@apralabs/apra-fleet 0.4.1 → 0.4.3
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/README.md +53 -12
- package/dist/agents/backlog-groomer.md +42 -21
- package/dist/agents/ci-watcher.md +14 -0
- package/dist/agents/deployer.md +59 -46
- package/dist/agents/doer.md +157 -134
- package/dist/agents/harvester.md +31 -32
- package/dist/agents/integ-test-runner.md +92 -113
- package/dist/agents/kb-reconciler.md +40 -42
- package/dist/agents/plan-reviewer.md +139 -63
- package/dist/agents/planner.md +176 -100
- package/dist/agents/regression-test-runner.md +77 -81
- package/dist/agents/reviewer.md +69 -85
- package/dist/agents/schemas/integ-test-runner-output.json +1 -1
- package/dist/agents/schemas/plan-reviewer-output.json +37 -0
- package/dist/agents/schemas/regression-test-runner-output.json +4 -17
- package/dist/cli/agent-transform.d.ts +83 -2
- package/dist/cli/agent-transform.d.ts.map +1 -1
- package/dist/cli/agent-transform.js +266 -21
- package/dist/cli/agent-transform.js.map +1 -1
- package/dist/cli/auth.d.ts.map +1 -1
- package/dist/cli/auth.js +29 -11
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/config.d.ts +7 -5
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +44 -43
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/install.d.ts +33 -0
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +294 -61
- package/dist/cli/install.js.map +1 -1
- package/dist/cli/kb-directives.d.ts.map +1 -1
- package/dist/cli/kb-directives.js +2 -1
- package/dist/cli/kb-directives.js.map +1 -1
- package/dist/cli/register-member.d.ts.map +1 -1
- package/dist/cli/register-member.js +7 -3
- package/dist/cli/register-member.js.map +1 -1
- package/dist/cli/start.d.ts.map +1 -1
- package/dist/cli/start.js +7 -0
- package/dist/cli/start.js.map +1 -1
- package/dist/cli/uninstall.d.ts.map +1 -1
- package/dist/cli/uninstall.js +5 -3
- package/dist/cli/uninstall.js.map +1 -1
- package/dist/cli/watch.d.ts +26 -3
- package/dist/cli/watch.d.ts.map +1 -1
- package/dist/cli/watch.js +41 -9
- package/dist/cli/watch.js.map +1 -1
- package/dist/commands/kb-server.d.ts +3 -0
- package/dist/commands/kb-server.d.ts.map +1 -1
- package/dist/commands/kb-server.js +43 -3
- package/dist/commands/kb-server.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/os/git-bash-candidates.d.ts +35 -0
- package/dist/os/git-bash-candidates.d.ts.map +1 -0
- package/dist/os/git-bash-candidates.js +46 -0
- package/dist/os/git-bash-candidates.js.map +1 -0
- package/dist/os/index.d.ts +13 -4
- package/dist/os/index.d.ts.map +1 -1
- package/dist/os/index.js +17 -2
- package/dist/os/index.js.map +1 -1
- package/dist/os/linux.d.ts +6 -0
- package/dist/os/linux.d.ts.map +1 -1
- package/dist/os/linux.js +36 -3
- package/dist/os/linux.js.map +1 -1
- package/dist/os/os-commands.d.ts +68 -2
- package/dist/os/os-commands.d.ts.map +1 -1
- package/dist/os/os-commands.js.map +1 -1
- package/dist/os/windows-gitbash.d.ts +98 -0
- package/dist/os/windows-gitbash.d.ts.map +1 -0
- package/dist/os/windows-gitbash.js +259 -0
- package/dist/os/windows-gitbash.js.map +1 -0
- package/dist/os/windows.d.ts +6 -0
- package/dist/os/windows.d.ts.map +1 -1
- package/dist/os/windows.js +73 -8
- package/dist/os/windows.js.map +1 -1
- package/dist/providers/agy.d.ts +118 -8
- package/dist/providers/agy.d.ts.map +1 -1
- package/dist/providers/agy.js +580 -55
- package/dist/providers/agy.js.map +1 -1
- package/dist/providers/claude.d.ts +83 -4
- package/dist/providers/claude.d.ts.map +1 -1
- package/dist/providers/claude.js +365 -12
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/codex.d.ts +7 -4
- package/dist/providers/codex.d.ts.map +1 -1
- package/dist/providers/codex.js +24 -4
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/copilot.d.ts +7 -4
- package/dist/providers/copilot.d.ts.map +1 -1
- package/dist/providers/copilot.js +27 -4
- package/dist/providers/copilot.js.map +1 -1
- package/dist/providers/index.d.ts +0 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +0 -3
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/none.d.ts +7 -4
- package/dist/providers/none.d.ts.map +1 -1
- package/dist/providers/none.js +22 -4
- package/dist/providers/none.js.map +1 -1
- package/dist/providers/opencode.d.ts +6 -3
- package/dist/providers/opencode.d.ts.map +1 -1
- package/dist/providers/opencode.js +27 -4
- package/dist/providers/opencode.js.map +1 -1
- package/dist/providers/provider.d.ts +215 -11
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/provider.js +58 -2
- package/dist/providers/provider.js.map +1 -1
- package/dist/services/agent-provisioner.js +2 -2
- package/dist/services/agent-provisioner.js.map +1 -1
- package/dist/services/agy-project.d.ts +102 -0
- package/dist/services/agy-project.d.ts.map +1 -0
- package/dist/services/agy-project.js +356 -0
- package/dist/services/agy-project.js.map +1 -0
- package/dist/services/auth-socket.js +4 -4
- package/dist/services/auth-web.js +1 -1
- package/dist/services/cloud/activity.js +2 -2
- package/dist/services/cloud/activity.js.map +1 -1
- package/dist/services/cloud/lifecycle.d.ts.map +1 -1
- package/dist/services/cloud/lifecycle.js +33 -4
- package/dist/services/cloud/lifecycle.js.map +1 -1
- package/dist/services/context-admission.d.ts.map +1 -1
- package/dist/services/context-admission.js +9 -7
- package/dist/services/context-admission.js.map +1 -1
- package/dist/services/credential-cleanup.d.ts.map +1 -1
- package/dist/services/credential-cleanup.js +47 -10
- package/dist/services/credential-cleanup.js.map +1 -1
- package/dist/services/exit-drain.d.ts +44 -0
- package/dist/services/exit-drain.d.ts.map +1 -0
- package/dist/services/exit-drain.js +52 -0
- package/dist/services/exit-drain.js.map +1 -0
- package/dist/services/github-app.d.ts.map +1 -1
- package/dist/services/github-app.js +32 -4
- package/dist/services/github-app.js.map +1 -1
- package/dist/services/http-transport.d.ts +1 -0
- package/dist/services/http-transport.d.ts.map +1 -1
- package/dist/services/http-transport.js +48 -1
- package/dist/services/http-transport.js.map +1 -1
- package/dist/services/knowledge/kb-config.d.ts +42 -0
- package/dist/services/knowledge/kb-config.d.ts.map +1 -0
- package/dist/services/knowledge/kb-config.js +54 -0
- package/dist/services/knowledge/kb-config.js.map +1 -0
- package/dist/services/knowledge/kb-providers.d.ts +7 -1
- package/dist/services/knowledge/kb-providers.d.ts.map +1 -1
- package/dist/services/knowledge/kb-providers.js +191 -17
- package/dist/services/knowledge/kb-providers.js.map +1 -1
- package/dist/services/knowledge/require-sqlite-project.d.ts +32 -0
- package/dist/services/knowledge/require-sqlite-project.d.ts.map +1 -0
- package/dist/services/knowledge/require-sqlite-project.js +38 -0
- package/dist/services/knowledge/require-sqlite-project.js.map +1 -0
- package/dist/services/member-home.d.ts +1 -1
- package/dist/services/member-home.d.ts.map +1 -1
- package/dist/services/member-home.js +15 -12
- package/dist/services/member-home.js.map +1 -1
- package/dist/services/model-pricing.d.ts.map +1 -1
- package/dist/services/model-pricing.js +7 -8
- package/dist/services/model-pricing.js.map +1 -1
- package/dist/services/orphan-recovery.d.ts +6 -3
- package/dist/services/orphan-recovery.d.ts.map +1 -1
- package/dist/services/orphan-recovery.js +17 -14
- package/dist/services/orphan-recovery.js.map +1 -1
- package/dist/services/preflight-check.js +2 -2
- package/dist/services/preflight-check.js.map +1 -1
- package/dist/services/secret-token.d.ts +38 -0
- package/dist/services/secret-token.d.ts.map +1 -0
- package/dist/services/secret-token.js +51 -0
- package/dist/services/secret-token.js.map +1 -0
- package/dist/services/service-manager/types.d.ts +3 -1
- package/dist/services/service-manager/types.d.ts.map +1 -1
- package/dist/services/service-manager/windows.d.ts +14 -2
- package/dist/services/service-manager/windows.d.ts.map +1 -1
- package/dist/services/service-manager/windows.js +65 -7
- package/dist/services/service-manager/windows.js.map +1 -1
- package/dist/services/shell-probe.d.ts +131 -0
- package/dist/services/shell-probe.d.ts.map +1 -0
- package/dist/services/shell-probe.js +210 -0
- package/dist/services/shell-probe.js.map +1 -0
- package/dist/services/singleton.d.ts +2 -0
- package/dist/services/singleton.d.ts.map +1 -1
- package/dist/services/singleton.js +1 -1
- package/dist/services/singleton.js.map +1 -1
- package/dist/services/ssh.d.ts.map +1 -1
- package/dist/services/ssh.js +60 -4
- package/dist/services/ssh.js.map +1 -1
- package/dist/services/stall/find-log-file.d.ts.map +1 -1
- package/dist/services/stall/find-log-file.js +22 -16
- package/dist/services/stall/find-log-file.js.map +1 -1
- package/dist/services/stall/read-log-tail.d.ts.map +1 -1
- package/dist/services/stall/read-log-tail.js +26 -15
- package/dist/services/stall/read-log-tail.js.map +1 -1
- package/dist/services/stall/stall-detector.d.ts +53 -4
- package/dist/services/stall/stall-detector.d.ts.map +1 -1
- package/dist/services/stall/stall-detector.js +212 -34
- package/dist/services/stall/stall-detector.js.map +1 -1
- package/dist/services/stall/stall-poller.d.ts.map +1 -1
- package/dist/services/stall/stall-poller.js +35 -42
- package/dist/services/stall/stall-poller.js.map +1 -1
- package/dist/services/strategy.d.ts +9 -0
- package/dist/services/strategy.d.ts.map +1 -1
- package/dist/services/strategy.js +119 -8
- package/dist/services/strategy.js.map +1 -1
- package/dist/services/substitution-engine.js +2 -2
- package/dist/services/substitution-engine.js.map +1 -1
- package/dist/services/tool-registry.d.ts.map +1 -1
- package/dist/services/tool-registry.js +5 -3
- package/dist/services/tool-registry.js.map +1 -1
- package/dist/services/user-config.js +1 -1
- package/dist/services/user-config.js.map +1 -1
- package/dist/services/vcs/azure-devops.d.ts +67 -2
- package/dist/services/vcs/azure-devops.d.ts.map +1 -1
- package/dist/services/vcs/azure-devops.js +281 -15
- package/dist/services/vcs/azure-devops.js.map +1 -1
- package/dist/services/vcs/bitbucket.d.ts.map +1 -1
- package/dist/services/vcs/bitbucket.js +16 -0
- package/dist/services/vcs/bitbucket.js.map +1 -1
- package/dist/services/vcs/github.d.ts.map +1 -1
- package/dist/services/vcs/github.js +24 -0
- package/dist/services/vcs/github.js.map +1 -1
- package/dist/services/vcs/types.d.ts +123 -2
- package/dist/services/vcs/types.d.ts.map +1 -1
- package/dist/skills/fleet-sprint-cli/SKILL.md +20 -1
- package/dist/skills/pm/SKILL.md +1 -2
- package/dist/skills/pm/cost.md +0 -4
- package/dist/skills/pm/fleet-addendum.md +2 -3
- package/dist/tools/check-status.d.ts +7 -4
- package/dist/tools/check-status.d.ts.map +1 -1
- package/dist/tools/check-status.js +5 -3
- package/dist/tools/check-status.js.map +1 -1
- package/dist/tools/cloud-control.js +2 -2
- package/dist/tools/cloud-control.js.map +1 -1
- package/dist/tools/compose-permissions.d.ts +6 -0
- package/dist/tools/compose-permissions.d.ts.map +1 -1
- package/dist/tools/compose-permissions.js +211 -50
- package/dist/tools/compose-permissions.js.map +1 -1
- package/dist/tools/credential-store-set.js +1 -1
- package/dist/tools/execute-command.d.ts.map +1 -1
- package/dist/tools/execute-command.js +56 -29
- package/dist/tools/execute-command.js.map +1 -1
- package/dist/tools/execute-prompt.d.ts +15 -2
- package/dist/tools/execute-prompt.d.ts.map +1 -1
- package/dist/tools/execute-prompt.js +1214 -873
- package/dist/tools/execute-prompt.js.map +1 -1
- package/dist/tools/kb-capture.d.ts +2 -2
- package/dist/tools/kb-capture.d.ts.map +1 -1
- package/dist/tools/kb-capture.js +29 -5
- package/dist/tools/kb-capture.js.map +1 -1
- package/dist/tools/kb-export.d.ts +2 -2
- package/dist/tools/kb-export.d.ts.map +1 -1
- package/dist/tools/kb-export.js +3 -28
- package/dist/tools/kb-export.js.map +1 -1
- package/dist/tools/kb-feedback.d.ts.map +1 -1
- package/dist/tools/kb-feedback.js +3 -1
- package/dist/tools/kb-feedback.js.map +1 -1
- package/dist/tools/kb-freshness-sweep.d.ts.map +1 -1
- package/dist/tools/kb-freshness-sweep.js +3 -1
- package/dist/tools/kb-freshness-sweep.js.map +1 -1
- package/dist/tools/kb-import.d.ts.map +1 -1
- package/dist/tools/kb-import.js +2 -1
- package/dist/tools/kb-import.js.map +1 -1
- package/dist/tools/kb-list.d.ts.map +1 -1
- package/dist/tools/kb-list.js +3 -1
- package/dist/tools/kb-list.js.map +1 -1
- package/dist/tools/kb-query.d.ts +2 -2
- package/dist/tools/kb-reconcile-prefilter.d.ts.map +1 -1
- package/dist/tools/kb-reconcile-prefilter.js +3 -1
- package/dist/tools/kb-reconcile-prefilter.js.map +1 -1
- package/dist/tools/kb-resolve-contradiction.d.ts.map +1 -1
- package/dist/tools/kb-resolve-contradiction.js +3 -1
- package/dist/tools/kb-resolve-contradiction.js.map +1 -1
- package/dist/tools/kb-setup.d.ts.map +1 -1
- package/dist/tools/kb-setup.js +125 -20
- package/dist/tools/kb-setup.js.map +1 -1
- package/dist/tools/kb-stats.d.ts.map +1 -1
- package/dist/tools/kb-stats.js +64 -43
- package/dist/tools/kb-stats.js.map +1 -1
- package/dist/tools/list-members.d.ts +2 -2
- package/dist/tools/list-members.d.ts.map +1 -1
- package/dist/tools/list-members.js +7 -2
- package/dist/tools/list-members.js.map +1 -1
- package/dist/tools/member-detail.d.ts +2 -2
- package/dist/tools/member-detail.d.ts.map +1 -1
- package/dist/tools/member-detail.js +22 -3
- package/dist/tools/member-detail.js.map +1 -1
- package/dist/tools/member-reservation.d.ts +58 -1
- package/dist/tools/member-reservation.d.ts.map +1 -1
- package/dist/tools/member-reservation.js +71 -18
- package/dist/tools/member-reservation.js.map +1 -1
- package/dist/tools/monitor-task.d.ts.map +1 -1
- package/dist/tools/monitor-task.js +17 -2
- package/dist/tools/monitor-task.js.map +1 -1
- package/dist/tools/provision-auth.d.ts +80 -1
- package/dist/tools/provision-auth.d.ts.map +1 -1
- package/dist/tools/provision-auth.js +147 -59
- package/dist/tools/provision-auth.js.map +1 -1
- package/dist/tools/provision-vcs-auth.d.ts +96 -3
- package/dist/tools/provision-vcs-auth.d.ts.map +1 -1
- package/dist/tools/provision-vcs-auth.js +254 -88
- package/dist/tools/provision-vcs-auth.js.map +1 -1
- package/dist/tools/register-member.d.ts +21 -12
- package/dist/tools/register-member.d.ts.map +1 -1
- package/dist/tools/register-member.js +141 -16
- package/dist/tools/register-member.js.map +1 -1
- package/dist/tools/remove-member.d.ts.map +1 -1
- package/dist/tools/remove-member.js +29 -4
- package/dist/tools/remove-member.js.map +1 -1
- package/dist/tools/revoke-vcs-auth.js +2 -2
- package/dist/tools/revoke-vcs-auth.js.map +1 -1
- package/dist/tools/send-email.d.ts +2 -2
- package/dist/tools/setup-git-app.d.ts.map +1 -1
- package/dist/tools/setup-git-app.js +11 -7
- package/dist/tools/setup-git-app.js.map +1 -1
- package/dist/tools/setup-ssh-key.d.ts.map +1 -1
- package/dist/tools/setup-ssh-key.js +2 -1
- package/dist/tools/setup-ssh-key.js.map +1 -1
- package/dist/tools/shutdown-server.d.ts +2 -0
- package/dist/tools/shutdown-server.d.ts.map +1 -1
- package/dist/tools/shutdown-server.js +23 -1
- package/dist/tools/shutdown-server.js.map +1 -1
- package/dist/tools/stop-prompt.js +2 -2
- package/dist/tools/stop-prompt.js.map +1 -1
- package/dist/tools/update-agent-cli.js +2 -2
- package/dist/tools/update-agent-cli.js.map +1 -1
- package/dist/tools/update-member.d.ts +21 -12
- package/dist/tools/update-member.d.ts.map +1 -1
- package/dist/tools/update-member.js +61 -12
- package/dist/tools/update-member.js.map +1 -1
- package/dist/tools/vcs-credential-exec.d.ts +127 -0
- package/dist/tools/vcs-credential-exec.d.ts.map +1 -0
- package/dist/tools/vcs-credential-exec.js +197 -0
- package/dist/tools/vcs-credential-exec.js.map +1 -0
- package/dist/types.d.ts +24 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/agent-helpers.d.ts +36 -0
- package/dist/utils/agent-helpers.d.ts.map +1 -1
- package/dist/utils/agent-helpers.js +39 -1
- package/dist/utils/agent-helpers.js.map +1 -1
- package/dist/utils/log-helpers.d.ts.map +1 -1
- package/dist/utils/log-helpers.js +2 -2
- package/dist/utils/log-helpers.js.map +1 -1
- package/dist/utils/platform.d.ts +7 -0
- package/dist/utils/platform.d.ts.map +1 -1
- package/dist/utils/platform.js +11 -1
- package/dist/utils/platform.js.map +1 -1
- package/dist/utils/prompt-errors.d.ts.map +1 -1
- package/dist/utils/prompt-errors.js +7 -1
- package/dist/utils/prompt-errors.js.map +1 -1
- package/dist/utils/shell-escape.d.ts +16 -0
- package/dist/utils/shell-escape.d.ts.map +1 -1
- package/dist/utils/shell-escape.js +22 -2
- package/dist/utils/shell-escape.js.map +1 -1
- package/dist/utils/vcs-provider-detect.d.ts +65 -0
- package/dist/utils/vcs-provider-detect.d.ts.map +1 -0
- package/dist/utils/vcs-provider-detect.js +109 -0
- package/dist/utils/vcs-provider-detect.js.map +1 -0
- package/dist/utils/workspace-trust.d.ts +20 -17
- package/dist/utils/workspace-trust.d.ts.map +1 -1
- package/dist/utils/workspace-trust.js +91 -1
- package/dist/utils/workspace-trust.js.map +1 -1
- package/dist/workflows/auto-sprint.js +180 -32
- package/package.json +7 -5
- package/packages/apra-fleet-client/src/client/api.mjs +403 -12
- package/packages/apra-fleet-client/src/client/errors.mjs +6 -2
- package/packages/apra-fleet-se/apra-pm/agents/_shared/GRAPH-SEMANTICS.md +10 -2
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +42 -21
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +14 -0
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +59 -46
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +157 -134
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +31 -32
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +92 -113
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +40 -42
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +139 -63
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +176 -100
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +77 -81
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +69 -85
- package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-output.json +1 -1
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +37 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +4 -17
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +1 -2
- package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +0 -4
- package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +2 -3
- package/packages/apra-fleet-se/bin/cli.mjs +280 -3
- package/packages/apra-fleet-se/bin/serve.mjs +114 -5
- package/packages/apra-fleet-se/fleet-sprint/abort.mjs +481 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +491 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +282 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +208 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +638 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +301 -0
- package/packages/apra-fleet-se/fleet-sprint/branch-ensure.mjs +96 -0
- package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +8 -0
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +199 -34
- package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +516 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +184 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +1121 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +216 -4
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +23 -8
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-manual-recovery-verified.md +10 -8
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +285 -4
- package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +3 -3
- package/packages/apra-fleet-se/fleet-sprint/docs/run-sprint-cycle-prelude-decision.md +215 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/shared-orchestrator-reservation-design.md +12 -12
- package/packages/apra-fleet-se/fleet-sprint/docs/stabilization-log.md +14 -4
- package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +56 -1
- package/packages/apra-fleet-se/fleet-sprint/dolt-settle.mjs +275 -99
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +1054 -39
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +308 -0
- package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +501 -0
- package/packages/apra-fleet-se/fleet-sprint/fatal-diagnostics.mjs +134 -0
- package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +102 -0
- package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +556 -0
- package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +495 -0
- package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +564 -0
- package/packages/apra-fleet-se/fleet-sprint/inline-ladder-guard.mjs +216 -0
- package/packages/apra-fleet-se/fleet-sprint/kb.mjs +728 -0
- package/packages/apra-fleet-se/fleet-sprint/mcp-result.mjs +75 -0
- package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +252 -0
- package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +581 -0
- package/packages/apra-fleet-se/fleet-sprint/member-target.mjs +93 -0
- package/packages/apra-fleet-se/fleet-sprint/newtask-text.mjs +266 -0
- package/packages/apra-fleet-se/fleet-sprint/parent-notes-staleness.mjs +201 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +136 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +822 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +294 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +403 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +180 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +358 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +390 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +323 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +232 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +174 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +197 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +305 -0
- package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +559 -0
- package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +1416 -0
- package/packages/apra-fleet-se/fleet-sprint/round-session.mjs +100 -0
- package/packages/apra-fleet-se/fleet-sprint/runner.js +1672 -9072
- package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +134 -0
- package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +159 -0
- package/packages/apra-fleet-se/fleet-sprint/se-windows-gitbash.mjs +97 -0
- package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +143 -0
- package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +304 -0
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +20 -1
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +21 -2
- package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +454 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +239 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +163 -0
- package/packages/apra-fleet-se/fleet-sprint/unbracketed-push-guard.mjs +234 -0
- package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +211 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +1279 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +204 -19
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +707 -12
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +28 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/dolt.mjs +33 -4
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +191 -43
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +333 -6
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +165 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +167 -37
- package/packages/apra-fleet-se/fleet-sprint/worklists.mjs +559 -0
- package/packages/apra-fleet-se/package.json +1 -1
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +178 -1
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +478 -32
- package/skills/fleet/SKILL.md +27 -16
- package/skills/fleet/auth-azdevops.md +57 -7
- package/skills/fleet/auth-bitbucket.md +5 -5
- package/skills/fleet/auth-github.md +7 -6
- package/skills/fleet/beads-conflict-resolution.md +141 -0
- package/skills/fleet/beads.md +16 -12
- package/skills/fleet/onboarding.md +6 -6
- package/skills/fleet/permissions.md +11 -7
- package/skills/fleet/profiles/node.json +1 -1
- package/skills/fleet/skill-matrix.md +1 -1
- package/skills/fleet/troubleshooting.md +4 -3
- package/version.json +1 -1
- package/dist/providers/gemini.d.ts +0 -52
- package/dist/providers/gemini.d.ts.map +0 -1
- package/dist/providers/gemini.js +0 -236
- package/dist/providers/gemini.js.map +0 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/coach-role-design.md +0 -23
|
@@ -16,8 +16,9 @@ import {
|
|
|
16
16
|
getServerInfoPath,
|
|
17
17
|
} from '@apralabs/apra-fleet-client/server-resolution';
|
|
18
18
|
import { beadsExtension } from '../fleet-sprint/viewer-extensions.mjs';
|
|
19
|
-
import { validateIssueId, validateBranchName, checkMemberTopology, createMemberReservationClient } from '../fleet-sprint/runner.js';
|
|
19
|
+
import { validateIssueId, validateBranchName, checkMemberTopology, createMemberReservationClient, resyncReacquiredMember, commandResultToSoftGit } from '../fleet-sprint/runner.js';
|
|
20
20
|
import { normalizeRole } from '../fleet-sprint/contracts.mjs';
|
|
21
|
+
import { BEADS_IDENTITY_PROBES, parseBeadsIdentity, formatBeadsIdentity, parseExpectedIdentity } from '../fleet-sprint/beads-identity.mjs';
|
|
21
22
|
|
|
22
23
|
const __filename = fileURLToPath(import.meta.url);
|
|
23
24
|
const __dirname = path.dirname(__filename);
|
|
@@ -155,10 +156,19 @@ export function buildOptionsSpec() {
|
|
|
155
156
|
// a direct/standalone CLI launch (no supervisor) falls back to
|
|
156
157
|
// --branch for this identity, exactly as before this flag existed.
|
|
157
158
|
'run-id': { type: 'string' },
|
|
159
|
+
// The beads identity (JSON, serializeExpectedIdentity output) every
|
|
160
|
+
// member's bd must resolve to, injected by the supervisor's spawner;
|
|
161
|
+
// env fallback FLEET_SPRINT_EXPECT_BEADS. Omitted (direct launch):
|
|
162
|
+
// the runner takes the expectation from the orchestrator member.
|
|
163
|
+
'expect-beads': { type: 'string' },
|
|
158
164
|
budget: { type: 'string' },
|
|
159
165
|
// Stabilization Issue 32: per-dispatch time budget in seconds
|
|
160
166
|
// (timeout_s == max_total_s at every dispatch; integ ceiling 2x).
|
|
161
167
|
'dispatch-timeout-s': { type: 'string' },
|
|
168
|
+
// apra-fleet-hzeb.4.2: the CLI-overridable usage-limit pause budgets.
|
|
169
|
+
// Both optional; omitted, the runner uses USAGE_LIMIT_BUDGET_DEFAULTS.
|
|
170
|
+
'usage-limit-max-wait-s': { type: 'string' },
|
|
171
|
+
'usage-limit-max-reprobes': { type: 'string' },
|
|
162
172
|
// apra-fleet-eft.8.5: explicitly opt a multi-member run into synced
|
|
163
173
|
// topology mode (orchestrator-bracketed git sync -- same-origin +
|
|
164
174
|
// dolt-probe precondition, differing HEADs allowed). Omitted => legacy
|
|
@@ -193,12 +203,22 @@ Options:
|
|
|
193
203
|
Normally set automatically to the supervisor's sprintId when this
|
|
194
204
|
sprint is supervisor-spawned; omitted (direct/standalone launch)
|
|
195
205
|
falls back to --branch, exactly as before this flag existed.
|
|
206
|
+
--expect-beads <json> Beads identity every member must resolve to, as JSON
|
|
207
|
+
({"beadsDir","prefix","syncRemote","repoRemote"}). Normally injected by
|
|
208
|
+
the supervisor; env fallback FLEET_SPRINT_EXPECT_BEADS. Omitted: the
|
|
209
|
+
orchestrator member's own 'bd where' becomes the expectation and every
|
|
210
|
+
other member must match it. A mismatch aborts before any bd mutation.
|
|
196
211
|
--budget <usd> USD ceiling for this run's total estimated spend. Optional;
|
|
197
212
|
omitted (the default) means unlimited, identical to prior behavior.
|
|
198
213
|
--dispatch-timeout-s <s> Per-dispatch time budget in seconds (default 3600). Applied as both
|
|
199
214
|
the inactivity timeout and the hard ceiling on every agent dispatch
|
|
200
215
|
(the integration-test dispatch ceiling is 2x). Lower it for small
|
|
201
216
|
sprints so a hung dispatch costs minutes, not an hour. Minimum 60.
|
|
217
|
+
--usage-limit-max-wait-s <s> Total wall-clock seconds a dispatch may stay paused across all
|
|
218
|
+
usage-limit reprobes before giving up (typed sprint abort). Optional;
|
|
219
|
+
omitted uses the runner default. Minimum 60.
|
|
220
|
+
--usage-limit-max-reprobes <n> Max usage-limit reprobe attempts before giving up, independent
|
|
221
|
+
of elapsed wait. Optional; omitted uses the runner default. Minimum 1.
|
|
202
222
|
--sync Use synced topology mode (orchestrator-bracketed git sync):
|
|
203
223
|
members may sit on differing HEADs but must share the same
|
|
204
224
|
origin URL and pass a 'bd dolt pull' probe. Omitted (default)
|
|
@@ -303,7 +323,7 @@ export async function resolveRoleMap(rawValue, deps = {}) {
|
|
|
303
323
|
* }} opts
|
|
304
324
|
* @returns {object}
|
|
305
325
|
*/
|
|
306
|
-
export function buildRunnerArgs({ targetIssues, members, branch, baseBranch, goal, maxCycles, requirementsFile, roleMap, budget, dispatchTimeoutS, serviceUrl }) {
|
|
326
|
+
export function buildRunnerArgs({ targetIssues, members, branch, baseBranch, goal, maxCycles, requirementsFile, roleMap, budget, dispatchTimeoutS, usageLimitMaxWaitS, usageLimitMaxReprobes, serviceUrl, runId, expectBeads }) {
|
|
307
327
|
const args = {
|
|
308
328
|
target_issues: targetIssues,
|
|
309
329
|
members,
|
|
@@ -316,14 +336,82 @@ export function buildRunnerArgs({ targetIssues, members, branch, baseBranch, goa
|
|
|
316
336
|
if (roleMap !== undefined) args.roleMap = roleMap;
|
|
317
337
|
if (budget !== undefined) args.budget = budget;
|
|
318
338
|
if (dispatchTimeoutS !== undefined) args.dispatch_timeout_s = dispatchTimeoutS;
|
|
339
|
+
// apra-fleet-hzeb.4.2: the CLI-overridable usage-limit pause budgets,
|
|
340
|
+
// forwarded to runner.js's validateArgs() when supplied (omitted keeps the
|
|
341
|
+
// runner's USAGE_LIMIT_BUDGET_DEFAULTS).
|
|
342
|
+
if (usageLimitMaxWaitS !== undefined) args.usage_limit_max_wait_s = usageLimitMaxWaitS;
|
|
343
|
+
if (usageLimitMaxReprobes !== undefined) args.usage_limit_max_reprobes = usageLimitMaxReprobes;
|
|
319
344
|
// apra-fleet-f34.1: forwarded straight through to runner.js's validateArgs()
|
|
320
345
|
// (args.serviceUrl), which is what actually switches it onto the
|
|
321
346
|
// HTTP-backed dolt-mutex/id-allocator clients (fleet-sprint/runner.js
|
|
322
347
|
// ~5013-5052). Omitted when not supplied -- unchanged fallback behavior.
|
|
323
348
|
if (serviceUrl !== undefined) args.serviceUrl = serviceUrl;
|
|
349
|
+
// apra-fleet-5co8.37: this launch's reservation identity (the supervisor's
|
|
350
|
+
// --run-id, or the branch name for a direct launch -- the SAME key members
|
|
351
|
+
// are reserved under below). runner.js threads it into the deployer's
|
|
352
|
+
// dispatch so deploy.md's active-sprints gate can recognize this sprint's
|
|
353
|
+
// OWN reservation instead of stopping on it.
|
|
354
|
+
if (runId !== undefined) args.run_id = runId;
|
|
355
|
+
// The raw --expect-beads JSON, forwarded verbatim; runner.js's
|
|
356
|
+
// validateArgs() parses it (validateExpectBeads) and rejects bad JSON.
|
|
357
|
+
if (expectBeads !== undefined) args.expect_beads = expectBeads;
|
|
324
358
|
return args;
|
|
325
359
|
}
|
|
326
360
|
|
|
361
|
+
/**
|
|
362
|
+
* Resolves the `--expect-beads` value: the flag wins, else the
|
|
363
|
+
* FLEET_SPRINT_EXPECT_BEADS env var, else undefined (no expectation).
|
|
364
|
+
* @param {string|undefined} flagValue
|
|
365
|
+
* @param {NodeJS.ProcessEnv} env
|
|
366
|
+
* @returns {string|undefined}
|
|
367
|
+
*/
|
|
368
|
+
export function resolveExpectBeads(flagValue, env = process.env) {
|
|
369
|
+
if (typeof flagValue === 'string' && flagValue.trim()) return flagValue;
|
|
370
|
+
const fromEnv = env.FLEET_SPRINT_EXPECT_BEADS;
|
|
371
|
+
if (typeof fromEnv === 'string' && fromEnv.trim()) return fromEnv;
|
|
372
|
+
return undefined;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Runs `bd where --json` on the ORCHESTRATOR MEMBER (never locally -- the
|
|
377
|
+
* sprint's bd commands run in that member's workFolder, see
|
|
378
|
+
* checkIssuesExistOnMember below) so the startup banner can show which
|
|
379
|
+
* .beads the sprint is about to mutate, and so a member with no beads
|
|
380
|
+
* database is reported plainly (as a WARNING with the fix -- the `bd show`
|
|
381
|
+
* precondition right after it is what actually fails a member whose bd
|
|
382
|
+
* cannot answer). The runner re-probes every member and does the hard
|
|
383
|
+
* expected-vs-actual comparison; this is display only.
|
|
384
|
+
* @param {{ member: string, runCommand: (cmd: string, member: string) => Promise<string> }} opts
|
|
385
|
+
* @returns {Promise<{ ok: boolean, identity: object|null, message: string }>}
|
|
386
|
+
*/
|
|
387
|
+
export async function probeBeadsIdentityOnMember({ member, runCommand }) {
|
|
388
|
+
const raw = {};
|
|
389
|
+
const fix = `To fix: run 'bd where' in the member's workFolder; ensure bd is installed there and the folder contains the project's .beads.`;
|
|
390
|
+
for (const [key, cmd] of Object.entries(BEADS_IDENTITY_PROBES)) {
|
|
391
|
+
try {
|
|
392
|
+
raw[key] = await runCommand(cmd, member);
|
|
393
|
+
} catch (err) {
|
|
394
|
+
if (key === 'where') {
|
|
395
|
+
return {
|
|
396
|
+
ok: false,
|
|
397
|
+
identity: null,
|
|
398
|
+
message: `Warning: no beads database found at member '${member}'s workFolder ('${cmd}' failed: ${err && err.message ? err.message : String(err)}); the beads identity cannot be shown and is not verified for this member. ${fix}`,
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
raw[key] = '';
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
const identity = parseBeadsIdentity(raw);
|
|
405
|
+
if (!identity.beadsDir) {
|
|
406
|
+
return {
|
|
407
|
+
ok: false,
|
|
408
|
+
identity: null,
|
|
409
|
+
message: `Warning: no beads database found at member '${member}'s workFolder ('${BEADS_IDENTITY_PROBES.where}' returned no database path: ${String(raw.where || '').trim() || '(no output)'}); the beads identity cannot be shown and is not verified for this member. ${fix}`,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
return { ok: true, identity, message: formatBeadsIdentity(identity, { label: `[Precondition] member '${member}'` }) };
|
|
413
|
+
}
|
|
414
|
+
|
|
327
415
|
/**
|
|
328
416
|
* Splits `--members` against the fleet's registered member names and decides
|
|
329
417
|
* whether the sprint may proceed.
|
|
@@ -445,6 +533,39 @@ export function attachViewerErrorHandler(server, port, opts = {}) {
|
|
|
445
533
|
return server;
|
|
446
534
|
}
|
|
447
535
|
|
|
536
|
+
// (apra-fleet-p2to.4.2) Owner-checked re-reserve executed on the workflow's
|
|
537
|
+
// 'resumed' event. reReserveForResume() re-grabs every member released at pause
|
|
538
|
+
// and, on the happy path, re-syncs each; if any member was claimed by another
|
|
539
|
+
// sprint while we were paused it throws a MemberReservationResumeError that
|
|
540
|
+
// NAMES exactly those members.
|
|
541
|
+
//
|
|
542
|
+
// The prior review (PR #397) reopened this bead because the 'resumed' handler
|
|
543
|
+
// wrapped that call in `.catch(console.error)`, which SWALLOWED the naming
|
|
544
|
+
// throw: the sprint then resumed anyway while holding ZERO reservations, and
|
|
545
|
+
// the designed clean-failure path never fired. This helper is the fix -- it
|
|
546
|
+
// does NOT swallow. On failure it re-pauses the run (requestPause) so no further
|
|
547
|
+
// dispatch lands on a member this sprint no longer owns, and then RETHROWS so
|
|
548
|
+
// the failure -- and precisely which members block the resume -- is surfaced to
|
|
549
|
+
// the operator instead of lost to a console.error line. Extracted and exported
|
|
550
|
+
// so the rethrow-and-name behavior is unit-testable without a live engine.
|
|
551
|
+
export async function reReserveOnResume({ sprintReservation, resyncMember, requestPause, log = () => {} } = {}) {
|
|
552
|
+
try {
|
|
553
|
+
return await sprintReservation.reReserveForResume({ resyncMember });
|
|
554
|
+
} catch (err) {
|
|
555
|
+
const msg = err && err.message ? err.message : String(err);
|
|
556
|
+
// Re-park the run: the resume cannot proceed on a reservation set we no
|
|
557
|
+
// longer fully own. This keeps the sprint from silently continuing on
|
|
558
|
+
// zero reservations (the exact regression the review flagged).
|
|
559
|
+
if (typeof requestPause === 'function') {
|
|
560
|
+
requestPause(`resume blocked -- ${msg}`);
|
|
561
|
+
}
|
|
562
|
+
log(`[member-reservation] resume failed (run re-paused; free the named members and resume again): ${msg}`);
|
|
563
|
+
// Surface, do not swallow: the operator must see which members block the
|
|
564
|
+
// resume (MemberReservationResumeError.members names them).
|
|
565
|
+
throw err;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
448
569
|
async function main() {
|
|
449
570
|
const { values } = parseCliArgs(process.argv.slice(2));
|
|
450
571
|
|
|
@@ -482,6 +603,18 @@ async function main() {
|
|
|
482
603
|
// (unchanged pre-existing behavior in that case).
|
|
483
604
|
const effectiveRunId = values['run-id'] || branchName;
|
|
484
605
|
const dispatchTimeoutS = values['dispatch-timeout-s'] !== undefined ? Number(values['dispatch-timeout-s']) : undefined;
|
|
606
|
+
// apra-fleet-hzeb.4.2: the CLI-overridable usage-limit pause budgets.
|
|
607
|
+
const usageLimitMaxWaitS = values['usage-limit-max-wait-s'] !== undefined ? Number(values['usage-limit-max-wait-s']) : undefined;
|
|
608
|
+
const usageLimitMaxReprobes = values['usage-limit-max-reprobes'] !== undefined ? Number(values['usage-limit-max-reprobes']) : undefined;
|
|
609
|
+
// --expect-beads (flag, else FLEET_SPRINT_EXPECT_BEADS). Parsed here too
|
|
610
|
+
// so malformed JSON fails before any fleet connection; the runner's
|
|
611
|
+
// validateArgs() re-validates the raw string it is handed.
|
|
612
|
+
const expectBeads = resolveExpectBeads(values['expect-beads']);
|
|
613
|
+
const expectedBeads = expectBeads !== undefined ? parseExpectedIdentity(expectBeads) : null;
|
|
614
|
+
if (expectBeads !== undefined && !expectedBeads) {
|
|
615
|
+
console.error(`Error: --expect-beads is not valid JSON: ${expectBeads}`);
|
|
616
|
+
process.exit(1);
|
|
617
|
+
}
|
|
485
618
|
|
|
486
619
|
// --- A7 defense-in-depth: reject shell-unsafe issue ids / branch names
|
|
487
620
|
// BEFORE any bd/fleet dispatch happens. runner.js re-validates these
|
|
@@ -522,6 +655,18 @@ async function main() {
|
|
|
522
655
|
process.exit(1);
|
|
523
656
|
}
|
|
524
657
|
|
|
658
|
+
// apra-fleet-hzeb.4.2: same strict-parsing posture as --dispatch-timeout-s
|
|
659
|
+
// above; mirrors (does not replace) runner.js validateArgs's own checks.
|
|
660
|
+
if (usageLimitMaxWaitS !== undefined && (!Number.isInteger(usageLimitMaxWaitS) || usageLimitMaxWaitS < 60)) {
|
|
661
|
+
console.error(`Error: --usage-limit-max-wait-s must be an integer >= 60 (seconds), got "${values['usage-limit-max-wait-s']}".`);
|
|
662
|
+
process.exit(1);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
if (usageLimitMaxReprobes !== undefined && (!Number.isInteger(usageLimitMaxReprobes) || usageLimitMaxReprobes < 1)) {
|
|
666
|
+
console.error(`Error: --usage-limit-max-reprobes must be an integer >= 1, got "${values['usage-limit-max-reprobes']}".`);
|
|
667
|
+
process.exit(1);
|
|
668
|
+
}
|
|
669
|
+
|
|
525
670
|
if (budget !== undefined && (!Number.isFinite(budget) || budget < 0)) {
|
|
526
671
|
console.error(`Error: --budget must be a non-negative finite number (USD ceiling), got "${values.budget}".`);
|
|
527
672
|
process.exit(1);
|
|
@@ -570,11 +715,19 @@ async function main() {
|
|
|
570
715
|
|
|
571
716
|
// 2. Validate members exist via the fleet's list_members tool.
|
|
572
717
|
let validMembers = [];
|
|
718
|
+
// apra-fleet: names flagged unreservable in the SAME list_members read --
|
|
719
|
+
// hoisted out of this try block so the topology filter below (item 4) can
|
|
720
|
+
// key on the actual unreservable flag, not on roleMap.orchestrator
|
|
721
|
+
// membership (which would also match a real, git-having dispatch member
|
|
722
|
+
// that is ADDITIONALLY role-mapped as orchestrator, and wrongly skip its
|
|
723
|
+
// legitimate same-HEAD topology check).
|
|
724
|
+
let unreservableNames = new Set();
|
|
573
725
|
try {
|
|
574
726
|
const listRes = await fleetApi.listMembers({ format: 'json' });
|
|
575
727
|
const text = listRes && listRes.content && listRes.content[0] ? listRes.content[0].text : JSON.stringify(listRes);
|
|
576
728
|
const parsed = JSON.parse(text);
|
|
577
729
|
const registeredNames = new Set((parsed.members || []).map(m => m.name));
|
|
730
|
+
unreservableNames = new Set((parsed.members || []).filter(m => m && m.unreservable).map(m => m.name));
|
|
578
731
|
const result = resolveMemberValidation({ rawMembers, registeredNames, allowMissingMembers });
|
|
579
732
|
if (!result.ok) {
|
|
580
733
|
console.error(result.message);
|
|
@@ -601,6 +754,25 @@ async function main() {
|
|
|
601
754
|
// N15 finding: that stray casing silently never matched a roleMap
|
|
602
755
|
// author's natural lowercase key).
|
|
603
756
|
const orchestratorMember = (roleMap && roleMap.orchestrator && roleMap.orchestrator[0]) || validMembers[0];
|
|
757
|
+
const runProbe = async (cmd, member) => {
|
|
758
|
+
const res = await fleetApi.executeCommand({ command: cmd, member_name: member });
|
|
759
|
+
const text = res && res.content && res.content[0] ? res.content[0].text : '';
|
|
760
|
+
if (res && res.isError) throw new Error(text || 'unknown error');
|
|
761
|
+
const exitCode = res && res.structuredContent && typeof res.structuredContent.exitCode === 'number' ? res.structuredContent.exitCode : 0;
|
|
762
|
+
if (exitCode !== 0) throw new Error(text || `exit code ${exitCode}`);
|
|
763
|
+
return res && res.structuredContent && typeof res.structuredContent.stdout === 'string' ? res.structuredContent.stdout : text;
|
|
764
|
+
};
|
|
765
|
+
// Which .beads the orchestrator member's bd resolves to -- probed BEFORE
|
|
766
|
+
// the `bd show` precondition below so a member with no beads database
|
|
767
|
+
// is reported plainly (a warning with the fix) ahead of the bare bd
|
|
768
|
+
// error that precondition would otherwise be the first to show, and
|
|
769
|
+
// shown in the banner. A failed probe is a warning, not an exit: the
|
|
770
|
+
// existing preconditions decide. The runner repeats this for every
|
|
771
|
+
// member and hard-fails only a mismatch against --expect-beads.
|
|
772
|
+
const beadsProbe = await probeBeadsIdentityOnMember({ member: orchestratorMember, runCommand: runProbe });
|
|
773
|
+
if (!beadsProbe.ok) {
|
|
774
|
+
console.warn(beadsProbe.message);
|
|
775
|
+
}
|
|
604
776
|
const issueCheck = await checkIssuesExistOnMember({
|
|
605
777
|
targetIssues,
|
|
606
778
|
member: orchestratorMember,
|
|
@@ -637,8 +809,31 @@ async function main() {
|
|
|
637
809
|
}
|
|
638
810
|
return res && res.content && res.content[0] ? res.content[0].text : '';
|
|
639
811
|
};
|
|
812
|
+
// apra-fleet: exclude any member flagged `unreservable` from this
|
|
813
|
+
// git-identity/git-remote probe -- such a member (e.g. a shared
|
|
814
|
+
// fleet-sprint orchestrator, docs/design-orchestrator-worktree-model-v2.md)
|
|
815
|
+
// may have no real checkout at all, and `git rev-parse HEAD` on one
|
|
816
|
+
// hard-fails the launch (process.exit(1) just below). Deliberately keyed
|
|
817
|
+
// on the `unreservable` FLAG, not on roleMap.orchestrator membership: a
|
|
818
|
+
// real, git-having dispatch member that is ADDITIONALLY role-mapped as
|
|
819
|
+
// orchestrator (a supported topology, runner.js's branchEnsureMembers
|
|
820
|
+
// dedupe comment) must still pass its legitimate same-HEAD check against
|
|
821
|
+
// the other dispatch members -- filtering on roleMap.orchestrator alone
|
|
822
|
+
// would silently skip that check instead of just skipping a git-less
|
|
823
|
+
// member. This only matters when an operator also lists a shared member
|
|
824
|
+
// in --members (redundant with roleMap.orchestrator, and not required);
|
|
825
|
+
// a normal launch that passes the shared orchestrator ONLY via
|
|
826
|
+
// roleMap.orchestrator was never affected.
|
|
827
|
+
const topologyMembersFiltered = validMembers.filter((m) => !unreservableNames.has(m));
|
|
828
|
+
// Degrade back to the unfiltered list if excluding unreservable members
|
|
829
|
+
// would empty it out entirely -- checkMemberTopology refuses to start on
|
|
830
|
+
// an empty member list, and an operator who names ONLY unreservable
|
|
831
|
+
// members in --members (unusual, but not this check's job to forbid) gets
|
|
832
|
+
// the ORIGINAL single-member-trivial-pass behavior rather than a topology
|
|
833
|
+
// error about having no members at all.
|
|
834
|
+
const topologyMembers = topologyMembersFiltered.length > 0 ? topologyMembersFiltered : validMembers;
|
|
640
835
|
const topology = await checkMemberTopology({
|
|
641
|
-
members:
|
|
836
|
+
members: topologyMembers,
|
|
642
837
|
mode: syncedMode ? 'synced' : 'legacy',
|
|
643
838
|
getIdentity: (member) => runCommand('git rev-parse HEAD', member),
|
|
644
839
|
getOriginUrl: (member) => runCommand('git remote get-url origin', member),
|
|
@@ -659,6 +854,10 @@ async function main() {
|
|
|
659
854
|
console.log(`Goal Constraint: ${goal}`);
|
|
660
855
|
console.log(`Max Cycles: ${maxCycles}`);
|
|
661
856
|
console.log(`Active Members (${validMembers.length}): ${validMembers.join(', ')}`);
|
|
857
|
+
console.log(`Beads: ${formatBeadsIdentity(beadsProbe.identity, { label: `orchestrator '${orchestratorMember}'` })}`);
|
|
858
|
+
if (expectedBeads) {
|
|
859
|
+
console.log(`Beads: ${formatBeadsIdentity(expectedBeads, { label: 'expected (--expect-beads)' })}`);
|
|
860
|
+
}
|
|
662
861
|
|
|
663
862
|
const workflow = new FleetWorkflow(fleetApi);
|
|
664
863
|
const engine = new WorkflowEngine(workflow);
|
|
@@ -735,6 +934,64 @@ async function main() {
|
|
|
735
934
|
});
|
|
736
935
|
await sprintReservation.reserveAll();
|
|
737
936
|
|
|
937
|
+
// apra-fleet-p2to.4.2: reservation handling across a cooperative
|
|
938
|
+
// pause/resume (apra-fleet-p2to.1's engine primitive). On 'paused' hand
|
|
939
|
+
// every member back so another sprint may use it while this one is parked;
|
|
940
|
+
// on 'resumed' re-acquire them OWNER-CHECKED (a member another sprint
|
|
941
|
+
// grabbed while we were paused fails the resume, NAMING it) and re-sync
|
|
942
|
+
// every re-acquired member (git fetch + decideEnsureBranchAction probe +
|
|
943
|
+
// bd dolt pull) unconditionally before work continues. The 'paused' handler
|
|
944
|
+
// is best-effort (a release hiccup must never fail a pause). The 'resumed'
|
|
945
|
+
// handler, by contrast, FAILS the resume when a member was taken while
|
|
946
|
+
// paused: reReserveForResume's throw (an unavailable member) is surfaced --
|
|
947
|
+
// the run is re-paused and the error rethrown -- so the operator sees
|
|
948
|
+
// exactly which members block the resume instead of the sprint silently
|
|
949
|
+
// continuing on zero reservations.
|
|
950
|
+
// `ok` is derived from the command's real exit code (via
|
|
951
|
+
// commandResultToSoftGit), NOT from an isError flag: execute_command never
|
|
952
|
+
// sets isError on a non-zero exit, so reading it here would make every git
|
|
953
|
+
// command -- including the `git merge-base --is-ancestor` tip comparison --
|
|
954
|
+
// look successful and silently reset committed-but-unpushed work. See
|
|
955
|
+
// commandResultToSoftGit()'s doc comment in runner.js.
|
|
956
|
+
const runGitSoft = async (cmd, member) => {
|
|
957
|
+
const res = await fleetApi.executeCommand({ command: cmd, member_name: member });
|
|
958
|
+
return commandResultToSoftGit(res);
|
|
959
|
+
};
|
|
960
|
+
workflow.on('paused', () => {
|
|
961
|
+
sprintReservation.releaseForPause().catch((err) =>
|
|
962
|
+
console.error('[member-reservation] release-on-pause failed:', err && err.message ? err.message : err));
|
|
963
|
+
});
|
|
964
|
+
// (apra-fleet-p2to.1.3) The re-reserve + per-member resync is registered as
|
|
965
|
+
// an AWAITABLE pre-resume hook, not a fire-and-forget 'resumed' listener.
|
|
966
|
+
// requestResume() drains this hook as a hard barrier -- while the run is
|
|
967
|
+
// still paused, so no post-resume agent()/command() dispatch can land ahead
|
|
968
|
+
// of it -- and only then releases the gate waiters and emits 'resumed'. The
|
|
969
|
+
// re-reserve therefore completes strictly BEFORE the first post-resume
|
|
970
|
+
// dispatch, closing the race the old 'resumed' handler left open.
|
|
971
|
+
//
|
|
972
|
+
// reReserveOnResume() does NOT swallow a re-reserve failure (the old
|
|
973
|
+
// `.catch(console.error)` did, silently resuming on zero reservations). It
|
|
974
|
+
// rethrows the MemberReservationResumeError that NAMES the unavailable
|
|
975
|
+
// members; because the hook runs before requestResume() clears pause state,
|
|
976
|
+
// that rejection leaves the run parked (still paused) and propagates out of
|
|
977
|
+
// requestResume() to the resume caller instead of being lost -- the operator
|
|
978
|
+
// sees exactly which members block the resume. requestPause() is still
|
|
979
|
+
// passed for the exported helper's standalone contract; here it is a no-op
|
|
980
|
+
// because the run has not yet been unpaused.
|
|
981
|
+
workflow.setPreResumeHook(() => reReserveOnResume({
|
|
982
|
+
sprintReservation,
|
|
983
|
+
resyncMember: (member) => resyncReacquiredMember({
|
|
984
|
+
member,
|
|
985
|
+
branch: branchName,
|
|
986
|
+
baseBranch,
|
|
987
|
+
runGit: (cmd) => runGitSoft(cmd, member),
|
|
988
|
+
doltPull: (m) => runCommand('bd dolt pull', m),
|
|
989
|
+
log: (msg) => console.log(msg),
|
|
990
|
+
}),
|
|
991
|
+
requestPause: (reason) => workflow.requestPause(reason),
|
|
992
|
+
log: (msg) => console.error(msg),
|
|
993
|
+
}));
|
|
994
|
+
|
|
738
995
|
let reservationReleased = false;
|
|
739
996
|
const releaseReservationOnce = async () => {
|
|
740
997
|
if (reservationReleased) return;
|
|
@@ -768,7 +1025,11 @@ async function main() {
|
|
|
768
1025
|
roleMap,
|
|
769
1026
|
budget,
|
|
770
1027
|
dispatchTimeoutS,
|
|
1028
|
+
usageLimitMaxWaitS,
|
|
1029
|
+
usageLimitMaxReprobes,
|
|
771
1030
|
serviceUrl,
|
|
1031
|
+
runId: effectiveRunId,
|
|
1032
|
+
expectBeads,
|
|
772
1033
|
}),
|
|
773
1034
|
// apra-fleet-eft.75.1: wires this already-connected mcpClient
|
|
774
1035
|
// through to runner.js's createMemberSessionGuard (see its doc
|
|
@@ -823,6 +1084,22 @@ async function main() {
|
|
|
823
1084
|
|
|
824
1085
|
function isMainModule() {
|
|
825
1086
|
try {
|
|
1087
|
+
// Never self-execute when this module is loaded as a test file under a
|
|
1088
|
+
// Node test runner. `node --test <file>` sets NODE_TEST_CONTEXT in the
|
|
1089
|
+
// process that evaluates the file AND leaves process.argv[1] pointing at
|
|
1090
|
+
// that file, so the URL comparison below would otherwise treat the test
|
|
1091
|
+
// load as a direct CLI run and fire main() for real. The Phase-4
|
|
1092
|
+
// move-only probe (scripts/phase4-moveonly-probe.mjs) does exactly this:
|
|
1093
|
+
// it copies cli.mjs to a sibling `.phase4probe-cli.mjs` and runs
|
|
1094
|
+
// `node --test` on it, so without this guard main() runs, exits 1 on the
|
|
1095
|
+
// missing required flags, and the CURRENT revision fails to corroborate
|
|
1096
|
+
// as an ANCHOR_DESYNC -- turning the move-only gate red. NODE_TEST_CONTEXT
|
|
1097
|
+
// is stripped from the probe's spawn env, but `node --test` re-injects it
|
|
1098
|
+
// into the file's own process, so it is a reliable "loaded as a test"
|
|
1099
|
+
// signal. A production CLI launch (node bin/cli.mjs ...) and the workflow
|
|
1100
|
+
// import trampoline (src/cli/workflow.ts, which is not a node --test run)
|
|
1101
|
+
// never have it set, so both keep self-executing.
|
|
1102
|
+
if (process.env.NODE_TEST_CONTEXT) return false;
|
|
826
1103
|
if (process.argv[1] === undefined) return false;
|
|
827
1104
|
const invokedUrl = pathToFileURL(process.argv[1]).href;
|
|
828
1105
|
const moduleUrl = import.meta.url;
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
// =============================================================================
|
|
19
19
|
|
|
20
20
|
import { parseArgs } from 'node:util';
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
import fs from 'node:fs';
|
|
21
23
|
import { pathToFileURL } from 'node:url';
|
|
22
24
|
import { createSupervisor, DEFAULT_SERVICE_PORT, readJsonBody, sendJson } from '../src/supervisor/server.mjs';
|
|
23
25
|
import { createLedger } from '../src/supervisor/ledger.mjs';
|
|
@@ -47,8 +49,13 @@ import { createDashboard, registerDashboardRoutes } from '../src/supervisor/dash
|
|
|
47
49
|
import { createSprintController, registerSprintRoutes, defaultMemberOverlapGuard, ApiError } from '../src/supervisor/api.mjs';
|
|
48
50
|
import { createScopeGuard, formatScopeConflict } from '../src/supervisor/scope-overlap.mjs';
|
|
49
51
|
import { listFleetMembers, executeFleetCommand } from '../src/supervisor/fleet-members.mjs';
|
|
50
|
-
import { createDoltOrphanSweep } from '../src/supervisor/dolt-orphan-sweep.mjs';
|
|
52
|
+
import { createDoltOrphanSweep, normalizeMsysPathForPlatform } from '../src/supervisor/dolt-orphan-sweep.mjs';
|
|
51
53
|
import { resolveFleetServerConnection } from './cli.mjs';
|
|
54
|
+
import {
|
|
55
|
+
discoverBeadsDir, resolveBeadsDirArg, probeBeadsIdentity, createBeadsIdentityState,
|
|
56
|
+
formatNoBeadsWarning, formatProbeFailedWarning,
|
|
57
|
+
} from '../src/supervisor/beads-identity.mjs';
|
|
58
|
+
import { formatBeadsIdentity, serializeExpectedIdentity } from '../fleet-sprint/beads-identity.mjs';
|
|
52
59
|
|
|
53
60
|
const SERVE_USAGE = `
|
|
54
61
|
Usage: fleet-se serve [options]
|
|
@@ -57,8 +64,23 @@ Starts the always-on fleet-sprint supervisor. Runs until POST /api/shutdown or a
|
|
|
57
64
|
termination signal (Ctrl-C / SIGTERM).
|
|
58
65
|
|
|
59
66
|
Options:
|
|
60
|
-
--port <port>
|
|
61
|
-
|
|
67
|
+
--port <port> HTTP service port for the supervisor API. Default: ${DEFAULT_SERVICE_PORT}.
|
|
68
|
+
--beads-dir <path> Project folder (or its .beads dir) whose beads tracker
|
|
69
|
+
this supervisor runs against. Default: discovered by
|
|
70
|
+
walking up from the current directory, exactly like
|
|
71
|
+
bd does. None found: the supervisor still starts,
|
|
72
|
+
logs a WARNING and reports beads as unknown until
|
|
73
|
+
GET /api/health?refresh=1 finds one. A path that
|
|
74
|
+
does not exist is an error.
|
|
75
|
+
-h, --help Show this help message.
|
|
76
|
+
|
|
77
|
+
Environment:
|
|
78
|
+
FLEET_SE_DATA_DIR Service data dir (ledger/history/logs).
|
|
79
|
+
FLEET_SE_SWEEP_OWNER_DATA_DIR Scope the dolt-orphan-sweep to ephemeral
|
|
80
|
+
dolt sql-servers whose --data-dir is under
|
|
81
|
+
this path, so an isolated supervisor
|
|
82
|
+
instance never kills another instance's
|
|
83
|
+
server. Unset = machine-wide (default).
|
|
62
84
|
`.trim();
|
|
63
85
|
|
|
64
86
|
/**
|
|
@@ -102,6 +124,7 @@ export function parseServeArgs(argv) {
|
|
|
102
124
|
args: argv,
|
|
103
125
|
options: {
|
|
104
126
|
port: { type: 'string' },
|
|
127
|
+
'beads-dir': { type: 'string' },
|
|
105
128
|
help: { type: 'boolean', short: 'h' },
|
|
106
129
|
},
|
|
107
130
|
strict: true,
|
|
@@ -140,6 +163,53 @@ export async function serveMain(argv = process.argv.slice(2)) {
|
|
|
140
163
|
}
|
|
141
164
|
}
|
|
142
165
|
|
|
166
|
+
// Which .beads this supervisor runs against -- resolved ONCE, up front,
|
|
167
|
+
// BEFORE any seam is built or the port is bound, so a supervisor started
|
|
168
|
+
// from the wrong folder says so loudly instead of silently serving an
|
|
169
|
+
// empty backlog or dispatching sprints at an unrelated tracker. Every bd
|
|
170
|
+
// the supervisor itself runs (backlog/scope-overlap) resolves by walking
|
|
171
|
+
// up from process.cwd(), so `--beads-dir` is honored by chdir'ing there
|
|
172
|
+
// (nothing sets BEADS_DIR, nothing is persisted); the sprint children
|
|
173
|
+
// below then get repoRoot as their cwd and the resolved identity as
|
|
174
|
+
// --expect-beads.
|
|
175
|
+
//
|
|
176
|
+
// Severity: a `--beads-dir` that does not exist is an operator typo and
|
|
177
|
+
// still a startup ERROR. No .beads reachable from cwd, or a failing
|
|
178
|
+
// identity probe, is an environment condition: a WARNING (with the fix),
|
|
179
|
+
// the identity stays "unknown" (health `beads: null` + `beadsWarning`,
|
|
180
|
+
// amber dashboard header, no --expect-beads handed to sprints -- the
|
|
181
|
+
// engine then verifies members against the orchestrator's own beads),
|
|
182
|
+
// and GET /api/health?refresh=1 can recover it without a restart.
|
|
183
|
+
if (values['beads-dir'] !== undefined) {
|
|
184
|
+
let target;
|
|
185
|
+
try {
|
|
186
|
+
target = resolveBeadsDirArg(values['beads-dir']);
|
|
187
|
+
process.chdir(target);
|
|
188
|
+
} catch (err) {
|
|
189
|
+
console.error(`Error: ${err && err.message ? err.message : err}`);
|
|
190
|
+
return { exitCode: 1 };
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const discovered = discoverBeadsDir({ cwd: process.cwd() });
|
|
194
|
+
const repoRoot = discovered ? discovered.repoRoot : process.cwd();
|
|
195
|
+
let beadsIdentityRecord = null;
|
|
196
|
+
let beadsWarning = null;
|
|
197
|
+
if (!discovered) {
|
|
198
|
+
beadsWarning = formatNoBeadsWarning(process.cwd());
|
|
199
|
+
} else {
|
|
200
|
+
try {
|
|
201
|
+
beadsIdentityRecord = await probeBeadsIdentity({ cwd: repoRoot });
|
|
202
|
+
} catch (err) {
|
|
203
|
+
beadsWarning = formatProbeFailedWarning(repoRoot, err);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const beadsIdentity = createBeadsIdentityState({ cwd: repoRoot, initial: beadsIdentityRecord, warning: beadsWarning });
|
|
207
|
+
if (beadsIdentityRecord) {
|
|
208
|
+
console.log(`[supervisor] ${formatBeadsIdentity(beadsIdentityRecord, { label: 'supervisor' })}`);
|
|
209
|
+
} else {
|
|
210
|
+
console.warn(`[supervisor] WARNING: ${beadsWarning}`);
|
|
211
|
+
}
|
|
212
|
+
|
|
143
213
|
// The durable reservation ledger (eft.5.1) and its terminal-event history
|
|
144
214
|
// (eft.5.4) are the restart-surviving source of truth. Wire them as real
|
|
145
215
|
// collaborators so a restarted supervisor reconciles against on-disk state.
|
|
@@ -181,6 +251,19 @@ export async function serveMain(argv = process.argv.slice(2)) {
|
|
|
181
251
|
// discoverable even after the reservation is eventually released.
|
|
182
252
|
const spawner = createSpawner({
|
|
183
253
|
serviceUrl: `http://localhost:${port}`,
|
|
254
|
+
// Sprint children run from the project root (the folder holding the
|
|
255
|
+
// discovered .beads, not whatever subfolder the operator started in)
|
|
256
|
+
// and carry the resolved identity so the engine can verify every
|
|
257
|
+
// member's own `bd where` against it (see beads-identity.mjs). Read
|
|
258
|
+
// at each spawn (not captured at startup) so an identity recovered
|
|
259
|
+
// by GET /api/health?refresh=1 reaches later sprints; while it is
|
|
260
|
+
// unknown, --expect-beads is omitted and the engine falls back to
|
|
261
|
+
// the orchestrator member's own identity.
|
|
262
|
+
cwd: repoRoot,
|
|
263
|
+
expectBeads: () => {
|
|
264
|
+
const id = beadsIdentity.get();
|
|
265
|
+
return id ? serializeExpectedIdentity(id) : undefined;
|
|
266
|
+
},
|
|
184
267
|
onChildExit: async ({ runId, exitCode, signal, at, logPath }) => {
|
|
185
268
|
if (!runId) return;
|
|
186
269
|
try {
|
|
@@ -251,7 +334,7 @@ export async function serveMain(argv = process.argv.slice(2)) {
|
|
|
251
334
|
// Backlog, then the Launch Sprint form (launch-form.mjs attaches itself
|
|
252
335
|
// via dashboard.mjs's renderIndexPageHtml default; see the import comment
|
|
253
336
|
// above for why no separate launch-form seam is constructed here).
|
|
254
|
-
const dashboard = createDashboard({ ledger, watchdog, backlog });
|
|
337
|
+
const dashboard = createDashboard({ ledger, watchdog, backlog, beadsIdentity });
|
|
255
338
|
|
|
256
339
|
// docs/dolt-sync-redesign.md Part 3.3: kill any orphaned ephemeral
|
|
257
340
|
// `dolt sql-server` a mid-settle orchestrator death left behind on a
|
|
@@ -259,12 +342,37 @@ export async function serveMain(argv = process.argv.slice(2)) {
|
|
|
259
342
|
// collaborators use the same short-lived-MCP-connection pattern as
|
|
260
343
|
// listFleetMembers -- the supervisor never holds a standing fleet
|
|
261
344
|
// transport.
|
|
345
|
+
// apra-fleet-5co8.33: `FLEET_SE_SWEEP_OWNER_DATA_DIR` is the deps-level
|
|
346
|
+
// scope seam for that sweep. Unset (production default) the probe/kill
|
|
347
|
+
// command stays machine-wide -- it must be, because the ephemeral server's
|
|
348
|
+
// `--data-dir` belongs to the MEMBER (dolt-settle.mjs reads it from
|
|
349
|
+
// `bd dolt status` there), so a remote member's data dir has no relation to
|
|
350
|
+
// this supervisor's own FLEET_SE_DATA_DIR and deriving a prefix from the
|
|
351
|
+
// latter would silently make the sweep a no-op everywhere. Set (an isolated
|
|
352
|
+
// instance -- e.g. regression-test-playbook.md's sandbox supervisor, whose
|
|
353
|
+
// HOME and members all live under one root) it constrains candidates to
|
|
354
|
+
// processes whose `--data-dir` is under that root, so this instance can
|
|
355
|
+
// never kill another live supervisor's ephemeral server.
|
|
356
|
+
const sweepOwnerDataDir = process.env.FLEET_SE_SWEEP_OWNER_DATA_DIR
|
|
357
|
+
? path.resolve(normalizeMsysPathForPlatform(process.env.FLEET_SE_SWEEP_OWNER_DATA_DIR))
|
|
358
|
+
: null;
|
|
359
|
+
if (sweepOwnerDataDir) {
|
|
360
|
+
console.log(`[dolt-orphan-sweep] owner-scoped to data dirs under '${sweepOwnerDataDir}' (FLEET_SE_SWEEP_OWNER_DATA_DIR).`);
|
|
361
|
+
// apra-fleet-5co8.36: a confident scope claim above is worse than
|
|
362
|
+
// useless if the resolved prefix does not actually exist -- that is
|
|
363
|
+
// exactly what an un-normalized MSYS path used to produce. Warn
|
|
364
|
+
// loudly rather than let the sweep silently match nothing.
|
|
365
|
+
if (!fs.existsSync(sweepOwnerDataDir)) {
|
|
366
|
+
console.warn(`[dolt-orphan-sweep] WARNING: FLEET_SE_SWEEP_OWNER_DATA_DIR resolved to '${sweepOwnerDataDir}', which does not exist on disk -- the owner-scoped sweep will match no process and silently degrade to matching nothing.`);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
262
369
|
const doltOrphanSweep = createDoltOrphanSweep({
|
|
263
370
|
listMembers: () => listFleetMembers({ resolveConnection: resolveFleetServerConnection }),
|
|
264
371
|
execCommand: ({ member, command }) => executeFleetCommand({ member, command, resolveConnection: resolveFleetServerConnection }),
|
|
372
|
+
ownerDataDirPrefix: sweepOwnerDataDir,
|
|
265
373
|
});
|
|
266
374
|
|
|
267
|
-
const supervisor = createSupervisor({ port, ledger, spawner, watchdog, dashboard, idAllocator, doltMutex, doltOrphanSweep });
|
|
375
|
+
const supervisor = createSupervisor({ port, ledger, spawner, watchdog, dashboard, idAllocator, doltMutex, doltOrphanSweep, beadsIdentity });
|
|
268
376
|
registerIdAllocatorRoutes(supervisor, idAllocator, { readJsonBody, sendJson });
|
|
269
377
|
registerDoltMutexRoutes(supervisor, doltMutex, { readJsonBody, sendJson });
|
|
270
378
|
|
|
@@ -311,6 +419,7 @@ export async function serveMain(argv = process.argv.slice(2)) {
|
|
|
311
419
|
listMembers: listMembersForLaunch,
|
|
312
420
|
getBacklog: async () => ({ tree: await backlog.buildTree() }),
|
|
313
421
|
beforeLaunch,
|
|
422
|
+
beadsIdentity,
|
|
314
423
|
});
|
|
315
424
|
registerSprintRoutes(supervisor, sprintController);
|
|
316
425
|
|