@cortexkit/opencode-magic-context 0.42.6 → 0.43.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 +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/{announcement-8mgn61fw.js → announcement-1a8bvswd.js} +2 -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-956fkedc.js} +6 -4
- package/dist/{derive-budgets-v1fkhjjr.js → derive-budgets-b8ybssh9.js} +7 -3
- 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 +51 -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 +3 -1
- 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 +3 -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 +4 -1
- 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/memory/verification-paths.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/auto-update-checker/checker.d.ts +1 -0
- package/dist/hooks/auto-update-checker/checker.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 +2 -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/lkg-slot.d.ts +1 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- 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 +26 -3
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts +1 -0
- package/dist/hooks/magic-context/send-session-notification.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-0ccmyzbj.js} +90 -10
- package/dist/index-1gtwrdc4.js +393 -0
- package/dist/{index-ntbmt6rq.js → index-4b30nf6z.js} +1 -1
- package/dist/index-6w9p73jz.js +170 -0
- package/dist/{index-4ftb5hcq.js → index-6z9g64js.js} +7 -1
- package/dist/{index-djp6rwz6.js → index-7wpwr2e2.js} +28002 -30125
- package/dist/index-9r1cbh9e.js +16 -0
- package/dist/{safe-notification-target-fepvcbsj.js → index-febg06dy.js} +6 -7
- package/dist/index-j7cnyvq1.js +5409 -0
- package/dist/{index-s61hh7gv.js → index-kpmmr8s0.js} +95 -73
- package/dist/{index-a9ssj59b.js → index-v8qr6tt2.js} +56 -16
- package/dist/{index-qp20p2py.js → index-wgzyeyf5.js} +1 -1
- package/dist/index-y5145x8k.js +619 -0
- package/dist/{index-ngjmj6xx.js → index-yc81txp4.js} +38 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6274 -3180
- package/dist/message-time-backfill-0ccvyk9n.js +109 -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-z7fv0qjv.js +62 -0
- package/dist/recomp-orchestrator-r00aa5t3.js +21 -0
- package/dist/safe-notification-target-vrkjrbgb.js +10 -0
- package/dist/{send-session-notification-jbxknvar.js → send-session-notification-3warjyjp.js} +7 -3
- 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/data-path.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/test-temp-dir.d.ts +1 -1
- package/dist/shared/test-temp-dir.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-mgf5nsh3.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 +7 -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 +59 -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 +142236 -112052
- 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-y0bs7t5a.js +18 -0
- package/package.json +9 -7
- package/src/agents/dreamer.ts +7 -16
- package/src/agents/hidden-agent-registrations.ts +10 -22
- package/src/agents/magic-context-prompt.test.ts +29 -39
- package/src/agents/magic-context-prompt.ts +99 -122
- package/src/agents/permissions.test.ts +17 -21
- package/src/config/index.ts +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/data-path.ts +6 -6
- 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 +86 -0
- package/src/shared/model-suggestion-retry.ts +29 -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/test-temp-dir.ts +3 -0
- 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/recomp-orchestrator-0xx1364v.js +0 -19
- package/dist/storage-meta-session-z818pn1e.js +0 -20
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Typed view of load-compiled-status-dialog.mjs; see that file for why it is untyped JS. */
|
|
2
|
+
import type { StatusDetail } from "../../shared/rpc-types";
|
|
3
|
+
import type { V1Theme } from "./load-compiled-sidebar.d.mts";
|
|
4
|
+
|
|
5
|
+
/** The slice of OpenCode 1's `TuiPluginApi` the status dialog component reads. */
|
|
6
|
+
export interface V1StatusDialogApi {
|
|
7
|
+
readonly theme: { readonly current: V1Theme };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface CompiledStatusDialog {
|
|
11
|
+
StatusDialog(props: {
|
|
12
|
+
readonly api: V1StatusDialogApi;
|
|
13
|
+
readonly s: StatusDetail;
|
|
14
|
+
}): unknown;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export declare function loadCompiledStatusDialog(): Promise<CompiledStatusDialog>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Loads the precompiled OpenCode 1 status dialog for the OpenCode 2 dialog surface.
|
|
2
|
+
//
|
|
3
|
+
// Same arrangement, and same reasons, as load-compiled-sidebar.mjs next to it:
|
|
4
|
+
// `src/tui-compiled/dialogs/status-dialog.tsx` is Solid-transform output that this
|
|
5
|
+
// package never typechecks or compiles, and a TypeScript file importing a .tsx
|
|
6
|
+
// path would force `--jsx` on the whole program and pull that generated file into
|
|
7
|
+
// the type graph. The typed view of this module is load-compiled-status-dialog.d.mts.
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Imports the compiled status dialog component. Rejects when the host registers
|
|
11
|
+
* no `opentui:runtime-module:*` virtual modules to resolve the component's
|
|
12
|
+
* runtime imports through; the caller answers that case with the text dialog.
|
|
13
|
+
*/
|
|
14
|
+
export async function loadCompiledStatusDialog() {
|
|
15
|
+
return await import("../../tui-compiled/dialogs/status-dialog.tsx");
|
|
16
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The v2 sidebar has two arms: the real OpenCode 1 component, and a plain-text
|
|
3
|
+
* projection for a host that registers no OpenTUI runtime modules. The real
|
|
4
|
+
* host lane proves the first arm paints. This file forces the second one and
|
|
5
|
+
* pins why it is reachable, so the fallback cannot quietly become dead code —
|
|
6
|
+
* or, worse, quietly become the arm every user gets because a genuine defect
|
|
7
|
+
* was mistaken for a missing runtime.
|
|
8
|
+
*
|
|
9
|
+
* Bare Bun is exactly that no-registry host: nothing registers the
|
|
10
|
+
* `opentui:runtime-module:*` virtual modules, so the compiled component's
|
|
11
|
+
* imports do not resolve here.
|
|
12
|
+
*/
|
|
13
|
+
import { expect, test } from "bun:test";
|
|
14
|
+
import { setupWithJsx, sidebarText } from "./index";
|
|
15
|
+
import { loadCompiledSidebar } from "./load-compiled-sidebar.mjs";
|
|
16
|
+
import { isMissingOpenTuiRuntime, mountV1Sidebar } from "./sidebar-mount";
|
|
17
|
+
import type { V2SlotClaim, V2TuiContext } from "./types";
|
|
18
|
+
|
|
19
|
+
function fixture() {
|
|
20
|
+
const claims: V2SlotClaim[] = [];
|
|
21
|
+
const context: V2TuiContext = {
|
|
22
|
+
location: { directory: process.cwd() },
|
|
23
|
+
renderer: { requestRender() {} },
|
|
24
|
+
data: {
|
|
25
|
+
listen: () => () => {},
|
|
26
|
+
location: { default: () => ({ directory: process.cwd() }) },
|
|
27
|
+
},
|
|
28
|
+
keymap: { layer: () => {} },
|
|
29
|
+
storage: {
|
|
30
|
+
memory: <Value extends object>(_key: string, options: { initial: Value }) =>
|
|
31
|
+
[
|
|
32
|
+
options.initial,
|
|
33
|
+
(mutation: (draft: Value) => void) => mutation(options.initial),
|
|
34
|
+
] as const,
|
|
35
|
+
},
|
|
36
|
+
ui: {
|
|
37
|
+
router: { current: () => ({ type: "session", sessionID: "ses-fallback" }) },
|
|
38
|
+
slot: (claim) => {
|
|
39
|
+
claims.push(claim);
|
|
40
|
+
return () => {};
|
|
41
|
+
},
|
|
42
|
+
toast: { show() {} },
|
|
43
|
+
dialog: {
|
|
44
|
+
async alert() {},
|
|
45
|
+
async confirm() {
|
|
46
|
+
return false;
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
return { context, claims };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
test("the compiled sidebar cannot load without the host's OpenTUI runtime registry", async () => {
|
|
55
|
+
const error = await loadCompiledSidebar().then(
|
|
56
|
+
() => undefined,
|
|
57
|
+
(reason: unknown) => reason,
|
|
58
|
+
);
|
|
59
|
+
// If this ever resolves, the fallback arm below is unreachable and the test
|
|
60
|
+
// that forces it is measuring nothing.
|
|
61
|
+
expect(error).toBeDefined();
|
|
62
|
+
expect(String((error as Error).message)).toContain("opentui:runtime-module:");
|
|
63
|
+
expect(isMissingOpenTuiRuntime(error)).toBe(true);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test("only a missing runtime registry counts as the fallback condition", () => {
|
|
67
|
+
expect(isMissingOpenTuiRuntime(new Error("Cannot find package 'left-pad'"))).toBe(false);
|
|
68
|
+
expect(isMissingOpenTuiRuntime(new Error("boom"))).toBe(false);
|
|
69
|
+
// A real defect inside the component would arrive as an ordinary error and
|
|
70
|
+
// must reach the host instead of degrading the sidebar to text.
|
|
71
|
+
expect(
|
|
72
|
+
isMissingOpenTuiRuntime(
|
|
73
|
+
new TypeError("undefined is not a function (opentui:runtime-module:)"),
|
|
74
|
+
),
|
|
75
|
+
).toBe(false);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("mountV1Sidebar reports the missing registry as null instead of throwing", async () => {
|
|
79
|
+
const { context } = fixture();
|
|
80
|
+
expect(await mountV1Sidebar(context, process.cwd())).toBeNull();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test("the sidebar.content claim renders the text projection when the component cannot mount", async () => {
|
|
84
|
+
const { context, claims } = fixture();
|
|
85
|
+
const cleanup = await setupWithJsx(context, (type, props) => ({ type, props }));
|
|
86
|
+
try {
|
|
87
|
+
const claim = claims.find((entry) => entry.append === "sidebar.content");
|
|
88
|
+
if (claim?.append !== "sidebar.content") throw new Error("expected the sidebar claim");
|
|
89
|
+
// Spelled out rather than computed from sidebarText: an expectation
|
|
90
|
+
// built by the same function as the value under test agrees with it
|
|
91
|
+
// however wrong both are.
|
|
92
|
+
expect(claim.render({ sessionID: "ses-fallback" })).toEqual({
|
|
93
|
+
type: "text",
|
|
94
|
+
props: { children: "Magic Context · loading…" },
|
|
95
|
+
});
|
|
96
|
+
expect(sidebarText(undefined)).toBe("Magic Context · loading…");
|
|
97
|
+
} finally {
|
|
98
|
+
cleanup();
|
|
99
|
+
}
|
|
100
|
+
});
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mounts the OpenCode 1 sidebar component on the OpenCode 2 `sidebar.content`
|
|
3
|
+
* slot, so both host generations render the same sidebar from the same
|
|
4
|
+
* RPC-backed data layer.
|
|
5
|
+
*
|
|
6
|
+
* The component itself is loaded from `src/tui-compiled/`, the Solid-transformed
|
|
7
|
+
* copy of `src/tui/` produced by `scripts/build-tui.ts`. Two properties of that
|
|
8
|
+
* copy are what make it usable here:
|
|
9
|
+
*
|
|
10
|
+
* - OpenCode's bundler plugin skips the Solid compile-time transform for files
|
|
11
|
+
* under `node_modules`, which is where an installed plugin lives. The raw
|
|
12
|
+
* `.tsx` source would therefore evaluate its JSX children once and freeze on
|
|
13
|
+
* the first paint; the precompiled copy has the transform already applied.
|
|
14
|
+
* - Its runtime imports name the `opentui:runtime-module:*` virtual modules
|
|
15
|
+
* that OpenCode registers process-wide, so the component binds the host's
|
|
16
|
+
* single Solid/OpenTUI runtime instead of loading a second copy out of this
|
|
17
|
+
* package. Two Solid instances in one process do not share reactive
|
|
18
|
+
* ownership, and the renderables would not belong to the host's tree.
|
|
19
|
+
*/
|
|
20
|
+
import { eventSessionID } from "./events";
|
|
21
|
+
import {
|
|
22
|
+
type CompiledSidebarComponent,
|
|
23
|
+
type CompiledSidebarData,
|
|
24
|
+
loadCompiledSidebar,
|
|
25
|
+
type V1SidebarApi,
|
|
26
|
+
type V1Theme,
|
|
27
|
+
} from "./load-compiled-sidebar.mjs";
|
|
28
|
+
import type { V2ResolvedTheme, V2TuiContext } from "./types";
|
|
29
|
+
|
|
30
|
+
export interface V1SidebarMount {
|
|
31
|
+
/** Renders the v1 component for one paint of the v2 `sidebar.content` slot. */
|
|
32
|
+
render(input: { readonly sessionID: string }): unknown;
|
|
33
|
+
/** Asks the mounted component to fetch a snapshot now, out of band. */
|
|
34
|
+
refresh(): void;
|
|
35
|
+
dispose(): void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Colour tokens moved between host generations: OpenCode 1 handed the sidebar a
|
|
40
|
+
* flat table (`theme.accent`, `theme.textMuted`, …) while OpenCode 2 resolves a
|
|
41
|
+
* token tree (`@opencode/theme/tui` `ResolvedThemeTokens`: `text.base`,
|
|
42
|
+
* `text.muted`, `text.feedback.error.base`, `hue.accent[500]`, …). This maps
|
|
43
|
+
* the eight tokens the sidebar reads. A token the host does not resolve falls
|
|
44
|
+
* back to a colour chosen for the host's theme mode: an earlier fallback of
|
|
45
|
+
* white text painted the section headers white-on-white on light themes when
|
|
46
|
+
* the mapping read key names the theme package never had.
|
|
47
|
+
*
|
|
48
|
+
* The accent is read at hue step 200, the step the host draws its own accent
|
|
49
|
+
* UI in. The ramp is ordered by distance from the page, not by lightness, so
|
|
50
|
+
* step 200 stays a readable accent in both modes (captured GA host: #9d7cd8 on
|
|
51
|
+
* #0a0a0a dark, #d68c27 on #ffffff light) where step 500 resolved to a dark
|
|
52
|
+
* purple on the dark page and a pale orange on the light one.
|
|
53
|
+
*/
|
|
54
|
+
export function flattenTheme(
|
|
55
|
+
theme: V2ResolvedTheme | undefined,
|
|
56
|
+
mode: "dark" | "light" = "dark",
|
|
57
|
+
): V1Theme {
|
|
58
|
+
const light = mode === "light";
|
|
59
|
+
const feedback = theme?.text?.feedback;
|
|
60
|
+
return {
|
|
61
|
+
text: theme?.text?.base ?? (light ? "#1a1a1a" : "#ffffff"),
|
|
62
|
+
textMuted: theme?.text?.muted ?? (light ? "#6b6b6b" : "#9a9a9a"),
|
|
63
|
+
accent: theme?.hue?.accent?.[200] ?? "#5f87ff",
|
|
64
|
+
background: theme?.background?.base ?? (light ? "#ffffff" : "#000000"),
|
|
65
|
+
borderActive: theme?.border?.base ?? "#9a9a9a",
|
|
66
|
+
error: feedback?.error?.base ?? "#d13b3b",
|
|
67
|
+
warning: feedback?.warning?.base ?? "#c77d1a",
|
|
68
|
+
success: feedback?.success?.base ?? "#2e9a4e",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* True when the import failed because the host does not register the OpenTUI
|
|
74
|
+
* runtime modules. That is the only failure this module is allowed to answer
|
|
75
|
+
* with the plain-text fallback; anything else is a real defect and rethrows.
|
|
76
|
+
*/
|
|
77
|
+
export function isMissingOpenTuiRuntime(error: unknown): boolean {
|
|
78
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
79
|
+
return (
|
|
80
|
+
message.includes("opentui:runtime-module:") &&
|
|
81
|
+
/Cannot find|Could not resolve|Module not found|Unable to resolve/.test(message)
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function createV1Api(context: V2TuiContext, directory: string): V1SidebarApi {
|
|
86
|
+
return {
|
|
87
|
+
state: { path: { directory } },
|
|
88
|
+
renderer: { requestRender: () => context.renderer.requestRender() },
|
|
89
|
+
event: {
|
|
90
|
+
// OpenCode 1's event names ("message.updated", "session.updated",
|
|
91
|
+
// "message.removed") do not exist on OpenCode 2, whose stream uses
|
|
92
|
+
// "session.status", "session.idle", "session.step.ended" and so on.
|
|
93
|
+
// Rather than guess a per-name mapping that would silently stop
|
|
94
|
+
// updating when the host renames an event, every subscription is fed
|
|
95
|
+
// every v2 event that carries a session id, projected into the v1
|
|
96
|
+
// shape. The component debounces its refresh, so the three
|
|
97
|
+
// subscriptions collapse into one fetch.
|
|
98
|
+
on: (_type, handler) =>
|
|
99
|
+
context.data.listen(({ details }) => {
|
|
100
|
+
const sessionID = eventSessionID(details);
|
|
101
|
+
if (!sessionID) return;
|
|
102
|
+
handler({
|
|
103
|
+
properties: { sessionID, info: { id: sessionID, sessionID } },
|
|
104
|
+
});
|
|
105
|
+
}),
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Loads and mounts the v1 sidebar, or returns `null` when the host provides no
|
|
112
|
+
* OpenTUI runtime registry to load it through.
|
|
113
|
+
*/
|
|
114
|
+
export async function mountV1Sidebar(
|
|
115
|
+
context: V2TuiContext,
|
|
116
|
+
directory: string,
|
|
117
|
+
): Promise<V1SidebarMount | null> {
|
|
118
|
+
let compiled: CompiledSidebarComponent;
|
|
119
|
+
let data: CompiledSidebarData;
|
|
120
|
+
try {
|
|
121
|
+
({ component: compiled, data } = await loadCompiledSidebar());
|
|
122
|
+
} catch (error) {
|
|
123
|
+
if (!isMissingOpenTuiRuntime(error)) throw error;
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// The compiled tree carries its own copy of the RPC data layer, so its
|
|
128
|
+
// client has to be initialised separately from the one `setupWithJsx`
|
|
129
|
+
// creates for the status/recomp dialogs. Without this the component's
|
|
130
|
+
// fetches return the empty snapshot and every row reads zero.
|
|
131
|
+
data.initRpcClient(directory);
|
|
132
|
+
|
|
133
|
+
const slot = compiled.createSidebarContentSlot(createV1Api(context, directory));
|
|
134
|
+
return {
|
|
135
|
+
render: (input) =>
|
|
136
|
+
slot.slots.sidebar_content(
|
|
137
|
+
{
|
|
138
|
+
// Read through a getter so a theme change repaints: the
|
|
139
|
+
// component wraps this in a memo, and the host's theme is a
|
|
140
|
+
// reactive store.
|
|
141
|
+
get theme() {
|
|
142
|
+
return {
|
|
143
|
+
get current() {
|
|
144
|
+
return flattenTheme(context.theme, context.themeMode);
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
// `input` is the slot's reactive props object; reading
|
|
151
|
+
// `sessionID` lazily keeps the component subscribed to
|
|
152
|
+
// session switches.
|
|
153
|
+
get session_id() {
|
|
154
|
+
return input.sessionID;
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
),
|
|
158
|
+
refresh: () => compiled.refreshSidebarSnapshot(),
|
|
159
|
+
dispose: () => {
|
|
160
|
+
slot.dispose();
|
|
161
|
+
data.closeRpc();
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
import { COMPACTION_ENABLED_PATH } from "../../config/agent-disable";
|
|
3
|
+
import type { SidebarSnapshot, StatusDetail } from "../../shared/rpc-types";
|
|
4
|
+
import { sidebarText, statusText } from "./index";
|
|
5
|
+
|
|
6
|
+
function snapshot(overrides: Partial<SidebarSnapshot>): SidebarSnapshot {
|
|
7
|
+
return {
|
|
8
|
+
sessionId: "ses-test",
|
|
9
|
+
usagePercentage: 42,
|
|
10
|
+
inputTokens: 4200,
|
|
11
|
+
contextLimit: 10000,
|
|
12
|
+
systemPromptTokens: 0,
|
|
13
|
+
compartmentCount: 3,
|
|
14
|
+
memoryCount: 7,
|
|
15
|
+
memoryBlockCount: 2,
|
|
16
|
+
pendingOpsCount: 1,
|
|
17
|
+
historianRunning: false,
|
|
18
|
+
lastTransformError: null,
|
|
19
|
+
...overrides,
|
|
20
|
+
} as SidebarSnapshot;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
test("compaction-off sidebar mirrors the v1 rows and native context label", () => {
|
|
24
|
+
const text = sidebarText(
|
|
25
|
+
snapshot({
|
|
26
|
+
compaction_enabled: false,
|
|
27
|
+
archivedCompartmentCount: 4,
|
|
28
|
+
sessionNoteCount: 2,
|
|
29
|
+
readySmartNoteCount: 1,
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
expect(text).toContain("Context: 42.0% · native compaction");
|
|
33
|
+
expect(text).toContain("Memories 7");
|
|
34
|
+
expect(text).toContain("Notes 2");
|
|
35
|
+
expect(text).toContain("Archived compartments 4");
|
|
36
|
+
expect(text).toContain("Smart Notes 1 ready");
|
|
37
|
+
expect(text).not.toContain("Historian");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("compaction-on sidebar keeps the historian/compartment line", () => {
|
|
41
|
+
const text = sidebarText(snapshot({ compaction_enabled: true }));
|
|
42
|
+
expect(text).toContain("Historian idle · C:3");
|
|
43
|
+
expect(text).toContain("Memories 2/7 · Q:1");
|
|
44
|
+
expect(text).not.toContain("native compaction");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("status dialog prefixes the compaction-off notice", () => {
|
|
48
|
+
const detail = {
|
|
49
|
+
...snapshot({ compaction_enabled: false }),
|
|
50
|
+
} as unknown as StatusDetail;
|
|
51
|
+
expect(statusText(detail)).toContain(
|
|
52
|
+
`Compaction: disabled (${COMPACTION_ENABLED_PATH}: false) — native compaction owns the context window.`,
|
|
53
|
+
);
|
|
54
|
+
expect(statusText({ ...detail, compaction_enabled: true } as StatusDetail)).not.toContain(
|
|
55
|
+
"Compaction: disabled",
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test("OpenCode 2 status reports the live config generation and parse failure", () => {
|
|
60
|
+
const detail = {
|
|
61
|
+
...snapshot({}),
|
|
62
|
+
configGeneration: 4,
|
|
63
|
+
configAdoptedAt: 1730000000000,
|
|
64
|
+
configReloadFailure: { path: "/tmp/magic-context.jsonc", message: "malformed" },
|
|
65
|
+
} as StatusDetail;
|
|
66
|
+
expect(statusText(detail)).toContain("Config generation: 4 (adopted ");
|
|
67
|
+
expect(statusText(detail)).toContain(
|
|
68
|
+
"Config reload failed /tmp/magic-context.jsonc: malformed",
|
|
69
|
+
);
|
|
70
|
+
});
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The v2 `/ctx-status` has two arms: the real OpenCode 1 dialog component, and
|
|
3
|
+
* the plain-text dialog for a host that cannot render a component. The real
|
|
4
|
+
* host lane proves the first arm paints. This file forces the second one and
|
|
5
|
+
* pins why it is reachable, so the text projection cannot quietly become dead
|
|
6
|
+
* code — or, worse, quietly become what every user gets because a genuine
|
|
7
|
+
* defect was mistaken for a missing runtime.
|
|
8
|
+
*
|
|
9
|
+
* Bare Bun is exactly that no-registry host: nothing registers the
|
|
10
|
+
* `opentui:runtime-module:*` virtual modules, so the compiled component's
|
|
11
|
+
* imports do not resolve here.
|
|
12
|
+
*/
|
|
13
|
+
import { expect, test } from "bun:test";
|
|
14
|
+
import type { StatusDetail } from "../../shared/rpc-types";
|
|
15
|
+
import { statusText } from "./index";
|
|
16
|
+
import { loadCompiledStatusDialog } from "./load-compiled-status-dialog.mjs";
|
|
17
|
+
import { isMissingOpenTuiRuntime } from "./sidebar-mount";
|
|
18
|
+
import { mountV1StatusDialog } from "./status-dialog-mount";
|
|
19
|
+
import type { V2TuiContext } from "./types";
|
|
20
|
+
|
|
21
|
+
function context(dialog: Partial<V2TuiContext["ui"]["dialog"]>): V2TuiContext {
|
|
22
|
+
return {
|
|
23
|
+
location: { directory: process.cwd() },
|
|
24
|
+
renderer: { requestRender() {} },
|
|
25
|
+
data: {
|
|
26
|
+
listen: () => () => {},
|
|
27
|
+
location: { default: () => ({ directory: process.cwd() }) },
|
|
28
|
+
},
|
|
29
|
+
keymap: { layer: () => {} },
|
|
30
|
+
storage: {
|
|
31
|
+
memory: <Value extends object>(_key: string, options: { initial: Value }) =>
|
|
32
|
+
[
|
|
33
|
+
options.initial,
|
|
34
|
+
(mutation: (draft: Value) => void) => mutation(options.initial),
|
|
35
|
+
] as const,
|
|
36
|
+
},
|
|
37
|
+
ui: {
|
|
38
|
+
router: { current: () => ({ type: "session", sessionID: "ses-status" }) },
|
|
39
|
+
slot: () => () => {},
|
|
40
|
+
toast: { show() {} },
|
|
41
|
+
dialog: {
|
|
42
|
+
async alert() {},
|
|
43
|
+
async confirm() {
|
|
44
|
+
return false;
|
|
45
|
+
},
|
|
46
|
+
...dialog,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
test("the compiled status dialog cannot load without the host's OpenTUI runtime registry", async () => {
|
|
53
|
+
const error = await loadCompiledStatusDialog().then(
|
|
54
|
+
() => undefined,
|
|
55
|
+
(reason: unknown) => reason,
|
|
56
|
+
);
|
|
57
|
+
// If this ever resolves, the fallback arm below is unreachable and the test
|
|
58
|
+
// that forces it is measuring nothing.
|
|
59
|
+
expect(error).toBeDefined();
|
|
60
|
+
expect(String((error as Error).message)).toContain("opentui:runtime-module:");
|
|
61
|
+
expect(isMissingOpenTuiRuntime(error)).toBe(true);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("mountV1StatusDialog reports the missing registry as null instead of throwing", async () => {
|
|
65
|
+
expect(await mountV1StatusDialog(context({ show: () => {} }))).toBeNull();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("mountV1StatusDialog declines a host that publishes no component dialog surface", async () => {
|
|
69
|
+
expect(await mountV1StatusDialog(context({}))).toBeNull();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test("the text dialog carries the status a component dialog would have drawn", () => {
|
|
73
|
+
const detail = {
|
|
74
|
+
usagePercentage: 42.5,
|
|
75
|
+
inputTokens: 85_000,
|
|
76
|
+
contextLimit: 200_000,
|
|
77
|
+
historianRunning: false,
|
|
78
|
+
compartmentCount: 3,
|
|
79
|
+
memoryBlockCount: 2,
|
|
80
|
+
memoryCount: 7,
|
|
81
|
+
pendingOpsCount: 1,
|
|
82
|
+
lastTransformError: null,
|
|
83
|
+
} as StatusDetail;
|
|
84
|
+
// Spelled out rather than computed from statusText: an expectation built by
|
|
85
|
+
// the same function as the value under test agrees with it however wrong
|
|
86
|
+
// both are.
|
|
87
|
+
expect(statusText(detail)).toBe(
|
|
88
|
+
[
|
|
89
|
+
"Context: 42.5% (85K/200K tokens)",
|
|
90
|
+
"Historian: idle",
|
|
91
|
+
"Compartments: 3",
|
|
92
|
+
"Memories: 2 injected / 7 stored",
|
|
93
|
+
"Pending reductions: 1",
|
|
94
|
+
"Harness: opencode2",
|
|
95
|
+
].join("\n"),
|
|
96
|
+
);
|
|
97
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mounts the OpenCode 1 `/ctx-status` dialog component on the OpenCode 2 dialog
|
|
3
|
+
* surface, so both host generations show the same status view instead of one
|
|
4
|
+
* host getting a plain-text summary of it.
|
|
5
|
+
*
|
|
6
|
+
* It is the same arrangement as `sidebar-mount.ts`, for the same reasons: the
|
|
7
|
+
* component is loaded from `src/tui-compiled/` (Solid transform already applied,
|
|
8
|
+
* runtime imports pointing at the host's `opentui:runtime-module:*` registry) so
|
|
9
|
+
* it binds the host's single Solid/OpenTUI runtime rather than a second copy out
|
|
10
|
+
* of this package.
|
|
11
|
+
*
|
|
12
|
+
* Unlike the sidebar, this component fetches nothing: the caller passes the
|
|
13
|
+
* status snapshot it already loaded over RPC, so no second data layer is
|
|
14
|
+
* initialised here.
|
|
15
|
+
*/
|
|
16
|
+
import type { StatusDetail } from "../../shared/rpc-types";
|
|
17
|
+
import {
|
|
18
|
+
type CompiledStatusDialog,
|
|
19
|
+
loadCompiledStatusDialog,
|
|
20
|
+
} from "./load-compiled-status-dialog.mjs";
|
|
21
|
+
import { flattenTheme, isMissingOpenTuiRuntime } from "./sidebar-mount";
|
|
22
|
+
import type { V2TuiContext } from "./types";
|
|
23
|
+
|
|
24
|
+
export interface V1StatusDialogMount {
|
|
25
|
+
/** Replaces the host's dialog surface with the status view for one snapshot. */
|
|
26
|
+
show(detail: StatusDetail): void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Loads and mounts the v1 status dialog, or returns `null` when this host
|
|
31
|
+
* cannot render it: either it publishes no component dialog surface, or it
|
|
32
|
+
* registers no OpenTUI runtime modules to load the component through. Both
|
|
33
|
+
* cases are answered by the caller's plain-text dialog.
|
|
34
|
+
*/
|
|
35
|
+
export async function mountV1StatusDialog(
|
|
36
|
+
context: V2TuiContext,
|
|
37
|
+
): Promise<V1StatusDialogMount | null> {
|
|
38
|
+
if (typeof context.ui.dialog.show !== "function") return null;
|
|
39
|
+
let compiled: CompiledStatusDialog;
|
|
40
|
+
try {
|
|
41
|
+
compiled = await loadCompiledStatusDialog();
|
|
42
|
+
} catch (error) {
|
|
43
|
+
if (!isMissingOpenTuiRuntime(error)) throw error;
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
show: (detail) => {
|
|
48
|
+
context.ui.dialog.show?.(() =>
|
|
49
|
+
compiled.StatusDialog({
|
|
50
|
+
// Read through getters so a theme change repaints: the
|
|
51
|
+
// component wraps this in a memo, and the host's theme is a
|
|
52
|
+
// reactive store.
|
|
53
|
+
get api() {
|
|
54
|
+
return {
|
|
55
|
+
get theme() {
|
|
56
|
+
return {
|
|
57
|
+
get current() {
|
|
58
|
+
return flattenTheme(context.theme, context.themeMode);
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
get s() {
|
|
65
|
+
return detail;
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
);
|
|
69
|
+
// After `show`, which replaces the surface and resets it to the
|
|
70
|
+
// host's default width. "large" is the widest the host offers (88
|
|
71
|
+
// columns on GA 2.0.5); the component lays its sections out against
|
|
72
|
+
// whatever width it ends up with.
|
|
73
|
+
context.ui.dialog.set?.({ size: "large", centered: true });
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
|
+
import captured from "./__fixtures__/ga-host-theme.json";
|
|
3
|
+
import { flattenTheme } from "./sidebar-mount";
|
|
4
|
+
import type { V2ResolvedTheme } from "./types";
|
|
5
|
+
|
|
6
|
+
// The fixture is a recording taken off a running @opencode/cli GA host, not a
|
|
7
|
+
// hand-written object: an earlier mapping read `text.default` / `text.subdued`
|
|
8
|
+
// / `*.default`, names the theme package never had, and a fixture written in
|
|
9
|
+
// that same invented shape agreed with the mapping while every token fell to
|
|
10
|
+
// its hex fallback on the real host. A recorded shape fails instead.
|
|
11
|
+
type Mode = "dark" | "light";
|
|
12
|
+
const modes = captured.modes as Record<Mode, V2ResolvedTheme>;
|
|
13
|
+
const rgba = (r: number, g: number, b: number) => ({ r, g, b, a: 1 });
|
|
14
|
+
|
|
15
|
+
describe("OpenCode 2 theme mapping", () => {
|
|
16
|
+
for (const mode of ["dark", "light"] as const) {
|
|
17
|
+
it(`reads the host's resolved tokens on the ${mode} recording, not fallbacks`, () => {
|
|
18
|
+
const host = modes[mode];
|
|
19
|
+
const flat = flattenTheme(host, mode);
|
|
20
|
+
expect(flat.text).toEqual(host.text?.base);
|
|
21
|
+
expect(flat.textMuted).toEqual(host.text?.muted);
|
|
22
|
+
expect(flat.background).toEqual(host.background?.base);
|
|
23
|
+
expect(flat.borderActive).toEqual(host.border?.base);
|
|
24
|
+
expect(flat.error).toEqual(host.text?.feedback?.error?.base);
|
|
25
|
+
expect(flat.warning).toEqual(host.text?.feedback?.warning?.base);
|
|
26
|
+
expect(flat.success).toEqual(host.text?.feedback?.success?.base);
|
|
27
|
+
// Every mapped value must be a resolved colour object, never one of
|
|
28
|
+
// the string fallbacks: a renamed key would fall through silently.
|
|
29
|
+
for (const value of Object.values(flat)) expect(typeof value).toBe("object");
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
it("takes the accent from hue step 200, the step the host draws its own accent in", () => {
|
|
34
|
+
// On the recording, step 500 is a dark purple on the dark page and a pale
|
|
35
|
+
// orange on the light page; step 200 is the readable accent in both.
|
|
36
|
+
expect(flattenTheme(modes.dark, "dark").accent).toEqual(modes.dark.hue?.accent?.[200]);
|
|
37
|
+
expect(flattenTheme(modes.light, "light").accent).toEqual(modes.light.hue?.accent?.[200]);
|
|
38
|
+
expect(modes.dark.hue?.accent?.[200]).not.toEqual(modes.dark.hue?.accent?.[500]);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("never falls back to white text on a light host", () => {
|
|
42
|
+
const flat = flattenTheme(undefined, "light");
|
|
43
|
+
expect(flat.text).not.toBe("#ffffff");
|
|
44
|
+
expect(flat.background).toBe("#ffffff");
|
|
45
|
+
expect(flattenTheme(undefined, "dark").text).toBe("#ffffff");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("a hand-written object in the old invented shape gets fallbacks, proving the recording is load-bearing", () => {
|
|
49
|
+
const invented = {
|
|
50
|
+
text: { default: rgba(0, 0, 0), subdued: rgba(0.5, 0.5, 0.5) },
|
|
51
|
+
background: { default: rgba(1, 1, 1) },
|
|
52
|
+
} as unknown as V2ResolvedTheme;
|
|
53
|
+
const flat = flattenTheme(invented, "light");
|
|
54
|
+
expect(typeof flat.text).toBe("string");
|
|
55
|
+
expect(typeof flat.background).toBe("string");
|
|
56
|
+
});
|
|
57
|
+
});
|