agent-bober 0.11.6 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +311 -0
- package/README.md +124 -9
- package/agents/bober-architect.md +38 -0
- package/agents/bober-code-reviewer.md +236 -0
- package/agents/bober-curator.md +37 -0
- package/agents/bober-deployer.md +267 -0
- package/agents/bober-diagnoser.md +289 -0
- package/agents/bober-evaluator.md +127 -1
- package/agents/bober-generator.md +122 -3
- package/agents/bober-planner.md +293 -32
- package/agents/bober-postmortemer.md +185 -0
- package/agents/bober-researcher.md +38 -0
- package/dist/cli/commands/approve.d.ts +17 -0
- package/dist/cli/commands/approve.d.ts.map +1 -0
- package/dist/cli/commands/approve.js +64 -0
- package/dist/cli/commands/approve.js.map +1 -0
- package/dist/cli/commands/audit-show.d.ts +14 -0
- package/dist/cli/commands/audit-show.d.ts.map +1 -0
- package/dist/cli/commands/audit-show.js +85 -0
- package/dist/cli/commands/audit-show.js.map +1 -0
- package/dist/cli/commands/config.d.ts +10 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +73 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/eval.js +6 -6
- package/dist/cli/commands/eval.js.map +1 -1
- package/dist/cli/commands/graph.d.ts +8 -0
- package/dist/cli/commands/graph.d.ts.map +1 -0
- package/dist/cli/commands/graph.js +219 -0
- package/dist/cli/commands/graph.js.map +1 -0
- package/dist/cli/commands/impact.d.ts +19 -0
- package/dist/cli/commands/impact.d.ts.map +1 -0
- package/dist/cli/commands/impact.js +191 -0
- package/dist/cli/commands/impact.js.map +1 -0
- package/dist/cli/commands/incident.d.ts +19 -0
- package/dist/cli/commands/incident.d.ts.map +1 -0
- package/dist/cli/commands/incident.js +324 -0
- package/dist/cli/commands/incident.js.map +1 -0
- package/dist/cli/commands/init.js +82 -3
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/list-approvals.d.ts +16 -0
- package/dist/cli/commands/list-approvals.d.ts.map +1 -0
- package/dist/cli/commands/list-approvals.js +57 -0
- package/dist/cli/commands/list-approvals.js.map +1 -0
- package/dist/cli/commands/onboard.d.ts +3 -0
- package/dist/cli/commands/onboard.d.ts.map +1 -0
- package/dist/cli/commands/onboard.js +190 -0
- package/dist/cli/commands/onboard.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +12 -0
- package/dist/cli/commands/plan.d.ts.map +1 -1
- package/dist/cli/commands/plan.js +232 -37
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/cli/commands/playbook.d.ts +17 -0
- package/dist/cli/commands/playbook.d.ts.map +1 -0
- package/dist/cli/commands/playbook.js +123 -0
- package/dist/cli/commands/playbook.js.map +1 -0
- package/dist/cli/commands/postmortem.d.ts +12 -0
- package/dist/cli/commands/postmortem.d.ts.map +1 -0
- package/dist/cli/commands/postmortem.js +67 -0
- package/dist/cli/commands/postmortem.js.map +1 -0
- package/dist/cli/commands/reject.d.ts +17 -0
- package/dist/cli/commands/reject.d.ts.map +1 -0
- package/dist/cli/commands/reject.js +52 -0
- package/dist/cli/commands/reject.js.map +1 -0
- package/dist/cli/commands/rollback.d.ts +21 -0
- package/dist/cli/commands/rollback.d.ts.map +1 -0
- package/dist/cli/commands/rollback.js +90 -0
- package/dist/cli/commands/rollback.js.map +1 -0
- package/dist/cli/commands/run.d.ts +9 -0
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +31 -2
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/sprint.d.ts.map +1 -1
- package/dist/cli/commands/sprint.js +8 -8
- package/dist/cli/commands/sprint.js.map +1 -1
- package/dist/cli/commands/telemetry.d.ts +16 -0
- package/dist/cli/commands/telemetry.d.ts.map +1 -0
- package/dist/cli/commands/telemetry.js +152 -0
- package/dist/cli/commands/telemetry.js.map +1 -0
- package/dist/cli/commands/worktree.d.ts +12 -0
- package/dist/cli/commands/worktree.d.ts.map +1 -0
- package/dist/cli/commands/worktree.js +57 -0
- package/dist/cli/commands/worktree.js.map +1 -0
- package/dist/cli/index.js +73 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +27 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +4 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +18 -1
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +1016 -96
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +147 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/contracts/eval-result.d.ts +38 -38
- package/dist/contracts/index.d.ts +2 -2
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +8 -4
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/spec.d.ts +335 -40
- package/dist/contracts/spec.d.ts.map +1 -1
- package/dist/contracts/spec.js +210 -18
- package/dist/contracts/spec.js.map +1 -1
- package/dist/contracts/sprint-contract.d.ts +155 -88
- package/dist/contracts/sprint-contract.d.ts.map +1 -1
- package/dist/contracts/sprint-contract.js +176 -29
- package/dist/contracts/sprint-contract.js.map +1 -1
- package/dist/evaluators/builtin/api-check.js +1 -1
- package/dist/evaluators/builtin/api-check.js.map +1 -1
- package/dist/graph/artifact-store.d.ts +14 -0
- package/dist/graph/artifact-store.d.ts.map +1 -0
- package/dist/graph/artifact-store.js +100 -0
- package/dist/graph/artifact-store.js.map +1 -0
- package/dist/graph/cli.d.ts +49 -0
- package/dist/graph/cli.d.ts.map +1 -0
- package/dist/graph/cli.js +140 -0
- package/dist/graph/cli.js.map +1 -0
- package/dist/graph/client.d.ts +64 -0
- package/dist/graph/client.d.ts.map +1 -0
- package/dist/graph/client.js +216 -0
- package/dist/graph/client.js.map +1 -0
- package/dist/graph/fallback.d.ts +13 -0
- package/dist/graph/fallback.d.ts.map +1 -0
- package/dist/graph/fallback.js +57 -0
- package/dist/graph/fallback.js.map +1 -0
- package/dist/graph/hook-handler.d.ts +50 -0
- package/dist/graph/hook-handler.d.ts.map +1 -0
- package/dist/graph/hook-handler.js +217 -0
- package/dist/graph/hook-handler.js.map +1 -0
- package/dist/graph/incidents.d.ts +59 -0
- package/dist/graph/incidents.d.ts.map +1 -0
- package/dist/graph/incidents.js +22 -0
- package/dist/graph/incidents.js.map +1 -0
- package/dist/graph/mcp-client.d.ts +51 -0
- package/dist/graph/mcp-client.d.ts.map +1 -0
- package/dist/graph/mcp-client.js +285 -0
- package/dist/graph/mcp-client.js.map +1 -0
- package/dist/graph/onboarding-composer.d.ts +30 -0
- package/dist/graph/onboarding-composer.d.ts.map +1 -0
- package/dist/graph/onboarding-composer.js +275 -0
- package/dist/graph/onboarding-composer.js.map +1 -0
- package/dist/graph/pipeline-lifecycle.d.ts +86 -0
- package/dist/graph/pipeline-lifecycle.d.ts.map +1 -0
- package/dist/graph/pipeline-lifecycle.js +329 -0
- package/dist/graph/pipeline-lifecycle.js.map +1 -0
- package/dist/graph/preflight-budgets.d.ts +52 -0
- package/dist/graph/preflight-budgets.d.ts.map +1 -0
- package/dist/graph/preflight-budgets.js +78 -0
- package/dist/graph/preflight-budgets.js.map +1 -0
- package/dist/graph/preflight-injector.d.ts +116 -0
- package/dist/graph/preflight-injector.d.ts.map +1 -0
- package/dist/graph/preflight-injector.js +538 -0
- package/dist/graph/preflight-injector.js.map +1 -0
- package/dist/graph/prereq.d.ts +12 -0
- package/dist/graph/prereq.d.ts.map +1 -0
- package/dist/graph/prereq.js +61 -0
- package/dist/graph/prereq.js.map +1 -0
- package/dist/graph/prompts.d.ts +42 -0
- package/dist/graph/prompts.d.ts.map +1 -0
- package/dist/graph/prompts.js +80 -0
- package/dist/graph/prompts.js.map +1 -0
- package/dist/graph/sandbox.d.ts +19 -0
- package/dist/graph/sandbox.d.ts.map +1 -0
- package/dist/graph/sandbox.js +25 -0
- package/dist/graph/sandbox.js.map +1 -0
- package/dist/graph/token-usage.d.ts +21 -0
- package/dist/graph/token-usage.d.ts.map +1 -0
- package/dist/graph/token-usage.js +22 -0
- package/dist/graph/token-usage.js.map +1 -0
- package/dist/graph/types.d.ts +129 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +12 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/incident/orchestrator.d.ts +168 -0
- package/dist/incident/orchestrator.d.ts.map +1 -0
- package/dist/incident/orchestrator.js +279 -0
- package/dist/incident/orchestrator.js.map +1 -0
- package/dist/incident/playbook-search.d.ts +67 -0
- package/dist/incident/playbook-search.d.ts.map +1 -0
- package/dist/incident/playbook-search.js +288 -0
- package/dist/incident/playbook-search.js.map +1 -0
- package/dist/incident/postmortem.d.ts +44 -0
- package/dist/incident/postmortem.d.ts.map +1 -0
- package/dist/incident/postmortem.js +486 -0
- package/dist/incident/postmortem.js.map +1 -0
- package/dist/incident/resolution-verify.d.ts +186 -0
- package/dist/incident/resolution-verify.d.ts.map +1 -0
- package/dist/incident/resolution-verify.js +210 -0
- package/dist/incident/resolution-verify.js.map +1 -0
- package/dist/incident/rollback.d.ts +137 -0
- package/dist/incident/rollback.d.ts.map +1 -0
- package/dist/incident/rollback.js +328 -0
- package/dist/incident/rollback.js.map +1 -0
- package/dist/incident/timeline.d.ts +147 -0
- package/dist/incident/timeline.d.ts.map +1 -0
- package/dist/incident/timeline.js +452 -0
- package/dist/incident/timeline.js.map +1 -0
- package/dist/incident/types.d.ts +335 -0
- package/dist/incident/types.d.ts.map +1 -0
- package/dist/incident/types.js +158 -0
- package/dist/incident/types.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp/event-stream.d.ts +46 -0
- package/dist/mcp/event-stream.d.ts.map +1 -0
- package/dist/mcp/event-stream.js +421 -0
- package/dist/mcp/event-stream.js.map +1 -0
- package/dist/mcp/external-client.d.ts +38 -0
- package/dist/mcp/external-client.d.ts.map +1 -0
- package/dist/mcp/external-client.js +121 -0
- package/dist/mcp/external-client.js.map +1 -0
- package/dist/mcp/run-manager.d.ts +74 -9
- package/dist/mcp/run-manager.d.ts.map +1 -1
- package/dist/mcp/run-manager.js +127 -31
- package/dist/mcp/run-manager.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +56 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/abort-run.d.ts +2 -0
- package/dist/mcp/tools/abort-run.d.ts.map +1 -0
- package/dist/mcp/tools/abort-run.js +62 -0
- package/dist/mcp/tools/abort-run.js.map +1 -0
- package/dist/mcp/tools/anchor.js +1 -1
- package/dist/mcp/tools/anchor.js.map +1 -1
- package/dist/mcp/tools/approve-checkpoint.d.ts +2 -0
- package/dist/mcp/tools/approve-checkpoint.d.ts.map +1 -0
- package/dist/mcp/tools/approve-checkpoint.js +70 -0
- package/dist/mcp/tools/approve-checkpoint.js.map +1 -0
- package/dist/mcp/tools/brownfield.js +1 -1
- package/dist/mcp/tools/brownfield.js.map +1 -1
- package/dist/mcp/tools/contracts.js +2 -2
- package/dist/mcp/tools/contracts.js.map +1 -1
- package/dist/mcp/tools/eval.js +8 -8
- package/dist/mcp/tools/eval.js.map +1 -1
- package/dist/mcp/tools/get-project-state.d.ts +2 -0
- package/dist/mcp/tools/get-project-state.d.ts.map +1 -0
- package/dist/mcp/tools/get-project-state.js +107 -0
- package/dist/mcp/tools/get-project-state.js.map +1 -0
- package/dist/mcp/tools/get-run-status.d.ts +2 -0
- package/dist/mcp/tools/get-run-status.d.ts.map +1 -0
- package/dist/mcp/tools/get-run-status.js +40 -0
- package/dist/mcp/tools/get-run-status.js.map +1 -0
- package/dist/mcp/tools/graph-schemas.d.ts +100 -0
- package/dist/mcp/tools/graph-schemas.d.ts.map +1 -0
- package/dist/mcp/tools/graph-schemas.js +39 -0
- package/dist/mcp/tools/graph-schemas.js.map +1 -0
- package/dist/mcp/tools/graph.d.ts +19 -0
- package/dist/mcp/tools/graph.d.ts.map +1 -0
- package/dist/mcp/tools/graph.js +263 -0
- package/dist/mcp/tools/graph.js.map +1 -0
- package/dist/mcp/tools/incident.d.ts +2 -0
- package/dist/mcp/tools/incident.d.ts.map +1 -0
- package/dist/mcp/tools/incident.js +246 -0
- package/dist/mcp/tools/incident.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +38 -18
- package/dist/mcp/tools/index.d.ts.map +1 -1
- package/dist/mcp/tools/index.js +74 -18
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/list-active-runs.d.ts +2 -0
- package/dist/mcp/tools/list-active-runs.d.ts.map +1 -0
- package/dist/mcp/tools/list-active-runs.js +35 -0
- package/dist/mcp/tools/list-active-runs.js.map +1 -0
- package/dist/mcp/tools/list-pending-approvals.d.ts +2 -0
- package/dist/mcp/tools/list-pending-approvals.d.ts.map +1 -0
- package/dist/mcp/tools/list-pending-approvals.js +40 -0
- package/dist/mcp/tools/list-pending-approvals.js.map +1 -0
- package/dist/mcp/tools/list-projects.d.ts +2 -0
- package/dist/mcp/tools/list-projects.d.ts.map +1 -0
- package/dist/mcp/tools/list-projects.js +101 -0
- package/dist/mcp/tools/list-projects.js.map +1 -0
- package/dist/mcp/tools/list-specs.d.ts +2 -0
- package/dist/mcp/tools/list-specs.d.ts.map +1 -0
- package/dist/mcp/tools/list-specs.js +48 -0
- package/dist/mcp/tools/list-specs.js.map +1 -0
- package/dist/mcp/tools/plan.d.ts.map +1 -1
- package/dist/mcp/tools/plan.js +40 -14
- package/dist/mcp/tools/plan.js.map +1 -1
- package/dist/mcp/tools/playbook.d.ts +2 -0
- package/dist/mcp/tools/playbook.d.ts.map +1 -0
- package/dist/mcp/tools/playbook.js +104 -0
- package/dist/mcp/tools/playbook.js.map +1 -0
- package/dist/mcp/tools/postmortem.d.ts +2 -0
- package/dist/mcp/tools/postmortem.d.ts.map +1 -0
- package/dist/mcp/tools/postmortem.js +75 -0
- package/dist/mcp/tools/postmortem.js.map +1 -0
- package/dist/mcp/tools/react.js +1 -1
- package/dist/mcp/tools/react.js.map +1 -1
- package/dist/mcp/tools/reject-checkpoint.d.ts +2 -0
- package/dist/mcp/tools/reject-checkpoint.d.ts.map +1 -0
- package/dist/mcp/tools/reject-checkpoint.js +79 -0
- package/dist/mcp/tools/reject-checkpoint.js.map +1 -0
- package/dist/mcp/tools/rollback.d.ts +2 -0
- package/dist/mcp/tools/rollback.d.ts.map +1 -0
- package/dist/mcp/tools/rollback.js +78 -0
- package/dist/mcp/tools/rollback.js.map +1 -0
- package/dist/mcp/tools/run-in-worktree.d.ts +2 -0
- package/dist/mcp/tools/run-in-worktree.d.ts.map +1 -0
- package/dist/mcp/tools/run-in-worktree.js +90 -0
- package/dist/mcp/tools/run-in-worktree.js.map +1 -0
- package/dist/mcp/tools/run.js +1 -1
- package/dist/mcp/tools/run.js.map +1 -1
- package/dist/mcp/tools/solidity.js +1 -1
- package/dist/mcp/tools/solidity.js.map +1 -1
- package/dist/mcp/tools/sprint.d.ts.map +1 -1
- package/dist/mcp/tools/sprint.js +11 -11
- package/dist/mcp/tools/sprint.js.map +1 -1
- package/dist/mcp/tools/status.d.ts.map +1 -1
- package/dist/mcp/tools/status.js +11 -0
- package/dist/mcp/tools/status.js.map +1 -1
- package/dist/mcp/tools/subscribe-events.d.ts +2 -0
- package/dist/mcp/tools/subscribe-events.d.ts.map +1 -0
- package/dist/mcp/tools/subscribe-events.js +48 -0
- package/dist/mcp/tools/subscribe-events.js.map +1 -0
- package/dist/mcp/tools/unsubscribe-events.d.ts +2 -0
- package/dist/mcp/tools/unsubscribe-events.d.ts.map +1 -0
- package/dist/mcp/tools/unsubscribe-events.js +45 -0
- package/dist/mcp/tools/unsubscribe-events.js.map +1 -0
- package/dist/orchestrator/agent-loader.d.ts +16 -0
- package/dist/orchestrator/agent-loader.d.ts.map +1 -1
- package/dist/orchestrator/agent-loader.js +16 -0
- package/dist/orchestrator/agent-loader.js.map +1 -1
- package/dist/orchestrator/architect-agent.d.ts.map +1 -1
- package/dist/orchestrator/architect-agent.js +37 -8
- package/dist/orchestrator/architect-agent.js.map +1 -1
- package/dist/orchestrator/checkpoints/audit.d.ts +128 -0
- package/dist/orchestrator/checkpoints/audit.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/audit.js +272 -0
- package/dist/orchestrator/checkpoints/audit.js.map +1 -0
- package/dist/orchestrator/checkpoints/feedback-router.d.ts +213 -0
- package/dist/orchestrator/checkpoints/feedback-router.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/feedback-router.js +438 -0
- package/dist/orchestrator/checkpoints/feedback-router.js.map +1 -0
- package/dist/orchestrator/checkpoints/index.d.ts +11 -0
- package/dist/orchestrator/checkpoints/index.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/index.js +12 -0
- package/dist/orchestrator/checkpoints/index.js.map +1 -0
- package/dist/orchestrator/checkpoints/mechanisms/cli.d.ts +35 -0
- package/dist/orchestrator/checkpoints/mechanisms/cli.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/mechanisms/cli.js +153 -0
- package/dist/orchestrator/checkpoints/mechanisms/cli.js.map +1 -0
- package/dist/orchestrator/checkpoints/mechanisms/disk.d.ts +34 -0
- package/dist/orchestrator/checkpoints/mechanisms/disk.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/mechanisms/disk.js +139 -0
- package/dist/orchestrator/checkpoints/mechanisms/disk.js.map +1 -0
- package/dist/orchestrator/checkpoints/mechanisms/pr.d.ts +141 -0
- package/dist/orchestrator/checkpoints/mechanisms/pr.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/mechanisms/pr.js +445 -0
- package/dist/orchestrator/checkpoints/mechanisms/pr.js.map +1 -0
- package/dist/orchestrator/checkpoints/noop.d.ts +12 -0
- package/dist/orchestrator/checkpoints/noop.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/noop.js +13 -0
- package/dist/orchestrator/checkpoints/noop.js.map +1 -0
- package/dist/orchestrator/checkpoints/registry.d.ts +48 -0
- package/dist/orchestrator/checkpoints/registry.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/registry.js +89 -0
- package/dist/orchestrator/checkpoints/registry.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/_util.d.ts +50 -0
- package/dist/orchestrator/checkpoints/renderers/_util.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/_util.js +137 -0
- package/dist/orchestrator/checkpoints/renderers/_util.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/code-review.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/code-review.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/code-review.js +66 -0
- package/dist/orchestrator/checkpoints/renderers/code-review.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/curator-briefing.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/curator-briefing.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/curator-briefing.js +40 -0
- package/dist/orchestrator/checkpoints/renderers/curator-briefing.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/eval-result.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/eval-result.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/eval-result.js +54 -0
- package/dist/orchestrator/checkpoints/renderers/eval-result.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/generator-diff.d.ts +49 -0
- package/dist/orchestrator/checkpoints/renderers/generator-diff.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/generator-diff.js +154 -0
- package/dist/orchestrator/checkpoints/renderers/generator-diff.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/pipeline-summary.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/pipeline-summary.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/pipeline-summary.js +59 -0
- package/dist/orchestrator/checkpoints/renderers/pipeline-summary.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/plan.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/plan.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/plan.js +34 -0
- package/dist/orchestrator/checkpoints/renderers/plan.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/registry.d.ts +43 -0
- package/dist/orchestrator/checkpoints/renderers/registry.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/registry.js +83 -0
- package/dist/orchestrator/checkpoints/renderers/registry.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/research.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/research.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/research.js +39 -0
- package/dist/orchestrator/checkpoints/renderers/research.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-contract.d.ts +20 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-contract.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-contract.js +57 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-contract.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-summary.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-summary.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-summary.js +38 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-summary.js.map +1 -0
- package/dist/orchestrator/checkpoints/sites.d.ts +22 -0
- package/dist/orchestrator/checkpoints/sites.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/sites.js +57 -0
- package/dist/orchestrator/checkpoints/sites.js.map +1 -0
- package/dist/orchestrator/checkpoints/types.d.ts +51 -0
- package/dist/orchestrator/checkpoints/types.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/types.js +9 -0
- package/dist/orchestrator/checkpoints/types.js.map +1 -0
- package/dist/orchestrator/code-reviewer-agent.d.ts +50 -0
- package/dist/orchestrator/code-reviewer-agent.d.ts.map +1 -0
- package/dist/orchestrator/code-reviewer-agent.js +283 -0
- package/dist/orchestrator/code-reviewer-agent.js.map +1 -0
- package/dist/orchestrator/context-handoff.d.ts +484 -224
- package/dist/orchestrator/context-handoff.d.ts.map +1 -1
- package/dist/orchestrator/context-handoff.js +32 -12
- package/dist/orchestrator/context-handoff.js.map +1 -1
- package/dist/orchestrator/curator-agent.d.ts.map +1 -1
- package/dist/orchestrator/curator-agent.js +63 -12
- package/dist/orchestrator/curator-agent.js.map +1 -1
- package/dist/orchestrator/deploy/classify.d.ts +31 -0
- package/dist/orchestrator/deploy/classify.d.ts.map +1 -0
- package/dist/orchestrator/deploy/classify.js +109 -0
- package/dist/orchestrator/deploy/classify.js.map +1 -0
- package/dist/orchestrator/deploy/execute.d.ts +45 -0
- package/dist/orchestrator/deploy/execute.d.ts.map +1 -0
- package/dist/orchestrator/deploy/execute.js +146 -0
- package/dist/orchestrator/deploy/execute.js.map +1 -0
- package/dist/orchestrator/deploy/executor.d.ts +22 -0
- package/dist/orchestrator/deploy/executor.d.ts.map +1 -0
- package/dist/orchestrator/deploy/executor.js +31 -0
- package/dist/orchestrator/deploy/executor.js.map +1 -0
- package/dist/orchestrator/deploy/index.d.ts +21 -0
- package/dist/orchestrator/deploy/index.d.ts.map +1 -0
- package/dist/orchestrator/deploy/index.js +21 -0
- package/dist/orchestrator/deploy/index.js.map +1 -0
- package/dist/orchestrator/deploy/resolve.d.ts +51 -0
- package/dist/orchestrator/deploy/resolve.d.ts.map +1 -0
- package/dist/orchestrator/deploy/resolve.js +53 -0
- package/dist/orchestrator/deploy/resolve.js.map +1 -0
- package/dist/orchestrator/deploy/spawn.d.ts +60 -0
- package/dist/orchestrator/deploy/spawn.d.ts.map +1 -0
- package/dist/orchestrator/deploy/spawn.js +62 -0
- package/dist/orchestrator/deploy/spawn.js.map +1 -0
- package/dist/orchestrator/deploy/types.d.ts +98 -0
- package/dist/orchestrator/deploy/types.d.ts.map +1 -0
- package/dist/orchestrator/deploy/types.js +39 -0
- package/dist/orchestrator/deploy/types.js.map +1 -0
- package/dist/orchestrator/evaluator-agent.d.ts.map +1 -1
- package/dist/orchestrator/evaluator-agent.js +23 -10
- package/dist/orchestrator/evaluator-agent.js.map +1 -1
- package/dist/orchestrator/generator-agent.d.ts.map +1 -1
- package/dist/orchestrator/generator-agent.js +24 -11
- package/dist/orchestrator/generator-agent.js.map +1 -1
- package/dist/orchestrator/model-resolver.d.ts.map +1 -1
- package/dist/orchestrator/model-resolver.js +4 -2
- package/dist/orchestrator/model-resolver.js.map +1 -1
- package/dist/orchestrator/observability/index.d.ts +12 -0
- package/dist/orchestrator/observability/index.d.ts.map +1 -0
- package/dist/orchestrator/observability/index.js +12 -0
- package/dist/orchestrator/observability/index.js.map +1 -0
- package/dist/orchestrator/observability/merge.d.ts +73 -0
- package/dist/orchestrator/observability/merge.d.ts.map +1 -0
- package/dist/orchestrator/observability/merge.js +110 -0
- package/dist/orchestrator/observability/merge.js.map +1 -0
- package/dist/orchestrator/pipeline.d.ts +28 -0
- package/dist/orchestrator/pipeline.d.ts.map +1 -1
- package/dist/orchestrator/pipeline.js +223 -30
- package/dist/orchestrator/pipeline.js.map +1 -1
- package/dist/orchestrator/planner-agent.d.ts +21 -1
- package/dist/orchestrator/planner-agent.d.ts.map +1 -1
- package/dist/orchestrator/planner-agent.js +16 -6
- package/dist/orchestrator/planner-agent.js.map +1 -1
- package/dist/orchestrator/research-agent.d.ts.map +1 -1
- package/dist/orchestrator/research-agent.js +46 -9
- package/dist/orchestrator/research-agent.js.map +1 -1
- package/dist/orchestrator/tools/handlers.d.ts +2 -0
- package/dist/orchestrator/tools/handlers.d.ts.map +1 -1
- package/dist/orchestrator/tools/handlers.js +1 -1
- package/dist/orchestrator/tools/handlers.js.map +1 -1
- package/dist/orchestrator/tools/index.d.ts +84 -1
- package/dist/orchestrator/tools/index.d.ts.map +1 -1
- package/dist/orchestrator/tools/index.js +164 -1
- package/dist/orchestrator/tools/index.js.map +1 -1
- package/dist/orchestrator/worktree.d.ts +18 -0
- package/dist/orchestrator/worktree.d.ts.map +1 -0
- package/dist/orchestrator/worktree.js +129 -0
- package/dist/orchestrator/worktree.js.map +1 -0
- package/dist/providers/anthropic.d.ts +8 -1
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +86 -5
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/factory.d.ts.map +1 -1
- package/dist/providers/factory.js +35 -2
- package/dist/providers/factory.js.map +1 -1
- package/dist/providers/google.d.ts.map +1 -1
- package/dist/providers/google.js +5 -0
- package/dist/providers/google.js.map +1 -1
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/openai.d.ts.map +1 -1
- package/dist/providers/openai.js +4 -0
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/types.d.ts +25 -2
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/state/approval-state.d.ts +74 -0
- package/dist/state/approval-state.d.ts.map +1 -0
- package/dist/state/approval-state.js +127 -0
- package/dist/state/approval-state.js.map +1 -0
- package/dist/state/history.d.ts.map +1 -1
- package/dist/state/history.js +3 -3
- package/dist/state/history.js.map +1 -1
- package/dist/state/index.d.ts +3 -0
- package/dist/state/index.d.ts.map +1 -1
- package/dist/state/index.js +4 -1
- package/dist/state/index.js.map +1 -1
- package/dist/state/plan-state.js +1 -1
- package/dist/state/plan-state.js.map +1 -1
- package/dist/state/review-state.d.ts +15 -0
- package/dist/state/review-state.d.ts.map +1 -0
- package/dist/state/review-state.js +51 -0
- package/dist/state/review-state.js.map +1 -0
- package/dist/state/run-state.d.ts +39 -0
- package/dist/state/run-state.d.ts.map +1 -0
- package/dist/state/run-state.js +101 -0
- package/dist/state/run-state.js.map +1 -0
- package/dist/state/sprint-state.d.ts +9 -2
- package/dist/state/sprint-state.d.ts.map +1 -1
- package/dist/state/sprint-state.js +25 -11
- package/dist/state/sprint-state.js.map +1 -1
- package/dist/telemetry/emit.d.ts +41 -0
- package/dist/telemetry/emit.d.ts.map +1 -0
- package/dist/telemetry/emit.js +65 -0
- package/dist/telemetry/emit.js.map +1 -0
- package/dist/utils/git.d.ts +27 -0
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +50 -0
- package/dist/utils/git.js.map +1 -1
- package/hooks/hooks.json +17 -1
- package/hooks/session-start +42 -0
- package/package.json +6 -2
- package/scripts/check-prereqs.sh +12 -0
- package/scripts/e2e-graph-smoke.sh +167 -0
- package/scripts/graph-hook.mjs +151 -0
- package/scripts/migrate-specs.mjs +127 -0
- package/scripts/run-kpi-gate.mjs +245 -0
- package/scripts/sync-skills.mjs +99 -0
- package/skills/bober.code-review/SKILL.md +186 -0
- package/skills/bober.debug/SKILL.md +300 -0
- package/skills/bober.deploy/SKILL.md +262 -0
- package/skills/bober.diagnose/SKILL.md +254 -0
- package/skills/bober.graph/SKILL.md +85 -0
- package/skills/bober.impact/SKILL.md +101 -0
- package/skills/bober.incident/SKILL.md +245 -0
- package/skills/bober.onboard/SKILL.md +84 -0
- package/skills/bober.plan/SKILL.md +51 -0
- package/skills/bober.plan/references/spec-schema.md +31 -4
- package/skills/bober.postmortem/SKILL.md +231 -0
- package/skills/bober.run/SKILL.md +41 -7
- package/skills/bober.runbook/SKILL.md +335 -0
- package/skills/bober.sprint/SKILL.md +6 -259
- package/skills/bober.using-bober/SKILL.md +133 -0
- package/skills/bober.verify/SKILL.md +143 -0
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub PR-native checkpoint mechanism.
|
|
3
|
+
*
|
|
4
|
+
* On request(): opens a draft PR per `bober run` (idempotent — reuses
|
|
5
|
+
* existing run-tracking PR) and appends a checkpoint comment. Polls the PR
|
|
6
|
+
* for resolution via: (a) merge → auto-approve all pending, (b) 'approve
|
|
7
|
+
* <checkpointId>' comment or 'bober/approved-<id>' label, (c) 'reject
|
|
8
|
+
* <checkpointId> <feedback>' comment, (d) 'edit <checkpointId>\n```...```'
|
|
9
|
+
* comment. Falls back to disk mechanism with a warning when gh is unavailable.
|
|
10
|
+
*
|
|
11
|
+
* Sprint 10 — colocated in mechanisms/ per Sprint 7+8+9 precedent.
|
|
12
|
+
*/
|
|
13
|
+
import { execa } from "execa";
|
|
14
|
+
import { DiskCheckpointMechanism } from "./disk.js";
|
|
15
|
+
import { render } from "../renderers/registry.js";
|
|
16
|
+
const DEFAULT_POLL_MS = 30_000;
|
|
17
|
+
const MIN_POLL_MS = 10_000;
|
|
18
|
+
const DEFAULT_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1000; // 7d cap (mirrors disk)
|
|
19
|
+
const RATE_LIMIT_BACKOFF_CAP_MS = 5 * 60 * 1000; // 5 minute cap
|
|
20
|
+
/** Default GhClient implementation — wraps execa. */
|
|
21
|
+
export function createGhClient(cwd) {
|
|
22
|
+
return {
|
|
23
|
+
async version() {
|
|
24
|
+
const r = await execa("gh", ["--version"], { reject: false, timeout: 5000 });
|
|
25
|
+
return { ok: r.exitCode === 0, stdout: r.stdout ?? "" };
|
|
26
|
+
},
|
|
27
|
+
async authStatus() {
|
|
28
|
+
const r = await execa("gh", ["auth", "status"], { reject: false, timeout: 5000 });
|
|
29
|
+
return { ok: r.exitCode === 0, stderr: r.stderr ?? "" };
|
|
30
|
+
},
|
|
31
|
+
async repoView() {
|
|
32
|
+
const r = await execa("gh", ["repo", "view", "--json", "url,owner,name"], { cwd, reject: false, timeout: 5000 });
|
|
33
|
+
if (r.exitCode !== 0)
|
|
34
|
+
return null;
|
|
35
|
+
try {
|
|
36
|
+
const j = JSON.parse(r.stdout ?? "{}");
|
|
37
|
+
return { url: j.url, owner: j.owner.login, name: j.name };
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
async prList(headRef) {
|
|
44
|
+
const r = await execa("gh", ["pr", "list", "--head", headRef, "--json", "number,state", "--state", "open"], { cwd, reject: false, timeout: 10000 });
|
|
45
|
+
if (r.exitCode !== 0)
|
|
46
|
+
return [];
|
|
47
|
+
try {
|
|
48
|
+
return JSON.parse(r.stdout ?? "[]");
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
async prCreate({ title, body, draft }) {
|
|
55
|
+
const args = ["pr", "create", "--title", title, "--body", body];
|
|
56
|
+
if (draft)
|
|
57
|
+
args.push("--draft");
|
|
58
|
+
const r = await execa("gh", args, { cwd, reject: false, timeout: 30000 });
|
|
59
|
+
if (r.exitCode !== 0)
|
|
60
|
+
throw new Error(`gh pr create failed: ${r.stderr}`);
|
|
61
|
+
// gh pr create outputs the PR URL on stdout
|
|
62
|
+
const url = (r.stdout ?? "").trim();
|
|
63
|
+
// Extract PR number from URL (e.g. https://github.com/owner/repo/pull/42)
|
|
64
|
+
const match = url.match(/\/pull\/(\d+)/);
|
|
65
|
+
const number = match ? parseInt(match[1], 10) : 0;
|
|
66
|
+
return { number, url };
|
|
67
|
+
},
|
|
68
|
+
async prEdit(prNumber, body) {
|
|
69
|
+
const r = await execa("gh", ["pr", "edit", String(prNumber), "--body", body], { cwd, reject: false, timeout: 10000 });
|
|
70
|
+
if (r.exitCode !== 0)
|
|
71
|
+
throw new Error(`gh pr edit failed: ${r.stderr}`);
|
|
72
|
+
},
|
|
73
|
+
async prReady(prNumber) {
|
|
74
|
+
const r = await execa("gh", ["pr", "ready", String(prNumber)], { cwd, reject: false, timeout: 10000 });
|
|
75
|
+
if (r.exitCode !== 0)
|
|
76
|
+
throw new Error(`gh pr ready failed: ${r.stderr}`);
|
|
77
|
+
},
|
|
78
|
+
async prComment(prNumber, body) {
|
|
79
|
+
const r = await execa("gh", ["pr", "comment", String(prNumber), "--body", body], { cwd, reject: false, timeout: 10000 });
|
|
80
|
+
if (r.exitCode !== 0)
|
|
81
|
+
throw new Error(`gh pr comment failed: ${r.stderr}`);
|
|
82
|
+
},
|
|
83
|
+
async prView(prNumber) {
|
|
84
|
+
const r = await execa("gh", ["pr", "view", String(prNumber), "--json", "state,merged,labels,comments"], { cwd, reject: false, timeout: 10000 });
|
|
85
|
+
if (r.exitCode !== 0) {
|
|
86
|
+
return { state: "UNKNOWN", merged: false, labels: [], comments: [] };
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
return JSON.parse(r.stdout ?? "{}");
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return { state: "UNKNOWN", merged: false, labels: [], comments: [] };
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export class PrCheckpointMechanism {
|
|
98
|
+
gh;
|
|
99
|
+
fallback;
|
|
100
|
+
options;
|
|
101
|
+
now;
|
|
102
|
+
cwd;
|
|
103
|
+
/** Cached PR number for this run — set on first request(), reused thereafter. */
|
|
104
|
+
runPrNumber = null;
|
|
105
|
+
/** Per-checkpoint states — updated as checkpoints are added and resolved. */
|
|
106
|
+
checkpointStates = new Map();
|
|
107
|
+
/** Number of in-flight request() calls. Used to defer prReady until all requests finish. */
|
|
108
|
+
inFlightCount = 0;
|
|
109
|
+
/** Pending prReady timer handle — cancelled if a new request() starts before it fires. */
|
|
110
|
+
prReadyTimer = null;
|
|
111
|
+
/**
|
|
112
|
+
* @param gh - Mockable GhClient. Tests pass a fake; prod uses createGhClient(cwd).
|
|
113
|
+
* @param fallback - Mechanism used when gh is unavailable. Defaults to DiskCheckpointMechanism
|
|
114
|
+
* rooted at <cwd>/.bober/approvals. MUST be disk (not cli/noop) per evaluator note.
|
|
115
|
+
* @param options - poll/timeout/runId/featureName.
|
|
116
|
+
* @param now - Clock injection for deterministic timeout tests (matches disk.ts:69).
|
|
117
|
+
* @param cwd - Working directory, defaults to process.cwd().
|
|
118
|
+
*/
|
|
119
|
+
constructor(gh, fallback = new DiskCheckpointMechanism(`${process.cwd()}/.bober/approvals`), options = {}, now = () => Date.now(), cwd = process.cwd()) {
|
|
120
|
+
this.gh = gh;
|
|
121
|
+
this.fallback = fallback;
|
|
122
|
+
this.options = options;
|
|
123
|
+
this.now = now;
|
|
124
|
+
this.cwd = cwd;
|
|
125
|
+
}
|
|
126
|
+
async request(checkpoint, artifact) {
|
|
127
|
+
// 1) Availability check (s10-c4) — gh version, gh auth, gh repo view.
|
|
128
|
+
const avail = await this.checkAvailability();
|
|
129
|
+
if (!avail.ok) {
|
|
130
|
+
process.stderr.write(`warn: PR checkpoint "${checkpoint}" requested but gh is unavailable (${avail.reason}); falling back to disk mechanism. Run \`gh auth login\` to enable PR checkpoints.\n`);
|
|
131
|
+
return this.fallback.request(checkpoint, artifact);
|
|
132
|
+
}
|
|
133
|
+
// 2) Add this checkpoint to the state map as pending and track in-flight count.
|
|
134
|
+
// Cancel any deferred prReady that may have been scheduled by a prior request.
|
|
135
|
+
this.checkpointStates.set(checkpoint, "pending");
|
|
136
|
+
this.inFlightCount++;
|
|
137
|
+
if (this.prReadyTimer !== null) {
|
|
138
|
+
clearTimeout(this.prReadyTimer);
|
|
139
|
+
this.prReadyTimer = null;
|
|
140
|
+
}
|
|
141
|
+
// 3) Find or create the run-tracking PR.
|
|
142
|
+
const prNumber = await this.ensureRunPr(avail.headRef);
|
|
143
|
+
// 4) Update the PR body to include per-checkpoint checkbox list.
|
|
144
|
+
const runId = this.options.runId ?? `run-${Date.now()}`;
|
|
145
|
+
const featureName = this.options.featureName ?? "bober run";
|
|
146
|
+
await this.gh.prEdit(prNumber, this.renderPrBody(runId, featureName));
|
|
147
|
+
// 5) Append the checkpoint comment.
|
|
148
|
+
await this.gh.prComment(prNumber, this.renderCheckpointComment(checkpoint, artifact));
|
|
149
|
+
// 6) Poll for resolution (merge / approve / reject / edit) with exponential
|
|
150
|
+
// back-off on rate-limit errors (cap at 5 minutes per evaluatorNotes).
|
|
151
|
+
const outcome = await this.pollPrUntilResolved(prNumber, checkpoint, artifact);
|
|
152
|
+
// 7) Update checkpoint state and PR body after resolution.
|
|
153
|
+
if ("edit" in outcome && outcome.edit) {
|
|
154
|
+
// For edit outcomes, leave as pending until next request resolves it.
|
|
155
|
+
}
|
|
156
|
+
else if ("approved" in outcome && outcome.approved) {
|
|
157
|
+
this.checkpointStates.set(checkpoint, "approved");
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
this.checkpointStates.set(checkpoint, "rejected");
|
|
161
|
+
}
|
|
162
|
+
// Decrement in-flight counter after resolution.
|
|
163
|
+
this.inFlightCount--;
|
|
164
|
+
// Re-render PR body with updated checkbox states.
|
|
165
|
+
await this.gh.prEdit(prNumber, this.renderPrBody(runId, featureName));
|
|
166
|
+
// 8) If ALL checkpoints are approved (none pending, none rejected), schedule
|
|
167
|
+
// prReady via a deferred macrotask (setTimeout 0). This allows the next
|
|
168
|
+
// sequential request() call to cancel it if another checkpoint is coming.
|
|
169
|
+
const hasNoRejection = [...this.checkpointStates.values()].every((s) => s !== "rejected");
|
|
170
|
+
const hasNoPending = [...this.checkpointStates.values()].every((s) => s !== "pending");
|
|
171
|
+
if (hasNoRejection && hasNoPending && this.checkpointStates.size > 0) {
|
|
172
|
+
const capturedPrNumber = prNumber;
|
|
173
|
+
const capturedGh = this.gh;
|
|
174
|
+
this.prReadyTimer = setTimeout(() => {
|
|
175
|
+
this.prReadyTimer = null;
|
|
176
|
+
// Double-check: no new pending checkpoints added while timer was pending.
|
|
177
|
+
const stillAllApproved = this.checkpointStates.size > 0 &&
|
|
178
|
+
[...this.checkpointStates.values()].every((s) => s === "approved");
|
|
179
|
+
if (stillAllApproved) {
|
|
180
|
+
capturedGh.prReady(capturedPrNumber).catch((err) => {
|
|
181
|
+
process.stderr.write(`warn: gh pr ready failed: ${String(err)}\n`);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}, 0);
|
|
185
|
+
}
|
|
186
|
+
return outcome;
|
|
187
|
+
}
|
|
188
|
+
/** Check if gh is available and the repo has a GitHub remote. */
|
|
189
|
+
async checkAvailability() {
|
|
190
|
+
// (a) gh --version
|
|
191
|
+
const ver = await this.gh.version();
|
|
192
|
+
if (!ver.ok) {
|
|
193
|
+
return { ok: false, reason: "gh CLI not found or returned non-zero exit" };
|
|
194
|
+
}
|
|
195
|
+
// (b) gh auth status
|
|
196
|
+
const auth = await this.gh.authStatus();
|
|
197
|
+
if (!auth.ok) {
|
|
198
|
+
return { ok: false, reason: "gh auth status failed — not authenticated" };
|
|
199
|
+
}
|
|
200
|
+
// (c) repo has a GitHub remote
|
|
201
|
+
const repo = await this.gh.repoView();
|
|
202
|
+
if (!repo) {
|
|
203
|
+
return { ok: false, reason: "no GitHub remote found (gh repo view failed)" };
|
|
204
|
+
}
|
|
205
|
+
// Get current branch for PR head ref.
|
|
206
|
+
// Use injected headRef option if available (tests), otherwise detect via git.
|
|
207
|
+
let headRef;
|
|
208
|
+
if (this.options.headRef !== undefined) {
|
|
209
|
+
headRef = this.options.headRef;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
try {
|
|
213
|
+
const r = await execa("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
|
|
214
|
+
cwd: this.cwd,
|
|
215
|
+
reject: false,
|
|
216
|
+
timeout: 5000,
|
|
217
|
+
});
|
|
218
|
+
headRef = r.exitCode === 0 ? (r.stdout ?? "").trim() : "HEAD";
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
headRef = "HEAD";
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return { ok: true, headRef, repoUrl: repo.url };
|
|
225
|
+
}
|
|
226
|
+
/** Find existing run PR or create a new one. Caches the PR number for the run. */
|
|
227
|
+
async ensureRunPr(headRef) {
|
|
228
|
+
if (this.runPrNumber !== null) {
|
|
229
|
+
return this.runPrNumber;
|
|
230
|
+
}
|
|
231
|
+
// Check if a PR already exists for this head ref.
|
|
232
|
+
const existing = await this.gh.prList(headRef);
|
|
233
|
+
if (existing.length > 0) {
|
|
234
|
+
this.runPrNumber = existing[0].number;
|
|
235
|
+
return this.runPrNumber;
|
|
236
|
+
}
|
|
237
|
+
// Create a new draft PR.
|
|
238
|
+
const runId = this.options.runId ?? `run-${Date.now()}`;
|
|
239
|
+
const featureName = this.options.featureName ?? "bober run";
|
|
240
|
+
const title = `bober: ${runId} — ${featureName}`;
|
|
241
|
+
const body = this.renderPrBody(runId, featureName);
|
|
242
|
+
const created = await this.gh.prCreate({ title, body, draft: true });
|
|
243
|
+
this.runPrNumber = created.number;
|
|
244
|
+
return this.runPrNumber;
|
|
245
|
+
}
|
|
246
|
+
/** Render the PR body with a per-checkpoint checkbox list. */
|
|
247
|
+
renderPrBody(runId, featureName) {
|
|
248
|
+
const checkboxLines = [];
|
|
249
|
+
for (const [id, state] of this.checkpointStates) {
|
|
250
|
+
if (state === "approved") {
|
|
251
|
+
checkboxLines.push(`- [x] ${id}`);
|
|
252
|
+
}
|
|
253
|
+
else if (state === "rejected") {
|
|
254
|
+
checkboxLines.push(`- [x] ${id} (rejected)`);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
checkboxLines.push(`- [ ] ${id}`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
const checkpointsSection = checkboxLines.length > 0
|
|
261
|
+
? checkboxLines.join("\n")
|
|
262
|
+
: "Checkpoint comments will be appended below as the run progresses.";
|
|
263
|
+
return [
|
|
264
|
+
`# bober run: ${featureName}`,
|
|
265
|
+
``,
|
|
266
|
+
`**Run ID:** \`${runId}\``,
|
|
267
|
+
``,
|
|
268
|
+
`## Checkpoints`,
|
|
269
|
+
``,
|
|
270
|
+
checkpointsSection,
|
|
271
|
+
``,
|
|
272
|
+
`## How to respond`,
|
|
273
|
+
``,
|
|
274
|
+
`Post a comment with one of:`,
|
|
275
|
+
`- \`approve <checkpointId>\` — approve that checkpoint`,
|
|
276
|
+
`- \`reject <checkpointId> <feedback>\` — reject with feedback`,
|
|
277
|
+
`- \`edit <checkpointId>\n\`\`\`\n<new content>\n\`\`\`\` — request an edit`,
|
|
278
|
+
``,
|
|
279
|
+
`Or merge this PR to auto-approve all pending checkpoints.`,
|
|
280
|
+
].join("\n");
|
|
281
|
+
}
|
|
282
|
+
/** Render a checkpoint comment to post on the PR. */
|
|
283
|
+
renderCheckpointComment(checkpoint, artifact) {
|
|
284
|
+
return [
|
|
285
|
+
`## Checkpoint: \`${checkpoint}\``,
|
|
286
|
+
``,
|
|
287
|
+
render(artifact),
|
|
288
|
+
``,
|
|
289
|
+
`---`,
|
|
290
|
+
``,
|
|
291
|
+
`Reply with \`approve ${checkpoint}\`, \`reject ${checkpoint} <reason>\`, or \`edit ${checkpoint}\n\`\`\`\n<new content>\n\`\`\`\`.`,
|
|
292
|
+
].join("\n");
|
|
293
|
+
}
|
|
294
|
+
/** Poll the PR until it resolves (merge / approve / reject / edit) or times out. */
|
|
295
|
+
async pollPrUntilResolved(prNumber, checkpoint, artifact) {
|
|
296
|
+
const rawPollMs = this.options.pollMs ?? DEFAULT_POLL_MS;
|
|
297
|
+
if (rawPollMs < MIN_POLL_MS) {
|
|
298
|
+
process.stderr.write(`warn: prPollMs (${rawPollMs}ms) is below the minimum (${MIN_POLL_MS}ms); using configured value but may hit GitHub rate limits.\n`);
|
|
299
|
+
}
|
|
300
|
+
const pollMs = rawPollMs;
|
|
301
|
+
const timeoutMs = this.options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
302
|
+
const startedAt = this.now();
|
|
303
|
+
let currentBackoffMs = pollMs;
|
|
304
|
+
let pollHandle;
|
|
305
|
+
try {
|
|
306
|
+
return await new Promise((resolve, reject) => {
|
|
307
|
+
const tick = async () => {
|
|
308
|
+
try {
|
|
309
|
+
// Check timeout.
|
|
310
|
+
if (this.now() - startedAt >= timeoutMs) {
|
|
311
|
+
resolve({ approved: false, feedback: "TIMEOUT" });
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
let view;
|
|
315
|
+
try {
|
|
316
|
+
view = await this.gh.prView(prNumber);
|
|
317
|
+
}
|
|
318
|
+
catch (err) {
|
|
319
|
+
// On rate-limit or transient error, back off.
|
|
320
|
+
const errMsg = String(err);
|
|
321
|
+
if (/rate.?limit|abuse.?detection|429/i.test(errMsg)) {
|
|
322
|
+
currentBackoffMs = Math.min(currentBackoffMs * 2, RATE_LIMIT_BACKOFF_CAP_MS);
|
|
323
|
+
process.stderr.write(`warn: PR poll hit rate limit; backing off to ${Math.round(currentBackoffMs / 1000)}s.\n`);
|
|
324
|
+
}
|
|
325
|
+
pollHandle = setTimeout(() => { tick().catch(reject); }, currentBackoffMs);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
// Check for signals in order of precedence.
|
|
329
|
+
const signal = parseSignals(view, checkpoint, artifact);
|
|
330
|
+
if (signal !== null) {
|
|
331
|
+
switch (signal.type) {
|
|
332
|
+
case "merge":
|
|
333
|
+
resolve({ approved: true });
|
|
334
|
+
return;
|
|
335
|
+
case "approve":
|
|
336
|
+
resolve({ approved: true });
|
|
337
|
+
return;
|
|
338
|
+
case "reject":
|
|
339
|
+
resolve({ approved: false, feedback: signal.feedback });
|
|
340
|
+
return;
|
|
341
|
+
case "edit":
|
|
342
|
+
resolve({ edit: true, editDelta: signal.editDelta });
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
// Reset backoff on success.
|
|
347
|
+
currentBackoffMs = pollMs;
|
|
348
|
+
// Schedule next tick.
|
|
349
|
+
pollHandle = setTimeout(() => { tick().catch(reject); }, pollMs);
|
|
350
|
+
}
|
|
351
|
+
catch (err) {
|
|
352
|
+
reject(err);
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
// Start the first tick.
|
|
356
|
+
pollHandle = setTimeout(() => { tick().catch(reject); }, pollMs);
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
finally {
|
|
360
|
+
if (pollHandle !== undefined) {
|
|
361
|
+
clearTimeout(pollHandle);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Parse PR state + comments + labels to determine the resolution signal.
|
|
368
|
+
* Strict parsing — rejects typos like 'approveeee' or 'aproove'.
|
|
369
|
+
*/
|
|
370
|
+
export function parseSignals(view, checkpoint, artifact) {
|
|
371
|
+
// (a) PR merge → auto-approve all pending.
|
|
372
|
+
if (view.merged) {
|
|
373
|
+
return { type: "merge" };
|
|
374
|
+
}
|
|
375
|
+
// (b) Label-based approval: 'bober/approved-<checkpointId>'.
|
|
376
|
+
const approvalLabel = `bober/approved-${checkpoint}`;
|
|
377
|
+
if (view.labels.some((l) => l.name === approvalLabel)) {
|
|
378
|
+
return { type: "approve" };
|
|
379
|
+
}
|
|
380
|
+
// Check comments in order (oldest first — first matching signal wins).
|
|
381
|
+
for (const comment of view.comments) {
|
|
382
|
+
const body = comment.body.trim();
|
|
383
|
+
const signal = parseCommentSignal(body, checkpoint, artifact);
|
|
384
|
+
if (signal !== null) {
|
|
385
|
+
return signal;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Derive the 'before' text from an artifact for edit deltas.
|
|
392
|
+
*/
|
|
393
|
+
function deriveBefore(art, artifact) {
|
|
394
|
+
if (art && typeof art === "object") {
|
|
395
|
+
if (typeof art["text"] === "string") {
|
|
396
|
+
return art["text"];
|
|
397
|
+
}
|
|
398
|
+
else if (typeof art["content"] === "string") {
|
|
399
|
+
return art["content"];
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
return JSON.stringify(art, null, 2);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
else if (typeof artifact === "string") {
|
|
406
|
+
return artifact;
|
|
407
|
+
}
|
|
408
|
+
return JSON.stringify(artifact, null, 2);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Parse a single comment body for approval signals.
|
|
412
|
+
* Strict word-boundary matching to reject typos.
|
|
413
|
+
*/
|
|
414
|
+
function parseCommentSignal(body, checkpoint, artifact) {
|
|
415
|
+
// Normalize line endings.
|
|
416
|
+
const normalized = body.replace(/\r\n/g, "\n");
|
|
417
|
+
// Split into first line and rest.
|
|
418
|
+
const firstNewline = normalized.indexOf("\n");
|
|
419
|
+
const firstLine = firstNewline >= 0 ? normalized.slice(0, firstNewline).trim() : normalized.trim();
|
|
420
|
+
const rest = firstNewline >= 0 ? normalized.slice(firstNewline + 1) : "";
|
|
421
|
+
// Strict approve: '^approve <checkpointId>$' (case-insensitive, word boundaries).
|
|
422
|
+
// Rejects 'approveeee', 'aproove', etc.
|
|
423
|
+
const approveMatch = /^approve\s+(\S+)\s*$/i.exec(firstLine);
|
|
424
|
+
if (approveMatch && approveMatch[1] === checkpoint) {
|
|
425
|
+
return { type: "approve" };
|
|
426
|
+
}
|
|
427
|
+
// Strict reject: '^reject <checkpointId> <feedback>$' (case-insensitive).
|
|
428
|
+
const rejectMatch = /^reject\s+(\S+)\s+(.+)$/i.exec(firstLine);
|
|
429
|
+
if (rejectMatch && rejectMatch[1] === checkpoint) {
|
|
430
|
+
return { type: "reject", feedback: rejectMatch[2].trim() };
|
|
431
|
+
}
|
|
432
|
+
// Edit: '^edit <checkpointId>' followed by a fenced code block.
|
|
433
|
+
const editMatch = /^edit\s+(\S+)\s*$/i.exec(firstLine);
|
|
434
|
+
if (editMatch && editMatch[1] === checkpoint) {
|
|
435
|
+
// Extract the fenced code block from the rest of the comment.
|
|
436
|
+
const fenceMatch = /^```[^\n]*\n([\s\S]*?)```/m.exec(rest);
|
|
437
|
+
const after = fenceMatch ? fenceMatch[1] : rest.trim();
|
|
438
|
+
// Derive 'before' from the artifact.
|
|
439
|
+
const art = artifact;
|
|
440
|
+
const before = deriveBefore(art, artifact);
|
|
441
|
+
return { type: "edit", editDelta: { before, after } };
|
|
442
|
+
}
|
|
443
|
+
return null;
|
|
444
|
+
}
|
|
445
|
+
//# sourceMappingURL=pr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr.js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3C,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;IACxD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CheckpointArtifact, CheckpointId, CheckpointMechanism, CheckpointOutcome } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The auto-approve mechanism used in autopilot mode (the default).
|
|
4
|
+
* Every request resolves synchronously to { approved: true } — preserves
|
|
5
|
+
* pipeline behavior identical to pre-Tier-2.
|
|
6
|
+
*
|
|
7
|
+
* Sprints 8-10 register real mechanisms (cli, disk, pr) alongside this one.
|
|
8
|
+
*/
|
|
9
|
+
export declare class NoopCheckpointMechanism implements CheckpointMechanism {
|
|
10
|
+
request(_checkpoint: CheckpointId, _artifact: CheckpointArtifact): Promise<CheckpointOutcome>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=noop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/checkpoints/noop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE3G;;;;;;GAMG;AACH,qBAAa,uBAAwB,YAAW,mBAAmB;IAC3D,OAAO,CACX,WAAW,EAAE,YAAY,EACzB,SAAS,EAAE,kBAAkB,GAC5B,OAAO,CAAC,iBAAiB,CAAC;CAG9B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The auto-approve mechanism used in autopilot mode (the default).
|
|
3
|
+
* Every request resolves synchronously to { approved: true } — preserves
|
|
4
|
+
* pipeline behavior identical to pre-Tier-2.
|
|
5
|
+
*
|
|
6
|
+
* Sprints 8-10 register real mechanisms (cli, disk, pr) alongside this one.
|
|
7
|
+
*/
|
|
8
|
+
export class NoopCheckpointMechanism {
|
|
9
|
+
async request(_checkpoint, _artifact) {
|
|
10
|
+
return { approved: true };
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=noop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop.js","sourceRoot":"","sources":["../../../src/orchestrator/checkpoints/noop.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,OAAO,uBAAuB;IAClC,KAAK,CAAC,OAAO,CACX,WAAyB,EACzB,SAA6B;QAE7B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CheckpointMechanism } from "./types.js";
|
|
2
|
+
export declare function registerCheckpointMechanism(name: string, impl: CheckpointMechanism): void;
|
|
3
|
+
export declare function getCheckpointMechanism(name: string): CheckpointMechanism;
|
|
4
|
+
/**
|
|
5
|
+
* Minimal config shape for per-checkpoint override resolution.
|
|
6
|
+
* Structural subset of BoberConfig — passing a real BoberConfig works without a cast.
|
|
7
|
+
*
|
|
8
|
+
* Sprint 14: added mode field and extended checkpointOverrides type.
|
|
9
|
+
*/
|
|
10
|
+
export interface CheckpointOverrideConfig {
|
|
11
|
+
pipeline?: {
|
|
12
|
+
/** Global default checkpoint mechanism name (e.g., "noop", "cli", "disk", "pr"). */
|
|
13
|
+
checkpointMechanism?: string;
|
|
14
|
+
/** Per-checkpoint overrides: { "<checkpointId>": "<mechanismName>" } */
|
|
15
|
+
checkpointOverrides?: Record<string, string>;
|
|
16
|
+
/** Pipeline execution mode — determines mechanism default when checkpointMechanism is unset. */
|
|
17
|
+
mode?: "autopilot" | "careful";
|
|
18
|
+
/** Allow any additional pipeline fields (e.g., maxCheckpointIterations) from BoberConfig. */
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Pure resolution function — returns the mechanism name string without doing a registry lookup.
|
|
24
|
+
* Sprint 14: implements 6-tier resolution order:
|
|
25
|
+
* 1. cliOverrideAll && cliOverride → cliOverride (force-all CLI flag)
|
|
26
|
+
* 2. config.pipeline.checkpointOverrides[checkpointId] (most specific per-checkpoint config)
|
|
27
|
+
* 3. cliOverride (per-run CLI flag, deferred to after per-checkpoint config override)
|
|
28
|
+
* 4. config.pipeline.checkpointMechanism (global config default, if set)
|
|
29
|
+
* 5. mode default: mode='careful' → 'disk', mode='autopilot' or unset → 'noop'
|
|
30
|
+
* 6. fallback param (back-compat hatch for callers that supply one)
|
|
31
|
+
*
|
|
32
|
+
* Exported so that pipeline.ts can snapshot the resolved name once per run for audit logging.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveCheckpointMechanismName(checkpointId: string, config: CheckpointOverrideConfig | undefined, cliOverride?: string, cliOverrideAll?: boolean, fallback?: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Resolve the mechanism for a specific checkpoint. Resolution order:
|
|
37
|
+
* 1. (cliOverrideAll && cliOverride) → cliOverride (force-all CLI flag)
|
|
38
|
+
* 2. config.pipeline.checkpointOverrides[checkpointId] (per-checkpoint config)
|
|
39
|
+
* 3. cliOverride (per-run CLI flag, after per-checkpoint config)
|
|
40
|
+
* 4. config.pipeline.checkpointMechanism (global config default)
|
|
41
|
+
* 5. mode default: 'careful' → 'disk', 'autopilot'/unset → 'noop'
|
|
42
|
+
* 6. fallback param (back-compat; e.g., "noop")
|
|
43
|
+
*
|
|
44
|
+
* Sprint 14: extended with optional cliOverride + cliOverrideAll trailing params.
|
|
45
|
+
* All existing 3-arg and 2-arg call-sites continue to work unchanged.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getCheckpointMechanismFor(checkpointId: string, config: CheckpointOverrideConfig | undefined, fallback?: string, cliOverride?: string, cliOverrideAll?: boolean): CheckpointMechanism;
|
|
48
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/checkpoints/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAkBtD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAEzF;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAQxE;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE;QACT,oFAAoF;QACpF,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,wEAAwE;QACxE,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC7C,gGAAgG;QAChG,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;QAC/B,6FAA6F;QAC7F,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;CACH;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAC5C,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,wBAAwB,GAAG,SAAS,EAC5C,WAAW,CAAC,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,OAAO,EACxB,QAAQ,SAAS,GAChB,MAAM,CAoBR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,wBAAwB,GAAG,SAAS,EAC5C,QAAQ,CAAC,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,OAAO,GACvB,mBAAmB,CASrB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { NoopCheckpointMechanism } from "./noop.js";
|
|
3
|
+
import { CliCheckpointMechanism } from "./mechanisms/cli.js";
|
|
4
|
+
import { DiskCheckpointMechanism } from "./mechanisms/disk.js";
|
|
5
|
+
import { PrCheckpointMechanism, createGhClient } from "./mechanisms/pr.js";
|
|
6
|
+
/**
|
|
7
|
+
* Module-level registry mapping mechanism names to CheckpointMechanism implementations.
|
|
8
|
+
*
|
|
9
|
+
* Pattern matches ROLE_TOOLS in src/orchestrator/tools/index.ts:
|
|
10
|
+
* a module-level Map, not a class. Noop is self-registered at module init.
|
|
11
|
+
*
|
|
12
|
+
* Sprints 8-10 will call registerCheckpointMechanism("cli" | "disk" | "pr", impl)
|
|
13
|
+
* before the pipeline starts. The coordinator never imports noop directly — it
|
|
14
|
+
* calls getCheckpointMechanism("noop") via the registry.
|
|
15
|
+
*/
|
|
16
|
+
const mechanisms = new Map();
|
|
17
|
+
export function registerCheckpointMechanism(name, impl) {
|
|
18
|
+
mechanisms.set(name, impl);
|
|
19
|
+
}
|
|
20
|
+
export function getCheckpointMechanism(name) {
|
|
21
|
+
const impl = mechanisms.get(name);
|
|
22
|
+
if (!impl) {
|
|
23
|
+
throw new Error(`Unknown checkpoint mechanism: ${name}. Registered: ${[...mechanisms.keys()].join(", ") || "(none)"}`);
|
|
24
|
+
}
|
|
25
|
+
return impl;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Pure resolution function — returns the mechanism name string without doing a registry lookup.
|
|
29
|
+
* Sprint 14: implements 6-tier resolution order:
|
|
30
|
+
* 1. cliOverrideAll && cliOverride → cliOverride (force-all CLI flag)
|
|
31
|
+
* 2. config.pipeline.checkpointOverrides[checkpointId] (most specific per-checkpoint config)
|
|
32
|
+
* 3. cliOverride (per-run CLI flag, deferred to after per-checkpoint config override)
|
|
33
|
+
* 4. config.pipeline.checkpointMechanism (global config default, if set)
|
|
34
|
+
* 5. mode default: mode='careful' → 'disk', mode='autopilot' or unset → 'noop'
|
|
35
|
+
* 6. fallback param (back-compat hatch for callers that supply one)
|
|
36
|
+
*
|
|
37
|
+
* Exported so that pipeline.ts can snapshot the resolved name once per run for audit logging.
|
|
38
|
+
*/
|
|
39
|
+
export function resolveCheckpointMechanismName(checkpointId, config, cliOverride, cliOverrideAll, fallback = "noop") {
|
|
40
|
+
// Tier 1: CLI force-all overrides everything
|
|
41
|
+
if (cliOverrideAll && cliOverride)
|
|
42
|
+
return cliOverride;
|
|
43
|
+
// Tier 2: per-checkpoint config override
|
|
44
|
+
const perCheckpoint = config?.pipeline?.checkpointOverrides?.[checkpointId];
|
|
45
|
+
if (perCheckpoint)
|
|
46
|
+
return perCheckpoint;
|
|
47
|
+
// Tier 3: per-run CLI flag (deferred — per-checkpoint config wins)
|
|
48
|
+
if (cliOverride)
|
|
49
|
+
return cliOverride;
|
|
50
|
+
// Tier 4: global config default
|
|
51
|
+
const global = config?.pipeline?.checkpointMechanism;
|
|
52
|
+
if (global)
|
|
53
|
+
return global;
|
|
54
|
+
// Tier 5: mode-based default
|
|
55
|
+
if (config?.pipeline?.mode === "careful")
|
|
56
|
+
return "disk";
|
|
57
|
+
// Tier 6: caller-supplied fallback (back-compat)
|
|
58
|
+
return fallback;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolve the mechanism for a specific checkpoint. Resolution order:
|
|
62
|
+
* 1. (cliOverrideAll && cliOverride) → cliOverride (force-all CLI flag)
|
|
63
|
+
* 2. config.pipeline.checkpointOverrides[checkpointId] (per-checkpoint config)
|
|
64
|
+
* 3. cliOverride (per-run CLI flag, after per-checkpoint config)
|
|
65
|
+
* 4. config.pipeline.checkpointMechanism (global config default)
|
|
66
|
+
* 5. mode default: 'careful' → 'disk', 'autopilot'/unset → 'noop'
|
|
67
|
+
* 6. fallback param (back-compat; e.g., "noop")
|
|
68
|
+
*
|
|
69
|
+
* Sprint 14: extended with optional cliOverride + cliOverrideAll trailing params.
|
|
70
|
+
* All existing 3-arg and 2-arg call-sites continue to work unchanged.
|
|
71
|
+
*/
|
|
72
|
+
export function getCheckpointMechanismFor(checkpointId, config, fallback, cliOverride, cliOverrideAll) {
|
|
73
|
+
const name = resolveCheckpointMechanismName(checkpointId, config, cliOverride, cliOverrideAll, fallback ?? "noop");
|
|
74
|
+
return getCheckpointMechanism(name);
|
|
75
|
+
}
|
|
76
|
+
// Self-register the noop mechanism at module init.
|
|
77
|
+
// This mirrors how src/evaluators/registry.ts:41-50 populates built-ins.
|
|
78
|
+
registerCheckpointMechanism("noop", new NoopCheckpointMechanism());
|
|
79
|
+
registerCheckpointMechanism("cli", new CliCheckpointMechanism());
|
|
80
|
+
// Disk mechanism uses process.cwd() at module-load time. If the orchestrator
|
|
81
|
+
// ever runs from a different cwd, this path may be wrong; a factory pattern
|
|
82
|
+
// (Sprint 14+) can address this. For now this matches the cli registration parity.
|
|
83
|
+
registerCheckpointMechanism("disk", new DiskCheckpointMechanism(join(process.cwd(), ".bober", "approvals")));
|
|
84
|
+
// PR mechanism — one instance per process, with disk as fallback.
|
|
85
|
+
// The disk fallback is rooted at the same .bober/approvals directory.
|
|
86
|
+
const cwd = process.cwd();
|
|
87
|
+
const diskForPrFallback = new DiskCheckpointMechanism(join(cwd, ".bober", "approvals"));
|
|
88
|
+
registerCheckpointMechanism("pr", new PrCheckpointMechanism(createGhClient(cwd), diskForPrFallback));
|
|
89
|
+
//# sourceMappingURL=registry.js.map
|