@iowarp/clio-coder 0.3.6 → 0.3.7

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 (258) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +16 -5
  3. package/dist/{acp-2BEHC4DL.js → acp-SK4MD6MM.js} +10 -10
  4. package/dist/{agents-LNNFTM53.js → agents-2FN2K6ME.js} +30 -25
  5. package/dist/assets/codewiki.json +1 -1
  6. package/dist/{auth-KXXFI2VS.js → auth-QIYZWM5I.js} +13 -13
  7. package/dist/{chunk-KHSFENX2.js → chunk-3HAPLH5M.js} +10 -10
  8. package/dist/{chunk-24I7BN55.js → chunk-465YSENW.js} +2 -2
  9. package/dist/{chunk-4OC57DA6.js → chunk-4DGYLA73.js} +53 -2
  10. package/dist/{chunk-CYQKWTG3.js → chunk-4DWFMQDR.js} +4 -4
  11. package/dist/{chunk-E2ER4LJF.js → chunk-5C3AQNDW.js} +25 -1
  12. package/dist/{chunk-22NAGB7X.js → chunk-5C77SEEY.js} +5 -94
  13. package/dist/{chunk-43AOLP7E.js → chunk-5FR74PWO.js} +2 -1
  14. package/dist/{chunk-K7T3E2SR.js → chunk-5UJ6ECTS.js} +10 -9
  15. package/dist/{chunk-6US73PDB.js → chunk-6M7VS3J3.js} +5 -5
  16. package/dist/{chunk-CJUB2JJ2.js → chunk-6TUKSZVF.js} +5 -5
  17. package/dist/{chunk-5JGRAMKL.js → chunk-AB4XIIVB.js} +8 -6
  18. package/dist/{chunk-R46L2BIR.js → chunk-BMWK7ZIZ.js} +14 -20
  19. package/dist/{chunk-4BPJXDWC.js → chunk-C4JBQ5SR.js} +30 -14
  20. package/dist/{chunk-XXQNGV4M.js → chunk-CEYBNUGC.js} +243 -63
  21. package/dist/{chunk-VEZEGCGW.js → chunk-D4MDIG46.js} +20 -18
  22. package/dist/chunk-DJNLUABN.js +843 -0
  23. package/dist/{chunk-RY3LY4J5.js → chunk-DMD2AGVS.js} +5 -4
  24. package/dist/{chunk-KOHPCX4K.js → chunk-DOOEX22V.js} +2 -2
  25. package/dist/chunk-DQA7QLMD.js +123 -0
  26. package/dist/chunk-DR52UMZW.js +21 -0
  27. package/dist/{chunk-XF5N4U5A.js → chunk-EBEFWSGL.js} +6 -5
  28. package/dist/{chunk-EYPA3EGJ.js → chunk-EELBMBT6.js} +120 -13
  29. package/dist/{chunk-CKXWIANG.js → chunk-EOOQZZDE.js} +16 -14
  30. package/dist/{chunk-WR67VIZY.js → chunk-FOT2FX5J.js} +63 -5
  31. package/dist/{chunk-FYYLNIL5.js → chunk-GH5622CP.js} +2 -2
  32. package/dist/chunk-GWS3VEIW.js +195 -0
  33. package/dist/{chunk-LYF7OHWH.js → chunk-J7PIKKWC.js} +8 -463
  34. package/dist/{chunk-NILBFAPG.js → chunk-JNXPYBB4.js} +2 -2
  35. package/dist/{chunk-4VP4KH3K.js → chunk-JRIO5UD2.js} +4 -4
  36. package/dist/{chunk-6XXKFVSN.js → chunk-JTSEDYVQ.js} +7 -7
  37. package/dist/{chunk-QKMUKYO7.js → chunk-KCMKRQX4.js} +236 -84
  38. package/dist/chunk-KZ2H5X4G.js +1026 -0
  39. package/dist/{chunk-QNQHSOLF.js → chunk-LADCF22A.js} +12 -12
  40. package/dist/chunk-M4AKACEO.js +382 -0
  41. package/dist/{chunk-XYDYPRZI.js → chunk-MXI6J5JF.js} +7 -7
  42. package/dist/{chunk-G7MUEIGA.js → chunk-OB5HIGJY.js} +1 -1
  43. package/dist/{chunk-EKY57CSP.js → chunk-OBMAI2DP.js} +61 -767
  44. package/dist/chunk-PD3MESLB.js +242 -0
  45. package/dist/{chunk-ZRGEBJ4T.js → chunk-QCTRSGHQ.js} +21 -21
  46. package/dist/chunk-RVG5JXAL.js +41 -0
  47. package/dist/{chunk-RD5U66HV.js → chunk-SROCI7ZU.js} +7 -7
  48. package/dist/{chunk-MFFY33HR.js → chunk-THKY7CD7.js} +466 -205
  49. package/dist/{chunk-PCZJO5TI.js → chunk-UFQ3F4FW.js} +13 -178
  50. package/dist/{chunk-AD2SYQYC.js → chunk-UHXRNZ2J.js} +121 -3
  51. package/dist/chunk-UND3GU2L.js +103 -0
  52. package/dist/{chunk-QM3F2GKX.js → chunk-UUANF5CR.js} +2247 -2096
  53. package/dist/chunk-UVDSQ6LW.js +472 -0
  54. package/dist/{chunk-DJVECN66.js → chunk-VQNODYQ4.js} +14 -14
  55. package/dist/{chunk-3BPUFZDL.js → chunk-VREKEFLL.js} +3 -3
  56. package/dist/{chunk-PBTHKCPN.js → chunk-WJHBC77E.js} +6 -6
  57. package/dist/{chunk-XE2VEJHX.js → chunk-X2KV5FXT.js} +2 -2
  58. package/dist/{chunk-ZXF4XRKW.js → chunk-XEGB6BCN.js} +157 -7
  59. package/dist/{chunk-E25LMLRW.js → chunk-YD734TPH.js} +2 -2
  60. package/dist/{verifiers-NCBTHHN2.js → chunk-YTYFXUI3.js} +65 -322
  61. package/dist/{chunk-OH3TOQTB.js → chunk-ZGH7FGS5.js} +13 -7
  62. package/dist/cli/index.js +32 -30
  63. package/dist/{clio-M2KGYUFZ.js → clio-WBVQEBKO.js} +7 -7
  64. package/dist/{code-nav-GQNL7XA6.js → code-nav-FGGFIE7L.js} +3 -3
  65. package/dist/{components-5TTYYX6G.js → components-F7OEATSO.js} +4 -4
  66. package/dist/{config-XUUYQIWO.js → config-TRBL3RCF.js} +34 -29
  67. package/dist/{configure-IHJ7YOMV.js → configure-OLCVPHNM.js} +15 -15
  68. package/dist/{context-74JLXAWD.js → context-MJIJ6GOX.js} +11 -11
  69. package/dist/{context-ZQ7SIFJV.js → context-WFPKQSM6.js} +19 -3
  70. package/dist/{context-75MIWW3U.js → context-XEWE3MOJ.js} +31 -26
  71. package/dist/{context-clear-GYKWNUML.js → context-clear-KNOS2JPB.js} +31 -26
  72. package/dist/{context-working-set-UX5KEP4J.js → context-working-set-EUXAZI6N.js} +8 -8
  73. package/dist/{dispatch-runner-GIJBHNFL.js → dispatch-runner-B7MTOVKL.js} +313 -53
  74. package/dist/{docs-6FZSCG5B.js → docs-FLJTIDSE.js} +4 -4
  75. package/dist/{doctor-SVJ5BZCW.js → doctor-RN4YKO2X.js} +14 -14
  76. package/dist/{eval-CG6LLBLD.js → eval-RUBJVSNQ.js} +8 -7
  77. package/dist/{evidence-ZYFIEN42.js → evidence-JZNBUOQZ.js} +30 -25
  78. package/dist/{evolve-QGEXEMDW.js → evolve-FJVC4KKI.js} +30 -25
  79. package/dist/{extensions-ADGNCJJD.js → extensions-IQL36S7K.js} +4 -4
  80. package/dist/{fleet-S5R4ZOQY.js → fleet-BDKYJFCP.js} +214 -360
  81. package/dist/fleet-commands-ZFIWZSB3.js +70 -0
  82. package/dist/fleet-graph-Y6HPXIVF.js +125 -0
  83. package/dist/fleet-new-RDVJLHHH.js +48 -0
  84. package/dist/fleet-validate-BIYREGIK.js +79 -0
  85. package/dist/{init-5DRU55YR.js → init-LQUB5COQ.js} +44 -37
  86. package/dist/library-NJAHIGG4.js +217 -0
  87. package/dist/{memory-7YKKR6UC.js → memory-OG6HOYKM.js} +31 -26
  88. package/dist/{models-ZPOLRU2C.js → models-5ZG5XY7J.js} +21 -20
  89. package/dist/{monitor-US5F5YGZ.js → monitor-TJ7AMTGB.js} +49 -30
  90. package/dist/{orchestrator-E2AL4T5N.js → orchestrator-WZYB54DM.js} +3827 -581
  91. package/dist/{paths-E7KYAQWE.js → paths-XUC7GS6E.js} +4 -4
  92. package/dist/{reset-KZ652EK6.js → reset-PXQT45IY.js} +7 -7
  93. package/dist/{run-SRNBKDWD.js → run-FQ74YF62.js} +53 -45
  94. package/dist/{share-CGZE33UP.js → share-FW7SVCL3.js} +33 -9
  95. package/dist/{skills-S2X4DLY5.js → skills-7E7IRB3R.js} +24 -8
  96. package/dist/{skills-eval-W2GGIC4R.js → skills-eval-LI75W6OK.js} +34 -27
  97. package/dist/{targets-54SWINWB.js → targets-4CIFKCTW.js} +23 -22
  98. package/dist/{terminal-lease-SAIF2OGY.js → terminal-lease-WUZY7ZV5.js} +4 -4
  99. package/dist/{uninstall-BVLWXKBT.js → uninstall-7FV7IP4E.js} +4 -4
  100. package/dist/{upgrade-JKAR27XC.js → upgrade-K2HVIVMQ.js} +20 -19
  101. package/dist/{usage-MSAWCLX4.js → usage-GTZELZQX.js} +116 -49
  102. package/dist/verifiers-RLAHT27O.js +336 -0
  103. package/dist/{verify-X5HDROLA.js → verify-BX3BRKH5.js} +7 -6
  104. package/dist/{wiki-generate-GUSOQ6ZP.js → wiki-generate-ASIFASCN.js} +45 -37
  105. package/dist/worker/entry.js +38 -35
  106. package/docs/README.md +3 -2
  107. package/docs/acp.md +1 -1
  108. package/docs/alcf-provider.md +1 -1
  109. package/docs/architecture.md +2 -2
  110. package/docs/artifact-versions.md +10 -6
  111. package/docs/built-in-agents.md +26 -2
  112. package/docs/capacity-and-scheduling.md +1 -1
  113. package/docs/commands-and-modes.md +82 -2
  114. package/docs/configuration-and-targets.md +79 -2
  115. package/docs/context-engine.md +1 -1
  116. package/docs/development-pipeline.md +1 -1
  117. package/docs/dispatch-architecture-rationale.md +1 -1
  118. package/docs/documentation-coverage.md +3 -3
  119. package/docs/documentation-guide.md +3 -3
  120. package/docs/eval-runner.md +1 -1
  121. package/docs/evals-internal.md +1 -1
  122. package/docs/evidence-and-memory.md +5 -5
  123. package/docs/evolution.md +1 -1
  124. package/docs/exit-codes-and-output.md +4 -1
  125. package/docs/extensions-and-sharing.md +6 -2
  126. package/docs/fleet-demo-runbook.md +2 -2
  127. package/docs/fleet-dispatch.md +197 -10
  128. package/docs/git-commit-provenance.md +2 -2
  129. package/docs/glossary.md +1 -1
  130. package/docs/installation-and-lifecycle.md +2 -2
  131. package/docs/middleware-and-components.md +2 -1
  132. package/docs/model-catalog.md +1 -1
  133. package/docs/observability.md +55 -8
  134. package/docs/proactive-memory.md +1 -1
  135. package/docs/prompt-envelope-and-tools.md +1 -1
  136. package/docs/provider-adapter-cookbook.md +1 -1
  137. package/docs/release-cut-checklist.md +79 -64
  138. package/docs/resource-library.md +59 -0
  139. package/docs/safety-model.md +2 -2
  140. package/docs/scientific-validation.md +3 -3
  141. package/docs/session-lifecycle.md +37 -1
  142. package/docs/skills-marketplace.md +16 -3
  143. package/docs/tool-usage.md +14 -7
  144. package/docs/trace-store.md +1 -1
  145. package/docs/troubleshooting.md +1 -1
  146. package/docs/tui-design.md +1 -1
  147. package/docs/worker-dispatch-mechanics.md +3 -3
  148. package/package.json +1 -1
  149. package/src/cli/fleet-commands.ts +37 -0
  150. package/src/cli/fleet-graph.ts +102 -0
  151. package/src/cli/fleet-new.ts +36 -0
  152. package/src/cli/fleet-preflight.ts +121 -0
  153. package/src/cli/fleet-validate.ts +30 -0
  154. package/src/cli/fleet.ts +173 -335
  155. package/src/cli/index.ts +3 -1
  156. package/src/cli/library.ts +190 -0
  157. package/src/cli/share.ts +13 -1
  158. package/src/cli/usage.ts +111 -19
  159. package/src/core/bus-events.ts +4 -0
  160. package/src/core/commit-attribution.ts +4 -4
  161. package/src/core/config.ts +130 -0
  162. package/src/core/defaults.ts +81 -0
  163. package/src/domains/agents/builtins/architect.md +1 -0
  164. package/src/domains/agents/builtins/oracle.md +33 -0
  165. package/src/domains/agents/catalog.ts +13 -1
  166. package/src/domains/agents/fleet-contract.ts +278 -16
  167. package/src/domains/agents/index.ts +14 -0
  168. package/src/domains/agents/result-contract.ts +235 -1
  169. package/src/domains/config/classify.ts +4 -0
  170. package/src/domains/dispatch/active-route-planner.ts +14 -0
  171. package/src/domains/dispatch/backoff.ts +2 -1
  172. package/src/domains/dispatch/capability-match.ts +1 -0
  173. package/src/domains/dispatch/checkout-writer-lease.ts +175 -0
  174. package/src/domains/dispatch/contract.ts +34 -0
  175. package/src/domains/dispatch/delegation-plan.ts +167 -0
  176. package/src/domains/dispatch/execution-plan.ts +76 -5
  177. package/src/domains/dispatch/execution-role.ts +3 -1
  178. package/src/domains/dispatch/execution-scheduler.ts +183 -67
  179. package/src/domains/dispatch/extension.ts +258 -9
  180. package/src/domains/dispatch/fleet-gate.ts +14 -0
  181. package/src/domains/dispatch/fleet-plan.ts +63 -3
  182. package/src/domains/dispatch/fleet-run.ts +737 -0
  183. package/src/domains/dispatch/gate-role-prompts.ts +9 -0
  184. package/src/domains/dispatch/host-verification.ts +178 -0
  185. package/src/domains/dispatch/index.ts +38 -0
  186. package/src/domains/dispatch/intent.ts +159 -0
  187. package/src/domains/dispatch/receipt-integrity.ts +8 -4
  188. package/src/domains/dispatch/state.ts +36 -3
  189. package/src/domains/dispatch/types.ts +51 -6
  190. package/src/domains/dispatch/validation.ts +66 -6
  191. package/src/domains/evidence/trust-status.ts +10 -1
  192. package/src/domains/middleware/index.ts +15 -0
  193. package/src/domains/middleware/watchdog.ts +281 -0
  194. package/src/domains/observability/contract.ts +3 -1
  195. package/src/domains/observability/cost.ts +12 -1
  196. package/src/domains/observability/extension.ts +2 -2
  197. package/src/domains/observability/index.ts +10 -0
  198. package/src/domains/observability/out-of-turn-usage.ts +223 -0
  199. package/src/domains/resources/index.ts +20 -0
  200. package/src/domains/resources/library.ts +326 -0
  201. package/src/domains/resources/skills/marketplace.ts +37 -12
  202. package/src/domains/session/handoff.ts +629 -0
  203. package/src/domains/share/archive.ts +67 -2
  204. package/src/entry/orchestrator.ts +37 -0
  205. package/src/interactive/bus-notices.ts +26 -0
  206. package/src/interactive/chat-loop.ts +235 -1
  207. package/src/interactive/chat-renderer.ts +22 -0
  208. package/src/interactive/cost-overlay.ts +31 -3
  209. package/src/interactive/council-dispatch.ts +30 -0
  210. package/src/interactive/council-grid.ts +213 -0
  211. package/src/interactive/council.ts +99 -0
  212. package/src/interactive/dispatch-board.ts +260 -16
  213. package/src/interactive/fleet-run-preview.ts +307 -0
  214. package/src/interactive/footer/notifications.ts +219 -0
  215. package/src/interactive/handoff-round.ts +56 -0
  216. package/src/interactive/interactive-application.ts +43 -1
  217. package/src/interactive/interactive-event-projection.ts +9 -1
  218. package/src/interactive/interactive-slash-runtime.ts +52 -2
  219. package/src/interactive/interactive-subscriptions.ts +14 -2
  220. package/src/interactive/oracle.ts +179 -0
  221. package/src/interactive/overlay-ask-user-lifecycle.ts +6 -0
  222. package/src/interactive/overlay-general-openers.ts +190 -1
  223. package/src/interactive/overlay-key-routing.ts +17 -1
  224. package/src/interactive/overlay-lifecycle.ts +41 -1
  225. package/src/interactive/overlay-permission-lifecycle.ts +10 -0
  226. package/src/interactive/overlay-resource-openers.ts +11 -3
  227. package/src/interactive/overlay-session-lifecycle.ts +234 -2
  228. package/src/interactive/overlays/fleet-run-approval.ts +208 -0
  229. package/src/interactive/overlays/handoff-review.ts +185 -0
  230. package/src/interactive/overlays/library-install-confirm.ts +151 -0
  231. package/src/interactive/overlays/list-overlay.ts +168 -2
  232. package/src/interactive/overlays/settings.ts +101 -4
  233. package/src/interactive/overlays/side-question.ts +139 -0
  234. package/src/interactive/overlays/skills-hub.ts +401 -15
  235. package/src/interactive/side-question.ts +171 -0
  236. package/src/interactive/slash-commands.ts +432 -5
  237. package/src/interactive/slash-spec.ts +19 -6
  238. package/src/interactive/theme/tokens.ts +30 -0
  239. package/src/interactive/turn-middleware.ts +15 -1
  240. package/src/interactive/watchdog-run.ts +75 -0
  241. package/src/interactive/worker-share.ts +56 -1
  242. package/src/interactive/worker-stream.ts +7 -0
  243. package/src/tools/bootstrap.ts +3 -0
  244. package/src/tools/compete-worktrees.ts +13 -79
  245. package/src/tools/dispatch-admission.ts +242 -8
  246. package/src/tools/dispatch-arguments.ts +57 -1
  247. package/src/tools/dispatch-plan.ts +136 -6
  248. package/src/tools/dispatch-runner.ts +319 -13
  249. package/src/tools/dispatch-types.ts +20 -1
  250. package/src/tools/dispatch.ts +72 -2
  251. package/src/tools/monitor.ts +16 -0
  252. package/src/tools/profiles.ts +18 -4
  253. package/src/tools/task-worktree.ts +238 -0
  254. package/src/tools/verify/authoring.ts +61 -1
  255. package/src/tools/verify/scripts.ts +62 -0
  256. package/src/tools/worker-evidence.ts +2 -1
  257. package/src/worker/spec-contract.ts +1 -0
  258. package/dist/chunk-HC4CLZ2Y.js +0 -68
@@ -2,68 +2,53 @@ 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-EBEFWSGL.js";
6
6
  import {
7
- AgentsDomainModule,
8
7
  SafetyDomainModule
9
- } from "./chunk-LYF7OHWH.js";
8
+ } from "./chunk-J7PIKKWC.js";
10
9
  import {
11
10
  LifecycleDomainModule
12
- } from "./chunk-6XXKFVSN.js";
11
+ } from "./chunk-JTSEDYVQ.js";
13
12
  import {
14
13
  ensureClioState
15
- } from "./chunk-KHSFENX2.js";
14
+ } from "./chunk-3HAPLH5M.js";
16
15
  import {
17
16
  ConfigDomainModule,
18
17
  loadDomains
19
- } from "./chunk-R46L2BIR.js";
18
+ } from "./chunk-BMWK7ZIZ.js";
20
19
  import {
21
20
  ObservabilityDomainModule
22
- } from "./chunk-K7T3E2SR.js";
23
- import "./chunk-HC4CLZ2Y.js";
21
+ } from "./chunk-5UJ6ECTS.js";
22
+ import "./chunk-GWS3VEIW.js";
24
23
  import "./chunk-HFSBBKSQ.js";
25
- import "./chunk-E25LMLRW.js";
24
+ import "./chunk-YD734TPH.js";
26
25
  import {
27
26
  ContextDomainModule
28
- } from "./chunk-CYQKWTG3.js";
27
+ } from "./chunk-4DWFMQDR.js";
29
28
  import "./chunk-LCGCVYZ4.js";
30
29
  import "./chunk-5WIGXA4T.js";
31
- import "./chunk-6US73PDB.js";
30
+ import "./chunk-6M7VS3J3.js";
32
31
  import {
33
32
  DispatchDomainModule,
34
- WRITE_BOUNDARY_VIOLATION_REASON,
35
33
  capacityDrain,
36
- codeStepDir,
37
- compileFleetExecutionPlan,
38
- createWriteBoundaryEnforcer,
39
- decideReviewGate,
40
- executePlan,
41
- executionPlanAncestors,
42
- materializePendingGateDecision,
34
+ executeFleetRun,
43
35
  openLedger,
44
- preflightWriteBoundaries,
45
- runCodeStep,
46
- setCapacityDraining,
47
- stagePendingGateDecision,
48
- writeCodeStepRecord
49
- } from "./chunk-QM3F2GKX.js";
36
+ planFleetResume,
37
+ readFleetRun,
38
+ setCapacityDraining
39
+ } from "./chunk-UUANF5CR.js";
50
40
  import {
51
41
  SessionDomainModule
52
- } from "./chunk-CJUB2JJ2.js";
42
+ } from "./chunk-6TUKSZVF.js";
53
43
  import {
54
- FLEET_COMMANDS_REMEDY,
55
- FLEET_COMMANDS_REPO_PATH,
56
- FleetCommandRegistryMissingError,
57
- listFleetContracts,
58
- loadFleetCommands,
59
- loadFleetContract,
60
- renderFleetPrompt
61
- } from "./chunk-QKMUKYO7.js";
44
+ WRITE_BOUNDARY_VIOLATION_REASON,
45
+ preflightWriteBoundaries
46
+ } from "./chunk-KZ2H5X4G.js";
62
47
  import {
63
- RUN_RECEIPT_INTEGRITY_ALGORITHM,
64
- RUN_RECEIPT_INTEGRITY_VERSION,
65
- verifyReceiptIntegrity
66
- } from "./chunk-OH3TOQTB.js";
48
+ compileFleetExecutionPlan
49
+ } from "./chunk-M4AKACEO.js";
50
+ import "./chunk-RVG5JXAL.js";
51
+ import "./chunk-ZGH7FGS5.js";
67
52
  import "./chunk-TSHXZTOQ.js";
68
53
  import "./chunk-TXOTCRLG.js";
69
54
  import "./chunk-HVDIIIQW.js";
@@ -71,14 +56,27 @@ import "./chunk-NDINPTJ4.js";
71
56
  import "./chunk-MVVUPGPW.js";
72
57
  import {
73
58
  ResourcesDomainModule
74
- } from "./chunk-MFFY33HR.js";
75
- import "./chunk-4BPJXDWC.js";
59
+ } from "./chunk-THKY7CD7.js";
60
+ import {
61
+ AgentsDomainModule
62
+ } from "./chunk-UVDSQ6LW.js";
63
+ import "./chunk-DR52UMZW.js";
64
+ import "./chunk-C4JBQ5SR.js";
76
65
  import "./chunk-2SFS6XQE.js";
77
66
  import "./chunk-ZWLZP4ZT.js";
78
67
  import "./chunk-W6GROXXM.js";
68
+ import {
69
+ FLEET_COMMANDS_REMEDY,
70
+ FLEET_COMMANDS_REPO_PATH,
71
+ FleetCommandRegistryMissingError,
72
+ listFleetContracts,
73
+ loadFleetCommands,
74
+ loadFleetContract,
75
+ renderFleetPrompt
76
+ } from "./chunk-KCMKRQX4.js";
79
77
  import {
80
78
  MiddlewareDomainModule
81
- } from "./chunk-ZXF4XRKW.js";
79
+ } from "./chunk-XEGB6BCN.js";
82
80
  import "./chunk-IR4CFBFN.js";
83
81
  import "./chunk-UOV2BYIW.js";
84
82
  import "./chunk-WHGPSPT5.js";
@@ -87,31 +85,30 @@ import {
87
85
  formatBudgetReasons,
88
86
  formatBudgetRequest,
89
87
  formatEffectiveBudget
90
- } from "./chunk-XXQNGV4M.js";
91
- import "./chunk-43AOLP7E.js";
92
- import {
93
- resultContractAuthorship
94
- } from "./chunk-EKY57CSP.js";
88
+ } from "./chunk-CEYBNUGC.js";
89
+ import "./chunk-5FR74PWO.js";
90
+ import "./chunk-OBMAI2DP.js";
91
+ import "./chunk-5C77SEEY.js";
95
92
  import {
96
93
  agentRoleFactsResolver,
97
- gateRouteCorrelation,
98
94
  requestExecutionRole,
99
95
  withAttemptRole
100
- } from "./chunk-22NAGB7X.js";
101
- import "./chunk-AOCYTWAV.js";
102
- import "./chunk-MV3K5QF2.js";
96
+ } from "./chunk-UND3GU2L.js";
103
97
  import "./chunk-CMZWFGD2.js";
104
98
  import "./chunk-I4HZDVNP.js";
105
- import "./chunk-FYYLNIL5.js";
106
- import "./chunk-UL3WSD3F.js";
99
+ import "./chunk-GH5622CP.js";
107
100
  import "./chunk-VG7TBQIY.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-DJNLUABN.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";
115
112
  import "./chunk-6XLNIQDB.js";
116
113
  import "./chunk-5B2AEOW5.js";
117
114
  import "./chunk-CGKSTWHD.js";
@@ -121,28 +118,28 @@ import "./chunk-UUVG37B4.js";
121
118
  import "./chunk-LBMZMYH2.js";
122
119
  import "./chunk-33YXPOE3.js";
123
120
  import "./chunk-XPLRXC72.js";
124
- import "./chunk-RD5U66HV.js";
125
- import "./chunk-KOHPCX4K.js";
121
+ import "./chunk-SROCI7ZU.js";
122
+ import "./chunk-DOOEX22V.js";
126
123
  import {
127
124
  ProvidersDomainModule
128
- } from "./chunk-DJVECN66.js";
125
+ } from "./chunk-VQNODYQ4.js";
129
126
  import "./chunk-CFGTUFWB.js";
130
- import "./chunk-AD2SYQYC.js";
131
- import "./chunk-4OC57DA6.js";
132
- import "./chunk-LL4KHSZI.js";
133
- import "./chunk-4VP4KH3K.js";
134
- import {
135
- attributeCommitMessage
136
- } from "./chunk-VEZEGCGW.js";
137
- import "./chunk-FQ4SKYE4.js";
138
- import "./chunk-IKCO5N3L.js";
139
- import "./chunk-3I7MS7N2.js";
127
+ import "./chunk-JRIO5UD2.js";
140
128
  import "./chunk-IHXBNWMM.js";
141
129
  import "./chunk-GEYXPTRF.js";
130
+ import {
131
+ readSettings
132
+ } from "./chunk-UHXRNZ2J.js";
133
+ import "./chunk-4DGYLA73.js";
134
+ import "./chunk-LL4KHSZI.js";
142
135
  import "./chunk-SST6Z5JA.js";
143
136
  import "./chunk-FO5ZOVUY.js";
144
137
  import "./chunk-R346GLFC.js";
138
+ import "./chunk-D4MDIG46.js";
139
+ import "./chunk-FQ4SKYE4.js";
145
140
  import "./chunk-4ZG3XFUR.js";
141
+ import "./chunk-IKCO5N3L.js";
142
+ import "./chunk-3I7MS7N2.js";
146
143
  import "./chunk-FCSXB6T2.js";
147
144
  import "./chunk-APJ265NV.js";
148
145
  import "./chunk-YXLYO42X.js";
@@ -151,9 +148,9 @@ import {
151
148
  } from "./chunk-BNAZZHFG.js";
152
149
  import "./chunk-6EJMN2Y3.js";
153
150
  import "./chunk-WEPFGWHJ.js";
154
- import "./chunk-XE2VEJHX.js";
151
+ import "./chunk-X2KV5FXT.js";
155
152
  import "./chunk-ZGVHUX3M.js";
156
- import "./chunk-G7MUEIGA.js";
153
+ import "./chunk-OB5HIGJY.js";
157
154
  import "./chunk-JVCV3ICN.js";
158
155
  import "./chunk-7CR24IG7.js";
159
156
  import "./chunk-IWHMRKLL.js";
@@ -166,48 +163,18 @@ init_esm_shims();
166
163
  import { randomBytes } from "node:crypto";
167
164
  import { readFileSync } from "node:fs";
168
165
  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
166
  var HELP = `clio-coder fleet <subcommand>
205
167
 
206
168
  Repo-owned fleet contracts and the dispatch status surface.
207
169
 
208
170
  Subcommands:
209
171
  list list .clio-coder/fleets/*.md contracts with validation status
172
+ new <name> --from <builtin> copy build-review, build-test, or sdlc into this repository
173
+ validate <name> [--json] run the fleet execution preflight without side effects
174
+ graph <name> [--json] print compiled waves, loops, scopes, and write boundaries
175
+ commands init draft a commented command registry from declared project entries
210
176
  run <name> [--var k=v ...] preflight and execute a fleet contract
177
+ [--resume <runId>] replay a completed prefix from a prior run of the same plan
211
178
  [--json] emit step receipts as JSON
212
179
  status [--json] show running, retrying, and total dispatch state
213
180
  drain [--json] deny new execution starts for up to one hour
@@ -225,6 +192,11 @@ function fail(message) {
225
192
  `);
226
193
  return 2;
227
194
  }
195
+ function refuse(message) {
196
+ process.stderr.write(`clio-coder fleet: ${message}
197
+ `);
198
+ return 1;
199
+ }
228
200
  function parseVars(args) {
229
201
  const vars = {};
230
202
  const rest = [];
@@ -247,28 +219,15 @@ function parseVars(args) {
247
219
  }
248
220
  return { vars, rest };
249
221
  }
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
222
  function newFleetRootId() {
266
223
  return `fleet-${randomBytes(6).toString("hex")}`;
267
224
  }
268
225
  function renderStep(step) {
269
226
  if (step.kind === "code") return `code:${step.command}[${step.scope}]`;
270
227
  if (step.kind === "agent") return `${step.agent}[${step.scope}]`;
271
- const check = step.check.kind === "code" ? `code:${step.check.command}` : step.check.agent;
228
+ if (step.kind === "gate") return `gate:${step.path}[${step.run}]`;
229
+ if (step.kind === "plan") return `plan:${step.agent}[${step.roster.join(",")}; max ${step.maxTasks}]`;
230
+ const check = step.check.kind === "code" ? `code:${step.check.command}` : step.check.kind === "gate" ? `gate:${step.check.gate}` : step.check.agent;
272
231
  return `loop:${step.id}(${check} -> ${step.repair.agent} x${step.maxAttempts})`;
273
232
  }
274
233
  function listingLine(entry, state, detail) {
@@ -309,7 +268,11 @@ function contractAgents(contract) {
309
268
  const agents = [];
310
269
  for (const step of contract.steps) {
311
270
  if (step.kind === "agent") agents.push({ id: step.id, agent: step.agent, scope: step.scope });
312
- else if (step.kind === "loop") {
271
+ else if (step.kind === "gate") agents.push({ id: step.id, agent: step.agent, scope: "workspace" });
272
+ else if (step.kind === "plan") {
273
+ agents.push({ id: step.id, agent: step.agent, scope: step.scope });
274
+ for (const agent of step.roster) agents.push({ id: `${step.id}.roster`, agent, scope: "readonly" });
275
+ } else if (step.kind === "loop") {
313
276
  if (step.check.kind === "agent") {
314
277
  agents.push({ id: `${step.id}.check`, agent: step.check.agent, scope: step.check.scope });
315
278
  }
@@ -319,6 +282,28 @@ function contractAgents(contract) {
319
282
  return agents;
320
283
  }
321
284
  function preflightFleet(contract, deps) {
285
+ const targets = new Set(deps.settings.targets.map((target) => target.id));
286
+ const profiles = new Set(Object.keys(deps.settings.workers?.profiles ?? {}));
287
+ const checkRoute = (id, route) => {
288
+ if (route.target !== void 0 && !targets.has(route.target))
289
+ return `unknown target '${route.target}' at step '${id}'`;
290
+ if (route.profile !== void 0 && !profiles.has(route.profile))
291
+ return `unknown profile '${route.profile}' at step '${id}'`;
292
+ return null;
293
+ };
294
+ for (const step of contract.steps) {
295
+ if (step.kind === "agent" || step.kind === "gate" || step.kind === "plan") {
296
+ const error2 = checkRoute(step.id, step);
297
+ if (error2 !== null) return error2;
298
+ }
299
+ if (step.kind !== "loop") continue;
300
+ if (step.check.kind === "agent") {
301
+ const error2 = checkRoute(`${step.id}.check`, step.check);
302
+ if (error2 !== null) return error2;
303
+ }
304
+ const error = checkRoute(`${step.id}.repair`, step.repair);
305
+ if (error !== null) return error;
306
+ }
322
307
  for (const step of contractAgents(contract)) {
323
308
  if (!deps.agents.get(step.agent)) {
324
309
  return `unknown agent '${step.agent}' (step '${step.id}' must name a recipe from 'clio-coder agents')`;
@@ -346,8 +331,12 @@ async function runFleet(args) {
346
331
  const { vars, rest, error } = parseVars(args);
347
332
  if (error !== void 0) return fail(error);
348
333
  const json = rest.includes("--json");
334
+ const resumeIndex = rest.indexOf("--resume");
335
+ const resumeId = resumeIndex === -1 ? void 0 : rest[resumeIndex + 1];
336
+ if (resumeIndex !== -1 && (resumeId === void 0 || resumeId.startsWith("-")))
337
+ return fail("--resume requires a run id");
349
338
  const name = rest.find((arg) => !arg.startsWith("-"));
350
- if (!name) return fail("usage: clio-coder fleet run <name> [--var key=value ...] [--json]");
339
+ if (!name) return fail("usage: clio-coder fleet run <name> [--var key=value ...] [--resume <runId>] [--json]");
351
340
  let contract;
352
341
  let prompt;
353
342
  let commands;
@@ -390,13 +379,17 @@ async function runFleet(args) {
390
379
  return fail("required domains unavailable (dispatch/agents/safety)");
391
380
  }
392
381
  const roleFacts = agentRoleFactsResolver((id) => agents.getSpec(id));
393
- const preflightError = preflightFleet(contract, { agents, safety, scheduling });
382
+ const preflightError = preflightFleet(contract, {
383
+ agents,
384
+ safety,
385
+ scheduling,
386
+ settings: config?.get() ?? readSettings()
387
+ });
394
388
  if (preflightError !== null) {
395
389
  await loaded.stop();
396
390
  return fail(`preflight failed: ${preflightError}`);
397
391
  }
398
392
  const fleetRootId = newFleetRootId();
399
- let planOutcome;
400
393
  let plan;
401
394
  try {
402
395
  plan = compileFleetExecutionPlan({
@@ -415,9 +408,7 @@ async function runFleet(args) {
415
408
  return {
416
409
  requestedAuthority: spec.capabilityClass,
417
410
  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,
411
+ expectedResultContract: context.planRole === true ? "delegation-plan" : context.gateAuthorRole === true ? "artifact-report" : context.gateRole === "reviewer" ? "verifier-report" : spec.resultContract.kind,
421
412
  executionRole: withAttemptRole(requestRole, context.attempt)
422
413
  };
423
414
  }
@@ -432,233 +423,96 @@ async function runFleet(args) {
432
423
  await loaded.stop();
433
424
  return fail(`preflight failed: ${err instanceof Error ? err.message : String(err)}`);
434
425
  }
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}
426
+ let resume;
427
+ if (resumeId !== void 0) {
428
+ const record = readFleetRun(resumeId);
429
+ if (record === null) {
430
+ await loaded.stop();
431
+ return refuse(`resume run '${resumeId}' was not found in the durable fleet ledger`);
432
+ }
433
+ const planned = planFleetResume(record, plan, contract, vars);
434
+ if (!planned.ok) {
435
+ if (planned.reason === "fleet-name") {
436
+ await loaded.stop();
437
+ return refuse(`resume run '${resumeId}' belongs to fleet '${planned.priorFleet}', not '${planned.currentFleet}'`);
438
+ }
439
+ if (planned.reason === "vars") {
440
+ await loaded.stop();
441
+ return refuse(`resume run '${resumeId}' used different --var values`);
442
+ }
443
+ process.stderr.write(
444
+ `clio-coder fleet: resume plan hash differs: prior=${planned.priorHash} current=${planned.currentHash}
445
+ `
446
+ );
447
+ for (const entry of planned.diff) {
448
+ process.stderr.write(` step ${entry.index + 1}: ${entry.priorId} -> ${entry.currentId}
449
+ `);
450
+ process.stderr.write(` prior: ${JSON.stringify(entry.prior)}
451
+ `);
452
+ process.stderr.write(` current: ${JSON.stringify(entry.current)}
443
453
  `);
454
+ }
455
+ await loaded.stop();
456
+ return 1;
444
457
  }
445
- });
458
+ resume = { record, replayed: planned.replayed };
459
+ }
446
460
  process.stderr.write(
447
461
  `fleet ${contract.name}: root=${fleetRootId} plan=${plan.hash} steps=${plan.steps.length} loops=${plan.loops.length}
448
462
  `
449
463
  );
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
- };
464
+ let outcome;
469
465
  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)}
466
+ outcome = await executeFleetRun({
467
+ plan,
468
+ contractName: contract.name,
469
+ commands,
470
+ workspaceRoot: process.cwd(),
471
+ fleetRootId,
472
+ dispatch,
473
+ agents: { getSpec: (agentId) => agents.getSpec(agentId) },
474
+ attributionEnabled: config?.get().attribution.gitCommits ?? true,
475
+ vars,
476
+ ...resume !== void 0 ? { resume } : {},
477
+ onStepSettled(step) {
478
+ if (step.replayed === true && step.result !== void 0) {
479
+ if (json)
480
+ process.stdout.write(
481
+ `${JSON.stringify({ stepId: step.stepId, status: "replayed", receipt: { runId: step.result.terminalRunId, digest: step.result.receiptDigest } })}
548
482
  `
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;
483
+ );
484
+ else
485
+ process.stdout.write(
486
+ `step ${step.stepId}: replayed terminal-run=${step.result.terminalRunId} receipt=${step.result.receiptDigest}
487
+ `
488
+ );
489
+ return;
576
490
  }
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 })}
491
+ if (step.receipt !== void 0) {
492
+ if (json) process.stdout.write(`${JSON.stringify(step.receipt)}
595
493
  `);
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}
494
+ else
495
+ process.stdout.write(
496
+ `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
497
  `
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;
619
- }
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
- };
498
+ );
499
+ return;
626
500
  }
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}
501
+ if (step.codeStep !== void 0) {
502
+ if (json) process.stdout.write(`${JSON.stringify({ codeStep: step.codeStep })}
503
+ `);
504
+ else
505
+ process.stdout.write(
506
+ `step ${step.stepId} code:${step.commandId}: ${step.succeeded ? "passed" : "failed"} exit=${step.codeStep.exitCode} ${step.codeStep.durationMs}ms record=${step.recordPath}
643
507
  `
644
- );
508
+ );
645
509
  }
646
- return {
647
- resolved: decided.verdict === "pass",
648
- findings: decided.findings,
649
- needsDecision: decided.needsDecision
650
- };
651
- },
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
510
  },
659
- releaseUnconsumed: (ownerId) => {
660
- if (ownerId === NO_WORKER_RESERVATION) return;
661
- dispatch.reservations?.rollbackUnconsumed(ownerId);
511
+ onNotice(text, kind) {
512
+ if (kind === "write-boundary") process.stderr.write(`${text}
513
+ `);
514
+ else if (kind === "gate" && !json) process.stdout.write(`${text}
515
+ `);
662
516
  }
663
517
  });
664
518
  } catch (err) {
@@ -668,53 +522,45 @@ async function runFleet(args) {
668
522
  }
669
523
  await dispatch.drain();
670
524
  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
525
  if (json) {
676
526
  process.stdout.write(
677
527
  `${JSON.stringify({
678
528
  fleet: contract.name,
679
529
  rootId: fleetRootId,
680
530
  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
531
+ loops: outcome.result.loops,
532
+ revalidated: outcome.result.revalidated,
533
+ unneeded: outcome.result.unneeded,
534
+ skipped: outcome.result.skipped,
535
+ needsDecision: outcome.result.needsDecision,
536
+ writeBoundaries: outcome.result.writeBoundaries
687
537
  })}
688
538
  `
689
539
  );
690
540
  } else {
691
- const spentUsd = receipts.reduce((sum, receipt) => sum + receipt.costUsd, 0);
692
541
  process.stdout.write(
693
- `fleet ${contract.name}: ${succeededSteps}/${required.length} steps succeeded, ${resolvedLoops}/${planOutcome.loops.length} loops resolved, total cost $${spentUsd.toFixed(4)}
542
+ `fleet ${contract.name}: ${outcome.succeededStepCount}/${outcome.requiredStepCount} steps succeeded, ${outcome.resolvedLoopCount}/${outcome.result.loops.length} loops resolved, total cost $${outcome.totalCostUsd.toFixed(4)}
694
543
  `
695
544
  );
696
- for (const loop of planOutcome.loops) {
545
+ for (const loop of outcome.result.loops)
697
546
  process.stdout.write(
698
547
  ` loop ${loop.loopId}: ${loop.reason} after ${loop.attempts} verification(s) and ${loop.repairs} repair(s)
699
548
  `
700
549
  );
701
- }
702
- if (planOutcome.revalidated.length > 0) {
550
+ if (outcome.result.revalidated.length > 0)
703
551
  process.stdout.write(
704
- ` staleness: re-ran ${planOutcome.revalidated.join(", ")} because a workspace step landed after the last green
552
+ ` staleness: re-ran ${outcome.result.revalidated.join(", ")} because a workspace step landed after the last green
705
553
  `
706
554
  );
707
- }
708
- for (const message of planOutcome.needsDecision) process.stdout.write(` needs operator decision: ${message}
555
+ for (const message of outcome.result.needsDecision) process.stdout.write(` needs operator decision: ${message}
709
556
  `);
710
- for (const boundary of planOutcome.writeBoundaries) {
557
+ for (const boundary of outcome.result.writeBoundaries) {
711
558
  if (!boundary.violated) continue;
712
559
  process.stdout.write(` write boundary ${boundary.window}: ${boundary.detail ?? WRITE_BOUNDARY_VIOLATION_REASON}
713
560
  `);
714
561
  }
715
562
  }
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;
563
+ return outcome.cleanRun ? 0 : 1;
718
564
  }
719
565
  function isProcessAlive(pid) {
720
566
  if (pid === null || !Number.isFinite(pid) || pid <= 0) return false;
@@ -884,6 +730,14 @@ async function runFleetCommand(args) {
884
730
  switch (sub) {
885
731
  case "list":
886
732
  return runList(args.slice(1));
733
+ case "new":
734
+ return (await import("./fleet-new-RDVJLHHH.js")).runFleetNew(args.slice(1));
735
+ case "validate":
736
+ return (await import("./fleet-validate-BIYREGIK.js")).runFleetValidate(args.slice(1));
737
+ case "graph":
738
+ return (await import("./fleet-graph-Y6HPXIVF.js")).runFleetGraph(args.slice(1));
739
+ case "commands":
740
+ return (await import("./fleet-commands-ZFIWZSB3.js")).runFleetCommands(args.slice(1));
887
741
  case "run":
888
742
  return runFleet(args.slice(1));
889
743
  case "status":
@@ -903,4 +757,4 @@ export {
903
757
  runFleetCommand,
904
758
  statusSnapshot
905
759
  };
906
- //# sourceMappingURL=fleet-S5R4ZOQY.js.map
760
+ //# sourceMappingURL=fleet-BDKYJFCP.js.map