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