@iowarp/clio-coder 0.4.6 → 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 (1142) hide show
  1. package/.claude-plugin/marketplace.json +283 -0
  2. package/CHANGELOG.md +79 -0
  3. package/CONTRIBUTING.md +178 -96
  4. package/NOTICE +8 -0
  5. package/README.md +100 -47
  6. package/dist/acp-JWPQZM2D.js +130 -0
  7. package/dist/agents-4GCDIRVX.js +149 -0
  8. package/dist/assets/codewiki.json +1 -1
  9. package/dist/assets/tui-notices/get-east-asian-width-LICENSE +9 -0
  10. package/dist/assets/tui-notices/marked-LICENSE +44 -0
  11. package/dist/assets/tui-notices/pi-tui-LICENSE +21 -0
  12. package/dist/assets/web-notices/@hono__node-server-LICENSE +21 -0
  13. package/dist/assets/web-notices/hono-LICENSE +21 -0
  14. package/dist/auth-SYAKTDQE.js +551 -0
  15. package/dist/background-OW67WMYR.js +37 -0
  16. package/dist/builtins-TKS63VNV.js +22 -0
  17. package/dist/chunk-2JSCCEKO.js +85 -0
  18. package/dist/chunk-2SXGG2IV.js +391 -0
  19. package/dist/chunk-2U2U5POA.js +59 -0
  20. package/dist/chunk-2ZWLMA3T.js +658 -0
  21. package/dist/chunk-36XSBPXL.js +579 -0
  22. package/dist/chunk-3IQOZRQ6.js +396 -0
  23. package/dist/chunk-3XE4NRLF.js +324 -0
  24. package/dist/chunk-44U2OUSM.js +243 -0
  25. package/dist/chunk-4P6M2TTE.js +119 -0
  26. package/dist/chunk-526ABLHD.js +1219 -0
  27. package/dist/chunk-5C2OQHLR.js +674 -0
  28. package/dist/chunk-5D2FNBMG.js +185 -0
  29. package/dist/chunk-5EQO5NWP.js +243 -0
  30. package/dist/chunk-5HULHKT2.js +32 -0
  31. package/dist/chunk-5UG6EZI3.js +66 -0
  32. package/dist/chunk-5W4FRA5Q.js +22283 -0
  33. package/dist/chunk-6R5MBXBJ.js +386 -0
  34. package/dist/chunk-6TKOFFGE.js +1058 -0
  35. package/dist/chunk-6UJ7RDI7.js +1143 -0
  36. package/dist/chunk-6X7VOCDY.js +44 -0
  37. package/dist/chunk-7QQRPB2E.js +915 -0
  38. package/dist/chunk-ARRUMZ7X.js +1377 -0
  39. package/dist/chunk-ATB3Q7YO.js +663 -0
  40. package/dist/chunk-AUHVBIDW.js +19 -0
  41. package/dist/chunk-BE4I3UJ2.js +668 -0
  42. package/dist/chunk-BFPHMSK7.js +169 -0
  43. package/dist/chunk-BHJMMCXS.js +466 -0
  44. package/dist/chunk-BIY22UUK.js +1322 -0
  45. package/dist/chunk-D55WO5J7.js +110 -0
  46. package/dist/chunk-DVJL77SO.js +162 -0
  47. package/dist/chunk-E2NSPYLC.js +814 -0
  48. package/dist/chunk-EFXMQYI6.js +4484 -0
  49. package/dist/chunk-EPYATQMG.js +2718 -0
  50. package/dist/chunk-EXKUF426.js +1801 -0
  51. package/dist/chunk-F7Y6QTPL.js +689 -0
  52. package/dist/chunk-FB3KTE2J.js +1710 -0
  53. package/dist/chunk-FNVPQQYT.js +117 -0
  54. package/dist/chunk-GEVQNST4.js +101 -0
  55. package/dist/chunk-GEYX2NZ5.js +697 -0
  56. package/dist/chunk-GJBJHJNY.js +2120 -0
  57. package/dist/chunk-GM4TY6VN.js +1233 -0
  58. package/dist/chunk-GVU4CXPJ.js +5191 -0
  59. package/dist/chunk-H5DPSUBB.js +637 -0
  60. package/dist/chunk-H77XBUBM.js +688 -0
  61. package/dist/chunk-HMGAKB7E.js +380 -0
  62. package/dist/chunk-HP7KJ5O2.js +797 -0
  63. package/dist/chunk-HVCAY2FH.js +67 -0
  64. package/dist/chunk-ICYIUNO4.js +35 -0
  65. package/dist/chunk-IILXVWJY.js +223 -0
  66. package/dist/chunk-JCVIL6TY.js +595 -0
  67. package/dist/chunk-JIMWEYWO.js +63 -0
  68. package/dist/chunk-JLBVCROW.js +562 -0
  69. package/dist/chunk-JOBN2YQQ.js +176 -0
  70. package/dist/chunk-JOL2QRLE.js +152 -0
  71. package/dist/chunk-JRA6OBHY.js +974 -0
  72. package/dist/chunk-JV25I7ID.js +1865 -0
  73. package/dist/chunk-JYKUMHCQ.js +705 -0
  74. package/dist/chunk-K3W6BF5C.js +283 -0
  75. package/dist/chunk-K45LHSCI.js +194 -0
  76. package/dist/chunk-K53E2PTW.js +1289 -0
  77. package/dist/chunk-K5UJD6MM.js +39 -0
  78. package/dist/chunk-KGP3UQGJ.js +200 -0
  79. package/dist/chunk-KKRXONXG.js +43 -0
  80. package/dist/chunk-KWJXCL2X.js +103 -0
  81. package/dist/chunk-L75H5B3B.js +446 -0
  82. package/dist/chunk-LLCGGVSW.js +108 -0
  83. package/dist/chunk-LZCCBLRC.js +57 -0
  84. package/dist/chunk-LZDLYSUN.js +197 -0
  85. package/dist/chunk-MATCRH3M.js +667 -0
  86. package/dist/chunk-MEHBW2SP.js +132 -0
  87. package/dist/chunk-MUXNDNMZ.js +659 -0
  88. package/dist/chunk-MWMW53WW.js +7346 -0
  89. package/dist/chunk-MZDPF35R.js +45 -0
  90. package/dist/chunk-MZKYVIWW.js +188 -0
  91. package/dist/chunk-O2QJDRWP.js +362 -0
  92. package/dist/chunk-O3HSB2YL.js +693 -0
  93. package/dist/chunk-OEMFEL26.js +891 -0
  94. package/dist/chunk-OH3YYA3B.js +15 -0
  95. package/dist/chunk-OPC4DQD6.js +634 -0
  96. package/dist/chunk-ORRNGQDV.js +207 -0
  97. package/dist/chunk-P4JS3MH5.js +165 -0
  98. package/dist/chunk-P7GTE4FX.js +308 -0
  99. package/dist/chunk-PAQVETLA.js +962 -0
  100. package/dist/chunk-PFZJMXIY.js +146 -0
  101. package/dist/chunk-PGEFOTJB.js +1974 -0
  102. package/dist/chunk-PJ5H5B7A.js +3151 -0
  103. package/dist/chunk-PMUUAABD.js +604 -0
  104. package/dist/chunk-Q32C6AWI.js +236 -0
  105. package/dist/chunk-QGIC5SX5.js +139 -0
  106. package/dist/chunk-QLAGXTTV.js +482 -0
  107. package/dist/chunk-QLKCCC2J.js +573 -0
  108. package/dist/chunk-QWUSS2QP.js +3630 -0
  109. package/dist/chunk-QYSAZMSH.js +47 -0
  110. package/dist/chunk-R5NRX5N4.js +123 -0
  111. package/dist/chunk-RAUOKUZV.js +1572 -0
  112. package/dist/chunk-RBES4TCZ.js +302 -0
  113. package/dist/chunk-RFCKPS2V.js +26 -0
  114. package/dist/chunk-RFULVPBX.js +318 -0
  115. package/dist/chunk-RKFNU5UA.js +404 -0
  116. package/dist/chunk-RM3XJX7P.js +1148 -0
  117. package/dist/chunk-RNLAPBJL.js +386 -0
  118. package/dist/chunk-RPMNIFRY.js +65 -0
  119. package/dist/chunk-RRZFRIJP.js +42 -0
  120. package/dist/chunk-RXI7K4J5.js +4493 -0
  121. package/dist/chunk-SER7RRAE.js +4271 -0
  122. package/dist/chunk-STC6CWUZ.js +402 -0
  123. package/dist/chunk-TEHVMHOK.js +97 -0
  124. package/dist/chunk-TOPICHGR.js +33 -0
  125. package/dist/chunk-U3TPUXOQ.js +2653 -0
  126. package/dist/chunk-UB33F3YW.js +709 -0
  127. package/dist/chunk-UDAK6GR2.js +175 -0
  128. package/dist/chunk-USBBEKHW.js +177 -0
  129. package/dist/chunk-V4ZKOKRB.js +13433 -0
  130. package/dist/chunk-W5RM7YAH.js +78 -0
  131. package/dist/chunk-W7KNI3F5.js +215 -0
  132. package/dist/chunk-WFTSK7N3.js +637 -0
  133. package/dist/chunk-WJWNZXRM.js +395 -0
  134. package/dist/chunk-WLHX3MM5.js +63 -0
  135. package/dist/chunk-WS4FOGLY.js +686 -0
  136. package/dist/chunk-WTZVSMQZ.js +52 -0
  137. package/dist/chunk-WWRV5RJI.js +165 -0
  138. package/dist/chunk-X6FLVUM5.js +141 -0
  139. package/dist/chunk-XC5POIL4.js +68 -0
  140. package/dist/chunk-XTLJDC2X.js +1013 -0
  141. package/dist/chunk-XW2UZICE.js +372 -0
  142. package/dist/chunk-Y3JU5RPK.js +8 -0
  143. package/dist/chunk-YGIV24MF.js +1018 -0
  144. package/dist/chunk-YJCCMYYT.js +125 -0
  145. package/dist/chunk-YKIIWURD.js +36 -0
  146. package/dist/chunk-YQ3GFEUY.js +341 -0
  147. package/dist/chunk-YXANQGCX.js +179 -0
  148. package/dist/chunk-YXFKLMX2.js +222 -0
  149. package/dist/chunk-ZST3FRCV.js +132 -0
  150. package/dist/cli/index.js +40 -40
  151. package/dist/clio-BPBAPZGA.js +26 -0
  152. package/dist/code-nav-KBQ3RIFK.js +686 -0
  153. package/dist/components-6DKAXWFN.js +674 -0
  154. package/dist/config-FWL5JK2H.js +270 -0
  155. package/dist/config-graph-ACDB26L2.js +156 -0
  156. package/dist/configure-ZIZ4YV62.js +85 -0
  157. package/dist/context-EZZPT2ZV.js +1074 -0
  158. package/dist/context-VIL5MFRH.js +282 -0
  159. package/dist/context-Z3GOBHDK.js +344 -0
  160. package/dist/context-clear-ZPB3L7MN.js +188 -0
  161. package/dist/context-index-W6A4V7OC.js +120 -0
  162. package/dist/context-map-DKL3QT6D.js +555 -0
  163. package/dist/context-working-set-2GLBVF7L.js +1559 -0
  164. package/dist/detail-VSBWYSGZ.js +119 -0
  165. package/dist/dispatch-runner-EEEHGKX4.js +2442 -0
  166. package/dist/docs-VMMWFVHL.js +101 -0
  167. package/dist/doctor-V5L4IQGP.js +812 -0
  168. package/dist/eval-VJYJ2BV3.js +5050 -0
  169. package/dist/eval-inventory-CX24K2JT.js +260 -0
  170. package/dist/evals-J2H5V6DD.js +104 -0
  171. package/dist/evidence-POWAEBEW.js +229 -0
  172. package/dist/evidence-XCCCLS36.js +242 -0
  173. package/dist/evidence-Y35YSXH6.js +388 -0
  174. package/dist/evolve-GPG72VB6.js +613 -0
  175. package/dist/extensions-YIZ7W3DA.js +308 -0
  176. package/dist/fleet-2MDCQ2VK.js +264 -0
  177. package/dist/fleet-W2AF3TOJ.js +919 -0
  178. package/dist/fleet-commands-WS56G26H.js +75 -0
  179. package/dist/fleet-decisions-MYGZ3JW7.js +52 -0
  180. package/dist/fleet-graph-ELTBXBAV.js +136 -0
  181. package/dist/fleet-inspect-45IK73L4.js +308 -0
  182. package/dist/fleet-preflight-T5NCZKHE.js +22 -0
  183. package/dist/fleet-validate-VG4JBLA4.js +91 -0
  184. package/dist/fleet-verify-VTSABAYO.js +206 -0
  185. package/dist/fleet-view-XC7WMKSS.js +123 -0
  186. package/dist/init-VTJNNTIP.js +329 -0
  187. package/dist/install-6PIF6F6W.js +19 -0
  188. package/dist/interop-IU6BNA7C.js +246 -0
  189. package/dist/inventory-QPQUTUUZ.js +123 -0
  190. package/dist/library-HUTAS57T.js +492 -0
  191. package/dist/library-LF7DLU6S.js +306 -0
  192. package/dist/library-Q3NWL5CM.js +75 -0
  193. package/dist/library-import-PPW4YUC5.js +183 -0
  194. package/dist/library-inventory-DIRVFRZU.js +56 -0
  195. package/dist/library-validation-XHUZ3INE.js +42 -0
  196. package/dist/memory-Z2LSKNV6.js +516 -0
  197. package/dist/models-3FTREYPY.js +302 -0
  198. package/dist/monitor-HF2MQRB3.js +781 -0
  199. package/dist/orchestrator-UYPA6W4S.js +41502 -0
  200. package/dist/panes-736XB73K.js +74 -0
  201. package/dist/panes-C4P3PIWT.js +103 -0
  202. package/dist/paths-JQ4QYIYB.js +67 -0
  203. package/dist/preload-XSLRYH3Y.js +120 -0
  204. package/dist/reset-V7QSPZYE.js +345 -0
  205. package/dist/resources-OJGDFHYT.js +181 -0
  206. package/dist/run-T354SMDW.js +892 -0
  207. package/dist/settings-MWZXO6RV.js +72 -0
  208. package/dist/share-Y5ZKJPND.js +293 -0
  209. package/dist/skills-4GLZC4LN.js +100 -0
  210. package/dist/skills-eval-L5T7GODM.js +1074 -0
  211. package/dist/skills-inventory-LASKXEZI.js +138 -0
  212. package/dist/slash-commands-OIMRU36D.js +95 -0
  213. package/dist/steer-KMAM2Y2C.js +77 -0
  214. package/dist/support-AWC3XKPX.js +38 -0
  215. package/dist/system-CD75NYBU.js +116 -0
  216. package/dist/targets-VSZX2J2S.js +1116 -0
  217. package/dist/tasks-AN567LYH.js +36 -0
  218. package/dist/terminal-lease-6KTWNHVY.js +418 -0
  219. package/dist/tools-AGRK3V5J.js +28 -0
  220. package/dist/trace-P4MQZD33.js +524 -0
  221. package/dist/tui-primitives-A6MUW32V.js +18 -0
  222. package/dist/uninstall-BRUTEPIC.js +432 -0
  223. package/dist/upgrade-SBCGHQGJ.js +307 -0
  224. package/dist/usage-BIDVTO6V.js +1061 -0
  225. package/dist/verifiers-LTGCAMXS.js +630 -0
  226. package/dist/verify-OZU4LLNP.js +30 -0
  227. package/dist/web/client/THIRD_PARTY_LICENSES.md +1809 -0
  228. package/dist/web/client/assets/abnfDiagram-VCTEODGH-C5wfoHm3.js +1 -0
  229. package/dist/web/client/assets/arc-oH91sfLl.js +1 -0
  230. package/dist/web/client/assets/architecture-7GRP2DOG-EGozsYEO.js +1 -0
  231. package/dist/web/client/assets/architectureDiagram-5GKGNRK7-z9FokbJl.js +36 -0
  232. package/dist/web/client/assets/array-BifhSqXX.js +1 -0
  233. package/dist/web/client/assets/atkinson-hyperlegible-next-latin-ext-wght-normal-C6vrW8VD.woff2 +0 -0
  234. package/dist/web/client/assets/atkinson-hyperlegible-next-latin-wght-normal-BcXVPD7q.woff2 +0 -0
  235. package/dist/web/client/assets/blockDiagram-I7D4REHJ-wi0_CYHL.js +129 -0
  236. package/dist/web/client/assets/c4Diagram-7LVT6UL2-DV7NYc2W.js +38 -0
  237. package/dist/web/client/assets/channel-CiUWbHN9.js +1 -0
  238. package/dist/web/client/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  239. package/dist/web/client/assets/chunk-4HAMMTFA-Bhsegh3F.js +62 -0
  240. package/dist/web/client/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  241. package/dist/web/client/assets/chunk-75Z2AOVW-RQCckcQG.js +2 -0
  242. package/dist/web/client/assets/chunk-DU6HZSFF-C5USiOAy.js +125 -0
  243. package/dist/web/client/assets/chunk-F27PBJKO-BcNqv2x1.js +1 -0
  244. package/dist/web/client/assets/chunk-FOHPRMQF-CoA4358r.js +161 -0
  245. package/dist/web/client/assets/chunk-GMAD6QVW-Bq8JWiZT.js +72 -0
  246. package/dist/web/client/assets/chunk-GVQU2GXP-DbchrAeJ.js +1 -0
  247. package/dist/web/client/assets/chunk-IMKFNOWR-DrpvjocK.js +231 -0
  248. package/dist/web/client/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  249. package/dist/web/client/assets/chunk-L3NEJ4N5-DHLmTnCe.js +1 -0
  250. package/dist/web/client/assets/chunk-OSK3NFVY-CsRbtN9n.js +10 -0
  251. package/dist/web/client/assets/chunk-P2QGCYS3-aqPbxoMh.js +1 -0
  252. package/dist/web/client/assets/chunk-POPQ4Y6H-Dl5vw0h0.js +1 -0
  253. package/dist/web/client/assets/chunk-PWAF6VOD-D7OBRSdO.js +1 -0
  254. package/dist/web/client/assets/chunk-SHT3W25Y-CdKCIwuB.js +168 -0
  255. package/dist/web/client/assets/chunk-SVP7TREG-B94Nu_1-.js +88 -0
  256. package/dist/web/client/assets/chunk-TICWLB2K-jjRQI_hk.js +206 -0
  257. package/dist/web/client/assets/chunk-XXDRQBXY-azkbKE37.js +1 -0
  258. package/dist/web/client/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  259. package/dist/web/client/assets/classDiagram-ZZMXUADV-CMODalmo.js +1 -0
  260. package/dist/web/client/assets/classDiagram-v2-VYDZK3BY-CMODalmo.js +1 -0
  261. package/dist/web/client/assets/commit-mono-latin-400-normal-s0S3qwFW.woff +0 -0
  262. package/dist/web/client/assets/commit-mono-latin-400-normal-wzhe4RuD.woff2 +0 -0
  263. package/dist/web/client/assets/cose-bilkent-JH36ORCC-RbQL23qS.js +1 -0
  264. package/dist/web/client/assets/cynefin-OW5HDTMX--i9RDU5f.js +1 -0
  265. package/dist/web/client/assets/cynefinDiagram-5FMLGOSQ-cRcvyBdp.js +62 -0
  266. package/dist/web/client/assets/cytoscape.esm-c2aL46s-.js +321 -0
  267. package/dist/web/client/assets/dagre-C-rnJpZF.js +1 -0
  268. package/dist/web/client/assets/dagre-GXQ25YYZ-C9mZmAPe.js +4 -0
  269. package/dist/web/client/assets/defaultLocale-BFoDCU3G.js +1 -0
  270. package/dist/web/client/assets/diagram-S7CK7UJ4-Oj_zlLDY.js +30 -0
  271. package/dist/web/client/assets/diagram-UQ7AKVKN-BWKbbfcR.js +41 -0
  272. package/dist/web/client/assets/diagram-VSXAHHWV-C3N3f7DO.js +3 -0
  273. package/dist/web/client/assets/diagram-VX7I27RA-CtDKDAWe.js +24 -0
  274. package/dist/web/client/assets/diagram-Z3DM3KII-B8bkBRCz.js +24 -0
  275. package/dist/web/client/assets/dist-D0_q-A2b.js +1 -0
  276. package/dist/web/client/assets/ebnfDiagram-PWID7BFC-CskW-Whx.js +1 -0
  277. package/dist/web/client/assets/erDiagram-RLTQ6QDP-C-83cgCW.js +99 -0
  278. package/dist/web/client/assets/eventmodeling-NTZA5JFV-DjVq8wKU.js +1 -0
  279. package/dist/web/client/assets/flowDiagram-HODETNUW-BUiCBGXt.js +1 -0
  280. package/dist/web/client/assets/ganttDiagram-EL5Y4UJY-B2lb8lvF.js +292 -0
  281. package/dist/web/client/assets/gitGraph-4MIJSDKK-B40cQtBE.js +1 -0
  282. package/dist/web/client/assets/gitGraphDiagram-WWUBYQGX-CH-7P7Di.js +106 -0
  283. package/dist/web/client/assets/graphlib-DS17s2tU.js +1 -0
  284. package/dist/web/client/assets/index-Dsi52apB.css +1 -0
  285. package/dist/web/client/assets/index-FSIC94pi.js +83 -0
  286. package/dist/web/client/assets/info-A6RAGUB7-eCCE9D_Q.js +1 -0
  287. package/dist/web/client/assets/infoDiagram-27XIBGKW-DRnvqMjM.js +2 -0
  288. package/dist/web/client/assets/init-C-OQMol4.js +1 -0
  289. package/dist/web/client/assets/ishikawaDiagram-5VMMS53U-DBA_55wp.js +70 -0
  290. package/dist/web/client/assets/journeyDiagram-3NMN7TZE-C-ewpNl7.js +139 -0
  291. package/dist/web/client/assets/kanban-definition-UXKFOSKX-B1taGsu0.js +89 -0
  292. package/dist/web/client/assets/katex-ZlcWpGUi.js +257 -0
  293. package/dist/web/client/assets/line-lZ0kyxDI.js +1 -0
  294. package/dist/web/client/assets/linear-DIc8FgZj.js +1 -0
  295. package/dist/web/client/assets/mermaid-parser.core-SXolxpXw.js +7 -0
  296. package/dist/web/client/assets/mermaid.core-DXgQtkNg.js +44 -0
  297. package/dist/web/client/assets/mindmap-definition-YA3MSWOX-DXJas9K7.js +96 -0
  298. package/dist/web/client/assets/newsreader-latin-ext-wght-normal-C-3rgBeH.woff2 +0 -0
  299. package/dist/web/client/assets/newsreader-latin-wght-normal-CCVVNp6i.woff2 +0 -0
  300. package/dist/web/client/assets/newsreader-vietnamese-wght-normal-Czsa-EzN.woff2 +0 -0
  301. package/dist/web/client/assets/ordinal-BDEzSJ7C.js +1 -0
  302. package/dist/web/client/assets/packet-AYTQ26CC-OqVl_07o.js +1 -0
  303. package/dist/web/client/assets/path-fybaL0A-.js +1 -0
  304. package/dist/web/client/assets/pegDiagram-XKGWAZYB-CPE_zdfN.js +1 -0
  305. package/dist/web/client/assets/pie-WAS4IAKB-DAxnMBLe.js +1 -0
  306. package/dist/web/client/assets/pieDiagram-E7YTZNPT-Uwjpufxv.js +39 -0
  307. package/dist/web/client/assets/prism-bash-D6zCJ74D.js +1 -0
  308. package/dist/web/client/assets/prism-c-04YixN25.js +1 -0
  309. package/dist/web/client/assets/prism-clike-DapgWyxx.js +1 -0
  310. package/dist/web/client/assets/prism-core-BngLtbUd.js +1 -0
  311. package/dist/web/client/assets/prism-cpp-C-lJbC-6.js +1 -0
  312. package/dist/web/client/assets/prism-css-CPgOzxXp.js +1 -0
  313. package/dist/web/client/assets/prism-diff-BF8m0_mq.js +3 -0
  314. package/dist/web/client/assets/prism-docker-DkT6yOFj.js +1 -0
  315. package/dist/web/client/assets/prism-fortran-Be5x3y1V.js +1 -0
  316. package/dist/web/client/assets/prism-go-C_8qAH5n.js +1 -0
  317. package/dist/web/client/assets/prism-ini-BESK3y0r.js +1 -0
  318. package/dist/web/client/assets/prism-javascript-BnO-swvr.js +1 -0
  319. package/dist/web/client/assets/prism-json-Dp_-W-Hv.js +1 -0
  320. package/dist/web/client/assets/prism-jsx-D-D0NWtC.js +1 -0
  321. package/dist/web/client/assets/prism-julia-DIjOgiAV.js +1 -0
  322. package/dist/web/client/assets/prism-latex-DNMbqcH_.js +1 -0
  323. package/dist/web/client/assets/prism-makefile-CRKWLQ8l.js +1 -0
  324. package/dist/web/client/assets/prism-markdown-C0FPJ1Iz.js +1 -0
  325. package/dist/web/client/assets/prism-markup-Cp04rIa1.js +1 -0
  326. package/dist/web/client/assets/prism-matlab-D-nk08al.js +1 -0
  327. package/dist/web/client/assets/prism-python-CfiSVtM6.js +1 -0
  328. package/dist/web/client/assets/prism-r-QmNGR8LX.js +1 -0
  329. package/dist/web/client/assets/prism-rust-Bu9N8X3N.js +1 -0
  330. package/dist/web/client/assets/prism-shell-session-Be4UuYoM.js +1 -0
  331. package/dist/web/client/assets/prism-sql-CYhVDMEE.js +1 -0
  332. package/dist/web/client/assets/prism-toml-DKb54GAT.js +1 -0
  333. package/dist/web/client/assets/prism-tsx-p6J2Kc_4.js +1 -0
  334. package/dist/web/client/assets/prism-typescript-BMqONzxf.js +1 -0
  335. package/dist/web/client/assets/prism-yaml-C0JHu8gr.js +1 -0
  336. package/dist/web/client/assets/purify.es-ChwZkWde.js +3 -0
  337. package/dist/web/client/assets/quadrantDiagram-AXDQQJYC-Bjs4yjgs.js +7 -0
  338. package/dist/web/client/assets/radar-RG4KPBEZ-CuCKjHM3.js +1 -0
  339. package/dist/web/client/assets/railroad-74A4TZTK-CnQK-Cc1.js +1 -0
  340. package/dist/web/client/assets/railroad-abnf-HS5TGJTU-BcW01NZG.js +1 -0
  341. package/dist/web/client/assets/railroad-ebnf-LZEXJU2U-B7YCEDDd.js +1 -0
  342. package/dist/web/client/assets/railroad-peg-WCYAUIDC-DjNZbSTZ.js +1 -0
  343. package/dist/web/client/assets/railroadDiagram-O6MQD6OU-BDDIPNLL.js +1 -0
  344. package/dist/web/client/assets/requirementDiagram-BXWQKSXE-B5Ydyxc1.js +84 -0
  345. package/dist/web/client/assets/rough.esm-Dy-Kn_BL.js +1 -0
  346. package/dist/web/client/assets/sankeyDiagram-P5KCCOFB-Bw2Qym75.js +40 -0
  347. package/dist/web/client/assets/sequenceDiagram-WJ2MYXX4-BZf36nO0.js +162 -0
  348. package/dist/web/client/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
  349. package/dist/web/client/assets/src-yeptRXpt.js +1 -0
  350. package/dist/web/client/assets/stateDiagram-D77RDMKH-DnH6JRkp.js +1 -0
  351. package/dist/web/client/assets/stateDiagram-v2-MP3YSRHH-C7QtHeK4.js +1 -0
  352. package/dist/web/client/assets/swimlanes-42K2YHIH-D9PZmtZg.js +1 -0
  353. package/dist/web/client/assets/swimlanesDiagram-VR7AAH4N-CBZlPFky.js +8 -0
  354. package/dist/web/client/assets/timeline-definition-24CTP7MA-CrkZZBo7.js +120 -0
  355. package/dist/web/client/assets/treeView-Q6P3EWNA-C9zDShoC.js +1 -0
  356. package/dist/web/client/assets/treemap-WGGIJYW6-B-plj9yK.js +1 -0
  357. package/dist/web/client/assets/vennDiagram-4TSXK5OY-VeOdaphN.js +34 -0
  358. package/dist/web/client/assets/wardley-WFR3VGLG-Wl1P_m6L.js +1 -0
  359. package/dist/web/client/assets/wardleyDiagram-VM6X3IG4-B85-R9t2.js +78 -0
  360. package/dist/web/client/assets/xychartDiagram-S5SC5T6Z-BrD8OW8m.js +7 -0
  361. package/dist/web/client/clio-coder-logo.webp +0 -0
  362. package/dist/web/client/icon-192.png +0 -0
  363. package/dist/web/client/icon-512.png +0 -0
  364. package/dist/web/client/index.html +4 -0
  365. package/dist/web/client/manifest.webmanifest +15 -0
  366. package/dist/web/client/offline.css +55 -0
  367. package/dist/web/client/offline.html +5 -0
  368. package/dist/web/client/offline.js +27 -0
  369. package/dist/web/client/sw.js +34 -0
  370. package/dist/web/ops-worker.js +37 -0
  371. package/dist/web/reads-worker.js +1726 -0
  372. package/dist/web/server.js +8499 -0
  373. package/dist/web-EU6ATJWA.js +13 -0
  374. package/dist/web-fetch-U22Q7HV4.js +788 -0
  375. package/dist/wiki-generate-LZRLFG6I.js +623 -0
  376. package/dist/with-panes-X5CZOGML.js +628 -0
  377. package/dist/worker/entry.js +300 -93
  378. package/docs/README.md +58 -14
  379. package/docs/architecture/acp.md +5 -9
  380. package/docs/architecture/alcf-provider.md +0 -3
  381. package/docs/architecture/architecture.md +8 -10
  382. package/docs/architecture/artifact-placement.md +0 -3
  383. package/docs/architecture/artifact-versions.md +3 -6
  384. package/docs/architecture/capacity-and-scheduling.md +0 -3
  385. package/docs/architecture/context-engine.md +35 -4
  386. package/docs/architecture/context-working-set.md +0 -3
  387. package/docs/architecture/dispatch-architecture-rationale.md +0 -3
  388. package/docs/architecture/dispatch-typed-intent.md +0 -3
  389. package/docs/architecture/evidence-and-memory.md +0 -3
  390. package/docs/architecture/library.md +30 -0
  391. package/docs/architecture/middleware-and-components.md +1 -4
  392. package/docs/architecture/model-catalog.md +21 -4
  393. package/docs/architecture/observability.md +0 -3
  394. package/docs/architecture/pi-boundary.md +23 -8
  395. package/docs/architecture/prompt-envelope-and-tools.md +6 -9
  396. package/docs/architecture/provider-adapter-cookbook.md +1 -4
  397. package/docs/architecture/safety-model.md +21 -5
  398. package/docs/architecture/session-lifecycle.md +12 -4
  399. package/docs/architecture/time-conventions.md +0 -3
  400. package/docs/architecture/trace-store.md +28 -20
  401. package/docs/architecture/tui-design.md +108 -12
  402. package/docs/architecture/worker-context.md +104 -0
  403. package/docs/architecture/worker-dispatch-mechanics.md +1 -4
  404. package/docs/guide/authoring-plugins.md +158 -0
  405. package/docs/guide/built-in-agents.md +5 -8
  406. package/docs/guide/commands-and-modes.md +162 -61
  407. package/docs/guide/configuration-and-targets.md +198 -5
  408. package/docs/guide/configuration-reference.md +36 -38
  409. package/docs/guide/environment-variables.md +2 -5
  410. package/docs/guide/exit-codes-and-output.md +1 -4
  411. package/docs/guide/extensions-and-sharing.md +92 -55
  412. package/docs/guide/fleet-dispatch.md +31 -7
  413. package/docs/guide/glossary.md +1 -4
  414. package/docs/guide/harness-extensions.md +289 -0
  415. package/docs/guide/installation-and-lifecycle.md +10 -13
  416. package/docs/guide/interop.md +241 -0
  417. package/docs/guide/panes-and-files.md +3 -6
  418. package/docs/guide/plugins.md +77 -0
  419. package/docs/guide/proactive-memory.md +0 -3
  420. package/docs/guide/resource-library.md +109 -45
  421. package/docs/guide/skills-marketplace.md +34 -73
  422. package/docs/guide/tool-usage.md +19 -10
  423. package/docs/guide/troubleshooting.md +1 -4
  424. package/docs/history/config-knobs-audit.md +0 -3
  425. package/docs/history/release-cut-checklist.md +0 -3
  426. package/docs/process/development-pipeline.md +14 -17
  427. package/docs/process/documentation-coverage.md +31 -4
  428. package/docs/process/documentation-guide.md +28 -27
  429. package/docs/process/eval-runner.md +8 -6
  430. package/docs/process/evals-internal.md +0 -3
  431. package/docs/process/evolution.md +0 -3
  432. package/docs/process/fleet-demo-runbook.md +0 -3
  433. package/docs/process/git-commit-provenance.md +0 -3
  434. package/docs/process/performance-methodology.md +2 -5
  435. package/docs/process/release-cut-checklist.md +114 -217
  436. package/docs/process/scientific-validation.md +23 -3
  437. package/evals/scalar-decision-machinery.ts +1 -1
  438. package/examples/extensions/README.md +67 -0
  439. package/examples/extensions/lab-status/clio-coder-extension.json +14 -0
  440. package/examples/extensions/lab-status/extension.mjs +68 -0
  441. package/examples/extensions/lab-status/jobs.synthetic.json +9 -0
  442. package/examples/extensions/measurements/clio-coder-extension.json +28 -0
  443. package/examples/extensions/measurements/summarize.cjs +23 -0
  444. package/library/README.md +109 -0
  445. package/library/_authoring/templates/agent/README.md +28 -0
  446. package/library/_authoring/templates/agent/agents/benchmark-scout.md +30 -0
  447. package/library/_authoring/templates/agent/plugin.json +23 -0
  448. package/library/_authoring/templates/fleet/README.md +29 -0
  449. package/library/_authoring/templates/fleet/fleets/pipeline-review.md +31 -0
  450. package/library/_authoring/templates/fleet/plugin.json +23 -0
  451. package/library/_authoring/templates/plugin/README.md +37 -0
  452. package/library/_authoring/templates/plugin/agents/data-curator.md +31 -0
  453. package/library/_authoring/templates/plugin/assets/curation-guide.md +22 -0
  454. package/library/_authoring/templates/plugin/plugin.json +42 -0
  455. package/library/_authoring/templates/plugin/prompts/inspect-dataset.md +15 -0
  456. package/library/_authoring/templates/plugin/skills/dataset-curation/SKILL.md +36 -0
  457. package/library/_authoring/templates/plugin/skills/dataset-curation/evals.md +17 -0
  458. package/library/_authoring/templates/prompt/README.md +28 -0
  459. package/library/_authoring/templates/prompt/plugin.json +23 -0
  460. package/library/_authoring/templates/prompt/prompts/paper-summary.md +26 -0
  461. package/library/_authoring/templates/skill/README.md +24 -0
  462. package/library/_authoring/templates/skill/SKILL.md +39 -0
  463. package/library/_authoring/templates/skill/evals.md +30 -0
  464. package/library/_authoring/templates/skill/plugin.json +23 -0
  465. package/library/agents/README.md +7 -0
  466. package/library/fleets/README.md +7 -0
  467. package/library/plugins/materio/README.md +137 -0
  468. package/library/plugins/materio/ai.iowarp.clio/agents/materio-lab-definer.md +208 -0
  469. package/library/plugins/materio/ai.iowarp.clio/agents/materio-literature-reviewer.md +308 -0
  470. package/library/plugins/materio/ai.iowarp.clio/agents/materio-research-explorer.md +249 -0
  471. package/library/plugins/materio/ai.iowarp.clio/agents/materio-task-executor.md +416 -0
  472. package/library/plugins/materio/ai.iowarp.clio/agents/materio-task-verifier.md +60 -0
  473. package/library/plugins/materio/ai.iowarp.clio/agents/materio-workflow-planner.md +238 -0
  474. package/library/plugins/materio/ai.iowarp.clio/fleets/materio-execute-task.md +50 -0
  475. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/add-task.md +66 -0
  476. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/archive-task.md +65 -0
  477. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/checkpoint.md +26 -0
  478. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/define-research-tasks.md +230 -0
  479. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/define-virtual-lab.md +181 -0
  480. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/execute-task.md +292 -0
  481. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/help.md +129 -0
  482. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/identify-research.md +206 -0
  483. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/literature-review.md +201 -0
  484. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/pause-research.md +12 -0
  485. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/progress.md +105 -0
  486. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/remove-task.md +63 -0
  487. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/resume-research.md +64 -0
  488. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/settings.md +16 -0
  489. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/status.md +92 -0
  490. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/upload-data.md +104 -0
  491. package/library/plugins/materio/ai.iowarp.clio/prompts/materio/wtfp.md +145 -0
  492. package/library/plugins/materio/ai.iowarp.clio/references/execution.md +56 -0
  493. package/library/plugins/materio/ai.iowarp.portability/provenance.json +9 -0
  494. package/library/plugins/materio/assets/actions/add-task.md +86 -0
  495. package/library/plugins/materio/assets/actions/archive-task.md +84 -0
  496. package/library/plugins/materio/assets/actions/checkpoint.md +47 -0
  497. package/library/plugins/materio/assets/actions/define-research-tasks.md +228 -0
  498. package/library/plugins/materio/assets/actions/define-virtual-lab.md +179 -0
  499. package/library/plugins/materio/assets/actions/execute-task.md +290 -0
  500. package/library/plugins/materio/assets/actions/help.md +140 -0
  501. package/library/plugins/materio/assets/actions/identify-research.md +204 -0
  502. package/library/plugins/materio/assets/actions/literature-review.md +199 -0
  503. package/library/plugins/materio/assets/actions/pause-research.md +34 -0
  504. package/library/plugins/materio/assets/actions/progress.md +125 -0
  505. package/library/plugins/materio/assets/actions/remove-task.md +82 -0
  506. package/library/plugins/materio/assets/actions/resume-research.md +84 -0
  507. package/library/plugins/materio/assets/actions/settings.md +38 -0
  508. package/library/plugins/materio/assets/actions/status.md +112 -0
  509. package/library/plugins/materio/assets/actions/upload-data.md +123 -0
  510. package/library/plugins/materio/assets/actions/wtfp.md +179 -0
  511. package/library/plugins/materio/assets/references/research-domains.md +134 -0
  512. package/library/plugins/materio/assets/references/research-policy.md +77 -0
  513. package/library/plugins/materio/assets/references/traditional-workflows.md +146 -0
  514. package/library/plugins/materio/assets/scripts/check_physics.py +271 -0
  515. package/library/plugins/materio/assets/scripts/check_scripts.py +248 -0
  516. package/library/plugins/materio/assets/scripts/project_plugin.py +165 -0
  517. package/library/plugins/materio/assets/scripts/research_state.py +400 -0
  518. package/library/plugins/materio/assets/scripts/verify_citations.py +616 -0
  519. package/library/plugins/materio/assets/templates/RESEARCH.md +39 -0
  520. package/library/plugins/materio/assets/templates/VIRTUAL-LAB.md +120 -0
  521. package/library/plugins/materio/assets/templates/WORKFLOW.md +42 -0
  522. package/library/plugins/materio/assets/templates/config.json +5 -0
  523. package/library/plugins/materio/evals/scripts.yaml +29 -0
  524. package/library/plugins/materio/plugin.json +530 -0
  525. package/library/plugins/materio/skills/materio-lab-definer/SKILL.md +74 -0
  526. package/library/plugins/materio/skills/materio-literature-reviewer/SKILL.md +64 -0
  527. package/library/plugins/materio/skills/materio-research-explorer/SKILL.md +74 -0
  528. package/library/plugins/materio/skills/materio-task-executor/SKILL.md +214 -0
  529. package/library/plugins/materio/skills/materio-task-verifier/SKILL.md +46 -0
  530. package/library/plugins/materio/skills/materio-workflow-planner/SKILL.md +79 -0
  531. package/library/plugins/materio/tests/test_check_physics.py +139 -0
  532. package/library/plugins/materio/tests/test_check_scripts.py +140 -0
  533. package/library/plugins/materio/tests/test_research_state.py +291 -0
  534. package/library/plugins/materio/tests/test_verify_citations.py +337 -0
  535. package/library/prompts/README.md +7 -0
  536. package/library/registry.yaml +921 -0
  537. package/library/skills/README.md +120 -0
  538. package/library/skills/coding/ast-grep/SKILL.md +213 -0
  539. package/library/skills/coding/ast-grep/evals.md +82 -0
  540. package/library/skills/coding/ast-grep/plugin.json +23 -0
  541. package/library/skills/coding/coding-standards/SKILL.md +164 -0
  542. package/library/skills/coding/coding-standards/evals.md +57 -0
  543. package/library/skills/coding/coding-standards/plugin.json +23 -0
  544. package/library/skills/coding/prototype/SKILL.md +151 -0
  545. package/library/skills/coding/prototype/evals.md +61 -0
  546. package/library/skills/coding/prototype/plugin.json +23 -0
  547. package/library/skills/coding/tdd/SKILL.md +134 -0
  548. package/library/skills/coding/tdd/evals.md +61 -0
  549. package/library/skills/coding/tdd/plugin.json +23 -0
  550. package/library/skills/context/context-handoff/SKILL.md +176 -0
  551. package/library/skills/context/context-handoff/evals.md +101 -0
  552. package/library/skills/context/context-handoff/plugin.json +23 -0
  553. package/library/skills/context/context-prime/SKILL.md +131 -0
  554. package/library/skills/context/context-prime/evals.md +99 -0
  555. package/library/skills/context/context-prime/plugin.json +23 -0
  556. package/library/skills/git/branch-closeout/SKILL.md +132 -0
  557. package/library/skills/git/branch-closeout/plugin.json +23 -0
  558. package/library/skills/git/file-ticket/SKILL.md +126 -0
  559. package/library/skills/git/file-ticket/plugin.json +23 -0
  560. package/library/skills/git/fix-issue/SKILL.md +136 -0
  561. package/library/skills/git/fix-issue/plugin.json +23 -0
  562. package/library/skills/git/resolve-merge-conflicts/SKILL.md +151 -0
  563. package/library/skills/git/resolve-merge-conflicts/evals.md +85 -0
  564. package/library/skills/git/resolve-merge-conflicts/plugin.json +23 -0
  565. package/library/skills/git/ship/SKILL.md +134 -0
  566. package/library/skills/git/ship/plugin.json +23 -0
  567. package/library/skills/git/worktree-create/SKILL.md +127 -0
  568. package/library/skills/git/worktree-create/plugin.json +23 -0
  569. package/library/skills/git/worktree-merge/SKILL.md +147 -0
  570. package/library/skills/git/worktree-merge/plugin.json +23 -0
  571. package/library/skills/meta/clio-coder-dev/SKILL.md +101 -0
  572. package/library/skills/meta/clio-coder-dev/evals.md +46 -0
  573. package/library/skills/meta/clio-coder-dev/plugin.json +23 -0
  574. package/library/skills/meta/clio-coder-test/SKILL.md +156 -0
  575. package/library/skills/meta/clio-coder-test/evals.md +62 -0
  576. package/library/skills/meta/clio-coder-test/plugin.json +23 -0
  577. package/library/skills/meta/clio-coder-test/references/test-map.md +97 -0
  578. package/library/skills/meta/credentials/SKILL.md +132 -0
  579. package/library/skills/meta/credentials/evals.md +104 -0
  580. package/library/skills/meta/credentials/plugin.json +23 -0
  581. package/library/skills/meta/find-skills/SKILL.md +85 -0
  582. package/library/skills/meta/find-skills/evals.md +65 -0
  583. package/library/skills/meta/find-skills/plugin.json +23 -0
  584. package/library/skills/meta/herdr/SKILL.md +133 -0
  585. package/library/skills/meta/herdr/evals.md +38 -0
  586. package/library/skills/meta/herdr/plugin.json +23 -0
  587. package/library/skills/meta/skill-craft/SKILL.md +139 -0
  588. package/library/skills/meta/skill-craft/evals.md +49 -0
  589. package/library/skills/meta/skill-craft/plugin.json +23 -0
  590. package/library/skills/planning/archify/SKILL.md +196 -0
  591. package/library/skills/planning/archify/plugin.json +23 -0
  592. package/library/skills/planning/architecture/SKILL.md +184 -0
  593. package/library/skills/planning/architecture/evals.md +101 -0
  594. package/library/skills/planning/architecture/plugin.json +23 -0
  595. package/library/skills/planning/backlog/SKILL.md +212 -0
  596. package/library/skills/planning/backlog/evals.md +185 -0
  597. package/library/skills/planning/backlog/plugin.json +23 -0
  598. package/library/skills/planning/prd/SKILL.md +129 -0
  599. package/library/skills/planning/prd/evals.md +103 -0
  600. package/library/skills/planning/prd/plugin.json +23 -0
  601. package/library/skills/planning/product-intent/SKILL.md +173 -0
  602. package/library/skills/planning/product-intent/evals.md +106 -0
  603. package/library/skills/planning/product-intent/plugin.json +23 -0
  604. package/library/skills/planning/tech-spec/SKILL.md +172 -0
  605. package/library/skills/planning/tech-spec/evals.md +120 -0
  606. package/library/skills/planning/tech-spec/plugin.json +23 -0
  607. package/library/skills/registry.yaml +144 -0
  608. package/library/skills/remote.yaml +13 -0
  609. package/library/skills/research/arxiv-literature/SKILL.md +168 -0
  610. package/library/skills/research/arxiv-literature/evals.md +108 -0
  611. package/library/skills/research/arxiv-literature/plugin.json +23 -0
  612. package/library/skills/research/experiment-protocol/SKILL.md +148 -0
  613. package/library/skills/research/experiment-protocol/evals.md +114 -0
  614. package/library/skills/research/experiment-protocol/plugin.json +23 -0
  615. package/library/skills/research/scientific-debugging/SKILL.md +149 -0
  616. package/library/skills/research/scientific-debugging/evals.md +156 -0
  617. package/library/skills/research/scientific-debugging/plugin.json +23 -0
  618. package/library/skills/research/scientific-modernization/SKILL.md +170 -0
  619. package/library/skills/research/scientific-modernization/evals.md +111 -0
  620. package/library/skills/research/scientific-modernization/plugin.json +23 -0
  621. package/library/skills/skill-marketplace.json +507 -0
  622. package/library/skills/workflow/cut-it/SKILL.md +153 -0
  623. package/library/skills/workflow/cut-it/evals.md +143 -0
  624. package/library/skills/workflow/cut-it/plugin.json +23 -0
  625. package/library/skills/workflow/design-council/SKILL.md +233 -0
  626. package/library/skills/workflow/design-council/evals.md +258 -0
  627. package/library/skills/workflow/design-council/plugin.json +23 -0
  628. package/library/skills/workflow/grill-me/SKILL.md +267 -0
  629. package/library/skills/workflow/grill-me/evals.md +231 -0
  630. package/library/skills/workflow/grill-me/plugin.json +23 -0
  631. package/library/skills/workflow/workflow-distiller/SKILL.md +204 -0
  632. package/library/skills/workflow/workflow-distiller/evals.md +233 -0
  633. package/library/skills/workflow/workflow-distiller/plugin.json +23 -0
  634. package/package.json +23 -14
  635. package/src/cli/agents.ts +1 -1
  636. package/src/cli/config-inspect.ts +1 -1
  637. package/src/cli/configure.ts +2 -2
  638. package/src/cli/docs.ts +65 -328
  639. package/src/cli/eval.ts +40 -6
  640. package/src/cli/extensions.ts +74 -8
  641. package/src/cli/fleet-preflight.ts +2 -0
  642. package/src/cli/fleet.ts +2 -0
  643. package/src/cli/index.ts +4 -4
  644. package/src/cli/interop-inspect.ts +61 -33
  645. package/src/cli/interop.ts +79 -9
  646. package/src/cli/library-import.ts +139 -0
  647. package/src/cli/library.ts +418 -120
  648. package/src/cli/run.ts +26 -9
  649. package/src/cli/skills-eval.ts +43 -6
  650. package/src/cli/skills-inventory.ts +6 -2
  651. package/src/cli/skills.ts +44 -491
  652. package/src/cli/trace.ts +4 -65
  653. package/src/cli/uninstall.ts +26 -0
  654. package/src/cli/usage.ts +3 -0
  655. package/src/cli/web.ts +79 -0
  656. package/src/core/bus-events.ts +8 -4
  657. package/src/core/config.ts +71 -0
  658. package/src/core/defaults.ts +1 -1
  659. package/src/core/domain-loader.ts +37 -28
  660. package/src/core/recent-models.ts +2 -2
  661. package/src/core/session-routing.ts +3 -3
  662. package/src/core/state-file-lock.ts +1 -1
  663. package/src/core/termination.ts +13 -9
  664. package/src/core/tool-names.ts +5 -0
  665. package/src/domains/agents/contract.ts +1 -1
  666. package/src/domains/agents/extension.ts +53 -9
  667. package/src/domains/agents/fleet-commands.ts +92 -1
  668. package/src/domains/agents/fleet-contract.ts +87 -19
  669. package/src/domains/agents/recipe.ts +5 -4
  670. package/src/domains/agents/registry.ts +80 -24
  671. package/src/domains/config/extension.ts +5 -4
  672. package/src/domains/config/keybindings.ts +155 -95
  673. package/src/domains/context/worker/contract.ts +91 -0
  674. package/src/domains/context/worker/pressure.ts +120 -0
  675. package/src/domains/context/worker/recall.ts +62 -0
  676. package/src/domains/context/worker/select.ts +164 -0
  677. package/src/domains/context/worker/snapshot.ts +35 -0
  678. package/src/domains/context/worker/store.ts +16 -0
  679. package/src/domains/context/working-set/replay/synthetic.ts +2 -1
  680. package/src/domains/dispatch/active-route-planner.ts +2 -0
  681. package/src/domains/dispatch/backoff.ts +1 -0
  682. package/src/domains/dispatch/code-step.ts +12 -2
  683. package/src/domains/dispatch/contract.ts +3 -0
  684. package/src/domains/dispatch/execution-plan.ts +2 -0
  685. package/src/domains/dispatch/extension.ts +184 -39
  686. package/src/domains/dispatch/fleet-plan.ts +10 -0
  687. package/src/domains/dispatch/fleet-run.ts +1 -0
  688. package/src/domains/dispatch/index.ts +1 -0
  689. package/src/domains/dispatch/orphan-recovery.ts +2 -0
  690. package/src/domains/dispatch/receipt-integrity.ts +7 -0
  691. package/src/domains/dispatch/state.ts +2 -2
  692. package/src/domains/dispatch/types.ts +7 -0
  693. package/src/domains/dispatch/validation.ts +12 -0
  694. package/src/domains/dispatch/workspace-checkpoint.ts +1 -1
  695. package/src/domains/eval/metrics/tracked.ts +22 -2
  696. package/src/domains/evidence/failure-attribution.ts +1 -0
  697. package/src/domains/evidence/trust-status.ts +22 -3
  698. package/src/domains/extensions/command-schema.ts +145 -0
  699. package/src/domains/extensions/command-tools.ts +15 -0
  700. package/src/domains/extensions/compatibility.ts +7 -0
  701. package/src/domains/extensions/contract.ts +0 -4
  702. package/src/domains/extensions/discovery.ts +69 -205
  703. package/src/domains/extensions/extension.ts +0 -4
  704. package/src/domains/extensions/index.ts +1 -5
  705. package/src/domains/extensions/manager.ts +1 -6
  706. package/src/domains/extensions/operator-commands.ts +29 -0
  707. package/src/domains/extensions/operator-runtime.ts +485 -0
  708. package/src/domains/extensions/public-api.ts +53 -0
  709. package/src/domains/extensions/runtime-child.mjs +114 -0
  710. package/src/domains/extensions/runtime-process.ts +306 -0
  711. package/src/domains/extensions/runtime-schema.ts +146 -0
  712. package/src/domains/extensions/snapshot-access.ts +21 -0
  713. package/src/domains/extensions/snapshot.ts +4 -32
  714. package/src/domains/extensions/state.ts +5 -83
  715. package/src/domains/extensions/types.ts +33 -34
  716. package/src/domains/interop/adopt.ts +546 -0
  717. package/src/domains/interop/detect.ts +50 -12
  718. package/src/domains/interop/foreign.ts +554 -0
  719. package/src/domains/interop/import.ts +277 -0
  720. package/src/domains/interop/index.ts +24 -0
  721. package/src/domains/interop/install.ts +6 -0
  722. package/src/domains/interop/inventory.ts +351 -0
  723. package/src/domains/interop/projection.ts +360 -0
  724. package/src/domains/interop/registry.ts +106 -3
  725. package/src/domains/interop/types.ts +51 -0
  726. package/src/domains/lifecycle/migrations/index.ts +0 -2
  727. package/src/domains/lifecycle/naming-resources.ts +1 -1
  728. package/src/domains/middleware/hooks.ts +2 -2
  729. package/src/domains/middleware/marketplace-offer.ts +1 -1
  730. package/src/domains/mux/contract.ts +1 -1
  731. package/src/domains/observability/background-memory-usage.ts +3 -0
  732. package/src/domains/observability/compaction-usage.ts +2 -0
  733. package/src/domains/observability/cost.ts +5 -0
  734. package/src/domains/observability/extension.ts +1 -0
  735. package/src/domains/observability/out-of-turn-usage.ts +2 -0
  736. package/src/domains/observability/trace-store.ts +65 -5
  737. package/src/domains/plugins/catalog.ts +204 -0
  738. package/src/domains/plugins/contract.ts +24 -0
  739. package/src/domains/plugins/discovery.ts +316 -0
  740. package/src/domains/plugins/extension.ts +40 -0
  741. package/src/domains/plugins/index.ts +77 -0
  742. package/src/domains/plugins/integrity.ts +6 -0
  743. package/src/domains/plugins/manifest.ts +3 -0
  744. package/src/domains/plugins/resources.ts +102 -0
  745. package/src/domains/plugins/state.ts +753 -0
  746. package/src/domains/plugins/types.ts +217 -0
  747. package/src/domains/prompts/extension.ts +4 -10
  748. package/src/domains/prompts/fragments/operating/skills.md +10 -10
  749. package/src/domains/providers/cache-deployment.ts +147 -0
  750. package/src/domains/providers/catalog.ts +12 -7
  751. package/src/domains/providers/extension.ts +27 -5
  752. package/src/domains/providers/index.ts +1 -0
  753. package/src/domains/providers/plugins.ts +3 -13
  754. package/src/domains/providers/runtimes/common/local-synth.ts +4 -0
  755. package/src/domains/providers/types/target-descriptor.ts +17 -0
  756. package/src/domains/resources/common-loader.ts +9 -6
  757. package/src/domains/resources/index.ts +67 -0
  758. package/src/domains/resources/library-actions.ts +836 -0
  759. package/src/domains/resources/library-evals.ts +38 -0
  760. package/src/domains/resources/library-inventory.ts +1048 -0
  761. package/src/domains/resources/library-types.ts +50 -0
  762. package/src/domains/resources/library-validation.ts +634 -0
  763. package/src/domains/resources/library.ts +437 -156
  764. package/src/domains/resources/package-references.ts +66 -0
  765. package/src/domains/resources/prompts/loader.ts +75 -41
  766. package/src/domains/resources/skills/install.ts +2 -2
  767. package/src/domains/resources/skills/loader.ts +77 -22
  768. package/src/domains/resources/skills/marketplace.ts +48 -57
  769. package/src/domains/resources/skills/promotion.ts +2 -2
  770. package/src/domains/resources/skills/provenance-pin.ts +17 -4
  771. package/src/domains/safety/action-classifier.ts +2 -2
  772. package/src/domains/safety/default-path-policy.ts +3 -1
  773. package/src/domains/safety/policy-engine.ts +1 -1
  774. package/src/domains/safety/protected-artifacts.ts +21 -5
  775. package/src/domains/safety/skill-authority.ts +5 -2
  776. package/src/domains/session/compaction/compact.ts +4 -1
  777. package/src/domains/session/entries.ts +1 -0
  778. package/src/domains/session/usage.ts +6 -7
  779. package/src/domains/share/archive.ts +1 -1
  780. package/src/engine/acp/server.ts +11 -0
  781. package/src/engine/ai.ts +2 -0
  782. package/src/engine/apis/openai-completions.ts +61 -6
  783. package/src/engine/notices/pi-tui-LICENSE +21 -0
  784. package/src/engine/prewarm.ts +232 -0
  785. package/src/engine/provider-diagnostics.ts +6 -1
  786. package/src/engine/tui.ts +3 -0
  787. package/src/engine/worker-runtime.ts +58 -14
  788. package/src/engine/worker-tools.ts +5 -0
  789. package/src/entry/orchestrator.ts +46 -21
  790. package/src/entry/plugin-reload.ts +18 -0
  791. package/src/interactive/application-controller.ts +67 -21
  792. package/src/interactive/chat-loop-messages.ts +3 -0
  793. package/src/interactive/chat-loop.ts +32 -11
  794. package/src/interactive/chat-panel.ts +5 -1
  795. package/src/interactive/clio-editor.ts +53 -21
  796. package/src/interactive/command-output.ts +56 -1
  797. package/src/interactive/editor-submit.ts +65 -28
  798. package/src/interactive/fleet-run-preview.ts +2 -0
  799. package/src/interactive/follow-up-queue-panel.ts +3 -3
  800. package/src/interactive/footer/dashboard.ts +4 -1
  801. package/src/interactive/footer/notifications.ts +2 -2
  802. package/src/interactive/footer/widgets.ts +2 -2
  803. package/src/interactive/interactive-application.ts +209 -21
  804. package/src/interactive/interactive-input-runtime.ts +254 -7
  805. package/src/interactive/interactive-presentation.ts +41 -12
  806. package/src/interactive/interactive-slash-runtime.ts +37 -8
  807. package/src/interactive/keybinding-manager.ts +156 -79
  808. package/src/interactive/keyboard-owner.ts +37 -0
  809. package/src/interactive/leader-key.ts +49 -102
  810. package/src/interactive/leader-menu.ts +45 -0
  811. package/src/interactive/overlay-ask-user-lifecycle.ts +9 -1
  812. package/src/interactive/overlay-frame.ts +15 -0
  813. package/src/interactive/overlay-key-routing.ts +46 -47
  814. package/src/interactive/overlay-lifecycle.ts +30 -15
  815. package/src/interactive/overlay-resource-openers.ts +56 -46
  816. package/src/interactive/overlays/ask-user.ts +630 -556
  817. package/src/interactive/overlays/extension-panel.ts +70 -0
  818. package/src/interactive/overlays/extensions.ts +28 -5
  819. package/src/interactive/overlays/fleet-run-approval.ts +7 -3
  820. package/src/interactive/overlays/help-reference.ts +89 -40
  821. package/src/interactive/overlays/interop.ts +122 -3
  822. package/src/interactive/overlays/keybinding-detail.ts +2 -2
  823. package/src/interactive/overlays/library-lifecycle.ts +90 -0
  824. package/src/interactive/overlays/library-model.ts +574 -0
  825. package/src/interactive/overlays/library-review.ts +557 -0
  826. package/src/interactive/overlays/library-tabs.ts +3 -15
  827. package/src/interactive/overlays/library.ts +602 -0
  828. package/src/interactive/overlays/list-overlay.ts +218 -39
  829. package/src/interactive/overlays/model-selector.ts +28 -25
  830. package/src/interactive/overlays/session-selector.ts +9 -3
  831. package/src/interactive/overlays/settings.ts +25 -18
  832. package/src/interactive/overlays/tree-selector.ts +16 -11
  833. package/src/interactive/permission-hint.ts +13 -0
  834. package/src/interactive/permission-overlay.ts +77 -28
  835. package/src/interactive/prewarm.ts +11 -197
  836. package/src/interactive/prompt-source-label.ts +21 -0
  837. package/src/interactive/renderers/reference-card.ts +35 -0
  838. package/src/interactive/renderers/worker-entry.ts +35 -3
  839. package/src/interactive/session-usage-reseed.ts +2 -0
  840. package/src/interactive/side-question.ts +2 -0
  841. package/src/interactive/slash-autocomplete.ts +99 -1
  842. package/src/interactive/slash-commands.ts +390 -67
  843. package/src/interactive/slash-spec.ts +0 -1
  844. package/src/interactive/terminal-lease.ts +44 -12
  845. package/src/interactive/turn-context.ts +1 -0
  846. package/src/interactive/turn-persistence.ts +3 -0
  847. package/src/interactive/turn-prewarm.ts +126 -19
  848. package/src/interactive/turn-queues.ts +8 -7
  849. package/src/interactive/turn-runtime.ts +15 -1
  850. package/src/interactive/view/view-overlay.ts +19 -14
  851. package/src/interactive/welcome-dashboard.ts +525 -408
  852. package/src/tools/bootstrap.ts +8 -0
  853. package/src/tools/builtin-tool-catalog.ts +15 -6
  854. package/src/tools/context/index.ts +58 -5
  855. package/src/tools/context/library.ts +465 -0
  856. package/src/tools/context/surface.ts +20 -6
  857. package/src/tools/core-bootstrap.ts +3 -0
  858. package/src/tools/dispatch-admission.ts +24 -1
  859. package/src/tools/dispatch-arguments.ts +8 -0
  860. package/src/tools/dispatch-plan.ts +32 -0
  861. package/src/tools/dispatch-schema.ts +31 -1
  862. package/src/tools/dispatch-types.ts +3 -0
  863. package/src/tools/dispatch.ts +1 -1
  864. package/src/tools/harness-extensions.ts +169 -0
  865. package/src/tools/observation.ts +4 -0
  866. package/src/tools/policy.ts +7 -1
  867. package/src/tools/registry.ts +31 -3
  868. package/src/tools/worker-evidence.ts +5 -0
  869. package/src/worker/context-seed.ts +192 -0
  870. package/src/worker/entry.ts +1 -0
  871. package/src/worker/spec-contract.ts +35 -1
  872. package/dist/acp-UVEVWSDL.js +0 -130
  873. package/dist/agents-VWY37DTK.js +0 -148
  874. package/dist/auth-PCV2XQDV.js +0 -551
  875. package/dist/builtins-PD652MTK.js +0 -22
  876. package/dist/chunk-22PQ4TX4.js +0 -360
  877. package/dist/chunk-24T2YZ7A.js +0 -22648
  878. package/dist/chunk-2AKYFREM.js +0 -1008
  879. package/dist/chunk-2QPI3TR3.js +0 -162
  880. package/dist/chunk-3BJGMT2D.js +0 -324
  881. package/dist/chunk-3HQVBIKD.js +0 -308
  882. package/dist/chunk-3JLFK5MW.js +0 -193
  883. package/dist/chunk-3O2ZAUGQ.js +0 -283
  884. package/dist/chunk-3QKXHCGS.js +0 -59
  885. package/dist/chunk-3T4DXWP6.js +0 -668
  886. package/dist/chunk-3UW3KU4A.js +0 -21
  887. package/dist/chunk-3WBALRQH.js +0 -5076
  888. package/dist/chunk-4DU2TVI4.js +0 -108
  889. package/dist/chunk-4U4TKZFR.js +0 -5052
  890. package/dist/chunk-4VMV6OS6.js +0 -101
  891. package/dist/chunk-536HXRFE.js +0 -1257
  892. package/dist/chunk-5CMARGPF.js +0 -477
  893. package/dist/chunk-5CY4Q6QI.js +0 -141
  894. package/dist/chunk-5QRX7SLS.js +0 -1018
  895. package/dist/chunk-5VTJP36Q.js +0 -36
  896. package/dist/chunk-5ZSZEYJK.js +0 -119
  897. package/dist/chunk-6HAO6X5B.js +0 -197
  898. package/dist/chunk-6OII3LOK.js +0 -404
  899. package/dist/chunk-6RYDAVQT.js +0 -4338
  900. package/dist/chunk-6VRRJT7L.js +0 -146
  901. package/dist/chunk-6YA46L5A.js +0 -386
  902. package/dist/chunk-77CZRFTE.js +0 -634
  903. package/dist/chunk-7JSSKXG2.js +0 -1215
  904. package/dist/chunk-7WUZEB2M.js +0 -165
  905. package/dist/chunk-7YJWEF2L.js +0 -974
  906. package/dist/chunk-ACCKVSHU.js +0 -44
  907. package/dist/chunk-B3MOMLJ4.js +0 -433
  908. package/dist/chunk-BBV5TKE6.js +0 -35
  909. package/dist/chunk-BLTEAUCB.js +0 -668
  910. package/dist/chunk-BS4GAMUB.js +0 -233
  911. package/dist/chunk-BT7HGDOX.js +0 -3151
  912. package/dist/chunk-CBSKDFWL.js +0 -101
  913. package/dist/chunk-CXQ37WJH.js +0 -45
  914. package/dist/chunk-DXLUVUD4.js +0 -1490
  915. package/dist/chunk-DZK63TZJ.js +0 -1334
  916. package/dist/chunk-E7RF4KBO.js +0 -266
  917. package/dist/chunk-ECOMVOHP.js +0 -139
  918. package/dist/chunk-EHOSNVVM.js +0 -59
  919. package/dist/chunk-F5Z7EWMN.js +0 -4484
  920. package/dist/chunk-FQOOGXBH.js +0 -579
  921. package/dist/chunk-GLYBJ4RQ.js +0 -396
  922. package/dist/chunk-HHVJNVUJ.js +0 -179
  923. package/dist/chunk-HL26ADLH.js +0 -77
  924. package/dist/chunk-HPTJF6DG.js +0 -2465
  925. package/dist/chunk-HXHFDHB6.js +0 -962
  926. package/dist/chunk-HZ2T2YED.js +0 -1687
  927. package/dist/chunk-HZFBVU5X.js +0 -666
  928. package/dist/chunk-I2K2NCZQ.js +0 -659
  929. package/dist/chunk-IGLVVNEG.js +0 -402
  930. package/dist/chunk-IKRWLEDA.js +0 -1567
  931. package/dist/chunk-J2FYEQ5L.js +0 -33
  932. package/dist/chunk-JMPL7NUB.js +0 -108
  933. package/dist/chunk-K2HL3GBL.js +0 -998
  934. package/dist/chunk-KAFMW7WM.js +0 -386
  935. package/dist/chunk-KTFSFCVN.js +0 -46
  936. package/dist/chunk-LIN2K3EL.js +0 -66
  937. package/dist/chunk-LUL5Z66S.js +0 -221
  938. package/dist/chunk-LVFANMOH.js +0 -466
  939. package/dist/chunk-LY4N4TTL.js +0 -117
  940. package/dist/chunk-LZBMXNLP.js +0 -1196
  941. package/dist/chunk-M6TAYK66.js +0 -807
  942. package/dist/chunk-N2OKBREN.js +0 -243
  943. package/dist/chunk-NC4KV7EL.js +0 -39
  944. package/dist/chunk-NF3BK5WR.js +0 -42
  945. package/dist/chunk-NNWJYUNO.js +0 -573
  946. package/dist/chunk-NTK3WTHM.js +0 -141
  947. package/dist/chunk-ODUTYZIU.js +0 -688
  948. package/dist/chunk-OQM5IVJY.js +0 -1377
  949. package/dist/chunk-P5JMBPDJ.js +0 -7192
  950. package/dist/chunk-P5SC4DLJ.js +0 -47
  951. package/dist/chunk-P6M7RKMI.js +0 -97
  952. package/dist/chunk-PWWSIB2A.js +0 -52
  953. package/dist/chunk-PZN2LQY6.js +0 -674
  954. package/dist/chunk-Q7NNUHQV.js +0 -705
  955. package/dist/chunk-QCOV5DFY.js +0 -911
  956. package/dist/chunk-QNWRHOMF.js +0 -692
  957. package/dist/chunk-QRFXEO6Y.js +0 -17
  958. package/dist/chunk-QXFBABFJ.js +0 -380
  959. package/dist/chunk-RGZNQ5CT.js +0 -657
  960. package/dist/chunk-SRZOW5L2.js +0 -1865
  961. package/dist/chunk-SXQKNKRA.js +0 -223
  962. package/dist/chunk-T334FW2H.js +0 -362
  963. package/dist/chunk-T52TPHYC.js +0 -318
  964. package/dist/chunk-TJFDL26W.js +0 -658
  965. package/dist/chunk-TN5FW4XY.js +0 -172
  966. package/dist/chunk-U7H5WRG5.js +0 -123
  967. package/dist/chunk-UFYNOQK4.js +0 -302
  968. package/dist/chunk-URBGEOH3.js +0 -32
  969. package/dist/chunk-USZA7GWL.js +0 -341
  970. package/dist/chunk-UUQ5G6EZ.js +0 -697
  971. package/dist/chunk-VAHLPXPY.js +0 -399
  972. package/dist/chunk-VANN3GDP.js +0 -2488
  973. package/dist/chunk-VHMX7SXF.js +0 -1289
  974. package/dist/chunk-WJIMKGD6.js +0 -132
  975. package/dist/chunk-WKUYQBCG.js +0 -795
  976. package/dist/chunk-WNGF5AJX.js +0 -1911
  977. package/dist/chunk-WV6TDAPN.js +0 -3627
  978. package/dist/chunk-X3BI7HTV.js +0 -562
  979. package/dist/chunk-XWMSPJYN.js +0 -149
  980. package/dist/chunk-YPRSNUTC.js +0 -395
  981. package/dist/chunk-ZS43Y2FT.js +0 -438
  982. package/dist/clio-QQCMTUZE.js +0 -26
  983. package/dist/code-nav-GUPM6766.js +0 -686
  984. package/dist/components-TNIKXCBH.js +0 -674
  985. package/dist/config-IIM7YOD3.js +0 -621
  986. package/dist/configure-4ZM5HWJX.js +0 -73
  987. package/dist/context-44BZLJ3J.js +0 -344
  988. package/dist/context-AIDVQKMW.js +0 -278
  989. package/dist/context-OL5P3HEP.js +0 -1031
  990. package/dist/context-clear-OQV76MYP.js +0 -184
  991. package/dist/context-index-HP2JFUWA.js +0 -120
  992. package/dist/context-map-INTXD54D.js +0 -555
  993. package/dist/context-working-set-ZUW3EGLS.js +0 -1556
  994. package/dist/detail-UXPWRANG.js +0 -115
  995. package/dist/dispatch-runner-P3ZW6G77.js +0 -2438
  996. package/dist/docs-BL7ROUFN.js +0 -292
  997. package/dist/doctor-JJVGPZWT.js +0 -797
  998. package/dist/eval-V2RTN3UH.js +0 -4972
  999. package/dist/eval-inventory-QOYZERXJ.js +0 -315
  1000. package/dist/evidence-35PYWGSO.js +0 -225
  1001. package/dist/evidence-CIGGKI6J.js +0 -383
  1002. package/dist/evolve-33SM3NJP.js +0 -609
  1003. package/dist/extensions-YVRHX6ZI.js +0 -229
  1004. package/dist/fleet-LFO7SIPC.js +0 -908
  1005. package/dist/fleet-commands-RLK72GU3.js +0 -75
  1006. package/dist/fleet-decisions-3SBSCTCW.js +0 -159
  1007. package/dist/fleet-graph-JZIBCGMW.js +0 -134
  1008. package/dist/fleet-inspect-2L5YGGZJ.js +0 -469
  1009. package/dist/fleet-preflight-QRSHIIDE.js +0 -22
  1010. package/dist/fleet-validate-LIAVKDUU.js +0 -92
  1011. package/dist/fleet-verify-JIK3OQZR.js +0 -202
  1012. package/dist/fleet-view-IWHYGQKK.js +0 -118
  1013. package/dist/init-NJEDOTQW.js +0 -321
  1014. package/dist/interop-RVCAYECG.js +0 -115
  1015. package/dist/inventory-74UL7UHU.js +0 -118
  1016. package/dist/library-CTKZA7K3.js +0 -226
  1017. package/dist/memory-I76I5VUH.js +0 -512
  1018. package/dist/models-D4YDIQZQ.js +0 -289
  1019. package/dist/monitor-NKVD55HX.js +0 -775
  1020. package/dist/orchestrator-I6OATVPK.js +0 -39518
  1021. package/dist/panes-7BTYH3XQ.js +0 -103
  1022. package/dist/panes-WPOMEMRH.js +0 -74
  1023. package/dist/paths-J3KN7UAO.js +0 -67
  1024. package/dist/preload-EJAWJEIO.js +0 -116
  1025. package/dist/reset-4XMQKDNZ.js +0 -345
  1026. package/dist/resources-TVYVXK3Q.js +0 -125
  1027. package/dist/run-OWQNNSJU.js +0 -872
  1028. package/dist/share-NPZZMUXG.js +0 -290
  1029. package/dist/skills-OXFEAWMT.js +0 -510
  1030. package/dist/skills-eval-J5TCKSJA.js +0 -1034
  1031. package/dist/skills-inventory-7II4DM57.js +0 -133
  1032. package/dist/slash-commands-MDSDSWYF.js +0 -92
  1033. package/dist/steer-S7D7IKPU.js +0 -77
  1034. package/dist/support-5VAEC32W.js +0 -38
  1035. package/dist/targets-KILZEOCE.js +0 -1109
  1036. package/dist/tasks-R6P6OV22.js +0 -36
  1037. package/dist/terminal-lease-LZCG2KN3.js +0 -405
  1038. package/dist/tools-6OCQ6SVB.js +0 -28
  1039. package/dist/trace-JHLXWUMN.js +0 -572
  1040. package/dist/tui-primitives-RCY2HN7G.js +0 -17
  1041. package/dist/uninstall-FXYMFFRT.js +0 -407
  1042. package/dist/upgrade-D2OZH6IQ.js +0 -307
  1043. package/dist/usage-PIASNUS4.js +0 -1052
  1044. package/dist/verifiers-LTHUY2PX.js +0 -630
  1045. package/dist/verify-HYF7KBVE.js +0 -30
  1046. package/dist/web-fetch-MQN4FH3X.js +0 -788
  1047. package/dist/wiki-generate-RK7JQ5NP.js +0 -615
  1048. package/dist/with-panes-OFTNAR4Y.js +0 -628
  1049. package/skills/README.md +0 -418
  1050. package/skills/coding/ast-grep/SKILL.md +0 -213
  1051. package/skills/coding/ast-grep/evals.md +0 -82
  1052. package/skills/coding/coding-standards/SKILL.md +0 -164
  1053. package/skills/coding/coding-standards/evals.md +0 -57
  1054. package/skills/coding/prototype/SKILL.md +0 -151
  1055. package/skills/coding/prototype/evals.md +0 -61
  1056. package/skills/coding/tdd/SKILL.md +0 -134
  1057. package/skills/coding/tdd/evals.md +0 -61
  1058. package/skills/context/context-handoff/SKILL.md +0 -176
  1059. package/skills/context/context-handoff/evals.md +0 -101
  1060. package/skills/context/context-prime/SKILL.md +0 -131
  1061. package/skills/context/context-prime/evals.md +0 -99
  1062. package/skills/git/branch-closeout/SKILL.md +0 -132
  1063. package/skills/git/file-ticket/SKILL.md +0 -126
  1064. package/skills/git/fix-issue/SKILL.md +0 -136
  1065. package/skills/git/resolve-merge-conflicts/SKILL.md +0 -151
  1066. package/skills/git/resolve-merge-conflicts/evals.md +0 -85
  1067. package/skills/git/ship/SKILL.md +0 -134
  1068. package/skills/git/worktree-create/SKILL.md +0 -127
  1069. package/skills/git/worktree-merge/SKILL.md +0 -147
  1070. package/skills/meta/clio-coder-dev/SKILL.md +0 -101
  1071. package/skills/meta/clio-coder-dev/evals.md +0 -46
  1072. package/skills/meta/clio-coder-test/SKILL.md +0 -146
  1073. package/skills/meta/clio-coder-test/evals.md +0 -48
  1074. package/skills/meta/clio-coder-test/references/test-map.md +0 -96
  1075. package/skills/meta/credentials/SKILL.md +0 -132
  1076. package/skills/meta/credentials/evals.md +0 -104
  1077. package/skills/meta/find-skills/SKILL.md +0 -78
  1078. package/skills/meta/find-skills/evals.md +0 -47
  1079. package/skills/meta/herdr/SKILL.md +0 -133
  1080. package/skills/meta/herdr/evals.md +0 -38
  1081. package/skills/meta/skill-craft/SKILL.md +0 -125
  1082. package/skills/meta/skill-craft/evals.md +0 -41
  1083. package/skills/planning/archify/SKILL.md +0 -196
  1084. package/skills/planning/architecture/SKILL.md +0 -184
  1085. package/skills/planning/architecture/evals.md +0 -101
  1086. package/skills/planning/backlog/SKILL.md +0 -212
  1087. package/skills/planning/backlog/evals.md +0 -185
  1088. package/skills/planning/prd/SKILL.md +0 -129
  1089. package/skills/planning/prd/evals.md +0 -103
  1090. package/skills/planning/product-intent/SKILL.md +0 -173
  1091. package/skills/planning/product-intent/evals.md +0 -106
  1092. package/skills/planning/tech-spec/SKILL.md +0 -172
  1093. package/skills/planning/tech-spec/evals.md +0 -120
  1094. package/skills/registry.yaml +0 -144
  1095. package/skills/remote.yaml +0 -13
  1096. package/skills/research/arxiv-literature/SKILL.md +0 -168
  1097. package/skills/research/arxiv-literature/evals.md +0 -108
  1098. package/skills/research/experiment-protocol/SKILL.md +0 -148
  1099. package/skills/research/experiment-protocol/evals.md +0 -114
  1100. package/skills/research/scientific-debugging/SKILL.md +0 -149
  1101. package/skills/research/scientific-debugging/evals.md +0 -156
  1102. package/skills/research/scientific-modernization/SKILL.md +0 -170
  1103. package/skills/research/scientific-modernization/evals.md +0 -111
  1104. package/skills/skill-marketplace.json +0 -507
  1105. package/skills/workflow/cut-it/SKILL.md +0 -153
  1106. package/skills/workflow/cut-it/evals.md +0 -143
  1107. package/skills/workflow/design-council/SKILL.md +0 -233
  1108. package/skills/workflow/design-council/evals.md +0 -258
  1109. package/skills/workflow/grill-me/SKILL.md +0 -267
  1110. package/skills/workflow/grill-me/evals.md +0 -231
  1111. package/skills/workflow/workflow-distiller/SKILL.md +0 -201
  1112. package/skills/workflow/workflow-distiller/evals.md +0 -225
  1113. package/src/domains/extensions/resource-path.ts +0 -27
  1114. package/src/domains/extensions/resources.ts +0 -37
  1115. package/src/domains/lifecycle/migrations/2026-09-01-extension-install-digests.ts +0 -27
  1116. package/src/interactive/overlays/agents.ts +0 -70
  1117. package/src/interactive/overlays/library-install-confirm.ts +0 -152
  1118. package/src/interactive/overlays/prompts.ts +0 -89
  1119. package/src/interactive/overlays/skills-hub.ts +0 -615
  1120. /package/{skills → library/skills}/coding/ast-grep/references/rule_reference.md +0 -0
  1121. /package/{skills → library/skills}/coding/prototype/references/LOGIC.md +0 -0
  1122. /package/{skills → library/skills}/coding/prototype/references/UI.md +0 -0
  1123. /package/{skills → library/skills}/coding/tdd/references/mocking.md +0 -0
  1124. /package/{skills → library/skills}/coding/tdd/references/tests.md +0 -0
  1125. /package/{skills → library/skills}/context/context-handoff/scripts/new-handoff.sh +0 -0
  1126. /package/{skills → library/skills}/git/branch-closeout/evals.md +0 -0
  1127. /package/{skills → library/skills}/git/branch-closeout/references/closeout-checklist.md +0 -0
  1128. /package/{skills → library/skills}/git/file-ticket/assets/issue-template.md +0 -0
  1129. /package/{skills → library/skills}/git/file-ticket/evals.md +0 -0
  1130. /package/{skills → library/skills}/git/file-ticket/references/issue-discovery.md +0 -0
  1131. /package/{skills → library/skills}/git/fix-issue/evals.md +0 -0
  1132. /package/{skills → library/skills}/git/fix-issue/references/diagnosis-and-rca.md +0 -0
  1133. /package/{skills → library/skills}/git/resolve-merge-conflicts/references/conflict-matrix.md +0 -0
  1134. /package/{skills → library/skills}/git/ship/assets/pr-template.md +0 -0
  1135. /package/{skills → library/skills}/git/ship/evals.md +0 -0
  1136. /package/{skills → library/skills}/git/ship/references/remote-and-branch-policy.md +0 -0
  1137. /package/{skills → library/skills}/git/worktree-create/evals.md +0 -0
  1138. /package/{skills → library/skills}/git/worktree-create/references/worktree-setup.md +0 -0
  1139. /package/{skills → library/skills}/git/worktree-merge/evals.md +0 -0
  1140. /package/{skills → library/skills}/git/worktree-merge/references/merge-strategies.md +0 -0
  1141. /package/{skills → library/skills}/meta/clio-coder-test/references/harness.md +0 -0
  1142. /package/{skills → library/skills}/planning/archify/evals.md +0 -0
@@ -0,0 +1,1377 @@
1
+ import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
+ import {
3
+ classify
4
+ } from "./chunk-YXFKLMX2.js";
5
+ import {
6
+ ToolNames,
7
+ isBuiltinToolName
8
+ } from "./chunk-WLHX3MM5.js";
9
+ import {
10
+ init_esm_shims
11
+ } from "./chunk-ECBHH7LU.js";
12
+
13
+ // src/core/json-payload.ts
14
+ init_esm_shims();
15
+ function jsonPayloadCandidates(text) {
16
+ const trimmed = text.trim();
17
+ const candidates = [trimmed];
18
+ const fenced = /```[A-Za-z0-9_-]*\s*\n?([\s\S]*?)```/.exec(trimmed)?.[1]?.trim();
19
+ if (fenced !== void 0 && fenced.length > 0) candidates.push(fenced);
20
+ const start = trimmed.indexOf("{");
21
+ const end = trimmed.lastIndexOf("}");
22
+ if (start >= 0 && end > start) candidates.push(trimmed.slice(start, end + 1));
23
+ return candidates;
24
+ }
25
+ function parseJsonObjectPayload(text) {
26
+ let parsedSomething = false;
27
+ for (const candidate of jsonPayloadCandidates(text)) {
28
+ let value;
29
+ try {
30
+ value = JSON.parse(candidate);
31
+ } catch {
32
+ continue;
33
+ }
34
+ parsedSomething = true;
35
+ if (value === null || typeof value !== "object" || Array.isArray(value)) continue;
36
+ return { ok: true, value };
37
+ }
38
+ return { ok: false, reason: parsedSomething ? "not-object" : "not-json" };
39
+ }
40
+
41
+ // src/domains/agents/spec.ts
42
+ init_esm_shims();
43
+ import { createHash } from "node:crypto";
44
+ var AGENT_AUTOMATION_AUTHORITIES = ["read-only", "verification", "artifact-write", "workspace-edit"];
45
+ var AGENT_PRODUCTS = ["orientation"];
46
+ var AGENT_CATEGORIES = [
47
+ "explore",
48
+ "plan",
49
+ "research",
50
+ "implement",
51
+ "quality",
52
+ "science",
53
+ "evolution",
54
+ "operations",
55
+ "internal"
56
+ ];
57
+ var AGENT_CAPABILITY_CLASSES = [
58
+ "read-only",
59
+ "artifact-write",
60
+ "workspace-edit",
61
+ "verification",
62
+ "orchestration",
63
+ "internal"
64
+ ];
65
+ var AGENT_LATENCY_CLASSES = ["fast", "balanced", "deep"];
66
+ var AGENT_AUDIENCES = ["base", "shadow", "custom", "internal"];
67
+ var AGENT_PROJECT_CONTEXT_TIERS = ["none", "bounded"];
68
+ function includes(values, value) {
69
+ return typeof value === "string" && values.includes(value);
70
+ }
71
+ function isAgentCategory(value) {
72
+ return includes(AGENT_CATEGORIES, value);
73
+ }
74
+ function isAgentCapabilityClass(value) {
75
+ return includes(AGENT_CAPABILITY_CLASSES, value);
76
+ }
77
+ function isAgentLatencyClass(value) {
78
+ return includes(AGENT_LATENCY_CLASSES, value);
79
+ }
80
+ function isAgentAudience(value) {
81
+ return includes(AGENT_AUDIENCES, value);
82
+ }
83
+ function isAgentProjectContextTier(value) {
84
+ return includes(AGENT_PROJECT_CONTEXT_TIERS, value);
85
+ }
86
+ function isAgentProduct(value) {
87
+ return includes(AGENT_PRODUCTS, value);
88
+ }
89
+ function actionClassesForTools(tools) {
90
+ const actions = /* @__PURE__ */ new Set();
91
+ for (const tool of tools) actions.add(classify({ tool }).actionClass);
92
+ return actions;
93
+ }
94
+ function normalizeTools(recipe) {
95
+ const seen = /* @__PURE__ */ new Set();
96
+ const tools = [];
97
+ for (const tool of recipe.tools) {
98
+ if (typeof tool !== "string" || tool.trim().length === 0) {
99
+ throw new Error(`agent recipe '${recipe.id}' declares an invalid tool name`);
100
+ }
101
+ if (seen.has(tool)) continue;
102
+ seen.add(tool);
103
+ tools.push(isBuiltinToolName(tool) ? tool : tool);
104
+ }
105
+ return tools;
106
+ }
107
+ function asToolName(tool) {
108
+ return isBuiltinToolName(tool) ? tool : tool;
109
+ }
110
+ function normalizeToolRequirements(recipe, tools) {
111
+ if (!recipe.toolRequirements) {
112
+ throw new Error(`agent recipe '${recipe.id}' must declare tools.required and tools.optional`);
113
+ }
114
+ const declared = new Set(tools);
115
+ const required = recipe.toolRequirements.required.map((requirement, index) => {
116
+ if (typeof requirement === "string") return asToolName(requirement);
117
+ if (!Array.isArray(requirement.anyOf) || requirement.anyOf.length === 0) {
118
+ throw new Error(`agent recipe '${recipe.id}' tools.required[${index}].anyOf must be non-empty`);
119
+ }
120
+ return { anyOf: requirement.anyOf.map(asToolName) };
121
+ });
122
+ const optional = recipe.toolRequirements.optional.map(asToolName);
123
+ const mentioned = required.flatMap(
124
+ (requirement) => typeof requirement === "string" ? [requirement] : requirement.anyOf
125
+ );
126
+ for (const tool of [...mentioned, ...optional]) {
127
+ if (!declared.has(tool)) throw new Error(`agent recipe '${recipe.id}' requirement '${tool}' is not declared`);
128
+ }
129
+ if ((/* @__PURE__ */ new Set([...mentioned, ...optional])).size !== mentioned.length + optional.length) {
130
+ throw new Error(`agent recipe '${recipe.id}' contains duplicate tool requirements`);
131
+ }
132
+ if ((/* @__PURE__ */ new Set([...mentioned, ...optional])).size !== tools.length) {
133
+ throw new Error(`agent recipe '${recipe.id}' has declared tools without required/optional semantics`);
134
+ }
135
+ return { required, optional };
136
+ }
137
+ function resolveAgentToolCompatibility(spec, effectiveTools, options) {
138
+ const available = new Set(effectiveTools);
139
+ const missingRequired = [];
140
+ for (const requirement of spec.toolRequirements.required) {
141
+ if (typeof requirement === "string") {
142
+ if (!available.has(requirement)) missingRequired.push(requirement);
143
+ continue;
144
+ }
145
+ if (!requirement.anyOf.some((tool) => available.has(tool))) {
146
+ missingRequired.push(`anyOf(${requirement.anyOf.join("|")})`);
147
+ }
148
+ }
149
+ if (available.has(ToolNames.Dispatch) && !options.mediatesDispatch) {
150
+ missingRequired.push("dispatch(runtime mediation unavailable)");
151
+ }
152
+ return {
153
+ compatible: missingRequired.length === 0,
154
+ missingRequired,
155
+ lostOptional: spec.toolRequirements.optional.filter((tool) => !available.has(tool))
156
+ };
157
+ }
158
+ function normalizeAgentSpec(recipe) {
159
+ const tools = normalizeTools(recipe);
160
+ const toolRequirements = normalizeToolRequirements(recipe, tools);
161
+ return {
162
+ version: recipe.version,
163
+ id: recipe.id,
164
+ name: recipe.name,
165
+ description: recipe.description,
166
+ source: recipe.source,
167
+ filepath: recipe.filepath,
168
+ tools,
169
+ toolRequirements,
170
+ category: recipe.category,
171
+ capabilityClass: recipe.capabilityClass,
172
+ latencyClass: recipe.latencyClass,
173
+ projectContextTier: recipe.projectContextTier,
174
+ audience: recipe.audience,
175
+ tags: recipe.tags,
176
+ skills: recipe.skills,
177
+ resultContract: recipe.resultContract,
178
+ ...recipe.product !== void 0 ? { product: recipe.product } : {},
179
+ budget: recipe.budget,
180
+ body: recipe.body
181
+ };
182
+ }
183
+ function agentSpecFingerprint(spec) {
184
+ const requirement = (entry) => typeof entry === "string" ? entry : `anyOf(${[...entry.anyOf].sort().join("|")})`;
185
+ const payload = JSON.stringify({
186
+ id: spec.id,
187
+ tools: [...spec.tools].sort(),
188
+ required: spec.toolRequirements.required.map(requirement).sort(),
189
+ optional: [...spec.toolRequirements.optional].sort(),
190
+ capabilityClass: spec.capabilityClass,
191
+ latencyClass: spec.latencyClass,
192
+ projectContextTier: spec.projectContextTier,
193
+ audience: spec.audience,
194
+ skills: [...spec.skills].sort(),
195
+ resultContract: spec.resultContract,
196
+ budget: spec.budget,
197
+ body: createHash("sha256").update(spec.body, "utf8").digest("hex")
198
+ });
199
+ return createHash("sha256").update(payload, "utf8").digest("hex");
200
+ }
201
+ function isUserVisibleAgent(spec) {
202
+ return spec.audience === "base" || spec.audience === "custom";
203
+ }
204
+ function isShadowAgent(spec) {
205
+ return spec.audience === "shadow" || spec.audience === "internal";
206
+ }
207
+ function agentSpecPolicyErrors(spec) {
208
+ const errors = [];
209
+ const actions = actionClassesForTools(spec.tools);
210
+ const requiredGroups = spec.toolRequirements.required.map(
211
+ (requirement) => typeof requirement === "string" ? [requirement] : requirement.anyOf
212
+ );
213
+ const requiresTool = (tool) => requiredGroups.some((group) => group.length > 0 && group.every((candidate) => candidate === tool));
214
+ const requiresMutation = requiredGroups.some(
215
+ (group) => group.length > 0 && group.every((tool) => tool === ToolNames.Write || tool === ToolNames.Edit)
216
+ );
217
+ if (spec.capabilityClass === "workspace-edit" && (!requiresTool(ToolNames.Read) || !requiresMutation)) {
218
+ errors.push(`workspace-edit agent '${spec.id}' must require read and write|edit`);
219
+ }
220
+ if (spec.capabilityClass === "verification" && !requiresTool(ToolNames.Verify)) {
221
+ errors.push(`verification agent '${spec.id}' must require verify`);
222
+ }
223
+ if (spec.capabilityClass === "artifact-write" && !requiresTool(ToolNames.Artifact)) {
224
+ errors.push(`artifact-write agent '${spec.id}' must require artifact`);
225
+ }
226
+ if (spec.skills.length > 0 && !requiresTool(ToolNames.Context)) {
227
+ errors.push(`agent '${spec.id}' must require context for bound skills`);
228
+ }
229
+ if (spec.capabilityClass === "orchestration" && spec.tools.includes(ToolNames.Dispatch) && !requiresTool(ToolNames.Dispatch)) {
230
+ errors.push(`orchestration agent '${spec.id}' must require dispatch when it is declared`);
231
+ }
232
+ const toolList = spec.tools.join(", ");
233
+ if (spec.capabilityClass === "read-only") {
234
+ for (const action of actions) {
235
+ if (action !== "read") errors.push(`read-only agent '${spec.id}' requests ${action} tools (${toolList})`);
236
+ }
237
+ }
238
+ if (spec.capabilityClass === "artifact-write") {
239
+ for (const tool of spec.tools) {
240
+ const action = classify({ tool }).actionClass;
241
+ if (action === "execute" || action === "dispatch" || action === "system_modify" || action === "git_destructive") {
242
+ errors.push(`artifact-write agent '${spec.id}' requests ${action} tool '${tool}'`);
243
+ }
244
+ if (action === "write" && tool !== ToolNames.Artifact) {
245
+ errors.push(`artifact-write agent '${spec.id}' can only write terminal artifacts; got '${tool}'`);
246
+ }
247
+ }
248
+ }
249
+ if (spec.capabilityClass === "verification") {
250
+ for (const tool of spec.tools) {
251
+ const action = classify({ tool }).actionClass;
252
+ if (action === "write" || action === "dispatch" || action === "system_modify" || action === "git_destructive") {
253
+ errors.push(`verification agent '${spec.id}' must not request ${action} tool '${tool}'`);
254
+ }
255
+ if (tool === ToolNames.Bash)
256
+ errors.push(`verification agent '${spec.id}' must use typed validation tools, not bash`);
257
+ }
258
+ }
259
+ if (spec.capabilityClass !== "orchestration" && spec.tools.includes(ToolNames.Dispatch)) {
260
+ errors.push(`agent '${spec.id}' exposes dispatch without orchestration capability`);
261
+ }
262
+ if (spec.tools.includes(ToolNames.AskUser)) {
263
+ errors.push(`agent '${spec.id}' exposes ask_user, which is only available to the orchestrator`);
264
+ }
265
+ if (spec.skills.length > 0 && !spec.tools.includes(ToolNames.Context)) {
266
+ errors.push(`agent '${spec.id}' declares skills but does not expose context`);
267
+ }
268
+ return errors;
269
+ }
270
+ function assertAgentSpecPolicy(spec) {
271
+ const errors = agentSpecPolicyErrors(spec);
272
+ if (errors.length > 0) throw new Error(`agent policy violation:
273
+ ${errors.map((error) => `- ${error}`).join("\n")}`);
274
+ }
275
+
276
+ // src/domains/agents/result-contract.ts
277
+ init_esm_shims();
278
+ import { createHash as createHash2 } from "node:crypto";
279
+ import path from "node:path";
280
+ function parseDelegationPlanResult(output) {
281
+ const parsed = parseJson(output);
282
+ if (!parsed.ok || !hasOnlyKeys(parsed.value, ["tasks"]) || !Array.isArray(parsed.value.tasks) || parsed.value.tasks.length === 0)
283
+ return null;
284
+ const tasks = [];
285
+ for (const raw of parsed.value.tasks) {
286
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return null;
287
+ const task = raw;
288
+ if (!hasOnlyKeys(task, ["id", "agent", "description", "depends_on", "writes", "mode"]) || !string(task.id) || !string(task.agent) || !string(task.description) || !Array.isArray(task.depends_on) || task.depends_on.some((entry) => !string(entry)) || !Array.isArray(task.writes) || task.writes.some((entry) => !string(entry)) || task.mode !== void 0 && task.mode !== "sequential" && task.mode !== "parallel")
289
+ return null;
290
+ tasks.push({
291
+ id: task.id,
292
+ agent: task.agent,
293
+ description: task.description,
294
+ depends_on: [...task.depends_on],
295
+ writes: [...task.writes],
296
+ ...task.mode !== void 0 ? { mode: task.mode } : {}
297
+ });
298
+ }
299
+ return { tasks };
300
+ }
301
+ var COUNCIL_BALLOT_VERDICT_MAX_BYTES = 64;
302
+ var COUNCIL_BALLOT_SHAPE = '{"verdict":"yes","text":"the answer and the evidence behind it"}';
303
+ function parseCouncilBallot(output) {
304
+ const parsed = parseJson(output);
305
+ if (!parsed.ok) return null;
306
+ const value = parsed.value;
307
+ if (!hasOnlyKeys(value, ["verdict", "text"]) || !string(value.verdict) || !string(value.text)) return null;
308
+ const verdict = value.verdict.trim();
309
+ if (verdict.includes("\n") || Buffer.byteLength(verdict, "utf8") > COUNCIL_BALLOT_VERDICT_MAX_BYTES) return null;
310
+ return { verdict, text: value.text.trim() };
311
+ }
312
+ function validateCouncilBallot(contract, output) {
313
+ const parsed = parseJson(output);
314
+ if (!parsed.ok) return failure(contract, "unmeasured", parsed.reason);
315
+ const ballot = parseCouncilBallot(output);
316
+ if (ballot === null) {
317
+ return failure(
318
+ contract,
319
+ "unmeasured",
320
+ `A council ballot must carry only verdict and text, both non-empty strings, with verdict a single line of at most ${COUNCIL_BALLOT_VERDICT_MAX_BYTES} bytes so the tally can match it against the other members`
321
+ );
322
+ }
323
+ return success(contract, "unmeasured", ballot);
324
+ }
325
+ function parseCouncilReport(output) {
326
+ if (output === null) return null;
327
+ const parsed = parseJsonObjectPayload(output);
328
+ if (!parsed.ok) return null;
329
+ const value = parsed.value;
330
+ if (!hasOnlyKeys(value, ["members", "synthesis"]) || !Array.isArray(value.members) || value.members.length === 0) {
331
+ return null;
332
+ }
333
+ const members = [];
334
+ for (const raw of value.members) {
335
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return null;
336
+ const member = raw;
337
+ if (!hasOnlyKeys(member, ["label", "runId", "round", "answer", "verdict", "failed"]) || !string(member.label) || !string(member.runId) || !Number.isInteger(member.round) || Number(member.round) < 1 || typeof member.answer !== "string" || member.verdict !== void 0 && !string(member.verdict))
338
+ return null;
339
+ let failed;
340
+ if (member.failed !== void 0) {
341
+ if (member.failed === null || typeof member.failed !== "object" || Array.isArray(member.failed) || !hasOnlyKeys(member.failed, ["reason"]) || !string(member.failed.reason))
342
+ return null;
343
+ failed = { reason: member.failed.reason };
344
+ }
345
+ members.push({
346
+ label: member.label,
347
+ runId: member.runId,
348
+ round: Number(member.round),
349
+ answer: member.answer,
350
+ ...member.verdict !== void 0 ? { verdict: member.verdict } : {},
351
+ ...failed !== void 0 ? { failed } : {}
352
+ });
353
+ }
354
+ if (value.synthesis === null || typeof value.synthesis !== "object" || Array.isArray(value.synthesis)) return null;
355
+ const rawSynthesis = value.synthesis;
356
+ if (!hasOnlyKeys(rawSynthesis, ["kind", "text", "verdict", "tally", "judgeRunId"])) return null;
357
+ if (rawSynthesis.kind !== "none" && rawSynthesis.kind !== "judge" && rawSynthesis.kind !== "vote") return null;
358
+ for (const key of ["text", "verdict", "judgeRunId"]) {
359
+ if (rawSynthesis[key] !== void 0 && !string(rawSynthesis[key])) return null;
360
+ }
361
+ let tally;
362
+ if (rawSynthesis.tally !== void 0) {
363
+ if (rawSynthesis.tally === null || typeof rawSynthesis.tally !== "object" || Array.isArray(rawSynthesis.tally))
364
+ return null;
365
+ tally = {};
366
+ for (const [key, count] of Object.entries(rawSynthesis.tally)) {
367
+ if (!key || !Number.isInteger(count) || Number(count) < 0) return null;
368
+ tally[key] = Number(count);
369
+ }
370
+ }
371
+ return {
372
+ members,
373
+ synthesis: {
374
+ kind: rawSynthesis.kind,
375
+ ...rawSynthesis.text !== void 0 ? { text: rawSynthesis.text } : {},
376
+ ...rawSynthesis.verdict !== void 0 ? { verdict: rawSynthesis.verdict } : {},
377
+ ...tally !== void 0 ? { tally } : {},
378
+ ...rawSynthesis.judgeRunId !== void 0 ? { judgeRunId: rawSynthesis.judgeRunId } : {}
379
+ }
380
+ };
381
+ }
382
+ function canonical(value) {
383
+ if (value === null) return "null";
384
+ if (typeof value === "string" || typeof value === "boolean") return JSON.stringify(value);
385
+ if (typeof value === "number") {
386
+ if (!Number.isFinite(value)) throw new Error("result contract cannot digest non-finite numbers");
387
+ return JSON.stringify(value);
388
+ }
389
+ if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
390
+ if (typeof value === "object") {
391
+ const record = value;
392
+ return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${canonical(record[key])}`).join(",")}}`;
393
+ }
394
+ throw new Error(`result contract cannot digest ${typeof value}`);
395
+ }
396
+ function digest(value) {
397
+ return createHash2("sha256").update(canonical(value), "utf8").digest("hex");
398
+ }
399
+ function resultContractDigest(contract) {
400
+ return digest(contract);
401
+ }
402
+ function resultContractSourceId(contract) {
403
+ return `agent-result-contract:${contract.kind}:${resultContractDigest(contract)}`;
404
+ }
405
+ function failure(contract, quality, reason) {
406
+ return {
407
+ conformance: "fail",
408
+ quality,
409
+ sourceId: resultContractSourceId(contract),
410
+ validatorDigest: digest({ contract, reason }),
411
+ reason
412
+ };
413
+ }
414
+ function success(contract, quality, value, extra = {}) {
415
+ return {
416
+ conformance: "pass",
417
+ quality,
418
+ sourceId: resultContractSourceId(contract),
419
+ validatorDigest: digest({ contract, value }),
420
+ ...extra
421
+ };
422
+ }
423
+ function parseJson(output) {
424
+ if (output === null || output.trim().length === 0) return { ok: false, reason: "missing final result" };
425
+ const parsed = parseJsonObjectPayload(output);
426
+ if (parsed.ok) return parsed;
427
+ return {
428
+ ok: false,
429
+ reason: parsed.reason === "not-object" ? "result must be a JSON object" : "result must be valid JSON"
430
+ };
431
+ }
432
+ function hasOnlyKeys(value, keys) {
433
+ const allowed = new Set(keys);
434
+ return Object.keys(value).every((key) => allowed.has(key));
435
+ }
436
+ function string(value) {
437
+ return typeof value === "string" && value.trim().length > 0;
438
+ }
439
+ function parseFindings(value) {
440
+ if (!Array.isArray(value)) return null;
441
+ const findings = [];
442
+ for (const entry of value) {
443
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry)) return null;
444
+ const finding = entry;
445
+ const line = finding.line;
446
+ if (!hasOnlyKeys(finding, ["claim", "path", "line"]) || !string(finding.claim) || !string(finding.path) || typeof line !== "number" || !Number.isSafeInteger(line) || line < 1) {
447
+ return null;
448
+ }
449
+ findings.push({ claim: finding.claim, path: finding.path, line });
450
+ }
451
+ return findings;
452
+ }
453
+ var RESULT_CONTRACT_KINDS = [
454
+ "architect-plan",
455
+ "scout-report",
456
+ "verifier-report",
457
+ "council-report",
458
+ "debugger-report",
459
+ "research-report",
460
+ "world-knowledge-report",
461
+ "mutation-report",
462
+ "provenance-report",
463
+ "external-delegation"
464
+ ];
465
+ function parseSubtasks(value) {
466
+ if (!Array.isArray(value) || value.length > 4) return null;
467
+ const subtasks = [];
468
+ const ids = /* @__PURE__ */ new Set();
469
+ for (const entry of value) {
470
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry)) return null;
471
+ const subtask = entry;
472
+ if (!hasOnlyKeys(subtask, ["id", "task", "dependencies", "expectedResultContract", "requestedAuthority"]) || !string(subtask.id) || !/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/u.test(subtask.id) || ids.has(subtask.id) || !string(subtask.task) || Buffer.byteLength(subtask.task, "utf8") > 4096 || !Array.isArray(subtask.dependencies) || subtask.dependencies.length > 4 || subtask.dependencies.some((dependency) => !string(dependency)) || new Set(subtask.dependencies).size !== subtask.dependencies.length || !RESULT_CONTRACT_KINDS.includes(subtask.expectedResultContract) || !AGENT_AUTOMATION_AUTHORITIES.includes(subtask.requestedAuthority)) {
473
+ return null;
474
+ }
475
+ ids.add(subtask.id);
476
+ subtasks.push({
477
+ id: subtask.id,
478
+ task: subtask.task,
479
+ dependencies: [...subtask.dependencies],
480
+ expectedResultContract: subtask.expectedResultContract,
481
+ requestedAuthority: subtask.requestedAuthority
482
+ });
483
+ }
484
+ for (const subtask of subtasks) {
485
+ if (subtask.dependencies.some((dependency) => dependency === subtask.id || !ids.has(dependency))) return null;
486
+ }
487
+ const remaining = new Set(ids);
488
+ const completed = /* @__PURE__ */ new Set();
489
+ while (remaining.size > 0) {
490
+ const ready = subtasks.filter(
491
+ (subtask) => remaining.has(subtask.id) && subtask.dependencies.every((dependency) => completed.has(dependency))
492
+ );
493
+ if (ready.length === 0) return null;
494
+ for (const subtask of ready) {
495
+ remaining.delete(subtask.id);
496
+ completed.add(subtask.id);
497
+ }
498
+ }
499
+ return subtasks;
500
+ }
501
+ function isContextHandbookResult(value) {
502
+ if (!hasOnlyKeys(value, ["projectName", "identity", "conventions", "invariants", "sections"])) return false;
503
+ if (!string(value.projectName) || !string(value.identity)) return false;
504
+ if (!Array.isArray(value.conventions) || value.conventions.some((entry) => !string(entry))) return false;
505
+ if (!Array.isArray(value.invariants) || value.invariants.some((entry) => !string(entry))) return false;
506
+ if (!Array.isArray(value.sections)) return false;
507
+ return value.sections.every((entry) => {
508
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry)) return false;
509
+ const section = entry;
510
+ return hasOnlyKeys(section, ["title", "body"]) && string(section.title) && string(section.body);
511
+ });
512
+ }
513
+ function validateContextHandbook(contract, output) {
514
+ const parsed = parseJson(output);
515
+ if (!parsed.ok) return failure(contract, "fail", parsed.reason);
516
+ if (!isContextHandbookResult(parsed.value)) {
517
+ return failure(
518
+ contract,
519
+ "fail",
520
+ "context handbook result must carry projectName, identity, conventions[], invariants[], and sections[{title, body}] and nothing else"
521
+ );
522
+ }
523
+ return success(contract, "unmeasured", parsed.value);
524
+ }
525
+ function salvageScoutClaims(value) {
526
+ const grounded = [];
527
+ const ungrounded = [];
528
+ if (!Array.isArray(value)) return { grounded, ungrounded };
529
+ for (const entry of value) {
530
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry)) continue;
531
+ const finding = entry;
532
+ if (!string(finding.claim)) continue;
533
+ const line = finding.line;
534
+ if (string(finding.path) && typeof line === "number" && Number.isSafeInteger(line) && line >= 1) {
535
+ grounded.push({ claim: finding.claim, path: finding.path, line });
536
+ continue;
537
+ }
538
+ ungrounded.push(finding.claim);
539
+ }
540
+ return { grounded, ungrounded };
541
+ }
542
+ function degradedScout(contract, value, reason) {
543
+ const salvaged = salvageScoutClaims(value.findings);
544
+ if (salvaged.grounded.length === 0 && salvaged.ungrounded.length === 0) return null;
545
+ const degradedReason = `${reason} (accepted as a degraded reconnaissance result; findings are leads, not validation evidence)`;
546
+ const scout = {
547
+ findings: salvaged.grounded,
548
+ citations: salvaged.grounded.map(({ path: citedPath, line }) => ({ path: citedPath, line })),
549
+ needsSplit: false,
550
+ proposedSubtasks: [],
551
+ ungroundedClaims: salvaged.ungrounded,
552
+ degradedReason
553
+ };
554
+ return success(contract, "unmeasured", scout, { scout, reason: degradedReason });
555
+ }
556
+ function validateScout(contract, output) {
557
+ const parsed = parseJson(output);
558
+ if (!parsed.ok) return failure(contract, "fail", parsed.reason);
559
+ const value = parsed.value;
560
+ const degrade = (reason) => degradedScout(contract, value, reason) ?? failure(contract, "fail", reason);
561
+ if (!hasOnlyKeys(value, ["findings", "needsSplit", "proposedSubtasks"])) {
562
+ return degrade("Scout result has unknown fields");
563
+ }
564
+ const findings = parseFindings(value.findings);
565
+ const proposedSubtasks = parseSubtasks(value.proposedSubtasks);
566
+ if (findings === null || typeof value.needsSplit !== "boolean" || proposedSubtasks === null) {
567
+ return degrade(
568
+ "Scout result must carry findings as {claim, path, line} objects, needsSplit, and 0..4 typed proposed subtasks"
569
+ );
570
+ }
571
+ if (value.needsSplit !== proposedSubtasks.length > 0) {
572
+ return degrade("Scout needsSplit must agree with proposedSubtasks");
573
+ }
574
+ if (findings.length === 0 && !value.needsSplit) {
575
+ return degrade("Scout result must carry at least one cited finding, or set needsSplit");
576
+ }
577
+ if (value.needsSplit && findings.length > 0) {
578
+ return degrade("Scout split recommendations carry typed subtasks instead of findings");
579
+ }
580
+ const scout = {
581
+ findings,
582
+ citations: findings.map(({ path: citedPath, line }) => ({ path: citedPath, line })),
583
+ needsSplit: value.needsSplit,
584
+ proposedSubtasks
585
+ };
586
+ return success(contract, "pass", scout, { scout });
587
+ }
588
+ function parseChecks(value) {
589
+ if (!Array.isArray(value) || value.length === 0) return null;
590
+ const checks = [];
591
+ for (const entry of value) {
592
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry)) return null;
593
+ const check = entry;
594
+ if (!hasOnlyKeys(check, ["name", "passed", "evidence"]) || !string(check.name) || typeof check.passed !== "boolean" || !string(check.evidence)) {
595
+ return null;
596
+ }
597
+ checks.push({ name: check.name, passed: check.passed, evidence: check.evidence });
598
+ }
599
+ return checks;
600
+ }
601
+ function citationWithinWorkspace(cwd, citedPath) {
602
+ const relative = path.relative(cwd, citedPath);
603
+ if (relative === "") return true;
604
+ return !(relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative));
605
+ }
606
+ function directoryCitationDigest(cwd, citedPath) {
607
+ const relative = path.relative(cwd, citedPath);
608
+ return createHash2("sha256").update(`directory:${relative === "" ? "." : relative}`, "utf8").digest("hex");
609
+ }
610
+ function validateScoutCitation(input, citation) {
611
+ const cwd = path.resolve(input.cwd);
612
+ const citedPath = path.resolve(cwd, citation.path);
613
+ if (!citationWithinWorkspace(cwd, citedPath)) {
614
+ return { ok: false, reason: `Scout citation path escapes the workspace: ${citation.path}` };
615
+ }
616
+ if (input.filesystem.isDirectory?.(citedPath) === true) {
617
+ return { ok: true, evidence: { ...citation, contentDigest: directoryCitationDigest(cwd, citedPath) } };
618
+ }
619
+ const content = input.filesystem.readFile(citedPath);
620
+ if (content === null) return { ok: false, reason: `Scout citation cannot be read: ${citation.path}` };
621
+ const lineCount = content.split(/\r\n|\r|\n/u).length;
622
+ if (citation.line > lineCount) {
623
+ return { ok: false, reason: `Scout citation is past end of file: ${citation.path}:${citation.line}` };
624
+ }
625
+ if (input.observedReadRanges !== void 0) {
626
+ const spans = input.observedReadRanges.get(citedPath) ?? [];
627
+ if (!spans.some(([start, end]) => citation.line >= start && citation.line <= end)) {
628
+ const observed = spans.length === 0 ? "this run never read that file" : `this run read only ${spans.map(([start, end]) => `${start}-${end}`).join(", ")}`;
629
+ return {
630
+ ok: false,
631
+ reason: `Scout citation is not grounded in a live read: ${citation.path}:${citation.line} (${observed})`
632
+ };
633
+ }
634
+ }
635
+ return {
636
+ ok: true,
637
+ evidence: { ...citation, contentDigest: createHash2("sha256").update(content, "utf8").digest("hex") }
638
+ };
639
+ }
640
+ function validateScoutCitations(input, citations) {
641
+ const evidence = [];
642
+ for (const citation of citations) {
643
+ const checked = validateScoutCitation(input, citation);
644
+ if (!checked.ok) return checked;
645
+ evidence.push(checked.evidence);
646
+ }
647
+ return { ok: true, evidence };
648
+ }
649
+ function groundDegradedScout(contract, input, scout, degradedReason) {
650
+ const grounded = [];
651
+ const evidence = [];
652
+ const demoted = [];
653
+ for (const finding of scout.findings) {
654
+ const checked = validateScoutCitation(input, { path: finding.path, line: finding.line });
655
+ if (checked.ok) {
656
+ grounded.push(finding);
657
+ evidence.push(checked.evidence);
658
+ continue;
659
+ }
660
+ demoted.push(finding.claim);
661
+ }
662
+ const degraded = {
663
+ findings: grounded,
664
+ citations: grounded.map(({ path: citedPath, line }) => ({ path: citedPath, line })),
665
+ needsSplit: false,
666
+ proposedSubtasks: [],
667
+ ungroundedClaims: [...scout.ungroundedClaims ?? [], ...demoted],
668
+ degradedReason
669
+ };
670
+ return success(contract, "unmeasured", { scout: degraded, evidence }, { scout: degraded, reason: degradedReason });
671
+ }
672
+ function validateVerifier(contract, output) {
673
+ const parsed = parseJson(output);
674
+ if (!parsed.ok) return failure(contract, "fail", `Verifier result payload failed: ${parsed.reason}`);
675
+ const value = parsed.value;
676
+ const unknown = Object.keys(value).filter((key) => key !== "verdict" && key !== "checks");
677
+ if (unknown.length > 0) {
678
+ return failure(
679
+ contract,
680
+ "fail",
681
+ `Verifier result field${unknown.length === 1 ? "" : "s"} ${unknown.join(", ")} ${unknown.length === 1 ? "is" : "are"} not legal; legal top-level fields are verdict and checks`
682
+ );
683
+ }
684
+ if (value.verdict !== "pass" && value.verdict !== "fail") {
685
+ return failure(contract, "fail", 'Verifier field "verdict" must be one of: pass | fail');
686
+ }
687
+ if (!Array.isArray(value.checks) || value.checks.length === 0) {
688
+ return failure(
689
+ contract,
690
+ "fail",
691
+ 'Verifier field "checks" must be a non-empty array of {name, passed, evidence}; each checks[].passed value must be one of: true | false'
692
+ );
693
+ }
694
+ const checks = [];
695
+ for (const [index, raw] of value.checks.entries()) {
696
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
697
+ return failure(contract, "fail", `Verifier field "checks[${index}]" must be an object`);
698
+ }
699
+ const check = raw;
700
+ const checkUnknown = Object.keys(check).filter((key) => key !== "name" && key !== "passed" && key !== "evidence");
701
+ if (checkUnknown.length > 0) {
702
+ return failure(
703
+ contract,
704
+ "fail",
705
+ `Verifier field "checks[${index}].${checkUnknown[0]}" is not legal; legal check fields are name, passed, and evidence`
706
+ );
707
+ }
708
+ if (!string(check.name)) {
709
+ return failure(contract, "fail", `Verifier field "checks[${index}].name" must be a non-empty string`);
710
+ }
711
+ if (typeof check.passed !== "boolean") {
712
+ return failure(contract, "fail", `Verifier field "checks[${index}].passed" must be one of: true | false`);
713
+ }
714
+ if (!string(check.evidence)) {
715
+ return failure(contract, "fail", `Verifier field "checks[${index}].evidence" must be a non-empty string`);
716
+ }
717
+ checks.push({ name: check.name, passed: check.passed, evidence: check.evidence });
718
+ }
719
+ if (value.verdict === "pass" !== checks.every((check) => check.passed)) {
720
+ return failure(
721
+ contract,
722
+ "fail",
723
+ 'Verifier field "verdict" must agree with every checks[].passed value; verdict legal values are pass | fail and checks[].passed legal values are true | false'
724
+ );
725
+ }
726
+ const verifier = { verdict: value.verdict, checks };
727
+ return success(contract, value.verdict, verifier, { verifier });
728
+ }
729
+ function parseVerifierResult(output) {
730
+ const validation = validateVerifier({ kind: "verifier-report" }, output);
731
+ return validation.verifier ?? null;
732
+ }
733
+ function validateOracle(contract, output) {
734
+ const parsed = parseJson(output);
735
+ if (!parsed.ok) return failure(contract, "unmeasured", parsed.reason);
736
+ const value = parsed.value;
737
+ if (!hasOnlyKeys(value, ["verdict", "challenge", "changesMyMind", "citedDecisions"]) || !string(value.verdict) || !string(value.challenge) || !string(value.changesMyMind) || !Array.isArray(value.citedDecisions) || value.citedDecisions.some((entry) => !string(entry))) {
738
+ return failure(
739
+ contract,
740
+ "unmeasured",
741
+ 'Oracle result must carry verdict, challenge, changesMyMind, and a citedDecisions array of strings, for example {"verdict":"consistent with decision routing.target","challenge":"...","changesMyMind":"...","citedDecisions":["routing.target"]}'
742
+ );
743
+ }
744
+ return success(contract, "unmeasured", value);
745
+ }
746
+ function parseOracleResult(output) {
747
+ const validation = validateOracle({ kind: "oracle-report" }, output);
748
+ if (validation.conformance !== "pass") return null;
749
+ const parsed = parseJson(output);
750
+ if (!parsed.ok) return null;
751
+ return {
752
+ verdict: String(parsed.value.verdict),
753
+ challenge: String(parsed.value.challenge),
754
+ changesMyMind: String(parsed.value.changesMyMind),
755
+ citedDecisions: parsed.value.citedDecisions.map((entry) => String(entry))
756
+ };
757
+ }
758
+ function validateCodeReport(contract, output) {
759
+ const parsed = parseJson(output);
760
+ if (!parsed.ok) return failure(contract, "unmeasured", parsed.reason);
761
+ const value = parsed.value;
762
+ if (!hasOnlyKeys(value, ["passed", "exitCode", "checks", "artifactPaths", "outputExcerpt"]) || typeof value.passed !== "boolean" || typeof value.exitCode !== "number" || !Number.isSafeInteger(value.exitCode) || typeof value.outputExcerpt !== "string" || !Array.isArray(value.artifactPaths) || value.artifactPaths.some((entry) => !string(entry))) {
763
+ return failure(
764
+ contract,
765
+ "unmeasured",
766
+ "Code result must carry passed, integer exitCode, checks, artifactPaths, and outputExcerpt"
767
+ );
768
+ }
769
+ const checks = parseChecks(value.checks);
770
+ if (checks === null) return failure(contract, "unmeasured", "Code result must carry typed checks");
771
+ if (value.passed !== (value.exitCode === 0) || value.passed !== checks.every((check) => check.passed)) {
772
+ return failure(contract, "unmeasured", "Code result passed must agree with its exit code and every check");
773
+ }
774
+ return success(contract, "unmeasured", value);
775
+ }
776
+ var RESULT_COMMIT_MESSAGE_MAX_BYTES = 1e3;
777
+ var RESULT_SUMMARY_DEFAULT_MAX_BYTES = 16384;
778
+ var RESULT_SUMMARY_MAX_BYTES_CEILING = 32768;
779
+ var RESULT_OUTPUT_ENVELOPE_HEADROOM_BYTES = 4096;
780
+ function resultSummaryMaxBytes(contract) {
781
+ if (contract.kind !== "mutation-report") return RESULT_COMMIT_MESSAGE_MAX_BYTES;
782
+ return contract.maxSummaryBytes ?? RESULT_SUMMARY_DEFAULT_MAX_BYTES;
783
+ }
784
+ function parseResultSummaryMaxBytes(value, label) {
785
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1 || value > RESULT_SUMMARY_MAX_BYTES_CEILING) {
786
+ throw new Error(`${label} must be an integer between 1 and ${RESULT_SUMMARY_MAX_BYTES_CEILING}`);
787
+ }
788
+ return value;
789
+ }
790
+ function withResultSummaryAllowance(contract, maxSummaryBytes) {
791
+ if (contract.kind !== "mutation-report") return contract;
792
+ return { kind: "mutation-report", maxSummaryBytes: parseResultSummaryMaxBytes(maxSummaryBytes, "maxSummaryBytes") };
793
+ }
794
+ function resultContractOutputBytes(contract) {
795
+ if (contract === null || contract === void 0 || contract.kind !== "mutation-report") return null;
796
+ return 2 * resultSummaryMaxBytes(contract) + 2 * RESULT_COMMIT_MESSAGE_MAX_BYTES + RESULT_OUTPUT_ENVELOPE_HEADROOM_BYTES;
797
+ }
798
+ var AUTHORSHIP_FIELDS = ["commitMessage", "summary"];
799
+ function hasControlCharacters(value) {
800
+ for (const character of value) {
801
+ const code = character.codePointAt(0) ?? 0;
802
+ if (code === 127) return true;
803
+ if (code < 32 && character !== "\n" && character !== "\r" && character !== " ") return true;
804
+ }
805
+ return false;
806
+ }
807
+ function normalizeAuthored(value) {
808
+ return value.replace(/\r\n/gu, "\n").replace(/\r/gu, "\n").trim();
809
+ }
810
+ function validateAuthorship(value, summaryMaxBytes) {
811
+ for (const field of AUTHORSHIP_FIELDS) {
812
+ const maxBytes = field === "summary" ? summaryMaxBytes : RESULT_COMMIT_MESSAGE_MAX_BYTES;
813
+ const raw = value[field];
814
+ if (raw === void 0 || raw === null) continue;
815
+ if (typeof raw !== "string") return `${field} must be a string when present`;
816
+ if (raw.trim().length === 0) continue;
817
+ const bytes = Buffer.byteLength(raw, "utf8");
818
+ if (bytes > maxBytes) return `${field} must be at most ${maxBytes} UTF-8 bytes (${bytes} given)`;
819
+ if (hasControlCharacters(raw)) return `${field} must not contain control characters`;
820
+ }
821
+ return null;
822
+ }
823
+ function resultContractAuthorship(contract, output) {
824
+ const empty = { commitMessage: null, summary: null };
825
+ if (contract.kind !== "mutation-report" && contract.kind !== "architect-plan") return empty;
826
+ const parsed = parseJson(output);
827
+ if (!parsed.ok || validateAuthorship(parsed.value, resultSummaryMaxBytes(contract)) !== null) return empty;
828
+ const read = (field) => {
829
+ const raw = parsed.value[field];
830
+ if (typeof raw !== "string") return null;
831
+ const normalized = normalizeAuthored(raw);
832
+ return normalized.length === 0 ? null : normalized;
833
+ };
834
+ return { commitMessage: read("commitMessage"), summary: read("summary") };
835
+ }
836
+ function validateDebugger(contract, output) {
837
+ const parsed = parseJson(output);
838
+ if (!parsed.ok) return failure(contract, "unmeasured", `Debugger result payload failed: ${parsed.reason}`);
839
+ const value = parsed.value;
840
+ const unknown = Object.keys(value).filter(
841
+ (key) => key !== "diagnosis" && key !== "reproduction" && key !== "evidence"
842
+ );
843
+ if (unknown.length > 0) {
844
+ return failure(
845
+ contract,
846
+ "unmeasured",
847
+ `Debugger result field${unknown.length === 1 ? "" : "s"} ${unknown.join(", ")} ${unknown.length === 1 ? "is" : "are"} not legal; legal top-level fields are diagnosis, reproduction, and evidence`
848
+ );
849
+ }
850
+ if (!string(value.diagnosis)) {
851
+ return failure(contract, "unmeasured", 'Debugger field "diagnosis" must be a non-empty string');
852
+ }
853
+ if (value.reproduction !== "reproduced" && value.reproduction !== "not-reproduced" && value.reproduction !== "unknown") {
854
+ return failure(
855
+ contract,
856
+ "unmeasured",
857
+ 'Debugger field "reproduction" must be one of: reproduced | not-reproduced | unknown'
858
+ );
859
+ }
860
+ if (!Array.isArray(value.evidence)) {
861
+ return failure(contract, "unmeasured", 'Debugger field "evidence" must be an array of strings');
862
+ }
863
+ const malformedEvidence = value.evidence.findIndex((entry) => !string(entry));
864
+ if (malformedEvidence >= 0) {
865
+ return failure(contract, "unmeasured", `Debugger field "evidence[${malformedEvidence}]" must be a non-empty string`);
866
+ }
867
+ return success(contract, "unmeasured", value);
868
+ }
869
+ function validateResearch(contract, output, networkAllowed) {
870
+ const parsed = parseJson(output);
871
+ if (!parsed.ok) return failure(contract, "unmeasured", `Research result payload failed: ${parsed.reason}`);
872
+ const value = parsed.value;
873
+ const unknown = Object.keys(value).filter((key) => key !== "source" && key !== "findings");
874
+ if (unknown.length > 0) {
875
+ return failure(
876
+ contract,
877
+ "unmeasured",
878
+ `Research result field${unknown.length === 1 ? "" : "s"} ${unknown.join(", ")} ${unknown.length === 1 ? "is" : "are"} not legal; legal top-level fields are source and findings`
879
+ );
880
+ }
881
+ if (value.source !== "local" && value.source !== "external") {
882
+ return failure(contract, "unmeasured", 'Research field "source" must be one of: local | external');
883
+ }
884
+ if (!Array.isArray(value.findings)) {
885
+ return failure(contract, "unmeasured", 'Research field "findings" must be an array of {claim, evidence} objects');
886
+ }
887
+ if (value.source === "external" && !networkAllowed) {
888
+ return failure(
889
+ contract,
890
+ "unmeasured",
891
+ 'Research field "source" is external but the run has no allowed network posture; legal values are local | external, and use local for workspace-only evidence'
892
+ );
893
+ }
894
+ for (const [index, finding] of value.findings.entries()) {
895
+ if (finding === null || typeof finding !== "object" || Array.isArray(finding)) {
896
+ return failure(contract, "unmeasured", `Research field "findings[${index}]" must be an object`);
897
+ }
898
+ const record = finding;
899
+ const findingUnknown = Object.keys(record).filter((key) => key !== "claim" && key !== "evidence");
900
+ if (findingUnknown.length > 0) {
901
+ return failure(
902
+ contract,
903
+ "unmeasured",
904
+ `Research field "findings[${index}].${findingUnknown[0]}" is not legal; legal finding fields are claim and evidence`
905
+ );
906
+ }
907
+ if (!string(record.claim)) {
908
+ return failure(contract, "unmeasured", `Research field "findings[${index}].claim" must be a non-empty string`);
909
+ }
910
+ if (!string(record.evidence)) {
911
+ return failure(contract, "unmeasured", `Research field "findings[${index}].evidence" must be a non-empty string`);
912
+ }
913
+ }
914
+ return success(contract, "unmeasured", value);
915
+ }
916
+ function validateWorldKnowledge(contract, output, externalSourcesAllowed) {
917
+ const parsed = parseJson(output);
918
+ if (!parsed.ok) return failure(contract, "unmeasured", `World-knowledge payload failed: ${parsed.reason}`);
919
+ const value = parsed.value;
920
+ const legal = ["discovery", "facts", "synthesis", "uncertainties", "followUpVerification"];
921
+ const unknown = Object.keys(value).filter((key) => !legal.includes(key));
922
+ if (unknown.length > 0) {
923
+ return failure(contract, "unmeasured", `World-knowledge field '${unknown[0]}' is not legal`);
924
+ }
925
+ if (value.discovery !== "performed" && value.discovery !== "caller-supplied-only" && value.discovery !== "unavailable") {
926
+ return failure(
927
+ contract,
928
+ "unmeasured",
929
+ 'World-knowledge field "discovery" must be one of: performed | caller-supplied-only | unavailable'
930
+ );
931
+ }
932
+ if (value.discovery === "performed" && !externalSourcesAllowed) {
933
+ return failure(
934
+ contract,
935
+ "unmeasured",
936
+ 'World-knowledge field "discovery" is performed but this run had no external-source posture'
937
+ );
938
+ }
939
+ if (!Array.isArray(value.facts)) {
940
+ return failure(contract, "unmeasured", 'World-knowledge field "facts" must be an array');
941
+ }
942
+ for (const [index, finding] of value.facts.entries()) {
943
+ if (!finding || typeof finding !== "object" || Array.isArray(finding)) {
944
+ return failure(contract, "unmeasured", `World-knowledge field "facts[${index}]" must be an object`);
945
+ }
946
+ const fact = finding;
947
+ const factUnknown = Object.keys(fact).filter((key) => !["claim", "evidence", "sources"].includes(key));
948
+ if (factUnknown.length > 0) {
949
+ return failure(contract, "unmeasured", `World-knowledge field "facts[${index}].${factUnknown[0]}" is not legal`);
950
+ }
951
+ if (!string(fact.claim) || !string(fact.evidence) || !Array.isArray(fact.sources)) {
952
+ return failure(
953
+ contract,
954
+ "unmeasured",
955
+ `World-knowledge field "facts[${index}]" requires non-empty claim/evidence strings and a sources array`
956
+ );
957
+ }
958
+ if (fact.sources.some((source) => !string(source))) {
959
+ return failure(contract, "unmeasured", `World-knowledge field "facts[${index}].sources" must contain strings`);
960
+ }
961
+ }
962
+ for (const field of ["synthesis", "uncertainties", "followUpVerification"]) {
963
+ const entries = value[field];
964
+ if (!Array.isArray(entries) || entries.some((entry) => !string(entry))) {
965
+ return failure(contract, "unmeasured", `World-knowledge field "${field}" must be an array of non-empty strings`);
966
+ }
967
+ }
968
+ return success(contract, "unmeasured", value);
969
+ }
970
+ function describeWriteSet(effects, cwd) {
971
+ if (effects.mutatedPaths.size === 0) return "this run wrote nothing";
972
+ const written = [...effects.mutatedPaths].map((target) => path.relative(cwd, target) || target).sort().slice(0, MUTATION_WRITE_SET_REASON_LIMIT);
973
+ const more = effects.mutatedPaths.size - written.length;
974
+ return `this run wrote ${written.join(", ")}${more > 0 ? ` (+${more} more)` : ""}`;
975
+ }
976
+ var MUTATION_WRITE_SET_REASON_LIMIT = 8;
977
+ function pathIsPresent(filesystem, target) {
978
+ if (filesystem.pathExists === void 0) return true;
979
+ return filesystem.pathExists(target);
980
+ }
981
+ var MUTATION_VALIDATION_EXAMPLE = '{"name":"npm test","passed":true,"evidence":"exit 0"}';
982
+ function mutationValidationsReason(value) {
983
+ const empty = Array.isArray(value) && value.length === 0;
984
+ if (empty) {
985
+ return `Mutation result must carry typed validation results: validations was empty. Emit one entry per check this run actually made, each shaped like ${MUTATION_VALIDATION_EXAMPLE}. A run that only read files still names the read and cites what it saw.`;
986
+ }
987
+ return `Mutation result must carry typed validation results: every validations entry is shaped like ${MUTATION_VALIDATION_EXAMPLE}, with a string name, a boolean passed, a string evidence, and no other keys.`;
988
+ }
989
+ function validateMutation(contract, input) {
990
+ if (input.outputTruncated === true && input.output !== null) {
991
+ const bound = resultContractOutputBytes(contract) ?? Buffer.byteLength(input.output, "utf8");
992
+ return failure(
993
+ contract,
994
+ "unmeasured",
995
+ `result exceeded the sealed output bound of ${bound} bytes and was truncated; keep summary within ${resultSummaryMaxBytes(contract)} UTF-8 bytes or state the limitation`
996
+ );
997
+ }
998
+ const parsed = parseJson(input.output);
999
+ if (!parsed.ok) return failure(contract, "unmeasured", parsed.reason);
1000
+ const value = parsed.value;
1001
+ if (!hasOnlyKeys(value, ["mutatedPaths", "validations", "commitMessage", "summary"]) || !Array.isArray(value.mutatedPaths) || value.mutatedPaths.some((entry) => !string(entry))) {
1002
+ return failure(contract, "unmeasured", "Mutation result must carry mutatedPaths and validations");
1003
+ }
1004
+ const authorship = validateAuthorship(value, resultSummaryMaxBytes(contract));
1005
+ if (authorship !== null) return failure(contract, "unmeasured", authorship);
1006
+ const validations = parseChecks(value.validations);
1007
+ if (validations === null) return failure(contract, "unmeasured", mutationValidationsReason(value.validations));
1008
+ const reportedFailure = !validations.every((check) => check.passed);
1009
+ const effects = input.observedRunEffects;
1010
+ if (effects === void 0) return success(contract, reportedFailure ? "fail" : "pass", value);
1011
+ const cwd = path.resolve(input.cwd);
1012
+ let unverifiedMutation = false;
1013
+ for (const reported of value.mutatedPaths) {
1014
+ const target = path.resolve(cwd, reported);
1015
+ if (effects.mutatedPaths.has(target)) continue;
1016
+ if (effects.failedMutationPaths.has(target)) {
1017
+ return failure(
1018
+ contract,
1019
+ "unmeasured",
1020
+ `Mutation result names a path whose only write this run attempted was refused: ${reported} (${describeWriteSet(effects, cwd)})`
1021
+ );
1022
+ }
1023
+ if (pathIsPresent(input.filesystem, target)) {
1024
+ unverifiedMutation = true;
1025
+ continue;
1026
+ }
1027
+ return failure(
1028
+ contract,
1029
+ "unmeasured",
1030
+ `Mutation result names a path this run never wrote and that does not exist: ${reported} (${describeWriteSet(effects, cwd)})`
1031
+ );
1032
+ }
1033
+ if (reportedFailure) return success(contract, "fail", value);
1034
+ const measured = !unverifiedMutation && effects.validationCommands.size > 0;
1035
+ return success(contract, measured ? "pass" : "unmeasured", value);
1036
+ }
1037
+ function validateProvenance(contract, output) {
1038
+ const parsed = parseJson(output);
1039
+ if (!parsed.ok) return failure(contract, "unmeasured", parsed.reason);
1040
+ const value = parsed.value;
1041
+ if (!hasOnlyKeys(value, ["confirmedFacts", "missingEvidence", "nextInspections"]) || ![value.confirmedFacts, value.missingEvidence, value.nextInspections].every(
1042
+ (entry) => Array.isArray(entry) && entry.every((item) => string(item))
1043
+ )) {
1044
+ return failure(
1045
+ contract,
1046
+ "unmeasured",
1047
+ "Provenance result must carry confirmedFacts, missingEvidence, and nextInspections"
1048
+ );
1049
+ }
1050
+ return success(contract, "unmeasured", value);
1051
+ }
1052
+ function validateArchitect(contract, input) {
1053
+ const artifactPath = path.resolve(input.cwd, contract.path);
1054
+ const content = input.filesystem.readFile(artifactPath);
1055
+ if (content === null || content.trim().length === 0) {
1056
+ return failure(contract, "unmeasured", `required plan artifact is missing or empty: ${contract.path}`);
1057
+ }
1058
+ return success(contract, "unmeasured", {
1059
+ path: contract.path,
1060
+ artifactDigest: createHash2("sha256").update(content, "utf8").digest("hex")
1061
+ });
1062
+ }
1063
+ function parseScoutResult(output) {
1064
+ const validation = validateScout({ kind: "scout-report" }, output);
1065
+ if (validation.conformance !== "pass" || validation.scout === void 0) return null;
1066
+ return validation.scout.degradedReason === void 0 ? validation.scout : null;
1067
+ }
1068
+ function validateResultContract(input) {
1069
+ switch (input.contract.kind) {
1070
+ case "architect-plan":
1071
+ return validateArchitect(input.contract, input);
1072
+ case "scout-report": {
1073
+ const validation = validateScout(input.contract, input.output);
1074
+ if (validation.scout === void 0) return validation;
1075
+ const degradedReason = validation.scout.degradedReason;
1076
+ if (degradedReason !== void 0) {
1077
+ return groundDegradedScout(input.contract, input, validation.scout, degradedReason);
1078
+ }
1079
+ const citations = validateScoutCitations(input, validation.scout.citations);
1080
+ return citations.ok ? success(
1081
+ input.contract,
1082
+ "pass",
1083
+ { scout: validation.scout, evidence: citations.evidence },
1084
+ { scout: validation.scout }
1085
+ ) : failure(input.contract, "fail", citations.reason);
1086
+ }
1087
+ case "verifier-report":
1088
+ return validateVerifier(input.contract, input.output);
1089
+ case "council-report": {
1090
+ const report = parseCouncilReport(input.output);
1091
+ return report === null ? failure(input.contract, "fail", "council-report is malformed") : success(input.contract, "unmeasured", { council: report });
1092
+ }
1093
+ case "council-ballot":
1094
+ return validateCouncilBallot(input.contract, input.output);
1095
+ case "debugger-report":
1096
+ return validateDebugger(input.contract, input.output);
1097
+ case "research-report":
1098
+ return validateResearch(input.contract, input.output, input.networkAllowed);
1099
+ case "world-knowledge-report":
1100
+ return validateWorldKnowledge(input.contract, input.output, input.networkAllowed);
1101
+ case "mutation-report":
1102
+ return validateMutation(input.contract, input);
1103
+ case "provenance-report":
1104
+ return validateProvenance(input.contract, input.output);
1105
+ case "delegation-plan": {
1106
+ const plan = parseDelegationPlanResult(input.output);
1107
+ return plan === null ? failure(
1108
+ input.contract,
1109
+ "fail",
1110
+ "delegation-plan must carry tasks with id, agent, description, depends_on, writes, and optional mode"
1111
+ ) : success(input.contract, "unmeasured", plan, { delegationPlan: plan });
1112
+ }
1113
+ case "oracle-report":
1114
+ return validateOracle(input.contract, input.output);
1115
+ case "external-delegation":
1116
+ return success(input.contract, "unmeasured", { external: true });
1117
+ case "artifact-report": {
1118
+ if (input.contract.path !== void 0) {
1119
+ const content = input.filesystem.readFile(path.resolve(input.cwd, input.contract.path));
1120
+ if (content === null) {
1121
+ return failure(
1122
+ input.contract,
1123
+ "unmeasured",
1124
+ `Required artifact is missing or unreadable: ${JSON.stringify(input.contract.path)}`
1125
+ );
1126
+ }
1127
+ if (content.trim().length === 0) {
1128
+ return failure(input.contract, "unmeasured", `Required artifact is empty: ${JSON.stringify(input.contract.path)}`);
1129
+ }
1130
+ }
1131
+ return success(input.contract, "unmeasured", { artifact: true });
1132
+ }
1133
+ case "context-handbook":
1134
+ return validateContextHandbook(input.contract, input.output);
1135
+ case "code-report":
1136
+ return validateCodeReport(input.contract, input.output);
1137
+ }
1138
+ }
1139
+ function validateRecipeResult(input) {
1140
+ if (input.contract === null) return null;
1141
+ if (!input.reachedTerminalResult) {
1142
+ return {
1143
+ applicable: false,
1144
+ fact: {
1145
+ sourceId: resultContractSourceId(input.contract),
1146
+ validatorDigest: digest({ contract: input.contract, reached: false }),
1147
+ conformance: "not-reached",
1148
+ quality: "unmeasured"
1149
+ }
1150
+ };
1151
+ }
1152
+ const validation = validateResultContract({
1153
+ contract: input.contract,
1154
+ output: input.output,
1155
+ cwd: input.cwd,
1156
+ networkAllowed: input.networkAllowed,
1157
+ filesystem: input.filesystem,
1158
+ ...input.observedRunEffects !== void 0 ? { observedRunEffects: input.observedRunEffects } : {},
1159
+ ...input.outputTruncated !== void 0 ? { outputTruncated: input.outputTruncated } : {}
1160
+ });
1161
+ return {
1162
+ applicable: true,
1163
+ validation,
1164
+ fact: {
1165
+ sourceId: validation.sourceId,
1166
+ validatorDigest: validation.validatorDigest,
1167
+ conformance: validation.conformance,
1168
+ quality: validation.quality
1169
+ }
1170
+ };
1171
+ }
1172
+ var RESULT_CONTRACT_REPAIR_LIMIT = 2;
1173
+ var RESULT_CONTRACT_ANCHOR_LIMIT = 12;
1174
+ function resultContractShape(contract) {
1175
+ switch (contract.kind) {
1176
+ case "architect-plan":
1177
+ return `a plan artifact written to ${contract.path}, then optionally {"commitMessage":"...","summary":"..."} describing it`;
1178
+ case "scout-report":
1179
+ return '{"findings":[{"claim":"what you observed","path":"src/file.ts","line":1}],"needsSplit":false,"proposedSubtasks":[]} or {"findings":[],"needsSplit":true,"proposedSubtasks":[{"id":"inspect","task":"Inspect the boundary","dependencies":[],"expectedResultContract":"scout-report","requestedAuthority":"read-only"}]} or, if you cannot produce a citation you are sure of, at least {"findings":[{"claim":"what you observed"}]}, which is accepted as an ungrounded lead rather than losing the run';
1180
+ case "verifier-report":
1181
+ return 'one of {"verdict":"pass","checks":[{"name":"npm run typecheck","passed":true,"evidence":"exit 0"}]} or {"verdict":"fail","checks":[{"name":"npm run typecheck","passed":false,"evidence":"exit 1"}]}; verdict legal values are pass | fail and checks[].passed legal values are true | false';
1182
+ case "council-report":
1183
+ return '{"members":[{"label":"alpha","runId":"run-1","round":1,"answer":"..."}],"synthesis":{"kind":"none"}}';
1184
+ case "council-ballot":
1185
+ return COUNCIL_BALLOT_SHAPE;
1186
+ case "debugger-report":
1187
+ return 'one of {"diagnosis":"...","reproduction":"reproduced","evidence":["..."]}, {"diagnosis":"...","reproduction":"not-reproduced","evidence":["..."]}, or {"diagnosis":"...","reproduction":"unknown","evidence":["..."]}; reproduction legal values are reproduced | not-reproduced | unknown';
1188
+ case "research-report":
1189
+ return 'one of {"source":"local","findings":[{"claim":"...","evidence":"..."}]} or {"source":"external","findings":[{"claim":"...","evidence":"..."}]}; source legal values are local | external';
1190
+ case "world-knowledge-report":
1191
+ return '{"discovery":"performed|caller-supplied-only|unavailable","facts":[{"claim":"...","evidence":"...","sources":["URL or document id"]}],"synthesis":["comparison or advisory conclusion"],"uncertainties":["..."],"followUpVerification":["..."]}';
1192
+ case "mutation-report":
1193
+ return `{"mutatedPaths":["src/file.ts"],"validations":[{"name":"npm test","passed":true,"evidence":"exit 0"}],"commitMessage":"optional: the commit message for this change","summary":"the requested explanation or deliverable, or a specific limitation; otherwise optional"}. summary allows at most ${resultSummaryMaxBytes(contract)} UTF-8 bytes and commitMessage at most ${RESULT_COMMIT_MESSAGE_MAX_BYTES} UTF-8 bytes. Preserve the requested explanation and citations in summary when repairing the report; if they cannot fit or be grounded, state that specific limitation. Report only actual mutations and checks; a read-only task has mutatedPaths:[] and names the source read in validations, never a command that did not run`;
1194
+ case "provenance-report":
1195
+ return '{"confirmedFacts":["..."],"missingEvidence":["..."],"nextInspections":["..."]}';
1196
+ case "delegation-plan":
1197
+ return '{"tasks":[{"id":"build","agent":"coder","description":"Implement the change","depends_on":[],"writes":["src"],"mode":"parallel"}]}';
1198
+ case "oracle-report":
1199
+ return '{"verdict":"one line","challenge":"the strongest objection you can mount","changesMyMind":"the evidence that would reverse the verdict","citedDecisions":["decision key or task id you relied on"]}';
1200
+ case "external-delegation":
1201
+ return "any final text";
1202
+ case "artifact-report":
1203
+ return contract.path === void 0 ? "any final text; the artifact you wrote at the location the task named is the result" : `any final text; the required artifact at ${JSON.stringify(contract.path)} must be readable and non-empty on disk`;
1204
+ case "context-handbook":
1205
+ return '{"projectName":"string","identity":"one sentence","conventions":[],"invariants":[],"sections":[{"title":"Architecture","body":"markdown that cites `real/path.ts` tokens"}]}';
1206
+ case "code-report":
1207
+ return '{"passed":false,"exitCode":1,"checks":[{"name":"test","passed":false,"evidence":"exit 1"}],"artifactPaths":["/path/command.log"],"outputExcerpt":"..."}';
1208
+ }
1209
+ }
1210
+ function resultContractRepairMessage(input) {
1211
+ const last = input.attempt >= RESULT_CONTRACT_REPAIR_LIMIT;
1212
+ const boundArtifact = input.contract.kind === "artifact-report" && input.contract.path !== void 0;
1213
+ const lines = [
1214
+ last ? "FINAL RESULT REQUIRED IN THIS RESPONSE. Your previous response still did not satisfy this run's result contract." : "Your previous response did not satisfy this run's result contract.",
1215
+ `Validator reason: ${input.reason}`,
1216
+ input.toolsAvailable === true ? "You may use the admitted tools to repair this validator failure, then emit the required terminal result." : "Tool use is over. Answer from the evidence you already gathered.",
1217
+ ...boundArtifact ? [
1218
+ `Required result: ${resultContractShape(input.contract)}`,
1219
+ input.toolsAvailable === true ? "Repair the required artifact on disk, then give a brief final status. Literal tool-call markup in final text does not write a file." : "State the limitation in a brief final status; the required artifact remains unsatisfied."
1220
+ ] : [
1221
+ `Emit exactly this shape and nothing else: ${resultContractShape(input.contract)}`,
1222
+ "Do not add prose, code fences, or commentary around it. Do not describe work you intend to do next."
1223
+ ]
1224
+ ];
1225
+ if (input.anchors.length > 0) {
1226
+ lines.push(
1227
+ "",
1228
+ "Source ranges you read successfully in this run (path:start-end, inclusive):",
1229
+ ...input.anchors.slice(-RESULT_CONTRACT_ANCHOR_LIMIT).map((anchor) => `- ${anchor}`)
1230
+ );
1231
+ }
1232
+ if (input.contract.kind === "scout-report") {
1233
+ lines.push(
1234
+ "For each finding, use the exact source line that supports its claim inside a listed read range. Range endpoints are not suggested citations.",
1235
+ "If a finding's supporting line cannot be confirmed from the source already returned, remove that finding and keep the confirmed findings. Never shift a rejected citation into range just to pass validation."
1236
+ );
1237
+ }
1238
+ return lines.join("\n");
1239
+ }
1240
+ var RESULT_CONTRACT_REPAIR_TOOL = "result_contract";
1241
+ function resultContractRepairMessages(input, origin) {
1242
+ const id = `clio-result-contract-repair-${input.attempt}`;
1243
+ const timestamp = Date.now();
1244
+ return [
1245
+ {
1246
+ role: "assistant",
1247
+ content: [{ type: "toolCall", id, name: RESULT_CONTRACT_REPAIR_TOOL, arguments: {} }],
1248
+ stopReason: "toolUse",
1249
+ usage: {
1250
+ input: 0,
1251
+ output: 0,
1252
+ cacheRead: 0,
1253
+ cacheWrite: 0,
1254
+ totalTokens: 0,
1255
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
1256
+ },
1257
+ ...origin,
1258
+ timestamp
1259
+ },
1260
+ {
1261
+ role: "toolResult",
1262
+ toolCallId: id,
1263
+ toolName: RESULT_CONTRACT_REPAIR_TOOL,
1264
+ content: [{ type: "text", text: resultContractRepairMessage(input) }],
1265
+ isError: true,
1266
+ timestamp
1267
+ }
1268
+ ];
1269
+ }
1270
+ var RECIPE_DECLARABLE_KINDS = [
1271
+ "scout-report",
1272
+ "verifier-report",
1273
+ "council-report",
1274
+ "debugger-report",
1275
+ "research-report",
1276
+ "world-knowledge-report",
1277
+ "mutation-report",
1278
+ "provenance-report",
1279
+ "oracle-report",
1280
+ "external-delegation",
1281
+ "artifact-report",
1282
+ "context-handbook",
1283
+ "delegation-plan"
1284
+ ];
1285
+ var COORDINATOR_AUTHORED_KINDS = ["council-ballot"];
1286
+ function parseContract(value, sourcePath, kinds, callerBoundArtifacts = false) {
1287
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
1288
+ throw new Error(`agent recipe: ${sourcePath}: resultContract must be an object`);
1289
+ }
1290
+ const record = value;
1291
+ if (typeof record.kind !== "string") throw new Error(`agent recipe: ${sourcePath}: resultContract.kind is required`);
1292
+ const keys = Object.keys(record);
1293
+ const only = (...allowed) => keys.every((key) => allowed.includes(key));
1294
+ if (record.kind === "architect-plan") {
1295
+ if (!only("kind", "path") || !string(record.path)) {
1296
+ throw new Error(`agent recipe: ${sourcePath}: architect-plan requires only non-empty path`);
1297
+ }
1298
+ if (path.isAbsolute(record.path) || record.path.split(/[\\/]/u).includes("..")) {
1299
+ throw new Error(`agent recipe: ${sourcePath}: architect-plan path must be workspace-relative`);
1300
+ }
1301
+ return { kind: "architect-plan", path: record.path };
1302
+ }
1303
+ if (record.kind === "artifact-report" && callerBoundArtifacts) {
1304
+ if (!only("kind", "path")) {
1305
+ throw new Error(`agent recipe: ${sourcePath}: artifact-report admits only kind and path`);
1306
+ }
1307
+ if (record.path === void 0) return { kind: "artifact-report" };
1308
+ if (!string(record.path) || record.path.includes("\0")) {
1309
+ throw new Error(`agent recipe: ${sourcePath}: artifact-report requires a non-empty path without NUL`);
1310
+ }
1311
+ if (path.posix.isAbsolute(record.path) || path.win32.isAbsolute(record.path) || /^[a-z]:/iu.test(record.path) || record.path.split(/[\\/]/u).includes("..")) {
1312
+ throw new Error(`agent recipe: ${sourcePath}: artifact-report path must be workspace-relative`);
1313
+ }
1314
+ return { kind: "artifact-report", path: record.path };
1315
+ }
1316
+ if (record.kind === "mutation-report") {
1317
+ if (!only("kind", "maxSummaryBytes")) {
1318
+ throw new Error(`agent recipe: ${sourcePath}: mutation-report admits only kind and maxSummaryBytes`);
1319
+ }
1320
+ if (record.maxSummaryBytes === void 0) return { kind: "mutation-report" };
1321
+ try {
1322
+ return {
1323
+ kind: "mutation-report",
1324
+ maxSummaryBytes: parseResultSummaryMaxBytes(record.maxSummaryBytes, "maxSummaryBytes")
1325
+ };
1326
+ } catch (error) {
1327
+ throw new Error(`agent recipe: ${sourcePath}: ${error instanceof Error ? error.message : String(error)}`);
1328
+ }
1329
+ }
1330
+ if (!kinds.includes(record.kind) || !only("kind")) {
1331
+ throw new Error(`agent recipe: ${sourcePath}: resultContract.kind is unsupported or has unknown keys`);
1332
+ }
1333
+ return { kind: record.kind };
1334
+ }
1335
+ function parseResultContract(value, sourcePath) {
1336
+ return parseContract(value, sourcePath, RECIPE_DECLARABLE_KINDS);
1337
+ }
1338
+ function parseWorkerResultContract(value, sourcePath) {
1339
+ return parseContract(value, sourcePath, [...RECIPE_DECLARABLE_KINDS, ...COORDINATOR_AUTHORED_KINDS], true);
1340
+ }
1341
+
1342
+ export {
1343
+ parseJsonObjectPayload,
1344
+ AGENT_AUTOMATION_AUTHORITIES,
1345
+ isAgentCategory,
1346
+ isAgentCapabilityClass,
1347
+ isAgentLatencyClass,
1348
+ isAgentAudience,
1349
+ isAgentProjectContextTier,
1350
+ isAgentProduct,
1351
+ resolveAgentToolCompatibility,
1352
+ normalizeAgentSpec,
1353
+ agentSpecFingerprint,
1354
+ isUserVisibleAgent,
1355
+ isShadowAgent,
1356
+ assertAgentSpecPolicy,
1357
+ COUNCIL_BALLOT_VERDICT_MAX_BYTES,
1358
+ COUNCIL_BALLOT_SHAPE,
1359
+ parseCouncilReport,
1360
+ resultContractSourceId,
1361
+ parseVerifierResult,
1362
+ parseOracleResult,
1363
+ RESULT_SUMMARY_MAX_BYTES_CEILING,
1364
+ parseResultSummaryMaxBytes,
1365
+ withResultSummaryAllowance,
1366
+ resultContractOutputBytes,
1367
+ resultContractAuthorship,
1368
+ parseScoutResult,
1369
+ validateResultContract,
1370
+ validateRecipeResult,
1371
+ RESULT_CONTRACT_REPAIR_LIMIT,
1372
+ resultContractShape,
1373
+ resultContractRepairMessages,
1374
+ parseResultContract,
1375
+ parseWorkerResultContract
1376
+ };
1377
+ //# sourceMappingURL=chunk-ARRUMZ7X.js.map