agentic-orchestrator 0.1.6 → 0.1.8
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/.prettierignore +10 -0
- package/.prettierrc.json +24 -0
- package/CLAUDE.md +3 -2
- package/README.md +71 -48
- package/agentic/orchestrator/defaults/policy.defaults.yaml +1 -1
- package/agentic/orchestrator/prompts/planner.system.md +1 -0
- package/agentic/orchestrator/schemas/agents.schema.json +5 -22
- package/agentic/orchestrator/schemas/gates.schema.json +4 -19
- package/agentic/orchestrator/schemas/index.schema.json +3 -14
- package/agentic/orchestrator/schemas/multi-project.schema.json +2 -8
- package/agentic/orchestrator/schemas/plan.schema.json +6 -26
- package/agentic/orchestrator/schemas/policy.schema.json +19 -81
- package/agentic/orchestrator/schemas/policy.user.schema.json +1 -5
- package/agentic/orchestrator/schemas/qa_test_index.schema.json +5 -29
- package/agentic/orchestrator/schemas/state.schema.json +11 -61
- package/agentic/orchestrator/tools/catalog.json +33 -164
- package/agentic/orchestrator/tools/schemas/input/evidence.latest.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/feature.delete.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/feature.get_context.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/feature.init.input.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/input/feature.log_append.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/feature.ready_to_merge.input.schema.json +1 -6
- package/agentic/orchestrator/tools/schemas/input/feature.state_get.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/feature.state_patch.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/gates.run.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/locks.acquire.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/locks.release.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/performance.record_outcome.input.schema.json +10 -1
- package/agentic/orchestrator/tools/schemas/input/plan.get.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/plan.submit.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/plan.update.input.schema.json +1 -6
- package/agentic/orchestrator/tools/schemas/input/qa.test_index_get.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/qa.test_index_update.input.schema.json +1 -6
- package/agentic/orchestrator/tools/schemas/input/repo.apply_patch.input.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/input/repo.diff.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/repo.diff_bundle.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/repo.ensure_worktree.input.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/input/repo.read_file.input.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/input/repo.search.input.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/input/repo.status.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/input/report.feature_summary.input.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/output/collisions.scan.output.schema.json +1 -3
- package/agentic/orchestrator/tools/schemas/output/evidence.latest.output.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/output/feature.delete.output.schema.json +4 -20
- package/agentic/orchestrator/tools/schemas/output/feature.discover_specs.output.schema.json +2 -7
- package/agentic/orchestrator/tools/schemas/output/feature.get_context.output.schema.json +1 -8
- package/agentic/orchestrator/tools/schemas/output/feature.init.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/feature.log_append.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/feature.ready_to_merge.output.schema.json +1 -6
- package/agentic/orchestrator/tools/schemas/output/feature.state_get.output.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/output/feature.state_patch.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/gates.list.output.schema.json +2 -7
- package/agentic/orchestrator/tools/schemas/output/gates.run.output.schema.json +1 -8
- package/agentic/orchestrator/tools/schemas/output/locks.acquire.output.schema.json +1 -7
- package/agentic/orchestrator/tools/schemas/output/locks.release.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/performance.get_analytics.output.schema.json +22 -2
- package/agentic/orchestrator/tools/schemas/output/plan.get.output.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/output/plan.submit.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/plan.update.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/qa.test_index_get.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/qa.test_index_update.output.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/output/repo.apply_patch.output.schema.json +1 -6
- package/agentic/orchestrator/tools/schemas/output/repo.diff.output.schema.json +1 -4
- package/agentic/orchestrator/tools/schemas/output/repo.diff_bundle.output.schema.json +1 -7
- package/agentic/orchestrator/tools/schemas/output/repo.ensure_worktree.output.schema.json +1 -6
- package/agentic/orchestrator/tools/schemas/output/repo.read_file.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/repo.search.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/repo.status.output.schema.json +1 -5
- package/agentic/orchestrator/tools/schemas/output/report.dashboard.output.schema.json +1 -4
- package/apps/control-plane/scripts/validate-architecture-rules.mjs +16 -5
- package/apps/control-plane/scripts/validate-docker-mcp-contract.mjs +30 -8
- package/apps/control-plane/scripts/validate-mcp-contracts.ts +13 -7
- package/apps/control-plane/src/application/adapters/adapter-registry.ts +35 -15
- package/apps/control-plane/src/application/multi-project-loader.ts +27 -10
- package/apps/control-plane/src/application/services/activity-monitor-service.ts +26 -14
- package/apps/control-plane/src/application/services/collision-queue-service.ts +31 -17
- package/apps/control-plane/src/application/services/cost-tracking-service.ts +23 -16
- package/apps/control-plane/src/application/services/dependency-scheduler-service.ts +12 -4
- package/apps/control-plane/src/application/services/feature-deletion-service.ts +94 -58
- package/apps/control-plane/src/application/services/feature-lifecycle-service.ts +19 -13
- package/apps/control-plane/src/application/services/feature-state-service.ts +29 -19
- package/apps/control-plane/src/application/services/gate-interpolation-service.ts +7 -2
- package/apps/control-plane/src/application/services/gate-service.ts +64 -41
- package/apps/control-plane/src/application/services/instance-isolation-service.ts +1 -1
- package/apps/control-plane/src/application/services/issue-tracker-service.ts +49 -38
- package/apps/control-plane/src/application/services/lock-service.ts +75 -49
- package/apps/control-plane/src/application/services/merge-service.ts +91 -50
- package/apps/control-plane/src/application/services/notifier-service.ts +42 -20
- package/apps/control-plane/src/application/services/patch-service.ts +73 -44
- package/apps/control-plane/src/application/services/performance-analytics-service.ts +8 -6
- package/apps/control-plane/src/application/services/plan-service.ts +148 -89
- package/apps/control-plane/src/application/services/policy-loader-service.ts +10 -4
- package/apps/control-plane/src/application/services/pr-monitor-service.ts +33 -14
- package/apps/control-plane/src/application/services/qa-index-service.ts +20 -16
- package/apps/control-plane/src/application/services/reactions-service.ts +30 -15
- package/apps/control-plane/src/application/services/reporting-service.ts +16 -12
- package/apps/control-plane/src/application/services/run-lease-service.ts +138 -81
- package/apps/control-plane/src/application/tools/tool-metadata.ts +5 -5
- package/apps/control-plane/src/application/tools/tool-router.ts +6 -3
- package/apps/control-plane/src/cli/aop.ts +2 -2
- package/apps/control-plane/src/cli/attach-command-handler.ts +9 -9
- package/apps/control-plane/src/cli/cleanup-command-handler.ts +16 -11
- package/apps/control-plane/src/cli/cli-argument-parser.ts +6 -3
- package/apps/control-plane/src/cli/dashboard-command-handler.ts +28 -8
- package/apps/control-plane/src/cli/delete-command-handler.ts +7 -7
- package/apps/control-plane/src/cli/env-file.ts +115 -0
- package/apps/control-plane/src/cli/help-command-handler.ts +61 -32
- package/apps/control-plane/src/cli/init-command-handler.ts +182 -56
- package/apps/control-plane/src/cli/io.ts +7 -3
- package/apps/control-plane/src/cli/resume-command-handler.ts +21 -13
- package/apps/control-plane/src/cli/retry-command-handler.ts +12 -11
- package/apps/control-plane/src/cli/run-command-handler.ts +12 -8
- package/apps/control-plane/src/cli/send-command-handler.ts +6 -6
- package/apps/control-plane/src/cli/spec-ingestion-service.ts +14 -8
- package/apps/control-plane/src/cli/spec-input-resolver.ts +6 -1
- package/apps/control-plane/src/cli/spec-utils.ts +2 -2
- package/apps/control-plane/src/cli/status-command-handler.ts +13 -12
- package/apps/control-plane/src/cli/tooling.ts +3 -3
- package/apps/control-plane/src/cli/types.ts +1 -1
- package/apps/control-plane/src/core/collisions.ts +27 -10
- package/apps/control-plane/src/core/constants.ts +13 -7
- package/apps/control-plane/src/core/error-codes.ts +1 -1
- package/apps/control-plane/src/core/fs.ts +11 -5
- package/apps/control-plane/src/core/gates.ts +53 -27
- package/apps/control-plane/src/core/git.ts +18 -6
- package/apps/control-plane/src/core/kernel.ts +513 -227
- package/apps/control-plane/src/core/patch.ts +7 -3
- package/apps/control-plane/src/core/path-layout.ts +5 -1
- package/apps/control-plane/src/core/path-rules.ts +19 -5
- package/apps/control-plane/src/core/qa-index.ts +26 -12
- package/apps/control-plane/src/core/response.ts +9 -6
- package/apps/control-plane/src/core/schemas.ts +29 -10
- package/apps/control-plane/src/core/tool-caller.ts +1 -1
- package/apps/control-plane/src/core/workspace-hooks.ts +5 -5
- package/apps/control-plane/src/index.ts +3 -9
- package/apps/control-plane/src/interfaces/cli/bootstrap.ts +79 -35
- package/apps/control-plane/src/mcp/kernel-tool-executor.ts +7 -3
- package/apps/control-plane/src/mcp/mcp-server-adapter.ts +12 -10
- package/apps/control-plane/src/mcp/operation-ledger.ts +18 -8
- package/apps/control-plane/src/mcp/protocol-contract.ts +2 -2
- package/apps/control-plane/src/mcp/runtime-factory.ts +15 -6
- package/apps/control-plane/src/mcp/token-auth-verifier.ts +3 -2
- package/apps/control-plane/src/mcp/token-claims-validator.ts +11 -7
- package/apps/control-plane/src/mcp/tool-authorizer.ts +1 -3
- package/apps/control-plane/src/mcp/tool-client.ts +17 -5
- package/apps/control-plane/src/mcp/tool-contract-validator.ts +17 -8
- package/apps/control-plane/src/mcp/tool-registry-loader.ts +7 -3
- package/apps/control-plane/src/mcp/tool-runtime.ts +66 -39
- package/apps/control-plane/src/mcp/tools-markdown-generator.ts +6 -1
- package/apps/control-plane/src/providers/providers.ts +137 -54
- package/apps/control-plane/src/supervisor/build-wave-executor.ts +44 -25
- package/apps/control-plane/src/supervisor/planning-wave-executor.ts +46 -33
- package/apps/control-plane/src/supervisor/prompt-bundle-loader.ts +1 -1
- package/apps/control-plane/src/supervisor/qa-wave-executor.ts +38 -23
- package/apps/control-plane/src/supervisor/run-coordinator.ts +71 -36
- package/apps/control-plane/src/supervisor/runtime.ts +59 -35
- package/apps/control-plane/src/supervisor/session-orchestrator.ts +48 -31
- package/apps/control-plane/src/supervisor/types.ts +22 -7
- package/apps/control-plane/src/supervisor/worker-decision-loop.ts +30 -20
- package/apps/control-plane/test/activity-monitor.spec.ts +54 -30
- package/apps/control-plane/test/adapter-registry.spec.ts +5 -5
- package/apps/control-plane/test/aop.spec.ts +4 -4
- package/apps/control-plane/test/batch-operations.spec.ts +20 -18
- package/apps/control-plane/test/bootstrap-attach.spec.ts +52 -19
- package/apps/control-plane/test/bootstrap-edge-cases.spec.ts +58 -27
- package/apps/control-plane/test/bootstrap.spec.ts +72 -40
- package/apps/control-plane/test/cleanup-command.spec.ts +86 -32
- package/apps/control-plane/test/cli-helpers.spec.ts +119 -66
- package/apps/control-plane/test/cli.spec.ts +1 -1
- package/apps/control-plane/test/cli.unit.spec.ts +226 -167
- package/apps/control-plane/test/collision-queue.spec.ts +49 -40
- package/apps/control-plane/test/collisions.spec.ts +30 -30
- package/apps/control-plane/test/core-utils.spec.ts +29 -15
- package/apps/control-plane/test/cost-tracking.spec.ts +38 -22
- package/apps/control-plane/test/dashboard-api.integration.spec.ts +68 -36
- package/apps/control-plane/test/dashboard-client.spec.ts +18 -12
- package/apps/control-plane/test/dashboard-command.spec.ts +11 -7
- package/apps/control-plane/test/delete-command-handler.spec.ts +49 -41
- package/apps/control-plane/test/dependency-scheduler.spec.ts +47 -20
- package/apps/control-plane/test/epoch-tracking.spec.ts +9 -9
- package/apps/control-plane/test/feature-deletion-service.spec.ts +60 -52
- package/apps/control-plane/test/feature-lifecycle.spec.ts +36 -17
- package/apps/control-plane/test/gates.spec.ts +101 -81
- package/apps/control-plane/test/git-spawn-error.spec.ts +1 -1
- package/apps/control-plane/test/helpers.ts +10 -6
- package/apps/control-plane/test/incremental-gates.spec.ts +59 -20
- package/apps/control-plane/test/init-wizard.spec.ts +328 -68
- package/apps/control-plane/test/instance-isolation.spec.ts +43 -10
- package/apps/control-plane/test/issue-tracker.spec.ts +368 -128
- package/apps/control-plane/test/kernel-collision-replay.spec.ts +50 -29
- package/apps/control-plane/test/kernel.branches.spec.ts +64 -40
- package/apps/control-plane/test/kernel.coverage.spec.ts +85 -49
- package/apps/control-plane/test/kernel.coverage2.spec.ts +109 -65
- package/apps/control-plane/test/kernel.spec.ts +134 -51
- package/apps/control-plane/test/lock-service.spec.ts +92 -68
- package/apps/control-plane/test/mcp-helpers.spec.ts +53 -39
- package/apps/control-plane/test/mcp.spec.ts +231 -115
- package/apps/control-plane/test/merge-service.spec.ts +142 -94
- package/apps/control-plane/test/multi-project.spec.ts +28 -22
- package/apps/control-plane/test/notifier-service.spec.ts +136 -92
- package/apps/control-plane/test/parallel-gates.spec.ts +51 -35
- package/apps/control-plane/test/patch-service.spec.ts +128 -48
- package/apps/control-plane/test/performance-analytics.spec.ts +99 -63
- package/apps/control-plane/test/plan-service.spec.ts +50 -39
- package/apps/control-plane/test/planning-wave-executor.spec.ts +95 -71
- package/apps/control-plane/test/policy-loader-service.spec.ts +41 -19
- package/apps/control-plane/test/pr-monitor.spec.ts +113 -64
- package/apps/control-plane/test/providers.spec.ts +208 -104
- package/apps/control-plane/test/qa-index-service.spec.ts +31 -33
- package/apps/control-plane/test/qa-index.spec.ts +58 -61
- package/apps/control-plane/test/reactions.spec.ts +88 -45
- package/apps/control-plane/test/response.spec.ts +5 -5
- package/apps/control-plane/test/resume-command.spec.ts +121 -80
- package/apps/control-plane/test/run-coordinator.spec.ts +205 -136
- package/apps/control-plane/test/schema-date-time.spec.ts +49 -41
- package/apps/control-plane/test/service-retry-paths.spec.ts +77 -57
- package/apps/control-plane/test/services.spec.ts +147 -129
- package/apps/control-plane/test/session-management.spec.ts +136 -74
- package/apps/control-plane/test/spec-ingestion.spec.ts +23 -21
- package/apps/control-plane/test/spec-input-resolver.spec.ts +11 -10
- package/apps/control-plane/test/supervisor-collaborators.spec.ts +168 -121
- package/apps/control-plane/test/supervisor.calltool.spec.ts +21 -18
- package/apps/control-plane/test/supervisor.spec.ts +67 -43
- package/apps/control-plane/test/supervisor.unit.spec.ts +195 -126
- package/apps/control-plane/test/token-auth-verifier.spec.ts +29 -14
- package/apps/control-plane/test/tool-registry-loader.spec.ts +51 -27
- package/apps/control-plane/test/tool-runtime.spec.ts +63 -46
- package/apps/control-plane/test/worker-decision-loop.spec.ts +143 -122
- package/apps/control-plane/test/workspace-hooks.spec.ts +61 -23
- package/apps/control-plane/tsconfig.build.json +2 -7
- package/apps/control-plane/tsconfig.json +1 -5
- package/apps/control-plane/vitest.config.ts +7 -7
- package/config/agentic/orchestrator/adapters.yaml +3 -0
- package/config/agentic/orchestrator/agents.yaml +14 -0
- package/config/agentic/orchestrator/gates.yaml +28 -0
- package/config/agentic/orchestrator/policy.yaml +22 -0
- package/config/agentic/orchestrator/prompts/builder.system.md +1 -0
- package/config/agentic/orchestrator/prompts/planner.system.md +16 -0
- package/config/agentic/orchestrator/prompts/qa.system.md +1 -0
- package/dist/apps/control-plane/application/adapters/adapter-registry.js +12 -5
- package/dist/apps/control-plane/application/adapters/adapter-registry.js.map +1 -1
- package/dist/apps/control-plane/application/multi-project-loader.js +26 -9
- package/dist/apps/control-plane/application/multi-project-loader.js.map +1 -1
- package/dist/apps/control-plane/application/services/activity-monitor-service.js +7 -7
- package/dist/apps/control-plane/application/services/activity-monitor-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/collision-queue-service.js +7 -7
- package/dist/apps/control-plane/application/services/collision-queue-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/cost-tracking-service.js +6 -8
- package/dist/apps/control-plane/application/services/cost-tracking-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/dependency-scheduler-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/feature-deletion-service.js +37 -29
- package/dist/apps/control-plane/application/services/feature-deletion-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/feature-lifecycle-service.js +10 -10
- package/dist/apps/control-plane/application/services/feature-lifecycle-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/feature-state-service.js +11 -11
- package/dist/apps/control-plane/application/services/feature-state-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/gate-interpolation-service.js +3 -1
- package/dist/apps/control-plane/application/services/gate-interpolation-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/gate-service.js +26 -26
- package/dist/apps/control-plane/application/services/gate-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/instance-isolation-service.js +1 -1
- package/dist/apps/control-plane/application/services/instance-isolation-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/issue-tracker-service.js +25 -15
- package/dist/apps/control-plane/application/services/issue-tracker-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/lock-service.js +32 -32
- package/dist/apps/control-plane/application/services/lock-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/merge-service.js +41 -27
- package/dist/apps/control-plane/application/services/merge-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/notifier-service.js +29 -15
- package/dist/apps/control-plane/application/services/notifier-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/patch-service.js +21 -19
- package/dist/apps/control-plane/application/services/patch-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/performance-analytics-service.js +4 -4
- package/dist/apps/control-plane/application/services/performance-analytics-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/plan-service.js +33 -33
- package/dist/apps/control-plane/application/services/plan-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/policy-loader-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/pr-monitor-service.js +23 -11
- package/dist/apps/control-plane/application/services/pr-monitor-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/qa-index-service.js +11 -11
- package/dist/apps/control-plane/application/services/qa-index-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/reactions-service.js +13 -9
- package/dist/apps/control-plane/application/services/reactions-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/reporting-service.js +11 -9
- package/dist/apps/control-plane/application/services/reporting-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/run-lease-service.js +34 -33
- package/dist/apps/control-plane/application/services/run-lease-service.js.map +1 -1
- package/dist/apps/control-plane/application/tools/tool-metadata.js +2 -2
- package/dist/apps/control-plane/application/tools/tool-router.js.map +1 -1
- package/dist/apps/control-plane/cli/attach-command-handler.js +9 -9
- package/dist/apps/control-plane/cli/cleanup-command-handler.js +11 -9
- package/dist/apps/control-plane/cli/cleanup-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/cli-argument-parser.js +4 -3
- package/dist/apps/control-plane/cli/cli-argument-parser.js.map +1 -1
- package/dist/apps/control-plane/cli/dashboard-command-handler.js +23 -7
- package/dist/apps/control-plane/cli/dashboard-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/delete-command-handler.js +7 -7
- package/dist/apps/control-plane/cli/env-file.d.ts +4 -0
- package/dist/apps/control-plane/cli/env-file.js +89 -0
- package/dist/apps/control-plane/cli/env-file.js.map +1 -0
- package/dist/apps/control-plane/cli/help-command-handler.js +58 -30
- package/dist/apps/control-plane/cli/help-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/init-command-handler.js +97 -37
- package/dist/apps/control-plane/cli/init-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/io.js +2 -2
- package/dist/apps/control-plane/cli/io.js.map +1 -1
- package/dist/apps/control-plane/cli/resume-command-handler.js +9 -9
- package/dist/apps/control-plane/cli/resume-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/retry-command-handler.js +12 -11
- package/dist/apps/control-plane/cli/retry-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/run-command-handler.js +12 -8
- package/dist/apps/control-plane/cli/run-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/send-command-handler.js +6 -6
- package/dist/apps/control-plane/cli/spec-ingestion-service.js +10 -8
- package/dist/apps/control-plane/cli/spec-ingestion-service.js.map +1 -1
- package/dist/apps/control-plane/cli/spec-input-resolver.js.map +1 -1
- package/dist/apps/control-plane/cli/spec-utils.js.map +1 -1
- package/dist/apps/control-plane/cli/status-command-handler.js +8 -8
- package/dist/apps/control-plane/cli/status-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/tooling.js +1 -1
- package/dist/apps/control-plane/core/collisions.js +11 -8
- package/dist/apps/control-plane/core/collisions.js.map +1 -1
- package/dist/apps/control-plane/core/constants.js +13 -7
- package/dist/apps/control-plane/core/constants.js.map +1 -1
- package/dist/apps/control-plane/core/error-codes.js +1 -1
- package/dist/apps/control-plane/core/fs.js.map +1 -1
- package/dist/apps/control-plane/core/gates.d.ts +2 -2
- package/dist/apps/control-plane/core/gates.js +26 -19
- package/dist/apps/control-plane/core/gates.js.map +1 -1
- package/dist/apps/control-plane/core/git.js +3 -3
- package/dist/apps/control-plane/core/git.js.map +1 -1
- package/dist/apps/control-plane/core/kernel.d.ts +1 -0
- package/dist/apps/control-plane/core/kernel.js +134 -81
- package/dist/apps/control-plane/core/kernel.js.map +1 -1
- package/dist/apps/control-plane/core/patch.js +7 -3
- package/dist/apps/control-plane/core/patch.js.map +1 -1
- package/dist/apps/control-plane/core/path-layout.d.ts +1 -0
- package/dist/apps/control-plane/core/path-layout.js +4 -1
- package/dist/apps/control-plane/core/path-layout.js.map +1 -1
- package/dist/apps/control-plane/core/path-rules.js +3 -1
- package/dist/apps/control-plane/core/path-rules.js.map +1 -1
- package/dist/apps/control-plane/core/qa-index.js +5 -5
- package/dist/apps/control-plane/core/qa-index.js.map +1 -1
- package/dist/apps/control-plane/core/response.js +3 -3
- package/dist/apps/control-plane/core/response.js.map +1 -1
- package/dist/apps/control-plane/core/schemas.js +10 -6
- package/dist/apps/control-plane/core/schemas.js.map +1 -1
- package/dist/apps/control-plane/core/workspace-hooks.js +3 -3
- package/dist/apps/control-plane/index.d.ts +1 -1
- package/dist/apps/control-plane/index.js +1 -1
- package/dist/apps/control-plane/index.js.map +1 -1
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js +40 -23
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js.map +1 -1
- package/dist/apps/control-plane/mcp/kernel-tool-executor.js +1 -1
- package/dist/apps/control-plane/mcp/kernel-tool-executor.js.map +1 -1
- package/dist/apps/control-plane/mcp/mcp-server-adapter.js +6 -7
- package/dist/apps/control-plane/mcp/mcp-server-adapter.js.map +1 -1
- package/dist/apps/control-plane/mcp/operation-ledger.js +5 -5
- package/dist/apps/control-plane/mcp/operation-ledger.js.map +1 -1
- package/dist/apps/control-plane/mcp/protocol-contract.js +2 -2
- package/dist/apps/control-plane/mcp/runtime-factory.js +2 -2
- package/dist/apps/control-plane/mcp/runtime-factory.js.map +1 -1
- package/dist/apps/control-plane/mcp/token-auth-verifier.js +1 -1
- package/dist/apps/control-plane/mcp/token-auth-verifier.js.map +1 -1
- package/dist/apps/control-plane/mcp/token-claims-validator.js +5 -5
- package/dist/apps/control-plane/mcp/token-claims-validator.js.map +1 -1
- package/dist/apps/control-plane/mcp/tool-authorizer.js +1 -3
- package/dist/apps/control-plane/mcp/tool-authorizer.js.map +1 -1
- package/dist/apps/control-plane/mcp/tool-client.js +2 -2
- package/dist/apps/control-plane/mcp/tool-client.js.map +1 -1
- package/dist/apps/control-plane/mcp/tool-contract-validator.js +3 -3
- package/dist/apps/control-plane/mcp/tool-contract-validator.js.map +1 -1
- package/dist/apps/control-plane/mcp/tool-registry-loader.js +1 -1
- package/dist/apps/control-plane/mcp/tool-registry-loader.js.map +1 -1
- package/dist/apps/control-plane/mcp/tool-runtime.js +17 -17
- package/dist/apps/control-plane/mcp/tool-runtime.js.map +1 -1
- package/dist/apps/control-plane/mcp/tools-markdown-generator.js +6 -1
- package/dist/apps/control-plane/mcp/tools-markdown-generator.js.map +1 -1
- package/dist/apps/control-plane/providers/providers.d.ts +3 -2
- package/dist/apps/control-plane/providers/providers.js +81 -39
- package/dist/apps/control-plane/providers/providers.js.map +1 -1
- package/dist/apps/control-plane/supervisor/build-wave-executor.js +12 -12
- package/dist/apps/control-plane/supervisor/build-wave-executor.js.map +1 -1
- package/dist/apps/control-plane/supervisor/planning-wave-executor.js +19 -16
- package/dist/apps/control-plane/supervisor/planning-wave-executor.js.map +1 -1
- package/dist/apps/control-plane/supervisor/prompt-bundle-loader.js +1 -1
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js +13 -13
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js.map +1 -1
- package/dist/apps/control-plane/supervisor/run-coordinator.js +37 -20
- package/dist/apps/control-plane/supervisor/run-coordinator.js.map +1 -1
- package/dist/apps/control-plane/supervisor/runtime.js +25 -21
- package/dist/apps/control-plane/supervisor/runtime.js.map +1 -1
- package/dist/apps/control-plane/supervisor/session-orchestrator.js +29 -23
- package/dist/apps/control-plane/supervisor/session-orchestrator.js.map +1 -1
- package/dist/apps/control-plane/supervisor/types.d.ts +3 -3
- package/dist/apps/control-plane/supervisor/types.js.map +1 -1
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js +14 -16
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js.map +1 -1
- package/eslint.config.mjs +20 -20
- package/example-configurations/README.md +1 -1
- package/example-configurations/java/agents.yaml +3 -3
- package/example-configurations/java/policy.yaml +1 -1
- package/example-configurations/node/agents.yaml +3 -3
- package/example-configurations/node/policy.yaml +1 -1
- package/package.json +10 -5
- package/packages/web-dashboard/next.config.js +2 -2
- package/packages/web-dashboard/src/app/api/actions/route.ts +25 -9
- package/packages/web-dashboard/src/app/api/events/route.ts +20 -6
- package/packages/web-dashboard/src/app/api/features/[id]/checkout/route.ts +88 -37
- package/packages/web-dashboard/src/app/api/features/[id]/evidence/[artifact]/route.ts +8 -5
- package/packages/web-dashboard/src/app/api/features/[id]/review/route.ts +27 -9
- package/packages/web-dashboard/src/app/api/features/[id]/route.ts +5 -2
- package/packages/web-dashboard/src/app/api/projects/route.ts +5 -5
- package/packages/web-dashboard/src/app/globals.css +10 -2
- package/packages/web-dashboard/src/app/page.tsx +100 -37
- package/packages/web-dashboard/src/lib/aop-client.ts +68 -37
- package/packages/web-dashboard/src/lib/multi-project-config.ts +28 -7
- package/packages/web-dashboard/src/lib/orchestrator-tools.ts +59 -36
- package/packages/web-dashboard/tsconfig.json +3 -11
- package/scripts/nx-safe.mjs +10 -10
- package/spec-files/completed/agentic_orchestrator_cli_delete_command_spec.md +5 -0
- package/spec-files/completed/agentic_orchestrator_feature_gaps_closure_spec.md +189 -90
- package/spec-files/completed/agentic_orchestrator_init_policy_ux_simplification_spec.md +49 -16
- package/spec-files/completed/agentic_orchestrator_mcp_formalization_spec.md +24 -1
- package/spec-files/completed/agentic_orchestrator_single_global_orchestrator_spec.md +9 -0
- package/spec-files/completed/agentic_orchestrator_spec.md +171 -75
- package/spec-files/completed/agentic_orchestrator_validator_hardening_spec.md +25 -17
- package/spec-files/outstanding/agentic_orchestrator_artifact_database_publishing_spec.md +40 -5
- package/spec-files/outstanding/agentic_orchestrator_enterprise_governance_dashboard_spec.md +23 -12
- package/spec-files/outstanding/agentic_orchestrator_knowledge_canary_spec.md +16 -4
- package/spec-files/outstanding/agentic_orchestrator_observability_integrity_diagnostics_spec.md +42 -2
- package/spec-files/outstanding/agentic_orchestrator_performance_improvements_spec.md +209 -130
- package/spec-files/outstanding/agentic_orchestrator_planning_review_quality_spec.md +56 -3
- package/spec-files/outstanding/agentic_orchestrator_productization_commercial_spec.md +77 -10
- package/spec-files/outstanding/agentic_orchestrator_provider_auth_bootstrap_spec.md +384 -0
- package/spec-files/outstanding/agentic_orchestrator_quality_adoption_execution_spec.md +29 -14
- package/spec-files/progress.md +186 -175
- package/tsconfig.json +2 -8
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
FeatureOrchestrationPort,
|
|
7
7
|
RuntimeStateReader,
|
|
8
8
|
SupervisorRuntimeState,
|
|
9
|
-
SupervisorToolCaller
|
|
9
|
+
SupervisorToolCaller,
|
|
10
10
|
} from './types.js';
|
|
11
11
|
import { type SessionOrchestrator } from './session-orchestrator.js';
|
|
12
12
|
import { type PlanningWaveExecutor } from './planning-wave-executor.js';
|
|
@@ -59,7 +59,11 @@ export class RunCoordinator {
|
|
|
59
59
|
private readonly prMonitor: PrMonitorService | undefined;
|
|
60
60
|
private readonly issueTracker: IssueTracker | undefined;
|
|
61
61
|
private readonly statusCache: Map<string, string>;
|
|
62
|
-
private static readonly TERMINAL_STATUSES = new Set<string>([
|
|
62
|
+
private static readonly TERMINAL_STATUSES = new Set<string>([
|
|
63
|
+
STATUS.MERGED,
|
|
64
|
+
STATUS.FAILED,
|
|
65
|
+
STATUS.PAUSED_BUDGET,
|
|
66
|
+
]);
|
|
63
67
|
|
|
64
68
|
constructor(dependencies: RunCoordinatorDependencies) {
|
|
65
69
|
this.kernel = dependencies.kernel;
|
|
@@ -93,7 +97,7 @@ export class RunCoordinator {
|
|
|
93
97
|
provider: this.provider.selection.provider,
|
|
94
98
|
model: this.provider.selection.model,
|
|
95
99
|
provider_config_ref_hash: this.providerConfigRefHash(),
|
|
96
|
-
takeover_stale_run: this.takeoverStaleRun
|
|
100
|
+
takeover_stale_run: this.takeoverStaleRun,
|
|
97
101
|
});
|
|
98
102
|
|
|
99
103
|
this.state.runMetadata.took_over_stale = Boolean(leaseResult.data.took_over_stale);
|
|
@@ -109,7 +113,7 @@ export class RunCoordinator {
|
|
|
109
113
|
await this.kernel.pruneFeatureSessionAssignments({
|
|
110
114
|
run_id: this.state.runId,
|
|
111
115
|
owner_instance_id: this.state.ownerInstanceId,
|
|
112
|
-
active_feature_ids: scopedFeatureIds
|
|
116
|
+
active_feature_ids: scopedFeatureIds,
|
|
113
117
|
});
|
|
114
118
|
|
|
115
119
|
activeFeatureIds = await this.rebalanceActiveFeatures(activeFeatureIds);
|
|
@@ -119,7 +123,10 @@ export class RunCoordinator {
|
|
|
119
123
|
break;
|
|
120
124
|
}
|
|
121
125
|
await this.leaseHeartbeatService.renew();
|
|
122
|
-
activeFeatureIds = await this.applyOrchestratorPrioritization(
|
|
126
|
+
activeFeatureIds = await this.applyOrchestratorPrioritization(
|
|
127
|
+
activeFeatureIds,
|
|
128
|
+
iteration + 1,
|
|
129
|
+
);
|
|
123
130
|
// N3: Check budget before waves; pause over-budget features
|
|
124
131
|
activeFeatureIds = await this.pauseOverBudgetFeatures(activeFeatureIds);
|
|
125
132
|
await this.planningWaveExecutor.run(activeFeatureIds);
|
|
@@ -139,8 +146,8 @@ export class RunCoordinator {
|
|
|
139
146
|
queue_depth: this.state.queue.length,
|
|
140
147
|
run_metadata: {
|
|
141
148
|
...this.state.runMetadata,
|
|
142
|
-
runtime_sessions: runtimeSessions
|
|
143
|
-
}
|
|
149
|
+
runtime_sessions: runtimeSessions,
|
|
150
|
+
},
|
|
144
151
|
};
|
|
145
152
|
}
|
|
146
153
|
|
|
@@ -149,17 +156,22 @@ export class RunCoordinator {
|
|
|
149
156
|
for (const featureId of activeFeatureIds) {
|
|
150
157
|
const budgetCheck = await this.kernel.checkBudget(featureId);
|
|
151
158
|
if (budgetCheck.over_budget) {
|
|
152
|
-
await this.kernel.updateState(featureId, null, (_fm) =>
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
159
|
+
await this.kernel.updateState(featureId, null, (_fm) =>
|
|
160
|
+
Promise.resolve({
|
|
161
|
+
frontMatter: {
|
|
162
|
+
status: STATUS.PAUSED_BUDGET,
|
|
163
|
+
status_reason: `Feature paused: estimated cost $${budgetCheck.current_cost_usd.toFixed(4)} exceeds budget limit $${budgetCheck.limit_usd.toFixed(2)}`,
|
|
164
|
+
},
|
|
165
|
+
}),
|
|
166
|
+
);
|
|
158
167
|
if (this.notifier) {
|
|
159
168
|
await this.notifier.notify('budget_exceeded', {
|
|
160
169
|
feature_id: featureId,
|
|
161
170
|
message: `Budget exceeded for ${featureId}: $${budgetCheck.current_cost_usd.toFixed(4)} >= $${budgetCheck.limit_usd.toFixed(2)}`,
|
|
162
|
-
details: {
|
|
171
|
+
details: {
|
|
172
|
+
current_cost_usd: budgetCheck.current_cost_usd,
|
|
173
|
+
limit_usd: budgetCheck.limit_usd,
|
|
174
|
+
},
|
|
163
175
|
});
|
|
164
176
|
}
|
|
165
177
|
await this.sessionOrchestrator.closeFeatureCluster(featureId);
|
|
@@ -169,7 +181,11 @@ export class RunCoordinator {
|
|
|
169
181
|
await this.notifier.notify('budget_alert', {
|
|
170
182
|
feature_id: featureId,
|
|
171
183
|
message: `Budget alert for ${featureId}: $${budgetCheck.current_cost_usd.toFixed(4)} (${Math.round(budgetCheck.alert_threshold * 100)}% of $${budgetCheck.limit_usd.toFixed(2)})`,
|
|
172
|
-
details: {
|
|
184
|
+
details: {
|
|
185
|
+
current_cost_usd: budgetCheck.current_cost_usd,
|
|
186
|
+
limit_usd: budgetCheck.limit_usd,
|
|
187
|
+
alert_threshold: budgetCheck.alert_threshold,
|
|
188
|
+
},
|
|
173
189
|
});
|
|
174
190
|
}
|
|
175
191
|
}
|
|
@@ -190,7 +206,10 @@ export class RunCoordinator {
|
|
|
190
206
|
survivingActiveFeatureIds.push(featureId);
|
|
191
207
|
}
|
|
192
208
|
|
|
193
|
-
while (
|
|
209
|
+
while (
|
|
210
|
+
survivingActiveFeatureIds.length < this.maxActiveFeatures &&
|
|
211
|
+
this.state.queue.length > 0
|
|
212
|
+
) {
|
|
194
213
|
const nextFeature = this.state.queue.shift();
|
|
195
214
|
if (!nextFeature) {
|
|
196
215
|
break;
|
|
@@ -206,17 +225,20 @@ export class RunCoordinator {
|
|
|
206
225
|
survivingActiveFeatureIds.push(nextFeature.feature_id);
|
|
207
226
|
}
|
|
208
227
|
|
|
209
|
-
const activeFeatureIds = [...new Set(survivingActiveFeatureIds)].sort((a, b) =>
|
|
210
|
-
|
|
211
|
-
a.localeCompare(b)
|
|
228
|
+
const activeFeatureIds = [...new Set(survivingActiveFeatureIds)].sort((a, b) =>
|
|
229
|
+
a.localeCompare(b),
|
|
212
230
|
);
|
|
231
|
+
const scopedFeatureIds = [
|
|
232
|
+
...activeFeatureIds,
|
|
233
|
+
...this.state.queue.map((item) => item.feature_id),
|
|
234
|
+
].sort((a, b) => a.localeCompare(b));
|
|
213
235
|
|
|
214
236
|
await this.sessionOrchestrator.reconcileQueuedFeatures(this.state.queue);
|
|
215
237
|
await this.sessionOrchestrator.enforceActiveFeatureInvariant(activeFeatureIds);
|
|
216
238
|
await this.kernel.pruneFeatureSessionAssignments({
|
|
217
239
|
run_id: this.state.runId,
|
|
218
240
|
owner_instance_id: this.state.ownerInstanceId,
|
|
219
|
-
active_feature_ids: scopedFeatureIds
|
|
241
|
+
active_feature_ids: scopedFeatureIds,
|
|
220
242
|
});
|
|
221
243
|
|
|
222
244
|
return activeFeatureIds;
|
|
@@ -227,12 +249,16 @@ export class RunCoordinator {
|
|
|
227
249
|
}
|
|
228
250
|
|
|
229
251
|
private async readFeatureStateSnapshot(
|
|
230
|
-
featureId: string
|
|
252
|
+
featureId: string,
|
|
231
253
|
): Promise<{ status: string | null; branch: string; hasPr: boolean }> {
|
|
232
254
|
try {
|
|
233
|
-
const state = await this.toolCaller.callTool<FeatureStatePayload>(
|
|
234
|
-
|
|
235
|
-
|
|
255
|
+
const state = await this.toolCaller.callTool<FeatureStatePayload>(
|
|
256
|
+
'orchestrator',
|
|
257
|
+
TOOLS.FEATURE_STATE_GET,
|
|
258
|
+
{
|
|
259
|
+
feature_id: featureId,
|
|
260
|
+
},
|
|
261
|
+
);
|
|
236
262
|
const frontMatter = RunCoordinator.asRecord(state.data.front_matter);
|
|
237
263
|
const status = typeof frontMatter.status === 'string' ? frontMatter.status : null;
|
|
238
264
|
const prValue = frontMatter.pr;
|
|
@@ -262,7 +288,8 @@ export class RunCoordinator {
|
|
|
262
288
|
continue;
|
|
263
289
|
}
|
|
264
290
|
const prevStatus = this.statusCache.get(featureId);
|
|
265
|
-
const shouldPollPr =
|
|
291
|
+
const shouldPollPr =
|
|
292
|
+
this.prMonitor && (newStatus === STATUS.READY_TO_MERGE || snapshot.hasPr);
|
|
266
293
|
if (prevStatus === newStatus && shouldPollPr) {
|
|
267
294
|
await this.prMonitor.checkAndUpdate(featureId, snapshot.branch);
|
|
268
295
|
}
|
|
@@ -275,12 +302,12 @@ export class RunCoordinator {
|
|
|
275
302
|
const event = prevStatus === STATUS.PLANNING ? 'collision_detected' : 'gate_failed';
|
|
276
303
|
await this.notifier.notify(event, {
|
|
277
304
|
feature_id: featureId,
|
|
278
|
-
message: `Feature ${featureId} blocked (event: ${event})
|
|
305
|
+
message: `Feature ${featureId} blocked (event: ${event})`,
|
|
279
306
|
});
|
|
280
307
|
} else if (newStatus === STATUS.READY_TO_MERGE) {
|
|
281
308
|
await this.notifier.notify('ready_to_merge', {
|
|
282
309
|
feature_id: featureId,
|
|
283
|
-
message: `Feature ${featureId} is ready to merge
|
|
310
|
+
message: `Feature ${featureId} is ready to merge`,
|
|
284
311
|
});
|
|
285
312
|
if (shouldPollPr) {
|
|
286
313
|
await this.prMonitor.checkAndUpdate(featureId, snapshot.branch);
|
|
@@ -288,7 +315,7 @@ export class RunCoordinator {
|
|
|
288
315
|
} else if (newStatus === STATUS.MERGED) {
|
|
289
316
|
await this.notifier.notify('feature_merged', {
|
|
290
317
|
feature_id: featureId,
|
|
291
|
-
message: `Feature ${featureId} was merged
|
|
318
|
+
message: `Feature ${featureId} was merged`,
|
|
292
319
|
});
|
|
293
320
|
}
|
|
294
321
|
}
|
|
@@ -298,8 +325,14 @@ export class RunCoordinator {
|
|
|
298
325
|
}
|
|
299
326
|
}
|
|
300
327
|
|
|
301
|
-
private async syncIssueTrackerStatus(
|
|
302
|
-
|
|
328
|
+
private async syncIssueTrackerStatus(
|
|
329
|
+
featureId: string,
|
|
330
|
+
status: string,
|
|
331
|
+
prevStatus: string | undefined,
|
|
332
|
+
): Promise<void> {
|
|
333
|
+
if (!this.issueTracker) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
303
336
|
const issueId = featureId.replace(/^feature[/_]/, '');
|
|
304
337
|
if (status === STATUS.PLANNING && prevStatus === undefined) {
|
|
305
338
|
// Spec enrichment: fetch issue context when planning starts, store in frontmatter
|
|
@@ -310,20 +343,22 @@ export class RunCoordinator {
|
|
|
310
343
|
title: issue.title,
|
|
311
344
|
body: issue.body,
|
|
312
345
|
status: issue.status,
|
|
313
|
-
url: issue.url
|
|
346
|
+
url: issue.url,
|
|
314
347
|
};
|
|
315
348
|
await this.kernel.updateState(featureId, null, (fm) =>
|
|
316
|
-
Promise.resolve({ frontMatter: { ...fm, issue_context: issueCtx } })
|
|
349
|
+
Promise.resolve({ frontMatter: { ...fm, issue_context: issueCtx } }),
|
|
317
350
|
);
|
|
318
351
|
}
|
|
319
352
|
}
|
|
320
|
-
await this.issueTracker
|
|
353
|
+
await this.issueTracker
|
|
354
|
+
.addComment(issueId, `AOP: feature status changed to \`${status}\``)
|
|
355
|
+
.catch(() => undefined);
|
|
321
356
|
await this.issueTracker.updateIssueStatus(issueId, status).catch(() => undefined);
|
|
322
357
|
}
|
|
323
358
|
|
|
324
359
|
private async applyOrchestratorPrioritization(
|
|
325
360
|
activeFeatureIds: string[],
|
|
326
|
-
iteration: number
|
|
361
|
+
iteration: number,
|
|
327
362
|
): Promise<string[]> {
|
|
328
363
|
if (activeFeatureIds.length < 2) {
|
|
329
364
|
return activeFeatureIds;
|
|
@@ -335,10 +370,10 @@ export class RunCoordinator {
|
|
|
335
370
|
contextBundle: {
|
|
336
371
|
iteration,
|
|
337
372
|
active_feature_ids: activeFeatureIds,
|
|
338
|
-
queued_feature_ids: this.state.queue.map((item) => item.feature_id)
|
|
373
|
+
queued_feature_ids: this.state.queue.map((item) => item.feature_id),
|
|
339
374
|
},
|
|
340
375
|
instructions:
|
|
341
|
-
'Decide per-iteration prioritization. Emit REQUEST action=prioritize with feature_order to reprioritize active features.'
|
|
376
|
+
'Decide per-iteration prioritization. Emit REQUEST action=prioritize with feature_order to reprioritize active features.',
|
|
342
377
|
});
|
|
343
378
|
|
|
344
379
|
if (decision.priorityOrder.length === 0) {
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
NOTIFICATION_CHANNEL_SLOT,
|
|
22
22
|
ACTIVITY_DETECTOR_SLOT,
|
|
23
23
|
SCM_PROVIDER_SLOT,
|
|
24
|
-
type AdapterSlot
|
|
24
|
+
type AdapterSlot,
|
|
25
25
|
} from '../application/adapters/adapter-registry.js';
|
|
26
26
|
import type { ReactionsPolicy } from '../application/services/reactions-service.js';
|
|
27
27
|
import type {
|
|
@@ -36,7 +36,7 @@ import type {
|
|
|
36
36
|
SupervisorOptions,
|
|
37
37
|
SupervisorRuntimeState,
|
|
38
38
|
SupervisorToolCaller,
|
|
39
|
-
WorkerSessions
|
|
39
|
+
WorkerSessions,
|
|
40
40
|
} from './types.js';
|
|
41
41
|
|
|
42
42
|
type NamedContract = { name: string };
|
|
@@ -44,9 +44,10 @@ type NamedContract = { name: string };
|
|
|
44
44
|
function resolveAdapterName(
|
|
45
45
|
slot: AdapterSlot<NamedContract>,
|
|
46
46
|
configuredValue: unknown,
|
|
47
|
-
fallback: string | null
|
|
47
|
+
fallback: string | null,
|
|
48
48
|
): string | null {
|
|
49
|
-
const configured =
|
|
49
|
+
const configured =
|
|
50
|
+
typeof configuredValue === 'string' && configuredValue.length > 0 ? configuredValue : null;
|
|
50
51
|
const candidate = configured ?? fallback;
|
|
51
52
|
if (!candidate) {
|
|
52
53
|
return null;
|
|
@@ -91,24 +92,40 @@ export class SupervisorRuntime
|
|
|
91
92
|
kernel: SupervisorKernelPort,
|
|
92
93
|
provider: WorkerProvider,
|
|
93
94
|
toolClient: ToolClient,
|
|
94
|
-
options: SupervisorOptions = {}
|
|
95
|
+
options: SupervisorOptions = {},
|
|
95
96
|
) {
|
|
96
97
|
this.kernel = kernel;
|
|
97
98
|
this.provider = provider;
|
|
98
99
|
this.toolClient = toolClient;
|
|
99
100
|
this.maxActiveFeatures = options.max_active_features ?? 5;
|
|
100
101
|
this.maxParallelGateRuns = this.resolveMaxParallelGateRuns(options.max_parallel_gate_runs);
|
|
101
|
-
this.maxIterationsPerPhase = this.resolveMaxIterationsPerPhase(
|
|
102
|
+
this.maxIterationsPerPhase = this.resolveMaxIterationsPerPhase(
|
|
103
|
+
options.max_iterations_per_phase,
|
|
104
|
+
);
|
|
102
105
|
this.takeoverStaleRun = Boolean(options.takeover_stale_run);
|
|
103
106
|
const runId = options.run_id ?? `run:${Date.now()}`;
|
|
104
|
-
const ownerInstanceId =
|
|
107
|
+
const ownerInstanceId =
|
|
108
|
+
options.owner_instance_id ?? `supervisor:${process.pid}:${crypto.randomUUID()}`;
|
|
105
109
|
const adaptersConfig =
|
|
106
|
-
typeof (this.kernel as { getAdaptersConfig?: () => Record<string, unknown> })
|
|
110
|
+
typeof (this.kernel as { getAdaptersConfig?: () => Record<string, unknown> })
|
|
111
|
+
.getAdaptersConfig === 'function'
|
|
107
112
|
? this.kernel.getAdaptersConfig()
|
|
108
113
|
: {};
|
|
109
|
-
const notificationChannel = resolveAdapterName(
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
const notificationChannel = resolveAdapterName(
|
|
115
|
+
NOTIFICATION_CHANNEL_SLOT,
|
|
116
|
+
adaptersConfig['notification-channel'],
|
|
117
|
+
null,
|
|
118
|
+
);
|
|
119
|
+
const activityDetector = resolveAdapterName(
|
|
120
|
+
ACTIVITY_DETECTOR_SLOT,
|
|
121
|
+
adaptersConfig['activity-detector'],
|
|
122
|
+
'claude-jsonl',
|
|
123
|
+
);
|
|
124
|
+
const scmProvider = resolveAdapterName(
|
|
125
|
+
SCM_PROVIDER_SLOT,
|
|
126
|
+
adaptersConfig['scm-provider'],
|
|
127
|
+
'github',
|
|
128
|
+
);
|
|
112
129
|
|
|
113
130
|
this.state = {
|
|
114
131
|
runId,
|
|
@@ -124,9 +141,9 @@ export class SupervisorRuntime
|
|
|
124
141
|
adapters: {
|
|
125
142
|
notification_channel: notificationChannel,
|
|
126
143
|
activity_detector: activityDetector,
|
|
127
|
-
scm_provider: scmProvider
|
|
128
|
-
}
|
|
129
|
-
}
|
|
144
|
+
scm_provider: scmProvider,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
130
147
|
};
|
|
131
148
|
|
|
132
149
|
this.promptBundleLoader = new PromptBundleLoader(this.kernel);
|
|
@@ -136,7 +153,7 @@ export class SupervisorRuntime
|
|
|
136
153
|
provider: this.provider,
|
|
137
154
|
promptProvider: this,
|
|
138
155
|
toolCaller: this,
|
|
139
|
-
state: this.state
|
|
156
|
+
state: this.state,
|
|
140
157
|
});
|
|
141
158
|
|
|
142
159
|
const notifier = createNotifierService(this.kernel.getPolicySnapshot(), notificationChannel);
|
|
@@ -144,7 +161,7 @@ export class SupervisorRuntime
|
|
|
144
161
|
const reactionsService = new ReactionsService({
|
|
145
162
|
toolCaller: this,
|
|
146
163
|
notifier,
|
|
147
|
-
policy: reactionsPolicy
|
|
164
|
+
policy: reactionsPolicy,
|
|
148
165
|
});
|
|
149
166
|
|
|
150
167
|
const activityMonitor = new ActivityMonitorService({
|
|
@@ -152,7 +169,7 @@ export class SupervisorRuntime
|
|
|
152
169
|
notifier,
|
|
153
170
|
reactionsPolicy,
|
|
154
171
|
idleThresholdMs: this.resolveActivityIdleThresholdMs(),
|
|
155
|
-
detectorName: activityDetector ?? 'claude-jsonl'
|
|
172
|
+
detectorName: activityDetector ?? 'claude-jsonl',
|
|
156
173
|
});
|
|
157
174
|
|
|
158
175
|
const prMonitor =
|
|
@@ -161,33 +178,34 @@ export class SupervisorRuntime
|
|
|
161
178
|
toolCaller: this,
|
|
162
179
|
notifier,
|
|
163
180
|
reactionsPolicy,
|
|
164
|
-
ghRunner: createGhRunner()
|
|
181
|
+
ghRunner: createGhRunner(),
|
|
165
182
|
})
|
|
166
183
|
: undefined;
|
|
167
184
|
|
|
168
185
|
const policy = this.kernel.getPolicySnapshot();
|
|
169
186
|
const rawIssueTrackerConfig = policy['issue_tracker'];
|
|
170
|
-
const issueTrackerConfig =
|
|
171
|
-
|
|
172
|
-
|
|
187
|
+
const issueTrackerConfig =
|
|
188
|
+
typeof rawIssueTrackerConfig === 'object' && rawIssueTrackerConfig !== null
|
|
189
|
+
? (rawIssueTrackerConfig as { type: string; config?: Record<string, string> })
|
|
190
|
+
: undefined;
|
|
173
191
|
const issueTracker = createIssueTracker(issueTrackerConfig);
|
|
174
192
|
|
|
175
193
|
this.workerDecisionLoop = new WorkerDecisionLoop({
|
|
176
194
|
provider: this.provider,
|
|
177
195
|
toolCaller: this,
|
|
178
|
-
activityMonitor
|
|
196
|
+
activityMonitor,
|
|
179
197
|
});
|
|
180
198
|
|
|
181
199
|
this.planningWaveExecutor = new PlanningWaveExecutor({
|
|
182
200
|
toolCaller: this,
|
|
183
201
|
planGenerator: this,
|
|
184
|
-
workerDecisionRunner: this.workerDecisionLoop
|
|
202
|
+
workerDecisionRunner: this.workerDecisionLoop,
|
|
185
203
|
});
|
|
186
204
|
|
|
187
205
|
this.buildWaveExecutor = new BuildWaveExecutor({
|
|
188
206
|
toolCaller: this,
|
|
189
207
|
workerDecisionRunner: this.workerDecisionLoop,
|
|
190
|
-
reactionsService
|
|
208
|
+
reactionsService,
|
|
191
209
|
});
|
|
192
210
|
|
|
193
211
|
this.qaWaveExecutor = new QaWaveExecutor({
|
|
@@ -198,12 +216,12 @@ export class SupervisorRuntime
|
|
|
198
216
|
featureClusterPatcher: this,
|
|
199
217
|
state: this.state,
|
|
200
218
|
workerDecisionRunner: this.workerDecisionLoop,
|
|
201
|
-
reactionsService
|
|
219
|
+
reactionsService,
|
|
202
220
|
});
|
|
203
221
|
|
|
204
222
|
this.leaseHeartbeatService = new LeaseHeartbeatService({
|
|
205
223
|
kernel: this.kernel,
|
|
206
|
-
state: this.state
|
|
224
|
+
state: this.state,
|
|
207
225
|
});
|
|
208
226
|
|
|
209
227
|
this.runCoordinator = new RunCoordinator({
|
|
@@ -224,7 +242,7 @@ export class SupervisorRuntime
|
|
|
224
242
|
workerDecisionRunner: this.workerDecisionLoop,
|
|
225
243
|
notifier,
|
|
226
244
|
prMonitor,
|
|
227
|
-
issueTracker
|
|
245
|
+
issueTracker,
|
|
228
246
|
});
|
|
229
247
|
}
|
|
230
248
|
|
|
@@ -369,7 +387,10 @@ export class SupervisorRuntime
|
|
|
369
387
|
await this.sessionOrchestrator.enforceActiveFeatureInvariant(activeFeatureIds);
|
|
370
388
|
}
|
|
371
389
|
|
|
372
|
-
async patchFeatureCluster(
|
|
390
|
+
async patchFeatureCluster(
|
|
391
|
+
featureId: string,
|
|
392
|
+
clusterPatch: Record<string, string>,
|
|
393
|
+
): Promise<void> {
|
|
373
394
|
await this.sessionOrchestrator.patchFeatureCluster(featureId, clusterPatch);
|
|
374
395
|
}
|
|
375
396
|
|
|
@@ -398,7 +419,10 @@ export class SupervisorRuntime
|
|
|
398
419
|
}
|
|
399
420
|
|
|
400
421
|
async generateInitialPlan(featureId: string): Promise<Record<string, unknown>> {
|
|
401
|
-
const baseRef = await this.kernel
|
|
422
|
+
const baseRef = await this.kernel
|
|
423
|
+
.repoDiff(featureId, ['--stat'])
|
|
424
|
+
.then(() => 'HEAD')
|
|
425
|
+
.catch(() => 'HEAD');
|
|
402
426
|
return {
|
|
403
427
|
feature_id: featureId,
|
|
404
428
|
plan_version: 1,
|
|
@@ -409,15 +433,15 @@ export class SupervisorRuntime
|
|
|
409
433
|
files: {
|
|
410
434
|
create: [],
|
|
411
435
|
modify: [],
|
|
412
|
-
delete: []
|
|
436
|
+
delete: [],
|
|
413
437
|
},
|
|
414
438
|
contracts: {
|
|
415
439
|
openapi: 'none',
|
|
416
440
|
events: 'none',
|
|
417
|
-
db: 'none'
|
|
441
|
+
db: 'none',
|
|
418
442
|
},
|
|
419
443
|
acceptance_criteria: ['Feature has deterministic plan and passes configured gate profile.'],
|
|
420
|
-
gate_profile: 'default'
|
|
444
|
+
gate_profile: 'default',
|
|
421
445
|
};
|
|
422
446
|
}
|
|
423
447
|
|
|
@@ -451,7 +475,7 @@ export class SupervisorRuntime
|
|
|
451
475
|
async callTool<TData = Record<string, unknown>>(
|
|
452
476
|
role: RuntimeRole,
|
|
453
477
|
toolName: string,
|
|
454
|
-
args: Record<string, unknown
|
|
478
|
+
args: Record<string, unknown>,
|
|
455
479
|
): Promise<{ ok: true; data: TData }> {
|
|
456
480
|
const payload = withOperationIdIfRequired(toolName, args, createOperationId);
|
|
457
481
|
const roleSessionId = this.resolveRoleSessionId(role, payload);
|
|
@@ -460,11 +484,11 @@ export class SupervisorRuntime
|
|
|
460
484
|
run_id: this.state.runId,
|
|
461
485
|
session_id: roleSessionId ?? `bootstrap:${role}`,
|
|
462
486
|
actor_type: role,
|
|
463
|
-
actor_id: `supervisor:${role}
|
|
487
|
+
actor_id: `supervisor:${role}`,
|
|
464
488
|
});
|
|
465
489
|
|
|
466
490
|
if (response.ok === false) {
|
|
467
|
-
const normalized =
|
|
491
|
+
const normalized = response.error;
|
|
468
492
|
const error = new Error(normalized.message) as AppError;
|
|
469
493
|
error.code = normalized.code;
|
|
470
494
|
error.details = normalized.details;
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
RuntimeStateReader,
|
|
8
8
|
SupervisorKernelPort,
|
|
9
9
|
SupervisorRuntimeState,
|
|
10
|
-
SupervisorToolCaller
|
|
10
|
+
SupervisorToolCaller,
|
|
11
11
|
} from './types.js';
|
|
12
12
|
import { UNASSIGNED_SESSION_ID } from './types.js';
|
|
13
13
|
|
|
@@ -67,7 +67,7 @@ export class SessionOrchestrator {
|
|
|
67
67
|
run_id: this.state.runId,
|
|
68
68
|
owner_instance_id: this.state.ownerInstanceId,
|
|
69
69
|
orchestrator_session_id: orchestratorSession.session_id,
|
|
70
|
-
increment_epoch: canReuse
|
|
70
|
+
increment_epoch: canReuse,
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
if (canReuse && candidate) {
|
|
@@ -90,8 +90,8 @@ export class SessionOrchestrator {
|
|
|
90
90
|
const reattachResult = await Promise.race([
|
|
91
91
|
this.provider.reattachSession(sessionId),
|
|
92
92
|
new Promise<never>((_, reject) =>
|
|
93
|
-
setTimeout(() => reject(new Error('Reattach timeout')), timeoutMs)
|
|
94
|
-
)
|
|
93
|
+
setTimeout(() => reject(new Error('Reattach timeout')), timeoutMs),
|
|
94
|
+
),
|
|
95
95
|
]);
|
|
96
96
|
return Boolean(reattachResult?.session_id === sessionId);
|
|
97
97
|
} catch (_error) {
|
|
@@ -116,14 +116,16 @@ export class SessionOrchestrator {
|
|
|
116
116
|
metadata: {
|
|
117
117
|
orphan_session_id: sessionId,
|
|
118
118
|
previous_epoch: previousEpoch,
|
|
119
|
-
new_epoch: previousEpoch + 1
|
|
120
|
-
}
|
|
119
|
+
new_epoch: previousEpoch + 1,
|
|
120
|
+
},
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
-
await this.toolCaller
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
await this.toolCaller
|
|
124
|
+
.callTool('orchestrator', TOOLS.FEATURE_LOG_APPEND, {
|
|
125
|
+
feature_id: 'global',
|
|
126
|
+
note: JSON.stringify(orphanEvent),
|
|
127
|
+
})
|
|
128
|
+
.catch(() => ({ ok: true, data: {} }));
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
async cleanupOrphanWorkerSessions(scopedFeatureIds: string[]): Promise<void> {
|
|
@@ -138,7 +140,11 @@ export class SessionOrchestrator {
|
|
|
138
140
|
}
|
|
139
141
|
|
|
140
142
|
const assignment = assignments[featureId];
|
|
141
|
-
for (const sessionId of [
|
|
143
|
+
for (const sessionId of [
|
|
144
|
+
assignment.planner_session_id,
|
|
145
|
+
assignment.builder_session_id,
|
|
146
|
+
assignment.qa_session_id,
|
|
147
|
+
]) {
|
|
142
148
|
if (!sessionId || sessionId === UNASSIGNED_SESSION_ID) {
|
|
143
149
|
continue;
|
|
144
150
|
}
|
|
@@ -159,7 +165,7 @@ export class SessionOrchestrator {
|
|
|
159
165
|
this.state.sessionsByFeature.set(featureId, {
|
|
160
166
|
planner: plannerSession.session_id,
|
|
161
167
|
builder: builderSession.session_id,
|
|
162
|
-
qa: qaSession.session_id
|
|
168
|
+
qa: qaSession.session_id,
|
|
163
169
|
});
|
|
164
170
|
|
|
165
171
|
await this.kernel.updateFeatureSessionAssignment({
|
|
@@ -168,14 +174,14 @@ export class SessionOrchestrator {
|
|
|
168
174
|
feature_id: featureId,
|
|
169
175
|
planner_session_id: plannerSession.session_id,
|
|
170
176
|
builder_session_id: builderSession.session_id,
|
|
171
|
-
qa_session_id: qaSession.session_id
|
|
177
|
+
qa_session_id: qaSession.session_id,
|
|
172
178
|
});
|
|
173
179
|
|
|
174
180
|
await this.patchFeatureCluster(featureId, {
|
|
175
181
|
orchestrator_session_id: this.state.orchestratorSessionId ?? 'unknown',
|
|
176
182
|
planner_session_id: plannerSession.session_id,
|
|
177
183
|
builder_session_id: builderSession.session_id,
|
|
178
|
-
qa_session_id: qaSession.session_id
|
|
184
|
+
qa_session_id: qaSession.session_id,
|
|
179
185
|
});
|
|
180
186
|
}
|
|
181
187
|
|
|
@@ -204,14 +210,14 @@ export class SessionOrchestrator {
|
|
|
204
210
|
feature_id: feature.feature_id,
|
|
205
211
|
planner_session_id: UNASSIGNED_SESSION_ID,
|
|
206
212
|
builder_session_id: UNASSIGNED_SESSION_ID,
|
|
207
|
-
qa_session_id: UNASSIGNED_SESSION_ID
|
|
213
|
+
qa_session_id: UNASSIGNED_SESSION_ID,
|
|
208
214
|
});
|
|
209
215
|
|
|
210
216
|
await this.patchFeatureCluster(feature.feature_id, {
|
|
211
217
|
orchestrator_session_id: this.state.orchestratorSessionId ?? 'unknown',
|
|
212
218
|
planner_session_id: UNASSIGNED_SESSION_ID,
|
|
213
219
|
builder_session_id: UNASSIGNED_SESSION_ID,
|
|
214
|
-
qa_session_id: UNASSIGNED_SESSION_ID
|
|
220
|
+
qa_session_id: UNASSIGNED_SESSION_ID,
|
|
215
221
|
});
|
|
216
222
|
}
|
|
217
223
|
}
|
|
@@ -223,9 +229,13 @@ export class SessionOrchestrator {
|
|
|
223
229
|
}
|
|
224
230
|
|
|
225
231
|
for (const featureId of [...activeFeatureIds].sort((a, b) => a.localeCompare(b))) {
|
|
226
|
-
const state = await this.toolCaller.callTool<FeatureStatePayload>(
|
|
227
|
-
|
|
228
|
-
|
|
232
|
+
const state = await this.toolCaller.callTool<FeatureStatePayload>(
|
|
233
|
+
'orchestrator',
|
|
234
|
+
TOOLS.FEATURE_STATE_GET,
|
|
235
|
+
{
|
|
236
|
+
feature_id: featureId,
|
|
237
|
+
},
|
|
238
|
+
);
|
|
229
239
|
|
|
230
240
|
const cluster = state.data.front_matter.cluster ?? {};
|
|
231
241
|
if (cluster.orchestrator_session_id === orchestratorSessionId) {
|
|
@@ -239,18 +249,25 @@ export class SessionOrchestrator {
|
|
|
239
249
|
front_matter: {
|
|
240
250
|
cluster: {
|
|
241
251
|
...cluster,
|
|
242
|
-
orchestrator_session_id: orchestratorSessionId
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
252
|
+
orchestrator_session_id: orchestratorSessionId,
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
},
|
|
246
256
|
});
|
|
247
257
|
}
|
|
248
258
|
}
|
|
249
259
|
|
|
250
|
-
async patchFeatureCluster(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
260
|
+
async patchFeatureCluster(
|
|
261
|
+
featureId: string,
|
|
262
|
+
clusterPatch: Record<string, string>,
|
|
263
|
+
): Promise<void> {
|
|
264
|
+
const state = await this.toolCaller.callTool<FeatureStatePayload>(
|
|
265
|
+
'orchestrator',
|
|
266
|
+
TOOLS.FEATURE_STATE_GET,
|
|
267
|
+
{
|
|
268
|
+
feature_id: featureId,
|
|
269
|
+
},
|
|
270
|
+
);
|
|
254
271
|
|
|
255
272
|
await this.toolCaller.callTool('orchestrator', TOOLS.FEATURE_STATE_PATCH, {
|
|
256
273
|
feature_id: featureId,
|
|
@@ -259,10 +276,10 @@ export class SessionOrchestrator {
|
|
|
259
276
|
front_matter: {
|
|
260
277
|
cluster: {
|
|
261
278
|
...(state.data.front_matter.cluster ?? {}),
|
|
262
|
-
...clusterPatch
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
279
|
+
...clusterPatch,
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
},
|
|
266
283
|
});
|
|
267
284
|
}
|
|
268
285
|
}
|