@iowarp/clio-coder 0.4.7 → 0.4.8

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 (485) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +29 -0
  3. package/CONTRIBUTING.md +83 -74
  4. package/README.md +66 -45
  5. package/dist/{acp-W3Y3TRHD.js → acp-JWPQZM2D.js} +14 -14
  6. package/dist/{agents-J4ICNLQ3.js → agents-4GCDIRVX.js} +55 -54
  7. package/dist/assets/codewiki.json +1 -1
  8. package/dist/assets/web-notices/@hono__node-server-LICENSE +21 -0
  9. package/dist/assets/web-notices/hono-LICENSE +21 -0
  10. package/dist/{auth-X2UJUMOC.js → auth-SYAKTDQE.js} +22 -22
  11. package/dist/background-OW67WMYR.js +37 -0
  12. package/dist/{builtins-XLXWWSRF.js → builtins-TKS63VNV.js} +4 -4
  13. package/dist/chunk-2JSCCEKO.js +85 -0
  14. package/dist/{chunk-QKWL7SYE.js → chunk-2SXGG2IV.js} +49 -38
  15. package/dist/{chunk-MZHXENL7.js → chunk-2U2U5POA.js} +5 -5
  16. package/dist/{chunk-NCCQ6DVS.js → chunk-2ZWLMA3T.js} +6 -6
  17. package/dist/{chunk-FQOOGXBH.js → chunk-36XSBPXL.js} +7 -7
  18. package/dist/{chunk-5AJPUR72.js → chunk-3IQOZRQ6.js} +7 -7
  19. package/dist/{chunk-4MFBBY2Z.js → chunk-44U2OUSM.js} +3 -3
  20. package/dist/{chunk-5ZSZEYJK.js → chunk-4P6M2TTE.js} +2 -2
  21. package/dist/{chunk-IZYTT3CD.js → chunk-526ABLHD.js} +6 -6
  22. package/dist/{chunk-BO4XV5VX.js → chunk-5C2OQHLR.js} +4 -4
  23. package/dist/chunk-5D2FNBMG.js +185 -0
  24. package/dist/{chunk-M6Z2V6YU.js → chunk-5HULHKT2.js} +5 -5
  25. package/dist/{chunk-PFLOULP3.js → chunk-5UG6EZI3.js} +4 -4
  26. package/dist/{chunk-WN552PKN.js → chunk-5W4FRA5Q.js} +280 -900
  27. package/dist/{chunk-KAFMW7WM.js → chunk-6R5MBXBJ.js} +1 -1
  28. package/dist/{chunk-24S3DN22.js → chunk-6TKOFFGE.js} +4 -4
  29. package/dist/{chunk-YKRJTYNP.js → chunk-6UJ7RDI7.js} +4 -4
  30. package/dist/{chunk-GXIWHXDB.js → chunk-6X7VOCDY.js} +3 -3
  31. package/dist/{chunk-KKEYGFX4.js → chunk-7QQRPB2E.js} +11 -11
  32. package/dist/{chunk-34XHRVKG.js → chunk-ARRUMZ7X.js} +2 -2
  33. package/dist/{chunk-3T4DXWP6.js → chunk-ATB3Q7YO.js} +1 -6
  34. package/dist/chunk-AUHVBIDW.js +19 -0
  35. package/dist/{chunk-L3Z5ANCV.js → chunk-BE4I3UJ2.js} +7 -7
  36. package/dist/chunk-BFPHMSK7.js +169 -0
  37. package/dist/{chunk-LVFANMOH.js → chunk-BHJMMCXS.js} +4 -4
  38. package/dist/{chunk-D2T66PDV.js → chunk-BIY22UUK.js} +35 -203
  39. package/dist/{chunk-VMATUZB6.js → chunk-D55WO5J7.js} +11 -11
  40. package/dist/{chunk-2O2LVQQK.js → chunk-E2NSPYLC.js} +4 -4
  41. package/dist/{chunk-IJMW64DX.js → chunk-EFXMQYI6.js} +32 -32
  42. package/dist/{chunk-GVZFCJHE.js → chunk-EPYATQMG.js} +18 -18
  43. package/dist/{chunk-MZNWZUJM.js → chunk-EXKUF426.js} +11 -11
  44. package/dist/{chunk-IMOD2YPV.js → chunk-F7Y6QTPL.js} +9 -19
  45. package/dist/{chunk-IQCNVLO6.js → chunk-FB3KTE2J.js} +10 -7
  46. package/dist/{chunk-3LXJOICS.js → chunk-FNVPQQYT.js} +2 -2
  47. package/dist/{chunk-UUQ5G6EZ.js → chunk-GEYX2NZ5.js} +2 -2
  48. package/dist/{chunk-CP3HIR5H.js → chunk-GJBJHJNY.js} +19 -18
  49. package/dist/{chunk-LZBMXNLP.js → chunk-GM4TY6VN.js} +43 -6
  50. package/dist/{chunk-WT5TRMO4.js → chunk-GVU4CXPJ.js} +179 -65
  51. package/dist/{chunk-TZ6UVP2H.js → chunk-H5DPSUBB.js} +8 -8
  52. package/dist/{chunk-EUEXGXXR.js → chunk-H77XBUBM.js} +5 -5
  53. package/dist/{config-YXARKGTX.js → chunk-HMGAKB7E.js} +15 -259
  54. package/dist/{chunk-EUZRMP4Y.js → chunk-HP7KJ5O2.js} +19 -19
  55. package/dist/chunk-HVCAY2FH.js +67 -0
  56. package/dist/{chunk-CPXGJI2A.js → chunk-ICYIUNO4.js} +4 -4
  57. package/dist/{chunk-GI5RRMAH.js → chunk-IILXVWJY.js} +7 -7
  58. package/dist/{chunk-MNQN3X6Y.js → chunk-JCVIL6TY.js} +5 -5
  59. package/dist/chunk-JIMWEYWO.js +63 -0
  60. package/dist/{chunk-C3G5PNUO.js → chunk-JLBVCROW.js} +25 -25
  61. package/dist/chunk-JOBN2YQQ.js +176 -0
  62. package/dist/chunk-JOL2QRLE.js +152 -0
  63. package/dist/{chunk-N37QC5FV.js → chunk-JRA6OBHY.js} +5 -5
  64. package/dist/{chunk-C6GEXX4L.js → chunk-JV25I7ID.js} +7 -7
  65. package/dist/{chunk-SEDI5K5B.js → chunk-JYKUMHCQ.js} +16 -16
  66. package/dist/{chunk-UA6W4XFJ.js → chunk-K3W6BF5C.js} +2 -2
  67. package/dist/chunk-K45LHSCI.js +194 -0
  68. package/dist/{chunk-UA3W4FGC.js → chunk-K53E2PTW.js} +5 -5
  69. package/dist/{chunk-VCRVEDUC.js → chunk-K5UJD6MM.js} +5 -5
  70. package/dist/{chunk-65BGHOUR.js → chunk-KGP3UQGJ.js} +5 -5
  71. package/dist/chunk-KKRXONXG.js +43 -0
  72. package/dist/{chunk-LBFQMYS3.js → chunk-KWJXCL2X.js} +5 -3
  73. package/dist/{chunk-RTLNFZMD.js → chunk-L75H5B3B.js} +3 -3
  74. package/dist/{chunk-G4LGUTOE.js → chunk-LLCGGVSW.js} +6 -6
  75. package/dist/{chunk-HRAKUPIH.js → chunk-LZCCBLRC.js} +5 -5
  76. package/dist/{chunk-WURGVOZJ.js → chunk-LZDLYSUN.js} +18 -14
  77. package/dist/{chunk-ISNCCX42.js → chunk-MATCRH3M.js} +7 -6
  78. package/dist/{chunk-BAU36233.js → chunk-MEHBW2SP.js} +7 -7
  79. package/dist/{chunk-BQQ5MXUC.js → chunk-MUXNDNMZ.js} +3 -3
  80. package/dist/{chunk-NO7J45X6.js → chunk-MWMW53WW.js} +90 -51
  81. package/dist/chunk-MZDPF35R.js +45 -0
  82. package/dist/{chunk-P4DL2LM5.js → chunk-MZKYVIWW.js} +8 -119
  83. package/dist/{chunk-T334FW2H.js → chunk-O2QJDRWP.js} +5 -5
  84. package/dist/{chunk-T7QQBNLH.js → chunk-O3HSB2YL.js} +9 -7
  85. package/dist/{chunk-WB7POC6M.js → chunk-OEMFEL26.js} +6 -6
  86. package/dist/{chunk-77CZRFTE.js → chunk-OPC4DQD6.js} +2 -2
  87. package/dist/{chunk-4UHVS5T7.js → chunk-ORRNGQDV.js} +8 -8
  88. package/dist/{chunk-TZHN5ITX.js → chunk-P4JS3MH5.js} +5 -5
  89. package/dist/{chunk-WBVKKTUT.js → chunk-P7GTE4FX.js} +2 -2
  90. package/dist/{chunk-6TAATXXH.js → chunk-PAQVETLA.js} +6 -6
  91. package/dist/{chunk-6CA2BHOR.js → chunk-PFZJMXIY.js} +4 -4
  92. package/dist/{chunk-4QKAITQT.js → chunk-PGEFOTJB.js} +70 -7
  93. package/dist/{chunk-MBJO5VNZ.js → chunk-PJ5H5B7A.js} +25 -25
  94. package/dist/{chunk-DO7M3LSX.js → chunk-PMUUAABD.js} +43 -96
  95. package/dist/{chunk-A67NR5AT.js → chunk-Q32C6AWI.js} +11 -8
  96. package/dist/{chunk-ECOMVOHP.js → chunk-QGIC5SX5.js} +2 -2
  97. package/dist/{chunk-5CMARGPF.js → chunk-QLAGXTTV.js} +7 -2
  98. package/dist/{chunk-GFQ7P2UF.js → chunk-QLKCCC2J.js} +9 -9
  99. package/dist/{chunk-SELG4SUR.js → chunk-QWUSS2QP.js} +7 -4
  100. package/dist/{chunk-P5SC4DLJ.js → chunk-QYSAZMSH.js} +2 -2
  101. package/dist/{fleet-decisions-S3PTZV2D.js → chunk-R5NRX5N4.js} +5 -41
  102. package/dist/{chunk-DLIYANB7.js → chunk-RAUOKUZV.js} +11 -11
  103. package/dist/{chunk-UFYNOQK4.js → chunk-RBES4TCZ.js} +7 -7
  104. package/dist/{chunk-T52TPHYC.js → chunk-RFULVPBX.js} +4 -4
  105. package/dist/{chunk-TLTGZTXI.js → chunk-RKFNU5UA.js} +3 -3
  106. package/dist/{chunk-T4TY5GG3.js → chunk-RM3XJX7P.js} +3 -3
  107. package/dist/{chunk-6YA46L5A.js → chunk-RNLAPBJL.js} +2 -2
  108. package/dist/chunk-RPMNIFRY.js +65 -0
  109. package/dist/{chunk-DACXIVVF.js → chunk-RRZFRIJP.js} +5 -5
  110. package/dist/{chunk-CE64C5K5.js → chunk-RXI7K4J5.js} +61 -61
  111. package/dist/{chunk-CULVKYTK.js → chunk-STC6CWUZ.js} +5 -5
  112. package/dist/{chunk-6YHPAAZR.js → chunk-TEHVMHOK.js} +3 -3
  113. package/dist/{chunk-VTYHHQ57.js → chunk-TOPICHGR.js} +2 -2
  114. package/dist/{chunk-UWD3JD5X.js → chunk-UB33F3YW.js} +10 -10
  115. package/dist/{chunk-TN5FW4XY.js → chunk-UDAK6GR2.js} +12 -9
  116. package/dist/chunk-USBBEKHW.js +177 -0
  117. package/dist/{chunk-6CB2IL4N.js → chunk-W5RM7YAH.js} +1 -1
  118. package/dist/{chunk-6LRLOJHQ.js → chunk-W7KNI3F5.js} +11 -62
  119. package/dist/chunk-WFTSK7N3.js +637 -0
  120. package/dist/{chunk-YPRSNUTC.js → chunk-WJWNZXRM.js} +2 -2
  121. package/dist/chunk-WS4FOGLY.js +686 -0
  122. package/dist/{chunk-ZGIGW4ZG.js → chunk-WTZVSMQZ.js} +5 -5
  123. package/dist/{chunk-XR3XJN2M.js → chunk-WWRV5RJI.js} +4 -4
  124. package/dist/{chunk-24TOGHPO.js → chunk-X6FLVUM5.js} +4 -4
  125. package/dist/chunk-XC5POIL4.js +68 -0
  126. package/dist/{chunk-XZ6UFQ52.js → chunk-XTLJDC2X.js} +22 -17
  127. package/dist/{chunk-7EEGBKV4.js → chunk-YGIV24MF.js} +8 -8
  128. package/dist/{chunk-RXFPB32E.js → chunk-YJCCMYYT.js} +2 -2
  129. package/dist/{chunk-4N2RZ4TO.js → chunk-YKIIWURD.js} +3 -3
  130. package/dist/{chunk-USZA7GWL.js → chunk-YQ3GFEUY.js} +2 -2
  131. package/dist/{chunk-KS7ETA3P.js → chunk-YXANQGCX.js} +6 -6
  132. package/dist/{chunk-HOX4YZ2K.js → chunk-YXFKLMX2.js} +5 -5
  133. package/dist/chunk-ZST3FRCV.js +132 -0
  134. package/dist/cli/index.js +39 -37
  135. package/dist/{clio-L2P7S2R2.js → clio-BPBAPZGA.js} +9 -9
  136. package/dist/{code-nav-B5LNX4KU.js → code-nav-KBQ3RIFK.js} +33 -33
  137. package/dist/{components-63MMQKUT.js → components-6DKAXWFN.js} +10 -10
  138. package/dist/config-FWL5JK2H.js +270 -0
  139. package/dist/config-graph-ACDB26L2.js +156 -0
  140. package/dist/{configure-LMVQJ46J.js → configure-ZIZ4YV62.js} +48 -48
  141. package/dist/{context-7HJEWTTP.js → context-EZZPT2ZV.js} +49 -49
  142. package/dist/{context-YG2LZDYZ.js → context-VIL5MFRH.js} +86 -84
  143. package/dist/{context-XSZKKFBW.js → context-Z3GOBHDK.js} +16 -16
  144. package/dist/{context-clear-AC5NXHM2.js → context-clear-ZPB3L7MN.js} +72 -70
  145. package/dist/{context-index-KKTPRV5G.js → context-index-W6A4V7OC.js} +4 -4
  146. package/dist/{context-map-T7ROR5D5.js → context-map-DKL3QT6D.js} +3 -3
  147. package/dist/{context-working-set-F4Q4J3NS.js → context-working-set-2GLBVF7L.js} +23 -22
  148. package/dist/{detail-H73BEF2N.js → detail-VSBWYSGZ.js} +73 -71
  149. package/dist/{dispatch-runner-3RY5FSJC.js → dispatch-runner-EEEHGKX4.js} +78 -76
  150. package/dist/docs-VMMWFVHL.js +101 -0
  151. package/dist/{doctor-EQYJOGUG.js → doctor-V5L4IQGP.js} +63 -62
  152. package/dist/{eval-4P7O6CCE.js → eval-VJYJ2BV3.js} +80 -65
  153. package/dist/{eval-inventory-QOYZERXJ.js → eval-inventory-CX24K2JT.js} +5 -60
  154. package/dist/evals-J2H5V6DD.js +104 -0
  155. package/dist/{evidence-D6GUSYJW.js → evidence-POWAEBEW.js} +72 -70
  156. package/dist/evidence-XCCCLS36.js +242 -0
  157. package/dist/{evidence-O76QF7TZ.js → evidence-Y35YSXH6.js} +80 -78
  158. package/dist/{evolve-H47BCETS.js → evolve-GPG72VB6.js} +74 -72
  159. package/dist/{extensions-NNL3ZOCU.js → extensions-YIZ7W3DA.js} +12 -11
  160. package/dist/fleet-2MDCQ2VK.js +264 -0
  161. package/dist/{fleet-KMNS6NOM.js → fleet-W2AF3TOJ.js} +127 -123
  162. package/dist/{fleet-commands-DOWSYCBX.js → fleet-commands-WS56G26H.js} +11 -11
  163. package/dist/fleet-decisions-MYGZ3JW7.js +52 -0
  164. package/dist/{fleet-graph-F2DE2TME.js → fleet-graph-ELTBXBAV.js} +22 -22
  165. package/dist/{fleet-inspect-EN2Q6IVB.js → fleet-inspect-45IK73L4.js} +84 -248
  166. package/dist/{fleet-preflight-FRLETDD3.js → fleet-preflight-T5NCZKHE.js} +4 -4
  167. package/dist/{fleet-validate-B2XDLS57.js → fleet-validate-VG4JBLA4.js} +26 -26
  168. package/dist/{fleet-verify-4JKUWGJ7.js → fleet-verify-VTSABAYO.js} +72 -70
  169. package/dist/{fleet-view-BHJFW26B.js → fleet-view-XC7WMKSS.js} +75 -73
  170. package/dist/{init-XAT5N5YM.js → init-VTJNNTIP.js} +95 -92
  171. package/dist/install-6PIF6F6W.js +19 -0
  172. package/dist/{interop-FVECHFKG.js → interop-IU6BNA7C.js} +25 -25
  173. package/dist/{inventory-7KFQGLCV.js → inventory-QPQUTUUZ.js} +75 -73
  174. package/dist/{library-NY2XOT75.js → library-HUTAS57T.js} +33 -33
  175. package/dist/{library-QAPAO23R.js → library-LF7DLU6S.js} +13 -13
  176. package/dist/library-Q3NWL5CM.js +75 -0
  177. package/dist/{library-import-5Y6MAS3R.js → library-import-PPW4YUC5.js} +25 -25
  178. package/dist/{library-inventory-JT6HWITQ.js → library-inventory-DIRVFRZU.js} +19 -19
  179. package/dist/{library-validation-EQUH25DC.js → library-validation-XHUZ3INE.js} +17 -17
  180. package/dist/{memory-DYVTTCP6.js → memory-Z2LSKNV6.js} +74 -72
  181. package/dist/{models-MASFJ6Y2.js → models-3FTREYPY.js} +53 -52
  182. package/dist/{monitor-YMP4NXJJ.js → monitor-HF2MQRB3.js} +83 -80
  183. package/dist/{orchestrator-AFQRRTEI.js → orchestrator-UYPA6W4S.js} +498 -358
  184. package/dist/{panes-NICTHQCV.js → panes-736XB73K.js} +14 -14
  185. package/dist/{panes-D3Y2KFG5.js → panes-C4P3PIWT.js} +4 -4
  186. package/dist/{paths-PSFAUIGO.js → paths-JQ4QYIYB.js} +6 -6
  187. package/dist/{preload-5Q7VXRFJ.js → preload-XSLRYH3Y.js} +72 -70
  188. package/dist/{reset-7NKZK7JN.js → reset-V7QSPZYE.js} +9 -9
  189. package/dist/{resources-NILSIZAT.js → resources-OJGDFHYT.js} +22 -22
  190. package/dist/{run-BPZGEBZV.js → run-T354SMDW.js} +129 -125
  191. package/dist/settings-MWZXO6RV.js +72 -0
  192. package/dist/{share-EZ6ERBMH.js → share-Y5ZKJPND.js} +26 -26
  193. package/dist/{skills-BTVVNYVM.js → skills-4GLZC4LN.js} +28 -28
  194. package/dist/{skills-eval-UY34MNK7.js → skills-eval-L5T7GODM.js} +87 -85
  195. package/dist/{skills-inventory-JDHSIA7I.js → skills-inventory-LASKXEZI.js} +22 -22
  196. package/dist/{slash-commands-K4FNQ2AT.js → slash-commands-OIMRU36D.js} +49 -49
  197. package/dist/{steer-2B3EQGFH.js → steer-KMAM2Y2C.js} +4 -4
  198. package/dist/{support-L2SOL3IE.js → support-AWC3XKPX.js} +8 -8
  199. package/dist/system-CD75NYBU.js +116 -0
  200. package/dist/{targets-44VKGFLN.js → targets-VSZX2J2S.js} +66 -65
  201. package/dist/{tasks-3KODKFU7.js → tasks-AN567LYH.js} +14 -14
  202. package/dist/{terminal-lease-LXA7MMPO.js → terminal-lease-6KTWNHVY.js} +3 -3
  203. package/dist/{tools-3UB7TEVR.js → tools-AGRK3V5J.js} +13 -13
  204. package/dist/{trace-TAMIU4OJ.js → trace-P4MQZD33.js} +18 -67
  205. package/dist/{uninstall-QYVRPEM4.js → uninstall-BRUTEPIC.js} +37 -12
  206. package/dist/{upgrade-7PMKM2JH.js → upgrade-SBCGHQGJ.js} +22 -21
  207. package/dist/{usage-6EQV7EQK.js → usage-BIDVTO6V.js} +93 -87
  208. package/dist/{verifiers-JLITWSHU.js → verifiers-LTGCAMXS.js} +12 -12
  209. package/dist/{verify-T7NAEVIG.js → verify-OZU4LLNP.js} +9 -9
  210. package/dist/web/client/THIRD_PARTY_LICENSES.md +1809 -0
  211. package/dist/web/client/assets/abnfDiagram-VCTEODGH-C5wfoHm3.js +1 -0
  212. package/dist/web/client/assets/arc-oH91sfLl.js +1 -0
  213. package/dist/web/client/assets/architecture-7GRP2DOG-EGozsYEO.js +1 -0
  214. package/dist/web/client/assets/architectureDiagram-5GKGNRK7-z9FokbJl.js +36 -0
  215. package/dist/web/client/assets/array-BifhSqXX.js +1 -0
  216. package/dist/web/client/assets/atkinson-hyperlegible-next-latin-ext-wght-normal-C6vrW8VD.woff2 +0 -0
  217. package/dist/web/client/assets/atkinson-hyperlegible-next-latin-wght-normal-BcXVPD7q.woff2 +0 -0
  218. package/dist/web/client/assets/blockDiagram-I7D4REHJ-wi0_CYHL.js +129 -0
  219. package/dist/web/client/assets/c4Diagram-7LVT6UL2-DV7NYc2W.js +38 -0
  220. package/dist/web/client/assets/channel-CiUWbHN9.js +1 -0
  221. package/dist/web/client/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  222. package/dist/web/client/assets/chunk-4HAMMTFA-Bhsegh3F.js +62 -0
  223. package/dist/web/client/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  224. package/dist/web/client/assets/chunk-75Z2AOVW-RQCckcQG.js +2 -0
  225. package/dist/web/client/assets/chunk-DU6HZSFF-C5USiOAy.js +125 -0
  226. package/dist/web/client/assets/chunk-F27PBJKO-BcNqv2x1.js +1 -0
  227. package/dist/web/client/assets/chunk-FOHPRMQF-CoA4358r.js +161 -0
  228. package/dist/web/client/assets/chunk-GMAD6QVW-Bq8JWiZT.js +72 -0
  229. package/dist/web/client/assets/chunk-GVQU2GXP-DbchrAeJ.js +1 -0
  230. package/dist/web/client/assets/chunk-IMKFNOWR-DrpvjocK.js +231 -0
  231. package/dist/web/client/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  232. package/dist/web/client/assets/chunk-L3NEJ4N5-DHLmTnCe.js +1 -0
  233. package/dist/web/client/assets/chunk-OSK3NFVY-CsRbtN9n.js +10 -0
  234. package/dist/web/client/assets/chunk-P2QGCYS3-aqPbxoMh.js +1 -0
  235. package/dist/web/client/assets/chunk-POPQ4Y6H-Dl5vw0h0.js +1 -0
  236. package/dist/web/client/assets/chunk-PWAF6VOD-D7OBRSdO.js +1 -0
  237. package/dist/web/client/assets/chunk-SHT3W25Y-CdKCIwuB.js +168 -0
  238. package/dist/web/client/assets/chunk-SVP7TREG-B94Nu_1-.js +88 -0
  239. package/dist/web/client/assets/chunk-TICWLB2K-jjRQI_hk.js +206 -0
  240. package/dist/web/client/assets/chunk-XXDRQBXY-azkbKE37.js +1 -0
  241. package/dist/web/client/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  242. package/dist/web/client/assets/classDiagram-ZZMXUADV-CMODalmo.js +1 -0
  243. package/dist/web/client/assets/classDiagram-v2-VYDZK3BY-CMODalmo.js +1 -0
  244. package/dist/web/client/assets/commit-mono-latin-400-normal-s0S3qwFW.woff +0 -0
  245. package/dist/web/client/assets/commit-mono-latin-400-normal-wzhe4RuD.woff2 +0 -0
  246. package/dist/web/client/assets/cose-bilkent-JH36ORCC-RbQL23qS.js +1 -0
  247. package/dist/web/client/assets/cynefin-OW5HDTMX--i9RDU5f.js +1 -0
  248. package/dist/web/client/assets/cynefinDiagram-5FMLGOSQ-cRcvyBdp.js +62 -0
  249. package/dist/web/client/assets/cytoscape.esm-c2aL46s-.js +321 -0
  250. package/dist/web/client/assets/dagre-C-rnJpZF.js +1 -0
  251. package/dist/web/client/assets/dagre-GXQ25YYZ-C9mZmAPe.js +4 -0
  252. package/dist/web/client/assets/defaultLocale-BFoDCU3G.js +1 -0
  253. package/dist/web/client/assets/diagram-S7CK7UJ4-Oj_zlLDY.js +30 -0
  254. package/dist/web/client/assets/diagram-UQ7AKVKN-BWKbbfcR.js +41 -0
  255. package/dist/web/client/assets/diagram-VSXAHHWV-C3N3f7DO.js +3 -0
  256. package/dist/web/client/assets/diagram-VX7I27RA-CtDKDAWe.js +24 -0
  257. package/dist/web/client/assets/diagram-Z3DM3KII-B8bkBRCz.js +24 -0
  258. package/dist/web/client/assets/dist-D0_q-A2b.js +1 -0
  259. package/dist/web/client/assets/ebnfDiagram-PWID7BFC-CskW-Whx.js +1 -0
  260. package/dist/web/client/assets/erDiagram-RLTQ6QDP-C-83cgCW.js +99 -0
  261. package/dist/web/client/assets/eventmodeling-NTZA5JFV-DjVq8wKU.js +1 -0
  262. package/dist/web/client/assets/flowDiagram-HODETNUW-BUiCBGXt.js +1 -0
  263. package/dist/web/client/assets/ganttDiagram-EL5Y4UJY-B2lb8lvF.js +292 -0
  264. package/dist/web/client/assets/gitGraph-4MIJSDKK-B40cQtBE.js +1 -0
  265. package/dist/web/client/assets/gitGraphDiagram-WWUBYQGX-CH-7P7Di.js +106 -0
  266. package/dist/web/client/assets/graphlib-DS17s2tU.js +1 -0
  267. package/dist/web/client/assets/index-Dsi52apB.css +1 -0
  268. package/dist/web/client/assets/index-FSIC94pi.js +83 -0
  269. package/dist/web/client/assets/info-A6RAGUB7-eCCE9D_Q.js +1 -0
  270. package/dist/web/client/assets/infoDiagram-27XIBGKW-DRnvqMjM.js +2 -0
  271. package/dist/web/client/assets/init-C-OQMol4.js +1 -0
  272. package/dist/web/client/assets/ishikawaDiagram-5VMMS53U-DBA_55wp.js +70 -0
  273. package/dist/web/client/assets/journeyDiagram-3NMN7TZE-C-ewpNl7.js +139 -0
  274. package/dist/web/client/assets/kanban-definition-UXKFOSKX-B1taGsu0.js +89 -0
  275. package/dist/web/client/assets/katex-ZlcWpGUi.js +257 -0
  276. package/dist/web/client/assets/line-lZ0kyxDI.js +1 -0
  277. package/dist/web/client/assets/linear-DIc8FgZj.js +1 -0
  278. package/dist/web/client/assets/mermaid-parser.core-SXolxpXw.js +7 -0
  279. package/dist/web/client/assets/mermaid.core-DXgQtkNg.js +44 -0
  280. package/dist/web/client/assets/mindmap-definition-YA3MSWOX-DXJas9K7.js +96 -0
  281. package/dist/web/client/assets/newsreader-latin-ext-wght-normal-C-3rgBeH.woff2 +0 -0
  282. package/dist/web/client/assets/newsreader-latin-wght-normal-CCVVNp6i.woff2 +0 -0
  283. package/dist/web/client/assets/newsreader-vietnamese-wght-normal-Czsa-EzN.woff2 +0 -0
  284. package/dist/web/client/assets/ordinal-BDEzSJ7C.js +1 -0
  285. package/dist/web/client/assets/packet-AYTQ26CC-OqVl_07o.js +1 -0
  286. package/dist/web/client/assets/path-fybaL0A-.js +1 -0
  287. package/dist/web/client/assets/pegDiagram-XKGWAZYB-CPE_zdfN.js +1 -0
  288. package/dist/web/client/assets/pie-WAS4IAKB-DAxnMBLe.js +1 -0
  289. package/dist/web/client/assets/pieDiagram-E7YTZNPT-Uwjpufxv.js +39 -0
  290. package/dist/web/client/assets/prism-bash-D6zCJ74D.js +1 -0
  291. package/dist/web/client/assets/prism-c-04YixN25.js +1 -0
  292. package/dist/web/client/assets/prism-clike-DapgWyxx.js +1 -0
  293. package/dist/web/client/assets/prism-core-BngLtbUd.js +1 -0
  294. package/dist/web/client/assets/prism-cpp-C-lJbC-6.js +1 -0
  295. package/dist/web/client/assets/prism-css-CPgOzxXp.js +1 -0
  296. package/dist/web/client/assets/prism-diff-BF8m0_mq.js +3 -0
  297. package/dist/web/client/assets/prism-docker-DkT6yOFj.js +1 -0
  298. package/dist/web/client/assets/prism-fortran-Be5x3y1V.js +1 -0
  299. package/dist/web/client/assets/prism-go-C_8qAH5n.js +1 -0
  300. package/dist/web/client/assets/prism-ini-BESK3y0r.js +1 -0
  301. package/dist/web/client/assets/prism-javascript-BnO-swvr.js +1 -0
  302. package/dist/web/client/assets/prism-json-Dp_-W-Hv.js +1 -0
  303. package/dist/web/client/assets/prism-jsx-D-D0NWtC.js +1 -0
  304. package/dist/web/client/assets/prism-julia-DIjOgiAV.js +1 -0
  305. package/dist/web/client/assets/prism-latex-DNMbqcH_.js +1 -0
  306. package/dist/web/client/assets/prism-makefile-CRKWLQ8l.js +1 -0
  307. package/dist/web/client/assets/prism-markdown-C0FPJ1Iz.js +1 -0
  308. package/dist/web/client/assets/prism-markup-Cp04rIa1.js +1 -0
  309. package/dist/web/client/assets/prism-matlab-D-nk08al.js +1 -0
  310. package/dist/web/client/assets/prism-python-CfiSVtM6.js +1 -0
  311. package/dist/web/client/assets/prism-r-QmNGR8LX.js +1 -0
  312. package/dist/web/client/assets/prism-rust-Bu9N8X3N.js +1 -0
  313. package/dist/web/client/assets/prism-shell-session-Be4UuYoM.js +1 -0
  314. package/dist/web/client/assets/prism-sql-CYhVDMEE.js +1 -0
  315. package/dist/web/client/assets/prism-toml-DKb54GAT.js +1 -0
  316. package/dist/web/client/assets/prism-tsx-p6J2Kc_4.js +1 -0
  317. package/dist/web/client/assets/prism-typescript-BMqONzxf.js +1 -0
  318. package/dist/web/client/assets/prism-yaml-C0JHu8gr.js +1 -0
  319. package/dist/web/client/assets/purify.es-ChwZkWde.js +3 -0
  320. package/dist/web/client/assets/quadrantDiagram-AXDQQJYC-Bjs4yjgs.js +7 -0
  321. package/dist/web/client/assets/radar-RG4KPBEZ-CuCKjHM3.js +1 -0
  322. package/dist/web/client/assets/railroad-74A4TZTK-CnQK-Cc1.js +1 -0
  323. package/dist/web/client/assets/railroad-abnf-HS5TGJTU-BcW01NZG.js +1 -0
  324. package/dist/web/client/assets/railroad-ebnf-LZEXJU2U-B7YCEDDd.js +1 -0
  325. package/dist/web/client/assets/railroad-peg-WCYAUIDC-DjNZbSTZ.js +1 -0
  326. package/dist/web/client/assets/railroadDiagram-O6MQD6OU-BDDIPNLL.js +1 -0
  327. package/dist/web/client/assets/requirementDiagram-BXWQKSXE-B5Ydyxc1.js +84 -0
  328. package/dist/web/client/assets/rough.esm-Dy-Kn_BL.js +1 -0
  329. package/dist/web/client/assets/sankeyDiagram-P5KCCOFB-Bw2Qym75.js +40 -0
  330. package/dist/web/client/assets/sequenceDiagram-WJ2MYXX4-BZf36nO0.js +162 -0
  331. package/dist/web/client/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
  332. package/dist/web/client/assets/src-yeptRXpt.js +1 -0
  333. package/dist/web/client/assets/stateDiagram-D77RDMKH-DnH6JRkp.js +1 -0
  334. package/dist/web/client/assets/stateDiagram-v2-MP3YSRHH-C7QtHeK4.js +1 -0
  335. package/dist/web/client/assets/swimlanes-42K2YHIH-D9PZmtZg.js +1 -0
  336. package/dist/web/client/assets/swimlanesDiagram-VR7AAH4N-CBZlPFky.js +8 -0
  337. package/dist/web/client/assets/timeline-definition-24CTP7MA-CrkZZBo7.js +120 -0
  338. package/dist/web/client/assets/treeView-Q6P3EWNA-C9zDShoC.js +1 -0
  339. package/dist/web/client/assets/treemap-WGGIJYW6-B-plj9yK.js +1 -0
  340. package/dist/web/client/assets/vennDiagram-4TSXK5OY-VeOdaphN.js +34 -0
  341. package/dist/web/client/assets/wardley-WFR3VGLG-Wl1P_m6L.js +1 -0
  342. package/dist/web/client/assets/wardleyDiagram-VM6X3IG4-B85-R9t2.js +78 -0
  343. package/dist/web/client/assets/xychartDiagram-S5SC5T6Z-BrD8OW8m.js +7 -0
  344. package/dist/web/client/clio-coder-logo.webp +0 -0
  345. package/dist/web/client/icon-192.png +0 -0
  346. package/dist/web/client/icon-512.png +0 -0
  347. package/dist/web/client/index.html +4 -0
  348. package/dist/web/client/manifest.webmanifest +15 -0
  349. package/dist/web/client/offline.css +55 -0
  350. package/dist/web/client/offline.html +5 -0
  351. package/dist/web/client/offline.js +27 -0
  352. package/dist/web/client/sw.js +34 -0
  353. package/dist/web/ops-worker.js +37 -0
  354. package/dist/web/reads-worker.js +1726 -0
  355. package/dist/web/server.js +8499 -0
  356. package/dist/web-EU6ATJWA.js +13 -0
  357. package/dist/{web-fetch-W4TNW4Q7.js → web-fetch-U22Q7HV4.js} +3 -3
  358. package/dist/{wiki-generate-T2TJQJUA.js → wiki-generate-LZRLFG6I.js} +98 -95
  359. package/dist/{with-panes-CHFC7HGI.js → with-panes-X5CZOGML.js} +9 -9
  360. package/dist/worker/entry.js +68 -68
  361. package/docs/README.md +27 -26
  362. package/docs/architecture/acp.md +5 -9
  363. package/docs/architecture/alcf-provider.md +0 -3
  364. package/docs/architecture/architecture.md +0 -3
  365. package/docs/architecture/artifact-placement.md +0 -3
  366. package/docs/architecture/artifact-versions.md +0 -3
  367. package/docs/architecture/capacity-and-scheduling.md +0 -3
  368. package/docs/architecture/context-engine.md +0 -3
  369. package/docs/architecture/context-working-set.md +0 -3
  370. package/docs/architecture/dispatch-architecture-rationale.md +0 -3
  371. package/docs/architecture/dispatch-typed-intent.md +0 -3
  372. package/docs/architecture/evidence-and-memory.md +0 -3
  373. package/docs/architecture/library.md +0 -2
  374. package/docs/architecture/middleware-and-components.md +0 -3
  375. package/docs/architecture/model-catalog.md +1 -4
  376. package/docs/architecture/observability.md +0 -3
  377. package/docs/architecture/pi-boundary.md +6 -9
  378. package/docs/architecture/prompt-envelope-and-tools.md +1 -4
  379. package/docs/architecture/provider-adapter-cookbook.md +1 -4
  380. package/docs/architecture/safety-model.md +0 -3
  381. package/docs/architecture/session-lifecycle.md +0 -3
  382. package/docs/architecture/time-conventions.md +0 -3
  383. package/docs/architecture/trace-store.md +28 -20
  384. package/docs/architecture/tui-design.md +1 -4
  385. package/docs/architecture/worker-context.md +1 -3
  386. package/docs/architecture/worker-dispatch-mechanics.md +1 -4
  387. package/docs/guide/authoring-plugins.md +1 -3
  388. package/docs/guide/built-in-agents.md +0 -3
  389. package/docs/guide/commands-and-modes.md +2 -6
  390. package/docs/guide/configuration-and-targets.md +197 -4
  391. package/docs/guide/configuration-reference.md +9 -4
  392. package/docs/guide/environment-variables.md +0 -3
  393. package/docs/guide/exit-codes-and-output.md +0 -3
  394. package/docs/guide/extensions-and-sharing.md +0 -3
  395. package/docs/guide/fleet-dispatch.md +0 -3
  396. package/docs/guide/glossary.md +0 -3
  397. package/docs/guide/harness-extensions.md +0 -2
  398. package/docs/guide/installation-and-lifecycle.md +1 -4
  399. package/docs/guide/interop.md +0 -2
  400. package/docs/guide/panes-and-files.md +0 -3
  401. package/docs/guide/plugins.md +0 -3
  402. package/docs/guide/proactive-memory.md +0 -3
  403. package/docs/guide/resource-library.md +0 -2
  404. package/docs/guide/skills-marketplace.md +0 -2
  405. package/docs/guide/tool-usage.md +0 -3
  406. package/docs/guide/troubleshooting.md +0 -3
  407. package/docs/history/config-knobs-audit.md +0 -3
  408. package/docs/history/release-cut-checklist.md +0 -3
  409. package/docs/process/development-pipeline.md +0 -3
  410. package/docs/process/documentation-coverage.md +3 -3
  411. package/docs/process/documentation-guide.md +15 -22
  412. package/docs/process/eval-runner.md +0 -3
  413. package/docs/process/evals-internal.md +0 -3
  414. package/docs/process/evolution.md +0 -3
  415. package/docs/process/fleet-demo-runbook.md +0 -3
  416. package/docs/process/git-commit-provenance.md +0 -3
  417. package/docs/process/performance-methodology.md +1 -4
  418. package/docs/process/release-cut-checklist.md +114 -221
  419. package/docs/process/scientific-validation.md +1 -4
  420. package/library/registry.yaml +2 -2
  421. package/library/skills/meta/clio-coder-test/SKILL.md +25 -15
  422. package/library/skills/meta/clio-coder-test/evals.md +16 -2
  423. package/library/skills/meta/clio-coder-test/plugin.json +1 -1
  424. package/library/skills/meta/clio-coder-test/references/test-map.md +19 -18
  425. package/library/skills/registry.yaml +2 -2
  426. package/library/skills/skill-marketplace.json +1 -1
  427. package/package.json +13 -11
  428. package/src/cli/docs.ts +65 -328
  429. package/src/cli/index.ts +3 -1
  430. package/src/cli/trace.ts +4 -65
  431. package/src/cli/uninstall.ts +26 -0
  432. package/src/cli/usage.ts +3 -0
  433. package/src/cli/web.ts +79 -0
  434. package/src/core/bus-events.ts +3 -4
  435. package/src/core/config.ts +71 -0
  436. package/src/core/domain-loader.ts +37 -28
  437. package/src/core/termination.ts +13 -9
  438. package/src/domains/agents/contract.ts +1 -1
  439. package/src/domains/agents/extension.ts +18 -10
  440. package/src/domains/config/extension.ts +5 -4
  441. package/src/domains/dispatch/extension.ts +75 -12
  442. package/src/domains/dispatch/index.ts +1 -0
  443. package/src/domains/dispatch/orphan-recovery.ts +1 -0
  444. package/src/domains/dispatch/receipt-integrity.ts +3 -0
  445. package/src/domains/dispatch/state.ts +1 -2
  446. package/src/domains/dispatch/types.ts +2 -0
  447. package/src/domains/eval/metrics/tracked.ts +22 -2
  448. package/src/domains/extensions/operator-runtime.ts +3 -1
  449. package/src/domains/middleware/hooks.ts +2 -2
  450. package/src/domains/observability/background-memory-usage.ts +3 -0
  451. package/src/domains/observability/compaction-usage.ts +2 -0
  452. package/src/domains/observability/cost.ts +5 -0
  453. package/src/domains/observability/extension.ts +1 -0
  454. package/src/domains/observability/out-of-turn-usage.ts +2 -0
  455. package/src/domains/observability/trace-store.ts +65 -5
  456. package/src/domains/prompts/extension.ts +4 -17
  457. package/src/domains/providers/cache-deployment.ts +147 -0
  458. package/src/domains/providers/catalog.ts +12 -7
  459. package/src/domains/providers/extension.ts +27 -5
  460. package/src/domains/providers/index.ts +1 -0
  461. package/src/domains/providers/plugins.ts +3 -13
  462. package/src/domains/providers/runtimes/common/local-synth.ts +4 -0
  463. package/src/domains/providers/types/target-descriptor.ts +17 -0
  464. package/src/domains/session/compaction/compact.ts +4 -1
  465. package/src/domains/session/entries.ts +1 -0
  466. package/src/domains/session/usage.ts +6 -7
  467. package/src/engine/acp/server.ts +11 -0
  468. package/src/engine/ai.ts +2 -0
  469. package/src/engine/apis/openai-completions.ts +9 -4
  470. package/src/engine/prewarm.ts +232 -0
  471. package/src/engine/provider-diagnostics.ts +6 -1
  472. package/src/entry/orchestrator.ts +20 -16
  473. package/src/interactive/chat-loop-messages.ts +3 -0
  474. package/src/interactive/chat-loop.ts +2 -8
  475. package/src/interactive/prewarm.ts +11 -197
  476. package/src/interactive/session-usage-reseed.ts +2 -0
  477. package/src/interactive/side-question.ts +2 -0
  478. package/src/interactive/turn-context.ts +1 -0
  479. package/src/interactive/turn-persistence.ts +3 -0
  480. package/src/interactive/turn-prewarm.ts +126 -19
  481. package/src/interactive/turn-runtime.ts +14 -0
  482. package/src/tools/builtin-tool-catalog.ts +8 -4
  483. package/src/tools/registry.ts +12 -2
  484. package/src/worker/spec-contract.ts +27 -0
  485. package/dist/docs-BL7ROUFN.js +0 -292
@@ -11,11 +11,11 @@ import {
11
11
  createWriteBoundaryEnforcer,
12
12
  gitCheckoutRoot,
13
13
  workspaceCheckpointRef
14
- } from "./chunk-UA3W4FGC.js";
14
+ } from "./chunk-K53E2PTW.js";
15
15
  import {
16
16
  executionPlanAncestors,
17
17
  spliceExecutionPlan
18
- } from "./chunk-RTLNFZMD.js";
18
+ } from "./chunk-L75H5B3B.js";
19
19
  import {
20
20
  decideReviewGate,
21
21
  materializePendingGateDecision,
@@ -23,7 +23,7 @@ import {
23
23
  readGateDecisionArtifactsForRunIds,
24
24
  stagePendingGateDecision,
25
25
  verifyGateDecisionArtifact
26
- } from "./chunk-EUEXGXXR.js";
26
+ } from "./chunk-H77XBUBM.js";
27
27
  import {
28
28
  RUN_RECEIPT_INTEGRITY_ALGORITHM,
29
29
  RUN_RECEIPT_INTEGRITY_VERSION,
@@ -43,14 +43,14 @@ import {
43
43
  trustVerdict,
44
44
  verifyReceiptIntegrity,
45
45
  withReceiptIntegrity
46
- } from "./chunk-IQCNVLO6.js";
46
+ } from "./chunk-FB3KTE2J.js";
47
47
  import {
48
48
  protectedArtifactFromSessionEntry,
49
49
  protectedArtifactStateFromSessionEntries,
50
50
  readAuditRows,
51
51
  readSessionEntriesForId,
52
52
  responseModelIdObservationFromRecord
53
- } from "./chunk-D2T66PDV.js";
53
+ } from "./chunk-BIY22UUK.js";
54
54
  import {
55
55
  loadEvalArtifact,
56
56
  parseEvalArtifactV4,
@@ -60,11 +60,28 @@ import {
60
60
  import {
61
61
  codeStepDir,
62
62
  writeCodeStepRecord
63
- } from "./chunk-P5SC4DLJ.js";
63
+ } from "./chunk-QYSAZMSH.js";
64
+ import {
65
+ filterEntriesToActivePath
66
+ } from "./chunk-O5F25NIE.js";
64
67
  import {
65
68
  defaultRunEventJournal,
66
69
  removeRunEventJournals
67
70
  } from "./chunk-UQIVHSE4.js";
71
+ import {
72
+ AdmissionCanceledError,
73
+ EVENT_TEE_LIMIT,
74
+ activeDecisionRefs,
75
+ createWorkerOutputCapture,
76
+ durableAssistantTextFromEvent,
77
+ foldDecisionBoard,
78
+ startDispatchEventPump,
79
+ workerOutputCaptureBytes
80
+ } from "./chunk-STC6CWUZ.js";
81
+ import {
82
+ judgeNumericTexts,
83
+ judgePerfTexts
84
+ } from "./chunk-RKFNU5UA.js";
68
85
  import {
69
86
  changedPathsSince,
70
87
  computeWikiContentHash,
@@ -77,18 +94,7 @@ import {
77
94
  wikiStaleness,
78
95
  writeWikiMeta,
79
96
  writeWikiMetaInDir
80
- } from "./chunk-USZA7GWL.js";
81
- import {
82
- readClioState,
83
- statePath,
84
- writeClioState
85
- } from "./chunk-WTQGRBHV.js";
86
- import {
87
- buildCodewikiCandidate,
88
- coordinateCodewikiExclusive,
89
- coordinateCodewikiWrite,
90
- drainCodewikiWrites
91
- } from "./chunk-XR3XJN2M.js";
97
+ } from "./chunk-YQ3GFEUY.js";
92
98
  import {
93
99
  WIKI_INDEX,
94
100
  WIKI_PLAN_FILE,
@@ -107,24 +113,18 @@ import {
107
113
  wikiMarkdownFilesInDir,
108
114
  wikiSourcesMatch,
109
115
  writeWikiPlanFile
110
- } from "./chunk-LVFANMOH.js";
111
- import {
112
- filterEntriesToActivePath
113
- } from "./chunk-O5F25NIE.js";
116
+ } from "./chunk-BHJMMCXS.js";
114
117
  import {
115
- AdmissionCanceledError,
116
- EVENT_TEE_LIMIT,
117
- activeDecisionRefs,
118
- createWorkerOutputCapture,
119
- durableAssistantTextFromEvent,
120
- foldDecisionBoard,
121
- startDispatchEventPump,
122
- workerOutputCaptureBytes
123
- } from "./chunk-CULVKYTK.js";
118
+ readClioState,
119
+ statePath,
120
+ writeClioState
121
+ } from "./chunk-WTQGRBHV.js";
124
122
  import {
125
- judgeNumericTexts,
126
- judgePerfTexts
127
- } from "./chunk-TLTGZTXI.js";
123
+ buildCodewikiCandidate,
124
+ coordinateCodewikiExclusive,
125
+ coordinateCodewikiWrite,
126
+ drainCodewikiWrites
127
+ } from "./chunk-WWRV5RJI.js";
128
128
  import {
129
129
  LOCAL_NODE_ID,
130
130
  computeSettingsFingerprint,
@@ -135,7 +135,7 @@ import {
135
135
  receiptAttestationFields,
136
136
  routeFactVerdict,
137
137
  spawnNativeWorker
138
- } from "./chunk-N37QC5FV.js";
138
+ } from "./chunk-JRA6OBHY.js";
139
139
  import {
140
140
  createTomlFileReader,
141
141
  tomlTableAt
@@ -143,11 +143,20 @@ import {
143
143
  import {
144
144
  parseRigorOverride,
145
145
  resolveRigor
146
- } from "./chunk-NCCQ6DVS.js";
146
+ } from "./chunk-2ZWLMA3T.js";
147
147
  import {
148
148
  describeValidationContract,
149
149
  loadValidationContract
150
- } from "./chunk-T52TPHYC.js";
150
+ } from "./chunk-RFULVPBX.js";
151
+ import {
152
+ FLEET_COMMAND_BASE_ENV,
153
+ normalizeWriteBoundary,
154
+ validateFleetCommandArgs
155
+ } from "./chunk-7QQRPB2E.js";
156
+ import {
157
+ AcpTimeoutError,
158
+ createStdioTransport
159
+ } from "./chunk-WS4FOGLY.js";
151
160
  import {
152
161
  AGENT_LEDGER_PROMPT_MAX_CHARS,
153
162
  COUNCIL_MIN_MEMBERS,
@@ -189,7 +198,7 @@ import {
189
198
  serializeWorkerRuntimeDescriptor,
190
199
  toolPromptHintsForNames,
191
200
  validateJobSpec
192
- } from "./chunk-NO7J45X6.js";
201
+ } from "./chunk-MWMW53WW.js";
193
202
  import {
194
203
  WORKER_CONTEXT_MAX_BYTES,
195
204
  completeHistoryLength,
@@ -212,27 +221,17 @@ import {
212
221
  routingIntentRejection,
213
222
  sameRouteIdentity,
214
223
  toRouteCandidate
215
- } from "./chunk-T4TY5GG3.js";
216
- import {
217
- describeCallAction
218
- } from "./chunk-2GPGAE5W.js";
224
+ } from "./chunk-RM3XJX7P.js";
219
225
  import {
220
226
  isLoadableExtension
221
227
  } from "./chunk-OH3YYA3B.js";
222
228
  import {
223
229
  extensionToolName,
224
230
  listInstalledExtensions
225
- } from "./chunk-24S3DN22.js";
226
- import {
227
- networkToolsDisabled
228
- } from "./chunk-SL2RDHKO.js";
229
- import {
230
- compileGlobRegex,
231
- normalizeGlobInput
232
- } from "./chunk-V552WL53.js";
231
+ } from "./chunk-6TKOFFGE.js";
233
232
  import {
234
- TOOL_RESULT_TRUST_CONTRACT
235
- } from "./chunk-WXA2CFJO.js";
233
+ describeCallAction
234
+ } from "./chunk-2GPGAE5W.js";
236
235
  import {
237
236
  applyToolProfile,
238
237
  assertToolProfileEnforceable
@@ -244,7 +243,7 @@ import {
244
243
  requestExecutionRole,
245
244
  routeCorrelationFactsForRun,
246
245
  withAttemptRole
247
- } from "./chunk-3LXJOICS.js";
246
+ } from "./chunk-FNVPQQYT.js";
248
247
  import {
249
248
  declaredScopeIntent,
250
249
  declaredScopeReplacementDiagnostic,
@@ -253,28 +252,25 @@ import {
253
252
  inferredScopeParentTokenNotice,
254
253
  resolveDispatchPathScope
255
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";
256
265
  import {
257
266
  WORKER_STDIN_FRAME_MAX_BYTES,
258
267
  canonicalJson,
259
268
  endpointIdentityHash,
260
269
  parseAgentLedgerBody
261
270
  } from "./chunk-VQD7NH7Z.js";
262
- import {
263
- createRedactionTally,
264
- redactSecretsDeep,
265
- redactSecretsText
266
- } from "./chunk-O3VV6IVK.js";
267
- import {
268
- decisionRef,
269
- isDecisionRecord,
270
- isSkillActivation
271
- } from "./chunk-KAFMW7WM.js";
272
271
  import {
273
272
  assessFinishContract
274
- } from "./chunk-BQQ5MXUC.js";
275
- import {
276
- WRITE_ROOT_REFUSED_TOOLS
277
- } from "./chunk-DLIYANB7.js";
273
+ } from "./chunk-MUXNDNMZ.js";
278
274
  import {
279
275
  canonicalEndpointKey,
280
276
  canonicalizeWireModelId,
@@ -293,59 +289,29 @@ import {
293
289
  resolveRuntimeTarget,
294
290
  runtimeResolutionWarnings,
295
291
  runtimeTargetSnapshot
296
- } from "./chunk-WT5TRMO4.js";
292
+ } from "./chunk-GVU4CXPJ.js";
297
293
  import {
298
294
  ceilChars,
299
295
  estimateAgentMessageTokens
300
- } from "./chunk-77CZRFTE.js";
301
- import {
302
- DEFAULT_AUTONOMY_LEVEL,
303
- autonomyDenyRejection,
304
- mapAutonomy
305
- } from "./chunk-EM2WNQS2.js";
296
+ } from "./chunk-OPC4DQD6.js";
306
297
  import {
307
- atomicWrite
308
- } from "./chunk-FQOOGXBH.js";
298
+ WRITE_ROOT_REFUSED_TOOLS
299
+ } from "./chunk-RAUOKUZV.js";
309
300
  import {
310
- assertSafeId
311
- } from "./chunk-UHW5V7HC.js";
301
+ resolveEffectivePricing
302
+ } from "./chunk-UDAK6GR2.js";
312
303
  import {
313
304
  compareCodepoints
314
305
  } from "./chunk-B6UM3OZC.js";
315
306
  import {
316
307
  truncateUtf8
317
308
  } from "./chunk-MYI32N4R.js";
318
- import {
319
- normalizeClioCoderEventRecord,
320
- normalizeClioCoderEventType
321
- } from "./chunk-KMF54VH3.js";
322
309
  import {
323
310
  BusChannels
324
- } from "./chunk-6CB2IL4N.js";
325
- import {
326
- computeFingerprintCached,
327
- isStale
328
- } from "./chunk-VHKTOLEW.js";
329
- import {
330
- codewikiPath
331
- } from "./chunk-W2RJEH6Q.js";
332
- import {
333
- detectProjectType
334
- } from "./chunk-CVDAFGPW.js";
335
- import {
336
- enumerateWorkspaceFiles
337
- } from "./chunk-PPEZJWUG.js";
311
+ } from "./chunk-W5RM7YAH.js";
338
312
  import {
339
313
  targetRequiresAuth
340
- } from "./chunk-6TAATXXH.js";
341
- import {
342
- resolveEffectivePricing
343
- } from "./chunk-TN5FW4XY.js";
344
- import {
345
- FLEET_COMMAND_BASE_ENV,
346
- normalizeWriteBoundary,
347
- validateFleetCommandArgs
348
- } from "./chunk-KKEYGFX4.js";
314
+ } from "./chunk-PAQVETLA.js";
349
315
  import {
350
316
  agentSpecFingerprint,
351
317
  assertAgentSpecPolicy,
@@ -355,24 +321,24 @@ import {
355
321
  resolveAgentToolCompatibility,
356
322
  resultContractAuthorship,
357
323
  validateRecipeResult
358
- } from "./chunk-34XHRVKG.js";
324
+ } from "./chunk-ARRUMZ7X.js";
359
325
  import {
360
326
  INTEROP_AGENT_KINDS
361
327
  } from "./chunk-5EQO5NWP.js";
362
328
  import {
363
329
  classify
364
- } from "./chunk-HOX4YZ2K.js";
330
+ } from "./chunk-YXFKLMX2.js";
365
331
  import {
366
332
  detectValidationCommand
367
- } from "./chunk-2O2LVQQK.js";
368
- import {
369
- canonicalizeExistingPath
370
- } from "./chunk-KQ6IDQIB.js";
333
+ } from "./chunk-E2NSPYLC.js";
371
334
  import {
372
335
  PATH_BOUNDARY_MAX_ENTRIES,
373
336
  pathBoundaryCovers,
374
337
  resolvePathBoundary
375
338
  } from "./chunk-R2P2U3ZS.js";
339
+ import {
340
+ canonicalizeExistingPath
341
+ } from "./chunk-KQ6IDQIB.js";
376
342
  import {
377
343
  isProjectVerifierCheckId,
378
344
  isVerificationScriptName
@@ -382,11 +348,6 @@ import {
382
348
  isBuiltinToolName,
383
349
  isHarnessExtensionToolName
384
350
  } from "./chunk-WLHX3MM5.js";
385
- import {
386
- readClioVersion,
387
- readPiMonoVersion,
388
- resolvePackageRoot
389
- } from "./chunk-E3LEPLQ2.js";
390
351
  import {
391
352
  DEFAULT_DELEGATION_CONNECT_TIMEOUT_MS,
392
353
  DEFAULT_DELEGATION_TURN_TIMEOUT_MS,
@@ -398,8 +359,8 @@ import {
398
359
  resolveGuardrail
399
360
  } from "./chunk-C27U2TYG.js";
400
361
  import {
401
- buildSafeToolEnv
402
- } from "./chunk-GJ24ODAX.js";
362
+ require_dist
363
+ } from "./chunk-B5GGDIHT.js";
403
364
  import {
404
365
  attributeCommitMessage,
405
366
  gitCommitAttributionEnabled,
@@ -407,34 +368,73 @@ import {
407
368
  withManagedGitCommitAttributionEnvironment
408
369
  } from "./chunk-LTR5QCLS.js";
409
370
  import {
410
- MAX_TIMER_DELAY_MS,
411
371
  rawDurationMs
412
372
  } from "./chunk-6EXUUOSN.js";
413
373
  import {
414
374
  AI_AGENT_NAME
415
375
  } from "./chunk-ZTNFYMIO.js";
376
+ import {
377
+ decisionRef,
378
+ isDecisionRecord,
379
+ isSkillActivation
380
+ } from "./chunk-6R5MBXBJ.js";
381
+ import {
382
+ createRedactionTally,
383
+ redactSecretsDeep,
384
+ redactSecretsText
385
+ } from "./chunk-O3VV6IVK.js";
386
+ import {
387
+ DEFAULT_AUTONOMY_LEVEL,
388
+ autonomyDenyRejection,
389
+ mapAutonomy
390
+ } from "./chunk-EM2WNQS2.js";
391
+ import {
392
+ atomicWrite
393
+ } from "./chunk-36XSBPXL.js";
394
+ import {
395
+ assertSafeId
396
+ } from "./chunk-UHW5V7HC.js";
416
397
  import {
417
398
  FILE_LOCK_ACQUIRE_TIMEOUT_MS,
418
399
  withStateFileLock,
419
400
  withStateFileLockSync
420
401
  } from "./chunk-DVJL77SO.js";
402
+ import {
403
+ normalizeClioCoderEventRecord,
404
+ normalizeClioCoderEventType
405
+ } from "./chunk-KMF54VH3.js";
421
406
  import {
422
407
  BIRTH_TOKEN_SOURCE_AVAILABLE,
423
408
  processAlive,
424
409
  processBirthToken
425
410
  } from "./chunk-TK2BMCBZ.js";
426
- import {
427
- require_dist
428
- } from "./chunk-B5GGDIHT.js";
429
- import {
430
- safeResourceWrite
431
- } from "./chunk-ZZFWWYLX.js";
432
411
  import {
433
412
  clioDataDir,
434
413
  clioStateDir,
435
414
  resolveClioDirs,
436
415
  stateRootRemoved
437
416
  } from "./chunk-CTTI7G3T.js";
417
+ import {
418
+ computeFingerprintCached,
419
+ isStale
420
+ } from "./chunk-VHKTOLEW.js";
421
+ import {
422
+ codewikiPath
423
+ } from "./chunk-W2RJEH6Q.js";
424
+ import {
425
+ detectProjectType
426
+ } from "./chunk-CVDAFGPW.js";
427
+ import {
428
+ enumerateWorkspaceFiles
429
+ } from "./chunk-PPEZJWUG.js";
430
+ import {
431
+ safeResourceWrite
432
+ } from "./chunk-ZZFWWYLX.js";
433
+ import {
434
+ readClioVersion,
435
+ readPiMonoVersion,
436
+ resolvePackageRoot
437
+ } from "./chunk-E3LEPLQ2.js";
438
438
  import {
439
439
  __toESM,
440
440
  init_esm_shims
@@ -5275,7 +5275,7 @@ function persistWorkerContextSeed(input) {
5275
5275
  import { createHash as createHash13, randomBytes as randomBytes5 } from "node:crypto";
5276
5276
  import { readdirSync as readdirSync8, readFileSync as readFileSync22 } from "node:fs";
5277
5277
  import { isAbsolute as isAbsolute6, relative as relative6, resolve as resolvePath, sep as sep3 } from "node:path";
5278
- import { performance as performance5 } from "node:perf_hooks";
5278
+ import { performance as performance4 } from "node:perf_hooks";
5279
5279
 
5280
5280
  // src/core/residency-protection.ts
5281
5281
  init_esm_shims();
@@ -5296,72 +5296,7 @@ function protectedResidencyModels(settings) {
5296
5296
 
5297
5297
  // src/engine/acp/adapter.ts
5298
5298
  init_esm_shims();
5299
- import { performance as performance4 } from "node:perf_hooks";
5300
-
5301
- // src/engine/acp/errors.ts
5302
- init_esm_shims();
5303
- var AcpError = class extends Error {
5304
- code;
5305
- data;
5306
- constructor(code, message, data) {
5307
- super(message);
5308
- this.name = "AcpError";
5309
- this.code = code;
5310
- this.data = data;
5311
- }
5312
- };
5313
- var AcpProtocolError = class extends AcpError {
5314
- constructor(message, data) {
5315
- super("acp_protocol_error", message, data);
5316
- this.name = "AcpProtocolError";
5317
- }
5318
- };
5319
- var AcpTimeoutError = class extends AcpError {
5320
- constructor(message, data) {
5321
- super("acp_timeout", message, data);
5322
- this.name = "AcpTimeoutError";
5323
- }
5324
- };
5325
- var AcpProcessError = class extends AcpError {
5326
- constructor(message, data) {
5327
- super("acp_process_error", message, data);
5328
- this.name = "AcpProcessError";
5329
- }
5330
- };
5331
- var ACP_MAX_ERROR_MESSAGE_CHARS = 256;
5332
- var ACP_TURN_FAILED_MESSAGE = "the prompt turn failed";
5333
- var ACP_INTERNAL_ERROR_MESSAGE = "internal error";
5334
- var ACP_METHOD_NOT_FOUND_MESSAGE = "method not found";
5335
- var ACP_ERROR_META_KEY = "clio-coder/error";
5336
- var ACP_ERROR_META_VERSION = 1;
5337
- var AcpRequestError = class extends Error {
5338
- constructor(rpcCode, message, detail) {
5339
- super(message);
5340
- this.rpcCode = rpcCode;
5341
- this.detail = detail;
5342
- this.name = "AcpRequestError";
5343
- }
5344
- rpcCode;
5345
- detail;
5346
- };
5347
- function acpErrorData(detail) {
5348
- return {
5349
- _meta: {
5350
- [ACP_ERROR_META_KEY]: {
5351
- version: ACP_ERROR_META_VERSION,
5352
- code: detail.code,
5353
- ...detail.reason !== void 0 ? { reason: detail.reason } : {},
5354
- ...detail.supported !== void 0 ? { supported: [...detail.supported] } : {}
5355
- }
5356
- }
5357
- };
5358
- }
5359
- function acpErrorMessage(value) {
5360
- const raw = value instanceof Error ? value.message : String(value);
5361
- const collapsed = raw.replace(/\s+/g, " ").trim();
5362
- if (collapsed.length <= ACP_MAX_ERROR_MESSAGE_CHARS) return collapsed;
5363
- return `${collapsed.slice(0, ACP_MAX_ERROR_MESSAGE_CHARS - 1)}\u2026`;
5364
- }
5299
+ import { performance as performance3 } from "node:perf_hooks";
5365
5300
 
5366
5301
  // src/engine/acp/event-mapper.ts
5367
5302
  init_esm_shims();
@@ -6023,599 +5958,6 @@ var AcpToolMediator = class {
6023
5958
  }
6024
5959
  };
6025
5960
 
6026
- // src/engine/acp/transport.ts
6027
- init_esm_shims();
6028
- import { spawn } from "node:child_process";
6029
- import { performance as performance3 } from "node:perf_hooks";
6030
- var ACP_MAX_INPUT_LINE_BYTES = 1024 * 1024;
6031
- function exceedsInputLineBytes(value) {
6032
- if (value.length <= ACP_MAX_INPUT_LINE_BYTES / 3) return false;
6033
- return Buffer.byteLength(value, "utf8") > ACP_MAX_INPUT_LINE_BYTES;
6034
- }
6035
- function isRecord7(value) {
6036
- return typeof value === "object" && value !== null && !Array.isArray(value);
6037
- }
6038
- function isSuccess(value) {
6039
- return "id" in value && "result" in value;
6040
- }
6041
- function isFailure(value) {
6042
- return "id" in value && isRecord7(value.error);
6043
- }
6044
- function errorMessage(value) {
6045
- return value instanceof Error ? value.message : String(value);
6046
- }
6047
- function errorCode(value) {
6048
- return isRecord7(value) && typeof value.code === "string" ? value.code : void 0;
6049
- }
6050
- function boundedMilliseconds(value, fallback) {
6051
- return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : fallback;
6052
- }
6053
- function validateRequestTimeout(method, timeoutMs) {
6054
- if (timeoutMs === void 0) return void 0;
6055
- if (!Number.isFinite(timeoutMs) || timeoutMs <= 0 || timeoutMs > MAX_TIMER_DELAY_MS) {
6056
- throw new AcpTimeoutError(`ACP request timeout must be between 1 and ${MAX_TIMER_DELAY_MS} ms: ${method}`);
6057
- }
6058
- return timeoutMs;
6059
- }
6060
- function jsonRpcError(id, code, message, data) {
6061
- return {
6062
- jsonrpc: "2.0",
6063
- id,
6064
- error: data === void 0 ? { code, message } : { code, message, data }
6065
- };
6066
- }
6067
- function handlerErrorFrame(id, err, diagnostics) {
6068
- if (err instanceof AcpRequestError) {
6069
- const message = err.detail.code === "internal_error" ? ACP_INTERNAL_ERROR_MESSAGE : acpErrorMessage(err.message);
6070
- return jsonRpcError(id, err.rpcCode, message, acpErrorData(err.detail));
6071
- }
6072
- diagnostics?.(`internal error: ${acpErrorMessage(err)}`);
6073
- return jsonRpcError(id, -32e3, ACP_INTERNAL_ERROR_MESSAGE, acpErrorData({ code: "internal_error" }));
6074
- }
6075
- var StdioJsonRpcTransport = class {
6076
- child;
6077
- terminationScope = process.platform === "win32" ? "child" : "process-group";
6078
- nextId = 1;
6079
- buffer = "";
6080
- isClosed = false;
6081
- inputEnded = false;
6082
- childHandlesClosed = false;
6083
- forceTermination = null;
6084
- terminationGraceMs;
6085
- terminationWaitMs;
6086
- childClosePromise;
6087
- resolveChildClose = null;
6088
- pending = /* @__PURE__ */ new Map();
6089
- notificationHandlers = /* @__PURE__ */ new Map();
6090
- requestHandlers = /* @__PURE__ */ new Map();
6091
- stderrHandlers = /* @__PURE__ */ new Set();
6092
- constructor(command, args, options = {}) {
6093
- this.terminationGraceMs = boundedMilliseconds(options.terminationGraceMs, 500);
6094
- this.terminationWaitMs = boundedMilliseconds(options.terminationWaitMs, 2e3);
6095
- this.childClosePromise = new Promise((resolve11) => {
6096
- this.resolveChildClose = resolve11;
6097
- });
6098
- const childEnvironment = buildSafeToolEnv(options.env);
6099
- const attribution = withManagedGitCommitAttributionEnvironment(childEnvironment, {
6100
- cwd: options.cwd ?? process.cwd(),
6101
- enabled: gitCommitAttributionEnabled(process.env),
6102
- evidence: { materiallyAssisted: true }
6103
- });
6104
- reportCommitAttributionDiagnostic(attribution.diagnostic);
6105
- this.child = spawn(command, args, {
6106
- cwd: options.cwd,
6107
- env: attribution.env,
6108
- stdio: ["pipe", "pipe", "pipe"],
6109
- // POSIX detached children lead a new session/process group whose id is
6110
- // the child pid. That makes negative-pid signaling safe for this owned
6111
- // group. Windows detached semantics do not provide an equivalent
6112
- // killable tree, so the explicit fallback there is the direct child.
6113
- detached: process.platform !== "win32"
6114
- });
6115
- this.child.stdout.setEncoding("utf8");
6116
- this.child.stderr.setEncoding("utf8");
6117
- this.child.stdout.on("data", (chunk) => this.consumeStdout(chunk));
6118
- this.child.stderr.on("data", (chunk) => {
6119
- for (const handler of this.stderrHandlers) handler(chunk);
6120
- });
6121
- this.child.on("error", (err) => {
6122
- this.closeChannel(new AcpProcessError(`ACP process error: ${errorMessage(err)}`));
6123
- });
6124
- this.child.on("exit", (code, signal) => {
6125
- this.isClosed = true;
6126
- if (this.pending.size === 0) return;
6127
- const reason = new AcpProcessError(
6128
- `ACP process exited before replying (code=${code ?? "null"}, signal=${signal ?? "null"})`
6129
- );
6130
- this.failAll(reason);
6131
- });
6132
- this.child.on("close", () => {
6133
- this.childHandlesClosed = true;
6134
- this.isClosed = true;
6135
- this.resolveChildClose?.();
6136
- this.resolveChildClose = null;
6137
- });
6138
- this.child.stdin.on("error", (err) => {
6139
- if (!this.isClosed) this.closeChannel(new AcpProcessError(`ACP stdin error: ${errorMessage(err)}`));
6140
- });
6141
- }
6142
- get closed() {
6143
- return this.isClosed || this.child.exitCode !== null || this.child.signalCode !== null;
6144
- }
6145
- get pid() {
6146
- return this.child.pid ?? null;
6147
- }
6148
- request(method, params, timeoutMs) {
6149
- if (this.closed) throw new AcpProcessError(`ACP process is closed; cannot request ${method}`);
6150
- const requestTimeoutMs = validateRequestTimeout(method, timeoutMs);
6151
- const id = this.nextId++;
6152
- const message = { jsonrpc: "2.0", id, method, params };
6153
- const promise = new Promise((resolve11, reject) => {
6154
- const pending = {
6155
- method,
6156
- resolve: (value) => resolve11(value),
6157
- reject
6158
- };
6159
- if (requestTimeoutMs !== void 0) {
6160
- pending.timer = setTimeout(() => {
6161
- this.pending.delete(id);
6162
- reject(new AcpTimeoutError(`ACP request timed out after ${requestTimeoutMs}ms: ${method}`));
6163
- }, requestTimeoutMs);
6164
- }
6165
- this.pending.set(id, pending);
6166
- });
6167
- this.write(message);
6168
- return promise;
6169
- }
6170
- notify(method, params) {
6171
- if (this.closed) return;
6172
- this.write({ jsonrpc: "2.0", method, params });
6173
- }
6174
- onNotification(method, handler) {
6175
- const handlers = this.notificationHandlers.get(method) ?? /* @__PURE__ */ new Set();
6176
- handlers.add(handler);
6177
- this.notificationHandlers.set(method, handlers);
6178
- return () => {
6179
- handlers.delete(handler);
6180
- };
6181
- }
6182
- onRequest(method, handler) {
6183
- this.requestHandlers.set(method, handler);
6184
- return () => {
6185
- if (this.requestHandlers.get(method) === handler) this.requestHandlers.delete(method);
6186
- };
6187
- }
6188
- onStderr(handler) {
6189
- this.stderrHandlers.add(handler);
6190
- return () => {
6191
- this.stderrHandlers.delete(handler);
6192
- };
6193
- }
6194
- close() {
6195
- this.closeChannel(new AcpProcessError("ACP transport closed"));
6196
- }
6197
- terminate() {
6198
- this.closeChannel(new AcpProcessError("ACP transport terminated"));
6199
- this.signalOwnedScope("SIGTERM");
6200
- }
6201
- forceTerminate() {
6202
- if (this.forceTermination !== null) return this.forceTermination;
6203
- this.forceTermination = this.runForceTermination();
6204
- return this.forceTermination;
6205
- }
6206
- waitForExit(timeoutMs) {
6207
- return this.waitForTermination(boundedMilliseconds(timeoutMs, 0));
6208
- }
6209
- write(message) {
6210
- if (this.closed || !this.child.stdin.writable || this.child.stdin.destroyed) return;
6211
- try {
6212
- this.child.stdin.write(`${JSON.stringify(message)}
6213
- `);
6214
- } catch (err) {
6215
- this.closeChannel(new AcpProcessError(`ACP stdin write failed: ${errorMessage(err)}`));
6216
- }
6217
- }
6218
- consumeStdout(chunk) {
6219
- this.buffer += chunk;
6220
- for (; ; ) {
6221
- const idx = this.buffer.indexOf("\n");
6222
- if (idx === -1) break;
6223
- const line = this.buffer.slice(0, idx).trimEnd();
6224
- this.buffer = this.buffer.slice(idx + 1);
6225
- if (line.length === 0) continue;
6226
- this.handleLine(line);
6227
- }
6228
- }
6229
- handleLine(line) {
6230
- const trimmed = line.trimStart();
6231
- if (!trimmed.startsWith("{")) {
6232
- return;
6233
- }
6234
- let parsed;
6235
- try {
6236
- parsed = JSON.parse(trimmed);
6237
- } catch (err) {
6238
- this.failAll(new AcpProtocolError(`ACP stdout contained invalid JSON: ${errorMessage(err)}`, { line }));
6239
- return;
6240
- }
6241
- if (!isRecord7(parsed) || parsed.jsonrpc !== "2.0") {
6242
- return;
6243
- }
6244
- if (isSuccess(parsed) || isFailure(parsed)) {
6245
- this.handleResponse(parsed);
6246
- return;
6247
- }
6248
- const method = typeof parsed.method === "string" ? parsed.method : "";
6249
- if (!method) {
6250
- this.failAll(new AcpProtocolError("ACP request/notification missing method", parsed));
6251
- return;
6252
- }
6253
- if ("id" in parsed) {
6254
- void this.handleIncomingRequest(parsed.id, method, parsed.params);
6255
- return;
6256
- }
6257
- const handlers = this.notificationHandlers.get(method);
6258
- if (!handlers) return;
6259
- for (const handler of handlers) handler(parsed.params);
6260
- }
6261
- handleResponse(message) {
6262
- const pending = this.pending.get(message.id ?? "");
6263
- if (!pending) return;
6264
- this.pending.delete(message.id ?? "");
6265
- if (pending.timer) clearTimeout(pending.timer);
6266
- if ("error" in message) {
6267
- pending.reject(new AcpProtocolError(`ACP ${pending.method} failed: ${message.error.message}`, message.error));
6268
- return;
6269
- }
6270
- pending.resolve(message.result);
6271
- }
6272
- async handleIncomingRequest(id, method, params) {
6273
- const handler = this.requestHandlers.get(method);
6274
- if (!handler) {
6275
- this.write({
6276
- jsonrpc: "2.0",
6277
- id,
6278
- error: { code: -32601, message: `method not found: ${method}` }
6279
- });
6280
- return;
6281
- }
6282
- try {
6283
- const result = await handler(params);
6284
- this.write({ jsonrpc: "2.0", id, result });
6285
- } catch (err) {
6286
- this.write(handlerErrorFrame(id, err));
6287
- }
6288
- }
6289
- closeChannel(reason) {
6290
- if (!this.isClosed) {
6291
- this.isClosed = true;
6292
- this.failAll(reason);
6293
- }
6294
- if (this.inputEnded) return;
6295
- this.inputEnded = true;
6296
- try {
6297
- this.child.stdin.end();
6298
- } catch {
6299
- }
6300
- }
6301
- directChildAlive() {
6302
- return !this.childHandlesClosed && this.child.exitCode === null && this.child.signalCode === null;
6303
- }
6304
- processGroupAlive() {
6305
- if (this.terminationScope !== "process-group") return this.directChildAlive();
6306
- const pid = this.pid;
6307
- if (pid === null) return this.directChildAlive();
6308
- try {
6309
- process.kill(-pid, 0);
6310
- return true;
6311
- } catch (err) {
6312
- const code = errorCode(err);
6313
- if (code === "ESRCH") return false;
6314
- return true;
6315
- }
6316
- }
6317
- terminationObserved() {
6318
- return this.childHandlesClosed && !this.processGroupAlive();
6319
- }
6320
- signalOwnedScope(signal) {
6321
- const pid = this.pid;
6322
- if (this.terminationScope === "process-group" && pid !== null) {
6323
- try {
6324
- process.kill(-pid, signal);
6325
- return true;
6326
- } catch {
6327
- }
6328
- }
6329
- if (!this.directChildAlive()) return false;
6330
- try {
6331
- return this.child.kill(signal);
6332
- } catch {
6333
- return false;
6334
- }
6335
- }
6336
- async waitForTermination(timeoutMs) {
6337
- const deadline = performance3.now() + timeoutMs;
6338
- while (!this.terminationObserved()) {
6339
- const remaining = deadline - performance3.now();
6340
- if (remaining <= 0) return this.terminationObserved();
6341
- const interval = Math.min(10, remaining);
6342
- if (this.childHandlesClosed) {
6343
- await new Promise((resolve11) => setTimeout(resolve11, interval));
6344
- } else {
6345
- await Promise.race([this.childClosePromise, new Promise((resolve11) => setTimeout(resolve11, interval))]);
6346
- }
6347
- }
6348
- return true;
6349
- }
6350
- async runForceTermination() {
6351
- this.closeChannel(new AcpProcessError("ACP transport force-terminated"));
6352
- if (this.terminationObserved()) {
6353
- return { exited: true, escalated: false, scope: this.terminationScope };
6354
- }
6355
- this.signalOwnedScope("SIGTERM");
6356
- if (await this.waitForExit(this.terminationGraceMs)) {
6357
- return { exited: true, escalated: false, scope: this.terminationScope };
6358
- }
6359
- const escalated = this.signalOwnedScope("SIGKILL");
6360
- const exited = await this.waitForExit(this.terminationWaitMs);
6361
- return { exited, escalated, scope: this.terminationScope };
6362
- }
6363
- failAll(reason) {
6364
- for (const [id, pending] of this.pending.entries()) {
6365
- if (pending.timer) clearTimeout(pending.timer);
6366
- pending.reject(reason);
6367
- this.pending.delete(id);
6368
- }
6369
- }
6370
- };
6371
- function createStdioTransport(command, args = [], options = {}) {
6372
- if (command.trim().length === 0) {
6373
- throw new AcpProcessError("ACP stdio command must not be empty");
6374
- }
6375
- return new StdioJsonRpcTransport(command, args, options);
6376
- }
6377
- var StreamJsonRpcPeerTransport = class {
6378
- outputPaused = false;
6379
- queuedOutputBytes = 0;
6380
- sinkOutputBytes = 0;
6381
- outputQueue = [];
6382
- nextId = 1;
6383
- buffer = "";
6384
- /** True while the bytes of an oversized line are being dropped up to its terminating newline. */
6385
- discardingLine = false;
6386
- isClosed = false;
6387
- pending = /* @__PURE__ */ new Map();
6388
- notificationHandlers = /* @__PURE__ */ new Map();
6389
- requestHandlers = /* @__PURE__ */ new Map();
6390
- closeHandlers = /* @__PURE__ */ new Set();
6391
- input;
6392
- output;
6393
- writeOverride;
6394
- diagnostics;
6395
- constructor(options = {}) {
6396
- this.input = options.input ?? process.stdin;
6397
- this.output = options.output ?? process.stdout;
6398
- if (options.write !== void 0) this.writeOverride = options.write;
6399
- if (options.diagnostics !== void 0) this.diagnostics = options.diagnostics;
6400
- this.input.setEncoding("utf8");
6401
- this.input.on("data", (chunk) => this.consume(chunk));
6402
- this.input.on("end", () => this.markClosed(new AcpProcessError("ACP input closed")));
6403
- this.input.on("error", (err) => this.markClosed(new AcpProcessError(`ACP input error: ${errorMessage(err)}`)));
6404
- this.output.on?.("error", (err) => this.markClosed(new AcpProcessError(`ACP output error: ${errorMessage(err)}`)));
6405
- }
6406
- get closed() {
6407
- return this.isClosed;
6408
- }
6409
- request(method, params, timeoutMs) {
6410
- if (this.closed) throw new AcpProcessError(`ACP transport is closed; cannot request ${method}`);
6411
- const requestTimeoutMs = validateRequestTimeout(method, timeoutMs);
6412
- const id = this.nextId++;
6413
- const message = { jsonrpc: "2.0", id, method, params };
6414
- const promise = new Promise((resolve11, reject) => {
6415
- const pending = {
6416
- method,
6417
- resolve: (value) => resolve11(value),
6418
- reject
6419
- };
6420
- if (requestTimeoutMs !== void 0) {
6421
- pending.timer = setTimeout(() => {
6422
- this.pending.delete(id);
6423
- reject(new AcpTimeoutError(`ACP request timed out after ${requestTimeoutMs}ms: ${method}`));
6424
- }, requestTimeoutMs);
6425
- }
6426
- this.pending.set(id, pending);
6427
- });
6428
- this.write(message);
6429
- return promise;
6430
- }
6431
- notify(method, params) {
6432
- if (this.closed) return;
6433
- this.write({ jsonrpc: "2.0", method, params });
6434
- }
6435
- onNotification(method, handler) {
6436
- const handlers = this.notificationHandlers.get(method) ?? /* @__PURE__ */ new Set();
6437
- handlers.add(handler);
6438
- this.notificationHandlers.set(method, handlers);
6439
- return () => {
6440
- handlers.delete(handler);
6441
- };
6442
- }
6443
- onRequest(method, handler) {
6444
- this.requestHandlers.set(method, handler);
6445
- return () => {
6446
- if (this.requestHandlers.get(method) === handler) this.requestHandlers.delete(method);
6447
- };
6448
- }
6449
- onClose(handler) {
6450
- this.closeHandlers.add(handler);
6451
- return () => {
6452
- this.closeHandlers.delete(handler);
6453
- };
6454
- }
6455
- close() {
6456
- this.markClosed(new AcpProcessError("ACP transport closed"));
6457
- }
6458
- write(message) {
6459
- if (this.closed) return;
6460
- const line = `${JSON.stringify(message)}
6461
- `;
6462
- if (this.outputPaused) {
6463
- const bytes = Buffer.byteLength(line, "utf8");
6464
- if (this.queuedOutputBytes + this.sinkOutputBytes + bytes > ACP_MAX_INPUT_LINE_BYTES) {
6465
- this.markClosed(new AcpProcessError("ACP output buffer exceeded byte limit"));
6466
- return;
6467
- }
6468
- }
6469
- this.outputQueue.push(line);
6470
- this.queuedOutputBytes += Buffer.byteLength(line, "utf8");
6471
- if (!this.outputPaused) this.flushOutput();
6472
- }
6473
- flushOutput = () => {
6474
- this.outputPaused = false;
6475
- while (!this.closed && !this.outputPaused && this.outputQueue.length > 0) {
6476
- const line = this.outputQueue.shift();
6477
- if (line === void 0) break;
6478
- this.queuedOutputBytes -= Buffer.byteLength(line, "utf8");
6479
- try {
6480
- this.sinkOutputBytes = Math.min(this.sinkOutputBytes, this.output.writableLength * 3);
6481
- let ready;
6482
- if (this.writeOverride) {
6483
- this.writeOverride(line);
6484
- ready = !this.output.writableNeedDrain;
6485
- } else {
6486
- ready = this.output.write(line);
6487
- }
6488
- this.sinkOutputBytes = this.output.writableLength === 0 ? 0 : this.sinkOutputBytes + Buffer.byteLength(line, "utf8");
6489
- if (!ready && !this.closed) {
6490
- if (this.queuedOutputBytes + this.sinkOutputBytes > ACP_MAX_INPUT_LINE_BYTES) {
6491
- this.markClosed(new AcpProcessError("ACP output buffer exceeded byte limit"));
6492
- return;
6493
- }
6494
- this.outputPaused = true;
6495
- this.output.once("drain", this.flushOutput);
6496
- }
6497
- } catch (err) {
6498
- this.markClosed(new AcpProcessError(`ACP output write failed: ${errorMessage(err)}`));
6499
- }
6500
- }
6501
- };
6502
- consume(chunk) {
6503
- this.buffer += chunk;
6504
- for (; ; ) {
6505
- const idx = this.buffer.indexOf("\n");
6506
- if (idx === -1) break;
6507
- const line = this.buffer.slice(0, idx).trimEnd();
6508
- this.buffer = this.buffer.slice(idx + 1);
6509
- if (this.discardingLine) {
6510
- this.discardingLine = false;
6511
- continue;
6512
- }
6513
- if (line.length === 0) continue;
6514
- if (exceedsInputLineBytes(line)) {
6515
- this.reportOversizedLine();
6516
- continue;
6517
- }
6518
- this.handleLine(line);
6519
- }
6520
- if (this.discardingLine) {
6521
- this.buffer = "";
6522
- return;
6523
- }
6524
- if (exceedsInputLineBytes(this.buffer)) {
6525
- this.buffer = "";
6526
- this.discardingLine = true;
6527
- this.reportOversizedLine();
6528
- }
6529
- }
6530
- /** One error frame per oversized line. The transport stays open and parseable. */
6531
- reportOversizedLine() {
6532
- this.write(
6533
- jsonRpcError(null, -32600, "input line exceeds the maximum size", acpErrorData({ code: "input_line_too_large" }))
6534
- );
6535
- }
6536
- handleLine(line) {
6537
- let parsed;
6538
- try {
6539
- parsed = JSON.parse(line);
6540
- } catch {
6541
- this.write(jsonRpcError(null, -32700, "parse error", acpErrorData({ code: "parse_error" })));
6542
- return;
6543
- }
6544
- if (!isRecord7(parsed) || parsed.jsonrpc !== "2.0") {
6545
- this.write(jsonRpcError(null, -32600, "invalid JSON-RPC message", acpErrorData({ code: "invalid_request" })));
6546
- return;
6547
- }
6548
- if (isSuccess(parsed) || isFailure(parsed)) {
6549
- this.handleResponse(parsed);
6550
- return;
6551
- }
6552
- const method = typeof parsed.method === "string" ? parsed.method : "";
6553
- const id = "id" in parsed ? parsed.id : void 0;
6554
- if (!method) {
6555
- if (id !== void 0) {
6556
- this.write(
6557
- jsonRpcError(id, -32600, "request/notification missing method", acpErrorData({ code: "invalid_request" }))
6558
- );
6559
- }
6560
- return;
6561
- }
6562
- if (id !== void 0) {
6563
- void this.handleRequest(id, method, parsed.params);
6564
- return;
6565
- }
6566
- const handlers = this.notificationHandlers.get(method);
6567
- if (!handlers) return;
6568
- for (const handler of handlers) handler(parsed.params);
6569
- }
6570
- handleResponse(message) {
6571
- const pending = this.pending.get(message.id ?? "");
6572
- if (!pending) return;
6573
- this.pending.delete(message.id ?? "");
6574
- if (pending.timer) clearTimeout(pending.timer);
6575
- if ("error" in message) {
6576
- pending.reject(new AcpProtocolError(`ACP ${pending.method} failed: ${message.error.message}`, message.error));
6577
- return;
6578
- }
6579
- pending.resolve(message.result);
6580
- }
6581
- async handleRequest(id, method, params) {
6582
- if (id === null) {
6583
- this.write(jsonRpcError(null, -32600, "request id must not be null", acpErrorData({ code: "invalid_request_id" })));
6584
- return;
6585
- }
6586
- const handler = this.requestHandlers.get(method);
6587
- if (!handler) {
6588
- this.write(jsonRpcError(id, -32601, ACP_METHOD_NOT_FOUND_MESSAGE, acpErrorData({ code: "method_not_found" })));
6589
- return;
6590
- }
6591
- try {
6592
- const result = await handler(params);
6593
- this.write({ jsonrpc: "2.0", id, result });
6594
- } catch (err) {
6595
- this.write(handlerErrorFrame(id, err, this.diagnostics));
6596
- }
6597
- }
6598
- markClosed(reason) {
6599
- if (this.isClosed) return;
6600
- this.isClosed = true;
6601
- this.output.removeListener("drain", this.flushOutput);
6602
- this.outputQueue.length = 0;
6603
- this.queuedOutputBytes = 0;
6604
- this.failAll(reason);
6605
- for (const handler of this.closeHandlers) handler();
6606
- }
6607
- failAll(reason) {
6608
- for (const [id, pending] of this.pending.entries()) {
6609
- if (pending.timer) clearTimeout(pending.timer);
6610
- pending.reject(reason);
6611
- this.pending.delete(id);
6612
- }
6613
- }
6614
- };
6615
- function createStdioServerTransport(options = {}) {
6616
- return new StreamJsonRpcPeerTransport(options);
6617
- }
6618
-
6619
5961
  // src/engine/acp/types.ts
6620
5962
  init_esm_shims();
6621
5963
  var ACP_USAGE_META_KEY = "clio-coder/usage";
@@ -6659,22 +6001,22 @@ var AsyncEventQueue = class {
6659
6001
  }
6660
6002
  }
6661
6003
  };
6662
- function isRecord8(value) {
6004
+ function isRecord7(value) {
6663
6005
  return typeof value === "object" && value !== null && !Array.isArray(value);
6664
6006
  }
6665
6007
  function sessionIdFrom(value) {
6666
6008
  if (typeof value === "string" && value.length > 0) return value;
6667
- if (!isRecord8(value)) return null;
6009
+ if (!isRecord7(value)) return null;
6668
6010
  const sessionId = value.sessionId ?? value.id;
6669
6011
  return typeof sessionId === "string" && sessionId.length > 0 ? sessionId : null;
6670
6012
  }
6671
6013
  function supportsSessionClose(init) {
6672
6014
  const caps = init?.agentCapabilities;
6673
- if (!isRecord8(caps)) return false;
6674
- const meta = isRecord8(caps._meta) ? caps._meta[ACP_SESSION_META_KEY] : void 0;
6675
- if (isRecord8(meta) && meta.close === true) return true;
6015
+ if (!isRecord7(caps)) return false;
6016
+ const meta = isRecord7(caps._meta) ? caps._meta[ACP_SESSION_META_KEY] : void 0;
6017
+ if (isRecord7(meta) && meta.close === true) return true;
6676
6018
  const sessionCaps = caps.sessionCapabilities;
6677
- return isRecord8(sessionCaps) && isRecord8(sessionCaps.close);
6019
+ return isRecord7(sessionCaps) && isRecord7(sessionCaps.close);
6678
6020
  }
6679
6021
  function flattenPrompt(input) {
6680
6022
  const parts = [
@@ -6704,7 +6046,7 @@ function nonnegative(value) {
6704
6046
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
6705
6047
  }
6706
6048
  function mergeUsage(into, raw) {
6707
- if (!isRecord8(raw)) return;
6049
+ if (!isRecord7(raw)) return;
6708
6050
  const tokensReported = [
6709
6051
  raw.input,
6710
6052
  raw.inputTokens,
@@ -6736,7 +6078,7 @@ function mergeUsage(into, raw) {
6736
6078
  into.reasoningTokens += finite(raw.reasoning) + finite(raw.reasoningTokens) + finite(raw.reasoning_tokens);
6737
6079
  const explicitTotal = nonnegative(raw.totalTokens) ?? nonnegative(raw.total_tokens);
6738
6080
  into.totalTokens += explicitTotal ?? input + output + cacheRead + cacheWrite;
6739
- const cost = (isRecord8(raw.cost) ? nonnegative(raw.cost.total) : void 0) ?? nonnegative(raw.costUsd);
6081
+ const cost = (isRecord7(raw.cost) ? nonnegative(raw.cost.total) : void 0) ?? nonnegative(raw.costUsd);
6740
6082
  into.costUsd += cost ?? 0;
6741
6083
  if (tokensReported || cost !== void 0) {
6742
6084
  const provenance = cost === void 0 ? "unknown" : resolveCostProvenance(raw.costProvenance, "unknown");
@@ -6747,7 +6089,7 @@ function mergeUsage(into, raw) {
6747
6089
  else into.costProvenance = "known";
6748
6090
  }
6749
6091
  }
6750
- function errorMessage2(value) {
6092
+ function errorMessage(value) {
6751
6093
  return value instanceof Error ? value.message : String(value);
6752
6094
  }
6753
6095
  function cancelGraceMs(value) {
@@ -6767,7 +6109,7 @@ function startAcpDelegationRun(input) {
6767
6109
  const connectTimeoutMs = input.agent.connectTimeoutMs ?? DEFAULT_DELEGATION_CONNECT_TIMEOUT_MS;
6768
6110
  const turnTimeoutMs = input.agent.turnTimeoutMs ?? DEFAULT_DELEGATION_TURN_TIMEOUT_MS;
6769
6111
  const now = input.now ?? Date.now;
6770
- const monotonicNow = input.monotonicNow ?? (() => performance4.now());
6112
+ const monotonicNow = input.monotonicNow ?? (() => performance3.now());
6771
6113
  const heartbeatWallAnchor = now();
6772
6114
  const heartbeatMonotonicAnchor = monotonicNow();
6773
6115
  const heartbeatAt = {
@@ -6886,7 +6228,7 @@ function startAcpDelegationRun(input) {
6886
6228
  },
6887
6229
  turnTimeoutMs === 0 ? void 0 : turnTimeoutMs
6888
6230
  );
6889
- const metaUsage = isRecord8(promptResponse?._meta) ? promptResponse._meta[ACP_USAGE_META_KEY] : void 0;
6231
+ const metaUsage = isRecord7(promptResponse?._meta) ? promptResponse._meta[ACP_USAGE_META_KEY] : void 0;
6890
6232
  if (metaUsage !== void 0) {
6891
6233
  mergeUsage(usage, metaUsage);
6892
6234
  } else {
@@ -6912,7 +6254,7 @@ function startAcpDelegationRun(input) {
6912
6254
  };
6913
6255
  } catch (err) {
6914
6256
  const termination = await beginForceTermination();
6915
- const baseMessage = `ACP delegation failed: ${errorMessage2(err)}`;
6257
+ const baseMessage = `ACP delegation failed: ${errorMessage(err)}`;
6916
6258
  const message = termination.exited ? baseMessage : `${baseMessage}; ACP ${termination.scope} exit was not observed within the force-termination bound`;
6917
6259
  for (const event of errorEvents(message)) emit(event);
6918
6260
  const toolSnapshot = mediator.snapshot();
@@ -9699,7 +9041,7 @@ import { dirname as dirname7, join as join19, resolve as resolve9 } from "node:p
9699
9041
 
9700
9042
  // src/domains/dispatch/code-step.ts
9701
9043
  init_esm_shims();
9702
- import { execFileSync as execFileSync2, spawn as spawn2 } from "node:child_process";
9044
+ import { execFileSync as execFileSync2, spawn } from "node:child_process";
9703
9045
  import { createHash as createHash8 } from "node:crypto";
9704
9046
  import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync3 } from "node:fs";
9705
9047
  import { isAbsolute as isAbsolute5, join as join18, resolve as resolve8 } from "node:path";
@@ -9793,7 +9135,7 @@ async function spawnCommand(input, cwd, argv) {
9793
9135
  let settled = false;
9794
9136
  let timedOut = false;
9795
9137
  let spawnError = null;
9796
- const child = spawn2(executable, args, {
9138
+ const child = spawn(executable, args, {
9797
9139
  cwd,
9798
9140
  env: attribution.env,
9799
9141
  stdio: ["ignore", "pipe", "pipe"],
@@ -10710,6 +10052,7 @@ function envelopeFromReceipt(receipt, status, receiptPath) {
10710
10052
  };
10711
10053
  if (receipt.cacheReadTokenCount !== void 0) envelope.cacheReadTokenCount = receipt.cacheReadTokenCount;
10712
10054
  if (receipt.cacheWriteTokenCount !== void 0) envelope.cacheWriteTokenCount = receipt.cacheWriteTokenCount;
10055
+ if (receipt.cacheWrite1hTokenCount !== void 0) envelope.cacheWrite1hTokenCount = receipt.cacheWrite1hTokenCount;
10713
10056
  if (receipt.reasoningTokenCount !== void 0) envelope.reasoningTokenCount = receipt.reasoningTokenCount;
10714
10057
  if (receipt.inputTokenCount !== void 0) envelope.inputTokenCount = receipt.inputTokenCount;
10715
10058
  if (receipt.outputTokenCount !== void 0) envelope.outputTokenCount = receipt.outputTokenCount;
@@ -11247,7 +10590,7 @@ function compareRecords(left, right) {
11247
10590
  return left.settledAt.localeCompare(right.settledAt) || left.receiptDigest.localeCompare(right.receiptDigest);
11248
10591
  }
11249
10592
  function validateRecord(value) {
11250
- if (!isRecord9(value) || value.version !== ROUTE_HISTORY_VERSION)
10593
+ if (!isRecord8(value) || value.version !== ROUTE_HISTORY_VERSION)
11251
10594
  throw new Error("route history record has unsupported version");
11252
10595
  if (!isDigest(value.receiptDigest)) throw new Error("route history receipt digest invalid");
11253
10596
  if (typeof value.assignmentId !== "string" || value.assignmentId.length === 0)
@@ -11300,7 +10643,7 @@ function readHistory(path2) {
11300
10643
  } catch (error) {
11301
10644
  throw new Error(`route history unreadable: ${error instanceof Error ? error.message : String(error)}`);
11302
10645
  }
11303
- if (!isRecord9(parsed) || !Array.isArray(parsed.records)) throw new Error("route history has unsupported format");
10646
+ if (!isRecord8(parsed) || !Array.isArray(parsed.records)) throw new Error("route history has unsupported format");
11304
10647
  if (parsed.version !== ROUTE_HISTORY_VERSION) {
11305
10648
  retireHistory(path2, parsed.version);
11306
10649
  return [];
@@ -11360,14 +10703,14 @@ function createRouteHistoryStore(options = {}) {
11360
10703
  }
11361
10704
  };
11362
10705
  }
11363
- function isRecord9(value) {
10706
+ function isRecord8(value) {
11364
10707
  return typeof value === "object" && value !== null && !Array.isArray(value);
11365
10708
  }
11366
10709
  function isDigest(value) {
11367
10710
  return typeof value === "string" && /^[0-9a-f]{64}$/u.test(value);
11368
10711
  }
11369
10712
  function isRouteCandidate(value) {
11370
- if (!isRecord9(value)) return false;
10713
+ if (!isRecord8(value)) return false;
11371
10714
  if (!isExecutionRole(value.executionRole)) return false;
11372
10715
  return [
11373
10716
  value.agentId,
@@ -11383,7 +10726,7 @@ function isRouteCandidate(value) {
11383
10726
  ].every((field) => typeof field === "string");
11384
10727
  }
11385
10728
  function isPhaseTiming(value) {
11386
- if (!isRecord9(value)) return false;
10729
+ if (!isRecord8(value)) return false;
11387
10730
  return [
11388
10731
  "requestToDecisionMs",
11389
10732
  "decisionMs",
@@ -11860,15 +11203,15 @@ function receiptGatewayRoutingLabel(receipt) {
11860
11203
  var RUN_TAIL_ENTRY_LIMIT = 100;
11861
11204
  var RUN_TAIL_RUN_LIMIT = 64;
11862
11205
  var RUN_TAIL_TEXT_LIMIT = 600;
11863
- function isRecord10(value) {
11206
+ function isRecord9(value) {
11864
11207
  return typeof value === "object" && value !== null && !Array.isArray(value);
11865
11208
  }
11866
11209
  function eventDetail(event) {
11867
- const normalized = isRecord10(event) ? normalizeClioCoderEventRecord(event) : event;
11210
+ const normalized = isRecord9(event) ? normalizeClioCoderEventRecord(event) : event;
11868
11211
  const text = assistantTextFromEvent(normalized);
11869
11212
  if (text.length > 0) return truncateUtf8(text, RUN_TAIL_TEXT_LIMIT, "...");
11870
- if (!isRecord10(normalized)) return void 0;
11871
- if (normalized.type === "clio_coder_tool_finish" && isRecord10(normalized.payload)) {
11213
+ if (!isRecord9(normalized)) return void 0;
11214
+ if (normalized.type === "clio_coder_tool_finish" && isRecord9(normalized.payload)) {
11872
11215
  const tool = typeof normalized.payload.tool === "string" ? normalized.payload.tool : "tool";
11873
11216
  const outcome = typeof normalized.payload.outcome === "string" ? normalized.payload.outcome : "";
11874
11217
  return `${tool} ${outcome}`.trim();
@@ -11882,7 +11225,7 @@ function eventDetail(event) {
11882
11225
  return void 0;
11883
11226
  }
11884
11227
  function runTailEntryFromEvent(event, at = (/* @__PURE__ */ new Date()).toISOString()) {
11885
- const type = isRecord10(event) && typeof event.type === "string" ? normalizeClioCoderEventType(event.type) : "unknown";
11228
+ const type = isRecord9(event) && typeof event.type === "string" ? normalizeClioCoderEventType(event.type) : "unknown";
11886
11229
  if (type === "heartbeat" || type === "message_update") return null;
11887
11230
  const entry = { at, type };
11888
11231
  const detail = eventDetail(event);
@@ -11900,7 +11243,7 @@ function createDispatchRunEventRegistry(options = {}) {
11900
11243
  const activeBatches = /* @__PURE__ */ new Set();
11901
11244
  const journal = options.journal === void 0 ? defaultRunEventJournal() : options.journal;
11902
11245
  const journalSeal = (logicalRunId, receipt) => {
11903
- if (journal === null || !isRecord10(receipt)) return;
11246
+ if (journal === null || !isRecord9(receipt)) return;
11904
11247
  const digest = receipt.integrity?.digest;
11905
11248
  const outcome = typeof receipt.outcome === "string" ? receipt.outcome : REGISTRY_UNKNOWN_OUTCOME;
11906
11249
  journal.receipt(logicalRunId, {
@@ -11959,7 +11302,7 @@ function createDispatchRunEventRegistry(options = {}) {
11959
11302
  };
11960
11303
  for await (const event of events) {
11961
11304
  summary.count += 1;
11962
- const type = isRecord10(event) && typeof event.type === "string" ? event.type : "unknown";
11305
+ const type = isRecord9(event) && typeof event.type === "string" ? event.type : "unknown";
11963
11306
  summary.types.push(type);
11964
11307
  if (type === "attempt_start") summary.lastAssistantText = "";
11965
11308
  const text = durableAssistantTextFromEvent(event);
@@ -11972,7 +11315,7 @@ function createDispatchRunEventRegistry(options = {}) {
11972
11315
  const drainBatch = async (batchId, events, bus) => {
11973
11316
  const summaries = /* @__PURE__ */ new Map();
11974
11317
  for await (const event of events) {
11975
- if (!isRecord10(event) || event.type !== "batch_run_event") continue;
11318
+ if (!isRecord9(event) || event.type !== "batch_run_event") continue;
11976
11319
  const runId = typeof event.runId === "string" ? event.runId : batchId;
11977
11320
  const agentId = typeof event.agentId === "string" ? event.agentId : "batch";
11978
11321
  const inner = event.event;
@@ -11983,7 +11326,7 @@ function createDispatchRunEventRegistry(options = {}) {
11983
11326
  terminalAttemptRunId: runId
11984
11327
  };
11985
11328
  summary.count += 1;
11986
- const type = isRecord10(inner) && typeof inner.type === "string" ? inner.type : "unknown";
11329
+ const type = isRecord9(inner) && typeof inner.type === "string" ? inner.type : "unknown";
11987
11330
  summary.types.push(type);
11988
11331
  const text = durableAssistantTextFromEvent(inner);
11989
11332
  if (text.trim().length > 0) summary.lastAssistantText = text;
@@ -12089,11 +11432,11 @@ function createDispatchRunEventRegistry(options = {}) {
12089
11432
 
12090
11433
  // src/domains/dispatch/run-event-journal-bridge.ts
12091
11434
  var OPENED_RUN_LIMIT = 512;
12092
- function isRecord11(value) {
11435
+ function isRecord10(value) {
12093
11436
  return typeof value === "object" && value !== null && !Array.isArray(value);
12094
11437
  }
12095
11438
  function runIdentity(payload) {
12096
- if (!isRecord11(payload)) return null;
11439
+ if (!isRecord10(payload)) return null;
12097
11440
  if (typeof payload.runId !== "string" || payload.runId.length === 0) return null;
12098
11441
  return { runId: payload.runId, agentId: typeof payload.agentId === "string" ? payload.agentId : "unknown" };
12099
11442
  }
@@ -12114,7 +11457,7 @@ function attachRunEventJournalBridge(bus, options = {}) {
12114
11457
  const identity = runIdentity(payload);
12115
11458
  if (identity === null) return;
12116
11459
  ensureOpen(identity.runId, identity.agentId);
12117
- const exitCode = isRecord11(payload) && typeof payload.exitCode === "number" ? payload.exitCode : null;
11460
+ const exitCode = isRecord10(payload) && typeof payload.exitCode === "number" ? payload.exitCode : null;
12118
11461
  journal.receipt(identity.runId, { outcome, exitCode });
12119
11462
  journal.terminal(identity.runId, outcome, detail ?? void 0);
12120
11463
  opened.delete(identity.runId);
@@ -12126,7 +11469,7 @@ function attachRunEventJournalBridge(bus, options = {}) {
12126
11469
  const entry = runTailEntryFromEvent(payload.event);
12127
11470
  if (entry === null) return;
12128
11471
  ensureOpen(identity.runId, identity.agentId);
12129
- const message = isRecord11(payload.event) && typeof payload.event.message === "string" ? payload.event.message : void 0;
11472
+ const message = isRecord10(payload.event) && typeof payload.event.message === "string" ? payload.event.message : void 0;
12130
11473
  journal.append(
12131
11474
  identity.runId,
12132
11475
  entry.detail === void 0 && message !== void 0 ? { ...entry, detail: message } : entry
@@ -12246,7 +11589,7 @@ function listFleetRuns(limit = MAX_FLEET_RUN_SCAN) {
12246
11589
  records.sort((a, b) => (Date.parse(b.startedAt) || 0) - (Date.parse(a.startedAt) || 0));
12247
11590
  return records.slice(0, Math.max(0, limit));
12248
11591
  }
12249
- function isRecord12(value) {
11592
+ function isRecord11(value) {
12250
11593
  return typeof value === "object" && value !== null && !Array.isArray(value);
12251
11594
  }
12252
11595
  function readRuns() {
@@ -12258,7 +11601,7 @@ function readRuns() {
12258
11601
  if (!Array.isArray(parsed)) return [];
12259
11602
  const envelopes = [];
12260
11603
  for (const entry of parsed) {
12261
- if (!isRecord12(entry)) continue;
11604
+ if (!isRecord11(entry)) continue;
12262
11605
  const version = entry.version === void 0 ? 1 : entry.version;
12263
11606
  if (version !== 1) continue;
12264
11607
  envelopes.push({ ...entry, version: 1 });
@@ -12310,7 +11653,6 @@ function capRuns(all, maxRuns) {
12310
11653
  return kept;
12311
11654
  }
12312
11655
  function openLedger(opts) {
12313
- const maxRuns = resolveMaxRuns(opts?.maxRuns);
12314
11656
  let runs = readRuns();
12315
11657
  const dirty = /* @__PURE__ */ new Set();
12316
11658
  function findIndex(id) {
@@ -12416,7 +11758,7 @@ function openLedger(opts) {
12416
11758
  if (stateRootRemoved()) return;
12417
11759
  const diskRuns = readRuns();
12418
11760
  const merged = mergeRunsById(diskRuns, runs, dirty);
12419
- const capped = capRuns(merged, maxRuns);
11761
+ const capped = capRuns(merged, resolveMaxRuns(opts?.maxRuns));
12420
11762
  runs = capped;
12421
11763
  atomicWrite(target, JSON.stringify(capped, null, 2));
12422
11764
  if (merged.length > capped.length) {
@@ -12606,9 +11948,30 @@ function sealRouteDecision(draft, decision) {
12606
11948
  }
12607
11949
  var UNKNOWN_PRICING_ADMISSION_ESTIMATE_USD = 1;
12608
11950
  function calculateUsageCostUsd(meter, pricing) {
11951
+ if (meter.costUsd !== void 0) return meter.costUsd;
12609
11952
  if (pricing === null) return 0;
12610
11953
  return (meter.inputTokens * pricing.input + meter.outputTokens * pricing.output + meter.cacheReadTokens * pricing.cacheRead + meter.cacheWriteTokens * pricing.cacheWrite) / 1e6;
12611
11954
  }
11955
+ function accumulateNativeUsage(meter, usage, pricing) {
11956
+ const count = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : 0;
11957
+ const call = {
11958
+ inputTokens: count(usage.input),
11959
+ outputTokens: count(usage.output),
11960
+ cacheReadTokens: count(usage.cacheRead),
11961
+ cacheWriteTokens: count(usage.cacheWrite),
11962
+ reasoningTokens: extractReasoningTokenCount(usage)
11963
+ };
11964
+ const reported = isRecord12(usage.cost) ? usage.cost.total : void 0;
11965
+ const callCost = typeof reported === "number" && Number.isFinite(reported) && reported >= 0 ? reported : calculateUsageCostUsd(call, pricing);
11966
+ meter.costUsd = (meter.costUsd ?? 0) + callCost;
11967
+ meter.inputTokens += call.inputTokens;
11968
+ meter.outputTokens += call.outputTokens;
11969
+ meter.cacheReadTokens += call.cacheReadTokens;
11970
+ meter.cacheWriteTokens += call.cacheWriteTokens;
11971
+ if (typeof usage.cacheWrite1h === "number" && usage.cacheWrite1h >= 0 && usage.cacheWrite1h <= call.cacheWriteTokens)
11972
+ meter.cacheWrite1hTokens = (meter.cacheWrite1hTokens ?? 0) + usage.cacheWrite1h;
11973
+ meter.reasoningTokens += call.reasoningTokens;
11974
+ }
12612
11975
  function admissionMaxOutputTokens(settings) {
12613
11976
  return settings?.chat.maxOutputTokens ?? DEFAULT_SETTINGS.chat.maxOutputTokens;
12614
11977
  }
@@ -12633,12 +11996,12 @@ function promptCompositionHash(parts) {
12633
11996
  function toolSignature(tools) {
12634
11997
  return sha2566(JSON.stringify([...tools].sort()));
12635
11998
  }
12636
- function isRecord13(value) {
11999
+ function isRecord12(value) {
12637
12000
  return typeof value === "object" && value !== null && !Array.isArray(value);
12638
12001
  }
12639
12002
  function eventContainsFirstModelToken(event) {
12640
12003
  if (event.type === "message_end") return true;
12641
- const assistantEvent = isRecord13(event.assistantMessageEvent) ? event.assistantMessageEvent : null;
12004
+ const assistantEvent = isRecord12(event.assistantMessageEvent) ? event.assistantMessageEvent : null;
12642
12005
  return assistantEvent?.type === "text_delta" || assistantEvent?.type === "thinking_delta" || assistantEvent?.type === "toolcall_start" || assistantEvent?.type === "toolcall_delta";
12643
12006
  }
12644
12007
  function eventStartsTool(event) {
@@ -12650,13 +12013,13 @@ function finitePositive(value) {
12650
12013
  function nestedFinitePositive(record, path2) {
12651
12014
  let cursor = record;
12652
12015
  for (const key of path2) {
12653
- if (!isRecord13(cursor)) return void 0;
12016
+ if (!isRecord12(cursor)) return void 0;
12654
12017
  cursor = cursor[key];
12655
12018
  }
12656
12019
  return finitePositive(cursor);
12657
12020
  }
12658
12021
  function extractReasoningTokenCount(usage) {
12659
- if (!isRecord13(usage)) return 0;
12022
+ if (!isRecord12(usage)) return 0;
12660
12023
  const direct = finitePositive(usage.reasoningTokens) ?? finitePositive(usage.reasoning_tokens) ?? finitePositive(usage.reasoning);
12661
12024
  if (direct !== void 0) return direct;
12662
12025
  const paths = [
@@ -12682,14 +12045,14 @@ function readStringArrayOrNull(value) {
12682
12045
  return strings.length === value.length ? strings : null;
12683
12046
  }
12684
12047
  function messageText(value) {
12685
- const record = isRecord13(value) ? value : null;
12048
+ const record = isRecord12(value) ? value : null;
12686
12049
  if (record === null) return "";
12687
12050
  const content = record.content;
12688
12051
  if (typeof content === "string") return content;
12689
12052
  if (Array.isArray(content)) {
12690
12053
  return content.map((part) => {
12691
12054
  if (typeof part === "string") return part;
12692
- if (!isRecord13(part)) return "";
12055
+ if (!isRecord12(part)) return "";
12693
12056
  const text2 = part.text;
12694
12057
  return typeof text2 === "string" ? text2 : "";
12695
12058
  }).join("");
@@ -12731,7 +12094,7 @@ function appendDispatchFinishContractEntry(entries, event) {
12731
12094
  return null;
12732
12095
  }
12733
12096
  if (eventType !== "message_end") return null;
12734
- const message = isRecord13(event.message) ? event.message : null;
12097
+ const message = isRecord12(event.message) ? event.message : null;
12735
12098
  if (message === null) return null;
12736
12099
  const role = readStringOrNull(message.role);
12737
12100
  if (role !== "user" && role !== "assistant") return null;
@@ -12754,7 +12117,7 @@ function recordWorkerRunEffect(recorder, event) {
12754
12117
  if (event.type === "tool_execution_start") {
12755
12118
  const toolName = readStringOrNull(event.toolName) ?? readStringOrNull(event.tool);
12756
12119
  if (toolName === null) return;
12757
- recorder.start(toolCallId, toolName, isRecord13(event.args) ? event.args : void 0);
12120
+ recorder.start(toolCallId, toolName, isRecord12(event.args) ? event.args : void 0);
12758
12121
  return;
12759
12122
  }
12760
12123
  if (event.type === "tool_execution_end") recorder.finish(toolCallId, event.isError === true);
@@ -13877,7 +13240,7 @@ function createDispatchBundle(context, options) {
13877
13240
  return DEFAULT_RESILIENCE_COOLDOWN_MS;
13878
13241
  };
13879
13242
  const now = options?.now ?? (() => Date.now());
13880
- const monotonicNow = options?.monotonicNow ?? (() => performance5.now());
13243
+ const monotonicNow = options?.monotonicNow ?? (() => performance4.now());
13881
13244
  const routeObserver = options?.routeObserver ?? createRouteObserver({});
13882
13245
  let ledger = null;
13883
13246
  let heartbeatTimer = null;
@@ -14954,7 +14317,13 @@ function createDispatchBundle(context, options) {
14954
14317
  throw error;
14955
14318
  }
14956
14319
  timing.workerSpawnedAt = new Date(now()).toISOString();
14957
- const tokenMeter = { inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0, reasoningTokens: 0 };
14320
+ const tokenMeter = {
14321
+ inputTokens: 0,
14322
+ outputTokens: 0,
14323
+ cacheReadTokens: 0,
14324
+ cacheWriteTokens: 0,
14325
+ reasoningTokens: 0
14326
+ };
14958
14327
  const safetyDecisionCounts = { allowed: 0, blocked: 0, permissionRequested: 0 };
14959
14328
  const blockedAttempts = [];
14960
14329
  const toolStats = /* @__PURE__ */ new Map();
@@ -14987,7 +14356,7 @@ function createDispatchBundle(context, options) {
14987
14356
  const foldAcpEvent = (raw) => {
14988
14357
  outputCapture.observe(raw);
14989
14358
  const event = raw;
14990
- if (isRecord13(event)) {
14359
+ if (isRecord12(event)) {
14991
14360
  if (eventContainsFirstModelToken(event)) markObservedPhase("firstModelTokenAt");
14992
14361
  if (eventStartsTool(event)) markObservedPhase("firstToolAt");
14993
14362
  }
@@ -14998,14 +14367,14 @@ function createDispatchBundle(context, options) {
14998
14367
  reportedSpoofedOutcome = true;
14999
14368
  reportDispatchDiagnostic("ACP outcome event", new Error("ignored untrusted clio_coder_run_outcome assertion"));
15000
14369
  }
15001
- if (isRecord13(event)) {
14370
+ if (isRecord12(event)) {
15002
14371
  const finishEntry = appendDispatchFinishContractEntry(finishContractEntries, event);
15003
14372
  if (finishEntry !== null) {
15004
14373
  finishContractAssistantText = finishEntry.assistantText;
15005
14374
  finishContractAssistantTurnId = finishEntry.assistantTurnId;
15006
14375
  }
15007
14376
  }
15008
- if (event.type === "message_end" && event.message?.role === "assistant" && isRecord13(event.message.usage)) {
14377
+ if (event.type === "message_end" && event.message?.role === "assistant" && isRecord12(event.message.usage)) {
15009
14378
  const u = event.message.usage;
15010
14379
  tokenMeter.inputTokens += typeof u.input === "number" ? u.input : 0;
15011
14380
  tokenMeter.outputTokens += typeof u.output === "number" ? u.output : 0;
@@ -15166,7 +14535,7 @@ function createDispatchBundle(context, options) {
15166
14535
  }
15167
14536
  const eventPump = startDispatchEventPump(acp.events, foldAcpEvent, {
15168
14537
  onEvent: (event) => {
15169
- if (isRecord13(event) && event.type === "heartbeat") return;
14538
+ if (isRecord12(event) && event.type === "heartbeat") return;
15170
14539
  context.bus.emit(BusChannels.DispatchProgress, {
15171
14540
  runId: envelope.id,
15172
14541
  agentId: req.agentId,
@@ -15284,6 +14653,7 @@ function createDispatchBundle(context, options) {
15284
14653
  outputTokenCount: tokenMeter.outputTokens,
15285
14654
  cacheReadTokenCount: tokenMeter.cacheReadTokens,
15286
14655
  cacheWriteTokenCount: tokenMeter.cacheWriteTokens,
14656
+ ...tokenMeter.cacheWrite1hTokens === void 0 ? {} : { cacheWrite1hTokenCount: tokenMeter.cacheWrite1hTokens },
15287
14657
  reasoningTokenCount: tokenMeter.reasoningTokens,
15288
14658
  ...upstreamResponses.length > 0 ? { upstreamResponses: [...upstreamResponses] } : {},
15289
14659
  ...capturedOutput !== void 0 ? { output: capturedOutput } : {},
@@ -15368,6 +14738,7 @@ function createDispatchBundle(context, options) {
15368
14738
  outputTokenCount: receipt.outputTokenCount ?? 0,
15369
14739
  cacheReadTokenCount: receipt.cacheReadTokenCount ?? 0,
15370
14740
  cacheWriteTokenCount: receipt.cacheWriteTokenCount ?? 0,
14741
+ ...receipt.cacheWrite1hTokenCount === void 0 ? {} : { cacheWrite1hTokenCount: receipt.cacheWrite1hTokenCount },
15371
14742
  reasoningTokenCount: receipt.reasoningTokenCount ?? 0,
15372
14743
  staticShellHash: receipt.staticShellHash ?? null,
15373
14744
  sessionShellHash: receipt.sessionShellHash ?? null,
@@ -15482,6 +14853,7 @@ function createDispatchBundle(context, options) {
15482
14853
  dynamicHash: receiptDraft.dynamicHash ?? null,
15483
14854
  cacheReadTokenCount: receiptDraft.cacheReadTokenCount ?? 0,
15484
14855
  cacheWriteTokenCount: receiptDraft.cacheWriteTokenCount ?? 0,
14856
+ ...receiptDraft.cacheWrite1hTokenCount === void 0 ? {} : { cacheWrite1hTokenCount: receiptDraft.cacheWrite1hTokenCount },
15485
14857
  reasoningTokenCount: receiptDraft.reasoningTokenCount ?? 0,
15486
14858
  heartbeatAt: heartbeatIso(acp.heartbeatAt)
15487
14859
  };
@@ -15727,7 +15099,13 @@ function createDispatchBundle(context, options) {
15727
15099
  throw error;
15728
15100
  }
15729
15101
  })();
15730
- const tokenMeter = { inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0, reasoningTokens: 0 };
15102
+ const tokenMeter = {
15103
+ inputTokens: 0,
15104
+ outputTokens: 0,
15105
+ cacheReadTokens: 0,
15106
+ cacheWriteTokens: 0,
15107
+ reasoningTokens: 0
15108
+ };
15731
15109
  const safetyDecisionCounts = { allowed: 0, blocked: 0, permissionRequested: 0 };
15732
15110
  const escalationCounts = { requested: 0, approved: 0, denied: 0, timedOut: 0 };
15733
15111
  const blockedAttempts = [];
@@ -15871,7 +15249,7 @@ function createDispatchBundle(context, options) {
15871
15249
  const foldWorkerEvent = (raw) => {
15872
15250
  outputCapture.observe(raw);
15873
15251
  const event = raw;
15874
- if (isRecord13(event)) {
15252
+ if (isRecord12(event)) {
15875
15253
  if (eventContainsFirstModelToken(event)) markObservedPhase("firstModelTokenAt");
15876
15254
  if (eventStartsTool(event)) markObservedPhase("firstToolAt");
15877
15255
  }
@@ -15890,7 +15268,7 @@ function createDispatchBundle(context, options) {
15890
15268
  );
15891
15269
  }
15892
15270
  }
15893
- if (isRecord13(event)) {
15271
+ if (isRecord12(event)) {
15894
15272
  const finishEntry = appendDispatchFinishContractEntry(finishContractEntries, event);
15895
15273
  if (finishEntry !== null) {
15896
15274
  finishContractAssistantText = finishEntry.assistantText;
@@ -15900,9 +15278,9 @@ function createDispatchBundle(context, options) {
15900
15278
  }
15901
15279
  if (event.type === "clio_coder_permission_escalated" && event.payload && typeof event.payload.requestId === "string") {
15902
15280
  escalationCounts.requested += 1;
15903
- const ctx = isRecord13(event.payload.decision) ? event.payload.decision : null;
15904
- const classification = ctx !== null && isRecord13(ctx.classification) ? ctx.classification : null;
15905
- const policy = ctx !== null && isRecord13(ctx.policy) ? ctx.policy : null;
15281
+ const ctx = isRecord12(event.payload.decision) ? event.payload.decision : null;
15282
+ const classification = ctx !== null && isRecord12(ctx.classification) ? ctx.classification : null;
15283
+ const policy = ctx !== null && isRecord12(ctx.policy) ? ctx.policy : null;
15906
15284
  const actionClass = readStringOrNull(classification?.actionClass) ?? readStringOrNull(ctx?.actionClass) ?? readStringOrNull(event.payload.actionClass) ?? "unknown";
15907
15285
  const reasons = readStringArrayOrNull(ctx?.reasons) ?? readStringArrayOrNull(classification?.reasons);
15908
15286
  const reasonCode = readStringOrNull(ctx?.reasonCode) ?? readStringOrNull(policy?.reasonCode);
@@ -15929,13 +15307,9 @@ function createDispatchBundle(context, options) {
15929
15307
  escalation: true
15930
15308
  });
15931
15309
  }
15932
- if (event.type === "message_end" && event.message?.role === "assistant" && isRecord13(event.message.usage)) {
15310
+ if (event.type === "message_end" && event.message?.role === "assistant" && isRecord12(event.message.usage)) {
15933
15311
  const u = event.message.usage;
15934
- tokenMeter.inputTokens += typeof u.input === "number" ? u.input : 0;
15935
- tokenMeter.outputTokens += typeof u.output === "number" ? u.output : 0;
15936
- tokenMeter.cacheReadTokens += typeof u.cacheRead === "number" ? u.cacheRead : 0;
15937
- tokenMeter.cacheWriteTokens += typeof u.cacheWrite === "number" ? u.cacheWrite : 0;
15938
- tokenMeter.reasoningTokens += extractReasoningTokenCount(u);
15312
+ accumulateNativeUsage(tokenMeter, u, lifecycle.target.effectivePricing.rates);
15939
15313
  const requestedModelId = readStringOrNull(event.message.model);
15940
15314
  const responseModelIdObservation = responseModelIdObservationFromRecord(event.message, "not-observed");
15941
15315
  const differingResponseModelId = readStringOrNull(event.message.responseModel);
@@ -16287,11 +15661,12 @@ function createDispatchBundle(context, options) {
16287
15661
  outputTokenCount: tokenMeter.outputTokens,
16288
15662
  cacheReadTokenCount: tokenMeter.cacheReadTokens,
16289
15663
  cacheWriteTokenCount: tokenMeter.cacheWriteTokens,
15664
+ ...tokenMeter.cacheWrite1hTokens === void 0 ? {} : { cacheWrite1hTokenCount: tokenMeter.cacheWrite1hTokens },
16290
15665
  reasoningTokenCount: tokenMeter.reasoningTokens,
16291
15666
  ...upstreamResponses.length > 0 ? { upstreamResponses: [...upstreamResponses] } : {},
16292
15667
  ...capturedOutput !== void 0 ? { output: capturedOutput } : {},
16293
15668
  costUsd,
16294
- costProvenance: lifecycle.target.effectivePricing.provenance,
15669
+ costProvenance: lifecycle.target.effectivePricing.provenance === "unknown" && costUsd > 0 ? "estimated" : lifecycle.target.effectivePricing.provenance,
16295
15670
  compiledPromptHash: lifecycle.compiledPromptHash,
16296
15671
  staticCompositionHash: lifecycle.staticCompositionHash,
16297
15672
  staticShellHash: lifecycle.staticCompositionHash,
@@ -16373,6 +15748,7 @@ function createDispatchBundle(context, options) {
16373
15748
  outputTokenCount: receipt.outputTokenCount ?? 0,
16374
15749
  cacheReadTokenCount: receipt.cacheReadTokenCount ?? 0,
16375
15750
  cacheWriteTokenCount: receipt.cacheWriteTokenCount ?? 0,
15751
+ ...receipt.cacheWrite1hTokenCount === void 0 ? {} : { cacheWrite1hTokenCount: receipt.cacheWrite1hTokenCount },
16376
15752
  reasoningTokenCount: receipt.reasoningTokenCount ?? 0,
16377
15753
  staticShellHash: receipt.staticShellHash ?? null,
16378
15754
  sessionShellHash: receipt.sessionShellHash ?? null,
@@ -16569,6 +15945,7 @@ function createDispatchBundle(context, options) {
16569
15945
  sessionShellHash: receiptDraft.sessionShellHash ?? null,
16570
15946
  dynamicHash: receiptDraft.dynamicHash ?? null,
16571
15947
  ...receiptDraft.cacheReadTokenCount !== void 0 ? { cacheReadTokenCount: receiptDraft.cacheReadTokenCount } : {},
15948
+ ...receiptDraft.cacheWrite1hTokenCount === void 0 ? {} : { cacheWrite1hTokenCount: receiptDraft.cacheWrite1hTokenCount },
16572
15949
  ...receiptDraft.cacheWriteTokenCount !== void 0 ? { cacheWriteTokenCount: receiptDraft.cacheWriteTokenCount } : {},
16573
15950
  ...activeRun.heartbeatAt ? { heartbeatAt: heartbeatIso(activeRun.heartbeatAt) } : {}
16574
15951
  };
@@ -17206,7 +16583,11 @@ function createDispatchBundle(context, options) {
17206
16583
  async start() {
17207
16584
  if (options?.journalRunEvents === true) journalBridge = attachRunEventJournalBridge(context.bus);
17208
16585
  cleanupDispatchReservations({ startup: true, nowMs: now() });
17209
- ledger = openLedger();
16586
+ ledger = openLedger({
16587
+ get maxRuns() {
16588
+ return getEffectiveSettings()?.fleet?.history?.maxRuns ?? resolveGuardrail("maxDispatchRuns");
16589
+ }
16590
+ });
17210
16591
  try {
17211
16592
  const recovery = recoverOrphanReceipts(ledger);
17212
16593
  if (recovery.recovered > 0 || recovery.corrupt > 0 || recovery.abandoned > 0 || recovery.sealed > 0) {
@@ -17315,6 +16696,7 @@ function createDispatchBundle(context, options) {
17315
16696
  const meter = run.meter;
17316
16697
  const totalTokens = meter.inputTokens + meter.outputTokens + meter.cacheReadTokens + meter.cacheWriteTokens;
17317
16698
  const costUsd = calculateUsageCostUsd(meter, run.pricing);
16699
+ const costProvenance = run.costProvenance === "unknown" && costUsd > 0 ? "estimated" : run.costProvenance;
17318
16700
  const startedMs = Date.parse(run.startedAt);
17319
16701
  const elapsedMs = Number.isFinite(startedMs) ? Math.max(0, tickNow - startedMs) : 0;
17320
16702
  const timing = deriveRunPhaseDurations(run.timing, run.startedAt, new Date(tickNow).toISOString());
@@ -17332,14 +16714,14 @@ function createDispatchBundle(context, options) {
17332
16714
  timing,
17333
16715
  tokens: { input: meter.inputTokens, output: meter.outputTokens, total: totalTokens },
17334
16716
  costUsd,
17335
- costProvenance: run.costProvenance,
16717
+ costProvenance,
17336
16718
  node: run.node !== null ? { ...run.node } : null
17337
16719
  });
17338
16720
  totals.inputTokens += meter.inputTokens;
17339
16721
  totals.outputTokens += meter.outputTokens;
17340
16722
  totals.totalTokens += totalTokens;
17341
16723
  totals.costUsd += costUsd;
17342
- costAmounts.push({ usd: costUsd, provenance: run.costProvenance });
16724
+ costAmounts.push({ usd: costUsd, provenance: costProvenance });
17343
16725
  totals.runtimeSeconds += elapsedMs / 1e3;
17344
16726
  }
17345
16727
  const retrying = [...retryQueue.values()].map((entry) => ({
@@ -18195,6 +17577,7 @@ function createCostTracker() {
18195
17577
  output,
18196
17578
  cacheRead,
18197
17579
  cacheWrite,
17580
+ ...breakdown?.cacheWrite1h === void 0 ? {} : { cacheWrite1h: breakdown.cacheWrite1h },
18198
17581
  reasoningTokens,
18199
17582
  ...apiCalls !== void 0 ? { apiCalls } : {},
18200
17583
  ...label !== void 0 ? { label } : {}
@@ -18204,6 +17587,7 @@ function createCostTracker() {
18204
17587
  totals.output += output;
18205
17588
  totals.cacheRead += cacheRead;
18206
17589
  totals.cacheWrite += cacheWrite;
17590
+ if (breakdown?.cacheWrite1h !== void 0) totals.cacheWrite1h = (totals.cacheWrite1h ?? 0) + breakdown.cacheWrite1h;
18207
17591
  totals.reasoningTokens += reasoningTokens;
18208
17592
  totals.totalTokens += tokens2;
18209
17593
  return resolvedUsd;
@@ -18227,6 +17611,7 @@ function createCostTracker() {
18227
17611
  totals.output = 0;
18228
17612
  totals.cacheRead = 0;
18229
17613
  totals.cacheWrite = 0;
17614
+ delete totals.cacheWrite1h;
18230
17615
  totals.reasoningTokens = 0;
18231
17616
  totals.totalTokens = 0;
18232
17617
  }
@@ -18961,7 +18346,7 @@ function hasRunProvenance(view) {
18961
18346
  return view.pipeline !== void 0 || view.personaOverride !== void 0 || view.escalation !== void 0 || view.autonomyEnforcement !== void 0;
18962
18347
  }
18963
18348
  function runProvenanceFromUnknown(value) {
18964
- if (!isRecord14(value)) return {};
18349
+ if (!isRecord13(value)) return {};
18965
18350
  const view = {};
18966
18351
  const pipeline = pipelineFromUnknown(value.pipeline);
18967
18352
  if (pipeline !== null) view.pipeline = pipeline;
@@ -18973,14 +18358,14 @@ function runProvenanceFromUnknown(value) {
18973
18358
  if (autonomyEnforcement !== null) view.autonomyEnforcement = autonomyEnforcement;
18974
18359
  return view;
18975
18360
  }
18976
- function isRecord14(value) {
18361
+ function isRecord13(value) {
18977
18362
  return typeof value === "object" && value !== null && !Array.isArray(value);
18978
18363
  }
18979
18364
  function finiteNumber(value) {
18980
18365
  return typeof value === "number" && Number.isFinite(value) ? value : null;
18981
18366
  }
18982
18367
  function pipelineFromUnknown(value) {
18983
- if (!isRecord14(value)) return null;
18368
+ if (!isRecord13(value)) return null;
18984
18369
  const position = finiteNumber(value.position);
18985
18370
  const inputBytes = finiteNumber(value.inputBytes);
18986
18371
  if (position === null || inputBytes === null) return null;
@@ -18988,11 +18373,11 @@ function pipelineFromUnknown(value) {
18988
18373
  return { fromRunId, position, inputBytes, inputTruncated: value.inputTruncated === true };
18989
18374
  }
18990
18375
  function personaOverrideFromUnknown(value) {
18991
- if (!isRecord14(value) || typeof value.promptHash !== "string" || value.promptHash.length === 0) return null;
18376
+ if (!isRecord13(value) || typeof value.promptHash !== "string" || value.promptHash.length === 0) return null;
18992
18377
  return { promptHash: value.promptHash };
18993
18378
  }
18994
18379
  function autonomyEnforcementFromUnknown(value) {
18995
- if (!isRecord14(value)) return null;
18380
+ if (!isRecord13(value)) return null;
18996
18381
  if (value.grade !== "mediated" && value.grade !== "approximated" && value.grade !== "bypassed") return null;
18997
18382
  if (typeof value.autonomy !== "string" || value.autonomy.length === 0) return null;
18998
18383
  const view = { grade: value.grade, autonomy: value.autonomy };
@@ -19001,9 +18386,9 @@ function autonomyEnforcementFromUnknown(value) {
19001
18386
  return view;
19002
18387
  }
19003
18388
  function escalationFromUnknown(safety) {
19004
- if (!isRecord14(safety)) return null;
18389
+ if (!isRecord13(safety)) return null;
19005
18390
  const decisions = safety.decisions;
19006
- if (!isRecord14(decisions)) return null;
18391
+ if (!isRecord13(decisions)) return null;
19007
18392
  const requested = finiteNumber(decisions.escalationRequested);
19008
18393
  if (requested === null) return null;
19009
18394
  return {
@@ -19245,7 +18630,7 @@ async function loadEvidenceTrustStatus(dataDir, evidenceId) {
19245
18630
  }
19246
18631
  const source = `${evidenceId}/trust-status.json`;
19247
18632
  const parsed = parseJson2(raw, source);
19248
- if (!isRecord15(parsed)) throw new Error(`${source}: expected object`);
18633
+ if (!isRecord14(parsed)) throw new Error(`${source}: expected object`);
19249
18634
  if (parsed.version !== 1) throw new Error(`${source}: expected version 1`);
19250
18635
  if (readString2(parsed, source, "evidenceId") !== evidenceId) {
19251
18636
  throw new Error(`${source}.evidenceId: expected ${evidenceId}`);
@@ -19258,7 +18643,7 @@ async function loadEvidenceTrustStatus(dataDir, evidenceId) {
19258
18643
  projection: "canonical",
19259
18644
  runs: parsed.runs.map((entry, index) => {
19260
18645
  const entrySource = `${source}.runs[${index}]`;
19261
- if (!isRecord15(entry)) throw new Error(`${entrySource}: expected object`);
18646
+ if (!isRecord14(entry)) throw new Error(`${entrySource}: expected object`);
19262
18647
  return {
19263
18648
  runId: readString2(entry, entrySource, "runId"),
19264
18649
  status: normalizeTrustStatus(entry.status)
@@ -19276,10 +18661,10 @@ async function loadEvidenceRunProvenance(dataDir, evidenceId) {
19276
18661
  throw error;
19277
18662
  }
19278
18663
  const parsed = parseJson2(raw, `${evidenceId}/receipt.json`);
19279
- if (!isRecord15(parsed) || !Array.isArray(parsed.receipts)) return [];
18664
+ if (!isRecord14(parsed) || !Array.isArray(parsed.receipts)) return [];
19280
18665
  const out3 = [];
19281
18666
  for (const entry of parsed.receipts) {
19282
- if (!isRecord15(entry) || typeof entry.runId !== "string") continue;
18667
+ if (!isRecord14(entry) || typeof entry.runId !== "string") continue;
19283
18668
  const view = runProvenanceFromUnknown(entry);
19284
18669
  if (hasRunProvenance(view)) out3.push({ runId: entry.runId, view });
19285
18670
  }
@@ -19295,9 +18680,9 @@ async function loadEvidenceGateDecisions(dataDir, evidenceId) {
19295
18680
  throw error;
19296
18681
  }
19297
18682
  const parsed = parseJson2(raw, `${evidenceId}/gate-decisions.json`);
19298
- if (!isRecord15(parsed) || !Array.isArray(parsed.decisions)) return [];
18683
+ if (!isRecord14(parsed) || !Array.isArray(parsed.decisions)) return [];
19299
18684
  return parsed.decisions.filter((entry) => {
19300
- if (!isRecord15(entry)) return false;
18685
+ if (!isRecord14(entry)) return false;
19301
18686
  return verifyGateDecisionArtifact(entry).ok;
19302
18687
  });
19303
18688
  }
@@ -19320,7 +18705,7 @@ async function listEvidenceOverviews(dataDir) {
19320
18705
  return overviews;
19321
18706
  }
19322
18707
  function parseOverview(value, source) {
19323
- if (!isRecord15(value)) throw new Error(`${source}: expected object`);
18708
+ if (!isRecord14(value)) throw new Error(`${source}: expected object`);
19324
18709
  if (value.version !== 1) throw new Error(`${source}: expected version 1`);
19325
18710
  const evidenceId = readString2(value, source, "evidenceId");
19326
18711
  const sourceValue = readSource(value.source, `${source}.source`);
@@ -19364,13 +18749,13 @@ function parseOverview(value, source) {
19364
18749
  };
19365
18750
  }
19366
18751
  function parseFindingsFile(value, source) {
19367
- if (!isRecord15(value)) throw new Error(`${source}: expected object`);
18752
+ if (!isRecord14(value)) throw new Error(`${source}: expected object`);
19368
18753
  if (value.version !== 1) throw new Error(`${source}: expected version 1`);
19369
18754
  if (!Array.isArray(value.findings)) throw new Error(`${source}.findings: expected array`);
19370
18755
  return value.findings.map((entry, index) => parseFinding(entry, `${source}.findings[${index}]`));
19371
18756
  }
19372
18757
  function parseFinding(value, source) {
19373
- if (!isRecord15(value)) throw new Error(`${source}: expected object`);
18758
+ if (!isRecord14(value)) throw new Error(`${source}: expected object`);
19374
18759
  const severity = readString2(value, source, "severity");
19375
18760
  if (severity !== "info" && severity !== "warn") throw new Error(`${source}.severity: expected info or warn`);
19376
18761
  const tag = readString2(value, source, "tag");
@@ -19383,14 +18768,14 @@ function parseFinding(value, source) {
19383
18768
  };
19384
18769
  }
19385
18770
  function readSource(value, source) {
19386
- if (!isRecord15(value)) throw new Error(`${source}: expected object`);
18771
+ if (!isRecord14(value)) throw new Error(`${source}: expected object`);
19387
18772
  if (value.kind === "run") return { kind: "run", runId: readString2(value, source, "runId") };
19388
18773
  if (value.kind === "session") return { kind: "session", sessionId: readString2(value, source, "sessionId") };
19389
18774
  if (value.kind === "eval") return { kind: "eval", evalId: readString2(value, source, "evalId") };
19390
18775
  throw new Error(`${source}.kind: expected run, session, or eval`);
19391
18776
  }
19392
18777
  function readTotals(value, source) {
19393
- if (!isRecord15(value)) throw new Error(`${source}: expected object`);
18778
+ if (!isRecord14(value)) throw new Error(`${source}: expected object`);
19394
18779
  return {
19395
18780
  runs: readNumber2(value, source, "runs"),
19396
18781
  receipts: readNumber2(value, source, "receipts"),
@@ -19448,7 +18833,7 @@ function parseJson2(raw, source) {
19448
18833
  throw new Error(`${source}: invalid JSON: ${message}`);
19449
18834
  }
19450
18835
  }
19451
- function isRecord15(value) {
18836
+ function isRecord14(value) {
19452
18837
  return typeof value === "object" && value !== null && !Array.isArray(value);
19453
18838
  }
19454
18839
  function findingsFile(evidenceId, findings) {
@@ -19458,7 +18843,7 @@ function readDecisions(value, source) {
19458
18843
  if (!Array.isArray(value)) throw new Error(`${source}: expected array`);
19459
18844
  return value.map((entry, index) => {
19460
18845
  const path2 = `${source}[${index}]`;
19461
- if (!isRecord15(entry) || !isDecisionRecord(entry.record)) throw new Error(`${path2}: expected recorded decision`);
18846
+ if (!isRecord14(entry) || !isDecisionRecord(entry.record)) throw new Error(`${path2}: expected recorded decision`);
19462
18847
  return {
19463
18848
  runId: readString2(entry, path2, "runId"),
19464
18849
  sessionId: readString2(entry, path2, "sessionId"),
@@ -19857,7 +19242,7 @@ function validationToolCallCandidate(entry, linked, runSources) {
19857
19242
  }
19858
19243
  function validationToolCallSummary(toolName, args) {
19859
19244
  const parsed = parseMaybeJson(args);
19860
- const argRecord = isRecord16(parsed) ? parsed : null;
19245
+ const argRecord = isRecord15(parsed) ? parsed : null;
19861
19246
  if (toolName === "bash") {
19862
19247
  const command = readOptionalString(argRecord?.command);
19863
19248
  if (command === null) return null;
@@ -19879,8 +19264,8 @@ function validationToolCallSummary(toolName, args) {
19879
19264
  }
19880
19265
  function isSuccessfulSessionToolResult(result) {
19881
19266
  if (result.isError) return false;
19882
- const obj = isRecord16(result.result) ? result.result : null;
19883
- const details = isRecord16(obj?.details) ? obj.details : null;
19267
+ const obj = isRecord15(result.result) ? result.result : null;
19268
+ const details = isRecord15(obj?.details) ? obj.details : null;
19884
19269
  return details?.kind !== "error";
19885
19270
  }
19886
19271
  function finding(index, severity, tag, runId, message) {
@@ -20055,7 +19440,7 @@ function attributionWindows(ledger, runSources, sessionIds) {
20055
19440
  }
20056
19441
  const linkedSessions = new Set(sessionIds);
20057
19442
  for (const row of ledger.rows) {
20058
- if (!isRecord16(row)) continue;
19443
+ if (!isRecord15(row)) continue;
20059
19444
  const id = readOptionalString(row.id);
20060
19445
  const startedAt = readOptionalString(row.startedAt);
20061
19446
  const sessionId = readOptionalString(row.sessionId);
@@ -20623,7 +20008,7 @@ async function readRunLedger(stateDir) {
20623
20008
  }
20624
20009
  function selectRunEnvelopes(ledger, source) {
20625
20010
  return ledger.rows.flatMap((entry, index) => {
20626
- if (!isRecord16(entry)) return [];
20011
+ if (!isRecord15(entry)) return [];
20627
20012
  const selected = source.kind === "run" ? entry.id === source.runId : entry.sessionId === source.sessionId;
20628
20013
  return selected ? [parseRunEnvelope(entry, `${ledger.path}[${index}]`)] : [];
20629
20014
  });
@@ -20664,7 +20049,7 @@ function readExecutionRole(value, source) {
20664
20049
  return role;
20665
20050
  }
20666
20051
  function parseRunEnvelope(value, source) {
20667
- if (!isRecord16(value)) throw new Error(`${source}: expected object`);
20052
+ if (!isRecord15(value)) throw new Error(`${source}: expected object`);
20668
20053
  const reasoningTokenCount = readOptionalNumber2(value, source, "reasoningTokenCount");
20669
20054
  return {
20670
20055
  ...value,
@@ -20692,9 +20077,9 @@ function parseRunEnvelope(value, source) {
20692
20077
  };
20693
20078
  }
20694
20079
  function parseRunReceipt(value, source) {
20695
- if (!isRecord16(value)) throw new Error(`${source}: expected object`);
20080
+ if (!isRecord15(value)) throw new Error(`${source}: expected object`);
20696
20081
  const integrity = value.integrity;
20697
- if (!isRecord16(integrity)) throw new Error(`${source}.integrity: expected object`);
20082
+ if (!isRecord15(integrity)) throw new Error(`${source}.integrity: expected object`);
20698
20083
  const reasoningTokenCount = readOptionalNumber2(value, source, "reasoningTokenCount");
20699
20084
  const failureMessage = readOptionalString(value.failureMessage);
20700
20085
  return {
@@ -20738,7 +20123,7 @@ function readToolStats(record, source, field) {
20738
20123
  if (!Array.isArray(value)) throw new Error(`${source}.${field}: expected array`);
20739
20124
  return value.map((entry, index) => {
20740
20125
  const itemSource = `${source}.${field}[${index}]`;
20741
- if (!isRecord16(entry)) throw new Error(`${itemSource}: expected object`);
20126
+ if (!isRecord15(entry)) throw new Error(`${itemSource}: expected object`);
20742
20127
  return {
20743
20128
  tool: readString3(entry, itemSource, "tool"),
20744
20129
  count: readNumber3(entry, itemSource, "count"),
@@ -20803,11 +20188,11 @@ function parseJson3(raw, source) {
20803
20188
  throw new Error(`${source}: invalid JSON: ${message}`);
20804
20189
  }
20805
20190
  }
20806
- function isRecord16(value) {
20191
+ function isRecord15(value) {
20807
20192
  return typeof value === "object" && value !== null && !Array.isArray(value);
20808
20193
  }
20809
20194
  function payloadObject(payload) {
20810
- return isRecord16(payload) ? payload : null;
20195
+ return isRecord15(payload) ? payload : null;
20811
20196
  }
20812
20197
  function parseMaybeJson(value) {
20813
20198
  if (typeof value !== "string") return value;
@@ -20824,7 +20209,7 @@ function firstContentBlock(payload, type) {
20824
20209
  const content = obj?.content;
20825
20210
  if (!Array.isArray(content)) return null;
20826
20211
  for (const block of content) {
20827
- if (!isRecord16(block)) continue;
20212
+ if (!isRecord15(block)) continue;
20828
20213
  if (block.type === type) return block;
20829
20214
  }
20830
20215
  return null;
@@ -20837,7 +20222,7 @@ function extractTextFromPayload(payload) {
20837
20222
  if (Array.isArray(obj.content)) {
20838
20223
  const parts = [];
20839
20224
  for (const block of obj.content) {
20840
- if (!isRecord16(block)) continue;
20225
+ if (!isRecord15(block)) continue;
20841
20226
  if (block.type === "text" && typeof block.text === "string") parts.push(block.text);
20842
20227
  }
20843
20228
  return parts.join("\n");
@@ -21324,7 +20709,7 @@ async function readRunLedger2(stateDir) {
21324
20709
  try {
21325
20710
  const raw = await readFile4(join27(stateDir, "runs.json"), "utf8");
21326
20711
  const parsed = JSON.parse(raw);
21327
- return Array.isArray(parsed) ? parsed.filter(isRecord17) : [];
20712
+ return Array.isArray(parsed) ? parsed.filter(isRecord16) : [];
21328
20713
  } catch {
21329
20714
  return [];
21330
20715
  }
@@ -21336,7 +20721,7 @@ async function readReceiptForRun(stateDir, envelope) {
21336
20721
  const path2 = envelope.receiptPath ?? join27(stateDir, "receipts", `${envelope.id}.json`);
21337
20722
  try {
21338
20723
  const parsed = JSON.parse(await readFile4(path2, "utf8"));
21339
- return isRecord17(parsed) ? parsed : null;
20724
+ return isRecord16(parsed) ? parsed : null;
21340
20725
  } catch {
21341
20726
  return null;
21342
20727
  }
@@ -21351,7 +20736,7 @@ async function countSessionEntries(stateDir, sessionIds) {
21351
20736
  count += raw.split("\n").filter((line) => line.trim().length > 0).filter((line) => {
21352
20737
  try {
21353
20738
  const parsed = JSON.parse(line);
21354
- return isRecord17(parsed) && parsed.type !== "session";
20739
+ return isRecord16(parsed) && parsed.type !== "session";
21355
20740
  } catch {
21356
20741
  return false;
21357
20742
  }
@@ -21400,7 +20785,7 @@ async function linkedEvalAuditRows(stateDir, runIds, artifact) {
21400
20785
  } catch {
21401
20786
  continue;
21402
20787
  }
21403
- if (!isRecord17(parsed)) continue;
20788
+ if (!isRecord16(parsed)) continue;
21404
20789
  const directRunId = typeof parsed.runId === "string" ? parsed.runId : null;
21405
20790
  if (directRunId !== null && runIds.has(directRunId)) {
21406
20791
  rows.push(evalAuditRow(parsed, directRunId, "run-id", "exact", ["audit runId matched nested eval run"]));
@@ -21471,7 +20856,7 @@ function sanitizeEvidenceId2(value) {
21471
20856
  const sanitized = value.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
21472
20857
  return sanitized.length === 0 ? "unknown" : sanitized;
21473
20858
  }
21474
- function isRecord17(value) {
20859
+ function isRecord16(value) {
21475
20860
  return typeof value === "object" && value !== null && !Array.isArray(value);
21476
20861
  }
21477
20862
 
@@ -21753,7 +21138,7 @@ function parseTaskMemoryHandoffSnapshot(text) {
21753
21138
  } catch {
21754
21139
  return null;
21755
21140
  }
21756
- if (!isRecord18(raw) || raw.version !== 1 && raw.version !== TASK_MEMORY_HANDOFF_VERSION) return null;
21141
+ if (!isRecord17(raw) || raw.version !== 1 && raw.version !== TASK_MEMORY_HANDOFF_VERSION) return null;
21757
21142
  if (raw.version === 1 && !hasExactKeys(raw, ["version", "knowledge", "procedural"])) return null;
21758
21143
  if (raw.version === TASK_MEMORY_HANDOFF_VERSION && !hasExactKeys(raw, ["version", "source", "redaction", "knowledge", "procedural"])) {
21759
21144
  return null;
@@ -21840,7 +21225,7 @@ function parseEntries(value, maxEntries, version) {
21840
21225
  const entries = [];
21841
21226
  for (const raw of value) {
21842
21227
  const expectedKeys = version === 1 ? ["id", "content", "injectionCount"] : ["id", "content", "injectionCount", "createdAt", "lastTouchedAt"];
21843
- if (!isRecord18(raw) || !hasExactKeys(raw, expectedKeys)) return null;
21228
+ if (!isRecord17(raw) || !hasExactKeys(raw, expectedKeys)) return null;
21844
21229
  if (!nonEmptyString(raw.id) || !nonEmptyString(raw.content) || raw.content.length > TASK_MEMORY_CONTENT_MAX_CHARS)
21845
21230
  return null;
21846
21231
  if (!Number.isInteger(raw.injectionCount) || raw.injectionCount < 0) return null;
@@ -21857,7 +21242,7 @@ function parseEntries(value, maxEntries, version) {
21857
21242
  return entries;
21858
21243
  }
21859
21244
  function parseSource(value) {
21860
- if (!isRecord18(value) || !hasExactKeys(value, ["sessionId", "evidenceRefs", "runtimeIds", "agentIds"])) return null;
21245
+ if (!isRecord17(value) || !hasExactKeys(value, ["sessionId", "evidenceRefs", "runtimeIds", "agentIds"])) return null;
21861
21246
  if (!validSourceValue2(value.sessionId)) return null;
21862
21247
  const evidenceRefs = parseSourceValues(value.evidenceRefs, false);
21863
21248
  const runtimeIds = parseNamedIdentities(value.runtimeIds);
@@ -21866,7 +21251,7 @@ function parseSource(value) {
21866
21251
  return { sessionId: value.sessionId, evidenceRefs, runtimeIds, agentIds };
21867
21252
  }
21868
21253
  function parseRedaction(value) {
21869
- if (!isRecord18(value) || !hasExactKeys(value, ["replacementCount", "sourceFields"])) return null;
21254
+ if (!isRecord17(value) || !hasExactKeys(value, ["replacementCount", "sourceFields"])) return null;
21870
21255
  if (!Number.isInteger(value.replacementCount) || value.replacementCount < 0) return null;
21871
21256
  const sourceFields = parseSourceValues(value.sourceFields, true);
21872
21257
  if (sourceFields === null) return null;
@@ -21913,7 +21298,7 @@ function cloneSource(source) {
21913
21298
  agentIds: [...source.agentIds]
21914
21299
  };
21915
21300
  }
21916
- function isRecord18(value) {
21301
+ function isRecord17(value) {
21917
21302
  return typeof value === "object" && value !== null && !Array.isArray(value);
21918
21303
  }
21919
21304
  function hasExactKeys(value, keys) {
@@ -22815,11 +22200,6 @@ export {
22815
22200
  buildMemoryPromptSection,
22816
22201
  selectWorkerContext,
22817
22202
  protectedResidencyModels,
22818
- AcpTimeoutError,
22819
- ACP_TURN_FAILED_MESSAGE,
22820
- AcpRequestError,
22821
- acpErrorMessage,
22822
- createStdioServerTransport,
22823
22203
  ACP_USAGE_META_KEY,
22824
22204
  ACP_SESSION_META_KEY,
22825
22205
  ACP_AGENT_META_KEY,
@@ -22900,4 +22280,4 @@ export {
22900
22280
  buildWikiPlanPrompt,
22901
22281
  buildWikiPagePrompt
22902
22282
  };
22903
- //# sourceMappingURL=chunk-WN552PKN.js.map
22283
+ //# sourceMappingURL=chunk-5W4FRA5Q.js.map