@cortexkit/opencode-magic-context 0.41.4 → 0.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -3
- package/dist/agents/hidden-agent-registrations.d.ts +1 -3
- package/dist/agents/hidden-agent-registrations.d.ts.map +1 -1
- package/dist/agents/magic-context-prompt.d.ts +1 -1
- package/dist/agents/magic-context-prompt.d.ts.map +1 -1
- package/dist/agents/permissions.d.ts +1 -22
- package/dist/agents/permissions.d.ts.map +1 -1
- package/dist/config/agent-disable.d.ts +0 -5
- package/dist/config/agent-disable.d.ts.map +1 -1
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/migrate-config-location.d.ts.map +1 -1
- package/dist/config/project-security.d.ts +20 -2
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/removed-agent-config.d.ts +8 -0
- package/dist/config/removed-agent-config.d.ts.map +1 -0
- package/dist/config/schema/magic-context.d.ts +43 -201
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-ejkc9sjn.js → conflict-warning-hook-6p3xqeac.js} +3 -3
- package/dist/{derive-budgets-bc366cz8.js → derive-budgets-s2pgnnm4.js} +1 -1
- package/dist/features/builtin-commands/commands.d.ts +0 -4
- package/dist/features/builtin-commands/commands.d.ts.map +1 -1
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +15 -4
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
- package/dist/features/magic-context/context-authority.d.ts +31 -4
- package/dist/features/magic-context/context-authority.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/open-opencode-db.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts +19 -9
- package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +4 -0
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/fail-closed-block.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/sweep-coordinator.d.ts.map +1 -1
- package/dist/features/magic-context/index.d.ts +0 -1
- package/dist/features/magic-context/index.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-local.d.ts +13 -0
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-model-match.d.ts +41 -0
- package/dist/features/magic-context/memory/embedding-model-match.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-openai.d.ts +7 -20
- package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-provider.d.ts +2 -2
- package/dist/features/magic-context/memory/embedding-provider.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-synapse.d.ts +48 -14
- package/dist/features/magic-context/memory/embedding-synapse.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding.d.ts +1 -1
- package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
- package/dist/features/magic-context/memory/memory-migration.d.ts.map +1 -1
- package/dist/features/magic-context/memory/project-identity.d.ts +1 -0
- package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/promotion.d.ts +7 -1
- package/dist/features/magic-context/memory/promotion.d.ts.map +1 -1
- package/dist/features/magic-context/merged-reasoning-decisions.d.ts +6 -0
- package/dist/features/magic-context/merged-reasoning-decisions.d.ts.map +1 -0
- package/dist/features/magic-context/message-fts-rowid-map.d.ts.map +1 -1
- package/dist/features/magic-context/message-index-async.d.ts +12 -0
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
- package/dist/features/magic-context/mural/render-trigger.d.ts +6 -0
- package/dist/features/magic-context/mural/render-trigger.d.ts.map +1 -1
- package/dist/features/magic-context/no-content-compartment.d.ts +12 -0
- package/dist/features/magic-context/no-content-compartment.d.ts.map +1 -0
- package/dist/features/magic-context/pi-content-decisions.d.ts +9 -0
- package/dist/features/magic-context/pi-content-decisions.d.ts.map +1 -0
- package/dist/features/magic-context/project-docs-hash.d.ts +4 -0
- package/dist/features/magic-context/project-docs-hash.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +13 -4
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/protection-window.d.ts +79 -0
- package/dist/features/magic-context/protection-window.d.ts.map +1 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/session-project-backfill.d.ts.map +1 -1
- package/dist/features/magic-context/shadow-backfill-state.d.ts +26 -0
- package/dist/features/magic-context/shadow-backfill-state.d.ts.map +1 -0
- package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts +4 -0
- package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/storage.d.ts.map +1 -1
- package/dist/features/magic-context/storage-clone.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +1 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-embedding-measurements.d.ts +2 -2
- package/dist/features/magic-context/storage-embedding-measurements.d.ts.map +1 -1
- package/dist/features/magic-context/storage-historian-runs.d.ts +4 -0
- package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -1
- package/dist/features/magic-context/storage-memory-mutation-log.d.ts +1 -0
- package/dist/features/magic-context/storage-memory-mutation-log.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +79 -13
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta.d.ts +1 -1
- package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
- package/dist/features/magic-context/storage-native-replay.d.ts +29 -0
- package/dist/features/magic-context/storage-native-replay.d.ts.map +1 -0
- package/dist/features/magic-context/storage-notes.d.ts +6 -0
- package/dist/features/magic-context/storage-notes.d.ts.map +1 -1
- package/dist/features/magic-context/storage-replay-document.d.ts +33 -0
- package/dist/features/magic-context/storage-replay-document.d.ts.map +1 -0
- package/dist/features/magic-context/storage-subagent-invocations.d.ts +1 -1
- package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +19 -11
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +3 -3
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
- package/dist/features/magic-context/tagger.d.ts +13 -0
- package/dist/features/magic-context/tagger.d.ts.map +1 -1
- package/dist/features/magic-context/tool-owner-backfill.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -1
- package/dist/features/magic-context/workspaces.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts +11 -5
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +9 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
- package/dist/hooks/magic-context/caveman-cleanup.d.ts +1 -1
- package/dist/hooks/magic-context/caveman-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/channel2-delivery.d.ts.map +1 -1
- package/dist/hooks/magic-context/child-session-spawn.d.ts +3 -3
- package/dist/hooks/magic-context/child-session-spawn.d.ts.map +1 -1
- package/dist/hooks/magic-context/command-handler.d.ts +1 -10
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts +10 -21
- package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-partial-recomp.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-validation.d.ts +1 -1
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts +26 -2
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts.map +1 -1
- package/dist/hooks/magic-context/decay-render.d.ts.map +1 -1
- package/dist/hooks/magic-context/dropped-input-guard.d.ts +9 -0
- package/dist/hooks/magic-context/dropped-input-guard.d.ts.map +1 -0
- package/dist/hooks/magic-context/embed-session-state.d.ts +1 -1
- package/dist/hooks/magic-context/embed-session-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-drop.d.ts +6 -1
- package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts +0 -1
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-payloads.d.ts +7 -6
- package/dist/hooks/magic-context/event-payloads.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/execute-status.d.ts +3 -1
- package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/format-embed-failure.d.ts +2 -1
- package/dist/hooks/magic-context/format-embed-failure.d.ts.map +1 -1
- package/dist/hooks/magic-context/format-embed-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts +7 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook-handlers.d.ts +3 -1
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +13 -4
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +14 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/live-session-state.d.ts +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts +34 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/maintenance-authority.d.ts +2 -2
- package/dist/hooks/magic-context/maintenance-authority.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-state-sync-timing.d.ts +21 -0
- package/dist/hooks/magic-context/module-state-sync-timing.d.ts.map +1 -0
- package/dist/hooks/magic-context/module-state-sync.d.ts +21 -7
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts +12 -0
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-wire.d.ts +8 -0
- package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
- package/dist/hooks/magic-context/note-nudger.d.ts.map +1 -1
- package/dist/hooks/magic-context/persist-filtered-noise.d.ts +5 -0
- package/dist/hooks/magic-context/persist-filtered-noise.d.ts.map +1 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +6 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +18 -18
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +22 -12
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-formatting.d.ts +8 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +10 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/hooks/magic-context/reference-retrieval.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +74 -9
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts +11 -10
- package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
- package/dist/hooks/magic-context/strip-content.d.ts +7 -0
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/supersession-reclaim.d.ts +13 -0
- package/dist/hooks/magic-context/supersession-reclaim.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +2 -3
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +8 -3
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts +7 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +11 -4
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +7 -2
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/upgrade-reminder.d.ts +7 -9
- package/dist/hooks/magic-context/upgrade-reminder.d.ts.map +1 -1
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
- package/dist/index-1974jvn3.js +783 -0
- package/dist/{index-0y2mcg5y.js → index-1q9kay7n.js} +18717 -16197
- package/dist/{index-4avmwfp5.js → index-36wd1d6k.js} +6 -29
- package/dist/{index-fz104x1j.js → index-jmtjh2d3.js} +3 -3
- package/dist/{index-q264erdp.js → index-nqgjwfzn.js} +70 -38
- package/dist/{index-mjv9je4e.js → index-xdtge3y2.js} +45 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6457 -5190
- package/dist/plugin/conflict-warning-hook.d.ts +5 -6
- package/dist/plugin/conflict-warning-hook.d.ts.map +1 -1
- package/dist/plugin/dream-timer.d.ts +1 -0
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/embedding-bootstrap-helpers.d.ts.map +1 -1
- package/dist/plugin/embedding-routing.d.ts +4 -1
- package/dist/plugin/embedding-routing.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +16 -2
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts +31 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/plugin/rust-tool-backends.d.ts +1 -0
- package/dist/plugin/rust-tool-backends.d.ts.map +1 -1
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/{recomp-orchestrator-q98r6rga.js → recomp-orchestrator-m33b3rk9.js} +5 -5
- package/dist/{send-session-notification-hdh02wy9.js → send-session-notification-1qeqkswb.js} +6 -4
- package/dist/shared/child-session-teardown.d.ts +34 -0
- package/dist/shared/child-session-teardown.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 +1 -1
- package/dist/shared/opencode-db-path.d.ts +24 -0
- package/dist/shared/opencode-db-path.d.ts.map +1 -0
- package/dist/shared/prompt-surface-runtime.d.ts +10 -5
- package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
- package/dist/shared/resolve-fallbacks.d.ts +1 -1
- package/dist/shared/rpc-types.d.ts +121 -0
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/sqlite.d.ts +42 -0
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/status-detail-text.d.ts +3 -1
- package/dist/shared/status-detail-text.d.ts.map +1 -1
- package/dist/shared/status-summary.d.ts +30 -0
- package/dist/shared/status-summary.d.ts.map +1 -0
- package/dist/shared/subagent-runner.d.ts +17 -10
- package/dist/shared/subagent-runner.d.ts.map +1 -1
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/shared/tail-hygiene-status.d.ts +1 -0
- package/dist/shared/tail-hygiene-status.d.ts.map +1 -1
- package/dist/shared/transcript.d.ts +6 -0
- package/dist/shared/transcript.d.ts.map +1 -1
- package/dist/shared/user-facing-codes.d.ts +191 -0
- package/dist/shared/user-facing-codes.d.ts.map +1 -0
- package/dist/shared/window-geometry.d.ts +23 -0
- package/dist/shared/window-geometry.d.ts.map +1 -1
- package/dist/shared/write-transaction-timing.d.ts +1 -1
- package/dist/shared/write-transaction-timing.d.ts.map +1 -1
- package/dist/{storage-meta-session-dvwfw778.js → storage-meta-session-e6g0mmec.js} +2 -2
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/tools/ctx-memory/verification-recording.d.ts.map +1 -1
- package/dist/tools/ctx-note/constants.d.ts +1 -1
- package/dist/tools/ctx-note/constants.d.ts.map +1 -1
- package/dist/tools/ctx-note/tools.d.ts.map +1 -1
- package/dist/tools/ctx-note/types.d.ts +1 -0
- package/dist/tools/ctx-note/types.d.ts.map +1 -1
- package/dist/tools/ctx-reduce/tools.d.ts +10 -1
- package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
- package/dist/tools/ctx-search/constants.d.ts +1 -1
- package/dist/tools/ctx-search/constants.d.ts.map +1 -1
- package/dist/tools/light-descriptions.d.ts +2 -2
- package/dist/tools/light-descriptions.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/agents/hidden-agent-registrations.ts +3 -15
- package/src/agents/magic-context-prompt.test.ts +7 -5
- package/src/agents/magic-context-prompt.ts +22 -30
- package/src/agents/permissions.test.ts +1 -42
- package/src/agents/permissions.ts +1 -24
- package/src/config/agent-disable.ts +5 -22
- package/src/config/index.test.ts +126 -15
- package/src/config/index.ts +41 -6
- package/src/config/latch-permanence-guard.test.ts +4 -0
- package/src/config/migrate-config-location.test.ts +39 -6
- package/src/config/migrate-config-location.ts +18 -31
- package/src/config/profiles.ts +1 -1
- package/src/config/project-security.hostile-matrix.test.ts +0 -8
- package/src/config/project-security.test.ts +21 -24
- package/src/config/project-security.ts +115 -14
- package/src/config/protected-tokens.test.ts +235 -0
- package/src/config/removed-agent-config.ts +45 -0
- package/src/config/removed-agent-source-fence.test.ts +56 -0
- package/src/config/schema/magic-context.test.ts +50 -42
- package/src/config/schema/magic-context.ts +70 -37
- package/src/shared/child-session-teardown.test.ts +218 -0
- package/src/shared/child-session-teardown.ts +66 -0
- package/src/shared/keep-subagents.ts +9 -14
- package/src/shared/model-suggestion-retry.ts +1 -1
- package/src/shared/opencode-db-path.test.ts +196 -0
- package/src/shared/opencode-db-path.ts +215 -0
- package/src/shared/prompt-surface-a1-golden.md +50 -35
- package/src/shared/prompt-surface-runtime.test.ts +28 -0
- package/src/shared/prompt-surface-runtime.ts +22 -5
- package/src/shared/resolve-fallbacks.ts +1 -1
- package/src/shared/rpc-types.ts +128 -0
- package/src/shared/session-messages-bounded.test.ts +1 -1
- package/src/shared/sqlite-import-fence.test.ts +19 -0
- package/src/shared/sqlite.test.ts +27 -1
- package/src/shared/sqlite.ts +204 -1
- package/src/shared/status-detail-text.test.ts +92 -20
- package/src/shared/status-detail-text.ts +24 -2
- package/src/shared/status-summary.ts +167 -0
- package/src/shared/subagent-runner.ts +17 -10
- package/src/shared/tag-transcript.ts +33 -21
- package/src/shared/tail-hygiene-status.ts +8 -0
- package/src/shared/transcript.ts +7 -0
- package/src/shared/user-facing-codes.test.ts +140 -0
- package/src/shared/user-facing-codes.ts +276 -0
- package/src/shared/window-geometry.test.ts +44 -0
- package/src/shared/window-geometry.ts +89 -11
- package/src/shared/write-transaction-attribution.test.ts +241 -0
- package/src/shared/write-transaction-timing.ts +2 -1
- package/src/tui/index.tsx +44 -11
- package/src/tui/slots/sidebar-content.tsx +12 -7
- package/src/tui-compiled/index.tsx +662 -649
- package/src/tui-compiled/slots/sidebar-content.tsx +301 -305
- package/dist/agents/sidekick.d.ts +0 -2
- package/dist/agents/sidekick.d.ts.map +0 -1
- package/dist/features/magic-context/defaults.d.ts +0 -2
- package/dist/features/magic-context/defaults.d.ts.map +0 -1
- package/dist/features/magic-context/sidekick/agent.d.ts +0 -14
- package/dist/features/magic-context/sidekick/agent.d.ts.map +0 -1
- package/dist/features/magic-context/sidekick/core.d.ts +0 -38
- package/dist/features/magic-context/sidekick/core.d.ts.map +0 -1
- package/dist/features/magic-context/sidekick/index.d.ts +0 -3
- package/dist/features/magic-context/sidekick/index.d.ts.map +0 -1
- package/dist/hooks/magic-context/boundary-execution.d.ts +0 -27
- package/dist/hooks/magic-context/boundary-execution.d.ts.map +0 -1
- package/dist/index-raatkvw5.js +0 -360
- package/src/agents/sidekick.ts +0 -1
- package/src/features/magic-context/defaults.ts +0 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
|
2
|
+
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join, resolve } from "node:path";
|
|
5
|
+
|
|
6
|
+
const repoRoot = resolve(import.meta.dir, "../../../../");
|
|
7
|
+
const beginImmediate = /\b(?:[A-Za-z_$][\w$]*\.)?exec\("BEGIN IMMEDIATE"\)/g;
|
|
8
|
+
|
|
9
|
+
const fencedSources: Array<{ path: string; sites: string[] }> = [
|
|
10
|
+
{
|
|
11
|
+
path: "packages/plugin/src/features/magic-context/smart-notes/storage.ts",
|
|
12
|
+
sites: ["smart_note_commit"],
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
path: "packages/plugin/src/hooks/magic-context/inject-compartments.ts",
|
|
16
|
+
sites: ["opencode_materialize_cache", "opencode_soft_refresh_cache"],
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
path: "packages/plugin/src/features/magic-context/message-index.ts",
|
|
20
|
+
sites: [
|
|
21
|
+
"message_index_incremental",
|
|
22
|
+
"message_index_reconcile",
|
|
23
|
+
"message_index_orphan_sweep",
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
path: "packages/plugin/src/features/magic-context/storage-meta-persisted.ts",
|
|
28
|
+
sites: [
|
|
29
|
+
"storage_meta_wrapup_expiry_cleanup",
|
|
30
|
+
"storage_meta_wrapup_acquire",
|
|
31
|
+
"storage_meta_wrapup_update",
|
|
32
|
+
"storage_meta_wrapup_release",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
path: "packages/plugin/src/features/magic-context/context-authority.ts",
|
|
37
|
+
sites: ["authority_marker_capture", "authority_capture_check"],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
path: "packages/plugin/src/features/magic-context/compartment-storage.ts",
|
|
41
|
+
sites: ["compartment_state_replace", "recomp_staging_promote"],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
path: "packages/plugin/src/features/magic-context/project-embedding-registry.ts",
|
|
45
|
+
sites: ["embedding_identity_record", "embedding_stale_gc"],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
path: "packages/plugin/src/features/magic-context/workspaces.ts",
|
|
49
|
+
sites: ["workspace_epoch_bump", "workspace_epoch_bump"],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
// The chokepoint cannot import the logging chain (Node executes it
|
|
53
|
+
// directly), so it reports through the injected reporter instead.
|
|
54
|
+
path: "packages/plugin/src/shared/sqlite.ts",
|
|
55
|
+
sites: ["privileged_writer"],
|
|
56
|
+
reporterCall: "reportSlowPrivilegedWrite?.(",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
path: "packages/plugin/src/features/magic-context/git-commits/sweep-coordinator.ts",
|
|
60
|
+
sites: ["git_sweep_lease"],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
path: "packages/plugin/src/features/magic-context/session-project-backfill.ts",
|
|
64
|
+
sites: ["session_project_backfill"],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
path: "packages/plugin/src/tools/ctx-memory/verification-recording.ts",
|
|
68
|
+
sites: ["ctx_memory_mutation"],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
path: "packages/plugin/src/features/magic-context/storage-clone.ts",
|
|
72
|
+
sites: ["storage_clone_copy"],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
path: "packages/plugin/src/hooks/magic-context/compartment-runner-recomp.ts",
|
|
76
|
+
sites: ["historian-publish:recomp"],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
path: "packages/plugin/src/hooks/magic-context/compartment-runner-incremental.ts",
|
|
80
|
+
sites: ["historian-publish"],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
path: "packages/plugin/src/features/magic-context/dreamer/lease.ts",
|
|
84
|
+
sites: ["lease_dynamic_site"],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
path: "packages/pi-plugin/src/inject-compartments-pi.ts",
|
|
88
|
+
sites: ["pi_materialize_cache", "pi_soft_refresh_cache"],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
path: "packages/pi-plugin/src/pi-historian-runner.ts",
|
|
92
|
+
sites: ["pi_historian_publish"],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
path: "packages/pi-plugin/src/context-handler.ts",
|
|
96
|
+
sites: ["pi_compaction_queue"],
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
const nonBeginCoveredSites: Array<{ path: string; site: string }> = [
|
|
101
|
+
{
|
|
102
|
+
path: "packages/plugin/src/features/magic-context/message-index.ts",
|
|
103
|
+
site: "message_index_clear",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
path: "packages/plugin/src/features/magic-context/message-fts-rowid-map.ts",
|
|
107
|
+
site: "message_fts_rowid_backfill",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
path: "packages/plugin/src/hooks/magic-context/note-nudger.ts",
|
|
111
|
+
site: "note_nudge_trigger",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
path: "packages/plugin/src/features/magic-context/user-memory/storage-user-memory.ts",
|
|
115
|
+
site: "user_memory_candidate_insert",
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
let scenarioRoot: string | null = null;
|
|
120
|
+
let scenarioLogPath: string | null = null;
|
|
121
|
+
|
|
122
|
+
const newlyCoveredSites = [
|
|
123
|
+
"opencode_materialize_cache",
|
|
124
|
+
"opencode_soft_refresh_cache",
|
|
125
|
+
"message_index_incremental",
|
|
126
|
+
"message_index_reconcile",
|
|
127
|
+
"message_index_orphan_sweep",
|
|
128
|
+
"message_index_clear",
|
|
129
|
+
"message_fts_rowid_backfill",
|
|
130
|
+
"storage_meta_wrapup_expiry_cleanup",
|
|
131
|
+
"storage_meta_wrapup_acquire",
|
|
132
|
+
"storage_meta_wrapup_update",
|
|
133
|
+
"storage_meta_wrapup_release",
|
|
134
|
+
"authority_marker_capture",
|
|
135
|
+
"authority_capture_check",
|
|
136
|
+
"compartment_state_replace",
|
|
137
|
+
"recomp_staging_promote",
|
|
138
|
+
"embedding_identity_record",
|
|
139
|
+
"embedding_stale_gc",
|
|
140
|
+
"workspace_epoch_bump",
|
|
141
|
+
"privileged_writer",
|
|
142
|
+
"git_sweep_lease",
|
|
143
|
+
"session_project_backfill",
|
|
144
|
+
"ctx_memory_mutation",
|
|
145
|
+
"storage_clone_copy",
|
|
146
|
+
"smart_note_commit",
|
|
147
|
+
"pi_materialize_cache",
|
|
148
|
+
"pi_soft_refresh_cache",
|
|
149
|
+
"pi_historian_publish",
|
|
150
|
+
"pi_compaction_queue",
|
|
151
|
+
"note_nudge_trigger",
|
|
152
|
+
"user_memory_candidate_insert",
|
|
153
|
+
] as const;
|
|
154
|
+
|
|
155
|
+
function sourceFor(relativePath: string): string {
|
|
156
|
+
return readFileSync(resolve(repoRoot, relativePath), "utf8");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function assertCoveredBeginImmediate(
|
|
160
|
+
source: string,
|
|
161
|
+
sites: string[],
|
|
162
|
+
reporterCall = "logSlowWriteTransaction(",
|
|
163
|
+
): void {
|
|
164
|
+
const matches = [...source.matchAll(beginImmediate)];
|
|
165
|
+
expect(matches).toHaveLength(sites.length);
|
|
166
|
+
for (let index = 0; index < matches.length; index += 1) {
|
|
167
|
+
const match = matches[index];
|
|
168
|
+
const nextBegin = matches[index + 1]?.index ?? source.length;
|
|
169
|
+
const transactionRegion = source.slice(match.index, nextBegin);
|
|
170
|
+
expect(transactionRegion).toContain(reporterCall);
|
|
171
|
+
if (sites[index] === "lease_dynamic_site") {
|
|
172
|
+
expect(transactionRegion).toContain("logSlowWriteTransaction(site");
|
|
173
|
+
} else {
|
|
174
|
+
expect(transactionRegion).toContain(`"${sites[index]}"`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
describe("write transaction attribution fences", () => {
|
|
180
|
+
beforeAll(async () => {
|
|
181
|
+
scenarioRoot = mkdtempSync(join(tmpdir(), "magic-context-write-attribution-"));
|
|
182
|
+
scenarioLogPath = join(scenarioRoot, "transactions.log");
|
|
183
|
+
const scenario = `
|
|
184
|
+
const timing = await import(${JSON.stringify(new URL("./write-transaction-timing.ts", import.meta.url).href)});
|
|
185
|
+
const logger = await import(${JSON.stringify(new URL("./logger.ts", import.meta.url).href)});
|
|
186
|
+
for (const site of ${JSON.stringify(newlyCoveredSites)}) {
|
|
187
|
+
timing.logSlowWriteTransaction(site, 1_000, 1_000, 2_100);
|
|
188
|
+
timing.logSlowWriteTransaction(site, 2_000, 1_000, 2_100);
|
|
189
|
+
}
|
|
190
|
+
logger.flushLogger();
|
|
191
|
+
`;
|
|
192
|
+
const child = Bun.spawn({
|
|
193
|
+
cmd: ["bun", "--eval", scenario],
|
|
194
|
+
cwd: import.meta.dir,
|
|
195
|
+
env: {
|
|
196
|
+
...process.env,
|
|
197
|
+
NODE_ENV: "production",
|
|
198
|
+
MAGIC_CONTEXT_LOG_PATH: scenarioLogPath,
|
|
199
|
+
},
|
|
200
|
+
stdout: "pipe",
|
|
201
|
+
stderr: "pipe",
|
|
202
|
+
});
|
|
203
|
+
const [exitCode, stderr] = await Promise.all([
|
|
204
|
+
child.exited,
|
|
205
|
+
new Response(child.stderr).text(),
|
|
206
|
+
]);
|
|
207
|
+
expect(exitCode, stderr).toBe(0);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
afterAll(() => {
|
|
211
|
+
if (scenarioRoot) rmSync(scenarioRoot, { recursive: true, force: true });
|
|
212
|
+
scenarioRoot = null;
|
|
213
|
+
scenarioLogPath = null;
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
test("lists every BEGIN IMMEDIATE writer and requires a covered site", () => {
|
|
217
|
+
for (const fencedSource of fencedSources) {
|
|
218
|
+
assertCoveredBeginImmediate(
|
|
219
|
+
sourceFor(fencedSource.path),
|
|
220
|
+
fencedSource.sites,
|
|
221
|
+
"reporterCall" in fencedSource ? fencedSource.reporterCall : undefined,
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
for (const coveredSite of nonBeginCoveredSites) {
|
|
225
|
+
expect(sourceFor(coveredSite.path)).toContain(
|
|
226
|
+
`logSlowWriteTransaction("${coveredSite.site}"`,
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
for (const site of newlyCoveredSites) {
|
|
232
|
+
test(`logs a slow and suppresses a sub-threshold transaction at site=${site}`, () => {
|
|
233
|
+
if (!scenarioLogPath) throw new Error("timing scenario did not start");
|
|
234
|
+
const lines = readFileSync(scenarioLogPath, "utf8")
|
|
235
|
+
.split("\n")
|
|
236
|
+
.filter((line) => line.includes(`site=${site}`));
|
|
237
|
+
expect(lines).toHaveLength(1);
|
|
238
|
+
expect(lines[0]).toContain("held=1100.0ms");
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
});
|
|
@@ -14,9 +14,10 @@ export function logSlowWriteTransaction(
|
|
|
14
14
|
site: string,
|
|
15
15
|
startedAt: number,
|
|
16
16
|
thresholdMs = SLOW_WRITE_TRANSACTION_THRESHOLD_MS,
|
|
17
|
+
completedAtMs = performance.now(),
|
|
17
18
|
): void {
|
|
18
19
|
try {
|
|
19
|
-
const durationMs =
|
|
20
|
+
const durationMs = completedAtMs - startedAt;
|
|
20
21
|
if (durationMs < thresholdMs) return;
|
|
21
22
|
log(`[magic-context] slow write transaction: site=${site} held=${durationMs.toFixed(1)}ms`);
|
|
22
23
|
} catch {
|
package/src/tui/index.tsx
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** @jsxImportSource @opentui/solid */
|
|
2
2
|
// @ts-nocheck
|
|
3
|
-
import { createMemo } from "solid-js"
|
|
3
|
+
import { createMemo, createSignal } from "solid-js"
|
|
4
4
|
import type { TuiPlugin, TuiPluginApi, TuiThemeCurrent } from "@opencode-ai/plugin/tui"
|
|
5
|
+
import { renderUserStatusSummary, statusSummaryFromDetail } from "../shared/status-summary"
|
|
6
|
+
import { renderUserFacingFailure, userFacingFailureCode } from '../shared/user-facing-codes';
|
|
5
7
|
import {
|
|
6
8
|
createSidebarContentSlot,
|
|
7
9
|
kickRecompProgressRefresh,
|
|
@@ -138,10 +140,13 @@ const R = (props: { t: TuiThemeCurrent; l: string; v: string; fg?: string }) =>
|
|
|
138
140
|
</box>
|
|
139
141
|
)
|
|
140
142
|
|
|
141
|
-
const StatusDialog = (props: { api: TuiPluginApi; s: StatusDetail }) => {
|
|
143
|
+
const StatusDialog = (props: { api: TuiPluginApi; s: StatusDetail; diagnostics?: boolean }) => {
|
|
142
144
|
const theme = createMemo(() => (props.api as any).theme.current)
|
|
145
|
+
const [diagnostics, setDiagnostics] = createSignal(props.diagnostics === true)
|
|
143
146
|
const t = () => theme()
|
|
144
147
|
const s = () => props.s
|
|
148
|
+
const summaryLines = () =>
|
|
149
|
+
renderUserStatusSummary(statusSummaryFromDetail(s()), "plain").split("\n").slice(1)
|
|
145
150
|
const compactionOff = () => s().compaction_enabled === false
|
|
146
151
|
|
|
147
152
|
// Prefer the RPC-provided model context limit (what the sidebar shows) so the
|
|
@@ -206,7 +211,7 @@ const StatusDialog = (props: { api: TuiPluginApi; s: StatusDetail }) => {
|
|
|
206
211
|
segs.push({ label: "User Profile", tokens: d.profileTokens, color: COLORS.profile })
|
|
207
212
|
|
|
208
213
|
if (d.conversationTokens > 0)
|
|
209
|
-
segs.push({ label: "Conversation
|
|
214
|
+
segs.push({ label: "Conversation", tokens: d.conversationTokens, color: COLORS.conversation })
|
|
210
215
|
if (d.toolCallTokens > 0)
|
|
211
216
|
segs.push({ label: "Tool Calls", tokens: d.toolCallTokens, color: COLORS.toolCalls })
|
|
212
217
|
if (d.toolDefinitionTokens > 0)
|
|
@@ -230,6 +235,21 @@ const StatusDialog = (props: { api: TuiPluginApi; s: StatusDetail }) => {
|
|
|
230
235
|
<text fg={t().textMuted}>v{packageJson.version}</text>
|
|
231
236
|
</box>
|
|
232
237
|
|
|
238
|
+
<box
|
|
239
|
+
width="100%"
|
|
240
|
+
justifyContent="flex-end"
|
|
241
|
+
onMouseDown={() => setDiagnostics(!diagnostics())}
|
|
242
|
+
>
|
|
243
|
+
<text fg={diagnostics() ? t().accent : t().textMuted}>
|
|
244
|
+
{diagnostics() ? "[x]" : "[ ]"} Diagnostics
|
|
245
|
+
</text>
|
|
246
|
+
</box>
|
|
247
|
+
|
|
248
|
+
{!diagnostics() ? (
|
|
249
|
+
<box flexDirection="column" width="100%">
|
|
250
|
+
{summaryLines().map((line) => <text>{line}</text>)}
|
|
251
|
+
</box>
|
|
252
|
+
) : (<>
|
|
233
253
|
{s().configParseFailures.map((failure) => (
|
|
234
254
|
<text fg={t().error}>{formatConfigParseStatusLine(failure)}</text>
|
|
235
255
|
))}
|
|
@@ -279,7 +299,7 @@ const StatusDialog = (props: { api: TuiPluginApi; s: StatusDetail }) => {
|
|
|
279
299
|
</box>
|
|
280
300
|
)
|
|
281
301
|
})}
|
|
282
|
-
<text fg={t().textMuted}
|
|
302
|
+
<text fg={t().textMuted}>Conversation includes reasoning; hygiene excludes it</text>
|
|
283
303
|
{s().tailHygiene !== undefined && (
|
|
284
304
|
<R
|
|
285
305
|
t={t()}
|
|
@@ -438,7 +458,7 @@ const StatusDialog = (props: { api: TuiPluginApi; s: StatusDetail }) => {
|
|
|
438
458
|
{/* Error (full width, conditional) */}
|
|
439
459
|
{s().lastTransformError && (
|
|
440
460
|
<box marginTop={1} width="100%">
|
|
441
|
-
<text fg={t().error}
|
|
461
|
+
<text fg={t().error}>{renderUserFacingFailure("transform_update_failed")}</text>
|
|
442
462
|
</box>
|
|
443
463
|
)}
|
|
444
464
|
|
|
@@ -451,12 +471,13 @@ const StatusDialog = (props: { api: TuiPluginApi; s: StatusDetail }) => {
|
|
|
451
471
|
fg={(s().loggerDiagnostics?.swallowedWriteCount ?? 0) > 0 ? t().error : t().textMuted}
|
|
452
472
|
/>
|
|
453
473
|
{s().loggerDiagnostics?.lastErrorMessage && (
|
|
454
|
-
<R t={t()} l="
|
|
474
|
+
<R t={t()} l="Warning" v={renderUserFacingFailure("status_unavailable")} fg={t().error} />
|
|
455
475
|
)}
|
|
456
476
|
{s().loggerDiagnostics?.lastErrorTime && (
|
|
457
477
|
<R t={t()} l="Last error time" v={s().loggerDiagnostics.lastErrorTime} fg={t().textMuted} />
|
|
458
478
|
)}
|
|
459
479
|
</box>
|
|
480
|
+
</>)}
|
|
460
481
|
|
|
461
482
|
{/* Footer */}
|
|
462
483
|
<box marginTop={1} justifyContent="flex-end" width="100%">
|
|
@@ -515,7 +536,7 @@ async function showRecompDialog(api: TuiPluginApi, targetSessionId = getSessionI
|
|
|
515
536
|
? "This session has no compartments yet — recomp will build them from raw history."
|
|
516
537
|
: `You have ${count} compartments.`,
|
|
517
538
|
"",
|
|
518
|
-
"Recomp will
|
|
539
|
+
"Recomp will rebuild the compressed history from raw history. Saved memories are not changed.",
|
|
519
540
|
"This may take a long time and consume significant tokens.",
|
|
520
541
|
"",
|
|
521
542
|
"Proceed?",
|
|
@@ -617,7 +638,11 @@ function showUpgradeDialog(
|
|
|
617
638
|
return true
|
|
618
639
|
}
|
|
619
640
|
|
|
620
|
-
async function showStatusDialog(
|
|
641
|
+
async function showStatusDialog(
|
|
642
|
+
api: TuiPluginApi,
|
|
643
|
+
targetSessionId = getSessionId(api),
|
|
644
|
+
initialDiagnostics = false,
|
|
645
|
+
): Promise<boolean> {
|
|
621
646
|
const sessionId = targetSessionId
|
|
622
647
|
if (!sessionId) {
|
|
623
648
|
showToast(api, { message: "No active session", variant: "warning" })
|
|
@@ -629,14 +654,19 @@ async function showStatusDialog(api: TuiPluginApi, targetSessionId = getSessionI
|
|
|
629
654
|
const result = await loadStatusDetail(sessionId, directory, modelKey)
|
|
630
655
|
if (getSessionId(api) !== sessionId) return false
|
|
631
656
|
if (!result.ok) {
|
|
657
|
+
console.error(
|
|
658
|
+
`[magic-context] status unavailable code=${userFacingFailureCode("status_unavailable")}: ${result.error}`,
|
|
659
|
+
)
|
|
632
660
|
showToast(api, {
|
|
633
|
-
message:
|
|
661
|
+
message: renderUserFacingFailure("status_unavailable"),
|
|
634
662
|
variant: "warning",
|
|
635
663
|
})
|
|
636
664
|
return false
|
|
637
665
|
}
|
|
638
666
|
|
|
639
|
-
api.ui.dialog.replace(() =>
|
|
667
|
+
api.ui.dialog.replace(() => (
|
|
668
|
+
<StatusDialog api={api} s={result.detail} diagnostics={initialDiagnostics} />
|
|
669
|
+
))
|
|
640
670
|
return true
|
|
641
671
|
}
|
|
642
672
|
|
|
@@ -1125,7 +1155,10 @@ const tui: TuiPlugin = async (api, _options, meta) => {
|
|
|
1125
1155
|
const stillActive = () =>
|
|
1126
1156
|
getRpcGeneration() === generation && getSessionId(api) === requestedSessionId
|
|
1127
1157
|
if (action === "show-status-dialog") {
|
|
1128
|
-
return
|
|
1158
|
+
return (
|
|
1159
|
+
stillActive() &&
|
|
1160
|
+
(await showStatusDialog(api, requestedSessionId, n.payload?.diagnostics === true))
|
|
1161
|
+
)
|
|
1129
1162
|
}
|
|
1130
1163
|
if (action === "show-recomp-dialog") {
|
|
1131
1164
|
return stillActive() && (await showRecompDialog(api, requestedSessionId))
|
|
@@ -5,7 +5,6 @@ import packageJson from "../../../package.json"
|
|
|
5
5
|
import { badgeTextColor } from '../badge-contrast';
|
|
6
6
|
import { loadSidebarSnapshot, type SidebarSnapshot } from "../data/context-db"
|
|
7
7
|
import { formatThresholdPercent } from "../../shared/format-threshold"
|
|
8
|
-
import { formatTailHygiene } from "../../shared/tail-hygiene-status"
|
|
9
8
|
import { compactionOffSidebarRows, nativeCompactionContextLabel } from "../compaction-off"
|
|
10
9
|
import {
|
|
11
10
|
computeEffectiveOrder,
|
|
@@ -106,6 +105,16 @@ function compactTokens(value: number): string {
|
|
|
106
105
|
return String(value)
|
|
107
106
|
}
|
|
108
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Sidebar form of the tail-hygiene reading: the reclaimable share and the
|
|
110
|
+
* two masses it is computed from, in the same compact token unit as the
|
|
111
|
+
* breakdown rows so the value fits beside its label at sidebar width. The
|
|
112
|
+
* long, unit-spelled form stays in the status dialog.
|
|
113
|
+
*/
|
|
114
|
+
function hygieneValue(status: { severity: number; u: number; t: number }): string {
|
|
115
|
+
return `${(status.severity * 100).toFixed(1)}% · ${compactTokens(status.u)}/${compactTokens(status.t)}`
|
|
116
|
+
}
|
|
117
|
+
|
|
109
118
|
function relativeTime(ms: number): string {
|
|
110
119
|
const diff = Date.now() - ms
|
|
111
120
|
if (diff < 60_000) return "just now"
|
|
@@ -240,7 +249,7 @@ const TokenBreakdown = (props: {
|
|
|
240
249
|
key: "conv",
|
|
241
250
|
tokens: s.conversationTokens,
|
|
242
251
|
color: COLORS.conversation,
|
|
243
|
-
|
|
252
|
+
label: "Conversation",
|
|
244
253
|
})
|
|
245
254
|
|
|
246
255
|
// Tool Calls = tool_use/tool_result/tool/tool-invocation parts in messages
|
|
@@ -321,7 +330,6 @@ const TokenBreakdown = (props: {
|
|
|
321
330
|
</box>
|
|
322
331
|
)
|
|
323
332
|
})}
|
|
324
|
-
<text fg={props.theme.textMuted}>* includes Reasoning; hygiene excludes it</text>
|
|
325
333
|
</box>
|
|
326
334
|
)}
|
|
327
335
|
</box>
|
|
@@ -798,14 +806,11 @@ const SidebarContent = (props: {
|
|
|
798
806
|
</box>
|
|
799
807
|
)}
|
|
800
808
|
<TokenBreakdown theme={props.theme} snapshot={s()!} collapsed={collapsed()} />
|
|
801
|
-
{!collapsed() && (
|
|
802
|
-
<text fg={props.theme.textMuted}>Conversation includes reasoning estimates; hygiene excludes reasoning.</text>
|
|
803
|
-
)}
|
|
804
809
|
{s()!.tailHygiene !== undefined && (
|
|
805
810
|
<StatRow
|
|
806
811
|
theme={props.theme}
|
|
807
812
|
label="Hygiene"
|
|
808
|
-
value={
|
|
813
|
+
value={hygieneValue(s()!.tailHygiene!)}
|
|
809
814
|
warning={!s()!.tailHygiene!.evaluable}
|
|
810
815
|
/>
|
|
811
816
|
)}
|