@cortexkit/opencode-magic-context 0.42.5 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (511) hide show
  1. package/README.md +6 -7
  2. package/dist/agents/dreamer.d.ts +7 -9
  3. package/dist/agents/dreamer.d.ts.map +1 -1
  4. package/dist/agents/hidden-agent-registrations.d.ts.map +1 -1
  5. package/dist/agents/magic-context-prompt.d.ts.map +1 -1
  6. package/dist/config/index.d.ts +10 -1
  7. package/dist/config/index.d.ts.map +1 -1
  8. package/dist/config/live-run-config.d.ts +12 -0
  9. package/dist/config/live-run-config.d.ts.map +1 -0
  10. package/dist/config/live-snapshot.d.ts +32 -0
  11. package/dist/config/live-snapshot.d.ts.map +1 -0
  12. package/dist/config/schema/magic-context.d.ts +13 -2
  13. package/dist/config/schema/magic-context.d.ts.map +1 -1
  14. package/dist/{conflict-warning-hook-jyj54gbe.js → conflict-warning-hook-t2vb0wnx.js} +3 -3
  15. package/dist/{derive-budgets-v1fkhjjr.js → derive-budgets-0sg5vp61.js} +5 -2
  16. package/dist/features/builtin-commands/commands.d.ts +0 -4
  17. package/dist/features/builtin-commands/commands.d.ts.map +1 -1
  18. package/dist/features/magic-context/compaction-marker.d.ts +6 -0
  19. package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
  20. package/dist/features/magic-context/compartment-chunk-embedding.d.ts +4 -1
  21. package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
  22. package/dist/features/magic-context/compartment-lease.d.ts +8 -0
  23. package/dist/features/magic-context/compartment-lease.d.ts.map +1 -1
  24. package/dist/features/magic-context/compartment-storage.d.ts +21 -0
  25. package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
  26. package/dist/features/magic-context/context-authority.d.ts +37 -3
  27. package/dist/features/magic-context/context-authority.d.ts.map +1 -1
  28. package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
  29. package/dist/features/magic-context/dreamer/docs-proposals.d.ts +23 -0
  30. package/dist/features/magic-context/dreamer/docs-proposals.d.ts.map +1 -0
  31. package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts +5 -1
  32. package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
  33. package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts +48 -0
  34. package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -0
  35. package/dist/features/magic-context/dreamer/manual-summary.d.ts +7 -0
  36. package/dist/features/magic-context/dreamer/manual-summary.d.ts.map +1 -0
  37. package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
  38. package/dist/features/magic-context/dreamer/open-opencode-db.d.ts.map +1 -1
  39. package/dist/features/magic-context/dreamer/promote-primers.d.ts +8 -1
  40. package/dist/features/magic-context/dreamer/promote-primers.d.ts.map +1 -1
  41. package/dist/features/magic-context/dreamer/refresh-primers.d.ts.map +1 -1
  42. package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts +5 -2
  43. package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts.map +1 -1
  44. package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts +22 -13
  45. package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts.map +1 -1
  46. package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts +9 -0
  47. package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts.map +1 -1
  48. package/dist/features/magic-context/dreamer/task-config.d.ts.map +1 -1
  49. package/dist/features/magic-context/dreamer/task-executor.d.ts +3 -0
  50. package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
  51. package/dist/features/magic-context/dreamer/task-prompts.d.ts +7 -4
  52. package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -1
  53. package/dist/features/magic-context/dreamer/task-registry.d.ts +53 -2
  54. package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -1
  55. package/dist/features/magic-context/dreamer/task-scheduler.d.ts +3 -0
  56. package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
  57. package/dist/features/magic-context/dreamer/tick-failure.d.ts +38 -0
  58. package/dist/features/magic-context/dreamer/tick-failure.d.ts.map +1 -0
  59. package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
  60. package/dist/features/magic-context/git-commits/search-git-commits.d.ts +2 -0
  61. package/dist/features/magic-context/git-commits/search-git-commits.d.ts.map +1 -1
  62. package/dist/features/magic-context/memory/embedding-identity.d.ts +1 -0
  63. package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
  64. package/dist/features/magic-context/memory/embedding-local.d.ts +1 -0
  65. package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
  66. package/dist/features/magic-context/memory/embedding.d.ts +1 -1
  67. package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
  68. package/dist/features/magic-context/memory/memory-diagnostics.d.ts +6 -0
  69. package/dist/features/magic-context/memory/memory-diagnostics.d.ts.map +1 -0
  70. package/dist/features/magic-context/memory/memory-selection.d.ts +12 -0
  71. package/dist/features/magic-context/memory/memory-selection.d.ts.map +1 -0
  72. package/dist/features/magic-context/memory/memory-visibility.d.ts +46 -0
  73. package/dist/features/magic-context/memory/memory-visibility.d.ts.map +1 -0
  74. package/dist/features/magic-context/memory/mirror-reembed.d.ts +22 -0
  75. package/dist/features/magic-context/memory/mirror-reembed.d.ts.map +1 -0
  76. package/dist/features/magic-context/memory/project-identity.d.ts +9 -0
  77. package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
  78. package/dist/features/magic-context/memory/storage-memory-fts.d.ts +6 -2
  79. package/dist/features/magic-context/memory/storage-memory-fts.d.ts.map +1 -1
  80. package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
  81. package/dist/features/magic-context/memory/transformers-remote-host.d.ts +6 -0
  82. package/dist/features/magic-context/memory/transformers-remote-host.d.ts.map +1 -0
  83. package/dist/features/magic-context/memory/transformers-web-entry.d.ts.map +1 -1
  84. package/dist/features/magic-context/message-fts-rowid-map.d.ts +3 -1
  85. package/dist/features/magic-context/message-fts-rowid-map.d.ts.map +1 -1
  86. package/dist/features/magic-context/message-index-async.d.ts +8 -3
  87. package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
  88. package/dist/features/magic-context/message-index.d.ts +7 -1
  89. package/dist/features/magic-context/message-index.d.ts.map +1 -1
  90. package/dist/features/magic-context/message-time-backfill.d.ts +19 -0
  91. package/dist/features/magic-context/message-time-backfill.d.ts.map +1 -0
  92. package/dist/features/magic-context/migrations.d.ts +16 -0
  93. package/dist/features/magic-context/migrations.d.ts.map +1 -1
  94. package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
  95. package/dist/features/magic-context/mural/storage-mural.d.ts +5 -0
  96. package/dist/features/magic-context/mural/storage-mural.d.ts.map +1 -1
  97. package/dist/features/magic-context/opencode2-relabel.d.ts +132 -0
  98. package/dist/features/magic-context/opencode2-relabel.d.ts.map +1 -0
  99. package/dist/features/magic-context/overflow-detection.d.ts +3 -0
  100. package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
  101. package/dist/features/magic-context/project-embedding-registry.d.ts +1 -0
  102. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
  103. package/dist/features/magic-context/protection-window.d.ts +1 -1
  104. package/dist/features/magic-context/protection-window.d.ts.map +1 -1
  105. package/dist/features/magic-context/search.d.ts +6 -0
  106. package/dist/features/magic-context/search.d.ts.map +1 -1
  107. package/dist/features/magic-context/session-decision-calibration.d.ts +31 -0
  108. package/dist/features/magic-context/session-decision-calibration.d.ts.map +1 -0
  109. package/dist/features/magic-context/session-project-backfill.d.ts.map +1 -1
  110. package/dist/features/magic-context/shadow-backfill-state.d.ts +1 -1
  111. package/dist/features/magic-context/shadow-backfill-state.d.ts.map +1 -1
  112. package/dist/features/magic-context/smart-notes/compiler.d.ts +5 -1
  113. package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
  114. package/dist/features/magic-context/storage-clone.d.ts.map +1 -1
  115. package/dist/features/magic-context/storage-db.d.ts +1 -1
  116. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  117. package/dist/features/magic-context/storage-historian-runs.d.ts +4 -2
  118. package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -1
  119. package/dist/features/magic-context/storage-meta-persisted.d.ts +16 -2
  120. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  121. package/dist/features/magic-context/storage-meta-shared.d.ts +1 -1
  122. package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
  123. package/dist/features/magic-context/storage-meta.d.ts +1 -1
  124. package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
  125. package/dist/features/magic-context/storage-notes.d.ts +1 -0
  126. package/dist/features/magic-context/storage-notes.d.ts.map +1 -1
  127. package/dist/features/magic-context/storage-replay-document.d.ts +2 -0
  128. package/dist/features/magic-context/storage-replay-document.d.ts.map +1 -1
  129. package/dist/features/magic-context/storage-subagent-invocations.d.ts +1 -1
  130. package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -1
  131. package/dist/features/magic-context/storage-tags.d.ts +42 -4
  132. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  133. package/dist/features/magic-context/storage.d.ts +2 -2
  134. package/dist/features/magic-context/storage.d.ts.map +1 -1
  135. package/dist/features/magic-context/store-generation-rebase.d.ts +95 -0
  136. package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -0
  137. package/dist/features/magic-context/subagent-token-capture.d.ts +1 -0
  138. package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
  139. package/dist/features/magic-context/tagger.d.ts +2 -0
  140. package/dist/features/magic-context/tagger.d.ts.map +1 -1
  141. package/dist/features/magic-context/tool-definition-tokens.d.ts +1 -0
  142. package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
  143. package/dist/features/magic-context/tool-owner-backfill.d.ts.map +1 -1
  144. package/dist/features/magic-context/user-memory/review-user-memories.d.ts +5 -1
  145. package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
  146. package/dist/hooks/auto-update-checker/index.d.ts.map +1 -1
  147. package/dist/hooks/magic-context/apply-operations.d.ts +10 -1
  148. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  149. package/dist/hooks/magic-context/cache-busting-signals.d.ts +19 -4
  150. package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
  151. package/dist/hooks/magic-context/channel2-delivery.d.ts +8 -0
  152. package/dist/hooks/magic-context/channel2-delivery.d.ts.map +1 -1
  153. package/dist/hooks/magic-context/command-handler.d.ts +5 -4
  154. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
  155. package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
  156. package/dist/hooks/magic-context/compaction-off-transition.d.ts +1 -0
  157. package/dist/hooks/magic-context/compaction-off-transition.d.ts.map +1 -1
  158. package/dist/hooks/magic-context/compartment-prompt.d.ts +1 -1
  159. package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
  160. package/dist/hooks/magic-context/compartment-render-epoch.d.ts +3 -1
  161. package/dist/hooks/magic-context/compartment-render-epoch.d.ts.map +1 -1
  162. package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts +1 -1
  163. package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts.map +1 -1
  164. package/dist/hooks/magic-context/compartment-runner-historian.d.ts +1 -0
  165. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  166. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +19 -0
  167. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  168. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
  169. package/dist/hooks/magic-context/compartment-runner-types.d.ts +19 -11
  170. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  171. package/dist/hooks/magic-context/compartment-runner-validation.d.ts +4 -1
  172. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  173. package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
  174. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
  175. package/dist/hooks/magic-context/decay-render.d.ts +1 -0
  176. package/dist/hooks/magic-context/decay-render.d.ts.map +1 -1
  177. package/dist/hooks/magic-context/decision-calibration.d.ts +24 -0
  178. package/dist/hooks/magic-context/decision-calibration.d.ts.map +1 -0
  179. package/dist/hooks/magic-context/derive-budgets.d.ts +2 -0
  180. package/dist/hooks/magic-context/derive-budgets.d.ts.map +1 -1
  181. package/dist/hooks/magic-context/dropped-input-guard.d.ts +50 -4
  182. package/dist/hooks/magic-context/dropped-input-guard.d.ts.map +1 -1
  183. package/dist/hooks/magic-context/embed-history-runner.d.ts +30 -0
  184. package/dist/hooks/magic-context/embed-history-runner.d.ts.map +1 -0
  185. package/dist/hooks/magic-context/emergency-drop.d.ts +13 -8
  186. package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
  187. package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
  188. package/dist/hooks/magic-context/event-payloads.d.ts +2 -1
  189. package/dist/hooks/magic-context/event-payloads.d.ts.map +1 -1
  190. package/dist/hooks/magic-context/execute-status.d.ts +2 -1
  191. package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
  192. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +12 -4
  193. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
  194. package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
  195. package/dist/hooks/magic-context/historian-no-fire-cause.d.ts +5 -0
  196. package/dist/hooks/magic-context/historian-no-fire-cause.d.ts.map +1 -0
  197. package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts +3 -0
  198. package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts.map +1 -0
  199. package/dist/hooks/magic-context/hook-handlers.d.ts +0 -3
  200. package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
  201. package/dist/hooks/magic-context/hook.d.ts +4 -4
  202. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  203. package/dist/hooks/magic-context/host-served-rows.d.ts +58 -0
  204. package/dist/hooks/magic-context/host-served-rows.d.ts.map +1 -0
  205. package/dist/hooks/magic-context/inject-compartments.d.ts +38 -0
  206. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  207. package/dist/hooks/magic-context/legacy-compartments.d.ts +20 -0
  208. package/dist/hooks/magic-context/legacy-compartments.d.ts.map +1 -0
  209. package/dist/hooks/magic-context/live-session-state.d.ts +7 -7
  210. package/dist/hooks/magic-context/m0-token-breakdown.d.ts +6 -0
  211. package/dist/hooks/magic-context/m0-token-breakdown.d.ts.map +1 -1
  212. package/dist/hooks/magic-context/maintenance-authority.d.ts +0 -1
  213. package/dist/hooks/magic-context/maintenance-authority.d.ts.map +1 -1
  214. package/dist/hooks/magic-context/module-state-sync.d.ts +4 -1
  215. package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
  216. package/dist/hooks/magic-context/module-transport.d.ts +24 -2
  217. package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
  218. package/dist/hooks/magic-context/module-wire.d.ts +43 -1
  219. package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
  220. package/dist/hooks/magic-context/note-nudger.d.ts.map +1 -1
  221. package/dist/hooks/magic-context/postprocess-read-cache.d.ts +8 -0
  222. package/dist/hooks/magic-context/postprocess-read-cache.d.ts.map +1 -0
  223. package/dist/hooks/magic-context/producer-window-guard.d.ts +47 -1
  224. package/dist/hooks/magic-context/producer-window-guard.d.ts.map +1 -1
  225. package/dist/hooks/magic-context/producer-window-test-support.d.ts +14 -0
  226. package/dist/hooks/magic-context/producer-window-test-support.d.ts.map +1 -0
  227. package/dist/hooks/magic-context/protected-tail-boundary.d.ts +2 -0
  228. package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
  229. package/dist/hooks/magic-context/read-session-chunk.d.ts +51 -10
  230. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  231. package/dist/hooks/magic-context/read-session-db.d.ts +8 -0
  232. package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
  233. package/dist/hooks/magic-context/read-session-formatting.d.ts +6 -0
  234. package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
  235. package/dist/hooks/magic-context/read-session-raw.d.ts +4 -0
  236. package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
  237. package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts +6 -0
  238. package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
  239. package/dist/hooks/magic-context/recomp-orchestrator.d.ts +17 -39
  240. package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
  241. package/dist/hooks/magic-context/rust-mode-transform.d.ts +51 -0
  242. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  243. package/dist/hooks/magic-context/rust-refusal-recovery.d.ts +28 -0
  244. package/dist/hooks/magic-context/rust-refusal-recovery.d.ts.map +1 -0
  245. package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
  246. package/dist/hooks/magic-context/system-prompt-hash.d.ts +6 -7
  247. package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
  248. package/dist/hooks/magic-context/tag-messages.d.ts +21 -1
  249. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  250. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +63 -0
  251. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
  252. package/dist/hooks/magic-context/tokenizer-calibration.d.ts +19 -12
  253. package/dist/hooks/magic-context/tokenizer-calibration.d.ts.map +1 -1
  254. package/dist/hooks/magic-context/tool-drop-target.d.ts +52 -1
  255. package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
  256. package/dist/hooks/magic-context/tool-sweep-policy.d.ts +50 -0
  257. package/dist/hooks/magic-context/tool-sweep-policy.d.ts.map +1 -0
  258. package/dist/hooks/magic-context/transform-compartment-phase.d.ts +20 -1
  259. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  260. package/dist/hooks/magic-context/transform-context-state.d.ts +9 -0
  261. package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
  262. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +5 -3
  263. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  264. package/dist/hooks/magic-context/transform.d.ts +44 -4
  265. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  266. package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
  267. package/dist/{index-f9gem5cr.js → index-8w1skpnm.js} +85 -5
  268. package/dist/index-99sfbrrf.js +170 -0
  269. package/dist/index-9skq8m9y.js +16 -0
  270. package/dist/{index-3wbd8sdq.js → index-d0dh7v0f.js} +28107 -29850
  271. package/dist/{index-d8mgqezq.js → index-rpz2me0v.js} +133 -78
  272. package/dist/{index-p474rw9p.js → index-rvwvdq59.js} +1 -1
  273. package/dist/index-w2ety11c.js +393 -0
  274. package/dist/index-y5145x8k.js +619 -0
  275. package/dist/index-ygwdyntq.js +5407 -0
  276. package/dist/{index-jkrqhc7y.js → index-ykg9sdzz.js} +147 -28
  277. package/dist/index.d.ts.map +1 -1
  278. package/dist/index.js +7065 -3197
  279. package/dist/message-time-backfill-gzjer78y.js +108 -0
  280. package/dist/plugin/dream-timer.d.ts +13 -0
  281. package/dist/plugin/dream-timer.d.ts.map +1 -1
  282. package/dist/plugin/embedding-bootstrap.d.ts.map +1 -1
  283. package/dist/plugin/hooks/create-session-hooks.d.ts +5 -2
  284. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  285. package/dist/plugin/memory-id-translation.d.ts +109 -0
  286. package/dist/plugin/memory-id-translation.d.ts.map +1 -0
  287. package/dist/plugin/messages-transform.d.ts.map +1 -1
  288. package/dist/plugin/rpc-handlers.d.ts +10 -0
  289. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  290. package/dist/plugin/rust-note-backend.d.ts +84 -0
  291. package/dist/plugin/rust-note-backend.d.ts.map +1 -0
  292. package/dist/plugin/rust-tool-backends.d.ts +1 -1
  293. package/dist/plugin/rust-tool-backends.d.ts.map +1 -1
  294. package/dist/plugin/tool-registry.d.ts +1 -0
  295. package/dist/plugin/tool-registry.d.ts.map +1 -1
  296. package/dist/read-session-chunk-ec3jkvhg.js +61 -0
  297. package/dist/{recomp-orchestrator-k20sfpm2.js → recomp-orchestrator-6akjp11f.js} +8 -8
  298. package/dist/{send-session-notification-xnypkxpx.js → send-session-notification-f6gwkesy.js} +2 -2
  299. package/dist/shared/assistant-message-extractor.d.ts +6 -0
  300. package/dist/shared/assistant-message-extractor.d.ts.map +1 -1
  301. package/dist/shared/auto-update-provenance.d.ts +9 -0
  302. package/dist/shared/auto-update-provenance.d.ts.map +1 -0
  303. package/dist/shared/conflict-detector.d.ts +14 -5
  304. package/dist/shared/conflict-detector.d.ts.map +1 -1
  305. package/dist/shared/hidden-variant-warnings.d.ts +5 -0
  306. package/dist/shared/hidden-variant-warnings.d.ts.map +1 -0
  307. package/dist/shared/host-limitations.d.ts +14 -0
  308. package/dist/shared/host-limitations.d.ts.map +1 -0
  309. package/dist/shared/keep-subagents.d.ts +1 -1
  310. package/dist/shared/keep-subagents.d.ts.map +1 -1
  311. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  312. package/dist/shared/models-dev-cache.d.ts +1 -0
  313. package/dist/shared/models-dev-cache.d.ts.map +1 -1
  314. package/dist/shared/opencode-config-dir.d.ts +52 -0
  315. package/dist/shared/opencode-config-dir.d.ts.map +1 -1
  316. package/dist/shared/opencode-db-path.d.ts +46 -2
  317. package/dist/shared/opencode-db-path.d.ts.map +1 -1
  318. package/dist/shared/prompt-surface-runtime.d.ts +6 -6
  319. package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
  320. package/dist/shared/rpc-server.d.ts +10 -0
  321. package/dist/shared/rpc-server.d.ts.map +1 -1
  322. package/dist/shared/rpc-types.d.ts +64 -5
  323. package/dist/shared/rpc-types.d.ts.map +1 -1
  324. package/dist/shared/status-detail-text.d.ts +1 -3
  325. package/dist/shared/status-detail-text.d.ts.map +1 -1
  326. package/dist/shared/status-summary.d.ts +7 -0
  327. package/dist/shared/status-summary.d.ts.map +1 -1
  328. package/dist/shared/status-view.d.ts +229 -0
  329. package/dist/shared/status-view.d.ts.map +1 -0
  330. package/dist/shared/tag-transcript.d.ts.map +1 -1
  331. package/dist/shared/tail-hygiene-status.d.ts +8 -0
  332. package/dist/shared/tail-hygiene-status.d.ts.map +1 -1
  333. package/dist/shared/user-facing-codes.d.ts +32 -7
  334. package/dist/shared/user-facing-codes.d.ts.map +1 -1
  335. package/dist/shared/window-geometry.d.ts +3 -0
  336. package/dist/shared/window-geometry.d.ts.map +1 -1
  337. package/dist/{task-config-cv8k9y8r.js → task-config-ex4nt0q0.js} +1 -1
  338. package/dist/tools/ctx-expand/constants.d.ts +1 -1
  339. package/dist/tools/ctx-expand/constants.d.ts.map +1 -1
  340. package/dist/tools/ctx-expand/mode.d.ts +31 -0
  341. package/dist/tools/ctx-expand/mode.d.ts.map +1 -0
  342. package/dist/tools/ctx-expand/render.d.ts.map +1 -1
  343. package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
  344. package/dist/tools/ctx-memory/constants.d.ts +3 -1
  345. package/dist/tools/ctx-memory/constants.d.ts.map +1 -1
  346. package/dist/tools/ctx-memory/tools.d.ts +1 -0
  347. package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
  348. package/dist/tools/ctx-memory/types.d.ts +2 -2
  349. package/dist/tools/ctx-note/constants.d.ts +1 -1
  350. package/dist/tools/ctx-note/constants.d.ts.map +1 -1
  351. package/dist/tools/ctx-note/render.d.ts +88 -0
  352. package/dist/tools/ctx-note/render.d.ts.map +1 -0
  353. package/dist/tools/ctx-note/tools.d.ts.map +1 -1
  354. package/dist/tools/ctx-note/types.d.ts +1 -1
  355. package/dist/tools/ctx-note/types.d.ts.map +1 -1
  356. package/dist/tools/ctx-reduce/constants.d.ts +1 -1
  357. package/dist/tools/ctx-reduce/constants.d.ts.map +1 -1
  358. package/dist/tools/ctx-search/constants.d.ts +1 -1
  359. package/dist/tools/ctx-search/constants.d.ts.map +1 -1
  360. package/dist/tools/ctx-search/date-range.d.ts +9 -0
  361. package/dist/tools/ctx-search/date-range.d.ts.map +1 -0
  362. package/dist/tools/ctx-search/tools.d.ts.map +1 -1
  363. package/dist/tools/ctx-search/types.d.ts +3 -1
  364. package/dist/tools/ctx-search/types.d.ts.map +1 -1
  365. package/dist/tools/light-descriptions.d.ts +5 -5
  366. package/dist/tools/light-descriptions.d.ts.map +1 -1
  367. package/dist/tools/parameter-descriptions.d.ts +75 -0
  368. package/dist/tools/parameter-descriptions.d.ts.map +1 -0
  369. package/dist/transformers-node-wasm.js +1918 -826
  370. package/dist/transformers-web.js +1736 -636
  371. package/dist/{transformers.node-dpmf3wpx.js → transformers.node-3zqr6k1w.js} +4087 -2898
  372. package/dist/tui/data/context-db.d.ts +19 -7
  373. package/dist/tui/data/context-db.d.ts.map +1 -1
  374. package/dist/tui-compiled/data/context-db.d.ts +19 -7
  375. package/dist/tui-compiled/data/context-db.d.ts.map +1 -1
  376. package/dist/v2/fold/host-media.d.ts +36 -0
  377. package/dist/v2/fold/host-media.d.ts.map +1 -0
  378. package/dist/v2/fold/restore.d.ts +21 -1
  379. package/dist/v2/fold/restore.d.ts.map +1 -1
  380. package/dist/v2/hidden-completion.d.ts +114 -14
  381. package/dist/v2/hidden-completion.d.ts.map +1 -1
  382. package/dist/v2/hooks/commands.d.ts +29 -0
  383. package/dist/v2/hooks/commands.d.ts.map +1 -0
  384. package/dist/v2/hooks/context.d.ts +58 -2
  385. package/dist/v2/hooks/context.d.ts.map +1 -1
  386. package/dist/v2/hooks/deleted-session-tombstones.d.ts +10 -0
  387. package/dist/v2/hooks/deleted-session-tombstones.d.ts.map +1 -0
  388. package/dist/v2/hooks/dream-manual.d.ts +43 -0
  389. package/dist/v2/hooks/dream-manual.d.ts.map +1 -0
  390. package/dist/v2/hooks/dream-trigger.d.ts +7 -0
  391. package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
  392. package/dist/v2/hooks/hidden-child.d.ts +32 -0
  393. package/dist/v2/hooks/hidden-child.d.ts.map +1 -0
  394. package/dist/v2/hooks/model-limit-cache.d.ts +19 -0
  395. package/dist/v2/hooks/model-limit-cache.d.ts.map +1 -0
  396. package/dist/v2/hooks/payload.d.ts.map +1 -1
  397. package/dist/v2/hooks/provider-admission.d.ts +22 -0
  398. package/dist/v2/hooks/provider-admission.d.ts.map +1 -0
  399. package/dist/v2/hooks/rpc-live-state.d.ts +9 -0
  400. package/dist/v2/hooks/rpc-live-state.d.ts.map +1 -0
  401. package/dist/v2/hooks/store.d.ts +38 -2
  402. package/dist/v2/hooks/store.d.ts.map +1 -1
  403. package/dist/v2/hooks/tools.d.ts +8 -0
  404. package/dist/v2/hooks/tools.d.ts.map +1 -0
  405. package/dist/v2/hooks/types.d.ts +157 -19
  406. package/dist/v2/hooks/types.d.ts.map +1 -1
  407. package/dist/v2/hooks/usage-reading.d.ts +42 -0
  408. package/dist/v2/hooks/usage-reading.d.ts.map +1 -0
  409. package/dist/v2/host-service.d.ts +65 -0
  410. package/dist/v2/host-service.d.ts.map +1 -0
  411. package/dist/v2/server.d.ts +19 -0
  412. package/dist/v2/server.d.ts.map +1 -1
  413. package/dist/v2/server.js +141849 -110533
  414. package/dist/v2/store-reader.d.ts +78 -6
  415. package/dist/v2/store-reader.d.ts.map +1 -1
  416. package/dist/v2/tui/events.d.ts +7 -0
  417. package/dist/v2/tui/events.d.ts.map +1 -0
  418. package/dist/v2/tui/index.d.ts +33 -0
  419. package/dist/v2/tui/index.d.ts.map +1 -0
  420. package/dist/v2/tui/sidebar-mount.d.ts +40 -0
  421. package/dist/v2/tui/sidebar-mount.d.ts.map +1 -0
  422. package/dist/v2/tui/status-dialog-mount.d.ts +29 -0
  423. package/dist/v2/tui/status-dialog-mount.d.ts.map +1 -0
  424. package/dist/v2/tui/types.d.ts +148 -0
  425. package/dist/v2/tui/types.d.ts.map +1 -0
  426. package/dist/wrapup-orchestrator-5akc87gr.js +16 -0
  427. package/package.json +9 -7
  428. package/src/agents/dreamer.ts +7 -16
  429. package/src/agents/hidden-agent-registrations.ts +10 -22
  430. package/src/agents/magic-context-prompt.test.ts +29 -39
  431. package/src/agents/magic-context-prompt.ts +99 -122
  432. package/src/agents/permissions.test.ts +17 -21
  433. package/src/config/index.ts +39 -4
  434. package/src/config/live-run-config.test.ts +237 -0
  435. package/src/config/live-run-config.ts +80 -0
  436. package/src/config/live-schema-drift.test.ts +67 -0
  437. package/src/config/live-snapshot.test.ts +85 -0
  438. package/src/config/live-snapshot.ts +191 -0
  439. package/src/config/protected-tokens.test.ts +40 -0
  440. package/src/config/raw-loader.test.ts +1 -0
  441. package/src/config/schema/magic-context.test.ts +13 -5
  442. package/src/config/schema/magic-context.ts +109 -13
  443. package/src/features/magic-context/dreamer/task-registry.ts +137 -13
  444. package/src/shared/assistant-message-extractor.test.ts +21 -0
  445. package/src/shared/assistant-message-extractor.ts +43 -8
  446. package/src/shared/auto-update-provenance.ts +42 -0
  447. package/src/shared/child-session-teardown.test.ts +38 -3
  448. package/src/shared/child-session-teardown.ts +3 -3
  449. package/src/shared/conflict-detector.test.ts +277 -7
  450. package/src/shared/conflict-detector.ts +221 -80
  451. package/src/shared/hidden-variant-warnings.ts +21 -0
  452. package/src/shared/host-limitations.ts +43 -0
  453. package/src/shared/keep-subagents.ts +6 -6
  454. package/src/shared/model-suggestion-retry.test.ts +43 -0
  455. package/src/shared/model-suggestion-retry.ts +12 -0
  456. package/src/shared/models-dev-cache.test.ts +25 -0
  457. package/src/shared/models-dev-cache.ts +5 -0
  458. package/src/shared/opencode-config-dir.ts +80 -7
  459. package/src/shared/opencode-db-path.test.ts +174 -0
  460. package/src/shared/opencode-db-path.ts +193 -15
  461. package/src/shared/opencode-host-generation.test.ts +29 -0
  462. package/src/shared/prompt-surface-a1-golden.md +142 -215
  463. package/src/shared/prompt-surface-runtime.test.ts +20 -0
  464. package/src/shared/prompt-surface-runtime.ts +7 -5
  465. package/src/shared/rpc-server.ts +18 -0
  466. package/src/shared/rpc-types.ts +63 -4
  467. package/src/shared/status-detail-text.test.ts +52 -18
  468. package/src/shared/status-detail-text.ts +1 -90
  469. package/src/shared/status-summary.ts +37 -2
  470. package/src/shared/status-view.test.ts +441 -0
  471. package/src/shared/status-view.ts +707 -0
  472. package/src/shared/tag-transcript.ts +115 -16
  473. package/src/shared/tail-hygiene-status.ts +9 -1
  474. package/src/shared/user-facing-codes.test.ts +3 -4
  475. package/src/shared/user-facing-codes.ts +33 -8
  476. package/src/shared/window-geometry.test.ts +23 -5
  477. package/src/shared/window-geometry.ts +13 -3
  478. package/src/tui/data/context-db.ts +50 -15
  479. package/src/tui/dialogs/status-dialog-colors.test.ts +58 -0
  480. package/src/tui/dialogs/status-dialog.tsx +288 -0
  481. package/src/tui/entry.mjs +11 -1
  482. package/src/tui/index.tsx +7 -464
  483. package/src/tui/slots/sidebar-content.tsx +21 -5
  484. package/src/tui-compiled/data/context-db.ts +50 -15
  485. package/src/tui-compiled/dialogs/status-dialog.tsx +552 -0
  486. package/src/tui-compiled/index.tsx +43 -1025
  487. package/src/tui-compiled/slots/sidebar-content.tsx +173 -152
  488. package/src/v2/tui/__fixtures__/ga-host-theme.json +160 -0
  489. package/src/v2/tui/events.ts +23 -0
  490. package/src/v2/tui/host-contract.test.ts +251 -0
  491. package/src/v2/tui/index.ts +526 -0
  492. package/src/v2/tui/load-compiled-sidebar.d.mts +59 -0
  493. package/src/v2/tui/load-compiled-sidebar.mjs +24 -0
  494. package/src/v2/tui/load-compiled-status-dialog.d.mts +17 -0
  495. package/src/v2/tui/load-compiled-status-dialog.mjs +16 -0
  496. package/src/v2/tui/sidebar-fallback.test.ts +100 -0
  497. package/src/v2/tui/sidebar-mount.ts +164 -0
  498. package/src/v2/tui/sidebar-text.test.ts +70 -0
  499. package/src/v2/tui/status-dialog-fallback.test.ts +97 -0
  500. package/src/v2/tui/status-dialog-mount.ts +76 -0
  501. package/src/v2/tui/theme-mapping.test.ts +57 -0
  502. package/src/v2/tui/types.ts +132 -0
  503. package/tui.js +1 -0
  504. package/dist/features/magic-context/memory/memory-migration.d.ts +0 -129
  505. package/dist/features/magic-context/memory/memory-migration.d.ts.map +0 -1
  506. package/dist/hooks/magic-context/upgrade-reminder.d.ts +0 -76
  507. package/dist/hooks/magic-context/upgrade-reminder.d.ts.map +0 -1
  508. package/dist/index-1ar7b3e9.js +0 -637
  509. package/dist/index-4wwr6cz0.js +0 -112
  510. package/dist/index-avwt563y.js +0 -62
  511. package/dist/storage-meta-session-x3j0q9qy.js +0 -20
package/src/tui/index.tsx CHANGED
@@ -1,24 +1,16 @@
1
1
  /** @jsxImportSource @opentui/solid */
2
2
  // @ts-nocheck
3
- import { createMemo, createSignal } from "solid-js"
4
- import type { TuiPlugin, TuiPluginApi, TuiThemeCurrent } from "@opencode-ai/plugin/tui"
5
- import { renderUserStatusSummary, statusSummaryFromDetail } from "../shared/status-summary"
3
+ import { createMemo } from "solid-js"
4
+ import type { TuiPlugin, TuiPluginApi } from "@opencode-ai/plugin/tui"
5
+ import { StatusDialog } from "./dialogs/status-dialog"
6
6
  import { renderUserFacingFailure, userFacingFailureCode } from '../shared/user-facing-codes';
7
7
  import {
8
8
  createSidebarContentSlot,
9
9
  kickRecompProgressRefresh,
10
10
  refreshSidebarSnapshot,
11
11
  } from "./slots/sidebar-content"
12
- import packageJson from "../../package.json"
13
- import { closeRpc, dismissUpgradeReminder, getAnnouncement, getCompartmentCount, getRpcGeneration, initRpcClient, loadEmbedDetail, loadStatusDetail, loadToastDurationMs, markAnnounced, requestRecomp, requestUpgrade, type EmbedDetail, type StatusDetail } from "./data/context-db"
12
+ import { closeRpc, getAnnouncement, getCompartmentCount, getRpcGeneration, initRpcClient, loadEmbedDetail, loadStatusDetail, loadToastDurationMs, markAnnounced, requestRecomp, type EmbedDetail, type StatusDetail } from "./data/context-db"
14
13
  import { startNotificationSocket, stopNotificationSocket, type SocketNotification } from "./data/notification-socket"
15
- import { formatCacheTtlDisplay } from "../shared/cache-ttl-display"
16
- import { formatConfigParseStatusLine } from "../shared/config-diagnostics"
17
- import { formatThresholdPercent } from "../shared/format-threshold"
18
- import { formatTailHygiene } from "../shared/tail-hygiene-status"
19
- import { RUST_MODE_HOST_PATHS_LINE } from "../shared/rust-mode-status"
20
- import { formatWindowDerivationLine } from "../shared/window-geometry"
21
- import { compactionOffSidebarRows, nativeCompactionContextLabel } from "./compaction-off"
22
14
  import { isCompactionEnabled } from "../config/agent-disable"
23
15
  import { loadPluginConfig } from "../config"
24
16
  import { detectConflicts } from "../shared/conflict-detector"
@@ -133,360 +125,6 @@ function getSessionId(api: TuiPluginApi): string | null {
133
125
  return null
134
126
  }
135
127
 
136
- const R = (props: { t: TuiThemeCurrent; l: string; v: string; fg?: string }) => (
137
- <box width="100%" flexDirection="row" justifyContent="space-between">
138
- <text fg={props.t.textMuted}>{props.l}</text>
139
- <text fg={props.fg ?? props.t.text}>{props.v}</text>
140
- </box>
141
- )
142
-
143
- const StatusDialog = (props: { api: TuiPluginApi; s: StatusDetail; diagnostics?: boolean }) => {
144
- const theme = createMemo(() => (props.api as any).theme.current)
145
- const [diagnostics, setDiagnostics] = createSignal(props.diagnostics === true)
146
- const t = () => theme()
147
- const s = () => props.s
148
- const summaryLines = () =>
149
- renderUserStatusSummary(statusSummaryFromDetail(s()), "plain").split("\n").slice(1)
150
- const compactionOff = () => s().compaction_enabled === false
151
-
152
- // Prefer the RPC-provided model context limit (what the sidebar shows) so the
153
- // two surfaces never disagree. Fall back to deriving from usage% only when the
154
- // RPC limit is absent (0) — and that derivation is itself undefined at 0%, so
155
- // it stays "?" rather than showing a number inconsistent with the sidebar.
156
- const contextLimit = () =>
157
- s().contextLimit > 0
158
- ? s().contextLimit
159
- : s().usagePercentage > 0
160
- ? Math.round(s().inputTokens / (s().usagePercentage / 100))
161
- : 0
162
-
163
- const elapsed = () => (s().lastResponseTime > 0 ? Date.now() - s().lastResponseTime : 0)
164
-
165
- // Token breakdown segments — same colors as sidebar. Kept in sync with
166
- // slots/sidebar-content.tsx so the status dialog and sidebar read identically.
167
- const COLORS = {
168
- // Cool / structured — injected by the plugin into message[0]
169
- system: "#c084fc",
170
- docs: "#22d3ee",
171
- compartments: "#60a5fa",
172
- facts: "#fbbf24",
173
- memories: "#34d399",
174
- profile: "#a3e635",
175
- // Warm / user-facing — chat and tool traffic
176
- conversation: "#f87171",
177
- toolCalls: "#fb923c",
178
- toolDefs: "#f472b6",
179
- }
180
-
181
- const breakdownSegments = () => {
182
- const d = s()
183
- const total = d.inputTokens || 1
184
- const segs: Array<{ label: string; tokens: number; color: string; detail?: string }> = []
185
-
186
- if (d.systemPromptTokens > 0)
187
- segs.push({ label: "System", tokens: d.systemPromptTokens, color: COLORS.system })
188
- if (d.docsTokens > 0)
189
- segs.push({ label: "Docs", tokens: d.docsTokens, color: COLORS.docs })
190
- if (!compactionOff() && d.compartmentTokens > 0)
191
- segs.push({
192
- label: "Compartments",
193
- tokens: d.compartmentTokens,
194
- color: COLORS.compartments,
195
- detail: `(${d.compartmentCount})`,
196
- })
197
- if (d.factTokens > 0)
198
- segs.push({
199
- label: "Facts",
200
- tokens: d.factTokens,
201
- color: COLORS.facts,
202
- })
203
- if (d.memoryTokens > 0)
204
- segs.push({
205
- label: "Memories",
206
- tokens: d.memoryTokens,
207
- color: COLORS.memories,
208
- detail: `(${d.memoryBlockCount})`,
209
- })
210
- if (d.profileTokens > 0)
211
- segs.push({ label: "User Profile", tokens: d.profileTokens, color: COLORS.profile })
212
-
213
- if (d.conversationTokens > 0)
214
- segs.push({ label: "Conversation", tokens: d.conversationTokens, color: COLORS.conversation })
215
- if (d.toolCallTokens > 0)
216
- segs.push({ label: "Tool Calls", tokens: d.toolCallTokens, color: COLORS.toolCalls })
217
- if (d.toolDefinitionTokens > 0)
218
- segs.push({ label: "Tool Defs", tokens: d.toolDefinitionTokens, color: COLORS.toolDefs })
219
-
220
- return { segs, total }
221
- }
222
-
223
- // The status-dialog breakdown bar uses flex layout (same approach as the
224
- // sidebar breakdown). Each segment becomes a colored box with
225
- // flexGrow=tokens and flexBasis=0, parent has width="100%", so opentui
226
- // distributes the dialog's full width proportionally regardless of the
227
- // dialog's actual rendered width.
228
- const barSegments = () => breakdownSegments().segs.filter((seg) => seg.tokens > 0)
229
-
230
- return (
231
- <box flexDirection="column" width="100%" paddingLeft={2} paddingRight={2} paddingTop={1} paddingBottom={1}>
232
- {/* Title */}
233
- <box justifyContent="center" width="100%" marginBottom={1} flexDirection="row" gap={2}>
234
- <text fg={t().accent}><b>⚡ Magic Context Status</b></text>
235
- <text fg={t().textMuted}>v{packageJson.version}</text>
236
- </box>
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
- ) : (<>
253
- {s().configParseFailures.map((failure) => (
254
- <text fg={t().error}>{formatConfigParseStatusLine(failure)}</text>
255
- ))}
256
-
257
- <box flexDirection="row" justifyContent="space-between" width="100%">
258
- {compactionOff() ? (
259
- <text fg={t().accent}>
260
- <b>{nativeCompactionContextLabel(s())}</b>
261
- </text>
262
- ) : (
263
- <text fg={s().usagePercentage >= 80 ? t().error : s().usagePercentage >= 65 ? t().warning : t().accent}>
264
- <b>{s().usagePercentage.toFixed(1)}%</b> / {formatThresholdPercent(s().executeThreshold)}%{s().executeThresholdClamped ? "*" : ""}
265
- </text>
266
- )}
267
- <text fg={compactionOff() ? t().accent : s().usagePercentage >= 80 ? t().error : s().usagePercentage >= 65 ? t().warning : t().accent}>
268
- {fmt(s().inputTokens)} / {contextLimit() > 0 ? fmt(contextLimit()) : "?"} tokens
269
- </text>
270
- </box>
271
- {s().windowGeometry && (
272
- <text fg={t().textMuted}>
273
- {formatWindowDerivationLine(s().inputTokens, s().windowGeometry!)}
274
- </text>
275
- )}
276
-
277
- {/* Segmented breakdown bar: flex row of colored boxes filling
278
- the dialog width. See barSegments comment above. */}
279
- <box width="100%" flexDirection="row" height={1}>
280
- {barSegments().map((seg) => (
281
- <box
282
- key={seg.label}
283
- flexGrow={Math.max(1, seg.tokens)}
284
- flexBasis={0}
285
- height={1}
286
- backgroundColor={seg.color}
287
- />
288
- ))}
289
- </box>
290
-
291
- {/* Breakdown legend */}
292
- <box flexDirection="column">
293
- {breakdownSegments().segs.map((seg) => {
294
- const pct = ((seg.tokens / breakdownSegments().total) * 100).toFixed(1)
295
- return (
296
- <box key={seg.label} width="100%" flexDirection="row" justifyContent="space-between">
297
- <text fg={seg.color}>{seg.label} {seg.detail ?? ""}</text>
298
- <text fg={t().textMuted}>{fmt(seg.tokens)} ({pct}%)</text>
299
- </box>
300
- )
301
- })}
302
- <text fg={t().textMuted}>Conversation includes reasoning; hygiene excludes it</text>
303
- {s().tailHygiene !== undefined && (
304
- <R
305
- t={t()}
306
- l="Hygiene"
307
- v={formatTailHygiene(s().tailHygiene!)}
308
- fg={s().tailHygiene!.evaluable ? t().accent : t().warning}
309
- />
310
- )}
311
- </box>
312
-
313
- {/* Recomp / session-upgrade live progress (full width, only while
314
- running or just finished — dogfood 2026-05-30). */}
315
- {!compactionOff() && s().recompProgress && (() => {
316
- const p = s().recompProgress!
317
- // Label follows the flow that started the run, so a plain
318
- // /ctx-recomp never reads as an "Upgrade" (dogfood 2026-06-04).
319
- const verb = p.kind === "upgrade" ? "Upgrade" : p.kind === "embed" ? "Embed" : "Recomp"
320
- return (
321
- <box marginTop={1} width="100%" flexDirection="column">
322
- <text fg={t().text}><b>{verb}</b></text>
323
- {(() => {
324
- if (p.phase === "recomp") {
325
- const frac = p.totalMessages > 0 ? p.processedMessages / p.totalMessages : 0
326
- const width = 24
327
- const filled = Math.round(Math.max(0, Math.min(1, frac)) * width)
328
- const bar = p.totalMessages > 0
329
- ? `[${"█".repeat(filled)}${"░".repeat(width - filled)}]`
330
- : "(starting…)"
331
- const activeLabel = p.kind === "upgrade" ? "upgrading" : p.kind === "embed" ? "embedding" : "comparting"
332
- return (
333
- <>
334
- <R t={t()} l={activeLabel} v={p.totalMessages > 0 ? `${bar} ${Math.round(frac * 100)}%` : bar} fg={t().warning} />
335
- {p.note ? <R t={t()} l="Status" v={p.note} fg={t().textMuted} /> : null}
336
- {p.kind === "embed"
337
- ? <R t={t()} l="Compartments" v={`${p.processedMessages}/${p.totalMessages} embedded`} fg={t().textMuted} />
338
- : <R t={t()} l="Compartments" v={`${p.compartmentsCreated} (${p.passCount} pass${p.passCount === 1 ? "" : "es"})`} fg={t().textMuted} />}
339
- </>
340
- )
341
- }
342
- if (p.phase === "migration") return <R t={t()} l="Status" v={p.note ?? "Migrating memories ⟳"} fg={t().warning} />
343
- if (p.phase === "done") return <R t={t()} l="Status" v={`✓ ${verb} complete`} fg={t().accent} />
344
- if (p.phase === "skipped") return <R t={t()} l="Status" v={p.message ?? `${verb} stopped early`} fg={t().textMuted} />
345
- return <R t={t()} l="Status" v={`✗ ${verb} failed${p.message ? `: ${p.message}` : ""}`} fg={t().error} />
346
- })()}
347
- </box>
348
- )
349
- })()}
350
-
351
- {s().hostBackendsModuleSide && (
352
- <box marginTop={1} width="100%" flexDirection="column">
353
- <text fg={t().text}><b>Rust Mode</b></text>
354
- <text fg={t().textMuted}>{RUST_MODE_HOST_PATHS_LINE}</text>
355
- </box>
356
- )}
357
-
358
- <box flexDirection="row" width="100%" marginTop={1} gap={4}>
359
- {compactionOff() ? (
360
- <box flexDirection="column" flexGrow={1} flexBasis={0}>
361
- <text fg={t().text}><b>Knowledge</b></text>
362
- {compactionOffSidebarRows(s()).map((row) => (
363
- <R
364
- t={t()}
365
- l={row.label}
366
- v={row.value}
367
- fg={row.label === "Memories" ? t().accent : t().textMuted}
368
- />
369
- ))}
370
- {s().readySmartNoteCount > 0 && (
371
- <R t={t()} l="Smart Notes" v={`${s().readySmartNoteCount} ready`} fg={t().accent} />
372
- )}
373
- {s().lastDreamerRunAt && (
374
- <R t={t()} l="Dreamer" v={`last ${relTime(s().lastDreamerRunAt!)}`} fg={t().textMuted} />
375
- )}
376
- </box>
377
- ) : (
378
- <>
379
- <box flexDirection="column" flexGrow={1} flexBasis={0}>
380
- <text fg={t().text}><b>Tags</b></text>
381
- <R
382
- t={t()}
383
- l="Active"
384
- v={
385
- s().tagCountsAuthoritative === false
386
- ? "n/a (module total only)"
387
- : `${s().activeTags} (~${fmtBytes(s().activeBytes)})`
388
- }
389
- />
390
- <R
391
- t={t()}
392
- l="Dropped"
393
- v={
394
- s().tagCountsAuthoritative === false
395
- ? "n/a (module total only)"
396
- : String(s().droppedTags)
397
- }
398
- />
399
- <R t={t()} l="Total" v={String(s().totalTags)} fg={t().textMuted} />
400
- <box marginTop={1}>
401
- <text fg={t().text}><b>Pending Queue</b></text>
402
- </box>
403
- <R t={t()} l="Drops" v={String(s().pendingOpsCount)} fg={s().pendingOpsCount > 0 ? t().warning : t().textMuted} />
404
- <box marginTop={1}>
405
- <text fg={t().text}><b>Cache TTL</b></text>
406
- </box>
407
- <R
408
- t={t()}
409
- l="Configured"
410
- v={formatCacheTtlDisplay({
411
- value: s().cacheTtl,
412
- source: s().cacheTtlSource,
413
- modelKey: s().cacheTtlModelKey,
414
- }).replace(/^Cache TTL: /, "")}
415
- />
416
- <R t={t()} l="Last response" v={s().lastResponseTime > 0 ? `${Math.round(elapsed() / 1000)}s ago` : "never"} />
417
- <R t={t()} l="Remaining" v={s().cacheExpired ? "expired" : s().cacheNeverExpires ? "never (MC never assumes expiry — external cache-keep)" : `${Math.round(s().cacheRemainingMs / 1000)}s`} fg={s().cacheExpired ? t().warning : t().textMuted} />
418
- <R t={t()} l="Auto-execute" v={s().cacheExpired ? "yes (expired)" : s().cacheNeverExpires ? `at ≥${formatThresholdPercent(s().executeThreshold)}%` : `at TTL or ≥${formatThresholdPercent(s().executeThreshold)}%`} fg={t().textMuted} />
419
- <box marginTop={1}>
420
- <text fg={t().text}><b>Memory</b></text>
421
- </box>
422
- <R t={t()} l="Active" v={String(s().memoryCount)} fg={t().accent} />
423
- <R t={t()} l="Injected" v={String(s().memoryBlockCount)} fg={t().textMuted} />
424
- </box>
425
- <box flexDirection="column" flexGrow={1} flexBasis={0}>
426
- <text fg={t().text}><b>Reductions</b></text>
427
- <R t={t()} l="Execute threshold" v={`${formatThresholdPercent(s().executeThreshold)}%${s().executeThresholdClamped ? "*" : ""}`} />
428
- <R t={t()} l="Last reduce anchor" v={`${fmt(s().lastNudgeTokens)} tok`} />
429
- <box marginTop={1}>
430
- <text fg={t().text}><b>Context Details</b></text>
431
- </box>
432
- <R t={t()} l="Protected tags" v={String(s().protectedTagCount)} fg={t().textMuted} />
433
- <R t={t()} l="Subagent" v={s().isSubagent ? "yes" : "no"} fg={t().textMuted} />
434
- <box marginTop={1}>
435
- <text fg={t().text}><b>History Compression</b></text>
436
- </box>
437
- {typeof s().boundaryPresent === "boolean" && (
438
- <R t={t()} l="Boundary" v={s().boundaryPresent ? "present" : "absent"} />
439
- )}
440
- {s().coverageOrdinal !== undefined && (
441
- <R t={t()} l="Coverage ordinal" v={s().coverageOrdinal == null ? "none" : String(s().coverageOrdinal)} />
442
- )}
443
- {typeof s().boundaryPresent === "boolean" && (
444
- <R t={t()} l="Compartments" v={String(s().compartmentCount)} />
445
- )}
446
- <R t={t()} l="History block" v={`~${fmt(s().historyBlockTokens)} tok`} />
447
- {s().compressionBudget != null && (
448
- <R t={t()} l="Budget" v={`~${fmt(s().compressionBudget!)} tok (${s().compressionUsage} used)`} />
449
- )}
450
- {s().lastDreamerRunAt && (
451
- <R t={t()} l="Dreamer" v={`last ${relTime(s().lastDreamerRunAt!)}`} fg={t().textMuted} />
452
- )}
453
- </box>
454
- </>
455
- )}
456
- </box>
457
-
458
- {/* Error (full width, conditional) */}
459
- {s().lastTransformError && (
460
- <box marginTop={1} width="100%">
461
- <text fg={t().error}>{renderUserFacingFailure("transform_update_failed")}</text>
462
- </box>
463
- )}
464
-
465
- <box marginTop={1} width="100%">
466
- <text fg={t().text}><b>Logger</b></text>
467
- <R
468
- t={t()}
469
- l="Swallowed writes"
470
- v={String(s().loggerDiagnostics?.swallowedWriteCount ?? 0)}
471
- fg={(s().loggerDiagnostics?.swallowedWriteCount ?? 0) > 0 ? t().error : t().textMuted}
472
- />
473
- {s().loggerDiagnostics?.lastErrorMessage && (
474
- <R t={t()} l="Warning" v={renderUserFacingFailure("status_unavailable")} fg={t().error} />
475
- )}
476
- {s().loggerDiagnostics?.lastErrorTime && (
477
- <R t={t()} l="Last error time" v={s().loggerDiagnostics.lastErrorTime} fg={t().textMuted} />
478
- )}
479
- </box>
480
- </>)}
481
-
482
- {/* Footer */}
483
- <box marginTop={1} justifyContent="flex-end" width="100%">
484
- <text fg={t().textMuted}>Esc to close</text>
485
- </box>
486
- </box>
487
- )
488
- }
489
-
490
128
  function getModelKeyFromMessages(api: TuiPluginApi, sessionId: string): string | undefined {
491
129
  try {
492
130
  const msgs = api.state.session.messages(sessionId)
@@ -558,90 +196,9 @@ async function showRecompDialog(api: TuiPluginApi, targetSessionId = getSessionI
558
196
  return true
559
197
  }
560
198
 
561
- function showUpgradeDialog(
562
- api: TuiPluginApi,
563
- resume?: { stagedCount: number; stagedThrough: number },
564
- targetSessionId = getSessionId(api),
565
- ): boolean {
566
- const sessionId = targetSessionId
567
- if (!sessionId) {
568
- // No active session — nothing to upgrade. Silently skip (the server only
569
- // enqueues this for sessions with legacy compartments, but the TUI may
570
- // have switched sessions before the poller fired).
571
- return false
572
- }
573
-
574
- if (getSessionId(api) !== sessionId) return false
575
-
576
- const title = resume ? "🎆 Resume the interrupted upgrade?" : "🎆 Historian V2 is released!"
577
- const message = resume
578
- ? [
579
- `An earlier upgrade to the new historian format was interrupted. ${resume.stagedCount} compartment${resume.stagedCount === 1 ? " was" : "s were"} already rebuilt (through message ${resume.stagedThrough}). Resuming continues from where it left off — nothing already rebuilt is reprocessed.`,
580
- "",
581
- "Resuming will:",
582
- "• Rebuild the remaining compartments into the new layered format",
583
- "• Re-organize this project's memories into the new taxonomy (once per project)",
584
- "",
585
- "The historian runs in the background and you can keep working. You can also resume via /ctx-session-upgrade later.",
586
- "",
587
- "Resume the upgrade now?",
588
- ].join("\n")
589
- : [
590
- "This session's compartments are written by the old historian. The session is still usable with its old compartments, however it's strongly advised to upgrade them to the new format. This means every compartment needs to be reprocessed by the new historian, which might take a while depending on how big your session is.",
591
- "",
592
- "Running the upgrade will:",
593
- "• Rebuild this session's compartments into the new layered format",
594
- "• Re-organize this project's memories into the new taxonomy (once per project)",
595
- "",
596
- "The historian runs in the background and you can keep working while older compartments are reprocessed. You can also upgrade via /ctx-session-upgrade later.",
597
- "",
598
- "Run the upgrade now?",
599
- ].join("\n")
600
-
601
- api.ui.dialog.replace(
602
- () => (
603
- <api.ui.DialogConfirm
604
- title={title}
605
- message={message}
606
- onConfirm={async () => {
607
- const started = await requestUpgrade(sessionId)
608
- if (!started) {
609
- showToast(api, { message: "Session upgrade request failed", variant: "error" })
610
- return
611
- }
612
- // The RPC call fires no message event, so start the sidebar's
613
- // progress poll only after the server accepts the request.
614
- kickRecompProgressRefresh()
615
- showToast(api, {
616
- message: resume
617
- ? "Resuming session upgrade — running in the background"
618
- : "Session upgrade started — running in the background",
619
- variant: "info",
620
- })
621
- void dismissUpgradeReminder(sessionId)
622
- }}
623
- onCancel={() => {
624
- // Explicit decline → set the durable stamp so we don't re-prompt
625
- // on every restart. The fix for stamp-on-display trapping a
626
- // never-upgraded session (dogfood 2026-05-30) relies on THIS
627
- // being the only place the TUI path stamps.
628
- void dismissUpgradeReminder(sessionId)
629
- showToast(api, {
630
- message: "Upgrade skipped — run /ctx-session-upgrade anytime",
631
- variant: "info",
632
- durationOverrideMs: 4000,
633
- })
634
- }}
635
- />
636
- ),
637
- )
638
- return true
639
- }
640
-
641
199
  async function showStatusDialog(
642
200
  api: TuiPluginApi,
643
201
  targetSessionId = getSessionId(api),
644
- initialDiagnostics = false,
645
202
  ): Promise<boolean> {
646
203
  const sessionId = targetSessionId
647
204
  if (!sessionId) {
@@ -664,9 +221,7 @@ async function showStatusDialog(
664
221
  return false
665
222
  }
666
223
 
667
- api.ui.dialog.replace(() => (
668
- <StatusDialog api={api} s={result.detail} diagnostics={initialDiagnostics} />
669
- ))
224
+ api.ui.dialog.replace(() => <StatusDialog api={api} s={result.detail} />)
670
225
  return true
671
226
  }
672
227
 
@@ -1140,6 +695,7 @@ const tui: TuiPlugin = async (api, _options, meta) => {
1140
695
  }
1141
696
  if (n.type === "toast") {
1142
697
  const p = n.payload
698
+ await refreshToastDurationMs()
1143
699
  showToast(api, {
1144
700
  message: String(p.message ?? ""),
1145
701
  variant: (p.variant as "info" | "warning" | "error" | "success") ?? "info",
@@ -1155,24 +711,11 @@ const tui: TuiPlugin = async (api, _options, meta) => {
1155
711
  const stillActive = () =>
1156
712
  getRpcGeneration() === generation && getSessionId(api) === requestedSessionId
1157
713
  if (action === "show-status-dialog") {
1158
- return (
1159
- stillActive() &&
1160
- (await showStatusDialog(api, requestedSessionId, n.payload?.diagnostics === true))
1161
- )
714
+ return stillActive() && (await showStatusDialog(api, requestedSessionId))
1162
715
  }
1163
716
  if (action === "show-recomp-dialog") {
1164
717
  return stillActive() && (await showRecompDialog(api, requestedSessionId))
1165
718
  }
1166
- if (action === "show-upgrade-dialog") {
1167
- const resume =
1168
- n.payload?.resume === true
1169
- ? {
1170
- stagedCount: Number(n.payload?.stagedCount ?? 0),
1171
- stagedThrough: Number(n.payload?.stagedThrough ?? 0),
1172
- }
1173
- : undefined
1174
- return stillActive() && showUpgradeDialog(api, resume, requestedSessionId)
1175
- }
1176
719
  if (action === "show-embed-dialog") {
1177
720
  return stillActive() && (await showEmbedDialog(api, requestedSessionId))
1178
721
  }
@@ -5,6 +5,7 @@ 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 { renderUserFacingFailure } from "../../shared/user-facing-codes"
8
9
  import { compactionOffSidebarRows, nativeCompactionContextLabel } from "../compaction-off"
9
10
  import {
10
11
  computeEffectiveOrder,
@@ -102,7 +103,10 @@ function createSidebarController(initialPrefs: MagicContextTuiPrefs): SidebarCon
102
103
  function compactTokens(value: number): string {
103
104
  if (value >= 1_000_000) return `${(value / 1_000_000).toFixed(1)}M`
104
105
  if (value >= 1_000) return `${(value / 1_000).toFixed(0)}K`
105
- return String(value)
106
+ // Token counts are whole numbers to the reader even when the tokenizer
107
+ // calibration leaves them fractional; a raw `522.4` beside a `63K` reads as
108
+ // a measurement error rather than as precision.
109
+ return String(Math.round(value))
106
110
  }
107
111
 
108
112
  /**
@@ -369,9 +373,9 @@ const SectionHeader = (props: { theme: TuiThemeCurrent; title: string }) => (
369
373
  </box>
370
374
  )
371
375
 
372
- // Live recomp / session-upgrade progress. Renders while an upgrade runs (and
373
- // briefly after it finishes) so a multi-minute rebuild is visible instead of a
374
- // single missed toast (dogfood 2026-05-30).
376
+ // Live recomp progress. Renders while a rebuild runs (and briefly after it
377
+ // finishes) so a multi-minute rebuild is visible instead of a single missed
378
+ // toast (dogfood 2026-05-30).
375
379
  const RecompProgressSection = (props: {
376
380
  theme: TuiThemeCurrent
377
381
  progress: NonNullable<SidebarSnapshot["recompProgress"]>
@@ -773,6 +777,18 @@ const SidebarContent = (props: {
773
777
  </box>
774
778
  )}
775
779
 
780
+ {/* Named limitations of the host itself (for example an experimental
781
+ mode this OpenCode version cannot run). They stay for as long as
782
+ the process runs, so they are drawn like the transform error
783
+ rather than as a one-shot toast. */}
784
+ <For each={s()?.hostLimitations ?? []}>
785
+ {(limitation) => (
786
+ <box marginTop={1} width="100%">
787
+ <text fg={props.theme.warning}>⚠ {renderUserFacingFailure(limitation, "plain")}</text>
788
+ </box>
789
+ )}
790
+ </For>
791
+
776
792
  {s()?.dreamerProgress && (
777
793
  <box marginTop={1} width="100%">
778
794
  <text fg={props.theme.warning}>
@@ -898,7 +914,7 @@ const SidebarContent = (props: {
898
914
  value={String(s()?.compartmentCount ?? 0)}
899
915
  />
900
916
 
901
- {/* Recomp / session-upgrade live progress */}
917
+ {/* Recomp live progress */}
902
918
  <Show when={s()?.recompProgress}>
903
919
  {(progress) => (
904
920
  <RecompProgressSection theme={props.theme} progress={progress()} />