@iowarp/clio-coder 0.5.0 → 0.5.2

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 (312) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/CHANGELOG.md +35 -0
  3. package/CONTRIBUTING.md +9 -0
  4. package/README.md +12 -9
  5. package/ROADMAP.md +30 -5
  6. package/dist/{acp-KS7ARGV6.js → acp-F6PGOFZ4.js} +2 -2
  7. package/dist/{agents-YOGJ2YEJ.js → agents-ZHP4R6EX.js} +22 -21
  8. package/dist/assets/codewiki.json +1 -1
  9. package/dist/{auth-CEDCO6O6.js → auth-N75U2H3Z.js} +4 -4
  10. package/dist/{chunk-D3KWFOUT.js → chunk-23UIXH6Z.js} +3 -3
  11. package/dist/{chunk-ZR5YA6ZF.js → chunk-36XVK5P5.js} +5 -5
  12. package/dist/{chunk-AVSR2HKI.js → chunk-3DZ4LPLS.js} +6 -6
  13. package/dist/{chunk-LYJJ6546.js → chunk-3GSPCWFX.js} +12 -12
  14. package/dist/{chunk-CRHPCPZP.js → chunk-4KC4CHKJ.js} +2 -2
  15. package/dist/{chunk-4VDHLCF5.js → chunk-4WJBWKMI.js} +2 -2
  16. package/dist/{chunk-KBUTSJSR.js → chunk-4XBYHXGK.js} +2 -2
  17. package/dist/{chunk-6W75D37F.js → chunk-53P775GE.js} +6 -3
  18. package/dist/{chunk-XZWSP67B.js → chunk-5APYAXCB.js} +2 -2
  19. package/dist/{chunk-D65E25JG.js → chunk-67HPYNTJ.js} +2 -2
  20. package/dist/{chunk-5JQR5B4D.js → chunk-6KV4KCQZ.js} +4 -4
  21. package/dist/{chunk-V4XJWDHR.js → chunk-6UKFRTXI.js} +2 -1
  22. package/dist/{chunk-NDPF2N2L.js → chunk-7DW7CJW2.js} +2 -2
  23. package/dist/{chunk-5KQEUIWM.js → chunk-7LUEQODV.js} +4 -4
  24. package/dist/{chunk-LNOXCGN2.js → chunk-7UFDIOBT.js} +3 -3
  25. package/dist/{chunk-DXSETN72.js → chunk-7WUGNN43.js} +2 -2
  26. package/dist/{chunk-V35KZDUZ.js → chunk-AA3GRZWS.js} +2 -2
  27. package/dist/{chunk-X4CEFOSG.js → chunk-ADO3OQIC.js} +4 -4
  28. package/dist/{chunk-UX2L5CUD.js → chunk-AI36V3ON.js} +3 -3
  29. package/dist/{chunk-B7GY6QER.js → chunk-B26OUMJW.js} +2 -2
  30. package/dist/{chunk-LAR7DX5E.js → chunk-B5TASTCK.js} +153 -62
  31. package/dist/{chunk-TGWZXJ7L.js → chunk-BEMQK5Q7.js} +92 -84
  32. package/dist/{chunk-RNDCROSG.js → chunk-CNXU7TR2.js} +3 -3
  33. package/dist/{chunk-3JLTRPN7.js → chunk-CVMUXT64.js} +35 -66
  34. package/dist/{chunk-733ZBT5P.js → chunk-E74MJF6G.js} +4 -4
  35. package/dist/{chunk-T2MDZES3.js → chunk-EBMTBE76.js} +3 -3
  36. package/dist/{chunk-OZ76TLGU.js → chunk-EEITU7S6.js} +2 -2
  37. package/dist/{chunk-GRHOXDKB.js → chunk-ELDJWJKM.js} +97 -14
  38. package/dist/{chunk-GCQFN7YI.js → chunk-EMYEQLWO.js} +2 -2
  39. package/dist/{chunk-LTWH2ACR.js → chunk-EQPFEDFV.js} +222 -127
  40. package/dist/{chunk-TDGYTWM6.js → chunk-F4I3H56H.js} +2 -2
  41. package/dist/chunk-F6KCJO3U.js +523 -0
  42. package/dist/{chunk-FGSQHUCK.js → chunk-F6VKWTTY.js} +5 -5
  43. package/dist/{chunk-UJD5MPP6.js → chunk-FLNXQQ5B.js} +2 -2
  44. package/dist/{chunk-EX57VVWW.js → chunk-FOSRJ2VZ.js} +4 -4
  45. package/dist/{chunk-ZARZ4POR.js → chunk-G5ZDQQE3.js} +3 -3
  46. package/dist/{chunk-HQVN7G4F.js → chunk-G62JBPXN.js} +7 -7
  47. package/dist/{chunk-ZJPORZTC.js → chunk-GIAI7A2K.js} +2 -2
  48. package/dist/chunk-GPTR6OTU.js +2551 -0
  49. package/dist/{chunk-EZD2BXGP.js → chunk-GUFQPTQK.js} +2 -2
  50. package/dist/{chunk-OPD7GL6F.js → chunk-H6FQVNZC.js} +8 -7
  51. package/dist/chunk-H7REJ7L5.js +80 -0
  52. package/dist/{chunk-EYTLV3W3.js → chunk-HTWTORF7.js} +2 -2
  53. package/dist/{chunk-DF6PI6GN.js → chunk-I6UKQPGS.js} +3 -3
  54. package/dist/{chunk-ISHUS7HC.js → chunk-JRW236JT.js} +3 -3
  55. package/dist/{chunk-DE2LU267.js → chunk-KKAJGT3B.js} +3 -2
  56. package/dist/{chunk-OV62D6KO.js → chunk-KQMYL5GR.js} +3 -3
  57. package/dist/{chunk-QDUUOZ3S.js → chunk-KWMFC7FN.js} +3 -3
  58. package/dist/{chunk-R7FGRZNF.js → chunk-LXYHCCIZ.js} +9 -9
  59. package/dist/{chunk-NFSK2VNU.js → chunk-LZMTVVN4.js} +2 -2
  60. package/dist/{chunk-62UK7AGW.js → chunk-M5PMRZSR.js} +397 -44
  61. package/dist/chunk-MMZMM6SW.js +131 -0
  62. package/dist/{chunk-FFYTC2KQ.js → chunk-MNABNEBX.js} +2 -2
  63. package/dist/{chunk-XMDBTYCH.js → chunk-N3CWOGVF.js} +3 -3
  64. package/dist/{chunk-VYRQHORQ.js → chunk-NMQSO6Z6.js} +4 -3
  65. package/dist/{chunk-R2UUNSNQ.js → chunk-O3ZAF7UY.js} +18 -5
  66. package/dist/{chunk-4SYHGVDE.js → chunk-OQNCLZI4.js} +4 -4
  67. package/dist/{chunk-EG4ARXPC.js → chunk-OX6QTA4N.js} +3 -3
  68. package/dist/{chunk-P4GNZPXO.js → chunk-OYUS3UZP.js} +2 -2
  69. package/dist/{chunk-OQ2EOAHA.js → chunk-PF36KOGI.js} +291 -112
  70. package/dist/{chunk-55RMDDFM.js → chunk-PGQG7ZMW.js} +2 -2
  71. package/dist/{chunk-CBAQPTDU.js → chunk-PIU6BXXW.js} +2 -2
  72. package/dist/{chunk-EKV4UBCM.js → chunk-PZBQUJ2F.js} +2 -2
  73. package/dist/{chunk-7RET77VB.js → chunk-Q2HKY32Y.js} +2 -2
  74. package/dist/{chunk-U6YTUVOX.js → chunk-Q4RMNWMZ.js} +4 -4
  75. package/dist/chunk-Q6FRR3AQ.js +48 -0
  76. package/dist/{chunk-6RJMYYIE.js → chunk-QJSIAJBY.js} +3 -3
  77. package/dist/{chunk-DOUISWEE.js → chunk-QOJ4ERMU.js} +5 -5
  78. package/dist/{chunk-IFPDAD7R.js → chunk-RWSRKXLT.js} +3 -3
  79. package/dist/{chunk-T33IYTZM.js → chunk-SAASVMIY.js} +3 -3
  80. package/dist/{chunk-2DTIWSAW.js → chunk-SEQDH6JC.js} +3 -3
  81. package/dist/{chunk-BRCOSE7O.js → chunk-SZUO5BSE.js} +2 -2
  82. package/dist/{chunk-HOEDA42N.js → chunk-T7HZ7KJF.js} +2 -2
  83. package/dist/{chunk-OJXOA6YU.js → chunk-TL6LNERH.js} +2 -2
  84. package/dist/{chunk-UCINIRHW.js → chunk-TPCZXWLT.js} +3 -3
  85. package/dist/{chunk-ZUKUCZYZ.js → chunk-TQ2KTH4A.js} +2 -2
  86. package/dist/{chunk-4WOOTKFD.js → chunk-U3FETNQB.js} +341 -20
  87. package/dist/{chunk-5B3RTYAK.js → chunk-UGDSB4AN.js} +2 -2
  88. package/dist/{chunk-VKHLUZNO.js → chunk-UZ7YBL43.js} +3 -3
  89. package/dist/{chunk-QNUQ7K7D.js → chunk-VKMSEO7Y.js} +4 -4
  90. package/dist/{chunk-IN7DGBVS.js → chunk-VLX5VZ35.js} +5 -5
  91. package/dist/{chunk-SJGS3GDI.js → chunk-WAGBMMNX.js} +5 -5
  92. package/dist/{chunk-BFOSV5EZ.js → chunk-WX2YCH7F.js} +2 -2
  93. package/dist/{chunk-3LT34CAM.js → chunk-XBIGUILU.js} +32 -17
  94. package/dist/{chunk-XDHUDE5K.js → chunk-XKYBFRWR.js} +5 -5
  95. package/dist/{chunk-U5QU5ZOD.js → chunk-XYPWFSU5.js} +3 -3
  96. package/dist/{chunk-YBUECLAF.js → chunk-YEJQDODA.js} +2 -2
  97. package/dist/{chunk-YQ6XEFVK.js → chunk-Z74OGONW.js} +39 -7
  98. package/dist/{chunk-I4ELN5BX.js → chunk-ZTNOEJRI.js} +2 -2
  99. package/dist/cli/index.js +26 -26
  100. package/dist/{clio-K2PBVCEM.js → clio-4IKFE25F.js} +2 -2
  101. package/dist/{clio-context-tools-GR4OHFSO.js → clio-context-tools-OHJXYX4R.js} +25 -23
  102. package/dist/{code-nav-4X3OI6DK.js → code-nav-XPM3MY5I.js} +7 -7
  103. package/dist/{config-Q5J7UBAB.js → config-343YS25T.js} +43 -41
  104. package/dist/{config-graph-P3555574.js → config-graph-WI263KDX.js} +43 -41
  105. package/dist/{configure-KIJ32ZO6.js → configure-GZDG4HER.js} +21 -21
  106. package/dist/{context-LFBQOSXT.js → context-4OFO7N7Y.js} +12 -12
  107. package/dist/{context-WBH3KSVR.js → context-JLK2RLOG.js} +42 -40
  108. package/dist/{context-NNLBES2Y.js → context-O6DIWCF6.js} +23 -21
  109. package/dist/{context-clear-YOHMQ6SQ.js → context-clear-MR7KOGQI.js} +42 -40
  110. package/dist/{context-working-set-MRAEVDNV.js → context-working-set-YZAD3KWO.js} +14 -13
  111. package/dist/{data-tool-JJPBGMQJ.js → data-tool-EKD7DFHG.js} +7 -7
  112. package/dist/{detail-RHJOTGN4.js → detail-YZPHFEVJ.js} +43 -41
  113. package/dist/{dispatch-runner-NC7PYNIO.js → dispatch-runner-VKVXVTWJ.js} +44 -42
  114. package/dist/{doctor-S5KZ2GTN.js → doctor-53AVQXAO.js} +17 -16
  115. package/dist/{doctor-deep-2EJQSHIZ.js → doctor-deep-BLRB2NCG.js} +5 -5
  116. package/dist/{eval-3D6M36N7.js → eval-P3BQSLQE.js} +21 -20
  117. package/dist/{evidence-XNVPPLVK.js → evidence-6LLI6SZH.js} +44 -42
  118. package/dist/{evidence-6IYN52ET.js → evidence-HTN3JLUO.js} +42 -40
  119. package/dist/{evidence-JVECPI3F.js → evidence-NJRE3R5H.js} +42 -40
  120. package/dist/{evolve-TLPUDJDM.js → evolve-WWZHJVJP.js} +42 -40
  121. package/dist/{fleet-WKVBF5SZ.js → fleet-GGZ4BVJE.js} +64 -62
  122. package/dist/{fleet-6RJWIOEO.js → fleet-QG3IIWWM.js} +44 -42
  123. package/dist/{fleet-commands-L6WFT7KZ.js → fleet-commands-J2ZIKISQ.js} +7 -7
  124. package/dist/{fleet-decisions-BTQMWU5A.js → fleet-decisions-Y2Q7375Q.js} +8 -8
  125. package/dist/{fleet-graph-553DZ67Q.js → fleet-graph-TCBCCCBP.js} +11 -11
  126. package/dist/{fleet-inspect-236FZPRB.js → fleet-inspect-KOLKBC56.js} +44 -42
  127. package/dist/{fleet-preflight-NZQHABWO.js → fleet-preflight-44UNCC4Y.js} +27 -25
  128. package/dist/{fleet-validate-7NLAE26R.js → fleet-validate-K2FXRZVA.js} +13 -13
  129. package/dist/{fleet-verify-E3RO6A5W.js → fleet-verify-AS444WDW.js} +42 -40
  130. package/dist/{fleet-view-KMZQY7YJ.js → fleet-view-X4JU4J6O.js} +43 -41
  131. package/dist/gui/ops-worker.js +9 -9
  132. package/dist/gui/reads-worker.js +9 -8
  133. package/dist/{init-DV5B6HQG.js → init-VSOWFHVL.js} +54 -52
  134. package/dist/{interactive-OXGYZYAS.js → interactive-JRCBENLZ.js} +1733 -577
  135. package/dist/{interop-J7UOBOSF.js → interop-JR6BCY7R.js} +10 -10
  136. package/dist/{inventory-OEGIL6PY.js → inventory-3JUGLVJI.js} +43 -41
  137. package/dist/{library-ROZAMUIL.js → library-7BOH3Y7N.js} +15 -15
  138. package/dist/{library-B3UPGY4V.js → library-7PFONXUI.js} +9 -9
  139. package/dist/{library-MXQA5DLT.js → library-TUYZMFIA.js} +7 -7
  140. package/dist/{library-import-2LTWOVBD.js → library-import-TJVXKLDK.js} +10 -10
  141. package/dist/{library-inventory-LJ3XHLWO.js → library-inventory-MD3AYTP4.js} +9 -9
  142. package/dist/{library-validation-DARHHUNW.js → library-validation-ZDLITEA3.js} +7 -7
  143. package/dist/{mcp-2GSPYQ54.js → mcp-EFCWUPUR.js} +3 -3
  144. package/dist/{memory-J3STUUIK.js → memory-Q2YVOKK5.js} +42 -40
  145. package/dist/{models-Y3GMFJ2V.js → models-M7BOCW7F.js} +17 -16
  146. package/dist/{monitor-LHNH577J.js → monitor-2HD3MC67.js} +47 -45
  147. package/dist/{orchestrator-DTAPXULA.js → orchestrator-OUW3ZN6Y.js} +1894 -226
  148. package/dist/{panes-A743ONZ5.js → panes-TTPPSYCL.js} +3 -3
  149. package/dist/{preload-OJBMAIXF.js → preload-A47C2NUF.js} +42 -40
  150. package/dist/{providers-CMETPZNS.js → providers-T43W7EL4.js} +4 -4
  151. package/dist/{resources-FY6XYFN2.js → resources-TP6X2V6W.js} +20 -11
  152. package/dist/{run-H64MEVTA.js → run-LDSBPMCS.js} +61 -59
  153. package/dist/{share-CAFMMQLM.js → share-URHKKMHR.js} +9 -9
  154. package/dist/{skills-ERKQUC7L.js → skills-E477MOOO.js} +13 -11
  155. package/dist/{skills-eval-CQ23MYQK.js → skills-eval-AIBR2L7H.js} +583 -93
  156. package/dist/{skills-inventory-TVUYJDVN.js → skills-inventory-HLMKY3R5.js} +13 -11
  157. package/dist/{slash-commands-ROG3KIFJ.js → slash-commands-LIIZKA5Y.js} +28 -26
  158. package/dist/{startup-background-KDWCQMWT.js → startup-background-JR2KDK6R.js} +43 -41
  159. package/dist/{steer-KKYXJSH4.js → steer-D7RTAPCM.js} +3 -3
  160. package/dist/{system-ZDW44ZGX.js → system-X2P5N4IY.js} +14 -13
  161. package/dist/{targets-AJWA6E7Z.js → targets-VFFAKUFM.js} +25 -24
  162. package/dist/{tasks-6L2JJRC5.js → tasks-ERAWZA22.js} +6 -6
  163. package/dist/{terminal-lease-YFUSDPAD.js → terminal-lease-V2N2BIKQ.js} +2 -2
  164. package/dist/{trace-LA5MVR4Y.js → trace-MA5BT7XY.js} +3 -3
  165. package/dist/{usage-XSILDHKF.js → usage-WYFY2L6M.js} +50 -48
  166. package/dist/{verifiers-ECA5GIHL.js → verifiers-TYIW2XKF.js} +7 -7
  167. package/dist/{verify-R6QQCCEB.js → verify-242UFYTP.js} +6 -6
  168. package/dist/{web-fetch-PVZNMBOB.js → web-fetch-LRAGYU6Y.js} +3 -3
  169. package/dist/{wiki-generate-RP22WP5K.js → wiki-generate-OFKOX2T6.js} +53 -51
  170. package/dist/worker/entry.js +31 -29
  171. package/docs/architecture/architecture.md +1 -0
  172. package/docs/architecture/context-engine.md +4 -2
  173. package/docs/architecture/observability.md +6 -4
  174. package/docs/architecture/prompt-envelope-and-tools.md +1 -1
  175. package/docs/architecture/session-lifecycle.md +1 -1
  176. package/docs/architecture/tui-design.md +12 -9
  177. package/docs/gui/parity/02-slash-and-surfaces.md +1 -1
  178. package/docs/guide/commands-and-modes.md +91 -5
  179. package/docs/guide/configuration-and-targets.md +2 -2
  180. package/docs/guide/context-continuity.md +49 -0
  181. package/docs/guide/proactive-memory.md +6 -3
  182. package/library/registry.yaml +292 -32
  183. package/library/skills/README.md +27 -2
  184. package/library/skills/context/context-handoff/SKILL.md +10 -4
  185. package/library/skills/meta/clio-coder-dev/SKILL.md +92 -88
  186. package/library/skills/meta/clio-coder-dev/evals.md +51 -46
  187. package/library/skills/meta/clio-coder-dev/plugin.json +2 -2
  188. package/library/skills/meta/clio-coder-dev/references/change-map.md +49 -0
  189. package/library/skills/meta/clio-coder-test/SKILL.md +89 -142
  190. package/library/skills/meta/clio-coder-test/evals.md +58 -62
  191. package/library/skills/meta/clio-coder-test/plugin.json +2 -2
  192. package/library/skills/meta/clio-coder-test/references/harness.md +3 -3
  193. package/library/skills/meta/clio-coder-test/references/lifecycle-validation.md +30 -0
  194. package/library/skills/meta/clio-coder-test/references/test-map.md +60 -89
  195. package/library/skills/registry.yaml +5 -5
  196. package/library/skills/skill-marketplace.json +12 -14
  197. package/package.json +1 -1
  198. package/src/cli/skills-eval.ts +1064 -54
  199. package/src/cli/usage.ts +2 -2
  200. package/src/core/clio-repo.ts +3 -0
  201. package/src/core/tool-names.ts +1 -0
  202. package/src/domains/context/budget/inspection.ts +9 -0
  203. package/src/domains/context/budget/live-view.ts +418 -0
  204. package/src/domains/context/budget/pressure.ts +393 -0
  205. package/src/domains/context/budget/request-fit.ts +15 -0
  206. package/src/domains/evidence/build.ts +24 -0
  207. package/src/domains/gateway/mcp/client.ts +1 -1
  208. package/src/domains/memory/commit-state.ts +160 -0
  209. package/src/domains/memory/operations.ts +18 -10
  210. package/src/domains/memory/prompt-cache.ts +95 -0
  211. package/src/domains/memory/prompt-section.ts +50 -7
  212. package/src/domains/memory/relevance.ts +93 -0
  213. package/src/domains/memory/restoration.ts +78 -0
  214. package/src/domains/memory/store.ts +39 -1
  215. package/src/domains/middleware/memory-intervention.ts +116 -24
  216. package/src/domains/observability/background-memory-usage.ts +1 -1
  217. package/src/domains/observability/cost.ts +3 -3
  218. package/src/domains/observability/extension.ts +1 -1
  219. package/src/domains/observability/metrics.ts +1 -1
  220. package/src/domains/prompts/compiler.ts +1 -1
  221. package/src/domains/prompts/extension.ts +38 -1
  222. package/src/domains/quota/anthropic-max-provider.ts +134 -0
  223. package/src/domains/quota/anthropic-usage.ts +220 -0
  224. package/src/domains/quota/antigravity-provider.ts +339 -0
  225. package/src/domains/quota/cache.ts +87 -0
  226. package/src/domains/quota/claude-code-provider.ts +169 -0
  227. package/src/domains/quota/codex-provider.ts +237 -0
  228. package/src/domains/quota/presentation.ts +240 -0
  229. package/src/domains/quota/registry.ts +23 -0
  230. package/src/domains/quota/service.ts +93 -0
  231. package/src/domains/quota/summary-feed.ts +86 -0
  232. package/src/domains/quota/types.ts +84 -0
  233. package/src/domains/resources/index.ts +11 -0
  234. package/src/domains/resources/skills/catalog-view.ts +571 -0
  235. package/src/domains/resources/skills/lexical-match.ts +136 -0
  236. package/src/domains/resources/skills/loader.ts +38 -0
  237. package/src/domains/resources/skills/promotion.ts +1 -55
  238. package/src/domains/resources/skills/provenance-pin.ts +50 -20
  239. package/src/domains/safety/action-classifier.ts +1 -0
  240. package/src/domains/session/compaction/branch-summary.ts +4 -1
  241. package/src/domains/session/compaction/compact.ts +18 -2
  242. package/src/domains/session/compaction/cut-point.ts +20 -1
  243. package/src/domains/session/compaction/tokens.ts +48 -3
  244. package/src/domains/session/context-accounting.ts +8 -1
  245. package/src/domains/session/continuity/carry.ts +59 -0
  246. package/src/domains/session/continuity/contract.ts +592 -0
  247. package/src/domains/session/continuity/evidence.ts +290 -0
  248. package/src/domains/session/continuity/fold.ts +1075 -0
  249. package/src/domains/session/continuity/note.ts +79 -0
  250. package/src/domains/session/continuity/operator-request.ts +104 -0
  251. package/src/domains/session/continuity/persistence.ts +408 -0
  252. package/src/domains/session/continuity/ports.ts +231 -0
  253. package/src/domains/session/continuity/projection.ts +538 -0
  254. package/src/domains/session/continuity/validate.ts +352 -0
  255. package/src/domains/session/entries.ts +50 -3
  256. package/src/domains/session/index.ts +48 -0
  257. package/src/domains/session/migrations/index.ts +7 -3
  258. package/src/domains/session/tree/fork.ts +15 -1
  259. package/src/domains/session/usage.ts +2 -2
  260. package/src/engine/acp/commands.ts +1 -1
  261. package/src/engine/agent.ts +133 -9
  262. package/src/engine/session.ts +13 -6
  263. package/src/entry/orchestrator.ts +116 -33
  264. package/src/interactive/chat-loop-messages.ts +2 -2
  265. package/src/interactive/chat-loop.ts +219 -63
  266. package/src/interactive/chat-renderer.ts +99 -8
  267. package/src/interactive/context-overlay.ts +24 -3
  268. package/src/interactive/continuity-controller.ts +526 -0
  269. package/src/interactive/dispatch-board.ts +21 -3
  270. package/src/interactive/footer/dashboard.ts +25 -1
  271. package/src/interactive/footer/key-hints.ts +2 -2
  272. package/src/interactive/footer/pages.ts +70 -27
  273. package/src/interactive/footer/widgets.ts +32 -7
  274. package/src/interactive/footer-panel.ts +1 -1
  275. package/src/interactive/interactive-application.ts +7 -2
  276. package/src/interactive/interactive-input-runtime.ts +2 -2
  277. package/src/interactive/interactive-presentation.ts +15 -0
  278. package/src/interactive/interactive-slash-runtime.ts +45 -8
  279. package/src/interactive/interactive-tickers.ts +7 -1
  280. package/src/interactive/model-session-replay.ts +130 -3
  281. package/src/interactive/output-reserve.ts +35 -0
  282. package/src/interactive/overlay-general-openers.ts +12 -8
  283. package/src/interactive/overlay-key-routing.ts +6 -9
  284. package/src/interactive/overlay-lifecycle.ts +10 -6
  285. package/src/interactive/overlay-session-lifecycle.ts +21 -14
  286. package/src/interactive/quota-view.ts +229 -0
  287. package/src/interactive/session-last-turn.ts +1 -1
  288. package/src/interactive/session-transcript.ts +2 -1
  289. package/src/interactive/session-usage-reseed.ts +2 -2
  290. package/src/interactive/side-question.ts +2 -2
  291. package/src/interactive/slash-commands.ts +28 -9
  292. package/src/interactive/turn-context.ts +686 -63
  293. package/src/interactive/turn-middleware.ts +39 -6
  294. package/src/interactive/turn-persistence.ts +15 -2
  295. package/src/interactive/turn-prewarm.ts +1 -1
  296. package/src/interactive/turn-runtime.ts +48 -5
  297. package/src/interactive/{cost-overlay.ts → usage-overlay.ts} +121 -33
  298. package/src/interactive/welcome-dashboard.ts +26 -3
  299. package/src/tools/agent-tools.ts +3 -1
  300. package/src/tools/bootstrap.ts +6 -0
  301. package/src/tools/builtin-tool-catalog.ts +9 -0
  302. package/src/tools/context/index.ts +148 -113
  303. package/src/tools/context/surface.ts +11 -7
  304. package/src/tools/core-bootstrap.ts +4 -0
  305. package/src/tools/observation.ts +8 -2
  306. package/src/tools/policy.ts +3 -0
  307. package/src/tools/self-compact.ts +31 -0
  308. package/src/tools/surface.ts +1 -0
  309. package/src/tools/tasks.ts +1 -1
  310. package/dist/chunk-CTFPFW3H.js +0 -44
  311. package/dist/chunk-EOJPDNUP.js +0 -1325
  312. package/dist/chunk-I4Y4WKZR.js +0 -386
@@ -6,16 +6,16 @@ import {
6
6
  findCutPoint,
7
7
  getLastAssistantUsage,
8
8
  projectWorkingSet
9
- } from "./chunk-YQ6XEFVK.js";
9
+ } from "./chunk-Z74OGONW.js";
10
10
  import {
11
11
  hasStructuredToolCall,
12
12
  isSelfExplainingAbort,
13
13
  toolResultSummary
14
- } from "./chunk-ZR5YA6ZF.js";
14
+ } from "./chunk-36XVK5P5.js";
15
15
  import {
16
16
  getPromptManifestFilePath,
17
17
  readPromptCompileManifest
18
- } from "./chunk-ZJPORZTC.js";
18
+ } from "./chunk-GIAI7A2K.js";
19
19
  import {
20
20
  GLYPH,
21
21
  MUTATION_PREVIEW_KEY,
@@ -45,20 +45,20 @@ import {
45
45
  isHelperRun,
46
46
  workerReceiptSummary,
47
47
  workerTargetLabel
48
- } from "./chunk-3LT34CAM.js";
48
+ } from "./chunk-XBIGUILU.js";
49
49
  import {
50
50
  readAccountabilitySummary
51
- } from "./chunk-V35KZDUZ.js";
51
+ } from "./chunk-AA3GRZWS.js";
52
52
  import {
53
53
  boundSettledText
54
- } from "./chunk-HOEDA42N.js";
54
+ } from "./chunk-T7HZ7KJF.js";
55
55
  import {
56
56
  recallableRefListing
57
- } from "./chunk-EG4ARXPC.js";
57
+ } from "./chunk-OX6QTA4N.js";
58
58
  import {
59
59
  compactionCut,
60
60
  foldWorkingSet
61
- } from "./chunk-EZD2BXGP.js";
61
+ } from "./chunk-GUFQPTQK.js";
62
62
  import {
63
63
  Markdown,
64
64
  truncateToWidth,
@@ -72,24 +72,26 @@ import {
72
72
  formatCostAggregate,
73
73
  inspectEvidence,
74
74
  listEvidenceOverviews
75
- } from "./chunk-LTWH2ACR.js";
75
+ } from "./chunk-EQPFEDFV.js";
76
76
  import {
77
77
  describeWriteBoundaryAttributionDowngrade
78
- } from "./chunk-DXSETN72.js";
78
+ } from "./chunk-7WUGNN43.js";
79
79
  import {
80
80
  formatTrustSummaryLine,
81
81
  trustStateWord
82
- } from "./chunk-OZ76TLGU.js";
82
+ } from "./chunk-EEITU7S6.js";
83
83
  import {
84
+ continuityReplayBlocks,
84
85
  readAuditRows,
86
+ resolveContinuityProjection,
85
87
  responseModelIdObservationFromRecord
86
- } from "./chunk-EOJPDNUP.js";
88
+ } from "./chunk-GPTR6OTU.js";
87
89
  import {
88
90
  describeLocalCapacity
89
91
  } from "./chunk-E6IPKW2E.js";
90
92
  import {
91
93
  decisionRationale
92
- } from "./chunk-U5QU5ZOD.js";
94
+ } from "./chunk-XYPWFSU5.js";
93
95
  import {
94
96
  filterEntriesToActivePath
95
97
  } from "./chunk-O5F25NIE.js";
@@ -100,7 +102,7 @@ import {
100
102
  retiredReceiptIntegrity,
101
103
  retiredReceiptIntegrityReason,
102
104
  verifyReceiptIntegrity
103
- } from "./chunk-VKHLUZNO.js";
105
+ } from "./chunk-UZ7YBL43.js";
104
106
  import {
105
107
  applyEditsToNormalizedContent,
106
108
  askAxis,
@@ -117,17 +119,17 @@ import {
117
119
  runKindSupportsLiveSteering,
118
120
  stripBom,
119
121
  toolPresentationPolicy
120
- } from "./chunk-OQ2EOAHA.js";
122
+ } from "./chunk-PF36KOGI.js";
121
123
  import {
122
124
  taskBoardCounts
123
- } from "./chunk-NDPF2N2L.js";
125
+ } from "./chunk-7DW7CJW2.js";
124
126
  import {
125
127
  sanitizeCallTargetText,
126
128
  sanitizeMultilineDisplayText
127
129
  } from "./chunk-XNIZBOFV.js";
128
130
  import {
129
131
  effectiveToolCall
130
- } from "./chunk-DE2LU267.js";
132
+ } from "./chunk-KKAJGT3B.js";
131
133
  import {
132
134
  redactSecretString,
133
135
  redactToolArgs
@@ -135,7 +137,7 @@ import {
135
137
  import {
136
138
  toolResultPresentationPolicy,
137
139
  toolResultPresentationText
138
- } from "./chunk-OPD7GL6F.js";
140
+ } from "./chunk-H6FQVNZC.js";
139
141
  import {
140
142
  formatSize
141
143
  } from "./chunk-KECNXMDE.js";
@@ -146,7 +148,7 @@ import {
146
148
  estimateAgentContextTokens,
147
149
  estimateReasoningTextTokens,
148
150
  extractReasoningTokens
149
- } from "./chunk-6W75D37F.js";
151
+ } from "./chunk-53P775GE.js";
150
152
  import {
151
153
  streamSimple
152
154
  } from "./chunk-L7G7K4I2.js";
@@ -154,7 +156,7 @@ import {
154
156
  latestSkillContextState,
155
157
  skillContextContentHash,
156
158
  verifiedSkillContextCheckpoint
157
- } from "./chunk-I4Y4WKZR.js";
159
+ } from "./chunk-F6KCJO3U.js";
158
160
  import {
159
161
  redactSecretsText
160
162
  } from "./chunk-O3VV6IVK.js";
@@ -163,7 +165,7 @@ import {
163
165
  } from "./chunk-C2CPOIH2.js";
164
166
  import {
165
167
  ToolNames
166
- } from "./chunk-V4XJWDHR.js";
168
+ } from "./chunk-6UKFRTXI.js";
167
169
  import {
168
170
  clioStateDir,
169
171
  stateRootRemoved
@@ -800,6 +802,7 @@ async function runSummaryStream(input, userText, systemPrompt, maxTokens) {
800
802
  );
801
803
  }
802
804
  input.signal?.throwIfAborted();
805
+ input.beforeSummaryCall?.();
803
806
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
804
807
  const started = performance.now();
805
808
  let usage;
@@ -889,7 +892,7 @@ async function compact(input) {
889
892
  const usageStart = prevCompactionIndex >= 0 ? prevCompactionIndex : 0;
890
893
  const usageEntries = entries.slice(usageStart);
891
894
  const lastUsage = getLastAssistantUsage(usageEntries);
892
- const tokensBefore = calculateContextTokens(usageEntries, lastUsage);
895
+ const tokensBefore = calculateContextTokens(usageEntries, lastUsage, input.continuityNote);
893
896
  const rawCut = findCutPoint(entries, keepRecentTokens, { startIndex: boundaryStart });
894
897
  const cut = protectedStart !== null && rawCut.firstKeptEntryIndex > protectedStart ? { firstKeptEntryIndex: protectedStart, turnStartIndex: -1, isSplitTurn: false } : rawCut;
895
898
  const historyEnd = cut.isSplitTurn ? cut.turnStartIndex : cut.firstKeptEntryIndex;
@@ -1730,15 +1733,15 @@ function boundedContent(content) {
1730
1733
  };
1731
1734
  }
1732
1735
  function previewFrom(facts, heading, text, options = {}) {
1733
- const clean = sanitizeMultilineDisplayText(text);
1734
- const body = options.numbered ? numberedLines(clean.text) : clean.text.split("\n");
1736
+ const clean2 = sanitizeMultilineDisplayText(text);
1737
+ const body = options.numbered ? numberedLines(clean2.text) : clean2.text.split("\n");
1735
1738
  if (options.trailer !== void 0) body.push(options.trailer);
1736
1739
  return {
1737
1740
  facts,
1738
1741
  heading,
1739
1742
  body,
1740
- neutralized: clean.neutralized,
1741
- tabsExpanded: clean.tabsExpanded
1743
+ neutralized: clean2.neutralized,
1744
+ tabsExpanded: clean2.tabsExpanded
1742
1745
  };
1743
1746
  }
1744
1747
  function refusal(facts, heading, reason) {
@@ -3805,6 +3808,257 @@ function buildSegmentedContextBar(theme5, barWidth, contextWindow, breakdown) {
3805
3808
  return `${systemPart}${toolPart}${conversationPart}${freePart}${contextPercentLabel(percent)}`;
3806
3809
  }
3807
3810
 
3811
+ // src/interactive/quota-view.ts
3812
+ init_esm_shims();
3813
+
3814
+ // src/domains/quota/presentation.ts
3815
+ init_esm_shims();
3816
+ var SEVERITY_WORDS = /* @__PURE__ */ new Set(["normal", "caution", "warning", "critical"]);
3817
+ function severityForPct(usedPct) {
3818
+ if (usedPct >= 95) return "critical";
3819
+ if (usedPct >= 80) return "warning";
3820
+ if (usedPct >= 60) return "caution";
3821
+ return "normal";
3822
+ }
3823
+ function windowSeverity(window) {
3824
+ const reported = window.severity?.toLowerCase();
3825
+ if (reported !== void 0 && SEVERITY_WORDS.has(reported)) {
3826
+ return reported;
3827
+ }
3828
+ return severityForPct(window.usedPct);
3829
+ }
3830
+ function formatPct(usedPct) {
3831
+ return `${Math.round(usedPct)}%`;
3832
+ }
3833
+ function primaryWindow(snapshot) {
3834
+ let best = null;
3835
+ for (const window of snapshot.windows) {
3836
+ const rank = { normal: 0, caution: 1, warning: 2, critical: 3 };
3837
+ if (best === null || rank[windowSeverity(window)] > rank[windowSeverity(best)] || rank[windowSeverity(window)] === rank[windowSeverity(best)] && window.usedPct > best.usedPct)
3838
+ best = window;
3839
+ }
3840
+ return best;
3841
+ }
3842
+ function windowByKey(snapshot, key) {
3843
+ return snapshot.windows.find((window) => window.key === key) ?? null;
3844
+ }
3845
+ function foldDuplicateAccounts(snapshots) {
3846
+ const kept = [];
3847
+ for (const snapshot of snapshots) {
3848
+ const twin = kept.findIndex((existing2) => sameAccount(existing2, snapshot));
3849
+ if (twin < 0) {
3850
+ kept.push(snapshot);
3851
+ continue;
3852
+ }
3853
+ const existing = kept[twin];
3854
+ if (existing !== void 0 && existing.plan == null && snapshot.plan != null) kept[twin] = snapshot;
3855
+ }
3856
+ return kept;
3857
+ }
3858
+ function sameAccount(left, right) {
3859
+ if (left.status !== "ok" || right.status !== "ok") return false;
3860
+ const anthropic = /* @__PURE__ */ new Set(["anthropic-max", "claude-code"]);
3861
+ if (left.providerId === right.providerId || !anthropic.has(left.providerId) || !anthropic.has(right.providerId))
3862
+ return false;
3863
+ if (left.windows.length === 0 || left.windows.length !== right.windows.length) return false;
3864
+ return left.windows.every((window, index) => {
3865
+ const other = right.windows[index];
3866
+ return other !== void 0 && other.key === window.key && other.scope === window.scope && (other.resetsAt === window.resetsAt || other.resetsAt !== null && window.resetsAt !== null && Math.abs(Date.parse(other.resetsAt) - Date.parse(window.resetsAt)) < 1e3) && Math.abs(other.usedPct - window.usedPct) < 0.5;
3867
+ });
3868
+ }
3869
+ function footerQuotaSegment(snapshots) {
3870
+ const parts = [];
3871
+ for (const snapshot of foldDuplicateAccounts(snapshots)) {
3872
+ if (snapshot.status !== "ok") continue;
3873
+ const weekly = windowByKey(snapshot, "weekly");
3874
+ const session = windowByKey(snapshot, "session");
3875
+ const shown = [];
3876
+ if (session) shown.push(`5h ${formatPct(session.usedPct)} used`);
3877
+ if (weekly) shown.push(`wk ${formatPct(weekly.usedPct)} used`);
3878
+ const binding = primaryWindow(snapshot);
3879
+ if (shown.length > 0 && binding?.scope && binding !== session && binding !== weekly) {
3880
+ shown.push(
3881
+ `${binding.scope}${binding.label === binding.scope ? "" : ` ${binding.label}`} ${formatPct(binding.usedPct)} used`
3882
+ );
3883
+ }
3884
+ if (shown.length === 0) {
3885
+ const fallback = primaryWindow(snapshot);
3886
+ if (fallback) shown.push(`${fallback.short ?? fallback.label} ${formatPct(fallback.usedPct)} used`);
3887
+ }
3888
+ if (shown.length > 0) parts.push(`${shortName(snapshot.displayName)} ${shown.join("/")}`);
3889
+ }
3890
+ return parts.length > 0 ? parts.join(" \xB7 ") : null;
3891
+ }
3892
+ function shortName(displayName) {
3893
+ const first = displayName.split(" ")[0] ?? displayName;
3894
+ return first;
3895
+ }
3896
+ function quotaSummaryLine(snapshots) {
3897
+ const paid = footerQuotaSegment(snapshots);
3898
+ const local = snapshots.find((snapshot) => snapshot.providerId === "local");
3899
+ const localPart = local?.credits ? `Local ${local.credits.display}` : null;
3900
+ const parts = [paid, localPart].filter((part) => part !== null);
3901
+ return parts.length > 0 ? parts.join(" \xB7 ") : null;
3902
+ }
3903
+ function localQuotaSnapshot(options = {}) {
3904
+ return {
3905
+ providerId: "local",
3906
+ displayName: options.runtimeLabel ?? "Local AI",
3907
+ status: "ok",
3908
+ windows: [],
3909
+ credits: { display: "$0.00", usedPct: null },
3910
+ plan: "Local",
3911
+ message: "no subscription window consumed",
3912
+ fetchedAt: options.fetchedAt ?? null
3913
+ };
3914
+ }
3915
+
3916
+ // src/interactive/quota-view.ts
3917
+ var clean = (text) => sanitizeCallTargetText(redactSecretString(text));
3918
+ var tone = (severity) => severity === "critical" ? "error" : severity === "normal" ? "accent" : "warning";
3919
+ function quotaMeter(usedPct, cells, severity = severityForPct(usedPct)) {
3920
+ const count = Math.max(1, Math.floor(cells));
3921
+ const used = Math.max(0, Math.min(100, Number.isFinite(usedPct) ? usedPct : 0));
3922
+ const filled = Math.round(used / 100 * count);
3923
+ const theme5 = clioTheme();
3924
+ return theme5.fg(tone(severity), "\u2501".repeat(filled)) + theme5.fg("frame", "\u2500".repeat(count - filled));
3925
+ }
3926
+ function quotaResetLabel(reset, now = Date.now(), timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone) {
3927
+ const timestamp = reset === null ? NaN : Date.parse(reset);
3928
+ if (!Number.isFinite(timestamp)) return "Reset time not reported";
3929
+ const absolute = new Intl.DateTimeFormat("en-US", {
3930
+ month: "short",
3931
+ day: "numeric",
3932
+ hour: "numeric",
3933
+ minute: "2-digit",
3934
+ timeZone
3935
+ }).format(timestamp);
3936
+ const minutes = Math.max(0, Math.ceil((timestamp - now) / 6e4));
3937
+ const duration = minutes >= 1440 ? `${Math.floor(minutes / 1440)}d ${Math.floor(minutes % 1440 / 60)}h` : minutes >= 60 ? `${Math.floor(minutes / 60)}h ${minutes % 60}m` : `${minutes}m`;
3938
+ return minutes === 0 ? `Reset time passed \xB7 awaiting provider update (${absolute} \xB7 ${timeZone})` : `Resets in ${duration} \xB7 ${absolute} (${timeZone})`;
3939
+ }
3940
+ function renderQuotaAccounts(snapshots, width, options = {}) {
3941
+ const theme5 = clioTheme();
3942
+ const now = options.now ?? Date.now();
3943
+ const accounts = foldDuplicateAccounts(snapshots).filter((account) => account.status !== "no_credentials");
3944
+ if (!accounts.length) return [theme5.fg("dim", "Subscriptions \xB7 loading")];
3945
+ const out = [];
3946
+ for (const account of accounts) {
3947
+ const title = clean(`${account.displayName}${account.plan ? ` (${account.plan})` : ""}`);
3948
+ const age = account.fetchedAt === null ? null : Math.max(0, Math.floor((now - Date.parse(account.fetchedAt)) / 6e4));
3949
+ const freshness = account.stale ? "STALE \xB7 last good reading" : age === null || !Number.isFinite(age) ? "" : age === 0 ? "updated just now" : `updated ${age}m ago`;
3950
+ if (options.compact) {
3951
+ const window = primaryWindow(account);
3952
+ const ordered = window && ["warning", "critical"].includes(windowSeverity(window)) ? [window, ...account.windows.filter((item) => item !== window)] : account.windows;
3953
+ const windows = ordered.map(
3954
+ (item) => `${item.scope && item.scope !== item.label ? `${item.scope} ` : ""}${item.label} ${formatPct(item.usedPct)} used`
3955
+ ).join(" \xB7 ");
3956
+ const detail = account.status !== "ok" ? account.message ?? account.status : account.providerId === "local" ? "$0.00 \xB7 no subscription window consumed" : windows || account.credits?.display || "no windows reported";
3957
+ const meter = window && width >= 65 ? `${quotaMeter(window.usedPct, 8, windowSeverity(window))} ` : "";
3958
+ out.push(
3959
+ truncateToWidth(
3960
+ `${meter}${theme5.fg(account.status !== "ok" || account.stale ? "warning" : "muted", `${account.stale ? "STALE \xB7 " : ""}${title}`)} ${clean(detail)}`,
3961
+ width,
3962
+ "\u2026",
3963
+ true
3964
+ )
3965
+ );
3966
+ continue;
3967
+ }
3968
+ if (out.length) out.push("");
3969
+ out.push(theme5.style("accent", title, { bold: true }));
3970
+ if (freshness) out.push(theme5.fg(account.stale ? "warning" : "dim", freshness));
3971
+ if (account.status !== "ok")
3972
+ out.push(theme5.fg("warning", clean(`${account.status} \xB7 ${account.message ?? "usage unavailable"}`)));
3973
+ let scope;
3974
+ for (const window of account.windows) {
3975
+ if (window.scope && scope !== window.scope) {
3976
+ scope = window.scope;
3977
+ out.push(theme5.style("muted", clean(scope), { bold: true }));
3978
+ }
3979
+ const label = `${window.key.startsWith("weekly_scoped.") ? "Weekly" : window.label} \xB7 ${formatPct(window.usedPct)} used \xB7 ${formatPct(Math.max(0, 100 - window.usedPct))} remaining${window.active ? " \xB7 active limit" : ""}`;
3980
+ out.push(clean(label));
3981
+ out.push(quotaMeter(window.usedPct, Math.max(1, Math.min(48, width)), windowSeverity(window)));
3982
+ out.push(theme5.fg("dim", quotaResetLabel(window.resetsAt, now, options.timeZone)));
3983
+ }
3984
+ if (account.credits) {
3985
+ out.push(
3986
+ clean(
3987
+ `${account.providerId === "local" ? "Local inference" : "Usage credits"} \xB7 ${account.credits.display}${account.credits.usedPct === null ? "" : ` \xB7 ${formatPct(account.credits.usedPct)} used`}`
3988
+ )
3989
+ );
3990
+ if (account.credits.usedPct !== null) out.push(quotaMeter(account.credits.usedPct, Math.min(48, width)));
3991
+ }
3992
+ if (account.status === "ok" && account.message)
3993
+ out.push(theme5.fg(account.stale ? "warning" : "dim", clean(account.message)));
3994
+ if (account.status === "ok" && !account.windows.length && !account.credits && !account.message)
3995
+ out.push(theme5.fg("dim", "Connected \xB7 no usage windows reported"));
3996
+ if (account.retryAfterSeconds != null) out.push(theme5.fg("warning", `Retry after ${account.retryAfterSeconds}s`));
3997
+ }
3998
+ return out.flatMap((line) => visibleWidth(line) > width ? wrapTextWithAnsi(line, Math.max(1, width)) : [line]);
3999
+ }
4000
+ function routeAccount(route, snapshots) {
4001
+ if (route.node && route.node !== "local") return void 0;
4002
+ const provider = {
4003
+ "claude-code": "claude-code",
4004
+ "claude-sdk": "claude-code",
4005
+ "anthropic-max": "anthropic-max",
4006
+ "antigravity-code": "antigravity"
4007
+ }[route.runtimeId];
4008
+ return snapshots.find((item) => item.providerId === provider);
4009
+ }
4010
+ function routeWeeklyQuota(route, snapshots) {
4011
+ const account = routeAccount(route, snapshots);
4012
+ if (account?.status !== "ok") return null;
4013
+ const weekly = account.windows.filter((window2) => window2.key === "weekly" || window2.key.endsWith(".weekly"));
4014
+ const model = route.wireModelId.toLowerCase();
4015
+ const matches = account.providerId === "antigravity" ? weekly.filter((window2) => {
4016
+ const scope = window2.scope?.toLowerCase() ?? "";
4017
+ if (model.includes("gemini")) return scope.includes("gemini");
4018
+ if (/claude|opus|sonnet|haiku/.test(model)) return scope.includes("claude");
4019
+ if (model.includes("gpt")) return scope.includes("gpt");
4020
+ return false;
4021
+ }) : weekly.filter((window2) => !window2.scope);
4022
+ if (matches.length !== 1) return null;
4023
+ const window = matches[0];
4024
+ if (!window) return null;
4025
+ return {
4026
+ label: `${account.stale ? "STALE \xB7 " : ""}weekly ${formatPct(Math.max(0, Math.min(100, 100 - window.usedPct)))} left`,
4027
+ account: account.displayName,
4028
+ severity: windowSeverity(window)
4029
+ };
4030
+ }
4031
+ function workerQuotaLabel(row, snapshots) {
4032
+ if (row.node && row.node !== "local") return "Account quota unavailable for remote credentials";
4033
+ const account = routeAccount(row, snapshots);
4034
+ if (!account) return "Account quota not linked to this runtime";
4035
+ if (account.status !== "ok") return `${account.displayName} \xB7 ${account.message ?? account.status}`;
4036
+ return `Shared ${account.displayName}${account.stale ? " \xB7 STALE" : ""} \xB7 ${account.windows.map((window) => `${window.scope && window.scope !== window.label ? `${window.scope} ` : ""}${window.label} ${formatPct(Math.max(0, 100 - window.usedPct))} left`).join(" \xB7 ") || "no windows reported"}`;
4037
+ }
4038
+ function renderWorkerUsage(rows, snapshots, width) {
4039
+ const theme5 = clioTheme();
4040
+ const out = [theme5.fg("dim", "Active and recent workers \xB7 recorded tokens and cost \xB7 account limits are shared.")];
4041
+ if (!rows.length) out.push("", "No worker invocations recorded.");
4042
+ for (const row of rows) {
4043
+ const cost = formatCostAggregate(costAggregateForAmount(row.costUsd, row.costProvenance)) ?? "cost not reported";
4044
+ out.push(
4045
+ "",
4046
+ theme5.style("agent", clean(`${row.agentId} \xB7 ${row.status} \xB7 ${formatCompactMs(row.elapsedMs)}`), { bold: true })
4047
+ );
4048
+ out.push(clean(`${row.targetId} / ${row.wireModelId}${row.node ? ` \xB7 ${row.node}` : ""}`));
4049
+ out.push(
4050
+ row.tokenCount > 0 || row.inputTokens > 0 || row.outputTokens > 0 || row.progress?.inputTokens !== void 0 ? `${formatFooterTokens(row.tokenCount)} recorded tokens \xB7 input ${formatFooterTokens(row.inputTokens)} \xB7 output ${formatFooterTokens(row.outputTokens)} \xB7 ${cost}` : `Token usage not reported \xB7 ${cost}`
4051
+ );
4052
+ if (row.lastContextTokens !== void 0)
4053
+ out.push(
4054
+ `Context ${formatFooterTokens(row.lastContextTokens)}${row.contextWindow ? ` / ${formatFooterTokens(row.contextWindow)}` : ""}`
4055
+ );
4056
+ out.push(theme5.fg("muted", clean(workerQuotaLabel(row, snapshots))));
4057
+ out.push(theme5.fg("dim", clean(`/view dispatch:${row.runId}`)));
4058
+ }
4059
+ return out.flatMap((line) => wrapTextWithAnsi(line, Math.max(1, width)));
4060
+ }
4061
+
3808
4062
  // src/interactive/renderers/worker-answer.ts
3809
4063
  init_esm_shims();
3810
4064
  function safeWorkerAnswerText(text) {
@@ -4332,8 +4586,9 @@ function renderDispatchCard(row, width, evidence, options = {}) {
4332
4586
  if (detail !== null) bodyLines.push(...cardWrappedValueLines(theme5, "detail", theme5.fg("dim", detail), contentWidth));
4333
4587
  return frame(theme5, cardTitle, bodyLines, width, { rightMeta: elapsed });
4334
4588
  }
4335
- function renderTaskIslandRow(row, width) {
4589
+ function renderTaskIslandRow(row, width, quota) {
4336
4590
  const theme5 = clioTheme();
4591
+ const weekly = routeWeeklyQuota(row, quota);
4337
4592
  const agentLabel = agentDisplayLabel(row);
4338
4593
  const elapsed = formatCompactMs(row.elapsedMs);
4339
4594
  const cost = formatCostAggregate(costAggregateForAmount(row.costUsd, row.costProvenance)) ?? COST_NOT_MEASURED;
@@ -4377,6 +4632,15 @@ function renderTaskIslandRow(row, width) {
4377
4632
  ...quality.map((line) => padAnsi(theme5.fg("muted", line), width)),
4378
4633
  ...task.map((line) => padAnsi(line, width)),
4379
4634
  padAnsi(telemetry, width),
4635
+ ...weekly ? [
4636
+ padAnsi(
4637
+ theme5.fg(
4638
+ weekly.severity === "critical" ? "error" : weekly.severity === "normal" ? "dim" : "warning",
4639
+ ` Shared account \xB7 ${weekly.label}`
4640
+ ),
4641
+ width
4642
+ )
4643
+ ] : [],
4380
4644
  ...wrapTextWithAnsi(theme5.fg("dim", ` /view dispatch:${row.runId}`), width)
4381
4645
  ];
4382
4646
  }
@@ -4548,7 +4812,7 @@ function createDispatchBoardView(rows, observability) {
4548
4812
  }
4549
4813
  };
4550
4814
  }
4551
- function formatTaskIslandLines(rows, maxRows = 4) {
4815
+ function formatTaskIslandLines(rows, maxRows = 4, quota = []) {
4552
4816
  const items = dispatchBoardItems(rows.filter((row) => !isHelperRun(row)));
4553
4817
  const visibleItems = items.slice(0, Math.max(1, maxRows));
4554
4818
  const body = [];
@@ -4564,7 +4828,7 @@ function formatTaskIslandLines(rows, maxRows = 4) {
4564
4828
  body.push(innerDivider(clioTheme(), TASK_ISLAND_WIDTH));
4565
4829
  }
4566
4830
  body.push(
4567
- ...item.kind === "council" ? councilIslandLines(clioTheme(), item.group, TASK_ISLAND_WIDTH) : renderTaskIslandRow(item.row, TASK_ISLAND_WIDTH)
4831
+ ...item.kind === "council" ? councilIslandLines(clioTheme(), item.group, TASK_ISLAND_WIDTH) : renderTaskIslandRow(item.row, TASK_ISLAND_WIDTH, quota)
4568
4832
  );
4569
4833
  }
4570
4834
  const hidden = items.length - visibleItems.length;
@@ -5645,9 +5909,24 @@ function contextComposition(context) {
5645
5909
  system: finiteNonNegative2(breakdown?.systemPromptTokens),
5646
5910
  tools: finiteNonNegative2(breakdown?.toolSchemaTokens),
5647
5911
  chat: finiteNonNegative2(breakdown?.messageTokens) + finiteNonNegative2(breakdown?.pendingUserTokens),
5648
- free: window > 0 ? Math.max(0, window - used) : null
5912
+ free: window > 0 && typeof context.used === "number" && Number.isFinite(context.used) ? Math.max(0, window - used) : null
5649
5913
  };
5650
5914
  }
5915
+ function contextUsageText(context) {
5916
+ const used = context.budget ? context.used : context.ledger?.usedTokens ?? context.used;
5917
+ const window = context.budget ? context.contextWindow : context.ledger?.contextWindow ?? context.contextWindow;
5918
+ const source = context.budget?.inputSource === "historical" ? "saved " : context.budget && used !== null ? "~" : "";
5919
+ return `${source}${used === null ? "?" : formatFooterTokens(used)} / ${window ? formatFooterTokens(window) : "?"}`;
5920
+ }
5921
+ function contextOccupancyBar(context, cells, theme5) {
5922
+ if (!context.budget && context.ledger) return renderContextMeterBar(context.ledger, cells, theme5);
5923
+ return buildSegmentedContextBar(
5924
+ theme5,
5925
+ cells,
5926
+ context.contextWindow ?? 0,
5927
+ context.used === null ? void 0 : contextBreakdownForBar(context)
5928
+ );
5929
+ }
5651
5930
  function renderDashboardRow(theme5, row, keyWidth) {
5652
5931
  if (!row.value) return null;
5653
5932
  if (row.kind !== "kv") return row.value;
@@ -5835,7 +6114,7 @@ function ledgerBar(theme5, ledger, cells) {
5835
6114
  function contextQuadrant(facts, options = {}) {
5836
6115
  const theme5 = clioTheme();
5837
6116
  const ledger = facts.ledger ?? null;
5838
- const hasLedger = ledger !== null && ledger.contextWindow > 0;
6117
+ const hasLedger = !facts.budget && ledger !== null && ledger.contextWindow > 0;
5839
6118
  const barCells = expandedContextBarCells(options.width);
5840
6119
  let bar;
5841
6120
  let fill;
@@ -5856,7 +6135,7 @@ function contextQuadrant(facts, options = {}) {
5856
6135
  composition.chat > 0 ? theme5.fg("accent", formatFooterTokens(composition.chat)) : null,
5857
6136
  composition.free !== null ? theme5.style("frame", `free ${formatFooterTokens(composition.free)}`, { dim: true }) : null
5858
6137
  ]);
5859
- bar = buildSegmentedContextBar(theme5, barCells, facts.contextWindow ?? 0, contextBreakdownForBar(facts));
6138
+ bar = contextOccupancyBar(facts, barCells, theme5);
5860
6139
  const filledChar = visibleWidth(GLYPH.contextFull) === 1 ? GLYPH.contextFull : GLYPH.barFull;
5861
6140
  const freeChar = visibleWidth(GLYPH.contextFree) === 1 ? GLYPH.contextFree : GLYPH.barEmpty;
5862
6141
  legendRows = [
@@ -5870,7 +6149,7 @@ function contextQuadrant(facts, options = {}) {
5870
6149
  "Context",
5871
6150
  [
5872
6151
  statusRow(bar),
5873
- kv("used", formatUsedWindow(usedTokens, windowTokens)),
6152
+ kv("used", facts.budget ? contextUsageText(facts) : formatUsedWindow(usedTokens, windowTokens)),
5874
6153
  fill ? styledKv("fill", fill) : statusRow(null),
5875
6154
  chatFree ? styledKv("budget", chatFree) : statusRow(null),
5876
6155
  kv("compact", formatCompaction(facts)),
@@ -7927,6 +8206,10 @@ function createCoalescingChatRenderer(deps) {
7927
8206
  };
7928
8207
  return renderer;
7929
8208
  }
8209
+ function activeEntriesBeforeCompactionCut(turns, options = {}, truncateAtSelection = true) {
8210
+ const active = filterEntriesToActivePath(turns, options.activeLeafTurnId ?? options.uptoTurnId);
8211
+ return truncateAtSelection ? truncateAtTurn(active, options.uptoTurnId) : active;
8212
+ }
7930
8213
  function extractTurnText(payload) {
7931
8214
  if (typeof payload === "string") return payload;
7932
8215
  if (!payload || typeof payload !== "object") return "";
@@ -8436,15 +8719,15 @@ function skillActivationContextText(entry) {
8436
8719
  function buildReplayAgentMessagesFromTurns(turns, options = {}) {
8437
8720
  const out = createOrderedReplaySink();
8438
8721
  const seenToolCalls = /* @__PURE__ */ new Set();
8439
- const activeEntries = truncateAtTurn(
8440
- filterEntriesToActivePath(turns, options.activeLeafTurnId ?? options.uptoTurnId),
8441
- options.uptoTurnId
8442
- );
8722
+ const activeEntries = activeEntriesBeforeCompactionCut(turns, options);
8443
8723
  const skillState = latestSkillContextState(activeEntries);
8444
- const evidence = truncateAtTurn(
8445
- filterEntriesToActivePath(options.skillContextEntries ?? turns, options.activeLeafTurnId ?? options.uptoTurnId),
8446
- options.uptoTurnId
8447
- );
8724
+ let continuityEmitted = false;
8725
+ const emitContinuity = (timestamp) => {
8726
+ if (continuityEmitted) return;
8727
+ continuityEmitted = true;
8728
+ for (const block of options.continuityBlocks ?? []) out.push(makeTextMessage("user", block, timestamp));
8729
+ };
8730
+ const evidence = activeEntriesBeforeCompactionCut(options.skillContextEntries ?? turns, options);
8448
8731
  const verified = captureSkillContext(evidence, skillState);
8449
8732
  for (const entry of selectReplayEntries(turns, options)) {
8450
8733
  switch (entry.kind) {
@@ -8505,6 +8788,7 @@ ${skill.requestText}`, entry.timestamp));
8505
8788
  for (const block of skill.content) out.push(makeTextMessage("user", block.text, entry.timestamp));
8506
8789
  }
8507
8790
  }
8791
+ emitContinuity(entry.timestamp);
8508
8792
  break;
8509
8793
  case "skillActivation":
8510
8794
  if (entry.activation.runId !== void 0 || skillState && !skillState.activationRefs.includes(entry.turnId))
@@ -8537,9 +8821,17 @@ ${skill.requestText}`, entry.timestamp));
8537
8821
  // entries themselves never become messages.
8538
8822
  case "contextEviction":
8539
8823
  case "contextRecall":
8824
+ // Continuity records are bookkeeping. The chain and the commit payload
8825
+ // never become model messages; the one thing that reaches the model is
8826
+ // the accepted note, projected once through `continuityBlocks`. Handling
8827
+ // each commit here instead would emit a copy per record and would still
8828
+ // miss a commit that sits before the cut.
8829
+ case "handoffTransaction":
8830
+ case "continuityCommit":
8540
8831
  break;
8541
8832
  }
8542
8833
  }
8834
+ emitContinuity(activeEntries[activeEntries.length - 1]?.timestamp ?? (/* @__PURE__ */ new Date(0)).toISOString());
8543
8835
  out.flush();
8544
8836
  return out.messages;
8545
8837
  }
@@ -8699,6 +8991,21 @@ function rehydrateChatPanelFromTurns(chatPanel, turns, options = {}) {
8699
8991
  chatPanel.applyWorkerState(state);
8700
8992
  break;
8701
8993
  }
8994
+ // One bounded provenance line each. The transcript says a handoff
8995
+ // happened and where it stands; the note itself is rendered once,
8996
+ // below, under its own label, rather than once per record.
8997
+ case "handoffTransaction":
8998
+ appendReplayLine(
8999
+ chatPanel,
9000
+ `[continuity] ${entry.event.phase} handoff=${entry.identity.handoffId} seq=${entry.transition.sequence} attempt=${entry.transition.attempt}`
9001
+ );
9002
+ break;
9003
+ case "continuityCommit":
9004
+ appendReplayLine(
9005
+ chatPanel,
9006
+ `[continuity] commit handoff=${entry.continuity.identity.handoffId} outcome=${entry.continuity.commit.outcome} tokens=${entry.continuity.commit.tokensBefore}->${entry.continuity.commit.tokensAfter}`
9007
+ );
9008
+ break;
8702
9009
  case "label":
8703
9010
  case "taskLedger":
8704
9011
  case "decisionLedger":
@@ -8707,6 +9014,9 @@ function rehydrateChatPanelFromTurns(chatPanel, turns, options = {}) {
8707
9014
  break;
8708
9015
  }
8709
9016
  }
9017
+ for (const block of options.continuityBlocks ?? []) {
9018
+ for (const line of block.split("\n")) appendReplayLine(chatPanel, line);
9019
+ }
8710
9020
  for (const pendingId of pendingToolIds) {
8711
9021
  chatPanel.applyEvent({
8712
9022
  type: "tool_execution_end",
@@ -8719,10 +9029,44 @@ function rehydrateChatPanelFromTurns(chatPanel, turns, options = {}) {
8719
9029
  }
8720
9030
 
8721
9031
  // src/interactive/model-session-replay.ts
9032
+ function continuityContextFromSession(session) {
9033
+ const meta = session?.current();
9034
+ if (!meta) return {};
9035
+ const parentSessionId = meta.parentSessionId ?? null;
9036
+ const parentTurnId = meta.parentTurnId ?? null;
9037
+ return {
9038
+ sessionId: meta.id,
9039
+ ...parentSessionId !== null && parentTurnId !== null ? { fork: { parentSessionId, parentTurnId } } : {}
9040
+ };
9041
+ }
9042
+ function resolveReplayContinuity(entries, options = {}) {
9043
+ const context = options.continuity ?? {};
9044
+ return resolveContinuityProjection({
9045
+ // The positional cut applies only to a real historical selection. A live
9046
+ // /tree switch passes `uptoTurnId` for display and must still see the
9047
+ // sidecars anchored after the selected message, because they are part of
9048
+ // its own branch's current state.
9049
+ entries: activeEntriesBeforeCompactionCut(entries, options, context.historical === true),
9050
+ ...context.sessionId === void 0 ? {} : { sessionId: context.sessionId },
9051
+ ...context.fork === void 0 ? {} : { fork: context.fork },
9052
+ ...context.historical === void 0 ? {} : { historical: context.historical },
9053
+ ...context.unreadableRecords === void 0 ? {} : { unreadableRecords: context.unreadableRecords },
9054
+ ...context.nowMs === void 0 ? {} : { nowMs: context.nowMs }
9055
+ });
9056
+ }
9057
+ function withContinuityReplay(turns, options, session) {
9058
+ const merged = { ...options, continuity: continuityContextFromSession(session) };
9059
+ return { ...merged, continuityBlocks: continuityReplayBlocks(resolveReplayContinuity(turns, merged)) };
9060
+ }
8722
9061
  function buildModelReplayAgentMessagesFromTurns(entries, options = {}) {
8723
9062
  const activeLeafTurnId = options.activeLeafTurnId ?? options.uptoTurnId;
9063
+ const blocks = options.continuityBlocks ?? continuityReplayBlocks(resolveReplayContinuity(entries, options));
8724
9064
  const projected = projectWorkingSet(entries, foldWorkingSet(entries, activeLeafTurnId), activeLeafTurnId);
8725
- return buildReplayAgentMessagesFromTurns(projected, { ...options, skillContextEntries: entries });
9065
+ return buildReplayAgentMessagesFromTurns(projected, {
9066
+ ...options,
9067
+ skillContextEntries: entries,
9068
+ continuityBlocks: blocks
9069
+ });
8726
9070
  }
8727
9071
 
8728
9072
  // src/interactive/loop-guard-interrupt.ts
@@ -9264,7 +9608,6 @@ export {
9264
9608
  renderToolPreview,
9265
9609
  canGroupObservation,
9266
9610
  foldSessionArtifacts,
9267
- renderContextMeterBar,
9268
9611
  renderContextMeterGrid,
9269
9612
  renderEvictedTokensLine,
9270
9613
  contextCategorySwatch,
@@ -9279,6 +9622,12 @@ export {
9279
9622
  throughputDetailSegment,
9280
9623
  dispatchSegment,
9281
9624
  fitFooterText,
9625
+ quotaSummaryLine,
9626
+ localQuotaSnapshot,
9627
+ quotaMeter,
9628
+ renderQuotaAccounts,
9629
+ routeWeeklyQuota,
9630
+ renderWorkerUsage,
9282
9631
  safeWorkerAnswerText,
9283
9632
  exactWorkerAnswerObject,
9284
9633
  presentWorkerContractAnswer,
@@ -9301,6 +9650,8 @@ export {
9301
9650
  fitDashboardLine,
9302
9651
  formatToolTally,
9303
9652
  formatUsd,
9653
+ contextUsageText,
9654
+ contextOccupancyBar,
9304
9655
  workspaceQuadrant,
9305
9656
  sessionQuadrant,
9306
9657
  contextQuadrant,
@@ -9318,6 +9669,8 @@ export {
9318
9669
  workerRunEntryFields,
9319
9670
  createCoalescingChatRenderer,
9320
9671
  rehydrateChatPanelFromTurns,
9672
+ continuityContextFromSession,
9673
+ withContinuityReplay,
9321
9674
  buildModelReplayAgentMessagesFromTurns,
9322
9675
  hasAssistantGenerationDelta,
9323
9676
  createAssistantGenerationTiming,
@@ -9341,4 +9694,4 @@ export {
9341
9694
  autonomyDeniedNotice,
9342
9695
  safetyBlockedNotice
9343
9696
  };
9344
- //# sourceMappingURL=chunk-62UK7AGW.js.map
9697
+ //# sourceMappingURL=chunk-M5PMRZSR.js.map