@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window-geometry.d.ts","sourceRoot":"","sources":["../../src/shared/window-geometry.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,eAAO,MAAM,qBAAqB,+BAA+B,CAAC;AAClE,eAAO,MAAM,kBAAkB,OAAQ,CAAC;AACxC,eAAO,MAAM,eAAe,OAAQ,CAAC;AACrC,eAAO,MAAM,mBAAmB,QAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"window-geometry.d.ts","sourceRoot":"","sources":["../../src/shared/window-geometry.ts"],"names":[],"mappings":"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"}
|
|
@@ -7,5 +7,5 @@ export declare const SLOW_WRITE_TRANSACTION_THRESHOLD_MS = 1000;
|
|
|
7
7
|
* Log a slow write only after its COMMIT has completed. The timing diagnostic is
|
|
8
8
|
* deliberately best-effort so it can never change the transaction's behavior.
|
|
9
9
|
*/
|
|
10
|
-
export declare function logSlowWriteTransaction(site: string, startedAt: number, thresholdMs?: number): void;
|
|
10
|
+
export declare function logSlowWriteTransaction(site: string, startedAt: number, thresholdMs?: number, completedAtMs?: number): void;
|
|
11
11
|
//# sourceMappingURL=write-transaction-timing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-transaction-timing.d.ts","sourceRoot":"","sources":["../../src/shared/write-transaction-timing.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,mCAAmC,OAAQ,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,WAAW,SAAsC,
|
|
1
|
+
{"version":3,"file":"write-transaction-timing.d.ts","sourceRoot":"","sources":["../../src/shared/write-transaction-timing.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,mCAAmC,OAAQ,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,WAAW,SAAsC,EACjD,aAAa,SAAoB,GAClC,IAAI,CAQN"}
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
retryPendingSessionCleanups2,
|
|
7
7
|
retryPendingRustSessionCleanupsForProject2,
|
|
8
8
|
clearSession2
|
|
9
|
-
} from "./index-
|
|
10
|
-
import"./index-
|
|
9
|
+
} from "./index-jmtjh2d3.js";
|
|
10
|
+
import"./index-1974jvn3.js";
|
|
11
11
|
import"./index-dkv2dn46.js";
|
|
12
12
|
export {
|
|
13
13
|
advanceToolReclaimWatermark2 as advanceToolReclaimWatermark,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-memory/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-memory/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAsDhE,OAAO,EAKH,KAAK,iBAAiB,EACzB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAoiCrE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification-recording.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-memory/verification-recording.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"verification-recording.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-memory/verification-recording.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAYvE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CTX_NOTE_DESCRIPTION = "Working notes for this session
|
|
1
|
+
export declare const CTX_NOTE_DESCRIPTION = "Working notes for this session \u2014 reminders, follow-ups, and things to revisit later.\n\nUse 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.\n\nActions:\n- write: save a note (content). Add surface_condition to make it a smart note (below).\n- 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.\n- update: change a note by note_id. dismiss: retire one by note_id or 1\u201350 by note_ids; provide exactly one.\n\nSmart notes: pass surface_condition and the note stays hidden until a background checker confirms the condition \u2014 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:\n\u2713 \"When PR #42 in cortexkit/magic-context is merged\"\n\u2713 \"When the latest release tag is >= v0.22.0\"\n\u2713 \"When packages/plugin/src/foo.ts contains a function named bar\"\n\u2717 \"When the user mentions X\" / \"when we revisit Y\" / \"after we finish this refactor\" \u2014 no external signal; write a regular note instead.\n\nExample: ctx_note(action=\"write\", content=\"Re-run the perf benchmark once the boundary rework ships\", surface_condition=\"When the latest release tag is >= v0.23.0\")";
|
|
2
2
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,qnDAeoI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAsBhE,OAAO,KAAK,EAAuB,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAK7F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAKpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,QAAQ,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC/D,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACvC;AAygBD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAIxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;AAErF,MAAM,WAAW,WAAY,SAAQ,mBAAmB;IACpD,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;AAErF,MAAM,WAAW,WAAY,SAAQ,mBAAmB;IACpD,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB"}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
+
import { type ProtectionWindowResult } from "../../features/magic-context/protection-window";
|
|
2
3
|
import type { RustToolBackends } from "../../plugin/rust-tool-backends";
|
|
3
4
|
import type { Database } from "../../shared/sqlite";
|
|
4
5
|
export { CTX_REDUCE_LIGHT_DESCRIPTION } from "../light-descriptions";
|
|
5
6
|
export interface CtxReduceToolDeps {
|
|
6
7
|
db: Database;
|
|
7
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Union projection form: protectedSet (tag-number set form).
|
|
10
|
+
* Coordinate space: tag-number space.
|
|
11
|
+
* Empty-window behavior: empty set means zero tool tags are protected by the window;
|
|
12
|
+
* requested drops apply immediately, and non-tool tags are never reclaim targets.
|
|
13
|
+
*/
|
|
14
|
+
protectedSet?: ReadonlySet<number> | ((sessionId: string) => ReadonlySet<number>);
|
|
15
|
+
getProtectionWindow?: (sessionId: string) => ProtectionWindowResult;
|
|
16
|
+
floor?: number;
|
|
8
17
|
getSessionTokens?: (sessionId: string) => number;
|
|
9
18
|
rustToolBackends?: RustToolBackends;
|
|
10
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-reduce/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-reduce/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAEH,KAAK,sBAAsB,EAC9B,MAAM,gDAAgD,CAAC;AAUxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAKpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,QAAQ,CAAC;IACb;;;;;OAKG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;IAClF,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,sBAAsB,CAAC;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACvC;AA+OD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const CTX_SEARCH_TOOL_NAME = "ctx_search";
|
|
2
|
-
export declare const CTX_SEARCH_DESCRIPTION = "Your long-term recall for this project \u2014 search everything that ever happened here, not just what's currently visible.\n\nReach 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 \u2014 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.\n\nSources (omit for a broad search across all):\n- memory: curated cross-session project knowledge \u2014 rules, constraints, conventions.\n- message: the raw conversation behind your compacted history. Hits include message ordinals \u2014 expand the surrounding exchange with ctx_expand(start=N-10, end=N+5).\n- git_commit: this repository's commit history.\n- note: parked decisions
|
|
2
|
+
export declare const CTX_SEARCH_DESCRIPTION = "Your long-term recall for this project \u2014 search everything that ever happened here, not just what's currently visible.\n\nRetrieval 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.\n- Good: \"where is the retry backoff for the upload client configured?\"\n- Bad: \"upload client retry backoff config\"\n\nReach 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 \u2014 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.\n\nSources (omit for a broad search across all):\n- memory: curated cross-session project knowledge \u2014 rules, constraints, conventions.\n- message: the raw conversation behind your compacted history. Hits include message ordinals \u2014 expand the surrounding exchange with ctx_expand(start=N-10, end=N+5).\n- git_commit: this repository's commit history.\n- note: parked decisions and follow-ups with their recorded text.\n\nPicking sources:\n- \"when did this change / was this working before\" \u2192 [\"git_commit\", \"message\"]\n- \"did we discuss this earlier\" \u2192 [\"message\"]\n- \"did we decide something about this / leave a follow-up\" \u2192 [\"note\"]\n- \"what's our convention / rule for X\" \u2192 [\"memory\"]";
|
|
3
3
|
export declare const DEFAULT_CTX_SEARCH_LIMIT = 10;
|
|
4
4
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-search/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,eAAe,CAAC;AACjD,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-search/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,eAAe,CAAC;AACjD,eAAO,MAAM,sBAAsB,4tDAkBiB,CAAC;AACrD,eAAO,MAAM,wBAAwB,KAAK,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const CTX_REDUCE_LIGHT_DESCRIPTION = "For ctx_reduce users, mark spent \u00A7N\u00A7 outputs discardable; release is QUEUED, not immediate, so content stays visible until space is needed. Newest tags stay protected until they age out. Released content becomes a placeholder; recover it only by rerunning the source or recovery tool, so mark only genuinely finished material. Mark analyzed, redundant, persisted, or merely confirmatory outputs; keep user messages, unresolved errors, unextracted evidence, and exact wording. NEVER blanket-mark a large range: review every tag first.";
|
|
2
2
|
export declare const CTX_EXPAND_LIGHT_DESCRIPTION = "For ctx_expand users, recover compacted conversation by passing a session-history heading's inclusive start/end ordinals. Results are raw [N] U:/A: transcript capped near 15K tokens; oversized ranges return the head and a continuation. Use verbose=true to list each message ordinal, part previews, and tool-output sizes; use message=N for one complete stored message and its tool exchanges. NEVER expand ranges after the last compartment because that live tail is already visible.";
|
|
3
|
-
export declare const CTX_NOTE_LIGHT_DESCRIPTION = "For ctx_note
|
|
3
|
+
export declare const CTX_NOTE_LIGHT_DESCRIPTION = "For ctx_note: write saves, read lists, update changes, dismiss retires one note_id or 1\u201350 note_ids (choose one); surface_condition makes a smart note. Smart-note conditions must be externally verifiable via GitHub, disk, git, or web\u2014not this conversation or future actions.";
|
|
4
4
|
export declare const CTX_MEMORY_LIGHT_DESCRIPTION = "For ctx_memory users, write one standalone durable fact with category and content; update one ID, archive one or more IDs, merge two or more IDs, or get one to twenty numeric IDs. get reads memories in every status; list remains dreamer-only, so primary agents must NEVER assume bulk-list access.";
|
|
5
|
-
export declare const CTX_SEARCH_LIGHT_DESCRIPTION = "For ctx_search users, retrieve only hidden recall: memories not
|
|
5
|
+
export declare const CTX_SEARCH_LIGHT_DESCRIPTION = "For ctx_search users, retrieve only hidden recall: memories not in <project-memory>, compacted messages outside the live tail, commits, and notes; phrase query as a question carrying exact terms. Omit sources for broad search; select memory, message, git_commit, or note, or pass memory IDs directly. Hits expand through ctx_expand.";
|
|
6
6
|
//# sourceMappingURL=light-descriptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"light-descriptions.d.ts","sourceRoot":"","sources":["../../src/tools/light-descriptions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,oiBAA0hB,CAAC;AAEpkB,eAAO,MAAM,4BAA4B,qeAAqe,CAAC;AAE/gB,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"light-descriptions.d.ts","sourceRoot":"","sources":["../../src/tools/light-descriptions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,oiBAA0hB,CAAC;AAEpkB,eAAO,MAAM,4BAA4B,qeAAqe,CAAC;AAE/gB,eAAO,MAAM,0BAA0B,iSAAuR,CAAC;AAE/T,eAAO,MAAM,4BAA4B,6SAA6S,CAAC;AAEvV,eAAO,MAAM,4BAA4B,iVAAiV,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/opencode-magic-context",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"src/shared",
|
|
30
30
|
"src/config",
|
|
31
31
|
"src/agents",
|
|
32
|
-
"src/features/magic-context/defaults.ts",
|
|
33
32
|
"src/features/magic-context/dreamer/cron.ts",
|
|
34
33
|
"src/features/magic-context/dreamer/task-registry.ts",
|
|
35
34
|
"README.md"
|
|
@@ -51,7 +50,7 @@
|
|
|
51
50
|
"prepublishOnly": "bun run build && bun run build:tui"
|
|
52
51
|
},
|
|
53
52
|
"dependencies": {
|
|
54
|
-
"@cortexkit/subc-client": "0.
|
|
53
|
+
"@cortexkit/subc-client": "0.11.1",
|
|
55
54
|
"@jitl/quickjs-singlefile-cjs-release-asyncify": "0.32.0",
|
|
56
55
|
"@opencode-ai/plugin": "^1.17.11",
|
|
57
56
|
"@opencode-ai/sdk": "^1.17.11",
|
|
@@ -24,8 +24,8 @@ import { applyDisallowedTools, buildAllowOnlyPermission } from "./permissions";
|
|
|
24
24
|
|
|
25
25
|
// Clamp a user-provided step override to the hidden-agent's built-in cap (loop
|
|
26
26
|
// insurance — see buildHiddenAgentConfig). Caps live as inline literals in
|
|
27
|
-
// buildHiddenAgentRegistrations (historian
|
|
28
|
-
// of tool calls for the historian
|
|
27
|
+
// buildHiddenAgentRegistrations (historian=40, dreamer=150): a handful
|
|
28
|
+
// of tool calls for the historian, a real multi-step maintenance loop
|
|
29
29
|
// for the dreamer.
|
|
30
30
|
function clampHiddenAgentStepLimit(value: unknown, cap: number): number {
|
|
31
31
|
return typeof value === "number" && Number.isFinite(value) ? Math.min(value, cap) : cap;
|
|
@@ -75,7 +75,7 @@ export interface HiddenAgentRegistration {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
* Hoisted function declaration: returns the
|
|
78
|
+
* Hoisted function declaration: returns the hidden-agent registrations with
|
|
79
79
|
* INLINE id / allow-list / step-cap literals (see {@link HiddenAgentRegistration}
|
|
80
80
|
* for why these must not come from module-level `var` consts). Prompts and
|
|
81
81
|
* computed overrides are passed in by the caller; the historian disallow filter
|
|
@@ -87,10 +87,8 @@ export function buildHiddenAgentRegistrations(args: {
|
|
|
87
87
|
historianPrompt: string | undefined;
|
|
88
88
|
historianRecompPrompt?: string | undefined;
|
|
89
89
|
historianEditorPrompt: string | undefined;
|
|
90
|
-
sidekickPrompt: string | undefined;
|
|
91
90
|
dreamerOverrides?: Record<string, unknown>;
|
|
92
91
|
historianOverrides?: Record<string, unknown>;
|
|
93
|
-
sidekickOverrides?: Record<string, unknown>;
|
|
94
92
|
historianDisallowed: readonly string[];
|
|
95
93
|
}): HiddenAgentRegistration[] {
|
|
96
94
|
const historianAllowedTools = applyDisallowedTools(
|
|
@@ -287,16 +285,6 @@ export function buildHiddenAgentRegistrations(args: {
|
|
|
287
285
|
maxSteps: 40,
|
|
288
286
|
overrides: args.historianOverrides,
|
|
289
287
|
},
|
|
290
|
-
{
|
|
291
|
-
id: "sidekick",
|
|
292
|
-
mode: "primary",
|
|
293
|
-
hidden: true,
|
|
294
|
-
description: HIDDEN_AGENT_DESCRIPTION,
|
|
295
|
-
prompt: args.sidekickPrompt,
|
|
296
|
-
allowedTools: ["ctx_search", "aft_outline", "aft_zoom"],
|
|
297
|
-
maxSteps: 40,
|
|
298
|
-
overrides: args.sidekickOverrides,
|
|
299
|
-
},
|
|
300
288
|
];
|
|
301
289
|
}
|
|
302
290
|
|
|
@@ -81,7 +81,7 @@ describe("buildMagicContextSection — subagent mode", () => {
|
|
|
81
81
|
expect(out).toContain("## Magic Context");
|
|
82
82
|
expect(out).toContain("§N§ identifiers");
|
|
83
83
|
expect(out).toContain("ctx_reduce");
|
|
84
|
-
expect(out).toContain("
|
|
84
|
+
expect(out).toContain("newest token-mass window");
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
it("OMITS the long-term-partner frame and primary-only guidance", () => {
|
|
@@ -95,9 +95,11 @@ describe("buildMagicContextSection — subagent mode", () => {
|
|
|
95
95
|
expect(out).not.toContain("ctx_expand");
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
-
it("
|
|
99
|
-
const
|
|
100
|
-
|
|
98
|
+
it("describes token-mass protection independently of a legacy count", () => {
|
|
99
|
+
const withSeven = buildMagicContextSection(null, 7, true, false, false, false, true);
|
|
100
|
+
const withTwenty = buildMagicContextSection(null, 20, true, false, false, false, true);
|
|
101
|
+
expect(withSeven).toBe(withTwenty);
|
|
102
|
+
expect(withSeven).toContain("newest token-mass window");
|
|
101
103
|
});
|
|
102
104
|
|
|
103
105
|
it("is much shorter than the full primary block", () => {
|
|
@@ -174,7 +176,7 @@ describe("buildMagicContextSection — caveman compression warning", () => {
|
|
|
174
176
|
it("emits the warning when caveman is enabled and ctx_reduce is unavailable", () => {
|
|
175
177
|
const out = buildMagicContextSection(
|
|
176
178
|
null, // agent
|
|
177
|
-
20, //
|
|
179
|
+
20, // legacy positional value (ignored in no-reduce path)
|
|
178
180
|
false, // ctx_reduce is unavailable in this session.
|
|
179
181
|
false, // dreamerEnabled
|
|
180
182
|
false, // temporalAwarenessEnabled
|
|
@@ -46,8 +46,7 @@ const PARTNER_FRAME_CLOSER_NO_REDUCE_LIGHT = `\nWhen ctx_reduce is unavailable,
|
|
|
46
46
|
*/
|
|
47
47
|
const CTX_NOTE_GUIDANCE = `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).`;
|
|
48
48
|
|
|
49
|
-
// Tool
|
|
50
|
-
// guidance only describes the omit-entirely case.
|
|
49
|
+
// Tool history guidance is shared by both presets.
|
|
51
50
|
const TOOL_HISTORY_GUIDANCE = `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.
|
|
52
51
|
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.`;
|
|
53
52
|
|
|
@@ -73,20 +72,19 @@ function memoryGuidanceBlock(memoryEnabled: boolean): string {
|
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
const BASE_INTRO = (
|
|
76
|
-
protectedTags: number,
|
|
77
75
|
memoryEnabled: boolean,
|
|
78
76
|
): string => `Messages and tool outputs are tagged with §N§ identifiers (e.g., §1§, §42§).
|
|
79
|
-
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
|
|
77
|
+
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".
|
|
80
78
|
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.
|
|
81
79
|
${CTX_NOTE_GUIDANCE}
|
|
82
80
|
${memoryGuidanceBlock(memoryEnabled)}Use \`ctx_search\` to search across project memories, indexed git commits, and this session's full conversation history (including compacted parts) from one query.
|
|
83
81
|
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).
|
|
84
82
|
**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:
|
|
85
|
-
- Can't remember where a related codebase or dependency lives → \`ctx_search(query="opencode source code path")\`
|
|
86
|
-
- Forgot a prior architectural decision or constraint → \`ctx_search(query="why did we choose SQLite over postgres")\`
|
|
87
|
-
- Need a config value, API key location, or environment detail → \`ctx_search(query="embedding provider
|
|
88
|
-
- Looking for how something was implemented previously → \`ctx_search(query="how does the dreamer lease work")\`
|
|
89
|
-
- Want to recall what was decided in an earlier conversation → \`ctx_search(query="dashboard release signing setup")\`
|
|
83
|
+
- Can't remember where a related codebase or dependency lives → \`ctx_search(query="where is the opencode source code path?")\`
|
|
84
|
+
- Forgot a prior architectural decision or constraint → \`ctx_search(query="why did we choose SQLite over postgres?")\`
|
|
85
|
+
- Need a config value, API key location, or environment detail → \`ctx_search(query="how is the embedding provider configured?")\`
|
|
86
|
+
- Looking for how something was implemented previously → \`ctx_search(query="how does the dreamer lease work?")\`
|
|
87
|
+
- Want to recall what was decided in an earlier conversation → \`ctx_search(query="what did we decide about the dashboard release signing setup?")\`
|
|
90
88
|
\`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.
|
|
91
89
|
${TOOL_HISTORY_GUIDANCE}
|
|
92
90
|
NEVER drop large ranges blindly (e.g., "1-50"). Review each tag before deciding.
|
|
@@ -104,21 +102,20 @@ const BASE_INTRO_NO_REDUCE = (memoryEnabled: boolean): string => `${CTX_NOTE_GUI
|
|
|
104
102
|
${memoryGuidanceBlock(memoryEnabled)}Use \`ctx_search\` to search across project memories, indexed git commits, and this session's full conversation history (including compacted parts) from one query.
|
|
105
103
|
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).
|
|
106
104
|
**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:
|
|
107
|
-
- Can't remember where a related codebase or dependency lives → \`ctx_search(query="opencode source code path")\`
|
|
108
|
-
- Forgot a prior architectural decision or constraint → \`ctx_search(query="why did we choose SQLite over postgres")\`
|
|
109
|
-
- Need a config value, API key location, or environment detail → \`ctx_search(query="embedding provider
|
|
110
|
-
- Looking for how something was implemented previously → \`ctx_search(query="how does the dreamer lease work")\`
|
|
111
|
-
- Want to recall what was decided in an earlier conversation → \`ctx_search(query="dashboard release signing setup")\`
|
|
105
|
+
- Can't remember where a related codebase or dependency lives → \`ctx_search(query="where is the opencode source code path?")\`
|
|
106
|
+
- Forgot a prior architectural decision or constraint → \`ctx_search(query="why did we choose SQLite over postgres?")\`
|
|
107
|
+
- Need a config value, API key location, or environment detail → \`ctx_search(query="how is the embedding provider configured?")\`
|
|
108
|
+
- Looking for how something was implemented previously → \`ctx_search(query="how does the dreamer lease work?")\`
|
|
109
|
+
- Want to recall what was decided in an earlier conversation → \`ctx_search(query="what did we decide about the dashboard release signing setup?")\`
|
|
112
110
|
\`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.
|
|
113
111
|
${TOOL_HISTORY_GUIDANCE}`;
|
|
114
112
|
|
|
115
113
|
const LIGHT_SEARCH_RECOVERY = `Use ctx_search before asking the user about prior project context; it searches memories, commits, and compacted conversation. When a session-history summary lacks exact wording, values, errors, or reasoning, call ctx_expand with its heading range instead of guessing.`;
|
|
116
114
|
|
|
117
115
|
const BASE_INTRO_LIGHT = (
|
|
118
|
-
protectedTags: number,
|
|
119
116
|
memoryEnabled: boolean,
|
|
120
117
|
): string => `In primary sessions with ctx_reduce, the system tags messages and tool outputs as §N§ (for example §1§ and §42§); never imitate these prefixes in replies because only injected tag numbers are valid ctx_reduce handles.
|
|
121
|
-
In primary sessions, NEVER narrate ctx_reduce; call it silently after extracting a spent output because it marks content discardable and QUEUES release rather than deleting immediately. The
|
|
118
|
+
In primary sessions, NEVER narrate ctx_reduce; call it silently after extracting a spent output because it marks content discardable and QUEUES release rather than deleting immediately. The newest token-mass window stays protected until displaced. Use drop grammar "3-5", "1,2,9", or "1-5,8,12-15".
|
|
122
119
|
${CTX_NOTE_GUIDANCE}
|
|
123
120
|
${memoryGuidanceBlock(memoryEnabled)}${LIGHT_SEARCH_RECOVERY}
|
|
124
121
|
${TOOL_HISTORY_GUIDANCE}
|
|
@@ -159,16 +156,14 @@ const TEMPORAL_AWARENESS_GUIDANCE = `\n**Temporal awareness**: User messages may
|
|
|
159
156
|
* ctx_reduce mechanics. The `## Magic Context` marker is still present for
|
|
160
157
|
* injection idempotency (system-prompt-hash.ts gates on it).
|
|
161
158
|
*/
|
|
162
|
-
const SUBAGENT_REDUCE_INTRO =
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
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 last ${protectedTags} tags are protected.
|
|
159
|
+
const SUBAGENT_REDUCE_INTRO =
|
|
160
|
+
(): string => `Messages and tool outputs are tagged with §N§ identifiers (e.g., §1§, §42§).
|
|
161
|
+
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.
|
|
166
162
|
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.
|
|
167
163
|
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.`;
|
|
168
164
|
|
|
169
|
-
const SUBAGENT_REDUCE_INTRO_LIGHT =
|
|
170
|
-
|
|
171
|
-
): string => `In bounded subagent sessions, the system tags messages and tool outputs as §N§; use only those IDs in ctx_reduce drop ranges such as "3-5", "1,2,9", or "1-5,8,12-15". The last ${protectedTags} tags stay protected.
|
|
165
|
+
const SUBAGENT_REDUCE_INTRO_LIGHT =
|
|
166
|
+
(): string => `In bounded subagent sessions, the system tags messages and tool outputs as §N§; use only those IDs in ctx_reduce drop ranges such as "3-5", "1,2,9", or "1-5,8,12-15". Tags in the newest token-mass window stay protected.
|
|
172
167
|
When dropping, do it silently and NEVER choose a large range before reviewing every tag; drop only finished large tool outputs, never user or assistant messages.
|
|
173
168
|
If older calls show [dropped §N§], never copy that system sentinel because it is not reply syntax; make a fresh real tool call and never fabricate or inline output.`;
|
|
174
169
|
|
|
@@ -176,7 +171,7 @@ const CAVEMAN_COMPRESSION_WARNING = `\n**BEWARE**: History compression is on; ol
|
|
|
176
171
|
|
|
177
172
|
export function buildMagicContextSection(
|
|
178
173
|
_agent: string | null,
|
|
179
|
-
|
|
174
|
+
_legacyProtectionCount: number,
|
|
180
175
|
ctxReduceCallable = true,
|
|
181
176
|
dreamerEnabled = false,
|
|
182
177
|
temporalAwarenessEnabled = false,
|
|
@@ -194,10 +189,7 @@ export function buildMagicContextSection(
|
|
|
194
189
|
// when ctx_reduce is off the subagent gets no §N§ prefix, so describing the
|
|
195
190
|
// tag system would be noise.
|
|
196
191
|
if (subagentMode) {
|
|
197
|
-
const intro =
|
|
198
|
-
preset === "light"
|
|
199
|
-
? SUBAGENT_REDUCE_INTRO_LIGHT(protectedTags)
|
|
200
|
-
: SUBAGENT_REDUCE_INTRO(protectedTags);
|
|
192
|
+
const intro = preset === "light" ? SUBAGENT_REDUCE_INTRO_LIGHT() : SUBAGENT_REDUCE_INTRO();
|
|
201
193
|
return `## Magic Context\n\n${intro}`;
|
|
202
194
|
}
|
|
203
195
|
const smartNoteGuidance = dreamerEnabled
|
|
@@ -227,7 +219,7 @@ export function buildMagicContextSection(
|
|
|
227
219
|
return `## Magic Context\n\n${LONG_TERM_PARTNER_FRAME}\n${PARTNER_FRAME_CLOSER_NO_REDUCE}\n\n${BASE_INTRO_NO_REDUCE(memoryEnabled)}${smartNoteGuidance}${temporalGuidance}${cavemanWarning}${languageGuidance}`;
|
|
228
220
|
}
|
|
229
221
|
if (preset === "light") {
|
|
230
|
-
return `## Magic Context\n\n${LONG_TERM_PARTNER_FRAME}\n${PARTNER_FRAME_CLOSER_REDUCE_LIGHT}\n\n${BASE_INTRO_LIGHT(
|
|
222
|
+
return `## Magic Context\n\n${LONG_TERM_PARTNER_FRAME}\n${PARTNER_FRAME_CLOSER_REDUCE_LIGHT}\n\n${BASE_INTRO_LIGHT(memoryEnabled)}${smartNoteGuidance}${temporalGuidance}${cavemanWarning}${languageGuidance}`;
|
|
231
223
|
}
|
|
232
|
-
return `## Magic Context\n\n${LONG_TERM_PARTNER_FRAME}\n${PARTNER_FRAME_CLOSER_REDUCE}\n\n${BASE_INTRO(
|
|
224
|
+
return `## Magic Context\n\n${LONG_TERM_PARTNER_FRAME}\n${PARTNER_FRAME_CLOSER_REDUCE}\n\n${BASE_INTRO(memoryEnabled)}${smartNoteGuidance}${temporalGuidance}${cavemanWarning}\n${GENERIC_SECTION}\n\nPrefer many small targeted operations over one large blanket operation, and keep the working set tidy as routine maintenance.${languageGuidance}`;
|
|
233
225
|
}
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
applyDisallowedTools,
|
|
5
5
|
buildAllowOnlyPermission,
|
|
6
6
|
HISTORIAN_ALLOWED_TOOLS,
|
|
7
|
-
SIDEKICK_ALLOWED_TOOLS,
|
|
8
7
|
} from "./permissions";
|
|
9
8
|
|
|
10
9
|
describe("buildAllowOnlyPermission", () => {
|
|
@@ -34,7 +33,7 @@ describe("buildAllowOnlyPermission", () => {
|
|
|
34
33
|
|
|
35
34
|
it("never accidentally allows `task`, `bash`, or `edit` unless explicitly listed", () => {
|
|
36
35
|
// The whole point of this helper is preventing historian / dreamer /
|
|
37
|
-
//
|
|
36
|
+
// hidden agents from inheriting the primary-agent surface. Lock that in.
|
|
38
37
|
const perm = buildAllowOnlyPermission(["read"]);
|
|
39
38
|
expect(perm.task).toBeUndefined();
|
|
40
39
|
expect(perm.bash).toBeUndefined();
|
|
@@ -174,36 +173,6 @@ describe("DREAMER_DOCS_ALLOWED_TOOLS (maintain-docs)", () => {
|
|
|
174
173
|
});
|
|
175
174
|
});
|
|
176
175
|
|
|
177
|
-
describe("SIDEKICK_ALLOWED_TOOLS", () => {
|
|
178
|
-
it("includes ctx_search but not ctx_memory for retrieval", () => {
|
|
179
|
-
// Sidekick is the /ctx-aug memory retriever. It searches memories without
|
|
180
|
-
// receiving the mutation-capable ctx_memory tool.
|
|
181
|
-
expect(SIDEKICK_ALLOWED_TOOLS).toContain("ctx_search");
|
|
182
|
-
expect(SIDEKICK_ALLOWED_TOOLS).not.toContain("ctx_memory");
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
it("includes `aft_outline` and `aft_zoom` for lightweight structural context", () => {
|
|
186
|
-
// Sidekick can pull file outline / symbol body when the user's
|
|
187
|
-
// prompt references a specific file or symbol, without dragging
|
|
188
|
-
// in whole files.
|
|
189
|
-
expect(SIDEKICK_ALLOWED_TOOLS).toContain("aft_outline");
|
|
190
|
-
expect(SIDEKICK_ALLOWED_TOOLS).toContain("aft_zoom");
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it("does NOT include `read` (use aft_outline/aft_zoom for navigation instead)", () => {
|
|
194
|
-
// Sidekick should pull symbol-scoped views, not arbitrary file
|
|
195
|
-
// contents. If it needs full source it can use aft_zoom on a
|
|
196
|
-
// specific symbol.
|
|
197
|
-
expect(SIDEKICK_ALLOWED_TOOLS).not.toContain("read");
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
it("does NOT include `task` or any edit / bash / web tool", () => {
|
|
201
|
-
for (const denied of ["task", "bash", "edit", "write", "webfetch", "websearch"]) {
|
|
202
|
-
expect(SIDEKICK_ALLOWED_TOOLS).not.toContain(denied);
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
|
|
207
176
|
describe("integration: full hidden-agent permission shape", () => {
|
|
208
177
|
it("historian permission object: `*` denied + read + aft_outline + aft_zoom + aft_search allowed", () => {
|
|
209
178
|
const perm = buildAllowOnlyPermission(HISTORIAN_ALLOWED_TOOLS);
|
|
@@ -239,14 +208,4 @@ describe("integration: full hidden-agent permission shape", () => {
|
|
|
239
208
|
aft_search: "allow",
|
|
240
209
|
});
|
|
241
210
|
});
|
|
242
|
-
|
|
243
|
-
it("sidekick permission object: `*` denied + read-only retrieval/navigation allowed", () => {
|
|
244
|
-
const perm = buildAllowOnlyPermission(SIDEKICK_ALLOWED_TOOLS);
|
|
245
|
-
expect(perm).toEqual({
|
|
246
|
-
"*": "deny",
|
|
247
|
-
ctx_search: "allow",
|
|
248
|
-
aft_outline: "allow",
|
|
249
|
-
aft_zoom: "allow",
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
211
|
});
|
|
@@ -5,7 +5,7 @@ import { log } from "../shared/logger";
|
|
|
5
5
|
*
|
|
6
6
|
* # Why this exists
|
|
7
7
|
*
|
|
8
|
-
* Hidden agents (`historian`, `historian-editor`, `dreamer
|
|
8
|
+
* Hidden agents (`historian`, `historian-editor`, `dreamer`) are
|
|
9
9
|
* registered with `mode: "primary"` and `hidden: true`: primary mode keeps
|
|
10
10
|
* them out of OpenCode's general Task candidate list, while hidden keeps them
|
|
11
11
|
* out of the UI picker. Those flags do NOT restrict which tools the spawned
|
|
@@ -63,13 +63,6 @@ import { log } from "../shared/logger";
|
|
|
63
63
|
* dreamer task variants. `task` / `edit` / `write` / `webfetch` /
|
|
64
64
|
* `websearch` remain denied — dreamer must not spawn subagents
|
|
65
65
|
* or commit changes.
|
|
66
|
-
*
|
|
67
|
-
* - **sidekick**: `ctx_search`, plus the read-only AFT
|
|
68
|
-
* navigation tools `aft_outline` and `aft_zoom`. Sidekick's job
|
|
69
|
-
* is augmenting user prompts via memory retrieval — see
|
|
70
|
-
* `features/magic-context/sidekick/agent.ts`. AFT navigation lets
|
|
71
|
-
* it pull symbol-scoped structural context for prompts that
|
|
72
|
-
* reference a specific file or symbol.
|
|
73
66
|
*/
|
|
74
67
|
|
|
75
68
|
/**
|
|
@@ -242,20 +235,6 @@ export function applyDisallowedTools(
|
|
|
242
235
|
// read/write/bash, no memory) — both in `dreamer.ts` alongside the other
|
|
243
236
|
// per-task allow-lists (mapper/classifier/etc).
|
|
244
237
|
|
|
245
|
-
/**
|
|
246
|
-
* Tools the sidekick agent needs. Sidekick is a read-only memory
|
|
247
|
-
* retriever for `/ctx-aug` — it queries the project's memory store
|
|
248
|
-
* through `ctx_search` only. Keep `ctx_memory` out of this list because
|
|
249
|
-
* its OpenCode tool definition is mutation-capable for primary agents.
|
|
250
|
-
*
|
|
251
|
-
* Also allow `aft_outline` and `aft_zoom` so sidekick can pull
|
|
252
|
-
* lightweight structural context about a file or symbol when the
|
|
253
|
-
* user's prompt references it directly — token-efficient navigation
|
|
254
|
-
* without dragging in whole files.
|
|
255
|
-
*
|
|
256
|
-
* Still denied: spawning subagents, edits, bash, web fetches.
|
|
257
|
-
*/
|
|
258
|
-
|
|
259
238
|
export const DREAMER_RETROSPECTIVE_ALLOWED_TOOLS = ["ctx_search"] as const;
|
|
260
239
|
|
|
261
240
|
/**
|
|
@@ -280,5 +259,3 @@ export const DREAMER_PRIMER_INVESTIGATOR_ALLOWED_TOOLS = [
|
|
|
280
259
|
* performed only when the compiled check runs through the host capability API.
|
|
281
260
|
*/
|
|
282
261
|
export const SMART_NOTE_COMPILER_ALLOWED_TOOLS = [] as const;
|
|
283
|
-
|
|
284
|
-
export const SIDEKICK_ALLOWED_TOOLS = ["ctx_search", "aft_outline", "aft_zoom"] as const;
|
|
@@ -12,10 +12,6 @@ export function isDreamerRunnable(config: { dreamer?: { disable?: boolean } | nu
|
|
|
12
12
|
return !!config.dreamer && config.dreamer.disable !== true;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export function isSidekickRunnable(config: { sidekick?: { disable?: boolean } | null }): boolean {
|
|
16
|
-
return !!config.sidekick && config.sidekick.disable !== true;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
15
|
export function isHistorianRunnable(config: { historian?: { disable?: boolean } | null }): boolean {
|
|
20
16
|
return config.historian?.disable !== true;
|
|
21
17
|
}
|
|
@@ -43,7 +39,7 @@ function clonePlainObject(value: unknown): Record<string, unknown> | undefined {
|
|
|
43
39
|
|
|
44
40
|
function migrateLegacyEnabledForAgent(args: {
|
|
45
41
|
patched: Record<string, unknown>;
|
|
46
|
-
agentName: "dreamer" | "
|
|
42
|
+
agentName: "dreamer" | "historian";
|
|
47
43
|
warnings: string[];
|
|
48
44
|
}): void {
|
|
49
45
|
const agent = clonePlainObject(args.patched[args.agentName]);
|
|
@@ -61,33 +57,21 @@ function migrateLegacyEnabledForAgent(args: {
|
|
|
61
57
|
return;
|
|
62
58
|
}
|
|
63
59
|
|
|
64
|
-
if (args.agentName === "dreamer") {
|
|
65
|
-
if (disable !== true && enabled === false) {
|
|
66
|
-
agent.disable = true;
|
|
67
|
-
args.warnings.push(
|
|
68
|
-
'Migrated "dreamer.enabled=false" → "dreamer.disable=true" in-memory (run doctor to persist). This now also disables manual /ctx-dream; for manual-only remove disable and set schedule="".',
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
// enabled=true is a no-op alias for the new default (disable=false); strip silently.
|
|
72
|
-
args.patched.dreamer = agent;
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
60
|
if (disable !== true && enabled === false) {
|
|
77
61
|
agent.disable = true;
|
|
78
62
|
args.warnings.push(
|
|
79
|
-
'Migrated "
|
|
63
|
+
'Migrated "dreamer.enabled=false" → "dreamer.disable=true" in-memory (run doctor to persist). This now also disables manual /ctx-dream; for manual-only remove disable and set schedule="".',
|
|
80
64
|
);
|
|
81
65
|
}
|
|
82
|
-
// enabled=true is a no-op alias for the new default; strip silently.
|
|
83
|
-
args.patched.
|
|
66
|
+
// enabled=true is a no-op alias for the new default (disable=false); strip silently.
|
|
67
|
+
args.patched.dreamer = agent;
|
|
84
68
|
}
|
|
85
69
|
|
|
86
70
|
export function migrateLegacyAgentEnabledInMemory(
|
|
87
71
|
rawConfig: Record<string, unknown>,
|
|
88
72
|
warnings: string[],
|
|
89
73
|
): Record<string, unknown> {
|
|
90
|
-
const shouldPatch = ["dreamer", "
|
|
74
|
+
const shouldPatch = ["dreamer", "historian"].some((key) => {
|
|
91
75
|
const agent = rawConfig[key];
|
|
92
76
|
return (
|
|
93
77
|
typeof agent === "object" &&
|
|
@@ -100,7 +84,6 @@ export function migrateLegacyAgentEnabledInMemory(
|
|
|
100
84
|
|
|
101
85
|
const patched: Record<string, unknown> = { ...rawConfig };
|
|
102
86
|
migrateLegacyEnabledForAgent({ patched, agentName: "dreamer", warnings });
|
|
103
|
-
migrateLegacyEnabledForAgent({ patched, agentName: "sidekick", warnings });
|
|
104
87
|
migrateLegacyEnabledForAgent({ patched, agentName: "historian", warnings });
|
|
105
88
|
return patched;
|
|
106
89
|
}
|