@vellumai/assistant 0.10.2-dev.202606250318.5e7cfb0 → 0.10.2
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/bun.lock +0 -20
- package/docs/workspace-tools.md +33 -42
- package/eslint-rules/cli-no-daemon-internals.js +0 -6
- package/node_modules/@vellumai/gateway-client/src/__tests__/trust-verdict-contract.test.ts +0 -31
- package/node_modules/@vellumai/gateway-client/src/gateway-ipc-contracts.ts +0 -44
- package/node_modules/@vellumai/gateway-client/src/index.ts +0 -14
- package/node_modules/@vellumai/gateway-client/src/trust-verdict-contract.ts +0 -17
- package/node_modules/@vellumai/service-contracts/package.json +0 -1
- package/node_modules/@vellumai/service-contracts/src/index.ts +0 -1
- package/openapi.yaml +0 -155
- package/package.json +1 -4
- package/scripts/test.sh +15 -36
- package/src/__tests__/actor-token-service.test.ts +14 -36
- package/src/__tests__/agent-loop-override-profile.test.ts +0 -1
- package/src/__tests__/agent-wake-disk-pressure-callsite.test.ts +0 -2
- package/src/__tests__/agent-wake-override-profile.test.ts +0 -2
- package/src/__tests__/annotate-activity-metadata.test.ts +0 -2
- package/src/__tests__/annotate-risk-options.test.ts +0 -2
- package/src/__tests__/approval-cascade.test.ts +0 -2
- package/src/__tests__/assistant-attachments.test.ts +0 -42
- package/src/__tests__/background-workers-disk-pressure.test.ts +0 -2
- package/src/__tests__/btw-routes.test.ts +0 -2
- package/src/__tests__/build-persisted-content.test.ts +0 -2
- package/src/__tests__/call-controller.test.ts +0 -19
- package/src/__tests__/channel-guardian.test.ts +58 -94
- package/src/__tests__/channel-reply-delivery.test.ts +0 -2
- package/src/__tests__/compaction-events.test.ts +0 -2
- package/src/__tests__/compaction.benchmark.test.ts +0 -2
- package/src/__tests__/compactor-call-site-logging.test.ts +0 -2
- package/src/__tests__/compactor-low-watermark-cut.test.ts +0 -2
- package/src/__tests__/compactor-preserved-tail-count.test.ts +0 -2
- package/src/__tests__/compactor-summary-call-truncation.test.ts +0 -2
- package/src/__tests__/compactor-web-search-strip.test.ts +0 -2
- package/src/__tests__/config-loader-backfill.test.ts +10 -123
- package/src/__tests__/config-schema.test.ts +0 -1
- package/src/__tests__/confirmation-request-guardian-bridge.test.ts +29 -31
- package/src/__tests__/contacts-relay-reads.test.ts +15 -13
- package/src/__tests__/conversation-abort-tool-results.test.ts +0 -2
- package/src/__tests__/conversation-agent-loop-disk-pressure.test.ts +0 -2
- package/src/__tests__/conversation-agent-loop-inference-profile.test.ts +0 -2
- package/src/__tests__/conversation-agent-loop-overflow.test.ts +0 -2
- package/src/__tests__/conversation-agent-loop.test.ts +0 -134
- package/src/__tests__/conversation-analysis-routes.test.ts +0 -2
- package/src/__tests__/conversation-app-control-lifecycle.test.ts +0 -2
- package/src/__tests__/conversation-confirmation-signals.test.ts +0 -2
- package/src/__tests__/conversation-history-web-search.test.ts +0 -2
- package/src/__tests__/conversation-load-history-repair.test.ts +0 -2
- package/src/__tests__/conversation-load-history-stripped.test.ts +0 -2
- package/src/__tests__/conversation-pairing.test.ts +0 -2
- package/src/__tests__/conversation-process-app-control-preactivation.test.ts +0 -2
- package/src/__tests__/conversation-process-callsite.test.ts +0 -2
- package/src/__tests__/conversation-provider-retry-repair.test.ts +0 -2
- package/src/__tests__/conversation-queue.test.ts +0 -91
- package/src/__tests__/conversation-routes-guardian-reply.test.ts +0 -14
- package/src/__tests__/conversation-routes-slash-commands.test.ts +0 -14
- package/src/__tests__/conversation-slash-queue.test.ts +0 -2
- package/src/__tests__/conversation-slash-unknown.test.ts +0 -2
- package/src/__tests__/conversation-speed-override.test.ts +0 -2
- package/src/__tests__/conversation-surfaces-task-progress.test.ts +0 -29
- package/src/__tests__/conversation-title-service.test.ts +0 -2
- package/src/__tests__/conversation-tool-setup-attribution.test.ts +0 -47
- package/src/__tests__/conversation-usage.test.ts +0 -2
- package/src/__tests__/conversation-workspace-cache-state.test.ts +0 -2
- package/src/__tests__/conversation-workspace-injection.test.ts +0 -2
- package/src/__tests__/conversation-workspace-tool-tracking.test.ts +0 -2
- package/src/__tests__/credential-security-invariants.test.ts +1 -1
- package/src/__tests__/db-migration-rollback.test.ts +171 -205
- package/src/__tests__/db-test-helpers.ts +4 -5
- package/src/__tests__/deterministic-verification-control-plane.test.ts +2 -4
- package/src/__tests__/disk-pressure-guard.test.ts +0 -41
- package/src/__tests__/dm-persistence.test.ts +0 -2
- package/src/__tests__/emit-signal-routing-intent.test.ts +5 -10
- package/src/__tests__/events-dev-bypass-actor.test.ts +1 -7
- package/src/__tests__/exploration-drift-hook.test.ts +2 -3
- package/src/__tests__/filing-service.test.ts +0 -2
- package/src/__tests__/guardian-binding-drift-heal.test.ts +10 -75
- package/src/__tests__/guardian-dispatch.test.ts +1 -95
- package/src/__tests__/guardian-outbound-http.test.ts +0 -13
- package/src/__tests__/heartbeat-disk-pressure.test.ts +0 -2
- package/src/__tests__/heartbeat-service.test.ts +0 -2
- package/src/__tests__/helpers/channel-test-adapter.ts +7 -1
- package/src/__tests__/host-app-control-routes.test.ts +30 -24
- package/src/__tests__/host-bash-routes.test.ts +41 -31
- package/src/__tests__/host-browser-routes.test.ts +32 -26
- package/src/__tests__/host-cu-routes-targeted.test.ts +33 -25
- package/src/__tests__/host-file-routes-targeted.test.ts +52 -40
- package/src/__tests__/host-transfer-routes-targeted.test.ts +43 -31
- package/src/__tests__/http-user-message-parity.test.ts +8 -290
- package/src/__tests__/inbound-invite-redemption.test.ts +0 -28
- package/src/__tests__/inbound-slack-persistence.test.ts +0 -2
- package/src/__tests__/invite-redemption-service.test.ts +0 -198
- package/src/__tests__/llm-context-normalization.test.ts +0 -105
- package/src/__tests__/llm-request-log-error-payload.test.ts +9 -71
- package/src/__tests__/llm-usage-store.test.ts +0 -25
- package/src/__tests__/mcp-health-check.test.ts +1 -2
- package/src/__tests__/media-stream-server-integration.test.ts +0 -127
- package/src/__tests__/memory-retrieval-hook.test.ts +0 -2
- package/src/__tests__/messaging-send-tool.test.ts +0 -2
- package/src/__tests__/migration-import-from-url.test.ts +2 -2
- package/src/__tests__/mtime-cache.test.ts +5 -146
- package/src/__tests__/native-web-search.test.ts +0 -2
- package/src/__tests__/non-member-access-request.test.ts +17 -189
- package/src/__tests__/notification-broadcaster.test.ts +0 -4
- package/src/__tests__/notification-decision-recipient-context.test.ts +32 -33
- package/src/__tests__/notification-deep-link.test.ts +0 -6
- package/src/__tests__/notification-guardian-path.test.ts +0 -19
- package/src/__tests__/openai-provider.test.ts +12 -22
- package/src/__tests__/openai-responses-provider.test.ts +2 -12
- package/src/__tests__/outbound-slack-persistence.test.ts +0 -2
- package/src/__tests__/pending-interactions-resolved-event.test.ts +4 -7
- package/src/__tests__/persistence-secret-redaction.test.ts +0 -2
- package/src/__tests__/plugin-bootstrap.test.ts +73 -3
- package/src/__tests__/plugin-route-contribution.test.ts +17 -4
- package/src/__tests__/plugin-tool-contribution.test.ts +18 -3
- package/src/__tests__/plugin-types.test.ts +2 -0
- package/src/__tests__/process-message-background-slack.test.ts +0 -2
- package/src/__tests__/process-message-display-content.test.ts +0 -2
- package/src/__tests__/provider-error-scenarios.test.ts +4 -5
- package/src/__tests__/provider-usage-tracking.test.ts +0 -39
- package/src/__tests__/regenerate-fire-and-forget-trace.test.ts +0 -2
- package/src/__tests__/registry.test.ts +1 -4
- package/src/__tests__/relay-server.test.ts +25 -694
- package/src/__tests__/runtime-attachment-metadata.test.ts +1 -0
- package/src/__tests__/secret-ingress-http.test.ts +0 -14
- package/src/__tests__/send-endpoint-busy.test.ts +8 -30
- package/src/__tests__/skills.test.ts +0 -44
- package/src/__tests__/slack-inbound-verification.test.ts +2 -47
- package/src/__tests__/stt-hints.test.ts +13 -44
- package/src/__tests__/subagent-detail.test.ts +0 -27
- package/src/__tests__/subagent-disposal.test.ts +0 -65
- package/src/__tests__/subagent-notify-parent.test.ts +0 -2
- package/src/__tests__/subagent-role-registry.test.ts +2 -7
- package/src/__tests__/subagent-spawn-tool-fork.test.ts +0 -2
- package/src/__tests__/subagent-tools.test.ts +0 -2
- package/src/__tests__/suggestion-routes.test.ts +0 -2
- package/src/__tests__/title-generate-hook.test.ts +0 -2
- package/src/__tests__/tool-executor-lifecycle-events.test.ts +0 -2
- package/src/__tests__/tool-executor.test.ts +11 -16
- package/src/__tests__/tool-preview-lifecycle.test.ts +0 -2
- package/src/__tests__/tool-result-metadata-plumbing.test.ts +0 -2
- package/src/__tests__/tool-start-timestamp.test.ts +0 -2
- package/src/__tests__/trusted-contact-inline-approval-integration.test.ts +10 -10
- package/src/__tests__/twilio-routes.test.ts +0 -96
- package/src/__tests__/ui-file-upload-surface.test.ts +0 -86
- package/src/__tests__/verification-control-plane-policy.test.ts +0 -2
- package/src/__tests__/voice-invite-redemption.test.ts +0 -33
- package/src/__tests__/web-search-backend-failure.test.ts +0 -2
- package/src/__tests__/workspace-migration-remove-hooks.test.ts +35 -14
- package/src/__tests__/workspace-tool-loader.test.ts +2 -195
- package/src/__tests__/workspace-tools-watcher-flag.test.ts +70 -0
- package/src/agent/loop.ts +0 -56
- package/src/api/index.ts +1 -19
- package/src/api/responses/llm-request-log-entry.ts +0 -29
- package/src/api/responses/subagent-detail.ts +0 -17
- package/src/api/surfaces.ts +3 -39
- package/src/approvals/guardian-request-resolvers.ts +11 -1
- package/src/calls/__tests__/relay-setup-router.test.ts +4 -262
- package/src/calls/call-domain.ts +3 -3
- package/src/calls/guardian-dispatch.ts +8 -10
- package/src/calls/inbound-trust-reader.ts +1 -17
- package/src/calls/media-stream-server.ts +0 -21
- package/src/calls/relay-server.ts +50 -167
- package/src/calls/relay-setup-router.ts +7 -37
- package/src/calls/relay-verification.ts +4 -4
- package/src/calls/stt-hints.ts +12 -9
- package/src/calls/twilio-routes.ts +4 -14
- package/src/channels/types.ts +20 -10
- package/src/cli/commands/__tests__/cache.test.ts +1 -8
- package/src/cli/commands/cache.ts +181 -194
- package/src/cli/commands/db/__tests__/repair.test.ts +5 -6
- package/src/cli/commands/db/status.ts +1 -37
- package/src/cli/commands/mcp.ts +218 -252
- package/src/cli/commands/memory/index.ts +0 -2
- package/src/cli/commands/plugins.ts +3 -75
- package/src/cli/lib/__tests__/install-from-github.test.ts +0 -102
- package/src/cli/lib/__tests__/list-installed-plugins.test.ts +1 -160
- package/src/cli/lib/list-installed-plugins.ts +1 -179
- package/src/config/__tests__/sync-gated-profiles.test.ts +3 -11
- package/src/config/bundled-skills/contacts/tools/contact-merge.ts +17 -27
- package/src/config/bundled-skills/contacts/tools/contact-search.ts +3 -13
- package/src/config/bundled-skills/subagent/SKILL.md +1 -1
- package/src/config/bundled-skills/subagent/TOOLS.json +1 -1
- package/src/config/feature-flag-registry.json +13 -5
- package/src/config/loader.ts +5 -38
- package/src/config/schemas/__tests__/memory-v3.test.ts +0 -1
- package/src/config/schemas/memory-lifecycle.ts +0 -12
- package/src/config/schemas/memory-v3.ts +0 -7
- package/src/config/schemas/memory.ts +0 -4
- package/src/config/schemas/timeouts.ts +0 -8
- package/src/config/seed-inference-profiles.ts +11 -21
- package/src/config/skills.ts +5 -27
- package/src/config/sync-gated-profiles.ts +13 -12
- package/src/contacts/contacts-write.ts +0 -3
- package/src/daemon/assistant-attachments.ts +4 -27
- package/src/daemon/conversation-agent-loop.ts +0 -28
- package/src/daemon/conversation-process.ts +16 -35
- package/src/daemon/conversation-surfaces.ts +38 -111
- package/src/daemon/conversation-tool-setup.ts +16 -50
- package/src/daemon/conversation.ts +1 -13
- package/src/daemon/disk-pressure-guard.ts +2 -12
- package/src/daemon/event-loop-watchdog.ts +1 -28
- package/src/daemon/external-plugins-bootstrap.ts +34 -4
- package/src/daemon/handlers/__tests__/config-a2a-redeem.test.ts +0 -25
- package/src/daemon/handlers/config-a2a.ts +14 -6
- package/src/daemon/handlers/config-channels.ts +22 -78
- package/src/daemon/handlers/conversations.ts +0 -77
- package/src/daemon/lifecycle.ts +0 -4
- package/src/daemon/mcp-reload-service.ts +0 -10
- package/src/daemon/memory-v2-startup.test.ts +0 -72
- package/src/daemon/memory-v2-startup.ts +19 -87
- package/src/daemon/message-types/conversations.ts +0 -2
- package/src/daemon/message-types/surfaces.ts +12 -12
- package/src/daemon/server.ts +4 -0
- package/src/daemon/shutdown-handlers.ts +0 -20
- package/src/daemon/tool-setup-types.ts +0 -9
- package/src/daemon/workspace-tools-watcher.ts +328 -0
- package/src/ipc/__tests__/clients-list-ipc.test.ts +1 -1
- package/src/ipc/assistant-server.ts +2 -2
- package/src/mcp/__tests__/mcp-auth-orchestrator.test.ts +0 -1
- package/src/mcp/client.ts +1 -15
- package/src/mcp/mcp-auth-orchestrator.ts +1 -6
- package/src/mcp/mcp-oauth-provider.ts +8 -19
- package/src/memory/__tests__/memory-retrospective-job.test.ts +0 -8
- package/src/memory/conversation-crud.ts +0 -38
- package/src/memory/db-connection.ts +3 -22
- package/src/memory/db-init.ts +502 -36
- package/src/memory/db-singleton.ts +4 -6
- package/src/memory/jobs-worker.ts +0 -58
- package/src/memory/llm-request-log-store.ts +1 -26
- package/src/memory/llm-usage-store.ts +20 -48
- package/src/memory/memory-retrospective-job.ts +8 -9
- package/src/memory/migrations/209-strip-thinking-from-consolidated.ts +56 -130
- package/src/memory/migrations/__tests__/run-migrations.test.ts +2 -2
- package/src/memory/migrations/registry.ts +573 -0
- package/src/memory/migrations/run-migrations.ts +6 -90
- package/src/memory/migrations/validate-migration-state.ts +66 -101
- package/src/memory/schema/conversations.ts +0 -9
- package/src/memory/schema/infrastructure.ts +0 -20
- package/src/memory/v2/__tests__/cli-command-store.test.ts +0 -25
- package/src/memory/v2/__tests__/skill-store.test.ts +0 -80
- package/src/memory/v2/cli-command-store.ts +38 -75
- package/src/memory/v2/prompts/consolidation.ts +82 -13
- package/src/memory/v2/prompts/router.ts +93 -21
- package/src/memory/v2/skill-store.ts +31 -68
- package/src/notifications/__tests__/broadcaster.test.ts +8 -16
- package/src/notifications/__tests__/decision-engine.test.ts +9 -78
- package/src/notifications/broadcaster.ts +1 -8
- package/src/notifications/decision-engine.ts +7 -15
- package/src/notifications/destination-resolver.ts +24 -68
- package/src/notifications/emit-signal.ts +14 -39
- package/src/permissions/question-prompter.test.ts +1 -1
- package/src/permissions/question-prompter.ts +4 -7
- package/src/plugin-api/index.ts +6 -6
- package/src/plugin-api/types.ts +5 -3
- package/src/plugin-api/vision-support.test.ts +4 -28
- package/src/plugin-api/vision-support.ts +31 -66
- package/src/plugins/defaults/advisor/__tests__/consult.test.ts +0 -161
- package/src/plugins/defaults/advisor/consult.ts +6 -110
- package/src/plugins/defaults/advisor/steering.ts +2 -14
- package/src/plugins/defaults/advisor/tools/advisor.ts +5 -32
- package/src/plugins/defaults/exploration-drift/hooks/post-tool-use.ts +1 -2
- package/src/plugins/defaults/image-fallback/__tests__/image-fallback.test.ts +7 -47
- package/src/plugins/defaults/image-fallback/hooks/post-tool-use.ts +11 -10
- package/src/plugins/defaults/image-fallback/hooks/user-prompt-submit.ts +20 -12
- package/src/plugins/defaults/image-fallback/src/caption-blocks.ts +11 -42
- package/src/plugins/defaults/memory-v3-shadow/__tests__/injection.test.ts +3 -33
- package/src/plugins/defaults/memory-v3-shadow/__tests__/pool-select.test.ts +4 -48
- package/src/plugins/defaults/memory-v3-shadow/__tests__/shadow-plugin.test.ts +8 -4
- package/src/plugins/defaults/memory-v3-shadow/injector.ts +15 -43
- package/src/plugins/defaults/memory-v3-shadow/orchestrate.ts +2 -11
- package/src/plugins/defaults/memory-v3-shadow/pool-select.ts +13 -77
- package/src/plugins/defaults/memory-v3-shadow/shadow-plugin.ts +11 -12
- package/src/plugins/mtime-cache.ts +291 -76
- package/src/plugins/pipeline.ts +13 -111
- package/src/plugins/types.ts +2 -0
- package/src/providers/anthropic/client.ts +0 -5
- package/src/providers/call-site-routing.ts +0 -4
- package/src/providers/model-catalog.ts +0 -16
- package/src/providers/openai/__tests__/api-error-detail.test.ts +120 -0
- package/src/providers/openai/chat-completions-provider.ts +83 -37
- package/src/providers/openai/responses-provider.ts +46 -50
- package/src/providers/openrouter/client.ts +0 -5
- package/src/providers/provider-send-message.ts +0 -4
- package/src/providers/ratelimit.ts +0 -4
- package/src/providers/retry.ts +0 -4
- package/src/providers/types.ts +0 -9
- package/src/providers/usage-tracking.ts +0 -4
- package/src/runtime/__tests__/trust-verdict-consumer.test.ts +3 -335
- package/src/runtime/access-request-helper.ts +39 -19
- package/src/runtime/actor-trust-resolver.ts +2 -2
- package/src/runtime/assistant-event-hub.ts +1 -1
- package/src/runtime/assistant-stream-state.ts +2 -9
- package/src/runtime/auth/require-bound-guardian.ts +11 -21
- package/src/runtime/channel-verification-service.ts +31 -56
- package/src/runtime/confirmation-request-guardian-bridge.ts +3 -3
- package/src/runtime/guardian-vellum-migration.ts +7 -66
- package/src/runtime/invite-redemption-service.ts +187 -198
- package/src/runtime/local-actor-identity.ts +11 -76
- package/src/runtime/pending-interactions.ts +1 -11
- package/src/runtime/routes/__tests__/channel-verification-revoke.test.ts +5 -56
- package/src/runtime/routes/__tests__/channel-verification-routes.test.ts +1 -1
- package/src/runtime/routes/__tests__/surface-action-routes.test.ts +0 -187
- package/src/runtime/routes/browser-routes.ts +1 -1
- package/src/runtime/routes/canonical-guardian-expiry-sweep.ts +5 -13
- package/src/runtime/routes/channel-verification-routes.ts +3 -3
- package/src/runtime/routes/contact-routes.ts +32 -8
- package/src/runtime/routes/conversation-cli-routes.ts +5 -4
- package/src/runtime/routes/conversation-list-routes.ts +7 -4
- package/src/runtime/routes/conversation-query-routes.ts +0 -72
- package/src/runtime/routes/conversation-routes.ts +85 -84
- package/src/runtime/routes/events-routes.ts +2 -2
- package/src/runtime/routes/global-search-routes.ts +1 -3
- package/src/runtime/routes/guardian-action-routes.ts +5 -4
- package/src/runtime/routes/host-app-control-routes.ts +4 -5
- package/src/runtime/routes/host-bash-routes.ts +4 -5
- package/src/runtime/routes/host-browser-routes.ts +11 -9
- package/src/runtime/routes/host-cu-routes.ts +4 -5
- package/src/runtime/routes/host-file-routes.ts +4 -5
- package/src/runtime/routes/host-transfer-routes.ts +6 -6
- package/src/runtime/routes/http-adapter.ts +1 -1
- package/src/runtime/routes/identity-routes.ts +2 -3
- package/src/runtime/routes/inbound-message-handler.ts +5 -5
- package/src/runtime/routes/inbound-stages/acl-enforcement.test.ts +5 -97
- package/src/runtime/routes/inbound-stages/acl-enforcement.ts +49 -61
- package/src/runtime/routes/inbound-stages/background-dispatch.ts +4 -16
- package/src/runtime/routes/inbound-stages/escalation-intercept.ts +7 -7
- package/src/runtime/routes/inbound-stages/guardian-activation-intercept.test.ts +8 -21
- package/src/runtime/routes/inbound-stages/guardian-activation-intercept.ts +3 -14
- package/src/runtime/routes/index.ts +0 -2
- package/src/runtime/routes/llm-context-normalization.ts +0 -83
- package/src/runtime/routes/mcp-auth-routes.ts +19 -171
- package/src/runtime/routes/migration-rollback-routes.ts +3 -4
- package/src/runtime/routes/migration-routes.ts +1 -4
- package/src/runtime/routes/subagents-routes.ts +0 -5
- package/src/runtime/routes/surface-action-routes.ts +56 -42
- package/src/runtime/services/__tests__/conversation-serializer.test.ts +0 -1
- package/src/runtime/services/conversation-serializer.ts +9 -7
- package/src/runtime/tool-grant-request-helper.ts +3 -3
- package/src/runtime/trust-verdict-consumer.ts +9 -85
- package/src/runtime/verification-outbound-actions.ts +18 -18
- package/src/signals/user-message.ts +0 -16
- package/src/subagent/manager.ts +0 -9
- package/src/subagent/types.ts +3 -3
- package/src/telemetry/types.ts +1 -34
- package/src/telemetry/usage-telemetry-reporter.test.ts +2 -3
- package/src/telemetry/usage-telemetry-reporter.ts +3 -87
- package/src/tools/ask-question/ask-question-tool.test.ts +0 -29
- package/src/tools/ask-question/ask-question-tool.ts +0 -13
- package/src/tools/executor.ts +4 -4
- package/src/tools/registry.ts +0 -18
- package/src/tools/shared/filesystem/path-policy.ts +5 -12
- package/src/tools/tool-approval-handler.ts +1 -1
- package/src/tools/tool-defaults.ts +2 -9
- package/src/tools/tool-manifest.ts +0 -3
- package/src/tools/types.ts +2 -17
- package/src/tools/workspace-tools/loader.ts +244 -348
- package/src/util/errors.ts +1 -26
- package/src/util/platform.ts +0 -5
- package/src/workflows/library.test.ts +0 -140
- package/src/workflows/library.ts +28 -82
- package/src/workspace/migrations/017-seed-persona-dirs.ts +34 -3
- package/src/workspace/migrations/019-scope-journal-to-guardian.ts +24 -3
- package/src/workspace/migrations/048-remove-workspace-hooks.ts +66 -14
- package/src/workspace/migrations/registry.ts +0 -2
- package/node_modules/@vellumai/gateway-client/src/__tests__/guardian-delivery-contract.test.ts +0 -91
- package/node_modules/@vellumai/gateway-client/src/guardian-delivery-contract.ts +0 -48
- package/node_modules/@vellumai/service-contracts/src/__tests__/channels.test.ts +0 -28
- package/node_modules/@vellumai/service-contracts/src/channels.ts +0 -41
- package/src/__tests__/code-search-tool.test.ts +0 -585
- package/src/__tests__/guardian-expiry-notifier.test.ts +0 -282
- package/src/__tests__/mcp-config-secret-boundary.test.ts +0 -390
- package/src/__tests__/plugin-pipeline.test.ts +0 -96
- package/src/__tests__/sse-actor-principal-guardian-source.test.ts +0 -102
- package/src/__tests__/steer-on-enqueue-question.test.ts +0 -181
- package/src/__tests__/workspace-migration-111-prune-seeded-callsite-defaults.test.ts +0 -208
- package/src/agent/loop-exclusive-tool.test.ts +0 -150
- package/src/api/constants/sse-replay.ts +0 -41
- package/src/api/events/conversation-notice.ts +0 -26
- package/src/approvals/guardian-channel-delivery.ts +0 -30
- package/src/approvals/guardian-expiry-notifier.ts +0 -148
- package/src/cli/commands/memory/__tests__/worker.test.ts +0 -302
- package/src/cli/commands/memory/worker.ts +0 -175
- package/src/config/__tests__/loader-callsite-strip-fallback.test.ts +0 -143
- package/src/config/prune-seeded-callsite-defaults.ts +0 -110
- package/src/contacts/__tests__/contacts-write-revoke-relay.test.ts +0 -129
- package/src/contacts/__tests__/guardian-delivery-reader.test.ts +0 -312
- package/src/contacts/__tests__/member-write-relay.test.ts +0 -202
- package/src/contacts/guardian-delivery-reader.ts +0 -223
- package/src/contacts/member-write-relay.ts +0 -189
- package/src/daemon/conversation-notices.ts +0 -60
- package/src/daemon/handlers/__tests__/config-channels.test.ts +0 -225
- package/src/hooks/hook-loader.ts +0 -341
- package/src/mcp/mcp-header-store.ts +0 -134
- package/src/memory/__tests__/301-create-watchdog-events.test.ts +0 -110
- package/src/memory/__tests__/prompt-override.test.ts +0 -192
- package/src/memory/__tests__/watchdog-events-store.test.ts +0 -161
- package/src/memory/migrations/300-add-processing-started-at.ts +0 -30
- package/src/memory/migrations/301-create-watchdog-events.ts +0 -45
- package/src/memory/migrations/__tests__/209-strip-thinking-from-consolidated.test.ts +0 -224
- package/src/memory/prompt-override.ts +0 -129
- package/src/memory/steps.ts +0 -573
- package/src/memory/watchdog-events-store.ts +0 -87
- package/src/memory/worker-control.ts +0 -118
- package/src/memory/worker-process.ts +0 -72
- package/src/notifications/__tests__/connected-channels.test.ts +0 -114
- package/src/notifications/__tests__/destination-resolver.test.ts +0 -256
- package/src/onboarding/checkin-event.test.ts +0 -222
- package/src/onboarding/checkin-event.ts +0 -321
- package/src/onboarding/schedule-checkin.ts +0 -190
- package/src/plugins/defaults/advisor/__tests__/context-pack-gating.test.ts +0 -106
- package/src/plugins/defaults/advisor/__tests__/context-pack.test.ts +0 -60
- package/src/plugins/defaults/advisor/context-pack.ts +0 -288
- package/src/plugins/defaults/memory-v3-shadow/pool-select.test.ts +0 -146
- package/src/plugins/surface-import.ts +0 -121
- package/src/providers/openai/__tests__/api-error-normalization.test.ts +0 -321
- package/src/providers/openai/api-error-normalization.ts +0 -270
- package/src/runtime/__tests__/channel-verification-service.test.ts +0 -133
- package/src/runtime/__tests__/guardian-vellum-migration.test.ts +0 -181
- package/src/runtime/__tests__/is-guardian-bound-for-channel.test.ts +0 -66
- package/src/runtime/__tests__/local-principal-trust.test.ts +0 -164
- package/src/runtime/anchored-guardian.test.ts +0 -156
- package/src/runtime/anchored-guardian.ts +0 -135
- package/src/runtime/auth/__tests__/require-bound-guardian.test.ts +0 -99
- package/src/runtime/local-principal-trust.ts +0 -52
- package/src/runtime/routes/__tests__/contact-routes.test.ts +0 -212
- package/src/runtime/routes/__tests__/global-search-routes.test.ts +0 -93
- package/src/runtime/routes/onboarding-checkin-routes.ts +0 -86
- package/src/tools/filesystem/search.ts +0 -543
- package/src/util/telemetry-db-path.ts +0 -24
- package/src/workspace/migrations/111-prune-seeded-callsite-defaults.ts +0 -134
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
import type { DrizzleDb } from "../db-connection.js";
|
|
2
|
+
import { downJobDeferrals } from "./001-job-deferrals.js";
|
|
3
|
+
import { downMemoryEntityRelationDedup } from "./004-entity-relation-dedup.js";
|
|
4
|
+
import { downMemoryItemsFingerprintScopeUnique } from "./005-fingerprint-scope-unique.js";
|
|
5
|
+
import { downMemoryItemsScopeSaltedFingerprints } from "./006-scope-salted-fingerprints.js";
|
|
6
|
+
import { downAssistantIdToSelf } from "./007-assistant-id-to-self.js";
|
|
7
|
+
import { downRemoveAssistantIdColumns } from "./008-remove-assistant-id-columns.js";
|
|
8
|
+
import { downLlmUsageEventsDropAssistantId } from "./009-llm-usage-events-drop-assistant-id.js";
|
|
9
|
+
import { downBackfillInboxThreadState } from "./014-backfill-inbox-thread-state.js";
|
|
10
|
+
import { downDropActiveSearchIndex } from "./015-drop-active-search-index.js";
|
|
11
|
+
import { downNotificationTablesSchema } from "./019-notification-tables-schema-migration.js";
|
|
12
|
+
import { downRenameChannelToVellum } from "./020-rename-macos-ios-channel-to-vellum.js";
|
|
13
|
+
import { downEmbeddingVectorBlob } from "./024-embedding-vector-blob.js";
|
|
14
|
+
import { downEmbeddingsNullableVectorJson } from "./026a-embeddings-nullable-vector-json.js";
|
|
15
|
+
import { downNormalizePhoneIdentities } from "./036-normalize-phone-identities.js";
|
|
16
|
+
import { downBackfillGuardianPrincipalId } from "./126-backfill-guardian-principal-id.js";
|
|
17
|
+
import { downGuardianPrincipalIdNotNull } from "./127-guardian-principal-id-not-null.js";
|
|
18
|
+
import { downContactsNotesColumn } from "./134-contacts-notes-column.js";
|
|
19
|
+
import { downBackfillContactInteractionStats } from "./135-backfill-contact-interaction-stats.js";
|
|
20
|
+
import { downDropAssistantIdColumns } from "./136-drop-assistant-id-columns.js";
|
|
21
|
+
import { downBackfillUsageCacheAccounting } from "./140-backfill-usage-cache-accounting.js";
|
|
22
|
+
import { downRenameVerificationTable } from "./141-rename-verification-table.js";
|
|
23
|
+
import { downRenameVerificationSessionIdColumn } from "./142-rename-verification-session-id-column.js";
|
|
24
|
+
import { downRenameGuardianVerificationValues } from "./143-rename-guardian-verification-values.js";
|
|
25
|
+
import { downRenameVoiceToPhone } from "./144-rename-voice-to-phone.js";
|
|
26
|
+
import { migrateDropAccountsTableDown } from "./145-drop-accounts-table.js";
|
|
27
|
+
import { migrateRemindersToSchedulesDown } from "./147-migrate-reminders-to-schedules.js";
|
|
28
|
+
import { migrateDropRemindersTableDown } from "./148-drop-reminders-table.js";
|
|
29
|
+
import { migrateOAuthAppsClientSecretPathDown } from "./150-oauth-apps-client-secret-path.js";
|
|
30
|
+
import {
|
|
31
|
+
migrateGuardianTimestampsEpochMsDown,
|
|
32
|
+
migrateGuardianTimestampsRebuildDown,
|
|
33
|
+
} from "./162-guardian-timestamps-epoch-ms.js";
|
|
34
|
+
import { migrateRenameGmailProviderKeyToGoogleDown } from "./169-rename-gmail-provider-key-to-google.js";
|
|
35
|
+
import { migrateRenameThreadStartersTableDown } from "./174-rename-thread-starters-table.js";
|
|
36
|
+
import { migrateDropCapabilityCardStateDown } from "./176-drop-capability-card-state.js";
|
|
37
|
+
import { migrateBackfillInlineAttachmentsToDiskDown } from "./180-backfill-inline-attachments-to-disk.js";
|
|
38
|
+
import { migrateRenameThreadStartersCheckpointsDown } from "./181-rename-thread-starters-checkpoints.js";
|
|
39
|
+
import { migrateBackfillAudioAttachmentMimeTypesDown } from "./191-backfill-audio-attachment-mime-types.js";
|
|
40
|
+
import { migrateAddSourceTypeColumnsDown } from "./193-add-source-type-columns.js";
|
|
41
|
+
import { migrateStripIntegrationPrefixFromProviderKeysDown } from "./196-strip-integration-prefix-from-provider-keys.js";
|
|
42
|
+
import { migrateRenameMemoryGraphTypeValuesDown } from "./204-rename-memory-graph-type-values.js";
|
|
43
|
+
import { migrateScrubCorruptedImageAttachmentsDown } from "./206-scrub-corrupted-image-attachments.js";
|
|
44
|
+
import { downConversationHostAccess } from "./217-conversation-host-access.js";
|
|
45
|
+
import { downNormalizeUserFileByPrincipal } from "./220-normalize-user-file-by-principal.js";
|
|
46
|
+
import { downActivationState } from "./232-activation-state.js";
|
|
47
|
+
import { downMemoryV2ActivationLogs } from "./234-memory-v2-activation-logs.js";
|
|
48
|
+
import { downSlackCompactionWatermark } from "./235-slack-compaction-watermark.js";
|
|
49
|
+
import { downToolInvocationsMatchedRuleId } from "./236-tool-invocations-matched-rule-id.js";
|
|
50
|
+
import { downHeartbeatRuns } from "./237-heartbeat-runs.js";
|
|
51
|
+
import { downNormalizeSlackExternalContent } from "./249-normalize-slack-external-content.js";
|
|
52
|
+
import { downA2ATasks } from "./251-a2a-tasks.js";
|
|
53
|
+
import { downExternalConversationBindingChatName } from "./254-external-conversation-binding-chat-name.js";
|
|
54
|
+
import { downMemoryV2InjectionEvents } from "./256-memory-v2-injection-events.js";
|
|
55
|
+
import { downConversationCleanedAt } from "./259-conversation-cleaned-at.js";
|
|
56
|
+
import { downRenameCleanedAt } from "./260-rename-cleaned-at.js";
|
|
57
|
+
import { downLlmUsageAddRawUsage } from "./261-llm-usage-add-raw-usage.js";
|
|
58
|
+
import { downMemoryV3Coactivation } from "./262-memory-v3-coactivation.js";
|
|
59
|
+
import { downMemoryV3AutoEdges } from "./263-memory-v3-auto-edges.js";
|
|
60
|
+
import { downScheduleDescription } from "./270-schedule-description.js";
|
|
61
|
+
|
|
62
|
+
export interface MigrationRegistryEntry {
|
|
63
|
+
/** The checkpoint key written to memory_checkpoints on completion. */
|
|
64
|
+
key: string;
|
|
65
|
+
/**
|
|
66
|
+
* The name of the migration step function (as registered in db-init's step
|
|
67
|
+
* array). The step runner writes `step:${stepName}` checkpoints — this field
|
|
68
|
+
* maps registry entries to those step checkpoints for validation and rollback.
|
|
69
|
+
*/
|
|
70
|
+
stepName: string;
|
|
71
|
+
/** Monotonic version number used for ordering assertions. */
|
|
72
|
+
version: number;
|
|
73
|
+
/** Keys of other migrations that must complete before this one runs. */
|
|
74
|
+
dependsOn?: string[];
|
|
75
|
+
/** Human-readable description for diagnostics and future authorship guidance. */
|
|
76
|
+
description: string;
|
|
77
|
+
/** Reverse the migration. Must be idempotent — safe to re-run. */
|
|
78
|
+
down: (database: DrizzleDb) => void;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// Central registry of all checkpoint-based one-shot migrations. Each entry
|
|
83
|
+
// carries a monotonic version number (for documentation / ordering assertions)
|
|
84
|
+
// and an optional list of prerequisite checkpoint keys that must already be
|
|
85
|
+
// completed before this migration runs.
|
|
86
|
+
//
|
|
87
|
+
// Migrations that use pure DDL guards (CREATE TABLE IF NOT EXISTS, index
|
|
88
|
+
// presence checks, ALTER TABLE ADD COLUMN try/catch) are inherently idempotent
|
|
89
|
+
// and do not need entries here — they are safe to re-run on every startup.
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
|
|
92
|
+
export const MIGRATION_REGISTRY: MigrationRegistryEntry[] = [
|
|
93
|
+
{
|
|
94
|
+
key: "migration_job_deferrals",
|
|
95
|
+
stepName: "migrateJobDeferrals",
|
|
96
|
+
version: 1,
|
|
97
|
+
description:
|
|
98
|
+
"Reconcile legacy deferral history from attempts column into deferrals column",
|
|
99
|
+
down: downJobDeferrals,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
key: "migration_memory_entity_relations_dedup_v1",
|
|
103
|
+
stepName: "migrateMemoryEntityRelationDedup",
|
|
104
|
+
version: 2,
|
|
105
|
+
description:
|
|
106
|
+
"Deduplicate entity relation edges before enforcing the (source, target, relation) unique index",
|
|
107
|
+
down: downMemoryEntityRelationDedup,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
key: "migration_memory_items_fingerprint_scope_unique_v1",
|
|
111
|
+
stepName: "migrateMemoryItemsFingerprintScopeUnique",
|
|
112
|
+
version: 3,
|
|
113
|
+
description:
|
|
114
|
+
"Replace column-level UNIQUE on fingerprint with compound (fingerprint, scope_id) unique index",
|
|
115
|
+
down: downMemoryItemsFingerprintScopeUnique,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: "migration_memory_items_scope_salted_fingerprints_v1",
|
|
119
|
+
stepName: "migrateMemoryItemsScopeSaltedFingerprints",
|
|
120
|
+
version: 4,
|
|
121
|
+
dependsOn: ["migration_memory_items_fingerprint_scope_unique_v1"],
|
|
122
|
+
description:
|
|
123
|
+
"Recompute memory item fingerprints to include scope_id prefix after schema change",
|
|
124
|
+
down: downMemoryItemsScopeSaltedFingerprints,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
key: "migration_normalize_assistant_id_to_self_v1",
|
|
128
|
+
stepName: "migrateAssistantIdToSelf",
|
|
129
|
+
version: 5,
|
|
130
|
+
description:
|
|
131
|
+
'Normalize all assistant_id values in scoped tables to the implicit "self" single-tenant identity',
|
|
132
|
+
down: downAssistantIdToSelf,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
key: "migration_remove_assistant_id_columns_v1",
|
|
136
|
+
stepName: "migrateRemoveAssistantIdColumns",
|
|
137
|
+
version: 6,
|
|
138
|
+
dependsOn: ["migration_normalize_assistant_id_to_self_v1"],
|
|
139
|
+
description:
|
|
140
|
+
"Rebuild four tables to drop the assistant_id column after normalization",
|
|
141
|
+
down: downRemoveAssistantIdColumns,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
key: "migration_remove_assistant_id_lue_v1",
|
|
145
|
+
stepName: "migrateLlmUsageEventsDropAssistantId",
|
|
146
|
+
version: 7,
|
|
147
|
+
dependsOn: ["migration_normalize_assistant_id_to_self_v1"],
|
|
148
|
+
description:
|
|
149
|
+
"Remove assistant_id column from llm_usage_events (separate checkpoint from the four-table migration)",
|
|
150
|
+
down: downLlmUsageEventsDropAssistantId,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
key: "backfill_inbox_thread_state_from_bindings",
|
|
154
|
+
stepName: "createAssistantInboxTables",
|
|
155
|
+
version: 8,
|
|
156
|
+
description:
|
|
157
|
+
"Seed assistant_inbox_thread_state from external_conversation_bindings",
|
|
158
|
+
down: downBackfillInboxThreadState,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
key: "drop_active_search_index_v1",
|
|
162
|
+
stepName: "createCoreIndexes",
|
|
163
|
+
version: 9,
|
|
164
|
+
description:
|
|
165
|
+
"Drop old idx_memory_items_active_search so it can be recreated with updated covering columns",
|
|
166
|
+
down: downDropActiveSearchIndex,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
key: "migration_notification_tables_schema_v1",
|
|
170
|
+
stepName: "createNotificationTables",
|
|
171
|
+
version: 10,
|
|
172
|
+
description:
|
|
173
|
+
"Drop legacy enum-based notification tables so they can be recreated with the new signal-contract schema",
|
|
174
|
+
down: downNotificationTablesSchema,
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
key: "migration_rename_macos_ios_channel_to_vellum_v1",
|
|
178
|
+
stepName: "migrateRenameChannelToVellum",
|
|
179
|
+
version: 11,
|
|
180
|
+
description:
|
|
181
|
+
"Rename macos and ios channel identifiers to vellum across all tables",
|
|
182
|
+
down: downRenameChannelToVellum,
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
key: "migration_embedding_vector_blob_v1",
|
|
186
|
+
stepName: "migrateEmbeddingVectorBlob",
|
|
187
|
+
version: 12,
|
|
188
|
+
description:
|
|
189
|
+
"Add vector_blob BLOB column to memory_embeddings and backfill from vector_json for compact binary storage",
|
|
190
|
+
down: downEmbeddingVectorBlob,
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
key: "migration_embeddings_nullable_vector_json_v1",
|
|
194
|
+
stepName: "migrateEmbeddingsNullableVectorJson",
|
|
195
|
+
version: 13,
|
|
196
|
+
dependsOn: ["migration_embedding_vector_blob_v1"],
|
|
197
|
+
description:
|
|
198
|
+
"Rebuild memory_embeddings to make vector_json nullable (pre-100 DBs had NOT NULL)",
|
|
199
|
+
down: downEmbeddingsNullableVectorJson,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
key: "migration_normalize_phone_identities_v1",
|
|
203
|
+
stepName: "migrateNormalizePhoneIdentities",
|
|
204
|
+
version: 14,
|
|
205
|
+
description:
|
|
206
|
+
"Normalize phone-like identity fields to E.164 format across guardian bindings, verification challenges, canonical requests, ingress members, and rate limits",
|
|
207
|
+
down: downNormalizePhoneIdentities,
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
key: "migration_backfill_guardian_principal_id_v3",
|
|
211
|
+
stepName: "migrateBackfillGuardianPrincipalId",
|
|
212
|
+
version: 15,
|
|
213
|
+
description:
|
|
214
|
+
"Backfill guardianPrincipalId for existing channel_guardian_bindings and canonical_guardian_requests rows, expire unresolvable pending requests",
|
|
215
|
+
down: downBackfillGuardianPrincipalId,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
key: "migration_guardian_principal_id_not_null_v1",
|
|
219
|
+
stepName: "migrateGuardianPrincipalIdNotNull",
|
|
220
|
+
version: 16,
|
|
221
|
+
dependsOn: ["migration_backfill_guardian_principal_id_v3"],
|
|
222
|
+
description:
|
|
223
|
+
"Enforce NOT NULL on channel_guardian_bindings.guardian_principal_id after backfill",
|
|
224
|
+
down: downGuardianPrincipalIdNotNull,
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
key: "migration_contacts_notes_column_v1",
|
|
228
|
+
stepName: "migrateContactsNotesColumn",
|
|
229
|
+
version: 17,
|
|
230
|
+
description:
|
|
231
|
+
"Consolidate relationship/importance/response_expectation/preferred_tone into a single notes TEXT column, then drop the legacy columns",
|
|
232
|
+
down: downContactsNotesColumn,
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
key: "backfill_contact_interaction_stats",
|
|
236
|
+
stepName: "migrateBackfillContactInteractionStats",
|
|
237
|
+
version: 18,
|
|
238
|
+
description:
|
|
239
|
+
"Backfill contacts.last_interaction from the max lastSeenAt across each contact's channels",
|
|
240
|
+
down: downBackfillContactInteractionStats,
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
key: "migration_drop_assistant_id_columns_v1",
|
|
244
|
+
stepName: "migrateDropAssistantIdColumns",
|
|
245
|
+
version: 19,
|
|
246
|
+
dependsOn: ["migration_normalize_assistant_id_to_self_v1"],
|
|
247
|
+
description:
|
|
248
|
+
"Drop assistant_id columns from all 16 daemon tables after normalization to single-tenant identity",
|
|
249
|
+
down: downDropAssistantIdColumns,
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
key: "migration_backfill_usage_cache_accounting_v1",
|
|
253
|
+
stepName: "migrateBackfillUsageCacheAccounting",
|
|
254
|
+
version: 20,
|
|
255
|
+
description:
|
|
256
|
+
"Backfill historical Anthropic llm_usage_events rows from llm_request_logs with cache-aware pricing",
|
|
257
|
+
down: downBackfillUsageCacheAccounting,
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
key: "migration_rename_verification_table_v1",
|
|
261
|
+
stepName: "migrateRenameVerificationTable",
|
|
262
|
+
version: 21,
|
|
263
|
+
description:
|
|
264
|
+
"Rename channel_guardian_verification_challenges table to channel_verification_sessions and update indexes",
|
|
265
|
+
down: downRenameVerificationTable,
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
key: "migration_rename_verification_session_id_column_v1",
|
|
269
|
+
stepName: "migrateRenameVerificationSessionIdColumn",
|
|
270
|
+
version: 22,
|
|
271
|
+
description:
|
|
272
|
+
"Rename guardian_verification_session_id column in call_sessions to verification_session_id",
|
|
273
|
+
down: downRenameVerificationSessionIdColumn,
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
key: "migration_rename_guardian_verification_values_v1",
|
|
277
|
+
stepName: "migrateRenameGuardianVerificationValues",
|
|
278
|
+
version: 23,
|
|
279
|
+
description:
|
|
280
|
+
"Rename persisted guardian_verification call_mode and guardian_voice_verification_* event_type values to drop the guardian_ prefix",
|
|
281
|
+
down: downRenameGuardianVerificationValues,
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
key: "migration_rename_voice_to_phone_v1",
|
|
285
|
+
stepName: "migrateRenameVoiceToPhone",
|
|
286
|
+
version: 24,
|
|
287
|
+
description:
|
|
288
|
+
'Rename stored "voice" channel values to "phone" across all tables with channel text columns',
|
|
289
|
+
down: downRenameVoiceToPhone,
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
key: "migration_drop_accounts_table_v1",
|
|
293
|
+
stepName: "migrateDropAccountsTable",
|
|
294
|
+
version: 25,
|
|
295
|
+
description:
|
|
296
|
+
"Drop the unused legacy accounts table and its leftover indexes after account_manage removal",
|
|
297
|
+
down: migrateDropAccountsTableDown,
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
key: "migration_reminders_to_schedules_v1",
|
|
301
|
+
stepName: "migrateRemindersToSchedules",
|
|
302
|
+
version: 26,
|
|
303
|
+
description:
|
|
304
|
+
"Copy all existing reminders into cron_jobs as one-shot schedules with correct status and field mapping",
|
|
305
|
+
down: migrateRemindersToSchedulesDown,
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
key: "migration_drop_reminders_table_v1",
|
|
309
|
+
stepName: "migrateDropRemindersTable",
|
|
310
|
+
version: 27,
|
|
311
|
+
dependsOn: ["migration_reminders_to_schedules_v1"],
|
|
312
|
+
description:
|
|
313
|
+
"Drop the legacy reminders table and its index after data migration to cron_jobs",
|
|
314
|
+
down: migrateDropRemindersTableDown,
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
key: "migration_oauth_apps_client_secret_path_v1",
|
|
318
|
+
stepName: "migrateOAuthAppsClientSecretPath",
|
|
319
|
+
version: 28,
|
|
320
|
+
description:
|
|
321
|
+
"Add client_secret_credential_path column to oauth_apps and backfill existing rows with convention-based paths",
|
|
322
|
+
down: migrateOAuthAppsClientSecretPathDown,
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
key: "migration_guardian_timestamps_epoch_ms_v1",
|
|
326
|
+
stepName: "migrateGuardianTimestampsEpochMs",
|
|
327
|
+
version: 29,
|
|
328
|
+
description:
|
|
329
|
+
"Convert guardian table timestamps from ISO 8601 text to epoch ms integers for consistency with all other tables",
|
|
330
|
+
down: migrateGuardianTimestampsEpochMsDown,
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
key: "migration_guardian_timestamps_rebuild_v1",
|
|
334
|
+
stepName: "migrateGuardianTimestampsEpochMs",
|
|
335
|
+
version: 30,
|
|
336
|
+
dependsOn: ["migration_guardian_timestamps_epoch_ms_v1"],
|
|
337
|
+
description:
|
|
338
|
+
"Rebuild guardian tables so timestamp columns have INTEGER affinity instead of TEXT",
|
|
339
|
+
down: migrateGuardianTimestampsRebuildDown,
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
key: "migration_rename_gmail_provider_key_to_google_v1",
|
|
343
|
+
stepName: "migrateRenameGmailProviderKeyToGoogle",
|
|
344
|
+
version: 31,
|
|
345
|
+
description:
|
|
346
|
+
"Rename integration:gmail provider key to integration:google across oauth_providers, oauth_apps, and oauth_connections",
|
|
347
|
+
down: migrateRenameGmailProviderKeyToGoogleDown,
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
key: "migration_rename_thread_starters_table_v1",
|
|
351
|
+
stepName: "migrateRenameThreadStartersTable",
|
|
352
|
+
version: 32,
|
|
353
|
+
description:
|
|
354
|
+
"Rename thread_starters table to conversation_starters and recreate indexes with new names",
|
|
355
|
+
down: migrateRenameThreadStartersTableDown,
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
key: "migration_drop_capability_card_state_v1",
|
|
359
|
+
stepName: "migrateDropCapabilityCardState",
|
|
360
|
+
version: 33,
|
|
361
|
+
dependsOn: ["migration_rename_thread_starters_table_v1"],
|
|
362
|
+
description:
|
|
363
|
+
"Remove deleted capability-card rows, jobs, checkpoints, and category state",
|
|
364
|
+
down: migrateDropCapabilityCardStateDown,
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
key: "migration_backfill_inline_attachments_v1",
|
|
368
|
+
stepName: "migrateBackfillInlineAttachmentsToDisk",
|
|
369
|
+
version: 34,
|
|
370
|
+
description:
|
|
371
|
+
"Backfill existing inline base64 attachments to on-disk storage and clear dataBase64",
|
|
372
|
+
down: migrateBackfillInlineAttachmentsToDiskDown,
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
key: "migration_rename_thread_starters_checkpoints_v1",
|
|
376
|
+
stepName: "migrateRenameThreadStartersCheckpoints",
|
|
377
|
+
version: 35,
|
|
378
|
+
dependsOn: ["migration_rename_thread_starters_table_v1"],
|
|
379
|
+
description:
|
|
380
|
+
"Rename checkpoint keys from thread_starters: to conversation_starters: prefix so renamed code paths find existing generation state",
|
|
381
|
+
down: migrateRenameThreadStartersCheckpointsDown,
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
key: "migration_backfill_audio_attachment_mime_types_v1",
|
|
385
|
+
stepName: "migrateBackfillAudioAttachmentMimeTypes",
|
|
386
|
+
version: 36,
|
|
387
|
+
description:
|
|
388
|
+
"Backfill correct MIME types for audio attachments stored as application/octet-stream due to missing extension map entries",
|
|
389
|
+
down: migrateBackfillAudioAttachmentMimeTypesDown,
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
key: "migration_add_source_type_columns_v1",
|
|
393
|
+
stepName: "migrateAddSourceTypeColumns",
|
|
394
|
+
version: 37,
|
|
395
|
+
description:
|
|
396
|
+
"Add source_type and source_message_role columns to memory_items with backfill from verification_state and source messages",
|
|
397
|
+
down: migrateAddSourceTypeColumnsDown,
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
key: "migration_strip_integration_prefix_from_provider_keys_v1",
|
|
401
|
+
stepName: "migrateStripIntegrationPrefixFromProviderKeys",
|
|
402
|
+
version: 38,
|
|
403
|
+
description:
|
|
404
|
+
"Strip integration: prefix from provider_key across oauth_providers, oauth_apps, and oauth_connections",
|
|
405
|
+
down: migrateStripIntegrationPrefixFromProviderKeysDown,
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
key: "migration_rename_memory_graph_type_values_v1",
|
|
409
|
+
stepName: "migrateRenameMemoryGraphTypeValues",
|
|
410
|
+
version: 39,
|
|
411
|
+
description:
|
|
412
|
+
"Rename legacy memory graph node type values: style → behavioral, relationship → semantic",
|
|
413
|
+
down: migrateRenameMemoryGraphTypeValuesDown,
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
key: "migration_scrub_corrupted_image_attachments_v1",
|
|
417
|
+
stepName: "migrateScrubCorruptedImageAttachments",
|
|
418
|
+
version: 40,
|
|
419
|
+
description:
|
|
420
|
+
"Remove image attachments containing HTML error pages instead of image data",
|
|
421
|
+
down: migrateScrubCorruptedImageAttachmentsDown,
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
key: "migration_conversation_host_access_v1",
|
|
425
|
+
stepName: "migrateConversationHostAccess",
|
|
426
|
+
version: 41,
|
|
427
|
+
description:
|
|
428
|
+
"Add a host_access column to conversations so computer access is persisted per conversation with a safe default of disabled",
|
|
429
|
+
down: downConversationHostAccess,
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
key: "migration_normalize_user_file_by_principal_v1",
|
|
433
|
+
stepName: "migrateNormalizeUserFileByPrincipal",
|
|
434
|
+
version: 42,
|
|
435
|
+
description:
|
|
436
|
+
"Normalize contacts.user_file across rows sharing the same principal_id so every channel for one principal loads the same users/<slug>.md persona and journal directory",
|
|
437
|
+
down: downNormalizeUserFileByPrincipal,
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
key: "migration_activation_state_v1",
|
|
441
|
+
stepName: "migrateActivationState",
|
|
442
|
+
version: 43,
|
|
443
|
+
description: "Create activation_state table for memory v2",
|
|
444
|
+
down: downActivationState,
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
key: "migration_memory_v2_activation_logs_v1",
|
|
448
|
+
stepName: "migrateMemoryV2ActivationLogs",
|
|
449
|
+
version: 44,
|
|
450
|
+
description:
|
|
451
|
+
"Create memory_v2_activation_logs table for per-turn v2 activation telemetry consumed by the LLM Context Inspector",
|
|
452
|
+
down: downMemoryV2ActivationLogs,
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
key: "migration_slack_compaction_watermark_v1",
|
|
456
|
+
stepName: "migrateSlackCompactionWatermark",
|
|
457
|
+
version: 45,
|
|
458
|
+
description:
|
|
459
|
+
"Add Slack-specific compaction watermark columns to conversations",
|
|
460
|
+
down: downSlackCompactionWatermark,
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
key: "migration_tool_invocations_matched_trust_rule_id_v1",
|
|
464
|
+
stepName: "migrateToolInvocationsMatchedRuleId",
|
|
465
|
+
version: 46,
|
|
466
|
+
description:
|
|
467
|
+
"Add matched_trust_rule_id column to tool_invocations for trust rule audit and rule editor UI",
|
|
468
|
+
down: downToolInvocationsMatchedRuleId,
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
key: "migration_heartbeat_runs_v1",
|
|
472
|
+
stepName: "migrateHeartbeatRuns",
|
|
473
|
+
version: 47,
|
|
474
|
+
description:
|
|
475
|
+
"Create heartbeat_runs table for tracking heartbeat execution lifecycle with CAS state transitions",
|
|
476
|
+
down: downHeartbeatRuns,
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
key: "migration_normalize_slack_external_content_v1",
|
|
480
|
+
stepName: "migrateNormalizeSlackExternalContent",
|
|
481
|
+
version: 48,
|
|
482
|
+
description:
|
|
483
|
+
"Normalize legacy persisted Slack external_content wrappers back to raw message content",
|
|
484
|
+
down: downNormalizeSlackExternalContent,
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
key: "migration_a2a_tasks_v1",
|
|
488
|
+
stepName: "migrateA2ATasks",
|
|
489
|
+
version: 49,
|
|
490
|
+
description:
|
|
491
|
+
"Create a2a_tasks table for tracking A2A request/response lifecycle",
|
|
492
|
+
down: downA2ATasks,
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
key: "migration_external_conversation_binding_chat_name_v1",
|
|
496
|
+
stepName: "migrateExternalConversationBindingChatName",
|
|
497
|
+
version: 50,
|
|
498
|
+
description:
|
|
499
|
+
"Add external_chat_name to external conversation bindings for channel footer metadata",
|
|
500
|
+
down: downExternalConversationBindingChatName,
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
key: "migration_memory_v2_injection_events_v1",
|
|
504
|
+
stepName: "migrateMemoryV2InjectionEvents",
|
|
505
|
+
version: 51,
|
|
506
|
+
dependsOn: ["migration_memory_v2_activation_logs_v1"],
|
|
507
|
+
description:
|
|
508
|
+
"Create memory_v2_injection_events table and backfill from activation logs for EMA-based tier 2 routing",
|
|
509
|
+
down: downMemoryV2InjectionEvents,
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
key: "migration_conversation_cleaned_at_v1",
|
|
513
|
+
stepName: "migrateConversationCleanedAt",
|
|
514
|
+
version: 52,
|
|
515
|
+
description:
|
|
516
|
+
"Add cleaned_at timestamp to conversations so /clean survives reload and forks inherit conditionally on fork point",
|
|
517
|
+
down: downConversationCleanedAt,
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
key: "migration_rename_cleaned_at_v1",
|
|
521
|
+
stepName: "migrateRenameCleanedAt",
|
|
522
|
+
version: 53,
|
|
523
|
+
dependsOn: ["migration_conversation_cleaned_at_v1"],
|
|
524
|
+
description:
|
|
525
|
+
"Rename conversations.cleaned_at to history_stripped_at; the marker now records any injection-strip event (including compaction), not just /clean",
|
|
526
|
+
down: downRenameCleanedAt,
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
key: "migration_llm_usage_add_raw_usage_v1",
|
|
530
|
+
stepName: "migrateLlmUsageAddRawUsage",
|
|
531
|
+
version: 54,
|
|
532
|
+
description:
|
|
533
|
+
"Add raw_usage TEXT column to llm_usage_events for storing the provider's untouched usage block as JSON (Anthropic TTL breakdown, OpenAI prompt/completion token details, etc.) so downstream consumers can extract provider-specific detail without per-field schema changes",
|
|
534
|
+
down: downLlmUsageAddRawUsage,
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
key: "migration_memory_v3_coactivation_v1",
|
|
538
|
+
stepName: "migrateMemoryV3Coactivation",
|
|
539
|
+
version: 55,
|
|
540
|
+
description:
|
|
541
|
+
"Create memory_v3_coactivation table — append-only log of pass-1 → pass-N co-activation pairs (gradient signal) emitted by the v3 retrieval loop and reconciled later by edge-learning",
|
|
542
|
+
down: downMemoryV3Coactivation,
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
key: "migration_memory_v3_auto_edges_v1",
|
|
546
|
+
stepName: "migrateMemoryV3AutoEdges",
|
|
547
|
+
version: 56,
|
|
548
|
+
description:
|
|
549
|
+
"Create memory_v3_auto_edges table — weighted, decaying learned association graph (distinct from curated edges:) accrued by the edge-learning job from used co-activations and consumed above-threshold by edge expansion",
|
|
550
|
+
down: downMemoryV3AutoEdges,
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
key: "migration_schedule_description_backfill_v1",
|
|
554
|
+
stepName: "migrateScheduleDescription",
|
|
555
|
+
version: 57,
|
|
556
|
+
description:
|
|
557
|
+
"Backfill authored schedule descriptions for legacy non-defer schedules from their existing names",
|
|
558
|
+
down: downScheduleDescription,
|
|
559
|
+
},
|
|
560
|
+
];
|
|
561
|
+
|
|
562
|
+
export function getMaxMigrationVersion(): number {
|
|
563
|
+
return Math.max(...MIGRATION_REGISTRY.map((e) => e.version));
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export interface MigrationValidationResult {
|
|
567
|
+
/** Keys of migrations whose checkpoint has value 'started' — started but never completed. */
|
|
568
|
+
crashed: string[];
|
|
569
|
+
/** Pairs where a completed migration's declared prerequisite is missing from checkpoints. */
|
|
570
|
+
dependencyViolations: Array<{ migration: string; missingDependency: string }>;
|
|
571
|
+
/** Checkpoint keys present in the database but absent from the migration registry — likely from a newer version. */
|
|
572
|
+
unknownCheckpoints: string[];
|
|
573
|
+
}
|