@cortexkit/opencode-magic-context 0.41.3 → 0.42.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 +21 -3
- package/dist/agents/hidden-agent-registrations.d.ts +1 -3
- package/dist/agents/hidden-agent-registrations.d.ts.map +1 -1
- package/dist/agents/magic-context-prompt.d.ts +1 -1
- package/dist/agents/magic-context-prompt.d.ts.map +1 -1
- package/dist/agents/permissions.d.ts +1 -22
- package/dist/agents/permissions.d.ts.map +1 -1
- package/dist/config/agent-disable.d.ts +0 -5
- package/dist/config/agent-disable.d.ts.map +1 -1
- package/dist/config/index.d.ts +14 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/migrate-config-location.d.ts.map +1 -1
- package/dist/config/project-security.d.ts +17 -0
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/removed-agent-config.d.ts +8 -0
- package/dist/config/removed-agent-config.d.ts.map +1 -0
- package/dist/config/schema/magic-context.d.ts +23 -201
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-z5sd697e.js → conflict-warning-hook-6p3xqeac.js} +4 -4
- package/dist/{derive-budgets-901a0pk0.js → derive-budgets-s2pgnnm4.js} +4 -2
- package/dist/features/builtin-commands/commands.d.ts +0 -4
- package/dist/features/builtin-commands/commands.d.ts.map +1 -1
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +7 -0
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
- package/dist/features/magic-context/context-authority.d.ts +31 -4
- package/dist/features/magic-context/context-authority.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/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/open-opencode-db.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts +19 -9
- package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts +13 -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.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +7 -0
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/fail-closed-block.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/sweep-coordinator.d.ts.map +1 -1
- package/dist/features/magic-context/index.d.ts +0 -1
- package/dist/features/magic-context/index.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-local.d.ts +13 -0
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-synapse.d.ts +43 -10
- package/dist/features/magic-context/memory/embedding-synapse.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding.d.ts +1 -1
- package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
- package/dist/features/magic-context/memory/memory-migration.d.ts.map +1 -1
- package/dist/features/magic-context/memory/project-identity.d.ts +1 -0
- package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/promotion.d.ts +7 -1
- package/dist/features/magic-context/memory/promotion.d.ts.map +1 -1
- package/dist/features/magic-context/merged-reasoning-decisions.d.ts +6 -0
- package/dist/features/magic-context/merged-reasoning-decisions.d.ts.map +1 -0
- package/dist/features/magic-context/message-fts-rowid-map.d.ts.map +1 -1
- package/dist/features/magic-context/message-index-async.d.ts +12 -0
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
- package/dist/features/magic-context/mural/render-trigger.d.ts +6 -0
- package/dist/features/magic-context/mural/render-trigger.d.ts.map +1 -1
- package/dist/features/magic-context/no-content-compartment.d.ts +12 -0
- package/dist/features/magic-context/no-content-compartment.d.ts.map +1 -0
- package/dist/features/magic-context/pi-content-decisions.d.ts +9 -0
- package/dist/features/magic-context/pi-content-decisions.d.ts.map +1 -0
- package/dist/features/magic-context/project-docs-hash.d.ts +4 -0
- package/dist/features/magic-context/project-docs-hash.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +13 -4
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/protection-window.d.ts +79 -0
- package/dist/features/magic-context/protection-window.d.ts.map +1 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/session-project-backfill.d.ts.map +1 -1
- package/dist/features/magic-context/shadow-backfill-state.d.ts +26 -0
- package/dist/features/magic-context/shadow-backfill-state.d.ts.map +1 -0
- package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts +4 -0
- package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/storage.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 +1 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-embedding-measurements.d.ts +2 -2
- package/dist/features/magic-context/storage-embedding-measurements.d.ts.map +1 -1
- package/dist/features/magic-context/storage-historian-runs.d.ts +4 -0
- package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -1
- package/dist/features/magic-context/storage-memory-mutation-log.d.ts +1 -0
- package/dist/features/magic-context/storage-memory-mutation-log.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +81 -15
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta.d.ts +1 -1
- package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
- package/dist/features/magic-context/storage-native-replay.d.ts +29 -0
- package/dist/features/magic-context/storage-native-replay.d.ts.map +1 -0
- package/dist/features/magic-context/storage-notes.d.ts +6 -0
- package/dist/features/magic-context/storage-notes.d.ts.map +1 -1
- package/dist/features/magic-context/storage-replay-document.d.ts +33 -0
- package/dist/features/magic-context/storage-replay-document.d.ts.map +1 -0
- package/dist/features/magic-context/storage-subagent-invocations.d.ts +1 -1
- package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +19 -11
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +3 -3
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
- package/dist/features/magic-context/tagger.d.ts +13 -0
- package/dist/features/magic-context/tagger.d.ts.map +1 -1
- package/dist/features/magic-context/tool-owner-backfill.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -1
- package/dist/features/magic-context/workspaces.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts +11 -5
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +9 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
- package/dist/hooks/magic-context/caveman-cleanup.d.ts +1 -1
- package/dist/hooks/magic-context/caveman-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/channel2-delivery.d.ts.map +1 -1
- package/dist/hooks/magic-context/child-session-spawn.d.ts +3 -3
- package/dist/hooks/magic-context/child-session-spawn.d.ts.map +1 -1
- package/dist/hooks/magic-context/command-handler.d.ts +5 -10
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts +10 -21
- 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-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +4 -0
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts +26 -2
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts.map +1 -1
- package/dist/hooks/magic-context/decay-render.d.ts.map +1 -1
- package/dist/hooks/magic-context/derive-budgets.d.ts +1 -0
- package/dist/hooks/magic-context/derive-budgets.d.ts.map +1 -1
- package/dist/hooks/magic-context/dropped-input-guard.d.ts +9 -0
- package/dist/hooks/magic-context/dropped-input-guard.d.ts.map +1 -0
- package/dist/hooks/magic-context/emergency-drop.d.ts +9 -2
- package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts +0 -1
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-payloads.d.ts +7 -6
- package/dist/hooks/magic-context/event-payloads.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/execute-status.d.ts +8 -2
- package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/format-embed-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts +11 -4
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook-handlers.d.ts +5 -1
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +17 -5
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +14 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/issue-423-fixture.d.ts +37 -0
- package/dist/hooks/magic-context/issue-423-fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/issue-424-fixture.d.ts +11 -0
- package/dist/hooks/magic-context/issue-424-fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/live-session-state.d.ts +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts +34 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-state-sync-timing.d.ts +21 -0
- package/dist/hooks/magic-context/module-state-sync-timing.d.ts.map +1 -0
- package/dist/hooks/magic-context/module-state-sync.d.ts +21 -7
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts +12 -0
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-wire.d.ts +8 -0
- package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
- package/dist/hooks/magic-context/note-nudger.d.ts.map +1 -1
- package/dist/hooks/magic-context/persist-filtered-noise.d.ts +5 -0
- package/dist/hooks/magic-context/persist-filtered-noise.d.ts.map +1 -0
- package/dist/hooks/magic-context/producer-window-guard.d.ts +8 -0
- package/dist/hooks/magic-context/producer-window-guard.d.ts.map +1 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +65 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +20 -18
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +22 -12
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-formatting.d.ts +8 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +10 -1
- 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 +4 -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.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +79 -11
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts +11 -10
- package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
- package/dist/hooks/magic-context/sentinel.d.ts +3 -3
- package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
- package/dist/hooks/magic-context/strip-content.d.ts +7 -0
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/supersession-reclaim.d.ts +13 -0
- package/dist/hooks/magic-context/supersession-reclaim.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +2 -3
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +2 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +16 -6
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts +1 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +2 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts +7 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +11 -4
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +11 -2
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/upgrade-reminder.d.ts +7 -9
- package/dist/hooks/magic-context/upgrade-reminder.d.ts.map +1 -1
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
- package/dist/index-1974jvn3.js +783 -0
- package/dist/{index-npx8vhmy.js → index-36wd1d6k.js} +7 -30
- package/dist/{index-kby1sng5.js → index-avwt563y.js} +8 -1
- package/dist/{index-vmmjdpc0.js → index-c9hamh36.js} +18357 -16010
- package/dist/{index-0bycg0np.js → index-jmtjh2d3.js} +4 -4
- package/dist/{index-q264erdp.js → index-nqgjwfzn.js} +70 -38
- package/dist/index-sd3egckz.js +1583 -0
- package/dist/{index-dn1rwpd8.js → index-xdtge3y2.js} +58 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6826 -6660
- package/dist/plugin/conflict-warning-hook.d.ts +5 -6
- package/dist/plugin/conflict-warning-hook.d.ts.map +1 -1
- package/dist/plugin/dream-timer.d.ts +1 -0
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/embedding-routing.d.ts +4 -1
- package/dist/plugin/embedding-routing.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +19 -2
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts +31 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/plugin/rust-tool-backends.d.ts +1 -0
- package/dist/plugin/rust-tool-backends.d.ts.map +1 -1
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/{recomp-orchestrator-f5m2wk74.js → recomp-orchestrator-3atsasjy.js} +6 -6
- package/dist/{send-session-notification-hdh02wy9.js → send-session-notification-1qeqkswb.js} +6 -4
- package/dist/shared/cache-ttl-display.d.ts +23 -0
- package/dist/shared/cache-ttl-display.d.ts.map +1 -0
- package/dist/shared/cache-ttl-seed.d.ts +10 -0
- package/dist/shared/cache-ttl-seed.d.ts.map +1 -0
- package/dist/shared/child-session-teardown.d.ts +34 -0
- package/dist/shared/child-session-teardown.d.ts.map +1 -0
- package/dist/shared/config-diagnostics.d.ts +30 -0
- package/dist/shared/config-diagnostics.d.ts.map +1 -0
- package/dist/shared/config-warning-surface.d.ts +3 -0
- package/dist/shared/config-warning-surface.d.ts.map +1 -0
- package/dist/shared/data-path.d.ts +10 -9
- package/dist/shared/data-path.d.ts.map +1 -1
- package/dist/shared/harness-provider-map.d.ts +7 -0
- package/dist/shared/harness-provider-map.d.ts.map +1 -1
- package/dist/shared/jsonc-parser.d.ts +12 -0
- package/dist/shared/jsonc-parser.d.ts.map +1 -1
- package/dist/shared/keep-subagents.d.ts +1 -1
- package/dist/shared/keep-subagents.d.ts.map +1 -1
- package/dist/shared/model-suggestion-retry.d.ts +15 -11
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/opencode-db-path.d.ts +24 -0
- package/dist/shared/opencode-db-path.d.ts.map +1 -0
- package/dist/shared/pi-executable.d.ts +6 -0
- package/dist/shared/pi-executable.d.ts.map +1 -0
- package/dist/shared/prompt-surface-runtime.d.ts +10 -5
- package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
- package/dist/shared/resolve-fallbacks.d.ts +1 -1
- package/dist/shared/rpc-types.d.ts +117 -0
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/rpc-utils.d.ts.map +1 -1
- package/dist/shared/sqlite.d.ts +42 -0
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/status-detail-text.d.ts.map +1 -1
- package/dist/shared/subagent-runner.d.ts +17 -10
- package/dist/shared/subagent-runner.d.ts.map +1 -1
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/shared/transcript.d.ts +6 -0
- package/dist/shared/transcript.d.ts.map +1 -1
- package/dist/shared/window-geometry.d.ts +23 -0
- package/dist/shared/window-geometry.d.ts.map +1 -1
- package/dist/shared/write-transaction-timing.d.ts +1 -1
- package/dist/shared/write-transaction-timing.d.ts.map +1 -1
- package/dist/{storage-meta-session-3rxx9ekm.js → storage-meta-session-e6g0mmec.js} +2 -2
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/tools/ctx-memory/verification-recording.d.ts.map +1 -1
- package/dist/tools/ctx-note/constants.d.ts +1 -1
- package/dist/tools/ctx-note/constants.d.ts.map +1 -1
- package/dist/tools/ctx-note/tools.d.ts.map +1 -1
- package/dist/tools/ctx-note/types.d.ts +1 -0
- package/dist/tools/ctx-note/types.d.ts.map +1 -1
- package/dist/tools/ctx-reduce/tools.d.ts +10 -1
- package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
- package/dist/tools/ctx-search/constants.d.ts +1 -1
- package/dist/tools/ctx-search/constants.d.ts.map +1 -1
- package/dist/tools/light-descriptions.d.ts +2 -2
- package/dist/tools/light-descriptions.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/agents/hidden-agent-registrations.ts +3 -15
- package/src/agents/magic-context-prompt.test.ts +7 -5
- package/src/agents/magic-context-prompt.ts +22 -30
- package/src/agents/permissions.test.ts +1 -42
- package/src/agents/permissions.ts +1 -24
- package/src/config/agent-disable.ts +5 -22
- package/src/config/index.test.ts +169 -14
- package/src/config/index.ts +137 -21
- package/src/config/latch-permanence-guard.test.ts +4 -0
- package/src/config/migrate-config-location.test.ts +39 -6
- package/src/config/migrate-config-location.ts +18 -31
- package/src/config/profiles.ts +1 -1
- package/src/config/project-security.hostile-matrix.test.ts +0 -8
- package/src/config/project-security.test.ts +11 -22
- package/src/config/project-security.ts +103 -9
- package/src/config/protected-tokens.test.ts +235 -0
- package/src/config/removed-agent-config.ts +45 -0
- package/src/config/removed-agent-source-fence.test.ts +56 -0
- package/src/config/schema/magic-context.test.ts +21 -42
- package/src/config/schema/magic-context.ts +46 -37
- package/src/shared/cache-ttl-display.test.ts +84 -0
- package/src/shared/cache-ttl-display.ts +64 -0
- package/src/shared/cache-ttl-seed.ts +23 -0
- package/src/shared/child-session-teardown.test.ts +218 -0
- package/src/shared/child-session-teardown.ts +66 -0
- package/src/shared/config-diagnostics.test.ts +29 -0
- package/src/shared/config-diagnostics.ts +64 -0
- package/src/shared/config-warning-surface.ts +28 -0
- package/src/shared/data-path.ts +10 -9
- package/src/shared/harness-provider-map.test.ts +16 -0
- package/src/shared/harness-provider-map.ts +15 -0
- package/src/shared/jsonc-parser.test.ts +14 -1
- package/src/shared/jsonc-parser.ts +93 -0
- package/src/shared/keep-subagents.ts +9 -14
- package/src/shared/model-suggestion-retry.ts +144 -29
- package/src/shared/opencode-db-path.test.ts +196 -0
- package/src/shared/opencode-db-path.ts +215 -0
- package/src/shared/pi-executable.ts +20 -0
- package/src/shared/prompt-surface-a1-golden.md +50 -35
- package/src/shared/prompt-surface-runtime.test.ts +28 -0
- package/src/shared/prompt-surface-runtime.ts +22 -5
- package/src/shared/resolve-fallbacks.ts +1 -1
- package/src/shared/rpc-types.ts +124 -0
- package/src/shared/rpc-utils.ts +2 -3
- package/src/shared/session-messages-bounded.test.ts +1 -1
- package/src/shared/sqlite-import-fence.test.ts +19 -0
- package/src/shared/sqlite.test.ts +27 -1
- package/src/shared/sqlite.ts +204 -1
- package/src/shared/status-detail-text.test.ts +8 -4
- package/src/shared/status-detail-text.ts +20 -1
- package/src/shared/subagent-runner.ts +17 -10
- package/src/shared/tag-transcript.ts +53 -22
- package/src/shared/transcript.ts +7 -0
- package/src/shared/window-geometry.test.ts +44 -0
- package/src/shared/window-geometry.ts +89 -11
- package/src/shared/write-transaction-attribution.test.ts +241 -0
- package/src/shared/write-transaction-timing.ts +2 -1
- package/src/tui/index.tsx +18 -4
- package/src/tui/slots/sidebar-content.tsx +12 -7
- package/src/tui-compiled/index.tsx +237 -225
- package/src/tui-compiled/slots/sidebar-content.tsx +301 -305
- package/dist/agents/sidekick.d.ts +0 -2
- package/dist/agents/sidekick.d.ts.map +0 -1
- package/dist/features/magic-context/defaults.d.ts +0 -2
- package/dist/features/magic-context/defaults.d.ts.map +0 -1
- package/dist/features/magic-context/sidekick/agent.d.ts +0 -14
- package/dist/features/magic-context/sidekick/agent.d.ts.map +0 -1
- package/dist/features/magic-context/sidekick/core.d.ts +0 -38
- package/dist/features/magic-context/sidekick/core.d.ts.map +0 -1
- package/dist/features/magic-context/sidekick/index.d.ts +0 -3
- package/dist/features/magic-context/sidekick/index.d.ts.map +0 -1
- package/dist/hooks/magic-context/boundary-execution.d.ts +0 -27
- package/dist/hooks/magic-context/boundary-execution.d.ts.map +0 -1
- package/dist/index-jfpk81yt.js +0 -146
- package/dist/index-raatkvw5.js +0 -360
- package/src/agents/sidekick.ts +0 -1
- package/src/features/magic-context/defaults.ts +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Magic Context agent-facing surface (exported from source)
|
|
2
2
|
|
|
3
|
-
Generated by `packages/plugin/scripts/export-agent-surface.ts` at 2026-
|
|
3
|
+
Generated by `packages/plugin/scripts/export-agent-surface.ts` at 2026-09-11.
|
|
4
4
|
Token counts are Claude BPE estimates on the raw text.
|
|
5
5
|
|
|
6
6
|
## 1. System-prompt guidance section
|
|
7
7
|
|
|
8
|
-
### PRIMARY full (reduce=on, memory=on, dreamer=on, temporal=on) —
|
|
8
|
+
### PRIMARY full (reduce=on, memory=on, dreamer=on, temporal=on) — 8752 chars, ~2008 tokens
|
|
9
9
|
|
|
10
10
|
```markdown
|
|
11
11
|
## Magic Context
|
|
@@ -23,7 +23,7 @@ Because of this:
|
|
|
23
23
|
Reduction prompts are routine housekeeping to keep the session fast and cheap — act on them as light maintenance, never as scarcity warnings. Keep individual operations efficient, but never let context size change *what* work you take on or *how thoroughly* you do it.
|
|
24
24
|
|
|
25
25
|
Messages and tool outputs are tagged with §N§ identifiers (e.g., §1§, §42§).
|
|
26
|
-
Use `ctx_reduce` to mark spent tagged content as discardable and reclaim space. Marking is NOT an immediate delete — it queues the content, which stays fully visible until space is actually needed (as soon as the next turn if you're already under pressure, much later if not), so mark a tool output as soon as you're done with it rather than hoarding the call for the end of the turn. The
|
|
26
|
+
Use `ctx_reduce` to mark spent tagged content as discardable and reclaim space. Marking is NOT an immediate delete — it queues the content, which stays fully visible until space is actually needed (as soon as the next turn if you're already under pressure, much later if not), so mark a tool output as soon as you're done with it rather than hoarding the call for the end of the turn. The newest token-mass window stays protected until displaced. Syntax: "3-5", "1,2,9", or "1-5,8,12-15".
|
|
27
27
|
Do not announce or narrate `ctx_reduce` drops — just call the tool silently. Saying "I'll drop these outputs" wastes tokens the user does not care about.
|
|
28
28
|
Use `ctx_note` ONLY for genuinely future concerns — something to revisit much later, not work coming up in the next few turns (that's already in your active context) and not active multi-step work (use todos for that). Magic Context preserves your full context across both compaction and restarts, so an upcoming restart or "let's come back to this later" is never a reason to take a note — nothing is lost either way. Notes you do take survive compression and resurface at natural work boundaries (after commits, historian runs, todo completion).
|
|
29
29
|
Use `ctx_memory` for durable project knowledge: write what future sessions must know, update/archive/merge the memories you see in `<project-memory>` when they drift. Memories persist across sessions and every new session starts with them.
|
|
@@ -35,11 +35,11 @@ Memories are grouped by category as `#id: fact` lines; pass the numeric id to `c
|
|
|
35
35
|
Use `ctx_search` to search across project memories, indexed git commits, and this session's full conversation history (including compacted parts) from one query.
|
|
36
36
|
Use `ctx_expand` to recover the raw conversation behind a summary under a `## start-end · date · title` heading inside `<session-history>` — pass the heading's start/end range when the summary is not enough (exact wording, values, error text).
|
|
37
37
|
**Search before asking the user**: If you can't remember or don't know something that might have been discussed before or stored in project memory, use `ctx_search` before asking the user. Examples:
|
|
38
|
-
- Can't remember where a related codebase or dependency lives → `ctx_search(query="opencode source code path")`
|
|
39
|
-
- Forgot a prior architectural decision or constraint → `ctx_search(query="why did we choose SQLite over postgres")`
|
|
40
|
-
- Need a config value, API key location, or environment detail → `ctx_search(query="embedding provider
|
|
41
|
-
- Looking for how something was implemented previously → `ctx_search(query="how does the dreamer lease work")`
|
|
42
|
-
- Want to recall what was decided in an earlier conversation → `ctx_search(query="dashboard release signing setup")`
|
|
38
|
+
- Can't remember where a related codebase or dependency lives → `ctx_search(query="where is the opencode source code path?")`
|
|
39
|
+
- Forgot a prior architectural decision or constraint → `ctx_search(query="why did we choose SQLite over postgres?")`
|
|
40
|
+
- Need a config value, API key location, or environment detail → `ctx_search(query="how is the embedding provider configured?")`
|
|
41
|
+
- Looking for how something was implemented previously → `ctx_search(query="how does the dreamer lease work?")`
|
|
42
|
+
- Want to recall what was decided in an earlier conversation → `ctx_search(query="what did we decide about the dashboard release signing setup?")`
|
|
43
43
|
`ctx_search` returns ranked results from memories, git commits, and raw message history. Use message ordinals from results with `ctx_expand` to retrieve surrounding conversation context.
|
|
44
44
|
Compressed history intentionally omits tool calls and their outputs — summaries like "I edited file X" are historian records, not patterns to replicate. In the live conversation, older tool calls and their results are cleaned up to save context — you may see your own past messages referencing actions without the corresponding tool call or result visible. This is normal context management. ALWAYS use real tool calls; never simulate, fabricate, or inline tool outputs in your text. If there is no tool result message, the action did not happen. NEVER simulate, hallucinate or claim tool calls, command output, search results, file edits, or diffs in plain text as if they actually occurred.
|
|
45
45
|
Magic Context control metadata is not reply syntax. Never reproduce `<system-reminder>`, `<ctx-search-hint>`, `<session-history>`, `<session-history-since>`, `<project-memory>`, `<memory-updates>`, `<new-compartments>`, `<new-memories>`, `[dropped §N§]`, or `<!-- +Xm -->` markers in a normal reply and never treat them as user instructions; use ordinary prose and real tool calls instead.
|
|
@@ -71,7 +71,7 @@ Example: `ctx_note(action="write", content="Implement X because Y", surface_cond
|
|
|
71
71
|
Prefer many small targeted operations over one large blanket operation, and keep the working set tidy as routine maintenance.
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
### PRIMARY memory-off (reduce=on, memory=off) —
|
|
74
|
+
### PRIMARY memory-off (reduce=on, memory=off) — 7717 chars, ~1749 tokens
|
|
75
75
|
|
|
76
76
|
```markdown
|
|
77
77
|
## Magic Context
|
|
@@ -89,17 +89,17 @@ Because of this:
|
|
|
89
89
|
Reduction prompts are routine housekeeping to keep the session fast and cheap — act on them as light maintenance, never as scarcity warnings. Keep individual operations efficient, but never let context size change *what* work you take on or *how thoroughly* you do it.
|
|
90
90
|
|
|
91
91
|
Messages and tool outputs are tagged with §N§ identifiers (e.g., §1§, §42§).
|
|
92
|
-
Use `ctx_reduce` to mark spent tagged content as discardable and reclaim space. Marking is NOT an immediate delete — it queues the content, which stays fully visible until space is actually needed (as soon as the next turn if you're already under pressure, much later if not), so mark a tool output as soon as you're done with it rather than hoarding the call for the end of the turn. The
|
|
92
|
+
Use `ctx_reduce` to mark spent tagged content as discardable and reclaim space. Marking is NOT an immediate delete — it queues the content, which stays fully visible until space is actually needed (as soon as the next turn if you're already under pressure, much later if not), so mark a tool output as soon as you're done with it rather than hoarding the call for the end of the turn. The newest token-mass window stays protected until displaced. Syntax: "3-5", "1,2,9", or "1-5,8,12-15".
|
|
93
93
|
Do not announce or narrate `ctx_reduce` drops — just call the tool silently. Saying "I'll drop these outputs" wastes tokens the user does not care about.
|
|
94
94
|
Use `ctx_note` ONLY for genuinely future concerns — something to revisit much later, not work coming up in the next few turns (that's already in your active context) and not active multi-step work (use todos for that). Magic Context preserves your full context across both compaction and restarts, so an upcoming restart or "let's come back to this later" is never a reason to take a note — nothing is lost either way. Notes you do take survive compression and resurface at natural work boundaries (after commits, historian runs, todo completion).
|
|
95
95
|
Use `ctx_search` to search across project memories, indexed git commits, and this session's full conversation history (including compacted parts) from one query.
|
|
96
96
|
Use `ctx_expand` to recover the raw conversation behind a summary under a `## start-end · date · title` heading inside `<session-history>` — pass the heading's start/end range when the summary is not enough (exact wording, values, error text).
|
|
97
97
|
**Search before asking the user**: If you can't remember or don't know something that might have been discussed before or stored in project memory, use `ctx_search` before asking the user. Examples:
|
|
98
|
-
- Can't remember where a related codebase or dependency lives → `ctx_search(query="opencode source code path")`
|
|
99
|
-
- Forgot a prior architectural decision or constraint → `ctx_search(query="why did we choose SQLite over postgres")`
|
|
100
|
-
- Need a config value, API key location, or environment detail → `ctx_search(query="embedding provider
|
|
101
|
-
- Looking for how something was implemented previously → `ctx_search(query="how does the dreamer lease work")`
|
|
102
|
-
- Want to recall what was decided in an earlier conversation → `ctx_search(query="dashboard release signing setup")`
|
|
98
|
+
- Can't remember where a related codebase or dependency lives → `ctx_search(query="where is the opencode source code path?")`
|
|
99
|
+
- Forgot a prior architectural decision or constraint → `ctx_search(query="why did we choose SQLite over postgres?")`
|
|
100
|
+
- Need a config value, API key location, or environment detail → `ctx_search(query="how is the embedding provider configured?")`
|
|
101
|
+
- Looking for how something was implemented previously → `ctx_search(query="how does the dreamer lease work?")`
|
|
102
|
+
- Want to recall what was decided in an earlier conversation → `ctx_search(query="what did we decide about the dashboard release signing setup?")`
|
|
103
103
|
`ctx_search` returns ranked results from memories, git commits, and raw message history. Use message ordinals from results with `ctx_expand` to retrieve surrounding conversation context.
|
|
104
104
|
Compressed history intentionally omits tool calls and their outputs — summaries like "I edited file X" are historian records, not patterns to replicate. In the live conversation, older tool calls and their results are cleaned up to save context — you may see your own past messages referencing actions without the corresponding tool call or result visible. This is normal context management. ALWAYS use real tool calls; never simulate, fabricate, or inline tool outputs in your text. If there is no tool result message, the action did not happen. NEVER simulate, hallucinate or claim tool calls, command output, search results, file edits, or diffs in plain text as if they actually occurred.
|
|
105
105
|
Magic Context control metadata is not reply syntax. Never reproduce `<system-reminder>`, `<ctx-search-hint>`, `<session-history>`, `<session-history-since>`, `<project-memory>`, `<memory-updates>`, `<new-compartments>`, `<new-memories>`, `[dropped §N§]`, or `<!-- +Xm -->` markers in a normal reply and never treat them as user instructions; use ordinary prose and real tool calls instead.
|
|
@@ -131,7 +131,7 @@ Example: `ctx_note(action="write", content="Implement X because Y", surface_cond
|
|
|
131
131
|
Prefer many small targeted operations over one large blanket operation, and keep the working set tidy as routine maintenance.
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
### PRIMARY reduce-off (reduce=off, memory=on) —
|
|
134
|
+
### PRIMARY reduce-off (reduce=off, memory=on) — 6484 chars, ~1489 tokens
|
|
135
135
|
|
|
136
136
|
```markdown
|
|
137
137
|
## Magic Context
|
|
@@ -158,11 +158,11 @@ Memories are grouped by category as `#id: fact` lines; pass the numeric id to `c
|
|
|
158
158
|
Use `ctx_search` to search across project memories, indexed git commits, and this session's full conversation history (including compacted parts) from one query.
|
|
159
159
|
Use `ctx_expand` to recover the raw conversation behind a summary under a `## start-end · date · title` heading inside `<session-history>` — pass the heading's start/end range when the summary is not enough (exact wording, values, error text).
|
|
160
160
|
**Search before asking the user**: If you can't remember or don't know something that might have been discussed before or stored in project memory, use `ctx_search` before asking the user. Examples:
|
|
161
|
-
- Can't remember where a related codebase or dependency lives → `ctx_search(query="opencode source code path")`
|
|
162
|
-
- Forgot a prior architectural decision or constraint → `ctx_search(query="why did we choose SQLite over postgres")`
|
|
163
|
-
- Need a config value, API key location, or environment detail → `ctx_search(query="embedding provider
|
|
164
|
-
- Looking for how something was implemented previously → `ctx_search(query="how does the dreamer lease work")`
|
|
165
|
-
- Want to recall what was decided in an earlier conversation → `ctx_search(query="dashboard release signing setup")`
|
|
161
|
+
- Can't remember where a related codebase or dependency lives → `ctx_search(query="where is the opencode source code path?")`
|
|
162
|
+
- Forgot a prior architectural decision or constraint → `ctx_search(query="why did we choose SQLite over postgres?")`
|
|
163
|
+
- Need a config value, API key location, or environment detail → `ctx_search(query="how is the embedding provider configured?")`
|
|
164
|
+
- Looking for how something was implemented previously → `ctx_search(query="how does the dreamer lease work?")`
|
|
165
|
+
- Want to recall what was decided in an earlier conversation → `ctx_search(query="what did we decide about the dashboard release signing setup?")`
|
|
166
166
|
`ctx_search` returns ranked results from memories, git commits, and raw message history. Use message ordinals from results with `ctx_expand` to retrieve surrounding conversation context.
|
|
167
167
|
Compressed history intentionally omits tool calls and their outputs — summaries like "I edited file X" are historian records, not patterns to replicate. In the live conversation, older tool calls and their results are cleaned up to save context — you may see your own past messages referencing actions without the corresponding tool call or result visible. This is normal context management. ALWAYS use real tool calls; never simulate, fabricate, or inline tool outputs in your text. If there is no tool result message, the action did not happen. NEVER simulate, hallucinate or claim tool calls, command output, search results, file edits, or diffs in plain text as if they actually occurred.
|
|
168
168
|
Magic Context control metadata is not reply syntax. Never reproduce `<system-reminder>`, `<ctx-search-hint>`, `<session-history>`, `<session-history-since>`, `<project-memory>`, `<memory-updates>`, `<new-compartments>`, `<new-memories>`, `[dropped §N§]`, or `<!-- +Xm -->` markers in a normal reply and never treat them as user instructions; use ordinary prose and real tool calls instead.
|
|
@@ -172,13 +172,13 @@ Example: `ctx_note(action="write", content="Implement X because Y", surface_cond
|
|
|
172
172
|
**Temporal awareness**: User messages may be preceded by HTML comments like `<!-- +12m -->`, `<!-- +2h 15m -->`, or `<!-- +3d 4h -->` indicating time elapsed since the previous message's completion. Compartments in `<session-history>` carry `start-date` and `end-date` attributes (YYYY-MM-DD) showing real-time boundaries. Use these when reasoning about workflow pacing, log durations, build times, or how long ago something happened.
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
### SUBAGENT minimal —
|
|
175
|
+
### SUBAGENT minimal — 693 chars, ~187 tokens
|
|
176
176
|
|
|
177
177
|
```markdown
|
|
178
178
|
## Magic Context
|
|
179
179
|
|
|
180
180
|
Messages and tool outputs are tagged with §N§ identifiers (e.g., §1§, §42§).
|
|
181
|
-
Use `ctx_reduce` to drop tool outputs you have already finished with, keeping your working context lean. Syntax: "3-5", "1,2,9", or "1-5,8,12-15". The
|
|
181
|
+
Use `ctx_reduce` to drop tool outputs you have already finished with, keeping your working context lean. Syntax: "3-5", "1,2,9", or "1-5,8,12-15". The newest token-mass window stays protected.
|
|
182
182
|
Drop silently — do not narrate it. NEVER drop large ranges blindly (e.g., "1-50"); review each tag first. Do not drop user or assistant text messages — only large tool outputs are worth dropping.
|
|
183
183
|
Older tool calls may show `[dropped §N§]` sentinels; that is normal context management, not a pattern to copy. ALWAYS make fresh real tool calls when you need data again; never fabricate or inline tool output.
|
|
184
184
|
```
|
|
@@ -254,19 +254,19 @@ Two recovery modes for finer detail:
|
|
|
254
254
|
}
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
### ctx_note — description ~
|
|
257
|
+
### ctx_note — description ~392 tokens, params ~378 tokens (total ~770)
|
|
258
258
|
|
|
259
259
|
**Description:**
|
|
260
260
|
|
|
261
261
|
```
|
|
262
|
-
Working notes for this session
|
|
262
|
+
Working notes for this session — reminders, follow-ups, and things to revisit later.
|
|
263
263
|
|
|
264
|
-
Use a note when something matters LATER but not in the next few steps: "revisit the retry logic after the release", "user wants the dashboard polish batched", "flaky test to investigate when touching CI". Don't use notes for active
|
|
264
|
+
Use a note when something matters LATER but not in the next few steps: "revisit the retry logic after the release", "user wants the dashboard polish batched", "flaky test to investigate when touching CI". Don't use notes for active work (use todos) or durable project knowledge (use ctx_memory). Notes resurface at work boundaries and when read.
|
|
265
265
|
|
|
266
266
|
Actions:
|
|
267
267
|
- write: save a note (content). Add surface_condition to make it a smart note (below).
|
|
268
268
|
- read: list notes, newest first. Default: latest active session notes + ready smart notes; page older ones with limit/offset, or inspect other states with filter.
|
|
269
|
-
- update
|
|
269
|
+
- update: change a note by note_id. dismiss: retire one by note_id or 1–50 by note_ids; provide exactly one.
|
|
270
270
|
|
|
271
271
|
Smart notes: pass surface_condition and the note stays hidden until a background checker confirms the condition — using ONLY externally verifiable signals (GitHub state via gh, files on disk, git history, web pages). It cannot see this conversation, so the condition must be checkable from outside:
|
|
272
272
|
✓ "When PR #42 in cortexkit/magic-context is merged"
|
|
@@ -321,11 +321,22 @@ Example: ctx_note(action="write", content="Re-run the perf benchmark once the bo
|
|
|
321
321
|
"note_id": {
|
|
322
322
|
"description": "Note ID (required for 'dismiss' and 'update' actions).",
|
|
323
323
|
"type": "number"
|
|
324
|
+
},
|
|
325
|
+
"note_ids": {
|
|
326
|
+
"description": "One to fifty note ids for 'dismiss' only; do not combine with note_id.",
|
|
327
|
+
"minItems": 1,
|
|
328
|
+
"maxItems": 50,
|
|
329
|
+
"type": "array",
|
|
330
|
+
"items": {
|
|
331
|
+
"type": "integer",
|
|
332
|
+
"minimum": 1,
|
|
333
|
+
"maximum": 9007199254740991
|
|
334
|
+
}
|
|
324
335
|
}
|
|
325
336
|
}
|
|
326
337
|
```
|
|
327
338
|
|
|
328
|
-
### ctx_memory — description ~234 tokens, params ~
|
|
339
|
+
### ctx_memory — description ~234 tokens, params ~216 tokens (total ~450)
|
|
329
340
|
|
|
330
341
|
**Description:**
|
|
331
342
|
|
|
@@ -365,7 +376,7 @@ Example: ctx_memory(action="write", category="CONSTRAINTS", content="Pi stores s
|
|
|
365
376
|
"type": "string"
|
|
366
377
|
},
|
|
367
378
|
"category": {
|
|
368
|
-
"description": "What kind of fact this is (required for write; optional merge override)",
|
|
379
|
+
"description": "What kind of fact this is (required for write; optional on update to recategorize, omitted keeps the current category; optional merge override)",
|
|
369
380
|
"type": "string",
|
|
370
381
|
"enum": [
|
|
371
382
|
"PROJECT_RULES",
|
|
@@ -393,20 +404,24 @@ Example: ctx_memory(action="write", category="CONSTRAINTS", content="Pi stores s
|
|
|
393
404
|
}
|
|
394
405
|
```
|
|
395
406
|
|
|
396
|
-
### ctx_search — description ~
|
|
407
|
+
### ctx_search — description ~402 tokens, params ~184 tokens (total ~586)
|
|
397
408
|
|
|
398
409
|
**Description:**
|
|
399
410
|
|
|
400
411
|
```
|
|
401
412
|
Your long-term recall for this project — search everything that ever happened here, not just what's currently visible.
|
|
402
413
|
|
|
414
|
+
Retrieval matches meaning as well as exact words and fuses them, so phrasing matters: phrase `query` as a natural-language question that still contains the exact terms you expect in the answer (paths, symbols, config keys, error strings); a bare keyword stack finds less than a question carrying the same words.
|
|
415
|
+
- Good: "where is the retry backoff for the upload client configured?"
|
|
416
|
+
- Bad: "upload client retry backoff config"
|
|
417
|
+
|
|
403
418
|
Reach for it when something feels familiar but isn't in view: "did we solve this before?", "what did we decide about X?", "when did this break?", "where does Y live?". Results only contain things you CANNOT currently see — memories already shown in <project-memory> and the live conversation tail are filtered out. A query that is just one or more memory ids (e.g. `#7234` or `12, 34`) bypasses text search and resolves those ids directly.
|
|
404
419
|
|
|
405
420
|
Sources (omit for a broad search across all):
|
|
406
421
|
- memory: curated cross-session project knowledge — rules, constraints, conventions.
|
|
407
422
|
- message: the raw conversation behind your compacted history. Hits include message ordinals — expand the surrounding exchange with ctx_expand(start=N-10, end=N+5).
|
|
408
423
|
- git_commit: this repository's commit history.
|
|
409
|
-
- note: parked decisions
|
|
424
|
+
- note: parked decisions and follow-ups with their recorded text.
|
|
410
425
|
|
|
411
426
|
Picking sources:
|
|
412
427
|
- "when did this change / was this working before" → ["git_commit", "message"]
|
|
@@ -450,9 +465,9 @@ The hash handler persists the MD5 of `output.system.join("\\n")`. The values bel
|
|
|
450
465
|
|
|
451
466
|
| Variant | Guidance bytes | MD5 system-prompt hash |
|
|
452
467
|
|---|---:|---|
|
|
453
|
-
| PRIMARY full |
|
|
454
|
-
| PRIMARY memory-off |
|
|
455
|
-
| PRIMARY reduce-off |
|
|
456
|
-
| SUBAGENT minimal |
|
|
468
|
+
| PRIMARY full | 8816 | `e8a75373e85edefedf7a5c8c19af3926` |
|
|
469
|
+
| PRIMARY memory-off | 7775 | `402c342a3ff283375c47a1735d03aa1a` |
|
|
470
|
+
| PRIMARY reduce-off | 6526 | `7e5d386d94abe4f101bfd6d891ec183b` |
|
|
471
|
+
| SUBAGENT minimal | 705 | `1c09c70b742f79274c501dd8f7eff1fc` |
|
|
457
472
|
|
|
458
473
|
The OpenCode and Pi runtime compatibility tests consume this snapshot for omitted `prompt_surface` and explicit `{ default: "full" }`: both assert guidance, registered tool descriptions, tool IDs, and hashes; OpenCode also asserts these parameter schemas directly, while Pi asserts its TypeBox-owned schemas stay byte-identical across both config forms.
|
|
@@ -80,6 +80,34 @@ describe("prompt-surface runtime", () => {
|
|
|
80
80
|
expect(changedModel.primaryOverride).toBe(second);
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
+
it("shares one frozen guidance epoch between the system hook and Rust adapter", () => {
|
|
84
|
+
const directory = tempDir();
|
|
85
|
+
const path = join(directory, "guidance.md");
|
|
86
|
+
const first = "## Magic Context\n\nShared first epoch";
|
|
87
|
+
const second = "## Magic Context\n\nShared second epoch";
|
|
88
|
+
writeFileSync(path, first);
|
|
89
|
+
const runtime = createPromptSurfaceRuntime({
|
|
90
|
+
userConfigDirectory: directory,
|
|
91
|
+
warn: () => undefined,
|
|
92
|
+
});
|
|
93
|
+
const systemEpochs = createPromptSurfaceGuidanceEpochCache(runtime);
|
|
94
|
+
const adapterEpochs = createPromptSurfaceGuidanceEpochCache(runtime);
|
|
95
|
+
const config = {
|
|
96
|
+
default: "full" as const,
|
|
97
|
+
guidance_override_path: "guidance.md",
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const systemInitial = systemEpochs.resolve("session", config, "provider/model");
|
|
101
|
+
writeFileSync(path, second);
|
|
102
|
+
const adapterDeferred = adapterEpochs.resolve("session", config, "provider/model");
|
|
103
|
+
expect(adapterDeferred).toBe(systemInitial);
|
|
104
|
+
expect(adapterDeferred.primaryOverride).toBe(first);
|
|
105
|
+
|
|
106
|
+
adapterEpochs.clear("session");
|
|
107
|
+
const systemNextEpoch = systemEpochs.resolve("session", config, "provider/model");
|
|
108
|
+
expect(systemNextEpoch.primaryOverride).toBe(second);
|
|
109
|
+
});
|
|
110
|
+
|
|
83
111
|
it("uses registration default, applies known overrides, and reports invalid IDs", () => {
|
|
84
112
|
const warnings: string[] = [];
|
|
85
113
|
const runtime = createPromptSurfaceRuntime({
|
|
@@ -230,18 +230,33 @@ interface GuidanceEpoch {
|
|
|
230
230
|
selection: PromptSurfaceGuidanceSelection;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
|
|
234
|
-
export function createPromptSurfaceGuidanceEpochCache(runtime: PromptSurfaceRuntime): {
|
|
233
|
+
export interface PromptSurfaceGuidanceEpochCache {
|
|
235
234
|
resolve: (
|
|
236
235
|
sessionId: string,
|
|
237
236
|
config: PromptSurfaceConfig | undefined,
|
|
238
237
|
modelKey: string | undefined,
|
|
239
238
|
) => PromptSurfaceGuidanceSelection;
|
|
240
239
|
clear: (sessionId: string) => void;
|
|
241
|
-
}
|
|
242
|
-
const epochs = new Map<string, GuidanceEpoch>();
|
|
240
|
+
}
|
|
243
241
|
|
|
244
|
-
|
|
242
|
+
const guidanceEpochCacheByRuntime = new WeakMap<
|
|
243
|
+
PromptSurfaceRuntime,
|
|
244
|
+
PromptSurfaceGuidanceEpochCache
|
|
245
|
+
>();
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Freeze preset selection and materialized override bytes for one model-key epoch.
|
|
249
|
+
* Every hook using the same runtime also shares this cache, so a file edit cannot
|
|
250
|
+
* make the system hook and Rust adapter observe different bytes within one epoch.
|
|
251
|
+
*/
|
|
252
|
+
export function createPromptSurfaceGuidanceEpochCache(
|
|
253
|
+
runtime: PromptSurfaceRuntime,
|
|
254
|
+
): PromptSurfaceGuidanceEpochCache {
|
|
255
|
+
const shared = guidanceEpochCacheByRuntime.get(runtime);
|
|
256
|
+
if (shared) return shared;
|
|
257
|
+
|
|
258
|
+
const epochs = new Map<string, GuidanceEpoch>();
|
|
259
|
+
const cache: PromptSurfaceGuidanceEpochCache = {
|
|
245
260
|
resolve(sessionId, config, modelKey) {
|
|
246
261
|
const canonicalModelKey = modelKey ? piModelRefToCanonical(modelKey) : undefined;
|
|
247
262
|
const cached = epochs.get(sessionId);
|
|
@@ -257,4 +272,6 @@ export function createPromptSurfaceGuidanceEpochCache(runtime: PromptSurfaceRunt
|
|
|
257
272
|
epochs.delete(sessionId);
|
|
258
273
|
},
|
|
259
274
|
};
|
|
275
|
+
guidanceEpochCacheByRuntime.set(runtime, cache);
|
|
276
|
+
return cache;
|
|
260
277
|
}
|
|
@@ -2,7 +2,7 @@ import type { ModelInput, ResolvedModelEntry } from "./model-resolution";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Resolve the fallback model list to attempt for a hidden-agent (historian /
|
|
5
|
-
* dreamer
|
|
5
|
+
* dreamer) call when its configured primary fails.
|
|
6
6
|
*
|
|
7
7
|
* Policy: ONLY the user's explicitly-configured `fallback_models` for this
|
|
8
8
|
* agent. There is NO builtin provider-agnostic chain — a hardcoded chain
|
package/src/shared/rpc-types.ts
CHANGED
|
@@ -7,6 +7,8 @@ import type {
|
|
|
7
7
|
DreamTaskBacklogMap,
|
|
8
8
|
DreamTaskProgress,
|
|
9
9
|
} from "../features/magic-context/dreamer/task-registry";
|
|
10
|
+
import type { SynapseLaneDescriptor } from "../features/magic-context/memory/embedding-synapse";
|
|
11
|
+
import type { ConfigParseFailure } from "./config-diagnostics";
|
|
10
12
|
import type { LoggerDiagnostics } from "./logger";
|
|
11
13
|
|
|
12
14
|
export interface TailHygieneStatus {
|
|
@@ -168,6 +170,8 @@ export interface StatusDetail extends SidebarSnapshot {
|
|
|
168
170
|
reserve: number;
|
|
169
171
|
reserveSource: "output_catalog" | "output_config" | "wall_margin" | "none";
|
|
170
172
|
geometry: "shared_upfront" | "shared_truncating" | "separate";
|
|
173
|
+
windowSource: "catalog" | "overlay" | "provider" | "detected";
|
|
174
|
+
absoluteWall: number;
|
|
171
175
|
};
|
|
172
176
|
};
|
|
173
177
|
/**
|
|
@@ -181,6 +185,11 @@ export interface StatusDetail extends SidebarSnapshot {
|
|
|
181
185
|
* (only meaningful when lastResponseTime > 0); N = live countdown. */
|
|
182
186
|
cacheRemainingMs: number;
|
|
183
187
|
cacheExpired: boolean;
|
|
188
|
+
/** Reports whether the displayed TTL came from config, persisted session metadata,
|
|
189
|
+
* or the default; cache scheduling still uses the TTL stored in session metadata. */
|
|
190
|
+
cacheTtlSource?: "config" | "session" | "default";
|
|
191
|
+
cacheTtlModelKey?: string;
|
|
192
|
+
configParseFailures?: ConfigParseFailure[];
|
|
184
193
|
/** True when cacheTtl is "never" — the idle-TTL heuristic is disabled on
|
|
185
194
|
* this lane. Redundant with cacheTtlMs === -1; kept as the readable form. */
|
|
186
195
|
cacheNeverExpires?: boolean;
|
|
@@ -233,12 +242,127 @@ export interface EmbedDetail {
|
|
|
233
242
|
enabled: boolean;
|
|
234
243
|
model: string;
|
|
235
244
|
provider: string;
|
|
245
|
+
synapseDescriptor?: SynapseLaneDescriptor;
|
|
236
246
|
session: { embedded: number; total: number };
|
|
237
247
|
memories: { embedded: number; total: number };
|
|
238
248
|
commits: { embedded: number; total: number; gitEnabled: boolean };
|
|
239
249
|
statusText: string;
|
|
240
250
|
}
|
|
241
251
|
|
|
252
|
+
export interface DebugProcessMemoryUsage {
|
|
253
|
+
rss: number;
|
|
254
|
+
heapTotal: number;
|
|
255
|
+
heapUsed: number;
|
|
256
|
+
external: number;
|
|
257
|
+
arrayBuffers: number;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface DebugSessionHolderCount {
|
|
261
|
+
sessionId: string;
|
|
262
|
+
lkgBytes: number;
|
|
263
|
+
taggerAssignments: number;
|
|
264
|
+
taggerToolAccounting: number;
|
|
265
|
+
wireRawMessages: number;
|
|
266
|
+
wireMessages: number;
|
|
267
|
+
wireContentSnapshots: number;
|
|
268
|
+
wireEstimatedBytes: number;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface DebugMemoryHolders {
|
|
272
|
+
lkgSlots: {
|
|
273
|
+
count: number;
|
|
274
|
+
totalBytes: number;
|
|
275
|
+
};
|
|
276
|
+
taggerCache: {
|
|
277
|
+
sessionCount: number;
|
|
278
|
+
assignmentEntries: number;
|
|
279
|
+
toolAccountingEntries: number;
|
|
280
|
+
loadSignatureEntries: number;
|
|
281
|
+
};
|
|
282
|
+
wireCache: {
|
|
283
|
+
snapshots: number;
|
|
284
|
+
rawContentSnapshots: number;
|
|
285
|
+
estimatedBytes: number;
|
|
286
|
+
};
|
|
287
|
+
compartmentMirrors: {
|
|
288
|
+
entries: number;
|
|
289
|
+
};
|
|
290
|
+
messageIndexQueue: {
|
|
291
|
+
queueLength: number;
|
|
292
|
+
reconciliationScheduled: number;
|
|
293
|
+
incrementalTimers: number;
|
|
294
|
+
pendingIncremental: number;
|
|
295
|
+
activeSessionLocks: number;
|
|
296
|
+
completedIncrementalKeys: number;
|
|
297
|
+
activeBufferMessages: number;
|
|
298
|
+
activeBufferBytes: number;
|
|
299
|
+
};
|
|
300
|
+
sessions: DebugSessionHolderCount[];
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export interface DebugSqliteConnectionMemoryStats {
|
|
304
|
+
sequence: number;
|
|
305
|
+
filename: string;
|
|
306
|
+
readonly: boolean;
|
|
307
|
+
pageSize: number | null;
|
|
308
|
+
pageCount: number | null;
|
|
309
|
+
freelistCount: number | null;
|
|
310
|
+
cacheSize: number | null;
|
|
311
|
+
cacheSizeUnit: "pages" | "kib" | null;
|
|
312
|
+
cacheUpperBoundBytes: number | null;
|
|
313
|
+
mmapSizeBytes: number | null;
|
|
314
|
+
walFileBytes: number | null;
|
|
315
|
+
shmFileBytes: number | null;
|
|
316
|
+
fts5TableCount: number | null;
|
|
317
|
+
journalMode: string | null;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export interface DebugNativeMemoryUsage {
|
|
321
|
+
sqlite: {
|
|
322
|
+
connectionCount: number;
|
|
323
|
+
cacheUpperBoundBytes: number;
|
|
324
|
+
mmapUpperBoundBytes: number;
|
|
325
|
+
walFileBytes: number;
|
|
326
|
+
shmFileBytes: number;
|
|
327
|
+
sqliteStatusApi: "unavailable";
|
|
328
|
+
connections: DebugSqliteConnectionMemoryStats[];
|
|
329
|
+
};
|
|
330
|
+
tokenizer: {
|
|
331
|
+
loaded: boolean;
|
|
332
|
+
loadAttempted: boolean;
|
|
333
|
+
tableBytes: number | null;
|
|
334
|
+
tablePath: string | null;
|
|
335
|
+
};
|
|
336
|
+
localEmbedding: {
|
|
337
|
+
loaded: boolean;
|
|
338
|
+
providerCount: number;
|
|
339
|
+
models: string[];
|
|
340
|
+
runtimes: Array<"native" | "wasm">;
|
|
341
|
+
modelCacheBytes: number | null;
|
|
342
|
+
rssDeltaAtLoad: number;
|
|
343
|
+
externalDeltaAtLoad: number;
|
|
344
|
+
arrayBuffersDeltaAtLoad: number;
|
|
345
|
+
};
|
|
346
|
+
quickJs: {
|
|
347
|
+
loadAttempted: boolean;
|
|
348
|
+
loaded: boolean;
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export interface DebugMemoryUsageResponse {
|
|
353
|
+
pid: number;
|
|
354
|
+
bunVersion: string;
|
|
355
|
+
memoryUsage: DebugProcessMemoryUsage;
|
|
356
|
+
native: DebugNativeMemoryUsage;
|
|
357
|
+
holders: DebugMemoryHolders;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export interface DebugHeapSnapshotResponse extends DebugMemoryUsageResponse {
|
|
361
|
+
path: string;
|
|
362
|
+
format: "jsc" | "v8";
|
|
363
|
+
snapshotVersion?: number;
|
|
364
|
+
}
|
|
365
|
+
|
|
242
366
|
export interface RpcNotificationMessage {
|
|
243
367
|
id: number;
|
|
244
368
|
type: string;
|
package/src/shared/rpc-utils.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { readFileSync } from "node:fs";
|
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
|
|
6
6
|
import { log } from "./logger";
|
|
7
|
+
import { PI_IMAGE_NAMES, piHarnessKindFromExecutable } from "./pi-executable";
|
|
7
8
|
|
|
8
9
|
export type ProcessKind = "OpenCode server" | "OpenCode instance (TUI/CLI)" | "Pi" | "process";
|
|
9
10
|
|
|
@@ -102,8 +103,6 @@ const PI_HARNESS_ARC_MARKERS = [
|
|
|
102
103
|
"cljs/dist",
|
|
103
104
|
"dist/bundle/cli",
|
|
104
105
|
];
|
|
105
|
-
const PI_IMAGE_NAMES = new Set(["pi", "pi.cmd", "omp", "oh-my-pi"]);
|
|
106
|
-
|
|
107
106
|
let rpcIdentityReadFileSync: typeof readFileSync = readFileSync;
|
|
108
107
|
let rpcIdentityExecFileSync: typeof execFileSync = execFileSync;
|
|
109
108
|
let rpcIdentityProcessKill: typeof process.kill = process.kill;
|
|
@@ -346,7 +345,7 @@ function commandHasOpenCodeExecutable(tokens: readonly string[]): number {
|
|
|
346
345
|
function commandHasPiExecutable(tokens: readonly string[]): boolean {
|
|
347
346
|
for (let index = 0; index < tokens.length; index += 1) {
|
|
348
347
|
const executable = executableName(tokens[index]).replace(/\.(?:exe|cmd)$/, "");
|
|
349
|
-
if (
|
|
348
|
+
if (piHarnessKindFromExecutable(executable) !== undefined) return true;
|
|
350
349
|
if (["node", "bun", "deno"].includes(executable)) {
|
|
351
350
|
const script = executableName(tokens[index + 1]).replace(/\.(?:exe|cmd)$/, "");
|
|
352
351
|
if (
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// huge sessions (10k+ messages) which is exactly when Magic Context shines.
|
|
7
7
|
//
|
|
8
8
|
// Background: the plugin only ever needs the latest assistant message of a
|
|
9
|
-
// helper subagent (historian / dreamer /
|
|
9
|
+
// helper subagent (historian / dreamer / key-files / user-memory)
|
|
10
10
|
// or a bounded tail of the active session (conflict-warning cleanup). Both
|
|
11
11
|
// fit comfortably in `limit: 50` with massive headroom.
|
|
12
12
|
//
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
// `sqlite.ts` is executed directly by Node in CI's `node:sqlite` smoke and by
|
|
6
|
+
// Pi/Desktop hosts. Node's type-stripping loader does not resolve extensionless
|
|
7
|
+
// relative imports, so a static import of any sibling module breaks that path
|
|
8
|
+
// while every Bun-run test stays green (2026-09-12: master CI red for three
|
|
9
|
+
// runs after a logging import landed here). Runtime dependencies must be
|
|
10
|
+
// injected (see registerSlowWriteReporter); only type-only imports may be relative.
|
|
11
|
+
describe("sqlite.ts import fence", () => {
|
|
12
|
+
test("has no runtime-relative imports", () => {
|
|
13
|
+
const source = readFileSync(join(import.meta.dir, "sqlite.ts"), "utf8");
|
|
14
|
+
const relativeRuntimeImports = source
|
|
15
|
+
.split("\n")
|
|
16
|
+
.filter((line) => /^import\s+(?!type\s)[^;]*from\s+["']\.\.?\//.test(line));
|
|
17
|
+
expect(relativeRuntimeImports).toEqual([]);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
import { describe, expect, it } from "bun:test";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Database,
|
|
4
|
+
getSqliteMemoryStats,
|
|
5
|
+
loadSqliteModule,
|
|
6
|
+
SqliteRuntimeUnavailableError,
|
|
7
|
+
} from "./sqlite";
|
|
3
8
|
|
|
4
9
|
describe("SQLite runtime selector", () => {
|
|
10
|
+
it("reports live connection PRAGMAs and removes closed handles", () => {
|
|
11
|
+
const before = getSqliteMemoryStats().connectionCount;
|
|
12
|
+
const db = new Database(":memory:");
|
|
13
|
+
try {
|
|
14
|
+
db.exec("PRAGMA cache_size=-1024");
|
|
15
|
+
db.exec("CREATE VIRTUAL TABLE probe_fts USING fts5(content)");
|
|
16
|
+
const during = getSqliteMemoryStats();
|
|
17
|
+
expect(during.connectionCount).toBe(before + 1);
|
|
18
|
+
expect(during.connections.at(-1)).toMatchObject({
|
|
19
|
+
filename: ":memory:",
|
|
20
|
+
cacheSize: -1024,
|
|
21
|
+
cacheSizeUnit: "kib",
|
|
22
|
+
cacheUpperBoundBytes: 1024 * 1024,
|
|
23
|
+
fts5TableCount: 1,
|
|
24
|
+
});
|
|
25
|
+
} finally {
|
|
26
|
+
db.close();
|
|
27
|
+
}
|
|
28
|
+
expect(getSqliteMemoryStats().connectionCount).toBe(before);
|
|
29
|
+
});
|
|
30
|
+
|
|
5
31
|
it("wraps a missing node:sqlite module with the detected runtime and cause", async () => {
|
|
6
32
|
const cause = Object.assign(new Error("No such built-in module: node:sqlite"), {
|
|
7
33
|
code: "ERR_UNKNOWN_BUILTIN_MODULE",
|