@retaw106/mmc-oc 0.0.0-stage → 1.2.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/dist/agents/historian.d.ts +4 -0
- package/dist/agents/historian.d.ts.map +1 -0
- package/dist/agents/language-directive.d.ts +26 -0
- package/dist/agents/language-directive.d.ts.map +1 -0
- package/dist/agents/magic-context-prompt.d.ts +5 -0
- package/dist/agents/magic-context-prompt.d.ts.map +1 -0
- package/dist/agents/memory-maintainer.d.ts +96 -0
- package/dist/agents/memory-maintainer.d.ts.map +1 -0
- package/dist/config/agent-disable.d.ts +29 -0
- package/dist/config/agent-disable.d.ts.map +1 -0
- package/dist/config/config-paths.d.ts +7 -0
- package/dist/config/config-paths.d.ts.map +1 -0
- package/dist/config/index.d.ts +69 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/live-run-config.d.ts +11 -0
- package/dist/config/live-run-config.d.ts.map +1 -0
- package/dist/config/live-snapshot.d.ts +32 -0
- package/dist/config/live-snapshot.d.ts.map +1 -0
- package/dist/config/migrate-experimental.d.ts +26 -0
- package/dist/config/migrate-experimental.d.ts.map +1 -0
- package/dist/config/profiles.d.ts +22 -0
- package/dist/config/profiles.d.ts.map +1 -0
- package/dist/config/project-security.d.ts +124 -0
- package/dist/config/project-security.d.ts.map +1 -0
- package/dist/config/prune-config-leaf.d.ts +26 -0
- package/dist/config/prune-config-leaf.d.ts.map +1 -0
- package/dist/config/raw-loader.d.ts +42 -0
- package/dist/config/raw-loader.d.ts.map +1 -0
- package/dist/config/removed-agent-config.d.ts +8 -0
- package/dist/config/removed-agent-config.d.ts.map +1 -0
- package/dist/config/schema/agent-overrides.d.ts +52 -0
- package/dist/config/schema/agent-overrides.d.ts.map +1 -0
- package/dist/config/schema/magic-context.d.ts +805 -0
- package/dist/config/schema/magic-context.d.ts.map +1 -0
- package/dist/config/variable.d.ts +48 -0
- package/dist/config/variable.d.ts.map +1 -0
- package/dist/context-a6px04s0.js +23932 -0
- package/dist/derive-budgets-fhk00zv8.js +18 -0
- package/dist/features/magic-context/compaction-marker.d.ts +211 -0
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -0
- package/dist/features/magic-context/compaction.d.ts +7 -0
- package/dist/features/magic-context/compaction.d.ts.map +1 -0
- package/dist/features/magic-context/compartment-events.d.ts +50 -0
- package/dist/features/magic-context/compartment-events.d.ts.map +1 -0
- package/dist/features/magic-context/compartment-lease.d.ts +28 -0
- package/dist/features/magic-context/compartment-lease.d.ts.map +1 -0
- package/dist/features/magic-context/compartment-storage.d.ts +178 -0
- package/dist/features/magic-context/compartment-storage.d.ts.map +1 -0
- package/dist/features/magic-context/compression-depth-storage.d.ts +14 -0
- package/dist/features/magic-context/compression-depth-storage.d.ts.map +1 -0
- package/dist/features/magic-context/context-authority.d.ts +15 -0
- package/dist/features/magic-context/context-authority.d.ts.map +1 -0
- package/dist/features/magic-context/fail-closed-block.d.ts +117 -0
- package/dist/features/magic-context/fail-closed-block.d.ts.map +1 -0
- package/dist/features/magic-context/index.d.ts +10 -0
- package/dist/features/magic-context/index.d.ts.map +1 -0
- package/dist/features/magic-context/literal-probes.d.ts +24 -0
- package/dist/features/magic-context/literal-probes.d.ts.map +1 -0
- package/dist/features/magic-context/lkg-prefix-chunks.d.ts +53 -0
- package/dist/features/magic-context/lkg-prefix-chunks.d.ts.map +1 -0
- package/dist/features/magic-context/memory/constants.d.ts +16 -0
- package/dist/features/magic-context/memory/constants.d.ts.map +1 -0
- package/dist/features/magic-context/memory/index.d.ts +11 -0
- package/dist/features/magic-context/memory/index.d.ts.map +1 -0
- package/dist/features/magic-context/memory/memory-diagnostics.d.ts +6 -0
- package/dist/features/magic-context/memory/memory-diagnostics.d.ts.map +1 -0
- package/dist/features/magic-context/memory/memory-selection.d.ts +12 -0
- package/dist/features/magic-context/memory/memory-selection.d.ts.map +1 -0
- package/dist/features/magic-context/memory/memory-visibility.d.ts +46 -0
- package/dist/features/magic-context/memory/memory-visibility.d.ts.map +1 -0
- package/dist/features/magic-context/memory/normalize-hash.d.ts +3 -0
- package/dist/features/magic-context/memory/normalize-hash.d.ts.map +1 -0
- package/dist/features/magic-context/memory/project-identity-cache.d.ts +7 -0
- package/dist/features/magic-context/memory/project-identity-cache.d.ts.map +1 -0
- package/dist/features/magic-context/memory/project-identity.d.ts +97 -0
- package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -0
- package/dist/features/magic-context/memory/promotion.d.ts +26 -0
- package/dist/features/magic-context/memory/promotion.d.ts.map +1 -0
- package/dist/features/magic-context/memory/relocate-memory.d.ts +58 -0
- package/dist/features/magic-context/memory/relocate-memory.d.ts.map +1 -0
- package/dist/features/magic-context/memory/storage-memory-fts.d.ts +11 -0
- package/dist/features/magic-context/memory/storage-memory-fts.d.ts.map +1 -0
- package/dist/features/magic-context/memory/storage-memory-verifications.d.ts +35 -0
- package/dist/features/magic-context/memory/storage-memory-verifications.d.ts.map +1 -0
- package/dist/features/magic-context/memory/storage-memory.d.ts +89 -0
- package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -0
- package/dist/features/magic-context/memory/types.d.ts +59 -0
- package/dist/features/magic-context/memory/types.d.ts.map +1 -0
- package/dist/features/magic-context/memory/verification-paths.d.ts +48 -0
- package/dist/features/magic-context/memory/verification-paths.d.ts.map +1 -0
- package/dist/features/magic-context/memory/visibility.d.ts +6 -0
- package/dist/features/magic-context/memory/visibility.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/apply.d.ts +65 -0
- package/dist/features/magic-context/memory-maintainer/apply.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/budget.d.ts +75 -0
- package/dist/features/magic-context/memory-maintainer/budget.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/coverage.d.ts +91 -0
- package/dist/features/magic-context/memory-maintainer/coverage.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/dream-state.d.ts +18 -0
- package/dist/features/magic-context/memory-maintainer/dream-state.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/launcher.d.ts +119 -0
- package/dist/features/magic-context/memory-maintainer/launcher.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/lease.d.ts +56 -0
- package/dist/features/magic-context/memory-maintainer/lease.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/manifest.d.ts +127 -0
- package/dist/features/magic-context/memory-maintainer/manifest.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/manual-commands.d.ts +46 -0
- package/dist/features/magic-context/memory-maintainer/manual-commands.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/oc2-adapter.d.ts +79 -0
- package/dist/features/magic-context/memory-maintainer/oc2-adapter.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/pause-report.d.ts +37 -0
- package/dist/features/magic-context/memory-maintainer/pause-report.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/pipeline.d.ts +199 -0
- package/dist/features/magic-context/memory-maintainer/pipeline.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/provider-output-failure.d.ts +15 -0
- package/dist/features/magic-context/memory-maintainer/provider-output-failure.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/schedule-storage.d.ts +76 -0
- package/dist/features/magic-context/memory-maintainer/schedule-storage.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/schedule.d.ts +90 -0
- package/dist/features/magic-context/memory-maintainer/schedule.d.ts.map +1 -0
- package/dist/features/magic-context/merged-reasoning-decisions.d.ts +6 -0
- package/dist/features/magic-context/merged-reasoning-decisions.d.ts.map +1 -0
- package/dist/features/magic-context/message-fts-rowid-map.d.ts +50 -0
- package/dist/features/magic-context/message-fts-rowid-map.d.ts.map +1 -0
- package/dist/features/magic-context/message-fts-session-filter.d.ts +14 -0
- package/dist/features/magic-context/message-fts-session-filter.d.ts.map +1 -0
- package/dist/features/magic-context/message-index-async.d.ts +33 -0
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -0
- package/dist/features/magic-context/message-index-sweep.d.ts +11 -0
- package/dist/features/magic-context/message-index-sweep.d.ts.map +1 -0
- package/dist/features/magic-context/message-index.d.ts +88 -0
- package/dist/features/magic-context/message-index.d.ts.map +1 -0
- package/dist/features/magic-context/message-time-backfill.d.ts +19 -0
- package/dist/features/magic-context/message-time-backfill.d.ts.map +1 -0
- package/dist/features/magic-context/migration-v2-write-split.d.ts +62 -0
- package/dist/features/magic-context/migration-v2-write-split.d.ts.map +1 -0
- package/dist/features/magic-context/migrations.d.ts +73 -0
- package/dist/features/magic-context/migrations.d.ts.map +1 -0
- package/dist/features/magic-context/mock-database.d.ts +3 -0
- package/dist/features/magic-context/mock-database.d.ts.map +1 -0
- package/dist/features/magic-context/mural/storage-mural-cues.d.ts +65 -0
- package/dist/features/magic-context/mural/storage-mural-cues.d.ts.map +1 -0
- package/dist/features/magic-context/no-content-compartment.d.ts +12 -0
- package/dist/features/magic-context/no-content-compartment.d.ts.map +1 -0
- package/dist/features/magic-context/opencode2-relabel.d.ts +132 -0
- package/dist/features/magic-context/opencode2-relabel.d.ts.map +1 -0
- package/dist/features/magic-context/overflow-detection.d.ts +108 -0
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -0
- package/dist/features/magic-context/pi-content-decisions.d.ts +9 -0
- package/dist/features/magic-context/pi-content-decisions.d.ts.map +1 -0
- package/dist/features/magic-context/project-identity.d.ts +2 -0
- package/dist/features/magic-context/project-identity.d.ts.map +1 -0
- package/dist/features/magic-context/protection-window.d.ts +79 -0
- package/dist/features/magic-context/protection-window.d.ts.map +1 -0
- package/dist/features/magic-context/range-parser.d.ts +18 -0
- package/dist/features/magic-context/range-parser.d.ts.map +1 -0
- package/dist/features/magic-context/reclaim-protection.d.ts +13 -0
- package/dist/features/magic-context/reclaim-protection.d.ts.map +1 -0
- package/dist/features/magic-context/resolve-subagent-fallback.d.ts +42 -0
- package/dist/features/magic-context/resolve-subagent-fallback.d.ts.map +1 -0
- package/dist/features/magic-context/scheduler.d.ts +20 -0
- package/dist/features/magic-context/scheduler.d.ts.map +1 -0
- package/dist/features/magic-context/schema-fence-probe.d.ts +29 -0
- package/dist/features/magic-context/schema-fence-probe.d.ts.map +1 -0
- package/dist/features/magic-context/search.d.ts +118 -0
- package/dist/features/magic-context/search.d.ts.map +1 -0
- package/dist/features/magic-context/session-cache-ttl.d.ts +10 -0
- package/dist/features/magic-context/session-cache-ttl.d.ts.map +1 -0
- package/dist/features/magic-context/session-decision-calibration.d.ts +31 -0
- package/dist/features/magic-context/session-decision-calibration.d.ts.map +1 -0
- package/dist/features/magic-context/session-project-backfill.d.ts +37 -0
- package/dist/features/magic-context/session-project-backfill.d.ts.map +1 -0
- package/dist/features/magic-context/session-project-storage.d.ts +23 -0
- package/dist/features/magic-context/session-project-storage.d.ts.map +1 -0
- package/dist/features/magic-context/storage-caveman-rules.d.ts +21 -0
- package/dist/features/magic-context/storage-caveman-rules.d.ts.map +1 -0
- package/dist/features/magic-context/storage-clone.d.ts +44 -0
- package/dist/features/magic-context/storage-clone.d.ts.map +1 -0
- package/dist/features/magic-context/storage-db.d.ts +183 -0
- package/dist/features/magic-context/storage-db.d.ts.map +1 -0
- package/dist/features/magic-context/storage-historian-runs.d.ts +79 -0
- package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -0
- package/dist/features/magic-context/storage-identity-merge.d.ts +26 -0
- package/dist/features/magic-context/storage-identity-merge.d.ts.map +1 -0
- package/dist/features/magic-context/storage-identity-rekey-map.d.ts +11 -0
- package/dist/features/magic-context/storage-identity-rekey-map.d.ts.map +1 -0
- package/dist/features/magic-context/storage-m0-mutation-log.d.ts +22 -0
- package/dist/features/magic-context/storage-m0-mutation-log.d.ts.map +1 -0
- package/dist/features/magic-context/storage-memory-mutation-log.d.ts +29 -0
- package/dist/features/magic-context/storage-memory-mutation-log.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts +623 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta-session.d.ts +14 -0
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta-shared.d.ts +102 -0
- package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta.d.ts +4 -0
- package/dist/features/magic-context/storage-meta.d.ts.map +1 -0
- package/dist/features/magic-context/storage-native-replay.d.ts +29 -0
- package/dist/features/magic-context/storage-native-replay.d.ts.map +1 -0
- package/dist/features/magic-context/storage-notes.d.ts +80 -0
- package/dist/features/magic-context/storage-notes.d.ts.map +1 -0
- package/dist/features/magic-context/storage-ops.d.ts +14 -0
- package/dist/features/magic-context/storage-ops.d.ts.map +1 -0
- package/dist/features/magic-context/storage-primers.d.ts +96 -0
- package/dist/features/magic-context/storage-primers.d.ts.map +1 -0
- package/dist/features/magic-context/storage-project-state.d.ts +19 -0
- package/dist/features/magic-context/storage-project-state.d.ts.map +1 -0
- package/dist/features/magic-context/storage-reasoning-removal.d.ts +30 -0
- package/dist/features/magic-context/storage-reasoning-removal.d.ts.map +1 -0
- package/dist/features/magic-context/storage-replay-document.d.ts +72 -0
- package/dist/features/magic-context/storage-replay-document.d.ts.map +1 -0
- package/dist/features/magic-context/storage-schema-helpers.d.ts +31 -0
- package/dist/features/magic-context/storage-schema-helpers.d.ts.map +1 -0
- package/dist/features/magic-context/storage-session-tables.d.ts +18 -0
- package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -0
- package/dist/features/magic-context/storage-source.d.ts +5 -0
- package/dist/features/magic-context/storage-source.d.ts.map +1 -0
- package/dist/features/magic-context/storage-subagent-invocations.d.ts +62 -0
- package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -0
- package/dist/features/magic-context/storage-tags.d.ts +542 -0
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -0
- package/dist/features/magic-context/storage-unavailable-reason.d.ts +17 -0
- package/dist/features/magic-context/storage-unavailable-reason.d.ts.map +1 -0
- package/dist/features/magic-context/storage-v22-backfill-failures.d.ts +26 -0
- package/dist/features/magic-context/storage-v22-backfill-failures.d.ts.map +1 -0
- package/dist/features/magic-context/storage.d.ts +23 -0
- package/dist/features/magic-context/storage.d.ts.map +1 -0
- package/dist/features/magic-context/store-generation-rebase.d.ts +188 -0
- package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -0
- package/dist/features/magic-context/subagent-token-capture.d.ts +35 -0
- package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -0
- package/dist/features/magic-context/tag-input.d.ts +4 -0
- package/dist/features/magic-context/tag-input.d.ts.map +1 -0
- package/dist/features/magic-context/tagger.d.ts +119 -0
- package/dist/features/magic-context/tagger.d.ts.map +1 -0
- package/dist/features/magic-context/tool-definition-tokens.d.ts +90 -0
- package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -0
- package/dist/features/magic-context/tool-owner-backfill.d.ts +93 -0
- package/dist/features/magic-context/tool-owner-backfill.d.ts.map +1 -0
- package/dist/features/magic-context/transform-decision-log.d.ts +110 -0
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -0
- package/dist/features/magic-context/types.d.ts +133 -0
- package/dist/features/magic-context/types.d.ts.map +1 -0
- package/dist/features/magic-context/window-report-ledger.d.ts +70 -0
- package/dist/features/magic-context/window-report-ledger.d.ts.map +1 -0
- package/dist/features/magic-context/work-metrics.d.ts +79 -0
- package/dist/features/magic-context/work-metrics.d.ts.map +1 -0
- package/dist/features/magic-context/workspaces.d.ts +28 -0
- package/dist/features/magic-context/workspaces.d.ts.map +1 -0
- package/dist/hooks/auto-update-checker/semver.d.ts +26 -0
- package/dist/hooks/auto-update-checker/semver.d.ts.map +1 -0
- package/dist/hooks/magic-context/apply-operations.d.ts +158 -0
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-deadline.d.ts +10 -0
- package/dist/hooks/magic-context/auto-search-deadline.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-hint.d.ts +36 -0
- package/dist/hooks/magic-context/auto-search-hint.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-runner.d.ts +60 -0
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -0
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +42 -0
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -0
- package/dist/hooks/magic-context/caveman-cleanup.d.ts +98 -0
- package/dist/hooks/magic-context/caveman-cleanup.d.ts.map +1 -0
- package/dist/hooks/magic-context/caveman.d.ts +90 -0
- package/dist/hooks/magic-context/caveman.d.ts.map +1 -0
- package/dist/hooks/magic-context/channel2-cycle.d.ts +16 -0
- package/dist/hooks/magic-context/channel2-cycle.d.ts.map +1 -0
- package/dist/hooks/magic-context/channel2-delivery.d.ts +32 -0
- package/dist/hooks/magic-context/channel2-delivery.d.ts.map +1 -0
- package/dist/hooks/magic-context/child-session-spawn.d.ts +27 -0
- package/dist/hooks/magic-context/child-session-spawn.d.ts.map +1 -0
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts +154 -0
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -0
- package/dist/hooks/magic-context/compaction-off-transition.d.ts +97 -0
- package/dist/hooks/magic-context/compaction-off-transition.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-parser.d.ts +66 -0
- package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-prompt.d.ts +33 -0
- package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-render-epoch.d.ts +27 -0
- package/dist/hooks/magic-context/compartment-render-epoch.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts +29 -0
- package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts +43 -0
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +31 -0
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-mapping.d.ts +25 -0
- package/dist/hooks/magic-context/compartment-runner-mapping.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts +29 -0
- package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts +11 -0
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +295 -0
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts +83 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner.d.ts +59 -0
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-trigger.d.ts +77 -0
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -0
- package/dist/hooks/magic-context/ctx-reduce-availability.d.ts +170 -0
- package/dist/hooks/magic-context/ctx-reduce-availability.d.ts.map +1 -0
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts +104 -0
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts.map +1 -0
- package/dist/hooks/magic-context/decay-curve.d.ts +84 -0
- package/dist/hooks/magic-context/decay-curve.d.ts.map +1 -0
- package/dist/hooks/magic-context/decay-render.d.ts +80 -0
- package/dist/hooks/magic-context/decay-render.d.ts.map +1 -0
- package/dist/hooks/magic-context/decision-calibration.d.ts +24 -0
- package/dist/hooks/magic-context/decision-calibration.d.ts.map +1 -0
- package/dist/hooks/magic-context/degraded-pass-refusal.d.ts +35 -0
- package/dist/hooks/magic-context/degraded-pass-refusal.d.ts.map +1 -0
- package/dist/hooks/magic-context/derive-budgets.d.ts +60 -0
- package/dist/hooks/magic-context/derive-budgets.d.ts.map +1 -0
- package/dist/hooks/magic-context/drop-stale-reduce-calls.d.ts +39 -0
- package/dist/hooks/magic-context/drop-stale-reduce-calls.d.ts.map +1 -0
- package/dist/hooks/magic-context/dropped-input-guard.d.ts +55 -0
- package/dist/hooks/magic-context/dropped-input-guard.d.ts.map +1 -0
- package/dist/hooks/magic-context/dropped-token-estimate.d.ts +20 -0
- package/dist/hooks/magic-context/dropped-token-estimate.d.ts.map +1 -0
- package/dist/hooks/magic-context/edit-marker.d.ts +11 -0
- package/dist/hooks/magic-context/edit-marker.d.ts.map +1 -0
- package/dist/hooks/magic-context/emergency-drop.d.ts +112 -0
- package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -0
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts +14 -0
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts.map +1 -0
- package/dist/hooks/magic-context/empty-task-output.d.ts +16 -0
- package/dist/hooks/magic-context/empty-task-output.d.ts.map +1 -0
- package/dist/hooks/magic-context/event-payloads.d.ts +73 -0
- package/dist/hooks/magic-context/event-payloads.d.ts.map +1 -0
- package/dist/hooks/magic-context/event-resolvers.d.ts +114 -0
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -0
- package/dist/hooks/magic-context/execute-flush.d.ts +3 -0
- package/dist/hooks/magic-context/execute-flush.d.ts.map +1 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +56 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -0
- package/dist/hooks/magic-context/fold-execution-gate.d.ts +2 -0
- package/dist/hooks/magic-context/fold-execution-gate.d.ts.map +1 -0
- package/dist/hooks/magic-context/format-bytes.d.ts +2 -0
- package/dist/hooks/magic-context/format-bytes.d.ts.map +1 -0
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts +48 -0
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -0
- package/dist/hooks/magic-context/historian-no-fire-cause.d.ts +5 -0
- package/dist/hooks/magic-context/historian-no-fire-cause.d.ts.map +1 -0
- package/dist/hooks/magic-context/historian-prompt-fit.d.ts +112 -0
- package/dist/hooks/magic-context/historian-prompt-fit.d.ts.map +1 -0
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts +2 -0
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -0
- package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts +3 -0
- package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts.map +1 -0
- package/dist/hooks/magic-context/historian-state-file.d.ts +43 -0
- package/dist/hooks/magic-context/historian-state-file.d.ts.map +1 -0
- package/dist/hooks/magic-context/history-boundary-repair.d.ts +44 -0
- package/dist/hooks/magic-context/history-boundary-repair.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts +177 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -0
- package/dist/hooks/magic-context/host-served-rows.d.ts +58 -0
- package/dist/hooks/magic-context/host-served-rows.d.ts.map +1 -0
- package/dist/hooks/magic-context/image-token-estimate.d.ts +15 -0
- package/dist/hooks/magic-context/image-token-estimate.d.ts.map +1 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts +389 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -0
- package/dist/hooks/magic-context/issue-135-wire-fixtures.d.ts +8 -0
- package/dist/hooks/magic-context/issue-135-wire-fixtures.d.ts.map +1 -0
- package/dist/hooks/magic-context/issue-423-fixture.d.ts +37 -0
- package/dist/hooks/magic-context/issue-423-fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/issue-424-fixture.d.ts +11 -0
- package/dist/hooks/magic-context/issue-424-fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/legacy-compartments.d.ts +20 -0
- package/dist/hooks/magic-context/legacy-compartments.d.ts.map +1 -0
- package/dist/hooks/magic-context/live-session-state.d.ts +68 -0
- package/dist/hooks/magic-context/live-session-state.d.ts.map +1 -0
- package/dist/hooks/magic-context/lkg-persist.d.ts +22 -0
- package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -0
- package/dist/hooks/magic-context/lkg-replay.d.ts +71 -0
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts +119 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -0
- package/dist/hooks/magic-context/m0-token-breakdown.d.ts +44 -0
- package/dist/hooks/magic-context/m0-token-breakdown.d.ts.map +1 -0
- package/dist/hooks/magic-context/maintenance-authority.d.ts +2 -0
- package/dist/hooks/magic-context/maintenance-authority.d.ts.map +1 -0
- package/dist/hooks/magic-context/openai-compat-adjacency.d.ts +38 -0
- package/dist/hooks/magic-context/openai-compat-adjacency.d.ts.map +1 -0
- package/dist/hooks/magic-context/opencode-v1-store-fixture.d.ts +12 -0
- package/dist/hooks/magic-context/opencode-v1-store-fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/pass-outcome.d.ts +70 -0
- package/dist/hooks/magic-context/pass-outcome.d.ts.map +1 -0
- package/dist/hooks/magic-context/persist-filtered-noise.d.ts +5 -0
- package/dist/hooks/magic-context/persist-filtered-noise.d.ts.map +1 -0
- package/dist/hooks/magic-context/postprocess-read-cache.d.ts +8 -0
- package/dist/hooks/magic-context/postprocess-read-cache.d.ts.map +1 -0
- package/dist/hooks/magic-context/producer-window-guard.d.ts +63 -0
- package/dist/hooks/magic-context/producer-window-guard.d.ts.map +1 -0
- package/dist/hooks/magic-context/producer-window-test-support.d.ts +14 -0
- package/dist/hooks/magic-context/producer-window-test-support.d.ts.map +1 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +234 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -0
- package/dist/hooks/magic-context/raw-fallback-context-limit.d.ts +10 -0
- package/dist/hooks/magic-context/raw-fallback-context-limit.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts +271 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-db.d.ts +66 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts +65 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts +164 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts +82 -0
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -0
- package/dist/hooks/magic-context/reasoning-removal.d.ts +60 -0
- package/dist/hooks/magic-context/reasoning-removal.d.ts.map +1 -0
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts +93 -0
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -0
- package/dist/hooks/magic-context/reference-retrieval.d.ts +72 -0
- package/dist/hooks/magic-context/reference-retrieval.d.ts.map +1 -0
- package/dist/hooks/magic-context/reference-seeds.generated.d.ts +8 -0
- package/dist/hooks/magic-context/reference-seeds.generated.d.ts.map +1 -0
- package/dist/hooks/magic-context/send-session-notification.d.ts +43 -0
- package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -0
- package/dist/hooks/magic-context/sentinel.d.ts +146 -0
- package/dist/hooks/magic-context/sentinel.d.ts.map +1 -0
- package/dist/hooks/magic-context/storage-busy-refusal.d.ts +20 -0
- package/dist/hooks/magic-context/storage-busy-refusal.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-content.d.ts +216 -0
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-structural-noise.d.ts +15 -0
- package/dist/hooks/magic-context/strip-structural-noise.d.ts.map +1 -0
- package/dist/hooks/magic-context/stripped-command.d.ts +56 -0
- package/dist/hooks/magic-context/stripped-command.d.ts.map +1 -0
- package/dist/hooks/magic-context/supersession-reclaim.d.ts +58 -0
- package/dist/hooks/magic-context/supersession-reclaim.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-injection-stripper.d.ts +2 -0
- package/dist/hooks/magic-context/system-injection-stripper.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +129 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -0
- package/dist/hooks/magic-context/tag-content-primitives.d.ts +31 -0
- package/dist/hooks/magic-context/tag-content-primitives.d.ts.map +1 -0
- package/dist/hooks/magic-context/tag-id-fallback.d.ts +11 -0
- package/dist/hooks/magic-context/tag-id-fallback.d.ts.map +1 -0
- package/dist/hooks/magic-context/tag-messages.d.ts +145 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -0
- package/dist/hooks/magic-context/tag-part-guards.d.ts +23 -0
- package/dist/hooks/magic-context/tag-part-guards.d.ts.map +1 -0
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +178 -0
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -0
- package/dist/hooks/magic-context/temporal-awareness.d.ts +73 -0
- package/dist/hooks/magic-context/temporal-awareness.d.ts.map +1 -0
- package/dist/hooks/magic-context/text-complete.d.ts +31 -0
- package/dist/hooks/magic-context/text-complete.d.ts.map +1 -0
- package/dist/hooks/magic-context/todo-view.d.ts +127 -0
- package/dist/hooks/magic-context/todo-view.d.ts.map +1 -0
- package/dist/hooks/magic-context/tokenizer-calibration.d.ts +92 -0
- package/dist/hooks/magic-context/tokenizer-calibration.d.ts.map +1 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts +144 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -0
- package/dist/hooks/magic-context/tool-input-size.d.ts +21 -0
- package/dist/hooks/magic-context/tool-input-size.d.ts.map +1 -0
- package/dist/hooks/magic-context/tool-reclaim.d.ts +12 -0
- package/dist/hooks/magic-context/tool-reclaim.d.ts.map +1 -0
- package/dist/hooks/magic-context/tool-sweep-policy.d.ts +50 -0
- package/dist/hooks/magic-context/tool-sweep-policy.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +133 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-context-state.d.ts +28 -0
- package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-message-helpers.d.ts +32 -0
- package/dist/hooks/magic-context/transform-message-helpers.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-operations.d.ts +5 -0
- package/dist/hooks/magic-context/transform-operations.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +350 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-stage-logger.d.ts +2 -0
- package/dist/hooks/magic-context/transform-stage-logger.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform.d.ts +334 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -0
- package/dist/hooks/magic-context/unmanaged-over-window.d.ts +36 -0
- package/dist/hooks/magic-context/unmanaged-over-window.d.ts.map +1 -0
- package/dist/hooks/magic-context/unresolved-history-boundary.d.ts +15 -0
- package/dist/hooks/magic-context/unresolved-history-boundary.d.ts.map +1 -0
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts +14 -0
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -0
- package/dist/index-1vs6anwz.js +126 -0
- package/dist/index-3wagyrnj.js +670 -0
- package/dist/index-53g38ggt.js +40 -0
- package/dist/index-5pg0acf7.js +410 -0
- package/dist/index-977gxfz0.js +514 -0
- package/dist/index-by6h2pav.js +27883 -0
- package/dist/index-e1q8002h.js +16 -0
- package/dist/index-fg34g6a5.js +584 -0
- package/dist/index-jdxxq8cz.js +99 -0
- package/dist/index-me3zcj5t.js +69 -0
- package/dist/index-qbkzdkk0.js +496 -0
- package/dist/index-wgt4gamw.js +6388 -0
- package/dist/index-zx63j2e2.js +907 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/message-time-backfill-5ewk0axe.js +116 -0
- package/dist/model-resolution-5haaxnpt.js +6 -0
- package/dist/plugin/boot-deadline.d.ts +47 -0
- package/dist/plugin/boot-deadline.d.ts.map +1 -0
- package/dist/plugin/boot-quiet.d.ts +12 -0
- package/dist/plugin/boot-quiet.d.ts.map +1 -0
- package/dist/plugin/normalize-tool-arg-schemas.d.ts +7 -0
- package/dist/plugin/normalize-tool-arg-schemas.d.ts.map +1 -0
- package/dist/plugin/rpc-handlers.d.ts +52 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -0
- package/dist/plugin/sidebar-snapshot-cache.d.ts +19 -0
- package/dist/plugin/sidebar-snapshot-cache.d.ts.map +1 -0
- package/dist/plugin/subagent-tool-policy.d.ts +9 -0
- package/dist/plugin/subagent-tool-policy.d.ts.map +1 -0
- package/dist/plugin/types.d.ts +3 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/dist/prompt-context-ffa5xcfx.js +76 -0
- package/dist/read-session-chunk-apjwrttc.js +56 -0
- package/dist/recomp-orchestrator-gyeevxaw.js +21 -0
- package/dist/rpc-notifications-4amf6mf4.js +14 -0
- package/dist/safe-notification-target-ph3xd1ve.js +9 -0
- package/dist/send-session-notification-y29y9fsr.js +18 -0
- package/dist/shared/announcement.d.ts +69 -0
- package/dist/shared/announcement.d.ts.map +1 -0
- package/dist/shared/assistant-message-extractor.d.ts +13 -0
- package/dist/shared/assistant-message-extractor.d.ts.map +1 -0
- package/dist/shared/auto-update-provenance.d.ts +9 -0
- package/dist/shared/auto-update-provenance.d.ts.map +1 -0
- package/dist/shared/bounded-session-map.d.ts +45 -0
- package/dist/shared/bounded-session-map.d.ts.map +1 -0
- package/dist/shared/builtin-commands.d.ts +24 -0
- package/dist/shared/builtin-commands.d.ts.map +1 -0
- package/dist/shared/cache-ttl-display.d.ts +25 -0
- package/dist/shared/cache-ttl-display.d.ts.map +1 -0
- package/dist/shared/cache-ttl-seed.d.ts +10 -0
- package/dist/shared/cache-ttl-seed.d.ts.map +1 -0
- package/dist/shared/child-session-teardown.d.ts +34 -0
- package/dist/shared/child-session-teardown.d.ts.map +1 -0
- package/dist/shared/commit-detection.d.ts +29 -0
- package/dist/shared/commit-detection.d.ts.map +1 -0
- package/dist/shared/config-diagnostics.d.ts +30 -0
- package/dist/shared/config-diagnostics.d.ts.map +1 -0
- package/dist/shared/conflict-detector.d.ts +139 -0
- package/dist/shared/conflict-detector.d.ts.map +1 -0
- package/dist/shared/conflict-fixer.d.ts +20 -0
- package/dist/shared/conflict-fixer.d.ts.map +1 -0
- package/dist/shared/context-limit-provenance.d.ts +3 -0
- package/dist/shared/context-limit-provenance.d.ts.map +1 -0
- package/dist/shared/data-path.d.ts +176 -0
- package/dist/shared/data-path.d.ts.map +1 -0
- package/dist/shared/error-message.d.ts +32 -0
- package/dist/shared/error-message.d.ts.map +1 -0
- package/dist/shared/escalation-bands.d.ts +9 -0
- package/dist/shared/escalation-bands.d.ts.map +1 -0
- package/dist/shared/format-bytes.d.ts +2 -0
- package/dist/shared/format-bytes.d.ts.map +1 -0
- package/dist/shared/format-threshold.d.ts +43 -0
- package/dist/shared/format-threshold.d.ts.map +1 -0
- package/dist/shared/harness-provider-map.d.ts +64 -0
- package/dist/shared/harness-provider-map.d.ts.map +1 -0
- package/dist/shared/harness.d.ts +55 -0
- package/dist/shared/harness.d.ts.map +1 -0
- package/dist/shared/hidden-variant-warnings.d.ts +5 -0
- package/dist/shared/hidden-variant-warnings.d.ts.map +1 -0
- package/dist/shared/historian-tool-expansions.d.ts +5 -0
- package/dist/shared/historian-tool-expansions.d.ts.map +1 -0
- package/dist/shared/historian-tool-template.d.ts +5 -0
- package/dist/shared/historian-tool-template.d.ts.map +1 -0
- package/dist/shared/historian-transient-error.d.ts +2 -0
- package/dist/shared/historian-transient-error.d.ts.map +1 -0
- package/dist/shared/host-limitations.d.ts +14 -0
- package/dist/shared/host-limitations.d.ts.map +1 -0
- package/dist/shared/index.d.ts +8 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/internal-initiator-marker.d.ts +2 -0
- package/dist/shared/internal-initiator-marker.d.ts.map +1 -0
- package/dist/shared/jsonc-edit.d.ts +23 -0
- package/dist/shared/jsonc-edit.d.ts.map +1 -0
- package/dist/shared/jsonc-parser.d.ts +30 -0
- package/dist/shared/jsonc-parser.d.ts.map +1 -0
- package/dist/shared/keep-subagents.d.ts +7 -0
- package/dist/shared/keep-subagents.d.ts.map +1 -0
- package/dist/shared/logger.d.ts +18 -0
- package/dist/shared/logger.d.ts.map +1 -0
- package/dist/shared/model-cache-ttl.d.ts +9 -0
- package/dist/shared/model-cache-ttl.d.ts.map +1 -0
- package/dist/shared/model-resolution.d.ts +35 -0
- package/dist/shared/model-resolution.d.ts.map +1 -0
- package/dist/shared/model-suggestion-retry.d.ts +138 -0
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -0
- package/dist/shared/models-dev-cache.d.ts +156 -0
- package/dist/shared/models-dev-cache.d.ts.map +1 -0
- package/dist/shared/normalize-sdk-response.d.ts +5 -0
- package/dist/shared/normalize-sdk-response.d.ts.map +1 -0
- package/dist/shared/opencode-config-dir-types.d.ts +14 -0
- package/dist/shared/opencode-config-dir-types.d.ts.map +1 -0
- package/dist/shared/opencode-config-dir.d.ts +57 -0
- package/dist/shared/opencode-config-dir.d.ts.map +1 -0
- package/dist/shared/opencode-db-path.d.ts +68 -0
- package/dist/shared/opencode-db-path.d.ts.map +1 -0
- package/dist/shared/pi-executable.d.ts +6 -0
- package/dist/shared/pi-executable.d.ts.map +1 -0
- package/dist/shared/plugin-package-version.d.ts +14 -0
- package/dist/shared/plugin-package-version.d.ts.map +1 -0
- package/dist/shared/project-directory-key.d.ts +26 -0
- package/dist/shared/project-directory-key.d.ts.map +1 -0
- package/dist/shared/prompt-context.d.ts +31 -0
- package/dist/shared/prompt-context.d.ts.map +1 -0
- package/dist/shared/prompt-surface-a1-golden.d.ts +28 -0
- package/dist/shared/prompt-surface-a1-golden.d.ts.map +1 -0
- package/dist/shared/prompt-surface-runtime.d.ts +62 -0
- package/dist/shared/prompt-surface-runtime.d.ts.map +1 -0
- package/dist/shared/prompt-surface.d.ts +53 -0
- package/dist/shared/prompt-surface.d.ts.map +1 -0
- package/dist/shared/provider-response-completion.d.ts +12 -0
- package/dist/shared/provider-response-completion.d.ts.map +1 -0
- package/dist/shared/record-type-guard.d.ts +2 -0
- package/dist/shared/record-type-guard.d.ts.map +1 -0
- package/dist/shared/redaction.d.ts +7 -0
- package/dist/shared/redaction.d.ts.map +1 -0
- package/dist/shared/resolve-fallbacks.d.ts +48 -0
- package/dist/shared/resolve-fallbacks.d.ts.map +1 -0
- package/dist/shared/rpc-client.d.ts +28 -0
- package/dist/shared/rpc-client.d.ts.map +1 -0
- package/dist/shared/rpc-notifications.d.ts +74 -0
- package/dist/shared/rpc-notifications.d.ts.map +1 -0
- package/dist/shared/rpc-server.d.ts +52 -0
- package/dist/shared/rpc-server.d.ts.map +1 -0
- package/dist/shared/rpc-types.d.ts +385 -0
- package/dist/shared/rpc-types.d.ts.map +1 -0
- package/dist/shared/rpc-utils.d.ts +162 -0
- package/dist/shared/rpc-utils.d.ts.map +1 -0
- package/dist/shared/run-token-log.d.ts +13 -0
- package/dist/shared/run-token-log.d.ts.map +1 -0
- package/dist/shared/safe-notification-target.d.ts +23 -0
- package/dist/shared/safe-notification-target.d.ts.map +1 -0
- package/dist/shared/sqlite-context-pragmas.d.ts +12 -0
- package/dist/shared/sqlite-context-pragmas.d.ts.map +1 -0
- package/dist/shared/sqlite-helpers.d.ts +25 -0
- package/dist/shared/sqlite-helpers.d.ts.map +1 -0
- package/dist/shared/sqlite-write-locker-test-support.d.ts +7 -0
- package/dist/shared/sqlite-write-locker-test-support.d.ts.map +1 -0
- package/dist/shared/sqlite.d.ts +163 -0
- package/dist/shared/sqlite.d.ts.map +1 -0
- package/dist/shared/stable-json.d.ts +21 -0
- package/dist/shared/stable-json.d.ts.map +1 -0
- package/dist/shared/status-detail-text.d.ts +4 -0
- package/dist/shared/status-detail-text.d.ts.map +1 -0
- package/dist/shared/status-summary.d.ts +54 -0
- package/dist/shared/status-summary.d.ts.map +1 -0
- package/dist/shared/status-view-check.d.ts +130 -0
- package/dist/shared/status-view-check.d.ts.map +1 -0
- package/dist/shared/status-view.d.ts +230 -0
- package/dist/shared/status-view.d.ts.map +1 -0
- package/dist/shared/storage-permissions.d.ts +29 -0
- package/dist/shared/storage-permissions.d.ts.map +1 -0
- package/dist/shared/subagent-runner.d.ts +231 -0
- package/dist/shared/subagent-runner.d.ts.map +1 -0
- package/dist/shared/summarize-child-stderr.d.ts +2 -0
- package/dist/shared/summarize-child-stderr.d.ts.map +1 -0
- package/dist/shared/system-directive.d.ts +3 -0
- package/dist/shared/system-directive.d.ts.map +1 -0
- package/dist/shared/tag-owner-id.d.ts +19 -0
- package/dist/shared/tag-owner-id.d.ts.map +1 -0
- package/dist/shared/tag-transcript.d.ts +103 -0
- package/dist/shared/tag-transcript.d.ts.map +1 -0
- package/dist/shared/tail-hygiene-status.d.ts +24 -0
- package/dist/shared/tail-hygiene-status.d.ts.map +1 -0
- package/dist/shared/test-temp-dir.d.ts +46 -0
- package/dist/shared/test-temp-dir.d.ts.map +1 -0
- package/dist/shared/transcript.d.ts +251 -0
- package/dist/shared/transcript.d.ts.map +1 -0
- package/dist/shared/user-answer.d.ts +4 -0
- package/dist/shared/user-answer.d.ts.map +1 -0
- package/dist/shared/user-facing-codes.d.ts +135 -0
- package/dist/shared/user-facing-codes.d.ts.map +1 -0
- package/dist/shared/window-geometry.d.ts +121 -0
- package/dist/shared/window-geometry.d.ts.map +1 -0
- package/dist/shared/write-transaction-timing.d.ts +11 -0
- package/dist/shared/write-transaction-timing.d.ts.map +1 -0
- package/dist/shared/xml-unescape.d.ts +9 -0
- package/dist/shared/xml-unescape.d.ts.map +1 -0
- package/dist/tools/ctx-expand/constants.d.ts +3 -0
- package/dist/tools/ctx-expand/constants.d.ts.map +1 -0
- package/dist/tools/ctx-expand/index.d.ts +2 -0
- package/dist/tools/ctx-expand/index.d.ts.map +1 -0
- package/dist/tools/ctx-expand/mode.d.ts +35 -0
- package/dist/tools/ctx-expand/mode.d.ts.map +1 -0
- package/dist/tools/ctx-expand/render.d.ts +47 -0
- package/dist/tools/ctx-expand/render.d.ts.map +1 -0
- package/dist/tools/ctx-expand/tools.d.ts +10 -0
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -0
- package/dist/tools/ctx-expand/types.d.ts +11 -0
- package/dist/tools/ctx-expand/types.d.ts.map +1 -0
- package/dist/tools/ctx-memory/constants.d.ts +3 -0
- package/dist/tools/ctx-memory/constants.d.ts.map +1 -0
- package/dist/tools/ctx-memory/index.d.ts +4 -0
- package/dist/tools/ctx-memory/index.d.ts.map +1 -0
- package/dist/tools/ctx-memory/tools.d.ts +5 -0
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -0
- package/dist/tools/ctx-memory/types.d.ts +38 -0
- package/dist/tools/ctx-memory/types.d.ts.map +1 -0
- package/dist/tools/ctx-memory/verification-recording.d.ts +8 -0
- package/dist/tools/ctx-memory/verification-recording.d.ts.map +1 -0
- package/dist/tools/ctx-note/constants.d.ts +2 -0
- package/dist/tools/ctx-note/constants.d.ts.map +1 -0
- package/dist/tools/ctx-note/index.d.ts +4 -0
- package/dist/tools/ctx-note/index.d.ts.map +1 -0
- package/dist/tools/ctx-note/render.d.ts +67 -0
- package/dist/tools/ctx-note/render.d.ts.map +1 -0
- package/dist/tools/ctx-note/tools.d.ts +13 -0
- package/dist/tools/ctx-note/tools.d.ts.map +1 -0
- package/dist/tools/ctx-note/types.d.ts +14 -0
- package/dist/tools/ctx-note/types.d.ts.map +1 -0
- package/dist/tools/ctx-reduce/constants.d.ts +4 -0
- package/dist/tools/ctx-reduce/constants.d.ts.map +1 -0
- package/dist/tools/ctx-reduce/index.d.ts +4 -0
- package/dist/tools/ctx-reduce/index.d.ts.map +1 -0
- package/dist/tools/ctx-reduce/tools.d.ts +19 -0
- package/dist/tools/ctx-reduce/tools.d.ts.map +1 -0
- package/dist/tools/ctx-reduce/types.d.ts +5 -0
- package/dist/tools/ctx-reduce/types.d.ts.map +1 -0
- package/dist/tools/ctx-search/constants.d.ts +4 -0
- package/dist/tools/ctx-search/constants.d.ts.map +1 -0
- package/dist/tools/ctx-search/date-range.d.ts +9 -0
- package/dist/tools/ctx-search/date-range.d.ts.map +1 -0
- package/dist/tools/ctx-search/index.d.ts +4 -0
- package/dist/tools/ctx-search/index.d.ts.map +1 -0
- package/dist/tools/ctx-search/tools.d.ts +5 -0
- package/dist/tools/ctx-search/tools.d.ts.map +1 -0
- package/dist/tools/ctx-search/types.d.ts +34 -0
- package/dist/tools/ctx-search/types.d.ts.map +1 -0
- package/dist/tools/light-descriptions.d.ts +6 -0
- package/dist/tools/light-descriptions.d.ts.map +1 -0
- package/dist/tools/parameter-descriptions.d.ts +75 -0
- package/dist/tools/parameter-descriptions.d.ts.map +1 -0
- package/dist/tools/unwrap-imitated-reduced-args.d.ts +21 -0
- package/dist/tools/unwrap-imitated-reduced-args.d.ts.map +1 -0
- package/dist/v2/fold/boundary.d.ts +61 -0
- package/dist/v2/fold/boundary.d.ts.map +1 -0
- package/dist/v2/fold/host-media.d.ts +36 -0
- package/dist/v2/fold/host-media.d.ts.map +1 -0
- package/dist/v2/fold/markers.d.ts +7 -0
- package/dist/v2/fold/markers.d.ts.map +1 -0
- package/dist/v2/fold/owner.d.ts +40 -0
- package/dist/v2/fold/owner.d.ts.map +1 -0
- package/dist/v2/fold/restore.d.ts +31 -0
- package/dist/v2/fold/restore.d.ts.map +1 -0
- package/dist/v2/fork-inheritance.d.ts +101 -0
- package/dist/v2/fork-inheritance.d.ts.map +1 -0
- package/dist/v2/hidden-child-cleanup.d.ts +11 -0
- package/dist/v2/hidden-child-cleanup.d.ts.map +1 -0
- package/dist/v2/hidden-child-native.d.ts +29 -0
- package/dist/v2/hidden-child-native.d.ts.map +1 -0
- package/dist/v2/hidden-child-record.d.ts +137 -0
- package/dist/v2/hidden-child-record.d.ts.map +1 -0
- package/dist/v2/hidden-completion.d.ts +57 -0
- package/dist/v2/hidden-completion.d.ts.map +1 -0
- package/dist/v2/hooks/channel2.d.ts +10 -0
- package/dist/v2/hooks/channel2.d.ts.map +1 -0
- package/dist/v2/hooks/commands.d.ts +29 -0
- package/dist/v2/hooks/commands.d.ts.map +1 -0
- package/dist/v2/hooks/context.d.ts +112 -0
- package/dist/v2/hooks/context.d.ts.map +1 -0
- package/dist/v2/hooks/deleted-session-tombstones.d.ts +10 -0
- package/dist/v2/hooks/deleted-session-tombstones.d.ts.map +1 -0
- package/dist/v2/hooks/generate.d.ts +10 -0
- package/dist/v2/hooks/generate.d.ts.map +1 -0
- package/dist/v2/hooks/hidden-child.d.ts +76 -0
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -0
- package/dist/v2/hooks/hidden-terminal-error.d.ts +8 -0
- package/dist/v2/hooks/hidden-terminal-error.d.ts.map +1 -0
- package/dist/v2/hooks/lkg-system.d.ts +11 -0
- package/dist/v2/hooks/lkg-system.d.ts.map +1 -0
- package/dist/v2/hooks/model-limit-cache.d.ts +19 -0
- package/dist/v2/hooks/model-limit-cache.d.ts.map +1 -0
- package/dist/v2/hooks/payload.d.ts +15 -0
- package/dist/v2/hooks/payload.d.ts.map +1 -0
- package/dist/v2/hooks/refusal.d.ts +15 -0
- package/dist/v2/hooks/refusal.d.ts.map +1 -0
- package/dist/v2/hooks/restore-rows.d.ts +29 -0
- package/dist/v2/hooks/restore-rows.d.ts.map +1 -0
- package/dist/v2/hooks/rpc-live-state.d.ts +9 -0
- package/dist/v2/hooks/rpc-live-state.d.ts.map +1 -0
- package/dist/v2/hooks/session-api-gate.d.ts +4 -0
- package/dist/v2/hooks/session-api-gate.d.ts.map +1 -0
- package/dist/v2/hooks/session-project-backfill.d.ts +15 -0
- package/dist/v2/hooks/session-project-backfill.d.ts.map +1 -0
- package/dist/v2/hooks/storage-gate.d.ts +48 -0
- package/dist/v2/hooks/storage-gate.d.ts.map +1 -0
- package/dist/v2/hooks/storage-notice.d.ts +29 -0
- package/dist/v2/hooks/storage-notice.d.ts.map +1 -0
- package/dist/v2/hooks/store.d.ts +58 -0
- package/dist/v2/hooks/store.d.ts.map +1 -0
- package/dist/v2/hooks/tools.d.ts +8 -0
- package/dist/v2/hooks/tools.d.ts.map +1 -0
- package/dist/v2/hooks/types.d.ts +250 -0
- package/dist/v2/hooks/types.d.ts.map +1 -0
- package/dist/v2/hooks/usage-persist.d.ts +31 -0
- package/dist/v2/hooks/usage-persist.d.ts.map +1 -0
- package/dist/v2/hooks/usage-reading.d.ts +46 -0
- package/dist/v2/hooks/usage-reading.d.ts.map +1 -0
- package/dist/v2/server.d.ts +27 -0
- package/dist/v2/server.d.ts.map +1 -0
- package/dist/v2/server.js +76235 -0
- package/dist/v2/store-reader.d.ts +218 -0
- package/dist/v2/store-reader.d.ts.map +1 -0
- package/dist/web/api.d.ts +40 -0
- package/dist/web/api.d.ts.map +1 -0
- package/dist/web/context-store.d.ts +74 -0
- package/dist/web/context-store.d.ts.map +1 -0
- package/dist/web/fixtures.d.ts +53 -0
- package/dist/web/fixtures.d.ts.map +1 -0
- package/dist/web/host-opencode.d.ts +56 -0
- package/dist/web/host-opencode.d.ts.map +1 -0
- package/dist/web/host-pi.d.ts +116 -0
- package/dist/web/host-pi.d.ts.map +1 -0
- package/dist/web/main.d.ts +24 -0
- package/dist/web/main.d.ts.map +1 -0
- package/dist/web/main.js +6071 -0
- package/dist/web/memories.d.ts +67 -0
- package/dist/web/memories.d.ts.map +1 -0
- package/dist/web/server.d.ts +42 -0
- package/dist/web/server.d.ts.map +1 -0
- package/dist/web/types.d.ts +52 -0
- package/dist/web/types.d.ts.map +1 -0
- package/dist/web/ui/favicon.svg +4 -0
- package/dist/web/ui/index.html +36 -0
- package/dist/web/ui/panel.css +8 -0
- package/dist/web/ui/panel.js +373 -0
- package/dist/web/views.d.ts +155 -0
- package/dist/web/views.d.ts.map +1 -0
- package/dist/web/writes.d.ts +86 -0
- package/dist/web/writes.d.ts.map +1 -0
- package/dist/wrapup-orchestrator-z9sqpqjf.js +420 -0
- package/index.js +1 -0
- package/package.json +84 -4
- package/src/agents/historian.ts +3 -0
- package/src/agents/language-directive.test.ts +129 -0
- package/src/agents/language-directive.ts +113 -0
- package/src/agents/magic-context-prompt.language.test.ts +37 -0
- package/src/agents/magic-context-prompt.test.ts +520 -0
- package/src/agents/magic-context-prompt.ts +196 -0
- package/src/agents/memory-maintainer.test.ts +249 -0
- package/src/agents/memory-maintainer.ts +374 -0
- package/src/config/agent-disable.ts +58 -0
- package/src/config/compaction-accessor-guard.test.ts +81 -0
- package/src/config/compaction-backcompat.test.ts +52 -0
- package/src/config/config-paths.ts +42 -0
- package/src/config/index.test.ts +1252 -0
- package/src/config/index.ts +762 -0
- package/src/config/latch-permanence-guard.test.ts +218 -0
- package/src/config/live-run-config.test.ts +139 -0
- package/src/config/live-run-config.ts +79 -0
- package/src/config/live-schema-drift.test.ts +67 -0
- package/src/config/live-snapshot.test.ts +86 -0
- package/src/config/live-snapshot.ts +187 -0
- package/src/config/migrate-experimental.ts +92 -0
- package/src/config/misplaced-agent-model.test.ts +55 -0
- package/src/config/profiles.ts +106 -0
- package/src/config/project-config-trust-boundary.test.ts +185 -0
- package/src/config/project-security.hostile-matrix.test.ts +281 -0
- package/src/config/project-security.test.ts +329 -0
- package/src/config/project-security.ts +940 -0
- package/src/config/protected-tokens.test.ts +229 -0
- package/src/config/prune-config-leaf.test.ts +78 -0
- package/src/config/prune-config-leaf.ts +67 -0
- package/src/config/raw-loader.test.ts +389 -0
- package/src/config/raw-loader.ts +435 -0
- package/src/config/removed-agent-config.ts +45 -0
- package/src/config/removed-agent-source-fence.test.ts +53 -0
- package/src/config/removed-config-keys.test.ts +106 -0
- package/src/config/schema/agent-overrides.ts +45 -0
- package/src/config/schema/magic-context.test.ts +434 -0
- package/src/config/schema/magic-context.ts +1019 -0
- package/src/config/variable.test.ts +324 -0
- package/src/config/variable.ts +192 -0
- package/src/shared/__fixtures__/window-overlay.v1.json +337 -0
- package/src/shared/announcement.test.ts +198 -0
- package/src/shared/announcement.ts +145 -0
- package/src/shared/assistant-message-extractor.test.ts +47 -0
- package/src/shared/assistant-message-extractor.ts +156 -0
- package/src/shared/auto-update-provenance.ts +42 -0
- package/src/shared/bounded-session-map.test.ts +97 -0
- package/src/shared/bounded-session-map.ts +84 -0
- package/src/shared/builtin-commands.ts +46 -0
- package/src/shared/cache-ttl-display.test.ts +84 -0
- package/src/shared/cache-ttl-display.ts +58 -0
- package/src/shared/cache-ttl-seed.ts +23 -0
- package/src/shared/child-session-teardown.test.ts +241 -0
- package/src/shared/child-session-teardown.ts +66 -0
- package/src/shared/commit-detection.test.ts +63 -0
- package/src/shared/commit-detection.ts +53 -0
- package/src/shared/config-diagnostics.test.ts +29 -0
- package/src/shared/config-diagnostics.ts +64 -0
- package/src/shared/conflict-detector.test.ts +780 -0
- package/src/shared/conflict-detector.ts +596 -0
- package/src/shared/conflict-fixer.test.ts +608 -0
- package/src/shared/conflict-fixer.ts +295 -0
- package/src/shared/context-limit-provenance.ts +6 -0
- package/src/shared/data-path.test.ts +352 -0
- package/src/shared/data-path.ts +310 -0
- package/src/shared/error-message.test.ts +94 -0
- package/src/shared/error-message.ts +115 -0
- package/src/shared/escalation-bands.test.ts +23 -0
- package/src/shared/escalation-bands.ts +18 -0
- package/src/shared/format-bytes.ts +5 -0
- package/src/shared/format-threshold.ts +54 -0
- package/src/shared/harness-provider-map.test.ts +176 -0
- package/src/shared/harness-provider-map.ts +130 -0
- package/src/shared/harness.ts +76 -0
- package/src/shared/hidden-variant-warnings.ts +21 -0
- package/src/shared/historian-tool-defaults.json +13 -0
- package/src/shared/historian-tool-expansions.ts +18 -0
- package/src/shared/historian-tool-template.ts +248 -0
- package/src/shared/historian-transient-error.test.ts +36 -0
- package/src/shared/historian-transient-error.ts +22 -0
- package/src/shared/host-limitations.ts +43 -0
- package/src/shared/index.ts +7 -0
- package/src/shared/internal-initiator-marker.ts +1 -0
- package/src/shared/jsonc-edit.ts +387 -0
- package/src/shared/jsonc-parser.test.ts +46 -0
- package/src/shared/jsonc-parser.ts +283 -0
- package/src/shared/keep-subagents.test.ts +39 -0
- package/src/shared/keep-subagents.ts +28 -0
- package/src/shared/logger.test.ts +292 -0
- package/src/shared/logger.ts +248 -0
- package/src/shared/model-cache-ttl.test.ts +40 -0
- package/src/shared/model-cache-ttl.ts +58 -0
- package/src/shared/model-resolution.test.ts +132 -0
- package/src/shared/model-resolution.ts +158 -0
- package/src/shared/model-suggestion-retry.test.ts +698 -0
- package/src/shared/model-suggestion-retry.ts +838 -0
- package/src/shared/models-dev-cache.test.ts +720 -0
- package/src/shared/models-dev-cache.ts +661 -0
- package/src/shared/normalize-sdk-response.ts +40 -0
- package/src/shared/opencode-config-dir-types.ts +15 -0
- package/src/shared/opencode-config-dir.ts +111 -0
- package/src/shared/opencode-db-path.test.ts +389 -0
- package/src/shared/opencode-db-path.ts +396 -0
- package/src/shared/opencode-host-generation.test.ts +29 -0
- package/src/shared/pi-executable.ts +20 -0
- package/src/shared/plugin-package-version.ts +52 -0
- package/src/shared/project-directory-key.test.ts +111 -0
- package/src/shared/project-directory-key.ts +54 -0
- package/src/shared/prompt-context.ts +135 -0
- package/src/shared/prompt-surface-a1-golden.md +407 -0
- package/src/shared/prompt-surface-a1-golden.ts +41 -0
- package/src/shared/prompt-surface-runtime.test.ts +190 -0
- package/src/shared/prompt-surface-runtime.ts +263 -0
- package/src/shared/prompt-surface.test.ts +195 -0
- package/src/shared/prompt-surface.ts +162 -0
- package/src/shared/provider-response-completion.ts +23 -0
- package/src/shared/record-type-guard.ts +3 -0
- package/src/shared/redaction.test.ts +134 -0
- package/src/shared/redaction.ts +298 -0
- package/src/shared/resolve-fallbacks.test.ts +114 -0
- package/src/shared/resolve-fallbacks.ts +95 -0
- package/src/shared/rpc-async-probes.test.ts +320 -0
- package/src/shared/rpc-client.test.ts +576 -0
- package/src/shared/rpc-client.ts +218 -0
- package/src/shared/rpc-notifications.test.ts +151 -0
- package/src/shared/rpc-notifications.ts +222 -0
- package/src/shared/rpc-server.ts +431 -0
- package/src/shared/rpc-types.ts +386 -0
- package/src/shared/rpc-utils.test.ts +822 -0
- package/src/shared/rpc-utils.ts +1146 -0
- package/src/shared/run-token-log.test.ts +65 -0
- package/src/shared/run-token-log.ts +39 -0
- package/src/shared/safe-notification-target.test.ts +97 -0
- package/src/shared/safe-notification-target.ts +102 -0
- package/src/shared/session-messages-bounded.test.ts +112 -0
- package/src/shared/sqlite-acquisition-fence.test.ts +133 -0
- package/src/shared/sqlite-acquisition-routing.test.ts +145 -0
- package/src/shared/sqlite-bind-style.test.ts +80 -0
- package/src/shared/sqlite-context-pragmas.ts +24 -0
- package/src/shared/sqlite-helpers.ts +44 -0
- package/src/shared/sqlite-import-fence.test.ts +19 -0
- package/src/shared/sqlite-pass-scope.test.ts +154 -0
- package/src/shared/sqlite-transaction-mode-guard.test.ts +234 -0
- package/src/shared/sqlite-write-locker-test-support.ts +63 -0
- package/src/shared/sqlite.test.ts +58 -0
- package/src/shared/sqlite.ts +988 -0
- package/src/shared/stable-json.test.ts +87 -0
- package/src/shared/stable-json.ts +37 -0
- package/src/shared/status-detail-text.test.ts +194 -0
- package/src/shared/status-detail-text.ts +7 -0
- package/src/shared/status-summary.ts +189 -0
- package/src/shared/status-view-check.test.ts +252 -0
- package/src/shared/status-view-check.ts +519 -0
- package/src/shared/status-view.test.ts +395 -0
- package/src/shared/status-view.ts +794 -0
- package/src/shared/storage-busy.test.ts +73 -0
- package/src/shared/storage-permissions.test.ts +190 -0
- package/src/shared/storage-permissions.ts +212 -0
- package/src/shared/subagent-runner.ts +240 -0
- package/src/shared/summarize-child-stderr.test.ts +55 -0
- package/src/shared/summarize-child-stderr.ts +33 -0
- package/src/shared/system-directive.ts +9 -0
- package/src/shared/tag-owner-id.test.ts +33 -0
- package/src/shared/tag-owner-id.ts +29 -0
- package/src/shared/tag-transcript.test.ts +554 -0
- package/src/shared/tag-transcript.ts +1400 -0
- package/src/shared/tail-hygiene-status.ts +73 -0
- package/src/shared/test-temp-dir.test.ts +84 -0
- package/src/shared/test-temp-dir.ts +192 -0
- package/src/shared/transcript.ts +274 -0
- package/src/shared/user-answer.test.ts +12 -0
- package/src/shared/user-answer.ts +17 -0
- package/src/shared/user-facing-codes.test.ts +82 -0
- package/src/shared/user-facing-codes.ts +180 -0
- package/src/shared/window-geometry.test.ts +405 -0
- package/src/shared/window-geometry.ts +726 -0
- package/src/shared/windows-hidden-spawns.test.ts +133 -0
- package/src/shared/write-transaction-attribution.test.ts +214 -0
- package/src/shared/write-transaction-timing.ts +26 -0
- package/src/shared/xml-unescape.ts +19 -0
- package/README.md +0 -3
|
@@ -0,0 +1,1252 @@
|
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
|
+
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
|
|
6
|
+
import { resolveEpochFloorForPass } from "../features/magic-context/storage-meta-persisted";
|
|
7
|
+
import { resolveHistorianModel } from "../shared/model-resolution";
|
|
8
|
+
import { Database } from "../shared/sqlite";
|
|
9
|
+
import { createTestTempDir, createTestTempDirFromPath } from "../shared/test-temp-dir";
|
|
10
|
+
import {
|
|
11
|
+
getWindowOverlay,
|
|
12
|
+
reloadWindowOverlay,
|
|
13
|
+
setWindowOverlayPath,
|
|
14
|
+
} from "../shared/window-geometry";
|
|
15
|
+
import { loadPluginConfig, loadPluginConfigDetailed } from "./index";
|
|
16
|
+
import { resolveConfigProfile } from "./profiles";
|
|
17
|
+
import { getProtectedTokensTierOverrides } from "./project-security";
|
|
18
|
+
import { REMOVED_AGENT_CONFIG_WARNING } from "./removed-agent-config";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Writes a mmc.jsonc file inside a fresh temp XDG_CONFIG_HOME tree
|
|
22
|
+
* and runs loadPluginConfig against it. Returns warnings + parsed config.
|
|
23
|
+
*
|
|
24
|
+
* Scope directory is NOT set — we pass a unique directory that does not
|
|
25
|
+
* contain a project config so only the user config is loaded.
|
|
26
|
+
*/
|
|
27
|
+
function loadWithUserConfig(configText: string, extraEnv: Record<string, string> = {}) {
|
|
28
|
+
const xdg = createTestTempDirFromPath(join(tmpdir(), "mc-config-test-"));
|
|
29
|
+
// The loader reads user config from <XDG>/opencode/ ($OPENCODE_CONFIG_DIR would win, but is unset here).
|
|
30
|
+
const configDir = join(xdg, "opencode");
|
|
31
|
+
const fs = require("node:fs") as typeof import("node:fs");
|
|
32
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
33
|
+
writeFileSync(join(configDir, "mmc.jsonc"), configText, "utf-8");
|
|
34
|
+
|
|
35
|
+
const origXdg = process.env.XDG_CONFIG_HOME;
|
|
36
|
+
const savedEnv: Record<string, string | undefined> = {};
|
|
37
|
+
for (const [k, v] of Object.entries(extraEnv)) {
|
|
38
|
+
savedEnv[k] = process.env[k];
|
|
39
|
+
process.env[k] = v;
|
|
40
|
+
}
|
|
41
|
+
process.env.XDG_CONFIG_HOME = xdg;
|
|
42
|
+
|
|
43
|
+
// Use a directory that definitely has no project config so only the
|
|
44
|
+
// user config feeds the loader. We use a sibling temp directory.
|
|
45
|
+
const projectDir = createTestTempDirFromPath(join(tmpdir(), "mc-config-proj-"));
|
|
46
|
+
try {
|
|
47
|
+
return loadPluginConfig(projectDir);
|
|
48
|
+
} finally {
|
|
49
|
+
if (origXdg === undefined) {
|
|
50
|
+
delete process.env.XDG_CONFIG_HOME;
|
|
51
|
+
} else {
|
|
52
|
+
process.env.XDG_CONFIG_HOME = origXdg;
|
|
53
|
+
}
|
|
54
|
+
for (const [k, v] of Object.entries(savedEnv)) {
|
|
55
|
+
if (v === undefined) delete process.env[k];
|
|
56
|
+
else process.env[k] = v;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
rmSync(xdg, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
60
|
+
} catch {
|
|
61
|
+
/* Ignore EBUSY on Windows */
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
rmSync(projectDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
65
|
+
} catch {
|
|
66
|
+
/* Ignore EBUSY on Windows */
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function loadWithUserAndProjectConfig(
|
|
72
|
+
userConfigText: string,
|
|
73
|
+
projectConfigText: string,
|
|
74
|
+
extraEnv: Record<string, string> = {},
|
|
75
|
+
) {
|
|
76
|
+
const xdg = createTestTempDirFromPath(join(tmpdir(), "mc-config-test-"));
|
|
77
|
+
const projectDir = createTestTempDirFromPath(join(tmpdir(), "mc-config-proj-"));
|
|
78
|
+
const fs = require("node:fs") as typeof import("node:fs");
|
|
79
|
+
// User config at <XDG>/opencode/, project at <root>/.mmc/.
|
|
80
|
+
const configDir = join(xdg, "opencode");
|
|
81
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
82
|
+
fs.mkdirSync(join(projectDir, ".mmc"), { recursive: true });
|
|
83
|
+
writeFileSync(join(configDir, "mmc.jsonc"), userConfigText, "utf-8");
|
|
84
|
+
writeFileSync(join(projectDir, ".mmc", "mmc.jsonc"), projectConfigText, "utf-8");
|
|
85
|
+
|
|
86
|
+
const origXdg = process.env.XDG_CONFIG_HOME;
|
|
87
|
+
const savedEnv: Record<string, string | undefined> = {};
|
|
88
|
+
for (const [k, v] of Object.entries(extraEnv)) {
|
|
89
|
+
savedEnv[k] = process.env[k];
|
|
90
|
+
process.env[k] = v;
|
|
91
|
+
}
|
|
92
|
+
process.env.XDG_CONFIG_HOME = xdg;
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
return loadPluginConfig(projectDir);
|
|
96
|
+
} finally {
|
|
97
|
+
if (origXdg === undefined) {
|
|
98
|
+
delete process.env.XDG_CONFIG_HOME;
|
|
99
|
+
} else {
|
|
100
|
+
process.env.XDG_CONFIG_HOME = origXdg;
|
|
101
|
+
}
|
|
102
|
+
for (const [k, v] of Object.entries(savedEnv)) {
|
|
103
|
+
if (v === undefined) delete process.env[k];
|
|
104
|
+
else process.env[k] = v;
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
rmSync(xdg, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
108
|
+
} catch {
|
|
109
|
+
/* Ignore EBUSY on Windows */
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
rmSync(projectDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
113
|
+
} catch {
|
|
114
|
+
/* Ignore EBUSY on Windows */
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
describe("loadPluginConfig — Fusiform overlay reload", () => {
|
|
120
|
+
it("does not invalidate a same-path overlay during routine config reads", () => {
|
|
121
|
+
const overlayDir = createTestTempDirFromPath(join(tmpdir(), "mc-config-overlay-"));
|
|
122
|
+
const overlayPath = join(overlayDir, "window-overlay.json");
|
|
123
|
+
const configText = JSON.stringify({ models: { window_overlay_path: overlayPath } });
|
|
124
|
+
const writeOverlay = (modelId: string) =>
|
|
125
|
+
writeFileSync(
|
|
126
|
+
overlayPath,
|
|
127
|
+
JSON.stringify({
|
|
128
|
+
schema: "fusiform-window-overlay/v1",
|
|
129
|
+
generated_at: "2026-09-01T00:00:00Z",
|
|
130
|
+
minted_provider_ids: [],
|
|
131
|
+
cells: [{ provider_id: "hunt-provider", model_id: modelId, facts: {} }],
|
|
132
|
+
}),
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
writeOverlay("before-rewrite");
|
|
137
|
+
loadWithUserConfig(configText);
|
|
138
|
+
expect(getWindowOverlay()?.cells[0]?.model_id).toBe("before-rewrite");
|
|
139
|
+
|
|
140
|
+
writeOverlay("after-rewrite");
|
|
141
|
+
expect(getWindowOverlay()?.cells[0]?.model_id).toBe("before-rewrite");
|
|
142
|
+
|
|
143
|
+
loadWithUserConfig(configText);
|
|
144
|
+
expect(getWindowOverlay()?.cells[0]?.model_id).toBe("before-rewrite");
|
|
145
|
+
|
|
146
|
+
reloadWindowOverlay(overlayPath);
|
|
147
|
+
expect(getWindowOverlay()?.cells[0]?.model_id).toBe("after-rewrite");
|
|
148
|
+
} finally {
|
|
149
|
+
setWindowOverlayPath(undefined);
|
|
150
|
+
rmSync(overlayDir, { recursive: true, force: true });
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
describe("loadPluginConfig — preload user-config isolation", () => {
|
|
156
|
+
it("resolves schema-default config for a fixture with no config (#388)", () => {
|
|
157
|
+
const projectDir = createTestTempDirFromPath(join(tmpdir(), "mc-config-preload-fixture-"));
|
|
158
|
+
try {
|
|
159
|
+
// The test preload owns this default. A per-test XDG_CONFIG_HOME assignment
|
|
160
|
+
// still overrides it through loadWithUserConfig below.
|
|
161
|
+
expect(process.env.XDG_CONFIG_HOME).toContain("mc-plugin-test-xdg-pid-");
|
|
162
|
+
expect(loadPluginConfig(projectDir).cache_ttl).toBe("5m");
|
|
163
|
+
} finally {
|
|
164
|
+
rmSync(projectDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it("allows a test-scoped XDG_CONFIG_HOME to override the preload default", () => {
|
|
169
|
+
const preloadConfigHome = process.env.XDG_CONFIG_HOME;
|
|
170
|
+
const result = loadWithUserConfig(
|
|
171
|
+
JSON.stringify({
|
|
172
|
+
memory: { enabled: false },
|
|
173
|
+
}),
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
expect(result.memory.enabled).toBe(false);
|
|
177
|
+
expect(process.env.XDG_CONFIG_HOME).toBe(preloadConfigHome);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
describe("loadPluginConfig — parse failure diagnostics", () => {
|
|
182
|
+
it("recovers the reporter's stray leading character and keeps a loud location warning", () => {
|
|
183
|
+
const result = loadWithUserConfig('\\{\n "cache_ttl": "1h"\n}');
|
|
184
|
+
|
|
185
|
+
expect(result.cache_ttl).toBe("1h");
|
|
186
|
+
expect(result.configParseFailures).toHaveLength(1);
|
|
187
|
+
expect(result.configParseFailures?.[0]).toMatchObject({
|
|
188
|
+
warningClass: "file-parse",
|
|
189
|
+
line: 1,
|
|
190
|
+
column: 1,
|
|
191
|
+
recovered: true,
|
|
192
|
+
message: "invalid symbol",
|
|
193
|
+
});
|
|
194
|
+
expect(result.configWarnings?.[0]).toContain(":1:1: invalid symbol");
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it("keeps file parse and invalid-leaf warning classes distinct", () => {
|
|
198
|
+
const parseResult = loadWithUserConfig('\\{\n "cache_ttl": "1h"\n}');
|
|
199
|
+
const leafResult = loadWithUserConfig('{"protected_tokens":"bogus"}');
|
|
200
|
+
|
|
201
|
+
expect(parseResult.configWarningDetails?.[0]?.warningClass).toBe("file-parse");
|
|
202
|
+
expect(
|
|
203
|
+
leafResult.configWarningDetails?.some(
|
|
204
|
+
(detail) => detail.warningClass === "invalid-leaf",
|
|
205
|
+
),
|
|
206
|
+
).toBe(true);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
describe("loadPluginConfig — secret redaction", () => {
|
|
211
|
+
it("does NOT leak resolved env values through Zod validation warnings", () => {
|
|
212
|
+
const secret = "sk-live-CARDINAL-SIN-IF-THIS-APPEARS-IN-LOGS";
|
|
213
|
+
const config = JSON.stringify({
|
|
214
|
+
// `historian_timeout_ms` has a minimum of 60_000. Feeding the
|
|
215
|
+
// substituted secret string here causes Zod to reject the field
|
|
216
|
+
// and route through the warning path we care about.
|
|
217
|
+
historian_timeout_ms: "{env:MC_TEST_SECRET}",
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
const result = loadWithUserConfig(config, { MC_TEST_SECRET: secret });
|
|
221
|
+
const warnings = result.configWarnings ?? [];
|
|
222
|
+
|
|
223
|
+
// The plugin should still load (enabled: true kept by recovery path).
|
|
224
|
+
expect(result.enabled).toBe(true);
|
|
225
|
+
|
|
226
|
+
// No warning or config field may contain the resolved secret.
|
|
227
|
+
const allText = JSON.stringify({ config: result, warnings });
|
|
228
|
+
expect(allText).not.toContain(secret);
|
|
229
|
+
expect(allText).not.toContain("CARDINAL-SIN");
|
|
230
|
+
|
|
231
|
+
// But the warnings should still describe what failed. We expect a
|
|
232
|
+
// warning mentioning historian_timeout_ms and the safe type summary.
|
|
233
|
+
const relevantWarning = warnings.find((w) => w.includes("historian_timeout_ms"));
|
|
234
|
+
expect(relevantWarning).toBeDefined();
|
|
235
|
+
expect(relevantWarning).toContain("invalid value");
|
|
236
|
+
// Must show type + length, not the value itself.
|
|
237
|
+
expect(relevantWarning).toMatch(/string, \d+ chars?/);
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
it("redacts long string values of any source (not just env-substituted)", () => {
|
|
241
|
+
// Verifies the redaction applies to plain invalid values too — we
|
|
242
|
+
// don't want to special-case env vs non-env because we can't tell
|
|
243
|
+
// them apart at the Zod layer.
|
|
244
|
+
const config = JSON.stringify({
|
|
245
|
+
historian_timeout_ms: "super-secret-plain-literal-that-should-not-leak",
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
const result = loadWithUserConfig(config);
|
|
249
|
+
const warnings = result.configWarnings ?? [];
|
|
250
|
+
const combined = warnings.join("\n");
|
|
251
|
+
|
|
252
|
+
expect(combined).not.toContain("super-secret-plain-literal-that-should-not-leak");
|
|
253
|
+
expect(combined).toMatch(/string, \d+ chars?/);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it("redacts nested object values to structural shape only", () => {
|
|
257
|
+
const config = JSON.stringify({
|
|
258
|
+
historian_timeout_ms: { nested: "secret-xyz", apiKey: "also-secret" },
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
const result = loadWithUserConfig(config);
|
|
262
|
+
const warnings = result.configWarnings ?? [];
|
|
263
|
+
const combined = warnings.join("\n");
|
|
264
|
+
|
|
265
|
+
expect(combined).not.toContain("secret-xyz");
|
|
266
|
+
expect(combined).not.toContain("also-secret");
|
|
267
|
+
expect(combined).toContain("object with keys");
|
|
268
|
+
expect(combined).toContain("nested");
|
|
269
|
+
expect(combined).toContain("apiKey");
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
it("recovers an invalid NESTED field without wiping valid siblings in the same block", () => {
|
|
273
|
+
// Regression: one bad nested field (memory.injection_budget_tokens as a
|
|
274
|
+
// string) must NOT delete the whole `memory` block — which would silently
|
|
275
|
+
// drop valid siblings like memory.auto_search.enabled. Recovery
|
|
276
|
+
// should prune only the invalid leaf and keep the rest.
|
|
277
|
+
const config = JSON.stringify({
|
|
278
|
+
memory: {
|
|
279
|
+
injection_budget_tokens: "not-a-number", // invalid nested leaf
|
|
280
|
+
auto_search: { enabled: false }, // valid sibling — must survive
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
const result = loadWithUserConfig(config);
|
|
285
|
+
const warnings = result.configWarnings ?? [];
|
|
286
|
+
|
|
287
|
+
expect(result.enabled).toBe(true);
|
|
288
|
+
// The valid sibling the user explicitly set must be preserved, not reset
|
|
289
|
+
// to the schema default (true).
|
|
290
|
+
expect(result.memory.auto_search.enabled).toBe(false);
|
|
291
|
+
// The invalid leaf falls back to its schema default.
|
|
292
|
+
expect(typeof result.memory.injection_budget_tokens).toBe("number");
|
|
293
|
+
// A warning should name the pruned nested field.
|
|
294
|
+
const w = warnings.find(
|
|
295
|
+
(x) => x.includes("memory") && x.includes("injection_budget_tokens"),
|
|
296
|
+
);
|
|
297
|
+
expect(w).toBeDefined();
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
it("prunes an invalid expansion template without losing valid siblings", () => {
|
|
301
|
+
const result = loadWithUserConfig(
|
|
302
|
+
JSON.stringify({
|
|
303
|
+
historian: {
|
|
304
|
+
expand_tools: {
|
|
305
|
+
ask: "${input.x.nope()}",
|
|
306
|
+
peer_send: false,
|
|
307
|
+
read: "Read ${input.path}",
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
}),
|
|
311
|
+
);
|
|
312
|
+
expect(result.historian?.expand_tools?.ask).toBeUndefined();
|
|
313
|
+
expect(result.historian?.expand_tools?.peer_send).toBe(false);
|
|
314
|
+
expect(result.historian?.expand_tools?.read).toBe("Read ${input.path}");
|
|
315
|
+
expect(result.configWarnings?.join("\n")).toContain("historian.expand_tools.ask");
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
it("allows project expansion overrides without changing historian model authority", () => {
|
|
319
|
+
const result = loadWithUserAndProjectConfig(
|
|
320
|
+
JSON.stringify({
|
|
321
|
+
historian: {
|
|
322
|
+
opencode: { model: "trusted/historian" },
|
|
323
|
+
expand_tools: { ask: "Question ${input.question}", peer_send: false },
|
|
324
|
+
},
|
|
325
|
+
}),
|
|
326
|
+
JSON.stringify({
|
|
327
|
+
historian: {
|
|
328
|
+
opencode: { model: "untrusted/historian" },
|
|
329
|
+
expand_tools: { ask: false, board: '${input.ops.each("${op}")}' },
|
|
330
|
+
},
|
|
331
|
+
}),
|
|
332
|
+
);
|
|
333
|
+
expect(result.historian?.expand_tools).toEqual({
|
|
334
|
+
ask: false,
|
|
335
|
+
peer_send: false,
|
|
336
|
+
board: '${input.ops.each("${op}")}',
|
|
337
|
+
});
|
|
338
|
+
expect(result.historian?.opencode?.model).toBe("trusted/historian");
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
it("prunes only cross-harness qualifier leaves and names their full paths", () => {
|
|
342
|
+
const result = loadWithUserConfig(
|
|
343
|
+
JSON.stringify({
|
|
344
|
+
historian: {
|
|
345
|
+
two_pass: true,
|
|
346
|
+
opencode: {
|
|
347
|
+
model: "anthropic/claude-sonnet",
|
|
348
|
+
variant: "high",
|
|
349
|
+
thinking_level: "minimal",
|
|
350
|
+
},
|
|
351
|
+
pi: {
|
|
352
|
+
model: "github-copilot/gpt-5",
|
|
353
|
+
thinking_level: "medium",
|
|
354
|
+
variant: "fast",
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
}),
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
expect(result.historian?.two_pass).toBe(true);
|
|
361
|
+
expect(result.historian?.opencode).toEqual({
|
|
362
|
+
model: "anthropic/claude-sonnet",
|
|
363
|
+
variant: "high",
|
|
364
|
+
});
|
|
365
|
+
expect(result.historian?.pi).toEqual({
|
|
366
|
+
model: "github-copilot/gpt-5",
|
|
367
|
+
thinking_level: "medium",
|
|
368
|
+
});
|
|
369
|
+
const warnings = result.configWarnings?.join("\n") ?? "";
|
|
370
|
+
expect(warnings).toContain("historian.opencode.thinking_level");
|
|
371
|
+
expect(warnings).toContain("historian.pi.variant");
|
|
372
|
+
expect(warnings).not.toContain("invalid agent configuration, ignoring");
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
it("still shows numeric and boolean invalid values (not secrets by nature)", () => {
|
|
376
|
+
// Numbers/booleans in config fields are never secrets — they're
|
|
377
|
+
// plain validation mistakes — so we surface them fully to help
|
|
378
|
+
// the user diagnose.
|
|
379
|
+
const config = JSON.stringify({
|
|
380
|
+
execute_threshold_percentage: 5, // below min (20)
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
const result = loadWithUserConfig(config);
|
|
384
|
+
const warnings = result.configWarnings ?? [];
|
|
385
|
+
const combined = warnings.join("\n");
|
|
386
|
+
|
|
387
|
+
expect(combined).toContain("execute_threshold_percentage");
|
|
388
|
+
// `number 5` is the human-friendly safe render.
|
|
389
|
+
expect(combined).toMatch(/number 5/);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
it("rejects execute_threshold_percentage > 90 with the cache-safety explanation (issue #111)", () => {
|
|
393
|
+
const config = JSON.stringify({
|
|
394
|
+
execute_threshold_percentage: 91, // above cap (90)
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
const result = loadWithUserConfig(config);
|
|
398
|
+
const warnings = result.configWarnings ?? [];
|
|
399
|
+
const combined = warnings.join("\n");
|
|
400
|
+
|
|
401
|
+
expect(combined).toContain("execute_threshold_percentage");
|
|
402
|
+
// The custom message explains WHY, not just "too big".
|
|
403
|
+
expect(combined).toContain("capped at 90% for cache safety");
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
it("honors user storage permissions while ignoring a project-tier override", () => {
|
|
407
|
+
const result = loadWithUserAndProjectConfig(
|
|
408
|
+
JSON.stringify({ storage: { enforce_private_permissions: false } }),
|
|
409
|
+
JSON.stringify({ storage: { enforce_private_permissions: true, futureSibling: 1 } }),
|
|
410
|
+
);
|
|
411
|
+
|
|
412
|
+
expect(result.storage.enforce_private_permissions).toBe(false);
|
|
413
|
+
expect(result.configWarnings?.join("\n")).toContain("storage.enforce_private_permissions");
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
it("rejects prototype-pollution keys before project security filtering and merging", () => {
|
|
417
|
+
const projectConfig = `{
|
|
418
|
+
"__proto__": {
|
|
419
|
+
"fail_closed_blocking": false,
|
|
420
|
+
"storage": { "enforce_private_permissions": false }
|
|
421
|
+
}
|
|
422
|
+
}`;
|
|
423
|
+
|
|
424
|
+
const result = loadWithUserAndProjectConfig("{}", projectConfig);
|
|
425
|
+
|
|
426
|
+
expect(result.fail_closed_blocking).toBe(true);
|
|
427
|
+
expect(result.storage.enforce_private_permissions).toBe(true);
|
|
428
|
+
expect(result.configWarnings?.join("\n")).toContain("prototype-pollution");
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
describe("loadPluginConfig — experimental graduation migration", () => {
|
|
433
|
+
// These cover the experimental.* → top-level/memory.* graduation chain.
|
|
434
|
+
it("is a no-op when no experimental block exists", () => {
|
|
435
|
+
const config = JSON.stringify({ enabled: true });
|
|
436
|
+
const result = loadWithUserConfig(config);
|
|
437
|
+
// No warning, no disruption.
|
|
438
|
+
expect(result.configWarnings).toBeUndefined();
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
it("temporal_awareness and memory.auto_search default ON; caveman default OFF", () => {
|
|
442
|
+
const result = loadWithUserConfig(JSON.stringify({ enabled: true }));
|
|
443
|
+
expect(result.temporal_awareness).toBe(true);
|
|
444
|
+
expect(result.memory.auto_search.enabled).toBe(true);
|
|
445
|
+
expect(result.caveman_text_compression.enabled).toBe(false);
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
it("relocates legacy experimental.* graduated keys to top-level + memory.* (run-doctor warning)", () => {
|
|
449
|
+
const config = JSON.stringify({
|
|
450
|
+
experimental: {
|
|
451
|
+
temporal_awareness: false,
|
|
452
|
+
auto_search: { enabled: false },
|
|
453
|
+
caveman_text_compression: { enabled: true, min_chars: 800 },
|
|
454
|
+
},
|
|
455
|
+
});
|
|
456
|
+
const result = loadWithUserConfig(config);
|
|
457
|
+
// Explicit user values survive the relocation (opt-outs/opt-ins preserved).
|
|
458
|
+
expect(result.temporal_awareness).toBe(false);
|
|
459
|
+
expect(result.caveman_text_compression.enabled).toBe(true);
|
|
460
|
+
expect(result.caveman_text_compression.min_chars).toBe(800);
|
|
461
|
+
// auto_search lands under memory.*
|
|
462
|
+
expect(result.memory.auto_search.enabled).toBe(false);
|
|
463
|
+
const warnings = result.configWarnings?.join("\n") ?? "";
|
|
464
|
+
expect(warnings).toContain("experimental.temporal_awareness");
|
|
465
|
+
expect(warnings).toContain('"memory.auto_search"');
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
describe("loadPluginConfig — legacy agent enabled migration", () => {
|
|
470
|
+
it("ignores the removed agent block with one warning", () => {
|
|
471
|
+
const removedKey = ["side", "kick"].join("");
|
|
472
|
+
const result = loadWithUserConfig(
|
|
473
|
+
JSON.stringify({
|
|
474
|
+
profile: "work",
|
|
475
|
+
[removedKey]: { enabled: false, model: "example/model" },
|
|
476
|
+
profiles: {
|
|
477
|
+
work: {
|
|
478
|
+
[removedKey]: { model: "example/profile-model" },
|
|
479
|
+
historian: { opencode: { model: "example/historian" } },
|
|
480
|
+
},
|
|
481
|
+
},
|
|
482
|
+
}),
|
|
483
|
+
);
|
|
484
|
+
|
|
485
|
+
expect(removedKey in result).toBe(false);
|
|
486
|
+
expect(result.historian?.opencode?.model).toBe("example/historian");
|
|
487
|
+
expect(result.configWarnings?.filter((warning) => warning.includes(removedKey))).toEqual([
|
|
488
|
+
`[config] ${REMOVED_AGENT_CONFIG_WARNING}`,
|
|
489
|
+
]);
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
it("removes invalid historian.enabled and applies conflict rules", () => {
|
|
493
|
+
const result = loadWithUserConfig(
|
|
494
|
+
JSON.stringify({
|
|
495
|
+
historian: { enabled: false },
|
|
496
|
+
}),
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
expect(result.historian).toEqual({ two_pass: false, disallowed_tools: [] });
|
|
500
|
+
expect(result.configWarnings?.join("\n")).toContain(
|
|
501
|
+
'Removed invalid "historian.enabled" in-memory (run doctor to persist).',
|
|
502
|
+
);
|
|
503
|
+
});
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
describe("loadPluginConfig — variable expansion scope", () => {
|
|
507
|
+
it("keeps {env:} and {file:} expansion enabled for user config", () => {
|
|
508
|
+
const { dir: secretDir, cleanup } = createTestTempDir("mc-config-secret-");
|
|
509
|
+
const secretFile = join(secretDir, "secret.txt");
|
|
510
|
+
writeFileSync(secretFile, "file-secret", "utf-8");
|
|
511
|
+
|
|
512
|
+
try {
|
|
513
|
+
const result = loadWithUserConfig(
|
|
514
|
+
JSON.stringify({
|
|
515
|
+
system_prompt_injection: {
|
|
516
|
+
skip_signatures: ["{env:MC_USER_ENDPOINT}", `{file:${secretFile}}`],
|
|
517
|
+
},
|
|
518
|
+
}),
|
|
519
|
+
{ MC_USER_ENDPOINT: "http://user-env.test/v1" },
|
|
520
|
+
);
|
|
521
|
+
|
|
522
|
+
expect(result.system_prompt_injection.skip_signatures[0]).toBe(
|
|
523
|
+
"http://user-env.test/v1",
|
|
524
|
+
);
|
|
525
|
+
expect(result.system_prompt_injection.skip_signatures[1]).toBe("file-secret");
|
|
526
|
+
expect(result.configWarnings).toBeUndefined();
|
|
527
|
+
} finally {
|
|
528
|
+
cleanup();
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
it("leaves {env:} and {file:} tokens literal in project config and warns", () => {
|
|
533
|
+
const { cleanup } = createTestTempDir("mc-config-secret-");
|
|
534
|
+
try {
|
|
535
|
+
const result = loadWithUserAndProjectConfig(
|
|
536
|
+
JSON.stringify({ enabled: true }),
|
|
537
|
+
JSON.stringify({
|
|
538
|
+
system_prompt_injection: { skip_signatures: ["{env:MC_PROJECT_ENDPOINT}"] },
|
|
539
|
+
}),
|
|
540
|
+
{ MC_PROJECT_ENDPOINT: "http://project-env.test/v1" },
|
|
541
|
+
);
|
|
542
|
+
|
|
543
|
+
expect(result.system_prompt_injection.skip_signatures[0]).toBe(
|
|
544
|
+
"{env:MC_PROJECT_ENDPOINT}",
|
|
545
|
+
);
|
|
546
|
+
const warnings = result.configWarnings?.join("\n") ?? "";
|
|
547
|
+
expect(warnings).toContain("Project-level config no longer supports");
|
|
548
|
+
expect(warnings).toContain("security reasons");
|
|
549
|
+
} finally {
|
|
550
|
+
cleanup();
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
describe("loadPluginConfig — user-only settings", () => {
|
|
556
|
+
it("allows user config to disable auto_update", () => {
|
|
557
|
+
const result = loadWithUserConfig(JSON.stringify({ auto_update: false }));
|
|
558
|
+
|
|
559
|
+
expect(result.auto_update).toBe(false);
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
it("allows user config to opt in to an exact home project", () => {
|
|
563
|
+
const result = loadWithUserConfig(JSON.stringify({ allow_home_project: true }));
|
|
564
|
+
|
|
565
|
+
expect(result.allow_home_project).toBe(true);
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
it("prevents project config from opting in to a home project", () => {
|
|
569
|
+
const result = loadWithUserAndProjectConfig(
|
|
570
|
+
JSON.stringify({ allow_home_project: false }),
|
|
571
|
+
JSON.stringify({ allow_home_project: true }),
|
|
572
|
+
);
|
|
573
|
+
|
|
574
|
+
expect(result.allow_home_project).toBe(false);
|
|
575
|
+
expect(result.configWarnings?.join("\n")).toContain("Ignoring allow_home_project");
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
it("prevents project config from overriding user auto_update", () => {
|
|
579
|
+
const result = loadWithUserAndProjectConfig(
|
|
580
|
+
JSON.stringify({ auto_update: true, enabled: true }),
|
|
581
|
+
JSON.stringify({ auto_update: false, enabled: false }),
|
|
582
|
+
);
|
|
583
|
+
|
|
584
|
+
expect(result.auto_update).toBe(true);
|
|
585
|
+
expect(result.enabled).toBe(false);
|
|
586
|
+
expect(result.configWarnings?.join("\n")).toContain("Ignoring auto_update");
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
it("keeps historian model selection user-owned when project config tries to override it", () => {
|
|
590
|
+
const result = loadWithUserAndProjectConfig(
|
|
591
|
+
JSON.stringify({
|
|
592
|
+
historian: {
|
|
593
|
+
opencode: {
|
|
594
|
+
model: "anthropic/user-historian",
|
|
595
|
+
fallback_models: ["anthropic/user-fallback"],
|
|
596
|
+
},
|
|
597
|
+
pi: {
|
|
598
|
+
model: "github-copilot/user-historian",
|
|
599
|
+
fallback_models: ["github-copilot/user-fallback"],
|
|
600
|
+
},
|
|
601
|
+
},
|
|
602
|
+
}),
|
|
603
|
+
JSON.stringify({
|
|
604
|
+
historian: {
|
|
605
|
+
opencode: {
|
|
606
|
+
model: "anthropic/project-historian",
|
|
607
|
+
fallback_models: ["anthropic/project-fallback"],
|
|
608
|
+
},
|
|
609
|
+
pi: {
|
|
610
|
+
model: "github-copilot/project-historian",
|
|
611
|
+
fallback_models: ["github-copilot/project-fallback"],
|
|
612
|
+
},
|
|
613
|
+
temperature: 0.2,
|
|
614
|
+
},
|
|
615
|
+
}),
|
|
616
|
+
);
|
|
617
|
+
|
|
618
|
+
expect(result.historian?.opencode).toEqual({
|
|
619
|
+
model: "anthropic/user-historian",
|
|
620
|
+
fallback_models: ["anthropic/user-fallback"],
|
|
621
|
+
});
|
|
622
|
+
expect(result.historian?.pi).toEqual({
|
|
623
|
+
model: "github-copilot/user-historian",
|
|
624
|
+
fallback_models: ["github-copilot/user-fallback"],
|
|
625
|
+
});
|
|
626
|
+
expect(result.historian?.temperature).toBe(0.2);
|
|
627
|
+
const warnings = result.configWarnings?.join("\n") ?? "";
|
|
628
|
+
expect(warnings).toContain("historian.opencode.model");
|
|
629
|
+
expect(warnings).toContain("historian.pi.model");
|
|
630
|
+
});
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
describe("loadPluginConfig — project compaction trust boundary", () => {
|
|
634
|
+
it("keeps protected_tokens scalar-only at both tiers and preserves the user scalar on an invalid project leaf", () => {
|
|
635
|
+
const vectors = [
|
|
636
|
+
{
|
|
637
|
+
name: "user scalar",
|
|
638
|
+
user: { protected_tokens: 20_000 },
|
|
639
|
+
project: {},
|
|
640
|
+
expected: 20_000,
|
|
641
|
+
warns: false,
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
name: "user object",
|
|
645
|
+
user: { protected_tokens: { default: 20_000 } },
|
|
646
|
+
project: {},
|
|
647
|
+
expected: undefined,
|
|
648
|
+
warns: true,
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
name: "project scalar",
|
|
652
|
+
user: {},
|
|
653
|
+
project: { protected_tokens: 20_000 },
|
|
654
|
+
expected: 20_000,
|
|
655
|
+
warns: false,
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
name: "project object",
|
|
659
|
+
user: {},
|
|
660
|
+
project: { protected_tokens: { default: 20_000 } },
|
|
661
|
+
expected: undefined,
|
|
662
|
+
warns: true,
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
name: "invalid project object over user scalar",
|
|
666
|
+
user: { protected_tokens: 25_000 },
|
|
667
|
+
project: { protected_tokens: { default: 30_000 } },
|
|
668
|
+
expected: 25_000,
|
|
669
|
+
warns: true,
|
|
670
|
+
},
|
|
671
|
+
] as const;
|
|
672
|
+
|
|
673
|
+
for (const vector of vectors) {
|
|
674
|
+
const result = loadWithUserAndProjectConfig(
|
|
675
|
+
JSON.stringify(vector.user),
|
|
676
|
+
JSON.stringify(vector.project),
|
|
677
|
+
);
|
|
678
|
+
expect(result.protected_tokens, vector.name).toBe(vector.expected);
|
|
679
|
+
const warned = (result.configWarnings ?? []).some((warning) =>
|
|
680
|
+
warning.includes("protected_tokens"),
|
|
681
|
+
);
|
|
682
|
+
expect(warned, vector.name).toBe(vector.warns);
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
it("rejects a project protected_tokens floor below the derived floor once geometry is known", () => {
|
|
687
|
+
const result = loadWithUserAndProjectConfig(
|
|
688
|
+
JSON.stringify({}),
|
|
689
|
+
JSON.stringify({ protected_tokens: 4_000 }),
|
|
690
|
+
);
|
|
691
|
+
const db = new Database(":memory:");
|
|
692
|
+
db.exec(`
|
|
693
|
+
CREATE TABLE session_meta (
|
|
694
|
+
session_id TEXT PRIMARY KEY,
|
|
695
|
+
harness TEXT NOT NULL DEFAULT 'opencode',
|
|
696
|
+
last_response_time INTEGER NOT NULL DEFAULT 0,
|
|
697
|
+
cache_ttl TEXT NOT NULL DEFAULT '5m',
|
|
698
|
+
counter INTEGER NOT NULL DEFAULT 0,
|
|
699
|
+
last_nudge_tokens INTEGER NOT NULL DEFAULT 0,
|
|
700
|
+
last_nudge_band TEXT NOT NULL DEFAULT '',
|
|
701
|
+
last_transform_error TEXT NOT NULL DEFAULT '',
|
|
702
|
+
is_subagent INTEGER NOT NULL DEFAULT 0,
|
|
703
|
+
last_context_percentage REAL NOT NULL DEFAULT 0,
|
|
704
|
+
last_input_tokens INTEGER NOT NULL DEFAULT 0,
|
|
705
|
+
observed_safe_input_tokens INTEGER NOT NULL DEFAULT 0,
|
|
706
|
+
cache_alert_sent INTEGER NOT NULL DEFAULT 0,
|
|
707
|
+
times_execute_threshold_reached INTEGER NOT NULL DEFAULT 0,
|
|
708
|
+
compartment_in_progress INTEGER NOT NULL DEFAULT 0,
|
|
709
|
+
system_prompt_hash TEXT NOT NULL DEFAULT '',
|
|
710
|
+
cleared_reasoning_through_tag INTEGER NOT NULL DEFAULT 0,
|
|
711
|
+
protected_tokens_effective INTEGER,
|
|
712
|
+
protected_tokens_pre_snapshot TEXT
|
|
713
|
+
)
|
|
714
|
+
`);
|
|
715
|
+
const warnings: string[] = [];
|
|
716
|
+
const tierOverrides = getProtectedTokensTierOverrides(result);
|
|
717
|
+
|
|
718
|
+
const resolved = resolveEpochFloorForPass(db, "loader-derived-floor", {
|
|
719
|
+
tierOverrides,
|
|
720
|
+
usableSoft: 200_000,
|
|
721
|
+
isCacheBustingPass: true,
|
|
722
|
+
onRejectedProjectOverride: (warning) => warnings.push(warning),
|
|
723
|
+
});
|
|
724
|
+
resolveEpochFloorForPass(db, "loader-derived-floor-next", {
|
|
725
|
+
tierOverrides,
|
|
726
|
+
usableSoft: 200_000,
|
|
727
|
+
isCacheBustingPass: true,
|
|
728
|
+
onRejectedProjectOverride: (warning) => warnings.push(warning),
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
expect(resolved.floor).toBe(16_000);
|
|
732
|
+
expect(warnings).toHaveLength(1);
|
|
733
|
+
expect(warnings[0]).toContain("protected_tokens=4000");
|
|
734
|
+
db.close();
|
|
735
|
+
});
|
|
736
|
+
|
|
737
|
+
it("ignores a lower project execute_threshold_percentage with a warning", () => {
|
|
738
|
+
const result = loadWithUserAndProjectConfig(
|
|
739
|
+
JSON.stringify({ execute_threshold_percentage: 60 }),
|
|
740
|
+
JSON.stringify({ execute_threshold_percentage: 50 }),
|
|
741
|
+
);
|
|
742
|
+
|
|
743
|
+
expect(result.execute_threshold_percentage).toBe(60);
|
|
744
|
+
expect(result.configWarnings?.join("\n")).toContain(
|
|
745
|
+
"Ignoring execute_threshold_percentage",
|
|
746
|
+
);
|
|
747
|
+
});
|
|
748
|
+
|
|
749
|
+
it("applies a higher project execute_threshold_percentage", () => {
|
|
750
|
+
const result = loadWithUserAndProjectConfig(
|
|
751
|
+
JSON.stringify({ execute_threshold_percentage: 60 }),
|
|
752
|
+
JSON.stringify({ execute_threshold_percentage: 70 }),
|
|
753
|
+
);
|
|
754
|
+
|
|
755
|
+
expect(result.execute_threshold_percentage).toBe(70);
|
|
756
|
+
expect(result.configWarnings?.join("\n") ?? "").not.toContain(
|
|
757
|
+
"execute_threshold_percentage",
|
|
758
|
+
);
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
it("ignores a lower project execute_threshold_tokens.default with a warning", () => {
|
|
762
|
+
const result = loadWithUserAndProjectConfig(
|
|
763
|
+
JSON.stringify({ execute_threshold_tokens: { default: 12_000 } }),
|
|
764
|
+
JSON.stringify({ execute_threshold_tokens: { default: 9_000 } }),
|
|
765
|
+
);
|
|
766
|
+
|
|
767
|
+
expect(result.execute_threshold_tokens).toEqual({ default: 12_000 });
|
|
768
|
+
expect(result.configWarnings?.join("\n")).toContain(
|
|
769
|
+
"Ignoring execute_threshold_tokens.default",
|
|
770
|
+
);
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
it("applies a higher project execute_threshold_tokens.default", () => {
|
|
774
|
+
const result = loadWithUserAndProjectConfig(
|
|
775
|
+
JSON.stringify({ execute_threshold_tokens: { default: 12_000 } }),
|
|
776
|
+
JSON.stringify({ execute_threshold_tokens: { default: 18_000 } }),
|
|
777
|
+
);
|
|
778
|
+
|
|
779
|
+
expect(result.execute_threshold_tokens).toEqual({ default: 18_000 });
|
|
780
|
+
});
|
|
781
|
+
});
|
|
782
|
+
|
|
783
|
+
describe("loadPluginConfig — raw merge preserves user fields not set in project", () => {
|
|
784
|
+
// Regression for the 2026-05-12 embedding-wipe bug. Project configs that
|
|
785
|
+
// don't mention a defaulted field must inherit the user's explicit value
|
|
786
|
+
// instead of getting clobbered by the Zod default. Previously each source
|
|
787
|
+
// was parsed separately and Zod-filled defaults appeared as if they were
|
|
788
|
+
// explicit project overrides.
|
|
789
|
+
|
|
790
|
+
it("user object field survives when project config omits it", () => {
|
|
791
|
+
const userConfig = JSON.stringify({
|
|
792
|
+
memory: { enabled: false },
|
|
793
|
+
});
|
|
794
|
+
const projectConfig = JSON.stringify({ smart_drops: true });
|
|
795
|
+
|
|
796
|
+
const result = loadWithUserAndProjectConfig(userConfig, projectConfig);
|
|
797
|
+
|
|
798
|
+
expect(result.memory.enabled).toBe(false);
|
|
799
|
+
expect(result.smart_drops).toBe(true);
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
it("user scalar field survives when project omits it", () => {
|
|
803
|
+
// execute_threshold_percentage default is { default: 65, ... }. User
|
|
804
|
+
// sets a value, project doesn't mention it — user must win.
|
|
805
|
+
const result = loadWithUserAndProjectConfig(
|
|
806
|
+
JSON.stringify({ execute_threshold_percentage: 30, enabled: true }),
|
|
807
|
+
JSON.stringify({ smart_drops: false }),
|
|
808
|
+
);
|
|
809
|
+
|
|
810
|
+
// execute_threshold_percentage min is 20, so 30 is valid
|
|
811
|
+
expect(result.execute_threshold_percentage).toBe(30);
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
it("project boolean override beats user default", () => {
|
|
815
|
+
// User omits smart_drops (default false). Project turns it on.
|
|
816
|
+
const result = loadWithUserAndProjectConfig(
|
|
817
|
+
JSON.stringify({ enabled: true }),
|
|
818
|
+
JSON.stringify({ smart_drops: true }),
|
|
819
|
+
);
|
|
820
|
+
|
|
821
|
+
expect(result.smart_drops).toBe(true);
|
|
822
|
+
});
|
|
823
|
+
|
|
824
|
+
it("ignores the removed mmc_reduce_enabled key without failing parse", () => {
|
|
825
|
+
const result = loadWithUserAndProjectConfig(
|
|
826
|
+
JSON.stringify({ mmc_reduce_enabled: false, execute_threshold_percentage: 30 }),
|
|
827
|
+
JSON.stringify({}),
|
|
828
|
+
);
|
|
829
|
+
|
|
830
|
+
expect(result.execute_threshold_percentage).toBe(30);
|
|
831
|
+
expect("mmc_reduce_enabled" in result).toBe(false);
|
|
832
|
+
});
|
|
833
|
+
|
|
834
|
+
it("disabled_hooks union-merges across user and project", () => {
|
|
835
|
+
const result = loadWithUserAndProjectConfig(
|
|
836
|
+
JSON.stringify({ disabled_hooks: ["a", "b"] }),
|
|
837
|
+
JSON.stringify({ disabled_hooks: ["b", "c"] }),
|
|
838
|
+
);
|
|
839
|
+
|
|
840
|
+
expect(result.disabled_hooks?.sort()).toEqual(["a", "b", "c"]);
|
|
841
|
+
});
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
describe("loadPluginConfig — user-owned model profiles", () => {
|
|
845
|
+
it("merges user base, selected profile, then project config without losing profile fallback qualifiers", () => {
|
|
846
|
+
const result = loadWithUserAndProjectConfig(
|
|
847
|
+
JSON.stringify({
|
|
848
|
+
profile: "personal",
|
|
849
|
+
historian: {
|
|
850
|
+
two_pass: true,
|
|
851
|
+
opencode: {
|
|
852
|
+
model: "anthropic/base-historian",
|
|
853
|
+
fallback_models: ["anthropic/base-fallback"],
|
|
854
|
+
},
|
|
855
|
+
},
|
|
856
|
+
profiles: {
|
|
857
|
+
work: {
|
|
858
|
+
historian: {
|
|
859
|
+
opencode: {
|
|
860
|
+
model: { model: "anthropic/work-historian", variant: "high" },
|
|
861
|
+
fallback_models: [
|
|
862
|
+
{ model: "openai/work-fallback", variant: "low" },
|
|
863
|
+
],
|
|
864
|
+
},
|
|
865
|
+
},
|
|
866
|
+
},
|
|
867
|
+
personal: {
|
|
868
|
+
historian: { opencode: { model: "anthropic/personal-historian" } },
|
|
869
|
+
},
|
|
870
|
+
},
|
|
871
|
+
}),
|
|
872
|
+
JSON.stringify({
|
|
873
|
+
profile: "work",
|
|
874
|
+
memory: { enabled: false },
|
|
875
|
+
}),
|
|
876
|
+
);
|
|
877
|
+
|
|
878
|
+
expect(result.profile).toBe("work");
|
|
879
|
+
expect(result.memory.enabled).toBe(false);
|
|
880
|
+
expect(result.historian?.two_pass).toBe(true);
|
|
881
|
+
expect(result.historian?.opencode).toEqual({
|
|
882
|
+
model: { model: "anthropic/work-historian", variant: "high" },
|
|
883
|
+
fallback_models: [{ model: "openai/work-fallback", variant: "low" }],
|
|
884
|
+
});
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
it("uses project selection over user selection and falls back to the base on an unknown name", () => {
|
|
888
|
+
const userConfig = JSON.stringify({
|
|
889
|
+
profile: "personal",
|
|
890
|
+
historian: { opencode: { model: "anthropic/base" } },
|
|
891
|
+
profiles: {
|
|
892
|
+
personal: { historian: { opencode: { model: "anthropic/personal" } } },
|
|
893
|
+
work: { historian: { opencode: { model: "anthropic/work" } } },
|
|
894
|
+
},
|
|
895
|
+
});
|
|
896
|
+
|
|
897
|
+
const userDefault = loadWithUserAndProjectConfig(userConfig, "{}");
|
|
898
|
+
const projectOverride = loadWithUserAndProjectConfig(userConfig, '{"profile":"work"}');
|
|
899
|
+
const unknownProject = loadWithUserAndProjectConfig(userConfig, '{"profile":"missing"}');
|
|
900
|
+
|
|
901
|
+
expect(userDefault.profile).toBe("personal");
|
|
902
|
+
expect(userDefault.historian?.opencode?.model).toBe("anthropic/personal");
|
|
903
|
+
expect(projectOverride.profile).toBe("work");
|
|
904
|
+
expect(projectOverride.historian?.opencode?.model).toBe("anthropic/work");
|
|
905
|
+
expect(unknownProject.profile).toBeUndefined();
|
|
906
|
+
expect(unknownProject.enabled).toBe(true);
|
|
907
|
+
expect(unknownProject.historian?.opencode?.model).toBe("anthropic/base");
|
|
908
|
+
expect(unknownProject.configWarnings?.join("\n")).toContain(
|
|
909
|
+
'Unknown profile "missing" selected by project config',
|
|
910
|
+
);
|
|
911
|
+
});
|
|
912
|
+
|
|
913
|
+
it("rejects invalid profile definitions with a warning instead of applying their fields", () => {
|
|
914
|
+
const result = loadWithUserConfig(
|
|
915
|
+
JSON.stringify({
|
|
916
|
+
profile: "unsafe",
|
|
917
|
+
historian: { opencode: { model: "anthropic/base" } },
|
|
918
|
+
profiles: {
|
|
919
|
+
unsafe: {
|
|
920
|
+
historian: { two_pass: true },
|
|
921
|
+
},
|
|
922
|
+
},
|
|
923
|
+
}),
|
|
924
|
+
);
|
|
925
|
+
|
|
926
|
+
expect(result.profile).toBeUndefined();
|
|
927
|
+
expect(result.historian?.opencode?.model).toBe("anthropic/base");
|
|
928
|
+
// two_pass defaults to false; the profile's `true` must not leak through.
|
|
929
|
+
expect(result.historian?.two_pass).toBe(false);
|
|
930
|
+
expect(result.configWarnings?.join("\n")).toContain("Ignoring profiles from user config");
|
|
931
|
+
});
|
|
932
|
+
|
|
933
|
+
it("strips hostile project profile definitions while allowing only user-owned definitions", () => {
|
|
934
|
+
const result = loadWithUserAndProjectConfig(
|
|
935
|
+
JSON.stringify({
|
|
936
|
+
historian: { opencode: { model: "anthropic/user-base" } },
|
|
937
|
+
}),
|
|
938
|
+
JSON.stringify({
|
|
939
|
+
profile: "work",
|
|
940
|
+
profiles: {
|
|
941
|
+
work: {
|
|
942
|
+
historian: { opencode: { model: "attacker/project-profile" } },
|
|
943
|
+
},
|
|
944
|
+
},
|
|
945
|
+
}),
|
|
946
|
+
);
|
|
947
|
+
|
|
948
|
+
expect(result.profile).toBeUndefined();
|
|
949
|
+
expect(result.historian?.opencode?.model).toBe("anthropic/user-base");
|
|
950
|
+
expect(result.configWarnings?.join("\n")).toContain(
|
|
951
|
+
"Ignoring profiles from project config",
|
|
952
|
+
);
|
|
953
|
+
});
|
|
954
|
+
|
|
955
|
+
it("falls back loudly for inherited profile names without changing the resolved base config", () => {
|
|
956
|
+
const userConfig = JSON.stringify({
|
|
957
|
+
historian: { opencode: { model: "anthropic/base", fallback_models: ["openai/base"] } },
|
|
958
|
+
profiles: { known: { historian: { opencode: { model: "anthropic/known" } } } },
|
|
959
|
+
});
|
|
960
|
+
const base = loadWithUserConfig(userConfig);
|
|
961
|
+
const { configWarnings: _baseWarnings, ...baseWithoutWarnings } = base;
|
|
962
|
+
const hostileNames = [
|
|
963
|
+
"__proto__",
|
|
964
|
+
"constructor",
|
|
965
|
+
"prototype",
|
|
966
|
+
"toString",
|
|
967
|
+
"hasOwnProperty",
|
|
968
|
+
"valueOf",
|
|
969
|
+
];
|
|
970
|
+
|
|
971
|
+
for (const name of hostileNames) {
|
|
972
|
+
const resolved = loadWithUserAndProjectConfig(
|
|
973
|
+
userConfig,
|
|
974
|
+
JSON.stringify({ profile: name }),
|
|
975
|
+
);
|
|
976
|
+
const { configWarnings: _warnings, ...resolvedWithoutWarnings } = resolved;
|
|
977
|
+
|
|
978
|
+
expect(resolved.profile).toBeUndefined();
|
|
979
|
+
expect(resolved.configWarnings?.join("\n")).toContain(
|
|
980
|
+
`Unknown profile "${name}" selected by project config`,
|
|
981
|
+
);
|
|
982
|
+
expect(resolvedWithoutWarnings).toEqual(baseWithoutWarnings);
|
|
983
|
+
}
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
it("ignores a profile inherited from a polluted Object prototype", () => {
|
|
987
|
+
const profileName = "profile_overlay_pollution_canary";
|
|
988
|
+
const previousDescriptor = Object.getOwnPropertyDescriptor(Object.prototype, profileName);
|
|
989
|
+
const userBase = { historian: { opencode: { model: "anthropic/base" } } };
|
|
990
|
+
// Null-prototype input isolates lookup behavior from strict schema validation of inherited data.
|
|
991
|
+
const profileOpenCode = Object.assign(Object.create(null), {
|
|
992
|
+
model: "anthropic/known",
|
|
993
|
+
});
|
|
994
|
+
const profileHistorian = Object.assign(Object.create(null), {
|
|
995
|
+
opencode: profileOpenCode,
|
|
996
|
+
});
|
|
997
|
+
const knownProfile = Object.assign(Object.create(null), {
|
|
998
|
+
historian: profileHistorian,
|
|
999
|
+
});
|
|
1000
|
+
const profiles = Object.assign(Object.create(null), {
|
|
1001
|
+
known: knownProfile,
|
|
1002
|
+
}) as Record<string, unknown>;
|
|
1003
|
+
Object.defineProperty(Object.prototype, profileName, {
|
|
1004
|
+
value: { historian: { opencode: { model: "attacker/inherited-overlay" } } },
|
|
1005
|
+
enumerable: true,
|
|
1006
|
+
configurable: true,
|
|
1007
|
+
});
|
|
1008
|
+
|
|
1009
|
+
try {
|
|
1010
|
+
const resolution = resolveConfigProfile({
|
|
1011
|
+
userRaw: {
|
|
1012
|
+
...userBase,
|
|
1013
|
+
profiles,
|
|
1014
|
+
},
|
|
1015
|
+
projectRaw: { profile: profileName },
|
|
1016
|
+
});
|
|
1017
|
+
|
|
1018
|
+
expect(resolution.activeProfile).toBeUndefined();
|
|
1019
|
+
expect(resolution.overlay).toEqual({});
|
|
1020
|
+
expect(resolution.userBase).toEqual(userBase);
|
|
1021
|
+
expect(resolution.projectBase).toEqual({});
|
|
1022
|
+
expect(resolution.warnings).toEqual([
|
|
1023
|
+
`Unknown profile "${profileName}" selected by project config; using base config without a profile.`,
|
|
1024
|
+
]);
|
|
1025
|
+
} finally {
|
|
1026
|
+
if (previousDescriptor) {
|
|
1027
|
+
Object.defineProperty(Object.prototype, profileName, previousDescriptor);
|
|
1028
|
+
} else {
|
|
1029
|
+
delete (Object.prototype as Record<string, unknown>)[profileName];
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
1033
|
+
|
|
1034
|
+
it("treats empty, null, and non-string project selectors as no selection", () => {
|
|
1035
|
+
const userConfig = JSON.stringify({
|
|
1036
|
+
profile: "personal",
|
|
1037
|
+
historian: { opencode: { model: "anthropic/base" } },
|
|
1038
|
+
profiles: {
|
|
1039
|
+
personal: { historian: { opencode: { model: "anthropic/personal" } } },
|
|
1040
|
+
},
|
|
1041
|
+
});
|
|
1042
|
+
const invalidProjectSelectors = ["", null, { name: "work" }];
|
|
1043
|
+
|
|
1044
|
+
for (const profile of invalidProjectSelectors) {
|
|
1045
|
+
const result = loadWithUserAndProjectConfig(userConfig, JSON.stringify({ profile }));
|
|
1046
|
+
|
|
1047
|
+
expect(result.profile).toBe("personal");
|
|
1048
|
+
expect(result.historian?.opencode?.model).toBe("anthropic/personal");
|
|
1049
|
+
expect(result.configWarnings?.join("\n")).toContain(
|
|
1050
|
+
"Ignoring invalid profile selection from project config",
|
|
1051
|
+
);
|
|
1052
|
+
}
|
|
1053
|
+
});
|
|
1054
|
+
|
|
1055
|
+
it("preserves an untouched historian Pi block when a profile overlays OpenCode", () => {
|
|
1056
|
+
const piBase = {
|
|
1057
|
+
model: { model: "github-copilot/base", thinking_level: "high" },
|
|
1058
|
+
fallback_models: [
|
|
1059
|
+
{ model: "openai/base-fallback", thinking_level: "minimal" },
|
|
1060
|
+
{ model: "github-copilot/second-base-fallback", thinking_level: "medium" },
|
|
1061
|
+
],
|
|
1062
|
+
thinking_level: "high",
|
|
1063
|
+
};
|
|
1064
|
+
const result = loadWithUserConfig(
|
|
1065
|
+
JSON.stringify({
|
|
1066
|
+
profile: "work",
|
|
1067
|
+
historian: {
|
|
1068
|
+
opencode: { model: "anthropic/base-opencode" },
|
|
1069
|
+
pi: piBase,
|
|
1070
|
+
},
|
|
1071
|
+
profiles: {
|
|
1072
|
+
work: {
|
|
1073
|
+
historian: { opencode: { model: "anthropic/work-opencode" } },
|
|
1074
|
+
},
|
|
1075
|
+
},
|
|
1076
|
+
}),
|
|
1077
|
+
);
|
|
1078
|
+
|
|
1079
|
+
expect(result.historian?.opencode).toEqual({ model: "anthropic/work-opencode" });
|
|
1080
|
+
expect(result.historian?.pi).toEqual(piBase);
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1083
|
+
it("replaces a base fallback_models array wholesale when a profile provides one", () => {
|
|
1084
|
+
const result = loadWithUserConfig(
|
|
1085
|
+
JSON.stringify({
|
|
1086
|
+
profile: "work",
|
|
1087
|
+
historian: {
|
|
1088
|
+
opencode: {
|
|
1089
|
+
model: "anthropic/base",
|
|
1090
|
+
fallback_models: [
|
|
1091
|
+
{ model: "openai/base-first", variant: "low" },
|
|
1092
|
+
{ model: "anthropic/base-second", variant: "high" },
|
|
1093
|
+
],
|
|
1094
|
+
},
|
|
1095
|
+
},
|
|
1096
|
+
profiles: {
|
|
1097
|
+
work: {
|
|
1098
|
+
historian: {
|
|
1099
|
+
opencode: {
|
|
1100
|
+
fallback_models: [{ model: "google/work-only", variant: "medium" }],
|
|
1101
|
+
},
|
|
1102
|
+
},
|
|
1103
|
+
},
|
|
1104
|
+
},
|
|
1105
|
+
}),
|
|
1106
|
+
);
|
|
1107
|
+
|
|
1108
|
+
expect(result.historian?.opencode?.fallback_models).toEqual([
|
|
1109
|
+
{ model: "google/work-only", variant: "medium" },
|
|
1110
|
+
]);
|
|
1111
|
+
});
|
|
1112
|
+
|
|
1113
|
+
it("resolves profiles independently for two projects in one process", () => {
|
|
1114
|
+
const xdg = createTestTempDirFromPath(join(tmpdir(), "mc-profile-isolation-user-"));
|
|
1115
|
+
const projectA = createTestTempDirFromPath(join(tmpdir(), "mc-profile-isolation-a-"));
|
|
1116
|
+
const projectB = createTestTempDirFromPath(join(tmpdir(), "mc-profile-isolation-b-"));
|
|
1117
|
+
const previousXdg = process.env.XDG_CONFIG_HOME;
|
|
1118
|
+
mkdirSync(join(xdg, "opencode"), { recursive: true });
|
|
1119
|
+
mkdirSync(join(projectA, ".mmc"), { recursive: true });
|
|
1120
|
+
mkdirSync(join(projectB, ".mmc"), { recursive: true });
|
|
1121
|
+
writeFileSync(
|
|
1122
|
+
join(xdg, "opencode", "mmc.jsonc"),
|
|
1123
|
+
JSON.stringify({
|
|
1124
|
+
profiles: {
|
|
1125
|
+
work: { historian: { opencode: { model: "anthropic/work" } } },
|
|
1126
|
+
personal: {
|
|
1127
|
+
historian: { opencode: { model: "anthropic/personal" } },
|
|
1128
|
+
},
|
|
1129
|
+
},
|
|
1130
|
+
}),
|
|
1131
|
+
);
|
|
1132
|
+
writeFileSync(join(projectA, ".mmc", "mmc.jsonc"), '{"profile":"work"}');
|
|
1133
|
+
writeFileSync(join(projectB, ".mmc", "mmc.jsonc"), '{"profile":"personal"}');
|
|
1134
|
+
process.env.XDG_CONFIG_HOME = xdg;
|
|
1135
|
+
try {
|
|
1136
|
+
const work = loadPluginConfig(projectA);
|
|
1137
|
+
const personal = loadPluginConfig(projectB);
|
|
1138
|
+
const workAgain = loadPluginConfig(projectA);
|
|
1139
|
+
expect(work.profile).toBe("work");
|
|
1140
|
+
expect(personal.profile).toBe("personal");
|
|
1141
|
+
expect(workAgain.profile).toBe("work");
|
|
1142
|
+
expect(work.historian?.opencode?.model).toBe("anthropic/work");
|
|
1143
|
+
expect(personal.historian?.opencode?.model).toBe("anthropic/personal");
|
|
1144
|
+
expect(workAgain.historian?.opencode?.model).toBe("anthropic/work");
|
|
1145
|
+
} finally {
|
|
1146
|
+
if (previousXdg === undefined) delete process.env.XDG_CONFIG_HOME;
|
|
1147
|
+
else process.env.XDG_CONFIG_HOME = previousXdg;
|
|
1148
|
+
rmSync(xdg, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
1149
|
+
rmSync(projectA, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
1150
|
+
rmSync(projectB, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
1151
|
+
}
|
|
1152
|
+
});
|
|
1153
|
+
|
|
1154
|
+
it("feeds the selected profile through the existing historian model resolver", () => {
|
|
1155
|
+
const config = loadWithUserAndProjectConfig(
|
|
1156
|
+
JSON.stringify({
|
|
1157
|
+
profiles: {
|
|
1158
|
+
work: {
|
|
1159
|
+
historian: {
|
|
1160
|
+
opencode: {
|
|
1161
|
+
model: { model: "anthropic/work", variant: "high" },
|
|
1162
|
+
fallback_models: [
|
|
1163
|
+
{ model: "openai/work-fallback", variant: "low" },
|
|
1164
|
+
],
|
|
1165
|
+
},
|
|
1166
|
+
},
|
|
1167
|
+
},
|
|
1168
|
+
},
|
|
1169
|
+
}),
|
|
1170
|
+
'{"profile":"work"}',
|
|
1171
|
+
);
|
|
1172
|
+
|
|
1173
|
+
// Profile selection changes only the normal resolved model input. The
|
|
1174
|
+
// existing model-switch identity path still sees canonical model IDs and
|
|
1175
|
+
// qualifier-distinct fallback attempts; profiles add no separate cache-bust class.
|
|
1176
|
+
expect(resolveHistorianModel(config, "opencode")).toEqual({
|
|
1177
|
+
primary: { model: "anthropic/work", qualifier: "high" },
|
|
1178
|
+
fallbacks: [{ model: "openai/work-fallback", qualifier: "low" }],
|
|
1179
|
+
});
|
|
1180
|
+
});
|
|
1181
|
+
});
|
|
1182
|
+
|
|
1183
|
+
describe("loadPluginConfigDetailed — prompt-surface registration owner", () => {
|
|
1184
|
+
it("captures the user default before project guidance routing is merged", () => {
|
|
1185
|
+
const xdg = createTestTempDirFromPath(join(tmpdir(), "mc-config-prompt-surface-"));
|
|
1186
|
+
const projectDir = createTestTempDirFromPath(join(tmpdir(), "mc-project-prompt-surface-"));
|
|
1187
|
+
const fs = require("node:fs") as typeof import("node:fs");
|
|
1188
|
+
const userDir = join(xdg, "opencode");
|
|
1189
|
+
const projectConfigDir = join(projectDir, ".mmc");
|
|
1190
|
+
fs.mkdirSync(userDir, { recursive: true });
|
|
1191
|
+
fs.mkdirSync(projectConfigDir, { recursive: true });
|
|
1192
|
+
writeFileSync(
|
|
1193
|
+
join(userDir, "mmc.jsonc"),
|
|
1194
|
+
JSON.stringify({
|
|
1195
|
+
prompt_surface: {
|
|
1196
|
+
default: "light",
|
|
1197
|
+
guidance_override_path: "guidance.md",
|
|
1198
|
+
tool_descriptions: { mmc_search: "user text" },
|
|
1199
|
+
},
|
|
1200
|
+
}),
|
|
1201
|
+
);
|
|
1202
|
+
writeFileSync(
|
|
1203
|
+
join(projectConfigDir, "mmc.jsonc"),
|
|
1204
|
+
JSON.stringify({
|
|
1205
|
+
prompt_surface: {
|
|
1206
|
+
default: "full",
|
|
1207
|
+
models: { "openai/*": "light" },
|
|
1208
|
+
},
|
|
1209
|
+
}),
|
|
1210
|
+
);
|
|
1211
|
+
const originalXdg = process.env.XDG_CONFIG_HOME;
|
|
1212
|
+
process.env.XDG_CONFIG_HOME = xdg;
|
|
1213
|
+
|
|
1214
|
+
try {
|
|
1215
|
+
const result = loadPluginConfigDetailed(projectDir);
|
|
1216
|
+
expect(result.config.prompt_surface).toEqual({
|
|
1217
|
+
default: "full",
|
|
1218
|
+
models: { "openai/*": "light" },
|
|
1219
|
+
guidance_override_path: "guidance.md",
|
|
1220
|
+
tool_descriptions: { mmc_search: "user text" },
|
|
1221
|
+
});
|
|
1222
|
+
expect(result.registrationPromptSurface).toEqual({
|
|
1223
|
+
default: "light",
|
|
1224
|
+
guidance_override_path: "guidance.md",
|
|
1225
|
+
tool_descriptions: { mmc_search: "user text" },
|
|
1226
|
+
});
|
|
1227
|
+
} finally {
|
|
1228
|
+
if (originalXdg === undefined) delete process.env.XDG_CONFIG_HOME;
|
|
1229
|
+
else process.env.XDG_CONFIG_HOME = originalXdg;
|
|
1230
|
+
rmSync(xdg, { recursive: true, force: true });
|
|
1231
|
+
rmSync(projectDir, { recursive: true, force: true });
|
|
1232
|
+
}
|
|
1233
|
+
});
|
|
1234
|
+
});
|
|
1235
|
+
|
|
1236
|
+
describe("shared per-harness config loading", () => {
|
|
1237
|
+
it("lets OpenCode load Pi agent blocks without schema recovery warnings", () => {
|
|
1238
|
+
const config = loadWithUserConfig(
|
|
1239
|
+
JSON.stringify({
|
|
1240
|
+
historian: {
|
|
1241
|
+
opencode: { model: "anthropic/opencode-historian" },
|
|
1242
|
+
pi: { model: "anthropic/pi-historian", thinking_level: "high" },
|
|
1243
|
+
},
|
|
1244
|
+
}),
|
|
1245
|
+
);
|
|
1246
|
+
|
|
1247
|
+
expect(config.configWarnings).toBeUndefined();
|
|
1248
|
+
expect(resolveHistorianModel(config, "opencode").primary?.model).toBe(
|
|
1249
|
+
"anthropic/opencode-historian",
|
|
1250
|
+
);
|
|
1251
|
+
});
|
|
1252
|
+
});
|