@cortexkit/opencode-magic-context 0.42.6 → 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 +4 -5
- 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 +1 -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 +12 -2
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-aktepwpz.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 +9 -2
- 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/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.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 +10 -6
- 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.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/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/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 -3
- package/dist/hooks/magic-context/cache-busting-signals.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 +8 -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 +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 +1 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-wire.d.ts +42 -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/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 +16 -0
- 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 +45 -10
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.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 +24 -3
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- 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 +37 -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-djp6rwz6.js → index-d0dh7v0f.js} +28130 -30282
- package/dist/{index-s61hh7gv.js → index-rpz2me0v.js} +94 -72
- package/dist/{index-ngjmj6xx.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-a9ssj59b.js → index-ykg9sdzz.js} +55 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5749 -3006
- 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/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 +86 -0
- package/dist/plugin/memory-id-translation.d.ts.map +1 -1
- 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/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-0xx1364v.js → recomp-orchestrator-6akjp11f.js} +8 -8
- package/dist/{send-session-notification-jbxknvar.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/conflict-detector.d.ts +9 -4
- 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 +15 -0
- package/dist/shared/opencode-db-path.d.ts.map +1 -1
- package/dist/shared/prompt-surface-runtime.d.ts +5 -5
- 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/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-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 +2 -0
- 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 +45 -1
- 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 +46 -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 +1 -0
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- 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 +58 -0
- 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.js +141678 -111890
- package/dist/v2/store-reader.d.ts +67 -1
- 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 +23 -0
- package/dist/v2/tui/index.d.ts.map +1 -1
- 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 +74 -6
- package/dist/v2/tui/types.d.ts.map +1 -1
- package/dist/wrapup-orchestrator-5akc87gr.js +16 -0
- package/package.json +8 -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 +8 -3
- 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/raw-loader.test.ts +1 -0
- package/src/config/schema/magic-context.test.ts +13 -5
- package/src/config/schema/magic-context.ts +101 -10
- 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/child-session-teardown.test.ts +38 -3
- package/src/shared/child-session-teardown.ts +3 -3
- package/src/shared/conflict-detector.test.ts +224 -7
- package/src/shared/conflict-detector.ts +161 -89
- 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.ts +5 -0
- package/src/shared/opencode-config-dir.ts +80 -7
- package/src/shared/opencode-db-path.test.ts +78 -0
- package/src/shared/opencode-db-path.ts +49 -2
- package/src/shared/opencode-host-generation.test.ts +29 -0
- package/src/shared/prompt-surface-a1-golden.md +142 -211
- 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/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 +57 -8
- package/src/v2/tui/index.ts +315 -59
- 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 +69 -4
- 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-4wwr6cz0.js +0 -112
- package/dist/index-avwt563y.js +0 -62
- package/dist/index-znraa0kv.js +0 -637
- package/dist/storage-meta-session-z818pn1e.js +0 -20
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
stripWellFormedLeadingTagPrefix,
|
|
67
67
|
} from "../hooks/magic-context/tag-content-primitives";
|
|
68
68
|
import type { TagTarget } from "../hooks/magic-context/tag-messages";
|
|
69
|
-
import type { Transcript, TranscriptPart } from "./transcript";
|
|
69
|
+
import type { Transcript, TranscriptMessage, TranscriptPart } from "./transcript";
|
|
70
70
|
|
|
71
71
|
export const TEXT_TAG_IDENTITY_MARKER = ":mc-text-v1:";
|
|
72
72
|
|
|
@@ -236,6 +236,8 @@ export function tagTranscript(
|
|
|
236
236
|
// atomicity we need. Removing the wrapper matches OpenCode's
|
|
237
237
|
// tag-messages.ts design — see the long comment there for the
|
|
238
238
|
// rationale (cache-bust amplifier story).
|
|
239
|
+
const conversationEnd = new ConversationEndGuard(transcript.messages);
|
|
240
|
+
|
|
239
241
|
for (let msgIndex = 0; msgIndex < transcript.messages.length; msgIndex += 1) {
|
|
240
242
|
const message = transcript.messages[msgIndex];
|
|
241
243
|
if (message === undefined) continue;
|
|
@@ -436,6 +438,7 @@ export function tagTranscript(
|
|
|
436
438
|
aggregate: existing,
|
|
437
439
|
targets,
|
|
438
440
|
timing,
|
|
441
|
+
conversationEnd,
|
|
439
442
|
});
|
|
440
443
|
if (part.kind === "tool_result") {
|
|
441
444
|
markToolAggregateResolved(
|
|
@@ -566,6 +569,7 @@ export function tagTranscript(
|
|
|
566
569
|
aggregate,
|
|
567
570
|
targets,
|
|
568
571
|
timing,
|
|
572
|
+
conversationEnd,
|
|
569
573
|
});
|
|
570
574
|
if (part.kind === "tool_result") {
|
|
571
575
|
markToolAggregateResolved(callId, aggregateKey, openToolAggregateKeysByCallId);
|
|
@@ -678,6 +682,56 @@ interface ApplyToolPrefixAndTargetArgs {
|
|
|
678
682
|
aggregate: ToolAggregate;
|
|
679
683
|
targets: Map<number, TagTarget>;
|
|
680
684
|
timing: TagTranscriptTiming | undefined;
|
|
685
|
+
conversationEnd: ConversationEndGuard;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
function partHasContent(part: TranscriptPart): boolean {
|
|
689
|
+
return part.kind !== "text" || (part.getText() ?? "").trim().length > 0;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Keeps structural tool removal from ending the provider request on an
|
|
694
|
+
* assistant turn, which models without assistant prefill support reject.
|
|
695
|
+
*
|
|
696
|
+
* The request ends with the newest message that has any content. Tool results
|
|
697
|
+
* there are what close the conversation with a user turn, so removal may take
|
|
698
|
+
* one only while that message keeps other content. Shared by every target one
|
|
699
|
+
* tagging pass builds, so drops earlier in the same pass count as removed.
|
|
700
|
+
*/
|
|
701
|
+
class ConversationEndGuard {
|
|
702
|
+
private readonly end: TranscriptMessage | undefined;
|
|
703
|
+
private readonly removed = new Set<unknown>();
|
|
704
|
+
|
|
705
|
+
constructor(messages: readonly TranscriptMessage[]) {
|
|
706
|
+
for (let index = messages.length - 1; index >= 0 && !this.end; index -= 1) {
|
|
707
|
+
const message = messages[index];
|
|
708
|
+
if (message?.parts.some(partHasContent)) this.end = message;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
wouldStrand(occurrences: readonly ToolOccurrence[]): boolean {
|
|
713
|
+
const end = this.end;
|
|
714
|
+
if (!end || !occurrences.some((occ) => occ.message === end)) return false;
|
|
715
|
+
const leaving = new Set(occurrences.map((occ) => partKey(occ.part)));
|
|
716
|
+
const survives = (part: TranscriptPart) =>
|
|
717
|
+
!leaving.has(partKey(part)) && !this.removed.has(partKey(part));
|
|
718
|
+
return end.info.role === "assistant"
|
|
719
|
+
? !end.parts.some((part) => part.kind === "tool_result" && survives(part))
|
|
720
|
+
: !end.parts.some((part) => partHasContent(part) && survives(part));
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
noteRemoved(occurrences: readonly ToolOccurrence[]): void {
|
|
724
|
+
for (const occ of occurrences) this.removed.add(partKey(occ.part));
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Adapters may hand out a fresh proxy object per read of `message.parts`, so
|
|
730
|
+
* tool parts are matched by kind and tool-call id; parts without an id fall
|
|
731
|
+
* back to object identity.
|
|
732
|
+
*/
|
|
733
|
+
function partKey(part: TranscriptPart): unknown {
|
|
734
|
+
return part.id === undefined ? part : `${part.kind}\u0000${part.id}`;
|
|
681
735
|
}
|
|
682
736
|
|
|
683
737
|
function applyToolPrefixAndTarget(args: ApplyToolPrefixAndTargetArgs): void {
|
|
@@ -693,6 +747,7 @@ function applyToolPrefixAndTarget(args: ApplyToolPrefixAndTargetArgs): void {
|
|
|
693
747
|
args.tagId,
|
|
694
748
|
args.aggregate.occurrences,
|
|
695
749
|
args.aggregate.requiresToolArcSkeleton,
|
|
750
|
+
args.conversationEnd,
|
|
696
751
|
),
|
|
697
752
|
);
|
|
698
753
|
if (args.timing) args.timing.targets += performance.now() - targetStart;
|
|
@@ -1030,11 +1085,60 @@ function buildAggregateTarget(
|
|
|
1030
1085
|
tagId: number,
|
|
1031
1086
|
occurrences: ToolOccurrence[],
|
|
1032
1087
|
requiresToolArcSkeleton: boolean,
|
|
1088
|
+
conversationEnd?: ConversationEndGuard,
|
|
1033
1089
|
): TagTarget {
|
|
1034
1090
|
const role = occurrences[0]?.message.info.role ?? "user";
|
|
1035
1091
|
const messageId = occurrences[0]?.message.info.id;
|
|
1036
1092
|
|
|
1093
|
+
const truncate = (): "truncated" | "absent" => {
|
|
1094
|
+
// Keep the tool call and its result, but replace the call arguments with
|
|
1095
|
+
// a non-executable marker and the result content with the dropped marker.
|
|
1096
|
+
const sentinel = `[dropped \u00a7${tagId}\u00a7]`;
|
|
1097
|
+
let any = false;
|
|
1098
|
+
for (const occ of occurrences) {
|
|
1099
|
+
if (occ.kind === "tool_use" && occ.part.setToolInput) {
|
|
1100
|
+
if (occ.part.setToolInput(droppedInputMarker(tagId))) any = true;
|
|
1101
|
+
} else if (setToolContentOrText(occ.part, sentinel)) {
|
|
1102
|
+
any = true;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
return any ? "truncated" : "absent";
|
|
1106
|
+
};
|
|
1107
|
+
|
|
1037
1108
|
return {
|
|
1109
|
+
measureReclaim(skeleton) {
|
|
1110
|
+
let beforeTools = 0;
|
|
1111
|
+
let afterTools = 0;
|
|
1112
|
+
const authorization = occurrences.map((occ) => occ.part.canRemove?.());
|
|
1113
|
+
const removable =
|
|
1114
|
+
!requiresToolArcSkeleton &&
|
|
1115
|
+
occurrences.every(
|
|
1116
|
+
(occ, index) =>
|
|
1117
|
+
occ.part.remove &&
|
|
1118
|
+
authorization[index] !== false &&
|
|
1119
|
+
authorization[index] !== "defer",
|
|
1120
|
+
);
|
|
1121
|
+
for (const occ of occurrences) {
|
|
1122
|
+
const before =
|
|
1123
|
+
occ.kind === "tool_use"
|
|
1124
|
+
? JSON.stringify(occ.part.getToolInput?.() ?? {})
|
|
1125
|
+
: (occ.part.getText() ?? "");
|
|
1126
|
+
beforeTools += estimateTokens(before);
|
|
1127
|
+
if (skeleton || !removable) {
|
|
1128
|
+
const after =
|
|
1129
|
+
occ.kind === "tool_use"
|
|
1130
|
+
? JSON.stringify(droppedInputMarker(tagId))
|
|
1131
|
+
: `[dropped §${tagId}§]`;
|
|
1132
|
+
afterTools += estimateTokens(after);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
return {
|
|
1136
|
+
beforeTools,
|
|
1137
|
+
afterTools: !skeleton && authorization.includes("defer") ? beforeTools : afterTools,
|
|
1138
|
+
beforeProse: 0,
|
|
1139
|
+
afterProse: 0,
|
|
1140
|
+
};
|
|
1141
|
+
},
|
|
1038
1142
|
setContent(content: string): boolean {
|
|
1039
1143
|
// Walk all occurrences; mutate every one. Return true if at
|
|
1040
1144
|
// least one occurrence's content actually changed (used to
|
|
@@ -1058,7 +1162,7 @@ function buildAggregateTarget(
|
|
|
1058
1162
|
}
|
|
1059
1163
|
return occurrences[0]?.part.getText() ?? null;
|
|
1060
1164
|
},
|
|
1061
|
-
drop(): "removed" | "absent" | "incomplete" {
|
|
1165
|
+
drop(): "removed" | "truncated" | "absent" | "incomplete" {
|
|
1062
1166
|
const complete =
|
|
1063
1167
|
occurrences.some((occ) => occ.kind === "tool_use") &&
|
|
1064
1168
|
occurrences.some((occ) => occ.kind === "tool_result");
|
|
@@ -1073,8 +1177,16 @@ function buildAggregateTarget(
|
|
|
1073
1177
|
(occ, index) => occ.part.remove && authorization[index] !== false,
|
|
1074
1178
|
)
|
|
1075
1179
|
) {
|
|
1180
|
+
// If removing this call's result would leave the provider
|
|
1181
|
+
// request ending on an assistant turn, keep a call skeleton
|
|
1182
|
+
// plus placeholder result instead. "truncated" tells callers
|
|
1183
|
+
// to persist that mode, so later passes serve the same bytes.
|
|
1184
|
+
// (The sentinel fallback below keeps call and result in place,
|
|
1185
|
+
// so it needs no exception.)
|
|
1186
|
+
if (conversationEnd?.wouldStrand(occurrences)) return truncate();
|
|
1076
1187
|
let removed = false;
|
|
1077
1188
|
for (const occ of occurrences) removed = occ.part.remove?.() || removed;
|
|
1189
|
+
if (removed) conversationEnd?.noteRemoved(occurrences);
|
|
1078
1190
|
return removed ? "removed" : "absent";
|
|
1079
1191
|
}
|
|
1080
1192
|
}
|
|
@@ -1086,20 +1198,7 @@ function buildAggregateTarget(
|
|
|
1086
1198
|
}
|
|
1087
1199
|
return any ? "removed" : "absent";
|
|
1088
1200
|
},
|
|
1089
|
-
truncate
|
|
1090
|
-
// Keep the paired call shell, but replace its arguments with one
|
|
1091
|
-
// non-executable marker; result halves carry the matching sentinel.
|
|
1092
|
-
const sentinel = `[dropped \u00a7${tagId}\u00a7]`;
|
|
1093
|
-
let any = false;
|
|
1094
|
-
for (const occ of occurrences) {
|
|
1095
|
-
if (occ.kind === "tool_use" && occ.part.setToolInput) {
|
|
1096
|
-
if (occ.part.setToolInput(droppedInputMarker(tagId))) any = true;
|
|
1097
|
-
} else if (setToolContentOrText(occ.part, sentinel)) {
|
|
1098
|
-
any = true;
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
return any ? "truncated" : "absent";
|
|
1102
|
-
},
|
|
1201
|
+
truncate,
|
|
1103
1202
|
editMarker(): "truncated" | "absent" {
|
|
1104
1203
|
// Edit-marker: preserve the tool_use input's filePath + a region
|
|
1105
1204
|
// hint of the diff, sentinelize the result half. Separate from
|
|
@@ -58,8 +58,16 @@ export function resolveTailHygieneStatus(
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* The reclaimable share and the two masses it is computed from.
|
|
63
|
+
*
|
|
64
|
+
* The tokenizer calibration makes `u` and `t` fractional, but a token count is
|
|
65
|
+
* a whole number to the reader: `63,063.522 tok` reads as a measurement error,
|
|
66
|
+
* not as precision. Both masses are rounded here, at the one formatter every
|
|
67
|
+
* host prints, so the dialog, the sidebar and Pi cannot disagree.
|
|
68
|
+
*/
|
|
61
69
|
export function formatTailHygiene(status: TailHygieneStatus): string {
|
|
62
70
|
const percentage = (status.severity * 100).toFixed(1);
|
|
63
71
|
const state = status.evaluable ? "" : " · held until baseline refresh";
|
|
64
|
-
return `${percentage}% · ${status.u.toLocaleString()} / ${status.t.toLocaleString()} tok${state}`;
|
|
72
|
+
return `${percentage}% · ${Math.round(status.u).toLocaleString()} / ${Math.round(status.t).toLocaleString()} tok${state}`;
|
|
65
73
|
}
|
|
@@ -64,10 +64,10 @@ describe("user-facing failure codes", () => {
|
|
|
64
64
|
"Finish the provider setup, or set a fallback provider in the embedding settings, then run /ctx-embed start again. (MC-E06)",
|
|
65
65
|
);
|
|
66
66
|
expect(renderUserFacingFailure("configuration_warning")).toContain(
|
|
67
|
-
"Fix the configuration warning shown in /ctx-status
|
|
67
|
+
"Fix the configuration warning shown in /ctx-status, then restart. (MC-S03)",
|
|
68
68
|
);
|
|
69
|
-
expect(renderUserFacingFailure("
|
|
70
|
-
"Run /ctx-recomp
|
|
69
|
+
expect(renderUserFacingFailure("partial_history_unavailable")).toContain(
|
|
70
|
+
"Run /ctx-recomp without a range. (MC-C06)",
|
|
71
71
|
);
|
|
72
72
|
});
|
|
73
73
|
|
|
@@ -92,7 +92,6 @@ describe("user-facing failure codes", () => {
|
|
|
92
92
|
"note_access",
|
|
93
93
|
"context_cleanup",
|
|
94
94
|
"partial_history",
|
|
95
|
-
"session_upgrade",
|
|
96
95
|
"smart_note_condition",
|
|
97
96
|
"history_compression",
|
|
98
97
|
"context_service",
|
|
@@ -7,6 +7,11 @@ export const USER_FACING_FAILURES = {
|
|
|
7
7
|
sentence: "History compression could not finish this turn.",
|
|
8
8
|
action: "It will retry automatically.",
|
|
9
9
|
},
|
|
10
|
+
hidden_cleanup_unbound: {
|
|
11
|
+
code: "MC-H02",
|
|
12
|
+
sentence: "Some finished background sessions could not be removed from this host.",
|
|
13
|
+
action: "They are removed automatically the next time Magic Context runs inside a registered OpenCode service.",
|
|
14
|
+
},
|
|
10
15
|
recomp_unavailable: {
|
|
11
16
|
code: "MC-R01",
|
|
12
17
|
sentence: "History compression could not be rebuilt.",
|
|
@@ -47,6 +52,17 @@ export const USER_FACING_FAILURES = {
|
|
|
47
52
|
sentence: "Memory maintenance could not finish.",
|
|
48
53
|
action: "Run /ctx-dream again.",
|
|
49
54
|
},
|
|
55
|
+
dreamer_tick_blocked: {
|
|
56
|
+
code: "MC-D09",
|
|
57
|
+
sentence:
|
|
58
|
+
"Background maintenance is not running: its last pass stopped before it reached the scheduled tasks.",
|
|
59
|
+
action: "It is retried automatically; if it keeps happening, check the Magic Context log for the stage that stopped and run `npx @cortexkit/magic-context doctor`.",
|
|
60
|
+
},
|
|
61
|
+
dream_task_needs_tool_loop: {
|
|
62
|
+
code: "MC-D08",
|
|
63
|
+
sentence: "Some memory maintenance tasks need a tool loop this host does not provide.",
|
|
64
|
+
action: "The remaining tasks still run; the listed ones are skipped on this host.",
|
|
65
|
+
},
|
|
50
66
|
embedding_substitution_rejected: {
|
|
51
67
|
code: "MC-E01",
|
|
52
68
|
sentence: "Search indexing could not use the selected model.",
|
|
@@ -120,7 +136,7 @@ export const USER_FACING_FAILURES = {
|
|
|
120
136
|
configuration_warning: {
|
|
121
137
|
code: "MC-S03",
|
|
122
138
|
sentence: "Some configuration settings could not be applied.",
|
|
123
|
-
action: "Fix the configuration warning shown in /ctx-status
|
|
139
|
+
action: "Fix the configuration warning shown in /ctx-status, then restart.",
|
|
124
140
|
},
|
|
125
141
|
status_log_unavailable: {
|
|
126
142
|
code: "MC-S04",
|
|
@@ -157,11 +173,6 @@ export const USER_FACING_FAILURES = {
|
|
|
157
173
|
sentence: "Partial history compression is not available in the current mode.",
|
|
158
174
|
action: "Run /ctx-recomp without a range.",
|
|
159
175
|
},
|
|
160
|
-
session_upgrade_unavailable: {
|
|
161
|
-
code: "MC-C07",
|
|
162
|
-
sentence: "Session upgrade is not available in the current mode.",
|
|
163
|
-
action: "Run /ctx-recomp instead.",
|
|
164
|
-
},
|
|
165
176
|
smart_note_conditions_unavailable: {
|
|
166
177
|
code: "MC-C08",
|
|
167
178
|
sentence: "Conditional notes are not available in the current mode.",
|
|
@@ -177,6 +188,12 @@ export const USER_FACING_FAILURES = {
|
|
|
177
188
|
sentence: "Magic Context is temporarily unavailable.",
|
|
178
189
|
action: "Retry in a moment.",
|
|
179
190
|
},
|
|
191
|
+
compaction_marker_missing: {
|
|
192
|
+
code: "MC-C11",
|
|
193
|
+
sentence:
|
|
194
|
+
"The history boundary marker is missing from the OpenCode store, so requests carry the full session.",
|
|
195
|
+
action: "It is retried on every message; if this persists, run `/ctx-flush`.",
|
|
196
|
+
},
|
|
180
197
|
memory_mirror_stalled: {
|
|
181
198
|
code: "MC-M01",
|
|
182
199
|
sentence: "Memory synchronization stopped before the host mirror caught up.",
|
|
@@ -187,6 +204,16 @@ export const USER_FACING_FAILURES = {
|
|
|
187
204
|
sentence: "Memory authority is inconsistent between the host and module.",
|
|
188
205
|
action: "Run `ck doctor drain-authority` before changing Rust mode.",
|
|
189
206
|
},
|
|
207
|
+
rust_mode_unsupported: {
|
|
208
|
+
code: "MC-S06",
|
|
209
|
+
sentence: "Experimental Rust transform mode is not available on this OpenCode host.",
|
|
210
|
+
action: 'Magic Context is running its TypeScript mode instead; set `transform_mode` to "ts" to stop requesting Rust.',
|
|
211
|
+
},
|
|
212
|
+
dreamer_task_failing: {
|
|
213
|
+
code: "MC-S05",
|
|
214
|
+
sentence: "A background maintenance task keeps failing on its schedule.",
|
|
215
|
+
action: "Check the Magic Context log for the failing task and its error.",
|
|
216
|
+
},
|
|
190
217
|
} as const;
|
|
191
218
|
|
|
192
219
|
export type UserFacingFailureKey = keyof typeof USER_FACING_FAILURES;
|
|
@@ -213,7 +240,6 @@ export type CapabilityRefusal =
|
|
|
213
240
|
| "note_access"
|
|
214
241
|
| "context_cleanup"
|
|
215
242
|
| "partial_history"
|
|
216
|
-
| "session_upgrade"
|
|
217
243
|
| "smart_note_condition"
|
|
218
244
|
| "history_compression"
|
|
219
245
|
| "context_service";
|
|
@@ -225,7 +251,6 @@ const CAPABILITY_FAILURES: Record<CapabilityRefusal, UserFacingFailureKey> = {
|
|
|
225
251
|
note_access: "note_access_unavailable",
|
|
226
252
|
context_cleanup: "context_cleanup_paused",
|
|
227
253
|
partial_history: "partial_history_unavailable",
|
|
228
|
-
session_upgrade: "session_upgrade_unavailable",
|
|
229
254
|
smart_note_condition: "smart_note_conditions_unavailable",
|
|
230
255
|
history_compression: "history_compression_paused",
|
|
231
256
|
context_service: "context_service_unavailable",
|
|
@@ -6,6 +6,7 @@ import { resolveLimit, resolveOutputReserve } from "./models-dev-cache";
|
|
|
6
6
|
import {
|
|
7
7
|
applyProvenInputFloor,
|
|
8
8
|
deriveWindowGeometry,
|
|
9
|
+
formatCompactTokens,
|
|
9
10
|
formatWindowDerivationLine,
|
|
10
11
|
parseWindowOverlay,
|
|
11
12
|
placeholderFilteredOutput,
|
|
@@ -372,15 +373,32 @@ describe("window geometry", () => {
|
|
|
372
373
|
}
|
|
373
374
|
});
|
|
374
375
|
|
|
375
|
-
test("
|
|
376
|
+
test("prints one line without the internal geometry tag or a second percentage", () => {
|
|
376
377
|
const result = deriveWindowGeometry("openai", "model", {
|
|
377
378
|
context: 204_000,
|
|
378
379
|
output: 30_600,
|
|
379
380
|
}) as NonNullable<ReturnType<typeof deriveWindowGeometry>>;
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
381
|
+
const line = formatWindowDerivationLine(105_900, result);
|
|
382
|
+
// The headline row above this line already carries the percentage, and
|
|
383
|
+
// the bracketed geometry mode is window-geometry's own vocabulary.
|
|
384
|
+
expect(line).not.toContain("%");
|
|
385
|
+
expect(line).not.toContain("[");
|
|
386
|
+
expect(line).not.toContain("—");
|
|
387
|
+
expect(line).toBe(
|
|
388
|
+
`105.9k / ${formatCompactTokens(result.usableSoft)} usable · window ${formatCompactTokens(result.derivation.window)} · ${formatCompactTokens(result.derivation.reserve)} output reserve`,
|
|
384
389
|
);
|
|
385
390
|
});
|
|
391
|
+
|
|
392
|
+
test("fits one line at the dialog's narrowest content width", () => {
|
|
393
|
+
// The narrowest dialog content width is 56 columns (an 88-column dialog
|
|
394
|
+
// less its padding); a longer line wraps onto a second row. The 1m
|
|
395
|
+
// window with a 128k output reserve is the shape the dialog shows.
|
|
396
|
+
const result = deriveWindowGeometry("openai", "model", {
|
|
397
|
+
context: 1_000_000,
|
|
398
|
+
output: 128_000,
|
|
399
|
+
}) as NonNullable<ReturnType<typeof deriveWindowGeometry>>;
|
|
400
|
+
const line = formatWindowDerivationLine(533_700, result);
|
|
401
|
+
expect(line).toBe("533.7k / 872k usable · window 1m · 128k output reserve");
|
|
402
|
+
expect(line.length).toBeLessThanOrEqual(56);
|
|
403
|
+
});
|
|
386
404
|
});
|
|
@@ -16,7 +16,12 @@ export const OPENCODE_OUTPUT_CAP = 32_000;
|
|
|
16
16
|
* real window, so every denominator check shares this one floor.
|
|
17
17
|
*/
|
|
18
18
|
export const MIN_PLAUSIBLE_CONTEXT_LIMIT = 1_024;
|
|
19
|
-
const OUTPUT_RESERVE_CAP_RATIO = 0.25;
|
|
19
|
+
export const OUTPUT_RESERVE_CAP_RATIO = 0.25;
|
|
20
|
+
|
|
21
|
+
/** Catalog output ceilings are not requested output; reserve at most a quarter of a shared window. */
|
|
22
|
+
export function catalogOutputReserve(window: number, output: number | undefined): number {
|
|
23
|
+
return Math.min(output ?? 0, Math.floor(window * OUTPUT_RESERVE_CAP_RATIO));
|
|
24
|
+
}
|
|
20
25
|
|
|
21
26
|
export type WindowGeometry = "shared_upfront" | "shared_truncating" | "separate";
|
|
22
27
|
export type WindowReserveSource = "output_catalog" | "output_config" | "wall_margin" | "none";
|
|
@@ -692,14 +697,19 @@ export function formatWindowDerivationLine(
|
|
|
692
697
|
inputTokens: number,
|
|
693
698
|
result: WindowGeometryResult,
|
|
694
699
|
): string {
|
|
695
|
-
const percentage = result.usableSoft > 0 ? (inputTokens / result.usableSoft) * 100 : 0;
|
|
696
700
|
const reserveLabel =
|
|
697
701
|
result.derivation.reserveSource === "wall_margin"
|
|
698
702
|
? "wall margin"
|
|
699
703
|
: result.derivation.reserveSource === "none"
|
|
700
704
|
? "reserve"
|
|
701
705
|
: "output reserve";
|
|
702
|
-
|
|
706
|
+
// One line at the dialog's narrowest width, and no geometry vocabulary: the
|
|
707
|
+
// bracketed derivation tag (`[shared_truncating]`) names an internal
|
|
708
|
+
// window-geometry mode, and the percentage is already on the headline row
|
|
709
|
+
// above this one. The `Context:` prefix is dropped for the same reason — it
|
|
710
|
+
// pushed the line past the narrowest dialog's content width, where it
|
|
711
|
+
// wrapped onto a second row.
|
|
712
|
+
return `${formatCompactTokens(inputTokens)} / ${formatCompactTokens(result.usableSoft)} usable · window ${formatCompactTokens(result.derivation.window)} · ${formatCompactTokens(result.derivation.reserve)} ${reserveLabel}`;
|
|
703
713
|
}
|
|
704
714
|
|
|
705
715
|
export function formatCompactTokens(value: number): string {
|
|
@@ -246,33 +246,68 @@ export async function requestRecomp(sessionId: string): Promise<boolean> {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
/**
|
|
250
|
-
*
|
|
251
|
-
export async function
|
|
249
|
+
/** Start a manual `/ctx-dream` run (optionally one named task) via RPC. The
|
|
250
|
+
* server starts the pass in the background and pushes the summary when done. */
|
|
251
|
+
export async function requestDream(sessionId: string, task?: string): Promise<boolean> {
|
|
252
252
|
if (!rpcClient) return false;
|
|
253
253
|
try {
|
|
254
|
-
const result = await rpcClient.call<{ ok: boolean }>("
|
|
254
|
+
const result = await rpcClient.call<{ ok: boolean }>("dream", {
|
|
255
|
+
sessionId,
|
|
256
|
+
...(task ? { task } : {}),
|
|
257
|
+
});
|
|
255
258
|
return result.ok ?? false;
|
|
256
259
|
} catch {
|
|
257
260
|
return false;
|
|
258
261
|
}
|
|
259
262
|
}
|
|
260
263
|
|
|
261
|
-
/**
|
|
262
|
-
*
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
/** What a command RPC reports back: finished text, an acknowledgement that
|
|
265
|
+
* background work started (no text yet), or the failure. */
|
|
266
|
+
export type CommandRpcResult =
|
|
267
|
+
| { ok: true; message?: string; started?: boolean }
|
|
268
|
+
| { ok: false; error?: string };
|
|
269
|
+
|
|
270
|
+
async function callCommandRpc(
|
|
271
|
+
method: string,
|
|
272
|
+
params: Record<string, unknown>,
|
|
273
|
+
): Promise<CommandRpcResult> {
|
|
274
|
+
if (!rpcClient) return { ok: false };
|
|
266
275
|
try {
|
|
267
|
-
const result = await rpcClient.call<
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
} catch {
|
|
272
|
-
return false;
|
|
276
|
+
const result = await rpcClient.call<CommandRpcResult>(method, params);
|
|
277
|
+
return result.ok === true
|
|
278
|
+
? result
|
|
279
|
+
: { ok: false, error: (result as { error?: string }).error };
|
|
280
|
+
} catch (error) {
|
|
281
|
+
return { ok: false, error: error instanceof Error ? error.message : String(error) };
|
|
273
282
|
}
|
|
274
283
|
}
|
|
275
284
|
|
|
285
|
+
/** Run `/ctx-flush` for the session: apply the queued operations now. */
|
|
286
|
+
export async function requestFlush(sessionId: string): Promise<CommandRpcResult> {
|
|
287
|
+
return callCommandRpc("flush", { sessionId });
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** Start `/ctx-wrapup`: compact the older live tail, keeping the newest N raw. */
|
|
291
|
+
export async function requestWrapup(
|
|
292
|
+
sessionId: string,
|
|
293
|
+
messagesToKeep: number,
|
|
294
|
+
): Promise<CommandRpcResult> {
|
|
295
|
+
return callCommandRpc("wrapup", { sessionId, messagesToKeep });
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** `/ctx-embed`: read coverage, or start/pause the history embedding drain. */
|
|
299
|
+
export async function requestEmbed(
|
|
300
|
+
sessionId: string,
|
|
301
|
+
action: "status" | "start" | "pause",
|
|
302
|
+
directory?: string,
|
|
303
|
+
): Promise<CommandRpcResult> {
|
|
304
|
+
return callCommandRpc("embed", {
|
|
305
|
+
sessionId,
|
|
306
|
+
action,
|
|
307
|
+
...(directory ? { directory } : {}),
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
|
|
276
311
|
/** Resolve global toast duration from server config via RPC. */
|
|
277
312
|
export async function loadToastDurationMs(): Promise<number> {
|
|
278
313
|
if (!rpcClient) return 5000;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Every `<text>` in the status dialog must set `fg`.
|
|
7
|
+
*
|
|
8
|
+
* A text element without it takes OpenTUI's default foreground, which is the
|
|
9
|
+
* terminal's default colour — on a light theme that is the same colour as the
|
|
10
|
+
* dialog's background, so the row renders as blank space. That is exactly how
|
|
11
|
+
* the old collapsed summary shipped: its rows carried no `fg` and the dialog
|
|
12
|
+
* looked empty. Nothing else catches it, because a colourless row still lays
|
|
13
|
+
* out, still has the right text, and only disappears on themes the author is
|
|
14
|
+
* not using.
|
|
15
|
+
*
|
|
16
|
+
* The check reads the source rather than a rendered frame because `fg` is set
|
|
17
|
+
* per element in this file; a row that loses it loses it here.
|
|
18
|
+
*/
|
|
19
|
+
const DIALOG_SOURCE = join(import.meta.dir, "status-dialog.tsx");
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Opening tags for `element`, terminated by the `>` that is not inside a JSX
|
|
23
|
+
* expression. Tracking brace depth keeps a `>` inside `fg={a > b ? x : y}` from
|
|
24
|
+
* ending the tag early.
|
|
25
|
+
*/
|
|
26
|
+
export function openingTags(source: string, element: string): string[] {
|
|
27
|
+
const tags: string[] = [];
|
|
28
|
+
const marker = `<${element}`;
|
|
29
|
+
let cursor = source.indexOf(marker);
|
|
30
|
+
while (cursor !== -1) {
|
|
31
|
+
let depth = 0;
|
|
32
|
+
let end = cursor + marker.length;
|
|
33
|
+
while (end < source.length) {
|
|
34
|
+
const character = source[end];
|
|
35
|
+
if (character === "{") depth += 1;
|
|
36
|
+
else if (character === "}") depth -= 1;
|
|
37
|
+
else if (character === ">" && depth === 0) break;
|
|
38
|
+
end += 1;
|
|
39
|
+
}
|
|
40
|
+
tags.push(source.slice(cursor, end + 1));
|
|
41
|
+
cursor = source.indexOf(marker, end);
|
|
42
|
+
}
|
|
43
|
+
return tags;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
test("every text row in the status dialog sets an explicit foreground colour", () => {
|
|
47
|
+
const source = readFileSync(DIALOG_SOURCE, "utf8");
|
|
48
|
+
const tags = openingTags(source, "text");
|
|
49
|
+
// A file that stopped containing text elements would pass the loop below
|
|
50
|
+
// without checking anything.
|
|
51
|
+
expect(tags.length).toBeGreaterThan(8);
|
|
52
|
+
expect(tags.filter((tag) => !tag.includes("fg="))).toEqual([]);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("the tag scanner does not stop at a > inside a JSX expression", () => {
|
|
56
|
+
const sample = "<text fg={a > b ? c : d}>x</text><text>y</text>";
|
|
57
|
+
expect(openingTags(sample, "text")).toEqual(["<text fg={a > b ? c : d}>", "<text>"]);
|
|
58
|
+
});
|