@iowarp/clio-coder 0.4.0 → 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 (751) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/CONTRIBUTING.md +59 -36
  3. package/README.md +407 -375
  4. package/SECURITY.md +2 -1
  5. package/dist/{acp-G5WJBNCT.js → acp-TMDQZDIG.js} +14 -14
  6. package/dist/{agents-FMV2Q5G4.js → agents-5N5NG3XG.js} +45 -34
  7. package/dist/assets/codewiki.json +1 -1
  8. package/dist/{auth-3IDSJEIK.js → auth-Z5CCBXKQ.js} +22 -21
  9. package/dist/{builtins-XCZWXSC7.js → builtins-K6TNDT24.js} +6 -6
  10. package/dist/{chunk-GR5G2PVF.js → chunk-2HFQNRV3.js} +15 -10
  11. package/dist/{chunk-PQEFIJ36.js → chunk-2LEAKD4C.js} +1 -2
  12. package/dist/{chunk-HJJTYUHX.js → chunk-2NHR3NAY.js} +168 -1406
  13. package/dist/chunk-2X4RYJTJ.js +39 -0
  14. package/dist/{chunk-UXMFQ54G.js → chunk-2Z2IKEXI.js} +39 -43
  15. package/dist/{chunk-SST6Z5JA.js → chunk-336NSSKI.js} +1 -1
  16. package/dist/chunk-34BHNEE3.js +1846 -0
  17. package/dist/{chunk-YJX4SHTD.js → chunk-35MSIRKH.js} +9 -4
  18. package/dist/chunk-3EBYEESD.js +314 -0
  19. package/dist/{chunk-CTJ4RNAA.js → chunk-3F7VUY77.js} +2 -2
  20. package/dist/chunk-3KIPBMUA.js +308 -0
  21. package/dist/chunk-3M6DQK6S.js +362 -0
  22. package/dist/{chunk-BPKCPIL7.js → chunk-462T4EGZ.js} +3 -3
  23. package/dist/{chunk-QLFS5GO2.js → chunk-4JDLP6ZS.js} +44 -37
  24. package/dist/{chunk-LDQ2ZF2M.js → chunk-4O6MANBS.js} +6 -6
  25. package/dist/{chunk-O6TL7WWY.js → chunk-54ODD65L.js} +6 -6
  26. package/dist/{chunk-JDG2WCRO.js → chunk-5KW52TEP.js} +5 -5
  27. package/dist/{chunk-NHLBIGRH.js → chunk-5PFYMY2V.js} +41 -18
  28. package/dist/{chunk-P3FOHJT4.js → chunk-72GZI5EV.js} +2 -2
  29. package/dist/chunk-77QIVUZB.js +1334 -0
  30. package/dist/{chunk-HWHKMHUA.js → chunk-7BHIY2MW.js} +9 -15
  31. package/dist/{chunk-FWDFM5ZU.js → chunk-AK5XEFVZ.js} +3 -3
  32. package/dist/{chunk-VAZSBTKF.js → chunk-AZ4WMN4W.js} +2 -2
  33. package/dist/{chunk-B7OBL7PK.js → chunk-B74PXLU7.js} +21 -11
  34. package/dist/{chunk-CY6FY24N.js → chunk-B7HM5Z7T.js} +15 -15
  35. package/dist/{chunk-ULC6OTWO.js → chunk-BO7Y52RY.js} +88 -27
  36. package/dist/chunk-BTK3SSSK.js +67 -0
  37. package/dist/{chunk-M6L6IDJG.js → chunk-BWH6N36D.js} +1 -1
  38. package/dist/{chunk-DQITNCXG.js → chunk-BYMNWQ7O.js} +149 -159
  39. package/dist/{chunk-HI63TFOG.js → chunk-CDNVLKUX.js} +3 -3
  40. package/dist/{chunk-Z4TXYIEG.js → chunk-CRFOIAX3.js} +10 -10
  41. package/dist/{chunk-UM7N4G5A.js → chunk-CWVRRIEI.js} +2 -2
  42. package/dist/{chunk-3BT2XMV4.js → chunk-CYZW7JHJ.js} +53 -60
  43. package/dist/{chunk-BKFM6EJV.js → chunk-D4CJV46V.js} +2 -2
  44. package/dist/chunk-D7E7WCDF.js +27 -0
  45. package/dist/{chunk-X3YGUTOB.js → chunk-DYHAXKHD.js} +90 -62
  46. package/dist/{chunk-QBJA7R7N.js → chunk-DZAW46HP.js} +3 -3
  47. package/dist/{chunk-MLKNTWH2.js → chunk-DZEK6CJN.js} +22 -22
  48. package/dist/{chunk-K5C3NCBD.js → chunk-E7GT7O5N.js} +5 -5
  49. package/dist/{chunk-FQ4SKYE4.js → chunk-EBY63B7G.js} +2 -5
  50. package/dist/chunk-F2I26BDK.js +66 -0
  51. package/dist/{chunk-HLW2MRKE.js → chunk-F4EKGO4N.js} +3 -1
  52. package/dist/{chunk-RAPCMZL4.js → chunk-FSP7CMNU.js} +9 -1
  53. package/dist/{chunk-32KWKNSF.js → chunk-FVDGR2ZL.js} +4 -4
  54. package/dist/{chunk-TZSKNMZG.js → chunk-GTUD2WMY.js} +2 -1
  55. package/dist/{chunk-SJ5ZKQ4S.js → chunk-HIICAHCJ.js} +2 -2
  56. package/dist/chunk-HJWWJ6IL.js +184 -0
  57. package/dist/{chunk-WZR7K7ZX.js → chunk-HKMD33FO.js} +32 -83
  58. package/dist/chunk-HLAFFSEK.js +360 -0
  59. package/dist/{chunk-VO67MWHC.js → chunk-HRQMFLJP.js} +3 -3
  60. package/dist/{chunk-KFZI4NIL.js → chunk-I64IFBLB.js} +152 -31
  61. package/dist/{chunk-BKFJHQCA.js → chunk-I66EAJFY.js} +2 -2
  62. package/dist/{chunk-BUMFYQFY.js → chunk-I66ZTYNP.js} +543 -267
  63. package/dist/{chunk-2OQE55CK.js → chunk-I7XBWTYH.js} +2 -2
  64. package/dist/{chunk-GKF55TAZ.js → chunk-IDNA72AH.js} +104 -3
  65. package/dist/{chunk-GCSMB2KY.js → chunk-IKOZFYBN.js} +1 -1
  66. package/dist/{chunk-J4W7KFM7.js → chunk-IKSLQ4XV.js} +5439 -3475
  67. package/dist/{chunk-6DB53AJS.js → chunk-IMXMHHMQ.js} +171 -30
  68. package/dist/{chunk-AB44T6BB.js → chunk-JBCS7CRR.js} +8 -7
  69. package/dist/{chunk-BBVJUZHB.js → chunk-JIEGK6UF.js} +5 -173
  70. package/dist/{chunk-SP2RXXYO.js → chunk-JWJGP5DQ.js} +10 -10
  71. package/dist/{chunk-HZHHCK24.js → chunk-KKOJXO6R.js} +527 -325
  72. package/dist/chunk-KPXDY6QF.js +47 -0
  73. package/dist/{chunk-LQ3DZAMX.js → chunk-LJID3DYZ.js} +8 -2
  74. package/dist/{chunk-7MCTRUCE.js → chunk-M2DAX4F6.js} +2 -2
  75. package/dist/{chunk-VEO4AP2K.js → chunk-M2WXEHER.js} +4 -3
  76. package/dist/{chunk-YPI3QQCF.js → chunk-MCEPRMZW.js} +2 -4
  77. package/dist/{chunk-YDFRH54B.js → chunk-MCMZMDAC.js} +4 -4
  78. package/dist/{chunk-J5Q24KAG.js → chunk-MNJGS2IN.js} +5 -6
  79. package/dist/{chunk-76ONBSIA.js → chunk-MQXIVJ35.js} +14 -5
  80. package/dist/chunk-NDDGJUXD.js +81 -0
  81. package/dist/{chunk-TVHHYFHE.js → chunk-NEDJ26B5.js} +2 -2
  82. package/dist/chunk-NMJXSHBJ.js +283 -0
  83. package/dist/{chunk-VYMXRQI6.js → chunk-O3YUNJZ2.js} +88 -100
  84. package/dist/{chunk-VO2LKSTM.js → chunk-O42A54GG.js} +2 -2
  85. package/dist/{chunk-Z2RR6MAK.js → chunk-P75RZCJW.js} +28 -6
  86. package/dist/{chunk-NHCZP4K7.js → chunk-PBP4B7XR.js} +2 -2
  87. package/dist/{chunk-DYJP44XW.js → chunk-PGF63K6I.js} +2 -2
  88. package/dist/chunk-PJX3WQUQ.js +42 -0
  89. package/dist/{chunk-ZGVHUX3M.js → chunk-PMZVFWSR.js} +2 -2
  90. package/dist/{chunk-2JDWVJND.js → chunk-Q4XWMHX6.js} +5 -7
  91. package/dist/{chunk-W5VSYASO.js → chunk-QQLGQY2A.js} +46 -87
  92. package/dist/{chunk-KMVISBZR.js → chunk-RKSR6VSF.js} +1 -1
  93. package/dist/{chunk-C2LTL2W6.js → chunk-RLYRBIYQ.js} +463 -180
  94. package/dist/{chunk-4ZG3XFUR.js → chunk-S66XZJOF.js} +14 -23
  95. package/dist/{chunk-I5VEOC6I.js → chunk-SSEYRH53.js} +13 -14
  96. package/dist/chunk-SZAA6XDG.js +30 -0
  97. package/dist/{chunk-CODPRO7Q.js → chunk-TPEQIQIE.js} +7 -7
  98. package/dist/{chunk-QLL7ILRG.js → chunk-UBRFI4HS.js} +1151 -614
  99. package/dist/{chunk-O4XIVISU.js → chunk-UH347SHR.js} +227 -47
  100. package/dist/{chunk-OQBA45DZ.js → chunk-UH632ZYL.js} +2 -2
  101. package/dist/chunk-UXCU4E3T.js +303 -0
  102. package/dist/{chunk-CMZWFGD2.js → chunk-VAVR4IJY.js} +19 -15
  103. package/dist/{chunk-IQ7KR472.js → chunk-VIA6RFQZ.js} +8 -13
  104. package/dist/{chunk-V5DHCITQ.js → chunk-VKPAQYEB.js} +49 -19
  105. package/dist/{chunk-5LXZXPKX.js → chunk-VN3SHNBN.js} +2 -2
  106. package/dist/{chunk-UOSL25KY.js → chunk-VXMFAE2W.js} +1 -1
  107. package/dist/{chunk-3XML7CDN.js → chunk-W4YEMFBX.js} +3 -3
  108. package/dist/{chunk-U77AMWDL.js → chunk-W6NIE6OW.js} +44 -23
  109. package/dist/{chunk-BBVYXMFO.js → chunk-WNP7O5WZ.js} +2 -2
  110. package/dist/{chunk-QREDIESB.js → chunk-X7IARSHT.js} +15 -9
  111. package/dist/{chunk-3URVFKWK.js → chunk-XE3PCIXH.js} +5 -5
  112. package/dist/{chunk-FEFIFZTL.js → chunk-XGDPUNND.js} +2 -2
  113. package/dist/{chunk-F4CKPOEQ.js → chunk-XOXV5GKE.js} +119 -38
  114. package/dist/chunk-XQRY4DTA.js +657 -0
  115. package/dist/{chunk-NYS75XW5.js → chunk-YAKGTXEV.js} +5 -3
  116. package/dist/{chunk-NQQH3YT7.js → chunk-YJISEZKC.js} +3 -3
  117. package/dist/{chunk-X75E3D2N.js → chunk-ZGNYYXQ6.js} +18 -16
  118. package/dist/{chunk-LY4S7GJC.js → chunk-ZNT2M6TG.js} +20 -18
  119. package/dist/{chunk-HKIYEGME.js → chunk-ZTJUVLTU.js} +2 -2
  120. package/dist/{chunk-IBEBSCYA.js → chunk-ZW4HH5JJ.js} +43 -34
  121. package/dist/{chunk-2ANTL7MR.js → chunk-ZW55JB7N.js} +2 -2
  122. package/dist/cli/index.js +38 -37
  123. package/dist/{clio-2JXHBBY5.js → clio-7VB377CC.js} +12 -13
  124. package/dist/{code-nav-3YYRMYNF.js → code-nav-YVLCYA7V.js} +86 -18
  125. package/dist/codewiki/build-worker.js +1 -1
  126. package/dist/{compile-cache-7FPE6PS3.js → compile-cache-OQAVB7Y5.js} +2 -4
  127. package/dist/{components-RYZV4JGP.js → components-UBWCQSRW.js} +4 -4
  128. package/dist/{config-QZPCMYSO.js → config-4HVOS65E.js} +112 -63
  129. package/dist/{configure-TEGEBYCA.js → configure-PIWO7B24.js} +25 -22
  130. package/dist/{context-E6H5RNMC.js → context-IYEHL3WQ.js} +53 -47
  131. package/dist/{context-GSXUE4CT.js → context-KQYIWPWT.js} +68 -42
  132. package/dist/{context-AV7OEZ4D.js → context-N6ZE3LGJ.js} +11 -11
  133. package/dist/{context-clear-SHIBYK6T.js → context-clear-G4OGZJDS.js} +53 -47
  134. package/dist/{context-working-set-5ZGKPGZQ.js → context-working-set-BWLF6LJP.js} +12 -11
  135. package/dist/{dispatch-runner-EFMJT4LD.js → dispatch-runner-2QQAITS3.js} +67 -58
  136. package/dist/{docs-23KQS3XK.js → docs-PD3EXDKU.js} +20 -25
  137. package/dist/doctor-LHBD36VU.js +773 -0
  138. package/dist/{eval-TFBYQH4H.js → eval-C45FYRJ6.js} +68 -49
  139. package/dist/{eval-inventory-SXH7PDKX.js → eval-inventory-6DEJPLBF.js} +7 -8
  140. package/dist/{evidence-ERGESKGN.js → evidence-6SHONYAF.js} +50 -44
  141. package/dist/{evolve-VDXTSYCJ.js → evolve-KRKMV72X.js} +49 -43
  142. package/dist/{extensions-7BGBHN57.js → extensions-KPZ2UHBB.js} +8 -6
  143. package/dist/{fleet-2RRVDF2V.js → fleet-IVTCKDHT.js} +93 -79
  144. package/dist/{fleet-commands-VJ726XIA.js → fleet-commands-EDWL3IT7.js} +10 -9
  145. package/dist/{fleet-decisions-EPAPM3XJ.js → fleet-decisions-YP3YEFGK.js} +6 -6
  146. package/dist/{fleet-graph-JF5QOATM.js → fleet-graph-ZFWKHY2M.js} +19 -15
  147. package/dist/{fleet-inspect-VLY4S7QM.js → fleet-inspect-FVUNCBML.js} +50 -45
  148. package/dist/{fleet-preflight-AIZUEJOY.js → fleet-preflight-UN5XED4R.js} +5 -9
  149. package/dist/{fleet-validate-AJRPDMDV.js → fleet-validate-XOWC4HSX.js} +22 -17
  150. package/dist/{fleet-verify-JFEL2L3H.js → fleet-verify-UN3SODEL.js} +48 -43
  151. package/dist/fleet-view-TWHJKCN6.js +96 -0
  152. package/dist/{init-DN2WWLFE.js → init-T2QORQ3Y.js} +72 -66
  153. package/dist/{install-XGLBQY5E.js → install-NKNG7KD4.js} +2 -2
  154. package/dist/{interop-OZBKXAYL.js → interop-IN5I2A66.js} +13 -11
  155. package/dist/{library-YWZG7IMW.js → library-LSCATDLZ.js} +23 -18
  156. package/dist/{memory-I4C4HMLW.js → memory-HYOKAGGJ.js} +51 -45
  157. package/dist/{models-CEYXJBO6.js → models-2GPMFYCM.js} +42 -33
  158. package/dist/{monitor-NZ6GCI3P.js → monitor-E4ASVUJH.js} +56 -50
  159. package/dist/{orchestrator-GCGQ4N5I.js → orchestrator-DDMPR3PY.js} +2676 -1507
  160. package/dist/{panes-KY6W3V2E.js → panes-E3RUXOW5.js} +5 -5
  161. package/dist/panes-IXKLOKA2.js +75 -0
  162. package/dist/{paths-II4K7DNR.js → paths-L7LGY6RN.js} +4 -4
  163. package/dist/{reset-DQ6FGCSH.js → reset-OAQP3W4O.js} +7 -8
  164. package/dist/{resources-BB3MVJMD.js → resources-OTRSN34L.js} +23 -17
  165. package/dist/{run-H2GQDUER.js → run-5DEYH5QK.js} +95 -84
  166. package/dist/{share-GTJN6A5O.js → share-IHWTLO3M.js} +26 -19
  167. package/dist/{skills-L55TEW6R.js → skills-IYMXMKW4.js} +25 -20
  168. package/dist/{skills-eval-XVXPH2JI.js → skills-eval-DROHSJAR.js} +63 -65
  169. package/dist/{skills-inventory-S4MXPJFV.js → skills-inventory-D7X4L4ZX.js} +21 -16
  170. package/dist/{slash-commands-ZSGASKJC.js → slash-commands-QBM7UZ3B.js} +38 -33
  171. package/dist/{steer-RZGSCY4R.js → steer-Z5DO23FJ.js} +3 -3
  172. package/dist/{support-PKEUNNQL.js → support-U7QOWY26.js} +6 -6
  173. package/dist/{targets-NCPZ644J.js → targets-P2FUC4IL.js} +64 -61
  174. package/dist/{terminal-lease-44SV3YCN.js → terminal-lease-YREJ3JX2.js} +15 -10
  175. package/dist/{tools-DAF3DI3C.js → tools-5B7RO6MV.js} +10 -8
  176. package/dist/{trace-FYVW2MQA.js → trace-YMGMUM6A.js} +101 -8
  177. package/dist/{tui-primitives-2AKXQNZK.js → tui-primitives-K5PASC3O.js} +8 -4
  178. package/dist/{uninstall-DW2PNOIC.js → uninstall-N34PCTGJ.js} +4 -6
  179. package/dist/{upgrade-3XPP6OQL.js → upgrade-PXK3S2YM.js} +36 -61
  180. package/dist/{usage-3NLHGTU2.js → usage-ME5MPXGX.js} +58 -53
  181. package/dist/{verifiers-SSQONKRT.js → verifiers-BVZ7IWOO.js} +10 -9
  182. package/dist/{verify-3U6J7FZI.js → verify-5K7ZKQFC.js} +9 -8
  183. package/dist/{web-fetch-S7RR6GZ7.js → web-fetch-MPARV2K7.js} +2 -3
  184. package/dist/{wiki-generate-CEHYGPGQ.js → wiki-generate-F5W5QTYY.js} +74 -70
  185. package/dist/{with-panes-MKB46MPQ.js → with-panes-BYOJCLAM.js} +78 -246
  186. package/dist/worker/entry.js +83 -63
  187. package/docs/README.md +176 -81
  188. package/docs/{acp.md → architecture/acp.md} +36 -20
  189. package/docs/{alcf-provider.md → architecture/alcf-provider.md} +8 -5
  190. package/docs/{architecture.md → architecture/architecture.md} +43 -22
  191. package/docs/{artifact-placement.md → architecture/artifact-placement.md} +26 -23
  192. package/docs/architecture/artifact-versions.md +90 -0
  193. package/docs/{capacity-and-scheduling.md → architecture/capacity-and-scheduling.md} +26 -13
  194. package/docs/{context-engine.md → architecture/context-engine.md} +25 -25
  195. package/docs/{context-working-set.md → architecture/context-working-set.md} +13 -10
  196. package/docs/{dispatch-architecture-rationale.md → architecture/dispatch-architecture-rationale.md} +12 -9
  197. package/docs/{dispatch-typed-intent.md → architecture/dispatch-typed-intent.md} +68 -46
  198. package/docs/{evidence-and-memory.md → architecture/evidence-and-memory.md} +23 -16
  199. package/docs/{middleware-and-components.md → architecture/middleware-and-components.md} +11 -5
  200. package/docs/{model-catalog.md → architecture/model-catalog.md} +40 -17
  201. package/docs/{observability.md → architecture/observability.md} +26 -13
  202. package/docs/{pi-boundary.md → architecture/pi-boundary.md} +24 -11
  203. package/docs/{prompt-envelope-and-tools.md → architecture/prompt-envelope-and-tools.md} +55 -20
  204. package/docs/{provider-adapter-cookbook.md → architecture/provider-adapter-cookbook.md} +35 -24
  205. package/docs/{safety-model.md → architecture/safety-model.md} +20 -15
  206. package/docs/{session-lifecycle.md → architecture/session-lifecycle.md} +8 -5
  207. package/docs/architecture/time-conventions.md +125 -0
  208. package/docs/{trace-store.md → architecture/trace-store.md} +26 -13
  209. package/docs/{tui-design.md → architecture/tui-design.md} +13 -13
  210. package/docs/{worker-dispatch-mechanics.md → architecture/worker-dispatch-mechanics.md} +27 -30
  211. package/docs/{built-in-agents.md → guide/built-in-agents.md} +70 -46
  212. package/docs/{commands-and-modes.md → guide/commands-and-modes.md} +73 -62
  213. package/docs/{configuration-and-targets.md → guide/configuration-and-targets.md} +323 -444
  214. package/docs/guide/configuration-reference.md +1158 -0
  215. package/docs/{environment-variables.md → guide/environment-variables.md} +31 -27
  216. package/docs/{exit-codes-and-output.md → guide/exit-codes-and-output.md} +8 -3
  217. package/docs/{extensions-and-sharing.md → guide/extensions-and-sharing.md} +41 -14
  218. package/docs/{fleet-dispatch.md → guide/fleet-dispatch.md} +47 -49
  219. package/docs/{glossary.md → guide/glossary.md} +14 -11
  220. package/docs/{installation-and-lifecycle.md → guide/installation-and-lifecycle.md} +45 -14
  221. package/docs/guide/panes-and-files.md +290 -0
  222. package/docs/{proactive-memory.md → guide/proactive-memory.md} +79 -66
  223. package/docs/{resource-library.md → guide/resource-library.md} +13 -4
  224. package/docs/{skills-marketplace.md → guide/skills-marketplace.md} +7 -3
  225. package/docs/{tool-usage.md → guide/tool-usage.md} +87 -23
  226. package/docs/{troubleshooting.md → guide/troubleshooting.md} +10 -5
  227. package/docs/{config-knobs-audit.md → history/config-knobs-audit.md} +13 -10
  228. package/docs/history/release-cut-checklist.md +207 -0
  229. package/docs/{development-pipeline.md → process/development-pipeline.md} +24 -26
  230. package/docs/process/documentation-coverage.md +100 -0
  231. package/docs/process/documentation-guide.md +187 -0
  232. package/docs/{eval-runner.md → process/eval-runner.md} +41 -50
  233. package/docs/{evals-internal.md → process/evals-internal.md} +10 -10
  234. package/docs/{evolution.md → process/evolution.md} +2 -2
  235. package/docs/{fleet-demo-runbook.md → process/fleet-demo-runbook.md} +17 -10
  236. package/docs/{git-commit-provenance.md → process/git-commit-provenance.md} +11 -4
  237. package/docs/{performance-methodology.md → process/performance-methodology.md} +87 -69
  238. package/docs/{scientific-validation.md → process/scientific-validation.md} +4 -4
  239. package/evals/README.md +5 -0
  240. package/evals/behavioral-corpus-grader.mjs +103 -0
  241. package/evals/behavioral-machinery-baseline.json +2276 -0
  242. package/evals/behavioral-machinery-driver.ts +250 -0
  243. package/evals/behavioral-machinery-support.ts +253 -0
  244. package/evals/behavioral-machinery.yaml +614 -0
  245. package/evals/behavioral-model-negative-control.yaml +68 -0
  246. package/evals/behavioral-model.yaml +216 -0
  247. package/evals/fixtures/behavioral-facts.txt +3 -0
  248. package/evals/fixtures/behavioral-main.ts +7 -0
  249. package/evals/fixtures/decoy/note.txt +2 -0
  250. package/evals/fixtures/private/credentials.txt +1 -0
  251. package/evals/tracked-metrics-baseline.yaml +229 -0
  252. package/evals/tracked-metrics-grader.mjs +129 -0
  253. package/package.json +13 -21
  254. package/skills/README.md +51 -42
  255. package/skills/coding/ast-grep/SKILL.md +9 -3
  256. package/skills/coding/coding-standards/SKILL.md +9 -3
  257. package/skills/coding/prototype/SKILL.md +9 -3
  258. package/skills/coding/tdd/SKILL.md +9 -3
  259. package/skills/context/context-handoff/SKILL.md +13 -4
  260. package/skills/context/context-handoff/evals.md +3 -3
  261. package/skills/context/context-prime/SKILL.md +9 -3
  262. package/skills/context/context-prime/evals.md +2 -2
  263. package/skills/git/file-ticket/SKILL.md +10 -5
  264. package/skills/git/file-ticket/evals.md +2 -2
  265. package/skills/git/fix-issue/SKILL.md +12 -5
  266. package/skills/git/fix-issue/evals.md +4 -4
  267. package/skills/git/resolve-merge-conflicts/SKILL.md +9 -3
  268. package/skills/git/resolve-merge-conflicts/evals.md +2 -2
  269. package/skills/git/ship/SKILL.md +10 -4
  270. package/skills/git/ship/evals.md +4 -4
  271. package/skills/git/worktree-create/SKILL.md +8 -3
  272. package/skills/git/worktree-create/evals.md +6 -6
  273. package/skills/git/worktree-merge/SKILL.md +8 -3
  274. package/skills/git/worktree-merge/evals.md +6 -6
  275. package/skills/meta/{clio-dev → clio-coder-dev}/SKILL.md +22 -12
  276. package/skills/meta/{clio-dev → clio-coder-dev}/evals.md +5 -4
  277. package/skills/meta/clio-coder-test/SKILL.md +146 -0
  278. package/skills/meta/{clio-test → clio-coder-test}/evals.md +10 -5
  279. package/skills/meta/clio-coder-test/references/harness.md +102 -0
  280. package/skills/meta/clio-coder-test/references/test-map.md +96 -0
  281. package/skills/meta/credentials/SKILL.md +10 -3
  282. package/skills/meta/find-skills/SKILL.md +9 -3
  283. package/skills/meta/herdr/SKILL.md +9 -3
  284. package/skills/meta/skill-craft/SKILL.md +39 -16
  285. package/skills/planning/architecture/SKILL.md +9 -3
  286. package/skills/planning/backlog/SKILL.md +9 -3
  287. package/skills/planning/prd/SKILL.md +9 -3
  288. package/skills/planning/product-intent/SKILL.md +9 -3
  289. package/skills/planning/tech-spec/SKILL.md +9 -3
  290. package/skills/registry.yaml +66 -66
  291. package/skills/research/arxiv-literature/SKILL.md +9 -3
  292. package/skills/research/experiment-protocol/SKILL.md +10 -3
  293. package/skills/research/scientific-debugging/SKILL.md +10 -3
  294. package/skills/research/scientific-debugging/evals.md +2 -2
  295. package/skills/research/scientific-modernization/SKILL.md +10 -3
  296. package/skills/skill-marketplace.json +285 -66
  297. package/skills/workflow/cut-it/SKILL.md +11 -3
  298. package/skills/workflow/design-council/SKILL.md +12 -3
  299. package/skills/workflow/grill-me/SKILL.md +9 -3
  300. package/skills/workflow/workflow-distiller/SKILL.md +9 -3
  301. package/src/cli/acp.ts +2 -2
  302. package/src/cli/args.ts +2 -2
  303. package/src/cli/auth.ts +2 -2
  304. package/src/cli/bootstrap-generate.ts +6 -6
  305. package/src/cli/clio.ts +6 -1
  306. package/src/cli/config-inspect.ts +68 -15
  307. package/src/cli/configure-interop.ts +1 -1
  308. package/src/cli/configure.ts +27 -31
  309. package/src/cli/default-target.ts +1 -1
  310. package/src/cli/docs.ts +28 -20
  311. package/src/cli/doctor-naming.ts +323 -0
  312. package/src/cli/doctor-panes.ts +46 -14
  313. package/src/cli/doctor-toolchain.ts +31 -10
  314. package/src/cli/doctor.ts +15 -1
  315. package/src/cli/eval-inventory.ts +8 -8
  316. package/src/cli/eval.ts +1 -2
  317. package/src/cli/evidence-detail.ts +1 -1
  318. package/src/cli/evidence-inventory.ts +1 -1
  319. package/src/cli/extensions.ts +2 -1
  320. package/src/cli/fleet-decisions.ts +1 -1
  321. package/src/cli/fleet-inspect.ts +1 -1
  322. package/src/cli/fleet-preflight.ts +1 -1
  323. package/src/cli/fleet-verify.ts +1 -1
  324. package/src/cli/fleet-view.ts +40 -23
  325. package/src/cli/fleet.ts +9 -6
  326. package/src/cli/index.ts +2 -1
  327. package/src/cli/internal-dispatch.ts +3 -4
  328. package/src/cli/interop-inspect.ts +2 -2
  329. package/src/cli/models.ts +3 -3
  330. package/src/cli/modes/print.ts +1 -1
  331. package/src/cli/panes.ts +19 -5
  332. package/src/cli/reset.ts +1 -1
  333. package/src/cli/run.ts +13 -17
  334. package/src/cli/share.ts +6 -2
  335. package/src/cli/skills-eval.ts +14 -14
  336. package/src/cli/targets.ts +25 -30
  337. package/src/cli/trace-inspect.ts +1 -1
  338. package/src/cli/trace.ts +96 -4
  339. package/src/cli/uninstall.ts +2 -2
  340. package/src/cli/upgrade.ts +29 -34
  341. package/src/cli/usage.ts +2 -2
  342. package/src/cli/validate-model.ts +1 -1
  343. package/src/cli/verifiers-inspect.ts +1 -1
  344. package/src/cli/wiki-generate.ts +6 -6
  345. package/src/core/artifact-paths.ts +1 -1
  346. package/src/core/bash-exec.ts +132 -87
  347. package/src/core/boot-trace.ts +3 -3
  348. package/src/core/bus-events.ts +51 -6
  349. package/src/core/bus-trace.ts +2 -2
  350. package/src/core/compile-cache.ts +1 -1
  351. package/src/core/config.ts +1066 -886
  352. package/src/core/defaults.ts +326 -530
  353. package/src/core/dispatch-outcome.ts +16 -0
  354. package/src/core/domain-loader.ts +6 -4
  355. package/src/core/event-bus.ts +1 -1
  356. package/src/core/file-references.ts +78 -88
  357. package/src/core/git-commit-attribution.ts +3 -9
  358. package/src/core/guardrails.ts +33 -52
  359. package/src/core/naming-compat.ts +45 -0
  360. package/src/core/naming-events.ts +62 -0
  361. package/src/core/prompt-hint.ts +9 -0
  362. package/src/core/recent-models.ts +1 -7
  363. package/src/core/residency-protection.ts +4 -8
  364. package/src/core/resolve-config-value.ts +1 -1
  365. package/src/core/response-model-id.ts +0 -14
  366. package/src/core/session-routing.ts +84 -74
  367. package/src/core/skill-activation.ts +18 -0
  368. package/src/core/termination.ts +4 -4
  369. package/src/core/timers.ts +2 -12
  370. package/src/domains/agents/builtins/architect.md +2 -3
  371. package/src/domains/agents/builtins/coder.md +3 -2
  372. package/src/domains/agents/builtins/debugger.md +2 -2
  373. package/src/domains/agents/builtins/documenter.md +2 -2
  374. package/src/domains/agents/builtins/git-master.md +1 -1
  375. package/src/domains/agents/builtins/oracle.md +1 -1
  376. package/src/domains/agents/builtins/provenance.md +1 -1
  377. package/src/domains/agents/builtins/researcher.md +1 -1
  378. package/src/domains/agents/builtins/scout.md +1 -1
  379. package/src/domains/agents/builtins/tester.md +2 -2
  380. package/src/domains/agents/builtins/verifier.md +2 -2
  381. package/src/domains/agents/builtins/wiki-writer.md +1 -1
  382. package/src/domains/agents/catalog.ts +14 -26
  383. package/src/domains/agents/contract.ts +2 -0
  384. package/src/domains/agents/extension.ts +26 -4
  385. package/src/domains/agents/registry.ts +7 -7
  386. package/src/domains/agents/result-contract.ts +1 -1
  387. package/src/domains/agents/spec.ts +0 -11
  388. package/src/domains/config/classify.ts +35 -47
  389. package/src/domains/config/extension.ts +5 -5
  390. package/src/domains/config/keybindings.ts +56 -47
  391. package/src/domains/config/watcher.ts +1 -1
  392. package/src/domains/context/codewiki/indexer.ts +1 -1
  393. package/src/domains/context/extension.ts +3 -6
  394. package/src/domains/context/prompt-context.ts +1 -1
  395. package/src/domains/context/wiki/assemble.ts +2 -2
  396. package/src/domains/context/working-set/path-index.ts +1 -0
  397. package/src/domains/context/working-set/replay/metrics.ts +0 -4
  398. package/src/domains/context/working-set/replay/report.ts +1 -1
  399. package/src/domains/context/working-set/replay/synthetic.ts +2 -2
  400. package/src/domains/dispatch/active-route-planner.ts +2 -2
  401. package/src/domains/dispatch/agent-candidates.ts +1 -1
  402. package/src/domains/dispatch/agent-ledger-store.ts +1 -1
  403. package/src/domains/dispatch/agent-ledger.ts +1 -1
  404. package/src/domains/dispatch/assignment.ts +5 -5
  405. package/src/domains/dispatch/capability-match.ts +10 -0
  406. package/src/domains/dispatch/capacity-lease.ts +2 -5
  407. package/src/domains/dispatch/code-step.ts +1 -1
  408. package/src/domains/dispatch/contract.ts +2 -2
  409. package/src/domains/dispatch/extension.ts +169 -82
  410. package/src/domains/dispatch/fleet-node-prompt.ts +1 -1
  411. package/src/domains/dispatch/fleet-preflight.ts +8 -17
  412. package/src/domains/dispatch/fleet-run.ts +0 -7
  413. package/src/domains/dispatch/gate-decisions.ts +25 -14
  414. package/src/domains/dispatch/host-verification.ts +435 -39
  415. package/src/domains/dispatch/intent-requirements.ts +10 -0
  416. package/src/domains/dispatch/intent.ts +18 -1
  417. package/src/domains/dispatch/joint-route-resolver.ts +1 -1
  418. package/src/domains/dispatch/path-scope.ts +220 -70
  419. package/src/domains/dispatch/placement.ts +2 -2
  420. package/src/domains/dispatch/receipt-findings.ts +1 -1
  421. package/src/domains/dispatch/receipt-integrity.ts +20 -8
  422. package/src/domains/dispatch/reservation-store.ts +0 -23
  423. package/src/domains/dispatch/route-decision.ts +1 -1
  424. package/src/domains/dispatch/route-history.ts +1 -1
  425. package/src/domains/dispatch/route-policy.ts +1 -1
  426. package/src/domains/dispatch/route-readiness.ts +0 -28
  427. package/src/domains/dispatch/run-event-journal.ts +9 -19
  428. package/src/domains/dispatch/state.ts +2 -3
  429. package/src/domains/dispatch/tool-stats.ts +1 -1
  430. package/src/domains/dispatch/transport.ts +47 -40
  431. package/src/domains/dispatch/types.ts +58 -6
  432. package/src/domains/dispatch/worker-protocol.ts +2 -2
  433. package/src/domains/eval/artifacts/store.ts +10 -4
  434. package/src/domains/eval/compare/thresholds.ts +0 -8
  435. package/src/domains/eval/execution-provenance.ts +1 -1
  436. package/src/domains/eval/metrics/token-stream.ts +0 -7
  437. package/src/domains/eval/report.ts +1 -1
  438. package/src/domains/eval/runner.ts +1 -1
  439. package/src/domains/eval/runners/clio-run.ts +7 -6
  440. package/src/domains/eval/runners/external-command.ts +4 -3
  441. package/src/domains/eval/schema/artifact.ts +1 -1
  442. package/src/domains/eval/schema/behavioral-metrics.ts +3 -2
  443. package/src/domains/eval/schema/behavioral.ts +7 -6
  444. package/src/domains/eval/schema/execution-envelope.ts +4 -2
  445. package/src/domains/eval/schema/naming.ts +10 -0
  446. package/src/domains/eval/schema/suite.ts +2 -2
  447. package/src/domains/eval/schema/validate.ts +9 -5
  448. package/src/domains/eval/schema/verdict.ts +4 -2
  449. package/src/domains/eval/store.ts +20 -3
  450. package/src/domains/eval/suites/run.ts +12 -6
  451. package/src/domains/eval/types.ts +1 -1
  452. package/src/domains/eval/workspaces/git.ts +1 -1
  453. package/src/domains/eval/workspaces/temp-copy.ts +1 -1
  454. package/src/domains/evidence/build.ts +13 -5
  455. package/src/domains/evidence/trust-status.ts +10 -1
  456. package/src/domains/extensions/contract.ts +15 -1
  457. package/src/domains/extensions/discovery.ts +238 -41
  458. package/src/domains/extensions/extension.ts +105 -6
  459. package/src/domains/extensions/index.ts +24 -0
  460. package/src/domains/extensions/integrity.ts +189 -0
  461. package/src/domains/extensions/manager.ts +17 -1
  462. package/src/domains/extensions/resource-path.ts +27 -0
  463. package/src/domains/extensions/resources.ts +18 -38
  464. package/src/domains/extensions/snapshot-store.ts +39 -0
  465. package/src/domains/extensions/snapshot.ts +180 -0
  466. package/src/domains/extensions/state.ts +385 -57
  467. package/src/domains/extensions/types.ts +118 -1
  468. package/src/domains/interop/consent.ts +7 -7
  469. package/src/domains/interop/extension.ts +1 -1
  470. package/src/domains/lifecycle/doctor.ts +27 -21
  471. package/src/domains/lifecycle/migrations/2026-09-01-clio-coder-naming.ts +155 -0
  472. package/src/domains/lifecycle/migrations/2026-09-01-extension-install-digests.ts +27 -0
  473. package/src/domains/lifecycle/migrations/2026-09-01-retire-panes-knobs.ts +59 -0
  474. package/src/domains/lifecycle/migrations/2026-09-01-settings-v2.ts +338 -0
  475. package/src/domains/lifecycle/migrations/index.ts +22 -1
  476. package/src/domains/lifecycle/naming-history.ts +153 -0
  477. package/src/domains/lifecycle/naming-mutable-state.ts +104 -0
  478. package/src/domains/lifecycle/naming-resources.ts +276 -0
  479. package/src/domains/lifecycle/naming-tool-markers.ts +139 -0
  480. package/src/domains/lifecycle/naming-yazi.ts +86 -0
  481. package/src/domains/lifecycle/upgrade-notice.ts +1 -1
  482. package/src/domains/memory/task-memory-handoff.ts +6 -3
  483. package/src/domains/middleware/contract.ts +26 -0
  484. package/src/domains/middleware/extension.ts +24 -24
  485. package/src/domains/middleware/hook-receipts.ts +27 -4
  486. package/src/domains/middleware/hooks-io.ts +65 -32
  487. package/src/domains/middleware/hooks.ts +64 -0
  488. package/src/domains/middleware/index.ts +35 -4
  489. package/src/domains/middleware/marketplace-offer.ts +339 -0
  490. package/src/domains/middleware/registrations.ts +326 -0
  491. package/src/domains/middleware/runtime.ts +30 -2
  492. package/src/domains/middleware/snapshot.ts +20 -7
  493. package/src/domains/mux/contract.ts +195 -25
  494. package/src/domains/mux/detect.ts +23 -6
  495. package/src/domains/mux/dock-controller.ts +365 -0
  496. package/src/domains/mux/extension.ts +7 -1
  497. package/src/domains/mux/index.ts +21 -1
  498. package/src/domains/mux/operations.ts +72 -5
  499. package/src/domains/mux/protocol.ts +19 -6
  500. package/src/domains/mux/socket-client.ts +167 -19
  501. package/src/domains/mux/types.ts +49 -6
  502. package/src/domains/mux/yazi/assets/yazi.toml +2 -2
  503. package/src/domains/mux/yazi/event-stream.ts +6 -4
  504. package/src/domains/mux/yazi/profile.ts +1 -1
  505. package/src/domains/mux/yazi/session.ts +79 -7
  506. package/src/domains/mux/yazi/theme.ts +117 -17
  507. package/src/domains/observability/contract.ts +10 -11
  508. package/src/domains/observability/extension.ts +12 -4
  509. package/src/domains/observability/out-of-turn-usage.ts +2 -2
  510. package/src/domains/observability/projection.ts +15 -91
  511. package/src/domains/observability/trace-store.ts +65 -19
  512. package/src/domains/prompts/compiler.ts +75 -55
  513. package/src/domains/prompts/contract.ts +15 -3
  514. package/src/domains/prompts/extension.ts +100 -12
  515. package/src/domains/prompts/fragments/identity/clio-worker.md +2 -4
  516. package/src/domains/prompts/fragments/identity/clio.md +6 -12
  517. package/src/domains/prompts/fragments/identity/docs-routing.md +1 -2
  518. package/src/domains/prompts/fragments/identity/self-awareness.md +3 -11
  519. package/src/domains/prompts/fragments/operating/contract.md +7 -15
  520. package/src/domains/prompts/fragments/operating/delegation.md +32 -34
  521. package/src/domains/prompts/fragments/operating/skills.md +11 -18
  522. package/src/domains/prompts/fragments/operating/worker.md +1 -8
  523. package/src/domains/providers/extension.ts +5 -5
  524. package/src/domains/providers/index.ts +1 -1
  525. package/src/domains/providers/knowledge-base-path.ts +1 -1
  526. package/src/domains/providers/model-runtime-capabilities.ts +99 -23
  527. package/src/domains/providers/models/cloud-models/alcf.yaml +1 -1
  528. package/src/domains/providers/models/local-models/{clio-local-coding-targets.yaml → clio-coder-local-coding-targets.yaml} +671 -106
  529. package/src/domains/providers/plugins.ts +1 -1
  530. package/src/domains/providers/resolver.ts +1 -1
  531. package/src/domains/providers/runtime-resolution.ts +31 -0
  532. package/src/domains/providers/runtimes/cloud/alcf.ts +4 -4
  533. package/src/domains/providers/runtimes/common/lmstudio-http.ts +1 -5
  534. package/src/domains/providers/runtimes/common/local-synth.ts +3 -3
  535. package/src/domains/providers/runtimes/common/probe-helpers.ts +9 -4
  536. package/src/domains/providers/runtimes/local-native/llamacpp-completion.ts +1 -1
  537. package/src/domains/providers/runtimes/local-native/llamacpp.ts +9 -1
  538. package/src/domains/providers/runtimes/local-native/lmstudio.ts +2 -9
  539. package/src/domains/providers/runtimes/protocol/litellm.ts +1 -91
  540. package/src/domains/providers/types/cost-provenance.ts +19 -0
  541. package/src/domains/providers/types/knowledge-base.ts +13 -0
  542. package/src/domains/providers/types/local-model-quirks.ts +87 -39
  543. package/src/domains/providers/types/target-descriptor.ts +3 -3
  544. package/src/domains/resources/extension.ts +1 -1
  545. package/src/domains/resources/library.ts +6 -6
  546. package/src/domains/resources/prompts/loader.ts +1 -1
  547. package/src/domains/resources/skills/content-hash.ts +7 -6
  548. package/src/domains/resources/skills/evals.ts +1 -1
  549. package/src/domains/resources/skills/install.ts +36 -12
  550. package/src/domains/resources/skills/loader.ts +41 -18
  551. package/src/domains/resources/skills/marketplace.ts +21 -2
  552. package/src/domains/resources/skills/promotion.ts +214 -0
  553. package/src/domains/safety/audit.ts +2 -2
  554. package/src/domains/safety/call-target.ts +1 -1
  555. package/src/domains/safety/finish-contract.ts +2 -1
  556. package/src/domains/safety/loop-detector.ts +7 -4
  557. package/src/domains/safety/run-effects.ts +1 -1
  558. package/src/domains/scheduling/extension.ts +4 -4
  559. package/src/domains/session/archive-readers.ts +9 -1
  560. package/src/domains/session/compaction/branch-summary.ts +4 -0
  561. package/src/domains/session/compaction/compact.ts +1 -1
  562. package/src/domains/session/compaction/tokens.ts +4 -0
  563. package/src/domains/session/context-accounting.ts +1 -1
  564. package/src/domains/session/decision-board.ts +1 -1
  565. package/src/domains/session/extension.ts +1 -1
  566. package/src/domains/session/handoff.ts +2 -2
  567. package/src/domains/session/prompt-manifest.ts +0 -5
  568. package/src/domains/session/protected-artifact-journal.ts +12 -6
  569. package/src/domains/session/retry.ts +1 -1
  570. package/src/domains/session/task-board.ts +10 -9
  571. package/src/domains/share/archive.ts +249 -43
  572. package/src/domains/toolchain/install.ts +1 -1
  573. package/src/engine/acp/adapter.ts +3 -3
  574. package/src/engine/acp/event-mapper.ts +3 -3
  575. package/src/engine/acp/server.ts +89 -35
  576. package/src/engine/acp/tool-mediator.ts +2 -2
  577. package/src/engine/acp/types.ts +1 -1
  578. package/src/engine/alcf-oauth.ts +5 -5
  579. package/src/engine/antigravity/subprocess-runtime.ts +2 -2
  580. package/src/engine/api-registry.ts +1 -1
  581. package/src/engine/apis/llamacpp-residency.ts +4 -23
  582. package/src/engine/apis/lmstudio.ts +4 -9
  583. package/src/engine/apis/ollama-native.ts +9 -9
  584. package/src/engine/apis/openai-completions.ts +30 -27
  585. package/src/engine/apis/output-budget.ts +8 -18
  586. package/src/engine/apis/residency.ts +10 -35
  587. package/src/engine/claude/sdk-module.ts +1 -12
  588. package/src/engine/claude/sdk-runtime.ts +6 -6
  589. package/src/engine/claude/subprocess-runtime.ts +1 -1
  590. package/src/engine/claude/tool-safety.ts +4 -4
  591. package/src/engine/gemma-channel-filter.ts +19 -0
  592. package/src/engine/loop-guard.ts +92 -17
  593. package/src/engine/session.ts +14 -7
  594. package/src/engine/tui-primitives.ts +1 -1
  595. package/src/engine/worker-events.ts +6 -6
  596. package/src/engine/worker-runtime.ts +54 -24
  597. package/src/engine/worker-tools.ts +3 -1
  598. package/src/entry/extension-hook-sources.ts +28 -0
  599. package/src/entry/extension-reload.ts +309 -0
  600. package/src/entry/orchestrator.ts +163 -120
  601. package/src/interactive/application-controller.ts +23 -22
  602. package/src/interactive/bus-notices.ts +10 -3
  603. package/src/interactive/chat-loop-messages.ts +3 -13
  604. package/src/interactive/chat-loop.ts +18 -9
  605. package/src/interactive/chat-panel.ts +37 -14
  606. package/src/interactive/chat-renderer.ts +71 -7
  607. package/src/interactive/clio-editor.ts +105 -1
  608. package/src/interactive/context-activity.ts +8 -6
  609. package/src/interactive/context-meter.ts +3 -6
  610. package/src/interactive/context-overlay.ts +1 -1
  611. package/src/interactive/cost-overlay.ts +1 -1
  612. package/src/interactive/council-grid.ts +2 -2
  613. package/src/interactive/dispatch-board.ts +36 -44
  614. package/src/interactive/editor-bash.ts +21 -0
  615. package/src/interactive/editor-steer.ts +9 -4
  616. package/src/interactive/editor-submit.ts +24 -18
  617. package/src/interactive/external-editor.ts +1 -1
  618. package/src/interactive/file-reference-completion.ts +360 -0
  619. package/src/interactive/footer/dashboard.ts +15 -17
  620. package/src/interactive/footer/notifications.ts +14 -8
  621. package/src/interactive/footer/widgets.ts +15 -44
  622. package/src/interactive/interactive-application.ts +116 -61
  623. package/src/interactive/interactive-event-projection.ts +1 -1
  624. package/src/interactive/interactive-input-runtime.ts +6 -2
  625. package/src/interactive/interactive-presentation.ts +22 -17
  626. package/src/interactive/interactive-shell.ts +2 -2
  627. package/src/interactive/interactive-slash-runtime.ts +65 -17
  628. package/src/interactive/interactive-subscriptions.ts +1 -1
  629. package/src/interactive/interactive-tickers.ts +1 -1
  630. package/src/interactive/keybinding-manager.ts +4 -4
  631. package/src/interactive/layout.ts +1 -1
  632. package/src/interactive/memory-overlay.ts +2 -2
  633. package/src/interactive/modal-marker.ts +2 -21
  634. package/src/interactive/mutation-preview.ts +1 -1
  635. package/src/interactive/overlay-frame.ts +4 -12
  636. package/src/interactive/overlay-general-openers.ts +6 -2
  637. package/src/interactive/overlay-key-routing.ts +7 -7
  638. package/src/interactive/overlay-lifecycle.ts +1 -1
  639. package/src/interactive/overlay-model-selectors.ts +3 -3
  640. package/src/interactive/overlays/agents.ts +2 -2
  641. package/src/interactive/overlays/ask-user.ts +25 -11
  642. package/src/interactive/overlays/context-reset.ts +28 -4
  643. package/src/interactive/overlays/cwd-fallback.ts +28 -4
  644. package/src/interactive/overlays/decisions.ts +4 -2
  645. package/src/interactive/overlays/extensions.ts +9 -1
  646. package/src/interactive/overlays/fleet-run-approval.ts +3 -3
  647. package/src/interactive/overlays/handoff-review.ts +2 -2
  648. package/src/interactive/overlays/help-reference.ts +13 -0
  649. package/src/interactive/overlays/interop.ts +1 -1
  650. package/src/interactive/overlays/library-install-confirm.ts +1 -1
  651. package/src/interactive/overlays/message-picker.ts +1 -1
  652. package/src/interactive/overlays/model-selector.ts +39 -31
  653. package/src/interactive/overlays/prompts.ts +10 -4
  654. package/src/interactive/overlays/session-selector.ts +2 -2
  655. package/src/interactive/overlays/settings.ts +360 -303
  656. package/src/interactive/overlays/side-question.ts +2 -2
  657. package/src/interactive/overlays/skills-hub.ts +8 -8
  658. package/src/interactive/overlays/tree-selector.ts +2 -2
  659. package/src/interactive/panes-runtime.ts +145 -43
  660. package/src/interactive/permission-overlay.ts +2 -2
  661. package/src/interactive/prompt-cache-identity.ts +88 -0
  662. package/src/interactive/renderers/retry-status.ts +12 -4
  663. package/src/interactive/renderers/tool-execution.ts +4 -4
  664. package/src/interactive/session-transcript.ts +3 -3
  665. package/src/interactive/slash-autocomplete.ts +454 -165
  666. package/src/interactive/slash-commands.ts +401 -190
  667. package/src/interactive/slash-spec.ts +160 -17
  668. package/src/interactive/status/controller.ts +2 -2
  669. package/src/interactive/stream-pacing-policy.ts +1 -24
  670. package/src/interactive/tasks-overlay.ts +20 -13
  671. package/src/interactive/terminal-lease.ts +6 -7
  672. package/src/interactive/turn-context.ts +41 -26
  673. package/src/interactive/turn-persistence.ts +2 -2
  674. package/src/interactive/turn-prewarm.ts +2 -2
  675. package/src/interactive/turn-runtime.ts +8 -8
  676. package/src/interactive/turn-state.ts +1 -1
  677. package/src/interactive/view/artifacts.ts +12 -9
  678. package/src/interactive/view/view-overlay.ts +13 -10
  679. package/src/interactive/watch-pane.ts +38 -10
  680. package/src/interactive/welcome-dashboard.ts +15 -15
  681. package/src/interactive/worker-progress.ts +4 -4
  682. package/src/interactive/worker-receipts.ts +1 -1
  683. package/src/interactive/worker-stream.ts +1 -4
  684. package/src/interactive/yazi-bridge.ts +72 -11
  685. package/src/tools/agent-tools.ts +30 -1
  686. package/src/tools/artifact.ts +2 -2
  687. package/src/tools/ask-user.ts +6 -6
  688. package/src/tools/bash.ts +2 -2
  689. package/src/tools/bootstrap.ts +4 -0
  690. package/src/tools/builtin-tool-catalog.ts +52 -22
  691. package/src/tools/codewiki/code-nav-surface.ts +6 -0
  692. package/src/tools/codewiki/code-nav.ts +99 -13
  693. package/src/tools/compete-worktrees.ts +27 -17
  694. package/src/tools/context/docs-engine.ts +20 -7
  695. package/src/tools/context/index.ts +44 -13
  696. package/src/tools/core-bootstrap.ts +28 -6
  697. package/src/tools/credential-present.ts +1 -2
  698. package/src/tools/dispatch-admission.ts +4 -2
  699. package/src/tools/dispatch-arguments.ts +6 -2
  700. package/src/tools/dispatch-plan.ts +48 -15
  701. package/src/tools/dispatch-run-events.ts +13 -11
  702. package/src/tools/dispatch-runner.ts +11 -6
  703. package/src/tools/dispatch-schema.ts +338 -0
  704. package/src/tools/dispatch-types.ts +3 -0
  705. package/src/tools/dispatch.ts +9 -254
  706. package/src/tools/find.ts +1 -6
  707. package/src/tools/ledger.ts +3 -5
  708. package/src/tools/monitor-surface.ts +5 -13
  709. package/src/tools/monitor.ts +4 -4
  710. package/src/tools/observation.ts +4 -5
  711. package/src/tools/observers.ts +0 -33
  712. package/src/tools/panes-surface.ts +4 -11
  713. package/src/tools/panes.ts +4 -2
  714. package/src/tools/policy.ts +15 -2
  715. package/src/tools/read.ts +5 -6
  716. package/src/tools/registry.ts +30 -7
  717. package/src/tools/result-shaping.ts +18 -14
  718. package/src/tools/steer-surface.ts +1 -1
  719. package/src/tools/task-worktree.ts +28 -7
  720. package/src/tools/tasks.ts +1 -1
  721. package/src/tools/truncate.ts +6 -5
  722. package/src/tools/verify/authoring.ts +3 -6
  723. package/src/tools/verify/frontend.ts +1 -1
  724. package/src/tools/verify/surface.ts +6 -12
  725. package/src/tools/web-fetch-surface.ts +1 -3
  726. package/src/tools/web-fetch.ts +1 -1
  727. package/src/worker/entry.ts +4 -3
  728. package/src/worker/protocol.ts +16 -14
  729. package/src/worker/spec-contract.ts +2 -2
  730. package/src/worker/stdin-demux.ts +2 -2
  731. package/dist/chunk-36EJLSQQ.js +0 -814
  732. package/dist/chunk-GXNLGKAB.js +0 -571
  733. package/dist/chunk-K7VKOLQQ.js +0 -15
  734. package/dist/chunk-PMZCIOCJ.js +0 -25
  735. package/dist/chunk-SUCTJL45.js +0 -45
  736. package/dist/chunk-SUW5DORT.js +0 -819
  737. package/dist/chunk-TZ3SGWZZ.js +0 -48
  738. package/dist/chunk-UOV2BYIW.js +0 -107
  739. package/dist/chunk-VFA6GDY5.js +0 -1625
  740. package/dist/doctor-QOA5FNY5.js +0 -313
  741. package/dist/fleet-view-ZCON35AG.js +0 -102
  742. package/dist/panes-HMABYVO4.js +0 -58
  743. package/docs/artifact-versions.md +0 -67
  744. package/docs/documentation-coverage.md +0 -46
  745. package/docs/documentation-guide.md +0 -167
  746. package/docs/release-cut-checklist.md +0 -193
  747. package/docs/time-conventions.md +0 -101
  748. package/skills/meta/clio-test/SKILL.md +0 -133
  749. package/skills/meta/clio-test/references/harness.md +0 -126
  750. package/skills/meta/clio-test/references/test-map.md +0 -69
  751. package/src/engine/apis/degraded-inference.ts +0 -95
@@ -6,7 +6,7 @@ import {
6
6
  readGateDecisionArtifactsForRunIds,
7
7
  stagePendingGateDecision,
8
8
  verifyGateDecisionArtifact
9
- } from "./chunk-X75E3D2N.js";
9
+ } from "./chunk-ZGNYYXQ6.js";
10
10
  import {
11
11
  RUN_RECEIPT_INTEGRITY_ALGORITHM,
12
12
  RUN_RECEIPT_INTEGRITY_VERSION,
@@ -24,14 +24,18 @@ import {
24
24
  trustVerdict,
25
25
  verifyReceiptIntegrity,
26
26
  withReceiptIntegrity
27
- } from "./chunk-B7OBL7PK.js";
27
+ } from "./chunk-B74PXLU7.js";
28
28
  import {
29
29
  protectedArtifactFromSessionEntry,
30
30
  protectedArtifactStateFromSessionEntries,
31
31
  readAuditRows,
32
32
  readSessionEntriesForId,
33
33
  responseModelIdObservationFromRecord
34
- } from "./chunk-QREDIESB.js";
34
+ } from "./chunk-X7IARSHT.js";
35
+ import {
36
+ codeStepDir,
37
+ writeCodeStepRecord
38
+ } from "./chunk-KPXDY6QF.js";
35
39
  import {
36
40
  applyTaskWorktree,
37
41
  captureWorkspaceSnapshot,
@@ -39,11 +43,11 @@ import {
39
43
  createTaskWorktree,
40
44
  createWriteBoundaryEnforcer,
41
45
  gitCheckoutRoot
42
- } from "./chunk-U77AMWDL.js";
46
+ } from "./chunk-W6NIE6OW.js";
43
47
  import {
44
48
  executionPlanAncestors,
45
49
  spliceExecutionPlan
46
- } from "./chunk-QBJA7R7N.js";
50
+ } from "./chunk-DZAW46HP.js";
47
51
  import {
48
52
  parseRigorOverride,
49
53
  resolveRigor
@@ -53,11 +57,11 @@ import {
53
57
  parseEvalArtifactV4,
54
58
  redactArtifactForStorage,
55
59
  sumEvalHarnessMetrics
56
- } from "./chunk-NHLBIGRH.js";
60
+ } from "./chunk-5PFYMY2V.js";
57
61
  import {
58
62
  defaultRunEventJournal,
59
63
  removeRunEventJournals
60
- } from "./chunk-IQ7KR472.js";
64
+ } from "./chunk-VIA6RFQZ.js";
61
65
  import {
62
66
  AdmissionCanceledError,
63
67
  EVENT_TEE_LIMIT,
@@ -75,11 +79,11 @@ import {
75
79
  receiptAttestationFields,
76
80
  routeFactVerdict,
77
81
  spawnNativeWorker
78
- } from "./chunk-QLFS5GO2.js";
82
+ } from "./chunk-4JDLP6ZS.js";
79
83
  import {
80
84
  FLEET_COMMAND_BASE_ENV,
81
85
  normalizeWriteBoundary
82
- } from "./chunk-CTJ4RNAA.js";
86
+ } from "./chunk-3F7VUY77.js";
83
87
  import {
84
88
  AGENT_LEDGER_PROMPT_MAX_CHARS,
85
89
  COUNCIL_MIN_MEMBERS,
@@ -103,12 +107,15 @@ import {
103
107
  declaredScopeIntent,
104
108
  declaredScopeReplacementDiagnostic,
105
109
  declaredScopeReplacementNotice,
110
+ inferredScopeParentTokenDiagnostic,
111
+ inferredScopeParentTokenNotice,
106
112
  isBoundedGateRolePrompt,
107
113
  isClaudeCanonicalTool,
108
114
  isResponseSchemaRejection,
109
115
  isRunOutcomeCode,
110
116
  networkToolsDisabled,
111
117
  nodeResultContractFilesystem,
118
+ normalizePromptHint,
112
119
  projectExecutionHandoffs,
113
120
  renderAgentLedger,
114
121
  resolveDispatchPathScope,
@@ -119,7 +126,7 @@ import {
119
126
  serializeWorkerRuntimeDescriptor,
120
127
  toolPromptHintsForNames,
121
128
  validateJobSpec
122
- } from "./chunk-J4W7KFM7.js";
129
+ } from "./chunk-IKSLQ4XV.js";
123
130
  import {
124
131
  decideRoute,
125
132
  defaultRoutingIntent,
@@ -137,16 +144,16 @@ import {
137
144
  routingIntentRejection,
138
145
  sameRouteIdentity,
139
146
  toRouteCandidate
140
- } from "./chunk-SJ5ZKQ4S.js";
147
+ } from "./chunk-HIICAHCJ.js";
141
148
  import {
142
149
  assessFinishContract
143
- } from "./chunk-GKF55TAZ.js";
150
+ } from "./chunk-IDNA72AH.js";
144
151
  import {
145
152
  WRITE_ROOT_REFUSED_TOOLS
146
- } from "./chunk-32KWKNSF.js";
153
+ } from "./chunk-FVDGR2ZL.js";
147
154
  import {
148
155
  describeCallAction
149
- } from "./chunk-TVHHYFHE.js";
156
+ } from "./chunk-NEDJ26B5.js";
150
157
  import {
151
158
  applyToolProfile,
152
159
  assertToolProfileEnforceable
@@ -161,13 +168,13 @@ import {
161
168
  } from "./chunk-H7IXIC72.js";
162
169
  import {
163
170
  compareCodepoints
164
- } from "./chunk-5LXZXPKX.js";
171
+ } from "./chunk-VN3SHNBN.js";
165
172
  import {
166
173
  DEFAULT_AUTONOMY_LEVEL,
167
174
  autonomyDenyRejection,
168
175
  isSkillActivation,
169
176
  mapAutonomy
170
- } from "./chunk-RAPCMZL4.js";
177
+ } from "./chunk-FSP7CMNU.js";
171
178
  import {
172
179
  createRedactionTally,
173
180
  redactSecretsDeep,
@@ -180,9 +187,11 @@ import {
180
187
  canonicalJson,
181
188
  endpointIdentityHash,
182
189
  parseAgentLedgerBody
183
- } from "./chunk-CMZWFGD2.js";
190
+ } from "./chunk-VAVR4IJY.js";
184
191
  import {
185
- pathBoundaryCovers
192
+ PATH_BOUNDARY_MAX_ENTRIES,
193
+ pathBoundaryCovers,
194
+ resolvePathBoundary
186
195
  } from "./chunk-HHV2GANA.js";
187
196
  import {
188
197
  agentSpecFingerprint,
@@ -194,10 +203,10 @@ import {
194
203
  resolveAgentToolCompatibility,
195
204
  resultContractAuthorship,
196
205
  validateRecipeResult
197
- } from "./chunk-DYJP44XW.js";
206
+ } from "./chunk-PGF63K6I.js";
198
207
  import {
199
208
  detectValidationCommand
200
- } from "./chunk-GCSMB2KY.js";
209
+ } from "./chunk-IKOZFYBN.js";
201
210
  import {
202
211
  isProjectVerifierCheckId,
203
212
  isVerificationScriptName
@@ -210,6 +219,7 @@ import {
210
219
  isBuiltinToolName
211
220
  } from "./chunk-K6BSR66V.js";
212
221
  import {
222
+ canonicalEndpointKey,
213
223
  canonicalizeWireModelId,
214
224
  endpointCapacityFor,
215
225
  endpointCapacityForStatus,
@@ -223,29 +233,33 @@ import {
223
233
  resolveRuntimeTarget,
224
234
  runtimeResolutionWarnings,
225
235
  runtimeTargetSnapshot
226
- } from "./chunk-DQITNCXG.js";
236
+ } from "./chunk-BYMNWQ7O.js";
227
237
  import {
228
238
  ceilChars
229
- } from "./chunk-UM7N4G5A.js";
230
- import {
231
- BusChannels
232
- } from "./chunk-HLW2MRKE.js";
239
+ } from "./chunk-CWVRRIEI.js";
233
240
  import {
234
241
  atomicWrite
235
- } from "./chunk-76ONBSIA.js";
242
+ } from "./chunk-MQXIVJ35.js";
236
243
  import {
237
244
  assertSafeId
238
245
  } from "./chunk-R346GLFC.js";
246
+ import {
247
+ normalizeClioCoderEventRecord,
248
+ normalizeClioCoderEventType
249
+ } from "./chunk-BTK3SSSK.js";
250
+ import {
251
+ BusChannels
252
+ } from "./chunk-F4EKGO4N.js";
239
253
  import {
240
254
  attributeCommitMessage,
241
255
  gitCommitAttributionEnabled,
242
256
  reportCommitAttributionDiagnostic,
243
257
  withManagedGitCommitAttributionEnvironment
244
- } from "./chunk-BBVJUZHB.js";
258
+ } from "./chunk-JIEGK6UF.js";
245
259
  import {
246
260
  MAX_TIMER_DELAY_MS,
247
261
  rawDurationMs
248
- } from "./chunk-FQ4SKYE4.js";
262
+ } from "./chunk-EBY63B7G.js";
249
263
  import {
250
264
  AI_AGENT_NAME
251
265
  } from "./chunk-6EJMN2Y3.js";
@@ -259,14 +273,14 @@ import {
259
273
  DEFAULT_DELEGATION_TURN_TIMEOUT_MS,
260
274
  DEFAULT_SETTINGS,
261
275
  THINKING_LEVELS
262
- } from "./chunk-GXNLGKAB.js";
276
+ } from "./chunk-UXCU4E3T.js";
263
277
  import {
264
278
  GUARDRAIL_DEFAULTS,
265
279
  resolveGuardrail
266
- } from "./chunk-4ZG3XFUR.js";
280
+ } from "./chunk-S66XZJOF.js";
267
281
  import {
268
282
  targetRequiresAuth
269
- } from "./chunk-BBVYXMFO.js";
283
+ } from "./chunk-WNP7O5WZ.js";
270
284
  import {
271
285
  FILE_LOCK_ACQUIRE_TIMEOUT_MS,
272
286
  withStateFileLock,
@@ -280,11 +294,12 @@ import {
280
294
  import {
281
295
  clioDataDir,
282
296
  clioStateDir,
297
+ resolveClioDirs,
283
298
  stateRootRemoved
284
299
  } from "./chunk-BYP5D4HI.js";
285
300
  import {
286
301
  resolveEffectivePricing
287
- } from "./chunk-VO2LKSTM.js";
302
+ } from "./chunk-O42A54GG.js";
288
303
  import {
289
304
  init_esm_shims
290
305
  } from "./chunk-3R73A4XB.js";
@@ -298,10 +313,10 @@ function protectedResidencyModels(settings) {
298
313
  if (!trimmed || byId.has(trimmed)) return;
299
314
  byId.set(trimmed, role);
300
315
  };
301
- add(settings.orchestrator.model, "chat");
302
- add(settings.background.model, "memory");
303
- add(settings.workers.default.model, "worker");
304
- for (const profile of Object.values(settings.workers.profiles ?? {})) add(profile.model, "worker");
316
+ add(settings.chat.model, "chat");
317
+ add(settings.context.memory.model, "memory");
318
+ add(settings.fleet.default.model, "worker");
319
+ for (const profile of Object.values(settings.fleet.profiles ?? {})) add(profile.model, "worker");
305
320
  for (const target of settings.targets) add(target.defaultModel, "target-default");
306
321
  return [...byId].map(([modelId, role]) => ({ modelId, role }));
307
322
  }
@@ -1391,7 +1406,7 @@ function agentLedgerContribution(id, runId) {
1391
1406
  if (record === null) return null;
1392
1407
  const contribution = contributionFor(record, runId);
1393
1408
  const mine = record.entries.filter((entry) => entry.runId === runId).sort((left, right) => left.sequence - right.sequence);
1394
- const digest = createHash("sha256").update(`clio.agentLedger:${canonicalJson(mine)}`, "utf8").digest("hex");
1409
+ const digest = createHash("sha256").update(`clio-coder.agentLedger:${canonicalJson(mine)}`, "utf8").digest("hex");
1395
1410
  return { posted: contribution.posted, refused: contribution.refused, digest };
1396
1411
  }
1397
1412
 
@@ -1403,6 +1418,12 @@ function renderDispatchIntentRequirements(intent) {
1403
1418
  "# Declared Result Requirements",
1404
1419
  "These entries are requirements to satisfy and verify. They are not evidence that an output exists or a check passed."
1405
1420
  ];
1421
+ if (intent.writeRoots.length > 0) {
1422
+ lines.push(
1423
+ "",
1424
+ "This run is confined to its write roots and has no bash or verify tool, so you cannot run tests, scripts, or the checks below yourself. Write the code and the tests, re-read them, and report what you wrote; the host runs the declared checks after you finish and records the result on the receipt."
1425
+ );
1426
+ }
1406
1427
  if (intent.expectedOutputs.length > 0) {
1407
1428
  lines.push("", "Expected outputs:", ...intent.expectedOutputs.map((output) => `- ${output}`));
1408
1429
  }
@@ -1438,7 +1459,7 @@ init_esm_shims();
1438
1459
  // src/domains/evidence/build.ts
1439
1460
  init_esm_shims();
1440
1461
  import { mkdir, readFile as readFile2, writeFile } from "node:fs/promises";
1441
- import { join as join16 } from "node:path";
1462
+ import { join as join15 } from "node:path";
1442
1463
 
1443
1464
  // src/domains/dispatch/index.ts
1444
1465
  init_esm_shims();
@@ -1521,7 +1542,7 @@ var AcpEventMapper = class {
1521
1542
  return this.mapToolUpdate(update);
1522
1543
  }
1523
1544
  if (kind === "plan") {
1524
- return [{ type: "clio_plan_update", payload: update }];
1545
+ return [{ type: "clio_coder_plan_update", payload: update }];
1525
1546
  }
1526
1547
  return [];
1527
1548
  }
@@ -1555,7 +1576,7 @@ var AcpEventMapper = class {
1555
1576
  this.toolStarts.set(toolCallId, performance2.now());
1556
1577
  const action = describeCallAction(update.kind ?? title, update.rawInput);
1557
1578
  out.push({
1558
- type: "clio_tool_start",
1579
+ type: "clio_coder_tool_start",
1559
1580
  payload: {
1560
1581
  tool: update.kind ?? title,
1561
1582
  toolCallId,
@@ -1584,7 +1605,7 @@ var AcpEventMapper = class {
1584
1605
  isError
1585
1606
  });
1586
1607
  out.push({
1587
- type: "clio_tool_finish",
1608
+ type: "clio_coder_tool_finish",
1588
1609
  payload: {
1589
1610
  tool: update.kind ?? title,
1590
1611
  toolCallId,
@@ -2021,7 +2042,7 @@ var AcpToolMediator = class {
2021
2042
  let reason;
2022
2043
  let safetyDecision;
2023
2044
  if (mapped.validationError !== void 0) {
2024
- if (this.input.toolGovernance === "clio-policy") {
2045
+ if (this.input.toolGovernance === "clio-coder-policy") {
2025
2046
  const invalidSafetyDecisions = mapped.evaluations.map(
2026
2047
  (evaluation) => this.input.safety.evaluate({ tool: evaluation.tool, args: evaluation.args })
2027
2048
  );
@@ -2264,10 +2285,10 @@ function startAcpDelegationRun(input) {
2264
2285
  const mediator = new AcpToolMediator({
2265
2286
  safety: input.safety,
2266
2287
  cwd: input.cwd,
2267
- toolGovernance: input.agent.toolGovernance ?? "clio-policy",
2288
+ toolGovernance: input.agent.toolGovernance ?? "clio-coder-policy",
2268
2289
  ...input.autonomy !== void 0 ? { autonomy: input.autonomy } : {},
2269
2290
  onPermissionResolved: (event) => emit({
2270
- type: "clio_permission_resolved",
2291
+ type: "clio_coder_permission_resolved",
2271
2292
  payload: event
2272
2293
  })
2273
2294
  });
@@ -2433,7 +2454,6 @@ function startAcpDelegationRun(input) {
2433
2454
  // src/domains/prompts/compiler.ts
2434
2455
  init_esm_shims();
2435
2456
  import { join as join3 } from "node:path";
2436
- var FLEET_ROUTING_GUIDANCE = 'Fleet routing: pin the `agent` id from the Fleet section; agent:"auto" baselines from the task text and is a fallback, not a router.';
2437
2457
  var WORKER_CLAIM_GUIDANCE = 'Never claim a completion, a validation, or a file change that no tool call in this run supports. If you did not run it or write it here, say "not verified" and report what you did do.';
2438
2458
  function lookupFragment(table, id, role) {
2439
2459
  const frag = table.byId.get(id);
@@ -2483,16 +2503,32 @@ function renderRuntimeBlock(inputs) {
2483
2503
  }
2484
2504
  function sessionCanDispatch(inputs) {
2485
2505
  if (inputs.providerSupportsTools === false) return false;
2486
- return toolSurfaceHasTool(inputs.toolNames, inputs.toolPromptHints, "dispatch");
2506
+ return toolSurfaceHasTool(inputs.toolNames, "dispatch");
2487
2507
  }
2488
2508
  function sessionHasContext(inputs) {
2489
2509
  if (inputs.providerSupportsTools === false) return false;
2490
- return toolSurfaceHasTool(inputs.toolNames, inputs.toolPromptHints, "context");
2510
+ return toolSurfaceHasTool(inputs.toolNames, "context");
2491
2511
  }
2492
- function toolSurfaceHasTool(toolNames, toolPromptHints, tool) {
2512
+ function toolSurfaceHasTool(toolNames, tool) {
2493
2513
  const names = new Set((toolNames ?? []).map((name) => name.trim()));
2494
- const hinted = new Set((toolPromptHints ?? []).map((entry) => entry.tool.trim()));
2495
- return names.has(tool) || hinted.has(tool);
2514
+ return names.has(tool);
2515
+ }
2516
+ function canonicalToolPromptHints(entries, admitted) {
2517
+ const normalized = entries.map((entry) => ({
2518
+ tool: entry.tool.trim(),
2519
+ hint: normalizePromptHint(entry.hint) ?? ""
2520
+ })).filter((entry) => admitted.has(entry.tool) && entry.hint.length > 0).sort((a, b) => {
2521
+ if (a.tool !== b.tool) return a.tool < b.tool ? -1 : 1;
2522
+ return a.hint < b.hint ? -1 : a.hint > b.hint ? 1 : 0;
2523
+ });
2524
+ const seenTools = /* @__PURE__ */ new Set();
2525
+ const seenHints = /* @__PURE__ */ new Set();
2526
+ return normalized.filter((entry) => {
2527
+ if (seenTools.has(entry.tool) || seenHints.has(entry.hint)) return false;
2528
+ seenTools.add(entry.tool);
2529
+ seenHints.add(entry.hint);
2530
+ return true;
2531
+ });
2496
2532
  }
2497
2533
  function renderFleetBlock(inputs) {
2498
2534
  if (!sessionCanDispatch(inputs)) return "";
@@ -2511,36 +2547,43 @@ function renderToolContractBlock(inputs) {
2511
2547
  ].sort();
2512
2548
  const canDispatch = sessionCanDispatch(inputs);
2513
2549
  const canListSkills = sessionHasContext(inputs);
2550
+ const admitted = new Set(names);
2514
2551
  const inventoryGuidance = [
2515
- // Asked twice in one session which tools it had, a live model gave two
2516
- // different answers and invented `web_find`. The authoritative list is one
2517
- // line above; pointing at it beats letting the model recall the schemas.
2518
- "When answering capability-inventory questions, copy the Direct tools line above verbatim rather than recalling the attached schemas, and make no calls",
2519
- ...canDispatch ? ["add dispatch(list:true) only if agents or the fleet are requested"] : [],
2520
- ...canListSkills ? ['add context(scope="skills") only if skills are requested (it lists installed and marketplace skills)'] : []
2552
+ "When asked what tools you have, copy the Direct tools line verbatim and call nothing",
2553
+ ...canDispatch ? [
2554
+ "dispatch(list:true) answers a question about agents, the fleet, or which target and model run this session and its workers"
2555
+ ] : [],
2556
+ ...canListSkills ? ['context(scope="skills") answers only a question about skills'] : []
2521
2557
  ].join("; ");
2558
+ const capabilityKinds = [
2559
+ "direct tools are attached schemas",
2560
+ ...canDispatch ? ["fleet agents are workers behind dispatch"] : [],
2561
+ ...canListSkills ? ["skills are operator-activated workflows reached through context"] : []
2562
+ ];
2563
+ const orientationTools = ["context", "code_nav", "grep", "read"].filter((name) => admitted.has(name));
2564
+ const validationTools = ["verify", "git"].filter((name) => admitted.has(name));
2522
2565
  const lines = [
2523
2566
  "# Tool Contract",
2524
2567
  "The attached schemas are the session's complete direct-tool surface; follow each schema exactly.",
2525
2568
  ...names.length > 0 ? [`Direct tools: ${names.map((name) => `\`${name}\``).join(", ")}.`] : [],
2526
- "Harness model: direct tools are attached schemas; fleet agents are workers behind dispatch; skills are operator-activated workflows reached through context. Keep these capability sets distinct.",
2569
+ `Harness model: ${capabilityKinds.join("; ")}. Keep these capability sets distinct.`,
2527
2570
  `${inventoryGuidance}.`,
2528
- "Call tools only for concrete inspection or changes the task requires. If the user asks for a tool-free answer, simply answer without calling tools.",
2571
+ "Call tools only for concrete inspection or changes the task requires; a tool-free question gets a tool-free answer.",
2529
2572
  // The tool-specific instantiation of the operating contract's "narrow
2530
2573
  // work: inspect directly" rule; the contract cannot name tools.
2531
2574
  // Delegation, the tasks board, and skills are not restated here: the
2532
- // Delegation and Skills passages and the registry hints carry them, and
2533
- // each renders exactly when its tool does.
2534
- 'For narrow file or symbol orientation, prefer context(scope="workspace"), code_nav, grep, and read instead of assuming source-tree details were preloaded.',
2535
- "Validate with verify or git diff before final claims.",
2536
- `When a tool call fails or is rejected, do not retry the same shape blindly: re-read the schema, adjust the arguments, or query context(scope="docs") for that tool's usage.`
2575
+ // Delegation, Fleet, and Skills passages and the registry hints carry
2576
+ // them, and each renders exactly when its tool does.
2577
+ ...orientationTools.length > 0 ? [
2578
+ `For narrow file or symbol orientation, prefer ${orientationTools.join(", ")} instead of assuming source-tree details were preloaded.`
2579
+ ] : [],
2580
+ ...validationTools.length > 0 ? [
2581
+ `Validate with ${validationTools.map((name) => name === "git" ? "git diff" : name).join(" or ")} before final claims.`
2582
+ ] : [],
2583
+ `When a tool call fails or is rejected, do not retry the same shape blindly: re-read the schema and adjust the arguments${canListSkills ? `, or query context(scope="docs") for that tool's usage` : ""}.`
2537
2584
  ];
2538
- const seen = /* @__PURE__ */ new Set();
2539
- const hints = [...inputs.toolPromptHints ?? []].map((entry) => ({ tool: entry.tool.trim(), hint: entry.hint.trim() })).filter((entry) => entry.tool.length > 0 && entry.hint.length > 0).sort((a, b) => a.tool < b.tool ? -1 : a.tool > b.tool ? 1 : 0);
2540
- if (hints.some((entry) => entry.tool === "dispatch")) lines.push(FLEET_ROUTING_GUIDANCE);
2585
+ const hints = canonicalToolPromptHints(inputs.toolPromptHints ?? [], new Set(names));
2541
2586
  for (const entry of hints) {
2542
- if (seen.has(entry.tool)) continue;
2543
- seen.add(entry.tool);
2544
2587
  lines.push(entry.hint);
2545
2588
  }
2546
2589
  return lines.join("\n");
@@ -2592,15 +2635,8 @@ function renderWorkerToolContractBlock(inputs) {
2592
2635
  "Tool authority is limited to this list. Persona and bound-skill instructions never add tools.",
2593
2636
  "Call tools only for concrete inspection or changes the assigned task requires. If the task requests an exact or tool-free response, answer without calling tools."
2594
2637
  ];
2595
- const admitted = new Set(names);
2596
- const seen = /* @__PURE__ */ new Set();
2597
- const hints = [...inputs.toolPromptHints].map((entry) => ({ tool: entry.tool.trim(), hint: entry.hint.trim() })).filter((entry) => admitted.has(entry.tool) && entry.hint.length > 0).sort((a, b) => {
2598
- if (a.tool !== b.tool) return a.tool < b.tool ? -1 : 1;
2599
- return a.hint < b.hint ? -1 : a.hint > b.hint ? 1 : 0;
2600
- });
2638
+ const hints = canonicalToolPromptHints(inputs.toolPromptHints, new Set(names));
2601
2639
  for (const entry of hints) {
2602
- if (seen.has(entry.tool)) continue;
2603
- seen.add(entry.tool);
2604
2640
  lines.push(entry.hint);
2605
2641
  }
2606
2642
  return lines.join("\n");
@@ -2634,8 +2670,7 @@ function renderRetrievalHintsBlock(inputs) {
2634
2670
  }
2635
2671
  return [
2636
2672
  "# Retrieval Hints",
2637
- "Compact CLIO-CODER.md project instructions may be preloaded above; everything else about the repository must be fetched, not assumed.",
2638
- "Never invent file paths, automatic tool behavior, or mutable repo details from the system prompt."
2673
+ "Repository details not included above must be fetched, never invented; compact CLIO-CODER.md instructions may be preloaded."
2639
2674
  ].join("\n");
2640
2675
  }
2641
2676
  function renderProjectBlock(contextFiles) {
@@ -2702,7 +2737,8 @@ function compile(table, inputs) {
2702
2737
  const docsRouting = selfAwareness && sessionHasContext(session) ? table.byId.get("identity.docs-routing") : void 0;
2703
2738
  if (selfAwareness) {
2704
2739
  const packageRoot = resolvePackageRoot();
2705
- const rendered2 = selfAwareness.body.replace("{CLIO_DOCS_PATH}", join3(packageRoot, "docs")).replace("{CLIO_SRC_PATH}", join3(packageRoot, "src")).replace("{CLIO_CODEWIKI_PATH}", join3(packageRoot, "dist", "assets", "codewiki.json"));
2740
+ const clioDirs = resolveClioDirs();
2741
+ const rendered2 = selfAwareness.body.replace("{CLIO_DOCS_PATH}", join3(packageRoot, "docs")).replace("{CLIO_SRC_PATH}", join3(packageRoot, "src")).replace("{CLIO_CODEWIKI_PATH}", join3(packageRoot, "dist", "assets", "codewiki.json")).replace("{CLIO_SETTINGS_PATH}", join3(clioDirs.config, "settings.yaml")).replace("{CLIO_STATE_PATH}", clioDirs.state);
2706
2742
  identityBody = [identity.body.trim(), rendered2.trim(), ...docsRouting ? [docsRouting.body.trim()] : []].join(
2707
2743
  "\n\n"
2708
2744
  );
@@ -2774,7 +2810,7 @@ function compileWorker(table, inputs) {
2774
2810
  if (inputs.hasBoundSkills && !inputs.hasCanonicalContext) {
2775
2811
  throw new Error("prompts/compiler: bound skills require canonical context in the final attached tool surface");
2776
2812
  }
2777
- const identity = lookupFragment(table, "identity.clio-worker", "worker identity");
2813
+ const identity = lookupFragment(table, "identity.clio-coder-worker", "worker identity");
2778
2814
  const operatingContract = lookupFragment(table, "operating.contract", "operating contract");
2779
2815
  const workerContract = lookupFragment(table, "operating.worker", "worker contract");
2780
2816
  const safety = lookupFragment(table, `safety.${inputs.autonomy}`, "safety");
@@ -2906,7 +2942,7 @@ function asAssignmentId(rootRunId) {
2906
2942
  function activeRoutingEnabled(input) {
2907
2943
  if (input.posture === "manual" || input.failover !== "approved") return false;
2908
2944
  if (input.capabilityClass !== "read-only" && input.capabilityClass !== "verification") return false;
2909
- return input.settings.activeRoles.includes(input.role) && input.settings.activePostures.includes(input.posture);
2945
+ return input.settings.roles.includes(input.role) && input.settings.postures.includes(input.posture);
2910
2946
  }
2911
2947
  function applyActiveRouteSelection(req, decision) {
2912
2948
  if (decision.mode !== "active") throw new Error("dispatch: cannot apply a non-active route decision");
@@ -3106,7 +3142,7 @@ function routeValidationProjection(request, allowUnenvelopedApproval = false) {
3106
3142
  function enabled(input) {
3107
3143
  const posture = input.request.routingIntent?.posture ?? "balanced";
3108
3144
  if (input.request.agentSelection?.mode === "auto") {
3109
- return input.settings !== void 0 && posture !== "manual" && input.failover === "approved" && input.settings.activePostures.includes(posture) && input.settings.agentAutomation.activeAgentRoles.length > 0;
3145
+ return input.settings !== void 0 && posture !== "manual" && input.failover === "approved" && input.settings.postures.includes(posture) && input.settings.agentRoles.length > 0;
3110
3146
  }
3111
3147
  return input.settings !== void 0 && input.capabilityClass !== null && activeRoutingEnabled({
3112
3148
  settings: input.settings,
@@ -4354,6 +4390,7 @@ function suggestedSpecialist(taskType, specs) {
4354
4390
  }
4355
4391
  function assessCapabilityMismatch(input) {
4356
4392
  if (!READ_ONLY_CAPABILITY_CLASSES.has(input.capabilityClass)) return null;
4393
+ if (input.intent && input.intent.writeRoots.length === 0 && input.intent.expectedOutputs.length === 0) return null;
4357
4394
  const features = classifyAgentTask(input.task);
4358
4395
  if (!MUTATING_TASK_TYPES.has(features.taskType)) return null;
4359
4396
  const readShaped = READ_SHAPED_PATTERNS.some((pattern) => pattern.test(input.task));
@@ -4840,6 +4877,9 @@ ${spawned.spawnError}
4840
4877
  // src/domains/dispatch/host-verification.ts
4841
4878
  var OUTPUT_TAIL_BYTES = 2048;
4842
4879
  var MEMO_VERSION = 1;
4880
+ var HTTP_URL_RE = /\bhttps?:\/\/\S+/gu;
4881
+ var CHECK_OUTPUT_PATH_RE = /\/?(?:[A-Za-z0-9_.@+-]+\/)+[A-Za-z0-9_.@+-]*\.(?:[cm]?[jt]sx?|json|ya?ml|md|txt|py|go|rs|c|h|cc|cpp|hpp|java|rb|sh|toml|css|html|sql)\b/gu;
4882
+ var IMPLICATED_PATH_CAP = PATH_BOUNDARY_MAX_ENTRIES;
4843
4883
  function sha2563(value) {
4844
4884
  return createHash4("sha256").update(value, "utf8").digest("hex");
4845
4885
  }
@@ -4911,6 +4951,52 @@ function hostVerificationRejection(verification) {
4911
4951
  detail: failedCheck === void 0 ? "host verification rejected" : `host verification check '${failedCheck.check}' rejected with exit code ${failedCheck.exitCode}`
4912
4952
  };
4913
4953
  }
4954
+ async function runResolvedCheck(input) {
4955
+ const resolvedCheck = input.resolvedCheck;
4956
+ const command = {
4957
+ id: resolvedCheck.check,
4958
+ argv: [...resolvedCheck.argv],
4959
+ cwd: "",
4960
+ timeoutMs: resolvedCheck.timeoutMs,
4961
+ env: [],
4962
+ description: `Host verification check ${resolvedCheck.check}.`
4963
+ };
4964
+ const fingerprint = workspaceFingerprint(resolvedCheck.cwd);
4965
+ const key = fingerprint === null ? null : memoKey({ ...command, cwd: resolve3(resolvedCheck.cwd) }, fingerprint, input.env);
4966
+ const hit = key === null ? void 0 : readMemo(input.stateDir).entries.find((entry) => entry.key === key && entry.check.exitCode === 0);
4967
+ if (hit !== void 0) {
4968
+ return {
4969
+ check: { ...hit.check, argv: [...hit.check.argv], memo: true, evidenceRunId: hit.runId },
4970
+ outputExcerpt: ""
4971
+ };
4972
+ }
4973
+ const outcome = await runCodeStep({
4974
+ stepId: `verification-${input.index + 1}-${resolvedCheck.check.replace(/[^a-z0-9._-]/giu, "_")}`,
4975
+ command,
4976
+ workspaceRoot: resolvedCheck.cwd,
4977
+ artifactDir: join8(input.stateDir, "artifacts", input.runId, "verification"),
4978
+ env: input.env
4979
+ });
4980
+ const artifactPath = outcome.record.artifactPaths[0];
4981
+ const check = {
4982
+ check: resolvedCheck.check,
4983
+ argv: [...outcome.record.argv],
4984
+ cwd: outcome.record.cwd,
4985
+ exitCode: outcome.record.exitCode,
4986
+ durationMs: outcome.record.durationMs,
4987
+ memo: false,
4988
+ outputTail: outputTail(outcome.report.outputExcerpt),
4989
+ ...artifactPath !== void 0 ? { artifactPath } : {}
4990
+ };
4991
+ if (check.exitCode === 0 && key !== null) {
4992
+ try {
4993
+ storeMemoEntry(input.stateDir, { key, runId: input.runId, check });
4994
+ } catch (error) {
4995
+ input.onDiagnostic?.(error);
4996
+ }
4997
+ }
4998
+ return { check, outputExcerpt: outcome.report.outputExcerpt };
4999
+ }
4914
5000
  async function runHostVerification(input) {
4915
5001
  const checks = input.request.resolvedVerification;
4916
5002
  if (checks === void 0 || checks.length === 0) return void 0;
@@ -4919,51 +5005,220 @@ async function runHostVerification(input) {
4919
5005
  const env = input.env ?? process.env;
4920
5006
  const results = [];
4921
5007
  for (const [index, resolvedCheck] of checks.entries()) {
4922
- const command = {
4923
- id: resolvedCheck.check,
5008
+ const outcome = await runResolvedCheck({
5009
+ runId: input.runId,
5010
+ index,
5011
+ resolvedCheck,
5012
+ stateDir,
5013
+ env,
5014
+ ...input.onDiagnostic !== void 0 ? { onDiagnostic: input.onDiagnostic } : {}
5015
+ });
5016
+ results.push(outcome.check);
5017
+ }
5018
+ return {
5019
+ status: results.every((check) => check.exitCode === 0) ? "verified" : "rejected",
5020
+ checks: results
5021
+ };
5022
+ }
5023
+ function implicatedPaths(outputExcerpt, checkCwd) {
5024
+ const withoutUrls = outputExcerpt.replace(HTTP_URL_RE, (url) => " ".repeat(url.length));
5025
+ const paths = /* @__PURE__ */ new Set();
5026
+ for (const match of withoutUrls.matchAll(CHECK_OUTPUT_PATH_RE)) paths.add(resolve3(checkCwd, match[0]));
5027
+ return [...paths].sort();
5028
+ }
5029
+ function checkDedupeKey(resolvedCheck) {
5030
+ return sha2563(
5031
+ JSON.stringify({
5032
+ check: resolvedCheck.check,
4924
5033
  argv: [...resolvedCheck.argv],
4925
- cwd: "",
4926
- timeoutMs: resolvedCheck.timeoutMs,
4927
- env: [],
4928
- description: `Host verification check ${resolvedCheck.check}.`
4929
- };
4930
- const fingerprint = workspaceFingerprint(resolvedCheck.cwd);
4931
- const key = fingerprint === null ? null : memoKey({ ...command, cwd: resolve3(resolvedCheck.cwd) }, fingerprint, env);
4932
- const hit = key === null ? void 0 : readMemo(stateDir).entries.find((entry) => entry.key === key && entry.check.exitCode === 0);
4933
- if (hit !== void 0) {
4934
- results.push({ ...hit.check, argv: [...hit.check.argv], memo: true, evidenceRunId: hit.runId });
5034
+ cwd: resolve3(resolvedCheck.cwd),
5035
+ timeoutMs: resolvedCheck.timeoutMs
5036
+ })
5037
+ );
5038
+ }
5039
+ function memberBoundary(participant) {
5040
+ const writeRoots = participant.request.intent?.writeRoots ?? [];
5041
+ return writeRoots.map((root) => resolvePathBoundary(participant.request.cwd ?? process.cwd(), root));
5042
+ }
5043
+ function attributeFailure(input) {
5044
+ const declared = new Set(input.declarers.map((member) => member.runId));
5045
+ const implicatedDeclarers = /* @__PURE__ */ new Set();
5046
+ const unconfined = /* @__PURE__ */ new Set();
5047
+ const decisive = /* @__PURE__ */ new Set();
5048
+ for (const member of input.declarers) {
5049
+ const boundary = memberBoundary(member);
5050
+ if (boundary.length === 0) {
5051
+ unconfined.add(member.runId);
4935
5052
  continue;
4936
5053
  }
4937
- const outcome = await runCodeStep({
4938
- stepId: `verification-${index + 1}-${resolvedCheck.check.replace(/[^a-z0-9._-]/giu, "_")}`,
4939
- command,
4940
- workspaceRoot: resolvedCheck.cwd,
4941
- artifactDir: join8(stateDir, "artifacts", input.runId, "verification"),
4942
- env
4943
- });
4944
- const artifactPath = outcome.record.artifactPaths[0];
4945
- const check = {
4946
- check: resolvedCheck.check,
4947
- argv: [...outcome.record.argv],
4948
- cwd: outcome.record.cwd,
4949
- exitCode: outcome.record.exitCode,
4950
- durationMs: outcome.record.durationMs,
4951
- memo: false,
4952
- outputTail: outputTail(outcome.report.outputExcerpt),
4953
- ...artifactPath !== void 0 ? { artifactPath } : {}
4954
- };
4955
- results.push(check);
4956
- if (check.exitCode === 0 && key !== null) {
4957
- try {
4958
- storeMemoEntry(stateDir, { key, runId: input.runId, check });
4959
- } catch (error) {
4960
- input.onDiagnostic?.(error);
5054
+ const hits = input.implicated.filter((path2) => pathBoundaryCovers(boundary, path2));
5055
+ if (hits.length === 0) continue;
5056
+ implicatedDeclarers.add(member.runId);
5057
+ for (const hit of hits) decisive.add(hit);
5058
+ }
5059
+ const others = input.wave.filter((member) => !declared.has(member.runId));
5060
+ const ownedElsewhere = input.implicated.length > 0 && input.implicated.every((path2) => others.some((member) => pathBoundaryCovers(memberBoundary(member), path2)));
5061
+ const localized = implicatedDeclarers.size > 0 || ownedElsewhere;
5062
+ const charged = localized ? new Set(implicatedDeclarers) : new Set(declared);
5063
+ for (const runId of unconfined) charged.add(runId);
5064
+ return {
5065
+ charged,
5066
+ basis: !localized || unconfined.size > 0 ? "unattributable" : implicatedDeclarers.size > 0 ? "write_roots" : "attributed_elsewhere",
5067
+ decisive: [...decisive].sort()
5068
+ };
5069
+ }
5070
+ function createBatchVerificationGate(options = {}) {
5071
+ const stateDir = options.stateDir ?? clioStateDir();
5072
+ const env = options.env ?? process.env;
5073
+ const liveMembers = /* @__PURE__ */ new Set();
5074
+ const parked = /* @__PURE__ */ new Map();
5075
+ let settling = false;
5076
+ const perRun = (participant) => runHostVerification({
5077
+ runId: participant.runId,
5078
+ request: participant.request,
5079
+ workerSuccessful: participant.workerSuccessful,
5080
+ stateDir,
5081
+ env,
5082
+ ...participant.onDiagnostic !== void 0 ? { onDiagnostic: participant.onDiagnostic } : {}
5083
+ });
5084
+ const nothingToRun = (participant) => {
5085
+ const checks = participant.request.resolvedVerification;
5086
+ if (checks === void 0 || checks.length === 0) return void 0;
5087
+ return { status: "skipped", reason: "worker_not_successful", checks: [] };
5088
+ };
5089
+ async function settleBatch(wave) {
5090
+ const members = wave.map((entry) => entry.participant);
5091
+ const contributors = members.filter(
5092
+ (member) => member.workerSuccessful && (member.request.resolvedVerification?.length ?? 0) > 0
5093
+ );
5094
+ const distinct = /* @__PURE__ */ new Map();
5095
+ for (const member of contributors) {
5096
+ for (const resolvedCheck of member.request.resolvedVerification ?? []) {
5097
+ const key = checkDedupeKey(resolvedCheck);
5098
+ if (!distinct.has(key)) distinct.set(key, { resolvedCheck, owner: member, index: distinct.size });
5099
+ }
5100
+ }
5101
+ const ran = /* @__PURE__ */ new Map();
5102
+ for (const [key, entry] of distinct) {
5103
+ const outcome = await runResolvedCheck({
5104
+ runId: entry.owner.runId,
5105
+ index: entry.index,
5106
+ resolvedCheck: entry.resolvedCheck,
5107
+ stateDir,
5108
+ env,
5109
+ // The owning member's callback, because the artifact directory is
5110
+ // named for that same run and the diagnostic text is closed over the
5111
+ // run id it was built for (`extension.ts:5534`); any other member's
5112
+ // callback would name a run whose artifacts the failure is not under.
5113
+ ...entry.owner.onDiagnostic !== void 0 ? { onDiagnostic: entry.owner.onDiagnostic } : {}
5114
+ });
5115
+ ran.set(key, { check: outcome.check, owner: entry.owner.runId, outputExcerpt: outcome.outputExcerpt });
5116
+ }
5117
+ const attribution = [];
5118
+ const chargedByKey = /* @__PURE__ */ new Map();
5119
+ for (const [key, entry] of ran) {
5120
+ if (entry.check.exitCode === 0) continue;
5121
+ const declarers = contributors.filter(
5122
+ (member) => (member.request.resolvedVerification ?? []).some((candidate) => checkDedupeKey(candidate) === key)
5123
+ );
5124
+ const implicated = implicatedPaths(entry.outputExcerpt, entry.check.cwd);
5125
+ const verdict = attributeFailure({ implicated, declarers, wave: members });
5126
+ chargedByKey.set(key, verdict.charged);
5127
+ const decisive = new Set(verdict.decisive);
5128
+ attribution.push({
5129
+ check: entry.check.check,
5130
+ // The paths that decided the charge lead the capped list. A large
5131
+ // suite names more than 32 files and the sealed evidence has to
5132
+ // contain the path a receipt was charged on, or it documents nothing.
5133
+ implicated: [...verdict.decisive, ...implicated.filter((path2) => !decisive.has(path2))].slice(
5134
+ 0,
5135
+ IMPLICATED_PATH_CAP
5136
+ ),
5137
+ charged: [...verdict.charged].sort(),
5138
+ basis: verdict.basis
5139
+ });
5140
+ }
5141
+ attribution.sort((first, second) => first.check < second.check ? -1 : first.check > second.check ? 1 : 0);
5142
+ for (const entry of wave) {
5143
+ const member = entry.participant;
5144
+ if (!contributors.includes(member)) {
5145
+ entry.settle(nothingToRun(member));
5146
+ continue;
4961
5147
  }
5148
+ const own = [];
5149
+ let rejected = false;
5150
+ let unimplicated = false;
5151
+ for (const resolvedCheck of member.request.resolvedVerification ?? []) {
5152
+ const key = checkDedupeKey(resolvedCheck);
5153
+ const shared = ran.get(key);
5154
+ if (shared === void 0) continue;
5155
+ own.push(
5156
+ shared.owner === member.runId || shared.check.evidenceRunId !== void 0 ? { ...shared.check, argv: [...shared.check.argv] } : { ...shared.check, argv: [...shared.check.argv], evidenceRunId: shared.owner }
5157
+ );
5158
+ if (shared.check.exitCode === 0) continue;
5159
+ if (chargedByKey.get(key)?.has(member.runId) === true) rejected = true;
5160
+ else unimplicated = true;
5161
+ }
5162
+ entry.settle({
5163
+ // `verified` states that every declared check passed, which is what
5164
+ // `trust-status.ts:619` certifies and what the board and
5165
+ // `worker-evidence.ts:161` print. An exculpated member's checks array
5166
+ // still carries a non-zero exit code, so it seals its own status
5167
+ // instead of borrowing that claim.
5168
+ status: rejected ? "rejected" : unimplicated ? "not_implicated" : "verified",
5169
+ ...!rejected && unimplicated ? { reason: "batch_settled_not_implicated" } : {},
5170
+ checks: own,
5171
+ strategy: "batch-settled",
5172
+ // Copied per receipt so no two members of the batch share a mutable array.
5173
+ ...attribution.length > 0 ? {
5174
+ attribution: attribution.map((record) => ({
5175
+ ...record,
5176
+ implicated: [...record.implicated],
5177
+ charged: [...record.charged]
5178
+ }))
5179
+ } : {}
5180
+ });
4962
5181
  }
4963
5182
  }
5183
+ function maybeSettle() {
5184
+ if (settling || parked.size === 0) return;
5185
+ for (const runId of liveMembers) {
5186
+ if (!parked.has(runId)) return;
5187
+ }
5188
+ settling = true;
5189
+ const wave = [...parked.values()];
5190
+ for (const runId of parked.keys()) liveMembers.delete(runId);
5191
+ parked.clear();
5192
+ void settleBatch(wave).catch(async (error) => {
5193
+ for (const entry of wave) {
5194
+ entry.participant.onDiagnostic?.(error);
5195
+ try {
5196
+ entry.settle(await perRun(entry.participant));
5197
+ } catch (fallbackError) {
5198
+ entry.fail(fallbackError);
5199
+ }
5200
+ }
5201
+ }).finally(() => {
5202
+ settling = false;
5203
+ maybeSettle();
5204
+ });
5205
+ }
4964
5206
  return {
4965
- status: results.every((check) => check.exitCode === 0) ? "verified" : "rejected",
4966
- checks: results
5207
+ live(runId) {
5208
+ liveMembers.add(runId);
5209
+ },
5210
+ abandon(runId) {
5211
+ if (parked.has(runId) || !liveMembers.delete(runId)) return;
5212
+ maybeSettle();
5213
+ },
5214
+ arrive(input) {
5215
+ liveMembers.add(input.runId);
5216
+ const parkedPromise = new Promise((settle, fail) => {
5217
+ parked.set(input.runId, { participant: input, settle, fail });
5218
+ });
5219
+ maybeSettle();
5220
+ return parkedPromise;
5221
+ }
4967
5222
  };
4968
5223
  }
4969
5224
 
@@ -5463,9 +5718,9 @@ function completedReroutes(reroutes, toNode) {
5463
5718
  }
5464
5719
  function requestedNodeId(req, settings) {
5465
5720
  if (req.node !== void 0 && req.node.trim().length > 0) return req.node.trim();
5466
- const workers = settings?.workers;
5721
+ const workers = settings?.fleet;
5467
5722
  if (!workers) return null;
5468
- const profileName = req.workerProfile ?? workers.agentBindings?.[req.agentId];
5723
+ const profileName = req.workerProfile ?? workers.agentProfiles?.[req.agentId];
5469
5724
  if (!profileName) return null;
5470
5725
  const pin = workers.profiles?.[profileName]?.node;
5471
5726
  return pin !== void 0 && pin.trim().length > 0 ? pin.trim() : null;
@@ -5736,7 +5991,7 @@ function retireHistory(path2, version) {
5736
5991
  const retired = `${path2}.v${String(version)}.${stamp}.retired`;
5737
5992
  renameSync3(path2, retired);
5738
5993
  process.stderr.write(
5739
- `[clio:dispatch] route history v${String(version)} is retired; starting empty at v${ROUTE_HISTORY_VERSION}. Prior observations: ${retired}
5994
+ `[clio-coder:dispatch] route history v${String(version)} is retired; starting empty at v${ROUTE_HISTORY_VERSION}. Prior observations: ${retired}
5740
5995
  `
5741
5996
  );
5742
5997
  }
@@ -6283,24 +6538,25 @@ function isRecord6(value) {
6283
6538
  return typeof value === "object" && value !== null && !Array.isArray(value);
6284
6539
  }
6285
6540
  function eventDetail(event) {
6286
- const text = assistantTextFromEvent(event);
6541
+ const normalized = isRecord6(event) ? normalizeClioCoderEventRecord(event) : event;
6542
+ const text = assistantTextFromEvent(normalized);
6287
6543
  if (text.length > 0) return truncateUtf8(text, RUN_TAIL_TEXT_LIMIT, "...");
6288
- if (!isRecord6(event)) return void 0;
6289
- if (event.type === "clio_tool_finish" && isRecord6(event.payload)) {
6290
- const tool = typeof event.payload.tool === "string" ? event.payload.tool : "tool";
6291
- const outcome = typeof event.payload.outcome === "string" ? event.payload.outcome : "";
6544
+ if (!isRecord6(normalized)) return void 0;
6545
+ if (normalized.type === "clio_coder_tool_finish" && isRecord6(normalized.payload)) {
6546
+ const tool = typeof normalized.payload.tool === "string" ? normalized.payload.tool : "tool";
6547
+ const outcome = typeof normalized.payload.outcome === "string" ? normalized.payload.outcome : "";
6292
6548
  return `${tool} ${outcome}`.trim();
6293
6549
  }
6294
- if (event.type === "attempt_start") {
6295
- const attempt = typeof event.attempt === "number" ? event.attempt : "?";
6296
- const runId = typeof event.runId === "string" ? event.runId : "?";
6297
- const reason = typeof event.reason === "string" ? event.reason : "retry";
6550
+ if (normalized.type === "attempt_start") {
6551
+ const attempt = typeof normalized.attempt === "number" ? normalized.attempt : "?";
6552
+ const runId = typeof normalized.runId === "string" ? normalized.runId : "?";
6553
+ const reason = typeof normalized.reason === "string" ? normalized.reason : "retry";
6298
6554
  return truncateUtf8(`attempt ${attempt} -> ${runId}: ${reason}`, RUN_TAIL_TEXT_LIMIT, "...");
6299
6555
  }
6300
6556
  return void 0;
6301
6557
  }
6302
6558
  function runTailEntryFromEvent(event, at = (/* @__PURE__ */ new Date()).toISOString()) {
6303
- const type = isRecord6(event) && typeof event.type === "string" ? event.type : "unknown";
6559
+ const type = isRecord6(event) && typeof event.type === "string" ? normalizeClioCoderEventType(event.type) : "unknown";
6304
6560
  if (type === "heartbeat" || type === "message_update") return null;
6305
6561
  const entry = { at, type };
6306
6562
  const detail = eventDetail(event);
@@ -6986,7 +7242,7 @@ function calculateUsageCostUsd(meter, pricing) {
6986
7242
  return (meter.inputTokens * pricing.input + meter.outputTokens * pricing.output + meter.cacheReadTokens * pricing.cacheRead + meter.cacheWriteTokens * pricing.cacheWrite) / 1e6;
6987
7243
  }
6988
7244
  function admissionMaxOutputTokens(settings) {
6989
- return settings?.defaults.maxTokens ?? DEFAULT_SETTINGS.defaults.maxTokens;
7245
+ return settings?.chat.maxOutputTokens ?? DEFAULT_SETTINGS.chat.maxOutputTokens;
6990
7246
  }
6991
7247
  function conservativeRouteAdmissionEstimateUsd(pricing, maxOutputTokens) {
6992
7248
  if (pricing.provenance === "known_free") return 0;
@@ -7018,7 +7274,7 @@ function eventContainsFirstModelToken(event) {
7018
7274
  return assistantEvent?.type === "text_delta" || assistantEvent?.type === "thinking_delta" || assistantEvent?.type === "toolcall_start" || assistantEvent?.type === "toolcall_delta";
7019
7275
  }
7020
7276
  function eventStartsTool(event) {
7021
- return event.type === "tool_execution_start" || event.type === "clio_tool_start";
7277
+ return event.type === "tool_execution_start" || event.type === "clio_coder_tool_start";
7022
7278
  }
7023
7279
  function finitePositive(value) {
7024
7280
  return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
@@ -7151,7 +7407,7 @@ async function awaitEventDrain(drained, graceMs = DISPATCH_DRAIN_GRACE_MS) {
7151
7407
  function reportDispatchDiagnostic(scope, error) {
7152
7408
  const message = error instanceof Error ? error.message : String(error);
7153
7409
  try {
7154
- process.stderr.write(`[clio:dispatch] ${scope}: ${message}
7410
+ process.stderr.write(`[clio-coder:dispatch] ${scope}: ${message}
7155
7411
  `);
7156
7412
  } catch {
7157
7413
  }
@@ -7570,9 +7826,7 @@ function assertPostRuntimeToolCompatibility(agentId, spec, effectiveTools, targe
7570
7826
  );
7571
7827
  }
7572
7828
  function workerToolCallHardCap(settings) {
7573
- const rawEnvCap = process.env.CLIO_CODER_WORKER_TOOL_CALL_CAP?.trim();
7574
- const parsedEnvCap = rawEnvCap && /^[1-9]\d*$/.test(rawEnvCap) ? Number(rawEnvCap) : Number.NaN;
7575
- return Number.isSafeInteger(parsedEnvCap) ? parsedEnvCap : settings?.guardrails.workerToolCallCap ?? GUARDRAIL_DEFAULTS.workerToolCallCap;
7829
+ return settings?.fleet.limits.toolCallsPerRun ?? GUARDRAIL_DEFAULTS.workerToolCallCap;
7576
7830
  }
7577
7831
  function resolveEffectiveWorkerBudget(input) {
7578
7832
  const hardCap = workerToolCallHardCap(input.settings);
@@ -7670,13 +7924,13 @@ function acpRuntimeLimitations() {
7670
7924
  ];
7671
7925
  }
7672
7926
  function readWorkerTargets(settings) {
7673
- const workerDefault = settings?.workers?.default ? {
7674
- target: settings.workers.default.target ?? null,
7675
- model: settings.workers.default.model ?? null,
7676
- thinkingLevel: settings.workers.default.thinkingLevel ?? "off"
7927
+ const workerDefault = settings?.fleet?.default ? {
7928
+ target: settings.fleet.default.target ?? null,
7929
+ model: settings.fleet.default.model ?? null,
7930
+ thinkingLevel: settings.fleet.default.thinkingLevel ?? "off"
7677
7931
  } : null;
7678
7932
  const workerProfiles = {};
7679
- for (const [name, profile] of Object.entries(settings?.workers?.profiles ?? {})) {
7933
+ for (const [name, profile] of Object.entries(settings?.fleet?.profiles ?? {})) {
7680
7934
  workerProfiles[name] = {
7681
7935
  target: profile.target ?? null,
7682
7936
  model: profile.model ?? null,
@@ -7684,7 +7938,7 @@ function readWorkerTargets(settings) {
7684
7938
  };
7685
7939
  }
7686
7940
  const agentBindings = {};
7687
- for (const [agentId, profileName] of Object.entries(settings?.workers?.agentBindings ?? {})) {
7941
+ for (const [agentId, profileName] of Object.entries(settings?.fleet?.agentProfiles ?? {})) {
7688
7942
  const id = agentId.trim();
7689
7943
  const profile = profileName.trim();
7690
7944
  if (id.length > 0 && profile.length > 0) agentBindings[id] = profile;
@@ -7821,12 +8075,12 @@ function buildDispatchWorkerSpec(input, config) {
7821
8075
  if (input.req.trustProjectCompatRoots !== void 0) {
7822
8076
  spec.trustProjectCompatRoots = input.req.trustProjectCompatRoots;
7823
8077
  } else if (settings) {
7824
- spec.trustProjectCompatRoots = settings.skills.trustProjectCompatRoots === true;
8078
+ spec.trustProjectCompatRoots = settings.integrations.projectResources.trustProjectImports === true;
7825
8079
  }
7826
- spec.gitCommitAttribution = settings?.attribution.gitCommits ?? true;
7827
- spec.onPermission = settings?.workers.onPermission ?? "deny";
8080
+ spec.gitCommitAttribution = settings?.integrations.git.commitAttribution ?? true;
8081
+ spec.onPermission = settings?.fleet.permissions.mode ?? "deny";
7828
8082
  if (spec.onPermission === "escalate") {
7829
- const escalation = settings?.workers.escalation;
8083
+ const escalation = settings?.fleet.permissions.escalation;
7830
8084
  if (escalation) spec.escalation = { timeoutMs: escalation.timeoutMs, fallback: escalation.fallback };
7831
8085
  }
7832
8086
  assertRuntimeCanHonorWorkerPermissionMode(input.target.runtime, spec.onPermission);
@@ -8214,7 +8468,7 @@ function createDispatchBundle(context, options) {
8214
8468
  const heartbeatIntervalMs = options?.heartbeatIntervalMs ?? DEFAULT_HEARTBEAT_INTERVAL_MS;
8215
8469
  const getResilienceCooldownMs = () => {
8216
8470
  if (options?.resilienceCooldownMs !== void 0) return options.resilienceCooldownMs;
8217
- const settingsVal = getEffectiveSettings()?.workers?.resilienceCooldownMs;
8471
+ const settingsVal = getEffectiveSettings()?.fleet?.retry.routeCooldownMs;
8218
8472
  if (settingsVal !== void 0 && settingsVal >= 0) return settingsVal;
8219
8473
  return DEFAULT_RESILIENCE_COOLDOWN_MS;
8220
8474
  };
@@ -8262,6 +8516,17 @@ function createDispatchBundle(context, options) {
8262
8516
  function configuredEndpointLimits() {
8263
8517
  return Object.fromEntries(Object.entries(configuredEndpointCapacities()).map(([key, value]) => [key, value.limit]));
8264
8518
  }
8519
+ const probedDefaultBoundEndpoints = /* @__PURE__ */ new Set();
8520
+ function probeEndpointsAtDefaultBound() {
8521
+ const capacities = configuredEndpointCapacities();
8522
+ for (const target of getEffectiveSettings()?.targets ?? []) {
8523
+ const key = canonicalEndpointKey(target);
8524
+ if (key === null || capacities[key]?.source !== "local-native-default") continue;
8525
+ if (probedDefaultBoundEndpoints.has(key)) continue;
8526
+ probedDefaultBoundEndpoints.add(key);
8527
+ void providers.probeTarget(target.id, { reasoning: false }).catch(() => void 0);
8528
+ }
8529
+ }
8265
8530
  function endpointCapacityForTarget(targetId) {
8266
8531
  const status = providers.list().find((entry) => entry.target.id === targetId);
8267
8532
  const target = status?.target ?? providers.getTarget(targetId);
@@ -8342,7 +8607,7 @@ function createDispatchBundle(context, options) {
8342
8607
  }
8343
8608
  }
8344
8609
  function configuredGlobalCapacity(settings) {
8345
- const configured = settings?.budget.concurrency;
8610
+ const configured = settings?.fleet.concurrency;
8346
8611
  return scheduling.maxWorkers?.() ?? (configured === "auto" || configured === void 0 ? 4 : Math.max(1, configured));
8347
8612
  }
8348
8613
  function publishCapacityQueued(identity, timing, node) {
@@ -8418,7 +8683,7 @@ function createDispatchBundle(context, options) {
8418
8683
  const finalizedTotals = { inputTokens: 0, outputTokens: 0, totalTokens: 0, costUsd: 0, runtimeSeconds: 0 };
8419
8684
  const finalizedCosts = [];
8420
8685
  function workersMaxRetries(settings = getEffectiveSettings()) {
8421
- const value = settings?.workers?.maxRetries;
8686
+ const value = settings?.fleet?.retry.maxRetries;
8422
8687
  return typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : 2;
8423
8688
  }
8424
8689
  function failoverModeFor(req) {
@@ -8915,6 +9180,17 @@ function createDispatchBundle(context, options) {
8915
9180
  agentId: req.agentId
8916
9181
  });
8917
9182
  }
9183
+ const parentTokenDiagnostic = inferredScopeParentTokenDiagnostic(pathScope);
9184
+ if (parentTokenDiagnostic !== null) {
9185
+ reportDispatchDiagnostic("inferred scope parent tokens", new Error(parentTokenDiagnostic));
9186
+ }
9187
+ const parentTokenNotice = inferredScopeParentTokenNotice(pathScope);
9188
+ if (parentTokenNotice !== null) {
9189
+ context.bus.emit(BusChannels.DispatchScopeNotice, {
9190
+ ...parentTokenNotice,
9191
+ agentId: req.agentId
9192
+ });
9193
+ }
8918
9194
  }
8919
9195
  async function resolveLifecycle(req, settings) {
8920
9196
  const recipe = agents.get(req.agentId);
@@ -8936,7 +9212,8 @@ function createDispatchBundle(context, options) {
8936
9212
  task: req.task,
8937
9213
  autoSelected: req.agentSelection?.mode === "auto",
8938
9214
  resultContractKind: spec.resultContract.kind,
8939
- specs: agents.listSpecs()
9215
+ specs: agents.listSpecs(),
9216
+ intent: req.intent ?? null
8940
9217
  });
8941
9218
  if (capabilityMismatch?.verdict === "refuse") throw new Error(capabilityMismatch.detail);
8942
9219
  const pathScope = resolveDispatchPathScope(req);
@@ -8953,10 +9230,10 @@ function createDispatchBundle(context, options) {
8953
9230
  providers
8954
9231
  );
8955
9232
  enforceCapabilityGate(target.target.id, target.modelCapabilities, req.requiredCapabilities);
8956
- assertRuntimeCanHonorWorkerPermissionMode(target.runtime, settings?.workers.onPermission ?? "deny");
9233
+ assertRuntimeCanHonorWorkerPermissionMode(target.runtime, settings?.fleet.permissions.mode ?? "deny");
8957
9234
  assertWorkerBudgetEnforceable(target.runtime, spec.budget !== null || req.budget !== void 0);
8958
9235
  const cwd = req.cwd ?? process.cwd();
8959
- const sessionAutonomy = settings?.autonomy ?? "auto-edit";
9236
+ const sessionAutonomy = settings?.safety.autonomy ?? "auto-edit";
8960
9237
  const effectiveAutonomy = clampWorkerAutonomy(sessionAutonomy, req.autonomy);
8961
9238
  const effectiveTools = withLedgerToolNarrowing(
8962
9239
  effectiveToolNames(admission.allowedTools, target, pathScope.writeBoundaries.length > 0, deniedToolNames(req)),
@@ -8968,14 +9245,16 @@ function createDispatchBundle(context, options) {
8968
9245
  allowedTools: effectiveTools
8969
9246
  };
8970
9247
  const personaBody = workerPersonaBody(req, recipe, effectiveTools);
9248
+ const hasCanonicalContext = effectiveTools.includes(ToolNames.Context);
9249
+ const hasBoundSkills = hasCanonicalContext && recipe.skills !== void 0 && recipe.skills.length > 0 && req.noSkills !== true;
8971
9250
  const compiledWorkerPrompt = await prompts.compileWorkerPrompt({
8972
9251
  autonomy: effectiveAutonomy,
8973
9252
  providerSupportsTools: target.runtime.kind === "subprocess" ? null : targetToolCapability(target),
8974
9253
  toolNames: effectiveTools,
8975
- toolPromptHints: toolPromptHintsForNames(effectiveTools),
8976
- hasCanonicalContext: effectiveTools.includes(ToolNames.Context),
8977
- hasBoundSkills: effectiveTools.includes(ToolNames.Context) && recipe.skills !== void 0 && recipe.skills.length > 0 && req.noSkills !== true,
8978
- onPermission: settings?.workers.onPermission ?? "deny",
9254
+ toolPromptHints: toolPromptHintsForNames(effectiveTools, hasBoundSkills ? "bound-worker" : "worker"),
9255
+ hasCanonicalContext,
9256
+ hasBoundSkills,
9257
+ onPermission: settings?.fleet.permissions.mode ?? "deny",
8979
9258
  persona: {
8980
9259
  id: `persona.${recipe.id}`,
8981
9260
  relPath: recipe.filepath,
@@ -9000,7 +9279,7 @@ function createDispatchBundle(context, options) {
9000
9279
  capabilityClass: spec.capabilityClass,
9001
9280
  projectContextTier: tier,
9002
9281
  autonomy: effectiveAutonomy,
9003
- onPermission: settings?.workers.onPermission ?? "deny",
9282
+ onPermission: settings?.fleet.permissions.mode ?? "deny",
9004
9283
  project,
9005
9284
  workspace: readWorkspaceRootFacts(cwd)
9006
9285
  });
@@ -9013,7 +9292,7 @@ function createDispatchBundle(context, options) {
9013
9292
  const personaOverride = personaOverrideFor(req, staticCompositionHash);
9014
9293
  const currentToolSignature = toolSignature(effectiveTools);
9015
9294
  const auth = targetRequiresAuth(target.target, target.runtime) ? await providers.auth.resolveForTarget(target.target, target.runtime) : null;
9016
- const apiKey = auth?.apiKey ?? (auth === null ? "clio-local-target" : void 0);
9295
+ const apiKey = auth?.apiKey ?? (auth === null ? "clio-coder-local-target" : void 0);
9017
9296
  const runtimeKind = target.runtime.kind;
9018
9297
  const limitations = runtimeLimitations(runtimeKind, target.runtime.id);
9019
9298
  return {
@@ -9064,16 +9343,16 @@ function createDispatchBundle(context, options) {
9064
9343
  }
9065
9344
  }
9066
9345
  if (!settings) throw new Error("dispatch: effective settings required for ACP delegation");
9067
- const configured = settings.delegation.agents.find((entry) => entry.id === agentId);
9346
+ const configured = settings.integrations.externalAgents.entries.find((entry) => entry.id === agentId);
9068
9347
  if (!configured) throw new Error(`dispatch: ACP delegation agent '${agentId}' not configured`);
9069
- const toolGovernance = configured.toolGovernance ?? "clio-policy";
9348
+ const toolGovernance = configured.toolGovernance ?? "clio-coder-policy";
9070
9349
  if (options?.autonomyOverride === true && toolGovernance === "agent-managed") {
9071
9350
  throw new Error(
9072
- `dispatch: ACP delegation agent '${agentId}' uses toolGovernance='agent-managed', which cannot enforce an explicit one-run autonomy override; choose clio-policy or deny-all governance, or omit --autonomy`
9351
+ `dispatch: ACP delegation agent '${agentId}' uses toolGovernance='agent-managed', which cannot enforce an explicit one-run autonomy override; choose clio-coder-policy or deny-all governance, or omit --autonomy`
9073
9352
  );
9074
9353
  }
9075
9354
  const admission = resolveDelegationAdmissionStage(req, safety);
9076
- const sessionAutonomy = settings.autonomy ?? "auto-edit";
9355
+ const sessionAutonomy = settings.safety.autonomy ?? "auto-edit";
9077
9356
  const autonomy = clampWorkerAutonomy(sessionAutonomy, req.autonomy);
9078
9357
  if (toolGovernance === "agent-managed" && autonomy !== sessionAutonomy) {
9079
9358
  throw new Error(
@@ -9217,12 +9496,12 @@ function createDispatchBundle(context, options) {
9217
9496
  if (eventContainsFirstModelToken(event)) markObservedPhase("firstModelTokenAt");
9218
9497
  if (eventStartsTool(event)) markObservedPhase("firstToolAt");
9219
9498
  }
9220
- if (event.type === "clio_tool_start" && event.payload && typeof event.payload.tool === "string") {
9499
+ if (event.type === "clio_coder_tool_start" && event.payload && typeof event.payload.tool === "string") {
9221
9500
  recordToolStart(inFlightTools, event.payload);
9222
9501
  }
9223
- if (event.type === "clio_run_outcome" && !reportedSpoofedOutcome) {
9502
+ if (event.type === "clio_coder_run_outcome" && !reportedSpoofedOutcome) {
9224
9503
  reportedSpoofedOutcome = true;
9225
- reportDispatchDiagnostic("ACP outcome event", new Error("ignored untrusted clio_run_outcome assertion"));
9504
+ reportDispatchDiagnostic("ACP outcome event", new Error("ignored untrusted clio_coder_run_outcome assertion"));
9226
9505
  }
9227
9506
  if (isRecord8(event)) {
9228
9507
  const finishEntry = appendDispatchFinishContractEntry(finishContractEntries, event);
@@ -9253,7 +9532,7 @@ function createDispatchBundle(context, options) {
9253
9532
  if (message !== null) failureMessage = message;
9254
9533
  }
9255
9534
  }
9256
- if (event.type === "clio_permission_resolved" && event.payload && typeof event.payload.tool === "string") {
9535
+ if (event.type === "clio_coder_permission_resolved" && event.payload && typeof event.payload.tool === "string") {
9257
9536
  const requestId = typeof event.payload.requestId === "string" ? event.payload.requestId : `delegation-permission-${Date.now()}`;
9258
9537
  const origin = runIdForPermissionAudit !== null ? `delegation:${runIdForPermissionAudit}` : "delegation:unknown";
9259
9538
  const actionClass = typeof event.payload.actionClass === "string" ? event.payload.actionClass : "unknown";
@@ -9277,7 +9556,7 @@ function createDispatchBundle(context, options) {
9277
9556
  ...runIdForPermissionAudit !== null ? { requestedBy: runIdForPermissionAudit } : {}
9278
9557
  });
9279
9558
  }
9280
- if (event.type === "clio_tool_finish" && event.payload && typeof event.payload.tool === "string") {
9559
+ if (event.type === "clio_coder_tool_finish" && event.payload && typeof event.payload.tool === "string") {
9281
9560
  recordToolCompletion(inFlightTools, event.payload);
9282
9561
  recordToolFinish(toolStats, event.payload);
9283
9562
  if (event.payload.decision === "allowed") safetyDecisionCounts.allowed += 1;
@@ -9455,7 +9734,7 @@ function createDispatchBundle(context, options) {
9455
9734
  const finalFailureMessage = result.failureMessage ?? failureMessage;
9456
9735
  const finalToolStats = snapshotToolStats(toolStats);
9457
9736
  const unfinished = snapshotUnfinishedTools(inFlightTools);
9458
- const toolGovernance = lifecycle.agentConfig.toolGovernance ?? "clio-policy";
9737
+ const toolGovernance = lifecycle.agentConfig.toolGovernance ?? "clio-coder-policy";
9459
9738
  return {
9460
9739
  runId: envelope.id,
9461
9740
  agentId: req.agentId,
@@ -9505,7 +9784,7 @@ function createDispatchBundle(context, options) {
9505
9784
  dynamicHash: lifecycle.dynamicHash,
9506
9785
  promptSignature: lifecycle.promptSignature,
9507
9786
  toolSignature: lifecycle.toolSignature,
9508
- clioVersion: readClioVersion(),
9787
+ clioCoderVersion: readClioVersion(),
9509
9788
  piMonoVersion: readPiMonoVersion(),
9510
9789
  platform: process.platform,
9511
9790
  nodeVersion: process.version,
@@ -9519,7 +9798,7 @@ function createDispatchBundle(context, options) {
9519
9798
  quality: createRunReceiptQuality({ runtimeEnforceable: false, enforcementPassed: null, resultContract: null }),
9520
9799
  autonomyEnforcement: autonomyEnforcementForAcpDelegation(
9521
9800
  lifecycle.autonomy,
9522
- lifecycle.agentConfig.toolGovernance ?? "clio-policy",
9801
+ lifecycle.agentConfig.toolGovernance ?? "clio-coder-policy",
9523
9802
  lifecycle.sessionAutonomy,
9524
9803
  req.autonomy
9525
9804
  ),
@@ -9549,7 +9828,7 @@ function createDispatchBundle(context, options) {
9549
9828
  toolCallsRequested: result.delegation.toolCallsRequested,
9550
9829
  toolCallsApproved: result.delegation.toolCallsApproved,
9551
9830
  toolCallsDenied: result.delegation.toolCallsDenied,
9552
- toolGovernance: lifecycle.agentConfig.toolGovernance ?? "clio-policy",
9831
+ toolGovernance: lifecycle.agentConfig.toolGovernance ?? "clio-coder-policy",
9553
9832
  toolCallLog: acp.toolCallLog()
9554
9833
  },
9555
9834
  sessionId: result.delegation.acpSessionId
@@ -9752,11 +10031,11 @@ function createDispatchBundle(context, options) {
9752
10031
  finalPromise
9753
10032
  };
9754
10033
  }
9755
- async function dispatchAttempt(req, observer) {
10034
+ async function dispatchAttempt(req, observer, settlement) {
9756
10035
  const requestedAt = new Date(now()).toISOString();
9757
10036
  const timing = { requestedAt, decisionStartedAt: requestedAt };
9758
10037
  const settings = getEffectiveSettings();
9759
- const isAcpAgent = settings?.delegation?.agents?.some((entry) => entry.id === req.agentId) ?? false;
10038
+ const isAcpAgent = settings?.integrations.externalAgents?.entries?.some((entry) => entry.id === req.agentId) ?? false;
9760
10039
  if (isAcpAgent && !req.delegationAgentId) {
9761
10040
  req.delegationAgentId = req.agentId;
9762
10041
  }
@@ -9772,7 +10051,7 @@ function createDispatchBundle(context, options) {
9772
10051
  const recipe = agents.get(req.agentId);
9773
10052
  const activation = consumeActiveRouteApproval({
9774
10053
  request: req,
9775
- settings: settings?.routing,
10054
+ settings: settings?.fleet.adaptiveRouting,
9776
10055
  capabilityClass: recipe === null ? null : normalizeAgentSpec(recipe).capabilityClass,
9777
10056
  failover: failoverModeFor(req),
9778
10057
  requestedAt,
@@ -9833,10 +10112,9 @@ function createDispatchBundle(context, options) {
9833
10112
  }
9834
10113
  rebindReservationSlot(req, "local", null, UNKNOWN_PRICING_ADMISSION_ESTIMATE_USD, settings);
9835
10114
  routeObservation = observeShadowRoute(req, void 0, settings);
9836
- return attachRouteObservation({
9837
- ...await dispatchAcpDelegation(req, settings, timing, routeObservation.decision, observer),
9838
- effectiveRequest: req
9839
- });
10115
+ const delegated = await dispatchAcpDelegation(req, settings, timing, routeObservation.decision, observer);
10116
+ settlement?.live(delegated.runId);
10117
+ return attachRouteObservation({ ...delegated, effectiveRequest: req });
9840
10118
  }
9841
10119
  req = routeAroundCoolingTarget(req, settings) ?? req;
9842
10120
  const lifecycle = await resolveLifecycle(req, settings);
@@ -10029,7 +10307,7 @@ function createDispatchBundle(context, options) {
10029
10307
  context.bus.emit(BusChannels.DispatchProgress, {
10030
10308
  runId,
10031
10309
  agentId: req.agentId,
10032
- event: { type: "clio_write_record_downgraded", payload: downgrade }
10310
+ event: { type: "clio_coder_write_record_downgraded", payload: downgrade }
10033
10311
  });
10034
10312
  }
10035
10313
  });
@@ -10060,11 +10338,11 @@ function createDispatchBundle(context, options) {
10060
10338
  if (eventContainsFirstModelToken(event)) markObservedPhase("firstModelTokenAt");
10061
10339
  if (eventStartsTool(event)) markObservedPhase("firstToolAt");
10062
10340
  }
10063
- if (event.type === "clio_tool_start" && event.payload && typeof event.payload.tool === "string") {
10341
+ if (event.type === "clio_coder_tool_start" && event.payload && typeof event.payload.tool === "string") {
10064
10342
  recordToolStart(inFlightTools, event.payload);
10065
10343
  }
10066
- if (event.type === "clio_steer_received") acknowledgeSteer(event.payload?.sequence);
10067
- if (event.type === "clio_run_outcome" && isRunOutcomeCode(event.payload?.outcomeCode) && event.payload.outcomeCode !== "worker_final_output_missing" && event.payload.outcomeCode !== "host_verification_rejected") {
10344
+ if (event.type === "clio_coder_steer_received") acknowledgeSteer(event.payload?.sequence);
10345
+ if (event.type === "clio_coder_run_outcome" && isRunOutcomeCode(event.payload?.outcomeCode) && event.payload.outcomeCode !== "worker_final_output_missing" && event.payload.outcomeCode !== "host_verification_rejected") {
10068
10346
  if (acceptsOutcomeCodeEvents) {
10069
10347
  trustedOutcomeCodes.add(event.payload.outcomeCode);
10070
10348
  } else if (!reportedUntrustedOutcome) {
@@ -10083,7 +10361,7 @@ function createDispatchBundle(context, options) {
10083
10361
  }
10084
10362
  recordWorkerRunEffect(runEffects, event);
10085
10363
  }
10086
- if (event.type === "clio_permission_escalated" && event.payload && typeof event.payload.requestId === "string") {
10364
+ if (event.type === "clio_coder_permission_escalated" && event.payload && typeof event.payload.requestId === "string") {
10087
10365
  escalationCounts.requested += 1;
10088
10366
  const ctx = isRecord8(event.payload.decision) ? event.payload.decision : null;
10089
10367
  const classification = ctx !== null && isRecord8(ctx.classification) ? ctx.classification : null;
@@ -10136,7 +10414,7 @@ function createDispatchBundle(context, options) {
10136
10414
  if (message !== null) failureMessage = message;
10137
10415
  }
10138
10416
  }
10139
- if (event.type === "clio_permission_resolved" && event.payload && typeof event.payload.tool === "string") {
10417
+ if (event.type === "clio_coder_permission_resolved" && event.payload && typeof event.payload.tool === "string") {
10140
10418
  const source = event.payload.source;
10141
10419
  const granted = (source === "operator" || source === "remembered") && event.payload.decision === "approved";
10142
10420
  const decidedBy = source === "operator" ? "operator" : source === "remembered" ? "operator:remembered" : source === "timeout" ? "timeout" : "policy:no-operator";
@@ -10172,7 +10450,7 @@ function createDispatchBundle(context, options) {
10172
10450
  ...runIdForPermissionAudit !== null ? { requestedBy: runIdForPermissionAudit } : {}
10173
10451
  });
10174
10452
  }
10175
- if (event.type === "clio_tool_finish" && event.payload && typeof event.payload.tool === "string") {
10453
+ if (event.type === "clio_coder_tool_finish" && event.payload && typeof event.payload.tool === "string") {
10176
10454
  recordToolCompletion(inFlightTools, event.payload);
10177
10455
  recordToolFinish(toolStats, event.payload);
10178
10456
  if (isSkillActivation(event.payload.skillActivation)) {
@@ -10471,7 +10749,7 @@ function createDispatchBundle(context, options) {
10471
10749
  dynamicHash: lifecycle.dynamicHash,
10472
10750
  promptSignature: lifecycle.promptSignature,
10473
10751
  toolSignature: lifecycle.toolSignature,
10474
- clioVersion: readClioVersion(),
10752
+ clioCoderVersion: readClioVersion(),
10475
10753
  piMonoVersion: readPiMonoVersion(),
10476
10754
  platform: process.platform,
10477
10755
  nodeVersion: process.version,
@@ -10493,7 +10771,7 @@ function createDispatchBundle(context, options) {
10493
10771
  ...skillActivations.length > 0 ? { skillActivations: [...skillActivations] } : {},
10494
10772
  autonomyEnforcement: autonomyEnforcementForWorkerSpec(
10495
10773
  spec,
10496
- lifecycle.settings?.autonomy ?? "auto-edit",
10774
+ lifecycle.settings?.safety.autonomy ?? "auto-edit",
10497
10775
  req.autonomy
10498
10776
  ),
10499
10777
  safety: {
@@ -10585,6 +10863,7 @@ function createDispatchBundle(context, options) {
10585
10863
  }
10586
10864
  return { assessment, rigor };
10587
10865
  };
10866
+ settlement?.live(envelope.id);
10588
10867
  const finalPromise = (async () => {
10589
10868
  try {
10590
10869
  const result = await workerDone;
@@ -10681,12 +10960,13 @@ function createDispatchBundle(context, options) {
10681
10960
  finalDetail = WORKER_FINAL_OUTPUT_MISSING_DETAIL;
10682
10961
  failureMessage = finalDetail;
10683
10962
  }
10684
- const hostVerification = await runHostVerification({
10963
+ const hostVerificationInput = {
10685
10964
  runId: envelope.id,
10686
10965
  request: req,
10687
10966
  workerSuccessful: finalOutcome === "succeeded",
10688
10967
  onDiagnostic: (error) => reportDispatchDiagnostic(`write host verification memo for ${envelope.id}`, error)
10689
- });
10968
+ };
10969
+ const hostVerification = settlement === void 0 ? await runHostVerification(hostVerificationInput) : await settlement.arrive(hostVerificationInput);
10690
10970
  const hostRejection = hostVerificationRejection(hostVerification);
10691
10971
  if (hostRejection !== null && finalOutcome === "succeeded") {
10692
10972
  finalOutcome = "failed";
@@ -10849,7 +11129,7 @@ function createDispatchBundle(context, options) {
10849
11129
  effectiveRequest: req
10850
11130
  });
10851
11131
  }
10852
- async function dispatch(req, observer) {
11132
+ async function dispatch(req, observer, settlement) {
10853
11133
  let prepared = req;
10854
11134
  let createdWorktree;
10855
11135
  let writerLease;
@@ -10892,7 +11172,7 @@ function createDispatchBundle(context, options) {
10892
11172
  }
10893
11173
  let handle;
10894
11174
  try {
10895
- handle = await dispatchAttempt(prepared, observer);
11175
+ handle = await dispatchAttempt(prepared, observer, settlement);
10896
11176
  } catch (error) {
10897
11177
  writerLease?.release();
10898
11178
  if (createdWorktree !== void 0) {
@@ -10907,6 +11187,10 @@ function createDispatchBundle(context, options) {
10907
11187
  }
10908
11188
  throw error;
10909
11189
  }
11190
+ if (settlement !== void 0) {
11191
+ const release = () => settlement.abandon(handle.runId);
11192
+ handle.finalPromise.then(release, release);
11193
+ }
10910
11194
  if (req.lineage) return { ...handle, finalPromise: handle.finalPromise.finally(() => writerLease?.release()) };
10911
11195
  const assignment = assignments.open(handle.runId, assignmentPolicyFor(handle.effectiveRequest));
10912
11196
  persistAssignment(registerAssignment(assignment.id), `${assignment.id}:open`);
@@ -10920,7 +11204,7 @@ function createDispatchBundle(context, options) {
10920
11204
  return { runId: handle.runId, events: assignment.events, finalPromise: terminal };
10921
11205
  }
10922
11206
  function previewFixed(req, settings = getEffectiveSettings()) {
10923
- const isAcpAgent = settings?.delegation?.agents?.some((entry) => entry.id === req.agentId) ?? false;
11207
+ const isAcpAgent = settings?.integrations.externalAgents?.entries?.some((entry) => entry.id === req.agentId) ?? false;
10924
11208
  if (isAcpAgent && !req.delegationAgentId) req = { ...req, delegationAgentId: req.agentId };
10925
11209
  const validation = routeValidationProjection(req, true);
10926
11210
  const validated = validateJobSpec(validation.jobSpec);
@@ -10993,7 +11277,7 @@ function createDispatchBundle(context, options) {
10993
11277
  req
10994
11278
  );
10995
11279
  assertPostRuntimeToolCompatibility(req.agentId, agentSpec, effectiveTools, target);
10996
- assertRuntimeCanHonorWorkerPermissionMode(target.runtime, settings?.workers.onPermission ?? "deny");
11280
+ assertRuntimeCanHonorWorkerPermissionMode(target.runtime, settings?.fleet.permissions.mode ?? "deny");
10997
11281
  assertWorkerBudgetEnforceable(target.runtime, agentSpec.budget !== null || req.budget !== void 0);
10998
11282
  assertResponseSchemaEnforceable(target.runtime, target.modelCapabilities, req.responseSchema, effectiveTools.length);
10999
11283
  assertWriteRootsEnforceable(target.runtime, pathScope.writeBoundaries);
@@ -11048,7 +11332,7 @@ function createDispatchBundle(context, options) {
11048
11332
  specs,
11049
11333
  request: req,
11050
11334
  mode,
11051
- activeAgentRoles: settings?.routing.agentAutomation.activeAgentRoles ?? [],
11335
+ activeAgentRoles: settings?.fleet.adaptiveRouting.agentRoles ?? [],
11052
11336
  ...agentIntent === void 0 ? {} : { intentOverride: agentIntent }
11053
11337
  });
11054
11338
  const settingsFingerprint = computeSettingsFingerprint(settings ?? null);
@@ -11133,7 +11417,7 @@ function createDispatchBundle(context, options) {
11133
11417
  const recipe = agents.get(req.agentId);
11134
11418
  return planActiveRoute({
11135
11419
  request: req,
11136
- settings: settings?.routing,
11420
+ settings: settings?.fleet.adaptiveRouting,
11137
11421
  capabilityClass: recipe === null ? null : normalizeAgentSpec(recipe).capabilityClass,
11138
11422
  failover: failoverModeFor(req),
11139
11423
  fixed,
@@ -11212,10 +11496,11 @@ function createDispatchBundle(context, options) {
11212
11496
  }
11213
11497
  async function dispatchBatch(reqs) {
11214
11498
  if (reqs.length === 0) throw new Error("dispatch: batch requires at least one request");
11499
+ const settlement = reqs.length > 1 && reqs.some((req) => (req.resolvedVerification?.length ?? 0) > 0) ? createBatchVerificationGate() : void 0;
11215
11500
  const handles = [];
11216
11501
  try {
11217
11502
  for (const req of reqs) {
11218
- const handle = await dispatch(req);
11503
+ const handle = await dispatch(req, void 0, settlement);
11219
11504
  handles.push({ ...handle, agentId: req.agentId });
11220
11505
  }
11221
11506
  } catch (err) {
@@ -11298,7 +11583,7 @@ function createDispatchBundle(context, options) {
11298
11583
  costProvenance: "unknown",
11299
11584
  compiledPromptHash: null,
11300
11585
  staticCompositionHash: null,
11301
- clioVersion: readClioVersion(),
11586
+ clioCoderVersion: readClioVersion(),
11302
11587
  piMonoVersion: readPiMonoVersion(),
11303
11588
  platform: process.platform,
11304
11589
  nodeVersion: process.version,
@@ -11402,6 +11687,7 @@ function createDispatchBundle(context, options) {
11402
11687
  } catch {
11403
11688
  }
11404
11689
  startHeartbeatWatchdog();
11690
+ probeEndpointsAtDefaultBound();
11405
11691
  },
11406
11692
  async stop() {
11407
11693
  draining = true;
@@ -11728,22 +12014,6 @@ var DispatchManifest = {
11728
12014
  dependsOn: ["config", "safety", "agents", "providers", "middleware", "prompts", "scheduling"]
11729
12015
  };
11730
12016
 
11731
- // src/domains/dispatch/code-step-store.ts
11732
- init_esm_shims();
11733
- import { join as join13 } from "node:path";
11734
- function codeStepDir(rootId) {
11735
- return join13(clioStateDir(), "code-steps", rootId);
11736
- }
11737
- function codeStepRecordPath(rootId, runId) {
11738
- return join13(codeStepDir(rootId), `${runId}.json`);
11739
- }
11740
- async function writeCodeStepRecord(rootId, record) {
11741
- const path2 = codeStepRecordPath(rootId, record.runId);
11742
- await atomicWrite(path2, `${JSON.stringify(record, null, 2)}
11743
- `);
11744
- return path2;
11745
- }
11746
-
11747
12017
  // src/domains/dispatch/delegation-plan.ts
11748
12018
  init_esm_shims();
11749
12019
  import { createHash as createHash8 } from "node:crypto";
@@ -12284,7 +12554,7 @@ function gateFailureLines(output) {
12284
12554
  init_esm_shims();
12285
12555
  import { createHash as createHash9 } from "node:crypto";
12286
12556
  import { readFileSync as readFileSync12 } from "node:fs";
12287
- import { join as join14 } from "node:path";
12557
+ import { join as join13 } from "node:path";
12288
12558
 
12289
12559
  // src/domains/observability/cost.ts
12290
12560
  init_esm_shims();
@@ -12568,7 +12838,7 @@ async function executeFleetRun(input) {
12568
12838
  for (const [stepId, replayedResult] of replayed) {
12569
12839
  try {
12570
12840
  const receipt = JSON.parse(
12571
- readFileSync12(join14(clioStateDir(), "receipts", `${replayedResult.terminalRunId}.json`), "utf8")
12841
+ readFileSync12(join13(clioStateDir(), "receipts", `${replayedResult.terminalRunId}.json`), "utf8")
12572
12842
  );
12573
12843
  receiptsByStep.set(stepId, receipt);
12574
12844
  } catch {
@@ -12755,7 +13025,7 @@ async function executeFleetRun(input) {
12755
13025
  if (step.gate !== void 0 && succeeded) {
12756
13026
  let gateBytes = "";
12757
13027
  try {
12758
- gateBytes = readFileSync12(join14(workspaceRoot, step.gate.path), "utf8");
13028
+ gateBytes = readFileSync12(join13(workspaceRoot, step.gate.path), "utf8");
12759
13029
  } catch {
12760
13030
  gateBytes = "";
12761
13031
  }
@@ -12999,7 +13269,6 @@ async function executeFleetRun(input) {
12999
13269
  planHash: input.plan.hash,
13000
13270
  result,
13001
13271
  receipts,
13002
- totalCostUsd: receipts.reduce((sum, receipt) => sum + receipt.costUsd, 0),
13003
13272
  totalCost: aggregateCostAmounts(
13004
13273
  receipts.map((receipt) => ({ usd: receipt.costUsd, provenance: receipt.costProvenance }))
13005
13274
  ),
@@ -13325,7 +13594,7 @@ function latestGateDecisionForRun(decisions, runId) {
13325
13594
  // src/domains/evidence/store.ts
13326
13595
  init_esm_shims();
13327
13596
  import { readdir, readFile } from "node:fs/promises";
13328
- import { join as join15 } from "node:path";
13597
+ import { join as join14 } from "node:path";
13329
13598
  var EVIDENCE_FILES = [
13330
13599
  "overview.json",
13331
13600
  "transcript.md",
@@ -13341,11 +13610,11 @@ var EVIDENCE_FILES = [
13341
13610
  "findings.md"
13342
13611
  ];
13343
13612
  function evidenceRoot(dataDir) {
13344
- return join15(dataDir, "evidence");
13613
+ return join14(dataDir, "evidence");
13345
13614
  }
13346
13615
  function evidenceDirectory(dataDir, evidenceId) {
13347
13616
  assertSafeId(evidenceId, "evidence");
13348
- return join15(evidenceRoot(dataDir), evidenceId);
13617
+ return join14(evidenceRoot(dataDir), evidenceId);
13349
13618
  }
13350
13619
  var EvidenceNotFoundError = class extends Error {
13351
13620
  constructor(evidenceId) {
@@ -13361,7 +13630,7 @@ function isMissingFile(error) {
13361
13630
  async function loadEvidenceOverview(dataDir, evidenceId) {
13362
13631
  let raw;
13363
13632
  try {
13364
- raw = await readFile(join15(evidenceDirectory(dataDir, evidenceId), "overview.json"), "utf8");
13633
+ raw = await readFile(join14(evidenceDirectory(dataDir, evidenceId), "overview.json"), "utf8");
13365
13634
  } catch (error) {
13366
13635
  if (isMissingFile(error)) throw new EvidenceNotFoundError(evidenceId);
13367
13636
  throw error;
@@ -13373,7 +13642,7 @@ async function inspectEvidence(dataDir, evidenceId) {
13373
13642
  const overview = await loadEvidenceOverview(dataDir, evidenceId);
13374
13643
  let findingsRaw;
13375
13644
  try {
13376
- findingsRaw = await readFile(join15(evidenceDirectory(dataDir, evidenceId), "findings.json"), "utf8");
13645
+ findingsRaw = await readFile(join14(evidenceDirectory(dataDir, evidenceId), "findings.json"), "utf8");
13377
13646
  } catch (error) {
13378
13647
  if (isMissingFile(error)) throw new Error(`evidence artifact ${evidenceId} is missing findings.json`);
13379
13648
  throw error;
@@ -13385,7 +13654,7 @@ async function inspectEvidence(dataDir, evidenceId) {
13385
13654
  async function loadEvidenceTrustStatus(dataDir, evidenceId) {
13386
13655
  let raw;
13387
13656
  try {
13388
- raw = await readFile(join15(evidenceDirectory(dataDir, evidenceId), "trust-status.json"), "utf8");
13657
+ raw = await readFile(join14(evidenceDirectory(dataDir, evidenceId), "trust-status.json"), "utf8");
13389
13658
  } catch (error) {
13390
13659
  if (isMissingFile(error)) {
13391
13660
  return { version: 1, evidenceId, projection: "historical_format", runs: [] };
@@ -13418,7 +13687,7 @@ async function loadEvidenceTrustStatus(dataDir, evidenceId) {
13418
13687
  async function loadEvidenceRunProvenance(dataDir, evidenceId) {
13419
13688
  let raw;
13420
13689
  try {
13421
- raw = await readFile(join15(evidenceDirectory(dataDir, evidenceId), "receipt.json"), "utf8");
13690
+ raw = await readFile(join14(evidenceDirectory(dataDir, evidenceId), "receipt.json"), "utf8");
13422
13691
  } catch (error) {
13423
13692
  const err = error;
13424
13693
  if (err.code === "ENOENT") return [];
@@ -13592,6 +13861,7 @@ var MAX_TASK_CHARS = 500;
13592
13861
  var TRANSCRIPT_TEXT_MAX_CHARS = 500;
13593
13862
  var TOOL_PREVIEW_MAX_CHARS = 240;
13594
13863
  var TASK_LEDGER_ROW_LIMIT = 200;
13864
+ var MODEL_PRIVATE_MARKER = "[not sent to model]";
13595
13865
  async function buildEvidence(options) {
13596
13866
  if (options.runId !== void 0 && options.sessionId !== void 0) {
13597
13867
  throw new Error("build evidence accepts either runId or sessionId, not both");
@@ -13992,22 +14262,22 @@ function finding(index, severity, tag, runId, message) {
13992
14262
  }
13993
14263
  async function writeEvidenceFiles(directory, overview, runSources, findings, sessionLinks, auditLinks, toolEventRows, gateDecisions, trustStatus, protectedArtifacts, transcript) {
13994
14264
  await mkdir(directory, { recursive: true });
13995
- await writeJson(join16(directory, "overview.json"), overview);
14265
+ await writeJson(join15(directory, "overview.json"), overview);
13996
14266
  await writeFile(
13997
- join16(directory, "transcript.md"),
14267
+ join15(directory, "transcript.md"),
13998
14268
  transcript ?? renderTranscript(overview, runSources, sessionLinks, trustStatus),
13999
14269
  "utf8"
14000
14270
  );
14001
- await writeJsonl(join16(directory, "trace.raw.jsonl"), rawTraceRows(runSources));
14002
- await writeJsonl(join16(directory, "trace.cleaned.jsonl"), cleanedTraceRows(runSources, findings, toolEventRows));
14003
- await writeJsonl(join16(directory, "tool-events.jsonl"), toolEventRows);
14004
- await writeJsonl(join16(directory, "audit-linked.jsonl"), auditLinks.rows);
14005
- await writeJson(join16(directory, "receipt.json"), receiptsFile(runSources));
14006
- await writeJson(join16(directory, "gate-decisions.json"), gateDecisions);
14007
- await writeJson(join16(directory, "trust-status.json"), trustStatus);
14008
- await writeJson(join16(directory, "protected-artifacts.json"), protectedArtifacts);
14009
- await writeJson(join16(directory, "findings.json"), findingsFile(overview.evidenceId, [...findings]));
14010
- await writeFile(join16(directory, "findings.md"), renderEvidenceFindingsMarkdown(findings, trustStatus), "utf8");
14271
+ await writeJsonl(join15(directory, "trace.raw.jsonl"), rawTraceRows(runSources));
14272
+ await writeJsonl(join15(directory, "trace.cleaned.jsonl"), cleanedTraceRows(runSources, findings, toolEventRows));
14273
+ await writeJsonl(join15(directory, "tool-events.jsonl"), toolEventRows);
14274
+ await writeJsonl(join15(directory, "audit-linked.jsonl"), auditLinks.rows);
14275
+ await writeJson(join15(directory, "receipt.json"), receiptsFile(runSources));
14276
+ await writeJson(join15(directory, "gate-decisions.json"), gateDecisions);
14277
+ await writeJson(join15(directory, "trust-status.json"), trustStatus);
14278
+ await writeJson(join15(directory, "protected-artifacts.json"), protectedArtifacts);
14279
+ await writeJson(join15(directory, "findings.json"), findingsFile(overview.evidenceId, [...findings]));
14280
+ await writeFile(join15(directory, "findings.md"), renderEvidenceFindingsMarkdown(findings, trustStatus), "utf8");
14011
14281
  }
14012
14282
  function rawTraceRows(runSources) {
14013
14283
  const rows = [];
@@ -14190,6 +14460,7 @@ function sessionToolEvents(entries) {
14190
14460
  for (const linked of entries) {
14191
14461
  const entry = linked.entry;
14192
14462
  if (entry.kind === "bashExecution") {
14463
+ const contextMarker = entry.excludeFromContext === true ? `${MODEL_PRIVATE_MARKER} ` : "";
14193
14464
  events.push({
14194
14465
  source: "session-entry",
14195
14466
  runId: linked.link.runId,
@@ -14204,8 +14475,8 @@ function sessionToolEvents(entries) {
14204
14475
  timestamp: entry.timestamp,
14205
14476
  linkKind: "session-bash-execution",
14206
14477
  confidence: "exact",
14207
- argsPreview: truncateText(entry.command, TOOL_PREVIEW_MAX_CHARS),
14208
- resultPreview: truncateText(entry.output, TOOL_PREVIEW_MAX_CHARS)
14478
+ argsPreview: truncateText(`${contextMarker}${entry.command}`, TOOL_PREVIEW_MAX_CHARS),
14479
+ resultPreview: truncateText(`${contextMarker}${entry.output}`, TOOL_PREVIEW_MAX_CHARS)
14209
14480
  });
14210
14481
  continue;
14211
14482
  }
@@ -14559,9 +14830,10 @@ function renderSessionTranscriptEntry(linked) {
14559
14830
  }
14560
14831
  if (entry.kind === "bashExecution") {
14561
14832
  const status = entry.cancelled ? "cancelled" : entry.exitCode === null ? "exit=?" : `exit=${entry.exitCode}`;
14833
+ const contextMarker = entry.excludeFromContext === true ? ` ${MODEL_PRIVATE_MARKER}` : "";
14562
14834
  return [
14563
- `${prefix} bash ${status}: $ ${truncateText(entry.command, TRANSCRIPT_TEXT_MAX_CHARS)}`,
14564
- ` output: ${previewUnknown(entry.output)}`
14835
+ `${prefix} bash ${status}${contextMarker}: $ ${truncateText(entry.command, TRANSCRIPT_TEXT_MAX_CHARS)}`,
14836
+ ` output${contextMarker}: ${previewUnknown(entry.output)}`
14565
14837
  ];
14566
14838
  }
14567
14839
  if (entry.kind === "branchSummary")
@@ -14685,7 +14957,7 @@ function axisFindings(offset, source, status) {
14685
14957
  return out;
14686
14958
  }
14687
14959
  async function readRunLedger(stateDir) {
14688
- const target = join16(stateDir, "runs.json");
14960
+ const target = join15(stateDir, "runs.json");
14689
14961
  let raw;
14690
14962
  try {
14691
14963
  raw = await readFile2(target, "utf8");
@@ -14706,7 +14978,7 @@ function selectRunEnvelopes(ledger, source) {
14706
14978
  });
14707
14979
  }
14708
14980
  async function readReceipt(stateDir, envelope) {
14709
- const receiptPath = envelope.receiptPath ?? join16(stateDir, "receipts", `${envelope.id}.json`);
14981
+ const receiptPath = envelope.receiptPath ?? join15(stateDir, "receipts", `${envelope.id}.json`);
14710
14982
  let raw;
14711
14983
  try {
14712
14984
  raw = await readFile2(receiptPath, "utf8");
@@ -14791,7 +15063,7 @@ function parseRunReceipt(value, source) {
14791
15063
  costUsd: readNumber2(value, source, "costUsd"),
14792
15064
  compiledPromptHash: readNullableString2(value, source, "compiledPromptHash"),
14793
15065
  staticCompositionHash: readNullableString2(value, source, "staticCompositionHash"),
14794
- clioVersion: readString2(value, source, "clioVersion"),
15066
+ clioCoderVersion: readReceiptVersion(value, source),
14795
15067
  piMonoVersion: readString2(value, source, "piMonoVersion"),
14796
15068
  platform: readString2(value, source, "platform"),
14797
15069
  nodeVersion: readString2(value, source, "nodeVersion"),
@@ -14805,6 +15077,10 @@ function parseRunReceipt(value, source) {
14805
15077
  }
14806
15078
  };
14807
15079
  }
15080
+ function readReceiptVersion(value, source) {
15081
+ if (typeof value.clioCoderVersion === "string") return value.clioCoderVersion;
15082
+ return readString2(value, source, "clioVersion");
15083
+ }
14808
15084
  function readToolStats(record, source, field) {
14809
15085
  const value = record[field];
14810
15086
  if (!Array.isArray(value)) throw new Error(`${source}.${field}: expected array`);
@@ -14995,7 +15271,7 @@ function sanitizeEvidenceId(value) {
14995
15271
  // src/domains/evidence/eval.ts
14996
15272
  init_esm_shims();
14997
15273
  import { mkdir as mkdir2, readdir as readdir2, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
14998
- import { join as join17 } from "node:path";
15274
+ import { join as join16 } from "node:path";
14999
15275
 
15000
15276
  // src/domains/eval/index.ts
15001
15277
  init_esm_shims();
@@ -15196,19 +15472,19 @@ async function writeEvalEvidenceFiles(directory, artifact, overview, findings, t
15196
15472
  };
15197
15473
  const redactedArtifact = redactArtifactForStorage(artifact);
15198
15474
  await mkdir2(directory, { recursive: true });
15199
- await writeJson2(join17(directory, "overview.json"), overview);
15200
- await writeFile2(join17(directory, "transcript.md"), renderEvalTranscript(redactedArtifact, overview), "utf8");
15201
- await writeJsonl2(join17(directory, "trace.raw.jsonl"), rawEvalTraceRows(redactedArtifact));
15202
- await writeJsonl2(join17(directory, "trace.cleaned.jsonl"), cleanedEvalTraceRows(redactedArtifact, findings));
15203
- await writeJsonl2(join17(directory, "tool-events.jsonl"), redactArtifactForStorage(toolEventRows));
15204
- await writeJsonl2(join17(directory, "audit-linked.jsonl"), linkedRuns.auditRows);
15205
- await writeJson2(join17(directory, "receipt.json"), receiptsFile2);
15206
- await writeJson2(join17(directory, "gate-decisions.json"), gateDecisions);
15207
- await writeJson2(join17(directory, "trust-status.json"), trustStatus);
15208
- await writeJson2(join17(directory, "protected-artifacts.json"), emptyProtected);
15209
- await writeJson2(join17(directory, "eval-result.json"), redactedArtifact);
15210
- await writeJson2(join17(directory, "findings.json"), findingsFile(overview.evidenceId, [...findings]));
15211
- await writeFile2(join17(directory, "findings.md"), renderEvidenceFindingsMarkdown(findings, trustStatus), "utf8");
15475
+ await writeJson2(join16(directory, "overview.json"), overview);
15476
+ await writeFile2(join16(directory, "transcript.md"), renderEvalTranscript(redactedArtifact, overview), "utf8");
15477
+ await writeJsonl2(join16(directory, "trace.raw.jsonl"), rawEvalTraceRows(redactedArtifact));
15478
+ await writeJsonl2(join16(directory, "trace.cleaned.jsonl"), cleanedEvalTraceRows(redactedArtifact, findings));
15479
+ await writeJsonl2(join16(directory, "tool-events.jsonl"), redactArtifactForStorage(toolEventRows));
15480
+ await writeJsonl2(join16(directory, "audit-linked.jsonl"), linkedRuns.auditRows);
15481
+ await writeJson2(join16(directory, "receipt.json"), receiptsFile2);
15482
+ await writeJson2(join16(directory, "gate-decisions.json"), gateDecisions);
15483
+ await writeJson2(join16(directory, "trust-status.json"), trustStatus);
15484
+ await writeJson2(join16(directory, "protected-artifacts.json"), emptyProtected);
15485
+ await writeJson2(join16(directory, "eval-result.json"), redactedArtifact);
15486
+ await writeJson2(join16(directory, "findings.json"), findingsFile(overview.evidenceId, [...findings]));
15487
+ await writeFile2(join16(directory, "findings.md"), renderEvidenceFindingsMarkdown(findings, trustStatus), "utf8");
15212
15488
  }
15213
15489
  function rawEvalTraceRows(artifact) {
15214
15490
  return artifact.results.map((result) => ({
@@ -15349,7 +15625,7 @@ async function linkEvalRuns(stateDir, artifact) {
15349
15625
  }
15350
15626
  async function readRunLedger2(stateDir) {
15351
15627
  try {
15352
- const raw = await readFile3(join17(stateDir, "runs.json"), "utf8");
15628
+ const raw = await readFile3(join16(stateDir, "runs.json"), "utf8");
15353
15629
  const parsed = JSON.parse(raw);
15354
15630
  return Array.isArray(parsed) ? parsed.filter(isRecord12) : [];
15355
15631
  } catch {
@@ -15360,7 +15636,7 @@ function evalRunMatches(artifact, envelope) {
15360
15636
  return artifact.results.some((result) => result.runId === envelope.id);
15361
15637
  }
15362
15638
  async function readReceiptForRun(stateDir, envelope) {
15363
- const path2 = envelope.receiptPath ?? join17(stateDir, "receipts", `${envelope.id}.json`);
15639
+ const path2 = envelope.receiptPath ?? join16(stateDir, "receipts", `${envelope.id}.json`);
15364
15640
  try {
15365
15641
  const parsed = JSON.parse(await readFile3(path2, "utf8"));
15366
15642
  return isRecord12(parsed) ? parsed : null;
@@ -15389,7 +15665,7 @@ async function countSessionEntries(stateDir, sessionIds) {
15389
15665
  return count;
15390
15666
  }
15391
15667
  async function findSessionLedgerPath(stateDir, sessionId) {
15392
- const root = join17(stateDir, "sessions");
15668
+ const root = join16(stateDir, "sessions");
15393
15669
  let cwdHashes;
15394
15670
  try {
15395
15671
  cwdHashes = await readdir2(root);
@@ -15397,7 +15673,7 @@ async function findSessionLedgerPath(stateDir, sessionId) {
15397
15673
  return null;
15398
15674
  }
15399
15675
  for (const cwdHash of cwdHashes) {
15400
- const path2 = join17(root, cwdHash, sessionId, "current.jsonl");
15676
+ const path2 = join16(root, cwdHash, sessionId, "current.jsonl");
15401
15677
  try {
15402
15678
  await readFile3(path2, "utf8");
15403
15679
  return path2;
@@ -15407,7 +15683,7 @@ async function findSessionLedgerPath(stateDir, sessionId) {
15407
15683
  return null;
15408
15684
  }
15409
15685
  async function linkedEvalAuditRows(stateDir, runIds, artifact) {
15410
- const root = join17(stateDir, "audit");
15686
+ const root = join16(stateDir, "audit");
15411
15687
  let files;
15412
15688
  try {
15413
15689
  files = await readdir2(root);
@@ -15416,7 +15692,7 @@ async function linkedEvalAuditRows(stateDir, runIds, artifact) {
15416
15692
  }
15417
15693
  const rows = [];
15418
15694
  for (const file of files.filter((name) => name.endsWith(".jsonl")).sort(compareCodepoints)) {
15419
- const raw = await readFile3(join17(root, file), "utf8").catch(() => "");
15695
+ const raw = await readFile3(join16(root, file), "utf8").catch(() => "");
15420
15696
  const lines = raw.split("\n");
15421
15697
  for (let index = 0; index < lines.length; index += 1) {
15422
15698
  const line = lines[index];
@@ -15704,4 +15980,4 @@ export {
15704
15980
  summarizeEvalResults,
15705
15981
  buildEvalEvidence
15706
15982
  };
15707
- //# sourceMappingURL=chunk-BUMFYQFY.js.map
15983
+ //# sourceMappingURL=chunk-I66ZTYNP.js.map