feat(audio): add opt-in browser dictation
Adds opt-in browser speech-to-text for #3003. With [features.audio] enabled = true and mode = "browser", the microphone uses SpeechRecognition/webkitSpeechRecognition and appends finalized transcripts to the composer. Users can edit the text and submit through the normal message path, retaining selected commands and attachments.
The existing Python audio streaming path remains the default (mode = "realtime"). Browser mode requires no Python audio callbacks. Recognition stops on submit, disables/unmounts safely, handles microphone/start errors, avoids duplicate final results, and shows a disabled microphone when unsupported. The README and generated config explain browser support and possible vendor-hosted recognition.
Validation:
- Frontend unit suite: 42 passed on Node 24, including 10 new recognition lifecycle tests.
- Python configuration suite: 32 passed, including mode defaults, serialization, and validation.
- Frontend, react-client, and copilot production builds passed.
- Commit hooks passed: ESLint, Prettier, Ruff, full backend mypy, and frontend/react-client TypeScript checks. Copilot type checking is disabled by the repository's existing configuration.
- Browser recognition events were mocked in tests. Physical microphone transcription and the full Cypress suite were not run.
Fixes #3003
AI assistance: implemented and tested with Codex at the contributor's request, credited in the commit as required by AGENTS.md.
Summary by cubic
Fixes #3003 by adding opt-in browser dictation. With features.audio.mode = "browser", the composer microphone uses the Web Speech API and appends finalized transcripts for editing and normal submission; mode = "realtime" with Python audio callbacks remains the default.
- Recognition appends each final result once, ignores interim results, and aborts cleanly on submit, disable, or unmount.
- The microphone is disabled when the browser lacks
SpeechRecognitionorwebkitSpeechRecognition. - Browser mode may send audio to a vendor-hosted service, so it does not guarantee offline processing.
- Adds config validation, UI translations, and tests for recognition lifecycle and audio mode defaults.