HEL-879 unified integration review: actual fc905fe worker frames (generated on the .12 real SDK, read-only SSH stdin) fed through the preserved HEL-898 frontend - fixtures + 9 vitest cases pass (incremental->final->record takeover, phi/no-receipt/interrupt/proactive-during-playout lifecycles, user-interim/hush/drop-reopen boundaries, replay/late/out-of-order frames all dropped); seq namespace analysis (job=room=dispatch=controller call, one entrypoint per job, reconnect keeps the bus, single dispatch site per fresh room - no same-room second-job reset path; residual gap: agent-left zombie UI, for the author); DOCUMENTED GAP: closed-64 squeeze lets a duplicate high-seq turn_start re-enter a retired speech (not producible by the current worker; unbounded-Set fix suggested for the author); browser layer NOT independently re-run (no GUI system libs locally, zero-install policy) - hel879_unified_shots.mjs harness committed for Edge replay, author's 61/61 + theme screenshots remain the interface evidence; regression pytest 352/352, vitest 108/108, typecheck/build/lint(0 err/1 known warning)/ruff clean, requirements checks 4/4 (origin/main and fc905fe, with/without updated handoff-HEL-879); R5 real-test package prepared for the main card (r5-test-package.md) with zero execution; mock &turn/&id params are additive test-infra extensions, default semantics unchanged
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
multica-agent
parent
fb7ea846ff
commit
f92a86f5d8
+149
@@ -0,0 +1,149 @@
|
||||
{"v": 2, "seq": 1, "kind": "interim", "role": "user", "text": "上次说的那只猫"}
|
||||
{"v": 2, "seq": 2, "kind": "user_final", "role": "user", "text": "上次说的那只猫你见到了吗"}
|
||||
{"v": 2, "seq": 3, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_A"}
|
||||
{"v": 2, "seq": 4, "kind": "assistant_interim", "role": "assistant", "text": "见到了,它还在桥下", "speech_id": "speech_A"}
|
||||
{"v": 2, "seq": 5, "kind": "assistant_interim", "role": "assistant", "text": "见到了,它还在桥下晒太阳。", "speech_id": "speech_A"}
|
||||
{"v": 2, "seq": 6, "kind": "assistant_final", "role": "assistant", "text": "见到了,它还在桥下晒太阳。", "speech_id": "speech_A", "turn_id": "gate-turn-1"}
|
||||
{"v": 2, "seq": 7, "kind": "turn_end", "role": "assistant", "text": "", "speech_id": "speech_A", "turn_id": "gate-turn-1"}
|
||||
{"v": 2, "seq": 4, "kind": "assistant_interim", "role": "assistant", "text": "见到了,它还在桥下", "speech_id": "speech_A"}
|
||||
{"v": 2, "seq": 5, "kind": "assistant_interim", "role": "assistant", "text": "见到了,它还在桥下晒太阳。", "speech_id": "speech_A"}
|
||||
{"v": 2, "seq": 8, "kind": "assistant_final", "role": "assistant", "text": "迟到的旧稿", "speech_id": "speech_A", "turn_id": "late"}
|
||||
{"v": 2, "seq": 9, "kind": "interim", "role": "user", "text": "再说点别的"}
|
||||
{"v": 2, "seq": 8, "kind": "interim", "role": "user", "text": "乱序旧帧"}
|
||||
{"v": 2, "seq": 10, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_A"}
|
||||
{"v": 2, "seq": 11, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s00"}
|
||||
{"v": 2, "seq": 12, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s00", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 13, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s01"}
|
||||
{"v": 2, "seq": 14, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s01", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 15, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s02"}
|
||||
{"v": 2, "seq": 16, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s02", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 17, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s03"}
|
||||
{"v": 2, "seq": 18, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s03", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 19, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s04"}
|
||||
{"v": 2, "seq": 20, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s04", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 21, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s05"}
|
||||
{"v": 2, "seq": 22, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s05", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 23, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s06"}
|
||||
{"v": 2, "seq": 24, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s06", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 25, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s07"}
|
||||
{"v": 2, "seq": 26, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s07", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 27, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s08"}
|
||||
{"v": 2, "seq": 28, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s08", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 29, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s09"}
|
||||
{"v": 2, "seq": 30, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s09", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 31, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s10"}
|
||||
{"v": 2, "seq": 32, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s10", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 33, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s11"}
|
||||
{"v": 2, "seq": 34, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s11", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 35, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s12"}
|
||||
{"v": 2, "seq": 36, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s12", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 37, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s13"}
|
||||
{"v": 2, "seq": 38, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s13", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 39, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s14"}
|
||||
{"v": 2, "seq": 40, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s14", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 41, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s15"}
|
||||
{"v": 2, "seq": 42, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s15", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 43, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s16"}
|
||||
{"v": 2, "seq": 44, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s16", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 45, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s17"}
|
||||
{"v": 2, "seq": 46, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s17", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 47, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s18"}
|
||||
{"v": 2, "seq": 48, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s18", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 49, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s19"}
|
||||
{"v": 2, "seq": 50, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s19", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 51, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s20"}
|
||||
{"v": 2, "seq": 52, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s20", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 53, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s21"}
|
||||
{"v": 2, "seq": 54, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s21", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 55, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s22"}
|
||||
{"v": 2, "seq": 56, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s22", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 57, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s23"}
|
||||
{"v": 2, "seq": 58, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s23", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 59, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s24"}
|
||||
{"v": 2, "seq": 60, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s24", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 61, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s25"}
|
||||
{"v": 2, "seq": 62, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s25", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 63, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s26"}
|
||||
{"v": 2, "seq": 64, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s26", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 65, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s27"}
|
||||
{"v": 2, "seq": 66, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s27", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 67, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s28"}
|
||||
{"v": 2, "seq": 68, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s28", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 69, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s29"}
|
||||
{"v": 2, "seq": 70, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s29", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 71, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s30"}
|
||||
{"v": 2, "seq": 72, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s30", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 73, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s31"}
|
||||
{"v": 2, "seq": 74, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s31", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 75, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s32"}
|
||||
{"v": 2, "seq": 76, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s32", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 77, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s33"}
|
||||
{"v": 2, "seq": 78, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s33", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 79, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s34"}
|
||||
{"v": 2, "seq": 80, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s34", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 81, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s35"}
|
||||
{"v": 2, "seq": 82, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s35", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 83, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s36"}
|
||||
{"v": 2, "seq": 84, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s36", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 85, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s37"}
|
||||
{"v": 2, "seq": 86, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s37", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 87, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s38"}
|
||||
{"v": 2, "seq": 88, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s38", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 89, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s39"}
|
||||
{"v": 2, "seq": 90, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s39", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 91, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s40"}
|
||||
{"v": 2, "seq": 92, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s40", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 93, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s41"}
|
||||
{"v": 2, "seq": 94, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s41", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 95, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s42"}
|
||||
{"v": 2, "seq": 96, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s42", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 97, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s43"}
|
||||
{"v": 2, "seq": 98, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s43", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 99, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s44"}
|
||||
{"v": 2, "seq": 100, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s44", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 101, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s45"}
|
||||
{"v": 2, "seq": 102, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s45", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 103, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s46"}
|
||||
{"v": 2, "seq": 104, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s46", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 105, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s47"}
|
||||
{"v": 2, "seq": 106, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s47", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 107, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s48"}
|
||||
{"v": 2, "seq": 108, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s48", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 109, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s49"}
|
||||
{"v": 2, "seq": 110, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s49", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 111, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s50"}
|
||||
{"v": 2, "seq": 112, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s50", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 113, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s51"}
|
||||
{"v": 2, "seq": 114, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s51", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 115, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s52"}
|
||||
{"v": 2, "seq": 116, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s52", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 117, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s53"}
|
||||
{"v": 2, "seq": 118, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s53", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 119, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s54"}
|
||||
{"v": 2, "seq": 120, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s54", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 121, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s55"}
|
||||
{"v": 2, "seq": 122, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s55", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 123, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s56"}
|
||||
{"v": 2, "seq": 124, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s56", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 125, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s57"}
|
||||
{"v": 2, "seq": 126, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s57", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 127, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s58"}
|
||||
{"v": 2, "seq": 128, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s58", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 129, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s59"}
|
||||
{"v": 2, "seq": 130, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s59", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 131, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s60"}
|
||||
{"v": 2, "seq": 132, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s60", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 133, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s61"}
|
||||
{"v": 2, "seq": 134, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s61", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 135, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s62"}
|
||||
{"v": 2, "seq": 136, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s62", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 137, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s63"}
|
||||
{"v": 2, "seq": 138, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s63", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 139, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s64"}
|
||||
{"v": 2, "seq": 140, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s64", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 141, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_s65"}
|
||||
{"v": 2, "seq": 142, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_s65", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 143, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_A"}
|
||||
{"v": 2, "seq": 144, "kind": "assistant_interim", "role": "assistant", "text": "被挤出后的重放增量", "speech_id": "speech_A"}
|
||||
{"v": 2, "seq": 145, "kind": "assistant_final", "role": "assistant", "text": "被挤出后的重放终稿", "speech_id": "speech_A", "turn_id": "gate-turn-1"}
|
||||
{"v": 2, "seq": 146, "kind": "turn_end", "role": "assistant", "text": "", "speech_id": "speech_A", "turn_id": "gate-turn-1"}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"sdk": {
|
||||
"livekit_agents": "1.8.8",
|
||||
"livekit_api": "1.2.1"
|
||||
},
|
||||
"source": "actual fc905fe+fb7ea84 worker driven on .12 real SDK (livekit-agents 1.8.8, livekit-api 1.2.1) via SSH stdin, zero network/writes",
|
||||
"scenarios": {
|
||||
"normal": {
|
||||
"kinds": [
|
||||
"interim",
|
||||
"user_final",
|
||||
"turn_start",
|
||||
"assistant_interim",
|
||||
"assistant_interim",
|
||||
"assistant_interim",
|
||||
"assistant_final",
|
||||
"turn_end"
|
||||
],
|
||||
"frames": 8,
|
||||
"acks": [
|
||||
"382c41d9-0d72-433e-b370-f838fa5d0bd0"
|
||||
],
|
||||
"turn_id": "382c41d9-0d72-433e-b370-f838fa5d0bd0"
|
||||
},
|
||||
"interrupt": {
|
||||
"kinds": [
|
||||
"user_final",
|
||||
"turn_start",
|
||||
"assistant_interim",
|
||||
"assistant_interim",
|
||||
"turn_cancel",
|
||||
"user_final",
|
||||
"turn_start",
|
||||
"assistant_interim",
|
||||
"assistant_interim",
|
||||
"assistant_final",
|
||||
"turn_end"
|
||||
],
|
||||
"frames": 11,
|
||||
"acks": [
|
||||
"edbcb837-f19f-47e7-8d5c-057010da43eb"
|
||||
],
|
||||
"turn_ids": {
|
||||
"cut": "09d05c0f-3058-4ff8-a56e-4e94bd17d7b7",
|
||||
"next": "edbcb837-f19f-47e7-8d5c-057010da43eb"
|
||||
}
|
||||
},
|
||||
"phi": {
|
||||
"kinds": [
|
||||
"user_final",
|
||||
"turn_start",
|
||||
"assistant_interim",
|
||||
"assistant_interim",
|
||||
"assistant_interim",
|
||||
"error",
|
||||
"turn_cancel"
|
||||
],
|
||||
"frames": 7,
|
||||
"acks": [],
|
||||
"turn_id": "31e70e52-1471-4e50-ac49-cce89979a9bf"
|
||||
},
|
||||
"no_receipt": {
|
||||
"kinds": [
|
||||
"user_final",
|
||||
"turn_start",
|
||||
"assistant_interim",
|
||||
"assistant_interim",
|
||||
"turn_cancel"
|
||||
],
|
||||
"frames": 5,
|
||||
"acks": [],
|
||||
"turn_id": "36d160e3-e365-46ff-ad57-c2878c00720f"
|
||||
},
|
||||
"proactive": {
|
||||
"kinds": [
|
||||
"proactive_start",
|
||||
"proactive_end",
|
||||
"proactive_start",
|
||||
"proactive_cancel"
|
||||
],
|
||||
"frames": 4,
|
||||
"start_while_playing": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{"v": 2, "seq": 1, "kind": "user_final", "role": "user", "text": "讲讲你下午做了什么"}
|
||||
{"v": 2, "seq": 2, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_dd1c4c382512"}
|
||||
{"v": 2, "seq": 3, "kind": "assistant_interim", "role": "assistant", "text": "我下午去了河边,", "speech_id": "speech_dd1c4c382512"}
|
||||
{"v": 2, "seq": 4, "kind": "assistant_interim", "role": "assistant", "text": "我下午去了河边,看到一群白鹭从水面上飞过去了,", "speech_id": "speech_dd1c4c382512"}
|
||||
{"v": 2, "seq": 5, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_dd1c4c382512", "reason": "interrupted"}
|
||||
{"v": 2, "seq": 6, "kind": "user_final", "role": "user", "text": "那后来呢"}
|
||||
{"v": 2, "seq": 7, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_55ef57a410cf"}
|
||||
{"v": 2, "seq": 8, "kind": "assistant_interim", "role": "assistant", "text": "后来我在桥上站了一会儿,", "speech_id": "speech_55ef57a410cf"}
|
||||
{"v": 2, "seq": 9, "kind": "assistant_interim", "role": "assistant", "text": "后来我在桥上站了一会儿,风把水面吹皱了。", "speech_id": "speech_55ef57a410cf"}
|
||||
{"v": 2, "seq": 10, "kind": "assistant_final", "role": "assistant", "text": "后来我在桥上站了一会儿,风把水面吹皱了。", "speech_id": "speech_55ef57a410cf", "turn_id": "edbcb837-f19f-47e7-8d5c-057010da43eb"}
|
||||
{"v": 2, "seq": 11, "kind": "turn_end", "role": "assistant", "text": "", "speech_id": "speech_55ef57a410cf", "turn_id": "edbcb837-f19f-47e7-8d5c-057010da43eb"}
|
||||
@@ -0,0 +1,5 @@
|
||||
{"v": 2, "seq": 1, "kind": "user_final", "role": "user", "text": "再讲讲那座桥"}
|
||||
{"v": 2, "seq": 2, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_20d31bfb084a"}
|
||||
{"v": 2, "seq": 3, "kind": "assistant_interim", "role": "assistant", "text": "那座桥是石头砌的,", "speech_id": "speech_20d31bfb084a"}
|
||||
{"v": 2, "seq": 4, "kind": "assistant_interim", "role": "assistant", "text": "那座桥是石头砌的,下雨的时候水声很好听。", "speech_id": "speech_20d31bfb084a"}
|
||||
{"v": 2, "seq": 5, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_20d31bfb084a", "reason": "no-receipt"}
|
||||
@@ -0,0 +1,8 @@
|
||||
{"v": 2, "seq": 1, "kind": "interim", "role": "user", "text": "你在听"}
|
||||
{"v": 2, "seq": 2, "kind": "user_final", "role": "user", "text": "你在听吗"}
|
||||
{"v": 2, "seq": 3, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_17d892eb3dc3"}
|
||||
{"v": 2, "seq": 4, "kind": "assistant_interim", "role": "assistant", "text": "在听呢,", "speech_id": "speech_17d892eb3dc3"}
|
||||
{"v": 2, "seq": 5, "kind": "assistant_interim", "role": "assistant", "text": "在听呢,你刚才说到一半的那件事", "speech_id": "speech_17d892eb3dc3"}
|
||||
{"v": 2, "seq": 6, "kind": "assistant_interim", "role": "assistant", "text": "在听呢,你刚才说到一半的那件事我还在想。", "speech_id": "speech_17d892eb3dc3"}
|
||||
{"v": 2, "seq": 7, "kind": "assistant_final", "role": "assistant", "text": "在听呢,你刚才说到一半的那件事我还在想。", "speech_id": "speech_17d892eb3dc3", "turn_id": "382c41d9-0d72-433e-b370-f838fa5d0bd0"}
|
||||
{"v": 2, "seq": 8, "kind": "turn_end", "role": "assistant", "text": "", "speech_id": "speech_17d892eb3dc3", "turn_id": "382c41d9-0d72-433e-b370-f838fa5d0bd0"}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{"v": 2, "seq": 1, "kind": "user_final", "role": "user", "text": "说说那件事吧"}
|
||||
{"v": 2, "seq": 2, "kind": "turn_start", "role": "assistant", "text": "", "speech_id": "speech_7a5630ba8cc7"}
|
||||
{"v": 2, "seq": 3, "kind": "assistant_interim", "role": "assistant", "text": "(她顿了一下)", "speech_id": "speech_7a5630ba8cc7"}
|
||||
{"v": 2, "seq": 4, "kind": "assistant_interim", "role": "assistant", "text": "(她顿了一下)这会儿我有点说不出来话……", "speech_id": "speech_7a5630ba8cc7"}
|
||||
{"v": 2, "seq": 5, "kind": "assistant_interim", "role": "assistant", "text": "(她顿了一下)这会儿我有点说不出来话……(她顿了一下)这会儿我有点说不出来话……", "speech_id": "speech_7a5630ba8cc7"}
|
||||
{"v": 2, "seq": 6, "kind": "error", "role": "assistant", "text": "(她顿了一下)这会儿我有点说不出来话……", "speech_id": "speech_7a5630ba8cc7"}
|
||||
{"v": 2, "seq": 7, "kind": "turn_cancel", "role": "assistant", "text": "", "speech_id": "speech_7a5630ba8cc7", "reason": "error_phi"}
|
||||
@@ -0,0 +1,4 @@
|
||||
{"v": 2, "seq": 1, "kind": "proactive_start", "role": "assistant", "text": "刚才路过花店,想起你说过喜欢白色的洋桔梗。", "speech_id": "speech_172abc64e23c", "message_id": 301}
|
||||
{"v": 2, "seq": 2, "kind": "proactive_end", "role": "assistant", "text": "", "speech_id": "speech_172abc64e23c", "message_id": 301}
|
||||
{"v": 2, "seq": 3, "kind": "proactive_start", "role": "assistant", "text": "晚上风大,窗台的那盆薄荷记得搬进来。", "speech_id": "speech_835f928b989d", "message_id": 302}
|
||||
{"v": 2, "seq": 4, "kind": "proactive_cancel", "role": "assistant", "text": "", "speech_id": "speech_835f928b989d", "message_id": 302, "reason": "interrupted"}
|
||||
@@ -34,15 +34,26 @@ createServer(async (req, res) => {
|
||||
if (p === '/__voice') { voice = { configured: url.searchParams.get('configured') !== '0', tts: url.searchParams.get('tts') !== '0' }; return send(res, 200, voice); }
|
||||
if (p.startsWith('/__refuse/')) { refuse = Number(p.slice(10)); return send(res, 200, { refuse }); }
|
||||
// What the worker's /api/chat call leaves in the record, one stage at a time (the browser never posts it).
|
||||
// `&turn=` (HEL-879 unified review) lets a recorded worker fixture drive rows under its own
|
||||
// turn id (the real worker's turn ids are uuids, not voice-N); without it behavior is unchanged.
|
||||
if (p === '/__voice-turn') {
|
||||
const stage = url.searchParams.get('stage'), text = url.searchParams.get('text') || '';
|
||||
if (stage === 'user') { voiceTurn++; add({ role: 'user', text, turn_id: `voice-${voiceTurn}`, status: 'pending' }); }
|
||||
if (stage === 'reply') { add({ role: 'companion', text, turn_id: `voice-${voiceTurn}` }); rows.forEach(r => { if (r.turn_id === `voice-${voiceTurn}`) r.status = 'sent'; }); }
|
||||
if (stage === 'cancel') rows.forEach(r => { if (r.turn_id === `voice-${voiceTurn}`) r.status = 'cancelled'; });
|
||||
return send(res, 200, { turn: voiceTurn });
|
||||
if (stage === 'user' && !url.searchParams.has('turn')) voiceTurn++; // default path: same counter semantics as before
|
||||
const key = url.searchParams.get('turn') || `voice-${voiceTurn}`;
|
||||
if (stage === 'user') add({ role: 'user', text, turn_id: key, status: 'pending' });
|
||||
if (stage === 'reply') { add({ role: 'companion', text, turn_id: key }); rows.forEach(r => { if (r.turn_id === key) r.status = 'sent'; }); }
|
||||
if (stage === 'cancel') rows.forEach(r => { if (r.turn_id === key) r.status = 'cancelled'; });
|
||||
return send(res, 200, { turn: key });
|
||||
}
|
||||
// A reach-out the life runtime stored (HEL-898): the worker may read it aloud; the page sees it through the inbox.
|
||||
if (p === '/__proactive') { const id = add({ role: 'companion', text: url.searchParams.get('text') || '', turn_id: `pro-${rows.length + 1}`, proactive: true }); return send(res, 200, { id }); }
|
||||
// `&id=` (HEL-879 unified review) pins the stored row id a fixture's proactive frames carry; without it
|
||||
// behavior is unchanged.
|
||||
if (p === '/__proactive') {
|
||||
const text = url.searchParams.get('text') || '', want = Number(url.searchParams.get('id') || 0);
|
||||
const id = want || add({ role: 'companion', text, turn_id: `pro-${rows.length + 1}`, proactive: true });
|
||||
if (want && !rows.some(r => r.id === want)) rows.push({ id: want, ts: T0 + want * 60e3 + 1, status: 'sent', lifeIds: [], role: 'companion', text, turn_id: `pro-${want}`, proactive: true });
|
||||
return send(res, 200, { id });
|
||||
}
|
||||
// A voice turn took the server's turn gate: the text stream in flight ends without a final; its row is cancelled.
|
||||
if (p === '/__cut') { const s = textStream; textStream = null; if (s) { rows.forEach(r => { if (r.turn_id === s.turn_id && r.role === 'user') r.status = 'cancelled'; }); s.cut = true; s.res.end(); } return send(res, 200, { cut: !!s }); }
|
||||
if (p === '/__real-sdk.js') return send(res, 200, await readFile(join(dist, 'vendor/livekit-client-2.22.4.umd.min.js')), 'text/javascript');
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
import { describe, expect, it, vi, afterEach } from 'vitest';
|
||||
import { mergeTurns, VoiceController, voiceLine, WORDS, type MicTrack, type RoomEvents, type VoiceRoom, type VoiceView } from '../src/voice/session';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
// HEL-879 unified review: the frames here are the ACTUAL worker output, generated by
|
||||
// scripts/gen_hel879_unified_frames.py driving the fc905fe worker wiring (make_voice_llm +
|
||||
// bind_voice_session + speak_proactive_row) on the .12 real SDK (livekit-agents 1.8.8) — see
|
||||
// docs/rework/hel879/unified-review/frames/. adversarial-gates.jsonl is hand-built (page-guard
|
||||
// probes), never claimed as worker output.
|
||||
type Frame = Record<string, unknown> & { seq: number };
|
||||
const load = (name: string): Frame[] => readFileSync(new URL(`./fixtures/hel879/${name}.jsonl`, import.meta.url), 'utf8').split('\n').filter(l => l.trim()).map(l => JSON.parse(l));
|
||||
const sidecar = JSON.parse(readFileSync(new URL('./fixtures/hel879/sidecar.json', import.meta.url), 'utf8')) as { scenarios: Record<string, { turn_id?: string; turn_ids?: Record<string, string>; acks?: string[]; start_while_playing?: boolean; kinds: string[] }> };
|
||||
|
||||
const gate = () => { let open!: () => void; const promise = new Promise<void>(r => { open = r; }); return { promise, open }; };
|
||||
const flush = async (n = 8) => { for (let i = 0; i < n; i++) await Promise.resolve(); await new Promise(r => setTimeout(r, 0)); };
|
||||
class Mic implements MicTrack { stopped = 0; ended?: () => void; stop() { this.stopped++; } onEnded(cb: () => void) { this.ended = cb; } }
|
||||
class Room implements VoiceRoom {
|
||||
closed = 0; published: MicTrack[] = []; hushed: boolean[] = []; on!: RoomEvents;
|
||||
async publish(mic: MicTrack) { this.published.push(mic); }
|
||||
hush(on: boolean) { this.hushed.push(on); }
|
||||
async resumeAudio() {}
|
||||
async close() { this.closed++; }
|
||||
}
|
||||
class Transport {
|
||||
rooms: Room[] = []; mics: Mic[] = [];
|
||||
async capture() { const m = new Mic(); this.mics.push(m); return m; }
|
||||
async join(_url: string, _token: string, on: RoomEvents) { const r = new Room(); r.on = on; this.rooms.push(r); return r; }
|
||||
}
|
||||
class Server {
|
||||
open = new Set<string>(); made = 0; calls: { method: string; url: string }[] = [];
|
||||
fetch = vi.fn(async (url: string, init: RequestInit = {}) => {
|
||||
const method = init.method || 'GET';
|
||||
this.calls.push({ method, url });
|
||||
if (url === '/api/voice/status') return new Response(JSON.stringify({ configured: true, tts_ok: true }));
|
||||
if (url === '/api/voice/session' && method === 'POST') { const id = `s${++this.made}`; this.open.add(id); return new Response(JSON.stringify({ url: 'wss://lk.test', token: `t-${id}`, room: `cg-voice-${id}`, session_id: id, epoch: 3, expires_at: 0 }), { status: 201 }); }
|
||||
const m = /^\/api\/voice\/session\/(.+)$/u.exec(url);
|
||||
if (m && method === 'DELETE') return this.open.delete(decodeURIComponent(m[1])) ? new Response('{"ended":true}') : new Response('{"detail":"gone"}', { status: 404 });
|
||||
return new Response('{"detail":"Not Found"}', { status: 404 });
|
||||
});
|
||||
}
|
||||
function rig() {
|
||||
const server = new Server(), transport = new Transport(), views: VoiceView[] = [], record = vi.fn(), spoke = vi.fn();
|
||||
const c = new VoiceController({ transport: async () => transport, onView: v => views.push(v), onRecord: record, onSpoke: spoke, fetch: server.fetch as unknown as typeof fetch, secure: () => true, agentWaitMs: 1000 });
|
||||
const view = () => views.at(-1)!;
|
||||
return { server, transport, views, view, record, spoke, c };
|
||||
}
|
||||
async function connected() {
|
||||
const r = rig(); await r.c.start(); r.transport.rooms[0].on.agentJoined(); return r;
|
||||
}
|
||||
const play = (room: Room, frames: Frame[]) => { for (const f of frames) room.on.subtitle(f); };
|
||||
// Rebase a fixture's seq namespace (a second recording replayed into the same call must
|
||||
// continue past every seq the page has already applied).
|
||||
const rebase = (frames: Frame[], by: number): Frame[] => frames.map(f => ({ ...f, seq: f.seq + by }));
|
||||
afterEach(() => { vi.restoreAllMocks(); });
|
||||
|
||||
describe('actual-worker frames (fc905fe on the real SDK) through the page', () => {
|
||||
it('normal turn: draft, growing reply, stored final, ack — and the record takes over the stage line', async () => {
|
||||
const r = await connected(), room = r.transport.rooms[0], turn = sidecar.scenarios.normal.turn_id!;
|
||||
const frames = load('worker-normal');
|
||||
play(room, frames.slice(0, 2));
|
||||
expect(r.view().heard).toBe('你在听吗');
|
||||
const speech = (frames.find(f => f.kind === 'turn_start') as { speech_id: string }).speech_id;
|
||||
play(room, frames.slice(2, 3));
|
||||
expect(r.view().her).toEqual({ speech, text: '', state: 'open' });
|
||||
play(room, frames.slice(3, 6));
|
||||
expect(r.view().her).toEqual({ speech, text: '在听呢,你刚才说到一半的那件事我还在想。', state: 'open' });
|
||||
play(room, frames.slice(6, 7));
|
||||
expect(r.view().her).toEqual({ speech, text: '在听呢,你刚才说到一半的那件事我还在想。', state: 'final', turnId: turn });
|
||||
play(room, frames.slice(7, 8));
|
||||
expect(r.view().her).toEqual({ speech, text: '在听呢,你刚才说到一半的那件事我还在想。', state: 'done', turnId: turn });
|
||||
// The worker confirmed the receipt of exactly this turn (sidecar acks).
|
||||
expect(sidecar.scenarios.normal.acks).toEqual([turn]);
|
||||
// Stage takeover: while open, the subtitle line stands in with a voice- key; once the
|
||||
// stored row (same turn id) is re-read, the line IS that row — no duplicate, no jump.
|
||||
const open = { speech, text: '在听呢,你刚才说到一半的那件事', state: 'open' as const, turnId: undefined };
|
||||
expect(voiceLine(open, [], 0)?.id).toBe(`voice-${speech}`);
|
||||
const rows = [
|
||||
{ id: '501', role: 'user' as const, text: '你在听吗', lifeIds: [], turnId: turn, status: 'sent' as const },
|
||||
{ id: '502', role: 'companion' as const, text: '在听呢,你刚才说到一半的那件事我还在想。', lifeIds: [], turnId: turn, status: 'sent' as const },
|
||||
];
|
||||
expect(voiceLine({ ...open, state: 'final', turnId: turn, text: rows[1].text }, rows, 0)).toBeNull();
|
||||
const known = [rows[0]];
|
||||
const merged = mergeTurns(known, rows)!;
|
||||
expect(merged.filter(m => m.turnId === turn)).toHaveLength(2);
|
||||
expect(merged.at(-1)?.id).toBe('502');
|
||||
});
|
||||
|
||||
it('barge-in: the cut turn never gets a final; the next turn lands clean with its own receipt', async () => {
|
||||
const r = await connected(), room = r.transport.rooms[0];
|
||||
const frames = load('worker-interrupt');
|
||||
play(room, frames);
|
||||
const cut = (frames.find(f => f.kind === 'turn_cancel') as { speech_id: string }).speech_id;
|
||||
const nextTurn = sidecar.scenarios.interrupt.turn_ids!.next;
|
||||
expect(r.view().her?.turnId).toBe(nextTurn);
|
||||
expect(r.view().her?.state).toBe('done');
|
||||
expect(sidecar.scenarios.interrupt.acks).toEqual([nextTurn]); // the cut turn was never acked
|
||||
expect(frames.filter(f => f.kind === 'assistant_final')).toHaveLength(1);
|
||||
expect(frames.find(f => f.kind === 'turn_cancel')?.speech_id).toBe(cut);
|
||||
});
|
||||
|
||||
it('phi: her failed line is heard (spoken), not stored; the speech closes without a final', async () => {
|
||||
const r = await connected(), room = r.transport.rooms[0];
|
||||
play(room, load('worker-phi'));
|
||||
expect(r.view().spoken).toContain('说不出来话');
|
||||
expect(r.view().her).toBeNull();
|
||||
expect(sidecar.scenarios.phi.acks).toEqual([]);
|
||||
});
|
||||
|
||||
it('no legal receipt: cancel only — the fc905fe gate keeps assistant_final off the wire', async () => {
|
||||
const r = await connected(), room = r.transport.rooms[0];
|
||||
const frames = load('worker-no_receipt');
|
||||
play(room, frames);
|
||||
expect(frames.some(f => f.kind === 'assistant_final')).toBe(false);
|
||||
expect(frames.at(-1)?.kind).toBe('turn_cancel');
|
||||
expect((frames.at(-1) as { reason?: string }).reason).toBe('no-receipt');
|
||||
expect(r.view().her).toBeNull();
|
||||
expect(sidecar.scenarios.no_receipt.acks).toEqual([]);
|
||||
});
|
||||
|
||||
it('proactive: start is published while the handle is still playing (sidecar), end closes the row-bound line', async () => {
|
||||
const r = await connected(), room = r.transport.rooms[0];
|
||||
const frames = load('worker-proactive');
|
||||
expect(sidecar.scenarios.proactive.start_while_playing).toBe(true);
|
||||
play(room, frames.slice(0, 2));
|
||||
expect(r.view().her).toMatchObject({ state: 'done', proactive: true, messageId: 301, text: '刚才路过花店,想起你说过喜欢白色的洋桔梗。' });
|
||||
// The reach-out keeps the stored row's identity on the stage while it is being read;
|
||||
// once that row is the newest line of the record, the subtitle line gives way to it.
|
||||
const row = { id: '301', role: 'companion' as const, text: '刚才路过花店,想起你说过喜欢白色的洋桔梗。', lifeIds: [], turnId: 'pro-1', proactive: true, status: 'sent' as const };
|
||||
const line = voiceLine({ speech: 'p1', text: row.text, state: 'open', messageId: 301, proactive: true }, [], 0, [row]);
|
||||
expect(line?.id).toBe('301');
|
||||
expect(line?.proactive).toBe(true);
|
||||
expect(voiceLine({ speech: 'p1', text: row.text, state: 'done', messageId: 301, proactive: true }, [row], 0)).toBeNull();
|
||||
// The interrupted variant clears without a trace.
|
||||
play(room, frames.slice(2));
|
||||
expect(r.view().her).toBeNull();
|
||||
expect(r.spoke).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('page guards against bad frames (adversarial, hand-built)', () => {
|
||||
it('replays, late frames of a closed speech and out-of-order frames are all dropped', async () => {
|
||||
const r = await connected(), room = r.transport.rooms[0];
|
||||
const frames = load('adversarial-gates');
|
||||
// Everything up to and including the later user interim, plus the replayed interim
|
||||
// (old seq), the closed speech's late frames (fresh seqs, dead speech) and an
|
||||
// out-of-order lower seq — none of the bad ones may move anything.
|
||||
play(room, frames.slice(0, 11));
|
||||
expect(r.view().her).toMatchObject({ speech: 'speech_A', state: 'done', turnId: 'gate-turn-1' });
|
||||
expect(r.view().heard).toBe('再说点别的');
|
||||
// The duplicate turn_start for speech_A (still inside the 64-entry window) is ignored.
|
||||
play(room, frames.slice(12, 13));
|
||||
expect(r.view().her).toMatchObject({ speech: 'speech_A', state: 'done', turnId: 'gate-turn-1' });
|
||||
expect(r.view().her?.text).not.toContain('迟到');
|
||||
// The out-of-order lower-seq frame (a lower seq arriving after a higher one) is
|
||||
// already in slice(0, 11): it never overwrote the newer draft.
|
||||
const outOfOrder = frames.find(f => f.kind === 'interim' && f.text === '乱序旧帧')!;
|
||||
expect(outOfOrder.seq).toBeLessThan(9);
|
||||
expect(r.view().heard).toBe('再说点别的');
|
||||
// A replay of the whole first turn (start of speech_A again, still inside the
|
||||
// window) keeps being ignored.
|
||||
const dup = frames.filter(f => f.kind === 'turn_start' && f.speech_id === 'speech_A');
|
||||
expect(dup.length).toBeGreaterThan(1);
|
||||
play(room, dup.slice(1));
|
||||
expect(r.view().her).toMatchObject({ speech: 'speech_A', state: 'done', turnId: 'gate-turn-1' });
|
||||
});
|
||||
|
||||
it('DOCUMENTED GAP: after 64+ later closures a retired speech falls out of the window and a duplicate start with a fresh seq re-enters', async () => {
|
||||
const r = await connected(), room = r.transport.rooms[0];
|
||||
const frames = load('adversarial-gates');
|
||||
// Up to the end of the 66 squeeze speeches: speech_A is long closed (and by now pushed
|
||||
// out of the 64-entry window); nothing of it is on the page.
|
||||
const dupStart = frames.filter(f => f.kind === 'turn_start' && f.speech_id === 'speech_A').at(-1)!;
|
||||
play(room, frames.filter(f => f.seq < dupStart.seq));
|
||||
expect(r.view().her).toBeNull();
|
||||
expect(dupStart.seq).toBeGreaterThan(140);
|
||||
// The current worker never re-emits a speech id (each SDK speech gets a fresh id and
|
||||
// interim.begin runs once per stream), so this needs a misbehaving/second source —
|
||||
// but if it happens, the page DOES re-open the long-retired speech...
|
||||
play(room, frames.filter(f => f.seq >= dupStart.seq));
|
||||
expect(r.view().her).toMatchObject({ speech: 'speech_A', state: 'done', turnId: 'gate-turn-1' });
|
||||
// ...whose replayed line stands as her words again.
|
||||
expect(r.view().her?.text).toBe('被挤出后的重放终稿');
|
||||
});
|
||||
|
||||
it('your interim leaves her open line to the server\'s cancel; your final closes it at once', async () => {
|
||||
const r = await connected(), room = r.transport.rooms[0];
|
||||
const frames = load('worker-interrupt');
|
||||
play(room, frames.slice(0, 4));
|
||||
expect(r.view().her?.state).toBe('open');
|
||||
// A barge-in is the SDK's decision, not any sound: the worker's cancel clears her line.
|
||||
play(room, frames.slice(4, 5));
|
||||
expect(r.view().her).toBeNull();
|
||||
// A user_final closes the current speech immediately (the server owns the turn gate).
|
||||
play(room, frames.slice(5, 6));
|
||||
expect(r.view().her).toBeNull();
|
||||
expect(r.view().heard).toBe('那后来呢');
|
||||
expect(r.spoke).toHaveBeenCalled();
|
||||
// Your interim alone (a draft, not a turn) leaves her open line alone.
|
||||
room.on.subtitle({ v: 2, seq: 99, kind: 'interim', role: 'user', text: '嗯' });
|
||||
expect(r.view().heard).toBe('嗯');
|
||||
});
|
||||
|
||||
it('text takeover while she speaks: her line and its audio go at once; a drop clears everything and a new call ignores the old room', async () => {
|
||||
const r = await connected(), room = r.transport.rooms[0];
|
||||
room.on.agentState('speaking');
|
||||
const frames = load('worker-normal');
|
||||
play(room, frames.slice(2, 6));
|
||||
expect(r.view().her?.state).toBe('open');
|
||||
r.c.hush();
|
||||
expect(r.view().her).toBeNull();
|
||||
expect(room.hushed).toEqual([true]);
|
||||
play(room, frames.slice(6)); // her late final from the cut turn
|
||||
expect(r.view().her).toBeNull();
|
||||
// The room drops mid-sentence: everything clears with the call.
|
||||
room.on.agentState('speaking');
|
||||
play(room, rebase(load('worker-phi').slice(1, 3), 20));
|
||||
expect(r.view().her?.state).toBe('open');
|
||||
room.on.dropped(); await flush();
|
||||
expect(r.view()).toMatchObject({ phase: 'off', her: null, notice: WORDS.dropped });
|
||||
// A new call is a new room and a new sequence; stale frames of the old room change nothing.
|
||||
await r.c.start(); const next = r.transport.rooms[1]; next.on.agentJoined();
|
||||
next.on.subtitle(frames.find(f => f.kind === 'turn_start')!);
|
||||
next.on.subtitle(frames.find(f => f.kind === 'assistant_interim')!);
|
||||
expect(r.view().her).toEqual({ speech: (frames.find(f => f.kind === 'turn_start') as { speech_id: string }).speech_id, text: '在听呢,', state: 'open' });
|
||||
room.on.subtitle({ v: 2, seq: 99, kind: 'turn_start', role: 'assistant', text: '', speech_id: 'stale' });
|
||||
expect(r.view().her?.speech).not.toBe('stale');
|
||||
await r.c.end();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,192 @@
|
||||
// HEL-879 unified review: the ACTUAL worker's v2 frames (web/tests/fixtures/hel879, generated on
|
||||
// the .12 real SDK by scripts/gen_hel879_unified_frames.py) replayed through the current page.
|
||||
// Headless Chromium over CDP against tests/hel878_mock.mjs + tests/fake-livekit.js (no WebRTC, no
|
||||
// model, no TTS; fake audio device as the microphone). Everything on the subtitle side is the
|
||||
// worker's own output — turn ids, speech ids, seqs, kinds; the mock's record rows are keyed to the
|
||||
// fixture turn ids so the stage takeover is exercised end to end. Usage:
|
||||
// node tests/hel879_unified_shots.mjs <chromium-binary> <outDir> [port]
|
||||
import { spawn } from 'node:child_process';
|
||||
import { mkdirSync, writeFileSync, readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { tmpdir } from 'node:os';
|
||||
|
||||
const [chrome, out, portArg] = process.argv.slice(2);
|
||||
const port = Number(portArg || 8879), base = `http://127.0.0.1:${port}`, cdpPort = 9499;
|
||||
mkdirSync(out, { recursive: true });
|
||||
// The mock rides along (child of this run, killed at the end): one self-contained command.
|
||||
const mock = spawn(process.execPath, [new URL('./hel878_mock.mjs', import.meta.url).pathname, String(port)], { stdio: 'ignore' });
|
||||
await new Promise((ok, ko) => { const t = setTimeout(() => ok(undefined), 3000); mock.once('spawn', () => setTimeout(ok, 400)); });
|
||||
const profile = join(tmpdir(), `hel879-unified-${Date.now()}`);
|
||||
const browser = spawn(chrome, ['--headless=new', `--remote-debugging-port=${cdpPort}`, `--user-data-dir=${profile}`, '--no-first-run', '--hide-scrollbars', '--force-color-profile=srgb', '--use-fake-device-for-media-stream', '--use-fake-ui-for-media-stream', '--autoplay-policy=no-user-gesture-required', 'about:blank'], { stdio: 'ignore' });
|
||||
const sleep = ms => new Promise(r => setTimeout(r, ms));
|
||||
let targets;
|
||||
for (let i = 0; i < 60 && !targets; i++) { try { targets = await (await fetch(`http://127.0.0.1:${cdpPort}/json`)).json(); } catch { await sleep(250); } }
|
||||
const ws = new WebSocket(targets.find(t => t.type === 'page').webSocketDebuggerUrl);
|
||||
await new Promise(r => ws.addEventListener('open', r, { once: true }));
|
||||
let id = 0; const waiting = new Map();
|
||||
ws.addEventListener('message', ({ data }) => { const m = JSON.parse(data); if (m.id && waiting.has(m.id)) { const { ok, ko } = waiting.get(m.id); waiting.delete(m.id); m.error ? ko(new Error(m.error.message)) : ok(m.result); } });
|
||||
const cdp = (method, params = {}) => new Promise((ok, ko) => { const n = ++id; waiting.set(n, { ok, ko }); ws.send(JSON.stringify({ id: n, method, params })); });
|
||||
const js = async expr => { const r = await cdp('Runtime.evaluate', { expression: expr, returnByValue: true, awaitPromise: true }); if (r.exceptionDetails) throw new Error(r.exceptionDetails.exception?.description || 'js error'); return r.result.value; };
|
||||
const results = [];
|
||||
const check = (name, ok, detail = '') => { results.push(ok); console.log(`${ok ? 'PASS' : 'FAIL'} ${name}${detail ? ` — ${detail}` : ''}`); };
|
||||
const ctl = async path => (await fetch(`${base}${path}`)).json();
|
||||
const shot = async name => { const { data } = await cdp('Page.captureScreenshot', { format: 'png' }); writeFileSync(join(out, `${name}.png`), Buffer.from(data, 'base64')); };
|
||||
const frames = async (name, ms) => { const list = []; const end = Date.now() + ms; while (Date.now() < end) { const { data } = await cdp('Page.captureScreenshot', { format: 'jpeg', quality: 70 }); list.push(data); } list.forEach((d, i) => writeFileSync(join(out, `${name}-${String(i).padStart(2, '0')}.jpg`), Buffer.from(d, 'base64'))); return list.length; };
|
||||
const click = async (selector, text = '') => js(`(() => { const el = [...document.querySelectorAll(${JSON.stringify(selector)})].find(e => e.offsetParent !== null && e.textContent.includes(${JSON.stringify(text)})); if (!el) return false; el.click(); return true; })()`);
|
||||
const type = t => js(`(() => { const el = document.querySelector('textarea'); const set = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, 'value').set; set.call(el, ${JSON.stringify(t)}); el.dispatchEvent(new Event('input', { bubbles: true })); return true; })()`);
|
||||
const until = async (fn, ms = 4000) => { const end = Date.now() + ms; while (Date.now() < end) { if (await fn()) return true; await sleep(100); } return false; };
|
||||
const stage = () => js(`document.querySelector('.conversation .stage')?.innerText || ''`);
|
||||
const said = () => js(`document.querySelector('.conversation .sr')?.textContent || ''`);
|
||||
const row = () => js(`document.querySelector('.voice-row.real')?.innerText || ''`);
|
||||
const phase = () => js(`document.querySelector('.voice-row.real')?.dataset.phase || 'off'`);
|
||||
const lk = expr => js(`window.__lk ? (${expr}) : null`);
|
||||
const say = frame => lk(`__lk.say(${JSON.stringify(frame)})`);
|
||||
const state = s => lk(`__lk.state(${JSON.stringify(s)})`);
|
||||
const exists = sel => js(`!!document.querySelector(${JSON.stringify(sel)})`);
|
||||
const views = { desktop: { width: 1440, height: 900, deviceScaleFactor: 1, mobile: false }, phone: { width: 390, height: 844, deviceScaleFactor: 2, mobile: true } };
|
||||
async function view(v) { await cdp('Emulation.setDeviceMetricsOverride', views[v]); await cdp('Emulation.setTouchEmulationEnabled', { enabled: views[v].mobile, maxTouchPoints: 5 }); }
|
||||
async function boot(theme) {
|
||||
await cdp('Page.navigate', { url: `${base}/` }); await sleep(500);
|
||||
await js(`localStorage.setItem('cg.theme', ${JSON.stringify(theme)}); sessionStorage.clear(); true`);
|
||||
await cdp('Page.navigate', { url: `${base}/` }); await sleep(1600);
|
||||
}
|
||||
async function startVoice() {
|
||||
await click('.voice-button'); await until(() => exists('.modal.open'));
|
||||
await click('.modal.open .btn-primary', '开始语音');
|
||||
await until(async () => (await phase()) === 'joining');
|
||||
await until(async () => (await lk('__lk.rooms.at(-1)?.state')) === 'connected');
|
||||
await lk('__lk.join()'); await sleep(250);
|
||||
}
|
||||
// The actual worker fixtures + the sidecar that carries their turn ids / receipts.
|
||||
const load = name => readFileSync(new URL(`./fixtures/hel879/${name}.jsonl`, import.meta.url), 'utf8').split('\n').filter(l => l.trim()).map(l => JSON.parse(l));
|
||||
const sidecar = JSON.parse(readFileSync(new URL('./fixtures/hel879/sidecar.json', import.meta.url), 'utf8'));
|
||||
const of = (frames, kind, nth = 0) => frames.filter(f => f.kind === kind)[nth];
|
||||
const sayAll = async frames => { for (const f of frames) await say(f); };
|
||||
const calls = async () => ctl('/__log');
|
||||
const rows = async () => ctl('/__rows');
|
||||
await cdp('Page.enable'); await cdp('Runtime.enable'); await cdp('Network.enable');
|
||||
|
||||
// ── The full run on moon/desktop: every worker scenario through the real page. ──
|
||||
await view('desktop'); await boot('moon'); await click('.nav-item', '交谈'); await sleep(1400);
|
||||
await startVoice(); await calls();
|
||||
|
||||
// 1. Normal turn (worker-normal.jsonl): her words grow on the stage before anything is stored.
|
||||
const normal = load('worker-normal'), turn = sidecar.scenarios.normal.turn_id;
|
||||
await ctl(`/__voice-turn?stage=user&turn=${encodeURIComponent(turn)}&text=${encodeURIComponent('你在听吗')}`);
|
||||
await sayAll(normal.filter(f => f.seq <= 2)); await state('thinking');
|
||||
for (const f of normal.filter(f => f.kind === 'turn_start' || f.kind === 'assistant_interim')) {
|
||||
await say(f); await state('speaking');
|
||||
if (f.text.length > 8) { await until(async () => (await stage()).includes(f.text.slice(0, 6)), 6000); await frames(`w-normal-grow-${f.seq}`, 350); }
|
||||
}
|
||||
check('worker frames: her reply grows on the stage while she speaks, before it is stored', (await stage()).includes('在听呢') && (await rows()).every(r => r.role !== 'companion' || r.turn_id !== turn), (await stage()));
|
||||
check('worker frames: your final is your line, her words never in the voice line', !(await row()).includes('在听呢'), await row());
|
||||
await shot('w1-her-words-growing');
|
||||
// The stored row takes over: same turn id, exactly once, stage keeps its place.
|
||||
await ctl(`/__voice-turn?stage=reply&turn=${encodeURIComponent(turn)}&text=${encodeURIComponent('在听呢,你刚才说到一半的那件事我还在想。')}`);
|
||||
await sayAll(normal.filter(f => f.kind === 'assistant_final' || f.kind === 'turn_end')); await state('listening'); await sleep(900);
|
||||
await click('.log-btn'); await sleep(700);
|
||||
const record1 = await js(`document.querySelector('.log-panel .scroll')?.innerText || ''`);
|
||||
check('worker frames: the stored row (same turn id) takes over exactly once — re-read, never written by the page', record1.split('在听呢,你刚才说到一半的那件事我还在想。').length - 1 === 1, record1.slice(-140).replace(/\n/g, ' '));
|
||||
await shot('w2-record-after-final');
|
||||
await click('.log-panel .btn-round'); await sleep(400); await click('.read-all'); await sleep(400); await click('.record.full .btn-round'); await sleep(300);
|
||||
|
||||
// 2. Barge-in (worker-interrupt.jsonl): the cut turn never gets a final; the next turn lands clean.
|
||||
const it = load('worker-interrupt'), cutTurn = sidecar.scenarios.interrupt.turn_ids.cut, nextTurn = sidecar.scenarios.interrupt.turn_ids.next;
|
||||
await ctl(`/__voice-turn?stage=user&turn=${encodeURIComponent(cutTurn)}&text=${encodeURIComponent('讲讲你下午做了什么')}`);
|
||||
await sayAll(it.slice(0, 4)); await state('speaking');
|
||||
await until(async () => (await stage()).includes('白鹭'), 6000);
|
||||
await shot('w3-before-cut');
|
||||
await sayAll(it.slice(4, 5)); await state('listening'); await ctl(`/__voice-turn?stage=cancel&turn=${encodeURIComponent(cutTurn)}`); await sleep(250);
|
||||
check('worker frames: interrupted — her unfinished line is gone at once, no final exists for the cut turn', !(await stage()).includes('白鹭') && it.filter(f => f.kind === 'assistant_final' && f.speech_id === of(it, 'turn_cancel').speech_id).length === 0, await stage());
|
||||
// Late frames of the cut speech (fresh seqs, dead speech) change nothing.
|
||||
const cutSpeech = of(it, 'turn_cancel').speech_id;
|
||||
await say({ v: 2, seq: 90, kind: 'assistant_interim', role: 'assistant', speech_id: cutSpeech, text: '白鹭又飞回来了' });
|
||||
await say({ v: 2, seq: 91, kind: 'assistant_final', role: 'assistant', speech_id: cutSpeech, turn_id: 'late', text: '白鹭又飞回来了。' });
|
||||
await sleep(350);
|
||||
check('worker frames: late frames of the cut speech stay out', !(await stage()).includes('飞回来'));
|
||||
// The next clean turn of the same recording lands with its own receipt.
|
||||
await ctl(`/__voice-turn?stage=user&turn=${encodeURIComponent(nextTurn)}&text=${encodeURIComponent('那后来呢')}`);
|
||||
await ctl(`/__voice-turn?stage=reply&turn=${encodeURIComponent(nextTurn)}&text=${encodeURIComponent('后来我在桥上站了一会儿,风把水面吹皱了。')}`);
|
||||
await sayAll(it.slice(5)); await state('speaking'); await until(async () => (await stage()).includes('桥上'), 6000); await state('listening'); await sleep(700);
|
||||
await click('.log-btn'); await sleep(600);
|
||||
const record2 = await js(`document.querySelector('.log-panel .scroll')?.innerText || ''`);
|
||||
check('worker frames: the next turn lands clean (one stored row of its own)', record2.includes('风把水面吹皱了') && record2.split('风把水面吹皱了').length - 1 === 1, record2.slice(-120).replace(/\n/g, ' '));
|
||||
await click('.log-panel .btn-round'); await sleep(300);
|
||||
|
||||
// 3. phi (worker-phi.jsonl): her failed line is heard, not stored.
|
||||
const phi = load('worker-phi');
|
||||
await ctl(`/__voice-turn?stage=user&turn=${encodeURIComponent(sidecar.scenarios.phi.turn_id)}&text=${encodeURIComponent('说说那件事吧')}`);
|
||||
await sayAll(phi); await state('speaking'); await sleep(300); await state('listening'); await sleep(300);
|
||||
check('worker frames: phi is heard in the voice line, not stored as her reply', (await row()).includes('说不出来话') && !(await stage()).includes('说不出来话'), await row());
|
||||
await shot('w4-phi-heard');
|
||||
await sleep(600);
|
||||
|
||||
// 4. No legal receipt (worker-no_receipt.jsonl): cancel only, nothing on the stage.
|
||||
const nr = load('worker-no_receipt');
|
||||
await ctl(`/__voice-turn?stage=user&turn=${encodeURIComponent(sidecar.scenarios.no_receipt.turn_id)}&text=${encodeURIComponent('再讲讲那座桥')}`);
|
||||
await sayAll(nr.filter(f => f.kind !== 'turn_cancel')); await state('speaking');
|
||||
await until(async () => (await stage()).includes('水声很好听'), 6000);
|
||||
await say(of(nr, 'turn_cancel')); await state('listening'); await sleep(300);
|
||||
check('worker frames: no legal receipt — the page never shows a final (cancel only)', !(await stage()).includes('水声很好听') && nr.every(f => f.kind !== 'assistant_final'), await stage());
|
||||
|
||||
// 5. Proactive (worker-proactive.jsonl): start DURING playout, end/cancel with the row's own id.
|
||||
await ctl(`/__proactive?id=301&text=${encodeURIComponent('刚才路过花店,想起你说过喜欢白色的洋桔梗。')}`); await calls();
|
||||
const pro = load('worker-proactive');
|
||||
await say(of(pro.filter(f => f.message_id === 301), 'proactive_start')); await state('speaking'); await sleep(600);
|
||||
check('worker frames: reach-out read aloud is shown word for word while she speaks it', (await stage()).includes('洋桔梗'), await stage());
|
||||
await shot('w5-reach-out');
|
||||
await say(of(pro.filter(f => f.message_id === 301), 'proactive_end')); await state('listening'); await sleep(400);
|
||||
// The interrupted variant clears without a trace and the page wrote nothing.
|
||||
const before = await calls();
|
||||
await say(pro.filter(f => f.message_id === 302)[0]); await state('speaking'); await sleep(250);
|
||||
await say(pro.filter(f => f.message_id === 302)[1]); await state('listening'); await sleep(250);
|
||||
const after = await calls();
|
||||
check('worker frames: an interrupted reach-out clears; the page still wrote nothing (no receipt, no read mark)', !after.some(l => !l.startsWith('GET ')), after.join(' | '));
|
||||
|
||||
// 6. Text takes over while she speaks (the worker's own next turn): typed words come next.
|
||||
const nt = load('worker-normal'), nt2 = { ...normal[2], seq: 100, speech_id: 'speech_text_takeover' };
|
||||
await say(nt2); await state('speaking'); await sleep(200);
|
||||
await type('先等等,我打字跟你说'); await js(`document.querySelector('.send').click(), true`); await sleep(400);
|
||||
check('text over voice: her worker line is gone at once, your typed words are on the stage', !(await stage()).includes('在听呢,') && (await stage()).includes('先等等'), await stage());
|
||||
await until(async () => !(await exists('.reader-bar .stop')), 9000); await state('listening'); await sleep(400);
|
||||
|
||||
// 7. The room drops mid-sentence: everything clears with the call; starting again works.
|
||||
await say({ v: 2, seq: 120, kind: 'turn_start', role: 'assistant', speech_id: 'speech_drop', text: '' });
|
||||
await say({ v: 2, seq: 121, kind: 'assistant_interim', role: 'assistant', speech_id: 'speech_drop', text: '晚安,明天见。' }); await state('speaking');
|
||||
await until(async () => (await stage()).includes('晚安'), 6000);
|
||||
await lk('__lk.drop()'); await sleep(400);
|
||||
check('dropped mid-sentence: her line and the call clear together', !(await stage()).includes('晚安') && (await phase()) === 'off', await stage());
|
||||
await shot('w6-after-drop');
|
||||
await startVoice(); await calls();
|
||||
const fresh = { v: 2, seq: 1, kind: 'turn_start', role: 'assistant', speech_id: 'speech_fresh', text: '' };
|
||||
const freshText = { v: 2, seq: 2, kind: 'assistant_interim', role: 'assistant', speech_id: 'speech_fresh', text: '又见面了。' };
|
||||
await say(fresh); await say(freshText); await state('speaking');
|
||||
await until(async () => (await stage()).includes('又见面了'), 6000);
|
||||
check('a new call is a new room and a new sequence: her words flow again, nothing of the old call remains', (await stage()).includes('又见面了') && !(await stage()).includes('晚安'), await stage());
|
||||
await shot('w7-reopened');
|
||||
await click('.voice-row.real .voice-end'); await sleep(300);
|
||||
|
||||
// ── Second theme + phone: the same worker frames on the approved visuals. ──
|
||||
for (const [theme, v, tag] of [['fog', 'desktop', 'fog'], ['moon', 'phone', 'phone']]) {
|
||||
await view(v); await boot(theme); await click('.nav-item', '交谈'); await sleep(1400); await startVoice(); await calls();
|
||||
const t = load('worker-normal'), tid = sidecar.scenarios.normal.turn_id;
|
||||
await ctl(`/__voice-turn?stage=user&turn=${encodeURIComponent(tid)}&text=${encodeURIComponent('你在听吗')}`);
|
||||
await sayAll(t.filter(f => f.seq <= 2));
|
||||
await say(of(t, 'turn_start')); await state('speaking');
|
||||
for (const f of t.filter(f => f.kind === 'assistant_interim')) { await say(f); await sleep(260); }
|
||||
check(`${tag}: worker frames grow her reply on the approved ${theme} ${v} layout`, await until(async () => (await stage()).includes('在听呢,你刚才说到一半的那件事'), 8000), await stage());
|
||||
if (tag === 'phone') await frames('phone-growing', 700);
|
||||
await shot(`${tag}-her-words-growing`);
|
||||
await ctl(`/__voice-turn?stage=reply&turn=${encodeURIComponent(tid)}&text=${encodeURIComponent('在听呢,你刚才说到一半的那件事我还在想。')}`);
|
||||
await sayAll(t.filter(f => f.kind === 'assistant_final' || f.kind === 'turn_end')); await state('listening'); await sleep(800);
|
||||
await click('.log-btn'); await sleep(600);
|
||||
const rec = await js(`document.querySelector('.log-panel .scroll')?.innerText || ''`);
|
||||
check(`${tag}: the stored row takes over once on ${theme} ${v}`, rec.split('在听呢,你刚才说到一半的那件事我还在想。').length - 1 === 1, '');
|
||||
await click('.log-panel .btn-round'); await sleep(300);
|
||||
await click('.voice-row.real .voice-end'); await sleep(300);
|
||||
}
|
||||
|
||||
ws.close(); browser.kill(); mock.kill();
|
||||
const failed = results.filter(r => !r).length;
|
||||
console.log(`${results.length - failed}/${results.length} passed`);
|
||||
process.exit(failed ? 1 : 0);
|
||||
Reference in New Issue
Block a user