mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Let a user explicitly play/stop a delivered agent response from the message action bar, reusing the local Pocket TTS stack while keeping read-aloud fully independent from huddle orchestration. Backend (src-tauri): - New app-scoped message_tts module with its own TtsPipeline instance and fresh active/cancel flags — zero STT/barge-in/huddle-phase coupling. Commands: speak_chat_message / stop_chat_message_speech. - Message-keyed lifecycle (preparing/playing/completed/stopped/ superseded/failed) emitted as message-tts-state-changed events. Generation tokens guarantee stale watcher completions can never overwrite a newer request; one playback app-wide, newer play supersedes older. - Huddle exclusion both ways: speak refuses while huddle phase is not Idle, and start/join_huddle stop any message playback before taking the audio device. - Long-message limit mirrors the huddle cap (2000 chars, char-counted) with a spoken suffix and a truncated flag so the cut is disclosed, not silent. Missing voice model kicks off the download and surfaces a retryable error. No persisted audio cache. Frontend (desktop/src): - MessageTtsProvider (mounted in AppShell inside HuddleProvider) folds backend events through a pure reducer (playbackReducer.mjs) so stale terminal events for superseded messages can't clear newer playback. Errors surface as toasts + per-message state; truncation is disclosed via toast at playback start. - ReadAloudButton in MessageActionBar for delivered agent text only (isAgent, not pending, has body), with aria-label/aria-pressed, tooltip, and disabled-with-reason during active huddles. Tests: 16 Rust unit tests (truncation UTF-8 safety, supersede/stop races, concurrent stops, event payload shape) and 13 node:test reducer tests (out-of-order supersede delivery, detached errors, rapid play/stop). Full suites green: cargo test (1576), pnpm test (3414), typecheck, biome + file-size checks, desktop build. Co-authored-by: Taylor Ho <taylorkmho@gmail.com> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
Buzz
Desktop chat shell with:
- Tauri + React + TypeScript + Vite
- Tailwind CSS
- shadcn/ui-ready shared components
- Biome (lint/format/check)
- Feature-driven frontend structure
Scripts
pnpm dev- run the web frontendpnpm tauri dev- run the desktop apppnpm build- typecheck and build frontendpnpm typecheck- TypeScript checkspnpm lint- Biome lintpnpm format- Biome format (write)pnpm check- Biome check
Structure
src/shared- reusable app-wide code (ui,lib,styles)src/features- feature modules (vertical slices)src/app- top-level app composition