@apralabs/apra-fleet 0.4.2 → 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 +38 -5
- package/dist/agents/backlog-groomer.md +25 -0
- package/dist/agents/ci-watcher.md +11 -0
- package/dist/agents/deployer.md +37 -2
- package/dist/agents/doer.md +36 -12
- package/dist/agents/harvester.md +11 -0
- package/dist/agents/integ-test-runner.md +11 -0
- package/dist/agents/kb-reconciler.md +9 -0
- package/dist/agents/plan-reviewer.md +110 -22
- package/dist/agents/planner.md +125 -37
- package/dist/agents/regression-test-runner.md +11 -0
- package/dist/agents/reviewer.md +13 -2
- package/dist/agents/schemas/plan-reviewer-output.json +37 -0
- 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 +28 -9
- 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 -34
- 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 +290 -23
- 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 +6 -2
- package/dist/cli/register-member.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/linux.d.ts +6 -0
- package/dist/os/linux.d.ts.map +1 -1
- package/dist/os/linux.js +35 -2
- package/dist/os/linux.js.map +1 -1
- package/dist/os/os-commands.d.ts +61 -2
- package/dist/os/os-commands.d.ts.map +1 -1
- package/dist/os/windows-gitbash.d.ts +5 -0
- package/dist/os/windows-gitbash.d.ts.map +1 -1
- package/dist/os/windows-gitbash.js +15 -0
- package/dist/os/windows-gitbash.js.map +1 -1
- package/dist/os/windows.d.ts +6 -0
- package/dist/os/windows.d.ts.map +1 -1
- package/dist/os/windows.js +46 -3
- package/dist/os/windows.js.map +1 -1
- package/dist/providers/agy.d.ts +115 -6
- package/dist/providers/agy.d.ts.map +1 -1
- package/dist/providers/agy.js +569 -53
- package/dist/providers/agy.js.map +1 -1
- package/dist/providers/claude.d.ts +81 -3
- package/dist/providers/claude.d.ts.map +1 -1
- package/dist/providers/claude.js +344 -10
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/codex.d.ts +4 -2
- package/dist/providers/codex.d.ts.map +1 -1
- package/dist/providers/codex.js +19 -2
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/copilot.d.ts +4 -2
- package/dist/providers/copilot.d.ts.map +1 -1
- package/dist/providers/copilot.js +20 -2
- package/dist/providers/copilot.js.map +1 -1
- package/dist/providers/none.d.ts +4 -2
- package/dist/providers/none.d.ts.map +1 -1
- package/dist/providers/none.js +17 -2
- package/dist/providers/none.js.map +1 -1
- package/dist/providers/opencode.d.ts +3 -1
- package/dist/providers/opencode.d.ts.map +1 -1
- package/dist/providers/opencode.js +22 -2
- package/dist/providers/opencode.js.map +1 -1
- package/dist/providers/provider.d.ts +201 -6
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/provider.js +56 -0
- package/dist/providers/provider.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/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/credential-cleanup.d.ts.map +1 -1
- package/dist/services/credential-cleanup.js +35 -17
- 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/model-pricing.d.ts.map +1 -1
- package/dist/services/model-pricing.js +7 -3
- package/dist/services/model-pricing.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/ssh.d.ts.map +1 -1
- package/dist/services/ssh.js +58 -2
- package/dist/services/ssh.js.map +1 -1
- package/dist/services/stall/read-log-tail.d.ts.map +1 -1
- package/dist/services/stall/read-log-tail.js +20 -10
- 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/strategy.d.ts.map +1 -1
- package/dist/services/strategy.js +79 -2
- 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/vcs/azure-devops.d.ts +66 -1
- package/dist/services/vcs/azure-devops.d.ts.map +1 -1
- package/dist/services/vcs/azure-devops.js +192 -21
- package/dist/services/vcs/azure-devops.js.map +1 -1
- package/dist/services/vcs/types.d.ts +1 -1
- package/dist/skills/fleet-sprint-cli/SKILL.md +18 -0
- package/dist/skills/pm/SKILL.md +1 -1
- package/dist/skills/pm/cost.md +0 -3
- package/dist/skills/pm/fleet-addendum.md +2 -2
- 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 +2 -0
- package/dist/tools/check-status.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 +182 -34
- 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 +31 -20
- 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 +1196 -892
- 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 +1 -0
- 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 +17 -0
- 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 +61 -20
- package/dist/tools/member-reservation.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 +142 -54
- package/dist/tools/provision-auth.js.map +1 -1
- package/dist/tools/provision-vcs-auth.d.ts +91 -1
- package/dist/tools/provision-vcs-auth.d.ts.map +1 -1
- package/dist/tools/provision-vcs-auth.js +209 -49
- package/dist/tools/provision-vcs-auth.js.map +1 -1
- package/dist/tools/register-member.d.ts +12 -9
- package/dist/tools/register-member.d.ts.map +1 -1
- package/dist/tools/register-member.js +99 -12
- 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 +27 -2
- package/dist/tools/remove-member.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/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/update-member.d.ts +12 -9
- package/dist/tools/update-member.d.ts.map +1 -1
- package/dist/tools/update-member.js +43 -11
- 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 +13 -0
- package/dist/types.d.ts.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/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 +87 -1
- package/dist/utils/workspace-trust.js.map +1 -1
- package/dist/workflows/auto-sprint.js +176 -15
- package/package.json +6 -4
- package/packages/apra-fleet-client/src/client/api.mjs +319 -17
- 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 +25 -0
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +37 -2
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +36 -12
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +9 -0
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +110 -22
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +125 -37
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +13 -2
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +37 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +1 -1
- package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +0 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +2 -2
- package/packages/apra-fleet-se/bin/cli.mjs +149 -1
- package/packages/apra-fleet-se/bin/serve.mjs +78 -4
- 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 +61 -14
- 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 +1 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +276 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +1 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/run-sprint-cycle-prelude-decision.md +215 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +56 -1
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +996 -32
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +267 -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 +1467 -9798
- package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +17 -12
- 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 +18 -0
- 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 +153 -19
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +71 -21
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +28 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +131 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +140 -16
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +1 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +77 -2
- 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 +17 -6
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +49 -7
- package/skills/fleet/SKILL.md +8 -8
- package/skills/fleet/auth-azdevops.md +14 -3
- package/skills/fleet/auth-bitbucket.md +2 -2
- package/skills/fleet/auth-github.md +5 -4
- package/skills/fleet/onboarding.md +3 -3
- package/skills/fleet/permissions.md +5 -1
- package/skills/fleet/profiles/node.json +1 -1
- package/skills/fleet/troubleshooting.md +3 -3
- package/version.json +1 -1
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
// Reviewer-verdict bead transitions for fleet-sprint (apra-fleet-3swo.4.7):
|
|
2
|
+
// the reopen/replan/close transitions the ORCHESTRATOR -- never the LLM --
|
|
3
|
+
// applies to beads after a role returns a verdict. Extracted out of runner.js;
|
|
4
|
+
// runner.js re-exports every symbol it previously exported from this region,
|
|
5
|
+
// so existing importers of fleet-sprint/runner.js resolve unchanged.
|
|
6
|
+
//
|
|
7
|
+
// THREE CALL SITES, ONE GUARD. Three places apply a reviewer-shaped verdict to
|
|
8
|
+
// beads, and before this extraction only two of them were guarded:
|
|
9
|
+
//
|
|
10
|
+
// 1. the per-round reviewer inside the Develop/Review loop,
|
|
11
|
+
// 2. Final Review, and
|
|
12
|
+
// 3. Re-Review (the "0 open beads at goal but the last verdict was not
|
|
13
|
+
// APPROVED" branch) -- which looped over reopenIds issuing
|
|
14
|
+
// `bd update <id> --status=open` with NO goal-scope guard at all.
|
|
15
|
+
//
|
|
16
|
+
// Site 3's omission was a real hole, not a deliberate exemption: reopening a
|
|
17
|
+
// DEFERRED below-goal bead injects work the sprint no longer targets and pins
|
|
18
|
+
// the verdict at CHANGES_NEEDED forever -- the exact failure the other two
|
|
19
|
+
// sites guard against. All three now go through applyGuardedReopens() below,
|
|
20
|
+
// so the guard cannot be forgotten by a fourth site either.
|
|
21
|
+
//
|
|
22
|
+
// WHAT WAS UNIFIED AND WHAT WAS DELIBERATELY NOT. The GUARD is unified. The
|
|
23
|
+
// PAYLOAD SHAPES are not: the three sites take three different reopen-entry
|
|
24
|
+
// shapes (site 1 bare string, site 2 `{id, reason}` with BOTH fields
|
|
25
|
+
// required, site 3 bare string), each with its own producer on the other end
|
|
26
|
+
// of a dispatch contract. Normalising the shape would be a behaviour change
|
|
27
|
+
// to those contracts, not a move, so each site keeps its own `parseEntry` and
|
|
28
|
+
// its own `buildReopenCommand` while sharing the allowlist, the below-goal
|
|
29
|
+
// check, the skip log text and the control flow.
|
|
30
|
+
//
|
|
31
|
+
// FAIL OPEN, DELIBERATELY. When the scope lookup THROWS, the allowlist is set
|
|
32
|
+
// to null and every reopen is applied UNGUARDED rather than dropped. This is
|
|
33
|
+
// intentional and must not be "hardened" into a fail-closed drop: a failed
|
|
34
|
+
// scope lookup is an infrastructure problem, and silently swallowing a
|
|
35
|
+
// reviewer's reopens because of one would lose real review signal with no
|
|
36
|
+
// trace. A null allowlist therefore means "apply everything", never "skip
|
|
37
|
+
// everything" -- see buildReopenAllowlist() and isDeferredScopeReopen().
|
|
38
|
+
// =============================================================================
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Detects the reviewer contract violation described on
|
|
42
|
+
* `ReviewerContractViolationError`: a `CHANGES_NEEDED` verdict naming nothing
|
|
43
|
+
* to reopen, proposing no follow-up work, AND naming no scoped-replan targets
|
|
44
|
+
* is schema-legal but self-contradictory -- the orchestrator has nothing to
|
|
45
|
+
* act on, so the sprint cannot make progress off of it. A non-empty
|
|
46
|
+
* `replanIds` exempts the verdict from that hard abort even with empty
|
|
47
|
+
* reopenIds/newTasks -- NOT because the field is guaranteed to be consumed
|
|
48
|
+
* (foldReplanIds() below only accepts replanIds entries ALSO named in
|
|
49
|
+
* reopenIds this round), but because a verdict that names a genuine replan
|
|
50
|
+
* intent in `notes` still represents real reviewer signal worth an ordinary
|
|
51
|
+
* next-round retry rather than a hard sprint abort.
|
|
52
|
+
*
|
|
53
|
+
* @param {{ verdict: string, reopenIds?: string[], replanIds?: string[], newTasks?: object[] }} verdict
|
|
54
|
+
* @returns {boolean}
|
|
55
|
+
*/
|
|
56
|
+
export function isReviewerContractViolation(verdict) {
|
|
57
|
+
return verdict.verdict === 'CHANGES_NEEDED'
|
|
58
|
+
&& (!verdict.reopenIds || verdict.reopenIds.length === 0)
|
|
59
|
+
&& (!verdict.newTasks || verdict.newTasks.length === 0)
|
|
60
|
+
&& (!verdict.replanIds || verdict.replanIds.length === 0);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Look up the beads currently in sprint scope, as the goal-scope allowlist
|
|
65
|
+
* every reopen is checked against.
|
|
66
|
+
*
|
|
67
|
+
* FAILS OPEN BY DESIGN: any throw from the scope lookup yields `null`, which
|
|
68
|
+
* isDeferredScopeReopen() reads as "apply every reopen unguarded". Dropping a
|
|
69
|
+
* reviewer's reopens because a `bd list` failed would silently lose review
|
|
70
|
+
* signal; a redundant unguarded reopen is the far cheaper failure.
|
|
71
|
+
*
|
|
72
|
+
* @param {(rest: string) => Promise<Array<object>>} bdListScoped
|
|
73
|
+
* @returns {Promise<Map<string, object>|null>} the allowlist, or null on lookup failure
|
|
74
|
+
*/
|
|
75
|
+
export async function buildReopenAllowlist(bdListScoped) {
|
|
76
|
+
try {
|
|
77
|
+
const inScopeNow = await bdListScoped('');
|
|
78
|
+
return new Map(inScopeNow.map((b) => [b.id, b]));
|
|
79
|
+
} catch {
|
|
80
|
+
return null; // lookup failed -- apply reopens unguarded rather than dropping them
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Coerce a goal-priority ceiling to the NUMBER the priority comparison needs.
|
|
86
|
+
*
|
|
87
|
+
* runner.js's `goalMax` closure variable is goalPriorityMax(goal), which
|
|
88
|
+
* returns the STRING form ('P2') because its other consumers want exactly
|
|
89
|
+
* that: `bd list --priority-max=P2` and the human-facing log text. A bead's
|
|
90
|
+
* own `priority`, though, is a NUMBER (3).
|
|
91
|
+
*
|
|
92
|
+
* That mismatch was a live, silent bug in the pre-extraction guard, which
|
|
93
|
+
* compared them directly:
|
|
94
|
+
*
|
|
95
|
+
* bead.priority > goalMax // 3 > 'P2' -> NaN comparison -> false
|
|
96
|
+
*
|
|
97
|
+
* `>` coerces the string to a number, `Number('P2')` is NaN, and every
|
|
98
|
+
* comparison against NaN is false -- so the goal-scope guard NEVER skipped
|
|
99
|
+
* anything, at ANY site, for ANY priority (even a P9 bead in a P1 sprint
|
|
100
|
+
* returned false). The two "guarded" sites were guarded in appearance only.
|
|
101
|
+
* runner.js already knew the numeric form was required elsewhere and derived
|
|
102
|
+
* it explicitly (`Number(goalPriorityMax(goal).slice(1))` in
|
|
103
|
+
* partitionByGoalMembership and in the dashboard payload); only this guard
|
|
104
|
+
* missed it.
|
|
105
|
+
*
|
|
106
|
+
* Accepts either form so callers may pass the string ceiling they already
|
|
107
|
+
* have; returns NaN for anything unparseable, which -- since every comparison
|
|
108
|
+
* against NaN is false -- degrades to the historical never-skip behaviour
|
|
109
|
+
* rather than to skipping everything.
|
|
110
|
+
*
|
|
111
|
+
* @param {number|string} goalMax - e.g. 2 or 'P2'
|
|
112
|
+
* @returns {number}
|
|
113
|
+
*/
|
|
114
|
+
export function normalizeGoalMax(goalMax) {
|
|
115
|
+
if (typeof goalMax === 'number') return goalMax;
|
|
116
|
+
if (typeof goalMax === 'string') return Number(goalMax.replace(/^[Pp]/, ''));
|
|
117
|
+
return NaN;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The goal-scope check itself: is `id` a bead this sprint has DEFERRED below
|
|
122
|
+
* its goal priority, and therefore must not reopen?
|
|
123
|
+
*
|
|
124
|
+
* Every clause matters. A null `allowlist` (lookup failed) is never a skip --
|
|
125
|
+
* see buildReopenAllowlist. A bead absent from the allowlist is never a skip
|
|
126
|
+
* either: it is out-of-scope or brand new, and the pre-extraction sites
|
|
127
|
+
* deliberately let those through rather than guessing. Only a bead the
|
|
128
|
+
* allowlist KNOWS about, with a NUMERIC priority strictly worse (higher) than
|
|
129
|
+
* the goal max, is refused -- and `goalMax` is normalized to a number first,
|
|
130
|
+
* because comparing against the raw 'P2' string is what made this guard inert
|
|
131
|
+
* (see normalizeGoalMax).
|
|
132
|
+
*
|
|
133
|
+
* @param {Map<string, object>|null} allowlist
|
|
134
|
+
* @param {string} id
|
|
135
|
+
* @param {number|string} goalMax - numeric ceiling, or the 'Pn' string form
|
|
136
|
+
* @returns {{ deferred: boolean, priority: number|null }}
|
|
137
|
+
*/
|
|
138
|
+
export function isDeferredScopeReopen(allowlist, id, goalMax) {
|
|
139
|
+
const bead = allowlist ? allowlist.get(id) : null;
|
|
140
|
+
const max = normalizeGoalMax(goalMax);
|
|
141
|
+
if (allowlist && bead && typeof bead.priority === 'number' && bead.priority > max) {
|
|
142
|
+
return { deferred: true, priority: bead.priority };
|
|
143
|
+
}
|
|
144
|
+
return { deferred: false, priority: bead && typeof bead.priority === 'number' ? bead.priority : null };
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* The single reopen-entry parser for the two sites whose reopenIds are BARE
|
|
149
|
+
* STRINGS carrying no reason (the per-round reviewer and Re-Review).
|
|
150
|
+
*
|
|
151
|
+
* @param {unknown} entry
|
|
152
|
+
* @returns {{ id: string, reason: string }|{ error: string }}
|
|
153
|
+
*/
|
|
154
|
+
export function parseBareIdEntry(entry) {
|
|
155
|
+
const id = typeof entry === 'string' ? entry.trim() : '';
|
|
156
|
+
if (!id) return { error: `expected a bead id string -- ${JSON.stringify(entry)}` };
|
|
157
|
+
return { id, reason: '' };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Final Review's reopen-entry parser: `{id, reason}` with BOTH fields
|
|
162
|
+
* required. Unlike the per-round reviewer's single blanket `notes` string
|
|
163
|
+
* shared across every id, each Final Review entry carries its OWN reason, so
|
|
164
|
+
* an entry missing either field has nothing usable to record and is refused.
|
|
165
|
+
*
|
|
166
|
+
* @param {unknown} entry
|
|
167
|
+
* @returns {{ id: string, reason: string }|{ error: string }}
|
|
168
|
+
*/
|
|
169
|
+
export function parseIdWithReasonEntry(entry) {
|
|
170
|
+
const id = entry && typeof entry.id === 'string' ? entry.id.trim() : '';
|
|
171
|
+
const reason = entry && typeof entry.reason === 'string' ? entry.reason.trim() : '';
|
|
172
|
+
if (!id || !reason) {
|
|
173
|
+
return { error: `a malformed entry (both id and reason are required) -- ${JSON.stringify(entry)}` };
|
|
174
|
+
}
|
|
175
|
+
return { id, reason };
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Apply a verdict's reopenIds to beads, behind the shared goal-scope guard.
|
|
180
|
+
* This is the ONE path all three verdict sites now take.
|
|
181
|
+
*
|
|
182
|
+
* The below-goal skip emits the identical "deferred scope, not reopened"
|
|
183
|
+
* outcome at every site -- that exact phrasing is what makes the guard
|
|
184
|
+
* greppable in a run log and is asserted by the extraction's tests, so keep
|
|
185
|
+
* it verbatim if you touch this.
|
|
186
|
+
*
|
|
187
|
+
* @param {object} o
|
|
188
|
+
* @param {Array<unknown>} o.entries - the verdict's raw reopenIds, in its own shape
|
|
189
|
+
* @param {(rest: string) => Promise<Array<object>>} o.bdListScoped - scope lookup for the allowlist
|
|
190
|
+
* @param {number} o.goalMax - worst (numerically highest) priority this sprint targets
|
|
191
|
+
* @param {string} o.goal - the goal label, for log text (e.g. 'P1/P2')
|
|
192
|
+
* @param {string} o.logPrefix - site label for log lines (e.g. 'Reviewer reopenIds')
|
|
193
|
+
* @param {(msg: string) => void} o.log
|
|
194
|
+
* @param {(cmd: string, opts: object) => Promise<any>} o.command
|
|
195
|
+
* @param {string} o.member - the member every `bd` command here is dispatched to
|
|
196
|
+
* @param {(entry: unknown) => {id: string, reason: string}|{error: string}} [o.parseEntry]
|
|
197
|
+
* @param {(e: {id: string, reason: string}) => {cmd: string, label: string}|null} o.buildReopenCommand
|
|
198
|
+
* @param {(e: {id: string, reason: string}) => void} [o.onReopened] - per-bead side effects (thrash counters, feedback routing)
|
|
199
|
+
* @param {(e: {id: string, reason: string}, err: Error) => void} [o.onEntryError] - when present, a throwing entry is non-fatal and reported here
|
|
200
|
+
* @returns {Promise<string[]>} the ids ACTUALLY reopened (survived the guard)
|
|
201
|
+
*/
|
|
202
|
+
export async function applyGuardedReopens(o) {
|
|
203
|
+
const {
|
|
204
|
+
entries, bdListScoped, goalMax, goal, logPrefix, log, command, member,
|
|
205
|
+
parseEntry = parseBareIdEntry, buildReopenCommand, onReopened, onEntryError,
|
|
206
|
+
} = o;
|
|
207
|
+
|
|
208
|
+
const list = Array.isArray(entries) ? entries : [];
|
|
209
|
+
// Short-circuit an empty verdict WITHOUT issuing the scope lookup: the
|
|
210
|
+
// pre-extraction sites both guarded the lookup on a non-empty reopenIds,
|
|
211
|
+
// and a `bd list` per empty verdict is real dispatch cost.
|
|
212
|
+
if (list.length === 0) return [];
|
|
213
|
+
|
|
214
|
+
const allowlist = await buildReopenAllowlist(bdListScoped);
|
|
215
|
+
const reopenedIds = [];
|
|
216
|
+
|
|
217
|
+
for (const entry of list) {
|
|
218
|
+
const parsed = parseEntry(entry);
|
|
219
|
+
if (parsed.error) {
|
|
220
|
+
log(`${logPrefix}: SKIPPED ${parsed.error}`);
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const { deferred, priority } = isDeferredScopeReopen(allowlist, parsed.id, goalMax);
|
|
225
|
+
if (deferred) {
|
|
226
|
+
log(`${logPrefix}: SKIPPED '${parsed.id}' (priority P${priority} is below this sprint's goal ${goal} -- deferred scope, not reopened).`);
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
try {
|
|
231
|
+
const built = buildReopenCommand(parsed);
|
|
232
|
+
// A builder may refuse an entry it cannot render safely (Final
|
|
233
|
+
// Review's reason sanitizing to empty); it has already logged why.
|
|
234
|
+
if (!built) continue;
|
|
235
|
+
await command(built.cmd, { member_name: member, silent: true, label: built.label });
|
|
236
|
+
reopenedIds.push(parsed.id);
|
|
237
|
+
if (onReopened) onReopened(parsed);
|
|
238
|
+
} catch (err) {
|
|
239
|
+
if (!onEntryError) throw err;
|
|
240
|
+
onEntryError(parsed, err);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return reopenedIds;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Fold a round's reviewer `replanIds` into the cycle's running replan union.
|
|
249
|
+
* Only the per-round reviewer site uses this; Final Review and Re-Review have
|
|
250
|
+
* no scoped-replan machinery to feed.
|
|
251
|
+
*
|
|
252
|
+
* Two independent refusals, each logged so the drop is visible in the run log
|
|
253
|
+
* rather than vanishing with no trace:
|
|
254
|
+
*
|
|
255
|
+
* 1. NOT ALSO REOPENED. An id named in replanIds without ALSO being named
|
|
256
|
+
* in (and surviving the guard on) this round's reopenIds is DROPPED and
|
|
257
|
+
* never reaches the scoped-replan machinery. buildReviewerPrompt
|
|
258
|
+
* requires replanIds to be a subset of reopenIds; this is the
|
|
259
|
+
* enforcement side. Note the subset is checked against ids ACTUALLY
|
|
260
|
+
* reopened, so a below-goal id skipped by the scope guard cannot sneak
|
|
261
|
+
* back in through replanIds.
|
|
262
|
+
* 2. ALREADY REPLANNED THIS CYCLE. A bead that has already been through one
|
|
263
|
+
* in-cycle scoped replan is refused a SECOND: it stays reopened (real
|
|
264
|
+
* dev feedback still applies) but is not re-added, so the develop loop
|
|
265
|
+
* never dispatches a second scoped planner pass for it -- it is handed
|
|
266
|
+
* to the next cycle's planner instead. This is what makes "max one
|
|
267
|
+
* scoped replan per bead per cycle" hold regardless of the round budget.
|
|
268
|
+
*
|
|
269
|
+
* @param {object} o
|
|
270
|
+
* @param {string[]|undefined} o.replanIds - the verdict's replanIds (absent on verdicts that do not use it)
|
|
271
|
+
* @param {Set<string>} o.reopenedIds - ids actually reopened this round
|
|
272
|
+
* @param {Set<string>} o.replannedThisCycle - beads already scoped-replanned this cycle
|
|
273
|
+
* @param {number|string} o.cycle - cycle label, for log text
|
|
274
|
+
* @param {(msg: string) => void} o.log
|
|
275
|
+
* @returns {string[]} the ids accepted into the cycle's replan union
|
|
276
|
+
*/
|
|
277
|
+
export function foldReplanIds(o) {
|
|
278
|
+
const { replanIds, reopenedIds, replannedThisCycle, cycle, log } = o;
|
|
279
|
+
const accepted = [];
|
|
280
|
+
for (const id of (replanIds || [])) {
|
|
281
|
+
if (!reopenedIds.has(id)) {
|
|
282
|
+
log(
|
|
283
|
+
`[fleet-sprint] replanIds: DROPPED '${id}' -- not also named in this round's reopenIds ` +
|
|
284
|
+
`(reviewer prompt requires replanIds to be a subset of reopenIds), so it never reaches the ` +
|
|
285
|
+
`scoped-replan machinery.`
|
|
286
|
+
);
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
if (replannedThisCycle.has(id)) {
|
|
290
|
+
log(
|
|
291
|
+
`[fleet-sprint] replan loop guard: bead ${id} was already scoped-replanned once this cycle ` +
|
|
292
|
+
`(C${cycle}) and a reviewer has flagged it for replan AGAIN -- refusing a second in-cycle scoped ` +
|
|
293
|
+
`replan (max one per bead per cycle). It stays reopened and is handed off to the next cycle's ` +
|
|
294
|
+
`planner rather than re-planned again now.`
|
|
295
|
+
);
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
accepted.push(id);
|
|
299
|
+
}
|
|
300
|
+
return accepted;
|
|
301
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// The pure branch-selection decision helper for fleet-sprint's Ensure Sprint
|
|
2
|
+
// Branch phase (apra-fleet-3swo.3.6). Moved verbatim out of runner.js --
|
|
3
|
+
// runner.js imports it back for its own Ensure Sprint Branch phase and for
|
|
4
|
+
// resyncReacquiredMember(). This is a move-only extraction: no I/O, no
|
|
5
|
+
// behaviour change -- the helper stays pure.
|
|
6
|
+
|
|
7
|
+
// Pure branch-selection decision for the Ensure Sprint Branch phase. Given the
|
|
8
|
+
// outcomes of the probes that phase issues -- a soft-failed
|
|
9
|
+
// `git fetch origin/<branch>` and, when that reports the ref is missing, a
|
|
10
|
+
// local-branch existence probe -- this decides which checkout command to run,
|
|
11
|
+
// or that the phase must abort rather than touch git at all. No I/O of its
|
|
12
|
+
// own; the caller still issues the command() calls and does the logging.
|
|
13
|
+
//
|
|
14
|
+
// Returns one of:
|
|
15
|
+
// { action: 'abort', message } -- the fetch failed for a reason other than
|
|
16
|
+
// "branch doesn't exist yet", or local and origin have diverged. The
|
|
17
|
+
// caller must throw and never attempt a checkout: a transient fetch
|
|
18
|
+
// failure misread as "new branch" would reset the branch to base and
|
|
19
|
+
// destroy pushed work.
|
|
20
|
+
// { action: 'checkout', reused: true, command } -- reuse an existing local
|
|
21
|
+
// branch as-is (plain `git checkout`, no reset), preserving commits that
|
|
22
|
+
// exist only locally.
|
|
23
|
+
// { action: 'checkout', reused: false, command, startPoint } -- normal
|
|
24
|
+
// `git checkout -B <branch> <startPoint>`, where startPoint is
|
|
25
|
+
// `origin/<branch>` when the fetch succeeded and `origin/<baseBranch>`
|
|
26
|
+
// when the branch is genuinely new.
|
|
27
|
+
//
|
|
28
|
+
// When the fetch succeeds and a local branch also exists, the two tips can
|
|
29
|
+
// still disagree, because a doer may have committed without its push
|
|
30
|
+
// succeeding. `localTipStatus` -- the caller's comparison of the two tips via
|
|
31
|
+
// `git merge-base --is-ancestor` in both directions -- resolves that:
|
|
32
|
+
// 'behind-or-equal' -- local holds nothing origin does not; safe to reset.
|
|
33
|
+
// 'ahead' -- local holds commits origin does not and origin holds
|
|
34
|
+
// none local does not; reuse the local branch so those
|
|
35
|
+
// commits survive.
|
|
36
|
+
// 'diverged' -- neither tip is an ancestor of the other; abort rather
|
|
37
|
+
// than attempt any automatic merge or rebase, since
|
|
38
|
+
// either direction could discard real commits.
|
|
39
|
+
export function decideEnsureBranchAction({ branch, baseBranch, branchFetchOk, branchFetchError, localBranchExists, localTipStatus, localSha, remoteSha }) {
|
|
40
|
+
// A failed fetch is only safe to read as "branch doesn't exist yet" when
|
|
41
|
+
// git says exactly that. Any other failure -- network blip, auth expiry,
|
|
42
|
+
// DNS hiccup -- must not fall back to origin/<baseBranch>, or a transient
|
|
43
|
+
// error would silently reset the branch to base.
|
|
44
|
+
if (!branchFetchOk && !/couldn't find remote ref/i.test(branchFetchError || '')) {
|
|
45
|
+
return {
|
|
46
|
+
action: 'abort',
|
|
47
|
+
message:
|
|
48
|
+
`Ensure Sprint Branch: fetch of existing branch 'origin/${branch}' ` +
|
|
49
|
+
`failed for a reason other than "branch doesn't exist" (${branchFetchError || 'unknown error'}) -- ` +
|
|
50
|
+
`refusing to silently fall back to resetting to base, since the branch may actually exist with real ` +
|
|
51
|
+
`pushed work and this fetch failure could be transient. Investigate and retry.`,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Both refs exist and neither tip is an ancestor of the other: never
|
|
56
|
+
// attempt an automatic merge or rebase, abort and let a human reconcile.
|
|
57
|
+
if (branchFetchOk && localBranchExists && localTipStatus === 'diverged') {
|
|
58
|
+
const shaNote = (localSha || remoteSha)
|
|
59
|
+
? ` (local ${localSha || 'unknown'} vs 'origin/${branch}' ${remoteSha || 'unknown'} -- if 'git branch -vv' ` +
|
|
60
|
+
`on the machine you are inspecting does not show '${branch}' at all, this member is very likely ` +
|
|
61
|
+
`dispatching commands against a DIFFERENT git working directory than the one you checked; verify the ` +
|
|
62
|
+
`member's actual registered working directory before assuming this is a real divergence.)`
|
|
63
|
+
: '';
|
|
64
|
+
return {
|
|
65
|
+
action: 'abort',
|
|
66
|
+
message:
|
|
67
|
+
`Ensure Sprint Branch: local branch '${branch}' has diverged from 'origin/${branch}' ` +
|
|
68
|
+
`(neither is an ancestor of the other) -- refusing to reset or auto-merge, since either direction ` +
|
|
69
|
+
`could silently discard real commits. A human needs to investigate and reconcile the two branches ` +
|
|
70
|
+
`manually before this sprint can safely proceed.${shaNote}`,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const startPoint = branchFetchOk ? `origin/${branch}` : `origin/${baseBranch}`;
|
|
75
|
+
// Reuse the local branch as-is (no reset) whenever the remote ref is
|
|
76
|
+
// missing entirely, or it exists but the local branch is strictly ahead of
|
|
77
|
+
// it -- resetting would discard committed-but-unpushed local work.
|
|
78
|
+
const reuseLocalBranch =
|
|
79
|
+
(!branchFetchOk && !!localBranchExists) ||
|
|
80
|
+
(branchFetchOk && !!localBranchExists && localTipStatus === 'ahead');
|
|
81
|
+
|
|
82
|
+
if (reuseLocalBranch) {
|
|
83
|
+
return {
|
|
84
|
+
action: 'checkout',
|
|
85
|
+
reused: true,
|
|
86
|
+
command: `git checkout ${branch}`,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
action: 'checkout',
|
|
92
|
+
reused: false,
|
|
93
|
+
command: `git checkout -B ${branch} ${startPoint}`,
|
|
94
|
+
startPoint,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -172,6 +172,14 @@ export async function dispatchConflictResolutionAgent({ agent, member, branch, u
|
|
|
172
172
|
member_name: member,
|
|
173
173
|
label: `Tier 2 conflict resolution [${unmergedPaths.join(', ')}]`,
|
|
174
174
|
model,
|
|
175
|
+
// EXPLICITLY a fresh session. The runbook above is entirely
|
|
176
|
+
// self-contained (it names the member, the branch and every
|
|
177
|
+
// conflicted path), and the member's stored last session is whatever
|
|
178
|
+
// role dispatch happened to run there -- resuming it would drop a git
|
|
179
|
+
// conflict-resolution instruction into an unrelated conversation.
|
|
180
|
+
// Never rely on an omitted `resume`: execute_prompt defaults it to
|
|
181
|
+
// true, i.e. best-effort reattachment to exactly that stale session.
|
|
182
|
+
resume: false,
|
|
175
183
|
timeout_s: 1800,
|
|
176
184
|
max_total_s: 1800,
|
|
177
185
|
});
|
|
@@ -281,9 +281,12 @@ export function majorVersionFromId(id) {
|
|
|
281
281
|
export function assertVersionPin(role, schema, expectedMajor) {
|
|
282
282
|
const actualMajor = majorVersionFromId(schema && schema.$id);
|
|
283
283
|
if (actualMajor !== expectedMajor) {
|
|
284
|
+
// GENERIC-BOUNDARY-EXCEPTION: developer-facing Error about this product's own vendored schema --
|
|
285
|
+
// thrown at module load and read by an apra-fleet developer, never dispatched to a sprint
|
|
286
|
+
// agent; it must name the package whose vendored schema drifted (docs/generic-engine-boundary.md).
|
|
284
287
|
throw new Error(
|
|
285
288
|
`[contracts] Version-pin mismatch for role "${role}": this module was written against ` +
|
|
286
|
-
`schema $id major version ${expectedMajor}, but the vendored schema's $id is ` +
|
|
289
|
+
`schema $id major version ${expectedMajor}, but the vendored schema's $id is ` + // shell-guard-allow: "$id" here and on the next line is the JSON Schema $id property name (schema.$id), not a shell variable expansion -- this text is a thrown JS Error, never dispatched as a command string.
|
|
287
290
|
`${JSON.stringify(schema && schema.$id)}. A packages/apra-fleet-se/apra-pm package update changed this ` +
|
|
288
291
|
`role's contract -- update contracts.mjs (and re-verify every call site that consumes ` +
|
|
289
292
|
`this schema) before accepting the new vendored version.`,
|
|
@@ -423,6 +426,47 @@ const FALLBACK_planReviewerVerdict = {
|
|
|
423
426
|
properties: {
|
|
424
427
|
verdict: { type: 'string', enum: ['APPROVED', 'CHANGES_NEEDED'] },
|
|
425
428
|
notes: { type: 'string' },
|
|
429
|
+
// apra-fleet-3swo.7.8: optional, deliberately NOT in `required` below
|
|
430
|
+
// -- mirrors packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json.
|
|
431
|
+
// Machine-readable per-bead findings, so a CHANGES_NEEDED verdict can
|
|
432
|
+
// be routed to the beads it concerns WITHOUT scanning free-text notes
|
|
433
|
+
// for literal bead ids (the job extractContestedBeadIds does today in
|
|
434
|
+
// fleet-sprint/newtask-text.mjs; retiring that scraper is a separate
|
|
435
|
+
// task). An EMPTY array is meaningful -- it is the explicit
|
|
436
|
+
// "plan-wide objection, no individual bead named" signal, which is the
|
|
437
|
+
// same thing the prose scan expressed by matching no id. An ABSENT
|
|
438
|
+
// field is schema-valid and means "this verdict predates the findings
|
|
439
|
+
// contract", so the consumer may still fall back to notes for one
|
|
440
|
+
// release; keeping it out of `required` is what makes that fallback
|
|
441
|
+
// window possible.
|
|
442
|
+
findings: {
|
|
443
|
+
type: 'array',
|
|
444
|
+
items: {
|
|
445
|
+
type: 'object',
|
|
446
|
+
properties: {
|
|
447
|
+
id: { type: 'string' },
|
|
448
|
+
kind: {
|
|
449
|
+
type: 'string',
|
|
450
|
+
enum: [
|
|
451
|
+
'coverage',
|
|
452
|
+
'missing_test_task',
|
|
453
|
+
'acceptance_criteria',
|
|
454
|
+
'task_size',
|
|
455
|
+
'dependency_wiring',
|
|
456
|
+
'scope_creep',
|
|
457
|
+
'duplicate_work',
|
|
458
|
+
'feasibility',
|
|
459
|
+
'ready_work',
|
|
460
|
+
'model_metadata',
|
|
461
|
+
'lane_cohesion',
|
|
462
|
+
'other',
|
|
463
|
+
],
|
|
464
|
+
},
|
|
465
|
+
detail: { type: 'string', minLength: 1 },
|
|
466
|
+
},
|
|
467
|
+
required: ['id', 'kind', 'detail'],
|
|
468
|
+
},
|
|
469
|
+
},
|
|
426
470
|
taskAssignments: { type: 'array', items: taskAssignmentSchema },
|
|
427
471
|
},
|
|
428
472
|
required: ['verdict', 'notes', 'taskAssignments'],
|
|
@@ -928,19 +972,22 @@ function longestBacktickRun(content) {
|
|
|
928
972
|
}
|
|
929
973
|
|
|
930
974
|
/**
|
|
931
|
-
* The pattern src/
|
|
932
|
-
*
|
|
933
|
-
*
|
|
975
|
+
* The pattern src/services/secret-token.ts (SECRET_TOKEN_RE) matches to
|
|
976
|
+
* reject a dispatch outright / redact untrusted content. Mirrored here as a
|
|
977
|
+
* literal rather than imported: this module deliberately has no dependency
|
|
978
|
+
* on the fleet server sources. Accepts both the canonical {{secret.NAME}}
|
|
979
|
+
* spelling and the deprecated {{secure.NAME}} one.
|
|
934
980
|
*/
|
|
935
|
-
const
|
|
981
|
+
const SECRET_TOKEN_RE_G = /\{\{(secret|secure)\.([a-zA-Z0-9_-]{1,64})\}\}/g;
|
|
936
982
|
|
|
937
|
-
const
|
|
938
|
-
+ '(
|
|
983
|
+
const SECRET_REDACTION_NOTE = 'NOTE: secret-token braces were redacted from the block above '
|
|
984
|
+
+ '(secret.NAME is shown without its surrounding double braces). Write the braced form when '
|
|
939
985
|
+ 'you actually use the token in an execute_command call.';
|
|
940
986
|
|
|
941
987
|
/**
|
|
942
|
-
* Strips the surrounding double braces from any
|
|
943
|
-
*
|
|
988
|
+
* Strips the surrounding double braces from any secret-token reference
|
|
989
|
+
* (either {{secret.NAME}} or the deprecated {{secure.NAME}}) in untrusted
|
|
990
|
+
* content, keeping the "secret.NAME"/"secure.NAME" text so it still reads.
|
|
944
991
|
*
|
|
945
992
|
* Why this must happen before the content reaches a prompt: execute_prompt
|
|
946
993
|
* rejects the ENTIRE dispatch -- no LLM call, an error string returned in
|
|
@@ -953,17 +1000,17 @@ const SECURE_REDACTION_NOTE = 'NOTE: secure-token braces were redacted from the
|
|
|
953
1000
|
* @param {string} content
|
|
954
1001
|
* @returns {{text: string, redacted: boolean}}
|
|
955
1002
|
*/
|
|
956
|
-
function
|
|
1003
|
+
function redactSecretTokens(content) {
|
|
957
1004
|
let text = content;
|
|
958
1005
|
let redacted = false;
|
|
959
1006
|
// Run to a fixed point rather than a single pass: replacing the inner
|
|
960
|
-
// token in `{{{{
|
|
1007
|
+
// token in `{{{{secret.A}}}}` leaves `{{secret.A}}`, so the surrounding
|
|
961
1008
|
// braces close over the redacted name and rebuild exactly the pattern
|
|
962
1009
|
// being removed. Untrusted content is attacker-influenced free-text, so
|
|
963
1010
|
// one pass is not enough. Guaranteed to terminate -- every replacement
|
|
964
1011
|
// removes four brace characters, so `text` strictly shrinks.
|
|
965
1012
|
for (;;) {
|
|
966
|
-
const next = text.replace(
|
|
1013
|
+
const next = text.replace(SECRET_TOKEN_RE_G, (_match, kind, name) => `${kind}.${name}`);
|
|
967
1014
|
if (next === text) break;
|
|
968
1015
|
text = next;
|
|
969
1016
|
redacted = true;
|
|
@@ -996,7 +1043,7 @@ export function wrapUntrustedBlock(sourceLabel, content) {
|
|
|
996
1043
|
if (typeof content !== 'string') {
|
|
997
1044
|
throw new TypeError('[contracts] wrapUntrustedBlock requires content to be a string');
|
|
998
1045
|
}
|
|
999
|
-
const { text: safeContent, redacted } =
|
|
1046
|
+
const { text: safeContent, redacted } = redactSecretTokens(content);
|
|
1000
1047
|
const fenceLength = Math.max(MIN_FENCE_LENGTH, longestBacktickRun(safeContent) + 1);
|
|
1001
1048
|
const fence = '`'.repeat(fenceLength);
|
|
1002
1049
|
return [
|
|
@@ -1005,7 +1052,7 @@ export function wrapUntrustedBlock(sourceLabel, content) {
|
|
|
1005
1052
|
`${fence}${UNTRUSTED_BLOCK_FENCE_LABEL}`,
|
|
1006
1053
|
safeContent,
|
|
1007
1054
|
fence,
|
|
1008
|
-
...(redacted ? [
|
|
1055
|
+
...(redacted ? [SECRET_REDACTION_NOTE] : []),
|
|
1009
1056
|
].join('\n');
|
|
1010
1057
|
}
|
|
1011
1058
|
|