Mechanism: AudioWorklet (16 kHz PCM16) → Streaming STT (Deepgram Flux / gemini-3.5-transcribe-live / mock) → conv.submit() → Harness.observeConversation() (pi.live LiveDoc deltas) → SpeakabilityChunker → Streaming TTS (ElevenLabs Multi-Context WS / Cartesia Sonic / gemini-3.8-flash-tts / mock).

pnpm exec tsx examples/29-voice-cascaded-stream/run.ts # :7491 + /shell/ with custom:voice-cascaded panel
pnpm exec tsx examples/29-voice-cascaded-stream/run.ts --smoke # offline verification, exit 0
# Live cloud adapters (requires keys in .env)
dotenvx run -- pnpm exec tsx examples/29-voice-cascaded-stream/run.ts \
--stt deepgram --tts elevenlabs --model google:gemini-4-hydrogen
Open http://127.0.0.1:7491/shell/ to see the Chat panel in the center and Voice: Cascaded Stream in the right rail (voice-cascaded.js). Both share the same agent.sqlite conversation.
Checks
| Check | What it proves |
|---|---|
streams-clauses-before-turn-end | tts_clause and binary 24 kHz PCM frames arrive over /api/voice before turn_done. |
code-blocks-summarized-not-read | SpeakabilityChunker replaces fenced code blocks with "I included a code block; check the chat panel." instead of reading raw syntax aloud. |
barge-in-aborts-durable-generation | Sending barge_in mid-stream cancels the TTS context, calls conv.abort(), emits interrupt, and increments VoiceSessionDoc.bargeIns. |
shared-durable-ledger-with-chat | Spoken turns appear inside GET /api/state alongside typed chat. |
substrate-component-served | /shell/manifest.json includes custom:voice-cascaded and /shell/custom/voice-cascaded.js returns 200. |
Break it
In examples/29-voice-cascaded-stream/run.ts, remove await conv.abort(ctx) inside triggerBargeIn. The barge-in-aborts-durable-generation check keeps waiting on the held generation or leaves the conversation busy, and --smoke fails.
Files
run.ts:serveAgent+/api/voiceWebSocket bridge, STT/TTS adapters, and--smoke.components/voice-cascaded.js: Zero-dependency Substrate Shell panel with inlineAudioWorkletcapture & playback ring buffer.PROMPT.md: Prompt to rebuild this lab.