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,415 @@
|
|
|
1
|
+
# Feature Spec: OOP-First Refactor of `apps/control-plane` (AOP)
|
|
2
|
+
|
|
3
|
+
> **Purpose of this document**: Define an implementation-ready plan to refactor the control-plane code under `apps/` to align with strong OOP and clean architecture principles (SRP, KISS, OCP, DIP, ISP, encapsulation), while preserving the existing deterministic MCP/runtime behavior and public contracts.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Objectives
|
|
8
|
+
|
|
9
|
+
### 1.1 Must-Have Outcomes
|
|
10
|
+
|
|
11
|
+
- Preserve current behavior and contracts:
|
|
12
|
+
- tool names, request/response envelope shape, and error codes
|
|
13
|
+
- schema-governed state/index/plan formats
|
|
14
|
+
- CLI command and flags (`run`, `status`, `resume`, `stop`, `--transport`, `--takeover-stale-run`)
|
|
15
|
+
- Eliminate god objects and high coupling:
|
|
16
|
+
- split `AopKernel` into cohesive domain/application services
|
|
17
|
+
- split `SupervisorRuntime` and `cli/aop.ts` orchestration-heavy logic into dedicated collaborators
|
|
18
|
+
- Enforce OOP and type safety:
|
|
19
|
+
- remove cross-layer `as any` dependence from production paths
|
|
20
|
+
- remove broad `[key: string]: any` usage from core runtime classes
|
|
21
|
+
- introduce explicit interfaces for storage, process execution, auth, and orchestration boundaries
|
|
22
|
+
- Make tool dispatch open for extension:
|
|
23
|
+
- replace hard-coded `switch(toolName)` dispatch with handler registry and per-tool command handlers
|
|
24
|
+
- Reduce duplication and hidden policy drift:
|
|
25
|
+
- centralize mutating-tool metadata currently duplicated in CLI and Supervisor
|
|
26
|
+
- remove side effects from registry-loading code paths where not strictly required
|
|
27
|
+
- Improve testability:
|
|
28
|
+
- make each service unit-testable via dependency inversion and narrow interfaces
|
|
29
|
+
- keep and expand behavior-level parity tests for MCP and in-process transports
|
|
30
|
+
|
|
31
|
+
### 1.2 Non-Goals
|
|
32
|
+
|
|
33
|
+
- No rewrite of product semantics, workflow semantics, or gate policy semantics.
|
|
34
|
+
- No change to canonical artifact locations unless explicitly versioned and documented.
|
|
35
|
+
- No replacement of file-backed state model with database-backed storage in this phase.
|
|
36
|
+
- No provider feature expansion beyond current provider selection contract.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 2. Current Design Weaknesses (Observed in `apps/`)
|
|
41
|
+
|
|
42
|
+
### 2.1 God Object / SRP Violations
|
|
43
|
+
|
|
44
|
+
- `apps/control-plane/src/core/kernel.ts` currently combines:
|
|
45
|
+
- auth/authorization checks
|
|
46
|
+
- schema loading and validation
|
|
47
|
+
- tool routing
|
|
48
|
+
- feature lifecycle and state transitions
|
|
49
|
+
- git/worktree orchestration
|
|
50
|
+
- patch policy enforcement
|
|
51
|
+
- lock lease lifecycle
|
|
52
|
+
- gate execution orchestration
|
|
53
|
+
- QA index logic
|
|
54
|
+
- reporting and merge logic
|
|
55
|
+
- run lease and recovery logic
|
|
56
|
+
- This violates SRP and creates high blast radius for change.
|
|
57
|
+
|
|
58
|
+
### 2.2 OCP and KISS Violations
|
|
59
|
+
|
|
60
|
+
- `AopKernel.dispatchTool(...)` uses a large switch over tool names.
|
|
61
|
+
- Adding a tool currently requires editing central dispatch and often touching unrelated logic.
|
|
62
|
+
- CLI and Supervisor each re-implement mutating-tool logic (`MUTATING_TOOLS` sets), increasing drift risk.
|
|
63
|
+
|
|
64
|
+
### 2.3 DIP/ISP Violations
|
|
65
|
+
|
|
66
|
+
- `SupervisorRuntime` depends on concrete `AopKernel` behavior and accesses internals via `(kernel as any)` for config and repo root.
|
|
67
|
+
- Runtime factory and other modules read internal kernel fields directly instead of consuming typed ports.
|
|
68
|
+
- Process, filesystem, and policy dependencies are concretely bound inside core services rather than injected through interfaces.
|
|
69
|
+
|
|
70
|
+
### 2.4 Encapsulation and Type Safety Gaps
|
|
71
|
+
|
|
72
|
+
- Broad `any` usage in core/supervisor/cli paths weakens invariants and makes regressions easier.
|
|
73
|
+
- State and index access patterns pass loosely typed objects across modules.
|
|
74
|
+
- Domain errors and infrastructure errors are not uniformly modeled as typed exceptions/results.
|
|
75
|
+
|
|
76
|
+
### 2.5 Mixed Concerns and Side Effects
|
|
77
|
+
|
|
78
|
+
- Tool registry loading also regenerates `tools.md`, coupling startup behavior with documentation generation.
|
|
79
|
+
- Auth, authorization, validation, idempotency, execution, and logging are interleaved in `ToolRuntime` without clear policy pipeline abstractions.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 3. Refactor Principles (Normative)
|
|
84
|
+
|
|
85
|
+
1. **SRP**: each class/service must have one primary reason to change.
|
|
86
|
+
2. **KISS**: avoid framework-heavy abstractions; use straightforward interfaces and composition.
|
|
87
|
+
3. **OCP**: add tools/behaviors by adding new handlers/services, not modifying core dispatch.
|
|
88
|
+
4. **DIP**: depend on interfaces (`ports`), not concrete filesystem/process/kernel implementations.
|
|
89
|
+
5. **ISP**: expose small role-specific interfaces rather than broad god interfaces.
|
|
90
|
+
6. **Encapsulation**: domain invariants live in domain/application services, not spread across callers.
|
|
91
|
+
7. **Composition over inheritance**: prefer coordinator + collaborators over class hierarchies.
|
|
92
|
+
8. **Determinism-first**: no refactor may weaken existing deterministic lock/collision/schema/lease behavior.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 4. Target Architecture
|
|
97
|
+
|
|
98
|
+
### 4.1 Layered Boundaries
|
|
99
|
+
|
|
100
|
+
- **Domain Layer** (`domain/`):
|
|
101
|
+
- Entities/value objects for `FeatureState`, `Plan`, `RunLease`, `SessionAssignment`, `QaIndex`
|
|
102
|
+
- Domain policies and invariants (legal transitions, plan revision rules, collision semantics)
|
|
103
|
+
- **Application Layer** (`application/`):
|
|
104
|
+
- Use-case services for feature init, plan submit/update, patch apply, gates run, locks, merge, reports, recovery
|
|
105
|
+
- Tool handlers that orchestrate domain + infra ports
|
|
106
|
+
- **Infrastructure Layer** (`infrastructure/`):
|
|
107
|
+
- filesystem repositories, git command adapter, gate command runner, YAML/schema loader, ledger persistence
|
|
108
|
+
- **Interface Layer** (`interfaces/`):
|
|
109
|
+
- CLI commands, MCP adapter, runtime composition root
|
|
110
|
+
|
|
111
|
+
### 4.2 Port Contracts (Core Interfaces)
|
|
112
|
+
|
|
113
|
+
- `IndexRepository`
|
|
114
|
+
- `FeatureStateRepository`
|
|
115
|
+
- `PlanRepository`
|
|
116
|
+
- `QaIndexRepository`
|
|
117
|
+
- `EvidenceRepository`
|
|
118
|
+
- `LockRepository`
|
|
119
|
+
- `OperationLedgerRepository`
|
|
120
|
+
- `CommandRunner`
|
|
121
|
+
- `GitClient`
|
|
122
|
+
- `GateRunner`
|
|
123
|
+
- `PolicyProvider`
|
|
124
|
+
- `SchemaValidator`
|
|
125
|
+
- `Clock`
|
|
126
|
+
- `IdGenerator`
|
|
127
|
+
- `ToolAuthorizerPort`
|
|
128
|
+
- `TokenVerifierPort`
|
|
129
|
+
|
|
130
|
+
### 4.3 Application Services (Initial Set)
|
|
131
|
+
|
|
132
|
+
- `RunLeaseService`
|
|
133
|
+
- `FeatureLifecycleService`
|
|
134
|
+
- `FeatureStateService`
|
|
135
|
+
- `PlanService`
|
|
136
|
+
- `PatchService`
|
|
137
|
+
- `GateService`
|
|
138
|
+
- `LockService`
|
|
139
|
+
- `MergeService`
|
|
140
|
+
- `QaIndexService`
|
|
141
|
+
- `ReportingService`
|
|
142
|
+
- `RecoveryService`
|
|
143
|
+
- `SessionAssignmentService`
|
|
144
|
+
|
|
145
|
+
### 4.4 Tool Dispatch Model
|
|
146
|
+
|
|
147
|
+
- Replace kernel switch dispatch with:
|
|
148
|
+
- `ToolHandler` interface: `execute(args, context): Promise<ToolResponse>`
|
|
149
|
+
- `ToolHandlerRegistry`: map of tool name to handler
|
|
150
|
+
- `ToolRouter`: centralized routing with typed unknown-tool handling
|
|
151
|
+
- MCP and in-process runtime both call the same handler layer through a shared application boundary.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 5. Walkthrough Refactor Plan for `apps/` Files
|
|
156
|
+
|
|
157
|
+
### 5.1 `apps/control-plane/src/core/*`
|
|
158
|
+
|
|
159
|
+
- `core/kernel.ts`
|
|
160
|
+
- Decompose into domain/application service classes listed in Section 4.3.
|
|
161
|
+
- Keep a thin façade (`AopKernelFacade`) temporarily for backward compatibility during migration.
|
|
162
|
+
- Remove dynamic `[key: string]: any`.
|
|
163
|
+
- `core/gates.ts`
|
|
164
|
+
- Split into:
|
|
165
|
+
- `GateExecutionService`
|
|
166
|
+
- `CoverageParserStrategy` (`lcov`, `junit_xml`, `jacoco_xml`, `cobertura_xml`)
|
|
167
|
+
- `CoverageThresholdPolicy`
|
|
168
|
+
- Keep current parser behavior unchanged.
|
|
169
|
+
- `core/fs.ts`
|
|
170
|
+
- Split atomic file writer and lock manager:
|
|
171
|
+
- `AtomicFileWriter`
|
|
172
|
+
- `FileLockManager`
|
|
173
|
+
- `PathFsAdapter`
|
|
174
|
+
- `core/git.ts`
|
|
175
|
+
- Introduce `GitClient` interface and `NodeGitClient` implementation.
|
|
176
|
+
- Preserve `runCommand` behavior via `CommandRunner` abstraction.
|
|
177
|
+
- `core/schemas.ts`
|
|
178
|
+
- Promote `SchemaRegistry` to typed validator service with explicit schema IDs.
|
|
179
|
+
- Remove `any` from AJV access points.
|
|
180
|
+
- `core/patch.ts`
|
|
181
|
+
- Convert to `DiffParser` domain utility with typed parse errors.
|
|
182
|
+
- `core/qa-index.ts`
|
|
183
|
+
- Move update/version rules into `QaIndexDomainService` and keep repository logic separate.
|
|
184
|
+
- `core/path-rules.ts`
|
|
185
|
+
- Split normalization from matching policy:
|
|
186
|
+
- `RepoPathNormalizer`
|
|
187
|
+
- `AreaMatchingPolicy`
|
|
188
|
+
- `core/frontmatter.ts`
|
|
189
|
+
- Keep as utility but wrap in `StateMarkdownSerializer`.
|
|
190
|
+
- `core/response.ts`
|
|
191
|
+
- Preserve wire envelope; add typed result helpers for internal app layer.
|
|
192
|
+
- `core/error-codes.ts`
|
|
193
|
+
- Preserve codes; add typed domain/application error mapping.
|
|
194
|
+
- `core/constants.ts`
|
|
195
|
+
- Keep protocol constants; move mutating tool metadata to shared tool metadata module.
|
|
196
|
+
|
|
197
|
+
### 5.2 `apps/control-plane/src/mcp/*`
|
|
198
|
+
|
|
199
|
+
- `mcp/tool-runtime.ts`
|
|
200
|
+
- Refactor into explicit policy pipeline:
|
|
201
|
+
1. authorize scope/role
|
|
202
|
+
2. validate input
|
|
203
|
+
3. idempotency precheck
|
|
204
|
+
4. execute handler
|
|
205
|
+
5. validate output/error envelope
|
|
206
|
+
6. idempotency record
|
|
207
|
+
7. emit audit log
|
|
208
|
+
- Keep behavior parity; improve readability and test seam isolation.
|
|
209
|
+
- `mcp/tool-registry-loader.ts`
|
|
210
|
+
- Separate responsibilities:
|
|
211
|
+
- `ToolRegistryLoader` (read + validate)
|
|
212
|
+
- `ToolsMarkdownGenerator` (doc generation)
|
|
213
|
+
- Make docs generation explicit (startup hook or dedicated command).
|
|
214
|
+
- `mcp/tool-contract-validator.ts`
|
|
215
|
+
- Replace broad `any` with typed AJV wrapper.
|
|
216
|
+
- `mcp/token-auth-verifier.ts`
|
|
217
|
+
- Split JWT codec/signature and claim validation into separate components.
|
|
218
|
+
- `mcp/tool-authorizer.ts`
|
|
219
|
+
- Keep policy intersection behavior; expose interface for application layer.
|
|
220
|
+
- `mcp/operation-ledger.ts`
|
|
221
|
+
- Extract persistence from idempotency policy decisions.
|
|
222
|
+
- `mcp/kernel-tool-executor.ts`
|
|
223
|
+
- Replace kernel dependency with application tool router interface.
|
|
224
|
+
- `mcp/mcp-server-adapter.ts`
|
|
225
|
+
- Keep as transport adapter only; no domain logic.
|
|
226
|
+
- `mcp/runtime-factory.ts`
|
|
227
|
+
- Move construction into composition root with explicit dependency graph and config object.
|
|
228
|
+
- `mcp/tool-client.ts`
|
|
229
|
+
- Keep clients; centralize operation-id policy in shared metadata module.
|
|
230
|
+
- `mcp/types.ts`
|
|
231
|
+
- Keep contract models; split internal runtime-only types from transport DTOs.
|
|
232
|
+
|
|
233
|
+
### 5.3 `apps/control-plane/src/supervisor/runtime.ts`
|
|
234
|
+
|
|
235
|
+
- Split into:
|
|
236
|
+
- `RunCoordinator`
|
|
237
|
+
- `SessionOrchestrator`
|
|
238
|
+
- `PlanningWaveExecutor`
|
|
239
|
+
- `BuildWaveExecutor`
|
|
240
|
+
- `QaWaveExecutor`
|
|
241
|
+
- `PromptBundleLoader`
|
|
242
|
+
- `LeaseHeartbeatService`
|
|
243
|
+
- Remove direct access to kernel internals and replace with typed ports:
|
|
244
|
+
- `RuntimeStateReader`
|
|
245
|
+
- `FeatureOrchestrationPort`
|
|
246
|
+
- `AgentPromptProvider`
|
|
247
|
+
|
|
248
|
+
### 5.4 `apps/control-plane/src/cli/aop.ts`
|
|
249
|
+
|
|
250
|
+
- Split command concerns:
|
|
251
|
+
- `CliArgumentParser`
|
|
252
|
+
- `RunCommandHandler`
|
|
253
|
+
- `StatusCommandHandler`
|
|
254
|
+
- `ResumeCommandHandler`
|
|
255
|
+
- `StopCommandHandler`
|
|
256
|
+
- `SpecInputResolver`
|
|
257
|
+
- `SpecIngestionService`
|
|
258
|
+
- Keep CLI contract unchanged; remove operational logic from entrypoint.
|
|
259
|
+
- Replace inline bootstrapping with composition root in `interfaces/cli/bootstrap.ts`.
|
|
260
|
+
|
|
261
|
+
### 5.5 `apps/control-plane/src/providers/providers.ts`
|
|
262
|
+
|
|
263
|
+
- Introduce provider interfaces:
|
|
264
|
+
- `WorkerProvider`
|
|
265
|
+
- `ProviderSelectionResolver`
|
|
266
|
+
- Keep `NullWorkerProvider` as test/default adapter, but isolate provider-agnostic behavior in shared abstractions.
|
|
267
|
+
|
|
268
|
+
### 5.6 `apps/control-plane/src/index.ts`
|
|
269
|
+
|
|
270
|
+
- Export only stable public API surface from composition root and major interfaces.
|
|
271
|
+
|
|
272
|
+
### 5.7 `apps/control-plane/test/*`
|
|
273
|
+
|
|
274
|
+
- Keep behavior tests, but re-balance:
|
|
275
|
+
- domain service unit tests (fast, pure)
|
|
276
|
+
- infrastructure adapter tests (filesystem/git behavior)
|
|
277
|
+
- transport parity tests (in-process vs MCP)
|
|
278
|
+
- CLI integration tests
|
|
279
|
+
- Reduce brittle casts and internal state poking where possible.
|
|
280
|
+
- Add characterization tests before decomposition for high-risk paths:
|
|
281
|
+
- plan submit/update rules
|
|
282
|
+
- lock acquisition/release and stale reclaim behavior
|
|
283
|
+
- merge gating preconditions
|
|
284
|
+
- lease takeover behavior
|
|
285
|
+
- idempotent mutation replay/mismatch
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## 6. Proposed Target File Layout
|
|
290
|
+
|
|
291
|
+
```text
|
|
292
|
+
apps/control-plane/src/
|
|
293
|
+
application/
|
|
294
|
+
services/
|
|
295
|
+
tools/
|
|
296
|
+
ports/
|
|
297
|
+
domain/
|
|
298
|
+
models/
|
|
299
|
+
policies/
|
|
300
|
+
errors/
|
|
301
|
+
infrastructure/
|
|
302
|
+
fs/
|
|
303
|
+
git/
|
|
304
|
+
schema/
|
|
305
|
+
ledger/
|
|
306
|
+
gates/
|
|
307
|
+
interfaces/
|
|
308
|
+
cli/
|
|
309
|
+
mcp/
|
|
310
|
+
supervisor/
|
|
311
|
+
composition/
|
|
312
|
+
runtime-factory.ts
|
|
313
|
+
index.ts
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## 7. Migration Milestones
|
|
319
|
+
|
|
320
|
+
### OOP-M1: Safety Net and Characterization
|
|
321
|
+
|
|
322
|
+
- Freeze behavior via characterization tests around current kernel and supervisor critical flows.
|
|
323
|
+
- Add per-tool parity assertions for in-process and MCP clients.
|
|
324
|
+
|
|
325
|
+
### OOP-M2: Shared Contracts and Metadata
|
|
326
|
+
|
|
327
|
+
- Introduce typed command/context/result contracts.
|
|
328
|
+
- Centralize tool metadata including mutating-tool flags.
|
|
329
|
+
- Remove duplicated `MUTATING_TOOLS` declarations.
|
|
330
|
+
|
|
331
|
+
### OOP-M3: Kernel Decomposition Phase 1
|
|
332
|
+
|
|
333
|
+
- Extract pure domain policies:
|
|
334
|
+
- status transitions
|
|
335
|
+
- plan revision rules
|
|
336
|
+
- collision and lock requirement rules
|
|
337
|
+
- Keep compatibility façade delegating to extracted services.
|
|
338
|
+
|
|
339
|
+
### OOP-M4: Kernel Decomposition Phase 2
|
|
340
|
+
|
|
341
|
+
- Extract repositories and infra adapters for state/index/plan/qa/evidence/git.
|
|
342
|
+
- Migrate façade methods to use application services only.
|
|
343
|
+
|
|
344
|
+
### OOP-M5: Tool Routing Refactor
|
|
345
|
+
|
|
346
|
+
- Replace `switch` dispatch with handler registry and router.
|
|
347
|
+
- Add per-handler unit tests.
|
|
348
|
+
|
|
349
|
+
### OOP-M6: Supervisor and CLI Separation
|
|
350
|
+
|
|
351
|
+
- Split supervisor waves and session orchestration components.
|
|
352
|
+
- Split CLI command handlers and input ingestion services.
|
|
353
|
+
- Remove `(kernel as any)` access in production code.
|
|
354
|
+
|
|
355
|
+
### OOP-M7: MCP Runtime Pipeline Cleanup
|
|
356
|
+
|
|
357
|
+
- Convert ToolRuntime flow into explicit pipeline components.
|
|
358
|
+
- Isolate registry loading and documentation generation concerns.
|
|
359
|
+
|
|
360
|
+
### OOP-M8: Hardening and Finalization
|
|
361
|
+
|
|
362
|
+
- Remove deprecated façade code paths.
|
|
363
|
+
- Enforce type/lint architecture rules.
|
|
364
|
+
- Run full test suite and document architecture in README and spec progress.
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## 8. Acceptance Criteria
|
|
369
|
+
|
|
370
|
+
1. All existing externally visible contracts remain compatible.
|
|
371
|
+
2. `AopKernel` is reduced to a thin façade or replaced by composed services with no monolithic business logic block.
|
|
372
|
+
3. Tool dispatch is registry/handler-driven (no large central switch statement).
|
|
373
|
+
4. No duplicated mutating-tool policy declarations across CLI and Supervisor.
|
|
374
|
+
5. Supervisor and CLI do not use `(kernel as any)` to read internals.
|
|
375
|
+
6. Core production paths compile without broad `any` escape hatches except where unavoidable for third-party boundaries.
|
|
376
|
+
7. MCP and in-process transport parity tests remain green for critical tool paths.
|
|
377
|
+
8. Existing deterministic guarantees (locks, schema validation, optimistic concurrency, idempotency, transitions) are preserved.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## 9. Risks and Mitigations
|
|
382
|
+
|
|
383
|
+
- Risk: behavior regressions during decomposition.
|
|
384
|
+
- Mitigation: characterization tests before migration and phased extraction with compatibility façade.
|
|
385
|
+
- Risk: over-abstraction and complexity increase.
|
|
386
|
+
- Mitigation: enforce KISS and prefer minimal interfaces with concrete implementations.
|
|
387
|
+
- Risk: refactor stalls due to broad scope.
|
|
388
|
+
- Mitigation: milestone-based delivery with independently mergeable phases.
|
|
389
|
+
- Risk: test flakiness with git/worktree behavior.
|
|
390
|
+
- Mitigation: isolate process and filesystem adapters, then test them directly.
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## 10. Execution Backlog (Initial)
|
|
395
|
+
|
|
396
|
+
- `OOP-T-001`: Add characterization tests for kernel high-risk flows.
|
|
397
|
+
- `OOP-T-002`: Create shared tool metadata module and remove duplicate mutating sets.
|
|
398
|
+
- `OOP-T-003`: Introduce application-layer port interfaces and context types.
|
|
399
|
+
- `OOP-T-004`: Extract state/index repositories from kernel.
|
|
400
|
+
- `OOP-T-005`: Extract run lease + lock services from kernel.
|
|
401
|
+
- `OOP-T-006`: Extract plan/patch/gate/merge services from kernel.
|
|
402
|
+
- `OOP-T-007`: Replace kernel dispatch switch with handler registry.
|
|
403
|
+
- `OOP-T-008`: Refactor SupervisorRuntime into coordinator + wave executors.
|
|
404
|
+
- `OOP-T-009`: Refactor CLI into command handlers + composition root.
|
|
405
|
+
- `OOP-T-010`: Refactor ToolRuntime into explicit pipeline components.
|
|
406
|
+
- `OOP-T-011`: Remove production `(as any)` internal field access patterns.
|
|
407
|
+
- `OOP-T-012`: Architecture verification pass (typecheck + test + contract parity).
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## 11. Rollout Notes
|
|
412
|
+
|
|
413
|
+
- This refactor should be executed after or in parallel-safe slices with existing roadmap milestones, with each OOP milestone producing a shippable state.
|
|
414
|
+
- Keep schema contracts and tool registry contracts authoritative during the refactor.
|
|
415
|
+
- Any intentional contract changes must be versioned and documented in `spec-files/progress.md` and corresponding specs before implementation.
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# Feature Spec: Single Global Orchestrator Session Topology (AOP)
|
|
2
|
+
|
|
3
|
+
> **Purpose of this document**: Define the implementation contract for moving from per-feature orchestrator sessions to one global orchestrator session per active run, while preserving deterministic multi-feature delivery and MCP-governed safety.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Objectives
|
|
8
|
+
|
|
9
|
+
### 1.1 Must-Have Outcomes
|
|
10
|
+
|
|
11
|
+
- Enforce active-run topology: `1 + 3N`
|
|
12
|
+
- `1` global orchestrator session
|
|
13
|
+
- `N` planner sessions
|
|
14
|
+
- `N` builder sessions
|
|
15
|
+
- `N` QA sessions
|
|
16
|
+
- Prevent split-brain orchestration:
|
|
17
|
+
- exactly one active run owner per repo
|
|
18
|
+
- exactly one orchestrator session per active run
|
|
19
|
+
- Preserve deterministic orchestration behavior:
|
|
20
|
+
- lock/collision policy
|
|
21
|
+
- plan/patch/gate enforcement
|
|
22
|
+
- auditable state transitions
|
|
23
|
+
- Preserve per-feature worktree isolation.
|
|
24
|
+
|
|
25
|
+
### 1.2 Non-Goals
|
|
26
|
+
|
|
27
|
+
- No change to worker role definitions.
|
|
28
|
+
- No change to MCP tool semantics.
|
|
29
|
+
- No replacement of file-backed canonical state.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 2. Topology Model
|
|
34
|
+
|
|
35
|
+
### 2.1 Current vs Target
|
|
36
|
+
|
|
37
|
+
Current behavior creates per-feature orchestrator sessions (`4N`).
|
|
38
|
+
|
|
39
|
+
Target behavior:
|
|
40
|
+
- one global orchestrator session per run
|
|
41
|
+
- worker sessions per active feature
|
|
42
|
+
- queued features do not allocate worker sessions
|
|
43
|
+
|
|
44
|
+
### 2.2 Active Feature Definition
|
|
45
|
+
|
|
46
|
+
`N` means active features currently admitted by `max_active_features`.
|
|
47
|
+
Queued features are excluded from `N` until promoted to active.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 3. Run Ownership and Singleton Guarantees
|
|
52
|
+
|
|
53
|
+
### 3.1 Repository Run Lease
|
|
54
|
+
|
|
55
|
+
A repo must have at most one active orchestrator run at a time.
|
|
56
|
+
|
|
57
|
+
Canonical lease fields in index:
|
|
58
|
+
- `runtime_sessions.run_id`
|
|
59
|
+
- `runtime_sessions.owner_instance_id`
|
|
60
|
+
- `runtime_sessions.lease_id`
|
|
61
|
+
- `runtime_sessions.lease_expires_at`
|
|
62
|
+
|
|
63
|
+
### 3.2 Start Behavior
|
|
64
|
+
|
|
65
|
+
On `aop run` start:
|
|
66
|
+
1. acquire run lease if absent
|
|
67
|
+
2. if active lease exists and is fresh -> fail with `run_already_active`
|
|
68
|
+
3. if active lease stale and caller passed takeover flag -> claim lease and continue
|
|
69
|
+
|
|
70
|
+
Takeover contract:
|
|
71
|
+
- CLI flag: `--takeover-stale-run`
|
|
72
|
+
- default (flag absent): stale lease does not get reclaimed automatically
|
|
73
|
+
- when flag present: reclaim stale lease deterministically and continue
|
|
74
|
+
- programmatic invocations SHOULD expose equivalent boolean input: `takeover_stale_run`
|
|
75
|
+
|
|
76
|
+
### 3.3 Heartbeat
|
|
77
|
+
|
|
78
|
+
Supervisor MUST refresh run lease heartbeat periodically.
|
|
79
|
+
Expired run lease enables deterministic takeover.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 4. Session Ownership and Assignment Rules
|
|
84
|
+
|
|
85
|
+
### 4.1 Session Graph
|
|
86
|
+
|
|
87
|
+
- `runtime_sessions.orchestrator_session_id` (single, canonical field in `index.json`)
|
|
88
|
+
- `feature_sessions[feature_id] = { planner_session_id, builder_session_id, qa_session_id }` (runtime assignment map)
|
|
89
|
+
|
|
90
|
+
### 4.2 Assignment for Active vs Queued Features
|
|
91
|
+
|
|
92
|
+
- Active feature:
|
|
93
|
+
- planner/builder/qa session ids MUST be concrete ids.
|
|
94
|
+
- Queued feature:
|
|
95
|
+
- planner/builder/qa session ids MUST be sentinel `"unassigned"`.
|
|
96
|
+
|
|
97
|
+
Queued features MUST NOT consume session slots or violate `1 + 3N`.
|
|
98
|
+
|
|
99
|
+
### 4.3 Forbidden Behavior
|
|
100
|
+
|
|
101
|
+
- creating orchestrator session inside per-feature initialization
|
|
102
|
+
- assigning distinct orchestrator ids per feature in same run
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 5. Canonical State Contract Deltas
|
|
107
|
+
|
|
108
|
+
### 5.1 `index.json` Runtime Session Object
|
|
109
|
+
|
|
110
|
+
Standardize on one object:
|
|
111
|
+
- `runtime_sessions.run_id` (string)
|
|
112
|
+
- `runtime_sessions.orchestrator_session_id` (string)
|
|
113
|
+
- `runtime_sessions.provider` (string)
|
|
114
|
+
- `runtime_sessions.model` (string)
|
|
115
|
+
- `runtime_sessions.provider_config_ref_hash` (string)
|
|
116
|
+
- `runtime_sessions.owner_instance_id` (string)
|
|
117
|
+
- `runtime_sessions.lease_id` (string)
|
|
118
|
+
- `runtime_sessions.started_at` (date-time)
|
|
119
|
+
- `runtime_sessions.last_heartbeat_at` (date-time)
|
|
120
|
+
- `runtime_sessions.lease_expires_at` (date-time)
|
|
121
|
+
|
|
122
|
+
### 5.2 `state.md` Cluster Invariant
|
|
123
|
+
|
|
124
|
+
Keep existing `cluster` fields for compatibility.
|
|
125
|
+
|
|
126
|
+
Invariant:
|
|
127
|
+
- For each active feature:
|
|
128
|
+
- `state.cluster.orchestrator_session_id == index.runtime_sessions.orchestrator_session_id`
|
|
129
|
+
|
|
130
|
+
### 5.3 Compatibility Window
|
|
131
|
+
|
|
132
|
+
- Backfill missing `runtime_sessions` on first run after upgrade.
|
|
133
|
+
- Preserve existing per-feature cluster fields until deprecation milestone.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 6. Supervisor Loop Under Global Orchestrator
|
|
138
|
+
|
|
139
|
+
Each loop iteration:
|
|
140
|
+
1. collect per-feature summaries
|
|
141
|
+
2. global orchestrator decides prioritization/arbitration
|
|
142
|
+
3. dispatch planner/builder/qa work
|
|
143
|
+
4. apply role-scoped `ToolClient` calls (`inprocess` or `mcp`)
|
|
144
|
+
5. reconcile outcomes and update canonical state
|
|
145
|
+
|
|
146
|
+
Global orchestrator decisions MUST govern:
|
|
147
|
+
- lock contention strategy
|
|
148
|
+
- collision resolution ordering
|
|
149
|
+
- merge readiness sequencing
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 7. Recovery and Failover Algorithm (Normative)
|
|
154
|
+
|
|
155
|
+
### 7.1 Startup Recovery
|
|
156
|
+
|
|
157
|
+
1. load index and feature states
|
|
158
|
+
2. validate run lease freshness
|
|
159
|
+
3. if run lease owned by this instance and fresh -> continue
|
|
160
|
+
4. if stale -> reclaim only with takeover policy
|
|
161
|
+
5. attempt orchestrator session reattach (bounded timeout)
|
|
162
|
+
6. if reattach fails -> create exactly one new orchestrator session
|
|
163
|
+
7. increment orchestrator epoch marker in index (for audit)
|
|
164
|
+
8. reconcile all active features to current orchestrator session id
|
|
165
|
+
9. close/mark orphan worker sessions from prior epoch
|
|
166
|
+
10. resume each feature from earliest incomplete phase
|
|
167
|
+
|
|
168
|
+
### 7.2 Determinism Requirements
|
|
169
|
+
|
|
170
|
+
- tie-breakers use deterministic ordering by feature id
|
|
171
|
+
- reattach timeout defaults are policy-configured
|
|
172
|
+
- orphan session cleanup is idempotent
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## 8. Implementation Plan
|
|
177
|
+
|
|
178
|
+
### M14: Topology Refactor Foundations
|
|
179
|
+
|
|
180
|
+
- add global session structure in Supervisor
|
|
181
|
+
- create one orchestrator session per run
|
|
182
|
+
- remove per-feature orchestrator session creation
|
|
183
|
+
- keep per-feature planner/builder/qa creation
|
|
184
|
+
|
|
185
|
+
### M15: Contract and Schema Updates
|
|
186
|
+
|
|
187
|
+
- add standardized `runtime_sessions` object to index schema
|
|
188
|
+
- update state/index write paths
|
|
189
|
+
- implement queued-feature session sentinel handling
|
|
190
|
+
|
|
191
|
+
### M16: Recovery and Takeover
|
|
192
|
+
|
|
193
|
+
- implement deterministic reattach-or-recreate algorithm
|
|
194
|
+
- implement run lease heartbeat and stale takeover behavior
|
|
195
|
+
- implement orphan session cleanup
|
|
196
|
+
|
|
197
|
+
### M17: Validation and Hardening
|
|
198
|
+
|
|
199
|
+
- add runtime invariants and enforcement checks
|
|
200
|
+
- add integration tests for `N=1`, `N=3`, `N > max_active_features`
|
|
201
|
+
|
|
202
|
+
### M18: Production Promotion
|
|
203
|
+
|
|
204
|
+
- align with MCP formalization parity gate
|
|
205
|
+
- promote new topology as default production behavior
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 9. File-Level Change Targets
|
|
210
|
+
|
|
211
|
+
- `apps/control-plane/src/supervisor/runtime.ts`
|
|
212
|
+
- global orchestrator lifecycle
|
|
213
|
+
- active/queued session assignment rules
|
|
214
|
+
- recovery and takeover handling
|
|
215
|
+
- `apps/control-plane/src/cli/aop.ts`
|
|
216
|
+
- takeover flag contract
|
|
217
|
+
- run ownership/start semantics wiring
|
|
218
|
+
- `apps/control-plane/src/core/kernel.ts`
|
|
219
|
+
- index runtime session helpers
|
|
220
|
+
- invariant validation hooks
|
|
221
|
+
- `apps/control-plane/src/mcp/tool-client.ts`
|
|
222
|
+
- transport-agnostic call boundary used by supervisor orchestration
|
|
223
|
+
- `apps/control-plane/src/mcp/runtime-factory.ts`
|
|
224
|
+
- client/runtime construction used by `aop run`
|
|
225
|
+
- `agentic/orchestrator/schemas/index.schema.json`
|
|
226
|
+
- standardized `runtime_sessions`
|
|
227
|
+
- `agentic/orchestrator/schemas/state.schema.json`
|
|
228
|
+
- compatibility + invariant notes for cluster fields
|
|
229
|
+
- `apps/control-plane/test/*.spec.ts`
|
|
230
|
+
- topology, recovery, takeover, and queue semantics tests
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## 10. Acceptance Criteria
|
|
235
|
+
|
|
236
|
+
1. Active run topology is exactly `1 + 3N`.
|
|
237
|
+
2. All active features share one orchestrator session id.
|
|
238
|
+
3. Queued features use sentinel worker session ids and consume no worker slots.
|
|
239
|
+
4. Split-brain prevention works (fresh active run lease blocks second run).
|
|
240
|
+
5. Recovery reuses or recreates exactly one orchestrator session deterministically.
|
|
241
|
+
6. Existing deterministic tool behavior remains unchanged relative to formalized MCP contracts (auth claims, RBAC intersection, and mutation idempotency).
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## 11. Risks and Mitigations
|
|
246
|
+
|
|
247
|
+
- Risk: global orchestrator throughput bottleneck.
|
|
248
|
+
- Mitigation: keep worker phases parallel and orchestrator coordination lightweight.
|
|
249
|
+
- Risk: migration breaks existing state snapshots.
|
|
250
|
+
- Mitigation: compatibility backfill and invariant checks.
|
|
251
|
+
- Risk: stale lease takeover errors.
|
|
252
|
+
- Mitigation: explicit lease policy, deterministic takeover rules, and audit logs.
|
|
253
|
+
- Risk: hidden assumptions in existing tests about per-feature orchestrators.
|
|
254
|
+
- Mitigation: add topology-focused integration tests and remove old assumptions.
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## 12. Dependency Note
|
|
259
|
+
|
|
260
|
+
This spec depends on security, idempotency, and transport contracts from:
|
|
261
|
+
- `agentic_orchestrator_mcp_formalization_spec.md`
|
|
262
|
+
|
|
263
|
+
Status note (as of February 28, 2026): foundational MCP formalization artifacts and runtime boundaries are implemented; this topology spec now targets the remaining M14-M18 topology changes on top of that baseline.
|
|
264
|
+
|
|
265
|
+
Delivery ordering MUST follow the integrated plan in the MCP formalization spec, with topology milestones layered after the formalized tool boundary.
|