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
Add voice agent hotkey (#932)
Gabriel Stein3688168f962a
diff --git a/CLAUDE.md b/CLAUDE.mdindex f38377a7a..ca734cf46 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -62,6 +62,7 @@ OpenWhispr is an Electron-based desktop dictation application that uses whisper.- **dragManager.js**: Window dragging functionality- **environment.js**: Environment variable and OpenAI API management- **hotkeyManager.js**: Global hotkey registration and management+ - Named hotkey slots: `dictation`, `agent` (chat agent overlay), `voiceAgent` (dictation routed straight to the dictation agent), `meeting`- Handles platform-specific defaults (GLOBE on macOS, backtick on Windows/Linux)- Auto-fallback to F8/F9 if default hotkey is unavailable- Notifies renderer via IPC when hotkey registration fails@@ -527,6 +528,27 @@ Detects meetings via three independent sources, orchestrated by `MeetingDetectio- Exponential backoff on consecutive failures: 2min → 4min → 8min → cap 30min- Reset to normal 2min interval on any successful sync+### 17. Voice Agent Hotkey++A dedicated global hotkey that starts a dictation whose transcript is sent straight to the dictation agent as a command — no wake word ("Hey [AgentName]") needed — and that always bypasses the cleanup model. Separate from the chat agent hotkey (`CHAT_AGENT_KEY`), which toggles the agent overlay window.++**Flow**:+1. Hotkey pressed → `voiceAgent` slot callback in `main.js` → `windowManager.sendToggleVoiceAgent()` → `toggle-voice-agent` IPC to the main window+2. `useAudioRecording.js` starts a recording with `audioManager.setVoiceAgentRequested(true)` (any other start resets it to `false`)+3. On transcription, `resolveReasoningRoute` consults `resolveDictationRouteKind()` (`src/helpers/dictationRouting.js`): a voice agent recording always takes the agent route; if the dictation agent is disabled or has no model, the raw transcript is returned — it never falls back to cleanup++**Storage & IPC**:+- Env var: `VOICE_AGENT_KEY` (persisted via `environment.js`), store key: `voiceAgentKey` (no default — user opt-in)+- IPC handlers: `update-voice-agent-hotkey`, `get-voice-agent-key`+- Hotkey slot: `voiceAgent` (tap-to-toggle; GNOME-native slot via `ToggleVoiceAgent` D-Bus method, KDE via KGlobalAccel, otherwise `globalShortcut`)++**UI**:+- Settings → Hotkeys → "Voice Agent Hotkey" (with cross-slot conflict validation)+- Onboarding: optional step right after the dictation hotkey (activation) step+- Requires the dictation agent to be enabled (Settings → AI Models) for the agent route to apply++**Tests**: `test/helpers/dictationRouting.test.js` (run with `node --test`)+## Development Guidelines### Internationalization (i18n) — REQUIREDdiff --git a/README.md b/README.mdindex 64734ec83..a685077d5 100644--- a/README.md+++ b/README.md@@ -42,6 +42,7 @@ OpenWhispr turns your voice into text, notes, and actions from your desktop. Pre- **Voice dictation** — global hotkey to dictate into any app with automatic pasting- **AI agent** — talk to GPT-5, Claude, Gemini, Groq, or local models with a named voice assistant+- **Voice agent hotkey** — dedicated hotkey that sends your dictation straight to your AI agent as a command, no wake word needed and no cleanup pass- **Meeting transcription** — auto-detect Zoom, Teams, and FaceTime calls with live speaker diarization, voice fingerprinting, and Google Calendar integration- **Local speaker diarization** — on-device speaker labelling with voice fingerprint recognition across meetings, no cloud required- **Notes** — create, organize, and search notes with folders, semantic search, cloud sync, and AI actionsdiff --git a/main.js b/main.jsindex 56def01a9..331159a2f 100644--- a/main.js+++ b/main.js@@ -833,6 +833,29 @@ async function startApp() {}}+ // Set up voice agent hotkey (dictation routed straight to the dictation+ // agent, bypassing cleanup)+ const voiceAgentHotkeyCallback = () => {+ windowManager.sendToggleVoiceAgent();+ };+ windowManager._voiceAgentHotkeyCallback = voiceAgentHotkeyCallback;++ const savedVoiceAgentKey = environmentManager.getVoiceAgentKey?.() || "";+ if (savedVoiceAgentKey) {+ const result = await hotkeyManager.registerSlot(+ "voiceAgent",+ savedVoiceAgentKey,+ voiceAgentHotkeyCallback+ );+ if (!result.success) {+ debugLogger.warn(+ "Failed to restore voice agent hotkey",+ { hotkey: savedVoiceAgentKey },+ "hotkey"+ );+ }+ }+// Set up meeting mode hotkeyconst meetingHotkeyCallback = () => {if (hotkeyManager.isInListeningMode()) return;@@ -1029,11 +1052,18 @@ async function startApp() {}}- // Check agent slot for Globe/Fn key+ // Check agent and voice agent slots for Globe/Fn keyconst agentHotkey = hotkeyManager.getSlotHotkey("agent");- if (agentHotkey && isGlobeLikeHotkey(agentHotkey)) {+ const voiceAgentHotkey = hotkeyManager.getSlotHotkey("voiceAgent");+ const agentUsesGlobe = !!agentHotkey && isGlobeLikeHotkey(agentHotkey);+ const voiceAgentUsesGlobe = !!voiceAgentHotkey && isGlobeLikeHotkey(voiceAgentHotkey);+ if (agentUsesGlobe) {windowManager.toggleAgentOverlay();- } else if (!isGlobeLikeHotkey(currentHotkey)) {+ }+ if (voiceAgentUsesGlobe) {+ windowManager.sendToggleVoiceAgent();+ }+ if (!agentUsesGlobe && !voiceAgentUsesGlobe && !isGlobeLikeHotkey(currentHotkey)) {debugLogger?.debug("[Globe] Ignored — hotkey is not GLOBE", { currentHotkey });}});@@ -1077,11 +1107,13 @@ async function startApp() {globeKeyManager.on("right-modifier-down", async (modifier) => {const currentHotkey = hotkeyManager.getCurrentHotkey && hotkeyManager.getCurrentHotkey();- // Check agent slot for right-modifier- const agentHotkey = hotkeyManager.getSlotHotkey("agent");- if (agentHotkey === modifier) {+ // Check agent and voice agent slots for right-modifier+ if (hotkeyManager.getSlotHotkey("agent") === modifier) {windowManager.toggleAgentOverlay();}+ if (hotkeyManager.getSlotHotkey("voiceAgent") === modifier) {+ windowManager.sendToggleVoiceAgent();+ }if (currentHotkey !== modifier) return;if (!isLiveWindow(windowManager.mainWindow)) return;@@ -1142,8 +1174,10 @@ async function startApp() {const currentHotkey = hotkeyManager.getCurrentHotkey && hotkeyManager.getCurrentHotkey();if (isMouseButtonHotkey(currentHotkey)) buttons.push(currentHotkey);- const agentHotkey = hotkeyManager.getSlotHotkey("agent");- if (isMouseButtonHotkey(agentHotkey)) buttons.push(agentHotkey);+ for (const slotName of ["agent", "voiceAgent"]) {+ const slotHotkey = hotkeyManager.getSlotHotkey(slotName);+ if (isMouseButtonHotkey(slotHotkey)) buttons.push(slotHotkey);+ }globeKeyManager.setSuppressedMouseButtons(buttons);};@@ -1158,11 +1192,13 @@ async function startApp() {if (!isMouseButtonHotkey(button)) return;const currentHotkey = hotkeyManager.getCurrentHotkey && hotkeyManager.getCurrentHotkey();- const agentHotkey = hotkeyManager.getSlotHotkey("agent");- if (agentHotkey === button) {+ if (hotkeyManager.getSlotHotkey("agent") === button) {windowManager.toggleAgentOverlay();}+ if (hotkeyManager.getSlotHotkey("voiceAgent") === button) {+ windowManager.sendToggleVoiceAgent();+ }if (currentHotkey !== button) return;if (!isLiveWindow(windowManager.mainWindow)) return;diff --git a/preload.js b/preload.jsindex 4005a6ccf..42c4b6c71 100644--- a/preload.js+++ b/preload.js@@ -27,6 +27,7 @@ contextBridge.exposeInMainWorld("electronAPI", {hideWindow: () => ipcRenderer.invoke("hide-window"),showDictationPanel: () => ipcRenderer.invoke("show-dictation-panel"),onToggleDictation: registerListener("toggle-dictation", (callback) => () => callback()),+ onToggleVoiceAgent: registerListener("toggle-voice-agent", (callback) => () => callback()),onStartDictation: registerListener("start-dictation", (callback) => () => callback()),onStopDictation: registerListener("stop-dictation", (callback) => () => callback()),@@ -716,6 +717,8 @@ contextBridge.exposeInMainWorld("electronAPI", {// Agent modeupdateAgentHotkey: (hotkey) => ipcRenderer.invoke("update-agent-hotkey", hotkey),+ updateVoiceAgentHotkey: (hotkey) => ipcRenderer.invoke("update-voice-agent-hotkey", hotkey),+ getVoiceAgentKey: () => ipcRenderer.invoke("get-voice-agent-key"),getAgentKey: () => ipcRenderer.invoke("get-agent-key"),saveAgentKey: (key) => ipcRenderer.invoke("save-agent-key", key),onAgentStartRecording: registerListener("agent-start-recording", (callback) => () => callback()),diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsxindex bf2c9c88d..3a9aa5827 100644--- a/src/components/OnboardingFlow.tsx+++ b/src/components/OnboardingFlow.tsx@@ -10,6 +10,7 @@ import {Settings,Shield,Command,+ Sparkles,UserCircle,} from "lucide-react";import TitleBar from "./TitleBar";@@ -33,6 +34,7 @@ import { useAuth } from "../hooks/useAuth";import { HotkeyInput } from "./ui/HotkeyInput";import { useHotkeyRegistration } from "../hooks/useHotkeyRegistration";import { getValidationMessage } from "../utils/hotkeyValidator";+import { validateHotkeyForSlot } from "../utils/hotkeyValidation";import { getCachedPlatform, getPlatform } from "../utils/platform";import logger from "../utils/logger";import { ActivationModeSelector } from "./ui/ActivationModeSelector";@@ -47,7 +49,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {const { t } = useTranslation();const { isSignedIn } = useAuth();- const getMaxStep = () => (isSignedIn ? 2 : 3);+ const getMaxStep = () => (isSignedIn ? 3 : 4);const [currentStep, setCurrentStep, removeCurrentStep] = useLocalStorage("onboardingCurrentStep",@@ -87,6 +89,8 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {xaiApiKey,mistralApiKey,dictationKey,+ voiceAgentKey,+ setVoiceAgentKey,activationMode,setActivationMode,setDictationKey,@@ -126,6 +130,12 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {[]);+ const validateVoiceAgentHotkey = useCallback(+ (newHotkey: string) =>+ validateHotkeyForSlot(newHotkey, { "settingsPage.general.hotkey.title": hotkey }, t),+ [hotkey, t]+ );+const permissionsHook = usePermissions(showAlertDialog);useClipboard(showAlertDialog); // Initialize clipboard hook for permission checks@@ -149,12 +159,14 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {{ id: "welcome", title: t("onboarding.steps.welcome"), icon: UserCircle },{ id: "setup", title: t("onboarding.steps.setup"), icon: Settings },{ id: "activation", title: t("onboarding.steps.activation"), icon: Command },+ { id: "voiceAgent", title: t("onboarding.steps.voiceAgent"), icon: Sparkles },]: [{ id: "welcome", title: t("onboarding.steps.welcome"), icon: UserCircle },{ id: "setup", title: t("onboarding.steps.setup"), icon: Settings },{ id: "permissions", title: t("onboarding.steps.permissions"), icon: Shield },{ id: "activation", title: t("onboarding.steps.activation"), icon: Command },+ { id: "voiceAgent", title: t("onboarding.steps.voiceAgent"), icon: Sparkles },],[isSignedIn, skipAuth, t]);@@ -594,9 +606,15 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {</div>);- case 3: // Activation (only for non-signed-in users)+ case 3: // Voice agent (signed-in users) or Activation (non-signed-in users)+ if (isSignedIn && !skipAuth) {+ return renderVoiceAgentStep();+ }return renderActivationStep();+ case 4: // Voice agent (only for non-signed-in users)+ return renderVoiceAgentStep();+default:return null;}@@ -648,11 +666,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {: t("onboarding.activation.holdDescription")}</p></div>- <ActivationModeSelector- value={activationMode}- onChange={setActivationMode}- variant="compact"- />+ <ActivationModeSelector value={activationMode} onChange={setActivationMode} /></div>)}</div>@@ -678,6 +692,46 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {</div>);+ const renderVoiceAgentStep = () => (+ <div className="space-y-4">+ {/* Header */}+ <div className="text-center space-y-0.5">+ <h2 className="text-lg font-semibold text-foreground tracking-tight">+ {t("onboarding.voiceAgent.title")}+ </h2>+ <p className="text-xs text-muted-foreground">{t("onboarding.voiceAgent.description")}</p>+ </div>++ {/* Hotkey section */}+ <div className="rounded-lg border border-border-subtle bg-surface-1 overflow-hidden">+ <div className="p-4 border-b border-border-subtle">+ <div className="flex items-center justify-between mb-3">+ <span className="text-xs font-medium text-muted-foreground uppercase tracking-wide">+ {t("onboarding.voiceAgent.hotkey")}+ </span>+ </div>+ <HotkeyInput+ value={voiceAgentKey}+ onChange={setVoiceAgentKey}+ onClear={() => setVoiceAgentKey("")}+ variant="hero"+ validate={validateVoiceAgentHotkey}+ />+ </div>++ <div className="p-4">+ <p className="text-xs text-muted-foreground leading-relaxed">+ {t("onboarding.voiceAgent.howItWorks", { agentName })}+ </p>+ </div>+ </div>++ <p className="text-xs text-muted-foreground/60 text-center">+ {t("onboarding.voiceAgent.optionalNote")}+ </p>+ </div>+ );+const canProceed = () => {switch (currentStep) {case 0:@@ -719,7 +773,14 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {return areRequiredPermissionsMet(permissionsHook.micPermissionGranted);}case 3:- return hotkey.trim() !== ""; // Activation step for non-signed-in users+ // Voice agent step (signed-in) is optional; activation (non-signed-in)+ // requires a hotkey+ if (isSignedIn && !skipAuth) {+ return true;+ }+ return hotkey.trim() !== "";+ case 4:+ return true; // Voice agent step is optional for non-signed-in usersdefault:return false;}diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex 2d52a9b42..48f9f063c 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -769,6 +769,8 @@ export default function SettingsPage({const chatAgentKey = useSettingsStore((s) => s.chatAgentKey);const setChatAgentKey = useSettingsStore((s) => s.setChatAgentKey);+ const voiceAgentKey = useSettingsStore((s) => s.voiceAgentKey);+ const setVoiceAgentKey = useSettingsStore((s) => s.setVoiceAgentKey);const meetingAudioDetection = useSettingsStore((s) => s.meetingAudioDetection);const setMeetingAudioDetection = useSettingsStore((s) => s.setMeetingAudioDetection);@@ -928,10 +930,11 @@ export default function SettingsPage({{"settingsPage.general.meetingHotkey.title": meetingKey,"agentMode.settings.hotkey": chatAgentKey,+ "settingsPage.general.voiceAgentHotkey.title": voiceAgentKey,},t),- [meetingKey, chatAgentKey, t]+ [meetingKey, chatAgentKey, voiceAgentKey, t]);const validateMeetingHotkey = useCallback(@@ -941,23 +944,39 @@ export default function SettingsPage({{"settingsPage.general.hotkey.title": dictationKey,"agentMode.settings.hotkey": chatAgentKey,+ "settingsPage.general.voiceAgentHotkey.title": voiceAgentKey,},t),- [dictationKey, chatAgentKey, t]+ [dictationKey, chatAgentKey, voiceAgentKey, t]);- const validateAgentHotkey = useCallback(+ const validateChatAgentHotkey = useCallback((hotkey: string) =>validateHotkeyForSlot(hotkey,{"settingsPage.general.hotkey.title": dictationKey,"settingsPage.general.meetingHotkey.title": meetingKey,+ "settingsPage.general.voiceAgentHotkey.title": voiceAgentKey,},t),- [dictationKey, meetingKey, t]+ [dictationKey, meetingKey, voiceAgentKey, t]+ );++ const validateVoiceAgentHotkey = useCallback(+ (hotkey: string) =>+ validateHotkeyForSlot(+ hotkey,+ {+ "settingsPage.general.hotkey.title": dictationKey,+ "settingsPage.general.meetingHotkey.title": meetingKey,+ "agentMode.settings.hotkey": chatAgentKey,+ },+ t+ ),+ [dictationKey, meetingKey, chatAgentKey, t]);const [isUsingNativeShortcut, setIsUsingNativeShortcut] = useState(false);@@ -3210,10 +3229,12 @@ EOF`,{(!isUsingNativeShortcut || getCachedPlatform() === "linux") && (<SettingsPanelRow>- <p className="text-xs font-medium text-muted-foreground/80 mb-2">- {t("settingsPage.general.hotkey.activationMode")}- </p>- <ActivationModeSelector value={activationMode} onChange={setActivationMode} />+ <div className="flex items-center justify-between gap-3">+ <span className="text-xs text-muted-foreground/80">+ {t("settingsPage.general.hotkey.activationMode")}+ </span>+ <ActivationModeSelector value={activationMode} onChange={setActivationMode} />+ </div>{getCachedPlatform() === "linux" && activationMode === "push" && (<LinuxPttSetupInfo isAvailable={linuxPttAvailable} />)}@@ -3222,6 +3243,24 @@ EOF`,</SettingsPanel></div>+ {/* Voice Agent Hotkey */}+ <div>+ <SectionHeader+ title={t("settingsPage.general.voiceAgentHotkey.title")}+ description={t("settingsPage.general.voiceAgentHotkey.description")}+ />+ <SettingsPanel>+ <SettingsPanelRow>+ <HotkeyInput+ value={voiceAgentKey}+ onChange={setVoiceAgentKey}+ onClear={() => setVoiceAgentKey("")}+ validate={validateVoiceAgentHotkey}+ />+ </SettingsPanelRow>+ </SettingsPanel>+ </div>+{/* Meeting Mode Hotkey */}<div><SectionHeader@@ -3235,21 +3274,13 @@ EOF`,onChange={async (newHotkey) => {await registerMeetingHotkey(newHotkey);}}+ onClear={async () => {+ await window.electronAPI?.registerMeetingHotkey?.("");+ setMeetingKey("");+ }}disabled={isMeetingHotkeyRegistering}validate={validateMeetingHotkey}/>- {meetingKey && (- <button- onClick={async () => {- await window.electronAPI?.registerMeetingHotkey?.("");- setMeetingKey("");- }}- disabled={isMeetingHotkeyRegistering}- className="mt-2 text-xs text-muted-foreground/70 hover:text-foreground transition-colors disabled:opacity-50"- >- {t("settingsPage.general.meetingHotkey.clear")}- </button>- )}</SettingsPanelRow><SettingsPanelRow className="flex items-center justify-between gap-3 border-t border-border/40 dark:border-white/5"><span className="text-xs text-muted-foreground/80">@@ -3283,7 +3314,7 @@ EOF`,</SettingsPanel></div>- {/* Agent Hotkey */}+ {/* Chat Agent Hotkey */}<div><SectionHeadertitle={t("agentMode.settings.hotkey")}@@ -3294,16 +3325,9 @@ EOF`,<HotkeyInputvalue={chatAgentKey}onChange={setChatAgentKey}- validate={validateAgentHotkey}+ onClear={() => setChatAgentKey("")}+ validate={validateChatAgentHotkey}/>- {chatAgentKey && (- <button- onClick={() => setChatAgentKey("")}- className="mt-2 text-xs text-muted-foreground/70 hover:text-foreground transition-colors"- >- {t("agentMode.settings.clearHotkey")}- </button>- )}</SettingsPanelRow></SettingsPanel></div>diff --git a/src/components/ui/ActivationModeSelector.tsx b/src/components/ui/ActivationModeSelector.tsxindex 0f6ce3bc3..147fa4207 100644--- a/src/components/ui/ActivationModeSelector.tsx+++ b/src/components/ui/ActivationModeSelector.tsx@@ -7,25 +7,25 @@ interface ActivationModeSelectorProps {value: ActivationMode;onChange: (mode: ActivationMode) => void;disabled?: boolean;- /** Compact variant for inline use */- variant?: "default" | "compact";}+const OPTIONS = [+ { mode: "tap", Icon: MousePointerClick, labelKey: "common.tap" },+ { mode: "push", Icon: MicVocal, labelKey: "common.hold" },+] as const;+export function ActivationModeSelector({value,onChange,disabled = false,- variant = "default",}: ActivationModeSelectorProps) {const { t } = useTranslation();- const isCompact = variant === "compact";return (<divclassName={`- relative flex rounded-md border transition-colors duration-200+ relative flex rounded-md border p-0.5 transition-colors duration-200bg-surface-1 border-border-subtle- ${isCompact ? "p-0.5" : "p-0.5"}${disabled ? "opacity-50 cursor-not-allowed" : ""}`}>@@ -39,41 +39,23 @@ export function ActivationModeSelector({`}/>- <button- type="button"- disabled={disabled}- onClick={() => onChange("tap")}- className={`- relative z-10 flex-1 flex items-center justify-center gap-1.5 rounded- transition-colors duration-150- ${isCompact ? "px-2.5 py-1.5" : "px-3 py-2"}- ${disabled ? "cursor-not-allowed" : "cursor-pointer"}- ${value === "tap" ? "text-foreground" : "text-muted-foreground hover:text-foreground"}- `}- >- <MousePointerClick className={isCompact ? "w-3.5 h-3.5" : "w-4 h-4"} />- <span className={`font-medium ${isCompact ? "text-xs" : "text-sm"}`}>- {t("common.tap")}- </span>- </button>-- <button- type="button"- disabled={disabled}- onClick={() => onChange("push")}- className={`- relative z-10 flex-1 flex items-center justify-center gap-1.5 rounded- transition-colors duration-150- ${isCompact ? "px-2.5 py-1.5" : "px-3 py-2"}- ${disabled ? "cursor-not-allowed" : "cursor-pointer"}- ${value === "push" ? "text-foreground" : "text-muted-foreground hover:text-foreground"}- `}- >- <MicVocal className={isCompact ? "w-3.5 h-3.5" : "w-4 h-4"} />- <span className={`font-medium ${isCompact ? "text-xs" : "text-sm"}`}>- {t("common.hold")}- </span>- </button>+ {OPTIONS.map(({ mode, Icon, labelKey }) => (+ <button+ key={mode}+ type="button"+ disabled={disabled}+ onClick={() => onChange(mode)}+ className={`+ relative z-10 flex-1 flex items-center justify-center gap-1 rounded px-2.5 py-1+ transition-colors duration-150+ ${disabled ? "cursor-not-allowed" : "cursor-pointer"}+ ${value === mode ? "text-foreground" : "text-muted-foreground hover:text-foreground"}+ `}+ >+ <Icon className="w-3 h-3" />+ <span className="text-xs font-medium">{t(labelKey)}</span>+ </button>+ ))}</div>);}diff --git a/src/components/ui/HotkeyInput.tsx b/src/components/ui/HotkeyInput.tsxindex 19461cfc2..2525a2ee1 100644--- a/src/components/ui/HotkeyInput.tsx+++ b/src/components/ui/HotkeyInput.tsx@@ -1,6 +1,6 @@import React, { useState, useCallback, useRef, useEffect } from "react";import { useTranslation } from "react-i18next";-import { AlertTriangle } from "lucide-react";+import { AlertTriangle, Trash2 } from "lucide-react";import { formatHotkeyLabel, isGlobeLikeHotkey } from "../../utils/hotkeys";import { getPlatform } from "../../utils/platform";@@ -143,6 +143,8 @@ const MODIFIER_CODES = new Set([export interface HotkeyInputProps {value: string;onChange: (hotkey: string) => void;+ /** When provided, a remove button is revealed on hover while a hotkey is set. */+ onClear?: () => void;onBlur?: () => void;disabled?: boolean;autoFocus?: boolean;@@ -183,6 +185,7 @@ export interface HotkeyInputVariant {export function HotkeyInput({value,onChange,+ onClear,onBlur,disabled = false,autoFocus = false,@@ -472,6 +475,27 @@ export function HotkeyInput({const isGlobe = isGlobeLikeHotkey(value);const hotkeyParts = value?.includes("+") ? displayValue.split("+") : [];+ // mousedown is prevented so clicking never focuses the container and starts capture+ const clearButton =+ onClear && value && !isCapturing && !disabled ? (+ <button+ type="button"+ tabIndex={-1}+ aria-label={t("hotkeyInput.remove")}+ onMouseDown={(e) => {+ e.preventDefault();+ e.stopPropagation();+ }}+ onClick={(e) => {+ e.stopPropagation();+ onClear();+ }}+ className="opacity-0 group-hover:opacity-100 transition-opacity duration-150 text-muted-foreground/50 hover:text-destructive cursor-pointer"+ >+ <Trash2 className="w-3.5 h-3.5" />+ </button>+ ) : null;+// Hero variant: large centered key display for onboardingif (variant === "hero") {return (@@ -574,6 +598,7 @@ export function HotkeyInput({<span className="text-sm font-medium">{t("hotkeyInput.clickToSet")}</span></div>)}+ {clearButton && <span className="absolute top-2.5 right-2.5">{clearButton}</span>}</div>);}@@ -592,7 +617,7 @@ export function HotkeyInput({onFocus={handleFocus}onBlur={handleBlur}className={`- relative overflow-hidden rounded-md border+ relative group overflow-hidden rounded-md bordertransition-colors duration-150 cursor-pointer select-none focus:outline-none${disabled@@ -678,6 +703,7 @@ export function HotkeyInput({<span className="text-xs text-muted-foreground/50">{t("hotkeyInput.clickToChangeLower")}</span>+ {clearButton}</div></div>) : (diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.jsindex 6070f6d6e..7402b1764 100644--- a/src/helpers/audioManager.js+++ b/src/helpers/audioManager.js@@ -14,6 +14,7 @@ import { reacquireIfDead } from "./micTrackHealth";import { getSettings, getEffectiveCleanupModel, isCloudCleanupMode } from "../stores/settingsStore";import { shouldSkipTranscriptionApiKey } from "./transcriptionAuth";import { detectAgentName } from "../config/agentDetection";+import { resolveDictationRouteKind } from "./dictationRouting";import { resolvePrompt } from "../config/prompts";import { syncService } from "../services/SyncService.js";import { matchesDictionaryPrompt } from "../utils/dictionaryEchoFilter.js";@@ -22,15 +23,19 @@ import { getDictionaryHintWords } from "../utils/snippets";const REASONING_CACHE_TTL = 30000; // 30 secondsconst REALTIME_MODELS = new Set(["gpt-4o-mini-transcribe", "gpt-4o-transcribe"]);-function resolveReasoningRoute(text, settings, agentName) {+function resolveReasoningRoute(text, settings, agentName, voiceAgentRequested) {const cleanupReachable =!!settings.useCleanupModel && (!!settings.cleanupModel?.trim() || isCloudCleanupMode());const agentModel = settings.dictationAgentModel?.trim() || "";const agentReachable = !!settings.useDictationAgent && agentModel.length > 0;- if (!cleanupReachable && !agentReachable) return { kind: "skip" };- const invoked = !!agentName && detectAgentName(text, agentName);- if (agentReachable && invoked) {+ const kind = resolveDictationRouteKind({+ cleanupReachable,+ agentReachable,+ agentInvoked: !!agentName && detectAgentName(text, agentName),+ voiceAgentRequested,+ });+ if (kind === "agent") {const provider = settings.dictationAgentProvider?.trim() || undefined;const isSelfHostedAgent =settings.dictationAgentMode === "self-hosted" && !!settings.dictationAgentRemoteUrl;@@ -56,7 +61,7 @@ function resolveReasoningRoute(text, settings, agentName) {},};}- if (cleanupReachable) {+ if (kind === "cleanup") {return {kind: "cleanup",config: { disableThinking: settings.cleanupDisableThinking },@@ -178,6 +183,7 @@ class AudioManager {this.streamingFallbackRecorder = null;this.streamingFallbackChunks = [];this.skipReasoning = false;+ this.voiceAgentRequested = false;this.context = "dictation";this.sttConfig = null;this.lastAudioBlob = null;@@ -256,6 +262,10 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);this.skipReasoning = skip;}+ setVoiceAgentRequested(requested) {+ this.voiceAgentRequested = requested;+ }+setContext(context) {this.context = context;}@@ -1154,7 +1164,12 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);if (useReasoning) {try {- const route = resolveReasoningRoute(normalizedText, getSettings(), agentName);+ const route = resolveReasoningRoute(+ normalizedText,+ getSettings(),+ agentName,+ this.voiceAgentRequested+ );if (route.kind === "skip") return normalizedText;const targetModel = route.kind === "agent" ? route.model : cleanupModel;@@ -1400,7 +1415,12 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);if (processedText && !this.skipReasoning) {const reasoningStart = performance.now();const agentName = localStorage.getItem("agentName") || null;- const route = resolveReasoningRoute(processedText, settings, agentName);+ const route = resolveReasoningRoute(+ processedText,+ settings,+ agentName,+ this.voiceAgentRequested+ );const cleanupCloudMode = settings.cleanupCloudMode || "openwhispr";if (route.kind === "agent") {diff --git a/src/helpers/dictationRouting.js b/src/helpers/dictationRouting.jsnew file mode 100644index 000000000..e1bd6db7c--- /dev/null+++ b/src/helpers/dictationRouting.js@@ -0,0 +1,20 @@+// Decides which reasoning path ("agent" | "cleanup" | "skip") a finished+// dictation takes. A recording started via the voice agent hotkey always takes+// the agent path — no wake word needed — and never falls back to cleanup.+export function resolveDictationRouteKind({+ cleanupReachable,+ agentReachable,+ agentInvoked,+ voiceAgentRequested,+}) {+ if (voiceAgentRequested) {+ return agentReachable ? "agent" : "skip";+ }+ if (agentReachable && agentInvoked) {+ return "agent";+ }+ if (cleanupReachable) {+ return "cleanup";+ }+ return "skip";+}diff --git a/src/helpers/environment.js b/src/helpers/environment.jsindex 172ddbc93..c0974ef5c 100644--- a/src/helpers/environment.js+++ b/src/helpers/environment.js@@ -41,6 +41,7 @@ const PERSISTED_KEYS = ["LLAMA_VULKAN_ENABLED","DICTATION_KEY","CHAT_AGENT_KEY",+ "VOICE_AGENT_KEY","MEETING_KEY","ACTIVATION_MODE","FLOATING_ICON_AUTO_HIDE",@@ -461,6 +462,16 @@ class EnvironmentManager {return result;}+ getVoiceAgentKey() {+ return this._getKey("VOICE_AGENT_KEY");+ }++ saveVoiceAgentKey(key) {+ const result = this._saveKey("VOICE_AGENT_KEY", key);+ this.saveAllKeysToEnvFile().catch(() => {});+ return result;+ }+getMeetingKey() {return this._getKey("MEETING_KEY");}diff --git a/src/helpers/gnomeShortcut.js b/src/helpers/gnomeShortcut.jsindex 0139f0d5f..59f49ff7e 100644--- a/src/helpers/gnomeShortcut.js+++ b/src/helpers/gnomeShortcut.js@@ -19,6 +19,10 @@ const SLOT_CONFIG = {path: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/openwhispr-meeting/",name: "OpenWhispr Meeting",},+ voiceAgent: {+ path: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/openwhispr-voice-agent/",+ name: "OpenWhispr Voice Agent",+ },};const KEYBINDING_SCHEMA = "org.gnome.settings-daemon.plugins.media-keys.custom-keybinding";@@ -84,6 +88,7 @@ class GnomeShortcutManager {this.dictationCallback = null;this.agentCallback = null;this.meetingCallback = null;+ this.voiceAgentCallback = null;// Track which slots have been registered in gsettingsthis.registeredSlots = new Set();}@@ -122,6 +127,14 @@ class GnomeShortcutManager {debugLogger.log("[GnomeShortcut] Meeting callback registered");}+ setVoiceAgentCallback(callback) {+ this.voiceAgentCallback = callback;+ if (this._ifaceRef) {+ this._ifaceRef._voiceAgentCallback = callback;+ }+ debugLogger.log("[GnomeShortcut] Voice agent callback registered");+ }+async initDBusService(dictationCallback) {this.dictationCallback = dictationCallback;@@ -135,7 +148,12 @@ class GnomeShortcutManager {await this.bus.requestName(DBUS_SERVICE_NAME, 0);const InterfaceClass = this._createInterfaceClass(dbusModule);- const iface = new InterfaceClass(dictationCallback, this.agentCallback, this.meetingCallback);+ const iface = new InterfaceClass(+ dictationCallback,+ this.agentCallback,+ this.meetingCallback,+ this.voiceAgentCallback+ );// Keep a reference so setAgentCallback() can update it laterthis._ifaceRef = iface;this.bus.export(DBUS_OBJECT_PATH, iface);@@ -154,11 +172,12 @@ class GnomeShortcutManager {_createInterfaceClass(dbusModule) {class OpenWhisprInterface extends dbusModule.interface.Interface {- constructor(dictationCallback, agentCallback, meetingCallback) {+ constructor(dictationCallback, agentCallback, meetingCallback, voiceAgentCallback) {super(DBUS_INTERFACE);this._dictationCallback = dictationCallback;this._agentCallback = agentCallback || null;this._meetingCallback = meetingCallback || null;+ this._voiceAgentCallback = voiceAgentCallback || null;}Toggle() {@@ -178,6 +197,12 @@ class GnomeShortcutManager {this._meetingCallback();}}++ ToggleVoiceAgent() {+ if (this._voiceAgentCallback) {+ this._voiceAgentCallback();+ }+ }}OpenWhisprInterface.configureMembers({@@ -185,6 +210,7 @@ class GnomeShortcutManager {Toggle: { inSignature: "", outSignature: "" },ToggleAgent: { inSignature: "", outSignature: "" },ToggleMeeting: { inSignature: "", outSignature: "" },+ ToggleVoiceAgent: { inSignature: "", outSignature: "" },},});@@ -217,6 +243,7 @@ class GnomeShortcutManager {dictation: "Toggle",agent: "ToggleAgent",meeting: "ToggleMeeting",+ voiceAgent: "ToggleVoiceAgent",};const dbusMethod = SLOT_DBUS_METHOD[slotName] || "Toggle";const command = `dbus-send --session --type=method_call --dest=${DBUS_SERVICE_NAME} ${DBUS_OBJECT_PATH} ${DBUS_INTERFACE}.${dbusMethod}`;diff --git a/src/helpers/hotkeyManager.js b/src/helpers/hotkeyManager.jsindex c7d9bda17..53a74f927 100644--- a/src/helpers/hotkeyManager.js+++ b/src/helpers/hotkeyManager.js@@ -17,7 +17,7 @@ const DEFAULT_HOTKEY = "Control+Super";// Slots routed through GNOME native gsettings (not globalShortcut).// Temporary slots like "cancel" stay on globalShortcut.-const GNOME_NATIVE_SLOTS = new Set(["agent", "meeting"]);+const GNOME_NATIVE_SLOTS = new Set(["agent", "meeting", "voiceAgent"]);// KDE registration failure reasons — reuse existing i18n keysconst KDE_FAILURE_REASONS = {@@ -187,6 +187,8 @@ class HotkeyManager extends EventEmitter {this.gnomeManager.setAgentCallback(callback);} else if (slotName === "meeting") {this.gnomeManager.setMeetingCallback(callback);+ } else if (slotName === "voiceAgent") {+ this.gnomeManager.setVoiceAgentCallback(callback);}const success = await this.gnomeManager.registerKeybinding(gnomeHotkey, slotName);diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex ecaedf00b..d4ae45848 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -7332,6 +7332,35 @@ class IPCHandlers {};});+ ipcMain.handle("update-voice-agent-hotkey", async (_event, hotkey) => {+ const hotkeyManager = this.windowManager.hotkeyManager;+ const voiceAgentCallback = this.windowManager._voiceAgentHotkeyCallback;+ if (!voiceAgentCallback) {+ return { success: false, message: "Voice agent hotkey callback not initialized" };+ }++ if (!hotkey) {+ hotkeyManager.unregisterSlot("voiceAgent");+ this.environmentManager.saveVoiceAgentKey?.("");+ return { success: true, message: "Voice agent hotkey cleared" };+ }++ const result = await hotkeyManager.registerSlot("voiceAgent", hotkey, voiceAgentCallback);+ if (result.success) {+ this.environmentManager.saveVoiceAgentKey?.(hotkey);+ return { success: true, message: `Voice agent hotkey updated to: ${hotkey}` };+ }++ return {+ success: false,+ message: result.error || `Failed to update voice agent hotkey to: ${hotkey}`,+ };+ });++ ipcMain.handle("get-voice-agent-key", async () => {+ return this.environmentManager.getVoiceAgentKey?.() || "";+ });+ipcMain.handle("get-agent-key", async () => {return this.environmentManager.getAgentKey?.() || "";});diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.jsindex deb25cc67..9aec9d1c9 100644--- a/src/helpers/windowManager.js+++ b/src/helpers/windowManager.js@@ -440,18 +440,26 @@ class WindowManager {this.handleWindowsPushKeyUp();}- sendToggleDictation() {+ _sendDictationToggle(channel) {if (this.hotkeyManager.isInListeningMode()) {return;}if (this.mainWindow && !this.mainWindow.isDestroyed()) {this.showDictationPanel();- this.mainWindow.webContents.send("toggle-dictation");+ this.mainWindow.webContents.send(channel);this._isDictatingToggle = !this._isDictatingToggle;this.meetingDetectionEngine?.setUserRecording(this._isDictatingToggle);}}+ sendToggleDictation() {+ this._sendDictationToggle("toggle-dictation");+ }++ sendToggleVoiceAgent() {+ this._sendDictationToggle("toggle-voice-agent");+ }+sendStartDictation() {if (this.hotkeyManager.isInListeningMode()) {return;diff --git a/src/hooks/useAudioRecording.js b/src/hooks/useAudioRecording.jsindex c253c692f..93e5a3962 100644--- a/src/hooks/useAudioRecording.js+++ b/src/hooks/useAudioRecording.js@@ -20,7 +20,7 @@ export const useAudioRecording = (toast, options = {}) => {const stopLockRef = useRef(false);const { onToggle } = options;- const performStartRecording = useCallback(async () => {+ const performStartRecording = useCallback(async ({ voiceAgentRequested = false } = {}) => {if (startLockRef.current) return false;startLockRef.current = true;try {@@ -29,6 +29,8 @@ export const useAudioRecording = (toast, options = {}) => {const currentState = audioManagerRef.current.getState();if (currentState.isRecording || currentState.isProcessing) return false;+ audioManagerRef.current.setVoiceAgentRequested(voiceAgentRequested);+// Retry STT config fetch if it wasn't loaded on mount (e.g. auth wasn't ready)if (!audioManagerRef.current.sttConfig) {const config = await window.electronAPI.getSttConfig?.();@@ -202,12 +204,12 @@ export const useAudioRecording = (toast, options = {}) => {}});- const handleToggle = async () => {+ const handleToggle = async ({ voiceAgentRequested = false } = {}) => {if (!audioManagerRef.current) return;const currentState = audioManagerRef.current.getState();if (!currentState.isRecording && !currentState.isProcessing) {- await performStartRecording();+ await performStartRecording({ voiceAgentRequested });} else if (currentState.isRecording) {await performStopRecording();}@@ -226,6 +228,11 @@ export const useAudioRecording = (toast, options = {}) => {onToggle?.();});+ const disposeVoiceAgentToggle = window.electronAPI.onToggleVoiceAgent?.(() => {+ handleToggle({ voiceAgentRequested: true });+ onToggle?.();+ });+const disposeStart = window.electronAPI.onStartDictation?.(() => {handleStart();onToggle?.();@@ -252,6 +259,7 @@ export const useAudioRecording = (toast, options = {}) => {// Cleanupreturn () => {disposeToggle?.();+ disposeVoiceAgentToggle?.();disposeStart?.();disposeStop?.();disposeNoAudio?.();diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.tsindex 5f029de3d..375fc071b 100644--- a/src/hooks/useSettings.ts+++ b/src/hooks/useSettings.ts@@ -43,6 +43,7 @@ export interface CleanupSettings {export interface HotkeySettings {dictationKey: string;meetingKey: string;+ voiceAgentKey: string;meetingHotkeyLayoutMode: "side-panel" | "full-width";activationMode: "tap" | "push";}@@ -225,6 +226,7 @@ function useSettingsInternal() {mistralApiKey: store.mistralApiKey,dictationKey: store.dictationKey,meetingKey: store.meetingKey,+ voiceAgentKey: store.voiceAgentKey,meetingHotkeyLayoutMode: store.meetingHotkeyLayoutMode,setMeetingHotkeyLayoutMode: store.setMeetingHotkeyLayoutMode,theme: store.theme,@@ -264,6 +266,7 @@ function useSettingsInternal() {setCleanupCustomApiKey: store.setCleanupCustomApiKey,setDictationKey: store.setDictationKey,setMeetingKey: store.setMeetingKey,+ setVoiceAgentKey: store.setVoiceAgentKey,setTheme: store.setTheme,activationMode: store.activationMode,setActivationMode: store.setActivationMode,diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex 5bed39049..dee3dab80 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -172,7 +172,8 @@"welcome": "Willkommen","setup": "Einrichtung","permissions": "Berechtigungen",- "activation": "Aktivierung"+ "activation": "Aktivierung",+ "voiceAgent": "Sprachagent"},"hotkey": {"couldNotRegisterTitle": "Dieser Hotkey konnte nicht registriert werden",@@ -218,6 +219,13 @@"holdHotkey": "{{hotkey}} gedrückt halten","textareaPlaceholder": "Hier klicken und Hotkey zum Diktieren verwenden..."},+ "voiceAgent": {+ "title": "Sprachagent-Hotkey",+ "description": "Sprechen Sie mit Ihrem KI-Agenten per Tastendruck",+ "hotkey": "Hotkey",+ "howItWorks": "Drücken Sie die Taste und sagen Sie, was Sie möchten — zum Beispiel „schreibe eine kurze Dankesnachricht“. {{agentName}} schreibt das Ergebnis direkt an Ihren Cursor. Sie müssen nicht zuerst „Hey {{agentName}}“ sagen.",+ "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.",@@ -809,7 +817,8 @@"pressAnyKeyMac": "Beliebige Taste drücken oder ⌘⇧K","recording": "Aufnahme","tryShortcut": "Versuchen Sie Ctrl+Shift+K",- "tryShortcutMac": "Versuchen Sie ⌘⇧K"+ "tryShortcutMac": "Versuchen Sie ⌘⇧K",+ "remove": "Hotkey entfernen"},"languageSelector": {"noLanguagesFound": "Keine Sprachen gefunden",@@ -1294,11 +1303,14 @@"meetingHotkey": {"title": "Meeting-Modus-Hotkey","description": "Meeting-Modus starten und das Panel an den Bildschirmrand verschieben",- "clear": "Hotkey entfernen","layoutLabel": "Beim Auslösen per Hotkey öffnen in:","layoutFullWidth": "Volle Breite","layoutSidePanel": "Seitenleiste"},+ "voiceAgentHotkey": {+ "title": "Sprachagent-Hotkey",+ "description": "Sagen Sie, was Sie brauchen — Ihr KI-Agent schreibt das Ergebnis, nicht Ihre Worte"+ },"microphone": {"description": "Wählen Sie das Eingabegerät für das Diktat","title": "Mikrofon"@@ -2353,9 +2365,8 @@},"agentMode": {"settings": {- "hotkey": "Agent-Tastenkombination",- "hotkeyDescription": "Tastenkombination zum Umschalten des Agent-Overlays",- "clearHotkey": "Hotkey entfernen",+ "hotkey": "Chat-Agent-Hotkey",+ "hotkeyDescription": "Öffnet und schließt das Chat-Agent-Overlay","model": "Agent-Modell","modelDescription": "KI-Modell für Agent-Unterhaltungen","systemPrompt": "System-Prompt",diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex e6439d3fc..ee2cd0fa7 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -172,7 +172,8 @@"welcome": "Welcome","setup": "Setup","permissions": "Permissions",- "activation": "Activation"+ "activation": "Activation",+ "voiceAgent": "Voice Agent"},"hotkey": {"couldNotRegisterTitle": "Couldn't register that hotkey",@@ -218,6 +219,13 @@"holdHotkey": "Hold {{hotkey}}","textareaPlaceholder": "Click here and use your hotkey to dictate..."},+ "voiceAgent": {+ "title": "Voice Agent Hotkey",+ "description": "Talk to your AI agent with a single keypress",+ "hotkey": "Hotkey",+ "howItWorks": "Press the key and say what you want — for example “write a short thank-you note”. {{agentName}} types the result wherever your cursor is. No need to say “Hey {{agentName}}” first.",+ "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.",@@ -905,7 +913,8 @@"pressAnyKeyMac": "Press any key or ⌘⇧K","recording": "Recording","tryShortcut": "Try Ctrl+Shift+K",- "tryShortcutMac": "Try ⌘⇧K"+ "tryShortcutMac": "Try ⌘⇧K",+ "remove": "Remove hotkey"},"languageSelector": {"noLanguagesFound": "No languages found",@@ -1475,11 +1484,14 @@"meetingHotkey": {"title": "Meeting Mode Hotkey","description": "Start meeting mode and snap the panel to the side of the screen",- "clear": "Remove hotkey","layoutLabel": "When triggered by hotkey, open in:","layoutFullWidth": "Full width","layoutSidePanel": "Side panel"},+ "voiceAgentHotkey": {+ "title": "Voice Agent Hotkey",+ "description": "Speak a request — your AI agent types the result, not your words"+ },"microphone": {"description": "Select which input device to use for dictation","title": "Microphone"@@ -2497,9 +2509,8 @@},"agentMode": {"settings": {- "hotkey": "Agent Hotkey",- "hotkeyDescription": "Hotkey to toggle the agent overlay",- "clearHotkey": "Remove hotkey",+ "hotkey": "Chat Agent Hotkey",+ "hotkeyDescription": "Open and close the chat agent overlay","model": "Agent Model","modelDescription": "AI model used for agent conversations","systemPrompt": "System Prompt",diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex 8873ed648..654711481 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -172,7 +172,8 @@"welcome": "Bienvenido","setup": "Configuración","permissions": "Permisos",- "activation": "Activación"+ "activation": "Activación",+ "voiceAgent": "Agente de voz"},"hotkey": {"couldNotRegisterTitle": "No se pudo registrar ese atajo",@@ -218,6 +219,13 @@"holdHotkey": "Mantener {{hotkey}}","textareaPlaceholder": "Haz clic aquí y usa tu atajo para dictar..."},+ "voiceAgent": {+ "title": "Atajo del agente de voz",+ "description": "Habla con tu agente 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». {{agentName}} escribe el resultado donde esté el cursor. No hace falta decir «Hey {{agentName}}» antes.",+ "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.",@@ -857,7 +865,8 @@"pressAnyKeyMac": "Pulsa cualquier tecla o ⌘⇧K","recording": "Grabando","tryShortcut": "Prueba Ctrl+Shift+K",- "tryShortcutMac": "Prueba ⌘⇧K"+ "tryShortcutMac": "Prueba ⌘⇧K",+ "remove": "Eliminar atajo"},"languageSelector": {"noLanguagesFound": "No se encontraron idiomas",@@ -1342,11 +1351,14 @@"meetingHotkey": {"title": "Atajo modo reunión","description": "Iniciar modo reunión y ajustar el panel al lado de la pantalla",- "clear": "Eliminar atajo","layoutLabel": "Al activarse con el atajo, abrir en:","layoutFullWidth": "Ancho completo","layoutSidePanel": "Panel lateral"},+ "voiceAgentHotkey": {+ "title": "Atajo del agente de voz",+ "description": "Di lo que necesitas y tu agente de IA escribe el resultado, no tus palabras"+ },"microphone": {"description": "Selecciona qué dispositivo de entrada usar para dictado","title": "Micrófono"@@ -2401,9 +2413,8 @@},"agentMode": {"settings": {- "hotkey": "Tecla del Agente",- "hotkeyDescription": "Tecla de acceso rápido para alternar la superposición del agente",- "clearHotkey": "Eliminar atajo",+ "hotkey": "Atajo del agente de chat",+ "hotkeyDescription": "Abre y cierra la superposición del agente de chat","model": "Modelo del Agente","modelDescription": "Modelo de IA utilizado para conversaciones del agente","systemPrompt": "Prompt del Sistema",diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex 2da5613f2..3660d3d47 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -172,7 +172,8 @@"welcome": "Bienvenue","setup": "Configuration","permissions": "Permissions",- "activation": "Activation"+ "activation": "Activation",+ "voiceAgent": "Agent vocal"},"hotkey": {"couldNotRegisterTitle": "Impossible d'enregistrer ce raccourci",@@ -218,6 +219,13 @@"holdHotkey": "Maintenir {{hotkey}}","textareaPlaceholder": "Cliquez ici puis utilisez votre raccourci pour dicter..."},+ "voiceAgent": {+ "title": "Raccourci de l'agent vocal",+ "description": "Parlez à votre agent 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 ». {{agentName}} écrit le résultat là où se trouve votre curseur. Pas besoin de dire « Hey {{agentName}} » d'abord.",+ "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.",@@ -857,7 +865,8 @@"pressAnyKeyMac": "Appuyez sur une touche ou ⌘⇧K","recording": "Enregistrement","tryShortcut": "Essayez Ctrl+Shift+K",- "tryShortcutMac": "Essayez ⌘⇧K"+ "tryShortcutMac": "Essayez ⌘⇧K",+ "remove": "Supprimer le raccourci"},"languageSelector": {"noLanguagesFound": "Aucune langue trouvée",@@ -1342,11 +1351,14 @@"meetingHotkey": {"title": "Raccourci mode réunion","description": "Démarrer le mode réunion et ancrer le panneau sur le côté de l'écran",- "clear": "Supprimer le raccourci","layoutLabel": "Lors du déclenchement par raccourci, ouvrir en :","layoutFullWidth": "Pleine largeur","layoutSidePanel": "Panneau latéral"},+ "voiceAgentHotkey": {+ "title": "Raccourci de l'agent vocal",+ "description": "Dites ce que vous voulez — votre agent IA écrit le résultat, pas vos mots"+ },"microphone": {"description": "Sélectionnez le périphérique d'entrée à utiliser pour la dictée","title": "Microphone"@@ -2401,9 +2413,8 @@},"agentMode": {"settings": {- "hotkey": "Raccourci Agent",- "hotkeyDescription": "Raccourci clavier pour basculer la fenêtre agent",- "clearHotkey": "Supprimer le raccourci",+ "hotkey": "Raccourci de l'agent de chat",+ "hotkeyDescription": "Affiche ou masque la fenêtre de l'agent de chat","model": "Modèle Agent","modelDescription": "Modèle IA utilisé pour les conversations agent","systemPrompt": "Prompt système",diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex d0a45c317..98a3f6511 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -172,7 +172,8 @@"welcome": "Benvenuto","setup": "Configurazione","permissions": "Permessi",- "activation": "Attivazione"+ "activation": "Attivazione",+ "voiceAgent": "Agente vocale"},"hotkey": {"couldNotRegisterTitle": "Impossibile registrare questa scorciatoia",@@ -218,6 +219,13 @@"holdHotkey": "Tieni premuto {{hotkey}}","textareaPlaceholder": "Clicca qui e usa la scorciatoia per dettare..."},+ "voiceAgent": {+ "title": "Scorciatoia dell'agente vocale",+ "description": "Parla con il tuo agente IA con un solo tasto",+ "hotkey": "Scorciatoia",+ "howItWorks": "Premi il tasto e di' cosa vuoi — ad esempio “scrivi un breve messaggio di ringraziamento”. {{agentName}} scrive il risultato dove si trova il cursore. Non serve dire prima “Hey {{agentName}}”.",+ "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.",@@ -809,7 +817,8 @@"pressAnyKeyMac": "Premi un tasto qualsiasi o ⌘⇧K","recording": "Registrazione","tryShortcut": "Prova Ctrl+Shift+K",- "tryShortcutMac": "Prova ⌘⇧K"+ "tryShortcutMac": "Prova ⌘⇧K",+ "remove": "Rimuovi scorciatoia"},"languageSelector": {"noLanguagesFound": "Nessuna lingua trovata",@@ -1294,11 +1303,14 @@"meetingHotkey": {"title": "Scorciatoia modalità meeting","description": "Avvia la modalità meeting e posiziona il pannello a lato dello schermo",- "clear": "Rimuovi scorciatoia","layoutLabel": "Quando attivata da scorciatoia, apri in:","layoutFullWidth": "Larghezza completa","layoutSidePanel": "Pannello laterale"},+ "voiceAgentHotkey": {+ "title": "Scorciatoia dell'agente vocale",+ "description": "Di' cosa ti serve — il tuo agente IA scrive il risultato, non le tue parole"+ },"microphone": {"description": "Seleziona il dispositivo di ingresso da usare per la dettatura","title": "Microfono"@@ -2353,9 +2365,8 @@},"agentMode": {"settings": {- "hotkey": "Tasto Agente",- "hotkeyDescription": "Tasto di scelta rapida per alternare l'overlay agente",- "clearHotkey": "Rimuovi scorciatoia",+ "hotkey": "Scorciatoia dell'agente chat",+ "hotkeyDescription": "Apre e chiude l'overlay dell'agente chat","model": "Modello Agente","modelDescription": "Modello IA utilizzato per le conversazioni agente","systemPrompt": "Prompt di Sistema",diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex bcb312874..1f9f9cb72 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -172,7 +172,8 @@"welcome": "ようこそ","setup": "セットアップ","permissions": "権限",- "activation": "アクティベーション"+ "activation": "アクティベーション",+ "voiceAgent": "ボイスエージェント"},"hotkey": {"couldNotRegisterTitle": "ホットキーを登録できませんでした",@@ -218,6 +219,13 @@"holdHotkey": "{{hotkey}} を押し続ける","textareaPlaceholder": "ここをクリックしてホットキーでディクテーション..."},+ "voiceAgent": {+ "title": "ボイスエージェントホットキー",+ "description": "ワンキーでAIエージェントに話しかけられます",+ "hotkey": "ホットキー",+ "howItWorks": "キーを押して、してほしいことを話すだけ。例えば「お礼のメッセージを書いて」と言えば、{{agentName}}がカーソル位置に結果を入力します。「Hey {{agentName}}」と言う必要はありません。",+ "optionalNote": "任意です。設定からいつでも追加・変更できます。"+ },"connectivity": {"title": "このネットワークから OpenWhispr Cloud に接続できません","body": "{{cause}} ローカルエンジンに切り替えるか、続行して後でもう一度お試しください。",@@ -809,7 +817,8 @@"pressAnyKeyMac": "任意のキーまたは ⌘⇧K を押してください","recording": "記録中","tryShortcut": "Ctrl+Shift+K をお試しください",- "tryShortcutMac": "⌘⇧K をお試しください"+ "tryShortcutMac": "⌘⇧K をお試しください",+ "remove": "ホットキーを削除"},"languageSelector": {"noLanguagesFound": "言語が見つかりません",@@ -1294,11 +1303,14 @@"meetingHotkey": {"title": "ミーティングモードホットキー","description": "ミーティングモードを開始し、パネルを画面の横に配置する",- "clear": "ホットキーを削除","layoutLabel": "ホットキーで起動したときに開く:","layoutFullWidth": "全幅","layoutSidePanel": "サイドパネル"},+ "voiceAgentHotkey": {+ "title": "ボイスエージェントホットキー",+ "description": "話しかけるだけで、AIエージェントが言葉そのままではなく結果を入力します"+ },"microphone": {"description": "ディクテーションに使用する入力デバイスを選択","title": "マイク"@@ -2353,9 +2365,8 @@},"agentMode": {"settings": {- "hotkey": "エージェントホットキー",- "hotkeyDescription": "エージェントオーバーレイを切り替えるホットキー",- "clearHotkey": "ホットキーを削除",+ "hotkey": "チャットエージェントホットキー",+ "hotkeyDescription": "チャットエージェントのオーバーレイを開閉します","model": "エージェントモデル","modelDescription": "エージェント会話に使用するAIモデル","systemPrompt": "システムプロンプト",diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex 1ffe31540..20c240f58 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -144,7 +144,8 @@"welcome": "Boas-vindas","setup": "Configuração","permissions": "Permissões",- "activation": "Ativação"+ "activation": "Ativação",+ "voiceAgent": "Agente de voz"},"hotkey": {"couldNotRegisterTitle": "Não foi possível registrar esse atalho",@@ -190,6 +191,13 @@"holdHotkey": "Segure {{hotkey}}","textareaPlaceholder": "Clique aqui e use seu atalho para ditar..."},+ "voiceAgent": {+ "title": "Atalho do agente de voz",+ "description": "Fale com seu agente 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”. {{agentName}} escreve o resultado onde estiver o cursor. Não precisa dizer “Hey {{agentName}}” antes.",+ "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.",@@ -781,7 +789,8 @@"pressAnyKeyMac": "Pressione qualquer tecla ou ⌘⇧K","recording": "Gravando","tryShortcut": "Tente Ctrl+Shift+K",- "tryShortcutMac": "Tente ⌘⇧K"+ "tryShortcutMac": "Tente ⌘⇧K",+ "remove": "Remover atalho"},"languageSelector": {"noLanguagesFound": "Nenhum idioma encontrado",@@ -1266,11 +1275,14 @@"meetingHotkey": {"title": "Atalho modo reunião","description": "Iniciar modo reunião e posicionar o painel ao lado da tela",- "clear": "Remover atalho","layoutLabel": "Ao acionar pelo atalho, abrir em:","layoutFullWidth": "Largura total","layoutSidePanel": "Painel lateral"},+ "voiceAgentHotkey": {+ "title": "Atalho do agente de voz",+ "description": "Diga o que você precisa — seu agente de IA escreve o resultado, não suas palavras"+ },"microphone": {"description": "Selecione qual dispositivo de entrada usar para ditado","title": "Microfone"@@ -2353,9 +2365,8 @@},"agentMode": {"settings": {- "hotkey": "Tecla do Agente",- "hotkeyDescription": "Tecla de atalho para alternar a sobreposição do agente",- "clearHotkey": "Remover atalho",+ "hotkey": "Atalho do agente de chat",+ "hotkeyDescription": "Abre e fecha a sobreposição do agente de chat","model": "Modelo do Agente","modelDescription": "Modelo de IA usado para conversas do agente","systemPrompt": "Prompt do Sistema",diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex 03812affa..2255892ff 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -172,7 +172,8 @@"welcome": "Приветствие","setup": "Настройка","permissions": "Разрешения",- "activation": "Активация"+ "activation": "Активация",+ "voiceAgent": "Голосовой агент"},"hotkey": {"couldNotRegisterTitle": "Не удалось зарегистрировать горячую клавишу",@@ -218,6 +219,13 @@"holdHotkey": "Удерживайте {{hotkey}}","textareaPlaceholder": "Нажмите сюда и используйте горячую клавишу для диктовки..."},+ "voiceAgent": {+ "title": "Горячая клавиша голосового агента",+ "description": "Обращайтесь к ИИ-агенту одним нажатием",+ "hotkey": "Горячая клавиша",+ "howItWorks": "Нажмите клавишу и скажите, что вам нужно — например, «напиши короткую благодарственную записку». {{agentName}} напечатает результат там, где находится курсор. Говорить «Hey {{agentName}}» не нужно.",+ "optionalNote": "Необязательно — вы можете настроить или изменить её в любое время в настройках."+ },"connectivity": {"title": "Не удаётся подключиться к OpenWhispr Cloud из этой сети","body": "{{cause}} Вы можете переключиться на локальный движок или продолжить и повторить попытку позже.",@@ -809,7 +817,8 @@"pressAnyKeyMac": "Нажмите любую клавишу или ⌘⇧K","recording": "Запись","tryShortcut": "Попробуйте Ctrl+Shift+K",- "tryShortcutMac": "Попробуйте ⌘⇧K"+ "tryShortcutMac": "Попробуйте ⌘⇧K",+ "remove": "Удалить горячую клавишу"},"languageSelector": {"noLanguagesFound": "Языки не найдены",@@ -1294,11 +1303,14 @@"meetingHotkey": {"title": "Горячая клавиша режима встречи","description": "Запустить режим встречи и закрепить панель сбоку экрана",- "clear": "Удалить горячую клавишу","layoutLabel": "При запуске горячей клавишей открывать в:","layoutFullWidth": "Полная ширина","layoutSidePanel": "Боковая панель"},+ "voiceAgentHotkey": {+ "title": "Горячая клавиша голосового агента",+ "description": "Скажите, что нужно — ИИ-агент напечатает результат, а не ваши слова"+ },"microphone": {"description": "Выберите устройство ввода для диктовки","title": "Микрофон"@@ -2357,9 +2369,8 @@},"agentMode": {"settings": {- "hotkey": "Горячая клавиша агента",- "hotkeyDescription": "Горячая клавиша для переключения наложения агента",- "clearHotkey": "Удалить горячую клавишу",+ "hotkey": "Горячая клавиша чат-агента",+ "hotkeyDescription": "Открывает и закрывает окно чат-агента","model": "Модель агента","modelDescription": "Модель ИИ для разговоров с агентом","systemPrompt": "Системный промпт",diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex f21e6abbc..2863ff5cf 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -172,7 +172,8 @@"welcome": "欢迎","setup": "设置","permissions": "权限",- "activation": "激活"+ "activation": "激活",+ "voiceAgent": "语音助手"},"hotkey": {"couldNotRegisterTitle": "无法注册该快捷键",@@ -218,6 +219,13 @@"holdHotkey": "按住 {{hotkey}}","textareaPlaceholder": "点击此处,然后使用快捷键进行听写..."},+ "voiceAgent": {+ "title": "语音助手快捷键",+ "description": "一键唤起你的 AI 助手",+ "hotkey": "快捷键",+ "howItWorks": "按下快捷键,说出你想要的内容,例如“写一段简短的感谢语”。{{agentName}} 会把结果输入到光标所在的位置。无需先说“Hey {{agentName}}”。",+ "optionalNote": "可选——你可以随时在设置中添加或修改。"+ },"connectivity": {"title": "无法从该网络连接到 OpenWhispr Cloud","body": "{{cause}} 你可以切换到本地引擎,或继续并稍后重试。",@@ -809,7 +817,8 @@"pressAnyKeyMac": "按任意键或 ⌘⇧K","recording": "录制中","tryShortcut": "试试 Ctrl+Shift+K",- "tryShortcutMac": "试试 ⌘⇧K"+ "tryShortcutMac": "试试 ⌘⇧K",+ "remove": "移除快捷键"},"languageSelector": {"noLanguagesFound": "未找到匹配的语言",@@ -1289,11 +1298,14 @@"meetingHotkey": {"title": "会议模式快捷键","description": "启动会议模式并将面板固定到屏幕侧边",- "clear": "移除快捷键","layoutLabel": "通过快捷键触发时,打开方式:","layoutFullWidth": "全宽","layoutSidePanel": "侧边栏"},+ "voiceAgentHotkey": {+ "title": "语音助手快捷键",+ "description": "说出你的需求,AI 助手会输入结果,而不是你说的原话"+ },"microphone": {"description": "选择用于听写的输入设备","title": "麦克风"@@ -2348,9 +2360,8 @@},"agentMode": {"settings": {- "hotkey": "助手热键",- "hotkeyDescription": "切换助手覆盖层的热键",- "clearHotkey": "移除快捷键",+ "hotkey": "聊天助手快捷键",+ "hotkeyDescription": "打开或关闭聊天助手窗口","model": "助手模型","modelDescription": "用于助手对话的AI模型","systemPrompt": "系统提示词",diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex 35c590854..f495b9617 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -172,7 +172,8 @@"welcome": "歡迎","setup": "設定","permissions": "權限",- "activation": "啟用"+ "activation": "啟用",+ "voiceAgent": "語音助手"},"hotkey": {"couldNotRegisterTitle": "無法註冊該快捷鍵",@@ -218,6 +219,13 @@"holdHotkey": "按住 {{hotkey}}","textareaPlaceholder": "點擊這裡,然後使用快捷鍵開始語音輸入..."},+ "voiceAgent": {+ "title": "語音助手快捷鍵",+ "description": "一鍵喚起你的 AI 助手",+ "hotkey": "快捷鍵",+ "howItWorks": "按下快捷鍵,說出你想要的內容,例如「寫一段簡短的感謝語」。{{agentName}} 會把結果輸入到游標所在的位置。無需先說「Hey {{agentName}}」。",+ "optionalNote": "選用——你可以隨時在設定中新增或修改。"+ },"connectivity": {"title": "無法從此網路連線到 OpenWhispr Cloud","body": "{{cause}} 你可以切換到本機引擎,或繼續並稍後再試。",@@ -809,7 +817,8 @@"pressAnyKeyMac": "按下任意按鍵或 ⌘⇧K","recording": "記錄中","tryShortcut": "試試 Ctrl+Shift+K",- "tryShortcutMac": "試試 ⌘⇧K"+ "tryShortcutMac": "試試 ⌘⇧K",+ "remove": "移除快捷鍵"},"languageSelector": {"noLanguagesFound": "找不到語言",@@ -1289,11 +1298,14 @@"meetingHotkey": {"title": "會議模式快捷鍵","description": "啟動會議模式並將面板固定到螢幕側邊",- "clear": "移除快捷鍵","layoutLabel": "透過快捷鍵觸發時,開啟方式:","layoutFullWidth": "全寬","layoutSidePanel": "側邊欄"},+ "voiceAgentHotkey": {+ "title": "語音助手快捷鍵",+ "description": "說出你的需求,AI 助手會輸入結果,而不是你說的原話"+ },"microphone": {"description": "選擇用於語音輸入的輸入裝置","title": "麥克風"@@ -2348,9 +2360,8 @@},"agentMode": {"settings": {- "hotkey": "助手熱鍵",- "hotkeyDescription": "切換助手覆蓋層的熱鍵",- "clearHotkey": "移除快捷鍵",+ "hotkey": "聊天助手快捷鍵",+ "hotkeyDescription": "開啟或關閉聊天助手視窗","model": "助手模型","modelDescription": "用於助手對話的AI模型","systemPrompt": "系統提示詞",diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.tsindex 67b182b18..770b81814 100644--- a/src/stores/settingsStore.ts+++ b/src/stores/settingsStore.ts@@ -539,6 +539,7 @@ export interface SettingsStatesetDictationKey: (key: string) => void;setMeetingKey: (key: string) => void;+ setVoiceAgentKey: (key: string) => void;setMeetingHotkeyLayoutMode: (mode: "side-panel" | "full-width") => void;setActivationMode: (mode: "tap" | "push") => void;@@ -609,6 +610,58 @@ function createBooleanSetter(key: string) {};}+// Setter for hotkeys that must be registered with the main process before+// being persisted. Rolls back to the previous key if registration fails.+function createRegisteredHotkeySetter(+ key: "chatAgentKey" | "voiceAgentKey",+ label: string,+ getRegisterFn: () =>+ | ((hotkey: string) => Promise<{ success: boolean; message: string }>)+ | undefined,+ fallbackSave?: (hotkey: string) => void+) {+ return (hotkey: string) => {+ if (!isBrowser) {+ useSettingsStore.setState({ [key]: hotkey });+ return;+ }++ const registerFn = getRegisterFn();+ if (!registerFn) {+ localStorage.setItem(key, hotkey);+ useSettingsStore.setState({ [key]: hotkey });+ fallbackSave?.(hotkey);+ return;+ }++ const previousKey = useSettingsStore.getState()[key];++ void registerFn(hotkey)+ .then((result) => {+ if (!result?.success) {+ localStorage.setItem(key, previousKey);+ useSettingsStore.setState({ [key]: previousKey });+ logger.warn(+ `Failed to update ${label}`,+ { hotkey, message: result?.message },+ "settings"+ );+ return;+ }++ localStorage.setItem(key, hotkey);+ useSettingsStore.setState({ [key]: hotkey });+ })+ .catch((error) => {+ logger.warn(+ `Failed to update ${label}`,+ { hotkey, error: error instanceof Error ? error.message : String(error) },+ "settings"+ );+ });+ };+}+let envPersistTimer: ReturnType<typeof setTimeout> | null = null;function debouncedPersistToEnv() {if (!isBrowser) return;@@ -774,6 +827,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({dictationKey: readString("dictationKey", ""),meetingKey: readString("meetingKey", ""),+ voiceAgentKey: readString("voiceAgentKey", ""),meetingHotkeyLayoutMode: (readString("meetingHotkeyLayoutMode", "full-width") === "side-panel"? "side-panel": "full-width") as "side-panel" | "full-width",@@ -1225,6 +1279,11 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({if (isBrowser) localStorage.setItem("meetingKey", key);set({ meetingKey: key });},+ setVoiceAgentKey: createRegisteredHotkeySetter(+ "voiceAgentKey",+ "voice agent hotkey",+ () => window.electronAPI?.updateVoiceAgentHotkey+ ),setMeetingHotkeyLayoutMode: (mode: "side-panel" | "full-width") => {if (isBrowser) localStorage.setItem("meetingHotkeyLayoutMode", mode);@@ -1402,46 +1461,12 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({setChatAgentModel: createStringSetter("chatAgentModel"),setChatAgentProvider: createStringSetter("chatAgentProvider"),- setChatAgentKey: (key: string) => {- if (!isBrowser) {- useSettingsStore.setState({ chatAgentKey: key });- return;- }-- const updateAgentHotkey = window.electronAPI?.updateAgentHotkey;- if (!updateAgentHotkey) {- localStorage.setItem("chatAgentKey", key);- useSettingsStore.setState({ chatAgentKey: key });- window.electronAPI?.saveAgentKey?.(key);- return;- }-- const previousKey = get().chatAgentKey;-- void updateAgentHotkey(key)- .then((result) => {- if (!result?.success) {- localStorage.setItem("chatAgentKey", previousKey);- useSettingsStore.setState({ chatAgentKey: previousKey });- logger.warn(- "Failed to update chat agent hotkey",- { hotkey: key, message: result?.message },- "settings"- );- return;- }-- localStorage.setItem("chatAgentKey", key);- useSettingsStore.setState({ chatAgentKey: key });- })- .catch((error) => {- logger.warn(- "Failed to update chat agent hotkey",- { hotkey: key, error: error instanceof Error ? error.message : String(error) },- "settings"- );- });- },+ setChatAgentKey: createRegisteredHotkeySetter(+ "chatAgentKey",+ "chat agent hotkey",+ () => window.electronAPI?.updateAgentHotkey,+ (key) => window.electronAPI?.saveAgentKey?.(key)+ ),setChatAgentCloudMode: createStringSetter("chatAgentCloudMode"),setChatAgentMode: createStringSetter("chatAgentMode") as (mode: InferenceMode) => void,setChatAgentCloudBaseUrl: createStringSetter("chatAgentCloudBaseUrl"),@@ -1812,6 +1837,20 @@ export async function initializeSettings(): Promise<void> {);}+ // Sync voice agent hotkey from main process+ try {+ const envKey = await window.electronAPI.getVoiceAgentKey?.();+ if (envKey && envKey !== state.voiceAgentKey) {+ createStringSetter("voiceAgentKey")(envKey);+ }+ } catch (err) {+ logger.warn(+ "Failed to sync voice agent hotkey on startup",+ { error: (err as Error).message },+ "settings"+ );+ }+try {let envMode = await window.electronAPI.getActivationMode?.();if (envMode && envMode !== state.activationMode) {diff --git a/src/types/electron.ts b/src/types/electron.tsindex 79a7cb6e5..ebea0768c 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -473,6 +473,7 @@ declare global {hideWindow: () => Promise<void>;showDictationPanel: () => Promise<void>;onToggleDictation: (callback: () => void) => () => void;+ onToggleVoiceAgent?: (callback: () => void) => () => void;onStartDictation?: (callback: () => void) => () => void;onStopDictation?: (callback: () => void) => () => void;@@ -1335,6 +1336,8 @@ declare global {// Agent ModeupdateAgentHotkey?: (hotkey: string) => Promise<{ success: boolean; message: string }>;+ updateVoiceAgentHotkey?: (hotkey: string) => Promise<{ success: boolean; message: string }>;+ getVoiceAgentKey?: () => Promise<string>;getAgentKey?: () => Promise<string>;saveAgentKey?: (key: string) => Promise<void>;createAgentConversation?: (diff --git a/test/helpers/dictationRouting.test.js b/test/helpers/dictationRouting.test.jsnew file mode 100644index 000000000..30a6d72bb--- /dev/null+++ b/test/helpers/dictationRouting.test.js@@ -0,0 +1,104 @@+const test = require("node:test");+const assert = require("node:assert/strict");++const load = () => import("../../src/helpers/dictationRouting.js");++test("voice agent hotkey routes to the agent without a wake word", async () => {+ const { resolveDictationRouteKind } = await load();++ assert.equal(+ resolveDictationRouteKind({+ cleanupReachable: true,+ agentReachable: true,+ agentInvoked: false,+ voiceAgentRequested: true,+ }),+ "agent"+ );+});++test("voice agent hotkey never triggers cleanup", async () => {+ const { resolveDictationRouteKind } = await load();++ // Even with cleanup enabled and reachable, a voice agent recording with an+ // unreachable agent returns the raw transcript instead of falling back.+ assert.equal(+ resolveDictationRouteKind({+ cleanupReachable: true,+ agentReachable: false,+ agentInvoked: false,+ voiceAgentRequested: true,+ }),+ "skip"+ );+});++test("voice agent hotkey ignores the wake word state", async () => {+ const { resolveDictationRouteKind } = await load();++ assert.equal(+ resolveDictationRouteKind({+ cleanupReachable: false,+ agentReachable: true,+ agentInvoked: true,+ voiceAgentRequested: true,+ }),+ "agent"+ );+});++test("normal dictation with wake word routes to the agent", async () => {+ const { resolveDictationRouteKind } = await load();++ assert.equal(+ resolveDictationRouteKind({+ cleanupReachable: true,+ agentReachable: true,+ agentInvoked: true,+ voiceAgentRequested: false,+ }),+ "agent"+ );+});++test("normal dictation without wake word routes to cleanup", async () => {+ const { resolveDictationRouteKind } = await load();++ assert.equal(+ resolveDictationRouteKind({+ cleanupReachable: true,+ agentReachable: true,+ agentInvoked: false,+ voiceAgentRequested: false,+ }),+ "cleanup"+ );+});++test("wake word with unreachable agent falls back to cleanup", async () => {+ const { resolveDictationRouteKind } = await load();++ assert.equal(+ resolveDictationRouteKind({+ cleanupReachable: true,+ agentReachable: false,+ agentInvoked: true,+ voiceAgentRequested: false,+ }),+ "cleanup"+ );+});++test("skips reasoning when nothing is reachable", async () => {+ const { resolveDictationRouteKind } = await load();++ assert.equal(+ resolveDictationRouteKind({+ cleanupReachable: false,+ agentReachable: false,+ agentInvoked: false,+ voiceAgentRequested: false,+ }),+ "skip"+ );+});