| name | maintain-voice-input |
| description | Maintain local microphone capture, model preparation/transcription, editable composer insertion, provenance, cancellation, and O/Escape voice shortcuts. Use when changing voice-input UI, ASR adapters, recording timeouts, or local audio boundaries. |
Maintain voice input
Role and boundary
Keep voice input local and batch-oriented: prepare one snapshotted ASR model, capture native audio, transcribe on stop, and insert editable text. Do not auto-submit, send audio through IPC/logs, or let WebView code own microphone/audio-device implementation.
Source map
src/voice.ts: wireVoiceInput, states, preparation-stage/progress filtering, 45 s inactivity timeout, model snapshot, recording/transcribing/cancel flow, transcript insertion, and accessibility labels.
src/voice-draft-provenance.ts: exact transcript/duration tracking and input-event invalidation; src/voice-shortcuts.ts: modified/composing/repeat-safe O/X shortcuts.
src/main.ts: Chat composer wiring and Live shortcut targets; src/live.ts: native Live transcript/provenance path and separate VAD input.
src/settings.ts: closed VoiceInputModelId catalog and persistence;
src-tauri/src/artifact.rs: shared pinned download, integrity, archive, and
verification-marker lifecycle; src-tauri/src/voice/mod.rs, model.rs,
moonshine.rs, recording.rs, and audio.rs: adapter pins/progress/runtime,
15 s microphone start timeout, capture, normalize/downmix/validate/resample,
and transcription.
- Tests:
tests/voice-draft-provenance.test.ts, tests/voice-shortcuts.test.ts, tests/live.test.ts, and settings/model tests.
Cover
- Snapshot the selected Parakeet or Moonshine ID at preparation and retain it through recording and transcription; reject unknown IDs at typed native boundaries.
- Distinguish cached verification, download/extract/load, microphone startup, recording, transcribing, ready, and actionable timeout/error states; never request microphone permission during cache-only warmup.
- Stop recording for local batch transcription, support Escape cancellation, insert at the selection with sensible spacing, and preserve focus. Attach real voice provenance only when the empty draft remains unedited; edited or blended text becomes typed.
- Keep O toggling Chat voice or Live start and X ending active Live scoped by visibility/modifier guards; do not make voice insertion submit automatically.
- Preserve bounded/local audio handling and no cloud transcription. Inspect current source and native event payloads before changing state labels or model routing.
Validate and accept
- Run
bun test tests/voice-draft-provenance.test.ts tests/voice-shortcuts.test.ts tests/live.test.ts tests/settings.test.ts.
- Run
git diff --check against the actual files changed; run just check when the change crosses TypeScript/Rust/build boundaries. Exercise warmup, download/load, timeout, recording, Escape, insertion/edit invalidation, and shortcuts in $test-voice-layer-app.
- Treat real microphone permission, device capture, ASR quality, and human transcript editing as packaged/device acceptance; tests prove state contracts only.
Relationships
Coordinate with $maintain-chat for composer admission, $maintain-live for Live VAD/transcripts, $maintain-settings for model selection, and $maintain-assistant-orchestration for generated turns. $integrate-local-tts is unrelated output work.