@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,18 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./index-
|
|
2
|
+
readJsoncFile
|
|
3
|
+
} from "./index-sd3egckz.js";
|
|
4
4
|
import {
|
|
5
|
-
importPluginModule,
|
|
6
5
|
log
|
|
7
6
|
} from "./index-hybnrwq0.js";
|
|
8
|
-
import {
|
|
9
|
-
readJsoncFile
|
|
10
|
-
} from "./index-sd3egckz.js";
|
|
11
|
-
|
|
12
|
-
// src/plugin/conflict-warning-hook.ts
|
|
13
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
14
|
-
import { homedir as homedir3, platform } from "node:os";
|
|
15
|
-
import { join as join3 } from "node:path";
|
|
16
7
|
|
|
17
8
|
// src/shared/conflict-detector.ts
|
|
18
9
|
import { homedir as homedir2 } from "node:os";
|
|
@@ -351,248 +342,4 @@ function formatConflictShort(result) {
|
|
|
351
342
|
`);
|
|
352
343
|
}
|
|
353
344
|
|
|
354
|
-
|
|
355
|
-
var CONFLICT_WARNING_MARKER = "⚠️ Magic Context is disabled due to conflicting configuration:";
|
|
356
|
-
var SCHEMA_FENCE_MARKER = "⚠️ Magic Context is disabled — database is newer than this version";
|
|
357
|
-
var ENABLED_MARKER = "✨ Magic Context is now enabled";
|
|
358
|
-
var ANNOUNCEMENT_MARKER = "✨ Magic Context — what's new in";
|
|
359
|
-
function getDesktopStatePath() {
|
|
360
|
-
const os = platform();
|
|
361
|
-
const home = homedir3();
|
|
362
|
-
if (os === "darwin") {
|
|
363
|
-
return join3(home, "Library", "Application Support", "ai.opencode.desktop", "opencode.global.dat");
|
|
364
|
-
}
|
|
365
|
-
if (os === "linux") {
|
|
366
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME || join3(home, ".config");
|
|
367
|
-
return join3(xdgConfig, "ai.opencode.desktop", "opencode.global.dat");
|
|
368
|
-
}
|
|
369
|
-
if (os === "win32") {
|
|
370
|
-
const appData = process.env.APPDATA || join3(home, "AppData", "Roaming");
|
|
371
|
-
return join3(appData, "ai.opencode.desktop", "opencode.global.dat");
|
|
372
|
-
}
|
|
373
|
-
return null;
|
|
374
|
-
}
|
|
375
|
-
function readDesktopState(directory) {
|
|
376
|
-
const statePath = getDesktopStatePath();
|
|
377
|
-
if (!statePath || !existsSync(statePath)) {
|
|
378
|
-
log(`[magic-context] conflict-warning: Desktop state file not found at ${statePath}`);
|
|
379
|
-
return { sessionId: null, sidecarUrl: null };
|
|
380
|
-
}
|
|
381
|
-
try {
|
|
382
|
-
const raw = readFileSync(statePath, "utf-8");
|
|
383
|
-
const state = JSON.parse(raw);
|
|
384
|
-
let sidecarUrl = null;
|
|
385
|
-
const serverStr = state.server;
|
|
386
|
-
if (typeof serverStr === "string") {
|
|
387
|
-
try {
|
|
388
|
-
const serverState = JSON.parse(serverStr);
|
|
389
|
-
if (typeof serverState.currentSidecarUrl === "string") {
|
|
390
|
-
sidecarUrl = serverState.currentSidecarUrl;
|
|
391
|
-
}
|
|
392
|
-
} catch {}
|
|
393
|
-
}
|
|
394
|
-
let sessionId = null;
|
|
395
|
-
const layoutPage = state["layout.page"];
|
|
396
|
-
if (typeof layoutPage === "string") {
|
|
397
|
-
const parsed = JSON.parse(layoutPage);
|
|
398
|
-
const lastProjectSession = parsed.lastProjectSession;
|
|
399
|
-
if (lastProjectSession) {
|
|
400
|
-
const entry = lastProjectSession[directory];
|
|
401
|
-
sessionId = entry?.id ?? null;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
return { sessionId, sidecarUrl };
|
|
405
|
-
} catch (error) {
|
|
406
|
-
log(`[magic-context] conflict-warning: failed to read Desktop state: ${error instanceof Error ? error.message : String(error)}`);
|
|
407
|
-
return { sessionId: null, sidecarUrl: null };
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
var cachedDesktopStateByDir = new Map;
|
|
411
|
-
var __conflictWarningTest2 = {
|
|
412
|
-
setDesktopState(directory, state) {
|
|
413
|
-
cachedDesktopStateByDir.set(directory, state);
|
|
414
|
-
},
|
|
415
|
-
reset() {
|
|
416
|
-
cachedDesktopStateByDir.clear();
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
function getDesktopState(directory) {
|
|
420
|
-
let cached = cachedDesktopStateByDir.get(directory);
|
|
421
|
-
if (!cached) {
|
|
422
|
-
cached = readDesktopState(directory);
|
|
423
|
-
cachedDesktopStateByDir.set(directory, cached);
|
|
424
|
-
}
|
|
425
|
-
return cached;
|
|
426
|
-
}
|
|
427
|
-
async function deleteMessage(serverUrl, sessionId, messageId) {
|
|
428
|
-
const auth = getServerAuth();
|
|
429
|
-
const url = `${serverUrl}/session/${encodeURIComponent(sessionId)}/message/${encodeURIComponent(messageId)}`;
|
|
430
|
-
try {
|
|
431
|
-
const response = await fetch(url, {
|
|
432
|
-
method: "DELETE",
|
|
433
|
-
headers: auth ? { Authorization: auth } : {},
|
|
434
|
-
signal: AbortSignal.timeout(1e4)
|
|
435
|
-
});
|
|
436
|
-
if (!response.ok) {
|
|
437
|
-
log(`[magic-context] conflict-warning: DELETE failed status=${response.status} url=${url}`);
|
|
438
|
-
return false;
|
|
439
|
-
}
|
|
440
|
-
return true;
|
|
441
|
-
} catch (error) {
|
|
442
|
-
log(`[magic-context] conflict-warning: DELETE error (url=${serverUrl}): ${error instanceof Error ? error.message : String(error)}`);
|
|
443
|
-
return false;
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
function getServerAuth() {
|
|
447
|
-
const password = process.env.OPENCODE_SERVER_PASSWORD;
|
|
448
|
-
if (!password)
|
|
449
|
-
return;
|
|
450
|
-
const username = process.env.OPENCODE_SERVER_USERNAME ?? "opencode";
|
|
451
|
-
return `Basic ${Buffer.from(`${username}:${password}`, "utf8").toString("base64")}`;
|
|
452
|
-
}
|
|
453
|
-
async function getSessionMessages(client, sessionId) {
|
|
454
|
-
try {
|
|
455
|
-
const c = client;
|
|
456
|
-
if (typeof c.session?.messages === "function") {
|
|
457
|
-
const result = await c.session.messages({
|
|
458
|
-
path: { id: sessionId },
|
|
459
|
-
query: { limit: 50 }
|
|
460
|
-
});
|
|
461
|
-
return result?.data ?? [];
|
|
462
|
-
}
|
|
463
|
-
} catch (error) {
|
|
464
|
-
log(`[magic-context] conflict-warning: failed to read messages: ${error instanceof Error ? error.message : String(error)}`);
|
|
465
|
-
}
|
|
466
|
-
return [];
|
|
467
|
-
}
|
|
468
|
-
async function sendConflictWarning2(client, directory, conflictResult) {
|
|
469
|
-
const { sessionId } = getDesktopState(directory);
|
|
470
|
-
if (!sessionId) {
|
|
471
|
-
log("[magic-context] conflict-warning: could not find active session for Desktop warning");
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
const warningText = formatConflictShort(conflictResult);
|
|
475
|
-
log(`[magic-context] sending conflict warning to session ${sessionId}: ${conflictResult.reasons.join(", ")}`);
|
|
476
|
-
try {
|
|
477
|
-
await sendStatusNotification2(client, sessionId, warningText, {});
|
|
478
|
-
} catch (error) {
|
|
479
|
-
log(`[magic-context] conflict-warning: failed to send: ${error instanceof Error ? error.message : String(error)}`);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
async function cleanupConflictWarnings2(client, directory, serverUrl) {
|
|
483
|
-
const { sessionId } = getDesktopState(directory);
|
|
484
|
-
if (!sessionId) {
|
|
485
|
-
log("[magic-context] cleanup: no active Desktop session found");
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
const messages = await getSessionMessages(client, sessionId);
|
|
489
|
-
if (messages.length === 0)
|
|
490
|
-
return;
|
|
491
|
-
const warningMessageIds = [];
|
|
492
|
-
for (let i = messages.length - 1;i >= 0; i--) {
|
|
493
|
-
const msg = messages[i];
|
|
494
|
-
const msgId = msg.info?.id;
|
|
495
|
-
const msgRole = msg.info?.role;
|
|
496
|
-
if (!msgId || msgRole !== "user")
|
|
497
|
-
break;
|
|
498
|
-
const parts = msg.parts ?? [];
|
|
499
|
-
const isWarning = parts.length > 0 && parts.every((p) => p.ignored === true && p.type === "text" && typeof p.text === "string" && p.text.startsWith(CONFLICT_WARNING_MARKER));
|
|
500
|
-
if (isWarning) {
|
|
501
|
-
warningMessageIds.push(msgId);
|
|
502
|
-
} else {
|
|
503
|
-
break;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
if (warningMessageIds.length === 0) {
|
|
507
|
-
await cleanupEnabledMessages(messages, serverUrl, sessionId);
|
|
508
|
-
return;
|
|
509
|
-
}
|
|
510
|
-
if (!serverUrl) {
|
|
511
|
-
log("[magic-context] cleanup: no serverUrl provided, cannot delete messages");
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
log(`[magic-context] cleaning up ${warningMessageIds.length} conflict warning message(s) from session ${sessionId}`);
|
|
515
|
-
for (const messageId of warningMessageIds) {
|
|
516
|
-
const ok = await deleteMessage(serverUrl, sessionId, messageId);
|
|
517
|
-
if (ok) {
|
|
518
|
-
log(`[magic-context] deleted conflict warning message ${messageId}`);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
const enabledText = `${ENABLED_MARKER}. Enjoy! ✨`;
|
|
522
|
-
try {
|
|
523
|
-
await sendStatusNotification2(client, sessionId, enabledText, {});
|
|
524
|
-
} catch {}
|
|
525
|
-
}
|
|
526
|
-
async function cleanupEnabledMessages(messages, serverUrl, sessionId) {
|
|
527
|
-
if (!serverUrl)
|
|
528
|
-
return;
|
|
529
|
-
for (let i = messages.length - 1;i >= 0; i--) {
|
|
530
|
-
const msg = messages[i];
|
|
531
|
-
const msgId = msg.info?.id;
|
|
532
|
-
const msgRole = msg.info?.role;
|
|
533
|
-
if (!msgId || msgRole !== "user")
|
|
534
|
-
break;
|
|
535
|
-
const parts = msg.parts ?? [];
|
|
536
|
-
const isEnabled = parts.length > 0 && parts.every((p) => p.ignored === true && p.type === "text" && typeof p.text === "string" && p.text.startsWith(ENABLED_MARKER));
|
|
537
|
-
if (isEnabled) {
|
|
538
|
-
await deleteMessage(serverUrl, sessionId, msgId);
|
|
539
|
-
} else {
|
|
540
|
-
break;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
async function sendSchemaFenceWarning2(client, directory, detail) {
|
|
545
|
-
const { sessionId } = getDesktopState(directory);
|
|
546
|
-
if (!sessionId)
|
|
547
|
-
return;
|
|
548
|
-
const text = [
|
|
549
|
-
`${SCHEMA_FENCE_MARKER}`,
|
|
550
|
-
"",
|
|
551
|
-
`The shared Magic Context database was upgraded to schema v${detail.persistedVersion} by a`,
|
|
552
|
-
`newer build (OpenCode and Pi share one database). This build only supports`,
|
|
553
|
-
`up to v${detail.supportedVersion}, so it has fail-closed to avoid corrupting the cache.`,
|
|
554
|
-
"",
|
|
555
|
-
"This usually means a pinned or stale plugin is sharing the database with a",
|
|
556
|
-
"newer instance. Update or unpin Magic Context on this harness (or update",
|
|
557
|
-
"OpenCode/Pi) to the latest version, then restart. The fastest fix is:",
|
|
558
|
-
"",
|
|
559
|
-
" npx @cortexkit/magic-context@latest doctor --force",
|
|
560
|
-
"",
|
|
561
|
-
"Your data is safe; nothing is disabled permanently."
|
|
562
|
-
].join(`
|
|
563
|
-
`);
|
|
564
|
-
try {
|
|
565
|
-
await sendStatusNotification2(client, sessionId, text, {});
|
|
566
|
-
} catch {
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
async function sendStartupAnnouncement2(client, directory, version, features, footer, markSeen) {
|
|
571
|
-
if (!version || features.length === 0)
|
|
572
|
-
return;
|
|
573
|
-
const { sessionId } = getDesktopState(directory);
|
|
574
|
-
if (!sessionId) {
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
const { isTuiConnected } = await importPluginModule(() => import("./rpc-notifications-3hed126v.js"));
|
|
578
|
-
if (isTuiConnected(sessionId) || isTuiConnected())
|
|
579
|
-
return;
|
|
580
|
-
const bullets = features.map((line) => ` • ${line}`).join(`
|
|
581
|
-
`);
|
|
582
|
-
const sections = [`${ANNOUNCEMENT_MARKER} v${version}:`, "", bullets];
|
|
583
|
-
if (footer && footer.trim().length > 0) {
|
|
584
|
-
sections.push("", footer);
|
|
585
|
-
}
|
|
586
|
-
const text = sections.join(`
|
|
587
|
-
`);
|
|
588
|
-
log(`[magic-context] sending startup announcement for v${version} to session ${sessionId}`);
|
|
589
|
-
try {
|
|
590
|
-
await sendStatusNotification2(client, sessionId, text, {
|
|
591
|
-
onDelivered: () => markSeen(version)
|
|
592
|
-
});
|
|
593
|
-
} catch (error) {
|
|
594
|
-
log(`[magic-context] announcement: failed to send: ${error instanceof Error ? error.message : String(error)}`);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
export { detectConflicts, resolveCompactionForBoot, __conflictWarningTest2, sendConflictWarning2, cleanupConflictWarnings2, sendSchemaFenceWarning2, sendStartupAnnouncement2 };
|
|
345
|
+
export { detectConflicts, resolveCompactionForBoot, formatConflictShort };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
toolTemplateError
|
|
3
|
-
|
|
2
|
+
toolTemplateError,
|
|
3
|
+
DEFAULT_PROTECTED_TOOLS,
|
|
4
|
+
mergeProtectedTools
|
|
5
|
+
} from "./index-q4yp4b52.js";
|
|
4
6
|
import {
|
|
5
7
|
getHarness,
|
|
6
8
|
getMagicContextStorageDir
|
|
@@ -11,10 +13,14 @@ import {
|
|
|
11
13
|
} from "./index-hybnrwq0.js";
|
|
12
14
|
import {
|
|
13
15
|
estimateTokens
|
|
14
|
-
} from "./index-
|
|
16
|
+
} from "./index-5eqk6z3s.js";
|
|
15
17
|
import {
|
|
16
|
-
shouldEnforcePrivateStoragePermissions
|
|
17
|
-
|
|
18
|
+
shouldEnforcePrivateStoragePermissions,
|
|
19
|
+
ensureStorageDirectorySync,
|
|
20
|
+
writeStorageFileAsync,
|
|
21
|
+
writeStorageFileHandleAsync,
|
|
22
|
+
createStorageFileHandleAsync
|
|
23
|
+
} from "./index-1bc61ans.js";
|
|
18
24
|
import {
|
|
19
25
|
modelRefLookupOrder
|
|
20
26
|
} from "./index-avwt563y.js";
|
|
@@ -92,8 +98,8 @@ function buildPrimaryLanguageDirective(language) {
|
|
|
92
98
|
}
|
|
93
99
|
|
|
94
100
|
// src/features/magic-context/memory/embedding-local.ts
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
101
|
+
import { readdirSync, statSync } from "node:fs";
|
|
102
|
+
import { stat, unlink } from "node:fs/promises";
|
|
97
103
|
import { dirname, join } from "node:path";
|
|
98
104
|
import { pathToFileURL } from "node:url";
|
|
99
105
|
import { workerData } from "node:worker_threads";
|
|
@@ -5467,6 +5473,7 @@ var AgentMetadataSchema = AgentOverrideConfigSchema.pick({
|
|
|
5467
5473
|
maxTokens: true
|
|
5468
5474
|
});
|
|
5469
5475
|
var DreamerConfigSchema = AgentMetadataSchema.extend({
|
|
5476
|
+
disable: boolean2().optional().describe("Disable this agent"),
|
|
5470
5477
|
runner: _enum(["broca", "host"]).optional().describe(`Which side runs the dreamer completions the Rust module routes (classify-memories) in Rust transform mode: "host" runs them on this process's carrier, "broca" routes them to the Broca module. When unset, historian.runner applies, and when that is unset too the harness decides the same way it does for the historian. User-level config only.`),
|
|
5471
5478
|
opencode: DreamerOpenCodeHarnessBlockSchema.optional(),
|
|
5472
5479
|
pi: DreamerPiHarnessBlockSchema.optional(),
|
|
@@ -5615,7 +5622,7 @@ var MagicContextConfigSchema = object({
|
|
|
5615
5622
|
smart_notes: object({
|
|
5616
5623
|
retina_handoff: boolean2().default(false).describe("When true, dreamer skips smart notes whose surface conditions compiled to retina provider configs at authoring time. Default false keeps both paths active until the retina consumer is deployed.")
|
|
5617
5624
|
}).default({ retina_handoff: false }).describe("Smart-note ownership transition controls."),
|
|
5618
|
-
cache_ttl: union([string(), object({ default: string() }).catchall(string())]).default("5m").describe(`How long Magic Context assumes the provider's cached prefix stays valid. This is MC's own deferral gate — it does not change the provider's actual cache lifetime. String (e.g. "5m", "1h", "30s") or per-model object ({ default: "5m", "provider/model": "1h", "provider/*": "never" }); keys resolve most-specific first (exact provider/model, bare model ID, shorter dash-prefixes, then the provider/* wildcard).
|
|
5625
|
+
cache_ttl: union([string(), object({ default: string() }).catchall(string())]).default("5m").describe(`How long Magic Context assumes the provider's cached prefix stays valid. This is MC's own deferral gate — it does not change the provider's actual cache lifetime. String (e.g. "5m", "1h", "30s") or per-model object ({ default: "5m", "provider/model": "1h", "provider/*": "never" }); keys resolve most-specific first (exact provider/model, bare model ID, shorter dash-prefixes, then the provider/* wildcard, then default). User and project settings, including an explicit "5m" or object default, apply on the next pass. Only built-in defaults are frozen per session, including across restarts: when unset, GPT-5.6 and later (including gpt-6*, through any provider prefix) use 30m, other models use 5m. /ctx-status shows the effective TTL and whether it comes from your config or a frozen built-in default. Editing the TTL does not itself rewrite prompt bytes; a lowered TTL rebuilds only after normal idle expiry. OpenAI documents at least 30 minutes since the latest write or reuse: https://developers.openai.com/api/docs/guides/prompt-caching (Cache lifetime and Summary of model differences). Set to "never" to mean MC never assumes expiry (for lanes kept warm externally by a cache-keep tool) — disables the idle-TTL heuristic so MC never initiates a rebuild based on elapsed time. Provider-side extended TTL is a separate request-level concern (cache_control: { ttl } in the request body).`),
|
|
5619
5626
|
prompt_surface: PromptSurfaceConfigSchema.default({ default: "full" }).describe("Prompt-surface presets: default is full; models use bare model IDs, provider/model, or provider/* routing keys. Guidance and tool-description overrides are user-level only. OpenCode 1.x, Pi, and OMP register tool descriptions once per process (they follow the default preset). OpenCode 2 rewrites the five ctx_* descriptions per request from the draft model."),
|
|
5620
5627
|
output_reserve: union([
|
|
5621
5628
|
number2().min(0),
|
|
@@ -5653,8 +5660,8 @@ var MagicContextConfigSchema = object({
|
|
|
5653
5660
|
mmap_size_mb: number2().min(0).max(8192).default(0).describe("Memory-mapped I/O size in MiB (PRAGMA mmap_size). 0 disables mmap (SQLite default). Raising it can cut read overhead on large DBs at the cost of address space. (min 0, max 8192, default 0)")
|
|
5654
5661
|
}).default({ cache_size_mb: 64, mmap_size_mb: 0 }).describe("SQLite connection tuning for Magic Context's own context.db. These are per-connection PRAGMAs applied at open; they do not change the schema or what is stored."),
|
|
5655
5662
|
storage: object({
|
|
5656
|
-
enforce_private_permissions: boolean2().default(true).describe("When true (default), Magic Context creates and re-tightens its storage directories to owner-only 0700 and storage files to owner-only 0600. Set false only for a deliberate trusted-group deployment whose operator manages
|
|
5657
|
-
}).default({ enforce_private_permissions: true }).describe("Storage permission policy. The default keeps session content and memories owner-private. Disabling enforcement is for trusted shared-group storage managed externally;
|
|
5663
|
+
enforce_private_permissions: boolean2().default(true).describe("When true (default), Magic Context creates and re-tightens its TypeScript-mode storage directories to owner-only 0700 and storage files to owner-only 0600. Set false only for a deliberate trusted-group deployment whose operator manages those files externally; in TypeScript mode Magic Context then skips its own creation modes and recursive tightening. In Rust transform mode, ck-mc's store library always keeps the shared data directory owner-only 0700, regardless of this setting. USER-LEVEL ONLY — ignored in project config for security. On Windows, POSIX chmod modes are already meaningless, so this setting is a no-op.")
|
|
5664
|
+
}).default({ enforce_private_permissions: true }).describe("Storage permission policy. The default keeps session content and memories owner-private. Disabling enforcement is for trusted shared-group storage managed externally; TypeScript mode follows that policy, but Rust transform mode always keeps its shared data directory owner-only because ck-mc's store library enforces it."),
|
|
5658
5665
|
embedding: EmbeddingConfigSchema.default({
|
|
5659
5666
|
provider: "local",
|
|
5660
5667
|
model: DEFAULT_LOCAL_EMBEDDING_MODEL,
|
|
@@ -5678,7 +5685,8 @@ var MagicContextConfigSchema = object({
|
|
|
5678
5685
|
overlay: boolean2().default(true).describe("Pi only: show the persistent todo overlay above the editor while tasks are active.")
|
|
5679
5686
|
}).default({ enabled: false, overlay: true }).describe("Pi-only todowrite tool and overlay controls. Pi registers tools and widgets at extension boot, so changing this after /cd requires /reload or restart."),
|
|
5680
5687
|
pi: PiConfigSchema.describe("Pi-only child-process extension controls. This setting is user-level only; project configuration cannot choose which extensions a user's subagent children load."),
|
|
5681
|
-
smart_drops:
|
|
5688
|
+
smart_drops: unknown().optional().describe("Deprecated: ignored. Content-aware supersession reclaim is always on, only on passes already rebuilding the cache. Remove this key; it no longer does anything.").meta({ deprecated: true }),
|
|
5689
|
+
protected_tools: record(string(), number2().int().nonnegative()).default({ ...DEFAULT_PROTECTED_TOOLS }).transform((map) => mergeProtectedTools(map)).describe("Keep each tool's newest N still-active results in every automatic drop lane (issue 621). User and project maps merge over defaults {todowrite: 1, ctx_reduce: 3}; 0 turns protection off. Names are case-insensitive and ignore leading mcp_. Holds even at 95% pressure, with no byte cap: large protected outputs can reach refusal sooner. Queued drops, from the agent or historian publication, are held until newer calls displace the result and a later cache-rebuilding pass applies them. The historian's summary is unaffected; the raw result leaves at the next fold. Frozen strips are unaffected. Changes and rotation never originate a bust; dropped results are never restored."),
|
|
5682
5690
|
caveman_text_compression: object({
|
|
5683
5691
|
enabled: boolean2().default(false).describe("Apply deterministic caveman-style text compression to old conversation text. Active for primary sessions when enabled; never for subagents. Compresses user/assistant text in oldest-first tiers: ultra (oldest 20%), full, lite, untouched (newest 40%)."),
|
|
5684
5692
|
min_chars: number2().min(100).max(1e4).default(500).describe("Text parts shorter than this (characters) stay untouched. Min 100, max 10000. Default: 500.")
|
|
@@ -5713,6 +5721,7 @@ var MagicContextConfigSchema = object({
|
|
|
5713
5721
|
};
|
|
5714
5722
|
});
|
|
5715
5723
|
var LIVE_RELOAD_CONFIG_PATHS = [
|
|
5724
|
+
"cache_ttl",
|
|
5716
5725
|
"mural.model",
|
|
5717
5726
|
"toast_duration_ms",
|
|
5718
5727
|
"historian.opencode.model",
|
|
@@ -5731,6 +5740,7 @@ var LIVE_RELOAD_CONFIG_PATHS = [
|
|
|
5731
5740
|
"commit_cluster_trigger.enabled",
|
|
5732
5741
|
"commit_cluster_trigger.min_clusters",
|
|
5733
5742
|
"memory.auto_promote",
|
|
5743
|
+
"dreamer.disable",
|
|
5734
5744
|
"dreamer.maxTokens",
|
|
5735
5745
|
"dreamer.opencode.model",
|
|
5736
5746
|
"dreamer.opencode.fallback_models",
|
|
@@ -8460,9 +8470,9 @@ async function acquireModelLoadLock(lockPath) {
|
|
|
8460
8470
|
const waitStart = Date.now();
|
|
8461
8471
|
while (true) {
|
|
8462
8472
|
try {
|
|
8463
|
-
const handle = await
|
|
8473
|
+
const handle = await createStorageFileHandleAsync(lockPath, "wx");
|
|
8464
8474
|
try {
|
|
8465
|
-
await handle
|
|
8475
|
+
await writeStorageFileHandleAsync(handle, `pid=${process.pid} started=${Date.now()}
|
|
8466
8476
|
`);
|
|
8467
8477
|
} catch {}
|
|
8468
8478
|
await handle.close();
|
|
@@ -8498,7 +8508,7 @@ async function acquireModelLoadLock(lockPath) {
|
|
|
8498
8508
|
function startLockHeartbeat(lockPath) {
|
|
8499
8509
|
const HEARTBEAT_MS = Math.floor(STALE_LOCK_MS / 3);
|
|
8500
8510
|
const timer = setInterval(() => {
|
|
8501
|
-
|
|
8511
|
+
writeStorageFileAsync(lockPath, `pid=${process.pid} alive=${Date.now()}
|
|
8502
8512
|
`).catch(() => {});
|
|
8503
8513
|
}, HEARTBEAT_MS);
|
|
8504
8514
|
timer.unref?.();
|
|
@@ -8861,16 +8871,7 @@ class LocalEmbeddingProvider {
|
|
|
8861
8871
|
}
|
|
8862
8872
|
const modelCacheDir = modelCacheDirForRuntime();
|
|
8863
8873
|
try {
|
|
8864
|
-
|
|
8865
|
-
mkdirSync(modelCacheDir, { recursive: true, mode: 448 });
|
|
8866
|
-
if (process.platform !== "win32") {
|
|
8867
|
-
try {
|
|
8868
|
-
chmodSync(modelCacheDir, 448);
|
|
8869
|
-
} catch {}
|
|
8870
|
-
}
|
|
8871
|
-
} else {
|
|
8872
|
-
mkdirSync(modelCacheDir, { recursive: true });
|
|
8873
|
-
}
|
|
8874
|
+
ensureStorageDirectorySync(modelCacheDir);
|
|
8874
8875
|
env.cacheDir = modelCacheDir;
|
|
8875
8876
|
} catch {
|
|
8876
8877
|
log("[magic-context] could not create model cache dir, using library default");
|
|
@@ -198,5 +198,13 @@ function closeQuietly(db) {
|
|
|
198
198
|
db.close();
|
|
199
199
|
} catch {}
|
|
200
200
|
}
|
|
201
|
+
function isKnownAutocommit(db) {
|
|
202
|
+
const state = db;
|
|
203
|
+
try {
|
|
204
|
+
return state.inTransaction === false || state.isTransaction === false;
|
|
205
|
+
} catch {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
201
209
|
|
|
202
|
-
export { resolveOpenCodeDbPath, hasV1MessageTables, assertOpenCodeStoreGeneration, openCodeDbPathExists, getOpenCodeDbProbeDescriptions, formatOpenCodeDbMissingBanner, formatOpenCodeDbMissingStatusLine, formatOpenCodeDbReadFailureStatusLine, recordOpenCodeDbReadFailure, clearOpenCodeDbReadFailure, getOpenCodeDbReadFailure, claimOpenCodeDbDiagnosticOnce, closeQuietly };
|
|
210
|
+
export { resolveOpenCodeDbPath, hasV1MessageTables, assertOpenCodeStoreGeneration, openCodeDbPathExists, getOpenCodeDbProbeDescriptions, formatOpenCodeDbMissingBanner, formatOpenCodeDbMissingStatusLine, formatOpenCodeDbReadFailureStatusLine, recordOpenCodeDbReadFailure, clearOpenCodeDbReadFailure, getOpenCodeDbReadFailure, claimOpenCodeDbDiagnosticOnce, closeQuietly, isKnownAutocommit };
|
|
@@ -169,6 +169,12 @@ function trackSqliteConnection(db, filename, options) {
|
|
|
169
169
|
...metadata,
|
|
170
170
|
reference: new WeakRef(db)
|
|
171
171
|
});
|
|
172
|
+
const prepare = db.prepare.bind(db);
|
|
173
|
+
Object.defineProperty(db, "prepare", {
|
|
174
|
+
configurable: true,
|
|
175
|
+
writable: true,
|
|
176
|
+
value: (sql) => ownPreparedStatement(db, prepare(sql))
|
|
177
|
+
});
|
|
172
178
|
return db;
|
|
173
179
|
}
|
|
174
180
|
var TrackedDatabase = new Proxy(DatabaseImpl, {
|
|
@@ -279,6 +285,54 @@ function getSqliteMemoryStats() {
|
|
|
279
285
|
connections
|
|
280
286
|
};
|
|
281
287
|
}
|
|
288
|
+
var statementOwners = new WeakMap;
|
|
289
|
+
var FIRST_PRUNE_AT = 256;
|
|
290
|
+
function ownPreparedStatement(db, statement) {
|
|
291
|
+
const finalizable = statement;
|
|
292
|
+
if (typeof finalizable.finalize !== "function")
|
|
293
|
+
return statement;
|
|
294
|
+
let owner = statementOwners.get(db);
|
|
295
|
+
if (!owner) {
|
|
296
|
+
const references = new Set;
|
|
297
|
+
owner = { references, registered: new WeakSet, pruneAt: FIRST_PRUNE_AT };
|
|
298
|
+
statementOwners.set(db, owner);
|
|
299
|
+
const close = db.close.bind(db);
|
|
300
|
+
Object.defineProperty(db, "close", {
|
|
301
|
+
configurable: true,
|
|
302
|
+
writable: true,
|
|
303
|
+
value: (...args) => {
|
|
304
|
+
let failure;
|
|
305
|
+
for (const reference of references) {
|
|
306
|
+
try {
|
|
307
|
+
reference.deref()?.finalize();
|
|
308
|
+
} catch (error) {
|
|
309
|
+
failure ??= error;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
references.clear();
|
|
313
|
+
const result = close(...args);
|
|
314
|
+
if (failure)
|
|
315
|
+
throw failure;
|
|
316
|
+
return result;
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
if (!owner.registered.has(finalizable)) {
|
|
321
|
+
if (owner.references.size >= owner.pruneAt) {
|
|
322
|
+
for (const reference of owner.references) {
|
|
323
|
+
if (reference.deref() === undefined)
|
|
324
|
+
owner.references.delete(reference);
|
|
325
|
+
}
|
|
326
|
+
owner.pruneAt = Math.max(FIRST_PRUNE_AT, owner.references.size * 2);
|
|
327
|
+
}
|
|
328
|
+
owner.references.add(new WeakRef(finalizable));
|
|
329
|
+
owner.registered.add(finalizable);
|
|
330
|
+
}
|
|
331
|
+
return statement;
|
|
332
|
+
}
|
|
333
|
+
function prepareCachedStatement(db, sql) {
|
|
334
|
+
return ownPreparedStatement(db, db.prepare(sql));
|
|
335
|
+
}
|
|
282
336
|
var privilegeDepth = new WeakMap;
|
|
283
337
|
var transformPassScope = new AsyncLocalStorage;
|
|
284
338
|
var admissionScope = new AsyncLocalStorage;
|
|
@@ -527,4 +581,4 @@ function withPrivilegedWriter(db, operation) {
|
|
|
527
581
|
}
|
|
528
582
|
}
|
|
529
583
|
|
|
530
|
-
export { registerSlowWriteReporter, registerSqliteDiagnosticSink, detectSqliteRuntime, Database, getSqliteMemoryStats, withSqliteBackgroundWriter, withSqliteTransformPass, withoutSqliteTransformPass, isTransientSqliteError, SqliteAcquisitionBusyError, beginSqliteWriterAsync, withAsyncPrivilegedWriter, withPrivilegedWriter };
|
|
584
|
+
export { registerSlowWriteReporter, registerSqliteDiagnosticSink, detectSqliteRuntime, Database, getSqliteMemoryStats, prepareCachedStatement, withSqliteBackgroundWriter, withSqliteTransformPass, withoutSqliteTransformPass, isTransientSqliteError, SqliteAcquisitionBusyError, beginSqliteWriterAsync, withAsyncPrivilegedWriter, withPrivilegedWriter };
|