Repository navigation
Add managed local Kokoro voice output with offline playback and interruption #24
Description
Outcome
Add managed, CPU-capable Kokoro local speech output to Agentflow. Input and output can run offline while native-agent reasoning remains independently configured. Work on feat/local-kokoro, a worktree created from current main.
Acceptance criteria
- AC1: Pin Kokoro ONNX runtime/model/voices and document licenses, supported installation and verified checksums. Explicit setup downloads assets; synthesis works with external networking blocked.
- AC2: Select Local Kokoro for TTS only, with voice and saved playback speed. No cloud key lookup or fallback; STT settings and native session identity remain unchanged. Validate loopback endpoint and reject redirects/proxy routing.
- AC3: Managed setup/start/status/stop reports missing/corrupt models and startup failures clearly, preserves unrelated processes, and supports recovery. No microphone or model download starts implicitly.
- AC4: Browser synthesis/preview and CLI/MCP speak use local audio; sentence playback remains ordered. Long replies begin at sentence boundaries instead of waiting for the whole answer.
- AC5: Interrupt aborts requests and queued/late audio cannot resume; verify playback stop within 250 ms on the reference Mac in an automated playback test. Retry speech without another native-agent turn.
- AC6: Deterministic tests cover invalid voice/model, empty/oversized input, timeout, cancellation, unavailable engine and malformed/oversized audio. Relevant full Node, browser and lifecycle suites pass.
- AC7: Run real-engine offline synthesis on the reference Mac; record runtime/model versions, cold/warm latency, audio validity and memory. Target warm first-sentence synthesis <=2 seconds; report measured results and limitations honestly, including physical audible-device checks.
- AC8: Documentation and QA evidence map to each criterion; reviewed PR passes CI, merges to main, and task worktree/branch are cleaned up.
Test-driven workflow
For each behavior, first write and run a focused failing test and record the actual missing-behavior failure. Implement minimally, rerun the focused test, then refactor while green. Use synthetic text/audio and disposable state, never personal agent sessions. Contract tests inspect requests and failures; integration tests exercise lifecycle and real local HTTP; browser tests cover selection, playback and cancellation. Real-model QA supplements mocks.
Delivery evidence
Record red/green commands, all verification results, hardware and measurements in the PR and repository validation docs. Do not check off unverified criteria. No custom voice cloning or local agent reasoning is included.
Completed
Merged PR #26 as 031fbd5152ff698991c39d969c0ea4f018293156. Both GitHub CI checks passed for the final source tree; main was verified identical to that tested tree. Independent implementation review completed; asynchronous CodeRabbit review was still pending at merge and is not claimed as passed.
65 Node tests,19 browser tests,15 Kokoro lifecycle/bounds tests and9 Whisper lifecycle regressions passed. Real engine and application synthesis, CLI and MCP native playback passed with external networking blocked. Warm synthesis1.714–1.741s for5.735s audio; about754MiB RSS; browser interruption1.3–2.8ms. Human speaker-quality/microphone/echo/sleep-wake checks are not claimed; general device QA remains #23.
Acceptance and red/green evidence · Setup, licenses and reproducible offline QA
Task worktree and local/remote feature branch removed. Temporary QA engine was stopped through its ownership protocol and temporary downloaded models/runtime were removed. Installed user application settings were not changed.
Activity
[-]Follow-up: local speech output with ordered playback and interruption[/-][+]Add managed local Kokoro voice output with offline playback and interruption[/+]