From 8b82e4885fedba1971f5e723c4343c7bb2fefa48 Mon Sep 17 00:00:00 2001 From: Wiktor Golicz Date: Thu, 12 Nov 2026 19:34:11 +0100 Subject: [PATCH 1/3] feat(speech): add Meta batch dictation --- .../features/settings/CloudVoiceSection.tsx | 8 +- apps/server/src/serverSettings.test.ts | 16 +- .../sourceControlHostSecrets.test.ts | 2 +- apps/server/src/speech/CloudSpeech.test.ts | 213 +++++++++++------- apps/server/src/speech/CloudSpeech.ts | 72 +++++- apps/server/src/speech/http.test.ts | 2 + .../settings/CloudVoiceConfiguration.tsx | 6 +- .../settings/VoiceSettingsPanel.tsx | 4 +- .../src/components/settings/settingsSearch.ts | 2 +- docs/user/voice-input.md | 7 +- packages/contracts/src/settings.ts | 6 +- packages/contracts/src/speech.ts | 7 +- 12 files changed, 246 insertions(+), 99 deletions(-) diff --git a/apps/mobile/src/features/settings/CloudVoiceSection.tsx b/apps/mobile/src/features/settings/CloudVoiceSection.tsx index 6ca61ece7b90a..3e6cc4d1c50bb 100644 --- a/apps/mobile/src/features/settings/CloudVoiceSection.tsx +++ b/apps/mobile/src/features/settings/CloudVoiceSection.tsx @@ -287,7 +287,13 @@ function CloudChoices({ environment, active, onClose }: Props & { onClose: () => leading={ diff --git a/apps/server/src/serverSettings.test.ts b/apps/server/src/serverSettings.test.ts index 347b43dd6f44c..ccdebaab5294f 100644 --- a/apps/server/src/serverSettings.test.ts +++ b/apps/server/src/serverSettings.test.ts @@ -1753,7 +1753,11 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("server settings" const hub = UsageLimitSourceId.make("hub"); const router = ProviderInstanceId.make("openrouter"); const withUsage = yield* serverSettings.updateSettings({ - cloudSpeechCredentials: { openai: usageReference, xai: "literal-fixture" }, + cloudSpeechCredentials: { + openai: usageReference, + xai: "literal-fixture", + meta: usageReference, + }, textGenerators: { [router]: { kind: "openaiCompatible", @@ -1811,6 +1815,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("server settings" openai: SECRET_REDACTED, xai: SECRET_REDACTED, openrouter: "", + meta: SECRET_REDACTED, }); assert.equal(legacy.sourceControlHosts.bitbucket?.accessToken, SECRET_REDACTED); assert.equal(legacy.usageLimitSources[hub]?.managementKey, SECRET_REDACTED); @@ -1841,6 +1846,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("server settings" openai: usageReference, xai: "literal-fixture", openrouter: "", + meta: usageReference, }); assert.deepEqual(echoed.easDeviceHosts[0]?.accessToken, easReference); assert.deepEqual(echoed.simlockDeviceHosts[0]?.agentToken, simlockReference); @@ -1926,7 +1932,12 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("server settings" "ghe.acme.test": work, }); assert.equal(removed.usageLimitSources[hub]?.managementKey, ""); - assert.deepEqual(removed.cloudSpeechCredentials, { openai: "", xai: work, openrouter: "" }); + assert.deepEqual(removed.cloudSpeechCredentials, { + openai: "", + xai: work, + openrouter: "", + meta: "", + }); assert.equal(removed.easDeviceHosts[0]?.accessToken, ""); assert.deepEqual(Object.keys(removed.secretProviders), ["work"]); }).pipe(Effect.provide(layerServerSettingsWithSecrets())), @@ -1939,6 +1950,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("server settings" "cloudSpeechCredentials.openai", "cloudSpeechCredentials.xai", "cloudSpeechCredentials.openrouter", + "cloudSpeechCredentials.meta", "easDeviceHosts.[].accessToken", "simlockDeviceHosts.[].agentToken", "usageLimitSources.*.managementKey", diff --git a/apps/server/src/sourceControl/sourceControlHostSecrets.test.ts b/apps/server/src/sourceControl/sourceControlHostSecrets.test.ts index 9f73b2512841c..073ed1bcefae1 100644 --- a/apps/server/src/sourceControl/sourceControlHostSecrets.test.ts +++ b/apps/server/src/sourceControl/sourceControlHostSecrets.test.ts @@ -176,7 +176,7 @@ it.effect("reads a collected reference again once it is invalidated", () => resolver, Effect.succeed({ sourceControlHosts: hosts, - cloudSpeechCredentials: { openai: source("voice#key"), xai: "", openrouter: "" }, + cloudSpeechCredentials: { openai: source("voice#key"), xai: "", openrouter: "", meta: "" }, usageLimitSources, textGenerators: {}, easDeviceHosts, diff --git a/apps/server/src/speech/CloudSpeech.test.ts b/apps/server/src/speech/CloudSpeech.test.ts index 112c7a88d9b3b..36338e2c2fb38 100644 --- a/apps/server/src/speech/CloudSpeech.test.ts +++ b/apps/server/src/speech/CloudSpeech.test.ts @@ -10,90 +10,139 @@ import { expect, vi } from "vite-plus/test"; import * as ServerSettings from "../serverSettings.ts"; import * as CloudSpeech from "./CloudSpeech.ts"; -it.effect.each(["openai", "xai"] as const)("sends only to %s using its own saved key", (provider) => - Effect.gen(function* () { - const reference = { - provider: SecretProviderId.make("work"), - reference: "op://Work/Voice/key", - }; - let resolved: string | undefined; - let cached: string | undefined; - const read = vi.fn(() => Effect.sync(() => [(cached ??= resolved)])); - const upstream = vi.fn(async () => Response.json({ text: "hello" })); - const service = yield* CloudSpeech.CloudSpeech.pipe( - Effect.provide( - CloudSpeech.layer.pipe( - Layer.provide(FetchHttpClient.layer), - Layer.provide(ServerSettings.ServerSettingsService.layerTest()), - Layer.provide( - Layer.mock(SecretResolver.SecretResolver)({ - read, - label: () => Effect.succeed("Work"), - invalidate: () => - Effect.sync(() => { - cached = undefined; - }), - }), +it.effect.each(["openai", "xai", "meta"] as const)( + "sends only to %s using its own saved key", + (provider) => + Effect.gen(function* () { + const reference = { + provider: SecretProviderId.make("work"), + reference: "op://Work/Voice/key", + }; + let resolved: string | undefined; + let cached: string | undefined; + const read = vi.fn(() => Effect.sync(() => [(cached ??= resolved)])); + const upstream = vi.fn(async () => + Response.json(provider === "meta" ? { transcript: "hello" } : { text: "hello" }), + ); + const service = yield* CloudSpeech.CloudSpeech.pipe( + Effect.provide( + CloudSpeech.layer.pipe( + Layer.provide(FetchHttpClient.layer), + Layer.provide(ServerSettings.ServerSettingsService.layerTest()), + Layer.provide( + Layer.mock(SecretResolver.SecretResolver)({ + read, + label: () => Effect.succeed("Work"), + invalidate: () => + Effect.sync(() => { + cached = undefined; + }), + }), + ), ), ), - ), - ); - const transcribe = (pcm = new Uint8Array(new Float32Array([0, 0.5]).buffer)) => - service - .transcribe(provider, pcm, { - ...DEFAULT_SPEECH_TRANSCRIPTION_OPTIONS, - speechLanguage: "en", - speechCustomWords: [{ term: "T3 Code", aliases: [] }], - }) - .pipe(Effect.provideService(FetchHttpClient.Fetch, upstream)); - yield* service.setKey(provider === "openai" ? "xai" : "openai", Redacted.make("other")); - expect((yield* Effect.flip(transcribe()))._tag).toBe("CloudSpeechError"); - yield* service.setKey(provider, Redacted.make("chosen")); - expect(yield* service.configured).toEqual({ openai: true, xai: true, openrouter: false }); - yield* Effect.flip(transcribe(new Uint8Array(3))); - expect(upstream).not.toHaveBeenCalled(); - expect(yield* transcribe()).toBe("hello"); - const [url, init] = upstream.mock.calls[0]!; - expect(String(url)).toBe( - { - openai: "https://api.openai.com/v1/audio/transcriptions", - xai: "https://api.x.ai/v1/stt", - }[provider], - ); - expect(init?.redirect).toBe("error"); - expect(new Headers(init?.headers).get("authorization")).toBe("Bearer chosen"); - const form = init?.body as FormData; - expect(form.get("model")).toBe( - provider === "openai" ? "gpt-transcribe" : "grok-voice-transcribe-2.0", - ); - expect(form.getAll(provider === "openai" ? "keywords[]" : "keyterm")).toEqual(["T3 Code"]); - expect(form.get(provider === "openai" ? "languages[]" : "language")).toBe("en"); - expect([...form.keys()].at(-1)).toBe("file"); - const wav = new DataView(yield* Effect.promise(() => (form.get("file") as Blob).arrayBuffer())); - expect(wav.getUint32(24, true)).toBe(16_000); - expect(wav.getInt16(46, true)).toBe(16384); - upstream.mockResolvedValueOnce(new Response("sensitive upstream diagnostic", { status: 401 })); - expect(yield* Effect.flip(transcribe())).toMatchObject({ provider, reason: "rejected-key" }); - yield* service.setKey(provider, null); - expect((yield* service.configured)[provider]).toBe(false); - yield* Effect.flip(transcribe()); - expect(upstream).toHaveBeenCalledTimes(2); - yield* service.setKey(provider, reference); - expect((yield* service.configured)[provider]).toBe(true); - expect(read).not.toHaveBeenCalled(); - resolved = "resolved-fixture"; - expect(yield* transcribe()).toBe("hello"); - expect(read).toHaveBeenCalledWith([reference]); - expect(new Headers(upstream.mock.calls[2]?.[1]?.headers).get("authorization")).toBe( - "Bearer resolved-fixture", - ); - resolved = undefined; - expect(yield* Effect.flip(transcribe())).toMatchObject({ - provider, - reason: "unreadable-key", - }); - expect(upstream).toHaveBeenCalledTimes(3); - }), + ); + const transcribe = ( + pcm = new Uint8Array(new Float32Array([0, 0.5]).buffer), + speechLanguage = "en", + ) => + service + .transcribe(provider, pcm, { + ...DEFAULT_SPEECH_TRANSCRIPTION_OPTIONS, + speechLanguage, + speechCustomWords: [{ term: "T3 Code", aliases: [] }], + }) + .pipe(Effect.provideService(FetchHttpClient.Fetch, upstream)); + yield* service.setKey(provider === "openai" ? "xai" : "openai", Redacted.make("other")); + expect((yield* Effect.flip(transcribe()))._tag).toBe("CloudSpeechError"); + yield* service.setKey(provider, Redacted.make("chosen")); + expect((yield* service.configured)[provider]).toBe(true); + yield* Effect.flip(transcribe(new Uint8Array(3))); + expect(upstream).not.toHaveBeenCalled(); + expect(yield* transcribe()).toBe("hello"); + const [url, init] = upstream.mock.calls[0]!; + expect(String(url)).toBe( + { + openai: "https://api.openai.com/v1/audio/transcriptions", + xai: "https://api.x.ai/v1/stt", + meta: "https://api.meta.ai/v1/asr/transcribe", + }[provider], + ); + expect(init?.redirect).toBe("error"); + expect(new Headers(init?.headers).get("authorization")).toBe("Bearer chosen"); + const form = init?.body as FormData; + if (provider === "meta") { + expect(new Headers(init?.headers).get("accept")).toBe("application/json"); + const request = form.get("request") as Blob; + expect(request.type).toBe("application/json"); + expect(JSON.parse(yield* Effect.promise(() => request.text()))).toEqual({ + model: "muse-voice-transcribe-1.0", + audioEncoding: "WAV", + mode: "PUSH_TO_TALK", + languageBias: ["English"], + keywords: ["T3 Code"], + }); + expect([...form.keys()]).toEqual(["request", "audio"]); + } else { + expect(form.get("model")).toBe( + provider === "openai" ? "gpt-transcribe" : "grok-voice-transcribe-2.0", + ); + expect(form.getAll(provider === "openai" ? "keywords[]" : "keyterm")).toEqual(["T3 Code"]); + expect(form.get(provider === "openai" ? "languages[]" : "language")).toBe("en"); + expect([...form.keys()].at(-1)).toBe("file"); + } + const wav = new DataView( + yield* Effect.promise(() => + (form.get(provider === "meta" ? "audio" : "file") as Blob).arrayBuffer(), + ), + ); + expect(wav.getUint32(24, true)).toBe(16_000); + expect(wav.getInt16(46, true)).toBe(16384); + upstream.mockResolvedValueOnce( + new Response("sensitive upstream diagnostic", { status: 401 }), + ); + expect(yield* Effect.flip(transcribe())).toMatchObject({ provider, reason: "rejected-key" }); + if (provider === "meta") { + for (const [status, reason] of [ + [403, "rejected-key"], + [429, "rate-limit"], + [500, "unavailable"], + ] as const) { + upstream.mockResolvedValueOnce(new Response("sensitive upstream diagnostic", { status })); + expect(yield* Effect.flip(transcribe())).toMatchObject({ provider, reason }); + } + upstream.mockResolvedValueOnce(Response.json({ text: "wrong schema" })); + expect(yield* Effect.flip(transcribe())).toMatchObject({ provider, reason: "unavailable" }); + for (const language of ["auto", "ru", "pl"]) { + expect(yield* transcribe(undefined, language)).toBe("hello"); + const body = upstream.mock.lastCall![1]!.body as FormData; + const request = JSON.parse( + yield* Effect.promise(() => (body.get("request") as Blob).text()), + ); + expect(request.languageBias).toEqual(language === "pl" ? ["Polish"] : undefined); + } + upstream.mockClear(); + } + yield* service.setKey(provider, null); + expect((yield* service.configured)[provider]).toBe(false); + yield* Effect.flip(transcribe()); + expect(upstream).toHaveBeenCalledTimes(provider === "meta" ? 0 : 2); + yield* service.setKey(provider, reference); + expect((yield* service.configured)[provider]).toBe(true); + expect(read).not.toHaveBeenCalled(); + resolved = "resolved-fixture"; + expect(yield* transcribe()).toBe("hello"); + expect(read).toHaveBeenCalledWith([reference]); + expect(new Headers(upstream.mock.lastCall?.[1]?.headers).get("authorization")).toBe( + "Bearer resolved-fixture", + ); + resolved = undefined; + expect(yield* Effect.flip(transcribe())).toMatchObject({ + provider, + reason: "unreadable-key", + }); + expect(upstream).toHaveBeenCalledTimes(provider === "meta" ? 1 : 3); + }), ); it.effect("uploads to OpenRouter only for a listed exact model, as zero-retention JSON WAV", () => diff --git a/apps/server/src/speech/CloudSpeech.ts b/apps/server/src/speech/CloudSpeech.ts index 3b7eab6b5242b..4da25d4cb059c 100644 --- a/apps/server/src/speech/CloudSpeech.ts +++ b/apps/server/src/speech/CloudSpeech.ts @@ -30,6 +30,7 @@ import { decodeSpeechPcm, SpeechInvalidAudioError } from "./SpeechService.ts"; const endpoints = { openai: { url: "https://api.openai.com/v1/audio/transcriptions", model: "gpt-transcribe" }, xai: { url: "https://api.x.ai/v1/stt", model: "grok-voice-transcribe-2.0" }, + meta: { url: "https://api.meta.ai/v1/asr/transcribe" }, openrouter: { url: "https://openrouter.ai/api/v1/audio/transcriptions" }, }; const OPENROUTER_CATALOG_URL = @@ -92,6 +93,57 @@ function audioBody( return HttpClientRequest.bodyFormData(form); } +const metaLanguages: Readonly> = { + ar: "Arabic", + bn: "Bengali", + nl: "Dutch", + en: "English", + fr: "French", + de: "German", + he: "Hebrew", + hi: "Hindi", + id: "Indonesian", + it: "Italian", + ja: "Japanese", + kn: "Kannada", + ko: "Korean", + ms: "Malay", + zh: "Mandarin Chinese", + mr: "Marathi", + pl: "Polish", + pt: "Portuguese", + es: "Spanish", + tl: "Tagalog", + ta: "Tamil", + te: "Telugu", + th: "Thai", + tr: "Turkish", + vi: "Vietnamese", +}; +const MetaTranscriptionResult = Schema.Struct({ transcript: Schema.String }); + +function metaBody(audio: ArrayBuffer, options: SpeechTranscriptionOptions) { + const language = metaLanguages[options.speechLanguage]; + const form = new FormData(); + form.set( + "request", + new Blob( + [ + JSON.stringify({ + model: "muse-voice-transcribe-1.0", + audioEncoding: "WAV", + mode: "PUSH_TO_TALK", + ...(language ? { languageBias: [language] } : {}), + keywords: options.speechCustomWords.map(({ term }) => term), + }), + ], + { type: "application/json" }, + ), + ); + form.set("audio", new Blob([audio], { type: "audio/wav" }), "dictation.wav"); + return HttpClientRequest.bodyFormData(form); +} + function openRouterBody(model: string, audio: ArrayBuffer, language: string) { return HttpClientRequest.bodyJsonUnsafe({ model, @@ -130,10 +182,11 @@ export const layer = Layer.effect( Effect.map((value) => value.cloudSpeechCredentials), ); const configured = credentials.pipe( - Effect.map(({ openai, xai, openrouter }) => ({ + Effect.map(({ openai, xai, openrouter, meta }) => ({ openai: Boolean(openai), xai: Boolean(xai), openrouter: Boolean(openrouter), + meta: Boolean(meta), })), ); const execute = (request: HttpClientRequest.HttpClientRequest) => @@ -212,7 +265,10 @@ export const layer = Layer.effect( HttpClientRequest.bearerToken(Redacted.make(key)), provider === "openrouter" ? openRouterBody(model!, audio, language) - : audioBody(provider, audio, language, options), + : provider === "meta" + ? metaBody(audio, options) + : audioBody(provider, audio, language, options), + HttpClientRequest.acceptJson, ); const unavailable = () => new CloudSpeechError({ provider, reason: "unavailable" }); // A catalog fetch or vault lookup may have outlived the credential it started with. @@ -235,9 +291,15 @@ export const layer = Layer.effect( ? "model-unavailable" : "unavailable", }); - const { text } = yield* HttpClientResponse.schemaBodyJson( - EnvironmentSpeechTranscriptionResult, - )(response).pipe(Effect.mapError(unavailable)); + const text = yield* ( + provider === "meta" + ? HttpClientResponse.schemaBodyJson(MetaTranscriptionResult)(response).pipe( + Effect.map(({ transcript }) => transcript), + ) + : HttpClientResponse.schemaBodyJson(EnvironmentSpeechTranscriptionResult)( + response, + ).pipe(Effect.map(({ text }) => text)) + ).pipe(Effect.mapError(unavailable)); const corrected = applySpeechAliases(text, options.speechCustomWords); return ( options.speechRemoveFillerWords diff --git a/apps/server/src/speech/http.test.ts b/apps/server/src/speech/http.test.ts index d86f77fbdbd83..a9850e277e8f0 100644 --- a/apps/server/src/speech/http.test.ts +++ b/apps/server/src/speech/http.test.ts @@ -253,6 +253,8 @@ effectIt.effect( 422, ); expect(transcribe).toHaveBeenLastCalledWith("openrouter", "acme/transcribe-1"); + expect((yield* call("meta/transcribe", audio)).status).toBe(422); + expect(transcribe).toHaveBeenLastCalledWith("meta", undefined); // Naming a path on the environment needs filesystem access, not only settings access. const link = yield* Effect.promise(() => handler( diff --git a/apps/web/src/components/settings/CloudVoiceConfiguration.tsx b/apps/web/src/components/settings/CloudVoiceConfiguration.tsx index 95dcee4cffb45..10abbe3596e49 100644 --- a/apps/web/src/components/settings/CloudVoiceConfiguration.tsx +++ b/apps/web/src/components/settings/CloudVoiceConfiguration.tsx @@ -218,7 +218,11 @@ export function CloudVoiceConfiguration({ const destination = (): CloudDestination => routed && isModelId(model) ? { kind: "cloud", provider: "openrouter", environmentId: id, model } - : { kind: "cloud", provider: provider as "openai" | "xai", environmentId: id }; + : { + kind: "cloud", + provider: provider as Exclude, + environmentId: id, + }; const enable = () => chooseAudioDestination(destination()); const canSubmit = routed ? modelChosen && keyReady && (!active || modelChanged || keyChanged) diff --git a/apps/web/src/components/settings/VoiceSettingsPanel.tsx b/apps/web/src/components/settings/VoiceSettingsPanel.tsx index cfddfce72d154..345a552057ed0 100644 --- a/apps/web/src/components/settings/VoiceSettingsPanel.tsx +++ b/apps/web/src/components/settings/VoiceSettingsPanel.tsx @@ -144,7 +144,9 @@ function CloudSpeechLogo({ provider }: { provider: CloudSpeechProvider }) { return ; return ( diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.ts index 6a9ce0557ca5e..d0dbc73e54c3b 100644 --- a/apps/web/src/components/settings/settingsSearch.ts +++ b/apps/web/src/components/settings/settingsSearch.ts @@ -544,7 +544,7 @@ export const SETTINGS_SEARCH_ITEMS = [ title: "Transcribe with", to: "/settings/voice", searchTerms: [ - "send microphone audio dictation destination speech voice stt transcription environment machine consent privacy cloud OpenAI Grok OpenRouter", + "send microphone audio dictation destination speech voice stt transcription environment machine consent privacy cloud OpenAI Grok OpenRouter Meta", ], }, { diff --git a/docs/user/voice-input.md b/docs/user/voice-input.md index 95ea15d707d00..10d837f95e55a 100644 --- a/docs/user/voice-input.md +++ b/docs/user/voice-input.md @@ -24,7 +24,7 @@ Set it back to **Off** at any time; a recording in progress is discarded. If the chosen environment goes offline, voice input waits for it. T3 Code never substitutes another environment. -For cloud dictation, choose **OpenAI** or **Grok Voice Transcribe** via the environment +For cloud dictation, choose **OpenAI**, **Grok Voice Transcribe**, or **Meta Voice Transcribe** via the environment you want to use. If it needs a key, enter one and choose **Save and enable**. You can also choose a [secret provider](secrets.md) instead of **Value** and enter a reference. Unlock the vault on that environment before dictating. Anyone with @@ -36,6 +36,11 @@ subscription is needed. Switch back to **This device** on mobile or **Off** on web and desktop to stop sharing. Removing the key stops that provider for everyone on the environment. +**Meta Voice Transcribe** uses a Meta Model API key and the +`muse-voice-transcribe-1.0` model. It transcribes after you stop recording, with +language and dictionary hints sent alongside the audio. Unsupported language +hints are omitted so Meta can detect the language. + **OpenRouter** works the same way but has no default model: pick one from its live speech-to-text catalog when you enable it, or later under **Manage OpenRouter**. The model choice is yours alone and needs no settings access, so anyone with diff --git a/packages/contracts/src/settings.ts b/packages/contracts/src/settings.ts index 2844c8181324a..7fe1c6f2668a6 100644 --- a/packages/contracts/src/settings.ts +++ b/packages/contracts/src/settings.ts @@ -385,7 +385,7 @@ export const VoiceTranscriptionDestination = Schema.Union([ Schema.Struct({ kind: Schema.Literal("cloud"), environmentId: EnvironmentId, - provider: Schema.Literals(["openai", "xai"]), + provider: Schema.Literals(["openai", "xai", "meta"]), }), Schema.Struct({ kind: Schema.Literal("cloud"), @@ -1348,6 +1348,7 @@ export const CloudSpeechCredentials = Schema.Struct({ openai: CloudSpeechCredential, xai: CloudSpeechCredential, openrouter: CloudSpeechCredential, + meta: CloudSpeechCredential, }); export const ServerSettings = Schema.Struct({ @@ -1378,7 +1379,7 @@ export const ServerSettings = Schema.Struct({ enableAgentBrowserAccess: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))), cloudSpeechCredentials: CloudSpeechCredentials.pipe( - Schema.withDecodingDefault(Effect.succeed({ openai: "", xai: "", openrouter: "" })), + Schema.withDecodingDefault(Effect.succeed({ openai: "", xai: "", openrouter: "", meta: "" })), ), speechModelId: Schema.String.pipe( Schema.withDecodingDefault(Effect.succeed("handy-computer/parakeet-unified-en-0.6b-gguf")), @@ -1832,6 +1833,7 @@ export const ServerSettingsPatch = Schema.Struct({ openai: Schema.optionalKey(SettingsSecretValue), xai: Schema.optionalKey(SettingsSecretValue), openrouter: Schema.optionalKey(SettingsSecretValue), + meta: Schema.optionalKey(SettingsSecretValue), }), ), speechModelId: Schema.optionalKey(Schema.String), diff --git a/packages/contracts/src/speech.ts b/packages/contracts/src/speech.ts index ff3362f67fc0c..2fbbd627fbb6a 100644 --- a/packages/contracts/src/speech.ts +++ b/packages/contracts/src/speech.ts @@ -8,23 +8,26 @@ export const CloudSpeechApiKey = TrimmedNonEmptyString.check( Schema.isPattern(/^(?![a-z][a-z\d+.-]*:\/\/)[!-~]+$/i), ); -export const CloudSpeechProvider = Schema.Literals(["openai", "xai", "openrouter"]); +export const CloudSpeechProvider = Schema.Literals(["openai", "xai", "openrouter", "meta"]); export type CloudSpeechProvider = typeof CloudSpeechProvider.Type; export const CLOUD_SPEECH_LABELS = { openai: "OpenAI", xai: "Grok Voice Transcribe", openrouter: "OpenRouter", + meta: "Meta Voice Transcribe", } as const; export const CLOUD_SPEECH_PROVIDER_NAMES = { openai: "OpenAI", xai: "xAI", openrouter: "OpenRouter", + meta: "Meta", } as const; -/** Servers that predate OpenRouter report only the first two providers. */ +/** Older servers omit providers they do not support. */ export const CloudSpeechKeys = Schema.Struct({ openai: Schema.Boolean, xai: Schema.Boolean, openrouter: Schema.optionalKey(Schema.Boolean), + meta: Schema.optionalKey(Schema.Boolean), }); export type CloudSpeechKeys = typeof CloudSpeechKeys.Type; From 6d581cd1d5fcfaf5cd880b1ed27c5c275c181a4a Mon Sep 17 00:00:00 2001 From: Wiktor Golicz Date: Thu, 12 Nov 2026 20:06:30 +0100 Subject: [PATCH 2/3] fix(web): show update guidance for unsupported Meta dictation --- .../web/src/components/settings/CloudVoiceConfiguration.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/settings/CloudVoiceConfiguration.tsx b/apps/web/src/components/settings/CloudVoiceConfiguration.tsx index 10abbe3596e49..853553513d467 100644 --- a/apps/web/src/components/settings/CloudVoiceConfiguration.tsx +++ b/apps/web/src/components/settings/CloudVoiceConfiguration.tsx @@ -347,11 +347,13 @@ export function CloudVoiceConfiguration({ - ) : routed && + ) : (routed || provider === "meta") && AsyncResult.isSuccess(presence) && presence.value && saved === undefined ? ( -

Update {environment.label} to use OpenRouter dictation.

+

+ Update {environment.label} to use {name} dictation. +

) : saved === undefined ? (

Checking for an API key…

) : routed ? ( From 589fc2d2008c2635d0982dd46f8c1d525a94ad02 Mon Sep 17 00:00:00 2001 From: muse Date: Thu, 19 Nov 2026 10:50:34 +0000 Subject: [PATCH 3/3] fix(web): translate regenerated Meta dictation strings The Meta provider generalized two voice settings strings, leaving the locale catalogs with stale keys and untranslated entries. Regenerate en.json and translate the new keys in every locale. --- apps/web/src/i18n/translations/de.json | 12 +++++++++--- apps/web/src/i18n/translations/en.json | 12 +++++++++--- apps/web/src/i18n/translations/es.json | 12 +++++++++--- apps/web/src/i18n/translations/fr.json | 12 +++++++++--- apps/web/src/i18n/translations/ja.json | 11 ++++++++--- apps/web/src/i18n/translations/ko.json | 11 ++++++++--- apps/web/src/i18n/translations/pt-BR.json | 12 +++++++++--- apps/web/src/i18n/translations/ru.json | 12 +++++++++--- apps/web/src/i18n/translations/sv.json | 12 +++++++++--- apps/web/src/i18n/translations/zh.json | 12 +++++++++--- 10 files changed, 88 insertions(+), 30 deletions(-) diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 5aca70101b1f3..8e9f6286d430f 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -7684,14 +7684,20 @@ ", um fortzufahren." ], "1d33877ef8ea3559": "Laden des API-Schlüssels wiederholen", - "be805c1729dc0726": [ + "2b5b356019c6857b": [ "Aktualisiere ", { "i": 1, "k": "_gt_value_1", "v": "v" }, - ", um OpenRouter-Diktat zu nutzen." + ", um ", + { + "i": 2, + "k": "_gt_value_2", + "v": "v" + }, + "-Diktat zu nutzen." ], "d7acad5dde4c1d1b": "Es wird nach einem API-Schlüssel gesucht…", "8257030da7a4ad4e": "Modell", @@ -11425,7 +11431,7 @@ "fea2dc36585c4a20": "Simlock-Geräte-Hosts (Alpha)", "9d834d178130180e": "beta alpha simlock callstack simulator emulator ios android pool lease gateway", "bcb520297a9ae143": "beta schneller worktree checkout klonen apfs copy-on-write cache macos geschwindigkeit", - "4c83ac419da342bd": "mikrofon audio senden diktat ziel sprache spracheingabe stt transkription umgebung rechner einwilligung datenschutz cloud OpenAI Grok OpenRouter", + "aa91364ad6fc950e": "mikrofon audio senden diktat ziel sprache spracheingabe stt transkription umgebung rechner einwilligung datenschutz cloud OpenAI Grok OpenRouter Meta", "f9c000e92379d027": "mikrofon eingabe audio gerät reihenfolge priorität bevorzugt", "22811f405e0b4b28": "sprache spracheingabe tastatur hotkey halten umschalten auto", "e27bccf50397d9fe": "sprache spracheingabe übersetzen englisch automatisch erkennen", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index 246e11939fd89..86e7d6a422844 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -7691,14 +7691,20 @@ " with dictation access to continue." ], "1d33877ef8ea3559": "Retry loading API key", - "be805c1729dc0726": [ + "2b5b356019c6857b": [ "Update ", { "i": 1, "k": "_gt_value_1", "v": "v" }, - " to use OpenRouter dictation." + " to use ", + { + "i": 2, + "k": "_gt_value_2", + "v": "v" + }, + " dictation." ], "d7acad5dde4c1d1b": "Checking for an API key…", "8257030da7a4ad4e": "Model", @@ -11433,7 +11439,7 @@ "fea2dc36585c4a20": "Simlock device hosts (alpha)", "9d834d178130180e": "beta alpha simlock callstack simulator emulator ios android pool lease gateway", "bcb520297a9ae143": "beta fast worktree checkout clone apfs copy-on-write cache macos speed", - "4c83ac419da342bd": "send microphone audio dictation destination speech voice stt transcription environment machine consent privacy cloud OpenAI Grok OpenRouter", + "aa91364ad6fc950e": "send microphone audio dictation destination speech voice stt transcription environment machine consent privacy cloud OpenAI Grok OpenRouter Meta", "f9c000e92379d027": "mic input audio device order priority preferred", "22811f405e0b4b28": "speech voice keyboard hotkey hold toggle auto", "e27bccf50397d9fe": "speech voice translate english auto detect", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 38fe66011ed56..9c95e129752b0 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -7683,14 +7683,20 @@ " con acceso al dictado para continuar." ], "1d33877ef8ea3559": "Reintentar la carga de la clave de API", - "be805c1729dc0726": [ + "2b5b356019c6857b": [ "Actualiza ", { "i": 1, "k": "_gt_value_1", "v": "v" }, - " para usar el dictado con OpenRouter." + " para usar el dictado con ", + { + "i": 2, + "k": "_gt_value_2", + "v": "v" + }, + "." ], "d7acad5dde4c1d1b": "Buscando una clave de API…", "8257030da7a4ad4e": "Modelo", @@ -11418,7 +11424,7 @@ "fea2dc36585c4a20": "Hosts de dispositivos Simlock (alfa)", "9d834d178130180e": "beta alfa simlock callstack simulador emulador ios android grupo préstamo gateway", "bcb520297a9ae143": "beta worktree rápido checkout clonar apfs copy-on-write caché macos velocidad", - "4c83ac419da342bd": "enviar audio del micrófono dictado destino voz habla stt transcripción entorno máquina consentimiento privacidad nube OpenAI Grok OpenRouter", + "aa91364ad6fc950e": "enviar audio del micrófono dictado destino voz habla stt transcripción entorno máquina consentimiento privacidad nube OpenAI Grok OpenRouter Meta", "f9c000e92379d027": "micrófono entrada audio dispositivo orden prioridad preferido", "22811f405e0b4b28": "voz habla teclado atajo mantener alternar automático", "e27bccf50397d9fe": "voz habla traducir inglés detectar automáticamente", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index 658857f98fc48..21ef10f1a8ba6 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -7684,14 +7684,20 @@ " avec l’accès à la dictée pour continuer." ], "1d33877ef8ea3559": "Réessayer de charger la clé API", - "be805c1729dc0726": [ + "2b5b356019c6857b": [ "Mettez à jour ", { "i": 1, "k": "_gt_value_1", "v": "v" }, - " pour utiliser la dictée OpenRouter." + " pour utiliser la dictée ", + { + "i": 2, + "k": "_gt_value_2", + "v": "v" + }, + "." ], "d7acad5dde4c1d1b": "Recherche d’une clé API…", "8257030da7a4ad4e": "Modèle", @@ -11423,7 +11429,7 @@ "fea2dc36585c4a20": "Hôtes d’appareils Simlock (alpha)", "9d834d178130180e": "bêta alpha simlock callstack simulateur émulateur ios android pool bail passerelle", "bcb520297a9ae143": "bêta rapide worktree extraction clone apfs copie sur écriture cache macos vitesse", - "4c83ac419da342bd": "envoyer microphone audio dictée destination parole voix stt transcription environnement machine consentement confidentialité cloud OpenAI Grok OpenRouter", + "aa91364ad6fc950e": "envoyer microphone audio dictée destination parole voix stt transcription environnement machine consentement confidentialité cloud OpenAI Grok OpenRouter Meta", "f9c000e92379d027": "micro entrée audio appareil ordre priorité préféré", "22811f405e0b4b28": "parole voix clavier raccourci maintenir basculer auto", "e27bccf50397d9fe": "parole voix traduire anglais détection auto", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index a405829ae1a06..2e89e400b40bc 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -7648,8 +7648,13 @@ " に接続してください。" ], "1d33877ef8ea3559": "API キーの読み込みを再試行", - "be805c1729dc0726": [ - "OpenRouter の音声入力を使うには ", + "2b5b356019c6857b": [ + { + "i": 2, + "k": "_gt_value_2", + "v": "v" + }, + " の音声入力を使うには ", { "i": 1, "k": "_gt_value_1", @@ -11373,7 +11378,7 @@ "fea2dc36585c4a20": "Simlock デバイスホスト (アルファ版)", "9d834d178130180e": "ベータ アルファ simlock callstack シミュレーター エミュレーター iOS Android プール リース ゲートウェイ simulator", "bcb520297a9ae143": "ベータ 高速 ワークツリー チェックアウト クローン APFS コピーオンライト キャッシュ macOS 速度 fast worktree", - "4c83ac419da342bd": "送信 マイク 音声 音声入力 送信先 発話 STT 文字起こし 環境 マシン 同意 プライバシー クラウド OpenAI Grok OpenRouter dictation", + "aa91364ad6fc950e": "送信 マイク 音声 音声入力 送信先 発話 STT 文字起こし 環境 マシン 同意 プライバシー クラウド OpenAI Grok OpenRouter dictation Meta", "f9c000e92379d027": "マイク 入力 オーディオ デバイス 順序 優先 優先度 mic", "22811f405e0b4b28": "音声 キーボード ホットキー 長押し 切り替え 自動 hotkey", "e27bccf50397d9fe": "音声 翻訳 英語 自動検出 translate", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index c5690cb564f42..c78b19036fe52 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -7650,8 +7650,13 @@ "에 연결하세요." ], "1d33877ef8ea3559": "API 키 다시 불러오기", - "be805c1729dc0726": [ - "OpenRouter 받아쓰기를 사용하려면 ", + "2b5b356019c6857b": [ + { + "i": 2, + "k": "_gt_value_2", + "v": "v" + }, + " 받아쓰기를 사용하려면 ", { "i": 1, "k": "_gt_value_1", @@ -11370,7 +11375,7 @@ "fea2dc36585c4a20": "Simlock 기기 호스트(알파)", "9d834d178130180e": "베타 알파 simlock callstack 시뮬레이터 에뮬레이터 iOS Android 풀 임대 게이트웨이", "bcb520297a9ae143": "베타 빠른 워크트리 체크아웃 복제 apfs copy-on-write 캐시 macOS 속도", - "4c83ac419da342bd": "마이크 오디오 보내기 받아쓰기 대상 음성 stt 받아쓰기 환경 머신 동의 개인정보 클라우드 OpenAI Grok OpenRouter", + "aa91364ad6fc950e": "마이크 오디오 보내기 받아쓰기 대상 음성 stt 받아쓰기 환경 머신 동의 개인정보 클라우드 OpenAI Grok OpenRouter Meta", "f9c000e92379d027": "마이크 입력 오디오 장치 순서 우선순위 선호", "22811f405e0b4b28": "음성 키보드 단축키 길게 누르기 전환 자동", "e27bccf50397d9fe": "음성 번역 영어 자동 감지", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index 9c4552aed155b..d17c931e32757 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -7683,14 +7683,20 @@ " com acesso ao ditado para continuar." ], "1d33877ef8ea3559": "Tentar carregar a chave de API novamente", - "be805c1729dc0726": [ + "2b5b356019c6857b": [ "Atualize ", { "i": 1, "k": "_gt_value_1", "v": "v" }, - " para usar o ditado do OpenRouter." + " para usar o ditado com ", + { + "i": 2, + "k": "_gt_value_2", + "v": "v" + }, + "." ], "d7acad5dde4c1d1b": "Verificando se há uma chave de API…", "8257030da7a4ad4e": "Modelo", @@ -11422,7 +11428,7 @@ "fea2dc36585c4a20": "Hosts de dispositivos Simlock (alfa)", "9d834d178130180e": "beta alpha simlock callstack simulador emulador ios android pool lease gateway", "bcb520297a9ae143": "beta rápido worktree checkout clonar apfs copy-on-write cache macos velocidade", - "4c83ac419da342bd": "enviar áudio do microfone ditado destino fala voz stt transcrição ambiente máquina consentimento privacidade nuvem OpenAI Grok OpenRouter", + "aa91364ad6fc950e": "enviar áudio do microfone ditado destino fala voz stt transcrição ambiente máquina consentimento privacidade nuvem OpenAI Grok OpenRouter Meta", "f9c000e92379d027": "microfone entrada áudio dispositivo ordem prioridade preferido", "22811f405e0b4b28": "fala voz teclado atalho manter pressionado alternar automático", "e27bccf50397d9fe": "fala voz traduzir inglês detectar automaticamente", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 7e36f4bd730a1..aa2093d16fad8 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -7683,14 +7683,20 @@ " с доступом к диктовке, чтобы продолжить." ], "1d33877ef8ea3559": "Повторить загрузку API-ключа", - "be805c1729dc0726": [ + "2b5b356019c6857b": [ "Обновите ", { "i": 1, "k": "_gt_value_1", "v": "v" }, - ", чтобы использовать диктовку OpenRouter." + ", чтобы использовать диктовку ", + { + "i": 2, + "k": "_gt_value_2", + "v": "v" + }, + "." ], "d7acad5dde4c1d1b": "Проверка наличия API-ключа…", "8257030da7a4ad4e": "Модель", @@ -11423,7 +11429,7 @@ "fea2dc36585c4a20": "Хосты устройств Simlock (альфа)", "9d834d178130180e": "бета альфа simlock callstack симулятор эмулятор ios android пул аренда шлюз", "bcb520297a9ae143": "бета быстрый checkout рабочего дерева клон apfs copy-on-write кеш macos скорость", - "4c83ac419da342bd": "отправить звук микрофона диктовка назначение речь голос stt расшифровка окружение компьютер согласие конфиденциальность облако OpenAI Grok OpenRouter", + "aa91364ad6fc950e": "отправить звук микрофона диктовка назначение речь голос stt расшифровка окружение компьютер согласие конфиденциальность облако OpenAI Grok OpenRouter Meta", "f9c000e92379d027": "микрофон ввод звук устройство порядок приоритет предпочтительный", "22811f405e0b4b28": "речь голос клавиатура горячая клавиша удержание переключение авто", "e27bccf50397d9fe": "речь голос перевод английский автоопределение", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index 95bcd0b80080a..811b6eed56e59 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -7689,14 +7689,20 @@ " med dikteringsåtkomst för att fortsätta." ], "1d33877ef8ea3559": "Försök läsa in API-nyckeln igen", - "be805c1729dc0726": [ + "2b5b356019c6857b": [ "Uppdatera ", { "i": 1, "k": "_gt_value_1", "v": "v" }, - " för att använda diktering med OpenRouter." + " för att använda diktering med ", + { + "i": 2, + "k": "_gt_value_2", + "v": "v" + }, + "." ], "d7acad5dde4c1d1b": "Söker efter en API-nyckel…", "8257030da7a4ad4e": "Modell", @@ -11431,7 +11437,7 @@ "fea2dc36585c4a20": "Simlock-enhetsvärdar (alfa)", "9d834d178130180e": "beta alpha simlock callstack simulator emulator ios android pool lån gateway", "bcb520297a9ae143": "beta snabb worktree utcheckning klon apfs copy-on-write cache macos hastighet", - "4c83ac419da342bd": "skicka mikrofonljud diktering mål tal röst stt transkribering miljö dator samtycke integritet moln OpenAI Grok OpenRouter", + "aa91364ad6fc950e": "skicka mikrofonljud diktering mål tal röst stt transkribering miljö dator samtycke integritet moln OpenAI Grok OpenRouter Meta", "f9c000e92379d027": "mikrofon indata ljud enhet ordning prioritet föredragen", "22811f405e0b4b28": "tal röst tangentbord snabbtangent håll växla auto", "e27bccf50397d9fe": "tal röst översätt engelska identifiera automatiskt", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index 7f161ed108acf..807ae164e792e 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -7701,14 +7701,20 @@ " 以继续。" ], "1d33877ef8ea3559": "重新加载 API 密钥", - "be805c1729dc0726": [ + "2b5b356019c6857b": [ "请更新 ", { "i": 1, "k": "_gt_value_1", "v": "v" }, - " 以使用 OpenRouter 听写。" + " 以使用 ", + { + "i": 2, + "k": "_gt_value_2", + "v": "v" + }, + " 听写。" ], "d7acad5dde4c1d1b": "正在检查 API 密钥…", "8257030da7a4ad4e": "模型", @@ -11447,7 +11453,7 @@ "fea2dc36585c4a20": "Simlock 设备主机(早期测试)", "9d834d178130180e": "测试版 alpha simlock callstack 模拟器 ios android 池 租用 网关", "bcb520297a9ae143": "测试版 快速工作树检出 克隆 apfs 写时复制 缓存 macos 速度", - "4c83ac419da342bd": "发送 麦克风 音频 听写 目标 语音 stt 转写 环境 机器 授权 隐私 云 OpenAI Grok OpenRouter", + "aa91364ad6fc950e": "发送 麦克风 音频 听写 目标 语音 stt 转写 环境 机器 授权 隐私 云 OpenAI Grok OpenRouter Meta", "f9c000e92379d027": "麦克风 输入 音频 设备 顺序 优先级 首选", "22811f405e0b4b28": "语音 键盘 热键 长按 切换 自动", "e27bccf50397d9fe": "语音 翻译 英语 自动检测",