@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
@@ -6,16 +6,23 @@ import {
6
6
  cloneApprovedAssignmentRoute,
7
7
  cloneDispatchBudgetRequest,
8
8
  isApprovedAssignmentRoute,
9
- isToolProfileName
10
- } from "./chunk-XXQNGV4M.js";
9
+ isDispatchIntent,
10
+ isToolProfileName,
11
+ resolveDispatchPathScope
12
+ } from "./chunk-A3WNZD3P.js";
11
13
  import {
12
14
  ROUTE_POLICY_VERSION,
13
- isExecutionRole,
14
15
  isRouteDecisionAgentSelection,
15
16
  isRoutingIntent,
16
- parseRoutingIntent,
17
+ parseRoutingIntent
18
+ } from "./chunk-P43ETTHK.js";
19
+ import {
20
+ isExecutionRole,
17
21
  requestExecutionRole
18
- } from "./chunk-22NAGB7X.js";
22
+ } from "./chunk-H7IXIC72.js";
23
+ import {
24
+ pathBoundaryCovers
25
+ } from "./chunk-TTHACPOM.js";
19
26
  import {
20
27
  AGENT_AUTOMATION_AUTHORITIES
21
28
  } from "./chunk-AOCYTWAV.js";
@@ -30,6 +37,7 @@ import { createHash } from "node:crypto";
30
37
  // src/tools/dispatch-arguments.ts
31
38
  init_esm_shims();
32
39
  var DEFAULT_AGENT_ID = "coder";
40
+ var COUNCIL_DEFAULT_AGENT_ID = "researcher";
33
41
  var AUTO_BASELINE_BY_TASK_TYPE = {
34
42
  // Mutating shapes: capability class first, specialization second.
35
43
  code_write: "coder",
@@ -78,7 +86,7 @@ function dispatchRequestFromArgs(args, options) {
78
86
  const task = stringArg(args, "task");
79
87
  if (!task) return { ok: false, message: "missing task (pass list:true to see available agents)" };
80
88
  if (Object.hasOwn(args, "agent_id")) return { ok: false, message: "agent_id is unsupported; use agent" };
81
- const requestedAgent = stringArg(args, "agent") ?? DEFAULT_AGENT_ID;
89
+ const requestedAgent = stringArg(args, "agent") ?? (args.mode === "council" ? COUNCIL_DEFAULT_AGENT_ID : DEFAULT_AGENT_ID);
82
90
  const auto = requestedAgent === "auto";
83
91
  const agentId = auto ? autoBaselineAgentId(task, options.hasAgent) : requestedAgent;
84
92
  const request = {
@@ -126,6 +134,45 @@ function dispatchRequestFromArgs(args, options) {
126
134
  request.requiredCapabilities = routing.intent.requiredCapabilities;
127
135
  const cwd = stringArg(args, "cwd");
128
136
  if (cwd) request.cwd = cwd;
137
+ if (args.worktree !== void 0) {
138
+ if (args.worktree !== true) return { ok: false, message: "worktree must be true when present" };
139
+ request.worktree = true;
140
+ }
141
+ if (args.apply !== void 0) {
142
+ if (args.apply !== "merge" && args.apply !== "preserve")
143
+ return { ok: false, message: "apply must be merge or preserve" };
144
+ if (request.worktree !== true) return { ok: false, message: "apply requires worktree: true" };
145
+ request.apply = args.apply;
146
+ }
147
+ if (Object.hasOwn(args, "gate") && isRecord(args.intent) && Object.hasOwn(args.intent, "verification")) {
148
+ return { ok: false, message: "gate_and_intent_verification_conflict: gate cannot combine with intent.verification" };
149
+ }
150
+ let rawIntent = args.intent;
151
+ if (Object.hasOwn(args, "gate")) {
152
+ if (typeof args.gate !== "string" || args.gate.trim().length === 0) {
153
+ return { ok: false, message: "gate must be a non-empty declared check id" };
154
+ }
155
+ rawIntent = { ...isRecord(rawIntent) ? rawIntent : {}, verification: [{ check: args.gate.trim() }] };
156
+ }
157
+ if (rawIntent !== void 0) {
158
+ if (options.resolveIntent === void 0) return { ok: false, message: "intent resolver is unavailable" };
159
+ const resolved = options.resolveIntent(rawIntent, cwd);
160
+ if (!resolved.ok) return resolved;
161
+ request.intent = resolved.intent;
162
+ if (resolved.resolvedVerification.length > 0) request.resolvedVerification = resolved.resolvedVerification;
163
+ if (resolved.intent.writeRoots.length > 0) {
164
+ const legacy = Array.isArray(args.writeRoots) ? args.writeRoots.filter((entry) => typeof entry === "string") : void 0;
165
+ if (legacy !== void 0) {
166
+ const left = [...new Set(legacy)].sort();
167
+ if (JSON.stringify(left) !== JSON.stringify(resolved.intent.writeRoots)) {
168
+ return { ok: false, message: "intent_write_roots_contradiction" };
169
+ }
170
+ request.writeRoots = legacy;
171
+ } else {
172
+ request.writeRoots = resolved.intent.writeRoots;
173
+ }
174
+ }
175
+ }
129
176
  if ("persona" in args && args.persona !== void 0) {
130
177
  if (typeof args.persona !== "string") return { ok: false, message: "persona must be a string" };
131
178
  const persona = args.persona.trim();
@@ -174,8 +221,34 @@ function dispatchRequestsFromArgs(args, options) {
174
221
  for (let index = 0; index < tasks.length; index += 1) {
175
222
  const item = tasks[index];
176
223
  const itemArgs = isRecord(item) ? { ...shared, ...item } : { ...shared, task: item };
224
+ const sharedIntent = isRecord(shared.intent) ? shared.intent : null;
225
+ const itemIntent = isRecord(item) && Object.hasOwn(item, "intent") && isRecord(item.intent) ? item.intent : null;
226
+ if (sharedIntent !== null && itemIntent !== null) itemArgs.intent = { ...sharedIntent, ...itemIntent };
177
227
  const parsed = dispatchRequestFromArgs(itemArgs, options);
178
228
  if (!parsed.ok) return { ok: false, message: `dispatch: task ${index + 1}: ${parsed.message}` };
229
+ if (sharedIntent !== null && itemIntent !== null) {
230
+ if (options.resolveIntent === void 0) {
231
+ return { ok: false, message: `dispatch: task ${index + 1}: intent resolver is unavailable` };
232
+ }
233
+ const ceiling = options.resolveIntent(sharedIntent, parsed.request.cwd);
234
+ if (!ceiling.ok) return { ok: false, message: `dispatch: task ${index + 1}: ${ceiling.message}` };
235
+ const pathCeilings = {
236
+ readRoots: [...ceiling.intent.readRoots, ...ceiling.intent.writeRoots],
237
+ writeRoots: ceiling.intent.writeRoots,
238
+ relevantPaths: [...ceiling.intent.readRoots, ...ceiling.intent.writeRoots, ...ceiling.intent.relevantPaths]
239
+ };
240
+ for (const field of ["readRoots", "writeRoots", "relevantPaths"]) {
241
+ const outside = parsed.request.intent?.[field].find(
242
+ (candidate) => !pathBoundaryCovers(pathCeilings[field], candidate)
243
+ );
244
+ if (outside !== void 0) {
245
+ return {
246
+ ok: false,
247
+ message: `dispatch: task ${index + 1}: intent_scope_widening: ${field} entry '${outside}' is outside the top-level intent ceiling`
248
+ };
249
+ }
250
+ }
251
+ }
179
252
  requests.push(parsed.request);
180
253
  }
181
254
  return { ok: true, requests };
@@ -232,7 +305,14 @@ function withResolvedPlanTaskPin(request, task, options = {}) {
232
305
  ...task.routeApproval === null ? {} : { routeApproval: cloneApprovedAssignmentRoute(task.routeApproval) },
233
306
  ...task.allowedCandidates === void 0 ? {} : { allowedCandidates: task.allowedCandidates.map((candidate) => ({ ...candidate })) },
234
307
  task: options.pinTask === false ? request.task : task.task,
235
- ...task.briefing !== void 0 ? { briefing: task.briefing } : {},
308
+ ...options.pinBriefing === false ? request.briefing !== void 0 ? { briefing: request.briefing } : {} : task.briefing !== void 0 ? { briefing: task.briefing } : {},
309
+ ...task.worktree === true ? {
310
+ worktree: true,
311
+ apply: task.apply ?? "merge",
312
+ ...task.worktreeDestination === void 0 ? {} : { taskWorktreeDestination: task.worktreeDestination }
313
+ } : {},
314
+ ...task.intent !== void 0 ? { intent: structuredClone(task.intent) } : {},
315
+ ...task.resolvedVerification !== void 0 ? { resolvedVerification: task.resolvedVerification.map((check) => ({ ...check, argv: [...check.argv] })) } : {},
236
316
  target: task.target,
237
317
  model: task.model,
238
318
  node: task.node,
@@ -258,6 +338,32 @@ function safeField(value) {
258
338
  }
259
339
  return result;
260
340
  }
341
+ function renderLegacyPathScope(task) {
342
+ if (task.intent !== void 0) return [];
343
+ const scope = resolveDispatchPathScope({
344
+ agentId: task.agent,
345
+ executionRole: task.executionRole,
346
+ task: task.task,
347
+ ...task.briefing !== void 0 ? { briefing: task.briefing } : {}
348
+ });
349
+ const lines = [" scope mode=legacy-inferred"];
350
+ for (const [policy, entries] of [
351
+ ["working_context", scope.provenance.workingContextPaths],
352
+ ["write_boundary", scope.provenance.writeBoundaries]
353
+ ]) {
354
+ for (const entry of entries) {
355
+ for (const evidence of entry.evidence) {
356
+ lines.push(
357
+ ` scope ${policy} path=${JSON.stringify(safeField(entry.path))} provenance=${evidence.provenance} source=${evidence.source} confidence=${evidence.confidence} reason=${evidence.reason}`
358
+ );
359
+ }
360
+ }
361
+ }
362
+ if (scope.provenance.workingContextPaths.length === 0 && scope.provenance.writeBoundaries.length === 0) {
363
+ lines.push(" scope policy_paths=none");
364
+ }
365
+ return lines;
366
+ }
261
367
  function taskViews(args) {
262
368
  const tasks = Array.isArray(args.tasks) ? args.tasks : [];
263
369
  const sharedAgent = str(args.agent) ?? "coder";
@@ -281,6 +387,12 @@ function taskViews(args) {
281
387
  };
282
388
  const briefing = "briefing" in record ? str(record.briefing) : str(args.briefing);
283
389
  if (briefing !== void 0) view.briefing = briefing;
390
+ const worktree = "worktree" in record ? record.worktree : args.worktree;
391
+ if (worktree === true) {
392
+ view.worktree = true;
393
+ const apply = "apply" in record ? record.apply : args.apply;
394
+ view.apply = apply === "preserve" ? "preserve" : "merge";
395
+ }
284
396
  const model = str(record.model) ?? sharedModel;
285
397
  if (model !== void 0) view.model = model;
286
398
  const node = str(record.node) ?? sharedNode;
@@ -315,6 +427,7 @@ function canonicalCandidates(value) {
315
427
  function topologyOf(args) {
316
428
  if (isRecord2(args.apply_winner)) return "compete";
317
429
  if (args.mode === "compete") return "compete";
430
+ if (args.mode === "council") return "council";
318
431
  if (args.review === true || isRecord2(args.review)) return "review";
319
432
  if (args.detach === true) return "detached";
320
433
  if (args.mode === "sequential") return "sequential";
@@ -348,6 +461,15 @@ function renderPlanText(topology, tasks, costCeilingUsd, deadlineMs, source, max
348
461
  lines.push(
349
462
  ` ${index + 1}.${role} agent=${safeField(task.agent)}${target}${model}${node}${failover}${routingText} task=${JSON.stringify(safeField(task.task))}`
350
463
  );
464
+ if (task.council !== void 0) {
465
+ lines.push(
466
+ ` council label=${safeField(task.council.label)} color=${safeField(task.council.color ?? "none")} round=${task.council.round} rounds=${task.council.rounds} synthesis=${task.council.synthesis}`
467
+ );
468
+ }
469
+ if (task.worktree === true)
470
+ lines.push(
471
+ ` worktree=true apply=${task.apply ?? "merge"} destination=${safeField(task.worktreeDestination ?? "unresolved")}`
472
+ );
351
473
  if (task.allowedCandidates !== void 0) {
352
474
  for (const [candidateIndex, candidate] of task.allowedCandidates.entries()) {
353
475
  lines.push(
@@ -382,6 +504,16 @@ function renderPlanText(topology, tasks, costCeilingUsd, deadlineMs, source, max
382
504
  ` briefing_bytes=${Buffer.byteLength(task.briefing, "utf8")} briefing_sha256=${createHash("sha256").update(task.briefing, "utf8").digest("hex")} briefing_preview=${JSON.stringify(safeField(task.briefing))}`
383
505
  );
384
506
  }
507
+ if (task.intent !== void 0) {
508
+ const serialized = JSON.stringify(task.intent);
509
+ lines.push(` intent_sha256=${createHash("sha256").update(serialized, "utf8").digest("hex")}`);
510
+ }
511
+ lines.push(...renderLegacyPathScope(task));
512
+ for (const check of task.resolvedVerification ?? []) {
513
+ lines.push(
514
+ ` verification check=${safeField(check.check)} argv=${JSON.stringify(check.argv)} cwd=${JSON.stringify(check.cwd)} timeout_ms=${check.timeoutMs}`
515
+ );
516
+ }
385
517
  }
386
518
  return lines.join("\n");
387
519
  }
@@ -391,12 +523,16 @@ function isResolvedTask(value) {
391
523
  "agent",
392
524
  "task",
393
525
  "briefing",
526
+ "worktree",
527
+ "apply",
528
+ "worktreeDestination",
394
529
  "model",
395
530
  "node",
396
531
  "nodeKind",
397
532
  "nodeHost",
398
533
  "target",
399
534
  "role",
535
+ "council",
400
536
  "position",
401
537
  "routingIntent",
402
538
  "failover",
@@ -409,7 +545,9 @@ function isResolvedTask(value) {
409
545
  "expectedResultContract",
410
546
  "authorityGrant",
411
547
  "agentDecision",
412
- "wave"
548
+ "wave",
549
+ "intent",
550
+ "resolvedVerification"
413
551
  ]);
414
552
  if (Object.keys(value).some((key) => !allowedKeys.has(key))) return false;
415
553
  for (const key of [
@@ -432,16 +570,24 @@ function isResolvedTask(value) {
432
570
  "wave"
433
571
  ])
434
572
  if (!Object.hasOwn(value, key)) return false;
435
- if (value.role !== void 0 && value.role !== "task" && value.role !== "builder" && value.role !== "reviewer" && value.role !== "candidate" && value.role !== "judge") {
573
+ if (value.role !== void 0 && value.role !== "task" && value.role !== "builder" && value.role !== "reviewer" && value.role !== "candidate" && value.role !== "judge" && value.role !== "member" && value.role !== "synthesis") {
436
574
  return false;
437
575
  }
438
576
  if (value.position !== void 0 && (!Number.isInteger(value.position) || Number(value.position) < 1)) return false;
577
+ if (value.council !== void 0) {
578
+ if (!isRecord2(value.council) || typeof value.council.label !== "string" || value.council.label.length === 0 || value.council.color !== void 0 && typeof value.council.color !== "string" || !Number.isInteger(value.council.round) || Number(value.council.round) < 1 || !Number.isInteger(value.council.rounds) || Number(value.council.rounds) < 1 || value.council.synthesis !== "none" && value.council.synthesis !== "judge" && value.council.synthesis !== "vote")
579
+ return false;
580
+ }
439
581
  if (value.nodeKind !== "local" && value.nodeKind !== "ssh") return false;
440
582
  if (value.nodeKind === "ssh" && (typeof value.nodeHost !== "string" || value.nodeHost.trim().length === 0))
441
583
  return false;
442
584
  if (value.nodeKind === "local" && value.nodeHost !== void 0) return false;
443
585
  if (value.briefing !== void 0 && (typeof value.briefing !== "string" || value.briefing.trim().length === 0))
444
586
  return false;
587
+ if (value.worktree !== void 0 && value.worktree !== true) return false;
588
+ if (value.apply !== void 0 && value.apply !== "merge" && value.apply !== "preserve") return false;
589
+ if (value.apply !== void 0 && value.worktree !== true) return false;
590
+ if (value.worktreeDestination !== void 0 && typeof value.worktreeDestination !== "string") return false;
445
591
  if (failoverModeOf(value.failover) === void 0) return false;
446
592
  if (!isRoutingIntent(value.routingIntent)) return false;
447
593
  if (value.routeApproval !== null && !isApprovedAssignmentRoute(value.routeApproval)) return false;
@@ -455,6 +601,11 @@ function isResolvedTask(value) {
455
601
  return false;
456
602
  if (value.authorityGrant !== null && !isAuthorityGrant(value.authorityGrant)) return false;
457
603
  if (value.agentDecision !== null && !isAgentDecision(value.agentDecision)) return false;
604
+ if (value.intent !== void 0 && !isDispatchIntent(value.intent)) return false;
605
+ if (value.resolvedVerification !== void 0 && (!Array.isArray(value.resolvedVerification) || !value.resolvedVerification.every(
606
+ (check) => isRecord2(check) && typeof check.check === "string" && Array.isArray(check.argv) && check.argv.every((arg) => typeof arg === "string") && typeof check.cwd === "string" && typeof check.timeoutMs === "number"
607
+ )))
608
+ return false;
458
609
  if (value.failover === "approved") {
459
610
  if (canonicalCandidates(value.allowedCandidates) === null) return false;
460
611
  } else if (value.allowedCandidates !== void 0) {
@@ -468,11 +619,16 @@ var RESULT_CONTRACT_KINDS = /* @__PURE__ */ new Set([
468
619
  "architect-plan",
469
620
  "scout-report",
470
621
  "verifier-report",
622
+ "council-report",
471
623
  "debugger-report",
472
624
  "research-report",
473
625
  "mutation-report",
474
626
  "provenance-report",
475
- "external-delegation"
627
+ "oracle-report",
628
+ "external-delegation",
629
+ "artifact-report",
630
+ "context-handbook",
631
+ "delegation-plan"
476
632
  ]);
477
633
  function isAuthorityGrant(value) {
478
634
  return isRecord2(value) && Object.keys(value).sort().join("\0") === "basis\0requested" && AGENT_AUTOMATION_AUTHORITIES.includes(value.requested) && (value.basis === "operator-plan-approval" || value.basis === "full-auto-policy");
@@ -536,7 +692,7 @@ function resolvedDispatchPlanFromArgs(args) {
536
692
  };
537
693
  }
538
694
  if (value.tasks.length === 0 && confirmation === void 0) return null;
539
- if (value.topology !== "parallel" && value.topology !== "sequential" && value.topology !== "pipeline" && value.topology !== "review" && value.topology !== "compete" && value.topology !== "detached" && value.topology !== "fleet") {
695
+ if (value.topology !== "parallel" && value.topology !== "sequential" && value.topology !== "pipeline" && value.topology !== "review" && value.topology !== "compete" && value.topology !== "council" && value.topology !== "detached" && value.topology !== "fleet") {
540
696
  return null;
541
697
  }
542
698
  if (typeof value.costCeilingUsd !== "number" || !Number.isFinite(value.costCeilingUsd) || value.costCeilingUsd <= 0) {
@@ -567,6 +723,11 @@ function resolvedDispatchPlanFromArgs(args) {
567
723
  agent: task.agent.trim(),
568
724
  task: task.task.trim(),
569
725
  ...task.briefing !== void 0 ? { briefing: task.briefing.trim() } : {},
726
+ ...task.worktree === true ? {
727
+ worktree: true,
728
+ apply: task.apply ?? "merge",
729
+ ...task.worktreeDestination === void 0 ? {} : { worktreeDestination: task.worktreeDestination }
730
+ } : {},
570
731
  model: task.model.trim(),
571
732
  node: task.node.trim(),
572
733
  nodeKind: task.nodeKind,
@@ -585,7 +746,10 @@ function resolvedDispatchPlanFromArgs(args) {
585
746
  ...task.failover === "approved" && canonicalCandidates(task.allowedCandidates) !== null ? { allowedCandidates: canonicalCandidates(task.allowedCandidates) } : {},
586
747
  ...task.nodeHost !== void 0 ? { nodeHost: task.nodeHost.trim() } : {},
587
748
  ...task.role !== void 0 ? { role: task.role } : {},
588
- ...task.position !== void 0 ? { position: task.position } : {}
749
+ ...task.council !== void 0 ? { council: { ...task.council } } : {},
750
+ ...task.position !== void 0 ? { position: task.position } : {},
751
+ ...task.intent !== void 0 ? { intent: structuredClone(task.intent) } : {},
752
+ ...task.resolvedVerification !== void 0 ? { resolvedVerification: task.resolvedVerification.map((check) => ({ ...check, argv: [...check.argv] })) } : {}
589
753
  })),
590
754
  costCeilingUsd: value.costCeilingUsd,
591
755
  deadlineMs: value.deadlineMs,
@@ -621,7 +785,7 @@ function describeDispatchPlan(rawArgs) {
621
785
  const maxWorkers = resolved?.maxWorkers ?? null;
622
786
  const onFailure = resolved?.onFailure ?? null;
623
787
  const remote = tasks.some((task) => task.node !== void 0 && task.node !== "local");
624
- const planScale = !preparationFailed && args.list !== true && (tasks.length > 1 || source !== null || topology === "compete" || remote || tasks.some((task) => task.failover === "approved") || confirmation !== void 0 || isRecord2(args.apply_winner));
788
+ const planScale = !preparationFailed && args.list !== true && (tasks.length > 1 || source !== null || topology === "compete" || topology === "council" || remote || tasks.some((task) => task.failover === "approved") || confirmation !== void 0 || isRecord2(args.apply_winner));
625
789
  const text = renderPlanText(topology, tasks, costCeilingUsd, deadlineMs, source, maxWorkers, onFailure, confirmation);
626
790
  return {
627
791
  topology,
@@ -649,4 +813,4 @@ export {
649
813
  withResolvedDispatchPlan,
650
814
  describeDispatchPlan
651
815
  };
652
- //# sourceMappingURL=chunk-EYPA3EGJ.js.map
816
+ //# sourceMappingURL=chunk-KTYTFRMB.js.map
@@ -0,0 +1,33 @@
1
+ import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
+ import {
3
+ openAuthStorage
4
+ } from "./chunk-EQ63NRB7.js";
5
+ import {
6
+ getRuntimeRegistry
7
+ } from "./chunk-NUGM5KR6.js";
8
+ import {
9
+ init_esm_shims
10
+ } from "./chunk-3R73A4XB.js";
11
+
12
+ // src/domains/providers/credentials.ts
13
+ init_esm_shims();
14
+ function credentialsPresent() {
15
+ const present = /* @__PURE__ */ new Set();
16
+ const registry = getRuntimeRegistry();
17
+ const auth = openAuthStorage();
18
+ for (const desc of registry.list()) {
19
+ const envVar = desc.credentialsEnvVar;
20
+ if (!envVar) continue;
21
+ const providerId = desc.id;
22
+ const status = auth.status(providerId, { explicitEnvVar: envVar, includeFallback: false });
23
+ if (status.available) {
24
+ present.add(envVar);
25
+ }
26
+ }
27
+ return present;
28
+ }
29
+
30
+ export {
31
+ credentialsPresent
32
+ };
33
+ //# sourceMappingURL=chunk-LU7P4LHA.js.map
@@ -0,0 +1,108 @@
1
+ import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
+ import {
3
+ discoverAgentRecipes
4
+ } from "./chunk-FBVTI2TJ.js";
5
+ import {
6
+ compileFleetExecutionPlan
7
+ } from "./chunk-J3YUBZWY.js";
8
+ import {
9
+ loadFleetCommands,
10
+ loadFleetContract,
11
+ renderFleetPrompt
12
+ } from "./chunk-E77JEWSD.js";
13
+ import {
14
+ requestExecutionRole,
15
+ withAttemptRole
16
+ } from "./chunk-H7IXIC72.js";
17
+ import {
18
+ normalizeAgentSpec
19
+ } from "./chunk-AOCYTWAV.js";
20
+ import {
21
+ readSettings
22
+ } from "./chunk-IJ7RPIYJ.js";
23
+ import {
24
+ init_esm_shims
25
+ } from "./chunk-3R73A4XB.js";
26
+
27
+ // src/cli/fleet-preflight.ts
28
+ init_esm_shims();
29
+ function discoverSpecs(cwd) {
30
+ return discoverAgentRecipes(cwd).map(normalizeAgentSpec);
31
+ }
32
+ function inspectFleet(name, vars) {
33
+ const cwd = process.cwd();
34
+ const contract = loadFleetContract(cwd, name);
35
+ const commands = loadFleetCommands(cwd);
36
+ const prompt = vars === void 0 ? contract.body : renderFleetPrompt(contract.body, vars);
37
+ const specs = discoverSpecs(cwd);
38
+ const byId = new Map(specs.map((spec) => [spec.id, spec]));
39
+ const resolved = /* @__PURE__ */ new Set();
40
+ const settings = readSettings();
41
+ const targetIds = new Set(settings.targets.map((target) => target.id));
42
+ const profileIds = new Set(Object.keys(settings.workers?.profiles ?? {}));
43
+ for (const step of contract.steps) {
44
+ const positions = step.kind === "loop" ? [
45
+ ...step.check.kind === "agent" ? [{ id: `${step.id}.check`, route: step.check }] : [],
46
+ { id: `${step.id}.repair`, route: step.repair }
47
+ ] : step.kind === "agent" || step.kind === "gate" || step.kind === "plan" ? [{ id: step.id, route: step }] : [];
48
+ for (const position of positions) {
49
+ if (position.route.target !== void 0 && !targetIds.has(position.route.target)) {
50
+ throw new Error(`unknown target '${position.route.target}' at step '${position.id}'`);
51
+ }
52
+ if (position.route.profile !== void 0 && !profileIds.has(position.route.profile)) {
53
+ throw new Error(`unknown profile '${position.route.profile}' at step '${position.id}'`);
54
+ }
55
+ }
56
+ }
57
+ const plan = compileFleetExecutionPlan({
58
+ contract,
59
+ task: prompt,
60
+ resolveAgent(context) {
61
+ const spec = byId.get(context.agentId);
62
+ if (spec === void 0) {
63
+ throw new Error(
64
+ `unknown agent '${context.agentId}' (step '${context.stepId}' must name a recipe from 'clio-coder agents')`
65
+ );
66
+ }
67
+ if (spec.capabilityClass === "orchestration" || spec.capabilityClass === "internal") {
68
+ throw new Error(`fleet step '${context.stepId}' has no automatable agent authority`);
69
+ }
70
+ resolved.add(spec.id);
71
+ const role = requestExecutionRole({
72
+ agentId: spec.id,
73
+ resolveFacts: (id) => {
74
+ const found = byId.get(id);
75
+ return found === void 0 ? null : {
76
+ category: found.category,
77
+ capabilityClass: found.capabilityClass,
78
+ resultContractKind: found.resultContract.kind
79
+ };
80
+ },
81
+ ...context.gateRole === void 0 ? {} : { gateRole: context.gateRole }
82
+ });
83
+ return {
84
+ requestedAuthority: spec.capabilityClass,
85
+ approvedAuthority: spec.capabilityClass,
86
+ expectedResultContract: context.planRole === true ? "delegation-plan" : context.gateAuthorRole === true ? "artifact-report" : context.gateRole === "reviewer" ? "verifier-report" : spec.resultContract.kind,
87
+ executionRole: withAttemptRole(role, context.attempt)
88
+ };
89
+ }
90
+ });
91
+ return {
92
+ contract,
93
+ commands,
94
+ plan,
95
+ checks: [
96
+ { check: "parse", summary: `parsed contract version ${contract.version}` },
97
+ { check: "graph", summary: `validated ${contract.steps.length} declared steps` },
98
+ { check: "commands", summary: `validated ${plan.steps.filter((step) => step.kind === "code").length} code steps` },
99
+ { check: "agents", summary: `resolved ${resolved.size} agents` },
100
+ { check: "plan", summary: `compiled ${plan.steps.length} plan steps with hash ${plan.hash}` }
101
+ ]
102
+ };
103
+ }
104
+
105
+ export {
106
+ inspectFleet
107
+ };
108
+ //# sourceMappingURL=chunk-ME6CCNFO.js.map