cloudaxe-opencode/CHANGELOGS/2026-07-26-desktop-voice-control.md

65 lines
3.9 KiB
Markdown
Raw Permalink Normal View History

2026-07-30 20:20:14 +00:00
# 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` (`78bf9a35eb50e183128a003ce8ef3a5c8b6bb359`).
- Added remote `cloudaxe``https://repo.cloudaxe.io/CloudAxe/cloudaxe-opencode.git`; left GitHub `origin` unchanged.
- Direct full-history HTTP push hit server `413 Request Entity Too Large`; seeded history via Gitea migrate from `anomalyco/opencode`, then force-with-lease updated `cloudaxe/dev` to the local voice tip.
- Verified `cloudaxe/dev` SHA matches local `dev` (`78bf9a35eb50e183128a003ce8ef3a5c8b6bb359`).