@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.
- package/docs/architecture/memory.md +1 -1
- package/package.json +1 -1
- package/src/__tests__/access-request-decision.test.ts +85 -4
- package/src/__tests__/actor-token-service.test.ts +4 -12
- package/src/__tests__/approval-primitive.test.ts +0 -45
- package/src/__tests__/approval-routes-http.test.ts +0 -1
- package/src/__tests__/assistant-id-boundary-guard.test.ts +150 -0
- package/src/__tests__/call-controller.test.ts +0 -1
- package/src/__tests__/call-routes-http.test.ts +0 -1
- package/src/__tests__/callback-handoff-copy.test.ts +0 -1
- package/src/__tests__/channel-approval-routes.test.ts +5 -45
- package/src/__tests__/channel-guardian.test.ts +122 -346
- package/src/__tests__/channel-invite-transport.test.ts +52 -40
- package/src/__tests__/commit-message-enrichment-service.test.ts +4 -38
- package/src/__tests__/computer-use-session-working-dir.test.ts +0 -1
- package/src/__tests__/confirmation-request-guardian-bridge.test.ts +4 -3
- package/src/__tests__/contacts-tools.test.ts +4 -5
- package/src/__tests__/conversation-attention-store.test.ts +2 -65
- package/src/__tests__/conversation-attention-telegram.test.ts +0 -2
- package/src/__tests__/conversation-pairing.test.ts +0 -1
- package/src/__tests__/credential-security-invariants.test.ts +1 -0
- package/src/__tests__/deterministic-verification-control-plane.test.ts +0 -3
- package/src/__tests__/guardian-action-conversation-turn.test.ts +1 -7
- package/src/__tests__/guardian-action-followup-executor.test.ts +0 -1
- package/src/__tests__/guardian-action-grant-mint-consume.test.ts +0 -74
- package/src/__tests__/guardian-action-late-reply.test.ts +1 -8
- package/src/__tests__/guardian-dispatch.test.ts +0 -1
- package/src/__tests__/guardian-grant-minting.test.ts +0 -1
- package/src/__tests__/guardian-outbound-http.test.ts +0 -1
- package/src/__tests__/guardian-routing-state.test.ts +0 -3
- package/src/__tests__/handlers-telegram-config.test.ts +0 -1
- package/src/__tests__/inbound-invite-redemption.test.ts +1 -7
- package/src/__tests__/ingress-reconcile.test.ts +3 -36
- package/src/__tests__/migration-cross-version-compatibility.test.ts +0 -1
- package/src/__tests__/migration-export-http.test.ts +0 -1
- package/src/__tests__/migration-import-commit-http.test.ts +0 -1
- package/src/__tests__/migration-import-preflight-http.test.ts +0 -1
- package/src/__tests__/migration-validate-http.test.ts +0 -1
- package/src/__tests__/non-member-access-request.test.ts +0 -8
- package/src/__tests__/notification-broadcaster.test.ts +1 -2
- package/src/__tests__/notification-decision-fallback.test.ts +0 -2
- package/src/__tests__/notification-decision-strategy.test.ts +0 -1
- package/src/__tests__/notification-guardian-path.test.ts +0 -1
- package/src/__tests__/notification-telegram-adapter.test.ts +0 -4
- package/src/__tests__/relay-server.test.ts +151 -80
- package/src/__tests__/sandbox-host-parity.test.ts +5 -2
- package/src/__tests__/scoped-approval-grants.test.ts +9 -40
- package/src/__tests__/scoped-grant-security-matrix.test.ts +0 -36
- package/src/__tests__/send-endpoint-busy.test.ts +0 -1
- package/src/__tests__/send-notification-tool.test.ts +0 -1
- package/src/__tests__/session-init.benchmark.test.ts +0 -2
- package/src/__tests__/slack-channel-config.test.ts +0 -1
- package/src/__tests__/slack-inbound-verification.test.ts +2 -5
- package/src/__tests__/sms-messaging-provider.test.ts +0 -4
- package/src/__tests__/terminal-tools.test.ts +5 -2
- package/src/__tests__/thread-seed-composer.test.ts +0 -1
- package/src/__tests__/tool-approval-handler.test.ts +0 -1
- package/src/__tests__/tool-grant-request-escalation.test.ts +0 -4
- package/src/__tests__/trusted-contact-approval-notifier.test.ts +65 -77
- package/src/__tests__/trusted-contact-inline-approval-integration.test.ts +0 -1
- package/src/__tests__/trusted-contact-lifecycle-notifications.test.ts +1 -18
- package/src/__tests__/trusted-contact-multichannel.test.ts +0 -14
- package/src/__tests__/trusted-contact-verification.test.ts +3 -16
- package/src/__tests__/twilio-routes.test.ts +2 -3
- package/src/__tests__/update-bulletin.test.ts +0 -2
- package/src/__tests__/user-reference.test.ts +47 -1
- package/src/__tests__/voice-invite-redemption.test.ts +0 -1
- package/src/__tests__/voice-scoped-grant-consumer.test.ts +0 -38
- package/src/__tests__/workspace-git-service.test.ts +2 -2
- package/src/approvals/approval-primitive.ts +0 -15
- package/src/approvals/guardian-decision-primitive.ts +0 -3
- package/src/approvals/guardian-request-resolvers.ts +0 -5
- package/src/calls/call-domain.ts +0 -3
- package/src/calls/call-store.ts +0 -3
- package/src/calls/guardian-action-sweep.ts +2 -1
- package/src/calls/guardian-dispatch.ts +1 -2
- package/src/calls/relay-access-wait.ts +0 -4
- package/src/calls/relay-server.ts +8 -66
- package/src/calls/relay-setup-router.ts +1 -2
- package/src/calls/relay-verification.ts +0 -1
- package/src/calls/twilio-routes.ts +0 -3
- package/src/calls/types.ts +0 -1
- package/src/calls/voice-session-bridge.ts +0 -1
- package/src/channels/config.ts +41 -2
- package/src/config/bundled-skills/notifications/tools/send-notification.ts +0 -1
- package/src/config/bundled-skills/slack/SKILL.md +2 -0
- package/src/config/bundled-skills/slack-digest-setup/SKILL.md +164 -0
- package/src/config/env.ts +0 -4
- package/src/config/feature-flag-registry.json +4 -4
- package/src/config/user-reference.ts +47 -9
- package/src/contacts/contact-store.ts +13 -88
- package/src/contacts/contacts-write.ts +3 -11
- package/src/contacts/types.ts +0 -1
- package/src/daemon/handlers/config-channels.ts +19 -44
- package/src/daemon/handlers/config-inbox.ts +6 -6
- package/src/daemon/handlers/contacts.ts +8 -12
- package/src/daemon/handlers/index.ts +0 -2
- package/src/daemon/lifecycle.ts +18 -26
- package/src/daemon/session-process.ts +0 -4
- package/src/memory/channel-delivery-store.ts +1 -0
- package/src/memory/conversation-attention-store.ts +4 -19
- package/src/memory/conversation-crud.ts +0 -2
- package/src/memory/db-init.ts +8 -0
- package/src/memory/delivery-crud.ts +13 -0
- package/src/memory/guardian-action-store.ts +0 -12
- package/src/memory/guardian-approvals.ts +35 -80
- package/src/memory/guardian-rate-limits.ts +1 -14
- package/src/memory/guardian-verification.ts +6 -34
- package/src/memory/invite-store.ts +76 -15
- package/src/memory/migrations/040-invite-code-hash-column.ts +16 -0
- package/src/memory/migrations/134-contacts-notes-column.ts +64 -45
- package/src/memory/migrations/136-drop-assistant-id-columns.ts +263 -0
- package/src/memory/migrations/index.ts +2 -0
- package/src/memory/migrations/registry.ts +14 -1
- package/src/memory/schema/calls.ts +0 -7
- package/src/memory/schema/contacts.ts +2 -8
- package/src/memory/schema/guardian.ts +0 -5
- package/src/memory/schema/infrastructure.ts +0 -2
- package/src/memory/schema/notifications.ts +3 -17
- package/src/memory/scoped-approval-grants.ts +2 -24
- package/src/notifications/adapters/sms.ts +2 -1
- package/src/notifications/broadcaster.ts +1 -6
- package/src/notifications/decision-engine.ts +3 -4
- package/src/notifications/deliveries-store.ts +0 -4
- package/src/notifications/destination-resolver.ts +4 -6
- package/src/notifications/deterministic-checks.ts +1 -6
- package/src/notifications/emit-signal.ts +4 -11
- package/src/notifications/events-store.ts +7 -17
- package/src/notifications/preference-summary.ts +2 -2
- package/src/notifications/preferences-store.ts +2 -9
- package/src/notifications/signal.ts +0 -1
- package/src/notifications/thread-candidates.ts +1 -11
- package/src/notifications/types.ts +0 -3
- package/src/runtime/access-request-helper.ts +3 -10
- package/src/runtime/actor-refresh-token-store.ts +0 -6
- package/src/runtime/actor-token-store.ts +3 -16
- package/src/runtime/actor-trust-resolver.ts +1 -4
- package/src/runtime/auth/__tests__/credential-service.test.ts +0 -9
- package/src/runtime/auth/__tests__/guard-tests.test.ts +1 -3
- package/src/runtime/auth/credential-service.ts +1 -15
- package/src/runtime/auth/require-bound-guardian.ts +1 -4
- package/src/runtime/auth/token-service.ts +50 -0
- package/src/runtime/channel-guardian-service.ts +16 -49
- package/src/runtime/channel-invite-transport.ts +129 -34
- package/src/runtime/channel-invite-transports/email.ts +54 -0
- package/src/runtime/channel-invite-transports/slack.ts +87 -0
- package/src/runtime/channel-invite-transports/sms.ts +74 -0
- package/src/runtime/channel-invite-transports/telegram.ts +35 -11
- package/src/runtime/channel-invite-transports/voice.ts +12 -12
- package/src/runtime/confirmation-request-guardian-bridge.ts +0 -1
- package/src/runtime/guardian-action-followup-executor.ts +3 -2
- package/src/runtime/guardian-action-grant-minter.ts +0 -1
- package/src/runtime/guardian-outbound-actions.ts +2 -12
- package/src/runtime/guardian-vellum-migration.ts +2 -3
- package/src/runtime/http-server.ts +0 -1
- package/src/runtime/invite-redemption-service.ts +191 -11
- package/src/runtime/invite-redemption-templates.ts +6 -6
- package/src/runtime/invite-service.ts +81 -11
- package/src/runtime/local-actor-identity.ts +2 -5
- package/src/runtime/routes/access-request-decision.ts +52 -7
- package/src/runtime/routes/approval-strategies/guardian-callback-strategy.ts +6 -9
- package/src/runtime/routes/channel-readiness-routes.ts +29 -18
- package/src/runtime/routes/contact-routes.ts +48 -46
- package/src/runtime/routes/conversation-attention-routes.ts +0 -2
- package/src/runtime/routes/global-search-routes.ts +0 -2
- package/src/runtime/routes/guardian-bootstrap-routes.ts +6 -12
- package/src/runtime/routes/guardian-expiry-sweep.ts +3 -2
- package/src/runtime/routes/inbound-message-handler.ts +1 -6
- package/src/runtime/routes/inbound-stages/acl-enforcement.ts +296 -47
- package/src/runtime/routes/inbound-stages/background-dispatch.ts +6 -42
- package/src/runtime/routes/inbound-stages/bootstrap-intercept.ts +1 -6
- package/src/runtime/routes/inbound-stages/edit-intercept.ts +10 -0
- package/src/runtime/routes/inbound-stages/escalation-intercept.ts +0 -1
- package/src/runtime/routes/inbound-stages/secret-ingress-check.ts +0 -1
- package/src/runtime/routes/inbound-stages/verification-intercept.ts +3 -7
- package/src/runtime/routes/invite-routes.ts +1 -0
- package/src/runtime/routes/pairing-routes.ts +4 -4
- package/src/runtime/tool-grant-request-helper.ts +0 -1
- package/src/tools/browser/browser-manager.ts +22 -12
- package/src/tools/browser/runtime-check.ts +110 -3
- package/src/tools/calls/call-start.ts +1 -3
- package/src/tools/followups/followup_create.ts +1 -2
- package/src/tools/shared/shell-output.ts +7 -2
- package/src/tools/tool-approval-handler.ts +0 -2
- package/src/util/platform.ts +0 -4
- package/src/workspace/git-service.ts +10 -4
|
@@ -208,7 +208,6 @@ const noopProcessMessage = mock(async () => ({ messageId: "msg-1" }));
|
|
|
208
208
|
function ensureTestContact(): void {
|
|
209
209
|
upsertContact({
|
|
210
210
|
displayName: "Test User",
|
|
211
|
-
assistantId: "self",
|
|
212
211
|
channels: [
|
|
213
212
|
{
|
|
214
213
|
type: "telegram",
|
|
@@ -268,7 +267,6 @@ describe("stale callback handling without matching pending approval", () => {
|
|
|
268
267
|
describe("inbound callback metadata triggers decision handling", () => {
|
|
269
268
|
beforeEach(() => {
|
|
270
269
|
createGuardianBinding({
|
|
271
|
-
assistantId: "self",
|
|
272
270
|
channel: "telegram",
|
|
273
271
|
guardianExternalUserId: "telegram-user-default",
|
|
274
272
|
guardianDeliveryChatId: "chat-123",
|
|
@@ -362,7 +360,6 @@ describe("inbound callback metadata triggers decision handling", () => {
|
|
|
362
360
|
describe("inbound text matching approval phrases triggers decision handling", () => {
|
|
363
361
|
beforeEach(() => {
|
|
364
362
|
createGuardianBinding({
|
|
365
|
-
assistantId: "self",
|
|
366
363
|
channel: "telegram",
|
|
367
364
|
guardianExternalUserId: "telegram-user-default",
|
|
368
365
|
guardianDeliveryChatId: "chat-123",
|
|
@@ -444,7 +441,6 @@ describe("inbound text matching approval phrases triggers decision handling", ()
|
|
|
444
441
|
describe("non-decision messages during pending approval (legacy fallback)", () => {
|
|
445
442
|
beforeEach(() => {
|
|
446
443
|
createGuardianBinding({
|
|
447
|
-
assistantId: "self",
|
|
448
444
|
channel: "telegram",
|
|
449
445
|
guardianExternalUserId: "telegram-user-default",
|
|
450
446
|
guardianDeliveryChatId: "chat-123",
|
|
@@ -526,7 +522,6 @@ describe("messages without pending approval proceed normally", () => {
|
|
|
526
522
|
describe("empty content with callbackData bypasses validation", () => {
|
|
527
523
|
beforeEach(() => {
|
|
528
524
|
createGuardianBinding({
|
|
529
|
-
assistantId: "self",
|
|
530
525
|
channel: "telegram",
|
|
531
526
|
guardianExternalUserId: "telegram-user-default",
|
|
532
527
|
guardianDeliveryChatId: "chat-123",
|
|
@@ -639,7 +634,6 @@ describe("empty content with callbackData bypasses validation", () => {
|
|
|
639
634
|
describe("callback requestId validation", () => {
|
|
640
635
|
beforeEach(() => {
|
|
641
636
|
createGuardianBinding({
|
|
642
|
-
assistantId: "self",
|
|
643
637
|
channel: "telegram",
|
|
644
638
|
guardianExternalUserId: "telegram-user-default",
|
|
645
639
|
guardianDeliveryChatId: "chat-123",
|
|
@@ -767,7 +761,6 @@ describe("callback requestId validation", () => {
|
|
|
767
761
|
describe("no immediate reply after approval decision", () => {
|
|
768
762
|
beforeEach(() => {
|
|
769
763
|
createGuardianBinding({
|
|
770
|
-
assistantId: "self",
|
|
771
764
|
channel: "telegram",
|
|
772
765
|
guardianExternalUserId: "telegram-user-default",
|
|
773
766
|
guardianDeliveryChatId: "chat-123",
|
|
@@ -900,7 +893,6 @@ describe("stale callback handling", () => {
|
|
|
900
893
|
describe("SMS channel approval decisions", () => {
|
|
901
894
|
beforeEach(() => {
|
|
902
895
|
createGuardianBinding({
|
|
903
|
-
assistantId: "self",
|
|
904
896
|
channel: "sms",
|
|
905
897
|
guardianExternalUserId: "sms-user-default",
|
|
906
898
|
guardianDeliveryChatId: "sms-chat-123",
|
|
@@ -1056,7 +1048,7 @@ describe("SMS guardian verify intercept", () => {
|
|
|
1056
1048
|
test("verification code reply works with sourceChannel sms", async () => {
|
|
1057
1049
|
const { createVerificationChallenge } =
|
|
1058
1050
|
await import("../runtime/channel-guardian-service.js");
|
|
1059
|
-
const { secret } = createVerificationChallenge("
|
|
1051
|
+
const { secret } = createVerificationChallenge("sms");
|
|
1060
1052
|
|
|
1061
1053
|
const deliverSpy = spyOn(
|
|
1062
1054
|
gatewayClient,
|
|
@@ -1100,7 +1092,7 @@ describe("SMS guardian verify intercept", () => {
|
|
|
1100
1092
|
const { createVerificationChallenge } =
|
|
1101
1093
|
await import("../runtime/channel-guardian-service.js");
|
|
1102
1094
|
// Ensure there is a pending challenge so bare-code verification is intercepted.
|
|
1103
|
-
createVerificationChallenge("
|
|
1095
|
+
createVerificationChallenge("sms");
|
|
1104
1096
|
|
|
1105
1097
|
const deliverSpy = spyOn(
|
|
1106
1098
|
gatewayClient,
|
|
@@ -1148,7 +1140,6 @@ describe("SMS guardian verify intercept", () => {
|
|
|
1148
1140
|
const challengeHash = createHash("sha256").update(secret).digest("hex");
|
|
1149
1141
|
createChallenge({
|
|
1150
1142
|
id: `challenge-hex-${Date.now()}`,
|
|
1151
|
-
assistantId: "self",
|
|
1152
1143
|
channel: "sms",
|
|
1153
1144
|
challengeHash,
|
|
1154
1145
|
expiresAt: Date.now() + 600_000,
|
|
@@ -1192,7 +1183,6 @@ describe("SMS guardian verify intercept", () => {
|
|
|
1192
1183
|
describe("guardian decision scoping — multiple pending approvals", () => {
|
|
1193
1184
|
test("callback for older request resolves to the correct approval request", async () => {
|
|
1194
1185
|
createGuardianBinding({
|
|
1195
|
-
assistantId: "self",
|
|
1196
1186
|
channel: "telegram",
|
|
1197
1187
|
guardianExternalUserId: "guardian-scope-user",
|
|
1198
1188
|
guardianDeliveryChatId: "guardian-scope-chat",
|
|
@@ -1277,7 +1267,6 @@ describe("guardian decision scoping — multiple pending approvals", () => {
|
|
|
1277
1267
|
describe("ambiguous plain-text decision with multiple pending requests", () => {
|
|
1278
1268
|
test("does not apply plain-text decision to wrong request when multiple pending", async () => {
|
|
1279
1269
|
createGuardianBinding({
|
|
1280
|
-
assistantId: "self",
|
|
1281
1270
|
channel: "telegram",
|
|
1282
1271
|
guardianExternalUserId: "guardian-ambig-user",
|
|
1283
1272
|
guardianDeliveryChatId: "guardian-ambig-chat",
|
|
@@ -1510,7 +1499,7 @@ describe("assistant-scoped guardian verification via handleChannelInbound", () =
|
|
|
1510
1499
|
test("verification code uses the threaded assistantId (default: self)", async () => {
|
|
1511
1500
|
const { createVerificationChallenge } =
|
|
1512
1501
|
await import("../runtime/channel-guardian-service.js");
|
|
1513
|
-
const { secret } = createVerificationChallenge("
|
|
1502
|
+
const { secret } = createVerificationChallenge("telegram");
|
|
1514
1503
|
|
|
1515
1504
|
const deliverSpy = spyOn(
|
|
1516
1505
|
gatewayClient,
|
|
@@ -1538,7 +1527,7 @@ describe("assistant-scoped guardian verification via handleChannelInbound", () =
|
|
|
1538
1527
|
await import("../runtime/channel-guardian-service.js");
|
|
1539
1528
|
|
|
1540
1529
|
// All assistant IDs canonicalize to 'self' in the single-tenant daemon
|
|
1541
|
-
const { secret } = createVerificationChallenge("
|
|
1530
|
+
const { secret } = createVerificationChallenge("telegram");
|
|
1542
1531
|
|
|
1543
1532
|
const deliverSpy = spyOn(
|
|
1544
1533
|
gatewayClient,
|
|
@@ -1572,7 +1561,7 @@ describe("assistant-scoped guardian verification via handleChannelInbound", () =
|
|
|
1572
1561
|
await import("../runtime/channel-guardian-service.js");
|
|
1573
1562
|
|
|
1574
1563
|
// Both IDs canonicalize to 'self', so the challenge is found
|
|
1575
|
-
const { secret } = createVerificationChallenge("
|
|
1564
|
+
const { secret } = createVerificationChallenge("telegram");
|
|
1576
1565
|
|
|
1577
1566
|
const deliverSpy = spyOn(
|
|
1578
1567
|
gatewayClient,
|
|
@@ -1600,7 +1589,6 @@ describe("assistant-scoped guardian verification via handleChannelInbound", () =
|
|
|
1600
1589
|
test("inbound with explicit assistantId does not mutate existing external bindings", async () => {
|
|
1601
1590
|
upsertContact({
|
|
1602
1591
|
displayName: "Incoming User",
|
|
1603
|
-
assistantId: "self",
|
|
1604
1592
|
channels: [
|
|
1605
1593
|
{
|
|
1606
1594
|
type: "telegram",
|
|
@@ -1665,7 +1653,6 @@ describe("assistant-scoped guardian verification via handleChannelInbound", () =
|
|
|
1665
1653
|
describe("conversational approval engine — standard path", () => {
|
|
1666
1654
|
beforeEach(() => {
|
|
1667
1655
|
createGuardianBinding({
|
|
1668
|
-
assistantId: "self",
|
|
1669
1656
|
channel: "telegram",
|
|
1670
1657
|
guardianExternalUserId: "telegram-user-default",
|
|
1671
1658
|
guardianDeliveryChatId: "chat-123",
|
|
@@ -1886,7 +1873,6 @@ describe("conversational approval engine — standard path", () => {
|
|
|
1886
1873
|
describe("guardian conversational approval via conversation engine", () => {
|
|
1887
1874
|
test("guardian follow-up clarification: engine returns keep_pending", async () => {
|
|
1888
1875
|
createGuardianBinding({
|
|
1889
|
-
assistantId: "self",
|
|
1890
1876
|
channel: "telegram",
|
|
1891
1877
|
guardianExternalUserId: "guardian-conv-user",
|
|
1892
1878
|
guardianDeliveryChatId: "guardian-conv-chat",
|
|
@@ -1959,7 +1945,6 @@ describe("guardian conversational approval via conversation engine", () => {
|
|
|
1959
1945
|
const pending = getAllPendingApprovalsByGuardianChat(
|
|
1960
1946
|
"telegram",
|
|
1961
1947
|
"guardian-conv-chat",
|
|
1962
|
-
"self",
|
|
1963
1948
|
);
|
|
1964
1949
|
expect(pending).toHaveLength(1);
|
|
1965
1950
|
|
|
@@ -1968,7 +1953,6 @@ describe("guardian conversational approval via conversation engine", () => {
|
|
|
1968
1953
|
|
|
1969
1954
|
test("guardian natural-language approval: engine returns approve_once", async () => {
|
|
1970
1955
|
createGuardianBinding({
|
|
1971
|
-
assistantId: "self",
|
|
1972
1956
|
channel: "telegram",
|
|
1973
1957
|
guardianExternalUserId: "guardian-nlp-user",
|
|
1974
1958
|
guardianDeliveryChatId: "guardian-nlp-chat",
|
|
@@ -2031,7 +2015,6 @@ describe("guardian conversational approval via conversation engine", () => {
|
|
|
2031
2015
|
const pending = getAllPendingApprovalsByGuardianChat(
|
|
2032
2016
|
"telegram",
|
|
2033
2017
|
"guardian-nlp-chat",
|
|
2034
|
-
"self",
|
|
2035
2018
|
);
|
|
2036
2019
|
expect(pending).toHaveLength(0);
|
|
2037
2020
|
|
|
@@ -2048,7 +2031,6 @@ describe("guardian conversational approval via conversation engine", () => {
|
|
|
2048
2031
|
|
|
2049
2032
|
test("guardian callback button approve_always is downgraded to approve_once", async () => {
|
|
2050
2033
|
createGuardianBinding({
|
|
2051
|
-
assistantId: "self",
|
|
2052
2034
|
channel: "telegram",
|
|
2053
2035
|
guardianExternalUserId: "guardian-dg-user",
|
|
2054
2036
|
guardianDeliveryChatId: "guardian-dg-chat",
|
|
@@ -2103,7 +2085,6 @@ describe("guardian conversational approval via conversation engine", () => {
|
|
|
2103
2085
|
|
|
2104
2086
|
test("multi-pending guardian disambiguation: engine requests clarification", async () => {
|
|
2105
2087
|
createGuardianBinding({
|
|
2106
|
-
assistantId: "self",
|
|
2107
2088
|
channel: "telegram",
|
|
2108
2089
|
guardianExternalUserId: "guardian-multi-user",
|
|
2109
2090
|
guardianDeliveryChatId: "guardian-multi-chat",
|
|
@@ -2206,7 +2187,6 @@ describe("guardian conversational approval via conversation engine", () => {
|
|
|
2206
2187
|
describe("keep_pending remains conversational — standard path", () => {
|
|
2207
2188
|
beforeEach(() => {
|
|
2208
2189
|
createGuardianBinding({
|
|
2209
|
-
assistantId: "self",
|
|
2210
2190
|
channel: "telegram",
|
|
2211
2191
|
guardianExternalUserId: "telegram-user-default",
|
|
2212
2192
|
guardianDeliveryChatId: "chat-123",
|
|
@@ -2267,7 +2247,6 @@ describe("keep_pending remains conversational — standard path", () => {
|
|
|
2267
2247
|
describe("keep_pending remains conversational — guardian path", () => {
|
|
2268
2248
|
test('guardian explicit "yes" with keep_pending returns assistant_turn without applying a decision', async () => {
|
|
2269
2249
|
createGuardianBinding({
|
|
2270
|
-
assistantId: "self",
|
|
2271
2250
|
channel: "telegram",
|
|
2272
2251
|
guardianExternalUserId: "guardian-user-fb",
|
|
2273
2252
|
guardianDeliveryChatId: "guardian-chat-fb",
|
|
@@ -2291,7 +2270,6 @@ describe("keep_pending remains conversational — guardian path", () => {
|
|
|
2291
2270
|
runId: "run-gfb-1",
|
|
2292
2271
|
requestId: "req-gfb-1",
|
|
2293
2272
|
conversationId: convId,
|
|
2294
|
-
assistantId: "self",
|
|
2295
2273
|
channel: "telegram",
|
|
2296
2274
|
requesterExternalUserId: "requester-user-fb",
|
|
2297
2275
|
requesterChatId: "requester-chat-fb",
|
|
@@ -2342,7 +2320,6 @@ describe("keep_pending remains conversational — guardian path", () => {
|
|
|
2342
2320
|
describe("requester cancel of guardian-gated pending request", () => {
|
|
2343
2321
|
beforeEach(() => {
|
|
2344
2322
|
createGuardianBinding({
|
|
2345
|
-
assistantId: "self",
|
|
2346
2323
|
channel: "telegram",
|
|
2347
2324
|
guardianExternalUserId: "guardian-cancel",
|
|
2348
2325
|
guardianDeliveryChatId: "guardian-cancel-chat",
|
|
@@ -2350,7 +2327,6 @@ describe("requester cancel of guardian-gated pending request", () => {
|
|
|
2350
2327
|
});
|
|
2351
2328
|
upsertContact({
|
|
2352
2329
|
displayName: "Requester Cancel User",
|
|
2353
|
-
assistantId: "self",
|
|
2354
2330
|
channels: [
|
|
2355
2331
|
{
|
|
2356
2332
|
type: "telegram",
|
|
@@ -2394,7 +2370,6 @@ describe("requester cancel of guardian-gated pending request", () => {
|
|
|
2394
2370
|
runId: "run-cancel-1",
|
|
2395
2371
|
requestId: "req-cancel-1",
|
|
2396
2372
|
conversationId: conversationId!,
|
|
2397
|
-
assistantId: "self",
|
|
2398
2373
|
channel: "telegram",
|
|
2399
2374
|
requesterExternalUserId: "requester-cancel-user",
|
|
2400
2375
|
requesterChatId: "requester-cancel-chat",
|
|
@@ -2476,7 +2451,6 @@ describe("requester cancel of guardian-gated pending request", () => {
|
|
|
2476
2451
|
runId: "run-cancel-2",
|
|
2477
2452
|
requestId: "req-cancel-2",
|
|
2478
2453
|
conversationId: conversationId!,
|
|
2479
|
-
assistantId: "self",
|
|
2480
2454
|
channel: "telegram",
|
|
2481
2455
|
requesterExternalUserId: "requester-cancel-user",
|
|
2482
2456
|
requesterChatId: "requester-cancel-chat",
|
|
@@ -2552,7 +2526,6 @@ describe("requester cancel of guardian-gated pending request", () => {
|
|
|
2552
2526
|
runId: "run-cancel-3",
|
|
2553
2527
|
requestId: "req-cancel-3",
|
|
2554
2528
|
conversationId: conversationId!,
|
|
2555
|
-
assistantId: "self",
|
|
2556
2529
|
channel: "telegram",
|
|
2557
2530
|
requesterExternalUserId: "requester-cancel-user",
|
|
2558
2531
|
requesterChatId: "requester-cancel-chat",
|
|
@@ -2621,7 +2594,6 @@ describe("requester cancel of guardian-gated pending request", () => {
|
|
|
2621
2594
|
runId: "run-cancel-4",
|
|
2622
2595
|
requestId: "req-cancel-4",
|
|
2623
2596
|
conversationId: conversationId!,
|
|
2624
|
-
assistantId: "self",
|
|
2625
2597
|
channel: "telegram",
|
|
2626
2598
|
requesterExternalUserId: "requester-cancel-user",
|
|
2627
2599
|
requesterChatId: "requester-cancel-chat",
|
|
@@ -2657,7 +2629,6 @@ describe("requester cancel of guardian-gated pending request", () => {
|
|
|
2657
2629
|
describe("engine decision race condition — standard path", () => {
|
|
2658
2630
|
beforeEach(() => {
|
|
2659
2631
|
createGuardianBinding({
|
|
2660
|
-
assistantId: "self",
|
|
2661
2632
|
channel: "telegram",
|
|
2662
2633
|
guardianExternalUserId: "telegram-user-default",
|
|
2663
2634
|
guardianDeliveryChatId: "chat-123",
|
|
@@ -2727,7 +2698,6 @@ describe("engine decision race condition — standard path", () => {
|
|
|
2727
2698
|
describe("engine decision race condition — guardian path", () => {
|
|
2728
2699
|
test("returns stale_ignored when guardian engine approves but interaction was already resolved", async () => {
|
|
2729
2700
|
createGuardianBinding({
|
|
2730
|
-
assistantId: "self",
|
|
2731
2701
|
channel: "telegram",
|
|
2732
2702
|
guardianExternalUserId: "guardian-race-user",
|
|
2733
2703
|
guardianDeliveryChatId: "guardian-race-chat",
|
|
@@ -2747,7 +2717,6 @@ describe("engine decision race condition — guardian path", () => {
|
|
|
2747
2717
|
runId: "run-grc-1",
|
|
2748
2718
|
requestId: "req-grc-1",
|
|
2749
2719
|
conversationId: convId,
|
|
2750
|
-
assistantId: "self",
|
|
2751
2720
|
channel: "telegram",
|
|
2752
2721
|
requesterExternalUserId: "requester-race-user",
|
|
2753
2722
|
requesterChatId: "requester-race-chat",
|
|
@@ -2809,14 +2778,12 @@ describe("engine decision race condition — guardian path", () => {
|
|
|
2809
2778
|
describe("non-decision status reply for different channels", () => {
|
|
2810
2779
|
beforeEach(() => {
|
|
2811
2780
|
createGuardianBinding({
|
|
2812
|
-
assistantId: "self",
|
|
2813
2781
|
channel: "telegram",
|
|
2814
2782
|
guardianExternalUserId: "telegram-user-default",
|
|
2815
2783
|
guardianDeliveryChatId: "chat-123",
|
|
2816
2784
|
guardianPrincipalId: "telegram-user-default",
|
|
2817
2785
|
});
|
|
2818
2786
|
createGuardianBinding({
|
|
2819
|
-
assistantId: "self",
|
|
2820
2787
|
channel: "sms",
|
|
2821
2788
|
guardianExternalUserId: "telegram-user-default",
|
|
2822
2789
|
guardianDeliveryChatId: "chat-123",
|
|
@@ -2927,7 +2894,6 @@ describe("background channel processing approval prompts", () => {
|
|
|
2927
2894
|
test("marks guardian channel turns interactive and delivers approval prompt when confirmation is pending", async () => {
|
|
2928
2895
|
// Set up a guardian binding so the sender is recognized as a guardian
|
|
2929
2896
|
createGuardianBinding({
|
|
2930
|
-
assistantId: "self",
|
|
2931
2897
|
channel: "telegram",
|
|
2932
2898
|
guardianExternalUserId: "telegram-user-default",
|
|
2933
2899
|
guardianDeliveryChatId: "chat-123",
|
|
@@ -2991,7 +2957,6 @@ describe("background channel processing approval prompts", () => {
|
|
|
2991
2957
|
// Guardian binding includes extra whitespace; trust resolution canonicalizes
|
|
2992
2958
|
// identity and prompt delivery should still treat this sender as the guardian.
|
|
2993
2959
|
createGuardianBinding({
|
|
2994
|
-
assistantId: "self",
|
|
2995
2960
|
channel: "telegram",
|
|
2996
2961
|
guardianExternalUserId: " telegram-user-default ",
|
|
2997
2962
|
guardianDeliveryChatId: "chat-123",
|
|
@@ -3056,7 +3021,6 @@ describe("background channel processing approval prompts", () => {
|
|
|
3056
3021
|
// trusted contact (not the guardian). The guardian route is resolvable
|
|
3057
3022
|
// because the binding exists — approval notifications can be delivered.
|
|
3058
3023
|
createGuardianBinding({
|
|
3059
|
-
assistantId: "self",
|
|
3060
3024
|
channel: "telegram",
|
|
3061
3025
|
guardianExternalUserId: "guardian-user-other",
|
|
3062
3026
|
guardianDeliveryChatId: "guardian-chat-other",
|
|
@@ -3178,7 +3142,6 @@ describe("NL approval routing via destination-scoped canonical requests", () =>
|
|
|
3178
3142
|
|
|
3179
3143
|
// Create guardian binding for Telegram
|
|
3180
3144
|
createGuardianBinding({
|
|
3181
|
-
assistantId: "self",
|
|
3182
3145
|
channel: "telegram",
|
|
3183
3146
|
guardianExternalUserId: guardianUserId,
|
|
3184
3147
|
guardianDeliveryChatId: guardianChatId,
|
|
@@ -3236,7 +3199,6 @@ describe("NL approval routing via destination-scoped canonical requests", () =>
|
|
|
3236
3199
|
|
|
3237
3200
|
// Create guardian binding for the guardian user on the different chat
|
|
3238
3201
|
createGuardianBinding({
|
|
3239
|
-
assistantId: "self",
|
|
3240
3202
|
channel: "telegram",
|
|
3241
3203
|
guardianExternalUserId: guardianUserId,
|
|
3242
3204
|
guardianDeliveryChatId: differentChatId,
|
|
@@ -3293,7 +3255,6 @@ describe("trusted-contact self-approval blocked before guardian approval row exi
|
|
|
3293
3255
|
beforeEach(() => {
|
|
3294
3256
|
// Create a guardian binding so the requester resolves as trusted_contact
|
|
3295
3257
|
createGuardianBinding({
|
|
3296
|
-
assistantId: "self",
|
|
3297
3258
|
channel: "telegram",
|
|
3298
3259
|
guardianExternalUserId: "guardian-tc-selfapproval",
|
|
3299
3260
|
guardianDeliveryChatId: "guardian-tc-selfapproval-chat",
|
|
@@ -3301,7 +3262,6 @@ describe("trusted-contact self-approval blocked before guardian approval row exi
|
|
|
3301
3262
|
});
|
|
3302
3263
|
upsertContact({
|
|
3303
3264
|
displayName: "TC Self-Approval User",
|
|
3304
|
-
assistantId: "self",
|
|
3305
3265
|
channels: [
|
|
3306
3266
|
{
|
|
3307
3267
|
type: "telegram",
|