Skip to content

ui-sdk: design selectable dictation providers and Gemini transcription #3706

Closed

Description

@schlessera

Part of #3705.

Context

The maintainer has requested selectable dictation providers and Gemini 3.5 Transcribe Live. The epic holds the upstream evidence and binding rules. Source pointers verified on main a63e564f02f9b1ab0462bb0ac02dbf8ea6eacee7 on 2026-11-08; verify named anchors again at pickup.

Current seams are (SpeechProvider, packages/ui-sdk/src/server/speech.ts:26-43), (AsrClient, packages/ui-sdk/src/client/asr.ts:21-30) and (createAsrClientRegistry, packages/ui-sdk/src/client/asr.ts:41-65). Selection is (pickSpeechProvider, packages/ui-server/src/voice/speech-providers.ts:127-155), and capture consumes (const start, packages/ui-react/src/voice/use-dictation.ts:52-123). The Settings frame is (SECTIONS, packages/ui-react/src/components/settings/settings-panel.tsx:27-37); #3616/#3617 establish the Voice destination and #3690 owns presentation. Existing operational preference storage is (getSetting, packages/ui-server/src/db/settings.ts:26-47). Track mapping is (Voice:, scripts/sync-project.ts:80-80).

Scope

Produce the source-backed integration/interaction design and durable decision amendment for this epic, before runtime implementation. Use the already verified dedicated gemini-3.5-transcribe-live API rather than transcription attached to a conversational audio model.

Specify:

  1. Multi-provider registration/discovery through existing seams, ids/duplicates, legacy by-value/VOICE_PROVIDER migration, explicit/saved/host default precedence, unavailable choices and zero/one/multiple-provider cases. Define authorization, persisted preference scope, revision/concurrent edits and exact additive HTTP/client schemas. Keep the prior live-provider setting independent.
  2. Selection/disclosure for a live dictation take and saved-recording upload: freeze the disclosed provider across asynchronous start, token mint, capability reads and any receipt/retry. No Settings save can retarget an active take or silently route saved audio to another service.
  3. A Gemini SpeechProvider plus matching AsrClient: server-held long-lived key; constrained ephemeral token/model/config, expiry/uses/resumption semantics; actual browser WebSocket auth; PCM capture/resampling/chunk bounds; interim/final mapping, endpointing and bounded drain/stop/error/cancel cleanup. Inspect the current SDK/dependencies or use the documented wire protocol; do not invent an SDK version/API.
  4. SMART/VERBATIM configuration and disclosure, vocabulary/language bounds, final-text/inline-correction semantics and any remaining maintainer choices. Include SMART in the selected feature scope; do not assume it grants command authority or silently changes other providers' output.
  5. Settings/pre-capture/error and saved-audio-unsupported flows at 320px/desktop, coordinated with the Voice pane and Epic: unified voice experience — one mic, one field (dictation + live conversation) #3690 without a circular dependency. Draw how zero/one/multiple and stale/default changes behave; using existing presentation until Epic: unified voice experience — one mic, one field (dictation + live conversation) #3690 lands is acceptable.
  6. Exact contract/code/test ownership and compatibility matrix. Update the dependent issue briefs with the approved outputs; unresolved product/architecture rulings must stay explicit needs: labels rather than becoming implied approvals.

Append the resulting decision to docs/decisions/dictation-speech.md or a focused linked record/index entry. Seed #3705 into the Voice epic mapping in scripts/sync-project.ts, preserving existing assignments.

Out of scope

Runtime Gemini/registry/UI implementation, new seams/packages or dependencies, paid calls/credentials, deployment, broad voice redesign, TTS/conversation features and Gemini saved-file transcription.

Acceptance criteria

  • A complete recommended design covers all six points with exact API/session/event/error examples, source evidence, alternatives and known limits; defaults and unsupported cases are explicit. Any required maintainer approval is distinguished from the proposal.
  • It states which Google claims are documentation facts and which still need real-provider/device qualification. It does not promise parity with all Pixel/Rambler UI features or claim that saved files work because streaming does.
  • It contains 320px/desktop mocks and state/compatibility tables, plus a bounded implementation/proof split matching the native children. Mandatory source citations resolve against inspected source.
  • Selected decisions are recorded durably and folded into the downstream issue bodies; if review/choices remain, record exact next questions and preserve their prerequisite/readiness state. Closing this investigation alone is not approval of an unresolved choice.
  • The epic is added to the Voice track mapping, with focused project-sync regression proof and no terminal --apply racing the workflow.

Verification

Inspect the exact Google docs linked by the epic and installed dependency declarations; no paid network call. Review the schema/mocks against the dictation, voice-permission, history and offline/saved-recording decisions. Run applicable documentation/lint/citation checks and bun run test tests/project-sync-main.test.ts tests/project-sync-item.test.ts for the mapping, plus required PR preflight before a PR.

Contract impact

Design and board mapping only. Propose contract changes explicitly, but do not claim runtime/schema additions have shipped. A later supported change needs CONTRACT:, same-commit authoritative documentation and an appropriate minor changeset; any break needs a maintainer ruling first.

Activity

  1. added
    type: spike
    area: ui-sdk
    area: ui-server
    area: ui-react
    area: ci
    area: docs
    priority: p2
    on Nov 8, 2026
  2. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    The requested outcome is selected dictation providers plus Gemini 3.5 Transcribe Live, including SMART transcription. The remaining work is the concrete compatibility/transport/selection and Settings design; the investigation produces that proposal and must distinguish any unresolved ruling from approval.

    Design schlessera/brain-kit#3706 under epic #3705; do not implement runtime code or make paid API calls.
    
    Read first:
    - The full epic #3705, this issue and its native implementation/qualification siblings.
    - SpeechProvider, packages/ui-sdk/src/server/speech.ts:26; AsrClient and createAsrClientRegistry, packages/ui-sdk/src/client/asr.ts:21 and :41.
    - pickSpeechProvider, packages/ui-server/src/voice/speech-providers.ts:127; createVoiceRoutes, packages/ui-server/src/routes/voice.ts:19; saved-recording provider claim, packages/ui-server/src/routes/transcriptions.ts:82.
    - Dictation start, packages/ui-react/src/voice/use-dictation.ts:52; Settings SECTIONS, packages/ui-react/src/components/settings/settings-panel.tsx:27. Verify anchors against current main.
    - docs/decisions/dictation-speech.md, provider-history.md, voice-permission.md and the saved-recording/offline rulings; docs/extending/speech.md; integration-contract.md and its relevant components; ROADMAP.md binding rules.
    - #3616/#3617 for Voice Settings coordination; #3690 for the independent voice presentation. Neither supplies a Gemini dictation adapter.
    - Google's Live Transcribe, model and ephemeral-token sources linked in the epic; verify current wire/SDK shapes and account limitations rather than infer them from a conversation model.
    
    Problem: server selection currently resolves one provider, while browser factories can already register alternatives. Gemini's dedicated streaming transcription requires PCM, its own partial/final protocol and bounded browser session credentials.
    
    Design: registration/discovery/migration/default precedence and authorization; per-take/upload disclosed provider binding and concurrency; constrained Gemini credentials and PCM/event/drain lifecycle; SMART versus VERBATIM/default/mode visibility; bounded language/vocabulary; saved-audio unsupported behavior; shared Voice Settings at 320px/desktop; and exact public contract/test ownership. State zero/one/multiple and removed/unavailable provider cases. Opening/saving Settings never starts capture or sends audio; no provider fallback or mid-take retargeting. Text remains an unsent draft and never gains tool/permission authority.
    
    Deliver a source-backed recommended contract and interaction design with alternatives, concrete request/error examples, 320px/desktop mocks, state tables and meaningful keyless/browser/mutation proof. Record it durably and fold approved outputs into the implementation briefs. Explicitly list any remaining maintainer choices; the proposal itself is not their approval. A streaming-only Gemini first delivery with honest saved-audio unavailability is required/acceptable; omitting Gemini or silently selecting another provider is not. Seed this epic in the Voice track mapping as scoped in the issue. Real-vendor/device claims require the separate qualification task and its authorization.
    
  3. added
    agent-ready
    on Nov 8, 2026
  4. self-assigned this
    on Nov 8, 2026
  5. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Claiming for implementation (claim token wi-3706-d12e), branch docs/3706-dictation-provider-design. Collision scan on the cited paths reports closure-only overlaps with unrelated draft PRs; no path collisions.

  6. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Maintainer decision, 2026-11-08:

    • D1: Gemini SMART transcription is on by default. A brain-wide Clean up as I speak switch in Voice settings turns it off, from the next take.
    • D2: The provider is switched in Settings only. The capture sheet names the destination; there is no per-take Change.
    • D3: Gemini is registered as a selectable choice whenever GEMINI_API_KEY is set. It never becomes the default on that basis alone, unless it is the only registered provider.
    • D4: The first take to a provider this device hasn't acknowledged shows the destination with an explicit Start before any session request or microphone access.

    Recorded in docs/decisions/dictation-speech.md. The design is in docs/plans/selectable-dictation.md (#3713).

  7. added this to the 0.45.0 milestone on Nov 8, 2026
  8. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Delivered by #3713, squash a3ca546 on main, milestone 0.45.0. It adds the design plan docs/plans/selectable-dictation.md, records rulings D1–D4 in docs/decisions/dictation-speech.md, and puts #3705 on the Voice track with a project-sync regression test. Mutation receipt: removing 3705 from the mapping fails the new test (Expected "Voice", Received undefined). The downstream briefs #3707–#3710 now include the approved design.

    Correction found in implementation review: §6's example token request used SDK option names (liveConnectConstraints, lockAdditionalFields). The REST wire uses bidiGenerateContentSetup and fieldMask, as @google/genai 2.24.0's own serializer shows. §4 also wrongly called legacy VOICE_PROVIDER misconfiguration a construction error; it stays a route-time 500. Both are corrected in the implementation PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: ciarea: docsarea: ui-reactarea: ui-sdkarea: ui-serverpriority: p2type: spike

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions