@iowarp/clio-coder 0.4.1 → 0.4.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 (437) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/CONTRIBUTING.md +59 -36
  3. package/README.md +404 -472
  4. package/SECURITY.md +2 -1
  5. package/dist/{acp-ZILU3AUO.js → acp-TMDQZDIG.js} +7 -7
  6. package/dist/{agents-HYWGBGQR.js → agents-5N5NG3XG.js} +28 -28
  7. package/dist/assets/codewiki.json +1 -1
  8. package/dist/{auth-N3QT7CBO.js → auth-Z5CCBXKQ.js} +8 -9
  9. package/dist/{builtins-UJLMOVOV.js → builtins-K6TNDT24.js} +4 -4
  10. package/dist/{chunk-GVQJ5CCZ.js → chunk-2HFQNRV3.js} +7 -7
  11. package/dist/{chunk-QMXC4JB7.js → chunk-2NHR3NAY.js} +163 -1401
  12. package/dist/chunk-2X4RYJTJ.js +39 -0
  13. package/dist/{chunk-Y45G3AXC.js → chunk-2Z2IKEXI.js} +6 -10
  14. package/dist/{chunk-EIMVLWB3.js → chunk-34BHNEE3.js} +7 -3
  15. package/dist/{chunk-GIZNH63R.js → chunk-35MSIRKH.js} +9 -4
  16. package/dist/chunk-3EBYEESD.js +314 -0
  17. package/dist/{chunk-CTJ4RNAA.js → chunk-3F7VUY77.js} +2 -2
  18. package/dist/{chunk-AP73CFDC.js → chunk-3KIPBMUA.js} +2 -2
  19. package/dist/{chunk-J5LZHVIT.js → chunk-3M6DQK6S.js} +113 -35
  20. package/dist/{chunk-VEGN6WIQ.js → chunk-462T4EGZ.js} +2 -2
  21. package/dist/{chunk-AFKWHWXF.js → chunk-4JDLP6ZS.js} +33 -16
  22. package/dist/{chunk-6FN3E6KX.js → chunk-4O6MANBS.js} +2 -2
  23. package/dist/{chunk-AKB4GYDL.js → chunk-54ODD65L.js} +5 -5
  24. package/dist/{chunk-BBTJOK6Y.js → chunk-5KW52TEP.js} +3 -3
  25. package/dist/{chunk-6CCS4G3W.js → chunk-5PFYMY2V.js} +2 -2
  26. package/dist/chunk-77QIVUZB.js +1334 -0
  27. package/dist/{chunk-7OBGU7UB.js → chunk-7BHIY2MW.js} +7 -13
  28. package/dist/{chunk-3QSOM6PA.js → chunk-AZ4WMN4W.js} +2 -2
  29. package/dist/{chunk-6NJQITNH.js → chunk-B74PXLU7.js} +6 -3
  30. package/dist/{chunk-R23Z6K6I.js → chunk-B7HM5Z7T.js} +15 -15
  31. package/dist/{chunk-R32CLGZ6.js → chunk-BO7Y52RY.js} +81 -20
  32. package/dist/{chunk-UEDMSP56.js → chunk-BYMNWQ7O.js} +123 -148
  33. package/dist/{chunk-ZJLUDYFY.js → chunk-CRFOIAX3.js} +4 -4
  34. package/dist/{chunk-2NM363SV.js → chunk-CYZW7JHJ.js} +7 -7
  35. package/dist/{chunk-6HMJX2VU.js → chunk-DYHAXKHD.js} +38 -10
  36. package/dist/{chunk-THYWACCR.js → chunk-DZAW46HP.js} +3 -3
  37. package/dist/{chunk-FYUN5KZ3.js → chunk-DZEK6CJN.js} +17 -17
  38. package/dist/{chunk-3I5NY75V.js → chunk-E7GT7O5N.js} +5 -5
  39. package/dist/{chunk-VKFQTNDV.js → chunk-F2I26BDK.js} +4 -4
  40. package/dist/{chunk-HLW2MRKE.js → chunk-F4EKGO4N.js} +3 -1
  41. package/dist/{chunk-IXJT6DCX.js → chunk-FVDGR2ZL.js} +3 -3
  42. package/dist/{chunk-TZSKNMZG.js → chunk-GTUD2WMY.js} +2 -1
  43. package/dist/{chunk-7EPLI7VL.js → chunk-HIICAHCJ.js} +2 -2
  44. package/dist/{chunk-E67WX76H.js → chunk-HKMD33FO.js} +29 -80
  45. package/dist/chunk-HLAFFSEK.js +360 -0
  46. package/dist/{chunk-UAPGZHYC.js → chunk-I64IFBLB.js} +9 -2
  47. package/dist/{chunk-XKA2ICR3.js → chunk-I66ZTYNP.js} +440 -175
  48. package/dist/{chunk-7PWAODYW.js → chunk-I7XBWTYH.js} +2 -2
  49. package/dist/{chunk-PVAMAVBB.js → chunk-IDNA72AH.js} +102 -2
  50. package/dist/{chunk-GCSMB2KY.js → chunk-IKOZFYBN.js} +1 -1
  51. package/dist/{chunk-2VG7KLYV.js → chunk-IKSLQ4XV.js} +5460 -3241
  52. package/dist/{chunk-QKIFBZKT.js → chunk-IMXMHHMQ.js} +166 -25
  53. package/dist/{chunk-74YWRRU5.js → chunk-JBCS7CRR.js} +2 -2
  54. package/dist/{chunk-BDPT6GTK.js → chunk-JWJGP5DQ.js} +2 -2
  55. package/dist/{chunk-K6BF4U2H.js → chunk-KKOJXO6R.js} +62 -14
  56. package/dist/chunk-KPXDY6QF.js +47 -0
  57. package/dist/{chunk-ABLSQ6JX.js → chunk-LJID3DYZ.js} +7 -1
  58. package/dist/{chunk-VKRH2TCS.js → chunk-M2DAX4F6.js} +2 -2
  59. package/dist/{chunk-6I5ILFOF.js → chunk-M2WXEHER.js} +2 -2
  60. package/dist/{chunk-YPI3QQCF.js → chunk-MCEPRMZW.js} +2 -4
  61. package/dist/{chunk-N5UK64DP.js → chunk-MCMZMDAC.js} +2 -2
  62. package/dist/{chunk-Y4CAGMM6.js → chunk-MNJGS2IN.js} +5 -6
  63. package/dist/{chunk-TVHHYFHE.js → chunk-NEDJ26B5.js} +2 -2
  64. package/dist/{chunk-U2WB7TZS.js → chunk-NMJXSHBJ.js} +97 -85
  65. package/dist/{chunk-HUAS7ITX.js → chunk-O3YUNJZ2.js} +13 -21
  66. package/dist/{chunk-MA3H6DM5.js → chunk-P75RZCJW.js} +25 -3
  67. package/dist/{chunk-IG7BCQBA.js → chunk-PGF63K6I.js} +2 -2
  68. package/dist/chunk-PJX3WQUQ.js +42 -0
  69. package/dist/{chunk-6DWBAZ5U.js → chunk-Q4XWMHX6.js} +4 -6
  70. package/dist/{chunk-OJTRZGR3.js → chunk-QQLGQY2A.js} +8 -8
  71. package/dist/{chunk-J4HBWF6Y.js → chunk-RLYRBIYQ.js} +115 -20
  72. package/dist/{chunk-NLFAQR7Z.js → chunk-S66XZJOF.js} +3 -23
  73. package/dist/{chunk-C537JADH.js → chunk-SSEYRH53.js} +6 -7
  74. package/dist/chunk-SZAA6XDG.js +30 -0
  75. package/dist/{chunk-MOPSG2X7.js → chunk-TPEQIQIE.js} +6 -6
  76. package/dist/{chunk-JA5QWE4Z.js → chunk-UBRFI4HS.js} +1879 -1650
  77. package/dist/{chunk-BTGG6BG2.js → chunk-UH347SHR.js} +154 -15
  78. package/dist/{chunk-5YHDIDBP.js → chunk-UH632ZYL.js} +2 -2
  79. package/dist/{chunk-BWW4HLO4.js → chunk-UXCU4E3T.js} +8 -6
  80. package/dist/{chunk-6VC4OV3Z.js → chunk-VIA6RFQZ.js} +3 -11
  81. package/dist/{chunk-ZAZB4JMW.js → chunk-VKPAQYEB.js} +27 -8
  82. package/dist/{chunk-UXN6JT4W.js → chunk-W4YEMFBX.js} +2 -2
  83. package/dist/{chunk-TD3PGPQA.js → chunk-W6NIE6OW.js} +2 -2
  84. package/dist/{chunk-TVH4ONAM.js → chunk-X7IARSHT.js} +3 -3
  85. package/dist/{chunk-PJJ6MY27.js → chunk-XE3PCIXH.js} +3 -3
  86. package/dist/{chunk-FEFIFZTL.js → chunk-XGDPUNND.js} +2 -2
  87. package/dist/{chunk-SCYB3HA4.js → chunk-XOXV5GKE.js} +51 -16
  88. package/dist/{chunk-QTFGO774.js → chunk-XQRY4DTA.js} +24 -11
  89. package/dist/{chunk-BJGUKIG4.js → chunk-YJISEZKC.js} +2 -2
  90. package/dist/{chunk-GPPB3JBE.js → chunk-ZGNYYXQ6.js} +2 -2
  91. package/dist/{chunk-SINK3QR6.js → chunk-ZNT2M6TG.js} +7 -7
  92. package/dist/{chunk-7RY5VZPH.js → chunk-ZW4HH5JJ.js} +6 -6
  93. package/dist/cli/index.js +33 -32
  94. package/dist/{clio-IT3G3VQH.js → clio-7VB377CC.js} +7 -7
  95. package/dist/{code-nav-RK6S7F6E.js → code-nav-YVLCYA7V.js} +85 -17
  96. package/dist/{config-3QZRWZJF.js → config-4HVOS65E.js} +88 -43
  97. package/dist/{configure-FL7Y3KJF.js → configure-PIWO7B24.js} +10 -10
  98. package/dist/{context-5HE7ODYK.js → context-IYEHL3WQ.js} +33 -31
  99. package/dist/{context-XNHL75JV.js → context-KQYIWPWT.js} +47 -34
  100. package/dist/{context-KYQFRVDC.js → context-N6ZE3LGJ.js} +11 -11
  101. package/dist/{context-clear-N545L53A.js → context-clear-G4OGZJDS.js} +33 -31
  102. package/dist/{context-working-set-QHKXSV2F.js → context-working-set-BWLF6LJP.js} +7 -7
  103. package/dist/{dispatch-runner-RGIE5PCT.js → dispatch-runner-2QQAITS3.js} +38 -38
  104. package/dist/{docs-5NAF6AU7.js → docs-PD3EXDKU.js} +21 -20
  105. package/dist/{doctor-ZGPEGHIP.js → doctor-LHBD36VU.js} +23 -22
  106. package/dist/{eval-GXLL44RD.js → eval-C45FYRJ6.js} +21 -20
  107. package/dist/{eval-inventory-HBWSWQOK.js → eval-inventory-6DEJPLBF.js} +2 -2
  108. package/dist/{evidence-HWLBRH3Q.js → evidence-6SHONYAF.js} +30 -28
  109. package/dist/{evolve-FTZBMNVW.js → evolve-KRKMV72X.js} +30 -28
  110. package/dist/{extensions-VHRBEID7.js → extensions-KPZ2UHBB.js} +5 -3
  111. package/dist/{fleet-CKZHJWZJ.js → fleet-IVTCKDHT.js} +62 -61
  112. package/dist/{fleet-commands-EXDXBMV6.js → fleet-commands-EDWL3IT7.js} +5 -5
  113. package/dist/{fleet-decisions-OTHB6KRL.js → fleet-decisions-YP3YEFGK.js} +4 -4
  114. package/dist/{fleet-graph-YTEZUCUT.js → fleet-graph-ZFWKHY2M.js} +16 -14
  115. package/dist/{fleet-inspect-SS6YMDCK.js → fleet-inspect-FVUNCBML.js} +31 -29
  116. package/dist/{fleet-preflight-PBY4VYOM.js → fleet-preflight-UN5XED4R.js} +2 -2
  117. package/dist/{fleet-validate-KMEM5L3S.js → fleet-validate-XOWC4HSX.js} +17 -15
  118. package/dist/{fleet-verify-QD5M7E7Q.js → fleet-verify-UN3SODEL.js} +30 -28
  119. package/dist/{fleet-view-WAMJYNDT.js → fleet-view-TWHJKCN6.js} +31 -29
  120. package/dist/{init-5XQRBOFV.js → init-T2QORQ3Y.js} +50 -49
  121. package/dist/{interop-34TVO25M.js → interop-IN5I2A66.js} +5 -5
  122. package/dist/{library-3QY6KF57.js → library-LSCATDLZ.js} +15 -13
  123. package/dist/{memory-L4UTIIIW.js → memory-HYOKAGGJ.js} +31 -29
  124. package/dist/{models-ZVX3QOWE.js → models-2GPMFYCM.js} +22 -21
  125. package/dist/{monitor-CEKVSYTS.js → monitor-E4ASVUJH.js} +34 -32
  126. package/dist/{orchestrator-77BAP6BC.js → orchestrator-DDMPR3PY.js} +984 -583
  127. package/dist/{panes-7STHOAUJ.js → panes-E3RUXOW5.js} +4 -4
  128. package/dist/{panes-SHAUIRXY.js → panes-IXKLOKA2.js} +23 -8
  129. package/dist/{reset-EOLM7GVE.js → reset-OAQP3W4O.js} +4 -4
  130. package/dist/{resources-74GKTLSF.js → resources-OTRSN34L.js} +15 -13
  131. package/dist/{run-HBAUJNNZ.js → run-5DEYH5QK.js} +60 -59
  132. package/dist/{share-G3APVLVP.js → share-IHWTLO3M.js} +19 -15
  133. package/dist/{skills-35HHUKCR.js → skills-IYMXMKW4.js} +17 -15
  134. package/dist/{skills-eval-QN4HSHDC.js → skills-eval-DROHSJAR.js} +36 -36
  135. package/dist/{skills-inventory-J357J34F.js → skills-inventory-D7X4L4ZX.js} +15 -13
  136. package/dist/{slash-commands-JZZCQA32.js → slash-commands-QBM7UZ3B.js} +21 -18
  137. package/dist/{steer-XAVHJM22.js → steer-Z5DO23FJ.js} +2 -2
  138. package/dist/{targets-DSM6CY3M.js → targets-P2FUC4IL.js} +25 -28
  139. package/dist/{terminal-lease-JOPFUVEM.js → terminal-lease-YREJ3JX2.js} +5 -5
  140. package/dist/{tools-MKNWVPBH.js → tools-5B7RO6MV.js} +4 -4
  141. package/dist/{trace-ECQ7TIYZ.js → trace-YMGMUM6A.js} +55 -7
  142. package/dist/{upgrade-H7TOM7YL.js → upgrade-PXK3S2YM.js} +11 -9
  143. package/dist/{usage-X52N3IDJ.js → usage-ME5MPXGX.js} +36 -34
  144. package/dist/{verifiers-EJTVVSMA.js → verifiers-BVZ7IWOO.js} +5 -5
  145. package/dist/{verify-YJL6XET2.js → verify-5K7ZKQFC.js} +4 -4
  146. package/dist/{web-fetch-MPIFL3LL.js → web-fetch-MPARV2K7.js} +2 -2
  147. package/dist/{wiki-generate-4NDZTQ4B.js → wiki-generate-F5W5QTYY.js} +48 -47
  148. package/dist/{with-panes-OBOBFIIR.js → with-panes-BYOJCLAM.js} +51 -255
  149. package/dist/worker/entry.js +45 -30
  150. package/docs/README.md +176 -81
  151. package/docs/{acp.md → architecture/acp.md} +36 -20
  152. package/docs/{alcf-provider.md → architecture/alcf-provider.md} +8 -5
  153. package/docs/{architecture.md → architecture/architecture.md} +43 -22
  154. package/docs/{artifact-placement.md → architecture/artifact-placement.md} +26 -23
  155. package/docs/architecture/artifact-versions.md +90 -0
  156. package/docs/{capacity-and-scheduling.md → architecture/capacity-and-scheduling.md} +26 -13
  157. package/docs/{context-engine.md → architecture/context-engine.md} +25 -25
  158. package/docs/{context-working-set.md → architecture/context-working-set.md} +13 -10
  159. package/docs/{dispatch-architecture-rationale.md → architecture/dispatch-architecture-rationale.md} +12 -9
  160. package/docs/{dispatch-typed-intent.md → architecture/dispatch-typed-intent.md} +68 -46
  161. package/docs/{evidence-and-memory.md → architecture/evidence-and-memory.md} +23 -16
  162. package/docs/{middleware-and-components.md → architecture/middleware-and-components.md} +11 -5
  163. package/docs/{model-catalog.md → architecture/model-catalog.md} +40 -17
  164. package/docs/{observability.md → architecture/observability.md} +26 -13
  165. package/docs/{pi-boundary.md → architecture/pi-boundary.md} +24 -11
  166. package/docs/{prompt-envelope-and-tools.md → architecture/prompt-envelope-and-tools.md} +55 -20
  167. package/docs/{provider-adapter-cookbook.md → architecture/provider-adapter-cookbook.md} +35 -24
  168. package/docs/{safety-model.md → architecture/safety-model.md} +20 -15
  169. package/docs/{session-lifecycle.md → architecture/session-lifecycle.md} +8 -5
  170. package/docs/architecture/time-conventions.md +125 -0
  171. package/docs/{trace-store.md → architecture/trace-store.md} +13 -5
  172. package/docs/{tui-design.md → architecture/tui-design.md} +13 -13
  173. package/docs/{worker-dispatch-mechanics.md → architecture/worker-dispatch-mechanics.md} +27 -30
  174. package/docs/{built-in-agents.md → guide/built-in-agents.md} +50 -34
  175. package/docs/{commands-and-modes.md → guide/commands-and-modes.md} +65 -60
  176. package/docs/{configuration-and-targets.md → guide/configuration-and-targets.md} +227 -289
  177. package/docs/guide/configuration-reference.md +1158 -0
  178. package/docs/{environment-variables.md → guide/environment-variables.md} +31 -28
  179. package/docs/{exit-codes-and-output.md → guide/exit-codes-and-output.md} +6 -3
  180. package/docs/{extensions-and-sharing.md → guide/extensions-and-sharing.md} +41 -14
  181. package/docs/{fleet-dispatch.md → guide/fleet-dispatch.md} +39 -43
  182. package/docs/{glossary.md → guide/glossary.md} +14 -11
  183. package/docs/{installation-and-lifecycle.md → guide/installation-and-lifecycle.md} +44 -13
  184. package/docs/guide/panes-and-files.md +290 -0
  185. package/docs/{proactive-memory.md → guide/proactive-memory.md} +79 -66
  186. package/docs/{resource-library.md → guide/resource-library.md} +13 -4
  187. package/docs/{skills-marketplace.md → guide/skills-marketplace.md} +7 -3
  188. package/docs/{tool-usage.md → guide/tool-usage.md} +87 -23
  189. package/docs/{troubleshooting.md → guide/troubleshooting.md} +9 -4
  190. package/docs/{config-knobs-audit.md → history/config-knobs-audit.md} +11 -11
  191. package/docs/{release-cut-checklist.md → history/release-cut-checklist.md} +29 -2
  192. package/docs/{development-pipeline.md → process/development-pipeline.md} +24 -26
  193. package/docs/process/documentation-coverage.md +100 -0
  194. package/docs/process/documentation-guide.md +187 -0
  195. package/docs/{eval-runner.md → process/eval-runner.md} +41 -50
  196. package/docs/{evals-internal.md → process/evals-internal.md} +10 -10
  197. package/docs/{evolution.md → process/evolution.md} +2 -2
  198. package/docs/{fleet-demo-runbook.md → process/fleet-demo-runbook.md} +11 -7
  199. package/docs/{git-commit-provenance.md → process/git-commit-provenance.md} +11 -4
  200. package/docs/{performance-methodology.md → process/performance-methodology.md} +87 -69
  201. package/docs/{scientific-validation.md → process/scientific-validation.md} +4 -4
  202. package/evals/README.md +2 -2
  203. package/package.json +9 -7
  204. package/skills/README.md +46 -37
  205. package/skills/coding/ast-grep/SKILL.md +2 -2
  206. package/skills/coding/coding-standards/SKILL.md +2 -2
  207. package/skills/coding/prototype/SKILL.md +2 -2
  208. package/skills/coding/tdd/SKILL.md +2 -2
  209. package/skills/context/context-handoff/SKILL.md +2 -2
  210. package/skills/context/context-prime/SKILL.md +2 -2
  211. package/skills/git/file-ticket/SKILL.md +2 -2
  212. package/skills/git/fix-issue/SKILL.md +3 -3
  213. package/skills/git/resolve-merge-conflicts/SKILL.md +2 -2
  214. package/skills/git/ship/SKILL.md +2 -2
  215. package/skills/git/worktree-create/SKILL.md +2 -2
  216. package/skills/git/worktree-merge/SKILL.md +2 -2
  217. package/skills/meta/clio-coder-dev/SKILL.md +9 -5
  218. package/skills/meta/clio-coder-dev/evals.md +3 -2
  219. package/skills/meta/clio-coder-test/SKILL.md +102 -95
  220. package/skills/meta/clio-coder-test/evals.md +9 -4
  221. package/skills/meta/clio-coder-test/references/harness.md +100 -124
  222. package/skills/meta/clio-coder-test/references/test-map.md +77 -50
  223. package/skills/meta/credentials/SKILL.md +2 -2
  224. package/skills/meta/find-skills/SKILL.md +2 -2
  225. package/skills/meta/herdr/SKILL.md +2 -2
  226. package/skills/meta/skill-craft/SKILL.md +22 -16
  227. package/skills/planning/architecture/SKILL.md +2 -2
  228. package/skills/planning/backlog/SKILL.md +2 -2
  229. package/skills/planning/prd/SKILL.md +2 -2
  230. package/skills/planning/product-intent/SKILL.md +2 -2
  231. package/skills/planning/tech-spec/SKILL.md +2 -2
  232. package/skills/registry.yaml +62 -62
  233. package/skills/research/arxiv-literature/SKILL.md +2 -2
  234. package/skills/research/experiment-protocol/SKILL.md +2 -2
  235. package/skills/research/scientific-debugging/SKILL.md +2 -2
  236. package/skills/research/scientific-modernization/SKILL.md +2 -2
  237. package/skills/skill-marketplace.json +62 -62
  238. package/skills/workflow/cut-it/SKILL.md +2 -2
  239. package/skills/workflow/design-council/SKILL.md +2 -2
  240. package/skills/workflow/grill-me/SKILL.md +2 -2
  241. package/skills/workflow/workflow-distiller/SKILL.md +2 -2
  242. package/src/cli/args.ts +2 -2
  243. package/src/cli/bootstrap-generate.ts +1 -1
  244. package/src/cli/config-inspect.ts +65 -12
  245. package/src/cli/configure.ts +0 -4
  246. package/src/cli/docs.ts +22 -14
  247. package/src/cli/doctor-naming.ts +5 -5
  248. package/src/cli/doctor-toolchain.ts +3 -3
  249. package/src/cli/eval.ts +1 -2
  250. package/src/cli/extensions.ts +2 -1
  251. package/src/cli/fleet.ts +1 -1
  252. package/src/cli/index.ts +2 -1
  253. package/src/cli/internal-dispatch.ts +3 -4
  254. package/src/cli/panes.ts +19 -5
  255. package/src/cli/run.ts +2 -2
  256. package/src/cli/share.ts +5 -1
  257. package/src/cli/skills-eval.ts +3 -3
  258. package/src/cli/targets.ts +2 -6
  259. package/src/cli/trace.ts +55 -4
  260. package/src/cli/wiki-generate.ts +1 -1
  261. package/src/core/artifact-paths.ts +1 -1
  262. package/src/core/bash-exec.ts +131 -86
  263. package/src/core/bus-events.ts +51 -6
  264. package/src/core/config.ts +5 -1
  265. package/src/core/defaults.ts +7 -4
  266. package/src/core/dispatch-outcome.ts +16 -0
  267. package/src/core/guardrails.ts +10 -49
  268. package/src/core/prompt-hint.ts +9 -0
  269. package/src/domains/agents/builtins/architect.md +2 -3
  270. package/src/domains/agents/builtins/coder.md +3 -2
  271. package/src/domains/agents/builtins/debugger.md +2 -2
  272. package/src/domains/agents/builtins/documenter.md +2 -2
  273. package/src/domains/agents/builtins/git-master.md +1 -1
  274. package/src/domains/agents/builtins/oracle.md +1 -1
  275. package/src/domains/agents/builtins/provenance.md +1 -1
  276. package/src/domains/agents/builtins/researcher.md +1 -1
  277. package/src/domains/agents/builtins/scout.md +1 -1
  278. package/src/domains/agents/builtins/tester.md +2 -2
  279. package/src/domains/agents/builtins/verifier.md +2 -2
  280. package/src/domains/agents/builtins/wiki-writer.md +1 -1
  281. package/src/domains/agents/catalog.ts +12 -14
  282. package/src/domains/agents/contract.ts +2 -0
  283. package/src/domains/agents/extension.ts +23 -1
  284. package/src/domains/config/keybindings.ts +8 -0
  285. package/src/domains/context/extension.ts +0 -3
  286. package/src/domains/context/working-set/path-index.ts +1 -0
  287. package/src/domains/dispatch/capability-match.ts +10 -0
  288. package/src/domains/dispatch/extension.ts +105 -22
  289. package/src/domains/dispatch/host-verification.ts +435 -39
  290. package/src/domains/dispatch/intent-requirements.ts +10 -0
  291. package/src/domains/dispatch/intent.ts +18 -1
  292. package/src/domains/dispatch/path-scope.ts +235 -24
  293. package/src/domains/dispatch/run-event-journal.ts +4 -15
  294. package/src/domains/dispatch/state.ts +2 -3
  295. package/src/domains/dispatch/transport.ts +45 -21
  296. package/src/domains/dispatch/types.ts +55 -3
  297. package/src/domains/eval/artifacts/store.ts +5 -0
  298. package/src/domains/eval/store.ts +8 -1
  299. package/src/domains/evidence/trust-status.ts +10 -1
  300. package/src/domains/extensions/contract.ts +15 -1
  301. package/src/domains/extensions/discovery.ts +238 -41
  302. package/src/domains/extensions/extension.ts +105 -6
  303. package/src/domains/extensions/index.ts +24 -0
  304. package/src/domains/extensions/integrity.ts +189 -0
  305. package/src/domains/extensions/manager.ts +17 -1
  306. package/src/domains/extensions/resource-path.ts +27 -0
  307. package/src/domains/extensions/resources.ts +18 -38
  308. package/src/domains/extensions/snapshot-store.ts +39 -0
  309. package/src/domains/extensions/snapshot.ts +180 -0
  310. package/src/domains/extensions/state.ts +385 -57
  311. package/src/domains/extensions/types.ts +118 -1
  312. package/src/domains/lifecycle/migrations/2026-09-01-extension-install-digests.ts +27 -0
  313. package/src/domains/lifecycle/migrations/index.ts +2 -0
  314. package/src/domains/lifecycle/naming-resources.ts +19 -4
  315. package/src/domains/lifecycle/naming-yazi.ts +10 -5
  316. package/src/domains/middleware/contract.ts +26 -0
  317. package/src/domains/middleware/extension.ts +24 -24
  318. package/src/domains/middleware/hook-receipts.ts +27 -4
  319. package/src/domains/middleware/hooks-io.ts +65 -32
  320. package/src/domains/middleware/hooks.ts +64 -0
  321. package/src/domains/middleware/index.ts +28 -4
  322. package/src/domains/middleware/registrations.ts +326 -0
  323. package/src/domains/middleware/runtime.ts +28 -0
  324. package/src/domains/middleware/snapshot.ts +20 -7
  325. package/src/domains/mux/contract.ts +38 -0
  326. package/src/domains/mux/detect.ts +6 -13
  327. package/src/domains/mux/index.ts +1 -1
  328. package/src/domains/mux/operations.ts +44 -5
  329. package/src/domains/mux/yazi/assets/yazi.toml +2 -2
  330. package/src/domains/mux/yazi/session.ts +53 -4
  331. package/src/domains/mux/yazi/theme.ts +117 -17
  332. package/src/domains/observability/contract.ts +10 -11
  333. package/src/domains/observability/extension.ts +11 -3
  334. package/src/domains/observability/projection.ts +14 -90
  335. package/src/domains/observability/trace-store.ts +43 -7
  336. package/src/domains/prompts/compiler.ts +73 -53
  337. package/src/domains/prompts/contract.ts +15 -3
  338. package/src/domains/prompts/extension.ts +97 -9
  339. package/src/domains/prompts/fragments/identity/clio-worker.md +1 -3
  340. package/src/domains/prompts/fragments/identity/clio.md +6 -12
  341. package/src/domains/prompts/fragments/identity/docs-routing.md +1 -2
  342. package/src/domains/prompts/fragments/identity/self-awareness.md +3 -11
  343. package/src/domains/prompts/fragments/operating/contract.md +7 -15
  344. package/src/domains/prompts/fragments/operating/delegation.md +32 -34
  345. package/src/domains/prompts/fragments/operating/skills.md +10 -24
  346. package/src/domains/prompts/fragments/operating/worker.md +1 -8
  347. package/src/domains/providers/index.ts +1 -1
  348. package/src/domains/providers/model-runtime-capabilities.ts +85 -21
  349. package/src/domains/providers/models/local-models/clio-coder-local-coding-targets.yaml +669 -104
  350. package/src/domains/providers/runtime-resolution.ts +31 -0
  351. package/src/domains/providers/runtimes/common/probe-helpers.ts +7 -2
  352. package/src/domains/providers/runtimes/local-native/llamacpp.ts +9 -1
  353. package/src/domains/providers/types/cost-provenance.ts +19 -0
  354. package/src/domains/providers/types/local-model-quirks.ts +85 -37
  355. package/src/domains/resources/skills/loader.ts +16 -19
  356. package/src/domains/safety/call-target.ts +1 -1
  357. package/src/domains/safety/loop-detector.ts +7 -4
  358. package/src/domains/session/task-board.ts +10 -9
  359. package/src/domains/share/archive.ts +164 -7
  360. package/src/engine/acp/server.ts +62 -9
  361. package/src/engine/apis/llamacpp-residency.ts +3 -4
  362. package/src/engine/apis/lmstudio.ts +3 -3
  363. package/src/engine/apis/ollama-native.ts +6 -6
  364. package/src/engine/apis/openai-completions.ts +28 -25
  365. package/src/engine/apis/output-budget.ts +8 -18
  366. package/src/engine/apis/residency.ts +8 -27
  367. package/src/engine/gemma-channel-filter.ts +19 -0
  368. package/src/engine/loop-guard.ts +92 -12
  369. package/src/engine/worker-runtime.ts +40 -11
  370. package/src/engine/worker-tools.ts +3 -1
  371. package/src/entry/extension-hook-sources.ts +28 -0
  372. package/src/entry/extension-reload.ts +309 -0
  373. package/src/entry/orchestrator.ts +59 -35
  374. package/src/interactive/application-controller.ts +2 -1
  375. package/src/interactive/bus-notices.ts +8 -1
  376. package/src/interactive/chat-loop-messages.ts +3 -13
  377. package/src/interactive/chat-loop.ts +10 -1
  378. package/src/interactive/chat-panel.ts +36 -13
  379. package/src/interactive/chat-renderer.ts +71 -7
  380. package/src/interactive/dispatch-board.ts +6 -11
  381. package/src/interactive/footer/widgets.ts +13 -0
  382. package/src/interactive/interactive-application.ts +39 -4
  383. package/src/interactive/interactive-input-runtime.ts +4 -0
  384. package/src/interactive/interactive-presentation.ts +2 -2
  385. package/src/interactive/interactive-slash-runtime.ts +2 -0
  386. package/src/interactive/overlays/extensions.ts +9 -1
  387. package/src/interactive/overlays/help-reference.ts +13 -0
  388. package/src/interactive/overlays/settings.ts +27 -16
  389. package/src/interactive/panes-runtime.ts +111 -35
  390. package/src/interactive/prompt-cache-identity.ts +88 -0
  391. package/src/interactive/slash-commands.ts +129 -14
  392. package/src/interactive/stream-pacing-policy.ts +0 -23
  393. package/src/interactive/turn-context.ts +30 -15
  394. package/src/interactive/yazi-bridge.ts +60 -6
  395. package/src/tools/agent-tools.ts +30 -1
  396. package/src/tools/artifact.ts +2 -2
  397. package/src/tools/ask-user.ts +3 -3
  398. package/src/tools/bash.ts +1 -1
  399. package/src/tools/bootstrap.ts +4 -0
  400. package/src/tools/builtin-tool-catalog.ts +52 -22
  401. package/src/tools/codewiki/code-nav-surface.ts +6 -0
  402. package/src/tools/codewiki/code-nav.ts +99 -13
  403. package/src/tools/context/docs-engine.ts +20 -7
  404. package/src/tools/context/index.ts +29 -12
  405. package/src/tools/core-bootstrap.ts +28 -6
  406. package/src/tools/credential-present.ts +1 -2
  407. package/src/tools/dispatch-arguments.ts +5 -1
  408. package/src/tools/dispatch-plan.ts +48 -4
  409. package/src/tools/dispatch-run-events.ts +1 -1
  410. package/src/tools/dispatch-schema.ts +338 -0
  411. package/src/tools/dispatch-types.ts +3 -0
  412. package/src/tools/dispatch.ts +9 -254
  413. package/src/tools/ledger.ts +3 -5
  414. package/src/tools/monitor-surface.ts +5 -13
  415. package/src/tools/observation.ts +4 -5
  416. package/src/tools/panes-surface.ts +4 -11
  417. package/src/tools/panes.ts +4 -2
  418. package/src/tools/policy.ts +15 -2
  419. package/src/tools/read.ts +5 -6
  420. package/src/tools/registry.ts +30 -7
  421. package/src/tools/result-shaping.ts +18 -14
  422. package/src/tools/steer-surface.ts +1 -1
  423. package/src/tools/tasks.ts +1 -1
  424. package/src/tools/truncate.ts +6 -5
  425. package/src/tools/verify/surface.ts +6 -12
  426. package/src/tools/web-fetch-surface.ts +1 -3
  427. package/dist/chunk-5QIAJV2D.js +0 -48
  428. package/dist/chunk-JZWT5J3Y.js +0 -814
  429. package/dist/chunk-K7VKOLQQ.js +0 -15
  430. package/dist/chunk-PMZCIOCJ.js +0 -25
  431. package/dist/chunk-SUW5DORT.js +0 -819
  432. package/dist/chunk-UOV2BYIW.js +0 -107
  433. package/dist/chunk-WR6U3OVP.js +0 -45
  434. package/docs/artifact-versions.md +0 -67
  435. package/docs/documentation-coverage.md +0 -46
  436. package/docs/documentation-guide.md +0 -167
  437. package/docs/time-conventions.md +0 -101
package/src/cli/trace.ts CHANGED
@@ -3,6 +3,8 @@ import { access } from "node:fs/promises";
3
3
  import { resolve } from "node:path";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
5
5
  import { clioStatePath } from "../core/xdg.js";
6
+ import type { CodeStepRecord } from "../domains/dispatch/code-step.js";
7
+ import { codeStepDir, readCodeStepRecords } from "../domains/dispatch/code-step-store.js";
6
8
  import {
7
9
  assertTraceSelectOnly,
8
10
  DEFAULT_TRACE_RETENTION_POLICY,
@@ -24,12 +26,16 @@ const HELP = `Usage:
24
26
  clio-coder trace phases <runId> [--db PATH]
25
27
  clio-coder trace tail <runId> [--follow] [--db PATH]
26
28
  clio-coder trace procs <runId> [--db PATH]
29
+ clio-coder trace code-steps <rootId> [--json] deterministic code steps of one fleet root
27
30
  clio-coder trace prune [--max-age-days N] [--max-bytes N] [--db PATH] [--json]
28
31
  clio-coder trace sql <SELECT query> [--db PATH]
29
32
  clio-coder trace ui [--db PATH] [--port N] source checkout only
30
33
 
31
34
  The viewer ships with the repository, not the npm package, so from an installed
32
- Clio the subcommands above are the way in. They read the same database.
35
+ Clio the subcommands above are the way in. They read the same database, except
36
+ code-steps, which reads the per-root record files under the state directory's
37
+ code-steps/ tree (a code step is a subprocess, not a model run, so it never
38
+ enters the SQLite mirror).
33
39
  Pruning keeps ${DEFAULT_TRACE_RETENTION_POLICY.maxAgeDays} days and at most ${DEFAULT_TRACE_RETENTION_POLICY.maxBytes} bytes by default. Set
34
40
  CLIO_CODER_TRACE_RETENTION_DAYS or CLIO_CODER_TRACE_MAX_BYTES to change the automatic
35
41
  policy; prune flags override those values for one command.
@@ -97,7 +103,7 @@ function parseTraceArgs(args: string[]): ParsedTraceArgs {
97
103
  }
98
104
 
99
105
  /** Every subcommand `trace` answers to. Anything else is a usage error. */
100
- const TRACE_COMMANDS = new Set(["runs", "inspect", "phases", "tail", "procs", "prune", "sql", "ui"]);
106
+ const TRACE_COMMANDS = new Set(["runs", "inspect", "phases", "tail", "procs", "code-steps", "prune", "sql", "ui"]);
101
107
 
102
108
  /** The subcommands whose first positional is a run id. */
103
109
  const TRACE_COMMANDS_NEEDING_RUN_ID = new Set(["phases", "tail", "procs"]);
@@ -119,6 +125,10 @@ function invocationError(command: string, runId: string | undefined): number | n
119
125
  return 2;
120
126
  }
121
127
  if (TRACE_COMMANDS_NEEDING_RUN_ID.has(command) && !runId) return missingRunId(command);
128
+ if (command === "code-steps" && !runId) {
129
+ process.stderr.write("trace code-steps requires a fleet root id\n");
130
+ return 2;
131
+ }
122
132
  return null;
123
133
  }
124
134
 
@@ -161,6 +171,12 @@ export async function runTraceCommand(args: string[]): Promise<number> {
161
171
 
162
172
  if (command === "ui") return runTraceUi(parsed.db, parsed.port);
163
173
 
174
+ // Code-step records live in flat per-root JSON files beside the ledger, not
175
+ // in the SQLite mirror, so this answers before the database is consulted and
176
+ // ignores --db. An absent root directory is the empty state: the root either
177
+ // never ran a code step or its records were pruned with the state tree.
178
+ if (command === "code-steps") return runTraceCodeSteps(runId ?? "", parsed.json);
179
+
164
180
  // `inspect` answers ahead of the no-database courtesy below, because its
165
181
  // answer to a state tree nothing has written to is a JSON snapshot saying
166
182
  // the trace database is unavailable, not a sentence on stdout.
@@ -242,6 +258,41 @@ export async function runTraceCommand(args: string[]): Promise<number> {
242
258
  }
243
259
  }
244
260
 
261
+ /**
262
+ * Print every `CodeStepRecord` one fleet root wrote, oldest first. The record
263
+ * is the code step's stand-in for a receipt (argv, cwd, env names, exit code,
264
+ * duration, output digest, artifact paths), and until this command nothing
265
+ * read it back. JSON is the record verbatim; the table keeps the fields an
266
+ * operator scans for and leaves argv last because it is the widest.
267
+ */
268
+ function runTraceCodeSteps(rootId: string, json: boolean): number {
269
+ let records: CodeStepRecord[];
270
+ try {
271
+ records = readCodeStepRecords(rootId);
272
+ } catch (error) {
273
+ process.stderr.write(`code-step records: ${error instanceof Error ? error.message : String(error)}\n`);
274
+ return 1;
275
+ }
276
+ if (json) {
277
+ process.stdout.write(`${JSON.stringify(records, null, 2)}\n`);
278
+ return 0;
279
+ }
280
+ if (records.length === 0) {
281
+ process.stdout.write(
282
+ `no code-step records for fleet root ${rootId} under ${codeStepDir(rootId)}. a record is written when a fleet plan runs a deterministic code step.\n`,
283
+ );
284
+ return 0;
285
+ }
286
+ process.stdout.write("EXIT DURATION STARTED STEP COMMAND ARGV\n");
287
+ for (const record of records) {
288
+ const exit = record.timedOut ? "timeout" : record.signal !== null ? `sig:${record.signal}` : String(record.exitCode);
289
+ process.stdout.write(
290
+ `${exit.padEnd(5)} ${`${record.durationMs}ms`.padStart(8)} ${record.startedAt.padEnd(24)} ${record.stepId.slice(0, 20).padEnd(20)} ${record.commandId.slice(0, 20).padEnd(20)} ${record.argv.join(" ")}\n`,
291
+ );
292
+ }
293
+ return 0;
294
+ }
295
+
245
296
  function runTracePrune(parsed: ParsedTraceArgs): number {
246
297
  let policy: ReturnType<typeof resolveTraceRetentionPolicy>;
247
298
  try {
@@ -302,10 +353,10 @@ function formatEvent(row: TraceEventRow): string {
302
353
  }
303
354
 
304
355
  function printRuns(rows: TraceRunRow[]): void {
305
- process.stdout.write("STATUS STARTED TOKENS COST RUN\n");
356
+ process.stdout.write("STATUS SOURCE STARTED TOKENS COST RUN\n");
306
357
  for (const row of rows) {
307
358
  process.stdout.write(
308
- `${row.status.padEnd(8)} ${row.started_at.padEnd(28)} ${formatNumber(row.total_tokens).padStart(8)} ${formatCost(row.total_cost_usd).padStart(10)} ${row.run_id}\n`,
359
+ `${row.status.padEnd(8)} ${row.source.padEnd(8)} ${row.started_at.padEnd(28)} ${formatNumber(row.total_tokens).padStart(8)} ${formatCost(row.total_cost_usd).padStart(10)} ${row.run_id}\n`,
309
360
  );
310
361
  }
311
362
  }
@@ -236,7 +236,7 @@ async function runWikiDispatch(input: {
236
236
  } catch (err) {
237
237
  return { ok: false, detail: err instanceof Error ? err.message : String(err) };
238
238
  }
239
- const deadline = armInternalDispatchDeadline(input.dispatch, handle.runId, input.label, process.env, input.deadlineMs);
239
+ const deadline = armInternalDispatchDeadline(input.dispatch, handle.runId, input.label, input.deadlineMs);
240
240
  let lastHeartbeatAt = startedAtClock;
241
241
  try {
242
242
  const summary = await drainDispatchEvents(handle.events, (tools) => {
@@ -15,7 +15,7 @@
15
15
  * be checking a path the tool never writes. One artifact per kind is therefore
16
16
  * the contract; keep several by passing explicit paths.
17
17
  *
18
- * See docs/artifact-placement.md for the full taxonomy.
18
+ * See docs/architecture/artifact-placement.md for the full taxonomy.
19
19
  */
20
20
 
21
21
  /** Project-local directory holding everything Clio generates for one repo. */
@@ -18,7 +18,7 @@ export { clampTimerDelayMs as clampTimeoutMs } from "./timers.js";
18
18
  // (failing assertion, compiler error, exit summary) must survive.
19
19
  export const BASH_HARD_CAP_BYTES = 16 * 1024 * 1024;
20
20
 
21
- const CLIO_CONTROL_ENV_KEYS = ["CLIO_CODER_INTERACTIVE", "CLIO_CODER_RESUME_SESSION_ID"] as const;
21
+ const CLIO_CONTROL_ENV_KEYS = ["CLIO_CODER_INTERACTIVE"] as const;
22
22
 
23
23
  export interface BashCommandResult {
24
24
  error: NodeJS.ErrnoException | null;
@@ -52,6 +52,129 @@ export interface RunBashCommandOptions {
52
52
 
53
53
  const BASH_UPDATE_THROTTLE_MS = 100;
54
54
 
55
+ export interface BashProgressScheduler {
56
+ now(): number;
57
+ setTimeout(callback: () => void, delayMs: number): unknown;
58
+ clearTimeout(timer: unknown): void;
59
+ }
60
+
61
+ export interface BashOutputProgressController {
62
+ /** Emit the initial empty cumulative snapshot, when a callback is configured. */
63
+ start(): void;
64
+ /** Accept one stream chunk. Returns true only when this chunk reaches the hard cap. */
65
+ append(target: "stdout" | "stderr", chunk: Buffer): boolean;
66
+ /** Seal output, cancel progress work, emit the final snapshot, and return the result fields. */
67
+ settle(): Pick<BashCommandResult, "stdout" | "stderr" | "outputBytes" | "outputCapped">;
68
+ }
69
+
70
+ const SYSTEM_PROGRESS_SCHEDULER: BashProgressScheduler = {
71
+ now: Date.now,
72
+ setTimeout: (callback, delayMs) => setTimeout(callback, delayMs),
73
+ clearTimeout: (timer) => clearTimeout(timer as ReturnType<typeof setTimeout>),
74
+ };
75
+
76
+ /**
77
+ * Cumulative stdout/stderr fold shared by the child stream handlers and a
78
+ * deterministic contract-test seam. Settlement is a phase, not just a final
79
+ * boolean: once it starts, re-entrant or queued stream work is rejected while
80
+ * the one final advisory snapshot is still allowed to publish.
81
+ */
82
+ export function createBashOutputProgressController(
83
+ onUpdate?: (progress: BashCommandProgress) => void,
84
+ scheduler: BashProgressScheduler = SYSTEM_PROGRESS_SCHEDULER,
85
+ ): BashOutputProgressController {
86
+ let phase: "active" | "settling" | "settled" = "active";
87
+ let stdout = "";
88
+ let stderr = "";
89
+ const stdoutDecoder = new StringDecoder("utf8");
90
+ const stderrDecoder = new StringDecoder("utf8");
91
+ let decodersFinished = false;
92
+ let outputBytes = 0;
93
+ let outputCapped = false;
94
+ let updateTimer: unknown = null;
95
+ let updateDirty = false;
96
+ let lastUpdateAt = 0;
97
+
98
+ const snapshot = (): BashCommandProgress => ({ stdout, stderr, outputBytes });
99
+
100
+ const finishDecoders = (): void => {
101
+ if (decodersFinished) return;
102
+ decodersFinished = true;
103
+ // A hard byte cap may bisect a multibyte code point. Discard the
104
+ // decoder's incomplete suffix instead of manufacturing U+FFFD.
105
+ if (outputCapped) return;
106
+ stdout += stdoutDecoder.end();
107
+ stderr += stderrDecoder.end();
108
+ };
109
+
110
+ const emitUpdate = (final = false): void => {
111
+ if (onUpdate === undefined || !updateDirty) return;
112
+ if (phase !== "active" && !(final && phase === "settling")) return;
113
+ updateDirty = false;
114
+ lastUpdateAt = scheduler.now();
115
+ try {
116
+ onUpdate(snapshot());
117
+ } catch {
118
+ // Rendering progress is advisory and must never change command execution.
119
+ }
120
+ };
121
+
122
+ const clearUpdateTimer = (): void => {
123
+ if (updateTimer === null) return;
124
+ scheduler.clearTimeout(updateTimer);
125
+ updateTimer = null;
126
+ };
127
+
128
+ const scheduleUpdate = (): void => {
129
+ if (onUpdate === undefined || phase !== "active") return;
130
+ updateDirty = true;
131
+ const delay = BASH_UPDATE_THROTTLE_MS - (scheduler.now() - lastUpdateAt);
132
+ if (delay <= 0) {
133
+ clearUpdateTimer();
134
+ emitUpdate();
135
+ return;
136
+ }
137
+ updateTimer ??= scheduler.setTimeout(() => {
138
+ updateTimer = null;
139
+ // A timer already queued by the event loop may still invoke its callback
140
+ // after clearTimeout. The phase check makes that callback inert.
141
+ emitUpdate();
142
+ }, delay);
143
+ };
144
+
145
+ return {
146
+ start(): void {
147
+ if (phase !== "active" || onUpdate === undefined) return;
148
+ updateDirty = true;
149
+ emitUpdate();
150
+ },
151
+ append(target, chunk): boolean {
152
+ if (phase !== "active" || outputCapped) return false;
153
+ const remaining = BASH_HARD_CAP_BYTES - outputBytes;
154
+ const accepted = chunk.byteLength <= remaining ? chunk : chunk.subarray(0, Math.max(0, remaining));
155
+ outputBytes += accepted.byteLength;
156
+ if (accepted.byteLength > 0) {
157
+ const decoded = target === "stdout" ? stdoutDecoder.write(accepted) : stderrDecoder.write(accepted);
158
+ if (target === "stdout") stdout += decoded;
159
+ else stderr += decoded;
160
+ }
161
+ if (accepted.byteLength < chunk.byteLength) outputCapped = true;
162
+ scheduleUpdate();
163
+ return outputCapped;
164
+ },
165
+ settle() {
166
+ if (phase === "settled") return { ...snapshot(), outputCapped };
167
+ if (phase === "settling") return { ...snapshot(), outputCapped };
168
+ phase = "settling";
169
+ clearUpdateTimer();
170
+ finishDecoders();
171
+ emitUpdate(true);
172
+ phase = "settled";
173
+ return { ...snapshot(), outputCapped };
174
+ },
175
+ };
176
+ }
177
+
55
178
  function buildToolEnv(): NodeJS.ProcessEnv {
56
179
  const env = { ...process.env };
57
180
  env.AI_AGENT = AI_AGENT_NAME;
@@ -152,16 +275,7 @@ export async function runBashCommand(command: string, options: RunBashCommandOpt
152
275
  let timeoutId: ReturnType<typeof setTimeout> | null = null;
153
276
  let killGraceTimer: ReturnType<typeof setTimeout> | null = null;
154
277
  let killSent = false;
155
- let stdout = "";
156
- let stderr = "";
157
- const stdoutDecoder = new StringDecoder("utf8");
158
- const stderrDecoder = new StringDecoder("utf8");
159
- let decodersFinished = false;
160
- let outputBytes = 0;
161
- let outputCapped = false;
162
- let updateTimer: ReturnType<typeof setTimeout> | null = null;
163
- let updateDirty = false;
164
- let lastUpdateAt = 0;
278
+ const output = createBashOutputProgressController(options.onUpdate);
165
279
 
166
280
  const child = spawn("/bin/bash", [plan.mode, command], {
167
281
  ...(options.cwd === undefined ? {} : { cwd: options.cwd }),
@@ -170,53 +284,7 @@ export async function runBashCommand(command: string, options: RunBashCommandOpt
170
284
  stdio: ["ignore", "pipe", "pipe"],
171
285
  });
172
286
 
173
- const finishDecoders = (): void => {
174
- if (decodersFinished) return;
175
- decodersFinished = true;
176
- // A hard byte cap may bisect a multibyte code point. Discard the
177
- // decoder's incomplete suffix instead of manufacturing U+FFFD.
178
- if (outputCapped) return;
179
- stdout += stdoutDecoder.end();
180
- stderr += stderrDecoder.end();
181
- };
182
-
183
- const emitUpdate = (): void => {
184
- if (options.onUpdate === undefined || !updateDirty) return;
185
- updateDirty = false;
186
- lastUpdateAt = Date.now();
187
- try {
188
- options.onUpdate({ stdout, stderr, outputBytes: Math.min(outputBytes, BASH_HARD_CAP_BYTES) });
189
- } catch {
190
- // Rendering progress is advisory and must never change command execution.
191
- }
192
- };
193
- const clearUpdateTimer = (): void => {
194
- if (updateTimer === null) return;
195
- clearTimeout(updateTimer);
196
- updateTimer = null;
197
- };
198
- const scheduleUpdate = (): void => {
199
- if (options.onUpdate === undefined) return;
200
- updateDirty = true;
201
- const delay = BASH_UPDATE_THROTTLE_MS - (Date.now() - lastUpdateAt);
202
- if (delay <= 0) {
203
- clearUpdateTimer();
204
- emitUpdate();
205
- return;
206
- }
207
- updateTimer ??= setTimeout(() => {
208
- updateTimer = null;
209
- emitUpdate();
210
- }, delay);
211
- };
212
- const finishUpdates = (): void => {
213
- clearUpdateTimer();
214
- emitUpdate();
215
- };
216
- if (options.onUpdate !== undefined) {
217
- updateDirty = true;
218
- emitUpdate();
219
- }
287
+ output.start();
220
288
 
221
289
  const clearKillGraceTimer = (): void => {
222
290
  if (!killGraceTimer) return;
@@ -265,22 +333,7 @@ export async function runBashCommand(command: string, options: RunBashCommandOpt
265
333
  }
266
334
 
267
335
  const appendChunk = (target: "stdout" | "stderr", chunk: Buffer): void => {
268
- if (outputCapped) return;
269
- const remaining = BASH_HARD_CAP_BYTES - outputBytes;
270
- const accepted = chunk.byteLength <= remaining ? chunk : chunk.subarray(0, Math.max(0, remaining));
271
- outputBytes += accepted.byteLength;
272
- if (accepted.byteLength > 0) {
273
- const decoded = target === "stdout" ? stdoutDecoder.write(accepted) : stderrDecoder.write(accepted);
274
- if (target === "stdout") stdout += decoded;
275
- else stderr += decoded;
276
- }
277
- if (accepted.byteLength < chunk.byteLength) {
278
- outputCapped = true;
279
- scheduleUpdate();
280
- killChild();
281
- return;
282
- }
283
- scheduleUpdate();
336
+ if (output.append(target, chunk)) killChild();
284
337
  };
285
338
 
286
339
  child.stdout?.on("data", (chunk: Buffer) => appendChunk("stdout", chunk));
@@ -290,19 +343,15 @@ export async function runBashCommand(command: string, options: RunBashCommandOpt
290
343
  settled = true;
291
344
  if (timeoutId) clearTimeout(timeoutId);
292
345
  clearKillGraceTimer();
293
- finishDecoders();
294
- finishUpdates();
346
+ const finalOutput = output.settle();
295
347
  options.signal?.removeEventListener("abort", onAbort);
296
348
  resolve({
297
349
  error: error as NodeJS.ErrnoException,
298
- stdout,
299
- stderr,
350
+ ...finalOutput,
300
351
  exitCode: null,
301
352
  signal: null,
302
353
  aborted,
303
354
  timedOut,
304
- outputCapped,
305
- outputBytes,
306
355
  });
307
356
  });
308
357
  child.on("close", (code, signalName) => {
@@ -310,8 +359,7 @@ export async function runBashCommand(command: string, options: RunBashCommandOpt
310
359
  settled = true;
311
360
  if (timeoutId) clearTimeout(timeoutId);
312
361
  clearKillGraceTimer();
313
- finishDecoders();
314
- finishUpdates();
362
+ const finalOutput = output.settle();
315
363
  options.signal?.removeEventListener("abort", onAbort);
316
364
  const error =
317
365
  code === 0 && signalName === null
@@ -324,14 +372,11 @@ export async function runBashCommand(command: string, options: RunBashCommandOpt
324
372
  } as NodeJS.ErrnoException);
325
373
  resolve({
326
374
  error,
327
- stdout,
328
- stderr,
375
+ ...finalOutput,
329
376
  exitCode: code,
330
377
  signal: signalName,
331
378
  aborted,
332
379
  timedOut,
333
- outputCapped,
334
- outputBytes,
335
380
  });
336
381
  });
337
382
  });
@@ -24,6 +24,7 @@ import type {
24
24
  ToolActivitySummary,
25
25
  } from "../domains/dispatch/types.js";
26
26
  import type { MiddlewareHook } from "../domains/middleware/types.js";
27
+ import type { ObservabilityRunEvidence } from "../domains/observability/contract.js";
27
28
  import type { TargetStatus } from "../domains/providers/contract.js";
28
29
  import type { CostProvenance } from "../domains/providers/index.js";
29
30
  import type { ClioSettings } from "./config.js";
@@ -58,9 +59,11 @@ export const BusChannels = {
58
59
  DispatchProgress: "dispatch.progress",
59
60
  DispatchCompleted: "dispatch.completed",
60
61
  DispatchFailed: "dispatch.failed",
62
+ AccountabilityEvidenceReady: "accountability.evidenceReady",
61
63
  CompactionBegin: "compaction.begin",
62
64
  CompactionEnd: "compaction.end",
63
65
  MiddlewareHookFailed: "middleware.hookFailed",
66
+ ExtensionsReloaded: "extensions.reloaded",
64
67
  ContextActivity: "context.activity",
65
68
  ContextWarning: "context.warning",
66
69
  ContextPruned: "context.pruned",
@@ -628,8 +631,8 @@ export interface DispatchTerminalStats {
628
631
  exitCode: number;
629
632
  /** Honest activity record aggregated from the run's tool telemetry; null when the receipt predates it. */
630
633
  toolActivity: ToolActivitySummary | null;
631
- /** Host-run declared verification status when the request included checks. */
632
- hostVerification?: "verified" | "rejected" | "skipped";
634
+ /** Host-run declared verification status when the request included checks; `not_implicated` is a batch member the failure was charged away from. */
635
+ hostVerification?: "verified" | "rejected" | "skipped" | "not_implicated";
633
636
  }
634
637
 
635
638
  /** Published on {@link BusChannels.DispatchCompleted} when a run finalizes as succeeded. */
@@ -667,6 +670,24 @@ export interface DispatchFailedPayload extends DispatchRunIdentity, Partial<Disp
667
670
  skillActivations?: ReadonlyArray<SkillActivation>;
668
671
  }
669
672
 
673
+ // ---------------------------------------------------------------------------
674
+ // Accountability
675
+ // ---------------------------------------------------------------------------
676
+
677
+ /**
678
+ * Published on {@link BusChannels.AccountabilityEvidenceReady} by the
679
+ * observability extension once a finalized run's evidence bundle and its
680
+ * sidecar index row have landed. The evidence fields are exactly
681
+ * {@link ObservabilityRunEvidence}, the shape the projection already attaches
682
+ * to the run summary, so the bus and the snapshot cannot describe the same
683
+ * moment two ways. A failed build publishes nothing here: the projection's
684
+ * notice is the failure surface, and a client that never receives this event
685
+ * has learned only that no bundle is ready, which is the truth.
686
+ */
687
+ export interface AccountabilityEvidenceReadyPayload extends ObservabilityRunEvidence {
688
+ runId: string;
689
+ }
690
+
670
691
  // ---------------------------------------------------------------------------
671
692
  // Compaction
672
693
  // ---------------------------------------------------------------------------
@@ -677,6 +698,26 @@ export interface CompactionPayload {
677
698
  at: number;
678
699
  }
679
700
 
701
+ // ---------------------------------------------------------------------------
702
+ // Extensions
703
+ // ---------------------------------------------------------------------------
704
+
705
+ /**
706
+ * Published on {@link BusChannels.ExtensionsReloaded} by the composition
707
+ * root after a new extension generation and its user-hook registrations
708
+ * have both been committed. Consumers that cache extension-sourced data
709
+ * (prompt fragments, agent recipes, the session prompt) refresh on
710
+ * `changed`; an unchanged generation carries the previous digest and needs
711
+ * no work. Never published between the two commits.
712
+ */
713
+ export interface ExtensionsReloadedPayload {
714
+ generation: number;
715
+ previousGeneration: number;
716
+ changed: boolean;
717
+ /** Content identity of the committed snapshot. */
718
+ digest: string;
719
+ }
720
+
680
721
  // ---------------------------------------------------------------------------
681
722
  // Middleware
682
723
  // ---------------------------------------------------------------------------
@@ -685,15 +726,17 @@ export interface CompactionPayload {
685
726
  * Published on {@link BusChannels.MiddlewareHookFailed} when a middleware hook
686
727
  * registration misbehaves: `hook_failed` for a thrown evaluate (its effects
687
728
  * are discarded and the turn proceeds), `budget_exceeded` for a soft
688
- * wall-time overrun (effects still apply). Diagnostics only; nothing
689
- * subscribing here may decide anything.
729
+ * wall-time overrun (effects still apply), `registration_conflict` when an
730
+ * owned registration set (user hooks) offered an id a builtin or host
731
+ * registration holds, or a host registration evicted an owned one.
732
+ * Diagnostics only; nothing subscribing here may decide anything.
690
733
  */
691
734
  export interface MiddlewareHookFailedPayload {
692
- kind: "hook_failed" | "budget_exceeded";
735
+ kind: "hook_failed" | "budget_exceeded" | "registration_conflict";
693
736
  registrationId: string;
694
737
  hook: MiddlewareHook;
695
738
  at: number;
696
- /** Error text; hook_failed only. */
739
+ /** Error text for hook_failed; one formatted line for registration_conflict. */
697
740
  message?: string | undefined;
698
741
  /** Measured and allowed wall time in ms; budget_exceeded only. */
699
742
  elapsedMs?: number | undefined;
@@ -798,9 +841,11 @@ export type BusPayloadMap = {
798
841
  [BusChannels.DispatchProgress]: DispatchProgressPayload;
799
842
  [BusChannels.DispatchCompleted]: DispatchCompletedPayload;
800
843
  [BusChannels.DispatchFailed]: DispatchFailedPayload;
844
+ [BusChannels.AccountabilityEvidenceReady]: AccountabilityEvidenceReadyPayload;
801
845
  [BusChannels.CompactionBegin]: CompactionPayload;
802
846
  [BusChannels.CompactionEnd]: CompactionPayload;
803
847
  [BusChannels.MiddlewareHookFailed]: MiddlewareHookFailedPayload;
848
+ [BusChannels.ExtensionsReloaded]: ExtensionsReloadedPayload;
804
849
  [BusChannels.ContextActivity]: ContextActivityPayload;
805
850
  [BusChannels.ContextWarning]: ContextWarningPayload;
806
851
  [BusChannels.ContextPruned]: ContextPrunedPayload;
@@ -1486,7 +1486,11 @@ export function validateSettings(raw: unknown): SettingsValidationResult {
1486
1486
  if (!isPlainObject(raw.context)) issues.add("context", `expected a map, got ${describe(raw.context)}`);
1487
1487
  else {
1488
1488
  const context = raw.context;
1489
- issues.unknownKeys("context", context, ["workingSet", "compaction", "memory"]);
1489
+ issues.unknownKeys("context", context, ["toolResultMaxBytes", "workingSet", "compaction", "memory"]);
1490
+ if ("toolResultMaxBytes" in context) {
1491
+ const parsed = expectInteger(issues, "context.toolResultMaxBytes", context.toolResultMaxBytes, { min: 4096 });
1492
+ if (parsed !== undefined) settings.context.toolResultMaxBytes = parsed;
1493
+ }
1490
1494
  if ("workingSet" in context) {
1491
1495
  if (!isPlainObject(context.workingSet))
1492
1496
  issues.add("context.workingSet", `expected a map, got ${describe(context.workingSet)}`);
@@ -412,6 +412,7 @@ export interface MemorySettings {
412
412
  }
413
413
 
414
414
  export interface ContextSettings {
415
+ toolResultMaxBytes: number;
415
416
  workingSet: WorkingSetSettings;
416
417
  compaction: DurableCompactionSettings;
417
418
  memory: MemorySettings;
@@ -447,13 +448,13 @@ export const DEFAULT_SETTINGS = {
447
448
  chat: {
448
449
  target: null as string | null,
449
450
  model: null as string | null,
450
- thinkingLevel: "off" as ThinkingLevel,
451
+ thinkingLevel: "low" as ThinkingLevel,
451
452
  modelPicker: {
452
453
  cycleSet: [] as string[],
453
454
  favorites: [] as string[],
454
455
  recentLimit: 12,
455
456
  } as ModelSelectorSettings,
456
- maxOutputTokens: 32768,
457
+ maxOutputTokens: 0,
457
458
  prewarm: true,
458
459
  retry: {
459
460
  enabled: true,
@@ -491,6 +492,7 @@ export const DEFAULT_SETTINGS = {
491
492
  history: { maxRuns: GUARDRAIL_DEFAULTS.maxDispatchRuns, journal: true },
492
493
  } as FleetSettings,
493
494
  context: {
495
+ toolResultMaxBytes: 65536,
494
496
  workingSet: DEFAULT_WORKING_SET_SETTINGS,
495
497
  compaction: {
496
498
  auto: true,
@@ -582,12 +584,12 @@ targets: []
582
584
  chat:
583
585
  target: null
584
586
  model: null
585
- thinkingLevel: off
587
+ thinkingLevel: low
586
588
  modelPicker:
587
589
  cycleSet: []
588
590
  favorites: []
589
591
  recentLimit: 12
590
- maxOutputTokens: 32768
592
+ maxOutputTokens: 0
591
593
  prewarm: true
592
594
  retry:
593
595
  enabled: true
@@ -626,6 +628,7 @@ fleet:
626
628
  journal: true
627
629
 
628
630
  context:
631
+ toolResultMaxBytes: 65536
629
632
  workingSet:
630
633
  enabled: true
631
634
  policy: structural-v1
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Shared mapping from a `DispatchFailed` payload's `reason` field to the
3
+ * terminal status it implies. Both the observability projection's run
4
+ * summary (src/domains/observability/projection.ts) and the interactive
5
+ * dispatch board (src/interactive/dispatch-board.ts) derive a run's status
6
+ * from the same DispatchCompleted/DispatchFailed bus events; before this
7
+ * module existed they each carried their own copy of this exact mapping,
8
+ * kept in sync only by a comment asking the next editor to remember to.
9
+ */
10
+ export type DispatchFailureStatus = "dead" | "aborted" | "failed";
11
+
12
+ export function resolveDispatchFailureStatus(reason: unknown): DispatchFailureStatus {
13
+ if (reason === "dead" || reason === "stalled") return "dead";
14
+ if (reason === "interrupted" || reason === "canceled") return "aborted";
15
+ return "failed";
16
+ }