Repository navigation
feat(web): on-device voice input in the composer behind T3CODE_FEATURE_VOICE_INPUT - #1
Draft
stevefarthing-amc wants to merge 2 commits into
Draft
stevefarthing-amc wants to merge 2 commits into
stevefarthing-amc wants to merge 2 commits into
Conversation
…E_VOICE_INPUT Dictation exists on iPhone but not on web or desktop. This adds a mic beside Attach that records, transcribes on the device with Whisper (transformers.js in a worker, WebGPU when available), and inserts the text at the cursor for review. Enter or a second click stops recording; nothing is sent. It reuses the shared VoiceInputController from client-runtime, so the web client only adds a MediaRecorder recorder and a VoiceTranscriber. The model (onnx-community/whisper-base, about 100 MB) downloads on first use and the browser caches it; the ONNX runtime wasm is a lazy asset, so nothing loads until someone presses the mic. The flag is off by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The spinner alone made the one-time model download and transcription easy to miss. A short label now names each state: the one-time download with its percentage, listening with elapsed time and the Enter hint, and transcribing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a mic to the web and desktop composer, behind the
T3CODE_FEATURE_VOICE_INPUTbuild flag. Click it (or press Enter) to stop, and the transcript is inserted at the cursor for review; nothing is sent automatically. Transcription runs on the device with Whisper, so no audio leaves the machine. This is an internal draft on our fork to review before deciding whether to propose it upstream in Ideas discussion #25797.At a glance
VoiceInputControlleronnx-community/whisper-base(about 100 MB) downloads on first use and the browser caches it. The composer shows "Downloading speech model, one time only · N%"Review first
@huggingface/transformers. The worker chunk is 548 KB, and ONNX Runtime's wasm is a 27 MB lazy asset in the web dist, fetched only on first mic use. Node-only deps (onnxruntime-node,sharp) are removed with pnpm overrides plus a manifest patch so they are neither installed nor listed in license notices.VoiceTranscriber(seewhisperTranscriber.ts). Typing while recording discards the transcript with a message, the same rule iPhone uses. Live partial text and post-transcription cleanup are left out.Before proposing upstream
What closed or reworked earlier voice PRs, and how this branch stands:
VoiceInputControllerinstead of duplicating it.classNamerestyles oncomponents/ui, effects carry a reason, no new test files for wiring, heavy code loads only on first use, model and harness named, rebased right before review, "allow maintainer edits" on.docs/user/composer.md.Validation
vp run check:changedat 930be7a: format, lint, knip, typecheck (36 packages), tests, react compiler all pass, rebased on upstream mainT3CODE_FEATURE_VOICE_INPUT=1 vp build(before rebase): passes; transformers.js is absent from the main chunk; license manifest lists onnxruntime and transformers, not sharp or libvipssay-generated clip fed in as the mic: model download 6.5 s, 5 s clip transcribed in 1.1 s, text inserted after existing draft text, Enter stopped instead of sending; download, listening and transcribing labels each shownSecurity & Privacy Impact
PHI risk: Low. Audio is recorded and transcribed entirely in the browser; the recording is a blob URL revoked after transcription or cancel, and only the inserted text joins the draft. The only network traffic is the one-time model download from huggingface.co, which carries no user audio or text.
Written by Claude Opus 5.5 (
claude-opus-5-5) in Claude Code.🤖 Generated with Claude Code