From d5243045e26340e97036994e0b6564a220b7a3ac 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 | 232 +++++++++++------- apps/server/src/speech/CloudSpeech.ts | 75 +++++- 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, 261 insertions(+), 106 deletions(-) diff --git a/apps/mobile/src/features/settings/CloudVoiceSection.tsx b/apps/mobile/src/features/settings/CloudVoiceSection.tsx index 3e782d2457fa3..aac01f7643fa5 100644 --- a/apps/mobile/src/features/settings/CloudVoiceSection.tsx +++ b/apps/mobile/src/features/settings/CloudVoiceSection.tsx @@ -302,7 +302,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 5d46c916c3990..5df87369a9db2 100644 --- a/apps/server/src/serverSettings.test.ts +++ b/apps/server/src/serverSettings.test.ts @@ -1783,7 +1783,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", @@ -1841,6 +1845,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); @@ -1871,6 +1876,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); @@ -1974,7 +1980,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())), @@ -1987,6 +1998,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 1ada861d6d852..e81a7274542a2 100644 --- a/apps/server/src/speech/CloudSpeech.test.ts +++ b/apps/server/src/speech/CloudSpeech.test.ts @@ -10,97 +10,151 @@ 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; + }), + }), + ), ), ), - ), - ); - // A full dictionary plus a hint still stays within xAI's 100-term limit. - const words = Array.from({ length: 99 }, (_, index) => `word${index}`); - const transcribe = (pcm = new Uint8Array(new Float32Array([0, 0.5]).buffer)) => - service - .transcribe(provider, pcm, { - ...DEFAULT_SPEECH_TRANSCRIPTION_OPTIONS, - speechLanguage: "en", - speechCustomWords: ["T3 Code", ...words].map((term) => ({ term, aliases: [] })), - speechHints: ["Server"], - }) - .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([ - "Server", - "T3 Code", - ...words.slice(0, 98), - ]); - 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); - }), + ); + // A full dictionary plus a hint still stays within xAI's 100-term limit. + const words = Array.from({ length: 99 }, (_, index) => `word${index}`); + const transcribe = ( + pcm = new Uint8Array(new Float32Array([0, 0.5]).buffer), + speechLanguage = "en", + ) => + service + .transcribe(provider, pcm, { + ...DEFAULT_SPEECH_TRANSCRIPTION_OPTIONS, + speechLanguage, + speechCustomWords: ["T3 Code", ...words].map((term) => ({ term, aliases: [] })), + speechHints: ["Server"], + }) + .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: provider !== "meta", + openrouter: false, + meta: provider === "meta", + }); + 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: ["Server", "T3 Code", ...words.slice(0, 98)], + }); + 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([ + "Server", + "T3 Code", + ...words.slice(0, 98), + ]); + 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 31702c80a87ee..1d23765eea013 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 = @@ -95,6 +96,60 @@ 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: speechRecognitionWords( + options.speechHints, + 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, @@ -133,10 +188,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) => @@ -215,7 +271,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. @@ -238,9 +297,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 8bbf2d81bc065..953383f70dd03 100644 --- a/apps/server/src/speech/http.test.ts +++ b/apps/server/src/speech/http.test.ts @@ -252,6 +252,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 0a992f4f93b61..d251722ec3be3 100644 --- a/apps/web/src/components/settings/CloudVoiceConfiguration.tsx +++ b/apps/web/src/components/settings/CloudVoiceConfiguration.tsx @@ -228,7 +228,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 84a76f373c8be..40075685bd3fd 100644 --- a/apps/web/src/components/settings/VoiceSettingsPanel.tsx +++ b/apps/web/src/components/settings/VoiceSettingsPanel.tsx @@ -155,7 +155,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 1f38ed958d368..050af962a8eee 100644 --- a/apps/web/src/components/settings/settingsSearch.ts +++ b/apps/web/src/components/settings/settingsSearch.ts @@ -596,7 +596,7 @@ export const SETTINGS_SEARCH_ITEMS = [ to: "/settings/voice", searchTerms: [ msg( - "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 9831eeafd49f8..6287051d8ee7a 100644 --- a/docs/user/voice-input.md +++ b/docs/user/voice-input.md @@ -31,7 +31,7 @@ recording in a language can take longer while macOS downloads its speech model. filler-word removal are not available; the dictionary applies only when transcript cleanup is on. -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 @@ -43,6 +43,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 e7887f88f0369..d29b5bc012f58 100644 --- a/packages/contracts/src/settings.ts +++ b/packages/contracts/src/settings.ts @@ -398,7 +398,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"), @@ -1375,6 +1375,7 @@ export const CloudSpeechCredentials = Schema.Struct({ openai: CloudSpeechCredential, xai: CloudSpeechCredential, openrouter: CloudSpeechCredential, + meta: CloudSpeechCredential, }); export const ServerSettings = Schema.Struct({ @@ -1416,7 +1417,7 @@ export const ServerSettings = Schema.Struct({ /** Lets clients reach this machine's loopback ports over `/api/preview/tunnel`. */ enablePreviewTunnel: 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")), @@ -1886,6 +1887,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 0784c92be4ab6..60436ffc8043f 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 bfabcacda1f57466a74fee3d2d697519b3067083 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 --- apps/web/src/components/settings/CloudVoiceConfiguration.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/settings/CloudVoiceConfiguration.tsx b/apps/web/src/components/settings/CloudVoiceConfiguration.tsx index d251722ec3be3..7282f0942ea7a 100644 --- a/apps/web/src/components/settings/CloudVoiceConfiguration.tsx +++ b/apps/web/src/components/settings/CloudVoiceConfiguration.tsx @@ -371,13 +371,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 ? ( From ecee8d55b8f29ca6c0af45758c9e4de03de89513 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 7900e73186091..b5ff62238669b 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -7943,14 +7943,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", @@ -11856,7 +11862,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 5bdd7c383d319..e1883f77f8e34 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -7950,14 +7950,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", @@ -11864,7 +11870,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 91dbb2b07f50f..fd6da94518fcd 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -7942,14 +7942,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", @@ -11849,7 +11855,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 f5cf7e62a4744..15e238e761252 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -7943,14 +7943,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", @@ -11854,7 +11860,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 7e3be343b068b..7ba1d4a145af9 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -7907,8 +7907,13 @@ " に接続してください。" ], "1d33877ef8ea3559": "API キーの読み込みを再試行", - "be805c1729dc0726": [ - "OpenRouter の音声入力を使うには ", + "2b5b356019c6857b": [ + { + "i": 2, + "k": "_gt_value_2", + "v": "v" + }, + " の音声入力を使うには ", { "i": 1, "k": "_gt_value_1", @@ -11805,7 +11810,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 ef69858aead11..38055b7354682 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -7909,8 +7909,13 @@ "에 연결하세요." ], "1d33877ef8ea3559": "API 키 다시 불러오기", - "be805c1729dc0726": [ - "OpenRouter 받아쓰기를 사용하려면 ", + "2b5b356019c6857b": [ + { + "i": 2, + "k": "_gt_value_2", + "v": "v" + }, + " 받아쓰기를 사용하려면 ", { "i": 1, "k": "_gt_value_1", @@ -11801,7 +11806,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 5b2f82a27a416..c724b5d7c0fb0 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -7942,14 +7942,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", @@ -11854,7 +11860,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 2891cb8165d7c..d51cefaa9936e 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -7942,14 +7942,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": "Модель", @@ -11855,7 +11861,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 c792d6fb4a981..1beefbc023993 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -7948,14 +7948,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", @@ -11862,7 +11868,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 cd80e9a35102a..aee2fb8a6e288 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -7960,14 +7960,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": "模型", @@ -11879,7 +11885,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": "语音 翻译 英语 自动检测",