@ambystech/ambykit 1.5.0 → 2.0.0-rc.1
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 +190 -1
- package/README.md +12 -7
- package/dist/cli/add.js +9 -0
- package/dist/cli/add.js.map +1 -1
- package/dist/cli/analyze.js +25 -4
- package/dist/cli/analyze.js.map +1 -1
- package/dist/cli/base-command.d.ts +8 -0
- package/dist/cli/base-command.js +30 -0
- package/dist/cli/base-command.js.map +1 -1
- package/dist/cli/check.d.ts +2 -0
- package/dist/cli/check.js +38 -4
- package/dist/cli/check.js.map +1 -1
- package/dist/cli/dashboard.d.ts +5 -2
- package/dist/cli/dashboard.js +95 -24
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/edit.d.ts +17 -0
- package/dist/cli/edit.js +71 -0
- package/dist/cli/edit.js.map +1 -0
- package/dist/cli/fleet.d.ts +2 -0
- package/dist/cli/fleet.js +23 -1
- package/dist/cli/fleet.js.map +1 -1
- package/dist/cli/index.d.ts +1 -5
- package/dist/cli/index.js +21 -109
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init.js +9 -0
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/lane.d.ts +38 -3
- package/dist/cli/lane.js +124 -108
- package/dist/cli/lane.js.map +1 -1
- package/dist/cli/main.d.ts +6 -0
- package/dist/cli/main.js +111 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/mcp.d.ts +2 -0
- package/dist/cli/mcp.js +4 -0
- package/dist/cli/mcp.js.map +1 -1
- package/dist/cli/migrate.d.ts +17 -0
- package/dist/cli/migrate.js +67 -0
- package/dist/cli/migrate.js.map +1 -0
- package/dist/cli/node-guard.d.ts +4 -0
- package/dist/cli/node-guard.js +12 -0
- package/dist/cli/node-guard.js.map +1 -0
- package/dist/cli/run-budget.d.ts +25 -0
- package/dist/cli/run-budget.js +112 -0
- package/dist/cli/run-budget.js.map +1 -0
- package/dist/cli/run-control.d.ts +40 -0
- package/dist/cli/run-control.js +161 -0
- package/dist/cli/run-control.js.map +1 -0
- package/dist/cli/run-files.d.ts +96 -0
- package/dist/cli/run-files.js +120 -0
- package/dist/cli/run-files.js.map +1 -0
- package/dist/cli/run-fleet-control.d.ts +16 -0
- package/dist/cli/run-fleet-control.js +23 -0
- package/dist/cli/run-fleet-control.js.map +1 -0
- package/dist/cli/run-fleet-loop.d.ts +77 -0
- package/dist/cli/run-fleet-loop.js +156 -0
- package/dist/cli/run-fleet-loop.js.map +1 -0
- package/dist/cli/run-fleet-merge.d.ts +22 -0
- package/dist/cli/run-fleet-merge.js +69 -0
- package/dist/cli/run-fleet-merge.js.map +1 -0
- package/dist/cli/run-fleet-prepare.d.ts +35 -0
- package/dist/cli/run-fleet-prepare.js +58 -0
- package/dist/cli/run-fleet-prepare.js.map +1 -0
- package/dist/cli/run-fleet.d.ts +28 -0
- package/dist/cli/run-fleet.js +382 -0
- package/dist/cli/run-fleet.js.map +1 -0
- package/dist/cli/run-gates.d.ts +25 -0
- package/dist/cli/run-gates.js +45 -0
- package/dist/cli/run-gates.js.map +1 -0
- package/dist/cli/run-launch.d.ts +17 -0
- package/dist/cli/run-launch.js +106 -0
- package/dist/cli/run-launch.js.map +1 -0
- package/dist/cli/run-loop.d.ts +39 -0
- package/dist/cli/run-loop.js +197 -0
- package/dist/cli/run-loop.js.map +1 -0
- package/dist/cli/run-merger.d.ts +18 -0
- package/dist/cli/run-merger.js +126 -0
- package/dist/cli/run-merger.js.map +1 -0
- package/dist/cli/run-phase-check.d.ts +32 -0
- package/dist/cli/run-phase-check.js +173 -0
- package/dist/cli/run-phase-check.js.map +1 -0
- package/dist/cli/run-plan.d.ts +28 -0
- package/dist/cli/run-plan.js +62 -0
- package/dist/cli/run-plan.js.map +1 -0
- package/dist/cli/run-process.d.ts +45 -0
- package/dist/cli/run-process.js +111 -0
- package/dist/cli/run-process.js.map +1 -0
- package/dist/cli/run-protocol-prompts.d.ts +17 -0
- package/dist/cli/run-protocol-prompts.js +63 -0
- package/dist/cli/run-protocol-prompts.js.map +1 -0
- package/dist/cli/run-protocol.d.ts +17 -0
- package/dist/cli/run-protocol.js +128 -0
- package/dist/cli/run-protocol.js.map +1 -0
- package/dist/cli/run-script.d.ts +11 -0
- package/dist/cli/run-script.js +67 -0
- package/dist/cli/run-script.js.map +1 -0
- package/dist/cli/run-session.d.ts +93 -0
- package/dist/cli/run-session.js +21 -0
- package/dist/cli/run-session.js.map +1 -0
- package/dist/cli/run-stages.d.ts +11 -0
- package/dist/cli/run-stages.js +34 -0
- package/dist/cli/run-stages.js.map +1 -0
- package/dist/cli/run-supervisor.d.ts +20 -0
- package/dist/cli/run-supervisor.js +167 -0
- package/dist/cli/run-supervisor.js.map +1 -0
- package/dist/cli/run.d.ts +81 -0
- package/dist/cli/run.js +437 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/sync.js +10 -5
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/ui/dashboard/empty-state.d.ts +5 -0
- package/dist/cli/ui/dashboard/empty-state.js +7 -0
- package/dist/cli/ui/dashboard/empty-state.js.map +1 -1
- package/dist/cli/ui/dashboard/filter-line.d.ts +13 -0
- package/dist/cli/ui/dashboard/filter-line.js +20 -0
- package/dist/cli/ui/dashboard/filter-line.js.map +1 -0
- package/dist/cli/ui/dashboard/fleet-tab.d.ts +25 -0
- package/dist/cli/ui/dashboard/fleet-tab.js +91 -0
- package/dist/cli/ui/dashboard/fleet-tab.js.map +1 -0
- package/dist/cli/ui/dashboard/fleet-tokens.d.ts +404 -0
- package/dist/cli/ui/dashboard/fleet-tokens.js +405 -0
- package/dist/cli/ui/dashboard/fleet-tokens.js.map +1 -0
- package/dist/cli/ui/dashboard/fleet-view.d.ts +51 -0
- package/dist/cli/ui/dashboard/fleet-view.js +211 -0
- package/dist/cli/ui/dashboard/fleet-view.js.map +1 -0
- package/dist/cli/ui/dashboard/help-overlay.d.ts +3 -1
- package/dist/cli/ui/dashboard/help-overlay.js +36 -3
- package/dist/cli/ui/dashboard/help-overlay.js.map +1 -1
- package/dist/cli/ui/dashboard/layout.d.ts +15 -0
- package/dist/cli/ui/dashboard/layout.js +22 -0
- package/dist/cli/ui/dashboard/layout.js.map +1 -1
- package/dist/cli/ui/dashboard/metrics-panel.d.ts +15 -0
- package/dist/cli/ui/dashboard/metrics-panel.js +143 -0
- package/dist/cli/ui/dashboard/metrics-panel.js.map +1 -0
- package/dist/cli/ui/dashboard/tab-bar.d.ts +14 -0
- package/dist/cli/ui/dashboard/tab-bar.js +37 -0
- package/dist/cli/ui/dashboard/tab-bar.js.map +1 -0
- package/dist/cli/ui/dashboard/tab-frame.d.ts +43 -0
- package/dist/cli/ui/dashboard/tab-frame.js +68 -0
- package/dist/cli/ui/dashboard/tab-frame.js.map +1 -0
- package/dist/cli/ui/dashboard/tab-tokens.d.ts +569 -0
- package/dist/cli/ui/dashboard/tab-tokens.js +570 -0
- package/dist/cli/ui/dashboard/tab-tokens.js.map +1 -0
- package/dist/cli/ui/icons.d.ts +22 -0
- package/dist/cli/ui/icons.js +17 -0
- package/dist/cli/ui/icons.js.map +1 -0
- package/dist/cli/ui/interactive/fleet-actions.d.ts +24 -0
- package/dist/cli/ui/interactive/fleet-actions.js +30 -0
- package/dist/cli/ui/interactive/fleet-actions.js.map +1 -0
- package/dist/cli/ui/interactive/fleet.d.ts +54 -0
- package/dist/cli/ui/interactive/fleet.js +98 -0
- package/dist/cli/ui/interactive/fleet.js.map +1 -0
- package/dist/cli/ui/interactive/fullscreen.js +38 -10
- package/dist/cli/ui/interactive/fullscreen.js.map +1 -1
- package/dist/cli/ui/interactive/list-filter.d.ts +25 -0
- package/dist/cli/ui/interactive/list-filter.js +38 -0
- package/dist/cli/ui/interactive/list-filter.js.map +1 -0
- package/dist/cli/ui/interactive/live.d.ts +8 -0
- package/dist/cli/ui/interactive/live.js +13 -0
- package/dist/cli/ui/interactive/live.js.map +1 -1
- package/dist/cli/ui/interactive/overview.d.ts +52 -3
- package/dist/cli/ui/interactive/overview.js +354 -15
- package/dist/cli/ui/interactive/overview.js.map +1 -1
- package/dist/cli/ui/interactive/tabs.d.ts +15 -0
- package/dist/cli/ui/interactive/tabs.js +27 -0
- package/dist/cli/ui/interactive/tabs.js.map +1 -0
- package/dist/cli/ui/tool-options.d.ts +5 -1
- package/dist/cli/ui/tool-options.js +9 -3
- package/dist/cli/ui/tool-options.js.map +1 -1
- package/dist/cli/update.js +13 -2
- package/dist/cli/update.js.map +1 -1
- package/dist/core/analyze.d.ts +11 -0
- package/dist/core/analyze.js +33 -3
- package/dist/core/analyze.js.map +1 -1
- package/dist/core/burndown.d.ts +1 -1
- package/dist/core/burndown.js +2 -2
- package/dist/core/burndown.js.map +1 -1
- package/dist/core/checkouts.js +3 -2
- package/dist/core/checkouts.js.map +1 -1
- package/dist/core/config-schema.d.ts +45 -0
- package/dist/core/config-schema.js +63 -0
- package/dist/core/config-schema.js.map +1 -0
- package/dist/core/config.d.ts +6 -0
- package/dist/core/config.js +16 -0
- package/dist/core/config.js.map +1 -1
- package/dist/core/dashboard.js +3 -2
- package/dist/core/dashboard.js.map +1 -1
- package/dist/core/decisions.d.ts +12 -1
- package/dist/core/decisions.js +7 -2
- package/dist/core/decisions.js.map +1 -1
- package/dist/core/deprecation.d.ts +15 -0
- package/dist/core/deprecation.js +27 -0
- package/dist/core/deprecation.js.map +1 -0
- package/dist/core/features.js +11 -5
- package/dist/core/features.js.map +1 -1
- package/dist/core/fleet/fleet-text.d.ts +2 -0
- package/dist/core/fleet/fleet-text.js +41 -0
- package/dist/core/fleet/fleet-text.js.map +1 -0
- package/dist/core/fleet/fleet-view.d.ts +35 -0
- package/dist/core/fleet/fleet-view.js +43 -0
- package/dist/core/fleet/fleet-view.js.map +1 -0
- package/dist/core/fleet/fleets.d.ts +18 -0
- package/dist/core/fleet/fleets.js +64 -0
- package/dist/core/fleet/fleets.js.map +1 -0
- package/dist/core/fleet/flow-input.js +3 -4
- package/dist/core/fleet/flow-input.js.map +1 -1
- package/dist/core/fleet/index.d.ts +3 -0
- package/dist/core/fleet/index.js +3 -0
- package/dist/core/fleet/index.js.map +1 -1
- package/dist/core/fleet/runs.d.ts +18 -2
- package/dist/core/fleet/runs.js +67 -16
- package/dist/core/fleet/runs.js.map +1 -1
- package/dist/core/fleet-plan/budget.d.ts +18 -0
- package/dist/core/fleet-plan/budget.js +13 -0
- package/dist/core/fleet-plan/budget.js.map +1 -0
- package/dist/core/fleet-plan/contain.d.ts +10 -0
- package/dist/core/fleet-plan/contain.js +37 -0
- package/dist/core/fleet-plan/contain.js.map +1 -0
- package/dist/core/fleet-plan/format.d.ts +4 -0
- package/dist/core/fleet-plan/format.js +52 -0
- package/dist/core/fleet-plan/format.js.map +1 -0
- package/dist/core/fleet-plan/index.d.ts +7 -0
- package/dist/core/fleet-plan/index.js +8 -0
- package/dist/core/fleet-plan/index.js.map +1 -0
- package/dist/core/fleet-plan/order.d.ts +30 -0
- package/dist/core/fleet-plan/order.js +96 -0
- package/dist/core/fleet-plan/order.js.map +1 -0
- package/dist/core/fleet-plan/ownership.d.ts +12 -0
- package/dist/core/fleet-plan/ownership.js +36 -0
- package/dist/core/fleet-plan/ownership.js.map +1 -0
- package/dist/core/fleet-plan/plan.d.ts +23 -0
- package/dist/core/fleet-plan/plan.js +40 -0
- package/dist/core/fleet-plan/plan.js.map +1 -0
- package/dist/core/fleet-plan/read.d.ts +19 -0
- package/dist/core/fleet-plan/read.js +35 -0
- package/dist/core/fleet-plan/read.js.map +1 -0
- package/dist/core/fleet-plan/schedule.d.ts +15 -0
- package/dist/core/fleet-plan/schedule.js +27 -0
- package/dist/core/fleet-plan/schedule.js.map +1 -0
- package/dist/core/fleet-plan/select.d.ts +20 -0
- package/dist/core/fleet-plan/select.js +64 -0
- package/dist/core/fleet-plan/select.js.map +1 -0
- package/dist/core/fleet-plan/types.d.ts +123 -0
- package/dist/core/fleet-plan/types.js +2 -0
- package/dist/core/fleet-plan/types.js.map +1 -0
- package/dist/core/fleet-view/derive.d.ts +14 -0
- package/dist/core/fleet-view/derive.js +54 -0
- package/dist/core/fleet-view/derive.js.map +1 -0
- package/dist/core/fleet-view/group.d.ts +51 -0
- package/dist/core/fleet-view/group.js +73 -0
- package/dist/core/fleet-view/group.js.map +1 -0
- package/dist/core/fleet-view/json.d.ts +37 -0
- package/dist/core/fleet-view/json.js +25 -0
- package/dist/core/fleet-view/json.js.map +1 -0
- package/dist/core/fleet-view/read.d.ts +8 -0
- package/dist/core/fleet-view/read.js +44 -0
- package/dist/core/fleet-view/read.js.map +1 -0
- package/dist/core/fleet-view/types.d.ts +52 -0
- package/dist/core/fleet-view/types.js +2 -0
- package/dist/core/fleet-view/types.js.map +1 -0
- package/dist/core/graph-format.d.ts +2 -0
- package/dist/core/graph-format.js +4 -3
- package/dist/core/graph-format.js.map +1 -1
- package/dist/core/graph-types.d.ts +4 -0
- package/dist/core/graph.js +38 -1
- package/dist/core/graph.js.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/lane-merge.d.ts +29 -0
- package/dist/core/lane-merge.js +105 -0
- package/dist/core/lane-merge.js.map +1 -0
- package/dist/core/lanes.d.ts +53 -0
- package/dist/core/lanes.js +131 -0
- package/dist/core/lanes.js.map +1 -1
- package/dist/core/legacy.d.ts +2 -1
- package/dist/core/legacy.js +7 -2
- package/dist/core/legacy.js.map +1 -1
- package/dist/core/markers.d.ts +7 -0
- package/dist/core/markers.js +3 -2
- package/dist/core/markers.js.map +1 -1
- package/dist/core/metrics/cycle.d.ts +3 -0
- package/dist/core/metrics/cycle.js +47 -0
- package/dist/core/metrics/cycle.js.map +1 -0
- package/dist/core/metrics/gap.d.ts +9 -0
- package/dist/core/metrics/gap.js +35 -0
- package/dist/core/metrics/gap.js.map +1 -0
- package/dist/core/metrics/index.d.ts +21 -0
- package/dist/core/metrics/index.js +67 -0
- package/dist/core/metrics/index.js.map +1 -0
- package/dist/core/metrics/model.d.ts +23 -0
- package/dist/core/metrics/model.js +46 -0
- package/dist/core/metrics/model.js.map +1 -0
- package/dist/core/metrics/revisions.d.ts +22 -0
- package/dist/core/metrics/revisions.js +88 -0
- package/dist/core/metrics/revisions.js.map +1 -0
- package/dist/core/metrics/types.d.ts +74 -0
- package/dist/core/metrics/types.js +3 -0
- package/dist/core/metrics/types.js.map +1 -0
- package/dist/core/migrate/convert-spec.d.ts +19 -0
- package/dist/core/migrate/convert-spec.js +99 -0
- package/dist/core/migrate/convert-spec.js.map +1 -0
- package/dist/core/migrate/convert-tasks.d.ts +16 -0
- package/dist/core/migrate/convert-tasks.js +121 -0
- package/dist/core/migrate/convert-tasks.js.map +1 -0
- package/dist/core/migrate/run.d.ts +36 -0
- package/dist/core/migrate/run.js +178 -0
- package/dist/core/migrate/run.js.map +1 -0
- package/dist/core/migrate/safety.d.ts +33 -0
- package/dist/core/migrate/safety.js +199 -0
- package/dist/core/migrate/safety.js.map +1 -0
- package/dist/core/migrate/summary.d.ts +36 -0
- package/dist/core/migrate/summary.js +140 -0
- package/dist/core/migrate/summary.js.map +1 -0
- package/dist/core/moved-targets.d.ts +73 -8
- package/dist/core/moved-targets.js +79 -1
- package/dist/core/moved-targets.js.map +1 -1
- package/dist/core/overview-types.d.ts +7 -0
- package/dist/core/overview-types.js.map +1 -1
- package/dist/core/overview.js +4 -0
- package/dist/core/overview.js.map +1 -1
- package/dist/core/query.js +3 -2
- package/dist/core/query.js.map +1 -1
- package/dist/core/run-gate-actions.d.ts +51 -0
- package/dist/core/run-gate-actions.js +105 -0
- package/dist/core/run-gate-actions.js.map +1 -0
- package/dist/core/run-launch-plan.d.ts +53 -0
- package/dist/core/run-launch-plan.js +32 -0
- package/dist/core/run-launch-plan.js.map +1 -0
- package/dist/core/run-prompt.d.ts +89 -0
- package/dist/core/run-prompt.js +73 -0
- package/dist/core/run-prompt.js.map +1 -0
- package/dist/core/run-result.d.ts +42 -0
- package/dist/core/run-result.js +163 -0
- package/dist/core/run-result.js.map +1 -0
- package/dist/core/run-review.d.ts +50 -0
- package/dist/core/run-review.js +20 -0
- package/dist/core/run-review.js.map +1 -0
- package/dist/core/run-schedule.d.ts +23 -0
- package/dist/core/run-schedule.js +40 -0
- package/dist/core/run-schedule.js.map +1 -0
- package/dist/core/run-stability.d.ts +23 -0
- package/dist/core/run-stability.js +38 -0
- package/dist/core/run-stability.js.map +1 -0
- package/dist/core/run-supervise.d.ts +71 -0
- package/dist/core/run-supervise.js +61 -0
- package/dist/core/run-supervise.js.map +1 -0
- package/dist/core/runners.d.ts +114 -0
- package/dist/core/runners.js +146 -0
- package/dist/core/runners.js.map +1 -0
- package/dist/core/sibling-reads.d.ts +41 -0
- package/dist/core/sibling-reads.js +100 -0
- package/dist/core/sibling-reads.js.map +1 -0
- package/dist/core/spec-format/blocks.d.ts +19 -0
- package/dist/core/spec-format/blocks.js +58 -0
- package/dist/core/spec-format/blocks.js.map +1 -0
- package/dist/core/spec-format/detect.d.ts +14 -0
- package/dist/core/spec-format/detect.js +30 -0
- package/dist/core/spec-format/detect.js.map +1 -0
- package/dist/core/spec-format/dispatch.d.ts +13 -0
- package/dist/core/spec-format/dispatch.js +64 -0
- package/dist/core/spec-format/dispatch.js.map +1 -0
- package/dist/core/spec-format/frontmatter.d.ts +18 -0
- package/dist/core/spec-format/frontmatter.js +37 -0
- package/dist/core/spec-format/frontmatter.js.map +1 -0
- package/dist/core/spec-format/legacy.d.ts +40 -0
- package/dist/core/spec-format/legacy.js +91 -0
- package/dist/core/spec-format/legacy.js.map +1 -0
- package/dist/core/spec-format/meta.d.ts +3 -0
- package/dist/core/spec-format/meta.js +24 -0
- package/dist/core/spec-format/meta.js.map +1 -0
- package/dist/core/spec-format/model.d.ts +50 -0
- package/dist/core/spec-format/model.js +9 -0
- package/dist/core/spec-format/model.js.map +1 -0
- package/dist/core/spec-format/read-spec.d.ts +4 -0
- package/dist/core/spec-format/read-spec.js +102 -0
- package/dist/core/spec-format/read-spec.js.map +1 -0
- package/dist/core/spec-format/read-tasks.d.ts +2 -0
- package/dist/core/spec-format/read-tasks.js +146 -0
- package/dist/core/spec-format/read-tasks.js.map +1 -0
- package/dist/core/spec-format/write.d.ts +23 -0
- package/dist/core/spec-format/write.js +382 -0
- package/dist/core/spec-format/write.js.map +1 -0
- package/dist/core/subagents.js +0 -2
- package/dist/core/subagents.js.map +1 -1
- package/dist/core/tasks-edit.d.ts +4 -1
- package/dist/core/tasks-edit.js +19 -6
- package/dist/core/tasks-edit.js.map +1 -1
- package/dist/core/types.d.ts +21 -0
- package/dist/emitters/index.d.ts +0 -4
- package/dist/emitters/index.js +0 -10
- package/dist/emitters/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/plugins/api.d.ts +14 -8
- package/dist/plugins/api.js +9 -8
- package/dist/plugins/api.js.map +1 -1
- package/dist/plugins/index.d.ts +3 -2
- package/dist/plugins/index.js +3 -2
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/loader.d.ts +8 -0
- package/dist/plugins/loader.js +36 -6
- package/dist/plugins/loader.js.map +1 -1
- package/dist/plugins/report.d.ts +1 -1
- package/dist/plugins/report.js +3 -4
- package/dist/plugins/report.js.map +1 -1
- package/dist/plugins/session.d.ts +1 -0
- package/dist/plugins/session.js +1 -1
- package/dist/plugins/session.js.map +1 -1
- package/dist/testkit/index.d.ts +1 -1
- package/docs/architecture.md +16 -1
- package/docs/artifacts/decision-record.md +15 -0
- package/docs/artifacts/spec.md +35 -6
- package/docs/artifacts/tasks.md +67 -16
- package/docs/cli-reference.md +274 -5
- package/docs/contributing.md +6 -0
- package/docs/migration.md +191 -0
- package/docs/plugin-api.md +21 -13
- package/docs/plugin-split.md +5 -3
- package/docs/plugin-trust.md +2 -2
- package/docs/plugins-release.md +105 -0
- package/docs/release.md +103 -0
- package/docs/stability.md +152 -0
- package/docs/tool-compatibility.md +41 -3
- package/docs/workflow.md +10 -6
- package/package.json +4 -2
- package/src/agents/worker.md +2 -1
- package/src/prompts/converge.md +2 -2
- package/src/prompts/implement.md +13 -11
- package/src/prompts/revise.md +5 -2
- package/src/prompts/run.md +7 -4
- package/src/prompts/specify.md +5 -3
- package/src/prompts/tasks.md +9 -8
- package/src/templates/spec.md +10 -4
- package/src/templates/tasks.md +35 -13
- package/dist/emitters/antigravity-cli.d.ts +0 -15
- package/dist/emitters/antigravity-cli.js +0 -20
- package/dist/emitters/antigravity-cli.js.map +0 -1
- package/dist/emitters/antigravity.d.ts +0 -20
- package/dist/emitters/antigravity.js +0 -24
- package/dist/emitters/antigravity.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FleetSettings } from "../core/config.js";
|
|
2
|
+
import { type LaunchEntry } from "../core/run-launch-plan.js";
|
|
3
|
+
import { type RunnerSpec } from "../core/runners.js";
|
|
4
|
+
import type { LaneRef } from "../core/query.js";
|
|
5
|
+
/** The protocol wording spec 019's worker persona carries; one source (025), so the two cannot drift. */
|
|
6
|
+
export declare const PROTOCOL = "Report at the start of a task, at the end of a task, and whenever you are blocked or waiting. Never report on a timer and never report progress. The reply carries a directive: continue, pause or stop. On pause or stop, finish the task you are on, then obey it at your next report: do not start another task.";
|
|
7
|
+
/** The id the next run of a feature will get: one past the highest existing number (025's rule). */
|
|
8
|
+
export declare function nextRunId(root: string, feature: string): string;
|
|
9
|
+
/** Task IDs a lane still has to do, read from the lane's own checkout. */
|
|
10
|
+
export declare function laneOpenTasks(lane: LaneRef): string[];
|
|
11
|
+
/** The artifacts that exist in the lane checkout, as `@` reference targets. */
|
|
12
|
+
export declare function laneArtifacts(lane: LaneRef): string[];
|
|
13
|
+
export interface PlanContext {
|
|
14
|
+
root: string;
|
|
15
|
+
feature: string;
|
|
16
|
+
lanes: LaneRef[];
|
|
17
|
+
assistants: string[];
|
|
18
|
+
run: string;
|
|
19
|
+
settings: FleetSettings;
|
|
20
|
+
registry?: RunnerSpec[];
|
|
21
|
+
/** Run in the preview and script paths: where prompt files will be, even when nothing is written yet. */
|
|
22
|
+
promptDir?: string;
|
|
23
|
+
/** Lane (short) -> assistant, fixed by an earlier session of the same run (`--continue-run`). */
|
|
24
|
+
assignment?: Map<string, string>;
|
|
25
|
+
}
|
|
26
|
+
export declare function lanePromptText(lane: LaneRef, run: string, open?: string[], findings?: string[], runDir?: string, assistant?: string, commands?: readonly string[]): string;
|
|
27
|
+
/** One plan used by the preview, `--emit-script` and the launch: what is printed is exactly what runs. */
|
|
28
|
+
export declare function buildLaunchPlan(ctx: PlanContext): LaunchEntry[];
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { readTasks } from "../core/spec-format/dispatch.js";
|
|
4
|
+
import { listRuns, runDir } from "../core/fleet/index.js";
|
|
5
|
+
import { assignAssistants, launchPlan } from "../core/run-launch-plan.js";
|
|
6
|
+
import { buildLanePrompt } from "../core/run-prompt.js";
|
|
7
|
+
import { RUNNERS } from "../core/runners.js";
|
|
8
|
+
import { DIRECTIVE_PROTOCOL, REPORT_CADENCE } from "../mcp/tools/fleet.js";
|
|
9
|
+
/** The protocol wording spec 019's worker persona carries; one source (025), so the two cannot drift. */
|
|
10
|
+
export const PROTOCOL = `${REPORT_CADENCE} ${DIRECTIVE_PROTOCOL}`;
|
|
11
|
+
/** The id the next run of a feature will get: one past the highest existing number (025's rule). */
|
|
12
|
+
export function nextRunId(root, feature) {
|
|
13
|
+
const nums = listRuns(root, feature).map((r) => Number(r.run.slice(r.run.lastIndexOf(".") + 1)));
|
|
14
|
+
return `${feature}.${Math.max(0, ...nums) + 1}`;
|
|
15
|
+
}
|
|
16
|
+
/** Task IDs a lane still has to do, read from the lane's own checkout. */
|
|
17
|
+
export function laneOpenTasks(lane) {
|
|
18
|
+
const file = join(lane.root, "specs", lane.manifest.feature, "tasks.md");
|
|
19
|
+
if (!existsSync(file))
|
|
20
|
+
return lane.manifest.tasks.map((t) => t.id);
|
|
21
|
+
const done = new Set(readTasks(readFileSync(file, "utf8")).tasks.filter((t) => t.done).map((t) => t.id));
|
|
22
|
+
return lane.manifest.tasks.map((t) => t.id).filter((id) => !done.has(id));
|
|
23
|
+
}
|
|
24
|
+
/** The artifacts that exist in the lane checkout, as `@` reference targets. */
|
|
25
|
+
export function laneArtifacts(lane) {
|
|
26
|
+
const dir = `specs/${lane.manifest.feature}`;
|
|
27
|
+
return ["spec.md", "plan.md", "tasks.md", "tests.md"].map((f) => `${dir}/${f}`).filter((p) => existsSync(join(lane.root, p)));
|
|
28
|
+
}
|
|
29
|
+
export function lanePromptText(lane, run, open, findings, runDir, assistant, commands) {
|
|
30
|
+
return buildLanePrompt({ feature: lane.manifest.feature, lane: lane.name, phase: lane.manifest.phase, tasks: lane.manifest.tasks }, {
|
|
31
|
+
run,
|
|
32
|
+
artifacts: laneArtifacts(lane),
|
|
33
|
+
open: open ?? laneOpenTasks(lane),
|
|
34
|
+
...(findings ? { findings } : {}),
|
|
35
|
+
protocol: PROTOCOL,
|
|
36
|
+
...(runDir ? { runDir } : {}),
|
|
37
|
+
...(assistant ? { assistant } : {}),
|
|
38
|
+
...(commands && commands.length > 0 ? { commands } : {}),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/** One plan used by the preview, `--emit-script` and the launch: what is printed is exactly what runs. */
|
|
42
|
+
export function buildLaunchPlan(ctx) {
|
|
43
|
+
const assign = ctx.assignment ?? assignAssistants(ctx.lanes.map((l) => l.short), ctx.assistants.length > 0 ? ctx.assistants : ["claude"]);
|
|
44
|
+
const promptDir = ctx.promptDir ?? join(runDir(ctx.root, ctx.run), "prompts");
|
|
45
|
+
const lanes = ctx.lanes.map((l) => {
|
|
46
|
+
const assistant = assign.get(l.short) ?? ctx.assistants[0] ?? "claude";
|
|
47
|
+
return {
|
|
48
|
+
lane: l.short,
|
|
49
|
+
full: l.name,
|
|
50
|
+
cwd: l.root,
|
|
51
|
+
assistant,
|
|
52
|
+
prompt: lanePromptText(l, ctx.run, undefined, undefined, undefined, assistant, ctx.settings.allowedCommands),
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
return launchPlan(lanes, {
|
|
56
|
+
promptFileFor: (lane) => join(promptDir, `${lane}.md`),
|
|
57
|
+
registry: ctx.registry ?? RUNNERS,
|
|
58
|
+
...(ctx.settings.workerModel ? { model: ctx.settings.workerModel } : {}),
|
|
59
|
+
allowedCommands: ctx.settings.allowedCommands,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=run-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-plan.js","sourceRoot":"","sources":["../../src/cli/run-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAE5D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAoB,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAmB,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE3E,yGAAyG;AACzG,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,cAAc,IAAI,kBAAkB,EAAE,CAAC;AAElE,oGAAoG;AACpG,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,OAAe;IACrD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC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C;QACxE,eAAe,EAAE,GAAG,CAAC,QAAQ,CAAC,eAAe;KAC9C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The process edge (feature 028): the only place `ambykit run` uses `node:child_process`. Everything else
|
|
3
|
+
* depends on `ProcessPort`, so tests drive the supervisor with a fake port and a fake clock and never start a
|
|
4
|
+
* model (Principle 5).
|
|
5
|
+
*/
|
|
6
|
+
export interface SpawnSpec {
|
|
7
|
+
exe: string;
|
|
8
|
+
args: string[];
|
|
9
|
+
cwd: string;
|
|
10
|
+
env?: Record<string, string>;
|
|
11
|
+
/** Written to the process's stdin, then closed. */
|
|
12
|
+
stdin?: string;
|
|
13
|
+
/** Keep the process's stdout (its last `STDOUT_LIMIT` characters) and hand it back with the exit. */
|
|
14
|
+
captureStdout?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface ExitInfo {
|
|
17
|
+
code: number | null;
|
|
18
|
+
signal: string | null;
|
|
19
|
+
/** The captured stdout, when the spawn asked for it. */
|
|
20
|
+
stdout?: string;
|
|
21
|
+
}
|
|
22
|
+
/** A result object is small; the cap only stops a runaway process from growing memory without bound. */
|
|
23
|
+
export declare const STDOUT_LIMIT = 1000000;
|
|
24
|
+
export interface ProcessHandle {
|
|
25
|
+
pid: number | undefined;
|
|
26
|
+
alive(): boolean;
|
|
27
|
+
exited: Promise<ExitInfo>;
|
|
28
|
+
kill(signal?: "SIGTERM" | "SIGKILL"): void;
|
|
29
|
+
}
|
|
30
|
+
export interface ProcessPort {
|
|
31
|
+
spawn(spec: SpawnSpec): ProcessHandle;
|
|
32
|
+
/** Whether a process from an earlier session is still running (used by `--continue-run`). */
|
|
33
|
+
isAlive(pid: number): boolean;
|
|
34
|
+
/** Stop a process by pid, for a process this session did not spawn. */
|
|
35
|
+
kill(pid: number, signal?: "SIGTERM" | "SIGKILL"): void;
|
|
36
|
+
}
|
|
37
|
+
/** Windows ships assistants as `.cmd` shims, which `spawn` cannot run directly; resolve the executable first. */
|
|
38
|
+
export declare function resolveExecutable(exe: string, env?: Record<string, string | undefined>, platform?: NodeJS.Platform, exists?: (p: string) => boolean): string;
|
|
39
|
+
/** `.cmd` and `.bat` files must run through `cmd.exe`; everything else spawns directly. */
|
|
40
|
+
export declare function windowsCommand(resolved: string, args: string[]): {
|
|
41
|
+
exe: string;
|
|
42
|
+
args: string[];
|
|
43
|
+
verbatim: boolean;
|
|
44
|
+
};
|
|
45
|
+
export declare const nodeProcessPort: ProcessPort;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { win32 } from "node:path";
|
|
4
|
+
/** A result object is small; the cap only stops a runaway process from growing memory without bound. */
|
|
5
|
+
export const STDOUT_LIMIT = 1_000_000;
|
|
6
|
+
/** Windows ships assistants as `.cmd` shims, which `spawn` cannot run directly; resolve the executable first. */
|
|
7
|
+
export function resolveExecutable(exe, env = process.env, platform = process.platform, exists = existsSync) {
|
|
8
|
+
if (platform !== "win32")
|
|
9
|
+
return exe;
|
|
10
|
+
if (/[\\/]/.test(exe) && exists(exe))
|
|
11
|
+
return exe;
|
|
12
|
+
const exts = (env["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean);
|
|
13
|
+
const dirs = (env["PATH"] ?? env["Path"] ?? "").split(win32.delimiter).filter(Boolean);
|
|
14
|
+
for (const dir of dirs) {
|
|
15
|
+
for (const ext of ["", ...exts]) {
|
|
16
|
+
const candidate = win32.join(dir, exe + ext);
|
|
17
|
+
if (exists(candidate) && (ext !== "" || /\.[a-z]+$/i.test(exe)))
|
|
18
|
+
return candidate;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return exe;
|
|
22
|
+
}
|
|
23
|
+
/** `.cmd` and `.bat` files must run through `cmd.exe`; everything else spawns directly. */
|
|
24
|
+
export function windowsCommand(resolved, args) {
|
|
25
|
+
if (!/\.(cmd|bat)$/i.test(resolved))
|
|
26
|
+
return { exe: resolved, args, verbatim: false };
|
|
27
|
+
const quote = (a) => (/^[A-Za-z0-9_@%+=:,./\\-]+$/.test(a) ? a : `"${a.replace(/"/g, '""')}"`);
|
|
28
|
+
return { exe: "cmd.exe", args: ["/d", "/s", "/c", `"${[resolved, ...args].map(quote).join(" ")}"`], verbatim: true };
|
|
29
|
+
}
|
|
30
|
+
class NodeHandle {
|
|
31
|
+
child;
|
|
32
|
+
done = false;
|
|
33
|
+
exited;
|
|
34
|
+
constructor(child, capture = false) {
|
|
35
|
+
this.child = child;
|
|
36
|
+
let out = "";
|
|
37
|
+
if (capture) {
|
|
38
|
+
child.stdout?.setEncoding("utf8");
|
|
39
|
+
child.stdout?.on("data", (d) => {
|
|
40
|
+
out += d;
|
|
41
|
+
if (out.length > STDOUT_LIMIT)
|
|
42
|
+
out = out.slice(-STDOUT_LIMIT);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
this.exited = new Promise((resolve) => {
|
|
46
|
+
child.once("error", () => {
|
|
47
|
+
this.done = true;
|
|
48
|
+
resolve({ code: 127, signal: null });
|
|
49
|
+
});
|
|
50
|
+
// `close` comes after stdout has ended, so a captured result is complete; without capture `exit` is enough.
|
|
51
|
+
child.once(capture ? "close" : "exit", (code, signal) => {
|
|
52
|
+
this.done = true;
|
|
53
|
+
resolve({ code, signal, ...(capture ? { stdout: out } : {}) });
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
get pid() {
|
|
58
|
+
return this.child.pid;
|
|
59
|
+
}
|
|
60
|
+
alive() {
|
|
61
|
+
return !this.done;
|
|
62
|
+
}
|
|
63
|
+
kill(signal = "SIGTERM") {
|
|
64
|
+
if (this.done || this.child.pid === undefined)
|
|
65
|
+
return;
|
|
66
|
+
if (process.platform === "win32") {
|
|
67
|
+
// Windows has no signals: terminate the whole tree, as a shim spawns a child.
|
|
68
|
+
try {
|
|
69
|
+
spawn("taskkill", ["/pid", String(this.child.pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
this.child.kill();
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.child.kill(signal);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export const nodeProcessPort = {
|
|
80
|
+
spawn(spec) {
|
|
81
|
+
const resolved = windowsCommand(resolveExecutable(spec.exe), spec.args);
|
|
82
|
+
const child = spawn(resolved.exe, resolved.args, {
|
|
83
|
+
cwd: spec.cwd,
|
|
84
|
+
env: { ...process.env, ...(spec.env ?? {}) },
|
|
85
|
+
stdio: ["pipe", spec.captureStdout ? "pipe" : "ignore", "ignore"],
|
|
86
|
+
windowsHide: true,
|
|
87
|
+
windowsVerbatimArguments: resolved.verbatim,
|
|
88
|
+
});
|
|
89
|
+
child.stdin?.on("error", () => undefined);
|
|
90
|
+
child.stdin?.end(spec.stdin ?? "");
|
|
91
|
+
return new NodeHandle(child, spec.captureStdout === true);
|
|
92
|
+
},
|
|
93
|
+
isAlive(pid) {
|
|
94
|
+
try {
|
|
95
|
+
process.kill(pid, 0);
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
return err.code === "EPERM";
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
kill(pid, signal = "SIGTERM") {
|
|
103
|
+
try {
|
|
104
|
+
process.kill(pid, signal);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
/* already gone */
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=run-process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-process.js","sourceRoot":"","sources":["../../src/cli/run-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAA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H,CAAC;IACD,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;QAC1B,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,kBAAkB;QACpB,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JobKind, LaneRuntime, Session } from "./run-session.js";
|
|
2
|
+
/** The lane phase's `**Verify:**` line as written in the lane's own tasks.md; undefined when it has none. */
|
|
3
|
+
export declare function laneVerifyLine(rt: LaneRuntime): string | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Is this lane its phase's last stage? Read from the lane's own tasks.md (see `isLastStageOfPhase`); true when the file
|
|
6
|
+
* cannot be read, so a lane without one keeps the old rule (the phase's Verify line applies).
|
|
7
|
+
*/
|
|
8
|
+
export declare function laneIsLastStage(rt: LaneRuntime): boolean;
|
|
9
|
+
/** Where a reviewer writes its verdict, relative to the run directory (spec 019's contract). */
|
|
10
|
+
export declare function verdictFile(rt: LaneRuntime, role: "qa" | "architect", round: number): string;
|
|
11
|
+
/** The run directory as an absolute path with forward slashes, for prompts that run in a lane's checkout. */
|
|
12
|
+
export declare function absoluteRunDir(s: Session): string;
|
|
13
|
+
/**
|
|
14
|
+
* The QA or architect job's prompt: the role by `@` reference, the phase's Verify line (only on the phase's last stage;
|
|
15
|
+
* an earlier stage is judged on its own tasks), the verdict file.
|
|
16
|
+
*/
|
|
17
|
+
export declare function rolePromptText(s: Session, rt: LaneRuntime, job: JobKind): string;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { isLastStageOfPhase } from "../core/lanes.js";
|
|
4
|
+
import { readPhases, readTasks } from "../core/spec-format/dispatch.js";
|
|
5
|
+
import { runDir, verdictPath } from "../core/fleet/index.js";
|
|
6
|
+
import { buildRolePrompt } from "../core/run-prompt.js";
|
|
7
|
+
import { laneArtifacts } from "./run-plan.js";
|
|
8
|
+
import { sharesLastStage } from "./run-phase-check.js";
|
|
9
|
+
/** The lane phase's `**Verify:**` line as written in the lane's own tasks.md; undefined when it has none. */
|
|
10
|
+
export function laneVerifyLine(rt) {
|
|
11
|
+
const file = join(rt.ref.root, "specs", rt.ref.manifest.feature, "tasks.md");
|
|
12
|
+
if (!existsSync(file))
|
|
13
|
+
return undefined;
|
|
14
|
+
const phase = readPhases(readFileSync(file, "utf8")).find((p) => p.phase === rt.ref.manifest.phase);
|
|
15
|
+
return phase?.check ? `**Verify:** ${phase.check}` : undefined;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Is this lane its phase's last stage? Read from the lane's own tasks.md (see `isLastStageOfPhase`); true when the file
|
|
19
|
+
* cannot be read, so a lane without one keeps the old rule (the phase's Verify line applies).
|
|
20
|
+
*/
|
|
21
|
+
export function laneIsLastStage(rt) {
|
|
22
|
+
const file = join(rt.ref.root, "specs", rt.ref.manifest.feature, "tasks.md");
|
|
23
|
+
if (!existsSync(file))
|
|
24
|
+
return true;
|
|
25
|
+
const tasks = readTasks(readFileSync(file, "utf8")).tasks;
|
|
26
|
+
return isLastStageOfPhase(tasks, rt.ref.manifest.tasks.map((t) => t.id), rt.ref.manifest.phase);
|
|
27
|
+
}
|
|
28
|
+
/** Where a reviewer writes its verdict, relative to the run directory (spec 019's contract). */
|
|
29
|
+
export function verdictFile(rt, role, round) {
|
|
30
|
+
return verdictPath(rt.file.lane, role, round);
|
|
31
|
+
}
|
|
32
|
+
/** The run directory as an absolute path with forward slashes, for prompts that run in a lane's checkout. */
|
|
33
|
+
export function absoluteRunDir(s) {
|
|
34
|
+
return runDir(s.root, s.run).replace(/\\/g, "/");
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The QA or architect job's prompt: the role by `@` reference, the phase's Verify line (only on the phase's last stage;
|
|
38
|
+
* an earlier stage is judged on its own tasks), the verdict file.
|
|
39
|
+
*/
|
|
40
|
+
export function rolePromptText(s, rt, job) {
|
|
41
|
+
const role = job === "architect" ? "architect" : "qa";
|
|
42
|
+
// one of several parallel lanes of the last stage: the phase's Verify line runs once on the merged code (G3)
|
|
43
|
+
const shared = sharesLastStage(s, rt);
|
|
44
|
+
const last = laneIsLastStage(rt) && !shared;
|
|
45
|
+
const verify = last ? laneVerifyLine(rt) : undefined;
|
|
46
|
+
return buildRolePrompt({
|
|
47
|
+
role,
|
|
48
|
+
feature: rt.ref.manifest.feature,
|
|
49
|
+
lane: rt.ref.name,
|
|
50
|
+
phase: rt.ref.manifest.phase,
|
|
51
|
+
round: rt.round,
|
|
52
|
+
run: s.run,
|
|
53
|
+
roleFile: `.amby/roles/${role}.md`,
|
|
54
|
+
...(verify ? { verify } : {}),
|
|
55
|
+
...(last ? {} : { stageTasks: rt.ref.manifest.tasks.map((t) => t.id) }),
|
|
56
|
+
...(shared ? { sharedStage: true } : {}),
|
|
57
|
+
artifacts: laneArtifacts(rt.ref),
|
|
58
|
+
verdictFile: verdictFile(rt, role, rt.round),
|
|
59
|
+
// absolute: the reviewer runs in the lane's checkout, but the supervisor reads the run directory of the project root
|
|
60
|
+
runDir: absoluteRunDir(s),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=run-protocol-prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-protocol-prompts.js","sourceRoot":"","sources":["../../src/cli/run-protocol-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM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C,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QACvE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxC,SAAS,EAAE,aAAa,CAAC,EAAE,CAAC,GAAG,CAAC;QAChC,WAAW,EAAE,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC;QAC5C,qHAAqH;QACrH,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;KAC1B,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type LaneRuntime, type Session } from "./run-session.js";
|
|
2
|
+
/**
|
|
3
|
+
* The team protocol as processes (feature 028, FR-018): the same QA, architect and review loop `/amby.run`
|
|
4
|
+
* runs at prompt level, with each reviewer launched as a process of the lane's own assistant. A finished lane
|
|
5
|
+
* is reviewed by QA, then the architect; either one's failure goes back to the *same lane's worker* as finding
|
|
6
|
+
* IDs only; after `fleet.roundLimit` failed rounds the loop stops and asks a person. Only a lane that passes
|
|
7
|
+
* both becomes `ready` to merge, so a failing Verify line can never reach the merger (SC-009).
|
|
8
|
+
*/
|
|
9
|
+
/** Move every finished or reviewing lane one step along the loop. */
|
|
10
|
+
export declare function advanceReviews(s: Session, review: boolean): void;
|
|
11
|
+
/**
|
|
12
|
+
* Where the reviewer's verdict is: the run directory (the prompt gives its absolute path), or, when a reviewer wrote the
|
|
13
|
+
* same relative path inside the lane's checkout it runs in, that copy (the 2.0 dogfood: a relative path in the prompt
|
|
14
|
+
* made every verdict land in the lane, and the run reported "no verdict"). A copy in the lane is moved into the run
|
|
15
|
+
* directory, so the lane's checkout stays clean and can merge. Null when neither exists.
|
|
16
|
+
*/
|
|
17
|
+
export declare function verdictLocation(s: Session, rt: LaneRuntime, role: "qa" | "architect"): string | null;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, renameSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { parseVerdict, readRun, runDir, runDirRel, updateRun } from "../core/fleet/index.js";
|
|
4
|
+
import { escalate } from "../core/run-gate-actions.js";
|
|
5
|
+
import { reviewStep } from "../core/run-review.js";
|
|
6
|
+
import { addTaskEvents } from "./run-budget.js";
|
|
7
|
+
import { startJob } from "./run-launch.js";
|
|
8
|
+
import { verdictFile } from "./run-protocol-prompts.js";
|
|
9
|
+
import { event, isRunning, save } from "./run-session.js";
|
|
10
|
+
import { jobHeld } from "./run-control.js";
|
|
11
|
+
/**
|
|
12
|
+
* The team protocol as processes (feature 028, FR-018): the same QA, architect and review loop `/amby.run`
|
|
13
|
+
* runs at prompt level, with each reviewer launched as a process of the lane's own assistant. A finished lane
|
|
14
|
+
* is reviewed by QA, then the architect; either one's failure goes back to the *same lane's worker* as finding
|
|
15
|
+
* IDs only; after `fleet.roundLimit` failed rounds the loop stops and asks a person. Only a lane that passes
|
|
16
|
+
* both becomes `ready` to merge, so a failing Verify line can never reach the merger (SC-009).
|
|
17
|
+
*/
|
|
18
|
+
/** Move every finished or reviewing lane one step along the loop. */
|
|
19
|
+
export function advanceReviews(s, review) {
|
|
20
|
+
for (const rt of s.lanes) {
|
|
21
|
+
if (rt.file.status === "finished") {
|
|
22
|
+
if (!review) {
|
|
23
|
+
rt.file.status = "ready";
|
|
24
|
+
save(s, rt);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (jobHeld(s, rt))
|
|
28
|
+
continue; // paused or stopped: no review starts until the lane is resumed
|
|
29
|
+
rt.stage = rt.resumeStage ?? "qa";
|
|
30
|
+
delete rt.resumeStage;
|
|
31
|
+
rt.round = rt.round || 1;
|
|
32
|
+
begin(s, rt);
|
|
33
|
+
}
|
|
34
|
+
else if (rt.file.status === "reviewing" && rt.job !== "worker" && !isRunning(s, rt) && rt.exit) {
|
|
35
|
+
judge(s, rt);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function begin(s, rt) {
|
|
40
|
+
recordStage(s, rt);
|
|
41
|
+
if (!startJob(s, rt, rt.stage ?? "qa"))
|
|
42
|
+
return;
|
|
43
|
+
event(s, "review-started", rt, `${rt.stage} round ${rt.round}`);
|
|
44
|
+
}
|
|
45
|
+
function recordStage(s, rt) {
|
|
46
|
+
if (!readRun(s.root, s.run))
|
|
47
|
+
return;
|
|
48
|
+
updateRun(s.root, s.run, { stage: rt.stage ?? "working", round: rt.round });
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Where the reviewer's verdict is: the run directory (the prompt gives its absolute path), or, when a reviewer wrote the
|
|
52
|
+
* same relative path inside the lane's checkout it runs in, that copy (the 2.0 dogfood: a relative path in the prompt
|
|
53
|
+
* made every verdict land in the lane, and the run reported "no verdict"). A copy in the lane is moved into the run
|
|
54
|
+
* directory, so the lane's checkout stays clean and can merge. Null when neither exists.
|
|
55
|
+
*/
|
|
56
|
+
export function verdictLocation(s, rt, role) {
|
|
57
|
+
const name = verdictFile(rt, role, rt.round);
|
|
58
|
+
const main = join(runDir(s.root, s.run), name);
|
|
59
|
+
if (existsSync(main))
|
|
60
|
+
return main;
|
|
61
|
+
const inLane = join(rt.ref.root, runDirRel(s.root, s.run), name);
|
|
62
|
+
if (!existsSync(inLane))
|
|
63
|
+
return null;
|
|
64
|
+
mkdirSync(dirname(main), { recursive: true });
|
|
65
|
+
renameSync(inLane, main);
|
|
66
|
+
return main;
|
|
67
|
+
}
|
|
68
|
+
function judge(s, rt) {
|
|
69
|
+
if (s.stopReason) {
|
|
70
|
+
// the reviewer was stopped, not finished: review this lane again when the run is continued
|
|
71
|
+
delete rt.exit;
|
|
72
|
+
delete rt.handle;
|
|
73
|
+
delete rt.file.pid;
|
|
74
|
+
rt.file.status = "finished";
|
|
75
|
+
save(s, rt);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const role = rt.stage ?? "qa";
|
|
79
|
+
const limit = readRun(s.root, s.run)?.limit || s.settings.roundLimit;
|
|
80
|
+
const path = verdictLocation(s, rt, role);
|
|
81
|
+
const verdict = path ? parseVerdict(readFileSync(path, "utf8")) : null;
|
|
82
|
+
const step = reviewStep({ stage: role, round: rt.round, failedRounds: rt.file.failedRounds ?? 0, limit, reviewerDone: true, verdict });
|
|
83
|
+
delete rt.exit;
|
|
84
|
+
delete rt.handle;
|
|
85
|
+
delete rt.file.pid;
|
|
86
|
+
if (step.kind === "advance") {
|
|
87
|
+
rt.stage = "architect";
|
|
88
|
+
event(s, "review-passed", rt, `${role} round ${rt.round}`);
|
|
89
|
+
if (jobHeld(s, rt)) {
|
|
90
|
+
// paused: the architect review starts when the lane is resumed (the lane waits as finished, at this stage)
|
|
91
|
+
rt.resumeStage = "architect";
|
|
92
|
+
rt.file.status = "finished";
|
|
93
|
+
save(s, rt);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
begin(s, rt);
|
|
97
|
+
}
|
|
98
|
+
else if (step.kind === "pass") {
|
|
99
|
+
rt.file.status = "ready";
|
|
100
|
+
delete rt.stage;
|
|
101
|
+
save(s, rt);
|
|
102
|
+
recordStage(s, rt);
|
|
103
|
+
event(s, "review-passed", rt, `${role} round ${rt.round}; ready to merge`);
|
|
104
|
+
s.say(`${rt.file.lane}: reviews passed`);
|
|
105
|
+
}
|
|
106
|
+
else if (step.kind === "fix") {
|
|
107
|
+
rt.file.failedRounds = step.failedRounds;
|
|
108
|
+
rt.pendingFindings = step.findings;
|
|
109
|
+
rt.round += 1;
|
|
110
|
+
rt.stage = "qa";
|
|
111
|
+
rt.file.status = "queued";
|
|
112
|
+
save(s, rt);
|
|
113
|
+
addTaskEvents(s, 1);
|
|
114
|
+
event(s, "review-failed", rt, `${role} found ${step.findings.join(", ")}; sent back to the worker`);
|
|
115
|
+
s.say(`${rt.file.lane}: ${role} review failed (${step.findings.join(", ")}); back to the worker`);
|
|
116
|
+
}
|
|
117
|
+
else if (step.kind === "escalate") {
|
|
118
|
+
rt.file.status = "escalated";
|
|
119
|
+
rt.file.pausedAt = new Date(s.now()).toISOString();
|
|
120
|
+
rt.file.failedRounds = step.failedRounds;
|
|
121
|
+
rt.file.reason = step.reason;
|
|
122
|
+
save(s, rt);
|
|
123
|
+
escalate(s.root, s.run, { kind: "review", lane: rt.file.lane, reason: step.reason, findings: step.findings, rounds: step.failedRounds });
|
|
124
|
+
event(s, "escalated", rt, step.reason);
|
|
125
|
+
s.say(`${rt.file.lane}: ${step.reason}. A person decides.`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=run-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-protocol.js","sourceRoot":"","sources":["../../src/cli/run-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAA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-0,0 +1,11 @@
|
|
|
1
|
+
import type { LaunchEntry } from "../core/run-launch-plan.js";
|
|
2
|
+
export declare function shellScript(feature: string, plan: LaunchEntry[], batch: number): string;
|
|
3
|
+
export declare function powershellScript(feature: string, plan: LaunchEntry[], batch: number): string;
|
|
4
|
+
export interface EmittedScripts {
|
|
5
|
+
dir: string;
|
|
6
|
+
sh: string;
|
|
7
|
+
ps1: string;
|
|
8
|
+
prompts: string[];
|
|
9
|
+
}
|
|
10
|
+
/** Write the two scripts and the prompt files they read. Returns the paths; spawns nothing. */
|
|
11
|
+
export declare function emitScripts(root: string, feature: string, plan: LaunchEntry[], batch: number): EmittedScripts;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { primaryRoot } from "../core/checkouts.js";
|
|
4
|
+
import { FLEET_DIR, ensureFleetRoot } from "../core/fleet/runs.js";
|
|
5
|
+
import { withStability } from "../core/run-stability.js";
|
|
6
|
+
/**
|
|
7
|
+
* `--emit-script` (feature 028, FR-003): write the plan as `launch.sh` and `launch.ps1`, launching nothing.
|
|
8
|
+
* The scripts start the lanes in batches of `batch` (the total cap) and wait between batches, and they read
|
|
9
|
+
* each prompt from its file, so a person can review and edit both before running them. Project-local only
|
|
10
|
+
* (FR-020). The directory is `.amby/fleet/<feature>.scripts/`: it is not a run (no `run.json`), so emitting a
|
|
11
|
+
* script never blocks a later run.
|
|
12
|
+
*/
|
|
13
|
+
const sh = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
|
|
14
|
+
const ps = (s) => `'${s.replace(/'/g, "''")}'`;
|
|
15
|
+
export function shellScript(feature, plan, batch) {
|
|
16
|
+
const lines = ["#!/bin/sh", `# ${withStability(`ambykit run --emit-script for ${feature}`)}. Review before running; nothing has been launched.`, "set -e"];
|
|
17
|
+
let n = 0;
|
|
18
|
+
for (const e of plan) {
|
|
19
|
+
if (!e.command)
|
|
20
|
+
continue;
|
|
21
|
+
const cmd = [e.command.exe, ...e.command.args].map(sh).join(" ");
|
|
22
|
+
const stdin = e.command.stdin !== undefined ? ` < ${sh(e.promptFile)}` : "";
|
|
23
|
+
lines.push(`(cd ${sh(e.cwd)} && ${cmd}${stdin}) &`);
|
|
24
|
+
n += 1;
|
|
25
|
+
if (n % batch === 0)
|
|
26
|
+
lines.push("wait");
|
|
27
|
+
}
|
|
28
|
+
if (n % batch !== 0)
|
|
29
|
+
lines.push("wait");
|
|
30
|
+
return lines.join("\n") + "\n";
|
|
31
|
+
}
|
|
32
|
+
export function powershellScript(feature, plan, batch) {
|
|
33
|
+
const lines = [`# ${withStability(`ambykit run --emit-script for ${feature}`)}. Review before running; nothing has been launched.`, "$ErrorActionPreference = 'Stop'", "$jobs = @()"];
|
|
34
|
+
let n = 0;
|
|
35
|
+
for (const e of plan) {
|
|
36
|
+
if (!e.command)
|
|
37
|
+
continue;
|
|
38
|
+
const args = e.command.args.map(ps).join(", ");
|
|
39
|
+
const stdin = e.command.stdin !== undefined ? ` -RedirectStandardInput ${ps(e.promptFile)}` : "";
|
|
40
|
+
lines.push(`$jobs += Start-Process -FilePath ${ps(e.command.exe)} -ArgumentList @(${args}) -WorkingDirectory ${ps(e.cwd)}${stdin} -NoNewWindow -PassThru`);
|
|
41
|
+
n += 1;
|
|
42
|
+
if (n % batch === 0)
|
|
43
|
+
lines.push("$jobs | Wait-Process", "$jobs = @()");
|
|
44
|
+
}
|
|
45
|
+
if (n % batch !== 0)
|
|
46
|
+
lines.push("$jobs | Wait-Process");
|
|
47
|
+
return lines.join("\r\n") + "\r\n";
|
|
48
|
+
}
|
|
49
|
+
/** Write the two scripts and the prompt files they read. Returns the paths; spawns nothing. */
|
|
50
|
+
export function emitScripts(root, feature, plan, batch) {
|
|
51
|
+
const dir = join(primaryRoot(root), FLEET_DIR, `${feature}.scripts`);
|
|
52
|
+
mkdirSync(join(dir, "prompts"), { recursive: true });
|
|
53
|
+
writeFileSync(join(primaryRoot(root), FLEET_DIR, ".gitignore"), "# AmbyKit fleet state (local only)\n*\n", { flag: "a" });
|
|
54
|
+
const prompts = [];
|
|
55
|
+
const local = plan.map((e) => {
|
|
56
|
+
const file = join(dir, "prompts", `${e.lane}.md`);
|
|
57
|
+
writeFileSync(file, e.prompt.endsWith("\n") ? e.prompt : `${e.prompt}\n`, "utf8");
|
|
58
|
+
prompts.push(file);
|
|
59
|
+
return { ...e, promptFile: file };
|
|
60
|
+
});
|
|
61
|
+
const shPath = join(dir, "launch.sh");
|
|
62
|
+
const psPath = join(dir, "launch.ps1");
|
|
63
|
+
writeFileSync(shPath, shellScript(feature, local, batch), { encoding: "utf8", mode: 0o755 });
|
|
64
|
+
writeFileSync(psPath, powershellScript(feature, local, batch), "utf8");
|
|
65
|
+
return { dir, sh: shPath, ps1: psPath, prompts };
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=run-script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-script.js","sourceRoot":"","sources":["../../src/cli/run-script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;;;;;GAMG;AAEH,MAAM,EAAE,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AAClE,MAAM,EAAE,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;AAE/D,MAAM,UAAU,WAAW,CAAC,O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