dankvoice: speak long answers as sequential sentence-sized requests

agent_end awaited one whole-answer synthesis; long answers hit the
harness 30s extension-handler timeout (handler timed out after 30000ms)
and the single frank-tts request was the stall. Port the built-in
speak-aloud vocalizer's utterance segmenter (fHe in dist/cli.js) so
segmentation matches the known-working stock path: [.!?…]-run
boundaries, abbreviation/decimal/inline-code guards, fenced code and
tables swallowed, markup cleaned. Play segment N to player exit before
synthesizing N+1 (audio never stacks); fire-and-forget the chain so
utterances outlive the handler timeout; a run token retires superseded
chains. DANKVOICE_MAX becomes a per-answer budget of whole segments;
stripForSpeech is gone. Refs #23 follow-up.
This commit is contained in:
Frank
2026-10-19 01:21:34 -07:00
parent edd7e0cf68
commit bcd52bb0f4
4 changed files with 457 additions and 52 deletions
+31 -4
View File
@@ -189,6 +189,12 @@ if (!say) {
case "truncate":
await say.handler("Sentence one is here. ".repeat(40), ctx);
break;
case "sentences":
await say.handler("First stop here. Second one goes!!! Really? Third ... done", ctx);
break;
case "decimals":
await say.handler("Model 3.5 ships today. Version 1,5 too.", ctx);
break;
case "noplayer":
await say.handler("speak anyway", ctx);
break;
@@ -280,13 +286,34 @@ say_run() {
@test "markdown never reaches the speech engine" {
say_run markdown
[[ "$output" == *"input=Title Use pw-play here. see docs and bold a b"* ]]
[[ "$output" == *"input=Title"* ]]
[[ "$output" == *"input=Use pw-play here."* ]]
[[ "$output" == *"input=see docs and bold"* ]]
[[ "$output" != *"npm i x"* ]]
[[ "$output" != *"example.test"* ]]
}
@test "an over-long utterance is bounded and cut at a sentence boundary" {
@test "the spoken budget keeps only the leading whole segments" {
DANKVOICE_MAX=60 say_run truncate
[[ "$output" == *"here. …"* ]]
[ "$(grep -o 'Sentence one is here\.' <<<"$output" | wc -l)" -le 4 ]
[[ "$output" == *"CALLS 1"* ]]
[[ "$output" == *"PLAYS 1"* ]]
[[ "$output" == *"input=Sentence one is here."* ]]
}
@test "a long answer is spoken as sequential sentence-sized requests" {
say_run sentences
[[ "$output" == *"CALLS 3"* ]]
[[ "$output" == *"PLAYS 3"* ]]
[[ "$output" == *"input=First stop here."* ]]
[[ "$output" == *"input=Second one goes!!! Really?"* ]]
[[ "$output" == *"input=Third ... done"* ]]
}
@test "decimals and comma-decimals never split a sentence" {
say_run decimals
[[ "$output" == *"CALLS 2"* ]]
[[ "$output" == *"input=Model 3.5 ships today."* ]]
[[ "$output" == *"input=Version 1,5 too."* ]]
}
@test "a missing player is reported, not swallowed" {