@apralabs/apra-fleet 0.4.3 → 0.4.4
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 +66 -30
- package/dist/agents/backlog-groomer.md +75 -27
- package/dist/agents/ci-watcher.md +37 -22
- package/dist/agents/deployer.md +39 -22
- package/dist/agents/doer.md +74 -40
- package/dist/agents/harvester.md +49 -40
- package/dist/agents/integ-test-runner.md +40 -23
- package/dist/agents/kb-reconciler.md +28 -7
- package/dist/agents/plan-reviewer.md +49 -24
- package/dist/agents/planner.md +66 -43
- package/dist/agents/regression-test-runner.md +101 -78
- package/dist/agents/reviewer.md +117 -56
- package/dist/agents/schemas/backlog-groomer-output.json +1 -1
- package/dist/agents/schemas/doer-output.json +32 -0
- package/dist/agents/schemas/harvester-input.json +1 -5
- package/dist/agents/schemas/planner-output.json +1 -1
- package/dist/agents/schemas/regression-test-runner-output.json +41 -7
- package/dist/agents/schemas/reviewer-output.json +62 -3
- package/dist/cli/agent-transform.d.ts +7 -0
- package/dist/cli/agent-transform.js +46 -1
- package/dist/cli/auth.d.ts +1 -0
- package/dist/cli/auth.js +38 -8
- package/dist/cli/beads-install.d.ts +35 -0
- package/dist/cli/beads-install.js +125 -0
- package/dist/cli/beads-pin.d.ts +5 -0
- package/dist/cli/beads-pin.js +27 -0
- package/dist/cli/call.d.ts +27 -0
- package/dist/cli/call.js +177 -0
- package/dist/cli/config.d.ts +24 -1
- package/dist/cli/config.js +69 -2
- package/dist/cli/dolt-install.d.ts +18 -2
- package/dist/cli/dolt-install.js +46 -15
- package/dist/cli/fleet-se-guard.d.ts +51 -0
- package/dist/cli/fleet-se-guard.js +215 -0
- package/dist/cli/install-guard.d.ts +54 -0
- package/dist/cli/install-guard.js +132 -4
- package/dist/cli/install.d.ts +77 -21
- package/dist/cli/install.js +610 -152
- package/dist/cli/kb-commit.d.ts +2 -1
- package/dist/cli/kb-commit.js +1 -1
- package/dist/cli/kb-import.d.ts +2 -1
- package/dist/cli/kb-import.js +1 -1
- package/dist/cli/register-member.js +20 -3
- package/dist/cli/remove-member.d.ts +4 -0
- package/dist/cli/remove-member.js +63 -0
- package/dist/cli/secret.js +9 -0
- package/dist/cli/start.js +59 -4
- package/dist/cli/status.d.ts +3 -0
- package/dist/cli/status.js +45 -12
- package/dist/cli/stop.js +64 -9
- package/dist/cli/uninstall.js +101 -15
- package/dist/cli/update.js +33 -2
- package/dist/cli/watch.js +1 -1
- package/dist/cli/workflow.js +3 -2
- package/dist/commands/kb-server.js +9 -2
- package/dist/hub-service/http-server.d.ts +5 -1
- package/dist/hub-service/http-server.js +55 -5
- package/dist/index.js +155 -8
- package/dist/os/child-env-bound.d.ts +77 -0
- package/dist/os/child-env-bound.js +171 -0
- package/dist/os/linux.d.ts +7 -2
- package/dist/os/linux.js +40 -14
- package/dist/os/macos.d.ts +1 -1
- package/dist/os/macos.js +2 -11
- package/dist/os/os-commands.d.ts +17 -2
- package/dist/os/windows-gitbash.d.ts +1 -0
- package/dist/os/windows-gitbash.js +17 -3
- package/dist/os/windows-wrapper.d.ts +0 -4
- package/dist/os/windows-wrapper.js +2 -1
- package/dist/os/windows.d.ts +5 -2
- package/dist/os/windows.js +75 -29
- package/dist/paths.d.ts +21 -0
- package/dist/paths.js +35 -0
- package/dist/providers/agy.d.ts +6 -2
- package/dist/providers/agy.js +245 -106
- package/dist/providers/claude-permission-denial.d.ts +7 -0
- package/dist/providers/claude-permission-denial.js +137 -0
- package/dist/providers/claude.d.ts +86 -38
- package/dist/providers/claude.js +426 -164
- package/dist/providers/codex.js +5 -1
- package/dist/providers/copilot.js +5 -1
- package/dist/providers/opencode.d.ts +10 -2
- package/dist/providers/opencode.js +114 -53
- package/dist/providers/provider.d.ts +171 -33
- package/dist/providers/provider.js +164 -3
- package/dist/services/agent-provisioner.d.ts +29 -0
- package/dist/services/agent-provisioner.js +107 -0
- package/dist/services/agent-shadow.d.ts +96 -0
- package/dist/services/agent-shadow.js +479 -0
- package/dist/services/agy-project.d.ts +2 -1
- package/dist/services/agy-project.js +15 -17
- package/dist/services/auth-socket.d.ts +25 -0
- package/dist/services/auth-socket.js +68 -23
- package/dist/services/auth-web.js +1 -1
- package/dist/services/budget-awareness.d.ts +11 -11
- package/dist/services/budget-awareness.js +15 -3
- package/dist/services/claude-local-scope-mcp.d.ts +19 -0
- package/dist/services/claude-local-scope-mcp.js +91 -0
- package/dist/services/cloud/aws.js +2 -1
- package/dist/services/cloud/lifecycle.js +19 -2
- package/dist/services/cloud/task-wrapper.d.ts +0 -9
- package/dist/services/cloud/task-wrapper.js +15 -6
- package/dist/services/event-loop-watchdog.d.ts +32 -0
- package/dist/services/event-loop-watchdog.js +140 -0
- package/dist/services/http-transport.d.ts +49 -1
- package/dist/services/http-transport.js +190 -24
- package/dist/services/in-flight-agents.d.ts +2 -0
- package/dist/services/in-flight-agents.js +4 -0
- package/dist/services/knowledge/bible-basis-filter.d.ts +53 -0
- package/dist/services/knowledge/bible-basis-filter.js +134 -0
- package/dist/services/knowledge/bible-blob-id.d.ts +44 -0
- package/dist/services/knowledge/bible-blob-id.js +113 -0
- package/dist/services/knowledge/bible-import.d.ts +65 -0
- package/dist/services/knowledge/bible-import.js +211 -0
- package/dist/services/knowledge/file-hash.d.ts +31 -0
- package/dist/services/knowledge/file-hash.js +153 -23
- package/dist/services/knowledge/http-provider.d.ts +4 -3
- package/dist/services/knowledge/http-provider.js +17 -5
- package/dist/services/knowledge/kb-maintainer-grant.d.ts +15 -0
- package/dist/services/knowledge/kb-maintainer-grant.js +34 -0
- package/dist/services/knowledge/kb-providers.d.ts +4 -0
- package/dist/services/knowledge/kb-providers.js +8 -0
- package/dist/services/knowledge/kb-removed-scope-keys.d.ts +28 -0
- package/dist/services/knowledge/kb-removed-scope-keys.js +59 -0
- package/dist/services/knowledge/kb-scopes.d.ts +14 -0
- package/dist/services/knowledge/kb-scopes.js +47 -0
- package/dist/services/knowledge/kb-self.d.ts +91 -0
- package/dist/services/knowledge/kb-self.js +198 -0
- package/dist/services/knowledge/member-bible-view.d.ts +21 -0
- package/dist/services/knowledge/member-bible-view.js +194 -0
- package/dist/services/knowledge/pre-init.js +1 -0
- package/dist/services/knowledge/project-slug.js +2 -2
- package/dist/services/knowledge/sqlite-provider.d.ts +64 -11
- package/dist/services/knowledge/sqlite-provider.js +303 -41
- package/dist/services/knowledge/types.d.ts +45 -2
- package/dist/services/member-access-secret.d.ts +70 -0
- package/dist/services/member-access-secret.js +195 -0
- package/dist/services/member-call-counts.d.ts +24 -0
- package/dist/services/member-call-counts.js +58 -0
- package/dist/services/member-config-io.d.ts +192 -0
- package/dist/services/member-config-io.js +443 -0
- package/dist/services/member-fleet-install.d.ts +710 -0
- package/dist/services/member-fleet-install.js +1895 -0
- package/dist/services/member-secret-env.d.ts +42 -0
- package/dist/services/member-secret-env.js +68 -0
- package/dist/services/member-tool-allowlist.d.ts +49 -0
- package/dist/services/member-tool-allowlist.js +111 -0
- package/dist/services/model-pricing.d.ts +19 -0
- package/dist/services/model-pricing.js +54 -8
- package/dist/services/port-holder.d.ts +86 -0
- package/dist/services/port-holder.js +351 -0
- package/dist/services/preflight-check.js +2 -0
- package/dist/services/registry.d.ts +13 -2
- package/dist/services/registry.js +27 -1
- package/dist/services/relay-strategy.d.ts +2 -0
- package/dist/services/relay-strategy.js +8 -0
- package/dist/services/server-lifecycle.d.ts +26 -0
- package/dist/services/server-lifecycle.js +85 -0
- package/dist/services/service-manager/index.d.ts +7 -1
- package/dist/services/service-manager/index.js +17 -4
- package/dist/services/service-manager/linux.d.ts +1 -1
- package/dist/services/service-manager/linux.js +15 -7
- package/dist/services/service-manager/macos.d.ts +11 -1
- package/dist/services/service-manager/macos.js +45 -7
- package/dist/services/service-manager/service-path.d.ts +24 -0
- package/dist/services/service-manager/service-path.js +55 -0
- package/dist/services/service-manager/types.d.ts +38 -3
- package/dist/services/service-manager/types.js +29 -0
- package/dist/services/service-manager/windows.d.ts +181 -2
- package/dist/services/service-manager/windows.js +666 -49
- package/dist/services/service-notice.d.ts +14 -0
- package/dist/services/service-notice.js +62 -0
- package/dist/services/service-start-guard.d.ts +20 -0
- package/dist/services/service-start-guard.js +86 -0
- package/dist/services/session-cost.d.ts +24 -0
- package/dist/services/session-cost.js +105 -0
- package/dist/services/session-mcp-config.d.ts +83 -0
- package/dist/services/session-mcp-config.js +211 -0
- package/dist/services/sftp.d.ts +34 -0
- package/dist/services/sftp.js +304 -76
- package/dist/services/shell-probe.d.ts +0 -24
- package/dist/services/shell-probe.js +28 -3
- package/dist/services/singleton.d.ts +68 -2
- package/dist/services/singleton.js +168 -11
- package/dist/services/sprint-coordination.js +9 -3
- package/dist/services/ssh.d.ts +27 -0
- package/dist/services/ssh.js +229 -38
- package/dist/services/stall/find-log-file.js +12 -5
- package/dist/services/stall/index.d.ts +1 -1
- package/dist/services/stall/read-log-tail.d.ts +23 -0
- package/dist/services/stall/read-log-tail.js +33 -2
- package/dist/services/stall/stall-detector.d.ts +25 -1
- package/dist/services/stall/stall-detector.js +85 -6
- package/dist/services/stall/stall-poller.d.ts +16 -0
- package/dist/services/stall/stall-poller.js +50 -6
- package/dist/services/stopped-marker.d.ts +16 -0
- package/dist/services/stopped-marker.js +55 -0
- package/dist/services/strategy.d.ts +33 -1
- package/dist/services/strategy.js +86 -17
- package/dist/services/supervisor-service-cleanup.d.ts +52 -0
- package/dist/services/supervisor-service-cleanup.js +332 -0
- package/dist/services/tool-registry.d.ts +8 -1
- package/dist/services/tool-registry.js +160 -59
- package/dist/services/tool-scope.d.ts +58 -0
- package/dist/services/tool-scope.js +99 -0
- package/dist/services/watch/project-resolver.js +1 -0
- package/dist/skills/auto-sprint-args/SKILL.md +2 -2
- package/dist/skills/fleet-sprint-cli/SKILL.md +39 -15
- package/dist/skills/pm/SKILL.md +3 -3
- package/dist/skills/pm/index.md +4 -2
- package/dist/skills/pm/kb-reconcile.md +29 -14
- package/dist/skills/pm/kb-review.md +1 -0
- package/dist/skills/pm/sprint.md +5 -5
- package/dist/tools/check-status.d.ts +53 -5
- package/dist/tools/check-status.js +210 -53
- package/dist/tools/child-id-allocator.d.ts +2 -2
- package/dist/tools/child-id-allocator.js +1 -1
- package/dist/tools/code-index-heal.d.ts +8 -0
- package/dist/tools/code-index-heal.js +21 -0
- package/dist/tools/code-index-state.d.ts +45 -0
- package/dist/tools/code-index-state.js +115 -0
- package/dist/tools/code-intelligence-codebase-memory.js +6 -33
- package/dist/tools/code-intelligence-freshness.js +1 -1
- package/dist/tools/code-intelligence-gitnexus.d.ts +30 -0
- package/dist/tools/code-intelligence-gitnexus.js +333 -57
- package/dist/tools/code-intelligence-kb-enrich.js +7 -6
- package/dist/tools/code-intelligence-readiness.d.ts +99 -0
- package/dist/tools/code-intelligence-readiness.js +206 -0
- package/dist/tools/code-intelligence-reindex.d.ts +195 -0
- package/dist/tools/code-intelligence-reindex.js +530 -50
- package/dist/tools/code-intelligence-telemetry.d.ts +6 -1
- package/dist/tools/code-intelligence-telemetry.js +12 -3
- package/dist/tools/code-intelligence.d.ts +81 -31
- package/dist/tools/code-intelligence.js +156 -52
- package/dist/tools/compose-permissions.d.ts +57 -2
- package/dist/tools/compose-permissions.js +497 -44
- package/dist/tools/execute-command.d.ts +11 -0
- package/dist/tools/execute-command.js +80 -12
- package/dist/tools/execute-prompt.d.ts +59 -15
- package/dist/tools/execute-prompt.js +544 -133
- package/dist/tools/kb-bible-commit.d.ts +65 -0
- package/dist/tools/kb-bible-commit.js +239 -0
- package/dist/tools/kb-capture.d.ts +13 -9
- package/dist/tools/kb-capture.js +42 -11
- package/dist/tools/kb-context.d.ts +27 -7
- package/dist/tools/kb-context.js +60 -9
- package/dist/tools/kb-export.d.ts +96 -7
- package/dist/tools/kb-export.js +228 -65
- package/dist/tools/kb-feedback.d.ts +13 -9
- package/dist/tools/kb-feedback.js +13 -7
- package/dist/tools/kb-freshness-sweep.d.ts +11 -7
- package/dist/tools/kb-freshness-sweep.js +7 -7
- package/dist/tools/kb-harvest.d.ts +11 -7
- package/dist/tools/kb-harvest.js +7 -7
- package/dist/tools/kb-import.d.ts +26 -10
- package/dist/tools/kb-import.js +169 -159
- package/dist/tools/kb-invalidate.d.ts +17 -10
- package/dist/tools/kb-invalidate.js +41 -8
- package/dist/tools/kb-list.d.ts +14 -10
- package/dist/tools/kb-list.js +30 -10
- package/dist/tools/kb-promote.d.ts +11 -7
- package/dist/tools/kb-promote.js +14 -8
- package/dist/tools/kb-query.d.ts +21 -11
- package/dist/tools/kb-query.js +76 -13
- package/dist/tools/kb-reconcile-prefilter.d.ts +11 -7
- package/dist/tools/kb-reconcile-prefilter.js +10 -8
- package/dist/tools/kb-resolve-contradiction.d.ts +11 -7
- package/dist/tools/kb-resolve-contradiction.js +7 -7
- package/dist/tools/kb-session-prime.d.ts +14 -7
- package/dist/tools/kb-session-prime.js +44 -44
- package/dist/tools/kb-setup.d.ts +11 -4
- package/dist/tools/kb-setup.js +25 -11
- package/dist/tools/kb-stats.d.ts +11 -10
- package/dist/tools/kb-stats.js +22 -41
- package/dist/tools/list-members.js +5 -2
- package/dist/tools/member-detail.d.ts +3 -0
- package/dist/tools/member-detail.js +88 -17
- package/dist/tools/member-reservation.d.ts +2 -2
- package/dist/tools/provision-auth.d.ts +39 -1
- package/dist/tools/provision-auth.js +269 -47
- package/dist/tools/provision-vcs-auth.d.ts +2 -2
- package/dist/tools/receive-files.js +3 -1
- package/dist/tools/register-member.d.ts +34 -8
- package/dist/tools/register-member.js +76 -58
- package/dist/tools/remove-member.js +110 -32
- package/dist/tools/send-email.d.ts +2 -2
- package/dist/tools/send-files.js +6 -4
- package/dist/tools/session-stats.d.ts +17 -0
- package/dist/tools/session-stats.js +27 -0
- package/dist/tools/shutdown-server.js +5 -0
- package/dist/tools/update-agent-cli.d.ts +19 -0
- package/dist/tools/update-agent-cli.js +59 -2
- package/dist/tools/update-member.d.ts +13 -10
- package/dist/tools/update-member.js +138 -7
- package/dist/tools/vcs-credential-exec.js +8 -2
- package/dist/types.d.ts +98 -1
- package/dist/utils/agent-helpers.js +2 -0
- package/dist/utils/auth-env.d.ts +15 -4
- package/dist/utils/auth-env.js +52 -23
- package/dist/utils/find-on-path.d.ts +37 -0
- package/dist/utils/find-on-path.js +85 -0
- package/dist/utils/log-helpers.d.ts +37 -0
- package/dist/utils/log-helpers.js +106 -20
- package/dist/utils/owner-only-fs.d.ts +56 -0
- package/dist/utils/owner-only-fs.js +98 -0
- package/dist/utils/process-utils.d.ts +28 -0
- package/dist/utils/process-utils.js +68 -0
- package/dist/utils/prompt-errors.js +4 -1
- package/dist/utils/session-caller.d.ts +4 -2
- package/dist/utils/session-caller.js +3 -2
- package/dist/utils/shell-escape.d.ts +42 -3
- package/dist/utils/shell-escape.js +70 -4
- package/dist/utils/ssh-error-messages.js +3 -0
- package/dist/utils/workspace-trust.d.ts +24 -1
- package/dist/utils/workspace-trust.js +21 -17
- package/dist/workflows/auto-sprint.js +223 -43
- package/package.json +11 -8
- package/packages/apra-fleet-client/package.json +2 -2
- package/packages/apra-fleet-client/src/client/api.mjs +558 -27
- package/packages/apra-fleet-client/src/client/auto-start.mjs +434 -0
- package/packages/apra-fleet-client/src/client/client.mjs +9 -0
- package/packages/apra-fleet-client/src/client/factory.mjs +23 -4
- package/packages/apra-fleet-client/src/client/reconnecting-transport.mjs +137 -0
- package/packages/apra-fleet-client/src/client/server-resolution.mjs +267 -30
- package/packages/apra-fleet-client/src/client/transport.mjs +37 -3
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +75 -27
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +37 -22
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +39 -22
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +74 -40
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +49 -40
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +40 -23
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +28 -7
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +49 -24
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +66 -43
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +101 -78
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +117 -56
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-output.json +1 -1
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +32 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-input.json +1 -5
- package/packages/apra-fleet-se/apra-pm/agents/schemas/planner-output.json +1 -1
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +41 -7
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +62 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +3 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/index.md +4 -2
- package/packages/apra-fleet-se/apra-pm/skills/pm/kb-reconcile.md +29 -14
- package/packages/apra-fleet-se/apra-pm/skills/pm/kb-review.md +1 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/sprint.md +5 -5
- package/packages/apra-fleet-se/bin/cli.mjs +184 -54
- package/packages/apra-fleet-se/bin/serve.mjs +143 -10
- package/packages/apra-fleet-se/fleet-sprint/abort.mjs +56 -20
- package/packages/apra-fleet-se/fleet-sprint/backlog-role.mjs +93 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +208 -53
- package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +576 -33
- package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +9 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-memory-hygiene.mjs +201 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +114 -7
- package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +154 -8
- package/packages/apra-fleet-se/fleet-sprint/ci-gate.mjs +353 -0
- package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +12 -0
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +60 -1
- package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +25 -2
- package/packages/apra-fleet-se/fleet-sprint/dispatch-accounting.mjs +270 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +22 -2
- package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +205 -16
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +52 -14
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +6 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/fleet-sprint-diagram.md +3 -3
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +339 -20
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +210 -11
- package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +4 -4
- package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +200 -9
- package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +57 -9
- package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +53 -4
- package/packages/apra-fleet-se/fleet-sprint/kb-hints.mjs +181 -0
- package/packages/apra-fleet-se/fleet-sprint/kb-injection.mjs +64 -0
- package/packages/apra-fleet-se/fleet-sprint/kb-maintainer.mjs +298 -0
- package/packages/apra-fleet-se/fleet-sprint/kb.mjs +1257 -301
- package/packages/apra-fleet-se/fleet-sprint/lower-quality.mjs +39 -0
- package/packages/apra-fleet-se/fleet-sprint/member-align.mjs +391 -0
- package/packages/apra-fleet-se/fleet-sprint/member-call.mjs +374 -0
- package/packages/apra-fleet-se/fleet-sprint/member-init-probe.mjs +644 -0
- package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +447 -0
- package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +250 -29
- package/packages/apra-fleet-se/fleet-sprint/orphan-reclaim.mjs +153 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +82 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +97 -50
- package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +1 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +81 -18
- package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +43 -11
- package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +6 -6
- package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +20 -15
- package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +60 -38
- package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +42 -10
- package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +16 -11
- package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +36 -3
- package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +72 -12
- package/packages/apra-fleet-se/fleet-sprint/pr-body.mjs +259 -0
- package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +83 -25
- package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +19 -1
- package/packages/apra-fleet-se/fleet-sprint/runner.js +834 -142
- package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +24 -0
- package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +130 -0
- package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +111 -0
- package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +44 -1
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +39 -15
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +84 -30
- package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +138 -2
- package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +111 -11
- package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +22 -0
- package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +7 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +180 -14
- package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +134 -7
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +99 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +223 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +49 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +8 -4
- package/packages/apra-fleet-se/fleet-sprint/verify-block.mjs +152 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +235 -21
- package/packages/apra-fleet-se/package.json +2 -2
- package/packages/apra-fleet-se/src/supervisor/api.mjs +919 -0
- package/packages/apra-fleet-se/src/supervisor/backlog-member.mjs +332 -0
- package/packages/apra-fleet-se/src/supervisor/backlog.mjs +982 -0
- package/packages/apra-fleet-se/src/supervisor/beads-identity.mjs +246 -0
- package/packages/apra-fleet-se/src/supervisor/beads-view.mjs +438 -0
- package/packages/apra-fleet-se/src/supervisor/child-port.mjs +36 -0
- package/packages/apra-fleet-se/src/supervisor/dashboard.mjs +1659 -0
- package/packages/apra-fleet-se/src/supervisor/dolt-mutex.mjs +350 -0
- package/packages/apra-fleet-se/src/supervisor/dolt-orphan-sweep.mjs +338 -0
- package/packages/apra-fleet-se/src/supervisor/fleet-members.mjs +279 -0
- package/packages/apra-fleet-se/src/supervisor/history-view.mjs +276 -0
- package/packages/apra-fleet-se/src/supervisor/history.mjs +328 -0
- package/packages/apra-fleet-se/src/supervisor/id-allocator.mjs +521 -0
- package/packages/apra-fleet-se/src/supervisor/launch-form.mjs +444 -0
- package/packages/apra-fleet-se/src/supervisor/ledger.mjs +629 -0
- package/packages/apra-fleet-se/src/supervisor/lib/exec-bd.mjs +303 -0
- package/packages/apra-fleet-se/src/supervisor/log-timestamp.mjs +51 -0
- package/packages/apra-fleet-se/src/supervisor/log-view.mjs +159 -0
- package/packages/apra-fleet-se/src/supervisor/proxy.mjs +474 -0
- package/packages/apra-fleet-se/src/supervisor/readopt.mjs +136 -0
- package/packages/apra-fleet-se/src/supervisor/reconcile.mjs +263 -0
- package/packages/apra-fleet-se/src/supervisor/rename-with-retry.mjs +87 -0
- package/packages/apra-fleet-se/src/supervisor/scope-overlap.mjs +327 -0
- package/packages/apra-fleet-se/src/supervisor/self-log.mjs +133 -0
- package/packages/apra-fleet-se/src/supervisor/server.mjs +399 -0
- package/packages/apra-fleet-se/src/supervisor/spawner.mjs +542 -0
- package/packages/apra-fleet-se/src/supervisor/sprint-identity.mjs +96 -0
- package/packages/apra-fleet-se/src/supervisor/watchdog.mjs +987 -0
- package/packages/apra-fleet-workflow/package.json +1 -1
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +64 -9
- package/packages/apra-fleet-workflow/src/viewer/run-summary.mjs +127 -0
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +71 -5
- package/packages/apra-fleet-workflow/src/workflow/pricing.mjs +75 -25
- package/skills/fleet/permissions.md +9 -0
- package/skills/fleet/profiles/tag-kb-reconciler.json +2 -6
- package/version.json +1 -1
- package/dist/cli/agent-transform.d.ts.map +0 -1
- package/dist/cli/agent-transform.js.map +0 -1
- package/dist/cli/auth.d.ts.map +0 -1
- package/dist/cli/auth.js.map +0 -1
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js.map +0 -1
- package/dist/cli/dolt-install.d.ts.map +0 -1
- package/dist/cli/dolt-install.js.map +0 -1
- package/dist/cli/install-guard.d.ts.map +0 -1
- package/dist/cli/install-guard.js.map +0 -1
- package/dist/cli/install.d.ts.map +0 -1
- package/dist/cli/install.js.map +0 -1
- package/dist/cli/join.d.ts.map +0 -1
- package/dist/cli/join.js.map +0 -1
- package/dist/cli/kb-commit.d.ts.map +0 -1
- package/dist/cli/kb-commit.js.map +0 -1
- package/dist/cli/kb-directives.d.ts.map +0 -1
- package/dist/cli/kb-directives.js.map +0 -1
- package/dist/cli/kb-import.d.ts.map +0 -1
- package/dist/cli/kb-import.js.map +0 -1
- package/dist/cli/register-member.d.ts.map +0 -1
- package/dist/cli/register-member.js.map +0 -1
- package/dist/cli/restart.d.ts.map +0 -1
- package/dist/cli/restart.js.map +0 -1
- package/dist/cli/secret.d.ts.map +0 -1
- package/dist/cli/secret.js.map +0 -1
- package/dist/cli/spoke.d.ts.map +0 -1
- package/dist/cli/spoke.js.map +0 -1
- package/dist/cli/start.d.ts.map +0 -1
- package/dist/cli/start.js.map +0 -1
- package/dist/cli/status.d.ts.map +0 -1
- package/dist/cli/status.js.map +0 -1
- package/dist/cli/stop.d.ts.map +0 -1
- package/dist/cli/stop.js.map +0 -1
- package/dist/cli/uninstall.d.ts.map +0 -1
- package/dist/cli/uninstall.js.map +0 -1
- package/dist/cli/update.d.ts.map +0 -1
- package/dist/cli/update.js.map +0 -1
- package/dist/cli/watch.d.ts.map +0 -1
- package/dist/cli/watch.js.map +0 -1
- package/dist/cli/workflow-assets.d.ts.map +0 -1
- package/dist/cli/workflow-assets.js.map +0 -1
- package/dist/cli/workflow.d.ts.map +0 -1
- package/dist/cli/workflow.js.map +0 -1
- package/dist/commands/kb-server.d.ts.map +0 -1
- package/dist/commands/kb-server.js.map +0 -1
- package/dist/delivery-mode.d.ts.map +0 -1
- package/dist/delivery-mode.js.map +0 -1
- package/dist/hub-service/activity.d.ts.map +0 -1
- package/dist/hub-service/activity.js.map +0 -1
- package/dist/hub-service/audit-log.d.ts.map +0 -1
- package/dist/hub-service/audit-log.js.map +0 -1
- package/dist/hub-service/db/pool.d.ts.map +0 -1
- package/dist/hub-service/db/pool.js.map +0 -1
- package/dist/hub-service/enrollment.d.ts.map +0 -1
- package/dist/hub-service/enrollment.js.map +0 -1
- package/dist/hub-service/envelope-routes.d.ts.map +0 -1
- package/dist/hub-service/envelope-routes.js.map +0 -1
- package/dist/hub-service/handlers/installers.d.ts.map +0 -1
- package/dist/hub-service/handlers/installers.js.map +0 -1
- package/dist/hub-service/http-server.d.ts.map +0 -1
- package/dist/hub-service/http-server.js.map +0 -1
- package/dist/hub-service/hub-jwt.d.ts.map +0 -1
- package/dist/hub-service/hub-jwt.js.map +0 -1
- package/dist/hub-service/jwt-revocation.d.ts.map +0 -1
- package/dist/hub-service/jwt-revocation.js.map +0 -1
- package/dist/hub-service/machines.d.ts.map +0 -1
- package/dist/hub-service/machines.js.map +0 -1
- package/dist/hub-service/main.d.ts.map +0 -1
- package/dist/hub-service/main.js.map +0 -1
- package/dist/hub-service/member-tokens.d.ts.map +0 -1
- package/dist/hub-service/member-tokens.js.map +0 -1
- package/dist/hub-service/member-view.d.ts.map +0 -1
- package/dist/hub-service/member-view.js.map +0 -1
- package/dist/hub-service/members.d.ts.map +0 -1
- package/dist/hub-service/members.js.map +0 -1
- package/dist/hub-service/presence.d.ts.map +0 -1
- package/dist/hub-service/presence.js.map +0 -1
- package/dist/hub-service/project-view.d.ts.map +0 -1
- package/dist/hub-service/project-view.js.map +0 -1
- package/dist/hub-service/projects.d.ts.map +0 -1
- package/dist/hub-service/projects.js.map +0 -1
- package/dist/hub-service/relay-queue.d.ts.map +0 -1
- package/dist/hub-service/relay-queue.js.map +0 -1
- package/dist/hub-service/session-jwt.d.ts.map +0 -1
- package/dist/hub-service/session-jwt.js.map +0 -1
- package/dist/hub-service/usage.d.ts.map +0 -1
- package/dist/hub-service/usage.js.map +0 -1
- package/dist/hub-service/users.d.ts.map +0 -1
- package/dist/hub-service/users.js.map +0 -1
- package/dist/hub-service/workspaces.d.ts.map +0 -1
- package/dist/hub-service/workspaces.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/onboarding/text.d.ts.map +0 -1
- package/dist/onboarding/text.js.map +0 -1
- package/dist/os/git-bash-candidates.d.ts.map +0 -1
- package/dist/os/git-bash-candidates.js.map +0 -1
- package/dist/os/index.d.ts.map +0 -1
- package/dist/os/index.js.map +0 -1
- package/dist/os/linux.d.ts.map +0 -1
- package/dist/os/linux.js.map +0 -1
- package/dist/os/macos.d.ts.map +0 -1
- package/dist/os/macos.js.map +0 -1
- package/dist/os/os-commands.d.ts.map +0 -1
- package/dist/os/os-commands.js.map +0 -1
- package/dist/os/windows-gitbash.d.ts.map +0 -1
- package/dist/os/windows-gitbash.js.map +0 -1
- package/dist/os/windows-wrapper.d.ts.map +0 -1
- package/dist/os/windows-wrapper.js.map +0 -1
- package/dist/os/windows.d.ts.map +0 -1
- package/dist/os/windows.js.map +0 -1
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js.map +0 -1
- package/dist/providers/agy.d.ts.map +0 -1
- package/dist/providers/agy.js.map +0 -1
- package/dist/providers/claude.d.ts.map +0 -1
- package/dist/providers/claude.js.map +0 -1
- package/dist/providers/codex.d.ts.map +0 -1
- package/dist/providers/codex.js.map +0 -1
- package/dist/providers/copilot.d.ts.map +0 -1
- package/dist/providers/copilot.js.map +0 -1
- package/dist/providers/email/headers.d.ts.map +0 -1
- package/dist/providers/email/headers.js.map +0 -1
- package/dist/providers/email/index.d.ts.map +0 -1
- package/dist/providers/email/index.js.map +0 -1
- package/dist/providers/email/provider.d.ts.map +0 -1
- package/dist/providers/email/provider.js.map +0 -1
- package/dist/providers/email/sendgrid.d.ts.map +0 -1
- package/dist/providers/email/sendgrid.js.map +0 -1
- package/dist/providers/email/smtp.d.ts.map +0 -1
- package/dist/providers/email/smtp.js.map +0 -1
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/none.d.ts.map +0 -1
- package/dist/providers/none.js.map +0 -1
- package/dist/providers/opencode.d.ts.map +0 -1
- package/dist/providers/opencode.js.map +0 -1
- package/dist/providers/provider.d.ts.map +0 -1
- package/dist/providers/provider.js.map +0 -1
- package/dist/services/agent-provisioner.d.ts.map +0 -1
- package/dist/services/agent-provisioner.js.map +0 -1
- package/dist/services/agy-project.d.ts.map +0 -1
- package/dist/services/agy-project.js.map +0 -1
- package/dist/services/auth-socket.d.ts.map +0 -1
- package/dist/services/auth-socket.js.map +0 -1
- package/dist/services/auth-web.d.ts.map +0 -1
- package/dist/services/auth-web.js.map +0 -1
- package/dist/services/budget-awareness.d.ts.map +0 -1
- package/dist/services/budget-awareness.js.map +0 -1
- package/dist/services/cloud/activity.d.ts.map +0 -1
- package/dist/services/cloud/activity.js.map +0 -1
- package/dist/services/cloud/aws.d.ts.map +0 -1
- package/dist/services/cloud/aws.js.map +0 -1
- package/dist/services/cloud/cost.d.ts.map +0 -1
- package/dist/services/cloud/cost.js.map +0 -1
- package/dist/services/cloud/idle-manager.d.ts.map +0 -1
- package/dist/services/cloud/idle-manager.js.map +0 -1
- package/dist/services/cloud/lifecycle.d.ts.map +0 -1
- package/dist/services/cloud/lifecycle.js.map +0 -1
- package/dist/services/cloud/task-wrapper.d.ts.map +0 -1
- package/dist/services/cloud/task-wrapper.js.map +0 -1
- package/dist/services/cloud/types.d.ts.map +0 -1
- package/dist/services/cloud/types.js.map +0 -1
- package/dist/services/cloud-sync.d.ts.map +0 -1
- package/dist/services/cloud-sync.js.map +0 -1
- package/dist/services/context-admission.d.ts.map +0 -1
- package/dist/services/context-admission.js.map +0 -1
- package/dist/services/credential-cleanup.d.ts.map +0 -1
- package/dist/services/credential-cleanup.js.map +0 -1
- package/dist/services/credential-store.d.ts.map +0 -1
- package/dist/services/credential-store.js.map +0 -1
- package/dist/services/event-bus.d.ts.map +0 -1
- package/dist/services/event-bus.js.map +0 -1
- package/dist/services/exit-drain.d.ts.map +0 -1
- package/dist/services/exit-drain.js.map +0 -1
- package/dist/services/file-chunker.d.ts.map +0 -1
- package/dist/services/file-chunker.js.map +0 -1
- package/dist/services/file-transfer-relay.d.ts.map +0 -1
- package/dist/services/file-transfer-relay.js.map +0 -1
- package/dist/services/file-transfer.d.ts.map +0 -1
- package/dist/services/file-transfer.js.map +0 -1
- package/dist/services/git-config.d.ts.map +0 -1
- package/dist/services/git-config.js.map +0 -1
- package/dist/services/github-app.d.ts.map +0 -1
- package/dist/services/github-app.js.map +0 -1
- package/dist/services/http-transport.d.ts.map +0 -1
- package/dist/services/http-transport.js.map +0 -1
- package/dist/services/hub-client.d.ts.map +0 -1
- package/dist/services/hub-client.js.map +0 -1
- package/dist/services/icons.d.ts.map +0 -1
- package/dist/services/icons.js.map +0 -1
- package/dist/services/jwt.d.ts.map +0 -1
- package/dist/services/jwt.js.map +0 -1
- package/dist/services/knowledge/audn.d.ts.map +0 -1
- package/dist/services/knowledge/audn.js.map +0 -1
- package/dist/services/knowledge/file-hash.d.ts.map +0 -1
- package/dist/services/knowledge/file-hash.js.map +0 -1
- package/dist/services/knowledge/http-provider.d.ts.map +0 -1
- package/dist/services/knowledge/http-provider.js.map +0 -1
- package/dist/services/knowledge/kb-config.d.ts.map +0 -1
- package/dist/services/knowledge/kb-config.js.map +0 -1
- package/dist/services/knowledge/kb-providers.d.ts.map +0 -1
- package/dist/services/knowledge/kb-providers.js.map +0 -1
- package/dist/services/knowledge/kb-scope-input.d.ts +0 -5
- package/dist/services/knowledge/kb-scope-input.d.ts.map +0 -1
- package/dist/services/knowledge/kb-scope-input.js +0 -11
- package/dist/services/knowledge/kb-scope-input.js.map +0 -1
- package/dist/services/knowledge/kb-service.d.ts.map +0 -1
- package/dist/services/knowledge/kb-service.js.map +0 -1
- package/dist/services/knowledge/path-validation.d.ts.map +0 -1
- package/dist/services/knowledge/path-validation.js.map +0 -1
- package/dist/services/knowledge/pre-init.d.ts.map +0 -1
- package/dist/services/knowledge/pre-init.js.map +0 -1
- package/dist/services/knowledge/project-slug.d.ts.map +0 -1
- package/dist/services/knowledge/project-slug.js.map +0 -1
- package/dist/services/knowledge/require-sqlite-project.d.ts.map +0 -1
- package/dist/services/knowledge/require-sqlite-project.js.map +0 -1
- package/dist/services/knowledge/sqlite-provider.d.ts.map +0 -1
- package/dist/services/knowledge/sqlite-provider.js.map +0 -1
- package/dist/services/knowledge/types.d.ts.map +0 -1
- package/dist/services/knowledge/types.js.map +0 -1
- package/dist/services/known-hosts.d.ts.map +0 -1
- package/dist/services/known-hosts.js.map +0 -1
- package/dist/services/known-sessions.d.ts.map +0 -1
- package/dist/services/known-sessions.js.map +0 -1
- package/dist/services/member-home.d.ts.map +0 -1
- package/dist/services/member-home.js.map +0 -1
- package/dist/services/member-remote-url.d.ts.map +0 -1
- package/dist/services/member-remote-url.js.map +0 -1
- package/dist/services/model-pricing.d.ts.map +0 -1
- package/dist/services/model-pricing.js.map +0 -1
- package/dist/services/onboarding.d.ts.map +0 -1
- package/dist/services/onboarding.js.map +0 -1
- package/dist/services/orphan-recovery.d.ts.map +0 -1
- package/dist/services/orphan-recovery.js.map +0 -1
- package/dist/services/pending-responses.d.ts.map +0 -1
- package/dist/services/pending-responses.js.map +0 -1
- package/dist/services/preflight-check.d.ts.map +0 -1
- package/dist/services/preflight-check.js.map +0 -1
- package/dist/services/registry.d.ts.map +0 -1
- package/dist/services/registry.js.map +0 -1
- package/dist/services/relay-context.d.ts.map +0 -1
- package/dist/services/relay-context.js.map +0 -1
- package/dist/services/relay-executor.d.ts.map +0 -1
- package/dist/services/relay-executor.js.map +0 -1
- package/dist/services/relay-request.d.ts.map +0 -1
- package/dist/services/relay-request.js.map +0 -1
- package/dist/services/relay-strategy.d.ts.map +0 -1
- package/dist/services/relay-strategy.js.map +0 -1
- package/dist/services/secret-token.d.ts.map +0 -1
- package/dist/services/secret-token.js.map +0 -1
- package/dist/services/service-manager/index.d.ts.map +0 -1
- package/dist/services/service-manager/index.js.map +0 -1
- package/dist/services/service-manager/linux.d.ts.map +0 -1
- package/dist/services/service-manager/linux.js.map +0 -1
- package/dist/services/service-manager/macos.d.ts.map +0 -1
- package/dist/services/service-manager/macos.js.map +0 -1
- package/dist/services/service-manager/types.d.ts.map +0 -1
- package/dist/services/service-manager/types.js.map +0 -1
- package/dist/services/service-manager/windows.d.ts.map +0 -1
- package/dist/services/service-manager/windows.js.map +0 -1
- package/dist/services/session-registry.d.ts.map +0 -1
- package/dist/services/session-registry.js.map +0 -1
- package/dist/services/sftp.d.ts.map +0 -1
- package/dist/services/sftp.js.map +0 -1
- package/dist/services/shell-probe.d.ts.map +0 -1
- package/dist/services/shell-probe.js.map +0 -1
- package/dist/services/singleton.d.ts.map +0 -1
- package/dist/services/singleton.js.map +0 -1
- package/dist/services/sprint-coordination.d.ts.map +0 -1
- package/dist/services/sprint-coordination.js.map +0 -1
- package/dist/services/ssh.d.ts.map +0 -1
- package/dist/services/ssh.js.map +0 -1
- package/dist/services/stall/find-log-file.d.ts.map +0 -1
- package/dist/services/stall/find-log-file.js.map +0 -1
- package/dist/services/stall/index.d.ts.map +0 -1
- package/dist/services/stall/index.js.map +0 -1
- package/dist/services/stall/log-path-resolver.d.ts.map +0 -1
- package/dist/services/stall/log-path-resolver.js.map +0 -1
- package/dist/services/stall/read-log-tail.d.ts.map +0 -1
- package/dist/services/stall/read-log-tail.js.map +0 -1
- package/dist/services/stall/stall-detector.d.ts.map +0 -1
- package/dist/services/stall/stall-detector.js.map +0 -1
- package/dist/services/stall/stall-poller.d.ts.map +0 -1
- package/dist/services/stall/stall-poller.js.map +0 -1
- package/dist/services/stall/time-utils.d.ts.map +0 -1
- package/dist/services/stall/time-utils.js.map +0 -1
- package/dist/services/statusline.d.ts.map +0 -1
- package/dist/services/statusline.js.map +0 -1
- package/dist/services/strategy.d.ts.map +0 -1
- package/dist/services/strategy.js.map +0 -1
- package/dist/services/substitution-engine.d.ts.map +0 -1
- package/dist/services/substitution-engine.js.map +0 -1
- package/dist/services/task-cleanup.d.ts.map +0 -1
- package/dist/services/task-cleanup.js.map +0 -1
- package/dist/services/token-issuer.d.ts.map +0 -1
- package/dist/services/token-issuer.js.map +0 -1
- package/dist/services/tool-registry.d.ts.map +0 -1
- package/dist/services/tool-registry.js.map +0 -1
- package/dist/services/update-check.d.ts.map +0 -1
- package/dist/services/update-check.js.map +0 -1
- package/dist/services/user-config.d.ts.map +0 -1
- package/dist/services/user-config.js.map +0 -1
- package/dist/services/vcs/azure-devops.d.ts.map +0 -1
- package/dist/services/vcs/azure-devops.js.map +0 -1
- package/dist/services/vcs/bitbucket.d.ts.map +0 -1
- package/dist/services/vcs/bitbucket.js.map +0 -1
- package/dist/services/vcs/constants.d.ts.map +0 -1
- package/dist/services/vcs/constants.js.map +0 -1
- package/dist/services/vcs/github.d.ts.map +0 -1
- package/dist/services/vcs/github.js.map +0 -1
- package/dist/services/vcs/types.d.ts.map +0 -1
- package/dist/services/vcs/types.js.map +0 -1
- package/dist/services/version-check.d.ts.map +0 -1
- package/dist/services/version-check.js.map +0 -1
- package/dist/services/watch/fleet-log.d.ts.map +0 -1
- package/dist/services/watch/fleet-log.js.map +0 -1
- package/dist/services/watch/project-resolver.d.ts.map +0 -1
- package/dist/services/watch/project-resolver.js.map +0 -1
- package/dist/services/watch/transcript-formatter.d.ts.map +0 -1
- package/dist/services/watch/transcript-formatter.js.map +0 -1
- package/dist/smoke-test.d.ts.map +0 -1
- package/dist/smoke-test.js.map +0 -1
- package/dist/tools/check-status.d.ts.map +0 -1
- package/dist/tools/check-status.js.map +0 -1
- package/dist/tools/child-id-allocator.d.ts.map +0 -1
- package/dist/tools/child-id-allocator.js.map +0 -1
- package/dist/tools/cloud-control.d.ts.map +0 -1
- package/dist/tools/cloud-control.js.map +0 -1
- package/dist/tools/code-intelligence-codebase-memory.d.ts.map +0 -1
- package/dist/tools/code-intelligence-codebase-memory.js.map +0 -1
- package/dist/tools/code-intelligence-freshness.d.ts.map +0 -1
- package/dist/tools/code-intelligence-freshness.js.map +0 -1
- package/dist/tools/code-intelligence-gitnexus.d.ts.map +0 -1
- package/dist/tools/code-intelligence-gitnexus.js.map +0 -1
- package/dist/tools/code-intelligence-kb-enrich.d.ts.map +0 -1
- package/dist/tools/code-intelligence-kb-enrich.js.map +0 -1
- package/dist/tools/code-intelligence-reindex.d.ts.map +0 -1
- package/dist/tools/code-intelligence-reindex.js.map +0 -1
- package/dist/tools/code-intelligence-telemetry.d.ts.map +0 -1
- package/dist/tools/code-intelligence-telemetry.js.map +0 -1
- package/dist/tools/code-intelligence-tests.d.ts.map +0 -1
- package/dist/tools/code-intelligence-tests.js.map +0 -1
- package/dist/tools/code-intelligence.d.ts.map +0 -1
- package/dist/tools/code-intelligence.js.map +0 -1
- package/dist/tools/compose-permissions.d.ts.map +0 -1
- package/dist/tools/compose-permissions.js.map +0 -1
- package/dist/tools/credential-store-delete.d.ts.map +0 -1
- package/dist/tools/credential-store-delete.js.map +0 -1
- package/dist/tools/credential-store-list.d.ts.map +0 -1
- package/dist/tools/credential-store-list.js.map +0 -1
- package/dist/tools/credential-store-set.d.ts.map +0 -1
- package/dist/tools/credential-store-set.js.map +0 -1
- package/dist/tools/credential-store-update.d.ts.map +0 -1
- package/dist/tools/credential-store-update.js.map +0 -1
- package/dist/tools/dolt-push-mutex.d.ts.map +0 -1
- package/dist/tools/dolt-push-mutex.js.map +0 -1
- package/dist/tools/execute-command.d.ts.map +0 -1
- package/dist/tools/execute-command.js.map +0 -1
- package/dist/tools/execute-prompt.d.ts.map +0 -1
- package/dist/tools/execute-prompt.js.map +0 -1
- package/dist/tools/get-member-model-pricing.d.ts.map +0 -1
- package/dist/tools/get-member-model-pricing.js.map +0 -1
- package/dist/tools/kb-capture.d.ts.map +0 -1
- package/dist/tools/kb-capture.js.map +0 -1
- package/dist/tools/kb-context.d.ts.map +0 -1
- package/dist/tools/kb-context.js.map +0 -1
- package/dist/tools/kb-export.d.ts.map +0 -1
- package/dist/tools/kb-export.js.map +0 -1
- package/dist/tools/kb-feedback.d.ts.map +0 -1
- package/dist/tools/kb-feedback.js.map +0 -1
- package/dist/tools/kb-freshness-sweep.d.ts.map +0 -1
- package/dist/tools/kb-freshness-sweep.js.map +0 -1
- package/dist/tools/kb-harvest.d.ts.map +0 -1
- package/dist/tools/kb-harvest.js.map +0 -1
- package/dist/tools/kb-import.d.ts.map +0 -1
- package/dist/tools/kb-import.js.map +0 -1
- package/dist/tools/kb-invalidate.d.ts.map +0 -1
- package/dist/tools/kb-invalidate.js.map +0 -1
- package/dist/tools/kb-list.d.ts.map +0 -1
- package/dist/tools/kb-list.js.map +0 -1
- package/dist/tools/kb-promote.d.ts.map +0 -1
- package/dist/tools/kb-promote.js.map +0 -1
- package/dist/tools/kb-query.d.ts.map +0 -1
- package/dist/tools/kb-query.js.map +0 -1
- package/dist/tools/kb-reconcile-prefilter.d.ts.map +0 -1
- package/dist/tools/kb-reconcile-prefilter.js.map +0 -1
- package/dist/tools/kb-resolve-contradiction.d.ts.map +0 -1
- package/dist/tools/kb-resolve-contradiction.js.map +0 -1
- package/dist/tools/kb-session-prime.d.ts.map +0 -1
- package/dist/tools/kb-session-prime.js.map +0 -1
- package/dist/tools/kb-setup.d.ts.map +0 -1
- package/dist/tools/kb-setup.js.map +0 -1
- package/dist/tools/kb-stats.d.ts.map +0 -1
- package/dist/tools/kb-stats.js.map +0 -1
- package/dist/tools/list-members.d.ts.map +0 -1
- package/dist/tools/list-members.js.map +0 -1
- package/dist/tools/member-detail.d.ts.map +0 -1
- package/dist/tools/member-detail.js.map +0 -1
- package/dist/tools/member-reservation.d.ts.map +0 -1
- package/dist/tools/member-reservation.js.map +0 -1
- package/dist/tools/monitor-task.d.ts.map +0 -1
- package/dist/tools/monitor-task.js.map +0 -1
- package/dist/tools/provision-auth.d.ts.map +0 -1
- package/dist/tools/provision-auth.js.map +0 -1
- package/dist/tools/provision-vcs-auth.d.ts.map +0 -1
- package/dist/tools/provision-vcs-auth.js.map +0 -1
- package/dist/tools/receive-files.d.ts.map +0 -1
- package/dist/tools/receive-files.js.map +0 -1
- package/dist/tools/register-member.d.ts.map +0 -1
- package/dist/tools/register-member.js.map +0 -1
- package/dist/tools/remove-member.d.ts.map +0 -1
- package/dist/tools/remove-member.js.map +0 -1
- package/dist/tools/report-status.d.ts.map +0 -1
- package/dist/tools/report-status.js.map +0 -1
- package/dist/tools/respond-to-message.d.ts.map +0 -1
- package/dist/tools/respond-to-message.js.map +0 -1
- package/dist/tools/revoke-vcs-auth.d.ts.map +0 -1
- package/dist/tools/revoke-vcs-auth.js.map +0 -1
- package/dist/tools/send-email.d.ts.map +0 -1
- package/dist/tools/send-email.js.map +0 -1
- package/dist/tools/send-files.d.ts.map +0 -1
- package/dist/tools/send-files.js.map +0 -1
- package/dist/tools/send-message.d.ts.map +0 -1
- package/dist/tools/send-message.js.map +0 -1
- package/dist/tools/setup-git-app.d.ts.map +0 -1
- package/dist/tools/setup-git-app.js.map +0 -1
- package/dist/tools/setup-ssh-key.d.ts.map +0 -1
- package/dist/tools/setup-ssh-key.js.map +0 -1
- package/dist/tools/shutdown-server.d.ts.map +0 -1
- package/dist/tools/shutdown-server.js.map +0 -1
- package/dist/tools/stop-prompt.d.ts.map +0 -1
- package/dist/tools/stop-prompt.js.map +0 -1
- package/dist/tools/update-agent-cli.d.ts.map +0 -1
- package/dist/tools/update-agent-cli.js.map +0 -1
- package/dist/tools/update-member.d.ts.map +0 -1
- package/dist/tools/update-member.js.map +0 -1
- package/dist/tools/vcs-credential-exec.d.ts.map +0 -1
- package/dist/tools/vcs-credential-exec.js.map +0 -1
- package/dist/tools/version.d.ts.map +0 -1
- package/dist/tools/version.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/agent-helpers.d.ts.map +0 -1
- package/dist/utils/agent-helpers.js.map +0 -1
- package/dist/utils/ansi.d.ts.map +0 -1
- package/dist/utils/ansi.js.map +0 -1
- package/dist/utils/auth-env.d.ts.map +0 -1
- package/dist/utils/auth-env.js.map +0 -1
- package/dist/utils/collect-secret.d.ts.map +0 -1
- package/dist/utils/collect-secret.js.map +0 -1
- package/dist/utils/credential-validation.d.ts.map +0 -1
- package/dist/utils/credential-validation.js.map +0 -1
- package/dist/utils/crypto.d.ts.map +0 -1
- package/dist/utils/crypto.js.map +0 -1
- package/dist/utils/deep-merge.d.ts.map +0 -1
- package/dist/utils/deep-merge.js.map +0 -1
- package/dist/utils/file-permissions.d.ts.map +0 -1
- package/dist/utils/file-permissions.js.map +0 -1
- package/dist/utils/gpu-parser.d.ts.map +0 -1
- package/dist/utils/gpu-parser.js.map +0 -1
- package/dist/utils/log-helpers.d.ts.map +0 -1
- package/dist/utils/log-helpers.js.map +0 -1
- package/dist/utils/oob-timeout.d.ts.map +0 -1
- package/dist/utils/oob-timeout.js.map +0 -1
- package/dist/utils/opencode-model-validation.d.ts.map +0 -1
- package/dist/utils/opencode-model-validation.js.map +0 -1
- package/dist/utils/pid-helpers.d.ts.map +0 -1
- package/dist/utils/pid-helpers.js.map +0 -1
- package/dist/utils/platform.d.ts.map +0 -1
- package/dist/utils/platform.js.map +0 -1
- package/dist/utils/process-utils.d.ts.map +0 -1
- package/dist/utils/process-utils.js.map +0 -1
- package/dist/utils/prompt-errors.d.ts.map +0 -1
- package/dist/utils/prompt-errors.js.map +0 -1
- package/dist/utils/resolve-member.d.ts.map +0 -1
- package/dist/utils/resolve-member.js.map +0 -1
- package/dist/utils/secure-input.d.ts.map +0 -1
- package/dist/utils/secure-input.js.map +0 -1
- package/dist/utils/session-caller.d.ts.map +0 -1
- package/dist/utils/session-caller.js.map +0 -1
- package/dist/utils/shell-escape.d.ts.map +0 -1
- package/dist/utils/shell-escape.js.map +0 -1
- package/dist/utils/skill-matrix.d.ts.map +0 -1
- package/dist/utils/skill-matrix.js.map +0 -1
- package/dist/utils/ssh-error-messages.d.ts.map +0 -1
- package/dist/utils/ssh-error-messages.js.map +0 -1
- package/dist/utils/vcs-provider-detect.d.ts.map +0 -1
- package/dist/utils/vcs-provider-detect.js.map +0 -1
- package/dist/utils/work-folder-validation.d.ts.map +0 -1
- package/dist/utils/work-folder-validation.js.map +0 -1
- package/dist/utils/workspace-trust.d.ts.map +0 -1
- package/dist/utils/workspace-trust.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
// =============================================================================
|
|
48
48
|
|
|
49
49
|
import { GitDivergedError, GitSyncError } from './errors.mjs';
|
|
50
|
-
import { runGitStep, resolveGitProviderForClassification } from './git-topology.mjs';
|
|
50
|
+
import { runGitStep, resolveGitProviderForClassification, isMissingRemoteRefError } from './git-topology.mjs';
|
|
51
51
|
import { parseUnmergedPaths, detectAndAbortRebaseConflict, dispatchConflictResolutionAgent } from './conflict-ladder.mjs';
|
|
52
52
|
import { DoltSync } from './dolt-sync.mjs';
|
|
53
53
|
import { buildSettleCallback } from './dolt-settle.mjs';
|
|
@@ -83,22 +83,10 @@ import { resolveSettleShell } from './runner.js';
|
|
|
83
83
|
// each dispatch. `command` is dependency-injected so unit tests can drive these
|
|
84
84
|
// helpers with a mock command() and no live fleet.
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
* matched (apra-fleet-ta3.3): syncMemberBefore's pre-dispatch fetch and
|
|
91
|
-
* syncMemberAfter's post-push pull-rebase both hit this exact message for the
|
|
92
|
-
* identical underlying reason -- a brand-new local branch that has never been
|
|
93
|
-
* pushed to `remote` yet, so there is nothing there to fetch/rebase against --
|
|
94
|
-
* and both treat it as a benign no-op / retry-directly signal via this shared
|
|
95
|
-
* predicate rather than each carrying its own copy of the regex.
|
|
96
|
-
* @param {string} error - the raw git stderr/stdout of a failed command
|
|
97
|
-
* @returns {boolean}
|
|
98
|
-
*/
|
|
99
|
-
export function isMissingRemoteRefError(error) {
|
|
100
|
-
return /couldn't find remote ref/i.test(error || '');
|
|
101
|
-
}
|
|
86
|
+
// isMissingRemoteRefError() moved to ./git-topology.mjs so runGitStep can skip
|
|
87
|
+
// the auth self-heal for a missing remote ref (apra-fleet-ta3); re-exported
|
|
88
|
+
// here for existing importers.
|
|
89
|
+
export { isMissingRemoteRefError };
|
|
102
90
|
|
|
103
91
|
/**
|
|
104
92
|
* G-pull: bring `member` up to the shared branch tip before it does any work --
|
|
@@ -121,7 +109,9 @@ export function isMissingRemoteRefError(error) {
|
|
|
121
109
|
* re-committing over) a divergence its own prior attempt left behind. It must
|
|
122
110
|
* only be set on a retry that may have mutated state (withGitSync's
|
|
123
111
|
* resumeOntoRemoteTip); omitting it keeps the ff-only-merge behaviour for every
|
|
124
|
-
* first attempt.
|
|
112
|
+
* first attempt. Before the reset, any unpublished local commits and
|
|
113
|
+
* uncommitted tracked changes are pinned on a local fleet-salvage/ side ref
|
|
114
|
+
* (see salvageBeforeReset); if that fails, no reset happens.
|
|
125
115
|
*
|
|
126
116
|
* apra-fleet-417.7: an optional injected `resolveMemberProvider` (see
|
|
127
117
|
* createMemberVcsProviderResolver) is resolved ONCE at the top of this call
|
|
@@ -171,25 +161,33 @@ export async function syncMemberBefore(member, opts = {}) {
|
|
|
171
161
|
// because every subsequent push/merge fails non-fast-forward. Hard-resetting
|
|
172
162
|
// onto the freshly fetched remote tip makes the retry resume ON TOP of
|
|
173
163
|
// already-published work instead of re-committing it. Only the code checkout
|
|
174
|
-
// is touched (beads live in a separate Dolt clone)
|
|
175
|
-
//
|
|
176
|
-
// which is what prevents the divergent duplicate commit. A concrete branch
|
|
177
|
-
// is required to name a remote tip; without one this falls through to the
|
|
164
|
+
// is touched (beads live in a separate Dolt clone). A concrete branch is
|
|
165
|
+
// required to name a remote tip; without one this falls through to the
|
|
178
166
|
// ff-only merge below.
|
|
167
|
+
//
|
|
168
|
+
// SALVAGE FIRST (GitHub #716). The reset must never be the only copy of
|
|
169
|
+
// the prior attempt's work: a stall kill or a transport drop can leave real
|
|
170
|
+
// unpublished commits and uncommitted tracked edits behind. Before every
|
|
171
|
+
// reset, salvageBeforeReset() pins them on a LOCAL side ref
|
|
172
|
+
// (fleet-salvage/<branch-slug>/<short-sha>) without moving the sprint
|
|
173
|
+
// branch, staging anything, or touching untracked files. If the salvage
|
|
174
|
+
// cannot be completed the reset does not run (fail closed).
|
|
179
175
|
if (resetToRemoteTip && branch) {
|
|
180
176
|
const resetTarget = `${remote}/${branch}`;
|
|
177
|
+
const salvage = await salvageBeforeReset(member, { command, log, remote, branch });
|
|
181
178
|
const reset = await runGitStep({
|
|
182
179
|
command, member, cmd: `git reset --hard ${resetTarget}`,
|
|
183
180
|
label: `G-pull reset-to-remote-tip for '${member}'`, log, maxTransientRetries, onAuthFailure, provider,
|
|
184
181
|
});
|
|
185
182
|
if (!reset.ok) {
|
|
183
|
+
const salvageNote = salvage ? ` The prior work is also saved on local ref '${salvage.ref}'.` : '';
|
|
186
184
|
throw new GitSyncError(
|
|
187
|
-
`[Sync] G-pull reset-to-remote-tip failed for member '${member}'
|
|
188
|
-
{ member, gitOutput: reset.error },
|
|
185
|
+
`[Sync] G-pull reset-to-remote-tip failed for member '${member}'; the local branch was left at its prior tip.${salvageNote} ${reset.error}`,
|
|
186
|
+
{ member, gitOutput: reset.error, details: salvage ? { salvageRef: salvage.ref } : undefined },
|
|
189
187
|
);
|
|
190
188
|
}
|
|
191
189
|
log(`[Sync] G-pull for member '${member}': hard-reset local branch onto '${resetTarget}' so a retried dispatch resumes on the published tip instead of re-committing.`);
|
|
192
|
-
return { ok: true, member };
|
|
190
|
+
return salvage ? { ok: true, member, salvageRef: salvage.ref } : { ok: true, member };
|
|
193
191
|
}
|
|
194
192
|
|
|
195
193
|
const mergeCmd = branch ? `git merge --ff-only ${remote}/${branch}` : 'git merge --ff-only';
|
|
@@ -213,6 +211,212 @@ export async function syncMemberBefore(member, opts = {}) {
|
|
|
213
211
|
return { ok: true, member };
|
|
214
212
|
}
|
|
215
213
|
|
|
214
|
+
// G-push landed check. `git push` exiting 0 is not proof the shared branch
|
|
215
|
+
// now carries this member's work (a push reported as success by a transport
|
|
216
|
+
// that never delivered it was read as landed). After a push reports success,
|
|
217
|
+
// confirm the remote branch CONTAINS the local HEAD: equal tips, or -- when
|
|
218
|
+
// another writer pushed on top of ours in the meantime -- a remote tip that
|
|
219
|
+
// has our HEAD as an ancestor. Only positive evidence that the branch lacks
|
|
220
|
+
// our HEAD fails the push; an inconclusive read (unparseable output, a failed
|
|
221
|
+
// fetch, no branch name) keeps the pre-check behavior and is logged.
|
|
222
|
+
|
|
223
|
+
/** Refs/remotes safe to place in a command string on any member shell. */
|
|
224
|
+
const SAFE_GIT_NAME_RE = /^[A-Za-z0-9._/-]+$/;
|
|
225
|
+
const GIT_SHA_RE = /^[0-9a-f]{40,64}$/i;
|
|
226
|
+
|
|
227
|
+
function outputOf(res) {
|
|
228
|
+
if (!res || res.ok === false) return null;
|
|
229
|
+
return String((typeof res === 'object' ? res.output : res) ?? '');
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// ---------------------------------------------------------------------------
|
|
233
|
+
// Retry salvage (GitHub #716)
|
|
234
|
+
// ---------------------------------------------------------------------------
|
|
235
|
+
//
|
|
236
|
+
// syncMemberBefore's resetToRemoteTip mode runs `git reset --hard` on a member
|
|
237
|
+
// checkout whose prior attempt may have been killed mid-work. That reset must
|
|
238
|
+
// never destroy work that exists nowhere else, so salvageBeforeReset() first
|
|
239
|
+
// pins it on a LOCAL side ref:
|
|
240
|
+
//
|
|
241
|
+
// - `git rev-parse HEAD <remote>/<branch>` and `git rev-list --count` decide
|
|
242
|
+
// whether the local branch has commits the remote tip lacks;
|
|
243
|
+
// - `git stash create` snapshots uncommitted TRACKED changes as a dangling
|
|
244
|
+
// commit WITHOUT touching the index, the work tree or the stash reflog
|
|
245
|
+
// (untracked files -- .env, build output, provider permission files the
|
|
246
|
+
// fleet writes into the work folder -- are excluded by design and are not
|
|
247
|
+
// deleted by `reset --hard` either). The stash commit's first parent is
|
|
248
|
+
// HEAD, so one ref on it reaches both the WIP and every local commit;
|
|
249
|
+
// - `git branch -f fleet-salvage/<branch-slug>/<short-sha> <sha>` creates
|
|
250
|
+
// the ref. The sprint branch itself is never moved, nothing is staged and
|
|
251
|
+
// nothing is committed on it, and the ref is never pushed (every push in
|
|
252
|
+
// this module names the sprint branch explicitly).
|
|
253
|
+
//
|
|
254
|
+
// Every command is a plain token list: no shell expansion, no revision
|
|
255
|
+
// operators beyond `--not`, and every output is parsed here in JavaScript, so
|
|
256
|
+
// the same strings run unchanged in a POSIX shell or PowerShell. These local
|
|
257
|
+
// commands deliberately do not go through runGitStep: a failure here is never
|
|
258
|
+
// a credential problem, so the auth self-heal and transient retries do not
|
|
259
|
+
// apply. Any failure or unparseable output throws GitSyncError and the caller
|
|
260
|
+
// does not reset (fail closed).
|
|
261
|
+
|
|
262
|
+
const SALVAGE_REF_PREFIX = 'fleet-salvage';
|
|
263
|
+
// Identity for `git stash create` only (it writes a commit object, which needs
|
|
264
|
+
// a committer even on a member with no git identity configured). Plain tokens:
|
|
265
|
+
// no spaces, no angle brackets, no '@'.
|
|
266
|
+
const SALVAGE_IDENTITY_ARGS = '-c user.name=fleet-salvage -c user.email=fleet-salvage.invalid';
|
|
267
|
+
const FULL_SHA_LINE_RE = /^[0-9a-f]{40,64}$/i;
|
|
268
|
+
|
|
269
|
+
/** Lines of a command's output, trimmed, blanks dropped. */
|
|
270
|
+
function outputLines(text) {
|
|
271
|
+
return String(text || '').split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** A single-component ref slug for `branch`: anything outside [A-Za-z0-9_-] becomes '-'. */
|
|
275
|
+
export function salvageBranchSlug(branch) {
|
|
276
|
+
const slug = String(branch || '').replace(/[^A-Za-z0-9_-]+/g, '-').replace(/^-+|-+$/g, '');
|
|
277
|
+
return slug || 'branch';
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Pin a member's unpublished commits and uncommitted tracked changes on a
|
|
282
|
+
* local fleet-salvage/ ref before a reset onto `<remote>/<branch>`. Resolves
|
|
283
|
+
* null when there is nothing to save; throws GitSyncError when the salvage
|
|
284
|
+
* could not be completed (the caller must then not reset).
|
|
285
|
+
*
|
|
286
|
+
* @param {string} member
|
|
287
|
+
* @param {{ command: Function, log?: Function, remote: string, branch: string }} opts
|
|
288
|
+
* @returns {Promise<null|{ ref: string, target: string, headSha: string, remoteTipSha: string, ahead: number, stashSha: string|null }>}
|
|
289
|
+
*/
|
|
290
|
+
export async function salvageBeforeReset(member, { command, log = () => {}, remote, branch }) {
|
|
291
|
+
const remoteRef = `${remote}/${branch}`;
|
|
292
|
+
const fail = (what, output) => {
|
|
293
|
+
throw new GitSyncError(
|
|
294
|
+
`[Sync] Retry salvage for member '${member}' failed (${what}); NOT resetting onto '${remoteRef}', so the local branch and its uncommitted changes are left exactly as they were.${output ? ` Output: ${output}` : ''}`,
|
|
295
|
+
{ member, gitOutput: output || null, details: { kind: 'retry-salvage-failed' } },
|
|
296
|
+
);
|
|
297
|
+
};
|
|
298
|
+
const run = async (cmd, label) => {
|
|
299
|
+
let res;
|
|
300
|
+
try {
|
|
301
|
+
res = await command(cmd, { member_name: member, silent: true, failSoft: true, label: `${label} for '${member}'` });
|
|
302
|
+
} catch (err) {
|
|
303
|
+
res = { ok: false, error: (err && err.message) || String(err) };
|
|
304
|
+
}
|
|
305
|
+
return res || { ok: false, error: 'no result' };
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
// 1. Local HEAD and the freshly fetched remote tip, in one read.
|
|
309
|
+
const revs = await run(`git rev-parse HEAD ${remoteRef}`, 'Retry salvage: HEAD and remote tip read');
|
|
310
|
+
const revOut = outputOf(revs);
|
|
311
|
+
if (revOut === null) fail(`could not read HEAD and ${remoteRef}`, revs.error);
|
|
312
|
+
const shas = outputLines(revOut).filter((l) => FULL_SHA_LINE_RE.test(l)).map((l) => l.toLowerCase());
|
|
313
|
+
if (shas.length !== 2) fail(`unrecognized output reading HEAD and ${remoteRef}`, revOut.trim());
|
|
314
|
+
const [headSha, remoteTipSha] = shas;
|
|
315
|
+
|
|
316
|
+
// 2. Commits on the local branch that the remote tip lacks.
|
|
317
|
+
let ahead = 0;
|
|
318
|
+
if (headSha !== remoteTipSha) {
|
|
319
|
+
const countRes = await run(`git rev-list --count ${headSha} --not ${remoteTipSha}`, 'Retry salvage: unpublished commit count');
|
|
320
|
+
const countOut = outputOf(countRes);
|
|
321
|
+
if (countOut === null) fail('could not count unpublished local commits', countRes.error);
|
|
322
|
+
const countLines = outputLines(countOut).filter((l) => /^\d+$/.test(l));
|
|
323
|
+
if (countLines.length !== 1) fail('unrecognized output counting unpublished local commits', countOut.trim());
|
|
324
|
+
ahead = Number(countLines[0]);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// 3. Uncommitted tracked changes, as a dangling commit (empty = clean).
|
|
328
|
+
const stashRes = await run(`git ${SALVAGE_IDENTITY_ARGS} stash create`, 'Retry salvage: snapshot of uncommitted tracked changes');
|
|
329
|
+
const stashOut = outputOf(stashRes);
|
|
330
|
+
if (stashOut === null) fail('could not snapshot uncommitted tracked changes', stashRes.error);
|
|
331
|
+
const stashLines = outputLines(stashOut);
|
|
332
|
+
let stashSha = null;
|
|
333
|
+
if (stashLines.length > 0) {
|
|
334
|
+
const found = stashLines.filter((l) => FULL_SHA_LINE_RE.test(l));
|
|
335
|
+
if (found.length !== 1) fail('unrecognized output snapshotting uncommitted tracked changes', stashOut.trim());
|
|
336
|
+
stashSha = found[0].toLowerCase();
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (ahead === 0 && !stashSha) {
|
|
340
|
+
log(`[Sync] Retry salvage for member '${member}': nothing unpublished to save (no local commits ahead of '${remoteRef}', no uncommitted tracked changes); no side ref created.`);
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// 4. The side ref. The sprint branch is not touched.
|
|
345
|
+
const target = stashSha || headSha;
|
|
346
|
+
const slug = salvageBranchSlug(branch);
|
|
347
|
+
const ref = `${SALVAGE_REF_PREFIX}/${slug}/${target.slice(0, 12)}`;
|
|
348
|
+
const branchRes = await run(`git branch -f ${ref} ${target}`, 'Retry salvage: create side ref');
|
|
349
|
+
if (outputOf(branchRes) === null) {
|
|
350
|
+
const text = String(branchRes.error || branchRes.output || '');
|
|
351
|
+
const conflict = text.match(/'refs\/heads\/([^']+)' exists;\s*cannot create/i);
|
|
352
|
+
if (conflict || /cannot lock ref/i.test(text)) {
|
|
353
|
+
const blocking = conflict ? conflict[1] : `${SALVAGE_REF_PREFIX}/${slug}`;
|
|
354
|
+
throw new GitSyncError(
|
|
355
|
+
`[Sync] Retry salvage for member '${member}' could not create side ref '${ref}': an existing ref '${blocking}' blocks that name (a ref cannot be both a branch and a directory of branches). ` +
|
|
356
|
+
`NOT resetting onto '${remoteRef}'; the local branch is unchanged. Inspect it with 'git log ${blocking}', then delete it with 'git branch -D ${blocking}' in that member's work folder and re-run. Output: ${text.trim()}`,
|
|
357
|
+
{ member, gitOutput: text || null, details: { kind: 'retry-salvage-ref-conflict', ref, conflictingRef: blocking } },
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
fail(`could not create side ref '${ref}'`, text.trim());
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const recovery = [`git log ${ref}`];
|
|
364
|
+
if (ahead > 0) recovery.push(`git cherry-pick ${remoteTipSha}..${headSha}`);
|
|
365
|
+
if (stashSha) recovery.push(`git stash apply ${stashSha}`);
|
|
366
|
+
log(
|
|
367
|
+
`[Sync] Retry salvage for member '${member}': saved ${ahead} unpublished local commit(s)` +
|
|
368
|
+
`${stashSha ? ' and the uncommitted tracked changes' : ''} on local side ref '${ref}' before resetting onto '${remoteRef}'. ` +
|
|
369
|
+
`Recover with: ${recovery.join(' ; ')}. Untracked files are left in place. The side ref is local only and is never pushed.`
|
|
370
|
+
);
|
|
371
|
+
return { ref, target, headSha, remoteTipSha, ahead, stashSha };
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Does `remote`/`branch` contain `member`'s local HEAD? Never throws.
|
|
376
|
+
*
|
|
377
|
+
* @param {string} member
|
|
378
|
+
* @param {{ command: Function, remote: string, branch?: string }} opts
|
|
379
|
+
* @returns {Promise<{ status: 'contained'|'not-contained'|'unverified', why?: string, localHead?: string, remoteTip?: string }>}
|
|
380
|
+
*/
|
|
381
|
+
export async function checkGitPushLanded(member, { command, remote, branch }) {
|
|
382
|
+
if (!branch) return { status: 'unverified', why: 'no branch name to check the push against' };
|
|
383
|
+
if (!SAFE_GIT_NAME_RE.test(branch) || !SAFE_GIT_NAME_RE.test(remote)) return { status: 'unverified', why: 'remote or branch name is outside the safe character set' };
|
|
384
|
+
const run = async (cmd, label) => {
|
|
385
|
+
try {
|
|
386
|
+
return await command(cmd, { member_name: member, silent: true, failSoft: true, label: `${label} for '${member}'` });
|
|
387
|
+
} catch (err) {
|
|
388
|
+
return { ok: false, error: (err && err.message) || String(err) };
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
const headOut = outputOf(await run('git rev-parse HEAD', 'G-push landed check: local HEAD read'));
|
|
393
|
+
const localHead = headOut === null ? null : headOut.trim().split(/\r?\n/)[0].trim();
|
|
394
|
+
if (!localHead || !GIT_SHA_RE.test(localHead)) return { status: 'unverified', why: 'could not read the local HEAD' };
|
|
395
|
+
|
|
396
|
+
const lsOut = outputOf(await run(`git ls-remote ${remote} refs/heads/${branch}`, 'G-push landed check: remote branch read'));
|
|
397
|
+
if (lsOut === null) return { status: 'unverified', why: `could not read ${remote}/${branch}` };
|
|
398
|
+
let remoteTip = null;
|
|
399
|
+
for (const line of lsOut.split(/\r?\n/)) {
|
|
400
|
+
const m = line.match(/^([0-9a-f]{40,64})\s+(\S+)\s*$/i);
|
|
401
|
+
if (m && m[2] === `refs/heads/${branch}`) { remoteTip = m[1].toLowerCase(); break; }
|
|
402
|
+
}
|
|
403
|
+
if (!remoteTip) {
|
|
404
|
+
if (lsOut.trim() === '') return { status: 'not-contained', localHead, why: `branch '${branch}' does not exist on '${remote}'` };
|
|
405
|
+
return { status: 'unverified', localHead, why: `unrecognized ls-remote output for ${remote}/${branch}` };
|
|
406
|
+
}
|
|
407
|
+
if (remoteTip === localHead.toLowerCase()) return { status: 'contained', localHead, remoteTip };
|
|
408
|
+
|
|
409
|
+
// The remote moved past (or away from) our HEAD. Fetch it, then count
|
|
410
|
+
// commits in our HEAD that the remote tip lacks: 0 means contained.
|
|
411
|
+
const fetchRes = await run(`git fetch ${remote} ${branch}`, 'G-push landed check: remote branch fetch');
|
|
412
|
+
if (outputOf(fetchRes) === null) return { status: 'unverified', localHead, remoteTip, why: `could not fetch ${remote}/${branch}: ${fetchRes && fetchRes.error}` };
|
|
413
|
+
const countOut = outputOf(await run(`git rev-list --count ${localHead} --not ${remoteTip}`, 'G-push landed check: containment count'));
|
|
414
|
+
const count = countOut === null ? NaN : Number(countOut.trim());
|
|
415
|
+
if (!Number.isInteger(count)) return { status: 'unverified', localHead, remoteTip, why: 'could not compare the local HEAD with the remote tip' };
|
|
416
|
+
if (count === 0) return { status: 'contained', localHead, remoteTip };
|
|
417
|
+
return { status: 'not-contained', localHead, remoteTip, why: `${remote}/${branch} is at ${remoteTip}, which lacks ${count} commit(s) of the local HEAD ${localHead}` };
|
|
418
|
+
}
|
|
419
|
+
|
|
216
420
|
/**
|
|
217
421
|
* G-push: publish `member`'s committed work to the shared branch after a
|
|
218
422
|
* dispatch -- `git push` with ONE bounded pull-rebase retry. If the
|
|
@@ -278,12 +482,28 @@ export async function syncMemberAfter(member, opts = {}) {
|
|
|
278
482
|
// `git push <remote> <branch>` spelling below.
|
|
279
483
|
const pushCmd = branch ? `git push${setUpstream ? ' -u' : ''} ${remote} ${branch}` : 'git push';
|
|
280
484
|
|
|
485
|
+
// A push step reported success: only return success when the remote
|
|
486
|
+
// branch provably carries our HEAD, or the check is inconclusive.
|
|
487
|
+
const confirmLanded = async (result, label) => {
|
|
488
|
+
const verdict = await checkGitPushLanded(member, { command, remote, branch });
|
|
489
|
+
if (verdict.status === 'not-contained') {
|
|
490
|
+
throw new GitSyncError(
|
|
491
|
+
`[Sync] ${label} reported success but the push did NOT land: ${verdict.why}. The member's commits have NOT reached the shared branch.`,
|
|
492
|
+
{ member, gitOutput: verdict.why, details: { kind: 'push-not-landed', operation: 'push', localHead: verdict.localHead, remoteTip: verdict.remoteTip } },
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
if (verdict.status === 'unverified' && branch) {
|
|
496
|
+
log(`[Sync] ${label} reported success, but whether it landed could not be verified: ${verdict.why}`);
|
|
497
|
+
}
|
|
498
|
+
return result;
|
|
499
|
+
};
|
|
500
|
+
|
|
281
501
|
let push = await runGitStep({
|
|
282
502
|
command, member, cmd: pushCmd,
|
|
283
503
|
label: `G-push for '${member}'`, log, maxTransientRetries, onAuthFailure, provider,
|
|
284
504
|
});
|
|
285
505
|
if (push.ok) {
|
|
286
|
-
return { ok: true, member, pushed: true, rebased: false };
|
|
506
|
+
return await confirmLanded({ ok: true, member, pushed: true, rebased: false }, `G-push for member '${member}'`);
|
|
287
507
|
}
|
|
288
508
|
|
|
289
509
|
if (push.kind !== 'diverged') {
|
|
@@ -326,7 +546,7 @@ export async function syncMemberAfter(member, opts = {}) {
|
|
|
326
546
|
label: `G-push retry (create missing remote branch) for '${member}'`, log, maxTransientRetries, onAuthFailure, provider,
|
|
327
547
|
});
|
|
328
548
|
if (createPush.ok) {
|
|
329
|
-
return { ok: true, member, pushed: true, rebased: false };
|
|
549
|
+
return await confirmLanded({ ok: true, member, pushed: true, rebased: false }, `G-push retry (create missing remote branch) for member '${member}'`);
|
|
330
550
|
}
|
|
331
551
|
if (createPush.kind === 'diverged') {
|
|
332
552
|
// The branch now exists on the remote -- a concurrent writer
|
|
@@ -375,8 +595,9 @@ export async function syncMemberAfter(member, opts = {}) {
|
|
|
375
595
|
label: `G-push after Tier 2 conflict resolution for '${member}'`, log, maxTransientRetries, onAuthFailure, provider,
|
|
376
596
|
});
|
|
377
597
|
if (rePush.ok) {
|
|
598
|
+
const landed = await confirmLanded({ ok: true, member, pushed: true, rebased: true, tier2Resolved: true }, `G-push after Tier 2 conflict resolution for member '${member}'`);
|
|
378
599
|
log(`[Sync] Tier 2 conflict resolution for member '${member}' succeeded -- working tree clean and the resolved code was pushed.`);
|
|
379
|
-
return
|
|
600
|
+
return landed;
|
|
380
601
|
}
|
|
381
602
|
log(`[Sync] Tier 2 conflict resolution for member '${member}' left a clean tree but the re-push still failed: ${rePush.error}`);
|
|
382
603
|
} else {
|
|
@@ -402,7 +623,7 @@ export async function syncMemberAfter(member, opts = {}) {
|
|
|
402
623
|
label: `G-push re-push after rebase for '${member}'`, log, maxTransientRetries, onAuthFailure, provider,
|
|
403
624
|
});
|
|
404
625
|
if (push.ok) {
|
|
405
|
-
return { ok: true, member, pushed: true, rebased: true };
|
|
626
|
+
return await confirmLanded({ ok: true, member, pushed: true, rebased: true }, `G-push re-push after rebase for member '${member}'`);
|
|
406
627
|
}
|
|
407
628
|
|
|
408
629
|
// Still rejected after the one bounded rebase -- diverged, never retried further.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// IN-RUN ORPHANED-CLAIM TRACKING (GitHub #715).
|
|
3
|
+
//
|
|
4
|
+
// A doer of THIS sprint claims its beads (`bd update --claim`, by the engine
|
|
5
|
+
// and/or the doer itself), so a doer that then dies, exhausts its resumes or
|
|
6
|
+
// returns BLOCKED leaves the bead 'in_progress'. `bd ready` never offers an
|
|
7
|
+
// in_progress bead, so the bead -- and every bead its `blocks` chain hides --
|
|
8
|
+
// is stuck for the rest of the sprint. reclaimStaleInProgress in runner.js
|
|
9
|
+
// cannot help: it only reclaims claims that PREDATE the sprint launch.
|
|
10
|
+
//
|
|
11
|
+
// This module is the pure bookkeeping half of the fix. It records, per bead
|
|
12
|
+
// id, the latest streak outcome a doer dispatch of THIS run produced, and
|
|
13
|
+
// answers "which of those beads is an orphan candidate right now". It issues
|
|
14
|
+
// no command of its own: runner.js owns the fresh read, the session stop and
|
|
15
|
+
// the write, so every bd/fleet call stays inside the guarded runner surface.
|
|
16
|
+
//
|
|
17
|
+
// RULES (each one is a reason a bead is NOT a candidate):
|
|
18
|
+
// - its latest outcome closed it, or it was never failed -> nothing to do;
|
|
19
|
+
// - its streak failed because every bead was already claimed by ANOTHER
|
|
20
|
+
// sprint (structured reason CLAIMED_ELSEWHERE_REASON, carried on the
|
|
21
|
+
// outcome, never matched from message text) -> that claim belongs to the
|
|
22
|
+
// other sprint and is never touched;
|
|
23
|
+
// - its streak COMPLETED but the post-dispatch sync failed (including the
|
|
24
|
+
// permission-scope publish-blocked case) -> the work is committed on the
|
|
25
|
+
// doer's clone and the engine has already decided not to re-dispatch it;
|
|
26
|
+
// - the cached snapshot does not show it in_progress -> nothing to reclaim.
|
|
27
|
+
// The snapshot is only a PRE-FILTER that saves a fresh read on the common
|
|
28
|
+
// path; it never authorizes a write (runner.js re-reads before writing);
|
|
29
|
+
// - it has already been reclaimed ORPHAN_RECLAIM_LIMIT times -> capped and
|
|
30
|
+
// surfaced instead of bounced again.
|
|
31
|
+
//
|
|
32
|
+
// A reclaimed id is DROPPED from the tracker (forget/markReclaimed): it is
|
|
33
|
+
// only re-added when a doer of this run is dispatched on it again, so a later
|
|
34
|
+
// claim of the same bead by another actor is never reset at a cycle top.
|
|
35
|
+
//
|
|
36
|
+
// GUARD COVERAGE: registered in guarded-modules.mjs. It carries no command()
|
|
37
|
+
// or agent() call site.
|
|
38
|
+
// =============================================================================
|
|
39
|
+
|
|
40
|
+
/** Re-dispatch bound per bead, across the whole sprint. */
|
|
41
|
+
export const ORPHAN_RECLAIM_LIMIT = 2;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The structured `reason` develop.mjs carries on a streak outcome whose
|
|
45
|
+
* claim found every bead already held by another sprint.
|
|
46
|
+
*/
|
|
47
|
+
export const CLAIMED_ELSEWHERE_REASON = 'all-beads-already-claimed';
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param {{ limit?: number }} [opts]
|
|
51
|
+
*/
|
|
52
|
+
export function createOrphanClaimTracker(opts = {}) {
|
|
53
|
+
const limit = Number.isInteger(opts.limit) && opts.limit > 0 ? opts.limit : ORPHAN_RECLAIM_LIMIT;
|
|
54
|
+
// id -> { doerMember, failureReason, workCompleted }
|
|
55
|
+
const failedById = new Map();
|
|
56
|
+
const reclaimCounts = new Map();
|
|
57
|
+
const cappedIds = new Set();
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
/**
|
|
61
|
+
* Fold one Develop round's streak outcomes in. Every bead a doer of
|
|
62
|
+
* this run was dispatched on is recorded by its LATEST outcome: a
|
|
63
|
+
* closed bead is dropped, a still-open bead of a failed streak is
|
|
64
|
+
* recorded as failed with the streak's structured failure reason.
|
|
65
|
+
* @param {object[]} streakOutcomes develop.mjs's per-streak outcomes
|
|
66
|
+
*/
|
|
67
|
+
recordOutcomes(streakOutcomes) {
|
|
68
|
+
for (const o of streakOutcomes || []) {
|
|
69
|
+
const unclosed = new Set(o.unclosedIds || []);
|
|
70
|
+
for (const id of o.beadIds || []) {
|
|
71
|
+
if (o.outcome !== 'failed' || !unclosed.has(id)) {
|
|
72
|
+
failedById.delete(id);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
failedById.set(id, {
|
|
76
|
+
doerMember: o.doerMember || null,
|
|
77
|
+
failureReason: o.failureReason || null,
|
|
78
|
+
workCompleted: o.publishBlocked === true || o.postDispatchSyncFailed === true,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
/** True when at least one tracked bead's latest streak failed. */
|
|
85
|
+
hasFailed() {
|
|
86
|
+
return failedById.size > 0;
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Orphan candidates against a (possibly stale) beads snapshot. The
|
|
91
|
+
* snapshot only narrows the set; the caller must confirm each
|
|
92
|
+
* candidate with a fresh read before writing.
|
|
93
|
+
* @param {object[]} snapshotBeads full or scoped `bd list` records
|
|
94
|
+
* @returns {{ candidates: { id: string, doerMember: string|null }[], newlyCappedIds: string[] }}
|
|
95
|
+
*/
|
|
96
|
+
candidates(snapshotBeads) {
|
|
97
|
+
const statusById = new Map((snapshotBeads || []).map((b) => [b.id, b.status]));
|
|
98
|
+
const candidates = [];
|
|
99
|
+
const newlyCappedIds = [];
|
|
100
|
+
for (const [id, rec] of [...failedById.entries()]) {
|
|
101
|
+
if (rec.failureReason === CLAIMED_ELSEWHERE_REASON || rec.workCompleted) {
|
|
102
|
+
failedById.delete(id);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
const status = statusById.get(id);
|
|
106
|
+
if (status === 'closed') {
|
|
107
|
+
failedById.delete(id);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (status !== 'in_progress') continue;
|
|
111
|
+
if ((reclaimCounts.get(id) ?? 0) >= limit) {
|
|
112
|
+
failedById.delete(id);
|
|
113
|
+
if (!cappedIds.has(id)) {
|
|
114
|
+
cappedIds.add(id);
|
|
115
|
+
newlyCappedIds.push(id);
|
|
116
|
+
}
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
candidates.push({ id, doerMember: rec.doerMember });
|
|
120
|
+
}
|
|
121
|
+
return { candidates, newlyCappedIds };
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
/** Drop an id without counting a reclaim (e.g. a fresh read found it closed). */
|
|
125
|
+
forget(id) {
|
|
126
|
+
failedById.delete(id);
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Record a successful reclaim: the id leaves the tracker (re-added
|
|
131
|
+
* only on re-dispatch) and its per-bead count grows.
|
|
132
|
+
* @returns {number} the attempt number just used (1-based)
|
|
133
|
+
*/
|
|
134
|
+
markReclaimed(id) {
|
|
135
|
+
failedById.delete(id);
|
|
136
|
+
const n = (reclaimCounts.get(id) ?? 0) + 1;
|
|
137
|
+
reclaimCounts.set(id, n);
|
|
138
|
+
return n;
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
/** Ids that hit the per-bead cap this sprint, in the order they hit it. */
|
|
142
|
+
cappedIds() {
|
|
143
|
+
return [...cappedIds];
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
/** Whether `id` is currently tracked as a failed dispatch of this run. */
|
|
147
|
+
isTracked(id) {
|
|
148
|
+
return failedById.has(id);
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
limit,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
@@ -43,6 +43,88 @@
|
|
|
43
43
|
|
|
44
44
|
import { dispatchRole, TURN_BASES } from '../dispatch-role.mjs';
|
|
45
45
|
|
|
46
|
+
// =============================================================================
|
|
47
|
+
// DEPLOY-FAILURE VERDICT GATE (apra-fleet-b4g.102.1).
|
|
48
|
+
//
|
|
49
|
+
// A cycle whose deploy FAILED skipped Integration Test, so nothing this cycle
|
|
50
|
+
// ever exercised the deployed build. Cycle Evaluation used to exit as
|
|
51
|
+
// "satisfied" on 0 open beads + an APPROVED review regardless, and the Final
|
|
52
|
+
// Review's LLM verdict was the only thing standing between that and a [PASS]
|
|
53
|
+
// PR. The rule is now enforced by the orchestrator, not left to the LLM:
|
|
54
|
+
//
|
|
55
|
+
// * Cycle Evaluation never exits as satisfied (goal-priority exit OR the
|
|
56
|
+
// root/target-already-closed exit) while the LATEST cycle's deploy failed.
|
|
57
|
+
// It re-attempts the deploy in another cycle while the cycle budget
|
|
58
|
+
// (maxCycles) and DEPLOY_RETRY_CYCLE_LIMIT both allow.
|
|
59
|
+
// * When that budget is exhausted, the loop ends and the sprint verdict is
|
|
60
|
+
// forced to FAIL (deliberately FAIL, not INCONCLUSIVE: Publish PR's title
|
|
61
|
+
// and the run status are PASS/FAIL only, and an unverified build is a
|
|
62
|
+
// failed gate, not an undecided one). The reason names the cycle and the
|
|
63
|
+
// deployer's notes, and is prepended to the verdict notes so it reaches
|
|
64
|
+
// the PR title ([FAIL]), the PR body and the sprint analysis doc.
|
|
65
|
+
//
|
|
66
|
+
// A sprint with no deploy.md never records a deploy outcome
|
|
67
|
+
// (lastDeployFailure stays null), so none of this changes its behaviour.
|
|
68
|
+
// =============================================================================
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Consecutive cycles that may each end "otherwise satisfied but the deploy
|
|
72
|
+
* failed" before Cycle Evaluation stops re-attempting the deploy and exits to
|
|
73
|
+
* the finish phases with a forced FAIL. Bounded by maxCycles as well.
|
|
74
|
+
*/
|
|
75
|
+
export const DEPLOY_RETRY_CYCLE_LIMIT = 3;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The latest cycle's deploy outcome, as the gate reads it.
|
|
79
|
+
*
|
|
80
|
+
* @param {{ hasDeploy: boolean, deployedThisCycle: boolean, cycle: number,
|
|
81
|
+
* deployFailures: Array<{cycle: number, notes: string}> }} opts
|
|
82
|
+
* @returns {{cycle: number, notes: string} | null} The failure record when a
|
|
83
|
+
* deploy.md exists and this cycle's deploy failed; null when it succeeded or
|
|
84
|
+
* no deploy was attempted (no deploy.md).
|
|
85
|
+
*/
|
|
86
|
+
export function latestDeployFailure({ hasDeploy, deployedThisCycle, cycle, deployFailures }) {
|
|
87
|
+
if (!hasDeploy || deployedThisCycle) return null;
|
|
88
|
+
const rec = [...deployFailures].reverse().find((f) => f && f.cycle === cycle);
|
|
89
|
+
return { cycle, notes: rec && rec.notes != null ? String(rec.notes) : '(deployer returned no notes)' };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* One-line reason naming the deploy failure; used in the cycle-loop log, the
|
|
94
|
+
* forced verdict notes and therefore the PR body.
|
|
95
|
+
*
|
|
96
|
+
* @param {{cycle: number, notes: string}} failure
|
|
97
|
+
* @returns {string}
|
|
98
|
+
*/
|
|
99
|
+
export function formatDeployFailureReason(failure) {
|
|
100
|
+
return `Deploy FAILED in the last cycle (C${failure.cycle}), so Integration Test never ran against the ` +
|
|
101
|
+
`deployed build and this sprint cannot PASS. Deployer notes: ${failure.notes}`;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Applies the gate to the Final Review verdict. Returns a NEW verdict object
|
|
106
|
+
* (never mutates the dispatch result). With no failure, returns the input
|
|
107
|
+
* unchanged. With a failure, the verdict is FAIL and the notes start with the
|
|
108
|
+
* reason; an LLM PASS is overridden, an LLM FAIL keeps its own notes after it.
|
|
109
|
+
*
|
|
110
|
+
* @param {object} verdictResult Final Review verdict ({verdict, notes, ...}).
|
|
111
|
+
* @param {{cycle: number, notes: string} | null} failure
|
|
112
|
+
* @returns {object}
|
|
113
|
+
*/
|
|
114
|
+
export function applyDeployFailureVerdictGate(verdictResult, failure) {
|
|
115
|
+
if (!failure) return verdictResult;
|
|
116
|
+
const reason = formatDeployFailureReason(failure);
|
|
117
|
+
const prior = verdictResult && typeof verdictResult.notes === 'string' ? verdictResult.notes : '';
|
|
118
|
+
const overridden = !verdictResult || verdictResult.verdict === 'PASS';
|
|
119
|
+
return {
|
|
120
|
+
...(verdictResult || {}),
|
|
121
|
+
verdict: 'FAIL',
|
|
122
|
+
notes: `${reason}` +
|
|
123
|
+
(overridden ? ' (Final Review returned PASS; the orchestrator overrode it to FAIL.)' : '') +
|
|
124
|
+
(prior ? `\n\n${prior}` : ''),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
46
128
|
/**
|
|
47
129
|
* Runs the per-cycle Deploy phase.
|
|
48
130
|
*
|