@cortexkit/opencode-magic-context 0.45.0 → 0.46.0
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 +10 -4
- 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-8dkpszy5.js +4483 -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-75zjgwga.js → index-7qw742ev.js} +1 -1
- package/dist/{index-f85teqck.js → index-8da2zjhz.js} +3 -256
- package/dist/{index-w9jwmntv.js → index-b35pxds2.js} +9 -1
- package/dist/{index-8fgkmxmy.js → index-e2dtv0ra.js} +4 -3
- package/dist/{v2/server-a4m2b1yv.js → index-fg34g6a5.js} +55 -1
- package/dist/{index-xgt9k6c6.js → index-j7fvnjye.js} +2 -1
- package/dist/{index-2aq21j41.js → index-k4404na5.js} +418 -127
- package/dist/{index-2ntg5sd4.js → index-k5bdx1bx.js} +9 -5
- package/dist/{index-bmzf7zxv.js → index-majxda46.js} +23 -5
- package/dist/{index-16ny736w.js → index-p821bjdb.js} +14406 -13726
- package/dist/{index-remp7e2g.js → index-q4yp4b52.js} +16 -1
- package/dist/index-qr6r7akd.js +28505 -0
- package/dist/{index-fr2z4qy8.js → index-r5hmbx3t.js} +132 -169
- package/dist/index-sfnj6h8h.js +259 -0
- package/dist/index-sj29b3z2.js +30 -0
- package/dist/{index-q7yesyk9.js → index-yasgb8ej.js} +23 -24
- 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-ejq7ex5d.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-tz3pat2p.js} +15 -15
- package/dist/v2/context-8vgtb6sz.js +52166 -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/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/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/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-5xj0yzyk.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-4663ejam.js +3351 -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/{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-z19x7eqz.js → server-mcfawjgc.js} +4 -4
- package/dist/v2/server-p2en78c8.js +3892 -0
- package/dist/v2/{server-hfjfbg59.js → server-qp5hx1ad.js} +608 -105
- package/dist/v2/{server-c4g2y1z8.js → server-vnh7r35f.js} +2778 -5383
- package/dist/v2/server-vs5gpnd4.js +493 -0
- package/dist/v2/{server-w99cyt6a.js → server-wvjvfhck.js} +14 -6
- package/dist/v2/{server-v5xgft5v.js → server-xtp687da.js} +186 -3533
- 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-r5t1pyj8.js} +20 -16
- package/dist/wrapup-orchestrator-kw3x3myw.js +26 -0
- package/package.json +22 -7
- 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 +21 -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
package/src/tui/index.tsx
CHANGED
|
@@ -664,7 +664,9 @@ const tui: TuiPlugin = async (api, _options, meta) => {
|
|
|
664
664
|
}
|
|
665
665
|
|
|
666
666
|
initRpcClient(directory)
|
|
667
|
-
|
|
667
|
+
// RPC discovery can outlive the host's plugin-load deadline. Register the
|
|
668
|
+
// sidebar immediately; toast delivery still awaits its own current setting.
|
|
669
|
+
void refreshToastDurationMs()
|
|
668
670
|
|
|
669
671
|
// Register sidebar slot
|
|
670
672
|
const sidebarSlot = createSidebarContentSlot(api)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
|
|
4
|
+
test("TUI registration is not gated by toast RPC discovery in source or shipped copy", () => {
|
|
5
|
+
for (const path of ["./index.tsx", "../tui-compiled/index.tsx"]) {
|
|
6
|
+
const source = readFileSync(new URL(path, import.meta.url), "utf8");
|
|
7
|
+
const initialization = source.indexOf("initRpcClient(directory)");
|
|
8
|
+
expect(initialization).toBeGreaterThan(0);
|
|
9
|
+
const startup = source.slice(initialization);
|
|
10
|
+
const registration = startup.indexOf("api.slots.register(sidebarSlot)");
|
|
11
|
+
expect(registration).toBeGreaterThan(0);
|
|
12
|
+
const beforeRegistration = startup.slice(0, registration);
|
|
13
|
+
expect(beforeRegistration).toContain("void refreshToastDurationMs()");
|
|
14
|
+
expect(beforeRegistration).not.toContain("await refreshToastDurationMs()");
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -596,7 +596,9 @@ const tui = async (api, _options, meta) => {
|
|
|
596
596
|
return;
|
|
597
597
|
}
|
|
598
598
|
initRpcClient(directory);
|
|
599
|
-
|
|
599
|
+
// RPC discovery can outlive the host's plugin-load deadline. Register the
|
|
600
|
+
// sidebar immediately; toast delivery still awaits its own current setting.
|
|
601
|
+
void refreshToastDurationMs();
|
|
600
602
|
|
|
601
603
|
// Register sidebar slot
|
|
602
604
|
const sidebarSlot = createSidebarContentSlot(api);
|
package/src/v2/tui/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createElement, spread } from "@opentui/solid";
|
|
2
2
|
import { COMPACTION_ENABLED_PATH } from "../../config/agent-disable";
|
|
3
3
|
import { flushLogger, log } from "../../shared/logger";
|
|
4
4
|
import { pluginPackageVersion } from "../../shared/plugin-package-version";
|
|
@@ -575,7 +575,14 @@ export async function setupWithJsx(context: V2TuiContext, jsx: JsxFactory): Prom
|
|
|
575
575
|
}
|
|
576
576
|
|
|
577
577
|
export async function setup(context: V2TuiContext): Promise<() => void> {
|
|
578
|
-
|
|
578
|
+
// The host publishes @opentui/solid in its runtime registry, but not the
|
|
579
|
+
// jsx-runtime subpath. Use its renderer directly for the text fallback so
|
|
580
|
+
// an installed plugin does not need a private copy of OpenTUI.
|
|
581
|
+
return setupWithJsx(context, (type, props) => {
|
|
582
|
+
const element = createElement(type);
|
|
583
|
+
spread(element, props);
|
|
584
|
+
return element;
|
|
585
|
+
});
|
|
579
586
|
}
|
|
580
587
|
|
|
581
588
|
export default { id: "opencode-magic-context", setup };
|
package/dist/index-anq4nn6f.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
estimateTokens
|
|
3
|
-
} from "./index-gd5qx1j9.js";
|
|
4
|
-
|
|
5
|
-
// src/shared/stable-json.ts
|
|
6
|
-
function stableStringify(value, seen = new WeakSet) {
|
|
7
|
-
if (value === undefined)
|
|
8
|
-
return "undefined";
|
|
9
|
-
if (value === null || typeof value !== "object")
|
|
10
|
-
return JSON.stringify(value) ?? String(value);
|
|
11
|
-
if (seen.has(value))
|
|
12
|
-
return '"[Circular]"';
|
|
13
|
-
seen.add(value);
|
|
14
|
-
if (Array.isArray(value)) {
|
|
15
|
-
return `[${value.map((item) => stableStringify(item, seen)).join(",")}]`;
|
|
16
|
-
}
|
|
17
|
-
const entries = Object.entries(value).sort(([a], [b]) => {
|
|
18
|
-
if (a < b)
|
|
19
|
-
return -1;
|
|
20
|
-
if (a > b)
|
|
21
|
-
return 1;
|
|
22
|
-
return 0;
|
|
23
|
-
});
|
|
24
|
-
return `{${entries.map(([key, child]) => `${JSON.stringify(key)}:${stableStringify(child, seen)}`).join(",")}}`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// src/features/magic-context/tool-definition-tokens.ts
|
|
28
|
-
import { createHash } from "node:crypto";
|
|
29
|
-
var measurements = new Map;
|
|
30
|
-
var fingerprints = new Map;
|
|
31
|
-
var persistenceDb = null;
|
|
32
|
-
var cachedInsertStmt = null;
|
|
33
|
-
function keyFor(providerID, modelID, agentName) {
|
|
34
|
-
const agent = agentName && agentName.length > 0 ? agentName : "default";
|
|
35
|
-
return `${providerID}/${modelID}/${agent}`;
|
|
36
|
-
}
|
|
37
|
-
function fingerprintFor(description, parameters) {
|
|
38
|
-
return createHash("sha256").update(description).update("\x00").update(stableStringify(parameters)).digest("hex");
|
|
39
|
-
}
|
|
40
|
-
function getCurrentToolSetHash(providerID, modelID, agentName) {
|
|
41
|
-
if (!providerID || !modelID)
|
|
42
|
-
return "";
|
|
43
|
-
const toolIds = measurements.get(keyFor(providerID, modelID, agentName));
|
|
44
|
-
if (!toolIds || toolIds.size === 0)
|
|
45
|
-
return "";
|
|
46
|
-
return createHash("sha256").update(Array.from(toolIds.keys()).sort().join("\x00")).digest("hex");
|
|
47
|
-
}
|
|
48
|
-
function setDatabase(db) {
|
|
49
|
-
persistenceDb = db;
|
|
50
|
-
cachedInsertStmt = null;
|
|
51
|
-
}
|
|
52
|
-
function loadToolDefinitionMeasurements(db) {
|
|
53
|
-
let rows = [];
|
|
54
|
-
try {
|
|
55
|
-
rows = db.prepare("SELECT provider_id, model_id, agent_name, tool_id, token_count FROM tool_definition_measurements").all();
|
|
56
|
-
} catch {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
for (const row of rows) {
|
|
60
|
-
const key = keyFor(row.provider_id, row.model_id, row.agent_name);
|
|
61
|
-
let inner = measurements.get(key);
|
|
62
|
-
if (!inner) {
|
|
63
|
-
inner = new Map;
|
|
64
|
-
measurements.set(key, inner);
|
|
65
|
-
}
|
|
66
|
-
inner.set(row.tool_id, row.token_count);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function recordToolDefinition(providerID, modelID, agentName, toolID, description, parameters) {
|
|
70
|
-
if (!providerID || !modelID || !toolID)
|
|
71
|
-
return;
|
|
72
|
-
const key = keyFor(providerID, modelID, agentName);
|
|
73
|
-
const fp = fingerprintFor(description ?? "", parameters);
|
|
74
|
-
let innerFp = fingerprints.get(key);
|
|
75
|
-
if (innerFp && innerFp.get(toolID) === fp)
|
|
76
|
-
return;
|
|
77
|
-
let paramsText = "";
|
|
78
|
-
try {
|
|
79
|
-
paramsText = parameters === undefined ? "" : JSON.stringify(parameters);
|
|
80
|
-
} catch {
|
|
81
|
-
paramsText = "";
|
|
82
|
-
}
|
|
83
|
-
const tokens = estimateTokens(description ?? "") + estimateTokens(paramsText);
|
|
84
|
-
let inner = measurements.get(key);
|
|
85
|
-
if (!inner) {
|
|
86
|
-
inner = new Map;
|
|
87
|
-
measurements.set(key, inner);
|
|
88
|
-
}
|
|
89
|
-
inner.set(toolID, tokens);
|
|
90
|
-
if (!innerFp) {
|
|
91
|
-
innerFp = new Map;
|
|
92
|
-
fingerprints.set(key, innerFp);
|
|
93
|
-
}
|
|
94
|
-
innerFp.set(toolID, fp);
|
|
95
|
-
if (persistenceDb) {
|
|
96
|
-
try {
|
|
97
|
-
const agent = agentName && agentName.length > 0 ? agentName : "default";
|
|
98
|
-
if (!cachedInsertStmt) {
|
|
99
|
-
cachedInsertStmt = persistenceDb.prepare(`INSERT OR REPLACE INTO tool_definition_measurements
|
|
100
|
-
(provider_id, model_id, agent_name, tool_id, token_count, recorded_at)
|
|
101
|
-
VALUES (?, ?, ?, ?, ?, ?)`);
|
|
102
|
-
}
|
|
103
|
-
cachedInsertStmt.run(providerID, modelID, agent, toolID, tokens, Date.now());
|
|
104
|
-
} catch {
|
|
105
|
-
cachedInsertStmt = null;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function getLargestMeasuredToolDefinitionTokens() {
|
|
110
|
-
let largest = 0;
|
|
111
|
-
for (const tools of measurements.values()) {
|
|
112
|
-
let total = 0;
|
|
113
|
-
for (const tokens of tools.values())
|
|
114
|
-
total += tokens;
|
|
115
|
-
largest = Math.max(largest, total);
|
|
116
|
-
}
|
|
117
|
-
return largest > 0 ? largest : undefined;
|
|
118
|
-
}
|
|
119
|
-
function getMeasuredToolDefinitionTokens(providerID, modelID, agentName) {
|
|
120
|
-
if (!providerID || !modelID)
|
|
121
|
-
return;
|
|
122
|
-
const inner = measurements.get(keyFor(providerID, modelID, agentName));
|
|
123
|
-
if (!inner || inner.size === 0)
|
|
124
|
-
return;
|
|
125
|
-
let total = 0;
|
|
126
|
-
for (const tokens of inner.values())
|
|
127
|
-
total += tokens;
|
|
128
|
-
return total;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export { stableStringify, getCurrentToolSetHash, setDatabase, loadToolDefinitionMeasurements, recordToolDefinition, getLargestMeasuredToolDefinitionTokens, getMeasuredToolDefinitionTokens };
|
package/dist/index-e44zzy84.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// src/shared/storage-permissions.ts
|
|
2
|
-
var enforcePrivateStoragePermissions = true;
|
|
3
|
-
function setStoragePrivatePermissionEnforcement(enforce) {
|
|
4
|
-
enforcePrivateStoragePermissions = enforce;
|
|
5
|
-
}
|
|
6
|
-
function shouldEnforcePrivateStoragePermissions() {
|
|
7
|
-
return enforcePrivateStoragePermissions;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { setStoragePrivatePermissionEnforcement, shouldEnforcePrivateStoragePermissions };
|
package/dist/index-x23gah8c.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
log
|
|
3
|
-
} from "./index-hybnrwq0.js";
|
|
4
|
-
|
|
5
|
-
// src/shared/write-transaction-timing.ts
|
|
6
|
-
var SLOW_WRITE_TRANSACTION_THRESHOLD_MS = 1000;
|
|
7
|
-
function logSlowWriteTransaction(site, startedAt, thresholdMs = SLOW_WRITE_TRANSACTION_THRESHOLD_MS, completedAtMs = performance.now()) {
|
|
8
|
-
try {
|
|
9
|
-
const durationMs = completedAtMs - startedAt;
|
|
10
|
-
if (durationMs < thresholdMs)
|
|
11
|
-
return;
|
|
12
|
-
log(`[magic-context] slow write transaction: site=${site} held=${durationMs.toFixed(1)}ms`);
|
|
13
|
-
} catch {}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { logSlowWriteTransaction };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isRecompFailure2,
|
|
3
|
-
isRecompSkip2,
|
|
4
|
-
extractRecompReason2,
|
|
5
|
-
setRecompStarting2,
|
|
6
|
-
setRecompNote2,
|
|
7
|
-
setRecompTerminal2,
|
|
8
|
-
buildRecompDeps2,
|
|
9
|
-
runManagedRecomp2
|
|
10
|
-
} from "./server-c4g2y1z8.js";
|
|
11
|
-
import"./server-z19x7eqz.js";
|
|
12
|
-
import"./server-0jqw05sa.js";
|
|
13
|
-
import"./server-v5xgft5v.js";
|
|
14
|
-
import"./server-e36nf2p1.js";
|
|
15
|
-
import"./server-hfjfbg59.js";
|
|
16
|
-
import"./server-w99cyt6a.js";
|
|
17
|
-
import"./server-n96ag4rk.js";
|
|
18
|
-
import"./server-remp7e2g.js";
|
|
19
|
-
import"./server-r7cmye3k.js";
|
|
20
|
-
import"./server-qpg6wf72.js";
|
|
21
|
-
import"./server-rhdgxp1t.js";
|
|
22
|
-
import"./server-fgmxwrgy.js";
|
|
23
|
-
import"./server-a4m2b1yv.js";
|
|
24
|
-
import"./server-x8a7jmkh.js";
|
|
25
|
-
import"./server-5317ykaf.js";
|
|
26
|
-
import"./server-ckpc8pxy.js";
|
|
27
|
-
export {
|
|
28
|
-
buildRecompDeps2 as buildRecompDeps,
|
|
29
|
-
extractRecompReason2 as extractRecompReason,
|
|
30
|
-
isRecompFailure2 as isRecompFailure,
|
|
31
|
-
isRecompSkip2 as isRecompSkip,
|
|
32
|
-
runManagedRecomp2 as runManagedRecomp,
|
|
33
|
-
setRecompNote2 as setRecompNote,
|
|
34
|
-
setRecompStarting2 as setRecompStarting,
|
|
35
|
-
setRecompTerminal2 as setRecompTerminal
|
|
36
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// src/shared/storage-permissions.ts
|
|
2
|
-
var enforcePrivateStoragePermissions = true;
|
|
3
|
-
function setStoragePrivatePermissionEnforcement(enforce) {
|
|
4
|
-
enforcePrivateStoragePermissions = enforce;
|
|
5
|
-
}
|
|
6
|
-
function shouldEnforcePrivateStoragePermissions() {
|
|
7
|
-
return enforcePrivateStoragePermissions;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { setStoragePrivatePermissionEnforcement, shouldEnforcePrivateStoragePermissions };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
log
|
|
3
|
-
} from "./server-ckpc8pxy.js";
|
|
4
|
-
|
|
5
|
-
// src/shared/write-transaction-timing.ts
|
|
6
|
-
var SLOW_WRITE_TRANSACTION_THRESHOLD_MS = 1000;
|
|
7
|
-
function logSlowWriteTransaction(site, startedAt, thresholdMs = SLOW_WRITE_TRANSACTION_THRESHOLD_MS, completedAtMs = performance.now()) {
|
|
8
|
-
try {
|
|
9
|
-
const durationMs = completedAtMs - startedAt;
|
|
10
|
-
if (durationMs < thresholdMs)
|
|
11
|
-
return;
|
|
12
|
-
log(`[magic-context] slow write transaction: site=${site} held=${durationMs.toFixed(1)}ms`);
|
|
13
|
-
} catch {}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { logSlowWriteTransaction };
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
estimateTokens
|
|
3
|
-
} from "./server-rhdgxp1t.js";
|
|
4
|
-
|
|
5
|
-
// src/shared/stable-json.ts
|
|
6
|
-
function stableStringify(value, seen = new WeakSet) {
|
|
7
|
-
if (value === undefined)
|
|
8
|
-
return "undefined";
|
|
9
|
-
if (value === null || typeof value !== "object")
|
|
10
|
-
return JSON.stringify(value) ?? String(value);
|
|
11
|
-
if (seen.has(value))
|
|
12
|
-
return '"[Circular]"';
|
|
13
|
-
seen.add(value);
|
|
14
|
-
if (Array.isArray(value)) {
|
|
15
|
-
return `[${value.map((item) => stableStringify(item, seen)).join(",")}]`;
|
|
16
|
-
}
|
|
17
|
-
const entries = Object.entries(value).sort(([a], [b]) => {
|
|
18
|
-
if (a < b)
|
|
19
|
-
return -1;
|
|
20
|
-
if (a > b)
|
|
21
|
-
return 1;
|
|
22
|
-
return 0;
|
|
23
|
-
});
|
|
24
|
-
return `{${entries.map(([key, child]) => `${JSON.stringify(key)}:${stableStringify(child, seen)}`).join(",")}}`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// src/features/magic-context/tool-definition-tokens.ts
|
|
28
|
-
import { createHash } from "node:crypto";
|
|
29
|
-
var measurements = new Map;
|
|
30
|
-
var fingerprints = new Map;
|
|
31
|
-
var persistenceDb = null;
|
|
32
|
-
var cachedInsertStmt = null;
|
|
33
|
-
function keyFor(providerID, modelID, agentName) {
|
|
34
|
-
const agent = agentName && agentName.length > 0 ? agentName : "default";
|
|
35
|
-
return `${providerID}/${modelID}/${agent}`;
|
|
36
|
-
}
|
|
37
|
-
function fingerprintFor(description, parameters) {
|
|
38
|
-
return createHash("sha256").update(description).update("\x00").update(stableStringify(parameters)).digest("hex");
|
|
39
|
-
}
|
|
40
|
-
function getCurrentToolSetHash(providerID, modelID, agentName) {
|
|
41
|
-
if (!providerID || !modelID)
|
|
42
|
-
return "";
|
|
43
|
-
const toolIds = measurements.get(keyFor(providerID, modelID, agentName));
|
|
44
|
-
if (!toolIds || toolIds.size === 0)
|
|
45
|
-
return "";
|
|
46
|
-
return createHash("sha256").update(Array.from(toolIds.keys()).sort().join("\x00")).digest("hex");
|
|
47
|
-
}
|
|
48
|
-
function setDatabase(db) {
|
|
49
|
-
persistenceDb = db;
|
|
50
|
-
cachedInsertStmt = null;
|
|
51
|
-
}
|
|
52
|
-
function loadToolDefinitionMeasurements(db) {
|
|
53
|
-
let rows = [];
|
|
54
|
-
try {
|
|
55
|
-
rows = db.prepare("SELECT provider_id, model_id, agent_name, tool_id, token_count FROM tool_definition_measurements").all();
|
|
56
|
-
} catch {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
for (const row of rows) {
|
|
60
|
-
const key = keyFor(row.provider_id, row.model_id, row.agent_name);
|
|
61
|
-
let inner = measurements.get(key);
|
|
62
|
-
if (!inner) {
|
|
63
|
-
inner = new Map;
|
|
64
|
-
measurements.set(key, inner);
|
|
65
|
-
}
|
|
66
|
-
inner.set(row.tool_id, row.token_count);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function recordToolDefinition(providerID, modelID, agentName, toolID, description, parameters) {
|
|
70
|
-
if (!providerID || !modelID || !toolID)
|
|
71
|
-
return;
|
|
72
|
-
const key = keyFor(providerID, modelID, agentName);
|
|
73
|
-
const fp = fingerprintFor(description ?? "", parameters);
|
|
74
|
-
let innerFp = fingerprints.get(key);
|
|
75
|
-
if (innerFp && innerFp.get(toolID) === fp)
|
|
76
|
-
return;
|
|
77
|
-
let paramsText = "";
|
|
78
|
-
try {
|
|
79
|
-
paramsText = parameters === undefined ? "" : JSON.stringify(parameters);
|
|
80
|
-
} catch {
|
|
81
|
-
paramsText = "";
|
|
82
|
-
}
|
|
83
|
-
const tokens = estimateTokens(description ?? "") + estimateTokens(paramsText);
|
|
84
|
-
let inner = measurements.get(key);
|
|
85
|
-
if (!inner) {
|
|
86
|
-
inner = new Map;
|
|
87
|
-
measurements.set(key, inner);
|
|
88
|
-
}
|
|
89
|
-
inner.set(toolID, tokens);
|
|
90
|
-
if (!innerFp) {
|
|
91
|
-
innerFp = new Map;
|
|
92
|
-
fingerprints.set(key, innerFp);
|
|
93
|
-
}
|
|
94
|
-
innerFp.set(toolID, fp);
|
|
95
|
-
if (persistenceDb) {
|
|
96
|
-
try {
|
|
97
|
-
const agent = agentName && agentName.length > 0 ? agentName : "default";
|
|
98
|
-
if (!cachedInsertStmt) {
|
|
99
|
-
cachedInsertStmt = persistenceDb.prepare(`INSERT OR REPLACE INTO tool_definition_measurements
|
|
100
|
-
(provider_id, model_id, agent_name, tool_id, token_count, recorded_at)
|
|
101
|
-
VALUES (?, ?, ?, ?, ?, ?)`);
|
|
102
|
-
}
|
|
103
|
-
cachedInsertStmt.run(providerID, modelID, agent, toolID, tokens, Date.now());
|
|
104
|
-
} catch {
|
|
105
|
-
cachedInsertStmt = null;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function getLargestMeasuredToolDefinitionTokens() {
|
|
110
|
-
let largest = 0;
|
|
111
|
-
for (const tools of measurements.values()) {
|
|
112
|
-
let total = 0;
|
|
113
|
-
for (const tokens of tools.values())
|
|
114
|
-
total += tokens;
|
|
115
|
-
largest = Math.max(largest, total);
|
|
116
|
-
}
|
|
117
|
-
return largest > 0 ? largest : undefined;
|
|
118
|
-
}
|
|
119
|
-
function getMeasuredToolDefinitionTokens(providerID, modelID, agentName) {
|
|
120
|
-
if (!providerID || !modelID)
|
|
121
|
-
return;
|
|
122
|
-
const inner = measurements.get(keyFor(providerID, modelID, agentName));
|
|
123
|
-
if (!inner || inner.size === 0)
|
|
124
|
-
return;
|
|
125
|
-
let total = 0;
|
|
126
|
-
for (const tokens of inner.values())
|
|
127
|
-
total += tokens;
|
|
128
|
-
return total;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export { stableStringify, getCurrentToolSetHash, setDatabase, loadToolDefinitionMeasurements, recordToolDefinition, getLargestMeasuredToolDefinitionTokens, getMeasuredToolDefinitionTokens };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
runManagedWrapup2
|
|
3
|
-
} from "./index-8fgkmxmy.js";
|
|
4
|
-
import"./index-xgt9k6c6.js";
|
|
5
|
-
import"./index-16ny736w.js";
|
|
6
|
-
import"./index-sd3egckz.js";
|
|
7
|
-
import"./index-75zjgwga.js";
|
|
8
|
-
import"./index-vvtfyw1z.js";
|
|
9
|
-
import"./index-q7yesyk9.js";
|
|
10
|
-
import"./index-fr2z4qy8.js";
|
|
11
|
-
import"./index-4krbw8z9.js";
|
|
12
|
-
import"./index-bmzf7zxv.js";
|
|
13
|
-
import"./index-n96ag4rk.js";
|
|
14
|
-
import"./index-remp7e2g.js";
|
|
15
|
-
import"./index-anq4nn6f.js";
|
|
16
|
-
import"./index-w9jwmntv.js";
|
|
17
|
-
import"./index-gd5qx1j9.js";
|
|
18
|
-
import"./index-x23gah8c.js";
|
|
19
|
-
import"./index-a4m2b1yv.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
|
-
};
|
|
@@ -15,14 +15,6 @@ function harnessOwnsOpenCodeStore(harness = currentHarness) {
|
|
|
15
15
|
return harness === "opencode" || harness === "opencode2";
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
// src/shared/stale-plugin-build.ts
|
|
19
|
-
import { posix } from "node:path";
|
|
20
|
-
import { fileURLToPath } from "node:url";
|
|
21
|
-
|
|
22
|
-
// src/shared/logger.ts
|
|
23
|
-
import * as fs from "node:fs";
|
|
24
|
-
import * as path2 from "node:path";
|
|
25
|
-
|
|
26
18
|
// src/shared/data-path.ts
|
|
27
19
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
28
20
|
import * as os from "node:os";
|
|
@@ -120,6 +112,14 @@ function getLegacyOpenCodeMagicContextStorageDir() {
|
|
|
120
112
|
return path.join(getOpenCodeStorageDir(), "plugin", "magic-context");
|
|
121
113
|
}
|
|
122
114
|
|
|
115
|
+
// src/shared/stale-plugin-build.ts
|
|
116
|
+
import { posix } from "node:path";
|
|
117
|
+
import { fileURLToPath } from "node:url";
|
|
118
|
+
|
|
119
|
+
// src/shared/logger.ts
|
|
120
|
+
import * as fs from "node:fs";
|
|
121
|
+
import * as path2 from "node:path";
|
|
122
|
+
|
|
123
123
|
// src/shared/redaction.ts
|
|
124
124
|
import { homedir as homedir2, userInfo } from "node:os";
|
|
125
125
|
function escapeRegex(value) {
|