Repository navigation
Description
Part of #3705.
Blocked by #3706
Context
Google's dedicated live transcription model is gemini-3.5-transcribe-live; the epic links its protocol, model and ephemeral-token docs, checked 2026-11-08. Use the approved transport/SMART/event contract from #3706. Source pointers verified on main a63e564f02f9b1ab0462bb0ac02dbf8ea6eacee7 on 2026-11-08; verify named anchors again at pickup.
Server/client entry points are (SpeechProvider, packages/ui-sdk/src/server/speech.ts:26-43), (AsrClient, packages/ui-sdk/src/client/asr.ts:21-30) and (registerAsrClients, packages/ui-react/src/voice/asr-clients.ts:16-41). (AsrEvent, packages/ui-sdk/src/protocol.ts:2024-2024) distinguishes partial/final text; (const start, packages/ui-react/src/voice/use-dictation.ts:52-123) commits final words to the unsent capture. Existing PCM capture is (openConversationMicrophone, packages/ui-react/src/voice/conversation-pcm.ts:4-60); inspect/reuse the concrete audio code where appropriate without coupling dictation to live-conversation state. Deepgram's MediaRecorder/encoded-container path is not PCM.
Scope
Add a server Gemini dictation provider and matching root-registered browser ASR client using the dedicated text-only Live Transcribe API. Support the documented SMART/VERBATIM configuration under the approved design, bounded existing vocabulary hints and language behavior. Gemini may be supplied as one provider through the existing by-value seam while multi-provider selection is delivered separately; do not introduce a dependency on the entire live-conversation UI.
Keep the long-lived Google credential on the server; mint the documented constrained ephemeral session credential and use the exact vendor browser authentication/setup protocol. Stream correctly resampled mono PCM16 audio, map distinct interim/final messages, and implement bounded final drain, hard stop, cancellation, provider-close and expiry/error cleanup.
Out of scope
Conversational Gemini/TTS, function/tool calls, screen/chat-history context, paid benchmarks, new packages/frameworks, Gemini non-streaming saved-recording transcription and replaying recordings through a live session.
Acceptance criteria
- The model is explicitly
gemini-3.5-transcribe-live, with text transcription setup and approved SMART/VERBATIM behavior. Verify current model/API/installed dependency shapes at pickup; do not reuse the existing audio conversation adapter as if it were this API. - Browser material contains only the bounded ephemeral credential/config. The permanent key never reaches bundles, responses, logs or errors. Server constraints bind the actual model/modality/approved configuration; expiry and resumption behavior are documented accurately.
- Real browser capture produces correctly framed mono PCM16 at the documented sample rate, including non-16kHz hardware contexts. Chunk/buffer/network-backpressure budgets are explicit and bounded; no encoded WebM/Ogg is mislabeled as PCM.
- Revising interim text cannot append duplicates; each finalized segment commits once. SMART corrections/formatting affect unsent dictation only, never prior sent chat/provider history. Vocabulary uses existing bounded keyterms, not arbitrary corpus/context upload.
- Graceful Done flushes input/end signaling and waits for the approved final condition within a bounded timeout. Hard stop/cancel/unmount/superseded start releases tracks, AudioContext/worklet, timers, queues and socket; late events cannot mutate a replacement capture.
- Provider-ended or failed capture retains already heard text through existing review/failure semantics exactly once. Missing keys, token expiry, model errors or disconnect never trigger another provider automatically.
-
savedAudioremains false/absent unless a genuine separatetranscribeRecordingimplementation exists. Existing offline recording and receipt paths remain unchanged. - Run published SpeechProvider/AsrClient conformance, actual mounted-session integration and local WebSocket/real-browser capture proof. Mutations of final mapping, resampling/framing, credential constraints and teardown fail named intended assertions then pass after restoration.
- Update authoring/user/contract documentation, public schemas or API reports as needed, and the published-behavior changeset. Record keyless proof as protocol/resource evidence, not vendor accuracy/latency qualification.
Verification
Use deterministic Odysseus audio/transcript fixtures and a loopback vendor-transport double under the offline guard. Run the focused SDK/server/client conformance and actual browser capture suites, typecheck/lint, affected provider-history guard and PR preflight. Real Google calls belong to #3710 after separate authorization.
Contract impact
New built-in/provider-client behavior, credential/session/configuration and any additive capability/type surface require same-commit authoritative contract docs, CONTRACT: and a minor changeset. Reuse current public seams and preserve third-party compatibility; load release guidance before any proposed shipping/dependency change.
Approved design (folded 2026-11-08 from #3706)
Follow the selectable-dictation plan §2, §6 and §9, and the maintainer's decision D1–D4. Binding specifics:
- Built-in
createGeminiSpeechProvider(apiKey), idgemini, registered whenGEMINI_API_KEYis set (D3; read intoVoiceConfigand documented in the env descriptor) and accepted byVOICE_PROVIDER=gemini. A key never makes Gemini the default unless it is the only registered provider. This can land over the legacy single selection before ui-server: register and resolve selectable dictation providers #3707. - Capabilities:
streaming,interimResultsandkeytermstrue;endpointingfalse (manual Done);smartTranscriptiontrue; notranscribeRecording, sosavedAudiois false. createSessionmakes a single REST call,POST https://generativelanguage.googleapis.com/v1beta/auth_tokens(x-goog-api-key), withuses: 1,newSessionExpireTimenow+60 s,expireTimenow+11 min, andliveConnectConstraintslockingmodels/gemini-3.5-transcribe-live,responseModalities: ["TEXT"]andinputAudioTranscription { mode, customVocabulary }.modeisSMARTunless the session option asks forverbatim(D1 default on). Vocabulary uses the existing keyterms, ≤100 terms of ≤64 UTF-8 bytes. Language is auto-detected. There is no SDK dependency and no session resumption: a take ends at Google's 10-minute limit through provider-ended.- The session URL is the server-minted
wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContentConstrained. This is the SDK 2.24.0-observed path; the docs say v1beta, and ui-react: qualify Gemini dictation and provider switching on real devices #3710 resolves which applies. The client appends?access_token=<token>. - Client
GeminiAsrClient, registered asgeminiinregisterAsrClients: an AudioWorklet resamples the hardware rate to 16 kHz PCM16 LE. Share the worklet extracted fromopenConversationMicrophone, not its conversation state. Frames are 100 ms (3,200 B) base64realtimeInput.audio. Pre-setupCompletebuffering is capped at 5 s, with a 10 s handshake timeout.bufferedAmount> 256 KiB fails the take with a network error; audio is never silently dropped. - Events:
interimInputTranscription.text→partial(replace).inputTranscription.text→ onefinalwithendsTurn: finished ?? true, which clears the partial. Done sendsaudioStreamEndand waits up to 3 s forfinished/turnComplete. Hard stop releases tracks, context, worklet, timers, queue and socket. - Errors never echo the key or Google's text. Session failure gives
500 { error: "Gemini dictation session failed" }, and no other provider is tried. - Mutations (§9): final mapped as partial, resampler bypassed, constraint lock removed, teardown skipping
context.close().
Readiness
The approved transport, event and mode contract is folded in above. Ready once #3706 closes. No unresolved ruling remains.
Activity
schlessera commentedon Nov 8, 2026
2026-11-08: Folded the approved #3706 design (maintainer rulings D1–D4, schemas, states and proof split) into this body under Approved design. Source pointers were re-verified at main
a63e564f0. Design PR: #3713.schlessera commentedon Nov 8, 2026
Claiming (claim token
wi-3708-d12e), branchfeat/3708-gemini-dictation. The approved design is folded in from #3706 (PR #3713). This issue owns the optional SDK fields (smartTranscription,mode,label/destination); #3707 consumes them.schlessera commentedon Nov 8, 2026
Unblocked: #3706 is closed, so
scripts/sync-project.tsis removing theblockedlabel.CONTRACT: fix(ui-server,ui-react): send the REST auth-token shape and…
Merge #3707 registry into the Gemini dictation branch
CONTRACT: feat(ui-server,ui-react): add Gemini 3.5 Transcribe Live di…
schlessera commentedon Nov 8, 2026
Delivered by #3717, squash
723280eon main, milestone 0.45.0. It adds the built-ingeminidictation provider and its browserGeminiAsrClient:bidiGenerateContentSetup+fieldMasktogemini-3.5-transcribe-live, TEXT output and the transcription config. The REST body is checked against @google/genai 2.24.0's own serializer.mode. Interim text replaces the partial and each final commits once.Proof: independent review by gpt-6-astra; three findings fixed with failing-first and mutation receipts (see PR). Candidate run 42509003401 passed. Whether Google accepts the token, which endpoint version applies, SMART output and device behaviour remain for #3710.