@cortexkit/opencode-magic-context 0.42.5 → 0.43.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 +6 -7
- package/dist/agents/dreamer.d.ts +7 -9
- package/dist/agents/dreamer.d.ts.map +1 -1
- package/dist/agents/hidden-agent-registrations.d.ts.map +1 -1
- package/dist/agents/magic-context-prompt.d.ts.map +1 -1
- package/dist/config/index.d.ts +10 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/live-run-config.d.ts +12 -0
- package/dist/config/live-run-config.d.ts.map +1 -0
- package/dist/config/live-snapshot.d.ts +32 -0
- package/dist/config/live-snapshot.d.ts.map +1 -0
- package/dist/config/schema/magic-context.d.ts +13 -2
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-jyj54gbe.js → conflict-warning-hook-t2vb0wnx.js} +3 -3
- package/dist/{derive-budgets-v1fkhjjr.js → derive-budgets-0sg5vp61.js} +5 -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 +6 -0
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +4 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-lease.d.ts +8 -0
- package/dist/features/magic-context/compartment-lease.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-storage.d.ts +21 -0
- package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
- package/dist/features/magic-context/context-authority.d.ts +37 -3
- 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/docs-proposals.d.ts +23 -0
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts +5 -1
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts +48 -0
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/manual-summary.d.ts +7 -0
- package/dist/features/magic-context/dreamer/manual-summary.d.ts.map +1 -0
- 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/promote-primers.d.ts +8 -1
- package/dist/features/magic-context/dreamer/promote-primers.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 +5 -2
- package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts +22 -13
- package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts +9 -0
- package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-config.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts +3 -0
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-prompts.d.ts +7 -4
- package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-registry.d.ts +53 -2
- package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +3 -0
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/tick-failure.d.ts +38 -0
- package/dist/features/magic-context/dreamer/tick-failure.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/search-git-commits.d.ts +2 -0
- package/dist/features/magic-context/git-commits/search-git-commits.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-identity.d.ts +1 -0
- package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-local.d.ts +1 -0
- package/dist/features/magic-context/memory/embedding-local.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-diagnostics.d.ts +6 -0
- package/dist/features/magic-context/memory/memory-diagnostics.d.ts.map +1 -0
- package/dist/features/magic-context/memory/memory-selection.d.ts +12 -0
- package/dist/features/magic-context/memory/memory-selection.d.ts.map +1 -0
- package/dist/features/magic-context/memory/memory-visibility.d.ts +46 -0
- package/dist/features/magic-context/memory/memory-visibility.d.ts.map +1 -0
- package/dist/features/magic-context/memory/mirror-reembed.d.ts +22 -0
- package/dist/features/magic-context/memory/mirror-reembed.d.ts.map +1 -0
- package/dist/features/magic-context/memory/project-identity.d.ts +9 -0
- package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/storage-memory-fts.d.ts +6 -2
- package/dist/features/magic-context/memory/storage-memory-fts.d.ts.map +1 -1
- package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
- package/dist/features/magic-context/memory/transformers-remote-host.d.ts +6 -0
- package/dist/features/magic-context/memory/transformers-remote-host.d.ts.map +1 -0
- package/dist/features/magic-context/memory/transformers-web-entry.d.ts.map +1 -1
- package/dist/features/magic-context/message-fts-rowid-map.d.ts +3 -1
- package/dist/features/magic-context/message-fts-rowid-map.d.ts.map +1 -1
- package/dist/features/magic-context/message-index-async.d.ts +8 -3
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +7 -1
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/message-time-backfill.d.ts +19 -0
- package/dist/features/magic-context/message-time-backfill.d.ts.map +1 -0
- package/dist/features/magic-context/migrations.d.ts +16 -0
- 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/storage-mural.d.ts +5 -0
- package/dist/features/magic-context/mural/storage-mural.d.ts.map +1 -1
- package/dist/features/magic-context/opencode2-relabel.d.ts +132 -0
- package/dist/features/magic-context/opencode2-relabel.d.ts.map +1 -0
- package/dist/features/magic-context/overflow-detection.d.ts +3 -0
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +1 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/protection-window.d.ts +1 -1
- package/dist/features/magic-context/protection-window.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +6 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/session-decision-calibration.d.ts +31 -0
- package/dist/features/magic-context/session-decision-calibration.d.ts.map +1 -0
- package/dist/features/magic-context/session-project-backfill.d.ts.map +1 -1
- package/dist/features/magic-context/shadow-backfill-state.d.ts +1 -1
- package/dist/features/magic-context/shadow-backfill-state.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts +5 -1
- package/dist/features/magic-context/smart-notes/compiler.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-historian-runs.d.ts +4 -2
- package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +16 -2
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta.d.ts +1 -1
- package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
- package/dist/features/magic-context/storage-notes.d.ts +1 -0
- package/dist/features/magic-context/storage-notes.d.ts.map +1 -1
- package/dist/features/magic-context/storage-replay-document.d.ts +2 -0
- package/dist/features/magic-context/storage-replay-document.d.ts.map +1 -1
- 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 +42 -4
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +2 -2
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/store-generation-rebase.d.ts +95 -0
- package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -0
- package/dist/features/magic-context/subagent-token-capture.d.ts +1 -0
- package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
- package/dist/features/magic-context/tagger.d.ts +2 -0
- package/dist/features/magic-context/tagger.d.ts.map +1 -1
- package/dist/features/magic-context/tool-definition-tokens.d.ts +1 -0
- package/dist/features/magic-context/tool-definition-tokens.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 +5 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/hooks/auto-update-checker/index.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts +10 -1
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +19 -4
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
- package/dist/hooks/magic-context/channel2-delivery.d.ts +8 -0
- package/dist/hooks/magic-context/channel2-delivery.d.ts.map +1 -1
- package/dist/hooks/magic-context/command-handler.d.ts +5 -4
- 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/compaction-off-transition.d.ts +1 -0
- package/dist/hooks/magic-context/compaction-off-transition.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-prompt.d.ts +1 -1
- package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-render-epoch.d.ts +3 -1
- package/dist/hooks/magic-context/compartment-render-epoch.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts +1 -1
- package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts +1 -0
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +19 -0
- 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 +19 -11
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts +4 -1
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/decay-render.d.ts +1 -0
- package/dist/hooks/magic-context/decay-render.d.ts.map +1 -1
- package/dist/hooks/magic-context/decision-calibration.d.ts +24 -0
- package/dist/hooks/magic-context/decision-calibration.d.ts.map +1 -0
- package/dist/hooks/magic-context/derive-budgets.d.ts +2 -0
- package/dist/hooks/magic-context/derive-budgets.d.ts.map +1 -1
- package/dist/hooks/magic-context/dropped-input-guard.d.ts +50 -4
- package/dist/hooks/magic-context/dropped-input-guard.d.ts.map +1 -1
- package/dist/hooks/magic-context/embed-history-runner.d.ts +30 -0
- package/dist/hooks/magic-context/embed-history-runner.d.ts.map +1 -0
- package/dist/hooks/magic-context/emergency-drop.d.ts +13 -8
- package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-payloads.d.ts +2 -1
- package/dist/hooks/magic-context/event-payloads.d.ts.map +1 -1
- package/dist/hooks/magic-context/execute-status.d.ts +2 -1
- package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +12 -4
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-no-fire-cause.d.ts +5 -0
- package/dist/hooks/magic-context/historian-no-fire-cause.d.ts.map +1 -0
- package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts +3 -0
- package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts +0 -3
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +4 -4
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/host-served-rows.d.ts +58 -0
- package/dist/hooks/magic-context/host-served-rows.d.ts.map +1 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts +38 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/legacy-compartments.d.ts +20 -0
- package/dist/hooks/magic-context/legacy-compartments.d.ts.map +1 -0
- package/dist/hooks/magic-context/live-session-state.d.ts +7 -7
- package/dist/hooks/magic-context/m0-token-breakdown.d.ts +6 -0
- package/dist/hooks/magic-context/m0-token-breakdown.d.ts.map +1 -1
- package/dist/hooks/magic-context/maintenance-authority.d.ts +0 -1
- package/dist/hooks/magic-context/maintenance-authority.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts +4 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts +24 -2
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-wire.d.ts +43 -1
- 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/postprocess-read-cache.d.ts +8 -0
- package/dist/hooks/magic-context/postprocess-read-cache.d.ts.map +1 -0
- package/dist/hooks/magic-context/producer-window-guard.d.ts +47 -1
- package/dist/hooks/magic-context/producer-window-guard.d.ts.map +1 -1
- package/dist/hooks/magic-context/producer-window-test-support.d.ts +14 -0
- package/dist/hooks/magic-context/producer-window-test-support.d.ts.map +1 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +2 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +51 -10
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +8 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-formatting.d.ts +6 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +4 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts +6 -0
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts +17 -39
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +51 -0
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-refusal-recovery.d.ts +28 -0
- package/dist/hooks/magic-context/rust-refusal-recovery.d.ts.map +1 -0
- package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +6 -7
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +21 -1
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +63 -0
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
- package/dist/hooks/magic-context/tokenizer-calibration.d.ts +19 -12
- package/dist/hooks/magic-context/tokenizer-calibration.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts +52 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-sweep-policy.d.ts +50 -0
- package/dist/hooks/magic-context/tool-sweep-policy.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +20 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts +9 -0
- package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +5 -3
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +44 -4
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
- package/dist/{index-f9gem5cr.js → index-8w1skpnm.js} +85 -5
- package/dist/index-99sfbrrf.js +170 -0
- package/dist/index-9skq8m9y.js +16 -0
- package/dist/{index-3wbd8sdq.js → index-d0dh7v0f.js} +28107 -29850
- package/dist/{index-d8mgqezq.js → index-rpz2me0v.js} +133 -78
- package/dist/{index-p474rw9p.js → index-rvwvdq59.js} +1 -1
- package/dist/index-w2ety11c.js +393 -0
- package/dist/index-y5145x8k.js +619 -0
- package/dist/index-ygwdyntq.js +5407 -0
- package/dist/{index-jkrqhc7y.js → index-ykg9sdzz.js} +147 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7065 -3197
- package/dist/message-time-backfill-gzjer78y.js +108 -0
- package/dist/plugin/dream-timer.d.ts +13 -0
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/embedding-bootstrap.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +5 -2
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/memory-id-translation.d.ts +109 -0
- package/dist/plugin/memory-id-translation.d.ts.map +1 -0
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts +10 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/plugin/rust-note-backend.d.ts +84 -0
- package/dist/plugin/rust-note-backend.d.ts.map +1 -0
- package/dist/plugin/rust-tool-backends.d.ts +1 -1
- package/dist/plugin/rust-tool-backends.d.ts.map +1 -1
- package/dist/plugin/tool-registry.d.ts +1 -0
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/read-session-chunk-ec3jkvhg.js +61 -0
- package/dist/{recomp-orchestrator-k20sfpm2.js → recomp-orchestrator-6akjp11f.js} +8 -8
- package/dist/{send-session-notification-xnypkxpx.js → send-session-notification-f6gwkesy.js} +2 -2
- package/dist/shared/assistant-message-extractor.d.ts +6 -0
- package/dist/shared/assistant-message-extractor.d.ts.map +1 -1
- package/dist/shared/auto-update-provenance.d.ts +9 -0
- package/dist/shared/auto-update-provenance.d.ts.map +1 -0
- package/dist/shared/conflict-detector.d.ts +14 -5
- package/dist/shared/conflict-detector.d.ts.map +1 -1
- package/dist/shared/hidden-variant-warnings.d.ts +5 -0
- package/dist/shared/hidden-variant-warnings.d.ts.map +1 -0
- package/dist/shared/host-limitations.d.ts +14 -0
- package/dist/shared/host-limitations.d.ts.map +1 -0
- 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.map +1 -1
- package/dist/shared/models-dev-cache.d.ts +1 -0
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/opencode-config-dir.d.ts +52 -0
- package/dist/shared/opencode-config-dir.d.ts.map +1 -1
- package/dist/shared/opencode-db-path.d.ts +46 -2
- package/dist/shared/opencode-db-path.d.ts.map +1 -1
- package/dist/shared/prompt-surface-runtime.d.ts +6 -6
- package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
- package/dist/shared/rpc-server.d.ts +10 -0
- package/dist/shared/rpc-server.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +64 -5
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/status-detail-text.d.ts +1 -3
- package/dist/shared/status-detail-text.d.ts.map +1 -1
- package/dist/shared/status-summary.d.ts +7 -0
- package/dist/shared/status-summary.d.ts.map +1 -1
- package/dist/shared/status-view.d.ts +229 -0
- package/dist/shared/status-view.d.ts.map +1 -0
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/shared/tail-hygiene-status.d.ts +8 -0
- package/dist/shared/tail-hygiene-status.d.ts.map +1 -1
- package/dist/shared/user-facing-codes.d.ts +32 -7
- package/dist/shared/user-facing-codes.d.ts.map +1 -1
- package/dist/shared/window-geometry.d.ts +3 -0
- package/dist/shared/window-geometry.d.ts.map +1 -1
- package/dist/{task-config-cv8k9y8r.js → task-config-ex4nt0q0.js} +1 -1
- package/dist/tools/ctx-expand/constants.d.ts +1 -1
- package/dist/tools/ctx-expand/constants.d.ts.map +1 -1
- package/dist/tools/ctx-expand/mode.d.ts +31 -0
- package/dist/tools/ctx-expand/mode.d.ts.map +1 -0
- package/dist/tools/ctx-expand/render.d.ts.map +1 -1
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/tools/ctx-memory/constants.d.ts +3 -1
- package/dist/tools/ctx-memory/constants.d.ts.map +1 -1
- package/dist/tools/ctx-memory/tools.d.ts +1 -0
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/tools/ctx-memory/types.d.ts +2 -2
- 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/render.d.ts +88 -0
- package/dist/tools/ctx-note/render.d.ts.map +1 -0
- package/dist/tools/ctx-note/tools.d.ts.map +1 -1
- package/dist/tools/ctx-note/types.d.ts +1 -1
- package/dist/tools/ctx-note/types.d.ts.map +1 -1
- package/dist/tools/ctx-reduce/constants.d.ts +1 -1
- package/dist/tools/ctx-reduce/constants.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/ctx-search/date-range.d.ts +9 -0
- package/dist/tools/ctx-search/date-range.d.ts.map +1 -0
- package/dist/tools/ctx-search/tools.d.ts.map +1 -1
- package/dist/tools/ctx-search/types.d.ts +3 -1
- package/dist/tools/ctx-search/types.d.ts.map +1 -1
- package/dist/tools/light-descriptions.d.ts +5 -5
- package/dist/tools/light-descriptions.d.ts.map +1 -1
- package/dist/tools/parameter-descriptions.d.ts +75 -0
- package/dist/tools/parameter-descriptions.d.ts.map +1 -0
- package/dist/transformers-node-wasm.js +1918 -826
- package/dist/transformers-web.js +1736 -636
- package/dist/{transformers.node-dpmf3wpx.js → transformers.node-3zqr6k1w.js} +4087 -2898
- package/dist/tui/data/context-db.d.ts +19 -7
- package/dist/tui/data/context-db.d.ts.map +1 -1
- package/dist/tui-compiled/data/context-db.d.ts +19 -7
- package/dist/tui-compiled/data/context-db.d.ts.map +1 -1
- package/dist/v2/fold/host-media.d.ts +36 -0
- package/dist/v2/fold/host-media.d.ts.map +1 -0
- package/dist/v2/fold/restore.d.ts +21 -1
- package/dist/v2/fold/restore.d.ts.map +1 -1
- package/dist/v2/hidden-completion.d.ts +114 -14
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hooks/commands.d.ts +29 -0
- package/dist/v2/hooks/commands.d.ts.map +1 -0
- package/dist/v2/hooks/context.d.ts +58 -2
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/deleted-session-tombstones.d.ts +10 -0
- package/dist/v2/hooks/deleted-session-tombstones.d.ts.map +1 -0
- package/dist/v2/hooks/dream-manual.d.ts +43 -0
- package/dist/v2/hooks/dream-manual.d.ts.map +1 -0
- package/dist/v2/hooks/dream-trigger.d.ts +7 -0
- package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
- package/dist/v2/hooks/hidden-child.d.ts +32 -0
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -0
- package/dist/v2/hooks/model-limit-cache.d.ts +19 -0
- package/dist/v2/hooks/model-limit-cache.d.ts.map +1 -0
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/hooks/provider-admission.d.ts +22 -0
- package/dist/v2/hooks/provider-admission.d.ts.map +1 -0
- package/dist/v2/hooks/rpc-live-state.d.ts +9 -0
- package/dist/v2/hooks/rpc-live-state.d.ts.map +1 -0
- package/dist/v2/hooks/store.d.ts +38 -2
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/hooks/tools.d.ts +8 -0
- package/dist/v2/hooks/tools.d.ts.map +1 -0
- package/dist/v2/hooks/types.d.ts +157 -19
- package/dist/v2/hooks/types.d.ts.map +1 -1
- package/dist/v2/hooks/usage-reading.d.ts +42 -0
- package/dist/v2/hooks/usage-reading.d.ts.map +1 -0
- package/dist/v2/host-service.d.ts +65 -0
- package/dist/v2/host-service.d.ts.map +1 -0
- package/dist/v2/server.d.ts +19 -0
- package/dist/v2/server.d.ts.map +1 -1
- package/dist/v2/server.js +141849 -110533
- package/dist/v2/store-reader.d.ts +78 -6
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/tui/events.d.ts +7 -0
- package/dist/v2/tui/events.d.ts.map +1 -0
- package/dist/v2/tui/index.d.ts +33 -0
- package/dist/v2/tui/index.d.ts.map +1 -0
- package/dist/v2/tui/sidebar-mount.d.ts +40 -0
- package/dist/v2/tui/sidebar-mount.d.ts.map +1 -0
- package/dist/v2/tui/status-dialog-mount.d.ts +29 -0
- package/dist/v2/tui/status-dialog-mount.d.ts.map +1 -0
- package/dist/v2/tui/types.d.ts +148 -0
- package/dist/v2/tui/types.d.ts.map +1 -0
- package/dist/wrapup-orchestrator-5akc87gr.js +16 -0
- package/package.json +9 -7
- package/src/agents/dreamer.ts +7 -16
- package/src/agents/hidden-agent-registrations.ts +10 -22
- package/src/agents/magic-context-prompt.test.ts +29 -39
- package/src/agents/magic-context-prompt.ts +99 -122
- package/src/agents/permissions.test.ts +17 -21
- package/src/config/index.ts +39 -4
- package/src/config/live-run-config.test.ts +237 -0
- package/src/config/live-run-config.ts +80 -0
- package/src/config/live-schema-drift.test.ts +67 -0
- package/src/config/live-snapshot.test.ts +85 -0
- package/src/config/live-snapshot.ts +191 -0
- package/src/config/protected-tokens.test.ts +40 -0
- package/src/config/raw-loader.test.ts +1 -0
- package/src/config/schema/magic-context.test.ts +13 -5
- package/src/config/schema/magic-context.ts +109 -13
- package/src/features/magic-context/dreamer/task-registry.ts +137 -13
- package/src/shared/assistant-message-extractor.test.ts +21 -0
- package/src/shared/assistant-message-extractor.ts +43 -8
- package/src/shared/auto-update-provenance.ts +42 -0
- package/src/shared/child-session-teardown.test.ts +38 -3
- package/src/shared/child-session-teardown.ts +3 -3
- package/src/shared/conflict-detector.test.ts +277 -7
- package/src/shared/conflict-detector.ts +221 -80
- package/src/shared/hidden-variant-warnings.ts +21 -0
- package/src/shared/host-limitations.ts +43 -0
- package/src/shared/keep-subagents.ts +6 -6
- package/src/shared/model-suggestion-retry.test.ts +43 -0
- package/src/shared/model-suggestion-retry.ts +12 -0
- package/src/shared/models-dev-cache.test.ts +25 -0
- package/src/shared/models-dev-cache.ts +5 -0
- package/src/shared/opencode-config-dir.ts +80 -7
- package/src/shared/opencode-db-path.test.ts +174 -0
- package/src/shared/opencode-db-path.ts +193 -15
- package/src/shared/opencode-host-generation.test.ts +29 -0
- package/src/shared/prompt-surface-a1-golden.md +142 -215
- package/src/shared/prompt-surface-runtime.test.ts +20 -0
- package/src/shared/prompt-surface-runtime.ts +7 -5
- package/src/shared/rpc-server.ts +18 -0
- package/src/shared/rpc-types.ts +63 -4
- package/src/shared/status-detail-text.test.ts +52 -18
- package/src/shared/status-detail-text.ts +1 -90
- package/src/shared/status-summary.ts +37 -2
- package/src/shared/status-view.test.ts +441 -0
- package/src/shared/status-view.ts +707 -0
- package/src/shared/tag-transcript.ts +115 -16
- package/src/shared/tail-hygiene-status.ts +9 -1
- package/src/shared/user-facing-codes.test.ts +3 -4
- package/src/shared/user-facing-codes.ts +33 -8
- package/src/shared/window-geometry.test.ts +23 -5
- package/src/shared/window-geometry.ts +13 -3
- package/src/tui/data/context-db.ts +50 -15
- package/src/tui/dialogs/status-dialog-colors.test.ts +58 -0
- package/src/tui/dialogs/status-dialog.tsx +288 -0
- package/src/tui/entry.mjs +11 -1
- package/src/tui/index.tsx +7 -464
- package/src/tui/slots/sidebar-content.tsx +21 -5
- package/src/tui-compiled/data/context-db.ts +50 -15
- package/src/tui-compiled/dialogs/status-dialog.tsx +552 -0
- package/src/tui-compiled/index.tsx +43 -1025
- package/src/tui-compiled/slots/sidebar-content.tsx +173 -152
- package/src/v2/tui/__fixtures__/ga-host-theme.json +160 -0
- package/src/v2/tui/events.ts +23 -0
- package/src/v2/tui/host-contract.test.ts +251 -0
- package/src/v2/tui/index.ts +526 -0
- package/src/v2/tui/load-compiled-sidebar.d.mts +59 -0
- package/src/v2/tui/load-compiled-sidebar.mjs +24 -0
- package/src/v2/tui/load-compiled-status-dialog.d.mts +17 -0
- package/src/v2/tui/load-compiled-status-dialog.mjs +16 -0
- package/src/v2/tui/sidebar-fallback.test.ts +100 -0
- package/src/v2/tui/sidebar-mount.ts +164 -0
- package/src/v2/tui/sidebar-text.test.ts +70 -0
- package/src/v2/tui/status-dialog-fallback.test.ts +97 -0
- package/src/v2/tui/status-dialog-mount.ts +76 -0
- package/src/v2/tui/theme-mapping.test.ts +57 -0
- package/src/v2/tui/types.ts +132 -0
- package/tui.js +1 -0
- package/dist/features/magic-context/memory/memory-migration.d.ts +0 -129
- package/dist/features/magic-context/memory/memory-migration.d.ts.map +0 -1
- package/dist/hooks/magic-context/upgrade-reminder.d.ts +0 -76
- package/dist/hooks/magic-context/upgrade-reminder.d.ts.map +0 -1
- package/dist/index-1ar7b3e9.js +0 -637
- package/dist/index-4wwr6cz0.js +0 -112
- package/dist/index-avwt563y.js +0 -62
- package/dist/storage-meta-session-x3j0q9qy.js +0 -20
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { hasLengthCappedOutput } from "./assistant-message-extractor";
|
|
3
|
+
|
|
4
|
+
describe("hasLengthCappedOutput", () => {
|
|
5
|
+
test("detects OpenCode assistant info.finish", () => {
|
|
6
|
+
expect(hasLengthCappedOutput([{ info: { role: "assistant", finish: "length" } }])).toBe(
|
|
7
|
+
true,
|
|
8
|
+
);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test("detects OpenCode step-finish reason", () => {
|
|
12
|
+
expect(
|
|
13
|
+
hasLengthCappedOutput([{ parts: [{ type: "step-finish", reason: "length" }] }]),
|
|
14
|
+
).toBe(true);
|
|
15
|
+
expect(hasLengthCappedOutput({ type: "text", reason: "length" })).toBe(false);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test("detects Pi stopReason length", () => {
|
|
19
|
+
expect(hasLengthCappedOutput({ role: "assistant", stopReason: "length" })).toBe(true);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -3,6 +3,8 @@ type MessageTime = { created?: number };
|
|
|
3
3
|
type MessageInfo = {
|
|
4
4
|
role?: string;
|
|
5
5
|
time?: MessageTime;
|
|
6
|
+
error?: unknown;
|
|
7
|
+
finish?: string;
|
|
6
8
|
};
|
|
7
9
|
|
|
8
10
|
type MessagePart = {
|
|
@@ -15,6 +17,11 @@ type SessionMessage = {
|
|
|
15
17
|
parts?: unknown;
|
|
16
18
|
};
|
|
17
19
|
|
|
20
|
+
export interface AssistantFailure {
|
|
21
|
+
error: unknown;
|
|
22
|
+
finish: string | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
import { isRecord } from "./record-type-guard";
|
|
19
26
|
|
|
20
27
|
function asSessionMessage(value: unknown): SessionMessage | null {
|
|
@@ -33,6 +40,15 @@ function asSessionMessage(value: unknown): SessionMessage | null {
|
|
|
33
40
|
: undefined,
|
|
34
41
|
}
|
|
35
42
|
: undefined,
|
|
43
|
+
error: info.error,
|
|
44
|
+
finish:
|
|
45
|
+
typeof info.finish === "string"
|
|
46
|
+
? info.finish
|
|
47
|
+
: typeof info.finish_reason === "string"
|
|
48
|
+
? info.finish_reason
|
|
49
|
+
: typeof info.finishReason === "string"
|
|
50
|
+
? info.finishReason
|
|
51
|
+
: undefined,
|
|
36
52
|
}
|
|
37
53
|
: undefined,
|
|
38
54
|
parts,
|
|
@@ -54,16 +70,20 @@ function getTextParts(message: SessionMessage): MessagePart[] {
|
|
|
54
70
|
.filter((part) => part.type === "text" && Boolean(part.text));
|
|
55
71
|
}
|
|
56
72
|
|
|
57
|
-
|
|
73
|
+
function getLatestAssistantMessage(messages: unknown): SessionMessage | null {
|
|
58
74
|
if (!Array.isArray(messages) || messages.length === 0) return null;
|
|
59
75
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
return (
|
|
77
|
+
messages
|
|
78
|
+
.map(asSessionMessage)
|
|
79
|
+
.filter((message): message is SessionMessage => message !== null)
|
|
80
|
+
.filter((message) => message.info?.role === "assistant")
|
|
81
|
+
.sort((a, b) => getCreatedTime(b) - getCreatedTime(a))[0] ?? null
|
|
82
|
+
);
|
|
83
|
+
}
|
|
65
84
|
|
|
66
|
-
|
|
85
|
+
export function extractLatestAssistantText(messages: unknown): string | null {
|
|
86
|
+
const latest = getLatestAssistantMessage(messages);
|
|
67
87
|
if (!latest) return null;
|
|
68
88
|
|
|
69
89
|
return (
|
|
@@ -73,12 +93,27 @@ export function extractLatestAssistantText(messages: unknown): string | null {
|
|
|
73
93
|
);
|
|
74
94
|
}
|
|
75
95
|
|
|
96
|
+
/** Return an error persisted on the newest assistant row, including its settlement reason. */
|
|
97
|
+
export function extractLatestAssistantFailure(messages: unknown): AssistantFailure | null {
|
|
98
|
+
const latest = getLatestAssistantMessage(messages);
|
|
99
|
+
if (!latest || latest.info?.error === undefined || latest.info.error === null) return null;
|
|
100
|
+
return {
|
|
101
|
+
error: latest.info.error,
|
|
102
|
+
finish: latest.info.finish ?? null,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
76
106
|
export function hasLengthCappedOutput(value: unknown): boolean {
|
|
77
107
|
if (Array.isArray(value)) return value.some((item) => hasLengthCappedOutput(item));
|
|
78
108
|
if (!isRecord(value)) return false;
|
|
79
109
|
|
|
80
110
|
if (value.length_capped === true || value.lengthCapped === true) return true;
|
|
81
|
-
const finishReason =
|
|
111
|
+
const finishReason =
|
|
112
|
+
value.finish_reason ??
|
|
113
|
+
value.finishReason ??
|
|
114
|
+
value.finish ??
|
|
115
|
+
(value.type === "step-finish" ? value.reason : undefined) ??
|
|
116
|
+
value.stopReason;
|
|
82
117
|
if (typeof finishReason === "string") {
|
|
83
118
|
const normalized = finishReason.toLowerCase();
|
|
84
119
|
if (
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
|
|
3
|
+
export const AUTO_UPDATE_CHECK_STATE_FILENAME = "last-update-check.json";
|
|
4
|
+
|
|
5
|
+
export interface AutoUpdateCheckState {
|
|
6
|
+
lastCheckedMs?: number;
|
|
7
|
+
updaterPinnedSpec?: string;
|
|
8
|
+
updaterPinnedAt?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function readAutoUpdateCheckState(path: string): AutoUpdateCheckState | null {
|
|
12
|
+
if (!existsSync(path)) return null;
|
|
13
|
+
try {
|
|
14
|
+
const value = JSON.parse(readFileSync(path, "utf-8")) as unknown;
|
|
15
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
16
|
+
const raw = value as Record<string, unknown>;
|
|
17
|
+
const state: AutoUpdateCheckState = {};
|
|
18
|
+
if (typeof raw.lastCheckedMs === "number" && Number.isFinite(raw.lastCheckedMs)) {
|
|
19
|
+
state.lastCheckedMs = raw.lastCheckedMs;
|
|
20
|
+
}
|
|
21
|
+
if (typeof raw.updaterPinnedSpec === "string" && raw.updaterPinnedSpec.length > 0) {
|
|
22
|
+
state.updaterPinnedSpec = raw.updaterPinnedSpec;
|
|
23
|
+
}
|
|
24
|
+
if (typeof raw.updaterPinnedAt === "number" && Number.isFinite(raw.updaterPinnedAt)) {
|
|
25
|
+
state.updaterPinnedAt = raw.updaterPinnedAt;
|
|
26
|
+
}
|
|
27
|
+
return state;
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function isUpdaterPinnedSpec(
|
|
34
|
+
state: AutoUpdateCheckState | null,
|
|
35
|
+
configuredSpec: string,
|
|
36
|
+
): boolean {
|
|
37
|
+
return (
|
|
38
|
+
state?.updaterPinnedSpec === configuredSpec &&
|
|
39
|
+
typeof state.updaterPinnedAt === "number" &&
|
|
40
|
+
Number.isFinite(state.updaterPinnedAt)
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -73,7 +73,22 @@ describe("teardownChildSession", () => {
|
|
|
73
73
|
expect(fixture.archived).toEqual([]);
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
test("
|
|
76
|
+
test("deletes a settled privacy child when keep_subagents is false", async () => {
|
|
77
|
+
const fixture = teardownFixture();
|
|
78
|
+
await teardownChildSession({
|
|
79
|
+
client: fixture.client,
|
|
80
|
+
sessionId: "settled-private",
|
|
81
|
+
promptSettled: true,
|
|
82
|
+
privacySensitive: true,
|
|
83
|
+
context: "private",
|
|
84
|
+
log: (message) => fixture.messages.push(message),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
expect(fixture.deleted).toEqual(["settled-private"]);
|
|
88
|
+
expect(fixture.archived).toEqual([]);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test("keeps both settled ordinary and privacy children under keep_subagents", async () => {
|
|
77
92
|
setKeepSubagents(true);
|
|
78
93
|
const ordinary = teardownFixture();
|
|
79
94
|
await teardownChildSession({
|
|
@@ -89,13 +104,33 @@ describe("teardownChildSession", () => {
|
|
|
89
104
|
const privacy = teardownFixture();
|
|
90
105
|
await teardownChildSession({
|
|
91
106
|
client: privacy.client,
|
|
92
|
-
sessionId: "
|
|
107
|
+
sessionId: "kept-private",
|
|
93
108
|
promptSettled: true,
|
|
94
109
|
privacySensitive: true,
|
|
95
110
|
context: "private",
|
|
96
111
|
log: (message) => privacy.messages.push(message),
|
|
97
112
|
});
|
|
98
|
-
expect(privacy.deleted).toEqual([
|
|
113
|
+
expect(privacy.deleted).toEqual([]);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test("leaves an unsettled privacy child to the sweep regardless of keep_subagents", async () => {
|
|
117
|
+
for (const keepSubagents of [false, true]) {
|
|
118
|
+
setKeepSubagents(keepSubagents);
|
|
119
|
+
const fixture = teardownFixture();
|
|
120
|
+
const sessionId = `unsettled-private-${keepSubagents}`;
|
|
121
|
+
await teardownChildSession({
|
|
122
|
+
client: fixture.client,
|
|
123
|
+
sessionId,
|
|
124
|
+
sessionDirectory: "/repo",
|
|
125
|
+
promptSettled: false,
|
|
126
|
+
privacySensitive: true,
|
|
127
|
+
context: "private",
|
|
128
|
+
log: (message) => fixture.messages.push(message),
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
expect(fixture.deleted).toEqual([]);
|
|
132
|
+
expect(fixture.archived).toEqual([sessionId]);
|
|
133
|
+
}
|
|
99
134
|
});
|
|
100
135
|
|
|
101
136
|
test("archives an unsettled child before logging, leaves it intact, then the age gate reaps it", async () => {
|
|
@@ -35,8 +35,7 @@ export interface TeardownChildSessionArgs {
|
|
|
35
35
|
* endpoint, although its generated TypeScript body type does not yet expose time.
|
|
36
36
|
*/
|
|
37
37
|
export async function teardownChildSession(args: TeardownChildSessionArgs): Promise<void> {
|
|
38
|
-
const { client, sessionId, sessionDirectory, promptSettled,
|
|
39
|
-
args;
|
|
38
|
+
const { client, sessionId, sessionDirectory, promptSettled, context, log } = args;
|
|
40
39
|
if (!sessionId) return;
|
|
41
40
|
|
|
42
41
|
const request: ChildSessionRequest = {
|
|
@@ -44,7 +43,8 @@ export async function teardownChildSession(args: TeardownChildSessionArgs): Prom
|
|
|
44
43
|
...(sessionDirectory ? { query: { directory: sessionDirectory } } : {}),
|
|
45
44
|
};
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
// Retention keeps every settled child; only unsettled children go to the age-gated sweep.
|
|
47
|
+
if (promptSettled && !shouldKeepSubagents()) {
|
|
48
48
|
await client.session.delete(request).catch((error: unknown) => {
|
|
49
49
|
log(`${context}: session cleanup failed: ${String(error)}`);
|
|
50
50
|
});
|
|
@@ -480,6 +480,59 @@ describe("detectConflicts", () => {
|
|
|
480
480
|
});
|
|
481
481
|
});
|
|
482
482
|
|
|
483
|
+
describe("OpenCode 2 compaction ownership", () => {
|
|
484
|
+
it("keeps MC enabled when host auto-compaction is on and never reads v1 prune", () => {
|
|
485
|
+
const previous = process.env.OPENCODE_DISABLE_AUTOCOMPACT;
|
|
486
|
+
delete process.env.OPENCODE_DISABLE_AUTOCOMPACT;
|
|
487
|
+
const resolved = {
|
|
488
|
+
auto: true,
|
|
489
|
+
get prune(): boolean {
|
|
490
|
+
throw new Error("v2 must not read compaction.prune");
|
|
491
|
+
},
|
|
492
|
+
keepTokens: 4_096,
|
|
493
|
+
buffer: 1_024,
|
|
494
|
+
};
|
|
495
|
+
const result = detectConflicts(projectDir, {
|
|
496
|
+
compactionEnabled: true,
|
|
497
|
+
hostGeneration: "v2",
|
|
498
|
+
resolvedCompaction: resolved,
|
|
499
|
+
});
|
|
500
|
+
expect(result.hasConflict).toBe(false);
|
|
501
|
+
expect(result.conflicts.compactionAuto).toBe(false);
|
|
502
|
+
expect(result.conflicts.compactionPrune).toBe(false);
|
|
503
|
+
expect(result.nativeCompaction).toEqual({ auto: true, prune: false });
|
|
504
|
+
if (previous === undefined) delete process.env.OPENCODE_DISABLE_AUTOCOMPACT;
|
|
505
|
+
else process.env.OPENCODE_DISABLE_AUTOCOMPACT = previous;
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
it("reads the GA v2 auto, keep.tokens, and buffer shape", async () => {
|
|
509
|
+
const result = await resolveCompactionForBoot(
|
|
510
|
+
{
|
|
511
|
+
config: {
|
|
512
|
+
get: async () => ({
|
|
513
|
+
data: {
|
|
514
|
+
compaction: {
|
|
515
|
+
auto: true,
|
|
516
|
+
keep: { tokens: 4_096 },
|
|
517
|
+
buffer: 1_024,
|
|
518
|
+
prune: true,
|
|
519
|
+
},
|
|
520
|
+
},
|
|
521
|
+
}),
|
|
522
|
+
},
|
|
523
|
+
},
|
|
524
|
+
2_000,
|
|
525
|
+
"v2",
|
|
526
|
+
);
|
|
527
|
+
expect(result).toEqual({
|
|
528
|
+
auto: true,
|
|
529
|
+
prune: false,
|
|
530
|
+
keepTokens: 4_096,
|
|
531
|
+
buffer: 1_024,
|
|
532
|
+
});
|
|
533
|
+
});
|
|
534
|
+
});
|
|
535
|
+
|
|
483
536
|
// --- Resolved-config arm (issue #309) ---
|
|
484
537
|
// The plugin boot now consumes the host's RESOLVED config
|
|
485
538
|
// (ctx.client.config.get()) instead of re-deriving compaction from files.
|
|
@@ -499,10 +552,14 @@ describe("detectConflicts", () => {
|
|
|
499
552
|
}
|
|
500
553
|
}
|
|
501
554
|
|
|
502
|
-
it("resolved auto=false
|
|
503
|
-
//
|
|
504
|
-
//
|
|
505
|
-
//
|
|
555
|
+
it("resolved auto=false outranks a file layer that says auto=true (#309)", () => {
|
|
556
|
+
// The file layer says auto=true, which on its own disables the
|
|
557
|
+
// plugin. The host's resolved config says auto=false, and the host
|
|
558
|
+
// is the authority — it can see layers the file reader cannot.
|
|
559
|
+
writeFileSync(
|
|
560
|
+
join(projectDir, "opencode.json"),
|
|
561
|
+
JSON.stringify({ compaction: { auto: true } }),
|
|
562
|
+
);
|
|
506
563
|
withoutAutoCompactEnv(() => {
|
|
507
564
|
const result = detectConflicts(projectDir, {
|
|
508
565
|
compactionEnabled: true,
|
|
@@ -539,8 +596,17 @@ describe("detectConflicts", () => {
|
|
|
539
596
|
});
|
|
540
597
|
|
|
541
598
|
it("resolved arm is skipped when resolvedCompaction is absent (file-based fallback unchanged)", () => {
|
|
542
|
-
// No resolvedCompaction → the file-based check runs
|
|
543
|
-
//
|
|
599
|
+
// No resolvedCompaction → the file-based check runs and owns the
|
|
600
|
+
// verdict. The written block is what makes the file arm say
|
|
601
|
+
// auto=true; it used to be an absent block relying on the file
|
|
602
|
+
// arm's default-on, which issue #484 removed because an absent
|
|
603
|
+
// block cannot tell "the user wrote nothing" apart from "we read
|
|
604
|
+
// the wrong directory". The claim under test is unchanged: with no
|
|
605
|
+
// resolved value the file arm decides, and its reason is unlabeled.
|
|
606
|
+
writeFileSync(
|
|
607
|
+
join(projectDir, "opencode.json"),
|
|
608
|
+
JSON.stringify({ compaction: { auto: true } }),
|
|
609
|
+
);
|
|
544
610
|
withoutAutoCompactEnv(() => {
|
|
545
611
|
const result = detectConflicts(projectDir, { compactionEnabled: true });
|
|
546
612
|
expect(result.conflicts.compactionAuto).toBe(true);
|
|
@@ -582,6 +648,166 @@ describe("detectConflicts", () => {
|
|
|
582
648
|
});
|
|
583
649
|
});
|
|
584
650
|
|
|
651
|
+
// --- OPENCODE_CONFIG_DIR is an ADDITION, not a replacement (issue #484) ---
|
|
652
|
+
//
|
|
653
|
+
// A launcher (Orca) exported OPENCODE_CONFIG_DIR to a directory holding
|
|
654
|
+
// only plugin scaffolding. OpenCode kept reading the user's real global
|
|
655
|
+
// config — `opencode debug config` showed compaction.auto=false — but the
|
|
656
|
+
// detector resolved the env directory INSTEAD of the global one, found no
|
|
657
|
+
// file, fell through to its default-on, and disabled the plugin.
|
|
658
|
+
//
|
|
659
|
+
// Verified against the opencode 1.18.30 binary and on a live host:
|
|
660
|
+
// `$XDG_CONFIG_HOME/opencode` is always read; `~/.opencode` is always
|
|
661
|
+
// scanned; `$OPENCODE_CONFIG_DIR` is appended LAST, so it wins ties but
|
|
662
|
+
// never hides the layers below it.
|
|
663
|
+
describe("OPENCODE_CONFIG_DIR is additive, not a replacement (issue #484)", () => {
|
|
664
|
+
let globalDir: string;
|
|
665
|
+
let launcherDir: string;
|
|
666
|
+
|
|
667
|
+
beforeEach(() => {
|
|
668
|
+
// These cases exercise compaction detection itself, so the suite's
|
|
669
|
+
// isolation env var has to go.
|
|
670
|
+
delete process.env.OPENCODE_DISABLE_AUTOCOMPACT;
|
|
671
|
+
// HOME is the temp dir and XDG_CONFIG_HOME is cleared by the suite
|
|
672
|
+
// beforeEach, so this is the same path OpenCode would compute.
|
|
673
|
+
globalDir = join(homeDir, ".config", "opencode");
|
|
674
|
+
mkdirSync(globalDir, { recursive: true });
|
|
675
|
+
// The reporter's launcher directory: plugin scaffolding, no config.
|
|
676
|
+
launcherDir = join(root, "launcher-config-dir");
|
|
677
|
+
mkdirSync(launcherDir, { recursive: true });
|
|
678
|
+
writeFileSync(
|
|
679
|
+
join(launcherDir, "package.json"),
|
|
680
|
+
JSON.stringify({ name: "launcher-scaffold", version: "1.0.0" }),
|
|
681
|
+
);
|
|
682
|
+
process.env.OPENCODE_CONFIG_DIR = launcherDir;
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
afterEach(() => {
|
|
686
|
+
delete process.env.OPENCODE_CONFIG;
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
function writeCompaction(dir: string, file: string, compaction: unknown): void {
|
|
690
|
+
mkdirSync(dir, { recursive: true });
|
|
691
|
+
writeFileSync(join(dir, file), JSON.stringify({ compaction }));
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
it("reporter repro: global auto=false + config-less OPENCODE_CONFIG_DIR → no conflict", () => {
|
|
695
|
+
writeCompaction(globalDir, "opencode.json", { auto: false });
|
|
696
|
+
const result = detectConflicts(projectDir, { compactionEnabled: true });
|
|
697
|
+
expect(result.conflicts.compactionAuto).toBe(false);
|
|
698
|
+
expect(result.hasConflict).toBe(false);
|
|
699
|
+
expect(result.nativeCompaction.auto).toBe(false);
|
|
700
|
+
});
|
|
701
|
+
|
|
702
|
+
it("positive control: global auto=true still reports the conflict", () => {
|
|
703
|
+
writeCompaction(globalDir, "opencode.json", { auto: true });
|
|
704
|
+
const result = detectConflicts(projectDir, { compactionEnabled: true });
|
|
705
|
+
expect(result.conflicts.compactionAuto).toBe(true);
|
|
706
|
+
expect(result.hasConflict).toBe(true);
|
|
707
|
+
expect(result.reasons.join("; ")).toContain("compaction.auto=true");
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
it("an OPENCODE_CONFIG_DIR that DOES carry auto=true outranks a global auto=false", () => {
|
|
711
|
+
writeCompaction(globalDir, "opencode.json", { auto: false });
|
|
712
|
+
writeCompaction(launcherDir, "opencode.json", { auto: true });
|
|
713
|
+
const result = detectConflicts(projectDir, { compactionEnabled: true });
|
|
714
|
+
expect(result.conflicts.compactionAuto).toBe(true);
|
|
715
|
+
expect(result.hasConflict).toBe(true);
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
it("an OPENCODE_CONFIG_DIR auto=false outranks a global auto=true", () => {
|
|
719
|
+
writeCompaction(globalDir, "opencode.json", { auto: true });
|
|
720
|
+
writeCompaction(launcherDir, "opencode.jsonc", { auto: false });
|
|
721
|
+
const result = detectConflicts(projectDir, { compactionEnabled: true });
|
|
722
|
+
expect(result.conflicts.compactionAuto).toBe(false);
|
|
723
|
+
expect(result.hasConflict).toBe(false);
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
it("v1 keeps global supplementary config above the project .opencode overlay", () => {
|
|
727
|
+
writeCompaction(launcherDir, "opencode.json", { auto: false });
|
|
728
|
+
writeCompaction(join(projectDir, ".opencode"), "opencode.json", { auto: true });
|
|
729
|
+
const result = detectConflicts(projectDir, {
|
|
730
|
+
compactionEnabled: true,
|
|
731
|
+
hostGeneration: "v1",
|
|
732
|
+
});
|
|
733
|
+
expect(result.nativeCompaction.auto).toBe(false);
|
|
734
|
+
expect(result.conflicts.compactionAuto).toBe(false);
|
|
735
|
+
});
|
|
736
|
+
|
|
737
|
+
it("v2 ranks the project .opencode overlay above global supplementary config", () => {
|
|
738
|
+
writeCompaction(launcherDir, "opencode.json", { auto: false });
|
|
739
|
+
writeCompaction(join(projectDir, ".opencode"), "opencode.json", { auto: true });
|
|
740
|
+
const result = detectConflicts(projectDir, {
|
|
741
|
+
compactionEnabled: true,
|
|
742
|
+
hostGeneration: "v2",
|
|
743
|
+
});
|
|
744
|
+
expect(result.nativeCompaction.auto).toBe(true);
|
|
745
|
+
expect(result.conflicts.compactionAuto).toBe(false);
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
it("reads the global directory's legacy config.json layer", () => {
|
|
749
|
+
writeCompaction(globalDir, "config.json", { auto: true });
|
|
750
|
+
const result = detectConflicts(projectDir, { compactionEnabled: true });
|
|
751
|
+
expect(result.conflicts.compactionAuto).toBe(true);
|
|
752
|
+
});
|
|
753
|
+
|
|
754
|
+
it("global opencode.jsonc overrides global opencode.json", () => {
|
|
755
|
+
writeCompaction(globalDir, "opencode.json", { auto: true });
|
|
756
|
+
writeCompaction(globalDir, "opencode.jsonc", { auto: false });
|
|
757
|
+
const result = detectConflicts(projectDir, { compactionEnabled: true });
|
|
758
|
+
expect(result.conflicts.compactionAuto).toBe(false);
|
|
759
|
+
expect(result.hasConflict).toBe(false);
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
it("~/.opencode outranks the global config directory", () => {
|
|
763
|
+
writeCompaction(globalDir, "opencode.json", { auto: false });
|
|
764
|
+
writeCompaction(join(homeDir, ".opencode"), "opencode.json", { auto: true });
|
|
765
|
+
const result = detectConflicts(projectDir, { compactionEnabled: true });
|
|
766
|
+
expect(result.conflicts.compactionAuto).toBe(true);
|
|
767
|
+
});
|
|
768
|
+
|
|
769
|
+
it("reads the $OPENCODE_CONFIG single-file override", () => {
|
|
770
|
+
const explicit = join(root, "explicit-opencode.json");
|
|
771
|
+
writeFileSync(explicit, JSON.stringify({ compaction: { auto: true } }));
|
|
772
|
+
process.env.OPENCODE_CONFIG = explicit;
|
|
773
|
+
const result = detectConflicts(projectDir, { compactionEnabled: true });
|
|
774
|
+
expect(result.conflicts.compactionAuto).toBe(true);
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
it("merges keys across layers instead of letting one file erase the other", () => {
|
|
778
|
+
writeCompaction(globalDir, "opencode.json", { auto: false });
|
|
779
|
+
writeCompaction(projectDir, "opencode.json", { prune: true });
|
|
780
|
+
const result = detectConflicts(projectDir, { compactionEnabled: true });
|
|
781
|
+
expect(result.nativeCompaction.auto).toBe(false);
|
|
782
|
+
expect(result.nativeCompaction.prune).toBe(true);
|
|
783
|
+
expect(result.conflicts.compactionAuto).toBe(false);
|
|
784
|
+
expect(result.conflicts.compactionPrune).toBe(true);
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
it("no compaction key in any readable layer is inconclusive, never a disable", () => {
|
|
788
|
+
// Nothing anywhere. OpenCode's own default is auto=true, but we
|
|
789
|
+
// cannot tell "the user wrote nothing" from "the value lives in a
|
|
790
|
+
// layer we cannot read" (managed/enterprise config, an org layer,
|
|
791
|
+
// a file we failed to parse). Guessing the disabling direction
|
|
792
|
+
// leaves NOTHING managing the window — the unrecoverable failure
|
|
793
|
+
// issue #309 established for the resolved arm.
|
|
794
|
+
const result = detectConflicts(projectDir, { compactionEnabled: true });
|
|
795
|
+
expect(result.conflicts.compactionAuto).toBe(false);
|
|
796
|
+
expect(result.conflicts.compactionPrune).toBe(false);
|
|
797
|
+
expect(result.hasConflict).toBe(false);
|
|
798
|
+
expect(result.nativeCompaction.auto).toBe(false);
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
it("still finds a conflicting plugin declared in the global config", () => {
|
|
802
|
+
writeFileSync(
|
|
803
|
+
join(globalDir, "opencode.json"),
|
|
804
|
+
JSON.stringify({ plugin: ["@tarquinen/opencode-dcp"] }),
|
|
805
|
+
);
|
|
806
|
+
const result = detectConflicts(projectDir, { compactionEnabled: true });
|
|
807
|
+
expect(result.conflicts.dcpPlugin).toBe(true);
|
|
808
|
+
});
|
|
809
|
+
});
|
|
810
|
+
|
|
585
811
|
// --- resolveCompactionForBoot (the resolved-config fetch helper) ---
|
|
586
812
|
describe("resolveCompactionForBoot", () => {
|
|
587
813
|
it("returns the resolved compaction block from the client", async () => {
|
|
@@ -596,6 +822,40 @@ describe("detectConflicts", () => {
|
|
|
596
822
|
expect(result).toEqual({ auto: false, prune: true });
|
|
597
823
|
});
|
|
598
824
|
|
|
825
|
+
it("resolves a host block that carries only compaction.auto (issue #484)", async () => {
|
|
826
|
+
// The shape opencode 1.18.30 actually serves for the ordinary
|
|
827
|
+
// `"compaction": { "auto": false }` config: OpenCode merges only
|
|
828
|
+
// the keys the user wrote and never materialises schema defaults,
|
|
829
|
+
// so `prune` is simply absent. Requiring it here used to reject
|
|
830
|
+
// this block and hand the decision to the file arm.
|
|
831
|
+
const client = {
|
|
832
|
+
config: {
|
|
833
|
+
get: async () => ({ data: { compaction: { auto: false } } }),
|
|
834
|
+
},
|
|
835
|
+
};
|
|
836
|
+
const result = await resolveCompactionForBoot(client);
|
|
837
|
+
expect(result).toEqual({ auto: false, prune: false });
|
|
838
|
+
});
|
|
839
|
+
|
|
840
|
+
it("resolves auto=true without prune and keeps it a conflict", async () => {
|
|
841
|
+
const client = {
|
|
842
|
+
config: {
|
|
843
|
+
get: async () => ({ data: { compaction: { auto: true } } }),
|
|
844
|
+
},
|
|
845
|
+
};
|
|
846
|
+
const resolved = await resolveCompactionForBoot(client);
|
|
847
|
+
expect(resolved).toEqual({ auto: true, prune: false });
|
|
848
|
+
// The suite beforeEach sets OPENCODE_DISABLE_AUTOCOMPACT, which
|
|
849
|
+
// short-circuits both arms; this case is about the verdict.
|
|
850
|
+
delete process.env.OPENCODE_DISABLE_AUTOCOMPACT;
|
|
851
|
+
const result = detectConflicts(projectDir, {
|
|
852
|
+
compactionEnabled: true,
|
|
853
|
+
resolvedCompaction: resolved ?? undefined,
|
|
854
|
+
});
|
|
855
|
+
expect(result.conflicts.compactionAuto).toBe(true);
|
|
856
|
+
expect(result.reasons.join("; ")).toContain("(resolved config)");
|
|
857
|
+
});
|
|
858
|
+
|
|
599
859
|
it("returns null when the compaction block is absent (file-based fallback, not host defaults)", async () => {
|
|
600
860
|
// An absent block means the response shape did not carry the resolved
|
|
601
861
|
// state (server version drift, a fetch racing boot) — NOT that the
|
|
@@ -612,7 +872,7 @@ describe("detectConflicts", () => {
|
|
|
612
872
|
expect(result).toBeNull();
|
|
613
873
|
});
|
|
614
874
|
|
|
615
|
-
it("returns null when compaction
|
|
875
|
+
it("returns null when compaction.auto is not an explicit boolean", async () => {
|
|
616
876
|
const client = {
|
|
617
877
|
config: {
|
|
618
878
|
get: async () => ({ data: { compaction: { auto: "true", prune: null } } }),
|
|
@@ -622,6 +882,16 @@ describe("detectConflicts", () => {
|
|
|
622
882
|
expect(result).toBeNull();
|
|
623
883
|
});
|
|
624
884
|
|
|
885
|
+
it("treats a non-boolean prune as false rather than discarding an explicit auto", async () => {
|
|
886
|
+
const client = {
|
|
887
|
+
config: {
|
|
888
|
+
get: async () => ({ data: { compaction: { auto: true, prune: "yes" } } }),
|
|
889
|
+
},
|
|
890
|
+
};
|
|
891
|
+
const result = await resolveCompactionForBoot(client);
|
|
892
|
+
expect(result).toEqual({ auto: true, prune: false });
|
|
893
|
+
});
|
|
894
|
+
|
|
625
895
|
it("returns null when the response data is missing entirely", async () => {
|
|
626
896
|
const client = {
|
|
627
897
|
config: {
|