AdPilot · Corpus
T-021 — Voice input: mic button → prompt
T-021 — Voice input: mic button → prompt
Frozen spec for the T-021 build: dictate campaign prompts instead of typing them, with the engine isolated so a server STT can replace Web Speech later.
Decisions
- Scope (Q1): v1 engine = browser Web Speech API only. Nothing in this repo sends audio anywhere; Chrome's own Web Speech implementation may stream to Google — that exception is documented here and in the card result. The mic ships on the console's prompt boxes (Previews headline + body) per the standing web-next adaptation; dictation inserts per mode (append/replace) and stays editable before submit.
- Implementer — seam:
apps/web-next/lib/speech.tsprobes availability onglobalThis(identical towindowin browsers, unit-testable under node), exposescreateWebSpeechDictation(interim → onPartial, final → onFinal, normalised human errors) and aServerSpeechEngineinterface for a future Whisper/OpenAI-compatible STT card. - Implementer — lint-clean component:
VoiceInputavoids render-time ref access and effect-setState (strict react-hooks rules): availability is probed lazily at first interaction, transcription composes via an updater (onChange(prev => insertTranscription(prev, t, mode))).
Surface-area deltas
apps/web-next/lib/speech.ts— the abstraction (probe, controller,insertTranscription,ServerSpeechEngineseam, hints).apps/web-next/lib/speech.test.ts— 11 tests: insertion semantics (append/replace/punctuation/empty), unsupported detection, result routing through a Web-Speech-shaped fake, error normalisation, listening dedupe.apps/web-next/components/VoiceInput.tsx— mic button: aria-label, aria-pressed, keyboard-accessible, disabled-with-tooltip ("Voice input needs Chrome or Safari") where unsupported, live partial text, human error line.apps/web-next/app/previews/page.tsx— mic buttons on the headline/body prompt inputs.- Bookkeeping: this spec
docs/tech-spec/T-021.mdand the board card file (moved totasks/90-doneat close) are bookkeeping.
Verification
Web gates: npm run build (strict), jest (11 new assertions), eslint clean
including the strict react-hooks rules. Manual: dictate in Chrome — text
lands in the field, editable before submit; Safari works; Firefox shows the
disabled state with the tooltip.
Out of scope
Server Whisper/STT (credentials-gated card), push-to-talk PTT keys, mobile app voice (Expo AV), audio storage (never persisted).