@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
@@ -2,54 +2,66 @@ import { createRequire as __clioCreateRequire } from "node:module"; const requir
2
2
  import {
3
3
  SchedulingDomainModule,
4
4
  createPromptsDomainModule
5
- } from "./chunk-XF5N4U5A.js";
5
+ } from "./chunk-5DHKRSMQ.js";
6
6
  import {
7
- AgentsDomainModule,
8
7
  SafetyDomainModule
9
- } from "./chunk-LYF7OHWH.js";
8
+ } from "./chunk-EMYUUSFG.js";
10
9
  import {
11
10
  LifecycleDomainModule
12
- } from "./chunk-6XXKFVSN.js";
11
+ } from "./chunk-5Q2VVUKB.js";
13
12
  import {
14
13
  ensureClioState
15
- } from "./chunk-KHSFENX2.js";
14
+ } from "./chunk-WWCZ5F23.js";
16
15
  import {
17
16
  ConfigDomainModule,
18
17
  loadDomains
19
- } from "./chunk-R46L2BIR.js";
18
+ } from "./chunk-FHJEP5SW.js";
19
+ import {
20
+ ResourcesDomainModule
21
+ } from "./chunk-U6MBIEMB.js";
22
+ import {
23
+ AgentsDomainModule
24
+ } from "./chunk-FBVTI2TJ.js";
25
+ import "./chunk-DR52UMZW.js";
26
+ import "./chunk-TANS5ZJS.js";
27
+ import "./chunk-DGSYXYMX.js";
20
28
  import {
21
29
  ObservabilityDomainModule
22
- } from "./chunk-K7T3E2SR.js";
23
- import "./chunk-HC4CLZ2Y.js";
30
+ } from "./chunk-WNIJTQQK.js";
31
+ import "./chunk-GWS3VEIW.js";
24
32
  import "./chunk-HFSBBKSQ.js";
25
- import "./chunk-E25LMLRW.js";
33
+ import "./chunk-26LEYJZH.js";
34
+ import "./chunk-WXY7KU3G.js";
26
35
  import {
27
36
  ContextDomainModule
28
- } from "./chunk-CYQKWTG3.js";
37
+ } from "./chunk-WSB3FPX7.js";
29
38
  import "./chunk-LCGCVYZ4.js";
30
39
  import "./chunk-5WIGXA4T.js";
31
- import "./chunk-6US73PDB.js";
40
+ import "./chunk-TYPGUK6W.js";
41
+ import "./chunk-NDINPTJ4.js";
42
+ import "./chunk-MVVUPGPW.js";
32
43
  import {
33
44
  DispatchDomainModule,
34
- WRITE_BOUNDARY_VIOLATION_REASON,
35
45
  capacityDrain,
36
- codeStepDir,
37
- compileFleetExecutionPlan,
38
- createWriteBoundaryEnforcer,
39
- decideReviewGate,
40
- executePlan,
41
- executionPlanAncestors,
42
- materializePendingGateDecision,
46
+ executeFleetRun,
43
47
  openLedger,
44
- preflightWriteBoundaries,
45
- runCodeStep,
46
- setCapacityDraining,
47
- stagePendingGateDecision,
48
- writeCodeStepRecord
49
- } from "./chunk-QM3F2GKX.js";
48
+ planFleetResume,
49
+ readFleetRun,
50
+ setCapacityDraining
51
+ } from "./chunk-TLQJPP24.js";
50
52
  import {
51
53
  SessionDomainModule
52
- } from "./chunk-CJUB2JJ2.js";
54
+ } from "./chunk-YS5VLNH5.js";
55
+ import "./chunk-K4XHGFR5.js";
56
+ import {
57
+ WRITE_BOUNDARY_VIOLATION_REASON,
58
+ preflightWriteBoundaries
59
+ } from "./chunk-MXKJU4JB.js";
60
+ import {
61
+ compileFleetExecutionPlan
62
+ } from "./chunk-J3YUBZWY.js";
63
+ import "./chunk-RVG5JXAL.js";
64
+ import "./chunk-W6GROXXM.js";
53
65
  import {
54
66
  FLEET_COMMANDS_REMEDY,
55
67
  FLEET_COMMANDS_REPO_PATH,
@@ -58,105 +70,95 @@ import {
58
70
  loadFleetCommands,
59
71
  loadFleetContract,
60
72
  renderFleetPrompt
61
- } from "./chunk-QKMUKYO7.js";
62
- import {
63
- RUN_RECEIPT_INTEGRITY_ALGORITHM,
64
- RUN_RECEIPT_INTEGRITY_VERSION,
65
- verifyReceiptIntegrity
66
- } from "./chunk-OH3TOQTB.js";
67
- import "./chunk-TSHXZTOQ.js";
73
+ } from "./chunk-E77JEWSD.js";
74
+ import "./chunk-DYIM5TJT.js";
75
+ import "./chunk-JVCV3ICN.js";
76
+ import "./chunk-2HEJ2F35.js";
68
77
  import "./chunk-TXOTCRLG.js";
69
78
  import "./chunk-HVDIIIQW.js";
70
- import "./chunk-NDINPTJ4.js";
71
- import "./chunk-MVVUPGPW.js";
72
- import {
73
- ResourcesDomainModule
74
- } from "./chunk-MFFY33HR.js";
75
- import "./chunk-4BPJXDWC.js";
76
- import "./chunk-2SFS6XQE.js";
77
- import "./chunk-ZWLZP4ZT.js";
78
- import "./chunk-W6GROXXM.js";
79
79
  import {
80
80
  MiddlewareDomainModule
81
- } from "./chunk-ZXF4XRKW.js";
82
- import "./chunk-IR4CFBFN.js";
81
+ } from "./chunk-7RGZWPB6.js";
82
+ import "./chunk-VCBR6CU7.js";
83
83
  import "./chunk-UOV2BYIW.js";
84
- import "./chunk-WHGPSPT5.js";
84
+ import "./chunk-ZVJ5BLO2.js";
85
+ import "./chunk-VG7TBQIY.js";
85
86
  import {
86
87
  formatBudgetPolicy,
87
88
  formatBudgetReasons,
88
89
  formatBudgetRequest,
89
90
  formatEffectiveBudget
90
- } from "./chunk-XXQNGV4M.js";
91
- import "./chunk-43AOLP7E.js";
92
- import {
93
- resultContractAuthorship
94
- } from "./chunk-EKY57CSP.js";
91
+ } from "./chunk-A3WNZD3P.js";
92
+ import "./chunk-5FR74PWO.js";
93
+ import "./chunk-P43ETTHK.js";
95
94
  import {
96
95
  agentRoleFactsResolver,
97
- gateRouteCorrelation,
98
96
  requestExecutionRole,
99
97
  withAttemptRole
100
- } from "./chunk-22NAGB7X.js";
101
- import "./chunk-AOCYTWAV.js";
102
- import "./chunk-MV3K5QF2.js";
103
- import "./chunk-CMZWFGD2.js";
104
- import "./chunk-I4HZDVNP.js";
105
- import "./chunk-FYYLNIL5.js";
106
- import "./chunk-UL3WSD3F.js";
107
- import "./chunk-VG7TBQIY.js";
98
+ } from "./chunk-H7IXIC72.js";
99
+ import "./chunk-5H3GB5BO.js";
100
+ import "./chunk-A2NJGIB3.js";
108
101
  import "./chunk-OQE5J4C6.js";
109
- import "./chunk-ECH6PKUQ.js";
110
102
  import "./chunk-GOXNB3AO.js";
111
103
  import "./chunk-HWUFFB6L.js";
104
+ import "./chunk-TTHACPOM.js";
105
+ import "./chunk-AOCYTWAV.js";
106
+ import "./chunk-MV3K5QF2.js";
107
+ import "./chunk-UL3WSD3F.js";
112
108
  import "./chunk-ODFEOB4F.js";
113
109
  import "./chunk-OZNBF4L3.js";
114
110
  import "./chunk-4BJ5BYCE.js";
111
+ import "./chunk-ECH6PKUQ.js";
112
+ import "./chunk-CMZWFGD2.js";
113
+ import "./chunk-I4HZDVNP.js";
115
114
  import "./chunk-6XLNIQDB.js";
116
115
  import "./chunk-5B2AEOW5.js";
117
116
  import "./chunk-CGKSTWHD.js";
118
117
  import "./chunk-M6L6IDJG.js";
119
- import "./chunk-XAKHZX5N.js";
120
118
  import "./chunk-UUVG37B4.js";
121
119
  import "./chunk-LBMZMYH2.js";
120
+ import "./chunk-XAKHZX5N.js";
122
121
  import "./chunk-33YXPOE3.js";
122
+ import "./chunk-7CR24IG7.js";
123
123
  import "./chunk-XPLRXC72.js";
124
- import "./chunk-RD5U66HV.js";
125
- import "./chunk-KOHPCX4K.js";
124
+ import "./chunk-GPIEI3LY.js";
125
+ import "./chunk-XWSF374K.js";
126
126
  import {
127
127
  ProvidersDomainModule
128
- } from "./chunk-DJVECN66.js";
128
+ } from "./chunk-7RFXX52T.js";
129
129
  import "./chunk-CFGTUFWB.js";
130
- import "./chunk-AD2SYQYC.js";
131
- import "./chunk-4OC57DA6.js";
132
- import "./chunk-LL4KHSZI.js";
133
- import "./chunk-4VP4KH3K.js";
130
+ import "./chunk-LU7P4LHA.js";
131
+ import "./chunk-RWSI4YD7.js";
132
+ import "./chunk-IHXBNWMM.js";
133
+ import "./chunk-B5CSFE7B.js";
134
134
  import {
135
- attributeCommitMessage
136
- } from "./chunk-VEZEGCGW.js";
135
+ readSettings
136
+ } from "./chunk-IJ7RPIYJ.js";
137
137
  import "./chunk-FQ4SKYE4.js";
138
- import "./chunk-IKCO5N3L.js";
139
- import "./chunk-3I7MS7N2.js";
140
- import "./chunk-IHXBNWMM.js";
141
- import "./chunk-GEYXPTRF.js";
142
- import "./chunk-SST6Z5JA.js";
143
- import "./chunk-FO5ZOVUY.js";
138
+ import "./chunk-ZGVHUX3M.js";
139
+ import "./chunk-TT36MB5S.js";
140
+ import "./chunk-3BINW3FP.js";
144
141
  import "./chunk-R346GLFC.js";
142
+ import "./chunk-6EJMN2Y3.js";
143
+ import "./chunk-IWHMRKLL.js";
144
+ import "./chunk-NMPKI6XL.js";
145
+ import "./chunk-4DGYLA73.js";
146
+ import "./chunk-LL4KHSZI.js";
145
147
  import "./chunk-4ZG3XFUR.js";
146
- import "./chunk-FCSXB6T2.js";
148
+ import "./chunk-IIZWH4XA.js";
149
+ import "./chunk-EQ63NRB7.js";
150
+ import "./chunk-SST6Z5JA.js";
151
+ import "./chunk-IKCO5N3L.js";
152
+ import "./chunk-3I7MS7N2.js";
147
153
  import "./chunk-APJ265NV.js";
148
- import "./chunk-YXLYO42X.js";
149
154
  import {
150
155
  clioStateDir
151
156
  } from "./chunk-BNAZZHFG.js";
152
- import "./chunk-6EJMN2Y3.js";
153
157
  import "./chunk-WEPFGWHJ.js";
154
- import "./chunk-XE2VEJHX.js";
155
- import "./chunk-ZGVHUX3M.js";
156
- import "./chunk-G7MUEIGA.js";
157
- import "./chunk-JVCV3ICN.js";
158
- import "./chunk-7CR24IG7.js";
159
- import "./chunk-IWHMRKLL.js";
158
+ import "./chunk-NUGM5KR6.js";
159
+ import "./chunk-PT7HYKEM.js";
160
+ import "./chunk-FCSXB6T2.js";
161
+ import "./chunk-YXLYO42X.js";
160
162
  import {
161
163
  init_esm_shims
162
164
  } from "./chunk-3R73A4XB.js";
@@ -166,48 +168,18 @@ init_esm_shims();
166
168
  import { randomBytes } from "node:crypto";
167
169
  import { readFileSync } from "node:fs";
168
170
  import { join } from "node:path";
169
-
170
- // src/domains/dispatch/fleet-commit-attribution.ts
171
- init_esm_shims();
172
- function deriveFleetCommitAttribution(input) {
173
- const byId = new Map(input.plan.steps.map((step) => [step.id, step]));
174
- let materiallyAuthored = false;
175
- let receipt;
176
- for (const candidate of input.step.commitFrom ?? []) {
177
- const source = byId.get(candidate);
178
- const result = input.priorResults.get(candidate);
179
- if (source?.kind !== "agent" || source.scope !== "workspace" || result?.succeeded !== true || result.integrityValid !== true) {
180
- continue;
181
- }
182
- materiallyAuthored = true;
183
- if (/^[0-9a-f]{64}$/u.test(result.receiptDigest)) {
184
- receipt = {
185
- version: RUN_RECEIPT_INTEGRITY_VERSION,
186
- algorithm: RUN_RECEIPT_INTEGRITY_ALGORITHM,
187
- digest: result.receiptDigest,
188
- integrityValid: true,
189
- directlyRelevant: true
190
- };
191
- }
192
- break;
193
- }
194
- return {
195
- materiallyAssisted: materiallyAuthored,
196
- materiallyAuthored,
197
- validationSucceeded: input.validationFresh,
198
- independentReviewPassed: input.independentReviewFresh,
199
- ...receipt === void 0 ? {} : { receipt }
200
- };
201
- }
202
-
203
- // src/cli/fleet.ts
204
171
  var HELP = `clio-coder fleet <subcommand>
205
172
 
206
173
  Repo-owned fleet contracts and the dispatch status surface.
207
174
 
208
175
  Subcommands:
209
176
  list list .clio-coder/fleets/*.md contracts with validation status
177
+ new <name> --from <builtin> copy build-review, build-test, or sdlc into this repository
178
+ validate <name> [--json] run the fleet execution preflight without side effects
179
+ graph <name> [--json] print compiled waves, loops, scopes, and write boundaries
180
+ commands init draft a commented command registry from declared project entries
210
181
  run <name> [--var k=v ...] preflight and execute a fleet contract
182
+ [--resume <runId>] replay a completed prefix from a prior run of the same plan
211
183
  [--json] emit step receipts as JSON
212
184
  status [--json] show running, retrying, and total dispatch state
213
185
  drain [--json] deny new execution starts for up to one hour
@@ -225,6 +197,11 @@ function fail(message) {
225
197
  `);
226
198
  return 2;
227
199
  }
200
+ function refuse(message) {
201
+ process.stderr.write(`clio-coder fleet: ${message}
202
+ `);
203
+ return 1;
204
+ }
228
205
  function parseVars(args) {
229
206
  const vars = {};
230
207
  const rest = [];
@@ -247,28 +224,15 @@ function parseVars(args) {
247
224
  }
248
225
  return { vars, rest };
249
226
  }
250
- function fleetGateCorrelation(subject, decider) {
251
- const facts = (receipt) => ({
252
- agentId: receipt.agentId,
253
- targetId: receipt.targetId,
254
- wireModelId: receipt.wireModelId,
255
- runtimeId: receipt.runtimeId,
256
- nodeId: receipt.node?.id ?? "local"
257
- });
258
- const { agent, target, modelFamily, runtime, node, independent } = gateRouteCorrelation(
259
- facts(subject),
260
- facts(decider)
261
- );
262
- return { agent, target, modelFamily, runtime, node, independent };
263
- }
264
- var NO_WORKER_RESERVATION = "fleet-no-worker-reservation";
265
227
  function newFleetRootId() {
266
228
  return `fleet-${randomBytes(6).toString("hex")}`;
267
229
  }
268
230
  function renderStep(step) {
269
231
  if (step.kind === "code") return `code:${step.command}[${step.scope}]`;
270
232
  if (step.kind === "agent") return `${step.agent}[${step.scope}]`;
271
- const check = step.check.kind === "code" ? `code:${step.check.command}` : step.check.agent;
233
+ if (step.kind === "gate") return `gate:${step.path}[${step.run}]`;
234
+ if (step.kind === "plan") return `plan:${step.agent}[${step.roster.join(",")}; max ${step.maxTasks}]`;
235
+ const check = step.check.kind === "code" ? `code:${step.check.command}` : step.check.kind === "gate" ? `gate:${step.check.gate}` : step.check.agent;
272
236
  return `loop:${step.id}(${check} -> ${step.repair.agent} x${step.maxAttempts})`;
273
237
  }
274
238
  function listingLine(entry, state, detail) {
@@ -309,7 +273,11 @@ function contractAgents(contract) {
309
273
  const agents = [];
310
274
  for (const step of contract.steps) {
311
275
  if (step.kind === "agent") agents.push({ id: step.id, agent: step.agent, scope: step.scope });
312
- else if (step.kind === "loop") {
276
+ else if (step.kind === "gate") agents.push({ id: step.id, agent: step.agent, scope: "workspace" });
277
+ else if (step.kind === "plan") {
278
+ agents.push({ id: step.id, agent: step.agent, scope: step.scope });
279
+ for (const agent of step.roster) agents.push({ id: `${step.id}.roster`, agent, scope: "readonly" });
280
+ } else if (step.kind === "loop") {
313
281
  if (step.check.kind === "agent") {
314
282
  agents.push({ id: `${step.id}.check`, agent: step.check.agent, scope: step.check.scope });
315
283
  }
@@ -319,6 +287,28 @@ function contractAgents(contract) {
319
287
  return agents;
320
288
  }
321
289
  function preflightFleet(contract, deps) {
290
+ const targets = new Set(deps.settings.targets.map((target) => target.id));
291
+ const profiles = new Set(Object.keys(deps.settings.workers?.profiles ?? {}));
292
+ const checkRoute = (id, route) => {
293
+ if (route.target !== void 0 && !targets.has(route.target))
294
+ return `unknown target '${route.target}' at step '${id}'`;
295
+ if (route.profile !== void 0 && !profiles.has(route.profile))
296
+ return `unknown profile '${route.profile}' at step '${id}'`;
297
+ return null;
298
+ };
299
+ for (const step of contract.steps) {
300
+ if (step.kind === "agent" || step.kind === "gate" || step.kind === "plan") {
301
+ const error2 = checkRoute(step.id, step);
302
+ if (error2 !== null) return error2;
303
+ }
304
+ if (step.kind !== "loop") continue;
305
+ if (step.check.kind === "agent") {
306
+ const error2 = checkRoute(`${step.id}.check`, step.check);
307
+ if (error2 !== null) return error2;
308
+ }
309
+ const error = checkRoute(`${step.id}.repair`, step.repair);
310
+ if (error !== null) return error;
311
+ }
322
312
  for (const step of contractAgents(contract)) {
323
313
  if (!deps.agents.get(step.agent)) {
324
314
  return `unknown agent '${step.agent}' (step '${step.id}' must name a recipe from 'clio-coder agents')`;
@@ -346,8 +336,12 @@ async function runFleet(args) {
346
336
  const { vars, rest, error } = parseVars(args);
347
337
  if (error !== void 0) return fail(error);
348
338
  const json = rest.includes("--json");
339
+ const resumeIndex = rest.indexOf("--resume");
340
+ const resumeId = resumeIndex === -1 ? void 0 : rest[resumeIndex + 1];
341
+ if (resumeIndex !== -1 && (resumeId === void 0 || resumeId.startsWith("-")))
342
+ return fail("--resume requires a run id");
349
343
  const name = rest.find((arg) => !arg.startsWith("-"));
350
- if (!name) return fail("usage: clio-coder fleet run <name> [--var key=value ...] [--json]");
344
+ if (!name) return fail("usage: clio-coder fleet run <name> [--var key=value ...] [--resume <runId>] [--json]");
351
345
  let contract;
352
346
  let prompt;
353
347
  let commands;
@@ -390,13 +384,17 @@ async function runFleet(args) {
390
384
  return fail("required domains unavailable (dispatch/agents/safety)");
391
385
  }
392
386
  const roleFacts = agentRoleFactsResolver((id) => agents.getSpec(id));
393
- const preflightError = preflightFleet(contract, { agents, safety, scheduling });
387
+ const preflightError = preflightFleet(contract, {
388
+ agents,
389
+ safety,
390
+ scheduling,
391
+ settings: config?.get() ?? readSettings()
392
+ });
394
393
  if (preflightError !== null) {
395
394
  await loaded.stop();
396
395
  return fail(`preflight failed: ${preflightError}`);
397
396
  }
398
397
  const fleetRootId = newFleetRootId();
399
- let planOutcome;
400
398
  let plan;
401
399
  try {
402
400
  plan = compileFleetExecutionPlan({
@@ -415,9 +413,7 @@ async function runFleet(args) {
415
413
  return {
416
414
  requestedAuthority: spec.capabilityClass,
417
415
  approvedAuthority: spec.capabilityClass,
418
- // A gate decider answers the coordinator's question, so its
419
- // postcondition is the gate result contract, not its recipe's.
420
- expectedResultContract: context.gateRole === "reviewer" ? "verifier-report" : spec.resultContract.kind,
416
+ expectedResultContract: context.planRole === true ? "delegation-plan" : context.gateAuthorRole === true ? "artifact-report" : context.gateRole === "reviewer" ? "verifier-report" : spec.resultContract.kind,
421
417
  executionRole: withAttemptRole(requestRole, context.attempt)
422
418
  };
423
419
  }
@@ -432,233 +428,96 @@ async function runFleet(args) {
432
428
  await loaded.stop();
433
429
  return fail(`preflight failed: ${err instanceof Error ? err.message : String(err)}`);
434
430
  }
435
- const boundaryByStep = new Map(plan.steps.map((step) => [step.id, step.writes]));
436
- const boundaryEnforcer = createWriteBoundaryEnforcer({
437
- root: process.cwd(),
438
- rootId: fleetRootId,
439
- boundaryFor: (stepId) => boundaryByStep.get(stepId),
440
- onVerdict(verdict, path) {
441
- if (verdict.reason === null) return;
442
- process.stderr.write(`write boundary ${verdict.window}: ${verdict.detail ?? verdict.reason} record=${path}
431
+ let resume;
432
+ if (resumeId !== void 0) {
433
+ const record = readFleetRun(resumeId);
434
+ if (record === null) {
435
+ await loaded.stop();
436
+ return refuse(`resume run '${resumeId}' was not found in the durable fleet ledger`);
437
+ }
438
+ const planned = planFleetResume(record, plan, contract, vars);
439
+ if (!planned.ok) {
440
+ if (planned.reason === "fleet-name") {
441
+ await loaded.stop();
442
+ return refuse(`resume run '${resumeId}' belongs to fleet '${planned.priorFleet}', not '${planned.currentFleet}'`);
443
+ }
444
+ if (planned.reason === "vars") {
445
+ await loaded.stop();
446
+ return refuse(`resume run '${resumeId}' used different --var values`);
447
+ }
448
+ process.stderr.write(
449
+ `clio-coder fleet: resume plan hash differs: prior=${planned.priorHash} current=${planned.currentHash}
450
+ `
451
+ );
452
+ for (const entry of planned.diff) {
453
+ process.stderr.write(` step ${entry.index + 1}: ${entry.priorId} -> ${entry.currentId}
443
454
  `);
455
+ process.stderr.write(` prior: ${JSON.stringify(entry.prior)}
456
+ `);
457
+ process.stderr.write(` current: ${JSON.stringify(entry.current)}
458
+ `);
459
+ }
460
+ await loaded.stop();
461
+ return 1;
444
462
  }
445
- });
463
+ resume = { record, replayed: planned.replayed };
464
+ }
446
465
  process.stderr.write(
447
466
  `fleet ${contract.name}: root=${fleetRootId} plan=${plan.hash} steps=${plan.steps.length} loops=${plan.loops.length}
448
467
  `
449
468
  );
450
- const receipts = [];
451
- const receiptsByStep = /* @__PURE__ */ new Map();
452
- const planStep = (stepId) => plan.steps.find((entry) => entry.id === stepId);
453
- const attributionEnabled = config?.get().attribution.gitCommits ?? true;
454
- let validationFresh = false;
455
- let independentReviewFresh = false;
456
- const commitMessageFor = (step, priorResults) => {
457
- for (const candidate of step.commitFrom ?? []) {
458
- const source = planStep(candidate);
459
- const result = priorResults.get(candidate);
460
- if (source === void 0 || source.kind !== "agent" || result === void 0) continue;
461
- const resultContract = agents.getSpec(source.agentId)?.resultContract ?? null;
462
- if (resultContract === null) continue;
463
- const authored = resultContractAuthorship(resultContract, result.output);
464
- if (authored.commitMessage !== null) return authored.commitMessage;
465
- if (authored.summary !== null) return `clio(${fleetRootId}): ${authored.summary}`;
466
- }
467
- return `clio(${fleetRootId}): ${contract.name} ${step.id}`;
468
- };
469
+ let outcome;
469
470
  try {
470
- planOutcome = await executePlan(plan, {
471
- preflight(step) {
472
- const request = {
473
- agentId: step.agentId,
474
- executionRole: step.executionRole,
475
- task: step.task,
476
- requestOrigin: "user",
477
- lineage: { parentRunId: fleetRootId, rootRunId: fleetRootId, attempt: 0, depth: 1 },
478
- ...step.scope === "readonly" ? { autonomy: "read-only" } : {}
479
- };
480
- const resolution = dispatch.preview?.(request);
481
- if (!resolution) throw new Error(`fleet preflight cannot resolve step '${step.id}'`);
482
- return { step, costUpperBoundUsd: resolution.costUpperBoundUsd, nodeId: resolution.node.id };
483
- },
484
- reserve(_plan, admissions) {
485
- if (admissions.length === 0) return { ownerId: NO_WORKER_RESERVATION };
486
- const reservation = dispatch.reservations?.prepare({
487
- topology: "parallel",
488
- tasks: admissions.map((admission) => ({
489
- memberId: admission.step.id,
490
- wave: plan.waves.findIndex((wave) => wave.includes(admission.step.id)),
491
- resolution: dispatch.preview?.({
492
- agentId: admission.step.agentId,
493
- executionRole: admission.step.executionRole,
494
- task: admission.step.task
495
- })
496
- }))
497
- });
498
- if (!reservation) throw new Error("fleet whole-plan reservation is unavailable");
499
- return { ownerId: reservation.ownerId };
500
- },
501
- async run(step, handoffs, reservation, ledger) {
502
- const attempt = step.loop?.role === "repair" ? step.loop.attempt : 0;
503
- const request = {
504
- agentId: step.agentId,
505
- executionRole: step.executionRole,
506
- task: step.task,
507
- predecessorHandoffs: handoffs,
508
- requestOrigin: "user",
509
- lineage: { parentRunId: fleetRootId, rootRunId: fleetRootId, attempt, depth: 1 },
510
- reservation,
511
- ...ledger !== void 0 ? { ledger } : {},
512
- ...step.loop?.role === "check" ? {
513
- gate: {
514
- role: "reviewer",
515
- group: `${fleetRootId}:${step.loop.loopId}`,
516
- cycle: step.loop.attempt,
517
- subjects: handoffs.map((handoff) => ({
518
- runId: handoff.terminalRunId,
519
- digest: handoff.receiptDigest
520
- }))
521
- }
522
- } : {},
523
- ...step.scope === "readonly" ? { autonomy: "read-only" } : {}
524
- };
525
- const handle = await dispatch.dispatch(request);
526
- void (async () => {
527
- for await (const _event of handle.events) {
528
- }
529
- })().catch(() => {
530
- });
531
- return {
532
- assignmentId: handle.runId,
533
- result: handle.finalPromise.then((receipt) => {
534
- if (step.scope === "workspace") {
535
- validationFresh = false;
536
- independentReviewFresh = false;
537
- }
538
- receipts.push(receipt);
539
- receiptsByStep.set(step.id, receipt);
540
- const envelope = dispatch.getRun(receipt.runId);
541
- const integrityValid = envelope !== null && verifyReceiptIntegrity(receipt, envelope).ok;
542
- const succeeded = receipt.exitCode === 0 && (receipt.outcome === void 0 || receipt.outcome === "succeeded");
543
- if (json) process.stdout.write(`${JSON.stringify(receipt)}
544
- `);
545
- else
546
- process.stdout.write(
547
- `step ${step.id} ${step.agentId}: ${succeeded ? "succeeded" : "failed"} assignment=${handle.runId} terminal-run=${receipt.runId} cost=$${receipt.costUsd.toFixed(4)}
471
+ outcome = await executeFleetRun({
472
+ plan,
473
+ contractName: contract.name,
474
+ commands,
475
+ workspaceRoot: process.cwd(),
476
+ fleetRootId,
477
+ dispatch,
478
+ agents: { getSpec: (agentId) => agents.getSpec(agentId) },
479
+ attributionEnabled: config?.get().attribution.gitCommits ?? true,
480
+ vars,
481
+ ...resume !== void 0 ? { resume } : {},
482
+ onStepSettled(step) {
483
+ if (step.replayed === true && step.result !== void 0) {
484
+ if (json)
485
+ process.stdout.write(
486
+ `${JSON.stringify({ stepId: step.stepId, status: "replayed", receipt: { runId: step.result.terminalRunId, digest: step.result.receiptDigest } })}
548
487
  `
549
- );
550
- return {
551
- stepId: step.id,
552
- assignmentId: handle.runId,
553
- terminalRunId: receipt.runId,
554
- receiptDigest: receipt.integrity.digest,
555
- output: receipt.output?.state === "final" ? receipt.output.text : "",
556
- succeeded,
557
- integrityValid
558
- };
559
- })
560
- };
561
- },
562
- async runCode(step, _handoffs, signal, priorResults) {
563
- const command = commands?.commands.get(step.commandId);
564
- if (command === void 0) throw new Error(`fleet code step '${step.id}' has no registered command`);
565
- const isCommit = step.commitFrom !== void 0;
566
- const evidence = isCommit ? deriveFleetCommitAttribution({
567
- plan,
568
- step,
569
- priorResults,
570
- validationFresh,
571
- independentReviewFresh
572
- }) : null;
573
- if (!isCommit && step.scope === "workspace" && step.verification !== true) {
574
- validationFresh = false;
575
- independentReviewFresh = false;
488
+ );
489
+ else
490
+ process.stdout.write(
491
+ `step ${step.stepId}: replayed terminal-run=${step.result.terminalRunId} receipt=${step.result.receiptDigest}
492
+ `
493
+ );
494
+ return;
576
495
  }
577
- const originalMessage = isCommit ? commitMessageFor(step, priorResults) : null;
578
- const outcome = await runCodeStep({
579
- stepId: step.id,
580
- command,
581
- workspaceRoot: process.cwd(),
582
- artifactDir: codeStepDir(fleetRootId),
583
- signal,
584
- ...isCommit && evidence !== null && originalMessage !== null ? {
585
- substitutions: {
586
- commitMessage: attributeCommitMessage(originalMessage, evidence, attributionEnabled)
587
- },
588
- requireWorkspaceChanges: true,
589
- commitAttribution: { enabled: attributionEnabled, evidence }
590
- } : {}
591
- });
592
- if (step.verification === true) validationFresh = outcome.report.passed;
593
- const recordPath = await writeCodeStepRecord(fleetRootId, outcome.record);
594
- if (json) process.stdout.write(`${JSON.stringify({ codeStep: outcome.record })}
496
+ if (step.receipt !== void 0) {
497
+ if (json) process.stdout.write(`${JSON.stringify(step.receipt)}
595
498
  `);
596
- else
597
- process.stdout.write(
598
- `step ${step.id} code:${command.id}: ${outcome.report.passed ? "passed" : "failed"} exit=${outcome.report.exitCode} ${outcome.record.durationMs}ms record=${recordPath}
499
+ else
500
+ process.stdout.write(
501
+ `step ${step.stepId} ${step.agentId}: ${step.succeeded ? "succeeded" : "failed"}${step.failureReason !== void 0 ? ` reason=${step.failureReason}` : ""} assignment=${step.assignmentId} terminal-run=${step.terminalRunId} cost=$${step.costUsd.toFixed(4)}
599
502
  `
600
- );
601
- return {
602
- stepId: step.id,
603
- assignmentId: outcome.record.runId,
604
- terminalRunId: outcome.record.runId,
605
- receiptDigest: outcome.record.reportDigest,
606
- output: outcome.output,
607
- succeeded: outcome.report.passed,
608
- // The runner authored this report itself, so its provenance is
609
- // valid by construction; only the command's verdict can be red.
610
- integrityValid: true
611
- };
612
- },
613
- async decideLoop({ loop, step, attempt, terminalAttempt, result }) {
614
- const decider = receiptsByStep.get(step.id);
615
- const ancestors = executionPlanAncestors(plan, step.id);
616
- let subject;
617
- for (const [stepId, receipt] of receiptsByStep) {
618
- if (ancestors.has(stepId)) subject = receipt;
503
+ );
504
+ return;
619
505
  }
620
- if (decider === void 0 || subject === void 0) {
621
- return {
622
- resolved: false,
623
- findings: null,
624
- needsDecision: `loop '${loop.id}' cycle ${attempt} has no sealed reviewer or subject receipt`
625
- };
626
- }
627
- const correlation = fleetGateCorrelation(subject, decider);
628
- const decided = decideReviewGate({
629
- group: `${fleetRootId}:${loop.id}`,
630
- cycle: attempt,
631
- terminalCycle: terminalAttempt,
632
- subjects: [{ runId: subject.runId, digest: subject.integrity.digest }],
633
- decider: { runId: decider.runId, digest: decider.integrity.digest },
634
- correlation,
635
- output: result.output
636
- });
637
- independentReviewFresh = decided.verdict === "pass" && correlation.independent;
638
- const staged = stagePendingGateDecision(decided.draft);
639
- const { path: decisionPath } = materializePendingGateDecision(staged);
640
- if (!json) {
641
- process.stdout.write(
642
- `loop ${loop.id} cycle ${attempt}: ${decided.draft.outcome}${decided.draft.detail === void 0 ? "" : ` (${decided.draft.detail})`} decision=${decisionPath}
506
+ if (step.codeStep !== void 0) {
507
+ if (json) process.stdout.write(`${JSON.stringify({ codeStep: step.codeStep })}
508
+ `);
509
+ else
510
+ process.stdout.write(
511
+ `step ${step.stepId} code:${step.commandId}: ${step.succeeded ? "passed" : "failed"} exit=${step.codeStep.exitCode} ${step.codeStep.durationMs}ms record=${step.recordPath}
643
512
  `
644
- );
513
+ );
645
514
  }
646
- return {
647
- resolved: decided.verdict === "pass",
648
- findings: decided.findings,
649
- needsDecision: decided.needsDecision
650
- };
651
515
  },
652
- beginWriteBoundary: (window, stepIds) => boundaryEnforcer.begin(window, stepIds),
653
- verifyWriteBoundary: (window, stepIds) => boundaryEnforcer.verify(window, stepIds),
654
- cancel: (assignmentId) => dispatch.abort(assignmentId),
655
- release: (ownerId) => {
656
- if (ownerId === NO_WORKER_RESERVATION) return;
657
- dispatch.reservations?.rollbackUnconsumed(ownerId);
658
- },
659
- releaseUnconsumed: (ownerId) => {
660
- if (ownerId === NO_WORKER_RESERVATION) return;
661
- dispatch.reservations?.rollbackUnconsumed(ownerId);
516
+ onNotice(text, kind) {
517
+ if (kind === "write-boundary") process.stderr.write(`${text}
518
+ `);
519
+ else if (kind === "gate" && !json) process.stdout.write(`${text}
520
+ `);
662
521
  }
663
522
  });
664
523
  } catch (err) {
@@ -668,53 +527,45 @@ async function runFleet(args) {
668
527
  }
669
528
  await dispatch.drain();
670
529
  await loaded.stop();
671
- const required = plan.steps.filter((step) => step.loop === void 0 && !planOutcome.unneeded.includes(step.id));
672
- const failedLoops = planOutcome.loops.filter((loop) => !loop.resolved);
673
- const succeededSteps = required.filter((step) => planOutcome.results.get(step.id)?.succeeded === true).length;
674
- const resolvedLoops = planOutcome.loops.length - failedLoops.length;
675
530
  if (json) {
676
531
  process.stdout.write(
677
532
  `${JSON.stringify({
678
533
  fleet: contract.name,
679
534
  rootId: fleetRootId,
680
535
  planHash: plan.hash,
681
- loops: planOutcome.loops,
682
- revalidated: planOutcome.revalidated,
683
- unneeded: planOutcome.unneeded,
684
- skipped: planOutcome.skipped,
685
- needsDecision: planOutcome.needsDecision,
686
- writeBoundaries: planOutcome.writeBoundaries
536
+ loops: outcome.result.loops,
537
+ revalidated: outcome.result.revalidated,
538
+ unneeded: outcome.result.unneeded,
539
+ skipped: outcome.result.skipped,
540
+ needsDecision: outcome.result.needsDecision,
541
+ writeBoundaries: outcome.result.writeBoundaries
687
542
  })}
688
543
  `
689
544
  );
690
545
  } else {
691
- const spentUsd = receipts.reduce((sum, receipt) => sum + receipt.costUsd, 0);
692
546
  process.stdout.write(
693
- `fleet ${contract.name}: ${succeededSteps}/${required.length} steps succeeded, ${resolvedLoops}/${planOutcome.loops.length} loops resolved, total cost $${spentUsd.toFixed(4)}
547
+ `fleet ${contract.name}: ${outcome.succeededStepCount}/${outcome.requiredStepCount} steps succeeded, ${outcome.resolvedLoopCount}/${outcome.result.loops.length} loops resolved, total cost $${outcome.totalCostUsd.toFixed(4)}
694
548
  `
695
549
  );
696
- for (const loop of planOutcome.loops) {
550
+ for (const loop of outcome.result.loops)
697
551
  process.stdout.write(
698
552
  ` loop ${loop.loopId}: ${loop.reason} after ${loop.attempts} verification(s) and ${loop.repairs} repair(s)
699
553
  `
700
554
  );
701
- }
702
- if (planOutcome.revalidated.length > 0) {
555
+ if (outcome.result.revalidated.length > 0)
703
556
  process.stdout.write(
704
- ` staleness: re-ran ${planOutcome.revalidated.join(", ")} because a workspace step landed after the last green
557
+ ` staleness: re-ran ${outcome.result.revalidated.join(", ")} because a workspace step landed after the last green
705
558
  `
706
559
  );
707
- }
708
- for (const message of planOutcome.needsDecision) process.stdout.write(` needs operator decision: ${message}
560
+ for (const message of outcome.result.needsDecision) process.stdout.write(` needs operator decision: ${message}
709
561
  `);
710
- for (const boundary of planOutcome.writeBoundaries) {
562
+ for (const boundary of outcome.result.writeBoundaries) {
711
563
  if (!boundary.violated) continue;
712
564
  process.stdout.write(` write boundary ${boundary.window}: ${boundary.detail ?? WRITE_BOUNDARY_VIOLATION_REASON}
713
565
  `);
714
566
  }
715
567
  }
716
- const cleanRun = failedLoops.length === 0 && planOutcome.skipped.length === 0 && required.every((step) => planOutcome.results.get(step.id)?.succeeded === true);
717
- return cleanRun ? 0 : 1;
568
+ return outcome.cleanRun ? 0 : 1;
718
569
  }
719
570
  function isProcessAlive(pid) {
720
571
  if (pid === null || !Number.isFinite(pid) || pid <= 0) return false;
@@ -884,6 +735,14 @@ async function runFleetCommand(args) {
884
735
  switch (sub) {
885
736
  case "list":
886
737
  return runList(args.slice(1));
738
+ case "new":
739
+ return (await import("./fleet-new-RDVJLHHH.js")).runFleetNew(args.slice(1));
740
+ case "validate":
741
+ return (await import("./fleet-validate-72PC4SLA.js")).runFleetValidate(args.slice(1));
742
+ case "graph":
743
+ return (await import("./fleet-graph-6ULH7PES.js")).runFleetGraph(args.slice(1));
744
+ case "commands":
745
+ return (await import("./fleet-commands-UVHWM76J.js")).runFleetCommands(args.slice(1));
887
746
  case "run":
888
747
  return runFleet(args.slice(1));
889
748
  case "status":
@@ -903,4 +762,4 @@ export {
903
762
  runFleetCommand,
904
763
  statusSnapshot
905
764
  };
906
- //# sourceMappingURL=fleet-S5R4ZOQY.js.map
765
+ //# sourceMappingURL=fleet-7WZEWRFA.js.map