Repository navigation
feat(voice): dictation and voice mode in the Agent UI and TUI - #6789
kovtcharov wants to merge 54 commits into
Conversation
Adding Kokoro to the talk profile also put it in `gaia init --profile all`, whose model check sent every non-embedding model a chat request, so a clean install reported the voice model as broken. Init now recognises TTS models from the model registry, checks them by synthesizing one word, and labels them "speech" in `gaia init --check --load`. The docs now say to run `gaia download --agent talk` before asking the agent to read aloud, since the tool no longer downloads Kokoro itself.
Replies can now be heard: a speaker button on each Agent UI reply and /read-aloud in the TUI speak them through Lemonade's Kokoro voice, in a voice, speed and auto-read choice both apps share via ~/.gaia/config.json. - Backend: GET/PUT /api/speech/settings and POST /api/speech (WAV), with 503/502/422 that say what failed; read_aloud_voice/speed/auto config keys validated by gaia config. - Agent UI: per-reply button, Settings > Read aloud (voices grouped by accent and gender, Preview, speed, auto-read), markdown stripped and long replies spoken in pieces with the next fetched ahead. - TUI: /read-aloud and /voice, playback through the OS player, voice list embedded and pinned to KOKORO_VOICES by a drift test.
A fetch still running after Speak returned read the package-level folder while a test reset it, which the race detector caught on Linux and macOS CI.
…h tool Merges amd#6204 (the flagship text_to_speech tool) under read-aloud so GAIA has one way to make speech: the same Lemonade client, voice list and speed range, and the voice and speed the user picks for reading aloud. - text_to_speech now defaults to read_aloud_voice and read_aloud_speed from ~/.gaia/config.json when the request names neither. - Its speed bounds come from READ_ALOUD_MIN_SPEED/MAX_SPEED, the range the settings already enforce.
The speed menu's "Normal" carried the bracketed English hint, which an <option> can't style and which scrambles in rtl; option text now uses t.bare. The error detail used dir="auto", which pushed English 210px off the row's edge in Arabic; it is a <bdi> now. The rtl audit gains a rule for <option> text so the first can't come back.
# Conflicts: # hub/agents/gaia/npm/CHANGELOG.md # hub/agents/gaia/python/gaia_agent/chat_agent.py # hub/agents/gaia/python/tests/test_chat_tts_tool.py # src/gaia/audio/lemonade_tts.py
Main's new Settings layout came with fresh reference screenshots that predate this branch's Read aloud section in the sidebar.
# Conflicts: # src/gaia/apps/webui/src/components/ChatView.tsx # src/gaia/apps/webui/src/components/settings/SettingsDialog.css # src/gaia/apps/webui/src/components/settings/SettingsDialog.tsx # src/gaia/apps/webui/visual/__screenshots__/settings-general-dark-win32.png # src/gaia/apps/webui/visual/__screenshots__/settings-general-light-win32.png
# Conflicts: # hub/agents/gaia/npm/CHANGELOG.md
# Conflicts: # src/gaia/apps/webui/src/components/ChatView.tsx
# Conflicts: # hub/agents/gaia/python/tests/test_chat_tts_tool.py
# Conflicts: # src/gaia/apps/webui/src/components/ChatView.tsx
…ntract GAIA could speak replies but not listen. This adds the server half of dictation and voice mode: a session that streams the microphone to Lemonade's realtime recognizer, plays a chime when you stop talking, speaks the text the app hands it clause by clause, and drops queued speech the moment you interrupt. - gaia.voice: realtime listener, clause chunker, <spoken> splitter, PCM and G.711 helpers, the host-agnostic socket protocol. Refuses a remote Lemonade. - Agent UI server: GET /api/voice/status, POST /api/voice/models/download (voice models only), WS /api/voice/session with host, origin and mobile-access token checks. - Voice turns go through the normal chat path with reply_style "voice". The flagship (API 2.28) adds a per-turn note asking for a short <spoken> summary and status lines. An older flagship gets a clear "update GAIA" error. - Validated voice_* config keys.
The Agent UI and TUI each split <spoken> out of the answer stream, so one JSON case file now pins the behaviour all three parsers must match, including the reset when a tool step starts.
…hesis Tested against a real Lemonade 2026.44.1. Its realtime endpoint never loads a model, so the first dictation failed with "No model loaded". The listener now loads the recognizer first, as Lemonade's own example does. Kokoro takes 0.4-0.8 s per clause here, and streaming doesn't help: the first byte arrives only when the clause is done. So the next clause is now synthesized while the current one plays, and a real-time speaker never waits between clauses. Adds an integration test against a real Lemonade, run when GAIA_VOICE_TEST_LEMONADE is set. Kokoro speaks a sentence and the recognizer hears it back, starting from a recognizer that isn't downloaded.
Voice turns had no eval. The Agent UI MCP's send_message takes reply_style, and three scenarios check that a voice turn opens with a short plain spoken summary, narrates tool steps honestly, and says a failure out loud. They run in the gaia-signal lane on the next RC. The flagship's README, SPEC, SKILL, CHANGELOG and OpenAPI artifact now describe reply_style (contract 2.28) and alert_owner.
The TUI could read replies aloud but not listen. Ctrl+R (or /dictate) now
dictates into the composer, and /talk opens a hands-free voice mode with a
shimmering state line, a level meter, captions and the work log. The GAIA
daemon records the microphone and plays speech, so the Go build stays free of
cgo and audio libraries.
- Daemon: /daemon/v1/voice/{status,devices,models/download,session} behind
the client token. Capture pauses while speech plays, since the daemon has
no echo cancellation (amd#3494), and any key interrupts. A missing,
denied or busy mic is a stable error code with a message. Without
`websockets` the routes say so instead of 404ing. The [api] extra gains
websockets and sounddevice.
- TUI: a voice turn goes through the chat's normal query path with
reply_style "voice" (flagship 2.28+, refused before voice mode opens on an
older one). The Go splitter passes the shared spoken-split cases. Spoken
summaries show as a bold lead line in the history. Push-to-talk is Space to
start and Space to send, because terminals don't report key release.
- Adds github.com/coder/websocket (ISC, pure Go).
- Lint fixes in gaia.voice, and the live-Lemonade voice test is allowlisted
for CI lanes with its reason.
The Agent UI could read replies aloud but not listen. A mic button now dictates into the composer, with live partials in the box, and when the box is empty the send button opens voice mode. Voice mode is a hands-free screen with a listening ring and a speaking glow that follow the live audio, a shimmering state word, captions, and a "What GAIA did" work log. Voice turns are ordinary chat messages sent with reply_style "voice", so they are saved, shown and stopped like typed ones. The spoken summary appears as a bold lead line in the history. - Barge-in flushes playback locally first. Permission cards show inside voice mode, and GAIA says it needs your OK. Arabic answers on screen with captions, since speech is English-only for now. - Phone (mobile access): full-screen layout, tap to start audio, wake lock, pause when hidden, iOS play-and-record. - Settings › Voice: listening and voice-mode groups next to read-aloud's speaking controls. - Electron grants the microphone to the app's own page only. The macOS build gets the audio-input entitlement and usage text. - Exports and search snippets show the spoken summary as text, without tags. - Never uses the browser's SpeechRecognition or speechSynthesis; a test fails the build if the source mentions them.
…ession Review fixes. After the 5-minute dictation limit, every mic frame sent another limit event and commit. A TUI voice session whose send queue filled said it was closed but stayed open. The voice routes now use GAIA's logger.
…r name
Told "we're not talking to you", GAIA kept answering the room. She now
stands by and sends nothing until an utterance names her ("Hey GAIA"), and
an "um" followed by nothing is no longer a turn.
… on the voice screen
A conversation in the room was sent to GAIA line by line. In hands-free mode
she now answers when an utterance names her ("Hey GAIA") or within ten
seconds of her last reply. The voice screen gains a microphone mute button and
a menu for volume, voice, speed and the wake word; a new voice or speed is
used from the next reply.
…nd wake word Asked to change her voice she could only make a sample file. A new tool, set_voice_setting, saves one of five voice settings and refuses any other, pointing the user to Settings. Voice mode re-reads the settings when a tool finishes, so the change is heard in the same reply. Volume moves from the browser's storage into the saved voice settings so she can set it too.
…ice, and count the new tool The flagship now registers 106 tools; the manifests, capability matrix, guide and skill playbook say so. The voice eval category added earlier is in the matrix's expected list. Voice tests share one fixture through a conftest.
…picture row The voice screen's tests stubbed the controller without the new mute and volume functions, so every case in the file failed. The volume slider gets its own accessible name.
Whisper wrote the wake phrase as "Hegaya", which the name match missed, so the request was dropped.
…he chime is a setting Speech reaches the browser faster than it plays, so the server thought GAIA had finished while the room still heard her: talking over her started a new turn but her old answer kept playing, and the new one queued behind it. The app now tells the server while playback lasts, and a new request always cuts the end of the last answer. The "heard you" tone is a setting (on by default) that GAIA can change too. Speech ignored while waiting for her name now says so, and the follow-up window is 20 seconds.
…" ends it Follow-ups needed her name again after twenty seconds. The wake word is for when it has been quiet: the window is now a minute after she last spoke, and "GAIA, go to sleep", "good night" or "that's all" sends her back to waiting for her name at once, whether or not the phrase names her.
**This is the design the voice and phone work builds on** (amd#6789, amd#6790). The plans ship no code, and they don't block or change current release work. GAIA can read a reply aloud, but neither the Agent UI nor the TUI can listen. This plan covers two features: - **Dictation:** talk into the composer, and the text lands in the box for you to edit before sending. - **Voice mode:** a hands-free screen of its own. GAIA speaks short answers and keeps the full detail of what it did on screen: tool steps, results and files. It's built to feel instant and to stay 100% on the PC: - small streaming models (Moonshine Streaming for English, Whisper for other languages, Kokoro for speech, the chat model already loaded) - one server-side voice session - spoken status lines the model writes before each tool call - a latency budget of about 1.5 s from the end of speech to GAIA talking Arabic users get dictation, and voice mode answers them on screen until an Arabic voice exists. The plan ends with a six-PR delivery sequence, dictation first. Refs amd#702, amd#372 ## Test plan - [ ] `python util/check_doc_links.py` passes - [ ] The page renders under Roadmap › Agent UI on the Mintlify preview --------- Co-authored-by: Kalin Ovtcharov <[email protected]>
Conflicts: the capability matrix (regenerated: 106 tools) and the tool-request matcher, where main's media matches and the voice-setting match both stay.
… profile tool goldens Three checks failed on this branch against current main: the SDK page did not mention the four voice routes, the committed API schema snapshot lacked the voice models, and the profile goldens did not list set_voice_setting, which every non-chat profile now registers. The goldens' prompts are unchanged; only the tool name is added.
Conflict: the chat view's send. Main made it report whether the message was taken; the voice turn's error signal is kept on each path that now returns false.
|
Merged current main. I marked this ready, then put it back to draft once CI ran: the voice feature fails its own tests there, and that is feature work, not merge work. What still fails in CI
What I did
Three of those need a maintainer's yes, because the checks say so:
Locally on the merged branch: the test plan's Python suites pass, the webui unit suite passes and type-checks, |
|
Verdict: Request changes This PR adds dictation and a hands-free voice mode to the Agent UI and the TUI, running locally through Lemonade. The design is solid: a voice turn is an ordinary chat turn, and the voice socket checks host, origin and the mobile-access token itself. The new dependencies are permissively licensed. Four things should be fixed before merge:
Real-world evidenceN/A: no evidence bundle was produced for this run. The verdict rests on static review alone. The PR description also has no Agent UI screenshots, and no recorded run of the voice socket or the new 🔍 Technical details🟡 Background goal ticks keep a voice turn's reply style ( 🟡 🟡 Non- 🟡 Docs drift: contract version ( 🟡 Real-world evidence missing from the PR description 🟢 Nits
Licences checked: Strengths
|
gaia.voice was missing from setup.py's package list, so an installed (non-editable) GAIA would have had no voice code at all. Also: the doc-profile tool baseline is re-measured for the added set_voice_setting tool (46 tools; the text prompt grows by about 145 tokens), two voice eval scenarios use the corpus's own tier tags, and the TUI's new WebSocket module is recorded as ISC from the licence text it ships.
Every tool the flagship registers needs a label for its activity row; this one had none, which fails the profile check.
|
Verdict: Request changes The new commits fix packaging, the licence check and the tool label, but none of the four 🟡 findings from the last review is fixed yet:
🔍 Technical detailsAll checked against HEAD (
The suggested fixes in the previous review still apply. |
Getting a document as audio used to take two hand-described steps,
produced only WAV (3 minutes is 9 MB), and showed no player once the
file was saved to a folder of your own. Now one sentence does it in the
Agent UI and the TUI: attach or name a PDF, Word, Excel, text or
Markdown file, say "turn this into audio", and GAIA records it, plays it
in the chat, and saves the audio where you asked. It reads the document
as written, or rewrites tables, charts, footnotes and web addresses into
spoken sentences when it has them, says which it chose, and saves that
listening script beside the audio.
What a reviewer should weigh:
- **One tool does the whole job.** `dictate_document` reads the file
itself, so a long document is never shortened by passing through the
model, and a new `dictation` skill tells the agent to call it without
questions.
- **The player works for any save location, with the media boundary
intact.** The recording always stays in GAIA's audio folder and a copy
goes to the user's path; `text_to_speech` now does the same. The only
change to what the Agent UI serves is `.mp3`.
- **MP3 needs nothing new.** It is Lemonade's own encoding of the Kokoro
voice, joined frame by frame: 3 min 16 s is 3.9 MB against about 9 MB as
WAV. A lower bitrate would need ffmpeg and is left out.
- **Long documents show progress and stop cleanly** in both apps. The
TUI's live line now shows a running tool's own progress, which also
benefits other long tools.
- **A rewrite cannot change a number.** Every figure in a listening
script is checked against the document before recording. Gemma 4 E4B
wrote 13,110 for 13,100 on the test report; that is now asked for once
more and, if still wrong, refused with as-written offered instead.
- **Numbers are respelled for the voice.** Transcribing the voice back
showed it misreads decimals ("3.5" as "three. five"), footnote marks,
and abbreviations; those are fixed before recording.
Limits, stated in the guide: English Kokoro voices only (other Lemonade
speech models are not offered, as GAIA has not proven them); charts are
described from the document's text, not the picture; one dictation
covers about two hours of audio, and a longer document is recorded in
page ranges.
Two notes for the reviewer:
- **No eval was run.** This adds a tool, a skill and a tool bundle,
which is LLM-affecting, but another session's eval was running on this
machine, and evals run one at a time. Categories to watch on the next
RC: `tool_selection`, `gaia_tool_selection`, `web_system` (it holds the
`text_to_speech` scenario) and `rag_quality` (the document tools next to
it). The `dictation` skill is listed as deferred in the skill-scenario
coverage test, because the text lanes cannot judge audio.
- **Not the same as the voice-typing "dictation" in #6789.**
That is speech to text in the composer; this is document to audio. This
PR does not need the generated-media read grant from #6494.
## Screenshots
The audio card after a dictation saved to a folder of the user's, from
the `rtl.visual.ts` scene (English, then Arabic). The path stays left to
right inside the Arabic line.


## Test plan
Run against the real apps from an isolated GAIA home, chat model
DeepSeek through Fireworks, voice `kokoro-v1` on Lemonade.
- [x] Agent UI, typed path and a named folder: listening form chosen for
a 2-page report with a table, chart and footnote; player in the chat
(3:27); MP3 and `.script.md` saved in the folder; the reply named the
form and why
- [x] Agent UI, PDF dropped on the composer, "word for word": as-written
MP3 with a player and no permission prompt
- [x] Agent UI, 36-page PDF (20,000 words): refused as too long with a
page range, then recorded in parts; the first part ran 10 minutes as one
tool call and produced 34 min 28 s of audio with progress shown
throughout; Stop during the next part ended the turn and left no partial
file
- [x] TUI: one sentence produced the MP3 and script in the named folder,
progress on the live line, and the audio card with its open and reveal
keys
- [x] Listen-back with Whisper Large v3 Turbo: listening form 95.6% word
match (1 of 62 numbers heard differently, and correct when that sentence
was recorded alone); as-written 90.1% with every number heard; the last
two minutes of the 34-minute file 95.5% against the script's end
- [x] `python -m pytest tests/unit/test_dictation.py
tests/unit/test_lemonade_speech.py
tests/unit/chat/ui/test_generated_media.py
tests/unit/test_chat_tool_requests.py`
- [x] Routing: "Read notes.pdf aloud and save it as report.mp3",
"Narrate chapter1.txt and save as chapter1.wav" and six more variants
offer `dictate_document` first; "Transcribe meeting.mp3", "what does
interview.mp3 say?" and six more that read an existing audio file still
offer `transcribe_media` (`tests/unit/test_chat_tool_requests.py`)
- [x] `python -m pytest tests/unit/test_flagship_tool_labels.py`
(activity label in English and Arabic, live-progress phrase)
- [x] `python -m pytest
hub/agents/gaia/python/tests/test_chat_dictation_tool.py
hub/agents/gaia/python/tests/test_chat_tts_tool.py`
- [x] `cd src/gaia/apps/webui && npm test && npm run test:rtl` (3,449
unit and 456 visual tests pass; a new visual test renders the audio card
with its "Saved to" and "Script saved to" lines in English and Arabic,
and both were read on screen)
- [x] `cd tui && go test ./internal/ui/...`
- [x] `python util/lint.py --tool-descriptions`, black, isort, and
`python util/check_doc_links.py --internal-only`
- [x] Listening rewrite on Gemma 4 E4B (local, GPU): 6 of 7 runs passed
the figure check (one after its retry), 1 was refused for a wrong
figure; a full dictation gave 3 min 33 s of audio in 90 s with 95.1%
listen-back match
- [ ] Not tested: the listening rewrite on Qwen3.6; Linux and macOS; the
packaged desktop app
---------
Co-authored-by: Kalin Ovtcharov <[email protected]>
GAIA could read replies aloud but couldn't listen. Now you can dictate into the composer, or open a hands-free voice mode in both the Agent UI and the TUI. GAIA hears you, works, speaks a short summary, and keeps the full detail on screen. Everything runs locally through Lemonade (Moonshine or Whisper to hear, Kokoro to speak), and voice refuses to start against a remote Lemonade.
Design:
docs/plans/voice.mdx(#6491). Builds on read-aloud (#6489).reply_style: "voice", so it is saved, shown and stopped like a typed one. The flagship (contract 2.28) adds a per-turn note asking for a short, conversational<spoken>summary and status lines before tools. Typed turns and their cached prompt are unchanged.set_voice_setting(voice, speed, volume, captions, chime, wake word; 106 tools now). Anything else she refuses and points to Settings. The voice screen also gets a mute button and a menu for the same settings.Test plan
pytest tests/unit/voice tests/unit/chat/ui/test_voice_router.py tests/unit/chat/ui/test_relayed_reply_style.py tests/unit/test_daemon_voice_routes.py tests/unit/test_chat_tool_requests.py hub/agents/gaia/python/tests/test_server_reply_style.py hub/agents/gaia/python/tests/test_capability_matrix.pyGAIA_VOICE_TEST_LEMONADE=http://127.0.0.1:<port>/api/v1 pytest tests/integration/test_voice_realtime_lemonade.pyagainst a local Lemonadecd src/gaia/apps/webui && npm test && npm run test:rtlcd tui && go test ./.../talk, any key interruptsgaia_voice_mode(gaia-signal lane); the voice-turn note and one new tool changed, so also watchgaia_voice,gaia_honesty,gaia_tool_selection🔍 Technical details
src/gaia/voice/: listener, session, protocol, chunker, spoken splitter, PCM helpers, plusnoise.py(voiced-sound meter, non-speech and looped-transcript checks),turns.py(turn-taking decisions) andsettings.py(the five agent-settable settings).WS /api/voice/sessionand/api/voice/{status,settings,models/download}in the UI server;/daemon/v1/voice/*in the daemon.voice_wake_word(default on) andvoice_volume(default 100), documented indocs/reference/cli.mdx.test_full_tool_bundlestests fail on a machine without thebrowserextra, with or without this change.