@vellumai/assistant 0.12.4 → 0.12.5-dev.202609251017.e467a6c
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 +9 -1
- package/docs/architecture/scheduling.md +13 -5
- package/docs/desktop-browser-cli.md +3 -2
- package/docs/guardian-request-flow.md +1 -1
- package/node_modules/@vellumai/avatar-manifest/src/__tests__/notification-avatar.test.ts +48 -4
- package/node_modules/@vellumai/avatar-manifest/src/notification-avatar.ts +12 -8
- package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/__tests__/guardian-requests.test.ts +26 -0
- package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/guardian-requests.ts +77 -3
- package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/__tests__/guardian-requests.test.ts +26 -0
- package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/guardian-requests.ts +77 -3
- package/node_modules/@vellumai/gateway-client/src/outbound-contract.ts +2 -4
- package/node_modules/@vellumai/service-contracts/src/__tests__/guardian-requests.test.ts +26 -0
- package/node_modules/@vellumai/service-contracts/src/guardian-requests.ts +77 -3
- package/openapi.yaml +152 -3
- package/package.json +1 -1
- package/src/__tests__/agent-loop.test.ts +76 -0
- package/src/__tests__/anthropic-error-formatting.test.ts +9 -0
- package/src/__tests__/background-shell-bash.test.ts +34 -0
- package/src/__tests__/background-shell-host-bash.test.ts +98 -1
- package/src/__tests__/background-tool-registry.test.ts +39 -0
- package/src/__tests__/channel-readiness-discord.test.ts +8 -0
- package/src/__tests__/channel-readiness-slack-remote.test.ts +8 -0
- package/src/__tests__/client-os-metadata-persistence.test.ts +4 -20
- package/src/__tests__/conversation-agent-loop.test.ts +529 -1
- package/src/__tests__/conversation-error.test.ts +18 -0
- package/src/__tests__/conversation-pairing.test.ts +69 -0
- package/src/__tests__/conversation-queue.test.ts +257 -4
- package/src/__tests__/conversation-runtime-assembly.test.ts +27 -0
- package/src/__tests__/emit-signal-routing-intent.test.ts +62 -0
- package/src/__tests__/evict-conversations-for-reload.test.ts +21 -0
- package/src/__tests__/gemini-provider.test.ts +9 -0
- package/src/__tests__/host-cu-proxy.test.ts +79 -0
- package/src/__tests__/host-cu-routes-targeted.test.ts +14 -5
- package/src/__tests__/introduction-card-resolver.test.ts +53 -8
- package/src/__tests__/job-handler-registration-guard.test.ts +1 -0
- package/src/__tests__/non-member-access-request.test.ts +48 -0
- package/src/__tests__/notification-events-source-context-probe.test.ts +48 -1
- package/src/__tests__/notification-platform-adapter.test.ts +97 -0
- package/src/__tests__/notification-vellum-adapter.test.ts +103 -3
- package/src/__tests__/platform-callback-registration.test.ts +46 -1
- package/src/__tests__/plugin-import-boundary-guard.test.ts +3 -0
- package/src/__tests__/scaffold-managed-skill-tool.test.ts +116 -66
- package/src/__tests__/scheduler-disk-pressure.test.ts +1 -0
- package/src/__tests__/scheduler-result-notification.test.ts +521 -7
- package/src/__tests__/scheduler-wake.test.ts +1 -0
- package/src/__tests__/skill-load-inline-command.test.ts +35 -0
- package/src/__tests__/subagent-cron-run-attribution.test.ts +41 -2
- package/src/__tests__/subagent-manager-notify.test.ts +48 -0
- package/src/__tests__/trusted-contact-inline-approval-integration.test.ts +6 -6
- package/src/__tests__/usage-attribution.test.ts +31 -0
- package/src/__tests__/wake-schedule-escalation.test.ts +1 -0
- package/src/agent/loop.ts +23 -0
- package/src/api/ask-question-tool.ts +50 -0
- package/src/api/events/generation-handoff.ts +4 -0
- package/src/api/events/message-complete.ts +4 -0
- package/src/api/events/tool-result.ts +11 -0
- package/src/api/index.ts +11 -0
- package/src/api/requests/guardian-actions.test.ts +45 -0
- package/src/api/requests/guardian-actions.ts +20 -0
- package/src/api/responses/conversation-message.ts +4 -0
- package/src/api/responses/home.ts +27 -0
- package/src/approvals/guardian-decision-primitive.ts +6 -4
- package/src/approvals/guardian-request-resolvers.ts +35 -30
- package/src/avatar/notification-avatar.test.ts +42 -34
- package/src/avatar/notification-avatar.ts +1 -0
- package/src/calls/__tests__/call-controller.test.ts +18 -0
- package/src/calls/__tests__/voice-control-protocol.test.ts +6 -1
- package/src/calls/__tests__/voice-leg-coordinator.test.ts +70 -0
- package/src/calls/__tests__/voice-session-bridge.test.ts +116 -4
- package/src/calls/__tests__/voice-triage-escalate.test.ts +77 -11
- package/src/calls/call-controller.ts +3 -1
- package/src/calls/voice-control-protocol.ts +12 -4
- package/src/calls/voice-escalation-judge.ts +2 -2
- package/src/calls/voice-leg-coordinator.ts +23 -5
- package/src/calls/voice-screen-annotation.ts +44 -0
- package/src/calls/voice-session-bridge.ts +63 -20
- package/src/calls/voice-triage-escalate.ts +82 -27
- package/src/cli/commands/__tests__/conversations-clear.test.ts +156 -0
- package/src/cli/commands/conversations.help.ts +7 -2
- package/src/cli/commands/conversations.ts +36 -30
- package/src/cli/commands/oauth/index.help.ts +8 -2
- package/src/cli/commands/oauth/request.test.ts +32 -0
- package/src/cli/commands/platform/index.help.ts +2 -1
- package/src/cli/commands/platform/index.ts +8 -2
- package/src/cli/lib/__tests__/plugin-catalog-cache.test.ts +60 -0
- package/src/cli/lib/__tests__/plugin-catalog-platform.test.ts +66 -2
- package/src/cli/lib/bundled-marketplace.json +35 -0
- package/src/cli/lib/bundled-plugin-packages.json +21 -0
- package/src/cli/lib/plugin-catalog-cache.ts +17 -2
- package/src/cli/lib/plugin-catalog-platform.ts +48 -9
- package/src/config/__tests__/default-profile-catalog.test.ts +28 -0
- package/src/config/__tests__/platform-identity.test.ts +59 -0
- package/src/config/__tests__/profile-order.test.ts +19 -0
- package/src/config/__tests__/sync-gated-profiles.test.ts +71 -0
- package/src/config/bundled-skills/computer-use/SKILL.md +20 -0
- package/src/config/bundled-skills/computer-use/TOOLS.json +11 -11
- package/src/config/bundled-skills/screen-annotation/SKILL.md +41 -29
- package/src/config/bundled-skills/screen-annotation/TOOLS.json +5 -5
- package/src/config/call-site-defaults.ts +6 -0
- package/src/config/default-profile-catalog.ts +30 -1
- package/src/config/default-profile-names.ts +36 -2
- package/src/config/feature-flag-registry.json +9 -1
- package/src/config/platform-identity.ts +22 -5
- package/src/config/profile-order.ts +7 -1
- package/src/config/schemas/call-site-catalog.ts +7 -0
- package/src/config/schemas/llm.ts +21 -5
- package/src/config/sync-gated-profiles.ts +96 -44
- package/src/daemon/__tests__/abort-null-controller.test.ts +135 -1
- package/src/daemon/__tests__/auto-profile-router.test.ts +380 -0
- package/src/daemon/__tests__/turn-tail-assistant-reply-notify.test.ts +16 -0
- package/src/daemon/activity-trail.test.ts +206 -0
- package/src/daemon/activity-trail.ts +190 -0
- package/src/daemon/auto-profile-router.ts +431 -0
- package/src/daemon/computer-use-observation.test.ts +81 -0
- package/src/daemon/computer-use-observation.ts +23 -0
- package/src/daemon/conversation-agent-loop-handlers.ts +11 -0
- package/src/daemon/conversation-agent-loop.ts +157 -32
- package/src/daemon/conversation-error.ts +19 -0
- package/src/daemon/conversation-lifecycle.ts +70 -7
- package/src/daemon/conversation-media-retry.ts +1 -2
- package/src/daemon/conversation-messaging.ts +31 -2
- package/src/daemon/conversation-process.ts +107 -16
- package/src/daemon/conversation-queue-manager.ts +7 -0
- package/src/daemon/conversation-runtime-assembly.ts +1 -0
- package/src/daemon/conversation-turn-finalize.ts +14 -0
- package/src/daemon/conversation.ts +25 -6
- package/src/daemon/event-loop-watchdog.test.ts +201 -2
- package/src/daemon/event-loop-watchdog.ts +182 -6
- package/src/daemon/host-cu-proxy.ts +34 -3
- package/src/daemon/pkb-reminder-builder.test.ts +10 -3
- package/src/daemon/pkb-reminder-builder.ts +1 -1
- package/src/daemon/wake-conversation-ops.ts +4 -2
- package/src/desktop/desktop-computer-use.test.ts +14 -4
- package/src/home/feed-types.ts +2 -0
- package/src/inbound/platform-callback-registration.ts +19 -6
- package/src/live-voice/__tests__/live-voice-agent-turn.test.ts +27 -0
- package/src/live-voice/__tests__/live-voice-flux-turn-end.test.ts +83 -0
- package/src/live-voice/__tests__/live-voice-triage-escalate.test.ts +48 -1
- package/src/live-voice/__tests__/live-voice-vad.test.ts +34 -2
- package/src/live-voice/__tests__/protocol.test.ts +22 -0
- package/src/live-voice/continuation-judge.ts +1 -1
- package/src/live-voice/live-voice-session.ts +25 -19
- package/src/live-voice/protocol.ts +16 -5
- package/src/messaging/providers/discord/withdraw.ts +4 -5
- package/src/messaging/providers/gmail/client.ts +4 -0
- package/src/messaging/providers/slack/withdraw.ts +5 -5
- package/src/messaging/providers/telegram-bot/withdraw.ts +4 -5
- package/src/monitoring/__tests__/proc-fixtures.ts +28 -0
- package/src/monitoring/__tests__/proc-wait-state.test.ts +232 -0
- package/src/monitoring/__tests__/process-usage.test.ts +243 -0
- package/src/monitoring/proc-wait-state.ts +366 -0
- package/src/monitoring/process-memory.ts +4 -3
- package/src/monitoring/process-usage.ts +215 -0
- package/src/monitoring/resource-sample-types.ts +8 -0
- package/src/monitoring/resource-sampler.ts +17 -2
- package/src/monitoring/stall-capture.ts +12 -0
- package/src/notifications/README.md +88 -9
- package/src/notifications/__tests__/assistant-reply-producer.test.ts +390 -119
- package/src/notifications/__tests__/background-result-producer.test.ts +1272 -0
- package/src/notifications/__tests__/broadcaster.test.ts +292 -1
- package/src/notifications/__tests__/completion-policy.test.ts +243 -0
- package/src/notifications/__tests__/decision-engine.test.ts +51 -4
- package/src/notifications/__tests__/has-pending-background-work.test.ts +281 -0
- package/src/notifications/__tests__/home-feed-side-effect.test.ts +161 -3
- package/src/notifications/__tests__/resolve-visible-in-source.test.ts +110 -1
- package/src/notifications/__tests__/schedule-result-producer.test.ts +11 -4
- package/src/notifications/adapters/macos.ts +24 -12
- package/src/notifications/adapters/platform.ts +16 -5
- package/src/notifications/assistant-reply-producer.ts +96 -71
- package/src/notifications/background-result-producer.ts +369 -0
- package/src/notifications/broadcaster.ts +28 -8
- package/src/notifications/completion-policy.ts +115 -0
- package/src/notifications/completion-work.ts +46 -0
- package/src/notifications/conversation-pairing.ts +32 -13
- package/src/notifications/decision-engine.ts +18 -24
- package/src/notifications/emit-signal.ts +16 -1
- package/src/notifications/events-store.ts +4 -0
- package/src/notifications/has-pending-background-work.ts +91 -0
- package/src/notifications/home-feed-mirror.ts +44 -0
- package/src/notifications/home-feed-side-effect.ts +54 -28
- package/src/notifications/resolve-visible-in-source.ts +56 -2
- package/src/notifications/result-output.ts +154 -0
- package/src/notifications/schedule-result-producer.ts +6 -187
- package/src/notifications/types.ts +2 -0
- package/src/oauth/AGENTS.md +9 -1
- package/src/oauth/byo-connection.test.ts +28 -0
- package/src/persistence/__tests__/recent-conversation-messages.test.ts +41 -0
- package/src/persistence/conversation-crud.ts +26 -0
- package/src/persistence/conversation-types.ts +15 -37
- package/src/persistence/embeddings/__tests__/embedding-local-lifecycle.test.ts +85 -14
- package/src/persistence/jobs-store.ts +229 -0
- package/src/persistence/migrations/383-normalize-opencode-host-connections.ts +44 -0
- package/src/persistence/migrations/__tests__/383-normalize-opencode-host-connections.test.ts +102 -0
- package/src/persistence/steps.ts +12 -0
- package/src/platform/sync-avatar.test.ts +29 -0
- package/src/plugins/defaults/memory/AGENTS.md +5 -3
- package/src/plugins/defaults/memory/__tests__/skill-update-receipt-boundary-guard.test.ts +45 -0
- package/src/plugins/defaults/memory/__tests__/skill-update-receipt-job.test.ts +580 -0
- package/src/plugins/defaults/memory/__tests__/turn-retrieval.test.ts +21 -0
- package/src/plugins/defaults/memory/graph/tools.ts +9 -5
- package/src/plugins/defaults/memory/hooks/conversation-deleted.ts +4 -0
- package/src/plugins/defaults/memory/hooks/user-prompt-submit.ts +7 -3
- package/src/plugins/defaults/memory/job-handlers.ts +8 -2
- package/src/plugins/defaults/memory/skill-update-receipt-job.ts +334 -0
- package/src/plugins/defaults/memory/tools.test.ts +17 -0
- package/src/plugins/defaults/memory/turn-retrieval.ts +8 -0
- package/src/plugins/defaults/memory/v3/__tests__/injection.test.ts +24 -0
- package/src/plugins/defaults/memory/v3/injector.ts +4 -4
- package/src/plugins/types.ts +2 -0
- package/src/providers/__tests__/search-provider-catalog.test.ts +8 -0
- package/src/providers/anthropic/client.ts +4 -0
- package/src/providers/gemini/client.ts +7 -1
- package/src/providers/inference/auth.ts +25 -0
- package/src/providers/inference/profile-probe.ts +1 -0
- package/src/{calls/__tests__/typesafe-noul.test.ts → providers/jev/ask.test.ts} +4 -4
- package/src/{calls/typesafe-noul.ts → providers/jev/ask.ts} +67 -34
- package/src/providers/openai/__tests__/api-error-normalization.test.ts +12 -0
- package/src/providers/openai/api-error-normalization.ts +4 -0
- package/src/providers/retry.ts +2 -0
- package/src/providers/search-provider-catalog.ts +10 -0
- package/src/providers/types.ts +7 -0
- package/src/providers/usage-tracking.ts +5 -3
- package/src/runtime/__tests__/agent-wake.test.ts +308 -0
- package/src/runtime/access-request-helper.ts +16 -9
- package/src/runtime/agent-wake-queue.ts +52 -0
- package/src/runtime/agent-wake.ts +111 -18
- package/src/runtime/channel-approval-types.ts +6 -38
- package/src/runtime/channel-approvals.ts +4 -5
- package/src/runtime/http-server.ts +4 -1
- package/src/runtime/introduction-policy.test.ts +17 -1
- package/src/runtime/introduction-policy.ts +25 -7
- package/src/runtime/migrations/vbundle-builder.ts +9 -0
- package/src/runtime/routes/__tests__/inference-profiles-routes.test.ts +21 -1
- package/src/runtime/routes/__tests__/inference-provider-connection-routes.test.ts +60 -0
- package/src/runtime/routes/__tests__/oauth-proxy-routes.test.ts +61 -3
- package/src/runtime/routes/auto-profile-routes.ts +83 -0
- package/src/runtime/routes/conversation-management-routes.ts +1 -3
- package/src/runtime/routes/conversation-routes.ts +9 -0
- package/src/runtime/routes/guardian-action-routes.ts +8 -23
- package/src/runtime/routes/host-cu-routes.ts +3 -1
- package/src/runtime/routes/index.ts +2 -0
- package/src/runtime/routes/inference-profiles-routes.ts +5 -2
- package/src/runtime/routes/inference-provider-connection-routes.ts +25 -8
- package/src/runtime/routes/migration-routes.ts +8 -2
- package/src/runtime/routes/oauth-proxy-passthrough.test.ts +32 -0
- package/src/runtime/routes/platform-routes.ts +6 -1
- package/src/runtime/routes/user-route-dispatcher.ts +1 -2
- package/src/runtime/web-presence.ts +3 -4
- package/src/schedule/schedule-store.ts +10 -0
- package/src/schedule/scheduler.ts +92 -24
- package/src/subagent/manager.ts +32 -12
- package/src/telegram/__tests__/webhook-health.test.ts +8 -0
- package/src/telemetry/telemetry-wire-source.json +1 -1
- package/src/telemetry/telemetry-wire.generated.ts +1 -0
- package/src/tools/background-tool-registry.ts +30 -3
- package/src/tools/browser/cdp-client/local-cdp-client.ts +1 -2
- package/src/tools/host-terminal/host-shell.ts +7 -0
- package/src/tools/network/__tests__/web-fetch-firecrawl.test.ts +28 -1
- package/src/tools/network/__tests__/web-fetch-metadata.test.ts +34 -0
- package/src/tools/network/__tests__/web-fetch-tinyfish.test.ts +35 -1
- package/src/tools/network/__tests__/web-search.test.ts +96 -0
- package/src/tools/network/web-fetch.ts +30 -9
- package/src/tools/network/web-search.ts +235 -4
- package/src/tools/skills/load.ts +13 -17
- package/src/tools/skills/scaffold-managed.ts +86 -71
- package/src/tools/terminal/shell-launch.test.ts +27 -1
- package/src/tools/terminal/shell.ts +4 -0
- package/src/tools/workspace-tools/loader.ts +1 -2
- package/src/usage/attribution.ts +18 -1
- package/src/util/abort-reasons.ts +2 -0
- package/src/util/errors.ts +1 -0
- package/src/util/oauth-request-body.test.ts +5 -1
- package/src/util/provider-error-patterns.ts +11 -0
- package/src/util/single-flight.test.ts +6 -0
- package/src/util/single-flight.ts +2 -0
- package/src/util/worker-pipe.test.ts +56 -10
- package/src/util/worker-pipe.ts +9 -4
- package/src/workspace/git-service.ts +6 -1
- package/src/workspace/migrations/158-repoint-opencode-host-provider-fragments.ts +163 -0
- package/src/workspace/migrations/__tests__/158-repoint-opencode-host-provider-fragments.test.ts +188 -0
- package/src/workspace/migrations/registry.ts +2 -0
|
@@ -31,6 +31,25 @@ let assistantRow: MessageRow | null = null;
|
|
|
31
31
|
let initiatingRow: MessageRow | null = null;
|
|
32
32
|
let attentionState: AttentionState | null = null;
|
|
33
33
|
let getConversationShouldThrow = false;
|
|
34
|
+
let pendingBackgroundWork = false;
|
|
35
|
+
let pendingWorkStartedAt: number | undefined;
|
|
36
|
+
let firstAssistantRow: MessageRow | null = null;
|
|
37
|
+
let persistedRows: MessageRow[] | undefined;
|
|
38
|
+
const recentHistoryPages: Array<string | undefined> = [];
|
|
39
|
+
const pendingWorkArgs: unknown[][] = [];
|
|
40
|
+
|
|
41
|
+
mock.module("../has-pending-background-work.js", () => ({
|
|
42
|
+
hasPendingBackgroundWork: (...args: unknown[]) => {
|
|
43
|
+
pendingWorkArgs.push(args);
|
|
44
|
+
if (pendingWorkStartedAt !== undefined) {
|
|
45
|
+
return (
|
|
46
|
+
pendingWorkStartedAt >=
|
|
47
|
+
(args[1] as { startedAfter: number }).startedAfter
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return pendingBackgroundWork;
|
|
51
|
+
},
|
|
52
|
+
}));
|
|
34
53
|
|
|
35
54
|
mock.module("../emit-signal.js", () => ({
|
|
36
55
|
emitNotificationSignal: async (params: any) => {
|
|
@@ -60,8 +79,31 @@ mock.module("../../persistence/conversation-crud.js", () => ({
|
|
|
60
79
|
},
|
|
61
80
|
getMessageById: (messageId: string) => {
|
|
62
81
|
messageLookups.push(messageId);
|
|
82
|
+
if (firstAssistantRow?.id === messageId) {
|
|
83
|
+
return firstAssistantRow;
|
|
84
|
+
}
|
|
85
|
+
const persisted = persistedRows?.find((row) => row.id === messageId);
|
|
86
|
+
if (persisted) {
|
|
87
|
+
return persisted;
|
|
88
|
+
}
|
|
63
89
|
return messageId === ASSISTANT_MESSAGE_ID ? assistantRow : initiatingRow;
|
|
64
90
|
},
|
|
91
|
+
getRecentConversationMessages: (
|
|
92
|
+
_conversationId: string,
|
|
93
|
+
limit: number,
|
|
94
|
+
beforeMessageId?: string,
|
|
95
|
+
) => {
|
|
96
|
+
recentHistoryPages.push(beforeMessageId);
|
|
97
|
+
const history =
|
|
98
|
+
persistedRows ??
|
|
99
|
+
[initiatingRow, firstAssistantRow, assistantRow].filter(
|
|
100
|
+
(row): row is MessageRow => row !== null,
|
|
101
|
+
);
|
|
102
|
+
const end = beforeMessageId
|
|
103
|
+
? history.findIndex((row) => row.id === beforeMessageId)
|
|
104
|
+
: history.length;
|
|
105
|
+
return history.slice(Math.max(0, end - limit), end);
|
|
106
|
+
},
|
|
65
107
|
}));
|
|
66
108
|
|
|
67
109
|
// Attachments the assistant row carries. Linked by the agent loop before the
|
|
@@ -78,6 +120,30 @@ mock.module("../../persistence/attachments-store.js", () => ({
|
|
|
78
120
|
},
|
|
79
121
|
}));
|
|
80
122
|
|
|
123
|
+
let guardianPrincipalId: string | undefined = "guardian-1";
|
|
124
|
+
let guardianLookupGate: Promise<void> | undefined;
|
|
125
|
+
let onGuardianLookup = () => {};
|
|
126
|
+
const realGuardianDelivery =
|
|
127
|
+
await import("../../contacts/guardian-delivery-reader.js");
|
|
128
|
+
mock.module("../../contacts/guardian-delivery-reader.js", () => ({
|
|
129
|
+
...realGuardianDelivery,
|
|
130
|
+
getGuardianDelivery: async () => {
|
|
131
|
+
onGuardianLookup();
|
|
132
|
+
if (guardianLookupGate) {
|
|
133
|
+
await guardianLookupGate;
|
|
134
|
+
}
|
|
135
|
+
return guardianPrincipalId
|
|
136
|
+
? [
|
|
137
|
+
{
|
|
138
|
+
channelType: "vellum",
|
|
139
|
+
status: "active",
|
|
140
|
+
principalId: guardianPrincipalId,
|
|
141
|
+
},
|
|
142
|
+
]
|
|
143
|
+
: null;
|
|
144
|
+
},
|
|
145
|
+
}));
|
|
146
|
+
|
|
81
147
|
// Defaults to unattended, so every other case in this file exercises the
|
|
82
148
|
// unsuppressed path.
|
|
83
149
|
let desktopAttended = false;
|
|
@@ -290,10 +356,19 @@ async function run(
|
|
|
290
356
|
}
|
|
291
357
|
|
|
292
358
|
beforeEach(() => {
|
|
359
|
+
pendingBackgroundWork = false;
|
|
360
|
+
pendingWorkStartedAt = undefined;
|
|
361
|
+
firstAssistantRow = null;
|
|
362
|
+
persistedRows = undefined;
|
|
363
|
+
recentHistoryPages.length = 0;
|
|
364
|
+
pendingWorkArgs.length = 0;
|
|
293
365
|
emitCalls.length = 0;
|
|
294
366
|
warnCalls.length = 0;
|
|
295
367
|
messageLookups.length = 0;
|
|
296
368
|
attachmentLookups.length = 0;
|
|
369
|
+
guardianPrincipalId = "guardian-1";
|
|
370
|
+
guardianLookupGate = undefined;
|
|
371
|
+
onGuardianLookup = () => {};
|
|
297
372
|
desktopPresenceArgs.length = 0;
|
|
298
373
|
webPresenceArgs.length = 0;
|
|
299
374
|
assistantAttachments = [];
|
|
@@ -316,6 +391,281 @@ beforeEach(() => {
|
|
|
316
391
|
// ── Tests ──────────────────────────────────────────────────────────────
|
|
317
392
|
|
|
318
393
|
describe("emitAssistantReplyNotification", () => {
|
|
394
|
+
function appendCompletedContinuation(): void {
|
|
395
|
+
persistedRows = [
|
|
396
|
+
...(persistedRows ?? [initiatingRow!, assistantRow!]),
|
|
397
|
+
makeMessage({
|
|
398
|
+
id: "msg-completed-trigger",
|
|
399
|
+
createdAt: assistantRow!.createdAt,
|
|
400
|
+
metadata: JSON.stringify({
|
|
401
|
+
backgroundEventSource: "background-tool",
|
|
402
|
+
backgroundToolCompletion: {
|
|
403
|
+
id: "tool-completed",
|
|
404
|
+
toolName: "bash",
|
|
405
|
+
conversationId: CONVERSATION_ID,
|
|
406
|
+
command: "example-command",
|
|
407
|
+
startedAt: assistantRow!.createdAt,
|
|
408
|
+
completedAt: assistantRow!.createdAt,
|
|
409
|
+
status: "completed",
|
|
410
|
+
exitCode: 0,
|
|
411
|
+
output: "completed",
|
|
412
|
+
},
|
|
413
|
+
}),
|
|
414
|
+
}),
|
|
415
|
+
makeMessage({
|
|
416
|
+
id: "msg-completed-result",
|
|
417
|
+
role: "assistant",
|
|
418
|
+
createdAt: assistantRow!.createdAt,
|
|
419
|
+
content: [{ type: "text", text: "The requested work is finished." }],
|
|
420
|
+
}),
|
|
421
|
+
];
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
test.each([false, true])(
|
|
425
|
+
"suppresses a stale kickoff after fast completion with projected=%s and timestamp ties",
|
|
426
|
+
async (projected) => {
|
|
427
|
+
assistantRow!.content = [{ type: "text", text: "The work is started." }];
|
|
428
|
+
appendCompletedContinuation();
|
|
429
|
+
if (projected) {
|
|
430
|
+
attentionState!.latestAssistantMessageId = "msg-completed-result";
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
await run();
|
|
434
|
+
|
|
435
|
+
expect(pendingBackgroundWork).toBe(false);
|
|
436
|
+
expect(emitCalls).toHaveLength(0);
|
|
437
|
+
},
|
|
438
|
+
);
|
|
439
|
+
|
|
440
|
+
test.each(["new continuation", "pending continuation", "reply seen"])(
|
|
441
|
+
"rechecks freshness after presence lookup when there is a %s",
|
|
442
|
+
async (change) => {
|
|
443
|
+
const { promise: lookupStarted, resolve: markLookupStarted } =
|
|
444
|
+
Promise.withResolvers<void>();
|
|
445
|
+
const { promise: lookupReady, resolve: releaseLookup } =
|
|
446
|
+
Promise.withResolvers<void>();
|
|
447
|
+
onGuardianLookup = markLookupStarted;
|
|
448
|
+
guardianLookupGate = lookupReady;
|
|
449
|
+
const notification = run();
|
|
450
|
+
await lookupStarted;
|
|
451
|
+
if (change === "new continuation") {
|
|
452
|
+
appendCompletedContinuation();
|
|
453
|
+
} else if (change === "pending continuation") {
|
|
454
|
+
pendingBackgroundWork = true;
|
|
455
|
+
} else {
|
|
456
|
+
attentionState!.lastSeenAssistantMessageAt = assistantRow!.createdAt;
|
|
457
|
+
}
|
|
458
|
+
releaseLookup();
|
|
459
|
+
await notification;
|
|
460
|
+
|
|
461
|
+
expect(emitCalls).toHaveLength(0);
|
|
462
|
+
},
|
|
463
|
+
);
|
|
464
|
+
|
|
465
|
+
test.each(["text", "media"])(
|
|
466
|
+
"keeps an unseen public %s reply with a same-turn private wrap-up across history pages",
|
|
467
|
+
async (replyType) => {
|
|
468
|
+
if (replyType === "media") {
|
|
469
|
+
assistantRow!.content = [];
|
|
470
|
+
assistantAttachments = [{ originalFilename: "report.pdf" }];
|
|
471
|
+
}
|
|
472
|
+
persistedRows = [initiatingRow!, assistantRow!];
|
|
473
|
+
for (let index = 0; index < 110; index++) {
|
|
474
|
+
persistedRows.push(
|
|
475
|
+
makeMessage({
|
|
476
|
+
id: `msg-private-${index}`,
|
|
477
|
+
role: "assistant",
|
|
478
|
+
content: [
|
|
479
|
+
{
|
|
480
|
+
type: "tool_use",
|
|
481
|
+
id: `tool-${index}`,
|
|
482
|
+
name: "bash",
|
|
483
|
+
input: {},
|
|
484
|
+
},
|
|
485
|
+
],
|
|
486
|
+
metadata: JSON.stringify({ assistantTextVisibility: "private" }),
|
|
487
|
+
createdAt: assistantRow!.createdAt + index + 1,
|
|
488
|
+
}),
|
|
489
|
+
makeMessage({
|
|
490
|
+
id: `msg-tool-result-${index}`,
|
|
491
|
+
content: [
|
|
492
|
+
{
|
|
493
|
+
type: "tool_result",
|
|
494
|
+
tool_use_id: `tool-${index}`,
|
|
495
|
+
content: "ok",
|
|
496
|
+
},
|
|
497
|
+
],
|
|
498
|
+
createdAt: assistantRow!.createdAt + index + 1,
|
|
499
|
+
}),
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
const wrapUp = makeMessage({
|
|
503
|
+
id: "msg-private-wrap-up",
|
|
504
|
+
role: "assistant",
|
|
505
|
+
content: [{ type: "text", text: "Private working notes." }],
|
|
506
|
+
metadata: JSON.stringify({ assistantTextVisibility: "private" }),
|
|
507
|
+
createdAt: assistantRow!.createdAt + 200,
|
|
508
|
+
});
|
|
509
|
+
persistedRows.push(wrapUp);
|
|
510
|
+
attentionState!.latestAssistantMessageId = wrapUp.id;
|
|
511
|
+
attentionState!.latestAssistantMessageAt = wrapUp.createdAt;
|
|
512
|
+
|
|
513
|
+
await run();
|
|
514
|
+
|
|
515
|
+
expect(recentHistoryPages).toContain(
|
|
516
|
+
persistedRows[persistedRows.length - 200].id,
|
|
517
|
+
);
|
|
518
|
+
expect(emitCalls).toHaveLength(1);
|
|
519
|
+
expect(emitCalls[0].contextPayload.requestedMessage).toBe(
|
|
520
|
+
replyType === "media" ? "Sent report.pdf" : "Sure, here is the plan.",
|
|
521
|
+
);
|
|
522
|
+
},
|
|
523
|
+
);
|
|
524
|
+
|
|
525
|
+
test("does not reuse a seen public reply because a private wrap-up is unseen", async () => {
|
|
526
|
+
const wrapUp = makeMessage({
|
|
527
|
+
id: "msg-private-wrap-up",
|
|
528
|
+
role: "assistant",
|
|
529
|
+
metadata: JSON.stringify({ assistantTextVisibility: "private" }),
|
|
530
|
+
createdAt: assistantRow!.createdAt + 1,
|
|
531
|
+
});
|
|
532
|
+
persistedRows = [initiatingRow!, assistantRow!, wrapUp];
|
|
533
|
+
attentionState!.latestAssistantMessageId = wrapUp.id;
|
|
534
|
+
attentionState!.latestAssistantMessageAt = wrapUp.createdAt;
|
|
535
|
+
attentionState!.lastSeenAssistantMessageAt = assistantRow!.createdAt;
|
|
536
|
+
|
|
537
|
+
await run();
|
|
538
|
+
|
|
539
|
+
expect(emitCalls).toHaveLength(0);
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
test.each([false, true])(
|
|
543
|
+
"keeps a newer reply eligible when older work starts its continuation, completed=%s",
|
|
544
|
+
async (completed) => {
|
|
545
|
+
appendCompletedContinuation();
|
|
546
|
+
const trigger = persistedRows![2];
|
|
547
|
+
const metadata = JSON.parse(trigger.metadata!);
|
|
548
|
+
metadata.backgroundToolCompletion.startedAt =
|
|
549
|
+
assistantRow!.createdAt - 1000;
|
|
550
|
+
trigger.metadata = JSON.stringify(metadata);
|
|
551
|
+
if (!completed) {
|
|
552
|
+
persistedRows!.pop();
|
|
553
|
+
}
|
|
554
|
+
await run();
|
|
555
|
+
expect(emitCalls).toHaveLength(1);
|
|
556
|
+
},
|
|
557
|
+
);
|
|
558
|
+
|
|
559
|
+
test("keeps a later human reply eligible after old background completion", async () => {
|
|
560
|
+
appendCompletedContinuation();
|
|
561
|
+
persistedRows = persistedRows!.map((row) => ({
|
|
562
|
+
...row,
|
|
563
|
+
id: `old-${row.id}`,
|
|
564
|
+
createdAt: row.createdAt - 1000,
|
|
565
|
+
}));
|
|
566
|
+
persistedRows!.push(initiatingRow!, assistantRow!);
|
|
567
|
+
|
|
568
|
+
await run();
|
|
569
|
+
|
|
570
|
+
expect(emitCalls).toHaveLength(1);
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
test.each([false, true])(
|
|
574
|
+
"preserves a mixed human/hidden batch unless a later continuation exists=%s",
|
|
575
|
+
async (laterContinuation) => {
|
|
576
|
+
initiatingRow!.metadata = JSON.stringify({
|
|
577
|
+
turnOutcome: "batched",
|
|
578
|
+
turnBatchedInto: "msg-hidden-batch-tail",
|
|
579
|
+
});
|
|
580
|
+
const hiddenTail = makeMessage({
|
|
581
|
+
id: "msg-hidden-batch-tail",
|
|
582
|
+
metadata: JSON.stringify({ hidden: true }),
|
|
583
|
+
});
|
|
584
|
+
persistedRows = [initiatingRow!, hiddenTail, assistantRow!];
|
|
585
|
+
if (laterContinuation) {
|
|
586
|
+
appendCompletedContinuation();
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
await run();
|
|
590
|
+
|
|
591
|
+
expect(emitCalls).toHaveLength(laterContinuation ? 0 : 1);
|
|
592
|
+
},
|
|
593
|
+
);
|
|
594
|
+
|
|
595
|
+
test.each([undefined, "", 123, "msg-missing-target"])(
|
|
596
|
+
"rejects a malformed or missing batch target %s",
|
|
597
|
+
async (turnBatchedInto) => {
|
|
598
|
+
initiatingRow!.metadata = JSON.stringify({
|
|
599
|
+
turnOutcome: "batched",
|
|
600
|
+
turnBatchedInto,
|
|
601
|
+
});
|
|
602
|
+
|
|
603
|
+
await run();
|
|
604
|
+
|
|
605
|
+
expect(emitCalls).toHaveLength(0);
|
|
606
|
+
},
|
|
607
|
+
);
|
|
608
|
+
|
|
609
|
+
test("scopes unfinished work to this reply's turn, including its tool-call rows", async () => {
|
|
610
|
+
firstAssistantRow = makeMessage({
|
|
611
|
+
id: "msg-first-assistant",
|
|
612
|
+
role: "assistant",
|
|
613
|
+
createdAt: 1700000000100,
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
await run();
|
|
617
|
+
|
|
618
|
+
expect(emitCalls).toHaveLength(1);
|
|
619
|
+
expect(pendingWorkArgs.length).toBeGreaterThan(0);
|
|
620
|
+
for (const args of pendingWorkArgs) {
|
|
621
|
+
expect(args).toEqual([
|
|
622
|
+
CONVERSATION_ID,
|
|
623
|
+
{ startedAfter: firstAssistantRow.createdAt },
|
|
624
|
+
]);
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
test("long turns retain the pending work cutoff from their first assistant row", async () => {
|
|
629
|
+
const first = makeMessage({
|
|
630
|
+
id: "msg-first-assistant",
|
|
631
|
+
role: "assistant",
|
|
632
|
+
createdAt: initiatingRow!.createdAt + 1,
|
|
633
|
+
});
|
|
634
|
+
pendingWorkStartedAt = first.createdAt + 1;
|
|
635
|
+
persistedRows = [initiatingRow!, first];
|
|
636
|
+
for (let index = 0; index < 220; index++) {
|
|
637
|
+
persistedRows.push(
|
|
638
|
+
makeMessage({
|
|
639
|
+
id: `msg-long-turn-${index}`,
|
|
640
|
+
role: "assistant",
|
|
641
|
+
createdAt: first.createdAt + index + 2,
|
|
642
|
+
}),
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
assistantRow!.createdAt = first.createdAt + 300;
|
|
646
|
+
attentionState!.latestAssistantMessageAt = assistantRow!.createdAt;
|
|
647
|
+
persistedRows.push(assistantRow!);
|
|
648
|
+
|
|
649
|
+
await run();
|
|
650
|
+
|
|
651
|
+
expect(emitCalls).toHaveLength(0);
|
|
652
|
+
expect(pendingWorkArgs[0]).toEqual([
|
|
653
|
+
CONVERSATION_ID,
|
|
654
|
+
{ startedAfter: first.createdAt },
|
|
655
|
+
]);
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
test("does not announce completion while delegated work is pending", async () => {
|
|
659
|
+
pendingBackgroundWork = true;
|
|
660
|
+
assistantRow = makeAssistantRow([
|
|
661
|
+
{ type: "text", text: "I have started the requested work." },
|
|
662
|
+
]);
|
|
663
|
+
|
|
664
|
+
await run();
|
|
665
|
+
|
|
666
|
+
expect(emitCalls).toHaveLength(0);
|
|
667
|
+
});
|
|
668
|
+
|
|
319
669
|
test("emits one well-formed signal for an unseen user-conversation reply", async () => {
|
|
320
670
|
await run();
|
|
321
671
|
|
|
@@ -336,7 +686,7 @@ describe("emitAssistantReplyNotification", () => {
|
|
|
336
686
|
},
|
|
337
687
|
dedupeKey: `chat.assistant_reply:${CONVERSATION_ID}:${ASSISTANT_MESSAGE_ID}`,
|
|
338
688
|
});
|
|
339
|
-
//
|
|
689
|
+
// Completion alerts link to the existing conversation.
|
|
340
690
|
expect("requiresConversation" in emitCalls[0]).toBe(false);
|
|
341
691
|
expect("conversationAffinityHint" in emitCalls[0]).toBe(false);
|
|
342
692
|
expect("routingIntent" in emitCalls[0]).toBe(false);
|
|
@@ -355,139 +705,34 @@ describe("emitAssistantReplyNotification", () => {
|
|
|
355
705
|
// so the producer's contract here is the hint it emits, not the silence.
|
|
356
706
|
describe("desktop presence", () => {
|
|
357
707
|
beforeEach(() => {
|
|
358
|
-
initiatingRow = makeMacOriginatedMessage();
|
|
359
708
|
desktopAttended = true;
|
|
360
709
|
});
|
|
361
710
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
// has exactly one owner, so no principal filter belongs here.
|
|
369
|
-
expect(desktopPresenceArgs).toEqual([[]]);
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
test("marks a Windows-originated signal source-active while attended", async () => {
|
|
373
|
-
initiatingRow = makeWindowsOriginatedMessage();
|
|
374
|
-
|
|
375
|
-
await run();
|
|
376
|
-
|
|
377
|
-
expect(emitCalls).toHaveLength(1);
|
|
378
|
-
expect(emitCalls[0].attentionHints.visibleInSourceNow).toBe(true);
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
test("leaves the signal live when no desktop is attended", async () => {
|
|
382
|
-
desktopAttended = false;
|
|
383
|
-
|
|
384
|
-
await run();
|
|
385
|
-
|
|
386
|
-
expect(emitCalls).toHaveLength(1);
|
|
387
|
-
expect(emitCalls[0].attentionHints.visibleInSourceNow).toBe(false);
|
|
388
|
-
});
|
|
389
|
-
|
|
390
|
-
test("leaves the signal live when the presence read throws", async () => {
|
|
391
|
-
desktopPresenceShouldThrow = true;
|
|
392
|
-
|
|
393
|
-
await run();
|
|
394
|
-
|
|
395
|
-
expect(emitCalls).toHaveLength(1);
|
|
396
|
-
expect(emitCalls[0].attentionHints.visibleInSourceNow).toBe(false);
|
|
397
|
-
expect(warnCalls).toHaveLength(1);
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
// An attended desktop only speaks for a turn that desktop itself opened.
|
|
401
|
-
// The user can send from the phone minutes after last touching the keyboard,
|
|
402
|
-
// is exactly the reply this producer exists to push.
|
|
403
|
-
const NON_DESKTOP_ORIGIN_CASES: Array<{
|
|
404
|
-
name: string;
|
|
405
|
-
metadata: unknown;
|
|
406
|
-
}> = [
|
|
407
|
-
{
|
|
408
|
-
name: "the iOS app",
|
|
409
|
-
metadata: { client: { os: "ios" }, clientOsFromRequest: true },
|
|
410
|
-
},
|
|
411
|
-
{
|
|
412
|
-
name: "a browser",
|
|
413
|
-
metadata: { client: { os: "web" }, clientOsFromRequest: true },
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
name: "a client that reports no OS",
|
|
417
|
-
metadata: { client: {} },
|
|
418
|
-
},
|
|
419
|
-
{ name: "a row with no client bag", metadata: {} },
|
|
420
|
-
{
|
|
421
|
-
name: "a client reporting an unknown OS",
|
|
422
|
-
metadata: { client: { os: "bsd" }, clientOsFromRequest: true },
|
|
423
|
-
},
|
|
424
|
-
// The fail-closed shape this gate exists to refuse: a surface action
|
|
425
|
-
// tapped on the phone carries no transport, so persistence stamps the
|
|
426
|
-
// `macos` the conversation's live client state kept from an earlier
|
|
427
|
-
// desktop send. Without the marker that OS names an earlier turn, not
|
|
428
|
-
// this one, and the push the user is waiting for on their phone would
|
|
429
|
-
// be dropped by the attended desktop.
|
|
430
|
-
{
|
|
431
|
-
name: "a row whose macOS OS was inherited, not reported",
|
|
432
|
-
metadata: { userMessageInterface: "web", client: { os: "macos" } },
|
|
433
|
-
},
|
|
434
|
-
// A marker without a matching OS is not evidence of anything.
|
|
435
|
-
{
|
|
436
|
-
name: "a row marked request-reported with no client bag",
|
|
437
|
-
metadata: { clientOsFromRequest: true },
|
|
438
|
-
},
|
|
439
|
-
];
|
|
440
|
-
|
|
441
|
-
for (const { name, metadata } of NON_DESKTOP_ORIGIN_CASES) {
|
|
442
|
-
test(`leaves the signal live for a turn opened from ${name}`, async () => {
|
|
443
|
-
initiatingRow = makeMessage({ metadata: JSON.stringify(metadata) });
|
|
444
|
-
|
|
711
|
+
for (const [name, makeRow] of [
|
|
712
|
+
["macOS", makeMacOriginatedMessage],
|
|
713
|
+
["Windows", makeWindowsOriginatedMessage],
|
|
714
|
+
] as const) {
|
|
715
|
+
test(`notifies an unseen ${name} reply while the user is in another app`, async () => {
|
|
716
|
+
initiatingRow = makeRow();
|
|
445
717
|
await run();
|
|
446
718
|
|
|
447
719
|
expect(emitCalls).toHaveLength(1);
|
|
448
720
|
expect(emitCalls[0].attentionHints.visibleInSourceNow).toBe(false);
|
|
449
|
-
// The origin check runs first, so a turn no desktop opened never
|
|
450
|
-
// reaches the presence read.
|
|
451
721
|
expect(desktopPresenceArgs).toEqual([]);
|
|
452
722
|
});
|
|
453
723
|
}
|
|
454
724
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
initiatingRow = makeMessage({
|
|
459
|
-
metadata: JSON.stringify({
|
|
460
|
-
userMessageChannel: "vellum",
|
|
461
|
-
userMessageInterface: "web",
|
|
462
|
-
}),
|
|
463
|
-
});
|
|
464
|
-
|
|
725
|
+
test("ignores whole-computer presence even when its read would fail", async () => {
|
|
726
|
+
initiatingRow = makeMacOriginatedMessage();
|
|
727
|
+
desktopPresenceShouldThrow = true;
|
|
465
728
|
await run();
|
|
466
729
|
|
|
467
|
-
expect(emitCalls).toHaveLength(1);
|
|
468
730
|
expect(emitCalls[0].attentionHints.visibleInSourceNow).toBe(false);
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
// An unrecognized channel fails the whole metadata schema, so the origin
|
|
472
|
-
// read has to answer off the permissive fallback too.
|
|
473
|
-
test("marks the signal source-active when only the channel is unrecognized", async () => {
|
|
474
|
-
initiatingRow = makeMessage({
|
|
475
|
-
metadata: JSON.stringify({
|
|
476
|
-
userMessageChannel: "not-a-channel",
|
|
477
|
-
client: { os: "macos" },
|
|
478
|
-
clientOsFromRequest: true,
|
|
479
|
-
}),
|
|
480
|
-
});
|
|
481
|
-
|
|
482
|
-
await run();
|
|
483
|
-
|
|
484
|
-
expect(emitCalls).toHaveLength(1);
|
|
485
|
-
expect(emitCalls[0].attentionHints.visibleInSourceNow).toBe(true);
|
|
731
|
+
expect(desktopPresenceArgs).toEqual([]);
|
|
732
|
+
expect(warnCalls).toHaveLength(0);
|
|
486
733
|
});
|
|
487
734
|
});
|
|
488
735
|
|
|
489
|
-
// Same pre-gate as "desktop presence" above, scoped to a browser tab
|
|
490
|
-
// instead of the whole app.
|
|
491
736
|
describe("web presence", () => {
|
|
492
737
|
beforeEach(() => {
|
|
493
738
|
initiatingRow = makeWebOriginatedMessage();
|
|
@@ -501,7 +746,18 @@ describe("emitAssistantReplyNotification", () => {
|
|
|
501
746
|
expect(emitCalls[0].attentionHints.visibleInSourceNow).toBe(true);
|
|
502
747
|
// Scoped to this conversation, unlike desktop attendance: a focused tab
|
|
503
748
|
// only speaks for the conversation it is actually looking at.
|
|
504
|
-
expect(webPresenceArgs).toEqual([
|
|
749
|
+
expect(webPresenceArgs).toEqual([
|
|
750
|
+
[CONVERSATION_ID, { actorPrincipalId: "guardian-1" }],
|
|
751
|
+
]);
|
|
752
|
+
});
|
|
753
|
+
|
|
754
|
+
test("does not suppress without a resolved recipient", async () => {
|
|
755
|
+
guardianPrincipalId = undefined;
|
|
756
|
+
await run();
|
|
757
|
+
|
|
758
|
+
expect(emitCalls).toHaveLength(1);
|
|
759
|
+
expect(emitCalls[0].attentionHints.visibleInSourceNow).toBe(false);
|
|
760
|
+
expect(webPresenceArgs).toEqual([]);
|
|
505
761
|
});
|
|
506
762
|
|
|
507
763
|
test("leaves the signal live when no web tab is focused on this conversation", async () => {
|
|
@@ -540,7 +796,9 @@ describe("emitAssistantReplyNotification", () => {
|
|
|
540
796
|
|
|
541
797
|
expect(emitCalls).toHaveLength(1);
|
|
542
798
|
expect(emitCalls[0].attentionHints.visibleInSourceNow).toBe(true);
|
|
543
|
-
expect(webPresenceArgs).toEqual([
|
|
799
|
+
expect(webPresenceArgs).toEqual([
|
|
800
|
+
[CONVERSATION_ID, { actorPrincipalId: "guardian-1" }],
|
|
801
|
+
]);
|
|
544
802
|
});
|
|
545
803
|
});
|
|
546
804
|
|
|
@@ -957,6 +1215,19 @@ describe("emitAssistantReplyNotification", () => {
|
|
|
957
1215
|
});
|
|
958
1216
|
}
|
|
959
1217
|
|
|
1218
|
+
test("pushes the reply to a hidden voice continuation result", async () => {
|
|
1219
|
+
initiatingRow = makeMessage({
|
|
1220
|
+
metadata: JSON.stringify({
|
|
1221
|
+
hidden: true,
|
|
1222
|
+
voiceContinuationResult: true,
|
|
1223
|
+
}),
|
|
1224
|
+
});
|
|
1225
|
+
|
|
1226
|
+
await run();
|
|
1227
|
+
|
|
1228
|
+
expect(emitCalls).toHaveLength(1);
|
|
1229
|
+
});
|
|
1230
|
+
|
|
960
1231
|
// A pointer turn fact-checks the rows it generated only after the turn ends
|
|
961
1232
|
// and deletes them when validation fails, so a push at turn end would have
|
|
962
1233
|
// already carried a call outcome the deterministic fallback then replaces.
|