@iowarp/clio-coder 0.4.1 → 0.4.3

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 (604) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/CONTRIBUTING.md +142 -52
  3. package/README.md +434 -473
  4. package/SECURITY.md +2 -1
  5. package/dist/{acp-ZILU3AUO.js → acp-H2NGRPWO.js} +12 -12
  6. package/dist/{agents-HYWGBGQR.js → agents-TL5LLUQP.js} +56 -55
  7. package/dist/assets/codewiki.json +1 -1
  8. package/dist/{auth-N3QT7CBO.js → auth-E5SW4HMS.js} +23 -21
  9. package/dist/builtins-IA7V7FUC.js +22 -0
  10. package/dist/{chunk-7RY5VZPH.js → chunk-2APPQIER.js} +8 -8
  11. package/dist/{chunk-72GZI5EV.js → chunk-2JH2WHGE.js} +2 -2
  12. package/dist/{chunk-JA5QWE4Z.js → chunk-2UG5F4C5.js} +1973 -1664
  13. package/dist/{chunk-5YHDIDBP.js → chunk-2UH2KFUP.js} +2 -2
  14. package/dist/{chunk-CTJ4RNAA.js → chunk-2VIKGWFZ.js} +2 -2
  15. package/dist/{chunk-I66EAJFY.js → chunk-2WZ546HR.js} +267 -232
  16. package/dist/{chunk-GIZNH63R.js → chunk-35MSIRKH.js} +9 -4
  17. package/dist/chunk-3EBYEESD.js +314 -0
  18. package/dist/{chunk-J5LZHVIT.js → chunk-3M6DQK6S.js} +113 -35
  19. package/dist/{chunk-RKSR6VSF.js → chunk-4IUZQIJ3.js} +29 -1
  20. package/dist/{chunk-6FN3E6KX.js → chunk-4O6MANBS.js} +2 -2
  21. package/dist/chunk-4UVU7BJ5.js +39 -0
  22. package/dist/{chunk-VKRH2TCS.js → chunk-4WR7VSYB.js} +2 -2
  23. package/dist/{chunk-BBTJOK6Y.js → chunk-54CBCGIR.js} +5 -5
  24. package/dist/{chunk-AP73CFDC.js → chunk-5ICU3EUH.js} +2 -2
  25. package/dist/chunk-5MEZN6CB.js +1334 -0
  26. package/dist/{chunk-O42A54GG.js → chunk-5OIVVPHF.js} +2 -2
  27. package/dist/{chunk-ABLSQ6JX.js → chunk-64I3JVYM.js} +8 -2
  28. package/dist/{chunk-AFKWHWXF.js → chunk-6PTFB5VS.js} +39 -22
  29. package/dist/{chunk-VN3SHNBN.js → chunk-7DICMOS6.js} +2 -2
  30. package/dist/chunk-7DRAWPTZ.js +360 -0
  31. package/dist/chunk-7E7I3WLS.js +3762 -0
  32. package/dist/{chunk-BJGUKIG4.js → chunk-7ZYNNDKC.js} +7 -7
  33. package/dist/{chunk-XKA2ICR3.js → chunk-AF4YM7Z4.js} +652 -252
  34. package/dist/{chunk-GVQJ5CCZ.js → chunk-AX2THNSA.js} +12 -12
  35. package/dist/{chunk-IG7BCQBA.js → chunk-B4OAX3SI.js} +65 -3
  36. package/dist/{chunk-TD3PGPQA.js → chunk-B4VEBZKF.js} +3 -3
  37. package/dist/{chunk-74YWRRU5.js → chunk-BEPZRGGU.js} +10 -10
  38. package/dist/{chunk-FEFIFZTL.js → chunk-CE5AX47J.js} +2 -2
  39. package/dist/{chunk-UAPGZHYC.js → chunk-DWUOQKRU.js} +25 -11
  40. package/dist/{chunk-THYWACCR.js → chunk-E3TPLWFX.js} +3 -3
  41. package/dist/{chunk-7EPLI7VL.js → chunk-EKCHAPYA.js} +2 -2
  42. package/dist/{chunk-HLW2MRKE.js → chunk-F4EKGO4N.js} +3 -1
  43. package/dist/{chunk-PJJ6MY27.js → chunk-F5JHEYZM.js} +7 -7
  44. package/dist/{chunk-6CCS4G3W.js → chunk-FTMGRKEF.js} +3 -3
  45. package/dist/{chunk-SINK3QR6.js → chunk-G76U63X4.js} +17 -17
  46. package/dist/{chunk-EIMVLWB3.js → chunk-GHS5EBTQ.js} +64 -9
  47. package/dist/{chunk-QMXC4JB7.js → chunk-GI7YYQ3F.js} +187 -1419
  48. package/dist/{chunk-TZSKNMZG.js → chunk-GTUD2WMY.js} +2 -1
  49. package/dist/{chunk-6HMJX2VU.js → chunk-GWZNEVM2.js} +44 -12
  50. package/dist/chunk-GYV6VZOC.js +26 -0
  51. package/dist/{chunk-MQXIVJ35.js → chunk-HAXOFFRH.js} +5 -5
  52. package/dist/{chunk-UXN6JT4W.js → chunk-HEQY7ZFI.js} +3 -3
  53. package/dist/{chunk-7PWAODYW.js → chunk-I7XBWTYH.js} +2 -2
  54. package/dist/{chunk-GCSMB2KY.js → chunk-I7ZPNEJM.js} +145 -102
  55. package/dist/{chunk-WNP7O5WZ.js → chunk-ID64D7PE.js} +4 -4
  56. package/dist/{chunk-QTFGO774.js → chunk-IGLP3ODT.js} +29 -16
  57. package/dist/chunk-IJNZMHLA.js +101 -0
  58. package/dist/{chunk-BDPT6GTK.js → chunk-INY6HTFL.js} +7 -7
  59. package/dist/{chunk-PBP4B7XR.js → chunk-IUE3Y34X.js} +2 -2
  60. package/dist/{chunk-6NJQITNH.js → chunk-IWT4SF4R.js} +6 -3
  61. package/dist/{chunk-R23Z6K6I.js → chunk-JDAY6FIL.js} +19 -19
  62. package/dist/chunk-JEQ3XTHC.js +42 -0
  63. package/dist/{chunk-FSP7CMNU.js → chunk-JGRC33J2.js} +50 -4
  64. package/dist/{chunk-TVH4ONAM.js → chunk-JKKCYP3C.js} +10 -10
  65. package/dist/{chunk-HJWWJ6IL.js → chunk-JSC3U7TI.js} +16 -4
  66. package/dist/{chunk-C537JADH.js → chunk-KK4JZPBQ.js} +19 -141
  67. package/dist/{chunk-K6BF4U2H.js → chunk-KKOJXO6R.js} +62 -14
  68. package/dist/{chunk-IHXBNWMM.js → chunk-KXDSS5WJ.js} +7 -3
  69. package/dist/{chunk-6DWBAZ5U.js → chunk-L47TF46W.js} +5 -7
  70. package/dist/{chunk-HUAS7ITX.js → chunk-LDJG7DW3.js} +91 -42
  71. package/dist/{chunk-CDNVLKUX.js → chunk-LLDJM5XK.js} +13 -7
  72. package/dist/{chunk-YPI3QQCF.js → chunk-MCEPRMZW.js} +2 -4
  73. package/dist/{chunk-Y4CAGMM6.js → chunk-MNJGS2IN.js} +5 -6
  74. package/dist/{chunk-VKFQTNDV.js → chunk-MUW2BDDH.js} +4 -4
  75. package/dist/{chunk-E67WX76H.js → chunk-MWUZBSAQ.js} +104 -152
  76. package/dist/{chunk-OJTRZGR3.js → chunk-N2Z7HLVY.js} +21 -21
  77. package/dist/{chunk-TVHHYFHE.js → chunk-NEDJ26B5.js} +2 -2
  78. package/dist/{chunk-FYUN5KZ3.js → chunk-NIQJ66N4.js} +21 -21
  79. package/dist/{chunk-U2WB7TZS.js → chunk-NMJXSHBJ.js} +97 -85
  80. package/dist/{chunk-CWVRRIEI.js → chunk-NZMNUPZZ.js} +2 -2
  81. package/dist/{chunk-VEGN6WIQ.js → chunk-O5CVSAG5.js} +3 -3
  82. package/dist/{chunk-MOPSG2X7.js → chunk-OML5D5V5.js} +8 -8
  83. package/dist/{chunk-2VG7KLYV.js → chunk-PAJQJ7BS.js} +5816 -3255
  84. package/dist/{chunk-ZW55JB7N.js → chunk-PUVDKJ2Y.js} +2 -2
  85. package/dist/{chunk-BTGG6BG2.js → chunk-QWGDJJYJ.js} +158 -19
  86. package/dist/chunk-R6Q67RJH.js +134 -0
  87. package/dist/{chunk-ZJLUDYFY.js → chunk-RRNP2ANY.js} +6 -6
  88. package/dist/{chunk-PVAMAVBB.js → chunk-RSJ25QSL.js} +102 -2
  89. package/dist/{chunk-NLFAQR7Z.js → chunk-S66XZJOF.js} +3 -23
  90. package/dist/chunk-SKHCAU7K.js +385 -0
  91. package/dist/chunk-SZAA6XDG.js +30 -0
  92. package/dist/{chunk-J4HBWF6Y.js → chunk-TM6LQDI3.js} +131 -28
  93. package/dist/chunk-UOIZ7DA4.js +41 -0
  94. package/dist/{chunk-MA3H6DM5.js → chunk-UPZU6GE4.js} +25 -3
  95. package/dist/{chunk-BWW4HLO4.js → chunk-UXCU4E3T.js} +8 -6
  96. package/dist/{chunk-N5UK64DP.js → chunk-V2ANDPVT.js} +4 -4
  97. package/dist/{chunk-AK5XEFVZ.js → chunk-VA5FNYMT.js} +26 -13
  98. package/dist/{chunk-6VC4OV3Z.js → chunk-VIA6RFQZ.js} +3 -11
  99. package/dist/{chunk-ZAZB4JMW.js → chunk-VKPAQYEB.js} +27 -8
  100. package/dist/{chunk-QKIFBZKT.js → chunk-VW6DOEDG.js} +497 -81
  101. package/dist/{chunk-SCYB3HA4.js → chunk-W6RRQCPQ.js} +63 -19
  102. package/dist/{chunk-2NM363SV.js → chunk-WBKFA554.js} +10 -10
  103. package/dist/{chunk-R32CLGZ6.js → chunk-WCXUNS7U.js} +82 -21
  104. package/dist/{chunk-GPPB3JBE.js → chunk-WRBAGUNF.js} +3 -3
  105. package/dist/{chunk-IXJT6DCX.js → chunk-XIVNBFZS.js} +85 -30
  106. package/dist/{chunk-UEDMSP56.js → chunk-XPWWI35G.js} +417 -201
  107. package/dist/chunk-XRZT5WY5.js +47 -0
  108. package/dist/{chunk-3QSOM6PA.js → chunk-Y3CBHOR6.js} +2 -2
  109. package/dist/{chunk-VXMFAE2W.js → chunk-YPC6ZR5L.js} +19 -6
  110. package/dist/{chunk-AKB4GYDL.js → chunk-YQWYVTMC.js} +5 -5
  111. package/dist/{chunk-6I5ILFOF.js → chunk-ZA4VCIGV.js} +3 -3
  112. package/dist/{chunk-7OBGU7UB.js → chunk-ZDN3Y73Y.js} +12 -18
  113. package/dist/{chunk-3I5NY75V.js → chunk-ZWPRK62N.js} +8 -5
  114. package/dist/cli/index.js +41 -39
  115. package/dist/{clio-IT3G3VQH.js → clio-CMMK4KRR.js} +9 -9
  116. package/dist/{code-nav-RK6S7F6E.js → code-nav-MDZNQS33.js} +89 -21
  117. package/dist/{components-UBWCQSRW.js → components-UCUQ4QXW.js} +4 -4
  118. package/dist/{config-3QZRWZJF.js → config-SVM5P5YI.js} +131 -84
  119. package/dist/{configure-FL7Y3KJF.js → configure-LE3IK2TJ.js} +28 -26
  120. package/dist/{context-5HE7ODYK.js → context-2OHRKS42.js} +69 -64
  121. package/dist/{context-KYQFRVDC.js → context-E3VC7RX5.js} +15 -11
  122. package/dist/{context-XNHL75JV.js → context-VNCR7KAG.js} +93 -65
  123. package/dist/{context-clear-N545L53A.js → context-clear-BW4O37TG.js} +64 -60
  124. package/dist/context-map-COB37XXN.js +505 -0
  125. package/dist/{context-working-set-QHKXSV2F.js → context-working-set-VDS25HXZ.js} +19 -18
  126. package/dist/{dispatch-runner-RGIE5PCT.js → dispatch-runner-5AHT53RF.js} +93 -82
  127. package/dist/{docs-5NAF6AU7.js → docs-PD3EXDKU.js} +21 -20
  128. package/dist/{doctor-ZGPEGHIP.js → doctor-WNNVO6FY.js} +48 -47
  129. package/dist/{eval-GXLL44RD.js → eval-7G7SGAYO.js} +287 -115
  130. package/dist/{eval-inventory-HBWSWQOK.js → eval-inventory-Y6QRFOH5.js} +4 -4
  131. package/dist/{evidence-HWLBRH3Q.js → evidence-VD6736FQ.js} +67 -64
  132. package/dist/{evolve-FTZBMNVW.js → evolve-AL3NGVRL.js} +65 -62
  133. package/dist/{extensions-VHRBEID7.js → extensions-MOVJ32NM.js} +9 -7
  134. package/dist/{fleet-CKZHJWZJ.js → fleet-QZHUMAGI.js} +114 -111
  135. package/dist/{fleet-commands-EXDXBMV6.js → fleet-commands-BAYT5FJZ.js} +10 -10
  136. package/dist/{fleet-decisions-OTHB6KRL.js → fleet-decisions-IREVMRU4.js} +7 -6
  137. package/dist/{fleet-graph-YTEZUCUT.js → fleet-graph-YCTT3HTI.js} +22 -19
  138. package/dist/{fleet-inspect-SS6YMDCK.js → fleet-inspect-QVJTDAVB.js} +58 -55
  139. package/dist/{fleet-preflight-PBY4VYOM.js → fleet-preflight-25QAFPK4.js} +4 -4
  140. package/dist/{fleet-validate-KMEM5L3S.js → fleet-validate-5O57AAJ7.js} +26 -23
  141. package/dist/{fleet-verify-QD5M7E7Q.js → fleet-verify-CPH2W2T6.js} +59 -56
  142. package/dist/{fleet-view-WAMJYNDT.js → fleet-view-SWBR3VGQ.js} +58 -55
  143. package/dist/{init-5XQRBOFV.js → init-J477LKZH.js} +82 -79
  144. package/dist/{interop-34TVO25M.js → interop-3FCM6XLG.js} +11 -11
  145. package/dist/{library-3QY6KF57.js → library-QUQEIUG6.js} +30 -27
  146. package/dist/{memory-L4UTIIIW.js → memory-SGGSEP65.js} +67 -64
  147. package/dist/{models-ZVX3QOWE.js → models-HEKUAXXK.js} +53 -46
  148. package/dist/{monitor-CEKVSYTS.js → monitor-HKU57TYQ.js} +63 -60
  149. package/dist/{orchestrator-77BAP6BC.js → orchestrator-VDFAEFAI.js} +1831 -1057
  150. package/dist/{panes-7STHOAUJ.js → panes-DN2SSFOH.js} +5 -5
  151. package/dist/{panes-SHAUIRXY.js → panes-TALGNPZT.js} +29 -14
  152. package/dist/{paths-L7LGY6RN.js → paths-NBMFAIEZ.js} +5 -5
  153. package/dist/reset-EAJFFJVB.js +344 -0
  154. package/dist/{resources-74GKTLSF.js → resources-OVKSEFVE.js} +29 -20
  155. package/dist/{run-HBAUJNNZ.js → run-7DP7ZF2J.js} +120 -115
  156. package/dist/{share-G3APVLVP.js → share-WML67FT3.js} +32 -27
  157. package/dist/{skills-35HHUKCR.js → skills-SG662R2K.js} +41 -31
  158. package/dist/{skills-eval-QN4HSHDC.js → skills-eval-VVZEUU46.js} +78 -77
  159. package/dist/{skills-inventory-J357J34F.js → skills-inventory-I2E23GET.js} +23 -20
  160. package/dist/{slash-commands-JZZCQA32.js → slash-commands-S7MBJDQK.js} +40 -36
  161. package/dist/{steer-XAVHJM22.js → steer-2LQOMCPB.js} +3 -3
  162. package/dist/{support-U7QOWY26.js → support-CC2UJBJ6.js} +6 -6
  163. package/dist/{targets-DSM6CY3M.js → targets-4QC3HIEW.js} +54 -54
  164. package/dist/{terminal-lease-JOPFUVEM.js → terminal-lease-TUHIJ6Y2.js} +5 -5
  165. package/dist/{tools-MKNWVPBH.js → tools-TFGJICCU.js} +10 -10
  166. package/dist/{trace-ECQ7TIYZ.js → trace-FXMXUZUF.js} +55 -7
  167. package/dist/uninstall-5PEVOE5B.js +408 -0
  168. package/dist/upgrade-M4WXY6KN.js +303 -0
  169. package/dist/{usage-X52N3IDJ.js → usage-N7ZNVLEM.js} +151 -104
  170. package/dist/{verifiers-EJTVVSMA.js → verifiers-DJTP4XX6.js} +15 -15
  171. package/dist/{verify-YJL6XET2.js → verify-RWE4PPEK.js} +9 -9
  172. package/dist/{web-fetch-MPIFL3LL.js → web-fetch-MPARV2K7.js} +2 -2
  173. package/dist/{wiki-generate-4NDZTQ4B.js → wiki-generate-C7IQOXSP.js} +89 -86
  174. package/dist/{with-panes-OBOBFIIR.js → with-panes-4GCGSL7J.js} +53 -257
  175. package/dist/worker/entry.js +90 -74
  176. package/docs/README.md +176 -81
  177. package/docs/{acp.md → architecture/acp.md} +36 -20
  178. package/docs/{alcf-provider.md → architecture/alcf-provider.md} +8 -5
  179. package/docs/{architecture.md → architecture/architecture.md} +43 -22
  180. package/docs/{artifact-placement.md → architecture/artifact-placement.md} +27 -23
  181. package/docs/architecture/artifact-versions.md +90 -0
  182. package/docs/{capacity-and-scheduling.md → architecture/capacity-and-scheduling.md} +26 -13
  183. package/docs/{context-engine.md → architecture/context-engine.md} +29 -25
  184. package/docs/{context-working-set.md → architecture/context-working-set.md} +13 -10
  185. package/docs/{dispatch-architecture-rationale.md → architecture/dispatch-architecture-rationale.md} +12 -9
  186. package/docs/{dispatch-typed-intent.md → architecture/dispatch-typed-intent.md} +68 -46
  187. package/docs/{evidence-and-memory.md → architecture/evidence-and-memory.md} +23 -16
  188. package/docs/{middleware-and-components.md → architecture/middleware-and-components.md} +11 -5
  189. package/docs/{model-catalog.md → architecture/model-catalog.md} +61 -27
  190. package/docs/{observability.md → architecture/observability.md} +38 -14
  191. package/docs/{pi-boundary.md → architecture/pi-boundary.md} +24 -11
  192. package/docs/{prompt-envelope-and-tools.md → architecture/prompt-envelope-and-tools.md} +57 -20
  193. package/docs/{provider-adapter-cookbook.md → architecture/provider-adapter-cookbook.md} +99 -25
  194. package/docs/{safety-model.md → architecture/safety-model.md} +35 -20
  195. package/docs/{session-lifecycle.md → architecture/session-lifecycle.md} +8 -5
  196. package/docs/architecture/time-conventions.md +125 -0
  197. package/docs/{trace-store.md → architecture/trace-store.md} +13 -5
  198. package/docs/{tui-design.md → architecture/tui-design.md} +13 -13
  199. package/docs/{worker-dispatch-mechanics.md → architecture/worker-dispatch-mechanics.md} +27 -30
  200. package/docs/{built-in-agents.md → guide/built-in-agents.md} +65 -35
  201. package/docs/{commands-and-modes.md → guide/commands-and-modes.md} +66 -61
  202. package/docs/{configuration-and-targets.md → guide/configuration-and-targets.md} +323 -297
  203. package/docs/guide/configuration-reference.md +1163 -0
  204. package/docs/{environment-variables.md → guide/environment-variables.md} +33 -28
  205. package/docs/{exit-codes-and-output.md → guide/exit-codes-and-output.md} +6 -3
  206. package/docs/{extensions-and-sharing.md → guide/extensions-and-sharing.md} +41 -14
  207. package/docs/{fleet-dispatch.md → guide/fleet-dispatch.md} +39 -43
  208. package/docs/{glossary.md → guide/glossary.md} +14 -11
  209. package/docs/{installation-and-lifecycle.md → guide/installation-and-lifecycle.md} +81 -17
  210. package/docs/guide/panes-and-files.md +290 -0
  211. package/docs/{proactive-memory.md → guide/proactive-memory.md} +131 -107
  212. package/docs/{resource-library.md → guide/resource-library.md} +13 -4
  213. package/docs/{skills-marketplace.md → guide/skills-marketplace.md} +25 -3
  214. package/docs/{tool-usage.md → guide/tool-usage.md} +87 -23
  215. package/docs/{troubleshooting.md → guide/troubleshooting.md} +9 -4
  216. package/docs/{config-knobs-audit.md → history/config-knobs-audit.md} +11 -11
  217. package/docs/{release-cut-checklist.md → history/release-cut-checklist.md} +29 -2
  218. package/docs/process/development-pipeline.md +152 -0
  219. package/docs/process/documentation-coverage.md +100 -0
  220. package/docs/process/documentation-guide.md +187 -0
  221. package/docs/{eval-runner.md → process/eval-runner.md} +108 -53
  222. package/docs/{evals-internal.md → process/evals-internal.md} +10 -10
  223. package/docs/{evolution.md → process/evolution.md} +2 -2
  224. package/docs/{fleet-demo-runbook.md → process/fleet-demo-runbook.md} +11 -7
  225. package/docs/{git-commit-provenance.md → process/git-commit-provenance.md} +11 -4
  226. package/docs/{performance-methodology.md → process/performance-methodology.md} +87 -69
  227. package/docs/{scientific-validation.md → process/scientific-validation.md} +4 -4
  228. package/evals/README.md +2 -2
  229. package/evals/behavioral-model.yaml +3 -2
  230. package/package.json +10 -8
  231. package/skills/README.md +52 -41
  232. package/skills/coding/ast-grep/SKILL.md +102 -31
  233. package/skills/coding/ast-grep/evals.md +26 -0
  234. package/skills/coding/coding-standards/SKILL.md +41 -6
  235. package/skills/coding/coding-standards/evals.md +23 -0
  236. package/skills/coding/prototype/SKILL.md +88 -29
  237. package/skills/coding/prototype/evals.md +19 -0
  238. package/skills/coding/tdd/SKILL.md +81 -54
  239. package/skills/coding/tdd/evals.md +20 -0
  240. package/skills/context/context-handoff/SKILL.md +44 -3
  241. package/skills/context/context-handoff/evals.md +44 -0
  242. package/skills/context/context-prime/SKILL.md +46 -16
  243. package/skills/context/context-prime/evals.md +45 -0
  244. package/skills/git/branch-closeout/SKILL.md +132 -0
  245. package/skills/git/branch-closeout/evals.md +133 -0
  246. package/skills/git/branch-closeout/references/closeout-checklist.md +81 -0
  247. package/skills/git/file-ticket/SKILL.md +78 -64
  248. package/skills/git/file-ticket/assets/issue-template.md +22 -0
  249. package/skills/git/file-ticket/evals.md +31 -26
  250. package/skills/git/file-ticket/references/issue-discovery.md +49 -0
  251. package/skills/git/fix-issue/SKILL.md +88 -65
  252. package/skills/git/fix-issue/evals.md +35 -31
  253. package/skills/git/fix-issue/references/diagnosis-and-rca.md +46 -0
  254. package/skills/git/resolve-merge-conflicts/SKILL.md +101 -52
  255. package/skills/git/resolve-merge-conflicts/evals.md +52 -25
  256. package/skills/git/resolve-merge-conflicts/references/conflict-matrix.md +126 -0
  257. package/skills/git/ship/SKILL.md +103 -67
  258. package/skills/git/ship/assets/pr-template.md +21 -0
  259. package/skills/git/ship/evals.md +44 -28
  260. package/skills/git/ship/references/remote-and-branch-policy.md +62 -0
  261. package/skills/git/worktree-create/SKILL.md +80 -50
  262. package/skills/git/worktree-create/evals.md +40 -33
  263. package/skills/git/worktree-create/references/worktree-setup.md +62 -66
  264. package/skills/git/worktree-merge/SKILL.md +112 -65
  265. package/skills/git/worktree-merge/evals.md +42 -34
  266. package/skills/git/worktree-merge/references/merge-strategies.md +52 -0
  267. package/skills/meta/clio-coder-dev/SKILL.md +9 -5
  268. package/skills/meta/clio-coder-dev/evals.md +3 -2
  269. package/skills/meta/clio-coder-test/SKILL.md +102 -95
  270. package/skills/meta/clio-coder-test/evals.md +9 -4
  271. package/skills/meta/clio-coder-test/references/harness.md +100 -124
  272. package/skills/meta/clio-coder-test/references/test-map.md +77 -50
  273. package/skills/meta/credentials/SKILL.md +2 -2
  274. package/skills/meta/find-skills/SKILL.md +2 -2
  275. package/skills/meta/herdr/SKILL.md +2 -2
  276. package/skills/meta/skill-craft/SKILL.md +22 -16
  277. package/skills/planning/archify/SKILL.md +196 -0
  278. package/skills/planning/archify/evals.md +65 -0
  279. package/skills/planning/architecture/SKILL.md +62 -13
  280. package/skills/planning/architecture/evals.md +65 -0
  281. package/skills/planning/backlog/SKILL.md +131 -15
  282. package/skills/planning/backlog/evals.md +142 -0
  283. package/skills/planning/prd/SKILL.md +47 -7
  284. package/skills/planning/prd/evals.md +54 -0
  285. package/skills/planning/product-intent/SKILL.md +58 -3
  286. package/skills/planning/product-intent/evals.md +70 -0
  287. package/skills/planning/tech-spec/SKILL.md +54 -3
  288. package/skills/planning/tech-spec/evals.md +73 -0
  289. package/skills/registry.yaml +70 -62
  290. package/skills/remote.yaml +13 -0
  291. package/skills/research/arxiv-literature/SKILL.md +77 -19
  292. package/skills/research/arxiv-literature/evals.md +50 -0
  293. package/skills/research/experiment-protocol/SKILL.md +21 -2
  294. package/skills/research/experiment-protocol/evals.md +23 -0
  295. package/skills/research/scientific-debugging/SKILL.md +24 -2
  296. package/skills/research/scientific-debugging/evals.md +18 -0
  297. package/skills/research/scientific-modernization/SKILL.md +27 -2
  298. package/skills/research/scientific-modernization/evals.md +27 -0
  299. package/skills/skill-marketplace.json +97 -62
  300. package/skills/workflow/cut-it/SKILL.md +66 -6
  301. package/skills/workflow/cut-it/evals.md +101 -0
  302. package/skills/workflow/design-council/SKILL.md +118 -28
  303. package/skills/workflow/design-council/evals.md +161 -0
  304. package/skills/workflow/grill-me/SKILL.md +87 -11
  305. package/skills/workflow/grill-me/evals.md +153 -0
  306. package/skills/workflow/workflow-distiller/SKILL.md +77 -18
  307. package/skills/workflow/workflow-distiller/evals.md +118 -0
  308. package/src/cli/args.ts +2 -2
  309. package/src/cli/bootstrap-generate.ts +1 -1
  310. package/src/cli/config-inspect.ts +65 -12
  311. package/src/cli/configure-interop.ts +105 -13
  312. package/src/cli/configure-oauth.ts +57 -0
  313. package/src/cli/configure-onboarding.ts +980 -0
  314. package/src/cli/configure-target.ts +594 -0
  315. package/src/cli/configure.ts +1082 -532
  316. package/src/cli/context-map.ts +114 -0
  317. package/src/cli/context.ts +4 -0
  318. package/src/cli/docs.ts +22 -14
  319. package/src/cli/doctor-naming.ts +5 -5
  320. package/src/cli/doctor-toolchain.ts +3 -3
  321. package/src/cli/eval.ts +1 -2
  322. package/src/cli/extensions.ts +2 -1
  323. package/src/cli/fleet.ts +1 -1
  324. package/src/cli/index.ts +3 -1
  325. package/src/cli/internal-dispatch.ts +3 -4
  326. package/src/cli/lifecycle-presenter.ts +436 -0
  327. package/src/cli/models.ts +10 -2
  328. package/src/cli/modes/print.ts +5 -1
  329. package/src/cli/panes.ts +19 -5
  330. package/src/cli/reset.ts +228 -106
  331. package/src/cli/run.ts +9 -4
  332. package/src/cli/select.ts +664 -0
  333. package/src/cli/share.ts +5 -1
  334. package/src/cli/skills-eval.ts +3 -3
  335. package/src/cli/skills.ts +9 -2
  336. package/src/cli/targets.ts +5 -6
  337. package/src/cli/trace.ts +55 -4
  338. package/src/cli/uninstall.ts +233 -165
  339. package/src/cli/upgrade.ts +204 -149
  340. package/src/cli/usage.ts +86 -27
  341. package/src/cli/validate-model.ts +3 -3
  342. package/src/cli/wiki-generate.ts +1 -1
  343. package/src/core/artifact-paths.ts +1 -1
  344. package/src/core/bash-exec.ts +131 -86
  345. package/src/core/bus-events.ts +51 -6
  346. package/src/core/config.ts +61 -1
  347. package/src/core/defaults.ts +7 -4
  348. package/src/core/dispatch-outcome.ts +16 -0
  349. package/src/core/external-diagnostic.ts +44 -0
  350. package/src/core/gateway-routing.ts +157 -0
  351. package/src/core/guardrails.ts +10 -49
  352. package/src/core/prompt-hint.ts +9 -0
  353. package/src/core/safe-exec.ts +17 -2
  354. package/src/core/skill-activation.ts +89 -2
  355. package/src/domains/agents/builtins/architect.md +2 -3
  356. package/src/domains/agents/builtins/coder.md +3 -2
  357. package/src/domains/agents/builtins/debugger.md +2 -2
  358. package/src/domains/agents/builtins/documenter.md +2 -2
  359. package/src/domains/agents/builtins/git-master.md +1 -1
  360. package/src/domains/agents/builtins/oracle.md +1 -1
  361. package/src/domains/agents/builtins/provenance.md +1 -1
  362. package/src/domains/agents/builtins/researcher.md +1 -1
  363. package/src/domains/agents/builtins/scout.md +1 -1
  364. package/src/domains/agents/builtins/tester.md +2 -2
  365. package/src/domains/agents/builtins/verifier.md +2 -2
  366. package/src/domains/agents/builtins/wiki-writer.md +1 -1
  367. package/src/domains/agents/builtins/world-knowledge.md +31 -0
  368. package/src/domains/agents/catalog.ts +13 -15
  369. package/src/domains/agents/contract.ts +2 -0
  370. package/src/domains/agents/extension.ts +23 -1
  371. package/src/domains/agents/result-contract.ts +70 -0
  372. package/src/domains/config/keybindings.ts +8 -0
  373. package/src/domains/context/extension.ts +0 -3
  374. package/src/domains/context/wiki/map-seed.ts +589 -0
  375. package/src/domains/context/wiki/plan.ts +2 -2
  376. package/src/domains/context/working-set/path-index.ts +1 -0
  377. package/src/domains/dispatch/admission.ts +29 -0
  378. package/src/domains/dispatch/agent-candidates.ts +10 -0
  379. package/src/domains/dispatch/budget-envelope.ts +86 -1
  380. package/src/domains/dispatch/capability-match.ts +11 -0
  381. package/src/domains/dispatch/capacity-lease.ts +17 -0
  382. package/src/domains/dispatch/contract.ts +11 -1
  383. package/src/domains/dispatch/extension.ts +237 -49
  384. package/src/domains/dispatch/host-verification.ts +435 -39
  385. package/src/domains/dispatch/intent-requirements.ts +10 -0
  386. package/src/domains/dispatch/intent.ts +18 -1
  387. package/src/domains/dispatch/path-scope.ts +235 -24
  388. package/src/domains/dispatch/run-event-journal.ts +4 -15
  389. package/src/domains/dispatch/state.ts +2 -3
  390. package/src/domains/dispatch/transport.ts +45 -21
  391. package/src/domains/dispatch/types.ts +58 -3
  392. package/src/domains/dispatch/worker-model-metadata.ts +38 -0
  393. package/src/domains/eval/artifacts/store.ts +5 -0
  394. package/src/domains/eval/metrics/call-ledger-stream.ts +34 -11
  395. package/src/domains/eval/metrics/token-stream.ts +201 -31
  396. package/src/domains/eval/metrics/tracked.ts +40 -4
  397. package/src/domains/eval/runners/clio-run.ts +5 -2
  398. package/src/domains/eval/schema/suite.ts +28 -0
  399. package/src/domains/eval/schema/verdict.ts +2 -2
  400. package/src/domains/eval/store.ts +8 -1
  401. package/src/domains/eval/suites/resolve.ts +13 -1
  402. package/src/domains/eval/suites/run.ts +24 -3
  403. package/src/domains/evidence/trust-status.ts +10 -1
  404. package/src/domains/extensions/contract.ts +15 -1
  405. package/src/domains/extensions/discovery.ts +238 -41
  406. package/src/domains/extensions/extension.ts +105 -6
  407. package/src/domains/extensions/index.ts +24 -0
  408. package/src/domains/extensions/integrity.ts +189 -0
  409. package/src/domains/extensions/manager.ts +17 -1
  410. package/src/domains/extensions/resource-path.ts +27 -0
  411. package/src/domains/extensions/resources.ts +18 -38
  412. package/src/domains/extensions/snapshot-store.ts +39 -0
  413. package/src/domains/extensions/snapshot.ts +180 -0
  414. package/src/domains/extensions/state.ts +385 -57
  415. package/src/domains/extensions/types.ts +118 -1
  416. package/src/domains/interop/registry.ts +6 -2
  417. package/src/domains/interop/types.ts +4 -0
  418. package/src/domains/lifecycle/migrations/2026-09-01-extension-install-digests.ts +27 -0
  419. package/src/domains/lifecycle/migrations/index.ts +6 -0
  420. package/src/domains/lifecycle/naming-resources.ts +19 -4
  421. package/src/domains/lifecycle/naming-yazi.ts +10 -5
  422. package/src/domains/memory/task-memory-policy.ts +70 -26
  423. package/src/domains/memory/task-memory-telemetry.ts +1 -0
  424. package/src/domains/middleware/contract.ts +26 -0
  425. package/src/domains/middleware/extension.ts +24 -24
  426. package/src/domains/middleware/hook-receipts.ts +27 -4
  427. package/src/domains/middleware/hooks-io.ts +65 -32
  428. package/src/domains/middleware/hooks.ts +64 -0
  429. package/src/domains/middleware/index.ts +28 -5
  430. package/src/domains/middleware/marketplace-offer.ts +3 -35
  431. package/src/domains/middleware/memory-intervention.ts +127 -32
  432. package/src/domains/middleware/memory-step-endpoint.ts +3 -2
  433. package/src/domains/middleware/registrations.ts +326 -0
  434. package/src/domains/middleware/runtime.ts +28 -0
  435. package/src/domains/middleware/skills-reminder.ts +31 -2
  436. package/src/domains/middleware/snapshot.ts +20 -7
  437. package/src/domains/mux/contract.ts +38 -0
  438. package/src/domains/mux/detect.ts +6 -13
  439. package/src/domains/mux/index.ts +1 -1
  440. package/src/domains/mux/operations.ts +44 -5
  441. package/src/domains/mux/yazi/assets/yazi.toml +2 -2
  442. package/src/domains/mux/yazi/session.ts +53 -4
  443. package/src/domains/mux/yazi/theme.ts +117 -17
  444. package/src/domains/observability/compaction-usage.ts +118 -0
  445. package/src/domains/observability/contract.ts +10 -11
  446. package/src/domains/observability/cost.ts +1 -1
  447. package/src/domains/observability/extension.ts +17 -4
  448. package/src/domains/observability/out-of-turn-usage.ts +52 -21
  449. package/src/domains/observability/projection.ts +14 -90
  450. package/src/domains/observability/trace-store.ts +43 -7
  451. package/src/domains/prompts/compiler.ts +73 -53
  452. package/src/domains/prompts/contract.ts +15 -3
  453. package/src/domains/prompts/extension.ts +97 -9
  454. package/src/domains/prompts/fragments/identity/clio-worker.md +1 -3
  455. package/src/domains/prompts/fragments/identity/clio.md +6 -12
  456. package/src/domains/prompts/fragments/identity/docs-routing.md +1 -2
  457. package/src/domains/prompts/fragments/identity/self-awareness.md +3 -11
  458. package/src/domains/prompts/fragments/operating/contract.md +7 -15
  459. package/src/domains/prompts/fragments/operating/delegation.md +32 -34
  460. package/src/domains/prompts/fragments/operating/skills.md +10 -24
  461. package/src/domains/prompts/fragments/operating/worker.md +1 -8
  462. package/src/domains/providers/contract.ts +4 -1
  463. package/src/domains/providers/extension.ts +40 -9
  464. package/src/domains/providers/index.ts +1 -1
  465. package/src/domains/providers/model-capabilities.ts +9 -0
  466. package/src/domains/providers/model-discovery.ts +2 -0
  467. package/src/domains/providers/model-runtime-capabilities.ts +99 -25
  468. package/src/domains/providers/models/local-models/clio-coder-local-coding-targets.yaml +699 -114
  469. package/src/domains/providers/runtime-resolution.ts +31 -0
  470. package/src/domains/providers/runtimes/antigravity/antigravity-code.ts +225 -45
  471. package/src/domains/providers/runtimes/common/lmstudio-http.ts +6 -2
  472. package/src/domains/providers/runtimes/common/local-synth.ts +2 -0
  473. package/src/domains/providers/runtimes/common/probe-helpers.ts +7 -2
  474. package/src/domains/providers/runtimes/local-native/llamacpp.ts +9 -1
  475. package/src/domains/providers/runtimes/protocol/litellm.ts +119 -29
  476. package/src/domains/providers/support.ts +11 -5
  477. package/src/domains/providers/target-model-cache.ts +25 -2
  478. package/src/domains/providers/types/capability-flags.ts +2 -0
  479. package/src/domains/providers/types/cost-provenance.ts +19 -0
  480. package/src/domains/providers/types/local-model-quirks.ts +85 -37
  481. package/src/domains/providers/types/runtime-descriptor.ts +20 -1
  482. package/src/domains/providers/types/target-descriptor.ts +19 -0
  483. package/src/domains/resources/index.ts +3 -0
  484. package/src/domains/resources/skills/install.ts +72 -7
  485. package/src/domains/resources/skills/loader.ts +23 -19
  486. package/src/domains/resources/skills/marketplace.ts +63 -11
  487. package/src/domains/safety/autonomy.ts +15 -0
  488. package/src/domains/safety/call-target.ts +1 -1
  489. package/src/domains/safety/index.ts +1 -0
  490. package/src/domains/safety/loop-detector.ts +7 -4
  491. package/src/domains/safety/path-policy.ts +1 -1
  492. package/src/domains/safety/policy-engine.ts +34 -11
  493. package/src/domains/safety/protected-artifacts.ts +191 -88
  494. package/src/domains/safety/run-effects.ts +2 -22
  495. package/src/domains/safety/skill-authority.ts +55 -0
  496. package/src/domains/session/compaction/compact.ts +72 -22
  497. package/src/domains/session/entries.ts +6 -0
  498. package/src/domains/session/task-board.ts +10 -9
  499. package/src/domains/session/usage.ts +3 -3
  500. package/src/domains/share/archive.ts +164 -7
  501. package/src/engine/acp/server.ts +62 -9
  502. package/src/engine/agent.ts +13 -3
  503. package/src/engine/ai.ts +26 -8
  504. package/src/engine/antigravity/subprocess-runtime.ts +386 -120
  505. package/src/engine/api-registry.ts +3 -0
  506. package/src/engine/apis/llamacpp-residency.ts +3 -4
  507. package/src/engine/apis/lmstudio.ts +3 -3
  508. package/src/engine/apis/ollama-native.ts +6 -6
  509. package/src/engine/apis/openai-completions.ts +145 -39
  510. package/src/engine/apis/output-budget.ts +8 -18
  511. package/src/engine/apis/residency.ts +8 -27
  512. package/src/engine/external-subprocess.ts +114 -6
  513. package/src/engine/gemma-channel-filter.ts +19 -0
  514. package/src/engine/loop-guard.ts +92 -12
  515. package/src/engine/worker-runtime.ts +40 -11
  516. package/src/engine/worker-tools.ts +3 -1
  517. package/src/entry/background-model-metadata.ts +18 -0
  518. package/src/entry/compaction-prompt.ts +57 -0
  519. package/src/entry/extension-hook-sources.ts +28 -0
  520. package/src/entry/extension-reload.ts +309 -0
  521. package/src/entry/orchestrator.ts +464 -251
  522. package/src/entry/task-memory-lifecycle.ts +35 -0
  523. package/src/interactive/application-controller.ts +2 -1
  524. package/src/interactive/bus-notices.ts +8 -1
  525. package/src/interactive/chat-loop-messages.ts +16 -17
  526. package/src/interactive/chat-loop.ts +75 -3
  527. package/src/interactive/chat-panel.ts +36 -13
  528. package/src/interactive/chat-renderer.ts +72 -7
  529. package/src/interactive/cost-overlay.ts +26 -2
  530. package/src/interactive/dispatch-board.ts +6 -11
  531. package/src/interactive/footer/widgets.ts +13 -0
  532. package/src/interactive/interactive-application.ts +39 -4
  533. package/src/interactive/interactive-input-runtime.ts +4 -0
  534. package/src/interactive/interactive-presentation.ts +2 -2
  535. package/src/interactive/interactive-slash-runtime.ts +4 -1
  536. package/src/interactive/overlays/extensions.ts +9 -1
  537. package/src/interactive/overlays/help-reference.ts +13 -0
  538. package/src/interactive/overlays/settings.ts +27 -16
  539. package/src/interactive/panes-runtime.ts +111 -35
  540. package/src/interactive/prompt-cache-identity.ts +88 -0
  541. package/src/interactive/renderers/worker-entry.ts +32 -0
  542. package/src/interactive/slash-commands.ts +153 -20
  543. package/src/interactive/stream-pacing-policy.ts +0 -23
  544. package/src/interactive/theme/labels.ts +19 -13
  545. package/src/interactive/turn-context.ts +39 -20
  546. package/src/interactive/turn-recovery.ts +8 -0
  547. package/src/interactive/turn-runtime.ts +27 -11
  548. package/src/interactive/turn-state.ts +7 -0
  549. package/src/interactive/worker-receipts.ts +1 -0
  550. package/src/interactive/worker-stream.ts +6 -1
  551. package/src/interactive/yazi-bridge.ts +60 -6
  552. package/src/tools/agent-tools.ts +30 -1
  553. package/src/tools/artifact.ts +2 -2
  554. package/src/tools/ask-user.ts +3 -3
  555. package/src/tools/bash.ts +1 -1
  556. package/src/tools/bootstrap.ts +4 -0
  557. package/src/tools/builtin-tool-catalog.ts +52 -22
  558. package/src/tools/codewiki/code-nav-surface.ts +6 -0
  559. package/src/tools/codewiki/code-nav.ts +99 -13
  560. package/src/tools/context/docs-engine.ts +20 -7
  561. package/src/tools/context/index.ts +59 -21
  562. package/src/tools/core-bootstrap.ts +28 -6
  563. package/src/tools/credential-present.ts +1 -2
  564. package/src/tools/dispatch-arguments.ts +6 -1
  565. package/src/tools/dispatch-event-text.ts +10 -0
  566. package/src/tools/dispatch-plan.ts +49 -4
  567. package/src/tools/dispatch-run-events.ts +1 -1
  568. package/src/tools/dispatch-runner.ts +12 -0
  569. package/src/tools/dispatch-schema.ts +338 -0
  570. package/src/tools/dispatch-types.ts +3 -0
  571. package/src/tools/dispatch.ts +9 -254
  572. package/src/tools/ledger.ts +3 -5
  573. package/src/tools/monitor-surface.ts +5 -13
  574. package/src/tools/observation.ts +4 -5
  575. package/src/tools/panes-surface.ts +4 -11
  576. package/src/tools/panes.ts +4 -2
  577. package/src/tools/policy.ts +15 -2
  578. package/src/tools/read.ts +5 -6
  579. package/src/tools/registry.ts +41 -12
  580. package/src/tools/result-shaping.ts +18 -14
  581. package/src/tools/steer-surface.ts +1 -1
  582. package/src/tools/tasks.ts +1 -1
  583. package/src/tools/truncate.ts +6 -5
  584. package/src/tools/verify/surface.ts +6 -12
  585. package/src/tools/web-fetch-surface.ts +1 -3
  586. package/src/tools/worker-evidence.ts +3 -1
  587. package/src/worker/spec-contract.ts +4 -0
  588. package/dist/builtins-UJLMOVOV.js +0 -17
  589. package/dist/chunk-5QIAJV2D.js +0 -48
  590. package/dist/chunk-JZWT5J3Y.js +0 -814
  591. package/dist/chunk-K7VKOLQQ.js +0 -15
  592. package/dist/chunk-PMZCIOCJ.js +0 -25
  593. package/dist/chunk-SUW5DORT.js +0 -819
  594. package/dist/chunk-UOV2BYIW.js +0 -107
  595. package/dist/chunk-WR6U3OVP.js +0 -45
  596. package/dist/chunk-Y45G3AXC.js +0 -1558
  597. package/dist/reset-EOLM7GVE.js +0 -230
  598. package/dist/uninstall-N34PCTGJ.js +0 -331
  599. package/dist/upgrade-H7TOM7YL.js +0 -323
  600. package/docs/artifact-versions.md +0 -67
  601. package/docs/development-pipeline.md +0 -121
  602. package/docs/documentation-coverage.md +0 -46
  603. package/docs/documentation-guide.md +0 -167
  604. package/docs/time-conventions.md +0 -101
@@ -1,4 +1,16 @@
1
1
  import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
+ import {
3
+ applyTaskWorktree,
4
+ captureWorkspaceSnapshot,
5
+ cleanupTaskWorktree,
6
+ createTaskWorktree,
7
+ createWriteBoundaryEnforcer,
8
+ gitCheckoutRoot
9
+ } from "./chunk-B4VEBZKF.js";
10
+ import {
11
+ executionPlanAncestors,
12
+ spliceExecutionPlan
13
+ } from "./chunk-E3TPLWFX.js";
2
14
  import {
3
15
  decideReviewGate,
4
16
  materializePendingGateDecision,
@@ -6,7 +18,7 @@ import {
6
18
  readGateDecisionArtifactsForRunIds,
7
19
  stagePendingGateDecision,
8
20
  verifyGateDecisionArtifact
9
- } from "./chunk-GPPB3JBE.js";
21
+ } from "./chunk-WRBAGUNF.js";
10
22
  import {
11
23
  RUN_RECEIPT_INTEGRITY_ALGORITHM,
12
24
  RUN_RECEIPT_INTEGRITY_VERSION,
@@ -24,40 +36,32 @@ import {
24
36
  trustVerdict,
25
37
  verifyReceiptIntegrity,
26
38
  withReceiptIntegrity
27
- } from "./chunk-6NJQITNH.js";
39
+ } from "./chunk-IWT4SF4R.js";
28
40
  import {
29
41
  protectedArtifactFromSessionEntry,
30
42
  protectedArtifactStateFromSessionEntries,
31
43
  readAuditRows,
32
44
  readSessionEntriesForId,
33
45
  responseModelIdObservationFromRecord
34
- } from "./chunk-TVH4ONAM.js";
46
+ } from "./chunk-JKKCYP3C.js";
35
47
  import {
36
- applyTaskWorktree,
37
- captureWorkspaceSnapshot,
38
- cleanupTaskWorktree,
39
- createTaskWorktree,
40
- createWriteBoundaryEnforcer,
41
- gitCheckoutRoot
42
- } from "./chunk-TD3PGPQA.js";
48
+ loadEvalArtifact,
49
+ parseEvalArtifactV4,
50
+ redactArtifactForStorage,
51
+ sumEvalHarnessMetrics
52
+ } from "./chunk-FTMGRKEF.js";
43
53
  import {
44
- executionPlanAncestors,
45
- spliceExecutionPlan
46
- } from "./chunk-THYWACCR.js";
54
+ codeStepDir,
55
+ writeCodeStepRecord
56
+ } from "./chunk-XRZT5WY5.js";
47
57
  import {
48
58
  parseRigorOverride,
49
59
  resolveRigor
50
60
  } from "./chunk-RVG5JXAL.js";
51
- import {
52
- loadEvalArtifact,
53
- parseEvalArtifactV4,
54
- redactArtifactForStorage,
55
- sumEvalHarnessMetrics
56
- } from "./chunk-6CCS4G3W.js";
57
61
  import {
58
62
  defaultRunEventJournal,
59
63
  removeRunEventJournals
60
- } from "./chunk-6VC4OV3Z.js";
64
+ } from "./chunk-VIA6RFQZ.js";
61
65
  import {
62
66
  AdmissionCanceledError,
63
67
  EVENT_TEE_LIMIT,
@@ -65,6 +69,10 @@ import {
65
69
  durableAssistantTextFromEvent,
66
70
  startDispatchEventPump
67
71
  } from "./chunk-T56WDKA5.js";
72
+ import {
73
+ FLEET_COMMAND_BASE_ENV,
74
+ normalizeWriteBoundary
75
+ } from "./chunk-2VIKGWFZ.js";
68
76
  import {
69
77
  LOCAL_NODE_ID,
70
78
  computeSettingsFingerprint,
@@ -75,11 +83,7 @@ import {
75
83
  receiptAttestationFields,
76
84
  routeFactVerdict,
77
85
  spawnNativeWorker
78
- } from "./chunk-AFKWHWXF.js";
79
- import {
80
- FLEET_COMMAND_BASE_ENV,
81
- normalizeWriteBoundary
82
- } from "./chunk-CTJ4RNAA.js";
86
+ } from "./chunk-6PTFB5VS.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-2VG7KLYV.js";
129
+ } from "./chunk-PAJQJ7BS.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-7EPLI7VL.js";
147
+ } from "./chunk-EKCHAPYA.js";
141
148
  import {
142
149
  assessFinishContract
143
- } from "./chunk-PVAMAVBB.js";
150
+ } from "./chunk-RSJ25QSL.js";
144
151
  import {
145
152
  WRITE_ROOT_REFUSED_TOOLS
146
- } from "./chunk-IXJT6DCX.js";
153
+ } from "./chunk-XIVNBFZS.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,28 +168,11 @@ import {
161
168
  } from "./chunk-H7IXIC72.js";
162
169
  import {
163
170
  compareCodepoints
164
- } from "./chunk-VN3SHNBN.js";
165
- import {
166
- DEFAULT_AUTONOMY_LEVEL,
167
- autonomyDenyRejection,
168
- isSkillActivation,
169
- mapAutonomy
170
- } from "./chunk-FSP7CMNU.js";
171
- import {
172
- createRedactionTally,
173
- redactSecretsDeep,
174
- redactSecretsText
175
- } from "./chunk-4BJ5BYCE.js";
176
- import {
177
- truncateUtf8
178
- } from "./chunk-6XLNIQDB.js";
171
+ } from "./chunk-7DICMOS6.js";
179
172
  import {
180
- canonicalJson,
181
- endpointIdentityHash,
182
- parseAgentLedgerBody
183
- } from "./chunk-VAVR4IJY.js";
184
- import {
185
- pathBoundaryCovers
173
+ PATH_BOUNDARY_MAX_ENTRIES,
174
+ pathBoundaryCovers,
175
+ resolvePathBoundary
186
176
  } from "./chunk-HHV2GANA.js";
187
177
  import {
188
178
  agentSpecFingerprint,
@@ -194,10 +184,10 @@ import {
194
184
  resolveAgentToolCompatibility,
195
185
  resultContractAuthorship,
196
186
  validateRecipeResult
197
- } from "./chunk-IG7BCQBA.js";
187
+ } from "./chunk-B4OAX3SI.js";
198
188
  import {
199
189
  detectValidationCommand
200
- } from "./chunk-GCSMB2KY.js";
190
+ } from "./chunk-I7ZPNEJM.js";
201
191
  import {
202
192
  isProjectVerifierCheckId,
203
193
  isVerificationScriptName
@@ -205,17 +195,39 @@ import {
205
195
  import {
206
196
  canonicalizeExistingPath
207
197
  } from "./chunk-ECH6PKUQ.js";
198
+ import {
199
+ truncateUtf8
200
+ } from "./chunk-6XLNIQDB.js";
201
+ import {
202
+ canonicalJson,
203
+ endpointIdentityHash,
204
+ parseAgentLedgerBody
205
+ } from "./chunk-VAVR4IJY.js";
206
+ import {
207
+ DEFAULT_AUTONOMY_LEVEL,
208
+ autonomyDenyRejection,
209
+ isSkillActivation,
210
+ mapAutonomy
211
+ } from "./chunk-JGRC33J2.js";
212
+ import {
213
+ createRedactionTally,
214
+ redactSecretsDeep,
215
+ redactSecretsText
216
+ } from "./chunk-4BJ5BYCE.js";
208
217
  import {
209
218
  ToolNames,
210
219
  isBuiltinToolName
211
220
  } from "./chunk-K6BSR66V.js";
212
221
  import {
222
+ canonicalEndpointKey,
213
223
  canonicalizeWireModelId,
214
224
  endpointCapacityFor,
215
225
  endpointCapacityForStatus,
216
226
  endpointLabel,
217
227
  firstRuntimeResolutionError,
218
228
  foregroundStreamUsage,
229
+ gatewayRoutingObservationFromRecord,
230
+ gatewayRoutingObservationLabel,
219
231
  isDispatchEligibleRuntime,
220
232
  normalizeCostProvenance,
221
233
  resolveEndpointCapacities,
@@ -223,36 +235,23 @@ import {
223
235
  resolveRuntimeTarget,
224
236
  runtimeResolutionWarnings,
225
237
  runtimeTargetSnapshot
226
- } from "./chunk-UEDMSP56.js";
238
+ } from "./chunk-XPWWI35G.js";
227
239
  import {
228
240
  ceilChars
229
- } from "./chunk-CWVRRIEI.js";
241
+ } from "./chunk-NZMNUPZZ.js";
230
242
  import {
231
243
  atomicWrite
232
- } from "./chunk-MQXIVJ35.js";
244
+ } from "./chunk-HAXOFFRH.js";
233
245
  import {
234
246
  assertSafeId
235
247
  } from "./chunk-R346GLFC.js";
236
- import {
237
- BusChannels
238
- } from "./chunk-HLW2MRKE.js";
239
248
  import {
240
249
  normalizeClioCoderEventRecord,
241
250
  normalizeClioCoderEventType
242
251
  } from "./chunk-BTK3SSSK.js";
243
252
  import {
244
- attributeCommitMessage,
245
- gitCommitAttributionEnabled,
246
- reportCommitAttributionDiagnostic,
247
- withManagedGitCommitAttributionEnvironment
248
- } from "./chunk-JIEGK6UF.js";
249
- import {
250
- MAX_TIMER_DELAY_MS,
251
- rawDurationMs
252
- } from "./chunk-EBY63B7G.js";
253
- import {
254
- AI_AGENT_NAME
255
- } from "./chunk-6EJMN2Y3.js";
253
+ BusChannels
254
+ } from "./chunk-F4EKGO4N.js";
256
255
  import {
257
256
  readClioVersion,
258
257
  readPiMonoVersion,
@@ -263,14 +262,27 @@ import {
263
262
  DEFAULT_DELEGATION_TURN_TIMEOUT_MS,
264
263
  DEFAULT_SETTINGS,
265
264
  THINKING_LEVELS
266
- } from "./chunk-BWW4HLO4.js";
265
+ } from "./chunk-UXCU4E3T.js";
267
266
  import {
268
267
  GUARDRAIL_DEFAULTS,
269
268
  resolveGuardrail
270
- } from "./chunk-NLFAQR7Z.js";
269
+ } from "./chunk-S66XZJOF.js";
270
+ import {
271
+ attributeCommitMessage,
272
+ gitCommitAttributionEnabled,
273
+ reportCommitAttributionDiagnostic,
274
+ withManagedGitCommitAttributionEnvironment
275
+ } from "./chunk-JIEGK6UF.js";
276
+ import {
277
+ MAX_TIMER_DELAY_MS,
278
+ rawDurationMs
279
+ } from "./chunk-EBY63B7G.js";
280
+ import {
281
+ AI_AGENT_NAME
282
+ } from "./chunk-6EJMN2Y3.js";
271
283
  import {
272
284
  targetRequiresAuth
273
- } from "./chunk-WNP7O5WZ.js";
285
+ } from "./chunk-ID64D7PE.js";
274
286
  import {
275
287
  FILE_LOCK_ACQUIRE_TIMEOUT_MS,
276
288
  withStateFileLock,
@@ -281,14 +293,15 @@ import {
281
293
  processAlive,
282
294
  processBirthToken
283
295
  } from "./chunk-3I7MS7N2.js";
296
+ import {
297
+ resolveEffectivePricing
298
+ } from "./chunk-5OIVVPHF.js";
284
299
  import {
285
300
  clioDataDir,
286
301
  clioStateDir,
302
+ resolveClioDirs,
287
303
  stateRootRemoved
288
304
  } from "./chunk-BYP5D4HI.js";
289
- import {
290
- resolveEffectivePricing
291
- } from "./chunk-O42A54GG.js";
292
305
  import {
293
306
  init_esm_shims
294
307
  } from "./chunk-3R73A4XB.js";
@@ -1228,6 +1241,19 @@ function capacityLeaseUsage(options) {
1228
1241
  }
1229
1242
  return { global: leases.length, nodes, endpoints, endpointHolders };
1230
1243
  }
1244
+ function endpointCapacityUsage() {
1245
+ return withStateFileLockSync(capacityStateLockPath(), () => {
1246
+ const file = readCapacityStateUnsafe();
1247
+ reclaim(file, Date.now(), defaultProbe);
1248
+ const held2 = heldReservationUsage(file.reservations);
1249
+ const usage = { ...foregroundStreamUsage() };
1250
+ for (const [key, count] of Object.entries(held2.endpoints)) usage[key] = (usage[key] ?? 0) + count;
1251
+ for (const lease of file.leases) {
1252
+ if (lease.endpointKey !== void 0) usage[lease.endpointKey] = (usage[lease.endpointKey] ?? 0) + 1;
1253
+ }
1254
+ return usage;
1255
+ });
1256
+ }
1231
1257
  function createNodeLeaseUsageReader(options) {
1232
1258
  const cacheMs = options.cacheMs ?? 200;
1233
1259
  let cache = null;
@@ -1407,6 +1433,12 @@ function renderDispatchIntentRequirements(intent) {
1407
1433
  "# Declared Result Requirements",
1408
1434
  "These entries are requirements to satisfy and verify. They are not evidence that an output exists or a check passed."
1409
1435
  ];
1436
+ if (intent.writeRoots.length > 0) {
1437
+ lines.push(
1438
+ "",
1439
+ "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."
1440
+ );
1441
+ }
1410
1442
  if (intent.expectedOutputs.length > 0) {
1411
1443
  lines.push("", "Expected outputs:", ...intent.expectedOutputs.map((output) => `- ${output}`));
1412
1444
  }
@@ -1442,7 +1474,7 @@ init_esm_shims();
1442
1474
  // src/domains/evidence/build.ts
1443
1475
  init_esm_shims();
1444
1476
  import { mkdir, readFile as readFile2, writeFile } from "node:fs/promises";
1445
- import { join as join16 } from "node:path";
1477
+ import { join as join15 } from "node:path";
1446
1478
 
1447
1479
  // src/domains/dispatch/index.ts
1448
1480
  init_esm_shims();
@@ -2437,7 +2469,6 @@ function startAcpDelegationRun(input) {
2437
2469
  // src/domains/prompts/compiler.ts
2438
2470
  init_esm_shims();
2439
2471
  import { join as join3 } from "node:path";
2440
- 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.';
2441
2472
  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.';
2442
2473
  function lookupFragment(table, id, role) {
2443
2474
  const frag = table.byId.get(id);
@@ -2487,16 +2518,32 @@ function renderRuntimeBlock(inputs) {
2487
2518
  }
2488
2519
  function sessionCanDispatch(inputs) {
2489
2520
  if (inputs.providerSupportsTools === false) return false;
2490
- return toolSurfaceHasTool(inputs.toolNames, inputs.toolPromptHints, "dispatch");
2521
+ return toolSurfaceHasTool(inputs.toolNames, "dispatch");
2491
2522
  }
2492
2523
  function sessionHasContext(inputs) {
2493
2524
  if (inputs.providerSupportsTools === false) return false;
2494
- return toolSurfaceHasTool(inputs.toolNames, inputs.toolPromptHints, "context");
2525
+ return toolSurfaceHasTool(inputs.toolNames, "context");
2495
2526
  }
2496
- function toolSurfaceHasTool(toolNames, toolPromptHints, tool) {
2527
+ function toolSurfaceHasTool(toolNames, tool) {
2497
2528
  const names = new Set((toolNames ?? []).map((name) => name.trim()));
2498
- const hinted = new Set((toolPromptHints ?? []).map((entry) => entry.tool.trim()));
2499
- return names.has(tool) || hinted.has(tool);
2529
+ return names.has(tool);
2530
+ }
2531
+ function canonicalToolPromptHints(entries, admitted) {
2532
+ const normalized = entries.map((entry) => ({
2533
+ tool: entry.tool.trim(),
2534
+ hint: normalizePromptHint(entry.hint) ?? ""
2535
+ })).filter((entry) => admitted.has(entry.tool) && entry.hint.length > 0).sort((a, b) => {
2536
+ if (a.tool !== b.tool) return a.tool < b.tool ? -1 : 1;
2537
+ return a.hint < b.hint ? -1 : a.hint > b.hint ? 1 : 0;
2538
+ });
2539
+ const seenTools = /* @__PURE__ */ new Set();
2540
+ const seenHints = /* @__PURE__ */ new Set();
2541
+ return normalized.filter((entry) => {
2542
+ if (seenTools.has(entry.tool) || seenHints.has(entry.hint)) return false;
2543
+ seenTools.add(entry.tool);
2544
+ seenHints.add(entry.hint);
2545
+ return true;
2546
+ });
2500
2547
  }
2501
2548
  function renderFleetBlock(inputs) {
2502
2549
  if (!sessionCanDispatch(inputs)) return "";
@@ -2515,36 +2562,43 @@ function renderToolContractBlock(inputs) {
2515
2562
  ].sort();
2516
2563
  const canDispatch = sessionCanDispatch(inputs);
2517
2564
  const canListSkills = sessionHasContext(inputs);
2565
+ const admitted = new Set(names);
2518
2566
  const inventoryGuidance = [
2519
- // Asked twice in one session which tools it had, a live model gave two
2520
- // different answers and invented `web_find`. The authoritative list is one
2521
- // line above; pointing at it beats letting the model recall the schemas.
2522
- "When answering capability-inventory questions, copy the Direct tools line above verbatim rather than recalling the attached schemas, and make no calls",
2523
- ...canDispatch ? ["add dispatch(list:true) only if agents or the fleet are requested"] : [],
2524
- ...canListSkills ? ['add context(scope="skills") only if skills are requested (it lists installed and marketplace skills)'] : []
2567
+ "When asked what tools you have, copy the Direct tools line verbatim and call nothing",
2568
+ ...canDispatch ? [
2569
+ "dispatch(list:true) answers a question about agents, the fleet, or which target and model run this session and its workers"
2570
+ ] : [],
2571
+ ...canListSkills ? ['context(scope="skills") answers only a question about skills'] : []
2525
2572
  ].join("; ");
2573
+ const capabilityKinds = [
2574
+ "direct tools are attached schemas",
2575
+ ...canDispatch ? ["fleet agents are workers behind dispatch"] : [],
2576
+ ...canListSkills ? ["skills are operator-activated workflows reached through context"] : []
2577
+ ];
2578
+ const orientationTools = ["context", "code_nav", "grep", "read"].filter((name) => admitted.has(name));
2579
+ const validationTools = ["verify", "git"].filter((name) => admitted.has(name));
2526
2580
  const lines = [
2527
2581
  "# Tool Contract",
2528
2582
  "The attached schemas are the session's complete direct-tool surface; follow each schema exactly.",
2529
2583
  ...names.length > 0 ? [`Direct tools: ${names.map((name) => `\`${name}\``).join(", ")}.`] : [],
2530
- "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.",
2584
+ `Harness model: ${capabilityKinds.join("; ")}. Keep these capability sets distinct.`,
2531
2585
  `${inventoryGuidance}.`,
2532
- "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.",
2586
+ "Call tools only for concrete inspection or changes the task requires; a tool-free question gets a tool-free answer.",
2533
2587
  // The tool-specific instantiation of the operating contract's "narrow
2534
2588
  // work: inspect directly" rule; the contract cannot name tools.
2535
2589
  // Delegation, the tasks board, and skills are not restated here: the
2536
- // Delegation and Skills passages and the registry hints carry them, and
2537
- // each renders exactly when its tool does.
2538
- 'For narrow file or symbol orientation, prefer context(scope="workspace"), code_nav, grep, and read instead of assuming source-tree details were preloaded.',
2539
- "Validate with verify or git diff before final claims.",
2540
- `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.`
2590
+ // Delegation, Fleet, and Skills passages and the registry hints carry
2591
+ // them, and each renders exactly when its tool does.
2592
+ ...orientationTools.length > 0 ? [
2593
+ `For narrow file or symbol orientation, prefer ${orientationTools.join(", ")} instead of assuming source-tree details were preloaded.`
2594
+ ] : [],
2595
+ ...validationTools.length > 0 ? [
2596
+ `Validate with ${validationTools.map((name) => name === "git" ? "git diff" : name).join(" or ")} before final claims.`
2597
+ ] : [],
2598
+ `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` : ""}.`
2541
2599
  ];
2542
- const seen = /* @__PURE__ */ new Set();
2543
- 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);
2544
- if (hints.some((entry) => entry.tool === "dispatch")) lines.push(FLEET_ROUTING_GUIDANCE);
2600
+ const hints = canonicalToolPromptHints(inputs.toolPromptHints ?? [], new Set(names));
2545
2601
  for (const entry of hints) {
2546
- if (seen.has(entry.tool)) continue;
2547
- seen.add(entry.tool);
2548
2602
  lines.push(entry.hint);
2549
2603
  }
2550
2604
  return lines.join("\n");
@@ -2596,15 +2650,8 @@ function renderWorkerToolContractBlock(inputs) {
2596
2650
  "Tool authority is limited to this list. Persona and bound-skill instructions never add tools.",
2597
2651
  "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."
2598
2652
  ];
2599
- const admitted = new Set(names);
2600
- const seen = /* @__PURE__ */ new Set();
2601
- 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) => {
2602
- if (a.tool !== b.tool) return a.tool < b.tool ? -1 : 1;
2603
- return a.hint < b.hint ? -1 : a.hint > b.hint ? 1 : 0;
2604
- });
2653
+ const hints = canonicalToolPromptHints(inputs.toolPromptHints, new Set(names));
2605
2654
  for (const entry of hints) {
2606
- if (seen.has(entry.tool)) continue;
2607
- seen.add(entry.tool);
2608
2655
  lines.push(entry.hint);
2609
2656
  }
2610
2657
  return lines.join("\n");
@@ -2638,8 +2685,7 @@ function renderRetrievalHintsBlock(inputs) {
2638
2685
  }
2639
2686
  return [
2640
2687
  "# Retrieval Hints",
2641
- "Compact CLIO-CODER.md project instructions may be preloaded above; everything else about the repository must be fetched, not assumed.",
2642
- "Never invent file paths, automatic tool behavior, or mutable repo details from the system prompt."
2688
+ "Repository details not included above must be fetched, never invented; compact CLIO-CODER.md instructions may be preloaded."
2643
2689
  ].join("\n");
2644
2690
  }
2645
2691
  function renderProjectBlock(contextFiles) {
@@ -2706,7 +2752,8 @@ function compile(table, inputs) {
2706
2752
  const docsRouting = selfAwareness && sessionHasContext(session) ? table.byId.get("identity.docs-routing") : void 0;
2707
2753
  if (selfAwareness) {
2708
2754
  const packageRoot = resolvePackageRoot();
2709
- 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"));
2755
+ const clioDirs = resolveClioDirs();
2756
+ 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);
2710
2757
  identityBody = [identity.body.trim(), rendered2.trim(), ...docsRouting ? [docsRouting.body.trim()] : []].join(
2711
2758
  "\n\n"
2712
2759
  );
@@ -3683,6 +3730,19 @@ function createLeaseSlotGuard(controller, leaseId, ownedByAssignment) {
3683
3730
  }
3684
3731
  var PUMP_MIN_MS = 10;
3685
3732
  var PUMP_MAX_MS = 500;
3733
+ function foregroundEndpointBlock(input) {
3734
+ if (input.endpointKey === void 0) return null;
3735
+ const limit = input.limits.endpoints[input.endpointKey];
3736
+ const active = input.usage.endpoints[input.endpointKey] ?? 0;
3737
+ const holders = input.usage.endpointHolders?.[input.endpointKey];
3738
+ if (limit === void 0 || active < limit || !holders || holders.foregroundStreams < 1) return null;
3739
+ return [
3740
+ `dispatch: admission denied: endpoint '${endpointLabel(input.endpointKey)}' cannot open a worker slot`,
3741
+ ` while ${describeEndpointCapacityHolders(holders)} (${active}/${limit} slots).`,
3742
+ " The foreground agent cannot release its slot until this tool call returns, so waiting here would deadlock.",
3743
+ " Point workers at a second endpoint or raise this target's maxConcurrentRequests to the server's actual slot count."
3744
+ ].join("");
3745
+ }
3686
3746
  function describeAdmissionFailure(input) {
3687
3747
  if (input.state === "canceled") return "dispatch: admission canceled before a capacity slot opened";
3688
3748
  if (input.endpointKey !== void 0) {
@@ -3773,6 +3833,14 @@ function createCapacityAdmissionController(options) {
3773
3833
  const controller = {
3774
3834
  async admit(input) {
3775
3835
  if (draining) throw new Error("dispatch: admission denied: this process is shutting down");
3836
+ const limits = options.limits();
3837
+ const usage = options.usage?.() ?? capacityLeaseUsage({ nowMs: now() });
3838
+ const foregroundBlock = foregroundEndpointBlock({
3839
+ ...input.endpointKey !== void 0 ? { endpointKey: input.endpointKey } : {},
3840
+ limits,
3841
+ usage
3842
+ });
3843
+ if (foregroundBlock !== null) throw new Error(foregroundBlock);
3776
3844
  const queuedAt = now();
3777
3845
  const requestId = `admit-${queuedAt.toString(36)}-${randomBytes3(5).toString("hex")}`;
3778
3846
  pending.set(input.assignmentId, requestId);
@@ -4335,6 +4403,7 @@ var REPORTING_CONTRACT_KINDS = /* @__PURE__ */ new Set([
4335
4403
  "scout-report",
4336
4404
  "verifier-report",
4337
4405
  "research-report",
4406
+ "world-knowledge-report",
4338
4407
  "provenance-report",
4339
4408
  "debugger-report",
4340
4409
  "oracle-report"
@@ -4358,6 +4427,7 @@ function suggestedSpecialist(taskType, specs) {
4358
4427
  }
4359
4428
  function assessCapabilityMismatch(input) {
4360
4429
  if (!READ_ONLY_CAPABILITY_CLASSES.has(input.capabilityClass)) return null;
4430
+ if (input.intent && input.intent.writeRoots.length === 0 && input.intent.expectedOutputs.length === 0) return null;
4361
4431
  const features = classifyAgentTask(input.task);
4362
4432
  if (!MUTATING_TASK_TYPES.has(features.taskType)) return null;
4363
4433
  const readShaped = READ_SHAPED_PATTERNS.some((pattern) => pattern.test(input.task));
@@ -4844,6 +4914,9 @@ ${spawned.spawnError}
4844
4914
  // src/domains/dispatch/host-verification.ts
4845
4915
  var OUTPUT_TAIL_BYTES = 2048;
4846
4916
  var MEMO_VERSION = 1;
4917
+ var HTTP_URL_RE = /\bhttps?:\/\/\S+/gu;
4918
+ 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;
4919
+ var IMPLICATED_PATH_CAP = PATH_BOUNDARY_MAX_ENTRIES;
4847
4920
  function sha2563(value) {
4848
4921
  return createHash4("sha256").update(value, "utf8").digest("hex");
4849
4922
  }
@@ -4915,6 +4988,52 @@ function hostVerificationRejection(verification) {
4915
4988
  detail: failedCheck === void 0 ? "host verification rejected" : `host verification check '${failedCheck.check}' rejected with exit code ${failedCheck.exitCode}`
4916
4989
  };
4917
4990
  }
4991
+ async function runResolvedCheck(input) {
4992
+ const resolvedCheck = input.resolvedCheck;
4993
+ const command = {
4994
+ id: resolvedCheck.check,
4995
+ argv: [...resolvedCheck.argv],
4996
+ cwd: "",
4997
+ timeoutMs: resolvedCheck.timeoutMs,
4998
+ env: [],
4999
+ description: `Host verification check ${resolvedCheck.check}.`
5000
+ };
5001
+ const fingerprint = workspaceFingerprint(resolvedCheck.cwd);
5002
+ const key = fingerprint === null ? null : memoKey({ ...command, cwd: resolve3(resolvedCheck.cwd) }, fingerprint, input.env);
5003
+ const hit = key === null ? void 0 : readMemo(input.stateDir).entries.find((entry) => entry.key === key && entry.check.exitCode === 0);
5004
+ if (hit !== void 0) {
5005
+ return {
5006
+ check: { ...hit.check, argv: [...hit.check.argv], memo: true, evidenceRunId: hit.runId },
5007
+ outputExcerpt: ""
5008
+ };
5009
+ }
5010
+ const outcome = await runCodeStep({
5011
+ stepId: `verification-${input.index + 1}-${resolvedCheck.check.replace(/[^a-z0-9._-]/giu, "_")}`,
5012
+ command,
5013
+ workspaceRoot: resolvedCheck.cwd,
5014
+ artifactDir: join8(input.stateDir, "artifacts", input.runId, "verification"),
5015
+ env: input.env
5016
+ });
5017
+ const artifactPath = outcome.record.artifactPaths[0];
5018
+ const check = {
5019
+ check: resolvedCheck.check,
5020
+ argv: [...outcome.record.argv],
5021
+ cwd: outcome.record.cwd,
5022
+ exitCode: outcome.record.exitCode,
5023
+ durationMs: outcome.record.durationMs,
5024
+ memo: false,
5025
+ outputTail: outputTail(outcome.report.outputExcerpt),
5026
+ ...artifactPath !== void 0 ? { artifactPath } : {}
5027
+ };
5028
+ if (check.exitCode === 0 && key !== null) {
5029
+ try {
5030
+ storeMemoEntry(input.stateDir, { key, runId: input.runId, check });
5031
+ } catch (error) {
5032
+ input.onDiagnostic?.(error);
5033
+ }
5034
+ }
5035
+ return { check, outputExcerpt: outcome.report.outputExcerpt };
5036
+ }
4918
5037
  async function runHostVerification(input) {
4919
5038
  const checks = input.request.resolvedVerification;
4920
5039
  if (checks === void 0 || checks.length === 0) return void 0;
@@ -4923,51 +5042,220 @@ async function runHostVerification(input) {
4923
5042
  const env = input.env ?? process.env;
4924
5043
  const results = [];
4925
5044
  for (const [index, resolvedCheck] of checks.entries()) {
4926
- const command = {
4927
- id: resolvedCheck.check,
5045
+ const outcome = await runResolvedCheck({
5046
+ runId: input.runId,
5047
+ index,
5048
+ resolvedCheck,
5049
+ stateDir,
5050
+ env,
5051
+ ...input.onDiagnostic !== void 0 ? { onDiagnostic: input.onDiagnostic } : {}
5052
+ });
5053
+ results.push(outcome.check);
5054
+ }
5055
+ return {
5056
+ status: results.every((check) => check.exitCode === 0) ? "verified" : "rejected",
5057
+ checks: results
5058
+ };
5059
+ }
5060
+ function implicatedPaths(outputExcerpt, checkCwd) {
5061
+ const withoutUrls = outputExcerpt.replace(HTTP_URL_RE, (url) => " ".repeat(url.length));
5062
+ const paths = /* @__PURE__ */ new Set();
5063
+ for (const match of withoutUrls.matchAll(CHECK_OUTPUT_PATH_RE)) paths.add(resolve3(checkCwd, match[0]));
5064
+ return [...paths].sort();
5065
+ }
5066
+ function checkDedupeKey(resolvedCheck) {
5067
+ return sha2563(
5068
+ JSON.stringify({
5069
+ check: resolvedCheck.check,
4928
5070
  argv: [...resolvedCheck.argv],
4929
- cwd: "",
4930
- timeoutMs: resolvedCheck.timeoutMs,
4931
- env: [],
4932
- description: `Host verification check ${resolvedCheck.check}.`
4933
- };
4934
- const fingerprint = workspaceFingerprint(resolvedCheck.cwd);
4935
- const key = fingerprint === null ? null : memoKey({ ...command, cwd: resolve3(resolvedCheck.cwd) }, fingerprint, env);
4936
- const hit = key === null ? void 0 : readMemo(stateDir).entries.find((entry) => entry.key === key && entry.check.exitCode === 0);
4937
- if (hit !== void 0) {
4938
- results.push({ ...hit.check, argv: [...hit.check.argv], memo: true, evidenceRunId: hit.runId });
5071
+ cwd: resolve3(resolvedCheck.cwd),
5072
+ timeoutMs: resolvedCheck.timeoutMs
5073
+ })
5074
+ );
5075
+ }
5076
+ function memberBoundary(participant) {
5077
+ const writeRoots = participant.request.intent?.writeRoots ?? [];
5078
+ return writeRoots.map((root) => resolvePathBoundary(participant.request.cwd ?? process.cwd(), root));
5079
+ }
5080
+ function attributeFailure(input) {
5081
+ const declared = new Set(input.declarers.map((member) => member.runId));
5082
+ const implicatedDeclarers = /* @__PURE__ */ new Set();
5083
+ const unconfined = /* @__PURE__ */ new Set();
5084
+ const decisive = /* @__PURE__ */ new Set();
5085
+ for (const member of input.declarers) {
5086
+ const boundary = memberBoundary(member);
5087
+ if (boundary.length === 0) {
5088
+ unconfined.add(member.runId);
4939
5089
  continue;
4940
5090
  }
4941
- const outcome = await runCodeStep({
4942
- stepId: `verification-${index + 1}-${resolvedCheck.check.replace(/[^a-z0-9._-]/giu, "_")}`,
4943
- command,
4944
- workspaceRoot: resolvedCheck.cwd,
4945
- artifactDir: join8(stateDir, "artifacts", input.runId, "verification"),
4946
- env
4947
- });
4948
- const artifactPath = outcome.record.artifactPaths[0];
4949
- const check = {
4950
- check: resolvedCheck.check,
4951
- argv: [...outcome.record.argv],
4952
- cwd: outcome.record.cwd,
4953
- exitCode: outcome.record.exitCode,
4954
- durationMs: outcome.record.durationMs,
4955
- memo: false,
4956
- outputTail: outputTail(outcome.report.outputExcerpt),
4957
- ...artifactPath !== void 0 ? { artifactPath } : {}
4958
- };
4959
- results.push(check);
4960
- if (check.exitCode === 0 && key !== null) {
4961
- try {
4962
- storeMemoEntry(stateDir, { key, runId: input.runId, check });
4963
- } catch (error) {
4964
- input.onDiagnostic?.(error);
5091
+ const hits = input.implicated.filter((path2) => pathBoundaryCovers(boundary, path2));
5092
+ if (hits.length === 0) continue;
5093
+ implicatedDeclarers.add(member.runId);
5094
+ for (const hit of hits) decisive.add(hit);
5095
+ }
5096
+ const others = input.wave.filter((member) => !declared.has(member.runId));
5097
+ const ownedElsewhere = input.implicated.length > 0 && input.implicated.every((path2) => others.some((member) => pathBoundaryCovers(memberBoundary(member), path2)));
5098
+ const localized = implicatedDeclarers.size > 0 || ownedElsewhere;
5099
+ const charged = localized ? new Set(implicatedDeclarers) : new Set(declared);
5100
+ for (const runId of unconfined) charged.add(runId);
5101
+ return {
5102
+ charged,
5103
+ basis: !localized || unconfined.size > 0 ? "unattributable" : implicatedDeclarers.size > 0 ? "write_roots" : "attributed_elsewhere",
5104
+ decisive: [...decisive].sort()
5105
+ };
5106
+ }
5107
+ function createBatchVerificationGate(options = {}) {
5108
+ const stateDir = options.stateDir ?? clioStateDir();
5109
+ const env = options.env ?? process.env;
5110
+ const liveMembers = /* @__PURE__ */ new Set();
5111
+ const parked = /* @__PURE__ */ new Map();
5112
+ let settling = false;
5113
+ const perRun = (participant) => runHostVerification({
5114
+ runId: participant.runId,
5115
+ request: participant.request,
5116
+ workerSuccessful: participant.workerSuccessful,
5117
+ stateDir,
5118
+ env,
5119
+ ...participant.onDiagnostic !== void 0 ? { onDiagnostic: participant.onDiagnostic } : {}
5120
+ });
5121
+ const nothingToRun = (participant) => {
5122
+ const checks = participant.request.resolvedVerification;
5123
+ if (checks === void 0 || checks.length === 0) return void 0;
5124
+ return { status: "skipped", reason: "worker_not_successful", checks: [] };
5125
+ };
5126
+ async function settleBatch(wave) {
5127
+ const members = wave.map((entry) => entry.participant);
5128
+ const contributors = members.filter(
5129
+ (member) => member.workerSuccessful && (member.request.resolvedVerification?.length ?? 0) > 0
5130
+ );
5131
+ const distinct = /* @__PURE__ */ new Map();
5132
+ for (const member of contributors) {
5133
+ for (const resolvedCheck of member.request.resolvedVerification ?? []) {
5134
+ const key = checkDedupeKey(resolvedCheck);
5135
+ if (!distinct.has(key)) distinct.set(key, { resolvedCheck, owner: member, index: distinct.size });
5136
+ }
5137
+ }
5138
+ const ran = /* @__PURE__ */ new Map();
5139
+ for (const [key, entry] of distinct) {
5140
+ const outcome = await runResolvedCheck({
5141
+ runId: entry.owner.runId,
5142
+ index: entry.index,
5143
+ resolvedCheck: entry.resolvedCheck,
5144
+ stateDir,
5145
+ env,
5146
+ // The owning member's callback, because the artifact directory is
5147
+ // named for that same run and the diagnostic text is closed over the
5148
+ // run id it was built for (`extension.ts:5534`); any other member's
5149
+ // callback would name a run whose artifacts the failure is not under.
5150
+ ...entry.owner.onDiagnostic !== void 0 ? { onDiagnostic: entry.owner.onDiagnostic } : {}
5151
+ });
5152
+ ran.set(key, { check: outcome.check, owner: entry.owner.runId, outputExcerpt: outcome.outputExcerpt });
5153
+ }
5154
+ const attribution = [];
5155
+ const chargedByKey = /* @__PURE__ */ new Map();
5156
+ for (const [key, entry] of ran) {
5157
+ if (entry.check.exitCode === 0) continue;
5158
+ const declarers = contributors.filter(
5159
+ (member) => (member.request.resolvedVerification ?? []).some((candidate) => checkDedupeKey(candidate) === key)
5160
+ );
5161
+ const implicated = implicatedPaths(entry.outputExcerpt, entry.check.cwd);
5162
+ const verdict = attributeFailure({ implicated, declarers, wave: members });
5163
+ chargedByKey.set(key, verdict.charged);
5164
+ const decisive = new Set(verdict.decisive);
5165
+ attribution.push({
5166
+ check: entry.check.check,
5167
+ // The paths that decided the charge lead the capped list. A large
5168
+ // suite names more than 32 files and the sealed evidence has to
5169
+ // contain the path a receipt was charged on, or it documents nothing.
5170
+ implicated: [...verdict.decisive, ...implicated.filter((path2) => !decisive.has(path2))].slice(
5171
+ 0,
5172
+ IMPLICATED_PATH_CAP
5173
+ ),
5174
+ charged: [...verdict.charged].sort(),
5175
+ basis: verdict.basis
5176
+ });
5177
+ }
5178
+ attribution.sort((first, second) => first.check < second.check ? -1 : first.check > second.check ? 1 : 0);
5179
+ for (const entry of wave) {
5180
+ const member = entry.participant;
5181
+ if (!contributors.includes(member)) {
5182
+ entry.settle(nothingToRun(member));
5183
+ continue;
4965
5184
  }
5185
+ const own = [];
5186
+ let rejected = false;
5187
+ let unimplicated = false;
5188
+ for (const resolvedCheck of member.request.resolvedVerification ?? []) {
5189
+ const key = checkDedupeKey(resolvedCheck);
5190
+ const shared = ran.get(key);
5191
+ if (shared === void 0) continue;
5192
+ own.push(
5193
+ shared.owner === member.runId || shared.check.evidenceRunId !== void 0 ? { ...shared.check, argv: [...shared.check.argv] } : { ...shared.check, argv: [...shared.check.argv], evidenceRunId: shared.owner }
5194
+ );
5195
+ if (shared.check.exitCode === 0) continue;
5196
+ if (chargedByKey.get(key)?.has(member.runId) === true) rejected = true;
5197
+ else unimplicated = true;
5198
+ }
5199
+ entry.settle({
5200
+ // `verified` states that every declared check passed, which is what
5201
+ // `trust-status.ts:619` certifies and what the board and
5202
+ // `worker-evidence.ts:161` print. An exculpated member's checks array
5203
+ // still carries a non-zero exit code, so it seals its own status
5204
+ // instead of borrowing that claim.
5205
+ status: rejected ? "rejected" : unimplicated ? "not_implicated" : "verified",
5206
+ ...!rejected && unimplicated ? { reason: "batch_settled_not_implicated" } : {},
5207
+ checks: own,
5208
+ strategy: "batch-settled",
5209
+ // Copied per receipt so no two members of the batch share a mutable array.
5210
+ ...attribution.length > 0 ? {
5211
+ attribution: attribution.map((record) => ({
5212
+ ...record,
5213
+ implicated: [...record.implicated],
5214
+ charged: [...record.charged]
5215
+ }))
5216
+ } : {}
5217
+ });
5218
+ }
5219
+ }
5220
+ function maybeSettle() {
5221
+ if (settling || parked.size === 0) return;
5222
+ for (const runId of liveMembers) {
5223
+ if (!parked.has(runId)) return;
4966
5224
  }
5225
+ settling = true;
5226
+ const wave = [...parked.values()];
5227
+ for (const runId of parked.keys()) liveMembers.delete(runId);
5228
+ parked.clear();
5229
+ void settleBatch(wave).catch(async (error) => {
5230
+ for (const entry of wave) {
5231
+ entry.participant.onDiagnostic?.(error);
5232
+ try {
5233
+ entry.settle(await perRun(entry.participant));
5234
+ } catch (fallbackError) {
5235
+ entry.fail(fallbackError);
5236
+ }
5237
+ }
5238
+ }).finally(() => {
5239
+ settling = false;
5240
+ maybeSettle();
5241
+ });
4967
5242
  }
4968
5243
  return {
4969
- status: results.every((check) => check.exitCode === 0) ? "verified" : "rejected",
4970
- checks: results
5244
+ live(runId) {
5245
+ liveMembers.add(runId);
5246
+ },
5247
+ abandon(runId) {
5248
+ if (parked.has(runId) || !liveMembers.delete(runId)) return;
5249
+ maybeSettle();
5250
+ },
5251
+ arrive(input) {
5252
+ liveMembers.add(input.runId);
5253
+ const parkedPromise = new Promise((settle, fail) => {
5254
+ parked.set(input.runId, { participant: input, settle, fail });
5255
+ });
5256
+ maybeSettle();
5257
+ return parkedPromise;
5258
+ }
4971
5259
  };
4972
5260
  }
4973
5261
 
@@ -6278,6 +6566,11 @@ function receiptResponseModelIdObservationLabel(receipt) {
6278
6566
  });
6279
6567
  return `response_model_id_observation=${labels.join(",")}`;
6280
6568
  }
6569
+ function receiptGatewayRoutingLabel(receipt) {
6570
+ const observations = (receipt.upstreamResponses ?? []).map((response) => gatewayRoutingObservationFromRecord(response)).filter((observation) => observation !== null);
6571
+ if (observations.length === 0) return null;
6572
+ return observations.map(gatewayRoutingObservationLabel).join(" | ");
6573
+ }
6281
6574
 
6282
6575
  // src/tools/dispatch-run-events.ts
6283
6576
  var RUN_TAIL_ENTRY_LIMIT = 100;
@@ -6974,6 +7267,36 @@ function describeUngroundedValidations(grounding) {
6974
7267
  return grounding.basis === "no-command-executed" ? `unverifiable validation: this run claimed ${named} passed and executed no command at all (${grounding.grounded}/${grounding.claimed} claims grounded)` : `unmatched validation: this run claimed ${named} passed; it did run commands, but none the harness recognizes as that check (${grounding.grounded}/${grounding.claimed} claims grounded)`;
6975
7268
  }
6976
7269
 
7270
+ // src/domains/dispatch/worker-model-metadata.ts
7271
+ init_esm_shims();
7272
+ async function prepareWorkerModelMetadata(providers, targetId, deadlineAt, signal, now = Date.now) {
7273
+ signal?.throwIfAborted();
7274
+ const status = providers.list().find((entry) => entry.target.id === targetId);
7275
+ if (status?.target.runtime !== "litellm" || status.health.lastCheckAt !== null) return;
7276
+ const remainingMs = deadlineAt - now();
7277
+ const deadlineError = new Error("dispatch: admission deadline expired during worker model metadata preparation");
7278
+ if (remainingMs <= 0) throw deadlineError;
7279
+ const controller = new AbortController();
7280
+ const abort = () => controller.abort(signal?.reason);
7281
+ signal?.addEventListener("abort", abort, { once: true });
7282
+ const timer = setTimeout(() => controller.abort(deadlineError), Math.min(remainingMs, 2147483647));
7283
+ let rejectAborted;
7284
+ const aborted = new Promise((_resolve, reject) => {
7285
+ rejectAborted = reject;
7286
+ });
7287
+ const onAbort = () => rejectAborted(controller.signal.reason);
7288
+ controller.signal.addEventListener("abort", onAbort, { once: true });
7289
+ try {
7290
+ await Promise.race([providers.probeTarget(targetId, { reasoning: false, signal: controller.signal }), aborted]);
7291
+ controller.signal.throwIfAborted();
7292
+ if (now() >= deadlineAt) throw deadlineError;
7293
+ } finally {
7294
+ clearTimeout(timer);
7295
+ signal?.removeEventListener("abort", abort);
7296
+ controller.signal.removeEventListener("abort", onAbort);
7297
+ }
7298
+ }
7299
+
6977
7300
  // src/domains/dispatch/extension.ts
6978
7301
  var DEFAULT_HEARTBEAT_INTERVAL_MS = 1e3;
6979
7302
  var DEFAULT_RESILIENCE_COOLDOWN_MS = 15e3;
@@ -7499,6 +7822,13 @@ function runtimeLimitations(runtimeKind, runtimeId) {
7499
7822
  "Claude CLI subprocess executes Claude Code tools; Clio constrains permission mode and forbids dangerous bypass unless explicitly gated"
7500
7823
  ];
7501
7824
  }
7825
+ if (runtimeKind === "subprocess" && runtimeId === "antigravity-code") {
7826
+ return [
7827
+ "Antigravity CLI owns its internal tools, network activity, prompts, and approvals; Clio observes only structured stream output and does not provide per-tool mediation or complete tool telemetry",
7828
+ "Antigravity conversation ids are recorded only as opaque provider observations; Clio does not resume them",
7829
+ "Antigravity runs are one-shot and never retried automatically"
7830
+ ];
7831
+ }
7502
7832
  return [];
7503
7833
  }
7504
7834
  function assertRuntimeCanHonorWorkerPermissionMode(runtime, onPermission) {
@@ -7521,12 +7851,6 @@ function assertWriteRootsEnforceable(runtime, writeRoots) {
7521
7851
  `dispatch: runtime '${runtime.id}' cannot enforce writeRoots: subprocess workers run their own tool surface without Clio per-tool mediation. Dispatch to a native or claude-sdk worker.`
7522
7852
  );
7523
7853
  }
7524
- function assertWorkerBudgetEnforceable(runtime, hasDeclaredBudget) {
7525
- if (!hasDeclaredBudget || runtime.kind !== "subprocess") return;
7526
- throw new Error(
7527
- `dispatch: runtime '${runtime.id}' cannot enforce an explicit dispatch budget because subprocess workers do not expose per-tool mediation; choose a native or claude-sdk worker`
7528
- );
7529
- }
7530
7854
  var TOOL_CARRYING_API_FAMILIES = /* @__PURE__ */ new Set([
7531
7855
  "openai-completions",
7532
7856
  "openai-responses",
@@ -7575,11 +7899,19 @@ function assertPostRuntimeToolCompatibility(agentId, spec, effectiveTools, targe
7575
7899
  );
7576
7900
  }
7577
7901
  function workerToolCallHardCap(settings) {
7578
- const rawEnvCap = process.env.CLIO_CODER_WORKER_TOOL_CALL_CAP?.trim();
7579
- const parsedEnvCap = rawEnvCap && /^[1-9]\d*$/.test(rawEnvCap) ? Number(rawEnvCap) : Number.NaN;
7580
- return Number.isSafeInteger(parsedEnvCap) ? parsedEnvCap : settings?.fleet.limits.toolCallsPerRun ?? GUARDRAIL_DEFAULTS.workerToolCallCap;
7902
+ return settings?.fleet.limits.toolCallsPerRun ?? GUARDRAIL_DEFAULTS.workerToolCallCap;
7903
+ }
7904
+ function assertWorkerBudgetEnforceable(runtime, hasDeclaredBudget) {
7905
+ if (!hasDeclaredBudget || runtime.kind !== "subprocess" || runtime.externalAgentLoop !== void 0) return;
7906
+ throw new Error(
7907
+ `dispatch: runtime '${runtime.id}' cannot enforce an explicit dispatch budget because subprocess workers do not expose per-tool mediation; choose a native or claude-sdk worker`
7908
+ );
7909
+ }
7910
+ function budgetEnforcementForRuntime(runtime) {
7911
+ return runtime.kind === "subprocess" ? "external-one-shot" : "native-per-tool";
7581
7912
  }
7582
7913
  function resolveEffectiveWorkerBudget(input) {
7914
+ assertWorkerBudgetEnforceable(input.runtime, input.declared !== null || input.req.budget !== void 0);
7583
7915
  const hardCap = workerToolCallHardCap(input.settings);
7584
7916
  const declared = input.declared ?? {
7585
7917
  toolCalls: hardCap,
@@ -7593,7 +7925,8 @@ function resolveEffectiveWorkerBudget(input) {
7593
7925
  hardCap,
7594
7926
  hasReadTool: input.allowedTools.includes(ToolNames.Read),
7595
7927
  retry: (input.req.lineage?.attempt ?? 0) > 0,
7596
- revision: input.req.gate?.role === "builder" && input.req.gate.cycle > 1 && input.req.gate.verdict === "revise"
7928
+ revision: input.req.gate?.role === "builder" && input.req.gate.cycle > 1 && input.req.gate.verdict === "revise",
7929
+ enforcement: budgetEnforcementForRuntime(input.runtime)
7597
7930
  });
7598
7931
  }
7599
7932
  function frozenProtectedArtifactState(state) {
@@ -7851,6 +8184,9 @@ function clampWorkerAutonomy(session, requested) {
7851
8184
  if (requested === void 0) return session;
7852
8185
  return AUTONOMY_ORDER[requested] < AUTONOMY_ORDER[session] ? requested : session;
7853
8186
  }
8187
+ function effectiveWorkerAutonomy(session, requested, capabilityClass) {
8188
+ return clampWorkerAutonomy(session, capabilityClass === "read-only" ? "read-only" : requested);
8189
+ }
7854
8190
  function requestedAutonomyEvidence(sessionAutonomy, requestedAutonomy) {
7855
8191
  return requestedAutonomy === void 0 ? {} : { requestedAutonomy, sessionAutonomy };
7856
8192
  }
@@ -8267,6 +8603,17 @@ function createDispatchBundle(context, options) {
8267
8603
  function configuredEndpointLimits() {
8268
8604
  return Object.fromEntries(Object.entries(configuredEndpointCapacities()).map(([key, value]) => [key, value.limit]));
8269
8605
  }
8606
+ const probedDefaultBoundEndpoints = /* @__PURE__ */ new Set();
8607
+ function probeEndpointsAtDefaultBound() {
8608
+ const capacities = configuredEndpointCapacities();
8609
+ for (const target of getEffectiveSettings()?.targets ?? []) {
8610
+ const key = canonicalEndpointKey(target);
8611
+ if (key === null || capacities[key]?.source !== "local-native-default") continue;
8612
+ if (probedDefaultBoundEndpoints.has(key)) continue;
8613
+ probedDefaultBoundEndpoints.add(key);
8614
+ void providers.probeTarget(target.id, { reasoning: false }).catch(() => void 0);
8615
+ }
8616
+ }
8270
8617
  function endpointCapacityForTarget(targetId) {
8271
8618
  const status = providers.list().find((entry) => entry.target.id === targetId);
8272
8619
  const target = status?.target ?? providers.getTarget(targetId);
@@ -8364,7 +8711,7 @@ function createDispatchBundle(context, options) {
8364
8711
  reason: outcome
8365
8712
  });
8366
8713
  }
8367
- async function admitAssignmentCapacity(req, nodeId, timing, endpoint) {
8714
+ async function admitAssignmentCapacity(req, nodeId, timing, endpoint, signal) {
8368
8715
  const queuedAt = now();
8369
8716
  timing.queuedAt = new Date(queuedAt).toISOString();
8370
8717
  const assignmentId = req.lineage?.rootRunId ?? req.runIdHint ?? `pending-${queuedAt.toString(36)}-${randomBytes5(6).toString("hex")}`;
@@ -8376,7 +8723,12 @@ function createDispatchBundle(context, options) {
8376
8723
  req.reservation.memberId,
8377
8724
  (error) => reportDispatchDiagnostic("read plan queue identity", error)
8378
8725
  );
8726
+ const cancel = () => {
8727
+ capacityAdmission.cancel(assignmentId);
8728
+ };
8729
+ signal?.addEventListener("abort", cancel, { once: true });
8379
8730
  try {
8731
+ signal?.throwIfAborted();
8380
8732
  const admitted = await capacityAdmission.admit({
8381
8733
  assignmentId,
8382
8734
  nodeId,
@@ -8397,6 +8749,8 @@ function createDispatchBundle(context, options) {
8397
8749
  else await failQueuedAssignment(assignmentId);
8398
8750
  }
8399
8751
  throw error;
8752
+ } finally {
8753
+ signal?.removeEventListener("abort", cancel);
8400
8754
  }
8401
8755
  }
8402
8756
  function rebindReservationSlot(req, nodeId, endpoint, costUsd, settings) {
@@ -8489,6 +8843,13 @@ function createDispatchBundle(context, options) {
8489
8843
  if (draining) return { scheduled: false };
8490
8844
  const rootRunId = run.lineage.rootRunId;
8491
8845
  if (!retryChainIsLive(run)) return { scheduled: false };
8846
+ if (providers.getRuntime(run.runtimeId)?.externalAgentLoop?.generatingRetry === "forbidden") {
8847
+ retryBackoff.delete(rootRunId);
8848
+ return {
8849
+ scheduled: false,
8850
+ settlementDetail: "automatic retry suppressed because this external agent loop is one-shot and Clio cannot prove replay is side-effect-free"
8851
+ };
8852
+ }
8492
8853
  if (!RETRYABLE_OUTCOMES.has(outcome)) {
8493
8854
  retryBackoff.delete(rootRunId);
8494
8855
  return { scheduled: false };
@@ -8783,6 +9144,7 @@ function createDispatchBundle(context, options) {
8783
9144
  const tickMonotonic = monotonicNow();
8784
9145
  for (const run of active.values()) {
8785
9146
  if (run.aborted || run.stallKilled || !run.heartbeatAt) continue;
9147
+ if (ledger.get(run.runId)?.endedAt !== null) continue;
8786
9148
  const heartbeatMonotonic = heartbeatMonotonicAt(run.heartbeatAt);
8787
9149
  if (!Number.isFinite(heartbeatMonotonic) || !Number.isFinite(run.heartbeatAt.current)) continue;
8788
9150
  if (run.runtimeKind === "acp-delegation") {
@@ -8920,8 +9282,19 @@ function createDispatchBundle(context, options) {
8920
9282
  agentId: req.agentId
8921
9283
  });
8922
9284
  }
9285
+ const parentTokenDiagnostic = inferredScopeParentTokenDiagnostic(pathScope);
9286
+ if (parentTokenDiagnostic !== null) {
9287
+ reportDispatchDiagnostic("inferred scope parent tokens", new Error(parentTokenDiagnostic));
9288
+ }
9289
+ const parentTokenNotice = inferredScopeParentTokenNotice(pathScope);
9290
+ if (parentTokenNotice !== null) {
9291
+ context.bus.emit(BusChannels.DispatchScopeNotice, {
9292
+ ...parentTokenNotice,
9293
+ agentId: req.agentId
9294
+ });
9295
+ }
8923
9296
  }
8924
- async function resolveLifecycle(req, settings) {
9297
+ async function resolveLifecycle(req, settings, metadataDeadlineAt, signal) {
8925
9298
  const recipe = agents.get(req.agentId);
8926
9299
  if (!recipe) {
8927
9300
  throw new Error(`dispatch: unknown agent recipe: ${req.agentId}`);
@@ -8941,14 +9314,15 @@ function createDispatchBundle(context, options) {
8941
9314
  task: req.task,
8942
9315
  autoSelected: req.agentSelection?.mode === "auto",
8943
9316
  resultContractKind: spec.resultContract.kind,
8944
- specs: agents.listSpecs()
9317
+ specs: agents.listSpecs(),
9318
+ intent: req.intent ?? null
8945
9319
  });
8946
9320
  if (capabilityMismatch?.verdict === "refuse") throw new Error(capabilityMismatch.detail);
8947
9321
  const pathScope = resolveDispatchPathScope(req);
8948
9322
  publishDispatchPathScope(req, pathScope);
8949
9323
  const admission = resolveDispatchAdmissionStage(req, recipe, safety, pathScope);
8950
9324
  const targets = readWorkerTargets(settings);
8951
- const target = resolveDispatchTarget(
9325
+ const resolveTarget = () => resolveDispatchTarget(
8952
9326
  req,
8953
9327
  recipe,
8954
9328
  targets.workerDefault,
@@ -8957,12 +9331,24 @@ function createDispatchBundle(context, options) {
8957
9331
  targets.targetOrder,
8958
9332
  providers
8959
9333
  );
9334
+ let target = resolveTarget();
9335
+ const identity = (resolved) => JSON.stringify([
9336
+ resolved.target.id,
9337
+ resolved.runtime.id,
9338
+ resolved.wireModelId,
9339
+ endpointIdentityHash(resolved.target.url)
9340
+ ]);
9341
+ const selectedIdentity = identity(target);
9342
+ await prepareWorkerModelMetadata(providers, target.target.id, metadataDeadlineAt, signal, now);
9343
+ target = resolveTarget();
9344
+ if (identity(target) !== selectedIdentity) {
9345
+ throw new Error("dispatch: worker route changed during model metadata preparation; request a fresh admission");
9346
+ }
8960
9347
  enforceCapabilityGate(target.target.id, target.modelCapabilities, req.requiredCapabilities);
8961
9348
  assertRuntimeCanHonorWorkerPermissionMode(target.runtime, settings?.fleet.permissions.mode ?? "deny");
8962
- assertWorkerBudgetEnforceable(target.runtime, spec.budget !== null || req.budget !== void 0);
8963
9349
  const cwd = req.cwd ?? process.cwd();
8964
9350
  const sessionAutonomy = settings?.safety.autonomy ?? "auto-edit";
8965
- const effectiveAutonomy = clampWorkerAutonomy(sessionAutonomy, req.autonomy);
9351
+ const effectiveAutonomy = effectiveWorkerAutonomy(sessionAutonomy, req.autonomy, spec.capabilityClass);
8966
9352
  const effectiveTools = withLedgerToolNarrowing(
8967
9353
  effectiveToolNames(admission.allowedTools, target, pathScope.writeBoundaries.length > 0, deniedToolNames(req)),
8968
9354
  req
@@ -8973,13 +9359,15 @@ function createDispatchBundle(context, options) {
8973
9359
  allowedTools: effectiveTools
8974
9360
  };
8975
9361
  const personaBody = workerPersonaBody(req, recipe, effectiveTools);
9362
+ const hasCanonicalContext = effectiveTools.includes(ToolNames.Context);
9363
+ const hasBoundSkills = hasCanonicalContext && recipe.skills !== void 0 && recipe.skills.length > 0 && req.noSkills !== true;
8976
9364
  const compiledWorkerPrompt = await prompts.compileWorkerPrompt({
8977
9365
  autonomy: effectiveAutonomy,
8978
9366
  providerSupportsTools: target.runtime.kind === "subprocess" ? null : targetToolCapability(target),
8979
9367
  toolNames: effectiveTools,
8980
- toolPromptHints: toolPromptHintsForNames(effectiveTools),
8981
- hasCanonicalContext: effectiveTools.includes(ToolNames.Context),
8982
- hasBoundSkills: effectiveTools.includes(ToolNames.Context) && recipe.skills !== void 0 && recipe.skills.length > 0 && req.noSkills !== true,
9368
+ toolPromptHints: toolPromptHintsForNames(effectiveTools, hasBoundSkills ? "bound-worker" : "worker"),
9369
+ hasCanonicalContext,
9370
+ hasBoundSkills,
8983
9371
  onPermission: settings?.fleet.permissions.mode ?? "deny",
8984
9372
  persona: {
8985
9373
  id: `persona.${recipe.id}`,
@@ -8997,7 +9385,8 @@ function createDispatchBundle(context, options) {
8997
9385
  recipeId: recipe.id,
8998
9386
  declared: spec.budget,
8999
9387
  allowedTools: effectiveTools,
9000
- settings
9388
+ settings,
9389
+ runtime: target.runtime
9001
9390
  });
9002
9391
  const tier = spec.projectContextTier;
9003
9392
  const project = projectContext && tier === "bounded" ? projectContext.projectStructuredContext(cwd) : null;
@@ -9247,11 +9636,13 @@ function createDispatchBundle(context, options) {
9247
9636
  const responseModelIdObservation = responseModelIdObservationFromRecord(event.message, "not-observed");
9248
9637
  const differingResponseModelId = readStringOrNull(event.message.responseModel);
9249
9638
  const providerResponseId = readStringOrNull(event.message.responseId);
9639
+ const gatewayRouting = gatewayRoutingObservationFromRecord(event.message);
9250
9640
  upstreamResponses.push({
9251
9641
  requestedModelId,
9252
9642
  responseModelIdObservation,
9253
9643
  differingResponseModelId,
9254
- providerResponseId
9644
+ providerResponseId,
9645
+ ...gatewayRouting !== null ? { gatewayRouting } : {}
9255
9646
  });
9256
9647
  if (event.message.stopReason === "error") {
9257
9648
  const message = readStringOrNull(event.message.errorMessage);
@@ -9757,7 +10148,7 @@ function createDispatchBundle(context, options) {
9757
10148
  finalPromise
9758
10149
  };
9759
10150
  }
9760
- async function dispatchAttempt(req, observer) {
10151
+ async function dispatchAttempt(req, observer, preparation, settlement) {
9761
10152
  const requestedAt = new Date(now()).toISOString();
9762
10153
  const timing = { requestedAt, decisionStartedAt: requestedAt };
9763
10154
  const settings = getEffectiveSettings();
@@ -9838,13 +10229,14 @@ function createDispatchBundle(context, options) {
9838
10229
  }
9839
10230
  rebindReservationSlot(req, "local", null, UNKNOWN_PRICING_ADMISSION_ESTIMATE_USD, settings);
9840
10231
  routeObservation = observeShadowRoute(req, void 0, settings);
9841
- return attachRouteObservation({
9842
- ...await dispatchAcpDelegation(req, settings, timing, routeObservation.decision, observer),
9843
- effectiveRequest: req
9844
- });
10232
+ const delegated = await dispatchAcpDelegation(req, settings, timing, routeObservation.decision, observer);
10233
+ settlement?.live(delegated.runId);
10234
+ return attachRouteObservation({ ...delegated, effectiveRequest: req });
9845
10235
  }
9846
10236
  req = routeAroundCoolingTarget(req, settings) ?? req;
9847
- const lifecycle = await resolveLifecycle(req, settings);
10237
+ const metadataDeadlineAt = req.assignmentDeadlineAt ?? Date.parse(requestedAt) + (req.routingIntent?.deadlineMs ?? 6e4);
10238
+ const lifecycle = await resolveLifecycle(req, settings, metadataDeadlineAt, preparation?.signal);
10239
+ preparation?.signal?.throwIfAborted();
9848
10240
  timing.decisionCompletedAt = new Date(now()).toISOString();
9849
10241
  assertResponseSchemaEnforceable(
9850
10242
  lifecycle.target.runtime,
@@ -9911,7 +10303,13 @@ function createDispatchBundle(context, options) {
9911
10303
  if (queuedIdentity !== null) publishCapacityQueued(queuedIdentity, timing, placement?.node ?? null);
9912
10304
  let capacityLease;
9913
10305
  try {
9914
- capacityLease = await admitAssignmentCapacity(req, placement?.node.id ?? "local", timing, endpoint);
10306
+ capacityLease = await admitAssignmentCapacity(
10307
+ req,
10308
+ placement?.node.id ?? "local",
10309
+ timing,
10310
+ endpoint,
10311
+ preparation?.signal
10312
+ );
9915
10313
  } catch (error) {
9916
10314
  if (queuedIdentity !== null) publishCapacityAdmissionFailure(queuedIdentity, error);
9917
10315
  throw error;
@@ -9921,6 +10319,7 @@ function createDispatchBundle(context, options) {
9921
10319
  const leaseSlot = createLeaseSlotGuard(capacityAdmission, capacityLease.leaseId, req.lineage !== void 0);
9922
10320
  const ledgerRef = (() => {
9923
10321
  try {
10322
+ preparation?.signal?.throwIfAborted();
9924
10323
  return requireLedger();
9925
10324
  } catch (error) {
9926
10325
  leaseSlot.release();
@@ -9973,6 +10372,7 @@ function createDispatchBundle(context, options) {
9973
10372
  };
9974
10373
  let worker;
9975
10374
  try {
10375
+ preparation?.signal?.throwIfAborted();
9976
10376
  worker = (placement?.spawn ?? spawnWorker)(spec, {
9977
10377
  cwd: lifecycle.cwd,
9978
10378
  now,
@@ -10130,11 +10530,13 @@ function createDispatchBundle(context, options) {
10130
10530
  const responseModelIdObservation = responseModelIdObservationFromRecord(event.message, "not-observed");
10131
10531
  const differingResponseModelId = readStringOrNull(event.message.responseModel);
10132
10532
  const providerResponseId = readStringOrNull(event.message.responseId);
10533
+ const gatewayRouting = gatewayRoutingObservationFromRecord(event.message);
10133
10534
  upstreamResponses.push({
10134
10535
  requestedModelId,
10135
10536
  responseModelIdObservation,
10136
10537
  differingResponseModelId,
10137
- providerResponseId
10538
+ providerResponseId,
10539
+ ...gatewayRouting !== null ? { gatewayRouting } : {}
10138
10540
  });
10139
10541
  if (event.message.stopReason === "error") {
10140
10542
  const message = readStringOrNull(event.message.errorMessage);
@@ -10590,6 +10992,7 @@ function createDispatchBundle(context, options) {
10590
10992
  }
10591
10993
  return { assessment, rigor };
10592
10994
  };
10995
+ settlement?.live(envelope.id);
10593
10996
  const finalPromise = (async () => {
10594
10997
  try {
10595
10998
  const result = await workerDone;
@@ -10652,7 +11055,7 @@ function createDispatchBundle(context, options) {
10652
11055
  reachedTerminalResult: resultContractWasDue(finalOutcome, outcomeCode),
10653
11056
  output: capturedOutput?.state === "final" ? capturedOutput.text : null,
10654
11057
  cwd: lifecycle.cwd,
10655
- networkAllowed: lifecycle.admission.allowedTools.includes(ToolNames.WebFetch),
11058
+ networkAllowed: lifecycle.admission.allowedTools.includes(ToolNames.WebFetch) || lifecycle.target.runtime.externalAgentLoop?.network === "externally-governed-unobserved",
10656
11059
  observedRunEffects,
10657
11060
  filesystem: nodeResultContractFilesystem()
10658
11061
  });
@@ -10686,12 +11089,13 @@ function createDispatchBundle(context, options) {
10686
11089
  finalDetail = WORKER_FINAL_OUTPUT_MISSING_DETAIL;
10687
11090
  failureMessage = finalDetail;
10688
11091
  }
10689
- const hostVerification = await runHostVerification({
11092
+ const hostVerificationInput = {
10690
11093
  runId: envelope.id,
10691
11094
  request: req,
10692
11095
  workerSuccessful: finalOutcome === "succeeded",
10693
11096
  onDiagnostic: (error) => reportDispatchDiagnostic(`write host verification memo for ${envelope.id}`, error)
10694
- });
11097
+ };
11098
+ const hostVerification = settlement === void 0 ? await runHostVerification(hostVerificationInput) : await settlement.arrive(hostVerificationInput);
10695
11099
  const hostRejection = hostVerificationRejection(hostVerification);
10696
11100
  if (hostRejection !== null && finalOutcome === "succeeded") {
10697
11101
  finalOutcome = "failed";
@@ -10854,8 +11258,11 @@ function createDispatchBundle(context, options) {
10854
11258
  effectiveRequest: req
10855
11259
  });
10856
11260
  }
10857
- async function dispatch(req, observer) {
10858
- let prepared = req;
11261
+ async function dispatch(req, observer, preparation, settlement) {
11262
+ let prepared = preparation?.deadlineAt === void 0 ? req : {
11263
+ ...req,
11264
+ assignmentDeadlineAt: Math.min(req.assignmentDeadlineAt ?? Number.POSITIVE_INFINITY, preparation.deadlineAt)
11265
+ };
10859
11266
  let createdWorktree;
10860
11267
  let writerLease;
10861
11268
  const writerRecipe = agents.get(req.agentId);
@@ -10887,7 +11294,7 @@ function createDispatchBundle(context, options) {
10887
11294
  return rel === ".." || rel.startsWith(`..${sep}`) || isAbsolute2(rel) ? entry : resolvePath(taskWorktree.path, rel);
10888
11295
  });
10889
11296
  prepared = {
10890
- ...req,
11297
+ ...prepared,
10891
11298
  runIdHint: runId,
10892
11299
  taskWorktree,
10893
11300
  cwd: workerCwd,
@@ -10897,7 +11304,8 @@ function createDispatchBundle(context, options) {
10897
11304
  }
10898
11305
  let handle;
10899
11306
  try {
10900
- handle = await dispatchAttempt(prepared, observer);
11307
+ preparation?.signal?.throwIfAborted();
11308
+ handle = await dispatchAttempt(prepared, observer, preparation, settlement);
10901
11309
  } catch (error) {
10902
11310
  writerLease?.release();
10903
11311
  if (createdWorktree !== void 0) {
@@ -10912,6 +11320,10 @@ function createDispatchBundle(context, options) {
10912
11320
  }
10913
11321
  throw error;
10914
11322
  }
11323
+ if (settlement !== void 0) {
11324
+ const release = () => settlement.abandon(handle.runId);
11325
+ handle.finalPromise.then(release, release);
11326
+ }
10915
11327
  if (req.lineage) return { ...handle, finalPromise: handle.finalPromise.finally(() => writerLease?.release()) };
10916
11328
  const assignment = assignments.open(handle.runId, assignmentPolicyFor(handle.effectiveRequest));
10917
11329
  persistAssignment(registerAssignment(assignment.id), `${assignment.id}:open`);
@@ -10999,7 +11411,6 @@ function createDispatchBundle(context, options) {
10999
11411
  );
11000
11412
  assertPostRuntimeToolCompatibility(req.agentId, agentSpec, effectiveTools, target);
11001
11413
  assertRuntimeCanHonorWorkerPermissionMode(target.runtime, settings?.fleet.permissions.mode ?? "deny");
11002
- assertWorkerBudgetEnforceable(target.runtime, agentSpec.budget !== null || req.budget !== void 0);
11003
11414
  assertResponseSchemaEnforceable(target.runtime, target.modelCapabilities, req.responseSchema, effectiveTools.length);
11004
11415
  assertWriteRootsEnforceable(target.runtime, pathScope.writeBoundaries);
11005
11416
  assertProtectedArtifactsEnforceable(
@@ -11012,7 +11423,8 @@ function createDispatchBundle(context, options) {
11012
11423
  recipeId: recipe.id,
11013
11424
  declared: agentSpec.budget,
11014
11425
  allowedTools: effectiveTools,
11015
- settings
11426
+ settings,
11427
+ runtime: target.runtime
11016
11428
  });
11017
11429
  const endpoint = endpointCapacityForTarget(target.target.id);
11018
11430
  return {
@@ -11215,12 +11627,13 @@ function createDispatchBundle(context, options) {
11215
11627
  yield { type: "batch_events_drained", batch: snapshotBatch(batchRef.current) };
11216
11628
  })();
11217
11629
  }
11218
- async function dispatchBatch(reqs) {
11630
+ async function dispatchBatch(reqs, preparation) {
11219
11631
  if (reqs.length === 0) throw new Error("dispatch: batch requires at least one request");
11632
+ const settlement = reqs.length > 1 && reqs.some((req) => (req.resolvedVerification?.length ?? 0) > 0) ? createBatchVerificationGate() : void 0;
11220
11633
  const handles = [];
11221
11634
  try {
11222
11635
  for (const req of reqs) {
11223
- const handle = await dispatch(req);
11636
+ const handle = await dispatch(req, void 0, preparation, settlement);
11224
11637
  handles.push({ ...handle, agentId: req.agentId });
11225
11638
  }
11226
11639
  } catch (err) {
@@ -11407,6 +11820,7 @@ function createDispatchBundle(context, options) {
11407
11820
  } catch {
11408
11821
  }
11409
11822
  startHeartbeatWatchdog();
11823
+ probeEndpointsAtDefaultBound();
11410
11824
  },
11411
11825
  async stop() {
11412
11826
  draining = true;
@@ -11733,22 +12147,6 @@ var DispatchManifest = {
11733
12147
  dependsOn: ["config", "safety", "agents", "providers", "middleware", "prompts", "scheduling"]
11734
12148
  };
11735
12149
 
11736
- // src/domains/dispatch/code-step-store.ts
11737
- init_esm_shims();
11738
- import { join as join13 } from "node:path";
11739
- function codeStepDir(rootId) {
11740
- return join13(clioStateDir(), "code-steps", rootId);
11741
- }
11742
- function codeStepRecordPath(rootId, runId) {
11743
- return join13(codeStepDir(rootId), `${runId}.json`);
11744
- }
11745
- async function writeCodeStepRecord(rootId, record) {
11746
- const path2 = codeStepRecordPath(rootId, record.runId);
11747
- await atomicWrite(path2, `${JSON.stringify(record, null, 2)}
11748
- `);
11749
- return path2;
11750
- }
11751
-
11752
12150
  // src/domains/dispatch/delegation-plan.ts
11753
12151
  init_esm_shims();
11754
12152
  import { createHash as createHash8 } from "node:crypto";
@@ -12289,7 +12687,7 @@ function gateFailureLines(output) {
12289
12687
  init_esm_shims();
12290
12688
  import { createHash as createHash9 } from "node:crypto";
12291
12689
  import { readFileSync as readFileSync12 } from "node:fs";
12292
- import { join as join14 } from "node:path";
12690
+ import { join as join13 } from "node:path";
12293
12691
 
12294
12692
  // src/domains/observability/cost.ts
12295
12693
  init_esm_shims();
@@ -12573,7 +12971,7 @@ async function executeFleetRun(input) {
12573
12971
  for (const [stepId, replayedResult] of replayed) {
12574
12972
  try {
12575
12973
  const receipt = JSON.parse(
12576
- readFileSync12(join14(clioStateDir(), "receipts", `${replayedResult.terminalRunId}.json`), "utf8")
12974
+ readFileSync12(join13(clioStateDir(), "receipts", `${replayedResult.terminalRunId}.json`), "utf8")
12577
12975
  );
12578
12976
  receiptsByStep.set(stepId, receipt);
12579
12977
  } catch {
@@ -12760,7 +13158,7 @@ async function executeFleetRun(input) {
12760
13158
  if (step.gate !== void 0 && succeeded) {
12761
13159
  let gateBytes = "";
12762
13160
  try {
12763
- gateBytes = readFileSync12(join14(workspaceRoot, step.gate.path), "utf8");
13161
+ gateBytes = readFileSync12(join13(workspaceRoot, step.gate.path), "utf8");
12764
13162
  } catch {
12765
13163
  gateBytes = "";
12766
13164
  }
@@ -13329,7 +13727,7 @@ function latestGateDecisionForRun(decisions, runId) {
13329
13727
  // src/domains/evidence/store.ts
13330
13728
  init_esm_shims();
13331
13729
  import { readdir, readFile } from "node:fs/promises";
13332
- import { join as join15 } from "node:path";
13730
+ import { join as join14 } from "node:path";
13333
13731
  var EVIDENCE_FILES = [
13334
13732
  "overview.json",
13335
13733
  "transcript.md",
@@ -13345,11 +13743,11 @@ var EVIDENCE_FILES = [
13345
13743
  "findings.md"
13346
13744
  ];
13347
13745
  function evidenceRoot(dataDir) {
13348
- return join15(dataDir, "evidence");
13746
+ return join14(dataDir, "evidence");
13349
13747
  }
13350
13748
  function evidenceDirectory(dataDir, evidenceId) {
13351
13749
  assertSafeId(evidenceId, "evidence");
13352
- return join15(evidenceRoot(dataDir), evidenceId);
13750
+ return join14(evidenceRoot(dataDir), evidenceId);
13353
13751
  }
13354
13752
  var EvidenceNotFoundError = class extends Error {
13355
13753
  constructor(evidenceId) {
@@ -13365,7 +13763,7 @@ function isMissingFile(error) {
13365
13763
  async function loadEvidenceOverview(dataDir, evidenceId) {
13366
13764
  let raw;
13367
13765
  try {
13368
- raw = await readFile(join15(evidenceDirectory(dataDir, evidenceId), "overview.json"), "utf8");
13766
+ raw = await readFile(join14(evidenceDirectory(dataDir, evidenceId), "overview.json"), "utf8");
13369
13767
  } catch (error) {
13370
13768
  if (isMissingFile(error)) throw new EvidenceNotFoundError(evidenceId);
13371
13769
  throw error;
@@ -13377,7 +13775,7 @@ async function inspectEvidence(dataDir, evidenceId) {
13377
13775
  const overview = await loadEvidenceOverview(dataDir, evidenceId);
13378
13776
  let findingsRaw;
13379
13777
  try {
13380
- findingsRaw = await readFile(join15(evidenceDirectory(dataDir, evidenceId), "findings.json"), "utf8");
13778
+ findingsRaw = await readFile(join14(evidenceDirectory(dataDir, evidenceId), "findings.json"), "utf8");
13381
13779
  } catch (error) {
13382
13780
  if (isMissingFile(error)) throw new Error(`evidence artifact ${evidenceId} is missing findings.json`);
13383
13781
  throw error;
@@ -13389,7 +13787,7 @@ async function inspectEvidence(dataDir, evidenceId) {
13389
13787
  async function loadEvidenceTrustStatus(dataDir, evidenceId) {
13390
13788
  let raw;
13391
13789
  try {
13392
- raw = await readFile(join15(evidenceDirectory(dataDir, evidenceId), "trust-status.json"), "utf8");
13790
+ raw = await readFile(join14(evidenceDirectory(dataDir, evidenceId), "trust-status.json"), "utf8");
13393
13791
  } catch (error) {
13394
13792
  if (isMissingFile(error)) {
13395
13793
  return { version: 1, evidenceId, projection: "historical_format", runs: [] };
@@ -13422,7 +13820,7 @@ async function loadEvidenceTrustStatus(dataDir, evidenceId) {
13422
13820
  async function loadEvidenceRunProvenance(dataDir, evidenceId) {
13423
13821
  let raw;
13424
13822
  try {
13425
- raw = await readFile(join15(evidenceDirectory(dataDir, evidenceId), "receipt.json"), "utf8");
13823
+ raw = await readFile(join14(evidenceDirectory(dataDir, evidenceId), "receipt.json"), "utf8");
13426
13824
  } catch (error) {
13427
13825
  const err = error;
13428
13826
  if (err.code === "ENOENT") return [];
@@ -13997,22 +14395,22 @@ function finding(index, severity, tag, runId, message) {
13997
14395
  }
13998
14396
  async function writeEvidenceFiles(directory, overview, runSources, findings, sessionLinks, auditLinks, toolEventRows, gateDecisions, trustStatus, protectedArtifacts, transcript) {
13999
14397
  await mkdir(directory, { recursive: true });
14000
- await writeJson(join16(directory, "overview.json"), overview);
14398
+ await writeJson(join15(directory, "overview.json"), overview);
14001
14399
  await writeFile(
14002
- join16(directory, "transcript.md"),
14400
+ join15(directory, "transcript.md"),
14003
14401
  transcript ?? renderTranscript(overview, runSources, sessionLinks, trustStatus),
14004
14402
  "utf8"
14005
14403
  );
14006
- await writeJsonl(join16(directory, "trace.raw.jsonl"), rawTraceRows(runSources));
14007
- await writeJsonl(join16(directory, "trace.cleaned.jsonl"), cleanedTraceRows(runSources, findings, toolEventRows));
14008
- await writeJsonl(join16(directory, "tool-events.jsonl"), toolEventRows);
14009
- await writeJsonl(join16(directory, "audit-linked.jsonl"), auditLinks.rows);
14010
- await writeJson(join16(directory, "receipt.json"), receiptsFile(runSources));
14011
- await writeJson(join16(directory, "gate-decisions.json"), gateDecisions);
14012
- await writeJson(join16(directory, "trust-status.json"), trustStatus);
14013
- await writeJson(join16(directory, "protected-artifacts.json"), protectedArtifacts);
14014
- await writeJson(join16(directory, "findings.json"), findingsFile(overview.evidenceId, [...findings]));
14015
- await writeFile(join16(directory, "findings.md"), renderEvidenceFindingsMarkdown(findings, trustStatus), "utf8");
14404
+ await writeJsonl(join15(directory, "trace.raw.jsonl"), rawTraceRows(runSources));
14405
+ await writeJsonl(join15(directory, "trace.cleaned.jsonl"), cleanedTraceRows(runSources, findings, toolEventRows));
14406
+ await writeJsonl(join15(directory, "tool-events.jsonl"), toolEventRows);
14407
+ await writeJsonl(join15(directory, "audit-linked.jsonl"), auditLinks.rows);
14408
+ await writeJson(join15(directory, "receipt.json"), receiptsFile(runSources));
14409
+ await writeJson(join15(directory, "gate-decisions.json"), gateDecisions);
14410
+ await writeJson(join15(directory, "trust-status.json"), trustStatus);
14411
+ await writeJson(join15(directory, "protected-artifacts.json"), protectedArtifacts);
14412
+ await writeJson(join15(directory, "findings.json"), findingsFile(overview.evidenceId, [...findings]));
14413
+ await writeFile(join15(directory, "findings.md"), renderEvidenceFindingsMarkdown(findings, trustStatus), "utf8");
14016
14414
  }
14017
14415
  function rawTraceRows(runSources) {
14018
14416
  const rows = [];
@@ -14692,7 +15090,7 @@ function axisFindings(offset, source, status) {
14692
15090
  return out;
14693
15091
  }
14694
15092
  async function readRunLedger(stateDir) {
14695
- const target = join16(stateDir, "runs.json");
15093
+ const target = join15(stateDir, "runs.json");
14696
15094
  let raw;
14697
15095
  try {
14698
15096
  raw = await readFile2(target, "utf8");
@@ -14713,7 +15111,7 @@ function selectRunEnvelopes(ledger, source) {
14713
15111
  });
14714
15112
  }
14715
15113
  async function readReceipt(stateDir, envelope) {
14716
- const receiptPath = envelope.receiptPath ?? join16(stateDir, "receipts", `${envelope.id}.json`);
15114
+ const receiptPath = envelope.receiptPath ?? join15(stateDir, "receipts", `${envelope.id}.json`);
14717
15115
  let raw;
14718
15116
  try {
14719
15117
  raw = await readFile2(receiptPath, "utf8");
@@ -15006,7 +15404,7 @@ function sanitizeEvidenceId(value) {
15006
15404
  // src/domains/evidence/eval.ts
15007
15405
  init_esm_shims();
15008
15406
  import { mkdir as mkdir2, readdir as readdir2, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
15009
- import { join as join17 } from "node:path";
15407
+ import { join as join16 } from "node:path";
15010
15408
 
15011
15409
  // src/domains/eval/index.ts
15012
15410
  init_esm_shims();
@@ -15207,19 +15605,19 @@ async function writeEvalEvidenceFiles(directory, artifact, overview, findings, t
15207
15605
  };
15208
15606
  const redactedArtifact = redactArtifactForStorage(artifact);
15209
15607
  await mkdir2(directory, { recursive: true });
15210
- await writeJson2(join17(directory, "overview.json"), overview);
15211
- await writeFile2(join17(directory, "transcript.md"), renderEvalTranscript(redactedArtifact, overview), "utf8");
15212
- await writeJsonl2(join17(directory, "trace.raw.jsonl"), rawEvalTraceRows(redactedArtifact));
15213
- await writeJsonl2(join17(directory, "trace.cleaned.jsonl"), cleanedEvalTraceRows(redactedArtifact, findings));
15214
- await writeJsonl2(join17(directory, "tool-events.jsonl"), redactArtifactForStorage(toolEventRows));
15215
- await writeJsonl2(join17(directory, "audit-linked.jsonl"), linkedRuns.auditRows);
15216
- await writeJson2(join17(directory, "receipt.json"), receiptsFile2);
15217
- await writeJson2(join17(directory, "gate-decisions.json"), gateDecisions);
15218
- await writeJson2(join17(directory, "trust-status.json"), trustStatus);
15219
- await writeJson2(join17(directory, "protected-artifacts.json"), emptyProtected);
15220
- await writeJson2(join17(directory, "eval-result.json"), redactedArtifact);
15221
- await writeJson2(join17(directory, "findings.json"), findingsFile(overview.evidenceId, [...findings]));
15222
- await writeFile2(join17(directory, "findings.md"), renderEvidenceFindingsMarkdown(findings, trustStatus), "utf8");
15608
+ await writeJson2(join16(directory, "overview.json"), overview);
15609
+ await writeFile2(join16(directory, "transcript.md"), renderEvalTranscript(redactedArtifact, overview), "utf8");
15610
+ await writeJsonl2(join16(directory, "trace.raw.jsonl"), rawEvalTraceRows(redactedArtifact));
15611
+ await writeJsonl2(join16(directory, "trace.cleaned.jsonl"), cleanedEvalTraceRows(redactedArtifact, findings));
15612
+ await writeJsonl2(join16(directory, "tool-events.jsonl"), redactArtifactForStorage(toolEventRows));
15613
+ await writeJsonl2(join16(directory, "audit-linked.jsonl"), linkedRuns.auditRows);
15614
+ await writeJson2(join16(directory, "receipt.json"), receiptsFile2);
15615
+ await writeJson2(join16(directory, "gate-decisions.json"), gateDecisions);
15616
+ await writeJson2(join16(directory, "trust-status.json"), trustStatus);
15617
+ await writeJson2(join16(directory, "protected-artifacts.json"), emptyProtected);
15618
+ await writeJson2(join16(directory, "eval-result.json"), redactedArtifact);
15619
+ await writeJson2(join16(directory, "findings.json"), findingsFile(overview.evidenceId, [...findings]));
15620
+ await writeFile2(join16(directory, "findings.md"), renderEvidenceFindingsMarkdown(findings, trustStatus), "utf8");
15223
15621
  }
15224
15622
  function rawEvalTraceRows(artifact) {
15225
15623
  return artifact.results.map((result) => ({
@@ -15360,7 +15758,7 @@ async function linkEvalRuns(stateDir, artifact) {
15360
15758
  }
15361
15759
  async function readRunLedger2(stateDir) {
15362
15760
  try {
15363
- const raw = await readFile3(join17(stateDir, "runs.json"), "utf8");
15761
+ const raw = await readFile3(join16(stateDir, "runs.json"), "utf8");
15364
15762
  const parsed = JSON.parse(raw);
15365
15763
  return Array.isArray(parsed) ? parsed.filter(isRecord12) : [];
15366
15764
  } catch {
@@ -15371,7 +15769,7 @@ function evalRunMatches(artifact, envelope) {
15371
15769
  return artifact.results.some((result) => result.runId === envelope.id);
15372
15770
  }
15373
15771
  async function readReceiptForRun(stateDir, envelope) {
15374
- const path2 = envelope.receiptPath ?? join17(stateDir, "receipts", `${envelope.id}.json`);
15772
+ const path2 = envelope.receiptPath ?? join16(stateDir, "receipts", `${envelope.id}.json`);
15375
15773
  try {
15376
15774
  const parsed = JSON.parse(await readFile3(path2, "utf8"));
15377
15775
  return isRecord12(parsed) ? parsed : null;
@@ -15400,7 +15798,7 @@ async function countSessionEntries(stateDir, sessionIds) {
15400
15798
  return count;
15401
15799
  }
15402
15800
  async function findSessionLedgerPath(stateDir, sessionId) {
15403
- const root = join17(stateDir, "sessions");
15801
+ const root = join16(stateDir, "sessions");
15404
15802
  let cwdHashes;
15405
15803
  try {
15406
15804
  cwdHashes = await readdir2(root);
@@ -15408,7 +15806,7 @@ async function findSessionLedgerPath(stateDir, sessionId) {
15408
15806
  return null;
15409
15807
  }
15410
15808
  for (const cwdHash of cwdHashes) {
15411
- const path2 = join17(root, cwdHash, sessionId, "current.jsonl");
15809
+ const path2 = join16(root, cwdHash, sessionId, "current.jsonl");
15412
15810
  try {
15413
15811
  await readFile3(path2, "utf8");
15414
15812
  return path2;
@@ -15418,7 +15816,7 @@ async function findSessionLedgerPath(stateDir, sessionId) {
15418
15816
  return null;
15419
15817
  }
15420
15818
  async function linkedEvalAuditRows(stateDir, runIds, artifact) {
15421
- const root = join17(stateDir, "audit");
15819
+ const root = join16(stateDir, "audit");
15422
15820
  let files;
15423
15821
  try {
15424
15822
  files = await readdir2(root);
@@ -15427,7 +15825,7 @@ async function linkedEvalAuditRows(stateDir, runIds, artifact) {
15427
15825
  }
15428
15826
  const rows = [];
15429
15827
  for (const file of files.filter((name) => name.endsWith(".jsonl")).sort(compareCodepoints)) {
15430
- const raw = await readFile3(join17(root, file), "utf8").catch(() => "");
15828
+ const raw = await readFile3(join16(root, file), "utf8").catch(() => "");
15431
15829
  const lines = raw.split("\n");
15432
15830
  for (let index = 0; index < lines.length; index += 1) {
15433
15831
  const line = lines[index];
@@ -15676,6 +16074,7 @@ export {
15676
16074
  setCapacityDraining,
15677
16075
  capacityDrain,
15678
16076
  capacityLeaseUsage,
16077
+ endpointCapacityUsage,
15679
16078
  openAgentLedger,
15680
16079
  renderAgentLedgerBoard,
15681
16080
  closeAgentLedger,
@@ -15684,6 +16083,7 @@ export {
15684
16083
  UNVERIFIABLE_RECEIPT_VERIFICATION,
15685
16084
  assistantTextFromEvent,
15686
16085
  receiptResponseModelIdObservationLabel,
16086
+ receiptGatewayRoutingLabel,
15687
16087
  createDispatchRunEventRegistry,
15688
16088
  readFleetRun,
15689
16089
  listFleetRuns,
@@ -15715,4 +16115,4 @@ export {
15715
16115
  summarizeEvalResults,
15716
16116
  buildEvalEvidence
15717
16117
  };
15718
- //# sourceMappingURL=chunk-XKA2ICR3.js.map
16118
+ //# sourceMappingURL=chunk-AF4YM7Z4.js.map