@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
|
@@ -29,6 +29,59 @@ describe("PROVIDER_SEED_DATA managed mode wiring", () => {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
+
test("figma requests only scopes an app on any plan can grant", () => {
|
|
33
|
+
const figma = PROVIDER_SEED_DATA.figma;
|
|
34
|
+
expect(figma).toBeDefined();
|
|
35
|
+
expect(figma.managedServiceConfigKey).toBe("figma-oauth");
|
|
36
|
+
expect("figma-oauth" in ServicesSchema.shape).toBe(true);
|
|
37
|
+
|
|
38
|
+
// Figma rejects the whole authorization request when the app cannot grant
|
|
39
|
+
// one of the requested scopes, so the plan-gated and deprecated scopes stay
|
|
40
|
+
// in availableScopes for apps that have them and out of the defaults.
|
|
41
|
+
const gated = figma.defaultScopes.filter(
|
|
42
|
+
(scope) =>
|
|
43
|
+
scope.startsWith("org:") ||
|
|
44
|
+
scope.startsWith("file_variables:") ||
|
|
45
|
+
scope.startsWith("webhooks:") ||
|
|
46
|
+
scope === "library_analytics:read" ||
|
|
47
|
+
scope === "files:read",
|
|
48
|
+
);
|
|
49
|
+
expect(gated).toEqual([]);
|
|
50
|
+
|
|
51
|
+
// `selections:read` is documented by Figma but not offered in the app's
|
|
52
|
+
// OAuth scope list, so requesting it fails the whole authorization. It
|
|
53
|
+
// stays in availableScopes for BYO apps that do have it.
|
|
54
|
+
expect(figma.defaultScopes).not.toContain("selections:read");
|
|
55
|
+
const availableScopes = figma.availableScopes;
|
|
56
|
+
expect(Array.isArray(availableScopes)).toBe(true);
|
|
57
|
+
if (Array.isArray(availableScopes)) {
|
|
58
|
+
expect(availableScopes.map(({ scope }) => scope)).toContain(
|
|
59
|
+
"selections:read",
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// GET /v1/me backs both the ping and the identity label.
|
|
64
|
+
expect(figma.defaultScopes).toContain("current_user:read");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test("structured availableScopes cover every default scope", () => {
|
|
68
|
+
// A default scope absent from availableScopes is a typo the provider only
|
|
69
|
+
// reports at authorization time, by rejecting the request.
|
|
70
|
+
const offenders: Array<{ provider: string; missing: string[] }> = [];
|
|
71
|
+
for (const [provider, seed] of Object.entries(PROVIDER_SEED_DATA)) {
|
|
72
|
+
const available = seed.availableScopes;
|
|
73
|
+
if (!Array.isArray(available)) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const offered = new Set(available.map(({ scope }) => scope));
|
|
77
|
+
const missing = seed.defaultScopes.filter((scope) => !offered.has(scope));
|
|
78
|
+
if (missing.length > 0) {
|
|
79
|
+
offenders.push({ provider, missing });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
expect(offenders).toEqual([]);
|
|
83
|
+
});
|
|
84
|
+
|
|
32
85
|
test("google base URL is host-only so relative paths select the product", () => {
|
|
33
86
|
// A host-only base URL (no product path) lets a relative request path pick
|
|
34
87
|
// the Google product — Gmail (/gmail/v1/...), Calendar (/calendar/v3/...),
|
|
@@ -39,6 +92,35 @@ describe("PROVIDER_SEED_DATA managed mode wiring", () => {
|
|
|
39
92
|
);
|
|
40
93
|
});
|
|
41
94
|
|
|
95
|
+
test("Link does not ship a Stripe publishable key to BYO installs", () => {
|
|
96
|
+
// Link's authorize endpoint needs a `key` param naming the Stripe account
|
|
97
|
+
// behind the client_id. Vellum's belongs only in the platform registry,
|
|
98
|
+
// where it pairs with the platform's own client. Seeding it here would
|
|
99
|
+
// send our merchant identity from every self-hosted install.
|
|
100
|
+
const link = PROVIDER_SEED_DATA.stripe_link;
|
|
101
|
+
expect(link).toBeDefined();
|
|
102
|
+
expect(link.managedServiceConfigKey).toBe("stripe-link-oauth");
|
|
103
|
+
expect(link.authorizeParams).toBeUndefined();
|
|
104
|
+
expect(JSON.stringify(link)).not.toContain("pk_live_");
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test("Link identity falls back to phone when a wallet has no email", () => {
|
|
108
|
+
// /userinfo returns no id field, so email is the account handle and phone
|
|
109
|
+
// is the only backstop. Losing these paths breaks connection keying.
|
|
110
|
+
const link = PROVIDER_SEED_DATA.stripe_link;
|
|
111
|
+
expect(link.identityUrl).toBe("https://api.link.com/userinfo");
|
|
112
|
+
expect(link.identityResponsePaths).toEqual(["email", "phone"]);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test("figma ships behind the figma-oauth flag", () => {
|
|
116
|
+
// The provider is hidden from the providers list and the connect routes
|
|
117
|
+
// until the flag is enabled. Dropping featureFlag here would make Figma
|
|
118
|
+
// visible to every install with no other test noticing.
|
|
119
|
+
const figma = PROVIDER_SEED_DATA.figma;
|
|
120
|
+
expect(figma).toBeDefined();
|
|
121
|
+
expect(figma.featureFlag).toBe("figma-oauth");
|
|
122
|
+
});
|
|
123
|
+
|
|
42
124
|
test("every managedServiceConfigKey resolves to a ServicesSchema key", () => {
|
|
43
125
|
// Cross-repo invariant: a provider with managedServiceConfigKey but no
|
|
44
126
|
// matching ServicesSchema entry silently falls back to BYO mode in
|
|
@@ -969,10 +969,143 @@ export const PROVIDER_SEED_DATA: Record<
|
|
|
969
969
|
dashboardUrl: "https://www.figma.com/developers/apps",
|
|
970
970
|
clientIdPlaceholder: null,
|
|
971
971
|
logoUrl: "https://cdn.simpleicons.org/figma",
|
|
972
|
-
|
|
973
|
-
|
|
972
|
+
// Figma access tokens expire after 90 days and a refresh token is issued
|
|
973
|
+
// with every grant, so the refresh endpoint is wired up. Both the token
|
|
974
|
+
// and refresh endpoints authenticate the client with HTTP Basic
|
|
975
|
+
// (client_secret_basic), not form-encoded credentials.
|
|
976
|
+
refreshUrl: "https://api.figma.com/v1/oauth/refresh",
|
|
977
|
+
// Granular scopes only. The legacy `files:read` scope is deprecated by
|
|
978
|
+
// Figma in favour of the narrower `file_*` scopes and is deliberately
|
|
979
|
+
// absent here; it stays in availableScopes for BYO apps that still rely
|
|
980
|
+
// on it. Enterprise-only and org-admin-only scopes (file_variables:*,
|
|
981
|
+
// library_analytics:read, org:*) are offered but not requested by
|
|
982
|
+
// default, because Figma rejects the whole authorization request if the
|
|
983
|
+
// app cannot grant a requested scope. `selections:read` is withheld for
|
|
984
|
+
// that same reason: it is not offered in the app's OAuth scope list, so
|
|
985
|
+
// requesting it would fail the entire authorization.
|
|
986
|
+
defaultScopes: [
|
|
987
|
+
"current_user:read",
|
|
988
|
+
"file_content:read",
|
|
989
|
+
"file_metadata:read",
|
|
990
|
+
"file_versions:read",
|
|
991
|
+
"file_comments:read",
|
|
992
|
+
"file_comments:write",
|
|
993
|
+
"file_dev_resources:read",
|
|
994
|
+
"file_dev_resources:write",
|
|
995
|
+
"folders:read",
|
|
996
|
+
"folder_metadata:read",
|
|
997
|
+
"library_content:read",
|
|
998
|
+
"library_assets:read",
|
|
999
|
+
"team_library_content:read",
|
|
1000
|
+
],
|
|
1001
|
+
availableScopes: [
|
|
1002
|
+
{
|
|
1003
|
+
scope: "current_user:read",
|
|
1004
|
+
description: "Read your name, email, and profile image",
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
scope: "file_content:read",
|
|
1008
|
+
description:
|
|
1009
|
+
"Read the contents of files, such as nodes and the editor type",
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
scope: "file_metadata:read",
|
|
1013
|
+
description: "Read metadata of files",
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
scope: "file_versions:read",
|
|
1017
|
+
description: "Read the version history for files you can access",
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
scope: "file_comments:read",
|
|
1021
|
+
description: "Read the comments for files",
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
scope: "file_comments:write",
|
|
1025
|
+
description: "Post and delete comments and comment reactions in files",
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
scope: "file_dev_resources:read",
|
|
1029
|
+
description: "Read dev resources in files",
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
scope: "file_dev_resources:write",
|
|
1033
|
+
description: "Write dev resources to files",
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
scope: "folders:read",
|
|
1037
|
+
description: "List folders and files in folders",
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
scope: "folder_metadata:read",
|
|
1041
|
+
description: "Read metadata of folders",
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
scope: "library_content:read",
|
|
1045
|
+
description: "Read published components and styles of files",
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
scope: "library_assets:read",
|
|
1049
|
+
description: "Read data of individual published components and styles",
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
scope: "team_library_content:read",
|
|
1053
|
+
description: "Read published components and styles of teams",
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
scope: "selections:read",
|
|
1057
|
+
description: "Read most recent selection in files you can access",
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
scope: "file_variables:read",
|
|
1061
|
+
description: "Read variables in files (Enterprise plan only)",
|
|
1062
|
+
},
|
|
1063
|
+
{
|
|
1064
|
+
scope: "file_variables:write",
|
|
1065
|
+
description:
|
|
1066
|
+
"Write variables and collections in files (Enterprise plan only)",
|
|
1067
|
+
},
|
|
1068
|
+
{
|
|
1069
|
+
scope: "library_analytics:read",
|
|
1070
|
+
description: "Read your design system analytics (Enterprise plan only)",
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
scope: "webhooks:read",
|
|
1074
|
+
description: "Read metadata of webhooks",
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
scope: "webhooks:write",
|
|
1078
|
+
description: "Create and manage webhooks",
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
scope: "org:activity_log_read",
|
|
1082
|
+
description:
|
|
1083
|
+
"Read organization activity logs (Enterprise plan, org admin only)",
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
scope: "org:ai_metering_usage_read",
|
|
1087
|
+
description:
|
|
1088
|
+
"Read organization AI usage (Enterprise plan, org admin only)",
|
|
1089
|
+
},
|
|
1090
|
+
{
|
|
1091
|
+
scope: "org:developer_log_read",
|
|
1092
|
+
description:
|
|
1093
|
+
"Read organization developer logs (Governance+, org admin only)",
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
scope: "org:discovery_read",
|
|
1097
|
+
description:
|
|
1098
|
+
"Read text event data in the organization (Governance+, org admin only)",
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
scope: "files:read",
|
|
1102
|
+
description:
|
|
1103
|
+
"Deprecated by Figma. Broad read access to files, folders, users, versions, comments, components, styles, and webhooks",
|
|
1104
|
+
},
|
|
1105
|
+
],
|
|
974
1106
|
tokenEndpointAuthMethod: "client_secret_basic",
|
|
975
1107
|
loopbackPort: 17331,
|
|
1108
|
+
managedServiceConfigKey: "figma-oauth",
|
|
976
1109
|
injectionTemplates: [
|
|
977
1110
|
{
|
|
978
1111
|
hostPattern: "api.figma.com",
|
|
@@ -983,7 +1116,11 @@ export const PROVIDER_SEED_DATA: Record<
|
|
|
983
1116
|
],
|
|
984
1117
|
appType: "App",
|
|
985
1118
|
identityUrl: "https://api.figma.com/v1/me",
|
|
986
|
-
|
|
1119
|
+
// GET /v1/me returns a flat user object: { id, handle, img_url, email }.
|
|
1120
|
+
// `id` is the stable account identifier; email is the friendlier label
|
|
1121
|
+
// with handle as the fallback.
|
|
1122
|
+
identityResponsePaths: ["email", "handle"],
|
|
1123
|
+
featureFlag: "figma-oauth",
|
|
987
1124
|
},
|
|
988
1125
|
|
|
989
1126
|
outlook: {
|
|
@@ -1131,6 +1268,67 @@ export const PROVIDER_SEED_DATA: Record<
|
|
|
1131
1268
|
},
|
|
1132
1269
|
],
|
|
1133
1270
|
},
|
|
1271
|
+
stripe_link: {
|
|
1272
|
+
provider: "stripe_link",
|
|
1273
|
+
authorizeUrl: "https://login.link.com/auth",
|
|
1274
|
+
tokenExchangeUrl: "https://login.link.com/auth/token",
|
|
1275
|
+
refreshUrl: "https://login.link.com/auth/token",
|
|
1276
|
+
revokeUrl: "https://login.link.com/auth/revoke",
|
|
1277
|
+
revokeBodyTemplate: {
|
|
1278
|
+
token: "{access_token}",
|
|
1279
|
+
token_type_hint: "access_token",
|
|
1280
|
+
},
|
|
1281
|
+
pingUrl: "https://api.link.com/userinfo",
|
|
1282
|
+
baseUrl: "https://api.link.com",
|
|
1283
|
+
displayLabel: "Link by Stripe",
|
|
1284
|
+
description: "Wallet payment methods for agent purchases",
|
|
1285
|
+
dashboardUrl: "https://dashboard.stripe.com",
|
|
1286
|
+
// Link issues OAuth clients by request rather than through a self-serve
|
|
1287
|
+
// dashboard, so there is no placeholder shape to suggest.
|
|
1288
|
+
clientIdPlaceholder: null,
|
|
1289
|
+
// Simple Icons has no Link mark (`link` 404s on the CDN), so the parent
|
|
1290
|
+
// Stripe mark stands in.
|
|
1291
|
+
logoUrl: "https://cdn.simpleicons.org/stripe",
|
|
1292
|
+
defaultScopes: ["payment_methods.agentic", "userinfo:read"],
|
|
1293
|
+
availableScopes: [
|
|
1294
|
+
{
|
|
1295
|
+
scope: "payment_methods.agentic",
|
|
1296
|
+
description:
|
|
1297
|
+
"Create single-use cards and payment tokens against the wallet",
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
scope: "userinfo:read",
|
|
1301
|
+
description: "Read the wallet owner's profile (email, name, phone)",
|
|
1302
|
+
},
|
|
1303
|
+
],
|
|
1304
|
+
tokenEndpointAuthMethod: "client_secret_post",
|
|
1305
|
+
// Link's authorize request also needs a `key` param holding the Stripe
|
|
1306
|
+
// publishable key of the account behind the OAuth client. Vellum's own
|
|
1307
|
+
// key lives in the platform registry, which is the only place it is the
|
|
1308
|
+
// right answer: it pairs with the platform's client_id. Seeding it here
|
|
1309
|
+
// would hand every self-hosted install our merchant identity to send
|
|
1310
|
+
// alongside their own client_id, so BYO is deliberately left without one.
|
|
1311
|
+
// See setupNotes.
|
|
1312
|
+
loopbackPort: 17340,
|
|
1313
|
+
managedServiceConfigKey: "stripe-link-oauth",
|
|
1314
|
+
injectionTemplates: [
|
|
1315
|
+
{
|
|
1316
|
+
hostPattern: "api.link.com",
|
|
1317
|
+
injectionType: "header",
|
|
1318
|
+
headerName: "Authorization",
|
|
1319
|
+
valuePrefix: "Bearer ",
|
|
1320
|
+
},
|
|
1321
|
+
],
|
|
1322
|
+
appType: "App",
|
|
1323
|
+
setupNotes: [
|
|
1324
|
+
"Link is available in managed mode only. Its authorize endpoint requires a `key` parameter carrying the Stripe publishable key for the account that owns the OAuth client, and a bring-your-own connection has nowhere to put one: authorizeParams is re-stamped from seed data on every startup and no CLI or API surface sets it. Use managed mode, where the platform supplies both halves.",
|
|
1325
|
+
],
|
|
1326
|
+
// /userinfo returns no id, so email is the only stable-ish handle; phone
|
|
1327
|
+
// backstops a wallet that has one but no email on file.
|
|
1328
|
+
identityUrl: "https://api.link.com/userinfo",
|
|
1329
|
+
identityResponsePaths: ["email", "phone"],
|
|
1330
|
+
featureFlag: "stripe-link-oauth",
|
|
1331
|
+
},
|
|
1134
1332
|
};
|
|
1135
1333
|
|
|
1136
1334
|
export const SEEDED_PROVIDER_KEYS = new Set(Object.keys(PROVIDER_SEED_DATA));
|
|
@@ -130,9 +130,10 @@ export function recordActivationEvent(params: {
|
|
|
130
130
|
* `telemetry/live-voice-funnel.ts` for why duration and turn count are derived
|
|
131
131
|
* from that pairing rather than carried as fields.
|
|
132
132
|
*
|
|
133
|
-
* `screen` carries the end reason on the ended event
|
|
134
|
-
*
|
|
135
|
-
* disabled or the telemetry
|
|
133
|
+
* `screen` carries the end reason on the ended event and the originating
|
|
134
|
+
* client and entry point on the started one (see `liveVoiceStartScreen`).
|
|
135
|
+
* Returns null when usage data collection is disabled or the telemetry
|
|
136
|
+
* database is unavailable.
|
|
136
137
|
*
|
|
137
138
|
* **Never throws.** These fire from `LiveVoiceSession.start()` and `.close()`,
|
|
138
139
|
* which are the user's call itself: the outbox insert raises on a telemetry DB
|
|
@@ -176,14 +177,19 @@ export function recordLiveVoiceSessionEvent(params: {
|
|
|
176
177
|
);
|
|
177
178
|
}
|
|
178
179
|
|
|
179
|
-
/**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
/**
|
|
181
|
+
* Record the "a live-voice session was attempted" milestone, with where it
|
|
182
|
+
* was attempted from.
|
|
183
|
+
*/
|
|
184
|
+
export function recordLiveVoiceSessionStarted(params: {
|
|
185
|
+
sessionId: string;
|
|
186
|
+
screen: string;
|
|
187
|
+
}): OnboardingEvent | null {
|
|
183
188
|
return recordLiveVoiceSessionEvent({
|
|
184
189
|
stepName: LIVE_VOICE_STEPS.sessionStarted.stepName,
|
|
185
190
|
stepIndex: LIVE_VOICE_STEPS.sessionStarted.stepIndex,
|
|
186
|
-
sessionId,
|
|
191
|
+
sessionId: params.sessionId,
|
|
192
|
+
screen: params.screen,
|
|
187
193
|
});
|
|
188
194
|
}
|
|
189
195
|
|
|
@@ -42,7 +42,6 @@ import { getCurrentSeq } from "../runtime/assistant-stream-state.js";
|
|
|
42
42
|
import { publishSyncInvalidation } from "../runtime/sync/sync-publisher.js";
|
|
43
43
|
import { trustClassSchema } from "../runtime/trust-class.js";
|
|
44
44
|
import { UserError } from "../util/errors.js";
|
|
45
|
-
import { safeParseRecord } from "../util/json.js";
|
|
46
45
|
import { getLogger } from "../util/logger.js";
|
|
47
46
|
import { getLogsDbPath } from "../util/logs-db-path.js";
|
|
48
47
|
import { getConversationsDir } from "../util/platform.js";
|
|
@@ -117,6 +116,7 @@ import {
|
|
|
117
116
|
} from "./job-handlers/message-lexical.js";
|
|
118
117
|
import { buildLifecycleTelemetryEvent } from "./lifecycle-events-store.js";
|
|
119
118
|
import { resolveMessageContentBlocks } from "./message-content-file.js";
|
|
119
|
+
import { mergeMessageMetadata } from "./message-metadata.js";
|
|
120
120
|
import {
|
|
121
121
|
rawAll,
|
|
122
122
|
rawExec,
|
|
@@ -417,17 +417,31 @@ export const messageMetadataSchema = z
|
|
|
417
417
|
*/
|
|
418
418
|
attachmentStoredPaths: z.record(z.string(), z.string()).optional(),
|
|
419
419
|
memoryInjectedBlock: z.string().optional(),
|
|
420
|
-
/** Memory-v3 frozen net-new
|
|
421
|
-
* of `memoryInjectedBlock`. A row carries at most one of the
|
|
422
|
-
* matches the memory plugin's
|
|
423
|
-
* as a literal here (like
|
|
424
|
-
* not import the memory
|
|
420
|
+
/** Memory-v3 frozen net-new section block (unwrapped), the v3
|
|
421
|
+
* counterpart of `memoryInjectedBlock`. A row carries at most one of the
|
|
422
|
+
* two. The key matches the memory plugin's
|
|
423
|
+
* `MEMORY_V3_INJECTED_BLOCK_METADATA_KEY`, kept as a literal here (like
|
|
424
|
+
* `memoryInjectedBlock`) so the storage schema does not import the memory
|
|
425
|
+
* feature. */
|
|
425
426
|
memoryV3InjectedBlock: z.string().optional(),
|
|
426
|
-
/**
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
427
|
+
/** Rendering format of `memoryV3InjectedBlock`, stamped by the build
|
|
428
|
+
* that persisted it and compared on read against the memory plugin's
|
|
429
|
+
* `MEMORY_V3_INJECTED_BLOCK_FORMAT`; a row carrying the block without
|
|
430
|
+
* it holds a legacy compact-card block. The key matches the plugin's
|
|
431
|
+
* `MEMORY_V3_INJECTED_BLOCK_FORMAT_METADATA_KEY`, kept as a literal here
|
|
432
|
+
* so the storage schema does not import the memory feature. */
|
|
433
|
+
memoryV3InjectedBlockFormat: z.number().optional(),
|
|
434
|
+
/** Memory-v3 per-turn `<memory_pointer>` block (wrapped). Rehydrated by
|
|
435
|
+
* `loadFromDb` so historical turns keep the pointer they were sent with.
|
|
436
|
+
* The key matches the memory plugin's
|
|
437
|
+
* `MEMORY_V3_POINTER_BLOCK_METADATA_KEY`, kept as a literal here so the
|
|
438
|
+
* storage schema does not import the memory feature. */
|
|
439
|
+
memoryV3PointerBlock: z.string().optional(),
|
|
440
|
+
/** Persisted `<memory_spotlight>` text (wrapped) from earlier builds that
|
|
441
|
+
* shipped the per-turn spotlight layer. Never written; `loadFromDb`
|
|
442
|
+
* rehydrates it verbatim as inert history so the prompts those turns
|
|
443
|
+
* were sent with stay byte-identical across the upgrade. The key matches
|
|
444
|
+
* the memory plugin's `LEGACY_MEMORY_V3_SPOTLIGHT_BLOCK_METADATA_KEY`. */
|
|
431
445
|
memoryV3SpotlightBlock: z.string().optional(),
|
|
432
446
|
turnContextBlock: z.string().optional(),
|
|
433
447
|
pkbSystemReminderBlock: z.string().optional(),
|
|
@@ -2691,6 +2705,44 @@ export function selectSightFrameCaptureTimes(
|
|
|
2691
2705
|
return captureTimes;
|
|
2692
2706
|
}
|
|
2693
2707
|
|
|
2708
|
+
/**
|
|
2709
|
+
* The newest camera frame in the conversation, by the `createdAt` of the row
|
|
2710
|
+
* that carries it, or null when no row carries one.
|
|
2711
|
+
*
|
|
2712
|
+
* The one-row form of {@link selectSightFrameCaptureTimes}, for a caller that
|
|
2713
|
+
* wants only the latest and runs on every voice turn: every stored frame stays
|
|
2714
|
+
* a row for the life of the conversation, so the full scan grows with the
|
|
2715
|
+
* call. Same narrowing and the same validation, so the two agree on what a
|
|
2716
|
+
* frame is. A row carrying several frames answers with the last attached.
|
|
2717
|
+
*/
|
|
2718
|
+
export function selectNewestSightFrameCapture(
|
|
2719
|
+
conversationId: string,
|
|
2720
|
+
): { attachmentId: string; createdAt: number } | null {
|
|
2721
|
+
const db = getDb();
|
|
2722
|
+
const row = db
|
|
2723
|
+
.select({ metadata: messages.metadata, createdAt: messages.createdAt })
|
|
2724
|
+
.from(messages)
|
|
2725
|
+
.where(
|
|
2726
|
+
and(
|
|
2727
|
+
lineageFilter(conversationId),
|
|
2728
|
+
like(messages.metadata, `%"${SIGHT_FRAME_ATTACHMENT_IDS_KEY}"%`),
|
|
2729
|
+
),
|
|
2730
|
+
)
|
|
2731
|
+
.orderBy(desc(messages.createdAt))
|
|
2732
|
+
.limit(1)
|
|
2733
|
+
.get();
|
|
2734
|
+
if (!row) {
|
|
2735
|
+
return null;
|
|
2736
|
+
}
|
|
2737
|
+
const ids = sightFrameAttachmentIdsFromMetadata(
|
|
2738
|
+
parseMessageMetadata(row.metadata),
|
|
2739
|
+
);
|
|
2740
|
+
const attachmentId = ids.at(-1);
|
|
2741
|
+
return attachmentId === undefined
|
|
2742
|
+
? null
|
|
2743
|
+
: { attachmentId, createdAt: row.createdAt };
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2694
2746
|
/**
|
|
2695
2747
|
* Count messages in a conversation that were created strictly after the
|
|
2696
2748
|
* `afterMessageId` reference message. If `afterMessageId` is `null` or empty,
|
|
@@ -4183,8 +4235,9 @@ export function finalizeMessageContent(
|
|
|
4183
4235
|
}
|
|
4184
4236
|
|
|
4185
4237
|
/**
|
|
4186
|
-
* Merge `updates` into the metadata JSON of an existing message
|
|
4187
|
-
* Reads the current metadata, shallow-merges
|
|
4238
|
+
* Merge `updates` into the metadata JSON of an existing message
|
|
4239
|
+
* ({@link mergeMessageMetadata}). Reads the current metadata, shallow-merges
|
|
4240
|
+
* the new fields, and writes back.
|
|
4188
4241
|
*/
|
|
4189
4242
|
export function updateMessageMetadata(
|
|
4190
4243
|
messageId: string,
|
|
@@ -4196,11 +4249,8 @@ export function updateMessageMetadata(
|
|
|
4196
4249
|
.from(messages)
|
|
4197
4250
|
.where(eq(messages.id, messageId))
|
|
4198
4251
|
.get();
|
|
4199
|
-
// Sanitized like the transactional sibling above: a malformed stored
|
|
4200
|
-
// envelope must not fail the update that is trying to stamp the row.
|
|
4201
|
-
const existing = row?.metadata ? safeParseRecord(row.metadata) : {};
|
|
4202
4252
|
db.update(messages)
|
|
4203
|
-
.set({ metadata:
|
|
4253
|
+
.set({ metadata: mergeMessageMetadata(row?.metadata, updates) })
|
|
4204
4254
|
.where(eq(messages.id, messageId))
|
|
4205
4255
|
.run();
|
|
4206
4256
|
}
|
|
@@ -4227,11 +4277,10 @@ export function updateMessageContentAndMetadata(
|
|
|
4227
4277
|
.from(messages)
|
|
4228
4278
|
.where(eq(messages.id, messageId))
|
|
4229
4279
|
.get();
|
|
4230
|
-
const existing = row?.metadata ? safeParseRecord(row.metadata) : {};
|
|
4231
4280
|
tx.update(messages)
|
|
4232
4281
|
.set({
|
|
4233
4282
|
content: newContent,
|
|
4234
|
-
metadata:
|
|
4283
|
+
metadata: mergeMessageMetadata(row?.metadata, metadataUpdates),
|
|
4235
4284
|
})
|
|
4236
4285
|
.where(eq(messages.id, messageId))
|
|
4237
4286
|
.run();
|
|
@@ -3,15 +3,18 @@ import { afterEach, beforeEach, describe, expect, mock, test } from "bun:test";
|
|
|
3
3
|
import type { AssistantConfig } from "../../config/types.js";
|
|
4
4
|
import {
|
|
5
5
|
clearEmbeddingBackendCache,
|
|
6
|
+
customEmbeddingSpaceIdentity,
|
|
6
7
|
embedWithBackend,
|
|
7
8
|
isEmbeddingDimensionAvailable,
|
|
8
9
|
resetLocalEmbeddingFailureState,
|
|
10
|
+
resolveBackendDimension,
|
|
9
11
|
selectEmbeddingBackend,
|
|
10
12
|
} from "./embedding-backend.js";
|
|
11
13
|
import {
|
|
12
14
|
_resetEmbeddingBillingBreaker,
|
|
13
15
|
recordBillingBlock,
|
|
14
16
|
} from "./embedding-billing-breaker.js";
|
|
17
|
+
import { OpenAIEmbeddingBackend } from "./embedding-openai.js";
|
|
15
18
|
|
|
16
19
|
const getProviderKeyAsyncMock = mock(
|
|
17
20
|
async (_provider: string): Promise<string | undefined> => undefined,
|
|
@@ -361,3 +364,162 @@ describe("managed-proxy Gemini fallback to direct key", () => {
|
|
|
361
364
|
expect(directUrl).toContain("key=direct-key");
|
|
362
365
|
});
|
|
363
366
|
});
|
|
367
|
+
|
|
368
|
+
function customConfig(overrides: {
|
|
369
|
+
baseUrl?: string;
|
|
370
|
+
customModel?: string;
|
|
371
|
+
customDimensions?: number;
|
|
372
|
+
}): AssistantConfig {
|
|
373
|
+
return {
|
|
374
|
+
memory: {
|
|
375
|
+
embeddings: {
|
|
376
|
+
provider: "custom",
|
|
377
|
+
customModel: overrides.customModel ?? "text-embedding-3-small",
|
|
378
|
+
baseUrl: overrides.baseUrl,
|
|
379
|
+
customDimensions: overrides.customDimensions,
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
} as unknown as AssistantConfig;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
describe("custom OpenAI-compatible embedding backend selection", () => {
|
|
386
|
+
afterEach(() => {
|
|
387
|
+
clearEmbeddingBackendCache();
|
|
388
|
+
getProviderKeyAsyncMock.mockReset();
|
|
389
|
+
getProviderKeyAsyncMock.mockImplementation(async () => undefined);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
test("selects a custom backend with a trimmed baseUrl", async () => {
|
|
393
|
+
getProviderKeyAsyncMock.mockImplementation(async (provider) =>
|
|
394
|
+
provider === "custom" ? "gw-key" : undefined,
|
|
395
|
+
);
|
|
396
|
+
const { backend, reason } = await selectEmbeddingBackend(
|
|
397
|
+
customConfig({
|
|
398
|
+
baseUrl: "http://127.0.0.1:4000/v1/",
|
|
399
|
+
customModel: "embed-mistral",
|
|
400
|
+
customDimensions: 1024,
|
|
401
|
+
}),
|
|
402
|
+
);
|
|
403
|
+
expect(reason).toBeNull();
|
|
404
|
+
expect(backend).toBeInstanceOf(OpenAIEmbeddingBackend);
|
|
405
|
+
expect(backend?.provider).toBe("custom");
|
|
406
|
+
expect(backend?.model).toBe("embed-mistral");
|
|
407
|
+
expect((backend as OpenAIEmbeddingBackend).baseURL).toBe(
|
|
408
|
+
"http://127.0.0.1:4000/v1",
|
|
409
|
+
);
|
|
410
|
+
expect((backend as OpenAIEmbeddingBackend).dimensions).toBe(1024);
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
test("selects a custom backend without an API key", async () => {
|
|
414
|
+
const { backend, reason } = await selectEmbeddingBackend(
|
|
415
|
+
customConfig({ baseUrl: "http://127.0.0.1:1234/v1" }),
|
|
416
|
+
);
|
|
417
|
+
expect(reason).toBeNull();
|
|
418
|
+
expect(backend?.provider).toBe("custom");
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
test("is not configured when baseUrl is missing", async () => {
|
|
422
|
+
const { backend, reason } = await selectEmbeddingBackend(customConfig({}));
|
|
423
|
+
expect(backend).toBeNull();
|
|
424
|
+
expect(reason).toMatch(/baseUrl/);
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
test("is not configured when baseUrl is not http(s)", async () => {
|
|
428
|
+
const { backend, reason } = await selectEmbeddingBackend(
|
|
429
|
+
customConfig({ baseUrl: "not-a-url" }),
|
|
430
|
+
);
|
|
431
|
+
expect(backend).toBeNull();
|
|
432
|
+
expect(reason).toMatch(/baseUrl/);
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
test("is not selected by auto even when baseUrl is set", async () => {
|
|
436
|
+
const { backend } = await selectEmbeddingBackend({
|
|
437
|
+
memory: {
|
|
438
|
+
embeddings: {
|
|
439
|
+
provider: "auto",
|
|
440
|
+
localModel: "BAAI/bge-small-en-v1.5",
|
|
441
|
+
baseUrl: "http://127.0.0.1:4000/v1",
|
|
442
|
+
customModel: "embed-mistral",
|
|
443
|
+
},
|
|
444
|
+
},
|
|
445
|
+
} as unknown as AssistantConfig);
|
|
446
|
+
expect(backend?.provider).toBe("local");
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
test("caches custom backends by baseUrl", async () => {
|
|
450
|
+
const first = await selectEmbeddingBackend(
|
|
451
|
+
customConfig({ baseUrl: "http://127.0.0.1:4000/v1" }),
|
|
452
|
+
);
|
|
453
|
+
const second = await selectEmbeddingBackend(
|
|
454
|
+
customConfig({ baseUrl: "http://127.0.0.1:4001/v1" }),
|
|
455
|
+
);
|
|
456
|
+
const firstAgain = await selectEmbeddingBackend(
|
|
457
|
+
customConfig({ baseUrl: "http://127.0.0.1:4000/v1" }),
|
|
458
|
+
);
|
|
459
|
+
expect(first.backend).not.toBe(second.backend);
|
|
460
|
+
expect(firstAgain.backend).toBe(first.backend);
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
test("caches custom backends by requested dimensions", async () => {
|
|
464
|
+
const first = await selectEmbeddingBackend(
|
|
465
|
+
customConfig({
|
|
466
|
+
baseUrl: "http://127.0.0.1:4000/v1",
|
|
467
|
+
customDimensions: 1024,
|
|
468
|
+
}),
|
|
469
|
+
);
|
|
470
|
+
const second = await selectEmbeddingBackend(
|
|
471
|
+
customConfig({
|
|
472
|
+
baseUrl: "http://127.0.0.1:4000/v1",
|
|
473
|
+
customDimensions: 1536,
|
|
474
|
+
}),
|
|
475
|
+
);
|
|
476
|
+
expect(first.backend).not.toBe(second.backend);
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
test("dimension probes for custom backends are keyed by baseUrl", async () => {
|
|
480
|
+
const { backend: first } = await selectEmbeddingBackend(
|
|
481
|
+
customConfig({ baseUrl: "http://127.0.0.1:4000/v1" }),
|
|
482
|
+
);
|
|
483
|
+
const { backend: second } = await selectEmbeddingBackend(
|
|
484
|
+
customConfig({ baseUrl: "http://127.0.0.1:4001/v1" }),
|
|
485
|
+
);
|
|
486
|
+
if (!first || !second) {
|
|
487
|
+
throw new Error("expected custom backends");
|
|
488
|
+
}
|
|
489
|
+
(first as { embed: typeof first.embed }).embed = mock(async () => [
|
|
490
|
+
new Array(1536).fill(0),
|
|
491
|
+
]) as unknown as typeof first.embed;
|
|
492
|
+
(second as { embed: typeof second.embed }).embed = mock(async () => [
|
|
493
|
+
new Array(1024).fill(0),
|
|
494
|
+
]) as unknown as typeof second.embed;
|
|
495
|
+
|
|
496
|
+
expect(await resolveBackendDimension(first)).toBe(1536);
|
|
497
|
+
expect(await resolveBackendDimension(second)).toBe(1024);
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
test("customEmbeddingSpaceIdentity includes model, url, and dimensions", () => {
|
|
501
|
+
expect(
|
|
502
|
+
customEmbeddingSpaceIdentity(
|
|
503
|
+
customConfig({
|
|
504
|
+
baseUrl: "http://127.0.0.1:4000/v1/",
|
|
505
|
+
customModel: "embed-mistral",
|
|
506
|
+
customDimensions: 1024,
|
|
507
|
+
}),
|
|
508
|
+
),
|
|
509
|
+
).toBe("custom\0embed-mistral\0url=http://127.0.0.1:4000/v1\0dim=1024");
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
test("customEmbeddingSpaceIdentity is null when the provider is not custom", () => {
|
|
513
|
+
expect(
|
|
514
|
+
customEmbeddingSpaceIdentity({
|
|
515
|
+
memory: {
|
|
516
|
+
embeddings: {
|
|
517
|
+
provider: "openai",
|
|
518
|
+
openaiModel: "text-embedding-3-small",
|
|
519
|
+
baseUrl: "http://127.0.0.1:4000/v1",
|
|
520
|
+
},
|
|
521
|
+
},
|
|
522
|
+
} as unknown as AssistantConfig),
|
|
523
|
+
).toBeNull();
|
|
524
|
+
});
|
|
525
|
+
});
|