feat(desktop): add voice control
Some checks failed
deploy / deploy (push) Waiting to run
generate / generate (push) Waiting to run
nix-eval / nix-eval (push) Waiting to run
publish / version (push) Waiting to run
publish / build-cli (push) Blocked by required conditions
publish / sign-cli-windows (push) Blocked by required conditions
publish / build-electron (map[bun_install_flags:--os=darwin --cpu=arm64 host:macos-26 platform_flag:--mac --arm64 target:aarch64-apple-darwin]) (push) Blocked by required conditions
publish / build-electron (map[bun_install_flags:--os=darwin --cpu=x64 host:macos-26-intel platform_flag:--mac --x64 target:x86_64-apple-darwin]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-ubuntu-2404 platform_flag:--linux target:x86_64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-ubuntu-2404-arm platform_flag:--linux --arm64 target:aarch64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-windows-2025 platform_flag:--win target:x86_64-pc-windows-msvc]) (push) Blocked by required conditions
publish / build-electron (map[host:windows-2025 platform_flag:--win --arm64 target:aarch64-pc-windows-msvc]) (push) Blocked by required conditions
publish / publish (push) Blocked by required conditions
test / unit (linux) (push) Waiting to run
test / unit (windows) (push) Waiting to run
test / e2e (linux) (push) Waiting to run
test / e2e (windows) (push) Waiting to run
typecheck / typecheck (push) Waiting to run
containers / build (push) Has been cancelled
docs-locale-sync / sync-locales (push) Has been cancelled
nix-hashes / compute-hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Has been cancelled
nix-hashes / compute-hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Has been cancelled
nix-hashes / compute-hash (macos-15-intel, x86_64-darwin) (push) Has been cancelled
nix-hashes / compute-hash (macos-latest, aarch64-darwin) (push) Has been cancelled
storybook / storybook build (push) Has been cancelled
nix-hashes / update-hashes (push) Has been cancelled

This commit is contained in:
axcho 2026-07-30 16:20:14 -04:00
parent 0317531906
commit 78bf9a35eb
53 changed files with 2818 additions and 32 deletions

1
.gitignore vendored
View file

@ -32,3 +32,4 @@ UPCOMING_CHANGELOG.md
logs/
*.bun-build
tsconfig.tsbuildinfo
backups/

View file

@ -0,0 +1,63 @@
# Change Log — 2026-07-26
## Desktop microphone voice control
### Summary
Added built-in push-to-talk / toggle microphone voice control to the OpenCode Electron desktop app for Windows (and other desktop platforms). Speech is transcribed with cloud STT providers (Deepgram streaming, Groq Whisper, OpenAI Whisper). Short spoken phrases can be interpreted as voice commands.
### Architecture
- **Main process** (`packages/desktop/src/main/voice/`): recording orchestration, SoX/FFmpeg capture when available, cloud STT providers, global hotkey (`Alt+Space` by default), IPC + electron-store config.
- **Renderer fallback capture**: when SoX/FFmpeg is not installed, the renderer uses `getUserMedia`, downsamples to 16 kHz mono PCM, and streams chunks to the main process.
- **App UI** (`packages/app/src/voice/`): SolidJS voice context, mic button beside prompt submit, recording overlay, settings tab, command parser.
- **Config schema** (`packages/opencode/src/config/voice.ts`): Effect Schema for voice settings.
### User setup
1. Set one of: `DEEPGRAM_API_KEY`, `GROQ_API_KEY`, or `OPENAI_API_KEY` in the environment.
2. Optional: install SoX (`winget install sox`) for native capture; otherwise renderer MediaDevices is used automatically.
3. In Desktop Settings → Voice, choose provider/hotkey and enable commands.
4. Press the mic button or the global hotkey to dictate. Say `send`, `clear`, `stop`, etc. for commands.
### Files added
- `packages/desktop/src/main/voice/*`
- `packages/desktop/docs/voice-control.md`
- `packages/app/src/voice/*`
- `packages/opencode/src/config/voice.ts`
- `CHANGELOGS/2026-07-26-desktop-voice-control.md`
- `backups/20260726-121936/*` (pre-change backups)
### Files modified
- Desktop main/preload/renderer IPC surface
- Prompt input V2 (mic button + voice action wiring)
- Settings dialog (Voice tab)
- UI icon sets (microphone)
- App i18n dictionaries
- Permission dock (`data-action` hooks for voice accept/reject)
### Notes
- Existing npm plugin `opencode-voice` remains useful for CLI/TUI; this feature targets the Electron desktop app where plugins cannot access mic/DOM.
- Electron `globalShortcut` only fires on keydown, so the hotkey toggles recording (press to start, press again to stop).
## Production installation — 2026-07-30
- Repaired the Windows checkout declaration shim used by app typechecking.
- Corrected voice recorder child-process typing, settings component contracts, public voice type naming, and resolved config typing.
- Verified `packages/desktop`, `packages/app`, `packages/opencode`, `packages/ui`, and `packages/session-ui` with their package typecheck commands.
- Verified the voice command parser with four passing unit tests.
- Built with `OPENCODE_CHANNEL=prod` and packaged `dist/opencode-desktop-win-x64.exe`.
- Installer SHA-256: `E4E4C855FB17A9027B993EFB1C59DB8DBC589A23EA9FB171F7401D359913D4EC`.
- Installed silently for the current user over OpenCode Desktop 1.18.4; the installer returned exit code 0.
- Confirmed the existing user-data backup at `C:\Users\axcho\OneDrive\Documents\Business\CloudAxc.io\Code\OpenCode\opencode-userdata-backup-20260727`.
## CloudAxe repository publication — 2026-07-30
- Added `backups/` to root `.gitignore` so local timestamped safety copies stay untracked.
- Re-verified package typechecks for `desktop`, `app`, `opencode`, `ui`, and `session-ui`, plus voice command parser unit tests.
- Committed voice control source changes on `dev` as `feat(desktop): add voice control`.
- Published the fork (full upstream history preserved) to `https://repo.cloudaxe.io/CloudAxe/cloudaxe-opencode.git` via a separate `cloudaxe` remote, leaving GitHub `origin` unchanged.
- Pushed local `dev` to `cloudaxe/dev` and verified remote SHA match.

View file

@ -58,6 +58,7 @@ import { SettingsProvider, useSettings } from "@/context/settings"
import { TabsProvider, useTabs, type DraftTab } from "@/context/tabs"
import { SDKProvider, useSDK } from "@/context/sdk"
import { WslServersProvider } from "@/wsl/context"
import { VoiceOverlay, VoiceProvider } from "@/voice"
import DirectoryLayout, { DirectoryDataProvider } from "@/pages/directory-layout"
import LegacyLayout from "@/pages/layout"
import NewLayout from "@/pages/layout-new"
@ -371,22 +372,27 @@ export function AppBaseProviders(props: ParentProps<{ locale?: Locale }>) {
>
<LanguageProvider locale={props.locale}>
<UiI18nBridge>
<ErrorBoundary
fallback={(error) => {
Sentry.captureException(error)
return <ErrorPage error={error} />
}}
>
<QueryProvider>
<WslServersProvider>
<DialogProvider>
<MarkedProvider>
<FileComponentProvider component={File}>{props.children}</FileComponentProvider>
</MarkedProvider>
</DialogProvider>
</WslServersProvider>
</QueryProvider>
</ErrorBoundary>
<VoiceProvider>
<ErrorBoundary
fallback={(error) => {
Sentry.captureException(error)
return <ErrorPage error={error} />
}}
>
<QueryProvider>
<WslServersProvider>
<DialogProvider>
<MarkedProvider>
<FileComponentProvider component={File}>
{props.children}
<VoiceOverlay />
</FileComponentProvider>
</MarkedProvider>
</DialogProvider>
</WslServersProvider>
</QueryProvider>
</ErrorBoundary>
</VoiceProvider>
</UiI18nBridge>
</LanguageProvider>
</ThemeProvider>

View file

@ -6,7 +6,7 @@ import { Icon } from "@opencode-ai/ui/v2/icon"
import { KeybindV2 } from "@opencode-ai/ui/v2/keybind-v2"
import { TooltipV2 } from "@opencode-ai/ui/v2/tooltip-v2"
import type { Prompt, ReferenceInfo } from "@opencode-ai/sdk/v2/client"
import { createEffect, createMemo, on, Show } from "solid-js"
import { createEffect, createMemo, on, onCleanup, Show } from "solid-js"
import { ModelSelectorPopoverV2 } from "@/components/dialog-select-model"
import { DialogSelectModelUnpaidV2 } from "@/components/dialog-select-model-unpaid-v2"
import type { PromptInputProps } from "@/components/prompt-input/contracts"
@ -26,6 +26,7 @@ import { useSDK } from "@/context/sdk"
import { useSync } from "@/context/sync"
import { createSessionTabs } from "@/pages/session/helpers"
import { showToast } from "@/utils/toast"
import { VoiceButton, useVoiceOptional } from "@/voice"
import { PromptInputV2, type PromptInputV2Suggestion } from "@opencode-ai/session-ui/v2/prompt-input"
import {
createPromptInputV2Controller,
@ -50,10 +51,56 @@ export function PromptInputV2Composer(props: PromptInputV2ComposerProps) {
const dialog = useDialog()
const command = useCommand()
const language = useLanguage()
const voice = useVoiceOptional()
const prompt = usePrompt()
useCommands(props)
useEditHandler(props)
createEffect(() => {
const unregister = voice.registerActions({
insertText: (text) => {
const editor = document.querySelector<HTMLElement>('[data-component="prompt-input"]')
if (editor && typeof document.execCommand === "function") {
editor.focus()
document.execCommand("insertText", false, text.endsWith(" ") ? text : `${text} `)
return
}
props.controller.onInput(text)
},
submit: () => props.controller.submit(),
clear: () => {
prompt.set([{ type: "text", content: "", start: 0, end: 0 }], 0)
props.controller.onInput("")
},
stop: () => props.controller.stop(),
accept: () => {
document.querySelector<HTMLButtonElement>('[data-action="permission-once"]')?.click()
},
reject: () => {
document.querySelector<HTMLButtonElement>('[data-action="permission-reject"]')?.click()
},
scrollUp: () => {
const scroller = document.querySelector<HTMLElement>("[data-slot='session-scroll']")
scroller?.scrollBy({ top: -320, behavior: "smooth" })
},
scrollDown: () => {
const scroller = document.querySelector<HTMLElement>("[data-slot='session-scroll']")
scroller?.scrollBy({ top: 320, behavior: "smooth" })
},
focus: () => props.controller.restoreFocus(),
newline: () => {
const editor = document.querySelector<HTMLElement>('[data-component="prompt-input"]')
if (editor && typeof document.execCommand === "function") {
editor.focus()
document.execCommand("insertText", false, "\n")
}
},
run: () => props.controller.submit(),
})
onCleanup(unregister)
})
return (
<div class="flex flex-col gap-3">
<PromptInputV2
@ -62,6 +109,7 @@ export function PromptInputV2Composer(props: PromptInputV2ComposerProps) {
class={props.class}
attachKeybind={command.keybindParts("file.attach")}
attachShortcut={command.keybind("file.attach")}
actions={<VoiceButton />}
modelControl={
<PromptInputV2ModelControl
loading={props.controller.model.loading}

View file

@ -1,4 +1,4 @@
import { Component, createSignal, startTransition } from "solid-js"
import { Component, createSignal, Show, startTransition } from "solid-js"
import { Dialog } from "@opencode-ai/ui/v2/dialog-v2"
import { TabsV2 } from "@opencode-ai/ui/v2/tabs-v2"
import { Icon } from "@opencode-ai/ui/icon"
@ -10,6 +10,7 @@ import { SettingsProvidersV2 } from "./providers"
import { SettingsModelsV2 } from "./models"
import "./settings-v2.css"
import { SettingsServersV2 } from "./servers"
import { VoiceSettings } from "@/voice"
import { useDialog } from "@opencode-ai/ui/context/dialog"
export const DialogSettings: Component<{
@ -49,6 +50,12 @@ export const DialogSettings: Component<{
<Icon name="keyboard" />
{language.t("settings.tab.shortcuts")}
</TabsV2.Trigger>
<Show when={platform.platform === "desktop"}>
<TabsV2.Trigger value="voice">
<Icon name="microphone" />
{language.t("settings.tab.voice")}
</TabsV2.Trigger>
</Show>
</div>
</div>
@ -83,6 +90,9 @@ export const DialogSettings: Component<{
<TabsV2.Content value="shortcuts" class="settings-v2-panel">
<SettingsKeybinds v2 />
</TabsV2.Content>
<TabsV2.Content value="voice" class="settings-v2-panel">
<VoiceSettings />
</TabsV2.Content>
<TabsV2.Content value="servers" class="settings-v2-panel">
<SettingsServersV2 />
</TabsV2.Content>

View file

@ -120,6 +120,9 @@ type PlatformBase = {
/** Record a fatal renderer error in platform logs (desktop only) */
recordFatalRendererError?(error: FatalRendererErrorLog): Promise<void>
/** Desktop microphone voice control API (Electron only) */
voice?: import("../voice/types").VoicePlatformAPI
}
export type Platform = PlatformBase &

View file

@ -1 +1,17 @@
../../ui/src/custom-elements.d.ts
import { DIFFS_TAG_NAME } from "@pierre/diffs"
/**
* TypeScript declaration for the <diffs-container> custom element.
* This tells TypeScript that <diffs-container> is a valid JSX element in SolidJS.
* Required for using the @pierre/diffs web component in .tsx files.
*/
declare module "solid-js" {
namespace JSX {
interface IntrinsicElements {
[DIFFS_TAG_NAME]: HTMLAttributes<HTMLElement>
}
}
}
export {}

View file

@ -1005,4 +1005,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "فشل إنشاء أيقونة المشروع الدائمة",
"error.childStore.storeCreateFailed": "فشل إنشاء المخزن",
"terminal.connectionLost.abnormalClose": "تم إغلاق WebSocket بشكل غير طبيعي: {{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
}

View file

@ -1021,4 +1021,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "Falha ao criar ícone de projeto persistente",
"error.childStore.storeCreateFailed": "Falha ao criar armazenamento",
"terminal.connectionLost.abnormalClose": "WebSocket fechado anormalmente: {{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
}

View file

@ -1097,4 +1097,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "Nije uspjelo kreiranje trajne ikone projekta",
"error.childStore.storeCreateFailed": "Nije uspjelo kreiranje skladišta",
"terminal.connectionLost.abnormalClose": "WebSocket zatvoren nenormalno: {{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
}

View file

@ -1089,4 +1089,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "Kunne ikke oprette vedvarende projektikon",
"error.childStore.storeCreateFailed": "Kunne ikke oprette lager",
"terminal.connectionLost.abnormalClose": "WebSocket lukkede unormalt: {{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
}

View file

@ -1034,4 +1034,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "Dauerhaftes Projekticon konnte nicht erstellt werden",
"error.childStore.storeCreateFailed": "Speicher konnte nicht erstellt werden",
"terminal.connectionLost.abnormalClose": "WebSocket abnormal geschlossen: {{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
} satisfies Partial<Record<Keys, string>>

View file

@ -845,6 +845,54 @@ export const dict = {
"settings.section.server": "Server",
"settings.tab.general": "General",
"settings.tab.shortcuts": "Shortcuts",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
"settings.desktop.section.wsl": "WSL",
"settings.desktop.wsl.title": "WSL integration",
"settings.desktop.wsl.description": "Run the OpenCode server inside WSL on Windows.",

View file

@ -1105,4 +1105,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "Error al crear icono de proyecto persistente",
"error.childStore.storeCreateFailed": "Error al crear almacén",
"terminal.connectionLost.abnormalClose": "WebSocket cerrado anormalmente: {{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
}

View file

@ -1034,4 +1034,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "Échec de la création de l'icône de projet persistante",
"error.childStore.storeCreateFailed": "Échec de la création du stockage",
"terminal.connectionLost.abnormalClose": "WebSocket fermé anormalement : {{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
}

View file

@ -1013,4 +1013,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "永続プロジェクトアイコンの作成に失敗しました",
"error.childStore.storeCreateFailed": "ストアの作成に失敗しました",
"terminal.connectionLost.abnormalClose": "WebSocket が異常終了しました: {{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
}

View file

@ -1012,4 +1012,49 @@ export const dict = {
"settings.general.row.pinchZoom.description": "트랙패드 핀치 및 Ctrl-스크롤 제스처로 확대/축소 허용",
"settings.updates.action.downloading": "다운로드 중...",
"settings.updates.action.installing": "설치 중...",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
}

View file

@ -1108,4 +1108,49 @@ export const dict = {
"settings.general.row.pinchZoom.description": "Tillat knipebevegelser på styreflaten og Ctrl-rulling for å zoome",
"settings.updates.action.downloading": "Laster ned...",
"settings.updates.action.installing": "Installerer...",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
} satisfies Partial<Record<Keys, string>>

View file

@ -1021,4 +1021,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "Nie udało się utworzyć trwałej ikony projektu",
"error.childStore.storeCreateFailed": "Nie udało się utworzyć magazynu",
"terminal.connectionLost.abnormalClose": "WebSocket zamknięty nieprawidłowo: {{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
}

View file

@ -1100,4 +1100,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "Не удалось создать постоянный значок проекта",
"error.childStore.storeCreateFailed": "Не удалось создать хранилище",
"terminal.connectionLost.abnormalClose": "WebSocket закрыт аварийно: {{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
}

View file

@ -1084,4 +1084,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "ไม่สามารถสร้างไอคอนโปรเจกต์ถาวร",
"error.childStore.storeCreateFailed": "ไม่สามารถสร้างที่เก็บ",
"terminal.connectionLost.abnormalClose": "WebSocket ปิดอย่างผิดปกติ: {{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
}

View file

@ -1103,4 +1103,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "Kalıcı proje simgesi oluşturulamadı",
"error.childStore.storeCreateFailed": "Depo oluşturulamadı",
"terminal.connectionLost.abnormalClose": "WebSocket anormal şekilde kapandı: {{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
} satisfies Partial<Record<Keys, string>>

View file

@ -1102,4 +1102,49 @@ export const dict = {
"workspace.reset.archived.one": "1 сесію буде заархівовано.",
"workspace.reset.archived.many": "{{count}} сесій буде заархівовано.",
"workspace.reset.note": "Це скине робочу область, щоб вона відповідала гілці за замовчуванням.",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
}

View file

@ -1075,4 +1075,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "创建持久化项目图标失败",
"error.childStore.storeCreateFailed": "创建存储失败",
"terminal.connectionLost.abnormalClose": "WebSocket 异常关闭:{{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
} satisfies Partial<Record<Keys, string>>

View file

@ -1071,4 +1071,49 @@ export const dict = {
"error.childStore.persistedProjectIconCreateFailed": "建立持續性專案圖示失敗",
"error.childStore.storeCreateFailed": "建立儲存區失敗",
"terminal.connectionLost.abnormalClose": "WebSocket 異常關閉:{{code}}",
"settings.tab.voice": "Voice",
"settings.voice.title": "Voice control",
"settings.voice.unavailable.title": "Desktop only",
"settings.voice.unavailable.description": "Microphone voice control is available in the OpenCode desktop app.",
"settings.voice.enabled.title": "Enable voice input",
"settings.voice.enabled.description": "Allow microphone dictation and voice commands in the desktop app",
"settings.voice.provider.title": "Speech provider",
"settings.voice.provider.description": "Cloud speech-to-text backend used for transcription",
"settings.voice.language.title": "Language",
"settings.voice.language.description": "Language hint for the speech provider (for example en, fr)",
"settings.voice.hotkey.title": "Global hotkey",
"settings.voice.hotkey.description": "Press to start or stop recording from anywhere (Electron accelerator)",
"settings.voice.commands.title": "Voice commands",
"settings.voice.commands.description": "Interpret short phrases like send, clear, or stop as commands",
"settings.voice.autoSend.title": "Auto-send",
"settings.voice.autoSend.description": "Submit the prompt automatically after a final transcription",
"settings.voice.api.title": "API keys",
"settings.voice.api.status.title": "Provider key",
"settings.voice.api.status.configured": "Found {{env}} in the environment",
"settings.voice.api.status.missing": "Set {{env}} in your environment, then restart OpenCode",
"settings.voice.api.ready": "Configured",
"settings.voice.api.missing": "Missing",
"settings.voice.api.docs.title": "Get an API key",
"settings.voice.api.docs.description": "Open the provider console to create a key",
"settings.voice.test.title": "Microphone test",
"settings.voice.test.description": "Record for a few seconds to verify capture and transcription",
"settings.voice.test.action": "Test microphone",
"settings.voice.test.started": "Recording... speak now",
"settings.voice.commands.list.title": "Supported commands",
"voice.tooltip.start": "Dictate ({{hotkey}})",
"voice.tooltip.stop": "Stop recording",
"voice.action.dictate": "Dictate",
"voice.action.stop": "Stop",
"voice.status.recording": "Recording",
"voice.status.processing": "Transcribing...",
"voice.status.listening": "Listening...",
"voice.command.send": "Submit the current prompt",
"voice.command.run": "Run / submit the current prompt",
"voice.command.accept": "Allow the pending permission once",
"voice.command.reject": "Deny the pending permission",
"voice.command.clear": "Clear the prompt input",
"voice.command.stop": "Stop the current generation",
"voice.command.scroll": "Scroll the session timeline",
"voice.command.focus": "Focus the prompt input",
"voice.command.newline": "Insert a newline in the prompt",
} satisfies Partial<Record<Keys, string>>

View file

@ -34,18 +34,31 @@ export function SessionPermissionDock(props: {
<>
<div />
<div data-slot="permission-footer-actions">
<Button variant="ghost" size="normal" onClick={() => props.onDecide("reject")} disabled={props.responding}>
<Button
variant="ghost"
size="normal"
data-action="permission-reject"
onClick={() => props.onDecide("reject")}
disabled={props.responding}
>
{language.t("ui.permission.deny")}
</Button>
<Button
variant="secondary"
size="normal"
data-action="permission-always"
onClick={() => props.onDecide("always")}
disabled={props.responding}
>
{language.t("ui.permission.allowAlways")}
</Button>
<Button variant="primary" size="normal" onClick={() => props.onDecide("once")} disabled={props.responding}>
<Button
variant="primary"
size="normal"
data-action="permission-once"
onClick={() => props.onDecide("once")}
disabled={props.responding}
>
{language.t("ui.permission.allowOnce")}
</Button>
</div>

View file

@ -0,0 +1,17 @@
export { VoiceProvider, useVoice, useVoiceOptional } from "./voice-context"
export { VoiceButton } from "./voice-button"
export { VoiceOverlay } from "./voice-overlay"
export { VoiceSettings } from "./voice-settings"
export { parseVoiceInput } from "./voice-command-parser"
export type {
RecordingState,
TranscriptionResult,
VoiceActions,
VoiceCommand,
VoiceConfig,
VoiceConfigView,
VoiceError,
VoiceParseResult,
VoicePlatformAPI,
VoiceProvider as VoiceProviderName,
} from "./types"

View file

@ -0,0 +1,72 @@
export type VoiceProvider = "deepgram" | "groq" | "openai-whisper"
export type RecordingState = "idle" | "recording" | "processing"
export type VoiceConfig = {
enabled: boolean
provider: VoiceProvider
language: string
hotkey: string
commands: boolean
autoSend: boolean
}
export type VoiceConfigView = VoiceConfig & {
apiKeyConfigured: boolean
apiKeyEnv: string
}
export type TranscriptionResult = {
text: string
isFinal: boolean
confidence?: number
}
export type VoiceError = {
code: "no-api-key" | "no-microphone" | "no-recorder" | "stt-failed" | "permission-denied" | "unknown"
message: string
}
export type VoiceCommand =
| "send"
| "run"
| "accept"
| "reject"
| "clear"
| "stop"
| "scroll-up"
| "scroll-down"
| "focus"
| "newline"
export type VoiceParseResult =
| { type: "command"; command: VoiceCommand; raw: string }
| { type: "text"; text: string }
export type VoicePlatformAPI = {
getConfig: () => Promise<VoiceConfigView>
setConfig: (config: Partial<VoiceConfig>) => Promise<VoiceConfigView>
start: () => Promise<RecordingState>
stop: () => Promise<RecordingState>
toggle: () => Promise<RecordingState>
getState: () => Promise<RecordingState>
sendAudioChunk: (chunk: ArrayBuffer) => Promise<void>
checkApiKey: (provider?: VoiceProvider) => Promise<{ provider: VoiceProvider; configured: boolean; env: string }>
onTranscription: (cb: (result: TranscriptionResult) => void) => () => void
onRecordingState: (cb: (state: RecordingState) => void) => () => void
onError: (cb: (error: VoiceError) => void) => () => void
onCaptureMode: (cb: (mode: "native" | "renderer") => void) => () => void
}
export type VoiceActions = {
insertText: (text: string) => void
submit: () => void
clear: () => void
stop: () => void
accept: () => void
reject: () => void
scrollUp: () => void
scrollDown: () => void
focus: () => void
newline: () => void
run: () => void
}

View file

@ -0,0 +1,40 @@
import { Show, type Component } from "solid-js"
import { Icon } from "@opencode-ai/ui/v2/icon"
import { IconButtonV2 } from "@opencode-ai/ui/v2/icon-button-v2"
import { TooltipV2 } from "@opencode-ai/ui/v2/tooltip-v2"
import { useLanguage } from "@/context/language"
import { useVoiceOptional } from "./voice-context"
export const VoiceButton: Component<{ class?: string }> = (props) => {
const voice = useVoiceOptional()
const language = useLanguage()
return (
<Show when={voice.available()}>
<TooltipV2
value={
voice.recording()
? language.t("voice.tooltip.stop")
: language.t("voice.tooltip.start", { hotkey: voice.config().hotkey })
}
placement="top"
>
<IconButtonV2
class={props.class}
data-action="prompt-voice"
type="button"
variant="ghost-muted"
size="large"
aria-label={voice.recording() ? language.t("voice.tooltip.stop") : language.t("voice.action.dictate")}
aria-pressed={voice.recording()}
onClick={() => void voice.toggle()}
style={{
color: voice.recording() ? "var(--color-danger, #ef4444)" : undefined,
animation: voice.recording() ? "voice-pulse 1.2s ease-in-out infinite" : undefined,
}}
icon={<Icon name={voice.processing() ? "settings-gear" : "microphone"} />}
/>
</TooltipV2>
</Show>
)
}

View file

@ -0,0 +1,90 @@
import type { VoicePlatformAPI } from "./types"
/**
* Captures microphone audio in the renderer, downsamples to 16 kHz mono PCM,
* and streams chunks to the desktop main process for cloud STT.
*/
export function createRendererVoiceCapture(api: VoicePlatformAPI) {
let stream: MediaStream | undefined
let context: AudioContext | undefined
let processor: ScriptProcessorNode | undefined
let source: MediaStreamAudioSourceNode | undefined
let active = false
const stop = () => {
active = false
processor?.disconnect()
source?.disconnect()
processor = undefined
source = undefined
void context?.close()
context = undefined
stream?.getTracks().forEach((track) => track.stop())
stream = undefined
}
const start = async () => {
if (active) return
active = true
stream = await navigator.mediaDevices.getUserMedia({
audio: {
channelCount: 1,
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true,
},
video: false,
})
context = new AudioContext()
source = context.createMediaStreamSource(stream)
// ScriptProcessorNode is deprecated but widely available in Electron without AudioWorklet setup.
processor = context.createScriptProcessor(4096, 1, 1)
const inputRate = context.sampleRate
processor.onaudioprocess = (event) => {
if (!active) return
const input = event.inputBuffer.getChannelData(0)
const pcm = downsampleTo16k(input, inputRate)
if (pcm.byteLength === 0) return
void api.sendAudioChunk(pcm)
}
source.connect(processor)
processor.connect(context.destination)
}
return { start, stop, get active() { return active } }
}
function downsampleTo16k(input: Float32Array, inputRate: number) {
if (inputRate === 16000) return floatTo16BitPCM(input)
const ratio = inputRate / 16000
const length = Math.floor(input.length / ratio)
const result = new Float32Array(length)
let offsetResult = 0
let offsetInput = 0
while (offsetResult < length) {
const next = Math.floor((offsetResult + 1) * ratio)
let accum = 0
let count = 0
for (let i = offsetInput; i < next && i < input.length; i += 1) {
accum += input[i]
count += 1
}
result[offsetResult] = count ? accum / count : 0
offsetResult += 1
offsetInput = next
}
return floatTo16BitPCM(result)
}
function floatTo16BitPCM(input: Float32Array) {
const buffer = new ArrayBuffer(input.length * 2)
const view = new DataView(buffer)
for (let i = 0; i < input.length; i += 1) {
const sample = Math.max(-1, Math.min(1, input[i]))
view.setInt16(i * 2, sample < 0 ? sample * 0x8000 : sample * 0x7fff, true)
}
return buffer
}

View file

@ -0,0 +1,23 @@
import { describe, expect, test } from "bun:test"
import { parseVoiceInput } from "./voice-command-parser"
describe("parseVoiceInput", () => {
test("detects send command", () => {
expect(parseVoiceInput("please send")).toEqual({ type: "command", command: "send", raw: "please send" })
})
test("detects clear command", () => {
expect(parseVoiceInput("clear prompt")).toEqual({ type: "command", command: "clear", raw: "clear prompt" })
})
test("returns text for longer phrases", () => {
expect(parseVoiceInput("please refactor the login form")).toEqual({
type: "text",
text: "please refactor the login form",
})
})
test("disables commands when requested", () => {
expect(parseVoiceInput("send", false)).toEqual({ type: "text", text: "send" })
})
})

View file

@ -0,0 +1,43 @@
import type { VoiceCommand, VoiceParseResult } from "./types"
const FILLERS = /\b(please|can you|could you|would you|hey|okay|ok|just|now)\b/gi
const COMMANDS: Array<{ command: VoiceCommand; patterns: RegExp[] }> = [
{ command: "send", patterns: [/^send$/, /^submit$/, /^go$/, /^send (it|that|message|prompt)$/] },
{ command: "run", patterns: [/^run$/, /^execute$/, /^run (it|that|command)$/] },
{ command: "accept", patterns: [/^accept$/, /^approve$/, /^yes$/, /^accept (it|that|changes)$/] },
{ command: "reject", patterns: [/^reject$/, /^deny$/, /^no$/, /^reject (it|that|changes)$/] },
{ command: "clear", patterns: [/^clear$/, /^reset$/, /^erase$/, /^clear (prompt|input|text)$/] },
{ command: "stop", patterns: [/^stop$/, /^cancel$/, /^abort$/, /^stop (it|that|generation)$/] },
{ command: "scroll-up", patterns: [/^scroll up$/, /^page up$/] },
{ command: "scroll-down", patterns: [/^scroll down$/, /^page down$/] },
{ command: "focus", patterns: [/^focus$/, /^focus (prompt|input)$/] },
{ command: "newline", patterns: [/^new line$/, /^newline$/, /^line break$/] },
]
/**
* Detects short voice-control utterances. Longer phrases are treated as dictation text.
*/
export function parseVoiceInput(raw: string, enabled = true): VoiceParseResult {
const trimmed = raw.trim()
if (!trimmed) return { type: "text", text: "" }
if (!enabled) return { type: "text", text: trimmed }
const normalized = trimmed
.toLowerCase()
.replace(FILLERS, " ")
.replace(/[^\w\s-]/g, " ")
.replace(/\s+/g, " ")
.trim()
// Only treat short phrases as commands to avoid false positives in dictation
if (normalized.split(" ").length > 4) return { type: "text", text: trimmed }
for (const entry of COMMANDS) {
if (entry.patterns.some((pattern) => pattern.test(normalized))) {
return { type: "command", command: entry.command, raw: trimmed }
}
}
return { type: "text", text: trimmed }
}

View file

@ -0,0 +1,242 @@
import { createSimpleContext } from "@opencode-ai/ui/context"
import { createEffect, createMemo, onCleanup } from "solid-js"
import { createStore } from "solid-js/store"
import { usePlatform } from "@/context/platform"
import { createRendererVoiceCapture } from "./voice-capture"
import { parseVoiceInput } from "./voice-command-parser"
import type {
RecordingState,
TranscriptionResult,
VoiceActions,
VoiceConfigView,
VoiceError,
VoicePlatformAPI,
} from "./types"
const defaultConfig: VoiceConfigView = {
enabled: true,
provider: "deepgram",
language: "en",
hotkey: "Alt+Space",
commands: true,
autoSend: false,
apiKeyConfigured: false,
apiKeyEnv: "DEEPGRAM_API_KEY",
}
const noopVoice = {
available: () => false,
state: () => "idle" as RecordingState,
interim: () => "",
finalText: () => "",
error: () => undefined as VoiceError | undefined,
config: () => defaultConfig,
durationMs: () => 0,
recording: () => false,
processing: () => false,
async start() {},
async stop() {},
async toggle() {},
async setConfig(_patch: Partial<VoiceConfigView>) {},
async refreshConfig() {},
registerActions(_next: Partial<VoiceActions>) {
return () => undefined
},
clearError() {},
}
const ctx = createSimpleContext({
name: "Voice",
gate: false,
init: () => {
const platform = usePlatform()
const api = () => platform.voice
const [store, setStore] = createStore({
available: false,
state: "idle" as RecordingState,
interim: "",
finalText: "",
error: undefined as VoiceError | undefined,
config: defaultConfig,
captureMode: "native" as "native" | "renderer",
durationMs: 0,
})
let actions: Partial<VoiceActions> = {}
let capture: ReturnType<typeof createRendererVoiceCapture> | undefined
let timer: ReturnType<typeof setInterval> | undefined
let startedAt = 0
const refreshConfig = async () => {
const voice = api()
if (!voice) {
setStore("available", false)
return
}
setStore("available", true)
const config = await voice.getConfig()
setStore("config", config)
}
createEffect(() => {
const voice = api()
if (!voice) {
setStore("available", false)
return
}
setStore("available", true)
void refreshConfig()
void voice.getState().then((state) => setStore("state", state))
const unsubState = voice.onRecordingState((state) => {
setStore("state", state)
if (state === "recording") {
startedAt = Date.now()
clearInterval(timer)
timer = setInterval(() => setStore("durationMs", Date.now() - startedAt), 200)
return
}
clearInterval(timer)
timer = undefined
if (state === "idle") {
setStore("durationMs", 0)
capture?.stop()
}
})
const unsubTranscription = voice.onTranscription((result) => {
handleTranscription(result)
})
const unsubError = voice.onError((error) => {
setStore("error", error)
capture?.stop()
})
const unsubCapture = voice.onCaptureMode((mode) => {
setStore("captureMode", mode)
if (mode === "renderer") void startRendererCapture(voice)
if (mode === "native") capture?.stop()
})
onCleanup(() => {
unsubState()
unsubTranscription()
unsubError()
unsubCapture()
clearInterval(timer)
capture?.stop()
})
})
const startRendererCapture = async (voice: VoicePlatformAPI) => {
capture ??= createRendererVoiceCapture(voice)
try {
await capture.start()
} catch (error) {
setStore("error", {
code: "no-microphone",
message: error instanceof Error ? error.message : "Microphone access failed",
})
await voice.stop()
}
}
const handleTranscription = (result: TranscriptionResult) => {
setStore("interim", result.isFinal ? "" : result.text)
if (!result.isFinal) return
setStore("finalText", result.text)
const parsed = parseVoiceInput(result.text, store.config.commands)
if (parsed.type === "command") {
dispatchCommand(parsed.command)
return
}
if (!parsed.text) return
actions.insertText?.(parsed.text)
if (store.config.autoSend) actions.submit?.()
}
const dispatchCommand = (command: string) => {
if (command === "send") return actions.submit?.()
if (command === "run") return actions.run?.() ?? actions.submit?.()
if (command === "accept") return actions.accept?.()
if (command === "reject") return actions.reject?.()
if (command === "clear") return actions.clear?.()
if (command === "stop") return actions.stop?.()
if (command === "scroll-up") return actions.scrollUp?.()
if (command === "scroll-down") return actions.scrollDown?.()
if (command === "focus") return actions.focus?.()
if (command === "newline") return actions.newline?.()
}
return {
available: createMemo(() => store.available && store.config.enabled),
state: createMemo(() => store.state),
interim: createMemo(() => store.interim),
finalText: createMemo(() => store.finalText),
error: createMemo(() => store.error),
config: createMemo(() => store.config),
durationMs: createMemo(() => store.durationMs),
recording: createMemo(() => store.state === "recording"),
processing: createMemo(() => store.state === "processing"),
async start() {
const voice = api()
if (!voice) return
setStore("error", undefined)
setStore("interim", "")
await voice.start()
if (store.captureMode === "renderer") await startRendererCapture(voice)
},
async stop() {
const voice = api()
if (!voice) return
capture?.stop()
await voice.stop()
},
async toggle() {
const voice = api()
if (!voice) return
setStore("error", undefined)
if (store.state === "recording") {
capture?.stop()
await voice.stop()
return
}
await voice.start()
if (store.captureMode === "renderer") await startRendererCapture(voice)
},
async setConfig(patch: Partial<VoiceConfigView>) {
const voice = api()
if (!voice) return
const next = await voice.setConfig(patch)
setStore("config", next)
},
async refreshConfig() {
await refreshConfig()
},
registerActions(next: Partial<VoiceActions>) {
actions = { ...actions, ...next }
return () => {
for (const key of Object.keys(next) as Array<keyof VoiceActions>) {
if (actions[key] === next[key]) delete actions[key]
}
}
},
clearError() {
setStore("error", undefined)
},
}
},
})
export const VoiceProvider = ctx.provider
export const useVoice = ctx.use
/** Safe for storybook / non-app trees that omit VoiceProvider. */
export function useVoiceOptional() {
try {
return useVoice()
} catch {
return noopVoice
}
}

View file

@ -0,0 +1,72 @@
import { Show, type Component } from "solid-js"
import { Icon } from "@opencode-ai/ui/v2/icon"
import { useLanguage } from "@/context/language"
import { useVoice } from "./voice-context"
export const VoiceOverlay: Component = () => {
const voice = useVoice()
const language = useLanguage()
const seconds = () => Math.floor(voice.durationMs() / 1000)
const clock = () => {
const total = seconds()
const m = Math.floor(total / 60)
.toString()
.padStart(2, "0")
const s = (total % 60).toString().padStart(2, "0")
return `${m}:${s}`
}
return (
<Show when={voice.available() && (voice.recording() || voice.processing() || voice.error())}>
<div
class="pointer-events-none fixed inset-x-0 bottom-24 z-50 flex justify-center px-4"
data-component="voice-overlay"
>
<div class="pointer-events-auto flex max-w-xl flex-col gap-2 rounded-xl border border-border-weak-base bg-background-stronger px-4 py-3 shadow-lg">
<div class="flex items-center gap-3">
<div
class="flex size-8 items-center justify-center rounded-full"
style={{
"background-color": voice.recording() ? "color-mix(in srgb, #ef4444 20%, transparent)" : undefined,
animation: voice.recording() ? "voice-pulse 1.2s ease-in-out infinite" : undefined,
}}
>
<Icon name="microphone" style={{ color: voice.recording() ? "#ef4444" : undefined }} />
</div>
<div class="min-w-0 flex-1">
<div class="text-14-medium text-text-strong">
<Show when={voice.recording()} fallback={language.t("voice.status.processing")}>
{language.t("voice.status.recording")} · {clock()}
</Show>
</div>
<div class="truncate text-12-regular text-text-weak">
<Show
when={voice.error()}
fallback={voice.interim() || voice.finalText() || language.t("voice.status.listening")}
>
{(error) => error().message}
</Show>
</div>
</div>
<Show when={voice.recording()}>
<button
type="button"
class="pointer-events-auto rounded-md px-2 py-1 text-12-medium text-text-weak hover:bg-surface-base"
onClick={() => void voice.stop()}
>
{language.t("voice.action.stop")}
</button>
</Show>
</div>
</div>
</div>
<style>{`
@keyframes voice-pulse {
0%, 100% { transform: scale(1); opacity: 1; }
50% { transform: scale(1.08); opacity: 0.85; }
}
`}</style>
</Show>
)
}

View file

@ -0,0 +1,220 @@
import { For, Show, type Component, type JSX, createMemo, createSignal } from "solid-js"
import { ButtonV2 } from "@opencode-ai/ui/v2/button-v2"
import { SelectV2 } from "@opencode-ai/ui/v2/select-v2"
import { Switch } from "@opencode-ai/ui/v2/switch-v2"
import { TextInputV2 } from "@opencode-ai/ui/v2/text-input-v2"
import { useLanguage } from "@/context/language"
import { usePlatform } from "@/context/platform"
import { SettingsListV2 } from "@/components/settings-v2/parts/list"
import { SettingsRowV2 } from "@/components/settings-v2/parts/row"
import { Link } from "@/components/link"
import { useVoice } from "./voice-context"
import type { VoiceProvider } from "./types"
const PROVIDERS: Array<{ id: VoiceProvider; label: string; docs: string }> = [
{ id: "deepgram", label: "Deepgram", docs: "https://console.deepgram.com/" },
{ id: "groq", label: "Groq Whisper", docs: "https://console.groq.com/keys" },
{ id: "openai-whisper", label: "OpenAI Whisper", docs: "https://platform.openai.com/api-keys" },
]
export const VoiceSettings: Component = () => {
const voice = useVoice()
const language = useLanguage()
const platform = usePlatform()
const [testing, setTesting] = createSignal(false)
const [testMessage, setTestMessage] = createSignal<string>()
const provider = createMemo(() => PROVIDERS.find((item) => item.id === voice.config().provider) ?? PROVIDERS[0])
const providerOptions = () => PROVIDERS
return (
<Show
when={platform.platform === "desktop" && voice.available()}
fallback={
<SettingsSection title={language.t("settings.voice.title")}>
<SettingsRowV2
title={language.t("settings.voice.unavailable.title")}
description={language.t("settings.voice.unavailable.description")}
>
<span />
</SettingsRowV2>
</SettingsSection>
}
>
<div class="flex flex-col gap-6">
<SettingsSection title={language.t("settings.voice.title")}>
<SettingsRowV2
title={language.t("settings.voice.enabled.title")}
description={language.t("settings.voice.enabled.description")}
>
<div class="flex items-center">
<Switch checked={voice.config().enabled} onChange={(checked) => void voice.setConfig({ enabled: checked })} />
</div>
</SettingsRowV2>
<SettingsRowV2
title={language.t("settings.voice.provider.title")}
description={language.t("settings.voice.provider.description")}
>
<SelectV2
appearance="inline"
options={providerOptions()}
current={provider()}
placement="bottom-end"
gutter={6}
value={(o) => o.id}
label={(o) => o.label}
onSelect={(option) => {
if (!option) return
void voice.setConfig({ provider: option.id })
}}
/>
</SettingsRowV2>
<SettingsRowV2
title={language.t("settings.voice.language.title")}
description={language.t("settings.voice.language.description")}
>
<div class="w-full sm:w-[220px]">
<TextInputV2
type="text"
appearance="base"
value={voice.config().language}
placeholder="en"
onInput={(event) => void voice.setConfig({ language: event.currentTarget.value || "en" })}
/>
</div>
</SettingsRowV2>
<SettingsRowV2
title={language.t("settings.voice.hotkey.title")}
description={language.t("settings.voice.hotkey.description")}
>
<div class="w-full sm:w-[220px]">
<TextInputV2
type="text"
appearance="base"
value={voice.config().hotkey}
placeholder="Alt+Space"
onInput={(event) => void voice.setConfig({ hotkey: event.currentTarget.value || "Alt+Space" })}
/>
</div>
</SettingsRowV2>
<SettingsRowV2
title={language.t("settings.voice.commands.title")}
description={language.t("settings.voice.commands.description")}
>
<div class="flex items-center">
<Switch
checked={voice.config().commands}
onChange={(checked) => void voice.setConfig({ commands: checked })}
/>
</div>
</SettingsRowV2>
<SettingsRowV2
title={language.t("settings.voice.autoSend.title")}
description={language.t("settings.voice.autoSend.description")}
>
<div class="flex items-center">
<Switch
checked={voice.config().autoSend}
onChange={(checked) => void voice.setConfig({ autoSend: checked })}
/>
</div>
</SettingsRowV2>
</SettingsSection>
<SettingsSection title={language.t("settings.voice.api.title")}>
<SettingsRowV2
title={language.t("settings.voice.api.status.title")}
description={
voice.config().apiKeyConfigured
? language.t("settings.voice.api.status.configured", { env: voice.config().apiKeyEnv })
: language.t("settings.voice.api.status.missing", { env: voice.config().apiKeyEnv })
}
>
<span
class="text-12-medium"
style={{
color: voice.config().apiKeyConfigured ? "var(--color-success, #22c55e)" : "var(--color-danger, #ef4444)",
}}
>
{voice.config().apiKeyConfigured
? language.t("settings.voice.api.ready")
: language.t("settings.voice.api.missing")}
</span>
</SettingsRowV2>
<SettingsRowV2
title={language.t("settings.voice.api.docs.title")}
description={language.t("settings.voice.api.docs.description")}
>
<Link href={provider().docs}>{provider().label}</Link>
</SettingsRowV2>
<SettingsRowV2
title={language.t("settings.voice.test.title")}
description={language.t("settings.voice.test.description")}
>
<ButtonV2
size="small"
disabled={testing() || !voice.config().enabled}
onClick={async () => {
setTesting(true)
setTestMessage(undefined)
try {
await voice.start()
setTestMessage(language.t("settings.voice.test.started"))
setTimeout(() => void voice.stop(), 3000)
} catch (error) {
setTestMessage(error instanceof Error ? error.message : String(error))
} finally {
setTesting(false)
}
}}
>
{language.t("settings.voice.test.action")}
</ButtonV2>
</SettingsRowV2>
<Show when={testMessage()}>
<div class="px-3 text-12-regular text-text-weak">{testMessage()}</div>
</Show>
</SettingsSection>
<SettingsSection title={language.t("settings.voice.commands.list.title")}>
<For
each={
[
["send / submit / go", "voice.command.send"],
["run / execute", "voice.command.run"],
["accept / approve / yes", "voice.command.accept"],
["reject / deny / no", "voice.command.reject"],
["clear / reset / erase", "voice.command.clear"],
["stop / cancel / abort", "voice.command.stop"],
["scroll up / scroll down", "voice.command.scroll"],
["focus", "voice.command.focus"],
["new line / line break", "voice.command.newline"],
] as const
}
>
{([phrase, key]) => (
<SettingsRowV2 title={phrase} description={language.t(key)}>
<span />
</SettingsRowV2>
)}
</For>
</SettingsSection>
</div>
</Show>
)
}
const SettingsSection: Component<{ title: string; children: JSX.Element }> = (props) => (
<section class="flex flex-col gap-2">
<h2 class="text-14-medium text-text-strong">{props.title}</h2>
<SettingsListV2>{props.children}</SettingsListV2>
</section>
)

View file

@ -0,0 +1,64 @@
# Desktop Voice Control
## Overview
OpenCode Desktop includes built-in microphone voice control for Windows (and other Electron platforms). Speak to fill the prompt, or issue short voice commands such as `send`, `clear`, and `stop`.
## Requirements
1. OpenCode Desktop app (Electron)
2. One cloud STT API key in the environment:
- `DEEPGRAM_API_KEY` (recommended for streaming)
- `GROQ_API_KEY`
- `OPENAI_API_KEY`
3. Optional native recorder: SoX (`winget install sox`) or FFmpeg
If missing, the app automatically falls back to browser `getUserMedia` capture in the renderer.
## Usage
1. Open **Settings → Voice**
2. Choose provider, language, and hotkey (default `Alt+Space`)
3. Press the microphone button next to Send, or press the global hotkey
4. Speak
5. Press the hotkey / button again to stop
6. Review the inserted text, then send (or say `send` if commands are enabled)
## Voice commands
When **Voice commands** is enabled, short phrases are treated as commands instead of dictation:
| Phrase | Action |
| --- | --- |
| send / submit / go | Submit prompt |
| run / execute | Submit prompt |
| accept / approve / yes | Allow pending permission once |
| reject / deny / no | Deny pending permission |
| clear / reset / erase | Clear prompt |
| stop / cancel / abort | Stop generation |
| scroll up / scroll down | Scroll timeline |
| focus | Focus prompt |
| new line / line break | Insert newline |
Longer utterances are always treated as dictation text.
## Architecture
```
Hotkey / Mic button
→ Desktop main VoiceManager
→ Native SoX/FFmpeg capture OR renderer PCM stream
→ Cloud STT (Deepgram WS / Groq / OpenAI Whisper)
→ IPC transcription event
→ App VoiceProvider
→ Command parser OR prompt insert
```
### Packages
- `packages/desktop/src/main/voice/` — main-process capture, STT, IPC, hotkeys
- `packages/app/src/voice/` — UI, context, command parser, settings
- `packages/opencode/src/config/voice.ts` — Effect Schema for voice config
## Security
API keys are read only from environment variables. They are never written to `opencode.json` or electron-store.

View file

@ -15,6 +15,7 @@ import type { ServerReadyData } from "../preload/types"
import { checkAppExists, resolveAppPath } from "./apps"
import { CHANNEL } from "./constants"
import { registerIpcHandlers, sendDeepLinks, sendMenuCommand } from "./ipc"
import { registerVoiceIpc } from "./voice"
import { forwardInitializationFailure } from "./initialization"
import { exportDebugLogs, initCrashReporter, initLogging, startNetLog, write as writeLog } from "./logging"
import { parseMarkdown } from "./markdown"
@ -300,6 +301,7 @@ const main = Effect.gen(function* () {
recordFatalRendererError: (error) => writeLog("renderer", "fatal renderer error", { ...error }, "error"),
})
registerWslIpcHandlers(wslServers)
registerVoiceIpc()
void updater.start()
const updateTimer = setInterval(() => void updater.check(), 10 * 60 * 1000)
updateTimer.unref()

View file

@ -5,3 +5,4 @@ export const OLD_LAYOUT_ELIGIBLE_KEY = "oldLayoutEligible"
export const WSL_SERVERS_KEY = "wslServers"
export const PINCH_ZOOM_ENABLED_KEY = "pinchZoomEnabled"
export const WINDOW_IDS_KEY = "windowIds"
export const VOICE_CONFIG_KEY = "voiceConfig"

View file

@ -0,0 +1,14 @@
export { registerVoiceIpc } from "./voice-ipc"
export { VoiceManager } from "./voice-manager"
export { VoiceRecorder } from "./voice-recorder"
export { createSttProvider } from "./voice-stt"
export {
DEFAULT_VOICE_CONFIG,
apiKeyEnvName,
resolveApiKey,
type RecordingState,
type TranscriptionResult,
type VoiceConfig,
type VoiceError,
type VoiceProvider,
} from "./voice-types"

View file

@ -0,0 +1,164 @@
import { app, BrowserWindow, ipcMain, systemPreferences } from "electron"
import type { IpcMainInvokeEvent } from "electron"
import { getStore } from "../store"
import { VOICE_CONFIG_KEY } from "../store-keys"
import { VoiceManager } from "./voice-manager"
import { createVoiceShortcut } from "./voice-shortcut"
import {
DEFAULT_VOICE_CONFIG,
apiKeyEnvName,
resolveApiKey,
type VoiceConfig,
type VoiceProvider,
} from "./voice-types"
export type VoiceIpcApi = {
dispose: () => void
}
export function registerVoiceIpc(): VoiceIpcApi {
const broadcast = {
state(state: string) {
for (const win of BrowserWindow.getAllWindows()) {
if (win.isDestroyed()) continue
win.webContents.send("voice:state-changed", state)
}
},
transcription(result: unknown) {
for (const win of BrowserWindow.getAllWindows()) {
if (win.isDestroyed()) continue
win.webContents.send("voice:transcription", result)
}
},
error(error: unknown) {
for (const win of BrowserWindow.getAllWindows()) {
if (win.isDestroyed()) continue
win.webContents.send("voice:error", error)
}
},
captureMode(mode: "native" | "renderer") {
for (const win of BrowserWindow.getAllWindows()) {
if (win.isDestroyed()) continue
win.webContents.send("voice:capture-mode", mode)
}
},
}
const manager = new VoiceManager({
onState: (state) => broadcast.state(state),
onTranscription: (result) => broadcast.transcription(result),
onError: (error) => broadcast.error(error),
onCaptureMode: (mode) => broadcast.captureMode(mode),
})
manager.setConfig(loadConfig())
const press = async () => {
// globalShortcut only fires on keydown, so each press toggles recording.
if (manager.getState() === "recording") {
await manager.stop()
return
}
await manager.start()
}
const shortcut = createVoiceShortcut({
getConfig: () => manager.getConfig(),
onPress: () => {
void press()
},
})
shortcut.register(manager.getConfig().hotkey)
ipcMain.handle("voice:get-config", () => {
const config = manager.getConfig()
return {
...config,
apiKeyConfigured: !!resolveApiKey(config.provider),
apiKeyEnv: apiKeyEnvName(config.provider),
}
})
ipcMain.handle("voice:set-config", (_event: IpcMainInvokeEvent, patch: Partial<VoiceConfig>) => {
const next = manager.setConfig(patch)
saveConfig(next)
shortcut.register(next.hotkey)
return {
...next,
apiKeyConfigured: !!resolveApiKey(next.provider),
apiKeyEnv: apiKeyEnvName(next.provider),
}
})
ipcMain.handle("voice:start", async () => {
await ensureMicAccess()
await manager.start()
return manager.getState()
})
ipcMain.handle("voice:stop", async () => {
await manager.stop()
return manager.getState()
})
ipcMain.handle("voice:toggle", async () => {
await ensureMicAccess()
await manager.toggle()
return manager.getState()
})
ipcMain.handle("voice:get-state", () => manager.getState())
ipcMain.handle("voice:audio-chunk", (_event: IpcMainInvokeEvent, chunk: ArrayBuffer) => {
manager.ingestAudio(chunk)
})
ipcMain.handle("voice:check-api-key", (_event: IpcMainInvokeEvent, provider?: VoiceProvider) => {
const selected = provider ?? manager.getConfig().provider
return {
provider: selected,
configured: !!resolveApiKey(selected),
env: apiKeyEnvName(selected),
}
})
const dispose = () => {
shortcut.unregister()
manager.dispose()
}
app.once("will-quit", dispose)
return { dispose }
}
function loadConfig(): VoiceConfig {
const store = getStore()
const raw = store.get(VOICE_CONFIG_KEY)
if (!raw || typeof raw !== "object") return { ...DEFAULT_VOICE_CONFIG }
const value = raw as Partial<VoiceConfig>
return {
enabled: value.enabled ?? DEFAULT_VOICE_CONFIG.enabled,
provider: isProvider(value.provider) ? value.provider : DEFAULT_VOICE_CONFIG.provider,
language: typeof value.language === "string" ? value.language : DEFAULT_VOICE_CONFIG.language,
hotkey: typeof value.hotkey === "string" ? value.hotkey : DEFAULT_VOICE_CONFIG.hotkey,
commands: value.commands ?? DEFAULT_VOICE_CONFIG.commands,
autoSend: value.autoSend ?? DEFAULT_VOICE_CONFIG.autoSend,
}
}
function saveConfig(config: VoiceConfig) {
getStore().set(VOICE_CONFIG_KEY, config)
}
function isProvider(value: unknown): value is VoiceProvider {
return value === "deepgram" || value === "groq" || value === "openai-whisper"
}
async function ensureMicAccess() {
if (process.platform !== "darwin") return
const status = systemPreferences.getMediaAccessStatus("microphone")
if (status === "granted") return
const ok = await systemPreferences.askForMediaAccess("microphone")
if (!ok) throw new Error("Microphone permission denied")
}

View file

@ -0,0 +1,165 @@
import { VoiceRecorder } from "./voice-recorder"
import { createSttProvider, type SttProvider } from "./voice-stt"
import {
DEFAULT_VOICE_CONFIG,
type RecordingState,
type TranscriptionResult,
type VoiceConfig,
type VoiceError,
} from "./voice-types"
export type VoiceManagerCallbacks = {
onState: (state: RecordingState) => void
onTranscription: (result: TranscriptionResult) => void
onError: (error: VoiceError) => void
/** Request renderer MediaDevices capture when SoX/FFmpeg is unavailable. */
onCaptureMode: (mode: "native" | "renderer") => void
}
export class VoiceManager {
private config: VoiceConfig = { ...DEFAULT_VOICE_CONFIG }
private state: RecordingState = "idle"
private recorder: VoiceRecorder | undefined
private stt: SttProvider | undefined
private captureMode: "native" | "renderer" = "native"
private toggleArmed = false
private lastPressAt = 0
private callbacks: VoiceManagerCallbacks
constructor(callbacks: VoiceManagerCallbacks) {
this.callbacks = callbacks
}
getConfig() {
return { ...this.config }
}
setConfig(patch: Partial<VoiceConfig>) {
this.config = {
...this.config,
...patch,
provider: patch.provider ?? this.config.provider,
language: patch.language ?? this.config.language,
hotkey: patch.hotkey ?? this.config.hotkey,
enabled: patch.enabled ?? this.config.enabled,
commands: patch.commands ?? this.config.commands,
autoSend: patch.autoSend ?? this.config.autoSend,
}
return this.getConfig()
}
getState() {
return this.state
}
async start() {
if (!this.config.enabled) return
if (this.state === "recording" || this.state === "processing") return
this.setState("recording")
const hasNative = !!VoiceRecorder.detectTool()
this.captureMode = hasNative ? "native" : "renderer"
this.callbacks.onCaptureMode(this.captureMode)
try {
this.stt = createSttProvider(this.config)
await this.stt.start(
(result) => this.callbacks.onTranscription(result),
(error) => this.fail("stt-failed", error.message),
)
} catch (error) {
this.fail("no-api-key", error instanceof Error ? error.message : String(error))
return
}
if (this.captureMode === "native") {
this.recorder = new VoiceRecorder()
this.recorder.on("data", (chunk) => this.stt?.send(chunk))
this.recorder.on("error", (error) => {
// Fall back to renderer capture if native recorder fails at runtime
this.recorder?.stop()
this.recorder = undefined
this.captureMode = "renderer"
this.callbacks.onCaptureMode("renderer")
this.callbacks.onError({ code: "no-recorder", message: error.message })
})
this.recorder.start()
}
}
async stop() {
if (this.state !== "recording") return
this.setState("processing")
this.recorder?.stop()
this.recorder = undefined
const finalText = await this.stt?.stop().catch((error) => {
this.fail("stt-failed", error instanceof Error ? error.message : String(error))
return undefined
})
this.stt = undefined
if (finalText) {
this.callbacks.onTranscription({ text: finalText, isFinal: true })
}
this.setState("idle")
this.callbacks.onCaptureMode("native")
}
async toggle() {
if (this.state === "recording") {
await this.stop()
return
}
await this.start()
}
/** Push-to-talk press. Double-press within 400ms arms toggle mode. */
async press() {
const now = Date.now()
if (now - this.lastPressAt < 400) {
this.toggleArmed = true
this.lastPressAt = now
await this.toggle()
return
}
this.lastPressAt = now
this.toggleArmed = false
await this.start()
}
/** Push-to-talk release. Ignored when toggle mode is armed. */
async release() {
if (this.toggleArmed) return
await this.stop()
}
ingestAudio(chunk: ArrayBuffer | Buffer) {
if (this.state !== "recording") return
if (this.captureMode !== "renderer") return
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)
this.stt?.send(buffer)
}
dispose() {
this.recorder?.stop()
this.recorder = undefined
void this.stt?.stop()
this.stt = undefined
this.setState("idle")
}
private setState(state: RecordingState) {
this.state = state
this.callbacks.onState(state)
}
private fail(code: VoiceError["code"], message: string) {
this.recorder?.stop()
this.recorder = undefined
void this.stt?.stop()
this.stt = undefined
this.setState("idle")
this.callbacks.onError({ code, message })
}
}

View file

@ -0,0 +1,115 @@
import { spawn, type ChildProcessByStdio } from "node:child_process"
import { EventEmitter } from "node:events"
import { existsSync } from "node:fs"
import { delimiter, join } from "node:path"
import type { Readable } from "node:stream"
export type VoiceRecorderEvents = {
data: [Buffer]
error: [Error]
end: []
}
/**
* Captures 16 kHz mono signed 16-bit little-endian PCM via SoX or FFmpeg.
* When neither tool is available, callers should fall back to renderer MediaDevices capture.
*/
export class VoiceRecorder extends EventEmitter<VoiceRecorderEvents> {
private process: ChildProcessByStdio<null, Readable, Readable> | undefined
private running = false
get active() {
return this.running
}
static detectTool(): { tool: "sox" | "ffmpeg"; command: string } | undefined {
const sox = which("sox")
if (sox) return { tool: "sox", command: sox }
const ffmpeg = which("ffmpeg")
if (ffmpeg) return { tool: "ffmpeg", command: ffmpeg }
return
}
start() {
if (this.running) return
const detected = VoiceRecorder.detectTool()
if (!detected) {
this.emit("error", new Error("No recording tool found. Install SoX (winget install sox) or FFmpeg."))
return
}
const child =
detected.tool === "sox"
? spawn(
detected.command,
["-d", "-q", "-r", "16000", "-c", "1", "-e", "signed-integer", "-b", "16", "-t", "raw", "-"],
{ stdio: ["ignore", "pipe", "pipe"], windowsHide: true },
)
: spawn(
detected.command,
ffmpegArgs(),
{ stdio: ["ignore", "pipe", "pipe"], windowsHide: true },
)
this.process = child
this.running = true
child.stdout.on("data", (chunk: Buffer) => {
this.emit("data", chunk)
})
child.stderr.on("data", (chunk: Buffer) => {
const message = chunk.toString("utf8").trim()
if (!message) return
if (/error|failed|cannot|unable/i.test(message) && !/Input #|Output #|Stream #|size=/i.test(message)) {
this.emit("error", new Error(message))
}
})
child.on("error", (error) => {
this.running = false
this.emit("error", error instanceof Error ? error : new Error(String(error)))
})
child.on("close", () => {
this.running = false
this.process = undefined
this.emit("end")
})
}
stop() {
if (!this.process) {
this.running = false
return
}
const child = this.process
this.process = undefined
this.running = false
child.kill("SIGTERM")
setTimeout(() => {
if (!child.killed) child.kill("SIGKILL")
}, 1500).unref?.()
}
}
function ffmpegArgs() {
if (process.platform === "win32") {
return ["-f", "dshow", "-i", "audio=default", "-ac", "1", "-ar", "16000", "-f", "s16le", "-acodec", "pcm_s16le", "pipe:1"]
}
if (process.platform === "darwin") {
return ["-f", "avfoundation", "-i", ":0", "-ac", "1", "-ar", "16000", "-f", "s16le", "-acodec", "pcm_s16le", "pipe:1"]
}
return ["-f", "alsa", "-i", "default", "-ac", "1", "-ar", "16000", "-f", "s16le", "-acodec", "pcm_s16le", "pipe:1"]
}
function which(binary: string) {
const extensions = process.platform === "win32" ? [".exe", ".cmd", ".bat", ""] : [""]
const dirs = (process.env.PATH ?? "").split(delimiter)
for (const dir of dirs) {
for (const ext of extensions) {
const candidate = join(dir, binary + ext)
if (existsSync(candidate)) return candidate
}
}
}

View file

@ -0,0 +1,66 @@
import { BrowserWindow, globalShortcut } from "electron"
import type { VoiceConfig } from "./voice-types"
export type VoiceShortcutController = {
register: (hotkey: string) => boolean
unregister: () => void
getHotkey: () => string
}
/**
* Electron globalShortcut only fires on keydown (not keyup), so true hold-to-talk
* is approximated: first press starts recording, second press stops.
* Double-press within 400ms is handled by VoiceManager as an explicit toggle.
*/
export function createVoiceShortcut(input: {
getConfig: () => VoiceConfig
onPress: () => void
}): VoiceShortcutController {
let current = ""
const unregister = () => {
if (!current) return
try {
globalShortcut.unregister(current)
} catch {}
current = ""
}
const register = (hotkey: string) => {
unregister()
if (!hotkey || !input.getConfig().enabled) return false
const accelerator = toAccelerator(hotkey)
const ok = globalShortcut.register(accelerator, () => {
const win = BrowserWindow.getFocusedWindow() ?? BrowserWindow.getAllWindows()[0]
if (win && !win.isDestroyed()) {
if (win.isMinimized()) win.restore()
win.show()
win.focus()
}
input.onPress()
})
if (ok) current = accelerator
return ok
}
return {
register,
unregister,
getHotkey: () => current,
}
}
function toAccelerator(hotkey: string) {
return hotkey
.split("+")
.map((part) => {
const key = part.trim()
if (/^alt$/i.test(key)) return "Alt"
if (/^ctrl|control$/i.test(key)) return "Control"
if (/^shift$/i.test(key)) return "Shift"
if (/^meta|cmd|command|super|win$/i.test(key)) return "Super"
if (/^space$/i.test(key)) return "Space"
return key.length === 1 ? key.toUpperCase() : key
})
.join("+")
}

View file

@ -0,0 +1,218 @@
import { apiKeyEnvName, resolveApiKey, type TranscriptionResult, type VoiceConfig, type VoiceProvider } from "./voice-types"
export type SttProvider = {
readonly provider: VoiceProvider
start(onTranscription: (result: TranscriptionResult) => void, onError: (error: Error) => void): Promise<void>
send(chunk: Buffer): void
stop(): Promise<string | undefined>
}
export function createSttProvider(config: VoiceConfig): SttProvider {
if (config.provider === "deepgram") return createDeepgramProvider(config)
if (config.provider === "groq") return createHttpChunkProvider(config, "groq")
return createHttpChunkProvider(config, "openai-whisper")
}
function requireKey(provider: VoiceProvider) {
const key = resolveApiKey(provider)
if (key) return key
throw new Error(`Missing ${apiKeyEnvName(provider)}. Set it in the environment before using voice input.`)
}
function createDeepgramProvider(config: VoiceConfig): SttProvider {
let socket: WebSocket | undefined
let onTranscription: ((result: TranscriptionResult) => void) | undefined
let onError: ((error: Error) => void) | undefined
let finalText = ""
return {
provider: "deepgram",
async start(nextTranscription, nextError) {
onTranscription = nextTranscription
onError = nextError
finalText = ""
const key = requireKey("deepgram")
const params = new URLSearchParams({
model: "nova-2",
encoding: "linear16",
sample_rate: "16000",
channels: "1",
punctuate: "true",
interim_results: "true",
smart_format: "true",
})
if (config.language && config.language !== "auto") params.set("language", config.language)
const ws = new WebSocket(`wss://api.deepgram.com/v1/listen?${params}`, ["token", key])
socket = ws
await new Promise<void>((resolve, reject) => {
const timer = setTimeout(() => reject(new Error("Deepgram connection timed out")), 10_000)
ws.addEventListener("open", () => {
clearTimeout(timer)
resolve()
})
ws.addEventListener("error", () => {
clearTimeout(timer)
reject(new Error("Deepgram WebSocket failed to connect"))
})
})
ws.addEventListener("message", (event) => {
const payload = typeof event.data === "string" ? event.data : undefined
if (!payload) return
const parsed = JSON.parse(payload) as {
type?: string
channel?: { alternatives?: Array<{ transcript?: string; confidence?: number }> }
is_final?: boolean
}
if (parsed.type && parsed.type !== "Results") return
const alternative = parsed.channel?.alternatives?.[0]
const text = alternative?.transcript?.trim()
if (!text) return
if (parsed.is_final) {
finalText = joinText(finalText, text)
onTranscription?.({ text: finalText, isFinal: true, confidence: alternative?.confidence })
return
}
onTranscription?.({ text: joinText(finalText, text), isFinal: false, confidence: alternative?.confidence })
})
ws.addEventListener("error", () => {
onError?.(new Error("Deepgram WebSocket error"))
})
},
send(chunk) {
if (socket?.readyState !== WebSocket.OPEN) return
socket.send(chunk)
},
async stop() {
const ws = socket
socket = undefined
if (!ws) return finalText || undefined
if (ws.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify({ type: "CloseStream" }))
await new Promise<void>((resolve) => {
const timer = setTimeout(resolve, 1000)
ws.addEventListener("close", () => {
clearTimeout(timer)
resolve()
})
})
}
if (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING) ws.close()
return finalText || undefined
},
}
}
function createHttpChunkProvider(config: VoiceConfig, provider: "groq" | "openai-whisper"): SttProvider {
const chunkDurationMs = provider === "groq" ? (config as VoiceConfig & { chunkDurationMs?: number }).chunkDurationMs ?? 5000 : 10_000
const bytesPerMs = (16000 * 2) / 1000
const chunkBytes = Math.floor(chunkDurationMs * bytesPerMs)
let buffer = Buffer.alloc(0)
let parts: string[] = []
let onTranscription: ((result: TranscriptionResult) => void) | undefined
let onError: ((error: Error) => void) | undefined
let busy = Promise.resolve()
let active = false
const flush = (force = false) => {
if (!active) return
if (!force && buffer.length < chunkBytes) return
if (buffer.length === 0) return
const payload = buffer
buffer = Buffer.alloc(0)
busy = busy
.then(async () => {
const text = await transcribeHttp(provider, payload, config.language)
if (!text) return
parts.push(text)
onTranscription?.({ text: parts.join(" "), isFinal: false })
})
.catch((error) => {
onError?.(error instanceof Error ? error : new Error(String(error)))
})
}
return {
provider,
async start(nextTranscription, nextError) {
requireKey(provider)
onTranscription = nextTranscription
onError = nextError
buffer = Buffer.alloc(0)
parts = []
busy = Promise.resolve()
active = true
},
send(chunk) {
if (!active) return
buffer = Buffer.concat([buffer, chunk])
flush(false)
},
async stop() {
active = false
flush(true)
await busy
const text = parts.join(" ").trim()
if (text) onTranscription?.({ text, isFinal: true })
return text || undefined
},
}
}
async function transcribeHttp(provider: "groq" | "openai-whisper", pcm: Buffer, language: string) {
const key = requireKey(provider)
const wav = pcmToWav(pcm, 16000, 1)
const form = new FormData()
form.append("file", new Blob([new Uint8Array(wav)], { type: "audio/wav" }), "audio.wav")
form.append("model", provider === "groq" ? "whisper-large-v3-turbo" : "whisper-1")
form.append("response_format", "json")
if (language && language !== "auto") form.append("language", language)
const url =
provider === "groq"
? "https://api.groq.com/openai/v1/audio/transcriptions"
: "https://api.openai.com/v1/audio/transcriptions"
const response = await fetch(url, {
method: "POST",
headers: { Authorization: `Bearer ${key}` },
body: form,
})
if (!response.ok) {
const body = await response.text().catch(() => "")
throw new Error(`${provider} transcription failed (${response.status}): ${body || response.statusText}`)
}
const json = (await response.json()) as { text?: string }
return json.text?.trim() ?? ""
}
function pcmToWav(pcm: Buffer, sampleRate: number, channels: number) {
const header = Buffer.alloc(44)
const dataSize = pcm.length
header.write("RIFF", 0)
header.writeUInt32LE(36 + dataSize, 4)
header.write("WAVE", 8)
header.write("fmt ", 12)
header.writeUInt32LE(16, 16)
header.writeUInt16LE(1, 20)
header.writeUInt16LE(channels, 22)
header.writeUInt32LE(sampleRate, 24)
header.writeUInt32LE(sampleRate * channels * 2, 28)
header.writeUInt16LE(channels * 2, 32)
header.writeUInt16LE(16, 34)
header.write("data", 36)
header.writeUInt32LE(dataSize, 40)
return Buffer.concat([header, pcm])
}
function joinText(left: string, right: string) {
if (!left) return right
if (!right) return left
return `${left} ${right}`
}

View file

@ -0,0 +1,44 @@
export type VoiceProvider = "deepgram" | "groq" | "openai-whisper"
export type RecordingState = "idle" | "recording" | "processing"
export type VoiceConfig = {
enabled: boolean
provider: VoiceProvider
language: string
hotkey: string
commands: boolean
autoSend: boolean
}
export type TranscriptionResult = {
text: string
isFinal: boolean
confidence?: number
}
export type VoiceError = {
code: "no-api-key" | "no-microphone" | "no-recorder" | "stt-failed" | "permission-denied" | "unknown"
message: string
}
export const DEFAULT_VOICE_CONFIG: VoiceConfig = {
enabled: true,
provider: "deepgram",
language: "en",
hotkey: "Alt+Space",
commands: true,
autoSend: false,
}
export function resolveApiKey(provider: VoiceProvider): string | undefined {
if (provider === "deepgram") return process.env.DEEPGRAM_API_KEY || process.env.OPENCODE_VOICE_DEEPGRAM_API_KEY
if (provider === "groq") return process.env.GROQ_API_KEY || process.env.OPENCODE_VOICE_GROQ_API_KEY
return process.env.OPENAI_API_KEY || process.env.OPENCODE_VOICE_OPENAI_API_KEY
}
export function apiKeyEnvName(provider: VoiceProvider) {
if (provider === "deepgram") return "DEEPGRAM_API_KEY"
if (provider === "groq") return "GROQ_API_KEY"
return "OPENAI_API_KEY"
}

View file

@ -21,7 +21,14 @@ const rendererProtocol = "oc"
const rendererHost = "renderer"
const clipboardWritePermission = "clipboard-sanitized-write"
const notificationPermission = "notifications"
const rendererPermissions = new Set([clipboardWritePermission, notificationPermission])
const mediaPermission = "media"
const microphonePermission = "microphone"
const rendererPermissions = new Set([
clipboardWritePermission,
notificationPermission,
mediaPermission,
microphonePermission,
])
const oc2Theme = oc2ThemeJson as DesktopTheme
const oc2Background = {
light: resolveThemeVariant(oc2Theme.light, false)["background-base"],

View file

@ -1,5 +1,5 @@
import { contextBridge, ipcRenderer, webUtils } from "electron"
import type { ElectronAPI, WslServersEvent } from "./types"
import type { ElectronAPI, RecordingState, TranscriptionResult, VoiceError, WslServersEvent } from "./types"
import type { UpdaterState } from "@opencode-ai/app/updater"
const updaterCallbacks = new Set<(state: UpdaterState) => void>()
@ -123,6 +123,36 @@ const api: ElectronAPI = {
exportDebugLogs: () => ipcRenderer.invoke("export-debug-logs"),
setForceFocus: (enabled) => ipcRenderer.invoke("set-force-focus", enabled),
recordFatalRendererError: (error) => ipcRenderer.invoke("record-fatal-renderer-error", error),
voice: {
getConfig: () => ipcRenderer.invoke("voice:get-config"),
setConfig: (config) => ipcRenderer.invoke("voice:set-config", config),
start: () => ipcRenderer.invoke("voice:start"),
stop: () => ipcRenderer.invoke("voice:stop"),
toggle: () => ipcRenderer.invoke("voice:toggle"),
getState: () => ipcRenderer.invoke("voice:get-state"),
sendAudioChunk: (chunk) => ipcRenderer.invoke("voice:audio-chunk", chunk),
checkApiKey: (provider) => ipcRenderer.invoke("voice:check-api-key", provider),
onTranscription: (cb) => {
const handler = (_event: Electron.IpcRendererEvent, result: TranscriptionResult) => cb(result)
ipcRenderer.on("voice:transcription", handler)
return () => ipcRenderer.removeListener("voice:transcription", handler)
},
onRecordingState: (cb) => {
const handler = (_event: Electron.IpcRendererEvent, state: RecordingState) => cb(state)
ipcRenderer.on("voice:state-changed", handler)
return () => ipcRenderer.removeListener("voice:state-changed", handler)
},
onError: (cb) => {
const handler = (_event: Electron.IpcRendererEvent, error: VoiceError) => cb(error)
ipcRenderer.on("voice:error", handler)
return () => ipcRenderer.removeListener("voice:error", handler)
},
onCaptureMode: (cb) => {
const handler = (_event: Electron.IpcRendererEvent, mode: "native" | "renderer") => cb(mode)
ipcRenderer.on("voice:capture-mode", handler)
return () => ipcRenderer.removeListener("voice:capture-mode", handler)
},
},
}
contextBridge.exposeInMainWorld("api", api)

View file

@ -41,6 +41,44 @@ export type FatalRendererError = {
os?: string
}
export type VoiceProvider = "deepgram" | "groq" | "openai-whisper"
export type RecordingState = "idle" | "recording" | "processing"
export type VoiceConfig = {
enabled: boolean
provider: VoiceProvider
language: string
hotkey: string
commands: boolean
autoSend: boolean
}
export type VoiceConfigView = VoiceConfig & {
apiKeyConfigured: boolean
apiKeyEnv: string
}
export type TranscriptionResult = {
text: string
isFinal: boolean
confidence?: number
}
export type VoiceError = {
code: "no-api-key" | "no-microphone" | "no-recorder" | "stt-failed" | "permission-denied" | "unknown"
message: string
}
export type VoiceAPI = {
getConfig: () => Promise<VoiceConfigView>
setConfig: (config: Partial<VoiceConfig>) => Promise<VoiceConfigView>
start: () => Promise<RecordingState>
stop: () => Promise<RecordingState>
toggle: () => Promise<RecordingState>
getState: () => Promise<RecordingState>
sendAudioChunk: (chunk: ArrayBuffer) => Promise<void>
checkApiKey: (provider?: VoiceProvider) => Promise<{ provider: VoiceProvider; configured: boolean; env: string }>
onTranscription: (cb: (result: TranscriptionResult) => void) => () => void
onRecordingState: (cb: (state: RecordingState) => void) => () => void
onError: (cb: (error: VoiceError) => void) => () => void
onCaptureMode: (cb: (mode: "native" | "renderer") => void) => () => void
}
export type ElectronAPI = {
killSidecar: () => Promise<void>
installCli: () => Promise<string>
@ -106,4 +144,5 @@ export type ElectronAPI = {
exportDebugLogs: () => Promise<string>
setForceFocus: (enabled: boolean) => Promise<void>
recordFatalRendererError: (error: FatalRendererError) => Promise<void>
voice: VoiceAPI
}

View file

@ -244,6 +244,8 @@ const createPlatform = (windowState: DesktopWindowState): Platform => {
recordFatalRendererError: (error) => window.api.recordFatalRendererError(error),
voice: window.api.voice,
restart: async () => {
await window.api.killSidecar().catch(() => undefined)
window.api.relaunch()

View file

@ -0,0 +1,54 @@
export * as ConfigVoice from "./voice"
import { Option, Schema } from "effect"
export const Provider = Schema.Literals(["deepgram", "groq", "openai-whisper"]).annotate({
description: "Cloud speech-to-text provider used by desktop voice input",
})
export const Info = Schema.Struct({
enabled: Schema.optional(Schema.Boolean).annotate({
description: "Enable microphone voice control in the desktop app",
}),
provider: Schema.optional(Provider),
language: Schema.optional(Schema.String).annotate({
description: "BCP-47 language code passed to the STT provider (for example en)",
}),
hotkey: Schema.optional(Schema.String).annotate({
description: "Global accelerator for push-to-talk / toggle (for example Alt+Space)",
}),
commands: Schema.optional(Schema.Boolean).annotate({
description: "Parse short spoken phrases as voice commands instead of dictation",
}),
autoSend: Schema.optional(Schema.Boolean).annotate({
description: "Automatically submit the prompt after a final transcription",
}),
}).annotate({
identifier: "VoiceConfig",
description: "Desktop microphone voice control settings",
})
export type Info = typeof Info.Type
export type Resolved = Required<Info>
export const defaults = {
enabled: true,
provider: "deepgram",
language: "en",
hotkey: "Alt+Space",
commands: true,
autoSend: false,
} satisfies Resolved
export function normalize(input: unknown): Resolved {
const parsed = Schema.decodeUnknownOption(Info)(input)
if (!Option.isSome(parsed)) return { ...defaults }
return {
enabled: parsed.value.enabled ?? defaults.enabled,
provider: parsed.value.provider ?? defaults.provider,
language: parsed.value.language ?? defaults.language,
hotkey: parsed.value.hotkey ?? defaults.hotkey,
commands: parsed.value.commands ?? defaults.commands,
autoSend: parsed.value.autoSend ?? defaults.autoSend,
}
}

View file

@ -39,6 +39,7 @@ export type PromptInputV2Props = {
borderUnderlay?: boolean
class?: string
modelControl?: JSX.Element
actions?: JSX.Element
attachKeybind?: string[]
attachShortcut?: string
}
@ -244,15 +245,18 @@ export function PromptInputV2(props: PromptInputV2Props) {
)}
</Show>
</div>
<PromptInputV2SubmitButton
mode={state.mode}
stopping={view.submit.stopping()}
disabled={!props.controller.canSubmit()}
sendLabel="Send"
stopLabel="Stop"
onSubmit={props.controller.submit}
onStop={props.controller.stop}
/>
<div class="flex items-center gap-1">
{props.actions}
<PromptInputV2SubmitButton
mode={state.mode}
stopping={view.submit.stopping()}
disabled={!props.controller.canSubmit()}
sendLabel="Send"
stopLabel="Stop"
onSubmit={props.controller.submit}
onStop={props.controller.stop}
/>
</div>
</div>
</form>
</div>

View file

@ -104,6 +104,7 @@ const icons = {
providers: `<path d="M10.0001 4.37562V2.875M13 4.37793V2.87793M7.00014 4.37793V2.875M10 17.1279V15.6279M13 17.1279V15.6279M7 17.1279V15.6279M15.625 13.0029H17.125M15.625 7.00293H17.125M15.625 10.0029H17.125M2.875 10.0029H4.375M2.875 13.0029H4.375M2.875 7.00293H4.375M4.375 4.37793H15.625V15.6279H4.375V4.37793ZM12.6241 10.0022C12.6241 11.4519 11.4488 12.6272 9.99908 12.6272C8.54934 12.6272 7.37408 11.4519 7.37408 10.0022C7.37408 8.55245 8.54934 7.3772 9.99908 7.3772C11.4488 7.3772 12.6241 8.55245 12.6241 10.0022Z" stroke="currentColor" stroke-linecap="square"/>`,
models: `<path fill-rule="evenodd" clip-rule="evenodd" d="M17.5 10C12.2917 10 10 12.2917 10 17.5C10 12.2917 7.70833 10 2.5 10C7.70833 10 10 7.70833 10 2.5C10 7.70833 12.2917 10 17.5 10Z" stroke="currentColor"/>`,
"arrow-undo-down": `<path d="M4.08333 11.0859L1.75 8.7526L4.08333 6.41927M2.33333 8.7526L12.5417 8.7526L12.5417 3.21094L7 3.21094" stroke="currentColor" stroke-width="1" stroke-linecap="square"/>`,
microphone: `<path d="M10 2.91699C8.61929 2.91699 7.5 4.03628 7.5 5.41699V10.0003C7.5 11.381 8.61929 12.5003 10 12.5003C11.3807 12.5003 12.5 11.381 12.5 10.0003V5.41699C12.5 4.03628 11.3807 2.91699 10 2.91699Z" stroke="currentColor"/><path d="M5 9.16699V10.0003C5 12.7617 7.23858 15.0003 10 15.0003C12.7614 15.0003 15 12.7617 15 10.0003V9.16699M10 15.0003V17.0837" stroke="currentColor" stroke-linecap="square"/>`,
}
const spriteID = "opencode-icon-sprite"

View file

@ -149,6 +149,10 @@ const icons = {
viewBox: "0 0 16 16",
body: `<path d="M13.1112 13.5555V14.0555H13.6112V13.5555H13.1112ZM2.889 13.5555H2.389L2.389 14.0555H2.889V13.5555ZM3.38901 5.55546L3.38901 5.05546L2.38901 5.05546L2.38901 5.55546L2.88901 5.55546L3.38901 5.55546ZM14.4446 2.44434H14.9446V1.94434L14.4446 1.94434L14.4446 2.44434ZM14.4446 5.55545L14.4446 6.05545L14.9446 6.05545V5.55545H14.4446ZM1.55566 5.55546L1.05566 5.55545L1.05566 6.05546L1.55566 6.05546L1.55566 5.55546ZM1.5557 2.44436L1.5557 1.94436L1.05571 1.94436L1.0557 2.44435L1.5557 2.44436ZM13.1112 5.55546H12.6112V13.5555H13.1112H13.6112V5.55546H13.1112ZM2.889 13.5555H3.389L3.38901 5.55546L2.88901 5.55546L2.38901 5.55546L2.389 13.5555H2.889ZM14.4446 2.44434H13.9446V5.55545H14.4446H14.9446V2.44434H14.4446ZM1.55566 5.55546L2.05566 5.55547L2.0557 2.44436L1.5557 2.44436L1.0557 2.44435L1.05566 5.55545L1.55566 5.55546ZM6.22234 8.22213V8.72213H9.7779V8.22213V7.72213H6.22234V8.22213ZM13.1112 13.5555V13.0555H2.889V13.5555V14.0555H13.1112V13.5555ZM1.5557 2.44436L1.5557 2.94436L14.4446 2.94434L14.4446 2.44434L14.4446 1.94434L1.5557 1.94436L1.5557 2.44436ZM14.4446 5.55545L14.4446 5.05545L1.55566 5.05546L1.55566 5.55546L1.55566 6.05546L14.4446 6.05545L14.4446 5.55545Z" fill="currentColor"/>`,
},
microphone: {
viewBox: "0 0 16 16",
body: `<path d="M8 2.33337C6.89543 2.33337 6 3.2288 6 4.33337V8.00004C6 9.10461 6.89543 10 8 10C9.10457 10 10 9.10461 10 8.00004V4.33337C10 3.2288 9.10457 2.33337 8 2.33337Z" stroke="currentColor"/><path d="M4 7.33337V8.00004C4 10.2092 5.79086 12 8 12C10.2091 12 12 10.2092 12 8.00004V7.33337M8 12V13.6667" stroke="currentColor" stroke-linecap="square"/>`,
},
}
const spriteID = "opencode-v2-icon-sprite"