agentic-orchestrator 0.1.2 → 0.1.4

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 (300) hide show
  1. package/.claude/settings.local.json +15 -0
  2. package/CLAUDE.md +126 -0
  3. package/README.md +166 -25
  4. package/agentic/orchestrator/adapters.yaml +3 -0
  5. package/agentic/orchestrator/gates.yaml +47 -0
  6. package/agentic/orchestrator/policy.yaml +89 -0
  7. package/agentic/orchestrator/schemas/adapters.schema.json +12 -0
  8. package/agentic/orchestrator/schemas/gates.schema.json +6 -1
  9. package/agentic/orchestrator/schemas/index.schema.json +14 -0
  10. package/agentic/orchestrator/schemas/multi-project.schema.json +41 -0
  11. package/agentic/orchestrator/schemas/policy.schema.json +449 -52
  12. package/agentic/orchestrator/schemas/state.schema.json +16 -0
  13. package/agentic/orchestrator/tools/catalog.json +68 -0
  14. package/agentic/orchestrator/tools/schemas/input/cost.get.input.schema.json +10 -0
  15. package/agentic/orchestrator/tools/schemas/input/cost.record.input.schema.json +13 -0
  16. package/agentic/orchestrator/tools/schemas/input/feature.send_message.input.schema.json +11 -0
  17. package/agentic/orchestrator/tools/schemas/input/performance.get_analytics.input.schema.json +10 -0
  18. package/agentic/orchestrator/tools/schemas/input/performance.record_outcome.input.schema.json +18 -0
  19. package/agentic/orchestrator/tools/schemas/output/cost.get.output.schema.json +13 -0
  20. package/agentic/orchestrator/tools/schemas/output/cost.record.output.schema.json +13 -0
  21. package/agentic/orchestrator/tools/schemas/output/feature.ready_to_merge.output.schema.json +7 -0
  22. package/agentic/orchestrator/tools/schemas/output/feature.send_message.output.schema.json +23 -0
  23. package/agentic/orchestrator/tools/schemas/output/performance.get_analytics.output.schema.json +46 -0
  24. package/agentic/orchestrator/tools/schemas/output/performance.record_outcome.output.schema.json +10 -0
  25. package/agentic/orchestrator/tools.md +5 -0
  26. package/apps/control-plane/scripts/validate-architecture-rules.mjs +28 -2
  27. package/apps/control-plane/scripts/validate-docker-mcp-contract.mjs +12 -0
  28. package/apps/control-plane/scripts/validate-mcp-contracts.ts +92 -0
  29. package/apps/control-plane/src/application/adapters/adapter-registry.ts +169 -0
  30. package/apps/control-plane/src/application/multi-project-loader.ts +119 -0
  31. package/apps/control-plane/src/application/services/activity-monitor-service.ts +199 -0
  32. package/apps/control-plane/src/application/services/cost-tracking-service.ts +82 -0
  33. package/apps/control-plane/src/application/services/dependency-scheduler-service.ts +86 -0
  34. package/apps/control-plane/src/application/services/feature-deletion-service.ts +8 -7
  35. package/apps/control-plane/src/application/services/gate-interpolation-service.ts +15 -0
  36. package/apps/control-plane/src/application/services/gate-service.ts +38 -2
  37. package/apps/control-plane/src/application/services/instance-isolation-service.ts +18 -0
  38. package/apps/control-plane/src/application/services/issue-tracker-service.ts +469 -0
  39. package/apps/control-plane/src/application/services/merge-service.ts +67 -3
  40. package/apps/control-plane/src/application/services/notifier-service.ts +295 -0
  41. package/apps/control-plane/src/application/services/performance-analytics-service.ts +122 -0
  42. package/apps/control-plane/src/application/services/plan-service.ts +51 -0
  43. package/apps/control-plane/src/application/services/pr-monitor-service.ts +262 -0
  44. package/apps/control-plane/src/application/services/reactions-service.ts +175 -0
  45. package/apps/control-plane/src/application/services/reporting-service.ts +17 -2
  46. package/apps/control-plane/src/application/services/run-lease-service.ts +16 -38
  47. package/apps/control-plane/src/application/tools/tool-metadata.ts +4 -1
  48. package/apps/control-plane/src/cli/aop.ts +1 -1
  49. package/apps/control-plane/src/cli/attach-command-handler.ts +120 -0
  50. package/apps/control-plane/src/cli/cleanup-command-handler.ts +190 -0
  51. package/apps/control-plane/src/cli/cli-argument-parser.ts +69 -3
  52. package/apps/control-plane/src/cli/dashboard-command-handler.ts +57 -0
  53. package/apps/control-plane/src/cli/help-command-handler.ts +163 -0
  54. package/apps/control-plane/src/cli/init-command-handler.ts +609 -0
  55. package/apps/control-plane/src/cli/resume-command-handler.ts +1 -0
  56. package/apps/control-plane/src/cli/retry-command-handler.ts +138 -0
  57. package/apps/control-plane/src/cli/run-command-handler.ts +115 -3
  58. package/apps/control-plane/src/cli/send-command-handler.ts +65 -0
  59. package/apps/control-plane/src/cli/status-command-handler.ts +102 -2
  60. package/apps/control-plane/src/cli/types.ts +26 -1
  61. package/apps/control-plane/src/core/constants.ts +8 -2
  62. package/apps/control-plane/src/core/error-codes.ts +3 -1
  63. package/apps/control-plane/src/core/gates.ts +170 -50
  64. package/apps/control-plane/src/core/kernel.ts +280 -5
  65. package/apps/control-plane/src/core/path-layout.ts +12 -0
  66. package/apps/control-plane/src/core/tool-caller.ts +36 -0
  67. package/apps/control-plane/src/core/workspace-hooks.ts +87 -0
  68. package/apps/control-plane/src/interfaces/cli/bootstrap.ts +258 -9
  69. package/apps/control-plane/src/providers/providers.ts +235 -14
  70. package/apps/control-plane/src/supervisor/build-wave-executor.ts +129 -8
  71. package/apps/control-plane/src/supervisor/qa-wave-executor.ts +123 -5
  72. package/apps/control-plane/src/supervisor/run-coordinator.ts +143 -6
  73. package/apps/control-plane/src/supervisor/runtime.ts +135 -6
  74. package/apps/control-plane/src/supervisor/types.ts +12 -21
  75. package/apps/control-plane/src/supervisor/worker-decision-loop.ts +8 -0
  76. package/apps/control-plane/test/activity-monitor.spec.ts +294 -0
  77. package/apps/control-plane/test/adapter-registry.spec.ts +132 -0
  78. package/apps/control-plane/test/batch-operations.spec.ts +112 -0
  79. package/apps/control-plane/test/bootstrap-attach.spec.ts +102 -0
  80. package/apps/control-plane/test/bootstrap-edge-cases.spec.ts +252 -0
  81. package/apps/control-plane/test/bootstrap.spec.ts +560 -0
  82. package/apps/control-plane/test/cleanup-command.spec.ts +301 -0
  83. package/apps/control-plane/test/cli-helpers.spec.ts +404 -1
  84. package/apps/control-plane/test/cli.unit.spec.ts +182 -1
  85. package/apps/control-plane/test/collision-queue.spec.ts +104 -1
  86. package/apps/control-plane/test/core-utils.spec.ts +175 -2
  87. package/apps/control-plane/test/cost-tracking.spec.ts +143 -0
  88. package/apps/control-plane/test/dashboard-api.integration.spec.ts +247 -0
  89. package/apps/control-plane/test/dashboard-client.spec.ts +116 -0
  90. package/apps/control-plane/test/dashboard-command.spec.ts +103 -0
  91. package/apps/control-plane/test/dependency-scheduler.spec.ts +189 -0
  92. package/apps/control-plane/test/epoch-tracking.spec.ts +4 -4
  93. package/apps/control-plane/test/feature-deletion-service.spec.ts +422 -0
  94. package/apps/control-plane/test/feature-lifecycle.spec.ts +202 -0
  95. package/apps/control-plane/test/git-spawn-error.spec.ts +24 -0
  96. package/apps/control-plane/test/incremental-gates.spec.ts +137 -0
  97. package/apps/control-plane/test/init-wizard.spec.ts +506 -0
  98. package/apps/control-plane/test/instance-isolation.spec.ts +83 -0
  99. package/apps/control-plane/test/issue-tracker.spec.ts +890 -0
  100. package/apps/control-plane/test/kernel.coverage.spec.ts +3 -5
  101. package/apps/control-plane/test/kernel.coverage2.spec.ts +871 -0
  102. package/apps/control-plane/test/kernel.spec.ts +13 -11
  103. package/apps/control-plane/test/lock-service.spec.ts +508 -0
  104. package/apps/control-plane/test/mcp-helpers.spec.ts +176 -0
  105. package/apps/control-plane/test/mcp.spec.ts +50 -15
  106. package/apps/control-plane/test/merge-service.spec.ts +67 -4
  107. package/apps/control-plane/test/multi-project.spec.ts +372 -0
  108. package/apps/control-plane/test/notifier-service.spec.ts +388 -0
  109. package/apps/control-plane/test/parallel-gates.spec.ts +312 -0
  110. package/apps/control-plane/test/patch-service.spec.ts +253 -0
  111. package/apps/control-plane/test/performance-analytics.spec.ts +338 -0
  112. package/apps/control-plane/test/planning-wave-executor.spec.ts +168 -0
  113. package/apps/control-plane/test/pr-monitor.spec.ts +385 -0
  114. package/apps/control-plane/test/providers.spec.ts +344 -1
  115. package/apps/control-plane/test/reactions.spec.ts +392 -0
  116. package/apps/control-plane/test/resume-command.spec.ts +390 -0
  117. package/apps/control-plane/test/run-coordinator.spec.ts +481 -2
  118. package/apps/control-plane/test/schema-date-time.spec.ts +46 -0
  119. package/apps/control-plane/test/service-retry-paths.spec.ts +30 -0
  120. package/apps/control-plane/test/services.spec.ts +95 -2
  121. package/apps/control-plane/test/session-management.spec.ts +450 -0
  122. package/apps/control-plane/test/spec-ingestion.spec.ts +190 -0
  123. package/apps/control-plane/test/supervisor-collaborators.spec.ts +699 -2
  124. package/apps/control-plane/test/supervisor.spec.ts +36 -30
  125. package/apps/control-plane/test/supervisor.unit.spec.ts +405 -0
  126. package/apps/control-plane/test/worker-decision-loop.spec.ts +57 -0
  127. package/apps/control-plane/test/workspace-hooks.spec.ts +177 -0
  128. package/apps/control-plane/vitest.config.ts +21 -5
  129. package/dist/apps/control-plane/application/adapters/adapter-registry.d.ts +44 -0
  130. package/dist/apps/control-plane/application/adapters/adapter-registry.js +76 -0
  131. package/dist/apps/control-plane/application/adapters/adapter-registry.js.map +1 -0
  132. package/dist/apps/control-plane/application/multi-project-loader.d.ts +31 -0
  133. package/dist/apps/control-plane/application/multi-project-loader.js +82 -0
  134. package/dist/apps/control-plane/application/multi-project-loader.js.map +1 -0
  135. package/dist/apps/control-plane/application/services/activity-monitor-service.d.ts +43 -0
  136. package/dist/apps/control-plane/application/services/activity-monitor-service.js +132 -0
  137. package/dist/apps/control-plane/application/services/activity-monitor-service.js.map +1 -0
  138. package/dist/apps/control-plane/application/services/cost-tracking-service.d.ts +28 -0
  139. package/dist/apps/control-plane/application/services/cost-tracking-service.js +48 -0
  140. package/dist/apps/control-plane/application/services/cost-tracking-service.js.map +1 -0
  141. package/dist/apps/control-plane/application/services/dependency-scheduler-service.d.ts +26 -0
  142. package/dist/apps/control-plane/application/services/dependency-scheduler-service.js +75 -0
  143. package/dist/apps/control-plane/application/services/dependency-scheduler-service.js.map +1 -0
  144. package/dist/apps/control-plane/application/services/feature-deletion-service.d.ts +2 -0
  145. package/dist/apps/control-plane/application/services/feature-deletion-service.js +6 -7
  146. package/dist/apps/control-plane/application/services/feature-deletion-service.js.map +1 -1
  147. package/dist/apps/control-plane/application/services/gate-interpolation-service.d.ts +7 -0
  148. package/dist/apps/control-plane/application/services/gate-interpolation-service.js +7 -0
  149. package/dist/apps/control-plane/application/services/gate-interpolation-service.js.map +1 -0
  150. package/dist/apps/control-plane/application/services/gate-service.js +32 -2
  151. package/dist/apps/control-plane/application/services/gate-service.js.map +1 -1
  152. package/dist/apps/control-plane/application/services/instance-isolation-service.d.ts +11 -0
  153. package/dist/apps/control-plane/application/services/instance-isolation-service.js +17 -0
  154. package/dist/apps/control-plane/application/services/instance-isolation-service.js.map +1 -0
  155. package/dist/apps/control-plane/application/services/issue-tracker-service.d.ts +65 -0
  156. package/dist/apps/control-plane/application/services/issue-tracker-service.js +358 -0
  157. package/dist/apps/control-plane/application/services/issue-tracker-service.js.map +1 -0
  158. package/dist/apps/control-plane/application/services/merge-service.d.ts +4 -0
  159. package/dist/apps/control-plane/application/services/merge-service.js +44 -2
  160. package/dist/apps/control-plane/application/services/merge-service.js.map +1 -1
  161. package/dist/apps/control-plane/application/services/notifier-service.d.ts +74 -0
  162. package/dist/apps/control-plane/application/services/notifier-service.js +212 -0
  163. package/dist/apps/control-plane/application/services/notifier-service.js.map +1 -0
  164. package/dist/apps/control-plane/application/services/performance-analytics-service.d.ts +39 -0
  165. package/dist/apps/control-plane/application/services/performance-analytics-service.js +75 -0
  166. package/dist/apps/control-plane/application/services/performance-analytics-service.js.map +1 -0
  167. package/dist/apps/control-plane/application/services/plan-service.d.ts +1 -0
  168. package/dist/apps/control-plane/application/services/plan-service.js +53 -0
  169. package/dist/apps/control-plane/application/services/plan-service.js.map +1 -1
  170. package/dist/apps/control-plane/application/services/pr-monitor-service.d.ts +44 -0
  171. package/dist/apps/control-plane/application/services/pr-monitor-service.js +192 -0
  172. package/dist/apps/control-plane/application/services/pr-monitor-service.js.map +1 -0
  173. package/dist/apps/control-plane/application/services/reactions-service.d.ts +67 -0
  174. package/dist/apps/control-plane/application/services/reactions-service.js +114 -0
  175. package/dist/apps/control-plane/application/services/reactions-service.js.map +1 -0
  176. package/dist/apps/control-plane/application/services/reporting-service.d.ts +1 -0
  177. package/dist/apps/control-plane/application/services/reporting-service.js +13 -2
  178. package/dist/apps/control-plane/application/services/reporting-service.js.map +1 -1
  179. package/dist/apps/control-plane/application/services/run-lease-service.d.ts +2 -0
  180. package/dist/apps/control-plane/application/services/run-lease-service.js +14 -38
  181. package/dist/apps/control-plane/application/services/run-lease-service.js.map +1 -1
  182. package/dist/apps/control-plane/application/tools/tool-metadata.js +3 -1
  183. package/dist/apps/control-plane/application/tools/tool-metadata.js.map +1 -1
  184. package/dist/apps/control-plane/cli/aop.d.ts +1 -1
  185. package/dist/apps/control-plane/cli/aop.js +1 -1
  186. package/dist/apps/control-plane/cli/attach-command-handler.d.ts +12 -0
  187. package/dist/apps/control-plane/cli/attach-command-handler.js +98 -0
  188. package/dist/apps/control-plane/cli/attach-command-handler.js.map +1 -0
  189. package/dist/apps/control-plane/cli/cleanup-command-handler.d.ts +12 -0
  190. package/dist/apps/control-plane/cli/cleanup-command-handler.js +162 -0
  191. package/dist/apps/control-plane/cli/cleanup-command-handler.js.map +1 -0
  192. package/dist/apps/control-plane/cli/cli-argument-parser.js +73 -3
  193. package/dist/apps/control-plane/cli/cli-argument-parser.js.map +1 -1
  194. package/dist/apps/control-plane/cli/dashboard-command-handler.d.ts +7 -0
  195. package/dist/apps/control-plane/cli/dashboard-command-handler.js +45 -0
  196. package/dist/apps/control-plane/cli/dashboard-command-handler.js.map +1 -0
  197. package/dist/apps/control-plane/cli/help-command-handler.d.ts +8 -0
  198. package/dist/apps/control-plane/cli/help-command-handler.js +146 -0
  199. package/dist/apps/control-plane/cli/help-command-handler.js.map +1 -0
  200. package/dist/apps/control-plane/cli/init-command-handler.d.ts +26 -0
  201. package/dist/apps/control-plane/cli/init-command-handler.js +517 -0
  202. package/dist/apps/control-plane/cli/init-command-handler.js.map +1 -0
  203. package/dist/apps/control-plane/cli/resume-command-handler.js +1 -1
  204. package/dist/apps/control-plane/cli/resume-command-handler.js.map +1 -1
  205. package/dist/apps/control-plane/cli/retry-command-handler.d.ts +8 -0
  206. package/dist/apps/control-plane/cli/retry-command-handler.js +111 -0
  207. package/dist/apps/control-plane/cli/retry-command-handler.js.map +1 -0
  208. package/dist/apps/control-plane/cli/run-command-handler.d.ts +5 -0
  209. package/dist/apps/control-plane/cli/run-command-handler.js +82 -3
  210. package/dist/apps/control-plane/cli/run-command-handler.js.map +1 -1
  211. package/dist/apps/control-plane/cli/send-command-handler.d.ts +8 -0
  212. package/dist/apps/control-plane/cli/send-command-handler.js +55 -0
  213. package/dist/apps/control-plane/cli/send-command-handler.js.map +1 -0
  214. package/dist/apps/control-plane/cli/status-command-handler.d.ts +12 -1
  215. package/dist/apps/control-plane/cli/status-command-handler.js +55 -2
  216. package/dist/apps/control-plane/cli/status-command-handler.js.map +1 -1
  217. package/dist/apps/control-plane/cli/types.d.ts +26 -1
  218. package/dist/apps/control-plane/cli/types.js +15 -1
  219. package/dist/apps/control-plane/cli/types.js.map +1 -1
  220. package/dist/apps/control-plane/core/constants.d.ts +6 -0
  221. package/dist/apps/control-plane/core/constants.js +8 -2
  222. package/dist/apps/control-plane/core/constants.js.map +1 -1
  223. package/dist/apps/control-plane/core/error-codes.d.ts +2 -0
  224. package/dist/apps/control-plane/core/error-codes.js +3 -1
  225. package/dist/apps/control-plane/core/error-codes.js.map +1 -1
  226. package/dist/apps/control-plane/core/gates.d.ts +4 -0
  227. package/dist/apps/control-plane/core/gates.js +140 -43
  228. package/dist/apps/control-plane/core/gates.js.map +1 -1
  229. package/dist/apps/control-plane/core/kernel.d.ts +50 -1
  230. package/dist/apps/control-plane/core/kernel.js +220 -7
  231. package/dist/apps/control-plane/core/kernel.js.map +1 -1
  232. package/dist/apps/control-plane/core/path-layout.d.ts +3 -0
  233. package/dist/apps/control-plane/core/path-layout.js +9 -0
  234. package/dist/apps/control-plane/core/path-layout.js.map +1 -1
  235. package/dist/apps/control-plane/core/tool-caller.d.ts +32 -0
  236. package/dist/apps/control-plane/core/tool-caller.js +2 -0
  237. package/dist/apps/control-plane/core/tool-caller.js.map +1 -0
  238. package/dist/apps/control-plane/core/workspace-hooks.d.ts +20 -0
  239. package/dist/apps/control-plane/core/workspace-hooks.js +69 -0
  240. package/dist/apps/control-plane/core/workspace-hooks.js.map +1 -0
  241. package/dist/apps/control-plane/interfaces/cli/bootstrap.js +245 -9
  242. package/dist/apps/control-plane/interfaces/cli/bootstrap.js.map +1 -1
  243. package/dist/apps/control-plane/providers/providers.d.ts +42 -3
  244. package/dist/apps/control-plane/providers/providers.js +216 -5
  245. package/dist/apps/control-plane/providers/providers.js.map +1 -1
  246. package/dist/apps/control-plane/supervisor/build-wave-executor.d.ts +3 -0
  247. package/dist/apps/control-plane/supervisor/build-wave-executor.js +115 -6
  248. package/dist/apps/control-plane/supervisor/build-wave-executor.js.map +1 -1
  249. package/dist/apps/control-plane/supervisor/qa-wave-executor.d.ts +3 -0
  250. package/dist/apps/control-plane/supervisor/qa-wave-executor.js +109 -5
  251. package/dist/apps/control-plane/supervisor/qa-wave-executor.js.map +1 -1
  252. package/dist/apps/control-plane/supervisor/run-coordinator.d.ts +15 -0
  253. package/dist/apps/control-plane/supervisor/run-coordinator.js +132 -6
  254. package/dist/apps/control-plane/supervisor/run-coordinator.js.map +1 -1
  255. package/dist/apps/control-plane/supervisor/runtime.d.ts +3 -0
  256. package/dist/apps/control-plane/supervisor/runtime.js +110 -6
  257. package/dist/apps/control-plane/supervisor/runtime.js.map +1 -1
  258. package/dist/apps/control-plane/supervisor/types.d.ts +9 -16
  259. package/dist/apps/control-plane/supervisor/types.js.map +1 -1
  260. package/dist/apps/control-plane/supervisor/worker-decision-loop.d.ts +3 -0
  261. package/dist/apps/control-plane/supervisor/worker-decision-loop.js +5 -0
  262. package/dist/apps/control-plane/supervisor/worker-decision-loop.js.map +1 -1
  263. package/eslint.config.mjs +2 -1
  264. package/package.json +12 -2
  265. package/packages/web-dashboard/next-env.d.ts +5 -0
  266. package/packages/web-dashboard/next.config.js +7 -0
  267. package/packages/web-dashboard/package.json +26 -0
  268. package/packages/web-dashboard/src/app/api/actions/route.ts +64 -0
  269. package/packages/web-dashboard/src/app/api/events/route.ts +51 -0
  270. package/packages/web-dashboard/src/app/api/features/[id]/checkout/route.ts +256 -0
  271. package/packages/web-dashboard/src/app/api/features/[id]/diff/route.ts +10 -0
  272. package/packages/web-dashboard/src/app/api/features/[id]/evidence/[artifact]/route.ts +25 -0
  273. package/packages/web-dashboard/src/app/api/features/[id]/review/route.ts +63 -0
  274. package/packages/web-dashboard/src/app/api/features/[id]/route.ts +16 -0
  275. package/packages/web-dashboard/src/app/api/projects/route.ts +31 -0
  276. package/packages/web-dashboard/src/app/api/status/route.ts +15 -0
  277. package/packages/web-dashboard/src/app/globals.css +2 -0
  278. package/packages/web-dashboard/src/app/layout.tsx +15 -0
  279. package/packages/web-dashboard/src/app/page.tsx +393 -0
  280. package/packages/web-dashboard/src/lib/aop-client.ts +244 -0
  281. package/packages/web-dashboard/src/lib/multi-project-config.ts +116 -0
  282. package/packages/web-dashboard/src/lib/orchestrator-tools.ts +284 -0
  283. package/packages/web-dashboard/src/lib/types.ts +58 -0
  284. package/packages/web-dashboard/tsconfig.json +40 -0
  285. package/packages/web-dashboard/vitest.config.ts +6 -0
  286. package/spec-files/completed/agentic_orchestrator_feature_gaps_closure_spec.md +1764 -0
  287. package/spec-files/outstanding/agentic_orchestrator_enterprise_governance_dashboard_spec.md +348 -0
  288. package/spec-files/outstanding/agentic_orchestrator_knowledge_canary_spec.md +344 -0
  289. package/spec-files/outstanding/agentic_orchestrator_observability_integrity_diagnostics_spec.md +374 -0
  290. package/spec-files/outstanding/agentic_orchestrator_performance_improvements_spec.md +1059 -0
  291. package/spec-files/outstanding/agentic_orchestrator_planning_review_quality_spec.md +466 -0
  292. package/spec-files/outstanding/agentic_orchestrator_quality_adoption_execution_spec.md +198 -0
  293. package/spec-files/outstanding/agentic_orchestrator_validator_hardening_spec.md +365 -0
  294. package/spec-files/progress.md +481 -52
  295. /package/spec-files/{agentic_orchestrator_cli_delete_command_spec.md → completed/agentic_orchestrator_cli_delete_command_spec.md} +0 -0
  296. /package/spec-files/{agentic_orchestrator_dot_aop_generated_artifacts_spec.md → completed/agentic_orchestrator_dot_aop_generated_artifacts_spec.md} +0 -0
  297. /package/spec-files/{agentic_orchestrator_mcp_formalization_spec.md → completed/agentic_orchestrator_mcp_formalization_spec.md} +0 -0
  298. /package/spec-files/{agentic_orchestrator_oop_refactor_spec.md → completed/agentic_orchestrator_oop_refactor_spec.md} +0 -0
  299. /package/spec-files/{agentic_orchestrator_single_global_orchestrator_spec.md → completed/agentic_orchestrator_single_global_orchestrator_spec.md} +0 -0
  300. /package/spec-files/{agentic_orchestrator_spec.md → completed/agentic_orchestrator_spec.md} +0 -0
@@ -0,0 +1,365 @@
1
+ # Feature Spec: Validation Script Hardening (AOP)
2
+
3
+ > **Purpose of this document**: Define implementation-ready improvements to the three existing CI validators (`validate:mcp-contracts`, `validate:docker-mcp`, `validate:architecture`) based on gaps identified through static analysis. Each improvement closes a concrete drift or correctness risk.
4
+
5
+ **Version:** 1.0
6
+ **Date:** 2026-03-03
7
+ **Status:** Draft
8
+ **Roadmap Mapping:** Infrastructure / Quality
9
+
10
+ ---
11
+
12
+ ## 0. Standards and Dependencies
13
+
14
+ ### 0.1 Required Standards
15
+
16
+ All implementation MUST preserve:
17
+ - All three validators continue to pass on a clean codebase with zero output on success
18
+ - CI command signatures are unchanged: `npm run validate:mcp-contracts`, `npm run validate:docker-mcp`, `npm run validate:architecture`
19
+ - Exit code 1 on any new failure; exit code 0 only when all checks pass
20
+ - Nx + Vitest coverage thresholds maintained (≥ 90% per file)
21
+
22
+ ### 0.2 Upstream Inputs
23
+
24
+ Implementing agents MUST read:
25
+ - `agentic/orchestrator/tools/catalog.json` — source of truth for tool metadata
26
+ - `apps/control-plane/src/application/tools/tool-metadata.ts` — `MUTATING_TOOLS` runtime list
27
+ - `apps/control-plane/src/core/constants.ts` — `TOOLS` constants
28
+ - `apps/control-plane/scripts/validate-mcp-contracts.ts` — current MCP validator
29
+ - `apps/control-plane/scripts/validate-architecture-rules.mjs` — current architecture validator
30
+ - `apps/control-plane/scripts/validate-docker-mcp-contract.mjs` — current Docker validator
31
+ - `apps/control-plane/vitest.config.ts` — coverage exclusions
32
+
33
+ ### 0.3 Feature Scope
34
+
35
+ This spec implements improvements in three areas:
36
+ - **V1** MCP contract cross-validation hardening
37
+ - **V2** Docker MCP contract completeness
38
+ - **V3** Architecture rule completeness and correctness
39
+
40
+ ---
41
+
42
+ ## 1. Objectives
43
+
44
+ ### 1.1 Must-Have Outcomes
45
+
46
+ - The `mutating` flag in `catalog.json` must be verifiably consistent with `TOOL_BEHAVIOR_METADATA` in code — any skew detected at CI time, not at runtime.
47
+ - All tool input/output schema files referenced in the catalog must be syntactically valid JSON Schema (parseable and compilable by AJV).
48
+ - Schema files present on disk but unreferenced by any catalog entry are reported as orphans.
49
+ - The `supported_roles` field on every catalog tool is validated against the known role set.
50
+ - `application/adapters/` files and `application/multi-project-loader.ts` are subject to defined architecture rules rather than silently skipped.
51
+ - `core` is prohibited from importing `application-services`, `application-tools`, `mcp`, or `providers` layer files.
52
+ - The Docker Dockerfile Node version pin is validated against a minimum major version.
53
+ - The entrypoint passthrough (`exec "$@"`) is verified to be present.
54
+
55
+ ### 1.2 Non-Goals
56
+
57
+ - No rewrite of validators from scratch — changes are additive to existing checks.
58
+ - No new npm packages beyond `ajv` (already a project dependency).
59
+ - No runtime enforcement changes in kernel or tool runtime (only CI validators change).
60
+ - No coverage gating on the validator scripts themselves (they are scripts, not source).
61
+
62
+ ---
63
+
64
+ ## 2. Architecture Decisions
65
+
66
+ ### 2.1 Validators Remain Scripts
67
+
68
+ All three validators are plain `.ts` / `.mjs` scripts run via `tsx` or `node`. They do not import from `src/` source — they read files from disk. This remains the pattern.
69
+
70
+ ### 2.2 Catalog Remains the Source of Truth
71
+
72
+ `catalog.json` is authoritative. The code-side `MUTATING_TOOLS` in `tool-metadata.ts` must match it. When there is a discrepancy, the validator fails and prints the tool name. The developer must reconcile `tool-metadata.ts` to match the catalog.
73
+
74
+ ### 2.3 Architecture Layer Map is Canonical
75
+
76
+ The layer classification in `validate-architecture-rules.mjs` is the contract. Adding a new source directory without also adding it to the layer map must fail loudly, not silently skip.
77
+
78
+ ---
79
+
80
+ ## 3. Implementation: V1 — MCP Contract Hardening
81
+
82
+ ### 3.1 Cross-Check `mutating` vs `TOOL_BEHAVIOR_METADATA`
83
+
84
+ **File:** `apps/control-plane/scripts/validate-mcp-contracts.ts`
85
+
86
+ **Check:** For every tool entry in `catalog.json` with `mutating: true`, verify that the tool's `handler_id` appears as a key in `TOOL_BEHAVIOR_METADATA` (exported from `tool-metadata.ts`) with `mutating: true`.
87
+
88
+ **Implementation approach:**
89
+
90
+ The validator is a TypeScript file run via `tsx`. It can import `TOOL_BEHAVIOR_METADATA` directly from the source using a relative path:
91
+
92
+ ```typescript
93
+ import { TOOL_BEHAVIOR_METADATA } from '../src/application/tools/tool-metadata.js';
94
+ ```
95
+
96
+ Then for each tool in the catalog:
97
+
98
+ ```typescript
99
+ const mutatingInCatalog = tool.mutating === true;
100
+ const mutatingInCode = TOOL_BEHAVIOR_METADATA[tool.handler_id]?.mutating === true;
101
+ if (mutatingInCatalog !== mutatingInCode) {
102
+ errors.push(
103
+ `Tool "${tool.handler_id}" mutating flag mismatch: catalog=${mutatingInCatalog}, code=${mutatingInCode}`
104
+ );
105
+ }
106
+ ```
107
+
108
+ **Failure message example:**
109
+ ```
110
+ ✗ Tool "cost.record" mutating flag mismatch: catalog=true, code=false
111
+ Fix: add TOOLS.COST_RECORD to MUTATING_TOOLS in tool-metadata.ts
112
+ ```
113
+
114
+ **Current known failure to fix first:** `cost.record` — `TOOLS.COST_RECORD` must be added to `MUTATING_TOOLS` in `tool-metadata.ts` before the check is added, otherwise CI will immediately fail. Fix the code, then add the check.
115
+
116
+ ### 3.2 Validate Input/Output Schemas Are Valid JSON Schema
117
+
118
+ **File:** `apps/control-plane/scripts/validate-mcp-contracts.ts`
119
+
120
+ **Check:** For each `input_schema_ref` and `output_schema_ref` in the catalog, load the JSON file and compile it with AJV. A schema that fails to compile (bad `$schema`, invalid keyword, etc.) must be reported.
121
+
122
+ **Implementation approach:**
123
+
124
+ ```typescript
125
+ import Ajv from 'ajv';
126
+ const ajv = new Ajv({ strict: false });
127
+
128
+ for (const tool of catalog.tools) {
129
+ for (const schemaRef of [tool.input_schema_ref, tool.output_schema_ref]) {
130
+ const schemaPath = path.resolve(toolsDir, schemaRef);
131
+ const schema = JSON.parse(fs.readFileSync(schemaPath, 'utf8'));
132
+ try {
133
+ ajv.compile(schema);
134
+ } catch (e) {
135
+ errors.push(`Schema "${schemaRef}" failed AJV compilation: ${e.message}`);
136
+ }
137
+ }
138
+ }
139
+ ```
140
+
141
+ `ajv` is already a dependency (`"ajv": "^8.x"` appears in package.json via existing usage in the kernel). No new dependency needed.
142
+
143
+ ### 3.3 Detect Orphan Schema Files
144
+
145
+ **File:** `apps/control-plane/scripts/validate-mcp-contracts.ts`
146
+
147
+ **Check:** Collect all `.json` files under `agentic/orchestrator/tools/schemas/input/` and `schemas/output/`. Compare against the set of schema refs mentioned in the catalog. Files on disk that are not referenced by any tool are reported as orphans.
148
+
149
+ **Known current orphans (informational, not blocking — these may be shared base schemas):**
150
+ - `schemas/input/mutating.schema.json`
151
+ - `schemas/input/read.schema.json`
152
+ - `schemas/output/standard_success.schema.json`
153
+
154
+ These three files should be either:
155
+ 1. Added as `$ref` base schemas used by at least one tool, or
156
+ 2. Explicitly listed in a `known_shared_schemas` array in the validator (not subject to orphan check).
157
+
158
+ **Implementation approach:**
159
+
160
+ ```typescript
161
+ const referencedSchemas = new Set<string>();
162
+ for (const tool of catalog.tools) {
163
+ referencedSchemas.add(tool.input_schema_ref);
164
+ referencedSchemas.add(tool.output_schema_ref);
165
+ }
166
+
167
+ const allSchemaFiles = [
168
+ ...glob.sync('schemas/input/*.json', { cwd: toolsDir }),
169
+ ...glob.sync('schemas/output/*.json', { cwd: toolsDir }),
170
+ ];
171
+
172
+ const knownShared = new Set(['schemas/input/mutating.schema.json', 'schemas/input/read.schema.json', 'schemas/output/standard_success.schema.json']);
173
+
174
+ for (const file of allSchemaFiles) {
175
+ if (!referencedSchemas.has(file) && !knownShared.has(file)) {
176
+ warnings.push(`Orphan schema file not referenced by any catalog tool: ${file}`);
177
+ }
178
+ }
179
+ ```
180
+
181
+ Orphans emit **warnings** (printed but do not fail CI) unless the file is outside the `knownShared` exemption list.
182
+
183
+ ### 3.4 Validate `supported_roles` Against Known Role Set
184
+
185
+ **File:** `apps/control-plane/scripts/validate-mcp-contracts.ts`
186
+
187
+ **Check:** Every value in every tool's `supported_roles` array must be one of: `orchestrator`, `planner`, `builder`, `qa`, `system`.
188
+
189
+ ```typescript
190
+ const KNOWN_ROLES = new Set(['orchestrator', 'planner', 'builder', 'qa', 'system']);
191
+
192
+ for (const tool of catalog.tools) {
193
+ for (const role of tool.supported_roles) {
194
+ if (!KNOWN_ROLES.has(role)) {
195
+ errors.push(`Tool "${tool.name}" has unknown role "${role}" in supported_roles`);
196
+ }
197
+ }
198
+ }
199
+ ```
200
+
201
+ ---
202
+
203
+ ## 4. Implementation: V2 — Docker MCP Contract Completeness
204
+
205
+ ### 4.1 Validate Node Major Version Pin
206
+
207
+ **File:** `apps/control-plane/scripts/validate-docker-mcp-contract.mjs`
208
+
209
+ **Check:** The `FROM` line in the Dockerfile must pin to a specific Node major version (`node:22` or higher). `node:latest`, `node:lts`, or any unversioned form must fail.
210
+
211
+ ```javascript
212
+ const MIN_NODE_MAJOR = 22;
213
+
214
+ const fromMatch = dockerfile.match(/^FROM\s+node:(\d+)/m);
215
+ assert(fromMatch, 'Dockerfile must use a pinned Node version (e.g. node:22-bookworm-slim)');
216
+ const nodeMajor = parseInt(fromMatch[1], 10);
217
+ assert(
218
+ nodeMajor >= MIN_NODE_MAJOR,
219
+ `Dockerfile Node version ${nodeMajor} is below minimum required ${MIN_NODE_MAJOR}`
220
+ );
221
+ ```
222
+
223
+ ### 4.2 Verify Entrypoint `exec "$@"` Passthrough
224
+
225
+ **File:** `apps/control-plane/scripts/validate-docker-mcp-contract.mjs`
226
+
227
+ **Check:** The entrypoint shell script (referenced in `ENTRYPOINT` of the Dockerfile) must contain `exec "$@"` as the final command, ensuring the container actually runs the requested process after startup checks.
228
+
229
+ ```javascript
230
+ const entrypointPath = path.resolve(repoRoot, 'docker', 'entrypoint.sh');
231
+ const entrypoint = fs.readFileSync(entrypointPath, 'utf8');
232
+ assert(
233
+ /\bexec\s+"\$@"/.test(entrypoint),
234
+ 'Entrypoint script must contain exec "$@" passthrough'
235
+ );
236
+ ```
237
+
238
+ ---
239
+
240
+ ## 5. Implementation: V3 — Architecture Rule Completeness
241
+
242
+ ### 5.1 Classify `application/adapters/` and `application/multi-project-loader.ts`
243
+
244
+ **File:** `apps/control-plane/scripts/validate-architecture-rules.mjs`
245
+
246
+ **Problem:** Files in `application/` that are not under `application/services/` or `application/tools/` are currently classified as `'unknown'` and skipped. These files can import from any layer without detection.
247
+
248
+ **Fix:** Add an `'application'` layer classification and rules. Files that match `application/` but not the more specific `application/services/` or `application/tools/` paths resolve to `'application'`.
249
+
250
+ **Layer classification update:**
251
+
252
+ ```javascript
253
+ function classifyFile(relativePath) {
254
+ if (relativePath.startsWith('application/services/')) return 'application-services';
255
+ if (relativePath.startsWith('application/tools/')) return 'application-tools';
256
+ if (relativePath.startsWith('application/')) return 'application'; // NEW
257
+ if (relativePath.startsWith('cli/')) return 'cli';
258
+ if (relativePath.startsWith('core/')) return 'core';
259
+ if (relativePath.startsWith('interfaces/')) return 'interfaces';
260
+ if (relativePath.startsWith('mcp/')) return 'mcp';
261
+ if (relativePath.startsWith('providers/')) return 'providers';
262
+ if (relativePath.startsWith('supervisor/')) return 'supervisor';
263
+ return 'unknown';
264
+ }
265
+ ```
266
+
267
+ **Architecture rules addition:**
268
+
269
+ ```javascript
270
+ const ARCHITECTURE_RULES = {
271
+ // existing rules ...
272
+ 'application': ['cli', 'interfaces', 'supervisor'], // NEW: same restrictions as application-services
273
+ };
274
+ ```
275
+
276
+ **Unknown layer handling:** Files that remain `'unknown'` after classification must fail the validator with a message, rather than being silently skipped. This ensures new directories added to `src/` cannot evade architecture rules:
277
+
278
+ ```javascript
279
+ if (layer === 'unknown') {
280
+ errors.push(`Unclassified source file "${relativePath}" — add it to the layer map in validate-architecture-rules.mjs`);
281
+ continue;
282
+ }
283
+ ```
284
+
285
+ The top-level `index.ts` (public barrel export) should be explicitly exempt:
286
+
287
+ ```javascript
288
+ const EXEMPT_FILES = new Set(['index.ts']);
289
+ ```
290
+
291
+ ### 5.2 Prohibit `core` from Importing Upward Layers
292
+
293
+ **File:** `apps/control-plane/scripts/validate-architecture-rules.mjs`
294
+
295
+ **Problem:** The current `core` rule forbids `['cli', 'interfaces', 'supervisor']` but does not forbid `application-services`, `application-tools`, `mcp`, or `providers`. `core` should be a pure domain layer — no upward dependencies.
296
+
297
+ **Fix:** Expand the `core` forbidden list:
298
+
299
+ ```javascript
300
+ 'core': ['cli', 'interfaces', 'supervisor', 'application-services', 'application-tools', 'application', 'mcp', 'providers'],
301
+ ```
302
+
303
+ Before adding this rule, verify that no existing `core/` file currently imports from those layers. If any do, they must be refactored to eliminate the import first.
304
+
305
+ **Verification command:**
306
+ ```bash
307
+ grep -r "from.*application\|from.*mcp\|from.*providers" apps/control-plane/src/core/ --include="*.ts"
308
+ ```
309
+
310
+ ---
311
+
312
+ ## 6. Acceptance Criteria
313
+
314
+ ### V1 — MCP Contract Hardening
315
+
316
+ - [ ] `npm run validate:mcp-contracts` fails if any catalog tool with `mutating: true` is not in `TOOL_BEHAVIOR_METADATA`
317
+ - [ ] `npm run validate:mcp-contracts` fails if any input or output schema fails AJV compilation
318
+ - [ ] `npm run validate:mcp-contracts` prints warnings for orphan schema files not in the `knownShared` list
319
+ - [ ] `npm run validate:mcp-contracts` fails if any `supported_roles` value is not in the known role set
320
+ - [ ] `cost.record` tool has `TOOLS.COST_RECORD` added to `MUTATING_TOOLS` in `tool-metadata.ts`
321
+ - [ ] All existing passing behaviors of `validate:mcp-contracts` continue to pass
322
+
323
+ ### V2 — Docker MCP Contract
324
+
325
+ - [ ] `npm run validate:docker-mcp` fails if the Dockerfile `FROM` does not pin to `node:22` or higher
326
+ - [ ] `npm run validate:docker-mcp` fails if the entrypoint script does not contain `exec "$@"`
327
+ - [ ] All existing passing behaviors of `validate:docker-mcp` continue to pass
328
+
329
+ ### V3 — Architecture Rules
330
+
331
+ - [ ] `npm run validate:architecture` fails for any file in `application/adapters/` that imports from `cli`, `interfaces`, or `supervisor`
332
+ - [ ] `npm run validate:architecture` fails for any file in `core/` that imports from `application-services`, `application-tools`, `application`, `mcp`, or `providers`
333
+ - [ ] `npm run validate:architecture` fails for any unclassified source file (not in the exempt list)
334
+ - [ ] `index.ts` is explicitly exempted from architecture classification
335
+ - [ ] All existing passing behaviors of `validate:architecture` continue to pass
336
+
337
+ ---
338
+
339
+ ## 7. Implementation Order
340
+
341
+ Implement in this order to avoid false CI failures:
342
+
343
+ 1. **Fix `cost.record` in `tool-metadata.ts`** — adds `TOOLS.COST_RECORD` to `MUTATING_TOOLS` (code fix, not validator fix)
344
+ 2. **Verify `core/` has no upward imports** — grep check before changing rules
345
+ 3. **V3: Classify `application/` layer and `unknown` fail-loudly** — low risk, additive classification
346
+ 4. **V3: Expand `core` forbidden list** — only after step 2 confirms no violations exist
347
+ 5. **V1: Add `mutating` cross-check** — only after step 1 ensures it passes immediately
348
+ 6. **V1: Add AJV schema compilation check** — compile all schemas, fix any that fail
349
+ 7. **V1: Add orphan schema detection** — populate `knownShared` with the 3 known orphans
350
+ 8. **V1: Add `supported_roles` validation** — straightforward set membership check
351
+ 9. **V2: Add Node version pin check** — regex against Dockerfile `FROM` line
352
+ 10. **V2: Add `exec "$@"` check** — regex against entrypoint script
353
+
354
+ ---
355
+
356
+ ## 8. Files Affected
357
+
358
+ | File | Change Type |
359
+ |---|---|
360
+ | `apps/control-plane/scripts/validate-mcp-contracts.ts` | Add checks 3.1–3.4 |
361
+ | `apps/control-plane/scripts/validate-architecture-rules.mjs` | Add checks 5.1–5.2 |
362
+ | `apps/control-plane/scripts/validate-docker-mcp-contract.mjs` | Add checks 4.1–4.2 |
363
+ | `apps/control-plane/src/application/tools/tool-metadata.ts` | Add `TOOLS.COST_RECORD` to `MUTATING_TOOLS` |
364
+ | `apps/control-plane/test/tool-metadata.spec.ts` | Add tests for `COST_RECORD` mutating behavior |
365
+ | `spec-files/progress.md` | Update with completed milestone |