@cortexkit/opencode-magic-context 0.45.0 → 0.46.1
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/README.md +26 -0
- package/dist/{announcement-f75t58v9.js → announcement-y35wzg2r.js} +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/live-run-config.d.ts.map +1 -1
- package/dist/config/migrate-config-location.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +13 -7
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-5yrz2r24.js → conflict-warning-hook-7fj2b9jw.js} +6 -5
- package/dist/context-sh2m2vde.js +4525 -0
- package/dist/{derive-budgets-a63zsm5c.js → derive-budgets-7nj7r1rv.js} +2 -2
- package/dist/embedding-worker.js +4 -4
- package/dist/features/magic-context/checkout-claim-fake-subc.test-support.d.ts +45 -0
- package/dist/features/magic-context/checkout-claim-fake-subc.test-support.d.ts.map +1 -0
- package/dist/features/magic-context/checkout-claim.d.ts +155 -0
- package/dist/features/magic-context/checkout-claim.d.ts.map +1 -0
- package/dist/features/magic-context/compaction-marker.d.ts +20 -3
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-storage.d.ts +23 -2
- package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/provider-output-failure.d.ts +6 -2
- package/dist/features/magic-context/dreamer/provider-output-failure.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/provider-output-failure.test-support.d.ts +30 -0
- package/dist/features/magic-context/dreamer/provider-output-failure.test-support.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts +9 -0
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-diff.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-gate.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/search-git-commits.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
- package/dist/features/magic-context/memory/project-identity-cache.d.ts.map +1 -1
- package/dist/features/magic-context/memory/storage-memory-verifications.d.ts.map +1 -1
- package/dist/features/magic-context/memory/storage-memory.d.ts +3 -0
- package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
- package/dist/features/magic-context/memory/verification-paths.d.ts +2 -2
- package/dist/features/magic-context/memory/verification-paths.d.ts.map +1 -1
- package/dist/features/magic-context/merged-reasoning-decisions.d.ts.map +1 -1
- package/dist/features/magic-context/message-index-async.d.ts +3 -3
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +2 -0
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/migration-v95-perf-indexes.d.ts +12 -0
- package/dist/features/magic-context/migration-v95-perf-indexes.d.ts.map +1 -0
- package/dist/features/magic-context/migration-worker-client.d.ts +4 -4
- package/dist/features/magic-context/migration-worker-client.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts +1 -0
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/mural/render-trigger.d.ts.map +1 -1
- package/dist/features/magic-context/mural/resolve-mural.d.ts +15 -4
- package/dist/features/magic-context/mural/resolve-mural.d.ts.map +1 -1
- package/dist/features/magic-context/mural/source-revision.d.ts +7 -0
- package/dist/features/magic-context/mural/source-revision.d.ts.map +1 -0
- package/dist/features/magic-context/mural/storage-mural-cues.d.ts.map +1 -1
- package/dist/features/magic-context/reclaim-protection.d.ts +15 -10
- package/dist/features/magic-context/reclaim-protection.d.ts.map +1 -1
- package/dist/features/magic-context/session-cache-ttl.d.ts +4 -2
- package/dist/features/magic-context/session-cache-ttl.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/capabilities.d.ts +3 -0
- package/dist/features/magic-context/smart-notes/capabilities.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/github-token.d.ts +5 -0
- package/dist/features/magic-context/smart-notes/github-token.d.ts.map +1 -0
- package/dist/features/magic-context/smart-notes/runner.d.ts +1 -0
- package/dist/features/magic-context/smart-notes/runner.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts +12 -0
- package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/ssrf-guard.d.ts +6 -0
- package/dist/features/magic-context/smart-notes/ssrf-guard.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/storage.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/types.d.ts +2 -0
- package/dist/features/magic-context/smart-notes/types.d.ts.map +1 -1
- package/dist/features/magic-context/storage-clone.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +6 -9
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
- package/dist/features/magic-context/storage-ops.d.ts +8 -1
- package/dist/features/magic-context/storage-ops.d.ts.map +1 -1
- package/dist/features/magic-context/storage-replay-document.d.ts +7 -0
- package/dist/features/magic-context/storage-replay-document.d.ts.map +1 -1
- package/dist/features/magic-context/storage-schema-helpers.d.ts +2 -0
- package/dist/features/magic-context/storage-schema-helpers.d.ts.map +1 -1
- package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -1
- package/dist/features/magic-context/storage-source.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +11 -3
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +2 -2
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/temporal-decisions.d.ts +10 -0
- package/dist/features/magic-context/temporal-decisions.d.ts.map +1 -0
- package/dist/features/magic-context/tool-definition-tokens.d.ts +2 -0
- package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/features/magic-context/types.d.ts +7 -6
- package/dist/features/magic-context/types.d.ts.map +1 -1
- package/dist/features/magic-context/window-report-ledger.d.ts.map +1 -1
- package/dist/hooks/auto-update-checker/index.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts +8 -0
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +6 -3
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
- package/dist/hooks/magic-context/channel2-cycle.d.ts +2 -0
- package/dist/hooks/magic-context/channel2-cycle.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts +7 -0
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-prompt.d.ts +2 -2
- package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-render-epoch.d.ts +8 -0
- package/dist/hooks/magic-context/compartment-render-epoch.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts +18 -4
- package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/ctx-reduce-availability.d.ts +12 -0
- package/dist/hooks/magic-context/ctx-reduce-availability.d.ts.map +1 -1
- package/dist/hooks/magic-context/decision-calibration.d.ts +3 -0
- package/dist/hooks/magic-context/decision-calibration.d.ts.map +1 -1
- package/dist/hooks/magic-context/default-protection-pressure.test-support.d.ts +37 -0
- package/dist/hooks/magic-context/default-protection-pressure.test-support.d.ts.map +1 -0
- package/dist/hooks/magic-context/drop-stale-reduce-calls.d.ts +4 -0
- package/dist/hooks/magic-context/drop-stale-reduce-calls.d.ts.map +1 -1
- package/dist/hooks/magic-context/edit-marker.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-drop.d.ts +2 -0
- package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts +21 -1
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts +5 -0
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +30 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts +2 -0
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-prompt-fit.d.ts +4 -2
- package/dist/hooks/magic-context/historian-prompt-fit.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +2 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +9 -10
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-measured-request.d.ts +69 -0
- package/dist/hooks/magic-context/lkg-measured-request.d.ts.map +1 -0
- package/dist/hooks/magic-context/lkg-persist.d.ts +2 -0
- package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay-fit.d.ts +14 -0
- package/dist/hooks/magic-context/lkg-replay-fit.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts +10 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts +4 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts +2 -0
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
- package/dist/hooks/magic-context/note-nudger.d.ts +17 -5
- package/dist/hooks/magic-context/note-nudger.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +1 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-formatting.d.ts +7 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +4 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts +2 -0
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/hooks/magic-context/reference-retrieval.d.ts +27 -17
- package/dist/hooks/magic-context/reference-retrieval.d.ts.map +1 -1
- package/dist/hooks/magic-context/request-hook-order.d.ts +56 -0
- package/dist/hooks/magic-context/request-hook-order.d.ts.map +1 -0
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +22 -3
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/strip-content.d.ts +4 -2
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/supersession-reclaim.d.ts +4 -0
- package/dist/hooks/magic-context/supersession-reclaim.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +7 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +12 -3
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
- package/dist/hooks/magic-context/temporal-awareness.d.ts +6 -3
- package/dist/hooks/magic-context/temporal-awareness.d.ts.map +1 -1
- package/dist/hooks/magic-context/temporal-served-projection.d.ts +4 -0
- package/dist/hooks/magic-context/temporal-served-projection.d.ts.map +1 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-reclaim.d.ts +2 -0
- package/dist/hooks/magic-context/tool-reclaim.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-message-helpers.d.ts +5 -0
- package/dist/hooks/magic-context/transform-message-helpers.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +41 -17
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +12 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
- package/dist/{index-vvtfyw1z.js → index-0d3g3461.js} +5 -13
- package/dist/index-1bc61ans.js +154 -0
- package/dist/{index-n96ag4rk.js → index-1zx87sdm.js} +5 -1
- package/dist/{index-4krbw8z9.js → index-3h0ybwah.js} +608 -102
- package/dist/{index-gd5qx1j9.js → index-5eqk6z3s.js} +62 -1
- package/dist/index-5gq3b2ya.js +494 -0
- package/dist/{index-8fgkmxmy.js → index-5p8jdswx.js} +4 -3
- package/dist/{index-75zjgwga.js → index-7qw742ev.js} +1 -1
- package/dist/{index-f85teqck.js → index-8da2zjhz.js} +3 -256
- package/dist/{index-q7yesyk9.js → index-8x2v7gg9.js} +25 -24
- package/dist/{index-w9jwmntv.js → index-b35pxds2.js} +9 -1
- package/dist/{v2/server-a4m2b1yv.js → index-fg34g6a5.js} +55 -1
- package/dist/index-hpecdzec.js +28506 -0
- package/dist/{index-2ntg5sd4.js → index-k5bdx1bx.js} +9 -5
- package/dist/{index-bmzf7zxv.js → index-majxda46.js} +23 -5
- package/dist/{index-2aq21j41.js → index-pkbcrdqs.js} +418 -127
- package/dist/{index-remp7e2g.js → index-q4yp4b52.js} +16 -1
- package/dist/{index-fr2z4qy8.js → index-r5hmbx3t.js} +132 -169
- package/dist/index-sfnj6h8h.js +259 -0
- package/dist/{index-xgt9k6c6.js → index-sgthv3f7.js} +2 -1
- package/dist/index-sj29b3z2.js +30 -0
- package/dist/{index-16ny736w.js → index-sjthx78w.js} +20526 -19817
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1983 -33118
- package/dist/{message-time-backfill-an311pmk.js → message-time-backfill-68gj6t3e.js} +2 -2
- package/dist/migration-worker.js +12 -7
- package/dist/plugin/dream-timer.d.ts +25 -1
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +2 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts +13 -0
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts +4 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/plugin/subagent-tool-policy.d.ts +14 -0
- package/dist/plugin/subagent-tool-policy.d.ts.map +1 -0
- package/dist/plugin/tool-registry.d.ts +1 -0
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/{read-session-chunk-8rxs0tc9.js → read-session-chunk-egz7r68d.js} +8 -8
- package/dist/{recomp-orchestrator-nzamtw29.js → recomp-orchestrator-y15j0rb9.js} +15 -15
- package/dist/{send-session-notification-nqpv7cne.js → send-session-notification-dyw42dtr.js} +4 -4
- package/dist/shared/announcement.d.ts.map +1 -1
- package/dist/shared/cache-ttl-display.d.ts +6 -4
- package/dist/shared/cache-ttl-display.d.ts.map +1 -1
- package/dist/shared/model-cache-ttl.d.ts +1 -1
- package/dist/shared/model-cache-ttl.d.ts.map +1 -1
- package/dist/shared/model-suggestion-retry.d.ts +2 -0
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/protected-tools-policy.d.ts +6 -0
- package/dist/shared/protected-tools-policy.d.ts.map +1 -0
- package/dist/shared/quota-diagnostic.d.ts +4 -0
- package/dist/shared/quota-diagnostic.d.ts.map +1 -0
- package/dist/shared/rpc-server.d.ts.map +1 -1
- 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 +9 -0
- package/dist/shared/sqlite-helpers.d.ts.map +1 -1
- package/dist/shared/sqlite.d.ts +10 -0
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/status-summary.d.ts +1 -0
- package/dist/shared/status-summary.d.ts.map +1 -1
- package/dist/shared/status-view-check.d.ts.map +1 -1
- package/dist/shared/status-view.d.ts +4 -0
- package/dist/shared/status-view.d.ts.map +1 -1
- package/dist/shared/storage-permissions.d.ts +24 -0
- package/dist/shared/storage-permissions.d.ts.map +1 -1
- package/dist/shared/temporal-upgrade-fixture.d.ts +19 -0
- package/dist/shared/temporal-upgrade-fixture.d.ts.map +1 -0
- package/dist/shared/user-facing-codes.d.ts +5 -0
- package/dist/shared/user-facing-codes.d.ts.map +1 -1
- package/dist/shared/write-transaction-timing.d.ts +8 -1
- package/dist/shared/write-transaction-timing.d.ts.map +1 -1
- package/dist/tools/ctx-expand/render.d.ts.map +1 -1
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/tools/ctx-reduce/constants.d.ts +2 -0
- package/dist/tools/ctx-reduce/constants.d.ts.map +1 -1
- package/dist/tools/ctx-reduce/tools.d.ts +4 -4
- package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-414phndq.js → transform-postprocess-phase-bqhz6vdr.js} +15 -15
- package/dist/v2/context-zecmzk5s.js +52209 -0
- package/dist/v2/{derive-budgets-v0krf3t7.js → derive-budgets-kdgp4s3r.js} +4 -3
- package/dist/v2/embedding-worker.js +6 -5
- package/dist/v2/fold/boundary.d.ts +2 -0
- package/dist/v2/fold/boundary.d.ts.map +1 -1
- package/dist/v2/fold/owner.d.ts.map +1 -1
- package/dist/v2/hidden-child-native.d.ts +7 -0
- package/dist/v2/hidden-child-native.d.ts.map +1 -1
- package/dist/v2/hidden-child-record.d.ts +8 -0
- package/dist/v2/hidden-child-record.d.ts.map +1 -1
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hooks/channel2.d.ts +2 -0
- package/dist/v2/hooks/channel2.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts +2 -2
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/dream-timer.d.ts +39 -0
- package/dist/v2/hooks/dream-timer.d.ts.map +1 -0
- package/dist/v2/hooks/dream-trigger.d.ts +15 -1
- package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
- package/dist/v2/hooks/hidden-child.d.ts +54 -3
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/hooks/tools.d.ts +1 -1
- package/dist/v2/hooks/tools.d.ts.map +1 -1
- package/dist/v2/hooks/types.d.ts +12 -1
- package/dist/v2/hooks/types.d.ts.map +1 -1
- package/dist/v2/hooks/update-check.d.ts.map +1 -1
- package/dist/v2/{message-time-backfill-0n93vrd7.js → message-time-backfill-r6qkem1x.js} +3 -3
- package/dist/v2/migration-worker.js +13 -8
- package/dist/v2/{read-session-chunk-hjza38hr.js → read-session-chunk-8vjp6581.js} +9 -9
- package/dist/v2/recomp-orchestrator-8ejxvrzz.js +39 -0
- package/dist/v2/{safe-notification-target-wtj0bbc2.js → safe-notification-target-eb1n1vfb.js} +2 -2
- package/dist/v2/{send-session-notification-mq9frrtm.js → send-session-notification-qs0j78v6.js} +6 -6
- package/dist/v2/server-14vq4kpm.js +30 -0
- package/dist/v2/server-1bc61ans.js +154 -0
- package/dist/v2/{server-n96ag4rk.js → server-1zx87sdm.js} +5 -1
- package/dist/v2/server-3n4q9xme.js +79 -0
- package/dist/v2/{server-rhdgxp1t.js → server-51dv1pr5.js} +63 -2
- package/dist/v2/{server-5317ykaf.js → server-6r257mf5.js} +1 -1
- package/dist/v2/server-84w6rvvf.js +14 -0
- package/dist/v2/{server-qpg6wf72.js → server-ajzeteqw.js} +9 -1
- package/dist/v2/server-c5gz8wph.js +3892 -0
- package/dist/v2/{server-v5xgft5v.js → server-e29d7p7c.js} +188 -3533
- package/dist/{index-a4m2b1yv.js → v2/server-fg34g6a5.js} +55 -1
- package/dist/v2/{server-e36nf2p1.js → server-frbm99q5.js} +1595 -1599
- package/dist/v2/{server-remp7e2g.js → server-g0fjrkta.js} +16 -1
- package/dist/v2/{server-c4g2y1z8.js → server-jc7y02q0.js} +2816 -5392
- package/dist/v2/{server-z19x7eqz.js → server-mcfawjgc.js} +4 -4
- package/dist/v2/{server-hfjfbg59.js → server-qp5hx1ad.js} +608 -105
- package/dist/v2/server-vs5gpnd4.js +493 -0
- package/dist/v2/{server-w99cyt6a.js → server-wvjvfhck.js} +14 -6
- package/dist/v2/server-xa4xe3rv.js +3351 -0
- package/dist/v2/{server-0jqw05sa.js → server-y8maxeft.js} +6 -84
- package/dist/v2/server.d.ts.map +1 -1
- package/dist/v2/server.js +104 -49288
- package/dist/v2/store-reader.d.ts +39 -1
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/tool-result.d.ts +8 -0
- package/dist/v2/tool-result.d.ts.map +1 -0
- package/dist/v2/tui/index.d.ts.map +1 -1
- package/dist/v2/{wrapup-orchestrator-tbyx78dz.js → wrapup-orchestrator-0snhvwcv.js} +20 -16
- package/dist/wrapup-orchestrator-39amhv9s.js +26 -0
- package/package.json +26 -10
- package/src/config/index.ts +21 -4
- package/src/config/latch-permanence-guard.test.ts +6 -1
- package/src/config/live-run-config.ts +1 -0
- package/src/config/migrate-config-location.test.ts +31 -1
- package/src/config/migrate-config-location.ts +8 -41
- package/src/config/protected-tools.test.ts +70 -0
- package/src/config/raw-loader.test.ts +15 -0
- package/src/config/raw-loader.ts +1 -1
- package/src/config/removed-agent-source-fence.test.ts +10 -1
- package/src/config/schema/magic-context.test.ts +20 -1
- package/src/config/schema/magic-context.ts +26 -7
- package/src/shared/announcement.ts +6 -5
- package/src/shared/cache-ttl-display.test.ts +1 -1
- package/src/shared/cache-ttl-display.ts +17 -16
- package/src/shared/fold-render-lock-fence.test.ts +84 -0
- package/src/shared/fold-render-lock-fixtures.test.ts +276 -0
- package/src/shared/model-cache-ttl.test.ts +2 -2
- package/src/shared/model-cache-ttl.ts +8 -4
- package/src/shared/model-suggestion-retry.test.ts +104 -1
- package/src/shared/model-suggestion-retry.ts +63 -6
- package/src/shared/models-dev-cache.ts +3 -11
- package/src/shared/protected-tools-policy.ts +23 -0
- package/src/shared/quota-diagnostic.ts +9 -0
- package/src/shared/rpc-server.ts +6 -54
- package/src/shared/sqlite-context-pragmas.test.ts +105 -0
- package/src/shared/sqlite-context-pragmas.ts +24 -0
- package/src/shared/sqlite-helpers.ts +17 -0
- package/src/shared/sqlite.ts +75 -0
- package/src/shared/status-detail-text.test.ts +18 -1
- package/src/shared/status-summary.ts +11 -0
- package/src/shared/status-view-check.ts +5 -0
- package/src/shared/status-view.test.ts +11 -2
- package/src/shared/status-view.ts +12 -1
- package/src/shared/storage-permissions.test.ts +204 -0
- package/src/shared/storage-permissions.ts +192 -0
- package/src/shared/temporal-upgrade-fixture.ts +50 -0
- package/src/shared/user-facing-codes.ts +6 -0
- package/src/shared/write-transaction-timing.test.ts +39 -0
- package/src/shared/write-transaction-timing.ts +25 -1
- package/src/tui/dialogs/status-dialog-render.test.ts +1 -1
- package/src/tui/index.tsx +3 -1
- package/src/tui/startup-order.test.ts +16 -0
- package/src/tui-compiled/index.tsx +3 -1
- package/src/v2/tui/index.ts +9 -2
- package/dist/index-anq4nn6f.js +0 -131
- package/dist/index-e44zzy84.js +0 -10
- package/dist/index-x23gah8c.js +0 -16
- package/dist/v2/recomp-orchestrator-1aq7h44c.js +0 -36
- package/dist/v2/server-e44zzy84.js +0 -10
- package/dist/v2/server-fgmxwrgy.js +0 -16
- package/dist/v2/server-r7cmye3k.js +0 -131
- package/dist/wrapup-orchestrator-h28bqsy6.js +0 -26
- package/dist/v2/{server-ckpc8pxy.js → server-1qbnzc80.js} +8 -8
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { Statement } from "better-sqlite3";
|
|
1
2
|
import type { RawMessageOrdinalAnchor } from "../hooks/magic-context/read-session-raw";
|
|
3
|
+
import { Database } from "../shared/sqlite";
|
|
2
4
|
/** Compatibility export; shared/opencode-db-path.ts is the single filename authority. */
|
|
3
5
|
export declare function sourceDatabaseFilename(channel: string, env?: NodeJS.ProcessEnv): string;
|
|
4
6
|
/** GA data root resolved by the shared host-generation-aware resolver. */
|
|
@@ -99,11 +101,35 @@ export declare function getV2StoreReaderDebugCounters(): V2StoreReaderDebugCount
|
|
|
99
101
|
export declare function resetV2StoreReaderDebugCounters(options?: {
|
|
100
102
|
captureQueries?: boolean;
|
|
101
103
|
}): void;
|
|
104
|
+
interface ReaderConnection {
|
|
105
|
+
db: Database;
|
|
106
|
+
statements: Map<string, Statement>;
|
|
107
|
+
identity: string;
|
|
108
|
+
leases: number;
|
|
109
|
+
retired: boolean;
|
|
110
|
+
}
|
|
111
|
+
/** Boot-scoped read-only handles. Each lease still closes in the caller's finally block.
|
|
112
|
+
* Statements, not results, are cached: WAL updates are visible on the next query.
|
|
113
|
+
* A replaced/missing file cannot reuse the old inode, and disposal releases all handles. */
|
|
114
|
+
export declare class V2StoreReaderPool {
|
|
115
|
+
private readonly capacity;
|
|
116
|
+
private readonly connections;
|
|
117
|
+
private closed;
|
|
118
|
+
constructor(capacity?: number);
|
|
119
|
+
open(path: string): V2StoreReader;
|
|
120
|
+
acquire(path: string): ReaderConnection;
|
|
121
|
+
release(connection: ReaderConnection): void;
|
|
122
|
+
private retire;
|
|
123
|
+
close(): void;
|
|
124
|
+
}
|
|
102
125
|
/** Opens an existing store read-only; missing/corrupt stores propagate errors, never an empty history. */
|
|
103
126
|
export declare class V2StoreReader {
|
|
127
|
+
private readonly pool?;
|
|
104
128
|
private readonly db;
|
|
129
|
+
private readonly connection;
|
|
105
130
|
private closed;
|
|
106
|
-
constructor(path: string);
|
|
131
|
+
constructor(path: string, pool?: V2StoreReaderPool | undefined);
|
|
132
|
+
private prepare;
|
|
107
133
|
close(): void;
|
|
108
134
|
/** Exclusive cursor, ascending seq. IDs are not chronological in the v2 store. */
|
|
109
135
|
page(sessionID: string, options?: {
|
|
@@ -134,6 +160,15 @@ export declare class V2StoreReader {
|
|
|
134
160
|
latestMessageTime(sessionID: string): number | undefined;
|
|
135
161
|
/** Parent links are recorded by the host before a child's first context pass. */
|
|
136
162
|
isSubagent(sessionID: string): boolean | null;
|
|
163
|
+
/**
|
|
164
|
+
* The most recently updated top-level user session the host created in
|
|
165
|
+
* `directory`, or undefined when there is none. Children, Magic Context's
|
|
166
|
+
* own hidden runs and archived sessions are never returned. The directory
|
|
167
|
+
* must match exactly: OpenCode 2 puts a child session in its parent's
|
|
168
|
+
* location, and only the plugin context of that location recognises the
|
|
169
|
+
* child, so a parent from a sibling checkout would strand the run.
|
|
170
|
+
*/
|
|
171
|
+
latestRootSessionInDirectory(directory: string): string | undefined;
|
|
137
172
|
/** Native user activity on root sessions; internal children must never become
|
|
138
173
|
* retrospective input. Activity is read from the source, not project-binding
|
|
139
174
|
* times or optional activity keys in Magic Context's store. */
|
|
@@ -170,6 +205,8 @@ export declare class V2StoreReader {
|
|
|
170
205
|
/** Conversational rows at or before `throughSeq`, newest first. */
|
|
171
206
|
rawRowsThrough(sessionID: string, throughSeq: number, limit: number): StoreRow[];
|
|
172
207
|
sequenceForId(sessionID: string, id: string | null | undefined): number | undefined;
|
|
208
|
+
/** Native synthetics are user-shaped on the wire; their store kind is unambiguous. */
|
|
209
|
+
syntheticMessageIDs(sessionID: string): Set<string>;
|
|
173
210
|
/**
|
|
174
211
|
* The session this one was forked from and where the fork was cut, as the
|
|
175
212
|
* host recorded them (`session_v2.fork_session_id` and `fork_boundary`).
|
|
@@ -204,4 +241,5 @@ export declare class V2StoreReader {
|
|
|
204
241
|
history(sessionID: string): StoreRow[];
|
|
205
242
|
private all;
|
|
206
243
|
}
|
|
244
|
+
export {};
|
|
207
245
|
//# sourceMappingURL=store-reader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-reader.d.ts","sourceRoot":"","sources":["../../src/v2/store-reader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store-reader.d.ts","sourceRoot":"","sources":["../../src/v2/store-reader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAMvF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,yFAAyF;AACzF,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAAM,CAAC,UAAwB,GACrC,MAAM,CAER;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,CAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,SAAW,EAClB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACrC,MAAM,CAER;AAGD,MAAM,MAAM,WAAW,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,MAAM,GACN,WAAW,GACX,QAAQ,GACR,OAAO,GACP,OAAO,GACP,WAAW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9E,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,EAAE;IAWrC;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,EAAE;IAItC,OAAO,CAAC,GAAG;CAcd"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Part = Record<string, unknown>;
|
|
2
|
+
/** The context hook sees normalized results; checkpoint replay sees raw error envelopes. */
|
|
3
|
+
export declare function isToolError(part: Part): boolean;
|
|
4
|
+
/** Match the host's error wire text, including the content and the structured error. */
|
|
5
|
+
export declare function toolErrorText(result: Part): string;
|
|
6
|
+
export declare function toolStateContent(state: Part): string;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=tool-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-result.d.ts","sourceRoot":"","sources":["../../src/v2/tool-result.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC,4FAA4F;AAC5F,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAO/C;AAED,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,MAAM,EAAE,IAAI,GAAG,MAAM,CAGlD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,CAiBpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/v2/tui/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI5E,OAAO,EAYH,KAAK,kBAAkB,EAC1B,MAAM,2BAA2B,CAAC;AAUnC,OAAO,KAAK,EAAiC,YAAY,EAAE,MAAM,SAAS,CAAC;AAY3E;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,SA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GAClB,aAAa,GACb,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,qBAAqB,GACrB,oBAAoB,CACzB,GACF,MAAM,CA6BR;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAoBhE;AAOD,KAAK,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;AAE5E,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAgZ9F;AAED,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAStE;;;;;AAED,wBAAuD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sessionLog
|
|
3
|
-
} from "./server-
|
|
4
|
-
import"./server-
|
|
3
|
+
} from "./server-1qbnzc80.js";
|
|
4
|
+
import"./server-frbm99q5.js";
|
|
5
5
|
import {
|
|
6
6
|
COMPARTMENT_LEASE_RENEWAL_MS,
|
|
7
7
|
acquireCompartmentLease,
|
|
@@ -24,25 +24,28 @@ import {
|
|
|
24
24
|
registerActiveCompartmentRun,
|
|
25
25
|
setRecompStarting2,
|
|
26
26
|
setRecompTerminal2
|
|
27
|
-
} from "./server-
|
|
28
|
-
import"./server-
|
|
29
|
-
import"./server-
|
|
30
|
-
import"./server-
|
|
31
|
-
import"./server-
|
|
32
|
-
import"./server-
|
|
33
|
-
import"./server-
|
|
34
|
-
import"./server-
|
|
35
|
-
import"./server-
|
|
36
|
-
import"./server-
|
|
27
|
+
} from "./server-jc7y02q0.js";
|
|
28
|
+
import"./server-51dv1pr5.js";
|
|
29
|
+
import"./server-xa4xe3rv.js";
|
|
30
|
+
import"./server-fg34g6a5.js";
|
|
31
|
+
import"./server-vs5gpnd4.js";
|
|
32
|
+
import"./server-1zx87sdm.js";
|
|
33
|
+
import"./server-qp5hx1ad.js";
|
|
34
|
+
import"./server-g0fjrkta.js";
|
|
35
|
+
import"./server-ajzeteqw.js";
|
|
36
|
+
import"./server-wvjvfhck.js";
|
|
37
|
+
import"./server-e29d7p7c.js";
|
|
37
38
|
import {
|
|
38
39
|
pushNotification2
|
|
39
40
|
} from "./server-x8a7jmkh.js";
|
|
40
41
|
import {
|
|
41
42
|
sendStatusNotification2
|
|
42
|
-
} from "./server-
|
|
43
|
-
import"./server-
|
|
44
|
-
import"./server-
|
|
45
|
-
import"./server-
|
|
43
|
+
} from "./server-mcfawjgc.js";
|
|
44
|
+
import"./server-c5gz8wph.js";
|
|
45
|
+
import"./server-y8maxeft.js";
|
|
46
|
+
import"./server-3n4q9xme.js";
|
|
47
|
+
import"./server-6r257mf5.js";
|
|
48
|
+
import"./server-14vq4kpm.js";
|
|
46
49
|
|
|
47
50
|
// src/hooks/magic-context/wrapup-orchestrator.ts
|
|
48
51
|
import * as crypto from "node:crypto";
|
|
@@ -178,6 +181,7 @@ async function runOneWrapupIteration(args) {
|
|
|
178
181
|
const runnerPromise = runCompartmentAgentForWrapup({
|
|
179
182
|
client: ctx.client,
|
|
180
183
|
hiddenCompletionExecutor: ctx.hiddenCompletionExecutor,
|
|
184
|
+
compactionMarkerStrategy: ctx.compactionMarkerStrategy,
|
|
181
185
|
db: ctx.db,
|
|
182
186
|
sessionId,
|
|
183
187
|
historianChunkTokens: ctx.historianChunkTokens,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runManagedWrapup2
|
|
3
|
+
} from "./index-5p8jdswx.js";
|
|
4
|
+
import"./index-sgthv3f7.js";
|
|
5
|
+
import"./index-sjthx78w.js";
|
|
6
|
+
import"./index-sd3egckz.js";
|
|
7
|
+
import"./index-7qw742ev.js";
|
|
8
|
+
import"./index-0d3g3461.js";
|
|
9
|
+
import"./index-8x2v7gg9.js";
|
|
10
|
+
import"./index-r5hmbx3t.js";
|
|
11
|
+
import"./index-3h0ybwah.js";
|
|
12
|
+
import"./index-majxda46.js";
|
|
13
|
+
import"./index-1zx87sdm.js";
|
|
14
|
+
import"./index-q4yp4b52.js";
|
|
15
|
+
import"./index-5gq3b2ya.js";
|
|
16
|
+
import"./index-b35pxds2.js";
|
|
17
|
+
import"./index-5eqk6z3s.js";
|
|
18
|
+
import"./index-sj29b3z2.js";
|
|
19
|
+
import"./index-fg34g6a5.js";
|
|
20
|
+
import"./index-x8a7jmkh.js";
|
|
21
|
+
import"./index-fzbvakh0.js";
|
|
22
|
+
import"./index-hybnrwq0.js";
|
|
23
|
+
import"./index-q6hef7fh.js";
|
|
24
|
+
export {
|
|
25
|
+
runManagedWrapup2 as runManagedWrapup
|
|
26
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/opencode-magic-context",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -38,34 +38,33 @@
|
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "bun ../../scripts/check-bun.mjs && tsc -p ../retina-local-fs/tsconfig.build.json && bun run build:tui && bun ../../scripts/clean-dist-chunks.mjs dist index.js transformers-web.js transformers-node-wasm.js && bun build src/features/magic-context/memory/transformers-web-entry.ts --outfile dist/transformers-web.js --target browser --format esm --external onnxruntime-web && bun scripts/build-transformers-node-wasm.ts dist && bun build src/index.ts src/features/magic-context/memory/embedding-worker.ts src/features/magic-context/migration-worker.ts --outdir dist --entry-naming '[name].[ext]' --target node --format esm --splitting --external @opencode-ai/plugin --external onnxruntime-node --external onnxruntime-web --external sharp --external bun:sqlite --external node:sqlite && bun run build:v2 && tsc --emitDeclarationOnly",
|
|
41
|
-
"build:v2": "bun ../../scripts/clean-dist-chunks.mjs dist/v2 server.js embedding-worker.js migration-worker.js && bun build src/features/magic-context/memory/transformers-web-entry.ts --outfile dist/v2/transformers-web.js --target browser --format esm --external onnxruntime-web && bun scripts/build-transformers-node-wasm.ts dist/v2 && bun build src/v2/server.ts src/features/magic-context/memory/embedding-worker.ts src/features/magic-context/migration-worker.ts --outdir dist/v2 --entry-naming '[name].[ext]' --target node --format esm --splitting --external @opencode/plugin --external onnxruntime-node --external onnxruntime-web --external sharp --external bun:sqlite --external node:sqlite
|
|
41
|
+
"build:v2": "bun ../../scripts/clean-dist-chunks.mjs dist/v2 server.js embedding-worker.js migration-worker.js && bun build src/features/magic-context/memory/transformers-web-entry.ts --outfile dist/v2/transformers-web.js --target browser --format esm --external onnxruntime-web && bun scripts/build-transformers-node-wasm.ts dist/v2 && bun build src/v2/server.ts src/features/magic-context/memory/embedding-worker.ts src/features/magic-context/migration-worker.ts --outdir dist/v2 --entry-naming '[name].[ext]' --target node --format esm --splitting --external @opencode/plugin --external onnxruntime-node --external onnxruntime-web --external sharp --external bun:sqlite --external node:sqlite",
|
|
42
42
|
"build:tui": "bun scripts/build-tui.ts",
|
|
43
|
-
"check:tui-compiled": "
|
|
43
|
+
"check:tui-compiled": "git diff --exit-code -- src/tui-compiled && test -z \"$(git status --porcelain -- src/tui-compiled)\"",
|
|
44
44
|
"check:transformers-node-wasm": "bun scripts/verify-transformers-node-wasm.ts",
|
|
45
45
|
"typecheck": "tsc -p ../retina-local-fs/tsconfig.build.json && tsc --noEmit && tsc -p tsconfig.scripts.json",
|
|
46
|
-
"test": "bun ../../scripts/check-bun.mjs && bun install --frozen-lockfile && bun test --parallel=4 --timeout 30000",
|
|
47
|
-
"test:serial": "bun install --frozen-lockfile && bun test --timeout 30000",
|
|
46
|
+
"test": "bun ../../scripts/check-bun.mjs && bun install --frozen-lockfile && BUN_JSC_useOMGJIT=0 bun test --parallel=4 --timeout 30000",
|
|
47
|
+
"test:serial": "bun install --frozen-lockfile && BUN_JSC_useOMGJIT=0 bun test --timeout 30000",
|
|
48
48
|
"test:parallel:probe": "bun scripts/verify-parallel-db-isolation.ts",
|
|
49
49
|
"lint": "bun ../../scripts/check-bun.mjs && biome check .",
|
|
50
50
|
"lint:fix": "biome check --write .",
|
|
51
51
|
"format": "biome format --write .",
|
|
52
52
|
"format:check": "biome format .",
|
|
53
53
|
"clean": "bun ../../scripts/clean-dist-chunks.mjs dist index.js embedding-worker.js migration-worker.js transformers-web.js transformers-node-wasm.js && bun ../../scripts/clean-dist-chunks.mjs dist/v2 server.js embedding-worker.js migration-worker.js transformers-web.js transformers-node-wasm.js",
|
|
54
|
-
"prepublishOnly": "bun run build && bun run
|
|
54
|
+
"prepublishOnly": "bun run build && bun run check:tui-compiled"
|
|
55
55
|
},
|
|
56
|
+
"//check:tui-compiled": "Check drift on output already generated by build or build:tui; this check never regenerates files. CI and prepublishOnly build first.",
|
|
57
|
+
"//test": "Only test runs disable JSC's optimizing WebAssembly tier so per-file isolation does not pay its compilation cost on every file. This is not a production setting and does not change host process engine options.",
|
|
56
58
|
"dependencies": {
|
|
57
59
|
"@cortexkit/subc-client": "0.11.1",
|
|
58
60
|
"@jitl/quickjs-singlefile-cjs-release-asyncify": "0.32.0",
|
|
59
61
|
"@opencode-ai/plugin": "^1.17.11",
|
|
60
62
|
"@opencode-ai/sdk": "^1.17.11",
|
|
61
|
-
"@opentui/core": "^0.4.2",
|
|
62
|
-
"@opentui/solid": "^0.4.2",
|
|
63
63
|
"ai-tokenizer": "^1.0.6",
|
|
64
64
|
"comment-json": "^5.0.0",
|
|
65
65
|
"jsonc-parser": "^3.3.1",
|
|
66
66
|
"onnxruntime-web": "1.26.0-dev.20260416-b7804b056c",
|
|
67
67
|
"quickjs-emscripten": "^0.32.0",
|
|
68
|
-
"solid-js": "1.9.12",
|
|
69
68
|
"zod": "^4.1.8"
|
|
70
69
|
},
|
|
71
70
|
"optionalDependencies": {
|
|
@@ -73,6 +72,9 @@
|
|
|
73
72
|
"sharp": "^0.35.0"
|
|
74
73
|
},
|
|
75
74
|
"devDependencies": {
|
|
75
|
+
"@opentui/core": "^0.4.2",
|
|
76
|
+
"@opentui/solid": "^0.4.2",
|
|
77
|
+
"solid-js": "1.9.12",
|
|
76
78
|
"@opencode/plugin": "2.0.22",
|
|
77
79
|
"@opencode/ai": "2.0.22",
|
|
78
80
|
"@opencode/cli": "2.0.22",
|
|
@@ -103,6 +105,20 @@
|
|
|
103
105
|
"tui"
|
|
104
106
|
],
|
|
105
107
|
"peerDependencies": {
|
|
106
|
-
"@opencode-ai/plugin": ">=1.15.0"
|
|
108
|
+
"@opencode-ai/plugin": ">=1.15.0",
|
|
109
|
+
"@opentui/core": ">=0.4.2",
|
|
110
|
+
"@opentui/solid": ">=0.4.2",
|
|
111
|
+
"solid-js": "^1.9.12"
|
|
112
|
+
},
|
|
113
|
+
"peerDependenciesMeta": {
|
|
114
|
+
"@opentui/core": {
|
|
115
|
+
"optional": true
|
|
116
|
+
},
|
|
117
|
+
"@opentui/solid": {
|
|
118
|
+
"optional": true
|
|
119
|
+
},
|
|
120
|
+
"solid-js": {
|
|
121
|
+
"optional": true
|
|
122
|
+
}
|
|
107
123
|
}
|
|
108
124
|
}
|
package/src/config/index.ts
CHANGED
|
@@ -284,10 +284,22 @@ function deepMergeRawConfig(
|
|
|
284
284
|
typeof overrideVal === "object" &&
|
|
285
285
|
!Array.isArray(overrideVal)
|
|
286
286
|
) {
|
|
287
|
-
mergedValue =
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
287
|
+
mergedValue =
|
|
288
|
+
key === "protected_tools"
|
|
289
|
+
? Object.fromEntries(
|
|
290
|
+
[baseVal, overrideVal].flatMap((value) =>
|
|
291
|
+
Object.entries(value as Record<string, unknown>).map(
|
|
292
|
+
([name, count]) => [
|
|
293
|
+
name.toLowerCase().replace(/^mcp_/, ""),
|
|
294
|
+
count,
|
|
295
|
+
],
|
|
296
|
+
),
|
|
297
|
+
),
|
|
298
|
+
)
|
|
299
|
+
: deepMergeRawConfig(
|
|
300
|
+
baseVal as Record<string, unknown>,
|
|
301
|
+
overrideVal as Record<string, unknown>,
|
|
302
|
+
);
|
|
291
303
|
} else if (
|
|
292
304
|
key === "disabled_hooks" &&
|
|
293
305
|
Array.isArray(baseVal) &&
|
|
@@ -409,6 +421,11 @@ export function parsePluginConfig(
|
|
|
409
421
|
"protected_tags is deprecated and ignored; use protected_tokens instead.",
|
|
410
422
|
);
|
|
411
423
|
}
|
|
424
|
+
if (Object.hasOwn(rawConfig, "smart_drops")) {
|
|
425
|
+
preMigrationWarnings.push(
|
|
426
|
+
"smart_drops is deprecated and ignored; supersession reclaim is always on. This key no longer does anything; remove it.",
|
|
427
|
+
);
|
|
428
|
+
}
|
|
412
429
|
preMigrationWarnings.push(...misplacedAgentModelWarnings(rawConfig));
|
|
413
430
|
const migratedExperimental = migrateLegacyExperimental(
|
|
414
431
|
configWithoutRemovedAgent,
|
|
@@ -83,8 +83,13 @@ const KNOWN_SLOTS: Record<string, KnownSlot> = {
|
|
|
83
83
|
},
|
|
84
84
|
"packages/plugin/src/features/magic-context/smart-notes/sandbox-runner.ts:asyncModulePromise": {
|
|
85
85
|
classification: "VERDICT",
|
|
86
|
-
reason: "
|
|
86
|
+
reason: "Saved: the shared load has a ten-second deadline; timeout or rejection evicts the same cached attempt so a later check retries, and late native results cannot publish over a replacement.",
|
|
87
87
|
},
|
|
88
|
+
"packages/plugin/src/features/magic-context/smart-notes/sandbox-runner.ts:asyncModuleLoadAttempted":
|
|
89
|
+
{
|
|
90
|
+
classification: "DIAGNOSTIC",
|
|
91
|
+
reason: "Memory-stat history only: records that loading was attempted even after cache eviction; it never gates loading, retry or guest execution.",
|
|
92
|
+
},
|
|
88
93
|
"packages/plugin/src/features/magic-context/storage-meta-session.ts:sessionMetaSelectColumnsCache":
|
|
89
94
|
{
|
|
90
95
|
classification: "VERDICT",
|
|
@@ -6,6 +6,7 @@ import { LIVE_RELOAD_CONFIG_PATHS, type MagicContextConfig } from "./schema/magi
|
|
|
6
6
|
/** Copy only schema-marked live paths from fresh config; other settings retain boot values. */
|
|
7
7
|
export function sampleLiveConfig<T extends MagicContextConfig>(boot: T, fresh: T): T {
|
|
8
8
|
const result = { ...boot } as Record<string, unknown>;
|
|
9
|
+
result.cacheTtlConfigured = fresh.cacheTtlConfigured;
|
|
9
10
|
for (const path of LIVE_RELOAD_CONFIG_PATHS) {
|
|
10
11
|
const parts = path.split(".");
|
|
11
12
|
let value: unknown = fresh;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { describe, expect, it } from "bun:test";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
existsSync,
|
|
4
|
+
mkdirSync,
|
|
5
|
+
readFileSync,
|
|
6
|
+
rmSync,
|
|
7
|
+
statSync,
|
|
8
|
+
utimesSync,
|
|
9
|
+
writeFileSync,
|
|
10
|
+
} from "node:fs";
|
|
3
11
|
import { tmpdir } from "node:os";
|
|
4
12
|
import { join } from "node:path";
|
|
5
13
|
import { createTestTempDirFromPath } from "../shared/test-temp-dir";
|
|
@@ -18,6 +26,28 @@ function src(path: string, label = "legacy"): LegacyConfigSource {
|
|
|
18
26
|
}
|
|
19
27
|
|
|
20
28
|
describe("migrateConfigFile (location migration)", () => {
|
|
29
|
+
it("writes a user config migration with owner-only permissions", () => {
|
|
30
|
+
if (process.platform === "win32") return;
|
|
31
|
+
const dir = tmp();
|
|
32
|
+
try {
|
|
33
|
+
const target = join(dir, "config", "cortexkit", "magic-context.jsonc");
|
|
34
|
+
const legacy = join(dir, "legacy.jsonc");
|
|
35
|
+
writeFileSync(legacy, '{ "api_key": "secret" }\n');
|
|
36
|
+
|
|
37
|
+
const result = migrateConfigFile({
|
|
38
|
+
scope: "user",
|
|
39
|
+
targetPath: target,
|
|
40
|
+
legacySources: [src(legacy)],
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
expect(result.migrated).toBe(true);
|
|
44
|
+
expect(statSync(target).mode & 0o777).toBe(0o600);
|
|
45
|
+
expect(statSync(join(dir, "config", "cortexkit")).mode & 0o777).toBe(0o700);
|
|
46
|
+
} finally {
|
|
47
|
+
rmSync(dir, { recursive: true, force: true });
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
21
51
|
it("no-ops when no legacy source exists", () => {
|
|
22
52
|
const dir = tmp();
|
|
23
53
|
try {
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
closeSync,
|
|
3
|
-
existsSync,
|
|
4
|
-
mkdirSync,
|
|
5
|
-
openSync,
|
|
6
|
-
readFileSync,
|
|
7
|
-
renameSync,
|
|
8
|
-
rmSync,
|
|
9
|
-
statSync,
|
|
10
|
-
unlinkSync,
|
|
11
|
-
writeFileSync,
|
|
12
|
-
} from "node:fs";
|
|
1
|
+
import { existsSync, readFileSync, rmSync, statSync, unlinkSync } from "node:fs";
|
|
13
2
|
import { homedir } from "node:os";
|
|
14
3
|
import { basename, dirname, isAbsolute, join } from "node:path";
|
|
15
4
|
import { removeJsoncValue } from "../shared/jsonc-edit";
|
|
5
|
+
import {
|
|
6
|
+
ensureStorageDirectorySync,
|
|
7
|
+
writeStorageFileAtomicSync,
|
|
8
|
+
} from "../shared/storage-permissions";
|
|
16
9
|
|
|
17
10
|
/**
|
|
18
11
|
* Config-LOCATION migration: move Magic Context config from the per-harness
|
|
@@ -328,7 +321,7 @@ const CONFIG_LOCK_STALE_MS = 4_000;
|
|
|
328
321
|
function acquireConfigMigrationLock(lockDir: string): (() => void) | null {
|
|
329
322
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
330
323
|
try {
|
|
331
|
-
|
|
324
|
+
ensureStorageDirectorySync(lockDir, true, false);
|
|
332
325
|
return () => {
|
|
333
326
|
try {
|
|
334
327
|
rmSync(lockDir, { recursive: true, force: true });
|
|
@@ -361,33 +354,7 @@ function acquireConfigMigrationLock(lockDir: string): (() => void) | null {
|
|
|
361
354
|
// ── Atomic writes ────────────────────────────────────────────
|
|
362
355
|
|
|
363
356
|
function atomicWriteConfigFile(targetPath: string, content: string): void {
|
|
364
|
-
|
|
365
|
-
const tmpPath = join(
|
|
366
|
-
dirname(targetPath),
|
|
367
|
-
`.${basename(targetPath)}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`,
|
|
368
|
-
);
|
|
369
|
-
let fd: number | null = null;
|
|
370
|
-
try {
|
|
371
|
-
fd = openSync(tmpPath, "wx", 0o600);
|
|
372
|
-
writeFileSync(fd, content);
|
|
373
|
-
closeSync(fd);
|
|
374
|
-
fd = null;
|
|
375
|
-
renameSync(tmpPath, targetPath);
|
|
376
|
-
} catch (err) {
|
|
377
|
-
if (fd !== null) {
|
|
378
|
-
try {
|
|
379
|
-
closeSync(fd);
|
|
380
|
-
} catch {
|
|
381
|
-
// best-effort close before cleanup
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
try {
|
|
385
|
-
unlinkSync(tmpPath);
|
|
386
|
-
} catch {
|
|
387
|
-
// best-effort temp cleanup
|
|
388
|
-
}
|
|
389
|
-
throw err;
|
|
390
|
-
}
|
|
357
|
+
writeStorageFileAtomicSync(targetPath, content, true);
|
|
391
358
|
}
|
|
392
359
|
|
|
393
360
|
// ── Marker ───────────────────────────────────────────────────
|
|
@@ -483,7 +450,7 @@ export function migrateConfigFile(opts: ConfigFileMigrationOptions): ConfigFileM
|
|
|
483
450
|
return { migrated: false, conflict: false, targetPath: opts.targetPath, warnings };
|
|
484
451
|
}
|
|
485
452
|
|
|
486
|
-
|
|
453
|
+
ensureStorageDirectorySync(dirname(opts.targetPath), true);
|
|
487
454
|
const release = acquireConfigMigrationLock(`${opts.targetPath}.lock`);
|
|
488
455
|
if (!release) {
|
|
489
456
|
// Another instance holds the lock past our short budget. Skip rather than
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { 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
|
+
import { protectedToolTagNumbers } from "../features/magic-context/reclaim-protection";
|
|
6
|
+
import { createTestTempDirFromPath } from "../shared/test-temp-dir";
|
|
7
|
+
import { loadPluginConfigDetailed, parsePluginConfig } from ".";
|
|
8
|
+
import { MagicContextConfigSchema } from "./schema/magic-context";
|
|
9
|
+
|
|
10
|
+
it("protected_tools defaults, validation, active-only ordinals and zero override", () => {
|
|
11
|
+
expect(MagicContextConfigSchema.parse({}).protected_tools).toEqual({
|
|
12
|
+
todowrite: 1,
|
|
13
|
+
ctx_reduce: 3,
|
|
14
|
+
});
|
|
15
|
+
for (const value of [-1, 1.5, "2", null])
|
|
16
|
+
expect(
|
|
17
|
+
MagicContextConfigSchema.safeParse({ protected_tools: { custom: value } }).success,
|
|
18
|
+
).toBe(false);
|
|
19
|
+
const tags = [1, 2, 3, 4, 5].map((tagNumber) => ({
|
|
20
|
+
tagNumber,
|
|
21
|
+
toolName: tagNumber % 2 ? "MCP_CUSTOM" : "custom",
|
|
22
|
+
type: "tool",
|
|
23
|
+
status: tagNumber === 5 ? "compacted" : tagNumber === 4 ? "dropped" : "active",
|
|
24
|
+
}));
|
|
25
|
+
expect([...protectedToolTagNumbers(tags, { custom: 2 })]).toEqual([3, 2]);
|
|
26
|
+
expect([...protectedToolTagNumbers(tags, { custom: 0 })]).toEqual([]);
|
|
27
|
+
expect(parsePluginConfig({ smart_drops: false }).configWarnings).toContain(
|
|
28
|
+
"smart_drops is deprecated and ignored; supersession reclaim is always on. This key no longer does anything; remove it.",
|
|
29
|
+
);
|
|
30
|
+
expect(MagicContextConfigSchema.safeParse({ smart_drops: "ignored" }).success).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("protected_tools does not treat inherited object keys as configured tools", () => {
|
|
34
|
+
const tags = ["constructor", "__proto__"].map((toolName, i) => ({
|
|
35
|
+
tagNumber: i + 1,
|
|
36
|
+
toolName,
|
|
37
|
+
type: "tool",
|
|
38
|
+
status: "active",
|
|
39
|
+
}));
|
|
40
|
+
expect([...protectedToolTagNumbers(tags)]).toEqual([]);
|
|
41
|
+
expect([...protectedToolTagNumbers(tags, { constructor: 1 })]).toEqual([1]);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("protected_tools merges normalized project keys over user and shipped defaults", () => {
|
|
45
|
+
const dir = createTestTempDirFromPath(join(tmpdir(), "protected-tools-config-"));
|
|
46
|
+
const old = process.env.XDG_CONFIG_HOME;
|
|
47
|
+
try {
|
|
48
|
+
const project = join(dir, "project");
|
|
49
|
+
mkdirSync(join(dir, "cortexkit"), { recursive: true });
|
|
50
|
+
mkdirSync(join(project, ".cortexkit"), { recursive: true });
|
|
51
|
+
writeFileSync(
|
|
52
|
+
join(dir, "cortexkit/magic-context.jsonc"),
|
|
53
|
+
JSON.stringify({ protected_tools: { MCP_CUSTOM: 3, todowrite: 0 } }),
|
|
54
|
+
);
|
|
55
|
+
writeFileSync(
|
|
56
|
+
join(project, ".cortexkit/magic-context.jsonc"),
|
|
57
|
+
JSON.stringify({ protected_tools: { custom: 2, CTX_REDUCE: 1 } }),
|
|
58
|
+
);
|
|
59
|
+
process.env.XDG_CONFIG_HOME = dir;
|
|
60
|
+
expect(loadPluginConfigDetailed(project).config.protected_tools).toEqual({
|
|
61
|
+
custom: 2,
|
|
62
|
+
todowrite: 0,
|
|
63
|
+
ctx_reduce: 1,
|
|
64
|
+
});
|
|
65
|
+
} finally {
|
|
66
|
+
if (old === undefined) delete process.env.XDG_CONFIG_HOME;
|
|
67
|
+
else process.env.XDG_CONFIG_HOME = old;
|
|
68
|
+
rmSync(dir, { recursive: true, force: true });
|
|
69
|
+
}
|
|
70
|
+
});
|
|
@@ -375,6 +375,21 @@ describe("per-harness raw config migration", () => {
|
|
|
375
375
|
expect(statSync(backupPath).ino).toBe(backupInode);
|
|
376
376
|
});
|
|
377
377
|
|
|
378
|
+
it("creates user migration backups and replacement configs owner-only", () => {
|
|
379
|
+
if (process.platform === "win32") return;
|
|
380
|
+
const directory = temporaryDirectory();
|
|
381
|
+
const configPath = join(directory, "magic-context.jsonc");
|
|
382
|
+
const original = Buffer.from('{ "historian": { "model": "provider/model" } }\n');
|
|
383
|
+
writeFileSync(configPath, original);
|
|
384
|
+
chmodSync(configPath, 0o644);
|
|
385
|
+
|
|
386
|
+
const loaded = loadRawConfigFile({ configPath, tier: "user" });
|
|
387
|
+
|
|
388
|
+
expect(loaded?.migrated).toBe(true);
|
|
389
|
+
expect(statSync(configPath).mode & 0o777).toBe(0o600);
|
|
390
|
+
expect(statSync(`${configPath}.pre-per-harness.bak`).mode & 0o777).toBe(0o600);
|
|
391
|
+
});
|
|
392
|
+
|
|
378
393
|
// stow, chezmoi and home-manager link the user config into a dotfiles repo.
|
|
379
394
|
// Replacing the link with a regular file would silently stop later edits
|
|
380
395
|
// from reaching that repo, so the migration writes through to the target.
|
package/src/config/raw-loader.ts
CHANGED
|
@@ -439,7 +439,7 @@ export function loadRawConfigFile(options: RawConfigLoadOptions): RawConfigLoadR
|
|
|
439
439
|
// it in a dotfiles repo): the temporary file is created next to the
|
|
440
440
|
// real file and renamed onto it, so the link itself stays a link.
|
|
441
441
|
const writePath = realpathSync(options.configPath);
|
|
442
|
-
const mode = statSync(writePath).mode & 0o777;
|
|
442
|
+
const mode = options.tier === "user" ? 0o600 : statSync(writePath).mode & 0o777;
|
|
443
443
|
writeExclusiveBackup(backupPath, observedBytes, mode);
|
|
444
444
|
temporaryPath = writeTemporaryCandidate(writePath, migration.bytes, mode);
|
|
445
445
|
options.afterTemporaryWrite?.();
|
|
@@ -23,6 +23,13 @@ const SOURCE_ROOTS = [
|
|
|
23
23
|
join(REPO_ROOT, "packages", "dashboard", "src-tauri", "src"),
|
|
24
24
|
];
|
|
25
25
|
const SOURCE_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".rs", ".json"]);
|
|
26
|
+
// The dashboard labels sessions from other CortexKit agents, and one of their run
|
|
27
|
+
// kinds shares this name. These files name that external run kind, not the retired
|
|
28
|
+
// Magic Context agent, so they are allowed to mention it.
|
|
29
|
+
const EXTERNAL_RUN_KIND_FILES = new Set([
|
|
30
|
+
join(REPO_ROOT, "packages", "dashboard", "src", "lib", "session-label.ts"),
|
|
31
|
+
join(REPO_ROOT, "packages", "dashboard", "src", "lib", "session-label.test.ts"),
|
|
32
|
+
]);
|
|
26
33
|
|
|
27
34
|
function sourceFiles(directory: string, files: string[] = []): string[] {
|
|
28
35
|
for (const entry of readdirSync(directory)) {
|
|
@@ -44,7 +51,9 @@ describe("retired agent source fence", () => {
|
|
|
44
51
|
const offenses: string[] = [];
|
|
45
52
|
for (const file of SOURCE_ROOTS.flatMap((root) => sourceFiles(root))) {
|
|
46
53
|
const matches = readFileSync(file, "utf8").match(RETIRED_AGENT_PATTERN) ?? [];
|
|
47
|
-
const allowed =
|
|
54
|
+
const allowed =
|
|
55
|
+
(file === WARNING_SOURCE && matches.length === 1) ||
|
|
56
|
+
EXTERNAL_RUN_KIND_FILES.has(file);
|
|
48
57
|
if (!allowed && matches.length > 0) {
|
|
49
58
|
offenses.push(`${relative(REPO_ROOT, file)} (${matches.length})`);
|
|
50
59
|
}
|