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.
Files changed (439) hide show
  1. package/.dockerignore +24 -0
  2. package/.github/workflows/mcp-contract-validation.yml +38 -0
  3. package/Agentic-Orchestrator.iml +9 -0
  4. package/LICENSE +21 -0
  5. package/README.md +679 -0
  6. package/agentic/orchestrator/agents.yaml +14 -0
  7. package/agentic/orchestrator/gates.yaml +31 -0
  8. package/agentic/orchestrator/policy.yaml +145 -0
  9. package/agentic/orchestrator/prompts/builder.system.md +1 -0
  10. package/agentic/orchestrator/prompts/planner.system.md +15 -0
  11. package/agentic/orchestrator/prompts/qa.system.md +1 -0
  12. package/agentic/orchestrator/schemas/agents.schema.json +49 -0
  13. package/agentic/orchestrator/schemas/gates.schema.json +65 -0
  14. package/agentic/orchestrator/schemas/index.schema.json +108 -0
  15. package/agentic/orchestrator/schemas/plan.schema.json +127 -0
  16. package/agentic/orchestrator/schemas/policy.schema.json +227 -0
  17. package/agentic/orchestrator/schemas/qa_test_index.schema.json +53 -0
  18. package/agentic/orchestrator/schemas/state.schema.json +92 -0
  19. package/agentic/orchestrator/tools/catalog.json +399 -0
  20. package/agentic/orchestrator/tools/errors.schema.json +21 -0
  21. package/agentic/orchestrator/tools/protocol.json +8 -0
  22. package/agentic/orchestrator/tools/schemas/input/collisions.scan.input.schema.json +7 -0
  23. package/agentic/orchestrator/tools/schemas/input/evidence.latest.input.schema.json +15 -0
  24. package/agentic/orchestrator/tools/schemas/input/feature.delete.input.schema.json +42 -0
  25. package/agentic/orchestrator/tools/schemas/input/feature.discover_specs.input.schema.json +7 -0
  26. package/agentic/orchestrator/tools/schemas/input/feature.get_context.input.schema.json +15 -0
  27. package/agentic/orchestrator/tools/schemas/input/feature.init.input.schema.json +21 -0
  28. package/agentic/orchestrator/tools/schemas/input/feature.log_append.input.schema.json +26 -0
  29. package/agentic/orchestrator/tools/schemas/input/feature.ready_to_merge.input.schema.json +34 -0
  30. package/agentic/orchestrator/tools/schemas/input/feature.state_get.input.schema.json +15 -0
  31. package/agentic/orchestrator/tools/schemas/input/feature.state_patch.input.schema.json +28 -0
  32. package/agentic/orchestrator/tools/schemas/input/gates.list.input.schema.json +11 -0
  33. package/agentic/orchestrator/tools/schemas/input/gates.run.input.schema.json +29 -0
  34. package/agentic/orchestrator/tools/schemas/input/locks.acquire.input.schema.json +29 -0
  35. package/agentic/orchestrator/tools/schemas/input/locks.release.input.schema.json +26 -0
  36. package/agentic/orchestrator/tools/schemas/input/mutating.schema.json +14 -0
  37. package/agentic/orchestrator/tools/schemas/input/plan.get.input.schema.json +15 -0
  38. package/agentic/orchestrator/tools/schemas/input/plan.submit.input.schema.json +28 -0
  39. package/agentic/orchestrator/tools/schemas/input/plan.update.input.schema.json +29 -0
  40. package/agentic/orchestrator/tools/schemas/input/qa.test_index_get.input.schema.json +15 -0
  41. package/agentic/orchestrator/tools/schemas/input/qa.test_index_update.input.schema.json +38 -0
  42. package/agentic/orchestrator/tools/schemas/input/read.schema.json +6 -0
  43. package/agentic/orchestrator/tools/schemas/input/repo.apply_patch.input.schema.json +25 -0
  44. package/agentic/orchestrator/tools/schemas/input/repo.diff.input.schema.json +21 -0
  45. package/agentic/orchestrator/tools/schemas/input/repo.diff_bundle.input.schema.json +15 -0
  46. package/agentic/orchestrator/tools/schemas/input/repo.ensure_worktree.input.schema.json +21 -0
  47. package/agentic/orchestrator/tools/schemas/input/repo.read_file.input.schema.json +20 -0
  48. package/agentic/orchestrator/tools/schemas/input/repo.search.input.schema.json +20 -0
  49. package/agentic/orchestrator/tools/schemas/input/repo.status.input.schema.json +15 -0
  50. package/agentic/orchestrator/tools/schemas/input/report.dashboard.input.schema.json +7 -0
  51. package/agentic/orchestrator/tools/schemas/input/report.feature_summary.input.schema.json +15 -0
  52. package/agentic/orchestrator/tools/schemas/output/collisions.scan.output.schema.json +17 -0
  53. package/agentic/orchestrator/tools/schemas/output/evidence.latest.output.schema.json +20 -0
  54. package/agentic/orchestrator/tools/schemas/output/feature.delete.output.schema.json +224 -0
  55. package/agentic/orchestrator/tools/schemas/output/feature.discover_specs.output.schema.json +32 -0
  56. package/agentic/orchestrator/tools/schemas/output/feature.get_context.output.schema.json +40 -0
  57. package/agentic/orchestrator/tools/schemas/output/feature.init.output.schema.json +24 -0
  58. package/agentic/orchestrator/tools/schemas/output/feature.log_append.output.schema.json +24 -0
  59. package/agentic/orchestrator/tools/schemas/output/feature.ready_to_merge.output.schema.json +30 -0
  60. package/agentic/orchestrator/tools/schemas/output/feature.state_get.output.schema.json +18 -0
  61. package/agentic/orchestrator/tools/schemas/output/feature.state_patch.output.schema.json +24 -0
  62. package/agentic/orchestrator/tools/schemas/output/gates.list.output.schema.json +42 -0
  63. package/agentic/orchestrator/tools/schemas/output/gates.run.output.schema.json +37 -0
  64. package/agentic/orchestrator/tools/schemas/output/locks.acquire.output.schema.json +34 -0
  65. package/agentic/orchestrator/tools/schemas/output/locks.release.output.schema.json +24 -0
  66. package/agentic/orchestrator/tools/schemas/output/plan.get.output.schema.json +26 -0
  67. package/agentic/orchestrator/tools/schemas/output/plan.submit.output.schema.json +23 -0
  68. package/agentic/orchestrator/tools/schemas/output/plan.update.output.schema.json +23 -0
  69. package/agentic/orchestrator/tools/schemas/output/qa.test_index_get.output.schema.json +22 -0
  70. package/agentic/orchestrator/tools/schemas/output/qa.test_index_update.output.schema.json +19 -0
  71. package/agentic/orchestrator/tools/schemas/output/repo.apply_patch.output.schema.json +33 -0
  72. package/agentic/orchestrator/tools/schemas/output/repo.diff.output.schema.json +19 -0
  73. package/agentic/orchestrator/tools/schemas/output/repo.diff_bundle.output.schema.json +32 -0
  74. package/agentic/orchestrator/tools/schemas/output/repo.ensure_worktree.output.schema.json +29 -0
  75. package/agentic/orchestrator/tools/schemas/output/repo.read_file.output.schema.json +24 -0
  76. package/agentic/orchestrator/tools/schemas/output/repo.search.output.schema.json +26 -0
  77. package/agentic/orchestrator/tools/schemas/output/repo.status.output.schema.json +27 -0
  78. package/agentic/orchestrator/tools/schemas/output/report.dashboard.output.schema.json +21 -0
  79. package/agentic/orchestrator/tools/schemas/output/report.feature_summary.output.schema.json +36 -0
  80. package/agentic/orchestrator/tools/schemas/output/standard_success.schema.json +6 -0
  81. package/agentic/orchestrator/tools.md +32 -0
  82. package/apps/control-plane/project.json +39 -0
  83. package/apps/control-plane/scripts/validate-architecture-rules.mjs +170 -0
  84. package/apps/control-plane/scripts/validate-docker-mcp-contract.mjs +84 -0
  85. package/apps/control-plane/scripts/validate-mcp-contracts.ts +61 -0
  86. package/apps/control-plane/src/application/services/collision-queue-service.ts +227 -0
  87. package/apps/control-plane/src/application/services/feature-deletion-service.ts +459 -0
  88. package/apps/control-plane/src/application/services/feature-lifecycle-service.ts +177 -0
  89. package/apps/control-plane/src/application/services/feature-state-service.ts +125 -0
  90. package/apps/control-plane/src/application/services/gate-service.ts +232 -0
  91. package/apps/control-plane/src/application/services/lock-service.ts +298 -0
  92. package/apps/control-plane/src/application/services/merge-service.ts +246 -0
  93. package/apps/control-plane/src/application/services/patch-service.ts +259 -0
  94. package/apps/control-plane/src/application/services/plan-service.ts +302 -0
  95. package/apps/control-plane/src/application/services/qa-index-service.ts +98 -0
  96. package/apps/control-plane/src/application/services/reporting-service.ts +120 -0
  97. package/apps/control-plane/src/application/services/run-lease-service.ts +340 -0
  98. package/apps/control-plane/src/application/tools/tool-metadata.ts +56 -0
  99. package/apps/control-plane/src/application/tools/tool-router.ts +43 -0
  100. package/apps/control-plane/src/cli/aop.ts +31 -0
  101. package/apps/control-plane/src/cli/cli-argument-parser.ts +116 -0
  102. package/apps/control-plane/src/cli/delete-command-handler.ts +90 -0
  103. package/apps/control-plane/src/cli/io.ts +14 -0
  104. package/apps/control-plane/src/cli/resume-command-handler.ts +228 -0
  105. package/apps/control-plane/src/cli/run-command-handler.ts +57 -0
  106. package/apps/control-plane/src/cli/spec-ingestion-service.ts +88 -0
  107. package/apps/control-plane/src/cli/spec-input-resolver.ts +95 -0
  108. package/apps/control-plane/src/cli/spec-utils.ts +40 -0
  109. package/apps/control-plane/src/cli/status-command-handler.ts +17 -0
  110. package/apps/control-plane/src/cli/stop-command-handler.ts +5 -0
  111. package/apps/control-plane/src/cli/tooling.ts +36 -0
  112. package/apps/control-plane/src/cli/types.ts +34 -0
  113. package/apps/control-plane/src/core/collisions.ts +121 -0
  114. package/apps/control-plane/src/core/constants.ts +72 -0
  115. package/apps/control-plane/src/core/error-codes.ts +54 -0
  116. package/apps/control-plane/src/core/frontmatter.ts +42 -0
  117. package/apps/control-plane/src/core/fs.ts +173 -0
  118. package/apps/control-plane/src/core/gates.ts +361 -0
  119. package/apps/control-plane/src/core/git.ts +115 -0
  120. package/apps/control-plane/src/core/kernel.ts +1077 -0
  121. package/apps/control-plane/src/core/patch.ts +152 -0
  122. package/apps/control-plane/src/core/path-layout.ts +113 -0
  123. package/apps/control-plane/src/core/path-rules.ts +71 -0
  124. package/apps/control-plane/src/core/qa-index.ts +179 -0
  125. package/apps/control-plane/src/core/response.ts +62 -0
  126. package/apps/control-plane/src/core/runtime-sessions.ts +20 -0
  127. package/apps/control-plane/src/core/schemas.ts +125 -0
  128. package/apps/control-plane/src/index.ts +21 -0
  129. package/apps/control-plane/src/interfaces/cli/bootstrap.ts +100 -0
  130. package/apps/control-plane/src/mcp/kernel-tool-executor.ts +39 -0
  131. package/apps/control-plane/src/mcp/mcp-server-adapter.ts +74 -0
  132. package/apps/control-plane/src/mcp/operation-ledger.ts +108 -0
  133. package/apps/control-plane/src/mcp/protocol-contract.ts +9 -0
  134. package/apps/control-plane/src/mcp/runtime-factory.ts +105 -0
  135. package/apps/control-plane/src/mcp/runtime-types.ts +44 -0
  136. package/apps/control-plane/src/mcp/token-auth-verifier.ts +63 -0
  137. package/apps/control-plane/src/mcp/token-claims-validator.ts +72 -0
  138. package/apps/control-plane/src/mcp/token-codec.ts +62 -0
  139. package/apps/control-plane/src/mcp/tool-authorizer.ts +43 -0
  140. package/apps/control-plane/src/mcp/tool-client.ts +78 -0
  141. package/apps/control-plane/src/mcp/tool-contract-validator.ts +83 -0
  142. package/apps/control-plane/src/mcp/tool-registry-loader.ts +135 -0
  143. package/apps/control-plane/src/mcp/tool-runtime.ts +336 -0
  144. package/apps/control-plane/src/mcp/tools-markdown-generator.ts +26 -0
  145. package/apps/control-plane/src/mcp/transport-types.ts +16 -0
  146. package/apps/control-plane/src/mcp/types.ts +2 -0
  147. package/apps/control-plane/src/providers/providers.ts +177 -0
  148. package/apps/control-plane/src/supervisor/build-wave-executor.ts +55 -0
  149. package/apps/control-plane/src/supervisor/lease-heartbeat-service.ts +22 -0
  150. package/apps/control-plane/src/supervisor/planning-wave-executor.ts +316 -0
  151. package/apps/control-plane/src/supervisor/prompt-bundle-loader.ts +62 -0
  152. package/apps/control-plane/src/supervisor/qa-wave-executor.ts +99 -0
  153. package/apps/control-plane/src/supervisor/run-coordinator.ts +224 -0
  154. package/apps/control-plane/src/supervisor/runtime.ts +347 -0
  155. package/apps/control-plane/src/supervisor/session-orchestrator.ts +268 -0
  156. package/apps/control-plane/src/supervisor/types.ts +149 -0
  157. package/apps/control-plane/src/supervisor/worker-decision-loop.ts +299 -0
  158. package/apps/control-plane/test/aop.spec.ts +101 -0
  159. package/apps/control-plane/test/cli-helpers.spec.ts +102 -0
  160. package/apps/control-plane/test/cli.spec.ts +12 -0
  161. package/apps/control-plane/test/cli.unit.spec.ts +609 -0
  162. package/apps/control-plane/test/collision-queue.spec.ts +158 -0
  163. package/apps/control-plane/test/collisions.spec.ts +138 -0
  164. package/apps/control-plane/test/core-utils.spec.ts +102 -0
  165. package/apps/control-plane/test/delete-command-handler.spec.ts +202 -0
  166. package/apps/control-plane/test/epoch-tracking.spec.ts +121 -0
  167. package/apps/control-plane/test/gates.spec.ts +452 -0
  168. package/apps/control-plane/test/helpers.ts +68 -0
  169. package/apps/control-plane/test/index.spec.ts +18 -0
  170. package/apps/control-plane/test/kernel-collision-replay.spec.ts +222 -0
  171. package/apps/control-plane/test/kernel.branches.spec.ts +321 -0
  172. package/apps/control-plane/test/kernel.coverage.spec.ts +408 -0
  173. package/apps/control-plane/test/kernel.spec.ts +369 -0
  174. package/apps/control-plane/test/mcp-helpers.spec.ts +195 -0
  175. package/apps/control-plane/test/mcp.spec.ts +776 -0
  176. package/apps/control-plane/test/merge-service.spec.ts +357 -0
  177. package/apps/control-plane/test/plan-service.spec.ts +195 -0
  178. package/apps/control-plane/test/planning-wave-executor.spec.ts +229 -0
  179. package/apps/control-plane/test/providers.spec.ts +168 -0
  180. package/apps/control-plane/test/qa-index-service.spec.ts +187 -0
  181. package/apps/control-plane/test/qa-index.spec.ts +317 -0
  182. package/apps/control-plane/test/response.spec.ts +55 -0
  183. package/apps/control-plane/test/run-coordinator.spec.ts +334 -0
  184. package/apps/control-plane/test/schema-date-time.spec.ts +170 -0
  185. package/apps/control-plane/test/service-retry-paths.spec.ts +305 -0
  186. package/apps/control-plane/test/services.spec.ts +693 -0
  187. package/apps/control-plane/test/spec-input-resolver.spec.ts +76 -0
  188. package/apps/control-plane/test/supervisor-collaborators.spec.ts +201 -0
  189. package/apps/control-plane/test/supervisor.calltool.spec.ts +120 -0
  190. package/apps/control-plane/test/supervisor.spec.ts +415 -0
  191. package/apps/control-plane/test/supervisor.unit.spec.ts +522 -0
  192. package/apps/control-plane/test/token-auth-verifier.spec.ts +111 -0
  193. package/apps/control-plane/test/tool-registry-loader.spec.ts +268 -0
  194. package/apps/control-plane/test/tool-runtime.spec.ts +294 -0
  195. package/apps/control-plane/test/worker-decision-loop.spec.ts +587 -0
  196. package/apps/control-plane/tsconfig.build.json +17 -0
  197. package/apps/control-plane/tsconfig.json +11 -0
  198. package/apps/control-plane/vitest.config.ts +28 -0
  199. package/dist/apps/control-plane/application/services/collision-queue-service.d.ts +69 -0
  200. package/dist/apps/control-plane/application/services/collision-queue-service.js +158 -0
  201. package/dist/apps/control-plane/application/services/collision-queue-service.js.map +1 -0
  202. package/dist/apps/control-plane/application/services/feature-deletion-service.d.ts +79 -0
  203. package/dist/apps/control-plane/application/services/feature-deletion-service.js +336 -0
  204. package/dist/apps/control-plane/application/services/feature-deletion-service.js.map +1 -0
  205. package/dist/apps/control-plane/application/services/feature-lifecycle-service.d.ts +81 -0
  206. package/dist/apps/control-plane/application/services/feature-lifecycle-service.js +117 -0
  207. package/dist/apps/control-plane/application/services/feature-lifecycle-service.js.map +1 -0
  208. package/dist/apps/control-plane/application/services/feature-state-service.d.ts +34 -0
  209. package/dist/apps/control-plane/application/services/feature-state-service.js +90 -0
  210. package/dist/apps/control-plane/application/services/feature-state-service.js.map +1 -0
  211. package/dist/apps/control-plane/application/services/gate-service.d.ts +46 -0
  212. package/dist/apps/control-plane/application/services/gate-service.js +160 -0
  213. package/dist/apps/control-plane/application/services/gate-service.js.map +1 -0
  214. package/dist/apps/control-plane/application/services/lock-service.d.ts +56 -0
  215. package/dist/apps/control-plane/application/services/lock-service.js +242 -0
  216. package/dist/apps/control-plane/application/services/lock-service.js.map +1 -0
  217. package/dist/apps/control-plane/application/services/merge-service.d.ts +33 -0
  218. package/dist/apps/control-plane/application/services/merge-service.js +194 -0
  219. package/dist/apps/control-plane/application/services/merge-service.js.map +1 -0
  220. package/dist/apps/control-plane/application/services/patch-service.d.ts +39 -0
  221. package/dist/apps/control-plane/application/services/patch-service.js +189 -0
  222. package/dist/apps/control-plane/application/services/patch-service.js.map +1 -0
  223. package/dist/apps/control-plane/application/services/plan-service.d.ts +60 -0
  224. package/dist/apps/control-plane/application/services/plan-service.js +234 -0
  225. package/dist/apps/control-plane/application/services/plan-service.js.map +1 -0
  226. package/dist/apps/control-plane/application/services/qa-index-service.d.ts +26 -0
  227. package/dist/apps/control-plane/application/services/qa-index-service.js +66 -0
  228. package/dist/apps/control-plane/application/services/qa-index-service.js.map +1 -0
  229. package/dist/apps/control-plane/application/services/reporting-service.d.ts +47 -0
  230. package/dist/apps/control-plane/application/services/reporting-service.js +90 -0
  231. package/dist/apps/control-plane/application/services/reporting-service.js.map +1 -0
  232. package/dist/apps/control-plane/application/services/run-lease-service.d.ts +74 -0
  233. package/dist/apps/control-plane/application/services/run-lease-service.js +263 -0
  234. package/dist/apps/control-plane/application/services/run-lease-service.js.map +1 -0
  235. package/dist/apps/control-plane/application/tools/tool-metadata.d.ts +8 -0
  236. package/dist/apps/control-plane/application/tools/tool-metadata.js +37 -0
  237. package/dist/apps/control-plane/application/tools/tool-metadata.js.map +1 -0
  238. package/dist/apps/control-plane/application/tools/tool-router.d.ts +16 -0
  239. package/dist/apps/control-plane/application/tools/tool-router.js +25 -0
  240. package/dist/apps/control-plane/application/tools/tool-router.js.map +1 -0
  241. package/dist/apps/control-plane/cli/aop.d.ts +5 -0
  242. package/dist/apps/control-plane/cli/aop.js +19 -0
  243. package/dist/apps/control-plane/cli/aop.js.map +1 -0
  244. package/dist/apps/control-plane/cli/cli-argument-parser.d.ts +5 -0
  245. package/dist/apps/control-plane/cli/cli-argument-parser.js +109 -0
  246. package/dist/apps/control-plane/cli/cli-argument-parser.js.map +1 -0
  247. package/dist/apps/control-plane/cli/delete-command-handler.d.ts +8 -0
  248. package/dist/apps/control-plane/cli/delete-command-handler.js +77 -0
  249. package/dist/apps/control-plane/cli/delete-command-handler.js.map +1 -0
  250. package/dist/apps/control-plane/cli/io.d.ts +2 -0
  251. package/dist/apps/control-plane/cli/io.js +14 -0
  252. package/dist/apps/control-plane/cli/io.js.map +1 -0
  253. package/dist/apps/control-plane/cli/resume-command-handler.d.ts +17 -0
  254. package/dist/apps/control-plane/cli/resume-command-handler.js +178 -0
  255. package/dist/apps/control-plane/cli/resume-command-handler.js.map +1 -0
  256. package/dist/apps/control-plane/cli/run-command-handler.d.ts +15 -0
  257. package/dist/apps/control-plane/cli/run-command-handler.js +39 -0
  258. package/dist/apps/control-plane/cli/run-command-handler.js.map +1 -0
  259. package/dist/apps/control-plane/cli/spec-ingestion-service.d.ts +8 -0
  260. package/dist/apps/control-plane/cli/spec-ingestion-service.js +77 -0
  261. package/dist/apps/control-plane/cli/spec-ingestion-service.js.map +1 -0
  262. package/dist/apps/control-plane/cli/spec-input-resolver.d.ts +9 -0
  263. package/dist/apps/control-plane/cli/spec-input-resolver.js +81 -0
  264. package/dist/apps/control-plane/cli/spec-input-resolver.js.map +1 -0
  265. package/dist/apps/control-plane/cli/spec-utils.d.ts +3 -0
  266. package/dist/apps/control-plane/cli/spec-utils.js +36 -0
  267. package/dist/apps/control-plane/cli/spec-utils.js.map +1 -0
  268. package/dist/apps/control-plane/cli/status-command-handler.d.ts +7 -0
  269. package/dist/apps/control-plane/cli/status-command-handler.js +14 -0
  270. package/dist/apps/control-plane/cli/status-command-handler.js.map +1 -0
  271. package/dist/apps/control-plane/cli/stop-command-handler.d.ts +3 -0
  272. package/dist/apps/control-plane/cli/stop-command-handler.js +6 -0
  273. package/dist/apps/control-plane/cli/stop-command-handler.js.map +1 -0
  274. package/dist/apps/control-plane/cli/tooling.d.ts +4 -0
  275. package/dist/apps/control-plane/cli/tooling.js +24 -0
  276. package/dist/apps/control-plane/cli/tooling.js.map +1 -0
  277. package/dist/apps/control-plane/cli/types.d.ts +31 -0
  278. package/dist/apps/control-plane/cli/types.js +2 -0
  279. package/dist/apps/control-plane/cli/types.js.map +1 -0
  280. package/dist/apps/control-plane/core/collisions.d.ts +39 -0
  281. package/dist/apps/control-plane/core/collisions.js +78 -0
  282. package/dist/apps/control-plane/core/collisions.js.map +1 -0
  283. package/dist/apps/control-plane/core/constants.d.ts +64 -0
  284. package/dist/apps/control-plane/core/constants.js +64 -0
  285. package/dist/apps/control-plane/core/constants.js.map +1 -0
  286. package/dist/apps/control-plane/core/error-codes.d.ts +50 -0
  287. package/dist/apps/control-plane/core/error-codes.js +52 -0
  288. package/dist/apps/control-plane/core/error-codes.js.map +1 -0
  289. package/dist/apps/control-plane/core/frontmatter.d.ts +11 -0
  290. package/dist/apps/control-plane/core/frontmatter.js +30 -0
  291. package/dist/apps/control-plane/core/frontmatter.js.map +1 -0
  292. package/dist/apps/control-plane/core/fs.d.ts +33 -0
  293. package/dist/apps/control-plane/core/fs.js +134 -0
  294. package/dist/apps/control-plane/core/fs.js.map +1 -0
  295. package/dist/apps/control-plane/core/gates.d.ts +88 -0
  296. package/dist/apps/control-plane/core/gates.js +229 -0
  297. package/dist/apps/control-plane/core/gates.js.map +1 -0
  298. package/dist/apps/control-plane/core/git.d.ts +31 -0
  299. package/dist/apps/control-plane/core/git.js +79 -0
  300. package/dist/apps/control-plane/core/git.js.map +1 -0
  301. package/dist/apps/control-plane/core/kernel.d.ts +445 -0
  302. package/dist/apps/control-plane/core/kernel.js +805 -0
  303. package/dist/apps/control-plane/core/kernel.js.map +1 -0
  304. package/dist/apps/control-plane/core/patch.d.ts +23 -0
  305. package/dist/apps/control-plane/core/patch.js +118 -0
  306. package/dist/apps/control-plane/core/patch.js.map +1 -0
  307. package/dist/apps/control-plane/core/path-layout.d.ts +23 -0
  308. package/dist/apps/control-plane/core/path-layout.js +90 -0
  309. package/dist/apps/control-plane/core/path-layout.js.map +1 -0
  310. package/dist/apps/control-plane/core/path-rules.d.ts +13 -0
  311. package/dist/apps/control-plane/core/path-rules.js +52 -0
  312. package/dist/apps/control-plane/core/path-rules.js.map +1 -0
  313. package/dist/apps/control-plane/core/qa-index.d.ts +53 -0
  314. package/dist/apps/control-plane/core/qa-index.js +112 -0
  315. package/dist/apps/control-plane/core/qa-index.js.map +1 -0
  316. package/dist/apps/control-plane/core/response.d.ts +19 -0
  317. package/dist/apps/control-plane/core/response.js +34 -0
  318. package/dist/apps/control-plane/core/response.js.map +1 -0
  319. package/dist/apps/control-plane/core/runtime-sessions.d.ts +19 -0
  320. package/dist/apps/control-plane/core/runtime-sessions.js +2 -0
  321. package/dist/apps/control-plane/core/runtime-sessions.js.map +1 -0
  322. package/dist/apps/control-plane/core/schemas.d.ts +23 -0
  323. package/dist/apps/control-plane/core/schemas.js +80 -0
  324. package/dist/apps/control-plane/core/schemas.js.map +1 -0
  325. package/dist/apps/control-plane/index.d.ts +11 -0
  326. package/dist/apps/control-plane/index.js +9 -0
  327. package/dist/apps/control-plane/index.js.map +1 -0
  328. package/dist/apps/control-plane/interfaces/cli/bootstrap.d.ts +2 -0
  329. package/dist/apps/control-plane/interfaces/cli/bootstrap.js +86 -0
  330. package/dist/apps/control-plane/interfaces/cli/bootstrap.js.map +1 -0
  331. package/dist/apps/control-plane/mcp/kernel-tool-executor.d.ts +14 -0
  332. package/dist/apps/control-plane/mcp/kernel-tool-executor.js +26 -0
  333. package/dist/apps/control-plane/mcp/kernel-tool-executor.js.map +1 -0
  334. package/dist/apps/control-plane/mcp/mcp-server-adapter.d.ts +19 -0
  335. package/dist/apps/control-plane/mcp/mcp-server-adapter.js +55 -0
  336. package/dist/apps/control-plane/mcp/mcp-server-adapter.js.map +1 -0
  337. package/dist/apps/control-plane/mcp/operation-ledger.d.ts +21 -0
  338. package/dist/apps/control-plane/mcp/operation-ledger.js +75 -0
  339. package/dist/apps/control-plane/mcp/operation-ledger.js.map +1 -0
  340. package/dist/apps/control-plane/mcp/protocol-contract.d.ts +8 -0
  341. package/dist/apps/control-plane/mcp/protocol-contract.js +9 -0
  342. package/dist/apps/control-plane/mcp/protocol-contract.js.map +1 -0
  343. package/dist/apps/control-plane/mcp/runtime-factory.d.ts +38 -0
  344. package/dist/apps/control-plane/mcp/runtime-factory.js +71 -0
  345. package/dist/apps/control-plane/mcp/runtime-factory.js.map +1 -0
  346. package/dist/apps/control-plane/mcp/runtime-types.d.ts +40 -0
  347. package/dist/apps/control-plane/mcp/runtime-types.js +2 -0
  348. package/dist/apps/control-plane/mcp/runtime-types.js.map +1 -0
  349. package/dist/apps/control-plane/mcp/token-auth-verifier.d.ts +24 -0
  350. package/dist/apps/control-plane/mcp/token-auth-verifier.js +45 -0
  351. package/dist/apps/control-plane/mcp/token-auth-verifier.js.map +1 -0
  352. package/dist/apps/control-plane/mcp/token-claims-validator.d.ts +9 -0
  353. package/dist/apps/control-plane/mcp/token-claims-validator.js +62 -0
  354. package/dist/apps/control-plane/mcp/token-claims-validator.js.map +1 -0
  355. package/dist/apps/control-plane/mcp/token-codec.d.ts +11 -0
  356. package/dist/apps/control-plane/mcp/token-codec.js +46 -0
  357. package/dist/apps/control-plane/mcp/token-codec.js.map +1 -0
  358. package/dist/apps/control-plane/mcp/tool-authorizer.d.ts +8 -0
  359. package/dist/apps/control-plane/mcp/tool-authorizer.js +36 -0
  360. package/dist/apps/control-plane/mcp/tool-authorizer.js.map +1 -0
  361. package/dist/apps/control-plane/mcp/tool-client.d.ts +30 -0
  362. package/dist/apps/control-plane/mcp/tool-client.js +50 -0
  363. package/dist/apps/control-plane/mcp/tool-client.js.map +1 -0
  364. package/dist/apps/control-plane/mcp/tool-contract-validator.d.ts +29 -0
  365. package/dist/apps/control-plane/mcp/tool-contract-validator.js +61 -0
  366. package/dist/apps/control-plane/mcp/tool-contract-validator.js.map +1 -0
  367. package/dist/apps/control-plane/mcp/tool-registry-loader.d.ts +15 -0
  368. package/dist/apps/control-plane/mcp/tool-registry-loader.js +109 -0
  369. package/dist/apps/control-plane/mcp/tool-registry-loader.js.map +1 -0
  370. package/dist/apps/control-plane/mcp/tool-runtime.d.ts +34 -0
  371. package/dist/apps/control-plane/mcp/tool-runtime.js +252 -0
  372. package/dist/apps/control-plane/mcp/tool-runtime.js.map +1 -0
  373. package/dist/apps/control-plane/mcp/tools-markdown-generator.d.ts +7 -0
  374. package/dist/apps/control-plane/mcp/tools-markdown-generator.js +22 -0
  375. package/dist/apps/control-plane/mcp/tools-markdown-generator.js.map +1 -0
  376. package/dist/apps/control-plane/mcp/transport-types.d.ts +14 -0
  377. package/dist/apps/control-plane/mcp/transport-types.js +2 -0
  378. package/dist/apps/control-plane/mcp/transport-types.js.map +1 -0
  379. package/dist/apps/control-plane/mcp/types.d.ts +2 -0
  380. package/dist/apps/control-plane/mcp/types.js +3 -0
  381. package/dist/apps/control-plane/mcp/types.js.map +1 -0
  382. package/dist/apps/control-plane/providers/providers.d.ts +72 -0
  383. package/dist/apps/control-plane/providers/providers.js +94 -0
  384. package/dist/apps/control-plane/providers/providers.js.map +1 -0
  385. package/dist/apps/control-plane/supervisor/build-wave-executor.d.ts +13 -0
  386. package/dist/apps/control-plane/supervisor/build-wave-executor.js +40 -0
  387. package/dist/apps/control-plane/supervisor/build-wave-executor.js.map +1 -0
  388. package/dist/apps/control-plane/supervisor/lease-heartbeat-service.d.ts +12 -0
  389. package/dist/apps/control-plane/supervisor/lease-heartbeat-service.js +14 -0
  390. package/dist/apps/control-plane/supervisor/lease-heartbeat-service.js.map +1 -0
  391. package/dist/apps/control-plane/supervisor/planning-wave-executor.d.ts +19 -0
  392. package/dist/apps/control-plane/supervisor/planning-wave-executor.js +249 -0
  393. package/dist/apps/control-plane/supervisor/planning-wave-executor.js.map +1 -0
  394. package/dist/apps/control-plane/supervisor/prompt-bundle-loader.d.ts +9 -0
  395. package/dist/apps/control-plane/supervisor/prompt-bundle-loader.js +53 -0
  396. package/dist/apps/control-plane/supervisor/prompt-bundle-loader.js.map +1 -0
  397. package/dist/apps/control-plane/supervisor/qa-wave-executor.d.ts +24 -0
  398. package/dist/apps/control-plane/supervisor/qa-wave-executor.js +70 -0
  399. package/dist/apps/control-plane/supervisor/qa-wave-executor.js.map +1 -0
  400. package/dist/apps/control-plane/supervisor/run-coordinator.d.ts +49 -0
  401. package/dist/apps/control-plane/supervisor/run-coordinator.js +162 -0
  402. package/dist/apps/control-plane/supervisor/run-coordinator.js.map +1 -0
  403. package/dist/apps/control-plane/supervisor/runtime.d.ts +58 -0
  404. package/dist/apps/control-plane/supervisor/runtime.js +270 -0
  405. package/dist/apps/control-plane/supervisor/runtime.js.map +1 -0
  406. package/dist/apps/control-plane/supervisor/session-orchestrator.d.ts +29 -0
  407. package/dist/apps/control-plane/supervisor/session-orchestrator.js +211 -0
  408. package/dist/apps/control-plane/supervisor/session-orchestrator.js.map +1 -0
  409. package/dist/apps/control-plane/supervisor/types.d.ts +148 -0
  410. package/dist/apps/control-plane/supervisor/types.js +2 -0
  411. package/dist/apps/control-plane/supervisor/types.js.map +1 -0
  412. package/dist/apps/control-plane/supervisor/worker-decision-loop.d.ts +37 -0
  413. package/dist/apps/control-plane/supervisor/worker-decision-loop.js +236 -0
  414. package/dist/apps/control-plane/supervisor/worker-decision-loop.js.map +1 -0
  415. package/docker/mcp.Dockerfile +14 -0
  416. package/docker/mcp.compose.yaml +15 -0
  417. package/docker/mcp.entrypoint.sh +17 -0
  418. package/eslint.config.mjs +93 -0
  419. package/example-configurations/README.md +26 -0
  420. package/example-configurations/java/agents.yaml +14 -0
  421. package/example-configurations/java/gates.yaml +29 -0
  422. package/example-configurations/java/policy.yaml +148 -0
  423. package/example-configurations/node/agents.yaml +14 -0
  424. package/example-configurations/node/gates.yaml +32 -0
  425. package/example-configurations/node/policy.yaml +143 -0
  426. package/nx.json +16 -0
  427. package/package.json +39 -0
  428. package/prompts/vitest-testing-standards.instructions.md +204 -0
  429. package/scripts/dev-shell-env.sh +7 -0
  430. package/scripts/nx-safe.mjs +33 -0
  431. package/spec-files/agentic_orchestrator_cli_delete_command_spec.md +310 -0
  432. package/spec-files/agentic_orchestrator_dot_aop_generated_artifacts_spec.md +211 -0
  433. package/spec-files/agentic_orchestrator_mcp_formalization_spec.md +379 -0
  434. package/spec-files/agentic_orchestrator_oop_refactor_spec.md +415 -0
  435. package/spec-files/agentic_orchestrator_single_global_orchestrator_spec.md +265 -0
  436. package/spec-files/agentic_orchestrator_spec.md +1334 -0
  437. package/spec-files/progress.md +452 -0
  438. package/tsconfig.base.json +15 -0
  439. package/tsconfig.json +11 -0
package/README.md ADDED
@@ -0,0 +1,679 @@
1
+ # Agentic-Orchestrator
2
+
3
+ [![TypeScript](https://img.shields.io/badge/TypeScript-NodeNext-3178C6.svg)](https://www.typescriptlang.org/)
4
+ [![Nx Workspace](https://img.shields.io/badge/Nx-Monorepo-143055.svg)](https://nx.dev/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ A deterministic, MCP-first control plane for parallel multi-agent feature development.
8
+
9
+ It combines:
10
+
11
+ - a **deterministic kernel** (state, locks, collisions, gates, evidence)
12
+ - a **supervisor runtime** (orchestrator/planner/builder/qa session coordination)
13
+ - a **CLI contract** (`aop <run|status|resume|stop|delete>`) with deterministic spec ingestion, runtime control, and cleanup
14
+
15
+ > For complete normative requirements, see [agentic_orchestrator_spec.md](spec-files/agentic_orchestrator_spec.md).
16
+ > For implementation continuity and the latest status, see [progress.md](spec-files/progress.md).
17
+
18
+ ---
19
+
20
+ ## Quick Overview
21
+
22
+ Without a deterministic control plane, agentic parallel development is fragile:
23
+
24
+ ```bash
25
+ # brittle: no centralized state, lock ownership, or collision arbitration
26
+ # (multiple agents independently edit overlapping files/resources)
27
+ ```
28
+
29
+ With Agentic-Orchestrator:
30
+
31
+ ```bash
32
+ # deterministic: canonical state + lock leases + collision checks + gate evidence
33
+ npm run run -- -fi ./.aop/features/my_feature/spec.md --agent-provider custom
34
+ ```
35
+
36
+ Core guarantees:
37
+
38
+ - policy/schema validated plans before build
39
+ - worktree-per-feature isolation
40
+ - lock lease ownership for shared resources
41
+ - gate execution with evidence artifacts
42
+ - explicit merge promotion path (`feature.ready_to_merge`)
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ npm install
48
+ ```
49
+
50
+ ## Quick Start
51
+
52
+ ### 1. Prepare or use a feature spec
53
+
54
+ Canonical path format:
55
+
56
+ ```text
57
+ .aop/features/<feature_id>/spec.md
58
+ ```
59
+
60
+ ### 2. Run typecheck and build
61
+
62
+ ```bash
63
+ npm run typecheck
64
+ npm run build
65
+ ```
66
+
67
+ ### 3. Run one feature flow
68
+
69
+ ```bash
70
+ npm run run -- -fi ./.aop/features/my_feature/spec.md --agent-provider custom
71
+ ```
72
+
73
+ ### 4. Check runtime status
74
+
75
+ ```bash
76
+ npm run run -- status
77
+ ```
78
+
79
+ ### 5. Resume from persisted state
80
+
81
+ ```bash
82
+ npm run run -- resume
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Development
88
+
89
+ This repository is the **control-plane workspace** for Agentic-Orchestrator.
90
+
91
+ ### Project Structure
92
+
93
+ ```text
94
+ Agentic-Orchestrator/
95
+ ├── .aop/
96
+ │ ├── features/ # runtime-generated feature artifacts
97
+ │ │ └── index.json # global orchestration index
98
+ │ └── runtime/
99
+ │ └── operation-ledger/
100
+ ├── agentic/
101
+ │ ├── orchestrator/ # policy/gates/agents config + schemas + prompts
102
+ │ │ ├── policy.yaml
103
+ │ │ ├── gates.yaml
104
+ │ │ ├── agents.yaml
105
+ │ │ ├── schemas/
106
+ │ │ └── tools.md
107
+ ├── apps/
108
+ │ └── control-plane/
109
+ │ ├── src/
110
+ │ │ ├── cli/ # aop CLI
111
+ │ │ ├── core/ # deterministic kernel
112
+ │ │ ├── providers/ # provider resolution + adapter
113
+ │ │ └── supervisor/ # runtime orchestration loop
114
+ │ ├── test/ # Vitest suites
115
+ │ ├── project.json # Nx targets
116
+ │ └── vitest.config.ts
117
+ ├── spec-files/
118
+ │ ├── agentic_orchestrator_spec.md
119
+ │ ├── agentic_orchestrator_mcp_formalization_spec.md
120
+ │ ├── agentic_orchestrator_single_global_orchestrator_spec.md
121
+ │ ├── agentic_orchestrator_oop_refactor_spec.md
122
+ │ └── progress.md # implementation continuity log
123
+ └── README.md
124
+ ```
125
+
126
+ ### Setup
127
+
128
+ ```bash
129
+ git clone https://github.com/Eric-Taurone-Software/Agentic-Orchestrator.git
130
+ cd Agentic-Orchestrator
131
+ npm install
132
+ ```
133
+
134
+ ### Development Workflow
135
+
136
+ #### Type-check
137
+
138
+ ```bash
139
+ npm run typecheck
140
+ ```
141
+
142
+ #### Build
143
+
144
+ ```bash
145
+ npm run build
146
+ ```
147
+
148
+ `npm run build` is lint-gated (`npm run lint && ...`) and fails on any lint warning/error.
149
+
150
+ #### Lint
151
+
152
+ ```bash
153
+ npm run lint
154
+ ```
155
+
156
+ #### Run tests
157
+
158
+ ```bash
159
+ npm test
160
+ ```
161
+
162
+ #### Validate MCP contract pins and registry/docs consistency
163
+
164
+ ```bash
165
+ npm run validate:mcp-contracts
166
+ ```
167
+
168
+ #### Validate architecture boundaries
169
+
170
+ ```bash
171
+ npm run validate:architecture
172
+ ```
173
+
174
+ #### Validate Docker MCP deployment contract
175
+
176
+ ```bash
177
+ npm run validate:docker-mcp
178
+ ```
179
+
180
+ #### Run orchestrator CLI
181
+
182
+ ```bash
183
+ # source mode (tsx)
184
+ npm run run -- -fi ./.aop/features/my_feature/spec.md --agent-provider custom
185
+
186
+ # built artifact
187
+ node dist/apps/control-plane/cli/aop.js run -fi ./.aop/features/my_feature/spec.md --agent-provider custom
188
+ ```
189
+
190
+ ---
191
+
192
+ ## CLI Contract
193
+
194
+ Primary command:
195
+
196
+ ```bash
197
+ aop <run|status|resume|stop|delete> [options]
198
+ ```
199
+
200
+ If no command is provided, the CLI defaults to `run`.
201
+
202
+ All commands print JSON to stdout. Errors use:
203
+
204
+ ```json
205
+ { "ok": false, "error": { "code": "...", "message": "...", "details": { ... } } }
206
+ ```
207
+
208
+ ### `run`
209
+
210
+ Starts orchestration for feature specs and returns runtime metadata (`runtime_status`, `queue_depth`, dashboard snapshot, and active feature list).
211
+
212
+ Examples:
213
+
214
+ ```bash
215
+ # Installed binary
216
+ aop run -fi ./.aop/features/my_feature/spec.md --agent-provider custom
217
+
218
+ # In-repo dev command
219
+ npm run run -- -fi ./.aop/features/my_feature/spec.md --agent-provider custom
220
+ ```
221
+
222
+ Behavior:
223
+
224
+ - Input resolution:
225
+ - `-fi <path>` uses one file.
226
+ - `-fl <path>` recursively discovers all `*.md` files in deterministic lexical order.
227
+ - no `-fi/-fl` calls `feature.discover_specs` and runs discovered canonical specs.
228
+ - Canonical ingestion:
229
+ - canonical input (`.aop/features/<feature_id>/spec.md`) runs in place.
230
+ - non-canonical input is copied to `.aop/features/<feature_id>/spec.md`.
231
+ - `feature_id` is derived from file stem (strips `.spec` or `-spec` suffixes when present).
232
+ - each ingested feature runs `feature.init`, then state source metadata is patched with source path/hash.
233
+ - Provider selection precedence:
234
+ 1. CLI flags (`--agent-provider`, `--agent-model`, `--provider-config-env`)
235
+ 2. env vars (`AOP_AGENT_PROVIDER`, `AOP_AGENT_MODEL`, `AOP_PROVIDER_CONFIG_ENV`)
236
+ 3. `agentic/orchestrator/agents.yaml` runtime defaults
237
+ - Runtime start:
238
+ - starts `SupervisorRuntime` with `max_active_features=5`, `max_parallel_gate_runs=3`.
239
+ - `max_iterations_per_phase` resolves from `policy.yaml` (`supervisor.max_iterations_per_phase`, default `6`).
240
+ - `--takeover-stale-run` enables stale run-lease takeover when another run is stale.
241
+
242
+ ### `status`
243
+
244
+ Returns orchestration snapshot via `report.dashboard`:
245
+
246
+ - global index (`active`, `blocked`, `merged`, locks, runtime session metadata)
247
+ - per-feature summaries (status, held locks, gate profile/results, timestamps)
248
+
249
+ Example:
250
+
251
+ ```bash
252
+ aop status
253
+ ```
254
+
255
+ ### `resume`
256
+
257
+ Runs recovery (`kernel.recoverFromState`), reconstructs resumable non-terminal feature work, and restarts `SupervisorRuntime` from persisted state:
258
+
259
+ - candidate sources:
260
+ - `index.active`
261
+ - `index.blocked`
262
+ - `index.blocked_queue`
263
+ - `runtime_sessions.feature_sessions`
264
+ - `feature.discover_specs`
265
+ - feature selection:
266
+ - excludes terminal states (`merged`, `failed`)
267
+ - computes deterministic `resume_phase` (`planning|building|qa|ready_to_merge`)
268
+ - sorts by earliest phase then `feature_id`
269
+ - runtime restart:
270
+ - reuses persisted `runtime_sessions.run_id` and `owner_instance_id` when present
271
+ - starts supervisor loop with reconstructed feature set
272
+
273
+ If no resumable features are found, `resume` returns recovery metadata only and does not start a new loop.
274
+
275
+ Example:
276
+
277
+ ```bash
278
+ aop resume
279
+ ```
280
+
281
+ ---
282
+
283
+ ## Docker MCP Deployment
284
+
285
+ Baseline container artifacts:
286
+
287
+ - image definition: `docker/mcp.Dockerfile`
288
+ - runtime preflight entrypoint: `docker/mcp.entrypoint.sh`
289
+ - compose contract: `docker/mcp.compose.yaml`
290
+
291
+ Required runtime assumptions:
292
+
293
+ - target repository is bind-mounted at `/repo`
294
+ - container includes `node`, `npm`, `npx`, and `git`
295
+ - commands execute from `/repo`
296
+
297
+ Quick usage:
298
+
299
+ ```bash
300
+ docker compose -f docker/mcp.compose.yaml build aop-mcp
301
+ docker compose -f docker/mcp.compose.yaml run --rm aop-mcp npm run run -- status --transport mcp
302
+ ```
303
+
304
+ Contract validation:
305
+
306
+ ```bash
307
+ npm run validate:docker-mcp
308
+ node apps/control-plane/scripts/validate-docker-mcp-contract.mjs --smoke
309
+ ```
310
+
311
+ ### `stop`
312
+
313
+ Current behavior is a placeholder only:
314
+
315
+ ```json
316
+ { "ok": true, "data": { "status": "stop_not_implemented_yet" } }
317
+ ```
318
+
319
+ It does not currently terminate active sessions or revoke leases.
320
+
321
+ Example:
322
+
323
+ ```bash
324
+ aop stop
325
+ ```
326
+
327
+ ### `delete`
328
+
329
+ Performs deterministic feature cleanup. Default behavior is preview-only (`dry_run=true`); destructive execution requires `--yes`.
330
+
331
+ Examples:
332
+
333
+ ```bash
334
+ # Preview cleanup plan only (default behavior)
335
+ aop delete --feature-id my_feature
336
+
337
+ # Apply cleanup (remove runtime artifacts + worktree; keep local branch)
338
+ aop delete --feature-id my_feature --yes
339
+
340
+ # Apply cleanup and force-delete local branch
341
+ aop delete --feature-id my_feature --yes --remove-branch force
342
+ ```
343
+
344
+ Behavior:
345
+
346
+ - blocks deletion when a fresh run lease exists (`run_already_active`)
347
+ - preview reports planned cleanup for feature files, index/session references, locks, blocked queue entries, worktree, and branch
348
+ - execution removes feature residue from index/runtime state, deletes `.aop/features/<feature_id>`, optionally removes worktree, and optionally removes local branch
349
+
350
+ ### CLI Options
351
+
352
+ Supported options:
353
+
354
+ | Option | Description |
355
+ |-------------------------------------------------------|-----------------------------------------------------------------------------------|
356
+ | `-fi <path>` | Run exactly one spec file |
357
+ | `-fl <path>` | Resolve all `**/*.md` files recursively in a folder (deterministic lexical order) |
358
+ | `--agent-provider <codex\\|claude\\|gemini\\|custom>` | Provider selection |
359
+ | `--agent-model <model-id>` | Model selection |
360
+ | `--provider-config-env <ENV_VAR>` | Provider auth/config environment variable name |
361
+ | `--transport <mcp\\|inprocess>` | Tool transport selection (default `mcp`) |
362
+ | `--takeover-stale-run` | Allow stale run-lease takeover during `run` |
363
+ | `--feature-id <id>` | Target feature for `delete` |
364
+ | `--dry-run [true\\|false]` | Delete mode selector (defaults to preview behavior) |
365
+ | `--yes` | Confirm destructive `delete` execution |
366
+ | `--remove-worktree [true\\|false]` | Whether `delete` removes `.worktrees/<feature_id>` (default `true`) |
367
+ | `--remove-branch <none\\|safe\\|force>` | Optional local branch cleanup mode for `delete` (default `none`) |
368
+
369
+ Validation behavior:
370
+
371
+ - `-fi` and `-fl` are mutually exclusive (`invalid_cli_args`)
372
+ - missing path/folder -> `input_path_not_found`
373
+ - no discovered specs -> `no_specs_found`
374
+ - unsupported command -> `invalid_cli_args`
375
+ - invalid `--transport` -> `invalid_cli_args`
376
+ - `delete` without `--feature-id` -> `invalid_cli_args`
377
+ - destructive `delete` without `--yes` -> `invalid_cli_args` when explicitly requested via `--dry-run false`
378
+
379
+ Feature ID derivation for non-canonical inputs:
380
+
381
+ 1. start from filename stem
382
+ 2. remove `.spec` suffix if present
383
+ 3. else remove `-spec` suffix if present
384
+ 4. result must match `^[a-z0-9_][a-z0-9_-]*$`
385
+
386
+ Provider resolution precedence:
387
+
388
+ 1. CLI flags
389
+ 2. env vars (`AOP_AGENT_PROVIDER`, `AOP_AGENT_MODEL`, `AOP_PROVIDER_CONFIG_ENV`)
390
+ 3. `agentic/orchestrator/agents.yaml` runtime defaults
391
+
392
+ Transport behavior:
393
+
394
+ - default transport is `mcp`
395
+ - use `--transport inprocess` for test/recovery fallback paths
396
+ - `--transport mcp` remains available for explicitness
397
+
398
+ ---
399
+
400
+ ## Configuration
401
+
402
+ ### Policy (`agentic/orchestrator/policy.yaml`)
403
+
404
+ Current defaults include:
405
+
406
+ - plan and allowed-area patch enforcement enabled
407
+ - collision policy `reject`
408
+ - lock resources: `openapi`, `events`, `db_migrations`, `protected:libs/core`
409
+ - lock acquisition behavior: wait + backoff, lease TTL `300s`
410
+ - default execution timeout `600s`
411
+ - coverage minimums `line>=0.90`, `branch>=0.90`
412
+ - coverage targets `line=1.00`, `branch=1.00`
413
+ - implementation constraints: `workspace=nx`, `framework=vitest`
414
+ - merge requires explicit user approval token
415
+ - supervisor iteration loop is policy-configurable via `supervisor.max_iterations_per_phase` (default `6`)
416
+
417
+ ### Gates (`agentic/orchestrator/gates.yaml`)
418
+
419
+ Default profile modes:
420
+
421
+ - `fast`
422
+ - `full`
423
+ - `merge`
424
+
425
+ Coverage parser:
426
+
427
+ - `lcov` from `coverage/control-plane/lcov.info`
428
+
429
+ ### Agents (`agentic/orchestrator/agents.yaml`)
430
+
431
+ - role-specific system prompt paths
432
+ - default provider/model/config-env fallback values
433
+ - stack-specific examples: [`example-configurations/node/`](example-configurations/node) and [`example-configurations/java/`](example-configurations/java)
434
+
435
+ ### Example configuration bundles
436
+
437
+ - overview: [`example-configurations/README.md`](example-configurations/README.md)
438
+ - Node.js bundle: [`example-configurations/node/`](example-configurations/node)
439
+ - Java (Maven) bundle: [`example-configurations/java/`](example-configurations/java)
440
+ - note: `policy.yaml` `implementation.workspace` and `testing.framework` are control-plane schema invariants; language-specific test execution lives in each bundle's `gates.yaml`.
441
+
442
+ ---
443
+
444
+ ## Required Schemas
445
+
446
+ This section defines the schema-governed files the target repository must contain or will be expected to produce at runtime.
447
+
448
+ ### Who provides what
449
+
450
+ Files you provide/configure:
451
+
452
+ - `agentic/orchestrator/policy.yaml`
453
+ - `agentic/orchestrator/gates.yaml`
454
+ - `agentic/orchestrator/agents.yaml` (recommended; if present it is schema validated)
455
+ - `.aop/features/<feature_id>/spec.md` (input spec per feature)
456
+
457
+ Files the runtime creates/maintains:
458
+
459
+ - `.aop/features/index.json`
460
+ - `.aop/features/<feature_id>/state.md`
461
+ - `.aop/features/<feature_id>/plan.json`
462
+ - `.aop/features/<feature_id>/qa_test_index.json`
463
+ - `.aop/features/<feature_id>/logs/*`
464
+ - `.aop/features/<feature_id>/evidence/*`
465
+
466
+ ### Schema mapping
467
+
468
+ | Runtime file | Schema file | Required/expected essentials |
469
+ |----------------------------------------------------|----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
470
+ | `.aop/features/<feature_id>/plan.json` | `agentic/orchestrator/schemas/plan.schema.json` | `feature_id`, `plan_version`, `summary`, `allowed_areas`, `forbidden_areas`, `base_ref`, `files.{create,modify,delete}`, `contracts.{openapi,events,db}`, `acceptance_criteria`, `gate_profile` |
471
+ | `.aop/features/<feature_id>/state.md` front matter | `agentic/orchestrator/schemas/state.schema.json` | `feature_id`, `version`, `branch`, `worktree_path`, `status`, `gate_profile`, `gates`, `locks.held`, `collisions`, `cluster`, `role_status`, `last_updated` |
472
+ | `.aop/features/index.json` | `agentic/orchestrator/schemas/index.schema.json` | `version`, `active`, `blocked`, `merged`, `locks`, `lock_leases`, `blocked_queue`, `runtime_sessions.{run_id,orchestrator_session_id,owner_instance_id,lease_expires_at,feature_sessions}` |
473
+ | `agentic/orchestrator/gates.yaml` | `agentic/orchestrator/schemas/gates.schema.json` | `version`, `profiles.<profile>.modes.<mode>[{name,cmd,...}]`, optional parser/threshold metadata |
474
+ | `agentic/orchestrator/policy.yaml` | `agentic/orchestrator/schemas/policy.schema.json` | commit/merge policy, patch policy, lock config, collision policy, path rules, execution policy, RBAC, Nx/Vitest implementation constraints |
475
+ | `agentic/orchestrator/agents.yaml` | `agentic/orchestrator/schemas/agents.schema.json` | `version`, `roles`, `missing_prompt_behavior`, optional runtime defaults |
476
+ | `.aop/features/<feature_id>/qa_test_index.json` | `agentic/orchestrator/schemas/qa_test_index.schema.json` | `feature_id`, `version`, `source_diff_ref`, `items[]` with path/hunks/required_tests/status |
477
+
478
+ ### Important operational notes
479
+
480
+ - `state.md`, `index.json`, `plan.json`, and `qa_test_index.json` are not just data files; they are part of the runtime contract and are versioned/validated.
481
+ - mutating operations are optimistic-concurrency guarded (`expected_version`/`expected_plan_version` semantics).
482
+ - schema failures are blocked and returned as structured errors.
483
+
484
+ ---
485
+
486
+ ## Branches, Worktrees, and Review Before Merge
487
+
488
+ This runtime uses **feature branches + git worktrees**, not GitHub/GitLab fork automation.
489
+
490
+ - A feature flow creates/uses branch `<feature_id>`
491
+ - It creates worktree `.worktrees/<feature_id>`
492
+ - Changes are visible on host filesystem before merge
493
+ - Merge is never implicit on gate pass; it requires explicit promotion via `feature.ready_to_merge` after approval
494
+
495
+ ### What gets created
496
+
497
+ For feature `my_feature`:
498
+
499
+ - branch: `my_feature`
500
+ - worktree path: `.worktrees/my_feature`
501
+
502
+ Base branch used for cut is configured in `policy.yaml` (`worktree.base_branch`, currently `main`).
503
+
504
+ ### Manual review workflow (recommended)
505
+
506
+ 1. Inspect working changes in the feature worktree:
507
+ ```bash
508
+ git -C .worktrees/my_feature status
509
+ git -C .worktrees/my_feature diff --stat
510
+ git -C .worktrees/my_feature diff
511
+ ```
512
+ 2. Inspect commit history for the feature branch:
513
+ ```bash
514
+ git log --oneline --decorate main..my_feature
515
+ ```
516
+ 3. Compare branch delta against base:
517
+ ```bash
518
+ git diff --name-status main...my_feature
519
+ git diff main...my_feature
520
+ ```
521
+ 4. Inspect runtime evidence and logs:
522
+ ```bash
523
+ ls -la .aop/features/my_feature/evidence
524
+ ls -la .aop/features/my_feature/logs
525
+ ```
526
+ 5. Only after review/approval, allow merge promotion (`feature.ready_to_merge` path).
527
+
528
+ ### If you want remote forks anyway
529
+
530
+ The runtime does not create remote forks automatically. If your workflow requires forks, push feature branches manually to your fork remote.
531
+
532
+ ---
533
+
534
+ ## Deterministic Tool Surface (Detailed Definitions)
535
+
536
+ Defined in [agentic/orchestrator/tools.md](agentic/orchestrator/tools.md).
537
+
538
+ All failures return structured error payloads with stable error codes.
539
+
540
+ ### MCP contract artifacts
541
+
542
+ - `agentic/orchestrator/tools/catalog.json`: canonical tool list, roles, handler bindings, mutating/idempotency requirements, and schema refs.
543
+ - `agentic/orchestrator/tools/protocol.json`: pinned MCP protocol + SDK metadata and required transports.
544
+ - `agentic/orchestrator/tools/errors.schema.json`: normalized error envelope contract.
545
+ - `agentic/orchestrator/tools/schemas/input/*.schema.json`: per-tool request schemas.
546
+ - `agentic/orchestrator/tools/schemas/output/*.schema.json`: per-tool success payload schemas.
547
+
548
+ Validation workflow:
549
+
550
+ ```bash
551
+ npm run validate:mcp-contracts
552
+ npm run validate:architecture
553
+ ```
554
+
555
+ This verifies protocol pinning, `catalog.json`/`tools.md`/schema parity, and enforced layering boundaries before CI or release.
556
+
557
+ ### Tool definitions
558
+
559
+ | Tool | Purpose | Mutates state/files | Typical caller role(s) |
560
+ |--------------------------|------------------------------------------------------------------------|---------------------|----------------------------------------|
561
+ | `feature.discover_specs` | Discover canonical `spec.md` files under `.aop/features/*` | No | orchestrator, system |
562
+ | `feature.init` | Initialize feature folder/state and ensure branch/worktree | Yes | orchestrator, system |
563
+ | `feature.get_context` | Return spec + state + plan + latest evidence + QA index bundle | No | orchestrator, planner, builder, qa |
564
+ | `feature.state_get` | Read parsed state front matter/body | No | orchestrator/planner/builder/qa/system |
565
+ | `feature.state_patch` | Patch canonical feature state with version guard | Yes | orchestrator, system |
566
+ | `feature.log_append` | Append stamped note to feature decision log | Yes | orchestrator, system |
567
+ | `plan.submit` | Validate and accept initial plan (schema/policy/lock/collision checks) | Yes | orchestrator, planner |
568
+ | `plan.get` | Get accepted plan | No | orchestrator, planner, builder, qa |
569
+ | `plan.update` | Submit versioned plan revision (`+1` version) with full revalidation | Yes | orchestrator, planner |
570
+ | `repo.ensure_worktree` | Ensure feature branch + worktree exist | Yes | orchestrator, system |
571
+ | `repo.apply_patch` | Apply unified diff with plan/policy/path/lock enforcement | Yes | builder, qa, orchestrator |
572
+ | `repo.status` | Return porcelain status from feature worktree | No | builder, orchestrator |
573
+ | `repo.diff` | Return git diff for feature worktree | No | builder, qa, orchestrator |
574
+ | `repo.read_file` | Read file content from feature worktree path | No | planner, builder, qa, orchestrator |
575
+ | `repo.search` | Repo-safe text search (`rg`) in feature worktree | No | planner, builder, qa, orchestrator |
576
+ | `repo.diff_bundle` | Return review bundle (stat/full diff/files/latest gate summary) | No | orchestrator |
577
+ | `feature.ready_to_merge` | Commit + merge promotion after required gates and approval checks | Yes | orchestrator, system |
578
+ | `feature.delete` | Delete feature runtime artifacts and optional local git/worktree state | Yes | orchestrator, system |
579
+ | `gates.list` | List available gate profiles/modes | No | orchestrator, builder, qa |
580
+ | `gates.run` | Execute gate profile/mode, capture logs/evidence, enforce thresholds | Yes | builder, qa, orchestrator |
581
+ | `evidence.latest` | Return latest evidence summary for feature | No | qa, orchestrator |
582
+ | `qa.test_index_get` | Return QA index + pending obligations summary | No | qa, orchestrator |
583
+ | `qa.test_index_update` | Update QA hunk statuses with version guard and evidence refs | Yes | qa, orchestrator, system |
584
+ | `locks.acquire` | Acquire/renew resource lease lock for feature | Yes | orchestrator, system |
585
+ | `locks.release` | Release held resource lock | Yes | orchestrator, system |
586
+ | `collisions.scan` | Compute collision matrix across accepted plans | No | planner, orchestrator |
587
+ | `report.dashboard` | Return global orchestration summary | No | orchestrator |
588
+ | `report.feature_summary` | Return per-feature state/diff/evidence summary | No | orchestrator |
589
+
590
+ ### Role expectations at a glance
591
+
592
+ - `planner`: plan-focused, read/search, collision visibility
593
+ - `builder`: patch application + fast gate execution
594
+ - `qa`: patch/test follow-up + QA index updates + evidence inspection
595
+ - `orchestrator`: lifecycle coordination, locks, reporting, merge promotion, and feature cleanup (`delete`)
596
+ - `system`: internal automation fallback with broad access
597
+
598
+ ---
599
+
600
+ ## Quality & Testing
601
+
602
+ - framework: Vitest (`apps/control-plane/vitest.config.ts`)
603
+ - coverage output: `coverage/control-plane`
604
+ - configured thresholds: lines/branches/functions/statements at `90%`
605
+ - workspace tooling: Nx targets (`run`, `build`, `test`, `typecheck`)
606
+ - Nx launcher: use `npm run nx -- <target>`; this workspace defaults to `NX_DAEMON=false` and `NX_ISOLATE_PLUGINS=false` to avoid Unix-socket worker failures in restricted environments.
607
+ - Shell setup for raw `npx nx` commands:
608
+ ```bash
609
+ source scripts/dev-shell-env.sh
610
+ npx nx run control-plane:test
611
+ ```
612
+
613
+ ---
614
+
615
+ ## Current Status
616
+
617
+ From [progress.md](spec-files/progress.md):
618
+
619
+ - Nx + TypeScript + Vitest migration complete
620
+ - Kernel + supervisor + CLI implemented end-to-end
621
+ - strict linting is enforced (`npm run lint`) and build is lint-gated
622
+ - `npm run typecheck` passes
623
+ - architecture boundary checks are CI-enforced via `npm run validate:architecture`
624
+
625
+ Environment note observed during implementation sessions:
626
+
627
+ - intermittent `npm install` DNS failures (`EAI_AGAIN` to `registry.npmjs.org`) can block full test runs in constrained environments.
628
+
629
+ ---
630
+
631
+ ## Contributing
632
+
633
+ Contributions are welcome.
634
+
635
+ Suggested workflow:
636
+
637
+ 1. Create a feature branch (`feature/<name>`)
638
+ 2. Implement changes with tests
639
+ 3. Run quality checks:
640
+ ```bash
641
+ npm run typecheck
642
+ npm run build
643
+ npm test
644
+ ```
645
+ 4. Commit with clear, conventional commit messages
646
+ 5. Open a pull request with scope, rationale, and verification notes
647
+
648
+ ### Commit Convention
649
+
650
+ Recommended conventional prefixes:
651
+
652
+ - `feat:` new feature
653
+ - `fix:` bug fix
654
+ - `docs:` documentation
655
+ - `refactor:` internal structure change
656
+ - `test:` tests added/updated
657
+ - `chore:` maintenance and tooling
658
+
659
+ ---
660
+
661
+ ## License
662
+
663
+ MIT © Eric Taurone
664
+
665
+ See [LICENSE](LICENSE).
666
+
667
+ ---
668
+
669
+ ## Support & Links
670
+
671
+ - Repository: [Eric-Taurone-Software/Agentic-Orchestrator](https://github.com/Eric-Taurone-Software/Agentic-Orchestrator)
672
+ - Author: Eric Taurone
673
+ - Specification: [agentic_orchestrator_spec.md](spec-files/agentic_orchestrator_spec.md)
674
+ - Implementation log: [progress.md](spec-files/progress.md)
675
+ - Example bundles: [example-configurations/README.md](example-configurations/README.md)
676
+ - Tool catalog: [agentic/orchestrator/tools.md](agentic/orchestrator/tools.md)
677
+ - Policy config: [agentic/orchestrator/policy.yaml](agentic/orchestrator/policy.yaml)
678
+ - Gates config: [agentic/orchestrator/gates.yaml](agentic/orchestrator/gates.yaml)
679
+ - Agents config: [agentic/orchestrator/agents.yaml](agentic/orchestrator/agents.yaml)
@@ -0,0 +1,14 @@
1
+ version: 1
2
+ roles:
3
+ planner:
4
+ system_prompt_path: agentic/orchestrator/prompts/planner.system.md
5
+ builder:
6
+ system_prompt_path: agentic/orchestrator/prompts/builder.system.md
7
+ qa:
8
+ system_prompt_path: agentic/orchestrator/prompts/qa.system.md
9
+ missing_prompt_behavior: ignore
10
+ runtime:
11
+ default_provider: custom
12
+ default_model: local-default
13
+ provider_config_env: AOP_PROVIDER_CONFIG_ENV
14
+ role_provider_overrides: {}