@iowarp/clio-coder 0.4.2 → 0.4.4

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 (523) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/CONTRIBUTING.md +86 -19
  3. package/README.md +35 -6
  4. package/dist/{acp-TMDQZDIG.js → acp-WNAYYF4F.js} +12 -13
  5. package/dist/{agents-5N5NG3XG.js → agents-3OKXHLOI.js} +60 -57
  6. package/dist/assets/codewiki.json +1 -1
  7. package/dist/{auth-Z5CCBXKQ.js → auth-VKNNMGPU.js} +21 -19
  8. package/dist/{builtins-K6TNDT24.js → builtins-WGALA46I.js} +9 -4
  9. package/dist/{chunk-XE3PCIXH.js → chunk-23L32XTI.js} +12 -9
  10. package/dist/{chunk-I64IFBLB.js → chunk-25QBEXRS.js} +18 -11
  11. package/dist/{chunk-CDNVLKUX.js → chunk-26QSH3EJ.js} +13 -7
  12. package/dist/{chunk-QQLGQY2A.js → chunk-2ASED4PZ.js} +22 -22
  13. package/dist/{chunk-MCEPRMZW.js → chunk-2CU2H6KE.js} +2 -2
  14. package/dist/chunk-2DSOYNFC.js +108 -0
  15. package/dist/{chunk-72GZI5EV.js → chunk-2JH2WHGE.js} +2 -2
  16. package/dist/{chunk-I66EAJFY.js → chunk-2WZ546HR.js} +267 -232
  17. package/dist/{chunk-O3YUNJZ2.js → chunk-2ZSONWVL.js} +82 -25
  18. package/dist/{chunk-2NHR3NAY.js → chunk-36CT5VVL.js} +331 -42
  19. package/dist/{chunk-2X4RYJTJ.js → chunk-3GY4F45V.js} +3 -3
  20. package/dist/{chunk-ZW55JB7N.js → chunk-3ODX73FK.js} +4 -6
  21. package/dist/{chunk-PBP4B7XR.js → chunk-3UNOLWNZ.js} +3 -3
  22. package/dist/{chunk-4JDLP6ZS.js → chunk-3UUXNFEX.js} +14 -10
  23. package/dist/{chunk-RKSR6VSF.js → chunk-4IUZQIJ3.js} +29 -1
  24. package/dist/{chunk-ZW4HH5JJ.js → chunk-4M6Z5QVF.js} +6 -6
  25. package/dist/{chunk-K6BSR66V.js → chunk-4NSRCOYP.js} +4 -1
  26. package/dist/{chunk-M2DAX4F6.js → chunk-4WR7VSYB.js} +2 -2
  27. package/dist/{chunk-FSP7CMNU.js → chunk-54X7T7DK.js} +61 -6
  28. package/dist/{chunk-54ODD65L.js → chunk-5636DCO5.js} +4 -4
  29. package/dist/chunk-57XXR6DR.js +3763 -0
  30. package/dist/{chunk-3KIPBMUA.js → chunk-5ICU3EUH.js} +2 -2
  31. package/dist/{chunk-77QIVUZB.js → chunk-5MEZN6CB.js} +4 -4
  32. package/dist/{chunk-O42A54GG.js → chunk-5OIVVPHF.js} +2 -2
  33. package/dist/{chunk-YJISEZKC.js → chunk-5TUB6SLS.js} +6 -6
  34. package/dist/{chunk-IMXMHHMQ.js → chunk-6OSVSQL5.js} +341 -57
  35. package/dist/{chunk-Q4XWMHX6.js → chunk-6PAZTBPA.js} +14 -2
  36. package/dist/{chunk-FVDGR2ZL.js → chunk-6Q3CYFD3.js} +112 -39
  37. package/dist/{chunk-IDNA72AH.js → chunk-6QOTUPRG.js} +155 -36
  38. package/dist/{chunk-X7IARSHT.js → chunk-6UINWWS6.js} +16 -10
  39. package/dist/{chunk-CYZW7JHJ.js → chunk-72YIHOZQ.js} +9 -9
  40. package/dist/{chunk-IKSLQ4XV.js → chunk-75W7L2E2.js} +752 -861
  41. package/dist/{chunk-CRFOIAX3.js → chunk-7UGL4MB5.js} +6 -6
  42. package/dist/{chunk-HIICAHCJ.js → chunk-AUPNRN7C.js} +2 -2
  43. package/dist/{chunk-7BHIY2MW.js → chunk-BJVFZO5U.js} +8 -50
  44. package/dist/{chunk-B74PXLU7.js → chunk-CUSRQKPU.js} +65 -3
  45. package/dist/chunk-DQOVN6KV.js +386 -0
  46. package/dist/{chunk-E7GT7O5N.js → chunk-DT3LWJOB.js} +7 -4
  47. package/dist/chunk-DXKJURES.js +671 -0
  48. package/dist/{chunk-JBCS7CRR.js → chunk-EL24TAU4.js} +10 -10
  49. package/dist/{chunk-TPEQIQIE.js → chunk-ELWDPP3Y.js} +8 -8
  50. package/dist/{chunk-NDINPTJ4.js → chunk-ELZVTCGV.js} +5 -4
  51. package/dist/chunk-EXLD33WO.js +381 -0
  52. package/dist/chunk-FEAXX7B6.js +101 -0
  53. package/dist/{chunk-RLYRBIYQ.js → chunk-FFUPXJC4.js} +90 -331
  54. package/dist/{chunk-5PFYMY2V.js → chunk-FTMGRKEF.js} +2 -2
  55. package/dist/{chunk-34BHNEE3.js → chunk-GHS5EBTQ.js} +58 -7
  56. package/dist/{chunk-DYHAXKHD.js → chunk-GWZNEVM2.js} +12 -8
  57. package/dist/chunk-GX5WYQO4.js +59 -0
  58. package/dist/chunk-GYV6VZOC.js +26 -0
  59. package/dist/{chunk-MQXIVJ35.js → chunk-HAXOFFRH.js} +5 -5
  60. package/dist/chunk-I2DWJ4GM.js +390 -0
  61. package/dist/{chunk-TXOTCRLG.js → chunk-I5FWO7L5.js} +5 -5
  62. package/dist/{chunk-WNP7O5WZ.js → chunk-ID64D7PE.js} +4 -4
  63. package/dist/{chunk-XQRY4DTA.js → chunk-IGLP3ODT.js} +10 -10
  64. package/dist/chunk-IRXAATOX.js +539 -0
  65. package/dist/chunk-IXIY2H4R.js +44 -0
  66. package/dist/{chunk-SSEYRH53.js → chunk-IZXGRF7P.js} +92 -147
  67. package/dist/{chunk-5TSRNF4G.js → chunk-JCI2ROMZ.js} +164 -6
  68. package/dist/{chunk-JWJGP5DQ.js → chunk-JEIYHLOR.js} +7 -7
  69. package/dist/{chunk-F2I26BDK.js → chunk-JQLNNIKT.js} +4 -4
  70. package/dist/{chunk-BYMNWQ7O.js → chunk-JSD46VO2.js} +315 -63
  71. package/dist/{chunk-AK5XEFVZ.js → chunk-JT2RFCC5.js} +64 -14
  72. package/dist/{chunk-MCMZMDAC.js → chunk-K6T2ZAMZ.js} +168 -6
  73. package/dist/{chunk-PGF63K6I.js → chunk-KFV5L5SK.js} +73 -4
  74. package/dist/{chunk-IHXBNWMM.js → chunk-KXDSS5WJ.js} +7 -3
  75. package/dist/{chunk-PJX3WQUQ.js → chunk-LLXSDWXS.js} +3 -3
  76. package/dist/{chunk-DZAW46HP.js → chunk-LTIKRKFL.js} +3 -3
  77. package/dist/{chunk-DZEK6CJN.js → chunk-N56KALIC.js} +21 -21
  78. package/dist/{chunk-B7HM5Z7T.js → chunk-NAI6ZFCY.js} +9 -5
  79. package/dist/{chunk-I66ZTYNP.js → chunk-NRO2BJRH.js} +2656 -2213
  80. package/dist/{chunk-ZGNYYXQ6.js → chunk-NXIMQY5W.js} +3 -3
  81. package/dist/{chunk-IKOZFYBN.js → chunk-NXYCB2VD.js} +149 -106
  82. package/dist/{chunk-CWVRRIEI.js → chunk-NZMNUPZZ.js} +2 -2
  83. package/dist/{chunk-462T4EGZ.js → chunk-O5CVSAG5.js} +2 -2
  84. package/dist/chunk-ODGTEFFI.js +50 -0
  85. package/dist/{chunk-3F7VUY77.js → chunk-OEJSLEPW.js} +2 -2
  86. package/dist/{chunk-KKOJXO6R.js → chunk-OMQNJVKW.js} +4 -2
  87. package/dist/{chunk-5KW52TEP.js → chunk-Q4WO54TA.js} +132 -77
  88. package/dist/{chunk-W6NIE6OW.js → chunk-QUFRYSWI.js} +13 -7
  89. package/dist/{chunk-42FMPA75.js → chunk-QZWQA4DE.js} +2 -2
  90. package/dist/chunk-R6Q67RJH.js +134 -0
  91. package/dist/{chunk-W4YEMFBX.js → chunk-RAY4OVGZ.js} +3 -3
  92. package/dist/{chunk-ZNT2M6TG.js → chunk-RQCKCSRL.js} +17 -17
  93. package/dist/{chunk-LJID3DYZ.js → chunk-RXTN6AKH.js} +3 -3
  94. package/dist/{chunk-P75RZCJW.js → chunk-RZDWV63N.js} +3 -3
  95. package/dist/{chunk-UH632ZYL.js → chunk-S6PYF2XF.js} +2 -2
  96. package/dist/{chunk-HJWWJ6IL.js → chunk-TOIVGRUX.js} +17 -5
  97. package/dist/{chunk-HLAFFSEK.js → chunk-TQAHXW6Y.js} +2 -2
  98. package/dist/{chunk-JIEGK6UF.js → chunk-U6TMQNSI.js} +48 -4
  99. package/dist/{chunk-2HFQNRV3.js → chunk-UEPWCCTY.js} +12 -12
  100. package/dist/chunk-UOIZ7DA4.js +41 -0
  101. package/dist/{chunk-UH347SHR.js → chunk-USR47QNF.js} +11 -11
  102. package/dist/{chunk-AZ4WMN4W.js → chunk-V6HJFQZE.js} +2 -2
  103. package/dist/chunk-V76WTFTW.js +318 -0
  104. package/dist/{chunk-NMJXSHBJ.js → chunk-W54I7H25.js} +2 -2
  105. package/dist/{chunk-KPXDY6QF.js → chunk-XRZT5WY5.js} +2 -2
  106. package/dist/{chunk-UBRFI4HS.js → chunk-XULDXHTN.js} +142 -50
  107. package/dist/chunk-XXYSBZIQ.js +283 -0
  108. package/dist/{chunk-HKMD33FO.js → chunk-Y55JBDO5.js} +405 -122
  109. package/dist/{chunk-XOXV5GKE.js → chunk-YD5GIKET.js} +17 -8
  110. package/dist/{chunk-XGDPUNND.js → chunk-YECAMM3D.js} +2 -2
  111. package/dist/{chunk-BO7Y52RY.js → chunk-YNFKXPEC.js} +7 -7
  112. package/dist/{chunk-VXMFAE2W.js → chunk-YPC6ZR5L.js} +19 -6
  113. package/dist/{chunk-M2WXEHER.js → chunk-ZA4VCIGV.js} +2 -2
  114. package/dist/cli/index.js +42 -40
  115. package/dist/{clio-7VB377CC.js → clio-QLICPCF5.js} +7 -7
  116. package/dist/{code-nav-YVLCYA7V.js → code-nav-IJR2DBPR.js} +9 -9
  117. package/dist/{components-UBWCQSRW.js → components-2TGAI2RC.js} +5 -6
  118. package/dist/{config-4HVOS65E.js → config-IUA6OYNS.js} +88 -81
  119. package/dist/{configure-PIWO7B24.js → configure-VEPX4NMX.js} +26 -25
  120. package/dist/{context-KQYIWPWT.js → context-2DKHWH2T.js} +60 -45
  121. package/dist/{context-IYEHL3WQ.js → context-4MPR7WKB.js} +78 -69
  122. package/dist/{context-N6ZE3LGJ.js → context-BOYF5EJM.js} +15 -11
  123. package/dist/{context-clear-G4OGZJDS.js → context-clear-S4ZJCQUX.js} +73 -65
  124. package/dist/context-map-COB37XXN.js +505 -0
  125. package/dist/{context-working-set-BWLF6LJP.js → context-working-set-3I3FYX6Y.js} +18 -17
  126. package/dist/detail-A7JAVSIG.js +98 -0
  127. package/dist/{dispatch-runner-2QQAITS3.js → dispatch-runner-RJ5I2F2O.js} +99 -75
  128. package/dist/{docs-PD3EXDKU.js → docs-SPOV3BAN.js} +3 -5
  129. package/dist/{doctor-LHBD36VU.js → doctor-DKICC2SN.js} +71 -48
  130. package/dist/{eval-C45FYRJ6.js → eval-OQOQUDHK.js} +308 -146
  131. package/dist/{eval-inventory-6DEJPLBF.js → eval-inventory-Y6QRFOH5.js} +4 -4
  132. package/dist/{evidence-6SHONYAF.js → evidence-4DQ25GUQ.js} +79 -175
  133. package/dist/evidence-4F5USFKH.js +208 -0
  134. package/dist/{evolve-KRKMV72X.js → evolve-GSS52E5J.js} +71 -67
  135. package/dist/{extensions-KPZ2UHBB.js → extensions-G7MFLYHT.js} +8 -9
  136. package/dist/{fleet-IVTCKDHT.js → fleet-Q37YHHAQ.js} +126 -118
  137. package/dist/{fleet-commands-EDWL3IT7.js → fleet-commands-G7E4N7SM.js} +16 -13
  138. package/dist/{fleet-decisions-YP3YEFGK.js → fleet-decisions-O7M6QBA2.js} +9 -8
  139. package/dist/{fleet-graph-ZFWKHY2M.js → fleet-graph-TOUBW6OW.js} +21 -20
  140. package/dist/{fleet-inspect-FVUNCBML.js → fleet-inspect-SW33JJNI.js} +65 -60
  141. package/dist/{fleet-preflight-UN5XED4R.js → fleet-preflight-CV2655TW.js} +4 -5
  142. package/dist/{fleet-validate-XOWC4HSX.js → fleet-validate-KESZX2YH.js} +25 -24
  143. package/dist/{fleet-verify-UN3SODEL.js → fleet-verify-UQPMTVE3.js} +66 -61
  144. package/dist/{fleet-view-TWHJKCN6.js → fleet-view-MN2VG4MR.js} +65 -60
  145. package/dist/{init-T2QORQ3Y.js → init-PXEXQSBF.js} +90 -82
  146. package/dist/{interop-IN5I2A66.js → interop-ZG5T62U3.js} +12 -13
  147. package/dist/inventory-C26CFDRR.js +101 -0
  148. package/dist/{library-LSCATDLZ.js → library-B2W4N74O.js} +29 -29
  149. package/dist/{memory-HYOKAGGJ.js → memory-YCANYS5A.js} +73 -69
  150. package/dist/{models-2GPMFYCM.js → models-GERTU3YI.js} +51 -47
  151. package/dist/{monitor-E4ASVUJH.js → monitor-CPNIUULB.js} +74 -67
  152. package/dist/{orchestrator-DDMPR3PY.js → orchestrator-J4BSH4WQ.js} +1288 -1606
  153. package/dist/{panes-E3RUXOW5.js → panes-BOHAEGYC.js} +4 -4
  154. package/dist/{panes-IXKLOKA2.js → panes-NXSLDQZ2.js} +10 -11
  155. package/dist/{paths-L7LGY6RN.js → paths-VSUWNC22.js} +6 -7
  156. package/dist/reset-TNWTB5LU.js +343 -0
  157. package/dist/{resources-OTRSN34L.js → resources-4PXNMD5G.js} +29 -22
  158. package/dist/{run-5DEYH5QK.js → run-D6XJ34CN.js} +132 -132
  159. package/dist/{share-IHWTLO3M.js → share-2NWMJJEE.js} +27 -27
  160. package/dist/{skills-IYMXMKW4.js → skills-KR7WON5G.js} +40 -33
  161. package/dist/{skills-eval-DROHSJAR.js → skills-eval-O2ZNOLDS.js} +81 -77
  162. package/dist/{skills-inventory-D7X4L4ZX.js → skills-inventory-ZZOUBK7O.js} +23 -22
  163. package/dist/{slash-commands-QBM7UZ3B.js → slash-commands-ZXPJD64J.js} +47 -37
  164. package/dist/{steer-Z5DO23FJ.js → steer-XA25PSCS.js} +4 -4
  165. package/dist/{support-U7QOWY26.js → support-7EMVWYG2.js} +6 -6
  166. package/dist/{targets-P2FUC4IL.js → targets-OMH2XCSN.js} +50 -49
  167. package/dist/tasks-IPAGMEIX.js +36 -0
  168. package/dist/{terminal-lease-YREJ3JX2.js → terminal-lease-C2J3JYRE.js} +4 -4
  169. package/dist/{tools-5B7RO6MV.js → tools-EFFEAIDP.js} +8 -9
  170. package/dist/{trace-YMGMUM6A.js → trace-FXMXUZUF.js} +7 -7
  171. package/dist/uninstall-HALS6BLF.js +407 -0
  172. package/dist/upgrade-MS72RJEP.js +306 -0
  173. package/dist/{usage-ME5MPXGX.js → usage-NHG6MCJM.js} +162 -108
  174. package/dist/{verifiers-BVZ7IWOO.js → verifiers-7AUNVXDY.js} +155 -22
  175. package/dist/{verify-5K7ZKQFC.js → verify-FWYGPKMR.js} +14 -12
  176. package/dist/{web-fetch-MPARV2K7.js → web-fetch-V4FKSDAV.js} +4 -4
  177. package/dist/{wiki-generate-F5W5QTYY.js → wiki-generate-743CIGJW.js} +99 -90
  178. package/dist/{with-panes-BYOJCLAM.js → with-panes-BDQEWBRT.js} +10 -10
  179. package/dist/worker/entry.js +72 -68
  180. package/docs/README.md +3 -2
  181. package/docs/architecture/acp.md +17 -0
  182. package/docs/architecture/artifact-placement.md +1 -0
  183. package/docs/architecture/artifact-versions.md +2 -2
  184. package/docs/architecture/context-engine.md +4 -0
  185. package/docs/architecture/dispatch-typed-intent.md +1 -1
  186. package/docs/architecture/evidence-and-memory.md +1 -1
  187. package/docs/architecture/middleware-and-components.md +1 -1
  188. package/docs/architecture/model-catalog.md +21 -10
  189. package/docs/architecture/observability.md +19 -2
  190. package/docs/architecture/prompt-envelope-and-tools.md +17 -5
  191. package/docs/architecture/provider-adapter-cookbook.md +63 -0
  192. package/docs/architecture/safety-model.md +25 -22
  193. package/docs/architecture/tui-design.md +1 -1
  194. package/docs/guide/built-in-agents.md +25 -11
  195. package/docs/guide/commands-and-modes.md +18 -3
  196. package/docs/guide/configuration-and-targets.md +100 -10
  197. package/docs/guide/configuration-reference.md +17 -7
  198. package/docs/guide/environment-variables.md +4 -2
  199. package/docs/guide/installation-and-lifecycle.md +37 -4
  200. package/docs/guide/proactive-memory.md +66 -55
  201. package/docs/guide/skills-marketplace.md +18 -0
  202. package/docs/guide/tool-usage.md +78 -3
  203. package/docs/history/config-knobs-audit.md +2 -2
  204. package/docs/process/development-pipeline.md +40 -2
  205. package/docs/process/eval-runner.md +67 -3
  206. package/docs/process/git-commit-provenance.md +15 -0
  207. package/docs/process/release-cut-checklist.md +207 -0
  208. package/docs/process/scientific-validation.md +18 -17
  209. package/evals/behavioral-machinery-support.ts +1 -0
  210. package/evals/behavioral-machinery.yaml +1 -1
  211. package/evals/behavioral-model.yaml +3 -2
  212. package/package.json +2 -2
  213. package/skills/README.md +7 -5
  214. package/skills/coding/ast-grep/SKILL.md +101 -30
  215. package/skills/coding/ast-grep/evals.md +26 -0
  216. package/skills/coding/coding-standards/SKILL.md +47 -2
  217. package/skills/coding/coding-standards/evals.md +23 -0
  218. package/skills/coding/prototype/SKILL.md +87 -28
  219. package/skills/coding/prototype/evals.md +19 -0
  220. package/skills/coding/tdd/SKILL.md +80 -53
  221. package/skills/coding/tdd/evals.md +20 -0
  222. package/skills/context/context-handoff/SKILL.md +43 -2
  223. package/skills/context/context-handoff/evals.md +44 -0
  224. package/skills/context/context-prime/SKILL.md +45 -15
  225. package/skills/context/context-prime/evals.md +45 -0
  226. package/skills/git/branch-closeout/SKILL.md +132 -0
  227. package/skills/git/branch-closeout/evals.md +133 -0
  228. package/skills/git/branch-closeout/references/closeout-checklist.md +81 -0
  229. package/skills/git/file-ticket/SKILL.md +77 -63
  230. package/skills/git/file-ticket/assets/issue-template.md +22 -0
  231. package/skills/git/file-ticket/evals.md +31 -26
  232. package/skills/git/file-ticket/references/issue-discovery.md +49 -0
  233. package/skills/git/fix-issue/SKILL.md +87 -64
  234. package/skills/git/fix-issue/evals.md +35 -31
  235. package/skills/git/fix-issue/references/diagnosis-and-rca.md +46 -0
  236. package/skills/git/resolve-merge-conflicts/SKILL.md +100 -51
  237. package/skills/git/resolve-merge-conflicts/evals.md +52 -25
  238. package/skills/git/resolve-merge-conflicts/references/conflict-matrix.md +126 -0
  239. package/skills/git/ship/SKILL.md +103 -67
  240. package/skills/git/ship/assets/pr-template.md +21 -0
  241. package/skills/git/ship/evals.md +44 -28
  242. package/skills/git/ship/references/remote-and-branch-policy.md +62 -0
  243. package/skills/git/worktree-create/SKILL.md +80 -50
  244. package/skills/git/worktree-create/evals.md +40 -33
  245. package/skills/git/worktree-create/references/worktree-setup.md +62 -66
  246. package/skills/git/worktree-merge/SKILL.md +112 -65
  247. package/skills/git/worktree-merge/evals.md +42 -34
  248. package/skills/git/worktree-merge/references/merge-strategies.md +52 -0
  249. package/skills/planning/archify/SKILL.md +196 -0
  250. package/skills/planning/archify/evals.md +65 -0
  251. package/skills/planning/architecture/SKILL.md +61 -12
  252. package/skills/planning/architecture/evals.md +65 -0
  253. package/skills/planning/backlog/SKILL.md +130 -14
  254. package/skills/planning/backlog/evals.md +142 -0
  255. package/skills/planning/prd/SKILL.md +47 -6
  256. package/skills/planning/prd/evals.md +54 -0
  257. package/skills/planning/product-intent/SKILL.md +57 -2
  258. package/skills/planning/product-intent/evals.md +70 -0
  259. package/skills/planning/tech-spec/SKILL.md +53 -2
  260. package/skills/planning/tech-spec/evals.md +73 -0
  261. package/skills/registry.yaml +58 -50
  262. package/skills/remote.yaml +13 -0
  263. package/skills/research/arxiv-literature/SKILL.md +76 -18
  264. package/skills/research/arxiv-literature/evals.md +50 -0
  265. package/skills/research/experiment-protocol/SKILL.md +20 -1
  266. package/skills/research/experiment-protocol/evals.md +23 -0
  267. package/skills/research/scientific-debugging/SKILL.md +24 -1
  268. package/skills/research/scientific-debugging/evals.md +18 -0
  269. package/skills/research/scientific-modernization/SKILL.md +26 -1
  270. package/skills/research/scientific-modernization/evals.md +27 -0
  271. package/skills/skill-marketplace.json +63 -28
  272. package/skills/workflow/cut-it/SKILL.md +64 -5
  273. package/skills/workflow/cut-it/evals.md +101 -0
  274. package/skills/workflow/design-council/SKILL.md +112 -27
  275. package/skills/workflow/design-council/evals.md +161 -0
  276. package/skills/workflow/grill-me/SKILL.md +85 -10
  277. package/skills/workflow/grill-me/evals.md +153 -0
  278. package/skills/workflow/workflow-distiller/SKILL.md +76 -17
  279. package/skills/workflow/workflow-distiller/evals.md +118 -0
  280. package/src/cli/args.ts +0 -8
  281. package/src/cli/configure-interop.ts +105 -13
  282. package/src/cli/configure-oauth.ts +57 -0
  283. package/src/cli/configure-onboarding.ts +980 -0
  284. package/src/cli/configure-target.ts +594 -0
  285. package/src/cli/configure.ts +1084 -529
  286. package/src/cli/context-map.ts +114 -0
  287. package/src/cli/context.ts +4 -0
  288. package/src/cli/doctor-state-size.ts +1 -12
  289. package/src/cli/doctor-validation-contract.ts +28 -0
  290. package/src/cli/doctor.ts +5 -0
  291. package/src/cli/evidence-detail.ts +1 -75
  292. package/src/cli/evidence-inventory.ts +1 -167
  293. package/src/cli/index.ts +3 -0
  294. package/src/cli/lifecycle-presenter.ts +436 -0
  295. package/src/cli/models.ts +10 -2
  296. package/src/cli/modes/print.ts +5 -1
  297. package/src/cli/reset.ts +228 -106
  298. package/src/cli/run.ts +7 -4
  299. package/src/cli/select.ts +664 -0
  300. package/src/cli/skills.ts +9 -2
  301. package/src/cli/targets.ts +3 -0
  302. package/src/cli/tasks.ts +84 -0
  303. package/src/cli/uninstall.ts +233 -165
  304. package/src/cli/upgrade.ts +210 -150
  305. package/src/cli/usage.ts +92 -27
  306. package/src/cli/validate-model.ts +3 -3
  307. package/src/cli/verifiers.ts +147 -1
  308. package/src/cli/wiki-generate.ts +1 -0
  309. package/src/core/commit-attribution.ts +41 -1
  310. package/src/core/config.ts +56 -0
  311. package/src/core/external-diagnostic.ts +44 -0
  312. package/src/core/gateway-routing.ts +157 -0
  313. package/src/core/git-commit-attribution.ts +46 -3
  314. package/src/core/run-overrides.ts +0 -5
  315. package/src/core/safe-exec.ts +17 -2
  316. package/src/core/skill-activation.ts +92 -2
  317. package/src/core/tool-names.ts +5 -2
  318. package/src/domains/agents/builtins/architect.md +1 -1
  319. package/src/domains/agents/builtins/coder.md +1 -1
  320. package/src/domains/agents/builtins/documenter.md +1 -1
  321. package/src/domains/agents/builtins/git-master.md +1 -1
  322. package/src/domains/agents/builtins/provenance.md +7 -7
  323. package/src/domains/agents/builtins/tester.md +1 -1
  324. package/src/domains/agents/builtins/verifier.md +2 -2
  325. package/src/domains/agents/builtins/wiki-writer.md +4 -3
  326. package/src/domains/agents/builtins/world-knowledge.md +31 -0
  327. package/src/domains/agents/catalog.ts +1 -1
  328. package/src/domains/agents/result-contract.ts +70 -0
  329. package/src/domains/context/extension.ts +31 -7
  330. package/src/domains/context/refresh.ts +3 -0
  331. package/src/domains/context/wiki/frontmatter.ts +5 -2
  332. package/src/domains/context/wiki/generate.ts +6 -0
  333. package/src/domains/context/wiki/map-seed.ts +589 -0
  334. package/src/domains/context/wiki/plan.ts +2 -2
  335. package/src/domains/context/wiki/prompts.ts +43 -0
  336. package/src/domains/dispatch/active-route-planner.ts +4 -0
  337. package/src/domains/dispatch/admission.ts +29 -0
  338. package/src/domains/dispatch/agent-candidates.ts +10 -0
  339. package/src/domains/dispatch/budget-envelope.ts +86 -1
  340. package/src/domains/dispatch/capability-match.ts +1 -0
  341. package/src/domains/dispatch/capacity-lease.ts +17 -0
  342. package/src/domains/dispatch/code-step.ts +11 -4
  343. package/src/domains/dispatch/contract.ts +42 -8
  344. package/src/domains/dispatch/execution-scheduler.ts +2 -0
  345. package/src/domains/dispatch/extension.ts +184 -56
  346. package/src/domains/dispatch/fleet-commit-attribution.ts +5 -0
  347. package/src/domains/dispatch/fleet-run.ts +1 -0
  348. package/src/domains/dispatch/host-verification.ts +114 -13
  349. package/src/domains/dispatch/intent.ts +28 -18
  350. package/src/domains/dispatch/orphan-recovery.ts +2 -0
  351. package/src/domains/dispatch/receipt-integrity.ts +4 -0
  352. package/src/domains/dispatch/reservation-store.ts +5 -3
  353. package/src/domains/dispatch/state.ts +15 -2
  354. package/src/domains/dispatch/types.ts +20 -2
  355. package/src/domains/dispatch/worker-model-metadata.ts +38 -0
  356. package/src/domains/eval/metrics/call-ledger-stream.ts +34 -11
  357. package/src/domains/eval/metrics/token-stream.ts +201 -31
  358. package/src/domains/eval/metrics/tracked.ts +40 -4
  359. package/src/domains/eval/runners/clio-run.ts +17 -11
  360. package/src/domains/eval/runners/context-index.ts +2 -7
  361. package/src/domains/eval/runners/context-init.ts +3 -6
  362. package/src/domains/eval/runners/external-command.ts +29 -11
  363. package/src/domains/eval/schema/suite.ts +28 -0
  364. package/src/domains/eval/schema/verdict.ts +2 -2
  365. package/src/domains/eval/suites/resolve.ts +13 -1
  366. package/src/domains/eval/suites/run.ts +24 -3
  367. package/src/domains/evidence/build.ts +102 -15
  368. package/src/domains/evidence/detail.ts +69 -0
  369. package/src/domains/evidence/eval.ts +13 -1
  370. package/src/domains/evidence/finish-contract-map.ts +5 -1
  371. package/src/domains/evidence/inventory.ts +167 -0
  372. package/src/domains/evidence/store.ts +16 -0
  373. package/src/domains/evidence/types.ts +12 -0
  374. package/src/domains/extensions/resources.ts +7 -0
  375. package/src/domains/interop/registry.ts +6 -2
  376. package/src/domains/interop/types.ts +4 -0
  377. package/src/domains/lifecycle/migrations/index.ts +4 -0
  378. package/src/domains/memory/task-memory-policy.ts +70 -26
  379. package/src/domains/memory/task-memory-telemetry.ts +1 -0
  380. package/src/domains/middleware/index.ts +0 -1
  381. package/src/domains/middleware/marketplace-offer.ts +22 -35
  382. package/src/domains/middleware/memory-intervention.ts +127 -32
  383. package/src/domains/middleware/memory-step-endpoint.ts +3 -2
  384. package/src/domains/middleware/runtime.ts +7 -3
  385. package/src/domains/middleware/skills-reminder.ts +31 -2
  386. package/src/domains/mux/detect.ts +3 -6
  387. package/src/domains/observability/accountability.ts +15 -1
  388. package/src/domains/observability/compaction-usage.ts +118 -0
  389. package/src/domains/observability/contract.ts +52 -7
  390. package/src/domains/observability/cost.ts +1 -1
  391. package/src/domains/observability/evidence-index.ts +10 -0
  392. package/src/domains/observability/extension.ts +15 -6
  393. package/src/domains/observability/out-of-turn-usage.ts +52 -21
  394. package/src/domains/observability/projection.ts +394 -45
  395. package/src/{interactive → domains/observability}/worker-progress.ts +3 -3
  396. package/src/domains/prompts/fragments/operating/contract.md +2 -0
  397. package/src/domains/prompts/fragments/wiki/page.md +8 -0
  398. package/src/domains/providers/contract.ts +4 -1
  399. package/src/domains/providers/extension.ts +40 -9
  400. package/src/domains/providers/model-capabilities.ts +9 -0
  401. package/src/domains/providers/model-discovery.ts +3 -4
  402. package/src/domains/providers/model-runtime-capabilities.ts +15 -5
  403. package/src/domains/providers/models/local-models/clio-coder-local-coding-targets.yaml +48 -26
  404. package/src/domains/providers/runtimes/antigravity/antigravity-code.ts +225 -45
  405. package/src/domains/providers/runtimes/claude/claude-code.ts +9 -0
  406. package/src/domains/providers/runtimes/common/lmstudio-http.ts +6 -2
  407. package/src/domains/providers/runtimes/common/local-synth.ts +2 -0
  408. package/src/domains/providers/runtimes/protocol/litellm.ts +119 -29
  409. package/src/domains/providers/support.ts +11 -5
  410. package/src/domains/providers/target-model-cache.ts +25 -2
  411. package/src/domains/providers/types/capability-flags.ts +2 -0
  412. package/src/domains/providers/types/runtime-descriptor.ts +20 -1
  413. package/src/domains/providers/types/target-descriptor.ts +19 -0
  414. package/src/domains/resources/index.ts +3 -0
  415. package/src/domains/resources/skills/install.ts +72 -7
  416. package/src/domains/resources/skills/loader.ts +7 -0
  417. package/src/domains/resources/skills/marketplace.ts +63 -11
  418. package/src/domains/safety/action-classifier.ts +7 -0
  419. package/src/domains/safety/autonomy.ts +15 -0
  420. package/src/domains/safety/default-path-policy.ts +2 -0
  421. package/src/domains/safety/finish-contract-registration.ts +29 -14
  422. package/src/domains/safety/finish-contract.ts +252 -40
  423. package/src/domains/safety/index.ts +21 -1
  424. package/src/domains/safety/path-policy.ts +1 -1
  425. package/src/domains/safety/policy-engine.ts +60 -17
  426. package/src/domains/safety/protected-artifacts.ts +191 -88
  427. package/src/domains/safety/rigor.ts +53 -39
  428. package/src/domains/safety/run-effects.ts +2 -22
  429. package/src/domains/safety/skill-authority.ts +55 -0
  430. package/src/domains/safety/validation-contract.ts +388 -0
  431. package/src/domains/session/archive-readers.ts +10 -1
  432. package/src/domains/session/compaction/compact.ts +72 -22
  433. package/src/domains/session/decision-board.ts +101 -2
  434. package/src/domains/session/entries.ts +50 -7
  435. package/src/domains/session/extension.ts +4 -4
  436. package/src/domains/session/handoff.ts +2 -1
  437. package/src/domains/session/manager.ts +2 -3
  438. package/src/domains/session/task-board.ts +14 -1
  439. package/src/domains/session/tree/fork.ts +1 -2
  440. package/src/domains/session/tree/navigator.ts +1 -1
  441. package/src/domains/session/usage.ts +3 -3
  442. package/src/domains/user-tasks/acceptance.ts +56 -0
  443. package/src/domains/user-tasks/active-acceptance.ts +40 -0
  444. package/src/domains/user-tasks/store.ts +34 -3
  445. package/src/engine/acp/adapter.ts +24 -6
  446. package/src/engine/acp/server.ts +21 -4
  447. package/src/engine/acp/transport.ts +53 -8
  448. package/src/engine/acp/types.ts +4 -0
  449. package/src/engine/agent.ts +13 -3
  450. package/src/engine/ai.ts +26 -8
  451. package/src/engine/antigravity/subprocess-runtime.ts +386 -120
  452. package/src/engine/api-registry.ts +3 -0
  453. package/src/engine/apis/ollama-native.ts +15 -0
  454. package/src/engine/apis/openai-completions.ts +117 -14
  455. package/src/engine/claude/subprocess-runtime.ts +107 -60
  456. package/src/engine/external-subprocess.ts +122 -6
  457. package/src/entry/background-model-metadata.ts +18 -0
  458. package/src/entry/compaction-prompt.ts +57 -0
  459. package/src/entry/orchestrator.ts +416 -218
  460. package/src/entry/task-memory-lifecycle.ts +35 -0
  461. package/src/interactive/chat-loop-messages.ts +13 -4
  462. package/src/interactive/chat-loop.ts +65 -2
  463. package/src/interactive/chat-renderer.ts +1 -0
  464. package/src/interactive/cost-overlay.ts +26 -2
  465. package/src/interactive/dispatch-board.ts +46 -717
  466. package/src/interactive/fleet-run-preview.ts +2 -1
  467. package/src/interactive/interactive-application.ts +3 -2
  468. package/src/interactive/interactive-presentation.ts +55 -12
  469. package/src/interactive/interactive-slash-runtime.ts +4 -2
  470. package/src/interactive/oracle.ts +5 -2
  471. package/src/interactive/overlays/fleet-run-approval.ts +3 -2
  472. package/src/interactive/overlays/message-picker.ts +2 -2
  473. package/src/interactive/overlays/settings.ts +2 -2
  474. package/src/interactive/overlays/tree-selector.ts +2 -2
  475. package/src/interactive/renderers/branch-summary.ts +1 -1
  476. package/src/interactive/renderers/worker-entry.ts +32 -0
  477. package/src/interactive/slash-autocomplete.ts +4 -6
  478. package/src/interactive/slash-commands.ts +49 -45
  479. package/src/interactive/slash-spec.ts +28 -0
  480. package/src/interactive/theme/labels.ts +19 -13
  481. package/src/interactive/turn-context.ts +9 -5
  482. package/src/interactive/turn-recovery.ts +8 -0
  483. package/src/interactive/turn-runtime.ts +27 -11
  484. package/src/interactive/turn-state.ts +7 -0
  485. package/src/interactive/view/artifacts.ts +2 -0
  486. package/src/interactive/worker-receipts.ts +1 -0
  487. package/src/interactive/worker-stream.ts +13 -4
  488. package/src/tools/bootstrap.ts +4 -0
  489. package/src/tools/builtin-tool-catalog.ts +31 -0
  490. package/src/tools/compete-worktrees.ts +7 -1
  491. package/src/tools/context/index.ts +30 -9
  492. package/src/tools/core-bootstrap.ts +16 -0
  493. package/src/tools/decide.ts +136 -0
  494. package/src/tools/dispatch-admission.ts +21 -0
  495. package/src/tools/dispatch-arguments.ts +1 -0
  496. package/src/tools/dispatch-event-text.ts +10 -0
  497. package/src/tools/dispatch-plan.ts +6 -2
  498. package/src/tools/dispatch-runner.ts +27 -1
  499. package/src/tools/dispatch-types.ts +6 -0
  500. package/src/tools/evidence.ts +96 -0
  501. package/src/tools/limitation.ts +76 -0
  502. package/src/tools/policy.ts +9 -0
  503. package/src/tools/presentation.ts +3 -0
  504. package/src/tools/registry.ts +11 -5
  505. package/src/tools/result-shaping.ts +17 -5
  506. package/src/tools/task-worktree.ts +13 -3
  507. package/src/tools/tasks.ts +10 -1
  508. package/src/tools/verify/authoring.ts +170 -83
  509. package/src/tools/verify/catalog.ts +122 -5
  510. package/src/tools/verify/index.ts +2 -1
  511. package/src/tools/verify/numeric.ts +298 -0
  512. package/src/tools/verify/perf.ts +143 -0
  513. package/src/tools/verify/scripts.ts +229 -2
  514. package/src/tools/worker-evidence.ts +3 -1
  515. package/src/worker/spec-contract.ts +4 -0
  516. package/dist/chunk-2Z2IKEXI.js +0 -1554
  517. package/dist/chunk-RVG5JXAL.js +0 -41
  518. package/dist/chunk-T56WDKA5.js +0 -183
  519. package/dist/chunk-VN3SHNBN.js +0 -313
  520. package/dist/chunk-VPKWYKEY.js +0 -169
  521. package/dist/reset-OAQP3W4O.js +0 -230
  522. package/dist/uninstall-N34PCTGJ.js +0 -331
  523. package/dist/upgrade-PXK3S2YM.js +0 -325
@@ -1,4 +1,8 @@
1
1
  import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
+ import {
3
+ hashToolCall,
4
+ typedValidationSummary
5
+ } from "./chunk-6QOTUPRG.js";
2
6
  import {
3
7
  ROUTE_POLICY_VERSION,
4
8
  isRouteDecisionAgentSelection,
@@ -6,37 +10,14 @@ import {
6
10
  parseRoutingIntent,
7
11
  routePriorForLatencyClass,
8
12
  sameRouteIdentity
9
- } from "./chunk-HIICAHCJ.js";
10
- import {
11
- hashToolCall,
12
- typedValidationSummary
13
- } from "./chunk-IDNA72AH.js";
13
+ } from "./chunk-AUPNRN7C.js";
14
14
  import {
15
15
  describeCallAction
16
16
  } from "./chunk-NEDJ26B5.js";
17
- import {
18
- TOOL_PROFILE_NAMES,
19
- assertToolProfileEnforceable,
20
- isToolProfileName
21
- } from "./chunk-42FMPA75.js";
22
- import {
23
- deriveExecutionRole,
24
- isExecutionRole,
25
- requestExecutionRole
26
- } from "./chunk-H7IXIC72.js";
27
17
  import {
28
18
  expandPath,
29
19
  resolveReadPath
30
20
  } from "./chunk-OQE5J4C6.js";
31
- import {
32
- DEFAULT_AUTONOMY_EXPOSURE,
33
- DEFAULT_AUTONOMY_LEVEL,
34
- autonomyAskRejection,
35
- autonomyDenyRejection,
36
- evaluateSkillToolSurface,
37
- isAutonomyLevel,
38
- mapAutonomy
39
- } from "./chunk-FSP7CMNU.js";
40
21
  import {
41
22
  DEFAULT_MAX_LINES,
42
23
  DEFAULT_TOOL_RESULT_MAX_BYTES,
@@ -52,50 +33,70 @@ import {
52
33
  toolResultDigestFor,
53
34
  truncateHead,
54
35
  truncateTail
55
- } from "./chunk-B7HM5Z7T.js";
36
+ } from "./chunk-NAI6ZFCY.js";
56
37
  import {
57
38
  formatSize
58
39
  } from "./chunk-OZNBF4L3.js";
59
40
  import {
60
- byteLength,
61
- truncateUtf8
62
- } from "./chunk-6XLNIQDB.js";
63
- import {
64
- BASH_HARD_CAP_BYTES,
65
- combineBashOutput,
66
- runBashCommand
67
- } from "./chunk-NMJXSHBJ.js";
41
+ TOOL_PROFILE_NAMES,
42
+ assertToolProfileEnforceable,
43
+ isToolProfileName
44
+ } from "./chunk-QZWQA4DE.js";
68
45
  import {
69
- PATH_BOUNDARY_MAX_ENTRIES,
70
- PathBoundaryError,
71
- asDirectoryPathBoundary,
72
- normalizePathBoundaryEntry,
73
- pathBoundaryCovers,
74
- resolvePathBoundary
75
- } from "./chunk-HHV2GANA.js";
46
+ deriveExecutionRole,
47
+ isExecutionRole,
48
+ requestExecutionRole
49
+ } from "./chunk-H7IXIC72.js";
76
50
  import {
77
51
  AGENT_AUTOMATION_AUTHORITIES,
78
52
  COUNCIL_BALLOT_SHAPE,
79
53
  COUNCIL_BALLOT_VERDICT_MAX_BYTES,
80
54
  agentSpecFingerprint,
81
55
  classify
82
- } from "./chunk-PGF63K6I.js";
56
+ } from "./chunk-KFV5L5SK.js";
83
57
  import {
58
+ commandArgumentSegments,
84
59
  detectValidationCommand,
85
60
  extractCommandDeleteTargets,
86
61
  extractCommandWriteTargets,
87
- tokenizeShellLike,
88
62
  toolMutationPaths
89
- } from "./chunk-IKOZFYBN.js";
63
+ } from "./chunk-NXYCB2VD.js";
64
+ import {
65
+ isDispatchIntent,
66
+ resolveDispatchPathScope
67
+ } from "./chunk-IRXAATOX.js";
68
+ import {
69
+ asDirectoryPathBoundary,
70
+ pathBoundaryCovers,
71
+ resolvePathBoundary
72
+ } from "./chunk-HHV2GANA.js";
90
73
  import {
91
74
  typebox_exports
92
75
  } from "./chunk-5B2AEOW5.js";
76
+ import {
77
+ DEFAULT_AUTONOMY_EXPOSURE,
78
+ DEFAULT_AUTONOMY_LEVEL,
79
+ autonomyAskRejection,
80
+ autonomyDenyRejection,
81
+ evaluateSkillToolSurface,
82
+ isAutonomyLevel,
83
+ mapAutonomy
84
+ } from "./chunk-54X7T7DK.js";
85
+ import {
86
+ byteLength,
87
+ truncateUtf8
88
+ } from "./chunk-6XLNIQDB.js";
93
89
  import {
94
90
  ToolNames
95
- } from "./chunk-K6BSR66V.js";
91
+ } from "./chunk-4NSRCOYP.js";
96
92
  import {
97
- resolveSafeCwd
98
- } from "./chunk-HJWWJ6IL.js";
93
+ BASH_HARD_CAP_BYTES,
94
+ combineBashOutput,
95
+ runBashCommand
96
+ } from "./chunk-W54I7H25.js";
97
+ import {
98
+ boundedExternalDiagnostic
99
+ } from "./chunk-6OSVSQL5.js";
99
100
  import {
100
101
  THINKING_LEVELS
101
102
  } from "./chunk-UXCU4E3T.js";
@@ -105,11 +106,15 @@ import {
105
106
  resolveGuardrail
106
107
  } from "./chunk-S66XZJOF.js";
107
108
  import {
108
- clioStateDir
109
- } from "./chunk-BYP5D4HI.js";
109
+ buildSafeToolEnv,
110
+ resolveSafeCwd
111
+ } from "./chunk-TOIVGRUX.js";
110
112
  import {
111
113
  StringEnum
112
- } from "./chunk-VXMFAE2W.js";
114
+ } from "./chunk-YPC6ZR5L.js";
115
+ import {
116
+ clioStateDir
117
+ } from "./chunk-BYP5D4HI.js";
113
118
  import {
114
119
  init_esm_shims
115
120
  } from "./chunk-3R73A4XB.js";
@@ -817,515 +822,16 @@ function createAskUserTool(deps = {}) {
817
822
  };
818
823
  }
819
824
 
820
- // src/domains/dispatch/intent.ts
821
- init_esm_shims();
822
- import path2 from "node:path";
823
-
824
- // src/domains/dispatch/path-scope.ts
825
- init_esm_shims();
826
- import { existsSync } from "node:fs";
827
- var DISPATCH_PATH_TOKEN_RE = /(?:[\w.-]+\/)+[\w.-]+|\b[\w-]+\.[A-Za-z0-9]{1,8}\b/g;
828
- var HTTP_URL_RE = /\bhttps?:\/\/\S+/gu;
829
- var POSIX_ABSOLUTE_TOKEN_RE = /(?:^|[\s("'])((?:\/[\w.~+-]+)+)/gu;
830
- var WINDOWS_ABSOLUTE_TOKEN_RE = /(?:^|[\s("'])([A-Za-z]:[\\/][^\s"']+)/gu;
831
- var BACKSLASH_PATH_RE = /\b[A-Za-z_.-][\w.-]*\\(?:(?:[\w.-]+\\)+[\w.-]+|[\w-]+\.[A-Za-z0-9]{1,8})\b/gu;
832
- var DOUBLE_SEPARATOR_PATH_RE = /\b[\w.-]+\/\/[\w./-]+/gu;
833
- var PARENT_PREFIX_RE = /^(?:\.\.\/)+/u;
834
- var DispatchPathScopeInferenceError = class extends Error {
835
- code;
836
- source;
837
- token;
838
- constructor(code, source, token, detail) {
839
- super(`${code}: ${source} contains ${detail} '${token}'; declare intent explicitly`);
840
- this.name = "DispatchPathScopeInferenceError";
841
- this.code = code;
842
- this.source = source;
843
- this.token = token;
844
- }
845
- };
846
- var DECLARED_EVIDENCE = {
847
- readRoots: {
848
- provenance: "declared",
849
- source: "intent.read_roots",
850
- confidence: "certain",
851
- reason: "explicit_intent"
852
- },
853
- writeRoots: {
854
- provenance: "declared",
855
- source: "intent.write_roots",
856
- confidence: "certain",
857
- reason: "explicit_intent"
858
- },
859
- relevantPaths: {
860
- provenance: "declared",
861
- source: "intent.relevant_paths",
862
- confidence: "certain",
863
- reason: "explicit_intent"
864
- }
865
- };
866
- function cloneEvidence(evidence) {
867
- return { ...evidence };
868
- }
869
- function addProvenance(entries, path5, evidence) {
870
- const current = entries.get(path5);
871
- if (current === void 0) {
872
- entries.set(path5, { path: path5, evidence: [cloneEvidence(evidence)] });
873
- return;
874
- }
875
- if (!current.evidence.some((entry) => entry.source === evidence.source)) {
876
- current.evidence.push(cloneEvidence(evidence));
877
- }
878
- }
879
- function sortedEntries(entries) {
880
- return [...entries.values()].sort((left, right) => left.path < right.path ? -1 : left.path > right.path ? 1 : 0).map((entry) => ({ path: entry.path, evidence: entry.evidence.map(cloneEvidence) }));
881
- }
882
- function declaredIntentPathProvenance(input) {
883
- const entries = /* @__PURE__ */ new Map();
884
- for (const path5 of input.readRoots) addProvenance(entries, path5, DECLARED_EVIDENCE.readRoots);
885
- for (const path5 of input.writeRoots) addProvenance(entries, path5, DECLARED_EVIDENCE.writeRoots);
886
- for (const path5 of input.relevantPaths) addProvenance(entries, path5, DECLARED_EVIDENCE.relevantPaths);
887
- return sortedEntries(entries);
888
- }
889
- function inferredPaths(req, root) {
890
- const paths = /* @__PURE__ */ new Set();
891
- const droppedTokens = /* @__PURE__ */ new Set();
892
- const text = `${req.task}
893
- ${req.briefing ?? ""}`;
894
- for (const match of text.matchAll(DISPATCH_PATH_TOKEN_RE)) {
895
- const inferred = inferredPathToken(match[0], root);
896
- if (inferred.kind === "dropped") {
897
- droppedTokens.add(inferred.token);
898
- continue;
899
- }
900
- const token = inferred.kind === "anchored" ? inferred.resolved : inferred.token;
901
- if (token.startsWith("http://") || token.startsWith("https://")) continue;
902
- paths.add(token);
903
- }
904
- return { paths: [...paths], droppedTokens: [...droppedTokens] };
905
- }
906
- function inferredPathToken(raw, root) {
907
- const token = raw.replace(/^\.\//u, "").replace(/\.+$/u, "");
908
- const parents = PARENT_PREFIX_RE.exec(token)?.[0];
909
- if (parents === void 0) return { kind: "token", token };
910
- const rest = token.slice(parents.length);
911
- const segments = rest.split("/");
912
- if (rest.length === 0 || segments.includes("..") || segments.includes(".")) return { kind: "token", token };
913
- return existsSync(resolvePathBoundary(root, rest)) ? { kind: "anchored", token, resolved: rest } : { kind: "dropped", token };
914
- }
915
- function failMalformedText(text, source) {
916
- const withoutUrls = text.replace(HTTP_URL_RE, (url) => " ".repeat(url.length));
917
- const absolute = POSIX_ABSOLUTE_TOKEN_RE.exec(withoutUrls)?.[1];
918
- POSIX_ABSOLUTE_TOKEN_RE.lastIndex = 0;
919
- if (absolute !== void 0) {
920
- throw new DispatchPathScopeInferenceError("legacy_scope_path_absolute", source, absolute, "an absolute path token");
921
- }
922
- const windowsAbsolute = WINDOWS_ABSOLUTE_TOKEN_RE.exec(withoutUrls)?.[1];
923
- WINDOWS_ABSOLUTE_TOKEN_RE.lastIndex = 0;
924
- if (windowsAbsolute !== void 0) {
925
- throw new DispatchPathScopeInferenceError(
926
- "legacy_scope_path_absolute",
927
- source,
928
- windowsAbsolute,
929
- "an absolute path token"
930
- );
931
- }
932
- for (const pattern of [BACKSLASH_PATH_RE, DOUBLE_SEPARATOR_PATH_RE]) {
933
- const malformed = pattern.exec(withoutUrls)?.[0];
934
- pattern.lastIndex = 0;
935
- if (malformed !== void 0) {
936
- throw new DispatchPathScopeInferenceError(
937
- "legacy_scope_path_malformed",
938
- source,
939
- malformed,
940
- "a malformed path token"
941
- );
942
- }
943
- }
944
- }
945
- function strictInferredPaths(text, source, root) {
946
- failMalformedText(text, source);
947
- const withoutUrls = text.replace(HTTP_URL_RE, (url) => " ".repeat(url.length));
948
- const evidence = source === "task" ? { provenance: "inferred", source, confidence: "medium", reason: "task_path_token" } : { provenance: "inferred", source, confidence: "low", reason: "briefing_path_token" };
949
- const paths = [];
950
- const parentTokens = [];
951
- for (const match of withoutUrls.matchAll(DISPATCH_PATH_TOKEN_RE)) {
952
- const inferred = inferredPathToken(match[0], root);
953
- if (inferred.kind === "dropped") {
954
- parentTokens.push({ token: inferred.token, resolved: null, source });
955
- continue;
956
- }
957
- if (inferred.kind === "anchored") {
958
- parentTokens.push({ token: inferred.token, resolved: inferred.resolved, source });
959
- }
960
- const token = inferred.kind === "anchored" ? inferred.resolved : inferred.token;
961
- try {
962
- paths.push({ path: normalizePathBoundaryEntry(token), evidence });
963
- } catch (error) {
964
- const code = error instanceof PathBoundaryError && error.code === "absolute" ? "legacy_scope_path_absolute" : "legacy_scope_path_malformed";
965
- throw new DispatchPathScopeInferenceError(
966
- code,
967
- source,
968
- token,
969
- code === "legacy_scope_path_absolute" ? "an absolute path token" : "a malformed path token"
970
- );
971
- }
972
- }
973
- return { paths, parentTokens };
974
- }
975
- function legacyPathScope(req, cwd) {
976
- const workingEntries = /* @__PURE__ */ new Map();
977
- const writeEntries = /* @__PURE__ */ new Map();
978
- const writeEvidence = {
979
- provenance: "derived",
980
- source: "writeRoots",
981
- confidence: "high",
982
- reason: "legacy_write_roots"
983
- };
984
- for (const root of req.writeRoots ?? []) {
985
- addProvenance(workingEntries, root, writeEvidence);
986
- addProvenance(writeEntries, asDirectoryPathBoundary(resolvePathBoundary(cwd, root)), writeEvidence);
987
- }
988
- const parentTokens = /* @__PURE__ */ new Map();
989
- const recordParentTokens = (entries) => {
990
- for (const entry of entries) if (!parentTokens.has(entry.token)) parentTokens.set(entry.token, entry);
991
- };
992
- const taskScope = strictInferredPaths(req.task, "task", cwd);
993
- for (const candidate of taskScope.paths) addProvenance(workingEntries, candidate.path, candidate.evidence);
994
- recordParentTokens(taskScope.parentTokens);
995
- if (req.briefing !== void 0) {
996
- const briefingScope = strictInferredPaths(req.briefing, "briefing", cwd);
997
- for (const candidate of briefingScope.paths) addProvenance(workingEntries, candidate.path, candidate.evidence);
998
- recordParentTokens(briefingScope.parentTokens);
999
- }
1000
- const workingContext = [...workingEntries.values()].map((entry) => ({
1001
- path: entry.path,
1002
- evidence: entry.evidence.map(cloneEvidence)
1003
- }));
1004
- const writeBoundaries = [...writeEntries.values()].map((entry) => ({
1005
- path: entry.path,
1006
- evidence: entry.evidence.map(cloneEvidence)
1007
- }));
1008
- return {
1009
- source: "inferred",
1010
- workingContextPaths: workingContext.map((entry) => entry.path),
1011
- writeBoundaries: writeBoundaries.map((entry) => entry.path),
1012
- inferredOnlyPaths: [],
1013
- parentTokens: [...parentTokens.values()],
1014
- provenance: {
1015
- version: 1,
1016
- mode: "legacy-inferred",
1017
- workingContextPaths: workingContext,
1018
- writeBoundaries
1019
- }
1020
- };
1021
- }
1022
- function resolveDispatchPathScope(req) {
1023
- const cwd = req.cwd ?? process.cwd();
1024
- if (req.intent === void 0) return legacyPathScope(req, cwd);
1025
- const declaredProvenance = declaredIntentPathProvenance(req.intent);
1026
- const declaredPaths = declaredProvenance.map((entry) => entry.path);
1027
- const inferred = inferredPaths(req, cwd);
1028
- const inferredOnlyPaths = [
1029
- ...inferred.paths.filter((candidate) => !pathBoundaryCovers(declaredPaths, candidate)),
1030
- ...inferred.droppedTokens
1031
- ];
1032
- const writeEvidence = DECLARED_EVIDENCE.writeRoots;
1033
- const writeBoundaries = req.intent.writeRoots.map((root) => ({
1034
- path: resolvePathBoundary(cwd, root),
1035
- evidence: [cloneEvidence(writeEvidence)]
1036
- }));
1037
- return {
1038
- source: "declared",
1039
- workingContextPaths: declaredPaths,
1040
- writeBoundaries: writeBoundaries.map((entry) => entry.path),
1041
- inferredOnlyPaths,
1042
- // Empty on purpose: the declaration is the scope here, so no "../" token
1043
- // changed what the worker sees and there is nothing for the legacy notice
1044
- // to report. A dropped one still reaches the operator through
1045
- // inferredOnlyPaths above.
1046
- parentTokens: [],
1047
- provenance: {
1048
- version: 1,
1049
- mode: "declared",
1050
- workingContextPaths: declaredProvenance,
1051
- writeBoundaries
1052
- }
1053
- };
1054
- }
1055
- var REPORTABLE_OMITTED_PATH_RE = /\.(?:[cm]?[jt]sx?|json|ya?ml|md|txt|py|go|rs|c|h|cc|cpp|hpp|java|rb|sh|toml|css|html|sql|lock)(?:\/|$)|\/$/u;
1056
- var OMITTED_PATH_REPORT_CAP = 12;
1057
- function reportableOmittedPaths(scope) {
1058
- return scope.inferredOnlyPaths.filter((path5) => REPORTABLE_OMITTED_PATH_RE.test(path5));
1059
- }
1060
- function renderOmittedPaths(paths) {
1061
- if (paths.length <= OMITTED_PATH_REPORT_CAP) return paths.join(", ");
1062
- return `${paths.slice(0, OMITTED_PATH_REPORT_CAP).join(", ")} and ${paths.length - OMITTED_PATH_REPORT_CAP} more`;
1063
- }
1064
- function declaredScopeReplacementDiagnostic(scope) {
1065
- if (scope.source !== "declared") return null;
1066
- const omitted = reportableOmittedPaths(scope);
1067
- if (omitted.length === 0) return null;
1068
- return `typed_scope_replaced_inferred_paths: typed intent omitted prose-inferred paths ${renderOmittedPaths(
1069
- omitted
1070
- )}; those paths did not select project rules or expand worker authority`;
1071
- }
1072
- function declaredScopeReplacementNotice(scope) {
1073
- if (scope.source !== "declared") return null;
1074
- const omittedPaths = reportableOmittedPaths(scope);
1075
- if (omittedPaths.length === 0) return null;
1076
- return {
1077
- code: "typed_scope_replaced_inferred_paths",
1078
- level: "warning",
1079
- omittedPaths,
1080
- message: `[dispatch scope] typed intent replaced prose path inference; omitted paths: ${renderOmittedPaths(
1081
- omittedPaths
1082
- )}. Those paths did not select project rules or expand worker authority.`
1083
- };
1084
- }
1085
- function renderParentTokens(tokens) {
1086
- return renderOmittedPaths(tokens.map((entry) => `${entry.token} -> ${entry.resolved ?? "dropped"}`));
1087
- }
1088
- function inferredScopeParentTokenDiagnostic(scope) {
1089
- const tokens = scope.parentTokens;
1090
- if (tokens.length === 0) return null;
1091
- return `legacy_scope_inferred: prose inference resolved path tokens carrying a leading '../' run against the dispatch root ${renderParentTokens(
1092
- tokens
1093
- )}; an anchored token selects project rules without expanding worker authority and a dropped one took no part in scope`;
1094
- }
1095
- function inferredScopeParentTokenNotice(scope) {
1096
- const tokens = scope.parentTokens;
1097
- if (tokens.length === 0) return null;
1098
- return {
1099
- code: "legacy_scope_inferred",
1100
- level: "warning",
1101
- // Every entry names the raw prose token, the one spelling both outcomes
1102
- // share; the message carries what each one resolved to.
1103
- paths: tokens.map((entry) => ({
1104
- path: entry.token,
1105
- policy: "working-context",
1106
- provenance: "inferred",
1107
- source: entry.source,
1108
- confidence: "low"
1109
- })),
1110
- message: `[dispatch scope] prose inference resolved path tokens carrying a leading '../' run against the dispatch root: ${renderParentTokens(
1111
- tokens
1112
- )}. An anchored token selects project rules without expanding worker authority; a dropped one took no part in scope.`
1113
- };
1114
- }
1115
-
1116
- // src/domains/dispatch/intent.ts
1117
- var DISPATCH_INTENT_PATH_LIST_CAP = PATH_BOUNDARY_MAX_ENTRIES;
1118
- var DISPATCH_INTENT_PATH_ENTRY_BYTES_CAP = 512;
1119
- var DISPATCH_INTENT_VERIFICATION_CAP = 8;
1120
- var DISPATCH_INTENT_TIMEOUT_MIN_MS = 1e3;
1121
- var RAW_FIELDS = /* @__PURE__ */ new Set([
1122
- "version",
1123
- "read_roots",
1124
- "write_roots",
1125
- "relevant_paths",
1126
- "expected_outputs",
1127
- "verification"
1128
- ]);
1129
- function isRecord2(value) {
1130
- return value !== null && typeof value === "object" && !Array.isArray(value);
1131
- }
1132
- function compareCodepoints(left, right) {
1133
- return left < right ? -1 : left > right ? 1 : 0;
1134
- }
1135
- function fail(reason, message) {
1136
- return { ok: false, reason, message };
1137
- }
1138
- function checkedPathText(value, field, index) {
1139
- if (typeof value !== "string" || value.trim().length === 0) {
1140
- return fail("intent_path_malformed", `${field}[${index}] must be a non-empty repository-relative POSIX path`);
1141
- }
1142
- const trimmed = value.trim();
1143
- if (Buffer.byteLength(trimmed, "utf8") > DISPATCH_INTENT_PATH_ENTRY_BYTES_CAP) {
1144
- return fail(
1145
- "intent_path_over_cap",
1146
- `${field}[${index}] exceeds the ${DISPATCH_INTENT_PATH_ENTRY_BYTES_CAP}-byte cap`
1147
- );
1148
- }
1149
- return trimmed;
1150
- }
1151
- function normalizeScopePathEntry(value, field, index) {
1152
- const checked = checkedPathText(value, field, index);
1153
- if (typeof checked !== "string") return checked;
1154
- try {
1155
- return normalizePathBoundaryEntry(checked);
1156
- } catch (error) {
1157
- if (error instanceof PathBoundaryError) {
1158
- if (error.code === "absolute") {
1159
- return fail("intent_path_absolute", `${field}[${index}] must be a repository-relative POSIX path`);
1160
- }
1161
- if (error.code === "parent") {
1162
- return fail("intent_path_escapes_root", `${field}[${index}] escapes the repository root`);
1163
- }
1164
- }
1165
- return fail(
1166
- "intent_path_malformed",
1167
- `${field}[${index}] does not follow the repository path boundary grammar: ${error instanceof Error ? error.message : String(error)}`
1168
- );
1169
- }
1170
- }
1171
- function normalizeExpectedOutputEntry(value, field, index) {
1172
- const checked = checkedPathText(value, field, index);
1173
- if (typeof checked !== "string") return checked;
1174
- const trimmed = checked;
1175
- if (trimmed.includes("\\") || path2.posix.isAbsolute(trimmed) || path2.win32.isAbsolute(trimmed)) {
1176
- return fail("intent_path_absolute", `${field}[${index}] must be a repository-relative POSIX path`);
1177
- }
1178
- const normalized = path2.posix.normalize(trimmed.replace(/^\.\//u, "").replace(/\/{2,}/gu, "/"));
1179
- if (normalized === "." || normalized.length === 0) {
1180
- return fail("intent_path_malformed", `${field}[${index}] must not normalize to an empty path`);
1181
- }
1182
- if (normalized === ".." || normalized.startsWith("../") || normalized.split("/").includes("..")) {
1183
- return fail("intent_path_escapes_root", `${field}[${index}] escapes the repository root`);
1184
- }
1185
- return normalized;
1186
- }
1187
- function normalizePathList(value, field, normalizeEntry = normalizeScopePathEntry) {
1188
- if (value === void 0) return [];
1189
- if (!Array.isArray(value)) return fail("intent_path_malformed", `${field} must be an array`);
1190
- if (value.length > DISPATCH_INTENT_PATH_LIST_CAP) {
1191
- return fail("intent_path_over_cap", `${field} exceeds the ${DISPATCH_INTENT_PATH_LIST_CAP}-entry cap`);
1192
- }
1193
- const normalized = [];
1194
- for (const [index, entry] of value.entries()) {
1195
- if (normalizeEntry === normalizeScopePathEntry && typeof entry === "string" && /^\.\/?$/u.test(entry.trim())) {
1196
- continue;
1197
- }
1198
- const result = normalizeEntry(entry, field, index);
1199
- if (typeof result !== "string") return result;
1200
- normalized.push(result);
1201
- }
1202
- return [...new Set(normalized)].sort(compareCodepoints);
1203
- }
1204
- function declaredScopeIntent(input) {
1205
- const readRoots = normalizePathList(input.readRoots, "intent.read_roots");
1206
- if (!Array.isArray(readRoots)) return readRoots;
1207
- const writeRoots = normalizePathList(input.writeRoots, "intent.write_roots");
1208
- if (!Array.isArray(writeRoots)) return writeRoots;
1209
- const relevantPaths = normalizePathList(input.relevantPaths, "intent.relevant_paths");
1210
- if (!Array.isArray(relevantPaths)) return relevantPaths;
1211
- return {
1212
- ok: true,
1213
- intent: {
1214
- version: 2,
1215
- readRoots,
1216
- writeRoots,
1217
- relevantPaths,
1218
- pathProvenance: declaredIntentPathProvenance({ readRoots, writeRoots, relevantPaths }),
1219
- expectedOutputs: [],
1220
- verification: []
1221
- }
1222
- };
1223
- }
1224
- function isDispatchIntent(value) {
1225
- if (!isRecord2(value) || value.version !== 2) return false;
1226
- for (const field of ["readRoots", "writeRoots", "relevantPaths", "expectedOutputs"]) {
1227
- if (!Array.isArray(value[field]) || !value[field].every((entry) => typeof entry === "string")) return false;
1228
- }
1229
- const readRoots = value.readRoots;
1230
- const writeRoots = value.writeRoots;
1231
- const relevantPaths = value.relevantPaths;
1232
- if (!Array.isArray(value.pathProvenance) || JSON.stringify(value.pathProvenance) !== JSON.stringify(
1233
- declaredIntentPathProvenance({
1234
- readRoots,
1235
- writeRoots,
1236
- relevantPaths
1237
- })
1238
- )) {
1239
- return false;
1240
- }
1241
- return Array.isArray(value.verification) && value.verification.every(
1242
- (entry) => isRecord2(entry) && typeof entry.check === "string" && entry.check.length > 0 && typeof entry.timeoutMs === "number" && Number.isInteger(entry.timeoutMs) && entry.timeoutMs >= DISPATCH_INTENT_TIMEOUT_MIN_MS
1243
- );
1244
- }
1245
- function narrowDispatchIntentToReadOnly(intent) {
1246
- if (intent.writeRoots.length === 0) return intent;
1247
- const readRoots = [.../* @__PURE__ */ new Set([...intent.readRoots, ...intent.writeRoots])].sort(compareCodepoints);
1248
- return {
1249
- version: 2,
1250
- readRoots,
1251
- writeRoots: [],
1252
- relevantPaths: [...intent.relevantPaths],
1253
- pathProvenance: declaredIntentPathProvenance({ readRoots, writeRoots: [], relevantPaths: intent.relevantPaths }),
1254
- expectedOutputs: [...intent.expectedOutputs],
1255
- verification: intent.verification.map((entry) => ({ ...entry }))
1256
- };
1257
- }
1258
- function normalizeDispatchIntent(raw, checks) {
1259
- if (!isRecord2(raw)) return fail("intent_malformed", "intent must be an object");
1260
- const unknown = Object.keys(raw).filter((key) => !RAW_FIELDS.has(key)).sort(compareCodepoints);
1261
- if (unknown.length > 0) return fail("intent_malformed", `intent contains unknown field '${unknown[0]}'`);
1262
- if (raw.version !== void 0 && raw.version !== 2) {
1263
- return fail(
1264
- "intent_version_unsupported",
1265
- `intent declares version ${JSON.stringify(raw.version)}; this build speaks dispatch intent version 2. A declaration at another version is refused rather than migrated: restate read_roots, write_roots, relevant_paths, expected_outputs, and verification under version 2`
1266
- );
1267
- }
1268
- const readRoots = normalizePathList(raw.read_roots, "intent.read_roots");
1269
- if (!Array.isArray(readRoots)) return readRoots;
1270
- const writeRoots = normalizePathList(raw.write_roots, "intent.write_roots");
1271
- if (!Array.isArray(writeRoots)) return writeRoots;
1272
- const relevantPaths = normalizePathList(raw.relevant_paths, "intent.relevant_paths");
1273
- if (!Array.isArray(relevantPaths)) return relevantPaths;
1274
- const expectedOutputs = normalizePathList(
1275
- raw.expected_outputs,
1276
- "intent.expected_outputs",
1277
- normalizeExpectedOutputEntry
1278
- );
1279
- if (!Array.isArray(expectedOutputs)) return expectedOutputs;
1280
- const rawVerification = raw.verification ?? [];
1281
- if (!Array.isArray(rawVerification)) {
1282
- return fail("verification_malformed", "intent.verification must be an array");
1283
- }
1284
- if (rawVerification.length > DISPATCH_INTENT_VERIFICATION_CAP) {
1285
- return fail("verification_over_cap", `intent.verification exceeds the ${DISPATCH_INTENT_VERIFICATION_CAP}-entry cap`);
1286
- }
1287
- const verification = [];
1288
- for (const [index, entry] of rawVerification.entries()) {
1289
- if (!isRecord2(entry) || Object.keys(entry).some((key) => key !== "check" && key !== "timeout_ms")) {
1290
- return fail("verification_malformed", `intent.verification[${index}] must contain check and optional timeout_ms`);
1291
- }
1292
- if (typeof entry.check !== "string" || entry.check.trim().length === 0) {
1293
- return fail("verification_malformed", `intent.verification[${index}].check must be a non-empty declared id`);
1294
- }
1295
- const check = entry.check.trim();
1296
- const declared = checks.get(check);
1297
- if (declared === void 0 && check.toLowerCase() === "none") continue;
1298
- if (declared === void 0) {
1299
- return fail(
1300
- "verification_check_undeclared",
1301
- `verification check '${check}' is undeclared: intent.verification takes only check ids that verify() lists (package.json verification scripts or .clio-coder/verifiers.yaml entries), never a shell command; omit verification and run the check yourself after the receipt, or declare the check first`
1302
- );
1303
- }
1304
- if (entry.timeout_ms !== void 0 && (typeof entry.timeout_ms !== "number" || !Number.isInteger(entry.timeout_ms) || entry.timeout_ms <= 0)) {
1305
- return fail("verification_malformed", `intent.verification[${index}].timeout_ms must be a positive integer`);
1306
- }
1307
- const requested = typeof entry.timeout_ms === "number" ? entry.timeout_ms : declared.timeoutMs;
1308
- verification.push({
1309
- check,
1310
- timeoutMs: Math.min(declared.timeoutMs, Math.max(DISPATCH_INTENT_TIMEOUT_MIN_MS, requested))
1311
- });
1312
- }
1313
- return {
1314
- ok: true,
1315
- intent: {
1316
- version: 2,
1317
- readRoots,
1318
- writeRoots,
1319
- relevantPaths,
1320
- pathProvenance: declaredIntentPathProvenance({ readRoots, writeRoots, relevantPaths }),
1321
- expectedOutputs,
1322
- verification
1323
- }
1324
- };
1325
- }
1326
-
1327
825
  // src/domains/dispatch/budget-envelope.ts
1328
826
  init_esm_shims();
827
+ var NATIVE_CLIO_CONTROLS = ["tool-calls", "read-reserve", "synthesis", "attempt-cap"];
828
+ var EXTERNAL_CLIO_CONTROLS = [
829
+ "single-launch",
830
+ "wall-clock",
831
+ "output-cap",
832
+ "cancellation",
833
+ "result-contract"
834
+ ];
1329
835
  var BudgetAdmissionError = class extends Error {
1330
836
  code;
1331
837
  constructor(code, message) {
@@ -1334,11 +840,11 @@ var BudgetAdmissionError = class extends Error {
1334
840
  this.code = code;
1335
841
  }
1336
842
  };
1337
- function isRecord3(value) {
843
+ function isRecord2(value) {
1338
844
  return typeof value === "object" && value !== null && !Array.isArray(value);
1339
845
  }
1340
846
  function clonePhase(value, prefix) {
1341
- if (!isRecord3(value)) throw new Error(`${prefix} must be an object`);
847
+ if (!isRecord2(value)) throw new Error(`${prefix} must be an object`);
1342
848
  for (const key of Object.keys(value)) {
1343
849
  if (key !== "toolCalls" && key !== "readReserve") throw new Error(`${prefix}.${key} is unknown`);
1344
850
  }
@@ -1357,7 +863,7 @@ function clonePhase(value, prefix) {
1357
863
  return { toolCalls, readReserve };
1358
864
  }
1359
865
  function cloneDispatchBudgetRequest(value, prefix = "budget") {
1360
- if (!isRecord3(value)) throw new Error(`${prefix} must be an object`);
866
+ if (!isRecord2(value)) throw new Error(`${prefix} must be an object`);
1361
867
  for (const key of Object.keys(value)) {
1362
868
  if (key !== "toolCalls" && key !== "readReserve" && key !== "retryRevision") {
1363
869
  throw new Error(`${prefix}.${key} is unknown`);
@@ -1368,6 +874,8 @@ function cloneDispatchBudgetRequest(value, prefix = "budget") {
1368
874
  return { ...phase, ...retryRevision === void 0 ? {} : { retryRevision } };
1369
875
  }
1370
876
  function freezeEnvelope(envelope) {
877
+ Object.freeze(envelope.enforcement.clioControls);
878
+ Object.freeze(envelope.enforcement);
1371
879
  Object.freeze(envelope.policy.default);
1372
880
  Object.freeze(envelope.policy.maximum);
1373
881
  Object.freeze(envelope.policy);
@@ -1506,6 +1014,15 @@ function resolveToolBudgetEnvelope(input) {
1506
1014
  const authoredMaximum = input.policy.maximum ?? input.policy;
1507
1015
  return freezeEnvelope({
1508
1016
  version: 1,
1017
+ enforcement: input.enforcement === "external-one-shot" ? {
1018
+ classification: "external-one-shot",
1019
+ perTool: "unobserved-not-enforced",
1020
+ clioControls: [...EXTERNAL_CLIO_CONTROLS]
1021
+ } : {
1022
+ classification: "native-per-tool",
1023
+ perTool: "enforced",
1024
+ clioControls: [...NATIVE_CLIO_CONTROLS]
1025
+ },
1509
1026
  policy: {
1510
1027
  recipeId: input.recipeId,
1511
1028
  default: {
@@ -1541,7 +1058,8 @@ function formatBudgetRequest(envelope) {
1541
1058
  function formatEffectiveBudget(envelope) {
1542
1059
  const budget = envelope.effective;
1543
1060
  const revision = budget.revision ? `, result revision ${budget.revision.toolCalls}/${budget.revision.readReserve}` : "";
1544
- return `${budget.toolCalls}/${budget.readReserve}${revision}, lifetime cap ${budget.hardCap}, synthesis=${budget.synthesis ? "on" : "off"}`;
1061
+ const enforcement = envelope.enforcement.classification === "external-one-shot" ? "external one-shot; per-tool unobserved/not enforced" : "native per-tool enforced";
1062
+ return `${budget.toolCalls}/${budget.readReserve}${revision}, lifetime cap ${budget.hardCap}, synthesis=${budget.synthesis ? "on" : "off"}; ${enforcement}`;
1545
1063
  }
1546
1064
  function formatBudgetReasons(envelope) {
1547
1065
  return envelope.reasons.length === 0 ? "none" : envelope.reasons.map((reason) => reason.code).join(",");
@@ -1555,16 +1073,19 @@ var BUDGET_REASON_CODES = /* @__PURE__ */ new Set([
1555
1073
  "revision-growth-authorized",
1556
1074
  "revision-growth-denied"
1557
1075
  ]);
1076
+ function isExactStringArray(value, expected) {
1077
+ return value.length === expected.length && value.every((item, index) => item === expected[index]);
1078
+ }
1558
1079
  function cloneRunToolBudgetEnvelope(value) {
1559
1080
  try {
1560
- if (!isRecord3(value) || value.version !== 1 || !isRecord3(value.policy) || !isRecord3(value.effective)) {
1081
+ if (!isRecord2(value) || value.version !== 1 || !isRecord2(value.policy) || !isRecord2(value.effective)) {
1561
1082
  return void 0;
1562
1083
  }
1563
1084
  const recipeId = value.policy.recipeId;
1564
1085
  if (typeof recipeId !== "string" || recipeId.length === 0 || typeof value.policy.exact !== "boolean") {
1565
1086
  return void 0;
1566
1087
  }
1567
- if (!isRecord3(value.policy.default) || typeof value.policy.default.synthesis !== "boolean") return void 0;
1088
+ if (!isRecord2(value.policy.default) || typeof value.policy.default.synthesis !== "boolean") return void 0;
1568
1089
  const defaultPhase = clonePhase(
1569
1090
  { toolCalls: value.policy.default.toolCalls, readReserve: value.policy.default.readReserve },
1570
1091
  "budget.policy.default"
@@ -1584,13 +1105,45 @@ function cloneRunToolBudgetEnvelope(value) {
1584
1105
  }
1585
1106
  const reasons = [];
1586
1107
  for (const reason of value.reasons) {
1587
- if (!isRecord3(reason) || typeof reason.code !== "string" || !BUDGET_REASON_CODES.has(reason.code) || typeof reason.detail !== "string") {
1108
+ if (!isRecord2(reason) || typeof reason.code !== "string" || !BUDGET_REASON_CODES.has(reason.code) || typeof reason.detail !== "string") {
1588
1109
  return void 0;
1589
1110
  }
1590
1111
  reasons.push({ code: reason.code, detail: reason.detail });
1591
1112
  }
1113
+ const enforcement = (() => {
1114
+ if (value.enforcement === void 0) {
1115
+ return {
1116
+ classification: "native-per-tool",
1117
+ perTool: "enforced",
1118
+ clioControls: [...NATIVE_CLIO_CONTROLS]
1119
+ };
1120
+ }
1121
+ if (!isRecord2(value.enforcement) || !Array.isArray(value.enforcement.clioControls)) return null;
1122
+ if (Object.keys(value.enforcement).some(
1123
+ (key) => key !== "classification" && key !== "perTool" && key !== "clioControls"
1124
+ )) {
1125
+ return null;
1126
+ }
1127
+ if (value.enforcement.classification === "external-one-shot" && value.enforcement.perTool === "unobserved-not-enforced" && isExactStringArray(value.enforcement.clioControls, EXTERNAL_CLIO_CONTROLS)) {
1128
+ return {
1129
+ classification: "external-one-shot",
1130
+ perTool: "unobserved-not-enforced",
1131
+ clioControls: [...EXTERNAL_CLIO_CONTROLS]
1132
+ };
1133
+ }
1134
+ if (value.enforcement.classification === "native-per-tool" && value.enforcement.perTool === "enforced" && isExactStringArray(value.enforcement.clioControls, NATIVE_CLIO_CONTROLS)) {
1135
+ return {
1136
+ classification: "native-per-tool",
1137
+ perTool: "enforced",
1138
+ clioControls: [...NATIVE_CLIO_CONTROLS]
1139
+ };
1140
+ }
1141
+ return null;
1142
+ })();
1143
+ if (enforcement === null) return void 0;
1592
1144
  return freezeEnvelope({
1593
1145
  version: 1,
1146
+ enforcement,
1594
1147
  policy: {
1595
1148
  recipeId,
1596
1149
  default: { ...defaultPhase, synthesis: value.policy.default.synthesis },
@@ -1795,6 +1348,10 @@ var TASK_TYPE_RULES = [
1795
1348
  ["debug", /\b(debug|fix|bug|crash|failure|broken|regression)\b/i],
1796
1349
  ["refactor", /\b(refactor|clean ?up|restructure|rename|extract|simplify)\b/i],
1797
1350
  ["config", /\b(config|configuration|settings|setup|install|ci pipeline|workflow file)\b/i],
1351
+ [
1352
+ "world_knowledge",
1353
+ /\b(?:open[- ]world|ecosystem landscape|industry landscape|state of (?:the )?art|current alternatives|latest alternatives|advisory second opinion)\b/i
1354
+ ],
1798
1355
  ["research", /\b(research|investigate|explore|survey|compare|find out)\b/i],
1799
1356
  ["code_read", /\b(read|explain|understand|summarize|describe|walk through|map|locate|trace)\b/i],
1800
1357
  ["code_write", /\b(write|implement|add|create|build|develop|introduce)\b/i]
@@ -1870,6 +1427,11 @@ function agentRouteCandidates(input) {
1870
1427
  var TASK_SIGNALS = {
1871
1428
  code_read: { ids: ["scout"], tags: ["reconnaissance", "symbols", "codewiki"], contracts: ["scout-report"] },
1872
1429
  research: { ids: ["researcher"], tags: ["sources", "external-context", "papers"], contracts: ["research-report"] },
1430
+ world_knowledge: {
1431
+ ids: ["world-knowledge"],
1432
+ tags: ["open-world", "ecosystem", "current-context", "second-opinion"],
1433
+ contracts: ["world-knowledge-report"]
1434
+ },
1873
1435
  code_review: { ids: ["verifier"], tags: ["review", "verification"], contracts: ["verifier-report"] },
1874
1436
  debug: { ids: ["debugger"], tags: ["debugging", "root-cause"], contracts: ["debugger-report"] },
1875
1437
  test: { ids: ["verifier", "tester"], tags: ["tests", "validation", "regression"], contracts: ["verifier-report"] },
@@ -1960,14 +1522,14 @@ var DISPATCH_INTENT_SUPPORTED_VERSIONS = [DISPATCH_INTENT_VERSION];
1960
1522
  function finding(code, decision, detail) {
1961
1523
  return { code, decision, message: `${code}: ${detail}` };
1962
1524
  }
1963
- function isRecord4(value) {
1525
+ function isRecord3(value) {
1964
1526
  return typeof value === "object" && value !== null && !Array.isArray(value);
1965
1527
  }
1966
1528
  function declaredVersion(value) {
1967
1529
  return typeof value.version === "number" && Number.isInteger(value.version) ? value.version : null;
1968
1530
  }
1969
1531
  function isSupportedDispatchIntentVersion(value) {
1970
- if (!isRecord4(value)) return false;
1532
+ if (!isRecord3(value)) return false;
1971
1533
  const version = declaredVersion(value);
1972
1534
  return version !== null && DISPATCH_INTENT_SUPPORTED_VERSIONS.includes(version);
1973
1535
  }
@@ -2031,7 +1593,7 @@ function classifyDispatchIntentCompatibility(input) {
2031
1593
  );
2032
1594
  return findings;
2033
1595
  }
2034
- if (!isRecord4(input.intent)) {
1596
+ if (!isRecord3(input.intent)) {
2035
1597
  findings.push(
2036
1598
  finding(
2037
1599
  "intent_malformed",
@@ -2100,7 +1662,7 @@ function dispatchIntentScopeWidening(ceiling, narrowed) {
2100
1662
 
2101
1663
  // src/domains/dispatch/validation.ts
2102
1664
  init_esm_shims();
2103
- import path3 from "node:path";
1665
+ import path2 from "node:path";
2104
1666
 
2105
1667
  // src/core/response-schema.ts
2106
1668
  init_esm_shims();
@@ -2212,49 +1774,49 @@ function schemaSyntaxError(value) {
2212
1774
  while (stack.length > 0) {
2213
1775
  const frame = stack.pop();
2214
1776
  if (!frame) break;
2215
- const { schema, path: path5 } = frame;
1777
+ const { schema, path: path4 } = frame;
2216
1778
  for (const key of Object.keys(schema)) {
2217
- if (!SUPPORTED_SCHEMA_KEYS.has(key)) return `${path5}.${key} is not supported by the llama.cpp schema subset`;
1779
+ if (!SUPPORTED_SCHEMA_KEYS.has(key)) return `${path4}.${key} is not supported by the llama.cpp schema subset`;
2218
1780
  }
2219
1781
  if (typeof schema.type !== "string" || !SUPPORTED_SCHEMA_TYPES.has(schema.type)) {
2220
- return `${path5}.type must be one of ${[...SUPPORTED_SCHEMA_TYPES].join(", ")}`;
1782
+ return `${path4}.type must be one of ${[...SUPPORTED_SCHEMA_TYPES].join(", ")}`;
2221
1783
  }
2222
1784
  if (schema.type === "object") {
2223
- if (schema.items !== void 0) return `${path5}.items is only valid for array schemas`;
1785
+ if (schema.items !== void 0) return `${path4}.items is only valid for array schemas`;
2224
1786
  if (schema.properties !== void 0 && !isPlainObject(schema.properties)) {
2225
- return `${path5}.properties must be a plain object`;
1787
+ return `${path4}.properties must be a plain object`;
2226
1788
  }
2227
1789
  const properties = schema.properties ?? {};
2228
1790
  for (const [name, child] of Object.entries(properties)) {
2229
- if (!isPlainObject(child)) return `${path5}.properties.${name} must be a schema object`;
2230
- stack.push({ schema: child, path: `${path5}.properties.${name}` });
1791
+ if (!isPlainObject(child)) return `${path4}.properties.${name} must be a schema object`;
1792
+ stack.push({ schema: child, path: `${path4}.properties.${name}` });
2231
1793
  }
2232
1794
  if (schema.required !== void 0) {
2233
1795
  if (!Array.isArray(schema.required) || !schema.required.every((item) => typeof item === "string")) {
2234
- return `${path5}.required must be an array of strings`;
1796
+ return `${path4}.required must be an array of strings`;
2235
1797
  }
2236
1798
  if (new Set(schema.required).size !== schema.required.length) {
2237
- return `${path5}.required must not contain duplicates`;
1799
+ return `${path4}.required must not contain duplicates`;
2238
1800
  }
2239
1801
  for (const name of schema.required) {
2240
- if (!Object.hasOwn(properties, name)) return `${path5}.required names unknown property '${name}'`;
1802
+ if (!Object.hasOwn(properties, name)) return `${path4}.required names unknown property '${name}'`;
2241
1803
  }
2242
1804
  }
2243
1805
  if (schema.additionalProperties !== void 0 && typeof schema.additionalProperties !== "boolean") {
2244
- return `${path5}.additionalProperties must be a boolean`;
1806
+ return `${path4}.additionalProperties must be a boolean`;
2245
1807
  }
2246
1808
  continue;
2247
1809
  }
2248
1810
  if (schema.type === "array") {
2249
- if (!isPlainObject(schema.items)) return `${path5}.items must be a schema object`;
1811
+ if (!isPlainObject(schema.items)) return `${path4}.items must be a schema object`;
2250
1812
  if (schema.properties !== void 0 || schema.required !== void 0 || schema.additionalProperties !== void 0) {
2251
- return `${path5} contains object-only keywords on an array schema`;
1813
+ return `${path4} contains object-only keywords on an array schema`;
2252
1814
  }
2253
- stack.push({ schema: schema.items, path: `${path5}.items` });
1815
+ stack.push({ schema: schema.items, path: `${path4}.items` });
2254
1816
  continue;
2255
1817
  }
2256
1818
  if (schema.properties !== void 0 || schema.required !== void 0 || schema.items !== void 0 || schema.additionalProperties !== void 0) {
2257
- return `${path5} contains container keywords on a ${schema.type} schema`;
1819
+ return `${path4} contains container keywords on a ${schema.type} schema`;
2258
1820
  }
2259
1821
  }
2260
1822
  return null;
@@ -2483,7 +2045,7 @@ function validateJobSpec(spec) {
2483
2045
  }
2484
2046
  }
2485
2047
  if ("protectedArtifactRemap" in spec && spec.protectedArtifactRemap !== void 0) {
2486
- if (!isPlainObject2(spec.protectedArtifactRemap) || Object.keys(spec.protectedArtifactRemap).some((key) => key !== "sourceRoot" && key !== "workerRoot") || typeof spec.protectedArtifactRemap.sourceRoot !== "string" || !path3.isAbsolute(spec.protectedArtifactRemap.sourceRoot) || typeof spec.protectedArtifactRemap.workerRoot !== "string" || !path3.isAbsolute(spec.protectedArtifactRemap.workerRoot)) {
2048
+ if (!isPlainObject2(spec.protectedArtifactRemap) || Object.keys(spec.protectedArtifactRemap).some((key) => key !== "sourceRoot" && key !== "workerRoot") || typeof spec.protectedArtifactRemap.sourceRoot !== "string" || !path2.isAbsolute(spec.protectedArtifactRemap.sourceRoot) || typeof spec.protectedArtifactRemap.workerRoot !== "string" || !path2.isAbsolute(spec.protectedArtifactRemap.workerRoot)) {
2487
2049
  errors.push("protectedArtifactRemap must carry absolute sourceRoot and workerRoot paths");
2488
2050
  }
2489
2051
  }
@@ -2668,7 +2230,7 @@ function validateJobSpec(spec) {
2668
2230
  const effectiveWriteRoots = Array.isArray(spec.writeRoots) && spec.writeRoots.length > 0 && spec.writeRoots.every((root) => typeof root === "string" && root.length > 0) ? spec.writeRoots : isDispatchIntent(spec.intent) && spec.intent.writeRoots.length > 0 ? spec.intent.writeRoots : void 0;
2669
2231
  if (effectiveWriteRoots !== void 0) {
2670
2232
  const jobCwd = typeof spec.cwd === "string" && spec.cwd.length > 0 ? spec.cwd : process.cwd();
2671
- out.writeRoots = isDispatchIntent(spec.intent) ? effectiveWriteRoots.map((root) => resolvePathBoundary(jobCwd, String(root))) : effectiveWriteRoots.map((root) => asDirectoryPathBoundary(path3.resolve(jobCwd, String(root))));
2233
+ out.writeRoots = isDispatchIntent(spec.intent) ? effectiveWriteRoots.map((root) => resolvePathBoundary(jobCwd, String(root))) : effectiveWriteRoots.map((root) => asDirectoryPathBoundary(path2.resolve(jobCwd, String(root))));
2672
2234
  }
2673
2235
  if (typeof spec.requestOrigin === "string" && VALID_REQUEST_ORIGINS.has(spec.requestOrigin)) {
2674
2236
  out.requestOrigin = spec.requestOrigin;
@@ -2733,7 +2295,7 @@ function isValidPlannedNode(value) {
2733
2295
  return value.kind === "ssh" && typeof value.host === "string" && value.host.trim().length > 0;
2734
2296
  }
2735
2297
  function isValidProtectedArtifactRemap(value) {
2736
- return isPlainObject2(value) && typeof value.sourceRoot === "string" && path3.isAbsolute(value.sourceRoot) && typeof value.workerRoot === "string" && path3.isAbsolute(value.workerRoot);
2298
+ return isPlainObject2(value) && typeof value.sourceRoot === "string" && path2.isAbsolute(value.sourceRoot) && typeof value.workerRoot === "string" && path2.isAbsolute(value.workerRoot);
2737
2299
  }
2738
2300
  var VALID_GATE_ROLES = /* @__PURE__ */ new Set(["builder", "reviewer", "candidate", "judge", "member", "synthesis"]);
2739
2301
  var VALID_GATE_VERDICTS = /* @__PURE__ */ new Set(["pass", "fail", "revise"]);
@@ -2769,7 +2331,7 @@ function isValidGate(value) {
2769
2331
  if (value.worktree !== void 0) {
2770
2332
  if (!isPlainObject2(value.worktree)) return false;
2771
2333
  if (typeof value.worktree.backend !== "string" || !VALID_WORKTREE_BACKENDS.has(value.worktree.backend)) return false;
2772
- if (typeof value.worktree.path !== "string" || !path3.isAbsolute(value.worktree.path)) return false;
2334
+ if (typeof value.worktree.path !== "string" || !path2.isAbsolute(value.worktree.path)) return false;
2773
2335
  if (typeof value.worktree.branch !== "string" || value.worktree.branch.length === 0) return false;
2774
2336
  if (value.worktree.workspaceId !== void 0 && typeof value.worktree.workspaceId !== "string") return false;
2775
2337
  if (value.worktree.fallback !== void 0 && (typeof value.worktree.fallback !== "string" || !VALID_WORKTREE_FALLBACKS.has(value.worktree.fallback))) {
@@ -2836,6 +2398,7 @@ var AUTO_BASELINE_BY_TASK_TYPE = {
2836
2398
  // Read-only shapes.
2837
2399
  code_review: "verifier",
2838
2400
  research: "researcher",
2401
+ world_knowledge: "world-knowledge",
2839
2402
  code_read: "scout",
2840
2403
  unknown: "scout"
2841
2404
  };
@@ -2851,7 +2414,7 @@ var DEFAULT_MAX_OUTPUT_BYTES = 2e4;
2851
2414
  var PERSONA_MAX_CHARS = 8e3;
2852
2415
  var THINKING_LEVELS2 = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
2853
2416
  var VALID_THINKING2 = new Set(THINKING_LEVELS2);
2854
- function isRecord5(value) {
2417
+ function isRecord4(value) {
2855
2418
  return typeof value === "object" && value !== null && !Array.isArray(value);
2856
2419
  }
2857
2420
  function stringArg(args, ...names) {
@@ -2931,7 +2494,7 @@ function dispatchRequestFromArgs(args, options) {
2931
2494
  if (request.worktree !== true) return { ok: false, message: "apply requires worktree: true" };
2932
2495
  request.apply = args.apply;
2933
2496
  }
2934
- if (Object.hasOwn(args, "gate") && isRecord5(args.intent) && Object.hasOwn(args.intent, "verification")) {
2497
+ if (Object.hasOwn(args, "gate") && isRecord4(args.intent) && Object.hasOwn(args.intent, "verification")) {
2935
2498
  return { ok: false, message: "gate_and_intent_verification_conflict: gate cannot combine with intent.verification" };
2936
2499
  }
2937
2500
  let rawIntent = args.intent;
@@ -2942,7 +2505,7 @@ function dispatchRequestFromArgs(args, options) {
2942
2505
  message: "gate must be a non-empty declared check id: a check verify() lists, never a shell command; omit gate and run the check yourself after the receipt"
2943
2506
  };
2944
2507
  }
2945
- rawIntent = { ...isRecord5(rawIntent) ? rawIntent : {}, verification: [{ check: args.gate.trim() }] };
2508
+ rawIntent = { ...isRecord4(rawIntent) ? rawIntent : {}, verification: [{ check: args.gate.trim() }] };
2946
2509
  }
2947
2510
  if (rawIntent !== void 0) {
2948
2511
  if (options.resolveIntent === void 0) return { ok: false, message: "intent resolver is unavailable" };
@@ -3014,9 +2577,9 @@ function dispatchRequestsFromArgs(args, options) {
3014
2577
  const requests = [];
3015
2578
  for (let index = 0; index < tasks.length; index += 1) {
3016
2579
  const item = tasks[index];
3017
- const itemArgs = isRecord5(item) ? { ...shared, ...item } : { ...shared, task: item };
3018
- const sharedIntent = isRecord5(shared.intent) ? shared.intent : null;
3019
- const itemIntent = isRecord5(item) && Object.hasOwn(item, "intent") && isRecord5(item.intent) ? item.intent : null;
2580
+ const itemArgs = isRecord4(item) ? { ...shared, ...item } : { ...shared, task: item };
2581
+ const sharedIntent = isRecord4(shared.intent) ? shared.intent : null;
2582
+ const itemIntent = isRecord4(item) && Object.hasOwn(item, "intent") && isRecord4(item.intent) ? item.intent : null;
3020
2583
  if (sharedIntent !== null && itemIntent !== null) itemArgs.intent = { ...sharedIntent, ...itemIntent };
3021
2584
  const parsed = dispatchRequestFromArgs(itemArgs, options);
3022
2585
  if (!parsed.ok) return { ok: false, message: `dispatch: task ${index + 1}: ${parsed.message}` };
@@ -3047,7 +2610,7 @@ function prepareDispatchArguments(args) {
3047
2610
  }
3048
2611
  }
3049
2612
  }
3050
- if (isRecord5(next.tasks)) next.tasks = [next.tasks];
2613
+ if (isRecord4(next.tasks)) next.tasks = [next.tasks];
3051
2614
  if (typeof next.tasks === "string") next.tasks = [next.tasks];
3052
2615
  if (next.tasks === void 0 && typeof next.task === "string") {
3053
2616
  const { task: _task, ...rest } = next;
@@ -3105,7 +2668,7 @@ function withResolvedPlanTaskPin(request, task, options = {}) {
3105
2668
  }
3106
2669
  };
3107
2670
  }
3108
- function isRecord6(value) {
2671
+ function isRecord5(value) {
3109
2672
  return typeof value === "object" && value !== null && !Array.isArray(value);
3110
2673
  }
3111
2674
  function str(value) {
@@ -3163,10 +2726,10 @@ function taskViews(args) {
3163
2726
  const sharedNode = str(args.node);
3164
2727
  const sharedTarget = str(args.target);
3165
2728
  return tasks.map((item) => {
3166
- const record2 = isRecord6(item) ? item : {};
2729
+ const record3 = isRecord5(item) ? item : {};
3167
2730
  const view = {
3168
- agent: str(record2.agent) ?? sharedAgent,
3169
- task: str(item) ?? str(record2.task) ?? "(invalid task)",
2731
+ agent: str(record3.agent) ?? sharedAgent,
2732
+ task: str(item) ?? str(record3.task) ?? "(invalid task)",
3170
2733
  routeApproval: null,
3171
2734
  agentSelection: null,
3172
2735
  stepId: null,
@@ -3177,23 +2740,23 @@ function taskViews(args) {
3177
2740
  agentDecision: null,
3178
2741
  wave: null
3179
2742
  };
3180
- const briefing = "briefing" in record2 ? str(record2.briefing) : str(args.briefing);
2743
+ const briefing = "briefing" in record3 ? str(record3.briefing) : str(args.briefing);
3181
2744
  if (briefing !== void 0) view.briefing = briefing;
3182
- const worktree = "worktree" in record2 ? record2.worktree : args.worktree;
2745
+ const worktree = "worktree" in record3 ? record3.worktree : args.worktree;
3183
2746
  if (worktree === true) {
3184
2747
  view.worktree = true;
3185
- const apply = "apply" in record2 ? record2.apply : args.apply;
2748
+ const apply = "apply" in record3 ? record3.apply : args.apply;
3186
2749
  view.apply = apply === "preserve" ? "preserve" : "merge";
3187
2750
  }
3188
- const model = str(record2.model) ?? sharedModel;
2751
+ const model = str(record3.model) ?? sharedModel;
3189
2752
  if (model !== void 0) view.model = model;
3190
- const node = str(record2.node) ?? sharedNode;
2753
+ const node = str(record3.node) ?? sharedNode;
3191
2754
  if (node !== void 0) view.node = node;
3192
- const target = str(record2.target) ?? sharedTarget;
2755
+ const target = str(record3.target) ?? sharedTarget;
3193
2756
  if (target !== void 0) view.target = target;
3194
- const failover = failoverModeOf(record2.failover) ?? failoverModeOf(args.failover);
2757
+ const failover = failoverModeOf(record3.failover) ?? failoverModeOf(args.failover);
3195
2758
  if (failover !== void 0) view.failover = failover;
3196
- const rawCandidates = "allowedCandidates" in record2 ? record2.allowedCandidates : args.allowedCandidates;
2759
+ const rawCandidates = "allowedCandidates" in record3 ? record3.allowedCandidates : args.allowedCandidates;
3197
2760
  const candidates = canonicalCandidates(rawCandidates);
3198
2761
  if (failover === "approved" && candidates !== null) view.allowedCandidates = candidates;
3199
2762
  return view;
@@ -3206,7 +2769,7 @@ function canonicalCandidates(value) {
3206
2769
  if (!Array.isArray(value)) return null;
3207
2770
  const out = [];
3208
2771
  for (const item of value) {
3209
- if (!isRecord6(item)) return null;
2772
+ if (!isRecord5(item)) return null;
3210
2773
  const agentId = str(item.agentId);
3211
2774
  const target = str(item.target);
3212
2775
  const model = str(item.model);
@@ -3217,10 +2780,10 @@ function canonicalCandidates(value) {
3217
2780
  return out.length > 0 ? out : null;
3218
2781
  }
3219
2782
  function topologyOf(args) {
3220
- if (isRecord6(args.apply_winner)) return "compete";
2783
+ if (isRecord5(args.apply_winner)) return "compete";
3221
2784
  if (args.mode === "compete") return "compete";
3222
2785
  if (args.mode === "council") return "council";
3223
- if (args.review === true || isRecord6(args.review)) return "review";
2786
+ if (args.review === true || isRecord5(args.review)) return "review";
3224
2787
  if (args.detach === true) return "detached";
3225
2788
  if (args.mode === "sequential") return "sequential";
3226
2789
  if (args.mode === "pipeline") return "pipeline";
@@ -3303,14 +2866,14 @@ function renderPlanText(topology, tasks, costCeilingUsd, deadlineMs, source, max
3303
2866
  lines.push(...renderLegacyPathScope(task, cwd));
3304
2867
  for (const check of task.resolvedVerification ?? []) {
3305
2868
  lines.push(
3306
- ` verification check=${safeField(check.check)} argv=${JSON.stringify(check.argv)} cwd=${JSON.stringify(check.cwd)} timeout_ms=${check.timeoutMs}`
2869
+ ` verification check=${safeField(check.check)}${check.kind !== void 0 ? ` kind=${check.kind}` : ""} argv=${JSON.stringify(check.argv)} cwd=${JSON.stringify(check.cwd)} timeout_ms=${check.timeoutMs}`
3307
2870
  );
3308
2871
  }
3309
2872
  }
3310
2873
  return lines.join("\n");
3311
2874
  }
3312
2875
  function isResolvedTask(value) {
3313
- if (!isRecord6(value)) return false;
2876
+ if (!isRecord5(value)) return false;
3314
2877
  const allowedKeys = /* @__PURE__ */ new Set([
3315
2878
  "agent",
3316
2879
  "task",
@@ -3367,7 +2930,7 @@ function isResolvedTask(value) {
3367
2930
  }
3368
2931
  if (value.position !== void 0 && (!Number.isInteger(value.position) || Number(value.position) < 1)) return false;
3369
2932
  if (value.council !== void 0) {
3370
- if (!isRecord6(value.council) || typeof value.council.label !== "string" || value.council.label.length === 0 || value.council.color !== void 0 && typeof value.council.color !== "string" || !Number.isInteger(value.council.round) || Number(value.council.round) < 1 || !Number.isInteger(value.council.rounds) || Number(value.council.rounds) < 1 || value.council.synthesis !== "none" && value.council.synthesis !== "judge" && value.council.synthesis !== "vote")
2933
+ if (!isRecord5(value.council) || typeof value.council.label !== "string" || value.council.label.length === 0 || value.council.color !== void 0 && typeof value.council.color !== "string" || !Number.isInteger(value.council.round) || Number(value.council.round) < 1 || !Number.isInteger(value.council.rounds) || Number(value.council.rounds) < 1 || value.council.synthesis !== "none" && value.council.synthesis !== "judge" && value.council.synthesis !== "vote")
3371
2934
  return false;
3372
2935
  }
3373
2936
  if (value.nodeKind !== "local" && value.nodeKind !== "ssh") return false;
@@ -3395,7 +2958,7 @@ function isResolvedTask(value) {
3395
2958
  if (value.agentDecision !== null && !isAgentDecision(value.agentDecision)) return false;
3396
2959
  if (value.intent !== void 0 && !isDispatchIntent(value.intent)) return false;
3397
2960
  if (value.resolvedVerification !== void 0 && (!Array.isArray(value.resolvedVerification) || !value.resolvedVerification.every(
3398
- (check) => isRecord6(check) && typeof check.check === "string" && Array.isArray(check.argv) && check.argv.every((arg) => typeof arg === "string") && typeof check.cwd === "string" && typeof check.timeoutMs === "number"
2961
+ (check) => isRecord5(check) && typeof check.check === "string" && Array.isArray(check.argv) && check.argv.every((arg) => typeof arg === "string") && typeof check.cwd === "string" && typeof check.timeoutMs === "number" && (check.kind === void 0 || check.kind === "numeric-compare" || check.kind === "perf-budget") && (check.numeric === void 0 || isRecord5(check.numeric) && typeof check.numeric.reference === "string") && (check.perf === void 0 || isRecord5(check.perf))
3399
2962
  )))
3400
2963
  return false;
3401
2964
  if (value.failover === "approved") {
@@ -3414,6 +2977,7 @@ var RESULT_CONTRACT_KINDS = /* @__PURE__ */ new Set([
3414
2977
  "council-report",
3415
2978
  "debugger-report",
3416
2979
  "research-report",
2980
+ "world-knowledge-report",
3417
2981
  "mutation-report",
3418
2982
  "provenance-report",
3419
2983
  "oracle-report",
@@ -3423,13 +2987,13 @@ var RESULT_CONTRACT_KINDS = /* @__PURE__ */ new Set([
3423
2987
  "delegation-plan"
3424
2988
  ]);
3425
2989
  function isAuthorityGrant(value) {
3426
- return isRecord6(value) && Object.keys(value).sort().join("\0") === "basis\0requested" && AGENT_AUTOMATION_AUTHORITIES.includes(value.requested) && (value.basis === "operator-plan-approval" || value.basis === "full-auto-policy");
2990
+ return isRecord5(value) && Object.keys(value).sort().join("\0") === "basis\0requested" && AGENT_AUTOMATION_AUTHORITIES.includes(value.requested) && (value.basis === "operator-plan-approval" || value.basis === "full-auto-policy");
3427
2991
  }
3428
2992
  function isAgentDecision(value) {
3429
- return isRecord6(value) && value.policyVersion === ROUTE_POLICY_VERSION && (value.mode === "shadow" || value.mode === "active" || value.mode === "fixed") && isRecord6(value.selected) && isRecord6(value.executedRoute) && Array.isArray(value.approvedFallbacks) && Array.isArray(value.candidateEvaluations) && Array.isArray(value.hardConstraints) && Array.isArray(value.reasonCodes) && typeof value.decisionHash === "string" && /^[0-9a-f]{64}$/u.test(value.decisionHash) && isRouteDecisionAgentSelection(value.agentSelection);
2993
+ return isRecord5(value) && value.policyVersion === ROUTE_POLICY_VERSION && (value.mode === "shadow" || value.mode === "active" || value.mode === "fixed") && isRecord5(value.selected) && isRecord5(value.executedRoute) && Array.isArray(value.approvedFallbacks) && Array.isArray(value.candidateEvaluations) && Array.isArray(value.hardConstraints) && Array.isArray(value.reasonCodes) && typeof value.decisionHash === "string" && /^[0-9a-f]{64}$/u.test(value.decisionHash) && isRouteDecisionAgentSelection(value.agentSelection);
3430
2994
  }
3431
2995
  function isResolvedAgentSelection(value) {
3432
- if (!isRecord6(value)) return false;
2996
+ if (!isRecord5(value)) return false;
3433
2997
  if (Object.keys(value).sort().join("\0") !== ["approvedAuthorities", "authorityBasis", "baselineAgentId", "mode", "version"].sort().join("\0"))
3434
2998
  return false;
3435
2999
  if (value.version !== 1 || value.mode !== "auto") return false;
@@ -3443,7 +3007,7 @@ function isResolvedAgentSelection(value) {
3443
3007
  }
3444
3008
  function resolvedDispatchPlanFromArgs(args) {
3445
3009
  const value = args[RESOLVED_DISPATCH_PLAN_ARGUMENT];
3446
- if (!isRecord6(value) || value.version !== 3) return null;
3010
+ if (!isRecord5(value) || value.version !== 3) return null;
3447
3011
  const artifactKeys = /* @__PURE__ */ new Set([
3448
3012
  "version",
3449
3013
  "topology",
@@ -3471,7 +3035,7 @@ function resolvedDispatchPlanFromArgs(args) {
3471
3035
  if (!Array.isArray(value.tasks) || !value.tasks.every(isResolvedTask)) return null;
3472
3036
  let confirmation;
3473
3037
  if (value.confirmation !== void 0) {
3474
- if (!isRecord6(value.confirmation) || !["branch\0group\0index", "branch\0cwd\0group\0index"].includes(
3038
+ if (!isRecord5(value.confirmation) || !["branch\0group\0index", "branch\0cwd\0group\0index"].includes(
3475
3039
  Object.keys(value.confirmation).sort().join("\0")
3476
3040
  ) || typeof value.confirmation.branch !== "string" || value.confirmation.branch.trim().length === 0 || typeof value.confirmation.group !== "string" || value.confirmation.group.trim().length === 0 || value.confirmation.cwd !== void 0 && (typeof value.confirmation.cwd !== "string" || value.confirmation.cwd.trim().length === 0) || !Number.isInteger(value.confirmation.index) || Number(value.confirmation.index) < 1) {
3477
3041
  return null;
@@ -3550,7 +3114,7 @@ function resolvedDispatchPlanFromArgs(args) {
3550
3114
  }
3551
3115
  function parsePlanSource(value) {
3552
3116
  if (value === null) return null;
3553
- if (!isRecord6(value) || Object.keys(value).sort().join("\0") !== "executionPlanHash\0kind\0receiptDigest\0runId")
3117
+ if (!isRecord5(value) || Object.keys(value).sort().join("\0") !== "executionPlanHash\0kind\0receiptDigest\0runId")
3554
3118
  return void 0;
3555
3119
  if (value.kind !== "scout-transition" || typeof value.runId !== "string" || value.runId.length === 0 || typeof value.receiptDigest !== "string" || !/^[0-9a-f]{64}$/u.test(value.receiptDigest) || typeof value.executionPlanHash !== "string" || !/^[0-9a-f]{64}$/u.test(value.executionPlanHash))
3556
3120
  return void 0;
@@ -3577,7 +3141,7 @@ function describeDispatchPlan(rawArgs) {
3577
3141
  const maxWorkers = resolved?.maxWorkers ?? null;
3578
3142
  const onFailure = resolved?.onFailure ?? null;
3579
3143
  const remote = tasks.some((task) => task.node !== void 0 && task.node !== "local");
3580
- const planScale = !preparationFailed && args.list !== true && (tasks.length > 1 || source !== null || topology === "compete" || topology === "council" || remote || tasks.some((task) => task.failover === "approved") || confirmation !== void 0 || isRecord6(args.apply_winner));
3144
+ const planScale = !preparationFailed && args.list !== true && (tasks.length > 1 || source !== null || topology === "compete" || topology === "council" || remote || tasks.some((task) => task.failover === "approved") || confirmation !== void 0 || isRecord5(args.apply_winner));
3581
3145
  const text = renderPlanText(
3582
3146
  topology,
3583
3147
  tasks,
@@ -4073,7 +3637,8 @@ ${guidance}`,
4073
3637
  return { kind: "blocked", reason, decision: blocked };
4074
3638
  }
4075
3639
  function skillSurfaceBlockedVerdict(decision, tool, violation) {
4076
- const reason = violation.disallowedBy.length > 0 ? `${tool} is disallowed by the active skill(s) ${violation.disallowedBy.join(", ")} (disallowed-tools). The narrowing ends when the skill policy's turn or worker run ends. Work within the skill workflow; if it genuinely needs this step, use ask_user when available or state the blocker in your reply.` : `${tool} is outside the tool surface declared by the active skill(s) ${violation.skills.join(", ")}. Tools are narrowed to: ${(violation.mergedAllowedTools ?? []).join(", ")} (plus context and ask_user). The narrowing ends when the skill policy's turn or worker run ends. Work within the skill workflow; if it genuinely needs this step, use ask_user when available or state the blocker in your reply.`;
3640
+ const lifetime = violation.carriedSurface ? "The narrowing stays active for the rest of the session, across the operator's later turns, until a different skill replaces it or the operator clears it with /skill off." : "The narrowing ends when the skill policy's turn or worker run ends.";
3641
+ const reason = violation.disallowedBy.length > 0 ? `${tool} is disallowed by the active skill(s) ${violation.disallowedBy.join(", ")} (disallowed-tools). ${lifetime} Work within the skill workflow; if it genuinely needs this step, use ask_user when available or state the blocker in your reply.` : `${tool} is outside the tool surface declared by the active skill(s) ${violation.skills.join(", ")}. Tools are narrowed to: ${(violation.mergedAllowedTools ?? []).join(", ")} (plus context and ask_user). The limitation receipt is also available unless explicitly disallowed. ${lifetime} Work within the skill workflow; if it genuinely needs this step, use ask_user when available or state the blocker in your reply.`;
4077
3642
  const blocked = {
4078
3643
  kind: "block",
4079
3644
  classification: decision.classification,
@@ -4230,7 +3795,8 @@ var RUNTIME_API_FAMILIES = [
4230
3795
  "rerank-http",
4231
3796
  "embeddings-http",
4232
3797
  "claude-agent-sdk",
4233
- "claude-code-subprocess"
3798
+ "claude-code-subprocess",
3799
+ "external-agent-subprocess"
4234
3800
  ];
4235
3801
  var RUNTIME_AUTHS = [
4236
3802
  "api-key",
@@ -4303,15 +3869,15 @@ function readString(value, source, options) {
4303
3869
  if (!options?.allowEmpty && value.length === 0) throw new Error(`${source} must be a non-empty string`);
4304
3870
  return value;
4305
3871
  }
4306
- function readOptionalString(record2, key, source) {
4307
- if (record2[key] !== void 0) readString(record2[key], `${source}.${key}`);
3872
+ function readOptionalString(record3, key, source) {
3873
+ if (record3[key] !== void 0) readString(record3[key], `${source}.${key}`);
4308
3874
  }
4309
- function readOptionalBoolean(record2, key, source) {
4310
- const value = record2[key];
3875
+ function readOptionalBoolean(record3, key, source) {
3876
+ const value = record3[key];
4311
3877
  if (value !== void 0 && typeof value !== "boolean") throw new Error(`${source}.${key} must be a boolean`);
4312
3878
  }
4313
- function readOptionalNumber(record2, key, source) {
4314
- const value = record2[key];
3879
+ function readOptionalNumber(record3, key, source) {
3880
+ const value = record3[key];
4315
3881
  if (value !== void 0 && (typeof value !== "number" || !Number.isFinite(value))) {
4316
3882
  throw new Error(`${source}.${key} must be a finite number`);
4317
3883
  }
@@ -4322,15 +3888,15 @@ function readEnum(value, source, allowed) {
4322
3888
  }
4323
3889
  return value;
4324
3890
  }
4325
- function readOptionalEnum(record2, key, source, allowed) {
4326
- if (record2[key] !== void 0) readEnum(record2[key], `${source}.${key}`, allowed);
3891
+ function readOptionalEnum(record3, key, source, allowed) {
3892
+ if (record3[key] !== void 0) readEnum(record3[key], `${source}.${key}`, allowed);
4327
3893
  }
4328
3894
  function readStringArray(value, source) {
4329
3895
  if (!Array.isArray(value)) throw new Error(`${source} must be an array`);
4330
3896
  return value.map((item, index) => readString(item, `${source}[${index}]`));
4331
3897
  }
4332
- function readOptionalStringArray(record2, key, source) {
4333
- if (record2[key] !== void 0) readStringArray(record2[key], `${source}.${key}`);
3898
+ function readOptionalStringArray(record3, key, source) {
3899
+ if (record3[key] !== void 0) readStringArray(record3[key], `${source}.${key}`);
4334
3900
  }
4335
3901
  function validateProtectedModels(value) {
4336
3902
  if (value === void 0) return;
@@ -4397,6 +3963,9 @@ function validateCapabilityPatch(value, source) {
4397
3963
  for (const key of ["contextWindow", "maxTokens"]) {
4398
3964
  readOptionalNumber(caps, key, source);
4399
3965
  }
3966
+ if (caps.thinkingControlRuntime !== void 0) {
3967
+ readEnum(caps.thinkingControlRuntime, `${source}.thinkingControlRuntime`, ["lmstudio", "llamacpp"]);
3968
+ }
4400
3969
  for (const key of ["toolCallFormat", "thinkingFormat", "structuredOutputs"]) {
4401
3970
  readOptionalString(caps, key, source);
4402
3971
  }
@@ -4698,31 +4267,118 @@ import { spawn } from "node:child_process";
4698
4267
 
4699
4268
  // src/engine/external-subprocess.ts
4700
4269
  init_esm_shims();
4270
+ async function* readBoundedLines(readable, options) {
4271
+ let segments = [];
4272
+ let lineBytes = 0;
4273
+ let totalBytes = 0;
4274
+ let discarding = false;
4275
+ const finishLine = () => {
4276
+ if (discarding) {
4277
+ segments = [];
4278
+ lineBytes = 0;
4279
+ discarding = false;
4280
+ return { kind: "oversized" };
4281
+ }
4282
+ if (lineBytes === 0) return { kind: "line", line: "" };
4283
+ const joined = Buffer.concat(segments, lineBytes);
4284
+ segments = [];
4285
+ lineBytes = 0;
4286
+ const end = joined.at(-1) === 13 ? joined.length - 1 : joined.length;
4287
+ return { kind: "line", line: joined.subarray(0, end).toString("utf8") };
4288
+ };
4289
+ for await (const raw of readable) {
4290
+ const chunk = Buffer.isBuffer(raw) ? raw : Buffer.from(String(raw));
4291
+ totalBytes += chunk.byteLength;
4292
+ if (totalBytes > options.maxTotalBytes) throw new Error("external stdout exceeded the cumulative output limit");
4293
+ let offset = 0;
4294
+ while (offset < chunk.length) {
4295
+ const newline = chunk.indexOf(10, offset);
4296
+ const end = newline === -1 ? chunk.length : newline;
4297
+ const piece = chunk.subarray(offset, end);
4298
+ if (!discarding && piece.length > 0) {
4299
+ if (lineBytes + piece.length > options.maxLineBytes) {
4300
+ segments = [];
4301
+ lineBytes = 0;
4302
+ discarding = true;
4303
+ } else {
4304
+ segments.push(piece);
4305
+ lineBytes += piece.length;
4306
+ }
4307
+ }
4308
+ if (newline === -1) break;
4309
+ const line = finishLine();
4310
+ if (line) yield line;
4311
+ offset = newline + 1;
4312
+ }
4313
+ }
4314
+ if (discarding || lineBytes > 0) {
4315
+ const line = finishLine();
4316
+ if (line) yield line;
4317
+ }
4318
+ }
4701
4319
  async function readStderr(child) {
4702
- let stderr = "";
4320
+ let tail = Buffer.alloc(0);
4703
4321
  for await (const chunk of child.stderr) {
4704
- stderr += String(chunk);
4705
- if (stderr.length > 8192) stderr = stderr.slice(-8192);
4322
+ const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk));
4323
+ tail = Buffer.concat([tail, bytes]);
4324
+ if (tail.byteLength > 8192) tail = tail.subarray(tail.byteLength - 8192);
4706
4325
  }
4707
- return stderr;
4326
+ return boundedExternalDiagnostic(tail.toString("utf8"));
4327
+ }
4328
+ function createProcessTreeTerminator(child, graceMs = 1500) {
4329
+ let sent = false;
4330
+ let timer = null;
4331
+ const signal = (name) => {
4332
+ if (child.pid && process.platform !== "win32") {
4333
+ try {
4334
+ process.kill(-child.pid, name);
4335
+ return;
4336
+ } catch {
4337
+ }
4338
+ }
4339
+ if (child.exitCode !== null) return;
4340
+ child.kill(name);
4341
+ };
4342
+ return {
4343
+ terminate() {
4344
+ if (sent) return;
4345
+ sent = true;
4346
+ signal("SIGTERM");
4347
+ timer = setTimeout(() => {
4348
+ timer = null;
4349
+ signal("SIGKILL");
4350
+ }, graceMs);
4351
+ },
4352
+ cleanup() {
4353
+ if (timer) {
4354
+ clearTimeout(timer);
4355
+ timer = null;
4356
+ signal("SIGKILL");
4357
+ }
4358
+ }
4359
+ };
4708
4360
  }
4709
4361
  function waitForClose(child) {
4710
4362
  return new Promise((resolve) => {
4711
- child.once("error", () => resolve(1));
4712
- child.once("close", (code) => resolve(code ?? 1));
4363
+ let settled = false;
4364
+ const finish = (code) => {
4365
+ if (settled) return;
4366
+ settled = true;
4367
+ resolve(code);
4368
+ };
4369
+ child.once("error", () => finish(1));
4370
+ child.once("close", (code) => finish(code ?? 1));
4713
4371
  });
4714
4372
  }
4715
4373
 
4716
4374
  // src/engine/antigravity/subprocess-runtime.ts
4717
4375
  var ANTIGRAVITY_BINARY = "agy";
4718
- var ZERO_USAGE = {
4719
- input: 0,
4720
- output: 0,
4721
- cacheRead: 0,
4722
- cacheWrite: 0,
4723
- totalTokens: 0,
4724
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
4725
- };
4376
+ var ANTIGRAVITY_MAX_STREAM_LINE_BYTES = 1024 * 1024;
4377
+ var ANTIGRAVITY_MAX_STREAM_BYTES = 8 * 1024 * 1024;
4378
+ var ANTIGRAVITY_MAX_RESPONSE_BYTES = 4 * 1024 * 1024;
4379
+ var ANTIGRAVITY_MAX_PROMPT_BYTES = 4 * 1024 * 1024;
4380
+ var MAX_PROTOCOL_DIAGNOSTICS = 32;
4381
+ var MAX_CONVERSATION_ID_BYTES = 4096;
4726
4382
  function antigravitySubprocessConfigForAutonomy(level, env = process.env) {
4727
4383
  if (level === "full-auto" && env.CLIO_CODER_ALLOW_EXTERNAL_FULL_ACCESS === "1") {
4728
4384
  return {
@@ -4739,7 +4395,7 @@ function antigravitySubprocessConfigForAutonomy(level, env = process.env) {
4739
4395
  if (level === "read-only") {
4740
4396
  return { extraArgs: ["--mode", "plan", "--sandbox"], dangerousBypass: false, externalMode: "plan+sandbox" };
4741
4397
  }
4742
- return { extraArgs: [], dangerousBypass: false, externalMode: "agy-settings-default" };
4398
+ return { extraArgs: ["--mode", "accept-edits"], dangerousBypass: false, externalMode: "accept-edits" };
4743
4399
  }
4744
4400
  function buildAntigravityPrompt(input) {
4745
4401
  const parts = [];
@@ -4752,120 +4408,319 @@ function buildAntigravityPrompt(input) {
4752
4408
  parts.push(input.task);
4753
4409
  return parts.join("\n\n");
4754
4410
  }
4755
- function buildAgyArgs(input) {
4411
+ function buildAgyStdinLine(input) {
4412
+ const content = buildAntigravityPrompt(input);
4413
+ if (Buffer.byteLength(content, "utf8") > ANTIGRAVITY_MAX_PROMPT_BYTES) {
4414
+ throw new Error(`Antigravity work order exceeded ${ANTIGRAVITY_MAX_PROMPT_BYTES} bytes`);
4415
+ }
4416
+ return `${JSON.stringify({ event: "user", message: { content } })}
4417
+ `;
4418
+ }
4419
+ function buildAgyArgs(input, gateEnv = process.env) {
4756
4420
  assertToolProfileEnforceable(input.toolProfile, "antigravity-code");
4757
- const permission = antigravitySubprocessConfigForAutonomy(input.autonomy);
4758
- const args = ["--print", ...permission.extraArgs];
4421
+ const permission = antigravitySubprocessConfigForAutonomy(input.autonomy, gateEnv);
4422
+ const args = [
4423
+ ...permission.extraArgs,
4424
+ "--input-format",
4425
+ "stream-json",
4426
+ "--output-format",
4427
+ "stream-json",
4428
+ "--disable-slash-commands"
4429
+ ];
4759
4430
  if (input.wireModelId.trim().length > 0) args.push("--model", input.wireModelId.trim());
4760
- args.push(buildAntigravityPrompt(input));
4761
4431
  return args;
4762
4432
  }
4763
- function buildAssistantMessage(input) {
4764
- const message = {
4765
- role: "assistant",
4766
- content: [{ type: "text", text: input.text }],
4767
- api: "google-generative-ai",
4768
- provider: "google",
4769
- model: input.model,
4770
- usage: ZERO_USAGE,
4771
- stopReason: input.aborted ? "aborted" : input.exitCode === 0 ? "stop" : "error",
4772
- timestamp: Date.now()
4433
+ function record2(value) {
4434
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
4435
+ }
4436
+ function parseAntigravityStreamLine(line) {
4437
+ let decoded;
4438
+ try {
4439
+ decoded = JSON.parse(line);
4440
+ } catch {
4441
+ return null;
4442
+ }
4443
+ const envelope = record2(decoded);
4444
+ if (!envelope || typeof envelope.event !== "string") return null;
4445
+ if (envelope.event === "init") {
4446
+ return {
4447
+ event: "init",
4448
+ conversationId: typeof envelope.conversation_id === "string" ? envelope.conversation_id : null,
4449
+ model: typeof envelope.model === "string" ? envelope.model : null
4450
+ };
4451
+ }
4452
+ if (envelope.event === "step_update") {
4453
+ const update = record2(envelope.step_update);
4454
+ if (!update) return null;
4455
+ if (update.step_type !== "agent_response" || typeof update.text_delta !== "string") {
4456
+ return { event: "other" };
4457
+ }
4458
+ return {
4459
+ event: "text",
4460
+ conversationId: typeof update.conversation_id === "string" ? update.conversation_id : null,
4461
+ delta: update.text_delta
4462
+ };
4463
+ }
4464
+ if (envelope.event === "result") {
4465
+ const result = record2(envelope.result);
4466
+ return result ? { event: "result", result } : null;
4467
+ }
4468
+ return { event: "other" };
4469
+ }
4470
+ function finite(value) {
4471
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.min(value, Number.MAX_SAFE_INTEGER) : 0;
4472
+ }
4473
+ function normalizeUsage(raw) {
4474
+ const source = record2(raw) ?? {};
4475
+ const input = finite(source.input_tokens);
4476
+ const output = finite(source.output_tokens);
4477
+ const cacheRead = finite(source.cache_read_tokens);
4478
+ const reasoningTokens = finite(source.thinking_tokens);
4479
+ const usage = {
4480
+ input,
4481
+ output,
4482
+ cacheRead,
4483
+ cacheWrite: 0,
4484
+ totalTokens: finite(source.total_tokens) || input + output + reasoningTokens,
4485
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
4773
4486
  };
4774
- if (input.exitCode !== 0 && !input.aborted) {
4775
- const detail = input.stderr.trim();
4776
- if (detail.length > 0) message.errorMessage = detail;
4487
+ if (reasoningTokens > 0) usage.reasoningTokens = reasoningTokens;
4488
+ return usage;
4489
+ }
4490
+ function appendBoundedText(current, delta) {
4491
+ if (Buffer.byteLength(current, "utf8") + Buffer.byteLength(delta, "utf8") > ANTIGRAVITY_MAX_RESPONSE_BYTES) {
4492
+ throw new Error(`Antigravity response exceeded ${ANTIGRAVITY_MAX_RESPONSE_BYTES} bytes`);
4777
4493
  }
4778
- return message;
4494
+ return current + delta;
4495
+ }
4496
+ function boundedProviderField(value, field) {
4497
+ if (typeof value !== "string") return "";
4498
+ if (Buffer.byteLength(value, "utf8") > ANTIGRAVITY_MAX_RESPONSE_BYTES) {
4499
+ throw new Error(`Antigravity terminal ${field} exceeded ${ANTIGRAVITY_MAX_RESPONSE_BYTES} bytes`);
4500
+ }
4501
+ return value;
4502
+ }
4503
+ function boundedConversationId(value) {
4504
+ if (typeof value !== "string" || value.length === 0) return null;
4505
+ return Buffer.byteLength(value, "utf8") <= MAX_CONVERSATION_ID_BYTES ? value : null;
4506
+ }
4507
+ function protocolFailure(state, detail) {
4508
+ if (state.protocolDiagnostics.length < MAX_PROTOCOL_DIAGNOSTICS) state.protocolDiagnostics.push(detail);
4779
4509
  }
4780
4510
  function emitTextDelta(emit, state, delta) {
4781
4511
  if (delta.length === 0) return;
4782
- state.text += delta;
4783
- const message = buildAssistantMessage({
4784
- model: state.model,
4785
- text: state.text,
4786
- exitCode: 0,
4787
- aborted: false,
4788
- stderr: ""
4789
- });
4512
+ state.text = appendBoundedText(state.text, delta);
4790
4513
  if (!state.started) {
4791
4514
  state.started = true;
4792
- emit({ type: "message_start", message });
4515
+ emit({
4516
+ type: "message_start",
4517
+ message: buildAssistantMessage({
4518
+ model: state.model,
4519
+ text: "",
4520
+ result: null,
4521
+ conversationId: null,
4522
+ exitCode: 0,
4523
+ aborted: false,
4524
+ diagnostic: ""
4525
+ })
4526
+ });
4793
4527
  }
4794
4528
  emit({
4795
4529
  type: "message_update",
4796
- message,
4797
- assistantMessageEvent: {
4798
- type: "text_delta",
4799
- contentIndex: 0,
4800
- delta,
4801
- partial: message
4802
- }
4530
+ assistantMessageEvent: { type: "text_delta", contentIndex: 0, delta }
4803
4531
  });
4804
4532
  }
4805
- async function readStdout(child, emit, state) {
4806
- for await (const chunk of child.stdout) {
4807
- emitTextDelta(emit, state, String(chunk));
4533
+ async function readStream(child, emit, state) {
4534
+ for await (const bounded of readBoundedLines(child.stdout, {
4535
+ maxLineBytes: ANTIGRAVITY_MAX_STREAM_LINE_BYTES,
4536
+ maxTotalBytes: ANTIGRAVITY_MAX_STREAM_BYTES
4537
+ })) {
4538
+ if (bounded.kind === "oversized") {
4539
+ protocolFailure(state, "oversized structured output line");
4540
+ continue;
4541
+ }
4542
+ const line = bounded.line;
4543
+ if (!line.trim()) continue;
4544
+ const event = parseAntigravityStreamLine(line);
4545
+ if (!event) {
4546
+ protocolFailure(state, "unreadable structured output line");
4547
+ continue;
4548
+ }
4549
+ if (state.terminalSeen) {
4550
+ protocolFailure(state, "event after terminal result");
4551
+ continue;
4552
+ }
4553
+ switch (event.event) {
4554
+ case "init":
4555
+ if (state.initSeen) {
4556
+ protocolFailure(state, "duplicate init event");
4557
+ break;
4558
+ }
4559
+ state.initSeen = true;
4560
+ state.conversationId = boundedConversationId(event.conversationId);
4561
+ if (event.model?.trim()) state.model = event.model.trim();
4562
+ break;
4563
+ case "text":
4564
+ if (!state.initSeen) {
4565
+ protocolFailure(state, "text event before init");
4566
+ break;
4567
+ }
4568
+ state.conversationId = boundedConversationId(event.conversationId) ?? state.conversationId;
4569
+ emitTextDelta(emit, state, event.delta);
4570
+ break;
4571
+ case "result":
4572
+ if (!state.initSeen) {
4573
+ protocolFailure(state, "terminal result before init");
4574
+ break;
4575
+ }
4576
+ state.terminalSeen = true;
4577
+ state.result = event.result;
4578
+ state.conversationId = boundedConversationId(event.result.conversation_id) ?? state.conversationId;
4579
+ break;
4580
+ case "other":
4581
+ if (!state.initSeen) protocolFailure(state, "event before init");
4582
+ break;
4583
+ }
4808
4584
  }
4809
4585
  }
4810
- function startAntigravityWorkerRun(input, emit) {
4811
- const args = buildAgyArgs(input);
4812
- const child = spawn(ANTIGRAVITY_BINARY, args, {
4813
- cwd: process.cwd(),
4814
- env: process.env,
4815
- stdio: ["ignore", "pipe", "pipe"]
4586
+ function resultDiagnostic(input) {
4587
+ if (input.aborted) return "Antigravity run was cancelled";
4588
+ if (input.spawnError) return input.spawnError;
4589
+ if (input.streamError) return input.streamError;
4590
+ if (input.protocolDiagnostics.length > 0) {
4591
+ return `Antigravity structured output violated the protocol: ${input.protocolDiagnostics.join("; ")}`;
4592
+ }
4593
+ if (input.result === null) {
4594
+ return "Antigravity CLI ended without a terminal stream result. Update `agy` and verify stream-json support.";
4595
+ }
4596
+ if (input.result.status !== "SUCCESS") {
4597
+ const providerError = boundedProviderField(input.result.error, "error").trim();
4598
+ return providerError || `Antigravity returned terminal status ${String(input.result.status ?? "missing")}`;
4599
+ }
4600
+ if (input.exitCode !== 0) return `Antigravity returned SUCCESS but exited with status ${input.exitCode}`;
4601
+ if (typeof input.result.response !== "string") return "Antigravity SUCCESS result omitted its required response";
4602
+ return "";
4603
+ }
4604
+ function buildAssistantMessage(input) {
4605
+ const succeeded = !input.aborted && input.exitCode === 0 && input.result?.status === "SUCCESS" && typeof input.result.response === "string" && input.diagnostic.length === 0;
4606
+ const message = {
4607
+ role: "assistant",
4608
+ content: [{ type: "text", text: input.text }],
4609
+ api: "external-agent-subprocess",
4610
+ provider: "antigravity",
4611
+ model: input.model,
4612
+ usage: normalizeUsage(input.result?.usage),
4613
+ stopReason: input.aborted ? "aborted" : succeeded ? "stop" : "error",
4614
+ timestamp: Date.now()
4615
+ };
4616
+ if (input.conversationId) message.responseId = input.conversationId;
4617
+ if (input.diagnostic) message.errorMessage = boundedExternalDiagnostic(input.diagnostic);
4618
+ return message;
4619
+ }
4620
+ function startAntigravityWorkerRun(input, emit, dependencies = {}) {
4621
+ const sourceEnv = dependencies.environment ?? process.env;
4622
+ const args = buildAgyArgs(input, sourceEnv);
4623
+ const stdinLine = buildAgyStdinLine(input);
4624
+ const workspaceRoot = dependencies.workspaceRoot ?? process.cwd();
4625
+ const cwd = resolveSafeCwd(input.cwd, workspaceRoot);
4626
+ const child = spawn(dependencies.binary ?? ANTIGRAVITY_BINARY, args, {
4627
+ cwd,
4628
+ env: buildSafeToolEnv({}, sourceEnv),
4629
+ detached: process.platform !== "win32",
4630
+ stdio: ["pipe", "pipe", "pipe"]
4816
4631
  });
4817
- const streamState = { started: false, text: "", model: input.wireModelId };
4632
+ const streamState = {
4633
+ started: false,
4634
+ text: "",
4635
+ model: input.wireModelId,
4636
+ result: null,
4637
+ conversationId: null,
4638
+ initSeen: false,
4639
+ terminalSeen: false,
4640
+ protocolDiagnostics: []
4641
+ };
4818
4642
  let aborted = false;
4819
- let killTimer = null;
4643
+ let spawnError = "";
4644
+ let streamError = "";
4645
+ const terminator = createProcessTreeTerminator(child, dependencies.killGraceMs ?? 1500);
4820
4646
  const abort = () => {
4647
+ if (child.exitCode !== null) return;
4821
4648
  aborted = true;
4822
- if (child.killed) return;
4823
- child.kill("SIGTERM");
4824
- killTimer = setTimeout(() => {
4825
- if (!child.killed) child.kill("SIGKILL");
4826
- }, 1500);
4649
+ terminator.terminate();
4827
4650
  };
4828
- if (input.signal) {
4829
- if (input.signal.aborted) abort();
4830
- else input.signal.addEventListener("abort", abort, { once: true });
4831
- }
4651
+ const onAbort = () => abort();
4652
+ if (input.signal?.aborted) abort();
4653
+ else input.signal?.addEventListener("abort", onAbort, { once: true });
4654
+ child.once("error", (cause) => {
4655
+ spawnError = cause.code === "ENOENT" ? "Antigravity CLI (`agy`) is not installed or not on PATH." : boundedExternalDiagnostic(cause.message);
4656
+ });
4657
+ child.stdin.on("error", (cause) => {
4658
+ if (!aborted) spawnError ||= boundedExternalDiagnostic(`could not send work order to Antigravity: ${cause.message}`);
4659
+ });
4660
+ child.stdin.end(stdinLine);
4832
4661
  const promise = (async () => {
4833
4662
  emit({ type: "agent_start" });
4834
- const stderrPromise = readStderr(child);
4835
- const stdoutPromise = readStdout(child, emit, streamState);
4836
- const exitCode = await waitForClose(child);
4837
- await stdoutPromise.catch(() => {
4838
- });
4839
- const stderr = await stderrPromise.catch(() => "");
4840
- if (killTimer) clearTimeout(killTimer);
4841
- const finalText = streamState.text || (exitCode === 0 ? "" : stderr.trim());
4842
- const finalMessage = buildAssistantMessage({
4843
- model: streamState.model,
4844
- text: finalText,
4845
- exitCode,
4846
- aborted,
4847
- stderr
4848
- });
4849
- if (!streamState.started) emit({ type: "message_start", message: finalMessage });
4850
- emit({ type: "message_end", message: finalMessage });
4851
- const messages = [finalMessage];
4852
- emit({ type: "agent_end", messages });
4853
- if (exitCode !== 0 && stderr.trim().length > 0 && !aborted) {
4854
- process.stderr.write(`[worker:antigravity-code] ${stderr.trim()}
4663
+ try {
4664
+ const stderrPromise = readStderr(child);
4665
+ const stdoutPromise = readStream(child, emit, streamState).catch((cause) => {
4666
+ streamError = boundedExternalDiagnostic(cause instanceof Error ? cause.message : String(cause));
4667
+ terminator.terminate();
4668
+ });
4669
+ const exitCode = await waitForClose(child);
4670
+ await stdoutPromise;
4671
+ const stderr = await stderrPromise.catch(
4672
+ (cause) => boundedExternalDiagnostic(cause instanceof Error ? cause.message : String(cause))
4673
+ );
4674
+ let terminalResponse = "";
4675
+ try {
4676
+ terminalResponse = boundedProviderField(streamState.result?.response, "response");
4677
+ } catch (cause) {
4678
+ streamError ||= boundedExternalDiagnostic(cause instanceof Error ? cause.message : String(cause));
4679
+ }
4680
+ let diagnostic = "";
4681
+ try {
4682
+ diagnostic = resultDiagnostic({
4683
+ result: streamState.result,
4684
+ exitCode,
4685
+ spawnError,
4686
+ stderr,
4687
+ protocolDiagnostics: streamState.protocolDiagnostics,
4688
+ streamError,
4689
+ aborted
4690
+ });
4691
+ } catch (cause) {
4692
+ diagnostic = boundedExternalDiagnostic(cause instanceof Error ? cause.message : String(cause));
4693
+ }
4694
+ const finalText = terminalResponse || streamState.text;
4695
+ const finalMessage = buildAssistantMessage({
4696
+ model: streamState.model,
4697
+ text: finalText,
4698
+ result: streamState.result,
4699
+ conversationId: streamState.conversationId,
4700
+ exitCode,
4701
+ aborted,
4702
+ diagnostic
4703
+ });
4704
+ if (!streamState.started) emit({ type: "message_start", message: finalMessage });
4705
+ emit({ type: "message_end", message: finalMessage });
4706
+ const messages = [finalMessage];
4707
+ emit({ type: "agent_end", messages });
4708
+ if (finalMessage.stopReason === "error" && diagnostic && !aborted) {
4709
+ process.stderr.write(`[worker:antigravity-code] ${boundedExternalDiagnostic(diagnostic)}
4855
4710
  `);
4711
+ }
4712
+ return { messages, exitCode: finalMessage.stopReason === "stop" ? 0 : 1 };
4713
+ } finally {
4714
+ terminator.cleanup();
4715
+ input.signal?.removeEventListener("abort", onAbort);
4856
4716
  }
4857
- return { messages, exitCode: exitCode === 0 ? 0 : 1 };
4858
4717
  })();
4859
- return {
4860
- promise,
4861
- abort
4862
- };
4718
+ return { promise, abort };
4863
4719
  }
4864
4720
 
4865
4721
  // src/engine/claude/subprocess-runtime.ts
4866
4722
  init_esm_shims();
4867
4723
  import { spawn as spawn2 } from "node:child_process";
4868
- import { createInterface } from "node:readline";
4869
4724
 
4870
4725
  // src/engine/claude/session-id.ts
4871
4726
  init_esm_shims();
@@ -4876,6 +4731,9 @@ function isClaudeCodeSessionId(value) {
4876
4731
 
4877
4732
  // src/engine/claude/subprocess-runtime.ts
4878
4733
  var READ_ONLY_CLAUDE_TOOLS = ["Read", "Grep", "Glob", "LS", "WebFetch", "WebSearch"];
4734
+ var CLAUDE_BINARY = "claude";
4735
+ var CLAUDE_MAX_STREAM_LINE_BYTES = 1024 * 1024;
4736
+ var CLAUDE_MAX_STREAM_BYTES = 8 * 1024 * 1024;
4879
4737
  function claudeSubprocessPermissionConfigForAutonomy(level, env = process.env) {
4880
4738
  if (level === "full-auto" && env.CLIO_CODER_ALLOW_EXTERNAL_FULL_ACCESS === "1") {
4881
4739
  return {
@@ -4906,9 +4764,9 @@ function buildClaudeCodePrompt(input) {
4906
4764
  parts.push(input.task);
4907
4765
  return parts.join("\n\n");
4908
4766
  }
4909
- function buildClaudeCodeArgs(input) {
4767
+ function buildClaudeCodeArgs(input, gateEnv = process.env) {
4910
4768
  assertToolProfileEnforceable(input.toolProfile, "claude-code");
4911
- const permission = claudeSubprocessPermissionConfigForAutonomy(input.autonomy);
4769
+ const permission = claudeSubprocessPermissionConfigForAutonomy(input.autonomy, gateEnv);
4912
4770
  const args = [
4913
4771
  "-p",
4914
4772
  "--output-format",
@@ -4923,20 +4781,19 @@ function buildClaudeCodeArgs(input) {
4923
4781
  const systemPrompt = input.systemPrompt.trim();
4924
4782
  if (systemPrompt.length > 0) args.push("--append-system-prompt", systemPrompt);
4925
4783
  if (isClaudeCodeSessionId(input.sessionId)) args.push("--session-id", input.sessionId.trim());
4926
- args.push(buildClaudeCodePrompt(input));
4927
4784
  return args;
4928
4785
  }
4929
- function finite(value) {
4786
+ function finite2(value) {
4930
4787
  return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
4931
4788
  }
4932
- function normalizeUsage(raw, totalCostUsd = 0) {
4933
- const record2 = typeof raw === "object" && raw !== null ? raw : {};
4934
- const input = finite(record2.input_tokens) + finite(record2.inputTokens) + finite(record2.input) + finite(record2.prompt_tokens) + finite(record2.promptTokens);
4935
- const output = finite(record2.output_tokens) + finite(record2.outputTokens) + finite(record2.output) + finite(record2.completion_tokens) + finite(record2.completionTokens);
4936
- const cacheRead = finite(record2.cache_read_input_tokens) + finite(record2.cacheReadInputTokens) + finite(record2.cacheRead) + finite(record2.cacheReadTokens);
4937
- const cacheWrite = finite(record2.cache_creation_input_tokens) + finite(record2.cacheCreationInputTokens) + finite(record2.cacheWrite) + finite(record2.cacheWriteTokens);
4789
+ function normalizeUsage2(raw, totalCostUsd = 0) {
4790
+ const record3 = typeof raw === "object" && raw !== null ? raw : {};
4791
+ const input = finite2(record3.input_tokens) + finite2(record3.inputTokens) + finite2(record3.input) + finite2(record3.prompt_tokens) + finite2(record3.promptTokens);
4792
+ const output = finite2(record3.output_tokens) + finite2(record3.outputTokens) + finite2(record3.output) + finite2(record3.completion_tokens) + finite2(record3.completionTokens);
4793
+ const cacheRead = finite2(record3.cache_read_input_tokens) + finite2(record3.cacheReadInputTokens) + finite2(record3.cacheRead) + finite2(record3.cacheReadTokens);
4794
+ const cacheWrite = finite2(record3.cache_creation_input_tokens) + finite2(record3.cacheCreationInputTokens) + finite2(record3.cacheWrite) + finite2(record3.cacheWriteTokens);
4938
4795
  const totalTokens = input + output + cacheRead + cacheWrite;
4939
- const total = finite(totalCostUsd) + finite(record2.costUSD) + finite(record2.cost_usd);
4796
+ const total = finite2(totalCostUsd) + finite2(record3.costUSD) + finite2(record3.cost_usd);
4940
4797
  return {
4941
4798
  input,
4942
4799
  output,
@@ -4946,8 +4803,8 @@ function normalizeUsage(raw, totalCostUsd = 0) {
4946
4803
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total }
4947
4804
  };
4948
4805
  }
4949
- function nestedRecord(record2, key) {
4950
- const value = record2[key];
4806
+ function nestedRecord(record3, key) {
4807
+ const value = record3[key];
4951
4808
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
4952
4809
  }
4953
4810
  function extractContentText(content) {
@@ -4955,52 +4812,54 @@ function extractContentText(content) {
4955
4812
  let out = "";
4956
4813
  for (const block of content) {
4957
4814
  if (typeof block !== "object" || block === null) continue;
4958
- const record2 = block;
4959
- if (record2.type === "text" && typeof record2.text === "string") out += record2.text;
4815
+ const record3 = block;
4816
+ if (record3.type === "text" && typeof record3.text === "string") out += record3.text;
4960
4817
  }
4961
4818
  return out;
4962
4819
  }
4963
- function extractDelta(record2) {
4964
- const delta = nestedRecord(record2, "delta");
4820
+ function extractDelta(record3) {
4821
+ const delta = nestedRecord(record3, "delta");
4965
4822
  if (delta && typeof delta.text === "string") return delta.text;
4966
4823
  if (delta && typeof delta.thinking === "string") return "";
4967
- const contentBlock = nestedRecord(record2, "content_block");
4824
+ const contentBlock = nestedRecord(record3, "content_block");
4968
4825
  if (contentBlock && contentBlock.type === "text" && typeof contentBlock.text === "string") return contentBlock.text;
4969
- if (typeof record2.delta === "string") return record2.delta;
4826
+ if (typeof record3.delta === "string") return record3.delta;
4970
4827
  return "";
4971
4828
  }
4972
- function assistantTextFromEvent(record2) {
4973
- const message = nestedRecord(record2, "message");
4829
+ function assistantTextFromEvent(record3) {
4830
+ const message = nestedRecord(record3, "message");
4974
4831
  if (message) return extractContentText(message.content);
4975
- return extractContentText(record2.content);
4832
+ return extractContentText(record3.content);
4976
4833
  }
4977
- function resultText(record2) {
4978
- if (!record2) return "";
4979
- return typeof record2.result === "string" ? record2.result : "";
4834
+ function resultText(record3) {
4835
+ if (!record3) return "";
4836
+ return typeof record3.result === "string" ? record3.result : "";
4980
4837
  }
4981
- function resultError(record2, stderr) {
4982
- if (record2) {
4983
- if (typeof record2.error === "string") return record2.error;
4984
- if (Array.isArray(record2.errors)) return record2.errors.map(String).join("; ");
4985
- if (record2.subtype !== void 0 && record2.subtype !== "success") return String(record2.subtype);
4838
+ function resultError(record3, stderr) {
4839
+ if (record3) {
4840
+ if (typeof record3.error === "string") return record3.error;
4841
+ if (Array.isArray(record3.errors)) return record3.errors.map(String).join("; ");
4842
+ if (record3.subtype !== void 0 && record3.subtype !== "success") return String(record3.subtype);
4986
4843
  }
4987
4844
  return stderr.trim();
4988
4845
  }
4989
4846
  function buildAssistantMessage2(input) {
4990
- const errorMessage = input.exitCode === 0 ? "" : resultError(input.result, input.stderr);
4847
+ const transportError = input.transportError ?? "";
4848
+ const failed = input.exitCode !== 0 || transportError.length > 0;
4849
+ const errorMessage = !failed ? "" : transportError || resultError(input.result, input.stderr);
4991
4850
  const message = {
4992
4851
  role: "assistant",
4993
4852
  content: [{ type: "text", text: input.text }],
4994
4853
  api: "claude-code-subprocess",
4995
4854
  provider: "anthropic",
4996
4855
  model: input.model,
4997
- usage: normalizeUsage(input.result?.usage, finite(input.result?.total_cost_usd)),
4998
- stopReason: input.aborted ? "aborted" : input.exitCode === 0 ? "stop" : "error",
4856
+ usage: normalizeUsage2(input.result?.usage, finite2(input.result?.total_cost_usd)),
4857
+ stopReason: input.aborted ? "aborted" : failed ? "error" : "stop",
4999
4858
  timestamp: Date.now()
5000
4859
  };
5001
4860
  if (typeof input.result?.request_id === "string") message.responseId = input.result.request_id;
5002
4861
  if (typeof input.result?.model === "string") message.responseModel = input.result.model;
5003
- if (errorMessage.length > 0) message.errorMessage = errorMessage;
4862
+ if (errorMessage.length > 0) message.errorMessage = boundedExternalDiagnostic(errorMessage);
5004
4863
  return message;
5005
4864
  }
5006
4865
  function emitTextDelta2(emit, state, delta) {
@@ -5030,9 +4889,14 @@ function emitTextDelta2(emit, state, delta) {
5030
4889
  });
5031
4890
  }
5032
4891
  async function readJsonLines(child, emit, state) {
5033
- const rl = createInterface({ input: child.stdout });
5034
- for await (const line of rl) {
5035
- const trimmed = line.trim();
4892
+ for await (const bounded of readBoundedLines(child.stdout, {
4893
+ maxLineBytes: CLAUDE_MAX_STREAM_LINE_BYTES,
4894
+ maxTotalBytes: CLAUDE_MAX_STREAM_BYTES
4895
+ })) {
4896
+ if (bounded.kind === "oversized") {
4897
+ throw new Error(`claude stream-json line exceeded ${CLAUDE_MAX_STREAM_LINE_BYTES} bytes`);
4898
+ }
4899
+ const trimmed = bounded.line.trim();
5036
4900
  if (trimmed.length === 0) continue;
5037
4901
  let parsed;
5038
4902
  try {
@@ -5041,26 +4905,31 @@ async function readJsonLines(child, emit, state) {
5041
4905
  continue;
5042
4906
  }
5043
4907
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) continue;
5044
- const record2 = parsed;
5045
- if (record2.type === "system" && typeof record2.model === "string") state.model = record2.model;
5046
- if (record2.type === "result") {
5047
- state.result = record2;
4908
+ const record3 = parsed;
4909
+ if (record3.type === "system" && typeof record3.model === "string") state.model = record3.model;
4910
+ if (record3.type === "result") {
4911
+ state.result = record3;
5048
4912
  continue;
5049
4913
  }
5050
- if (record2.type === "assistant") {
5051
- const text = assistantTextFromEvent(record2);
4914
+ if (record3.type === "assistant") {
4915
+ const text = assistantTextFromEvent(record3);
5052
4916
  if (text.length > 0 && text.length >= state.text.length) state.text = text;
5053
4917
  continue;
5054
4918
  }
5055
- emitTextDelta2(emit, state, extractDelta(record2));
4919
+ emitTextDelta2(emit, state, extractDelta(record3));
5056
4920
  }
5057
4921
  }
5058
- function startClaudeCodeWorkerRun(input, emit) {
5059
- const args = buildClaudeCodeArgs(input);
5060
- const child = spawn2("claude", args, {
5061
- cwd: process.cwd(),
5062
- env: process.env,
5063
- stdio: ["ignore", "pipe", "pipe"]
4922
+ function startClaudeCodeWorkerRun(input, emit, dependencies = {}) {
4923
+ const sourceEnv = dependencies.environment ?? process.env;
4924
+ const args = buildClaudeCodeArgs(input, sourceEnv);
4925
+ const prompt = buildClaudeCodePrompt(input);
4926
+ const workspaceRoot = dependencies.workspaceRoot ?? process.cwd();
4927
+ const cwd = resolveSafeCwd(input.cwd, workspaceRoot);
4928
+ const child = spawn2(dependencies.binary ?? CLAUDE_BINARY, args, {
4929
+ cwd,
4930
+ env: buildSafeToolEnv({}, sourceEnv),
4931
+ detached: process.platform !== "win32",
4932
+ stdio: ["pipe", "pipe", "pipe"]
5064
4933
  });
5065
4934
  const streamState = {
5066
4935
  started: false,
@@ -5069,51 +4938,61 @@ function startClaudeCodeWorkerRun(input, emit) {
5069
4938
  result: null
5070
4939
  };
5071
4940
  let aborted = false;
5072
- let killTimer = null;
4941
+ let settled = false;
4942
+ let transportError = "";
4943
+ const terminator = createProcessTreeTerminator(child, dependencies.killGraceMs ?? 1500);
5073
4944
  const abort = () => {
4945
+ if (settled) return;
5074
4946
  aborted = true;
5075
- if (child.killed) return;
5076
- child.kill("SIGTERM");
5077
- killTimer = setTimeout(() => {
5078
- if (!child.killed) child.kill("SIGKILL");
5079
- }, 1500);
4947
+ terminator.terminate();
5080
4948
  };
5081
- if (input.signal) {
5082
- if (input.signal.aborted) abort();
5083
- else input.signal.addEventListener("abort", abort, { once: true });
5084
- }
4949
+ const onAbort = () => abort();
4950
+ if (input.signal?.aborted) abort();
4951
+ else input.signal?.addEventListener("abort", onAbort, { once: true });
4952
+ child.once("error", (cause) => {
4953
+ transportError ||= cause.code === "ENOENT" ? "Claude Code CLI (`claude`) is not installed or not on PATH." : cause.message;
4954
+ });
4955
+ child.stdin.on("error", (cause) => {
4956
+ if (!aborted) transportError ||= `could not send prompt to Claude Code CLI: ${cause.message}`;
4957
+ });
4958
+ child.stdin.end(prompt);
5085
4959
  const promise = (async () => {
5086
4960
  emit({ type: "agent_start" });
5087
- const stderrPromise = readStderr(child);
5088
- const stdoutPromise = readJsonLines(child, emit, streamState);
5089
- const exitCode = await waitForClose(child);
5090
- await stdoutPromise.catch(() => {
5091
- });
5092
- const stderr = await stderrPromise.catch(() => "");
5093
- if (killTimer) clearTimeout(killTimer);
5094
- const finalText = streamState.text || resultText(streamState.result) || (exitCode === 0 ? "" : resultError(streamState.result, stderr));
5095
- const finalMessage = buildAssistantMessage2({
5096
- model: streamState.model,
5097
- text: finalText,
5098
- result: streamState.result,
5099
- exitCode,
5100
- aborted,
5101
- stderr
5102
- });
5103
- if (!streamState.started) emit({ type: "message_start", message: finalMessage });
5104
- emit({ type: "message_end", message: finalMessage });
5105
- const messages = [finalMessage];
5106
- emit({ type: "agent_end", messages });
5107
- if (exitCode !== 0 && stderr.trim().length > 0 && !aborted) {
5108
- process.stderr.write(`[worker:claude-code] ${stderr.trim()}
4961
+ try {
4962
+ const stderrPromise = readStderr(child);
4963
+ const stdoutPromise = readJsonLines(child, emit, streamState).catch((cause) => {
4964
+ transportError ||= cause instanceof Error ? cause.message : String(cause);
4965
+ terminator.terminate();
4966
+ });
4967
+ const exitCode = await waitForClose(child);
4968
+ await stdoutPromise;
4969
+ const stderr = await stderrPromise.catch(() => "");
4970
+ const finalText = streamState.text || resultText(streamState.result) || (exitCode === 0 ? "" : resultError(streamState.result, stderr));
4971
+ const finalMessage = buildAssistantMessage2({
4972
+ model: streamState.model,
4973
+ text: finalText,
4974
+ result: streamState.result,
4975
+ exitCode,
4976
+ aborted,
4977
+ stderr,
4978
+ transportError
4979
+ });
4980
+ if (!streamState.started) emit({ type: "message_start", message: finalMessage });
4981
+ emit({ type: "message_end", message: finalMessage });
4982
+ const messages = [finalMessage];
4983
+ emit({ type: "agent_end", messages });
4984
+ if (finalMessage.stopReason === "error" && finalMessage.errorMessage && !aborted) {
4985
+ process.stderr.write(`[worker:claude-code] ${finalMessage.errorMessage}
5109
4986
  `);
4987
+ }
4988
+ return { messages, exitCode: finalMessage.stopReason === "stop" ? 0 : 1 };
4989
+ } finally {
4990
+ settled = true;
4991
+ terminator.cleanup();
4992
+ input.signal?.removeEventListener("abort", onAbort);
5110
4993
  }
5111
- return { messages, exitCode: exitCode === 0 ? 0 : 1 };
5112
4994
  })();
5113
- return {
5114
- promise,
5115
- abort
5116
- };
4995
+ return { promise, abort };
5117
4996
  }
5118
4997
 
5119
4998
  // src/engine/worker-runtime-capabilities.ts
@@ -5135,6 +5014,7 @@ var FOLDED_WITH_DIFF = {
5135
5014
  failureExcerpt: true
5136
5015
  };
5137
5016
  var TOOL_PRESENTATION = {
5017
+ [ToolNames.Evidence]: FOLDED,
5138
5018
  [ToolNames.Read]: FOLDED,
5139
5019
  [ToolNames.Grep]: FOLDED,
5140
5020
  [ToolNames.Find]: FOLDED,
@@ -5153,6 +5033,8 @@ var TOOL_PRESENTATION = {
5153
5033
  [ToolNames.Tasks]: FOLDED,
5154
5034
  [ToolNames.Ledger]: FOLDED,
5155
5035
  [ToolNames.Panes]: FOLDED,
5036
+ [ToolNames.Limitation]: FOLDED,
5037
+ [ToolNames.Decide]: FOLDED,
5156
5038
  [ToolNames.WebFetch]: FOLDED,
5157
5039
  [ToolNames.AskUser]: FOLDED,
5158
5040
  [ToolNames.Artifact]: FOLDED
@@ -5164,9 +5046,9 @@ function readStringField(args, key) {
5164
5046
  }
5165
5047
  function classifyResourceRead(toolName, args) {
5166
5048
  if (toolName !== ToolNames.Read) return null;
5167
- const path5 = readStringField(args, "path");
5168
- if (path5 === null) return null;
5169
- const normalized = path5.replace(/\\/g, "/");
5049
+ const path4 = readStringField(args, "path");
5050
+ if (path4 === null) return null;
5051
+ const normalized = path4.replace(/\\/g, "/");
5170
5052
  const base = normalized.split("/").pop() ?? "";
5171
5053
  if (base === "SKILL.md") return "skill";
5172
5054
  if (base === "CLIO-CODER.md") return "handbook";
@@ -5535,6 +5417,13 @@ var exactMutationPolicy = {
5535
5417
  };
5536
5418
  var TOOL_METADATA = {
5537
5419
  // OBSERVE: read-class, parallel, envelope + shared turn budget.
5420
+ [ToolNames.Evidence]: {
5421
+ objective: "Inspect canonical evidence, trust status, gate decisions, and findings.",
5422
+ uiLabel: "Evidence",
5423
+ retrySafety: "idempotent",
5424
+ resultSizePolicy: summaryPolicy("Inspect one run with evidence(mode=run, runId=<id>) to narrow the output."),
5425
+ costLatency: "local_medium"
5426
+ },
5538
5427
  [ToolNames.Read]: {
5539
5428
  objective: "Read exact UTF-8 file content with line and byte bounds.",
5540
5429
  uiLabel: "Read",
@@ -5722,6 +5611,30 @@ var TOOL_METADATA = {
5722
5611
  costLatency: "local_fast",
5723
5612
  promptHint: 'When the operator asks to see a dispatched agent ("show me the tester"), call panes(action="show", target=<agent id>).'
5724
5613
  },
5614
+ [ToolNames.Limitation]: {
5615
+ objective: "Record what the turn could not verify and why as a ledger receipt.",
5616
+ uiLabel: "Limitation",
5617
+ retrySafety: "idempotent",
5618
+ resultSizePolicy: {
5619
+ kind: "exact",
5620
+ maxBytes: 4096,
5621
+ followUpHint: "Call limitation again with a narrower scope if the first call was rejected."
5622
+ },
5623
+ costLatency: "local_fast"
5624
+ },
5625
+ [ToolNames.Decide]: {
5626
+ objective: "Record a design decision with its rejected alternatives and rationale on the session decision board.",
5627
+ uiLabel: "Decide",
5628
+ // A repeated call with the same key supersedes the earlier record, so
5629
+ // the surface as a whole is not retry safe.
5630
+ retrySafety: "not_retry_safe",
5631
+ resultSizePolicy: {
5632
+ kind: "exact",
5633
+ maxBytes: 4096,
5634
+ followUpHint: "The decision ref in the result is what receipts and commits cite."
5635
+ },
5636
+ costLatency: "local_fast"
5637
+ },
5725
5638
  // RETRIEVE: network-class.
5726
5639
  [ToolNames.WebFetch]: {
5727
5640
  objective: "Fetch HTTP(S) text for explicit external research.",
@@ -5786,7 +5699,7 @@ function builtin(spec, sourceInfo) {
5786
5699
 
5787
5700
  // src/domains/agents/result-contract-filesystem.ts
5788
5701
  init_esm_shims();
5789
- import { existsSync as existsSync2, readFileSync as readFileSync2, statSync as statSync2 } from "node:fs";
5702
+ import { existsSync, readFileSync as readFileSync2, statSync as statSync2 } from "node:fs";
5790
5703
  function nodeResultContractFilesystem() {
5791
5704
  return {
5792
5705
  readFile(filePath) {
@@ -5797,7 +5710,7 @@ function nodeResultContractFilesystem() {
5797
5710
  }
5798
5711
  },
5799
5712
  pathExists(filePath) {
5800
- return existsSync2(filePath);
5713
+ return existsSync(filePath);
5801
5714
  },
5802
5715
  isDirectory(filePath) {
5803
5716
  return statSync2(filePath, { throwIfNoEntry: false })?.isDirectory() === true;
@@ -5807,7 +5720,7 @@ function nodeResultContractFilesystem() {
5807
5720
 
5808
5721
  // src/domains/safety/run-effects.ts
5809
5722
  init_esm_shims();
5810
- import path4 from "node:path";
5723
+ import path3 from "node:path";
5811
5724
  var ENUMERABLE_ACTION_CLASSES = /* @__PURE__ */ new Set(["read", "write"]);
5812
5725
  function toolWritesOpaquely(toolName) {
5813
5726
  return !ENUMERABLE_ACTION_CLASSES.has(classify({ tool: toolName }).actionClass);
@@ -5815,7 +5728,7 @@ function toolWritesOpaquely(toolName) {
5815
5728
  var GIT_PATH_MUTATIONS = /* @__PURE__ */ new Set(["mv", "rm"]);
5816
5729
  function gitPathOperands(command) {
5817
5730
  const targets = [];
5818
- for (const segment of splitCommandSegments(command)) {
5731
+ for (const segment of commandArgumentSegments(command)) {
5819
5732
  if (segment[0] !== "git") continue;
5820
5733
  const subcommand = segment[1];
5821
5734
  if (subcommand === void 0 || !GIT_PATH_MUTATIONS.has(subcommand)) continue;
@@ -5826,20 +5739,6 @@ function gitPathOperands(command) {
5826
5739
  }
5827
5740
  return targets;
5828
5741
  }
5829
- function splitCommandSegments(command) {
5830
- const segments = [];
5831
- let current = [];
5832
- for (const token of tokenizeShellLike(command)) {
5833
- if (token === ";" || token === "&&" || token === "||" || token === "|") {
5834
- if (current.length > 0) segments.push(current);
5835
- current = [];
5836
- continue;
5837
- }
5838
- current.push(token);
5839
- }
5840
- if (current.length > 0) segments.push(current);
5841
- return segments;
5842
- }
5843
5742
  function commandOf(args) {
5844
5743
  const command = args?.command;
5845
5744
  return typeof command === "string" && command.length > 0 ? command : null;
@@ -5873,11 +5772,11 @@ function createRunEffectsRecorder(cwd, options = {}) {
5873
5772
  const verificationCommand = validationCommandOf(toolName, args, "grounding");
5874
5773
  const opaque = toolWritesOpaquely(toolName);
5875
5774
  if (!opaque && paths.length === 0 && validationCommand === null && verificationCommand === null) return;
5876
- const base = typeof args?.cwd === "string" && args.cwd.length > 0 ? path4.resolve(cwd, args.cwd) : cwd;
5775
+ const base = typeof args?.cwd === "string" && args.cwd.length > 0 ? path3.resolve(cwd, args.cwd) : cwd;
5877
5776
  pending.set(toolCallId, {
5878
5777
  tool: toolName,
5879
5778
  toolCallId,
5880
- paths: paths.map((target) => path4.resolve(base, target)),
5779
+ paths: paths.map((target) => path3.resolve(base, target)),
5881
5780
  validationCommand,
5882
5781
  verificationCommand,
5883
5782
  opaque
@@ -5945,8 +5844,8 @@ function claimConflicts(body, live, runId) {
5945
5844
  }
5946
5845
  return conflicts;
5947
5846
  }
5948
- function citedPathKey(path5) {
5949
- const trimmed = path5.trim();
5847
+ function citedPathKey(path4) {
5848
+ const trimmed = path4.trim();
5950
5849
  if (trimmed.length === 0) return trimmed;
5951
5850
  const absolute = isAbsolute(trimmed);
5952
5851
  const candidate = absolute ? relative(process.cwd(), trimmed) : trimmed;
@@ -5958,21 +5857,21 @@ function corroboration(entries) {
5958
5857
  const runsByPath = /* @__PURE__ */ new Map();
5959
5858
  for (const entry of entries) {
5960
5859
  if (entry.body.kind !== "finding") continue;
5961
- const path5 = entry.body.path === void 0 ? void 0 : citedPathKey(entry.body.path);
5962
- if (path5 === void 0) continue;
5963
- const runs = runsByPath.get(path5) ?? [];
5860
+ const path4 = entry.body.path === void 0 ? void 0 : citedPathKey(entry.body.path);
5861
+ if (path4 === void 0) continue;
5862
+ const runs = runsByPath.get(path4) ?? [];
5964
5863
  if (!runs.includes(entry.runId)) runs.push(entry.runId);
5965
- runsByPath.set(path5, runs);
5864
+ runsByPath.set(path4, runs);
5966
5865
  }
5967
5866
  const byEntryId = /* @__PURE__ */ new Map();
5968
5867
  for (const entry of entries) {
5969
5868
  if (entry.body.kind !== "finding") continue;
5970
- const path5 = entry.body.path;
5971
- if (path5 === void 0) {
5869
+ const path4 = entry.body.path;
5870
+ if (path4 === void 0) {
5972
5871
  byEntryId.set(entry.id, "ungrounded lead");
5973
5872
  continue;
5974
5873
  }
5975
- const runs = runsByPath.get(citedPathKey(path5)) ?? [];
5874
+ const runs = runsByPath.get(citedPathKey(path4)) ?? [];
5976
5875
  byEntryId.set(entry.id, runs.length >= 2 ? "corroborated" : "uncorroborated");
5977
5876
  }
5978
5877
  return { byEntryId, byPath: runsByPath };
@@ -6039,19 +5938,19 @@ function renderAll(entries) {
6039
5938
  // src/engine/claude/tool-safety.ts
6040
5939
  init_esm_shims();
6041
5940
  import { performance as performance2 } from "node:perf_hooks";
6042
- function isRecord7(value) {
5941
+ function isRecord6(value) {
6043
5942
  return typeof value === "object" && value !== null && !Array.isArray(value);
6044
5943
  }
6045
- function stringField(record2, ...keys) {
5944
+ function stringField(record3, ...keys) {
6046
5945
  for (const key of keys) {
6047
- const value = record2[key];
5946
+ const value = record3[key];
6048
5947
  if (typeof value === "string" && value.trim().length > 0) return value.trim();
6049
5948
  }
6050
5949
  return void 0;
6051
5950
  }
6052
5951
  function pathArgs(input) {
6053
- const path5 = stringField(input, "file_path", "filePath", "path", "notebook_path", "source", "target");
6054
- return path5 ? { ...input, path: path5 } : { ...input };
5952
+ const path4 = stringField(input, "file_path", "filePath", "path", "notebook_path", "source", "target");
5953
+ return path4 ? { ...input, path: path4 } : { ...input };
6055
5954
  }
6056
5955
  function commandArgs(input, cwd) {
6057
5956
  const command = stringField(input, "command", "cmd", "shell", "input", "description") ?? JSON.stringify(input);
@@ -6312,7 +6211,7 @@ function emitClaudeToolPermissionDecision(input) {
6312
6211
  return decision;
6313
6212
  }
6314
6213
  function coerceToolInput(value) {
6315
- return isRecord7(value) ? value : {};
6214
+ return isRecord6(value) ? value : {};
6316
6215
  }
6317
6216
 
6318
6217
  export {
@@ -6350,14 +6249,6 @@ export {
6350
6249
  cancelledAskUserResult,
6351
6250
  finalizeAskUserInterviewForHost,
6352
6251
  createAskUserTool,
6353
- resolveDispatchPathScope,
6354
- declaredScopeReplacementDiagnostic,
6355
- declaredScopeReplacementNotice,
6356
- inferredScopeParentTokenDiagnostic,
6357
- inferredScopeParentTokenNotice,
6358
- declaredScopeIntent,
6359
- narrowDispatchIntentToReadOnly,
6360
- normalizeDispatchIntent,
6361
6252
  assertApprovedAssignmentRoute,
6362
6253
  approvedRouteCandidates,
6363
6254
  assertApprovedRecoveryCapability,
@@ -6417,4 +6308,4 @@ export {
6417
6308
  isTerminalRunEnvelope,
6418
6309
  runKindSupportsLiveSteering
6419
6310
  };
6420
- //# sourceMappingURL=chunk-IKSLQ4XV.js.map
6311
+ //# sourceMappingURL=chunk-75W7L2E2.js.map