Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
onboarding cleanup: assistant wording, Voice Assistant model scope, screen-context opt-in (#2106)
Gabriel Stein918b0754c530
diff --git a/CLAUDE.md b/CLAUDE.mdindex 9daf89b25..aec7bbeb0 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -694,7 +694,7 @@ A dedicated global hotkey that starts a dictation whose transcript is sent strai- Settings → Hotkeys → "Voice Assistant Hotkey" (with cross-slot conflict validation)- Onboarding: optional step right after the dictation hotkey (activation) step-- Panel conversations run on the `chatIntelligence` scope (the chat's brain); in-place selection edits require the dictation agent (Settings → AI Models) and its `dictationAgent`/`dictationAgentVision` scopes+- Panel conversations and in-place selection edits both run on the Voice Assistant scope (Settings → AI Models → Voice Assistant; `dictationAgent`/`dictationAgentVision`), resolved by `resolveChatStreamingInference`; the panel falls back to the `chatIntelligence` scope while the Voice Assistant scope is unreachable. Typed chat (Control Panel, note and container chat) stays on `chatIntelligence`**Screen Context (opt-in)**:diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsxindex f7ee13c82..c47e56ed0 100644--- a/src/components/OnboardingFlow.tsx+++ b/src/components/OnboardingFlow.tsx@@ -104,6 +104,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {setAuthPath,setSetupMode,setSelfHostedRequested,+ setScreenContextRequested,clearSession,} = useOnboardingSession();@@ -257,35 +258,31 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {// The setting turns on only once the permission is actually granted, so an// Enable click whose System Settings grant is abandoned can't leave screen- // context armed to activate silently on some later grant.- const [screenContextRequested, setScreenContextRequested] = useState(false);+ // context armed to activate silently on some later grant. The latch lives in+ // the persisted session because macOS asks to quit and reopen the app after+ // the grant; it is cleared as soon as it is consumed.+ const screenContextRequested = session.screenContextRequested;const applyScreenContext = useCallback(() => {+ setScreenContextRequested(false);settingsStore.setVoiceAgentScreenContext(true);// Keeps the dictation overlay out of its own screenshots.void window.electronAPI?.setScreenContextEnabled?.(true);- }, [settingsStore]);+ }, [setScreenContextRequested, settingsStore]);const enableScreenContext = useCallback(async () => {setScreenContextRequested(true);const granted = await requestScreenRecordingAccess();if (granted) applyScreenContext();return granted;- }, [applyScreenContext, requestScreenRecordingAccess]);+ }, [applyScreenContext, requestScreenRecordingAccess, setScreenContextRequested]);// macOS grants Screen Recording in System Settings, outside the app; the- // permission hook re-checks on window focus. When the grant lands, complete- // the opt-in the Enable click started — within this session only.+ // permission hook re-checks on mount and window focus. When the grant lands,+ // complete the opt-in the Enable click started.useEffect(() => {- if (!screenContextRequested || !screenRecordingGranted) return;- if (settingsStore.voiceAgentScreenContext) return;- applyScreenContext();- }, [- screenContextRequested,- screenRecordingGranted,- settingsStore.voiceAgentScreenContext,- applyScreenContext,- ]);+ if (screenContextRequested && screenRecordingGranted) applyScreenContext();+ }, [screenContextRequested, screenRecordingGranted, applyScreenContext]);const requiredModels = useRequiredLocalModels();// Latched for the session once the step is entered (or resumed at), so a@@ -560,11 +557,22 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {// onProceed() in the same tick, so `settingsStore` here still holds the// values from before the pick. Reading it stale configured the other three// scopes to the defaults (groq / openai/gpt-oss-120b) with no key.- const { chatAgentProvider, chatAgentModel } = useSettingsStore.getState();+ const {+ chatAgentProvider,+ chatAgentModel,+ chatAgentCloudBaseUrl,+ chatAgentRemoteUrl,+ chatAgentCustomApiKey,+ } = useSettingsStore.getState();settingsStore.setCloudReasoningForAllScopes({cleanupCloudMode: mode,cleanupProvider: chatAgentProvider,cleanupModel: chatAgentModel,+ cleanupCloudBaseUrl: chatAgentCloudBaseUrl,+ cleanupRemoteUrl: chatAgentRemoteUrl,+ // Only a self-hosted or custom endpoint has one; an empty write would+ // just churn five secure-store entries.+ ...(chatAgentCustomApiKey ? { cleanupCustomApiKey: chatAgentCustomApiKey } : {}),useCleanupModel: true,useDictationAgent: true,});@@ -656,7 +664,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {useLocalWhisper: false,cloudTranscriptionMode: "byok",});- // When policy disallows the agent, the assistant step is off-route and no+ // When policy disallows the assistant, its step is off-route and no// LLM gets configured. Turn cleanup off so dictations do not route to a// default provider with no credential behind it.if (!route.includes("byok-assistant")) {diff --git a/src/components/chat/useChatStreaming.ts b/src/components/chat/useChatStreaming.tsindex b986cacf9..5c1784743 100644--- a/src/components/chat/useChatStreaming.ts+++ b/src/components/chat/useChatStreaming.ts@@ -1,9 +1,10 @@import { useState, useRef, useEffect, useCallback } from "react";import { useTranslation } from "react-i18next";import ReasoningService, { type AgentStreamChunk } from "../../services/ReasoningService";-import { getCloudModel, isEnterpriseProvider } from "../../models/ModelRegistry";-import { PROVIDER_REGISTRY } from "../../services/ai/inferenceProviders";-import { getSettings, selectResolvedLLMConfig } from "../../stores/settingsStore";+import { isEnterpriseProvider } from "../../models/ModelRegistry";+import { providerSupportsImages } from "../../services/ai/inferenceProviders";+import { getSettings } from "../../stores/settingsStore";+import { resolveChatStreamingInference } from "../../helpers/dictationAgentInference.js";import {isAgentAllowed,isLlmSelectionAllowed,@@ -62,9 +63,19 @@ async function buildRAGContext(userText: string, scope?: ContainerScope): Promis}}+/**+ * Which settings scope answers a conversation. Typed chat surfaces stay on the+ * Chat scope; the voice assistant panel runs on the Voice Assistant scope so+ * the model picked under Settings > Voice Assistant is the one that answers+ * (see resolveChatStreamingInference for its Chat fallback).+ */+export type ChatStreamingScope = "chatIntelligence" | "dictationAgent";+interface UseChatStreamingOptions {messages: Message[];setMessages: React.Dispatch<React.SetStateAction<Message[]>>;+ /** Settings scope the conversation resolves its provider and model from. */+ inferenceScope?: ChatStreamingScope;/** Optional note context to prepend to the system prompt (used by embedded note chat). */noteContext?: string;/** Optional container scope applied to RAG and the search_notes tool (container overview chat). */@@ -97,16 +108,6 @@ export interface ChatStreaming {cancelStream: () => void;}-// An image attaches only where the provider's AI-SDK client is image-wired-// (registry `supportsImages`) AND the model id exists in the local registry,-// so supportsVision is decidable — the same dual gate the single-shot-// dictation path applies. OpenRouter/custom alias the OpenAI client here, but-// their model ids never appear in the registry (vision would be a guess that-// errors the whole command on a text-only backend). The cloud path carries its-// screenshot separately as a server-routed field below.-const providerSupportsStreamImages = (providerId: string) =>- Boolean(providerId && PROVIDER_REGISTRY[providerId]?.supportsImages);-type HistoryMessage = { role: string; content: string | Array<Record<string, unknown>> };// Walks backward to the newest user message; a null transform keeps walking.@@ -126,6 +127,7 @@ function transformLastUserMessage(export function useChatStreaming({messages,setMessages,+ inferenceScope = "chatIntelligence",noteContext: externalNoteContext,searchScope,onStreamComplete,@@ -233,18 +235,23 @@ export function useChatStreaming({if (!options?.suppressResponseContent) onResponseContent?.();};const settings = getSettings();- const chatConfig = selectResolvedLLMConfig(settings, "chatIntelligence");- const chatAgentMode = chatConfig.mode || "openwhispr";+ const { config: llmConfig, attachScreenContext } = resolveChatStreamingInference(settings, {+ inferenceScope,+ hasScreenContext: !!options?.attachment,+ isProviderImageWired: providerSupportsImages,+ });+ const requestedAttachment = attachScreenContext ? (options?.attachment ?? null) : null;+ const llmMode = llmConfig.mode || "openwhispr";const policyState = usePolicyStore.getState();const policyProvider =- chatAgentMode === "openwhispr"+ llmMode === "openwhispr"? "openwhispr"- : chatAgentMode === "local"+ : llmMode === "local"? "local"- : chatConfig.provider;+ : llmConfig.provider;if (!isAgentAllowed(policyState) ||- !isLlmSelectionAllowed(policyState, { mode: chatAgentMode, provider: policyProvider })+ !isLlmSelectionAllowed(policyState, { mode: llmMode, provider: policyProvider })) {// The user message is already appended; answer it instead of dead-ending silently.const restriction = !isAgentAllowed(policyState)@@ -259,11 +266,11 @@ export function useChatStreaming({}setAgentState("thinking");- const isCloudAgent = chatAgentMode === "openwhispr" && settings.isSignedIn;- const isLanAgent = chatAgentMode === "self-hosted" && !!chatConfig.remoteUrl;- const isCustomAgent = chatAgentMode === "providers" && chatConfig.provider === "custom";+ const isCloudAgent = llmMode === "openwhispr" && settings.isSignedIn;+ const isLanAgent = llmMode === "self-hosted" && !!llmConfig.remoteUrl;+ const isCustomAgent = llmMode === "providers" && llmConfig.provider === "custom";const isLocalProvider =- !isEnterpriseProvider(chatConfig.provider) &&+ !isEnterpriseProvider(llmConfig.provider) &&!["openai","groq",@@ -273,9 +280,9 @@ export function useChatStreaming({"tinfoil","openrouter","corti",- ].includes(chatConfig.provider);+ ].includes(llmConfig.provider);const localModelCanUseTool =- isLocalProvider && estimateModelSizeB(chatConfig.model) >= LOCAL_TOOL_MIN_PARAMS_B;+ isLocalProvider && estimateModelSizeB(llmConfig.model) >= LOCAL_TOOL_MIN_PARAMS_B;const supportsTools = isCloudAgent || !isLocalProvider || localModelCanUseTool;const scope = searchScopeRef.current;@@ -329,24 +336,15 @@ export function useChatStreaming({);}- // Attach the screenshot to the command it came with, but only where a- // model can actually see it; otherwise drop it silently — an image- // problem must never cost the user their command. BYOK models get it as- // an image part when the registry says they have vision; the cloud- // agent gets it as a dedicated field the server vision-routes (older- // servers strip the unknown field, which degrades to a plain command).- const attachment =- options?.attachment &&- !isCloudAgent &&- !isLanAgent &&- !isLocalProvider &&- providerSupportsStreamImages(chatConfig.provider) &&- getCloudModel(chatConfig.model)?.supportsVision- ? options.attachment- : null;+ // A screenshot the resolver kept rides with the command it came with:+ // BYOK models get it as an image part, the cloud agent as a dedicated+ // field the server vision-routes (older servers strip the unknown field,+ // which degrades to a plain command). A dropped one costs nothing but the+ // image — the command still runs.+ const attachment = requestedAttachment && !isCloudAgent ? requestedAttachment : null;const cloudScreenContext =- options?.attachment && isCloudAgent- ? { data: options.attachment.image, mediaType: options.attachment.mediaType }+ requestedAttachment && isCloudAgent+ ? { data: requestedAttachment.image, mediaType: requestedAttachment.mediaType }: null;if (attachment) {// The screenshot needs its grounding instruction, exactly like the@@ -423,16 +421,20 @@ export function useChatStreaming({const aiTools = registry?.toAISDKFormat();stream = ReasoningService.processTextStreamingAI(llmMessages,- chatConfig.model,- chatConfig.provider,+ llmConfig.model,+ llmConfig.provider,{systemPrompt,- inferenceScope: "chatIntelligence",- lanUrl: isLanAgent ? chatConfig.remoteUrl : undefined,- baseUrl: isCustomAgent ? chatConfig.cloudBaseUrl || undefined : undefined,+ // Policy and managed enforcement judge the scope that actually+ // answers: the panel's Chat fallback as Chat, and the vision+ // override as the agent scope whose image lane it is.+ inferenceScope:+ llmConfig.scope === "dictationAgentVision" ? "dictationAgent" : llmConfig.scope,+ lanUrl: isLanAgent ? llmConfig.remoteUrl : undefined,+ baseUrl: isCustomAgent ? llmConfig.cloudBaseUrl || undefined : undefined,customApiKey:- isCustomAgent || isLanAgent ? chatConfig.customApiKey || undefined : undefined,- disableThinking: chatConfig.disableThinking,+ isCustomAgent || isLanAgent ? llmConfig.customApiKey || undefined : undefined,+ disableThinking: llmConfig.disableThinking,},aiTools);@@ -573,6 +575,7 @@ export function useChatStreaming({completeToolActivity();},[+ inferenceScope,t,setMessages,onStreamComplete,diff --git a/src/components/dictation/AssistantPanel.tsx b/src/components/dictation/AssistantPanel.tsxindex 286b37d8e..0129d31e2 100644--- a/src/components/dictation/AssistantPanel.tsx+++ b/src/components/dictation/AssistantPanel.tsx@@ -118,6 +118,8 @@ export function AssistantPanel({const streaming = useChatStreaming({messages,setMessages,+ // Spoken commands answer on the Voice Assistant scope, not the Chat one.+ inferenceScope: "dictationAgent",onStreamComplete: (_assistantId, content, toolCalls) => {void persistence.saveAssistantMessage(content, toolCalls);},diff --git a/src/components/onboarding/flow.ts b/src/components/onboarding/flow.tsindex fc95fdf5a..93f962211 100644--- a/src/components/onboarding/flow.ts+++ b/src/components/onboarding/flow.ts@@ -79,6 +79,13 @@ export interface OnboardingSession {authPath: OnboardingAuthPath;setupMode: OnboardingSetupMode;selfHostedRequested: boolean;+ /**+ * The permissions step's screen-context Enable was clicked and the grant has+ * not landed yet. Persisted so the opt-in completes across the quit-and-reopen+ * macOS asks for after granting Screen Recording; cleared once consumed and+ * dropped with the session at finalization.+ */+ screenContextRequested: boolean;resume: OnboardingResumeState;}@@ -186,6 +193,7 @@ export function createOnboardingSession(): OnboardingSession {authPath: null,setupMode: null,selfHostedRequested: false,+ screenContextRequested: false,resume: createOnboardingResumeState(),};}@@ -415,6 +423,12 @@ export function parseOnboardingSession(value: string | null): OnboardingSession) {return null;}+ if (+ parsed.screenContextRequested !== undefined &&+ typeof parsed.screenContextRequested !== "boolean"+ ) {+ return null;+ }return {version: ONBOARDING_FLOW_VERSION,@@ -423,6 +437,7 @@ export function parseOnboardingSession(value: string | null): OnboardingSessionauthPath,setupMode,selfHostedRequested: parsed.selfHostedRequested ?? false,+ screenContextRequested: parsed.screenContextRequested ?? false,resume: parseOnboardingResumeState(parsed.resume, parsed.currentStepId),};} catch {@@ -452,7 +467,7 @@ export function migrateLegacyOnboardingStep(value: string | null): OnboardingSte/*** Map a step onto the caller's route, for when a saved session names a step the- * current route no longer has (the agent gets disallowed, setupMode changes, or a+ * current route no longer has (the assistant gets disallowed, setupMode changes, or a* dev jump asks for an off-route step).** Clamps to the route step nearest in the canonical order, ties going to the@@ -494,7 +509,7 @@ export interface OnboardingProgressState {* counter on, filled up to the current one.** The total comes from the route rather than a constant because the route itself- * is conditional — the assistant pair drops out when the agent is disallowed, and+ * is conditional — the assistant pair drops out when the assistant is disallowed, and* the provider pair only exists once a non-cloud setup mode is picked. Choosing* BYOK/local on setup-choice therefore appends two steps and the row* grows by two dots at that moment, which is the flow honestly getting longer.diff --git a/src/components/onboarding/useOnboardingSession.ts b/src/components/onboarding/useOnboardingSession.tsindex 2bdc87fba..c1fca3da1 100644--- a/src/components/onboarding/useOnboardingSession.ts+++ b/src/components/onboarding/useOnboardingSession.ts@@ -74,6 +74,10 @@ export function useOnboardingSession() {setSession((current) => ({ ...current, selfHostedRequested }));}, []);+ const setScreenContextRequested = useCallback((screenContextRequested: boolean) => {+ setSession((current) => ({ ...current, screenContextRequested }));+ }, []);+const clearSession = useCallback(() => {localStorage.removeItem(ONBOARDING_SESSION_KEY);localStorage.removeItem(LEGACY_ONBOARDING_STEP_KEY);@@ -87,6 +91,7 @@ export function useOnboardingSession() {setAuthPath,setSetupMode,setSelfHostedRequested,+ setScreenContextRequested,clearSession,};}diff --git a/src/config/inferenceScopes.ts b/src/config/inferenceScopes.tsindex c3c8a9ead..6e5633f8a 100644--- a/src/config/inferenceScopes.ts+++ b/src/config/inferenceScopes.ts@@ -69,8 +69,9 @@ export const INFERENCE_SCOPES = {},fallbackScope: "dictationCleanup",},- // Runs every chat conversation, including the voice assistant panel's- // standalone commands. Selection edits stay on dictationAgent(Vision).+ // Runs typed chat conversations (Control Panel, note and container chat).+ // The voice assistant panel's spoken commands, like selection edits, run on+ // dictationAgent(Vision) — see resolveChatStreamingInference.chatIntelligence: {storeKeys: {mode: "chatAgentMode",diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.jsindex 47d561bc4..85be54f88 100644--- a/src/helpers/audioManager.js+++ b/src/helpers/audioManager.js@@ -1,5 +1,4 @@import ReasoningService from "../services/ReasoningService";-import { PROVIDER_REGISTRY } from "../services/ai/inferenceProviders";import logger from "../utils/logger";import { isAzureOpenAIEndpoint } from "../utils/urlUtils";import { withSessionRefresh } from "../lib/auth";@@ -95,6 +94,7 @@ import {resolveDictationAgentInference,resolveDictationAgentVisionInference,} from "./dictationAgentInference";+import { providerSupportsImages } from "../services/ai/inferenceProviders";import { resolveDictationTranslationInference } from "./dictationTranslationInference";import { resolvePrompt, appendScreenContextSuffix } from "../config/prompts";import { syncService } from "../services/SyncService.js";@@ -169,9 +169,6 @@ function analyticsSyncEnabled(settings = getSettings()) {);}-const providerSupportsImages = (providerId) =>- !!(providerId && PROVIDER_REGISTRY[providerId]?.supportsImages);-// Shared by the agent route and its text-only retry, which needs the prompt// without the screen-context suffix.function dictationAgentPrompt(settings, agentName) {@@ -301,11 +298,11 @@ function resolveReasoningRoute(: systemPrompt,...(attach ? { screenContext, textOnlySystemPrompt: systemPrompt } : {}),// Selection edits run on this (dictation) scope, so they need it- // reachable; standalone commands run on the chat scope in the panel.+ // reachable; standalone commands resolve the same scope again in the+ // panel and report their own configuration problems in-conversation.selectionEditReachable: agent.reachable,- // The panel re-decides attach/drop against the chat scope's model,- // which may see images even when this scope's cannot — carry the raw- // screenshot past the attach gate for that path.+ // The panel re-decides attach/drop for its own request, so carry the+ // raw screenshot past this attach gate for that path....(screenContext ? { rawScreenContext: screenContext } : {}),},};@@ -2582,8 +2579,8 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);transcript,// resolveReasoningRoute mirrors an attached screenContext into// rawScreenContext (same object), so the raw carry is the single source- // to read — it also survives when the agent scope's attach gate dropped- // the image (the panel re-decides against the chat scope's model).+ // to read — it also survives when this attach gate dropped the image+ // (the panel re-decides for its own request).screenContext: config?.rawScreenContext ?? null,...(selectedContext ? { selectedContext } : {}),...(deliverySessionId ? { deliverySessionId } : {}),@@ -2606,8 +2603,8 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);return extras;}- // Panel-first commands skip the dictation-agent model, so the org policy- // guard that protected that model must run here instead.+ // Panel-first commands make no LLM call here — the panel resolves the Voice+ // Assistant scope itself — so the org policy guard must run at bank time._bankPanelAgentCommand(text,agentName,@@ -2937,8 +2934,8 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);!cleanupReachable &&!agentReachable &&!(this.translationRequested && translationChainReachable(settings)) &&- // A voice-assistant command always routes: standalone commands run on- // the chat scope in the panel, so no dictation-scope model is needed.+ // A voice-assistant command always routes: standalone commands stream+ // in the panel, which reports a missing model in-conversation.!this.voiceAgentRequested) {logger.logReasoning("REASONING_SKIPPED", {diff --git a/src/helpers/dictationAgentInference.js b/src/helpers/dictationAgentInference.jsindex 4bf50f93c..69218b35a 100644--- a/src/helpers/dictationAgentInference.js+++ b/src/helpers/dictationAgentInference.js@@ -1,13 +1,14 @@import {+ resolveAgentImageTarget,resolveDictationAgentDisplayProvider,resolveDictationAgentProvider,resolveDictationAgentReachability,resolveModeProvider,resolveModeReachability,} from "./dictationRouting.js";-import { isProviderValidForMode } from "../models/ModelRegistry";+import { getCloudModel, isProviderValidForMode } from "../models/ModelRegistry";import { getManagedScopeResolution } from "../stores/enterpriseIdentityStore";-import { selectResolvedLLMConfig } from "../stores/settingsStore";+import { selectIsCloudDictationAgentMode, selectResolvedLLMConfig } from "../stores/settingsStore";import { inheritsFallbackEndpoint } from "./reasoningRouting.js";// The dictation agent's inference scope, shared by the dictation route in@@ -106,6 +107,7 @@ export function resolveDictationAgentVisionInference(settings, { isSignedIn = fa!!settings.useDictationAgentVisionModel &&chosen &&resolveModeReachability({ mode, provider, model, isCloud, isSelfHosted: false }),+ mode,// Cloud picks the model server-side from its vision chain.model: isCloud ? "" : model,config: {@@ -119,3 +121,83 @@ export function resolveDictationAgentVisionInference(settings, { isSignedIn = fa},};}++/**+ * What a chat conversation streams on, and whether its screenshot rides along.+ *+ * Typed chat surfaces resolve the Chat scope. The voice assistant panel resolves+ * the Voice Assistant scope — the tab that also governs selection edits — so the+ * model picked there answers spoken commands; while that scope is unreachable+ * (assistant toggled off, a BYOK mode with no model) the panel falls back to+ * Chat, its previous home. Profiles from before onboarding fanned selections out+ * are seeded from Chat on upgrade (settingsStore), so the fallback is not what+ * keeps them off the cloud default.+ *+ * Screenshots follow the dictation route's rules (resolveAgentImageTarget): a+ * configured vision override is trusted to see images and swapped in; an+ * override that cannot drops the screenshot rather than redirecting it to a+ * model the user did not choose; the base scope attaches only where its+ * provider is image-wired and the registry says its model has vision, or on+ * OpenWhispr Cloud, which vision-routes server-side.+ *+ * `isProviderImageWired` is injected: the provider registry reads Vite env at+ * load, which this helper's callers and tests do not all have.+ *+ * @param {import("../stores/settingsStore").SettingsState} settings+ * @param {{+ * inferenceScope?: "chatIntelligence" | "dictationAgent",+ * hasScreenContext?: boolean,+ * isProviderImageWired?: (providerId: string | undefined) => boolean,+ * }} [options]+ * @returns {{+ * config: import("../stores/settingsStore").ResolvedLLMConfig,+ * attachScreenContext: boolean,+ * }}+ */+export function resolveChatStreamingInference(+ settings,+ {+ inferenceScope = "chatIntelligence",+ hasScreenContext = false,+ isProviderImageWired = () => false,+ } = {}+) {+ const onAgentScope =+ inferenceScope === "dictationAgent" &&+ resolveDictationAgentInference(settings, {+ isCloudAgent: selectIsCloudDictationAgentMode(settings),+ }).reachable;+ const config = selectResolvedLLMConfig(+ settings,+ onAgentScope ? "dictationAgent" : "chatIntelligence"+ );+ const isCloud = !!settings.isSignedIn && config.mode === "openwhispr";+ const vision =+ onAgentScope && hasScreenContext+ ? resolveDictationAgentVisionInference(settings, { isSignedIn: !!settings.isSignedIn })+ : null;++ const { attach, useVisionOverride } = resolveAgentImageTarget({+ hasScreenContext,+ visionOverrideActive: !!vision?.active,+ visionProviderImageWired: isProviderImageWired(vision?.config.provider),+ baseProviderImageWired: isProviderImageWired(+ resolveModeProvider({ isCloud, mode: config.mode, provider: config.provider })+ ),+ isCloudAgent: isCloud,+ baseModelSupportsVision: !!getCloudModel(config.model)?.supportsVision,+ });+ if (!useVisionOverride) return { config, attachScreenContext: attach };+ return {+ config: {+ scope: "dictationAgentVision",+ mode: vision.mode,+ provider: vision.config.provider,+ model: vision.model,+ cloudBaseUrl: vision.config.baseUrl,+ customApiKey: vision.config.customApiKey,+ disableThinking: vision.config.disableThinking,+ },+ attachScreenContext: true,+ };+}diff --git a/src/helpers/dictationRouting.js b/src/helpers/dictationRouting.jsindex ab1b951ad..f0550974e 100644--- a/src/helpers/dictationRouting.js+++ b/src/helpers/dictationRouting.js@@ -154,8 +154,8 @@ export function resolveWakeWordLanguage({ preferredLanguage, uiLanguage }, detec// Decides which reasoning path ("translation" | "agent" | "cleanup" | "skip")// a finished dictation takes. A recording started via the voice assistant// hotkey always takes the agent path — no wake word needed. Standalone-// commands stream into the assistant panel (which resolves the chat scope and-// reports its own configuration problems in-conversation), so the dictation+// commands stream into the assistant panel (which resolves the Voice Assistant+// scope itself and reports configuration problems in-conversation), so the dictation// agent's reachability only gates selection edits — that check happens at the// selection disposition, not here. A translation recording degrades to// cleanup instead: the transcript is still a useful dictation without thediff --git a/src/helpers/reasoningRouting.js b/src/helpers/reasoningRouting.jsindex 45d19f4c0..54ec1719d 100644--- a/src/helpers/reasoningRouting.js+++ b/src/helpers/reasoningRouting.js@@ -15,16 +15,26 @@ export function inheritsFallbackEndpoint(own, fallbackMode) {return !!fallbackMode && own.mode === fallbackMode;}+const MIRRORED_ROUTING_FIELDS = [+ ["cleanupProvider", "provider"],+ ["cleanupModel", "model"],+ ["cleanupCloudMode", "cloudMode"],+ ["cleanupCloudBaseUrl", "cloudBaseUrl"],+ ["cleanupRemoteUrl", "remoteUrl"],+ ["cleanupCustomApiKey", "customApiKey"],+];+// Fan a cleanup config out to all five LLM scopes; the four non-cleanup scopes-// mirror only cloud routing plus the derived mode (each tab selects on its mode).+// mirror the routing fields that are set plus the derived mode (each tab selects+// on its mode). The endpoint and key ride along so a self-hosted or custom+// endpoint is reachable from every scope, not just the one onboarding wrote.export function buildReasoningScopePatches(settings, mode) {const dictationCleanup = { ...settings, cleanupMode: mode };- // The four non-cleanup scopes mirror only the cloud routing fields that are set.- const routing = {- ...(settings.cleanupProvider !== undefined ? { provider: settings.cleanupProvider } : {}),- ...(settings.cleanupModel !== undefined ? { model: settings.cleanupModel } : {}),- ...(settings.cleanupCloudMode !== undefined ? { cloudMode: settings.cleanupCloudMode } : {}),- };+ const routing = Object.fromEntries(+ MIRRORED_ROUTING_FIELDS.filter(([cleanupKey]) => settings[cleanupKey] !== undefined).map(+ ([cleanupKey, field]) => [field, settings[cleanupKey]]+ )+ );return {dictationCleanup,noteFormatting: { mode, ...routing },diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex 5f7dfb90f..7e38c16bd 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -431,8 +431,7 @@"activation": "Diktat","useCase": "Über dich","meeting": "Meetings",- "finish": "Fertig",- "voiceAgent": "Sprachassistent"+ "finish": "Fertig"},"hotkey": {"couldNotRegisterTitle": "Dieser Hotkey konnte nicht registriert werden",@@ -478,22 +477,6 @@"holdHotkey": "{{hotkey}} gedrückt halten","textareaPlaceholder": "Hier klicken und Hotkey zum Diktieren verwenden..."},- "voiceAgent": {- "title": "Sprachassistent-Einrichtung",- "description": "Sprechen Sie mit Ihrem KI-Assistenten per Tastendruck",- "hotkey": "Hotkey",- "howItWorks": "Drücken Sie die Taste und sagen Sie, was Sie möchten — zum Beispiel „schreibe eine kurze Dankesnachricht“. Ist Text markiert, bearbeitet und ersetzt {{agentName}} ihn. Ist ein beschreibbares Textfeld fokussiert, wird die Antwort am Cursor eingefügt; andernfalls öffnet sie sich in einem schwebenden Panel. Sie müssen nicht zuerst „Hey {{agentName}}“ sagen.",- "test": "Ausprobieren",- "testInstruction": "Markiere unten den Beispieltext, drücke {{hotkey}} und sage „mach das kürzer“ — die Änderung landet direkt im Textfeld",- "testSetHotkey": "Lege oben einen Hotkey fest, um es auszuprobieren",- "sampleText": "Das Meeting von Donnerstag wurde verschoben, lass uns also Anfang nächster Woche kurz abstimmen, um den Launch-Plan durchzugehen und die restlichen Aufgaben aufzuteilen.",- "examples": [- "Übersetze ins Italienische: „Ich spreche schneller, als ich tippe“",- "Schreibe eine kurze E-Mail an meinen Chef, dass ich eine Beförderung möchte, sein Name ist Mark",- "Was ist 5 × 5?"- ],- "optionalNote": "Optional — Sie können ihn jederzeit in den Einstellungen festlegen oder ändern."- },"connectivity": {"title": "OpenWhispr Cloud ist aus diesem Netzwerk nicht erreichbar","body": "{{cause}} Sie können zur lokalen Engine wechseln oder fortfahren und es später erneut versuchen.",diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex b7b62e39a..6fa5f4013 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -431,8 +431,7 @@"activation": "Dictation","useCase": "About you","meeting": "Meetings",- "finish": "Finish",- "voiceAgent": "Voice Assistant"+ "finish": "Finish"},"hotkey": {"couldNotRegisterTitle": "Couldn't register that hotkey",@@ -478,22 +477,6 @@"holdHotkey": "Hold {{hotkey}}","textareaPlaceholder": "Click here and use your hotkey to dictate..."},- "voiceAgent": {- "title": "Voice Assistant Setup",- "description": "Talk to your AI assistant with a single keypress",- "hotkey": "Hotkey",- "howItWorks": "Press the key and say what you want — for example “write a short thank-you note”. If text is highlighted, {{agentName}} edits and replaces it. If a writable text field is focused, the answer is pasted at the cursor; otherwise it opens in a floating panel. No need to say “Hey {{agentName}}” first.",- "test": "Try it",- "testInstruction": "Select the sample text below, then press {{hotkey}} and say “make this shorter” — the edit lands right in the text box",- "testSetHotkey": "Set a hotkey above to try it",- "sampleText": "The meeting from thursday got moved, so lets sync up early next week to go over the launch plan and divide up the remaining tasks.",- "examples": [- "Translate to Italian: “I talk faster than I type”",- "Write a short email to my boss telling him I want a promotion, his name is Mark",- "What is 5 × 5?"- ],- "optionalNote": "Optional — you can set or change it anytime in Settings."- },"connectivity": {"title": "We can't reach OpenWhispr Cloud from this network","body": "{{cause}} You can switch to the local engine, or continue and try again later.",diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex be25b91d4..b42b09f61 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -431,8 +431,7 @@"activation": "Dictado","useCase": "Sobre ti","meeting": "Reuniones",- "finish": "Listo",- "voiceAgent": "Asistente de voz"+ "finish": "Listo"},"hotkey": {"couldNotRegisterTitle": "No se pudo registrar ese atajo",@@ -478,22 +477,6 @@"holdHotkey": "Mantener {{hotkey}}","textareaPlaceholder": "Haz clic aquí y usa tu atajo para dictar..."},- "voiceAgent": {- "title": "Configuración del asistente de voz",- "description": "Habla con tu asistente de IA con una sola pulsación",- "hotkey": "Atajo",- "howItWorks": "Pulsa la tecla y di lo que quieres, por ejemplo «escribe una breve nota de agradecimiento». Si hay texto resaltado, {{agentName}} lo edita y reemplaza. Si un campo de texto editable tiene el foco, la respuesta se pega en el cursor; si no, se abre en un panel flotante. No hace falta decir «Hey {{agentName}}» antes.",- "test": "Pruébalo",- "testInstruction": "Selecciona el texto de ejemplo de abajo, pulsa {{hotkey}} y di «hazlo más corto»: la edición aparece directamente en el cuadro de texto",- "testSetHotkey": "Configura un atajo arriba para probarlo",- "sampleText": "La reunión del jueves se movió, así que sincronicemos a principios de la próxima semana para repasar el plan de lanzamiento y repartir las tareas pendientes.",- "examples": [- "Traduce al italiano: «Hablo más rápido de lo que escribo»",- "Escribe un correo breve a mi jefe diciéndole que quiero un ascenso, se llama Mark",- "¿Cuánto es 5 × 5?"- ],- "optionalNote": "Opcional: puedes configurarlo o cambiarlo en cualquier momento en los ajustes."- },"connectivity": {"title": "No podemos conectar con OpenWhispr Cloud desde esta red","body": "{{cause}} Puedes cambiar al motor local o continuar e intentarlo más tarde.",diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex 61fc6b656..b353f3437 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -431,8 +431,7 @@"activation": "Dictée","useCase": "À propos de vous","meeting": "Réunions",- "finish": "Terminer",- "voiceAgent": "Assistant vocal"+ "finish": "Terminer"},"hotkey": {"couldNotRegisterTitle": "Impossible d'enregistrer ce raccourci",@@ -478,22 +477,6 @@"holdHotkey": "Maintenir {{hotkey}}","textareaPlaceholder": "Cliquez ici puis utilisez votre raccourci pour dicter..."},- "voiceAgent": {- "title": "Configuration de l'assistant vocal",- "description": "Parlez à votre assistant IA d'une simple touche",- "hotkey": "Raccourci",- "howItWorks": "Appuyez sur la touche et dites ce que vous voulez, par exemple « écris un petit mot de remerciement ». Si du texte est surligné, {{agentName}} le modifie et le remplace. Si un champ de texte modifiable est actif, la réponse est collée au curseur ; sinon, elle s'ouvre dans un panneau flottant. Pas besoin de dire « Hey {{agentName}} » d'abord.",- "test": "Essayer",- "testInstruction": "Sélectionnez le texte d'exemple ci-dessous, appuyez sur {{hotkey}} et dites « raccourcis ce texte » — la modification apparaît directement dans la zone de texte",- "testSetHotkey": "Définissez un raccourci ci-dessus pour l'essayer",- "sampleText": "La réunion de jeudi a été déplacée, donc faisons un point en début de semaine prochaine pour revoir le plan de lancement et nous répartir les tâches restantes.",- "examples": [- "Traduis en italien : « Je parle plus vite que je ne tape »",- "Écris un court e-mail à mon patron pour lui dire que je veux une promotion, il s'appelle Mark",- "Combien font 5 × 5 ?"- ],- "optionalNote": "Facultatif — vous pouvez le définir ou le modifier à tout moment dans les réglages."- },"connectivity": {"title": "Impossible d'atteindre OpenWhispr Cloud depuis ce réseau","body": "{{cause}} Vous pouvez basculer sur le moteur local, ou continuer et réessayer plus tard.",diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex 5b9f60b31..0d68c5e0a 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -431,8 +431,7 @@"activation": "Dettatura","useCase": "Su di te","meeting": "Riunioni",- "finish": "Fine",- "voiceAgent": "Assistente vocale"+ "finish": "Fine"},"hotkey": {"couldNotRegisterTitle": "Impossibile registrare questa scorciatoia",@@ -478,22 +477,6 @@"holdHotkey": "Tieni premuto {{hotkey}}","textareaPlaceholder": "Clicca qui e usa la scorciatoia per dettare..."},- "voiceAgent": {- "title": "Configurazione dell'assistente vocale",- "description": "Parla con il tuo assistente IA con un solo tasto",- "hotkey": "Scorciatoia",- "howItWorks": "Premi il tasto e di' cosa vuoi — ad esempio “scrivi un breve messaggio di ringraziamento”. Se c'è del testo evidenziato, {{agentName}} lo modifica e sostituisce. Se è attivo un campo di testo modificabile, la risposta viene incollata al cursore; altrimenti si apre in un pannello flottante. Non serve dire prima “Hey {{agentName}}”.",- "test": "Provalo",- "testInstruction": "Seleziona il testo di esempio qui sotto, premi {{hotkey}} e di' «rendilo più corto» — la modifica arriva direttamente nella casella di testo",- "testSetHotkey": "Imposta una scorciatoia sopra per provarlo",- "sampleText": "La riunione di giovedì è stata spostata, quindi sentiamoci a inizio settimana prossima per rivedere il piano di lancio e dividerci i compiti rimanenti.",- "examples": [- "Traduci in italiano: «Parlo più velocemente di quanto scrivo»",- "Scrivi una breve email al mio capo dicendogli che voglio una promozione, si chiama Mark",- "Quanto fa 5 × 5?"- ],- "optionalNote": "Facoltativo — puoi impostarla o modificarla in qualsiasi momento nelle impostazioni."- },"connectivity": {"title": "Non riusciamo a raggiungere OpenWhispr Cloud da questa rete","body": "{{cause}} Puoi passare al motore locale o continuare e riprovare più tardi.",diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex 563a488b1..f2ec0fa01 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -431,8 +431,7 @@"activation": "ディクテーション","useCase": "あなたについて","meeting": "会議",- "finish": "完了",- "voiceAgent": "音声アシスタント"+ "finish": "完了"},"hotkey": {"couldNotRegisterTitle": "ホットキーを登録できませんでした",@@ -478,22 +477,6 @@"holdHotkey": "{{hotkey}} を押し続ける","textareaPlaceholder": "ここをクリックしてホットキーでディクテーション..."},- "voiceAgent": {- "title": "音声アシスタント設定",- "description": "ワンキーでAIアシスタントに話しかけられます",- "hotkey": "ホットキー",- "howItWorks": "キーを押して、してほしいことを話すだけ。例えば「お礼のメッセージを書いて」と言えます。テキストが選択されていれば、{{agentName}}が編集して置き換えます。編集可能なテキスト欄にフォーカスがある場合、回答はカーソル位置に貼り付けられ、それ以外の場合はフローティングパネルに表示されます。「Hey {{agentName}}」と言う必要はありません。",- "test": "試す",- "testInstruction": "下のサンプルテキストを選択して {{hotkey}} を押し、「短くして」と話してください。編集結果がそのままテキストボックスに反映されます",- "testSetHotkey": "上でホットキーを設定すると試せます",- "sampleText": "木曜のミーティングが移動になったので、来週の頭に集まってローンチ計画を確認し、残りのタスクを分担しましょう。",- "examples": [- "イタリア語に翻訳して:「私はタイプするより話す方が速い」",- "上司に昇進したいと伝える短いメールを書いて、彼の名前はマークです",- "5 × 5 はいくつ?"- ],- "optionalNote": "任意です。設定からいつでも追加・変更できます。"- },"connectivity": {"title": "このネットワークから OpenWhispr Cloud に接続できません","body": "{{cause}} ローカルエンジンに切り替えるか、続行して後でもう一度お試しください。",diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex c45c68660..ebb26c6d4 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -410,8 +410,7 @@"activation": "Ditado","useCase": "Sobre você","meeting": "Reuniões",- "finish": "Concluir",- "voiceAgent": "Assistente de voz"+ "finish": "Concluir"},"hotkey": {"couldNotRegisterTitle": "Não foi possível registrar esse atalho",@@ -457,22 +456,6 @@"holdHotkey": "Segure {{hotkey}}","textareaPlaceholder": "Clique aqui e use seu atalho para ditar..."},- "voiceAgent": {- "title": "Configuração do assistente de voz",- "description": "Fale com seu assistente de IA com um único atalho",- "hotkey": "Atalho",- "howItWorks": "Pressione a tecla e diga o que quer — por exemplo, “escreva uma breve nota de agradecimento”. Se houver texto destacado, {{agentName}} o edita e substitui. Se um campo de texto editável estiver em foco, a resposta é colada no cursor; caso contrário, abre em um painel flutuante. Não precisa dizer “Hey {{agentName}}” antes.",- "test": "Experimente",- "testInstruction": "Selecione o texto de exemplo abaixo, pressione {{hotkey}} e diga “deixe isso mais curto” — a edição aparece direto na caixa de texto",- "testSetHotkey": "Defina um atalho acima para experimentar",- "sampleText": "A reunião de quinta foi remarcada, então vamos alinhar no início da próxima semana para revisar o plano de lançamento e dividir as tarefas restantes.",- "examples": [- "Traduza para o italiano: «Falo mais rápido do que escrevo»",- "Escreva um e-mail curto para o meu chefe dizendo que quero uma promoção, ele se chama Mark",- "Quanto é 5 × 5?"- ],- "optionalNote": "Opcional — você pode definir ou alterar a qualquer momento nas configurações."- },"connectivity": {"title": "Não conseguimos acessar o OpenWhispr Cloud nesta rede","body": "{{cause}} Você pode mudar para o motor local ou continuar e tentar de novo depois.",diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex 5277c418e..6062acb86 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -431,8 +431,7 @@"activation": "Диктовка","useCase": "О вас","meeting": "Встречи",- "finish": "Готово",- "voiceAgent": "Голосовой помощник"+ "finish": "Готово"},"hotkey": {"couldNotRegisterTitle": "Не удалось зарегистрировать горячую клавишу",@@ -478,22 +477,6 @@"holdHotkey": "Удерживайте {{hotkey}}","textareaPlaceholder": "Нажмите сюда и используйте горячую клавишу для диктовки..."},- "voiceAgent": {- "title": "Настройка голосового помощника",- "description": "Обращайтесь к ИИ-помощнику одним нажатием",- "hotkey": "Горячая клавиша",- "howItWorks": "Нажмите клавишу и скажите, что вам нужно — например, «напиши короткую благодарственную записку». Если текст выделен, {{agentName}} отредактирует и заменит его. Если фокус находится в редактируемом текстовом поле, ответ вставится в позицию курсора; иначе он откроется в плавающей панели. Говорить «Hey {{agentName}}» не нужно.",- "test": "Попробуйте",- "testInstruction": "Выделите образец текста ниже, нажмите {{hotkey}} и скажите «сделай короче» — правка появится прямо в текстовом поле",- "testSetHotkey": "Задайте горячую клавишу выше, чтобы попробовать",- "sampleText": "Встречу с четверга перенесли, так что давайте созвонимся в начале следующей недели, чтобы пройтись по плану запуска и распределить оставшиеся задачи.",- "examples": [- "Переведи на итальянский: «Я говорю быстрее, чем печатаю»",- "Напиши короткое письмо начальнику о том, что я хочу повышение, его зовут Марк",- "Сколько будет 5 × 5?"- ],- "optionalNote": "Необязательно — вы можете настроить или изменить её в любое время в настройках."- },"connectivity": {"title": "Не удаётся подключиться к OpenWhispr Cloud из этой сети","body": "{{cause}} Вы можете переключиться на локальный движок или продолжить и повторить попытку позже.",diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex 5baba30e1..9efa062bc 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -431,8 +431,7 @@"activation": "听写","useCase": "关于你","meeting": "会议",- "finish": "完成",- "voiceAgent": "语音助手"+ "finish": "完成"},"hotkey": {"couldNotRegisterTitle": "无法注册该快捷键",@@ -478,22 +477,6 @@"holdHotkey": "按住 {{hotkey}}","textareaPlaceholder": "点击此处,然后使用快捷键进行听写..."},- "voiceAgent": {- "title": "语音助手设置",- "description": "一键唤起你的 AI 助手",- "hotkey": "快捷键",- "howItWorks": "按下快捷键,说出你想要的内容,例如“写一段简短的感谢语”。如果有选中的文本,{{agentName}} 会编辑并替换它。如果可编辑文本框已获得焦点,回答会粘贴到光标处;否则会在悬浮面板中打开。无需先说“Hey {{agentName}}”。",- "test": "试一试",- "testInstruction": "选中下方的示例文本,按下 {{hotkey}} 并说“把它改短一点”——编辑结果会直接出现在文本框里",- "testSetHotkey": "在上方设置快捷键即可试用",- "sampleText": "周四的会议改期了,我们下周初碰一下,过一遍发布计划,并分配剩下的任务。",- "examples": [- "翻译成意大利语:“我说话比打字快”",- "给我的老板写一封简短的邮件,告诉他我想要升职,他叫 Mark",- "5 × 5 等于多少?"- ],- "optionalNote": "可选——你可以随时在设置中添加或修改。"- },"connectivity": {"title": "无法从该网络连接到 OpenWhispr Cloud","body": "{{cause}} 你可以切换到本地引擎,或继续并稍后重试。",diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex 4498520d5..201254559 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -431,8 +431,7 @@"activation": "聽寫","useCase": "關於你","meeting": "會議",- "finish": "完成",- "voiceAgent": "語音助理"+ "finish": "完成"},"hotkey": {"couldNotRegisterTitle": "無法註冊該快捷鍵",@@ -478,22 +477,6 @@"holdHotkey": "按住 {{hotkey}}","textareaPlaceholder": "點擊這裡,然後使用快捷鍵開始語音輸入..."},- "voiceAgent": {- "title": "語音助理設定",- "description": "一鍵喚起你的 AI 助理",- "hotkey": "快捷鍵",- "howItWorks": "按下快捷鍵,說出你想要的內容,例如「寫一段簡短的感謝語」。如果有選取的文字,{{agentName}} 會編輯並取代它。如果可編輯文字欄位已取得焦點,回答會貼到游標處;否則會在懸浮面板中開啟。無需先說「Hey {{agentName}}」。",- "test": "試試看",- "testInstruction": "選取下方的範例文字,按下 {{hotkey}} 並說「把它改短一點」——編輯結果會直接出現在文字框裡",- "testSetHotkey": "在上方設定快捷鍵即可試用",- "sampleText": "週四的會議改期了,我們下週初碰個面,過一遍上線計畫,並分配剩下的任務。",- "examples": [- "翻譯成義大利文:「我說話比打字快」",- "給我的老闆寫一封簡短的郵件,告訴他我想要升職,他叫 Mark",- "5 × 5 等於多少?"- ],- "optionalNote": "選用——你可以隨時在設定中新增或修改。"- },"connectivity": {"title": "無法從此網路連線到 OpenWhispr Cloud","body": "{{cause}} 你可以切換到本機引擎,或繼續並稍後再試。",diff --git a/src/services/ai/inferenceProviders/index.ts b/src/services/ai/inferenceProviders/index.tsindex fd25edc35..59b0cf11e 100644--- a/src/services/ai/inferenceProviders/index.ts+++ b/src/services/ai/inferenceProviders/index.ts@@ -28,3 +28,8 @@ export const PROVIDER_REGISTRY: Readonly<Record<string, InferenceProvider>> = Ob});export type { InferenceProvider, ProviderContext, ProviderCallParams } from "./types";++// Whether a provider's AI-SDK client is wired to send image parts. Shared by+// the dictation route and the assistant panel so both gate screenshots alike.+export const providerSupportsImages = (providerId: string | undefined): boolean =>+ !!(providerId && PROVIDER_REGISTRY[providerId]?.supportsImages);diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.tsindex 2dc800c4b..16bb0ef1f 100644--- a/src/stores/settingsStore.ts+++ b/src/stores/settingsStore.ts@@ -662,6 +662,45 @@ function migrateLLMScopeKeys() {migrateLLMScopeKeys();+// The Voice Assistant scope shipped unseeded — empty provider and model, mode+// defaulting to cloud — while the assistant panel answered on the Chat scope.+// The panel now answers on the Voice Assistant scope, so a profile that never+// configured it (no onboarding fan-out or Settings edit wrote its mode,+// provider or model) copies the Chat scope over once; otherwise a signed-in+// profile whose Chat runs local or BYOK would have its spoken commands move to+// the cloud default silently. The scope's custom key is a secret, so+// initializeSettings copies it once the secure store has loaded.+const SEEDED_SCOPE_FIELDS = [+ "mode",+ "provider",+ "model",+ "cloudMode",+ "cloudBaseUrl",+ "remoteUrl",+] as const;++function seedDictationAgentScopeFromChat() {+ if (!isBrowser) return;+ if (localStorage.getItem("_dictationAgentSeeded") !== null) return;++ const chat = INFERENCE_SCOPES.chatIntelligence.storeKeys;+ const agent = INFERENCE_SCOPES.dictationAgent.storeKeys;+ const configured = [agent.mode, agent.provider, agent.model].some(+ (key) => localStorage.getItem(key) !== null+ );+ if (configured) {+ localStorage.setItem("_dictationAgentSeeded", "1");+ return;+ }+ for (const field of SEEDED_SCOPE_FIELDS) {+ const value = localStorage.getItem(chat[field] as string);+ if (value !== null) localStorage.setItem(agent[field] as string, value);+ }+ localStorage.setItem("_dictationAgentSeeded", "key-pending");+}++seedDictationAgentScopeFromChat();+// Builds before 1.10.0 ran migrateMeetingFollowFlags() before// migrateProviderSettings() had created `transcriptionMode` / `reasoningMode`,// so a profile upgrading straight from ≤1.6.7 copied every Note Recording key@@ -1154,7 +1193,9 @@ export interface SettingsStateupdateTranscriptionSettings: (settings: Partial<TranscriptionSettings>) => void;setCloudTranscriptionForAllScopes: (settings: Partial<TranscriptionSettings>) => void;updateCleanupSettings: (settings: Partial<CleanupSettings>) => void;- setCloudReasoningForAllScopes: (settings: Partial<CleanupSettings>) => void;+ setCloudReasoningForAllScopes: (+ settings: Partial<CleanupSettings & Pick<ApiKeySettings, "cleanupCustomApiKey">>+ ) => void;updateApiKeys: (keys: Partial<ApiKeySettings>) => void;updateChatAgentSettings: (settings: Partial<ChatAgentSettings>) => void;}@@ -2550,12 +2591,13 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({if (settings.cleanupCloudBaseUrl !== undefined)s.setCleanupCloudBaseUrl(settings.cleanupCloudBaseUrl);if (settings.cleanupCloudMode !== undefined) s.setCleanupCloudMode(settings.cleanupCloudMode);+ if (settings.cleanupRemoteUrl !== undefined) s.setCleanupRemoteUrl(settings.cleanupRemoteUrl);},// Apply a cleanup config to dictation, then mirror its cloud routing to the// other three LLM scopes — used when onboarding routes every reasoning scope to// one provider so PHI never reaches a second LLM (e.g. Corti for medical providers).- setCloudReasoningForAllScopes: (settings: Partial<CleanupSettings>) => {+ setCloudReasoningForAllScopes: (settings) => {const s = useSettingsStore.getState();// Onboarding routes every scope to the local runtime or the enterprise// provider by passing "local"/"enterprise" as cleanupCloudMode. Those are@@ -2571,42 +2613,21 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({const mode = isDirectMode? requestedCloudMode: deriveReasoningMode(requestedCloudMode, settings.cleanupProvider ?? s.cleanupProvider);- const {- dictationCleanup,- noteFormatting,- dictationAgent,- chatIntelligence,- dictationTranslation,- } = buildReasoningScopePatches(+ const { dictationCleanup, ...mirrored } = buildReasoningScopePatches(isDirectMode ? { ...settings, cleanupCloudMode: undefined } : settings,mode);s.updateCleanupSettings(dictationCleanup);s.setCleanupMode(dictationCleanup.cleanupMode);- // Each Settings tab selects on its own mode field, so set the mode for every- // scope even when the routing fields are absent — otherwise the tab keeps+ if (dictationCleanup.cleanupCustomApiKey !== undefined) {+ s.setCleanupCustomApiKey(dictationCleanup.cleanupCustomApiKey);+ }+ // Each Settings tab selects on its own mode field, so every scope gets the+ // mode even when the routing fields are absent — otherwise the tab keeps// showing the previous provider despite the new cloud routing.- if (noteFormatting.provider !== undefined) s.setNoteFormattingProvider(noteFormatting.provider);- if (noteFormatting.model !== undefined) s.setNoteFormattingModel(noteFormatting.model);- if (noteFormatting.cloudMode !== undefined)- s.setNoteFormattingCloudMode(noteFormatting.cloudMode);- s.setNoteFormattingMode(mode);- if (dictationAgent.provider !== undefined) s.setDictationAgentProvider(dictationAgent.provider);- if (dictationAgent.model !== undefined) s.setDictationAgentModel(dictationAgent.model);- if (dictationAgent.cloudMode !== undefined)- s.setDictationAgentCloudMode(dictationAgent.cloudMode);- s.setDictationAgentMode(mode);- if (chatIntelligence.provider !== undefined) s.setChatAgentProvider(chatIntelligence.provider);- if (chatIntelligence.model !== undefined) s.setChatAgentModel(chatIntelligence.model);- if (chatIntelligence.cloudMode !== undefined)- s.setChatAgentCloudMode(chatIntelligence.cloudMode);- s.setChatAgentMode(mode);- if (dictationTranslation.provider !== undefined)- s.setTranslationProvider(dictationTranslation.provider);- if (dictationTranslation.model !== undefined) s.setTranslationModel(dictationTranslation.model);- if (dictationTranslation.cloudMode !== undefined)- s.setTranslationCloudMode(dictationTranslation.cloudMode);- s.setTranslationMode(mode);+ for (const [scope, patch] of Object.entries(mirrored)) {+ setResolvedLLMConfig(scope as InferenceScope, patch);+ }},updateApiKeys: (keys: Partial<ApiKeySettings>) => {@@ -3240,6 +3261,13 @@ export async function initializeSettings(): Promise<void> {assemblyaiApiKey: assemblyai || "",});+ if (localStorage.getItem("_dictationAgentSeeded") === "key-pending") {+ const { chatAgentCustomApiKey, setDictationAgentCustomApiKey } =+ useSettingsStore.getState();+ if (chatAgentCustomApiKey) setDictationAgentCustomApiKey(chatAgentCustomApiKey);+ localStorage.setItem("_dictationAgentSeeded", "1");+ }+if (!localStorage.getItem("enterpriseSetupMode")) {// One-time migration. "Managed by default" is meant to equip employees who never chose a// provider — not to move someone who deliberately set up local, self-hosted, BYOK, ordiff --git a/test/components/onboardingFlow.test.js b/test/components/onboardingFlow.test.jsindex ad860db6f..c09f6be1d 100644--- a/test/components/onboardingFlow.test.js+++ b/test/components/onboardingFlow.test.js@@ -167,8 +167,10 @@ test("versioned sessions reject malformed or old data", async () => {const legacyV2 = { ...session };delete legacyV2.selfHostedRequested;+ delete legacyV2.screenContextRequested;delete legacyV2.resume;assert.equal(parseOnboardingSession(JSON.stringify(legacyV2)).selfHostedRequested, false);+ assert.equal(parseOnboardingSession(JSON.stringify(legacyV2)).screenContextRequested, false);assert.deepEqual(parseOnboardingSession(JSON.stringify(legacyV2)).resume,createOnboardingSession().resume@@ -177,6 +179,19 @@ test("versioned sessions reject malformed or old data", async () => {parseOnboardingSession(JSON.stringify({ ...session, selfHostedRequested: "yes" })),null);+ assert.equal(+ parseOnboardingSession(JSON.stringify({ ...session, screenContextRequested: "yes" })),+ null+ );+});++// The permissions step's Enable click must survive the quit-and-reopen macOS+// asks for after granting Screen Recording, or the OS permission lands with+// the Voice Assistant setting still off.+test("a session keeps the screen-context request latch across a relaunch", async () => {+ const { createOnboardingSession, parseOnboardingSession } = await load();+ const session = { ...createOnboardingSession(), screenContextRequested: true };+ assert.equal(parseOnboardingSession(JSON.stringify(session)).screenContextRequested, true);});test("v2 sessions retain safe within-step state without accepting secrets", async () => {diff --git a/test/helpers/dictationAgentInference.test.js b/test/helpers/dictationAgentInference.test.jsindex 9c30b0b3a..a80320713 100644--- a/test/helpers/dictationAgentInference.test.js+++ b/test/helpers/dictationAgentInference.test.js@@ -276,3 +276,180 @@ test("a vision scope with its own endpoint never borrows the agent's key", async"the agent's key must not ride to the vision scope's own endpoint");});++// The assistant panel answers spoken commands on the Voice Assistant scope —+// the tab the user actually edits — and gates screenshots exactly like the+// dictation route does.+const imageWired = (providerId) =>+ ["openai", "anthropic", "gemini", "openwhispr"].includes(providerId);+const panelSettings = {+ ...baseSettings,+ isSignedIn: false,+ chatAgentMode: "providers",+ chatAgentProvider: "anthropic",+ chatAgentModel: "claude-sonnet-4-5",+ useDictationAgentVisionModel: false,+ dictationAgentVisionMode: "",+ dictationAgentVisionProvider: "",+ dictationAgentVisionModel: "",+ dictationAgentVisionCloudBaseUrl: "",+ dictationAgentVisionCustomApiKey: "",+};+const panel = (settings, options = {}) =>+ resolveChatStreamingInference(settings, {+ inferenceScope: "dictationAgent",+ isProviderImageWired: imageWired,+ ...options,+ });+let resolveChatStreamingInference;+test.before(async () => {+ ({ resolveChatStreamingInference } = await load());+});++test("typed chat surfaces stay on the Chat scope even when the Voice Assistant scope is reachable", () => {+ const { config, attachScreenContext } = resolveChatStreamingInference(panelSettings, {+ hasScreenContext: true,+ isProviderImageWired: imageWired,+ });++ assert.equal(config.scope, "chatIntelligence");+ assert.equal(config.model, "claude-sonnet-4-5");+ assert.equal(attachScreenContext, true, "Chat's own model can see images");+});++test("an unreachable Voice Assistant scope falls the panel back to the Chat scope", () => {+ const { config, attachScreenContext } = panel(+ {+ ...panelSettings,+ dictationAgentMode: "providers",+ dictationAgentProvider: "",+ dictationAgentModel: "",+ },+ { hasScreenContext: true }+ );++ assert.equal(config.scope, "chatIntelligence");+ assert.equal(config.provider, "anthropic");+ assert.equal(config.model, "claude-sonnet-4-5");+ assert.equal(attachScreenContext, true, "the fallback is gated on Chat's model, not the agent's");+});++test("a signed-in cloud Voice Assistant scope is reachable without a model and takes screenshots", () => {+ const { config, attachScreenContext } = panel(+ {+ ...panelSettings,+ isSignedIn: true,+ dictationAgentMode: "openwhispr",+ dictationAgentCloudMode: "openwhispr",+ dictationAgentProvider: "openwhispr",+ dictationAgentModel: "",+ },+ { hasScreenContext: true }+ );++ assert.equal(config.scope, "dictationAgent");+ assert.equal(config.mode, "openwhispr");+ assert.equal(attachScreenContext, true, "cloud vision-routes server-side");+});++test("a signed-out cloud Voice Assistant scope is unreachable and falls back to Chat", () => {+ const { config } = panel({+ ...panelSettings,+ dictationAgentMode: "openwhispr",+ dictationAgentCloudMode: "openwhispr",+ dictationAgentModel: "",+ });++ assert.equal(config.scope, "chatIntelligence");+});++test("the assistant toggled off keeps the panel on the Chat scope", () => {+ const { config } = panel({ ...panelSettings, useDictationAgent: false });++ assert.equal(config.scope, "chatIntelligence");+});++test("the assistant panel resolves the Voice Assistant scope, not the Chat scope", () => {+ const { config, attachScreenContext } = panel(panelSettings);++ assert.equal(config.scope, "dictationAgent");+ assert.equal(config.provider, "openai");+ assert.equal(config.model, "gpt-5-mini");+ assert.equal(attachScreenContext, false, "nothing to attach without a screenshot");+});++test("a screenshot attaches to the base scope when its model can see images", () => {+ const { config, attachScreenContext } = panel(panelSettings, { hasScreenContext: true });++ assert.equal(config.scope, "dictationAgent");+ assert.equal(config.model, "gpt-5-mini");+ assert.equal(attachScreenContext, true);+});++test("a screenshot is dropped when the base scope's provider is not image-wired", () => {+ const { config, attachScreenContext } = panel(+ {+ ...panelSettings,+ dictationAgentProvider: "groq",+ dictationAgentModel: "llama-3.3-70b-versatile",+ },+ { hasScreenContext: true }+ );++ assert.equal(config.scope, "dictationAgent");+ assert.equal(attachScreenContext, false);+});++const visionOverride = {+ useDictationAgentVisionModel: true,+ dictationAgentVisionMode: "providers",+ dictationAgentVisionProvider: "gemini",+ // Not in the local registry under gemini: a configured override is trusted+ // to see images, the way the dictation route trusts it.+ dictationAgentVisionModel: "gemini-2.5-flash",+};++test("a screenshot swaps the panel onto the vision override and keeps the image", () => {+ const { config, attachScreenContext } = panel(+ { ...panelSettings, ...visionOverride },+ { hasScreenContext: true }+ );++ assert.equal(config.scope, "dictationAgentVision");+ assert.equal(config.mode, "providers");+ assert.equal(config.provider, "gemini");+ assert.equal(config.model, "gemini-2.5-flash");+ assert.equal(attachScreenContext, true);+});++test("the vision override is ignored without a screenshot", () => {+ const { config } = panel({ ...panelSettings, ...visionOverride });++ assert.equal(config.scope, "dictationAgent");+});++test("the vision override toggle alone does not redirect without a chosen model", () => {+ const { config, attachScreenContext } = panel(+ { ...panelSettings, useDictationAgentVisionModel: true, dictationAgentVisionMode: "providers" },+ { hasScreenContext: true }+ );++ assert.equal(config.scope, "dictationAgent");+ assert.equal(attachScreenContext, true, "the base scope's own gate decides");+});++test("a vision override that cannot see images drops the screenshot instead of redirecting", () => {+ const { config, attachScreenContext } = panel(+ {+ ...panelSettings,+ ...visionOverride,+ // groq's client is not image-wired in the provider registry.+ dictationAgentVisionProvider: "groq",+ dictationAgentVisionModel: "llama-3.3-70b-versatile",+ },+ { hasScreenContext: true }+ );++ assert.equal(config.scope, "dictationAgent");+ assert.equal(attachScreenContext, false);+});diff --git a/test/helpers/reasoningRouting.test.js b/test/helpers/reasoningRouting.test.jsindex 267ed0e45..94163ecda 100644--- a/test/helpers/reasoningRouting.test.js+++ b/test/helpers/reasoningRouting.test.js@@ -48,6 +48,35 @@ test("fan-out routes provider, model and mode to all five scopes", async () => {}});+// A self-hosted endpoint is only reachable from a scope that carries its url+// and key; mirroring provider/model alone left four scopes pointing at a+// "self-hosted" mode with no host behind it.+test("fan-out mirrors the endpoint url and key alongside the routing", async () => {+ const { buildReasoningScopePatches } = await load();+ const { dictationCleanup, dictationAgent } = buildReasoningScopePatches(+ {+ cleanupProvider: "custom",+ cleanupModel: "qwen3-8b",+ cleanupCloudMode: "byok",+ cleanupCloudBaseUrl: "",+ cleanupRemoteUrl: "https://llm.lan:8080/v1",+ cleanupCustomApiKey: "lan-key",+ },+ "self-hosted"+ );++ assert.equal(dictationCleanup.cleanupRemoteUrl, "https://llm.lan:8080/v1");+ assert.deepEqual(dictationAgent, {+ mode: "self-hosted",+ provider: "custom",+ model: "qwen3-8b",+ cloudMode: "byok",+ cloudBaseUrl: "",+ remoteUrl: "https://llm.lan:8080/v1",+ customApiKey: "lan-key",+ });+});+test("fan-out with partial settings only mirrors the provided routing fields", async () => {const { buildReasoningScopePatches } = await load();const {@@ -63,10 +92,7 @@ test("fan-out with partial settings only mirrors the provided routing fields", aassert.equal("cleanupProvider" in dictationCleanup, false);for (const scope of [noteFormatting, dictationAgent, chatIntelligence, dictationTranslation]) {- assert.equal(scope.mode, "openwhispr");- assert.equal("provider" in scope, false);- assert.equal("model" in scope, false);- assert.equal("cloudMode" in scope, false);+ assert.deepEqual(scope, { mode: "openwhispr" });}});diff --git a/test/helpers/settingsStoreDictationAgentSeed.test.js b/test/helpers/settingsStoreDictationAgentSeed.test.jsnew file mode 100644index 000000000..c1ed70a19--- /dev/null+++ b/test/helpers/settingsStoreDictationAgentSeed.test.js@@ -0,0 +1,82 @@+const test = require("node:test");+const assert = require("node:assert/strict");+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");++// The assistant panel used to answer on the Chat scope while the Voice Assistant+// scope sat unconfigured (mode defaulting to cloud, empty provider and model).+// Now that the panel answers on the Voice Assistant scope, a profile that never+// configured it must inherit its Chat scope once, or a signed-in Local/BYOK chat+// user would have spoken commands move to OpenWhispr Cloud silently.+test("the Voice Assistant scope is seeded from Chat once for profiles that never configured it", async (t) => {+ const { storage } = installBrowserGlobals(t);+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-dictation-agent-seed-test-",+ });+ const load = async (seed) => {+ storage.clear();+ for (const [key, value] of Object.entries(seed)) storage.setItem(key, value);+ vite.moduleGraph.invalidateAll();+ const mod = await vite.ssrLoadModule("/stores/settingsStore.ts");+ return mod.useSettingsStore.getState();+ };+ const localChat = {+ _llmScopeKeysMigrated: "1",+ chatAgentMode: "local",+ chatAgentProvider: "llama",+ chatAgentModel: "qwen3-8b",+ chatAgentCloudMode: "byok",+ };++ await t.test("a Local chat with an untouched Voice Assistant scope copies it over", async () => {+ const state = await load(localChat);+ assert.equal(state.dictationAgentMode, "local");+ assert.equal(state.dictationAgentProvider, "llama");+ assert.equal(state.dictationAgentModel, "qwen3-8b");+ assert.equal(state.dictationAgentCloudMode, "byok");+ assert.equal(storage.getItem("_dictationAgentSeeded"), "key-pending");+ });++ await t.test("a self-hosted chat carries its endpoint", async () => {+ const state = await load({+ ...localChat,+ chatAgentMode: "self-hosted",+ chatAgentProvider: "custom",+ chatAgentRemoteUrl: "https://llm.lan:8080/v1",+ });+ assert.equal(state.dictationAgentMode, "self-hosted");+ assert.equal(state.dictationAgentRemoteUrl, "https://llm.lan:8080/v1");+ });++ await t.test("a Voice Assistant scope the user configured is left alone", async () => {+ const state = await load({ ...localChat, dictationAgentMode: "openwhispr" });+ assert.equal(state.dictationAgentMode, "openwhispr");+ assert.equal(state.dictationAgentProvider, "");+ assert.equal(storage.getItem("_dictationAgentSeeded"), "1");+ });++ await t.test("a scope with only a provider and model written counts as configured", async () => {+ const state = await load({+ ...localChat,+ dictationAgentProvider: "groq",+ dictationAgentModel: "openai/gpt-oss-20b",+ });+ assert.equal(state.dictationAgentMode, "openwhispr");+ assert.equal(state.dictationAgentProvider, "groq");+ assert.equal(state.dictationAgentModel, "openai/gpt-oss-20b");+ });++ // The provider-settings and agent-mode migrations leave a fresh profile's Chat+ // scope on the cloud default, so the copy is a no-op in effect.+ await t.test("a fresh profile inherits the same cloud default Chat was migrated to", async () => {+ const state = await load({});+ assert.equal(storage.getItem("chatAgentMode"), "openwhispr");+ assert.equal(state.dictationAgentMode, "openwhispr");+ assert.equal(state.dictationAgentProvider, "");+ });++ await t.test("a seeded profile is not seeded again after Chat changes", async () => {+ const state = await load({ ...localChat, _dictationAgentSeeded: "1" });+ assert.equal(state.dictationAgentMode, "openwhispr");+ assert.equal(storage.getItem("dictationAgentMode"), null);+ });+});