@vellumai/assistant 0.4.33 → 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 (137) hide show
  1. package/package.json +1 -1
  2. package/src/__tests__/access-request-decision.test.ts +2 -3
  3. package/src/__tests__/actor-token-service.test.ts +4 -11
  4. package/src/__tests__/approval-primitive.test.ts +0 -45
  5. package/src/__tests__/assistant-id-boundary-guard.test.ts +150 -0
  6. package/src/__tests__/callback-handoff-copy.test.ts +0 -1
  7. package/src/__tests__/channel-approval-routes.test.ts +5 -45
  8. package/src/__tests__/channel-guardian.test.ts +122 -345
  9. package/src/__tests__/confirmation-request-guardian-bridge.test.ts +4 -3
  10. package/src/__tests__/contacts-tools.test.ts +4 -5
  11. package/src/__tests__/conversation-attention-store.test.ts +2 -65
  12. package/src/__tests__/conversation-attention-telegram.test.ts +0 -2
  13. package/src/__tests__/conversation-pairing.test.ts +0 -1
  14. package/src/__tests__/deterministic-verification-control-plane.test.ts +0 -2
  15. package/src/__tests__/guardian-action-conversation-turn.test.ts +1 -7
  16. package/src/__tests__/guardian-action-grant-mint-consume.test.ts +0 -74
  17. package/src/__tests__/guardian-action-late-reply.test.ts +1 -8
  18. package/src/__tests__/guardian-grant-minting.test.ts +0 -1
  19. package/src/__tests__/guardian-routing-state.test.ts +0 -3
  20. package/src/__tests__/inbound-invite-redemption.test.ts +0 -3
  21. package/src/__tests__/non-member-access-request.test.ts +0 -7
  22. package/src/__tests__/notification-broadcaster.test.ts +1 -2
  23. package/src/__tests__/notification-decision-fallback.test.ts +0 -2
  24. package/src/__tests__/notification-decision-strategy.test.ts +0 -1
  25. package/src/__tests__/relay-server.test.ts +11 -83
  26. package/src/__tests__/scoped-approval-grants.test.ts +9 -40
  27. package/src/__tests__/scoped-grant-security-matrix.test.ts +0 -36
  28. package/src/__tests__/send-endpoint-busy.test.ts +0 -1
  29. package/src/__tests__/send-notification-tool.test.ts +0 -1
  30. package/src/__tests__/slack-inbound-verification.test.ts +2 -4
  31. package/src/__tests__/thread-seed-composer.test.ts +0 -1
  32. package/src/__tests__/tool-approval-handler.test.ts +0 -1
  33. package/src/__tests__/tool-grant-request-escalation.test.ts +0 -4
  34. package/src/__tests__/trusted-contact-approval-notifier.test.ts +1 -5
  35. package/src/__tests__/trusted-contact-lifecycle-notifications.test.ts +1 -17
  36. package/src/__tests__/trusted-contact-multichannel.test.ts +0 -13
  37. package/src/__tests__/trusted-contact-verification.test.ts +3 -15
  38. package/src/__tests__/twilio-routes.test.ts +2 -2
  39. package/src/__tests__/voice-invite-redemption.test.ts +0 -1
  40. package/src/__tests__/voice-scoped-grant-consumer.test.ts +0 -37
  41. package/src/approvals/approval-primitive.ts +0 -15
  42. package/src/approvals/guardian-decision-primitive.ts +0 -3
  43. package/src/approvals/guardian-request-resolvers.ts +0 -5
  44. package/src/calls/call-domain.ts +0 -3
  45. package/src/calls/call-store.ts +0 -3
  46. package/src/calls/guardian-action-sweep.ts +2 -1
  47. package/src/calls/guardian-dispatch.ts +1 -2
  48. package/src/calls/relay-access-wait.ts +0 -4
  49. package/src/calls/relay-server.ts +3 -11
  50. package/src/calls/relay-setup-router.ts +1 -2
  51. package/src/calls/relay-verification.ts +0 -1
  52. package/src/calls/twilio-routes.ts +0 -3
  53. package/src/calls/types.ts +0 -1
  54. package/src/calls/voice-session-bridge.ts +0 -1
  55. package/src/config/bundled-skills/notifications/tools/send-notification.ts +0 -1
  56. package/src/contacts/contact-store.ts +13 -88
  57. package/src/contacts/contacts-write.ts +3 -11
  58. package/src/contacts/types.ts +0 -1
  59. package/src/daemon/handlers/config-channels.ts +16 -42
  60. package/src/daemon/handlers/config-inbox.ts +6 -6
  61. package/src/daemon/handlers/contacts.ts +3 -11
  62. package/src/daemon/handlers/index.ts +0 -2
  63. package/src/daemon/session-process.ts +0 -4
  64. package/src/memory/conversation-attention-store.ts +4 -19
  65. package/src/memory/conversation-crud.ts +0 -2
  66. package/src/memory/db-init.ts +4 -0
  67. package/src/memory/guardian-action-store.ts +0 -12
  68. package/src/memory/guardian-approvals.ts +35 -80
  69. package/src/memory/guardian-rate-limits.ts +1 -14
  70. package/src/memory/guardian-verification.ts +6 -34
  71. package/src/memory/invite-store.ts +5 -14
  72. package/src/memory/migrations/134-contacts-notes-column.ts +64 -45
  73. package/src/memory/migrations/136-drop-assistant-id-columns.ts +263 -0
  74. package/src/memory/migrations/index.ts +1 -0
  75. package/src/memory/migrations/registry.ts +14 -1
  76. package/src/memory/schema/calls.ts +0 -7
  77. package/src/memory/schema/contacts.ts +0 -8
  78. package/src/memory/schema/guardian.ts +0 -5
  79. package/src/memory/schema/infrastructure.ts +0 -2
  80. package/src/memory/schema/notifications.ts +3 -17
  81. package/src/memory/scoped-approval-grants.ts +2 -24
  82. package/src/notifications/adapters/sms.ts +2 -1
  83. package/src/notifications/broadcaster.ts +1 -6
  84. package/src/notifications/decision-engine.ts +3 -4
  85. package/src/notifications/deliveries-store.ts +0 -4
  86. package/src/notifications/destination-resolver.ts +4 -6
  87. package/src/notifications/deterministic-checks.ts +1 -6
  88. package/src/notifications/emit-signal.ts +4 -11
  89. package/src/notifications/events-store.ts +7 -17
  90. package/src/notifications/preference-summary.ts +2 -2
  91. package/src/notifications/preferences-store.ts +2 -9
  92. package/src/notifications/signal.ts +0 -1
  93. package/src/notifications/thread-candidates.ts +1 -11
  94. package/src/notifications/types.ts +0 -3
  95. package/src/runtime/access-request-helper.ts +3 -10
  96. package/src/runtime/actor-refresh-token-store.ts +0 -6
  97. package/src/runtime/actor-token-store.ts +3 -16
  98. package/src/runtime/actor-trust-resolver.ts +1 -4
  99. package/src/runtime/auth/__tests__/credential-service.test.ts +0 -9
  100. package/src/runtime/auth/credential-service.ts +1 -15
  101. package/src/runtime/auth/require-bound-guardian.ts +1 -4
  102. package/src/runtime/channel-guardian-service.ts +15 -46
  103. package/src/runtime/channel-invite-transport.ts +8 -0
  104. package/src/runtime/channel-invite-transports/email.ts +4 -0
  105. package/src/runtime/channel-invite-transports/slack.ts +6 -0
  106. package/src/runtime/channel-invite-transports/sms.ts +4 -0
  107. package/src/runtime/channel-invite-transports/telegram.ts +6 -0
  108. package/src/runtime/confirmation-request-guardian-bridge.ts +0 -1
  109. package/src/runtime/guardian-action-followup-executor.ts +3 -2
  110. package/src/runtime/guardian-action-grant-minter.ts +0 -1
  111. package/src/runtime/guardian-outbound-actions.ts +2 -12
  112. package/src/runtime/guardian-vellum-migration.ts +2 -3
  113. package/src/runtime/http-server.ts +0 -1
  114. package/src/runtime/invite-redemption-service.ts +1 -14
  115. package/src/runtime/local-actor-identity.ts +2 -5
  116. package/src/runtime/routes/access-request-decision.ts +0 -1
  117. package/src/runtime/routes/approval-strategies/guardian-callback-strategy.ts +0 -9
  118. package/src/runtime/routes/channel-readiness-routes.ts +29 -18
  119. package/src/runtime/routes/contact-routes.ts +15 -40
  120. package/src/runtime/routes/conversation-attention-routes.ts +0 -2
  121. package/src/runtime/routes/global-search-routes.ts +0 -2
  122. package/src/runtime/routes/guardian-bootstrap-routes.ts +5 -6
  123. package/src/runtime/routes/guardian-expiry-sweep.ts +3 -2
  124. package/src/runtime/routes/inbound-message-handler.ts +0 -3
  125. package/src/runtime/routes/inbound-stages/acl-enforcement.ts +7 -43
  126. package/src/runtime/routes/inbound-stages/background-dispatch.ts +1 -4
  127. package/src/runtime/routes/inbound-stages/bootstrap-intercept.ts +1 -6
  128. package/src/runtime/routes/inbound-stages/escalation-intercept.ts +0 -1
  129. package/src/runtime/routes/inbound-stages/secret-ingress-check.ts +0 -1
  130. package/src/runtime/routes/inbound-stages/verification-intercept.ts +3 -7
  131. package/src/runtime/routes/pairing-routes.ts +4 -4
  132. package/src/runtime/tool-grant-request-helper.ts +0 -1
  133. package/src/tools/browser/browser-manager.ts +22 -21
  134. package/src/tools/browser/runtime-check.ts +111 -6
  135. package/src/tools/calls/call-start.ts +1 -3
  136. package/src/tools/followups/followup_create.ts +1 -2
  137. package/src/tools/tool-approval-handler.ts +0 -2
@@ -8,7 +8,6 @@
8
8
  * 3. tryMintGuardianActionGrant mints a tool_signature grant
9
9
  * 4. Voice consumer can consume the grant for the same tool+input
10
10
  * 5. Second consume attempt is denied (one-time use)
11
- * 6. Grant for a different assistantId is not consumable
12
11
  */
13
12
 
14
13
  import { mkdtempSync, rmSync } from "node:fs";
@@ -75,7 +74,6 @@ afterAll(() => {
75
74
 
76
75
  // ── Constants ───────────────────────────────────────────────────────
77
76
 
78
- const ASSISTANT_ID = "self";
79
77
  const TOOL_NAME = "execute_shell";
80
78
  const TOOL_INPUT = { command: "rm -rf /tmp/test" };
81
79
  const CONVERSATION_ID = "conv-e2e";
@@ -175,7 +173,6 @@ describe("guardian-action grant mint -> voice consume integration", () => {
175
173
  // Step 1: Create a guardian action request with tool metadata
176
174
  // (simulates the voice ASK_GUARDIAN path)
177
175
  const request = createGuardianActionRequest({
178
- assistantId: ASSISTANT_ID,
179
176
  kind: "ask_guardian",
180
177
  sourceChannel: "voice",
181
178
  sourceConversationId: CONVERSATION_ID,
@@ -217,7 +214,6 @@ describe("guardian-action grant mint -> voice consume integration", () => {
217
214
  expect(grants[0].inputDigest).toBe(inputDigest);
218
215
  expect(grants[0].scopeMode).toBe("tool_signature");
219
216
  expect(grants[0].status).toBe("active");
220
- expect(grants[0].assistantId).toBe(ASSISTANT_ID);
221
217
  expect(grants[0].callSessionId).toBe(CALL_SESSION_ID);
222
218
 
223
219
  // Step 4: Voice consumer consumes the grant
@@ -225,7 +221,6 @@ describe("guardian-action grant mint -> voice consume integration", () => {
225
221
  toolName: TOOL_NAME,
226
222
  inputDigest,
227
223
  consumingRequestId: "voice-req-1",
228
- assistantId: ASSISTANT_ID,
229
224
  executionChannel: "voice",
230
225
  callSessionId: CALL_SESSION_ID,
231
226
  conversationId: CONVERSATION_ID,
@@ -240,7 +235,6 @@ describe("guardian-action grant mint -> voice consume integration", () => {
240
235
  toolName: TOOL_NAME,
241
236
  inputDigest,
242
237
  consumingRequestId: "voice-req-2",
243
- assistantId: ASSISTANT_ID,
244
238
  executionChannel: "voice",
245
239
  callSessionId: CALL_SESSION_ID,
246
240
  conversationId: CONVERSATION_ID,
@@ -249,64 +243,9 @@ describe("guardian-action grant mint -> voice consume integration", () => {
249
243
  expect(secondConsume.grant).toBeNull();
250
244
  });
251
245
 
252
- test("grant minted for one assistantId cannot be consumed by another", async () => {
253
- const inputDigest = computeToolApprovalDigest(TOOL_NAME, TOOL_INPUT);
254
-
255
- const request = createGuardianActionRequest({
256
- assistantId: ASSISTANT_ID,
257
- kind: "ask_guardian",
258
- sourceChannel: "voice",
259
- sourceConversationId: CONVERSATION_ID,
260
- callSessionId: CALL_SESSION_ID,
261
- pendingQuestionId: nextPendingQuestionId(),
262
- questionText: "Can I run the command?",
263
- expiresAt: Date.now() + 60_000,
264
- toolName: TOOL_NAME,
265
- inputDigest,
266
- });
267
-
268
- const resolved = resolveGuardianActionRequest(
269
- request.id,
270
- "Yes",
271
- "telegram",
272
- );
273
- expect(resolved).not.toBeNull();
274
-
275
- await tryMintGuardianActionGrant({
276
- request: resolved!,
277
- answerText: "Yes",
278
- decisionChannel: "telegram",
279
- });
280
-
281
- // Attempt to consume with a different assistantId
282
- const wrongAssistant = consumeScopedApprovalGrantByToolSignature({
283
- toolName: TOOL_NAME,
284
- inputDigest,
285
- consumingRequestId: "voice-req-wrong",
286
- assistantId: "other-assistant",
287
- executionChannel: "voice",
288
- callSessionId: CALL_SESSION_ID,
289
- conversationId: CONVERSATION_ID,
290
- });
291
- expect(wrongAssistant.ok).toBe(false);
292
-
293
- // Correct assistantId succeeds
294
- const correctAssistant = consumeScopedApprovalGrantByToolSignature({
295
- toolName: TOOL_NAME,
296
- inputDigest,
297
- consumingRequestId: "voice-req-correct",
298
- assistantId: ASSISTANT_ID,
299
- executionChannel: "voice",
300
- callSessionId: CALL_SESSION_ID,
301
- conversationId: CONVERSATION_ID,
302
- });
303
- expect(correctAssistant.ok).toBe(true);
304
- });
305
-
306
246
  test("no grant minted when guardian action request lacks tool metadata", async () => {
307
247
  // Create a request without toolName/inputDigest (informational consult)
308
248
  const request = createGuardianActionRequest({
309
- assistantId: ASSISTANT_ID,
310
249
  kind: "ask_guardian",
311
250
  sourceChannel: "voice",
312
251
  sourceConversationId: CONVERSATION_ID,
@@ -340,7 +279,6 @@ describe("guardian-action grant mint -> voice consume integration", () => {
340
279
  const inputDigest = computeToolApprovalDigest(TOOL_NAME, TOOL_INPUT);
341
280
 
342
281
  const request = createGuardianActionRequest({
343
- assistantId: ASSISTANT_ID,
344
282
  kind: "ask_guardian",
345
283
  sourceChannel: "voice",
346
284
  sourceConversationId: CONVERSATION_ID,
@@ -372,7 +310,6 @@ describe("guardian-action grant mint -> voice consume integration", () => {
372
310
  toolName: TOOL_NAME,
373
311
  inputDigest,
374
312
  consumingRequestId: "voice-req-desktop",
375
- assistantId: ASSISTANT_ID,
376
313
  executionChannel: "voice",
377
314
  callSessionId: CALL_SESSION_ID,
378
315
  conversationId: CONVERSATION_ID,
@@ -384,7 +321,6 @@ describe("guardian-action grant mint -> voice consume integration", () => {
384
321
  const inputDigest = computeToolApprovalDigest(TOOL_NAME, TOOL_INPUT);
385
322
 
386
323
  const request = createGuardianActionRequest({
387
- assistantId: ASSISTANT_ID,
388
324
  kind: "ask_guardian",
389
325
  sourceChannel: "voice",
390
326
  sourceConversationId: CONVERSATION_ID,
@@ -424,7 +360,6 @@ describe("guardian-action grant mint -> voice consume integration", () => {
424
360
  const inputDigest = computeToolApprovalDigest(TOOL_NAME, TOOL_INPUT);
425
361
 
426
362
  const request = createGuardianActionRequest({
427
- assistantId: ASSISTANT_ID,
428
363
  kind: "ask_guardian",
429
364
  sourceChannel: "voice",
430
365
  sourceConversationId: CONVERSATION_ID,
@@ -459,7 +394,6 @@ describe("guardian-action grant mint -> voice consume integration", () => {
459
394
  const inputDigest = computeToolApprovalDigest(TOOL_NAME, TOOL_INPUT);
460
395
 
461
396
  const request = createGuardianActionRequest({
462
- assistantId: ASSISTANT_ID,
463
397
  kind: "ask_guardian",
464
398
  sourceChannel: "voice",
465
399
  sourceConversationId: CONVERSATION_ID,
@@ -497,7 +431,6 @@ describe("guardian-action grant mint -> voice consume integration", () => {
497
431
  const inputDigest = computeToolApprovalDigest(TOOL_NAME, TOOL_INPUT);
498
432
 
499
433
  const request = createGuardianActionRequest({
500
- assistantId: ASSISTANT_ID,
501
434
  kind: "ask_guardian",
502
435
  sourceChannel: "voice",
503
436
  sourceConversationId: CONVERSATION_ID,
@@ -544,7 +477,6 @@ describe("guardian-action grant minter: two-tier classification (deterministic +
544
477
  const inputDigest = computeToolApprovalDigest(TOOL_NAME, TOOL_INPUT);
545
478
 
546
479
  const request = createGuardianActionRequest({
547
- assistantId: ASSISTANT_ID,
548
480
  kind: "ask_guardian",
549
481
  sourceChannel: "voice",
550
482
  sourceConversationId: CONVERSATION_ID,
@@ -585,7 +517,6 @@ describe("guardian-action grant minter: two-tier classification (deterministic +
585
517
  const inputDigest = computeToolApprovalDigest(TOOL_NAME, TOOL_INPUT);
586
518
 
587
519
  const request = createGuardianActionRequest({
588
- assistantId: ASSISTANT_ID,
589
520
  kind: "ask_guardian",
590
521
  sourceChannel: "voice",
591
522
  sourceConversationId: CONVERSATION_ID,
@@ -626,7 +557,6 @@ describe("guardian-action grant minter: two-tier classification (deterministic +
626
557
  const inputDigest = computeToolApprovalDigest(TOOL_NAME, TOOL_INPUT);
627
558
 
628
559
  const request = createGuardianActionRequest({
629
- assistantId: ASSISTANT_ID,
630
560
  kind: "ask_guardian",
631
561
  sourceChannel: "voice",
632
562
  sourceConversationId: CONVERSATION_ID,
@@ -666,7 +596,6 @@ describe("guardian-action grant minter: two-tier classification (deterministic +
666
596
  const inputDigest = computeToolApprovalDigest(TOOL_NAME, TOOL_INPUT);
667
597
 
668
598
  const request = createGuardianActionRequest({
669
- assistantId: ASSISTANT_ID,
670
599
  kind: "ask_guardian",
671
600
  sourceChannel: "voice",
672
601
  sourceConversationId: CONVERSATION_ID,
@@ -705,7 +634,6 @@ describe("guardian-action grant minter: two-tier classification (deterministic +
705
634
  const inputDigest = computeToolApprovalDigest(TOOL_NAME, TOOL_INPUT);
706
635
 
707
636
  const request = createGuardianActionRequest({
708
- assistantId: ASSISTANT_ID,
709
637
  kind: "ask_guardian",
710
638
  sourceChannel: "voice",
711
639
  sourceConversationId: CONVERSATION_ID,
@@ -740,7 +668,6 @@ describe("guardian-action grant minter: two-tier classification (deterministic +
740
668
  const inputDigest = computeToolApprovalDigest(TOOL_NAME, TOOL_INPUT);
741
669
 
742
670
  const request = createGuardianActionRequest({
743
- assistantId: ASSISTANT_ID,
744
671
  kind: "ask_guardian",
745
672
  sourceChannel: "voice",
746
673
  sourceConversationId: CONVERSATION_ID,
@@ -783,7 +710,6 @@ describe("guardian-action grant minter: two-tier classification (deterministic +
783
710
  const inputDigest = computeToolApprovalDigest(TOOL_NAME, TOOL_INPUT);
784
711
 
785
712
  const request = createGuardianActionRequest({
786
- assistantId: ASSISTANT_ID,
787
713
  kind: "ask_guardian",
788
714
  sourceChannel: "voice",
789
715
  sourceConversationId: CONVERSATION_ID,
@@ -151,7 +151,6 @@ describe("guardian-action-late-reply", () => {
151
151
  });
152
152
 
153
153
  const deliveries = getExpiredDeliveriesByDestination(
154
- "self",
155
154
  "telegram",
156
155
  "chat-abc",
157
156
  );
@@ -163,11 +162,7 @@ describe("guardian-action-late-reply", () => {
163
162
  test("getExpiredDeliveriesByDestination returns empty for non-matching channel", () => {
164
163
  createExpiredRequest("conv-late-2", { chatId: "chat-abc" });
165
164
 
166
- const deliveries = getExpiredDeliveriesByDestination(
167
- "self",
168
- "sms",
169
- "chat-abc",
170
- );
165
+ const deliveries = getExpiredDeliveriesByDestination("sms", "chat-abc");
171
166
  expect(deliveries).toHaveLength(0);
172
167
  });
173
168
 
@@ -180,7 +175,6 @@ describe("guardian-action-late-reply", () => {
180
175
  startFollowupFromExpiredRequest(request.id, "late answer text");
181
176
 
182
177
  const deliveries = getExpiredDeliveriesByDestination(
183
- "self",
184
178
  "telegram",
185
179
  "chat-started",
186
180
  );
@@ -311,7 +305,6 @@ describe("guardian-action-late-reply", () => {
311
305
 
312
306
  // Should not appear in expired queries
313
307
  const expiredByDest = getExpiredDeliveriesByDestination(
314
- "self",
315
308
  "telegram",
316
309
  "chat-answered",
317
310
  );
@@ -104,7 +104,6 @@ function createTestGuardianApproval(
104
104
  runId: `run-${requestId}`,
105
105
  requestId,
106
106
  conversationId: CONVERSATION_ID,
107
- assistantId: ASSISTANT_ID,
108
107
  channel: "telegram",
109
108
  requesterExternalUserId: REQUESTER_USER,
110
109
  requesterChatId: REQUESTER_CHAT,
@@ -185,7 +185,6 @@ describe("inbound-message-handler trusted-contact interactivity", () => {
185
185
  // Insert a test contact so the contacts-based ACL lookup passes
186
186
  upsertContact({
187
187
  displayName: "Test User",
188
- assistantId: "self",
189
188
  channels: [
190
189
  {
191
190
  type: "telegram",
@@ -225,7 +224,6 @@ describe("inbound-message-handler trusted-contact interactivity", () => {
225
224
  test("trusted contact with guardian binding gets interactive turn", async () => {
226
225
  // Create guardian binding in contacts table so the trust resolver finds it
227
226
  createGuardianBinding({
228
- assistantId: "self",
229
227
  channel: "telegram",
230
228
  guardianExternalUserId: "guardian-user-for-tc",
231
229
  guardianDeliveryChatId: "guardian-chat-for-tc",
@@ -326,7 +324,6 @@ describe("inbound-message-handler trusted-contact interactivity", () => {
326
324
  test("guardian actors remain interactive regardless", async () => {
327
325
  // Guardian binding matches the sender — use contacts-first so trust resolver finds it
328
326
  createGuardianBinding({
329
- assistantId: "self",
330
327
  channel: "telegram",
331
328
  guardianExternalUserId: "telegram-user-default",
332
329
  guardianDeliveryChatId: "chat-123",
@@ -329,7 +329,6 @@ describe("inbound invite redemption intercept", () => {
329
329
  test("existing active member sending normal message is unaffected", async () => {
330
330
  // Pre-create an active member
331
331
  upsertMember({
332
- assistantId: "self",
333
332
  sourceChannel: "telegram",
334
333
  externalUserId: "user-active-member",
335
334
  externalChatId: "chat-active",
@@ -379,7 +378,6 @@ describe("inbound invite redemption intercept", () => {
379
378
 
380
379
  // Pre-create an active member that will click the invite link
381
380
  upsertMember({
382
- assistantId: "self",
383
381
  sourceChannel: "telegram",
384
382
  externalUserId: "user-already-active",
385
383
  externalChatId: "chat-invite-test",
@@ -406,7 +404,6 @@ describe("inbound invite redemption intercept", () => {
406
404
  });
407
405
 
408
406
  upsertMember({
409
- assistantId: "self",
410
407
  sourceChannel: "telegram",
411
408
  externalUserId: "user-invite-123",
412
409
  externalChatId: "chat-invite-test",
@@ -189,7 +189,6 @@ describe("non-member access request notification", () => {
189
189
  test("guardian is notified when a non-member messages and a guardian binding exists", async () => {
190
190
  // Set up a guardian binding for this channel
191
191
  createGuardianBinding({
192
- assistantId: "self",
193
192
  channel: "telegram",
194
193
  guardianExternalUserId: "guardian-user-789",
195
194
  guardianDeliveryChatId: "guardian-chat-789",
@@ -235,7 +234,6 @@ describe("non-member access request notification", () => {
235
234
 
236
235
  test("no duplicate approval requests for repeated messages from same non-member", async () => {
237
236
  createGuardianBinding({
238
- assistantId: "self",
239
237
  channel: "telegram",
240
238
  guardianExternalUserId: "guardian-user-789",
241
239
  guardianDeliveryChatId: "guardian-chat-789",
@@ -306,7 +304,6 @@ describe("non-member access request notification", () => {
306
304
  test("cross-channel fallback: SMS guardian binding resolves for Telegram access request", async () => {
307
305
  // Only an SMS guardian binding exists — no Telegram binding
308
306
  createGuardianBinding({
309
- assistantId: "self",
310
307
  channel: "sms",
311
308
  guardianExternalUserId: "guardian-sms-user",
312
309
  guardianDeliveryChatId: "guardian-sms-chat",
@@ -342,7 +339,6 @@ describe("non-member access request notification", () => {
342
339
 
343
340
  test("no notification when actorExternalId is absent", async () => {
344
341
  createGuardianBinding({
345
- assistantId: "self",
346
342
  channel: "telegram",
347
343
  guardianExternalUserId: "guardian-user-789",
348
344
  guardianDeliveryChatId: "guardian-chat-789",
@@ -419,7 +415,6 @@ describe("access-request-helper unit tests", () => {
419
415
  test("notifyGuardianOfAccessRequest uses cross-channel binding when source-channel binding is missing", () => {
420
416
  // Only SMS binding exists
421
417
  createGuardianBinding({
422
- assistantId: "self",
423
418
  channel: "sms",
424
419
  guardianExternalUserId: "guardian-sms",
425
420
  guardianDeliveryChatId: "sms-chat",
@@ -455,7 +450,6 @@ describe("access-request-helper unit tests", () => {
455
450
  test("notifyGuardianOfAccessRequest prefers source-channel binding over cross-channel fallback", () => {
456
451
  // Both Telegram and SMS bindings exist
457
452
  createGuardianBinding({
458
- assistantId: "self",
459
453
  channel: "telegram",
460
454
  guardianExternalUserId: "guardian-tg",
461
455
  guardianDeliveryChatId: "tg-chat",
@@ -463,7 +457,6 @@ describe("access-request-helper unit tests", () => {
463
457
  verifiedVia: "test",
464
458
  });
465
459
  createGuardianBinding({
466
- assistantId: "self",
467
460
  channel: "sms",
468
461
  guardianExternalUserId: "guardian-sms",
469
462
  guardianDeliveryChatId: "sms-chat",
@@ -23,7 +23,7 @@ mock.module("../util/logger.js", () => ({
23
23
 
24
24
  // Mock destination-resolver to return a destination for every requested channel
25
25
  mock.module("../notifications/destination-resolver.js", () => ({
26
- resolveDestinations: (_assistantId: string, channels: string[]) => {
26
+ resolveDestinations: (channels: string[]) => {
27
27
  const m = new Map();
28
28
  for (const ch of channels) {
29
29
  m.set(ch, { channel: ch, endpoint: `mock-${ch}` });
@@ -84,7 +84,6 @@ function makeSignal(
84
84
  ): NotificationSignal {
85
85
  return {
86
86
  signalId: "sig-broadcast-001",
87
- assistantId: "self",
88
87
  createdAt: Date.now(),
89
88
  sourceChannel: "scheduler",
90
89
  sourceSessionId: "sess-001",
@@ -63,7 +63,6 @@ function makeSignal(
63
63
  ): NotificationSignal {
64
64
  return {
65
65
  signalId: "sig-fallback-guardian-1",
66
- assistantId: "self",
67
66
  createdAt: Date.now(),
68
67
  sourceChannel: "voice",
69
68
  sourceSessionId: "call-session-1",
@@ -307,7 +306,6 @@ describe("access-request instruction enforcement", () => {
307
306
  ): NotificationSignal {
308
307
  return {
309
308
  signalId: "sig-access-req-1",
310
- assistantId: "self",
311
309
  createdAt: Date.now(),
312
310
  sourceChannel: "telegram",
313
311
  sourceSessionId: "tg-session-1",
@@ -36,7 +36,6 @@ function makeSignal(
36
36
  ): NotificationSignal {
37
37
  return {
38
38
  signalId: "sig-test-001",
39
- assistantId: "self",
40
39
  createdAt: Date.now(),
41
40
  sourceChannel: "scheduler",
42
41
  sourceSessionId: "sess-001",