@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
|
@@ -27,7 +27,8 @@ import {
|
|
|
27
27
|
quarantineRefusedExchanges,
|
|
28
28
|
} from "../context/refusal-quarantine.js";
|
|
29
29
|
import {
|
|
30
|
-
|
|
30
|
+
LEGACY_MEMORY_SPOTLIGHT_MATCHER,
|
|
31
|
+
MEMORY_POINTER_MATCHER,
|
|
31
32
|
NOW_SCRATCHPAD_STRIP_PREFIXES,
|
|
32
33
|
stripTailUserTextBlocksByPrefix,
|
|
33
34
|
stripUserTextBlocksByPrefix,
|
|
@@ -59,10 +60,17 @@ import {
|
|
|
59
60
|
unwrapMemoryBlock,
|
|
60
61
|
wrapMemoryBlock,
|
|
61
62
|
} from "../plugins/defaults/memory/memory-marker.js";
|
|
63
|
+
import { getPrunedSections } from "../plugins/defaults/memory/v3/ever-injected-store.js";
|
|
62
64
|
import {
|
|
65
|
+
mergeIntoAnchorBlock,
|
|
66
|
+
stripPrunedSectionsFromMessages,
|
|
67
|
+
} from "../plugins/defaults/memory/v3/prune.js";
|
|
68
|
+
import {
|
|
69
|
+
isV3LiveBlock,
|
|
70
|
+
markV3LiveBlock,
|
|
63
71
|
MEMORY_V3_BLOCK_ID,
|
|
64
72
|
MEMORY_V3_COMMIT_META_KEY,
|
|
65
|
-
|
|
73
|
+
MEMORY_V3_POINTER_BLOCK_ID,
|
|
66
74
|
} from "../plugins/defaults/memory/v3/types.js";
|
|
67
75
|
import { getRegisteredInjectors } from "../plugins/injector-registry.js";
|
|
68
76
|
import type {
|
|
@@ -1001,12 +1009,12 @@ function injectTransportHints(message: Message, hints: string[]): Message {
|
|
|
1001
1009
|
* `<active_thread>` focus block. DMs are excluded because they have no
|
|
1002
1010
|
* threads.
|
|
1003
1011
|
*
|
|
1004
|
-
* The gateway normalizer
|
|
1005
|
-
*
|
|
1006
|
-
* `
|
|
1007
|
-
*
|
|
1008
|
-
*
|
|
1009
|
-
*
|
|
1012
|
+
* The gateway normalizer (`gateway/src/slack/message-normalizer.ts`)
|
|
1013
|
+
* forwards `chatType: "channel"` for channel messages, `"im"` for a 1:1
|
|
1014
|
+
* DM, and `"mpim"` for a group DM, and omits it for an app mention, which
|
|
1015
|
+
* Slack sends without naming the room kind. Accepting only
|
|
1016
|
+
* `chatType === "channel"` therefore returns `false` for both DM shapes
|
|
1017
|
+
* and for an app mention.
|
|
1010
1018
|
*
|
|
1011
1019
|
* The chronological-transcript override applies to ALL Slack
|
|
1012
1020
|
* conversations (channels and DMs) — gate that on
|
|
@@ -1860,21 +1868,24 @@ export interface RuntimeInjectionBlocks {
|
|
|
1860
1868
|
*/
|
|
1861
1869
|
nonInteractiveContextBlock?: string;
|
|
1862
1870
|
/**
|
|
1863
|
-
* UNWRAPPED inner text of the memory-v3 frozen net-new
|
|
1871
|
+
* UNWRAPPED inner text of the memory-v3 frozen net-new section block the v3
|
|
1864
1872
|
* injector attached this turn, mirroring v2's unwrapped `memoryInjectedBlock`
|
|
1865
1873
|
* contract (rehydration re-wraps on use). Undefined when v3 attached no new
|
|
1866
|
-
*
|
|
1867
|
-
*
|
|
1874
|
+
* sections (all-repeat turn, v3 off, or v3 failure) and when the block
|
|
1875
|
+
* attached in memory only, carrying no residency commit (a replaced
|
|
1876
|
+
* history, a re-entry): what is captured here is persisted, and only a
|
|
1877
|
+
* block the store claims may be. Persisted by the user-prompt-submit hook
|
|
1878
|
+
* under `metadata.memoryV3InjectedBlock`
|
|
1868
1879
|
* (`MEMORY_V3_INJECTED_BLOCK_METADATA_KEY`).
|
|
1869
1880
|
*/
|
|
1870
1881
|
memoryV3InjectedBlock?: string;
|
|
1871
1882
|
/**
|
|
1872
|
-
* Rendered `<
|
|
1873
|
-
*
|
|
1874
|
-
* `metadata.
|
|
1875
|
-
* were sent with; a new
|
|
1883
|
+
* Rendered `<memory_pointer>` block spliced onto this turn's user message.
|
|
1884
|
+
* Persisted by the user-prompt-submit hook under
|
|
1885
|
+
* `metadata.memoryV3PointerBlock`. Historical turns keep the block they
|
|
1886
|
+
* were sent with; a new pointer is added only on the new tail.
|
|
1876
1887
|
*/
|
|
1877
|
-
|
|
1888
|
+
memoryV3PointerBlock?: string;
|
|
1878
1889
|
/**
|
|
1879
1890
|
* True when memory-v3 superseded v2 as this turn's `<memory>` source —
|
|
1880
1891
|
* `memory.v3.live` is on AND the v3 injector produced a block (possibly
|
|
@@ -1911,10 +1922,22 @@ export interface RuntimeInjectionResult {
|
|
|
1911
1922
|
* non-overlapping so the inspector's "Other" remainder is honest. The
|
|
1912
1923
|
* names are pinned by `injector-registry-order-guard.test.ts`.
|
|
1913
1924
|
*/
|
|
1914
|
-
const SELF_INSTRUMENTED_INJECTORS = new Set([
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1925
|
+
const SELF_INSTRUMENTED_INJECTORS = new Set(["memory-v3-shadow"]);
|
|
1926
|
+
|
|
1927
|
+
/**
|
|
1928
|
+
* Whether `block` replaces the turn's run messages: a
|
|
1929
|
+
* `"replace-run-messages"` placement carrying the override that
|
|
1930
|
+
* {@link applyInjectionBlock} swaps in (a replace block without one is a
|
|
1931
|
+
* no-op there).
|
|
1932
|
+
*/
|
|
1933
|
+
function replacesRunMessages(
|
|
1934
|
+
block: InjectionBlock,
|
|
1935
|
+
): block is InjectionBlock & { messagesOverride: Message[] } {
|
|
1936
|
+
return (
|
|
1937
|
+
block.placement === "replace-run-messages" &&
|
|
1938
|
+
block.messagesOverride !== undefined
|
|
1939
|
+
);
|
|
1940
|
+
}
|
|
1918
1941
|
|
|
1919
1942
|
/**
|
|
1920
1943
|
* Run every {@link Injector} in the chain ({@link getRegisteredInjectors},
|
|
@@ -1928,6 +1951,15 @@ const SELF_INSTRUMENTED_INJECTORS = new Set([
|
|
|
1928
1951
|
* callers ({@link composeInjectorChain}) that drive the chain without a
|
|
1929
1952
|
* message array.
|
|
1930
1953
|
*
|
|
1954
|
+
* `ctx` is handed to each injector as given, except that once an injector
|
|
1955
|
+
* has produced the run-messages replacement ({@link replacesRunMessages}),
|
|
1956
|
+
* every injector after it in the chain is told so on its context
|
|
1957
|
+
* (`TurnContext.replacesRunMessages`, read by the memory-v3 sections
|
|
1958
|
+
* injector). The flag follows the block Step 1 of
|
|
1959
|
+
* {@link applyRuntimeInjections} swaps in, so it is set exactly when the
|
|
1960
|
+
* replacement fires: never for a replacing injector that is unregistered,
|
|
1961
|
+
* disabled with its plugin, or gated off for the turn.
|
|
1962
|
+
*
|
|
1931
1963
|
* Injectors returning `null` are omitted from the result. The returned array
|
|
1932
1964
|
* preserves ascending-`order` sort so downstream callers (notably
|
|
1933
1965
|
* {@link applyRuntimeInjections}) can group blocks by `placement` and apply
|
|
@@ -1938,16 +1970,21 @@ async function collectInjectorBlocks(
|
|
|
1938
1970
|
runMessages?: Message[],
|
|
1939
1971
|
): Promise<InjectionBlock[]> {
|
|
1940
1972
|
const out: InjectionBlock[] = [];
|
|
1973
|
+
let injectorCtx = ctx;
|
|
1941
1974
|
for (const injector of getRegisteredInjectors()) {
|
|
1942
1975
|
const block = SELF_INSTRUMENTED_INJECTORS.has(injector.name)
|
|
1943
|
-
? await injector.produce(
|
|
1976
|
+
? await injector.produce(injectorCtx, runMessages)
|
|
1944
1977
|
: await timeLatencySubSpan(
|
|
1945
1978
|
`injector:${injector.name}`,
|
|
1946
1979
|
`Injector: ${injector.name}`,
|
|
1947
|
-
() => injector.produce(
|
|
1980
|
+
() => injector.produce(injectorCtx, runMessages),
|
|
1948
1981
|
);
|
|
1949
|
-
if (block) {
|
|
1950
|
-
|
|
1982
|
+
if (!block) {
|
|
1983
|
+
continue;
|
|
1984
|
+
}
|
|
1985
|
+
out.push(block);
|
|
1986
|
+
if (replacesRunMessages(block)) {
|
|
1987
|
+
injectorCtx = { ...injectorCtx, replacesRunMessages: true };
|
|
1951
1988
|
}
|
|
1952
1989
|
}
|
|
1953
1990
|
return out;
|
|
@@ -2035,6 +2072,10 @@ function applyInjectionBlock(
|
|
|
2035
2072
|
}
|
|
2036
2073
|
|
|
2037
2074
|
const textBlock = { type: "text" as const, text: block.text };
|
|
2075
|
+
if (block.id === MEMORY_V3_BLOCK_ID) {
|
|
2076
|
+
// The prune valve's live strip owns v3 blocks by object identity.
|
|
2077
|
+
markV3LiveBlock(textBlock);
|
|
2078
|
+
}
|
|
2038
2079
|
|
|
2039
2080
|
switch (placement) {
|
|
2040
2081
|
case "prepend-user-tail":
|
|
@@ -2237,6 +2278,19 @@ export interface RuntimeInjectionOptions {
|
|
|
2237
2278
|
* site when omitted.
|
|
2238
2279
|
*/
|
|
2239
2280
|
callSite?: LLMCallSite;
|
|
2281
|
+
/**
|
|
2282
|
+
* True when this assembly re-applies injections onto a continuation
|
|
2283
|
+
* history mid-turn (the post-compaction hook, which also serves overflow
|
|
2284
|
+
* re-entry). Such an assembly's blocks live in memory only: no caller
|
|
2285
|
+
* persists them, and every message they attach to predates the
|
|
2286
|
+
* compaction, whose `historyStrippedAt` marker keeps `loadFromDb` from
|
|
2287
|
+
* rehydrating metadata on it. The memory-v3 sections injector's residency
|
|
2288
|
+
* commit (`MEMORY_V3_COMMIT_META_KEY`) is therefore not invoked: a section
|
|
2289
|
+
* the store claimed here would have no persisted body after a restart, so
|
|
2290
|
+
* the injector would emit only a pointer for it. The injector attaches the
|
|
2291
|
+
* commit to the turn's first produce alone, so the two sites agree.
|
|
2292
|
+
*/
|
|
2293
|
+
reinjection?: boolean;
|
|
2240
2294
|
}
|
|
2241
2295
|
|
|
2242
2296
|
/**
|
|
@@ -2275,7 +2329,14 @@ function fallbackTurnTrust(
|
|
|
2275
2329
|
* tail. When replacement fires, re-prepend any memory-prefix blocks
|
|
2276
2330
|
* that `graphMemory.prepareMemory` had attached to the original tail —
|
|
2277
2331
|
* the Slack transcript is rendered fresh from persisted rows and
|
|
2278
|
-
* carries no memory prefix of its own.
|
|
2332
|
+
* carries no memory prefix of its own. Every injector after the
|
|
2333
|
+
* replacing one was told that the replacement will fire
|
|
2334
|
+
* (`replacesRunMessages` on its turn context, set by the chain walker
|
|
2335
|
+
* in step 2 as the replacing block is produced), and the memory-v3
|
|
2336
|
+
* block then attaches to the replaced tail in memory only (step 4); a
|
|
2337
|
+
* memory-v3 block the original tail already carried (a retry's anchor)
|
|
2338
|
+
* is left off the transcript in that case, so the fresh render is the
|
|
2339
|
+
* prompt's single copy of each selected section.
|
|
2279
2340
|
* 4. Apply the chain's `"after-memory-prefix"` blocks in ascending
|
|
2280
2341
|
* `order`. This runs BEFORE step 5's hardcoded prepends so the
|
|
2281
2342
|
* memory-prefix counter sees only the memory blocks on the tail —
|
|
@@ -2429,7 +2490,6 @@ export async function applyRuntimeInjections(
|
|
|
2429
2490
|
liveConversation?.slackContextCompactionWatermarkTs,
|
|
2430
2491
|
})
|
|
2431
2492
|
: null;
|
|
2432
|
-
|
|
2433
2493
|
// Assemble the per-turn TurnContext handed to the injector chain. The
|
|
2434
2494
|
// turn-identity fields come from `options` when supplied; `requestId` is the
|
|
2435
2495
|
// only one the caller must provide, since the other three are recovered from
|
|
@@ -2511,7 +2571,7 @@ export async function applyRuntimeInjections(
|
|
|
2511
2571
|
let pkbSystemReminderCaptured: string | undefined;
|
|
2512
2572
|
let memoryV2StaticCaptured: string | undefined;
|
|
2513
2573
|
let memoryV3Captured: string | undefined;
|
|
2514
|
-
let
|
|
2574
|
+
let memoryV3PointerCaptured: string | undefined;
|
|
2515
2575
|
let backgroundTurnCaptured: string | undefined;
|
|
2516
2576
|
let channelCapabilitiesCaptured: string | undefined;
|
|
2517
2577
|
let nonInteractiveContextCaptured: string | undefined;
|
|
@@ -2541,29 +2601,14 @@ export async function applyRuntimeInjections(
|
|
|
2541
2601
|
case "background-turn":
|
|
2542
2602
|
backgroundTurnCaptured = block.text;
|
|
2543
2603
|
break;
|
|
2544
|
-
case MEMORY_V3_BLOCK_ID:
|
|
2545
|
-
//
|
|
2546
|
-
//
|
|
2547
|
-
//
|
|
2548
|
-
// nothing is captured for persistence either.
|
|
2549
|
-
if (block.text.length > 0) {
|
|
2550
|
-
memoryV3Captured = unwrapMemoryBlock(block.text);
|
|
2551
|
-
}
|
|
2552
|
-
// Attachment is guaranteed from here (user tail — the gate this
|
|
2553
|
-
// capture loop runs under), so commit the injector's deferred
|
|
2554
|
-
// everInjected-store write. On a non-user tail the block silently
|
|
2555
|
-
// no-ops in `applyInjectionBlock`, and skipping the commit keeps
|
|
2556
|
-
// the store from claiming cards that never attached (which would
|
|
2557
|
-
// suppress them until compaction).
|
|
2558
|
-
const commit = block.meta?.[MEMORY_V3_COMMIT_META_KEY];
|
|
2559
|
-
if (typeof commit === "function") {
|
|
2560
|
-
(commit as () => void)();
|
|
2561
|
-
}
|
|
2604
|
+
case MEMORY_V3_BLOCK_ID:
|
|
2605
|
+
// Captured and committed at its Step 2 splice, where the block's
|
|
2606
|
+
// place on the tail (merged into a retried anchor's frozen block
|
|
2607
|
+
// or spliced as its own) is decided.
|
|
2562
2608
|
break;
|
|
2563
|
-
|
|
2564
|
-
case MEMORY_V3_SPOTLIGHT_BLOCK_ID:
|
|
2609
|
+
case MEMORY_V3_POINTER_BLOCK_ID:
|
|
2565
2610
|
if (block.text.length > 0) {
|
|
2566
|
-
|
|
2611
|
+
memoryV3PointerCaptured = block.text;
|
|
2567
2612
|
}
|
|
2568
2613
|
break;
|
|
2569
2614
|
}
|
|
@@ -2584,41 +2629,63 @@ export async function applyRuntimeInjections(
|
|
|
2584
2629
|
? injectorChainPieces.join("\n\n")
|
|
2585
2630
|
: undefined;
|
|
2586
2631
|
|
|
2587
|
-
// ── Step 0: tail
|
|
2632
|
+
// ── Step 0: tail pointer strip + tombstone strip + v2 tail suppression ──
|
|
2588
2633
|
//
|
|
2589
|
-
//
|
|
2590
|
-
//
|
|
2591
|
-
//
|
|
2592
|
-
//
|
|
2593
|
-
//
|
|
2594
|
-
//
|
|
2595
|
-
//
|
|
2634
|
+
// Pointer strip (tail only): mid-turn re-entry and post-compact can hand
|
|
2635
|
+
// back a tail that already carries this turn's `<memory_pointer>`. Strip
|
|
2636
|
+
// that leftover from the tail so Step 2 splices a single fresh copy.
|
|
2637
|
+
// Historical user messages keep the pointer they were sent with, so the
|
|
2638
|
+
// provider prefix through those messages stays byte-identical. Frozen
|
|
2639
|
+
// `<memory>` section blocks are untouched. A legacy `<memory_spotlight>`
|
|
2640
|
+
// that a row persisted by an earlier build rehydrated onto the tail is
|
|
2641
|
+
// stripped the same way (that build tail-stripped it too). With the v3
|
|
2642
|
+
// flag off no pointer blocks exist and this is a content no-op.
|
|
2596
2643
|
let runMessagesForAssembly = stripTailUserTextBlocksByPrefix(runMessages, [
|
|
2597
|
-
|
|
2644
|
+
MEMORY_POINTER_MATCHER,
|
|
2645
|
+
LEGACY_MEMORY_SPOTLIGHT_MATCHER,
|
|
2598
2646
|
]);
|
|
2599
2647
|
|
|
2648
|
+
// Tombstone strip (v3-owned blocks, every turn): the prune valve strips
|
|
2649
|
+
// the sections it tombstones from the live history it is handed, but it
|
|
2650
|
+
// runs on a timer while the turn that scheduled it may still be in
|
|
2651
|
+
// flight, against a history that turn's block has not folded back into.
|
|
2652
|
+
// A section pruned on the turn that injected it therefore rides back in
|
|
2653
|
+
// untouched, and the valve does not run again while the footprint stays
|
|
2654
|
+
// under the cap. Applying the store's full tombstone set (with the
|
|
2655
|
+
// newest-copy rule) to the owned blocks here, the filter rehydration
|
|
2656
|
+
// applies on load, converges the live history to the store by the next
|
|
2657
|
+
// assembly whenever the valve ran. In place on the shared message
|
|
2658
|
+
// objects, so the fold-back keeps it; idempotent and a no-op below the
|
|
2659
|
+
// cap. Ownership is by identity (`isV3LiveBlock`), so v2 blocks and
|
|
2660
|
+
// pre-cutover blocks are never touched.
|
|
2661
|
+
const memoryV3Live = isMemoryV3Live(getConfig());
|
|
2662
|
+
if (memoryV3Live) {
|
|
2663
|
+
stripPrunedSectionsFromMessages(
|
|
2664
|
+
runMessagesForAssembly,
|
|
2665
|
+
getPrunedSections(conversationId),
|
|
2666
|
+
);
|
|
2667
|
+
}
|
|
2668
|
+
|
|
2600
2669
|
// v2 suppression: when `memory.v3.live` is on AND the v3 injector
|
|
2601
2670
|
// produced a block this turn (possibly empty-text on an all-repeat turn), v3
|
|
2602
2671
|
// owns the `<memory>` layer. v2's `prepareMemory` already prepended its own
|
|
2603
2672
|
// fresh `<memory>` block to the tail user message — strip the TAIL's v2
|
|
2604
2673
|
// dynamic prefix only, so the v3 `after-memory-prefix` block (Step 2) lands
|
|
2605
2674
|
// at the top of the tail with no v2 prefix ahead of it. Historical user
|
|
2606
|
-
// messages keep their memory blocks byte-identical: frozen v3
|
|
2607
|
-
// from prior turns AND pre-cutover v2 blocks both ride the cached
|
|
2608
|
-
//
|
|
2609
|
-
// strip discriminates v2's dynamic block by IDENTITY ({@link
|
|
2675
|
+
// messages keep their memory blocks byte-identical: frozen v3 section
|
|
2676
|
+
// blocks from prior turns AND pre-cutover v2 blocks both ride the cached
|
|
2677
|
+
// prefix. The strip discriminates v2's dynamic block by IDENTITY ({@link
|
|
2610
2678
|
// stripTailV2DynamicMemoryPrefix}): the live graph handle holds the exact
|
|
2611
2679
|
// text the wiring layer prepended this turn, so a re-entry tail's
|
|
2612
|
-
// just-frozen v3
|
|
2680
|
+
// just-frozen v3 section block (and the `<info>` static block) survive even
|
|
2613
2681
|
// though v2 and v3 blocks share identical wrapper + header bytes — the v2
|
|
2614
2682
|
// prefix this strip exists to remove was already stripped on first entry.
|
|
2615
2683
|
// Keyed off the v3 block being present (not the flag alone) so a v3 failure
|
|
2616
2684
|
// (`produce()` → null) leaves v2's block intact — fallback rather than a
|
|
2617
2685
|
// memory-less turn. Idempotent: re-injection sites that already stripped
|
|
2618
2686
|
// see no change. Flag off → bit-for-bit identical to the v2 path.
|
|
2619
|
-
const suppressV2MemoryForV3 = isMemoryV3Live(getConfig());
|
|
2620
2687
|
const v3ProducedBlock = afterMemory.some((b) => b.id === MEMORY_V3_BLOCK_ID);
|
|
2621
|
-
const memoryV3Active =
|
|
2688
|
+
const memoryV3Active = memoryV3Live && v3ProducedBlock;
|
|
2622
2689
|
if (memoryV3Active) {
|
|
2623
2690
|
const v2DynamicText =
|
|
2624
2691
|
getLiveGraphMemory(conversationId)?.lastInjectedBlockText ?? null;
|
|
@@ -2631,15 +2698,25 @@ export async function applyRuntimeInjections(
|
|
|
2631
2698
|
let result = runMessagesForAssembly;
|
|
2632
2699
|
|
|
2633
2700
|
// ── Step 1: Slack chronological replacement (chain "replace" block) ──
|
|
2634
|
-
|
|
2701
|
+
let historyReplaced = false;
|
|
2702
|
+
if (replaceBlock && replacesRunMessages(replaceBlock)) {
|
|
2703
|
+
historyReplaced = true;
|
|
2635
2704
|
// `graphMemory.prepareMemory` prepends a `<memory __injected>` block
|
|
2636
2705
|
// (and any memory-image groups) to the last user message before
|
|
2637
2706
|
// runtime assembly runs. The Slack transcript is freshly rendered
|
|
2638
2707
|
// from persisted rows and has no such prefix, so swap it in and then
|
|
2639
|
-
// re-prepend the captured prefix onto the new tail user message.
|
|
2708
|
+
// re-prepend the captured prefix onto the new tail user message. A
|
|
2709
|
+
// v3-owned block on that tail (the first run's frozen block, rehydrated
|
|
2710
|
+
// onto the anchor a retry re-runs) is left behind whenever v3 produced
|
|
2711
|
+
// a block for this assembly: the sections injector rendered every
|
|
2712
|
+
// selection afresh for the replacement, resident ones included, so
|
|
2713
|
+
// carrying the anchor's block as well would put each re-selected
|
|
2714
|
+
// section in the prompt twice. With no v3 block this turn the anchor's
|
|
2715
|
+
// block is carried as the turn's only memory, the fallback the v2 tail
|
|
2716
|
+
// strip above also keeps.
|
|
2640
2717
|
const carriedMemoryBlocks = extractMemoryPrefixBlocks(
|
|
2641
2718
|
runMessagesForAssembly,
|
|
2642
|
-
);
|
|
2719
|
+
).filter((block) => !(memoryV3Active && isV3LiveBlock(block)));
|
|
2643
2720
|
result = replaceBlock.messagesOverride;
|
|
2644
2721
|
if (carriedMemoryBlocks.length > 0) {
|
|
2645
2722
|
const slackTail = result[result.length - 1];
|
|
@@ -2666,8 +2743,53 @@ export async function applyRuntimeInjections(
|
|
|
2666
2743
|
// Ascending `order`: each splice lands at the memory-prefix boundary,
|
|
2667
2744
|
// pushing any previously-spliced block one slot further from memory.
|
|
2668
2745
|
// So higher-`order` blocks end up closer to the memory prefix.
|
|
2746
|
+
//
|
|
2747
|
+
// The v3 frozen section block is captured here, UNWRAPPED (the v2
|
|
2748
|
+
// `memoryInjectedBlock` contract; rehydration re-wraps on use), and its
|
|
2749
|
+
// deferred section-store commit runs here, once attachment is certain: a
|
|
2750
|
+
// user tail (on any other tail `applyInjectionBlock` no-ops the block, and
|
|
2751
|
+
// a commit would claim sections that never attached), a block carrying a
|
|
2752
|
+
// commit, and not a re-injection assembly (`options.reinjection`, whose
|
|
2753
|
+
// block is never persisted). Capture and commit go together: a block
|
|
2754
|
+
// without a commit (a re-entry, or a turn whose history Step 1 replaced)
|
|
2755
|
+
// rides the tail in memory only and is never persisted or claimed. A tail
|
|
2756
|
+
// that already carries a v3 block (a turn re-run onto its original anchor
|
|
2757
|
+
// row, `/conversations/:id/retry`) takes the new entries by merge, or, for
|
|
2758
|
+
// a legacy-format anchor block, carries the new block in memory only
|
|
2759
|
+
// (`AnchorBlockMerge` in `v3/prune.ts`). An empty-text block (all-repeat
|
|
2760
|
+
// turn) attaches nothing and captures nothing. The partition and commit
|
|
2761
|
+
// rules live in `plugins/defaults/memory/v3/injector.ts`.
|
|
2669
2762
|
for (const block of afterMemory) {
|
|
2670
|
-
|
|
2763
|
+
if (block.id !== MEMORY_V3_BLOCK_ID) {
|
|
2764
|
+
result = applyInjectionBlock(result, block);
|
|
2765
|
+
continue;
|
|
2766
|
+
}
|
|
2767
|
+
const tail = result[result.length - 1];
|
|
2768
|
+
if (!tail || tail.role !== "user") {
|
|
2769
|
+
continue;
|
|
2770
|
+
}
|
|
2771
|
+
const commit = block.meta?.[MEMORY_V3_COMMIT_META_KEY];
|
|
2772
|
+
if (historyReplaced || typeof commit !== "function") {
|
|
2773
|
+
result = applyInjectionBlock(result, block);
|
|
2774
|
+
continue;
|
|
2775
|
+
}
|
|
2776
|
+
if (block.text.length > 0) {
|
|
2777
|
+
const merge = mergeIntoAnchorBlock(result, unwrapMemoryBlock(block.text));
|
|
2778
|
+
if (merge.kind === "legacy") {
|
|
2779
|
+
result = applyInjectionBlock(result, block);
|
|
2780
|
+
continue;
|
|
2781
|
+
}
|
|
2782
|
+
if (merge.kind === "merged") {
|
|
2783
|
+
result = merge.messages;
|
|
2784
|
+
memoryV3Captured = merge.inner;
|
|
2785
|
+
} else {
|
|
2786
|
+
result = applyInjectionBlock(result, block);
|
|
2787
|
+
memoryV3Captured = unwrapMemoryBlock(block.text);
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
if (!options.reinjection) {
|
|
2791
|
+
(commit as () => void)();
|
|
2792
|
+
}
|
|
2671
2793
|
}
|
|
2672
2794
|
|
|
2673
2795
|
// ── Step 3: hardcoded branches that stayed outside the injector chain ──
|
|
@@ -2802,7 +2924,7 @@ export async function applyRuntimeInjections(
|
|
|
2802
2924
|
pkbContextBlock: pkbContextCaptured,
|
|
2803
2925
|
memoryV2StaticBlock: memoryV2StaticCaptured,
|
|
2804
2926
|
memoryV3InjectedBlock: memoryV3Captured,
|
|
2805
|
-
|
|
2927
|
+
memoryV3PointerBlock: memoryV3PointerCaptured,
|
|
2806
2928
|
backgroundTurnBlock: backgroundTurnCaptured,
|
|
2807
2929
|
channelCapabilitiesBlock: channelCapabilitiesCaptured,
|
|
2808
2930
|
nonInteractiveContextBlock: nonInteractiveContextCaptured,
|
|
@@ -54,6 +54,7 @@ import {
|
|
|
54
54
|
isActivationMomentParam,
|
|
55
55
|
} from "../telemetry/activation-funnel.js";
|
|
56
56
|
import { resolveAppId } from "../tools/apps/resolve-app-id.js";
|
|
57
|
+
import { POINT_AT_PROXY_TOOL } from "../tools/computer-use/skill-proxy-bridge.js";
|
|
57
58
|
import type { ToolExecutionResult } from "../tools/types.js";
|
|
58
59
|
import { getLogger } from "../util/logger.js";
|
|
59
60
|
import { isPlainObject } from "../util/object.js";
|
|
@@ -68,6 +69,7 @@ import {
|
|
|
68
69
|
type SurfaceStateEntry,
|
|
69
70
|
} from "./conversation-surface-state.js";
|
|
70
71
|
import type { HostCuProxy } from "./host-cu-proxy.js";
|
|
72
|
+
import { resolveHostCuTarget } from "./host-cu-target.js";
|
|
71
73
|
import type {
|
|
72
74
|
AnySurfaceData,
|
|
73
75
|
CardSurfaceData,
|
|
@@ -87,6 +89,7 @@ import { INTERACTIVE_SURFACE_TYPES } from "./message-protocol.js";
|
|
|
87
89
|
import { isRowVisibleToUntrustedActor } from "./message-provenance.js";
|
|
88
90
|
import type { TrustContext } from "./trust-context-types.js";
|
|
89
91
|
import { restingTrust } from "./trust-context-types.js";
|
|
92
|
+
import { turnActorPrincipalId } from "./turn-actor.js";
|
|
90
93
|
export {
|
|
91
94
|
buildSurfaceShowPair,
|
|
92
95
|
type CurrentTurnSurface,
|
|
@@ -1800,13 +1803,19 @@ function maybeEmitActivationMoment(ctx: Conversation, surfaceId: string): void {
|
|
|
1800
1803
|
recordActivationMoment(ctx, moment);
|
|
1801
1804
|
}
|
|
1802
1805
|
|
|
1806
|
+
/** The action result for an enqueue the message queue refused. */
|
|
1807
|
+
const QUEUE_FULL_RESULT: SurfaceActionResult = {
|
|
1808
|
+
accepted: false,
|
|
1809
|
+
error: "queue_full",
|
|
1810
|
+
};
|
|
1811
|
+
|
|
1803
1812
|
/**
|
|
1804
1813
|
* Record a surface action the message queue refused.
|
|
1805
1814
|
*
|
|
1806
|
-
* The
|
|
1807
|
-
*
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1815
|
+
* The rejection reaches the client as a failed submit, so the card stays
|
|
1816
|
+
* answerable and nothing is marked completed. Nothing else on this path logs,
|
|
1817
|
+
* so without this a saturated queue leaves no trace of which actions it
|
|
1818
|
+
* turned away.
|
|
1810
1819
|
*/
|
|
1811
1820
|
function logSurfaceActionRejected(
|
|
1812
1821
|
ctx: Conversation,
|
|
@@ -2247,7 +2256,7 @@ export async function handleSurfaceAction(
|
|
|
2247
2256
|
if (result.rejected) {
|
|
2248
2257
|
ctx.surfaceActionRequestIds.delete(requestId);
|
|
2249
2258
|
logSurfaceActionRejected(ctx, surfaceId, actionId, stored?.surfaceType);
|
|
2250
|
-
return;
|
|
2259
|
+
return QUEUE_FULL_RESULT;
|
|
2251
2260
|
}
|
|
2252
2261
|
|
|
2253
2262
|
// Terminal user commit accepted — record the activation milestone if this
|
|
@@ -2500,7 +2509,7 @@ export async function handleSurfaceAction(
|
|
|
2500
2509
|
if (result.rejected) {
|
|
2501
2510
|
ctx.surfaceActionRequestIds.delete(requestId);
|
|
2502
2511
|
logSurfaceActionRejected(ctx, surfaceId, actionId, pending.surfaceType);
|
|
2503
|
-
return;
|
|
2512
|
+
return QUEUE_FULL_RESULT;
|
|
2504
2513
|
}
|
|
2505
2514
|
|
|
2506
2515
|
// Terminal user commit accepted — record the activation milestone if this
|
|
@@ -2990,61 +2999,25 @@ export async function surfaceProxyResolver(
|
|
|
2990
2999
|
// validate at the tool-resolution layer for the same reason. The proxy
|
|
2991
3000
|
// re-checks same-user (single authoritative gate); using the shared
|
|
2992
3001
|
// helper keeps log payload and error wording identical at both layers.
|
|
2993
|
-
const sourceActorPrincipalId =
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
content: `No connected client with id '${targetClientId}'. Run \`assistant clients list --capability host_cu\` to see available clients.`,
|
|
3002
|
-
isError: true,
|
|
3003
|
-
};
|
|
3004
|
-
}
|
|
3005
|
-
if (!client.capabilities.includes("host_cu")) {
|
|
3006
|
-
return {
|
|
3007
|
-
content: `Client '${targetClientId}' does not support host_cu. Run \`assistant clients list --capability host_cu\` to see available clients.`,
|
|
3008
|
-
isError: true,
|
|
3009
|
-
};
|
|
3010
|
-
}
|
|
3011
|
-
const rejection = enforceSameActorOrErrorResult({
|
|
3012
|
-
hub: assistantEventHub,
|
|
3013
|
-
sourceActorPrincipalId,
|
|
3014
|
-
targetClientId,
|
|
3015
|
-
op: "host_cu",
|
|
3016
|
-
});
|
|
3017
|
-
if (rejection) {
|
|
3018
|
-
return rejection;
|
|
3019
|
-
}
|
|
3002
|
+
const sourceActorPrincipalId = turnActorPrincipalId(ctx);
|
|
3003
|
+
const target = resolveHostCuTarget({
|
|
3004
|
+
toolName,
|
|
3005
|
+
targetClientId,
|
|
3006
|
+
sourceActorPrincipalId,
|
|
3007
|
+
});
|
|
3008
|
+
if (target.kind === "error") {
|
|
3009
|
+
return target.result;
|
|
3020
3010
|
}
|
|
3011
|
+
targetClientId = target.targetClientId;
|
|
3021
3012
|
|
|
3022
|
-
//
|
|
3023
|
-
//
|
|
3024
|
-
//
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
sourceActorPrincipalId,
|
|
3030
|
-
});
|
|
3031
|
-
if (resolved.kind === "ambiguous") {
|
|
3032
|
-
return ambiguousSameUserError("host_cu");
|
|
3033
|
-
}
|
|
3034
|
-
if (resolved.kind === "match") {
|
|
3035
|
-
targetClientId = resolved.clientId;
|
|
3036
|
-
} else if (
|
|
3037
|
-
assistantEventHub.listClientsByCapability("host_cu").length > 0
|
|
3038
|
-
) {
|
|
3039
|
-
return {
|
|
3040
|
-
content:
|
|
3041
|
-
"Computer use is not available for the current actor. Connect a host_cu-capable client as the same user.",
|
|
3042
|
-
isError: true,
|
|
3043
|
-
};
|
|
3044
|
-
}
|
|
3013
|
+
// Pointing at the screen is not a computer-use step. It drives nothing
|
|
3014
|
+
// and the user does the acting, so counting it against
|
|
3015
|
+
// `maxStepsPerSession` would let a long walkthrough exhaust a budget
|
|
3016
|
+
// meant for actions and be told to call `computer_use_done`, which has
|
|
3017
|
+
// nothing to do with what it was doing.
|
|
3018
|
+
if (toolName !== POINT_AT_PROXY_TOOL) {
|
|
3019
|
+
hostCuProxy.recordAction(toolName, input, reasoning);
|
|
3045
3020
|
}
|
|
3046
|
-
|
|
3047
|
-
hostCuProxy.recordAction(toolName, input, reasoning);
|
|
3048
3021
|
return hostCuProxy.request(
|
|
3049
3022
|
toolName,
|
|
3050
3023
|
input,
|
|
@@ -3101,10 +3074,7 @@ export async function surfaceProxyResolver(
|
|
|
3101
3074
|
? input.target_client_id
|
|
3102
3075
|
: undefined;
|
|
3103
3076
|
|
|
3104
|
-
const sourceActorPrincipalId =
|
|
3105
|
-
ctx.currentTurnSourceActorPrincipalId ??
|
|
3106
|
-
ctx.currentTurnAuthContext?.actorPrincipalId ??
|
|
3107
|
-
ctx.authContext?.actorPrincipalId;
|
|
3077
|
+
const sourceActorPrincipalId = turnActorPrincipalId(ctx);
|
|
3108
3078
|
if (targetClientId != null) {
|
|
3109
3079
|
const client = assistantEventHub.getClientById(targetClientId);
|
|
3110
3080
|
if (!client) {
|