@iowarp/clio-coder 0.4.8 → 0.4.9

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 (513) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +7 -6
  3. package/dist/{acp-JWPQZM2D.js → acp-ZWZCPS2A.js} +13 -13
  4. package/dist/{agents-4GCDIRVX.js → agents-LYSOWZUE.js} +53 -52
  5. package/dist/assets/codewiki.json +1 -1
  6. package/dist/{auth-SYAKTDQE.js → auth-WBQGKWQ5.js} +27 -27
  7. package/dist/{background-OW67WMYR.js → background-BUMOBAQN.js} +4 -4
  8. package/dist/{builtins-TKS63VNV.js → builtins-ODRJOEDI.js} +7 -7
  9. package/dist/{chunk-JLBVCROW.js → chunk-2DRRZ57Q.js} +33 -24
  10. package/dist/chunk-2JBZYUPY.js +105 -0
  11. package/dist/chunk-2KUBKL63.js +336 -0
  12. package/dist/{chunk-K45LHSCI.js → chunk-2VBWFXYE.js} +7 -3
  13. package/dist/{chunk-XTLJDC2X.js → chunk-2X2R3UTH.js} +23 -18
  14. package/dist/{chunk-5HULHKT2.js → chunk-37LW32LZ.js} +5 -5
  15. package/dist/{chunk-W7KNI3F5.js → chunk-3AND2EFU.js} +5 -5
  16. package/dist/{chunk-36XSBPXL.js → chunk-3RDHGNU7.js} +95 -27
  17. package/dist/{chunk-BIY22UUK.js → chunk-3SUDBGEI.js} +11 -10
  18. package/dist/{chunk-3IQOZRQ6.js → chunk-3TQN67I2.js} +7 -7
  19. package/dist/{chunk-KWJXCL2X.js → chunk-3U4BL2EV.js} +3 -3
  20. package/dist/{chunk-RBES4TCZ.js → chunk-3UQADNG2.js} +3 -3
  21. package/dist/{chunk-V4ZKOKRB.js → chunk-434LRQ6Z.js} +61 -53
  22. package/dist/{chunk-MWMW53WW.js → chunk-4ATBOFRP.js} +649 -193
  23. package/dist/{chunk-QGIC5SX5.js → chunk-4DNL43EZ.js} +3 -3
  24. package/dist/{chunk-GVU4CXPJ.js → chunk-4HFJKRGZ.js} +113 -54
  25. package/dist/{chunk-5A6XR3RJ.js → chunk-555E2WVV.js} +16 -2
  26. package/dist/{chunk-LZDLYSUN.js → chunk-5RTEFNBP.js} +3 -3
  27. package/dist/{chunk-HMGAKB7E.js → chunk-64XJW7NT.js} +15 -15
  28. package/dist/{chunk-EXKUF426.js → chunk-7FBCRWVT.js} +280 -280
  29. package/dist/{chunk-K3W6BF5C.js → chunk-7JSOSVLP.js} +2 -2
  30. package/dist/{chunk-WFTSK7N3.js → chunk-7N3OLLSL.js} +4 -4
  31. package/dist/{chunk-JRA6OBHY.js → chunk-A6DULIMH.js} +17 -5
  32. package/dist/{chunk-R5NRX5N4.js → chunk-AB3QXXBC.js} +2 -2
  33. package/dist/chunk-ACCECAH4.js +49 -0
  34. package/dist/{chunk-GJBJHJNY.js → chunk-AM6CEP2K.js} +5 -5
  35. package/dist/{chunk-MUXNDNMZ.js → chunk-AY4XE6GN.js} +19 -13
  36. package/dist/{chunk-MATCRH3M.js → chunk-BBA2TAWV.js} +9 -9
  37. package/dist/{chunk-PMUUAABD.js → chunk-BMNVVKEW.js} +9 -9
  38. package/dist/{chunk-TOPICHGR.js → chunk-CTGZCEI6.js} +2 -2
  39. package/dist/{chunk-L75H5B3B.js → chunk-DIAJYJYG.js} +2 -2
  40. package/dist/{chunk-JIMWEYWO.js → chunk-EHZRAB4U.js} +2 -2
  41. package/dist/{chunk-YXANQGCX.js → chunk-EM2DIQAJ.js} +6 -6
  42. package/dist/{chunk-JCVIL6TY.js → chunk-ETF4ROKH.js} +4 -4
  43. package/dist/{chunk-5W4FRA5Q.js → chunk-F2YM3JY4.js} +483 -253
  44. package/dist/{chunk-YGIV24MF.js → chunk-FEBQWHJT.js} +21 -16
  45. package/dist/{chunk-PGEFOTJB.js → chunk-FPS4R2RN.js} +5 -4
  46. package/dist/{chunk-XC5POIL4.js → chunk-G5R53COU.js} +1 -1
  47. package/dist/chunk-GHXGMFQ5.js +40 -0
  48. package/dist/{chunk-QLKCCC2J.js → chunk-GJDRMBDI.js} +14 -14
  49. package/dist/{chunk-2ZWLMA3T.js → chunk-GREYLTZ5.js} +7 -7
  50. package/dist/{chunk-YXFKLMX2.js → chunk-H2WSCZZT.js} +22 -6
  51. package/dist/{chunk-FNVPQQYT.js → chunk-H6IUCY6Q.js} +2 -2
  52. package/dist/{chunk-5C2OQHLR.js → chunk-H72DCH3E.js} +92 -203
  53. package/dist/{chunk-JYKUMHCQ.js → chunk-H7TXJR23.js} +21 -21
  54. package/dist/chunk-HBJQQTKM.js +40 -0
  55. package/dist/chunk-HCVKSGNZ.js +990 -0
  56. package/dist/{chunk-ARRUMZ7X.js → chunk-I47EJPYL.js} +3 -3
  57. package/dist/{chunk-YKIIWURD.js → chunk-IALGWTLO.js} +3 -3
  58. package/dist/{chunk-FB3KTE2J.js → chunk-IALZJE37.js} +4 -4
  59. package/dist/{chunk-RAUOKUZV.js → chunk-IC7JXLOM.js} +15 -10
  60. package/dist/{chunk-LLCGGVSW.js → chunk-IOSVTTCD.js} +7 -7
  61. package/dist/{chunk-DBREN25X.js → chunk-IPTPMLA6.js} +8 -3
  62. package/dist/{chunk-V552WL53.js → chunk-IZZI3SKQ.js} +3 -67
  63. package/dist/{chunk-UDAK6GR2.js → chunk-JIYWMQZ5.js} +2 -2
  64. package/dist/{chunk-O3HSB2YL.js → chunk-JKU34ACI.js} +2 -2
  65. package/dist/{chunk-6X7VOCDY.js → chunk-JTR3VSV3.js} +3 -3
  66. package/dist/{chunk-O2QJDRWP.js → chunk-JU6MAMRJ.js} +4 -4
  67. package/dist/chunk-JURMQWVJ.js +15 -0
  68. package/dist/{chunk-STC6CWUZ.js → chunk-K3XN4LZ4.js} +5 -5
  69. package/dist/{chunk-ATB3Q7YO.js → chunk-KIVFXGBM.js} +27 -2
  70. package/dist/{chunk-WJWNZXRM.js → chunk-KOAHT3N2.js} +2 -2
  71. package/dist/chunk-KP5BPXR3.js +73 -0
  72. package/dist/{chunk-K53E2PTW.js → chunk-KRJQG47M.js} +3 -3
  73. package/dist/{chunk-IILXVWJY.js → chunk-KW6OJ7IY.js} +19 -21
  74. package/dist/{chunk-A46ILRS2.js → chunk-L3NBWLSN.js} +4 -4
  75. package/dist/{chunk-2U2U5POA.js → chunk-L4RUTLRL.js} +5 -5
  76. package/dist/{chunk-QYSAZMSH.js → chunk-LGTVWPRN.js} +2 -2
  77. package/dist/{chunk-KGP3UQGJ.js → chunk-LSQW6KZO.js} +5 -5
  78. package/dist/{chunk-P4JS3MH5.js → chunk-LWJYOHT3.js} +8 -8
  79. package/dist/{chunk-U3TPUXOQ.js → chunk-M6YLF66Z.js} +74 -40
  80. package/dist/{chunk-5D2FNBMG.js → chunk-MJ4QEJVT.js} +2 -2
  81. package/dist/{chunk-RM3XJX7P.js → chunk-MO65K5CH.js} +5 -5
  82. package/dist/{chunk-H5DPSUBB.js → chunk-MTOZEQHL.js} +3 -3
  83. package/dist/{chunk-6R5MBXBJ.js → chunk-NBPA5QM6.js} +2 -2
  84. package/dist/{chunk-H77XBUBM.js → chunk-NMBEW4PP.js} +3 -3
  85. package/dist/{chunk-QWUSS2QP.js → chunk-NPLLK3HO.js} +67 -87
  86. package/dist/{chunk-K5UJD6MM.js → chunk-NSYGPIVW.js} +5 -5
  87. package/dist/{context-EZZPT2ZV.js → chunk-NXTV5OI5.js} +30 -84
  88. package/dist/{chunk-F7Y6QTPL.js → chunk-NYDG4QP4.js} +4 -4
  89. package/dist/{chunk-PFZJMXIY.js → chunk-OA2GDACN.js} +2 -2
  90. package/dist/{chunk-Q32C6AWI.js → chunk-PJI57EC6.js} +4 -4
  91. package/dist/{chunk-EFXMQYI6.js → chunk-PJJBUGMR.js} +52 -52
  92. package/dist/{chunk-ICYIUNO4.js → chunk-PNJE7JPS.js} +18 -3
  93. package/dist/chunk-PP23PZEV.js +1347 -0
  94. package/dist/chunk-PPIFDSBK.js +409 -0
  95. package/dist/{chunk-RFULVPBX.js → chunk-PTFISXQO.js} +6 -5
  96. package/dist/{chunk-JV25I7ID.js → chunk-QB33Z5S7.js} +5 -5
  97. package/dist/{chunk-D55WO5J7.js → chunk-QGNII5VC.js} +8 -8
  98. package/dist/{chunk-RKFNU5UA.js → chunk-QI72X67S.js} +104 -27
  99. package/dist/chunk-QKHZZFKH.js +98 -0
  100. package/dist/{chunk-5UG6EZI3.js → chunk-RDKX2PME.js} +4 -4
  101. package/dist/{chunk-B5ZTR6KZ.js → chunk-RL7LJYN4.js} +1 -1
  102. package/dist/{chunk-BE4I3UJ2.js → chunk-RQROVOV3.js} +15 -13
  103. package/dist/{chunk-TEHVMHOK.js → chunk-S34A7BSP.js} +3 -3
  104. package/dist/{chunk-4P6M2TTE.js → chunk-SJETVJHX.js} +2 -2
  105. package/dist/{chunk-OPC4DQD6.js → chunk-SJMNU4ZS.js} +2 -2
  106. package/dist/{chunk-2JSCCEKO.js → chunk-SLLG2G44.js} +2 -2
  107. package/dist/{chunk-EPYATQMG.js → chunk-SQAZN2V3.js} +42 -16
  108. package/dist/{chunk-E2NSPYLC.js → chunk-SQBT46OF.js} +5 -5
  109. package/dist/{chunk-WTZVSMQZ.js → chunk-TCUOGIL2.js} +5 -5
  110. package/dist/{chunk-RRZFRIJP.js → chunk-TIWPKCVO.js} +5 -5
  111. package/dist/{chunk-QLAGXTTV.js → chunk-UIU7MGZ3.js} +5 -1
  112. package/dist/{chunk-WLHX3MM5.js → chunk-V4XJWDHR.js} +21 -11
  113. package/dist/{chunk-PJ5H5B7A.js → chunk-VPWGADBG.js} +18 -18
  114. package/dist/{chunk-GEYX2NZ5.js → chunk-VWFCAK34.js} +6 -6
  115. package/dist/{chunk-44U2OUSM.js → chunk-W72LLZAV.js} +2 -2
  116. package/dist/{chunk-ORRNGQDV.js → chunk-WGRDABW7.js} +4 -4
  117. package/dist/{chunk-RNLAPBJL.js → chunk-XFLSL7BT.js} +2 -2
  118. package/dist/{chunk-2SXGG2IV.js → chunk-XJZEDCNT.js} +6 -6
  119. package/dist/{chunk-UB33F3YW.js → chunk-XLLEL3K7.js} +5 -5
  120. package/dist/{chunk-2GPGAE5W.js → chunk-XNIZBOFV.js} +15 -1
  121. package/dist/{chunk-WS4FOGLY.js → chunk-XNZWWDC3.js} +2 -2
  122. package/dist/{chunk-P7GTE4FX.js → chunk-XRECG65F.js} +2 -2
  123. package/dist/chunk-XTQ7MEJG.js +457 -0
  124. package/dist/{chunk-GEVQNST4.js → chunk-XZWSP67B.js} +2 -2
  125. package/dist/{chunk-OEMFEL26.js → chunk-Y3M2T5RO.js} +3 -3
  126. package/dist/{chunk-HP7KJ5O2.js → chunk-YPQOPFP7.js} +6 -6
  127. package/dist/{chunk-MEHBW2SP.js → chunk-YQYINEJI.js} +6 -6
  128. package/dist/{chunk-RXI7K4J5.js → chunk-ZF6CV4WZ.js} +1338 -217
  129. package/dist/{chunk-3XE4NRLF.js → chunk-ZKJU55MX.js} +4 -2
  130. package/dist/{chunk-526ABLHD.js → chunk-ZKQ63XZ5.js} +12 -35
  131. package/dist/{chunk-PAQVETLA.js → chunk-ZKVMDNAN.js} +5 -5
  132. package/dist/cli/index.js +47 -37
  133. package/dist/{clio-BPBAPZGA.js → clio-JUDCLNHC.js} +7 -7
  134. package/dist/clio-context-tools-FT672MNZ.js +136 -0
  135. package/dist/{code-nav-KBQ3RIFK.js → code-nav-7OVCTP2Z.js} +28 -26
  136. package/dist/{components-6DKAXWFN.js → components-OZXZMDWU.js} +5 -5
  137. package/dist/{config-FWL5JK2H.js → config-P3ZQVF63.js} +80 -75
  138. package/dist/{config-graph-ACDB26L2.js → config-graph-GKAOBAS5.js} +74 -70
  139. package/dist/{configure-ZIZ4YV62.js → configure-25LRYZJG.js} +45 -44
  140. package/dist/context-72VQV7JX.js +73 -0
  141. package/dist/{context-VIL5MFRH.js → context-COWRWXP3.js} +74 -70
  142. package/dist/{context-Z3GOBHDK.js → context-WB3D474G.js} +12 -12
  143. package/dist/{context-clear-ZPB3L7MN.js → context-clear-Y4LYMWC6.js} +70 -66
  144. package/dist/{context-working-set-2GLBVF7L.js → context-working-set-TMZYVC7A.js} +15 -14
  145. package/dist/data-tool-KMBWKKWR.js +2987 -0
  146. package/dist/{detail-VSBWYSGZ.js → detail-4GLROGY5.js} +71 -67
  147. package/dist/{dispatch-runner-EEEHGKX4.js → dispatch-runner-TR3LBP5P.js} +92 -88
  148. package/dist/{docs-VMMWFVHL.js → docs-ZK777W2G.js} +3 -3
  149. package/dist/{doctor-V5L4IQGP.js → doctor-WC4OV2OB.js} +61 -59
  150. package/dist/{eval-VJYJ2BV3.js → eval-FUNWJNUJ.js} +45 -45
  151. package/dist/{evals-J2H5V6DD.js → evals-L73EBHSU.js} +4 -4
  152. package/dist/{evidence-Y35YSXH6.js → evidence-AVJ2RTHX.js} +80 -76
  153. package/dist/{evidence-POWAEBEW.js → evidence-P4NZOAK7.js} +70 -66
  154. package/dist/{evidence-XCCCLS36.js → evidence-Y55WKYHH.js} +79 -75
  155. package/dist/{evolve-GPG72VB6.js → evolve-MAWKRYWF.js} +75 -71
  156. package/dist/{extensions-YIZ7W3DA.js → extensions-PYQH3H47.js} +8 -8
  157. package/dist/{fleet-2MDCQ2VK.js → fleet-M4H2QBWT.js} +84 -80
  158. package/dist/{fleet-W2AF3TOJ.js → fleet-ULBXXRDR.js} +123 -119
  159. package/dist/{fleet-commands-WS56G26H.js → fleet-commands-7NNC4JZU.js} +17 -16
  160. package/dist/{fleet-decisions-MYGZ3JW7.js → fleet-decisions-EHEY7KPU.js} +9 -9
  161. package/dist/{fleet-graph-ELTBXBAV.js → fleet-graph-LQ2AHZT3.js} +15 -15
  162. package/dist/{fleet-inspect-45IK73L4.js → fleet-inspect-5IGBIIYZ.js} +76 -72
  163. package/dist/{fleet-preflight-T5NCZKHE.js → fleet-preflight-UTTNOKMG.js} +7 -2
  164. package/dist/{fleet-validate-VG4JBLA4.js → fleet-validate-YGILJKA6.js} +20 -20
  165. package/dist/{fleet-verify-VTSABAYO.js → fleet-verify-AUWTCDKR.js} +70 -66
  166. package/dist/{fleet-view-XC7WMKSS.js → fleet-view-TGUFCY5A.js} +73 -69
  167. package/dist/{init-VTJNNTIP.js → init-GFN2Z7NF.js} +94 -90
  168. package/dist/{interop-IU6BNA7C.js → interop-EF5JUWWK.js} +21 -21
  169. package/dist/{inventory-QPQUTUUZ.js → inventory-I6VJDDYF.js} +73 -69
  170. package/dist/{library-Q3NWL5CM.js → library-3J5IO2OJ.js} +13 -13
  171. package/dist/{library-LF7DLU6S.js → library-IJTOFTDS.js} +16 -15
  172. package/dist/{library-HUTAS57T.js → library-Z3KZSHPE.js} +27 -27
  173. package/dist/{library-import-PPW4YUC5.js → library-import-IMKFLDHX.js} +21 -21
  174. package/dist/{library-inventory-DIRVFRZU.js → library-inventory-CQP5D6GU.js} +13 -13
  175. package/dist/{library-validation-XHUZ3INE.js → library-validation-33UTX7AI.js} +11 -11
  176. package/dist/mcp-5FWZKUS6.js +26 -0
  177. package/dist/{memory-Z2LSKNV6.js → memory-36CWN67Y.js} +75 -71
  178. package/dist/{models-3FTREYPY.js → models-KQ6PQJJQ.js} +49 -49
  179. package/dist/{monitor-HF2MQRB3.js → monitor-XX6ZD6KC.js} +83 -79
  180. package/dist/{orchestrator-UYPA6W4S.js → orchestrator-SK6HDAOP.js} +1337 -772
  181. package/dist/{panes-736XB73K.js → panes-L27QRXUH.js} +12 -12
  182. package/dist/{panes-C4P3PIWT.js → panes-LXZIWNOZ.js} +4 -4
  183. package/dist/{paths-JQ4QYIYB.js → paths-7DJDU4P4.js} +5 -5
  184. package/dist/{preload-XSLRYH3Y.js → preload-K2TDYI4Y.js} +70 -66
  185. package/dist/{reset-V7QSPZYE.js → reset-73VU3XNT.js} +10 -10
  186. package/dist/{resources-OJGDFHYT.js → resources-3BYJYVYL.js} +16 -16
  187. package/dist/{run-T354SMDW.js → run-AR7PY6GW.js} +132 -128
  188. package/dist/run-script-H2KUDIII.js +41 -0
  189. package/dist/{settings-MWZXO6RV.js → settings-3VMBMWID.js} +4 -4
  190. package/dist/{share-Y5ZKJPND.js → share-HVWH4FPF.js} +21 -21
  191. package/dist/{skills-4GLZC4LN.js → skills-5TYEY75Q.js} +22 -22
  192. package/dist/{skills-eval-L5T7GODM.js → skills-eval-CK3MD63Z.js} +96 -87
  193. package/dist/{skills-inventory-LASKXEZI.js → skills-inventory-KSFYG3I6.js} +16 -16
  194. package/dist/{slash-commands-OIMRU36D.js → slash-commands-DMVHML7P.js} +47 -44
  195. package/dist/{steer-KMAM2Y2C.js → steer-XCD6V3EW.js} +4 -4
  196. package/dist/{support-AWC3XKPX.js → support-JAZL6VBR.js} +7 -7
  197. package/dist/{system-CD75NYBU.js → system-3TDQRMZZ.js} +26 -26
  198. package/dist/{targets-VSZX2J2S.js → targets-EZKHAYRN.js} +66 -65
  199. package/dist/{tasks-AN567LYH.js → tasks-SNEFHWYW.js} +12 -12
  200. package/dist/{terminal-lease-6KTWNHVY.js → terminal-lease-BNLFA4OF.js} +8 -7
  201. package/dist/{tools-AGRK3V5J.js → tools-7IM6BDCE.js} +12 -12
  202. package/dist/{trace-P4MQZD33.js → trace-C3MBGD4S.js} +8 -8
  203. package/dist/{tui-primitives-A6MUW32V.js → tui-primitives-36BY2774.js} +2 -2
  204. package/dist/{uninstall-BRUTEPIC.js → uninstall-WWLOSZ42.js} +10 -10
  205. package/dist/{upgrade-SBCGHQGJ.js → upgrade-ETK2JNSJ.js} +37 -47
  206. package/dist/{usage-BIDVTO6V.js → usage-S2HOB7BZ.js} +93 -89
  207. package/dist/{verifiers-LTGCAMXS.js → verifiers-QDTEVH7R.js} +24 -22
  208. package/dist/{verify-OZU4LLNP.js → verify-SUKUK6XM.js} +15 -14
  209. package/dist/web/client/assets/{abnfDiagram-VCTEODGH-C5wfoHm3.js → abnfDiagram-VCTEODGH-BznNOe_I.js} +1 -1
  210. package/dist/web/client/assets/{arc-oH91sfLl.js → arc-Pry-7G1_.js} +1 -1
  211. package/dist/web/client/assets/architecture-7GRP2DOG-BQO9DL_y.js +1 -0
  212. package/dist/web/client/assets/architectureDiagram-5GKGNRK7-CKPbdvyx.js +36 -0
  213. package/dist/web/client/assets/{blockDiagram-I7D4REHJ-wi0_CYHL.js → blockDiagram-I7D4REHJ-prINbpbM.js} +1 -1
  214. package/dist/web/client/assets/{c4Diagram-7LVT6UL2-DV7NYc2W.js → c4Diagram-7LVT6UL2-DkVRKtyU.js} +1 -1
  215. package/dist/web/client/assets/channel-c4EeUUqA.js +1 -0
  216. package/dist/web/client/assets/{chunk-4HAMMTFA-Bhsegh3F.js → chunk-4HAMMTFA-CV0Z1ApC.js} +1 -1
  217. package/dist/web/client/assets/{chunk-75Z2AOVW-RQCckcQG.js → chunk-75Z2AOVW-D34Nohxq.js} +1 -1
  218. package/dist/web/client/assets/chunk-DU6HZSFF-Das_cS-O.js +125 -0
  219. package/dist/web/client/assets/{chunk-F27PBJKO-BcNqv2x1.js → chunk-F27PBJKO-CmRojxkG.js} +1 -1
  220. package/dist/web/client/assets/{chunk-GMAD6QVW-Bq8JWiZT.js → chunk-GMAD6QVW-ClYZmc73.js} +1 -1
  221. package/dist/web/client/assets/{chunk-GVQU2GXP-DbchrAeJ.js → chunk-GVQU2GXP-B2BiHFt-.js} +1 -1
  222. package/dist/web/client/assets/{chunk-IMKFNOWR-DrpvjocK.js → chunk-IMKFNOWR-BGApZ8nP.js} +1 -1
  223. package/dist/web/client/assets/{chunk-L3NEJ4N5-DHLmTnCe.js → chunk-L3NEJ4N5-DIzCgpkY.js} +1 -1
  224. package/dist/web/client/assets/{chunk-OSK3NFVY-CsRbtN9n.js → chunk-OSK3NFVY-BPT-yePv.js} +1 -1
  225. package/dist/web/client/assets/{chunk-P2QGCYS3-aqPbxoMh.js → chunk-P2QGCYS3-BC1WTc2t.js} +1 -1
  226. package/dist/web/client/assets/{chunk-POPQ4Y6H-Dl5vw0h0.js → chunk-POPQ4Y6H-BSjzBmZU.js} +1 -1
  227. package/dist/web/client/assets/{chunk-PWAF6VOD-D7OBRSdO.js → chunk-PWAF6VOD-BIjLs86Z.js} +1 -1
  228. package/dist/web/client/assets/{chunk-SHT3W25Y-CdKCIwuB.js → chunk-SHT3W25Y-CduDz2cm.js} +1 -1
  229. package/dist/web/client/assets/{chunk-SVP7TREG-B94Nu_1-.js → chunk-SVP7TREG-XUn4pPAP.js} +1 -1
  230. package/dist/web/client/assets/{chunk-TICWLB2K-jjRQI_hk.js → chunk-TICWLB2K-DcBy2DKy.js} +1 -1
  231. package/dist/web/client/assets/{chunk-XXDRQBXY-azkbKE37.js → chunk-XXDRQBXY-DqAYeljN.js} +1 -1
  232. package/dist/web/client/assets/classDiagram-ZZMXUADV-C0HR7YKN.js +1 -0
  233. package/dist/web/client/assets/classDiagram-v2-VYDZK3BY-C0HR7YKN.js +1 -0
  234. package/dist/web/client/assets/cose-bilkent-JH36ORCC-CVh1icwb.js +1 -0
  235. package/dist/web/client/assets/{cynefin-OW5HDTMX--i9RDU5f.js → cynefin-OW5HDTMX-BecPbyM6.js} +1 -1
  236. package/dist/web/client/assets/{cynefinDiagram-5FMLGOSQ-cRcvyBdp.js → cynefinDiagram-5FMLGOSQ-BzMzFwyT.js} +1 -1
  237. package/dist/web/client/assets/{dagre-GXQ25YYZ-C9mZmAPe.js → dagre-GXQ25YYZ-CAWJmRMG.js} +1 -1
  238. package/dist/web/client/assets/{diagram-S7CK7UJ4-Oj_zlLDY.js → diagram-S7CK7UJ4--lp0ALmn.js} +1 -1
  239. package/dist/web/client/assets/{diagram-UQ7AKVKN-BWKbbfcR.js → diagram-UQ7AKVKN-gKUnsjcj.js} +1 -1
  240. package/dist/web/client/assets/{diagram-VSXAHHWV-C3N3f7DO.js → diagram-VSXAHHWV-BoN5D1Gh.js} +1 -1
  241. package/dist/web/client/assets/{diagram-VX7I27RA-CtDKDAWe.js → diagram-VX7I27RA-BMtuswQ6.js} +1 -1
  242. package/dist/web/client/assets/{diagram-Z3DM3KII-B8bkBRCz.js → diagram-Z3DM3KII-DtU8LXrA.js} +1 -1
  243. package/dist/web/client/assets/dist-v5Q1xZ2K.js +1 -0
  244. package/dist/web/client/assets/{ebnfDiagram-PWID7BFC-CskW-Whx.js → ebnfDiagram-PWID7BFC-DDcnv9BH.js} +1 -1
  245. package/dist/web/client/assets/{erDiagram-RLTQ6QDP-C-83cgCW.js → erDiagram-RLTQ6QDP-DvRb4iDL.js} +1 -1
  246. package/dist/web/client/assets/eventmodeling-NTZA5JFV-01h4SbTc.js +1 -0
  247. package/dist/web/client/assets/flowDiagram-HODETNUW-Bll_YZ6T.js +1 -0
  248. package/dist/web/client/assets/framework-YGoR34M4.js +9 -0
  249. package/dist/web/client/assets/ganttDiagram-EL5Y4UJY-DdFZ9hvH.js +292 -0
  250. package/dist/web/client/assets/{gitGraph-4MIJSDKK-B40cQtBE.js → gitGraph-4MIJSDKK-DjD_AAMj.js} +1 -1
  251. package/dist/web/client/assets/{gitGraphDiagram-WWUBYQGX-CH-7P7Di.js → gitGraphDiagram-WWUBYQGX-CDyN9n2u.js} +1 -1
  252. package/dist/web/client/assets/index-CVcy0FAn.js +75 -0
  253. package/dist/web/client/assets/{info-A6RAGUB7-eCCE9D_Q.js → info-A6RAGUB7-C_XK8Hq0.js} +1 -1
  254. package/dist/web/client/assets/{infoDiagram-27XIBGKW-DRnvqMjM.js → infoDiagram-27XIBGKW-DIe4tJ1i.js} +1 -1
  255. package/dist/web/client/assets/{ishikawaDiagram-5VMMS53U-DBA_55wp.js → ishikawaDiagram-5VMMS53U-CVl5unKI.js} +1 -1
  256. package/dist/web/client/assets/{journeyDiagram-3NMN7TZE-C-ewpNl7.js → journeyDiagram-3NMN7TZE-CPEB1Vt8.js} +1 -1
  257. package/dist/web/client/assets/{kanban-definition-UXKFOSKX-B1taGsu0.js → kanban-definition-UXKFOSKX-j-9WXjYQ.js} +1 -1
  258. package/dist/web/client/assets/{line-lZ0kyxDI.js → line-BIDAcEtX.js} +1 -1
  259. package/dist/web/client/assets/{linear-DIc8FgZj.js → linear-SzVmGSw4.js} +1 -1
  260. package/dist/web/client/assets/{mermaid-parser.core-SXolxpXw.js → mermaid-parser.core-Ux4vssh0.js} +3 -3
  261. package/dist/web/client/assets/{mermaid.core-DXgQtkNg.js → mermaid.core-CDuwVKeh.js} +4 -4
  262. package/dist/web/client/assets/{mindmap-definition-YA3MSWOX-DXJas9K7.js → mindmap-definition-YA3MSWOX-5MlQEeQ6.js} +1 -1
  263. package/dist/web/client/assets/{packet-AYTQ26CC-OqVl_07o.js → packet-AYTQ26CC-DRO66c9Q.js} +1 -1
  264. package/dist/web/client/assets/{pegDiagram-XKGWAZYB-CPE_zdfN.js → pegDiagram-XKGWAZYB-BakZnSjM.js} +1 -1
  265. package/dist/web/client/assets/{pie-WAS4IAKB-DAxnMBLe.js → pie-WAS4IAKB-BEzcmhz8.js} +1 -1
  266. package/dist/web/client/assets/{pieDiagram-E7YTZNPT-Uwjpufxv.js → pieDiagram-E7YTZNPT-DpmqgoPt.js} +1 -1
  267. package/dist/web/client/assets/prism-core-BtsZdCS6.js +1 -0
  268. package/dist/web/client/assets/{quadrantDiagram-AXDQQJYC-Bjs4yjgs.js → quadrantDiagram-AXDQQJYC-DuMPwwV2.js} +1 -1
  269. package/dist/web/client/assets/{radar-RG4KPBEZ-CuCKjHM3.js → radar-RG4KPBEZ-Djm3oXl5.js} +1 -1
  270. package/dist/web/client/assets/{railroad-74A4TZTK-CnQK-Cc1.js → railroad-74A4TZTK-Cpvkwsao.js} +1 -1
  271. package/dist/web/client/assets/railroad-abnf-HS5TGJTU-CpRQ3ruG.js +1 -0
  272. package/dist/web/client/assets/railroad-ebnf-LZEXJU2U-1Rm5a5eJ.js +1 -0
  273. package/dist/web/client/assets/railroad-peg-WCYAUIDC-C8344cTh.js +1 -0
  274. package/dist/web/client/assets/{railroadDiagram-O6MQD6OU-BDDIPNLL.js → railroadDiagram-O6MQD6OU-CgMS4B6R.js} +1 -1
  275. package/dist/web/client/assets/{requirementDiagram-BXWQKSXE-B5Ydyxc1.js → requirementDiagram-BXWQKSXE-CX5eoNdN.js} +1 -1
  276. package/dist/web/client/assets/rolldown-runtime-hePW80VL.js +1 -0
  277. package/dist/web/client/assets/{sankeyDiagram-P5KCCOFB-Bw2Qym75.js → sankeyDiagram-P5KCCOFB-CODBX2N3.js} +1 -1
  278. package/dist/web/client/assets/{sequenceDiagram-WJ2MYXX4-BZf36nO0.js → sequenceDiagram-WJ2MYXX4-eUhhF8OR.js} +1 -1
  279. package/dist/web/client/assets/src-B6xuSHsQ.js +1 -0
  280. package/dist/web/client/assets/{stateDiagram-D77RDMKH-DnH6JRkp.js → stateDiagram-D77RDMKH-vR6l0NC2.js} +1 -1
  281. package/dist/web/client/assets/stateDiagram-v2-MP3YSRHH-BYUm8jLY.js +1 -0
  282. package/dist/web/client/assets/{swimlanes-42K2YHIH-D9PZmtZg.js → swimlanes-42K2YHIH-v9Tw_zX7.js} +1 -1
  283. package/dist/web/client/assets/swimlanesDiagram-VR7AAH4N-B2jdCvhD.js +8 -0
  284. package/dist/web/client/assets/{timeline-definition-24CTP7MA-CrkZZBo7.js → timeline-definition-24CTP7MA-DxianbhU.js} +1 -1
  285. package/dist/web/client/assets/{treeView-Q6P3EWNA-C9zDShoC.js → treeView-Q6P3EWNA-DLxnZb9R.js} +1 -1
  286. package/dist/web/client/assets/{treemap-WGGIJYW6-B-plj9yK.js → treemap-WGGIJYW6-I7UnZ6xJ.js} +1 -1
  287. package/dist/web/client/assets/{vennDiagram-4TSXK5OY-VeOdaphN.js → vennDiagram-4TSXK5OY-Ar7M8Mrj.js} +1 -1
  288. package/dist/web/client/assets/{wardley-WFR3VGLG-Wl1P_m6L.js → wardley-WFR3VGLG-B8ZSHeDu.js} +1 -1
  289. package/dist/web/client/assets/{wardleyDiagram-VM6X3IG4-B85-R9t2.js → wardleyDiagram-VM6X3IG4-Qks2FmIn.js} +1 -1
  290. package/dist/web/client/assets/{xychartDiagram-S5SC5T6Z-BrD8OW8m.js → xychartDiagram-S5SC5T6Z-BBBjRtiE.js} +1 -1
  291. package/dist/web/client/index.html +3 -1
  292. package/dist/web/reads-worker.js +17 -17
  293. package/dist/web/server.js +25 -25
  294. package/dist/{web-EU6ATJWA.js → web-EMGUGGEI.js} +3 -3
  295. package/dist/{web-fetch-U22Q7HV4.js → web-fetch-6BRRVQON.js} +22 -5
  296. package/dist/{wiki-generate-LZRLFG6I.js → wiki-generate-XHSJTDOP.js} +104 -100
  297. package/dist/{with-panes-X5CZOGML.js → with-panes-Z6BTEHMZ.js} +11 -11
  298. package/dist/worker/entry.js +101 -87
  299. package/docs/README.md +1 -1
  300. package/docs/architecture/artifact-placement.md +12 -1
  301. package/docs/architecture/library.md +1 -1
  302. package/docs/architecture/prompt-envelope-and-tools.md +37 -27
  303. package/docs/architecture/safety-model.md +19 -6
  304. package/docs/architecture/session-lifecycle.md +10 -4
  305. package/docs/architecture/tui-design.md +37 -14
  306. package/docs/guide/commands-and-modes.md +39 -19
  307. package/docs/guide/configuration-and-targets.md +7 -5
  308. package/docs/guide/configuration-reference.md +116 -13
  309. package/docs/guide/environment-variables.md +2 -5
  310. package/docs/guide/fleet-dispatch.md +3 -2
  311. package/docs/guide/glossary.md +1 -1
  312. package/docs/guide/installation-and-lifecycle.md +2 -2
  313. package/docs/guide/resource-library.md +1 -1
  314. package/docs/guide/tool-usage.md +166 -64
  315. package/docs/guide/troubleshooting.md +1 -1
  316. package/docs/process/documentation-guide.md +1 -0
  317. package/docs/process/fleet-demo-runbook.md +6 -6
  318. package/docs/process/scientific-validation.md +22 -2
  319. package/docs/process/tool-audit-v0.4.9.md +357 -0
  320. package/package.json +1 -1
  321. package/src/cli/argv.ts +31 -0
  322. package/src/cli/clio.ts +17 -13
  323. package/src/cli/config.ts +4 -0
  324. package/src/cli/doctor-panes.ts +1 -1
  325. package/src/cli/doctor.ts +3 -1
  326. package/src/cli/index.ts +14 -1
  327. package/src/cli/mcp.ts +106 -0
  328. package/src/cli/skills-eval.ts +8 -2
  329. package/src/cli/upgrade.ts +34 -38
  330. package/src/cli/verifiers.ts +1 -1
  331. package/src/core/bash-exec.ts +27 -4
  332. package/src/core/config.ts +2 -1
  333. package/src/core/defaults.ts +10 -1
  334. package/src/core/event-bus.ts +1 -1
  335. package/src/core/run-records.ts +438 -0
  336. package/src/core/safe-exec.ts +506 -56
  337. package/src/core/skill-activation.ts +5 -3
  338. package/src/core/termination.ts +3 -3
  339. package/src/core/tool-names.ts +33 -12
  340. package/src/domains/context/clio-md.ts +1 -1
  341. package/src/domains/context/worker/pressure.ts +6 -2
  342. package/src/domains/context/working-set/path-index.ts +7 -2
  343. package/src/domains/dispatch/code-step.ts +7 -2
  344. package/src/domains/dispatch/contract.ts +7 -0
  345. package/src/domains/dispatch/execution-role.ts +3 -3
  346. package/src/domains/dispatch/execution-scheduler.ts +204 -79
  347. package/src/domains/dispatch/extension.ts +131 -14
  348. package/src/domains/dispatch/fleet-preflight.ts +18 -3
  349. package/src/domains/dispatch/fleet-run.ts +1 -0
  350. package/src/domains/dispatch/gate-decisions.ts +3 -3
  351. package/src/domains/dispatch/heartbeat.ts +1 -1
  352. package/src/domains/dispatch/host-verification.ts +16 -14
  353. package/src/domains/dispatch/receipt-findings.ts +3 -4
  354. package/src/domains/dispatch/reservation-store.ts +7 -9
  355. package/src/domains/dispatch/route-facts.ts +1 -1
  356. package/src/domains/dispatch/state.ts +3 -3
  357. package/src/domains/dispatch/types.ts +1 -1
  358. package/src/domains/evidence/build.ts +35 -7
  359. package/src/domains/gateway/mcp/client.ts +923 -0
  360. package/src/domains/gateway/mcp/config.ts +456 -0
  361. package/src/domains/gateway/mcp/index.ts +88 -0
  362. package/src/domains/gateway/mcp/protocol.ts +273 -0
  363. package/src/domains/gateway/mcp/trust.ts +263 -0
  364. package/src/domains/lifecycle/doctor.ts +17 -3
  365. package/src/domains/mux/contract.ts +5 -9
  366. package/src/domains/mux/detect.ts +1 -1
  367. package/src/domains/mux/extension.ts +1 -1
  368. package/src/domains/mux/protocol.ts +5 -7
  369. package/src/domains/mux/socket-client.ts +3 -3
  370. package/src/domains/observability/accountability.ts +2 -2
  371. package/src/domains/observability/contract.ts +7 -3
  372. package/src/domains/observability/evidence-index.ts +2 -2
  373. package/src/domains/observability/projection.ts +10 -0
  374. package/src/domains/prompts/compiler.ts +41 -23
  375. package/src/domains/prompts/fragments/identity/docs-routing.md +2 -2
  376. package/src/domains/prompts/fragments/operating/skills.md +12 -10
  377. package/src/domains/providers/index.ts +5 -1
  378. package/src/domains/providers/models/local-models/clio-coder-local-coding-targets.yaml +42 -10
  379. package/src/domains/providers/probe/http.ts +44 -59
  380. package/src/domains/providers/probe/reasoning.ts +2 -0
  381. package/src/domains/providers/runtimes/local-native/llamacpp-embed.ts +20 -31
  382. package/src/domains/providers/runtimes/local-native/llamacpp-rerank.ts +9 -4
  383. package/src/domains/safety/action-classifier.ts +17 -1
  384. package/src/domains/safety/call-target.ts +14 -0
  385. package/src/domains/safety/contract.ts +1 -1
  386. package/src/domains/safety/finish-contract.ts +9 -3
  387. package/src/domains/safety/loop-detector.ts +1 -1
  388. package/src/domains/safety/policy-engine.ts +7 -0
  389. package/src/domains/safety/protected-artifacts.ts +3 -4
  390. package/src/domains/safety/rejection-feedback.ts +1 -1
  391. package/src/domains/safety/scope.ts +2 -3
  392. package/src/domains/safety/validation-contract.ts +3 -2
  393. package/src/domains/scheduling/budget.ts +5 -3
  394. package/src/domains/scheduling/contract.ts +2 -1
  395. package/src/domains/scheduling/extension.ts +3 -3
  396. package/src/domains/session/compaction/branch-summary.ts +1 -1
  397. package/src/domains/session/compaction/compact.ts +25 -2
  398. package/src/domains/session/compaction/cut-point.ts +1 -1
  399. package/src/domains/session/compaction/tokens.ts +5 -10
  400. package/src/domains/session/contract.ts +1 -1
  401. package/src/domains/session/cwd-fallback.ts +2 -2
  402. package/src/domains/session/handoff.ts +5 -1
  403. package/src/domains/session/history.ts +6 -0
  404. package/src/domains/session/manager.ts +14 -7
  405. package/src/domains/session/retry.ts +2 -1
  406. package/src/domains/session/session-artifacts.ts +12 -7
  407. package/src/domains/session/task-board.ts +2 -3
  408. package/src/engine/apis/openai-completions.ts +8 -0
  409. package/src/engine/loop-guard.ts +7 -0
  410. package/src/engine/provider-error-body.ts +65 -0
  411. package/src/engine/session.ts +118 -29
  412. package/src/engine/worker-runtime.ts +3 -0
  413. package/src/entry/boot-options.ts +2 -0
  414. package/src/entry/orchestrator.ts +18 -2
  415. package/src/interactive/chat-loop-policy.ts +1 -0
  416. package/src/interactive/chat-loop.ts +8 -4
  417. package/src/interactive/chat-panel.ts +23 -9
  418. package/src/interactive/chat-renderer.ts +33 -11
  419. package/src/interactive/clio-editor.ts +13 -5
  420. package/src/interactive/dispatch-board.ts +70 -30
  421. package/src/interactive/editor-submit.ts +30 -25
  422. package/src/interactive/footer/widgets.ts +12 -9
  423. package/src/interactive/interactive-presentation.ts +2 -3
  424. package/src/interactive/mux-bridge.ts +3 -7
  425. package/src/interactive/overlay-general-openers.ts +14 -7
  426. package/src/interactive/overlays/cwd-fallback.ts +1 -1
  427. package/src/interactive/overlays/library-model.ts +114 -35
  428. package/src/interactive/overlays/library.ts +52 -5
  429. package/src/interactive/overlays/list-overlay.ts +4 -1
  430. package/src/interactive/overlays/session-selector.ts +28 -23
  431. package/src/interactive/overlays/settings.ts +20 -1
  432. package/src/interactive/overlays/tree-selector.ts +47 -10
  433. package/src/interactive/panes-runtime.ts +1 -1
  434. package/src/interactive/renderers/compaction-summary.ts +1 -1
  435. package/src/interactive/renderers/provider-error.ts +118 -0
  436. package/src/interactive/renderers/retry-status.ts +59 -23
  437. package/src/interactive/renderers/tool-execution.ts +67 -7
  438. package/src/interactive/renderers/worker-answer.ts +198 -0
  439. package/src/interactive/renderers/worker-entry.ts +57 -163
  440. package/src/interactive/slash-commands.ts +26 -1
  441. package/src/interactive/slash-spec.ts +2 -2
  442. package/src/interactive/theme/labels.ts +66 -30
  443. package/src/interactive/turn-persistence.ts +6 -1
  444. package/src/interactive/turn-recovery.ts +2 -1
  445. package/src/interactive/turn-runtime.ts +22 -5
  446. package/src/interactive/view/artifacts.ts +3 -2
  447. package/src/interactive/view/view-overlay.ts +96 -20
  448. package/src/tools/agent-tools.ts +21 -7
  449. package/src/tools/artifact.ts +16 -8
  450. package/src/tools/bash.ts +90 -11
  451. package/src/tools/bootstrap.ts +42 -4
  452. package/src/tools/builtin-tool-catalog.ts +72 -7
  453. package/src/tools/context/index.ts +27 -31
  454. package/src/tools/context/library.ts +3 -1
  455. package/src/tools/context/surface.ts +12 -26
  456. package/src/tools/core-bootstrap.ts +72 -1
  457. package/src/tools/data/csv.ts +1189 -0
  458. package/src/tools/data/index.ts +308 -0
  459. package/src/tools/data/json.ts +1799 -0
  460. package/src/tools/data/jsonl.ts +561 -0
  461. package/src/tools/data/shared.ts +452 -0
  462. package/src/tools/edit-diff.ts +0 -7
  463. package/src/tools/edit.ts +115 -18
  464. package/src/tools/file-mutation-queue.ts +114 -4
  465. package/src/tools/find.ts +108 -29
  466. package/src/tools/gateway/caps.ts +11 -0
  467. package/src/tools/gateway/clio-context-surface.ts +41 -0
  468. package/src/tools/gateway/clio-context-tools.ts +77 -0
  469. package/src/tools/gateway/data-surface.ts +138 -0
  470. package/src/tools/gateway/data-tool.ts +201 -0
  471. package/src/tools/gateway/index.ts +342 -0
  472. package/src/tools/gateway/mcp-capabilities.ts +469 -0
  473. package/src/tools/grep.ts +88 -33
  474. package/src/tools/harness-extensions.ts +3 -0
  475. package/src/tools/ignore-policy.ts +7 -5
  476. package/src/tools/ls.ts +111 -20
  477. package/src/tools/policy.ts +35 -13
  478. package/src/tools/presentation.ts +6 -0
  479. package/src/tools/read.ts +634 -156
  480. package/src/tools/registry.ts +94 -6
  481. package/src/tools/run-script.ts +997 -0
  482. package/src/tools/spawn-hygiene.ts +157 -5
  483. package/src/tools/surface.ts +163 -0
  484. package/src/tools/verify/authoring.ts +8 -3
  485. package/src/tools/verify/catalog.ts +14 -1
  486. package/src/tools/verify/numeric.ts +367 -59
  487. package/src/tools/verify/perf.ts +171 -9
  488. package/src/tools/verify/scripts.ts +178 -26
  489. package/src/tools/web-fetch-surface.ts +22 -0
  490. package/src/tools/web-fetch.ts +26 -1
  491. package/src/tools/write.ts +45 -19
  492. package/dist/chunk-B6UM3OZC.js +0 -15
  493. package/dist/chunk-GJ24ODAX.js +0 -196
  494. package/dist/chunk-LZCCBLRC.js +0 -57
  495. package/dist/web/client/assets/architecture-7GRP2DOG-EGozsYEO.js +0 -1
  496. package/dist/web/client/assets/architectureDiagram-5GKGNRK7-z9FokbJl.js +0 -36
  497. package/dist/web/client/assets/channel-CiUWbHN9.js +0 -1
  498. package/dist/web/client/assets/chunk-DU6HZSFF-C5USiOAy.js +0 -125
  499. package/dist/web/client/assets/classDiagram-ZZMXUADV-CMODalmo.js +0 -1
  500. package/dist/web/client/assets/classDiagram-v2-VYDZK3BY-CMODalmo.js +0 -1
  501. package/dist/web/client/assets/cose-bilkent-JH36ORCC-RbQL23qS.js +0 -1
  502. package/dist/web/client/assets/dist-D0_q-A2b.js +0 -1
  503. package/dist/web/client/assets/eventmodeling-NTZA5JFV-DjVq8wKU.js +0 -1
  504. package/dist/web/client/assets/flowDiagram-HODETNUW-BUiCBGXt.js +0 -1
  505. package/dist/web/client/assets/ganttDiagram-EL5Y4UJY-B2lb8lvF.js +0 -292
  506. package/dist/web/client/assets/index-FSIC94pi.js +0 -83
  507. package/dist/web/client/assets/prism-core-BngLtbUd.js +0 -1
  508. package/dist/web/client/assets/railroad-abnf-HS5TGJTU-BcW01NZG.js +0 -1
  509. package/dist/web/client/assets/railroad-ebnf-LZEXJU2U-B7YCEDDd.js +0 -1
  510. package/dist/web/client/assets/railroad-peg-WCYAUIDC-DjNZbSTZ.js +0 -1
  511. package/dist/web/client/assets/src-yeptRXpt.js +0 -1
  512. package/dist/web/client/assets/stateDiagram-v2-MP3YSRHH-C7QtHeK4.js +0 -1
  513. package/dist/web/client/assets/swimlanesDiagram-VR7AAH4N-CBZlPFky.js +0 -8
@@ -2,20 +2,6 @@ import { createRequire as __clioCreateRequire } from "node:module"; const requir
2
2
  import {
3
3
  planWikiGeneration
4
4
  } from "./chunk-PECBKCDK.js";
5
- import {
6
- applyTaskWorktree,
7
- captureWorkspaceCheckpoint,
8
- captureWorkspaceSnapshot,
9
- cleanupTaskWorktree,
10
- createTaskWorktree,
11
- createWriteBoundaryEnforcer,
12
- gitCheckoutRoot,
13
- workspaceCheckpointRef
14
- } from "./chunk-K53E2PTW.js";
15
- import {
16
- executionPlanAncestors,
17
- spliceExecutionPlan
18
- } from "./chunk-L75H5B3B.js";
19
5
  import {
20
6
  decideReviewGate,
21
7
  materializePendingGateDecision,
@@ -23,7 +9,7 @@ import {
23
9
  readGateDecisionArtifactsForRunIds,
24
10
  stagePendingGateDecision,
25
11
  verifyGateDecisionArtifact
26
- } from "./chunk-H77XBUBM.js";
12
+ } from "./chunk-NMBEW4PP.js";
27
13
  import {
28
14
  RUN_RECEIPT_INTEGRITY_ALGORITHM,
29
15
  RUN_RECEIPT_INTEGRITY_VERSION,
@@ -43,14 +29,32 @@ import {
43
29
  trustVerdict,
44
30
  verifyReceiptIntegrity,
45
31
  withReceiptIntegrity
46
- } from "./chunk-FB3KTE2J.js";
32
+ } from "./chunk-IALZJE37.js";
47
33
  import {
48
34
  protectedArtifactFromSessionEntry,
49
35
  protectedArtifactStateFromSessionEntries,
50
36
  readAuditRows,
51
37
  readSessionEntriesForId,
52
38
  responseModelIdObservationFromRecord
53
- } from "./chunk-BIY22UUK.js";
39
+ } from "./chunk-3SUDBGEI.js";
40
+ import {
41
+ codeStepDir,
42
+ writeCodeStepRecord
43
+ } from "./chunk-LGTVWPRN.js";
44
+ import {
45
+ applyTaskWorktree,
46
+ captureWorkspaceCheckpoint,
47
+ captureWorkspaceSnapshot,
48
+ cleanupTaskWorktree,
49
+ createTaskWorktree,
50
+ createWriteBoundaryEnforcer,
51
+ gitCheckoutRoot,
52
+ workspaceCheckpointRef
53
+ } from "./chunk-KRJQG47M.js";
54
+ import {
55
+ executionPlanAncestors,
56
+ spliceExecutionPlan
57
+ } from "./chunk-DIAJYJYG.js";
54
58
  import {
55
59
  loadEvalArtifact,
56
60
  parseEvalArtifactV4,
@@ -58,9 +62,13 @@ import {
58
62
  sumEvalHarnessMetrics
59
63
  } from "./chunk-U44YYLVV.js";
60
64
  import {
61
- codeStepDir,
62
- writeCodeStepRecord
63
- } from "./chunk-QYSAZMSH.js";
65
+ parseRigorOverride,
66
+ resolveRigor
67
+ } from "./chunk-GREYLTZ5.js";
68
+ import {
69
+ describeValidationContract,
70
+ loadValidationContract
71
+ } from "./chunk-PTFISXQO.js";
64
72
  import {
65
73
  filterEntriesToActivePath
66
74
  } from "./chunk-O5F25NIE.js";
@@ -68,6 +76,10 @@ import {
68
76
  defaultRunEventJournal,
69
77
  removeRunEventJournals
70
78
  } from "./chunk-UQIVHSE4.js";
79
+ import {
80
+ createTomlFileReader,
81
+ tomlTableAt
82
+ } from "./chunk-LQTKDAUO.js";
71
83
  import {
72
84
  AdmissionCanceledError,
73
85
  EVENT_TEE_LIMIT,
@@ -77,11 +89,7 @@ import {
77
89
  foldDecisionBoard,
78
90
  startDispatchEventPump,
79
91
  workerOutputCaptureBytes
80
- } from "./chunk-STC6CWUZ.js";
81
- import {
82
- judgeNumericTexts,
83
- judgePerfTexts
84
- } from "./chunk-RKFNU5UA.js";
92
+ } from "./chunk-K3XN4LZ4.js";
85
93
  import {
86
94
  changedPathsSince,
87
95
  computeWikiContentHash,
@@ -95,6 +103,17 @@ import {
95
103
  writeWikiMeta,
96
104
  writeWikiMetaInDir
97
105
  } from "./chunk-YQ3GFEUY.js";
106
+ import {
107
+ readClioState,
108
+ statePath,
109
+ writeClioState
110
+ } from "./chunk-WTQGRBHV.js";
111
+ import {
112
+ buildCodewikiCandidate,
113
+ coordinateCodewikiExclusive,
114
+ coordinateCodewikiWrite,
115
+ drainCodewikiWrites
116
+ } from "./chunk-WWRV5RJI.js";
98
117
  import {
99
118
  WIKI_INDEX,
100
119
  WIKI_PLAN_FILE,
@@ -115,16 +134,15 @@ import {
115
134
  writeWikiPlanFile
116
135
  } from "./chunk-BHJMMCXS.js";
117
136
  import {
118
- readClioState,
119
- statePath,
120
- writeClioState
121
- } from "./chunk-WTQGRBHV.js";
137
+ FLEET_COMMAND_BASE_ENV,
138
+ normalizeWriteBoundary,
139
+ validateFleetCommandArgs
140
+ } from "./chunk-7QQRPB2E.js";
122
141
  import {
123
- buildCodewikiCandidate,
124
- coordinateCodewikiExclusive,
125
- coordinateCodewikiWrite,
126
- drainCodewikiWrites
127
- } from "./chunk-WWRV5RJI.js";
142
+ JUDGED_CHECK_MAX_OUTPUT_BYTES,
143
+ judgeNumericTexts,
144
+ judgePerfTexts
145
+ } from "./chunk-QI72X67S.js";
128
146
  import {
129
147
  LOCAL_NODE_ID,
130
148
  computeSettingsFingerprint,
@@ -135,28 +153,11 @@ import {
135
153
  receiptAttestationFields,
136
154
  routeFactVerdict,
137
155
  spawnNativeWorker
138
- } from "./chunk-JRA6OBHY.js";
139
- import {
140
- createTomlFileReader,
141
- tomlTableAt
142
- } from "./chunk-LQTKDAUO.js";
143
- import {
144
- parseRigorOverride,
145
- resolveRigor
146
- } from "./chunk-2ZWLMA3T.js";
147
- import {
148
- describeValidationContract,
149
- loadValidationContract
150
- } from "./chunk-RFULVPBX.js";
151
- import {
152
- FLEET_COMMAND_BASE_ENV,
153
- normalizeWriteBoundary,
154
- validateFleetCommandArgs
155
- } from "./chunk-7QQRPB2E.js";
156
+ } from "./chunk-A6DULIMH.js";
156
157
  import {
157
158
  AcpTimeoutError,
158
159
  createStdioTransport
159
- } from "./chunk-WS4FOGLY.js";
160
+ } from "./chunk-XNZWWDC3.js";
160
161
  import {
161
162
  AGENT_LEDGER_PROMPT_MAX_CHARS,
162
163
  COUNCIL_MIN_MEMBERS,
@@ -198,7 +199,7 @@ import {
198
199
  serializeWorkerRuntimeDescriptor,
199
200
  toolPromptHintsForNames,
200
201
  validateJobSpec
201
- } from "./chunk-MWMW53WW.js";
202
+ } from "./chunk-4ATBOFRP.js";
202
203
  import {
203
204
  WORKER_CONTEXT_MAX_BYTES,
204
205
  completeHistoryLength,
@@ -221,7 +222,10 @@ import {
221
222
  routingIntentRejection,
222
223
  sameRouteIdentity,
223
224
  toRouteCandidate
224
- } from "./chunk-RM3XJX7P.js";
225
+ } from "./chunk-MO65K5CH.js";
226
+ import {
227
+ assessFinishContract
228
+ } from "./chunk-AY4XE6GN.js";
225
229
  import {
226
230
  isLoadableExtension
227
231
  } from "./chunk-OH3YYA3B.js";
@@ -229,13 +233,18 @@ import {
229
233
  extensionToolName,
230
234
  listInstalledExtensions
231
235
  } from "./chunk-6TKOFFGE.js";
236
+ import {
237
+ directSurfaceNames,
238
+ effectiveToolCall,
239
+ withGatewayForCapabilities
240
+ } from "./chunk-2JBZYUPY.js";
232
241
  import {
233
242
  describeCallAction
234
- } from "./chunk-2GPGAE5W.js";
243
+ } from "./chunk-XNIZBOFV.js";
235
244
  import {
236
245
  applyToolProfile,
237
246
  assertToolProfileEnforceable
238
- } from "./chunk-GEVQNST4.js";
247
+ } from "./chunk-XZWSP67B.js";
239
248
  import {
240
249
  dispatchResultContract,
241
250
  gateRouteCorrelation,
@@ -243,34 +252,7 @@ import {
243
252
  requestExecutionRole,
244
253
  routeCorrelationFactsForRun,
245
254
  withAttemptRole
246
- } from "./chunk-FNVPQQYT.js";
247
- import {
248
- declaredScopeIntent,
249
- declaredScopeReplacementDiagnostic,
250
- declaredScopeReplacementNotice,
251
- inferredScopeParentTokenDiagnostic,
252
- inferredScopeParentTokenNotice,
253
- resolveDispatchPathScope
254
- } from "./chunk-L4N3DWNW.js";
255
- import {
256
- networkToolsDisabled
257
- } from "./chunk-SL2RDHKO.js";
258
- import {
259
- TOOL_RESULT_TRUST_CONTRACT
260
- } from "./chunk-WXA2CFJO.js";
261
- import {
262
- compileGlobRegex,
263
- normalizeGlobInput
264
- } from "./chunk-V552WL53.js";
265
- import {
266
- WORKER_STDIN_FRAME_MAX_BYTES,
267
- canonicalJson,
268
- endpointIdentityHash,
269
- parseAgentLedgerBody
270
- } from "./chunk-VQD7NH7Z.js";
271
- import {
272
- assessFinishContract
273
- } from "./chunk-MUXNDNMZ.js";
255
+ } from "./chunk-H6IUCY6Q.js";
274
256
  import {
275
257
  canonicalEndpointKey,
276
258
  canonicalizeWireModelId,
@@ -289,29 +271,27 @@ import {
289
271
  resolveRuntimeTarget,
290
272
  runtimeResolutionWarnings,
291
273
  runtimeTargetSnapshot
292
- } from "./chunk-GVU4CXPJ.js";
274
+ } from "./chunk-4HFJKRGZ.js";
293
275
  import {
294
276
  ceilChars,
295
277
  estimateAgentMessageTokens
296
- } from "./chunk-OPC4DQD6.js";
278
+ } from "./chunk-SJMNU4ZS.js";
297
279
  import {
298
- WRITE_ROOT_REFUSED_TOOLS
299
- } from "./chunk-RAUOKUZV.js";
300
- import {
301
- resolveEffectivePricing
302
- } from "./chunk-UDAK6GR2.js";
280
+ BusChannels
281
+ } from "./chunk-W5RM7YAH.js";
303
282
  import {
304
- compareCodepoints
305
- } from "./chunk-B6UM3OZC.js";
283
+ networkToolsDisabled
284
+ } from "./chunk-SL2RDHKO.js";
306
285
  import {
307
- truncateUtf8
308
- } from "./chunk-MYI32N4R.js";
286
+ compileGlobRegex,
287
+ normalizeGlobInput
288
+ } from "./chunk-IZZI3SKQ.js";
309
289
  import {
310
- BusChannels
311
- } from "./chunk-W5RM7YAH.js";
290
+ WRITE_ROOT_REFUSED_TOOLS
291
+ } from "./chunk-IC7JXLOM.js";
312
292
  import {
313
- targetRequiresAuth
314
- } from "./chunk-PAQVETLA.js";
293
+ TOOL_RESULT_TRUST_CONTRACT
294
+ } from "./chunk-WXA2CFJO.js";
315
295
  import {
316
296
  agentSpecFingerprint,
317
297
  assertAgentSpecPolicy,
@@ -321,24 +301,38 @@ import {
321
301
  resolveAgentToolCompatibility,
322
302
  resultContractAuthorship,
323
303
  validateRecipeResult
324
- } from "./chunk-ARRUMZ7X.js";
304
+ } from "./chunk-I47EJPYL.js";
325
305
  import {
326
306
  INTEROP_AGENT_KINDS
327
307
  } from "./chunk-5EQO5NWP.js";
328
308
  import {
329
309
  classify
330
- } from "./chunk-YXFKLMX2.js";
310
+ } from "./chunk-H2WSCZZT.js";
331
311
  import {
332
312
  detectValidationCommand
333
- } from "./chunk-E2NSPYLC.js";
313
+ } from "./chunk-SQBT46OF.js";
314
+ import {
315
+ canonicalizeExistingPath
316
+ } from "./chunk-KQ6IDQIB.js";
317
+ import {
318
+ declaredScopeIntent,
319
+ declaredScopeReplacementDiagnostic,
320
+ declaredScopeReplacementNotice,
321
+ inferredScopeParentTokenDiagnostic,
322
+ inferredScopeParentTokenNotice,
323
+ resolveDispatchPathScope
324
+ } from "./chunk-L4N3DWNW.js";
325
+ import {
326
+ compareCodepoints
327
+ } from "./chunk-2KUBKL63.js";
328
+ import {
329
+ truncateUtf8
330
+ } from "./chunk-MYI32N4R.js";
334
331
  import {
335
332
  PATH_BOUNDARY_MAX_ENTRIES,
336
333
  pathBoundaryCovers,
337
334
  resolvePathBoundary
338
335
  } from "./chunk-R2P2U3ZS.js";
339
- import {
340
- canonicalizeExistingPath
341
- } from "./chunk-KQ6IDQIB.js";
342
336
  import {
343
337
  isProjectVerifierCheckId,
344
338
  isVerificationScriptName
@@ -347,20 +341,32 @@ import {
347
341
  ToolNames,
348
342
  isBuiltinToolName,
349
343
  isHarnessExtensionToolName
350
- } from "./chunk-WLHX3MM5.js";
344
+ } from "./chunk-V4XJWDHR.js";
351
345
  import {
352
346
  DEFAULT_DELEGATION_CONNECT_TIMEOUT_MS,
353
347
  DEFAULT_DELEGATION_TURN_TIMEOUT_MS,
354
348
  DEFAULT_SETTINGS,
355
349
  THINKING_LEVELS
356
- } from "./chunk-3XE4NRLF.js";
350
+ } from "./chunk-ZKJU55MX.js";
357
351
  import {
358
352
  GUARDRAIL_DEFAULTS,
359
353
  resolveGuardrail
360
354
  } from "./chunk-C27U2TYG.js";
355
+ import {
356
+ targetRequiresAuth
357
+ } from "./chunk-ZKVMDNAN.js";
361
358
  import {
362
359
  require_dist
363
360
  } from "./chunk-B5GGDIHT.js";
361
+ import {
362
+ resolveEffectivePricing
363
+ } from "./chunk-JIYWMQZ5.js";
364
+ import {
365
+ WORKER_STDIN_FRAME_MAX_BYTES,
366
+ canonicalJson,
367
+ endpointIdentityHash,
368
+ parseAgentLedgerBody
369
+ } from "./chunk-VQD7NH7Z.js";
364
370
  import {
365
371
  attributeCommitMessage,
366
372
  gitCommitAttributionEnabled,
@@ -377,28 +383,30 @@ import {
377
383
  decisionRef,
378
384
  isDecisionRecord,
379
385
  isSkillActivation
380
- } from "./chunk-6R5MBXBJ.js";
386
+ } from "./chunk-NBPA5QM6.js";
387
+ import {
388
+ DEFAULT_AUTONOMY_LEVEL,
389
+ autonomyDenyRejection,
390
+ isAutonomyLevel,
391
+ mapAutonomy,
392
+ modelMayActivateSkills
393
+ } from "./chunk-EM2WNQS2.js";
381
394
  import {
382
395
  createRedactionTally,
383
396
  redactSecretsDeep,
384
397
  redactSecretsText
385
398
  } from "./chunk-O3VV6IVK.js";
386
399
  import {
387
- DEFAULT_AUTONOMY_LEVEL,
388
- autonomyDenyRejection,
389
- mapAutonomy
390
- } from "./chunk-EM2WNQS2.js";
400
+ FILE_LOCK_ACQUIRE_TIMEOUT_MS,
401
+ withStateFileLock,
402
+ withStateFileLockSync
403
+ } from "./chunk-DVJL77SO.js";
391
404
  import {
392
405
  atomicWrite
393
- } from "./chunk-36XSBPXL.js";
406
+ } from "./chunk-3RDHGNU7.js";
394
407
  import {
395
408
  assertSafeId
396
409
  } from "./chunk-UHW5V7HC.js";
397
- import {
398
- FILE_LOCK_ACQUIRE_TIMEOUT_MS,
399
- withStateFileLock,
400
- withStateFileLockSync
401
- } from "./chunk-DVJL77SO.js";
402
410
  import {
403
411
  normalizeClioCoderEventRecord,
404
412
  normalizeClioCoderEventType
@@ -1161,7 +1169,7 @@ function normalizeNestedMarkdown(value) {
1161
1169
  let cursor = 0;
1162
1170
  for (const match of mask.matchAll(/^(#{1,2})(\s+)/gm)) {
1163
1171
  if (match.index === void 0) continue;
1164
- out3 += body.slice(cursor, match.index) + "###" + (match[2] ?? "");
1172
+ out3 += `${body.slice(cursor, match.index)}###${match[2] ?? ""}`;
1165
1173
  cursor = match.index + match[0].length;
1166
1174
  }
1167
1175
  return out3 + body.slice(cursor);
@@ -6418,26 +6426,33 @@ function renderToolContractBlock(inputs) {
6418
6426
  "This target cannot call tools; answer from the visible user request and compact context only."
6419
6427
  ].join("\n");
6420
6428
  }
6421
- const names = [
6429
+ const capabilityNames = [
6422
6430
  ...new Set((inputs.toolNames ?? []).map((name2) => name2.trim()).filter((name2) => name2.length > 0))
6423
6431
  ].sort();
6432
+ const names = directSurfaceNames(capabilityNames).sort();
6424
6433
  const canDispatch = sessionCanDispatch(inputs);
6425
6434
  const canListSkills = sessionHasContext(inputs);
6426
6435
  const admitted = new Set(names);
6436
+ const hasGateway = admitted.has("gateway");
6427
6437
  const inventoryGuidance = [
6428
6438
  "When asked what tools you have, copy the Direct tools line verbatim and call nothing",
6429
6439
  ...canDispatch ? [
6430
6440
  "dispatch(list:true) answers a question about agents, the fleet, or which target and model run this session and its workers"
6431
6441
  ] : [],
6432
- ...canListSkills ? ['context(scope="skills") answers only a question about skills'] : []
6442
+ ...canListSkills ? ['context(scope="skills") lists skills for discovery or skill questions'] : [],
6443
+ ...hasGateway ? ['gateway(op="find") answers a question about secondary capabilities'] : []
6433
6444
  ].join("; ");
6434
6445
  const capabilityKinds = [
6435
6446
  "direct tools are attached schemas",
6447
+ ...hasGateway ? ["secondary capabilities are reached through gateway find, describe, and call"] : [],
6436
6448
  ...canDispatch ? ["fleet agents are workers behind dispatch"] : [],
6437
- ...canListSkills ? ["skills are operator-activated workflows reached through context"] : []
6449
+ ...canListSkills ? ["skills are workflows reached through context"] : []
6438
6450
  ];
6439
6451
  const orientationTools = ["context", "code_nav", "grep", "read"].filter((name2) => admitted.has(name2));
6440
- const validationTools = ["verify", "git"].filter((name2) => admitted.has(name2));
6452
+ const validationTools = [
6453
+ ...admitted.has("verify") ? ["verify"] : [],
6454
+ ...admitted.has("git") ? ["git diff"] : hasGateway ? ['gateway(op="call", capability="git") diff'] : []
6455
+ ];
6441
6456
  const lines = [
6442
6457
  "# Tool Contract",
6443
6458
  TOOL_RESULT_TRUST_CONTRACT,
@@ -6454,12 +6469,10 @@ function renderToolContractBlock(inputs) {
6454
6469
  ...orientationTools.length > 0 ? [
6455
6470
  `For narrow file or symbol orientation, prefer ${orientationTools.join(", ")} instead of assuming source-tree details were preloaded.`
6456
6471
  ] : [],
6457
- ...validationTools.length > 0 ? [
6458
- `Validate with ${validationTools.map((name2) => name2 === "git" ? "git diff" : name2).join(" or ")} before final claims.`
6459
- ] : [],
6460
- `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` : ""}.`
6472
+ ...validationTools.length > 0 ? [`Validate with ${validationTools.join(" or ")} before final claims.`] : [],
6473
+ `When a tool call fails or is rejected, do not retry the same shape blindly: re-read the schema and adjust the arguments${hasGateway ? `, or read that tool's usage with gateway(op="call", capability="clio_docs", args={query})` : ""}.`
6461
6474
  ];
6462
- const hints = canonicalToolPromptHints(inputs.toolPromptHints ?? [], new Set(names));
6475
+ const hints = canonicalToolPromptHints(inputs.toolPromptHints ?? [], /* @__PURE__ */ new Set([...capabilityNames, ...names]));
6463
6476
  for (const entry of hints) {
6464
6477
  lines.push(entry.hint);
6465
6478
  }
@@ -6512,7 +6525,7 @@ function renderWorkerToolContractBlock(inputs) {
6512
6525
  TOOL_RESULT_TRUST_CONTRACT,
6513
6526
  "The attached schemas are this worker's complete canonical tool surface; follow each schema exactly.",
6514
6527
  `Admitted canonical tools: ${names.map((name2) => `\`${name2}\``).join(", ")}.`,
6515
- "This worker surface is distinct from the parent session's tools, fleet agents, and operator-activated skills.",
6528
+ "This worker surface is distinct from the parent session's tools, fleet agents, and skills.",
6516
6529
  "Tool authority is limited to this list. Persona and bound-skill instructions never add tools.",
6517
6530
  "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."
6518
6531
  ];
@@ -6615,7 +6628,7 @@ function compile(table, inputs) {
6615
6628
  };
6616
6629
  let identityBody = identity.body;
6617
6630
  const selfAwareness = identity.id === "identity.clio" ? table.byId.get("identity.self-awareness") : void 0;
6618
- const docsRouting = selfAwareness && sessionHasContext(session) ? table.byId.get("identity.docs-routing") : void 0;
6631
+ const docsRouting = selfAwareness && session.providerSupportsTools !== false && toolSurfaceHasTool(session.toolNames, "gateway") ? table.byId.get("identity.docs-routing") : void 0;
6619
6632
  if (selfAwareness) {
6620
6633
  const packageRoot = resolvePackageRoot();
6621
6634
  const clioDirs = resolveClioDirs();
@@ -6626,12 +6639,13 @@ function compile(table, inputs) {
6626
6639
  }
6627
6640
  const delegation = sessionCanDispatch(session) ? table.byId.get("operating.delegation") : void 0;
6628
6641
  const skills = sessionHasContext(session) ? table.byId.get("operating.skills") : void 0;
6642
+ const skillActivation = isAutonomyLevel(autonomyLevel) && modelMayActivateSkills(autonomyLevel) ? 'Load matching installed skills with context(scope="skills", name="<name>") and continue the task; skill restrictions still apply.' : "Suggest matching skills as /skill <name> (in order when several compose), then continue without them; only the operator activates skills.";
6629
6643
  const legacy = inputs.sectionOrder === "legacy-0.3.8";
6630
6644
  const rendered = /* @__PURE__ */ new Map([
6631
6645
  ["identity", identityBody],
6632
6646
  ["operating-contract", operatingContract.body],
6633
6647
  ["delegation", delegation?.body ?? ""],
6634
- ["skills", skills?.body ?? ""],
6648
+ ["skills", skills?.body.replace("{SKILL_ACTIVATION_POLICY}", skillActivation) ?? ""],
6635
6649
  ["safety", renderSafetySection(safety, autonomyLevel)],
6636
6650
  ["runtime", renderRuntimeBlock(session)],
6637
6651
  ["tool-contract", renderToolContractBlock(session)],
@@ -9119,6 +9133,9 @@ function newCodeRunId() {
9119
9133
  }
9120
9134
  async function spawnCommand(input, cwd, argv) {
9121
9135
  const command = input.command;
9136
+ const captureMaxBytes = input.maxOutputBytes ?? CODE_STEP_CAPTURE_MAX_BYTES;
9137
+ if (!Number.isSafeInteger(captureMaxBytes) || captureMaxBytes <= 0)
9138
+ throw new Error("code step: maxOutputBytes must be a positive safe integer");
9122
9139
  const [executable, ...args] = argv;
9123
9140
  if (executable === void 0) throw new Error(`code step: command '${command.id}' has no executable`);
9124
9141
  return await new Promise((resolvePromise) => {
@@ -9145,8 +9162,8 @@ async function spawnCommand(input, cwd, argv) {
9145
9162
  });
9146
9163
  const collect = (chunk, stdout) => {
9147
9164
  outputBytes += chunk.length;
9148
- if (captured >= CODE_STEP_CAPTURE_MAX_BYTES) return;
9149
- const room = CODE_STEP_CAPTURE_MAX_BYTES - captured;
9165
+ if (captured >= captureMaxBytes) return;
9166
+ const room = captureMaxBytes - captured;
9150
9167
  const slice = chunk.length <= room ? chunk : chunk.subarray(0, room);
9151
9168
  chunks.push(slice);
9152
9169
  if (stdout) stdoutChunks.push(slice);
@@ -9286,7 +9303,7 @@ ${spawned.spawnError}
9286
9303
 
9287
9304
  // src/domains/dispatch/host-verification.ts
9288
9305
  var OUTPUT_TAIL_BYTES = 2048;
9289
- var MEMO_VERSION = 2;
9306
+ var MEMO_VERSION = 3;
9290
9307
  var HTTP_URL_RE = /\bhttps?:\/\/\S+/gu;
9291
9308
  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;
9292
9309
  var IMPLICATED_PATH_CAP = PATH_BOUNDARY_MAX_ENTRIES;
@@ -9379,7 +9396,8 @@ function judgeResolvedCheck(resolvedCheck, exitCode, durationMs2, stdout) {
9379
9396
  stdout,
9380
9397
  referenceText,
9381
9398
  resolvedCheck.numeric.tolerance,
9382
- `reference '${resolvedCheck.numeric.reference}'`
9399
+ `reference '${resolvedCheck.numeric.reference}'`,
9400
+ resolvedCheck.numeric.reference
9383
9401
  );
9384
9402
  if (report instanceof Error) return { exitCode: 1, outputTail: `numeric-compare: ${report.message}` };
9385
9403
  return { exitCode: report.passed ? 0 : 1, report, outputTail: outputTail(report.summary) };
@@ -9417,20 +9435,21 @@ async function runResolvedCheck(input) {
9417
9435
  outputExcerpt: ""
9418
9436
  };
9419
9437
  }
9438
+ const judged = resolvedCheck.kind === "numeric-compare" || resolvedCheck.kind === "perf-budget";
9439
+ const captureMaxBytes = judged ? JUDGED_CHECK_MAX_OUTPUT_BYTES : CODE_STEP_CAPTURE_MAX_BYTES;
9420
9440
  const outcome = await runCodeStep({
9421
9441
  stepId: `verification-${input.index + 1}-${resolvedCheck.check.replace(/[^a-z0-9._-]/giu, "_")}`,
9422
9442
  command,
9423
9443
  workspaceRoot: resolvedCheck.cwd,
9424
9444
  artifactDir: join19(input.stateDir, "artifacts", input.runId, "verification"),
9425
- env: input.env
9445
+ env: input.env,
9446
+ maxOutputBytes: captureMaxBytes
9426
9447
  });
9427
9448
  const artifactPath = outcome.record.artifactPaths[0];
9428
- const judgement = judgeResolvedCheck(
9429
- resolvedCheck,
9430
- outcome.record.exitCode,
9431
- outcome.record.durationMs,
9432
- outcome.stdout
9433
- );
9449
+ const judgement = judged && outcome.record.outputTruncated && outcome.record.outputBytes > captureMaxBytes ? {
9450
+ exitCode: 1,
9451
+ outputTail: `verify: ${resolvedCheck.kind} command output exceeded ${captureMaxBytes} bytes before judgement; captured output was truncated`
9452
+ } : judgeResolvedCheck(resolvedCheck, outcome.record.exitCode, outcome.record.durationMs, outcome.stdout);
9434
9453
  const check = {
9435
9454
  check: resolvedCheck.check,
9436
9455
  argv: [...outcome.record.argv],
@@ -9493,11 +9512,7 @@ function checkDedupeKey(resolvedCheck) {
9493
9512
  numeric: numeric === void 0 ? void 0 : {
9494
9513
  reference: numeric.reference,
9495
9514
  referenceDigest: sha2564(JSON.stringify(readSealedFile(numeric.reference) ?? null)),
9496
- tolerance: {
9497
- absolute: numeric.tolerance.absolute,
9498
- relative: numeric.tolerance.relative,
9499
- ulp: numeric.tolerance.ulp
9500
- }
9515
+ tolerance: numeric.tolerance
9501
9516
  },
9502
9517
  perf: perf === void 0 ? void 0 : {
9503
9518
  budget: perf.budget === void 0 ? void 0 : {
@@ -12572,21 +12587,25 @@ function effectiveToolNames(allowedTools, target, writeConfined = false, denied
12572
12587
  const networkStripped = networkToolsDisabled();
12573
12588
  const harnessTools = target.runtime.kind === "http" && !writeConfined && allowedTools.some(isHarnessExtensionToolName) ? enabledHarnessExtensionToolNames(cwd) : /* @__PURE__ */ new Set();
12574
12589
  const names = allowedTools.filter(
12575
- (tool) => (isBuiltinToolName(tool) || harnessTools.has(tool)) && tool !== ToolNames.AskUser && !(networkStripped && tool === ToolNames.WebFetch) && !denied.has(tool) && !(writeConfined && WRITE_ROOT_REFUSED_TOOLS.has(tool)) && (target.runtime.id !== "claude-sdk" || isClaudeCanonicalTool(tool))
12590
+ (tool) => (isBuiltinToolName(tool) || harnessTools.has(tool)) && tool !== ToolNames.AskUser && !(networkStripped && (tool === ToolNames.WebFetch || tool === ToolNames.WebRead)) && !denied.has(tool) && !(writeConfined && WRITE_ROOT_REFUSED_TOOLS.has(tool)) && (target.runtime.id !== "claude-sdk" || isClaudeCanonicalTool(tool))
12576
12591
  );
12577
- return [...new Set(names)].sort();
12592
+ const mediated = target.runtime.kind === "http" && target.runtime.id !== "claude-sdk";
12593
+ const surface = mediated ? withGatewayForCapabilities(names) : [...new Set(names)];
12594
+ return surface.sort();
12578
12595
  }
12579
12596
  function deniedToolNames(req) {
12580
12597
  if (!req.denyTools || req.denyTools.length === 0) return /* @__PURE__ */ new Set();
12581
12598
  return new Set(req.denyTools.map((tool) => tool.trim().toLowerCase()));
12582
12599
  }
12583
- function assertPostRuntimeToolCompatibility(agentId, spec, effectiveTools, target) {
12600
+ function assertPostRuntimeToolCompatibility(agentId, spec, effectiveTools, target, writeConfined) {
12584
12601
  const compatibility = resolveAgentToolCompatibility(spec, effectiveTools, {
12585
12602
  mediatesDispatch: WORKER_RUNTIME_MEDIATES_CLIO_DISPATCH
12586
12603
  });
12587
12604
  if (compatibility.compatible) return;
12605
+ const confined = writeConfined ? compatibility.missingRequired.filter((tool) => WRITE_ROOT_REFUSED_TOOLS.has(tool)) : [];
12606
+ const cause = confined.length > 0 ? `; declared write roots remove ${confined.join(", ")}, so omit write roots (use autonomy: "read-only" or worktree: true) for this agent` : "";
12588
12607
  throw new Error(
12589
- `dispatch: admission denied: agent '${agentId}' is incompatible with runtime '${target.runtime.id}' after tool narrowing; missing required tools: ${compatibility.missingRequired.join(", ")}`
12608
+ `dispatch: admission denied: agent '${agentId}' is incompatible with runtime '${target.runtime.id}' after tool narrowing; missing required tools: ${compatibility.missingRequired.join(", ")}${cause}`
12590
12609
  );
12591
12610
  }
12592
12611
  function workerToolCallHardCap(settings) {
@@ -13443,6 +13462,21 @@ function createDispatchBundle(context, options) {
13443
13462
  const retryBackoff = /* @__PURE__ */ new Map();
13444
13463
  const retryReasons = /* @__PURE__ */ new Map();
13445
13464
  const assignmentRootsByAttempt = /* @__PURE__ */ new Map();
13465
+ const controlRootsByAttempt = /* @__PURE__ */ new Map();
13466
+ const controlAttempts = /* @__PURE__ */ new Map();
13467
+ const canceledControlRoots = /* @__PURE__ */ new Set();
13468
+ const memberWork = /* @__PURE__ */ new Map();
13469
+ function trackMemberWork(runId, operation) {
13470
+ const root = controlRootsByAttempt.get(runId) ?? runId;
13471
+ const work = memberWork.get(root) ?? /* @__PURE__ */ new Set();
13472
+ memberWork.set(root, work);
13473
+ work.add(operation);
13474
+ const settled = () => {
13475
+ work.delete(operation);
13476
+ if (work.size === 0) memberWork.delete(root);
13477
+ };
13478
+ operation.then(settled, settled);
13479
+ }
13446
13480
  const assignments = new AssignmentRegistry({
13447
13481
  onStreamError: (error) => reportDispatchDiagnostic("assignment event stream", error)
13448
13482
  });
@@ -13468,6 +13502,11 @@ function createDispatchBundle(context, options) {
13468
13502
  function lineageFor(req, runId) {
13469
13503
  const lineage = req.lineage ? { ...req.lineage } : { parentRunId: null, rootRunId: runId, attempt: 0, depth: 0 };
13470
13504
  assignmentRootsByAttempt.set(runId, lineage.rootRunId);
13505
+ const parent = lineage.parentRunId === null ? void 0 : controlAttempts.get(lineage.parentRunId);
13506
+ const continuesParent = parent !== void 0 && parent.lineage.rootRunId === lineage.rootRunId && parent.lineage.depth === lineage.depth && parent.lineage.attempt + 1 === lineage.attempt && parent.reservation?.ownerId === req.reservation?.ownerId && parent.reservation?.memberId === req.reservation?.memberId;
13507
+ const priorControl = continuesParent && lineage.parentRunId !== null ? controlRootsByAttempt.get(lineage.parentRunId) : void 0;
13508
+ controlRootsByAttempt.set(runId, priorControl ?? runId);
13509
+ controlAttempts.set(runId, { lineage, reservation: req.reservation });
13471
13510
  return lineage;
13472
13511
  }
13473
13512
  function publishedLineage(lineage, hostRun) {
@@ -13511,7 +13550,8 @@ function createDispatchBundle(context, options) {
13511
13550
  capacityAdmission.releaseAssignment(rootRunId);
13512
13551
  }
13513
13552
  function retryChainIsLive(run) {
13514
- if (run.aborted) return false;
13553
+ if (run.aborted || canceledControlRoots.has(controlRootsByAttempt.get(run.runId) ?? run.lineage.rootRunId))
13554
+ return false;
13515
13555
  const reservation = run.req.reservation;
13516
13556
  if (reservation === void 0) return assignments.get(run.lineage.rootRunId)?.status === "running";
13517
13557
  try {
@@ -13570,9 +13610,16 @@ function createDispatchBundle(context, options) {
13570
13610
  const attempt = run.lineage.attempt + 1;
13571
13611
  const reason = detail !== null ? `${outcome}: ${detail}` : outcome;
13572
13612
  const dueAt = now() + delayMs;
13613
+ let settleCanceled;
13614
+ let rejectContinuation;
13615
+ const continuation = new Promise((resolve11, reject) => {
13616
+ settleCanceled = resolve11;
13617
+ rejectContinuation = reject;
13618
+ });
13619
+ trackMemberWork(run.runId, continuation);
13573
13620
  const timer = setTimeout(() => {
13574
13621
  retryQueue.delete(run.runId);
13575
- void executeRetry(run, attempt, reason, decision);
13622
+ executeRetry(run, attempt, reason, decision).then(settleCanceled, rejectContinuation);
13576
13623
  }, delayMs);
13577
13624
  retryQueue.set(run.runId, {
13578
13625
  runId: run.runId,
@@ -13584,7 +13631,8 @@ function createDispatchBundle(context, options) {
13584
13631
  excludedRouteParts: [...decision.excludedRouteParts],
13585
13632
  rootRunId,
13586
13633
  terminalCandidate: receipt,
13587
- timer
13634
+ timer,
13635
+ settleCanceled
13588
13636
  });
13589
13637
  context.bus.emit(BusChannels.DispatchProgress, {
13590
13638
  runId: run.runId,
@@ -13657,6 +13705,7 @@ function createDispatchBundle(context, options) {
13657
13705
  }
13658
13706
  };
13659
13707
  delete retryReq.runIdHint;
13708
+ let terminal;
13660
13709
  const reasonKey = retryReasonKey(run.lineage.rootRunId, attempt);
13661
13710
  retryReasons.set(reasonKey, reason);
13662
13711
  try {
@@ -13720,6 +13769,9 @@ function createDispatchBundle(context, options) {
13720
13769
  if (decision.excludedRouteParts.includes("runtime")) delete retryReq.workerRuntime;
13721
13770
  }
13722
13771
  const handle = await dispatch(retryReq, void 0, run.hostRun === void 0 ? void 0 : { hostRun: run.hostRun });
13772
+ if (canceledControlRoots.has(controlRootsByAttempt.get(run.runId) ?? run.lineage.rootRunId)) {
13773
+ contract.abort(handle.runId);
13774
+ }
13723
13775
  const marker = {
13724
13776
  type: "attempt_start",
13725
13777
  attempt,
@@ -13740,6 +13792,7 @@ function createDispatchBundle(context, options) {
13740
13792
  runtimeKind: run.runtimeKind,
13741
13793
  event: marker
13742
13794
  });
13795
+ terminal = handle.finalPromise;
13743
13796
  handle.finalPromise.catch((error) => {
13744
13797
  assignments.reject(asAssignmentId(run.lineage.rootRunId), error);
13745
13798
  reportDispatchDiagnostic(`finalize retry run ${handle.runId}`, error);
@@ -13770,6 +13823,7 @@ function createDispatchBundle(context, options) {
13770
13823
  outcomeDetail: denial
13771
13824
  });
13772
13825
  }
13826
+ await terminal;
13773
13827
  }
13774
13828
  function requireLedger() {
13775
13829
  if (!ledger) throw new Error("dispatch: ledger not initialised");
@@ -14064,7 +14118,7 @@ function createDispatchBundle(context, options) {
14064
14118
  ),
14065
14119
  req
14066
14120
  );
14067
- assertPostRuntimeToolCompatibility(req.agentId, spec, effectiveTools, target);
14121
+ assertPostRuntimeToolCompatibility(req.agentId, spec, effectiveTools, target, pathScope.writeBoundaries.length > 0);
14068
14122
  const effectiveAdmission = {
14069
14123
  ...admission,
14070
14124
  allowedTools: effectiveTools
@@ -15852,7 +15906,7 @@ function createDispatchBundle(context, options) {
15852
15906
  output: capturedOutput?.state === "final" ? capturedOutput.text : null,
15853
15907
  outputTruncated: capturedOutput?.truncated === true,
15854
15908
  cwd: lifecycle.cwd,
15855
- networkAllowed: lifecycle.admission.allowedTools.includes(ToolNames.WebFetch) || lifecycle.target.runtime.externalAgentLoop?.network === "externally-governed-unobserved",
15909
+ networkAllowed: lifecycle.admission.allowedTools.includes(ToolNames.WebFetch) || lifecycle.admission.allowedTools.includes(ToolNames.WebRead) || lifecycle.target.runtime.externalAgentLoop?.network === "externally-governed-unobserved",
15856
15910
  observedRunEffects,
15857
15911
  filesystem: nodeResultContractFilesystem()
15858
15912
  });
@@ -16122,7 +16176,11 @@ function createDispatchBundle(context, options) {
16122
16176
  const release = () => settlement.abandon(handle.runId);
16123
16177
  handle.finalPromise.then(release, release);
16124
16178
  }
16125
- if (req.lineage) return { ...handle, finalPromise: handle.finalPromise.finally(() => writerLease?.release()) };
16179
+ if (req.lineage) {
16180
+ const finalPromise = handle.finalPromise.finally(() => writerLease?.release());
16181
+ trackMemberWork(handle.runId, finalPromise);
16182
+ return { ...handle, finalPromise };
16183
+ }
16126
16184
  const assignment = assignments.open(handle.runId, assignmentPolicyFor(handle.effectiveRequest));
16127
16185
  persistAssignment(registerAssignment(assignment.id), `${assignment.id}:open`);
16128
16186
  assignments.attachAttempt(assignment.id, handle.events);
@@ -16209,7 +16267,13 @@ function createDispatchBundle(context, options) {
16209
16267
  ),
16210
16268
  req
16211
16269
  );
16212
- assertPostRuntimeToolCompatibility(req.agentId, agentSpec, effectiveTools, target);
16270
+ assertPostRuntimeToolCompatibility(
16271
+ req.agentId,
16272
+ agentSpec,
16273
+ effectiveTools,
16274
+ target,
16275
+ pathScope.writeBoundaries.length > 0
16276
+ );
16213
16277
  assertRuntimeCanHonorWorkerPermissionMode(target.runtime, settings?.fleet.permissions.mode ?? "deny");
16214
16278
  assertResponseSchemaEnforceable(target.runtime, target.modelCapabilities, req.responseSchema, effectiveTools.length);
16215
16279
  assertWriteRootsEnforceable(target.runtime, pathScope.writeBoundaries);
@@ -16752,6 +16816,7 @@ function createDispatchBundle(context, options) {
16752
16816
  function settleQueuedAssignmentsForShutdown() {
16753
16817
  for (const [finishedRunId, entry] of retryQueue) {
16754
16818
  clearTimeout(entry.timer);
16819
+ entry.settleCanceled();
16755
16820
  if (assignments.get(entry.rootRunId)?.status === "running") {
16756
16821
  settleAssignmentDurably(asAssignmentId(entry.rootRunId), entry.terminalCandidate, "canceled");
16757
16822
  }
@@ -16791,11 +16856,25 @@ function createDispatchBundle(context, options) {
16791
16856
  const stored = listStoredAssignments().find((record) => record.assignmentId === id || record.attempts.includes(id));
16792
16857
  return stored?.assignmentId ?? ledger?.get(id)?.lineage?.rootRunId ?? id;
16793
16858
  }
16859
+ function controlRootFor(id) {
16860
+ const exact = controlRootsByAttempt.get(id);
16861
+ if (exact !== void 0) return exact;
16862
+ const roots = /* @__PURE__ */ new Set();
16863
+ for (const [attempt, root] of assignmentRootsByAttempt) {
16864
+ if (root === id) roots.add(controlRootsByAttempt.get(attempt) ?? root);
16865
+ }
16866
+ if (roots.size > 1) {
16867
+ throw new Error(`dispatch: '${id}' names multiple fleet members; use a concrete member or assignment id`);
16868
+ }
16869
+ return roots.values().next().value ?? assignmentRootFor(id);
16870
+ }
16794
16871
  function currentAssignmentRun(id) {
16795
- const rootRunId = assignmentRootFor(id);
16872
+ const exact = active.get(id);
16873
+ if (exact !== void 0) return exact;
16874
+ const rootRunId = controlRootFor(id);
16796
16875
  let current = null;
16797
16876
  for (const run of active.values()) {
16798
- if (run.lineage.rootRunId !== rootRunId) continue;
16877
+ if ((controlRootsByAttempt.get(run.runId) ?? run.lineage.rootRunId) !== rootRunId) continue;
16799
16878
  if (current === null || run.lineage.attempt > current.lineage.attempt) current = run;
16800
16879
  }
16801
16880
  return current;
@@ -16846,8 +16925,25 @@ function createDispatchBundle(context, options) {
16846
16925
  await Promise.allSettled([...assignmentWrites]);
16847
16926
  }
16848
16927
  },
16928
+ async drainMember(runId) {
16929
+ const root = controlRootFor(runId);
16930
+ const errors = [];
16931
+ while (true) {
16932
+ const pending = [...memberWork.get(root) ?? []];
16933
+ const live = currentAssignmentRun(runId);
16934
+ if (live !== null) pending.push(live.finalPromise);
16935
+ if (pending.length === 0) break;
16936
+ for (const result of await Promise.allSettled(pending)) {
16937
+ if (result.status === "rejected" && !errors.includes(result.reason)) errors.push(result.reason);
16938
+ }
16939
+ }
16940
+ if (errors.length === 1) throw errors[0];
16941
+ if (errors.length > 1) throw new AggregateError(errors, "dispatch member drain failed", { cause: errors[0] });
16942
+ },
16849
16943
  abort(runId, reason) {
16850
- const rootRunId = assignmentRootFor(runId);
16944
+ const rootRunId = controlRootFor(runId);
16945
+ const run = currentAssignmentRun(runId);
16946
+ canceledControlRoots.add(rootRunId);
16851
16947
  const queued = pendingCapacity.get(rootRunId);
16852
16948
  if (queued !== void 0 && capacityAdmission.cancel(rootRunId)) {
16853
16949
  persistAssignment(cancelStoredAssignment(rootRunId), `${rootRunId}:cancel-queued`);
@@ -16865,10 +16961,13 @@ function createDispatchBundle(context, options) {
16865
16961
  persistAssignment(cancelStoredAssignment(rootRunId), `${rootRunId}:cancel`);
16866
16962
  }
16867
16963
  for (const [finishedRunId, retry] of retryQueue) {
16868
- if (retry.rootRunId !== rootRunId) continue;
16964
+ if ((controlRootsByAttempt.get(finishedRunId) ?? retry.rootRunId) !== rootRunId) continue;
16869
16965
  clearTimeout(retry.timer);
16966
+ retry.settleCanceled();
16870
16967
  retryQueue.delete(finishedRunId);
16871
- settleAssignmentDurably(asAssignmentId(rootRunId), retry.terminalCandidate, "canceled");
16968
+ if (retry.rootRunId === rootRunId) {
16969
+ settleAssignmentDurably(asAssignmentId(rootRunId), retry.terminalCandidate, "canceled");
16970
+ }
16872
16971
  context.bus.emit(BusChannels.RunAborted, {
16873
16972
  source: "dispatch_abort",
16874
16973
  runId: finishedRunId,
@@ -16883,7 +16982,6 @@ function createDispatchBundle(context, options) {
16883
16982
  event: { type: "retry_canceled", attempt: retry.attempt }
16884
16983
  });
16885
16984
  }
16886
- const run = currentAssignmentRun(rootRunId);
16887
16985
  if (!run) return;
16888
16986
  emitRunAborted(run, "dispatch_abort");
16889
16987
  run.aborted = true;
@@ -17111,7 +17209,6 @@ async function executePlan(initialPlan, adapter, signal) {
17111
17209
  }
17112
17210
  const ledgerId = agentSteps.length >= 2 ? `ledger-plan-${plan.hash.slice(0, 12)}-${Date.now().toString(36)}` : null;
17113
17211
  const ledger = ledgerId === null ? void 0 : { id: ledgerId, sequence: 0 };
17114
- if (ledgerId !== null) await openAgentLedger(ledgerId);
17115
17212
  const admissions = agentSteps.map((step) => adapter.preflight(step));
17116
17213
  const reservation = adapter.reserve(plan, admissions);
17117
17214
  const reservationOwners = /* @__PURE__ */ new Set([reservation.ownerId]);
@@ -17121,6 +17218,9 @@ async function executePlan(initialPlan, adapter, signal) {
17121
17218
  const unneeded = /* @__PURE__ */ new Set();
17122
17219
  const needsDecision = [];
17123
17220
  const running = /* @__PURE__ */ new Map();
17221
+ const cleanupErrors = [];
17222
+ const memberIds = /* @__PURE__ */ new Set();
17223
+ const canceledSteps = /* @__PURE__ */ new Set();
17124
17224
  const checkPassed = /* @__PURE__ */ new Map();
17125
17225
  const loopFindings = /* @__PURE__ */ new Map();
17126
17226
  const attemptsRun = /* @__PURE__ */ new Map();
@@ -17133,11 +17233,19 @@ async function executePlan(initialPlan, adapter, signal) {
17133
17233
  let lastMutationSeq = 0;
17134
17234
  let stopped = false;
17135
17235
  const codeAbort = new AbortController();
17236
+ const cancelOne = (owned) => {
17237
+ if (owned.assignmentId === null || owned.canceled) return;
17238
+ owned.canceled = true;
17239
+ try {
17240
+ adapter.cancel(owned.assignmentId);
17241
+ } catch (error) {
17242
+ cleanupErrors.push(error);
17243
+ }
17244
+ };
17136
17245
  const cancelOwned = () => {
17137
17246
  stopped = true;
17138
- for (const owned of running.values()) if (owned.assignmentId !== null) adapter.cancel(owned.assignmentId);
17139
17247
  codeAbort.abort();
17140
- for (const ownerId of reservationOwners) adapter.releaseUnconsumed(ownerId);
17248
+ for (const owned of running.values()) cancelOne(owned);
17141
17249
  };
17142
17250
  signal?.addEventListener("abort", cancelOwned, { once: true });
17143
17251
  const loopOf = (step) => step.loop === void 0 ? null : loopsById.get(step.loop.loopId) ?? null;
@@ -17148,42 +17256,44 @@ async function executePlan(initialPlan, adapter, signal) {
17148
17256
  results.set(step.id, result);
17149
17257
  if (isWorkspaceMutator(step)) lastMutationSeq = sequence;
17150
17258
  };
17151
- for (const step of plan.steps) {
17152
- const result = replayed.get(step.id);
17153
- if (result === void 0) continue;
17154
- if (!result.succeeded || !result.integrityValid) {
17155
- throw new Error(`execution plan: replayed step '${step.id}' is not a completed successful step`);
17156
- }
17157
- recordCompletion(step, result);
17158
- if (step.loop?.role === "check" && step.kind === "code") {
17159
- checkPassed.set(step.id, result.succeeded);
17160
- attemptsRun.set(step.loop.loopId, (attemptsRun.get(step.loop.loopId) ?? 0) + 1);
17161
- }
17162
- if (step.loop?.role === "check" && step.kind === "agent") {
17163
- const loop = loopsById.get(step.loop.loopId);
17164
- const decide = adapter.decideLoop;
17165
- if (loop === void 0 || decide === void 0) {
17166
- throw new Error(`execution plan: replayed loop check '${step.id}' has no decider`);
17259
+ const replayPrefix = async () => {
17260
+ for (const step of plan.steps) {
17261
+ const result = replayed.get(step.id);
17262
+ if (result === void 0) continue;
17263
+ if (!result.succeeded || !result.integrityValid) {
17264
+ throw new Error(`execution plan: replayed step '${step.id}' is not a completed successful step`);
17167
17265
  }
17168
- const decision = await decide({
17169
- loop,
17170
- step,
17171
- attempt: step.loop.attempt,
17172
- terminalAttempt: step.loop.attempt >= loop.maxAttempts,
17173
- result,
17174
- priorResults: results
17175
- });
17176
- checkPassed.set(step.id, decision.resolved);
17177
- attemptsRun.set(step.loop.loopId, (attemptsRun.get(step.loop.loopId) ?? 0) + 1);
17178
- if (decision.findings !== null) loopFindings.set(`${loop.id}:${step.loop.attempt}`, decision.findings);
17179
- if (decision.needsDecision !== void 0 && decision.needsDecision !== null) {
17180
- needsDecision.push(decision.needsDecision);
17266
+ recordCompletion(step, result);
17267
+ if (step.loop?.role === "check" && step.kind === "code") {
17268
+ checkPassed.set(step.id, result.succeeded);
17269
+ attemptsRun.set(step.loop.loopId, (attemptsRun.get(step.loop.loopId) ?? 0) + 1);
17270
+ }
17271
+ if (step.loop?.role === "check" && step.kind === "agent") {
17272
+ const loop = loopsById.get(step.loop.loopId);
17273
+ const decide = adapter.decideLoop;
17274
+ if (loop === void 0 || decide === void 0) {
17275
+ throw new Error(`execution plan: replayed loop check '${step.id}' has no decider`);
17276
+ }
17277
+ const decision = await decide({
17278
+ loop,
17279
+ step,
17280
+ attempt: step.loop.attempt,
17281
+ terminalAttempt: step.loop.attempt >= loop.maxAttempts,
17282
+ result,
17283
+ priorResults: results
17284
+ });
17285
+ checkPassed.set(step.id, decision.resolved);
17286
+ attemptsRun.set(step.loop.loopId, (attemptsRun.get(step.loop.loopId) ?? 0) + 1);
17287
+ if (decision.findings !== null) loopFindings.set(`${loop.id}:${step.loop.attempt}`, decision.findings);
17288
+ if (decision.needsDecision !== void 0 && decision.needsDecision !== null) {
17289
+ needsDecision.push(decision.needsDecision);
17290
+ }
17291
+ }
17292
+ if (step.loop?.role === "repair") {
17293
+ repairsRun.set(step.loop.loopId, (repairsRun.get(step.loop.loopId) ?? 0) + 1);
17181
17294
  }
17182
17295
  }
17183
- if (step.loop?.role === "repair") {
17184
- repairsRun.set(step.loop.loopId, (repairsRun.get(step.loop.loopId) ?? 0) + 1);
17185
- }
17186
- }
17296
+ };
17187
17297
  const dependencyBlocks = (dependency, dependent) => {
17188
17298
  if (unneeded.has(dependency)) return false;
17189
17299
  if (skipped.has(dependency)) return true;
@@ -17224,10 +17334,10 @@ async function executePlan(initialPlan, adapter, signal) {
17224
17334
  const closeBoundary = async (window, enforced, settled) => {
17225
17335
  const verify = adapter.verifyWriteBoundary;
17226
17336
  if (enforced === null || verify === void 0) return [...settled];
17227
- const outcome = await verify(window, enforced);
17228
- writeBoundaries.push(outcome);
17229
- if (!outcome.violated) return [...settled];
17230
- const blamed = new Set(outcome.failedStepIds);
17337
+ const outcome2 = await verify(window, enforced);
17338
+ writeBoundaries.push(outcome2);
17339
+ if (!outcome2.violated) return [...settled];
17340
+ const blamed = new Set(outcome2.failedStepIds);
17231
17341
  return settled.map(
17232
17342
  ({ step, result }) => blamed.has(step.id) ? { step, result: { ...result, succeeded: false, boundaryViolated: true } } : { step, result }
17233
17343
  );
@@ -17235,7 +17345,10 @@ async function executePlan(initialPlan, adapter, signal) {
17235
17345
  const runCodeStepNode = async (step, handoffs) => {
17236
17346
  const runCode = adapter.runCode;
17237
17347
  if (runCode === void 0) throw new Error(`execution plan: no runner for code step '${step.id}'`);
17238
- return await runCode(step, handoffs, codeAbort.signal, results);
17348
+ const result = await runCode(step, handoffs, codeAbort.signal, results);
17349
+ if (!codeAbort.signal.aborted) return result;
17350
+ canceledSteps.add(step.id);
17351
+ return { ...result, succeeded: false, failureReason: result.failureReason ?? "execution plan canceled this step" };
17239
17352
  };
17240
17353
  const revalidateFor = async (wave) => {
17241
17354
  const candidates = /* @__PURE__ */ new Set();
@@ -17253,6 +17366,7 @@ async function executePlan(initialPlan, adapter, signal) {
17253
17366
  }
17254
17367
  let halt = false;
17255
17368
  for (const id of [...candidates].sort()) {
17369
+ if (stopped || signal?.aborted) return true;
17256
17370
  const step = stepsById.get(id);
17257
17371
  if (step?.kind !== "code") continue;
17258
17372
  const spent = revalidations.get(id) ?? 0;
@@ -17278,7 +17392,6 @@ async function executePlan(initialPlan, adapter, signal) {
17278
17392
  if (plan.onFailure === "stop") {
17279
17393
  stopped = true;
17280
17394
  codeAbort.abort();
17281
- for (const ownerId of reservationOwners) adapter.releaseUnconsumed(ownerId);
17282
17395
  halt = true;
17283
17396
  }
17284
17397
  }
@@ -17338,7 +17451,12 @@ async function executePlan(initialPlan, adapter, signal) {
17338
17451
  const reason = !brokenMember && ran >= loop.maxAttempts ? "loop_bound_exhausted" : "loop_step_failed";
17339
17452
  return { loopId: loop.id, resolved: false, attempts, repairs, reason };
17340
17453
  });
17454
+ let outcome;
17455
+ let primaryError;
17456
+ let failed2 = false;
17341
17457
  try {
17458
+ if (ledgerId !== null) await openAgentLedger(ledgerId);
17459
+ await replayPrefix();
17342
17460
  let waveIndex = 0;
17343
17461
  while (waveIndex < plan.waves.length) {
17344
17462
  const wave = plan.waves[waveIndex];
@@ -17382,58 +17500,107 @@ async function executePlan(initialPlan, adapter, signal) {
17382
17500
  boundaryWindow,
17383
17501
  group.map((entry) => entry.step)
17384
17502
  );
17385
- const started = await Promise.all(
17386
- launch.map(async ({ step, handoffs }) => ({
17387
- step,
17388
- handle: await adapter.run(
17389
- step,
17390
- handoffs,
17391
- { ownerId: reservationByStep.get(step.id) ?? reservation.ownerId, memberId: step.id },
17392
- ledger
17393
- )
17394
- }))
17395
- );
17396
- for (const { step, handle } of started) running.set(step.id, { assignmentId: handle.assignmentId });
17503
+ const failures = [];
17504
+ const fail = (error) => {
17505
+ failures.push(error);
17506
+ cancelOwned();
17507
+ };
17397
17508
  const onSettled = (step, result) => {
17398
- if (isPlanFailure(step, result) && plan.onFailure === "stop") {
17399
- stopped = true;
17400
- for (const [runningStepId, owned] of running) {
17401
- if (runningStepId !== step.id && owned.assignmentId !== null) adapter.cancel(owned.assignmentId);
17402
- }
17403
- codeAbort.abort();
17404
- for (const ownerId of reservationOwners) adapter.releaseUnconsumed(ownerId);
17405
- }
17509
+ if (isPlanFailure(step, result) && plan.onFailure === "stop") cancelOwned();
17406
17510
  };
17407
- const ran = await Promise.all([
17408
- ...started.map(async ({ step, handle }) => {
17409
- const result = await handle.result;
17410
- onSettled(step, result);
17411
- return { step, result };
17412
- }),
17413
- ...codeWork.map(async ({ step, handoffs }) => {
17511
+ const terminals = [];
17512
+ await Promise.allSettled(
17513
+ launch.map(async ({ step, handoffs }) => {
17514
+ if (stopped || signal?.aborted) return;
17515
+ const owned = { assignmentId: null, canceled: false };
17516
+ running.set(step.id, owned);
17517
+ try {
17518
+ const handle = await adapter.run(
17519
+ step,
17520
+ handoffs,
17521
+ { ownerId: reservationByStep.get(step.id) ?? reservation.ownerId, memberId: step.id },
17522
+ ledger
17523
+ );
17524
+ owned.assignmentId = handle.assignmentId;
17525
+ memberIds.add(handle.assignmentId);
17526
+ const terminal = handle.result.then(
17527
+ (result) => {
17528
+ if (owned.canceled) canceledSteps.add(step.id);
17529
+ const settled2 = owned.canceled ? { ...result, succeeded: false, failureReason: result.failureReason ?? "execution plan canceled this step" } : result;
17530
+ onSettled(step, settled2);
17531
+ if (settled2.succeeded) running.delete(step.id);
17532
+ return { step, result: settled2 };
17533
+ },
17534
+ (error) => {
17535
+ fail(error);
17536
+ throw error;
17537
+ }
17538
+ );
17539
+ terminals.push(Promise.allSettled([terminal]));
17540
+ if (stopped || signal?.aborted) cancelOne(owned);
17541
+ } catch (error) {
17542
+ running.delete(step.id);
17543
+ fail(error);
17544
+ }
17545
+ return;
17546
+ })
17547
+ );
17548
+ const codeTerminals = stopped || signal?.aborted ? [] : codeWork.map(async ({ step, handoffs }) => {
17549
+ try {
17414
17550
  const result = await runCodeStepNode(step, handoffs);
17415
17551
  onSettled(step, result);
17416
17552
  return { step, result };
17417
- })
17418
- ]);
17419
- const settled = await closeBoundary(boundaryWindow, enforced, ran);
17553
+ } catch (error) {
17554
+ fail(error);
17555
+ throw error;
17556
+ }
17557
+ });
17558
+ const outcomes = (await Promise.all([...terminals, Promise.allSettled(codeTerminals)])).flat();
17559
+ for (const id of memberIds) {
17560
+ try {
17561
+ await adapter.drainMember?.(id);
17562
+ memberIds.delete(id);
17563
+ } catch (error) {
17564
+ fail(error);
17565
+ }
17566
+ }
17567
+ const ran = outcomes.flatMap((outcome2) => outcome2.status === "fulfilled" ? [outcome2.value] : []);
17568
+ const settlementOrder = [...launch, ...codeWork].map(({ step }) => step.id);
17569
+ ran.sort((a, b) => settlementOrder.indexOf(a.step.id) - settlementOrder.indexOf(b.step.id));
17570
+ let settled;
17571
+ try {
17572
+ settled = await closeBoundary(boundaryWindow, enforced, ran);
17573
+ } catch (error) {
17574
+ if (failures.length === 0) throw error;
17575
+ throw new AggregateError([...failures, error], "execution plan failure and boundary verification failed", {
17576
+ cause: failures[0]
17577
+ });
17578
+ }
17420
17579
  for (const { step, result } of settled) {
17421
- running.set(step.id, { assignmentId: result.assignmentId });
17422
17580
  recordCompletion(step, result);
17423
- await adapter.onStepSettled?.(step, result);
17581
+ try {
17582
+ await adapter.onStepSettled?.(step, result);
17583
+ } catch (error) {
17584
+ failures.push(error);
17585
+ cancelOwned();
17586
+ }
17424
17587
  if (step.loop?.role === "repair") {
17425
17588
  repairsRun.set(step.loop.loopId, (repairsRun.get(step.loop.loopId) ?? 0) + 1);
17426
17589
  }
17427
17590
  running.delete(step.id);
17428
17591
  }
17429
- for (const { step, result } of settled) await settleCheck(step, result);
17592
+ if (failures.length === 1) throw failures[0];
17593
+ if (failures.length > 1)
17594
+ throw new AggregateError(failures, "execution plan launch or result failed", { cause: failures[0] });
17595
+ for (const { step, result } of settled) {
17596
+ if (!signal?.aborted && !canceledSteps.has(step.id)) await settleCheck(step, result);
17597
+ }
17430
17598
  const exhausted = settled.some(({ step }) => {
17431
17599
  const loop = step.loop?.role === "check" ? loopOf(step) : null;
17432
17600
  return loop !== null && step.loop !== void 0 && step.loop.attempt >= loop.maxAttempts && !loopResolved(loop);
17433
17601
  });
17434
17602
  if ((exhausted || settled.some(({ step, result }) => isPlanFailure(step, result))) && plan.onFailure === "stop") {
17435
17603
  stopped = true;
17436
- for (const ownerId of reservationOwners) adapter.releaseUnconsumed(ownerId);
17437
17604
  }
17438
17605
  }
17439
17606
  if (!stopped && adapter.spliceAfter !== void 0) {
@@ -17462,7 +17629,7 @@ async function executePlan(initialPlan, adapter, signal) {
17462
17629
  }
17463
17630
  waveIndex += 1;
17464
17631
  }
17465
- return {
17632
+ outcome = {
17466
17633
  planHash: plan.hash,
17467
17634
  results,
17468
17635
  skipped: [...skipped],
@@ -17473,13 +17640,50 @@ async function executePlan(initialPlan, adapter, signal) {
17473
17640
  writeBoundaries: [...writeBoundaries]
17474
17641
  };
17475
17642
  } catch (error) {
17643
+ failed2 = true;
17644
+ primaryError = error;
17476
17645
  cancelOwned();
17477
- throw error;
17478
17646
  } finally {
17479
17647
  signal?.removeEventListener("abort", cancelOwned);
17480
- for (const ownerId of reservationOwners) adapter.release(ownerId);
17481
- if (ledgerId !== null) await closeAgentLedger(ledgerId);
17648
+ for (const id of memberIds) {
17649
+ try {
17650
+ await adapter.drainMember?.(id);
17651
+ } catch (error) {
17652
+ cleanupErrors.push(error);
17653
+ }
17654
+ }
17655
+ for (const ownerId of reservationOwners) {
17656
+ if (stopped || signal?.aborted) {
17657
+ try {
17658
+ adapter.releaseUnconsumed(ownerId);
17659
+ } catch (error) {
17660
+ cleanupErrors.push(error);
17661
+ }
17662
+ }
17663
+ try {
17664
+ adapter.release(ownerId);
17665
+ } catch (error) {
17666
+ cleanupErrors.push(error);
17667
+ }
17668
+ }
17669
+ if (ledgerId !== null) {
17670
+ try {
17671
+ await closeAgentLedger(ledgerId);
17672
+ } catch (error) {
17673
+ cleanupErrors.push(error);
17674
+ }
17675
+ }
17676
+ }
17677
+ if (cleanupErrors.length > 0) {
17678
+ throw new AggregateError(
17679
+ failed2 ? [primaryError, ...cleanupErrors] : cleanupErrors,
17680
+ "execution plan cleanup failed",
17681
+ failed2 ? { cause: primaryError } : void 0
17682
+ );
17482
17683
  }
17684
+ if (failed2) throw primaryError;
17685
+ if (outcome === void 0) throw new Error("execution plan did not produce an outcome");
17686
+ return outcome;
17483
17687
  }
17484
17688
 
17485
17689
  // src/domains/dispatch/fleet-gate.ts
@@ -18159,6 +18363,7 @@ async function executeFleetRun(input) {
18159
18363
  beginWriteBoundary: (window, stepIds) => boundaryEnforcer.begin(window, stepIds),
18160
18364
  verifyWriteBoundary: (window, stepIds) => boundaryEnforcer.verify(window, stepIds),
18161
18365
  cancel: (assignmentId) => dispatch.abort(assignmentId),
18366
+ drainMember: (assignmentId) => dispatch.drainMember?.(assignmentId) ?? Promise.resolve(),
18162
18367
  release: (ownerId) => {
18163
18368
  if (ownerId === NO_WORKER_RESERVATION) return;
18164
18369
  dispatch.reservations?.release(ownerId);
@@ -19233,7 +19438,10 @@ function isValidationProtectedArtifact(entry) {
19233
19438
  }
19234
19439
  function validationToolCallCandidate(entry, linked, runSources) {
19235
19440
  const call = extractSessionToolCall(entry, linked);
19236
- if (validationToolCallSummary(call.tool, call.args) === null) return null;
19441
+ const effective = effectiveToolCall(call.tool, call.args);
19442
+ if (validationToolCallSummary(effective.toolName, effective.viaGateway ? effective.args : call.args) === null) {
19443
+ return null;
19444
+ }
19237
19445
  return {
19238
19446
  toolCallId: call.id,
19239
19447
  runId: validationRunIdFor(linked, runSources),
@@ -19565,7 +19773,15 @@ function extractSessionToolCall(entry, linked) {
19565
19773
  const id = readOptionalString(payload?.id) ?? readOptionalString(payload?.toolCallId) ?? readOptionalString(payload?.tool_call_id) ?? readOptionalString(block?.id) ?? entry.turnId;
19566
19774
  const tool = readOptionalString(payload?.name) ?? readOptionalString(payload?.toolName) ?? readOptionalString(payload?.tool) ?? readOptionalString(fn?.name) ?? readOptionalString(block?.name) ?? "tool";
19567
19775
  const args = payload?.arguments ?? payload?.args ?? payload?.input ?? parseMaybeJson(fn?.arguments) ?? block?.arguments ?? block?.args ?? void 0;
19568
- return { id, tool, args, timestamp: entry.timestamp, link: linked.link, sessionId: linked.sessionId };
19776
+ const effective = effectiveToolCall(tool, args);
19777
+ return {
19778
+ id,
19779
+ tool: effective.toolName,
19780
+ args: effective.args ?? args,
19781
+ timestamp: entry.timestamp,
19782
+ link: linked.link,
19783
+ sessionId: linked.sessionId
19784
+ };
19569
19785
  }
19570
19786
  function extractSessionToolResult(entry, linked) {
19571
19787
  const payload = payloadObject(entry.payload);
@@ -19573,10 +19789,18 @@ function extractSessionToolResult(entry, linked) {
19573
19789
  const id = readOptionalString(payload?.toolCallId) ?? readOptionalString(payload?.tool_call_id) ?? readOptionalString(payload?.id) ?? null;
19574
19790
  const tool = readOptionalString(payload?.toolName) ?? readOptionalString(payload?.name) ?? readOptionalString(payload?.tool) ?? "tool";
19575
19791
  const result = payload?.result ?? payload?.output ?? payload?.out ?? payload?.content ?? (contentText.length > 0 ? contentText : entry.payload);
19792
+ const effective = effectiveToolCall(tool, void 0, payloadObject(result)?.details ?? payload?.details);
19793
+ const resultObject = payloadObject(result);
19794
+ const details = payloadObject(resultObject?.details);
19795
+ let projectedResult = result;
19796
+ if (effective.viaGateway && resultObject && details) {
19797
+ const { capability: _capability, ...innerDetails } = details;
19798
+ projectedResult = { ...resultObject, details: innerDetails };
19799
+ }
19576
19800
  return {
19577
19801
  id,
19578
- tool,
19579
- result,
19802
+ tool: effective.toolName,
19803
+ result: projectedResult,
19580
19804
  isError: payload?.isError === true || payload?.error === true,
19581
19805
  timestamp: entry.timestamp,
19582
19806
  link: linked.link,
@@ -19824,8 +20048,13 @@ function renderTranscript(overview, runSources, sessionLinks, trustStatus, findi
19824
20048
  }
19825
20049
  if (sessionLinks.entries.length > 0) {
19826
20050
  lines.push("", "## Linked Session Transcript");
20051
+ const calls = /* @__PURE__ */ new Map();
19827
20052
  for (const linked of sessionLinks.entries) {
19828
- lines.push(...renderSessionTranscriptEntry(linked));
20053
+ if (linked.entry.kind === "message" && linked.entry.role === "tool_call") {
20054
+ const call = extractSessionToolCall(linked.entry, linked);
20055
+ calls.set(call.id, call.tool);
20056
+ }
20057
+ lines.push(...renderSessionTranscriptEntry(linked, calls));
19829
20058
  }
19830
20059
  }
19831
20060
  lines.push("");
@@ -19845,7 +20074,7 @@ function transcriptRunLink(link) {
19845
20074
  }
19846
20075
  return "";
19847
20076
  }
19848
- function renderSessionTranscriptEntry(linked) {
20077
+ function renderSessionTranscriptEntry(linked, calls) {
19849
20078
  const entry = linked.entry;
19850
20079
  const prefix = `- ${entry.timestamp} session=${linked.sessionId}${transcriptRunLink(linked.link)}`;
19851
20080
  if (entry.kind === "message") {
@@ -19857,7 +20086,8 @@ function renderSessionTranscriptEntry(linked) {
19857
20086
  const result = extractSessionToolResult(entry, linked);
19858
20087
  const id = result.id === null ? "" : ` id=${result.id}`;
19859
20088
  const error = result.isError ? " error=true" : "";
19860
- return [`${prefix} tool_result ${result.tool}${id}${error}: ${previewUnknown(result.result)}`];
20089
+ const tool = result.id === null ? result.tool : calls.get(result.id) ?? result.tool;
20090
+ return [`${prefix} tool_result ${tool}${id}${error}: ${previewUnknown(result.result)}`];
19861
20091
  }
19862
20092
  const text = collapseWhitespace(extractTextFromPayload(entry.payload));
19863
20093
  const rendered = text.length > 0 ? truncateText(text, TRANSCRIPT_TEXT_MAX_CHARS) : previewUnknown(entry.payload);
@@ -22280,4 +22510,4 @@ export {
22280
22510
  buildWikiPlanPrompt,
22281
22511
  buildWikiPagePrompt
22282
22512
  };
22283
- //# sourceMappingURL=chunk-5W4FRA5Q.js.map
22513
+ //# sourceMappingURL=chunk-F2YM3JY4.js.map