@vellumai/assistant 0.11.9 → 0.11.10-dev.202609091114.7b6342c
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/ARCHITECTURE.md +2 -2
- package/Dockerfile +6 -12
- package/docs/architecture/memory.md +17 -9
- package/docs/guardian-request-flow.md +7 -4
- package/docs/runbook-trusted-contacts.md +13 -2
- package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/package.json +3 -1
- package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/__tests__/plan-credit.test.ts +51 -0
- package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/__tests__/secret-detection.test.ts +2 -0
- package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/desktop-presence.ts +11 -0
- package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/index.ts +1 -0
- package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/plan-credit.ts +66 -0
- package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/secret-detection.ts +7 -0
- package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/package.json +3 -1
- package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/__tests__/plan-credit.test.ts +51 -0
- package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/__tests__/secret-detection.test.ts +2 -0
- package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/desktop-presence.ts +11 -0
- package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/index.ts +1 -0
- package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/plan-credit.ts +66 -0
- package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/secret-detection.ts +7 -0
- package/node_modules/@vellumai/gateway-client/src/gateway-ipc-contracts.ts +72 -0
- package/node_modules/@vellumai/service-contracts/package.json +3 -1
- package/node_modules/@vellumai/service-contracts/src/__tests__/plan-credit.test.ts +51 -0
- package/node_modules/@vellumai/service-contracts/src/__tests__/secret-detection.test.ts +2 -0
- package/node_modules/@vellumai/service-contracts/src/desktop-presence.ts +11 -0
- package/node_modules/@vellumai/service-contracts/src/index.ts +1 -0
- package/node_modules/@vellumai/service-contracts/src/plan-credit.ts +66 -0
- package/node_modules/@vellumai/service-contracts/src/secret-detection.ts +7 -0
- package/openapi.yaml +729 -63
- package/package.json +1 -1
- package/src/__tests__/agent-loop-mutable-latest-user-message.test.ts +19 -21
- package/src/__tests__/assistant-event-hub-machine-name.test.ts +40 -0
- package/src/__tests__/assistant-event-hub.test.ts +45 -0
- package/src/__tests__/cli-memory-v2-reembed-skills.test.ts +0 -1
- package/src/__tests__/compactor-assistant-tail-preview.test.ts +111 -0
- package/src/__tests__/compactor-tail-resolution.test.ts +116 -0
- package/src/__tests__/computer-use-native-history.test.ts +30 -0
- package/src/__tests__/computer-use-window-schema.test.ts +24 -0
- package/src/__tests__/config-get-vision-flag.test.ts +36 -0
- package/src/__tests__/config-loader-validation-reset-notice.test.ts +47 -15
- package/src/__tests__/context-search-conversations-source.test.ts +27 -5
- package/src/__tests__/conversation-agent-loop-overflow.test.ts +189 -195
- package/src/__tests__/conversation-agent-loop.test.ts +690 -50
- package/src/__tests__/conversation-fork-crud.test.ts +132 -45
- package/src/__tests__/conversation-fork-retrospective.test.ts +9 -7
- package/src/__tests__/conversation-lifecycle.test.ts +684 -10
- package/src/__tests__/conversation-pairing.test.ts +10 -9
- package/src/__tests__/conversation-runtime-assembly.test.ts +288 -1
- package/src/__tests__/conversation-surfaces-history-restored-completion.test.ts +21 -4
- package/src/__tests__/conversation-surfaces-point-at-budget.test.ts +150 -0
- package/src/__tests__/conversation-surfaces-point-at-capability.test.ts +161 -0
- package/src/__tests__/copy-composer-tc-templates.test.ts +2 -2
- package/src/__tests__/credential-security-invariants.test.ts +1 -0
- package/src/__tests__/delivered-post-record.test.ts +107 -0
- package/src/__tests__/guardian-action-service-scope.test.ts +53 -0
- package/src/__tests__/guardian-question-mode.test.ts +88 -138
- package/src/__tests__/headless-browser-mode.test.ts +63 -13
- package/src/__tests__/heartbeat-disk-pressure.test.ts +2 -0
- package/src/__tests__/heartbeat-service.test.ts +118 -27
- package/src/__tests__/host-cu-proxy.test.ts +159 -1
- package/src/__tests__/host-proxy-interface.test.ts +15 -0
- package/src/__tests__/host-proxy-preactivation.test.ts +61 -0
- package/src/__tests__/injector-chain.test.ts +3 -3
- package/src/__tests__/injector-registry-order-guard.test.ts +1 -1
- package/src/__tests__/injector-v3-suppression.test.ts +587 -45
- package/src/__tests__/llm-schema.test.ts +70 -2
- package/src/__tests__/logger.test.ts +33 -32
- package/src/__tests__/mcp-config-secret-boundary.test.ts +2 -0
- package/src/__tests__/memory-config-file-parity.test.ts +18 -0
- package/src/__tests__/memory-retrieval-hook.test.ts +53 -3
- package/src/__tests__/messages-read-boundary-guard.test.ts +0 -1
- package/src/__tests__/messaging-send-tool.test.ts +251 -128
- package/src/__tests__/messaging-shared.test.ts +19 -0
- package/src/__tests__/notification-decision-fallback.test.ts +98 -76
- package/src/__tests__/notification-decision-strategy.test.ts +10 -38
- package/src/__tests__/notification-events-source-context-probe.test.ts +211 -0
- package/src/__tests__/openai-responses-prompt-cache.test.ts +7 -2
- package/src/__tests__/openai-responses-provider.test.ts +42 -0
- package/src/__tests__/outlook-messaging-provider.test.ts +9 -0
- package/src/__tests__/platform-callback-registration.test.ts +162 -3
- package/src/__tests__/plugin-api-webhook-url.test.ts +66 -4
- package/src/__tests__/plugin-import-boundary-guard.test.ts +1 -0
- package/src/__tests__/pricing.test.ts +29 -0
- package/src/__tests__/prompt-cache-cross-turn-stability.test.ts +63 -3
- package/src/__tests__/scheduler-result-notification.test.ts +209 -0
- package/src/__tests__/strip-memory-injections.test.ts +75 -27
- package/src/__tests__/tool-approval-seed-content-blocks.test.ts +4 -13
- package/src/acp/auto-install.test.ts +35 -1
- package/src/acp/resolve-agent.test.ts +3 -3
- package/src/agent/loop.ts +116 -45
- package/src/api/constants/personality-sliders.test.ts +21 -0
- package/src/api/constants/personality-sliders.ts +64 -0
- package/src/api/events/contact-record-request.ts +16 -4
- package/src/api/events/contact-request.ts +10 -1
- package/src/api/index.ts +12 -0
- package/src/api/responses/memory-v3-selection-log.ts +64 -13
- package/src/api/surfaces.ts +6 -5
- package/src/background-wake/next-wake.test.ts +13 -0
- package/src/background-wake/next-wake.ts +4 -2
- package/src/calls/__tests__/voice-session-bridge.test.ts +166 -0
- package/src/calls/__tests__/voice-turn-sight-hold.test.ts +301 -0
- package/src/calls/voice-session-bridge.ts +162 -1
- package/src/calls/voice-triage-escalate.ts +1 -1
- package/src/channels/types.ts +14 -0
- package/src/cli/__tests__/catalog-search-help.test.ts +1 -0
- package/src/cli/__tests__/contacts-address-prompt-cli.test.ts +701 -0
- package/src/cli/__tests__/contacts-record-prompt-cli.test.ts +276 -15
- package/src/cli/__tests__/roadmap-cli.test.ts +313 -0
- package/src/cli/__tests__/run-assistant-command.ts +59 -20
- package/src/cli/commands/__tests__/conversations-slack.test.ts +12 -0
- package/src/cli/commands/__tests__/plugins-search.test.ts +81 -0
- package/src/cli/commands/config.help.ts +3 -1
- package/src/cli/commands/contacts.help.ts +179 -12
- package/src/cli/commands/contacts.ts +442 -47
- package/src/cli/commands/memory/worker.ts +1 -1
- package/src/cli/commands/platform/__tests__/credits-format.test.ts +152 -0
- package/src/cli/commands/platform/__tests__/credits.test.ts +20 -0
- package/src/cli/commands/platform/credits-format.ts +108 -0
- package/src/cli/commands/platform/index.help.ts +33 -11
- package/src/cli/commands/platform/index.ts +7 -18
- package/src/cli/commands/plugins.help.ts +4 -1
- package/src/cli/commands/plugins.ts +2 -1
- package/src/cli/commands/roadmap.help.ts +171 -0
- package/src/cli/commands/roadmap.ts +358 -0
- package/src/cli/index.help.ts +2 -0
- package/src/cli/lib/__tests__/cli-output.test.ts +5 -0
- package/src/cli/lib/cli-output.ts +6 -6
- package/src/cli/program.ts +2 -0
- package/src/config/__tests__/webhook-routing.test.ts +42 -0
- package/src/config/acp-defaults.test.ts +3 -3
- package/src/config/acp-defaults.ts +5 -5
- package/src/config/bundled-skills/acp/SKILL.md +8 -11
- package/src/config/bundled-skills/computer-use/SKILL.md +21 -0
- package/src/config/bundled-skills/computer-use/TOOLS.json +6 -0
- package/src/config/bundled-skills/contacts/SKILL.md +61 -11
- package/src/config/bundled-skills/messaging/SKILL.md +2 -0
- package/src/config/bundled-skills/messaging/TOOLS.json +4 -4
- package/src/config/bundled-skills/messaging/tools/messaging-send.ts +160 -36
- package/src/config/bundled-skills/messaging/tools/shared.ts +6 -0
- package/src/config/bundled-skills/schedule/SKILL.md +10 -2
- package/src/config/bundled-skills/screen-annotation/SKILL.md +80 -0
- package/src/config/bundled-skills/screen-annotation/TOOLS.json +73 -0
- package/src/config/bundled-skills/screen-annotation/tools/screen-annotation.test.ts +74 -0
- package/src/config/bundled-skills/screen-annotation/tools/screen-clear-marks.ts +33 -0
- package/src/config/bundled-skills/screen-annotation/tools/screen-point-at.ts +25 -0
- package/src/config/env-registry.ts +2 -0
- package/src/config/feature-flag-registry.json +39 -7
- package/src/config/input-modalities.test.ts +71 -0
- package/src/config/input-modalities.ts +95 -0
- package/src/config/loader.ts +2 -0
- package/src/config/schemas/__tests__/memory-v3.test.ts +58 -15
- package/src/config/schemas/heartbeat.ts +3 -3
- package/src/config/schemas/llm.ts +47 -10
- package/src/config/schemas/memory-storage.test.ts +39 -0
- package/src/config/schemas/memory-storage.ts +21 -0
- package/src/config/schemas/memory-v3.ts +73 -46
- package/src/config/schemas/services.ts +18 -0
- package/src/config/webhook-routing.ts +12 -2
- package/src/context/compactor.ts +12 -13
- package/src/context/strip-injections.ts +29 -25
- package/src/context/token-estimator.ts +2 -2
- package/src/daemon/__tests__/embedding-reconcile.test.ts +77 -0
- package/src/daemon/__tests__/lifecycle-embedding-reconcile.test.ts +3 -0
- package/src/daemon/__tests__/turn-actor.test.ts +68 -0
- package/src/daemon/conversation-agent-loop-handlers.ts +152 -22
- package/src/daemon/conversation-agent-loop.ts +19 -3
- package/src/daemon/conversation-messaging.ts +3 -2
- package/src/daemon/conversation-runtime-assembly.ts +191 -69
- package/src/daemon/conversation-surfaces.ts +32 -62
- package/src/daemon/conversation.ts +153 -46
- package/src/daemon/embedding-reconcile.ts +64 -1
- package/src/daemon/handlers/config-embeddings.ts +31 -0
- package/src/daemon/host-cu-proxy.ts +66 -50
- package/src/daemon/host-cu-target.ts +139 -0
- package/src/daemon/host-proxy-preactivation.ts +29 -1
- package/src/daemon/mcp-reload-service.ts +6 -0
- package/src/daemon/providers-setup.ts +5 -26
- package/src/daemon/trust-context.ts +1 -1
- package/src/daemon/turn-actor.ts +46 -0
- package/src/heartbeat/heartbeat-service.ts +72 -13
- package/src/inbound/platform-callback-registration.ts +77 -11
- package/src/inbound/pod-webhook-claim.ts +35 -0
- package/src/inbound/velay-webhooks-gate.ts +20 -0
- package/src/ipc/gateway-client.ts +91 -0
- package/src/live-voice/__tests__/live-voice-photo.test.ts +174 -0
- package/src/live-voice/__tests__/live-voice-session-guardian.test.ts +127 -0
- package/src/live-voice/__tests__/live-voice-session-telemetry.test.ts +42 -2
- package/src/live-voice/__tests__/live-voice-sight-frame.test.ts +81 -0
- package/src/live-voice/__tests__/protocol.test.ts +67 -0
- package/src/live-voice/live-voice-connection.ts +14 -1
- package/src/live-voice/live-voice-photo.ts +109 -4
- package/src/live-voice/live-voice-session-manager.ts +10 -1
- package/src/live-voice/live-voice-session.ts +196 -31
- package/src/live-voice/protocol.ts +134 -1
- package/src/mcp/__tests__/reload-signal-emission.test.ts +54 -0
- package/src/mcp/__tests__/reload-signal.test.ts +57 -0
- package/src/mcp/__tests__/startup.test.ts +150 -0
- package/src/mcp/reload-signal.ts +50 -0
- package/src/mcp/startup.ts +101 -0
- package/src/messaging/providers/outlook/adapter.ts +2 -13
- package/src/messaging/providers/outlook/client.ts +13 -1
- package/src/messaging/providers/outlook/types.ts +3 -0
- package/src/messaging/providers/telegram-bot/adapter.ts +9 -2
- package/src/messaging/providers/telegram-bot/client.ts +8 -2
- package/src/messaging/providers/whatsapp/adapter.ts +9 -2
- package/src/messaging/providers/whatsapp/client.ts +8 -2
- package/src/notifications/AGENTS.md +5 -0
- package/src/notifications/README.md +21 -7
- package/src/notifications/__tests__/assistant-reply-producer.test.ts +3 -10
- package/src/notifications/__tests__/background-failure-signal.test.ts +96 -0
- package/src/notifications/__tests__/broadcaster.test.ts +171 -7
- package/src/notifications/__tests__/decision-engine.test.ts +79 -6
- package/src/notifications/__tests__/edit-notification.test.ts +59 -0
- package/src/notifications/__tests__/resolve-visible-in-source.test.ts +96 -0
- package/src/notifications/__tests__/schedule-result-producer.test.ts +397 -0
- package/src/notifications/access-request-copy.ts +5 -5
- package/src/notifications/approval-card-data.ts +29 -13
- package/src/notifications/assistant-reply-producer.ts +0 -4
- package/src/notifications/background-failure-signal.ts +13 -1
- package/src/notifications/broadcaster.ts +65 -2
- package/src/notifications/conversation-pairing.ts +263 -155
- package/src/notifications/copy-composer.ts +38 -22
- package/src/notifications/decision-engine.ts +89 -61
- package/src/notifications/delivered-post-record.ts +81 -0
- package/src/notifications/deliveries-store.ts +8 -1
- package/src/notifications/edit-notification.ts +16 -0
- package/src/notifications/events-store.ts +68 -2
- package/src/notifications/guardian-question-mode.ts +24 -232
- package/src/notifications/home-feed-side-effect.ts +1 -0
- package/src/notifications/notification-utils.ts +13 -5
- package/src/notifications/resolve-visible-in-source.ts +56 -0
- package/src/notifications/schedule-result-producer.ts +275 -0
- package/src/notifications/signal.ts +5 -0
- package/src/oauth/__tests__/seed-providers-managed.test.ts +82 -0
- package/src/oauth/seed-providers.ts +201 -3
- package/src/onboarding/onboarding-events-store.ts +14 -8
- package/src/persistence/conversation-crud.ts +68 -19
- package/src/persistence/embeddings/embedding-backend.test.ts +162 -0
- package/src/persistence/embeddings/embedding-backend.ts +148 -11
- package/src/persistence/embeddings/embedding-gemini.test.ts +328 -9
- package/src/persistence/embeddings/embedding-gemini.ts +211 -27
- package/src/persistence/embeddings/embedding-openai.test.ts +113 -0
- package/src/persistence/embeddings/embedding-openai.ts +55 -4
- package/src/persistence/embeddings/embedding-types.test.ts +24 -0
- package/src/persistence/embeddings/embedding-types.ts +25 -1
- package/src/persistence/job-utils.ts +6 -2
- package/src/persistence/message-metadata.ts +20 -0
- package/src/persistence/migrations/283-memory-v3-selections-message-id-and-sections.ts +2 -1
- package/src/persistence/migrations/376-notification-deliveries-canonical-message-id.ts +37 -0
- package/src/persistence/schema/memory-injection.ts +31 -9
- package/src/persistence/schema/notifications.ts +8 -0
- package/src/persistence/steps.ts +2 -0
- package/src/plugin-api/index.ts +2 -1
- package/src/plugin-api/vision-support.test.ts +81 -0
- package/src/plugin-api/vision-support.ts +57 -10
- package/src/plugin-api/webhook-url.ts +18 -4
- package/src/plugins/AGENTS.md +1 -1
- package/src/plugins/defaults/channel/injectors.ts +3 -1
- package/src/plugins/defaults/injector-order.ts +2 -2
- package/src/plugins/defaults/memory/AGENTS.md +263 -30
- package/src/plugins/defaults/memory/__tests__/conversation-memory-orphan-sweep.test.ts +4 -0
- package/src/plugins/defaults/memory/__tests__/conversation-memory-purge.test.ts +6 -0
- package/src/plugins/defaults/memory/__tests__/db-memory-attach.test.ts +9 -3
- package/src/plugins/defaults/memory/__tests__/memory-log-stores-degraded.test.ts +3 -7
- package/src/plugins/defaults/memory/__tests__/relocated-memory-test-rows.ts +18 -0
- package/src/plugins/defaults/memory/context-search/sources/conversations.ts +16 -2
- package/src/plugins/defaults/memory/conversation-memory-purge.ts +2 -0
- package/src/plugins/defaults/memory/fork-conversation-memory.ts +13 -13
- package/src/plugins/defaults/memory/graph/__tests__/conversation-graph-memory-v2-routing.test.ts +19 -12
- package/src/plugins/defaults/memory/graph/conversation-graph-memory.ts +17 -15
- package/src/plugins/defaults/memory/graph-topology/build-memory-graph.ts +1 -1
- package/src/plugins/defaults/memory/hooks/__tests__/post-compact.test.ts +121 -0
- package/src/plugins/defaults/memory/hooks/init.ts +10 -0
- package/src/plugins/defaults/memory/hooks/injection-metadata.ts +100 -0
- package/src/plugins/defaults/memory/hooks/post-compact.ts +19 -7
- package/src/plugins/defaults/memory/hooks/user-prompt-submit.ts +11 -83
- package/src/plugins/defaults/memory/injectors.ts +4 -4
- package/src/plugins/defaults/memory/job-handlers.ts +4 -1
- package/src/plugins/defaults/memory/jobs/__tests__/embed-concept-page.test.ts +1 -0
- package/src/plugins/defaults/memory/jobs/embed-concept-page.ts +11 -3
- package/src/plugins/defaults/memory/memory-db.ts +4 -0
- package/src/plugins/defaults/memory/memory-marker.ts +28 -17
- package/src/plugins/defaults/memory/src/__tests__/memory-v2-simulate-route.test.ts +0 -1
- package/src/plugins/defaults/memory/src/__tests__/memory-worker-routes.test.ts +20 -0
- package/src/plugins/defaults/memory/src/memory-item-routes.test.ts +0 -1
- package/src/plugins/defaults/memory/src/memory-worker-routes.ts +3 -1
- package/src/plugins/defaults/memory/substrate/__tests__/cli-command-store.test.ts +1 -1
- package/src/plugins/defaults/memory/substrate/__tests__/consolidation-job.test.ts +66 -0
- package/src/plugins/defaults/memory/substrate/__tests__/injected-block-slugs.test.ts +345 -0
- package/src/plugins/defaults/memory/substrate/__tests__/page-index.test.ts +0 -1
- package/src/plugins/defaults/memory/substrate/__tests__/prompts-consolidation.test.ts +170 -1
- package/src/plugins/defaults/memory/substrate/__tests__/reembed-job.test.ts +1 -0
- package/src/plugins/defaults/memory/substrate/capability-slugs.ts +53 -0
- package/src/plugins/defaults/memory/substrate/cli-command-store.ts +4 -18
- package/src/plugins/defaults/memory/substrate/consolidation-job.ts +40 -1
- package/src/plugins/defaults/memory/substrate/ingest.ts +11 -9
- package/src/plugins/defaults/memory/substrate/injected-block-slugs.ts +426 -42
- package/src/plugins/defaults/memory/substrate/page-index.ts +5 -4
- package/src/plugins/defaults/memory/substrate/prompts/consolidation.ts +127 -14
- package/src/plugins/defaults/memory/substrate/skill-store.ts +1 -18
- package/src/plugins/defaults/memory/v2/__tests__/backfill-jobs.test.ts +1 -0
- package/src/plugins/defaults/memory/v2/__tests__/injection.test.ts +2 -8
- package/src/plugins/defaults/memory/v2/__tests__/router.test.ts +0 -1
- package/src/plugins/defaults/memory/v2/injection.ts +4 -4
- package/src/plugins/defaults/memory/v3/__tests__/capabilities.test.ts +16 -0
- package/src/plugins/defaults/memory/v3/__tests__/carry-integration.test.ts +1004 -319
- package/src/plugins/defaults/memory/v3/__tests__/dense.test.ts +227 -4
- package/src/plugins/defaults/memory/v3/__tests__/injection.test.ts +836 -263
- package/src/plugins/defaults/memory/v3/__tests__/live-integration.test.ts +65 -38
- package/src/plugins/defaults/memory/v3/__tests__/maintain-job.test.ts +354 -3
- package/src/plugins/defaults/memory/v3/__tests__/orchestrate.test.ts +688 -104
- package/src/plugins/defaults/memory/v3/__tests__/overlong-sections.test.ts +109 -0
- package/src/plugins/defaults/memory/v3/__tests__/page-content.test.ts +144 -0
- package/src/plugins/defaults/memory/v3/__tests__/plugin-schema.test.ts +534 -0
- package/src/plugins/defaults/memory/v3/__tests__/pool-log-store.test.ts +449 -0
- package/src/plugins/defaults/memory/v3/__tests__/pool-select.test.ts +265 -27
- package/src/plugins/defaults/memory/v3/__tests__/render-injection.test.ts +34 -117
- package/src/plugins/defaults/memory/v3/__tests__/section-dense-store.test.ts +491 -4
- package/src/plugins/defaults/memory/v3/__tests__/section-needle.test.ts +124 -1
- package/src/plugins/defaults/memory/v3/__tests__/sections.test.ts +264 -4
- package/src/plugins/defaults/memory/v3/__tests__/selection-log-store.test.ts +560 -22
- package/src/plugins/defaults/memory/v3/__tests__/shadow-integration.test.ts +40 -33
- package/src/plugins/defaults/memory/v3/__tests__/shadow-plugin.test.ts +718 -63
- package/src/plugins/defaults/memory/v3/__tests__/types.test.ts +83 -2
- package/src/plugins/defaults/memory/v3/candidate-match.ts +1 -1
- package/src/plugins/defaults/memory/v3/capabilities.ts +90 -14
- package/src/plugins/defaults/memory/v3/card.test.ts +15 -16
- package/src/plugins/defaults/memory/v3/card.ts +16 -15
- package/src/plugins/defaults/memory/v3/dense.ts +10 -0
- package/src/plugins/defaults/memory/v3/ever-injected-store.test.ts +643 -140
- package/src/plugins/defaults/memory/v3/ever-injected-store.ts +462 -212
- package/src/plugins/defaults/memory/v3/hot-set.test.ts +2 -2
- package/src/plugins/defaults/memory/v3/injector.ts +366 -278
- package/src/plugins/defaults/memory/v3/learned-edges.test.ts +2 -2
- package/src/plugins/defaults/memory/v3/maintain-job.ts +299 -73
- package/src/plugins/defaults/memory/v3/orchestrate.ts +327 -214
- package/src/plugins/defaults/memory/v3/overlong-sections.ts +83 -0
- package/src/plugins/defaults/memory/v3/page-content.ts +72 -92
- package/src/plugins/defaults/memory/v3/plugin-schema.ts +346 -0
- package/src/plugins/defaults/memory/v3/pool-log-store.ts +291 -0
- package/src/plugins/defaults/memory/v3/pool-select.test.ts +2 -2
- package/src/plugins/defaults/memory/v3/pool-select.ts +160 -60
- package/src/plugins/defaults/memory/v3/prune.test.ts +1042 -329
- package/src/plugins/defaults/memory/v3/prune.ts +433 -270
- package/src/plugins/defaults/memory/v3/rare-term-lane.test.ts +269 -0
- package/src/plugins/defaults/memory/v3/rare-term-lane.ts +141 -0
- package/src/plugins/defaults/memory/v3/render-injection.ts +43 -82
- package/src/plugins/defaults/memory/v3/section-dense-store.ts +316 -28
- package/src/plugins/defaults/memory/v3/section-needle.ts +145 -11
- package/src/plugins/defaults/memory/v3/sections.ts +103 -16
- package/src/plugins/defaults/memory/v3/selection-log-store.ts +243 -78
- package/src/plugins/defaults/memory/v3/shadow-plugin.ts +189 -68
- package/src/plugins/defaults/memory/v3/tuning-profile.ts +6 -0
- package/src/plugins/defaults/memory/v3/types.ts +169 -23
- package/src/plugins/defaults/memory/v3-eval/__tests__/eval-packets.test.ts +21 -4
- package/src/plugins/defaults/memory/v3-eval/eval-packets.ts +77 -26
- package/src/plugins/types.ts +14 -0
- package/src/providers/__tests__/connection-model-compat.test.ts +1 -0
- package/src/providers/__tests__/provider-secret-catalog.test.ts +4 -0
- package/src/providers/__tests__/xml-tool-call-salvage.test.ts +172 -0
- package/src/providers/inline-audio-support.test.ts +34 -0
- package/src/providers/inline-audio-support.ts +27 -0
- package/src/providers/model-catalog.ts +102 -0
- package/src/providers/openai/__tests__/chat-completions-extra-body.test.ts +51 -0
- package/src/providers/openai/__tests__/chat-completions-provider-xml-salvage.test.ts +291 -0
- package/src/providers/openai/chat-completions-provider.ts +114 -14
- package/src/providers/openai/codex-models.ts +1 -0
- package/src/providers/openai/responses-provider.ts +65 -15
- package/src/providers/opencode/client.test.ts +24 -0
- package/src/providers/opencode/client.ts +6 -1
- package/src/providers/provider-secret-catalog.ts +11 -1
- package/src/providers/retry.ts +6 -0
- package/src/providers/vellum/client.ts +14 -1
- package/src/providers/vellum/personality-directions.test.ts +163 -0
- package/src/providers/vellum/personality-directions.ts +120 -0
- package/src/providers/xml-tool-call-salvage.ts +212 -0
- package/src/runtime/AGENTS.md +7 -2
- package/src/runtime/__tests__/background-job-runner.test.ts +115 -0
- package/src/runtime/__tests__/guardian-form-registry.test.ts +0 -32
- package/src/runtime/__tests__/host-observe.test.ts +44 -0
- package/src/runtime/assistant-event-hub.ts +14 -9
- package/src/runtime/auth/__tests__/guard-tests.test.ts +1 -4
- package/src/runtime/auth/__tests__/route-policy.test.ts +65 -0
- package/src/runtime/auth/same-actor.ts +4 -3
- package/src/runtime/background-job-runner.ts +10 -0
- package/src/runtime/channel-reply-delivery.ts +1 -162
- package/src/runtime/guardian-action-service.ts +20 -1
- package/src/runtime/host-observe.ts +56 -6
- package/src/runtime/http-server.ts +35 -0
- package/src/runtime/outbound-post-reconciliation.ts +183 -0
- package/src/runtime/routes/__tests__/contact-address-prompt-route.test.ts +231 -0
- package/src/runtime/routes/__tests__/contact-record-prompt-route.test.ts +59 -3
- package/src/runtime/routes/__tests__/guardian-form-routes.test.ts +85 -0
- package/src/runtime/routes/__tests__/heartbeat-routes.test.ts +24 -0
- package/src/runtime/routes/__tests__/platform-credits-routes.test.ts +239 -0
- package/src/runtime/routes/__tests__/roadmap-routes.test.ts +469 -0
- package/src/runtime/routes/__tests__/watch-routes.test.ts +70 -1
- package/src/runtime/routes/__tests__/webhook-routes.test.ts +83 -0
- package/src/runtime/routes/contact-prompt-routes.ts +177 -28
- package/src/runtime/routes/conversation-query-routes.ts +53 -11
- package/src/runtime/routes/events-routes.ts +13 -3
- package/src/runtime/routes/guardian-action-routes.ts +7 -0
- package/src/runtime/routes/guardian-form-routes.ts +6 -4
- package/src/runtime/routes/heartbeat-routes.ts +41 -53
- package/src/runtime/routes/index.ts +2 -2
- package/src/runtime/routes/integrations/a2a.ts +12 -3
- package/src/runtime/routes/integrations/vercel.ts +13 -3
- package/src/runtime/routes/platform-routes.ts +175 -23
- package/src/runtime/routes/roadmap-routes.ts +744 -0
- package/src/runtime/routes/watch-routes.ts +50 -0
- package/src/runtime/routes/webhook-routes.ts +24 -2
- package/src/runtime/web-presence.ts +13 -9
- package/src/schedule/__tests__/schedule-timezone.test.ts +21 -3
- package/src/schedule/__tests__/worker-mcp-tools.test.ts +88 -0
- package/src/schedule/schedule-timezone.ts +25 -0
- package/src/schedule/scheduler.ts +19 -0
- package/src/schedule/worker.ts +119 -2
- package/src/telemetry/__tests__/live-voice-funnel.test.ts +32 -0
- package/src/telemetry/live-voice-funnel.ts +33 -0
- package/src/tools/acp/list-agents.test.ts +1 -1
- package/src/tools/browser/__tests__/browser-status.test.ts +3 -0
- package/src/tools/browser/browser-execution.ts +117 -53
- package/src/tools/browser/browser-status-constants.ts +6 -6
- package/src/tools/capability-offer.test.ts +87 -0
- package/src/tools/capability-offer.ts +93 -0
- package/src/tools/computer-use/definitions.ts +6 -0
- package/src/tools/computer-use/skill-proxy-bridge.ts +10 -0
- package/src/tools/terminal/safe-env.ts +2 -0
- package/src/watch/__tests__/watch-retro.test.ts +11 -10
- package/src/watch/__tests__/watch-session-manager.test.ts +75 -1
- package/src/watch/watch-retro.ts +10 -9
- package/src/watch/watch-session-manager.ts +17 -0
- package/src/runtime/routes/__tests__/sight-frame-routes.test.ts +0 -487
- package/src/runtime/routes/sight-frame-routes.ts +0 -136
|
@@ -80,6 +80,7 @@ import { getSubagentManager } from "../subagent/index.js";
|
|
|
80
80
|
import {
|
|
81
81
|
liveVoiceEndScreen,
|
|
82
82
|
liveVoiceSilenceReason,
|
|
83
|
+
liveVoiceStartScreen,
|
|
83
84
|
} from "../telemetry/live-voice-funnel.js";
|
|
84
85
|
import { getToolOwner } from "../tools/registry.js";
|
|
85
86
|
import {
|
|
@@ -280,6 +281,19 @@ export type LiveVoiceStreamingTranscriberResolver = (
|
|
|
280
281
|
export type LiveVoiceCredentialReadinessResolver =
|
|
281
282
|
() => Promise<LiveVoiceCredentialReadiness>;
|
|
282
283
|
|
|
284
|
+
/**
|
|
285
|
+
* What a session's own guardian read settled on, which is not the same as no
|
|
286
|
+
* read having happened.
|
|
287
|
+
*
|
|
288
|
+
* Present with an undefined `principalId` means the session asked past the
|
|
289
|
+
* cache and got no answer; the turn then runs with no actor rather than with
|
|
290
|
+
* the cached one. Absent means nothing asked, which is the background
|
|
291
|
+
* continuation, and only its trust answer is used.
|
|
292
|
+
*/
|
|
293
|
+
export interface LiveVoiceSessionGuardian {
|
|
294
|
+
principalId: string | undefined;
|
|
295
|
+
}
|
|
296
|
+
|
|
283
297
|
export type LiveVoiceTurnStarter = (
|
|
284
298
|
options: VoiceTurnOptions,
|
|
285
299
|
) => Promise<VoiceTurnHandle>;
|
|
@@ -1201,6 +1215,11 @@ export class LiveVoiceSession implements LiveVoiceSessionContract {
|
|
|
1201
1215
|
private receivedAudio = false;
|
|
1202
1216
|
private detectedSpeech = false;
|
|
1203
1217
|
private dispatchedTurn = false;
|
|
1218
|
+
// Loudest server-VAD chunk not attributed to assistant playback, on the
|
|
1219
|
+
// gate's own scale. Logged with a silent session's end so `no_speech` can
|
|
1220
|
+
// be told apart: a peak under the gate is a user who talked and was not
|
|
1221
|
+
// heard, a peak near the floor is a user who said nothing.
|
|
1222
|
+
private peakChunkAmplitude = 0;
|
|
1204
1223
|
// The client declared a text input affordance on the start frame, so it can
|
|
1205
1224
|
// take a turn without the microphone. Governs one thing only: whether a
|
|
1206
1225
|
// missing speech-to-text leg is fatal to startup (see start()).
|
|
@@ -1304,6 +1323,10 @@ export class LiveVoiceSession implements LiveVoiceSessionContract {
|
|
|
1304
1323
|
// older one is simply out of date. Consumed (and cleared) when a turn
|
|
1305
1324
|
// launches, handed back if that turn is rolled back, and cleared on close.
|
|
1306
1325
|
private pendingTurnAttachmentId: string | null = null;
|
|
1326
|
+
// When `speech_started` last went to the client, for the sight-frame log:
|
|
1327
|
+
// the distance from it to a keep arriving is the client leg of the frame the
|
|
1328
|
+
// onset asked for, measured from the daemon's own clock.
|
|
1329
|
+
private lastSpeechStartedAtMs: number | null = null;
|
|
1307
1330
|
private readonly maxPendingAudioBytes: number;
|
|
1308
1331
|
// Set on VAD speech onset; consumed when the first speech chunk is routed
|
|
1309
1332
|
// to an utterance so the metric lands on the right turn.
|
|
@@ -1493,7 +1516,13 @@ export class LiveVoiceSession implements LiveVoiceSessionContract {
|
|
|
1493
1516
|
// credentials is precisely the one the failure rate needs to count, and
|
|
1494
1517
|
// recording the start only once `ready` goes out would hide every such
|
|
1495
1518
|
// session from both the numerator and the denominator.
|
|
1496
|
-
recordLiveVoiceSessionStarted(
|
|
1519
|
+
recordLiveVoiceSessionStarted({
|
|
1520
|
+
sessionId: this.context.sessionId,
|
|
1521
|
+
screen: liveVoiceStartScreen(
|
|
1522
|
+
this.context.startFrame.client,
|
|
1523
|
+
this.context.startFrame.entry,
|
|
1524
|
+
),
|
|
1525
|
+
});
|
|
1497
1526
|
|
|
1498
1527
|
if (this.resolveCredentialReadiness) {
|
|
1499
1528
|
const readiness = await this.resolveCredentialReadiness();
|
|
@@ -1694,11 +1723,32 @@ export class LiveVoiceSession implements LiveVoiceSessionContract {
|
|
|
1694
1723
|
* same fact.
|
|
1695
1724
|
*/
|
|
1696
1725
|
private persistSightFrame(frame: LiveVoiceClientSightFrameFrame): void {
|
|
1726
|
+
const receivedAtMs = Date.now();
|
|
1727
|
+
// One line per keep, written when the row lands, carrying the whole
|
|
1728
|
+
// timeline: the client leg the frame reported, the daemon leg the persist
|
|
1729
|
+
// measured, and the distance from the speech onset the frame may have
|
|
1730
|
+
// been asked for. Together with the turn's own "Voice turn dispatch
|
|
1731
|
+
// timing" line this says whether a frame missed its turn and where.
|
|
1732
|
+
const sinceSpeechStartedMs =
|
|
1733
|
+
this.lastSpeechStartedAtMs === null
|
|
1734
|
+
? null
|
|
1735
|
+
: receivedAtMs - this.lastSpeechStartedAtMs;
|
|
1697
1736
|
void persistAmbientSightFrame(
|
|
1698
1737
|
this.conversationId,
|
|
1699
1738
|
frame.attachmentId,
|
|
1700
1739
|
"voice",
|
|
1701
1740
|
).then((result) => {
|
|
1741
|
+
log.info(
|
|
1742
|
+
{
|
|
1743
|
+
attachmentId: frame.attachmentId,
|
|
1744
|
+
persisted: result.ok,
|
|
1745
|
+
sinceSpeechStartedMs,
|
|
1746
|
+
client: frame.timing ?? null,
|
|
1747
|
+
daemon: result.timing ?? null,
|
|
1748
|
+
daemonTotalMs: Date.now() - receivedAtMs,
|
|
1749
|
+
},
|
|
1750
|
+
"Sight frame timing",
|
|
1751
|
+
);
|
|
1702
1752
|
if (!result.ok && !this.isClosed) {
|
|
1703
1753
|
void this.sendFrame({
|
|
1704
1754
|
type: "error",
|
|
@@ -1863,6 +1913,25 @@ export class LiveVoiceSession implements LiveVoiceSessionContract {
|
|
|
1863
1913
|
),
|
|
1864
1914
|
outcome: failed ? "failed" : "completed",
|
|
1865
1915
|
});
|
|
1916
|
+
if (silenceReason !== null) {
|
|
1917
|
+
// The levels behind a silent session, on the gate's scale, since the
|
|
1918
|
+
// end event carries only the classification. A peak below `speechGate`
|
|
1919
|
+
// on a `no_speech` session is a microphone the gate could not hear.
|
|
1920
|
+
log.info(
|
|
1921
|
+
{
|
|
1922
|
+
sessionId: this.context.sessionId,
|
|
1923
|
+
reason,
|
|
1924
|
+
silenceReason,
|
|
1925
|
+
peakChunkAmplitude: Math.round(this.peakChunkAmplitude),
|
|
1926
|
+
noiseFloor:
|
|
1927
|
+
this.roomNoiseFloor.floor === null
|
|
1928
|
+
? null
|
|
1929
|
+
: Math.round(this.roomNoiseFloor.floor),
|
|
1930
|
+
speechGate: Math.round(this.effectiveBaseThreshold()),
|
|
1931
|
+
},
|
|
1932
|
+
"Live-voice session ended without a turn",
|
|
1933
|
+
);
|
|
1934
|
+
}
|
|
1866
1935
|
|
|
1867
1936
|
const shouldEmitSessionEndMetrics = this.state !== "failed";
|
|
1868
1937
|
this.state = "closed";
|
|
@@ -2274,6 +2343,12 @@ export class LiveVoiceSession implements LiveVoiceSessionContract {
|
|
|
2274
2343
|
if (energyClassification === "echo") {
|
|
2275
2344
|
return;
|
|
2276
2345
|
}
|
|
2346
|
+
// Measured past the echo gate, so a greeting heard through the speaker
|
|
2347
|
+
// cannot stand in for the user on a silent close.
|
|
2348
|
+
const meanAmplitude = pcm16MeanAmplitude(chunk);
|
|
2349
|
+
if (meanAmplitude > this.peakChunkAmplitude) {
|
|
2350
|
+
this.peakChunkAmplitude = meanAmplitude;
|
|
2351
|
+
}
|
|
2277
2352
|
|
|
2278
2353
|
// Idle mic: hold silent chunks in the bounded pre-roll instead of
|
|
2279
2354
|
// collecting or streaming them; flushed on speech onset so the
|
|
@@ -2740,12 +2815,21 @@ export class LiveVoiceSession implements LiveVoiceSessionContract {
|
|
|
2740
2815
|
|
|
2741
2816
|
this.pendingBargeIn = null;
|
|
2742
2817
|
this.assistantPlaybackTailUntilMs = 0;
|
|
2743
|
-
|
|
2818
|
+
this.sendSpeechStarted();
|
|
2744
2819
|
if (bargeableTurn) {
|
|
2745
2820
|
this.bargeIn(bargeableTurn);
|
|
2746
2821
|
}
|
|
2747
2822
|
}
|
|
2748
2823
|
|
|
2824
|
+
/**
|
|
2825
|
+
* Tell the client the caller started speaking, and remember when, so a
|
|
2826
|
+
* camera frame that follows can be logged against the onset it answers.
|
|
2827
|
+
*/
|
|
2828
|
+
private sendSpeechStarted(): void {
|
|
2829
|
+
this.lastSpeechStartedAtMs = Date.now();
|
|
2830
|
+
void this.sendFrame({ type: "speech_started" });
|
|
2831
|
+
}
|
|
2832
|
+
|
|
2749
2833
|
// Advance the sustained-speech barge-in guard by one server-VAD chunk.
|
|
2750
2834
|
// Speech accumulates toward bargeInMinSpeechMs, short true-silence gaps are
|
|
2751
2835
|
// tolerated, and classified playback echo resets the run immediately.
|
|
@@ -2791,7 +2875,7 @@ export class LiveVoiceSession implements LiveVoiceSessionContract {
|
|
|
2791
2875
|
}
|
|
2792
2876
|
this.pendingBargeIn = null;
|
|
2793
2877
|
this.assistantPlaybackTailUntilMs = 0;
|
|
2794
|
-
|
|
2878
|
+
this.sendSpeechStarted();
|
|
2795
2879
|
const { turn } = guard;
|
|
2796
2880
|
if (turn && turn === this.activeAssistantTurn && !turn.finalized) {
|
|
2797
2881
|
this.bargeIn(turn);
|
|
@@ -5262,6 +5346,9 @@ export class LiveVoiceSession implements LiveVoiceSessionContract {
|
|
|
5262
5346
|
...(this.context.startFrame.client
|
|
5263
5347
|
? { client: this.context.startFrame.client }
|
|
5264
5348
|
: {}),
|
|
5349
|
+
...(this.context.startFrame.entry
|
|
5350
|
+
? { entry: this.context.startFrame.entry }
|
|
5351
|
+
: {}),
|
|
5265
5352
|
},
|
|
5266
5353
|
voiceControlPrompt: buildVoiceControlPrompt(activeTurn, {
|
|
5267
5354
|
...(leg.frontDoor !== undefined ? { frontDoor: leg.frontDoor } : {}),
|
|
@@ -6965,7 +7052,9 @@ export function createLiveVoiceSession(
|
|
|
6965
7052
|
options.resolveCredentialReadiness === undefined
|
|
6966
7053
|
? defaultResolveLiveVoiceCredentialReadiness
|
|
6967
7054
|
: options.resolveCredentialReadiness,
|
|
6968
|
-
startVoiceTurn:
|
|
7055
|
+
startVoiceTurn:
|
|
7056
|
+
options.startVoiceTurn ??
|
|
7057
|
+
makeDefaultStartVoiceTurn(context.guardianPrincipalId),
|
|
6969
7058
|
streamTtsAudio:
|
|
6970
7059
|
options.streamTtsAudio === undefined
|
|
6971
7060
|
? defaultStreamLiveVoiceTtsAudio
|
|
@@ -7012,7 +7101,7 @@ export async function defaultSpawnBackgroundContinuation(args: {
|
|
|
7012
7101
|
// trust the foreground turn ran under and pass it explicitly (resolution
|
|
7013
7102
|
// itself stays fail-closed: on a miss the continuation runs as `unknown`,
|
|
7014
7103
|
// exactly as an unstamped turn does).
|
|
7015
|
-
const trustContext = await
|
|
7104
|
+
const { trustContext } = await resolveLocalLiveVoiceIdentity(
|
|
7016
7105
|
args.parentConversationId,
|
|
7017
7106
|
);
|
|
7018
7107
|
// getOrCreateConversation (not a raw registry read): it rebuilds a stale
|
|
@@ -7122,8 +7211,34 @@ async function defaultResolveLiveVoiceCredentialReadiness(): Promise<LiveVoiceCr
|
|
|
7122
7211
|
return resolveLiveVoiceCredentialReadiness();
|
|
7123
7212
|
}
|
|
7124
7213
|
|
|
7214
|
+
/**
|
|
7215
|
+
* The default turn starter, bound to the guardian this session was admitted
|
|
7216
|
+
* for.
|
|
7217
|
+
*
|
|
7218
|
+
* **The gateway's principal is authoritative and nothing here re-resolves
|
|
7219
|
+
* it.** The admission decision is made against the gateway's own binding and
|
|
7220
|
+
* the principal travels down on the upstream dial. The daemon is reached
|
|
7221
|
+
* through a service token, so every socket arrives as the same caller and any
|
|
7222
|
+
* identity worked out here would be a separate, later reading of a binding
|
|
7223
|
+
* that can change in between, leaving a session admitted for one guardian
|
|
7224
|
+
* running as another.
|
|
7225
|
+
*
|
|
7226
|
+
* Absent when the gateway named nobody, and the session's turns then run with
|
|
7227
|
+
* no actor.
|
|
7228
|
+
*
|
|
7229
|
+
* Exported for its tests, which are the only way to reach this: every caller
|
|
7230
|
+
* of `createLiveVoiceSession` in the suite injects its own `startVoiceTurn`,
|
|
7231
|
+
* so this starter is never driven there.
|
|
7232
|
+
*/
|
|
7233
|
+
export function makeDefaultStartVoiceTurn(
|
|
7234
|
+
guardianPrincipalId?: string,
|
|
7235
|
+
): LiveVoiceTurnStarter {
|
|
7236
|
+
return (options) => defaultStartVoiceTurn(options, guardianPrincipalId);
|
|
7237
|
+
}
|
|
7238
|
+
|
|
7125
7239
|
async function defaultStartVoiceTurn(
|
|
7126
7240
|
options: VoiceTurnOptions,
|
|
7241
|
+
guardianPrincipalId: string | undefined,
|
|
7127
7242
|
): Promise<VoiceTurnHandle> {
|
|
7128
7243
|
// On the first turn of a brand-new chat the client's conversation id has no
|
|
7129
7244
|
// persisted `conversations` row yet — the live-voice session adopts the id
|
|
@@ -7133,8 +7248,8 @@ async function defaultStartVoiceTurn(
|
|
|
7133
7248
|
// exists (idempotent) before persisting. Lives in the production wiring, not
|
|
7134
7249
|
// the session state machine, so session unit tests stay DB-free.
|
|
7135
7250
|
// Native: this is the local live-voice session, which adopts a conversation
|
|
7136
|
-
// id the app supplied. Its
|
|
7137
|
-
// `
|
|
7251
|
+
// id the app supplied. Its guardian identity resolves through
|
|
7252
|
+
// `resolveLocalLiveVoiceIdentity`, and a phone call reaches the assistant
|
|
7138
7253
|
// through the telephony path rather than here.
|
|
7139
7254
|
const createdConversation = ensureConversationExists(
|
|
7140
7255
|
options.conversationId,
|
|
@@ -7150,18 +7265,21 @@ async function defaultStartVoiceTurn(
|
|
|
7150
7265
|
options.conversationId,
|
|
7151
7266
|
);
|
|
7152
7267
|
}
|
|
7153
|
-
// Stamp the turn with the guardian's trust context
|
|
7154
|
-
//
|
|
7155
|
-
// session only exists for the guardian's own
|
|
7156
|
-
// gateway pins the `/v1/live-voice` upgrade to the
|
|
7157
|
-
// live-voice ingress bypasses the send-message
|
|
7158
|
-
//
|
|
7159
|
-
//
|
|
7160
|
-
//
|
|
7268
|
+
// Stamp the turn with the guardian's identity: the trust context that says
|
|
7269
|
+
// what it may do, and the actor principal that says whose machine it may
|
|
7270
|
+
// reach. A local live-voice session only exists for the guardian's own
|
|
7271
|
+
// authenticated client (the gateway pins the `/v1/live-voice` upgrade to the
|
|
7272
|
+
// bound guardian), but the live-voice ingress bypasses the send-message
|
|
7273
|
+
// route, which is where both are normally established. Without the trust
|
|
7274
|
+
// stamp the turn runs fail-closed as `unknown` and every sensitive tool is
|
|
7275
|
+
// denied; without the actor stamp it matches no connected client and every
|
|
7276
|
+
// host-proxy call is refused. Resolution stays fail-closed on both: a
|
|
7277
|
+
// gateway miss or missing binding leaves them unset, never a blind grant.
|
|
7161
7278
|
const trustStartedAt = performance.now();
|
|
7162
|
-
const trustContext =
|
|
7163
|
-
options.conversationId,
|
|
7164
|
-
|
|
7279
|
+
const { actorPrincipalId, trustContext } =
|
|
7280
|
+
await resolveLocalLiveVoiceIdentity(options.conversationId, {
|
|
7281
|
+
principalId: guardianPrincipalId,
|
|
7282
|
+
});
|
|
7165
7283
|
const trustMs = Math.round(performance.now() - trustStartedAt);
|
|
7166
7284
|
const { startVoiceTurn } = await import("../calls/voice-session-bridge.js");
|
|
7167
7285
|
log.info(
|
|
@@ -7175,35 +7293,82 @@ async function defaultStartVoiceTurn(
|
|
|
7175
7293
|
);
|
|
7176
7294
|
return startVoiceTurn({
|
|
7177
7295
|
...options,
|
|
7296
|
+
...(actorPrincipalId
|
|
7297
|
+
? { actorPrincipalId }
|
|
7298
|
+
: // The session asked and got no answer, so the conversation's resting
|
|
7299
|
+
// identity must not stand in: it may name the guardian this one was
|
|
7300
|
+
// rebound from, and the host proxies would follow it to that user's
|
|
7301
|
+
// desktop.
|
|
7302
|
+
{ actorFallbackSuppressed: true }),
|
|
7178
7303
|
...(trustContext ? { trustContext } : {}),
|
|
7179
7304
|
});
|
|
7180
7305
|
}
|
|
7181
7306
|
|
|
7182
7307
|
/**
|
|
7183
|
-
*
|
|
7184
|
-
*
|
|
7185
|
-
*
|
|
7186
|
-
*
|
|
7308
|
+
* Who a live-voice turn runs as: the local guardian's actor principal, and the
|
|
7309
|
+
* {@link TrustContext} resolved for it.
|
|
7310
|
+
*
|
|
7311
|
+
* The two answer different questions and are withheld under different
|
|
7312
|
+
* conditions, so a turn can carry one without the other.
|
|
7313
|
+
*
|
|
7314
|
+
* The principal says whose machine a tool may reach, and the host proxies
|
|
7315
|
+
* match connected clients against it. The trust class is a policy answer about
|
|
7316
|
+
* that principal, saying what the turn may do once it has one. A binding that
|
|
7317
|
+
* resolves to something other than `guardian` still names the actor the turn
|
|
7318
|
+
* belongs to: withholding the principal there would refuse the owner access to
|
|
7319
|
+
* their own machine over a question about what they are allowed to do with it.
|
|
7320
|
+
*
|
|
7321
|
+
* **The common partial answer is trust without an actor**, and it is the one
|
|
7322
|
+
* to recognise in an incident. A session whose own guardian read settled
|
|
7323
|
+
* nothing still resolves trust from the cached binding, because what a turn
|
|
7324
|
+
* may do is a question about the machine's owner and the cache answers it; the
|
|
7325
|
+
* actor is withheld because the cache cannot say whether the gateway admitted
|
|
7326
|
+
* that guardian or one it was rebound from. Such a turn talks and acts
|
|
7327
|
+
* normally and only its host-proxy calls are refused, which reads as computer
|
|
7328
|
+
* use being unavailable rather than as an untrusted turn.
|
|
7329
|
+
*
|
|
7330
|
+
* Both are empty only when no vellum guardian binding exists at all, or the
|
|
7331
|
+
* gateway answers nothing to either read, and the turn then runs exactly as an
|
|
7332
|
+
* unstamped one does.
|
|
7187
7333
|
*/
|
|
7188
|
-
async function
|
|
7334
|
+
export async function resolveLocalLiveVoiceIdentity(
|
|
7189
7335
|
conversationId: string,
|
|
7190
|
-
|
|
7336
|
+
session?: LiveVoiceSessionGuardian,
|
|
7337
|
+
): Promise<{
|
|
7338
|
+
actorPrincipalId?: string;
|
|
7339
|
+
trustContext?: TrustContext;
|
|
7340
|
+
}> {
|
|
7191
7341
|
const { findLocalGuardianPrincipalId } =
|
|
7192
7342
|
await import("../runtime/local-actor-identity.js");
|
|
7193
7343
|
const { resolveLocalPrincipalTrustContext } =
|
|
7194
7344
|
await import("../runtime/local-principal-trust.js");
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7345
|
+
// Trust is a question about the machine's own owner, so the cached binding
|
|
7346
|
+
// answers it whenever the session's read settled nothing. The actor is a
|
|
7347
|
+
// question about whose desktop a tool may reach, and only a read the
|
|
7348
|
+
// gateway's admission was reconciled with answers that one.
|
|
7349
|
+
const trustPrincipalId =
|
|
7350
|
+
session?.principalId ?? (await findLocalGuardianPrincipalId());
|
|
7351
|
+
if (!trustPrincipalId) {
|
|
7352
|
+
return {};
|
|
7198
7353
|
}
|
|
7199
7354
|
const trustContext = await resolveLocalPrincipalTrustContext({
|
|
7200
|
-
actorPrincipalId:
|
|
7355
|
+
actorPrincipalId: trustPrincipalId,
|
|
7201
7356
|
sourceChannel: "vellum",
|
|
7202
7357
|
conversationExternalId: conversationId,
|
|
7203
7358
|
});
|
|
7204
|
-
//
|
|
7205
|
-
//
|
|
7206
|
-
|
|
7359
|
+
// **Unset beats stale.** A session whose read settled nothing knows the
|
|
7360
|
+
// cached binding, but not whether the gateway admitted that guardian or one
|
|
7361
|
+
// it was just rebound from. Stamping the cached answer risks the turn
|
|
7362
|
+
// reaching another user's desktop; stamping nothing costs this session its
|
|
7363
|
+
// host proxies, which is where a voice session carrying no actor already
|
|
7364
|
+
// sits, and leaves the call itself untouched either way.
|
|
7365
|
+
const actorPrincipalId = session ? session.principalId : trustPrincipalId;
|
|
7366
|
+
return {
|
|
7367
|
+
...(actorPrincipalId ? { actorPrincipalId } : {}),
|
|
7368
|
+
// Only stamp a positive guardian resolution; the resolver's own
|
|
7369
|
+
// fail-closed `unknown` carries no more information than no stamp.
|
|
7370
|
+
...(trustContext.trustClass === "guardian" ? { trustContext } : {}),
|
|
7371
|
+
};
|
|
7207
7372
|
}
|
|
7208
7373
|
|
|
7209
7374
|
async function defaultStreamLiveVoiceTtsAudio(
|
|
@@ -135,6 +135,39 @@ export interface LiveVoiceClientStartFrame {
|
|
|
135
135
|
* load-bearing for what a voice turn may do.
|
|
136
136
|
*/
|
|
137
137
|
readonly client?: ClientOs;
|
|
138
|
+
/**
|
|
139
|
+
* Which control the session was asked from, as distinct from which client
|
|
140
|
+
* (`client`) it was asked on. The macOS app alone has three: the chat's
|
|
141
|
+
* voice button (`composer`), the companion surface's Talk (`companion`),
|
|
142
|
+
* and the voice key (`voice_key`, or `voice_key_ask` for a hold made over a
|
|
143
|
+
* selection). `deep_link` is Siri, a widget, the Action Button or a Live
|
|
144
|
+
* Activity tap, and `cli` the terminal client. Absent from clients that
|
|
145
|
+
* predate the field.
|
|
146
|
+
*
|
|
147
|
+
* Analytics only, exactly like `client`, and unlike `client` an open string
|
|
148
|
+
* rather than a closed set: the values are minted where the controls are,
|
|
149
|
+
* in the clients, and a daemon older than the client that sent one must
|
|
150
|
+
* carry the value through rather than erase it. The parser bounds the shape
|
|
151
|
+
* instead ({@link parseLiveVoiceEntry}) and drops anything outside it, so a
|
|
152
|
+
* malformed value costs a chart facet and never the session.
|
|
153
|
+
*/
|
|
154
|
+
readonly entry?: string;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* The shape a start frame's `entry` must have: a short snake_case token.
|
|
159
|
+
*
|
|
160
|
+
* The bound is set by where the value lands. The started telemetry row stamps
|
|
161
|
+
* `started_<client>:<entry>` into a 64-character wire field, and the longest
|
|
162
|
+
* `ClientOs` is seven characters, so 32 leaves the stamp well inside it.
|
|
163
|
+
*/
|
|
164
|
+
const LIVE_VOICE_ENTRY_PATTERN = /^[a-z][a-z0-9_]{0,31}$/;
|
|
165
|
+
|
|
166
|
+
/** Parse a start frame's `entry`. Returns `null` for anything off-shape. */
|
|
167
|
+
export function parseLiveVoiceEntry(value: unknown): string | null {
|
|
168
|
+
return typeof value === "string" && LIVE_VOICE_ENTRY_PATTERN.test(value)
|
|
169
|
+
? value
|
|
170
|
+
: null;
|
|
138
171
|
}
|
|
139
172
|
|
|
140
173
|
/**
|
|
@@ -279,6 +312,44 @@ export interface LiveVoiceClientAttachFrameFrame {
|
|
|
279
312
|
export interface LiveVoiceClientSightFrameFrame {
|
|
280
313
|
readonly type: "sight_frame";
|
|
281
314
|
readonly attachmentId: string;
|
|
315
|
+
/**
|
|
316
|
+
* How long the client's half of the frame took, for the daemon's log. The
|
|
317
|
+
* daemon adds its own half and the distance from the speech onset it
|
|
318
|
+
* announced, which is what makes a frame that answered the wrong question
|
|
319
|
+
* legible after the fact. Optional: an older client sends none.
|
|
320
|
+
*/
|
|
321
|
+
readonly timing?: LiveVoiceSightFrameTiming;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* The client leg of one kept frame, as durations between its own marks.
|
|
326
|
+
*
|
|
327
|
+
* Durations rather than timestamps because the two clocks are not the same
|
|
328
|
+
* clock: the client stamps from `performance.now` and the daemon from wall
|
|
329
|
+
* time, and only the client can say how long its encode and upload took.
|
|
330
|
+
* Every field is a non-negative whole number of milliseconds.
|
|
331
|
+
*/
|
|
332
|
+
export interface LiveVoiceSightFrameTiming {
|
|
333
|
+
/**
|
|
334
|
+
* Why the gate kept the frame: `forced` is the keep a speech onset asked
|
|
335
|
+
* for, everything else is the ambient cadence. Free-form so a new gate
|
|
336
|
+
* reason needs no daemon change to be logged.
|
|
337
|
+
*/
|
|
338
|
+
readonly reason: string;
|
|
339
|
+
/**
|
|
340
|
+
* From the arm that asked for this keep to the keep itself. Present only on
|
|
341
|
+
* a forced keep, where it is the distance from the client hearing
|
|
342
|
+
* `speech_started` to a frame that postdates it.
|
|
343
|
+
*/
|
|
344
|
+
readonly armToKeepMs?: number;
|
|
345
|
+
/** From the keep to a JPEG in hand, sized for upload. */
|
|
346
|
+
readonly keepToEncodedMs: number;
|
|
347
|
+
/** From the JPEG to the attachment id, which is the HTTP upload. */
|
|
348
|
+
readonly encodedToUploadedMs: number;
|
|
349
|
+
/** From the id to the send, which is the wait for older keeps to go first. */
|
|
350
|
+
readonly uploadedToSentMs: number;
|
|
351
|
+
/** The JPEG that was uploaded, in bytes. */
|
|
352
|
+
readonly bytes: number;
|
|
282
353
|
}
|
|
283
354
|
|
|
284
355
|
/**
|
|
@@ -899,9 +970,68 @@ function validateSightFrameFrame(
|
|
|
899
970
|
);
|
|
900
971
|
}
|
|
901
972
|
|
|
973
|
+
if (!("timing" in value) || value.timing === undefined) {
|
|
974
|
+
return {
|
|
975
|
+
ok: true,
|
|
976
|
+
frame: { type: "sight_frame", attachmentId: value.attachmentId },
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
const timing = validateSightFrameTiming(value.timing);
|
|
981
|
+
if (timing === null) {
|
|
982
|
+
return protocolError(
|
|
983
|
+
"invalid_field",
|
|
984
|
+
"sight_frame frame field timing must carry non-negative integer durations and a reason",
|
|
985
|
+
"timing",
|
|
986
|
+
"sight_frame",
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
|
|
902
990
|
return {
|
|
903
991
|
ok: true,
|
|
904
|
-
frame: { type: "sight_frame", attachmentId: value.attachmentId },
|
|
992
|
+
frame: { type: "sight_frame", attachmentId: value.attachmentId, timing },
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* Parse a `sight_frame`'s `timing`. Null for anything off-shape: a timing is
|
|
998
|
+
* for the log, so nothing about it is coerced, but a malformed one still
|
|
999
|
+
* refuses the frame, since a client that sends one means to send a whole one.
|
|
1000
|
+
*/
|
|
1001
|
+
function validateSightFrameTiming(
|
|
1002
|
+
value: unknown,
|
|
1003
|
+
): LiveVoiceSightFrameTiming | null {
|
|
1004
|
+
if (typeof value !== "object" || value === null) {
|
|
1005
|
+
return null;
|
|
1006
|
+
}
|
|
1007
|
+
const record = value as Record<string, unknown>;
|
|
1008
|
+
const isDuration = (duration: unknown): duration is number =>
|
|
1009
|
+
isIntInRange(duration, 0, Number.MAX_SAFE_INTEGER);
|
|
1010
|
+
const {
|
|
1011
|
+
reason,
|
|
1012
|
+
armToKeepMs,
|
|
1013
|
+
keepToEncodedMs,
|
|
1014
|
+
encodedToUploadedMs,
|
|
1015
|
+
uploadedToSentMs,
|
|
1016
|
+
bytes,
|
|
1017
|
+
} = record;
|
|
1018
|
+
if (
|
|
1019
|
+
!isNonEmptyString(reason) ||
|
|
1020
|
+
!isDuration(keepToEncodedMs) ||
|
|
1021
|
+
!isDuration(encodedToUploadedMs) ||
|
|
1022
|
+
!isDuration(uploadedToSentMs) ||
|
|
1023
|
+
!isDuration(bytes) ||
|
|
1024
|
+
(armToKeepMs !== undefined && !isDuration(armToKeepMs))
|
|
1025
|
+
) {
|
|
1026
|
+
return null;
|
|
1027
|
+
}
|
|
1028
|
+
return {
|
|
1029
|
+
reason,
|
|
1030
|
+
...(armToKeepMs !== undefined ? { armToKeepMs } : {}),
|
|
1031
|
+
keepToEncodedMs,
|
|
1032
|
+
encodedToUploadedMs,
|
|
1033
|
+
uploadedToSentMs,
|
|
1034
|
+
bytes,
|
|
905
1035
|
};
|
|
906
1036
|
}
|
|
907
1037
|
|
|
@@ -1088,6 +1218,8 @@ function validateStartFrame(
|
|
|
1088
1218
|
// analytics dimension, and failing a session's startup over it would trade a
|
|
1089
1219
|
// gap in a chart for a user who cannot talk to their assistant.
|
|
1090
1220
|
const client = parseClientOs(value.client);
|
|
1221
|
+
// Same policy for the same reason: a dimension, not a capability.
|
|
1222
|
+
const entry = parseLiveVoiceEntry(value.entry);
|
|
1091
1223
|
|
|
1092
1224
|
return {
|
|
1093
1225
|
ok: true,
|
|
@@ -1097,6 +1229,7 @@ function validateStartFrame(
|
|
|
1097
1229
|
? { conversationId: value.conversationId }
|
|
1098
1230
|
: {}),
|
|
1099
1231
|
...(client ? { client } : {}),
|
|
1232
|
+
...(entry ? { entry } : {}),
|
|
1100
1233
|
audio: audioConfig.frame,
|
|
1101
1234
|
...(isLiveVoiceTurnDetectionMode(value.turnDetection)
|
|
1102
1235
|
? { turnDetection: value.turnDetection }
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The daemon's MCP reload is what announces itself to the other processes.
|
|
3
|
+
*
|
|
4
|
+
* Every path that changes the server set (a config edit, the reload route, an
|
|
5
|
+
* OAuth reauthentication, a plugin install) funnels through `reloadMcpServers`,
|
|
6
|
+
* so signalling there covers all of them. Signalling anywhere narrower would
|
|
7
|
+
* leave whichever path was missed silently stale in the schedule worker.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { existsSync, rmSync } from "node:fs";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
import { beforeEach, describe, expect, jest, mock, test } from "bun:test";
|
|
13
|
+
|
|
14
|
+
mock.module("../manager.js", () => ({
|
|
15
|
+
getMcpServerManager: () => ({
|
|
16
|
+
start: jest.fn(async () => []),
|
|
17
|
+
stop: jest.fn(async () => {}),
|
|
18
|
+
callTool: jest.fn(),
|
|
19
|
+
getClient: () => undefined,
|
|
20
|
+
}),
|
|
21
|
+
stopMcpServerManager: jest.fn(async () => {}),
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
mock.module("../mcp-header-store.js", () => ({
|
|
25
|
+
migrateLegacyMcpHeaders: async () => {},
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
mock.module("../../plugins/mcp-servers.js", () => ({
|
|
29
|
+
readPluginMcpServers: () => ({ servers: [], issues: [] }),
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
const { getSignalsDir } = await import("../../util/platform.js");
|
|
33
|
+
const { MCP_RELOAD_SIGNAL_FILE } = await import("../reload-signal.js");
|
|
34
|
+
const { reloadMcpServers } = await import("../../daemon/mcp-reload-service.js");
|
|
35
|
+
|
|
36
|
+
const signalPath = () => join(getSignalsDir(), MCP_RELOAD_SIGNAL_FILE);
|
|
37
|
+
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
rmSync(signalPath(), { force: true });
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe("reloadMcpServers", () => {
|
|
43
|
+
test("signals the reload so other processes rebuild their own set", async () => {
|
|
44
|
+
const result = await reloadMcpServers();
|
|
45
|
+
|
|
46
|
+
expect(result.success).toBe(true);
|
|
47
|
+
expect(
|
|
48
|
+
existsSync(signalPath()),
|
|
49
|
+
"Connections and the tools they register are per-process. A reload " +
|
|
50
|
+
"that only rebuilds the daemon's leaves the schedule worker calling " +
|
|
51
|
+
"servers the config no longer lists.",
|
|
52
|
+
).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The MCP reload signal, the channel that tells the daemon's child processes
|
|
3
|
+
* their MCP server set moved.
|
|
4
|
+
*
|
|
5
|
+
* They hold their own connections to the same servers and have no config
|
|
6
|
+
* watcher of their own, so without this they keep serving the set as it stood
|
|
7
|
+
* when they started: a server the config has since disabled stays callable
|
|
8
|
+
* there long after the daemon dropped it.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { existsSync, mkdirSync, readFileSync, rmSync } from "node:fs";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { beforeEach, describe, expect, test } from "bun:test";
|
|
14
|
+
|
|
15
|
+
import { getSignalsDir } from "../../util/platform.js";
|
|
16
|
+
import { MCP_RELOAD_SIGNAL_FILE, signalMcpReloaded } from "../reload-signal.js";
|
|
17
|
+
|
|
18
|
+
const signalPath = () => join(getSignalsDir(), MCP_RELOAD_SIGNAL_FILE);
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
rmSync(signalPath(), { force: true });
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe("signalMcpReloaded", () => {
|
|
25
|
+
test("writes the signal file", () => {
|
|
26
|
+
signalMcpReloaded();
|
|
27
|
+
|
|
28
|
+
expect(existsSync(signalPath())).toBe(true);
|
|
29
|
+
expect(Number(readFileSync(signalPath(), "utf8"))).toBeGreaterThan(0);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test("creates the signals directory when it is absent", () => {
|
|
33
|
+
rmSync(getSignalsDir(), { recursive: true, force: true });
|
|
34
|
+
|
|
35
|
+
signalMcpReloaded();
|
|
36
|
+
|
|
37
|
+
expect(existsSync(signalPath())).toBe(true);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("rewrites in place, so a second reload is a fresh event", () => {
|
|
41
|
+
mkdirSync(getSignalsDir(), { recursive: true });
|
|
42
|
+
signalMcpReloaded();
|
|
43
|
+
const first = readFileSync(signalPath(), "utf8");
|
|
44
|
+
|
|
45
|
+
const until = Date.now() + 2;
|
|
46
|
+
while (Date.now() < until) {
|
|
47
|
+
/* let the clock move so the two writes differ */
|
|
48
|
+
}
|
|
49
|
+
signalMcpReloaded();
|
|
50
|
+
|
|
51
|
+
expect(
|
|
52
|
+
readFileSync(signalPath(), "utf8"),
|
|
53
|
+
"Readers react to the write rather than consuming the file, so the " +
|
|
54
|
+
"content has to change for a second reload to register.",
|
|
55
|
+
).not.toBe(first);
|
|
56
|
+
});
|
|
57
|
+
});
|