agentic-orchestrator 0.1.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/.dockerignore +24 -0
- package/.github/workflows/mcp-contract-validation.yml +38 -0
- package/Agentic-Orchestrator.iml +9 -0
- package/LICENSE +21 -0
- package/README.md +679 -0
- package/agentic/orchestrator/agents.yaml +14 -0
- package/agentic/orchestrator/gates.yaml +31 -0
- package/agentic/orchestrator/policy.yaml +145 -0
- package/agentic/orchestrator/prompts/builder.system.md +1 -0
- package/agentic/orchestrator/prompts/planner.system.md +15 -0
- package/agentic/orchestrator/prompts/qa.system.md +1 -0
- package/agentic/orchestrator/schemas/agents.schema.json +49 -0
- package/agentic/orchestrator/schemas/gates.schema.json +65 -0
- package/agentic/orchestrator/schemas/index.schema.json +108 -0
- package/agentic/orchestrator/schemas/plan.schema.json +127 -0
- package/agentic/orchestrator/schemas/policy.schema.json +227 -0
- package/agentic/orchestrator/schemas/qa_test_index.schema.json +53 -0
- package/agentic/orchestrator/schemas/state.schema.json +92 -0
- package/agentic/orchestrator/tools/catalog.json +399 -0
- package/agentic/orchestrator/tools/errors.schema.json +21 -0
- package/agentic/orchestrator/tools/protocol.json +8 -0
- package/agentic/orchestrator/tools/schemas/input/collisions.scan.input.schema.json +7 -0
- package/agentic/orchestrator/tools/schemas/input/evidence.latest.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/feature.delete.input.schema.json +42 -0
- package/agentic/orchestrator/tools/schemas/input/feature.discover_specs.input.schema.json +7 -0
- package/agentic/orchestrator/tools/schemas/input/feature.get_context.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/feature.init.input.schema.json +21 -0
- package/agentic/orchestrator/tools/schemas/input/feature.log_append.input.schema.json +26 -0
- package/agentic/orchestrator/tools/schemas/input/feature.ready_to_merge.input.schema.json +34 -0
- package/agentic/orchestrator/tools/schemas/input/feature.state_get.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/feature.state_patch.input.schema.json +28 -0
- package/agentic/orchestrator/tools/schemas/input/gates.list.input.schema.json +11 -0
- package/agentic/orchestrator/tools/schemas/input/gates.run.input.schema.json +29 -0
- package/agentic/orchestrator/tools/schemas/input/locks.acquire.input.schema.json +29 -0
- package/agentic/orchestrator/tools/schemas/input/locks.release.input.schema.json +26 -0
- package/agentic/orchestrator/tools/schemas/input/mutating.schema.json +14 -0
- package/agentic/orchestrator/tools/schemas/input/plan.get.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/plan.submit.input.schema.json +28 -0
- package/agentic/orchestrator/tools/schemas/input/plan.update.input.schema.json +29 -0
- package/agentic/orchestrator/tools/schemas/input/qa.test_index_get.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/qa.test_index_update.input.schema.json +38 -0
- package/agentic/orchestrator/tools/schemas/input/read.schema.json +6 -0
- package/agentic/orchestrator/tools/schemas/input/repo.apply_patch.input.schema.json +25 -0
- package/agentic/orchestrator/tools/schemas/input/repo.diff.input.schema.json +21 -0
- package/agentic/orchestrator/tools/schemas/input/repo.diff_bundle.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/repo.ensure_worktree.input.schema.json +21 -0
- package/agentic/orchestrator/tools/schemas/input/repo.read_file.input.schema.json +20 -0
- package/agentic/orchestrator/tools/schemas/input/repo.search.input.schema.json +20 -0
- package/agentic/orchestrator/tools/schemas/input/repo.status.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/report.dashboard.input.schema.json +7 -0
- package/agentic/orchestrator/tools/schemas/input/report.feature_summary.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/output/collisions.scan.output.schema.json +17 -0
- package/agentic/orchestrator/tools/schemas/output/evidence.latest.output.schema.json +20 -0
- package/agentic/orchestrator/tools/schemas/output/feature.delete.output.schema.json +224 -0
- package/agentic/orchestrator/tools/schemas/output/feature.discover_specs.output.schema.json +32 -0
- package/agentic/orchestrator/tools/schemas/output/feature.get_context.output.schema.json +40 -0
- package/agentic/orchestrator/tools/schemas/output/feature.init.output.schema.json +24 -0
- package/agentic/orchestrator/tools/schemas/output/feature.log_append.output.schema.json +24 -0
- package/agentic/orchestrator/tools/schemas/output/feature.ready_to_merge.output.schema.json +30 -0
- package/agentic/orchestrator/tools/schemas/output/feature.state_get.output.schema.json +18 -0
- package/agentic/orchestrator/tools/schemas/output/feature.state_patch.output.schema.json +24 -0
- package/agentic/orchestrator/tools/schemas/output/gates.list.output.schema.json +42 -0
- package/agentic/orchestrator/tools/schemas/output/gates.run.output.schema.json +37 -0
- package/agentic/orchestrator/tools/schemas/output/locks.acquire.output.schema.json +34 -0
- package/agentic/orchestrator/tools/schemas/output/locks.release.output.schema.json +24 -0
- package/agentic/orchestrator/tools/schemas/output/plan.get.output.schema.json +26 -0
- package/agentic/orchestrator/tools/schemas/output/plan.submit.output.schema.json +23 -0
- package/agentic/orchestrator/tools/schemas/output/plan.update.output.schema.json +23 -0
- package/agentic/orchestrator/tools/schemas/output/qa.test_index_get.output.schema.json +22 -0
- package/agentic/orchestrator/tools/schemas/output/qa.test_index_update.output.schema.json +19 -0
- package/agentic/orchestrator/tools/schemas/output/repo.apply_patch.output.schema.json +33 -0
- package/agentic/orchestrator/tools/schemas/output/repo.diff.output.schema.json +19 -0
- package/agentic/orchestrator/tools/schemas/output/repo.diff_bundle.output.schema.json +32 -0
- package/agentic/orchestrator/tools/schemas/output/repo.ensure_worktree.output.schema.json +29 -0
- package/agentic/orchestrator/tools/schemas/output/repo.read_file.output.schema.json +24 -0
- package/agentic/orchestrator/tools/schemas/output/repo.search.output.schema.json +26 -0
- package/agentic/orchestrator/tools/schemas/output/repo.status.output.schema.json +27 -0
- package/agentic/orchestrator/tools/schemas/output/report.dashboard.output.schema.json +21 -0
- package/agentic/orchestrator/tools/schemas/output/report.feature_summary.output.schema.json +36 -0
- package/agentic/orchestrator/tools/schemas/output/standard_success.schema.json +6 -0
- package/agentic/orchestrator/tools.md +32 -0
- package/apps/control-plane/project.json +39 -0
- package/apps/control-plane/scripts/validate-architecture-rules.mjs +170 -0
- package/apps/control-plane/scripts/validate-docker-mcp-contract.mjs +84 -0
- package/apps/control-plane/scripts/validate-mcp-contracts.ts +61 -0
- package/apps/control-plane/src/application/services/collision-queue-service.ts +227 -0
- package/apps/control-plane/src/application/services/feature-deletion-service.ts +459 -0
- package/apps/control-plane/src/application/services/feature-lifecycle-service.ts +177 -0
- package/apps/control-plane/src/application/services/feature-state-service.ts +125 -0
- package/apps/control-plane/src/application/services/gate-service.ts +232 -0
- package/apps/control-plane/src/application/services/lock-service.ts +298 -0
- package/apps/control-plane/src/application/services/merge-service.ts +246 -0
- package/apps/control-plane/src/application/services/patch-service.ts +259 -0
- package/apps/control-plane/src/application/services/plan-service.ts +302 -0
- package/apps/control-plane/src/application/services/qa-index-service.ts +98 -0
- package/apps/control-plane/src/application/services/reporting-service.ts +120 -0
- package/apps/control-plane/src/application/services/run-lease-service.ts +340 -0
- package/apps/control-plane/src/application/tools/tool-metadata.ts +56 -0
- package/apps/control-plane/src/application/tools/tool-router.ts +43 -0
- package/apps/control-plane/src/cli/aop.ts +31 -0
- package/apps/control-plane/src/cli/cli-argument-parser.ts +116 -0
- package/apps/control-plane/src/cli/delete-command-handler.ts +90 -0
- package/apps/control-plane/src/cli/io.ts +14 -0
- package/apps/control-plane/src/cli/resume-command-handler.ts +228 -0
- package/apps/control-plane/src/cli/run-command-handler.ts +57 -0
- package/apps/control-plane/src/cli/spec-ingestion-service.ts +88 -0
- package/apps/control-plane/src/cli/spec-input-resolver.ts +95 -0
- package/apps/control-plane/src/cli/spec-utils.ts +40 -0
- package/apps/control-plane/src/cli/status-command-handler.ts +17 -0
- package/apps/control-plane/src/cli/stop-command-handler.ts +5 -0
- package/apps/control-plane/src/cli/tooling.ts +36 -0
- package/apps/control-plane/src/cli/types.ts +34 -0
- package/apps/control-plane/src/core/collisions.ts +121 -0
- package/apps/control-plane/src/core/constants.ts +72 -0
- package/apps/control-plane/src/core/error-codes.ts +54 -0
- package/apps/control-plane/src/core/frontmatter.ts +42 -0
- package/apps/control-plane/src/core/fs.ts +173 -0
- package/apps/control-plane/src/core/gates.ts +361 -0
- package/apps/control-plane/src/core/git.ts +115 -0
- package/apps/control-plane/src/core/kernel.ts +1077 -0
- package/apps/control-plane/src/core/patch.ts +152 -0
- package/apps/control-plane/src/core/path-layout.ts +113 -0
- package/apps/control-plane/src/core/path-rules.ts +71 -0
- package/apps/control-plane/src/core/qa-index.ts +179 -0
- package/apps/control-plane/src/core/response.ts +62 -0
- package/apps/control-plane/src/core/runtime-sessions.ts +20 -0
- package/apps/control-plane/src/core/schemas.ts +125 -0
- package/apps/control-plane/src/index.ts +21 -0
- package/apps/control-plane/src/interfaces/cli/bootstrap.ts +100 -0
- package/apps/control-plane/src/mcp/kernel-tool-executor.ts +39 -0
- package/apps/control-plane/src/mcp/mcp-server-adapter.ts +74 -0
- package/apps/control-plane/src/mcp/operation-ledger.ts +108 -0
- package/apps/control-plane/src/mcp/protocol-contract.ts +9 -0
- package/apps/control-plane/src/mcp/runtime-factory.ts +105 -0
- package/apps/control-plane/src/mcp/runtime-types.ts +44 -0
- package/apps/control-plane/src/mcp/token-auth-verifier.ts +63 -0
- package/apps/control-plane/src/mcp/token-claims-validator.ts +72 -0
- package/apps/control-plane/src/mcp/token-codec.ts +62 -0
- package/apps/control-plane/src/mcp/tool-authorizer.ts +43 -0
- package/apps/control-plane/src/mcp/tool-client.ts +78 -0
- package/apps/control-plane/src/mcp/tool-contract-validator.ts +83 -0
- package/apps/control-plane/src/mcp/tool-registry-loader.ts +135 -0
- package/apps/control-plane/src/mcp/tool-runtime.ts +336 -0
- package/apps/control-plane/src/mcp/tools-markdown-generator.ts +26 -0
- package/apps/control-plane/src/mcp/transport-types.ts +16 -0
- package/apps/control-plane/src/mcp/types.ts +2 -0
- package/apps/control-plane/src/providers/providers.ts +177 -0
- package/apps/control-plane/src/supervisor/build-wave-executor.ts +55 -0
- package/apps/control-plane/src/supervisor/lease-heartbeat-service.ts +22 -0
- package/apps/control-plane/src/supervisor/planning-wave-executor.ts +316 -0
- package/apps/control-plane/src/supervisor/prompt-bundle-loader.ts +62 -0
- package/apps/control-plane/src/supervisor/qa-wave-executor.ts +99 -0
- package/apps/control-plane/src/supervisor/run-coordinator.ts +224 -0
- package/apps/control-plane/src/supervisor/runtime.ts +347 -0
- package/apps/control-plane/src/supervisor/session-orchestrator.ts +268 -0
- package/apps/control-plane/src/supervisor/types.ts +149 -0
- package/apps/control-plane/src/supervisor/worker-decision-loop.ts +299 -0
- package/apps/control-plane/test/aop.spec.ts +101 -0
- package/apps/control-plane/test/cli-helpers.spec.ts +102 -0
- package/apps/control-plane/test/cli.spec.ts +12 -0
- package/apps/control-plane/test/cli.unit.spec.ts +609 -0
- package/apps/control-plane/test/collision-queue.spec.ts +158 -0
- package/apps/control-plane/test/collisions.spec.ts +138 -0
- package/apps/control-plane/test/core-utils.spec.ts +102 -0
- package/apps/control-plane/test/delete-command-handler.spec.ts +202 -0
- package/apps/control-plane/test/epoch-tracking.spec.ts +121 -0
- package/apps/control-plane/test/gates.spec.ts +452 -0
- package/apps/control-plane/test/helpers.ts +68 -0
- package/apps/control-plane/test/index.spec.ts +18 -0
- package/apps/control-plane/test/kernel-collision-replay.spec.ts +222 -0
- package/apps/control-plane/test/kernel.branches.spec.ts +321 -0
- package/apps/control-plane/test/kernel.coverage.spec.ts +408 -0
- package/apps/control-plane/test/kernel.spec.ts +369 -0
- package/apps/control-plane/test/mcp-helpers.spec.ts +195 -0
- package/apps/control-plane/test/mcp.spec.ts +776 -0
- package/apps/control-plane/test/merge-service.spec.ts +357 -0
- package/apps/control-plane/test/plan-service.spec.ts +195 -0
- package/apps/control-plane/test/planning-wave-executor.spec.ts +229 -0
- package/apps/control-plane/test/providers.spec.ts +168 -0
- package/apps/control-plane/test/qa-index-service.spec.ts +187 -0
- package/apps/control-plane/test/qa-index.spec.ts +317 -0
- package/apps/control-plane/test/response.spec.ts +55 -0
- package/apps/control-plane/test/run-coordinator.spec.ts +334 -0
- package/apps/control-plane/test/schema-date-time.spec.ts +170 -0
- package/apps/control-plane/test/service-retry-paths.spec.ts +305 -0
- package/apps/control-plane/test/services.spec.ts +693 -0
- package/apps/control-plane/test/spec-input-resolver.spec.ts +76 -0
- package/apps/control-plane/test/supervisor-collaborators.spec.ts +201 -0
- package/apps/control-plane/test/supervisor.calltool.spec.ts +120 -0
- package/apps/control-plane/test/supervisor.spec.ts +415 -0
- package/apps/control-plane/test/supervisor.unit.spec.ts +522 -0
- package/apps/control-plane/test/token-auth-verifier.spec.ts +111 -0
- package/apps/control-plane/test/tool-registry-loader.spec.ts +268 -0
- package/apps/control-plane/test/tool-runtime.spec.ts +294 -0
- package/apps/control-plane/test/worker-decision-loop.spec.ts +587 -0
- package/apps/control-plane/tsconfig.build.json +17 -0
- package/apps/control-plane/tsconfig.json +11 -0
- package/apps/control-plane/vitest.config.ts +28 -0
- package/dist/apps/control-plane/application/services/collision-queue-service.d.ts +69 -0
- package/dist/apps/control-plane/application/services/collision-queue-service.js +158 -0
- package/dist/apps/control-plane/application/services/collision-queue-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/feature-deletion-service.d.ts +79 -0
- package/dist/apps/control-plane/application/services/feature-deletion-service.js +336 -0
- package/dist/apps/control-plane/application/services/feature-deletion-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/feature-lifecycle-service.d.ts +81 -0
- package/dist/apps/control-plane/application/services/feature-lifecycle-service.js +117 -0
- package/dist/apps/control-plane/application/services/feature-lifecycle-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/feature-state-service.d.ts +34 -0
- package/dist/apps/control-plane/application/services/feature-state-service.js +90 -0
- package/dist/apps/control-plane/application/services/feature-state-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/gate-service.d.ts +46 -0
- package/dist/apps/control-plane/application/services/gate-service.js +160 -0
- package/dist/apps/control-plane/application/services/gate-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/lock-service.d.ts +56 -0
- package/dist/apps/control-plane/application/services/lock-service.js +242 -0
- package/dist/apps/control-plane/application/services/lock-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/merge-service.d.ts +33 -0
- package/dist/apps/control-plane/application/services/merge-service.js +194 -0
- package/dist/apps/control-plane/application/services/merge-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/patch-service.d.ts +39 -0
- package/dist/apps/control-plane/application/services/patch-service.js +189 -0
- package/dist/apps/control-plane/application/services/patch-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/plan-service.d.ts +60 -0
- package/dist/apps/control-plane/application/services/plan-service.js +234 -0
- package/dist/apps/control-plane/application/services/plan-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/qa-index-service.d.ts +26 -0
- package/dist/apps/control-plane/application/services/qa-index-service.js +66 -0
- package/dist/apps/control-plane/application/services/qa-index-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/reporting-service.d.ts +47 -0
- package/dist/apps/control-plane/application/services/reporting-service.js +90 -0
- package/dist/apps/control-plane/application/services/reporting-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/run-lease-service.d.ts +74 -0
- package/dist/apps/control-plane/application/services/run-lease-service.js +263 -0
- package/dist/apps/control-plane/application/services/run-lease-service.js.map +1 -0
- package/dist/apps/control-plane/application/tools/tool-metadata.d.ts +8 -0
- package/dist/apps/control-plane/application/tools/tool-metadata.js +37 -0
- package/dist/apps/control-plane/application/tools/tool-metadata.js.map +1 -0
- package/dist/apps/control-plane/application/tools/tool-router.d.ts +16 -0
- package/dist/apps/control-plane/application/tools/tool-router.js +25 -0
- package/dist/apps/control-plane/application/tools/tool-router.js.map +1 -0
- package/dist/apps/control-plane/cli/aop.d.ts +5 -0
- package/dist/apps/control-plane/cli/aop.js +19 -0
- package/dist/apps/control-plane/cli/aop.js.map +1 -0
- package/dist/apps/control-plane/cli/cli-argument-parser.d.ts +5 -0
- package/dist/apps/control-plane/cli/cli-argument-parser.js +109 -0
- package/dist/apps/control-plane/cli/cli-argument-parser.js.map +1 -0
- package/dist/apps/control-plane/cli/delete-command-handler.d.ts +8 -0
- package/dist/apps/control-plane/cli/delete-command-handler.js +77 -0
- package/dist/apps/control-plane/cli/delete-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/io.d.ts +2 -0
- package/dist/apps/control-plane/cli/io.js +14 -0
- package/dist/apps/control-plane/cli/io.js.map +1 -0
- package/dist/apps/control-plane/cli/resume-command-handler.d.ts +17 -0
- package/dist/apps/control-plane/cli/resume-command-handler.js +178 -0
- package/dist/apps/control-plane/cli/resume-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/run-command-handler.d.ts +15 -0
- package/dist/apps/control-plane/cli/run-command-handler.js +39 -0
- package/dist/apps/control-plane/cli/run-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/spec-ingestion-service.d.ts +8 -0
- package/dist/apps/control-plane/cli/spec-ingestion-service.js +77 -0
- package/dist/apps/control-plane/cli/spec-ingestion-service.js.map +1 -0
- package/dist/apps/control-plane/cli/spec-input-resolver.d.ts +9 -0
- package/dist/apps/control-plane/cli/spec-input-resolver.js +81 -0
- package/dist/apps/control-plane/cli/spec-input-resolver.js.map +1 -0
- package/dist/apps/control-plane/cli/spec-utils.d.ts +3 -0
- package/dist/apps/control-plane/cli/spec-utils.js +36 -0
- package/dist/apps/control-plane/cli/spec-utils.js.map +1 -0
- package/dist/apps/control-plane/cli/status-command-handler.d.ts +7 -0
- package/dist/apps/control-plane/cli/status-command-handler.js +14 -0
- package/dist/apps/control-plane/cli/status-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/stop-command-handler.d.ts +3 -0
- package/dist/apps/control-plane/cli/stop-command-handler.js +6 -0
- package/dist/apps/control-plane/cli/stop-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/tooling.d.ts +4 -0
- package/dist/apps/control-plane/cli/tooling.js +24 -0
- package/dist/apps/control-plane/cli/tooling.js.map +1 -0
- package/dist/apps/control-plane/cli/types.d.ts +31 -0
- package/dist/apps/control-plane/cli/types.js +2 -0
- package/dist/apps/control-plane/cli/types.js.map +1 -0
- package/dist/apps/control-plane/core/collisions.d.ts +39 -0
- package/dist/apps/control-plane/core/collisions.js +78 -0
- package/dist/apps/control-plane/core/collisions.js.map +1 -0
- package/dist/apps/control-plane/core/constants.d.ts +64 -0
- package/dist/apps/control-plane/core/constants.js +64 -0
- package/dist/apps/control-plane/core/constants.js.map +1 -0
- package/dist/apps/control-plane/core/error-codes.d.ts +50 -0
- package/dist/apps/control-plane/core/error-codes.js +52 -0
- package/dist/apps/control-plane/core/error-codes.js.map +1 -0
- package/dist/apps/control-plane/core/frontmatter.d.ts +11 -0
- package/dist/apps/control-plane/core/frontmatter.js +30 -0
- package/dist/apps/control-plane/core/frontmatter.js.map +1 -0
- package/dist/apps/control-plane/core/fs.d.ts +33 -0
- package/dist/apps/control-plane/core/fs.js +134 -0
- package/dist/apps/control-plane/core/fs.js.map +1 -0
- package/dist/apps/control-plane/core/gates.d.ts +88 -0
- package/dist/apps/control-plane/core/gates.js +229 -0
- package/dist/apps/control-plane/core/gates.js.map +1 -0
- package/dist/apps/control-plane/core/git.d.ts +31 -0
- package/dist/apps/control-plane/core/git.js +79 -0
- package/dist/apps/control-plane/core/git.js.map +1 -0
- package/dist/apps/control-plane/core/kernel.d.ts +445 -0
- package/dist/apps/control-plane/core/kernel.js +805 -0
- package/dist/apps/control-plane/core/kernel.js.map +1 -0
- package/dist/apps/control-plane/core/patch.d.ts +23 -0
- package/dist/apps/control-plane/core/patch.js +118 -0
- package/dist/apps/control-plane/core/patch.js.map +1 -0
- package/dist/apps/control-plane/core/path-layout.d.ts +23 -0
- package/dist/apps/control-plane/core/path-layout.js +90 -0
- package/dist/apps/control-plane/core/path-layout.js.map +1 -0
- package/dist/apps/control-plane/core/path-rules.d.ts +13 -0
- package/dist/apps/control-plane/core/path-rules.js +52 -0
- package/dist/apps/control-plane/core/path-rules.js.map +1 -0
- package/dist/apps/control-plane/core/qa-index.d.ts +53 -0
- package/dist/apps/control-plane/core/qa-index.js +112 -0
- package/dist/apps/control-plane/core/qa-index.js.map +1 -0
- package/dist/apps/control-plane/core/response.d.ts +19 -0
- package/dist/apps/control-plane/core/response.js +34 -0
- package/dist/apps/control-plane/core/response.js.map +1 -0
- package/dist/apps/control-plane/core/runtime-sessions.d.ts +19 -0
- package/dist/apps/control-plane/core/runtime-sessions.js +2 -0
- package/dist/apps/control-plane/core/runtime-sessions.js.map +1 -0
- package/dist/apps/control-plane/core/schemas.d.ts +23 -0
- package/dist/apps/control-plane/core/schemas.js +80 -0
- package/dist/apps/control-plane/core/schemas.js.map +1 -0
- package/dist/apps/control-plane/index.d.ts +11 -0
- package/dist/apps/control-plane/index.js +9 -0
- package/dist/apps/control-plane/index.js.map +1 -0
- package/dist/apps/control-plane/interfaces/cli/bootstrap.d.ts +2 -0
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js +86 -0
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js.map +1 -0
- package/dist/apps/control-plane/mcp/kernel-tool-executor.d.ts +14 -0
- package/dist/apps/control-plane/mcp/kernel-tool-executor.js +26 -0
- package/dist/apps/control-plane/mcp/kernel-tool-executor.js.map +1 -0
- package/dist/apps/control-plane/mcp/mcp-server-adapter.d.ts +19 -0
- package/dist/apps/control-plane/mcp/mcp-server-adapter.js +55 -0
- package/dist/apps/control-plane/mcp/mcp-server-adapter.js.map +1 -0
- package/dist/apps/control-plane/mcp/operation-ledger.d.ts +21 -0
- package/dist/apps/control-plane/mcp/operation-ledger.js +75 -0
- package/dist/apps/control-plane/mcp/operation-ledger.js.map +1 -0
- package/dist/apps/control-plane/mcp/protocol-contract.d.ts +8 -0
- package/dist/apps/control-plane/mcp/protocol-contract.js +9 -0
- package/dist/apps/control-plane/mcp/protocol-contract.js.map +1 -0
- package/dist/apps/control-plane/mcp/runtime-factory.d.ts +38 -0
- package/dist/apps/control-plane/mcp/runtime-factory.js +71 -0
- package/dist/apps/control-plane/mcp/runtime-factory.js.map +1 -0
- package/dist/apps/control-plane/mcp/runtime-types.d.ts +40 -0
- package/dist/apps/control-plane/mcp/runtime-types.js +2 -0
- package/dist/apps/control-plane/mcp/runtime-types.js.map +1 -0
- package/dist/apps/control-plane/mcp/token-auth-verifier.d.ts +24 -0
- package/dist/apps/control-plane/mcp/token-auth-verifier.js +45 -0
- package/dist/apps/control-plane/mcp/token-auth-verifier.js.map +1 -0
- package/dist/apps/control-plane/mcp/token-claims-validator.d.ts +9 -0
- package/dist/apps/control-plane/mcp/token-claims-validator.js +62 -0
- package/dist/apps/control-plane/mcp/token-claims-validator.js.map +1 -0
- package/dist/apps/control-plane/mcp/token-codec.d.ts +11 -0
- package/dist/apps/control-plane/mcp/token-codec.js +46 -0
- package/dist/apps/control-plane/mcp/token-codec.js.map +1 -0
- package/dist/apps/control-plane/mcp/tool-authorizer.d.ts +8 -0
- package/dist/apps/control-plane/mcp/tool-authorizer.js +36 -0
- package/dist/apps/control-plane/mcp/tool-authorizer.js.map +1 -0
- package/dist/apps/control-plane/mcp/tool-client.d.ts +30 -0
- package/dist/apps/control-plane/mcp/tool-client.js +50 -0
- package/dist/apps/control-plane/mcp/tool-client.js.map +1 -0
- package/dist/apps/control-plane/mcp/tool-contract-validator.d.ts +29 -0
- package/dist/apps/control-plane/mcp/tool-contract-validator.js +61 -0
- package/dist/apps/control-plane/mcp/tool-contract-validator.js.map +1 -0
- package/dist/apps/control-plane/mcp/tool-registry-loader.d.ts +15 -0
- package/dist/apps/control-plane/mcp/tool-registry-loader.js +109 -0
- package/dist/apps/control-plane/mcp/tool-registry-loader.js.map +1 -0
- package/dist/apps/control-plane/mcp/tool-runtime.d.ts +34 -0
- package/dist/apps/control-plane/mcp/tool-runtime.js +252 -0
- package/dist/apps/control-plane/mcp/tool-runtime.js.map +1 -0
- package/dist/apps/control-plane/mcp/tools-markdown-generator.d.ts +7 -0
- package/dist/apps/control-plane/mcp/tools-markdown-generator.js +22 -0
- package/dist/apps/control-plane/mcp/tools-markdown-generator.js.map +1 -0
- package/dist/apps/control-plane/mcp/transport-types.d.ts +14 -0
- package/dist/apps/control-plane/mcp/transport-types.js +2 -0
- package/dist/apps/control-plane/mcp/transport-types.js.map +1 -0
- package/dist/apps/control-plane/mcp/types.d.ts +2 -0
- package/dist/apps/control-plane/mcp/types.js +3 -0
- package/dist/apps/control-plane/mcp/types.js.map +1 -0
- package/dist/apps/control-plane/providers/providers.d.ts +72 -0
- package/dist/apps/control-plane/providers/providers.js +94 -0
- package/dist/apps/control-plane/providers/providers.js.map +1 -0
- package/dist/apps/control-plane/supervisor/build-wave-executor.d.ts +13 -0
- package/dist/apps/control-plane/supervisor/build-wave-executor.js +40 -0
- package/dist/apps/control-plane/supervisor/build-wave-executor.js.map +1 -0
- package/dist/apps/control-plane/supervisor/lease-heartbeat-service.d.ts +12 -0
- package/dist/apps/control-plane/supervisor/lease-heartbeat-service.js +14 -0
- package/dist/apps/control-plane/supervisor/lease-heartbeat-service.js.map +1 -0
- package/dist/apps/control-plane/supervisor/planning-wave-executor.d.ts +19 -0
- package/dist/apps/control-plane/supervisor/planning-wave-executor.js +249 -0
- package/dist/apps/control-plane/supervisor/planning-wave-executor.js.map +1 -0
- package/dist/apps/control-plane/supervisor/prompt-bundle-loader.d.ts +9 -0
- package/dist/apps/control-plane/supervisor/prompt-bundle-loader.js +53 -0
- package/dist/apps/control-plane/supervisor/prompt-bundle-loader.js.map +1 -0
- package/dist/apps/control-plane/supervisor/qa-wave-executor.d.ts +24 -0
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js +70 -0
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js.map +1 -0
- package/dist/apps/control-plane/supervisor/run-coordinator.d.ts +49 -0
- package/dist/apps/control-plane/supervisor/run-coordinator.js +162 -0
- package/dist/apps/control-plane/supervisor/run-coordinator.js.map +1 -0
- package/dist/apps/control-plane/supervisor/runtime.d.ts +58 -0
- package/dist/apps/control-plane/supervisor/runtime.js +270 -0
- package/dist/apps/control-plane/supervisor/runtime.js.map +1 -0
- package/dist/apps/control-plane/supervisor/session-orchestrator.d.ts +29 -0
- package/dist/apps/control-plane/supervisor/session-orchestrator.js +211 -0
- package/dist/apps/control-plane/supervisor/session-orchestrator.js.map +1 -0
- package/dist/apps/control-plane/supervisor/types.d.ts +148 -0
- package/dist/apps/control-plane/supervisor/types.js +2 -0
- package/dist/apps/control-plane/supervisor/types.js.map +1 -0
- package/dist/apps/control-plane/supervisor/worker-decision-loop.d.ts +37 -0
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js +236 -0
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js.map +1 -0
- package/docker/mcp.Dockerfile +14 -0
- package/docker/mcp.compose.yaml +15 -0
- package/docker/mcp.entrypoint.sh +17 -0
- package/eslint.config.mjs +93 -0
- package/example-configurations/README.md +26 -0
- package/example-configurations/java/agents.yaml +14 -0
- package/example-configurations/java/gates.yaml +29 -0
- package/example-configurations/java/policy.yaml +148 -0
- package/example-configurations/node/agents.yaml +14 -0
- package/example-configurations/node/gates.yaml +32 -0
- package/example-configurations/node/policy.yaml +143 -0
- package/nx.json +16 -0
- package/package.json +39 -0
- package/prompts/vitest-testing-standards.instructions.md +204 -0
- package/scripts/dev-shell-env.sh +7 -0
- package/scripts/nx-safe.mjs +33 -0
- package/spec-files/agentic_orchestrator_cli_delete_command_spec.md +310 -0
- package/spec-files/agentic_orchestrator_dot_aop_generated_artifacts_spec.md +211 -0
- package/spec-files/agentic_orchestrator_mcp_formalization_spec.md +379 -0
- package/spec-files/agentic_orchestrator_oop_refactor_spec.md +415 -0
- package/spec-files/agentic_orchestrator_single_global_orchestrator_spec.md +265 -0
- package/spec-files/agentic_orchestrator_spec.md +1334 -0
- package/spec-files/progress.md +452 -0
- package/tsconfig.base.json +15 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
applyQaUpdates,
|
|
4
|
+
buildQaIndex,
|
|
5
|
+
makeRequiredTests,
|
|
6
|
+
summarizeQaIndex,
|
|
7
|
+
type QaIndex
|
|
8
|
+
} from '../src/core/qa-index.js';
|
|
9
|
+
import type { ParsedDiffFile } from '../src/core/patch.js';
|
|
10
|
+
|
|
11
|
+
describe('qa-index helpers', () => {
|
|
12
|
+
it('GIVEN_gate_profile_modes_WHEN_generating_required_tests_THEN_returns_stable_labels', () => {
|
|
13
|
+
const required = makeRequiredTests('default', {
|
|
14
|
+
modes: {
|
|
15
|
+
fast: [{ name: 'lint' }],
|
|
16
|
+
full: [{ name: 'test_with_coverage' }]
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
expect(required).toEqual([
|
|
21
|
+
'default:fast:lint',
|
|
22
|
+
'default:full:test_with_coverage'
|
|
23
|
+
]);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('GIVEN_previous_index_WHEN_building_new_index_THEN_preserves_known_item_state', () => {
|
|
27
|
+
const parsedDiff: ParsedDiffFile[] = [
|
|
28
|
+
{
|
|
29
|
+
oldPath: 'src/a.ts',
|
|
30
|
+
newPath: 'src/a.ts',
|
|
31
|
+
changeType: 'modify',
|
|
32
|
+
hunks: [{ start_line: 10, end_line: 12, change_type: 'modify' }]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
oldPath: 'src/removed.ts',
|
|
36
|
+
newPath: '/dev/null',
|
|
37
|
+
changeType: 'delete',
|
|
38
|
+
hunks: []
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
const previous: QaIndex = {
|
|
43
|
+
feature_id: 'feature_a',
|
|
44
|
+
version: 3,
|
|
45
|
+
source_diff_ref: 'old',
|
|
46
|
+
items: [
|
|
47
|
+
{
|
|
48
|
+
path: 'src/a.ts',
|
|
49
|
+
hunks: [{ start_line: 10, end_line: 12, change_type: 'modify' }],
|
|
50
|
+
required_tests: ['old'],
|
|
51
|
+
status: 'passed',
|
|
52
|
+
last_run_at: '2025-01-01T00:00:00.000Z',
|
|
53
|
+
evidence_refs: ['evidence-a']
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const next = buildQaIndex('feature_a', parsedDiff, ['default:fast:lint'], previous);
|
|
59
|
+
|
|
60
|
+
expect(next.version).toBe(4);
|
|
61
|
+
expect(next.items[0]).toMatchObject({
|
|
62
|
+
path: 'src/a.ts',
|
|
63
|
+
status: 'passed',
|
|
64
|
+
last_run_at: '2025-01-01T00:00:00.000Z',
|
|
65
|
+
evidence_refs: ['evidence-a'],
|
|
66
|
+
required_tests: ['default:fast:lint']
|
|
67
|
+
});
|
|
68
|
+
expect(next.items[1]).toMatchObject({
|
|
69
|
+
path: 'src/removed.ts',
|
|
70
|
+
status: 'pending'
|
|
71
|
+
});
|
|
72
|
+
expect(next.items[1].hunks[0]).toEqual({
|
|
73
|
+
start_line: 1,
|
|
74
|
+
end_line: 1,
|
|
75
|
+
change_type: 'delete'
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('GIVEN_index_items_WHEN_summarizing_THEN_counts_statuses_and_pending_by_file', () => {
|
|
80
|
+
const index: QaIndex = {
|
|
81
|
+
feature_id: 'feature_a',
|
|
82
|
+
version: 1,
|
|
83
|
+
source_diff_ref: 'ref',
|
|
84
|
+
items: [
|
|
85
|
+
{
|
|
86
|
+
path: 'src/a.ts',
|
|
87
|
+
hunks: [{ start_line: 1, end_line: 2, change_type: 'modify' }],
|
|
88
|
+
required_tests: ['fast'],
|
|
89
|
+
status: 'pending'
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
path: 'src/b.ts',
|
|
93
|
+
hunks: [{ start_line: 5, end_line: 6, change_type: 'add' }],
|
|
94
|
+
required_tests: ['full'],
|
|
95
|
+
status: 'failed'
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const summary = summarizeQaIndex(index);
|
|
101
|
+
expect(summary.summary).toEqual({
|
|
102
|
+
pending: 1,
|
|
103
|
+
running: 0,
|
|
104
|
+
passed: 0,
|
|
105
|
+
failed: 1,
|
|
106
|
+
waived: 0
|
|
107
|
+
});
|
|
108
|
+
expect(summary.pending_by_file).toEqual({
|
|
109
|
+
'src/a.ts': [
|
|
110
|
+
{
|
|
111
|
+
hunks: [{ start_line: 1, end_line: 2, change_type: 'modify' }],
|
|
112
|
+
required_tests: ['fast']
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('GIVEN_matching_expected_version_WHEN_applying_updates_THEN_updates_status_and_evidence', () => {
|
|
119
|
+
const index: QaIndex = {
|
|
120
|
+
feature_id: 'feature_a',
|
|
121
|
+
version: 2,
|
|
122
|
+
source_diff_ref: 'ref',
|
|
123
|
+
items: [
|
|
124
|
+
{
|
|
125
|
+
path: 'src/a.ts',
|
|
126
|
+
hunks: [{ start_line: 1, end_line: 3, change_type: 'modify' }],
|
|
127
|
+
required_tests: ['fast'],
|
|
128
|
+
status: 'pending',
|
|
129
|
+
evidence_refs: ['existing']
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const next = applyQaUpdates(
|
|
135
|
+
index,
|
|
136
|
+
2,
|
|
137
|
+
[
|
|
138
|
+
{
|
|
139
|
+
path: 'src/a.ts',
|
|
140
|
+
hunk: { start_line: 1, end_line: 3, change_type: 'modify' },
|
|
141
|
+
status: 'passed'
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
['new-evidence', 'existing']
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
expect(next.version).toBe(3);
|
|
148
|
+
expect(next.items[0].status).toBe('passed');
|
|
149
|
+
expect(next.items[0].last_run_at).toBeTruthy();
|
|
150
|
+
expect(next.items[0].evidence_refs).toEqual(['existing', 'new-evidence']);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('GIVEN_invalid_update_inputs_WHEN_applying_updates_THEN_throws_invalid_argument', () => {
|
|
154
|
+
const index: QaIndex = {
|
|
155
|
+
feature_id: 'feature_a',
|
|
156
|
+
version: 1,
|
|
157
|
+
source_diff_ref: 'ref',
|
|
158
|
+
items: [
|
|
159
|
+
{
|
|
160
|
+
path: 'src/a.ts',
|
|
161
|
+
hunks: [{ start_line: 1, end_line: 1, change_type: 'modify' }],
|
|
162
|
+
required_tests: ['fast'],
|
|
163
|
+
status: 'pending'
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
expect(() =>
|
|
169
|
+
applyQaUpdates(index, 1, [
|
|
170
|
+
{
|
|
171
|
+
path: '',
|
|
172
|
+
hunk: { start_line: 1, end_line: 1, change_type: 'modify' },
|
|
173
|
+
status: 'failed'
|
|
174
|
+
}
|
|
175
|
+
])
|
|
176
|
+
).toThrow('invalid_argument');
|
|
177
|
+
|
|
178
|
+
expect(() =>
|
|
179
|
+
applyQaUpdates(index, 1, [
|
|
180
|
+
{
|
|
181
|
+
path: 'src/missing.ts',
|
|
182
|
+
hunk: { start_line: 1, end_line: 1, change_type: 'modify' },
|
|
183
|
+
status: 'failed'
|
|
184
|
+
}
|
|
185
|
+
])
|
|
186
|
+
).toThrow('invalid_argument');
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('GIVEN_mismatched_expected_version_WHEN_applying_updates_THEN_throws_version_conflict', () => {
|
|
190
|
+
const index: QaIndex = {
|
|
191
|
+
feature_id: 'feature_a',
|
|
192
|
+
version: 5,
|
|
193
|
+
source_diff_ref: 'ref',
|
|
194
|
+
items: []
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
expect(() => applyQaUpdates(index, 4, [])).toThrow('qa_index_version_conflict');
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it('GIVEN_diff_entries_without_paths_WHEN_building_index_THEN_skips_invalid_entries', () => {
|
|
201
|
+
const next = buildQaIndex(
|
|
202
|
+
'feature_paths',
|
|
203
|
+
[
|
|
204
|
+
{
|
|
205
|
+
oldPath: '',
|
|
206
|
+
newPath: '',
|
|
207
|
+
changeType: 'modify',
|
|
208
|
+
hunks: []
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
['default:fast:lint'],
|
|
212
|
+
null
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
expect(next.items).toEqual([]);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
it('GIVEN_missing_items_collection_WHEN_summarizing_THEN_returns_zeroed_summary', () => {
|
|
219
|
+
const summary = summarizeQaIndex({
|
|
220
|
+
feature_id: 'feature_sparse',
|
|
221
|
+
version: 1,
|
|
222
|
+
source_diff_ref: 'ref'
|
|
223
|
+
} as unknown as QaIndex);
|
|
224
|
+
|
|
225
|
+
expect(summary.summary).toEqual({
|
|
226
|
+
pending: 0,
|
|
227
|
+
running: 0,
|
|
228
|
+
passed: 0,
|
|
229
|
+
failed: 0,
|
|
230
|
+
waived: 0
|
|
231
|
+
});
|
|
232
|
+
expect(summary.pending_by_file).toEqual({});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('GIVEN_missing_modes_WHEN_generating_required_tests_THEN_returns_empty_list', () => {
|
|
236
|
+
expect(makeRequiredTests('default', {})).toEqual([]);
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
it('GIVEN_sparse_previous_items_or_unknown_statuses_WHEN_building_or_summarizing_THEN_uses_null_safe_defaults', () => {
|
|
240
|
+
const rebuilt = buildQaIndex(
|
|
241
|
+
'feature_sparse',
|
|
242
|
+
[
|
|
243
|
+
{
|
|
244
|
+
oldPath: 'src/a.ts',
|
|
245
|
+
newPath: 'src/a.ts',
|
|
246
|
+
changeType: 'modify',
|
|
247
|
+
hunks: [{ start_line: 1, end_line: 2, change_type: 'modify' }]
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
['default:fast:lint'],
|
|
251
|
+
{
|
|
252
|
+
feature_id: 'feature_sparse',
|
|
253
|
+
version: 1,
|
|
254
|
+
source_diff_ref: 'old',
|
|
255
|
+
items: [{ path: 'src/a.ts', status: 'passed' } as any]
|
|
256
|
+
} as QaIndex
|
|
257
|
+
);
|
|
258
|
+
expect(rebuilt.items[0]?.status).toBe('pending');
|
|
259
|
+
|
|
260
|
+
const summary = summarizeQaIndex({
|
|
261
|
+
feature_id: 'feature_unknown',
|
|
262
|
+
version: 1,
|
|
263
|
+
source_diff_ref: 'ref',
|
|
264
|
+
items: [
|
|
265
|
+
{
|
|
266
|
+
path: 'src/unknown.ts',
|
|
267
|
+
hunks: [{ start_line: 1, end_line: 1, change_type: 'modify' }],
|
|
268
|
+
required_tests: ['fast'],
|
|
269
|
+
status: 'custom' as any
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
});
|
|
273
|
+
expect(summary.summary).toMatchObject({
|
|
274
|
+
custom: 1
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it('GIVEN_sparse_items_or_missing_evidence_WHEN_applying_updates_THEN_handles_defaults', () => {
|
|
279
|
+
const sparse = applyQaUpdates(
|
|
280
|
+
{
|
|
281
|
+
feature_id: 'feature_sparse_apply',
|
|
282
|
+
version: 3,
|
|
283
|
+
source_diff_ref: 'ref',
|
|
284
|
+
items: [{ path: 'src/a.ts', required_tests: ['fast'], status: 'pending' } as any]
|
|
285
|
+
} as QaIndex,
|
|
286
|
+
3,
|
|
287
|
+
[]
|
|
288
|
+
);
|
|
289
|
+
expect(sparse.version).toBe(4);
|
|
290
|
+
|
|
291
|
+
const updated = applyQaUpdates(
|
|
292
|
+
{
|
|
293
|
+
feature_id: 'feature_evidence',
|
|
294
|
+
version: 1,
|
|
295
|
+
source_diff_ref: 'ref',
|
|
296
|
+
items: [
|
|
297
|
+
{
|
|
298
|
+
path: 'src/a.ts',
|
|
299
|
+
hunks: [{ start_line: 2, end_line: 3, change_type: 'modify' }],
|
|
300
|
+
required_tests: ['fast'],
|
|
301
|
+
status: 'pending'
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
},
|
|
305
|
+
1,
|
|
306
|
+
[
|
|
307
|
+
{
|
|
308
|
+
path: 'src/a.ts',
|
|
309
|
+
hunk: { start_line: 2, end_line: 3, change_type: 'modify' },
|
|
310
|
+
status: 'passed'
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
['evidence-1']
|
|
314
|
+
);
|
|
315
|
+
expect(updated.items[0]?.evidence_refs).toEqual(['evidence-1']);
|
|
316
|
+
});
|
|
317
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { ERROR_CODES } from '../src/core/error-codes.js';
|
|
3
|
+
import { fail, ok, withSuggestedActions } from '../src/core/response.js';
|
|
4
|
+
|
|
5
|
+
describe('response helpers', () => {
|
|
6
|
+
it('GIVEN_data_without_evidence_WHEN_ok_THEN_returns_minimal_success_shape', () => {
|
|
7
|
+
expect(ok({ feature_id: 'feature_a' })).toEqual({
|
|
8
|
+
ok: true,
|
|
9
|
+
data: { feature_id: 'feature_a' }
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('GIVEN_evidence_WHEN_ok_THEN_includes_evidence', () => {
|
|
14
|
+
expect(ok({ accepted: true }, { trace_id: 'trace-1' })).toEqual({
|
|
15
|
+
ok: true,
|
|
16
|
+
data: { accepted: true },
|
|
17
|
+
evidence: { trace_id: 'trace-1' }
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('GIVEN_known_error_code_WHEN_fail_THEN_preserves_code', () => {
|
|
22
|
+
const response = fail(ERROR_CODES.INVALID_ARGUMENT, 'bad input', { path: 'x' });
|
|
23
|
+
expect(response.error.code).toBe(ERROR_CODES.INVALID_ARGUMENT);
|
|
24
|
+
expect(response.error.details).toEqual({ path: 'x' });
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('GIVEN_unknown_error_code_WHEN_fail_THEN_normalizes_to_internal_error', () => {
|
|
28
|
+
const response = fail('unknown_code', 'boom');
|
|
29
|
+
expect(response.error.code).toBe(ERROR_CODES.INTERNAL_ERROR);
|
|
30
|
+
expect(response.error.message).toBe('boom');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('GIVEN_details_WHEN_withSuggestedActions_THEN_adds_defaults_and_actions', () => {
|
|
34
|
+
const details = withSuggestedActions({ feature_id: 'feature_a' }, ['Retry', 'Escalate']);
|
|
35
|
+
expect(details).toEqual({
|
|
36
|
+
feature_id: 'feature_a',
|
|
37
|
+
retryable: false,
|
|
38
|
+
requires_human: false,
|
|
39
|
+
suggested_next_actions: ['Retry', 'Escalate']
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('GIVEN_existing_flags_WHEN_withSuggestedActions_THEN_keeps_existing_flags', () => {
|
|
44
|
+
const details = withSuggestedActions(
|
|
45
|
+
{ retryable: true, requires_human: true, reason: 'manual' },
|
|
46
|
+
['Open incident']
|
|
47
|
+
);
|
|
48
|
+
expect(details).toEqual({
|
|
49
|
+
retryable: true,
|
|
50
|
+
requires_human: true,
|
|
51
|
+
reason: 'manual',
|
|
52
|
+
suggested_next_actions: ['Open incident']
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { TOOLS } from '../src/core/constants.js';
|
|
3
|
+
import { RunCoordinator } from '../src/supervisor/run-coordinator.js';
|
|
4
|
+
|
|
5
|
+
describe('RunCoordinator iteration behavior', () => {
|
|
6
|
+
it('GIVEN_configured_max_iterations_WHEN_starting_run_THEN_executes_each_wave_exactly_that_many_times', async () => {
|
|
7
|
+
const kernel = {
|
|
8
|
+
ensureLoaded: vi.fn(async () => undefined),
|
|
9
|
+
recoverFromState: vi.fn(async () => ({ data: { recovered: true } })),
|
|
10
|
+
acquireRunLease: vi.fn(async () => ({ data: { took_over_stale: false } })),
|
|
11
|
+
pruneFeatureSessionAssignments: vi.fn(async () => ({ data: { removed: [] as string[] } })),
|
|
12
|
+
getRuntimeSessions: vi.fn(async () => ({
|
|
13
|
+
run_id: 'run:test',
|
|
14
|
+
owner_instance_id: 'owner:test',
|
|
15
|
+
orchestrator_session_id: 'orch:test',
|
|
16
|
+
feature_sessions: {}
|
|
17
|
+
}))
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const provider = {
|
|
21
|
+
selection: {
|
|
22
|
+
provider: 'custom',
|
|
23
|
+
model: 'model-test'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const toolCaller = {
|
|
28
|
+
callTool: vi.fn(async (_role: string, toolName: string) => {
|
|
29
|
+
if (toolName === TOOLS.REPORT_DASHBOARD) {
|
|
30
|
+
return { ok: true, data: { features: [] } };
|
|
31
|
+
}
|
|
32
|
+
return { ok: true, data: {} };
|
|
33
|
+
})
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const state = {
|
|
37
|
+
runId: 'run:test',
|
|
38
|
+
ownerInstanceId: 'owner:test',
|
|
39
|
+
orchestratorSessionId: 'orch:test',
|
|
40
|
+
sessionsByFeature: new Map<string, { planner: string; builder: string; qa: string }>(),
|
|
41
|
+
queue: [] as Array<{ feature_id: string }>,
|
|
42
|
+
runMetadata: {}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const sessionOrchestrator = {
|
|
46
|
+
ensureGlobalOrchestratorSession: vi.fn(async () => undefined),
|
|
47
|
+
cleanupOrphanWorkerSessions: vi.fn(async () => undefined),
|
|
48
|
+
initializeFeatureCluster: vi.fn(async () => undefined),
|
|
49
|
+
reconcileQueuedFeatures: vi.fn(async () => undefined),
|
|
50
|
+
enforceActiveFeatureInvariant: vi.fn(async () => undefined)
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const planningWaveExecutor = {
|
|
54
|
+
run: vi.fn(async () => undefined),
|
|
55
|
+
runPostQaReconciliation: vi.fn(async () => undefined)
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const buildWaveExecutor = {
|
|
59
|
+
run: vi.fn(async () => undefined)
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const qaWaveExecutor = {
|
|
63
|
+
run: vi.fn(async () => undefined)
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const leaseHeartbeatService = {
|
|
67
|
+
renew: vi.fn(async () => undefined)
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const coordinator = new RunCoordinator({
|
|
71
|
+
kernel: kernel as never,
|
|
72
|
+
provider: provider as never,
|
|
73
|
+
toolCaller: toolCaller as never,
|
|
74
|
+
state: state as never,
|
|
75
|
+
sessionOrchestrator: sessionOrchestrator as never,
|
|
76
|
+
planningWaveExecutor: planningWaveExecutor as never,
|
|
77
|
+
buildWaveExecutor: buildWaveExecutor as never,
|
|
78
|
+
qaWaveExecutor: qaWaveExecutor as never,
|
|
79
|
+
leaseHeartbeatService: leaseHeartbeatService as never,
|
|
80
|
+
maxActiveFeatures: 5,
|
|
81
|
+
maxParallelGateRuns: 2,
|
|
82
|
+
maxIterationsPerPhase: 3,
|
|
83
|
+
takeoverStaleRun: false,
|
|
84
|
+
providerConfigRefHash: () => 'hash'
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const result = await coordinator.start([{ feature_id: 'feature_b' }, { feature_id: 'feature_a' }]);
|
|
88
|
+
|
|
89
|
+
expect(result.queue_depth).toBe(0);
|
|
90
|
+
expect(leaseHeartbeatService.renew).toHaveBeenCalledTimes(3);
|
|
91
|
+
expect(planningWaveExecutor.run).toHaveBeenCalledTimes(3);
|
|
92
|
+
expect(buildWaveExecutor.run).toHaveBeenCalledTimes(3);
|
|
93
|
+
expect(qaWaveExecutor.run).toHaveBeenCalledTimes(3);
|
|
94
|
+
expect(planningWaveExecutor.runPostQaReconciliation).toHaveBeenCalledTimes(3);
|
|
95
|
+
expect(planningWaveExecutor.run).toHaveBeenNthCalledWith(1, ['feature_a', 'feature_b']);
|
|
96
|
+
expect(planningWaveExecutor.runPostQaReconciliation).toHaveBeenNthCalledWith(1, ['feature_a', 'feature_b'], 1);
|
|
97
|
+
expect(planningWaveExecutor.runPostQaReconciliation).toHaveBeenNthCalledWith(2, ['feature_a', 'feature_b'], 2);
|
|
98
|
+
expect(planningWaveExecutor.runPostQaReconciliation).toHaveBeenNthCalledWith(3, ['feature_a', 'feature_b'], 3);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('GIVEN_terminal_active_feature_WHEN_slots_free_up_THEN_promotes_next_queued_feature_deterministically', async () => {
|
|
102
|
+
const kernel = {
|
|
103
|
+
ensureLoaded: vi.fn(async () => undefined),
|
|
104
|
+
recoverFromState: vi.fn(async () => ({ data: { recovered: true } })),
|
|
105
|
+
acquireRunLease: vi.fn(async () => ({ data: { took_over_stale: false } })),
|
|
106
|
+
pruneFeatureSessionAssignments: vi.fn(async () => ({ data: { removed: [] as string[] } })),
|
|
107
|
+
getRuntimeSessions: vi.fn(async () => ({
|
|
108
|
+
run_id: 'run:test',
|
|
109
|
+
owner_instance_id: 'owner:test',
|
|
110
|
+
orchestrator_session_id: 'orch:test',
|
|
111
|
+
feature_sessions: {}
|
|
112
|
+
}))
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const provider = {
|
|
116
|
+
selection: {
|
|
117
|
+
provider: 'custom',
|
|
118
|
+
model: 'model-test'
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const statusReads = new Map<string, string[]>([
|
|
123
|
+
['feature_a', ['planning', 'merged']],
|
|
124
|
+
['feature_b', ['planning']]
|
|
125
|
+
]);
|
|
126
|
+
|
|
127
|
+
const toolCaller = {
|
|
128
|
+
callTool: vi.fn(async (_role: string, toolName: string, args: Record<string, unknown>) => {
|
|
129
|
+
if (toolName === TOOLS.FEATURE_STATE_GET) {
|
|
130
|
+
const featureId = String(args.feature_id);
|
|
131
|
+
const states = statusReads.get(featureId) ?? ['planning'];
|
|
132
|
+
const status = states.shift() ?? states.at(-1) ?? 'planning';
|
|
133
|
+
statusReads.set(featureId, states.length === 0 ? [status] : states);
|
|
134
|
+
return {
|
|
135
|
+
ok: true,
|
|
136
|
+
data: {
|
|
137
|
+
front_matter: {
|
|
138
|
+
status
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
if (toolName === TOOLS.REPORT_DASHBOARD) {
|
|
144
|
+
return { ok: true, data: { features: [] } };
|
|
145
|
+
}
|
|
146
|
+
return { ok: true, data: {} };
|
|
147
|
+
})
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const state = {
|
|
151
|
+
runId: 'run:test',
|
|
152
|
+
ownerInstanceId: 'owner:test',
|
|
153
|
+
orchestratorSessionId: 'orch:test',
|
|
154
|
+
sessionsByFeature: new Map<string, { planner: string; builder: string; qa: string }>(),
|
|
155
|
+
queue: [] as Array<{ feature_id: string }>,
|
|
156
|
+
runMetadata: {}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const sessionOrchestrator = {
|
|
160
|
+
ensureGlobalOrchestratorSession: vi.fn(async () => undefined),
|
|
161
|
+
cleanupOrphanWorkerSessions: vi.fn(async () => undefined),
|
|
162
|
+
initializeFeatureCluster: vi.fn(async (featureId: string) => {
|
|
163
|
+
state.sessionsByFeature.set(featureId, {
|
|
164
|
+
planner: `${featureId}:planner`,
|
|
165
|
+
builder: `${featureId}:builder`,
|
|
166
|
+
qa: `${featureId}:qa`
|
|
167
|
+
});
|
|
168
|
+
}),
|
|
169
|
+
closeFeatureCluster: vi.fn(async (featureId: string) => {
|
|
170
|
+
state.sessionsByFeature.delete(featureId);
|
|
171
|
+
}),
|
|
172
|
+
reconcileQueuedFeatures: vi.fn(async () => undefined),
|
|
173
|
+
enforceActiveFeatureInvariant: vi.fn(async () => undefined)
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const planningWaveExecutor = {
|
|
177
|
+
run: vi.fn(async () => undefined),
|
|
178
|
+
runPostQaReconciliation: vi.fn(async () => undefined)
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const buildWaveExecutor = {
|
|
182
|
+
run: vi.fn(async () => undefined)
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const qaWaveExecutor = {
|
|
186
|
+
run: vi.fn(async () => undefined)
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const leaseHeartbeatService = {
|
|
190
|
+
renew: vi.fn(async () => undefined)
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const coordinator = new RunCoordinator({
|
|
194
|
+
kernel: kernel as never,
|
|
195
|
+
provider: provider as never,
|
|
196
|
+
toolCaller: toolCaller as never,
|
|
197
|
+
state: state as never,
|
|
198
|
+
sessionOrchestrator: sessionOrchestrator as never,
|
|
199
|
+
planningWaveExecutor: planningWaveExecutor as never,
|
|
200
|
+
buildWaveExecutor: buildWaveExecutor as never,
|
|
201
|
+
qaWaveExecutor: qaWaveExecutor as never,
|
|
202
|
+
leaseHeartbeatService: leaseHeartbeatService as never,
|
|
203
|
+
maxActiveFeatures: 1,
|
|
204
|
+
maxParallelGateRuns: 2,
|
|
205
|
+
maxIterationsPerPhase: 2,
|
|
206
|
+
takeoverStaleRun: false,
|
|
207
|
+
providerConfigRefHash: () => 'hash'
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
const result = await coordinator.start([{ feature_id: 'feature_a' }, { feature_id: 'feature_b' }]);
|
|
211
|
+
|
|
212
|
+
expect(result.queue_depth).toBe(0);
|
|
213
|
+
expect(sessionOrchestrator.initializeFeatureCluster).toHaveBeenNthCalledWith(1, 'feature_a');
|
|
214
|
+
expect(sessionOrchestrator.closeFeatureCluster).toHaveBeenCalledWith('feature_a');
|
|
215
|
+
expect(sessionOrchestrator.initializeFeatureCluster).toHaveBeenNthCalledWith(2, 'feature_b');
|
|
216
|
+
expect(planningWaveExecutor.run).toHaveBeenNthCalledWith(1, ['feature_a']);
|
|
217
|
+
expect(planningWaveExecutor.run).toHaveBeenNthCalledWith(2, ['feature_b']);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it('GIVEN_orchestrator_priority_request_WHEN_running_iteration_THEN_reorders_active_feature_execution', async () => {
|
|
221
|
+
const kernel = {
|
|
222
|
+
ensureLoaded: vi.fn(async () => undefined),
|
|
223
|
+
recoverFromState: vi.fn(async () => ({ data: { recovered: true } })),
|
|
224
|
+
acquireRunLease: vi.fn(async () => ({ data: { took_over_stale: false } })),
|
|
225
|
+
pruneFeatureSessionAssignments: vi.fn(async () => ({ data: { removed: [] as string[] } })),
|
|
226
|
+
getRuntimeSessions: vi.fn(async () => ({
|
|
227
|
+
run_id: 'run:test',
|
|
228
|
+
owner_instance_id: 'owner:test',
|
|
229
|
+
orchestrator_session_id: 'orch:test',
|
|
230
|
+
feature_sessions: {}
|
|
231
|
+
}))
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const provider = {
|
|
235
|
+
selection: {
|
|
236
|
+
provider: 'custom',
|
|
237
|
+
model: 'model-test'
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const toolCaller = {
|
|
242
|
+
callTool: vi.fn(async (_role: string, toolName: string, _args: Record<string, unknown>) => {
|
|
243
|
+
if (toolName === TOOLS.FEATURE_STATE_GET) {
|
|
244
|
+
return {
|
|
245
|
+
ok: true,
|
|
246
|
+
data: {
|
|
247
|
+
front_matter: {
|
|
248
|
+
status: 'planning'
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
if (toolName === TOOLS.REPORT_DASHBOARD) {
|
|
254
|
+
return { ok: true, data: { features: [] } };
|
|
255
|
+
}
|
|
256
|
+
return { ok: true, data: {} };
|
|
257
|
+
})
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
const state = {
|
|
261
|
+
runId: 'run:test',
|
|
262
|
+
ownerInstanceId: 'owner:test',
|
|
263
|
+
orchestratorSessionId: 'orch:test',
|
|
264
|
+
sessionsByFeature: new Map<string, { planner: string; builder: string; qa: string }>(),
|
|
265
|
+
queue: [] as Array<{ feature_id: string }>,
|
|
266
|
+
runMetadata: {}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
const sessionOrchestrator = {
|
|
270
|
+
ensureGlobalOrchestratorSession: vi.fn(async () => undefined),
|
|
271
|
+
cleanupOrphanWorkerSessions: vi.fn(async () => undefined),
|
|
272
|
+
initializeFeatureCluster: vi.fn(async (featureId: string) => {
|
|
273
|
+
state.sessionsByFeature.set(featureId, {
|
|
274
|
+
planner: `${featureId}:planner`,
|
|
275
|
+
builder: `${featureId}:builder`,
|
|
276
|
+
qa: `${featureId}:qa`
|
|
277
|
+
});
|
|
278
|
+
}),
|
|
279
|
+
closeFeatureCluster: vi.fn(async (_featureId: string) => undefined),
|
|
280
|
+
reconcileQueuedFeatures: vi.fn(async () => undefined),
|
|
281
|
+
enforceActiveFeatureInvariant: vi.fn(async () => undefined)
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const planningWaveExecutor = {
|
|
285
|
+
run: vi.fn(async () => undefined),
|
|
286
|
+
runPostQaReconciliation: vi.fn(async () => undefined)
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
const buildWaveExecutor = {
|
|
290
|
+
run: vi.fn(async () => undefined)
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const qaWaveExecutor = {
|
|
294
|
+
run: vi.fn(async () => undefined)
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
const leaseHeartbeatService = {
|
|
298
|
+
renew: vi.fn(async () => undefined)
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
const workerDecisionRunner = {
|
|
302
|
+
execute: vi.fn(async () => ({
|
|
303
|
+
planSubmission: false,
|
|
304
|
+
patchApplied: false,
|
|
305
|
+
noteLogged: false,
|
|
306
|
+
requestHandled: true,
|
|
307
|
+
priorityOrder: ['feature_b'],
|
|
308
|
+
toolResults: []
|
|
309
|
+
}))
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
const coordinator = new RunCoordinator({
|
|
313
|
+
kernel: kernel as never,
|
|
314
|
+
provider: provider as never,
|
|
315
|
+
toolCaller: toolCaller as never,
|
|
316
|
+
state: state as never,
|
|
317
|
+
sessionOrchestrator: sessionOrchestrator as never,
|
|
318
|
+
planningWaveExecutor: planningWaveExecutor as never,
|
|
319
|
+
buildWaveExecutor: buildWaveExecutor as never,
|
|
320
|
+
qaWaveExecutor: qaWaveExecutor as never,
|
|
321
|
+
leaseHeartbeatService: leaseHeartbeatService as never,
|
|
322
|
+
maxActiveFeatures: 2,
|
|
323
|
+
maxParallelGateRuns: 2,
|
|
324
|
+
maxIterationsPerPhase: 1,
|
|
325
|
+
takeoverStaleRun: false,
|
|
326
|
+
providerConfigRefHash: () => 'hash',
|
|
327
|
+
workerDecisionRunner: workerDecisionRunner as never
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
await coordinator.start([{ feature_id: 'feature_a' }, { feature_id: 'feature_b' }]);
|
|
331
|
+
|
|
332
|
+
expect(planningWaveExecutor.run).toHaveBeenNthCalledWith(1, ['feature_b', 'feature_a']);
|
|
333
|
+
});
|
|
334
|
+
});
|