agent-bober 0.12.0 → 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 +213 -0
- package/README.md +112 -3
- 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 +89 -1
- package/agents/bober-generator.md +68 -3
- package/agents/bober-planner.md +39 -0
- 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/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 +36 -1
- 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/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 +29 -0
- package/dist/cli/commands/run.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 +50 -0
- 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 +976 -56
- 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/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 +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- 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/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/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/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/curator-agent.d.ts.map +1 -1
- package/dist/orchestrator/curator-agent.js +59 -8
- 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 +21 -8
- 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 +21 -8
- 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 +3 -1
- 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 +21 -0
- package/dist/orchestrator/pipeline.d.ts.map +1 -1
- package/dist/orchestrator/pipeline.js +156 -2
- package/dist/orchestrator/pipeline.js.map +1 -1
- package/dist/orchestrator/planner-agent.d.ts.map +1 -1
- package/dist/orchestrator/planner-agent.js +5 -4
- 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/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/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/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 +5 -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/run-kpi-gate.mjs +245 -0
- package/scripts/sync-skills.mjs +4 -1
- 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 +10 -0
- package/skills/bober.postmortem/SKILL.md +231 -0
- package/skills/bober.runbook/SKILL.md +335 -0
- package/skills/bober.using-bober/SKILL.md +133 -0
- package/skills/bober.verify/SKILL.md +143 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI blocking checkpoint mechanism.
|
|
3
|
+
*
|
|
4
|
+
* Prints the checkpoint id + artifact summary + an `a/r/e` prompt to stderr,
|
|
5
|
+
* blocks on stdin via readline until valid input is received, and:
|
|
6
|
+
* - 'a' / 'approve' → { approved: true }
|
|
7
|
+
* - 'r' / 'reject' → prompts for feedback, returns { approved: false, feedback }
|
|
8
|
+
* - 'e' / 'edit' → opens $EDITOR with artifact text, reads back on save,
|
|
9
|
+
* returns { edit: true, editDelta: { before, after } }
|
|
10
|
+
*
|
|
11
|
+
* Falls back to the noop mechanism (auto-approve) when stdin is not a TTY,
|
|
12
|
+
* and writes a warning to stderr.
|
|
13
|
+
*
|
|
14
|
+
* Sprint 8 — colocated in mechanisms/ per Sprint 7 precedent.
|
|
15
|
+
*/
|
|
16
|
+
import { createInterface } from "node:readline";
|
|
17
|
+
import { spawn } from "node:child_process";
|
|
18
|
+
import { tmpdir } from "node:os";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
import { randomBytes } from "node:crypto";
|
|
21
|
+
import { writeFile, readFile, unlink } from "node:fs/promises";
|
|
22
|
+
import { NoopCheckpointMechanism } from "../noop.js";
|
|
23
|
+
import { render } from "../renderers/registry.js";
|
|
24
|
+
/** Fallback mechanism used when stdin is not a TTY. */
|
|
25
|
+
const DEFAULT_NOOP = new NoopCheckpointMechanism();
|
|
26
|
+
/**
|
|
27
|
+
* Asks a question via readline and resolves with the user's answer.
|
|
28
|
+
*/
|
|
29
|
+
function ask(rl, question) {
|
|
30
|
+
return new Promise((resolve) => {
|
|
31
|
+
rl.question(question, (answer) => {
|
|
32
|
+
resolve(answer.trim());
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Opens $EDITOR (or nano as fallback) with the artifact text in a temp file.
|
|
38
|
+
* Returns { before, after } — a simple text delta.
|
|
39
|
+
* The temp file is always deleted, even if the editor exits non-zero.
|
|
40
|
+
*/
|
|
41
|
+
async function editArtifact(initialText, editor) {
|
|
42
|
+
const tmpPath = join(tmpdir(), `bober-checkpoint-${randomBytes(8).toString("hex")}.txt`);
|
|
43
|
+
await writeFile(tmpPath, initialText, "utf-8");
|
|
44
|
+
try {
|
|
45
|
+
await new Promise((resolve, reject) => {
|
|
46
|
+
// Support editors like "code --wait" by splitting on whitespace.
|
|
47
|
+
const [cmd, ...extraArgs] = editor.split(/\s+/);
|
|
48
|
+
const child = spawn(cmd, [...extraArgs, tmpPath], { stdio: "inherit" });
|
|
49
|
+
child.on("exit", () => {
|
|
50
|
+
// Non-zero exit is treated as "saved as-is" — do not reject.
|
|
51
|
+
// The finally block will still clean up.
|
|
52
|
+
resolve();
|
|
53
|
+
});
|
|
54
|
+
child.on("error", reject);
|
|
55
|
+
});
|
|
56
|
+
const after = await readFile(tmpPath, "utf-8");
|
|
57
|
+
return { before: initialText, after };
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
// Always delete the temp file — even on spawn error or non-zero exit.
|
|
61
|
+
await unlink(tmpPath).catch(() => {
|
|
62
|
+
// Ignore — file may not exist if spawn never created it.
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export class CliCheckpointMechanism {
|
|
67
|
+
fallback;
|
|
68
|
+
stdin;
|
|
69
|
+
editor;
|
|
70
|
+
/**
|
|
71
|
+
* @param fallback - Injected noop-like mechanism used when stdin is not a TTY.
|
|
72
|
+
* Defaults to a fresh NoopCheckpointMechanism instance.
|
|
73
|
+
* Injecting allows tests to spy on the fallback path.
|
|
74
|
+
* @param stdin - Readable stream to read user input from.
|
|
75
|
+
* Defaults to process.stdin; inject a pre-stuffed Readable
|
|
76
|
+
* for performance benchmarks / non-TTY unit tests.
|
|
77
|
+
* @param editor - Editor command override ($EDITOR env var is used when
|
|
78
|
+
* this is not supplied; falls back to "nano").
|
|
79
|
+
*/
|
|
80
|
+
constructor(fallback = DEFAULT_NOOP, stdin = process.stdin, editor) {
|
|
81
|
+
this.fallback = fallback;
|
|
82
|
+
this.stdin = stdin;
|
|
83
|
+
this.editor = editor;
|
|
84
|
+
}
|
|
85
|
+
async request(checkpoint, artifact) {
|
|
86
|
+
// TTY guard — fall back to noop in CI / non-interactive environments.
|
|
87
|
+
if (!process.stdin.isTTY) {
|
|
88
|
+
process.stderr.write(`warn: CLI checkpoint "${checkpoint}" requested but stdin is not a TTY; auto-approving via noop.\n`);
|
|
89
|
+
return this.fallback.request(checkpoint, artifact);
|
|
90
|
+
}
|
|
91
|
+
// Render the artifact summary to stderr using the renderer registry.
|
|
92
|
+
const summary = `[Checkpoint: ${checkpoint}] Artifact ready.\n${render(artifact)}`;
|
|
93
|
+
process.stderr.write(`${summary}\n`);
|
|
94
|
+
process.stderr.write(` Approve (a), Reject (r), Edit (e)? `);
|
|
95
|
+
const rl = createInterface({ input: this.stdin, crlfDelay: Infinity });
|
|
96
|
+
try {
|
|
97
|
+
// Read action — loop until valid input.
|
|
98
|
+
let action = "";
|
|
99
|
+
while (true) {
|
|
100
|
+
action = await ask(rl, "");
|
|
101
|
+
const normalized = action.toLowerCase();
|
|
102
|
+
if (normalized === "a" ||
|
|
103
|
+
normalized === "approve" ||
|
|
104
|
+
normalized === "r" ||
|
|
105
|
+
normalized === "reject" ||
|
|
106
|
+
normalized === "e" ||
|
|
107
|
+
normalized === "edit") {
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
process.stderr.write(` Invalid input "${action}". Enter a (approve), r (reject), or e (edit): `);
|
|
111
|
+
}
|
|
112
|
+
const normalized = action.toLowerCase();
|
|
113
|
+
// Approve branch.
|
|
114
|
+
if (normalized === "a" || normalized === "approve") {
|
|
115
|
+
return { approved: true };
|
|
116
|
+
}
|
|
117
|
+
// Reject branch — prompt for feedback.
|
|
118
|
+
if (normalized === "r" || normalized === "reject") {
|
|
119
|
+
process.stderr.write(` Why are you rejecting? Feedback (one line): `);
|
|
120
|
+
const feedback = await ask(rl, "");
|
|
121
|
+
return { approved: false, feedback };
|
|
122
|
+
}
|
|
123
|
+
// Edit branch — open $EDITOR with the artifact text.
|
|
124
|
+
const resolvedEditor = this.editor ?? process.env["EDITOR"] ?? "nano";
|
|
125
|
+
// Derive initial text from artifact.
|
|
126
|
+
const art = artifact;
|
|
127
|
+
let initialText = "";
|
|
128
|
+
if (art && typeof art === "object") {
|
|
129
|
+
if (typeof art["text"] === "string") {
|
|
130
|
+
initialText = art["text"];
|
|
131
|
+
}
|
|
132
|
+
else if (typeof art["content"] === "string") {
|
|
133
|
+
initialText = art["content"];
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
initialText = JSON.stringify(art, null, 2);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else if (typeof artifact === "string") {
|
|
140
|
+
initialText = artifact;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
initialText = JSON.stringify(artifact, null, 2);
|
|
144
|
+
}
|
|
145
|
+
const editDelta = await editArtifact(initialText, resolvedEditor);
|
|
146
|
+
return { edit: true, editDelta };
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
rl.close();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../../src/orchestrator/checkpoints/mechanisms/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAQ/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,uDAAuD;AACvD,MAAM,YAAY,GAAG,IAAI,uBAAuB,EAAE,CAAC;AAEnD;;GAEG;AACH,SAAS,GAAG,CACV,EAAsC,EACtC,QAAgB;IAEhB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;YAC/B,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,YAAY,CACzB,WAAmB,EACnB,MAAc;IAEd,MAAM,OAAO,GAAG,IAAI,CAClB,MAA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CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YAClD,CAAC;YAED,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;YAClE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACnC,CAAC;gBAAS,CAAC;YACT,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disk-marker blocking checkpoint mechanism.
|
|
3
|
+
*
|
|
4
|
+
* Writes .bober/approvals/<checkpointId>.pending.json containing a SUMMARY of
|
|
5
|
+
* the artifact (NOT the full artifact — perf budget 100ms), polls the directory
|
|
6
|
+
* until <id>.approved.json or <id>.rejected.json appears, deletes the pending
|
|
7
|
+
* file, and returns the matching CheckpointOutcome. Times out at a configurable
|
|
8
|
+
* cap (default 24h, max 7d) writing a TIMEOUT marker.
|
|
9
|
+
*
|
|
10
|
+
* Sprint 9 — colocated in mechanisms/ per Sprint 7+8 precedent.
|
|
11
|
+
*/
|
|
12
|
+
import type { CheckpointArtifact, CheckpointId, CheckpointMechanism, CheckpointOutcome } from "../types.js";
|
|
13
|
+
export interface DiskMechanismOptions {
|
|
14
|
+
/** Default 2000ms; configurable via pipeline.approvalPollMs */
|
|
15
|
+
pollMs?: number;
|
|
16
|
+
/** Default 24h; capped at 7d via MAX_TIMEOUT_MS */
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
/** Optional runId stamped into the pending file */
|
|
19
|
+
runId?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare class DiskCheckpointMechanism implements CheckpointMechanism {
|
|
22
|
+
private readonly approvalsDir;
|
|
23
|
+
private readonly options;
|
|
24
|
+
private readonly now;
|
|
25
|
+
/**
|
|
26
|
+
* @param approvalsDir - Absolute path to .bober/approvals directory.
|
|
27
|
+
* @param options - Polling + timeout + runId options.
|
|
28
|
+
* @param now - Clock injection for deterministic timeout tests.
|
|
29
|
+
* Defaults to Date.now.
|
|
30
|
+
*/
|
|
31
|
+
constructor(approvalsDir: string, options?: DiskMechanismOptions, now?: () => number);
|
|
32
|
+
request(checkpoint: CheckpointId, artifact: CheckpointArtifact): Promise<CheckpointOutcome>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=disk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disk.d.ts","sourceRoot":"","sources":["../../../../src/orchestrator/checkpoints/mechanisms/disk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAOrB,MAAM,WAAW,oBAAoB;IACnC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAeD,qBAAa,uBAAwB,YAAW,mBAAmB;IAQ/D,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAExB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAVtB;;;;;OAKG;gBAEgB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,oBAAyB,EAElC,GAAG,GAAE,MAAM,MAAyB;IAGjD,OAAO,CACX,UAAU,EAAE,YAAY,EACxB,QAAQ,EAAE,kBAAkB,GAC3B,OAAO,CAAC,iBAAiB,CAAC;CA+G9B"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disk-marker blocking checkpoint mechanism.
|
|
3
|
+
*
|
|
4
|
+
* Writes .bober/approvals/<checkpointId>.pending.json containing a SUMMARY of
|
|
5
|
+
* the artifact (NOT the full artifact — perf budget 100ms), polls the directory
|
|
6
|
+
* until <id>.approved.json or <id>.rejected.json appears, deletes the pending
|
|
7
|
+
* file, and returns the matching CheckpointOutcome. Times out at a configurable
|
|
8
|
+
* cap (default 24h, max 7d) writing a TIMEOUT marker.
|
|
9
|
+
*
|
|
10
|
+
* Sprint 9 — colocated in mechanisms/ per Sprint 7+8 precedent.
|
|
11
|
+
*/
|
|
12
|
+
import { readFile, writeFile, readdir, unlink, mkdir } from "node:fs/promises";
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
import { render } from "../renderers/registry.js";
|
|
15
|
+
const DEFAULT_POLL_MS = 2000;
|
|
16
|
+
const DEFAULT_TIMEOUT_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
17
|
+
const MAX_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1000; // 7 days cap
|
|
18
|
+
/**
|
|
19
|
+
* Extract a minimal artifact stub for the pending file.
|
|
20
|
+
* Only picks the `type` field — the full rendered summary goes into `prompt`.
|
|
21
|
+
* Never stringifies the whole artifact (perf budget / large-artifact safety).
|
|
22
|
+
*/
|
|
23
|
+
function artifactStub(artifact) {
|
|
24
|
+
const a = artifact;
|
|
25
|
+
if (!a || typeof a !== "object")
|
|
26
|
+
return {};
|
|
27
|
+
const stub = {};
|
|
28
|
+
if (typeof a["type"] === "string")
|
|
29
|
+
stub.type = a["type"];
|
|
30
|
+
return stub;
|
|
31
|
+
}
|
|
32
|
+
export class DiskCheckpointMechanism {
|
|
33
|
+
approvalsDir;
|
|
34
|
+
options;
|
|
35
|
+
now;
|
|
36
|
+
/**
|
|
37
|
+
* @param approvalsDir - Absolute path to .bober/approvals directory.
|
|
38
|
+
* @param options - Polling + timeout + runId options.
|
|
39
|
+
* @param now - Clock injection for deterministic timeout tests.
|
|
40
|
+
* Defaults to Date.now.
|
|
41
|
+
*/
|
|
42
|
+
constructor(approvalsDir, options = {},
|
|
43
|
+
// Optional clock injection for deterministic timeout tests
|
|
44
|
+
now = () => Date.now()) {
|
|
45
|
+
this.approvalsDir = approvalsDir;
|
|
46
|
+
this.options = options;
|
|
47
|
+
this.now = now;
|
|
48
|
+
}
|
|
49
|
+
async request(checkpoint, artifact) {
|
|
50
|
+
const pollMs = this.options.pollMs ?? DEFAULT_POLL_MS;
|
|
51
|
+
const timeoutMs = Math.min(this.options.timeoutMs ?? DEFAULT_TIMEOUT_MS, MAX_TIMEOUT_MS);
|
|
52
|
+
await mkdir(this.approvalsDir, { recursive: true });
|
|
53
|
+
const pendingPath = join(this.approvalsDir, `${checkpoint}.pending.json`);
|
|
54
|
+
const approvedPath = join(this.approvalsDir, `${checkpoint}.approved.json`);
|
|
55
|
+
const rejectedPath = join(this.approvalsDir, `${checkpoint}.rejected.json`);
|
|
56
|
+
const timeoutPath = join(this.approvalsDir, `${checkpoint}.timeout.json`);
|
|
57
|
+
// Clean up stale markers from a prior run (race-condition safety).
|
|
58
|
+
await unlink(approvedPath).catch(() => { });
|
|
59
|
+
await unlink(rejectedPath).catch(() => { });
|
|
60
|
+
await unlink(timeoutPath).catch(() => { });
|
|
61
|
+
const requestedAt = new Date(this.now()).toISOString();
|
|
62
|
+
const timeoutAt = new Date(this.now() + timeoutMs).toISOString();
|
|
63
|
+
// 1) Write the pending marker (SUMMARY only — perf budget 100ms).
|
|
64
|
+
// `artifact` holds only type metadata; full rendering goes into `prompt`.
|
|
65
|
+
const pending = {
|
|
66
|
+
checkpointId: checkpoint,
|
|
67
|
+
runId: this.options.runId,
|
|
68
|
+
artifact: artifactStub(artifact),
|
|
69
|
+
prompt: render(artifact),
|
|
70
|
+
requestedAt,
|
|
71
|
+
timeoutAt,
|
|
72
|
+
};
|
|
73
|
+
await writeFile(pendingPath, JSON.stringify(pending, null, 2) + "\n", "utf-8");
|
|
74
|
+
// 2) Poll until resolution OR timeout.
|
|
75
|
+
const startedAt = this.now();
|
|
76
|
+
let pollHandle;
|
|
77
|
+
try {
|
|
78
|
+
return await new Promise((resolve, reject) => {
|
|
79
|
+
const tick = async () => {
|
|
80
|
+
try {
|
|
81
|
+
// Enumerate the directory once per poll — atomic-ish check.
|
|
82
|
+
const entries = new Set(await readdir(this.approvalsDir).catch(() => []));
|
|
83
|
+
if (entries.has(`${checkpoint}.approved.json`)) {
|
|
84
|
+
const raw = await readFile(approvedPath, "utf-8");
|
|
85
|
+
const parsed = JSON.parse(raw);
|
|
86
|
+
// Cleanup — delete pending + approved markers.
|
|
87
|
+
await unlink(pendingPath).catch(() => { });
|
|
88
|
+
await unlink(approvedPath).catch(() => { });
|
|
89
|
+
if (parsed.editDelta !== undefined) {
|
|
90
|
+
resolve({ approved: true, editDelta: parsed.editDelta });
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
resolve({ approved: true });
|
|
94
|
+
}
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (entries.has(`${checkpoint}.rejected.json`)) {
|
|
98
|
+
const raw = await readFile(rejectedPath, "utf-8");
|
|
99
|
+
const parsed = JSON.parse(raw);
|
|
100
|
+
// Cleanup — delete pending + rejected markers.
|
|
101
|
+
await unlink(pendingPath).catch(() => { });
|
|
102
|
+
await unlink(rejectedPath).catch(() => { });
|
|
103
|
+
resolve({ approved: false, feedback: parsed.feedback });
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
// Check timeout.
|
|
107
|
+
if (this.now() - startedAt >= timeoutMs) {
|
|
108
|
+
await writeFile(timeoutPath, JSON.stringify({
|
|
109
|
+
checkpointId: checkpoint,
|
|
110
|
+
timedOutAt: new Date(this.now()).toISOString(),
|
|
111
|
+
}) + "\n", "utf-8");
|
|
112
|
+
await unlink(pendingPath).catch(() => { });
|
|
113
|
+
resolve({ approved: false, feedback: "TIMEOUT" });
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
// Schedule next tick.
|
|
117
|
+
pollHandle = setTimeout(() => {
|
|
118
|
+
tick().catch(reject);
|
|
119
|
+
}, pollMs);
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
reject(err);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
// Start the first tick.
|
|
126
|
+
pollHandle = setTimeout(() => {
|
|
127
|
+
tick().catch(reject);
|
|
128
|
+
}, pollMs);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
// Cleanup — never leak timers.
|
|
133
|
+
if (pollHandle !== undefined) {
|
|
134
|
+
clearTimeout(pollHandle);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=disk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disk.js","sourceRoot":"","sources":["../../../../src/orchestrator/checkpoints/mechanisms/disk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOjC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;AAC3D,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAW7D;;;;GAIG;AACH,SAAS,YAAY,CAAC,QAA4B;IAChD,MAAM,CAAC,GAAG,QAAsD,CAAC;IACjE,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IAC3C,MAAM,IAAI,GAAsB,EAAE,CAAC;IACnC,IAAI,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,QAAQ;QAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IACzD,O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YAAY,EAAE,UAAU;gCACxB,UAAU,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,WAAW,EAAE;6BAC/C,CAAC,GAAG,IAAI,EACT,OAAO,CACR,CAAC;4BACF,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;4BAC1C,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;4BAClD,OAAO;wBACT,CAAC;wBAED,sBAAsB;wBACtB,UAAU,GAAG,UAAU,CAAC,GAAG,EAAE;4BAC3B,IAAI,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;wBACvB,CAAC,EAAE,MAAM,CAAC,CAAC;oBACb,CAAC;oBAAC,OAAO,GAAG,EAAE,CAAC;wBACb,MAAM,CAAC,GAAG,CAAC,CAAC;oBACd,CAAC;gBACH,CAAC,CAAC;gBAEF,wBAAwB;gBACxB,UAAU,GAAG,UAAU,CAAC,GAAG,EAAE;oBAC3B,IAAI,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBACvB,CAAC,EAAE,MAAM,CAAC,CAAC;YACb,CAAC,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,+BAA+B;YAC/B,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC7B,YAAY,CAAC,UAAU,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,141 @@
|
|
|
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 type { CheckpointArtifact, CheckpointId, CheckpointMechanism, CheckpointOutcome } from "../types.js";
|
|
14
|
+
/** Single mockable seam for all `gh` CLI calls. */
|
|
15
|
+
export interface GhClient {
|
|
16
|
+
version(): Promise<{
|
|
17
|
+
ok: boolean;
|
|
18
|
+
stdout: string;
|
|
19
|
+
}>;
|
|
20
|
+
authStatus(): Promise<{
|
|
21
|
+
ok: boolean;
|
|
22
|
+
stderr: string;
|
|
23
|
+
}>;
|
|
24
|
+
repoView(): Promise<{
|
|
25
|
+
url: string;
|
|
26
|
+
owner: string;
|
|
27
|
+
name: string;
|
|
28
|
+
} | null>;
|
|
29
|
+
prList(headRef: string): Promise<Array<{
|
|
30
|
+
number: number;
|
|
31
|
+
state: string;
|
|
32
|
+
}>>;
|
|
33
|
+
prCreate(opts: {
|
|
34
|
+
title: string;
|
|
35
|
+
body: string;
|
|
36
|
+
draft: boolean;
|
|
37
|
+
}): Promise<{
|
|
38
|
+
number: number;
|
|
39
|
+
url: string;
|
|
40
|
+
}>;
|
|
41
|
+
prEdit(prNumber: number, body: string): Promise<void>;
|
|
42
|
+
prReady(prNumber: number): Promise<void>;
|
|
43
|
+
prComment(prNumber: number, body: string): Promise<void>;
|
|
44
|
+
prView(prNumber: number): Promise<{
|
|
45
|
+
state: string;
|
|
46
|
+
merged: boolean;
|
|
47
|
+
labels: Array<{
|
|
48
|
+
name: string;
|
|
49
|
+
}>;
|
|
50
|
+
comments: Array<{
|
|
51
|
+
id: number;
|
|
52
|
+
body: string;
|
|
53
|
+
createdAt: string;
|
|
54
|
+
}>;
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
57
|
+
/** Default GhClient implementation — wraps execa. */
|
|
58
|
+
export declare function createGhClient(cwd: string): GhClient;
|
|
59
|
+
export interface PrMechanismOptions {
|
|
60
|
+
/** Default 30_000ms; floor 10_000ms (GitHub rate limits). Configurable via pipeline.prPollMs. */
|
|
61
|
+
pollMs?: number;
|
|
62
|
+
/** Default 7d; matches disk cap. */
|
|
63
|
+
timeoutMs?: number;
|
|
64
|
+
/** Required — one PR per run, reused across checkpoints. */
|
|
65
|
+
runId?: string;
|
|
66
|
+
/** Used in the PR title — e.g., "bober(run-XXX): <featureName>". */
|
|
67
|
+
featureName?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Override the current branch head ref (normally auto-detected via git).
|
|
70
|
+
* Inject this in tests to avoid calling the real git binary.
|
|
71
|
+
*/
|
|
72
|
+
headRef?: string;
|
|
73
|
+
}
|
|
74
|
+
/** Parsed resolution signal from PR state + comments + labels. */
|
|
75
|
+
type PrSignal = {
|
|
76
|
+
type: "approve";
|
|
77
|
+
} | {
|
|
78
|
+
type: "reject";
|
|
79
|
+
feedback: string;
|
|
80
|
+
} | {
|
|
81
|
+
type: "edit";
|
|
82
|
+
editDelta: {
|
|
83
|
+
before: string;
|
|
84
|
+
after: string;
|
|
85
|
+
};
|
|
86
|
+
} | {
|
|
87
|
+
type: "merge";
|
|
88
|
+
} | null;
|
|
89
|
+
export declare class PrCheckpointMechanism implements CheckpointMechanism {
|
|
90
|
+
private readonly gh;
|
|
91
|
+
private readonly fallback;
|
|
92
|
+
private readonly options;
|
|
93
|
+
private readonly now;
|
|
94
|
+
private readonly cwd;
|
|
95
|
+
/** Cached PR number for this run — set on first request(), reused thereafter. */
|
|
96
|
+
private runPrNumber;
|
|
97
|
+
/** Per-checkpoint states — updated as checkpoints are added and resolved. */
|
|
98
|
+
private checkpointStates;
|
|
99
|
+
/** Number of in-flight request() calls. Used to defer prReady until all requests finish. */
|
|
100
|
+
private inFlightCount;
|
|
101
|
+
/** Pending prReady timer handle — cancelled if a new request() starts before it fires. */
|
|
102
|
+
private prReadyTimer;
|
|
103
|
+
/**
|
|
104
|
+
* @param gh - Mockable GhClient. Tests pass a fake; prod uses createGhClient(cwd).
|
|
105
|
+
* @param fallback - Mechanism used when gh is unavailable. Defaults to DiskCheckpointMechanism
|
|
106
|
+
* rooted at <cwd>/.bober/approvals. MUST be disk (not cli/noop) per evaluator note.
|
|
107
|
+
* @param options - poll/timeout/runId/featureName.
|
|
108
|
+
* @param now - Clock injection for deterministic timeout tests (matches disk.ts:69).
|
|
109
|
+
* @param cwd - Working directory, defaults to process.cwd().
|
|
110
|
+
*/
|
|
111
|
+
constructor(gh: GhClient, fallback?: CheckpointMechanism, options?: PrMechanismOptions, now?: () => number, cwd?: string);
|
|
112
|
+
request(checkpoint: CheckpointId, artifact: CheckpointArtifact): Promise<CheckpointOutcome>;
|
|
113
|
+
/** Check if gh is available and the repo has a GitHub remote. */
|
|
114
|
+
private checkAvailability;
|
|
115
|
+
/** Find existing run PR or create a new one. Caches the PR number for the run. */
|
|
116
|
+
private ensureRunPr;
|
|
117
|
+
/** Render the PR body with a per-checkpoint checkbox list. */
|
|
118
|
+
private renderPrBody;
|
|
119
|
+
/** Render a checkpoint comment to post on the PR. */
|
|
120
|
+
private renderCheckpointComment;
|
|
121
|
+
/** Poll the PR until it resolves (merge / approve / reject / edit) or times out. */
|
|
122
|
+
private pollPrUntilResolved;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Parse PR state + comments + labels to determine the resolution signal.
|
|
126
|
+
* Strict parsing — rejects typos like 'approveeee' or 'aproove'.
|
|
127
|
+
*/
|
|
128
|
+
export declare function parseSignals(view: {
|
|
129
|
+
state: string;
|
|
130
|
+
merged: boolean;
|
|
131
|
+
labels: Array<{
|
|
132
|
+
name: string;
|
|
133
|
+
}>;
|
|
134
|
+
comments: Array<{
|
|
135
|
+
id: number;
|
|
136
|
+
body: string;
|
|
137
|
+
createdAt: string;
|
|
138
|
+
}>;
|
|
139
|
+
}, checkpoint: CheckpointId, artifact: CheckpointArtifact): PrSignal;
|
|
140
|
+
export {};
|
|
141
|
+
//# sourceMappingURL=pr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr.d.ts","sourceRoot":"","sources":["../../../../src/orchestrator/checkpoints/mechanisms/pr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AASrB,mDAAmD;AACnD,MAAM,WAAW,QAAQ;IACvB,OAAO,IAAI,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,UAAU,IAAI,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvD,QAAQ,IAAI,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACzE,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IAC3E,QAAQ,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1G,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,OAAO,CAAC,QAAQ,EAA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