@vellumai/assistant 0.10.8-dev.202607122221.c5fc3ac → 0.10.8-dev.202607122252.157ae8a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/assistant",
3
- "version": "0.10.8-dev.202607122221.c5fc3ac",
3
+ "version": "0.10.8-dev.202607122252.157ae8a",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -0,0 +1,191 @@
1
+ import { beforeAll, beforeEach, describe, expect, test } from "bun:test";
2
+
3
+ import { and, eq } from "drizzle-orm";
4
+
5
+ import { getMemoryDb } from "../persistence/db-connection.js";
6
+ import { initializeDb } from "../persistence/db-init.js";
7
+ import { upsertSkillCardInsertJob } from "../persistence/jobs-store.js";
8
+ import { memoryJobs } from "../persistence/schema/index.js";
9
+
10
+ function skillEntry(skillId: string, name = `Skill ${skillId}`) {
11
+ return { skillId, name, description: `Does ${skillId}` };
12
+ }
13
+
14
+ function pendingRows() {
15
+ const db = getMemoryDb()!;
16
+ return db
17
+ .select()
18
+ .from(memoryJobs)
19
+ .where(eq(memoryJobs.type, "skill_card_insert"))
20
+ .all();
21
+ }
22
+
23
+ function parsedSkills(payload: string): Array<{ skillId: string }> {
24
+ return (JSON.parse(payload) as { skills: Array<{ skillId: string }> }).skills;
25
+ }
26
+
27
+ describe("upsertSkillCardInsertJob payload merge", () => {
28
+ beforeAll(async () => {
29
+ await initializeDb();
30
+ });
31
+
32
+ beforeEach(() => {
33
+ const db = getMemoryDb()!;
34
+ db.run("DELETE FROM memory_jobs");
35
+ });
36
+
37
+ test("inserts a fresh pending row when none exists for the run", () => {
38
+ upsertSkillCardInsertJob({
39
+ sourceConversationId: "src-1",
40
+ runConversationId: "run-1",
41
+ skills: [skillEntry("skill-a")],
42
+ });
43
+
44
+ const rows = pendingRows();
45
+ expect(rows).toHaveLength(1);
46
+ expect(rows[0]!.status).toBe("pending");
47
+ const payload = JSON.parse(rows[0]!.payload) as Record<string, unknown>;
48
+ expect(payload.sourceConversationId).toBe("src-1");
49
+ expect(payload.runConversationId).toBe("run-1");
50
+ expect(parsedSkills(rows[0]!.payload).map((s) => s.skillId)).toEqual([
51
+ "skill-a",
52
+ ]);
53
+ });
54
+
55
+ test("a second create in the same run merges its skill into the pending payload", () => {
56
+ upsertSkillCardInsertJob({
57
+ sourceConversationId: "src-1",
58
+ runConversationId: "run-1",
59
+ skills: [skillEntry("skill-a")],
60
+ });
61
+ upsertSkillCardInsertJob({
62
+ sourceConversationId: "src-1",
63
+ runConversationId: "run-1",
64
+ skills: [skillEntry("skill-b")],
65
+ });
66
+
67
+ const rows = pendingRows();
68
+ expect(rows).toHaveLength(1);
69
+ expect(parsedSkills(rows[0]!.payload).map((s) => s.skillId)).toEqual([
70
+ "skill-a",
71
+ "skill-b",
72
+ ]);
73
+ });
74
+
75
+ test("re-enqueueing the same skill is deduplicated by skillId (pending entry wins)", () => {
76
+ upsertSkillCardInsertJob({
77
+ sourceConversationId: "src-1",
78
+ runConversationId: "run-1",
79
+ skills: [skillEntry("skill-a", "Original Name")],
80
+ });
81
+ // The handler's still-mid-turn re-upsert replays the whole snapshot.
82
+ upsertSkillCardInsertJob({
83
+ sourceConversationId: "src-1",
84
+ runConversationId: "run-1",
85
+ skills: [skillEntry("skill-a", "Replayed Name"), skillEntry("skill-b")],
86
+ });
87
+
88
+ const rows = pendingRows();
89
+ expect(rows).toHaveLength(1);
90
+ const skills = parsedSkills(rows[0]!.payload) as Array<{
91
+ skillId: string;
92
+ name: string;
93
+ }>;
94
+ expect(skills.map((s) => s.skillId)).toEqual(["skill-a", "skill-b"]);
95
+ expect(skills[0]!.name).toBe("Original Name");
96
+ });
97
+
98
+ test("the earliest runAfter wins across merges", () => {
99
+ const later = Date.now() + 300_000;
100
+ const sooner = Date.now();
101
+ upsertSkillCardInsertJob(
102
+ {
103
+ sourceConversationId: "src-1",
104
+ runConversationId: "run-1",
105
+ skills: [skillEntry("skill-a")],
106
+ },
107
+ later,
108
+ );
109
+ upsertSkillCardInsertJob(
110
+ {
111
+ sourceConversationId: "src-1",
112
+ runConversationId: "run-1",
113
+ skills: [skillEntry("skill-b")],
114
+ },
115
+ sooner,
116
+ );
117
+ // A later-scheduled follow-up must not push the sooner row back out.
118
+ upsertSkillCardInsertJob(
119
+ {
120
+ sourceConversationId: "src-1",
121
+ runConversationId: "run-1",
122
+ skills: [skillEntry("skill-c")],
123
+ },
124
+ later,
125
+ );
126
+
127
+ const rows = pendingRows();
128
+ expect(rows).toHaveLength(1);
129
+ expect(rows[0]!.runAfter).toBe(sooner);
130
+ expect(parsedSkills(rows[0]!.payload).map((s) => s.skillId)).toEqual([
131
+ "skill-a",
132
+ "skill-b",
133
+ "skill-c",
134
+ ]);
135
+ });
136
+
137
+ test("distinct runs keep distinct pending rows", () => {
138
+ upsertSkillCardInsertJob({
139
+ sourceConversationId: "src-1",
140
+ runConversationId: "run-1",
141
+ skills: [skillEntry("skill-a")],
142
+ });
143
+ upsertSkillCardInsertJob({
144
+ sourceConversationId: "src-1",
145
+ runConversationId: "run-2",
146
+ skills: [skillEntry("skill-b")],
147
+ });
148
+
149
+ const rows = pendingRows();
150
+ expect(rows).toHaveLength(2);
151
+ const byRun = new Map(
152
+ rows.map((r) => [
153
+ (JSON.parse(r.payload) as { runConversationId: string })
154
+ .runConversationId,
155
+ parsedSkills(r.payload).map((s) => s.skillId),
156
+ ]),
157
+ );
158
+ expect(byRun.get("run-1")).toEqual(["skill-a"]);
159
+ expect(byRun.get("run-2")).toEqual(["skill-b"]);
160
+ });
161
+
162
+ test("a non-pending row does not coalesce — a fresh pending row is created", () => {
163
+ // The claimed row a handler re-upserts from is `running`; its replacement
164
+ // must be a NEW pending row, never a mutation of the claimed one.
165
+ upsertSkillCardInsertJob({
166
+ sourceConversationId: "src-1",
167
+ runConversationId: "run-1",
168
+ skills: [skillEntry("skill-a")],
169
+ });
170
+ const db = getMemoryDb()!;
171
+ db.update(memoryJobs)
172
+ .set({ status: "running" })
173
+ .where(
174
+ and(
175
+ eq(memoryJobs.type, "skill_card_insert"),
176
+ eq(memoryJobs.status, "pending"),
177
+ ),
178
+ )
179
+ .run();
180
+
181
+ upsertSkillCardInsertJob({
182
+ sourceConversationId: "src-1",
183
+ runConversationId: "run-1",
184
+ skills: [skillEntry("skill-a")],
185
+ });
186
+
187
+ const rows = pendingRows();
188
+ expect(rows).toHaveLength(2);
189
+ expect(rows.map((r) => r.status).sort()).toEqual(["pending", "running"]);
190
+ });
191
+ });
@@ -17,6 +17,36 @@ mock.module("../daemon/skill-memory-refresh.js", () => ({
17
17
  refreshSkillCapabilityMemories: mockRefreshSkillCapabilityMemories,
18
18
  }));
19
19
 
20
+ // Skill-card enqueue recorder. Snapshot + override (rather than a full module
21
+ // replacement) because other modules in this import graph (e.g. the managed
22
+ // store's capability seeding) import sibling jobs-store exports that must
23
+ // keep working.
24
+ import * as realJobsStore from "../persistence/jobs-store.js";
25
+
26
+ let skillCardJobUpserts: Array<{
27
+ payload: {
28
+ sourceConversationId: string;
29
+ runConversationId: string;
30
+ } & Record<string, unknown>;
31
+ runAfter: number | undefined;
32
+ }> = [];
33
+ let skillCardUpsertThrows = false;
34
+ mock.module("../persistence/jobs-store.js", () => ({
35
+ ...realJobsStore,
36
+ upsertSkillCardInsertJob: (
37
+ payload: {
38
+ sourceConversationId: string;
39
+ runConversationId: string;
40
+ } & Record<string, unknown>,
41
+ runAfter?: number,
42
+ ) => {
43
+ if (skillCardUpsertThrows) {
44
+ throw new Error("jobs db unavailable");
45
+ }
46
+ skillCardJobUpserts.push({ payload, runAfter });
47
+ },
48
+ }));
49
+
20
50
  /**
21
51
  * Build the injected catalog seam for the ownership-backstop tests. Seeds the
22
52
  * given non-managed (bundled / plugin / workspace) or managed entry so the
@@ -56,6 +86,8 @@ function installMetaFor(skillId: string) {
56
86
  beforeEach(() => {
57
87
  mkdirSync(join(TEST_DIR, "skills"), { recursive: true });
58
88
  mockRefreshSkillCapabilityMemories.mockClear();
89
+ skillCardJobUpserts = [];
90
+ skillCardUpsertThrows = false;
59
91
  });
60
92
 
61
93
  afterEach(() => {
@@ -1093,4 +1125,233 @@ describe("scaffold_managed_skill tool", () => {
1093
1125
  true,
1094
1126
  );
1095
1127
  });
1128
+
1129
+ // ── Skill-card enqueue at the creation site ─────────────────────────────
1130
+
1131
+ /** Lineage seam resolving the fork parent of the retrospective run. */
1132
+ function lineageSeam() {
1133
+ return {
1134
+ getConversation: (id: string) =>
1135
+ id === "retro-run-conv"
1136
+ ? { forkParentConversationId: "source-conv" }
1137
+ : null,
1138
+ };
1139
+ }
1140
+
1141
+ test("retrospective CREATE enqueues one skill_card_insert job with the normalized payload and resolved source id", async () => {
1142
+ const result = await executeScaffoldManagedSkill(
1143
+ {
1144
+ skill_id: " card-skill ",
1145
+ name: " Card\nSkill ",
1146
+ description: " Does\r\ncard things ",
1147
+ body_markdown: "Do the procedure.",
1148
+ emoji: " 🧭 ",
1149
+ },
1150
+ makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
1151
+ lineageSeam(),
1152
+ );
1153
+
1154
+ expect(result.isError).toBe(false);
1155
+ expect(skillCardJobUpserts).toHaveLength(1);
1156
+ // The payload carries the executor's post-normalization values — the
1157
+ // same trimmed/newline-collapsed strings persisted to the frontmatter —
1158
+ // so the card links and labels the skill exactly as it exists on disk.
1159
+ expect(skillCardJobUpserts[0]!.payload).toEqual({
1160
+ sourceConversationId: "source-conv",
1161
+ runConversationId: "retro-run-conv",
1162
+ skills: [
1163
+ {
1164
+ skillId: "card-skill",
1165
+ name: "Card Skill",
1166
+ description: "Does card things",
1167
+ emoji: "🧭",
1168
+ },
1169
+ ],
1170
+ });
1171
+ });
1172
+
1173
+ test("a whitespace-only emoji is omitted from the card payload", async () => {
1174
+ const result = await executeScaffoldManagedSkill(
1175
+ {
1176
+ skill_id: "no-emoji-card",
1177
+ name: "No Emoji",
1178
+ description: "Card without an emoji",
1179
+ body_markdown: "Do the procedure.",
1180
+ emoji: " \n ",
1181
+ },
1182
+ makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
1183
+ lineageSeam(),
1184
+ );
1185
+
1186
+ expect(result.isError).toBe(false);
1187
+ expect(skillCardJobUpserts).toHaveLength(1);
1188
+ const skill = (
1189
+ skillCardJobUpserts[0]!.payload.skills as Record<string, unknown>[]
1190
+ )[0]!;
1191
+ expect(skill.skillId).toBe("no-emoji-card");
1192
+ expect("emoji" in skill).toBe(false);
1193
+ });
1194
+
1195
+ test("retrospective CREATE with an unresolvable fork parent skips the enqueue but the scaffold still succeeds", async () => {
1196
+ // Three unresolvable shapes: the run row is gone, the run is not a fork,
1197
+ // and the lineage lookup throws.
1198
+ const cases: Array<{
1199
+ skillId: string;
1200
+ lookup: () => { forkParentConversationId: string | null } | null;
1201
+ }> = [
1202
+ { skillId: "no-card-no-row", lookup: () => null },
1203
+ {
1204
+ skillId: "no-card-no-parent",
1205
+ lookup: () => ({ forkParentConversationId: null }),
1206
+ },
1207
+ {
1208
+ skillId: "no-card-throwing-lookup",
1209
+ lookup: () => {
1210
+ throw new Error("db unavailable");
1211
+ },
1212
+ },
1213
+ ];
1214
+
1215
+ for (const { skillId, lookup } of cases) {
1216
+ const result = await executeScaffoldManagedSkill(
1217
+ {
1218
+ skill_id: skillId,
1219
+ name: "No Card",
1220
+ description: "Fork parent not resolvable",
1221
+ body_markdown: "Do the procedure.",
1222
+ },
1223
+ makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
1224
+ { getConversation: lookup },
1225
+ );
1226
+
1227
+ expect(result.isError).toBe(false);
1228
+ expect(existsSync(join(TEST_DIR, "skills", skillId, "SKILL.md"))).toBe(
1229
+ true,
1230
+ );
1231
+ }
1232
+ expect(skillCardJobUpserts).toHaveLength(0);
1233
+ });
1234
+
1235
+ test("retrospective overwrite of an EXISTING skill (a refinement) does not enqueue a card", async () => {
1236
+ // First pass: genuine create — enqueues.
1237
+ await executeScaffoldManagedSkill(
1238
+ {
1239
+ skill_id: "refined-skill",
1240
+ name: "Refined Skill",
1241
+ description: "First pass",
1242
+ body_markdown: "V1 procedure.",
1243
+ },
1244
+ makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
1245
+ lineageSeam(),
1246
+ );
1247
+ expect(skillCardJobUpserts).toHaveLength(1);
1248
+ skillCardJobUpserts = [];
1249
+
1250
+ // Second pass: overwrite of the pre-existing skill — a refinement, no card.
1251
+ const result = await executeScaffoldManagedSkill(
1252
+ {
1253
+ skill_id: "refined-skill",
1254
+ name: "Refined Skill",
1255
+ description: "Refined",
1256
+ body_markdown: "V2 procedure.",
1257
+ overwrite: true,
1258
+ },
1259
+ makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
1260
+ lineageSeam(),
1261
+ );
1262
+
1263
+ expect(result.isError).toBe(false);
1264
+ expect(skillCardJobUpserts).toHaveLength(0);
1265
+ });
1266
+
1267
+ test("retrospective overwrite:true on a skill that did NOT previously exist is still a create and enqueues", async () => {
1268
+ const result = await executeScaffoldManagedSkill(
1269
+ {
1270
+ skill_id: "overwrite-fresh",
1271
+ name: "Overwrite Fresh",
1272
+ description: "Overwrite flag on a fresh id",
1273
+ body_markdown: "Do the procedure.",
1274
+ overwrite: true,
1275
+ },
1276
+ makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
1277
+ lineageSeam(),
1278
+ );
1279
+
1280
+ expect(result.isError).toBe(false);
1281
+ expect(skillCardJobUpserts).toHaveLength(1);
1282
+ expect(skillCardJobUpserts[0]!.payload.skills).toEqual([
1283
+ {
1284
+ skillId: "overwrite-fresh",
1285
+ name: "Overwrite Fresh",
1286
+ description: "Overwrite flag on a fresh id",
1287
+ },
1288
+ ]);
1289
+ });
1290
+
1291
+ test("user-origin create never enqueues a card, even with resolvable lineage", async () => {
1292
+ const result = await executeScaffoldManagedSkill(
1293
+ {
1294
+ skill_id: "user-no-card",
1295
+ name: "User No Card",
1296
+ description: "Authored interactively",
1297
+ body_markdown: "Do the thing.",
1298
+ },
1299
+ makeContext({ conversationId: "retro-run-conv" }),
1300
+ lineageSeam(),
1301
+ );
1302
+
1303
+ expect(result.isError).toBe(false);
1304
+ expect(skillCardJobUpserts).toHaveLength(0);
1305
+ });
1306
+
1307
+ test("a throwing enqueue never fails the scaffold — the skill is already created", async () => {
1308
+ skillCardUpsertThrows = true;
1309
+
1310
+ const result = await executeScaffoldManagedSkill(
1311
+ {
1312
+ skill_id: "enqueue-throws",
1313
+ name: "Enqueue Throws",
1314
+ description: "Jobs DB unavailable at enqueue time",
1315
+ body_markdown: "Do the procedure.",
1316
+ },
1317
+ makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
1318
+ lineageSeam(),
1319
+ );
1320
+
1321
+ expect(result.isError).toBe(false);
1322
+ expect(
1323
+ existsSync(join(TEST_DIR, "skills", "enqueue-throws", "SKILL.md")),
1324
+ ).toBe(true);
1325
+ expect(installMetaFor("enqueue-throws")?.author).toBe("assistant");
1326
+ });
1327
+
1328
+ test("two creates in the same run enqueue one upsert per skill under the same run id (merge happens in the jobs store)", async () => {
1329
+ for (const skillId of ["run-skill-a", "run-skill-b"]) {
1330
+ const result = await executeScaffoldManagedSkill(
1331
+ {
1332
+ skill_id: skillId,
1333
+ name: `Skill ${skillId}`,
1334
+ description: `Does ${skillId}`,
1335
+ body_markdown: "Do the procedure.",
1336
+ },
1337
+ makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
1338
+ lineageSeam(),
1339
+ );
1340
+ expect(result.isError).toBe(false);
1341
+ }
1342
+
1343
+ // One upsert per created skill, all keyed to the same run + source — the
1344
+ // jobs-store upsert coalesces them into a single pending payload (covered
1345
+ // by jobs-store-skill-card-upsert.test.ts).
1346
+ expect(skillCardJobUpserts).toHaveLength(2);
1347
+ for (const upsert of skillCardJobUpserts) {
1348
+ expect(upsert.payload.sourceConversationId).toBe("source-conv");
1349
+ expect(upsert.payload.runConversationId).toBe("retro-run-conv");
1350
+ }
1351
+ expect(
1352
+ skillCardJobUpserts.flatMap((u) =>
1353
+ (u.payload.skills as Array<{ skillId: string }>).map((s) => s.skillId),
1354
+ ),
1355
+ ).toEqual(["run-skill-a", "run-skill-b"]);
1356
+ });
1096
1357
  });
@@ -28,7 +28,11 @@ import { setConfig } from "../../__tests__/helpers/set-config.js";
28
28
  import { ABORT_WATCHDOG_MS } from "../../daemon/abort-watchdog.js";
29
29
  import { CALL_OPENING_MARKER } from "../voice-control-protocol.js";
30
30
  import { startVoiceTurn } from "../voice-session-bridge.js";
31
- import { ESCALATION_CONTINUATION_CONTENT } from "../voice-triage-escalate.js";
31
+ import {
32
+ escalatedContinuationRule,
33
+ ESCALATION_CONTINUATION_CONTENT,
34
+ frontDoorTriageRule,
35
+ } from "../voice-triage-escalate.js";
32
36
 
33
37
  // `resolveProcessingWaitMs` reads `workspaceGit.turnCommitMaxWaitMs`; seed it
34
38
  // so the wait-budget assertions below get a fixed, known value.
@@ -290,6 +294,57 @@ describe("startVoiceTurn escalation-continuation persistence", () => {
290
294
  });
291
295
  });
292
296
 
297
+ describe("startVoiceTurn triage-and-escalate control prompt", () => {
298
+ // Live-voice supplies its own voiceControlPrompt, bypassing
299
+ // buildVoiceCallControlPrompt where the routing-leg rule is normally injected.
300
+ // The rule must still be appended, or the front-door model is never told to
301
+ // emit [ESCALATE] and can't hand off.
302
+ const LIVE_VOICE_PROMPT = "You are speaking in a local live voice session.";
303
+
304
+ // The turn installs its resolved control prompt, then cleanup resets it to
305
+ // null — so capture every applied value and read the installed (non-null) one.
306
+ function captureInstalledPrompt(): () => string | undefined {
307
+ const fake = makeFakeConversation({ processing: false });
308
+ fakeConversation = fake.conversation;
309
+ const applied: Array<string | null> = [];
310
+ fake.conversation.setVoiceCallControlPrompt = (prompt) => {
311
+ applied.push(prompt);
312
+ };
313
+ return () => applied.find((p): p is string => typeof p === "string");
314
+ }
315
+
316
+ test("appends the front-door triage rule to a caller-supplied prompt", async () => {
317
+ const installed = captureInstalledPrompt();
318
+ await startVoiceTurn({
319
+ ...makeTurnOptions(),
320
+ voiceControlPrompt: LIVE_VOICE_PROMPT,
321
+ routingLeg: "front-door",
322
+ });
323
+ expect(installed()).toContain(LIVE_VOICE_PROMPT);
324
+ expect(installed()).toContain(frontDoorTriageRule());
325
+ });
326
+
327
+ test("appends the escalated continuation rule to a caller-supplied prompt", async () => {
328
+ const installed = captureInstalledPrompt();
329
+ await startVoiceTurn({
330
+ ...makeTurnOptions(),
331
+ voiceControlPrompt: LIVE_VOICE_PROMPT,
332
+ routingLeg: "escalated",
333
+ });
334
+ expect(installed()).toContain(LIVE_VOICE_PROMPT);
335
+ expect(installed()).toContain(escalatedContinuationRule());
336
+ });
337
+
338
+ test("leaves a caller-supplied prompt verbatim when no routing leg is set", async () => {
339
+ const installed = captureInstalledPrompt();
340
+ await startVoiceTurn({
341
+ ...makeTurnOptions(),
342
+ voiceControlPrompt: LIVE_VOICE_PROMPT,
343
+ });
344
+ expect(installed()).toBe(LIVE_VOICE_PROMPT);
345
+ });
346
+ });
347
+
293
348
  describe("startVoiceTurn conversation-lock wait", () => {
294
349
  test("an idle conversation starts the turn without consulting waitForIdle", async () => {
295
350
  const fake = makeFakeConversation({ processing: false });
@@ -106,46 +106,23 @@ describe("escalation continuation content", () => {
106
106
  });
107
107
  });
108
108
 
109
- // Controller-level orchestration in CallController.streamTtsTokens is not
110
- // covered by unit tests here — CallController needs a live transport,
111
- // conversation, and TTS provider to instantiate. These document the intended
112
- // integration coverage (a harnessed call-controller test or the manual
113
- // cli-testing flow) for the two-leg escalation path.
114
- describe("call-controller escalation orchestration (integration — TODO)", () => {
109
+ // This module is the surface-agnostic escalation *policy* (profiles, prompt
110
+ // rules, the fallback-bridge decision, the flag gate). The two-leg *routing*
111
+ // runs on the in-app Voice Mode surface (LiveVoiceSession), gated behind both
112
+ // the voice-mode and voice-triage-escalate flags — see
113
+ // live-voice/__tests__/live-voice-triage-escalate.test.ts for the orchestration
114
+ // coverage (flag gating, front-door → escalated hand-off, marker suppression,
115
+ // fallback bridge, barge-in). What remains for the manual cli-testing flow is
116
+ // true end-to-end audio: real TTS timing across the bridge, and the residual
117
+ // broadcast/persist raw-marker leak (issue #37850, shared by both voice
118
+ // surfaces) once that is addressed.
119
+ describe("live-voice escalation orchestration (end-to-end — TODO)", () => {
115
120
  test.todo(
116
- "flag OFF: a single leg runs on the call-site default profile, no [ESCALATE] rule in the prompt",
121
+ "an unpunctuated fallback bridge is force-flushed so the caller hears audio during the escalated model's call, not silence",
117
122
  () => {},
118
123
  );
119
124
  test.todo(
120
- "flag ON, simple turn: the front-door (cost-optimized) leg answers and no escalation leg runs",
121
- () => {},
122
- );
123
- test.todo(
124
- "flag ON, tricky turn: [ESCALATE] triggers a second (quality-optimized) leg that shares the TTS stream and end-of-turn signal",
125
- () => {},
126
- );
127
- test.todo(
128
- "front-door text after [ESCALATE] is suppressed and never spoken; only the bridge before the marker reaches TTS",
129
- () => {},
130
- );
131
- test.todo(
132
- "post-[ESCALATE] front-door text is dropped from the completion text — no spurious [END_CALL]/[ASK_GUARDIAN], no transcript pollution",
133
- () => {},
134
- );
135
- test.todo(
136
- "the front-door leg is aborted on [ESCALATE] so a model that keeps generating does not delay the escalated leg",
137
- () => {},
138
- );
139
- test.todo(
140
- "an unpunctuated bridge is force-synthesized before the escalated leg so the caller is not left in silence during the strong-model call",
141
- () => {},
142
- );
143
- test.todo(
144
- "bare [ESCALATE] with no holding phrase injects the fallback bridge before the quality leg so there is no dead air",
145
- () => {},
146
- );
147
- test.todo(
148
- "barge-in during the bridge or hand-off aborts both legs via runSignal",
125
+ "the escalated answer's TTS follows the bridge audio with no listening window between them",
149
126
  () => {},
150
127
  );
151
128
  });