@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
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import type { CreateOutboundSessionIpcResponse } from "@vellumai/gateway-client";
|
|
19
|
+
import { isDenyingGuardianAction } from "@vellumai/service-contracts/guardian-requests";
|
|
19
20
|
|
|
20
21
|
import { answerCall } from "../calls/call-domain.js";
|
|
21
22
|
import type {
|
|
@@ -40,14 +41,12 @@ import type {
|
|
|
40
41
|
import type { QuestionBatchSubmission } from "../permissions/question-prompter.js";
|
|
41
42
|
import type { UserDecision } from "../permissions/types.js";
|
|
42
43
|
import { DAEMON_INTERNAL_ASSISTANT_ID } from "../runtime/assistant-scope.js";
|
|
43
|
-
import {
|
|
44
|
-
type ApprovalAction,
|
|
45
|
-
DENYING_ACTION_SET,
|
|
46
|
-
} from "../runtime/channel-approval-types.js";
|
|
44
|
+
import { type ApprovalAction } from "../runtime/channel-approval-types.js";
|
|
47
45
|
import { deliverChannelReply } from "../runtime/gateway-client.js";
|
|
48
46
|
import {
|
|
49
47
|
introductionMode,
|
|
50
48
|
parseRequesterSignals,
|
|
49
|
+
requesterCanCompleteHandshake,
|
|
51
50
|
type RequesterIdentitySignals,
|
|
52
51
|
resolveTrustBinding,
|
|
53
52
|
} from "../runtime/introduction-policy.js";
|
|
@@ -365,7 +364,7 @@ const pendingInteractionResolver: GuardianRequestResolver = {
|
|
|
365
364
|
|
|
366
365
|
// Map action to the permission system's UserDecision type and notify session.
|
|
367
366
|
// resolveConfirmation() owns pendingInteractions deregistration.
|
|
368
|
-
const userDecision: UserDecision =
|
|
367
|
+
const userDecision: UserDecision = isDenyingGuardianAction(decision.action)
|
|
369
368
|
? "deny"
|
|
370
369
|
: "allow";
|
|
371
370
|
|
|
@@ -551,7 +550,7 @@ async function resolveAskQuestionInteraction(
|
|
|
551
550
|
kind: "free_text",
|
|
552
551
|
text: decision.userText.trim(),
|
|
553
552
|
};
|
|
554
|
-
} else if (
|
|
553
|
+
} else if (isDenyingGuardianAction(decision.action)) {
|
|
555
554
|
submission = { questionId, kind: "skip" };
|
|
556
555
|
} else {
|
|
557
556
|
// Bare approval with no text (e.g. "CODE approve") — affirm without
|
|
@@ -621,20 +620,33 @@ const OUTCOME_BY_ACTION = {
|
|
|
621
620
|
} as const satisfies Record<ApprovalAction, IntroductionOutcome>;
|
|
622
621
|
|
|
623
622
|
/**
|
|
624
|
-
* The introduction outcome a decision action resolves to for an access
|
|
625
|
-
* The generic decision pair folds onto the card outcomes (`reject` →
|
|
626
|
-
* `leave_unverified`, `approve_once` → `verify_code`)
|
|
627
|
-
* map to themselves
|
|
628
|
-
*
|
|
629
|
-
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
*
|
|
623
|
+
* The introduction outcome a decision action resolves to for an access
|
|
624
|
+
* request. The generic decision pair folds onto the card outcomes (`reject` →
|
|
625
|
+
* `leave_unverified`, `approve_once` → `verify_code`) and the introduction
|
|
626
|
+
* actions map to themselves, except that a handshake approval on a requester
|
|
627
|
+
* who can never complete the handshake (a bot, an email sender) resolves to
|
|
628
|
+
* direct trust: the guardian's intent ("let them in") is unambiguous.
|
|
629
|
+
*
|
|
630
|
+
* The one derivation of the outcome: the resolver plans and follows through on
|
|
631
|
+
* it, and the decision primitive reports it (`decidedAction`) and projects it
|
|
632
|
+
* onto the resolved cards, so a `reject` that parked the contact reads as the
|
|
633
|
+
* neutral "Left unverified" and a coerced approval reads as the trust it was.
|
|
633
634
|
*/
|
|
634
635
|
export function introductionOutcomeForAction(
|
|
636
|
+
request: Pick<GuardianRequestWire, "sourceChannel" | "requesterSignals">,
|
|
635
637
|
action: ApprovalAction,
|
|
636
|
-
):
|
|
637
|
-
|
|
638
|
+
): IntroductionOutcome {
|
|
639
|
+
const outcome = OUTCOME_BY_ACTION[action];
|
|
640
|
+
if (
|
|
641
|
+
outcome === "verify_code" &&
|
|
642
|
+
!requesterCanCompleteHandshake(
|
|
643
|
+
request.sourceChannel ?? undefined,
|
|
644
|
+
parseRequesterSignals(request.requesterSignals),
|
|
645
|
+
)
|
|
646
|
+
) {
|
|
647
|
+
return "trust";
|
|
648
|
+
}
|
|
649
|
+
return outcome;
|
|
638
650
|
}
|
|
639
651
|
|
|
640
652
|
/** Derived access-request decision facts shared by `prepare` and `resolve`. */
|
|
@@ -677,15 +689,7 @@ function deriveAccessRequestDecision(
|
|
|
677
689
|
requesterContactResult?.contact.displayName ?? null;
|
|
678
690
|
|
|
679
691
|
const signals = parseRequesterSignals(request.requesterSignals);
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
// A bot cannot return a verification code, so a handshake approval on a
|
|
683
|
-
// bot requester can never complete. Coerce it to direct trust — the
|
|
684
|
-
// guardian's intent ("let it in") is unambiguous. Logged once, in
|
|
685
|
-
// `prepare` (this derivation runs again in `resolve`).
|
|
686
|
-
if (outcome === "verify_code" && signals.isBot === true) {
|
|
687
|
-
outcome = "trust";
|
|
688
|
-
}
|
|
692
|
+
const outcome = introductionOutcomeForAction(request, action);
|
|
689
693
|
|
|
690
694
|
return {
|
|
691
695
|
channel,
|
|
@@ -887,8 +891,8 @@ async function notifyRequesterOfDenial(params: {
|
|
|
887
891
|
* follow-through (requester/guardian notices, verification-code delivery
|
|
888
892
|
* from the decide's `mintedSession`, lifecycle signals).
|
|
889
893
|
*
|
|
890
|
-
* A
|
|
891
|
-
* coerced to direct trust.
|
|
894
|
+
* A requester who can never complete the handshake (a bot, an email
|
|
895
|
+
* sender) has handshake approvals coerced to direct trust.
|
|
892
896
|
*/
|
|
893
897
|
const accessRequestResolver: GuardianRequestResolver = {
|
|
894
898
|
kind: "access_request",
|
|
@@ -907,11 +911,12 @@ const accessRequestResolver: GuardianRequestResolver = {
|
|
|
907
911
|
if (outcome !== OUTCOME_BY_ACTION[decision.action]) {
|
|
908
912
|
log.info(
|
|
909
913
|
{
|
|
910
|
-
event: "
|
|
914
|
+
event: "resolver_access_request_trust_coercion",
|
|
911
915
|
requestId: request.id,
|
|
912
916
|
action: decision.action,
|
|
917
|
+
channel,
|
|
913
918
|
},
|
|
914
|
-
"Access request resolver: handshake approval
|
|
919
|
+
"Access request resolver: handshake approval coerced to direct trust (requester cannot complete a handshake)",
|
|
915
920
|
);
|
|
916
921
|
}
|
|
917
922
|
|
|
@@ -63,9 +63,6 @@ const TRAITS = { bodyShape: "blob", eyeStyle: "curious", color: "green" };
|
|
|
63
63
|
const GREEN_DISC = { r: 0xe6, g: 0xf1, b: 0xe7 };
|
|
64
64
|
/** #E9642F mixed 14% into white. */
|
|
65
65
|
const ORANGE_DISC = { r: 0xfc, g: 0xe9, b: 0xe2 };
|
|
66
|
-
/** The neutral disc every accent-less avatar wears. */
|
|
67
|
-
const FALLBACK_DISC = { r: 0xec, g: 0xef, b: 0xea };
|
|
68
|
-
|
|
69
66
|
/** On the disc and clear of the inset avatar square, which starts at y = 28.16. */
|
|
70
67
|
const DISC_SAMPLE = { x: 128, y: 8 };
|
|
71
68
|
/** Outside the inscribed disc, where the render leaves nothing at all. */
|
|
@@ -233,7 +230,7 @@ describe("renderNotificationAvatarPng", () => {
|
|
|
233
230
|
);
|
|
234
231
|
|
|
235
232
|
nativeTest(
|
|
236
|
-
"
|
|
233
|
+
"fills the circle with an uploaded image when it has no accent",
|
|
237
234
|
async () => {
|
|
238
235
|
await writeUpload("png", null);
|
|
239
236
|
|
|
@@ -245,7 +242,9 @@ describe("renderNotificationAvatarPng", () => {
|
|
|
245
242
|
expect(image.height).toBe(256);
|
|
246
243
|
expect(image.at(CORNER.x, CORNER.y).a).toBe(0);
|
|
247
244
|
expect(image.at(DISC_SAMPLE.x, DISC_SAMPLE.y)).toEqual({
|
|
248
|
-
|
|
245
|
+
r: 0x20,
|
|
246
|
+
g: 0x60,
|
|
247
|
+
b: 0xc0,
|
|
249
248
|
a: 255,
|
|
250
249
|
});
|
|
251
250
|
expect(image.at(128, 128)).toEqual({ r: 0x20, g: 0x60, b: 0xc0, a: 255 });
|
|
@@ -253,23 +252,34 @@ describe("renderNotificationAvatarPng", () => {
|
|
|
253
252
|
NATIVE_RENDER_TEST_TIMEOUT_MS,
|
|
254
253
|
);
|
|
255
254
|
|
|
256
|
-
|
|
257
|
-
"
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
255
|
+
for (const [shape, width, height] of [
|
|
256
|
+
["landscape", 256, 64],
|
|
257
|
+
["portrait", 64, 256],
|
|
258
|
+
] as const) {
|
|
259
|
+
nativeTest(
|
|
260
|
+
`cover-crops a ${shape} upload to the full disc`,
|
|
261
|
+
async () => {
|
|
262
|
+
await writeUpload("png", null, { width, height });
|
|
263
|
+
|
|
264
|
+
const image = await pixels((await renderNotificationAvatarPng())!);
|
|
265
|
+
for (const [x, y] of [
|
|
266
|
+
[128, 8],
|
|
267
|
+
[8, 128],
|
|
268
|
+
[128, 248],
|
|
269
|
+
[248, 128],
|
|
270
|
+
]) {
|
|
271
|
+
expect(image.at(x!, y!)).toEqual({
|
|
272
|
+
r: 0x20,
|
|
273
|
+
g: 0x60,
|
|
274
|
+
b: 0xc0,
|
|
275
|
+
a: 255,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
expect(image.at(30, 30).a).toBe(0);
|
|
279
|
+
},
|
|
280
|
+
NATIVE_RENDER_TEST_TIMEOUT_MS,
|
|
281
|
+
);
|
|
282
|
+
}
|
|
273
283
|
|
|
274
284
|
nativeTest(
|
|
275
285
|
"transcodes a WebP upload, which resvg cannot decode on its own",
|
|
@@ -281,20 +291,18 @@ describe("renderNotificationAvatarPng", () => {
|
|
|
281
291
|
|
|
282
292
|
const image = await pixels(png!);
|
|
283
293
|
expect(image.at(CORNER.x, CORNER.y).a).toBe(0);
|
|
284
|
-
expect(image.at(DISC_SAMPLE.x, DISC_SAMPLE.y)).toEqual({
|
|
285
|
-
...FALLBACK_DISC,
|
|
286
|
-
a: 255,
|
|
287
|
-
});
|
|
288
294
|
// WebP is lossy, so the transcode moves the flat fill by a channel step
|
|
289
295
|
// or two; what matters is that the avatar is drawn at all.
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
[
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
for (const point of [{ x: 128, y: 128 }, DISC_SAMPLE]) {
|
|
297
|
+
const pixel = image.at(point.x, point.y);
|
|
298
|
+
expect(pixel.a).toBe(255);
|
|
299
|
+
for (const [actual, expected] of [
|
|
300
|
+
[pixel.r, 0x20],
|
|
301
|
+
[pixel.g, 0x60],
|
|
302
|
+
[pixel.b, 0xc0],
|
|
303
|
+
]) {
|
|
304
|
+
expect(Math.abs(actual! - expected!)).toBeLessThanOrEqual(4);
|
|
305
|
+
}
|
|
298
306
|
}
|
|
299
307
|
},
|
|
300
308
|
NATIVE_RENDER_TEST_TIMEOUT_MS,
|
|
@@ -222,6 +222,7 @@ export async function renderNotificationAvatarPng(
|
|
|
222
222
|
const Resvg = getResvg();
|
|
223
223
|
const resvg = new Resvg(
|
|
224
224
|
notificationAvatarSvg({
|
|
225
|
+
kind: state.kind,
|
|
225
226
|
innerPngBase64: source.bytes.toString("base64"),
|
|
226
227
|
innerMediaType: source.mediaType,
|
|
227
228
|
accentHex: resolveNotificationAccentHex(state),
|
|
@@ -4355,6 +4355,24 @@ describe("call-controller", () => {
|
|
|
4355
4355
|
controller.destroy();
|
|
4356
4356
|
});
|
|
4357
4357
|
|
|
4358
|
+
test("a terminal verdict hands off without repeating the streamed bridge", async () => {
|
|
4359
|
+
const bridge = "Let me check that.";
|
|
4360
|
+
const { calls } = scriptLegs([
|
|
4361
|
+
[bridge, " [", "ESCALATE", "]"],
|
|
4362
|
+
["The answer is 42."],
|
|
4363
|
+
]);
|
|
4364
|
+
const { relay, controller } = setupController();
|
|
4365
|
+
|
|
4366
|
+
await controller.handleCallerUtterance("What is six times seven?");
|
|
4367
|
+
|
|
4368
|
+
expect(calls).toHaveLength(2);
|
|
4369
|
+
expect(calls[1].routingLeg).toBe("escalated");
|
|
4370
|
+
expect(calls[1].spokenEscalationBridge).toBe(bridge);
|
|
4371
|
+
expect(spokenText(relay)).toBe(`${bridge} The answer is 42.`);
|
|
4372
|
+
expect(relay.sentTokens.filter((t) => t.last)).toHaveLength(1);
|
|
4373
|
+
controller.destroy();
|
|
4374
|
+
});
|
|
4375
|
+
|
|
4358
4376
|
test("a bare escalate verdict speaks the canned bridge, audio-only", async () => {
|
|
4359
4377
|
const { calls } = scriptLegs([["[1]"], ["Forty-two."]]);
|
|
4360
4378
|
const { session, relay, controller } = setupController();
|
|
@@ -17,10 +17,13 @@ import {
|
|
|
17
17
|
describe("front-door verdict tokens", () => {
|
|
18
18
|
test("token constants are the expected bracketed forms", () => {
|
|
19
19
|
expect(HOLD_VERDICT_TOKEN).toBe("[0]");
|
|
20
|
-
expect(ESCALATE_VERDICT_TOKEN).toBe("[
|
|
20
|
+
expect(ESCALATE_VERDICT_TOKEN).toBe("[ESCALATE]");
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
test("stripInternalSpeechMarkers removes both tokens so they are never spoken", () => {
|
|
24
|
+
expect(stripInternalSpeechMarkers("[ESCALATE] Let me check.").trim()).toBe(
|
|
25
|
+
"Let me check.",
|
|
26
|
+
);
|
|
24
27
|
expect(
|
|
25
28
|
stripInternalSpeechMarkers("[1] Let me think about that.").trim(),
|
|
26
29
|
).toBe("Let me think about that.");
|
|
@@ -59,6 +62,7 @@ describe("isIncompleteControlMarkerTail", () => {
|
|
|
59
62
|
"[-",
|
|
60
63
|
"[-1",
|
|
61
64
|
"[END_CAL",
|
|
65
|
+
"[ESCALAT",
|
|
62
66
|
"[TASK:ST",
|
|
63
67
|
"[ASK_GUARDIAN_APPRO",
|
|
64
68
|
]) {
|
|
@@ -70,6 +74,7 @@ describe("isIncompleteControlMarkerTail", () => {
|
|
|
70
74
|
for (const tail of [
|
|
71
75
|
"[-1]",
|
|
72
76
|
"[END_CALL]",
|
|
77
|
+
"[ESCALATE]",
|
|
73
78
|
TASK_STOP_MARKER,
|
|
74
79
|
"[0] answer",
|
|
75
80
|
"[-1] look here",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
|
|
3
|
+
import { SCREEN_ACTION_VERDICT_TOKEN } from "../voice-control-protocol.js";
|
|
3
4
|
import {
|
|
4
5
|
createFrontDoorLegCoordinator,
|
|
5
6
|
type EscalatedLeg,
|
|
@@ -103,6 +104,33 @@ describe("escalatedLegFor", () => {
|
|
|
103
104
|
});
|
|
104
105
|
|
|
105
106
|
describe("createFrontDoorLegCoordinator", () => {
|
|
107
|
+
test.each(["leading", "terminal", "bare"])(
|
|
108
|
+
"a %s screen-action verdict survives split deltas and reaches the escalated leg",
|
|
109
|
+
(position) => {
|
|
110
|
+
const { coordinator, recorded } = harness();
|
|
111
|
+
const text =
|
|
112
|
+
position === "leading"
|
|
113
|
+
? `${SCREEN_ACTION_VERDICT_TOKEN} Let me circle that.`
|
|
114
|
+
: position === "terminal"
|
|
115
|
+
? `Let me circle that. ${SCREEN_ACTION_VERDICT_TOKEN}`
|
|
116
|
+
: SCREEN_ACTION_VERDICT_TOKEN;
|
|
117
|
+
for (const char of text) {
|
|
118
|
+
coordinator.push(char);
|
|
119
|
+
}
|
|
120
|
+
coordinator.complete();
|
|
121
|
+
expect(recorded.escalated).toHaveLength(1);
|
|
122
|
+
expect(recorded.escalated[0]?.screenAction).toBe(true);
|
|
123
|
+
expect(recorded.bridges[0]?.spokenBridge).not.toContain(
|
|
124
|
+
SCREEN_ACTION_VERDICT_TOKEN,
|
|
125
|
+
);
|
|
126
|
+
},
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
test("ordinary escalation keeps fresh memory retrieval", () => {
|
|
130
|
+
const { coordinator, recorded } = harness();
|
|
131
|
+
coordinator.push("[ESCALATE] Let me recall that.");
|
|
132
|
+
expect(recorded.escalated[0]?.screenAction).toBeUndefined();
|
|
133
|
+
});
|
|
106
134
|
test("an answer releases the held leading text, then streams", () => {
|
|
107
135
|
const { coordinator, recorded } = harness();
|
|
108
136
|
coordinator.push("[");
|
|
@@ -148,6 +176,48 @@ describe("createFrontDoorLegCoordinator", () => {
|
|
|
148
176
|
expect(recorded.escalated.length).toBe(1);
|
|
149
177
|
});
|
|
150
178
|
|
|
179
|
+
test("a terminal verdict hands off once with the already released speech", () => {
|
|
180
|
+
const { coordinator, recorded } = harness();
|
|
181
|
+
const bridge = "I will highlight the Rotate control on your screen.";
|
|
182
|
+
coordinator.push(bridge);
|
|
183
|
+
expect(recorded.answers).toEqual([bridge]);
|
|
184
|
+
coordinator.push(" [");
|
|
185
|
+
coordinator.push("ESCALATE]");
|
|
186
|
+
expect(coordinator.handedOff).toBe(false);
|
|
187
|
+
|
|
188
|
+
expect(coordinator.complete()).toBe(true);
|
|
189
|
+
expect(recorded.bridges).toEqual([
|
|
190
|
+
{ spokenBridge: bridge, usesFallback: false, alreadyReleased: true },
|
|
191
|
+
]);
|
|
192
|
+
expect(recorded.escalated).toEqual([escalatedLegFor(bridge)]);
|
|
193
|
+
expect(recorded.events).not.toContain("overrule");
|
|
194
|
+
coordinator.complete();
|
|
195
|
+
coordinator.push("late text");
|
|
196
|
+
expect(recorded.escalated).toHaveLength(1);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test("a cancelled answer with a terminal verdict never hands off", () => {
|
|
200
|
+
let live = true;
|
|
201
|
+
const { coordinator, recorded } = harness({ live: () => live });
|
|
202
|
+
coordinator.push("I will highlight it. [ESCALATE]");
|
|
203
|
+
live = false;
|
|
204
|
+
expect(coordinator.complete()).toBe(false);
|
|
205
|
+
expect(recorded.bridges).toEqual([]);
|
|
206
|
+
expect(recorded.escalated).toEqual([]);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
test.each(["Select option [1]", "The source is listed as [1]"])(
|
|
210
|
+
"a numbered reference does not start another leg: %s",
|
|
211
|
+
(answer) => {
|
|
212
|
+
const { coordinator, recorded } = harness();
|
|
213
|
+
coordinator.push(answer);
|
|
214
|
+
expect(coordinator.complete()).toBe(false);
|
|
215
|
+
expect(recorded.answers).toEqual([answer]);
|
|
216
|
+
expect(recorded.bridges).toEqual([]);
|
|
217
|
+
expect(recorded.escalated).toEqual([]);
|
|
218
|
+
},
|
|
219
|
+
);
|
|
220
|
+
|
|
151
221
|
test("a leg that stops mid-bridge hands off on completion with the canned bridge", () => {
|
|
152
222
|
const { coordinator, recorded } = harness({ language: "es" });
|
|
153
223
|
coordinator.push("[1]");
|
|
@@ -143,6 +143,10 @@ mock.module("../../persistence/conversation-crud.js", () => ({
|
|
|
143
143
|
recordConversationPersistedSeq: () => {},
|
|
144
144
|
}));
|
|
145
145
|
|
|
146
|
+
import {
|
|
147
|
+
clearHubClients,
|
|
148
|
+
registerHubClient,
|
|
149
|
+
} from "../../__tests__/helpers/hub-clients.js";
|
|
146
150
|
import { setConfig } from "../../__tests__/helpers/set-config.js";
|
|
147
151
|
import type { PreparedModelCall } from "../../agent/loop.js";
|
|
148
152
|
import { selectWinningProfile } from "../../config/llm-resolver.js";
|
|
@@ -2326,21 +2330,30 @@ describe("front-door leg tool suppression", () => {
|
|
|
2326
2330
|
});
|
|
2327
2331
|
|
|
2328
2332
|
describe("desktop skill preactivation", () => {
|
|
2333
|
+
afterEach(() => clearHubClients(assistantEventHub));
|
|
2334
|
+
|
|
2329
2335
|
async function preactivatedFor(turn: Record<string, unknown>): Promise<{
|
|
2330
2336
|
skillIds: string[];
|
|
2331
2337
|
proxyInterfaces: unknown[];
|
|
2332
2338
|
skillIdsDuringLoop: string[];
|
|
2339
|
+
promptDuringLoop: string | null;
|
|
2333
2340
|
}> {
|
|
2334
2341
|
const skillIds: string[] = [];
|
|
2335
2342
|
const proxyInterfaces: unknown[] = [];
|
|
2336
2343
|
let skillIdsDuringLoop: string[] = [];
|
|
2344
|
+
let prompt: string | null = null;
|
|
2345
|
+
let promptDuringLoop: string | null = null;
|
|
2337
2346
|
const fake = makeFakeConversation({
|
|
2338
2347
|
processing: false,
|
|
2339
2348
|
runAgentLoop: async () => {
|
|
2340
2349
|
skillIdsDuringLoop = [...skillIds];
|
|
2350
|
+
promptDuringLoop = prompt;
|
|
2341
2351
|
},
|
|
2342
2352
|
});
|
|
2343
2353
|
Object.assign(fake.conversation, {
|
|
2354
|
+
setVoiceCallControlPrompt: (value: string | null) => {
|
|
2355
|
+
prompt = value;
|
|
2356
|
+
},
|
|
2344
2357
|
addPreactivatedSkillId: (id: string) => {
|
|
2345
2358
|
skillIds.push(id);
|
|
2346
2359
|
},
|
|
@@ -2356,9 +2369,60 @@ describe("desktop skill preactivation", () => {
|
|
|
2356
2369
|
...turn,
|
|
2357
2370
|
});
|
|
2358
2371
|
await flushMicrotasks();
|
|
2359
|
-
return { skillIds, proxyInterfaces, skillIdsDuringLoop };
|
|
2372
|
+
return { skillIds, proxyInterfaces, skillIdsDuringLoop, promptDuringLoop };
|
|
2360
2373
|
}
|
|
2361
2374
|
|
|
2375
|
+
test("a shared-screen turn receives the annotation instructions and schemas before inference", async () => {
|
|
2376
|
+
registerHubClient({
|
|
2377
|
+
hub: assistantEventHub,
|
|
2378
|
+
clientId: "annotation-client",
|
|
2379
|
+
interfaceId: "macos",
|
|
2380
|
+
actorPrincipalId: "user-123",
|
|
2381
|
+
capabilities: ["host_cu", "host_cu_annotate"],
|
|
2382
|
+
});
|
|
2383
|
+
const result = await preactivatedFor({
|
|
2384
|
+
routingLeg: "escalated",
|
|
2385
|
+
macosDesktopSession: true,
|
|
2386
|
+
screenSharing: true,
|
|
2387
|
+
actorPrincipalId: "user-123",
|
|
2388
|
+
});
|
|
2389
|
+
expect(result.skillIdsDuringLoop).toContain("screen-annotation");
|
|
2390
|
+
expect(result.promptDuringLoop).toContain("ID: screen-annotation");
|
|
2391
|
+
expect(result.promptDuringLoop).toContain(
|
|
2392
|
+
"Use the picture when names cannot identify the control.",
|
|
2393
|
+
);
|
|
2394
|
+
expect(result.promptDuringLoop).toContain("screen_point_at");
|
|
2395
|
+
expect(result.promptDuringLoop).toContain("screen_clear_marks");
|
|
2396
|
+
expect(result.promptDuringLoop).toContain('"target"');
|
|
2397
|
+
expect(result.promptDuringLoop).toContain("skill_execute");
|
|
2398
|
+
});
|
|
2399
|
+
|
|
2400
|
+
test.each([
|
|
2401
|
+
{ screenSharing: false },
|
|
2402
|
+
{ actorPrincipalId: "other-user" },
|
|
2403
|
+
{ routingLeg: "front-door" },
|
|
2404
|
+
{ macosDesktopSession: false },
|
|
2405
|
+
])(
|
|
2406
|
+
"does not preload annotation for an ineligible turn: %j",
|
|
2407
|
+
async (override) => {
|
|
2408
|
+
registerHubClient({
|
|
2409
|
+
hub: assistantEventHub,
|
|
2410
|
+
clientId: "annotation-client",
|
|
2411
|
+
interfaceId: "macos",
|
|
2412
|
+
actorPrincipalId: "user-123",
|
|
2413
|
+
capabilities: ["host_cu", "host_cu_annotate"],
|
|
2414
|
+
});
|
|
2415
|
+
const result = await preactivatedFor({
|
|
2416
|
+
routingLeg: "escalated",
|
|
2417
|
+
macosDesktopSession: true,
|
|
2418
|
+
screenSharing: true,
|
|
2419
|
+
actorPrincipalId: "user-123",
|
|
2420
|
+
...override,
|
|
2421
|
+
});
|
|
2422
|
+
expect(result.promptDuringLoop).not.toContain("ID: screen-annotation");
|
|
2423
|
+
},
|
|
2424
|
+
);
|
|
2425
|
+
|
|
2362
2426
|
test("an escalated leg of a macOS desktop session starts with computer use active", async () => {
|
|
2363
2427
|
const result = await preactivatedFor({
|
|
2364
2428
|
routingLeg: "escalated",
|
|
@@ -2423,6 +2487,18 @@ describe("cutFrontDoorContentAtVerdict", () => {
|
|
|
2423
2487
|
expect(cut?.spokenText).toBe("");
|
|
2424
2488
|
});
|
|
2425
2489
|
|
|
2490
|
+
test("a terminal verdict split across blocks preserves all released speech", () => {
|
|
2491
|
+
const bridge = "Let me check. I will highlight the Rotate control.";
|
|
2492
|
+
const cut = cutFrontDoorContentAtVerdict([
|
|
2493
|
+
{ type: "text", text: `${bridge} [` },
|
|
2494
|
+
{ type: "text", text: "ESCALATE] " },
|
|
2495
|
+
]);
|
|
2496
|
+
expect(cut).toEqual({
|
|
2497
|
+
blocks: [{ type: "text", text: bridge }],
|
|
2498
|
+
spokenText: bridge,
|
|
2499
|
+
});
|
|
2500
|
+
});
|
|
2501
|
+
|
|
2426
2502
|
test("stray verdict tokens inside an answer are stripped, not treated as escalation", () => {
|
|
2427
2503
|
const cut = cutFrontDoorContentAtVerdict([
|
|
2428
2504
|
{ type: "text", text: "It is Tuesday [0] indeed." },
|
|
@@ -2449,7 +2525,7 @@ describe("front-door hub stream gate", () => {
|
|
|
2449
2525
|
* `deltas` in order, then ends the leg with `finalEvent`.
|
|
2450
2526
|
*/
|
|
2451
2527
|
function makeStreamingConversation(
|
|
2452
|
-
deltas: string[],
|
|
2528
|
+
deltas: readonly string[],
|
|
2453
2529
|
finalEvent:
|
|
2454
2530
|
| "message_complete"
|
|
2455
2531
|
| "generation_cancelled" = "message_complete",
|
|
@@ -2533,6 +2609,22 @@ describe("front-door hub stream gate", () => {
|
|
|
2533
2609
|
expect(texts.join("")).toBe("It is Tuesday, and it is sunny.");
|
|
2534
2610
|
});
|
|
2535
2611
|
|
|
2612
|
+
test("a terminal escalation never broadcasts marker fragments", async () => {
|
|
2613
|
+
makeStreamingConversation([
|
|
2614
|
+
"I will highlight it.",
|
|
2615
|
+
" [",
|
|
2616
|
+
"ESC",
|
|
2617
|
+
"ALATE",
|
|
2618
|
+
"]",
|
|
2619
|
+
]);
|
|
2620
|
+
|
|
2621
|
+
const texts = await collectBroadcastText(() =>
|
|
2622
|
+
startVoiceTurn({ ...makeTurnOptions(), routingLeg: "front-door" }),
|
|
2623
|
+
);
|
|
2624
|
+
|
|
2625
|
+
expect(texts).toEqual(["I will highlight it.", " "]);
|
|
2626
|
+
});
|
|
2627
|
+
|
|
2536
2628
|
test("an answer waits on the escalation judge before reaching the hub", async () => {
|
|
2537
2629
|
let openGate!: () => void;
|
|
2538
2630
|
judgeEscalationGate = new Promise<void>((resolve) => {
|
|
@@ -2556,9 +2648,12 @@ describe("front-door hub stream gate", () => {
|
|
|
2556
2648
|
}
|
|
2557
2649
|
});
|
|
2558
2650
|
|
|
2559
|
-
test(
|
|
2651
|
+
test.each([
|
|
2652
|
+
{ deltas: ["Yeah okay, ", "I'll do it."] },
|
|
2653
|
+
{ deltas: ["[ASK_GUARDIAN:"] },
|
|
2654
|
+
])("an overruled answer never reaches the hub: %j", async ({ deltas }) => {
|
|
2560
2655
|
judgeEscalationVerdict = true;
|
|
2561
|
-
makeStreamingConversation(
|
|
2656
|
+
makeStreamingConversation(deltas);
|
|
2562
2657
|
|
|
2563
2658
|
const texts = await collectBroadcastText(async () => {
|
|
2564
2659
|
const handle = await startVoiceTurn({
|
|
@@ -3063,6 +3158,23 @@ describe("startVoiceTurn with images in history", () => {
|
|
|
3063
3158
|
});
|
|
3064
3159
|
|
|
3065
3160
|
describe("startVoiceTurn escalated-leg profile pin", () => {
|
|
3161
|
+
test.each([
|
|
3162
|
+
{ screenAction: true, screenSharing: true, expected: true },
|
|
3163
|
+
{ screenAction: false, screenSharing: true, expected: false },
|
|
3164
|
+
{ screenAction: true, screenSharing: false, expected: false },
|
|
3165
|
+
{
|
|
3166
|
+
screenAction: true,
|
|
3167
|
+
screenSharing: true,
|
|
3168
|
+
routingLeg: "front-door",
|
|
3169
|
+
expected: false,
|
|
3170
|
+
},
|
|
3171
|
+
])(
|
|
3172
|
+
"skips fresh memory only for an escalated shared-screen action: %j",
|
|
3173
|
+
async ({ expected, ...turn }) => {
|
|
3174
|
+
const options = await runOptionsFor({ turn });
|
|
3175
|
+
expect(options.skipMemoryRetrieval).toBe(expected);
|
|
3176
|
+
},
|
|
3177
|
+
);
|
|
3066
3178
|
beforeEach(() => {
|
|
3067
3179
|
unresolvableProviderNames.clear();
|
|
3068
3180
|
});
|