@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,93 @@
|
|
|
1
|
+
import type { FleetSettings } from "../core/config.js";
|
|
2
|
+
import type { LaneRef } from "../core/query.js";
|
|
3
|
+
import type { RunnerSpec } from "../core/runners.js";
|
|
4
|
+
import type { Budgets } from "../core/run-supervise.js";
|
|
5
|
+
import { type LaneFile } from "./run-files.js";
|
|
6
|
+
import type { ExitInfo, ProcessHandle, ProcessPort } from "./run-process.js";
|
|
7
|
+
import type { PhaseCheckJob } from "./run-phase-check.js";
|
|
8
|
+
/**
|
|
9
|
+
* The state one supervisor process keeps while it runs a feature (feature 028). Everything durable is in
|
|
10
|
+
* `.amby/fleet/<run>/` (spec 025's `run.json` plus 028's lane files, events and budget meter); this object
|
|
11
|
+
* holds only what cannot be: live process handles and clocks. Modules take a `Session` and a lane runtime, so
|
|
12
|
+
* each concern (launch, supervise, merge, budget, gates, control, protocol) stays independently testable.
|
|
13
|
+
*/
|
|
14
|
+
export type JobKind = "worker" | "qa" | "architect";
|
|
15
|
+
export interface LaneRuntime {
|
|
16
|
+
ref: LaneRef;
|
|
17
|
+
assistant: string;
|
|
18
|
+
file: LaneFile;
|
|
19
|
+
/** What the current (or last) process is doing. */
|
|
20
|
+
job: JobKind;
|
|
21
|
+
/** Review round the lane is in (1-based), once its tasks are done. */
|
|
22
|
+
round: number;
|
|
23
|
+
/** Set once the lane's tasks are done and the review loop has begun. */
|
|
24
|
+
stage?: "qa" | "architect";
|
|
25
|
+
handle?: ProcessHandle;
|
|
26
|
+
startedMs?: number;
|
|
27
|
+
exit?: ExitInfo;
|
|
28
|
+
exitedMs?: number;
|
|
29
|
+
/** When a stop was asked for (budget or person), for the stop grace. */
|
|
30
|
+
stopAskedMs?: number;
|
|
31
|
+
/** Review finding IDs to send back to the worker at its next start. */
|
|
32
|
+
pendingFindings?: string[];
|
|
33
|
+
/** A review step that came due while the lane was paused (the architect after a passed QA): it starts on resume. */
|
|
34
|
+
resumeStage?: "qa" | "architect";
|
|
35
|
+
/** The directive `at` last recorded as obeyed, so it is recorded once. */
|
|
36
|
+
obeyedAt?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface Session {
|
|
39
|
+
root: string;
|
|
40
|
+
feature: string;
|
|
41
|
+
run: string;
|
|
42
|
+
settings: FleetSettings;
|
|
43
|
+
budgets: Budgets;
|
|
44
|
+
registry: RunnerSpec[];
|
|
45
|
+
port: ProcessPort;
|
|
46
|
+
now: () => number;
|
|
47
|
+
/** Human-readable progress line. */
|
|
48
|
+
say: (line: string) => void;
|
|
49
|
+
lanes: LaneRuntime[];
|
|
50
|
+
unattended: boolean;
|
|
51
|
+
/** Set when a budget stop is in force: nothing new launches. */
|
|
52
|
+
stopReason?: string;
|
|
53
|
+
/** True when every runner of the run reports usage (token ceilings are enforceable). */
|
|
54
|
+
reportsUsage: boolean;
|
|
55
|
+
/** Prompts for a decision in the foreground (TTY), when one is available. */
|
|
56
|
+
ask?: (question: string) => Promise<boolean | undefined>;
|
|
57
|
+
/**
|
|
58
|
+
* Feature 031: the lanes running in the OTHER sessions of the same fleet. They count toward the total and
|
|
59
|
+
* per-type caps, so the caps hold across the fleet. Absent (a single run) means today's behavior exactly.
|
|
60
|
+
*/
|
|
61
|
+
slots?: () => {
|
|
62
|
+
lane: string;
|
|
63
|
+
assistant: string;
|
|
64
|
+
}[];
|
|
65
|
+
/**
|
|
66
|
+
* Prepare the feature's next stage once every lane has merged (the 2.0 dogfood: sequential tasks must run too). The
|
|
67
|
+
* supervisor adds the returned lanes and keeps going; `none` = every task is done. Absent = the 1.6 behaviour: the run
|
|
68
|
+
* ends when its prepared lanes have merged.
|
|
69
|
+
*/
|
|
70
|
+
prepareNext?: (merged: ReadonlySet<string>) => NextStage;
|
|
71
|
+
/** The phase check running on the merged code (dogfood G3; see `run-phase-check.ts`), when one is. */
|
|
72
|
+
phaseCheck?: PhaseCheckJob;
|
|
73
|
+
}
|
|
74
|
+
export type NextStage = {
|
|
75
|
+
kind: "none";
|
|
76
|
+
} | {
|
|
77
|
+
kind: "planned";
|
|
78
|
+
phase: number;
|
|
79
|
+
stage: "serial" | "parallel";
|
|
80
|
+
lanes: {
|
|
81
|
+
ref: LaneRef;
|
|
82
|
+
assistant: string;
|
|
83
|
+
}[];
|
|
84
|
+
} | {
|
|
85
|
+
kind: "failed";
|
|
86
|
+
reason: string;
|
|
87
|
+
};
|
|
88
|
+
/** Persist a lane's file after changing it. */
|
|
89
|
+
export declare function save(s: Session, rt: LaneRuntime): void;
|
|
90
|
+
export declare function event(s: Session, kind: string, rt?: LaneRuntime, detail?: string): void;
|
|
91
|
+
/** Whether a lane's process is running now (this session's handle, or a pid from an earlier session). */
|
|
92
|
+
export declare function isRunning(s: Session, rt: LaneRuntime): boolean;
|
|
93
|
+
export declare function stopProcess(s: Session, rt: LaneRuntime, signal?: "SIGTERM" | "SIGKILL"): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { appendEvent, writeLaneFile } from "./run-files.js";
|
|
2
|
+
/** Persist a lane's file after changing it. */
|
|
3
|
+
export function save(s, rt) {
|
|
4
|
+
writeLaneFile(s.root, s.run, rt.file);
|
|
5
|
+
}
|
|
6
|
+
export function event(s, kind, rt, detail) {
|
|
7
|
+
appendEvent(s.root, s.run, { at: new Date(s.now()).toISOString(), kind, ...(rt ? { lane: rt.file.lane } : {}), ...(detail ? { detail } : {}) });
|
|
8
|
+
}
|
|
9
|
+
/** Whether a lane's process is running now (this session's handle, or a pid from an earlier session). */
|
|
10
|
+
export function isRunning(s, rt) {
|
|
11
|
+
if (rt.handle)
|
|
12
|
+
return rt.handle.alive();
|
|
13
|
+
return rt.file.pid !== undefined && rt.file.status === "running" && s.port.isAlive(rt.file.pid);
|
|
14
|
+
}
|
|
15
|
+
export function stopProcess(s, rt, signal = "SIGTERM") {
|
|
16
|
+
if (rt.handle)
|
|
17
|
+
rt.handle.kill(signal);
|
|
18
|
+
else if (rt.file.pid !== undefined)
|
|
19
|
+
s.port.kill(rt.file.pid, signal);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=run-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-session.js","sourceRoot":"","sources":["../../src/cli/run-session.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAiB,MAAM,gBAAgB,CAAC;AA4E3E,+CAA+C;AAC/C,MAAM,UAAU,IAAI,CAAC,CAAU,EAAE,EAAe;IAC9C,aAAa,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,CAAU,EAAE,IAAY,EAAE,EAAgB,EAAE,MAAe;IAC/E,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAClJ,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,SAAS,CAAC,CAAU,EAAE,EAAe;IACnD,IAAI,EAAE,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACxC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClG,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,CAAU,EAAE,EAAe,EAAE,MAAM,GAA0B,SAAS;IAChG,IAAI,EAAE,CAAC,MAAM;QAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACjC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS;QAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NextStage } from "./run-session.js";
|
|
2
|
+
/**
|
|
3
|
+
* Stage preparation for `ambykit run` (the 2.0 dogfood). A run used to cover only the `[P]` lanes prepared before it
|
|
4
|
+
* started, so a feature's sequential tasks never ran. Now, whenever every lane has merged, the supervisor asks for the
|
|
5
|
+
* next stage: `createNextStage` (the same code as `ambykit lane --next`) plans it from the feature branch's merged
|
|
6
|
+
* `tasks.md` and creates its worktrees; the lanes are spread over the run's assistants round-robin.
|
|
7
|
+
*/
|
|
8
|
+
export declare function stagePreparer(root: string, feature: string, opts: {
|
|
9
|
+
lanes: number;
|
|
10
|
+
assistants: readonly string[];
|
|
11
|
+
}): (merged?: ReadonlySet<string>) => NextStage;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { primaryRoot } from "../core/checkouts.js";
|
|
2
|
+
import { laneRefs } from "../core/query.js";
|
|
3
|
+
import { assignAssistants } from "../core/run-launch-plan.js";
|
|
4
|
+
import { createNextStage } from "./lane.js";
|
|
5
|
+
/**
|
|
6
|
+
* Stage preparation for `ambykit run` (the 2.0 dogfood). A run used to cover only the `[P]` lanes prepared before it
|
|
7
|
+
* started, so a feature's sequential tasks never ran. Now, whenever every lane has merged, the supervisor asks for the
|
|
8
|
+
* next stage: `createNextStage` (the same code as `ambykit lane --next`) plans it from the feature branch's merged
|
|
9
|
+
* `tasks.md` and creates its worktrees; the lanes are spread over the run's assistants round-robin.
|
|
10
|
+
*/
|
|
11
|
+
export function stagePreparer(root, feature, opts) {
|
|
12
|
+
return (merged) => {
|
|
13
|
+
const home = primaryRoot(root);
|
|
14
|
+
let out;
|
|
15
|
+
try {
|
|
16
|
+
out = createNextStage(home, feature, { lanes: opts.lanes, ...(merged ? { done: merged } : {}) });
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
return { kind: "failed", reason: err.message.split("\n")[0] ?? "the next stage could not be prepared" };
|
|
20
|
+
}
|
|
21
|
+
if (!out.ok)
|
|
22
|
+
return { kind: "failed", reason: out.error };
|
|
23
|
+
if (out.status === "done")
|
|
24
|
+
return { kind: "none" };
|
|
25
|
+
const names = new Set(out.lanes.map((l) => l.name));
|
|
26
|
+
const refs = laneRefs(home, feature)
|
|
27
|
+
.filter((r) => names.has(r.name))
|
|
28
|
+
.sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true }));
|
|
29
|
+
const assistants = opts.assistants.length > 0 ? [...opts.assistants] : ["claude"];
|
|
30
|
+
const assign = assignAssistants(refs.map((r) => r.short), assistants);
|
|
31
|
+
return { kind: "planned", phase: out.phase, stage: out.kind, lanes: refs.map((ref) => ({ ref, assistant: assign.get(ref.short) ?? assistants[0] })) };
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=run-stages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-stages.js","source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ACpD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;aACjC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aAChC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC9E,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAClF,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;QACtE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC,EAAE,CAAC;IACzJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type LaneRuntime, type Session } from "./run-session.js";
|
|
2
|
+
/**
|
|
3
|
+
* The supervisor (feature 028, FR-008..FR-010): what happens when a lane's process ends, and when it goes
|
|
4
|
+
* quiet. *Whether a lane is stalled* is spec 025's `laneStatus`: no report and no `tasks.md` change for
|
|
5
|
+
* `fleet.stallMinutes`, with waiting, blocked, paused and done lanes exempt. 028 keeps no stall logic of its
|
|
6
|
+
* own; it only restarts (work preserved: the prompt lists the unchecked tasks) or pauses at the limit.
|
|
7
|
+
*/
|
|
8
|
+
/** Record how a worker's process ended: finished, unfinished, or failed at once (a command mismatch). */
|
|
9
|
+
export declare function collectExits(s: Session): void;
|
|
10
|
+
/** Detect stalled workers and restart them or pause them at the restart limit (FR-008, FR-009, FR-010). */
|
|
11
|
+
export declare function superviseStalls(s: Session): void;
|
|
12
|
+
/** Keep spec 025's `lanes[].restarts` equal to the lane file's (the run record is what other hosts read). */
|
|
13
|
+
export declare function syncRunLane(s: Session, rt: LaneRuntime): void;
|
|
14
|
+
/** After a stop was asked for, terminate a lane that still has not reported once the stop grace is over. */
|
|
15
|
+
export declare function enforceStopGrace(s: Session): void;
|
|
16
|
+
/**
|
|
17
|
+
* A process from an earlier session (`--continue-run`) has no handle to tell us how it ended. When its pid is
|
|
18
|
+
* gone, record an exit with no code so the normal rules classify it (finished, or unfinished with tasks open).
|
|
19
|
+
*/
|
|
20
|
+
export declare function noteAdoptedExits(s: Session): void;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { laneStatus, readDirective, readRun, updateRun } from "../core/fleet/index.js";
|
|
2
|
+
import { isFailed } from "../core/query.js";
|
|
3
|
+
import { escalate } from "../core/run-gate-actions.js";
|
|
4
|
+
import { isImmediateFailure, mustTerminate, restartDecision } from "../core/run-supervise.js";
|
|
5
|
+
import { startJob } from "./run-launch.js";
|
|
6
|
+
import { laneOpenTasks } from "./run-plan.js";
|
|
7
|
+
import { event, isRunning, save, stopProcess } from "./run-session.js";
|
|
8
|
+
import { addTaskEvents, addTokens } from "./run-budget.js";
|
|
9
|
+
import { deniedSummary } from "../core/run-result.js";
|
|
10
|
+
/**
|
|
11
|
+
* The supervisor (feature 028, FR-008..FR-010): what happens when a lane's process ends, and when it goes
|
|
12
|
+
* quiet. *Whether a lane is stalled* is spec 025's `laneStatus`: no report and no `tasks.md` change for
|
|
13
|
+
* `fleet.stallMinutes`, with waiting, blocked, paused and done lanes exempt. 028 keeps no stall logic of its
|
|
14
|
+
* own; it only restarts (work preserved: the prompt lists the unchecked tasks) or pauses at the limit.
|
|
15
|
+
*/
|
|
16
|
+
/** Record how a worker's process ended: finished, unfinished, or failed at once (a command mismatch). */
|
|
17
|
+
export function collectExits(s) {
|
|
18
|
+
for (const rt of s.lanes) {
|
|
19
|
+
if (rt.job !== "worker" || rt.file.status !== "running" || !rt.exit || rt.exitedMs === undefined)
|
|
20
|
+
continue;
|
|
21
|
+
const exit = rt.exit;
|
|
22
|
+
const ranMs = rt.exitedMs - (rt.startedMs ?? rt.exitedMs);
|
|
23
|
+
rt.file.exit = { code: exit.code, signal: exit.signal };
|
|
24
|
+
rt.file.exitedAt = new Date(rt.exitedMs).toISOString();
|
|
25
|
+
delete rt.handle;
|
|
26
|
+
delete rt.file.pid;
|
|
27
|
+
const open = laneOpenTasks(rt.ref);
|
|
28
|
+
// 033 (live check): the runner's own result, when it writes one. Exit 0 alone does not prove the lane did its work.
|
|
29
|
+
const runner = s.registry.find((r) => r.id === rt.assistant);
|
|
30
|
+
const result = runner?.readResult && exit.stdout !== undefined ? runner.readResult(exit.stdout) : undefined;
|
|
31
|
+
if (result?.usage) {
|
|
32
|
+
addTokens(s, result.usage.tokens);
|
|
33
|
+
const cost = result.usage.costUSD !== undefined ? `, $${result.usage.costUSD.toFixed(4)}` : "";
|
|
34
|
+
event(s, "usage", rt, `${result.usage.tokens} tokens (${result.usage.inputTokens} in, ${result.usage.outputTokens} out${cost})`);
|
|
35
|
+
}
|
|
36
|
+
const denied = result ? deniedSummary(result) : undefined;
|
|
37
|
+
if (result?.failed && rt.stopAskedMs === undefined) {
|
|
38
|
+
rt.file.status = "failed";
|
|
39
|
+
rt.file.reason = `the ${rt.assistant} turn failed: ${result.failed}${denied ? `; refused tools: ${denied}` : ""}`;
|
|
40
|
+
event(s, "failed", rt, rt.file.reason);
|
|
41
|
+
s.say(`${rt.file.lane}: ${rt.file.reason}. It will not be merged.`);
|
|
42
|
+
}
|
|
43
|
+
else if (open.length === 0) {
|
|
44
|
+
rt.file.status = "finished";
|
|
45
|
+
rt.round = rt.round || 1;
|
|
46
|
+
event(s, "finished", rt, denied ? `every task is checked off (refused along the way: ${denied})` : "every task is checked off");
|
|
47
|
+
s.say(`${rt.file.lane}: finished`);
|
|
48
|
+
}
|
|
49
|
+
else if (rt.stopAskedMs !== undefined) {
|
|
50
|
+
// asked to stop (a directive or a budget): the exit is the obeying, not a failure
|
|
51
|
+
rt.file.status = "stopped";
|
|
52
|
+
event(s, "stopped", rt, `${open.length} task(s) left open`);
|
|
53
|
+
}
|
|
54
|
+
else if (pauseOrStop(s, rt)) {
|
|
55
|
+
// a worker that ends its turn after a pause or stop directive is obeying it, not failing (FR-016)
|
|
56
|
+
const d = pauseOrStop(s, rt);
|
|
57
|
+
rt.file.status = d.action === "stop" ? "stopped" : "paused";
|
|
58
|
+
rt.file.pausedAt = d.at;
|
|
59
|
+
event(s, "exited", rt, `after a ${d.action} directive, ${open.length} task(s) open`);
|
|
60
|
+
}
|
|
61
|
+
else if (denied) {
|
|
62
|
+
// the assistant ended its turn because it could not do the work: say which tools, so the runner command can be fixed
|
|
63
|
+
rt.file.status = "failed";
|
|
64
|
+
rt.file.reason = `the ${rt.assistant} turn ended with ${open.length} task(s) still open after these tools were refused: ${denied}`;
|
|
65
|
+
event(s, "failed", rt, rt.file.reason);
|
|
66
|
+
s.say(`${rt.file.lane}: ${rt.file.reason}. It will not be merged.`);
|
|
67
|
+
}
|
|
68
|
+
else if (isImmediateFailure({ code: exit.code, ranMs })) {
|
|
69
|
+
rt.file.status = "failed";
|
|
70
|
+
rt.file.reason = `the ${rt.assistant} command exited at once with code ${exit.code ?? "none"}; its recorded command may no longer match the installed version (see docs/tool-compatibility.md)`;
|
|
71
|
+
event(s, "failed", rt, rt.file.reason);
|
|
72
|
+
s.say(`${rt.file.lane}: ${rt.file.reason}`);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
rt.file.status = "unfinished";
|
|
76
|
+
rt.file.reason = `the process ended with ${open.length} task(s) still open: ${open.join(", ")}`;
|
|
77
|
+
event(s, "unfinished", rt, rt.file.reason);
|
|
78
|
+
s.say(`${rt.file.lane}: ${rt.file.reason}. It will not be merged.`);
|
|
79
|
+
}
|
|
80
|
+
save(s, rt);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** The lane's pause or stop directive, when it has one: the reason its process ending is not a failure. */
|
|
84
|
+
function pauseOrStop(s, rt) {
|
|
85
|
+
const d = readDirective(s.root, s.run, rt.file.lane);
|
|
86
|
+
return d && (d.action === "pause" || d.action === "stop") ? { action: d.action, at: d.at } : null;
|
|
87
|
+
}
|
|
88
|
+
/** Detect stalled workers and restart them or pause them at the restart limit (FR-008, FR-009, FR-010). */
|
|
89
|
+
export function superviseStalls(s) {
|
|
90
|
+
for (const rt of s.lanes) {
|
|
91
|
+
if (rt.job !== "worker" || rt.file.status !== "running" || !isRunning(s, rt))
|
|
92
|
+
continue;
|
|
93
|
+
if (rt.stopAskedMs !== undefined)
|
|
94
|
+
continue; // stopping: the stop grace handles it
|
|
95
|
+
const st = laneStatus(s.root, { feature: s.feature, lane: rt.file.lane, run: s.run, now: s.now() });
|
|
96
|
+
if (isFailed(st))
|
|
97
|
+
continue;
|
|
98
|
+
// 025's `laneStatus` is the one idle measure. Two things it cannot know: a lane that never reported is
|
|
99
|
+
// `unreported` (never stalled there), and a lane's files may be older than this process. So a lane is
|
|
100
|
+
// stalled here when 025 says so, or has never reported and is idle past the same limit, and only once this
|
|
101
|
+
// process has itself been running that long.
|
|
102
|
+
const idleStalled = st.stalled || (st.state === "unreported" && (st.idleMinutes ?? 0) >= st.stallMinutes);
|
|
103
|
+
const sinceStart = rt.startedMs === undefined ? Infinity : (s.now() - rt.startedMs) / 60_000;
|
|
104
|
+
const stalled = idleStalled && sinceStart >= st.stallMinutes;
|
|
105
|
+
const decision = restartDecision({ stalled, restarts: rt.file.restarts, limit: s.settings.restartLimit });
|
|
106
|
+
if (decision === "none")
|
|
107
|
+
continue;
|
|
108
|
+
stopProcess(s, rt, "SIGTERM");
|
|
109
|
+
if (decision === "restart") {
|
|
110
|
+
rt.file.restarts += 1;
|
|
111
|
+
syncRunLane(s, rt);
|
|
112
|
+
addTaskEvents(s, 1);
|
|
113
|
+
event(s, "stalled", rt, `no report or task change for ${st.idleMinutes ?? "?"} minutes; restart ${rt.file.restarts} of ${s.settings.restartLimit}`);
|
|
114
|
+
s.say(`${rt.file.lane}: stalled (${st.idleMinutes ?? "?"} min); restarting (${rt.file.restarts} of ${s.settings.restartLimit})`);
|
|
115
|
+
startJob(s, rt, "worker", { restart: true });
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
rt.file.status = "paused";
|
|
119
|
+
rt.file.pausedAt = new Date(s.now()).toISOString();
|
|
120
|
+
rt.file.reason = `stalled again after ${rt.file.restarts} restarts; a person must decide`;
|
|
121
|
+
delete rt.handle;
|
|
122
|
+
delete rt.file.pid;
|
|
123
|
+
save(s, rt);
|
|
124
|
+
escalate(s.root, s.run, { kind: "restart-limit", lane: rt.file.lane, assistant: rt.assistant, restarts: rt.file.restarts });
|
|
125
|
+
event(s, "paused", rt, rt.file.reason);
|
|
126
|
+
s.say(`${rt.file.lane}: ${rt.file.reason}. Resume it with: ambykit directive ${s.feature} ${rt.file.lane} resume`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/** Keep spec 025's `lanes[].restarts` equal to the lane file's (the run record is what other hosts read). */
|
|
131
|
+
export function syncRunLane(s, rt) {
|
|
132
|
+
const rec = readRun(s.root, s.run);
|
|
133
|
+
if (!rec)
|
|
134
|
+
return;
|
|
135
|
+
const lanes = rec.lanes.map((l) => (l.lane === rt.ref.name ? { ...l, restarts: rt.file.restarts } : l));
|
|
136
|
+
updateRun(s.root, s.run, { lanes });
|
|
137
|
+
}
|
|
138
|
+
/** After a stop was asked for, terminate a lane that still has not reported once the stop grace is over. */
|
|
139
|
+
export function enforceStopGrace(s) {
|
|
140
|
+
for (const rt of s.lanes) {
|
|
141
|
+
if (rt.stopAskedMs === undefined || !isRunning(s, rt))
|
|
142
|
+
continue;
|
|
143
|
+
const st = laneStatus(s.root, { feature: s.feature, lane: rt.file.lane, run: s.run, now: s.now() });
|
|
144
|
+
const last = !isFailed(st) && st.lastReportAt ? Date.parse(st.lastReportAt) : null;
|
|
145
|
+
if (mustTerminate({ stopRequestedAt: rt.stopAskedMs, lastReportAt: last, now: s.now(), graceMinutes: s.settings.stopGraceMinutes })) {
|
|
146
|
+
stopProcess(s, rt, "SIGTERM");
|
|
147
|
+
event(s, "terminated", rt, `no report within the ${s.settings.stopGraceMinutes}-minute stop grace`);
|
|
148
|
+
s.say(`${rt.file.lane}: terminated after the stop grace`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* A process from an earlier session (`--continue-run`) has no handle to tell us how it ended. When its pid is
|
|
154
|
+
* gone, record an exit with no code so the normal rules classify it (finished, or unfinished with tasks open).
|
|
155
|
+
*/
|
|
156
|
+
export function noteAdoptedExits(s) {
|
|
157
|
+
for (const rt of s.lanes) {
|
|
158
|
+
if (rt.handle || rt.exit || (rt.file.status !== "running" && rt.file.status !== "reviewing"))
|
|
159
|
+
continue;
|
|
160
|
+
if (rt.file.pid === undefined || s.port.isAlive(rt.file.pid))
|
|
161
|
+
continue;
|
|
162
|
+
rt.exit = { code: null, signal: null };
|
|
163
|
+
rt.exitedMs = s.now();
|
|
164
|
+
rt.startedMs ??= rt.exitedMs - 60_000; // unknown start: never read as an immediate failure
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=run-supervisor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-supervisor.js","sourceRoot":"","sources":["../../src/cli/run-supervisor.ts"],"names":[],"mapp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;YAAE,SAAS;QACvE,EAAE,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACvC,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QACtB,EAAE,CAAC,SAAS,KAAK,EAAE,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC,oDAAoD;IAC7F,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { BaseCommand, type CliOptions } from "./base-command.js";
|
|
2
|
+
import { type ProcessPort } from "./run-process.js";
|
|
3
|
+
import { type FleetAction } from "./run-fleet-control.js";
|
|
4
|
+
import type { LaneRunner } from "./run-fleet-prepare.js";
|
|
5
|
+
import { type FleetSettings } from "../core/config.js";
|
|
6
|
+
import type { Session } from "./run-session.js";
|
|
7
|
+
import { type LaunchEntry } from "../core/run-launch-plan.js";
|
|
8
|
+
import { type LaneRef } from "../core/query.js";
|
|
9
|
+
import { type RunnerSpec } from "../core/runners.js";
|
|
10
|
+
import { type Budgets } from "../core/run-supervise.js";
|
|
11
|
+
/**
|
|
12
|
+
* `ambykit run <feature>` — headless lane orchestration (feature 028). Experimental in 1.6 (FR-019), **stable from 2.0** (033 T072): the
|
|
13
|
+
* command, its flags and the runner commands may change before 2.0, when it is promoted to stable.
|
|
14
|
+
*
|
|
15
|
+
* Launching processes that edit code is the riskiest thing AmbyKit does, so nothing launches without
|
|
16
|
+
* `--yes` (FR-001, FR-002), `--emit-script` writes the commands and launches nothing (FR-003), and an
|
|
17
|
+
* assistant without a verified runner is refused (FR-006). State lives under `.amby/fleet/<run>/`, owned by
|
|
18
|
+
* spec 025 (FR-017); nothing is written outside the project (FR-020).
|
|
19
|
+
*/
|
|
20
|
+
export declare const EXPERIMENTAL_NOTE = "ambykit run is experimental in 1.6: its flags and runner commands may change before it is stable in 2.0.";
|
|
21
|
+
declare const SUBCOMMANDS: readonly ["approve", "reject"];
|
|
22
|
+
/** Everything a test needs to replace so no real assistant, clock or terminal is involved (Principle 5). */
|
|
23
|
+
export interface RunDeps {
|
|
24
|
+
registry: RunnerSpec[];
|
|
25
|
+
port: ProcessPort;
|
|
26
|
+
now: () => number;
|
|
27
|
+
sleep: (ms: number) => Promise<void>;
|
|
28
|
+
/** True when a person can answer a prompt on this terminal. */
|
|
29
|
+
interactive: boolean;
|
|
30
|
+
/** Ask a yes/no question; `undefined` = no answer (not interactive). */
|
|
31
|
+
ask?: (question: string) => Promise<boolean | undefined>;
|
|
32
|
+
/** Feature 031: how a fleet prepares missing lanes (default: the lane command in-process). */
|
|
33
|
+
laneRunner?: LaneRunner;
|
|
34
|
+
}
|
|
35
|
+
/** The resolved facts of one invocation, shared by the preview, the script writer and the launch. */
|
|
36
|
+
export interface RunContext {
|
|
37
|
+
root: string;
|
|
38
|
+
feature: string;
|
|
39
|
+
lanes: LaneRef[];
|
|
40
|
+
assistants: string[];
|
|
41
|
+
run: string;
|
|
42
|
+
settings: FleetSettings;
|
|
43
|
+
budgets: Budgets;
|
|
44
|
+
unattended: boolean;
|
|
45
|
+
plan: LaunchEntry[];
|
|
46
|
+
opts: CliOptions;
|
|
47
|
+
/** Set by `--continue-run`: the existing run this invocation continues. */
|
|
48
|
+
continueRun?: string;
|
|
49
|
+
}
|
|
50
|
+
export declare class RunCommand extends BaseCommand {
|
|
51
|
+
readonly name = "run";
|
|
52
|
+
readonly summary: string;
|
|
53
|
+
readonly usage = "ambykit run <feature> [<feature>...|--all-ready] [--yes] [--emit-script] [--assistant=<id,id>] [--unattended] [--max-minutes=N] [--max-tasks=N] [--max-tokens=N] [--continue-run=<run>] [--continue-fleet=<fleet>] [--json] | pause|stop|resume <fleet> | --runners | approve|reject <run> [--gate=<id>] [--reason=<text>] | approve <run> --reassign=<lane>:<assistant>";
|
|
54
|
+
protected readonly deps: RunDeps;
|
|
55
|
+
constructor(deps?: Partial<RunDeps>);
|
|
56
|
+
protected execute(opts: CliOptions): Promise<number>;
|
|
57
|
+
protected start(root: string, feature: string, lanes: LaneRef[], opts: CliOptions): Promise<number>;
|
|
58
|
+
/** Create (or continue) the run, start the lanes under the caps and supervise until it ends. */
|
|
59
|
+
protected launch(ctx: RunContext): Promise<number>;
|
|
60
|
+
/** Build the session from the run's saved lane files, so a continued run picks up where it was. */
|
|
61
|
+
protected session(ctx: RunContext, run: string): Session;
|
|
62
|
+
/** The foreground prompt for a checkpoint; without a terminal the run just waits for `ambykit run approve`. */
|
|
63
|
+
private readonly asked;
|
|
64
|
+
private askGate;
|
|
65
|
+
private refuse;
|
|
66
|
+
private printPlan;
|
|
67
|
+
private planJson;
|
|
68
|
+
/** `--runners`: the headless runners, what each can do and why a refused one is refused (FR-006, FR-007). */
|
|
69
|
+
protected listRunnerRows(opts: CliOptions): number;
|
|
70
|
+
/** `ambykit run pause|stop|resume <fleet>`: one directive per lane of every feature of the fleet (031 FR-015). */
|
|
71
|
+
protected fleetControl(root: string, action: FleetAction, fleet: string | undefined, opts: CliOptions): number;
|
|
72
|
+
/** `ambykit run approve|reject <run>`: the one pair of gate functions the dashboard calls too (FR-015). */
|
|
73
|
+
protected gate(root: string, verb: (typeof SUBCOMMANDS)[number], run: string | undefined, opts: CliOptions): Promise<number>;
|
|
74
|
+
}
|
|
75
|
+
/** The feature's prepared lanes in phase, then lane-index order (the order they are started and merged). */
|
|
76
|
+
export declare function preparedLanes(root: string, feature: string): LaneRef[];
|
|
77
|
+
/** The assistants lanes are spread over: `--assistant`, else `fleet.runners`, else the configured tools. */
|
|
78
|
+
export declare function assistantsFor(root: string, opts: CliOptions): string[];
|
|
79
|
+
/** Open tasks of the whole feature, read from its checkout (where lane check-offs are merged), else from this checkout. */
|
|
80
|
+
export declare function featureOpenTasks(root: string, feature: string): number;
|
|
81
|
+
export {};
|