feat: answer calls in the voice channel through the response policy
- conversation.rs: the loop between the core's events and the rest. Finals go through call detection and the response policy; answers are asked of the brain and spoken from the app's queue, an interruption cancels only that answer, a voice stop silences everything, and missed requests are kept without text (last 100). Tested with a fake voice side. - Core: answer(user, text) adopts a playback request the worker speaks under the same id, cancel(id) stops one request, ask_addressed and ask_rank pass the conversation's questions; new SpeakingStopped, Addressed and Ranked events. - Worker client: reply, addressed and rank messages and their results; a reply with no answer, refused or not sent ends its speech as failed. - Voice worker: addressed and rank messages on their own threads, beside a running reply; a spoken reply cancelled while the brain is answering is not spoken. judges.py holds the two short LLM judgements with the heard text fenced as data; eval evals/test_voice_judges.py. - Specs (conversation, discord core, voice worker), docs/llm_contexts.md and the roadmap updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,8 +18,8 @@ worker side of the link is `src/voice_worker/voice_worker.spec.md`.
|
||||
- **No text in logs.** Logs carry ids, sizes, counts and timings, never what anyone said or wrote, or
|
||||
what the bot says. Debug logs (`debug_log!`, on with `JARVIS_DEBUG=1`) go at joins and leaves,
|
||||
command use, finals, speech requests and stops, chat events and sends, and worker connection changes.
|
||||
- **Language-agnostic.** Nothing in the core matches words. Wake words are only passed to the STT as a
|
||||
hint until call detection (M4) uses them.
|
||||
- **Language-agnostic.** Nothing in the core matches words. Wake words go to the STT as a hint; call
|
||||
detection (`conversation.spec.md`) is the only place they are matched.
|
||||
- **Testable without Discord.** The pieces with rules (receive window, playback queue, speaker limit,
|
||||
chat access and splitting, settings, worker link, worker process) are plain types tested with fakes;
|
||||
the Discord glue is tested on real Discord by an opt-in live test.
|
||||
@@ -138,17 +138,25 @@ and the late "left" update cancelled the new join (seen on real Discord).
|
||||
- When a person leaves the channel (gateway voice state or songbird's client disconnect), the bot
|
||||
sends `speaker_leave`, so their utterance finishes and the worker frees their place.
|
||||
- **Events** for the layers above: `SpeechStart`, `Partial` and `Final` with the speaker's ID and
|
||||
server display name; `SpeakStart` and `SpeakEnd`; `Joined` and `Left` (with a reason: `command`,
|
||||
`moved`, `disconnected`, `shutdown`).
|
||||
server display name; `SpeakingStopped` with the speaker's ID when their `speaking_end` is sent;
|
||||
`SpeakStart` and `SpeakEnd`; `Joined` and `Left` (with a reason: `command`, `moved`, `disconnected`,
|
||||
`shutdown`); `Addressed` and `Ranked` with the brain's answers to `ask_addressed` and `ask_rank`.
|
||||
- **Speaking**: `say(text, more)` queues a TTS request and returns its id (`None` when not in a voice
|
||||
channel); `continue_text(id, text, more)` adds text to an open request. Each sentence the worker
|
||||
sends becomes one clip (a 48 kHz stereo WAV played through songbird without resampling); clips play
|
||||
in sentence order as soon as they arrive, and requests play first come, first served. A sentence that
|
||||
failed is skipped and the rest still play. `SpeakEnd` reports how many sentences played and whether
|
||||
the request was cancelled or failed.
|
||||
- **Answering** (M4): `answer(user, text)` queues a request like `say` whose speech the worker makes
|
||||
from the brain's answer (`reply` with `speak`, under the request's id) and returns its id. No answer
|
||||
from the brain, a refused `reply` (`brain_unavailable`) or a lost worker ends it as failed.
|
||||
`cancel(id)` stops one request (its clip if playing, the worker's unsent sentences, or the speech of
|
||||
an answer still being written) and the rest of the queue goes on. `ask_addressed(id, user, text)` and
|
||||
`ask_rank(id, candidates)` pass the conversation's questions to the brain.
|
||||
- **Stop** (slash command `stop`, or `stop()`): the current clip stops at the next 20 ms mix, every
|
||||
queued request is dropped, and unfinished requests are cancelled at the worker; each ends with
|
||||
`cancelled: true`. Stopping by voice ("자비스, 멈춰") needs call detection and comes in M4.
|
||||
`cancelled: true`. Stopping by voice ("자비스, 멈춰") is call detection's stop (`conversation.spec.md`),
|
||||
which does the same.
|
||||
- **Leave** (slash command `leave`, or `leave()`): stop speaking, send `speaker_leave` for everyone
|
||||
heard, and disconnect. When songbird's driver gives up the connection (kicked, channel deleted, long
|
||||
network loss) the session ends with `disconnected`. A driver disconnect without a reason is one the
|
||||
|
||||
Reference in New Issue
Block a user