@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
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Beads identity precondition: prove which .beads every member will mutate
|
|
3
|
+
// BEFORE the sprint issues its first mutating bd command.
|
|
4
|
+
//
|
|
5
|
+
// fleet-sprint never runs bd itself -- every bd goes to a member and runs in
|
|
6
|
+
// that member's workFolder, so bd's own cwd discovery decides which database
|
|
7
|
+
// a sprint mutates. Nothing else in the engine verifies that the database a
|
|
8
|
+
// member resolves to is the project the supervisor launched the sprint for.
|
|
9
|
+
// This module runs the three read-only probes from beads-identity.mjs on the
|
|
10
|
+
// orchestrator member first and then on every other distinct member, and
|
|
11
|
+
// compares each answer against the expected identity. The expected identity
|
|
12
|
+
// is either the supervisor's (`--expect-beads`, args.expectBeads) or, absent
|
|
13
|
+
// that, the orchestrator member's own probed identity -- in which case only
|
|
14
|
+
// the OTHER members are compared and the log says so.
|
|
15
|
+
//
|
|
16
|
+
// Severity model (deliberate):
|
|
17
|
+
// - MISMATCH is FATAL: a field that resolved on BOTH sides and differs
|
|
18
|
+
// means the member's bd points at a different project. Throws
|
|
19
|
+
// BeadsIdentityError (reason MISMATCH) before any bd mutation.
|
|
20
|
+
// - an UNRESOLVED probe is a WARNING: a probe that failed, or answered
|
|
21
|
+
// something unparseable/empty, leaves that field out of the comparison.
|
|
22
|
+
// The warning names the member, the field, the probe, the error and the
|
|
23
|
+
// fix, so the operator can repair it; the first real bd on that member
|
|
24
|
+
// surfaces a genuinely broken member exactly as it does today. Every
|
|
25
|
+
// warning is logged with the `[beads-identity] WARNING:` prefix, and
|
|
26
|
+
// collected into the published `beadsIdentity` state (`warnings`, plus
|
|
27
|
+
// a per-member `unresolved` field list) so the viewer can show it.
|
|
28
|
+
//
|
|
29
|
+
// Every command() call here names its member explicitly (dispatch-safety
|
|
30
|
+
// guard) and is issued failSoft + silent, like every other read-only probe in
|
|
31
|
+
// this package. Each member is probed at most once per run.
|
|
32
|
+
// =============================================================================
|
|
33
|
+
|
|
34
|
+
import {
|
|
35
|
+
BEADS_IDENTITY_PROBES,
|
|
36
|
+
COMPARED_FIELDS,
|
|
37
|
+
parseBeadsIdentity,
|
|
38
|
+
compareIdentity,
|
|
39
|
+
formatBeadsIdentity,
|
|
40
|
+
} from './beads-identity.mjs';
|
|
41
|
+
import { BeadsIdentityError, BEADS_IDENTITY_FAILURE_REASONS } from './errors.mjs';
|
|
42
|
+
|
|
43
|
+
// Short: three cheap local reads per member. A member that cannot answer
|
|
44
|
+
// `bd where` inside a minute is not a member this sprint should mutate.
|
|
45
|
+
export const BEADS_IDENTITY_PROBE_TIMEOUT_S = 60;
|
|
46
|
+
|
|
47
|
+
const LABEL = 'beads-identity';
|
|
48
|
+
export const BEADS_IDENTITY_WARNING_PREFIX = '[beads-identity] WARNING: ';
|
|
49
|
+
|
|
50
|
+
// Which probe each compared field comes from, and the operator-facing fix
|
|
51
|
+
// when that field could not be resolved on a member. Generic on purpose: no
|
|
52
|
+
// product paths, no host-specific text.
|
|
53
|
+
const FIELD_PROBE = Object.freeze({
|
|
54
|
+
prefix: 'where',
|
|
55
|
+
syncRemote: 'syncRemote',
|
|
56
|
+
repoRemote: 'repoRemote',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const BEADS_IDENTITY_FIELD_FIX = Object.freeze({
|
|
60
|
+
prefix: "run 'bd where' in the member's workFolder; ensure bd is installed there and the folder contains the project's .beads",
|
|
61
|
+
syncRemote: "set it on that member with 'bd config set sync.remote <url>' in its workFolder",
|
|
62
|
+
repoRemote: "the member's workFolder is not a git clone with an 'origin' remote; re-register the member with a real clone or add the remote",
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
function outputOf(res) {
|
|
66
|
+
if (res && typeof res === 'object') return typeof res.output === 'string' ? res.output : '';
|
|
67
|
+
return typeof res === 'string' ? res : '';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function failureOf(res) {
|
|
71
|
+
if (res && typeof res === 'object' && res.ok === false) return String(res.error || 'command failed');
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// One line (a warning is one log line), capped.
|
|
76
|
+
function summarizeRaw(text) {
|
|
77
|
+
const t = String(text || '').replace(/\s+/g, ' ').trim();
|
|
78
|
+
if (!t) return '(no output)';
|
|
79
|
+
return t.length > 400 ? `${t.slice(0, 400)}...` : t;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* A per-run prober: runs the three identity probes on a member through the
|
|
84
|
+
* injected command() and memoizes the result so a member is probed once.
|
|
85
|
+
*
|
|
86
|
+
* @param {{ command: Function, timeoutS?: number }} opts
|
|
87
|
+
* @returns {{ probe: (member: string) => Promise<{ identity: object, raw: object, failures: Array<{probe: string, key: string, error: string}> }> }}
|
|
88
|
+
*/
|
|
89
|
+
export function createBeadsIdentityProber({ command, timeoutS = BEADS_IDENTITY_PROBE_TIMEOUT_S }) {
|
|
90
|
+
if (typeof command !== 'function') {
|
|
91
|
+
throw new TypeError('createBeadsIdentityProber({ command }): command must be a function');
|
|
92
|
+
}
|
|
93
|
+
const cache = new Map();
|
|
94
|
+
|
|
95
|
+
async function runProbes(member) {
|
|
96
|
+
const raw = {};
|
|
97
|
+
const failures = [];
|
|
98
|
+
for (const [key, cmd] of Object.entries(BEADS_IDENTITY_PROBES)) {
|
|
99
|
+
let res;
|
|
100
|
+
try {
|
|
101
|
+
res = await command(cmd, { member_name: member, silent: true, failSoft: true, label: LABEL, timeout_s: timeoutS });
|
|
102
|
+
} catch (err) {
|
|
103
|
+
res = { ok: false, output: '', error: err && err.message ? err.message : String(err) };
|
|
104
|
+
}
|
|
105
|
+
const failed = failureOf(res);
|
|
106
|
+
raw[key] = outputOf(res);
|
|
107
|
+
if (failed !== null) failures.push({ probe: cmd, key, error: failed });
|
|
108
|
+
}
|
|
109
|
+
return { identity: parseBeadsIdentity(raw), raw, failures };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
probe(member) {
|
|
114
|
+
let pending = cache.get(member);
|
|
115
|
+
if (!pending) {
|
|
116
|
+
pending = runProbes(member);
|
|
117
|
+
cache.set(member, pending);
|
|
118
|
+
}
|
|
119
|
+
return pending;
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Why a probe key resolved to nothing on this member: its recorded failure,
|
|
125
|
+
// else the (unparseable or empty) output it did return.
|
|
126
|
+
function probeDetail(probed, key) {
|
|
127
|
+
const failure = probed.failures.find((f) => f.key === key);
|
|
128
|
+
if (failure) return summarizeRaw(failure.error);
|
|
129
|
+
const out = String(probed.raw[key] || '').trim();
|
|
130
|
+
if (!out) return 'empty output';
|
|
131
|
+
// `bd config get` answers an unset key with exit 0 and value "": the
|
|
132
|
+
// probe worked, the value is simply not configured.
|
|
133
|
+
if (key === 'syncRemote') return 'sync.remote is unset';
|
|
134
|
+
return `unparseable output: ${summarizeRaw(out)}`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// The member's `bd where` produced no database path: nothing to compare.
|
|
138
|
+
function noDatabaseWarning(member, probed) {
|
|
139
|
+
return `member '${member}' reports no beads database in its workFolder ` +
|
|
140
|
+
`('${BEADS_IDENTITY_PROBES.where}' -> ${probeDetail(probed, 'where')}); nothing to compare, the first bd command on it will surface the problem. ` +
|
|
141
|
+
`To fix: ${BEADS_IDENTITY_FIELD_FIX.prefix}.`;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// One compared field is empty on the member's side.
|
|
145
|
+
function unresolvedFieldWarning(member, field, probed) {
|
|
146
|
+
const key = FIELD_PROBE[field];
|
|
147
|
+
return `member '${member}' could not report ${field} ('${BEADS_IDENTITY_PROBES[key]}' -> ${probeDetail(probed, key)}); not compared. ` +
|
|
148
|
+
`To fix: ${BEADS_IDENTITY_FIELD_FIX[field]}.`;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// One compared field is empty on the EXPECTED side (the supplied
|
|
152
|
+
// --expect-beads carries no value for it, or the orchestrator it was derived
|
|
153
|
+
// from could not report it), so no member can be checked on it.
|
|
154
|
+
function unresolvedExpectedWarning(field, expectedFrom, orchestratorMember) {
|
|
155
|
+
const source = expectedFrom === 'orchestrator'
|
|
156
|
+
? `the orchestrator member '${orchestratorMember}' it was derived from could not report ${field}`
|
|
157
|
+
: `the supplied expected beads identity carries no ${field}`;
|
|
158
|
+
return `${source}; ${field} is not compared on any member this sprint. ` +
|
|
159
|
+
`To fix: ${BEADS_IDENTITY_FIELD_FIX[field]}${expectedFrom === 'orchestrator' ? ' (on the orchestrator member), or launch via the supervisor so --expect-beads is supplied' : ''}.`;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function noExpectationWarning(orchestratorMember, probed) {
|
|
163
|
+
return `no expected beads identity was supplied and the orchestrator member '${orchestratorMember}' could not report its beads database ` +
|
|
164
|
+
`('${BEADS_IDENTITY_PROBES.where}' -> ${probeDetail(probed, 'where')}); no cross-member beads identity check will happen this sprint. ` +
|
|
165
|
+
`To restore it: fix the orchestrator member's beads (${BEADS_IDENTITY_FIELD_FIX.prefix}), or launch via the supervisor so --expect-beads is supplied.`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function assertMatches(member, expected, actual, cmp) {
|
|
169
|
+
if (cmp.ok) return;
|
|
170
|
+
const lines = cmp.mismatches.map((m) => `${m.field}: expected '${m.expected || '(unset)'}', actual '${m.actual || '(unset)'}'`);
|
|
171
|
+
throw new BeadsIdentityError(
|
|
172
|
+
`Beads identity check failed: member '${member}' resolves to a different beads database than expected ` +
|
|
173
|
+
`(${actual.beadsDir}) -- ${lines.join('; ')}. Refusing to mutate beads on it.`,
|
|
174
|
+
{ reason: BEADS_IDENTITY_FAILURE_REASONS.MISMATCH, member, mismatches: cmp.mismatches, details: { actual, expected } }
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* The precondition itself. Probes the orchestrator member, then every other
|
|
180
|
+
* distinct member. Throws BeadsIdentityError (reason MISMATCH) before
|
|
181
|
+
* returning when a field that resolved on both sides differs; every probe
|
|
182
|
+
* that could not resolve a field is a logged + published warning instead.
|
|
183
|
+
*
|
|
184
|
+
* @param {{
|
|
185
|
+
* command: Function, log?: Function, publishState?: Function,
|
|
186
|
+
* orchestratorMember: string, members: string[],
|
|
187
|
+
* expected?: object|null, prober?: object, timeoutS?: number,
|
|
188
|
+
* }} opts
|
|
189
|
+
* @returns {Promise<{
|
|
190
|
+
* expected: object|null, expectedFrom: 'args'|'orchestrator'|'none',
|
|
191
|
+
* members: Record<string, object>, warnings: string[],
|
|
192
|
+
* }>}
|
|
193
|
+
* `members[name]` is that member's probed identity record plus
|
|
194
|
+
* `unresolved: string[]` (the compared fields it could not report). A
|
|
195
|
+
* member with no beads database at all has NO entry -- only a warning.
|
|
196
|
+
*/
|
|
197
|
+
export async function verifyBeadsIdentity({ command, log = () => {}, publishState, orchestratorMember, members, expected = null, prober, timeoutS }) {
|
|
198
|
+
if (typeof orchestratorMember !== 'string' || !orchestratorMember) {
|
|
199
|
+
throw new TypeError('verifyBeadsIdentity: orchestratorMember must be a non-empty string');
|
|
200
|
+
}
|
|
201
|
+
const p = prober || createBeadsIdentityProber({ command, timeoutS });
|
|
202
|
+
const ordered = [orchestratorMember, ...(Array.isArray(members) ? members : [])]
|
|
203
|
+
.filter((m, i, arr) => typeof m === 'string' && m && arr.indexOf(m) === i);
|
|
204
|
+
|
|
205
|
+
const warnings = [];
|
|
206
|
+
const warn = (text) => {
|
|
207
|
+
warnings.push(text);
|
|
208
|
+
log(`${BEADS_IDENTITY_WARNING_PREFIX}${text}`);
|
|
209
|
+
};
|
|
210
|
+
const result = { expected: null, expectedFrom: 'args', members: {}, warnings };
|
|
211
|
+
|
|
212
|
+
const orchestratorProbe = await p.probe(orchestratorMember);
|
|
213
|
+
const orchestratorHasDb = !!orchestratorProbe.identity.beadsDir;
|
|
214
|
+
|
|
215
|
+
let expectedIdentity = expected;
|
|
216
|
+
if (!expectedIdentity) {
|
|
217
|
+
if (orchestratorHasDb) {
|
|
218
|
+
result.expectedFrom = 'orchestrator';
|
|
219
|
+
expectedIdentity = { ...orchestratorProbe.identity };
|
|
220
|
+
log(`[beads-identity] no expected beads identity was supplied; taking the expectation from the orchestrator member '${orchestratorMember}'.`);
|
|
221
|
+
} else {
|
|
222
|
+
result.expectedFrom = 'none';
|
|
223
|
+
warn(noExpectationWarning(orchestratorMember, orchestratorProbe));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
result.expected = expectedIdentity;
|
|
227
|
+
|
|
228
|
+
// Fields the expectation itself lacks: warned once, up front, so the
|
|
229
|
+
// per-member loop below never repeats them for every member.
|
|
230
|
+
const expectedUnresolved = new Set();
|
|
231
|
+
if (expectedIdentity) {
|
|
232
|
+
for (const field of COMPARED_FIELDS) {
|
|
233
|
+
if (!String(expectedIdentity[field] ?? '').trim()) {
|
|
234
|
+
expectedUnresolved.add(field);
|
|
235
|
+
warn(unresolvedExpectedWarning(field, result.expectedFrom, orchestratorMember));
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Checks one probed member: warns for what it could not report, throws
|
|
241
|
+
// on a genuine mismatch, records the identity (or nothing at all when
|
|
242
|
+
// it has no database). `compare` is false for the orchestrator when the
|
|
243
|
+
// expectation was taken from it.
|
|
244
|
+
function settle(member, probed, compare) {
|
|
245
|
+
if (!probed.identity.beadsDir) {
|
|
246
|
+
warn(noDatabaseWarning(member, probed));
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const cmp = expectedIdentity
|
|
250
|
+
? compareIdentity(expectedIdentity, probed.identity, { skipUnresolved: true })
|
|
251
|
+
: { ok: true, mismatches: [], unresolved: [] };
|
|
252
|
+
const unresolved = [];
|
|
253
|
+
for (const field of COMPARED_FIELDS) {
|
|
254
|
+
if (String(probed.identity[field] ?? '').trim()) continue;
|
|
255
|
+
unresolved.push(field);
|
|
256
|
+
// The orchestrator's own gaps were already reported above as the
|
|
257
|
+
// expectation's gaps when the expectation came from it.
|
|
258
|
+
if (compare || !expectedUnresolved.has(field)) warn(unresolvedFieldWarning(member, field, probed));
|
|
259
|
+
}
|
|
260
|
+
if (compare) assertMatches(member, expectedIdentity, probed.identity, cmp);
|
|
261
|
+
result.members[member] = { ...probed.identity, unresolved };
|
|
262
|
+
log(formatBeadsIdentity(probed.identity, { label: `beads ok: ${member}` }));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
settle(orchestratorMember, orchestratorProbe, !!expected);
|
|
266
|
+
|
|
267
|
+
for (const member of ordered) {
|
|
268
|
+
if (member === orchestratorMember) continue;
|
|
269
|
+
const probed = await p.probe(member);
|
|
270
|
+
settle(member, probed, !!expectedIdentity);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (typeof publishState === 'function') {
|
|
274
|
+
publishState('beadsIdentity', {
|
|
275
|
+
expected: result.expected,
|
|
276
|
+
expectedFrom: result.expectedFrom,
|
|
277
|
+
members: result.members,
|
|
278
|
+
warnings: [...warnings],
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
return result;
|
|
282
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Beads identity: which .beads database a component is actually talking to.
|
|
3
|
+
//
|
|
4
|
+
// bd resolves its database by walking up from the cwd of whichever process
|
|
5
|
+
// runs it. fleet-sprint never runs bd itself -- every bd goes to a member and
|
|
6
|
+
// runs inside that member's workFolder -- so the ONLY way to know (and prove)
|
|
7
|
+
// which database a sprint will mutate is to ask each member `bd where`. The
|
|
8
|
+
// supervisor does run bd (backlog + scope-overlap reads), in its own cwd.
|
|
9
|
+
//
|
|
10
|
+
// This module is the shared, pure contract both sides use:
|
|
11
|
+
// - the probe command strings (plain read-only bd/git; no env, no shell
|
|
12
|
+
// specific text -- execute_command already cd's per member OS),
|
|
13
|
+
// - parsing of their output into one { beadsDir, prefix, syncRemote,
|
|
14
|
+
// repoRemote } record,
|
|
15
|
+
// - comparison of two records. beadsDir is DISPLAYED, never compared: it is
|
|
16
|
+
// a path on whichever box ran the probe. prefix, syncRemote and repoRemote
|
|
17
|
+
// are the project identity; every field that resolved on both sides must
|
|
18
|
+
// match (a field a probe could not resolve is reported, not compared).
|
|
19
|
+
//
|
|
20
|
+
// No I/O here: callers run the commands and hand the stdout in.
|
|
21
|
+
// =============================================================================
|
|
22
|
+
|
|
23
|
+
// The three probes. Order matters only for readability of logs.
|
|
24
|
+
export const BEADS_IDENTITY_PROBES = Object.freeze({
|
|
25
|
+
where: 'bd where --json',
|
|
26
|
+
syncRemote: 'bd config get sync.remote --json',
|
|
27
|
+
repoRemote: 'git remote get-url origin',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export function buildIdentityProbeCommands() {
|
|
31
|
+
return { ...BEADS_IDENTITY_PROBES };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Fields that must agree between two identities. beadsDir is excluded on
|
|
35
|
+
// purpose (see header).
|
|
36
|
+
export const COMPARED_FIELDS = Object.freeze(['prefix', 'syncRemote', 'repoRemote']);
|
|
37
|
+
|
|
38
|
+
function firstJsonObject(text) {
|
|
39
|
+
if (typeof text !== 'string') return null;
|
|
40
|
+
const start = text.indexOf('{');
|
|
41
|
+
if (start < 0) return null;
|
|
42
|
+
try {
|
|
43
|
+
return JSON.parse(text.slice(start));
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// `bd where --json` -> { path, prefix, database_path, schema_version }.
|
|
50
|
+
// Plain `bd where` (no --json) prints the dir on line 1 and " prefix: X" on
|
|
51
|
+
// line 2; accepted as a fallback so a member running an older bd still parses.
|
|
52
|
+
export function parseBdWhere(text) {
|
|
53
|
+
const obj = firstJsonObject(text);
|
|
54
|
+
if (obj && typeof obj.path === 'string' && obj.path.trim()) {
|
|
55
|
+
return {
|
|
56
|
+
beadsDir: obj.path.trim(),
|
|
57
|
+
prefix: typeof obj.prefix === 'string' ? obj.prefix.trim() : '',
|
|
58
|
+
databasePath: typeof obj.database_path === 'string' ? obj.database_path.trim() : '',
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (typeof text !== 'string') return null;
|
|
62
|
+
const lines = text.split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
|
|
63
|
+
if (lines.length === 0) return null;
|
|
64
|
+
const dir = lines[0];
|
|
65
|
+
if (!/[\\/]\.beads$/.test(dir)) return null;
|
|
66
|
+
let prefix = '';
|
|
67
|
+
let databasePath = '';
|
|
68
|
+
for (const l of lines.slice(1)) {
|
|
69
|
+
const m = /^(prefix|database):\s*(.+)$/.exec(l);
|
|
70
|
+
if (!m) continue;
|
|
71
|
+
if (m[1] === 'prefix') prefix = m[2].trim();
|
|
72
|
+
else databasePath = m[2].trim();
|
|
73
|
+
}
|
|
74
|
+
return { beadsDir: dir, prefix, databasePath };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// `bd config get sync.remote --json` -> { key, value, ... }; an unset key is
|
|
78
|
+
// exit 0 with value "". Plain output (no --json) is the raw value.
|
|
79
|
+
export function parseBdConfigValue(text) {
|
|
80
|
+
const obj = firstJsonObject(text);
|
|
81
|
+
if (obj && 'value' in obj) {
|
|
82
|
+
return typeof obj.value === 'string' ? obj.value.trim() : String(obj.value ?? '').trim();
|
|
83
|
+
}
|
|
84
|
+
if (typeof text !== 'string') return '';
|
|
85
|
+
return text.trim().split(/\r?\n/)[0].trim();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Canonical form of a git remote (lower-cased) so `git+https://x/y.git`,
|
|
89
|
+
// `git@x:y.git` and `ssh://git@x/y` all compare equal when they name the
|
|
90
|
+
// same repository. Returns '' for empty input.
|
|
91
|
+
export function normalizeRemoteUrl(url) {
|
|
92
|
+
if (typeof url !== 'string') return '';
|
|
93
|
+
let u = url.trim();
|
|
94
|
+
if (!u) return '';
|
|
95
|
+
u = u.replace(/^git\+/, '');
|
|
96
|
+
// scp-like: git@host:owner/repo(.git)
|
|
97
|
+
const scp = /^(?:[\w.-]+@)?([\w.-]+):(?!\/\/)(.+)$/.exec(u);
|
|
98
|
+
if (scp && !/^[a-z][a-z0-9+.-]*:\/\//i.test(u)) {
|
|
99
|
+
u = `${scp[1]}/${scp[2]}`;
|
|
100
|
+
} else {
|
|
101
|
+
u = u.replace(/^[a-z][a-z0-9+.-]*:\/\//i, '');
|
|
102
|
+
u = u.replace(/^[^@/]+@/, '');
|
|
103
|
+
}
|
|
104
|
+
u = u.replace(/\/+$/, '').replace(/\.git$/, '');
|
|
105
|
+
// Hosting providers treat owner/repo case-insensitively; fold the whole
|
|
106
|
+
// thing so a differently-cased clone URL is not a false mismatch.
|
|
107
|
+
return u.toLowerCase();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Builds one identity record from the three probe outputs. Any probe that
|
|
111
|
+
// could not be parsed leaves its field '' -- an UNRESOLVED field. Strict
|
|
112
|
+
// compareIdentity (the default) treats '' against a non-empty expectation
|
|
113
|
+
// as a mismatch; the engine's precondition passes { skipUnresolved: true }
|
|
114
|
+
// so an unresolved field is reported (warned about) rather than compared.
|
|
115
|
+
export function parseBeadsIdentity({ where, syncRemote, repoRemote }) {
|
|
116
|
+
const w = parseBdWhere(where);
|
|
117
|
+
return {
|
|
118
|
+
beadsDir: w ? w.beadsDir : '',
|
|
119
|
+
prefix: w ? w.prefix : '',
|
|
120
|
+
databasePath: w ? w.databasePath : '',
|
|
121
|
+
syncRemote: parseBdConfigValue(syncRemote),
|
|
122
|
+
repoRemote: typeof repoRemote === 'string' ? repoRemote.trim().split(/\r?\n/)[0].trim() : '',
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function isCompleteIdentity(id) {
|
|
127
|
+
return !!(id && id.beadsDir && id.prefix && id.syncRemote && id.repoRemote);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Compares `actual` against `expected` on COMPARED_FIELDS. Remote URLs are
|
|
131
|
+
// compared in normalized form; prefix is compared exactly. Returns
|
|
132
|
+
// { ok, mismatches: [{ field, expected, actual }], unresolved: [{ field,
|
|
133
|
+
// expected, actual }] }.
|
|
134
|
+
//
|
|
135
|
+
// A field that is empty on EITHER side is "unresolved". By default (strict)
|
|
136
|
+
// it is compared like any other value, so '' against a non-empty
|
|
137
|
+
// expectation is a mismatch. With `{ skipUnresolved: true }` such a field is
|
|
138
|
+
// listed under `unresolved` instead and never counts against `ok` -- the
|
|
139
|
+
// caller decides how loudly to report it. A field that is non-empty on both
|
|
140
|
+
// sides and differs is ALWAYS a mismatch, whichever option is set.
|
|
141
|
+
export function compareIdentity(expected, actual, { skipUnresolved = false } = {}) {
|
|
142
|
+
const mismatches = [];
|
|
143
|
+
const unresolved = [];
|
|
144
|
+
for (const field of COMPARED_FIELDS) {
|
|
145
|
+
const e = expected ? expected[field] ?? '' : '';
|
|
146
|
+
const a = actual ? actual[field] ?? '' : '';
|
|
147
|
+
const eText = String(e).trim();
|
|
148
|
+
const aText = String(a).trim();
|
|
149
|
+
if (skipUnresolved && (!eText || !aText)) {
|
|
150
|
+
unresolved.push({ field, expected: e, actual: a });
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
const same = field === 'prefix'
|
|
154
|
+
? eText === aText
|
|
155
|
+
: normalizeRemoteUrl(e) === normalizeRemoteUrl(a);
|
|
156
|
+
if (!same) mismatches.push({ field, expected: e, actual: a });
|
|
157
|
+
}
|
|
158
|
+
return { ok: mismatches.length === 0, mismatches, unresolved };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// One-line human form, used by the supervisor header, the CLI banner and the
|
|
162
|
+
// runner log. Deliberately generic: no product paths.
|
|
163
|
+
export function formatBeadsIdentity(id, { label } = {}) {
|
|
164
|
+
if (!id) return `${label ? label + ': ' : ''}beads: (unknown)`;
|
|
165
|
+
const parts = [
|
|
166
|
+
id.beadsDir || '(no .beads)',
|
|
167
|
+
`prefix=${id.prefix || '?'}`,
|
|
168
|
+
`remote=${id.syncRemote || '(unset)'}`,
|
|
169
|
+
];
|
|
170
|
+
if (id.repoRemote && normalizeRemoteUrl(id.repoRemote) !== normalizeRemoteUrl(id.syncRemote)) {
|
|
171
|
+
parts.push(`origin=${id.repoRemote}`);
|
|
172
|
+
}
|
|
173
|
+
return `${label ? label + ' ' : ''}beads: ${parts.join(' | ')}`;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Serialised form passed from the supervisor to a sprint child
|
|
177
|
+
// (`--expect-beads <json>`). Only the compared fields plus beadsDir for
|
|
178
|
+
// display; parse is lenient so a hand-written value works too.
|
|
179
|
+
export function serializeExpectedIdentity(id) {
|
|
180
|
+
return JSON.stringify({
|
|
181
|
+
beadsDir: id.beadsDir || '',
|
|
182
|
+
prefix: id.prefix || '',
|
|
183
|
+
syncRemote: id.syncRemote || '',
|
|
184
|
+
repoRemote: id.repoRemote || '',
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function parseExpectedIdentity(text) {
|
|
189
|
+
if (text && typeof text === 'object') return normaliseRecord(text);
|
|
190
|
+
if (typeof text !== 'string' || !text.trim()) return null;
|
|
191
|
+
let obj;
|
|
192
|
+
try {
|
|
193
|
+
obj = JSON.parse(text);
|
|
194
|
+
} catch {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
return obj && typeof obj === 'object' ? normaliseRecord(obj) : null;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function normaliseRecord(obj) {
|
|
201
|
+
const pick = (k) => (typeof obj[k] === 'string' ? obj[k].trim() : '');
|
|
202
|
+
return {
|
|
203
|
+
beadsDir: pick('beadsDir'),
|
|
204
|
+
prefix: pick('prefix'),
|
|
205
|
+
syncRemote: pick('syncRemote'),
|
|
206
|
+
repoRemote: pick('repoRemote'),
|
|
207
|
+
};
|
|
208
|
+
}
|