@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
|
@@ -39,9 +39,11 @@ const ClaimParams = RequestIdParams.extend({
|
|
|
39
39
|
/**
|
|
40
40
|
* Hand a writer's report to the call parked on the form.
|
|
41
41
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* `requestId` and `error` belong to the rail, and an `error` is what makes the
|
|
43
|
+
* outcome a failure. Every other field reaches the parked caller, on a failure
|
|
44
|
+
* as well as on a success, so a writer can mark an outcome rather than only
|
|
45
|
+
* describe it (a dismissal sends `cancelled`). The rail's own fields land last,
|
|
46
|
+
* so a writer's `ok` cannot overturn its `error`.
|
|
45
47
|
*/
|
|
46
48
|
export function resolveFormFromCallback({ body = {} }: RouteHandlerArgs): {
|
|
47
49
|
resolved: boolean;
|
|
@@ -54,7 +56,7 @@ export function resolveFormFromCallback({ body = {} }: RouteHandlerArgs): {
|
|
|
54
56
|
body as never;
|
|
55
57
|
|
|
56
58
|
const result: GuardianFormResult = error
|
|
57
|
-
? { ok: false, error }
|
|
59
|
+
? { ...rest, ok: false, error }
|
|
58
60
|
: { ok: true, ...rest };
|
|
59
61
|
return resolveGuardianForm(requestId, result);
|
|
60
62
|
}
|
|
@@ -20,6 +20,7 @@ import { listHeartbeatRuns } from "../../heartbeat/heartbeat-run-store.js";
|
|
|
20
20
|
import { HeartbeatService } from "../../heartbeat/heartbeat-service.js";
|
|
21
21
|
import { getConversation } from "../../persistence/conversation-crud.js";
|
|
22
22
|
import { getUsageCostForConversationWindow } from "../../persistence/llm-usage-store.js";
|
|
23
|
+
import { resolveScheduleTimezone } from "../../schedule/schedule-timezone.js";
|
|
23
24
|
import { readTextFileSync } from "../../util/fs.js";
|
|
24
25
|
import { getLogger } from "../../util/logger.js";
|
|
25
26
|
import { getWorkspacePromptPath } from "../../util/platform.js";
|
|
@@ -36,6 +37,41 @@ import type { RouteDefinition, RouteHandlerArgs } from "./types.js";
|
|
|
36
37
|
|
|
37
38
|
const log = getLogger("heartbeat-routes");
|
|
38
39
|
|
|
40
|
+
const HeartbeatConfigResponseSchema = z.object({
|
|
41
|
+
enabled: z.boolean(),
|
|
42
|
+
intervalMs: z.number(),
|
|
43
|
+
activeHoursStart: z.number().nullable(),
|
|
44
|
+
activeHoursEnd: z.number().nullable(),
|
|
45
|
+
cronExpression: z.string().nullable(),
|
|
46
|
+
timezone: z.string().nullable(),
|
|
47
|
+
effectiveTimezone: z
|
|
48
|
+
.string()
|
|
49
|
+
.nullable()
|
|
50
|
+
.describe(
|
|
51
|
+
"Timezone used for cron and active-hours evaluation after resolving heartbeat.timezone, then the user's configured or detected zone",
|
|
52
|
+
),
|
|
53
|
+
nextRunAt: z.number().nullable(),
|
|
54
|
+
lastRunAt: z.number().nullable(),
|
|
55
|
+
success: z.boolean(),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
function heartbeatConfigResponse() {
|
|
59
|
+
const heartbeat = getConfig().heartbeat;
|
|
60
|
+
const svc = HeartbeatService.getInstance();
|
|
61
|
+
return {
|
|
62
|
+
enabled: heartbeat.enabled,
|
|
63
|
+
intervalMs: heartbeat.intervalMs,
|
|
64
|
+
activeHoursStart: heartbeat.activeHoursStart ?? null,
|
|
65
|
+
activeHoursEnd: heartbeat.activeHoursEnd ?? null,
|
|
66
|
+
cronExpression: heartbeat.cronExpression ?? null,
|
|
67
|
+
timezone: heartbeat.timezone ?? null,
|
|
68
|
+
effectiveTimezone: resolveScheduleTimezone(heartbeat.timezone),
|
|
69
|
+
nextRunAt: svc?.nextRunAt ?? null,
|
|
70
|
+
lastRunAt: svc?.lastRunAt ?? null,
|
|
71
|
+
success: true,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
39
75
|
// ---------------------------------------------------------------------------
|
|
40
76
|
// Handlers (transport-agnostic)
|
|
41
77
|
// ---------------------------------------------------------------------------
|
|
@@ -196,32 +232,8 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
196
232
|
summary: "Get heartbeat config",
|
|
197
233
|
description: "Return the current heartbeat schedule configuration.",
|
|
198
234
|
tags: ["heartbeat"],
|
|
199
|
-
responseBody:
|
|
200
|
-
|
|
201
|
-
intervalMs: z.number(),
|
|
202
|
-
activeHoursStart: z.number().nullable(),
|
|
203
|
-
activeHoursEnd: z.number().nullable(),
|
|
204
|
-
cronExpression: z.string().nullable(),
|
|
205
|
-
timezone: z.string().nullable(),
|
|
206
|
-
nextRunAt: z.number().nullable(),
|
|
207
|
-
lastRunAt: z.number().nullable(),
|
|
208
|
-
success: z.boolean(),
|
|
209
|
-
}),
|
|
210
|
-
handler: async (_args: RouteHandlerArgs) => {
|
|
211
|
-
const config = getConfig().heartbeat;
|
|
212
|
-
const svc = HeartbeatService.getInstance();
|
|
213
|
-
return {
|
|
214
|
-
enabled: config.enabled,
|
|
215
|
-
intervalMs: config.intervalMs,
|
|
216
|
-
activeHoursStart: config.activeHoursStart ?? null,
|
|
217
|
-
activeHoursEnd: config.activeHoursEnd ?? null,
|
|
218
|
-
cronExpression: config.cronExpression ?? null,
|
|
219
|
-
timezone: config.timezone ?? null,
|
|
220
|
-
nextRunAt: svc?.nextRunAt ?? null,
|
|
221
|
-
lastRunAt: svc?.lastRunAt ?? null,
|
|
222
|
-
success: true,
|
|
223
|
-
};
|
|
224
|
-
},
|
|
235
|
+
responseBody: HeartbeatConfigResponseSchema,
|
|
236
|
+
handler: async (_args: RouteHandlerArgs) => heartbeatConfigResponse(),
|
|
225
237
|
},
|
|
226
238
|
{
|
|
227
239
|
operationId: "updateHeartbeatConfig",
|
|
@@ -258,19 +270,9 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
258
270
|
.string()
|
|
259
271
|
.nullable()
|
|
260
272
|
.optional()
|
|
261
|
-
.describe("Timezone for cron evaluation"),
|
|
262
|
-
}),
|
|
263
|
-
responseBody: z.object({
|
|
264
|
-
enabled: z.boolean(),
|
|
265
|
-
intervalMs: z.number(),
|
|
266
|
-
activeHoursStart: z.number().nullable(),
|
|
267
|
-
activeHoursEnd: z.number().nullable(),
|
|
268
|
-
cronExpression: z.string().nullable(),
|
|
269
|
-
timezone: z.string().nullable(),
|
|
270
|
-
nextRunAt: z.number().nullable(),
|
|
271
|
-
lastRunAt: z.number().nullable(),
|
|
272
|
-
success: z.boolean(),
|
|
273
|
+
.describe("Timezone for cron and active-hours evaluation"),
|
|
273
274
|
}),
|
|
275
|
+
responseBody: HeartbeatConfigResponseSchema,
|
|
274
276
|
handler: async ({ body = {} }: RouteHandlerArgs) => {
|
|
275
277
|
// Build a patch containing only the fields the caller actually set.
|
|
276
278
|
// Writing back the full Zod-defaulted heartbeat object would bake
|
|
@@ -316,24 +318,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
316
318
|
throw new InternalError("Failed to save config");
|
|
317
319
|
}
|
|
318
320
|
|
|
319
|
-
// Read effective values back through the schema-defaulting loader so
|
|
320
|
-
// callers that only set a subset of fields still see the resolved
|
|
321
|
-
// (post-default) shape in the response.
|
|
322
|
-
const heartbeat = getConfig().heartbeat;
|
|
323
321
|
const svc = HeartbeatService.getInstance();
|
|
324
322
|
svc?.reconfigure();
|
|
325
323
|
|
|
326
|
-
return
|
|
327
|
-
enabled: heartbeat.enabled,
|
|
328
|
-
intervalMs: heartbeat.intervalMs,
|
|
329
|
-
activeHoursStart: heartbeat.activeHoursStart ?? null,
|
|
330
|
-
activeHoursEnd: heartbeat.activeHoursEnd ?? null,
|
|
331
|
-
cronExpression: heartbeat.cronExpression ?? null,
|
|
332
|
-
timezone: heartbeat.timezone ?? null,
|
|
333
|
-
nextRunAt: svc?.nextRunAt ?? null,
|
|
334
|
-
lastRunAt: svc?.lastRunAt ?? null,
|
|
335
|
-
success: true,
|
|
336
|
-
};
|
|
324
|
+
return heartbeatConfigResponse();
|
|
337
325
|
},
|
|
338
326
|
},
|
|
339
327
|
{
|
|
@@ -132,6 +132,7 @@ import { ROUTES as RECORDING_ROUTES } from "./recording-routes.js";
|
|
|
132
132
|
import { ROUTES as RENAME_CONVERSATION_ROUTES } from "./rename-conversation-routes.js";
|
|
133
133
|
import { ROUTES as RESOURCE_PRESSURE_ROUTES } from "./resource-pressure-routes.js";
|
|
134
134
|
import { ROUTES as RETROSPECTIVE_ROUTES } from "./retrospective-routes.js";
|
|
135
|
+
import { ROUTES as ROADMAP_ROUTES } from "./roadmap-routes.js";
|
|
135
136
|
import { ROUTES as ROUTE_HOST_WORKER_ROUTES } from "./route-host-worker-routes.js";
|
|
136
137
|
import { ROUTES as SANITY_ROUTES } from "./sanity-routes.js";
|
|
137
138
|
import { ROUTES as SCHEDULE_ROUTES } from "./schedule-routes.js";
|
|
@@ -139,7 +140,6 @@ import { ROUTES as SCHEDULE_WORKER_ROUTES } from "./schedule-worker-routes.js";
|
|
|
139
140
|
import { ROUTES as SECRET_ROUTES } from "./secret-routes.js";
|
|
140
141
|
import { ROUTES as SEQUENCE_ROUTES } from "./sequence-routes.js";
|
|
141
142
|
import { ROUTES as SETTINGS_ROUTES } from "./settings-routes.js";
|
|
142
|
-
import { ROUTES as SIGHT_FRAME_ROUTES } from "./sight-frame-routes.js";
|
|
143
143
|
import { ROUTES as SKILL_ROUTES } from "./skills-routes.js";
|
|
144
144
|
import { ROUTES as SLACK_CHANNEL_RESOLVE_ROUTES } from "./slack-channel-routes.js";
|
|
145
145
|
import { ROUTES as SOUNDS_CONFIG_ROUTES } from "./sounds-config-routes.js";
|
|
@@ -282,13 +282,13 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
282
282
|
...RENAME_CONVERSATION_ROUTES,
|
|
283
283
|
...MONITORING_ROUTES,
|
|
284
284
|
...RETROSPECTIVE_ROUTES,
|
|
285
|
+
...ROADMAP_ROUTES,
|
|
285
286
|
...SCHEDULE_ROUTES,
|
|
286
287
|
...SCHEDULE_WORKER_ROUTES,
|
|
287
288
|
...ROUTE_HOST_WORKER_ROUTES,
|
|
288
289
|
...SANITY_ROUTES,
|
|
289
290
|
...SECRET_ROUTES,
|
|
290
291
|
...SETTINGS_ROUTES,
|
|
291
|
-
...SIGHT_FRAME_ROUTES,
|
|
292
292
|
...SOUNDS_CONFIG_ROUTES,
|
|
293
293
|
...SKILL_ROUTES,
|
|
294
294
|
...A2A_ROUTES,
|
|
@@ -230,7 +230,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
230
230
|
operationId: "integrations_a2a_config_get",
|
|
231
231
|
endpoint: "integrations/a2a/config",
|
|
232
232
|
method: "GET",
|
|
233
|
-
policy:
|
|
233
|
+
policy: {
|
|
234
|
+
requiredScopes: ["settings.read"],
|
|
235
|
+
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
236
|
+
},
|
|
234
237
|
summary: "Get A2A config",
|
|
235
238
|
description: "Check current A2A channel configuration status.",
|
|
236
239
|
tags: ["integrations"],
|
|
@@ -241,7 +244,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
241
244
|
operationId: "integrations_a2a_config_post",
|
|
242
245
|
endpoint: "integrations/a2a/config",
|
|
243
246
|
method: "POST",
|
|
244
|
-
policy:
|
|
247
|
+
policy: {
|
|
248
|
+
requiredScopes: ["settings.write"],
|
|
249
|
+
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
250
|
+
},
|
|
245
251
|
summary: "Enable A2A channel",
|
|
246
252
|
description: "Enable the A2A channel for inter-assistant communication.",
|
|
247
253
|
tags: ["integrations"],
|
|
@@ -252,7 +258,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
252
258
|
operationId: "integrations_a2a_config_delete",
|
|
253
259
|
endpoint: "integrations/a2a/config",
|
|
254
260
|
method: "DELETE",
|
|
255
|
-
policy:
|
|
261
|
+
policy: {
|
|
262
|
+
requiredScopes: ["settings.write"],
|
|
263
|
+
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
264
|
+
},
|
|
256
265
|
summary: "Disable A2A channel",
|
|
257
266
|
description: "Disable the A2A channel.",
|
|
258
267
|
tags: ["integrations"],
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
getVercelConfig,
|
|
17
17
|
setVercelConfig,
|
|
18
18
|
} from "../../../daemon/handlers/config-vercel.js";
|
|
19
|
+
import { ACTOR_PRINCIPALS } from "../../auth/route-policy.js";
|
|
19
20
|
import { BadRequestError } from "../errors.js";
|
|
20
21
|
import type { RouteDefinition, RouteHandlerArgs } from "../types.js";
|
|
21
22
|
|
|
@@ -70,7 +71,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
70
71
|
operationId: "integrations_vercel_config_get",
|
|
71
72
|
endpoint: "integrations/vercel/config",
|
|
72
73
|
method: "GET",
|
|
73
|
-
policy:
|
|
74
|
+
policy: {
|
|
75
|
+
requiredScopes: ["settings.read"],
|
|
76
|
+
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
77
|
+
},
|
|
74
78
|
summary: "Get Vercel config",
|
|
75
79
|
description: "Check if a Vercel API token is stored.",
|
|
76
80
|
tags: ["integrations"],
|
|
@@ -81,7 +85,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
81
85
|
operationId: "integrations_vercel_config_post",
|
|
82
86
|
endpoint: "integrations/vercel/config",
|
|
83
87
|
method: "POST",
|
|
84
|
-
policy:
|
|
88
|
+
policy: {
|
|
89
|
+
requiredScopes: ["settings.write"],
|
|
90
|
+
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
91
|
+
},
|
|
85
92
|
summary: "Set or delete Vercel config",
|
|
86
93
|
description:
|
|
87
94
|
"Set or delete the Vercel API token. Action is determined by the body action field.",
|
|
@@ -97,7 +104,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
97
104
|
operationId: "integrations_vercel_config_delete",
|
|
98
105
|
endpoint: "integrations/vercel/config",
|
|
99
106
|
method: "DELETE",
|
|
100
|
-
policy:
|
|
107
|
+
policy: {
|
|
108
|
+
requiredScopes: ["settings.write"],
|
|
109
|
+
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
110
|
+
},
|
|
101
111
|
summary: "Delete Vercel config",
|
|
102
112
|
description: "Delete the stored Vercel API token.",
|
|
103
113
|
tags: ["integrations"],
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
* - platform_callback_routes_list (GET platform/callback-routes): lists
|
|
16
16
|
* registered callback routes for this assistant.
|
|
17
17
|
* - platform_credits (GET platform/credits): fetches the org's remaining
|
|
18
|
-
* credit balance
|
|
18
|
+
* credit balance, plan-included credit usage, extra credit, upcoming
|
|
19
|
+
* expiry, today's spend, and daily-limit / low-balance state from the
|
|
20
|
+
* platform billing summary.
|
|
19
21
|
* - platform_subscription (GET platform/subscription): fetches the org's
|
|
20
22
|
* current plan, subscription status, and entitlements.
|
|
21
23
|
* - platform_plans (GET platform/plans): fetches the plan catalog with pricing.
|
|
@@ -25,6 +27,11 @@
|
|
|
25
27
|
* invoice list and returns a single invoice by Stripe invoice ID.
|
|
26
28
|
*/
|
|
27
29
|
|
|
30
|
+
import {
|
|
31
|
+
type BillingPlanId,
|
|
32
|
+
extraCreditUsd,
|
|
33
|
+
planCreditUsedFraction,
|
|
34
|
+
} from "@vellumai/service-contracts/plan-credit";
|
|
28
35
|
import {
|
|
29
36
|
type PlatformCredentialVerificationStatus,
|
|
30
37
|
type PlatformVerifyCredentialResponse,
|
|
@@ -142,6 +149,77 @@ const PlatformCreditsResponseSchema = z.object({
|
|
|
142
149
|
unit: z.literal("USD"),
|
|
143
150
|
stale: z.boolean(),
|
|
144
151
|
as_of: z.string(),
|
|
152
|
+
daily_spend: z
|
|
153
|
+
.number()
|
|
154
|
+
.nullable()
|
|
155
|
+
.describe(
|
|
156
|
+
"Today's (UTC) spend counted against the daily credit limit, in USD. Excludes spend covered by plan-included credits (initial credit, Pro credit bundle), so it is not total spend. Null when the platform did not report it.",
|
|
157
|
+
),
|
|
158
|
+
daily_limit: z
|
|
159
|
+
.number()
|
|
160
|
+
.nullable()
|
|
161
|
+
.describe("Daily credit limit in USD, or null when none is set."),
|
|
162
|
+
daily_limit_reached: z
|
|
163
|
+
.boolean()
|
|
164
|
+
.describe(
|
|
165
|
+
"True when today's spend has reached the daily limit and the limit is being enforced.",
|
|
166
|
+
),
|
|
167
|
+
daily_limit_snoozed: z
|
|
168
|
+
.boolean()
|
|
169
|
+
.describe(
|
|
170
|
+
"True when the daily limit has been skipped for the rest of the current UTC day.",
|
|
171
|
+
),
|
|
172
|
+
low_balance_threshold: z
|
|
173
|
+
.number()
|
|
174
|
+
.nullable()
|
|
175
|
+
.describe("Low-balance alert threshold in USD."),
|
|
176
|
+
low_balance_warning: z
|
|
177
|
+
.boolean()
|
|
178
|
+
.describe(
|
|
179
|
+
"True when the balance is above zero but below the low-balance threshold and auto top-up is not enabled.",
|
|
180
|
+
),
|
|
181
|
+
plan_credit_remaining: z
|
|
182
|
+
.number()
|
|
183
|
+
.nullable()
|
|
184
|
+
.describe(
|
|
185
|
+
"Unused credit (USD) remaining on the unexpired plan-included grants (initial credit, Pro credit bundle). Null when the platform did not report grant figures.",
|
|
186
|
+
),
|
|
187
|
+
plan_credit_total: z
|
|
188
|
+
.number()
|
|
189
|
+
.nullable()
|
|
190
|
+
.describe(
|
|
191
|
+
"Total credit (USD) those plan-included grants were worth, net of refunds. Null when the platform did not report grant figures.",
|
|
192
|
+
),
|
|
193
|
+
plan_credit_used_fraction: z
|
|
194
|
+
.number()
|
|
195
|
+
.nullable()
|
|
196
|
+
.describe(
|
|
197
|
+
"Share of the plan-included credit already used, from 0 to 1: the same reading as the in-app usage meter. A Pro subscription whose unexpired grants total nothing reads as 1 (everything granted is used or expired). Null when there is no usable reading: grant figures missing, or a zero total on a base or unknown plan.",
|
|
198
|
+
),
|
|
199
|
+
plan_credits_spent: z
|
|
200
|
+
.boolean()
|
|
201
|
+
.nullable()
|
|
202
|
+
.describe(
|
|
203
|
+
"True when the plan-included credit is used up or expired. Whether further managed usage is funded is extra_credit_remaining (zero means the organization is out of credit). Null when there is no plan-credit reading.",
|
|
204
|
+
),
|
|
205
|
+
extra_credit_remaining: z
|
|
206
|
+
.number()
|
|
207
|
+
.nullable()
|
|
208
|
+
.describe(
|
|
209
|
+
"Credit (USD) bought or earned on top of the plan-included grants: remaining minus plan_credit_remaining, floored at zero. Null when grant figures are missing.",
|
|
210
|
+
),
|
|
211
|
+
credits_expiring_soon: z
|
|
212
|
+
.number()
|
|
213
|
+
.nullable()
|
|
214
|
+
.describe(
|
|
215
|
+
"Unexpired credit (USD) on grants that expire within the next 30 days. Null when the platform did not report it.",
|
|
216
|
+
),
|
|
217
|
+
next_credit_expiry_at: z
|
|
218
|
+
.string()
|
|
219
|
+
.nullable()
|
|
220
|
+
.describe(
|
|
221
|
+
"Earliest upcoming expiry (ISO 8601) across grants that still hold credit, or null when none is scheduled.",
|
|
222
|
+
),
|
|
145
223
|
});
|
|
146
224
|
type PlatformCreditsResponse = z.infer<typeof PlatformCreditsResponseSchema>;
|
|
147
225
|
|
|
@@ -454,6 +532,18 @@ async function handleCallbackRoutesList(
|
|
|
454
532
|
return { routes };
|
|
455
533
|
}
|
|
456
534
|
|
|
535
|
+
/**
|
|
536
|
+
* Null when the billing summary omits the field (older platform builds) or it
|
|
537
|
+
* is not a finite number, so the daemon never reports a made-up figure.
|
|
538
|
+
*/
|
|
539
|
+
function parseUsd(value: string | null | undefined): number | null {
|
|
540
|
+
if (value == null || value.trim() === "") {
|
|
541
|
+
return null;
|
|
542
|
+
}
|
|
543
|
+
const parsed = Number(value);
|
|
544
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
545
|
+
}
|
|
546
|
+
|
|
457
547
|
async function handlePlatformCredits(
|
|
458
548
|
_args: RouteHandlerArgs,
|
|
459
549
|
): Promise<PlatformCreditsResponse> {
|
|
@@ -465,10 +555,46 @@ async function handlePlatformCredits(
|
|
|
465
555
|
pending_compute_usd: string;
|
|
466
556
|
effective_balance_usd: string;
|
|
467
557
|
is_degraded: boolean;
|
|
558
|
+
daily_spend_usd?: string;
|
|
559
|
+
daily_credit_limit_usd?: string | null;
|
|
560
|
+
daily_limit_reached?: boolean;
|
|
561
|
+
daily_limit_snoozed?: boolean;
|
|
562
|
+
low_balance_threshold_usd?: string;
|
|
563
|
+
low_balance_warning?: boolean;
|
|
564
|
+
available_usage_balance?: string;
|
|
565
|
+
total_usage_balance?: string;
|
|
566
|
+
credits_expiring_soon_usd?: string;
|
|
567
|
+
next_credit_expiry_at?: string | null;
|
|
468
568
|
};
|
|
469
569
|
|
|
570
|
+
const remaining = Number(summary.effective_balance_usd);
|
|
571
|
+
const planCreditRemaining = parseUsd(summary.available_usage_balance);
|
|
572
|
+
const planCreditTotal = parseUsd(summary.total_usage_balance);
|
|
573
|
+
let usedFraction = planCreditUsedFraction(
|
|
574
|
+
planCreditTotal,
|
|
575
|
+
planCreditRemaining,
|
|
576
|
+
null,
|
|
577
|
+
);
|
|
578
|
+
if (
|
|
579
|
+
usedFraction === null &&
|
|
580
|
+
planCreditTotal !== null &&
|
|
581
|
+
planCreditTotal <= 0
|
|
582
|
+
) {
|
|
583
|
+
// Only the zero-grant reading depends on the plan, so the subscription is
|
|
584
|
+
// read lazily and best-effort: a slow or failed read degrades that one
|
|
585
|
+
// reading to null instead of delaying or failing the balance.
|
|
586
|
+
const planId = await fetchBillingSubscription()
|
|
587
|
+
.then((subscription) => subscription.plan_id)
|
|
588
|
+
.catch((): BillingPlanId | null => null);
|
|
589
|
+
usedFraction = planCreditUsedFraction(
|
|
590
|
+
planCreditTotal,
|
|
591
|
+
planCreditRemaining,
|
|
592
|
+
planId,
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
|
|
470
596
|
return {
|
|
471
|
-
remaining
|
|
597
|
+
remaining,
|
|
472
598
|
settled: Number(summary.settled_balance_usd),
|
|
473
599
|
pending: Number(summary.pending_compute_usd),
|
|
474
600
|
unit: "USD",
|
|
@@ -476,6 +602,25 @@ async function handlePlatformCredits(
|
|
|
476
602
|
// as_of is response receipt time; add a server as_of field if the billing
|
|
477
603
|
// summary endpoint ever returns one.
|
|
478
604
|
as_of: new Date().toISOString(),
|
|
605
|
+
daily_spend: parseUsd(summary.daily_spend_usd),
|
|
606
|
+
daily_limit: parseUsd(summary.daily_credit_limit_usd),
|
|
607
|
+
daily_limit_reached: summary.daily_limit_reached === true,
|
|
608
|
+
daily_limit_snoozed: summary.daily_limit_snoozed === true,
|
|
609
|
+
low_balance_threshold: parseUsd(summary.low_balance_threshold_usd),
|
|
610
|
+
low_balance_warning: summary.low_balance_warning === true,
|
|
611
|
+
plan_credit_remaining: planCreditRemaining,
|
|
612
|
+
plan_credit_total: planCreditTotal,
|
|
613
|
+
plan_credit_used_fraction: usedFraction,
|
|
614
|
+
plan_credits_spent: usedFraction === null ? null : usedFraction >= 1,
|
|
615
|
+
extra_credit_remaining:
|
|
616
|
+
planCreditRemaining === null
|
|
617
|
+
? null
|
|
618
|
+
: extraCreditUsd(remaining, planCreditRemaining),
|
|
619
|
+
credits_expiring_soon: parseUsd(summary.credits_expiring_soon_usd),
|
|
620
|
+
next_credit_expiry_at:
|
|
621
|
+
typeof summary.next_credit_expiry_at === "string"
|
|
622
|
+
? summary.next_credit_expiry_at
|
|
623
|
+
: null,
|
|
479
624
|
};
|
|
480
625
|
}
|
|
481
626
|
|
|
@@ -570,28 +715,34 @@ async function fetchPlatformJson(
|
|
|
570
715
|
return response.json();
|
|
571
716
|
}
|
|
572
717
|
|
|
718
|
+
interface BillingSubscriptionData {
|
|
719
|
+
plan_id: BillingPlanId;
|
|
720
|
+
status: string | null;
|
|
721
|
+
renewal_date: string | null;
|
|
722
|
+
current_period_end: string | null;
|
|
723
|
+
cancel_at_period_end: boolean;
|
|
724
|
+
cancel_at: string | null;
|
|
725
|
+
selected_credit_tier: string | null;
|
|
726
|
+
package: {
|
|
727
|
+
key: string;
|
|
728
|
+
name: string;
|
|
729
|
+
version: number;
|
|
730
|
+
customized: boolean;
|
|
731
|
+
} | null;
|
|
732
|
+
entitlements: { managed_email: boolean; phone_number: boolean };
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
function fetchBillingSubscription(): Promise<BillingSubscriptionData> {
|
|
736
|
+
return fetchPlatformJson(
|
|
737
|
+
"/v1/organizations/billing/subscription/",
|
|
738
|
+
"subscription",
|
|
739
|
+
) as Promise<BillingSubscriptionData>;
|
|
740
|
+
}
|
|
741
|
+
|
|
573
742
|
async function handlePlatformSubscription(
|
|
574
743
|
_args: RouteHandlerArgs,
|
|
575
744
|
): Promise<PlatformSubscriptionResponse> {
|
|
576
|
-
const data =
|
|
577
|
-
"/v1/organizations/billing/subscription/",
|
|
578
|
-
"subscription",
|
|
579
|
-
)) as {
|
|
580
|
-
plan_id: "base" | "pro";
|
|
581
|
-
status: string | null;
|
|
582
|
-
renewal_date: string | null;
|
|
583
|
-
current_period_end: string | null;
|
|
584
|
-
cancel_at_period_end: boolean;
|
|
585
|
-
cancel_at: string | null;
|
|
586
|
-
selected_credit_tier: string | null;
|
|
587
|
-
package: {
|
|
588
|
-
key: string;
|
|
589
|
-
name: string;
|
|
590
|
-
version: number;
|
|
591
|
-
customized: boolean;
|
|
592
|
-
} | null;
|
|
593
|
-
entitlements: { managed_email: boolean; phone_number: boolean };
|
|
594
|
-
};
|
|
745
|
+
const data = await fetchBillingSubscription();
|
|
595
746
|
|
|
596
747
|
return {
|
|
597
748
|
planId: data.plan_id,
|
|
@@ -859,9 +1010,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
859
1010
|
requiredScopes: ["settings.read"],
|
|
860
1011
|
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
861
1012
|
},
|
|
862
|
-
summary:
|
|
1013
|
+
summary:
|
|
1014
|
+
"Get the organization's credit balance, plan-credit usage, and daily-limit state",
|
|
863
1015
|
description:
|
|
864
|
-
"Fetches the org's settled, pending, and effective (remaining) credit balance in USD from the platform billing summary.",
|
|
1016
|
+
"Fetches the org's settled, pending, and effective (remaining) credit balance in USD from the platform billing summary, plus plan-included credit usage (remaining, total, and the used fraction shown by the in-app usage meter), extra credit bought or earned on top, credit expiring within 30 days, and the daily-limit state: today's spend counted against the daily credit limit (which excludes spend covered by plan-included credits, so it is not total spend), the limit itself, and the low-balance warning state.",
|
|
865
1017
|
tags: ["platform"],
|
|
866
1018
|
handler: handlePlatformCredits,
|
|
867
1019
|
responseBody: PlatformCreditsResponseSchema,
|