feat(conversation): answers wait until the asker is quiet, and going on joins while the answer plays

Live 2026-11-19 (the user's own pieced requests replayed into Discord) the pauses inside
one thought, 2.3-4.7 s, were longer than writing the answer: the answer started in the
pause, and what followed became a new request, so answers were cut off mid-sentence.

- A voice answer is written at once but starts playing only after its asker has been
  quiet for call.answerWaitMs (default 3000, 0 = off, settings "말이 끝나고 답하기 전
  기다림"); while they talk it waits for their final, which joins the request.
- A request stays open (Going on) until its answer ended, not until it is first heard:
  going on within call.continueMs while it plays stops it and answers all of it.

Replayed live: the three pieced requests each get one answer, none cut off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-19 22:10:07 +09:00
parent e716065538
commit 81bd8bd573
9 changed files with 226 additions and 31 deletions

View File

@@ -34,7 +34,8 @@ Settings (`settings.json`, section `call`; wake words stay in `voice.wakeWords`)
| `call.stopWords` | `["멈춰", "그만", "정지", "stop"]` | Said together with a wake word, they stop Jarvis in any policy. |
| `call.earcon` | `true` | Play the earcon (below) when Jarvis takes a voice call. |
| `call.followUpMs` | `1500` | After a wake word said alone, how long the speaker's next utterance may take to start and still be joined to it. 0-5000. |
| `call.continueMs` | `5000` | Going on (below): how long after a request's utterance ended the speaker's next utterance may start and still be part of it, while its answer is not heard yet. 0 turns joining off. 0-15000. |
| `call.continueMs` | `5000` | Going on (below): how long after a request's utterance ended the speaker's next utterance may start and still be part of it, while its answer has not ended. 0 turns joining off. 0-15000. |
| `call.answerWaitMs` | `3000` | Waiting before answering (below): a voice answer starts playing only once its asker has been quiet this long after their request ended. 0: as soon as it is written. 0-10000. |
Normalisation: Unicode NFKD, lower case, and only letters and digits kept (spaces, punctuation and
combining marks dropped). NFKD splits Hangul syllables into their letters, so "자비즈" is one letter
@@ -83,8 +84,9 @@ a message is complete as sent.
seconds between them (live 2026-11-19: 0.1-4.7 s inside one thought), and every pause longer than
the worker's `end_silence_ms` ends an utterance. Each piece used to be answered on its own, one after
another, and the answers piled up (user request, 2026-11-19: what is said in pieces is one request).
So a speaker's voice request stays open until its answer is heard (the first audio of its speech
plays, `SpeakStart`), and while it is open their next final is joined to it when that utterance
So a speaker's voice request stays open until its answer has ended (`SpeakEnd`; also while it
plays, since live 2026-11-19 pauses of 2.3-4.7 s were longer than writing the answer and the answer
started in the pause), and while it is open their next final is joined to it when that utterance
started within `call.continueMs` of the request's end (start = the final's arrival minus its
`wait_ms` and `audio_ms`):
- The earlier request is taken back (the policy's `withdraw`): a running answer is stopped (its
@@ -100,12 +102,21 @@ started within `call.continueMs` of the request's end (start = the final's arriv
transcription), the request is held open for that utterance's final, also if its answer starts
playing or even ends meanwhile; the joined request then stops that answer if it still plays. An
empty final or a stop ends the hold, and nothing is asked again.
- Other speakers' utterances never join it. An answer already heard, an answer that ended, a missed
- Other speakers' utterances never join it. An answer that ended, a missed
request, a stop, leaving and a lost worker end it; then what the speaker says is a new request.
- The joined request gets no second earcon when the first one's already played.
- While a request is open, its speaker's partials are sent to get ready as the joined text, also while
its answer is being written (it is the request that will be answered).
**Waiting before answering.** So that a pause inside one thought does not get an answer, a voice
answer is written at once but starts playing only when its asker has been quiet for
`call.answerWaitMs` after the request ended (default 3 s: 8 of the 10 pauses inside one thought
measured live 2026-11-19 were shorter). While the asker is talking when that time comes, the answer
waits for that utterance's final: it joins the request (Going on, the held answer is cancelled and
the joined one waits again from its own end), or, when it is empty or not joined, the answer plays.
A stop stops it as always. The earcon is not held: it still tells the asker at once that Jarvis
heard them. Answers queued behind a held one wait their turn.
**Earcon.** A short two-tone "띠링" (about 0.3 s, made by the app, `app/src/earcon.rs`) tells the
speaker Jarvis heard the call, long before the answer is written: it is the first sound after a call.
It plays right before each voice answer starts (the policy's `Answer`), and at once when a wake word
@@ -226,12 +237,13 @@ one request, stop all, earcon, prepare, ask "addressed", ask "rank"), so the glu
judgement) closes the utterance, and no answer within 5 s counts as no, also when the answer arrives
after that but before the timer ran.
- Policy actions: `Answer` → the earcon (unless it already played for this request), then
`answer(user, text)` (the brain answers and the answer is spoken; when it
cannot be queued the answer is done at once); `StopAnswer` → `cancel` of that answer's speech;
`answer(user, text, hold)` (the brain answers and the answer is spoken; held, with a non-zero
`call.answerWaitMs`, until `release` when its asker has been quiet for it; when it cannot be
queued the answer is done at once); `StopAnswer` → `cancel` of that answer's speech;
`Rank { id }` → `rank` with id `k<id>` and the candidates' request ids; `Missed` → a debug log and
the missed list (the last 100: speaker, reason, time and length, never the text).
- `SpeakStart` of an answer's speech: the answer is heard, its request is no longer open (Going on),
unless its speaker already started their next utterance (held).
- `SpeakStart` of an answer's speech: the answer is heard (no second earcon when it is joined); its
request stays open until the answer ends (Going on).
- `SpeakEnd` of an answer's speech is that answer's done. The end of a speech the loop already
cancelled starts nothing.
- `Stopped` (all speech stopped from elsewhere: the slash command, `stop()`, the session ending) and
@@ -254,7 +266,9 @@ no and timeout, the earcon before each answer, once for a wake word alone, none
off, partials that read as a call sent to get ready (joined to a waiting wake word, none while
answering someone else, the joined text while going on), going on (pieces joined into one answer in
every policy without a missed record, a piece without a wake word joined, other speakers never, a
new request once the answer is heard or the pause is longer than `call.continueMs`, a stop still
new request once the answer ended or the pause is longer than `call.continueMs`, joined while the
answer plays, answers held until the asker was quiet for `call.answerWaitMs`, longer while they talk
and joined by what they say, released after noise, in every policy, a stop still
stopping, no second earcon, an utterance started before the answer played or before the first final
came still joined, also after a short answer ended, in every policy; an empty final or a stop
after a hold asking nothing again), interruption cancelling the right speech, a ranking deciding, end times from