--- title: Browser Voice Agent Demo emoji: 🎙️ colorFrom: indigo colorTo: purple sdk: static app_build_command: npm run build app_file: dist/index.html custom_headers: cross-origin-embedder-policy: require-corp cross-origin-opener-policy: same-origin cross-origin-resource-policy: cross-origin --- # Browser Voice Agent Demo Browser-first, on-device voice agent demo with Gradio-style camouflage. The app is served locally with Vite during development and built as static assets for public deployment. ## Stack - `Vite` for local development, preview, and bundling - `Bun` for package management and tests - `@mlc-ai/web-llm` for local browser LLM inference - `@huggingface/transformers` for local ASR - Vendored Pocket TTS browser worker derived from `KevinAHM/pocket-tts-web` ## Local Development ```bash bun install bun run dev ``` Then open `http://localhost:3000`. The same dev server now carries the isolation headers, so Pocket can take the threaded path without a separate custom preview server. For a production-like static serve, use: ```bash bun run preview ``` That serves the built `dist/` output with the same COOP/COEP/CORP headers. ## Test ```bash bun test ``` ## Build ```bash bun run build ``` The production output is emitted to `dist/`. ## Pocket TTS Runtime The app now ships a built-in Pocket TTS browser runtime and same-origin model assets: - `src/vendor/pocket-tts/inference-worker.js` - `src/vendor/pocket-tts/sentencepiece.js` - `src/vendor/pocket-tts/CODE-LICENSE` - `src/vendor/pocket-tts/onnx/*` - `src/vendor/pocket-tts/tokenizer.model` - `src/vendor/pocket-tts/voices.bin` - `src/vendor/onnxruntime-web/*` Those files are copied into `dist/` during `bun run build` and served locally from: - `/pocket-tts/inference-worker.js` - `/pocket-tts/sentencepiece.js` - `/pocket-tts/onnx/*` - `/pocket-tts/tokenizer.model` - `/pocket-tts/voices.bin` - `/onnxruntime-web/*` The vendored worker code is Apache 2.0; its license file is preserved in [src/vendor/pocket-tts/CODE-LICENSE](/home/autark/src/private-voice-agent/src/vendor/pocket-tts/CODE-LICENSE). For best Pocket performance, serve the app with: - `Cross-Origin-Opener-Policy: same-origin` - `Cross-Origin-Embedder-Policy: require-corp` Without those headers, the worker still runs, but ONNX Runtime drops back to single-threaded WASM.