Skip to content

ui-server: register and resolve selectable dictation providers #3707

Closed

Description

@schlessera

Part of #3705.

Blocked by #3706

Context

Source pointers verified on main a63e564f02f9b1ab0462bb0ac02dbf8ea6eacee7 on 2026-11-08; verify named anchors again at pickup.

(speechProvider, packages/ui-server/src/app.ts:240-240), (pickSpeechProvider, packages/ui-server/src/voice/speech-providers.ts:127-155) and (createVoiceRoutes, packages/ui-server/src/routes/voice.ts:19-58) currently accept/select one provider. (app.put(path, packages/ui-server/src/routes/transcriptions.ts:82-111) independently selects the active provider before claiming a saved-audio receipt. Follow the approved design produced by #3706, not unapproved examples. The epic holds the shared compatibility and authority rules.

Scope

Implement multi-provider registration/discovery and deliberate per-operation resolution through the existing SpeechProvider and ASR model. Supply authenticated persisted dictation-default APIs consumed by the Settings child; preserve the exact approved ownership/precedence/compatibility rules.

Bind the selected/disclosed provider identity and capability snapshot at capture/upload admission. Keep active captures and saved-recording receipts/retries on their original provider even when another device changes the default. Missing/unavailable/unknown selections fail visibly; discovery never mints a credential and failures never pick another vendor/browser recognizer.

Out of scope

The Gemini protocol/client adapter, Settings visuals, dictation-versus-live gestures, provider credentials UI, new plugin/provider seams and changing existing saved-recording retry/tombstone/unknown-outcome policy.

Acceptance criteria

  • Approved registration/discovery/default/selection schemas are implemented and documented, with duplicate/invalid ids refused and no credential/key material in discovery/errors.
  • Existing single supplied speechProvider, environment/built-in selection and external by-value consumers retain the approved documented compatibility; browser speech remains opt-in.
  • Actual mounted routes select the exact requested/default provider in zero/one/multiple cases. Unknown, removed, unusable and unauthorized/stale preference updates have the approved outcomes without another provider being invoked.
  • A held session-mint/upload crossing a default change cannot send data or create a receipt for a different provider; ordinary repeat/retry never redispatches under a new provider identity.
  • Method-derived saved-audio capability remains honest. Selecting a streaming-only provider cannot silently transcribe through another service; local recordings remain available for playback/retention.
  • Public schemas/types/client APIs, environment descriptors and authoritative contract/HTTP docs match the implementation. Required changeset/conformance proof preserves existing external adapters.
  • A named mutation removing provider binding or enabling implicit fallback fails the intended mounted-route assertion and passes after restoration.

Verification

Use keyless provider doubles installed below the shared request path, actual authentication/mounted routes and held concurrency boundaries. Run focused server/SDK tests including external speech and saved transcription, typecheck/lint, the affected provider-history guard, and required PR preflight. No test network/vendor credential.

Contract impact

Additive SDK/construction/configuration, supported HTTP/discovery/settings/session selection and client API surfaces. CONTRACT: implementation, authoritative docs/schema/API report updates and minor changeset. Preserve existing meanings; a necessary break goes back for a maintainer ruling.

Approved design (folded 2026-11-08 from #3706)

Follow the selectable-dictation plan §4, §5, §8 and §9, and the maintainer's decision D1–D4. Binding specifics:

  • Registered set is fixed at construction: Deepgram when DEEPGRAM_API_KEY is set, Gemini when GEMINI_API_KEY is set (once ui-react, ui-server: add Gemini 3.5 Transcribe Live dictation #3708's built-in exists; D3), browser speech only via VOICE_PROVIDER=webspeech, plus new createApp({ speechProviders }). The legacy speechProvider still replaces every built-in. Supplying both options, or any duplicate id, is a construction error.
  • Host default: defaultSpeechProviderId ?? VOICE_PROVIDER ?? deepgram when it is registered. An unregistered host default is a construction error.
  • Effective provider: the saved brain-wide default if registered. A saved default that is not registered blocks dictation, with no fallback. Otherwise the host default, otherwise the only registered provider, otherwise none (a choice is required when 2+ are registered). The §4 table is the acceptance matrix.
  • GET /api/voice/providers (read-only, never mints) returns providers[] (id, label, destination?, capabilities incl. the new optional smartTranscription) and dictation { saved, savedUsable, host, effective, source, smart, revision }. GET /voice/capabilities stays unchanged and reports the effective provider.
  • GET/PUT /api/voice/dictation/settings is stored as KV voice.dictation { defaultProvider, smart (default true), revision }. Writes use If-Match, need a human owner (owner/ambient) and enforce that on this route. Error codes: 400 speech_provider_unknown, 409 dictation_settings_stale (with current), 428 when If-Match is missing, 403 owner_required. The route is separate from ui-react: configure the default live-conversation provider through Settings #3616's live-service route.
  • POST /voice/session takes an optional body { providerId, smart }. When providerId is present it is exact or 409 speech_provider_unavailable, with no mint and no substitution. An absent body keeps the legacy resolution.
  • Saved audio: the upload header Speech-Provider selects exactly that provider (409 speech_provider_unavailable / 501 saved_audio_unsupported before the claim). claim refuses a retry whose provider differs from the receipt's with 409 transcription_provider_mismatch and attaches the receipt. A missing header keeps the legacy resolution.
  • SDK: optional SpeechProvider.label/destination, createSession option mode?: "smart" | "verbatim", SpeechCapabilities.smartTranscription?. Protocol types VoiceProvidersResponse, DictationSettings, VoiceSessionRequest. Client API voiceSession(signal, { providerId, smart }), voiceProviders(), dictationSettings()/saveDictationSettings().
  • Mutations (§9): substituting the effective provider for providerId → the held-mint test fails; resolving the upload from the current default instead of the header → the held-upload test fails.

Source re-verified at main a63e564f0: the upload names no provider (const response, packages/ui-react/src/lib/recordings.ts:775-777), and the retry check compares only the attempt id (claim(, packages/ui-server/src/voice/transcription-store.ts:63-75).

Readiness

The approved schema and authority rules are folded in above. Ready once #3706 closes. No unresolved ruling remains.

Activity

  1. added
    type: feat
    area: ui-sdk
    area: ui-server
    priority: p2
    blocked
    contract
    on Nov 8, 2026
  2. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    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.

  3. self-assigned this
    on Nov 8, 2026
  4. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Claiming (claim token wi-3707-d12e), branch feat/3707-selectable-dictation-providers. The approved design is folded in from #3706 (PR #3713, awaiting its merge lease). Expected overlap with #3708 is limited to the optional SDK fields both briefs name.

  5. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Unblocked: #3706 is closed, so scripts/sync-project.ts is removing the blocked label.

  6. removed
    blocked
    on Nov 8, 2026
  7. added a commit that references this issue on Nov 8, 2026
  8. added this to the 0.45.0 milestone on Nov 8, 2026
  9. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Delivered by #3715, squash 18a0ba3 on main, milestone 0.45.0. It adds a multi-provider dictation registry, GET /voice/providers, GET/PUT /voice/dictation/settings, exact providerId session binding, the Speech-Provider upload binding and the transcription_provider_mismatch retry guard. Legacy single-provider behaviour is unchanged. During review, legacy misconfiguration was restored to a route-time 500 rather than a boot failure; the PR records the mutation receipt. Candidate proof run 42487214057 passed. One earlier run failed on an unrelated deadline flake, now filed as #3723. Gemini registration lands with #3708 and the Settings UI with #3709.

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

Metadata

Metadata

Assignees

Labels

area: ui-sdkarea: ui-servercontractpriority: p2type: feat

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions