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
feat: reuse Intelligence model selector in Agent Mode + add cloud streaming
Gabriel Stein5870993f680a
diff --git a/preload.js b/preload.jsindex f7692a3c2..528dbc039 100644--- a/preload.js+++ b/preload.js@@ -465,6 +465,15 @@ contextBridge.exposeInMainWorld("electronAPI", {acquireRecordingLock: (pipeline) => ipcRenderer.invoke("acquire-recording-lock", pipeline),releaseRecordingLock: (pipeline) => ipcRenderer.invoke("release-recording-lock", pipeline),+ // Agent cloud streaming+ cloudAgentStream: (messages, opts) =>+ ipcRenderer.invoke("cloud-agent-stream", messages, opts),+ onAgentStreamChunk: registerListener(+ "agent-stream-chunk",+ (callback) => (_event, chunk) => callback(chunk)+ ),+ onAgentStreamDone: registerListener("agent-stream-done", (callback) => () => callback()),+// Agent conversation persistencecreateAgentConversation: (title) =>ipcRenderer.invoke("db-create-agent-conversation", title),diff --git a/src/components/AgentOverlay.tsx b/src/components/AgentOverlay.tsxindex 3f87ea4da..7cac5aa7c 100644--- a/src/components/AgentOverlay.tsx+++ b/src/components/AgentOverlay.tsx@@ -86,15 +86,21 @@ export default function AgentOverlay() {setMessages((prev) => [...prev, { id: assistantId, role: "assistant", content: "", isStreaming: true }]);setAgentState("streaming");+ const isCloudAgent = settings.isSignedIn && settings.cloudAgentMode === "openwhispr";+try {let fullContent = "";- for await (const chunk of ReasoningService.processTextStreaming(- llmMessages,- settings.agentModel,- settings.agentProvider,- { systemPrompt }- )) {+ const streamSource = isCloudAgent+ ? ReasoningService.processTextStreamingCloud(llmMessages, { systemPrompt })+ : ReasoningService.processTextStreaming(+ llmMessages,+ settings.agentModel,+ settings.agentProvider,+ { systemPrompt }+ );++ for await (const chunk of streamSource) {fullContent += chunk;setMessages((prev) =>prev.map((m) => (m.id === assistantId ? { ...m, content: fullContent } : m))diff --git a/src/components/settings/AgentModeSettings.tsx b/src/components/settings/AgentModeSettings.tsxindex 145132a4c..98d3f95e0 100644--- a/src/components/settings/AgentModeSettings.tsx+++ b/src/components/settings/AgentModeSettings.tsx@@ -1,12 +1,10 @@import { useTranslation } from "react-i18next";+import { Cloud, Key } from "lucide-react";import { useSettingsStore } from "../../stores/settingsStore";import { HotkeyInput } from "../ui/HotkeyInput";import { Toggle } from "../ui/toggle";import { SettingsRow, SettingsPanel, SettingsPanelRow, SectionHeader } from "../ui/SettingsSection";-import { ProviderTabs } from "../ui/ProviderTabs";-import { REASONING_PROVIDERS } from "../../models/ModelRegistry";-import { getProviderIcon, isMonochromeProvider } from "../../utils/providerIcons";-import { cn } from "../lib/utils";+import ReasoningModelSelector from "../ReasoningModelSelector";export default function AgentModeSettings() {const { t } = useTranslation();@@ -21,16 +19,25 @@ export default function AgentModeSettings() {setAgentProvider,agentSystemPrompt,setAgentSystemPrompt,+ cloudAgentMode,+ setCloudAgentMode,+ isSignedIn,+ openaiApiKey,+ setOpenaiApiKey,+ anthropicApiKey,+ setAnthropicApiKey,+ geminiApiKey,+ setGeminiApiKey,+ groqApiKey,+ setGroqApiKey,+ customReasoningApiKey,+ setCustomReasoningApiKey,+ cloudReasoningBaseUrl,+ setCloudReasoningBaseUrl,} = useSettingsStore();- const providerTabs = Object.entries(REASONING_PROVIDERS)- .filter(([id]) => id !== "local")- .map(([id, provider]) => ({- id,- name: provider.name,- }));-- const currentProviderModels = REASONING_PROVIDERS[agentProvider]?.models ?? [];+ const isCloudMode = isSignedIn && cloudAgentMode === "openwhispr";+ const isCustomMode = cloudAgentMode === "byok";return (<div className="space-y-6">@@ -62,67 +69,139 @@ export default function AgentModeSettings() {<HotkeyInput value={agentKey} onChange={setAgentKey} /></div>- {/* Agent Model */}- <div>- <SectionHeader- title={t("agentMode.settings.model")}- description={t("agentMode.settings.modelDescription")}- />-- <div className="space-y-3">- <ProviderTabs- providers={providerTabs}- selectedId={agentProvider}- onSelect={(id) => {- setAgentProvider(id);- const models = REASONING_PROVIDERS[id]?.models;- if (models && models.length > 0) {- setAgentModel(models[0].value);- }- }}- renderIcon={(providerId) => {- const icon = getProviderIcon(providerId);- if (!icon) return null;- return (- <img- src={icon}- alt=""- className={cn(- "w-3.5 h-3.5",- isMonochromeProvider(providerId) && "dark:invert"+ {/* Cloud / BYOK toggle */}+ {isSignedIn && (+ <SettingsPanel>+ <SettingsPanelRow>+ <button+ onClick={() => {+ if (!isCloudMode) setCloudAgentMode("openwhispr");+ }}+ className="w-full flex items-center gap-3 text-left cursor-pointer group"+ >+ <div+ className={`w-8 h-8 rounded-md flex items-center justify-center shrink-0 transition-colors ${+ isCloudMode+ ? "bg-primary/10 dark:bg-primary/15"+ : "bg-muted/60 dark:bg-surface-raised group-hover:bg-muted dark:group-hover:bg-surface-3"+ }`}+ >+ <Cloud+ className={`w-4 h-4 transition-colors ${+ isCloudMode ? "text-primary" : "text-muted-foreground"+ }`}+ />+ </div>+ <div className="flex-1 min-w-0">+ <div className="flex items-center gap-2">+ <span className="text-xs font-medium text-foreground">+ {t("agentMode.settings.openwhisprCloud")}+ </span>+ {isCloudMode && (+ <span className="text-xs font-medium text-primary bg-primary/10 dark:bg-primary/15 px-1.5 py-px rounded-sm">+ {t("common.active")}+ </span>)}+ </div>+ <p className="text-xs text-muted-foreground/80 mt-0.5">+ {t("agentMode.settings.openwhisprCloudDescription")}+ </p>+ </div>+ <div+ className={`w-4 h-4 rounded-full border-2 shrink-0 transition-colors ${+ isCloudMode+ ? "border-primary bg-primary"+ : "border-border-hover dark:border-border-subtle"+ }`}+ >+ {isCloudMode && (+ <div className="w-full h-full flex items-center justify-center">+ <div className="w-1.5 h-1.5 rounded-full bg-primary-foreground" />+ </div>+ )}+ </div>+ </button>+ </SettingsPanelRow>+ <SettingsPanelRow>+ <button+ onClick={() => {+ if (!isCustomMode) setCloudAgentMode("byok");+ }}+ className="w-full flex items-center gap-3 text-left cursor-pointer group"+ >+ <div+ className={`w-8 h-8 rounded-md flex items-center justify-center shrink-0 transition-colors ${+ isCustomMode+ ? "bg-accent/10 dark:bg-accent/15"+ : "bg-muted/60 dark:bg-surface-raised group-hover:bg-muted dark:group-hover:bg-surface-3"+ }`}+ >+ <Key+ className={`w-4 h-4 transition-colors ${+ isCustomMode ? "text-accent" : "text-muted-foreground"+ }`}/>- );- }}- colorScheme="dynamic"- scrollable- />-- <SettingsPanel>- <SettingsPanelRow>- <div className="space-y-1.5">- {currentProviderModels.map((model) => (- <button- key={model.value}- onClick={() => setAgentModel(model.value)}- className={cn(- "w-full text-left px-3 py-2 rounded-md text-xs transition-colors",- agentModel === model.value- ? "bg-primary/10 dark:bg-primary/15 text-primary border border-primary/20"- : "hover:bg-muted/60 dark:hover:bg-surface-raised text-foreground border border-transparent"- )}- >- <span className="font-medium">{model.label}</span>- {model.description && (- <span className="text-muted-foreground ml-1.5">{model.description}</span>- )}- </button>- ))}</div>- </SettingsPanelRow>- </SettingsPanel>+ <div className="flex-1 min-w-0">+ <div className="flex items-center gap-2">+ <span className="text-xs font-medium text-foreground">+ {t("agentMode.settings.customSetup")}+ </span>+ {isCustomMode && (+ <span className="text-xs font-medium text-accent bg-accent/10 dark:bg-accent/15 px-1.5 py-px rounded-sm">+ {t("common.active")}+ </span>+ )}+ </div>+ <p className="text-xs text-muted-foreground/80 mt-0.5">+ {t("agentMode.settings.customSetupDescription")}+ </p>+ </div>+ <div+ className={`w-4 h-4 rounded-full border-2 shrink-0 transition-colors ${+ isCustomMode+ ? "border-accent bg-accent"+ : "border-border-hover dark:border-border-subtle"+ }`}+ >+ {isCustomMode && (+ <div className="w-full h-full flex items-center justify-center">+ <div className="w-1.5 h-1.5 rounded-full bg-accent-foreground" />+ </div>+ )}+ </div>+ </button>+ </SettingsPanelRow>+ </SettingsPanel>+ )}++ {/* Model selector — shown when Custom Setup is active or not signed in */}+ {(isCustomMode || !isSignedIn) && (+ <div>+ <SectionHeader+ title={t("agentMode.settings.model")}+ description={t("agentMode.settings.modelDescription")}+ />+ <ReasoningModelSelector+ reasoningModel={agentModel}+ setReasoningModel={setAgentModel}+ localReasoningProvider={agentProvider}+ setLocalReasoningProvider={setAgentProvider}+ cloudReasoningBaseUrl={cloudReasoningBaseUrl}+ setCloudReasoningBaseUrl={setCloudReasoningBaseUrl}+ openaiApiKey={openaiApiKey}+ setOpenaiApiKey={setOpenaiApiKey}+ anthropicApiKey={anthropicApiKey}+ setAnthropicApiKey={setAnthropicApiKey}+ geminiApiKey={geminiApiKey}+ setGeminiApiKey={setGeminiApiKey}+ groqApiKey={groqApiKey}+ setGroqApiKey={setGroqApiKey}+ customReasoningApiKey={customReasoningApiKey}+ setCustomReasoningApiKey={setCustomReasoningApiKey}+ /></div>- </div>+ )}{/* Custom System Prompt */}<div>diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 4b624f0f9..abfd466d8 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -1993,6 +1993,88 @@ class IPCHandlers {}});+ ipcMain.handle("cloud-agent-stream", async (event, messages, opts = {}) => {+ try {+ const apiUrl = getApiUrl();+ if (!apiUrl) throw new Error("OpenWhispr API URL not configured");++ const cookieHeader = await getSessionCookies(event);+ if (!cookieHeader) throw new Error("No session cookies available");++ debugLogger.debug(+ "Cloud agent stream request",+ { messageCount: messages?.length || 0 },+ "cloud-api"+ );++ const response = await fetch(`${apiUrl}/api/agent/stream`, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ Cookie: cookieHeader,+ },+ body: JSON.stringify({+ messages,+ systemPrompt: opts.systemPrompt,+ sessionId: this.sessionId,+ clientType: "desktop",+ appVersion: app.getVersion(),+ }),+ });++ if (!response.ok) {+ if (response.status === 401) {+ return { success: false, error: "Session expired", code: "AUTH_EXPIRED" };+ }+ const errorData = await response.json().catch(() => ({}));+ return {+ success: false,+ error: errorData.error || `API error: ${response.status}`,+ };+ }++ const reader = response.body.getReader();+ const decoder = new TextDecoder();+ let buffer = "";++ try {+ while (true) {+ const { done, value } = await reader.read();+ if (done) break;++ buffer += decoder.decode(value, { stream: true });+ const lines = buffer.split("\n");+ buffer = lines.pop() || "";++ for (const line of lines) {+ const trimmed = line.trim();+ if (!trimmed) continue;++ // Handle Vercel AI SDK data stream format+ // Text chunks are prefixed with "0:" followed by a JSON string+ if (trimmed.startsWith("0:")) {+ try {+ const text = JSON.parse(trimmed.slice(2));+ if (text) event.sender.send("agent-stream-chunk", text);+ } catch {+ // skip malformed chunks+ }+ }+ }+ }+ } finally {+ reader.releaseLock();+ }++ event.sender.send("agent-stream-done");+ return { success: true };+ } catch (error) {+ debugLogger.error("Cloud agent stream error:", error);+ event.sender.send("agent-stream-done");+ return { success: false, error: error.message };+ }+ });+ipcMain.handle("cloud-streaming-usage",async (event, text, audioDurationSeconds, opts = {}) => {diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.tsindex 5e7fb52ed..6267c2c3d 100644--- a/src/hooks/useSettings.ts+++ b/src/hooks/useSettings.ts@@ -65,6 +65,7 @@ export interface AgentModeSettings {agentKey: string;agentSystemPrompt: string;agentEnabled: boolean;+ cloudAgentMode: string;}function useSettingsInternal() {diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex 844ba3877..0d564d36b 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -1605,7 +1605,11 @@"modelDescription": "KI-Modell für Agent-Unterhaltungen","systemPrompt": "System-Prompt","systemPromptDescription": "Benutzerdefinierte Anweisungen für den Agenten",- "systemPromptPlaceholder": "Benutzerdefinierten System-Prompt eingeben..."+ "systemPromptPlaceholder": "Benutzerdefinierten System-Prompt eingeben...",+ "openwhisprCloud": "OpenWhispr Cloud",+ "openwhisprCloudDescription": "OpenWhisprs Cloud-KI für Agent-Unterhaltungen verwenden",+ "customSetup": "Eigene Konfiguration (BYOK)",+ "customSetupDescription": "Eigene API-Schlüssel verwenden und bevorzugtes Modell auswählen"},"chat": {"placeholder": "Drücke {{hotkey}} zum Sprechen",diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex 3de810dc2..60af9653f 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -1605,7 +1605,11 @@"modelDescription": "AI model used for agent conversations","systemPrompt": "System Prompt","systemPromptDescription": "Custom instructions for the agent",- "systemPromptPlaceholder": "Enter custom system prompt..."+ "systemPromptPlaceholder": "Enter custom system prompt...",+ "openwhisprCloud": "OpenWhispr Cloud",+ "openwhisprCloudDescription": "Use OpenWhispr's cloud AI for agent conversations",+ "customSetup": "Custom Setup (BYOK)",+ "customSetupDescription": "Use your own API keys and choose your preferred model"},"chat": {"placeholder": "Press {{hotkey}} to speak",diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex ea85cb57d..c3494bd00 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -1605,7 +1605,11 @@"modelDescription": "Modelo de IA utilizado para conversaciones del agente","systemPrompt": "Prompt del Sistema","systemPromptDescription": "Instrucciones personalizadas para el agente",- "systemPromptPlaceholder": "Introduce un prompt de sistema personalizado..."+ "systemPromptPlaceholder": "Introduce un prompt de sistema personalizado...",+ "openwhisprCloud": "OpenWhispr Cloud",+ "openwhisprCloudDescription": "Usar la IA en la nube de OpenWhispr para conversaciones del agente",+ "customSetup": "Configuración personalizada (BYOK)",+ "customSetupDescription": "Usa tus propias claves API y elige tu modelo preferido"},"chat": {"placeholder": "Presiona {{hotkey}} para hablar",diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex 285358819..eccff07e9 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -1605,7 +1605,11 @@"modelDescription": "Modèle IA utilisé pour les conversations agent","systemPrompt": "Prompt système","systemPromptDescription": "Instructions personnalisées pour l'agent",- "systemPromptPlaceholder": "Entrez un prompt système personnalisé..."+ "systemPromptPlaceholder": "Entrez un prompt système personnalisé...",+ "openwhisprCloud": "OpenWhispr Cloud",+ "openwhisprCloudDescription": "Utiliser l'IA cloud d'OpenWhispr pour les conversations agent",+ "customSetup": "Configuration personnalisée (BYOK)",+ "customSetupDescription": "Utiliser vos propres clés API et choisir votre modèle préféré"},"chat": {"placeholder": "Appuyez sur {{hotkey}} pour parler",diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex 68a9f5ccc..09381c974 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -1605,7 +1605,11 @@"modelDescription": "Modello IA utilizzato per le conversazioni agente","systemPrompt": "Prompt di Sistema","systemPromptDescription": "Istruzioni personalizzate per l'agente",- "systemPromptPlaceholder": "Inserisci un prompt di sistema personalizzato..."+ "systemPromptPlaceholder": "Inserisci un prompt di sistema personalizzato...",+ "openwhisprCloud": "OpenWhispr Cloud",+ "openwhisprCloudDescription": "Usa l'IA cloud di OpenWhispr per le conversazioni agente",+ "customSetup": "Configurazione personalizzata (BYOK)",+ "customSetupDescription": "Usa le tue chiavi API e scegli il modello che preferisci"},"chat": {"placeholder": "Premi {{hotkey}} per parlare",diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex 8acbdf07f..6a2eeec5a 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -1605,7 +1605,11 @@"modelDescription": "エージェント会話に使用するAIモデル","systemPrompt": "システムプロンプト","systemPromptDescription": "エージェントへのカスタム指示",- "systemPromptPlaceholder": "カスタムシステムプロンプトを入力..."+ "systemPromptPlaceholder": "カスタムシステムプロンプトを入力...",+ "openwhisprCloud": "OpenWhispr Cloud",+ "openwhisprCloudDescription": "OpenWhisprのクラウドAIをエージェント会話に使用する",+ "customSetup": "カスタム設定 (BYOK)",+ "customSetupDescription": "自分のAPIキーを使用してお好みのモデルを選択する"},"chat": {"placeholder": "{{hotkey}}を押して話す",diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex 5946894ef..5f2d4dcdb 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -1605,7 +1605,11 @@"modelDescription": "Modelo de IA usado para conversas do agente","systemPrompt": "Prompt do Sistema","systemPromptDescription": "Instruções personalizadas para o agente",- "systemPromptPlaceholder": "Digite um prompt de sistema personalizado..."+ "systemPromptPlaceholder": "Digite um prompt de sistema personalizado...",+ "openwhisprCloud": "OpenWhispr Cloud",+ "openwhisprCloudDescription": "Usar a IA na nuvem da OpenWhispr para conversas do agente",+ "customSetup": "Configuração personalizada (BYOK)",+ "customSetupDescription": "Use suas próprias chaves API e escolha seu modelo preferido"},"chat": {"placeholder": "Pressione {{hotkey}} para falar",diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex 9cbf6e1e4..87add7935 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -1605,7 +1605,11 @@"modelDescription": "Модель ИИ для разговоров с агентом","systemPrompt": "Системный промпт","systemPromptDescription": "Пользовательские инструкции для агента",- "systemPromptPlaceholder": "Введите пользовательский системный промпт..."+ "systemPromptPlaceholder": "Введите пользовательский системный промпт...",+ "openwhisprCloud": "OpenWhispr Cloud",+ "openwhisprCloudDescription": "Использовать облачный ИИ OpenWhispr для разговоров с агентом",+ "customSetup": "Своя настройка (BYOK)",+ "customSetupDescription": "Используйте собственные API-ключи и выберите предпочтительную модель"},"chat": {"placeholder": "Нажмите {{hotkey}} чтобы говорить",diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex ddc115932..67b6f2eb0 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -1605,7 +1605,11 @@"modelDescription": "用于助手对话的AI模型","systemPrompt": "系统提示词","systemPromptDescription": "助手的自定义指令",- "systemPromptPlaceholder": "输入自定义系统提示词..."+ "systemPromptPlaceholder": "输入自定义系统提示词...",+ "openwhisprCloud": "OpenWhispr Cloud",+ "openwhisprCloudDescription": "使用 OpenWhispr 的云端 AI 进行助手对话",+ "customSetup": "自定义配置 (BYOK)",+ "customSetupDescription": "使用自己的 API 密钥并选择偏好的模型"},"chat": {"placeholder": "按 {{hotkey}} 开始说话",diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex e0feb1a50..5df1cd307 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -1605,7 +1605,11 @@"modelDescription": "用於助手對話的AI模型","systemPrompt": "系統提示詞","systemPromptDescription": "助手的自訂指令",- "systemPromptPlaceholder": "輸入自訂系統提示詞..."+ "systemPromptPlaceholder": "輸入自訂系統提示詞...",+ "openwhisprCloud": "OpenWhispr Cloud",+ "openwhisprCloudDescription": "使用 OpenWhispr 的雲端 AI 進行助手對話",+ "customSetup": "自訂配置 (BYOK)",+ "customSetupDescription": "使用自己的 API 金鑰並選擇偏好的模型"},"chat": {"placeholder": "按 {{hotkey}} 開始說話",diff --git a/src/services/ReasoningService.ts b/src/services/ReasoningService.tsindex e32251ca1..b9a407a25 100644--- a/src/services/ReasoningService.ts+++ b/src/services/ReasoningService.ts@@ -1184,6 +1184,46 @@ class ReasoningService extends BaseReasoningService {}}+ async *processTextStreamingCloud(+ messages: Array<{ role: string; content: string }>,+ config: { systemPrompt: string }+ ): AsyncGenerator<string, void, unknown> {+ const chunks: string[] = [];+ let done = false;+ let waiting: (() => void) | null = null;++ const unsubChunk = window.electronAPI?.onAgentStreamChunk?.((chunk: string) => {+ chunks.push(chunk);+ waiting?.();+ });+ const unsubDone = window.electronAPI?.onAgentStreamDone?.(() => {+ done = true;+ waiting?.();+ });++ try {+ const result = await window.electronAPI?.cloudAgentStream?.(messages, {+ systemPrompt: config.systemPrompt,+ });++ if (result && !result.success) {+ throw new Error(result.error || "Cloud agent streaming failed");+ }++ while (!done || chunks.length > 0) {+ if (chunks.length > 0) {+ yield chunks.shift()!;+ } else if (!done) {+ await new Promise<void>((r) => { waiting = r; });+ waiting = null;+ }+ }+ } finally {+ unsubChunk?.();+ unsubDone?.();+ }+ }+async isAvailable(): Promise<boolean> {try {if (isCloudReasoningMode()) {diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.tsindex e8d488008..9fecdd4a5 100644--- a/src/stores/settingsStore.ts+++ b/src/stores/settingsStore.ts@@ -135,6 +135,7 @@ export interface SettingsStatesetAgentKey: (key: string) => void;setAgentSystemPrompt: (value: string) => void;setAgentEnabled: (value: boolean) => void;+ setCloudAgentMode: (value: string) => void;updateTranscriptionSettings: (settings: Partial<TranscriptionSettings>) => void;updateReasoningSettings: (settings: Partial<ReasoningSettings>) => void;@@ -253,6 +254,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({agentKey: readString("agentKey", ""),agentSystemPrompt: readString("agentSystemPrompt", ""),agentEnabled: readBoolean("agentEnabled", true),+ cloudAgentMode: readString("cloudAgentMode", "openwhispr"),setUseLocalWhisper: createBooleanSetter("useLocalWhisper"),setWhisperModel: createStringSetter("whisperModel"),@@ -402,6 +404,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({},setAgentSystemPrompt: createStringSetter("agentSystemPrompt"),setAgentEnabled: createBooleanSetter("agentEnabled"),+ setCloudAgentMode: createStringSetter("cloudAgentMode"),updateTranscriptionSettings: (settings: Partial<TranscriptionSettings>) => {const s = useSettingsStore.getState();@@ -466,6 +469,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({if (settings.agentSystemPrompt !== undefined)s.setAgentSystemPrompt(settings.agentSystemPrompt);if (settings.agentEnabled !== undefined) s.setAgentEnabled(settings.agentEnabled);+ if (settings.cloudAgentMode !== undefined) s.setCloudAgentMode(settings.cloudAgentMode);},}));@@ -477,6 +481,13 @@ export const selectIsCloudReasoningMode = (state: SettingsState) =>export const selectEffectiveReasoningProvider = (state: SettingsState) =>selectIsCloudReasoningMode(state) ? "openwhispr" : state.reasoningProvider;+export const selectIsCloudAgentMode = (state: SettingsState) =>+ state.isSignedIn && state.cloudAgentMode === "openwhispr";++export function isCloudAgentMode() {+ return selectIsCloudAgentMode(useSettingsStore.getState());+}+// --- Convenience getters for non-React code ---export function getSettings() {diff --git a/src/types/electron.ts b/src/types/electron.tsindex a7503b146..b4438391d 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -958,6 +958,14 @@ declare global {onAgentStartRecording?: (callback: () => void) => () => void;onAgentStopRecording?: (callback: () => void) => () => void;onAgentToggleRecording?: (callback: () => void) => () => void;++ // Agent cloud streaming+ cloudAgentStream?: (+ messages: Array<{ role: string; content: string }>,+ opts?: { systemPrompt?: string }+ ) => Promise<{ success: boolean; error?: string; code?: string }>;+ onAgentStreamChunk?: (callback: (chunk: string) => void) => () => void;+ onAgentStreamDone?: (callback: () => void) => () => void;};api?: {