@iowarp/clio-coder 0.3.6 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +22 -6
  3. package/dist/{acp-2BEHC4DL.js → acp-U67UHUK2.js} +14 -14
  4. package/dist/{agents-LNNFTM53.js → agents-YU6SGALZ.js} +42 -35
  5. package/dist/assets/codewiki.json +1 -1
  6. package/dist/{auth-KXXFI2VS.js → auth-5ZPJOIVG.js} +32 -24
  7. package/dist/builtins-C6JMZVV6.js +17 -0
  8. package/dist/{chunk-E25LMLRW.js → chunk-26LEYJZH.js} +2 -2
  9. package/dist/{chunk-TSHXZTOQ.js → chunk-2HEJ2F35.js} +5 -5
  10. package/dist/{chunk-PBTHKCPN.js → chunk-2HFZQUHL.js} +7 -7
  11. package/dist/{chunk-FO5ZOVUY.js → chunk-3BINW3FP.js} +5 -5
  12. package/dist/{chunk-4OC57DA6.js → chunk-4DGYLA73.js} +53 -2
  13. package/dist/{chunk-CKXWIANG.js → chunk-4SPRNWDE.js} +18 -16
  14. package/dist/{chunk-E2ER4LJF.js → chunk-5C3AQNDW.js} +25 -1
  15. package/dist/{chunk-XF5N4U5A.js → chunk-5DHKRSMQ.js} +9 -8
  16. package/dist/{chunk-43AOLP7E.js → chunk-5FR74PWO.js} +2 -1
  17. package/dist/{chunk-EKY57CSP.js → chunk-5H3GB5BO.js} +68 -772
  18. package/dist/{chunk-6XXKFVSN.js → chunk-5Q2VVUKB.js} +4 -4
  19. package/dist/{chunk-DJVECN66.js → chunk-7RFXX52T.js} +295 -3705
  20. package/dist/{chunk-ZXF4XRKW.js → chunk-7RGZWPB6.js} +158 -8
  21. package/dist/{chunk-FYYLNIL5.js → chunk-A2NJGIB3.js} +2 -2
  22. package/dist/{chunk-XXQNGV4M.js → chunk-A3WNZD3P.js} +548 -72
  23. package/dist/{chunk-VEZEGCGW.js → chunk-B5CSFE7B.js} +23 -21
  24. package/dist/{chunk-2SFS6XQE.js → chunk-DGSYXYMX.js} +3 -2
  25. package/dist/chunk-DR52UMZW.js +21 -0
  26. package/dist/{chunk-ZWLZP4ZT.js → chunk-DYIM5TJT.js} +98 -12
  27. package/dist/{chunk-QKMUKYO7.js → chunk-E77JEWSD.js} +270 -125
  28. package/dist/{chunk-LYF7OHWH.js → chunk-EMYUUSFG.js} +12 -467
  29. package/dist/{chunk-4VP4KH3K.js → chunk-EQ63NRB7.js} +8 -8
  30. package/dist/chunk-FBVTI2TJ.js +518 -0
  31. package/dist/{chunk-R46L2BIR.js → chunk-FHJEP5SW.js} +19 -25
  32. package/dist/{chunk-WR67VIZY.js → chunk-GN57SG4G.js} +66 -8
  33. package/dist/{chunk-RD5U66HV.js → chunk-GPIEI3LY.js} +9 -9
  34. package/dist/{chunk-PCZJO5TI.js → chunk-GU2UIAFZ.js} +13 -178
  35. package/dist/chunk-GWS3VEIW.js +195 -0
  36. package/dist/chunk-H7IXIC72.js +103 -0
  37. package/dist/{chunk-3BPUFZDL.js → chunk-HLE42MG7.js} +3 -3
  38. package/dist/{chunk-24I7BN55.js → chunk-IFBNV6H6.js} +3 -3
  39. package/dist/{chunk-QNQHSOLF.js → chunk-IGWKHNIQ.js} +114 -55
  40. package/dist/chunk-IIZWH4XA.js +172 -0
  41. package/dist/{chunk-AD2SYQYC.js → chunk-IJ7RPIYJ.js} +124 -6
  42. package/dist/chunk-J3YUBZWY.js +382 -0
  43. package/dist/{chunk-5JGRAMKL.js → chunk-JOZYP4GM.js} +8 -6
  44. package/dist/{chunk-OH3TOQTB.js → chunk-K4XHGFR5.js} +751 -15
  45. package/dist/{chunk-EYPA3EGJ.js → chunk-KTYTFRMB.js} +178 -14
  46. package/dist/chunk-LU7P4LHA.js +33 -0
  47. package/dist/chunk-ME6CCNFO.js +108 -0
  48. package/dist/chunk-MXKJU4JB.js +1100 -0
  49. package/dist/{chunk-RY3LY4J5.js → chunk-N22QMJKY.js} +21 -18
  50. package/dist/chunk-NMPKI6XL.js +3006 -0
  51. package/dist/chunk-NUGM5KR6.js +165 -0
  52. package/dist/{chunk-22NAGB7X.js → chunk-P43ETTHK.js} +5 -94
  53. package/dist/{chunk-NILBFAPG.js → chunk-PMDBGQSJ.js} +2 -2
  54. package/dist/chunk-PT7HYKEM.js +165 -0
  55. package/dist/chunk-RVG5JXAL.js +41 -0
  56. package/dist/{chunk-GEYXPTRF.js → chunk-RWSI4YD7.js} +2 -2
  57. package/dist/{chunk-4BPJXDWC.js → chunk-TANS5ZJS.js} +35 -19
  58. package/dist/{verifiers-NCBTHHN2.js → chunk-TB5666IT.js} +67 -324
  59. package/dist/{chunk-QM3F2GKX.js → chunk-TLQJPP24.js} +7927 -8088
  60. package/dist/{chunk-G7MUEIGA.js → chunk-TT36MB5S.js} +2 -1
  61. package/dist/chunk-TTHACPOM.js +961 -0
  62. package/dist/{chunk-6US73PDB.js → chunk-TYPGUK6W.js} +7 -7
  63. package/dist/{chunk-MFFY33HR.js → chunk-U6MBIEMB.js} +554 -209
  64. package/dist/chunk-VAWNZU7Z.js +242 -0
  65. package/dist/{chunk-IR4CFBFN.js → chunk-VCBR6CU7.js} +12 -12
  66. package/dist/{chunk-WHJYKASB.js → chunk-VHN4MY6O.js} +2 -2
  67. package/dist/{chunk-XYDYPRZI.js → chunk-VWZOAB7K.js} +10 -10
  68. package/dist/{chunk-ZRGEBJ4T.js → chunk-WLFILSD5.js} +48 -48
  69. package/dist/{chunk-K7T3E2SR.js → chunk-WNIJTQQK.js} +12 -11
  70. package/dist/{chunk-CYQKWTG3.js → chunk-WSB3FPX7.js} +68 -20
  71. package/dist/{chunk-KHSFENX2.js → chunk-WWCZ5F23.js} +116 -14
  72. package/dist/{chunk-XE2VEJHX.js → chunk-WXY7KU3G.js} +2 -2
  73. package/dist/{chunk-PPAMZ32Z.js → chunk-XK56QHLX.js} +6 -1
  74. package/dist/{chunk-KOHPCX4K.js → chunk-XWSF374K.js} +5 -5
  75. package/dist/{chunk-CJUB2JJ2.js → chunk-YS5VLNH5.js} +10 -10
  76. package/dist/{chunk-ZZMN5OM4.js → chunk-ZNLWCMVZ.js} +2 -2
  77. package/dist/{chunk-WHGPSPT5.js → chunk-ZVJ5BLO2.js} +2 -2
  78. package/dist/cli/index.js +33 -31
  79. package/dist/{clio-M2KGYUFZ.js → clio-QVTYJ57A.js} +10 -10
  80. package/dist/{code-nav-GQNL7XA6.js → code-nav-FGGFIE7L.js} +5 -5
  81. package/dist/codewiki/build-worker.js +4 -4
  82. package/dist/{components-5TTYYX6G.js → components-ZFA3SAER.js} +9 -9
  83. package/dist/{config-XUUYQIWO.js → config-LW5IJFQN.js} +65 -55
  84. package/dist/{configure-IHJ7YOMV.js → configure-7XIZCOU4.js} +29 -24
  85. package/dist/{context-75MIWW3U.js → context-L3WL3X7K.js} +54 -43
  86. package/dist/{context-ZQ7SIFJV.js → context-N52ZA626.js} +30 -14
  87. package/dist/{context-74JLXAWD.js → context-Y6Y7QPR6.js} +12 -12
  88. package/dist/{context-clear-GYKWNUML.js → context-clear-MBQRLSDQ.js} +54 -43
  89. package/dist/{context-index-SSR5ECNE.js → context-index-HVMFQHK3.js} +5 -5
  90. package/dist/{context-working-set-UX5KEP4J.js → context-working-set-GS6DSO7F.js} +18 -18
  91. package/dist/{dispatch-runner-GIJBHNFL.js → dispatch-runner-22ZCNOM3.js} +367 -79
  92. package/dist/{docs-6FZSCG5B.js → docs-7LQ23DLM.js} +9 -9
  93. package/dist/{doctor-SVJ5BZCW.js → doctor-M7YEDGAE.js} +27 -23
  94. package/dist/{eval-CG6LLBLD.js → eval-BEC2WHDA.js} +73 -20
  95. package/dist/{evidence-ZYFIEN42.js → evidence-REJUMSKM.js} +70 -59
  96. package/dist/{evolve-QGEXEMDW.js → evolve-PY5ZBA5K.js} +50 -39
  97. package/dist/{extensions-ADGNCJJD.js → extensions-HVKU65YU.js} +7 -7
  98. package/dist/{fleet-S5R4ZOQY.js → fleet-7WZEWRFA.js} +236 -377
  99. package/dist/fleet-commands-UVHWM76J.js +70 -0
  100. package/dist/fleet-graph-6ULH7PES.js +125 -0
  101. package/dist/fleet-new-RDVJLHHH.js +48 -0
  102. package/dist/{fleet-preflight-BHSNPBMH.js → fleet-preflight-J53T6CCE.js} +5 -5
  103. package/dist/fleet-validate-72PC4SLA.js +79 -0
  104. package/dist/{init-5DRU55YR.js → init-OG3TPGQG.js} +69 -57
  105. package/dist/library-CNTMPLRF.js +217 -0
  106. package/dist/{memory-7YKKR6UC.js → memory-6IS7F275.js} +52 -41
  107. package/dist/{models-ZPOLRU2C.js → models-ENRJDA5W.js} +37 -31
  108. package/dist/{monitor-US5F5YGZ.js → monitor-XLDVO7TN.js} +79 -42
  109. package/dist/{orchestrator-E2AL4T5N.js → orchestrator-6KSPYRHA.js} +4126 -762
  110. package/dist/{paths-E7KYAQWE.js → paths-DBXMZMDU.js} +6 -6
  111. package/dist/registry-LG64LTF4.js +11 -0
  112. package/dist/{reset-KZ652EK6.js → reset-RZ4ER727.js} +12 -12
  113. package/dist/{run-SRNBKDWD.js → run-Y2CNK5RU.js} +89 -76
  114. package/dist/{share-CGZE33UP.js → share-A55GYP6Z.js} +37 -13
  115. package/dist/{skills-S2X4DLY5.js → skills-ALC5J6AT.js} +29 -13
  116. package/dist/{skills-eval-W2GGIC4R.js → skills-eval-JPBEBYQU.js} +60 -48
  117. package/dist/support-MIETYA5E.js +38 -0
  118. package/dist/{targets-54SWINWB.js → targets-VGNXIR3S.js} +46 -36
  119. package/dist/{terminal-lease-SAIF2OGY.js → terminal-lease-WOBR64YA.js} +4 -4
  120. package/dist/{uninstall-BVLWXKBT.js → uninstall-ZJF5H5ZN.js} +9 -9
  121. package/dist/{upgrade-JKAR27XC.js → upgrade-FUSUAGHR.js} +31 -28
  122. package/dist/{usage-MSAWCLX4.js → usage-N4MKVHKD.js} +140 -68
  123. package/dist/verifiers-YAWOJ3H2.js +336 -0
  124. package/dist/{verify-X5HDROLA.js → verify-LTDHYBGY.js} +10 -9
  125. package/dist/{wiki-generate-GUSOQ6ZP.js → wiki-generate-6M7GHTBJ.js} +75 -62
  126. package/dist/worker/entry.js +67 -57
  127. package/docs/README.md +3 -2
  128. package/docs/acp.md +1 -1
  129. package/docs/alcf-provider.md +1 -1
  130. package/docs/architecture.md +2 -2
  131. package/docs/artifact-versions.md +11 -6
  132. package/docs/built-in-agents.md +26 -2
  133. package/docs/capacity-and-scheduling.md +1 -1
  134. package/docs/commands-and-modes.md +83 -3
  135. package/docs/configuration-and-targets.md +86 -4
  136. package/docs/context-engine.md +1 -1
  137. package/docs/development-pipeline.md +1 -1
  138. package/docs/dispatch-architecture-rationale.md +1 -1
  139. package/docs/documentation-coverage.md +3 -3
  140. package/docs/documentation-guide.md +3 -3
  141. package/docs/eval-runner.md +1 -1
  142. package/docs/evals-internal.md +1 -1
  143. package/docs/evidence-and-memory.md +74 -10
  144. package/docs/evolution.md +1 -1
  145. package/docs/exit-codes-and-output.md +4 -1
  146. package/docs/extensions-and-sharing.md +6 -2
  147. package/docs/fleet-demo-runbook.md +2 -2
  148. package/docs/fleet-dispatch.md +228 -16
  149. package/docs/git-commit-provenance.md +2 -2
  150. package/docs/glossary.md +22 -2
  151. package/docs/installation-and-lifecycle.md +2 -2
  152. package/docs/middleware-and-components.md +2 -1
  153. package/docs/model-catalog.md +1 -1
  154. package/docs/observability.md +56 -9
  155. package/docs/proactive-memory.md +1 -1
  156. package/docs/prompt-envelope-and-tools.md +4 -2
  157. package/docs/provider-adapter-cookbook.md +1 -1
  158. package/docs/release-cut-checklist.md +83 -65
  159. package/docs/resource-library.md +59 -0
  160. package/docs/safety-model.md +2 -2
  161. package/docs/scientific-validation.md +3 -3
  162. package/docs/session-lifecycle.md +37 -1
  163. package/docs/skills-marketplace.md +16 -3
  164. package/docs/tool-usage.md +14 -7
  165. package/docs/trace-store.md +1 -1
  166. package/docs/troubleshooting.md +1 -1
  167. package/docs/tui-design.md +1 -1
  168. package/docs/worker-dispatch-mechanics.md +3 -3
  169. package/package.json +1 -2
  170. package/src/cli/argv.ts +5 -0
  171. package/src/cli/configure.ts +107 -23
  172. package/src/cli/doctor.ts +5 -1
  173. package/src/cli/evidence.ts +30 -25
  174. package/src/cli/fleet-commands.ts +37 -0
  175. package/src/cli/fleet-graph.ts +102 -0
  176. package/src/cli/fleet-new.ts +36 -0
  177. package/src/cli/fleet-preflight.ts +111 -0
  178. package/src/cli/fleet-validate.ts +30 -0
  179. package/src/cli/fleet.ts +173 -335
  180. package/src/cli/index.ts +3 -1
  181. package/src/cli/library.ts +190 -0
  182. package/src/cli/share.ts +13 -1
  183. package/src/cli/shared.ts +1 -0
  184. package/src/cli/targets.ts +4 -1
  185. package/src/cli/usage.ts +111 -19
  186. package/src/cli/validate-model.ts +60 -5
  187. package/src/core/bus-events.ts +29 -0
  188. package/src/core/commit-attribution.ts +4 -4
  189. package/src/core/config.ts +130 -0
  190. package/src/core/defaults.ts +81 -0
  191. package/src/core/path-boundary.ts +100 -0
  192. package/src/domains/agents/builtins/architect.md +1 -0
  193. package/src/domains/agents/builtins/oracle.md +33 -0
  194. package/src/domains/agents/catalog.ts +13 -1
  195. package/src/domains/agents/extension.ts +2 -11
  196. package/src/domains/agents/fleet-contract.ts +304 -24
  197. package/src/domains/agents/index.ts +14 -0
  198. package/src/domains/agents/recipe.ts +7 -1
  199. package/src/domains/agents/registry.ts +73 -5
  200. package/src/domains/agents/result-contract.ts +360 -15
  201. package/src/domains/agents/write-boundary.ts +15 -50
  202. package/src/domains/config/classify.ts +4 -0
  203. package/src/domains/context/project-rules.ts +51 -1
  204. package/src/domains/dispatch/active-route-planner.ts +14 -0
  205. package/src/domains/dispatch/assignment-reconcile.ts +22 -5
  206. package/src/domains/dispatch/assignment-store.ts +151 -14
  207. package/src/domains/dispatch/backoff.ts +2 -1
  208. package/src/domains/dispatch/capability-match.ts +1 -0
  209. package/src/domains/dispatch/checkout-writer-lease.ts +175 -0
  210. package/src/domains/dispatch/contract.ts +48 -0
  211. package/src/domains/dispatch/delegation-plan.ts +164 -0
  212. package/src/domains/dispatch/execution-plan.ts +76 -5
  213. package/src/domains/dispatch/execution-role.ts +12 -2
  214. package/src/domains/dispatch/execution-scheduler.ts +183 -67
  215. package/src/domains/dispatch/extension.ts +412 -74
  216. package/src/domains/dispatch/fleet-gate.ts +14 -0
  217. package/src/domains/dispatch/fleet-plan.ts +63 -3
  218. package/src/domains/dispatch/fleet-run.ts +791 -0
  219. package/src/domains/dispatch/gate-role-prompts.ts +47 -0
  220. package/src/domains/dispatch/host-verification.ts +178 -0
  221. package/src/domains/dispatch/index.ts +41 -1
  222. package/src/domains/dispatch/intent-requirements.ts +40 -0
  223. package/src/domains/dispatch/intent.ts +235 -0
  224. package/src/domains/dispatch/path-scope.ts +370 -0
  225. package/src/domains/dispatch/receipt-integrity.ts +9 -4
  226. package/src/domains/dispatch/state.ts +36 -3
  227. package/src/domains/dispatch/types.ts +64 -12
  228. package/src/domains/dispatch/validation.ts +69 -6
  229. package/src/domains/dispatch/write-boundary-enforcer.ts +45 -0
  230. package/src/domains/dispatch/write-boundary.ts +201 -22
  231. package/src/domains/eval/metrics/evidence.ts +79 -2
  232. package/src/domains/eval/runners/clio-run.ts +12 -2
  233. package/src/domains/evidence/build.ts +69 -11
  234. package/src/domains/evidence/index.ts +21 -0
  235. package/src/domains/evidence/provenance.ts +46 -11
  236. package/src/domains/evidence/trust-projection.ts +274 -0
  237. package/src/domains/evidence/trust-status.ts +155 -18
  238. package/src/domains/evidence/types.ts +4 -0
  239. package/src/domains/extensions/discovery.ts +88 -1
  240. package/src/domains/extensions/resources.ts +20 -8
  241. package/src/domains/extensions/state.ts +6 -2
  242. package/src/domains/extensions/types.ts +4 -1
  243. package/src/domains/lifecycle/doctor.ts +140 -1
  244. package/src/domains/middleware/index.ts +15 -0
  245. package/src/domains/middleware/watchdog.ts +281 -0
  246. package/src/domains/observability/contract.ts +3 -1
  247. package/src/domains/observability/cost.ts +12 -1
  248. package/src/domains/observability/extension.ts +2 -2
  249. package/src/domains/observability/index.ts +10 -0
  250. package/src/domains/observability/out-of-turn-usage.ts +223 -0
  251. package/src/domains/prompts/contract.ts +3 -5
  252. package/src/domains/providers/extension.ts +30 -2
  253. package/src/domains/resources/common-loader.ts +3 -0
  254. package/src/domains/resources/index.ts +20 -0
  255. package/src/domains/resources/library.ts +326 -0
  256. package/src/domains/resources/prompts/loader.ts +119 -14
  257. package/src/domains/resources/skills/marketplace.ts +37 -12
  258. package/src/domains/safety/policy-engine.ts +5 -5
  259. package/src/domains/safety/run-effects.ts +64 -1
  260. package/src/domains/safety/scope.ts +7 -12
  261. package/src/domains/session/handoff.ts +629 -0
  262. package/src/domains/share/archive.ts +67 -2
  263. package/src/engine/acp/server.ts +4 -1
  264. package/src/engine/prompt-templates.ts +18 -1
  265. package/src/engine/worker-runtime.ts +6 -3
  266. package/src/entry/orchestrator.ts +37 -0
  267. package/src/interactive/bus-notices.ts +26 -0
  268. package/src/interactive/chat-loop.ts +235 -1
  269. package/src/interactive/chat-renderer.ts +22 -0
  270. package/src/interactive/cost-overlay.ts +31 -3
  271. package/src/interactive/council-dispatch.ts +30 -0
  272. package/src/interactive/council-grid.ts +213 -0
  273. package/src/interactive/council.ts +99 -0
  274. package/src/interactive/dispatch-board.ts +311 -17
  275. package/src/interactive/fleet-run-preview.ts +307 -0
  276. package/src/interactive/footer/notifications.ts +219 -0
  277. package/src/interactive/handoff-round.ts +56 -0
  278. package/src/interactive/interactive-application.ts +43 -1
  279. package/src/interactive/interactive-event-projection.ts +23 -1
  280. package/src/interactive/interactive-slash-runtime.ts +52 -2
  281. package/src/interactive/interactive-subscriptions.ts +14 -2
  282. package/src/interactive/oracle.ts +179 -0
  283. package/src/interactive/overlay-ask-user-lifecycle.ts +6 -0
  284. package/src/interactive/overlay-general-openers.ts +190 -1
  285. package/src/interactive/overlay-key-routing.ts +17 -1
  286. package/src/interactive/overlay-lifecycle.ts +41 -1
  287. package/src/interactive/overlay-permission-lifecycle.ts +10 -0
  288. package/src/interactive/overlay-resource-openers.ts +11 -3
  289. package/src/interactive/overlay-session-lifecycle.ts +234 -2
  290. package/src/interactive/overlays/fleet-run-approval.ts +208 -0
  291. package/src/interactive/overlays/handoff-review.ts +185 -0
  292. package/src/interactive/overlays/library-install-confirm.ts +151 -0
  293. package/src/interactive/overlays/list-overlay.ts +168 -2
  294. package/src/interactive/overlays/settings.ts +221 -30
  295. package/src/interactive/overlays/side-question.ts +139 -0
  296. package/src/interactive/overlays/skills-hub.ts +401 -15
  297. package/src/interactive/side-question.ts +171 -0
  298. package/src/interactive/slash-commands.ts +439 -7
  299. package/src/interactive/slash-spec.ts +19 -6
  300. package/src/interactive/theme/tokens.ts +30 -0
  301. package/src/interactive/turn-middleware.ts +15 -1
  302. package/src/interactive/view/artifacts.ts +42 -9
  303. package/src/interactive/view/view-overlay.ts +15 -3
  304. package/src/interactive/watchdog-run.ts +75 -0
  305. package/src/interactive/worker-receipts.ts +14 -2
  306. package/src/interactive/worker-share.ts +56 -1
  307. package/src/interactive/worker-stream.ts +15 -0
  308. package/src/tools/bootstrap.ts +3 -0
  309. package/src/tools/compete-worktrees.ts +13 -79
  310. package/src/tools/dispatch-admission.ts +251 -18
  311. package/src/tools/dispatch-arguments.ts +84 -1
  312. package/src/tools/dispatch-plan.ts +165 -6
  313. package/src/tools/dispatch-runner.ts +364 -23
  314. package/src/tools/dispatch-types.ts +20 -1
  315. package/src/tools/dispatch.ts +72 -2
  316. package/src/tools/monitor.ts +29 -0
  317. package/src/tools/profiles.ts +18 -4
  318. package/src/tools/task-worktree.ts +238 -0
  319. package/src/tools/verify/authoring.ts +61 -1
  320. package/src/tools/verify/scripts.ts +62 -0
  321. package/src/tools/worker-evidence.ts +21 -14
  322. package/src/worker/spec-contract.ts +3 -1
  323. package/dist/chunk-HC4CLZ2Y.js +0 -68
@@ -1,4 +1,13 @@
1
1
  import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
+ import {
3
+ enabledExtensionResourceRoots
4
+ } from "./chunk-DYIM5TJT.js";
5
+ import {
6
+ PATH_BOUNDARY_MAX_ENTRIES,
7
+ normalizePathBoundary,
8
+ normalizePathBoundaryEntry,
9
+ pathBoundaryCovers
10
+ } from "./chunk-TTHACPOM.js";
2
11
  import {
3
12
  ArrayOptions,
4
13
  Clone,
@@ -62,12 +71,15 @@ import {
62
71
  settings_exports,
63
72
  typebox_exports
64
73
  } from "./chunk-5B2AEOW5.js";
74
+ import {
75
+ resolvePackageRoot
76
+ } from "./chunk-IWHMRKLL.js";
65
77
  import {
66
78
  require_dist
67
79
  } from "./chunk-APJ265NV.js";
68
80
  import {
69
- resolvePackageRoot
70
- } from "./chunk-IWHMRKLL.js";
81
+ clioConfigDir
82
+ } from "./chunk-BNAZZHFG.js";
71
83
  import {
72
84
  __export,
73
85
  __toESM,
@@ -3874,23 +3886,23 @@ init_esm_shims();
3874
3886
 
3875
3887
  // node_modules/typebox/build/value/delta/diff.mjs
3876
3888
  init_esm_shims();
3877
- function CreateUpdate(path2, value) {
3878
- return { type: "update", path: path2, value };
3889
+ function CreateUpdate(path, value) {
3890
+ return { type: "update", path, value };
3879
3891
  }
3880
- function CreateInsert(path2, value) {
3881
- return { type: "insert", path: path2, value };
3892
+ function CreateInsert(path, value) {
3893
+ return { type: "insert", path, value };
3882
3894
  }
3883
- function CreateDelete(path2) {
3884
- return { type: "delete", path: path2 };
3895
+ function CreateDelete(path) {
3896
+ return { type: "delete", path };
3885
3897
  }
3886
3898
  function AssertCanDiffObject(value) {
3887
3899
  if (guard_exports.IsObject(value) && guard_exports.IsEqual(guard_exports.Symbols(value).length, 0))
3888
3900
  return;
3889
3901
  throw new Error("Cannot create diffs for objects with symbols keys");
3890
3902
  }
3891
- function* FromObject8(path2, left, right) {
3903
+ function* FromObject8(path, left, right) {
3892
3904
  if (!guard_exports.IsObject(right) || guard_exports.IsArray(right))
3893
- return yield CreateUpdate(path2, right);
3905
+ return yield CreateUpdate(path, right);
3894
3906
  AssertCanDiffObject(left);
3895
3907
  AssertCanDiffObject(right);
3896
3908
  const leftKeys = guard_exports.Keys(left);
@@ -3900,7 +3912,7 @@ function* FromObject8(path2, left, right) {
3900
3912
  continue;
3901
3913
  if (guard_exports.IsUnsafePropertyKey(key))
3902
3914
  continue;
3903
- yield CreateInsert(`${path2}/${key}`, right[key]);
3915
+ yield CreateInsert(`${path}/${key}`, right[key]);
3904
3916
  }
3905
3917
  for (const key of leftKeys) {
3906
3918
  if (!guard_exports.HasPropertyKey(right, key))
@@ -3909,52 +3921,52 @@ function* FromObject8(path2, left, right) {
3909
3921
  continue;
3910
3922
  if (Equal(left, right))
3911
3923
  continue;
3912
- yield* FromValue2(`${path2}/${key}`, left[key], right[key]);
3924
+ yield* FromValue2(`${path}/${key}`, left[key], right[key]);
3913
3925
  }
3914
3926
  for (const key of leftKeys) {
3915
3927
  if (guard_exports.HasPropertyKey(right, key))
3916
3928
  continue;
3917
3929
  if (guard_exports.IsUnsafePropertyKey(key))
3918
3930
  continue;
3919
- yield CreateDelete(`${path2}/${key}`);
3931
+ yield CreateDelete(`${path}/${key}`);
3920
3932
  }
3921
3933
  }
3922
- function* FromArray8(path2, left, right) {
3934
+ function* FromArray8(path, left, right) {
3923
3935
  if (!guard_exports.IsArray(right))
3924
- return yield CreateUpdate(path2, right);
3936
+ return yield CreateUpdate(path, right);
3925
3937
  for (let i = 0; i < Math.min(left.length, right.length); i++) {
3926
- yield* FromValue2(`${path2}/${i}`, left[i], right[i]);
3938
+ yield* FromValue2(`${path}/${i}`, left[i], right[i]);
3927
3939
  }
3928
3940
  for (let i = 0; i < right.length; i++) {
3929
3941
  if (i < left.length)
3930
3942
  continue;
3931
- yield CreateInsert(`${path2}/${i}`, right[i]);
3943
+ yield CreateInsert(`${path}/${i}`, right[i]);
3932
3944
  }
3933
3945
  for (let i = left.length - 1; i >= 0; i--) {
3934
3946
  if (i < right.length)
3935
3947
  continue;
3936
- yield CreateDelete(`${path2}/${i}`);
3948
+ yield CreateDelete(`${path}/${i}`);
3937
3949
  }
3938
3950
  }
3939
- function* FromTypedArray(path2, left, right) {
3951
+ function* FromTypedArray(path, left, right) {
3940
3952
  const typeLeft = globalThis.Object.getPrototypeOf(left).constructor.name;
3941
3953
  const typeRight = globalThis.Object.getPrototypeOf(right).constructor.name;
3942
3954
  const predicate = globals_exports.IsTypeArray(right) && guard_exports.IsEqual(left.length, right.length) && guard_exports.IsEqual(typeLeft, typeRight);
3943
3955
  if (predicate) {
3944
3956
  for (let index = 0; index < Math.min(left.length, right.length); index++) {
3945
- yield* FromValue2(`${path2}/${index}`, left[index], right[index]);
3957
+ yield* FromValue2(`${path}/${index}`, left[index], right[index]);
3946
3958
  }
3947
3959
  } else {
3948
- return yield CreateUpdate(path2, right);
3960
+ return yield CreateUpdate(path, right);
3949
3961
  }
3950
3962
  }
3951
- function* FromUnknown(path2, left, right) {
3963
+ function* FromUnknown(path, left, right) {
3952
3964
  if (left === right)
3953
3965
  return;
3954
- yield CreateUpdate(path2, right);
3966
+ yield CreateUpdate(path, right);
3955
3967
  }
3956
- function* FromValue2(path2, left, right) {
3957
- return globals_exports.IsTypeArray(left) ? yield* FromTypedArray(path2, left, right) : guard_exports.IsArray(left) ? yield* FromArray8(path2, left, right) : guard_exports.IsObject(left) ? yield* FromObject8(path2, left, right) : yield* FromUnknown(path2, left, right);
3968
+ function* FromValue2(path, left, right) {
3969
+ return globals_exports.IsTypeArray(left) ? yield* FromTypedArray(path, left, right) : guard_exports.IsArray(left) ? yield* FromArray8(path, left, right) : guard_exports.IsObject(left) ? yield* FromObject8(path, left, right) : yield* FromUnknown(path, left, right);
3958
3970
  }
3959
3971
  function Diff(current, next) {
3960
3972
  return [...FromValue2("", current, next)];
@@ -4360,9 +4372,9 @@ function parseFleetCommands(raw, sourcePath) {
4360
4372
  return { version: 1, commands, path: sourcePath };
4361
4373
  }
4362
4374
  function loadFleetCommands(cwd) {
4363
- const path2 = fleetCommandsPath(cwd);
4364
- if (!existsSync(path2)) return null;
4365
- return parseFleetCommands(readFileSync(path2, "utf8"), path2);
4375
+ const path = fleetCommandsPath(cwd);
4376
+ if (!existsSync(path)) return null;
4377
+ return parseFleetCommands(readFileSync(path, "utf8"), path);
4366
4378
  }
4367
4379
 
4368
4380
  // src/domains/agents/fleet-contract.ts
@@ -4404,45 +4416,15 @@ function parseFrontmatter(raw, sourcePath) {
4404
4416
 
4405
4417
  // src/domains/agents/write-boundary.ts
4406
4418
  init_esm_shims();
4407
- var WRITE_BOUNDARY_MAX_ENTRIES = 32;
4408
- var GLOB_CHARACTERS = /[*?[\]{}]/u;
4419
+ var WRITE_BOUNDARY_MAX_ENTRIES = PATH_BOUNDARY_MAX_ENTRIES;
4409
4420
  function normalizeWriteBoundaryEntry(entry) {
4410
- const raw = entry.trim();
4411
- if (raw.length === 0) throw new Error("write boundary: entry must be a non-empty path");
4412
- if (raw.includes("\\")) {
4413
- throw new Error(`write boundary: entry '${entry}' must use '/' separators`);
4414
- }
4415
- if (GLOB_CHARACTERS.test(raw)) {
4416
- throw new Error(`write boundary: entry '${entry}' looks like a glob, which v1 does not support`);
4417
- }
4418
- if (raw.startsWith("/") || /^[A-Za-z]:/u.test(raw)) {
4419
- throw new Error(`write boundary: entry '${entry}' must be repository-relative, not absolute`);
4420
- }
4421
- const subtree = raw.endsWith("/");
4422
- const segments = raw.split("/").filter((segment) => segment.length > 0);
4423
- if (segments.length === 0) {
4424
- throw new Error(`write boundary: entry '${entry}' must name a path inside the repository`);
4425
- }
4426
- for (const segment of segments) {
4427
- if (segment === "..") throw new Error(`write boundary: entry '${entry}' must not contain '..'`);
4428
- if (segment === ".") throw new Error(`write boundary: entry '${entry}' must not contain '.' segments`);
4429
- }
4430
- const joined = segments.join("/");
4431
- return subtree ? `${joined}/` : joined;
4421
+ return normalizePathBoundaryEntry(entry);
4432
4422
  }
4433
4423
  function normalizeWriteBoundary(entries) {
4434
- if (entries.length > WRITE_BOUNDARY_MAX_ENTRIES) {
4435
- throw new Error(`write boundary: at most ${WRITE_BOUNDARY_MAX_ENTRIES} entries may be declared`);
4436
- }
4437
- const normalized = new Set(entries.map(normalizeWriteBoundaryEntry));
4438
- return [...normalized].sort();
4424
+ return normalizePathBoundary(entries);
4439
4425
  }
4440
- function toRepoRelativePosix(path2) {
4441
- return path2.split("\\").join("/");
4442
- }
4443
- function writeBoundaryCovers(boundary, path2) {
4444
- const candidate = toRepoRelativePosix(path2);
4445
- return boundary.some((entry) => entry.endsWith("/") ? candidate.startsWith(entry) : candidate === entry);
4426
+ function writeBoundaryCovers(boundary, path) {
4427
+ return pathBoundaryCovers(boundary, path);
4446
4428
  }
4447
4429
  function describeWriteBoundary(boundary) {
4448
4430
  return boundary.length === 0 ? "(nothing: readonly)" : boundary.join(", ");
@@ -4450,11 +4432,15 @@ function describeWriteBoundary(boundary) {
4450
4432
 
4451
4433
  // src/domains/agents/fleet-contract.ts
4452
4434
  var FLEET_WRITE_BOUNDARY_VERSION = 4;
4435
+ var FLEET_DYNAMIC_STEP_VERSION = 5;
4453
4436
  var FLEET_LOOP_MAX_ATTEMPTS = 5;
4454
4437
  var FleetScopeSchema = typebox_exports.Union([typebox_exports.Literal("readonly"), typebox_exports.Literal("workspace")]);
4455
4438
  function writesSchema(version) {
4456
4439
  return version >= FLEET_WRITE_BOUNDARY_VERSION ? { writes: typebox_exports.Optional(typebox_exports.Array(typebox_exports.String({ minLength: 1 }), { maxItems: WRITE_BOUNDARY_MAX_ENTRIES })) } : {};
4457
4440
  }
4441
+ function routeSchema(version) {
4442
+ return version >= FLEET_DYNAMIC_STEP_VERSION ? { target: typebox_exports.Optional(typebox_exports.String({ minLength: 1 })), profile: typebox_exports.Optional(typebox_exports.String({ minLength: 1 })) } : {};
4443
+ }
4458
4444
  function agentStepSchema(version) {
4459
4445
  return typebox_exports.Object(
4460
4446
  {
@@ -4463,7 +4449,40 @@ function agentStepSchema(version) {
4463
4449
  agent: typebox_exports.String({ minLength: 1 }),
4464
4450
  scope: FleetScopeSchema,
4465
4451
  dependencies: typebox_exports.Array(typebox_exports.String({ minLength: 1 })),
4466
- ...writesSchema(version)
4452
+ ...writesSchema(version),
4453
+ ...routeSchema(version)
4454
+ },
4455
+ { additionalProperties: false }
4456
+ );
4457
+ }
4458
+ function gateStepSchema() {
4459
+ return typebox_exports.Object(
4460
+ {
4461
+ kind: typebox_exports.Literal("gate"),
4462
+ id: typebox_exports.String({ minLength: 1 }),
4463
+ agent: typebox_exports.String({ minLength: 1 }),
4464
+ path: typebox_exports.String({ minLength: 1 }),
4465
+ run: typebox_exports.String({ minLength: 1 }),
4466
+ scope: typebox_exports.Optional(typebox_exports.Literal("workspace")),
4467
+ dependencies: typebox_exports.Array(typebox_exports.String({ minLength: 1 })),
4468
+ ...routeSchema(5)
4469
+ },
4470
+ { additionalProperties: false }
4471
+ );
4472
+ }
4473
+ function planStepSchema() {
4474
+ return typebox_exports.Object(
4475
+ {
4476
+ kind: typebox_exports.Literal("plan"),
4477
+ id: typebox_exports.String({ minLength: 1 }),
4478
+ agent: typebox_exports.Optional(typebox_exports.String({ minLength: 1 })),
4479
+ roster: typebox_exports.Array(typebox_exports.String({ minLength: 1 }), { minItems: 1, maxItems: 16 }),
4480
+ maxTasks: typebox_exports.Integer({ minimum: 1, maximum: 16 }),
4481
+ proposals: typebox_exports.Optional(typebox_exports.Boolean()),
4482
+ scope: FleetScopeSchema,
4483
+ dependencies: typebox_exports.Array(typebox_exports.String({ minLength: 1 })),
4484
+ ...writesSchema(5),
4485
+ ...routeSchema(5)
4467
4486
  },
4468
4487
  { additionalProperties: false }
4469
4488
  );
@@ -4500,12 +4519,19 @@ function loopStepSchema(version) {
4500
4519
  },
4501
4520
  { additionalProperties: false }
4502
4521
  ),
4522
+ ...version >= FLEET_DYNAMIC_STEP_VERSION ? [
4523
+ typebox_exports.Object(
4524
+ { kind: typebox_exports.Literal("gate"), gate: typebox_exports.String({ minLength: 1 }) },
4525
+ { additionalProperties: false }
4526
+ )
4527
+ ] : [],
4503
4528
  typebox_exports.Object(
4504
4529
  {
4505
4530
  kind: typebox_exports.Literal("agent"),
4506
4531
  agent: typebox_exports.String({ minLength: 1 }),
4507
4532
  scope: FleetScopeSchema,
4508
- ...writesSchema(version)
4533
+ ...writesSchema(version),
4534
+ ...routeSchema(version)
4509
4535
  },
4510
4536
  { additionalProperties: false }
4511
4537
  )
@@ -4515,7 +4541,8 @@ function loopStepSchema(version) {
4515
4541
  kind: typebox_exports.Optional(typebox_exports.Literal("agent")),
4516
4542
  agent: typebox_exports.String({ minLength: 1 }),
4517
4543
  scope: FleetScopeSchema,
4518
- ...writesSchema(version)
4544
+ ...writesSchema(version),
4545
+ ...routeSchema(version)
4519
4546
  },
4520
4547
  { additionalProperties: false }
4521
4548
  )
@@ -4526,6 +4553,15 @@ function loopStepSchema(version) {
4526
4553
  function stepSchema(version) {
4527
4554
  if (version === 1) return agentStepSchema(1);
4528
4555
  if (version === 2) return typebox_exports.Union([agentStepSchema(2), codeStepSchema(2)]);
4556
+ if (version === 5) {
4557
+ return typebox_exports.Union([
4558
+ agentStepSchema(version),
4559
+ codeStepSchema(version),
4560
+ loopStepSchema(version),
4561
+ gateStepSchema(),
4562
+ planStepSchema()
4563
+ ]);
4564
+ }
4529
4565
  return typebox_exports.Union([agentStepSchema(version), codeStepSchema(version), loopStepSchema(version)]);
4530
4566
  }
4531
4567
  function frontmatterSchema(version) {
@@ -4537,7 +4573,8 @@ function frontmatterSchema(version) {
4537
4573
  steps: typebox_exports.Array(stepSchema(version), { minItems: 1 }),
4538
4574
  maxWorkers: typebox_exports.Integer({ minimum: 1 }),
4539
4575
  budgetUsd: typebox_exports.Optional(typebox_exports.Number()),
4540
- onFailure: typebox_exports.Union([typebox_exports.Literal("stop"), typebox_exports.Literal("continue")])
4576
+ onFailure: typebox_exports.Union([typebox_exports.Literal("stop"), typebox_exports.Literal("continue")]),
4577
+ ...version >= FLEET_DYNAMIC_STEP_VERSION ? { writers: typebox_exports.Optional(typebox_exports.Literal(1)) } : {}
4541
4578
  },
4542
4579
  { additionalProperties: false }
4543
4580
  );
@@ -4546,11 +4583,12 @@ var SCHEMAS = {
4546
4583
  1: frontmatterSchema(1),
4547
4584
  2: frontmatterSchema(2),
4548
4585
  3: frontmatterSchema(3),
4549
- 4: frontmatterSchema(4)
4586
+ 4: frontmatterSchema(4),
4587
+ 5: frontmatterSchema(5)
4550
4588
  };
4551
4589
  function contractVersion(frontmatter) {
4552
4590
  const value = frontmatter.version;
4553
- return value === 1 || value === 2 || value === 3 || value === 4 ? value : null;
4591
+ return value === 1 || value === 2 || value === 3 || value === 4 || value === 5 ? value : null;
4554
4592
  }
4555
4593
  function firstSchemaError2(frontmatter, version) {
4556
4594
  const schema = SCHEMAS[version];
@@ -4565,6 +4603,36 @@ function normalizedWrites(writes) {
4565
4603
  return writes === void 0 ? {} : { writes: normalizeWriteBoundary(writes) };
4566
4604
  }
4567
4605
  function normalizeStep(step) {
4606
+ const route = (value) => ({
4607
+ ...value.target !== void 0 ? { target: value.target } : {},
4608
+ ...value.profile !== void 0 ? { profile: value.profile } : {}
4609
+ });
4610
+ if (step.kind === "gate") {
4611
+ return {
4612
+ kind: "gate",
4613
+ id: step.id,
4614
+ agent: step.agent ?? "",
4615
+ path: step.path ?? "",
4616
+ run: step.run ?? "",
4617
+ scope: "workspace",
4618
+ dependencies: [...step.dependencies],
4619
+ ...route(step)
4620
+ };
4621
+ }
4622
+ if (step.kind === "plan") {
4623
+ return {
4624
+ kind: "plan",
4625
+ id: step.id,
4626
+ agent: step.agent ?? "architect",
4627
+ roster: [...step.roster ?? []],
4628
+ maxTasks: step.maxTasks ?? 0,
4629
+ proposals: step.proposals ?? false,
4630
+ scope: step.scope,
4631
+ dependencies: [...step.dependencies],
4632
+ ...normalizedWrites(step.writes),
4633
+ ...route(step)
4634
+ };
4635
+ }
4568
4636
  if (step.kind === "loop") {
4569
4637
  const check = step.check;
4570
4638
  const repair = step.repair;
@@ -4573,8 +4641,20 @@ function normalizeStep(step) {
4573
4641
  id: step.id,
4574
4642
  maxAttempts: step.maxAttempts ?? 0,
4575
4643
  dependencies: [...step.dependencies],
4576
- check: check.kind === "code" ? { kind: "code", command: check.command ?? "", scope: check.scope, ...normalizedWrites(check.writes) } : { kind: "agent", agent: check.agent ?? "", scope: check.scope, ...normalizedWrites(check.writes) },
4577
- repair: { kind: "agent", agent: repair.agent, scope: repair.scope, ...normalizedWrites(repair.writes) }
4644
+ check: check.kind === "code" ? { kind: "code", command: check.command ?? "", scope: check.scope, ...normalizedWrites(check.writes) } : check.kind === "gate" ? { kind: "gate", gate: check.gate ?? "" } : {
4645
+ kind: "agent",
4646
+ agent: check.agent ?? "",
4647
+ scope: check.scope,
4648
+ ...normalizedWrites(check.writes),
4649
+ ...route(check)
4650
+ },
4651
+ repair: {
4652
+ kind: "agent",
4653
+ agent: repair.agent,
4654
+ scope: repair.scope,
4655
+ ...normalizedWrites(repair.writes),
4656
+ ...route(repair)
4657
+ }
4578
4658
  };
4579
4659
  }
4580
4660
  if (step.kind === "code") {
@@ -4594,7 +4674,8 @@ function normalizeStep(step) {
4594
4674
  agent: step.agent ?? "",
4595
4675
  scope: step.scope,
4596
4676
  dependencies: [...step.dependencies],
4597
- ...normalizedWrites(step.writes)
4677
+ ...normalizedWrites(step.writes),
4678
+ ...route(step)
4598
4679
  };
4599
4680
  }
4600
4681
  function fleetLoopCheckStepId(loopId, attempt) {
@@ -4635,6 +4716,13 @@ function validateFleetGraph(contract) {
4635
4716
  }
4636
4717
  }
4637
4718
  for (const step of contract.steps) {
4719
+ if (step.kind === "loop" && step.check.kind === "gate") {
4720
+ const gateId = step.check.gate;
4721
+ const gate = contract.steps.find((candidate) => candidate.id === gateId);
4722
+ if (gate?.kind !== "gate") {
4723
+ throw new Error(`fleet contract ${contract.path}: loop '${step.id}' names unknown gate '${gateId}'`);
4724
+ }
4725
+ }
4638
4726
  for (const dependency of step.dependencies) {
4639
4727
  if (dependency === step.id) throw new Error(`fleet contract ${contract.path}: step '${step.id}' depends on itself`);
4640
4728
  if (!declared.has(dependency)) {
@@ -4688,10 +4776,18 @@ function fleetStepBoundaries(contract) {
4688
4776
  };
4689
4777
  for (const step of contract.steps) {
4690
4778
  if (step.kind === "loop") {
4691
- add(`${step.id}.check`, step.check.scope, step.check.writes);
4779
+ if (step.check.kind === "gate") {
4780
+ const gateId = step.check.gate;
4781
+ const gate = contract.steps.find((candidate) => candidate.id === gateId);
4782
+ if (gate?.kind === "gate") add(`${step.id}.check`, "workspace", [gate.path]);
4783
+ } else add(`${step.id}.check`, step.check.scope, step.check.writes);
4692
4784
  add(`${step.id}.repair`, step.repair.scope, step.repair.writes);
4693
4785
  continue;
4694
4786
  }
4787
+ if (step.kind === "gate") {
4788
+ add(step.id, "workspace", [step.path]);
4789
+ continue;
4790
+ }
4695
4791
  add(step.id, step.scope, step.writes);
4696
4792
  }
4697
4793
  return boundaries;
@@ -4707,9 +4803,9 @@ function validateWriteBoundaries(contract) {
4707
4803
  }
4708
4804
  for (const step of contract.steps) {
4709
4805
  const declared = step.kind === "loop" ? [
4710
- { id: `${step.id}.check`, scope: step.check.scope, writes: step.check.writes },
4806
+ ...step.check.kind === "gate" ? [] : [{ id: `${step.id}.check`, scope: step.check.scope, writes: step.check.writes }],
4711
4807
  { id: `${step.id}.repair`, scope: step.repair.scope, writes: step.repair.writes }
4712
- ] : [{ id: step.id, scope: step.scope, writes: step.writes }];
4808
+ ] : step.kind === "gate" ? [] : [{ id: step.id, scope: step.scope, writes: step.writes }];
4713
4809
  for (const position of declared) {
4714
4810
  if (position.scope === "readonly" && position.writes !== void 0) {
4715
4811
  throw new Error(
@@ -4742,11 +4838,11 @@ function parseFleetContract(raw, sourcePath) {
4742
4838
  const { frontmatter, body } = parseFrontmatter(raw, sourcePath);
4743
4839
  const version = contractVersion(frontmatter);
4744
4840
  if (version === null) {
4745
- throw new Error(
4746
- `fleet contract ${sourcePath}: version must be 1 (agent steps), 2 (agent and code steps), 3 (adds bounded loops and commit steps), or 4 (adds enforced write boundaries)`
4747
- );
4841
+ throw new Error(`fleet contract ${sourcePath}: version must be 1, 2, 3, 4, or 5`);
4748
4842
  }
4749
4843
  if (version < FLEET_WRITE_BOUNDARY_VERSION) assertNoWritesBefore(frontmatter, sourcePath, version);
4844
+ if (version < FLEET_DYNAMIC_STEP_VERSION) assertNoV5FieldsBefore(frontmatter, sourcePath, version);
4845
+ if (version >= FLEET_DYNAMIC_STEP_VERSION) assertNoGateWrites(frontmatter, sourcePath);
4750
4846
  const schemaError = firstSchemaError2(frontmatter, version);
4751
4847
  if (schemaError !== null) {
4752
4848
  throw new Error(`fleet contract ${sourcePath}: ${schemaError}`);
@@ -4767,13 +4863,47 @@ function parseFleetContract(raw, sourcePath) {
4767
4863
  maxWorkers: fm.maxWorkers,
4768
4864
  budgetUsd: fm.budgetUsd ?? null,
4769
4865
  onFailure: fm.onFailure,
4866
+ ...fm.writers === 1 ? { writers: 1 } : {},
4770
4867
  body: trimmedBody,
4771
4868
  path: sourcePath
4772
4869
  };
4773
4870
  validateFleetGraph(contract);
4774
4871
  validateWriteBoundaries(contract);
4872
+ validateV5Declarations(contract);
4775
4873
  return contract;
4776
4874
  }
4875
+ function validateV5Declarations(contract) {
4876
+ if (contract.version < FLEET_DYNAMIC_STEP_VERSION) return;
4877
+ const route = (id, value) => {
4878
+ if (value.target !== void 0 && value.profile !== void 0) {
4879
+ throw new Error(`fleet contract ${contract.path}: step '${id}' may declare target or profile, never both`);
4880
+ }
4881
+ };
4882
+ for (const step of contract.steps) {
4883
+ if (step.kind === "agent" || step.kind === "plan" || step.kind === "gate") route(step.id, step);
4884
+ if (step.kind === "plan" && new Set(step.roster).size !== step.roster.length) {
4885
+ throw new Error(`fleet contract ${contract.path}: plan step '${step.id}' roster contains duplicate agents`);
4886
+ }
4887
+ if (step.kind === "gate") {
4888
+ let normalized;
4889
+ try {
4890
+ normalized = normalizeWriteBoundary([step.path]);
4891
+ } catch (error) {
4892
+ throw new Error(
4893
+ `fleet contract ${contract.path}: gate '${step.id}' path is invalid: ${error instanceof Error ? error.message : String(error)}`
4894
+ );
4895
+ }
4896
+ if (normalized[0] !== step.path.replaceAll("\\", "/")) {
4897
+ throw new Error(
4898
+ `fleet contract ${contract.path}: gate '${step.id}' path must be normalized and repository-relative`
4899
+ );
4900
+ }
4901
+ }
4902
+ if (step.kind !== "loop") continue;
4903
+ if (step.check.kind === "agent") route(`${step.id}.check`, step.check);
4904
+ route(`${step.id}.repair`, step.repair);
4905
+ }
4906
+ }
4777
4907
  function assertNoWritesBefore(frontmatter, sourcePath, version) {
4778
4908
  const steps = Array.isArray(frontmatter.steps) ? frontmatter.steps : [];
4779
4909
  const declaresWrites = (value) => typeof value === "object" && value !== null && "writes" in value;
@@ -4786,10 +4916,48 @@ function assertNoWritesBefore(frontmatter, sourcePath, version) {
4786
4916
  }
4787
4917
  }
4788
4918
  }
4919
+ function assertNoGateWrites(frontmatter, sourcePath) {
4920
+ for (const value of Array.isArray(frontmatter.steps) ? frontmatter.steps : []) {
4921
+ if (typeof value !== "object" || value === null) continue;
4922
+ const step = value;
4923
+ if (step.kind !== "gate" || typeof step.id !== "string" || step.id.length === 0 || !("writes" in step)) continue;
4924
+ throw new Error(
4925
+ `fleet contract ${sourcePath}: gate step '${step.id}' must not declare 'writes'; its write boundary is derived from 'path'`
4926
+ );
4927
+ }
4928
+ }
4929
+ function assertNoV5FieldsBefore(frontmatter, sourcePath, version) {
4930
+ const forbidden = ["target", "profile"];
4931
+ if ("writers" in frontmatter) {
4932
+ throw new Error(
4933
+ `fleet contract ${sourcePath}: 'writers' requires contract version ${FLEET_DYNAMIC_STEP_VERSION}; this contract declares version ${version}`
4934
+ );
4935
+ }
4936
+ for (const value of Array.isArray(frontmatter.steps) ? frontmatter.steps : []) {
4937
+ if (typeof value !== "object" || value === null) continue;
4938
+ const step = value;
4939
+ if (step.kind === "plan" || step.kind === "gate") {
4940
+ throw new Error(
4941
+ `fleet contract ${sourcePath}: kind '${String(step.kind)}' requires contract version ${FLEET_DYNAMIC_STEP_VERSION}; this contract declares version ${version}`
4942
+ );
4943
+ }
4944
+ for (const candidate of [step, step.check, step.repair]) {
4945
+ if (typeof candidate !== "object" || candidate === null) continue;
4946
+ for (const field of forbidden) {
4947
+ if (field in candidate) {
4948
+ throw new Error(
4949
+ `fleet contract ${sourcePath}: '${field}' requires contract version ${FLEET_DYNAMIC_STEP_VERSION}; this contract declares version ${version}`
4950
+ );
4951
+ }
4952
+ }
4953
+ }
4954
+ }
4955
+ }
4789
4956
  function fleetCodeSteps(contract) {
4790
4957
  const steps = [];
4791
4958
  for (const step of contract.steps) {
4792
4959
  if (step.kind === "code") steps.push({ id: step.id, command: step.command });
4960
+ else if (step.kind === "gate") steps.push({ id: step.id, command: step.run });
4793
4961
  else if (step.kind === "loop" && step.check.kind === "code") {
4794
4962
  steps.push({ id: fleetLoopCheckStepId(step.id, 1), command: step.check.command });
4795
4963
  }
@@ -4828,11 +4996,19 @@ function validateFleetCommands(contract, registry) {
4828
4996
  function builtinFleetsDir() {
4829
4997
  return join2(resolvePackageRoot(), "src", "domains", "agents", "fleets");
4830
4998
  }
4999
+ function fleetSources(cwd) {
5000
+ return [
5001
+ { dir: builtinFleetsDir(), source: "builtin" },
5002
+ ...enabledExtensionResourceRoots("fleets", cwd).sort((left, right) => left.source.localeCompare(right.source)).map((root) => ({ dir: root.path, source: "extension" })),
5003
+ { dir: join2(clioConfigDir(), "fleets"), source: "user" },
5004
+ { dir: fleetsDir(cwd), source: "project" }
5005
+ ];
5006
+ }
4831
5007
  function fleetContractPath(cwd, name) {
4832
- const projectPath = join2(fleetsDir(cwd), `${name}.md`);
4833
- if (existsSync2(projectPath)) return { path: projectPath, source: "project" };
4834
- const builtinPath = join2(builtinFleetsDir(), `${name}.md`);
4835
- if (existsSync2(builtinPath)) return { path: builtinPath, source: "builtin" };
5008
+ for (const source of [...fleetSources(cwd)].reverse()) {
5009
+ const candidate = join2(source.dir, `${name}.md`);
5010
+ if (existsSync2(candidate)) return { path: candidate, source: source.source };
5011
+ }
4836
5012
  return null;
4837
5013
  }
4838
5014
  function loadFleetContract(cwd, name) {
@@ -4861,23 +5037,20 @@ function listFleetContracts(cwd) {
4861
5037
  registryError = err instanceof Error ? err.message : String(err);
4862
5038
  }
4863
5039
  const listings = /* @__PURE__ */ new Map();
4864
- const sources = [
4865
- { dir: builtinFleetsDir(), source: "builtin" },
4866
- { dir: fleetsDir(cwd), source: "project" }
4867
- ];
5040
+ const sources = fleetSources(cwd);
4868
5041
  for (const { dir, source } of sources) {
4869
5042
  for (const file of listDirectory(dir)) {
4870
- const path2 = join2(dir, file);
5043
+ const path = join2(dir, file);
4871
5044
  const name = basename(file, ".md");
4872
5045
  try {
4873
- const contract = parseFleetContract(readFileSync2(path2, "utf8"), path2);
5046
+ const contract = parseFleetContract(readFileSync2(path, "utf8"), path);
4874
5047
  if (registryError !== null && fleetCodeSteps(contract).length > 0) throw new Error(registryError);
4875
5048
  validateFleetCommands(contract, registry);
4876
- listings.set(name, { name, path: path2, source, contract, error: null, needsCommands: null });
5049
+ listings.set(name, { name, path, source, contract, error: null, needsCommands: null });
4877
5050
  } catch (err) {
4878
5051
  listings.set(name, {
4879
5052
  name,
4880
- path: path2,
5053
+ path,
4881
5054
  source,
4882
5055
  contract: null,
4883
5056
  error: err instanceof Error ? err.message : String(err),
@@ -4908,54 +5081,26 @@ function renderFleetPrompt(body, vars) {
4908
5081
  return rendered;
4909
5082
  }
4910
5083
 
4911
- // src/domains/safety/rigor.ts
4912
- init_esm_shims();
4913
- import { existsSync as existsSync3 } from "node:fs";
4914
- import path from "node:path";
4915
- var VALIDATION_CONTRACT_FILES = [
4916
- path.join(".clio-coder", "validation.yaml"),
4917
- path.join(".clio-coder", "validation.yml"),
4918
- "validation.yaml",
4919
- "validation.yml",
4920
- "VALIDATION.md"
4921
- ];
4922
- function resolveRigor(options) {
4923
- if (options.override === "high" || options.override === "normal") return options.override;
4924
- const cwd = options.cwd ?? process.cwd();
4925
- return hasValidationContract(cwd) ? "high" : "normal";
4926
- }
4927
- function parseRigorOverride(value) {
4928
- if (typeof value !== "string") return null;
4929
- const normalized = value.trim().toLowerCase();
4930
- if (normalized === "high") return "high";
4931
- if (normalized === "normal") return "normal";
4932
- return null;
4933
- }
4934
- function hasValidationContract(cwd) {
4935
- try {
4936
- return VALIDATION_CONTRACT_FILES.some((relative) => existsSync3(path.join(cwd, relative)));
4937
- } catch {
4938
- return false;
4939
- }
4940
- }
4941
-
4942
5084
  export {
4943
5085
  parseFrontmatter,
4944
5086
  FLEET_COMMAND_BASE_ENV,
4945
5087
  loadFleetCommands,
5088
+ normalizeWriteBoundaryEntry,
4946
5089
  normalizeWriteBoundary,
4947
5090
  writeBoundaryCovers,
4948
5091
  describeWriteBoundary,
4949
5092
  fleetLoopCheckStepId,
4950
5093
  fleetLoopRepairStepId,
5094
+ validateFleetGraph,
4951
5095
  fleetStepWriteBoundary,
5096
+ fleetStepBoundaries,
5097
+ parseFleetContract,
4952
5098
  FLEET_COMMANDS_REPO_PATH,
4953
5099
  FLEET_COMMANDS_REMEDY,
4954
5100
  FleetCommandRegistryMissingError,
5101
+ validateFleetCommands,
4955
5102
  loadFleetContract,
4956
5103
  listFleetContracts,
4957
- renderFleetPrompt,
4958
- resolveRigor,
4959
- parseRigorOverride
5104
+ renderFleetPrompt
4960
5105
  };
4961
- //# sourceMappingURL=chunk-QKMUKYO7.js.map
5106
+ //# sourceMappingURL=chunk-E77JEWSD.js.map