@vellumai/assistant 0.10.2 → 0.10.3-dev.202606252046.9075fd5
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 +20 -0
- package/docs/workspace-tools.md +42 -33
- package/eslint-rules/cli-no-daemon-internals.js +6 -0
- package/node_modules/@vellumai/gateway-client/src/__tests__/guardian-delivery-contract.test.ts +91 -0
- package/node_modules/@vellumai/gateway-client/src/__tests__/trust-verdict-contract.test.ts +31 -0
- package/node_modules/@vellumai/gateway-client/src/gateway-ipc-contracts.ts +44 -0
- package/node_modules/@vellumai/gateway-client/src/guardian-delivery-contract.ts +48 -0
- package/node_modules/@vellumai/gateway-client/src/index.ts +14 -0
- package/node_modules/@vellumai/gateway-client/src/trust-verdict-contract.ts +17 -0
- package/node_modules/@vellumai/service-contracts/package.json +1 -0
- package/node_modules/@vellumai/service-contracts/src/__tests__/channels.test.ts +28 -0
- package/node_modules/@vellumai/service-contracts/src/channels.ts +41 -0
- package/node_modules/@vellumai/service-contracts/src/index.ts +1 -0
- package/openapi.yaml +196 -56
- package/package.json +4 -1
- package/scripts/test.sh +36 -15
- package/src/__tests__/actor-token-service.test.ts +36 -14
- package/src/__tests__/actor-trust-resolver-address-fallback.test.ts +83 -31
- package/src/__tests__/agent-loop-override-profile.test.ts +1 -0
- package/src/__tests__/agent-wake-disk-pressure-callsite.test.ts +2 -0
- package/src/__tests__/agent-wake-override-profile.test.ts +2 -0
- package/src/__tests__/annotate-activity-metadata.test.ts +2 -0
- package/src/__tests__/annotate-risk-options.test.ts +2 -0
- package/src/__tests__/approval-cascade.test.ts +2 -0
- package/src/__tests__/assistant-attachments.test.ts +42 -0
- package/src/__tests__/background-workers-disk-pressure.test.ts +2 -0
- package/src/__tests__/btw-routes.test.ts +2 -0
- package/src/__tests__/build-persisted-content.test.ts +2 -0
- package/src/__tests__/call-controller.test.ts +19 -0
- package/src/__tests__/channel-approval-routes.test.ts +21 -26
- package/src/__tests__/channel-delivery-store.test.ts +28 -0
- package/src/__tests__/channel-guardian.test.ts +164 -78
- package/src/__tests__/channel-inbound-disk-pressure.test.ts +11 -19
- package/src/__tests__/channel-reply-delivery.test.ts +2 -0
- package/src/__tests__/code-search-tool.test.ts +585 -0
- package/src/__tests__/compaction-events.test.ts +2 -0
- package/src/__tests__/compaction-ledger-store.test.ts +128 -0
- package/src/__tests__/compaction.benchmark.test.ts +2 -0
- package/src/__tests__/compactor-call-site-logging.test.ts +2 -0
- package/src/__tests__/compactor-low-watermark-cut.test.ts +2 -0
- package/src/__tests__/compactor-preserved-tail-count.test.ts +2 -0
- package/src/__tests__/compactor-summary-call-truncation.test.ts +2 -0
- package/src/__tests__/compactor-web-search-strip.test.ts +2 -0
- package/src/__tests__/config-loader-backfill.test.ts +123 -10
- package/src/__tests__/config-schema.test.ts +1 -0
- package/src/__tests__/confirmation-request-guardian-bridge.test.ts +31 -29
- package/src/__tests__/consult-deadline.test.ts +60 -0
- package/src/__tests__/contact-store-interaction-info.test.ts +156 -0
- package/src/__tests__/contact-store-user-file.test.ts +7 -10
- package/src/__tests__/contacts-relay-reads.test.ts +19 -24
- package/src/__tests__/contacts-write.test.ts +0 -2
- package/src/__tests__/conversation-abort-tool-results.test.ts +2 -0
- package/src/__tests__/conversation-agent-loop-disk-pressure.test.ts +2 -0
- package/src/__tests__/conversation-agent-loop-inference-profile.test.ts +2 -0
- package/src/__tests__/conversation-agent-loop-overflow.test.ts +2 -0
- package/src/__tests__/conversation-agent-loop.test.ts +134 -0
- package/src/__tests__/conversation-analysis-routes.test.ts +2 -0
- package/src/__tests__/conversation-app-control-lifecycle.test.ts +2 -0
- package/src/__tests__/conversation-attention-telegram.test.ts +9 -11
- package/src/__tests__/conversation-confirmation-signals.test.ts +2 -0
- package/src/__tests__/conversation-fork-crud.test.ts +354 -24
- package/src/__tests__/conversation-history-web-search.test.ts +2 -0
- package/src/__tests__/conversation-load-history-repair.test.ts +2 -0
- package/src/__tests__/conversation-load-history-stripped.test.ts +2 -0
- package/src/__tests__/conversation-pairing.test.ts +2 -0
- package/src/__tests__/conversation-process-app-control-preactivation.test.ts +2 -0
- package/src/__tests__/conversation-process-callsite.test.ts +2 -0
- package/src/__tests__/conversation-provider-retry-repair.test.ts +2 -0
- package/src/__tests__/conversation-queue.test.ts +91 -0
- package/src/__tests__/conversation-routes-guardian-reply.test.ts +14 -0
- package/src/__tests__/conversation-routes-slash-commands.test.ts +14 -0
- package/src/__tests__/conversation-slash-queue.test.ts +2 -0
- package/src/__tests__/conversation-slash-unknown.test.ts +2 -0
- package/src/__tests__/conversation-speed-override.test.ts +2 -0
- package/src/__tests__/conversation-surfaces-task-progress.test.ts +29 -0
- package/src/__tests__/conversation-title-service.test.ts +2 -0
- package/src/__tests__/conversation-tool-setup-attribution.test.ts +47 -0
- package/src/__tests__/conversation-usage.test.ts +2 -0
- package/src/__tests__/conversation-workspace-cache-state.test.ts +2 -0
- package/src/__tests__/conversation-workspace-injection.test.ts +2 -0
- package/src/__tests__/conversation-workspace-tool-tracking.test.ts +2 -0
- package/src/__tests__/credential-security-invariants.test.ts +1 -1
- package/src/__tests__/db-compaction-events-migration.test.ts +129 -0
- package/src/__tests__/db-migration-rollback.test.ts +205 -171
- package/src/__tests__/db-test-helpers.ts +5 -4
- package/src/__tests__/delete-propagation.test.ts +5 -3
- package/src/__tests__/deterministic-verification-control-plane.test.ts +4 -2
- package/src/__tests__/disk-pressure-guard.test.ts +41 -0
- package/src/__tests__/dm-backfill.test.ts +6 -4
- package/src/__tests__/dm-persistence.test.ts +2 -0
- package/src/__tests__/emit-signal-routing-intent.test.ts +7 -6
- package/src/__tests__/events-dev-bypass-actor.test.ts +7 -1
- package/src/__tests__/exploration-drift-hook.test.ts +3 -2
- package/src/__tests__/filing-service.test.ts +2 -0
- package/src/__tests__/guardian-binding-drift-heal.test.ts +104 -19
- package/src/__tests__/guardian-dispatch.test.ts +140 -1
- package/src/__tests__/guardian-expiry-notifier.test.ts +282 -0
- package/src/__tests__/guardian-outbound-http.test.ts +13 -0
- package/src/__tests__/guardian-routing-state.test.ts +6 -10
- package/src/__tests__/heartbeat-disk-pressure.test.ts +2 -0
- package/src/__tests__/heartbeat-service.test.ts +2 -0
- package/src/__tests__/helpers/channel-test-adapter.ts +46 -19
- package/src/__tests__/helpers/create-guardian-binding.ts +15 -23
- package/src/__tests__/helpers/mock-logger.ts +1 -0
- package/src/__tests__/helpers/seed-contact-channel.ts +96 -0
- package/src/__tests__/host-app-control-routes.test.ts +24 -30
- package/src/__tests__/host-bash-routes.test.ts +31 -41
- package/src/__tests__/host-browser-routes.test.ts +26 -32
- package/src/__tests__/host-cu-routes-targeted.test.ts +25 -33
- package/src/__tests__/host-file-routes-targeted.test.ts +40 -52
- package/src/__tests__/host-transfer-routes-targeted.test.ts +31 -43
- package/src/__tests__/http-user-message-parity.test.ts +290 -8
- package/src/__tests__/inbound-invite-redemption.test.ts +115 -10
- package/src/__tests__/inbound-slack-persistence.test.ts +2 -0
- package/src/__tests__/invite-redemption-service.test.ts +471 -53
- package/src/__tests__/invite-routes-http.test.ts +34 -0
- package/src/__tests__/invite-service-ipc.test.ts +65 -2
- package/src/__tests__/llm-context-normalization.test.ts +105 -0
- package/src/__tests__/llm-request-log-error-payload.test.ts +71 -9
- package/src/__tests__/llm-usage-store.test.ts +25 -0
- package/src/__tests__/mcp-config-secret-boundary.test.ts +392 -0
- package/src/__tests__/mcp-health-check.test.ts +2 -1
- package/src/__tests__/media-stream-server-integration.test.ts +127 -0
- package/src/__tests__/memory-retrieval-hook.test.ts +2 -0
- package/src/__tests__/messaging-send-tool.test.ts +2 -0
- package/src/__tests__/migration-import-from-url.test.ts +2 -2
- package/src/__tests__/mtime-cache.test.ts +275 -5
- package/src/__tests__/native-web-search.test.ts +2 -0
- package/src/__tests__/non-member-access-request.test.ts +191 -17
- package/src/__tests__/notification-broadcaster.test.ts +4 -0
- package/src/__tests__/notification-decision-recipient-context.test.ts +33 -32
- package/src/__tests__/notification-deep-link.test.ts +6 -0
- package/src/__tests__/notification-guardian-path.test.ts +19 -0
- package/src/__tests__/onboarding-persona-write.test.ts +52 -22
- package/src/__tests__/openai-provider.test.ts +22 -12
- package/src/__tests__/openai-responses-provider.test.ts +12 -2
- package/src/__tests__/outbound-slack-persistence.test.ts +2 -0
- package/src/__tests__/pending-interactions-resolved-event.test.ts +7 -4
- package/src/__tests__/persist-onboarding-artifacts.test.ts +1 -0
- package/src/__tests__/persistence-secret-redaction.test.ts +2 -0
- package/src/__tests__/persona-resolver.test.ts +75 -45
- package/src/__tests__/plugin-bootstrap.test.ts +21 -83
- package/src/__tests__/plugin-disabled-state.test.ts +190 -0
- package/src/__tests__/plugin-pipeline.test.ts +96 -0
- package/src/__tests__/plugin-route-contribution.test.ts +6 -19
- package/src/__tests__/plugin-tool-contribution.test.ts +5 -20
- package/src/__tests__/plugin-types.test.ts +2 -4
- package/src/__tests__/process-message-background-slack.test.ts +2 -0
- package/src/__tests__/process-message-display-content.test.ts +2 -0
- package/src/__tests__/provider-error-scenarios.test.ts +5 -4
- package/src/__tests__/provider-usage-tracking.test.ts +39 -0
- package/src/__tests__/reaction-intercept-cold-cache-warm.test.ts +135 -0
- package/src/__tests__/reaction-intercept-member-verdict-warm.test.ts +158 -0
- package/src/__tests__/reaction-persistence.test.ts +51 -4
- package/src/__tests__/regenerate-fire-and-forget-trace.test.ts +2 -0
- package/src/__tests__/registry.test.ts +4 -1
- package/src/__tests__/relay-server.test.ts +758 -32
- package/src/__tests__/runtime-attachment-metadata.test.ts +9 -12
- package/src/__tests__/secret-ingress-http.test.ts +14 -0
- package/src/__tests__/send-endpoint-busy.test.ts +30 -8
- package/src/__tests__/settings-routes.test.ts +32 -0
- package/src/__tests__/skills.test.ts +44 -0
- package/src/__tests__/slack-inbound-verification.test.ts +47 -2
- package/src/__tests__/sse-actor-principal-guardian-source.test.ts +79 -0
- package/src/__tests__/steer-on-enqueue-question.test.ts +181 -0
- package/src/__tests__/stt-hints.test.ts +49 -15
- package/src/__tests__/subagent-detail.test.ts +27 -0
- package/src/__tests__/subagent-disposal.test.ts +65 -0
- package/src/__tests__/subagent-fork-prompt-role.test.ts +195 -0
- package/src/__tests__/subagent-fork-spawn.test.ts +6 -7
- package/src/__tests__/subagent-notify-parent.test.ts +2 -0
- package/src/__tests__/subagent-role-registry.test.ts +24 -6
- package/src/__tests__/subagent-spawn-and-await.test.ts +546 -0
- package/src/__tests__/subagent-spawn-tool-fork.test.ts +2 -0
- package/src/__tests__/subagent-tools.test.ts +398 -1
- package/src/__tests__/suggestion-routes.test.ts +2 -0
- package/src/__tests__/thread-backfill.test.ts +3 -3
- package/src/__tests__/title-generate-hook.test.ts +2 -0
- package/src/__tests__/tool-executor-lifecycle-events.test.ts +2 -0
- package/src/__tests__/tool-executor.test.ts +16 -11
- package/src/__tests__/tool-preview-lifecycle.test.ts +2 -0
- package/src/__tests__/tool-result-metadata-plumbing.test.ts +2 -0
- package/src/__tests__/tool-start-timestamp.test.ts +2 -0
- package/src/__tests__/trusted-contact-approval-notifier.test.ts +37 -51
- package/src/__tests__/trusted-contact-inline-approval-integration.test.ts +12 -12
- package/src/__tests__/trusted-contact-lifecycle-notifications.test.ts +9 -7
- package/src/__tests__/trusted-contact-multichannel.test.ts +16 -7
- package/src/__tests__/trusted-contact-verification.test.ts +79 -54
- package/src/__tests__/twilio-routes.test.ts +96 -0
- package/src/__tests__/ui-file-upload-surface.test.ts +86 -0
- package/src/__tests__/verification-control-plane-policy.test.ts +2 -0
- package/src/__tests__/voice-guardian-cold-cache-warm.test.ts +137 -0
- package/src/__tests__/voice-invite-redemption.test.ts +216 -20
- package/src/__tests__/web-search-backend-failure.test.ts +2 -0
- package/src/__tests__/workspace-migration-102-preserve-heartbeat-enabled-for-existing-workspaces.test.ts +3 -3
- package/src/__tests__/workspace-migration-111-prune-seeded-callsite-defaults.test.ts +208 -0
- package/src/__tests__/workspace-migration-112-remove-advisor-callsite-override.test.ts +170 -0
- package/src/__tests__/workspace-migration-drop-user-md.test.ts +196 -238
- package/src/__tests__/workspace-migration-remove-hooks.test.ts +14 -35
- package/src/__tests__/workspace-tool-loader.test.ts +195 -2
- package/src/a2a/__tests__/e2e-a2a-channel.test.ts +35 -47
- package/src/agent/loop-exclusive-tool.test.ts +154 -0
- package/src/agent/loop-native-web-search.test.ts +200 -0
- package/src/agent/loop.ts +164 -1
- package/src/api/constants/sse-replay.ts +41 -0
- package/src/api/events/conversation-notice.ts +26 -0
- package/src/api/index.ts +19 -1
- package/src/api/responses/llm-request-log-entry.ts +29 -0
- package/src/api/responses/subagent-detail.ts +17 -0
- package/src/api/surfaces.ts +39 -3
- package/src/approvals/guardian-channel-delivery.ts +30 -0
- package/src/approvals/guardian-expiry-notifier.ts +148 -0
- package/src/approvals/guardian-request-resolvers.ts +17 -15
- package/src/calls/__tests__/relay-setup-router.test.ts +267 -17
- package/src/calls/call-domain.ts +3 -3
- package/src/calls/guardian-dispatch.ts +14 -9
- package/src/calls/inbound-trust-reader.ts +24 -2
- package/src/calls/media-stream-server.ts +21 -0
- package/src/calls/relay-access-wait.ts +6 -6
- package/src/calls/relay-server.ts +188 -51
- package/src/calls/relay-setup-router.ts +47 -17
- package/src/calls/relay-verification.ts +4 -4
- package/src/calls/stt-hints.ts +9 -12
- package/src/calls/twilio-routes.ts +14 -4
- package/src/channels/types.ts +10 -20
- package/src/cli/commands/__tests__/cache.test.ts +8 -1
- package/src/cli/commands/__tests__/conversations-slack.test.ts +1 -0
- package/src/cli/commands/cache.ts +194 -181
- package/src/cli/commands/contacts.ts +10 -7
- package/src/cli/commands/db/__tests__/repair.test.ts +6 -5
- package/src/cli/commands/db/status.ts +37 -1
- package/src/cli/commands/mcp.ts +252 -218
- package/src/cli/commands/memory/__tests__/worker.test.ts +432 -0
- package/src/cli/commands/memory/index.ts +2 -0
- package/src/cli/commands/memory/worker.ts +242 -0
- package/src/cli/commands/plugins.ts +125 -13
- package/src/cli/lib/__tests__/install-from-github.test.ts +102 -0
- package/src/cli/lib/__tests__/list-installed-plugins.test.ts +160 -1
- package/src/cli/lib/__tests__/publish-plugin.test.ts +404 -0
- package/src/cli/lib/list-installed-plugins.ts +179 -1
- package/src/cli/lib/publish-plugin.ts +633 -0
- package/src/config/__tests__/loader-callsite-strip-fallback.test.ts +143 -0
- package/src/config/__tests__/sync-gated-profiles.test.ts +16 -10
- package/src/config/bundled-skills/contacts/tools/contact-merge.ts +27 -17
- package/src/config/bundled-skills/contacts/tools/contact-search.ts +13 -3
- package/src/config/bundled-skills/subagent/SKILL.md +17 -2
- package/src/config/bundled-skills/subagent/TOOLS.json +5 -4
- package/src/config/call-site-defaults.ts +0 -6
- package/src/config/feature-flag-registry.json +5 -13
- package/src/config/llm-resolver.ts +0 -3
- package/src/config/loader.ts +38 -5
- package/src/config/prune-seeded-callsite-defaults.ts +110 -0
- package/src/config/schemas/__tests__/memory-v3.test.ts +1 -0
- package/src/config/schemas/call-site-catalog.ts +0 -7
- package/src/config/schemas/heartbeat.ts +2 -5
- package/src/config/schemas/llm.ts +3 -12
- package/src/config/schemas/memory-lifecycle.ts +12 -0
- package/src/config/schemas/memory-v3.ts +7 -0
- package/src/config/schemas/memory.ts +4 -0
- package/src/config/schemas/timeouts.ts +8 -0
- package/src/config/seed-inference-profiles.ts +30 -34
- package/src/config/skills.ts +27 -5
- package/src/config/sync-gated-profiles.ts +12 -16
- package/src/contacts/__tests__/contacts-write-revoke-relay.test.ts +128 -0
- package/src/contacts/__tests__/guardian-delivery-reader.test.ts +312 -0
- package/src/contacts/__tests__/member-write-relay.test.ts +226 -0
- package/src/contacts/contact-store.ts +27 -237
- package/src/contacts/contacts-write.ts +18 -55
- package/src/contacts/gateway-channel-read.ts +51 -0
- package/src/contacts/guardian-delivery-reader.ts +223 -0
- package/src/contacts/member-write-relay.ts +183 -0
- package/src/contacts/types.ts +3 -15
- package/src/daemon/__tests__/conversation-tool-setup-exclude.test.ts +35 -0
- package/src/daemon/__tests__/conversation-tool-setup.test.ts +0 -44
- package/src/daemon/assistant-attachments.ts +27 -4
- package/src/daemon/conversation-agent-loop.ts +28 -0
- package/src/daemon/conversation-notices.ts +60 -0
- package/src/daemon/conversation-process.ts +35 -16
- package/src/daemon/conversation-surfaces.ts +111 -38
- package/src/daemon/conversation-tool-setup.ts +71 -30
- package/src/daemon/conversation.ts +23 -1
- package/src/daemon/disk-pressure-guard.ts +12 -2
- package/src/daemon/event-loop-watchdog.ts +28 -1
- package/src/daemon/external-plugins-bootstrap.ts +17 -41
- package/src/daemon/handlers/__tests__/config-a2a-accept.test.ts +0 -1
- package/src/daemon/handlers/__tests__/config-a2a-complete.test.ts +0 -2
- package/src/daemon/handlers/__tests__/config-a2a-redeem.test.ts +25 -2
- package/src/daemon/handlers/__tests__/config-channels.test.ts +220 -0
- package/src/daemon/handlers/config-a2a.ts +6 -14
- package/src/daemon/handlers/config-channels.ts +67 -26
- package/src/daemon/handlers/conversations.ts +77 -0
- package/src/daemon/lifecycle.ts +16 -0
- package/src/daemon/mcp-reload-service.ts +10 -0
- package/src/daemon/memory-v2-startup.test.ts +72 -0
- package/src/daemon/memory-v2-startup.ts +87 -19
- package/src/daemon/message-types/conversations.ts +2 -0
- package/src/daemon/message-types/surfaces.ts +12 -12
- package/src/daemon/server.ts +0 -4
- package/src/daemon/shutdown-handlers.ts +20 -0
- package/src/daemon/tool-setup-types.ts +9 -0
- package/src/heartbeat/heartbeat-service.ts +5 -0
- package/src/home/relationship-state-writer.ts +5 -0
- package/src/hooks/hook-loader.ts +341 -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 +1 -0
- package/src/mcp/client.ts +15 -1
- package/src/mcp/mcp-auth-orchestrator.ts +6 -1
- package/src/mcp/mcp-header-store.ts +134 -0
- package/src/mcp/mcp-oauth-provider.ts +19 -8
- package/src/memory/__tests__/301-create-watchdog-events.test.ts +110 -0
- package/src/memory/__tests__/memory-retrospective-job.test.ts +8 -0
- package/src/memory/__tests__/prompt-override.test.ts +192 -0
- package/src/memory/__tests__/watchdog-events-store.test.ts +161 -0
- package/src/memory/compaction-ledger-store.ts +107 -0
- package/src/memory/conversation-crud.ts +129 -61
- package/src/memory/db-connection.ts +22 -3
- package/src/memory/db-init.ts +37 -503
- package/src/memory/db-singleton.ts +6 -4
- package/src/memory/jobs-worker.ts +104 -0
- package/src/memory/llm-request-log-store.ts +26 -1
- package/src/memory/llm-usage-store.ts +48 -20
- package/src/memory/memory-retrospective-job.ts +14 -8
- package/src/memory/migrations/209-strip-thinking-from-consolidated.ts +152 -56
- package/src/memory/migrations/300-add-processing-started-at.ts +30 -0
- package/src/memory/migrations/301-create-watchdog-events.ts +45 -0
- package/src/memory/migrations/302-create-compaction-events.ts +107 -0
- package/src/memory/migrations/__tests__/209-strip-thinking-from-consolidated.test.ts +297 -0
- package/src/memory/migrations/__tests__/run-migrations.test.ts +2 -2
- package/src/memory/migrations/run-migrations.ts +106 -10
- package/src/memory/migrations/validate-migration-state.ts +105 -67
- package/src/memory/prompt-override.ts +129 -0
- package/src/memory/schema/contacts.ts +6 -2
- package/src/memory/schema/conversations.ts +37 -0
- package/src/memory/schema/infrastructure.ts +20 -0
- package/src/memory/steps.ts +1294 -0
- package/src/memory/v2/__tests__/cli-command-store.test.ts +25 -0
- package/src/memory/v2/__tests__/skill-store.test.ts +80 -0
- package/src/memory/v2/cli-command-store.ts +75 -38
- package/src/memory/v2/prompts/consolidation.ts +13 -82
- package/src/memory/v2/prompts/router.ts +21 -93
- package/src/memory/v2/skill-store.ts +68 -31
- package/src/memory/watchdog-events-store.ts +87 -0
- package/src/memory/worker-control.ts +204 -0
- package/src/memory/worker-process.ts +89 -0
- package/src/messaging/channel-binding-metadata.ts +31 -0
- package/src/messaging/provider-types.ts +8 -0
- package/src/messaging/providers/slack/binding-metadata.ts +60 -0
- package/src/notifications/__tests__/broadcaster.test.ts +8 -8
- package/src/notifications/__tests__/connected-channels.test.ts +86 -0
- package/src/notifications/__tests__/decision-engine.test.ts +78 -9
- package/src/notifications/__tests__/destination-resolver.test.ts +151 -0
- package/src/notifications/broadcaster.ts +8 -1
- package/src/notifications/decision-engine.ts +15 -7
- package/src/notifications/destination-resolver.ts +53 -25
- package/src/notifications/emit-signal.ts +34 -15
- package/src/onboarding/checkin-event.test.ts +222 -0
- package/src/onboarding/checkin-event.ts +321 -0
- package/src/onboarding/schedule-checkin.ts +190 -0
- package/src/permissions/question-prompter.test.ts +1 -1
- package/src/permissions/question-prompter.ts +7 -4
- package/src/plugin-api/index.ts +12 -12
- package/src/plugin-api/types.ts +12 -14
- package/src/plugin-api/vision-support.test.ts +28 -4
- package/src/plugin-api/vision-support.ts +66 -31
- package/src/plugins/defaults/empty-response/hooks/post-model-call.ts +2 -2
- package/src/plugins/defaults/empty-response/hooks/stop.ts +2 -2
- package/src/plugins/defaults/exploration-drift/hooks/post-tool-use.ts +4 -3
- package/src/plugins/defaults/history-repair/hooks/post-model-call.ts +2 -2
- package/src/plugins/defaults/history-repair/hooks/stop.ts +2 -2
- package/src/plugins/defaults/history-repair/hooks/user-prompt-submit.ts +2 -2
- package/src/plugins/defaults/image-fallback/__tests__/image-fallback.test.ts +47 -7
- package/src/plugins/defaults/image-fallback/hooks/post-tool-use.ts +12 -13
- package/src/plugins/defaults/image-fallback/hooks/user-prompt-submit.ts +14 -22
- package/src/plugins/defaults/image-fallback/src/caption-blocks.ts +42 -11
- package/src/plugins/defaults/image-recovery/hooks/post-model-call.ts +2 -2
- package/src/plugins/defaults/image-recovery/hooks/stop.ts +2 -2
- package/src/plugins/defaults/index.ts +0 -35
- package/src/plugins/defaults/max-tokens-continue/hooks/post-model-call.ts +2 -2
- package/src/plugins/defaults/max-tokens-continue/hooks/stop.ts +2 -2
- package/src/plugins/defaults/memory-retrieval/hooks/post-compact.ts +2 -2
- package/src/plugins/defaults/memory-retrieval/hooks/user-prompt-submit.ts +2 -2
- package/src/plugins/defaults/memory-v3-shadow/__tests__/injection.test.ts +33 -3
- package/src/plugins/defaults/memory-v3-shadow/__tests__/pool-select.test.ts +48 -4
- package/src/plugins/defaults/memory-v3-shadow/__tests__/shadow-plugin.test.ts +4 -8
- package/src/plugins/defaults/memory-v3-shadow/hooks/post-compact.ts +2 -2
- package/src/plugins/defaults/memory-v3-shadow/hooks/user-prompt-submit.ts +2 -2
- package/src/plugins/defaults/memory-v3-shadow/injector.ts +43 -15
- package/src/plugins/defaults/memory-v3-shadow/orchestrate.ts +11 -2
- package/src/plugins/defaults/memory-v3-shadow/pool-select.test.ts +146 -0
- package/src/plugins/defaults/memory-v3-shadow/pool-select.ts +77 -13
- package/src/plugins/defaults/memory-v3-shadow/shadow-plugin.ts +12 -11
- package/src/plugins/defaults/surface-completion-nudge/hooks/post-model-call.ts +2 -2
- package/src/plugins/defaults/surface-completion-nudge/hooks/stop.ts +2 -2
- package/src/plugins/defaults/task-progress-nudge/hooks/post-tool-use.ts +2 -2
- package/src/plugins/defaults/title-generate/hooks/stop.ts +2 -2
- package/src/plugins/defaults/title-generate/hooks/user-prompt-submit.ts +2 -2
- package/src/plugins/defaults/tool-error/hooks/post-tool-use.ts +2 -2
- package/src/plugins/defaults/tool-result-truncate/hooks/post-tool-use.ts +2 -2
- package/src/plugins/disabled-state.ts +31 -0
- package/src/plugins/external-plugin-loader.ts +2 -2
- package/src/plugins/mtime-cache.ts +186 -330
- package/src/plugins/pipeline.ts +111 -13
- package/src/plugins/registry.ts +59 -16
- package/src/plugins/surface-import.ts +121 -0
- package/src/plugins/types.ts +7 -9
- package/src/prompts/persona-resolver.ts +43 -11
- package/src/providers/anthropic/client.ts +5 -0
- package/src/providers/call-site-routing.ts +45 -0
- package/src/providers/model-catalog.ts +16 -0
- package/src/providers/openai/__tests__/api-error-normalization.test.ts +321 -0
- package/src/providers/openai/api-error-normalization.ts +270 -0
- package/src/providers/openai/chat-completions-provider.ts +37 -83
- package/src/providers/openai/responses-provider.ts +50 -46
- package/src/providers/openrouter/client.ts +5 -0
- package/src/providers/provider-send-message.ts +10 -0
- package/src/providers/ratelimit.ts +10 -0
- package/src/providers/registry.ts +1 -1
- package/src/providers/retry.ts +10 -0
- package/src/providers/types.ts +22 -0
- package/src/providers/usage-tracking.ts +10 -0
- package/src/runtime/__tests__/channel-verification-service.test.ts +133 -0
- package/src/runtime/__tests__/guardian-vellum-migration.test.ts +184 -0
- package/src/runtime/__tests__/is-guardian-bound-for-channel.test.ts +66 -0
- package/src/runtime/__tests__/local-principal-trust.test.ts +162 -0
- package/src/runtime/__tests__/member-verdict-cache.test.ts +119 -0
- package/src/runtime/__tests__/trust-verdict-consumer.test.ts +402 -123
- package/src/runtime/access-request-helper.ts +18 -39
- package/src/runtime/actor-trust-resolver.ts +46 -19
- package/src/runtime/anchored-guardian.test.ts +109 -0
- package/src/runtime/anchored-guardian.ts +86 -0
- package/src/runtime/assistant-event-hub.ts +1 -1
- package/src/runtime/assistant-stream-state.ts +9 -2
- package/src/runtime/auth/__tests__/require-bound-guardian.test.ts +99 -0
- package/src/runtime/auth/require-bound-guardian.ts +21 -11
- package/src/runtime/channel-verification-service.ts +56 -31
- package/src/runtime/confirmation-request-guardian-bridge.ts +3 -3
- package/src/runtime/guardian-vellum-migration.ts +69 -8
- package/src/runtime/invite-redemption-service.ts +213 -187
- package/src/runtime/local-actor-identity.test.ts +108 -0
- package/src/runtime/local-actor-identity.ts +85 -13
- package/src/runtime/local-principal-trust.ts +52 -0
- package/src/runtime/member-verdict-cache.ts +0 -0
- package/src/runtime/pending-interactions.ts +11 -1
- package/src/runtime/routes/__tests__/channel-verification-revoke.test.ts +56 -5
- package/src/runtime/routes/__tests__/channel-verification-routes.test.ts +1 -1
- package/src/runtime/routes/__tests__/contact-routes.test.ts +305 -0
- package/src/runtime/routes/__tests__/global-search-routes.test.ts +92 -0
- package/src/runtime/routes/__tests__/http-adapter-actor-header.test.ts +129 -0
- package/src/runtime/routes/__tests__/surface-action-routes.test.ts +188 -0
- package/src/runtime/routes/browser-routes.ts +1 -1
- package/src/runtime/routes/canonical-guardian-expiry-sweep.ts +13 -5
- package/src/runtime/routes/channel-verification-routes.ts +3 -3
- package/src/runtime/routes/contact-routes.ts +48 -57
- package/src/runtime/routes/conversation-cli-routes.ts +4 -5
- package/src/runtime/routes/conversation-list-routes.ts +4 -7
- package/src/runtime/routes/conversation-query-routes.ts +72 -0
- package/src/runtime/routes/conversation-routes.ts +84 -85
- package/src/runtime/routes/events-routes.ts +2 -2
- package/src/runtime/routes/global-search-routes.ts +3 -1
- package/src/runtime/routes/guardian-action-routes.ts +4 -5
- package/src/runtime/routes/host-app-control-routes.ts +5 -4
- package/src/runtime/routes/host-bash-routes.ts +5 -4
- package/src/runtime/routes/host-browser-routes.ts +9 -11
- package/src/runtime/routes/host-cu-routes.ts +5 -4
- package/src/runtime/routes/host-file-routes.ts +5 -4
- package/src/runtime/routes/host-transfer-routes.ts +6 -6
- package/src/runtime/routes/http-adapter.ts +16 -1
- package/src/runtime/routes/identity-routes.ts +3 -2
- package/src/runtime/routes/inbound-message-handler.ts +5 -5
- package/src/runtime/routes/inbound-stages/acl-enforcement.test.ts +97 -5
- package/src/runtime/routes/inbound-stages/acl-enforcement.ts +61 -59
- package/src/runtime/routes/inbound-stages/background-dispatch.ts +13 -5
- package/src/runtime/routes/inbound-stages/escalation-intercept.ts +7 -7
- package/src/runtime/routes/inbound-stages/guardian-activation-intercept.test.ts +21 -8
- package/src/runtime/routes/inbound-stages/guardian-activation-intercept.ts +14 -3
- package/src/runtime/routes/inbound-stages/reaction-intercept.ts +19 -0
- package/src/runtime/routes/index.ts +2 -0
- package/src/runtime/routes/llm-context-normalization.ts +83 -0
- package/src/runtime/routes/mcp-auth-routes.ts +171 -19
- package/src/runtime/routes/migration-rollback-routes.ts +4 -3
- package/src/runtime/routes/migration-routes.ts +4 -1
- package/src/runtime/routes/onboarding-checkin-routes.ts +86 -0
- package/src/runtime/routes/settings-routes.ts +8 -3
- package/src/runtime/routes/subagents-routes.ts +5 -0
- package/src/runtime/routes/surface-action-routes.ts +42 -56
- package/src/runtime/services/__tests__/conversation-serializer.test.ts +1 -0
- package/src/runtime/services/conversation-serializer.ts +13 -58
- package/src/runtime/tool-grant-request-helper.ts +3 -3
- package/src/runtime/trust-verdict-consumer.ts +111 -40
- package/src/runtime/verification-outbound-actions.ts +18 -18
- package/src/signals/user-message.ts +16 -0
- package/src/subagent/__tests__/consult-prompt.test.ts +35 -0
- package/src/{plugins/defaults/advisor/__tests__/transcript.test.ts → subagent/__tests__/consult-transcript.test.ts} +47 -10
- package/src/{plugins/defaults/advisor/steering.ts → subagent/consult-prompt.ts} +22 -32
- package/src/{plugins/defaults/advisor/transcript.ts → subagent/consult-transcript.ts} +18 -8
- package/src/subagent/index.ts +1 -1
- package/src/subagent/manager.ts +254 -33
- package/src/subagent/types.ts +11 -4
- package/src/telemetry/types.ts +34 -1
- package/src/telemetry/usage-telemetry-reporter.test.ts +3 -2
- package/src/telemetry/usage-telemetry-reporter.ts +87 -3
- package/src/tools/ask-question/ask-question-tool.test.ts +29 -0
- package/src/tools/ask-question/ask-question-tool.ts +13 -0
- package/src/tools/executor.ts +4 -4
- package/src/tools/filesystem/search.ts +543 -0
- package/src/tools/registry.ts +38 -0
- package/src/tools/shared/filesystem/path-policy.ts +12 -5
- package/src/tools/subagent/consult-deadline.ts +49 -0
- package/src/tools/subagent/spawn.ts +234 -5
- package/src/tools/tool-approval-handler.ts +1 -1
- package/src/tools/tool-defaults.ts +9 -2
- package/src/tools/tool-manifest.ts +3 -0
- package/src/tools/types.ts +131 -25
- package/src/tools/workspace-tools/loader.ts +348 -244
- package/src/util/errors.ts +26 -1
- package/src/util/logger.ts +9 -0
- package/src/util/platform.ts +19 -0
- package/src/util/telemetry-db-path.ts +24 -0
- package/src/workflows/library.test.ts +140 -0
- package/src/workflows/library.ts +82 -28
- package/src/workspace/migrations/017-seed-persona-dirs.ts +3 -34
- package/src/workspace/migrations/019-scope-journal-to-guardian.ts +3 -24
- package/src/workspace/migrations/031-drop-user-md.ts +232 -148
- package/src/workspace/migrations/048-remove-workspace-hooks.ts +14 -66
- package/src/workspace/migrations/111-prune-seeded-callsite-defaults.ts +134 -0
- package/src/workspace/migrations/112-remove-advisor-callsite-override.ts +64 -0
- package/src/workspace/migrations/registry.ts +4 -0
- package/src/__tests__/workspace-tools-watcher-flag.test.ts +0 -70
- package/src/daemon/workspace-tools-watcher.ts +0 -328
- package/src/memory/migrations/registry.ts +0 -573
- package/src/plugins/defaults/advisor/__tests__/advisor-gate.test.ts +0 -56
- package/src/plugins/defaults/advisor/__tests__/advisor-state-store.test.ts +0 -43
- package/src/plugins/defaults/advisor/__tests__/agent-loop-integration.test.ts +0 -137
- package/src/plugins/defaults/advisor/__tests__/consult.test.ts +0 -153
- package/src/plugins/defaults/advisor/__tests__/hooks.test.ts +0 -138
- package/src/plugins/defaults/advisor/advisor-gate.ts +0 -29
- package/src/plugins/defaults/advisor/advisor-state-store.ts +0 -94
- package/src/plugins/defaults/advisor/config.ts +0 -21
- package/src/plugins/defaults/advisor/consult.ts +0 -93
- package/src/plugins/defaults/advisor/hooks/post-model-call.ts +0 -34
- package/src/plugins/defaults/advisor/hooks/pre-model-call.ts +0 -30
- package/src/plugins/defaults/advisor/hooks/user-prompt-submit.ts +0 -19
- package/src/plugins/defaults/advisor/package.json +0 -14
- package/src/plugins/defaults/advisor/tools/advisor.ts +0 -65
- package/src/providers/openai/__tests__/api-error-detail.test.ts +0 -120
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import {
|
|
4
|
+
afterAll,
|
|
5
|
+
afterEach,
|
|
6
|
+
beforeEach,
|
|
7
|
+
describe,
|
|
8
|
+
expect,
|
|
9
|
+
mock,
|
|
10
|
+
test,
|
|
11
|
+
} from "bun:test";
|
|
12
|
+
|
|
13
|
+
const WORKSPACE_DIR = process.env.VELLUM_WORKSPACE_DIR!;
|
|
14
|
+
const CONFIG_PATH = join(WORKSPACE_DIR, "config.json");
|
|
15
|
+
|
|
16
|
+
function ensureTestDir(): void {
|
|
17
|
+
const dirs = [
|
|
18
|
+
WORKSPACE_DIR,
|
|
19
|
+
join(WORKSPACE_DIR, "data"),
|
|
20
|
+
join(WORKSPACE_DIR, "data", "memory"),
|
|
21
|
+
join(WORKSPACE_DIR, "data", "logs"),
|
|
22
|
+
];
|
|
23
|
+
for (const dir of dirs) {
|
|
24
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function makeLoggerStub(): Record<string, unknown> {
|
|
29
|
+
const stub: Record<string, unknown> = {};
|
|
30
|
+
for (const m of [
|
|
31
|
+
"info",
|
|
32
|
+
"warn",
|
|
33
|
+
"error",
|
|
34
|
+
"debug",
|
|
35
|
+
"trace",
|
|
36
|
+
"fatal",
|
|
37
|
+
"silent",
|
|
38
|
+
"child",
|
|
39
|
+
]) {
|
|
40
|
+
stub[m] = m === "child" ? () => makeLoggerStub() : () => {};
|
|
41
|
+
}
|
|
42
|
+
return stub;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
mock.module("../../util/logger.js", () => ({
|
|
46
|
+
getLogger: () => makeLoggerStub(),
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
afterAll(() => {
|
|
50
|
+
mock.restore();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
import { resolveCallSiteConfig } from "../llm-resolver.js";
|
|
54
|
+
import { invalidateConfigCache, loadConfig } from "../loader.js";
|
|
55
|
+
|
|
56
|
+
function writeConfig(obj: unknown): void {
|
|
57
|
+
writeFileSync(CONFIG_PATH, JSON.stringify(obj, null, 2) + "\n");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Base config where the active profile resolves to a DIFFERENT model than the
|
|
62
|
+
* `balanced` profile that the shipped `memoryV3SelectL2` call-site default
|
|
63
|
+
* points at. This lets each test distinguish the two failure modes:
|
|
64
|
+
* - call-site default applied (fixed) -> model "balanced-model"
|
|
65
|
+
* - silently downgraded to active -> model "active-model"
|
|
66
|
+
*/
|
|
67
|
+
function baseLlm(callSites: Record<string, unknown>): unknown {
|
|
68
|
+
return {
|
|
69
|
+
llm: {
|
|
70
|
+
default: { provider: "anthropic", model: "default-model" },
|
|
71
|
+
profiles: {
|
|
72
|
+
balanced: { provider: "anthropic", model: "balanced-model" },
|
|
73
|
+
speedy: { provider: "anthropic", model: "active-model" },
|
|
74
|
+
},
|
|
75
|
+
activeProfile: "speedy",
|
|
76
|
+
callSites,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
describe("config recovery prunes call-site overrides emptied by a strip", () => {
|
|
82
|
+
beforeEach(() => {
|
|
83
|
+
ensureTestDir();
|
|
84
|
+
if (existsSync(CONFIG_PATH)) rmSync(CONFIG_PATH, { force: true });
|
|
85
|
+
delete process.env.IS_PLATFORM;
|
|
86
|
+
invalidateConfigCache();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
afterEach(() => {
|
|
90
|
+
delete process.env.IS_PLATFORM;
|
|
91
|
+
if (existsSync(CONFIG_PATH)) rmSync(CONFIG_PATH, { force: true });
|
|
92
|
+
invalidateConfigCache();
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test("an undefined call-site profile ref falls back to the shipped default, not the active profile", () => {
|
|
96
|
+
// The `.profile` ref is invalid (no such profile), so schema recovery
|
|
97
|
+
// strips it. Before the fix this left `callSites.memoryV3SelectL2 = {}`,
|
|
98
|
+
// which the resolver treats as a present override and so skips the shipped
|
|
99
|
+
// `{profile:"balanced"}` default — silently resolving to the active profile.
|
|
100
|
+
writeConfig(baseLlm({ memoryV3SelectL2: { profile: "ghost-profile" } }));
|
|
101
|
+
|
|
102
|
+
const config = loadConfig();
|
|
103
|
+
|
|
104
|
+
// The emptied call-site entry must be pruned entirely, not left as `{}`.
|
|
105
|
+
expect(config.llm.callSites?.memoryV3SelectL2).toBeUndefined();
|
|
106
|
+
|
|
107
|
+
// Resolution now lands on the shipped call-site default (balanced), not the
|
|
108
|
+
// active profile ("active-model"), which is what the bug produced.
|
|
109
|
+
const resolved = resolveCallSiteConfig("memoryV3SelectL2", config.llm);
|
|
110
|
+
expect(resolved.model).toBe("balanced-model");
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test("a valid sibling call-site override survives while the invalid one is pruned", () => {
|
|
114
|
+
// memoryRouter -> balanced is valid and must be preserved; only the invalid
|
|
115
|
+
// memoryV3SelectL2 entry is pruned. Guards against over-pruning the parent.
|
|
116
|
+
writeConfig(
|
|
117
|
+
baseLlm({
|
|
118
|
+
memoryV3SelectL2: { profile: "missing" },
|
|
119
|
+
memoryRouter: { profile: "balanced" },
|
|
120
|
+
}),
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const config = loadConfig();
|
|
124
|
+
|
|
125
|
+
expect(config.llm.callSites?.memoryV3SelectL2).toBeUndefined();
|
|
126
|
+
expect(config.llm.callSites?.memoryRouter).toEqual({ profile: "balanced" });
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test("a partial override keeping other fields is not pruned", () => {
|
|
130
|
+
// Stripping the invalid `.profile` leaves a non-empty `{temperature:0.5}`,
|
|
131
|
+
// a legitimate user override the resolver should keep (and which therefore
|
|
132
|
+
// still shadows the shipped default per existing either/or semantics).
|
|
133
|
+
writeConfig(
|
|
134
|
+
baseLlm({ memoryV3SelectL2: { profile: "missing", temperature: 0.5 } }),
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
const config = loadConfig();
|
|
138
|
+
|
|
139
|
+
expect(config.llm.callSites?.memoryV3SelectL2).toEqual({
|
|
140
|
+
temperature: 0.5,
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
});
|
|
@@ -109,10 +109,13 @@ describe("reconcileFlagGatedProfiles", () => {
|
|
|
109
109
|
|
|
110
110
|
const raw = readConfig();
|
|
111
111
|
const osBeta = raw.llm.profiles["os-beta"]!;
|
|
112
|
-
expect(osBeta.model).toBe("
|
|
113
|
-
expect(osBeta.provider_connection).toBe("
|
|
112
|
+
expect(osBeta.model).toBe("MiniMaxAI/MiniMax-M3");
|
|
113
|
+
expect(osBeta.provider_connection).toBe("together-managed");
|
|
114
|
+
expect(osBeta.provider).toBe("together");
|
|
114
115
|
expect(osBeta.source).toBe("managed");
|
|
115
116
|
expect(osBeta.label).toBe("OS Beta");
|
|
117
|
+
expect(osBeta.effort).toBe("low");
|
|
118
|
+
expect(osBeta.topP).toBe(0.95);
|
|
116
119
|
|
|
117
120
|
const order = raw.llm.profileOrder;
|
|
118
121
|
expect(order.indexOf("os-beta")).toBe(order.indexOf("balanced") + 1);
|
|
@@ -128,6 +131,7 @@ describe("reconcileFlagGatedProfiles", () => {
|
|
|
128
131
|
expect(osBeta.status).toBe("disabled");
|
|
129
132
|
expect(osBeta.label).toBe("OS Beta (Managed)");
|
|
130
133
|
expect(osBeta.source).toBe("managed");
|
|
134
|
+
expect(osBeta.effort).toBe("low");
|
|
131
135
|
});
|
|
132
136
|
|
|
133
137
|
test("flag on is idempotent across repeated runs", () => {
|
|
@@ -149,7 +153,7 @@ describe("reconcileFlagGatedProfiles", () => {
|
|
|
149
153
|
const raw = readConfig();
|
|
150
154
|
raw.llm.profiles["os-beta"]!.label = "My OS Beta";
|
|
151
155
|
raw.llm.profiles["os-beta"]!.status = "disabled";
|
|
152
|
-
raw.llm.profiles["os-beta"]!.
|
|
156
|
+
raw.llm.profiles["os-beta"]!.topP = 0.8;
|
|
153
157
|
writeConfig(raw);
|
|
154
158
|
invalidateConfigCache();
|
|
155
159
|
|
|
@@ -158,8 +162,10 @@ describe("reconcileFlagGatedProfiles", () => {
|
|
|
158
162
|
const after = readConfig().llm.profiles["os-beta"]!;
|
|
159
163
|
expect(after.label).toBe("My OS Beta");
|
|
160
164
|
expect(after.status).toBe("disabled");
|
|
161
|
-
expect(after.
|
|
162
|
-
expect(after.model).toBe("
|
|
165
|
+
expect(after.topP).toBe(0.8);
|
|
166
|
+
expect(after.model).toBe("MiniMaxAI/MiniMax-M3");
|
|
167
|
+
expect(after.provider_connection).toBe("together-managed");
|
|
168
|
+
expect(after.effort).toBe("low");
|
|
163
169
|
});
|
|
164
170
|
|
|
165
171
|
test("flag off removes a managed os-beta and applies fallbacks", () => {
|
|
@@ -316,7 +322,7 @@ describe("reconcileFlagGatedProfiles", () => {
|
|
|
316
322
|
|
|
317
323
|
const raw = readConfig();
|
|
318
324
|
(raw.llm as Record<string, unknown>).callSites = {
|
|
319
|
-
|
|
325
|
+
inference: { profile: "os-beta", temperature: 0.3 },
|
|
320
326
|
};
|
|
321
327
|
writeConfig(raw);
|
|
322
328
|
invalidateConfigCache();
|
|
@@ -325,14 +331,14 @@ describe("reconcileFlagGatedProfiles", () => {
|
|
|
325
331
|
expect(reconcileFlagGatedProfiles()).toBe(true);
|
|
326
332
|
|
|
327
333
|
const after = readConfig();
|
|
328
|
-
const
|
|
334
|
+
const inference = (
|
|
329
335
|
after.llm as unknown as Record<
|
|
330
336
|
string,
|
|
331
337
|
Record<string, Record<string, unknown>>
|
|
332
338
|
>
|
|
333
|
-
).callSites.
|
|
334
|
-
expect(
|
|
335
|
-
expect(
|
|
339
|
+
).callSites.inference;
|
|
340
|
+
expect(inference.profile).toBeUndefined();
|
|
341
|
+
expect(inference.temperature).toBe(0.3);
|
|
336
342
|
|
|
337
343
|
expect(LLMSchema.safeParse(after.llm).success).toBe(true);
|
|
338
344
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ContactRead } from "@vellumai/gateway-client/gateway-ipc-contracts";
|
|
2
|
+
|
|
2
3
|
import { cliIpcCall } from "../../../../ipc/cli-client.js";
|
|
3
4
|
import { resolveGuardianName } from "../../../../prompts/user-reference.js";
|
|
4
5
|
import type {
|
|
@@ -6,6 +7,12 @@ import type {
|
|
|
6
7
|
ToolExecutionResult,
|
|
7
8
|
} from "../../../../tools/types.js";
|
|
8
9
|
|
|
10
|
+
function guardianAwareName(contact: Pick<ContactRead, "role" | "displayName">) {
|
|
11
|
+
return contact.role === "guardian"
|
|
12
|
+
? resolveGuardianName(contact.displayName)
|
|
13
|
+
: contact.displayName;
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
export async function executeContactMerge(
|
|
10
17
|
input: Record<string, unknown>,
|
|
11
18
|
_context: ToolContext,
|
|
@@ -22,10 +29,10 @@ export async function executeContactMerge(
|
|
|
22
29
|
|
|
23
30
|
// Validate both contacts exist before merging
|
|
24
31
|
const [keepRes, mergeRes] = await Promise.all([
|
|
25
|
-
cliIpcCall<{ contact:
|
|
32
|
+
cliIpcCall<{ contact: ContactRead }>("getContact", {
|
|
26
33
|
pathParams: { id: keepId },
|
|
27
34
|
}),
|
|
28
|
-
cliIpcCall<{ contact:
|
|
35
|
+
cliIpcCall<{ contact: ContactRead }>("getContact", {
|
|
29
36
|
pathParams: { id: mergeId },
|
|
30
37
|
}),
|
|
31
38
|
]);
|
|
@@ -42,7 +49,7 @@ export async function executeContactMerge(
|
|
|
42
49
|
|
|
43
50
|
const mergeResult = await cliIpcCall<{
|
|
44
51
|
ok: boolean;
|
|
45
|
-
contact:
|
|
52
|
+
contact: ContactRead;
|
|
46
53
|
}>("merge_contacts", {
|
|
47
54
|
body: { keepId, mergeId },
|
|
48
55
|
});
|
|
@@ -51,19 +58,22 @@ export async function executeContactMerge(
|
|
|
51
58
|
return { content: `Error: ${mergeResult.error}`, isError: true };
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
const mergedId = mergeResult.result!.contact.id;
|
|
62
|
+
|
|
63
|
+
// Re-read the surviving contact through the gateway-relayed read so role and
|
|
64
|
+
// interactionCount come from the gateway ContactRead.
|
|
65
|
+
const mergedRes = await cliIpcCall<{ contact: ContactRead }>("getContact", {
|
|
66
|
+
pathParams: { id: mergedId },
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (!mergedRes.ok) {
|
|
70
|
+
return { content: `Error: ${mergedRes.error}`, isError: true };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const merged = mergedRes.result!.contact;
|
|
74
|
+
const displayName = guardianAwareName(merged);
|
|
75
|
+
const keepName = guardianAwareName(keepContact);
|
|
76
|
+
const mergeName = guardianAwareName(mergeContact);
|
|
67
77
|
|
|
68
78
|
const channelList = merged.channels
|
|
69
79
|
.map(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ContactRead } from "@vellumai/gateway-client/gateway-ipc-contracts";
|
|
2
|
+
|
|
2
3
|
import { cliIpcCall } from "../../../../ipc/cli-client.js";
|
|
3
4
|
import { resolveGuardianName } from "../../../../prompts/user-reference.js";
|
|
4
5
|
import type {
|
|
@@ -6,7 +7,16 @@ import type {
|
|
|
6
7
|
ToolExecutionResult,
|
|
7
8
|
} from "../../../../tools/types.js";
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
// The search route may carry an optional per-channel `externalChatId` not modeled
|
|
11
|
+
// on the gateway `ContactRead` channel contract.
|
|
12
|
+
type SearchChannel = ContactRead["channels"][number] & {
|
|
13
|
+
externalChatId?: string | null;
|
|
14
|
+
};
|
|
15
|
+
type SearchContact = Omit<ContactRead, "channels"> & {
|
|
16
|
+
channels: SearchChannel[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function formatContactSummary(c: SearchContact): string {
|
|
10
20
|
const displayName =
|
|
11
21
|
c.role === "guardian" ? resolveGuardianName(c.displayName) : c.displayName;
|
|
12
22
|
const parts = [`- **${displayName}** (ID: ${c.id})`];
|
|
@@ -45,7 +55,7 @@ export async function executeContactSearch(
|
|
|
45
55
|
};
|
|
46
56
|
}
|
|
47
57
|
|
|
48
|
-
const res = await cliIpcCall<
|
|
58
|
+
const res = await cliIpcCall<SearchContact[]>("search_contacts", {
|
|
49
59
|
body: { query, channelAddress, channelType, limit },
|
|
50
60
|
});
|
|
51
61
|
|
|
@@ -39,10 +39,25 @@ Each subagent is spawned with a role that determines its tool access. Choose the
|
|
|
39
39
|
| `researcher` | `web_search`, `web_fetch`, `file_read`, `file_list`, `recall`, `notify_parent` | Information gathering, web research, codebase exploration, reading documentation |
|
|
40
40
|
| `coder` | `bash`, `file_read`, `file_write`, `file_edit`, `web_search`, `recall`, `notify_parent` | Code changes, file editing, running commands, build/test tasks |
|
|
41
41
|
| `planner` | `file_read`, `file_list`, `web_search`, `web_fetch`, `recall`, `notify_parent` | Analysis, planning, synthesizing information, reviewing approaches |
|
|
42
|
-
| `investigator` | `
|
|
42
|
+
| `investigator` | `code_search`, `file_read`, `file_list`, `web_search`, `web_fetch`, `recall`, `notify_parent` | Root-cause analysis: debugging, log forensics, tracing behavior across many files. Read-only search/read tools only (no shell): use `code_search` to grep file contents across directories, `file_list` to enumerate paths, `file_read` to read whole files and logs; returns a compact root-cause report |
|
|
43
|
+
| `advisor` | None (tool-less) | Read-only senior-advisor consult. Runs on a stronger model, inherits full parent context, and BLOCKS until it returns guidance |
|
|
43
44
|
|
|
44
45
|
All specialized roles (`researcher`, `coder`, `planner`) include `notify_parent` for mid-run communication with the parent.
|
|
45
46
|
|
|
47
|
+
## Consulting the Advisor
|
|
48
|
+
|
|
49
|
+
The `advisor` role is the one role you spawn on your own judgment, unprompted — you do NOT wait for the user to ask for a subagent. The other roles (`researcher`, `coder`, `planner`, `investigator`, `general`) stay delegation-driven: reach for them to offload work, typically when the user's request calls for it. The advisor is different: proactively consult it whenever the conditions below are met.
|
|
50
|
+
|
|
51
|
+
Orient yourself first (read the relevant files, understand the task), then consult the advisor:
|
|
52
|
+
|
|
53
|
+
- **Before you commit to an approach and start building** — to shape a plan when you don't have one, or to pressure-test and sharpen a plan you've already drafted.
|
|
54
|
+
- **When you get stuck or are weighing a change in direction.**
|
|
55
|
+
- **Once before you declare the task done.**
|
|
56
|
+
|
|
57
|
+
The consult is synchronous and read-only: spawning an `advisor` subagent BLOCKS until it returns guidance. It runs on a stronger model and inherits your full context, so it sees the task, your tool calls, and their results without you re-explaining. Give its guidance serious weight; only override it when primary-source evidence contradicts a specific claim — and say so when you do.
|
|
58
|
+
|
|
59
|
+
Spawn the advisor **alone** — do NOT batch the consult in the same turn as other tool calls (especially file edits, shell commands, or anything destructive or expensive). Tool calls you issue in the same turn run concurrently with the consult, so they would execute before you see its guidance. Consult the advisor by itself, read its guidance, then act.
|
|
60
|
+
|
|
46
61
|
## Parent Communication
|
|
47
62
|
|
|
48
63
|
Subagents use `notify_parent` to send messages to the parent conversation while still running. Each notification has an urgency level:
|
|
@@ -79,7 +94,7 @@ Set `inference_profile` to an `llm.profiles` key when a subagent should run unde
|
|
|
79
94
|
|
|
80
95
|
Forks are sub-agents that inherit the parent's full context -- messages, system prompt, and memory -- sharing the KV cache for near-free context inheritance. Use forks when the task benefits from knowing what you've been discussing; use a regular sub-agent when the task is self-contained.
|
|
81
96
|
|
|
82
|
-
**Key behaviors:** Forks
|
|
97
|
+
**Key behaviors:** Forks default to `general` role (the `role` parameter is ignored for forks), except the special `advisor` role, which is honored even as a fork. `send_result_to_user` defaults to `false`. Read fork output with `last_n: 1` to get only the final synthesis.
|
|
83
98
|
|
|
84
99
|
**When to fork vs regular sub-agent:**
|
|
85
100
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"tools": [
|
|
4
4
|
{
|
|
5
5
|
"name": "subagent_spawn",
|
|
6
|
-
"description": "Spawn an independent subagent to work on a task in parallel. The subagent runs autonomously and its results are reported back when complete.\n\nTwo modes:\n- **Regular sub-agent** (fork: false or omitted): Gets only the objective + context fields. Use for self-contained tasks with clear objectives. Can use scoped roles (researcher, coder, planner).\n- **Fork** (fork: true): Inherits full parent context (messages, system prompt, memory). Shares KV cache for near-free context inheritance. Use when the task benefits from knowing what you've been discussing.
|
|
6
|
+
"description": "Spawn an independent subagent to work on a task in parallel. The subagent runs autonomously and its results are reported back when complete.\n\nTwo modes:\n- **Regular sub-agent** (fork: false or omitted): Gets only the objective + context fields. Use for self-contained tasks with clear objectives. Can use scoped roles (researcher, coder, planner).\n- **Fork** (fork: true): Inherits full parent context (messages, system prompt, memory). Shares KV cache for near-free context inheritance. Use when the task benefits from knowing what you've been discussing. Defaults to general role (the 'advisor' role is the exception — it is honored as a fork). Results are internal by default (send_result_to_user: false). Read with last_n: 1 to get only the final synthesis.\n\nDecision heuristic: Does the task need to know what we've been talking about? Fork. Is it self-contained? Regular sub-agent.\n\nThe 'advisor' role is a synchronous, read-only \"consult a stronger advisor\" mode: it inherits your full context, has no tools, and BLOCKS until it returns focused strategic guidance in a single response.",
|
|
7
7
|
"category": "orchestration",
|
|
8
8
|
"risk": "low",
|
|
9
9
|
"input_schema": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"fork": {
|
|
25
25
|
"type": "boolean",
|
|
26
|
-
"description": "When true, the subagent inherits the parent's full context (messages, system prompt, memory) instead of receiving only the objective + context fields. Fork mode
|
|
26
|
+
"description": "When true, the subagent inherits the parent's full context (messages, system prompt, memory) instead of receiving only the objective + context fields. Fork mode defaults to 'general' role (the role parameter is ignored for forks), except the special 'advisor' role which is honored even as a fork, and defaults send_result_to_user to false. Use for tasks that benefit from the full conversational context."
|
|
27
27
|
},
|
|
28
28
|
"send_result_to_user": {
|
|
29
29
|
"type": "boolean",
|
|
@@ -36,9 +36,10 @@
|
|
|
36
36
|
"researcher",
|
|
37
37
|
"coder",
|
|
38
38
|
"planner",
|
|
39
|
-
"investigator"
|
|
39
|
+
"investigator",
|
|
40
|
+
"advisor"
|
|
40
41
|
],
|
|
41
|
-
"description": "Agent specialization that controls tool access. 'researcher': read-only (web, files, memory). 'coder': file and bash access. 'planner': read-only analysis. 'investigator': root-cause analysis — debugging, log forensics, tracing behavior across many files;
|
|
42
|
+
"description": "Agent specialization that controls tool access. 'researcher': read-only (web, files, memory). 'coder': file and bash access. 'planner': read-only analysis. 'investigator': root-cause analysis — debugging, log forensics, tracing behavior across many files; uses read-only search/read tools (code_search, file_read, file_list) with no shell access and returns a compact root-cause report. 'advisor': synchronous, read-only \"consult a stronger advisor\" — inherits full context, has no tools, and blocks until it returns focused strategic guidance. 'general': full access (default). Non-advisor roles are ignored when fork: true (forks default to general); the advisor role is honored even as a fork."
|
|
42
43
|
},
|
|
43
44
|
"inference_profile": {
|
|
44
45
|
"type": "string",
|
|
@@ -69,12 +69,6 @@ export const CALL_SITE_DEFAULTS: Record<LLMCallSite, CallSiteDefaultConfig> = {
|
|
|
69
69
|
meetConsentMonitor: { profile: "cost-optimized" },
|
|
70
70
|
meetChatOpportunity: { profile: "cost-optimized" },
|
|
71
71
|
inference: { profile: "cost-optimized" },
|
|
72
|
-
// The advisor consults the strongest managed profile (`frontier`, Opus),
|
|
73
|
-
// which seeding writes into `llm.advisorProfile` on boot and floats above this
|
|
74
|
-
// layer. This static fallback — used only when no `advisorProfile` resolves —
|
|
75
|
-
// stays on the always-reserved `quality-optimized` so it can never resolve to
|
|
76
|
-
// a user-owned profile that happens to be named `frontier`.
|
|
77
|
-
advisor: { profile: "quality-optimized" },
|
|
78
72
|
// Vision captioning for the image-fallback plugin. No pinned profile — the
|
|
79
73
|
// plugin resolves a vision-capable profile itself via `doesSupportVision` and
|
|
80
74
|
// passes it as an `overrideProfile`, so the call-site default is a fallback
|
|
@@ -66,14 +66,6 @@
|
|
|
66
66
|
"description": "Gate per-turn conversation trace (user/assistant/tool-call/tool-response) collection. The daemon attaches a trace to its turn telemetry only when this flag AND the owner's share_diagnostics consent are both on. Defaults off (fail-closed) — the live value is delivered from LaunchDarkly.",
|
|
67
67
|
"defaultEnabled": false
|
|
68
68
|
},
|
|
69
|
-
{
|
|
70
|
-
"id": "workspace-tools-watcher",
|
|
71
|
-
"scope": "assistant",
|
|
72
|
-
"key": "workspace-tools-watcher",
|
|
73
|
-
"label": "Workspace tools file watcher",
|
|
74
|
-
"description": "Hot-reload workspace tool overrides under `<workspaceDir>/tools/` by watching the directory and re-registering tools as files change. When disabled, workspace tools still load from disk once at daemon startup, but live edits require a restart to take effect.",
|
|
75
|
-
"defaultEnabled": false
|
|
76
|
-
},
|
|
77
69
|
{
|
|
78
70
|
"id": "settings-developer-nav",
|
|
79
71
|
"scope": "assistant",
|
|
@@ -411,11 +403,11 @@
|
|
|
411
403
|
"defaultEnabled": false
|
|
412
404
|
},
|
|
413
405
|
{
|
|
414
|
-
"id": "mcp-
|
|
406
|
+
"id": "mcp-add-server",
|
|
415
407
|
"scope": "assistant",
|
|
416
|
-
"key": "mcp-
|
|
417
|
-
"label": "MCP
|
|
418
|
-
"description": "Show the
|
|
408
|
+
"key": "mcp-add-server",
|
|
409
|
+
"label": "MCP Add Server",
|
|
410
|
+
"description": "Show the Add Server action on the MCP settings page. The MCP page itself remains visible; this flag gates only creating new Model Context Protocol server connections.",
|
|
419
411
|
"defaultEnabled": false
|
|
420
412
|
},
|
|
421
413
|
{
|
|
@@ -423,7 +415,7 @@
|
|
|
423
415
|
"scope": "assistant",
|
|
424
416
|
"key": "os-beta",
|
|
425
417
|
"label": "OS Beta",
|
|
426
|
-
"description": "Enable the OS Beta model profile (
|
|
418
|
+
"description": "Enable the OS Beta model profile (MiniMax M3 / Together) in the assistant's model profile selection.",
|
|
427
419
|
"defaultEnabled": false
|
|
428
420
|
}
|
|
429
421
|
]
|
|
@@ -497,9 +497,6 @@ function profileConfigFragment(profile: ProfileEntry): Mergeable {
|
|
|
497
497
|
// lower-precedence (e.g. active) profile into one that merely inherited it.
|
|
498
498
|
// `RetryProvider` resolves it from the applied profile, not the merge.
|
|
499
499
|
logitBias: _logitBias,
|
|
500
|
-
// Per-profile advisor toggle is profile identity, not inheritable model
|
|
501
|
-
// config — strip it so it can't leak into the merged `LLMConfigBase`.
|
|
502
|
-
advisorEnabled: _advisorEnabled,
|
|
503
500
|
// `temperature`/`top_p` are provider-coupled: only the winning profile
|
|
504
501
|
// contributes them (tracked via `samplingRef`, applied post-merge), so a
|
|
505
502
|
// shadowed profile's sampling can never reach a different provider through
|
package/src/config/loader.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
getConfigQuarantineNoticePath,
|
|
15
15
|
getWorkspaceConfigPath,
|
|
16
16
|
} from "../util/platform.js";
|
|
17
|
+
import { pruneSeededCallsiteDefaultsFromConfig } from "./prune-seeded-callsite-defaults.js";
|
|
17
18
|
import { AssistantConfigSchema } from "./schema.js";
|
|
18
19
|
import type { AssistantConfig } from "./types.js";
|
|
19
20
|
|
|
@@ -300,14 +301,20 @@ function validateWithSchema(raw: Record<string, unknown>): AssistantConfig {
|
|
|
300
301
|
}
|
|
301
302
|
|
|
302
303
|
// Strip invalid fields by setting them to undefined so Zod defaults apply,
|
|
303
|
-
// then re-parse. We walk the error paths and delete the offending keys
|
|
304
|
+
// then re-parse. We walk the error paths and delete the offending keys,
|
|
305
|
+
// pruning any ancestor object the deletion leaves empty. Pruning matters for
|
|
306
|
+
// nested overrides like `llm.callSites.<id>.profile`: stripping just the
|
|
307
|
+
// invalid `.profile` leaf would leave `llm.callSites.<id> = {}`, which the
|
|
308
|
+
// resolver treats as a present (non-default) override and so skips the
|
|
309
|
+
// shipped call-site default — silently downgrading the call site to the
|
|
310
|
+
// active profile. Removing the emptied object lets that default apply.
|
|
304
311
|
const cleaned = structuredClone(raw);
|
|
305
312
|
for (const issue of result.error.issues) {
|
|
306
313
|
if (issue.path.length === 0) {
|
|
307
314
|
// Top-level error — return full defaults
|
|
308
315
|
return cloneDefaultConfig();
|
|
309
316
|
}
|
|
310
|
-
deleteNestedKey(cleaned, issue.path as (string | number)[]);
|
|
317
|
+
deleteNestedKey(cleaned, issue.path as (string | number)[], true);
|
|
311
318
|
}
|
|
312
319
|
|
|
313
320
|
const retry = AssistantConfigSchema.safeParse(cleaned);
|
|
@@ -320,17 +327,42 @@ function validateWithSchema(raw: Record<string, unknown>): AssistantConfig {
|
|
|
320
327
|
return cloneDefaultConfig();
|
|
321
328
|
}
|
|
322
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Delete the key at `path` from `obj`. When `pruneEmptyAncestors` is set, also
|
|
332
|
+
* remove any ancestor object the deletion leaves empty, walking up until the
|
|
333
|
+
* first ancestor that still holds other keys. Only empty plain objects are
|
|
334
|
+
* pruned (arrays are left alone), and a still-populated ancestor stops the walk
|
|
335
|
+
* so a container holding other config is never removed.
|
|
336
|
+
*/
|
|
323
337
|
function deleteNestedKey(
|
|
324
338
|
obj: Record<string, unknown>,
|
|
325
339
|
path: (string | number)[],
|
|
340
|
+
pruneEmptyAncestors = false,
|
|
326
341
|
): void {
|
|
342
|
+
// Record each (container, key) hop on the way down so we can prune upward
|
|
343
|
+
// after deleting the leaf.
|
|
344
|
+
const chain: Array<{ container: Record<string, unknown>; key: string }> = [];
|
|
327
345
|
let current: unknown = obj;
|
|
328
346
|
for (let i = 0; i < path.length - 1; i++) {
|
|
329
347
|
if (current == null || typeof current !== "object") return;
|
|
330
|
-
|
|
348
|
+
const key = String(path[i]);
|
|
349
|
+
chain.push({ container: current as Record<string, unknown>, key });
|
|
350
|
+
current = (current as Record<string, unknown>)[key];
|
|
331
351
|
}
|
|
332
|
-
if (current
|
|
333
|
-
|
|
352
|
+
if (current == null || typeof current !== "object") return;
|
|
353
|
+
delete (current as Record<string, unknown>)[String(path[path.length - 1])];
|
|
354
|
+
|
|
355
|
+
if (!pruneEmptyAncestors) return;
|
|
356
|
+
// Remove ancestors emptied by the deletion, deepest first; stop at the first
|
|
357
|
+
// that still has keys.
|
|
358
|
+
for (let i = chain.length - 1; i >= 0; i--) {
|
|
359
|
+
const { container, key } = chain[i];
|
|
360
|
+
const child = container[key];
|
|
361
|
+
if (isPlainObject(child) && Object.keys(child).length === 0) {
|
|
362
|
+
delete container[key];
|
|
363
|
+
} else {
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
334
366
|
}
|
|
335
367
|
}
|
|
336
368
|
|
|
@@ -598,6 +630,7 @@ export function mergeDefaultWorkspaceConfig(): DefaultWorkspaceConfigMergeResult
|
|
|
598
630
|
}
|
|
599
631
|
|
|
600
632
|
deepMergeOverwrite(existing, defaults as Record<string, unknown>);
|
|
633
|
+
pruneSeededCallsiteDefaultsFromConfig(existing);
|
|
601
634
|
|
|
602
635
|
const dir = dirname(configPath);
|
|
603
636
|
if (!existsSync(dir)) {
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Exact system-owned default materializations. These are resolved through
|
|
2
|
+
// shipped call-site defaults rather than persisted as user overrides.
|
|
3
|
+
const SEEDED_CALL_SITES: Record<string, Record<string, unknown>> = {
|
|
4
|
+
guardianQuestionCopy: latencySeed(),
|
|
5
|
+
interactionClassifier: latencySeed(),
|
|
6
|
+
skillCategoryInference: latencySeed(),
|
|
7
|
+
inviteInstructionGenerator: latencySeed(),
|
|
8
|
+
notificationDecision: latencySeed(),
|
|
9
|
+
preferenceExtraction: latencySeed(),
|
|
10
|
+
commitMessage: {
|
|
11
|
+
model: "claude-haiku-4-5-20251001",
|
|
12
|
+
maxTokens: 120,
|
|
13
|
+
temperature: 0.2,
|
|
14
|
+
effort: "low",
|
|
15
|
+
thinking: { enabled: false },
|
|
16
|
+
},
|
|
17
|
+
conversationStarters: latencySeed(),
|
|
18
|
+
conversationSummarization: {
|
|
19
|
+
model: "claude-opus-4-7",
|
|
20
|
+
effort: "low",
|
|
21
|
+
thinking: { enabled: false },
|
|
22
|
+
},
|
|
23
|
+
recall: {
|
|
24
|
+
profile: "cost-optimized",
|
|
25
|
+
maxTokens: 4096,
|
|
26
|
+
effort: "low",
|
|
27
|
+
thinking: { enabled: false, streamThinking: false },
|
|
28
|
+
temperature: 0,
|
|
29
|
+
disableCache: true,
|
|
30
|
+
},
|
|
31
|
+
heartbeatAgent: {
|
|
32
|
+
profile: "cost-optimized",
|
|
33
|
+
maxTokens: 2048,
|
|
34
|
+
effort: "low",
|
|
35
|
+
temperature: 0,
|
|
36
|
+
thinking: { enabled: false, streamThinking: false },
|
|
37
|
+
contextWindow: { maxInputTokens: 16000 },
|
|
38
|
+
},
|
|
39
|
+
replySuggestion: {
|
|
40
|
+
model: "claude-haiku-4-5-20251001",
|
|
41
|
+
effort: "low",
|
|
42
|
+
thinking: { enabled: false },
|
|
43
|
+
disableCache: true,
|
|
44
|
+
},
|
|
45
|
+
memoryRouter: {
|
|
46
|
+
profile: "cost-optimized",
|
|
47
|
+
contextWindow: { maxInputTokens: 1_000_000 },
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export function pruneSeededCallsiteDefaultsFromConfig(
|
|
52
|
+
config: Record<string, unknown>,
|
|
53
|
+
): boolean {
|
|
54
|
+
const llm = readObject(config.llm);
|
|
55
|
+
if (llm === null) return false;
|
|
56
|
+
|
|
57
|
+
const callSites = readObject(llm.callSites);
|
|
58
|
+
if (callSites === null) return false;
|
|
59
|
+
|
|
60
|
+
let changed = false;
|
|
61
|
+
for (const [callSite, seed] of Object.entries(SEEDED_CALL_SITES)) {
|
|
62
|
+
if (deepEqual(callSites[callSite], seed)) {
|
|
63
|
+
delete callSites[callSite];
|
|
64
|
+
changed = true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (!changed) return false;
|
|
68
|
+
|
|
69
|
+
if (Object.keys(callSites).length === 0) {
|
|
70
|
+
delete llm.callSites;
|
|
71
|
+
} else {
|
|
72
|
+
llm.callSites = callSites;
|
|
73
|
+
}
|
|
74
|
+
config.llm = llm;
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function latencySeed(): Record<string, unknown> {
|
|
79
|
+
return {
|
|
80
|
+
model: "claude-haiku-4-5-20251001",
|
|
81
|
+
effort: "low",
|
|
82
|
+
thinking: { enabled: false },
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function readObject(value: unknown): Record<string, unknown> | null {
|
|
87
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
return value as Record<string, unknown>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function deepEqual(a: unknown, b: unknown): boolean {
|
|
94
|
+
if (a === b) return true;
|
|
95
|
+
if (a === null || b === null) return false;
|
|
96
|
+
if (typeof a !== "object" || typeof b !== "object") return false;
|
|
97
|
+
if (Array.isArray(a) || Array.isArray(b)) return false;
|
|
98
|
+
|
|
99
|
+
const aRecord = a as Record<string, unknown>;
|
|
100
|
+
const bRecord = b as Record<string, unknown>;
|
|
101
|
+
const aKeys = Object.keys(aRecord);
|
|
102
|
+
const bKeys = Object.keys(bRecord);
|
|
103
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
104
|
+
|
|
105
|
+
for (const key of aKeys) {
|
|
106
|
+
if (!Object.prototype.hasOwnProperty.call(bRecord, key)) return false;
|
|
107
|
+
if (!deepEqual(aRecord[key], bRecord[key])) return false;
|
|
108
|
+
}
|
|
109
|
+
return true;
|
|
110
|
+
}
|