Repository navigation
feat(server): an environment speaks with voice models the user downloads - #78
Conversation
A speaking agent needs raw audio and word timings, one sentence at a time. Upstream's local read-aloud (pingdotgg#35910, still open) returns MP3 with no timings, so this adds a fork service on the same runtime, at the same version, URLs, hashes and folders, to be folded into upstream's when it ships. - The speech runtime is executable, so its builds are pinned in code by URL, size and SHA-256. The voice models are data: voices/voices.json in the team catalog repository, decoded strictly. A missing or invalid file means no voices, with the reason shown in Settings. There is no default voice. - A model is one file from a Hugging Face URL pinned to a commit, installed only after its size and SHA-256 match. The runtime archive comes with the first model, is verified the same way, and is checked entry by entry before and after extraction into a staging folder. - Synthesis runs in a child process with a minimal environment, one request at a time, killed when a request is cancelled and unloaded after ten idle minutes. Word timings are estimated from character counts and marked so. - New HTTP group /api/voice-output: reading and speaking need the operate scope, changes need settings write. speak answers with a length-prefixed JSON header followed by 16-bit mono PCM. - Client runtime calls, sentence splitting and word lookup; a Speech output section at the end of Settings -> Voice with download progress, samples and voice choice. The native bindings are written from the runtime's C header and upstream's pull request. No test loads the library: tests use a stand-in module in the worker and a fixture archive. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The voice binding was written from the runtime's header and had never run against the real library. Run in a Linux arm64 container with the pinned runtime build and real models, the service's speak failed for most of them: - The binding only streamed. Models that do not stream were refused at load, and models that return their audio only when the stream finishes gave "produced no audio". speak returns a sentence whole, so the binding now makes one offline run (audiocpp_session_run) and reads the result's audio. Every model checked speaks this way. - The service sent every voice's id as the request option voice_id. A model with one built-in voice declares no such option, and some models refuse an option they do not declare. The voice id now travels beside the request options, and the binding sends it only to a model that declares voice_id. The binding is tested with a stand-in for koffi: the offline call order, the copy of the audio before the result is freed, the voice id rule, the CPU fallback, and the runtime's error text. Backwards compatible: no stored format or wire contract changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
PR SummaryMedium Risk Overview The server exposes a new Settings → Voice gets a Speech output section to download models, pick a voice, and play samples; docs and fork README describe the feature and upstream alignment (pingdotgg#35910). Reviewed by Cursor Bugbot for commit 63d38f8. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b5fd789. Configure here.
…test allows the tracer's names A regular expression for sentence ends backtracked on a long run of marks with no space after it. On Linux the test runner's file tracer re-injects two environment names into every child process, which the worker's minimal-environment test took for a leak. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ads (#78) * feat(server): an environment speaks with voice models the user downloads A speaking agent needs raw audio and word timings, one sentence at a time. Upstream's local read-aloud (pingdotgg#35910, still open) returns MP3 with no timings, so this adds a fork service on the same runtime, at the same version, URLs, hashes and folders, to be folded into upstream's when it ships. - The speech runtime is executable, so its builds are pinned in code by URL, size and SHA-256. The voice models are data: voices/voices.json in the team catalog repository, decoded strictly. A missing or invalid file means no voices, with the reason shown in Settings. There is no default voice. - A model is one file from a Hugging Face URL pinned to a commit, installed only after its size and SHA-256 match. The runtime archive comes with the first model, is verified the same way, and is checked entry by entry before and after extraction into a staging folder. - Synthesis runs in a child process with a minimal environment, one request at a time, killed when a request is cancelled and unloaded after ten idle minutes. Word timings are estimated from character counts and marked so. - New HTTP group /api/voice-output: reading and speaking need the operate scope, changes need settings write. speak answers with a length-prefixed JSON header followed by 16-bit mono PCM. - Client runtime calls, sentence splitting and word lookup; a Speech output section at the end of Settings -> Voice with download progress, samples and voice choice. The native bindings are written from the runtime's C header and upstream's pull request. No test loads the library: tests use a stand-in module in the worker and a fixture archive. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix(server): downloaded voice models speak with one offline run The voice binding was written from the runtime's header and had never run against the real library. Run in a Linux arm64 container with the pinned runtime build and real models, the service's speak failed for most of them: - The binding only streamed. Models that do not stream were refused at load, and models that return their audio only when the stream finishes gave "produced no audio". speak returns a sentence whole, so the binding now makes one offline run (audiocpp_session_run) and reads the result's audio. Every model checked speaks this way. - The service sent every voice's id as the request option voice_id. A model with one built-in voice declares no such option, and some models refuse an option they do not declare. The voice id now travels beside the request options, and the binding sends it only to a model that declares voice_id. The binding is tested with a stand-in for koffi: the offline call order, the copy of the audio before the result is freed, the voice id rule, the CPU fallback, and the runtime's error text. Backwards compatible: no stored format or wire contract changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix(client-runtime): sentences are found in one pass, and the worker test allows the tracer's names A regular expression for sentence ends backtracked on a long run of marks with no space after it. On Linux the test runner's file tracer re-injects two environment names into every child process, which the worker's minimal-environment test took for a leak. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix(web): a voice sample opens its audio inside the click Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>

The app could listen (dictation with a downloaded model) but could not speak. The voice agent layer speaks with the browser's system voice as a stand-in. This adds speech output with downloaded local voice models, working the way dictation's models do.
What it adds
speakanswers with a JSON header followed by the PCM bytes.Where the lists live
SpeechModelStore.ts, so that when upstream ships local synthesis the fork can delete its own runtime code. Upstream's version returns MP3 and no timings; a voice agent needs PCM and timings, which is why the fork has its own service.voices/voices.json, in the team catalog repository, validated strictly: a model is installed only from ahuggingface.coURL pinned to a commit and only after its SHA-256 matches. A missing or invalid file means no voices, with the reason shown.Safety
Nothing spoken leaves the machine: synthesis is local, and the only network traffic is the downloads the user starts. A hash mismatch installs nothing and removes the partial file. Archive entry paths and the extracted tree are checked before use. The library still runs as the user with no sandbox; the minimal environment limits what it is handed, not what it can reach.
Checked
vp run check:changedpasses; unit tests use a stand-in worker.speak, with format, level, length and timing checks passing. That run found two bugs, fixed here: the binding only streamed (three model families deliver audio only whole), and every voice id was sent as an option some models refuse.Known limits
This change only adds; nothing existing changes format.
Claude Fable 5.2, in 1001 Code (Claude Code harness).
🤖 Generated with Claude Code