@vellumai/assistant 0.11.2-dev.202608051734.355dff7 → 0.11.2-dev.202608051838.a2809c6

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.
Files changed (38) hide show
  1. package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/ingress.ts +10 -0
  2. package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/ingress.ts +10 -0
  3. package/node_modules/@vellumai/service-contracts/src/ingress.ts +10 -0
  4. package/package.json +1 -1
  5. package/src/__tests__/conversation-tool-setup-app-refresh.test.ts +1 -0
  6. package/src/__tests__/conversation-tool-setup-attribution.test.ts +61 -0
  7. package/src/__tests__/cu-unified-flow.test.ts +2 -6
  8. package/src/__tests__/file-ops-service.test.ts +75 -4
  9. package/src/__tests__/host-bash-proxy.test.ts +10 -5
  10. package/src/__tests__/host-browser-proxy.test.ts +2 -2
  11. package/src/__tests__/host-cu-proxy.test.ts +3 -7
  12. package/src/__tests__/host-file-proxy.test.ts +3 -7
  13. package/src/__tests__/host-file-read-tool.test.ts +5 -1
  14. package/src/__tests__/host-transfer-proxy-targeted.test.ts +6 -4
  15. package/src/__tests__/media-stream-server-integration.test.ts +36 -0
  16. package/src/__tests__/stt-language-catalog-parity.test.ts +38 -0
  17. package/src/__tests__/subagent-tool-gate-mode.test.ts +1 -0
  18. package/src/__tests__/tool-result-spool.test.ts +74 -18
  19. package/src/agent/loop.ts +6 -3
  20. package/src/calls/media-stream-server.ts +9 -1
  21. package/src/config/bundled-skills/settings/TOOLS.json +2 -2
  22. package/src/config/bundled-skills/settings/tools/voice-config-update.ts +1 -0
  23. package/src/config/schemas/stt.ts +10 -4
  24. package/src/context/post-turn-tool-result-truncation.ts +32 -16
  25. package/src/context/tool-result-spool.ts +32 -18
  26. package/src/daemon/conversation-tool-setup.ts +1 -1
  27. package/src/platform/managed-speech.test.ts +20 -0
  28. package/src/platform/managed-speech.ts +9 -0
  29. package/src/providers/speech-to-text/__tests__/resolve.test.ts +164 -6
  30. package/src/providers/speech-to-text/deepgram.ts +1 -0
  31. package/src/providers/speech-to-text/resolve.ts +80 -10
  32. package/src/providers/speech-to-text/vellum-managed.ts +7 -1
  33. package/src/runtime/auth/same-actor.ts +38 -7
  34. package/src/stt/daemon-batch-transcriber.ts +8 -6
  35. package/src/tools/filesystem/read.ts +2 -2
  36. package/src/tools/host-filesystem/read.ts +14 -6
  37. package/src/tools/shared/filesystem/file-ops-service.ts +36 -3
  38. package/src/tools/types.ts +5 -3
@@ -20,6 +20,16 @@ export function normalizePublicBaseUrl(value: unknown): string | undefined {
20
20
  return normalized.length > 0 ? normalized : undefined;
21
21
  }
22
22
 
23
+ /**
24
+ * Application close code the gateway's velay bridge sends to proxied
25
+ * WebSockets when the tunnel itself is lost (velay disconnect, gateway
26
+ * shutdown). A dedicated code because the natural 1001 (going away) cannot
27
+ * be sent through the JS `close()` API (the bridge would remap it to a
28
+ * misleading 4001), and Bun's WebSocket client drops close reasons, so the
29
+ * code is the only signal that survives the relay to the daemon.
30
+ */
31
+ export const GATEWAY_TUNNEL_LOST_WS_CLOSE_CODE = 4801;
32
+
23
33
  export function normalizeHttpPublicBaseUrl(value: unknown): string | undefined {
24
34
  if (typeof value !== "string") return undefined;
25
35
  const trimmed = value.trim();
@@ -20,6 +20,16 @@ export function normalizePublicBaseUrl(value: unknown): string | undefined {
20
20
  return normalized.length > 0 ? normalized : undefined;
21
21
  }
22
22
 
23
+ /**
24
+ * Application close code the gateway's velay bridge sends to proxied
25
+ * WebSockets when the tunnel itself is lost (velay disconnect, gateway
26
+ * shutdown). A dedicated code because the natural 1001 (going away) cannot
27
+ * be sent through the JS `close()` API (the bridge would remap it to a
28
+ * misleading 4001), and Bun's WebSocket client drops close reasons, so the
29
+ * code is the only signal that survives the relay to the daemon.
30
+ */
31
+ export const GATEWAY_TUNNEL_LOST_WS_CLOSE_CODE = 4801;
32
+
23
33
  export function normalizeHttpPublicBaseUrl(value: unknown): string | undefined {
24
34
  if (typeof value !== "string") return undefined;
25
35
  const trimmed = value.trim();
@@ -20,6 +20,16 @@ export function normalizePublicBaseUrl(value: unknown): string | undefined {
20
20
  return normalized.length > 0 ? normalized : undefined;
21
21
  }
22
22
 
23
+ /**
24
+ * Application close code the gateway's velay bridge sends to proxied
25
+ * WebSockets when the tunnel itself is lost (velay disconnect, gateway
26
+ * shutdown). A dedicated code because the natural 1001 (going away) cannot
27
+ * be sent through the JS `close()` API (the bridge would remap it to a
28
+ * misleading 4001), and Bun's WebSocket client drops close reasons, so the
29
+ * code is the only signal that survives the relay to the daemon.
30
+ */
31
+ export const GATEWAY_TUNNEL_LOST_WS_CLOSE_CODE = 4801;
32
+
23
33
  export function normalizeHttpPublicBaseUrl(value: unknown): string | undefined {
24
34
  if (typeof value !== "string") return undefined;
25
35
  const trimmed = value.trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/assistant",
3
- "version": "0.11.2-dev.202608051734.355dff7",
3
+ "version": "0.11.2-dev.202608051838.a2809c6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -92,6 +92,7 @@ function makeCtx(overrides: Partial<Conversation> = {}): Conversation {
92
92
  conversationId: "conv-test",
93
93
  currentRequestId: "req-1",
94
94
  workingDir: "/tmp/test",
95
+ getTurnActorPrincipalId: () => undefined,
95
96
  abortController: null,
96
97
  sendToClient: mock(() => {}),
97
98
  pendingSurfaceActions: new Map(),
@@ -99,6 +99,7 @@ function makeCtx(overrides: Partial<Conversation> = {}): Conversation {
99
99
  conversationId: "conv-test",
100
100
  currentRequestId: "req-1",
101
101
  workingDir: "/tmp/test",
102
+ getTurnActorPrincipalId: () => undefined,
102
103
  abortController: null,
103
104
  sendToClient: mock(() => {}),
104
105
  pendingSurfaceActions: new Map(),
@@ -402,3 +403,63 @@ describe("createToolExecutor channel-permission coordinate threading", () => {
402
403
  expect(bindingLookups).toEqual([]);
403
404
  });
404
405
  });
406
+
407
+ describe("createToolExecutor source-actor threading", () => {
408
+ test("submits the turn's actor principal, not the trust context's guardian", async () => {
409
+ // `ToolContext.sourceActorPrincipalId` is compared against the principal a
410
+ // client registered with on its SSE stream, so it has to be the turn's
411
+ // actor. Reading `trustContext.guardianPrincipalId` instead meant any turn
412
+ // whose trust resolution degraded submitted nothing, and the same-actor
413
+ // gate rejected it as a user mismatch.
414
+ const { executor, calls } = makeCapturingExecutor();
415
+ await makeToolFn(
416
+ executor,
417
+ makeCtx({
418
+ getTurnActorPrincipalId: () => "actor-1",
419
+ currentTurnTrustContext: {
420
+ sourceChannel: "vellum",
421
+ trustClass: "guardian",
422
+ guardianPrincipalId: "guardian-1",
423
+ },
424
+ }),
425
+ )("file_read", { path: "/tmp/a" });
426
+
427
+ expect(calls[0].context.sourceActorPrincipalId).toBe("actor-1");
428
+ });
429
+
430
+ test("carries the actor through even when trust resolved without a guardian principal", async () => {
431
+ // The regression: degraded trust resolution (unreachable gateway, binding
432
+ // drift) or a service-principal turn leaves `guardianPrincipalId` unset
433
+ // while the turn's actor is perfectly well known.
434
+ const { executor, calls } = makeCapturingExecutor();
435
+ await makeToolFn(
436
+ executor,
437
+ makeCtx({
438
+ getTurnActorPrincipalId: () => "actor-1",
439
+ currentTurnTrustContext: {
440
+ sourceChannel: "vellum",
441
+ trustClass: "unknown",
442
+ },
443
+ }),
444
+ )("file_read", { path: "/tmp/a" });
445
+
446
+ expect(calls[0].context.sourceActorPrincipalId).toBe("actor-1");
447
+ });
448
+
449
+ test("submits nothing when the turn has no actor identity at all", async () => {
450
+ const { executor, calls } = makeCapturingExecutor();
451
+ await makeToolFn(
452
+ executor,
453
+ makeCtx({
454
+ getTurnActorPrincipalId: () => undefined,
455
+ currentTurnTrustContext: {
456
+ sourceChannel: "vellum",
457
+ trustClass: "guardian",
458
+ guardianPrincipalId: "guardian-1",
459
+ },
460
+ }),
461
+ )("file_read", { path: "/tmp/a" });
462
+
463
+ expect(calls[0].context.sourceActorPrincipalId).toBeUndefined();
464
+ });
465
+ });
@@ -705,9 +705,7 @@ describe("surfaceProxyResolver — CU tool routing", () => {
705
705
  });
706
706
 
707
707
  expect(result.isError).toBe(true);
708
- expect(result.content).toContain(
709
- "Submitting actor does not match the target client's actor",
710
- );
708
+ expect(result.content).toContain("signed in as a different user");
711
709
  // No state mutation, no dispatch.
712
710
  expect(proxy.stepCount).toBe(0);
713
711
  expect(proxy.actionHistory).toHaveLength(0);
@@ -734,9 +732,7 @@ describe("surfaceProxyResolver — CU tool routing", () => {
734
732
  });
735
733
 
736
734
  expect(result.isError).toBe(true);
737
- expect(result.content).toContain(
738
- "Submitting actor does not match the target client's actor",
739
- );
735
+ expect(result.content).toContain("no authenticated actor");
740
736
  expect(sentMessages).toHaveLength(0);
741
737
  });
742
738
 
@@ -11,6 +11,7 @@ import { join } from "node:path";
11
11
  import { afterEach, describe, expect, test } from "bun:test";
12
12
 
13
13
  import {
14
+ DEFAULT_READ_LINE_LIMIT,
14
15
  FileSystemOps,
15
16
  type PathPolicy,
16
17
  } from "../tools/shared/filesystem/file-ops-service.js";
@@ -124,10 +125,80 @@ describe("FileSystemOps.readFileSafe", () => {
124
125
  if (!result.ok) {
125
126
  return;
126
127
  }
127
- expect(result.value.content).toContain("b");
128
- expect(result.value.content).toContain("c");
129
- expect(result.value.content).not.toContain(" 1");
130
- expect(result.value.content).not.toContain("d");
128
+ // Assert on the numbered lines rather than bare letters: the truncation
129
+ // notice is prose, so a bare `toContain("d")` matches its wording.
130
+ const [body] = result.value.content.split("\n\n[Truncated:");
131
+ expect(body).toContain(" 2 b");
132
+ expect(body).toContain(" 3 c");
133
+ expect(body).not.toContain(" 1 a");
134
+ expect(body).not.toContain(" 4 d");
135
+ });
136
+
137
+ test("caps an unbounded read at the default line limit and says so", async () => {
138
+ const dir = makeTempDir();
139
+ const total = DEFAULT_READ_LINE_LIMIT + 500;
140
+ const lines = Array.from({ length: total }, (_, i) => `line${i + 1}`);
141
+ writeFileSync(join(dir, "big.txt"), lines.join("\n"));
142
+ const ops = new FileSystemOps(sandboxPolicyFor(dir));
143
+
144
+ const result = await ops.readFileSafe({ path: "big.txt" });
145
+ expect(result.ok).toBe(true);
146
+ if (!result.ok) {
147
+ return;
148
+ }
149
+ const content = result.value.content;
150
+ expect(content).toContain(` ${DEFAULT_READ_LINE_LIMIT} line2000`);
151
+ expect(content).not.toContain("line2001");
152
+ expect(content).toContain(
153
+ `[Truncated: showing through line ${DEFAULT_READ_LINE_LIMIT} of ${total}. Read on with offset=${DEFAULT_READ_LINE_LIMIT + 1}`,
154
+ );
155
+ });
156
+
157
+ test("an explicit limit is honored rather than replaced by the default", async () => {
158
+ const dir = makeTempDir();
159
+ const lines = Array.from(
160
+ { length: DEFAULT_READ_LINE_LIMIT + 500 },
161
+ (_, i) => `line${i + 1}`,
162
+ );
163
+ writeFileSync(join(dir, "big.txt"), lines.join("\n"));
164
+ const ops = new FileSystemOps(sandboxPolicyFor(dir));
165
+
166
+ const result = await ops.readFileSafe({
167
+ path: "big.txt",
168
+ limit: DEFAULT_READ_LINE_LIMIT + 500,
169
+ });
170
+ expect(result.ok).toBe(true);
171
+ if (!result.ok) {
172
+ return;
173
+ }
174
+ expect(result.value.content).toContain("line2500");
175
+ expect(result.value.content).not.toContain("[Truncated:");
176
+ });
177
+
178
+ test("a read that reaches the last line carries no truncation notice", async () => {
179
+ const dir = makeTempDir();
180
+ writeFileSync(join(dir, "small.txt"), "a\nb\nc");
181
+ const ops = new FileSystemOps(sandboxPolicyFor(dir));
182
+
183
+ const result = await ops.readFileSafe({ path: "small.txt" });
184
+ expect(result.ok).toBe(true);
185
+ if (!result.ok) {
186
+ return;
187
+ }
188
+ expect(result.value.content).not.toContain("[Truncated:");
189
+ });
190
+
191
+ test("paging past the end is not reported as truncation", async () => {
192
+ const dir = makeTempDir();
193
+ writeFileSync(join(dir, "small.txt"), "a\nb\nc");
194
+ const ops = new FileSystemOps(sandboxPolicyFor(dir));
195
+
196
+ const result = await ops.readFileSafe({ path: "small.txt", offset: 100 });
197
+ expect(result.ok).toBe(true);
198
+ if (!result.ok) {
199
+ return;
200
+ }
201
+ expect(result.value.content).not.toContain("[Truncated:");
131
202
  });
132
203
  });
133
204
 
@@ -742,8 +742,11 @@ describe("HostBashProxy", () => {
742
742
  });
743
743
 
744
744
  describe("same-user binding (sourceActorPrincipalId)", () => {
745
- const SAME_USER_REJECTION =
746
- "Submitting actor does not match the target client's actor for this request. The targeted client's authenticated user must submit the result.";
745
+ // The proxy path names which comparison failed, so each rejection asserts
746
+ // its own reason — a turn with no actor, a client registered without one,
747
+ // and two genuinely different users are three different problems.
748
+ const CROSS_USER_REJECTION =
749
+ "Submitting actor does not match the target client's actor for this request. The target client is signed in as a different user — run `assistant clients list` to see which connected clients you own.";
747
750
 
748
751
  test("same-user targeted request succeeds", async () => {
749
752
  setup();
@@ -784,7 +787,7 @@ describe("HostBashProxy", () => {
784
787
  );
785
788
 
786
789
  expect(result.isError).toBe(true);
787
- expect(result.content).toBe(SAME_USER_REJECTION);
790
+ expect(result.content).toBe(CROSS_USER_REJECTION);
788
791
  // No broadcast and no pending registration
789
792
  expect(sentMessages).toHaveLength(0);
790
793
  });
@@ -807,7 +810,9 @@ describe("HostBashProxy", () => {
807
810
  );
808
811
 
809
812
  expect(result.isError).toBe(true);
810
- expect(result.content).toBe(SAME_USER_REJECTION);
813
+ expect(result.content).toContain(
814
+ "registered without an authenticated user",
815
+ );
811
816
  expect(sentMessages).toHaveLength(0);
812
817
  });
813
818
 
@@ -823,7 +828,7 @@ describe("HostBashProxy", () => {
823
828
  );
824
829
 
825
830
  expect(result.isError).toBe(true);
826
- expect(result.content).toBe(SAME_USER_REJECTION);
831
+ expect(result.content).toContain("no authenticated actor");
827
832
  expect(sentMessages).toHaveLength(0);
828
833
  });
829
834
 
@@ -867,7 +867,7 @@ describe("HostBrowserProxy", () => {
867
867
  );
868
868
 
869
869
  expect(result.isError).toBe(true);
870
- expect(result.content).toContain("Submitting actor does not match");
870
+ expect(result.content).toContain("signed in as a different user");
871
871
  expect(getPublishedMessages()).toHaveLength(0);
872
872
  });
873
873
 
@@ -1054,7 +1054,7 @@ describe("HostBrowserProxy", () => {
1054
1054
  );
1055
1055
 
1056
1056
  expect(result.isError).toBe(true);
1057
- expect(result.content).toContain("Submitting actor does not match");
1057
+ expect(result.content).toContain("signed in as a different user");
1058
1058
  expect(result.content).not.toContain("extension_required");
1059
1059
  expect(getPublishedMessages()).toHaveLength(0);
1060
1060
  });
@@ -1416,9 +1416,7 @@ describe("HostCuProxy", () => {
1416
1416
  );
1417
1417
 
1418
1418
  expect(result.isError).toBe(true);
1419
- expect(result.content).toContain(
1420
- "Submitting actor does not match the target client's actor",
1421
- );
1419
+ expect(result.content).toContain("signed in as a different user");
1422
1420
  expect(sentMessages).toHaveLength(0);
1423
1421
  });
1424
1422
 
@@ -1444,9 +1442,7 @@ describe("HostCuProxy", () => {
1444
1442
  );
1445
1443
 
1446
1444
  expect(result.isError).toBe(true);
1447
- expect(result.content).toContain(
1448
- "Submitting actor does not match the target client's actor",
1449
- );
1445
+ expect(result.content).toContain("no authenticated actor");
1450
1446
  expect(sentMessages).toHaveLength(0);
1451
1447
  });
1452
1448
 
@@ -1473,7 +1469,7 @@ describe("HostCuProxy", () => {
1473
1469
 
1474
1470
  expect(result.isError).toBe(true);
1475
1471
  expect(result.content).toContain(
1476
- "Submitting actor does not match the target client's actor",
1472
+ "registered without an authenticated user",
1477
1473
  );
1478
1474
  expect(sentMessages).toHaveLength(0);
1479
1475
  });
@@ -693,9 +693,7 @@ describe("HostFileProxy", () => {
693
693
  );
694
694
 
695
695
  expect(result.isError).toBe(true);
696
- expect(result.content).toContain(
697
- "Submitting actor does not match the target client's actor",
698
- );
696
+ expect(result.content).toContain("signed in as a different user");
699
697
  // No host_file_request was broadcast.
700
698
  expect(sentMessages).toHaveLength(0);
701
699
  });
@@ -720,7 +718,7 @@ describe("HostFileProxy", () => {
720
718
 
721
719
  expect(result.isError).toBe(true);
722
720
  expect(result.content).toContain(
723
- "Submitting actor does not match the target client's actor",
721
+ "registered without an authenticated user",
724
722
  );
725
723
  expect(sentMessages).toHaveLength(0);
726
724
  });
@@ -744,9 +742,7 @@ describe("HostFileProxy", () => {
744
742
  );
745
743
 
746
744
  expect(result.isError).toBe(true);
747
- expect(result.content).toContain(
748
- "Submitting actor does not match the target client's actor",
749
- );
745
+ expect(result.content).toContain("no authenticated actor");
750
746
  expect(sentMessages).toHaveLength(0);
751
747
  });
752
748
 
@@ -27,6 +27,7 @@ mock.module("../daemon/host-file-proxy.js", () => ({
27
27
  }));
28
28
 
29
29
  import { hostFileReadTool } from "../tools/host-filesystem/read.js";
30
+ import { DEFAULT_READ_LINE_LIMIT } from "../tools/shared/filesystem/file-ops-service.js";
30
31
  import type { ToolContext } from "../tools/types.js";
31
32
 
32
33
  const testDirs: string[] = [];
@@ -226,13 +227,16 @@ describe("host_file_read image support", () => {
226
227
 
227
228
  expect(result.isError).toBe(false);
228
229
  expect(result.contentBlocks).toHaveLength(1);
230
+ // The proxied request carries the resolved default window, so a host read
231
+ // is bounded by the same limit as a local one rather than streaming a
232
+ // whole file across the bridge.
229
233
  expect(requests).toEqual([
230
234
  {
231
235
  input: {
232
236
  operation: "read",
233
237
  path: "/host/screenshot.png",
234
238
  offset: undefined,
235
- limit: undefined,
239
+ limit: DEFAULT_READ_LINE_LIMIT,
236
240
  },
237
241
  conversationId: "test-conversation",
238
242
  signal: undefined,
@@ -709,7 +709,7 @@ describe("HostTransferProxy — targetClientId", () => {
709
709
  );
710
710
 
711
711
  expect(result.isError).toBe(true);
712
- expect(result.content).toContain("does not match");
712
+ expect(result.content).toContain("signed in as a different user");
713
713
  expect(sentMessages).toHaveLength(0);
714
714
  });
715
715
 
@@ -738,7 +738,7 @@ describe("HostTransferProxy — targetClientId", () => {
738
738
  );
739
739
 
740
740
  expect(result.isError).toBe(true);
741
- expect(result.content).toContain("does not match");
741
+ expect(result.content).toContain("no authenticated actor");
742
742
  expect(sentMessages).toHaveLength(0);
743
743
  });
744
744
 
@@ -767,7 +767,9 @@ describe("HostTransferProxy — targetClientId", () => {
767
767
  );
768
768
 
769
769
  expect(result.isError).toBe(true);
770
- expect(result.content).toContain("does not match");
770
+ expect(result.content).toContain(
771
+ "registered without an authenticated user",
772
+ );
771
773
  expect(sentMessages).toHaveLength(0);
772
774
  });
773
775
 
@@ -863,7 +865,7 @@ describe("HostTransferProxy — targetClientId", () => {
863
865
  );
864
866
 
865
867
  expect(result.isError).toBe(true);
866
- expect(result.content).toContain("does not match");
868
+ expect(result.content).toContain("signed in as a different user");
867
869
  expect(sentMessages).toHaveLength(0);
868
870
  });
869
871
 
@@ -406,6 +406,8 @@ mock.module("../calls/access-request-wait.js", () => ({
406
406
  // Now import the module under test.
407
407
  // ---------------------------------------------------------------------------
408
408
 
409
+ import { GATEWAY_TUNNEL_LOST_WS_CLOSE_CODE } from "@vellumai/service-contracts/ingress";
410
+
409
411
  import { revokeScopedApprovalGrantsForContext } from "../approvals/scoped-approval-grants.js";
410
412
  import { CallController } from "../calls/call-controller.js";
411
413
  import { postPointerMessageSafe } from "../calls/call-pointer-messages.js";
@@ -746,6 +748,40 @@ describe("MediaStreamCallSession", () => {
746
748
  );
747
749
  });
748
750
 
751
+ test("tunnel-lost close code decodes to a readable failure detail", () => {
752
+ const mock = createMockWs();
753
+ mockSessions.set("call-1", {
754
+ id: "call-1",
755
+ conversationId: "conv-1",
756
+ status: "in_progress",
757
+ startedAt: Date.now() - 60000,
758
+ toNumber: "+16175550142",
759
+ initiatedFromConversationId: "conv-origin",
760
+ });
761
+
762
+ const session = new MediaStreamCallSession(mock.ws, "call-1");
763
+ // The gateway's close reason is dropped in relay, so only the code
764
+ // arrives; it must decode to something a human can act on.
765
+ session.handleTransportClosed(GATEWAY_TUNNEL_LOST_WS_CLOSE_CODE);
766
+
767
+ expect(updateCallSession).toHaveBeenCalledWith(
768
+ "call-1",
769
+ expect.objectContaining({
770
+ status: "failed",
771
+ lastError:
772
+ "Media stream WebSocket closed unexpectedly: public ingress tunnel disconnected",
773
+ }),
774
+ );
775
+ expect(postPointerMessageSafe).toHaveBeenCalledWith(
776
+ "conv-origin",
777
+ "failed",
778
+ "+16175550142",
779
+ expect.objectContaining({
780
+ reason: "public ingress tunnel disconnected",
781
+ }),
782
+ );
783
+ });
784
+
749
785
  test("close on already-terminal session is a no-op", () => {
750
786
  const mock = createMockWs();
751
787
  mockSessions.set("call-1", {
@@ -129,3 +129,41 @@ describe("web STT language catalog stays in sync with the daemon roster", () =>
129
129
  expect(nonExtended).toEqual(expected);
130
130
  });
131
131
  });
132
+
133
+ /**
134
+ * The settings skill accepts plain language names ("tamil", "hindi") and its
135
+ * tool description advertises that, so a roster code with no English-name
136
+ * alias is reachable only by someone who knows the raw BCP-47 code. Adding a
137
+ * language to the roster without its alias is the easy half-step, so pin the
138
+ * two together the same way the catalog copies are pinned.
139
+ */
140
+ const SETTINGS_TOOL_SOURCE = readFileSync(
141
+ join(
142
+ REPO_ROOT,
143
+ "assistant/src/config/bundled-skills/settings/tools/voice-config-update.ts",
144
+ ),
145
+ "utf-8",
146
+ );
147
+
148
+ describe("settings-skill language aliases", () => {
149
+ test("every roster language is reachable by an English name", () => {
150
+ const aliasBlockStart = SETTINGS_TOOL_SOURCE.indexOf(
151
+ "const STT_LANGUAGE_ALIASES",
152
+ );
153
+ expect(aliasBlockStart).toBeGreaterThan(-1);
154
+ const aliasBlockEnd = SETTINGS_TOOL_SOURCE.indexOf("};", aliasBlockStart);
155
+ const aliasBlock = SETTINGS_TOOL_SOURCE.slice(
156
+ aliasBlockStart,
157
+ aliasBlockEnd,
158
+ );
159
+ // Every value in the alias map, i.e. the codes a plain name can reach.
160
+ const aliasedCodes = new Set(
161
+ [...aliasBlock.matchAll(/:\s*"([a-z-]+)"/g)].map((match) => match[1]),
162
+ );
163
+
164
+ const unreachable = DEEPGRAM_NOVA3_MONOLINGUAL_CODES.filter(
165
+ (code) => !aliasedCodes.has(code),
166
+ );
167
+ expect(unreachable).toEqual([]);
168
+ });
169
+ });
@@ -116,6 +116,7 @@ function makeSetupCtx(overrides: Partial<Conversation> = {}): Conversation {
116
116
  conversationId: "conv-test",
117
117
  currentRequestId: "req-1",
118
118
  workingDir: "/tmp/test",
119
+ getTurnActorPrincipalId: () => undefined,
119
120
  abortController: null,
120
121
  sendToClient: mock(() => {}),
121
122
  pendingSurfaceActions: new Map(),