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,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://example.local/agentic/tools/schemas/output/report.dashboard.output.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": [
|
|
6
|
+
"index",
|
|
7
|
+
"features"
|
|
8
|
+
],
|
|
9
|
+
"properties": {
|
|
10
|
+
"index": {
|
|
11
|
+
"type": "object"
|
|
12
|
+
},
|
|
13
|
+
"features": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": {
|
|
16
|
+
"type": "object"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"additionalProperties": false
|
|
21
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://example.local/agentic/tools/schemas/output/report.feature_summary.output.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": [
|
|
6
|
+
"feature_id",
|
|
7
|
+
"state",
|
|
8
|
+
"diff_stat",
|
|
9
|
+
"touched_files",
|
|
10
|
+
"last_gate_summary",
|
|
11
|
+
"qa_summary"
|
|
12
|
+
],
|
|
13
|
+
"properties": {
|
|
14
|
+
"feature_id": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"minLength": 1
|
|
17
|
+
},
|
|
18
|
+
"state": {
|
|
19
|
+
"type": "object"
|
|
20
|
+
},
|
|
21
|
+
"diff_stat": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"touched_files": {
|
|
25
|
+
"type": "array",
|
|
26
|
+
"items": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"last_gate_summary": {},
|
|
31
|
+
"qa_summary": {
|
|
32
|
+
"type": "object"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"additionalProperties": false
|
|
36
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# AOP MCP Tool Surface
|
|
2
|
+
|
|
3
|
+
Generated from `agentic/orchestrator/tools/catalog.json`.
|
|
4
|
+
|
|
5
|
+
- collisions.scan
|
|
6
|
+
- evidence.latest
|
|
7
|
+
- feature.delete
|
|
8
|
+
- feature.discover_specs
|
|
9
|
+
- feature.get_context
|
|
10
|
+
- feature.init
|
|
11
|
+
- feature.log_append
|
|
12
|
+
- feature.ready_to_merge
|
|
13
|
+
- feature.state_get
|
|
14
|
+
- feature.state_patch
|
|
15
|
+
- gates.list
|
|
16
|
+
- gates.run
|
|
17
|
+
- locks.acquire
|
|
18
|
+
- locks.release
|
|
19
|
+
- plan.get
|
|
20
|
+
- plan.submit
|
|
21
|
+
- plan.update
|
|
22
|
+
- qa.test_index_get
|
|
23
|
+
- qa.test_index_update
|
|
24
|
+
- repo.apply_patch
|
|
25
|
+
- repo.diff
|
|
26
|
+
- repo.diff_bundle
|
|
27
|
+
- repo.ensure_worktree
|
|
28
|
+
- repo.read_file
|
|
29
|
+
- repo.search
|
|
30
|
+
- repo.status
|
|
31
|
+
- report.dashboard
|
|
32
|
+
- report.feature_summary
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "control-plane",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"projectType": "application",
|
|
5
|
+
"sourceRoot": "apps/control-plane/src",
|
|
6
|
+
"targets": {
|
|
7
|
+
"run": {
|
|
8
|
+
"executor": "nx:run-commands",
|
|
9
|
+
"options": {
|
|
10
|
+
"command": "tsx apps/control-plane/src/cli/aop.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"build": {
|
|
14
|
+
"executor": "nx:run-commands",
|
|
15
|
+
"dependsOn": ["lint"],
|
|
16
|
+
"options": {
|
|
17
|
+
"command": "tsc -p apps/control-plane/tsconfig.build.json"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"lint": {
|
|
21
|
+
"executor": "nx:run-commands",
|
|
22
|
+
"options": {
|
|
23
|
+
"command": "eslint apps/control-plane --max-warnings 0"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"test": {
|
|
27
|
+
"executor": "nx:run-commands",
|
|
28
|
+
"options": {
|
|
29
|
+
"command": "vitest run --coverage --config apps/control-plane/vitest.config.ts"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"typecheck": {
|
|
33
|
+
"executor": "nx:run-commands",
|
|
34
|
+
"options": {
|
|
35
|
+
"command": "tsc -p tsconfig.json --noEmit"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
const ARCHITECTURE_RULES = {
|
|
5
|
+
'application-services': ['cli', 'interfaces', 'mcp', 'providers', 'supervisor'],
|
|
6
|
+
'application-tools': ['cli', 'interfaces', 'mcp', 'providers', 'supervisor'],
|
|
7
|
+
cli: [],
|
|
8
|
+
core: ['cli', 'interfaces', 'supervisor'],
|
|
9
|
+
interfaces: [],
|
|
10
|
+
mcp: ['cli', 'interfaces', 'supervisor'],
|
|
11
|
+
providers: ['cli', 'interfaces', 'mcp', 'supervisor'],
|
|
12
|
+
supervisor: ['cli', 'interfaces']
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const IMPORT_PATTERN = /(?:import|export)\s+[^'"]*?from\s+['"]([^'"]+)['"]/g;
|
|
16
|
+
const SRC_ROOT = path.resolve(process.cwd(), 'apps/control-plane/src');
|
|
17
|
+
|
|
18
|
+
async function collectFiles(root) {
|
|
19
|
+
const entries = await fs.readdir(root, { withFileTypes: true });
|
|
20
|
+
const files = [];
|
|
21
|
+
for (const entry of entries) {
|
|
22
|
+
const absolutePath = path.join(root, entry.name);
|
|
23
|
+
if (entry.isDirectory()) {
|
|
24
|
+
files.push(...(await collectFiles(absolutePath)));
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (entry.isFile() && absolutePath.endsWith('.ts')) {
|
|
28
|
+
files.push(absolutePath);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return files.sort((a, b) => a.localeCompare(b));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function classifyLayer(filePath) {
|
|
35
|
+
const relativePath = path.relative(SRC_ROOT, filePath).replaceAll('\\', '/');
|
|
36
|
+
if (relativePath.startsWith('application/services/')) {
|
|
37
|
+
return 'application-services';
|
|
38
|
+
}
|
|
39
|
+
if (relativePath.startsWith('application/tools/')) {
|
|
40
|
+
return 'application-tools';
|
|
41
|
+
}
|
|
42
|
+
if (relativePath.startsWith('cli/')) {
|
|
43
|
+
return 'cli';
|
|
44
|
+
}
|
|
45
|
+
if (relativePath.startsWith('core/')) {
|
|
46
|
+
return 'core';
|
|
47
|
+
}
|
|
48
|
+
if (relativePath.startsWith('interfaces/')) {
|
|
49
|
+
return 'interfaces';
|
|
50
|
+
}
|
|
51
|
+
if (relativePath.startsWith('mcp/')) {
|
|
52
|
+
return 'mcp';
|
|
53
|
+
}
|
|
54
|
+
if (relativePath.startsWith('providers/')) {
|
|
55
|
+
return 'providers';
|
|
56
|
+
}
|
|
57
|
+
if (relativePath.startsWith('supervisor/')) {
|
|
58
|
+
return 'supervisor';
|
|
59
|
+
}
|
|
60
|
+
return 'unknown';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function fileExists(filePath) {
|
|
64
|
+
try {
|
|
65
|
+
await fs.stat(filePath);
|
|
66
|
+
return true;
|
|
67
|
+
} catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function resolveImport(sourceFile, importSpecifier) {
|
|
73
|
+
if (!importSpecifier.startsWith('.')) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const sourceDir = path.dirname(sourceFile);
|
|
78
|
+
const rawTarget = path.resolve(sourceDir, importSpecifier);
|
|
79
|
+
const candidates = [
|
|
80
|
+
rawTarget,
|
|
81
|
+
rawTarget.replace(/\.js$/, '.ts'),
|
|
82
|
+
`${rawTarget}.ts`,
|
|
83
|
+
`${rawTarget}.js`,
|
|
84
|
+
path.join(rawTarget, 'index.ts'),
|
|
85
|
+
path.join(rawTarget, 'index.js')
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
for (const candidate of candidates) {
|
|
89
|
+
if (await fileExists(candidate)) {
|
|
90
|
+
return candidate;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function extractImports(content) {
|
|
98
|
+
const imports = [];
|
|
99
|
+
let match;
|
|
100
|
+
while ((match = IMPORT_PATTERN.exec(content)) != null) {
|
|
101
|
+
imports.push(match[1]);
|
|
102
|
+
}
|
|
103
|
+
return imports;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async function collectViolations() {
|
|
107
|
+
const files = await collectFiles(SRC_ROOT);
|
|
108
|
+
const violations = [];
|
|
109
|
+
|
|
110
|
+
for (const file of files) {
|
|
111
|
+
const sourceLayer = classifyLayer(file);
|
|
112
|
+
if (sourceLayer === 'unknown') {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const forbiddenTargets = ARCHITECTURE_RULES[sourceLayer];
|
|
116
|
+
if (!forbiddenTargets || forbiddenTargets.length === 0) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const content = await fs.readFile(file, 'utf8');
|
|
121
|
+
const imports = extractImports(content);
|
|
122
|
+
for (const importSpecifier of imports) {
|
|
123
|
+
const resolved = await resolveImport(file, importSpecifier);
|
|
124
|
+
if (!resolved) {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (!resolved.startsWith(SRC_ROOT)) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const targetLayer = classifyLayer(resolved);
|
|
133
|
+
if (forbiddenTargets.includes(targetLayer)) {
|
|
134
|
+
violations.push({
|
|
135
|
+
source: path.relative(process.cwd(), file).replaceAll('\\', '/'),
|
|
136
|
+
sourceLayer,
|
|
137
|
+
target: path.relative(process.cwd(), resolved).replaceAll('\\', '/'),
|
|
138
|
+
targetLayer,
|
|
139
|
+
importSpecifier
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return { filesChecked: files.length, violations };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function printViolation(violation) {
|
|
149
|
+
const message =
|
|
150
|
+
`- ${violation.source} (${violation.sourceLayer}) imports ${violation.importSpecifier} ` +
|
|
151
|
+
`-> ${violation.target} (${violation.targetLayer})`;
|
|
152
|
+
process.stderr.write(`${message}\n`);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async function main() {
|
|
156
|
+
const { filesChecked, violations } = await collectViolations();
|
|
157
|
+
if (violations.length > 0) {
|
|
158
|
+
process.stderr.write('architecture_rule_violations_detected\n');
|
|
159
|
+
for (const violation of violations) {
|
|
160
|
+
printViolation(violation);
|
|
161
|
+
}
|
|
162
|
+
process.stderr.write(`files_checked=${filesChecked}\n`);
|
|
163
|
+
process.stderr.write(`violation_count=${violations.length}\n`);
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
process.stdout.write(`architecture_rules_ok files_checked=${filesChecked} violation_count=0\n`);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
void main();
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { spawnSync } from 'node:child_process';
|
|
5
|
+
|
|
6
|
+
const repoRoot = path.resolve(import.meta.dirname, '..', '..', '..');
|
|
7
|
+
const dockerDir = path.join(repoRoot, 'docker');
|
|
8
|
+
const dockerfilePath = path.join(dockerDir, 'mcp.Dockerfile');
|
|
9
|
+
const composePath = path.join(dockerDir, 'mcp.compose.yaml');
|
|
10
|
+
const entrypointPath = path.join(dockerDir, 'mcp.entrypoint.sh');
|
|
11
|
+
const runSmoke = process.argv.includes('--smoke');
|
|
12
|
+
|
|
13
|
+
function fail(message) {
|
|
14
|
+
console.error(`validate:docker-mcp: ${message}`);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function readText(filePath) {
|
|
19
|
+
if (!fs.existsSync(filePath)) {
|
|
20
|
+
fail(`missing required file: ${path.relative(repoRoot, filePath)}`);
|
|
21
|
+
}
|
|
22
|
+
return fs.readFileSync(filePath, 'utf8');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function assertContains(content, pattern, label) {
|
|
26
|
+
if (!pattern.test(content)) {
|
|
27
|
+
fail(`contract mismatch: ${label}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const dockerfile = readText(dockerfilePath);
|
|
32
|
+
const compose = readText(composePath);
|
|
33
|
+
const entrypoint = readText(entrypointPath);
|
|
34
|
+
|
|
35
|
+
assertContains(dockerfile, /^FROM\s+node:/m, 'docker image must be Node-based');
|
|
36
|
+
assertContains(dockerfile, /apt-get install[^]*\bgit\b/m, 'docker image must include git toolchain');
|
|
37
|
+
assertContains(dockerfile, /ENV\s+AOP_REPO_ROOT=\/repo/m, 'docker image must declare /repo root');
|
|
38
|
+
assertContains(
|
|
39
|
+
dockerfile,
|
|
40
|
+
/ENTRYPOINT\s+\["\/bin\/sh",\s*"\/app\/docker\/mcp\.entrypoint\.sh"\]/m,
|
|
41
|
+
'docker entrypoint must enforce runtime preflight checks'
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
assertContains(compose, /aop-mcp:/m, 'compose must declare aop-mcp service');
|
|
45
|
+
assertContains(compose, /- \.\.\/:\/repo/m, 'compose must bind-mount repository to /repo');
|
|
46
|
+
assertContains(compose, /working_dir:\s*\/repo/m, 'compose service must execute from /repo');
|
|
47
|
+
|
|
48
|
+
assertContains(entrypoint, /if \[ ! -d "\/repo" \]/m, 'entrypoint must enforce /repo mount check');
|
|
49
|
+
assertContains(entrypoint, /for tool in node npm npx git;/m, 'entrypoint must verify required toolchains');
|
|
50
|
+
|
|
51
|
+
if (!runSmoke) {
|
|
52
|
+
console.log('validate:docker-mcp: contract checks passed');
|
|
53
|
+
process.exit(0);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const config = spawnSync('docker', ['compose', '-f', composePath, 'config'], {
|
|
57
|
+
cwd: repoRoot,
|
|
58
|
+
stdio: 'inherit'
|
|
59
|
+
});
|
|
60
|
+
if (config.status !== 0) {
|
|
61
|
+
fail('docker compose config validation failed');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const build = spawnSync('docker', ['compose', '-f', composePath, 'build', 'aop-mcp'], {
|
|
65
|
+
cwd: repoRoot,
|
|
66
|
+
stdio: 'inherit'
|
|
67
|
+
});
|
|
68
|
+
if (build.status !== 0) {
|
|
69
|
+
fail('docker compose build smoke check failed');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const smoke = spawnSync(
|
|
73
|
+
'docker',
|
|
74
|
+
['compose', '-f', composePath, 'run', '--rm', 'aop-mcp', 'npm', 'run', 'run', '--', 'status', '--transport', 'mcp'],
|
|
75
|
+
{
|
|
76
|
+
cwd: repoRoot,
|
|
77
|
+
stdio: 'inherit'
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
if (smoke.status !== 0) {
|
|
81
|
+
fail('docker compose run smoke check failed');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
console.log('validate:docker-mcp: contract checks + smoke run passed');
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { MCP_PROTOCOL_PIN, REQUIRED_MCP_TRANSPORTS } from '../src/mcp/protocol-contract.js';
|
|
4
|
+
import { ToolsMarkdownGenerator } from '../src/mcp/tools-markdown-generator.js';
|
|
5
|
+
import { ToolRegistryLoader } from '../src/mcp/tool-registry-loader.js';
|
|
6
|
+
|
|
7
|
+
function fail(message: string): never {
|
|
8
|
+
throw new Error(message);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function normalizeMarkdown(content: string): string {
|
|
12
|
+
return `${content.replace(/\r\n/g, '\n').trimEnd()}\n`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function main(): Promise<void> {
|
|
16
|
+
const repoRoot = process.cwd();
|
|
17
|
+
const loader = new ToolRegistryLoader(repoRoot);
|
|
18
|
+
const registry = await loader.load();
|
|
19
|
+
const protocol = registry.protocol;
|
|
20
|
+
|
|
21
|
+
if (protocol.mcp_protocol_version !== MCP_PROTOCOL_PIN.mcp_protocol_version) {
|
|
22
|
+
fail(
|
|
23
|
+
`protocol_version_pin_mismatch expected=${MCP_PROTOCOL_PIN.mcp_protocol_version} actual=${protocol.mcp_protocol_version}`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
if (protocol.sdk.package !== MCP_PROTOCOL_PIN.sdk.package) {
|
|
27
|
+
fail(`protocol_sdk_package_pin_mismatch expected=${MCP_PROTOCOL_PIN.sdk.package} actual=${protocol.sdk.package}`);
|
|
28
|
+
}
|
|
29
|
+
if (protocol.sdk.version !== MCP_PROTOCOL_PIN.sdk.version) {
|
|
30
|
+
fail(`protocol_sdk_version_pin_mismatch expected=${MCP_PROTOCOL_PIN.sdk.version} actual=${protocol.sdk.version}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
for (const transport of REQUIRED_MCP_TRANSPORTS) {
|
|
34
|
+
if (!protocol.enabled_transports.includes(transport)) {
|
|
35
|
+
fail(`protocol_missing_required_transport:${transport}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (registry.catalog.tools.length !== registry.toolsByName.size) {
|
|
40
|
+
fail('registry_duplicate_tool_names_detected');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const generator = new ToolsMarkdownGenerator(repoRoot);
|
|
44
|
+
const expectedToolsMarkdown = normalizeMarkdown(generator.renderFromCatalog(registry.catalog));
|
|
45
|
+
const toolsMdPath = path.join(repoRoot, 'agentic', 'orchestrator', 'tools.md');
|
|
46
|
+
const actualToolsMarkdown = normalizeMarkdown(await fs.readFile(toolsMdPath, 'utf8'));
|
|
47
|
+
|
|
48
|
+
if (actualToolsMarkdown !== expectedToolsMarkdown) {
|
|
49
|
+
fail('tools_markdown_drift_detected');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
process.stdout.write(
|
|
53
|
+
`[validate:mcp-contracts] ok: tools=${registry.catalog.tools.length} protocol=${protocol.mcp_protocol_version} sdk=${protocol.sdk.package}@${protocol.sdk.version}\n`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
void main().catch((error: unknown) => {
|
|
58
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
59
|
+
process.stderr.write(`[validate:mcp-contracts] failed: ${message}\n`);
|
|
60
|
+
process.exitCode = 1;
|
|
61
|
+
});
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { nowIso, readJson } from '../../core/fs.js';
|
|
2
|
+
import { detectPlanCollisions } from '../../core/collisions.js';
|
|
3
|
+
import { sortResourcesDeterministically } from '../../core/path-rules.js';
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
type AnyRecord = Record<string, any>;
|
|
7
|
+
|
|
8
|
+
type StateReadResult = {
|
|
9
|
+
frontMatter: AnyRecord;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type StateUpdater = (
|
|
13
|
+
frontMatter: AnyRecord,
|
|
14
|
+
body: string
|
|
15
|
+
) => Promise<{ frontMatter?: AnyRecord; body?: string }>;
|
|
16
|
+
|
|
17
|
+
function asArray<T = unknown>(value: unknown): T[] {
|
|
18
|
+
return Array.isArray(value) ? (value as T[]) : [];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function readObjectField(record: AnyRecord, key: string): AnyRecord {
|
|
22
|
+
const value = record[key];
|
|
23
|
+
return value && typeof value === 'object' ? (value as AnyRecord) : {};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function readHeldLocks(frontMatter: AnyRecord): string[] {
|
|
27
|
+
const locks = readObjectField(frontMatter, 'locks');
|
|
28
|
+
return asArray<string>(locks.held).filter((item) => typeof item === 'string');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface QueueEntry {
|
|
32
|
+
feature_id: string;
|
|
33
|
+
plan_version: number;
|
|
34
|
+
detected_at: string;
|
|
35
|
+
collision_fingerprint: string;
|
|
36
|
+
required_resources: string[];
|
|
37
|
+
plan_snapshot?: AnyRecord;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface CollisionQueueServicePort {
|
|
41
|
+
getPolicySnapshot(): AnyRecord;
|
|
42
|
+
planPath(featureId: string): string;
|
|
43
|
+
statePath(featureId: string): string;
|
|
44
|
+
featureDiscoverSpecs(): Promise<{ data: { specs: Array<{ feature_id: string }> } }>;
|
|
45
|
+
readState(featureId: string): Promise<StateReadResult>;
|
|
46
|
+
withFeatureLock<T>(featureId: string, operation: () => Promise<T>): Promise<T>;
|
|
47
|
+
withIndexLock<T>(operation: () => Promise<T>): Promise<T>;
|
|
48
|
+
readIndex(): Promise<AnyRecord>;
|
|
49
|
+
writeIndex(index: AnyRecord): Promise<void>;
|
|
50
|
+
updateState(featureId: string, expectedVersion: number | null, updater: StateUpdater): Promise<AnyRecord>;
|
|
51
|
+
planSubmit(featureId: string, plan: AnyRecord, expectedVersion: number | null): Promise<{ data: { feature_id: string; accepted: boolean; plan_version: number } }>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export class CollisionQueueService {
|
|
55
|
+
private readonly port: CollisionQueueServicePort;
|
|
56
|
+
|
|
57
|
+
constructor(port: CollisionQueueServicePort) {
|
|
58
|
+
this.port = port;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async collectAcceptedPlans(excludeFeatureId: string | null = null): Promise<AnyRecord[]> {
|
|
62
|
+
const specs = await this.port.featureDiscoverSpecs();
|
|
63
|
+
const plans: AnyRecord[] = [];
|
|
64
|
+
for (const item of specs.data.specs) {
|
|
65
|
+
if (item.feature_id === excludeFeatureId) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const plan = await readJson(this.port.planPath(item.feature_id), null);
|
|
69
|
+
if (plan) {
|
|
70
|
+
plans.push(plan);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return plans;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
requiredResourcesForPlan(plan: AnyRecord): string[] {
|
|
77
|
+
const resources: string[] = [];
|
|
78
|
+
const policy = this.port.getPolicySnapshot();
|
|
79
|
+
if (plan.contracts?.openapi === 'modify') {
|
|
80
|
+
resources.push(policy.locks.contract_to_resource.openapi);
|
|
81
|
+
}
|
|
82
|
+
if (plan.contracts?.events === 'modify') {
|
|
83
|
+
resources.push(policy.locks.contract_to_resource.events);
|
|
84
|
+
}
|
|
85
|
+
if (plan.contracts?.db === 'migration') {
|
|
86
|
+
resources.push(policy.locks.contract_to_resource.db);
|
|
87
|
+
}
|
|
88
|
+
return sortResourcesDeterministically(resources);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async assertPlanLocksHeld(featureId: string, plan: AnyRecord): Promise<boolean> {
|
|
92
|
+
const state = await this.port.readState(featureId);
|
|
93
|
+
const held = new Set(readHeldLocks(state.frontMatter));
|
|
94
|
+
const required = await this.requiredResourcesForPlan(plan);
|
|
95
|
+
const missing = required.filter((resource) => !held.has(resource));
|
|
96
|
+
return missing.length === 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async checkPlanCollision(featureId: string, plan: AnyRecord): Promise<{ hasCollisions: boolean; fingerprint?: string }> {
|
|
100
|
+
const policy = this.port.getPolicySnapshot();
|
|
101
|
+
const acceptedPlans = await this.collectAcceptedPlans(featureId);
|
|
102
|
+
const collisionResult = detectPlanCollisions(
|
|
103
|
+
plan as Parameters<typeof detectPlanCollisions>[0],
|
|
104
|
+
acceptedPlans as Parameters<typeof detectPlanCollisions>[1],
|
|
105
|
+
policy as Parameters<typeof detectPlanCollisions>[2]
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
hasCollisions: collisionResult.hasCollisions,
|
|
110
|
+
fingerprint: collisionResult.fingerprint
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async processSingleQueueEntry(entry: QueueEntry): Promise<{ retried: boolean; reason?: string }> {
|
|
115
|
+
const persistedPlan = await readJson(this.port.planPath(entry.feature_id), null);
|
|
116
|
+
const snapshotPlan =
|
|
117
|
+
entry.plan_snapshot && typeof entry.plan_snapshot === 'object' ? entry.plan_snapshot : null;
|
|
118
|
+
|
|
119
|
+
const plan =
|
|
120
|
+
persistedPlan && persistedPlan.plan_version === entry.plan_version
|
|
121
|
+
? persistedPlan
|
|
122
|
+
: snapshotPlan && snapshotPlan.plan_version === entry.plan_version
|
|
123
|
+
? snapshotPlan
|
|
124
|
+
: null;
|
|
125
|
+
|
|
126
|
+
if (!plan) {
|
|
127
|
+
return { retried: false, reason: 'plan_missing' };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const locksHeld = await this.assertPlanLocksHeld(entry.feature_id, plan);
|
|
131
|
+
if (!locksHeld) {
|
|
132
|
+
return { retried: false, reason: 'locks_not_held' };
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const collision = await this.checkPlanCollision(entry.feature_id, plan);
|
|
136
|
+
if (collision.hasCollisions) {
|
|
137
|
+
return { retried: false, reason: 'collision_still_present' };
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
const expectedVersion = Number.isInteger(plan.revision_of) ? Number(plan.revision_of) : null;
|
|
142
|
+
await this.port.planSubmit(entry.feature_id, plan, expectedVersion);
|
|
143
|
+
return { retried: true };
|
|
144
|
+
} catch (_error) {
|
|
145
|
+
return { retried: false, reason: 'plan_submit_failed' };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async reDriveBlockedQueue(): Promise<{ data: { processed: number; retried: number; still_blocked: number } }> {
|
|
150
|
+
const policy = this.port.getPolicySnapshot();
|
|
151
|
+
|
|
152
|
+
if (policy.collision_policy !== 'block') {
|
|
153
|
+
return {
|
|
154
|
+
data: {
|
|
155
|
+
processed: 0,
|
|
156
|
+
retried: 0,
|
|
157
|
+
still_blocked: 0
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return await this.port.withIndexLock(async () => {
|
|
163
|
+
const index = await this.port.readIndex();
|
|
164
|
+
const queue: QueueEntry[] = asArray<QueueEntry>(index.blocked_queue);
|
|
165
|
+
|
|
166
|
+
if (queue.length === 0) {
|
|
167
|
+
return {
|
|
168
|
+
data: {
|
|
169
|
+
processed: 0,
|
|
170
|
+
retried: 0,
|
|
171
|
+
still_blocked: 0
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const sortedQueue = [...queue].sort(
|
|
177
|
+
(a, b) => a.detected_at.localeCompare(b.detected_at) || a.feature_id.localeCompare(b.feature_id)
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
const stillBlocked: QueueEntry[] = [];
|
|
181
|
+
let retriedCount = 0;
|
|
182
|
+
|
|
183
|
+
for (const entry of sortedQueue) {
|
|
184
|
+
const result = await this.processSingleQueueEntry(entry);
|
|
185
|
+
if (result.retried) {
|
|
186
|
+
retriedCount += 1;
|
|
187
|
+
} else {
|
|
188
|
+
stillBlocked.push(entry);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const currentIndex = await this.port.readIndex();
|
|
193
|
+
currentIndex.blocked_queue = stillBlocked;
|
|
194
|
+
currentIndex.version += 1;
|
|
195
|
+
currentIndex.updated_at = nowIso();
|
|
196
|
+
await this.port.writeIndex(currentIndex);
|
|
197
|
+
|
|
198
|
+
return {
|
|
199
|
+
data: {
|
|
200
|
+
processed: sortedQueue.length,
|
|
201
|
+
retried: retriedCount,
|
|
202
|
+
still_blocked: stillBlocked.length
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
async clearQueueEntry(featureId: string): Promise<{ data: { removed: boolean } }> {
|
|
209
|
+
return await this.port.withIndexLock(async () => {
|
|
210
|
+
const index = await this.port.readIndex();
|
|
211
|
+
const queue: QueueEntry[] = asArray<QueueEntry>(index.blocked_queue);
|
|
212
|
+
const before = queue.length;
|
|
213
|
+
const filtered = queue.filter((entry) => entry.feature_id !== featureId);
|
|
214
|
+
|
|
215
|
+
if (filtered.length === before) {
|
|
216
|
+
return { data: { removed: false } };
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
index.blocked_queue = filtered;
|
|
220
|
+
index.version += 1;
|
|
221
|
+
index.updated_at = nowIso();
|
|
222
|
+
await this.port.writeIndex(index);
|
|
223
|
+
|
|
224
|
+
return { data: { removed: true } };
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|