@vellumai/assistant 0.4.32 → 0.4.34

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 (186) hide show
  1. package/docs/architecture/memory.md +1 -1
  2. package/package.json +1 -1
  3. package/src/__tests__/access-request-decision.test.ts +85 -4
  4. package/src/__tests__/actor-token-service.test.ts +4 -12
  5. package/src/__tests__/approval-primitive.test.ts +0 -45
  6. package/src/__tests__/approval-routes-http.test.ts +0 -1
  7. package/src/__tests__/assistant-id-boundary-guard.test.ts +150 -0
  8. package/src/__tests__/call-controller.test.ts +0 -1
  9. package/src/__tests__/call-routes-http.test.ts +0 -1
  10. package/src/__tests__/callback-handoff-copy.test.ts +0 -1
  11. package/src/__tests__/channel-approval-routes.test.ts +5 -45
  12. package/src/__tests__/channel-guardian.test.ts +122 -346
  13. package/src/__tests__/channel-invite-transport.test.ts +52 -40
  14. package/src/__tests__/commit-message-enrichment-service.test.ts +4 -38
  15. package/src/__tests__/computer-use-session-working-dir.test.ts +0 -1
  16. package/src/__tests__/confirmation-request-guardian-bridge.test.ts +4 -3
  17. package/src/__tests__/contacts-tools.test.ts +4 -5
  18. package/src/__tests__/conversation-attention-store.test.ts +2 -65
  19. package/src/__tests__/conversation-attention-telegram.test.ts +0 -2
  20. package/src/__tests__/conversation-pairing.test.ts +0 -1
  21. package/src/__tests__/credential-security-invariants.test.ts +1 -0
  22. package/src/__tests__/deterministic-verification-control-plane.test.ts +0 -3
  23. package/src/__tests__/guardian-action-conversation-turn.test.ts +1 -7
  24. package/src/__tests__/guardian-action-followup-executor.test.ts +0 -1
  25. package/src/__tests__/guardian-action-grant-mint-consume.test.ts +0 -74
  26. package/src/__tests__/guardian-action-late-reply.test.ts +1 -8
  27. package/src/__tests__/guardian-dispatch.test.ts +0 -1
  28. package/src/__tests__/guardian-grant-minting.test.ts +0 -1
  29. package/src/__tests__/guardian-outbound-http.test.ts +0 -1
  30. package/src/__tests__/guardian-routing-state.test.ts +0 -3
  31. package/src/__tests__/handlers-telegram-config.test.ts +0 -1
  32. package/src/__tests__/inbound-invite-redemption.test.ts +1 -7
  33. package/src/__tests__/ingress-reconcile.test.ts +3 -36
  34. package/src/__tests__/migration-cross-version-compatibility.test.ts +0 -1
  35. package/src/__tests__/migration-export-http.test.ts +0 -1
  36. package/src/__tests__/migration-import-commit-http.test.ts +0 -1
  37. package/src/__tests__/migration-import-preflight-http.test.ts +0 -1
  38. package/src/__tests__/migration-validate-http.test.ts +0 -1
  39. package/src/__tests__/non-member-access-request.test.ts +0 -8
  40. package/src/__tests__/notification-broadcaster.test.ts +1 -2
  41. package/src/__tests__/notification-decision-fallback.test.ts +0 -2
  42. package/src/__tests__/notification-decision-strategy.test.ts +0 -1
  43. package/src/__tests__/notification-guardian-path.test.ts +0 -1
  44. package/src/__tests__/notification-telegram-adapter.test.ts +0 -4
  45. package/src/__tests__/relay-server.test.ts +151 -80
  46. package/src/__tests__/sandbox-host-parity.test.ts +5 -2
  47. package/src/__tests__/scoped-approval-grants.test.ts +9 -40
  48. package/src/__tests__/scoped-grant-security-matrix.test.ts +0 -36
  49. package/src/__tests__/send-endpoint-busy.test.ts +0 -1
  50. package/src/__tests__/send-notification-tool.test.ts +0 -1
  51. package/src/__tests__/session-init.benchmark.test.ts +0 -2
  52. package/src/__tests__/slack-channel-config.test.ts +0 -1
  53. package/src/__tests__/slack-inbound-verification.test.ts +2 -5
  54. package/src/__tests__/sms-messaging-provider.test.ts +0 -4
  55. package/src/__tests__/terminal-tools.test.ts +5 -2
  56. package/src/__tests__/thread-seed-composer.test.ts +0 -1
  57. package/src/__tests__/tool-approval-handler.test.ts +0 -1
  58. package/src/__tests__/tool-grant-request-escalation.test.ts +0 -4
  59. package/src/__tests__/trusted-contact-approval-notifier.test.ts +65 -77
  60. package/src/__tests__/trusted-contact-inline-approval-integration.test.ts +0 -1
  61. package/src/__tests__/trusted-contact-lifecycle-notifications.test.ts +1 -18
  62. package/src/__tests__/trusted-contact-multichannel.test.ts +0 -14
  63. package/src/__tests__/trusted-contact-verification.test.ts +3 -16
  64. package/src/__tests__/twilio-routes.test.ts +2 -3
  65. package/src/__tests__/update-bulletin.test.ts +0 -2
  66. package/src/__tests__/user-reference.test.ts +47 -1
  67. package/src/__tests__/voice-invite-redemption.test.ts +0 -1
  68. package/src/__tests__/voice-scoped-grant-consumer.test.ts +0 -38
  69. package/src/__tests__/workspace-git-service.test.ts +2 -2
  70. package/src/approvals/approval-primitive.ts +0 -15
  71. package/src/approvals/guardian-decision-primitive.ts +0 -3
  72. package/src/approvals/guardian-request-resolvers.ts +0 -5
  73. package/src/calls/call-domain.ts +0 -3
  74. package/src/calls/call-store.ts +0 -3
  75. package/src/calls/guardian-action-sweep.ts +2 -1
  76. package/src/calls/guardian-dispatch.ts +1 -2
  77. package/src/calls/relay-access-wait.ts +0 -4
  78. package/src/calls/relay-server.ts +8 -66
  79. package/src/calls/relay-setup-router.ts +1 -2
  80. package/src/calls/relay-verification.ts +0 -1
  81. package/src/calls/twilio-routes.ts +0 -3
  82. package/src/calls/types.ts +0 -1
  83. package/src/calls/voice-session-bridge.ts +0 -1
  84. package/src/channels/config.ts +41 -2
  85. package/src/config/bundled-skills/notifications/tools/send-notification.ts +0 -1
  86. package/src/config/bundled-skills/slack/SKILL.md +2 -0
  87. package/src/config/bundled-skills/slack-digest-setup/SKILL.md +164 -0
  88. package/src/config/env.ts +0 -4
  89. package/src/config/feature-flag-registry.json +4 -4
  90. package/src/config/user-reference.ts +47 -9
  91. package/src/contacts/contact-store.ts +13 -88
  92. package/src/contacts/contacts-write.ts +3 -11
  93. package/src/contacts/types.ts +0 -1
  94. package/src/daemon/handlers/config-channels.ts +19 -44
  95. package/src/daemon/handlers/config-inbox.ts +6 -6
  96. package/src/daemon/handlers/contacts.ts +8 -12
  97. package/src/daemon/handlers/index.ts +0 -2
  98. package/src/daemon/lifecycle.ts +18 -26
  99. package/src/daemon/session-process.ts +0 -4
  100. package/src/memory/channel-delivery-store.ts +1 -0
  101. package/src/memory/conversation-attention-store.ts +4 -19
  102. package/src/memory/conversation-crud.ts +0 -2
  103. package/src/memory/db-init.ts +8 -0
  104. package/src/memory/delivery-crud.ts +13 -0
  105. package/src/memory/guardian-action-store.ts +0 -12
  106. package/src/memory/guardian-approvals.ts +35 -80
  107. package/src/memory/guardian-rate-limits.ts +1 -14
  108. package/src/memory/guardian-verification.ts +6 -34
  109. package/src/memory/invite-store.ts +76 -15
  110. package/src/memory/migrations/040-invite-code-hash-column.ts +16 -0
  111. package/src/memory/migrations/134-contacts-notes-column.ts +64 -45
  112. package/src/memory/migrations/136-drop-assistant-id-columns.ts +263 -0
  113. package/src/memory/migrations/index.ts +2 -0
  114. package/src/memory/migrations/registry.ts +14 -1
  115. package/src/memory/schema/calls.ts +0 -7
  116. package/src/memory/schema/contacts.ts +2 -8
  117. package/src/memory/schema/guardian.ts +0 -5
  118. package/src/memory/schema/infrastructure.ts +0 -2
  119. package/src/memory/schema/notifications.ts +3 -17
  120. package/src/memory/scoped-approval-grants.ts +2 -24
  121. package/src/notifications/adapters/sms.ts +2 -1
  122. package/src/notifications/broadcaster.ts +1 -6
  123. package/src/notifications/decision-engine.ts +3 -4
  124. package/src/notifications/deliveries-store.ts +0 -4
  125. package/src/notifications/destination-resolver.ts +4 -6
  126. package/src/notifications/deterministic-checks.ts +1 -6
  127. package/src/notifications/emit-signal.ts +4 -11
  128. package/src/notifications/events-store.ts +7 -17
  129. package/src/notifications/preference-summary.ts +2 -2
  130. package/src/notifications/preferences-store.ts +2 -9
  131. package/src/notifications/signal.ts +0 -1
  132. package/src/notifications/thread-candidates.ts +1 -11
  133. package/src/notifications/types.ts +0 -3
  134. package/src/runtime/access-request-helper.ts +3 -10
  135. package/src/runtime/actor-refresh-token-store.ts +0 -6
  136. package/src/runtime/actor-token-store.ts +3 -16
  137. package/src/runtime/actor-trust-resolver.ts +1 -4
  138. package/src/runtime/auth/__tests__/credential-service.test.ts +0 -9
  139. package/src/runtime/auth/__tests__/guard-tests.test.ts +1 -3
  140. package/src/runtime/auth/credential-service.ts +1 -15
  141. package/src/runtime/auth/require-bound-guardian.ts +1 -4
  142. package/src/runtime/auth/token-service.ts +50 -0
  143. package/src/runtime/channel-guardian-service.ts +16 -49
  144. package/src/runtime/channel-invite-transport.ts +129 -34
  145. package/src/runtime/channel-invite-transports/email.ts +54 -0
  146. package/src/runtime/channel-invite-transports/slack.ts +87 -0
  147. package/src/runtime/channel-invite-transports/sms.ts +74 -0
  148. package/src/runtime/channel-invite-transports/telegram.ts +35 -11
  149. package/src/runtime/channel-invite-transports/voice.ts +12 -12
  150. package/src/runtime/confirmation-request-guardian-bridge.ts +0 -1
  151. package/src/runtime/guardian-action-followup-executor.ts +3 -2
  152. package/src/runtime/guardian-action-grant-minter.ts +0 -1
  153. package/src/runtime/guardian-outbound-actions.ts +2 -12
  154. package/src/runtime/guardian-vellum-migration.ts +2 -3
  155. package/src/runtime/http-server.ts +0 -1
  156. package/src/runtime/invite-redemption-service.ts +191 -11
  157. package/src/runtime/invite-redemption-templates.ts +6 -6
  158. package/src/runtime/invite-service.ts +81 -11
  159. package/src/runtime/local-actor-identity.ts +2 -5
  160. package/src/runtime/routes/access-request-decision.ts +52 -7
  161. package/src/runtime/routes/approval-strategies/guardian-callback-strategy.ts +6 -9
  162. package/src/runtime/routes/channel-readiness-routes.ts +29 -18
  163. package/src/runtime/routes/contact-routes.ts +48 -46
  164. package/src/runtime/routes/conversation-attention-routes.ts +0 -2
  165. package/src/runtime/routes/global-search-routes.ts +0 -2
  166. package/src/runtime/routes/guardian-bootstrap-routes.ts +6 -12
  167. package/src/runtime/routes/guardian-expiry-sweep.ts +3 -2
  168. package/src/runtime/routes/inbound-message-handler.ts +1 -6
  169. package/src/runtime/routes/inbound-stages/acl-enforcement.ts +296 -47
  170. package/src/runtime/routes/inbound-stages/background-dispatch.ts +6 -42
  171. package/src/runtime/routes/inbound-stages/bootstrap-intercept.ts +1 -6
  172. package/src/runtime/routes/inbound-stages/edit-intercept.ts +10 -0
  173. package/src/runtime/routes/inbound-stages/escalation-intercept.ts +0 -1
  174. package/src/runtime/routes/inbound-stages/secret-ingress-check.ts +0 -1
  175. package/src/runtime/routes/inbound-stages/verification-intercept.ts +3 -7
  176. package/src/runtime/routes/invite-routes.ts +1 -0
  177. package/src/runtime/routes/pairing-routes.ts +4 -4
  178. package/src/runtime/tool-grant-request-helper.ts +0 -1
  179. package/src/tools/browser/browser-manager.ts +22 -12
  180. package/src/tools/browser/runtime-check.ts +110 -3
  181. package/src/tools/calls/call-start.ts +1 -3
  182. package/src/tools/followups/followup_create.ts +1 -2
  183. package/src/tools/shared/shell-output.ts +7 -2
  184. package/src/tools/tool-approval-handler.ts +0 -2
  185. package/src/util/platform.ts +0 -4
  186. package/src/workspace/git-service.ts +10 -4
@@ -72,7 +72,6 @@ function grantParams(
72
72
  ): CreateScopedApprovalGrantParams {
73
73
  const futureExpiry = new Date(Date.now() + 60_000).toISOString();
74
74
  return {
75
- assistantId: "self",
76
75
  scopeMode: "request_id",
77
76
  requestChannel: "telegram",
78
77
  decisionChannel: "telegram",
@@ -95,11 +94,7 @@ describe("scoped-approval-grants / request_id scope", () => {
95
94
  expect(grant.status).toBe("active");
96
95
  expect(grant.requestId).toBe("req-1");
97
96
 
98
- const result = consumeScopedApprovalGrantByRequestId(
99
- "req-1",
100
- "consumer-1",
101
- "self",
102
- );
97
+ const result = consumeScopedApprovalGrantByRequestId("req-1", "consumer-1");
103
98
  expect(result.ok).toBe(true);
104
99
  expect(result.grant).not.toBeNull();
105
100
  expect(result.grant!.status).toBe("consumed");
@@ -111,18 +106,10 @@ describe("scoped-approval-grants / request_id scope", () => {
111
106
  grantParams({ scopeMode: "request_id", requestId: "req-2" }),
112
107
  );
113
108
 
114
- const first = consumeScopedApprovalGrantByRequestId(
115
- "req-2",
116
- "consumer-a",
117
- "self",
118
- );
109
+ const first = consumeScopedApprovalGrantByRequestId("req-2", "consumer-a");
119
110
  expect(first.ok).toBe(true);
120
111
 
121
- const second = consumeScopedApprovalGrantByRequestId(
122
- "req-2",
123
- "consumer-b",
124
- "self",
125
- );
112
+ const second = consumeScopedApprovalGrantByRequestId("req-2", "consumer-b");
126
113
  expect(second.ok).toBe(false);
127
114
  expect(second.grant).toBeNull();
128
115
  });
@@ -131,7 +118,6 @@ describe("scoped-approval-grants / request_id scope", () => {
131
118
  const result = consumeScopedApprovalGrantByRequestId(
132
119
  "nonexistent",
133
120
  "consumer-x",
134
- "self",
135
121
  );
136
122
  expect(result.ok).toBe(false);
137
123
  });
@@ -149,7 +135,6 @@ describe("scoped-approval-grants / request_id scope", () => {
149
135
  const result = consumeScopedApprovalGrantByRequestId(
150
136
  "req-expired",
151
137
  "consumer-1",
152
- "self",
153
138
  );
154
139
  expect(result.ok).toBe(false);
155
140
  });
@@ -421,11 +406,7 @@ describe("scoped-approval-grants / expiry", () => {
421
406
  expect(count).toBe(2);
422
407
 
423
408
  // Verify the alive grant is still active
424
- const alive = consumeScopedApprovalGrantByRequestId(
425
- "req-alive",
426
- "c1",
427
- "self",
428
- );
409
+ const alive = consumeScopedApprovalGrantByRequestId("req-alive", "c1");
429
410
  expect(alive.ok).toBe(true);
430
411
  });
431
412
 
@@ -438,7 +419,7 @@ describe("scoped-approval-grants / expiry", () => {
438
419
  expiresAt: new Date(Date.now() + 60_000).toISOString(),
439
420
  }),
440
421
  );
441
- consumeScopedApprovalGrantByRequestId("req-consumed", "c1", "self");
422
+ consumeScopedApprovalGrantByRequestId("req-consumed", "c1");
442
423
 
443
424
  // Force the expiry time to the past for the consumed grant (simulating time passing)
444
425
  // The sweep should not touch consumed grants
@@ -483,15 +464,11 @@ describe("scoped-approval-grants / revoke", () => {
483
464
  expect(count).toBe(2);
484
465
 
485
466
  // Revoked grant cannot be consumed
486
- const revoked = consumeScopedApprovalGrantByRequestId(
487
- "req-r1",
488
- "c1",
489
- "self",
490
- );
467
+ const revoked = consumeScopedApprovalGrantByRequestId("req-r1", "c1");
491
468
  expect(revoked.ok).toBe(false);
492
469
 
493
470
  // Unaffected grant is still consumable
494
- const alive = consumeScopedApprovalGrantByRequestId("req-r3", "c1", "self");
471
+ const alive = consumeScopedApprovalGrantByRequestId("req-r3", "c1");
495
472
  expect(alive.ok).toBe(true);
496
473
  });
497
474
 
@@ -506,11 +483,7 @@ describe("scoped-approval-grants / revoke", () => {
506
483
 
507
484
  revokeScopedApprovalGrantsForContext({ conversationId: "conv-1" });
508
485
 
509
- const result = consumeScopedApprovalGrantByRequestId(
510
- "req-revoke",
511
- "c1",
512
- "self",
513
- );
486
+ const result = consumeScopedApprovalGrantByRequestId("req-revoke", "c1");
514
487
  expect(result.ok).toBe(false);
515
488
  });
516
489
 
@@ -530,11 +503,7 @@ describe("scoped-approval-grants / revoke", () => {
530
503
  );
531
504
 
532
505
  // The grant should still be active (not revoked)
533
- const result = consumeScopedApprovalGrantByRequestId(
534
- "req-guard",
535
- "c1",
536
- "self",
537
- );
506
+ const result = consumeScopedApprovalGrantByRequestId("req-guard", "c1");
538
507
  expect(result.ok).toBe(true);
539
508
  });
540
509
  });
@@ -89,7 +89,6 @@ function grantParams(
89
89
  ): CreateScopedApprovalGrantParams {
90
90
  const futureExpiry = new Date(Date.now() + 60_000).toISOString();
91
91
  return {
92
- assistantId: "self",
93
92
  scopeMode: "tool_signature",
94
93
  toolName: "bash",
95
94
  inputDigest: computeToolApprovalDigest("bash", { cmd: "ls" }),
@@ -338,35 +337,6 @@ describe("security matrix: persistence and fail-closed behavior", () => {
338
337
  describe("security matrix: cross-scope invariants", () => {
339
338
  beforeEach(() => clearTables());
340
339
 
341
- test("grant for one assistant cannot be consumed by another assistant", () => {
342
- const digest = computeToolApprovalDigest("bash", { cmd: "ls" });
343
- createScopedApprovalGrant(
344
- grantParams({
345
- toolName: "bash",
346
- inputDigest: digest,
347
- assistantId: "assistant-alpha",
348
- }),
349
- );
350
-
351
- // Attempt consumption from a different assistant
352
- const wrongAssistant = consumeScopedApprovalGrantByToolSignature({
353
- toolName: "bash",
354
- inputDigest: digest,
355
- consumingRequestId: "c1",
356
- assistantId: "assistant-beta",
357
- });
358
- expect(wrongAssistant.ok).toBe(false);
359
-
360
- // Correct assistant succeeds
361
- const correctAssistant = consumeScopedApprovalGrantByToolSignature({
362
- toolName: "bash",
363
- inputDigest: digest,
364
- consumingRequestId: "c2",
365
- assistantId: "assistant-alpha",
366
- });
367
- expect(correctAssistant.ok).toBe(true);
368
- });
369
-
370
340
  test("all scope fields must match simultaneously for consumption", () => {
371
341
  const digest = computeToolApprovalDigest("bash", { cmd: "ls" });
372
342
 
@@ -375,7 +345,6 @@ describe("security matrix: cross-scope invariants", () => {
375
345
  grantParams({
376
346
  toolName: "bash",
377
347
  inputDigest: digest,
378
- assistantId: "self",
379
348
  executionChannel: "voice",
380
349
  conversationId: "conv-123",
381
350
  callSessionId: "call-456",
@@ -391,7 +360,6 @@ describe("security matrix: cross-scope invariants", () => {
391
360
  toolName: "bash",
392
361
  inputDigest: digest,
393
362
  consumingRequestId: "c-chan",
394
- assistantId: "self",
395
363
  executionChannel: "sms",
396
364
  conversationId: "conv-123",
397
365
  callSessionId: "call-456",
@@ -405,7 +373,6 @@ describe("security matrix: cross-scope invariants", () => {
405
373
  toolName: "bash",
406
374
  inputDigest: digest,
407
375
  consumingRequestId: "c-conv",
408
- assistantId: "self",
409
376
  executionChannel: "voice",
410
377
  conversationId: "conv-999",
411
378
  callSessionId: "call-456",
@@ -419,7 +386,6 @@ describe("security matrix: cross-scope invariants", () => {
419
386
  toolName: "bash",
420
387
  inputDigest: digest,
421
388
  consumingRequestId: "c-call",
422
- assistantId: "self",
423
389
  executionChannel: "voice",
424
390
  conversationId: "conv-123",
425
391
  callSessionId: "call-999",
@@ -433,7 +399,6 @@ describe("security matrix: cross-scope invariants", () => {
433
399
  toolName: "bash",
434
400
  inputDigest: digest,
435
401
  consumingRequestId: "c-user",
436
- assistantId: "self",
437
402
  executionChannel: "voice",
438
403
  conversationId: "conv-123",
439
404
  callSessionId: "call-456",
@@ -447,7 +412,6 @@ describe("security matrix: cross-scope invariants", () => {
447
412
  toolName: "bash",
448
413
  inputDigest: digest,
449
414
  consumingRequestId: "c-all",
450
- assistantId: "self",
451
415
  executionChannel: "voice",
452
416
  conversationId: "conv-123",
453
417
  callSessionId: "call-456",
@@ -295,7 +295,6 @@ describe("POST /v1/messages — queue-if-busy and hub publishing", () => {
295
295
  pendingInteractions.clear();
296
296
 
297
297
  createGuardianBinding({
298
- assistantId: "self",
299
298
  channel: "vellum",
300
299
  guardianExternalUserId: "dev-bypass",
301
300
  guardianDeliveryChatId: "vellum",
@@ -44,7 +44,6 @@ describe("send-notification tool", () => {
44
44
  sourceEventName: "user.send_notification",
45
45
  sourceChannel: "assistant_tool",
46
46
  sourceSessionId: "conv-override",
47
- assistantId: "ast-alpha",
48
47
  attentionHints: {
49
48
  requiresAction: true,
50
49
  urgency: "high",
@@ -107,13 +107,11 @@ mock.module("../util/platform.js", () => ({
107
107
  isWindows: () => process.platform === "win32",
108
108
  getPlatformName: () => process.platform,
109
109
  getClipboardCommand: () => null,
110
- getHttpTokenPath: () => join(testDir, "http-token"),
111
110
  getPlatformTokenPath: () => join(testDir, "platform-token"),
112
111
  getTCPHost: () => "127.0.0.1",
113
112
  getTCPPort: () => 8765,
114
113
  isIOSPairingEnabled: () => false,
115
114
  isTCPEnabled: () => false,
116
- readHttpToken: () => null,
117
115
  readLockfile: () => null,
118
116
  readPlatformToken: () => null,
119
117
  readSessionToken: () => null,
@@ -28,7 +28,6 @@ mock.module("../util/platform.js", () => ({
28
28
  getDbPath: () => join(testDir, "test.db"),
29
29
  getLogPath: () => join(testDir, "test.log"),
30
30
  ensureDataDir: () => {},
31
- readHttpToken: () => undefined,
32
31
  }));
33
32
 
34
33
  mock.module("../util/logger.js", () => ({
@@ -30,7 +30,6 @@ mock.module("../util/platform.js", () => ({
30
30
  getDbPath: () => join(testDir, "test.db"),
31
31
  getLogPath: () => join(testDir, "test.log"),
32
32
  ensureDataDir: () => {},
33
- readHttpToken: () => "test-bearer-token",
34
33
  }));
35
34
 
36
35
  mock.module("../util/logger.js", () => ({
@@ -177,7 +176,7 @@ describe("Slack inbound trusted contact verification", () => {
177
176
  await handleChannelInbound(req, undefined, TEST_BEARER_TOKEN);
178
177
 
179
178
  // An active outbound session should exist for the slack channel
180
- const session = findActiveSession("self", "slack");
179
+ const session = findActiveSession("slack");
181
180
  expect(session).not.toBeNull();
182
181
  expect(session!.expectedExternalUserId).toBe("U0123UNKNOWN");
183
182
  expect(session!.expectedChatId).toBe("U0123UNKNOWN");
@@ -188,7 +187,6 @@ describe("Slack inbound trusted contact verification", () => {
188
187
  test("guardian is notified of the access attempt alongside verification", async () => {
189
188
  // Set up a guardian binding so the notification can target it
190
189
  createGuardianBinding({
191
- assistantId: "self",
192
190
  channel: "slack",
193
191
  guardianExternalUserId: "U_GUARDIAN",
194
192
  guardianDeliveryChatId: "D_GUARDIAN_DM",
@@ -286,7 +284,7 @@ describe("Slack inbound trusted contact verification", () => {
286
284
  const req = buildSlackInboundRequest();
287
285
  await handleChannelInbound(req, undefined, TEST_BEARER_TOKEN);
288
286
 
289
- const session = findActiveSession("self", "slack");
287
+ const session = findActiveSession("slack");
290
288
  expect(session).not.toBeNull();
291
289
 
292
290
  // The challenge hash is stored in the session — extract the secret
@@ -318,7 +316,6 @@ describe("Slack inbound trusted contact verification", () => {
318
316
  await import("../runtime/channel-guardian-service.js");
319
317
 
320
318
  const outboundSession = createOutboundSession({
321
- assistantId: "self",
322
319
  channel: "slack",
323
320
  expectedExternalUserId: "U0123UNKNOWN",
324
321
  expectedChatId: "U0123UNKNOWN",
@@ -33,10 +33,6 @@ mock.module("../security/secure-keys.js", () => ({
33
33
  getSecureKey: (key: string) => secureKeys[key],
34
34
  }));
35
35
 
36
- mock.module("../util/platform.js", () => ({
37
- readHttpToken: () => "runtime-token",
38
- }));
39
-
40
36
  mock.module("../runtime/auth/token-service.js", () => ({
41
37
  mintDaemonDeliveryToken: () => "runtime-token",
42
38
  }));
@@ -711,10 +711,13 @@ describe("formatShellOutput", () => {
711
711
  expect(result.isError).toBe(false);
712
712
  });
713
713
 
714
- test("failed command with no output shows exit code tag", () => {
714
+ test("failed command with no output shows exit code tag and descriptive message", () => {
715
715
  const result = formatShellOutput("", "", 1, false, 120);
716
- expect(result.content).toBe('<command_exit code="1" />');
716
+ expect(result.content).toContain('<command_exit code="1" />');
717
+ expect(result.content).toContain("Command failed with exit code 1");
718
+ expect(result.content).toContain("No stdout or stderr output was produced");
717
719
  expect(result.isError).toBe(true);
720
+ expect(result.status).toContain('<command_exit code="1" />');
718
721
  });
719
722
 
720
723
  test("failed command with output includes exit code in status", () => {
@@ -25,7 +25,6 @@ function makeSignal(
25
25
  ): NotificationSignal {
26
26
  return {
27
27
  signalId: "sig-seed-001",
28
- assistantId: "self",
29
28
  createdAt: Date.now(),
30
29
  sourceChannel: "scheduler",
31
30
  sourceSessionId: "sess-1",
@@ -90,7 +90,6 @@ afterAll(() => {
90
90
  function mintParams(overrides: Partial<MintGrantParams> = {}): MintGrantParams {
91
91
  const futureExpiry = new Date(Date.now() + 60_000).toISOString();
92
92
  return {
93
- assistantId: "self",
94
93
  scopeMode: "tool_signature",
95
94
  requestChannel: "telegram",
96
95
  decisionChannel: "telegram",
@@ -684,7 +684,6 @@ describe("inline wait-and-resume", () => {
684
684
  toolName: "bash",
685
685
  inputDigest: "sha256:waitgrant",
686
686
  consumingRequestId: "consume-1",
687
- assistantId: "self",
688
687
  conversationId: "conv-1",
689
688
  requesterExternalUserId: "requester-1",
690
689
  executionChannel: "telegram",
@@ -727,7 +726,6 @@ describe("inline wait-and-resume", () => {
727
726
  toolName: "bash",
728
727
  inputDigest: "sha256:denywait",
729
728
  consumingRequestId: "consume-1",
730
- assistantId: "self",
731
729
  },
732
730
  { maxWaitMs: 2_000, intervalMs: 20 },
733
731
  );
@@ -759,7 +757,6 @@ describe("inline wait-and-resume", () => {
759
757
  toolName: "bash",
760
758
  inputDigest: "sha256:timeoutwait",
761
759
  consumingRequestId: "consume-1",
762
- assistantId: "self",
763
760
  },
764
761
  { maxWaitMs: 100, intervalMs: 20 },
765
762
  );
@@ -797,7 +794,6 @@ describe("inline wait-and-resume", () => {
797
794
  toolName: "bash",
798
795
  inputDigest: "sha256:abortwait",
799
796
  consumingRequestId: "consume-1",
800
- assistantId: "self",
801
797
  },
802
798
  { maxWaitMs: 5_000, intervalMs: 20, signal: controller.signal },
803
799
  );