@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
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import type { StatusDetail } from "./rpc-types";
|
|
3
|
+
import {
|
|
4
|
+
buildStatusView,
|
|
5
|
+
distributeBarWidths,
|
|
6
|
+
STATUS_COLUMN_GAP,
|
|
7
|
+
type StatusViewSource,
|
|
8
|
+
statusColumnsFor,
|
|
9
|
+
statusSectionWidth,
|
|
10
|
+
} from "./status-view";
|
|
11
|
+
|
|
12
|
+
const NOW = 1_730_000_000_000;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A snapshot with every optional block present, so a row that disappears from
|
|
16
|
+
* the view shows up as a failure here rather than as an empty section.
|
|
17
|
+
*/
|
|
18
|
+
const SOURCE: StatusViewSource = {
|
|
19
|
+
usagePercentage: 71.4,
|
|
20
|
+
inputTokens: 623_000,
|
|
21
|
+
contextLimit: 872_000,
|
|
22
|
+
executeThreshold: 75,
|
|
23
|
+
executeThresholdClamped: false,
|
|
24
|
+
windowGeometry: {
|
|
25
|
+
usableSoft: 872_000,
|
|
26
|
+
usableHard: 900_000,
|
|
27
|
+
geometry: "shared_upfront",
|
|
28
|
+
derivation: {
|
|
29
|
+
window: 904_000,
|
|
30
|
+
reserve: 32_000,
|
|
31
|
+
reserveSource: "output_catalog",
|
|
32
|
+
geometry: "shared_upfront",
|
|
33
|
+
windowSource: "catalog",
|
|
34
|
+
absoluteWall: 904_000,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
tailHygiene: {
|
|
38
|
+
u: 14_400,
|
|
39
|
+
t: 48_000,
|
|
40
|
+
severity: 0.3,
|
|
41
|
+
evaluable: true,
|
|
42
|
+
reclaimableToolOutputCount: 3,
|
|
43
|
+
},
|
|
44
|
+
systemPromptTokens: 12_000,
|
|
45
|
+
docsTokens: 4_000,
|
|
46
|
+
compartmentTokens: 80_000,
|
|
47
|
+
compartmentCount: 12,
|
|
48
|
+
factTokens: 0,
|
|
49
|
+
memoryTokens: 6_000,
|
|
50
|
+
memoryBlockCount: 3,
|
|
51
|
+
profileTokens: 1_000,
|
|
52
|
+
conversationTokens: 400_000,
|
|
53
|
+
toolCallTokens: 100_000,
|
|
54
|
+
toolDefinitionTokens: 20_000,
|
|
55
|
+
activeTags: 4,
|
|
56
|
+
droppedTags: 1,
|
|
57
|
+
totalTags: 5,
|
|
58
|
+
activeBytes: 48_000,
|
|
59
|
+
lastNudgeTokens: 512_000,
|
|
60
|
+
pendingOpsCount: 2,
|
|
61
|
+
protectedTagCount: 3,
|
|
62
|
+
isSubagent: false,
|
|
63
|
+
cacheTtl: "1h",
|
|
64
|
+
cacheTtlSource: "config",
|
|
65
|
+
cacheTtlModelKey: "anthropic/claude-opus-5",
|
|
66
|
+
lastResponseTime: NOW - 42_000,
|
|
67
|
+
cacheRemainingMs: 252_000,
|
|
68
|
+
cacheExpired: false,
|
|
69
|
+
historyBlockTokens: 80_000,
|
|
70
|
+
compressionBudget: 120_000,
|
|
71
|
+
compressionUsage: "66%",
|
|
72
|
+
lastDreamerRunAt: NOW - 3 * 3_600_000,
|
|
73
|
+
memoryCount: 8,
|
|
74
|
+
sessionNoteCount: 2,
|
|
75
|
+
readySmartNoteCount: 1,
|
|
76
|
+
configParseFailures: [],
|
|
77
|
+
warnings: [],
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
function view(overrides: Partial<StatusViewSource> = {}) {
|
|
81
|
+
return buildStatusView({ ...SOURCE, ...overrides }, { version: "1.2.3", now: NOW });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function rowLabels(sectionTitle: string, overrides: Partial<StatusViewSource> = {}): string[] {
|
|
85
|
+
const section = view(overrides).sections.find((entry) => entry.title === sectionTitle);
|
|
86
|
+
if (!section) throw new Error(`missing section: ${sectionTitle}`);
|
|
87
|
+
return section.rows.map((row) => row.label);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
describe("status view model", () => {
|
|
91
|
+
test("shows dropped hidden-run variants as warnings", () => {
|
|
92
|
+
expect(
|
|
93
|
+
view({ hiddenVariantWarnings: ["variant 'medium' not offered by example/model"] })
|
|
94
|
+
.warnings,
|
|
95
|
+
).toContainEqual({
|
|
96
|
+
text: "variant 'medium' not offered by example/model",
|
|
97
|
+
tone: "warning",
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
test("names the sections in the order every host draws them", () => {
|
|
101
|
+
expect(view().sections.map((section) => section.title)).toEqual([
|
|
102
|
+
"Tags",
|
|
103
|
+
"Reductions",
|
|
104
|
+
"Pending Queue",
|
|
105
|
+
"Context Details",
|
|
106
|
+
"Cache TTL",
|
|
107
|
+
"History Compression",
|
|
108
|
+
"Memory",
|
|
109
|
+
]);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("carries the section rows the status view is made of", () => {
|
|
113
|
+
expect(rowLabels("Tags")).toEqual(["Active", "Dropped", "Total"]);
|
|
114
|
+
expect(rowLabels("Reductions")).toEqual(["Execute threshold", "Last reduce anchor"]);
|
|
115
|
+
expect(rowLabels("Pending Queue")).toEqual(["Drops", "Marker"]);
|
|
116
|
+
expect(rowLabels("Context Details")).toEqual(["Protected tags", "Subagent"]);
|
|
117
|
+
expect(rowLabels("Cache TTL")).toEqual([
|
|
118
|
+
"Configured",
|
|
119
|
+
"Last response",
|
|
120
|
+
"Remaining",
|
|
121
|
+
"Auto-execute",
|
|
122
|
+
]);
|
|
123
|
+
expect(rowLabels("History Compression")).toEqual(["History block", "Budget", "Dreamer"]);
|
|
124
|
+
expect(rowLabels("Memory")).toEqual(["Active", "Injected"]);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test("shows marker retry health only after the bounded budget is exhausted", () => {
|
|
128
|
+
const healthy = view({
|
|
129
|
+
compactionMarker: {
|
|
130
|
+
code: null,
|
|
131
|
+
attempts: 2,
|
|
132
|
+
lastError: "database is locked",
|
|
133
|
+
pendingSinceMs: NOW - 1_000,
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
const healthyMarker = healthy.sections
|
|
137
|
+
.find((section) => section.title === "Pending Queue")
|
|
138
|
+
?.rows.find((row) => row.label === "Marker");
|
|
139
|
+
expect(healthyMarker).toMatchObject({ value: "healthy", tone: "muted" });
|
|
140
|
+
expect(healthy.warnings).toEqual([]);
|
|
141
|
+
|
|
142
|
+
const exhausted = view({
|
|
143
|
+
compactionMarker: {
|
|
144
|
+
code: "MC-C11",
|
|
145
|
+
attempts: 3,
|
|
146
|
+
lastError: "database is locked",
|
|
147
|
+
pendingSinceMs: NOW - 2_000,
|
|
148
|
+
},
|
|
149
|
+
warnings: ["compaction_marker_missing"],
|
|
150
|
+
});
|
|
151
|
+
expect(JSON.stringify(exhausted)).toContain("MC-C11 · 3 attempts · database is locked");
|
|
152
|
+
expect(exhausted.warnings[0]?.text).toContain("3 attempts; last error: database is locked");
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test("drops the rows the single view no longer carries", () => {
|
|
156
|
+
const rendered = JSON.stringify(view());
|
|
157
|
+
// The Diagnostics split, the Logger block, the memory-importance
|
|
158
|
+
// histogram and the breakdown footnote all left with it.
|
|
159
|
+
for (const gone of [
|
|
160
|
+
"Diagnostics",
|
|
161
|
+
"Logger",
|
|
162
|
+
"Swallowed writes",
|
|
163
|
+
"Importance",
|
|
164
|
+
"unclassified of",
|
|
165
|
+
"Boundary",
|
|
166
|
+
"Coverage ordinal",
|
|
167
|
+
"includes reasoning",
|
|
168
|
+
]) {
|
|
169
|
+
expect(rendered).not.toContain(gone);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
test("gives every row, breakdown row and warning an explicit colour", () => {
|
|
174
|
+
const built = view({ warnings: ["transform_update_failed"] });
|
|
175
|
+
for (const section of built.sections) {
|
|
176
|
+
for (const row of section.rows) {
|
|
177
|
+
expect(typeof row.tone).toBe("string");
|
|
178
|
+
expect(row.tone.length).toBeGreaterThan(0);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
for (const row of built.breakdown) expect(row.color).toMatch(/^#[0-9a-f]{6}$/);
|
|
182
|
+
for (const warning of built.warnings) {
|
|
183
|
+
expect(["warning", "error"]).toContain(warning.tone);
|
|
184
|
+
}
|
|
185
|
+
expect(built.hygiene?.tone).toBe("accent");
|
|
186
|
+
expect(built.headline.left.tone).toBe("warning");
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
test("reserves a label column wide enough for the section's longest label", () => {
|
|
190
|
+
for (const section of view().sections) {
|
|
191
|
+
const longest = Math.max(...section.rows.map((row) => row.label.length));
|
|
192
|
+
expect(section.labelWidth).toBeGreaterThanOrEqual(longest);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
test("prints the remaining cache lifetime as one value, and omits it when there is none", () => {
|
|
197
|
+
const remaining = view()
|
|
198
|
+
.sections.find((section) => section.title === "Cache TTL")
|
|
199
|
+
?.rows.find((row) => row.label === "Remaining");
|
|
200
|
+
expect(remaining?.value).toBe("4m 12s");
|
|
201
|
+
|
|
202
|
+
// A cache that never expires has no countdown to print, so the row is
|
|
203
|
+
// absent rather than carrying a sentence about its own absence.
|
|
204
|
+
expect(rowLabels("Cache TTL", { cacheNeverExpires: true, cacheTtl: "never" })).toEqual([
|
|
205
|
+
"Configured",
|
|
206
|
+
"Last response",
|
|
207
|
+
"Auto-execute",
|
|
208
|
+
]);
|
|
209
|
+
expect(
|
|
210
|
+
rowLabels("Cache TTL", { cacheRemainingMs: Number.POSITIVE_INFINITY }),
|
|
211
|
+
).not.toContain("Remaining");
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
test("marks an expired cache on the Remaining row", () => {
|
|
215
|
+
const section = view({ cacheExpired: true, cacheRemainingMs: 0 }).sections.find(
|
|
216
|
+
(entry) => entry.title === "Cache TTL",
|
|
217
|
+
);
|
|
218
|
+
const remaining = section?.rows.find((row) => row.label === "Remaining");
|
|
219
|
+
expect({ value: remaining?.value, tone: remaining?.tone }).toEqual({
|
|
220
|
+
value: "expired",
|
|
221
|
+
tone: "warning",
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
test("headlines pressure against the threshold and the absolute token count", () => {
|
|
226
|
+
const built = view();
|
|
227
|
+
expect(built.headline.left.text).toBe("71.4% / 75%");
|
|
228
|
+
expect(built.headline.right.text).toBe("623K / 872K tokens");
|
|
229
|
+
expect(built.windowLine).toContain("usable");
|
|
230
|
+
expect(built.title).toBe("⚡ Magic Context Status");
|
|
231
|
+
expect(built.version).toBe("v1.2.3");
|
|
232
|
+
expect(built.footer).toBe("Esc to close");
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* The tokenizer calibration leaves the hygiene masses fractional. A token
|
|
237
|
+
* count is a whole number to the reader, so a raw `63,063.522` beside a
|
|
238
|
+
* `288,527.546` reads as a measurement error rather than as precision.
|
|
239
|
+
*/
|
|
240
|
+
test("prints the hygiene masses as whole token counts", () => {
|
|
241
|
+
const built = view({
|
|
242
|
+
tailHygiene: {
|
|
243
|
+
u: 63_063.522,
|
|
244
|
+
t: 288_527.546,
|
|
245
|
+
severity: 0.2186,
|
|
246
|
+
evaluable: true,
|
|
247
|
+
reclaimableToolOutputCount: 3,
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
expect(built.hygiene?.value).toBe("21.9% · 63,064 / 288,528 tok");
|
|
251
|
+
// The masses are whole numbers; only the percentage keeps a decimal.
|
|
252
|
+
const masses = (built.hygiene?.value ?? "").split("·")[1] ?? "";
|
|
253
|
+
expect(masses).not.toMatch(/\d\.\d/);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* A value never wraps, so a section needs `labelWidth + 1 + longest value`
|
|
258
|
+
* columns. The grid is drawn only when both columns' requirements plus the
|
|
259
|
+
* gap fit; otherwise the caller draws one column.
|
|
260
|
+
*/
|
|
261
|
+
test("draws two columns only when both columns' values fit", () => {
|
|
262
|
+
const sections = view().sections;
|
|
263
|
+
for (const section of sections) {
|
|
264
|
+
const longest = Math.max(...section.rows.map((row) => row.value.length));
|
|
265
|
+
expect(statusSectionWidth(section)).toBe(section.labelWidth + 1 + longest);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// The values the dialog actually prints at ~88 columns: the longest is
|
|
269
|
+
// `~98K tok (100% used)` in History Compression, so both columns fit.
|
|
270
|
+
const narrowValues = view({
|
|
271
|
+
cacheTtl: "never",
|
|
272
|
+
cacheTtlSource: "session",
|
|
273
|
+
compressionBudget: 98_000,
|
|
274
|
+
compressionUsage: "100%",
|
|
275
|
+
lastDreamerRunAt: NOW - 16 * 3_600_000,
|
|
276
|
+
lastNudgeTokens: 495_000,
|
|
277
|
+
}).sections;
|
|
278
|
+
const layout = statusColumnsFor(narrowValues, 84);
|
|
279
|
+
expect(layout.twoColumn).toBe(true);
|
|
280
|
+
expect(layout.leftWidth + layout.rightWidth + STATUS_COLUMN_GAP).toBeLessThanOrEqual(84);
|
|
281
|
+
// The columns are sized from these requirements, so a value in the wider
|
|
282
|
+
// column cannot wrap inside the narrower one.
|
|
283
|
+
expect(layout.leftWidth).toBe(
|
|
284
|
+
Math.max(...narrowValues.filter((_s, i) => i % 2 === 0).map(statusSectionWidth)),
|
|
285
|
+
);
|
|
286
|
+
expect(layout.rightWidth).toBe(
|
|
287
|
+
Math.max(...narrowValues.filter((_s, i) => i % 2 === 1).map(statusSectionWidth)),
|
|
288
|
+
);
|
|
289
|
+
|
|
290
|
+
// One column short of the two requirements plus the gap: no grid.
|
|
291
|
+
const needed = layout.leftWidth + layout.rightWidth + STATUS_COLUMN_GAP;
|
|
292
|
+
expect(statusColumnsFor(narrowValues, needed).twoColumn).toBe(true);
|
|
293
|
+
expect(statusColumnsFor(narrowValues, needed - 1).twoColumn).toBe(false);
|
|
294
|
+
|
|
295
|
+
// A long value — the model key on the Configured row — pushes the left
|
|
296
|
+
// column past what the dialog has, so the same sections go one column
|
|
297
|
+
// rather than wrapping that value mid-word.
|
|
298
|
+
expect(statusColumnsFor(sections, 84).twoColumn).toBe(false);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Rounding each segment's share on its own leaves the bar short of its
|
|
303
|
+
* container by up to one column per segment, which paints as blank cells
|
|
304
|
+
* between the coloured runs.
|
|
305
|
+
*/
|
|
306
|
+
test("distributes the bar width so the segments sum to the bar with no gap", () => {
|
|
307
|
+
const tokens = view().bar.map((segment) => segment.tokens);
|
|
308
|
+
for (const width of [20, 56, 84, 88, 120]) {
|
|
309
|
+
const widths = distributeBarWidths(tokens, width);
|
|
310
|
+
expect(widths.reduce((sum, value) => sum + value, 0)).toBe(width);
|
|
311
|
+
expect(widths.every((value) => value >= 1)).toBe(true);
|
|
312
|
+
}
|
|
313
|
+
// A category whose share rounds below a column still gets one, so the
|
|
314
|
+
// bar never drops a segment the legend below it lists.
|
|
315
|
+
const tiny = distributeBarWidths([1_000_000, 1], 40);
|
|
316
|
+
expect(tiny.reduce((sum, value) => sum + value, 0)).toBe(40);
|
|
317
|
+
expect(tiny[1]).toBe(1);
|
|
318
|
+
// Narrower than the number of categories: the leftmost ones keep a cell.
|
|
319
|
+
expect(distributeBarWidths([5, 4, 3, 2, 1], 3)).toEqual([1, 1, 1, 0, 0]);
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* The window line is one line at the dialog's narrowest width and carries no
|
|
324
|
+
* window-geometry vocabulary: the bracketed derivation tag names an internal
|
|
325
|
+
* mode, and the percentage is already on the headline row above it.
|
|
326
|
+
*/
|
|
327
|
+
test("prints the window line without the derivation tag or a second percentage", () => {
|
|
328
|
+
const line = view().windowLine ?? "";
|
|
329
|
+
expect(line).toBe("623k / 872k usable · window 904k · 32k output reserve");
|
|
330
|
+
expect(line).not.toContain("[");
|
|
331
|
+
expect(line).not.toContain("%");
|
|
332
|
+
// The narrowest dialog content width is 56 columns (an 88-column dialog
|
|
333
|
+
// less its padding); a longer line wraps onto a second row.
|
|
334
|
+
expect(line.length).toBeLessThanOrEqual(56);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* `Last response 180s ago` is a raw stopwatch reading; the sidebar and the
|
|
339
|
+
* Dreamer rows say `3m ago` for the same age.
|
|
340
|
+
*/
|
|
341
|
+
test("humanizes the last-response age like the other age rows", () => {
|
|
342
|
+
const row = (lastResponseTime: number) =>
|
|
343
|
+
view({ lastResponseTime })
|
|
344
|
+
.sections.find((section) => section.title === "Cache TTL")
|
|
345
|
+
?.rows.find((entry) => entry.label === "Last response")?.value;
|
|
346
|
+
expect(row(NOW - 180_000)).toBe("3m ago");
|
|
347
|
+
expect(row(NOW - 42_000)).toBe("just now");
|
|
348
|
+
expect(row(NOW - 2 * 3_600_000)).toBe("2h ago");
|
|
349
|
+
expect(row(0)).toBe("never");
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
test("breaks the context down by category, with counts and percentages", () => {
|
|
353
|
+
expect(view().breakdown.map((row) => `${row.label} ${row.value}`)).toEqual([
|
|
354
|
+
"System 12K (1.9%)",
|
|
355
|
+
"Docs 4K (0.6%)",
|
|
356
|
+
"Compartments (12) 80K (12.8%)",
|
|
357
|
+
"Memories (3) 6K (1.0%)",
|
|
358
|
+
"User Profile 1K (0.2%)",
|
|
359
|
+
"Conversation 400K (64.2%)",
|
|
360
|
+
"Tool Calls 100K (16.1%)",
|
|
361
|
+
"Tool Defs 20K (3.2%)",
|
|
362
|
+
]);
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
test("prints config parse failures and failure codes as the warning block", () => {
|
|
366
|
+
const built = view({
|
|
367
|
+
configParseFailures: [
|
|
368
|
+
{ kind: "invalid-leaf", path: "/tmp/magic-context.jsonc", detail: "bad" },
|
|
369
|
+
] as StatusDetail["configParseFailures"],
|
|
370
|
+
warnings: ["transform_update_failed"],
|
|
371
|
+
});
|
|
372
|
+
expect(built.warnings).toHaveLength(2);
|
|
373
|
+
expect(built.warnings[0]?.tone).toBe("error");
|
|
374
|
+
expect(built.warnings[1]?.text).toContain("MC-S02");
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
test("replaces the compaction machinery with knowledge counts when compaction is off", () => {
|
|
378
|
+
const built = view({ compactionEnabled: false });
|
|
379
|
+
expect(built.sections.map((section) => section.title)).toEqual(["Knowledge"]);
|
|
380
|
+
expect(built.headline.left.text).toContain("native compaction");
|
|
381
|
+
expect(built.sections[0]?.rows.map((row) => row.label)).toEqual([
|
|
382
|
+
"Memories",
|
|
383
|
+
"Notes",
|
|
384
|
+
"Smart Notes",
|
|
385
|
+
"Dreamer",
|
|
386
|
+
]);
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* "Nothing has run lately" and "the background maintenance never got to its
|
|
391
|
+
* work" used to look identical here — both were simply an old Dreamer
|
|
392
|
+
* timestamp. The blocked state gets its own row so they cannot be confused
|
|
393
|
+
* (issue 496).
|
|
394
|
+
*/
|
|
395
|
+
describe("blocked background maintenance", () => {
|
|
396
|
+
const failure = {
|
|
397
|
+
at: NOW - 2 * 3_600_000,
|
|
398
|
+
stage: "message-history maintenance",
|
|
399
|
+
message: "orphan sweep cannot read this host store",
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
test("has no row while the maintenance passes are completing", () => {
|
|
403
|
+
expect(rowLabels("History Compression")).not.toContain("Dreamer blocked");
|
|
404
|
+
expect(rowLabels("Knowledge", { compactionEnabled: false })).not.toContain(
|
|
405
|
+
"Dreamer blocked",
|
|
406
|
+
);
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
test("names the stage that stopped and carries its code", () => {
|
|
410
|
+
const row = view({ dreamerTickFailure: failure })
|
|
411
|
+
.sections.find((section) => section.title === "History Compression")
|
|
412
|
+
?.rows.find((entry) => entry.label === "Dreamer blocked");
|
|
413
|
+
expect(row?.value).toBe("message-history maintenance failed 2h ago (MC-D09)");
|
|
414
|
+
expect(row?.tone).toBe("error");
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
test("is drawn with compaction off too, where the Dreamer row also lives", () => {
|
|
418
|
+
expect(
|
|
419
|
+
rowLabels("Knowledge", { compactionEnabled: false, dreamerTickFailure: failure }),
|
|
420
|
+
).toContain("Dreamer blocked");
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
test("status displays adopted config generation and last reload failure without disabling the view", () => {
|
|
426
|
+
const result = view({
|
|
427
|
+
configGeneration: 3,
|
|
428
|
+
configAdoptedAt: NOW,
|
|
429
|
+
configReloadFailure: {
|
|
430
|
+
path: "/tmp/project/.cortexkit/magic-context.jsonc",
|
|
431
|
+
message: "invalid JSONC",
|
|
432
|
+
},
|
|
433
|
+
});
|
|
434
|
+
expect(result.sections.find((section) => section.title === "Config")?.rows[0]?.value).toContain(
|
|
435
|
+
"3 · adopted",
|
|
436
|
+
);
|
|
437
|
+
expect(result.warnings).toContainEqual({
|
|
438
|
+
text: "Config reload failed /tmp/project/.cortexkit/magic-context.jsonc: invalid JSONC",
|
|
439
|
+
tone: "error",
|
|
440
|
+
});
|
|
441
|
+
});
|