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,229 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { STATUS, TOOLS } from '../src/core/constants.js';
|
|
3
|
+
import { PlanningWaveExecutor } from '../src/supervisor/planning-wave-executor.js';
|
|
4
|
+
|
|
5
|
+
function basePlan(featureId: string) {
|
|
6
|
+
return {
|
|
7
|
+
feature_id: featureId,
|
|
8
|
+
plan_version: 2,
|
|
9
|
+
summary: `Plan for ${featureId}`,
|
|
10
|
+
allowed_areas: ['apps/control-plane'],
|
|
11
|
+
forbidden_areas: [],
|
|
12
|
+
base_ref: 'HEAD',
|
|
13
|
+
files: {
|
|
14
|
+
create: [],
|
|
15
|
+
modify: ['apps/control-plane/src/file.ts'],
|
|
16
|
+
delete: []
|
|
17
|
+
},
|
|
18
|
+
contracts: {
|
|
19
|
+
openapi: 'none',
|
|
20
|
+
events: 'none',
|
|
21
|
+
db: 'none'
|
|
22
|
+
},
|
|
23
|
+
acceptance_criteria: ['Existing acceptance criterion.'],
|
|
24
|
+
gate_profile: 'default'
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
describe('PlanningWaveExecutor post-QA reconciliation', () => {
|
|
29
|
+
it('GIVEN_worker_emits_plan_submission_WHEN_running_planning_wave_THEN_skips_fallback_plan_generation', async () => {
|
|
30
|
+
const featureId = 'feature_worker_plan';
|
|
31
|
+
const toolCaller = {
|
|
32
|
+
callTool: vi.fn(async (_role: string, toolName: string) => {
|
|
33
|
+
if (toolName === TOOLS.FEATURE_GET_CONTEXT) {
|
|
34
|
+
return {
|
|
35
|
+
ok: true,
|
|
36
|
+
data: {
|
|
37
|
+
feature_id: featureId,
|
|
38
|
+
state: {
|
|
39
|
+
front_matter: {
|
|
40
|
+
status: STATUS.PLANNING
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
plan: null
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return { ok: true, data: {} };
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const planGenerator = {
|
|
52
|
+
generateInitialPlan: vi.fn(async () => ({ feature_id: featureId }))
|
|
53
|
+
};
|
|
54
|
+
const workerDecisionRunner = {
|
|
55
|
+
execute: vi.fn(async () => ({
|
|
56
|
+
planSubmission: true,
|
|
57
|
+
patchApplied: false,
|
|
58
|
+
noteLogged: true,
|
|
59
|
+
requestHandled: false,
|
|
60
|
+
priorityOrder: [],
|
|
61
|
+
toolResults: []
|
|
62
|
+
}))
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const executor = new PlanningWaveExecutor({
|
|
66
|
+
toolCaller: toolCaller as never,
|
|
67
|
+
planGenerator: planGenerator as never,
|
|
68
|
+
workerDecisionRunner: workerDecisionRunner as never
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
await executor.run([featureId]);
|
|
72
|
+
|
|
73
|
+
expect(workerDecisionRunner.execute).toHaveBeenCalledWith(
|
|
74
|
+
expect.objectContaining({
|
|
75
|
+
role: 'planner',
|
|
76
|
+
featureId
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
expect(planGenerator.generateInitialPlan).not.toHaveBeenCalled();
|
|
80
|
+
const planSubmitCalls = toolCaller.callTool.mock.calls.filter((call) => call[1] === TOOLS.PLAN_SUBMIT);
|
|
81
|
+
expect(planSubmitCalls).toHaveLength(0);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('GIVEN_post_qa_gaps_WHEN_reconciling_THEN_emits_plan_update_with_edge_case_hardening', async () => {
|
|
85
|
+
const featureId = 'feature_gap';
|
|
86
|
+
const toolCaller = {
|
|
87
|
+
callTool: vi.fn(async (_role: string, toolName: string, args: Record<string, unknown>) => {
|
|
88
|
+
if (toolName === TOOLS.FEATURE_GET_CONTEXT) {
|
|
89
|
+
return {
|
|
90
|
+
ok: true,
|
|
91
|
+
data: {
|
|
92
|
+
feature_id: featureId,
|
|
93
|
+
spec: 'Handle missing inputs and timeout retries under concurrent requests.',
|
|
94
|
+
state: {
|
|
95
|
+
front_matter: {
|
|
96
|
+
status: STATUS.BLOCKED
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
plan: basePlan(featureId),
|
|
100
|
+
qa_test_index: {
|
|
101
|
+
summary: {
|
|
102
|
+
pending: 1,
|
|
103
|
+
failed: 1,
|
|
104
|
+
running: 0,
|
|
105
|
+
passed: 0,
|
|
106
|
+
waived: 0
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
latest_evidence: {
|
|
110
|
+
overall: 'fail'
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (toolName === TOOLS.PLAN_UPDATE) {
|
|
116
|
+
return { ok: true, data: { accepted: true, plan_version: 3 } };
|
|
117
|
+
}
|
|
118
|
+
if (toolName === TOOLS.FEATURE_LOG_APPEND) {
|
|
119
|
+
return { ok: true, data: { appended: true } };
|
|
120
|
+
}
|
|
121
|
+
throw new Error(`unexpected_tool:${toolName}:${String(args.feature_id ?? '')}`);
|
|
122
|
+
})
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const executor = new PlanningWaveExecutor({
|
|
126
|
+
toolCaller: toolCaller as never,
|
|
127
|
+
planGenerator: { generateInitialPlan: vi.fn(async () => ({ feature_id: featureId })) }
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
await executor.runPostQaReconciliation([featureId], 1);
|
|
131
|
+
|
|
132
|
+
const updateCall = toolCaller.callTool.mock.calls.find((call) => call[1] === TOOLS.PLAN_UPDATE);
|
|
133
|
+
expect(updateCall).toBeTruthy();
|
|
134
|
+
expect(updateCall?.[0]).toBe('planner');
|
|
135
|
+
expect(updateCall?.[2]).toMatchObject({
|
|
136
|
+
feature_id: featureId,
|
|
137
|
+
expected_plan_version: 2,
|
|
138
|
+
plan_json: {
|
|
139
|
+
plan_version: 3,
|
|
140
|
+
revision_of: 2
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const updatedPlan = updateCall?.[2].plan_json as Record<string, unknown>;
|
|
145
|
+
expect(updatedPlan.acceptance_criteria).toEqual(
|
|
146
|
+
expect.arrayContaining([
|
|
147
|
+
'Reconcile QA/gate findings against plan scope and apply corrective updates before merge.',
|
|
148
|
+
'Planner reconciliation checkpoint [status=blocked;failed=1;pending=1;latest=fail]'
|
|
149
|
+
])
|
|
150
|
+
);
|
|
151
|
+
expect(updatedPlan.risk).toEqual(
|
|
152
|
+
expect.arrayContaining([
|
|
153
|
+
'Edge-case: boundary values and size limits are covered.',
|
|
154
|
+
'Edge-case: empty/null/missing input handling is covered.',
|
|
155
|
+
'Edge-case: timeout, retry, and latency behavior is covered.',
|
|
156
|
+
'Edge-case: concurrent access and race-condition behavior are covered.'
|
|
157
|
+
])
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
const logCall = toolCaller.callTool.mock.calls.find((call) => call[1] === TOOLS.FEATURE_LOG_APPEND);
|
|
161
|
+
expect(logCall?.[0]).toBe('orchestrator');
|
|
162
|
+
const note = JSON.parse(String(logCall?.[2].note)) as Record<string, unknown>;
|
|
163
|
+
expect(note.decision).toBe('plan_update');
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('GIVEN_reconciled_post_qa_context_WHEN_reconciling_THEN_logs_no_update_and_skips_plan_update', async () => {
|
|
167
|
+
const featureId = 'feature_reconciled';
|
|
168
|
+
const edgeChecklist = [
|
|
169
|
+
'Edge-case: boundary values and size limits are covered.',
|
|
170
|
+
'Edge-case: negative-path input validation and error handling are covered.',
|
|
171
|
+
'Edge-case: dependency failure and retry behavior are covered.'
|
|
172
|
+
];
|
|
173
|
+
const toolCaller = {
|
|
174
|
+
callTool: vi.fn(async (_role: string, toolName: string, _args: Record<string, unknown>) => {
|
|
175
|
+
if (toolName === TOOLS.FEATURE_GET_CONTEXT) {
|
|
176
|
+
return {
|
|
177
|
+
ok: true,
|
|
178
|
+
data: {
|
|
179
|
+
feature_id: featureId,
|
|
180
|
+
spec: 'Simple feature flow.',
|
|
181
|
+
state: {
|
|
182
|
+
front_matter: {
|
|
183
|
+
status: STATUS.READY_TO_MERGE
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
plan: {
|
|
187
|
+
...basePlan(featureId),
|
|
188
|
+
risk: edgeChecklist
|
|
189
|
+
},
|
|
190
|
+
qa_test_index: {
|
|
191
|
+
summary: {
|
|
192
|
+
pending: 0,
|
|
193
|
+
failed: 0,
|
|
194
|
+
running: 0,
|
|
195
|
+
passed: 2,
|
|
196
|
+
waived: 0
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
latest_evidence: {
|
|
200
|
+
overall: 'pass'
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (toolName === TOOLS.FEATURE_LOG_APPEND) {
|
|
206
|
+
return { ok: true, data: { appended: true } };
|
|
207
|
+
}
|
|
208
|
+
throw new Error(`unexpected_tool:${toolName}`);
|
|
209
|
+
})
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
const executor = new PlanningWaveExecutor({
|
|
213
|
+
toolCaller: toolCaller as never,
|
|
214
|
+
planGenerator: { generateInitialPlan: vi.fn(async () => ({ feature_id: featureId })) }
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
await executor.runPostQaReconciliation([featureId], 2);
|
|
218
|
+
|
|
219
|
+
const planUpdateCalls = toolCaller.callTool.mock.calls.filter((call) => call[1] === TOOLS.PLAN_UPDATE);
|
|
220
|
+
expect(planUpdateCalls).toHaveLength(0);
|
|
221
|
+
|
|
222
|
+
const logCall = toolCaller.callTool.mock.calls.find((call) => call[1] === TOOLS.FEATURE_LOG_APPEND);
|
|
223
|
+
expect(logCall).toBeTruthy();
|
|
224
|
+
const logArgs = logCall?.[2] ?? {};
|
|
225
|
+
const note = JSON.parse(String(logArgs.note));
|
|
226
|
+
expect(note.decision).toBe('no_update');
|
|
227
|
+
expect(note.reasons).toEqual(['reconciled_no_gaps']);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { ERROR_CODES } from '../src/core/error-codes.js';
|
|
3
|
+
import { NullWorkerProvider, resolveProviderSelection } from '../src/index.js';
|
|
4
|
+
|
|
5
|
+
describe('provider selection', () => {
|
|
6
|
+
it('GIVEN_cli_env_and_config_WHEN_resolving_THEN_cli_values_win', () => {
|
|
7
|
+
const selection = resolveProviderSelection({
|
|
8
|
+
cli: {
|
|
9
|
+
agent_provider: 'custom',
|
|
10
|
+
agent_model: 'cli-model',
|
|
11
|
+
provider_config_env: 'CLI_CONFIG'
|
|
12
|
+
},
|
|
13
|
+
env: {
|
|
14
|
+
AOP_AGENT_PROVIDER: 'codex',
|
|
15
|
+
AOP_AGENT_MODEL: 'env-model',
|
|
16
|
+
AOP_PROVIDER_CONFIG_ENV: 'ENV_CONFIG'
|
|
17
|
+
},
|
|
18
|
+
agentsConfig: {
|
|
19
|
+
runtime: {
|
|
20
|
+
default_provider: 'claude',
|
|
21
|
+
default_model: 'cfg-model',
|
|
22
|
+
provider_config_env: 'CFG_CONFIG'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
expect(selection.provider).toBe('custom');
|
|
28
|
+
expect(selection.model).toBe('cli-model');
|
|
29
|
+
expect(selection.provider_config_env).toBe('CLI_CONFIG');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('GIVEN_no_provider_WHEN_resolving_THEN_throws_agent_provider_not_configured', () => {
|
|
33
|
+
expect(() =>
|
|
34
|
+
resolveProviderSelection({
|
|
35
|
+
cli: {},
|
|
36
|
+
env: {},
|
|
37
|
+
agentsConfig: {}
|
|
38
|
+
})
|
|
39
|
+
).toThrow(ERROR_CODES.AGENT_PROVIDER_NOT_CONFIGURED);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('GIVEN_unsupported_provider_WHEN_resolving_THEN_throws_unsupported_provider_error', () => {
|
|
43
|
+
expect(() =>
|
|
44
|
+
resolveProviderSelection({
|
|
45
|
+
cli: { agent_provider: 'bogus' },
|
|
46
|
+
env: {},
|
|
47
|
+
agentsConfig: {}
|
|
48
|
+
})
|
|
49
|
+
).toThrow(ERROR_CODES.UNSUPPORTED_AGENT_PROVIDER);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('GIVEN_non_custom_provider_without_credentials_WHEN_resolving_THEN_throws_provider_auth_missing', () => {
|
|
53
|
+
expect(() =>
|
|
54
|
+
resolveProviderSelection({
|
|
55
|
+
cli: { agent_provider: 'codex', provider_config_env: 'AOP_KEY' },
|
|
56
|
+
env: {},
|
|
57
|
+
agentsConfig: {}
|
|
58
|
+
})
|
|
59
|
+
).toThrow(ERROR_CODES.PROVIDER_AUTH_MISSING);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('GIVEN_non_custom_provider_without_model_WHEN_resolving_THEN_uses_default_model_name', () => {
|
|
63
|
+
const selection = resolveProviderSelection({
|
|
64
|
+
cli: {
|
|
65
|
+
agent_provider: 'codex',
|
|
66
|
+
provider_config_env: 'AOP_KEY'
|
|
67
|
+
},
|
|
68
|
+
env: {
|
|
69
|
+
AOP_KEY: 'token'
|
|
70
|
+
},
|
|
71
|
+
agentsConfig: {}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
expect(selection.model).toBe('codex-default');
|
|
75
|
+
expect(selection.provider_config_ref).toBe('token');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('GIVEN_custom_provider_without_credentials_WHEN_resolving_THEN_allows_null_config_ref', () => {
|
|
79
|
+
const selection = resolveProviderSelection({
|
|
80
|
+
cli: {
|
|
81
|
+
agent_provider: 'custom'
|
|
82
|
+
},
|
|
83
|
+
env: {},
|
|
84
|
+
agentsConfig: {}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
expect(selection.provider).toBe('custom');
|
|
88
|
+
expect(selection.provider_config_ref).toBeNull();
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
describe('NullWorkerProvider', () => {
|
|
93
|
+
const selection = {
|
|
94
|
+
provider: 'custom' as const,
|
|
95
|
+
model: 'test-model',
|
|
96
|
+
provider_config_env: null,
|
|
97
|
+
provider_config_ref: null
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
it('GIVEN_system_prompt_WHEN_createSession_THEN_marks_prompt_loaded', async () => {
|
|
101
|
+
const provider = new NullWorkerProvider(selection);
|
|
102
|
+
const session = await provider.createSession('planner', 'feature_one', 'prompt content');
|
|
103
|
+
|
|
104
|
+
expect(session.role).toBe('planner');
|
|
105
|
+
expect(session.feature_id).toBe('feature_one');
|
|
106
|
+
expect(session.session_id).toMatch(/^planner-feature_one-/);
|
|
107
|
+
expect(session.system_prompt_loaded).toBe(true);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('GIVEN_planner_role_WHEN_runWorker_THEN_returns_context_snapshot', async () => {
|
|
111
|
+
const provider = new NullWorkerProvider(selection);
|
|
112
|
+
const output = await provider.runWorker({
|
|
113
|
+
role: 'planner',
|
|
114
|
+
feature_id: 'feature_two',
|
|
115
|
+
context_bundle: { state: { front_matter: { status: 'building' } } }
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
expect(output).toMatchObject({
|
|
119
|
+
type: 'NOTE',
|
|
120
|
+
content: 'Planner session active for feature_two.',
|
|
121
|
+
context_snapshot: { status: 'building' }
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('GIVEN_non_planner_role_WHEN_runWorker_THEN_returns_simple_note', async () => {
|
|
126
|
+
const provider = new NullWorkerProvider(selection);
|
|
127
|
+
const output = await provider.runWorker({ role: 'qa', feature_id: 'feature_three' });
|
|
128
|
+
|
|
129
|
+
expect(output).toMatchObject({
|
|
130
|
+
type: 'NOTE',
|
|
131
|
+
content: 'qa session active for feature_three.'
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('GIVEN_planner_without_context_WHEN_runWorker_THEN_returns_unknown_status_snapshot', async () => {
|
|
136
|
+
const provider = new NullWorkerProvider(selection);
|
|
137
|
+
const output = await provider.runWorker({
|
|
138
|
+
role: 'planner',
|
|
139
|
+
feature_id: 'feature_unknown'
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
expect(output).toMatchObject({
|
|
143
|
+
type: 'NOTE',
|
|
144
|
+
content: 'Planner session active for feature_unknown.',
|
|
145
|
+
context_snapshot: { status: 'unknown' }
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('GIVEN_planner_with_non_object_state_WHEN_runWorker_THEN_handles_gracefully', async () => {
|
|
150
|
+
const provider = new NullWorkerProvider(selection);
|
|
151
|
+
const output = await provider.runWorker({
|
|
152
|
+
role: 'planner',
|
|
153
|
+
feature_id: 'feature_weird',
|
|
154
|
+
context_bundle: { state: 'invalid' as unknown as Record<string, unknown> }
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
expect(output).toMatchObject({
|
|
158
|
+
type: 'NOTE',
|
|
159
|
+
content: 'Planner session active for feature_weird.',
|
|
160
|
+
context_snapshot: { status: 'unknown' }
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('GIVEN_session_id_WHEN_closeSession_THEN_returns_closed_true', async () => {
|
|
165
|
+
const provider = new NullWorkerProvider(selection);
|
|
166
|
+
await expect(provider.closeSession('session:1')).resolves.toEqual({ closed: true });
|
|
167
|
+
});
|
|
168
|
+
});
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
5
|
+
import { QaIndexService } from '../src/application/services/qa-index-service.js';
|
|
6
|
+
import { ERROR_CODES } from '../src/core/error-codes.js';
|
|
7
|
+
|
|
8
|
+
type AnyRecord = Record<string, unknown>;
|
|
9
|
+
|
|
10
|
+
async function writeJson(filePath: string, value: unknown): Promise<void> {
|
|
11
|
+
await fs.writeFile(filePath, `${JSON.stringify(value, null, 2)}\n`, 'utf8');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
describe('QaIndexService', () => {
|
|
15
|
+
const cleanupPaths: string[] = [];
|
|
16
|
+
|
|
17
|
+
afterEach(async () => {
|
|
18
|
+
while (cleanupPaths.length > 0) {
|
|
19
|
+
const target = cleanupPaths.pop();
|
|
20
|
+
if (target) {
|
|
21
|
+
await fs.rm(target, { recursive: true, force: true });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('GIVEN_missing_index_file_WHEN_qa_test_index_get_THEN_returns_default_index_and_empty_summary', async () => {
|
|
27
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'aop-qa-index-get-'));
|
|
28
|
+
cleanupPaths.push(tempDir);
|
|
29
|
+
|
|
30
|
+
const validateSchema = vi.fn(async () => ({ valid: true }));
|
|
31
|
+
const service = new QaIndexService({
|
|
32
|
+
qaIndexPath: () => path.join(tempDir, 'qa_test_index.json'),
|
|
33
|
+
validateSchema
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const result = await service.qaTestIndexGet('feature_qa');
|
|
37
|
+
|
|
38
|
+
expect(result.data.index).toMatchObject({
|
|
39
|
+
feature_id: 'feature_qa',
|
|
40
|
+
version: 1,
|
|
41
|
+
items: []
|
|
42
|
+
});
|
|
43
|
+
expect(result.data.summary).toEqual({
|
|
44
|
+
pending: 0,
|
|
45
|
+
running: 0,
|
|
46
|
+
passed: 0,
|
|
47
|
+
failed: 0,
|
|
48
|
+
waived: 0
|
|
49
|
+
});
|
|
50
|
+
expect(result.data.pending_required_tests).toEqual({});
|
|
51
|
+
expect(validateSchema).toHaveBeenCalledWith('qa_test_index.schema.json', expect.any(Object));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('GIVEN_invalid_index_schema_WHEN_qa_test_index_get_THEN_returns_internal_error', async () => {
|
|
55
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'aop-qa-index-invalid-'));
|
|
56
|
+
cleanupPaths.push(tempDir);
|
|
57
|
+
|
|
58
|
+
const service = new QaIndexService({
|
|
59
|
+
qaIndexPath: () => path.join(tempDir, 'qa_test_index.json'),
|
|
60
|
+
validateSchema: async () => ({ valid: false, errors: [{ message: 'invalid_schema' }] })
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
await expect(service.qaTestIndexGet('feature_invalid')).rejects.toMatchObject({
|
|
64
|
+
normalizedResponse: {
|
|
65
|
+
error: {
|
|
66
|
+
code: ERROR_CODES.INTERNAL_ERROR
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('GIVEN_missing_index_file_WHEN_qa_test_index_update_THEN_returns_file_not_found', async () => {
|
|
73
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'aop-qa-index-missing-update-'));
|
|
74
|
+
cleanupPaths.push(tempDir);
|
|
75
|
+
|
|
76
|
+
const service = new QaIndexService({
|
|
77
|
+
qaIndexPath: () => path.join(tempDir, 'qa_test_index.json'),
|
|
78
|
+
validateSchema: async () => ({ valid: true })
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
await expect(
|
|
82
|
+
service.qaTestIndexUpdate('feature_missing', 1, [], [])
|
|
83
|
+
).rejects.toMatchObject({
|
|
84
|
+
normalizedResponse: {
|
|
85
|
+
error: {
|
|
86
|
+
code: ERROR_CODES.FILE_NOT_FOUND
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('GIVEN_schema_validation_fails_on_update_WHEN_qa_test_index_update_THEN_returns_internal_error', async () => {
|
|
93
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'aop-qa-index-update-invalid-'));
|
|
94
|
+
cleanupPaths.push(tempDir);
|
|
95
|
+
|
|
96
|
+
const qaIndexPath = path.join(tempDir, 'qa_test_index.json');
|
|
97
|
+
const initialIndex: AnyRecord = {
|
|
98
|
+
feature_id: 'feature_update_invalid',
|
|
99
|
+
version: 1,
|
|
100
|
+
source_diff_ref: 'ref',
|
|
101
|
+
items: [
|
|
102
|
+
{
|
|
103
|
+
path: 'src/sample.ts',
|
|
104
|
+
hunks: [{ start_line: 1, end_line: 2, change_type: 'modify' }],
|
|
105
|
+
required_tests: ['default:fast:lint'],
|
|
106
|
+
status: 'pending'
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
};
|
|
110
|
+
await writeJson(qaIndexPath, initialIndex);
|
|
111
|
+
|
|
112
|
+
const service = new QaIndexService({
|
|
113
|
+
qaIndexPath: () => qaIndexPath,
|
|
114
|
+
validateSchema: async () => ({ valid: false, errors: [{ message: 'schema_failed' }] })
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
await expect(
|
|
118
|
+
service.qaTestIndexUpdate(
|
|
119
|
+
'feature_update_invalid',
|
|
120
|
+
1,
|
|
121
|
+
[
|
|
122
|
+
{
|
|
123
|
+
path: 'src/sample.ts',
|
|
124
|
+
hunk: { start_line: 1, end_line: 2, change_type: 'modify' },
|
|
125
|
+
status: 'passed'
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
['evidence://run-1']
|
|
129
|
+
)
|
|
130
|
+
).rejects.toMatchObject({
|
|
131
|
+
normalizedResponse: {
|
|
132
|
+
error: {
|
|
133
|
+
code: ERROR_CODES.INTERNAL_ERROR
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('GIVEN_valid_update_request_WHEN_qa_test_index_update_THEN_persists_incremented_version_and_status', async () => {
|
|
140
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'aop-qa-index-update-pass-'));
|
|
141
|
+
cleanupPaths.push(tempDir);
|
|
142
|
+
|
|
143
|
+
const qaIndexPath = path.join(tempDir, 'qa_test_index.json');
|
|
144
|
+
await writeJson(qaIndexPath, {
|
|
145
|
+
feature_id: 'feature_update_ok',
|
|
146
|
+
version: 1,
|
|
147
|
+
source_diff_ref: 'ref',
|
|
148
|
+
items: [
|
|
149
|
+
{
|
|
150
|
+
path: 'src/sample.ts',
|
|
151
|
+
hunks: [{ start_line: 3, end_line: 4, change_type: 'modify' }],
|
|
152
|
+
required_tests: ['default:fast:lint'],
|
|
153
|
+
status: 'pending'
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
const service = new QaIndexService({
|
|
159
|
+
qaIndexPath: () => qaIndexPath,
|
|
160
|
+
validateSchema: async () => ({ valid: true })
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const result = await service.qaTestIndexUpdate(
|
|
164
|
+
'feature_update_ok',
|
|
165
|
+
1,
|
|
166
|
+
[
|
|
167
|
+
{
|
|
168
|
+
path: 'src/sample.ts',
|
|
169
|
+
hunk: { start_line: 3, end_line: 4, change_type: 'modify' },
|
|
170
|
+
status: 'passed'
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
['evidence://run-ok']
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
expect(result.data).toEqual({
|
|
177
|
+
feature_id: 'feature_update_ok',
|
|
178
|
+
version: 2
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const persisted = JSON.parse(await fs.readFile(qaIndexPath, 'utf8'));
|
|
182
|
+
expect(persisted.version).toBe(2);
|
|
183
|
+
expect(persisted.items[0].status).toBe('passed');
|
|
184
|
+
expect(persisted.items[0].evidence_refs).toEqual(['evidence://run-ok']);
|
|
185
|
+
expect(typeof persisted.items[0].last_run_at).toBe('string');
|
|
186
|
+
});
|
|
187
|
+
});
|