@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
@@ -12,9 +12,10 @@ import {
12
12
  projectWorkingSet,
13
13
  resolveWorkingSetPolicy,
14
14
  selectVisibleEntries
15
- } from "./chunk-6I5ILFOF.js";
15
+ } from "./chunk-M2WXEHER.js";
16
16
  import {
17
17
  assistantSessionPayload,
18
+ attachedToolSchemasFromState,
18
19
  backendCacheVerdict,
19
20
  createAskUserToolPolicy,
20
21
  createPendingSkillToolPolicy,
@@ -31,6 +32,7 @@ import {
31
32
  isEmptyAbortedAssistantMessage,
32
33
  isLengthStopAssistantMessage,
33
34
  isSelfExplainingAbort,
35
+ mainPromptCacheIdentity,
34
36
  notConfiguredNotice,
35
37
  noticeMessage,
36
38
  pendingSkillRequestPreamble,
@@ -45,58 +47,62 @@ import {
45
47
  toolNamesFromAgentState,
46
48
  toolResultSummary,
47
49
  toolSignatureFromState
48
- } from "./chunk-SCYB3HA4.js";
50
+ } from "./chunk-XOXV5GKE.js";
49
51
  import {
50
52
  ToolchainDomainModule
51
53
  } from "./chunk-HRQMFLJP.js";
52
54
  import {
53
55
  ShareDomainModule
54
- } from "./chunk-BTGG6BG2.js";
56
+ } from "./chunk-UH347SHR.js";
55
57
  import {
56
58
  bootstrapInputFromInitOptions,
57
59
  modelBootstrapGenerate,
58
60
  resolveBootstrapRoute
59
- } from "./chunk-FYUN5KZ3.js";
60
- import "./chunk-Y4CAGMM6.js";
61
+ } from "./chunk-DZEK6CJN.js";
62
+ import "./chunk-MNJGS2IN.js";
61
63
  import {
62
64
  SchedulingDomainModule,
63
65
  createPromptsDomainModule,
64
66
  renderAgentCatalogSectionsFromSpecs
65
- } from "./chunk-R32CLGZ6.js";
67
+ } from "./chunk-BO7Y52RY.js";
68
+ import {
69
+ capturedHookSourcesFor
70
+ } from "./chunk-SZAA6XDG.js";
66
71
  import {
67
72
  SafetyDomainModule
68
- } from "./chunk-AKB4GYDL.js";
73
+ } from "./chunk-54ODD65L.js";
69
74
  import {
70
75
  LifecycleDomainModule,
71
76
  describeUpgradeNotice
72
- } from "./chunk-VKFQTNDV.js";
73
- import "./chunk-6HMJX2VU.js";
74
- import "./chunk-OJTRZGR3.js";
77
+ } from "./chunk-F2I26BDK.js";
78
+ import "./chunk-DYHAXKHD.js";
79
+ import "./chunk-QQLGQY2A.js";
75
80
  import {
76
81
  ensureClioState,
77
82
  takeUpgradeNotice
78
- } from "./chunk-QTFGO774.js";
79
- import "./chunk-AP73CFDC.js";
83
+ } from "./chunk-XQRY4DTA.js";
84
+ import "./chunk-3KIPBMUA.js";
80
85
  import {
81
86
  ConfigDomainModule,
82
87
  createConfigDomainModule,
83
88
  loadDomains
84
- } from "./chunk-2NM363SV.js";
89
+ } from "./chunk-CYZW7JHJ.js";
85
90
  import {
86
91
  steerToolSurface
87
- } from "./chunk-UXN6JT4W.js";
92
+ } from "./chunk-W4YEMFBX.js";
88
93
  import {
89
94
  panesToolSurface
90
- } from "./chunk-WR6U3OVP.js";
95
+ } from "./chunk-2X4RYJTJ.js";
91
96
  import {
97
+ describePanesLeftBehind,
92
98
  paneWatchDecision
93
- } from "./chunk-PMZCIOCJ.js";
94
- import "./chunk-J5LZHVIT.js";
99
+ } from "./chunk-3EBYEESD.js";
100
+ import "./chunk-3M6DQK6S.js";
95
101
  import {
96
102
  flushRawStdout,
97
103
  writeRawStdout
98
104
  } from "./chunk-2VTFPG5O.js";
99
- import "./chunk-VKRH2TCS.js";
105
+ import "./chunk-M2DAX4F6.js";
100
106
  import "./chunk-D4CJV46V.js";
101
107
  import {
102
108
  BUILTIN_SLASH_COMMANDS,
@@ -118,37 +124,38 @@ import {
118
124
  workerAskedByModel,
119
125
  workerReceiptSummary,
120
126
  workerTargetLabel
121
- } from "./chunk-J4HBWF6Y.js";
122
- import "./chunk-GIZNH63R.js";
127
+ } from "./chunk-RLYRBIYQ.js";
128
+ import "./chunk-35MSIRKH.js";
123
129
  import {
124
130
  discoverDeclaredChecks
125
- } from "./chunk-N5UK64DP.js";
131
+ } from "./chunk-MCMZMDAC.js";
126
132
  import {
127
133
  buildRecallFields,
128
134
  recallErrorMessage,
129
135
  recallParentTurnId,
130
136
  recallableRefListing,
131
137
  resolveRecall
132
- } from "./chunk-VEGN6WIQ.js";
138
+ } from "./chunk-462T4EGZ.js";
133
139
  import {
134
140
  foldWorkingSet,
135
141
  isTurnStart
136
- } from "./chunk-TZSKNMZG.js";
142
+ } from "./chunk-GTUD2WMY.js";
137
143
  import {
138
144
  compileScoutTransition
139
- } from "./chunk-5YHDIDBP.js";
145
+ } from "./chunk-UH632ZYL.js";
140
146
  import {
141
147
  monitorToolSurface
142
- } from "./chunk-5QIAJV2D.js";
148
+ } from "./chunk-PJX3WQUQ.js";
143
149
  import {
144
150
  ObservabilityDomainModule,
145
151
  readAccountabilitySummary,
146
- recordBackgroundMemoryStep
147
- } from "./chunk-E67WX76H.js";
152
+ recordBackgroundMemoryStep,
153
+ resolveDispatchFailureStatus
154
+ } from "./chunk-HKMD33FO.js";
148
155
  import {
149
156
  appendOutOfTurnUsageRow
150
157
  } from "./chunk-AK5XEFVZ.js";
151
- import "./chunk-ZAZB4JMW.js";
158
+ import "./chunk-VKPAQYEB.js";
152
159
  import {
153
160
  ClioEditor,
154
161
  CombinedAutocompleteProvider,
@@ -221,17 +228,17 @@ import {
221
228
  visibleWidth,
222
229
  wrapTextWithAnsi,
223
230
  writeInputWedgeDump
224
- } from "./chunk-UAPGZHYC.js";
231
+ } from "./chunk-I64IFBLB.js";
225
232
  import {
226
233
  getTerminationCoordinator
227
- } from "./chunk-6FN3E6KX.js";
234
+ } from "./chunk-4O6MANBS.js";
228
235
  import {
229
236
  createContextDomainModule,
230
237
  loadProjectClioMd
231
- } from "./chunk-C537JADH.js";
238
+ } from "./chunk-SSEYRH53.js";
232
239
  import {
233
240
  renderCodewikiDigest
234
- } from "./chunk-3QSOM6PA.js";
241
+ } from "./chunk-AZ4WMN4W.js";
235
242
  import {
236
243
  buildMemoryPromptSection,
237
244
  canonicalMemoryRepositoryIdentity,
@@ -247,7 +254,7 @@ import {
247
254
  taskMemoryBankSize,
248
255
  taskMemoryHandoffSeedOffer,
249
256
  taskMemoryTracePath
250
- } from "./chunk-74YWRRU5.js";
257
+ } from "./chunk-JBCS7CRR.js";
251
258
  import "./chunk-LCGCVYZ4.js";
252
259
  import {
253
260
  listWikiPages,
@@ -285,11 +292,11 @@ import {
285
292
  protectedResidencyModels,
286
293
  renderCostAggregate,
287
294
  renderDispatchReviewerTask
288
- } from "./chunk-XKA2ICR3.js";
295
+ } from "./chunk-I66ZTYNP.js";
289
296
  import {
290
297
  readGateDecisionArtifacts,
291
298
  readPendingGateDecisions
292
- } from "./chunk-GPPB3JBE.js";
299
+ } from "./chunk-ZGNYYXQ6.js";
293
300
  import {
294
301
  TRUST_STATUS_AXES,
295
302
  formatTrustSummaryLine,
@@ -300,7 +307,7 @@ import {
300
307
  summarizeTrustStatus,
301
308
  trustStateWord,
302
309
  verifyReceiptIntegrity
303
- } from "./chunk-6NJQITNH.js";
310
+ } from "./chunk-B74PXLU7.js";
304
311
  import {
305
312
  SessionDomainModule,
306
313
  addResponseModelIdObservationCount,
@@ -314,19 +321,20 @@ import {
314
321
  readAuditRows,
315
322
  responseModelIdObservationCountsLabel,
316
323
  responseModelIdObservationFromRecord
317
- } from "./chunk-TVH4ONAM.js";
324
+ } from "./chunk-X7IARSHT.js";
325
+ import "./chunk-KPXDY6QF.js";
318
326
  import {
319
327
  describeWriteBoundaryAttributionDowngrade,
320
328
  gitCheckoutRoot,
321
329
  isGitRepository,
322
330
  preflightWriteBoundaries,
323
331
  recoverCleanupReadyCompeteGroups
324
- } from "./chunk-TD3PGPQA.js";
332
+ } from "./chunk-W6NIE6OW.js";
325
333
  import {
326
334
  bindExecutionPlanEndpoints,
327
335
  compileFleetExecutionPlan,
328
336
  requireAgentSteps
329
- } from "./chunk-THYWACCR.js";
337
+ } from "./chunk-DZAW46HP.js";
330
338
  import {
331
339
  parseRigorOverride,
332
340
  resolveRigor
@@ -336,16 +344,16 @@ import {
336
344
  hasPromptCacheTelemetry,
337
345
  uncachedPrefillTokens
338
346
  } from "./chunk-3DPEIQKN.js";
339
- import "./chunk-6CCS4G3W.js";
347
+ import "./chunk-5PFYMY2V.js";
340
348
  import {
341
349
  configureRunEventJournal
342
- } from "./chunk-6VC4OV3Z.js";
350
+ } from "./chunk-VIA6RFQZ.js";
343
351
  import "./chunk-T56WDKA5.js";
344
352
  import {
345
353
  filterEntriesToActivePath
346
354
  } from "./chunk-W6GROXXM.js";
347
355
  import "./chunk-JVCV3ICN.js";
348
- import "./chunk-AFKWHWXF.js";
356
+ import "./chunk-4JDLP6ZS.js";
349
357
  import {
350
358
  shellQuote
351
359
  } from "./chunk-TXOTCRLG.js";
@@ -364,11 +372,11 @@ import {
364
372
  libraryEntryRef,
365
373
  libraryInstallPath,
366
374
  planLibraryInstall
367
- } from "./chunk-SINK3QR6.js";
375
+ } from "./chunk-ZNT2M6TG.js";
368
376
  import {
369
377
  AgentsDomainModule
370
- } from "./chunk-MA3H6DM5.js";
371
- import "./chunk-ZJLUDYFY.js";
378
+ } from "./chunk-P75RZCJW.js";
379
+ import "./chunk-CRFOIAX3.js";
372
380
  import "./chunk-DR52UMZW.js";
373
381
  import {
374
382
  MARKETPLACE_UNCONFIGURED,
@@ -376,9 +384,9 @@ import {
376
384
  getMarketplaceSkills,
377
385
  installSkill,
378
386
  modelVisibleSkills
379
- } from "./chunk-HUAS7ITX.js";
387
+ } from "./chunk-O3YUNJZ2.js";
380
388
  import "./chunk-NDDGJUXD.js";
381
- import "./chunk-FEFIFZTL.js";
389
+ import "./chunk-XGDPUNND.js";
382
390
  import {
383
391
  FLEET_COMMANDS_REMEDY,
384
392
  FleetCommandRegistryMissingError,
@@ -388,33 +396,25 @@ import {
388
396
  renderFleetPrompt,
389
397
  validateFleetCommands,
390
398
  validateFleetGraph
391
- } from "./chunk-CTJ4RNAA.js";
399
+ } from "./chunk-3F7VUY77.js";
392
400
  import "./chunk-RKKLTLYB.js";
393
401
  import {
402
+ EXTENSION_SNAPSHOT_DIAGNOSTIC_MESSAGE_CAP,
394
403
  ExtensionsDomainModule
395
- } from "./chunk-SUW5DORT.js";
404
+ } from "./chunk-HLAFFSEK.js";
405
+ import "./chunk-77QIVUZB.js";
396
406
  import {
397
407
  formatBootTrace,
398
408
  traceBoot
399
409
  } from "./chunk-ZTJUVLTU.js";
400
410
  import {
401
- ASK_USER_OTHER_LABEL,
402
411
  INTERACTIVE_LOOP_BLOCK_BUDGET,
403
412
  applyEditsToNormalizedContent,
404
- askAxis,
405
- askUserExposure,
406
413
  assertRegisteredBuiltinTools,
407
- cancelledAskUserResult,
408
- classifyDecisionPresentation,
409
414
  createEngineAgent,
410
415
  createLoopGuardRegistration,
411
416
  createProtectedArtifactsRegistration,
412
- createRegistry,
413
- decisionActionClass,
414
- decisionFactsForAnswer,
415
- decisionFactsForPermission,
416
417
  diffWords,
417
- finalizeAskUserInterviewForHost,
418
418
  generateDiffString,
419
419
  lazyTool,
420
420
  normalizeToLF,
@@ -427,15 +427,13 @@ import {
427
427
  resolveSessionTools,
428
428
  sanitizeLockedSynthesisMessage,
429
429
  stripBom
430
- } from "./chunk-QMXC4JB7.js";
431
- import {
432
- HEADLESS_PERMISSION_DENIED_REASON
433
- } from "./chunk-K7VKOLQQ.js";
430
+ } from "./chunk-2NHR3NAY.js";
434
431
  import {
435
432
  MIDDLEWARE_HOOK_TEXT_MAX_CHARS,
436
433
  MiddlewareDomainModule,
437
434
  WATCHDOG_TASK,
438
435
  announceMemoryStepEndpoint,
436
+ buildUserHookRegistrations,
439
437
  createDetachedDispatchNudgeRegistration,
440
438
  createHookReceiptLog,
441
439
  createMarketplaceOfferRegistration,
@@ -447,34 +445,21 @@ import {
447
445
  createTaskNudgeRegistration,
448
446
  createUnbackedWorkerClaimRegistration,
449
447
  createWatchdogRegistration,
450
- installUserHooks,
448
+ formatRegistrationConflict,
451
449
  openDetachedBatchViews,
452
450
  watchdogBriefing,
453
451
  writeMiddlewareDiagnosticToStderr
454
- } from "./chunk-JA5QWE4Z.js";
452
+ } from "./chunk-UBRFI4HS.js";
455
453
  import "./chunk-5PSMVOLM.js";
456
- import "./chunk-UOV2BYIW.js";
457
454
  import {
458
455
  resolveFdBinary
459
456
  } from "./chunk-BMS5RKQY.js";
460
457
  import "./chunk-QSNYB6ZV.js";
461
458
  import "./chunk-QDC3K2U3.js";
462
- import "./chunk-YPI3QQCF.js";
463
- import "./chunk-7OBGU7UB.js";
464
- import "./chunk-ABLSQ6JX.js";
459
+ import "./chunk-MCEPRMZW.js";
460
+ import "./chunk-7BHIY2MW.js";
461
+ import "./chunk-LJID3DYZ.js";
465
462
  import "./chunk-PBP4B7XR.js";
466
- import {
467
- DISPATCH_PLAN_PREPARATION_ERROR_ARGUMENT,
468
- RESOLVED_DISPATCH_PLAN_ARGUMENT,
469
- describeDispatchPlan,
470
- dispatchRequestsFromArgs,
471
- maxOutputBytesArg,
472
- prepareDispatchArguments,
473
- resolvedDispatchPlanFromArgs,
474
- stringArg,
475
- timeoutMsArg,
476
- withResolvedDispatchPlan
477
- } from "./chunk-JZWT5J3Y.js";
478
463
  import {
479
464
  TaskMemoryBank,
480
465
  createTaskMemoryTelemetrySink
@@ -483,50 +468,72 @@ import {
483
468
  escapeRegExp
484
469
  } from "./chunk-VG7TBQIY.js";
485
470
  import {
471
+ ASK_USER_OTHER_LABEL,
486
472
  COUNCIL_JUDGE_PROMPT,
487
473
  COUNCIL_MAX_MEMBERS,
488
474
  COUNCIL_MIN_MEMBERS,
489
475
  DISPATCH_BRIEFING_MAX_BYTES,
476
+ DISPATCH_PLAN_PREPARATION_ERROR_ARGUMENT,
477
+ HEADLESS_PERMISSION_DENIED_REASON,
490
478
  JUDGE_GATE_PROMPT,
479
+ RESOLVED_DISPATCH_PLAN_ARGUMENT,
491
480
  REVIEWER_GATE_PROMPT,
492
481
  approvedRouteCandidates,
482
+ askAxis,
483
+ askUserExposure,
493
484
  builtin,
485
+ cancelledAskUserResult,
486
+ classifyDecisionPresentation,
494
487
  classifyResourceRead,
495
488
  cloneRunToolBudgetEnvelope,
489
+ createRegistry,
490
+ decisionActionClass,
491
+ decisionFactsForAnswer,
492
+ decisionFactsForPermission,
493
+ describeDispatchPlan,
494
+ dispatchRequestsFromArgs,
495
+ finalizeAskUserInterviewForHost,
496
496
  formatBudgetPolicy,
497
497
  formatBudgetReasons,
498
498
  formatBudgetRequest,
499
499
  formatEffectiveBudget,
500
500
  isResponseSchemaRejection,
501
+ maxOutputBytesArg,
501
502
  narrowDispatchIntentToReadOnly,
502
503
  normalizeDispatchIntent,
504
+ prepareDispatchArguments,
503
505
  renderCouncilVoteMemberTask,
506
+ resolveToolPromptHint,
507
+ resolvedDispatchPlanFromArgs,
504
508
  responseSchemaDialectFor,
505
509
  runKindSupportsLiveSteering,
506
- toolPresentationPolicy
507
- } from "./chunk-2VG7KLYV.js";
510
+ stringArg,
511
+ timeoutMsArg,
512
+ toolPresentationPolicy,
513
+ withResolvedDispatchPlan
514
+ } from "./chunk-IKSLQ4XV.js";
508
515
  import {
509
516
  defaultRoutingIntent,
510
517
  sameRouteIdentity
511
- } from "./chunk-7EPLI7VL.js";
518
+ } from "./chunk-HIICAHCJ.js";
512
519
  import {
513
520
  createTaskBoardStore,
514
521
  foldSessionTaskHistory,
515
522
  foldTaskBoard,
516
523
  taskBoardCounts
517
- } from "./chunk-6DWBAZ5U.js";
524
+ } from "./chunk-Q4XWMHX6.js";
518
525
  import {
519
526
  DEFAULT_RECENT_ENTRY_LIMIT,
520
527
  assessFinishContract
521
- } from "./chunk-PVAMAVBB.js";
522
- import "./chunk-IXJT6DCX.js";
528
+ } from "./chunk-IDNA72AH.js";
529
+ import "./chunk-FVDGR2ZL.js";
523
530
  import {
524
531
  describeCallTarget,
525
532
  redactSecretString,
526
533
  redactToolArgs,
527
534
  sanitizeCallTargetText,
528
535
  sanitizeMultilineDisplayText
529
- } from "./chunk-TVHHYFHE.js";
536
+ } from "./chunk-NEDJ26B5.js";
530
537
  import {
531
538
  TOOL_PROFILE_NAMES
532
539
  } from "./chunk-42FMPA75.js";
@@ -550,7 +557,7 @@ import {
550
557
  sweepExpiredToolOffloads,
551
558
  toolResultPresentationPolicy,
552
559
  toolResultPresentationText
553
- } from "./chunk-R23Z6K6I.js";
560
+ } from "./chunk-B7HM5Z7T.js";
554
561
  import {
555
562
  formatSize
556
563
  } from "./chunk-OZNBF4L3.js";
@@ -559,7 +566,7 @@ import "./chunk-6XLNIQDB.js";
559
566
  import {
560
567
  combineBashOutput,
561
568
  runBashCommand
562
- } from "./chunk-U2WB7TZS.js";
569
+ } from "./chunk-NMJXSHBJ.js";
563
570
  import "./chunk-VAVR4IJY.js";
564
571
  import "./chunk-2LEAKD4C.js";
565
572
  import "./chunk-HHV2GANA.js";
@@ -568,11 +575,11 @@ import {
568
575
  parseScoutResult,
569
576
  parseVerifierResult,
570
577
  resultContractSourceId
571
- } from "./chunk-IG7BCQBA.js";
578
+ } from "./chunk-PGF63K6I.js";
572
579
  import {
573
580
  CLIO_PROJECT_DIR,
574
581
  toolMutationPaths
575
- } from "./chunk-GCSMB2KY.js";
582
+ } from "./chunk-IKOZFYBN.js";
576
583
  import {
577
584
  VERIFICATION_SCRIPT_FAMILY_HINT
578
585
  } from "./chunk-UL3WSD3F.js";
@@ -606,14 +613,13 @@ import {
606
613
  InteropDomainModule,
607
614
  delegationEntryForKind,
608
615
  renderProposalEntry
609
- } from "./chunk-BDPT6GTK.js";
610
- import "./chunk-7PWAODYW.js";
616
+ } from "./chunk-JWJGP5DQ.js";
617
+ import "./chunk-I7XBWTYH.js";
611
618
  import {
612
619
  source_default
613
620
  } from "./chunk-5TSRNF4G.js";
614
621
  import {
615
622
  ProvidersDomainModule,
616
- VALID_THINKING_LEVELS,
617
623
  applyModelCapabilityPatch,
618
624
  canonicalEndpointKey,
619
625
  endpointCapacitiesForStatuses,
@@ -630,6 +636,7 @@ import {
630
636
  refineRuntimeTargetWithModelHints,
631
637
  registerForegroundStream,
632
638
  residencyTargetKey,
639
+ resolveCostProvenance,
633
640
  resolveModelCapabilities,
634
641
  resolveModelRuntimeCapabilitiesForProviders,
635
642
  resolveReservedOutputTokens,
@@ -640,7 +647,7 @@ import {
640
647
  thinkingLevelChoiceLabel,
641
648
  thinkingLevelFromChoiceLabel,
642
649
  withRunOverrides
643
- } from "./chunk-UEDMSP56.js";
650
+ } from "./chunk-BYMNWQ7O.js";
644
651
  import "./chunk-CFGTUFWB.js";
645
652
  import "./chunk-72GZI5EV.js";
646
653
  import {
@@ -675,10 +682,6 @@ import "./chunk-R346GLFC.js";
675
682
  import {
676
683
  getSharedBus
677
684
  } from "./chunk-PMZVFWSR.js";
678
- import {
679
- BusChannels,
680
- isRunAbortedPayload
681
- } from "./chunk-HLW2MRKE.js";
682
685
  import "./chunk-BTK3SSSK.js";
683
686
  import {
684
687
  interopAgentKind
@@ -692,9 +695,13 @@ import {
692
695
  setFleetProfileInSettings,
693
696
  updateSettings,
694
697
  useTargetInSettings
695
- } from "./chunk-EIMVLWB3.js";
698
+ } from "./chunk-34BHNEE3.js";
696
699
  import "./chunk-D7E7WCDF.js";
697
700
  import "./chunk-HJWWJ6IL.js";
701
+ import {
702
+ BusChannels,
703
+ isRunAbortedPayload
704
+ } from "./chunk-F4EKGO4N.js";
698
705
  import {
699
706
  setGitCommitAttributionEnabled
700
707
  } from "./chunk-JIEGK6UF.js";
@@ -708,21 +715,22 @@ import {
708
715
  readPiMonoVersion
709
716
  } from "./chunk-IWHMRKLL.js";
710
717
  import {
718
+ VALID_THINKING_LEVELS,
711
719
  formatContextWindowSlots,
712
720
  registerBuiltinRuntimes
713
- } from "./chunk-QKIFBZKT.js";
721
+ } from "./chunk-IMXMHHMQ.js";
714
722
  import {
715
723
  ACTIVE_ROUTING_POSTURES,
716
724
  ACTIVE_ROUTING_ROLES,
717
725
  DEFAULT_DELEGATION_PERMISSION_TIMEOUT_MS,
718
726
  DEFAULT_SETTINGS,
719
727
  THINKING_LEVELS
720
- } from "./chunk-BWW4HLO4.js";
728
+ } from "./chunk-UXCU4E3T.js";
721
729
  import "./chunk-LL4KHSZI.js";
722
730
  import {
723
731
  configureGuardrails,
724
732
  guardrailValuesFromSettings
725
- } from "./chunk-NLFAQR7Z.js";
733
+ } from "./chunk-S66XZJOF.js";
726
734
  import {
727
735
  resolveProviderReference
728
736
  } from "./chunk-CDNVLKUX.js";
@@ -1220,10 +1228,10 @@ function recentModelsPath() {
1220
1228
  }
1221
1229
  var cache = null;
1222
1230
  var cachePath = null;
1223
- function readFromDisk(path) {
1224
- if (!existsSync(path)) return null;
1231
+ function readFromDisk(path2) {
1232
+ if (!existsSync(path2)) return null;
1225
1233
  try {
1226
- const parsed = JSON.parse(readFileSync(path, "utf8"));
1234
+ const parsed = JSON.parse(readFileSync(path2, "utf8"));
1227
1235
  if (!Array.isArray(parsed)) return [];
1228
1236
  const seen = /* @__PURE__ */ new Set();
1229
1237
  const out = [];
@@ -1239,29 +1247,29 @@ function readFromDisk(path) {
1239
1247
  return [];
1240
1248
  }
1241
1249
  }
1242
- function writeToDisk(path, refs) {
1243
- safeResourceWrite(path, `${JSON.stringify(refs, null, " ")}
1250
+ function writeToDisk(path2, refs) {
1251
+ safeResourceWrite(path2, `${JSON.stringify(refs, null, " ")}
1244
1252
  `, { encoding: "utf8" });
1245
1253
  }
1246
1254
  function listRecentModels(options) {
1247
- const path = recentModelsPath();
1248
- if (cache === null || cachePath !== path) {
1249
- cache = readFromDisk(path) ?? [];
1250
- cachePath = path;
1255
+ const path2 = recentModelsPath();
1256
+ if (cache === null || cachePath !== path2) {
1257
+ cache = readFromDisk(path2) ?? [];
1258
+ cachePath = path2;
1251
1259
  }
1252
1260
  const limit = Math.max(1, Math.floor(options?.limit ?? 12));
1253
1261
  return cache.slice(0, limit);
1254
1262
  }
1255
1263
  function rememberRecentModel(ref, limit) {
1256
- const path = recentModelsPath();
1257
- const base = readFromDisk(path) ?? (cachePath === path && cache !== null ? cache : []);
1264
+ const path2 = recentModelsPath();
1265
+ const base = readFromDisk(path2) ?? (cachePath === path2 && cache !== null ? cache : []);
1258
1266
  const max = Math.max(1, Math.floor(limit));
1259
1267
  const next = [ref, ...base.filter((entry) => entry !== ref)].slice(0, max);
1260
1268
  cache = next;
1261
- cachePath = path;
1269
+ cachePath = path2;
1262
1270
  if (stateRootRemoved()) return next;
1263
1271
  try {
1264
- writeToDisk(path, next);
1272
+ writeToDisk(path2, next);
1265
1273
  } catch {
1266
1274
  }
1267
1275
  return next;
@@ -1303,8 +1311,8 @@ function applyRoutingPatch(routing, patch) {
1303
1311
  if (patch.workersDefault) Object.assign(routing.workersDefault, patch.workersDefault);
1304
1312
  if (patch.scope) routing.scope = [...patch.scope];
1305
1313
  }
1306
- function isRoutingPath(path) {
1307
- return ROUTING_PATHS.has(path);
1314
+ function isRoutingPath(path2) {
1315
+ return ROUTING_PATHS.has(path2);
1308
1316
  }
1309
1317
  var ROUTING_PATHS = /* @__PURE__ */ new Set([
1310
1318
  "chat.target",
@@ -1317,16 +1325,16 @@ var ROUTING_PATHS = /* @__PURE__ */ new Set([
1317
1325
  "fleet.default.thinkingLevel",
1318
1326
  "chat.modelPicker.cycleSet"
1319
1327
  ]);
1320
- function getAtPath(source, path) {
1328
+ function getAtPath(source, path2) {
1321
1329
  let cursor = source;
1322
- for (const key of path.split(".")) {
1330
+ for (const key of path2.split(".")) {
1323
1331
  if (cursor === null || typeof cursor !== "object") return void 0;
1324
1332
  cursor = cursor[key];
1325
1333
  }
1326
1334
  return cursor;
1327
1335
  }
1328
- function setAtPath(target, path, value) {
1329
- const keys = path.split(".");
1336
+ function setAtPath(target, path2, value) {
1337
+ const keys = path2.split(".");
1330
1338
  const last = keys.pop();
1331
1339
  if (last === void 0) return;
1332
1340
  let cursor = target;
@@ -1341,7 +1349,7 @@ function setAtPath(target, path, value) {
1341
1349
  function applyOverrides(base, overrides) {
1342
1350
  if (overrides.size === 0) return base;
1343
1351
  const view = structuredClone(base);
1344
- for (const [path, value] of overrides) setAtPath(view, path, value);
1352
+ for (const [path2, value] of overrides) setAtPath(view, path2, value);
1345
1353
  return view;
1346
1354
  }
1347
1355
  function mergeRoutingPatchIntoSettings(settings, patch) {
@@ -1350,8 +1358,8 @@ function mergeRoutingPatchIntoSettings(settings, patch) {
1350
1358
  if (patch.workersDefault) Object.assign(settings.fleet.default, patch.workersDefault);
1351
1359
  if (patch.scope) settings.chat.modelPicker.cycleSet = [...patch.scope];
1352
1360
  }
1353
- function routingPatchForId(path, settings) {
1354
- switch (path) {
1361
+ function routingPatchForId(path2, settings) {
1362
+ switch (path2) {
1355
1363
  case "chat.target":
1356
1364
  return { orchestrator: { target: settings.chat.target, model: settings.chat.model } };
1357
1365
  case "chat.model":
@@ -1432,7 +1440,7 @@ var ROUTING_FIELD_LABELS = [
1432
1440
  function externalRoutingDivergence(changedPaths, saved, effective) {
1433
1441
  const labels = [];
1434
1442
  for (const entry of ROUTING_FIELD_LABELS) {
1435
- const touched = changedPaths.some((path) => path === entry.field || path.startsWith(`${entry.field}.`));
1443
+ const touched = changedPaths.some((path2) => path2 === entry.field || path2.startsWith(`${entry.field}.`));
1436
1444
  if (!touched) continue;
1437
1445
  if (entry.read(saved) !== entry.read(effective)) labels.push(entry.label);
1438
1446
  }
@@ -1450,7 +1458,7 @@ function routingChangeNotices(changedPaths, saved, effective, options) {
1450
1458
  });
1451
1459
  }
1452
1460
  const activeTarget = effective.chat.target;
1453
- const targetsTouched = changedPaths.some((path) => path === "targets" || path.startsWith("targets."));
1461
+ const targetsTouched = changedPaths.some((path2) => path2 === "targets" || path2.startsWith("targets."));
1454
1462
  if (activeTarget && targetsTouched && !saved.targets.some((entry) => entry.id === activeTarget)) {
1455
1463
  const hint = options?.commandHints ? " (/model)" : "";
1456
1464
  notices.push({
@@ -2389,9 +2397,9 @@ function stagePendingProtectedArtifact(sessionId, event) {
2389
2397
  };
2390
2398
  const directory = journalDirectory(sessionId);
2391
2399
  mkdirSync(directory, { recursive: true });
2392
- const path = join2(directory, `${id}.json`);
2393
- atomicWrite(path, JSON.stringify(record2, null, 2));
2394
- return { record: record2, path };
2400
+ const path2 = join2(directory, `${id}.json`);
2401
+ atomicWrite(path2, JSON.stringify(record2, null, 2));
2402
+ return { record: record2, path: path2 };
2395
2403
  }
2396
2404
  function clearPendingProtectedArtifact(handle) {
2397
2405
  rmSync(handle.path, { force: true });
@@ -2402,13 +2410,13 @@ function readPendingProtectedArtifacts(sessionId) {
2402
2410
  const records = [];
2403
2411
  const errors = [];
2404
2412
  for (const name of readdirSync(directory).filter((entry) => entry.endsWith(".json")).sort()) {
2405
- const path = join2(directory, name);
2413
+ const path2 = join2(directory, name);
2406
2414
  try {
2407
- const parsed = parseRecord(JSON.parse(readFileSync2(path, "utf8")), sessionId);
2415
+ const parsed = parseRecord(JSON.parse(readFileSync2(path2, "utf8")), sessionId);
2408
2416
  if (parsed === null) throw new Error("invalid or integrity-mismatched pending protection");
2409
- records.push({ record: parsed, path });
2417
+ records.push({ record: parsed, path: path2 });
2410
2418
  } catch (error) {
2411
- errors.push({ path, message: error instanceof Error ? error.message : String(error) });
2419
+ errors.push({ path: path2, message: error instanceof Error ? error.message : String(error) });
2412
2420
  }
2413
2421
  }
2414
2422
  return { records, errors };
@@ -2478,28 +2486,28 @@ function isUserTask(value) {
2478
2486
  if (!isRecord2(value) || !hasOnlyKeys(value, TASK_KEYS)) return false;
2479
2487
  return typeof value.id === "string" && /^u[1-9]\d*$/.test(value.id) && typeof value.title === "string" && value.title.trim().length > 0 && typeof value.status === "string" && USER_TASK_STATUSES.includes(value.status) && typeof value.createdAt === "string" && typeof value.updatedAt === "string" && isOptionalString(value.note) && isOptionalString(value.handedSessionId) && isOptionalString(value.boardTaskId);
2480
2488
  }
2481
- function parseFile(body, path) {
2489
+ function parseFile(body, path2) {
2482
2490
  let parsed;
2483
2491
  try {
2484
2492
  parsed = JSON.parse(body);
2485
2493
  } catch (error) {
2486
- throw new UserTasksStoreError(`user tasks file is corrupt JSON: ${path}`, { cause: error });
2494
+ throw new UserTasksStoreError(`user tasks file is corrupt JSON: ${path2}`, { cause: error });
2487
2495
  }
2488
2496
  if (!isRecord2(parsed) || !hasOnlyKeys(parsed, FILE_KEYS)) {
2489
- throw new UserTasksStoreError(`user tasks file has an invalid top-level shape: ${path}`);
2497
+ throw new UserTasksStoreError(`user tasks file has an invalid top-level shape: ${path2}`);
2490
2498
  }
2491
2499
  if (parsed.version !== USER_TASKS_FILE_VERSION || !Number.isSafeInteger(parsed.nextId) || parsed.nextId < 1 || !Array.isArray(parsed.tasks) || !parsed.tasks.every(isUserTask)) {
2492
- throw new UserTasksStoreError(`user tasks file failed schema validation: ${path}`);
2500
+ throw new UserTasksStoreError(`user tasks file failed schema validation: ${path2}`);
2493
2501
  }
2494
2502
  const ids = /* @__PURE__ */ new Set();
2495
2503
  let maxId = 0;
2496
2504
  for (const task of parsed.tasks) {
2497
- if (ids.has(task.id)) throw new UserTasksStoreError(`user tasks file contains duplicate id ${task.id}: ${path}`);
2505
+ if (ids.has(task.id)) throw new UserTasksStoreError(`user tasks file contains duplicate id ${task.id}: ${path2}`);
2498
2506
  ids.add(task.id);
2499
2507
  maxId = Math.max(maxId, Number(task.id.slice(1)));
2500
2508
  }
2501
2509
  if (parsed.nextId <= maxId) {
2502
- throw new UserTasksStoreError(`user tasks file nextId would reuse an existing id: ${path}`);
2510
+ throw new UserTasksStoreError(`user tasks file nextId would reuse an existing id: ${path2}`);
2503
2511
  }
2504
2512
  return {
2505
2513
  version: USER_TASKS_FILE_VERSION,
@@ -2514,26 +2522,26 @@ function initialFile() {
2514
2522
  return { version: USER_TASKS_FILE_VERSION, nextId: 1, tasks: [] };
2515
2523
  }
2516
2524
  function createUserTasksStore(deps) {
2517
- const path = join3(deps.cwd, USER_TASKS_RELATIVE_PATH);
2525
+ const path2 = join3(deps.cwd, USER_TASKS_RELATIVE_PATH);
2518
2526
  const exists = deps.exists ?? existsSync3;
2519
2527
  const read = deps.read ?? ((target) => readFileSync3(target, "utf8"));
2520
2528
  const write = deps.write ?? ((target, body) => atomicWrite(target, body));
2521
2529
  const now = () => (deps.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
2522
2530
  const load = () => {
2523
- if (!exists(path)) return initialFile();
2531
+ if (!exists(path2)) return initialFile();
2524
2532
  try {
2525
- return parseFile(read(path), path);
2533
+ return parseFile(read(path2), path2);
2526
2534
  } catch (error) {
2527
2535
  if (error instanceof UserTasksStoreError) throw error;
2528
- throw new UserTasksStoreError(`could not read user tasks file: ${path}`, { cause: error });
2536
+ throw new UserTasksStoreError(`could not read user tasks file: ${path2}`, { cause: error });
2529
2537
  }
2530
2538
  };
2531
2539
  const save = (file) => {
2532
2540
  try {
2533
- write(path, `${JSON.stringify(file, null, 2)}
2541
+ write(path2, `${JSON.stringify(file, null, 2)}
2534
2542
  `);
2535
2543
  } catch (error) {
2536
- throw new UserTasksStoreError(`could not write user tasks file: ${path}`, { cause: error });
2544
+ throw new UserTasksStoreError(`could not write user tasks file: ${path2}`, { cause: error });
2537
2545
  }
2538
2546
  };
2539
2547
  const mutate = (id, allowed, status, sessionId) => {
@@ -2570,7 +2578,7 @@ function createUserTasksStore(deps) {
2570
2578
  return copyTask(updated);
2571
2579
  };
2572
2580
  return {
2573
- path,
2581
+ path: path2,
2574
2582
  snapshot() {
2575
2583
  return load().tasks.map(copyTask);
2576
2584
  },
@@ -2732,11 +2740,14 @@ var ACP_FORWARDABLE_EVENT_KINDS = [
2732
2740
  "dispatch.started",
2733
2741
  "dispatch.progress",
2734
2742
  "dispatch.completed",
2735
- "dispatch.failed"
2743
+ "dispatch.failed",
2744
+ "accountability.evidenceReady"
2736
2745
  ];
2737
2746
  var ACP_MAX_REQUESTED_EVENT_KINDS = 16;
2738
2747
  var ACP_MAX_DISPATCH_TASK_PREVIEW_BYTES = 160;
2739
2748
  var ACP_MAX_DISPATCH_ID_BYTES = 128;
2749
+ var ACP_MAX_EVIDENCE_TAGS = 32;
2750
+ var ACP_MAX_EVIDENCE_TAG_BYTES = 64;
2740
2751
  var ACP_MAX_DISPATCH_PROGRESS_EVENTS = 256;
2741
2752
  var ACP_MAX_TRACKED_DISPATCH_RUNS = 512;
2742
2753
  var ACP_MAX_TOOL_CALL_AGENTS = 16;
@@ -2820,15 +2831,15 @@ var PATH_BEARING_TOOLS = /* @__PURE__ */ new Set(["read", "write", "edit", "ls",
2820
2831
  function toolLocations(toolName, args, cwd) {
2821
2832
  if (toolName === void 0 || !PATH_BEARING_TOOLS.has(toolName)) return null;
2822
2833
  if (!isRecord3(args)) return null;
2823
- const path = args.path;
2824
- if (typeof path !== "string" || path.length === 0) return null;
2825
- return [{ path: boundString(resolvePath(cwd, path), ACP_MAX_LOCATION_PATH_BYTES) }];
2834
+ const path2 = args.path;
2835
+ if (typeof path2 !== "string" || path2.length === 0) return null;
2836
+ return [{ path: boundString(resolvePath(cwd, path2), ACP_MAX_LOCATION_PATH_BYTES) }];
2826
2837
  }
2827
2838
  function utf8Bytes(value) {
2828
2839
  return Buffer.byteLength(value, "utf8");
2829
2840
  }
2830
2841
  function emptyUsage() {
2831
- return { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, reasoning: 0 };
2842
+ return { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, reasoning: 0, totalTokens: 0, costUsd: 0 };
2832
2843
  }
2833
2844
  function createActivePromptState() {
2834
2845
  return {
@@ -2855,13 +2866,25 @@ function createActivePromptState() {
2855
2866
  function finite(value) {
2856
2867
  return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
2857
2868
  }
2869
+ function costTotal(usage) {
2870
+ const cost = usage.cost;
2871
+ return isRecord3(cost) ? finite(cost.total) : 0;
2872
+ }
2858
2873
  function mergeUsage(into, usage) {
2859
2874
  if (!isRecord3(usage)) return;
2860
- into.input += finite(usage.input) + finite(usage.inputTokens) + finite(usage.input_tokens) + finite(usage.prompt_tokens);
2861
- into.output += finite(usage.output) + finite(usage.outputTokens) + finite(usage.output_tokens) + finite(usage.completion_tokens);
2862
- into.cacheRead += finite(usage.cacheRead) + finite(usage.cacheReadTokens) + finite(usage.cache_read_tokens);
2863
- into.cacheWrite += finite(usage.cacheWrite) + finite(usage.cacheWriteTokens) + finite(usage.cache_write_tokens);
2864
- into.reasoning += finite(usage.reasoning) + finite(usage.reasoningTokens) + finite(usage.reasoning_tokens);
2875
+ const input = finite(usage.input) + finite(usage.inputTokens) + finite(usage.input_tokens) + finite(usage.prompt_tokens);
2876
+ const output = finite(usage.output) + finite(usage.outputTokens) + finite(usage.output_tokens) + finite(usage.completion_tokens);
2877
+ const cacheRead = finite(usage.cacheRead) + finite(usage.cacheReadTokens) + finite(usage.cache_read_tokens);
2878
+ const cacheWrite = finite(usage.cacheWrite) + finite(usage.cacheWriteTokens) + finite(usage.cache_write_tokens);
2879
+ const reasoning = finite(usage.reasoning) + finite(usage.reasoningTokens) + finite(usage.reasoning_tokens);
2880
+ into.input += input;
2881
+ into.output += output;
2882
+ into.cacheRead += cacheRead;
2883
+ into.cacheWrite += cacheWrite;
2884
+ into.reasoning += reasoning;
2885
+ const explicitTotal = finite(usage.totalTokens) + finite(usage.total_tokens);
2886
+ into.totalTokens += explicitTotal > 0 ? explicitTotal : input + output + cacheRead + cacheWrite;
2887
+ into.costUsd += costTotal(usage);
2865
2888
  }
2866
2889
  function mergeMessageUsage(into, message, seen) {
2867
2890
  if (!isRecord3(message)) return;
@@ -3787,6 +3810,21 @@ async function serveClioAcpAgent(options) {
3787
3810
  });
3788
3811
  })
3789
3812
  );
3813
+ unsubscribeEvents.push(
3814
+ bus.on(BusChannels.AccountabilityEvidenceReady, (payload) => {
3815
+ const runId = safeStoredIdentifier(payload.runId, ACP_MAX_DISPATCH_ID_BYTES);
3816
+ const evidenceId = safeStoredIdentifier(payload.evidenceId, ACP_MAX_DISPATCH_ID_BYTES);
3817
+ if (runId === null || evidenceId === null) return;
3818
+ const tags = (Array.isArray(payload.tags) ? payload.tags : []).map((tag) => safeStoredIdentifier(tag, ACP_MAX_EVIDENCE_TAG_BYTES)).filter((tag) => tag !== null).slice(0, ACP_MAX_EVIDENCE_TAGS);
3819
+ forwardEvent("accountability.evidenceReady", null, true, {
3820
+ runId,
3821
+ evidenceId,
3822
+ firstPassSuccess: payload.firstPassSuccess === true,
3823
+ findingCount: safeCount(payload.findingCount),
3824
+ tags
3825
+ });
3826
+ })
3827
+ );
3790
3828
  }
3791
3829
  const unsubscribeEventStream = () => {
3792
3830
  for (const unsubscribe of unsubscribeEvents) unsubscribe();
@@ -4420,7 +4458,9 @@ function promptResponse(stopReason, active) {
4420
4458
  output: active.usage.output,
4421
4459
  cacheRead: active.usage.cacheRead,
4422
4460
  cacheWrite: active.usage.cacheWrite,
4423
- reasoning: active.usage.reasoning
4461
+ reasoning: active.usage.reasoning,
4462
+ totalTokens: active.usage.totalTokens,
4463
+ costUsd: active.usage.costUsd
4424
4464
  }
4425
4465
  }
4426
4466
  };
@@ -4688,9 +4728,9 @@ function parseHandoffExtraction(text) {
4688
4728
  const facts = boundList(stringsFrom(parsed.facts), HANDOFF_LIST_BOUNDS.facts, "facts", truncations).map(bound);
4689
4729
  const files = boundList(recordsFrom(parsed.files), HANDOFF_LIST_BOUNDS.files, "files", truncations).flatMap(
4690
4730
  (record2) => {
4691
- const path = requiredField(record2, "path");
4731
+ const path2 = requiredField(record2, "path");
4692
4732
  const why = requiredField(record2, "why");
4693
- return path === null || why === null ? [] : [{ path: bound(path), why: bound(why) }];
4733
+ return path2 === null || why === null ? [] : [{ path: bound(path2), why: bound(why) }];
4694
4734
  }
4695
4735
  );
4696
4736
  const commands = boundList(
@@ -5543,34 +5583,34 @@ function replacementListing(edits) {
5543
5583
  }
5544
5584
  return blocks.join("\n");
5545
5585
  }
5546
- function editPreview(facts, path, edits, read) {
5586
+ function editPreview(facts, path2, edits, read) {
5547
5587
  let current;
5548
5588
  try {
5549
- current = read(resolveToCwd(path));
5589
+ current = read(resolveToCwd(path2));
5550
5590
  } catch (error) {
5551
5591
  const message = sanitizeCallTargetText(error instanceof Error ? error.message : String(error));
5552
5592
  return previewFrom(
5553
5593
  facts,
5554
- `Requested replacements for ${sanitizeCallTargetText(path)} (the file could not be read: ${message})`,
5594
+ `Requested replacements for ${sanitizeCallTargetText(path2)} (the file could not be read: ${message})`,
5555
5595
  replacementListing(edits)
5556
5596
  );
5557
5597
  }
5558
5598
  try {
5559
5599
  const { text } = stripBom(current);
5560
- const applied = applyEditsToNormalizedContent(normalizeToLF(text), edits, path);
5600
+ const applied = applyEditsToNormalizedContent(normalizeToLF(text), edits, path2);
5561
5601
  const diff = generateDiffString(applied.baseContent, applied.newContent);
5562
- return previewFrom(facts, `Effective diff for ${sanitizeCallTargetText(path)}`, diff.diff);
5602
+ return previewFrom(facts, `Effective diff for ${sanitizeCallTargetText(path2)}`, diff.diff);
5563
5603
  } catch (error) {
5564
5604
  const message = sanitizeCallTargetText(error instanceof Error ? error.message : String(error));
5565
5605
  return previewFrom(
5566
5606
  facts,
5567
- `Requested replacements for ${sanitizeCallTargetText(path)} (they do not apply: ${message})`,
5607
+ `Requested replacements for ${sanitizeCallTargetText(path2)} (they do not apply: ${message})`,
5568
5608
  replacementListing(edits)
5569
5609
  );
5570
5610
  }
5571
5611
  }
5572
5612
  function createMutationInspector(tool, args, facts, options = {}) {
5573
- const read = options.readFile ?? ((path) => readFileSync5(path, "utf8"));
5613
+ const read = options.readFile ?? ((path2) => readFileSync5(path2, "utf8"));
5574
5614
  return () => {
5575
5615
  const current = mutationFacts(tool, args);
5576
5616
  if (current === null || current.digest !== facts.digest) {
@@ -5580,17 +5620,17 @@ function createMutationInspector(tool, args, facts, options = {}) {
5580
5620
  `These arguments no longer digest to sha256 ${facts.digest}. Deny this call rather than approving bytes that cannot be shown.`
5581
5621
  );
5582
5622
  }
5583
- const path = typeof args?.path === "string" ? args.path : "";
5623
+ const path2 = typeof args?.path === "string" ? args.path : "";
5584
5624
  if (facts.kind === "write") {
5585
5625
  const content = typeof args?.content === "string" ? args.content : "";
5586
5626
  const bounded = boundedContent(content);
5587
- return previewFrom(facts, `Proposed content for ${sanitizeCallTargetText(path)}`, bounded.text, {
5627
+ return previewFrom(facts, `Proposed content for ${sanitizeCallTargetText(path2)}`, bounded.text, {
5588
5628
  numbered: true,
5589
5629
  ...bounded.withheld > 0 ? { trailer: `\u2026 ${bounded.withheld} more characters not shown (preview capped at ${MUTATION_PREVIEW_MAX_CHARS})` } : {}
5590
5630
  });
5591
5631
  }
5592
5632
  const edits = readEdits(args?.edits) ?? [];
5593
- return editPreview(facts, path, edits, read);
5633
+ return editPreview(facts, path2, edits, read);
5594
5634
  };
5595
5635
  }
5596
5636
  function mutationPreviewWindow(lines, scroll, rows = MUTATION_PREVIEW_VISIBLE_ROWS) {
@@ -7140,9 +7180,9 @@ function isSessionArtifactTool(value) {
7140
7180
  function isSessionArtifactKind(value) {
7141
7181
  return value === "plan" || value === "review" || value === "report";
7142
7182
  }
7143
- function normalizedWorkspacePath(path, workspace) {
7183
+ function normalizedWorkspacePath(path2, workspace) {
7144
7184
  const root = resolve2(workspace);
7145
- const target = isAbsolute3(path) ? resolve2(path) : resolve2(root, path);
7185
+ const target = isAbsolute3(path2) ? resolve2(path2) : resolve2(root, path2);
7146
7186
  const rel = relative2(root, target);
7147
7187
  if (rel === "" || !rel.startsWith("..") && !isAbsolute3(rel)) return target;
7148
7188
  return null;
@@ -7185,8 +7225,8 @@ function foldSessionArtifacts(entries, options = {}) {
7185
7225
  }
7186
7226
  return [...lastByPath.values()].sort((left, right) => right.index - left.index).map(({ index: _index, ...artifact }) => artifact);
7187
7227
  }
7188
- function resolveSessionArtifactPath(path, workspace) {
7189
- return normalizedWorkspacePath(path, workspace);
7228
+ function resolveSessionArtifactPath(path2, workspace) {
7229
+ return normalizedWorkspacePath(path2, workspace);
7190
7230
  }
7191
7231
 
7192
7232
  // src/interactive/footer/widgets.ts
@@ -8293,11 +8333,6 @@ function resolveAgentEndStatus(rawMessages) {
8293
8333
  }
8294
8334
  return null;
8295
8335
  }
8296
- function resolveFailedStatus(reason) {
8297
- if (reason === "dead" || reason === "stalled") return "dead";
8298
- if (reason === "interrupted" || reason === "canceled") return "aborted";
8299
- return "failed";
8300
- }
8301
8336
  function resolveFailureDetail(payload, fallback) {
8302
8337
  const detail = parseOptionalDetail(payload.outcomeDetail);
8303
8338
  if (detail !== null) return detail;
@@ -8529,7 +8564,7 @@ function createDispatchBoardStore(bus, snapshot, readReceipt) {
8529
8564
  entry.durationMs = parseFiniteNumber(payload.durationMs, Math.max(0, rawDurationMs(entry.startedAtMs, now)));
8530
8565
  entry.tokenCount = parseFiniteNumber(payload.tokenCount, entry.tokenCount);
8531
8566
  entry.costUsd = parseFiniteNumber(payload.costUsd, entry.costUsd);
8532
- entry.costProvenance = payload.costProvenance ?? "unknown";
8567
+ entry.costProvenance = resolveCostProvenance(payload.costProvenance, entry.costProvenance ?? "unknown");
8533
8568
  entry.outcomeDetail = null;
8534
8569
  if (payload.hostVerification !== void 0) entry.hostVerification = payload.hostVerification;
8535
8570
  settleFromReceipt(entry);
@@ -8547,7 +8582,7 @@ function createDispatchBoardStore(bus, snapshot, readReceipt) {
8547
8582
  const payload = raw ?? {};
8548
8583
  const runId = parseRunId(payload.runId);
8549
8584
  const previousStatus = runId !== null ? entries.get(runId)?.status : void 0;
8550
- const resolvedStatus = resolveFailedStatus(payload.reason);
8585
+ const resolvedStatus = resolveDispatchFailureStatus(payload.reason);
8551
8586
  const status = previousStatus === "dead" && resolvedStatus === "failed" ? "dead" : resolvedStatus;
8552
8587
  const entry = upsertBase(payload, status, now);
8553
8588
  if (!entry) return;
@@ -8556,7 +8591,7 @@ function createDispatchBoardStore(bus, snapshot, readReceipt) {
8556
8591
  entry.durationMs = parseFiniteNumber(payload.durationMs, Math.max(0, rawDurationMs(entry.startedAtMs, now)));
8557
8592
  entry.tokenCount = parseFiniteNumber(payload.tokenCount, entry.tokenCount);
8558
8593
  entry.costUsd = parseFiniteNumber(payload.costUsd, entry.costUsd);
8559
- entry.costProvenance = payload.costProvenance ?? "unknown";
8594
+ entry.costProvenance = resolveCostProvenance(payload.costProvenance, entry.costProvenance ?? "unknown");
8560
8595
  entry.outcomeDetail = resolveFailureDetail(payload, entry.outcomeDetail);
8561
8596
  if (payload.hostVerification !== void 0) entry.hostVerification = payload.hostVerification;
8562
8597
  settleFromReceipt(entry);
@@ -9784,6 +9819,11 @@ function contextComposition(context) {
9784
9819
  free: window > 0 ? Math.max(0, window - used) : null
9785
9820
  };
9786
9821
  }
9822
+ function compactContextWindowLabel(context, width) {
9823
+ if (width < 72) return null;
9824
+ const window = finiteNonNegative2(context.ledger?.contextWindow ?? context.contextWindow);
9825
+ return window > 0 ? formatFooterTokens(window) : null;
9826
+ }
9787
9827
  function compactSecondaryLine(context, agent, width, theme6 = clioTheme(), status = {
9788
9828
  phase: "idle",
9789
9829
  since: 0,
@@ -9804,6 +9844,8 @@ function compactSecondaryLine(context, agent, width, theme6 = clioTheme(), statu
9804
9844
  } else {
9805
9845
  left = buildSegmentedContextBar(theme6, barCells, context.contextWindow ?? 0, contextBreakdownForBar(context));
9806
9846
  }
9847
+ const windowLabel = compactContextWindowLabel(context, safeWidth);
9848
+ if (windowLabel) left = `${left} ${theme6.fg("dim", "of")} ${theme6.fg("muted", windowLabel)}`;
9807
9849
  const maxRightWidth = Math.max(0, safeWidth - visibleWidth(left) - 1);
9808
9850
  const right = buildMetricStrip(
9809
9851
  theme6,
@@ -10512,9 +10554,9 @@ function readStringField2(record2, key) {
10512
10554
  const value = record2[key];
10513
10555
  return typeof value === "string" && value.length > 0 ? value : null;
10514
10556
  }
10515
- function maybeSizeBytes(path) {
10557
+ function maybeSizeBytes(path2) {
10516
10558
  try {
10517
- const info = statSync(path);
10559
+ const info = statSync(path2);
10518
10560
  return info.isFile() ? info.size : void 0;
10519
10561
  } catch {
10520
10562
  return void 0;
@@ -10524,8 +10566,8 @@ function sessionCurrentPath2(stateDir, meta) {
10524
10566
  if (!meta) return void 0;
10525
10567
  return join5(stateDir, "sessions", meta.cwdHash, meta.id, "current.jsonl");
10526
10568
  }
10527
- function protectedArtifactPath(path) {
10528
- return isAbsolute4(path) ? path : void 0;
10569
+ function protectedArtifactPath(path2) {
10570
+ return isAbsolute4(path2) ? path2 : void 0;
10529
10571
  }
10530
10572
  function receiptFilePath(stateDir, runId) {
10531
10573
  return join5(stateDir, "receipts", `${runId}.json`);
@@ -10791,11 +10833,11 @@ function pushCapped(lines, line, maxLines) {
10791
10833
  lines.push(line);
10792
10834
  return lines.length < maxLines;
10793
10835
  }
10794
- async function readTextFileLinesCapped(path, maxLines = VIEW_ARTIFACT_LINE_CAP) {
10836
+ async function readTextFileLinesCapped(path2, maxLines = VIEW_ARTIFACT_LINE_CAP) {
10795
10837
  const lines = [];
10796
10838
  let pending = "";
10797
10839
  let truncated = false;
10798
- const stream2 = createReadStream(path, { encoding: "utf8", highWaterMark: 64 * 1024 });
10840
+ const stream2 = createReadStream(path2, { encoding: "utf8", highWaterMark: 64 * 1024 });
10799
10841
  outer: for await (const chunk of stream2) {
10800
10842
  pending += chunk;
10801
10843
  for (; ; ) {
@@ -10814,42 +10856,42 @@ async function readTextFileLinesCapped(path, maxLines = VIEW_ARTIFACT_LINE_CAP)
10814
10856
  truncated = true;
10815
10857
  }
10816
10858
  if (truncated) {
10817
- lines.push(`[truncated, open file directly: ${path}]`);
10859
+ lines.push(`[truncated, open file directly: ${path2}]`);
10818
10860
  }
10819
10861
  return { lines, truncated };
10820
10862
  }
10821
- function splitLinesCapped(text, path, maxLines = VIEW_ARTIFACT_LINE_CAP) {
10863
+ function splitLinesCapped(text, path2, maxLines = VIEW_ARTIFACT_LINE_CAP) {
10822
10864
  const lines = text.split(/\r?\n/);
10823
10865
  if (lines.length <= maxLines) return lines;
10824
- return [...lines.slice(0, maxLines), `[truncated, open file directly${path ? `: ${path}` : ""}]`];
10866
+ return [...lines.slice(0, maxLines), `[truncated, open file directly${path2 ? `: ${path2}` : ""}]`];
10825
10867
  }
10826
- async function loadJsonFileLines(path) {
10868
+ async function loadJsonFileLines(path2) {
10827
10869
  let canPrettyPrint = false;
10828
10870
  try {
10829
- const info = await stat(path);
10871
+ const info = await stat(path2);
10830
10872
  canPrettyPrint = info.size <= JSON_PRETTY_MAX_BYTES;
10831
10873
  } catch {
10832
- return { lines: [`unable to read ${path}`], format: "text" };
10874
+ return { lines: [`unable to read ${path2}`], format: "text" };
10833
10875
  }
10834
10876
  if (canPrettyPrint) {
10835
10877
  try {
10836
- const raw = await readFile(path, "utf8");
10878
+ const raw = await readFile(path2, "utf8");
10837
10879
  const pretty = JSON.stringify(JSON.parse(raw), null, 2);
10838
- return { lines: splitLinesCapped(pretty, path), format: "json" };
10880
+ return { lines: splitLinesCapped(pretty, path2), format: "json" };
10839
10881
  } catch {
10840
- return loadTextPath(path);
10882
+ return loadTextPath(path2);
10841
10883
  }
10842
10884
  }
10843
- const { lines } = await readTextFileLinesCapped(path);
10885
+ const { lines } = await readTextFileLinesCapped(path2);
10844
10886
  return { lines, format: "json" };
10845
10887
  }
10846
- async function loadTextPath(path) {
10888
+ async function loadTextPath(path2) {
10847
10889
  try {
10848
- const { lines } = await readTextFileLinesCapped(path);
10890
+ const { lines } = await readTextFileLinesCapped(path2);
10849
10891
  return { lines, format: "text" };
10850
10892
  } catch (err) {
10851
10893
  const message = err instanceof Error ? err.message : String(err);
10852
- return { lines: [`unable to read ${path}: ${message}`], format: "text" };
10894
+ return { lines: [`unable to read ${path2}: ${message}`], format: "text" };
10853
10895
  }
10854
10896
  }
10855
10897
  function evidenceBundlePath(dataDir, evidenceId) {
@@ -10879,7 +10921,7 @@ function evidenceSourceTitle(source) {
10879
10921
  return `eval ${shortValue(source.evalId)}`;
10880
10922
  }
10881
10923
  }
10882
- function renderEvidenceMarkdown(overview, findings, path, loadError) {
10924
+ function renderEvidenceMarkdown(overview, findings, path2, loadError) {
10883
10925
  const lines = [
10884
10926
  "# Evidence Bundle",
10885
10927
  "",
@@ -10934,7 +10976,7 @@ function renderEvidenceMarkdown(overview, findings, path, loadError) {
10934
10976
  lines.push(`- ${finding.severity} ${finding.tag}${run}: ${finding.message}`);
10935
10977
  }
10936
10978
  }
10937
- lines.push("", "## Files", "", `- backing path: ${path ?? "unknown"}`);
10979
+ lines.push("", "## Files", "", `- backing path: ${path2 ?? "unknown"}`);
10938
10980
  if (overview.files.length === 0) {
10939
10981
  lines.push("- files: none");
10940
10982
  } else {
@@ -10961,7 +11003,7 @@ var EvidenceArtifactProvider = class {
10961
11003
  return [];
10962
11004
  }
10963
11005
  return overviews.map((overview) => {
10964
- const path = evidenceBundlePath(dataDir, overview.evidenceId);
11006
+ const path2 = evidenceBundlePath(dataDir, overview.evidenceId);
10965
11007
  const artifact = {
10966
11008
  id: overview.evidenceId,
10967
11009
  category: this.category,
@@ -10987,18 +11029,18 @@ var EvidenceArtifactProvider = class {
10987
11029
  const inspected = await inspectEvidence(dataDir, overview.evidenceId);
10988
11030
  return {
10989
11031
  format: "markdown",
10990
- lines: renderEvidenceMarkdown(inspected.overview, inspected.findings, path)
11032
+ lines: renderEvidenceMarkdown(inspected.overview, inspected.findings, path2)
10991
11033
  };
10992
11034
  } catch (err) {
10993
11035
  const message = err instanceof Error ? err.message : String(err);
10994
11036
  return {
10995
11037
  format: "markdown",
10996
- lines: renderEvidenceMarkdown(overview, [], path, `unable to inspect evidence: ${message}`)
11038
+ lines: renderEvidenceMarkdown(overview, [], path2, `unable to inspect evidence: ${message}`)
10997
11039
  };
10998
11040
  }
10999
11041
  }
11000
11042
  };
11001
- if (path !== void 0) artifact.path = path;
11043
+ if (path2 !== void 0) artifact.path = path2;
11002
11044
  if (overview.runIds.length === 1 && overview.runIds[0] !== void 0) artifact.runId = overview.runIds[0];
11003
11045
  if (overview.sessionId !== null) artifact.sessionId = overview.sessionId;
11004
11046
  return artifact;
@@ -11019,19 +11061,19 @@ var ReceiptArtifactProvider = class {
11019
11061
  return runs.filter(
11020
11062
  (env) => env.receiptPath !== null || maybeSizeBytes(receiptFilePath(this.deps.stateDir, env.id)) !== void 0
11021
11063
  ).map((env) => {
11022
- const path = env.receiptPath ?? receiptFilePath(this.deps.stateDir, env.id);
11064
+ const path2 = env.receiptPath ?? receiptFilePath(this.deps.stateDir, env.id);
11023
11065
  return {
11024
11066
  id: env.id,
11025
11067
  category: this.category,
11026
11068
  title: receiptTitle(env),
11027
11069
  timestamp: parseTime(env.endedAt ?? env.startedAt),
11028
- sizeBytes: maybeSizeBytes(path),
11029
- path,
11070
+ sizeBytes: maybeSizeBytes(path2),
11071
+ path: path2,
11030
11072
  description: env.task,
11031
11073
  runId: env.id,
11032
11074
  ...env.sessionId ? { sessionId: env.sessionId } : {},
11033
11075
  searchText: [env.id, env.agentId, env.task, env.targetId, env.runtimeId, env.runtimeKind, env.cwd],
11034
- load: () => loadJsonFileLines(path),
11076
+ load: () => loadJsonFileLines(path2),
11035
11077
  verify: async () => {
11036
11078
  const result = verifyReceiptFile(this.deps.stateDir, env.id);
11037
11079
  if (!result.ok) {
@@ -11106,14 +11148,14 @@ var DispatchArtifactProvider = class {
11106
11148
  const ledgerPath = runLedgerPath(this.deps.stateDir);
11107
11149
  return runs.map((env) => {
11108
11150
  const receiptPath = env.receiptPath ?? receiptFilePath(this.deps.stateDir, env.id);
11109
- const path = maybeSizeBytes(receiptPath) !== void 0 ? receiptPath : ledgerPath;
11151
+ const path2 = maybeSizeBytes(receiptPath) !== void 0 ? receiptPath : ledgerPath;
11110
11152
  return {
11111
11153
  id: env.id,
11112
11154
  category: this.category,
11113
11155
  title: receiptTitle(env),
11114
11156
  timestamp: parseTime(env.endedAt ?? env.startedAt),
11115
- sizeBytes: maybeSizeBytes(path),
11116
- path,
11157
+ sizeBytes: maybeSizeBytes(path2),
11158
+ path: path2,
11117
11159
  description: env.task,
11118
11160
  runId: env.id,
11119
11161
  ...env.sessionId ? { sessionId: env.sessionId } : {},
@@ -11139,7 +11181,7 @@ var DispatchArtifactProvider = class {
11139
11181
  "agent output:",
11140
11182
  ...text ? text.split(/\r?\n/) : ["(no session dispatch tool output found)"]
11141
11183
  ];
11142
- return { lines: splitLinesCapped(lines.join("\n"), path), format: "text" };
11184
+ return { lines: splitLinesCapped(lines.join("\n"), path2), format: "text" };
11143
11185
  }
11144
11186
  };
11145
11187
  });
@@ -11216,14 +11258,14 @@ var TaskLedgerArtifactProvider = class {
11216
11258
  category = "task-ledger";
11217
11259
  async list() {
11218
11260
  const entries = sessionEntries(this.deps);
11219
- const path = sessionCurrentPath2(this.deps.stateDir, this.deps.sessionMeta);
11261
+ const path2 = sessionCurrentPath2(this.deps.stateDir, this.deps.sessionMeta);
11220
11262
  return entries.filter((entry) => entry.kind === "taskLedger").map((entry) => ({
11221
11263
  id: `task-ledger:${entry.turnId}`,
11222
11264
  category: this.category,
11223
11265
  title: taskLedgerTitle(entry),
11224
11266
  timestamp: parseTime(entry.timestamp),
11225
11267
  sizeBytes: Buffer.byteLength(JSON.stringify(entry), "utf8"),
11226
- ...path ? { path } : {},
11268
+ ...path2 ? { path: path2 } : {},
11227
11269
  searchText: [
11228
11270
  entry.turnId,
11229
11271
  entry.boardId ?? "",
@@ -11259,36 +11301,36 @@ var TaskLedgerArtifactProvider = class {
11259
11301
  }));
11260
11302
  }
11261
11303
  };
11262
- function workspaceArtifactFormat(path) {
11263
- const lower = path.toLowerCase();
11304
+ function workspaceArtifactFormat(path2) {
11305
+ const lower = path2.toLowerCase();
11264
11306
  return lower.endsWith(".md") || lower.endsWith(".markdown") ? "markdown" : "text";
11265
11307
  }
11266
11308
  var WorkspaceArtifactContainmentError = class extends Error {
11267
11309
  };
11268
- async function canonicalWorkspaceArtifactPath(path, workspace) {
11310
+ async function canonicalWorkspaceArtifactPath(path2, workspace) {
11269
11311
  const canonicalWorkspace = await realpath(workspace);
11270
- const canonicalTarget = await realpath(path);
11312
+ const canonicalTarget = await realpath(path2);
11271
11313
  const rel = relative4(canonicalWorkspace, canonicalTarget);
11272
11314
  if (rel === ".." || rel.startsWith(`..${sep}`) || isAbsolute4(rel)) {
11273
11315
  throw new WorkspaceArtifactContainmentError("canonical target is outside the recorded workspace");
11274
11316
  }
11275
11317
  return canonicalTarget;
11276
11318
  }
11277
- async function loadWorkspaceArtifact(path, workspace, recordedAt) {
11319
+ async function loadWorkspaceArtifact(path2, workspace, recordedAt) {
11278
11320
  try {
11279
- const canonicalPath = await canonicalWorkspaceArtifactPath(path, workspace);
11321
+ const canonicalPath = await canonicalWorkspaceArtifactPath(path2, workspace);
11280
11322
  const { lines } = await readTextFileLinesCapped(canonicalPath);
11281
- return { lines, format: workspaceArtifactFormat(path) };
11323
+ return { lines, format: workspaceArtifactFormat(path2) };
11282
11324
  } catch (error) {
11283
11325
  const err = error;
11284
11326
  if (err.code === "ENOENT") {
11285
11327
  return { lines: [`file no longer on disk (recorded at ${recordedAt})`], format: "text" };
11286
11328
  }
11287
11329
  if (error instanceof WorkspaceArtifactContainmentError) {
11288
- return { lines: [`refusing to read ${path}: ${error.message}`], format: "text" };
11330
+ return { lines: [`refusing to read ${path2}: ${error.message}`], format: "text" };
11289
11331
  }
11290
11332
  const message = error instanceof Error ? error.message : String(error);
11291
- return { lines: [`unable to read ${path}: ${message}`], format: "text" };
11333
+ return { lines: [`unable to read ${path2}: ${message}`], format: "text" };
11292
11334
  }
11293
11335
  }
11294
11336
  var WorkspaceArtifactProvider = class {
@@ -11304,31 +11346,31 @@ var WorkspaceArtifactProvider = class {
11304
11346
  const workspace = this.deps.sessionMeta?.cwd;
11305
11347
  if (!workspace) return [];
11306
11348
  return foldSessionArtifacts(this.entries, { workspace }).flatMap((artifact) => {
11307
- const path = resolveSessionArtifactPath(artifact.path, workspace);
11308
- if (path === null) return [];
11349
+ const path2 = resolveSessionArtifactPath(artifact.path, workspace);
11350
+ if (path2 === null) return [];
11309
11351
  const kind = artifact.artifactKind ? ` \xB7 ${artifact.artifactKind}` : "";
11310
11352
  const overwriteLabel = `${artifact.overwrites} overwrite${artifact.overwrites === 1 ? "" : "s"}`;
11311
11353
  return [
11312
11354
  {
11313
- id: `workspace:${path}`,
11355
+ id: `workspace:${path2}`,
11314
11356
  category: this.category,
11315
11357
  title: safeTitle(`${artifact.path} \xB7 ${artifact.tool}${kind}`, artifact.path),
11316
11358
  timestamp: parseTime(artifact.timestamp),
11317
- sizeBytes: maybeSizeBytes(path),
11318
- path,
11359
+ sizeBytes: maybeSizeBytes(path2),
11360
+ path: path2,
11319
11361
  description: `${artifact.tool}${kind} \xB7 ${overwriteLabel}`,
11320
11362
  toolName: artifact.tool,
11321
11363
  searchText: [
11322
11364
  artifact.path,
11323
- path,
11324
- basename(path),
11365
+ path2,
11366
+ basename(path2),
11325
11367
  artifact.tool,
11326
11368
  artifact.artifactKind ?? "",
11327
11369
  overwriteLabel,
11328
11370
  String(artifact.overwrites),
11329
11371
  artifact.turnId
11330
11372
  ].filter(isNonEmptyString),
11331
- load: () => loadWorkspaceArtifact(path, workspace, artifact.timestamp)
11373
+ load: () => loadWorkspaceArtifact(path2, workspace, artifact.timestamp)
11332
11374
  }
11333
11375
  ];
11334
11376
  });
@@ -11354,39 +11396,39 @@ var ToolOutputArtifactProvider = class {
11354
11396
  continue;
11355
11397
  }
11356
11398
  if (entry.kind !== "message" || entry.role !== "tool_result") continue;
11357
- const path = pathFromToolResult(entry);
11358
- if (!path || seen.has(path)) continue;
11359
- seen.add(path);
11360
- out.push(this.toolResultArtifact(entry, path));
11399
+ const path2 = pathFromToolResult(entry);
11400
+ if (!path2 || seen.has(path2)) continue;
11401
+ seen.add(path2);
11402
+ out.push(this.toolResultArtifact(entry, path2));
11361
11403
  }
11362
11404
  return out;
11363
11405
  }
11364
11406
  bashArtifact(entry) {
11365
- const path = resolve3(entry.fullOutputPath ?? "");
11407
+ const path2 = resolve3(entry.fullOutputPath ?? "");
11366
11408
  return {
11367
11409
  id: `bash:${entry.turnId}`,
11368
11410
  category: this.category,
11369
11411
  title: safeTitle(`Bash \xB7 ${entry.command}`, "Bash output"),
11370
11412
  timestamp: parseTime(entry.timestamp),
11371
- sizeBytes: maybeSizeBytes(path),
11372
- path,
11413
+ sizeBytes: maybeSizeBytes(path2),
11414
+ path: path2,
11373
11415
  toolName: "bash",
11374
- searchText: ["bash", entry.turnId, entry.command, path, basename(path)],
11375
- load: () => loadTextPath(path)
11416
+ searchText: ["bash", entry.turnId, entry.command, path2, basename(path2)],
11417
+ load: () => loadTextPath(path2)
11376
11418
  };
11377
11419
  }
11378
- toolResultArtifact(entry, path) {
11420
+ toolResultArtifact(entry, path2) {
11379
11421
  const toolName = toolNameFor(entry);
11380
11422
  const artifact = {
11381
11423
  id: `tool:${entry.turnId}`,
11382
11424
  category: this.category,
11383
- title: safeTitle(`${toolName} \xB7 ${basename(path)}`, `${toolName} output`),
11425
+ title: safeTitle(`${toolName} \xB7 ${basename(path2)}`, `${toolName} output`),
11384
11426
  timestamp: parseTime(entry.timestamp),
11385
- sizeBytes: maybeSizeBytes(path),
11386
- path,
11427
+ sizeBytes: maybeSizeBytes(path2),
11428
+ path: path2,
11387
11429
  toolName,
11388
- searchText: [toolName, entry.turnId, path, basename(path)],
11389
- load: () => loadTextPath(path)
11430
+ searchText: [toolName, entry.turnId, path2, basename(path2)],
11431
+ load: () => loadTextPath(path2)
11390
11432
  };
11391
11433
  const payload = messagePayload(entry);
11392
11434
  const details = payload ? resultDetails(payload.result) : null;
@@ -11426,13 +11468,13 @@ var ProtectedArtifactProvider = class {
11426
11468
  async list() {
11427
11469
  const entries = sessionEntries(this.deps);
11428
11470
  return entries.filter((entry) => entry.kind === "protectedArtifact").map((entry) => {
11429
- const path = protectedArtifactPath(entry.artifact.path);
11471
+ const path2 = protectedArtifactPath(entry.artifact.path);
11430
11472
  const artifact = {
11431
11473
  id: `protected:${entry.turnId}`,
11432
11474
  category: this.category,
11433
11475
  title: protectedArtifactTitle(entry),
11434
11476
  timestamp: parseTime(entry.timestamp),
11435
- sizeBytes: path ? maybeSizeBytes(path) : Buffer.byteLength(JSON.stringify(entry), "utf8"),
11477
+ sizeBytes: path2 ? maybeSizeBytes(path2) : Buffer.byteLength(JSON.stringify(entry), "utf8"),
11436
11478
  description: entry.artifact.reason,
11437
11479
  ...entry.runId ? { runId: entry.runId } : {},
11438
11480
  ...entry.correlationId ? { correlationId: entry.correlationId } : {},
@@ -11454,7 +11496,7 @@ var ProtectedArtifactProvider = class {
11454
11496
  lines: renderProtectedArtifactMarkdown(entry)
11455
11497
  })
11456
11498
  };
11457
- if (path !== void 0) artifact.path = path;
11499
+ if (path2 !== void 0) artifact.path = path2;
11458
11500
  return artifact;
11459
11501
  });
11460
11502
  }
@@ -11467,14 +11509,14 @@ var CompactionArtifactProvider = class {
11467
11509
  category = "compaction";
11468
11510
  async list() {
11469
11511
  const entries = sessionEntries(this.deps);
11470
- const path = sessionCurrentPath2(this.deps.stateDir, this.deps.sessionMeta);
11512
+ const path2 = sessionCurrentPath2(this.deps.stateDir, this.deps.sessionMeta);
11471
11513
  return entries.filter((entry) => entry.kind === "compactionSummary").map((entry) => ({
11472
11514
  id: `compaction:${entry.turnId}`,
11473
11515
  category: this.category,
11474
11516
  title: safeTitle(`Compaction \xB7 ${entry.trigger ?? "summary"}`, "Compaction summary"),
11475
11517
  timestamp: parseTime(entry.timestamp),
11476
11518
  sizeBytes: Buffer.byteLength(entry.summary, "utf8"),
11477
- ...path ? { path } : {},
11519
+ ...path2 ? { path: path2 } : {},
11478
11520
  load: async () => ({
11479
11521
  format: "markdown",
11480
11522
  lines: [
@@ -11513,7 +11555,7 @@ var PromptManifestArtifactProvider = class {
11513
11555
  async list() {
11514
11556
  const meta = this.deps.sessionMeta;
11515
11557
  if (!meta) return [];
11516
- const path = getPromptManifestFilePath(meta, this.deps.stateDir);
11558
+ const path2 = getPromptManifestFilePath(meta, this.deps.stateDir);
11517
11559
  const read = readPromptCompileManifest(meta, this.deps.stateDir);
11518
11560
  const artifacts = read.records.map(
11519
11561
  (record2, index) => ({
@@ -11522,13 +11564,13 @@ var PromptManifestArtifactProvider = class {
11522
11564
  title: `Prompt compile \xB7 ${shortValue(record2.systemPromptHash)} \xB7 ${formatFooterTokens(record2.tokenEstimate)}`,
11523
11565
  timestamp: parseTime(record2.at),
11524
11566
  sizeBytes: Buffer.byteLength(JSON.stringify(record2), "utf8"),
11525
- path,
11567
+ path: path2,
11526
11568
  sessionId: meta.id,
11527
11569
  description: `thinking ${record2.thinkingLevel ?? "off"} \xB7 ${record2.sections.length} sections \xB7 ${record2.fragments.length} fragments`,
11528
11570
  searchText: promptManifestSearchText(record2),
11529
11571
  load: async () => ({
11530
11572
  format: "json",
11531
- lines: splitLinesCapped(JSON.stringify(record2, null, 2), path)
11573
+ lines: splitLinesCapped(JSON.stringify(record2, null, 2), path2)
11532
11574
  })
11533
11575
  })
11534
11576
  );
@@ -11540,7 +11582,7 @@ var PromptManifestArtifactProvider = class {
11540
11582
  category: this.category,
11541
11583
  title: `Prompt manifest \xB7 ${read.errors.length} read error${read.errors.length === 1 ? "" : "s"}`,
11542
11584
  timestamp: Date.now(),
11543
- path,
11585
+ path: path2,
11544
11586
  sessionId: meta.id,
11545
11587
  load: async () => ({
11546
11588
  format: "markdown",
@@ -11645,13 +11687,13 @@ function auditRowPayload(row2) {
11645
11687
  }
11646
11688
  function auditReadErrorsArtifact(stateDir, errors) {
11647
11689
  if (errors.length === 0) return null;
11648
- const path = join5(stateDir, "audit");
11690
+ const path2 = join5(stateDir, "audit");
11649
11691
  return {
11650
11692
  id: "audit:read-errors",
11651
11693
  category: "audit",
11652
11694
  title: `Audit \xB7 ${errors.length} read error${errors.length === 1 ? "" : "s"}`,
11653
11695
  timestamp: Date.now(),
11654
- path,
11696
+ path: path2,
11655
11697
  load: async () => ({
11656
11698
  format: "markdown",
11657
11699
  lines: ["# Audit Read Errors", "", ...errors.map((error) => `- ${error}`)]
@@ -11673,7 +11715,7 @@ var SafetyAuditArtifactProvider = class {
11673
11715
  }
11674
11716
  const selected = [...currentSessionAuditRows(read.rows, this.deps.sessionMeta?.id)].sort(compareAuditRowsNewestFirst).slice(0, SAFETY_AUDIT_ARTIFACT_LIMIT);
11675
11717
  const artifacts = selected.map((row2) => {
11676
- const path = join5(this.deps.stateDir, "audit", row2.file);
11718
+ const path2 = join5(this.deps.stateDir, "audit", row2.file);
11677
11719
  const runId = readStringField2(row2.row, "runId");
11678
11720
  const sessionId = readStringField2(row2.row, "sessionId");
11679
11721
  const correlationId = readStringField2(row2.row, "correlationId") ?? row2.correlationId;
@@ -11688,8 +11730,8 @@ var SafetyAuditArtifactProvider = class {
11688
11730
  category: this.category,
11689
11731
  title: auditRowTitle(row2),
11690
11732
  timestamp: parseTime(row2.ts),
11691
- sizeBytes: maybeSizeBytes(path),
11692
- path,
11733
+ sizeBytes: maybeSizeBytes(path2),
11734
+ path: path2,
11693
11735
  ...runId ? { runId } : {},
11694
11736
  ...sessionId ? { sessionId } : {},
11695
11737
  ...correlationId ? { correlationId } : {},
@@ -11711,7 +11753,7 @@ var SafetyAuditArtifactProvider = class {
11711
11753
  ].filter(isNonEmptyString),
11712
11754
  load: async () => ({
11713
11755
  format: "json",
11714
- lines: splitLinesCapped(JSON.stringify(auditRowPayload(row2), null, 2), path)
11756
+ lines: splitLinesCapped(JSON.stringify(auditRowPayload(row2), null, 2), path2)
11715
11757
  })
11716
11758
  };
11717
11759
  });
@@ -11840,10 +11882,10 @@ function readWorkerReceiptFacts(runId, stateDir = clioStateDir()) {
11840
11882
  return readReceiptFileFacts(runId, stateDir);
11841
11883
  }
11842
11884
  function findRunRow(runId, stateDir) {
11843
- const path = join6(stateDir, "runs.json");
11844
- if (!existsSync5(path)) return null;
11885
+ const path2 = join6(stateDir, "runs.json");
11886
+ if (!existsSync5(path2)) return null;
11845
11887
  try {
11846
- const parsed = JSON.parse(readFileSync7(path, "utf8"));
11888
+ const parsed = JSON.parse(readFileSync7(path2, "utf8"));
11847
11889
  if (!Array.isArray(parsed)) return null;
11848
11890
  for (const entry of parsed) {
11849
11891
  if (isRecord9(entry) && entry.id === runId) return entry;
@@ -12178,9 +12220,9 @@ function richMessageFromEntry(entry, maxTextChars) {
12178
12220
  timestamp: timestampMillis(entry.timestamp)
12179
12221
  };
12180
12222
  if (entry.role === "assistant") {
12181
- const failure = messageFailure(entry);
12182
- message.stopReason = failure?.stopReason ?? stopReason ?? "stop";
12183
- if (failure) message.errorMessage = failure.errorMessage;
12223
+ const failure2 = messageFailure(entry);
12224
+ message.stopReason = failure2?.stopReason ?? stopReason ?? "stop";
12225
+ if (failure2) message.errorMessage = failure2.errorMessage;
12184
12226
  for (const key of [
12185
12227
  "usage",
12186
12228
  "api",
@@ -12197,15 +12239,50 @@ function richMessageFromEntry(entry, maxTextChars) {
12197
12239
  }
12198
12240
  return message;
12199
12241
  }
12200
- function recordToolCallsFromMessage(message, seen) {
12242
+ function toolCallIdsFromMessage(message) {
12201
12243
  const content = message.content;
12202
- if (!Array.isArray(content)) return;
12244
+ if (!Array.isArray(content)) return [];
12245
+ const ids = [];
12203
12246
  for (const block of content) {
12204
12247
  if (!block || typeof block !== "object") continue;
12205
12248
  const b = block;
12206
12249
  if (b.type !== "toolCall") continue;
12207
- if (typeof b.id === "string" && b.id.length > 0) seen.add(b.id);
12250
+ if (typeof b.id === "string" && b.id.length > 0) ids.push(b.id);
12208
12251
  }
12252
+ return ids;
12253
+ }
12254
+ function recordToolCallsFromMessage(message, seen) {
12255
+ for (const id of toolCallIdsFromMessage(message)) seen.add(id);
12256
+ }
12257
+ function createOrderedReplaySink() {
12258
+ const messages = [];
12259
+ let callOrder = [];
12260
+ let staged = [];
12261
+ const rank = (message) => {
12262
+ const id = message.toolCallId;
12263
+ const index = typeof id === "string" ? callOrder.indexOf(id) : -1;
12264
+ return index < 0 ? Number.MAX_SAFE_INTEGER : index;
12265
+ };
12266
+ const flush = () => {
12267
+ if (staged.length === 0) return;
12268
+ staged.sort((a, b) => rank(a) - rank(b));
12269
+ messages.push(...staged);
12270
+ staged = [];
12271
+ callOrder = [];
12272
+ };
12273
+ return {
12274
+ messages,
12275
+ flush,
12276
+ push(message) {
12277
+ flush();
12278
+ messages.push(message);
12279
+ if (message.role === "assistant") callOrder.push(...toolCallIdsFromMessage(message));
12280
+ else callOrder = [];
12281
+ },
12282
+ stageToolResult(message) {
12283
+ staged.push(message);
12284
+ }
12285
+ };
12209
12286
  }
12210
12287
  function toolCallMessageFromEntry(entry) {
12211
12288
  const call = extractToolCall(entry);
@@ -12573,7 +12650,7 @@ function skillActivationContextText(entry) {
12573
12650
  return `Active skill loaded: ${activation.name} source=${activation.source} hash=${activation.hash} path=${activation.filePath} triggeredBy=${activation.triggeredBy}${turn}. Continue honoring this skill unless the user changes direction.`;
12574
12651
  }
12575
12652
  function buildReplayAgentMessagesFromTurns(turns, options = {}) {
12576
- const out = [];
12653
+ const out = createOrderedReplaySink();
12577
12654
  const seenToolCalls = /* @__PURE__ */ new Set();
12578
12655
  for (const entry of selectReplayEntries(turns, options)) {
12579
12656
  switch (entry.kind) {
@@ -12594,7 +12671,7 @@ function buildReplayAgentMessagesFromTurns(turns, options = {}) {
12594
12671
  recordToolCallsFromMessage(message, seenToolCalls);
12595
12672
  }
12596
12673
  } else if (entry.role === "tool_result") {
12597
- out.push(toolResultMessageFromEntry(entry));
12674
+ out.stageToolResult(toolResultMessageFromEntry(entry));
12598
12675
  } else if (entry.role === "system") {
12599
12676
  appendContextMessage(out, "user", `System note: ${text}`, entry.timestamp);
12600
12677
  }
@@ -12641,7 +12718,8 @@ function buildReplayAgentMessagesFromTurns(turns, options = {}) {
12641
12718
  break;
12642
12719
  }
12643
12720
  }
12644
- return out;
12721
+ out.flush();
12722
+ return out.messages;
12645
12723
  }
12646
12724
  function rehydrateChatPanelFromTurns(chatPanel, turns, options = {}) {
12647
12725
  const pendingToolIds = [];
@@ -12664,13 +12742,13 @@ function rehydrateChatPanelFromTurns(chatPanel, turns, options = {}) {
12664
12742
  }
12665
12743
  if (entry.role === "assistant") {
12666
12744
  const text = chatMessageText(entry);
12667
- const failure = messageFailure(entry);
12745
+ const failure2 = messageFailure(entry);
12668
12746
  const richMessage = richMessageFromEntry(entry, MAX_REPLAY_TEXT_CHARS);
12669
- if (richMessage || text.length > 0 || failure) {
12747
+ if (richMessage || text.length > 0 || failure2) {
12670
12748
  const message = richMessage ?? makeTextMessage("assistant", truncateReplayText(text), entry.timestamp);
12671
- if (failure) {
12672
- message.stopReason = failure.stopReason;
12673
- message.errorMessage = failure.errorMessage;
12749
+ if (failure2) {
12750
+ message.stopReason = failure2.stopReason;
12751
+ message.errorMessage = failure2.errorMessage;
12674
12752
  }
12675
12753
  chatPanel.applyEvent({ type: "message_end", message });
12676
12754
  runAssistantMessages.push(message);
@@ -13391,8 +13469,8 @@ function createTurnContext(deps) {
13391
13469
  },
13392
13470
  /**
13393
13471
  * Ensure the session system prompt is compiled and applied to the live
13394
- * agent. Compiles only when the compile key (target, model, safety
13395
- * level, session id) changes or a config hot-reload invalidated the
13472
+ * agent. Compiles only when the canonical live-input identity changes
13473
+ * or a config hot-reload invalidated compiler-owned inputs in the
13396
13474
  * cache; every other submit reuses the cached prompt byte-for-byte. A
13397
13475
  * compile whose text differs from the previous prompt queues a
13398
13476
  * "promptRecompiled" ledger entry (written once the session exists).
@@ -13402,21 +13480,17 @@ function createTurnContext(deps) {
13402
13480
  const settings = deps.getSettings();
13403
13481
  const autonomy = settings.safety.autonomy ?? "auto-edit";
13404
13482
  const sessionId = deps.session?.current()?.id ?? "";
13405
- const workingContextKey = [...sessionWorkingContextPaths].sort().join("\0");
13406
- const key = `${agentRuntime.targetId}|${agentRuntime.wireModelId}|${autonomy}|${sessionId}|${workingContextKey}`;
13407
- if (sessionPrompt && sessionPromptKey === key) {
13408
- lastSystemPromptReused = true;
13409
- return sessionPrompt;
13410
- }
13483
+ const cwd = process.cwd();
13411
13484
  const modelState = agentRuntime.agent.state.model;
13412
13485
  const windowDetails = agentRuntime.runtimeResolution.contextWindowDetails;
13413
13486
  const resolvedWindow = windowDetails.effectiveContextWindow;
13414
13487
  const contextWindow = typeof resolvedWindow === "number" && resolvedWindow > 0 ? resolvedWindow : null;
13415
13488
  const contextWindowSource = contextWindow === null ? null : windowDetails.contextWindowSource;
13416
- const guidance = modelState?.clio?.quirks?.thinking?.guidance;
13489
+ const guidance = modelState?.clioCoder?.quirks?.thinking?.guidance;
13417
13490
  const toolNames = toolNamesFromAgentState(agentRuntime.agent.state.tools);
13491
+ const attachedToolSchemas = attachedToolSchemasFromState(agentRuntime.agent.state.tools);
13418
13492
  const toolPromptHints = toolNames.flatMap((name) => {
13419
- const hint = deps.toolRegistry?.get(name)?.metadata?.promptHint;
13493
+ const hint = resolveToolPromptHint(deps.toolRegistry?.get(name)?.metadata?.promptHint, "session");
13420
13494
  return hint ? [{ tool: name, hint }] : [];
13421
13495
  });
13422
13496
  const sessionInputs = {
@@ -13438,11 +13512,29 @@ function createTurnContext(deps) {
13438
13512
  );
13439
13513
  }
13440
13514
  }
13515
+ const key = mainPromptCacheIdentity({
13516
+ targetId: agentRuntime.targetId,
13517
+ runtimeId: agentRuntime.runtimeId,
13518
+ wireModelId: agentRuntime.wireModelId,
13519
+ autonomy,
13520
+ sessionId,
13521
+ cwd,
13522
+ workingContextPaths: [...sessionWorkingContextPaths],
13523
+ contextWindowSource,
13524
+ promptInputEpoch: deps.prompts.inputEpoch(),
13525
+ sessionInputs,
13526
+ attachedToolSchemas
13527
+ });
13528
+ if (sessionPrompt && sessionPromptKey === key) {
13529
+ lastSystemPromptReused = true;
13530
+ return sessionPrompt;
13531
+ }
13441
13532
  try {
13442
13533
  const result = await deps.prompts.compileSessionPrompt({
13534
+ sessionId,
13443
13535
  sessionInputs,
13444
13536
  autonomy,
13445
- cwd: process.cwd(),
13537
+ cwd,
13446
13538
  workingContextPaths: [...sessionWorkingContextPaths]
13447
13539
  });
13448
13540
  const previousHash = sessionPromptHash ?? lastRecordedPromptHash();
@@ -13513,7 +13605,7 @@ function createTurnContext(deps) {
13513
13605
  sessionPromptKey = null;
13514
13606
  },
13515
13607
  addWorkingContextPaths(paths) {
13516
- for (const path of paths) sessionWorkingContextPaths.add(path);
13608
+ for (const path2 of paths) sessionWorkingContextPaths.add(path2);
13517
13609
  },
13518
13610
  async postToolContinuationGuard(agentRuntime, signal) {
13519
13611
  if (signal?.aborted || !toolResultTail(agentRuntime)) return void 0;
@@ -13976,8 +14068,8 @@ function createTurnPersistence(deps) {
13976
14068
  const appendAssistantTurn = (message, timing) => {
13977
14069
  if (message?.role !== "assistant") return;
13978
14070
  if (state.activeInterruptReason !== null && isEmptyAbortedAssistantMessage(message)) return;
13979
- const failure = terminalFailureFromAssistantMessage(message);
13980
- const payload = assistantSessionPayload(message, failure);
14071
+ const failure2 = terminalFailureFromAssistantMessage(message);
14072
+ const payload = assistantSessionPayload(message, failure2);
13981
14073
  if (timing) payload.timing = timing;
13982
14074
  const usage = message.usage;
13983
14075
  if (usage && typeof usage === "object") {
@@ -13993,8 +14085,8 @@ function createTurnPersistence(deps) {
13993
14085
  }
13994
14086
  accumulateTraceUsage(message);
13995
14087
  const turnContinues = hasStructuredToolCall(message);
13996
- if (!deps.session || !hasPersistableAssistantContent(payload, failure)) {
13997
- if (!turnContinues) finishTracedTurn(failure ? "fail" : "success", failure?.errorMessage ?? null);
14088
+ if (!deps.session || !hasPersistableAssistantContent(payload, failure2)) {
14089
+ if (!turnContinues) finishTracedTurn(failure2 ? "fail" : "success", failure2?.errorMessage ?? null);
13998
14090
  return;
13999
14091
  }
14000
14092
  if (message && typeof message === "object") persistedAssistantMessages.add(message);
@@ -14014,7 +14106,7 @@ function createTurnPersistence(deps) {
14014
14106
  },
14015
14107
  tokens: traceUsage?.totalTokens ?? null
14016
14108
  });
14017
- if (!turnContinues) finishTracedTurn(failure ? "fail" : "success", failure?.errorMessage ?? null);
14109
+ if (!turnContinues) finishTracedTurn(failure2 ? "fail" : "success", failure2?.errorMessage ?? null);
14018
14110
  };
14019
14111
  return {
14020
14112
  wasPersisted(message) {
@@ -14549,20 +14641,20 @@ function createTurnQueues(deps) {
14549
14641
 
14550
14642
  // src/interactive/turn-recovery.ts
14551
14643
  init_esm_shims();
14552
- function reclassifyStallAbort(state, failure) {
14644
+ function reclassifyStallAbort(state, failure2) {
14553
14645
  const reason = state.streamStallReason;
14554
14646
  state.streamStallReason = null;
14555
- if (reason === null || failure.stopReason !== "aborted" || state.activeInterruptReason !== null) return failure;
14556
- if (failure.message) rewriteStallAbortMessage(state, failure.message, reason);
14557
- return { ...failure, stopReason: "error", errorMessage: reason };
14647
+ if (reason === null || failure2.stopReason !== "aborted" || state.activeInterruptReason !== null) return failure2;
14648
+ if (failure2.message) rewriteStallAbortMessage(state, failure2.message, reason);
14649
+ return { ...failure2, stopReason: "error", errorMessage: reason };
14558
14650
  }
14559
14651
  function rewriteStallAbortMessage(state, message, reason = state.streamStallReason) {
14560
14652
  if (reason === null || state.activeInterruptReason !== null || message.role !== "assistant" || message.stopReason !== "aborted") {
14561
14653
  return false;
14562
14654
  }
14563
- const failure = message;
14564
- failure.stopReason = "error";
14565
- failure.errorMessage = reason;
14655
+ const failure2 = message;
14656
+ failure2.stopReason = "error";
14657
+ failure2.errorMessage = reason;
14566
14658
  return true;
14567
14659
  }
14568
14660
  function createTurnRecovery(deps) {
@@ -14575,8 +14667,8 @@ function createTurnRecovery(deps) {
14575
14667
  if (durable) appendRetryStatusSafe(status);
14576
14668
  deps.emitRetryStatus(status);
14577
14669
  };
14578
- const ensureFailureVisibleAndPersisted = (failure) => {
14579
- const message = failure.message;
14670
+ const ensureFailureVisibleAndPersisted = (failure2) => {
14671
+ const message = failure2.message;
14580
14672
  if (!message || typeof message !== "object" || persistence.wasPersisted(message)) return;
14581
14673
  if (state.activeInterruptReason !== null && isEmptyAbortedAssistantMessage(message)) return;
14582
14674
  persistence.appendAssistantTurn(message);
@@ -14644,16 +14736,16 @@ function createTurnRecovery(deps) {
14644
14736
  const settings = deps.retrySettings();
14645
14737
  if (!settings.enabled || settings.maxRetries <= 0) return false;
14646
14738
  if (initialFailure.stopReason === "aborted" || !isRetryableErrorMessage(initialFailure.errorMessage)) return false;
14647
- let failure = initialFailure;
14739
+ let failure2 = initialFailure;
14648
14740
  for (let attempt = 1; attempt <= settings.maxRetries; attempt += 1) {
14649
- ensureFailureVisibleAndPersisted(failure);
14741
+ ensureFailureVisibleAndPersisted(failure2);
14650
14742
  pruneFailedAssistantFromContext(agentRuntime.agent);
14651
14743
  const scheduled = {
14652
14744
  phase: "scheduled",
14653
14745
  attempt,
14654
14746
  maxAttempts: settings.maxRetries,
14655
- delayMs: computeRetryDelayMs(attempt, settings, failure.errorMessage),
14656
- errorMessage: failure.errorMessage
14747
+ delayMs: computeRetryDelayMs(attempt, settings, failure2.errorMessage),
14748
+ errorMessage: failure2.errorMessage
14657
14749
  };
14658
14750
  recordRetryStatus(scheduled);
14659
14751
  const countdown = await waitForRetryCountdown(scheduled);
@@ -14662,7 +14754,7 @@ function createTurnRecovery(deps) {
14662
14754
  phase: "cancelled",
14663
14755
  attempt,
14664
14756
  maxAttempts: settings.maxRetries,
14665
- errorMessage: failure.errorMessage
14757
+ errorMessage: failure2.errorMessage
14666
14758
  });
14667
14759
  pruneFailedAssistantFromContext(agentRuntime.agent);
14668
14760
  return true;
@@ -14672,7 +14764,7 @@ function createTurnRecovery(deps) {
14672
14764
  phase: "retrying",
14673
14765
  attempt,
14674
14766
  maxAttempts: settings.maxRetries,
14675
- errorMessage: failure.errorMessage
14767
+ errorMessage: failure2.errorMessage
14676
14768
  },
14677
14769
  false
14678
14770
  );
@@ -14691,7 +14783,7 @@ function createTurnRecovery(deps) {
14691
14783
  pruneFailedAssistantFromContext(agentRuntime.agent);
14692
14784
  return true;
14693
14785
  }
14694
- failure = { stopReason: "error", errorMessage: message };
14786
+ failure2 = { stopReason: "error", errorMessage: message };
14695
14787
  continue;
14696
14788
  }
14697
14789
  const overflow = detectOverflowFromState(agentRuntime.agent);
@@ -14714,13 +14806,13 @@ function createTurnRecovery(deps) {
14714
14806
  pruneFailedAssistantFromContext(agentRuntime.agent);
14715
14807
  return true;
14716
14808
  }
14717
- failure = nextFailure;
14809
+ failure2 = nextFailure;
14718
14810
  }
14719
14811
  recordRetryStatus({
14720
14812
  phase: "exhausted",
14721
14813
  attempt: settings.maxRetries,
14722
14814
  maxAttempts: settings.maxRetries,
14723
- errorMessage: failure.errorMessage
14815
+ errorMessage: failure2.errorMessage
14724
14816
  });
14725
14817
  pruneFailedAssistantFromContext(agentRuntime.agent);
14726
14818
  return true;
@@ -14863,10 +14955,10 @@ function createTurnRuntime(deps) {
14863
14955
  knownLoadedContextWindow: context.rememberedLoadedContextWindow(targetId, wireModelId)
14864
14956
  });
14865
14957
  if (!resolved.ok) {
14866
- const failure = resolved.diagnostics.find((entry) => entry.severity === "error") ?? resolved.diagnostics[0];
14958
+ const failure2 = resolved.diagnostics.find((entry) => entry.severity === "error") ?? resolved.diagnostics[0];
14867
14959
  throw new TurnAdmissionError(
14868
- `[Clio Coder] ${failure?.message ?? "orchestrator target resolution failed"}`,
14869
- failure?.code ?? "admission-failed"
14960
+ `[Clio Coder] ${failure2?.message ?? "orchestrator target resolution failed"}`,
14961
+ failure2?.code ?? "admission-failed"
14870
14962
  );
14871
14963
  }
14872
14964
  for (const message of runtimeResolutionWarningsBesideThinkingNotice(
@@ -15452,7 +15544,9 @@ function createChatLoop(deps) {
15452
15544
  };
15453
15545
  const retrySettings = () => normalizeRetrySettings(deps.getSettings().chat.retry);
15454
15546
  const currentToolInvokeOptions = () => {
15455
- const options = {};
15547
+ const options = {
15548
+ toolResultMaxBytes: deps.getSettings().context.toolResultMaxBytes
15549
+ };
15456
15550
  const sessionId = deps.session?.current()?.id ?? null;
15457
15551
  if (sessionId) options.sessionId = sessionId;
15458
15552
  const turnId = state.activeUserTurnId ?? state.lastTurnId;
@@ -15545,6 +15639,9 @@ function createChatLoop(deps) {
15545
15639
  const unsubscribeConfigReload = deps.bus?.on(BusChannels.ConfigHotReload, () => {
15546
15640
  context.invalidateSessionPromptCache();
15547
15641
  }) ?? null;
15642
+ const unsubscribeExtensionsReload = deps.bus?.on(BusChannels.ExtensionsReloaded, (payload) => {
15643
+ if (payload.changed) context.invalidateSessionPromptCache();
15644
+ }) ?? null;
15548
15645
  const unsubscribeSynthesisLock = deps.bus?.on(BusChannels.LoopBlocked, (payload) => {
15549
15646
  const disposition = payload?.disposition;
15550
15647
  if (disposition === "lockout") state.synthesisToolLock = true;
@@ -15872,9 +15969,9 @@ function createChatLoop(deps) {
15872
15969
  if (state.toolProseAbortReason && settled.message) {
15873
15970
  settled.message.errorMessage = state.toolProseAbortReason;
15874
15971
  }
15875
- const failure = reclassifyStallAbort(state, settled);
15876
- recovery.ensureFailureVisibleAndPersisted(failure);
15877
- await recovery.runTransientRetryChain(agentRuntime, runtimePromptText, failure);
15972
+ const failure2 = reclassifyStallAbort(state, settled);
15973
+ recovery.ensureFailureVisibleAndPersisted(failure2);
15974
+ await recovery.runTransientRetryChain(agentRuntime, runtimePromptText, failure2);
15878
15975
  }
15879
15976
  }
15880
15977
  } catch (err) {
@@ -16010,6 +16107,7 @@ function createChatLoop(deps) {
16010
16107
  },
16011
16108
  dispose() {
16012
16109
  unsubscribeConfigReload?.();
16110
+ unsubscribeExtensionsReload?.();
16013
16111
  unsubscribeSynthesisLock?.();
16014
16112
  unsubscribePrewarmCompaction();
16015
16113
  prewarm.dispose();
@@ -20516,9 +20614,9 @@ function isSameSelection(left, right) {
20516
20614
  function selectionCursor(selected) {
20517
20615
  return selected ? clioTheme().fg("accent", GLYPH.cursor) : " ";
20518
20616
  }
20519
- function displayArtifactPath(path, workspace) {
20617
+ function displayArtifactPath(path2, workspace) {
20520
20618
  const root = resolve4(workspace);
20521
- const target = isAbsolute5(path) ? resolve4(path) : resolve4(root, path);
20619
+ const target = isAbsolute5(path2) ? resolve4(path2) : resolve4(root, path2);
20522
20620
  const display = relative6(root, target);
20523
20621
  return display.length > 0 ? display : ".";
20524
20622
  }
@@ -20876,7 +20974,7 @@ function createOverlayGeneralOpeners(deps) {
20876
20974
  onDoneUserTask: (id) => void deps.userTasks?.done(id),
20877
20975
  onDropUserTask: (id) => void deps.userTasks?.drop(id)
20878
20976
  } : {},
20879
- onOpenArtifact: (path) => openView(`workspace:${path}`),
20977
+ onOpenArtifact: (path2) => openView(`workspace:${path2}`),
20880
20978
  requestRender: deps.requestRender,
20881
20979
  workspace: deps.getSessionMeta()?.cwd ?? process.cwd()
20882
20980
  });
@@ -22100,7 +22198,7 @@ var SETTINGS_LABELS_BY_ID = {
22100
22198
  "panes.journal": "Run event journal",
22101
22199
  "panes.yazi.enabled": "Files pane",
22102
22200
  "panes.yazi.mode": "Files pane mode",
22103
- "panes.yazi.profile": "Yazi profile",
22201
+ "panes.yazi.profile": "Files pane profile",
22104
22202
  "panes.yazi.followCwd": "Follow conversation cwd",
22105
22203
  "panes.yazi.ratio": "Files dock share",
22106
22204
  scope: "Model cycle set",
@@ -22108,6 +22206,7 @@ var SETTINGS_LABELS_BY_ID = {
22108
22206
  "modelSelector.favorites": "Pinned favorites",
22109
22207
  "budget.sessionCeilingUsd": "Session ceiling (USD)",
22110
22208
  "defaults.maxTokens": "Output budget (tokens)",
22209
+ "context.toolResultMaxBytes": "Tool result cap (bytes)",
22111
22210
  "budget.concurrency": "Fleet concurrency",
22112
22211
  "guardrails.turnToolCallBudget": "Turn tool-call budget",
22113
22212
  "guardrails.workerToolCallCap": "Worker tool-call cap",
@@ -22199,6 +22298,7 @@ var SETTINGS_SECTION_ROWS = {
22199
22298
  budget: [
22200
22299
  "budget.sessionCeilingUsd",
22201
22300
  "defaults.maxTokens",
22301
+ "context.toolResultMaxBytes",
22202
22302
  "budget.concurrency",
22203
22303
  "guardrails.turnToolCallBudget",
22204
22304
  "guardrails.workerToolCallCap",
@@ -22283,9 +22383,9 @@ var SETTINGS_DESCRIPTIONS_BY_ID = {
22283
22383
  "panes.layout": "What composes itself at interactive boot: nothing, the workers dock, or workers plus files.",
22284
22384
  "panes.workers.ratio": "Share of the width the workers dock takes, at most half.",
22285
22385
  "panes.journal": "Whether every dispatched run's event tail is written to disk for `clio-coder fleet view`.",
22286
- "panes.yazi.enabled": "Whether `/panes open yazi` may open the files pane or one-shot chooser.",
22287
- "panes.yazi.mode": "Keep Yazi beside the conversation, or close it after one selection.",
22288
- "panes.yazi.profile": "Use Clio's managed pick profile or leave the operator's Yazi profile untouched.",
22386
+ "panes.yazi.enabled": "Whether `/files`, its key, and `/panes open files` may open the files pane or the one-shot pick.",
22387
+ "panes.yazi.mode": "Keep the files pane beside the conversation, or close it after one selection.",
22388
+ "panes.yazi.profile": "Use Clio's managed, themed engine profile or the operator's own file-manager configuration.",
22289
22389
  "panes.yazi.followCwd": "Push the conversation directory into an already-open companion pane.",
22290
22390
  "panes.yazi.ratio": "Share of the height the files dock takes, at most half.",
22291
22391
  scope: "Alt+J and Alt+K model cycle set.",
@@ -22293,6 +22393,7 @@ var SETTINGS_DESCRIPTIONS_BY_ID = {
22293
22393
  "modelSelector.favorites": "Exact target/model refs pinned in /model.",
22294
22394
  "budget.sessionCeilingUsd": "Per-session cost cap.",
22295
22395
  "defaults.maxTokens": "Output tokens requested per turn, applied to every target.",
22396
+ "context.toolResultMaxBytes": "Maximum bytes returned from one tool result before the full text spills to scratch.",
22296
22397
  "budget.concurrency": "Parallel workers allowed during dispatch.",
22297
22398
  "guardrails.turnToolCallBudget": "Soft per-turn tool-call budget for this chat loop.",
22298
22399
  "guardrails.workerToolCallCap": "Lifetime ceiling on tool calls one dispatched worker may execute.",
@@ -22338,18 +22439,19 @@ var SETTINGS_DESCRIPTIONS_BY_ID = {
22338
22439
  var SETTINGS_HELP_BY_ID = {
22339
22440
  autonomy: "read-only observes; suggest parks non-read calls; auto-edit edits, dispatches, and runs recognized commands; full-auto runs except command substitution and system-level changes. A confirmation marked exposure=outward parks for you at suggest and auto-edit.",
22340
22441
  "defaults.maxTokens": "Clamped down to each model's max-output cap and the remaining context window. Set 0 to use per-model caps only.",
22442
+ "context.toolResultMaxBytes": "The 192KB per-turn observation pool remains authoritative. Three full 64KB results consume it, so a fourth finds it filled. Whole number of at least 4096 bytes \xB7 default: 65536 (64KB).",
22341
22443
  "compaction.threshold": "pressure = estimated tokens \xF7 context window. Higher keeps more history but risks overflow before a summary runs.",
22342
22444
  "context.workingSet.enabled": "Eviction moves stale tool-result bodies and thinking blocks out of the model's working set and records a ledger entry; history is never rewritten. Off skips eviction and goes straight to summary compaction. Legal values: true, false \xB7 default: true.",
22343
22445
  "context.workingSet.policy": "structural-v1 selects by message structure; age-horizon is the older age-based rule. Legal values: structural-v1, age-horizon \xB7 default: structural-v1.",
22344
22446
  "context.workingSet.target": "An applied eviction batch keeps evicting until pressure reaches this ratio, so it sits below compaction.threshold. Greater than 0 and less than 1 \xB7 default: 0.6.",
22345
22447
  "context.workingSet.protectLastTurns": "Counted in user turns. Whole number of at least 1 \xB7 default: 6.",
22346
22448
  "context.workingSet.minEvictableTokens": "The floor sweep put marker break-even near 50 tokens; 200 is the churn guard. Whole number, 0 evicts anything \xB7 default: 200.",
22347
- "guardrails.turnToolCallBudget": "Crossing it blocks further calls in the turn with a stop-and-summarize directive, and the hard interrupt ceiling sits a fixed margin above. A backstop against a model spraying unproductive calls, not a routine ceiling: a repo-wide audit legitimately runs dozens. Whole number of at least 1 \xB7 default: 60. Env override CLIO_CODER_TURN_TOOL_CALL_BUDGET beats this value.",
22348
- "guardrails.workerToolCallCap": "Bounds admitted calls, not attempts: a call the harness refuses never ran and never spends the cap. Dispatch takes the smaller of this and the agent recipe's own budget, so the recipe normally binds. Whole number of at least 1 \xB7 default: 150. Env override CLIO_CODER_WORKER_TOOL_CALL_CAP beats this value.",
22349
- "guardrails.maxDispatchRuns": "Runs leaving the ring also lose their event journal directory. Whole number of at least 1 \xB7 default: 1000. Env override CLIO_CODER_MAX_DISPATCH_RUNS beats this value.",
22350
- "guardrails.readMaxBytes": "Clamped up to a 1KB floor at use. Whole number of bytes, at least 1 \xB7 default: 51200 (50KB). Env override CLIO_CODER_READ_MAX_BYTES beats this value.",
22351
- "guardrails.observationTurnBudgetBytes": "One pool shared by every observation-producing tool in a turn, so a single verbose tool cannot starve the rest. Whole number of bytes, at least 1 \xB7 default: 196608 (192KB). Env override CLIO_CODER_OBSERVATION_TURN_BUDGET_BYTES beats this value.",
22352
- "guardrails.internalDispatchTimeoutMs": "Covers the wiki documenter and the bootstrap scout. Continuous output satisfies the heartbeat watchdog and a run mid-generation spends no tool calls, so this is the only guard that ends a degenerate generator. Healthy runs finish in minutes. Whole milliseconds of at least 1 \xB7 default: 900000 (15 minutes). Env override CLIO_CODER_INTERNAL_DISPATCH_TIMEOUT_MS beats this value.",
22449
+ "guardrails.turnToolCallBudget": "Crossing it blocks further calls in the turn with a stop-and-summarize directive, and the hard interrupt ceiling sits a fixed margin above. A backstop against a model spraying unproductive calls, not a routine ceiling: a repo-wide audit legitimately runs dozens. Whole number of at least 1 \xB7 default: 60.",
22450
+ "guardrails.workerToolCallCap": "Bounds admitted calls, not attempts: a call the harness refuses never ran and never spends the cap. Dispatch takes the smaller of this and the agent recipe's own budget, so the recipe normally binds. Whole number of at least 1 \xB7 default: 150.",
22451
+ "guardrails.maxDispatchRuns": "Runs leaving the ring also lose their event journal directory. Whole number of at least 1 \xB7 default: 1000.",
22452
+ "guardrails.readMaxBytes": "Clamped up to a 1KB floor at use. Whole number of bytes, at least 1 \xB7 default: 51200 (50KB).",
22453
+ "guardrails.observationTurnBudgetBytes": "One pool shared by every observation-producing tool in a turn, so a single verbose tool cannot starve the rest. Whole number of bytes, at least 1 \xB7 default: 196608 (192KB).",
22454
+ "guardrails.internalDispatchTimeoutMs": "Covers the wiki documenter and the bootstrap scout. Continuous output satisfies the heartbeat watchdog and a run mid-generation spends no tool calls, so this is the only guard that ends a degenerate generator. Healthy runs finish in minutes. Whole milliseconds of at least 1 \xB7 default: 900000 (15 minutes).",
22353
22455
  "retry.streamStallMs": "Measured from the last token received, not from the request, so a slow-but-alive stream is never aborted. The retry then follows the same enabled/maxRetries/delay settings above. Whole milliseconds \xB7 default: 180000 (three minutes).",
22354
22456
  "library.catalog": "Absolute path, or blank for the catalog in your config directory. The catalog is the index `clio-coder library` reads; installed resources land in the usual skill and resource roots either way. Default: blank.",
22355
22457
  "library.remote": "A Git remote URL, or blank to keep the library local. Setting it is not enough to sync: the remote must also be confirmed, and library.sync must be true. Default: blank.",
@@ -22417,14 +22519,11 @@ var SETTINGS_VALUE_HELP_BY_ID = {
22417
22519
  true: "compact automatically before a turn crosses the threshold",
22418
22520
  false: "context is only compacted when you run /context compact"
22419
22521
  },
22420
- // `embedded` is a declared rung with no implementation behind it, and a row
22421
- // that offered it beside two working values read as a third working value.
22422
- // It stays selectable, because refusing it outright would break a settings
22423
- // file that names it, but nothing here lets an operator pick it believing
22424
- // they will get panes.
22522
+ // `embedded` is a declared rung with no implementation behind it yet; it
22523
+ // runs as `auto` until Clio can own a pane host, and the hint says so.
22425
22524
  "panes.enabled": {
22426
22525
  auto: "detect a herdr session and join it as a guest; no pane host, no panes",
22427
- embedded: "NOT IMPLEMENTED (ships in phase 5): this session gets no panes at all, guest mode included",
22526
+ embedded: "not implemented yet; behaves as auto (guest mode inside herdr) until Clio can own a pane host",
22428
22527
  off: "never detect or open a pane"
22429
22528
  },
22430
22529
  "retry.enabled": {
@@ -23036,9 +23135,9 @@ function scopeForId(id) {
23036
23135
  return RESTART_REQUIRED_IDS.has(id) ? "restart" : "live";
23037
23136
  }
23038
23137
  function defaultValueFor(id) {
23039
- const path = settingsV2PathForRow(id);
23040
- if (isRoutingPath(path)) return void 0;
23041
- const raw = getAtPath(DEFAULT_SETTINGS, path);
23138
+ const path2 = settingsV2PathForRow(id);
23139
+ if (isRoutingPath(path2)) return void 0;
23140
+ const raw = getAtPath(DEFAULT_SETTINGS, path2);
23042
23141
  if (raw === null || raw === void 0 || typeof raw === "object") return void 0;
23043
23142
  if (id === "attribution.gitCommits") return raw === true ? "enabled" : "disabled";
23044
23143
  return String(raw);
@@ -23339,6 +23438,9 @@ function buildSettingItems(settings, options) {
23339
23438
  settingItem("defaults.maxTokens", String(settings.chat.maxOutputTokens), {
23340
23439
  values: ["0", "4096", "8192", "16384", "32768", "65536", "131072"]
23341
23440
  }),
23441
+ settingItem("context.toolResultMaxBytes", String(settings.context.toolResultMaxBytes), {
23442
+ values: ["4096", "8192", "16384", "32768", "65536", "131072"]
23443
+ }),
23342
23444
  settingItem("budget.concurrency", String(settings.fleet.concurrency), {
23343
23445
  values: ["auto", "1", "2", "4", "8"]
23344
23446
  }),
@@ -24133,6 +24235,11 @@ function applySettingChange(settings, id, value) {
24133
24235
  else settings.fleet.limits.internalRunTimeoutMs = next;
24134
24236
  });
24135
24237
  return;
24238
+ case "context.toolResultMaxBytes":
24239
+ applyNonNegativeInteger(value, (next) => {
24240
+ if (next >= 4096) settings.context.toolResultMaxBytes = next;
24241
+ });
24242
+ return;
24136
24243
  case "context.workingSet.enabled":
24137
24244
  if (value === "true" || value === "false") settings.context.workingSet.enabled = value === "true";
24138
24245
  return;
@@ -24221,15 +24328,15 @@ function applyEntrySettingChange(settings, id, value) {
24221
24328
  function changedLeafPaths(before, after) {
24222
24329
  const out = [];
24223
24330
  const isRecord11 = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
24224
- const visit = (a, b, path) => {
24331
+ const visit = (a, b, path2) => {
24225
24332
  if (a === b) return;
24226
- const profileLeaf = path.startsWith("fleet.profiles.") && path.split(".").length === 3;
24333
+ const profileLeaf = path2.startsWith("fleet.profiles.") && path2.split(".").length === 3;
24227
24334
  if (!isRecord11(a) || !isRecord11(b) || profileLeaf) {
24228
- if (JSON.stringify(a) !== JSON.stringify(b)) out.push(path);
24335
+ if (JSON.stringify(a) !== JSON.stringify(b)) out.push(path2);
24229
24336
  return;
24230
24337
  }
24231
24338
  for (const key of /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)])) {
24232
- visit(a[key], b[key], path ? `${path}.${key}` : key);
24339
+ visit(a[key], b[key], path2 ? `${path2}.${key}` : key);
24233
24340
  }
24234
24341
  };
24235
24342
  visit(before, after, "");
@@ -24242,13 +24349,13 @@ function deepFreeze(value) {
24242
24349
  }
24243
24350
  return value;
24244
24351
  }
24245
- function propagationTiming(id, selectedValue, path, restartRequired) {
24352
+ function propagationTiming(id, selectedValue, path2, restartRequired) {
24246
24353
  if (restartRequired) return "next-session";
24247
24354
  if (id.startsWith("targets.")) {
24248
24355
  if (selectedValue === "remove") return "next-dispatch";
24249
- return path.startsWith("chat.") ? "now" : "next-dispatch";
24356
+ return path2.startsWith("chat.") ? "now" : "next-dispatch";
24250
24357
  }
24251
- if (path.startsWith("fleet.")) return "next-dispatch";
24358
+ if (path2.startsWith("fleet.")) return "next-dispatch";
24252
24359
  return "now";
24253
24360
  }
24254
24361
  function impactFor(propagation) {
@@ -24269,14 +24376,14 @@ function createSettingsChangePlan(settings, item, selectedValue, sessionDestinat
24269
24376
  if (paths.length === 0) return null;
24270
24377
  const restartRequired = item.scope === "restart";
24271
24378
  const sessionCapable = !restartRequired && sessionDestinationAvailable;
24272
- const leaves = paths.map((path) => ({
24273
- path,
24274
- before: getAtPath(original, path),
24275
- after: getAtPath(proposed, path)
24379
+ const leaves = paths.map((path2) => ({
24380
+ path: path2,
24381
+ before: getAtPath(original, path2),
24382
+ after: getAtPath(proposed, path2)
24276
24383
  }));
24277
- const propagation = paths.map((path) => ({
24278
- path,
24279
- timing: propagationTiming(rowId, selectedValue, path, restartRequired)
24384
+ const propagation = paths.map((path2) => ({
24385
+ path: path2,
24386
+ timing: propagationTiming(rowId, selectedValue, path2, restartRequired)
24280
24387
  }));
24281
24388
  return deepFreeze({
24282
24389
  rowId,
@@ -24389,13 +24496,13 @@ function rowColumns(items, width, indentWidth) {
24389
24496
  const labelNatural = Math.max(8, ...items.map((item) => visibleWidth(item.label)));
24390
24497
  const pathNatural = Math.max(10, ...items.map((item) => visibleWidth(item.configPath)));
24391
24498
  let label = Math.min(labelNatural, 26, Math.max(8, Math.floor(available * 0.34)));
24392
- let path = Math.min(pathNatural, 36, Math.max(8, Math.floor(available * 0.42)));
24393
- while (available - label - path < 8 && path > 8) path -= 1;
24394
- while (available - label - path < 8 && label > 8) label -= 1;
24395
- if (available - label - path < 4) {
24396
- path = Math.max(4, available - label - 4);
24499
+ let path2 = Math.min(pathNatural, 36, Math.max(8, Math.floor(available * 0.42)));
24500
+ while (available - label - path2 < 8 && path2 > 8) path2 -= 1;
24501
+ while (available - label - path2 < 8 && label > 8) label -= 1;
24502
+ if (available - label - path2 < 4) {
24503
+ path2 = Math.max(4, available - label - 4);
24397
24504
  }
24398
- return { label, path };
24505
+ return { label, path: path2 };
24399
24506
  }
24400
24507
  function formatSettingRow(item, width, selected, columns, indentWidth, displayValue, pending) {
24401
24508
  const theme6 = clioTheme();
@@ -24900,7 +25007,7 @@ var SettingsCenter = class {
24900
25007
  const targetRemovalPreflight = (() => {
24901
25008
  if (!plan.rowId.startsWith("targets.") || plan.selectedValue !== "remove") return "";
24902
25009
  const paths = (prefix) => plan.leaves.filter((leaf) => leaf.path.startsWith(prefix)).map((leaf) => leaf.path);
24903
- const profiles = paths("fleet.profiles.").map((path) => path.slice("fleet.profiles.".length));
25010
+ const profiles = paths("fleet.profiles.").map((path2) => path2.slice("fleet.profiles.".length));
24904
25011
  const describe = (label, affected) => `Affected ${label}: ${affected.length > 0 ? affected.join(", ") : "none"}`;
24905
25012
  return `${describe("chat route", paths("chat."))} \xB7 ${describe("fleet route", paths("fleet.default."))} \xB7 ${describe("memory route", paths("context.memory."))} \xB7 ${describe("profiles", profiles)} \xB7 `;
24906
25013
  })();
@@ -25721,7 +25828,7 @@ function isSafetyBlockedPayload(value) {
25721
25828
  function isMiddlewareHookFailedPayload(value) {
25722
25829
  if (!value || typeof value !== "object") return false;
25723
25830
  const p = value;
25724
- if (p.kind !== "hook_failed" && p.kind !== "budget_exceeded") return false;
25831
+ if (p.kind !== "hook_failed" && p.kind !== "budget_exceeded" && p.kind !== "registration_conflict") return false;
25725
25832
  if (typeof p.registrationId !== "string" || p.registrationId.length === 0) return false;
25726
25833
  if (typeof p.hook !== "string" || p.hook.length === 0) return false;
25727
25834
  if (p.message !== void 0 && typeof p.message !== "string") return false;
@@ -25775,6 +25882,10 @@ function middlewareBudgetWarningKey(payload) {
25775
25882
  }
25776
25883
  function middlewareHookFailedNotice(payload, options = {}) {
25777
25884
  if (!isMiddlewareHookFailedPayload(payload)) return null;
25885
+ if (payload.kind === "registration_conflict") {
25886
+ const detail = payload.message !== void 0 && payload.message.length > 0 ? payload.message : `registration '${payload.registrationId}' conflicts with an existing id`;
25887
+ return { level: "warn", text: `[middleware] ${detail}` };
25888
+ }
25778
25889
  if (payload.kind === "hook_failed") {
25779
25890
  const detail = payload.message !== void 0 && payload.message.length > 0 ? `: ${payload.message}` : "";
25780
25891
  return {
@@ -26227,7 +26338,7 @@ var EXTENSIONS_EMPTY = "no extensions installed. install one with `clio-coder ex
26227
26338
  function openExtensionsOverlay(tui, ctx, onClose) {
26228
26339
  const list = ctx.listExtensions?.() ?? [];
26229
26340
  const items = list.map((ext) => {
26230
- const state = !ext.enabled ? "disabled" : ext.effective ? "active" : `shadowed:${ext.overriddenBy ?? "higher"}`;
26341
+ const state = !ext.valid ? "invalid" : !ext.compatible ? "incompatible" : !ext.enabled ? "disabled" : ext.loadable ? "active" : `shadowed:${ext.overriddenBy ?? "higher"}`;
26231
26342
  let meta = state;
26232
26343
  if (state === "active") {
26233
26344
  meta = clioTheme().fg("success", "active");
@@ -26409,6 +26520,19 @@ function openHelpOverlay(tui, manager, onClose, initialFilter) {
26409
26520
  "**Tasks versus runs**: `/tasks` shows the agent's plan steps. Fleet runs are concrete delegated worker executions and remain in this board as recent terminal history."
26410
26521
  ]
26411
26522
  },
26523
+ {
26524
+ id: "topic-files-pane",
26525
+ label: `${"panes & files".padEnd(30)}The files pane, the logs and shell panes, and what closes them`,
26526
+ group: "Topics",
26527
+ detail: () => [
26528
+ "# Panes & files",
26529
+ "**Where it works**: a session started inside a herdr pane with `clio-coder --with-panes` (or `interface.panes.enabled: auto`). Outside herdr `/files` still works as a full-screen pick that returns to the composer; `/panes open logs|shell` do not.",
26530
+ "**Files pane**: `/files` or the Files toggle key (Alt+E by default) opens the file view below the session and moves the keyboard into it; the same key or command closes it. `/files pick` borrows it for one selection. It is off until `interface.panes.files.enabled` is `true`.",
26531
+ "**Picking**: navigate, select with Space for several, then Ctrl+Y (or Enter in pick mode). The paths land in the composer as `@file` mentions and the keyboard returns to the composer.",
26532
+ "**Logs and shell**: `/panes open logs` follows the newest dispatched run's journal; `/panes open shell` opens a shell in the workspace. A second open focuses the pane that is already there. `/panes close <name|all>` closes them; `/quit` closes the docks it manages (files, workers), leaves a shell or logs pane you opened, and prints which panes it left and how to close them.",
26533
+ "**Engine**: the files pane runs a vendored file manager installed with `clio-coder tools install yazi`; `clio-coder doctor` and `/panes` say whether it resolved."
26534
+ ]
26535
+ },
26412
26536
  {
26413
26537
  id: "topic-steering-modes",
26414
26538
  label: `${"steering modes".padEnd(30)}Interrupt, next slot, or end of turn: when a message lands mid-run`,
@@ -29281,6 +29405,7 @@ var GLOBAL_ACTION_ORDER = [
29281
29405
  "clio-coder.thinking.cycle",
29282
29406
  "clio-coder.session.tree",
29283
29407
  "clio-coder.dispatchBoard.toggle",
29408
+ "clio-coder.files.toggle",
29284
29409
  "clio-coder.tasks.open",
29285
29410
  "clio-coder.decisions.open",
29286
29411
  "clio-coder.dispatch.background",
@@ -29340,9 +29465,9 @@ function createApplicationController(deps) {
29340
29465
  }
29341
29466
  };
29342
29467
  const reportFailures = () => {
29343
- for (const failure of failures.splice(0)) {
29468
+ for (const failure2 of failures.splice(0)) {
29344
29469
  try {
29345
- deps.reportShutdownFailure(failure.step, failure.error);
29470
+ deps.reportShutdownFailure(failure2.step, failure2.error);
29346
29471
  } catch {
29347
29472
  }
29348
29473
  }
@@ -30692,6 +30817,7 @@ function createInteractiveInputRuntime(deps) {
30692
30817
  openTasks: deps.overlay.openTasksOverlayState,
30693
30818
  openDecisions: deps.overlay.openDecisionsOverlayState,
30694
30819
  backgroundDispatch: deps.actions.backgroundActiveDispatch,
30820
+ toggleFilesPane: deps.actions.toggleFilesPane,
30695
30821
  openModelSelector: deps.overlay.openModelOverlayState,
30696
30822
  openTree: deps.overlay.openTreeOverlayState,
30697
30823
  cycleScopedModelForward: () => {
@@ -31362,9 +31488,9 @@ function scoutReport(value) {
31362
31488
  const finding = raw;
31363
31489
  const claim = reportString(finding.claim);
31364
31490
  if (claim === null) return null;
31365
- const path = reportString(finding.path);
31491
+ const path2 = reportString(finding.path);
31366
31492
  const line = typeof finding.line === "number" && Number.isSafeInteger(finding.line) ? finding.line : null;
31367
- lines.push(path !== null && line !== null ? `- ${claim} \u2014 ${path}:${line}` : `- ${claim} (ungrounded lead)`);
31493
+ lines.push(path2 !== null && line !== null ? `- ${claim} \u2014 ${path2}:${line}` : `- ${claim} (ungrounded lead)`);
31368
31494
  }
31369
31495
  if (value.needsSplit) {
31370
31496
  if (!Array.isArray(value.proposedSubtasks)) return null;
@@ -31630,18 +31756,30 @@ function hasStreamingText(entry) {
31630
31756
  const tail = entry.segments[entry.segments.length - 1];
31631
31757
  return tail?.kind === "text" && !tail.finalized && tail.text.trim().length > 0;
31632
31758
  }
31759
+ function findSkillSuggestionLine(seg) {
31760
+ const text = seg.text;
31761
+ let at = text.startsWith(SKILL_SUGGESTION_PREFIX) ? 0 : text.indexOf(`
31762
+ ${SKILL_SUGGESTION_PREFIX}`);
31763
+ if (at < 0) return null;
31764
+ if (at > 0) at += 1;
31765
+ const lineEnd = text.indexOf("\n", at);
31766
+ if (lineEnd < 0) return seg.finalized ? { start: at, end: text.length } : null;
31767
+ return { start: at, end: lineEnd };
31768
+ }
31633
31769
  function skillSuggestionSplit(seg) {
31634
- if (!seg.text.startsWith(SKILL_SUGGESTION_PREFIX)) return null;
31635
- const breakIndex = seg.text.indexOf("\n");
31636
- if (breakIndex < 0) return null;
31637
- const answerText2 = seg.text.slice(breakIndex + 1).replace(/^\n+/, "");
31770
+ const found = findSkillSuggestionLine(seg);
31771
+ if (!found) return null;
31772
+ const before = seg.text.slice(0, found.start).replace(/\n+$/, "");
31773
+ const after = seg.text.slice(found.end + 1).replace(/^\n+/, "");
31774
+ const answerText2 = before.length > 0 && after.length > 0 ? `${before}
31775
+ ${after}` : before + after;
31638
31776
  if (answerText2.trim().length === 0) return null;
31639
31777
  const split = seg.suggestionSplit ?? {
31640
31778
  suggestion: "",
31641
31779
  answer: { kind: "text", text: answerText2, finalized: seg.finalized }
31642
31780
  };
31643
31781
  seg.suggestionSplit = split;
31644
- split.suggestion = seg.text.slice(0, breakIndex);
31782
+ split.suggestion = seg.text.slice(found.start, found.end).replace(/\r$/, "");
31645
31783
  const answer = split.answer;
31646
31784
  if (answer.text === answerText2 && answer.finalized === seg.finalized) return split;
31647
31785
  const appendOnly = !seg.finalized && answer.finalized === seg.finalized && answerText2.startsWith(answer.text);
@@ -31934,7 +32072,7 @@ function renderEntryLines(entry, width, expandKey, latestHintToolId, latestFolde
31934
32072
  }
31935
32073
  const rendered = seg.kind === "text" ? renderTextSegmentLines(seg, proseWidth) : renderErrorSegmentLines(seg, proseWidth);
31936
32074
  if (rendered.length === 0) continue;
31937
- const isSkillSuggestion = seg.kind === "text" && seg.text.startsWith(SKILL_SUGGESTION_PREFIX);
32075
+ const isSkillSuggestion = seg.kind === "text" && findSkillSuggestionLine(seg) !== null;
31938
32076
  if (!labeled && !isSkillSuggestion) {
31939
32077
  lines.push(...hangProseLines(rendered, clioPrefix));
31940
32078
  labeled = true;
@@ -33280,11 +33418,11 @@ var PREVIEW_BYTES = 2048;
33280
33418
  var PREVIEW_CHARS = 120;
33281
33419
  var SNAPSHOT_TTL_MS = 2e3;
33282
33420
  var GIT_OUTPUT_LIMIT_BYTES = 128 * 1024 * 1024;
33283
- function posixPath(path) {
33284
- return sep2 === "\\" ? path.replaceAll("\\", "/") : path;
33421
+ function posixPath(path2) {
33422
+ return sep2 === "\\" ? path2.replaceAll("\\", "/") : path2;
33285
33423
  }
33286
- function safeRelativePath(path) {
33287
- const normalized = posixPath(path).replace(/^\.\//u, "").replace(/\/$/u, "");
33424
+ function safeRelativePath(path2) {
33425
+ const normalized = posixPath(path2).replace(/^\.\//u, "").replace(/\/$/u, "");
33288
33426
  if (normalized.length === 0 || normalized.startsWith("/") || normalized.includes("\0") || /[\r\n]/u.test(normalized)) {
33289
33427
  return null;
33290
33428
  }
@@ -33317,18 +33455,18 @@ function buildWorkspaceSnapshot(basePath, visibleFiles, trackedFiles) {
33317
33455
  const files = [];
33318
33456
  const directoryFacts = /* @__PURE__ */ new Map();
33319
33457
  for (const raw of visibleFiles) {
33320
- const path = safeRelativePath(raw);
33321
- if (!path) continue;
33322
- const tracked = trackedFiles.has(path);
33458
+ const path2 = safeRelativePath(raw);
33459
+ if (!path2) continue;
33460
+ const tracked = trackedFiles.has(path2);
33323
33461
  files.push({
33324
- path,
33325
- absolutePath: join8(basePath, path),
33462
+ path: path2,
33463
+ absolutePath: join8(basePath, path2),
33326
33464
  isDirectory: false,
33327
33465
  tracked,
33328
33466
  descendantFiles: 0,
33329
33467
  workspace: true
33330
33468
  });
33331
- const segments = path.split("/");
33469
+ const segments = path2.split("/");
33332
33470
  for (let index = 1; index < segments.length; index += 1) {
33333
33471
  const directory = segments.slice(0, index).join("/");
33334
33472
  const facts = directoryFacts.get(directory) ?? { tracked: false, descendantFiles: 0 };
@@ -33338,9 +33476,9 @@ function buildWorkspaceSnapshot(basePath, visibleFiles, trackedFiles) {
33338
33476
  }
33339
33477
  }
33340
33478
  const directories = [...directoryFacts].map(
33341
- ([path, facts]) => ({
33342
- path,
33343
- absolutePath: join8(basePath, path),
33479
+ ([path2, facts]) => ({
33480
+ path: path2,
33481
+ absolutePath: join8(basePath, path2),
33344
33482
  isDirectory: true,
33345
33483
  tracked: facts.tracked,
33346
33484
  descendantFiles: facts.descendantFiles,
@@ -33353,8 +33491,8 @@ function buildWorkspaceSnapshot(basePath, visibleFiles, trackedFiles) {
33353
33491
  trackedFiles
33354
33492
  };
33355
33493
  }
33356
- function candidateParent(path) {
33357
- const parent = posixPath(dirname2(path));
33494
+ function candidateParent(path2) {
33495
+ const parent = posixPath(dirname2(path2));
33358
33496
  return parent === "." ? "" : parent;
33359
33497
  }
33360
33498
  function fuzzyOrdered(candidates, query) {
@@ -33481,8 +33619,8 @@ async function candidateDescription(candidate) {
33481
33619
  return `${provenance} \xB7 preview unavailable`;
33482
33620
  }
33483
33621
  }
33484
- function formatInlineFileReference(path, isDirectory) {
33485
- const completionPath = isDirectory ? `${path.replace(/\/$/u, "")}/` : path;
33622
+ function formatInlineFileReference(path2, isDirectory) {
33623
+ const completionPath = isDirectory ? `${path2.replace(/\/$/u, "")}/` : path2;
33486
33624
  if (!/[\s"'\\]/u.test(completionPath) && !isEditorSteerTargetToken(completionPath)) return `@${completionPath}`;
33487
33625
  return `@"${completionPath.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
33488
33626
  }
@@ -33598,24 +33736,24 @@ var COMPLETION_SLOT_MANIFEST = {
33598
33736
  "export:pos:path": "paths"
33599
33737
  };
33600
33738
  function completionGrammar(command, args) {
33601
- const clone = (spec, path) => ({
33739
+ const clone = (spec, path2) => ({
33602
33740
  ...spec,
33603
33741
  ...spec.flags ? {
33604
33742
  flags: spec.flags.map((flag) => {
33605
- const completionSlot = COMPLETION_SLOT_MANIFEST[`${path}:flag:${flag.name}`];
33743
+ const completionSlot = COMPLETION_SLOT_MANIFEST[`${path2}:flag:${flag.name}`];
33606
33744
  return { ...flag, ...completionSlot ? { completionSlot } : {} };
33607
33745
  })
33608
33746
  } : {},
33609
33747
  ...spec.positionals ? {
33610
33748
  positionals: spec.positionals.map((pos) => {
33611
- const completionSlot = COMPLETION_SLOT_MANIFEST[`${path}:pos:${pos.name}`];
33749
+ const completionSlot = COMPLETION_SLOT_MANIFEST[`${path2}:pos:${pos.name}`];
33612
33750
  const values = command === "output" && pos.name === "verbosity" ? ["minimal", "default", "verbose"] : command === "settings" && pos.name === "area" ? SETTINGS_AREA_IDS : void 0;
33613
33751
  return { ...pos, ...completionSlot ? { completionSlot } : {}, ...values ? { values } : {} };
33614
33752
  })
33615
33753
  } : {},
33616
33754
  ...spec.subcommands ? {
33617
33755
  subcommands: Object.fromEntries(
33618
- Object.entries(spec.subcommands).map(([name, child]) => [name, clone(child, `${path}/${name}`)])
33756
+ Object.entries(spec.subcommands).map(([name, child]) => [name, clone(child, `${path2}/${name}`)])
33619
33757
  )
33620
33758
  } : {}
33621
33759
  });
@@ -33935,15 +34073,6 @@ function createSlashCommandAutocompleteProvider(options = {}) {
33935
34073
 
33936
34074
  // src/interactive/stream-pacing-policy.ts
33937
34075
  init_esm_shims();
33938
- var SMOOTH_STREAM_ENV = "CLIO_CODER_SMOOTH_STREAM";
33939
- function resolveSmoothStreamingMode(configured, env = process.env) {
33940
- const raw = env[SMOOTH_STREAM_ENV]?.trim().toLowerCase();
33941
- if (!raw) return configured;
33942
- if (raw === "0" || raw === "off" || raw === "false") return "off";
33943
- if (raw === "auto") return "auto";
33944
- if (raw === "1" || raw === "on" || raw === "true") return "on";
33945
- return "off";
33946
- }
33947
34076
  function autoPacingAllowed(environment) {
33948
34077
  if (!environment.isTTY || environment.backpressureObserved) return false;
33949
34078
  const term = environment.term?.trim().toLowerCase();
@@ -33957,7 +34086,6 @@ function processAutoPacingAllowed(backpressureObserved, env = process.env) {
33957
34086
  return autoPacingAllowed({
33958
34087
  isTTY: process.stdout.isTTY === true,
33959
34088
  ...env.TERM === void 0 ? {} : { term: env.TERM },
33960
- ...env.TERM_PROGRAM === void 0 ? {} : { termProgram: env.TERM_PROGRAM },
33961
34089
  ...env.SSH_CONNECTION === void 0 ? {} : { sshConnection: env.SSH_CONNECTION },
33962
34090
  ...env.SSH_TTY === void 0 ? {} : { sshTty: env.SSH_TTY },
33963
34091
  ...env.TMUX === void 0 ? {} : { tmux: env.TMUX },
@@ -34550,7 +34678,7 @@ function createInteractivePresentation(deps) {
34550
34678
  ...deps.resolveStreamIngress && deps.getSettings ? {
34551
34679
  streamIngress: deps.resolveStreamIngress,
34552
34680
  getSmoothStreamingMode: () => {
34553
- const mode = resolveSmoothStreamingMode(deps.getSettings?.().interface.smoothStreaming ?? "off");
34681
+ const mode = deps.getSettings?.().interface.smoothStreaming ?? "off";
34554
34682
  const autoAllowed = processAutoPacingAllowed(deps.hasObservedBackpressure?.() ?? false);
34555
34683
  deps.onSmoothStreamingMode?.(mode, mode === "on" || mode === "auto" && autoAllowed);
34556
34684
  return mode;
@@ -35168,9 +35296,9 @@ function createInteractiveSlashRuntime(deps) {
35168
35296
  listDelegationAgents: () => deps.getSettings?.().integrations.externalAgents.entries ?? [],
35169
35297
  exportShareArchive: (outPath) => {
35170
35298
  if (!deps.share) throw new Error("share domain is not loaded");
35171
- const path = resolve6(outPath);
35172
- const archive = deps.share.writeArchive(path, { scope: "project" });
35173
- return { fileCount: archive.files.length, path };
35299
+ const path2 = resolve6(outPath);
35300
+ const archive = deps.share.writeArchive(path2, { scope: "project" });
35301
+ return { fileCount: archive.files.length, path: path2 };
35174
35302
  },
35175
35303
  importShareArchive: (archivePath, options) => {
35176
35304
  if (!deps.share) {
@@ -35315,6 +35443,7 @@ function createInteractiveSlashRuntime(deps) {
35315
35443
  openAgents: deps.openAgents,
35316
35444
  openPrompts: deps.openPrompts,
35317
35445
  openExtensions: deps.openExtensions,
35446
+ ...deps.reloadExtensions ? { reloadExtensions: deps.reloadExtensions } : {},
35318
35447
  ...deps.openInterop ? { openInterop: deps.openInterop } : {},
35319
35448
  ...deps.interop ? { interop: deps.interop } : {},
35320
35449
  setEditorText: (text) => {
@@ -35842,6 +35971,9 @@ function dispatchInteractiveAction(id, deps) {
35842
35971
  case "clio-coder.dispatchBoard.toggle":
35843
35972
  deps.toggleDispatchBoard();
35844
35973
  return true;
35974
+ case "clio-coder.files.toggle":
35975
+ deps.toggleFilesPane();
35976
+ return true;
35845
35977
  case "clio-coder.tasks.open":
35846
35978
  deps.openTasks();
35847
35979
  return true;
@@ -35869,7 +36001,7 @@ function dispatchInteractiveAction(id, deps) {
35869
36001
  }
35870
36002
  }
35871
36003
  async function createInteractiveApplication(deps) {
35872
- const initialSmoothStreaming = resolveSmoothStreamingMode(deps.getSettings?.().interface.smoothStreaming ?? "off");
36004
+ const initialSmoothStreaming = deps.getSettings?.().interface.smoothStreaming ?? "off";
35873
36005
  const initialAutoPacingAllowed = processAutoPacingAllowed(false);
35874
36006
  const lease = deps.terminalLease;
35875
36007
  const shell = lease?.shell ?? createProcessInteractiveShell({
@@ -35996,7 +36128,7 @@ async function createInteractiveApplication(deps) {
35996
36128
  getDraft: () => editor.getText(),
35997
36129
  setDraft: (text) => editor.setText(text),
35998
36130
  requestRender: () => tui.requestRender(),
35999
- notice: (level, text) => notify(level, text, `yazi:${level}`),
36131
+ notice: (level, text) => notify(level, text, `files:${level}`),
36000
36132
  getCwd: () => process.cwd(),
36001
36133
  getSettings: () => deps.getSettings?.().interface.panes.files ?? {
36002
36134
  mode: "companion",
@@ -36055,7 +36187,7 @@ async function createInteractiveApplication(deps) {
36055
36187
  appendTranscriptNotice: (level, text) => appendNotice(level, text, busNoticeSink),
36056
36188
  refreshSettingsOverlay: () => overlayLifecycle.refreshSettingsOverlay(),
36057
36189
  onConfigHotReload: (settings) => {
36058
- const mode = resolveSmoothStreamingMode(settings.interface.smoothStreaming);
36190
+ const mode = settings.interface.smoothStreaming;
36059
36191
  const autoAllowed = processAutoPacingAllowed(shell.hasObservedBackpressure());
36060
36192
  chatRenderer.setSmoothStreamingMode(mode);
36061
36193
  shell.setStreamPacingActive(mode === "on" || mode === "auto" && autoAllowed);
@@ -36080,6 +36212,7 @@ async function createInteractiveApplication(deps) {
36080
36212
  settleVisibleFrame: (reason) => chatRenderer.flushAndCommit(reason),
36081
36213
  ...deps.resources ? { resources: deps.resources } : {},
36082
36214
  ...deps.extensions ? { extensions: deps.extensions } : {},
36215
+ ...deps.reloadExtensions ? { reloadExtensions: deps.reloadExtensions } : {},
36083
36216
  ...interopSurface ? { interop: interopSurface } : {},
36084
36217
  ...deps.agents ? { agents: deps.agents } : {},
36085
36218
  ...deps.share ? { share: deps.share } : {},
@@ -36376,7 +36509,26 @@ async function createInteractiveApplication(deps) {
36376
36509
  cycleScopedModelBackward: () => {
36377
36510
  if (deps.onCycleScopedModelBackward?.() === false) announceEmptyScopedSet();
36378
36511
  },
36379
- backgroundActiveDispatch
36512
+ backgroundActiveDispatch,
36513
+ toggleFilesPane: () => {
36514
+ const panes = deps.panes;
36515
+ if (!panes) {
36516
+ notify(
36517
+ "info",
36518
+ "the files pane is inactive: this session started without panes. Restart with `clio-coder --with-panes`, or set interface.panes.enabled=auto",
36519
+ "files:info"
36520
+ );
36521
+ return;
36522
+ }
36523
+ void panes.files("toggle").then((result) => {
36524
+ if (result.status === "opened") {
36525
+ if (result.paneId !== null)
36526
+ notify("success", `files pane ${result.existing ? "focused" : "opened"}`, "files:open");
36527
+ } else if (result.status === "closed") notify("info", "files pane closed", "files:close");
36528
+ else if (result.status === "missing-binary") notify("warning", result.detail, "files:missing");
36529
+ else notify("warning", result.reason, "files:refused");
36530
+ });
36531
+ }
36380
36532
  },
36381
36533
  overlay: overlayLifecycle,
36382
36534
  refreshFooter: () => footer.refresh(),
@@ -36458,6 +36610,9 @@ async function createInteractiveApplication(deps) {
36458
36610
  },
36459
36611
  cancelParkedCalls: (reason) => deps.toolRegistry?.cancelParkedCalls(reason),
36460
36612
  onShutdown: async () => {
36613
+ const leftBehind = mux && mux.mode !== "none" && mux.available() ? describePanesLeftBehind(mux) : null;
36614
+ if (leftBehind !== null) process.stderr.write(`${leftBehind}
36615
+ `);
36461
36616
  try {
36462
36617
  if (dumpInputWedgeOnTerminate) process.off("SIGTERM", dumpInputWedgeOnTerminate);
36463
36618
  await deps.onShutdown();
@@ -36497,6 +36652,206 @@ async function startInteractive(deps) {
36497
36652
  return createInteractiveApplication(deps);
36498
36653
  }
36499
36654
 
36655
+ // src/entry/extension-reload.ts
36656
+ init_esm_shims();
36657
+ import { realpathSync as realpathSync2 } from "node:fs";
36658
+ import path from "node:path";
36659
+ var EXTENSION_RELOAD_REPORT_LINE_CAP = 40;
36660
+ function failure(message) {
36661
+ return {
36662
+ entries: [{ type: "error", message: message.slice(0, EXTENSION_SNAPSHOT_DIAGNOSTIC_MESSAGE_CAP) }],
36663
+ truncated: 0
36664
+ };
36665
+ }
36666
+ function issueLines(built, dropped) {
36667
+ const lines = [];
36668
+ for (const issue of built.fileIssues) lines.push(`[clio-coder:hooks] ${issue.message}`);
36669
+ for (const issue of built.issues) {
36670
+ lines.push(`[clio-coder:hooks] ${issue.source.sourcePath}#${issue.index}: ${issue.issues.join("; ")}`);
36671
+ }
36672
+ for (const { loser, winner } of built.overridden) {
36673
+ lines.push(`[clio-coder:hooks] ${loser.source.sourcePath} hook '${loser.id}' overridden by ${winner.sourcePath}`);
36674
+ }
36675
+ for (const conflict of dropped) {
36676
+ lines.push(
36677
+ `[clio-coder:hooks] hook '${conflict.id}' dropped: id is held by a ${conflict.conflictsWith} registration`
36678
+ );
36679
+ }
36680
+ return lines;
36681
+ }
36682
+ function createExtensionReloadCoordinator(deps) {
36683
+ let inFlight = false;
36684
+ const build = (workspace, captured) => buildUserHookRegistrations({
36685
+ cwd: workspace,
36686
+ workspaceRoot: workspace,
36687
+ ...captured !== null ? { capturedSources: captured } : {},
36688
+ recordReceipt: deps.recordReceipt,
36689
+ ...deps.runCommand !== void 0 ? { runCommand: deps.runCommand } : {},
36690
+ ...deps.now !== void 0 ? { now: deps.now } : {}
36691
+ });
36692
+ const emitLines = (lines) => {
36693
+ for (const line of lines) {
36694
+ try {
36695
+ deps.report(line);
36696
+ } catch {
36697
+ }
36698
+ }
36699
+ };
36700
+ const rejected = (rejection) => {
36701
+ const lines = rejection.diagnostics.entries.map((entry) => `[clio-coder:extensions] ${entry.message}`);
36702
+ emitLines(lines);
36703
+ return { ...rejection, lines: lines.slice(0, EXTENSION_RELOAD_REPORT_LINE_CAP) };
36704
+ };
36705
+ const canonicalWorkspace = () => {
36706
+ try {
36707
+ return realpathSync2(path.resolve(deps.cwd()));
36708
+ } catch {
36709
+ return null;
36710
+ }
36711
+ };
36712
+ const publishProjectHooksOnly = (workspace) => {
36713
+ if (deps.middleware.ownedGeneration("user-hooks") !== 0) return;
36714
+ const built = build(workspace, null);
36715
+ const report = deps.middleware.replaceRegistrations("user-hooks", 1, built.registrations);
36716
+ const lines = issueLines(built, report.dropped);
36717
+ if (!report.applied) lines.push(`[clio-coder:hooks] project hooks were not applied: ${report.reason ?? "refused"}`);
36718
+ emitLines(lines);
36719
+ };
36720
+ const run = (boot) => {
36721
+ const activeGeneration = deps.extensions?.snapshot()?.generation ?? 0;
36722
+ if (inFlight) {
36723
+ return rejected({
36724
+ status: "rejected",
36725
+ reason: "reentrant",
36726
+ generation: activeGeneration,
36727
+ diagnostics: { entries: [], truncated: 0 }
36728
+ });
36729
+ }
36730
+ inFlight = true;
36731
+ try {
36732
+ const workspace = canonicalWorkspace();
36733
+ if (workspace === null) {
36734
+ return rejected({
36735
+ status: "rejected",
36736
+ reason: "build-failed",
36737
+ generation: activeGeneration,
36738
+ diagnostics: failure("the working directory could not be resolved")
36739
+ });
36740
+ }
36741
+ if (deps.extensions === void 0) {
36742
+ if (boot) publishProjectHooksOnly(workspace);
36743
+ return rejected({
36744
+ status: "rejected",
36745
+ reason: "build-failed",
36746
+ generation: 0,
36747
+ diagnostics: failure("extensions domain is not loaded; restart to recover it")
36748
+ });
36749
+ }
36750
+ const prepared = deps.extensions.prepareReload();
36751
+ if (prepared.status === "rejected") {
36752
+ if (boot) publishProjectHooksOnly(workspace);
36753
+ return rejected(prepared);
36754
+ }
36755
+ const candidate = prepared.candidate;
36756
+ if (candidate.snapshot.cwd !== workspace) {
36757
+ candidate.discard();
36758
+ return rejected({
36759
+ status: "rejected",
36760
+ reason: "workspace-changed",
36761
+ generation: candidate.previousGeneration,
36762
+ diagnostics: failure(
36763
+ `extension snapshot was built for ${candidate.snapshot.cwd} but the session workspace is ${workspace}`
36764
+ )
36765
+ });
36766
+ }
36767
+ let built;
36768
+ try {
36769
+ built = build(workspace, capturedHookSourcesFor(candidate.snapshot));
36770
+ } catch (error) {
36771
+ candidate.discard();
36772
+ return rejected({
36773
+ status: "rejected",
36774
+ reason: "build-failed",
36775
+ generation: candidate.previousGeneration,
36776
+ diagnostics: failure(
36777
+ `user hook registrations could not be built: ${error instanceof Error ? error.message : String(error)}`
36778
+ )
36779
+ });
36780
+ }
36781
+ const preparedReplacement = deps.middleware.prepareRegistrationReplacement(
36782
+ "user-hooks",
36783
+ candidate.generation,
36784
+ built.registrations
36785
+ );
36786
+ if (preparedReplacement.status === "rejected") {
36787
+ candidate.discard();
36788
+ return rejected({
36789
+ status: "rejected",
36790
+ reason: "stale",
36791
+ generation: candidate.previousGeneration,
36792
+ diagnostics: failure(
36793
+ `middleware refused generation ${candidate.generation} (${preparedReplacement.reason}; active ${preparedReplacement.activeGeneration})`
36794
+ )
36795
+ });
36796
+ }
36797
+ const replacement = preparedReplacement.replacement;
36798
+ if (!candidate.current() || !replacement.current()) {
36799
+ replacement.discard();
36800
+ candidate.discard();
36801
+ return rejected({
36802
+ status: "rejected",
36803
+ reason: "stale",
36804
+ generation: candidate.previousGeneration,
36805
+ diagnostics: failure(`generation ${candidate.generation} was superseded before it could be published`)
36806
+ });
36807
+ }
36808
+ candidate.publish();
36809
+ replacement.publish();
36810
+ replacement.emitConflicts();
36811
+ const lines = issueLines(built, replacement.dropped);
36812
+ try {
36813
+ deps.onCommitted?.({
36814
+ generation: candidate.generation,
36815
+ previousGeneration: candidate.previousGeneration,
36816
+ changed: candidate.changed,
36817
+ digest: candidate.snapshot.digest
36818
+ });
36819
+ } catch (error) {
36820
+ const message = error instanceof Error ? error.message : String(error);
36821
+ lines.push(
36822
+ `[clio-coder:extensions] committed generation observer failed: ${message.slice(0, EXTENSION_SNAPSHOT_DIAGNOSTIC_MESSAGE_CAP)}`
36823
+ );
36824
+ }
36825
+ emitLines(lines);
36826
+ return {
36827
+ status: "committed",
36828
+ generation: candidate.generation,
36829
+ previousGeneration: candidate.previousGeneration,
36830
+ changed: candidate.changed,
36831
+ digest: candidate.snapshot.digest,
36832
+ added: candidate.added,
36833
+ removed: candidate.removed,
36834
+ modified: candidate.modified,
36835
+ diagnostics: candidate.snapshot.diagnostics,
36836
+ hooks: {
36837
+ registered: replacement.size,
36838
+ dropped: replacement.dropped.length,
36839
+ fileIssues: built.fileIssues.length,
36840
+ issues: built.issues.length,
36841
+ overridden: built.overridden.length
36842
+ },
36843
+ lines: lines.slice(0, EXTENSION_RELOAD_REPORT_LINE_CAP)
36844
+ };
36845
+ } finally {
36846
+ inFlight = false;
36847
+ }
36848
+ };
36849
+ return {
36850
+ applyBoot: () => run(true),
36851
+ reload: () => run(false)
36852
+ };
36853
+ }
36854
+
36500
36855
  // src/entry/panes-activation.ts
36501
36856
  init_esm_shims();
36502
36857
  function resolvePanesEnablement(flag, setting) {
@@ -37437,7 +37792,34 @@ function createDispatchAdmissionController(deps) {
37437
37792
  };
37438
37793
  }
37439
37794
 
37440
- // src/tools/dispatch.ts
37795
+ // src/tools/dispatch-schema.ts
37796
+ init_esm_shims();
37797
+ var FULL_DISPATCH_SCHEMA_COMPOSITION = Object.freeze({
37798
+ council: true,
37799
+ compete: true,
37800
+ adaptiveRouting: true
37801
+ });
37802
+ function distinctFleetRoutes(fleet) {
37803
+ const routes = /* @__PURE__ */ new Set();
37804
+ const add = (target, model) => {
37805
+ if (!target) return;
37806
+ routes.add(`${target}${model ?? ""}`);
37807
+ };
37808
+ add(fleet.default.target, fleet.default.model);
37809
+ for (const profile of Object.values(fleet.profiles)) add(profile.target, profile.model);
37810
+ for (const roster of Object.values(fleet.rosters)) {
37811
+ for (const member of roster.members) add(member.target, member.model);
37812
+ }
37813
+ return routes.size;
37814
+ }
37815
+ function dispatchSchemaCompositionFor(fleet) {
37816
+ const routing = fleet.adaptiveRouting;
37817
+ return {
37818
+ council: Object.keys(fleet.rosters).length > 0,
37819
+ compete: distinctFleetRoutes(fleet) > 1,
37820
+ adaptiveRouting: routing.roles.length > 0 || routing.postures.length > 0 || routing.agentRoles.length > 0
37821
+ };
37822
+ }
37441
37823
  var THINKING_LEVELS2 = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
37442
37824
  var CouncilMemberSchema = typebox_exports.Object(
37443
37825
  {
@@ -37457,22 +37839,20 @@ var DispatchBudgetPhaseSchema = typebox_exports.Object(
37457
37839
  );
37458
37840
  var DispatchBudgetSchema = typebox_exports.Object(
37459
37841
  {
37460
- toolCalls: typebox_exports.Integer({ minimum: 1, description: "Requested tool-call phase boundary." }),
37461
- readReserve: typebox_exports.Integer({ minimum: 0, description: "Requested tail reserve for canonical read calls." }),
37842
+ toolCalls: typebox_exports.Integer({ minimum: 1, description: "Tool-call phase boundary." }),
37843
+ readReserve: typebox_exports.Integer({ minimum: 0, description: "Tail reserve for read calls." }),
37462
37844
  retryRevision: typebox_exports.Optional(DispatchBudgetPhaseSchema)
37463
37845
  },
37464
37846
  {
37465
37847
  additionalProperties: false,
37466
- description: "Invocation budget inside the recipe policy. retryRevision preauthorizes one ceiling for retry, result-contract revision, or review revision phases."
37848
+ description: "Tool-call budget within the recipe's range; retryRevision preauthorizes one ceiling for a retry or revision phase."
37467
37849
  }
37468
37850
  );
37469
37851
  var DispatchVerificationSchema = typebox_exports.Array(
37470
37852
  typebox_exports.Object(
37471
37853
  {
37472
- check: typebox_exports.String({ description: "Declared verification check id. This is not a shell command." }),
37473
- timeout_ms: typebox_exports.Optional(
37474
- typebox_exports.Integer({ minimum: 1, description: "Requested timeout within the declared check bounds." })
37475
- )
37854
+ check: typebox_exports.String({ description: "Declared check id, never a shell command." }),
37855
+ timeout_ms: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, description: "Within the check's declared bounds." }))
37476
37856
  },
37477
37857
  { additionalProperties: false }
37478
37858
  ),
@@ -37481,118 +37861,104 @@ var DispatchVerificationSchema = typebox_exports.Array(
37481
37861
  var DispatchIntentSchema = typebox_exports.Object(
37482
37862
  {
37483
37863
  read_roots: typebox_exports.Optional(typebox_exports.Array(typebox_exports.String(), { maxItems: 32 })),
37484
- write_roots: typebox_exports.Optional(typebox_exports.Array(typebox_exports.String(), { maxItems: 32 })),
37864
+ write_roots: typebox_exports.Optional(
37865
+ typebox_exports.Array(typebox_exports.String(), {
37866
+ maxItems: 32,
37867
+ description: "Paths the worker may write; every expected output sits under one. Declaring any confines the worker and removes bash and verify from it, so put checks in verification instead of the task text."
37868
+ })
37869
+ ),
37485
37870
  relevant_paths: typebox_exports.Optional(typebox_exports.Array(typebox_exports.String(), { maxItems: 32 })),
37486
- expected_outputs: typebox_exports.Optional(typebox_exports.Array(typebox_exports.String(), { maxItems: 32 })),
37871
+ expected_outputs: typebox_exports.Optional(
37872
+ typebox_exports.Array(typebox_exports.String(), { maxItems: 32, description: "Output paths only, never a description of the change." })
37873
+ ),
37487
37874
  verification: typebox_exports.Optional(DispatchVerificationSchema)
37488
37875
  },
37489
37876
  {
37490
37877
  additionalProperties: false,
37491
- description: "Typed repository-relative path and output intent. Declare it on every dispatch: declared paths select the project rules that apply to them and pin worker context, and omitting it falls back to reading path-like tokens out of your task and briefing text, which can miss an applicable rule. Verification checks are declared ids from package scripts or .clio-coder/verifiers.yaml, not shell commands. In a batch, per-task intent narrows the top-level intent and is refused if it reaches outside it."
37878
+ description: "Repository-relative paths and outputs. Declare it on every dispatch: it selects the project rules that apply and pins worker context, where omitting it falls back to path tokens scraped from the task text. verification entries are declared check ids from package scripts or .clio-coder/verifiers.yaml. Per-task intent must fit inside the top-level intent."
37492
37879
  }
37493
37880
  );
37494
- function admissionFailureResult(message) {
37495
- return {
37496
- kind: "error",
37497
- message: message.startsWith("dispatch: ") ? message : `dispatch: plan admission failed: ${message}`
37498
- };
37499
- }
37500
- function createDispatchTool(inputDeps, surfaceOptions = {}) {
37501
- const deps = {
37502
- ...inputDeps,
37503
- runEvents: inputDeps.runEvents ?? createDispatchRunEventRegistry()
37504
- };
37505
- const admission = createDispatchAdmissionController(deps);
37506
- let runnerPromise = null;
37507
- const loadRunner = () => {
37508
- runnerPromise ??= (surfaceOptions.loadRunner ?? (() => import("./dispatch-runner-RGIE5PCT.js")))();
37509
- return runnerPromise;
37510
- };
37511
- return {
37512
- name: ToolNames.Dispatch,
37513
- description: 'Dispatch one bounded task with task, or a batch with tasks (never both). Singular example: {agent:"debugger", task:"Verify the receipt boundary", briefing:"Prior receipt evidence...", detach:true}. task is the worker assignment; briefing is separate bounded parent context/data and cannot replace task. Ordinary calls auto-wait; detach:true returns ids for monitoring/steering, and collect is the authoritative terminal batch operation before final synthesis. Batch modes are parallel (default), sequential, pipeline, or compete. Task objects may include persona, tool_profile, and a recipe-admitted budget envelope. Sealed receipts are durable evidence; report receipt integrity, evidence verification, briefing provenance, and project-context provenance separately. Call with list:true to see agents. Do not repeat an identical successful dispatch in the same user turn. Prefer this tool over inline exploration whenever work is read-only fan-out, parallel investigation, or the operator asked for a worker by name; if you cannot dispatch, say so plainly and name the reason, and never narrate or summarize a worker you did not actually dispatch.',
37514
- parameters: typebox_exports.Object({
37515
- list: typebox_exports.Optional(typebox_exports.Boolean({ description: "List available agents instead of dispatching." })),
37881
+ var DISPATCH_DEFS = { intent: DispatchIntentSchema, budget: DispatchBudgetSchema };
37882
+ var IntentRef = typebox_exports.Unsafe({ $ref: "#/$defs/intent" });
37883
+ var BudgetRef = typebox_exports.Unsafe({ $ref: "#/$defs/budget" });
37884
+ var MODE_DESCRIPTION = {
37885
+ full: "parallel (default); sequential; pipeline, where each task receives the previous output; compete, where candidates build the same task in scratch worktrees and a judge picks; council, where roster members answer the same question.",
37886
+ noCouncil: "parallel (default); sequential; pipeline, where each task receives the previous output; compete, where candidates build the same task in scratch worktrees and a judge picks.",
37887
+ noCompete: "parallel (default); sequential; pipeline, where each task receives the previous output; council, where roster members answer the same question.",
37888
+ neither: "parallel (default); sequential; pipeline, where each task receives the previous output."
37889
+ };
37890
+ function buildDispatchParameters(composition = FULL_DISPATCH_SCHEMA_COMPOSITION) {
37891
+ const modes = [
37892
+ "parallel",
37893
+ "sequential",
37894
+ "pipeline",
37895
+ ...composition.compete ? ["compete"] : [],
37896
+ ...composition.council ? ["council"] : []
37897
+ ];
37898
+ const modeDescription = composition.compete && composition.council ? MODE_DESCRIPTION.full : composition.compete ? MODE_DESCRIPTION.noCouncil : composition.council ? MODE_DESCRIPTION.noCompete : MODE_DESCRIPTION.neither;
37899
+ return typebox_exports.Object(
37900
+ {
37901
+ list: typebox_exports.Optional(typebox_exports.Boolean({ description: "List the agent roster instead of dispatching." })),
37516
37902
  from_scout: typebox_exports.Optional(
37517
37903
  typebox_exports.Object(
37518
37904
  {
37519
- run_id: typebox_exports.String({ description: "Exact terminal Scout run id." }),
37520
- receipt_digest: typebox_exports.String({ description: "Exact sha256 receipt digest." })
37905
+ run_id: typebox_exports.String({ description: "Terminal Scout run id." }),
37906
+ receipt_digest: typebox_exports.String({ description: "Its sha256 receipt digest." })
37521
37907
  },
37522
37908
  {
37523
37909
  additionalProperties: false,
37524
- description: "Compile an authenticated split Scout result into one new approval-gated dependency plan; cannot combine with any other argument."
37910
+ description: "Compile a Scout split result into one approval-gated dependency plan; use with no other argument."
37525
37911
  }
37526
37912
  )
37527
37913
  ),
37528
- task: typebox_exports.Optional(
37529
- typebox_exports.String({
37530
- description: "Singular worker assignment/instructions. Use tasks instead for a batch; briefing is separate context and cannot replace task."
37531
- })
37532
- ),
37914
+ task: typebox_exports.Optional(typebox_exports.String({ description: "One worker assignment. Use tasks for a batch." })),
37533
37915
  tasks: typebox_exports.Optional(
37534
37916
  typebox_exports.Array(
37535
37917
  typebox_exports.Union([
37536
37918
  typebox_exports.String(),
37919
+ // A task carries only what varies per task. persona, tool_profile,
37920
+ // cwd, and apply come from the batch defaults (admission still reads
37921
+ // them when a caller sends them; the schema no longer spends the
37922
+ // tokens advertising them twice).
37537
37923
  typebox_exports.Object({
37538
- task: typebox_exports.String({ description: "Concrete agent task with expected output and constraints." }),
37924
+ task: typebox_exports.String({ description: "The assignment, with expected output and constraints." }),
37539
37925
  briefing: typebox_exports.Optional(
37540
- typebox_exports.String({
37541
- description: `Per-task parent context/data override, max ${DISPATCH_BRIEFING_MAX_BYTES} UTF-8 bytes.`
37542
- })
37543
- ),
37544
- agent: typebox_exports.Optional(typebox_exports.String({ description: "Agent recipe id (default coder)." })),
37545
- persona: typebox_exports.Optional(
37546
- typebox_exports.String({
37547
- description: "Ad-hoc specialist persona to substitute for the recipe body inside the stable worker shell, max 8000 chars."
37548
- })
37549
- ),
37550
- tool_profile: typebox_exports.Optional(
37551
- StringEnum(TOOL_PROFILE_NAMES, { description: "Narrow this worker's available tools." })
37926
+ typebox_exports.String({ description: `Per-task parent context, max ${DISPATCH_BRIEFING_MAX_BYTES} UTF-8 bytes.` })
37552
37927
  ),
37553
- budget: typebox_exports.Optional(DispatchBudgetSchema),
37928
+ agent: typebox_exports.Optional(typebox_exports.String({ description: "Recipe id (default coder)." })),
37929
+ budget: typebox_exports.Optional(BudgetRef),
37554
37930
  target: typebox_exports.Optional(typebox_exports.String()),
37555
37931
  model: typebox_exports.Optional(typebox_exports.String()),
37556
37932
  node: typebox_exports.Optional(typebox_exports.String({ description: "Fleet node pin: local or a fleet.nodes id." })),
37557
- cwd: typebox_exports.Optional(typebox_exports.String()),
37558
37933
  worktree: typebox_exports.Optional(typebox_exports.Literal(true, { description: "Run this writer in an isolated git worktree." })),
37559
- apply: typebox_exports.Optional(
37560
- StringEnum(["merge", "preserve"], { description: "Merge successful work by default, or preserve its branch." })
37561
- ),
37562
- intent: typebox_exports.Optional(DispatchIntentSchema),
37563
- gate: typebox_exports.Optional(
37564
- typebox_exports.String({
37565
- description: "Shorthand for one intent.verification declared check id. This is not a shell command."
37566
- })
37567
- )
37934
+ intent: typebox_exports.Optional(IntentRef),
37935
+ gate: typebox_exports.Optional(typebox_exports.String({ description: "One declared check id, shorthand for intent.verification." }))
37568
37936
  })
37569
37937
  ]),
37570
- { description: "Tasks to dispatch; a single object or string is accepted and wrapped." }
37938
+ { description: "Batch of assignments; one string or object is wrapped." }
37571
37939
  )
37572
37940
  ),
37573
- mode: typebox_exports.Optional(
37574
- StringEnum(["parallel", "sequential", "pipeline", "compete", "council"], {
37575
- description: "Run tasks concurrently (default), one at a time, as a pipeline where each task receives the previous task's output as input data, or as a compete where N candidates build the same single task in scratch worktrees and a judge picks the winner."
37576
- })
37577
- ),
37578
- roster: typebox_exports.Optional(typebox_exports.String({ description: "Configured workers.rosters name for council mode." })),
37579
- members: typebox_exports.Optional(typebox_exports.Array(CouncilMemberSchema, { minItems: 2, maxItems: 5 })),
37580
- synthesis: typebox_exports.Optional(StringEnum(["none", "judge", "vote"])),
37581
- rounds: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, maximum: 3 })),
37941
+ mode: typebox_exports.Optional(StringEnum(modes, { description: modeDescription })),
37942
+ ...composition.council ? {
37943
+ roster: typebox_exports.Optional(typebox_exports.String({ description: "Configured workers.rosters name (council)." })),
37944
+ members: typebox_exports.Optional(
37945
+ typebox_exports.Array(CouncilMemberSchema, { minItems: 2, maxItems: 5, description: "Explicit council members, 2 to 5." })
37946
+ ),
37947
+ synthesis: typebox_exports.Optional(StringEnum(["none", "judge", "vote"], { description: "Council synthesis." })),
37948
+ rounds: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, maximum: 3, description: "Council rounds." }))
37949
+ } : {},
37582
37950
  writers: typebox_exports.Optional(
37583
- typebox_exports.Literal(1, {
37584
- description: "Serialize writer admission in declared task order while readers continue concurrently."
37585
- })
37951
+ typebox_exports.Literal(1, { description: "Serialize writer admission in task order while readers run concurrently." })
37586
37952
  ),
37587
37953
  worktree: typebox_exports.Optional(
37588
37954
  typebox_exports.Literal(true, { description: "Run a singular writer task in an isolated git worktree." })
37589
37955
  ),
37590
37956
  apply: typebox_exports.Optional(
37591
- StringEnum(["merge", "preserve"], { description: "Merge successful work by default, or preserve its branch." })
37957
+ StringEnum(["merge", "preserve"], { description: "merge (default) or preserve the worktree branch." })
37592
37958
  ),
37593
37959
  detach: typebox_exports.Optional(
37594
37960
  typebox_exports.Boolean({
37595
- description: "Return immediately after admission with a batch id and run ids; runs continue in the background. Collect later with the monitor tool. Parallel mode only."
37961
+ description: "Return run ids immediately and collect with monitor before final synthesis. Parallel mode only."
37596
37962
  })
37597
37963
  ),
37598
37964
  review: typebox_exports.Optional(
@@ -37601,96 +37967,120 @@ function createDispatchTool(inputDeps, surfaceOptions = {}) {
37601
37967
  typebox_exports.Boolean(),
37602
37968
  typebox_exports.Object({
37603
37969
  reviewer: typebox_exports.Optional(
37604
- typebox_exports.String({
37605
- description: "Reviewer agent recipe id (default: the builder's agent as a read-only reviewer)."
37606
- })
37970
+ typebox_exports.String({ description: "Reviewer recipe id (default: the builder's agent, read-only)." })
37607
37971
  ),
37608
37972
  max_cycles: typebox_exports.Optional(
37609
- typebox_exports.Number({
37610
- description: "Max review/revise cycles before the gate needs an operator decision (default 2, max 4)."
37611
- })
37973
+ typebox_exports.Number({ description: "Review/revise cycles before an operator decision (default 2, max 4)." })
37612
37974
  ),
37613
37975
  node: typebox_exports.Optional(typebox_exports.String({ description: "Fleet node pin for the reviewer." })),
37614
- model: typebox_exports.Optional(typebox_exports.String({ description: "Model override for the reviewer." })),
37615
- target: typebox_exports.Optional(typebox_exports.String({ description: "Target override for the reviewer." }))
37976
+ model: typebox_exports.Optional(typebox_exports.String({ description: "Model for the reviewer." })),
37977
+ target: typebox_exports.Optional(typebox_exports.String({ description: "Target for the reviewer." }))
37616
37978
  })
37617
37979
  ],
37618
37980
  {
37619
- description: "Reviewer gate for a single task: the builder runs, a read-only reviewer verdicts pass/revise/fail against the workspace, and revise re-runs the builder with the findings."
37981
+ description: "Reviewer gate for one task: a read-only reviewer verdicts pass, revise, or fail, and revise re-runs the builder with the findings."
37620
37982
  }
37621
37983
  )
37622
37984
  ),
37623
- candidates: typebox_exports.Optional(typebox_exports.Number({ description: "Compete candidates 2..4 (mode=compete only, default 2)." })),
37624
- judge: typebox_exports.Optional(
37625
- typebox_exports.Object(
37626
- {
37627
- agent: typebox_exports.Optional(typebox_exports.String({ description: "Judge agent recipe id (default: the builder's agent)." })),
37628
- model: typebox_exports.Optional(typebox_exports.String()),
37629
- target: typebox_exports.Optional(typebox_exports.String()),
37630
- node: typebox_exports.Optional(typebox_exports.String({ description: "Fleet node pin for the judge." }))
37631
- },
37632
- { description: "Read-only judge that ranks compete candidates." }
37633
- )
37634
- ),
37635
- apply_winner: typebox_exports.Optional(
37636
- typebox_exports.Object(
37637
- {
37638
- branch: typebox_exports.String({ description: "Preserved winner branch: clio-coder/compete/<group>/<n>." }),
37639
- cwd: typebox_exports.Optional(typebox_exports.String({ description: "Repository root (default: current directory)." }))
37640
- },
37641
- {
37642
- description: "Apply a preserved compete winner: merges its branch and cleans up the compete group. Supervised autonomy parks this call so the operator confirms the winner."
37643
- }
37985
+ ...composition.compete ? {
37986
+ candidates: typebox_exports.Optional(typebox_exports.Number({ description: "Compete candidates, 2 to 4 (default 2)." })),
37987
+ judge: typebox_exports.Optional(
37988
+ typebox_exports.Object(
37989
+ {
37990
+ agent: typebox_exports.Optional(typebox_exports.String({ description: "Judge recipe id (default: the builder's agent)." })),
37991
+ model: typebox_exports.Optional(typebox_exports.String()),
37992
+ target: typebox_exports.Optional(typebox_exports.String()),
37993
+ node: typebox_exports.Optional(typebox_exports.String({ description: "Fleet node pin for the judge." }))
37994
+ },
37995
+ { description: "Read-only judge that ranks compete candidates." }
37996
+ )
37997
+ ),
37998
+ apply_winner: typebox_exports.Optional(
37999
+ typebox_exports.Object(
38000
+ {
38001
+ branch: typebox_exports.String({ description: "Preserved winner branch: clio-coder/compete/<group>/<n>." }),
38002
+ cwd: typebox_exports.Optional(typebox_exports.String({ description: "Repository root (default: current directory)." }))
38003
+ },
38004
+ {
38005
+ description: "Merge a preserved compete winner and clean up its group; supervised autonomy parks this for operator confirmation."
38006
+ }
38007
+ )
37644
38008
  )
37645
- ),
38009
+ } : {},
37646
38010
  agent: typebox_exports.Optional(
37647
38011
  typebox_exports.String({
37648
- description: "Default agent recipe for string tasks, or auto for bounded agent selection (default coder; researcher for mode council)."
38012
+ description: composition.council ? "Default recipe id for string tasks, or auto (default coder; researcher for council)." : "Default recipe id for string tasks, or auto (default coder)."
37649
38013
  })
37650
38014
  ),
37651
38015
  briefing: typebox_exports.Optional(
37652
38016
  typebox_exports.String({
37653
- description: `Separate bounded parent context/data for task, or the shared default for tasks; never worker instructions and never a task replacement. Max ${DISPATCH_BRIEFING_MAX_BYTES} UTF-8 bytes.`
37654
- })
37655
- ),
37656
- intent: typebox_exports.Optional(DispatchIntentSchema),
37657
- gate: typebox_exports.Optional(
37658
- typebox_exports.String({
37659
- description: "Shorthand for one intent.verification declared check id. This is not a shell command."
38017
+ description: `Parent context for task, or the shared default for tasks; never instructions. Max ${DISPATCH_BRIEFING_MAX_BYTES} UTF-8 bytes.`
37660
38018
  })
37661
38019
  ),
37662
- persona: typebox_exports.Optional(
37663
- typebox_exports.String({ description: "Default ad-hoc specialist persona for dispatched tasks, max 8000 chars." })
37664
- ),
38020
+ intent: typebox_exports.Optional(IntentRef),
38021
+ gate: typebox_exports.Optional(typebox_exports.String({ description: "One declared check id, shorthand for intent.verification." })),
38022
+ persona: typebox_exports.Optional(typebox_exports.String({ description: "Default persona for the batch, max 8000 chars." })),
37665
38023
  tool_profile: typebox_exports.Optional(StringEnum(TOOL_PROFILE_NAMES, { description: "Default worker tool profile." })),
37666
- budget: typebox_exports.Optional(DispatchBudgetSchema),
37667
- target: typebox_exports.Optional(typebox_exports.String({ description: "Default configured target id (omit for fleet default)." })),
38024
+ budget: typebox_exports.Optional(BudgetRef),
38025
+ target: typebox_exports.Optional(typebox_exports.String({ description: "Default target id (omit for the fleet default)." })),
37668
38026
  model: typebox_exports.Optional(typebox_exports.String({ description: "Default model override." })),
37669
- node: typebox_exports.Optional(
37670
- typebox_exports.String({ description: "Default fleet node pin: local or a fleet.nodes id (omit for automatic placement)." })
37671
- ),
38027
+ node: typebox_exports.Optional(typebox_exports.String({ description: "Default fleet node pin (omit for automatic placement)." })),
37672
38028
  routing: typebox_exports.Optional(
37673
38029
  typebox_exports.Object(
37674
38030
  {
37675
- posture: typebox_exports.Optional(StringEnum(["manual", "quality", "balanced", "latency", "economy"])),
38031
+ ...composition.adaptiveRouting ? { posture: typebox_exports.Optional(StringEnum(["manual", "quality", "balanced", "latency", "economy"])) } : {},
37676
38032
  maxCostUsd: typebox_exports.Optional(typebox_exports.Number({ exclusiveMinimum: 0 })),
37677
38033
  deadlineMs: typebox_exports.Optional(typebox_exports.Integer({ exclusiveMinimum: 0 })),
37678
- minimumQuality: typebox_exports.Optional(typebox_exports.Number({ minimum: 0, maximum: 1 })),
38034
+ ...composition.adaptiveRouting ? { minimumQuality: typebox_exports.Optional(typebox_exports.Number({ minimum: 0, maximum: 1 })) } : {},
37679
38035
  requiredCapabilities: typebox_exports.Optional(typebox_exports.Array(typebox_exports.String({ minLength: 1 }))),
37680
- locality: typebox_exports.Optional(StringEnum(["local-only", "prefer-local", "any"])),
37681
- failover: typebox_exports.Optional(StringEnum(["none", "approved"]))
38036
+ ...composition.adaptiveRouting ? {
38037
+ locality: typebox_exports.Optional(StringEnum(["local-only", "prefer-local", "any"])),
38038
+ failover: typebox_exports.Optional(StringEnum(["none", "approved"]))
38039
+ } : {}
37682
38040
  },
37683
38041
  {
37684
38042
  additionalProperties: false,
37685
- description: "Advisory posture plus hard routing bounds. Exact target/model/node pins remain manual."
38043
+ description: composition.adaptiveRouting ? "Advisory posture and hard routing bounds; exact target, model, and node pins stay manual." : "Hard routing bounds: cost ceiling, deadline, and required model capabilities."
37686
38044
  }
37687
38045
  )
37688
38046
  ),
37689
38047
  thinking_level: typebox_exports.Optional(StringEnum(THINKING_LEVELS2)),
37690
- cwd: typebox_exports.Optional(typebox_exports.String({ description: "Default agent working directory." })),
38048
+ cwd: typebox_exports.Optional(typebox_exports.String({ description: "Default worker working directory." })),
37691
38049
  timeout_ms: typebox_exports.Optional(typebox_exports.Number({ description: "Abort the dispatch after this many ms." })),
37692
38050
  max_output_bytes: typebox_exports.Optional(typebox_exports.Number({ description: "Max summary bytes returned." }))
37693
- }),
38051
+ },
38052
+ { $defs: DISPATCH_DEFS }
38053
+ );
38054
+ }
38055
+
38056
+ // src/tools/dispatch.ts
38057
+ function admissionFailureResult(message) {
38058
+ return {
38059
+ kind: "error",
38060
+ message: message.startsWith("dispatch: ") ? message : `dispatch: plan admission failed: ${message}`
38061
+ };
38062
+ }
38063
+ function createDispatchTool(inputDeps, surfaceOptions = {}) {
38064
+ const deps = {
38065
+ ...inputDeps,
38066
+ runEvents: inputDeps.runEvents ?? createDispatchRunEventRegistry()
38067
+ };
38068
+ const admission = createDispatchAdmissionController(deps);
38069
+ let runnerPromise = null;
38070
+ const loadRunner = () => {
38071
+ runnerPromise ??= (surfaceOptions.loadRunner ?? (() => import("./dispatch-runner-2QQAITS3.js")))();
38072
+ return runnerPromise;
38073
+ };
38074
+ return {
38075
+ name: ToolNames.Dispatch,
38076
+ // The delegation policy (when to delegate, spot-checks, repeats, refusals,
38077
+ // never narrating a worker you did not run) lives once in the Fleet and
38078
+ // Delegation prompt sections. This description says only what the call
38079
+ // shape is; every field below carries one discriminating sentence.
38080
+ description: "Delegate to a fleet worker: task dispatches one assignment, tasks dispatches a batch, never both. briefing is bounded parent context, never instructions. A call auto-waits for the sealed receipt; detach:true returns run ids to monitor and collect later. Declare intent on every dispatch. list:true shows the roster.",
38081
+ // Composed once per session: council, compete, and adaptive-routing fields
38082
+ // are advertised only when the fleet can exercise them (see dispatch-schema.ts).
38083
+ parameters: buildDispatchParameters(deps.getSchemaComposition?.() ?? FULL_DISPATCH_SCHEMA_COMPOSITION),
37694
38084
  baseActionClass: "dispatch",
37695
38085
  executionMode: "sequential",
37696
38086
  prepareAdmissionArguments: admission.prepareAdmissionArguments,
@@ -37731,6 +38121,7 @@ function registerAllTools(registry, deps = {}) {
37731
38121
  ...deps.getAutonomy ? { getAutonomy: deps.getAutonomy } : {},
37732
38122
  ...deps.getCostCeilingUsd ? { getCostCeilingUsd: deps.getCostCeilingUsd } : {},
37733
38123
  ...deps.getWorkerRosters ? { getWorkerRosters: deps.getWorkerRosters } : {},
38124
+ ...deps.getDispatchSchemaComposition ? { getSchemaComposition: deps.getDispatchSchemaComposition } : {},
37734
38125
  ...deps.dispatchBackground ? { background: deps.dispatchBackground } : {},
37735
38126
  ...deps.competeMuxWorktrees ? { competeWorktrees: { mux: deps.competeMuxWorktrees } } : {}
37736
38127
  };
@@ -37744,7 +38135,7 @@ function registerAllTools(registry, deps = {}) {
37744
38135
  ...builtin(
37745
38136
  lazyTool(
37746
38137
  monitorToolSurface,
37747
- async () => (await import("./monitor-CEKVSYTS.js")).createMonitorTool({ dispatch, runEvents: dispatchRunEvents })
38138
+ async () => (await import("./monitor-E4ASVUJH.js")).createMonitorTool({ dispatch, runEvents: dispatchRunEvents })
37748
38139
  ),
37749
38140
  {
37750
38141
  path: "src/tools/monitor.ts",
@@ -37754,7 +38145,7 @@ function registerAllTools(registry, deps = {}) {
37754
38145
  });
37755
38146
  registry.register({
37756
38147
  ...builtin(
37757
- lazyTool(steerToolSurface, async () => (await import("./steer-XAVHJM22.js")).createSteerTool({ dispatch })),
38148
+ lazyTool(steerToolSurface, async () => (await import("./steer-Z5DO23FJ.js")).createSteerTool({ dispatch })),
37758
38149
  {
37759
38150
  path: "src/tools/steer.ts",
37760
38151
  scope: "core"
@@ -37766,7 +38157,7 @@ function registerAllTools(registry, deps = {}) {
37766
38157
  const panes = deps.panes;
37767
38158
  registry.register({
37768
38159
  ...builtin(
37769
- lazyTool(panesToolSurface, async () => (await import("./panes-7STHOAUJ.js")).createPanesTool({ panes })),
38160
+ lazyTool(panesToolSurface, async () => (await import("./panes-E3RUXOW5.js")).createPanesTool({ panes })),
37770
38161
  { path: "src/tools/panes.ts", scope: "core" }
37771
38162
  )
37772
38163
  });
@@ -38250,8 +38641,8 @@ async function bootOrchestrator(options = {}) {
38250
38641
  preserveActiveGroups: pendingCompeteGroups,
38251
38642
  preserveAllActive: pendingGate.errors.length > 0
38252
38643
  });
38253
- for (const failure of recovery.failed) {
38254
- bootStderr(`[dispatch] compete recovery preserved ${failure.group}: ${failure.message}
38644
+ for (const failure2 of recovery.failed) {
38645
+ bootStderr(`[dispatch] compete recovery preserved ${failure2.group}: ${failure2.message}
38255
38646
  `);
38256
38647
  }
38257
38648
  } catch (err) {
@@ -38263,7 +38654,7 @@ async function bootOrchestrator(options = {}) {
38263
38654
  let protectedArtifactStateForDispatch = null;
38264
38655
  const muxInteractive = !options.headless && options.acp === void 0 && process.env.CLIO_CODER_INTERACTIVE === "1";
38265
38656
  const muxEnablement = resolvePanesEnablement(options.panes, options.startupSettings?.interface.panes.enabled);
38266
- const withPanes = muxInteractive && muxEnablement !== "off" ? await import("./with-panes-OBOBFIIR.js") : null;
38657
+ const withPanes = muxInteractive && muxEnablement !== "off" ? await import("./with-panes-BYOJCLAM.js") : null;
38267
38658
  const result = await loadDomains(
38268
38659
  [
38269
38660
  options.startupSettings ? createConfigDomainModule(options.startupSettings) : ConfigDomainModule,
@@ -38399,7 +38790,7 @@ async function bootOrchestrator(options = {}) {
38399
38790
  else resolvedResumeId = latest.id;
38400
38791
  }
38401
38792
  }
38402
- const resumeId = resolvedResumeId ?? process.env.CLIO_CODER_RESUME_SESSION_ID?.trim();
38793
+ const resumeId = resolvedResumeId;
38403
38794
  let resumedSessionAtBoot = false;
38404
38795
  if (resumeId && session && headlessResumeFailure === null) {
38405
38796
  try {
@@ -38412,7 +38803,6 @@ async function bootOrchestrator(options = {}) {
38412
38803
  `);
38413
38804
  }
38414
38805
  }
38415
- Reflect.deleteProperty(process.env, "CLIO_CODER_RESUME_SESSION_ID");
38416
38806
  if (headlessResumeFailure !== null) {
38417
38807
  bootStderr(`clio-coder run: ${headlessResumeFailure}
38418
38808
  `);
@@ -38420,6 +38810,17 @@ async function bootOrchestrator(options = {}) {
38420
38810
  return { exitCode: 2, bootTimeMs: timer.snapshot().totalMs };
38421
38811
  }
38422
38812
  middleware.setDiagnosticSink((diagnostic) => {
38813
+ if (diagnostic.kind === "registration_conflict") {
38814
+ bus.emit(BusChannels.MiddlewareHookFailed, {
38815
+ kind: "registration_conflict",
38816
+ registrationId: diagnostic.registrationId,
38817
+ hook: "on_compaction",
38818
+ at: Date.now(),
38819
+ message: formatRegistrationConflict(diagnostic)
38820
+ });
38821
+ if (!interactive) writeMiddlewareDiagnosticToStderr(diagnostic);
38822
+ return;
38823
+ }
38423
38824
  bus.emit(BusChannels.MiddlewareHookFailed, {
38424
38825
  kind: diagnostic.kind,
38425
38826
  registrationId: diagnostic.registrationId,
@@ -38453,7 +38854,7 @@ async function bootOrchestrator(options = {}) {
38453
38854
  safety,
38454
38855
  bus,
38455
38856
  turnBlockBudget: INTERACTIVE_LOOP_BLOCK_BUDGET,
38456
- turnToolCallBudget: readOrchTurnToolCallBudget(),
38857
+ turnToolCallBudget: () => readOrchTurnToolCallBudget(),
38457
38858
  // Interactive/headless/ACP all share this orchestrator guard: at the
38458
38859
  // block budget, lock tools for the rest of the turn so the model
38459
38860
  // answers from what it gathered instead of hard-cancelling a turn that
@@ -38608,23 +39009,18 @@ async function bootOrchestrator(options = {}) {
38608
39009
  middleware.registerHook(createFileMutationObserver(({ paths }) => contextDomain.noteFileChanges(paths)));
38609
39010
  }
38610
39011
  const hookReceiptLog = createHookReceiptLog({ persistPath: join12(clioStateDir(), "hook-receipts.json") });
38611
- const extensionHookRoots = (extensions?.list(process.cwd()) ?? []).filter((ext) => ext.enabled && ext.effective).map((ext) => ({ id: ext.id, rootPath: ext.rootPath }));
38612
- const userHooks = installUserHooks({
38613
- cwd: process.cwd(),
38614
- extensions: extensionHookRoots,
38615
- registerHook: (registration) => middleware.registerHook(registration),
38616
- recordReceipt: (receipt) => hookReceiptLog.record(receipt)
38617
- });
38618
- if (!interactive) {
38619
- for (const issue of userHooks.fileIssues) {
38620
- process.stderr.write(`[clio-coder:hooks] ${issue.message}
38621
- `);
38622
- }
38623
- for (const issue of userHooks.issues) {
38624
- process.stderr.write(`[clio-coder:hooks] ${issue.source.sourcePath}#${issue.index}: ${issue.issues.join("; ")}
39012
+ const extensionReload = createExtensionReloadCoordinator({
39013
+ extensions,
39014
+ middleware,
39015
+ cwd: () => process.cwd(),
39016
+ recordReceipt: (receipt) => hookReceiptLog.record(receipt),
39017
+ report: (line) => {
39018
+ if (!interactive) process.stderr.write(`${line}
38625
39019
  `);
38626
- }
38627
- }
39020
+ },
39021
+ onCommitted: (event) => bus.emit(BusChannels.ExtensionsReloaded, event)
39022
+ });
39023
+ extensionReload.applyBoot();
38628
39024
  termination.onDrain(() => hookReceiptLog.flush());
38629
39025
  let activeAcpSessionAutonomy = null;
38630
39026
  const resolveBaselineAutonomy = () => effectiveSettingsForDispatch?.().safety.autonomy ?? options.headless?.autonomy ?? (config?.get() ?? readSettings()).safety.autonomy ?? "auto-edit";
@@ -38749,6 +39145,7 @@ async function bootOrchestrator(options = {}) {
38749
39145
  ...panes && mux?.mode !== "none" ? { panes } : {},
38750
39146
  getCostCeilingUsd: () => result.getContract("scheduling")?.ceilingUsd() ?? 0,
38751
39147
  ...config ? { getWorkerRosters: () => config.get().fleet.rosters } : {},
39148
+ ...config ? { getDispatchSchemaComposition: () => dispatchSchemaCompositionFor(config.get().fleet) } : {},
38752
39149
  getSkillLoaderOptions: () => ({
38753
39150
  trustProjectCompatRoots: config?.get().integrations.projectResources.trustProjectImports === true,
38754
39151
  disableDiscovery: options.noSkills === true || options.headless?.noSkills === true,
@@ -38759,7 +39156,7 @@ async function bootOrchestrator(options = {}) {
38759
39156
  applyHeadlessSettingsOverlay(config?.get() ?? readSettings(), options.headless)
38760
39157
  );
38761
39158
  const sessionOverrides = new Map(
38762
- options.headless?.autonomy === void 0 ? [] : [["autonomy", options.headless.autonomy]]
39159
+ options.headless?.autonomy === void 0 ? [] : [["safety.autonomy", options.headless.autonomy]]
38763
39160
  );
38764
39161
  let sessionStateGeneration = 0;
38765
39162
  let cachedSettingsBase = null;
@@ -38767,7 +39164,10 @@ async function bootOrchestrator(options = {}) {
38767
39164
  let cachedSettingsView = null;
38768
39165
  const bumpSessionState = () => {
38769
39166
  sessionStateGeneration += 1;
38770
- setGitCommitAttributionEnabled(getCurrentSettings().integrations.git.commitAttribution);
39167
+ const settings = getCurrentSettings();
39168
+ configureGuardrails(guardrailValuesFromSettings(settings));
39169
+ configureRunEventJournal(settings.fleet.history.journal);
39170
+ setGitCommitAttributionEnabled(settings.integrations.git.commitAttribution);
38771
39171
  };
38772
39172
  const getCurrentSettings = () => {
38773
39173
  const base = config?.get();
@@ -38783,8 +39183,8 @@ async function bootOrchestrator(options = {}) {
38783
39183
  };
38784
39184
  effectiveSettingsForDispatch = getCurrentSettings;
38785
39185
  bumpSessionState();
38786
- const unsubscribeCommitAttributionSync = bus.on(BusChannels.ConfigHotReload, () => bumpSessionState());
38787
- termination.onDrain(() => unsubscribeCommitAttributionSync());
39186
+ const unsubscribeSettingsProjectionSync = bus.on(BusChannels.ConfigHotReload, () => bumpSessionState());
39187
+ termination.onDrain(() => unsubscribeSettingsProjectionSync());
38788
39188
  const getTaskMemorySeedOffer = () => {
38789
39189
  return taskMemoryHandoffSeedOffer(process.cwd(), getCurrentSettings().context.memory.enabled);
38790
39190
  };
@@ -38876,7 +39276,7 @@ async function bootOrchestrator(options = {}) {
38876
39276
  persistSavedMutation((fresh) => {
38877
39277
  const persisted = structuredClone(next);
38878
39278
  restoreRoutingFields(persisted, fresh);
38879
- for (const path of sessionOverrides.keys()) setAtPath(persisted, path, getAtPath(fresh, path));
39279
+ for (const path2 of sessionOverrides.keys()) setAtPath(persisted, path2, getAtPath(fresh, path2));
38880
39280
  if (patch) mergeRoutingPatchIntoSettings(persisted, patch);
38881
39281
  return persisted;
38882
39282
  });
@@ -39205,6 +39605,7 @@ async function bootOrchestrator(options = {}) {
39205
39605
  ...initialNotices.length > 0 ? { initialNotices } : {},
39206
39606
  ...resources ? { resources } : {},
39207
39607
  ...extensions ? { extensions } : {},
39608
+ reloadExtensions: () => extensionReload.reload(),
39208
39609
  ...interop ? { interop } : {},
39209
39610
  ...share ? { share } : {},
39210
39611
  ...mux ? { mux } : {},
@@ -39404,4 +39805,4 @@ async function bootOrchestrator(options = {}) {
39404
39805
  export {
39405
39806
  bootOrchestrator
39406
39807
  };
39407
- //# sourceMappingURL=orchestrator-77BAP6BC.js.map
39808
+ //# sourceMappingURL=orchestrator-DDMPR3PY.js.map