@llm-dev-ops/agentics-cli 1.4.59 → 1.4.68

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 (451) hide show
  1. package/README.md +1 -1
  2. package/dist/commands/agents.d.ts.map +1 -1
  3. package/dist/commands/agents.js +167 -0
  4. package/dist/commands/agents.js.map +1 -1
  5. package/dist/pipeline/auto-chain.d.ts +1 -0
  6. package/dist/pipeline/auto-chain.d.ts.map +1 -1
  7. package/dist/pipeline/auto-chain.js +124 -37
  8. package/dist/pipeline/auto-chain.js.map +1 -1
  9. package/dist/pipeline/execution-context.d.ts.map +1 -1
  10. package/dist/pipeline/execution-context.js +12 -37
  11. package/dist/pipeline/execution-context.js.map +1 -1
  12. package/dist/pipeline/phase2/phases/adr-generator.d.ts.map +1 -1
  13. package/dist/pipeline/phase2/phases/adr-generator.js +160 -1
  14. package/dist/pipeline/phase2/phases/adr-generator.js.map +1 -1
  15. package/dist/pipeline/phase2/phases/ddd-generator.d.ts.map +1 -1
  16. package/dist/pipeline/phase2/phases/ddd-generator.js +400 -3
  17. package/dist/pipeline/phase2/phases/ddd-generator.js.map +1 -1
  18. package/dist/pipeline/phase2/phases/ddd-quality-gate.d.ts +43 -0
  19. package/dist/pipeline/phase2/phases/ddd-quality-gate.d.ts.map +1 -0
  20. package/dist/pipeline/phase2/phases/ddd-quality-gate.js +413 -0
  21. package/dist/pipeline/phase2/phases/ddd-quality-gate.js.map +1 -0
  22. package/dist/pipeline/phase2/phases/research-dossier.d.ts +0 -13
  23. package/dist/pipeline/phase2/phases/research-dossier.d.ts.map +1 -1
  24. package/dist/pipeline/phase2/phases/research-dossier.js +114 -1
  25. package/dist/pipeline/phase2/phases/research-dossier.js.map +1 -1
  26. package/dist/pipeline/phase2/phases/research-quality-gate.d.ts +48 -0
  27. package/dist/pipeline/phase2/phases/research-quality-gate.d.ts.map +1 -0
  28. package/dist/pipeline/phase2/phases/research-quality-gate.js +322 -0
  29. package/dist/pipeline/phase2/phases/research-quality-gate.js.map +1 -0
  30. package/dist/pipeline/phase2/phases/sparc-quality-gate.d.ts +41 -0
  31. package/dist/pipeline/phase2/phases/sparc-quality-gate.d.ts.map +1 -0
  32. package/dist/pipeline/phase2/phases/sparc-quality-gate.js +350 -0
  33. package/dist/pipeline/phase2/phases/sparc-quality-gate.js.map +1 -0
  34. package/dist/pipeline/phase2/phases/sparc-specification.d.ts +14 -0
  35. package/dist/pipeline/phase2/phases/sparc-specification.d.ts.map +1 -1
  36. package/dist/pipeline/phase2/phases/sparc-specification.js +500 -10
  37. package/dist/pipeline/phase2/phases/sparc-specification.js.map +1 -1
  38. package/dist/pipeline/phase2/phases/tdd-plan-generator.js +1 -1
  39. package/dist/pipeline/phase2/phases/tdd-plan-generator.js.map +1 -1
  40. package/dist/pipeline/phase2/phases/tech-stack-detector.d.ts +72 -0
  41. package/dist/pipeline/phase2/phases/tech-stack-detector.d.ts.map +1 -0
  42. package/dist/pipeline/phase2/phases/tech-stack-detector.js +332 -0
  43. package/dist/pipeline/phase2/phases/tech-stack-detector.js.map +1 -0
  44. package/dist/pipeline/phase2/types.d.ts +2 -0
  45. package/dist/pipeline/phase2/types.d.ts.map +1 -1
  46. package/dist/pipeline/phase3/phases/domain-codegen.d.ts.map +1 -1
  47. package/dist/pipeline/phase3/phases/domain-codegen.js +169 -4
  48. package/dist/pipeline/phase3/phases/domain-codegen.js.map +1 -1
  49. package/dist/pipeline/phase3/phases/test-generator.d.ts.map +1 -1
  50. package/dist/pipeline/phase3/phases/test-generator.js +12 -2
  51. package/dist/pipeline/phase3/phases/test-generator.js.map +1 -1
  52. package/dist/pipeline/phase3-sparc/phase3-sparc-coordinator.d.ts.map +1 -1
  53. package/dist/pipeline/phase3-sparc/phase3-sparc-coordinator.js +99 -1
  54. package/dist/pipeline/phase3-sparc/phase3-sparc-coordinator.js.map +1 -1
  55. package/dist/pipeline/phase4/phases/deployment-generator.d.ts +17 -4
  56. package/dist/pipeline/phase4/phases/deployment-generator.d.ts.map +1 -1
  57. package/dist/pipeline/phase4/phases/deployment-generator.js +364 -44
  58. package/dist/pipeline/phase4/phases/deployment-generator.js.map +1 -1
  59. package/dist/pipeline/phase4/phases/erp-client-generator.d.ts.map +1 -1
  60. package/dist/pipeline/phase4/phases/erp-client-generator.js +27 -15
  61. package/dist/pipeline/phase4/phases/erp-client-generator.js.map +1 -1
  62. package/dist/pipeline/phase4/phases/erp-target-resolver.d.ts.map +1 -1
  63. package/dist/pipeline/phase4/phases/erp-target-resolver.js +49 -2
  64. package/dist/pipeline/phase4/phases/erp-target-resolver.js.map +1 -1
  65. package/dist/pipeline/phase4/phases/http-server-generator.d.ts.map +1 -1
  66. package/dist/pipeline/phase4/phases/http-server-generator.js +263 -3
  67. package/dist/pipeline/phase4/phases/http-server-generator.js.map +1 -1
  68. package/dist/pipeline/phase4/phases/infra-adapter-generator.d.ts.map +1 -1
  69. package/dist/pipeline/phase4/phases/infra-adapter-generator.js +335 -37
  70. package/dist/pipeline/phase4/phases/infra-adapter-generator.js.map +1 -1
  71. package/dist/pipeline/phase4/types.d.ts +3 -1
  72. package/dist/pipeline/phase4/types.d.ts.map +1 -1
  73. package/dist/pipeline/phase4-adrs/phase4-adrs-coordinator.d.ts.map +1 -1
  74. package/dist/pipeline/phase4-adrs/phase4-adrs-coordinator.js +211 -2
  75. package/dist/pipeline/phase4-adrs/phase4-adrs-coordinator.js.map +1 -1
  76. package/dist/pipeline/phase5-build/phases/implementation-quality-gate.d.ts +54 -0
  77. package/dist/pipeline/phase5-build/phases/implementation-quality-gate.d.ts.map +1 -0
  78. package/dist/pipeline/phase5-build/phases/implementation-quality-gate.js +417 -0
  79. package/dist/pipeline/phase5-build/phases/implementation-quality-gate.js.map +1 -0
  80. package/dist/pipeline/phases/prompt-generator.js +1 -1
  81. package/dist/pipeline/phases/prompt-generator.js.map +1 -1
  82. package/dist/pipeline/ruflo-phase-executor.d.ts +116 -1
  83. package/dist/pipeline/ruflo-phase-executor.d.ts.map +1 -1
  84. package/dist/pipeline/ruflo-phase-executor.js +666 -159
  85. package/dist/pipeline/ruflo-phase-executor.js.map +1 -1
  86. package/dist/pipeline/swarm-orchestrator.d.ts.map +1 -1
  87. package/dist/pipeline/swarm-orchestrator.js +62 -6
  88. package/dist/pipeline/swarm-orchestrator.js.map +1 -1
  89. package/dist/routing/capability-classifier.d.ts +43 -0
  90. package/dist/routing/capability-classifier.d.ts.map +1 -0
  91. package/dist/routing/capability-classifier.js +157 -0
  92. package/dist/routing/capability-classifier.js.map +1 -0
  93. package/dist/routing/composition-engine.d.ts +77 -0
  94. package/dist/routing/composition-engine.d.ts.map +1 -0
  95. package/dist/routing/composition-engine.js +249 -0
  96. package/dist/routing/composition-engine.js.map +1 -0
  97. package/dist/routing/graph-federation.d.ts +71 -0
  98. package/dist/routing/graph-federation.d.ts.map +1 -0
  99. package/dist/routing/graph-federation.js +210 -0
  100. package/dist/routing/graph-federation.js.map +1 -0
  101. package/dist/routing/graph-loader.d.ts +74 -0
  102. package/dist/routing/graph-loader.d.ts.map +1 -0
  103. package/dist/routing/graph-loader.js +383 -0
  104. package/dist/routing/graph-loader.js.map +1 -0
  105. package/dist/routing/graph-router.d.ts +103 -0
  106. package/dist/routing/graph-router.d.ts.map +1 -0
  107. package/dist/routing/graph-router.js +415 -0
  108. package/dist/routing/graph-router.js.map +1 -0
  109. package/dist/routing/graph-validator.d.ts +44 -0
  110. package/dist/routing/graph-validator.d.ts.map +1 -0
  111. package/dist/routing/graph-validator.js +329 -0
  112. package/dist/routing/graph-validator.js.map +1 -0
  113. package/dist/routing/index.d.ts +52 -0
  114. package/dist/routing/index.d.ts.map +1 -0
  115. package/dist/routing/index.js +68 -0
  116. package/dist/routing/index.js.map +1 -0
  117. package/dist/routing/outcome-recorder.d.ts +71 -0
  118. package/dist/routing/outcome-recorder.d.ts.map +1 -0
  119. package/dist/routing/outcome-recorder.js +133 -0
  120. package/dist/routing/outcome-recorder.js.map +1 -0
  121. package/dist/routing/weight-adjuster.d.ts +59 -0
  122. package/dist/routing/weight-adjuster.d.ts.map +1 -0
  123. package/dist/routing/weight-adjuster.js +167 -0
  124. package/dist/routing/weight-adjuster.js.map +1 -0
  125. package/dist/routing/weighted-resolver.d.ts +55 -0
  126. package/dist/routing/weighted-resolver.d.ts.map +1 -0
  127. package/dist/routing/weighted-resolver.js +133 -0
  128. package/dist/routing/weighted-resolver.js.map +1 -0
  129. package/dist/synthesis/ask-artifact-writer.d.ts.map +1 -1
  130. package/dist/synthesis/ask-artifact-writer.js +8 -0
  131. package/dist/synthesis/ask-artifact-writer.js.map +1 -1
  132. package/dist/synthesis/simulation-artifact-generator.d.ts +14 -0
  133. package/dist/synthesis/simulation-artifact-generator.d.ts.map +1 -1
  134. package/dist/synthesis/simulation-artifact-generator.js +224 -1
  135. package/dist/synthesis/simulation-artifact-generator.js.map +1 -1
  136. package/dist/synthesis/simulation-renderers.d.ts.map +1 -1
  137. package/dist/synthesis/simulation-renderers.js +211 -40
  138. package/dist/synthesis/simulation-renderers.js.map +1 -1
  139. package/package.json +1 -1
  140. package/dist/bundled-agents/connector-hub-agents/package-lock.json +0 -11697
  141. package/dist/bundled-agents/connector-hub-agents/package.json +0 -75
  142. package/dist/bundled-agents/connector-hub-agents/tsconfig.build.json +0 -22
  143. package/dist/bundled-agents/connector-hub-agents/tsconfig.json +0 -57
  144. package/dist/bundled-agents/copilot-agents/functions/.gcloudignore +0 -17
  145. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/cors.d.ts +0 -14
  146. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/cors.js +0 -35
  147. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/cors.js.map +0 -1
  148. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/envelope.d.ts +0 -55
  149. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/envelope.js +0 -40
  150. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/envelope.js.map +0 -1
  151. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/health.d.ts +0 -22
  152. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/health.js +0 -38
  153. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/health.js.map +0 -1
  154. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/index.d.ts +0 -34
  155. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/index.js +0 -186
  156. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/index.js.map +0 -1
  157. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/router.d.ts +0 -36
  158. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/router.js +0 -121
  159. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/router.js.map +0 -1
  160. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/config-validation-agent.d.ts +0 -157
  161. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/config-validation-agent.js +0 -948
  162. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/config-validation-agent.js.map +0 -1
  163. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/index.d.ts +0 -9
  164. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/index.js +0 -27
  165. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/index.js.map +0 -1
  166. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/agent-span-wrapper.d.ts +0 -23
  167. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/agent-span-wrapper.js +0 -50
  168. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/agent-span-wrapper.js.map +0 -1
  169. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/base-agent.d.ts +0 -214
  170. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/base-agent.js +0 -91
  171. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/base-agent.js.map +0 -1
  172. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/config-validation-schemas.d.ts +0 -1166
  173. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/config-validation-schemas.js +0 -308
  174. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/config-validation-schemas.js.map +0 -1
  175. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decision-event.d.ts +0 -59
  176. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decision-event.js +0 -62
  177. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decision-event.js.map +0 -1
  178. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decomposer-schemas.d.ts +0 -400
  179. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decomposer-schemas.js +0 -113
  180. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decomposer-schemas.js.map +0 -1
  181. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/execution-graph.d.ts +0 -250
  182. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/execution-graph.js +0 -169
  183. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/execution-graph.js.map +0 -1
  184. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/index.d.ts +0 -17
  185. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/index.js +0 -97
  186. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/index.js.map +0 -1
  187. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intelligence-schemas.d.ts +0 -1674
  188. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intelligence-schemas.js +0 -246
  189. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intelligence-schemas.js.map +0 -1
  190. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intent-classifier-schemas.d.ts +0 -1085
  191. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intent-classifier-schemas.js +0 -218
  192. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intent-classifier-schemas.js.map +0 -1
  193. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/meta-reasoner-schemas.d.ts +0 -949
  194. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/meta-reasoner-schemas.js +0 -253
  195. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/meta-reasoner-schemas.js.map +0 -1
  196. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/objective-clarifier-schemas.d.ts +0 -657
  197. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/objective-clarifier-schemas.js +0 -205
  198. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/objective-clarifier-schemas.js.map +0 -1
  199. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/pipeline-schemas.d.ts +0 -285
  200. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/pipeline-schemas.js +0 -106
  201. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/pipeline-schemas.js.map +0 -1
  202. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/planner-schemas.d.ts +0 -581
  203. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/planner-schemas.js +0 -136
  204. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/planner-schemas.js.map +0 -1
  205. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/reflection-schemas.d.ts +0 -791
  206. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/reflection-schemas.js +0 -225
  207. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/reflection-schemas.js.map +0 -1
  208. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/decomposer-agent.d.ts +0 -120
  209. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/decomposer-agent.js +0 -535
  210. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/decomposer-agent.js.map +0 -1
  211. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/index.d.ts +0 -9
  212. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/index.js +0 -18
  213. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/index.js.map +0 -1
  214. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/index.d.ts +0 -4
  215. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/index.js +0 -9
  216. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/index.js.map +0 -1
  217. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/intent-classifier-agent.d.ts +0 -123
  218. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/intent-classifier-agent.js +0 -609
  219. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/intent-classifier-agent.js.map +0 -1
  220. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/index.d.ts +0 -10
  221. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/index.js +0 -25
  222. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/index.js.map +0 -1
  223. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/meta-reasoner-agent.d.ts +0 -111
  224. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/meta-reasoner-agent.js +0 -686
  225. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/meta-reasoner-agent.js.map +0 -1
  226. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/telemetry.d.ts +0 -11
  227. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/telemetry.js +0 -25
  228. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/telemetry.js.map +0 -1
  229. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/index.d.ts +0 -6
  230. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/index.js +0 -15
  231. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/index.js.map +0 -1
  232. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/objective-clarifier-agent.d.ts +0 -126
  233. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/objective-clarifier-agent.js +0 -780
  234. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/objective-clarifier-agent.js.map +0 -1
  235. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/ruvector-persistence.d.ts +0 -49
  236. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/ruvector-persistence.js +0 -125
  237. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/ruvector-persistence.js.map +0 -1
  238. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/telemetry.d.ts +0 -73
  239. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/telemetry.js +0 -192
  240. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/telemetry.js.map +0 -1
  241. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/index.d.ts +0 -11
  242. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/index.js +0 -25
  243. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/index.js.map +0 -1
  244. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/planner-agent.d.ts +0 -127
  245. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/planner-agent.js +0 -483
  246. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/planner-agent.js.map +0 -1
  247. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/ruvector-persistence.d.ts +0 -49
  248. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/ruvector-persistence.js +0 -125
  249. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/ruvector-persistence.js.map +0 -1
  250. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/telemetry.d.ts +0 -73
  251. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/telemetry.js +0 -192
  252. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/telemetry.js.map +0 -1
  253. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/index.d.ts +0 -11
  254. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/index.js +0 -27
  255. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/index.js.map +0 -1
  256. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/reflection-agent.d.ts +0 -122
  257. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/reflection-agent.js +0 -645
  258. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/reflection-agent.js.map +0 -1
  259. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/ruvector-persistence.d.ts +0 -59
  260. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/ruvector-persistence.js +0 -156
  261. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/ruvector-persistence.js.map +0 -1
  262. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/telemetry.d.ts +0 -88
  263. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/telemetry.js +0 -246
  264. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/telemetry.js.map +0 -1
  265. package/dist/bundled-agents/copilot-agents/functions/index.js +0 -4
  266. package/dist/bundled-agents/copilot-agents/functions/jest.config.js +0 -29
  267. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/cors.d.ts +0 -14
  268. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/cors.js +0 -35
  269. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/cors.js.map +0 -1
  270. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/envelope.d.ts +0 -27
  271. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/envelope.js +0 -21
  272. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/envelope.js.map +0 -1
  273. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/health.d.ts +0 -22
  274. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/health.js +0 -38
  275. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/health.js.map +0 -1
  276. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/index.d.ts +0 -34
  277. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/index.js +0 -174
  278. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/index.js.map +0 -1
  279. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/router.d.ts +0 -27
  280. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/router.js +0 -107
  281. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/router.js.map +0 -1
  282. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/config-validation-agent.d.ts +0 -157
  283. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/config-validation-agent.js +0 -941
  284. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/config-validation-agent.js.map +0 -1
  285. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/index.d.ts +0 -9
  286. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/index.js +0 -27
  287. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/index.js.map +0 -1
  288. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/agent-span-wrapper.d.ts +0 -23
  289. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/agent-span-wrapper.js +0 -50
  290. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/agent-span-wrapper.js.map +0 -1
  291. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/base-agent.d.ts +0 -185
  292. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/base-agent.js +0 -86
  293. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/base-agent.js.map +0 -1
  294. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/config-validation-schemas.d.ts +0 -1081
  295. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/config-validation-schemas.js +0 -305
  296. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/config-validation-schemas.js.map +0 -1
  297. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decision-event.d.ts +0 -59
  298. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decision-event.js +0 -62
  299. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decision-event.js.map +0 -1
  300. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decomposer-schemas.d.ts +0 -315
  301. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decomposer-schemas.js +0 -110
  302. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decomposer-schemas.js.map +0 -1
  303. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/execution-graph.d.ts +0 -250
  304. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/execution-graph.js +0 -169
  305. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/execution-graph.js.map +0 -1
  306. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/index.d.ts +0 -16
  307. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/index.js +0 -88
  308. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/index.js.map +0 -1
  309. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intelligence-schemas.d.ts +0 -1674
  310. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intelligence-schemas.js +0 -246
  311. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intelligence-schemas.js.map +0 -1
  312. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intent-classifier-schemas.d.ts +0 -1000
  313. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intent-classifier-schemas.js +0 -215
  314. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intent-classifier-schemas.js.map +0 -1
  315. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/meta-reasoner-schemas.d.ts +0 -864
  316. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/meta-reasoner-schemas.js +0 -250
  317. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/meta-reasoner-schemas.js.map +0 -1
  318. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/objective-clarifier-schemas.d.ts +0 -572
  319. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/objective-clarifier-schemas.js +0 -202
  320. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/objective-clarifier-schemas.js.map +0 -1
  321. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/planner-schemas.d.ts +0 -496
  322. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/planner-schemas.js +0 -133
  323. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/planner-schemas.js.map +0 -1
  324. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/reflection-schemas.d.ts +0 -706
  325. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/reflection-schemas.js +0 -222
  326. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/reflection-schemas.js.map +0 -1
  327. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/decomposer-agent.d.ts +0 -107
  328. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/decomposer-agent.js +0 -360
  329. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/decomposer-agent.js.map +0 -1
  330. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/index.d.ts +0 -9
  331. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/index.js +0 -18
  332. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/index.js.map +0 -1
  333. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/index.d.ts +0 -4
  334. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/index.js +0 -9
  335. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/index.js.map +0 -1
  336. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/intent-classifier-agent.d.ts +0 -123
  337. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/intent-classifier-agent.js +0 -609
  338. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/intent-classifier-agent.js.map +0 -1
  339. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/index.d.ts +0 -10
  340. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/index.js +0 -25
  341. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/index.js.map +0 -1
  342. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/meta-reasoner-agent.d.ts +0 -111
  343. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/meta-reasoner-agent.js +0 -686
  344. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/meta-reasoner-agent.js.map +0 -1
  345. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/telemetry.d.ts +0 -11
  346. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/telemetry.js +0 -25
  347. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/telemetry.js.map +0 -1
  348. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/index.d.ts +0 -6
  349. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/index.js +0 -15
  350. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/index.js.map +0 -1
  351. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/objective-clarifier-agent.d.ts +0 -126
  352. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/objective-clarifier-agent.js +0 -780
  353. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/objective-clarifier-agent.js.map +0 -1
  354. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/ruvector-persistence.d.ts +0 -49
  355. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/ruvector-persistence.js +0 -125
  356. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/ruvector-persistence.js.map +0 -1
  357. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/telemetry.d.ts +0 -73
  358. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/telemetry.js +0 -192
  359. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/telemetry.js.map +0 -1
  360. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/index.d.ts +0 -11
  361. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/index.js +0 -25
  362. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/index.js.map +0 -1
  363. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/planner-agent.d.ts +0 -119
  364. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/planner-agent.js +0 -421
  365. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/planner-agent.js.map +0 -1
  366. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/ruvector-persistence.d.ts +0 -49
  367. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/ruvector-persistence.js +0 -125
  368. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/ruvector-persistence.js.map +0 -1
  369. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/telemetry.d.ts +0 -73
  370. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/telemetry.js +0 -192
  371. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/telemetry.js.map +0 -1
  372. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/index.d.ts +0 -11
  373. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/index.js +0 -27
  374. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/index.js.map +0 -1
  375. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/reflection-agent.d.ts +0 -122
  376. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/reflection-agent.js +0 -645
  377. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/reflection-agent.js.map +0 -1
  378. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/ruvector-persistence.d.ts +0 -59
  379. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/ruvector-persistence.js +0 -156
  380. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/ruvector-persistence.js.map +0 -1
  381. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/telemetry.d.ts +0 -88
  382. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/telemetry.js +0 -246
  383. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/telemetry.js.map +0 -1
  384. package/dist/bundled-agents/copilot-agents/functions/package-lock.json +0 -5473
  385. package/dist/bundled-agents/copilot-agents/functions/package.json +0 -40
  386. package/dist/bundled-agents/copilot-agents/functions/src/claude.ts +0 -71
  387. package/dist/bundled-agents/copilot-agents/functions/src/cors.ts +0 -36
  388. package/dist/bundled-agents/copilot-agents/functions/src/envelope.ts +0 -77
  389. package/dist/bundled-agents/copilot-agents/functions/src/handler.test.ts +0 -340
  390. package/dist/bundled-agents/copilot-agents/functions/src/health.ts +0 -53
  391. package/dist/bundled-agents/copilot-agents/functions/src/index.ts +0 -201
  392. package/dist/bundled-agents/copilot-agents/functions/src/router.ts +0 -148
  393. package/dist/bundled-agents/copilot-agents/functions/tsconfig.json +0 -31
  394. package/dist/bundled-agents/copilot-agents/package-lock.json +0 -11825
  395. package/dist/bundled-agents/copilot-agents/package.json +0 -5
  396. package/dist/bundled-agents/governance-dashboard-agents/package-lock.json +0 -8282
  397. package/dist/bundled-agents/governance-dashboard-agents/package.json +0 -13
  398. package/dist/bundled-agents/orchestrator-agents/functions/contracts/index.js +0 -590
  399. package/dist/bundled-agents/orchestrator-agents/functions/index.js +0 -442
  400. package/dist/bundled-agents/orchestrator-agents/functions/test.js +0 -325
  401. package/dist/bundled-agents/orchestrator-agents/index.js +0 -6
  402. package/dist/bundled-agents/orchestrator-agents/package-lock.json +0 -13254
  403. package/dist/bundled-agents/orchestrator-agents/package.json +0 -20
  404. package/dist/bundled-agents/platform-agents/package-lock.json +0 -1723
  405. package/dist/bundled-agents/platform-agents/package.json +0 -22
  406. package/dist/bundled-agents/platform-agents/src/agents/decision-memo.ts +0 -463
  407. package/dist/bundled-agents/platform-agents/src/agents/decision.ts +0 -234
  408. package/dist/bundled-agents/platform-agents/src/agents/executive-summary.ts +0 -229
  409. package/dist/bundled-agents/platform-agents/src/agents/risk-score.ts +0 -327
  410. package/dist/bundled-agents/platform-agents/src/claude.ts +0 -71
  411. package/dist/bundled-agents/platform-agents/src/cors.ts +0 -24
  412. package/dist/bundled-agents/platform-agents/src/envelope.ts +0 -37
  413. package/dist/bundled-agents/platform-agents/src/health.ts +0 -20
  414. package/dist/bundled-agents/platform-agents/src/index.ts +0 -171
  415. package/dist/bundled-agents/platform-agents/src/router.ts +0 -38
  416. package/dist/bundled-agents/platform-agents/src/text-analysis.ts +0 -238
  417. package/dist/bundled-agents/platform-agents/tsconfig.json +0 -19
  418. package/dist/bundled-agents/sentinel-agents/lib/agents/alert.d.ts +0 -3
  419. package/dist/bundled-agents/sentinel-agents/lib/agents/alert.d.ts.map +0 -1
  420. package/dist/bundled-agents/sentinel-agents/lib/agents/alert.js +0 -43
  421. package/dist/bundled-agents/sentinel-agents/lib/agents/alert.js.map +0 -1
  422. package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.d.ts +0 -3
  423. package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.d.ts.map +0 -1
  424. package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.js +0 -30
  425. package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.js.map +0 -1
  426. package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.d.ts +0 -3
  427. package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.d.ts.map +0 -1
  428. package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.js +0 -53
  429. package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.js.map +0 -1
  430. package/dist/bundled-agents/sentinel-agents/lib/agents/drift.d.ts +0 -3
  431. package/dist/bundled-agents/sentinel-agents/lib/agents/drift.d.ts.map +0 -1
  432. package/dist/bundled-agents/sentinel-agents/lib/agents/drift.js +0 -51
  433. package/dist/bundled-agents/sentinel-agents/lib/agents/drift.js.map +0 -1
  434. package/dist/bundled-agents/sentinel-agents/lib/agents/rca.d.ts +0 -3
  435. package/dist/bundled-agents/sentinel-agents/lib/agents/rca.d.ts.map +0 -1
  436. package/dist/bundled-agents/sentinel-agents/lib/agents/rca.js +0 -36
  437. package/dist/bundled-agents/sentinel-agents/lib/agents/rca.js.map +0 -1
  438. package/dist/bundled-agents/sentinel-agents/lib/index.d.ts +0 -2
  439. package/dist/bundled-agents/sentinel-agents/lib/index.d.ts.map +0 -1
  440. package/dist/bundled-agents/sentinel-agents/lib/index.js +0 -70
  441. package/dist/bundled-agents/sentinel-agents/lib/index.js.map +0 -1
  442. package/dist/bundled-agents/sentinel-agents/package-lock.json +0 -12591
  443. package/dist/bundled-agents/sentinel-agents/package.json +0 -62
  444. package/dist/bundled-agents/sentinel-agents/src/agents/alert.ts +0 -46
  445. package/dist/bundled-agents/sentinel-agents/src/agents/anomaly.ts +0 -33
  446. package/dist/bundled-agents/sentinel-agents/src/agents/correlation.ts +0 -56
  447. package/dist/bundled-agents/sentinel-agents/src/agents/drift.ts +0 -54
  448. package/dist/bundled-agents/sentinel-agents/src/agents/rca.ts +0 -38
  449. package/dist/bundled-agents/sentinel-agents/src/claude.ts +0 -71
  450. package/dist/bundled-agents/sentinel-agents/src/index.ts +0 -77
  451. package/dist/bundled-agents/sentinel-agents/tsconfig.json +0 -20
@@ -0,0 +1,210 @@
1
+ /**
2
+ * Graph Federation (ADR-031 Phase 4)
3
+ *
4
+ * Supports splitting the monolithic ecosystem.graph.json into per-capability
5
+ * fragment files under docs/ecosystem.fragments/. The loader detects the
6
+ * graph format and uses either monolithic or federated loading.
7
+ *
8
+ * Fragment format: Each file declares a single capability with an owner field.
9
+ * Root graph in v2.0 format contains metadata, stages, compositions, and
10
+ * a fragments_dir pointer instead of inline capabilities.
11
+ */
12
+ import * as fs from 'node:fs';
13
+ import * as path from 'node:path';
14
+ // ============================================================================
15
+ // Detection
16
+ // ============================================================================
17
+ /**
18
+ * Detect whether a parsed graph root uses federated mode (v2.0+).
19
+ * Federated graphs have a `fragments_dir` field instead of `capabilities`.
20
+ */
21
+ export function isFederatedGraph(data) {
22
+ return typeof data['fragments_dir'] === 'string';
23
+ }
24
+ // ============================================================================
25
+ // Fragment Loading
26
+ // ============================================================================
27
+ /**
28
+ * Load all capability fragments from the fragments directory.
29
+ * Returns the merged result with fragments, warnings, and errors.
30
+ */
31
+ export function loadFragments(rootGraphPath, fragmentsDir) {
32
+ const errors = [];
33
+ const warnings = [];
34
+ // Read root graph
35
+ let rootData;
36
+ try {
37
+ const raw = fs.readFileSync(rootGraphPath, 'utf-8');
38
+ rootData = JSON.parse(raw);
39
+ }
40
+ catch (err) {
41
+ errors.push(`Failed to read root graph: ${err.message}`);
42
+ return {
43
+ fragments: [],
44
+ root: { version: '2.0', fragments_dir: fragmentsDir },
45
+ errors,
46
+ warnings,
47
+ };
48
+ }
49
+ const root = {
50
+ version: rootData['version'] ?? '2.0',
51
+ description: rootData['description'],
52
+ stages: rootData['stages'],
53
+ fragments_dir: fragmentsDir,
54
+ compositions: rootData['compositions'],
55
+ overrides: rootData['overrides'],
56
+ };
57
+ // Resolve fragments directory relative to root graph
58
+ const rootDir = path.dirname(rootGraphPath);
59
+ const absFragDir = path.resolve(rootDir, fragmentsDir);
60
+ if (!fs.existsSync(absFragDir)) {
61
+ errors.push(`Fragments directory not found: ${absFragDir}`);
62
+ return { fragments: [], root, errors, warnings };
63
+ }
64
+ // Read all .graph.json files
65
+ const files = fs.readdirSync(absFragDir)
66
+ .filter(f => f.endsWith('.graph.json'))
67
+ .sort();
68
+ const fragments = [];
69
+ const capNames = new Set();
70
+ for (const file of files) {
71
+ const filePath = path.join(absFragDir, file);
72
+ try {
73
+ const raw = fs.readFileSync(filePath, 'utf-8');
74
+ const data = JSON.parse(raw);
75
+ const fragment = parseFragment(data, file);
76
+ if (!fragment) {
77
+ errors.push(`${file}: invalid fragment format — missing "capability" field`);
78
+ continue;
79
+ }
80
+ // Check for duplicate capability names
81
+ if (capNames.has(fragment.capability)) {
82
+ errors.push(`${file}: duplicate capability name "${fragment.capability}"`);
83
+ continue;
84
+ }
85
+ capNames.add(fragment.capability);
86
+ // Check owner field
87
+ if (!fragment.owner) {
88
+ warnings.push(`${file}: missing "owner" field`);
89
+ }
90
+ // Apply root overrides
91
+ const override = root.overrides?.[fragment.capability];
92
+ const finalFragment = override ? applyOverride(fragment, override) : fragment;
93
+ fragments.push(finalFragment);
94
+ }
95
+ catch (err) {
96
+ errors.push(`${file}: failed to parse — ${err.message}`);
97
+ }
98
+ }
99
+ return { fragments, root, errors, warnings };
100
+ }
101
+ // ============================================================================
102
+ // Fragment Parsing
103
+ // ============================================================================
104
+ function parseFragment(data, _fileName) {
105
+ if (typeof data['capability'] !== 'string')
106
+ return null;
107
+ return {
108
+ capability: data['capability'],
109
+ description: data['description'],
110
+ owner: data['owner'],
111
+ repos: data['repos'] ?? [],
112
+ agents: data['agents'] ?? [],
113
+ stage: data['stage'],
114
+ depends_on: data['depends_on'],
115
+ tags: data['tags'],
116
+ };
117
+ }
118
+ function applyOverride(fragment, override) {
119
+ return {
120
+ ...fragment,
121
+ stage: override.stage ?? fragment.stage,
122
+ // max_agents is applied at selection time, not stored on fragment
123
+ };
124
+ }
125
+ // ============================================================================
126
+ // Federation Script Support
127
+ // ============================================================================
128
+ /**
129
+ * Split a monolithic graph into capability fragments.
130
+ * Used by the `graph federate` CLI command.
131
+ *
132
+ * @param graphPath - Path to the monolithic ecosystem.graph.json
133
+ * @param outputDir - Directory to write fragments to
134
+ * @returns Summary of the federation operation
135
+ */
136
+ export function federateGraph(graphPath, outputDir) {
137
+ const errors = [];
138
+ let raw;
139
+ try {
140
+ raw = fs.readFileSync(graphPath, 'utf-8');
141
+ }
142
+ catch (err) {
143
+ return { fragmentsCreated: 0, rootUpdated: false, errors: [`Cannot read graph: ${err.message}`] };
144
+ }
145
+ let data;
146
+ try {
147
+ data = JSON.parse(raw);
148
+ }
149
+ catch (err) {
150
+ return { fragmentsCreated: 0, rootUpdated: false, errors: [`Invalid JSON: ${err.message}`] };
151
+ }
152
+ const capabilities = data['capabilities'];
153
+ if (!Array.isArray(capabilities) || capabilities.length === 0) {
154
+ return { fragmentsCreated: 0, rootUpdated: false, errors: ['No capabilities found in graph'] };
155
+ }
156
+ // Create output directory
157
+ fs.mkdirSync(outputDir, { recursive: true });
158
+ let fragmentsCreated = 0;
159
+ for (const cap of capabilities) {
160
+ const name = cap['name'];
161
+ if (!name) {
162
+ errors.push('Skipping capability with no name');
163
+ continue;
164
+ }
165
+ const fragment = {
166
+ capability: name,
167
+ description: cap['description'],
168
+ owner: '',
169
+ repos: cap['repos'],
170
+ agents: cap['agents'],
171
+ stage: cap['stage'],
172
+ depends_on: cap['depends_on'],
173
+ tags: cap['tags'],
174
+ };
175
+ const fileName = `${name}.graph.json`;
176
+ const filePath = path.join(outputDir, fileName);
177
+ fs.writeFileSync(filePath, JSON.stringify(fragment, null, 2) + '\n', 'utf-8');
178
+ fragmentsCreated++;
179
+ }
180
+ // Update root graph to v2.0 format
181
+ const relativeDir = path.relative(path.dirname(graphPath), outputDir);
182
+ const newRoot = {
183
+ version: '2.0',
184
+ description: data['description'] ?? '',
185
+ stages: data['stages'],
186
+ fragments_dir: relativeDir,
187
+ compositions: data['compositions'] ?? [],
188
+ };
189
+ // Write updated root (backup original first)
190
+ const backupPath = graphPath + '.bak';
191
+ fs.copyFileSync(graphPath, backupPath);
192
+ fs.writeFileSync(graphPath, JSON.stringify(newRoot, null, 2) + '\n', 'utf-8');
193
+ return { fragmentsCreated, rootUpdated: true, errors };
194
+ }
195
+ /**
196
+ * Convert a capability fragment back to the monolithic format.
197
+ * Used internally by the graph loader to unify fragment and inline formats.
198
+ */
199
+ export function fragmentToCapabilityEntry(fragment) {
200
+ return {
201
+ name: fragment.capability,
202
+ description: fragment.description,
203
+ repos: fragment.repos,
204
+ agents: fragment.agents,
205
+ stage: fragment.stage,
206
+ depends_on: fragment.depends_on ?? [],
207
+ tags: fragment.tags ?? [],
208
+ };
209
+ }
210
+ //# sourceMappingURL=graph-federation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-federation.js","sourceRoot":"","sources":["../../src/routing/graph-federation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAyClC,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IA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AAE,WAAW;QAC1B,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE;KACzC,CAAC;IAEF,6CAA6C;IAC7C,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;IACtC,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACvC,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;IAE9E,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACzD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,QAA4B;IACpE,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,UAAU;QACzB,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,UAAU,EAAE,QAAQ,CAAC,UAAU,IAAI,EAAE;QACrC,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE;KAC1B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Ecosystem Capability Graph Loader (ADR-030)
3
+ *
4
+ * Reads, validates, and caches the ecosystem capability graph from
5
+ * docs/ecosystem.graph.json. Provides typed lookup methods for
6
+ * the capability classifier and graph router.
7
+ */
8
+ import type { AgentInput } from './weighted-resolver.js';
9
+ import type { CompositionRule } from './composition-engine.js';
10
+ export type StageName = 'simulation' | 'research' | 'specification' | 'architecture' | 'build' | 'validation' | 'deployment' | 'governance';
11
+ export interface CapabilityEntry {
12
+ readonly name: string;
13
+ readonly description?: string;
14
+ readonly repos: readonly string[];
15
+ /** Agents can be plain strings or weighted objects (ADR-031 Phase 1). */
16
+ readonly agents: readonly AgentInput[];
17
+ readonly stage?: StageName;
18
+ readonly depends_on?: readonly string[];
19
+ readonly tags?: readonly string[];
20
+ }
21
+ export interface EcosystemGraph {
22
+ readonly version: string;
23
+ readonly description: string;
24
+ readonly stages: readonly StageName[];
25
+ readonly capabilities: readonly CapabilityEntry[];
26
+ /** Composition rules for capability interaction (ADR-031 Phase 3). */
27
+ readonly compositions?: readonly CompositionRule[];
28
+ /** Fragments directory for federated mode (ADR-031 Phase 4). */
29
+ readonly fragments_dir?: string;
30
+ }
31
+ export interface GraphValidationError {
32
+ readonly path: string;
33
+ readonly message: string;
34
+ }
35
+ /**
36
+ * Resolve the path to the ecosystem graph file.
37
+ * Looks relative to the project root (the directory containing package.json).
38
+ */
39
+ export declare function resolveGraphPath(projectRoot?: string): string;
40
+ /**
41
+ * Load and validate the ecosystem capability graph.
42
+ *
43
+ * Returns a validated, immutable graph object. The result is cached for the
44
+ * lifetime of the process. Pass `forceReload: true` to bypass the cache.
45
+ *
46
+ * @throws Error if the graph file cannot be read or fails validation.
47
+ */
48
+ export declare function loadEcosystemGraph(options?: {
49
+ graphPath?: string;
50
+ forceReload?: boolean;
51
+ }): EcosystemGraph;
52
+ /**
53
+ * Clear the cached graph. Useful for testing.
54
+ */
55
+ export declare function clearGraphCache(): void;
56
+ /**
57
+ * Look up a capability by exact name.
58
+ */
59
+ export declare function getCapabilityByName(graph: EcosystemGraph, name: string): CapabilityEntry | undefined;
60
+ /**
61
+ * Find all capabilities that have a matching tag.
62
+ */
63
+ export declare function getCapabilitiesByTag(graph: EcosystemGraph, tag: string): readonly CapabilityEntry[];
64
+ /**
65
+ * Find all capabilities assigned to a given stage.
66
+ */
67
+ export declare function getCapabilitiesByStage(graph: EcosystemGraph, stage: StageName): readonly CapabilityEntry[];
68
+ /**
69
+ * Resolve the full dependency tree for a set of capability names.
70
+ * Returns all capability names including transitive dependencies.
71
+ * Uses iterative BFS to avoid stack overflow on deep graphs.
72
+ */
73
+ export declare function resolveDependencies(graph: EcosystemGraph, capabilityNames: readonly string[]): readonly string[];
74
+ //# sourceMappingURL=graph-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-loader.d.ts","sourceRoot":"","sources":["../../src/routing/graph-loader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM/D,MAAM,MAAM,SAAS,GACjB,YAAY,GACZ,UAAU,GACV,eAAe,GACf,cAAc,GACd,OAAO,GACP,YAAY,GACZ,YAAY,GACZ,YAAY,CAAC;AAEjB,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,SAAS,eAAe,EAAE,CAAC;IAClD,sEAAsE;IACtE,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACnD,gEAAgE;IAChE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAiBD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAgPD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAG7D;AAeD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,cAAc,CAkEjB;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAGtC;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAEpG;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,eAAe,EAAE,CAKnG;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,eAAe,EAAE,CAE1G;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,cAAc,EACrB,eAAe,EAAE,SAAS,MAAM,EAAE,GACjC,SAAS,MAAM,EAAE,CAkBnB"}
@@ -0,0 +1,383 @@
1
+ /**
2
+ * Ecosystem Capability Graph Loader (ADR-030)
3
+ *
4
+ * Reads, validates, and caches the ecosystem capability graph from
5
+ * docs/ecosystem.graph.json. Provides typed lookup methods for
6
+ * the capability classifier and graph router.
7
+ */
8
+ import * as fs from 'node:fs';
9
+ import * as path from 'node:path';
10
+ // ============================================================================
11
+ // Validation
12
+ // ============================================================================
13
+ const VALID_STAGES = new Set([
14
+ 'simulation',
15
+ 'research',
16
+ 'specification',
17
+ 'architecture',
18
+ 'build',
19
+ 'validation',
20
+ 'deployment',
21
+ 'governance',
22
+ ]);
23
+ function validateGraph(data) {
24
+ const errors = [];
25
+ if (typeof data !== 'object' || data === null || Array.isArray(data)) {
26
+ errors.push({ path: '$', message: 'Root must be a non-null object' });
27
+ return errors;
28
+ }
29
+ const obj = data;
30
+ // version
31
+ if (typeof obj['version'] !== 'string' || obj['version'].length === 0) {
32
+ errors.push({ path: '$.version', message: 'version must be a non-empty string' });
33
+ }
34
+ // stages (optional in v1.0, required in v1.1+)
35
+ if ('stages' in obj) {
36
+ if (!Array.isArray(obj['stages'])) {
37
+ errors.push({ path: '$.stages', message: 'stages must be an array' });
38
+ }
39
+ else {
40
+ for (let i = 0; i < obj['stages'].length; i++) {
41
+ const s = obj['stages'][i];
42
+ if (typeof s !== 'string' || !VALID_STAGES.has(s)) {
43
+ errors.push({ path: `$.stages[${i}]`, message: `Invalid stage: ${String(s)}` });
44
+ }
45
+ }
46
+ }
47
+ }
48
+ // capabilities
49
+ if (!Array.isArray(obj['capabilities'])) {
50
+ errors.push({ path: '$.capabilities', message: 'capabilities must be an array' });
51
+ return errors;
52
+ }
53
+ const capNames = new Set();
54
+ const capabilities = obj['capabilities'];
55
+ for (let i = 0; i < capabilities.length; i++) {
56
+ const cap = capabilities[i];
57
+ const prefix = `$.capabilities[${i}]`;
58
+ if (typeof cap !== 'object' || cap === null || Array.isArray(cap)) {
59
+ errors.push({ path: prefix, message: 'Capability entry must be an object' });
60
+ continue;
61
+ }
62
+ const c = cap;
63
+ // name (required)
64
+ if (typeof c['name'] !== 'string' || c['name'].length === 0) {
65
+ errors.push({ path: `${prefix}.name`, message: 'name must be a non-empty string' });
66
+ }
67
+ else if (capNames.has(c['name'])) {
68
+ errors.push({ path: `${prefix}.name`, message: `Duplicate capability name: ${c['name']}` });
69
+ }
70
+ else {
71
+ capNames.add(c['name']);
72
+ }
73
+ // repos (required, non-empty array of strings)
74
+ if (!Array.isArray(c['repos']) || c['repos'].length === 0) {
75
+ errors.push({ path: `${prefix}.repos`, message: 'repos must be a non-empty array of strings' });
76
+ }
77
+ else {
78
+ for (let j = 0; j < c['repos'].length; j++) {
79
+ if (typeof c['repos'][j] !== 'string') {
80
+ errors.push({ path: `${prefix}.repos[${j}]`, message: 'repo entry must be a string' });
81
+ }
82
+ }
83
+ }
84
+ // agents (required, non-empty array of strings or weighted objects)
85
+ if (!Array.isArray(c['agents']) || c['agents'].length === 0) {
86
+ errors.push({ path: `${prefix}.agents`, message: 'agents must be a non-empty array' });
87
+ }
88
+ else {
89
+ for (let j = 0; j < c['agents'].length; j++) {
90
+ const agent = c['agents'][j];
91
+ if (typeof agent === 'string') {
92
+ // Plain string form — valid
93
+ if (agent.length === 0) {
94
+ errors.push({ path: `${prefix}.agents[${j}]`, message: 'agent name must be non-empty' });
95
+ }
96
+ }
97
+ else if (typeof agent === 'object' && agent !== null && !Array.isArray(agent)) {
98
+ // Weighted object form — validate fields
99
+ const agentObj = agent;
100
+ if (typeof agentObj['name'] !== 'string' || agentObj['name'].length === 0) {
101
+ errors.push({ path: `${prefix}.agents[${j}].name`, message: 'agent name must be a non-empty string' });
102
+ }
103
+ if (typeof agentObj['weight'] === 'number') {
104
+ if (agentObj['weight'] < 0 || agentObj['weight'] > 1) {
105
+ errors.push({ path: `${prefix}.agents[${j}].weight`, message: `weight must be between 0.0 and 1.0, got ${agentObj['weight']}` });
106
+ }
107
+ }
108
+ else if ('weight' in agentObj) {
109
+ errors.push({ path: `${prefix}.agents[${j}].weight`, message: 'weight must be a number' });
110
+ }
111
+ if ('role' in agentObj && agentObj['role'] !== undefined) {
112
+ const validRoles = ['primary', 'secondary', 'specialist'];
113
+ if (typeof agentObj['role'] !== 'string' || !validRoles.includes(agentObj['role'])) {
114
+ errors.push({ path: `${prefix}.agents[${j}].role`, message: `role must be "primary", "secondary", or "specialist"` });
115
+ }
116
+ }
117
+ }
118
+ else {
119
+ errors.push({ path: `${prefix}.agents[${j}]`, message: 'agent must be a string or { name, weight, role } object' });
120
+ }
121
+ }
122
+ }
123
+ // stage (optional, must be valid if present)
124
+ if ('stage' in c && c['stage'] !== undefined) {
125
+ if (typeof c['stage'] !== 'string' || !VALID_STAGES.has(c['stage'])) {
126
+ errors.push({ path: `${prefix}.stage`, message: `Invalid stage: ${String(c['stage'])}` });
127
+ }
128
+ }
129
+ // depends_on (optional, array of strings)
130
+ if ('depends_on' in c && c['depends_on'] !== undefined) {
131
+ if (!Array.isArray(c['depends_on'])) {
132
+ errors.push({ path: `${prefix}.depends_on`, message: 'depends_on must be an array of strings' });
133
+ }
134
+ else {
135
+ for (let j = 0; j < c['depends_on'].length; j++) {
136
+ if (typeof c['depends_on'][j] !== 'string') {
137
+ errors.push({ path: `${prefix}.depends_on[${j}]`, message: 'depends_on entry must be a string' });
138
+ }
139
+ }
140
+ }
141
+ }
142
+ // tags (optional, array of strings)
143
+ if ('tags' in c && c['tags'] !== undefined) {
144
+ if (!Array.isArray(c['tags'])) {
145
+ errors.push({ path: `${prefix}.tags`, message: 'tags must be an array of strings' });
146
+ }
147
+ else {
148
+ for (let j = 0; j < c['tags'].length; j++) {
149
+ if (typeof c['tags'][j] !== 'string') {
150
+ errors.push({ path: `${prefix}.tags[${j}]`, message: 'tag entry must be a string' });
151
+ }
152
+ }
153
+ }
154
+ }
155
+ }
156
+ // Cross-reference: depends_on must reference existing capability names
157
+ for (let i = 0; i < capabilities.length; i++) {
158
+ const c = capabilities[i];
159
+ if (Array.isArray(c['depends_on'])) {
160
+ for (let j = 0; j < c['depends_on'].length; j++) {
161
+ const dep = c['depends_on'][j];
162
+ if (typeof dep === 'string' && !capNames.has(dep)) {
163
+ errors.push({
164
+ path: `$.capabilities[${i}].depends_on[${j}]`,
165
+ message: `depends_on references unknown capability: ${dep}`,
166
+ });
167
+ }
168
+ }
169
+ }
170
+ }
171
+ // Cycle detection in depends_on (Kahn's algorithm)
172
+ if (errors.length === 0) {
173
+ const cycleErrors = detectDependencyCycles(capabilities);
174
+ errors.push(...cycleErrors);
175
+ }
176
+ return errors;
177
+ }
178
+ function detectDependencyCycles(capabilities) {
179
+ const adj = new Map();
180
+ const inDegree = new Map();
181
+ for (const cap of capabilities) {
182
+ const name = cap['name'];
183
+ adj.set(name, []);
184
+ inDegree.set(name, 0);
185
+ }
186
+ for (const cap of capabilities) {
187
+ const name = cap['name'];
188
+ const deps = cap['depends_on'] ?? [];
189
+ for (const dep of deps) {
190
+ const neighbors = adj.get(dep);
191
+ if (neighbors) {
192
+ neighbors.push(name);
193
+ inDegree.set(name, (inDegree.get(name) ?? 0) + 1);
194
+ }
195
+ }
196
+ }
197
+ const queue = [];
198
+ for (const [name, degree] of inDegree) {
199
+ if (degree === 0) {
200
+ queue.push(name);
201
+ }
202
+ }
203
+ const sorted = [];
204
+ while (queue.length > 0) {
205
+ const node = queue.shift();
206
+ sorted.push(node);
207
+ for (const neighbor of adj.get(node) ?? []) {
208
+ const newDegree = (inDegree.get(neighbor) ?? 1) - 1;
209
+ inDegree.set(neighbor, newDegree);
210
+ if (newDegree === 0) {
211
+ queue.push(neighbor);
212
+ }
213
+ }
214
+ }
215
+ if (sorted.length < capabilities.length) {
216
+ const cycleNodes = capabilities
217
+ .map(c => c['name'])
218
+ .filter(n => !sorted.includes(n));
219
+ return [{
220
+ path: '$.capabilities',
221
+ message: `Circular dependency detected among capabilities: ${cycleNodes.join(', ')}`,
222
+ }];
223
+ }
224
+ return [];
225
+ }
226
+ // ============================================================================
227
+ // Graph Loader
228
+ // ============================================================================
229
+ const DEFAULT_STAGES = [
230
+ 'simulation',
231
+ 'research',
232
+ 'specification',
233
+ 'architecture',
234
+ 'build',
235
+ 'validation',
236
+ 'deployment',
237
+ 'governance',
238
+ ];
239
+ /** Cached graph instance — loaded once per process. */
240
+ let cachedGraph = null;
241
+ let cachedGraphPath = null;
242
+ /**
243
+ * Resolve the path to the ecosystem graph file.
244
+ * Looks relative to the project root (the directory containing package.json).
245
+ */
246
+ export function resolveGraphPath(projectRoot) {
247
+ const root = projectRoot ?? findProjectRoot();
248
+ return path.join(root, 'docs', 'ecosystem.graph.json');
249
+ }
250
+ function findProjectRoot() {
251
+ let dir = process.cwd();
252
+ for (let i = 0; i < 10; i++) {
253
+ if (fs.existsSync(path.join(dir, 'package.json'))) {
254
+ return dir;
255
+ }
256
+ const parent = path.dirname(dir);
257
+ if (parent === dir)
258
+ break;
259
+ dir = parent;
260
+ }
261
+ return process.cwd();
262
+ }
263
+ /**
264
+ * Load and validate the ecosystem capability graph.
265
+ *
266
+ * Returns a validated, immutable graph object. The result is cached for the
267
+ * lifetime of the process. Pass `forceReload: true` to bypass the cache.
268
+ *
269
+ * @throws Error if the graph file cannot be read or fails validation.
270
+ */
271
+ export function loadEcosystemGraph(options) {
272
+ const graphPath = options?.graphPath ?? resolveGraphPath();
273
+ // Return cached if same path and not forcing reload
274
+ if (cachedGraph && cachedGraphPath === graphPath && !options?.forceReload) {
275
+ return cachedGraph;
276
+ }
277
+ // Read file
278
+ let raw;
279
+ try {
280
+ raw = fs.readFileSync(graphPath, 'utf-8');
281
+ }
282
+ catch (err) {
283
+ const code = err.code;
284
+ if (code === 'ENOENT') {
285
+ throw new Error(`Ecosystem graph not found at ${graphPath}. Expected docs/ecosystem.graph.json in the project root.`);
286
+ }
287
+ throw new Error(`Failed to read ecosystem graph at ${graphPath}: ${err.message}`);
288
+ }
289
+ // Parse JSON
290
+ let data;
291
+ try {
292
+ data = JSON.parse(raw);
293
+ }
294
+ catch (err) {
295
+ throw new Error(`Ecosystem graph at ${graphPath} contains invalid JSON: ${err.message}`);
296
+ }
297
+ // Validate
298
+ const errors = validateGraph(data);
299
+ if (errors.length > 0) {
300
+ const details = errors.map(e => ` ${e.path}: ${e.message}`).join('\n');
301
+ throw new Error(`Ecosystem graph validation failed:\n${details}`);
302
+ }
303
+ // Build typed graph
304
+ const obj = data;
305
+ const rawCapabilities = obj['capabilities'];
306
+ const stages = (Array.isArray(obj['stages']) ? obj['stages'] : DEFAULT_STAGES);
307
+ const graph = {
308
+ version: obj['version'],
309
+ description: obj['description'] ?? '',
310
+ stages,
311
+ capabilities: rawCapabilities.map(c => ({
312
+ name: c['name'],
313
+ description: c['description'],
314
+ repos: c['repos'],
315
+ agents: c['agents'],
316
+ stage: c['stage'],
317
+ depends_on: c['depends_on'] ?? [],
318
+ tags: c['tags'] ?? [],
319
+ })),
320
+ compositions: Array.isArray(obj['compositions'])
321
+ ? obj['compositions']
322
+ : undefined,
323
+ fragments_dir: typeof obj['fragments_dir'] === 'string'
324
+ ? obj['fragments_dir']
325
+ : undefined,
326
+ };
327
+ // Cache
328
+ cachedGraph = graph;
329
+ cachedGraphPath = graphPath;
330
+ return graph;
331
+ }
332
+ /**
333
+ * Clear the cached graph. Useful for testing.
334
+ */
335
+ export function clearGraphCache() {
336
+ cachedGraph = null;
337
+ cachedGraphPath = null;
338
+ }
339
+ // ============================================================================
340
+ // Lookup Helpers
341
+ // ============================================================================
342
+ /**
343
+ * Look up a capability by exact name.
344
+ */
345
+ export function getCapabilityByName(graph, name) {
346
+ return graph.capabilities.find(c => c.name === name);
347
+ }
348
+ /**
349
+ * Find all capabilities that have a matching tag.
350
+ */
351
+ export function getCapabilitiesByTag(graph, tag) {
352
+ const lower = tag.toLowerCase();
353
+ return graph.capabilities.filter(c => c.tags?.some(t => t.toLowerCase() === lower));
354
+ }
355
+ /**
356
+ * Find all capabilities assigned to a given stage.
357
+ */
358
+ export function getCapabilitiesByStage(graph, stage) {
359
+ return graph.capabilities.filter(c => c.stage === stage);
360
+ }
361
+ /**
362
+ * Resolve the full dependency tree for a set of capability names.
363
+ * Returns all capability names including transitive dependencies.
364
+ * Uses iterative BFS to avoid stack overflow on deep graphs.
365
+ */
366
+ export function resolveDependencies(graph, capabilityNames) {
367
+ const resolved = new Set(capabilityNames);
368
+ const queue = [...capabilityNames];
369
+ while (queue.length > 0) {
370
+ const current = queue.shift();
371
+ const cap = getCapabilityByName(graph, current);
372
+ if (!cap?.depends_on)
373
+ continue;
374
+ for (const dep of cap.depends_on) {
375
+ if (!resolved.has(dep)) {
376
+ resolved.add(dep);
377
+ queue.push(dep);
378
+ }
379
+ }
380
+ }
381
+ return Array.from(resolved);
382
+ }
383
+ //# sourceMappingURL=graph-loader.js.map