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

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 (452) 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 +3 -1
  140. package/scripts/postinstall.sh +25 -0
  141. package/dist/bundled-agents/connector-hub-agents/package-lock.json +0 -11697
  142. package/dist/bundled-agents/connector-hub-agents/package.json +0 -75
  143. package/dist/bundled-agents/connector-hub-agents/tsconfig.build.json +0 -22
  144. package/dist/bundled-agents/connector-hub-agents/tsconfig.json +0 -57
  145. package/dist/bundled-agents/copilot-agents/functions/.gcloudignore +0 -17
  146. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/cors.d.ts +0 -14
  147. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/cors.js +0 -35
  148. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/cors.js.map +0 -1
  149. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/envelope.d.ts +0 -55
  150. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/envelope.js +0 -40
  151. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/envelope.js.map +0 -1
  152. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/health.d.ts +0 -22
  153. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/health.js +0 -38
  154. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/health.js.map +0 -1
  155. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/index.d.ts +0 -34
  156. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/index.js +0 -186
  157. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/index.js.map +0 -1
  158. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/router.d.ts +0 -36
  159. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/router.js +0 -121
  160. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/router.js.map +0 -1
  161. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/config-validation-agent.d.ts +0 -157
  162. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/config-validation-agent.js +0 -948
  163. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/config-validation-agent.js.map +0 -1
  164. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/index.d.ts +0 -9
  165. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/index.js +0 -27
  166. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/index.js.map +0 -1
  167. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/agent-span-wrapper.d.ts +0 -23
  168. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/agent-span-wrapper.js +0 -50
  169. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/agent-span-wrapper.js.map +0 -1
  170. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/base-agent.d.ts +0 -214
  171. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/base-agent.js +0 -91
  172. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/base-agent.js.map +0 -1
  173. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/config-validation-schemas.d.ts +0 -1166
  174. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/config-validation-schemas.js +0 -308
  175. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/config-validation-schemas.js.map +0 -1
  176. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decision-event.d.ts +0 -59
  177. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decision-event.js +0 -62
  178. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decision-event.js.map +0 -1
  179. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decomposer-schemas.d.ts +0 -400
  180. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decomposer-schemas.js +0 -113
  181. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decomposer-schemas.js.map +0 -1
  182. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/execution-graph.d.ts +0 -250
  183. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/execution-graph.js +0 -169
  184. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/execution-graph.js.map +0 -1
  185. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/index.d.ts +0 -17
  186. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/index.js +0 -97
  187. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/index.js.map +0 -1
  188. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intelligence-schemas.d.ts +0 -1674
  189. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intelligence-schemas.js +0 -246
  190. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intelligence-schemas.js.map +0 -1
  191. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intent-classifier-schemas.d.ts +0 -1085
  192. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intent-classifier-schemas.js +0 -218
  193. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intent-classifier-schemas.js.map +0 -1
  194. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/meta-reasoner-schemas.d.ts +0 -949
  195. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/meta-reasoner-schemas.js +0 -253
  196. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/meta-reasoner-schemas.js.map +0 -1
  197. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/objective-clarifier-schemas.d.ts +0 -657
  198. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/objective-clarifier-schemas.js +0 -205
  199. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/objective-clarifier-schemas.js.map +0 -1
  200. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/pipeline-schemas.d.ts +0 -285
  201. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/pipeline-schemas.js +0 -106
  202. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/pipeline-schemas.js.map +0 -1
  203. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/planner-schemas.d.ts +0 -581
  204. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/planner-schemas.js +0 -136
  205. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/planner-schemas.js.map +0 -1
  206. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/reflection-schemas.d.ts +0 -791
  207. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/reflection-schemas.js +0 -225
  208. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/reflection-schemas.js.map +0 -1
  209. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/decomposer-agent.d.ts +0 -120
  210. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/decomposer-agent.js +0 -535
  211. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/decomposer-agent.js.map +0 -1
  212. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/index.d.ts +0 -9
  213. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/index.js +0 -18
  214. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/index.js.map +0 -1
  215. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/index.d.ts +0 -4
  216. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/index.js +0 -9
  217. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/index.js.map +0 -1
  218. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/intent-classifier-agent.d.ts +0 -123
  219. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/intent-classifier-agent.js +0 -609
  220. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/intent-classifier-agent.js.map +0 -1
  221. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/index.d.ts +0 -10
  222. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/index.js +0 -25
  223. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/index.js.map +0 -1
  224. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/meta-reasoner-agent.d.ts +0 -111
  225. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/meta-reasoner-agent.js +0 -686
  226. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/meta-reasoner-agent.js.map +0 -1
  227. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/telemetry.d.ts +0 -11
  228. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/telemetry.js +0 -25
  229. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/telemetry.js.map +0 -1
  230. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/index.d.ts +0 -6
  231. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/index.js +0 -15
  232. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/index.js.map +0 -1
  233. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/objective-clarifier-agent.d.ts +0 -126
  234. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/objective-clarifier-agent.js +0 -780
  235. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/objective-clarifier-agent.js.map +0 -1
  236. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/ruvector-persistence.d.ts +0 -49
  237. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/ruvector-persistence.js +0 -125
  238. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/ruvector-persistence.js.map +0 -1
  239. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/telemetry.d.ts +0 -73
  240. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/telemetry.js +0 -192
  241. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/telemetry.js.map +0 -1
  242. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/index.d.ts +0 -11
  243. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/index.js +0 -25
  244. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/index.js.map +0 -1
  245. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/planner-agent.d.ts +0 -127
  246. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/planner-agent.js +0 -483
  247. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/planner-agent.js.map +0 -1
  248. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/ruvector-persistence.d.ts +0 -49
  249. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/ruvector-persistence.js +0 -125
  250. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/ruvector-persistence.js.map +0 -1
  251. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/telemetry.d.ts +0 -73
  252. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/telemetry.js +0 -192
  253. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/telemetry.js.map +0 -1
  254. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/index.d.ts +0 -11
  255. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/index.js +0 -27
  256. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/index.js.map +0 -1
  257. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/reflection-agent.d.ts +0 -122
  258. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/reflection-agent.js +0 -645
  259. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/reflection-agent.js.map +0 -1
  260. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/ruvector-persistence.d.ts +0 -59
  261. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/ruvector-persistence.js +0 -156
  262. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/ruvector-persistence.js.map +0 -1
  263. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/telemetry.d.ts +0 -88
  264. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/telemetry.js +0 -246
  265. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/telemetry.js.map +0 -1
  266. package/dist/bundled-agents/copilot-agents/functions/index.js +0 -4
  267. package/dist/bundled-agents/copilot-agents/functions/jest.config.js +0 -29
  268. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/cors.d.ts +0 -14
  269. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/cors.js +0 -35
  270. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/cors.js.map +0 -1
  271. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/envelope.d.ts +0 -27
  272. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/envelope.js +0 -21
  273. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/envelope.js.map +0 -1
  274. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/health.d.ts +0 -22
  275. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/health.js +0 -38
  276. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/health.js.map +0 -1
  277. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/index.d.ts +0 -34
  278. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/index.js +0 -174
  279. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/index.js.map +0 -1
  280. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/router.d.ts +0 -27
  281. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/router.js +0 -107
  282. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/router.js.map +0 -1
  283. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/config-validation-agent.d.ts +0 -157
  284. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/config-validation-agent.js +0 -941
  285. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/config-validation-agent.js.map +0 -1
  286. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/index.d.ts +0 -9
  287. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/index.js +0 -27
  288. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/index.js.map +0 -1
  289. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/agent-span-wrapper.d.ts +0 -23
  290. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/agent-span-wrapper.js +0 -50
  291. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/agent-span-wrapper.js.map +0 -1
  292. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/base-agent.d.ts +0 -185
  293. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/base-agent.js +0 -86
  294. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/base-agent.js.map +0 -1
  295. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/config-validation-schemas.d.ts +0 -1081
  296. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/config-validation-schemas.js +0 -305
  297. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/config-validation-schemas.js.map +0 -1
  298. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decision-event.d.ts +0 -59
  299. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decision-event.js +0 -62
  300. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decision-event.js.map +0 -1
  301. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decomposer-schemas.d.ts +0 -315
  302. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decomposer-schemas.js +0 -110
  303. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decomposer-schemas.js.map +0 -1
  304. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/execution-graph.d.ts +0 -250
  305. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/execution-graph.js +0 -169
  306. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/execution-graph.js.map +0 -1
  307. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/index.d.ts +0 -16
  308. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/index.js +0 -88
  309. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/index.js.map +0 -1
  310. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intelligence-schemas.d.ts +0 -1674
  311. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intelligence-schemas.js +0 -246
  312. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intelligence-schemas.js.map +0 -1
  313. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intent-classifier-schemas.d.ts +0 -1000
  314. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intent-classifier-schemas.js +0 -215
  315. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intent-classifier-schemas.js.map +0 -1
  316. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/meta-reasoner-schemas.d.ts +0 -864
  317. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/meta-reasoner-schemas.js +0 -250
  318. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/meta-reasoner-schemas.js.map +0 -1
  319. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/objective-clarifier-schemas.d.ts +0 -572
  320. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/objective-clarifier-schemas.js +0 -202
  321. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/objective-clarifier-schemas.js.map +0 -1
  322. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/planner-schemas.d.ts +0 -496
  323. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/planner-schemas.js +0 -133
  324. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/planner-schemas.js.map +0 -1
  325. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/reflection-schemas.d.ts +0 -706
  326. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/reflection-schemas.js +0 -222
  327. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/reflection-schemas.js.map +0 -1
  328. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/decomposer-agent.d.ts +0 -107
  329. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/decomposer-agent.js +0 -360
  330. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/decomposer-agent.js.map +0 -1
  331. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/index.d.ts +0 -9
  332. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/index.js +0 -18
  333. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/index.js.map +0 -1
  334. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/index.d.ts +0 -4
  335. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/index.js +0 -9
  336. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/index.js.map +0 -1
  337. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/intent-classifier-agent.d.ts +0 -123
  338. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/intent-classifier-agent.js +0 -609
  339. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/intent-classifier-agent.js.map +0 -1
  340. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/index.d.ts +0 -10
  341. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/index.js +0 -25
  342. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/index.js.map +0 -1
  343. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/meta-reasoner-agent.d.ts +0 -111
  344. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/meta-reasoner-agent.js +0 -686
  345. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/meta-reasoner-agent.js.map +0 -1
  346. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/telemetry.d.ts +0 -11
  347. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/telemetry.js +0 -25
  348. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/telemetry.js.map +0 -1
  349. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/index.d.ts +0 -6
  350. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/index.js +0 -15
  351. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/index.js.map +0 -1
  352. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/objective-clarifier-agent.d.ts +0 -126
  353. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/objective-clarifier-agent.js +0 -780
  354. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/objective-clarifier-agent.js.map +0 -1
  355. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/ruvector-persistence.d.ts +0 -49
  356. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/ruvector-persistence.js +0 -125
  357. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/ruvector-persistence.js.map +0 -1
  358. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/telemetry.d.ts +0 -73
  359. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/telemetry.js +0 -192
  360. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/telemetry.js.map +0 -1
  361. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/index.d.ts +0 -11
  362. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/index.js +0 -25
  363. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/index.js.map +0 -1
  364. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/planner-agent.d.ts +0 -119
  365. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/planner-agent.js +0 -421
  366. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/planner-agent.js.map +0 -1
  367. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/ruvector-persistence.d.ts +0 -49
  368. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/ruvector-persistence.js +0 -125
  369. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/ruvector-persistence.js.map +0 -1
  370. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/telemetry.d.ts +0 -73
  371. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/telemetry.js +0 -192
  372. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/telemetry.js.map +0 -1
  373. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/index.d.ts +0 -11
  374. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/index.js +0 -27
  375. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/index.js.map +0 -1
  376. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/reflection-agent.d.ts +0 -122
  377. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/reflection-agent.js +0 -645
  378. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/reflection-agent.js.map +0 -1
  379. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/ruvector-persistence.d.ts +0 -59
  380. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/ruvector-persistence.js +0 -156
  381. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/ruvector-persistence.js.map +0 -1
  382. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/telemetry.d.ts +0 -88
  383. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/telemetry.js +0 -246
  384. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/telemetry.js.map +0 -1
  385. package/dist/bundled-agents/copilot-agents/functions/package-lock.json +0 -5473
  386. package/dist/bundled-agents/copilot-agents/functions/package.json +0 -40
  387. package/dist/bundled-agents/copilot-agents/functions/src/claude.ts +0 -71
  388. package/dist/bundled-agents/copilot-agents/functions/src/cors.ts +0 -36
  389. package/dist/bundled-agents/copilot-agents/functions/src/envelope.ts +0 -77
  390. package/dist/bundled-agents/copilot-agents/functions/src/handler.test.ts +0 -340
  391. package/dist/bundled-agents/copilot-agents/functions/src/health.ts +0 -53
  392. package/dist/bundled-agents/copilot-agents/functions/src/index.ts +0 -201
  393. package/dist/bundled-agents/copilot-agents/functions/src/router.ts +0 -148
  394. package/dist/bundled-agents/copilot-agents/functions/tsconfig.json +0 -31
  395. package/dist/bundled-agents/copilot-agents/package-lock.json +0 -11825
  396. package/dist/bundled-agents/copilot-agents/package.json +0 -5
  397. package/dist/bundled-agents/governance-dashboard-agents/package-lock.json +0 -8282
  398. package/dist/bundled-agents/governance-dashboard-agents/package.json +0 -13
  399. package/dist/bundled-agents/orchestrator-agents/functions/contracts/index.js +0 -590
  400. package/dist/bundled-agents/orchestrator-agents/functions/index.js +0 -442
  401. package/dist/bundled-agents/orchestrator-agents/functions/test.js +0 -325
  402. package/dist/bundled-agents/orchestrator-agents/index.js +0 -6
  403. package/dist/bundled-agents/orchestrator-agents/package-lock.json +0 -13254
  404. package/dist/bundled-agents/orchestrator-agents/package.json +0 -20
  405. package/dist/bundled-agents/platform-agents/package-lock.json +0 -1723
  406. package/dist/bundled-agents/platform-agents/package.json +0 -22
  407. package/dist/bundled-agents/platform-agents/src/agents/decision-memo.ts +0 -463
  408. package/dist/bundled-agents/platform-agents/src/agents/decision.ts +0 -234
  409. package/dist/bundled-agents/platform-agents/src/agents/executive-summary.ts +0 -229
  410. package/dist/bundled-agents/platform-agents/src/agents/risk-score.ts +0 -327
  411. package/dist/bundled-agents/platform-agents/src/claude.ts +0 -71
  412. package/dist/bundled-agents/platform-agents/src/cors.ts +0 -24
  413. package/dist/bundled-agents/platform-agents/src/envelope.ts +0 -37
  414. package/dist/bundled-agents/platform-agents/src/health.ts +0 -20
  415. package/dist/bundled-agents/platform-agents/src/index.ts +0 -171
  416. package/dist/bundled-agents/platform-agents/src/router.ts +0 -38
  417. package/dist/bundled-agents/platform-agents/src/text-analysis.ts +0 -238
  418. package/dist/bundled-agents/platform-agents/tsconfig.json +0 -19
  419. package/dist/bundled-agents/sentinel-agents/lib/agents/alert.d.ts +0 -3
  420. package/dist/bundled-agents/sentinel-agents/lib/agents/alert.d.ts.map +0 -1
  421. package/dist/bundled-agents/sentinel-agents/lib/agents/alert.js +0 -43
  422. package/dist/bundled-agents/sentinel-agents/lib/agents/alert.js.map +0 -1
  423. package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.d.ts +0 -3
  424. package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.d.ts.map +0 -1
  425. package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.js +0 -30
  426. package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.js.map +0 -1
  427. package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.d.ts +0 -3
  428. package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.d.ts.map +0 -1
  429. package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.js +0 -53
  430. package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.js.map +0 -1
  431. package/dist/bundled-agents/sentinel-agents/lib/agents/drift.d.ts +0 -3
  432. package/dist/bundled-agents/sentinel-agents/lib/agents/drift.d.ts.map +0 -1
  433. package/dist/bundled-agents/sentinel-agents/lib/agents/drift.js +0 -51
  434. package/dist/bundled-agents/sentinel-agents/lib/agents/drift.js.map +0 -1
  435. package/dist/bundled-agents/sentinel-agents/lib/agents/rca.d.ts +0 -3
  436. package/dist/bundled-agents/sentinel-agents/lib/agents/rca.d.ts.map +0 -1
  437. package/dist/bundled-agents/sentinel-agents/lib/agents/rca.js +0 -36
  438. package/dist/bundled-agents/sentinel-agents/lib/agents/rca.js.map +0 -1
  439. package/dist/bundled-agents/sentinel-agents/lib/index.d.ts +0 -2
  440. package/dist/bundled-agents/sentinel-agents/lib/index.d.ts.map +0 -1
  441. package/dist/bundled-agents/sentinel-agents/lib/index.js +0 -70
  442. package/dist/bundled-agents/sentinel-agents/lib/index.js.map +0 -1
  443. package/dist/bundled-agents/sentinel-agents/package-lock.json +0 -12591
  444. package/dist/bundled-agents/sentinel-agents/package.json +0 -62
  445. package/dist/bundled-agents/sentinel-agents/src/agents/alert.ts +0 -46
  446. package/dist/bundled-agents/sentinel-agents/src/agents/anomaly.ts +0 -33
  447. package/dist/bundled-agents/sentinel-agents/src/agents/correlation.ts +0 -56
  448. package/dist/bundled-agents/sentinel-agents/src/agents/drift.ts +0 -54
  449. package/dist/bundled-agents/sentinel-agents/src/agents/rca.ts +0 -38
  450. package/dist/bundled-agents/sentinel-agents/src/claude.ts +0 -71
  451. package/dist/bundled-agents/sentinel-agents/src/index.ts +0 -77
  452. package/dist/bundled-agents/sentinel-agents/tsconfig.json +0 -20
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Capability Classifier (ADR-030)
3
+ *
4
+ * Extracts capability names from a user prompt by matching against
5
+ * the ecosystem graph's capability names and tags.
6
+ *
7
+ * Classification strategy (ordered by priority):
8
+ * 1. Exact match — prompt contains a capability name verbatim
9
+ * 2. Tag match — prompt contains a tag from a capability entry
10
+ * 3. Description match — prompt words overlap with capability descriptions
11
+ *
12
+ * No LLM calls. Pure keyword extraction for deterministic, zero-latency routing.
13
+ */
14
+ // ============================================================================
15
+ // Tokenization
16
+ // ============================================================================
17
+ /**
18
+ * Normalize and tokenize a user prompt for matching.
19
+ * Produces lowercase tokens with punctuation stripped.
20
+ */
21
+ function tokenize(prompt) {
22
+ return prompt
23
+ .toLowerCase()
24
+ .replace(/[^a-z0-9\s\-_]/g, ' ')
25
+ .split(/\s+/)
26
+ .filter(t => t.length >= 2);
27
+ }
28
+ /**
29
+ * Build a set of n-grams (1-gram, 2-gram, 3-gram) from tokens
30
+ * for multi-word matching against tags like "cold-start" or "root-cause".
31
+ */
32
+ function buildNgrams(tokens) {
33
+ const ngrams = new Set();
34
+ for (const token of tokens) {
35
+ ngrams.add(token);
36
+ }
37
+ for (let i = 0; i < tokens.length - 1; i++) {
38
+ ngrams.add(`${tokens[i]}-${tokens[i + 1]}`);
39
+ ngrams.add(`${tokens[i]}_${tokens[i + 1]}`);
40
+ ngrams.add(`${tokens[i]}${tokens[i + 1]}`);
41
+ }
42
+ for (let i = 0; i < tokens.length - 2; i++) {
43
+ ngrams.add(`${tokens[i]}-${tokens[i + 1]}-${tokens[i + 2]}`);
44
+ ngrams.add(`${tokens[i]}_${tokens[i + 1]}_${tokens[i + 2]}`);
45
+ }
46
+ return ngrams;
47
+ }
48
+ // ============================================================================
49
+ // Stop Words
50
+ // ============================================================================
51
+ /**
52
+ * Common English stop words that should not trigger capability matches.
53
+ */
54
+ const STOP_WORDS = new Set([
55
+ 'the', 'is', 'at', 'which', 'on', 'for', 'to', 'in', 'of', 'and',
56
+ 'or', 'not', 'be', 'are', 'was', 'were', 'been', 'being', 'have',
57
+ 'has', 'had', 'do', 'does', 'did', 'will', 'would', 'could', 'should',
58
+ 'may', 'might', 'shall', 'can', 'need', 'dare', 'ought', 'used',
59
+ 'this', 'that', 'these', 'those', 'am', 'an', 'as', 'but', 'by',
60
+ 'from', 'if', 'into', 'it', 'its', 'my', 'no', 'so', 'than',
61
+ 'too', 'very', 'just', 'about', 'above', 'after', 'all', 'also',
62
+ 'any', 'because', 'before', 'between', 'both', 'each', 'few',
63
+ 'how', 'me', 'more', 'most', 'much', 'must', 'nor', 'only', 'other',
64
+ 'our', 'out', 'over', 'own', 'same', 'she', 'some', 'such', 'then',
65
+ 'there', 'they', 'through', 'under', 'up', 'what', 'when', 'where',
66
+ 'who', 'why', 'with', 'you', 'your', 'we', 'he', 'her', 'him',
67
+ 'his', 'us', 'them', 'their', 'here',
68
+ ]);
69
+ // ============================================================================
70
+ // Classifier
71
+ // ============================================================================
72
+ /**
73
+ * Classify a user prompt against the ecosystem capability graph.
74
+ *
75
+ * Returns matched capabilities with confidence scores and match metadata.
76
+ * Zero-cost: no LLM calls, no network, no async.
77
+ */
78
+ export function classifyCapabilities(prompt, graph) {
79
+ const tokens = tokenize(prompt);
80
+ const significantTokens = tokens.filter(t => !STOP_WORDS.has(t));
81
+ const ngrams = buildNgrams(significantTokens);
82
+ const promptLower = prompt.toLowerCase();
83
+ const matches = new Map();
84
+ for (const cap of graph.capabilities) {
85
+ // Strategy 1: Exact capability name match
86
+ // Normalize capability name for matching (e.g., "erp_integration" → "erp integration")
87
+ const nameNormalized = cap.name.replace(/_/g, ' ').toLowerCase();
88
+ const nameUnderscore = cap.name.toLowerCase();
89
+ if (promptLower.includes(nameNormalized) || promptLower.includes(nameUnderscore)) {
90
+ setMatch(matches, cap, 'exact', [cap.name], 1.0);
91
+ continue;
92
+ }
93
+ // Also check individual name parts (e.g., "erp_integration" splits to "erp", "integration")
94
+ const nameParts = cap.name.toLowerCase().split('_').filter(p => p.length >= 3);
95
+ const namePartMatches = nameParts.filter(part => !STOP_WORDS.has(part) && ngrams.has(part));
96
+ if (namePartMatches.length === nameParts.length && nameParts.length > 0) {
97
+ setMatch(matches, cap, 'exact', namePartMatches, 0.95);
98
+ continue;
99
+ }
100
+ // Strategy 2: Tag match
101
+ const tagMatches = findTagMatches(cap, ngrams);
102
+ if (tagMatches.length > 0) {
103
+ // Confidence scales with number of matching tags, capped at 0.9
104
+ const tagConfidence = Math.min(0.9, 0.5 + tagMatches.length * 0.1);
105
+ setMatch(matches, cap, 'tag', tagMatches, tagConfidence);
106
+ continue;
107
+ }
108
+ // Strategy 3: Description match (lowest confidence)
109
+ if (cap.description) {
110
+ const descTokens = tokenize(cap.description).filter(t => !STOP_WORDS.has(t) && t.length >= 3);
111
+ const descMatches = descTokens.filter(dt => ngrams.has(dt));
112
+ // Require at least 2 description word matches to avoid false positives
113
+ if (descMatches.length >= 2) {
114
+ const descConfidence = Math.min(0.6, 0.2 + descMatches.length * 0.1);
115
+ setMatch(matches, cap, 'description', descMatches, descConfidence);
116
+ }
117
+ }
118
+ }
119
+ const capabilities = Array.from(matches.values())
120
+ .sort((a, b) => b.confidence - a.confidence);
121
+ return {
122
+ capabilities,
123
+ promptTokens: significantTokens,
124
+ };
125
+ }
126
+ function findTagMatches(cap, ngrams) {
127
+ if (!cap.tags || cap.tags.length === 0)
128
+ return [];
129
+ const matched = [];
130
+ for (const tag of cap.tags) {
131
+ const tagLower = tag.toLowerCase();
132
+ if (ngrams.has(tagLower)) {
133
+ matched.push(tag);
134
+ }
135
+ }
136
+ return matched;
137
+ }
138
+ function setMatch(matches, cap, matchType, matchedTokens, confidence) {
139
+ const existing = matches.get(cap.name);
140
+ // Only replace if higher confidence
141
+ if (!existing || confidence > existing.confidence) {
142
+ matches.set(cap.name, {
143
+ name: cap.name,
144
+ matchType,
145
+ matchedTokens,
146
+ confidence,
147
+ });
148
+ }
149
+ }
150
+ /**
151
+ * Extract just the capability names from a classification result.
152
+ * Convenience method for the router.
153
+ */
154
+ export function extractCapabilityNames(result) {
155
+ return result.capabilities.map(c => c.name);
156
+ }
157
+ //# sourceMappingURL=capability-classifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-classifier.js","sourceRoot":"","sources":["../../src/routing/capability-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA0BH,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAAc;IAC9B,OAAO,MAAM;SACV,WAAW,EAAE;SACb,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC;SAC/B,KAAK,CAAC,KAAK,CAAC;SACZ,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;AAChC,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,MAAgB;IACnC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IAEjC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,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H,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAA4B;IACjE,OAAO,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Composition Engine (ADR-031 Phase 3)
3
+ *
4
+ * Evaluates composition rules that encode expert knowledge about
5
+ * capability interactions. When certain capability combinations are
6
+ * detected, the engine automatically adds required companion capabilities.
7
+ *
8
+ * Example: erp_integration + security_validation → add data_security
9
+ *
10
+ * Rules are defined in the ecosystem graph's `compositions` array.
11
+ * The engine iterates until no new capabilities are added, with a
12
+ * maximum of 3 iterations to prevent runaway rule chains.
13
+ */
14
+ export type CompositionOperator = 'all' | 'any';
15
+ export type CompositionPriority = 'required' | 'recommended' | 'optional';
16
+ export interface CompositionRule {
17
+ readonly id: string;
18
+ readonly when: readonly string[];
19
+ readonly operator: CompositionOperator;
20
+ readonly add: readonly string[];
21
+ readonly reason: string;
22
+ readonly priority: CompositionPriority;
23
+ }
24
+ export interface CompositionResult {
25
+ /** Final set of capabilities after composition rules are applied. */
26
+ readonly capabilities: readonly string[];
27
+ /** Capabilities that were added by composition rules. */
28
+ readonly added: readonly string[];
29
+ /** Rules that fired and their details. */
30
+ readonly firedRules: readonly FiredRule[];
31
+ /** Number of iterations performed. */
32
+ readonly iterations: number;
33
+ }
34
+ export interface FiredRule {
35
+ readonly ruleId: string;
36
+ readonly reason: string;
37
+ readonly addedCapabilities: readonly string[];
38
+ readonly priority: CompositionPriority;
39
+ }
40
+ /**
41
+ * Apply composition rules to expand the capability set.
42
+ *
43
+ * Iterates until no new capabilities are added or MAX_ITERATIONS is reached.
44
+ * Only 'required' rules always fire. 'recommended' rules fire if under
45
+ * the agent budget threshold. 'optional' rules are never auto-applied.
46
+ *
47
+ * @param capabilities - Initial set of classified capabilities
48
+ * @param rules - Composition rules from the graph
49
+ * @param validCapabilities - Set of all valid capability names in the graph
50
+ * @param options - Budget and control options
51
+ */
52
+ export declare function applyCompositions(capabilities: readonly string[], rules: readonly CompositionRule[], validCapabilities: ReadonlySet<string>, options?: CompositionOptions): CompositionResult;
53
+ export interface CompositionOptions {
54
+ /** Current agent count before composition. */
55
+ readonly currentAgentCount?: number;
56
+ /** Total agent budget ceiling. */
57
+ readonly agentBudget?: number;
58
+ }
59
+ /**
60
+ * Validate composition rules for structural correctness.
61
+ * Returns error messages or empty array.
62
+ */
63
+ export declare function validateCompositionRules(rules: readonly CompositionRule[], validCapabilities: ReadonlySet<string>): string[];
64
+ /**
65
+ * Detect cycles in composition rules.
66
+ * A cycle occurs when rule A adds capability X, and rule B (triggered by X) adds
67
+ * a capability that triggers rule A.
68
+ */
69
+ export declare function detectCompositionCycles(rules: readonly CompositionRule[]): {
70
+ hasCycle: boolean;
71
+ cycleNodes: string[];
72
+ };
73
+ /**
74
+ * Format composition result as a human-readable explanation.
75
+ */
76
+ export declare function formatCompositionExplanation(result: CompositionResult): string;
77
+ //# sourceMappingURL=composition-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition-engine.d.ts","sourceRoot":"","sources":["../../src/routing/composition-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,KAAK,CAAC;AAChD,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,aAAa,GAAG,UAAU,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,C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G;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAa9E"}
@@ -0,0 +1,249 @@
1
+ /**
2
+ * Composition Engine (ADR-031 Phase 3)
3
+ *
4
+ * Evaluates composition rules that encode expert knowledge about
5
+ * capability interactions. When certain capability combinations are
6
+ * detected, the engine automatically adds required companion capabilities.
7
+ *
8
+ * Example: erp_integration + security_validation → add data_security
9
+ *
10
+ * Rules are defined in the ecosystem graph's `compositions` array.
11
+ * The engine iterates until no new capabilities are added, with a
12
+ * maximum of 3 iterations to prevent runaway rule chains.
13
+ */
14
+ // ============================================================================
15
+ // Constants
16
+ // ============================================================================
17
+ const MAX_ITERATIONS = 3;
18
+ // ============================================================================
19
+ // Engine
20
+ // ============================================================================
21
+ /**
22
+ * Apply composition rules to expand the capability set.
23
+ *
24
+ * Iterates until no new capabilities are added or MAX_ITERATIONS is reached.
25
+ * Only 'required' rules always fire. 'recommended' rules fire if under
26
+ * the agent budget threshold. 'optional' rules are never auto-applied.
27
+ *
28
+ * @param capabilities - Initial set of classified capabilities
29
+ * @param rules - Composition rules from the graph
30
+ * @param validCapabilities - Set of all valid capability names in the graph
31
+ * @param options - Budget and control options
32
+ */
33
+ export function applyCompositions(capabilities, rules, validCapabilities, options) {
34
+ if (rules.length === 0 || capabilities.length === 0) {
35
+ return {
36
+ capabilities,
37
+ added: [],
38
+ firedRules: [],
39
+ iterations: 0,
40
+ };
41
+ }
42
+ const currentAgentCount = options?.currentAgentCount ?? 0;
43
+ const agentBudget = options?.agentBudget ?? 15;
44
+ const result = new Set(capabilities);
45
+ const added = [];
46
+ const firedRules = [];
47
+ let iterations = 0;
48
+ let changed = true;
49
+ while (changed && iterations < MAX_ITERATIONS) {
50
+ changed = false;
51
+ iterations++;
52
+ for (const rule of rules) {
53
+ // Check if the rule's trigger condition is met
54
+ if (!evaluateCondition(rule, result))
55
+ continue;
56
+ // Determine which capabilities to add
57
+ for (const capToAdd of rule.add) {
58
+ if (result.has(capToAdd))
59
+ continue;
60
+ if (!validCapabilities.has(capToAdd))
61
+ continue;
62
+ if (rule.priority === 'required') {
63
+ result.add(capToAdd);
64
+ added.push(capToAdd);
65
+ changed = true;
66
+ }
67
+ else if (rule.priority === 'recommended' &&
68
+ currentAgentCount < agentBudget * 0.8) {
69
+ result.add(capToAdd);
70
+ added.push(capToAdd);
71
+ changed = true;
72
+ }
73
+ // 'optional' rules are not auto-applied
74
+ }
75
+ // Record the fired rule if it added anything
76
+ const ruleAdded = rule.add.filter(c => added.includes(c));
77
+ if (ruleAdded.length > 0 && !firedRules.some(f => f.ruleId === rule.id)) {
78
+ firedRules.push({
79
+ ruleId: rule.id,
80
+ reason: rule.reason,
81
+ addedCapabilities: ruleAdded,
82
+ priority: rule.priority,
83
+ });
84
+ }
85
+ }
86
+ }
87
+ return {
88
+ capabilities: Array.from(result),
89
+ added,
90
+ firedRules,
91
+ iterations,
92
+ };
93
+ }
94
+ // ============================================================================
95
+ // Rule Evaluation
96
+ // ============================================================================
97
+ /**
98
+ * Evaluate whether a composition rule's trigger condition is met.
99
+ */
100
+ function evaluateCondition(rule, capabilities) {
101
+ if (rule.operator === 'all') {
102
+ return rule.when.every(c => capabilities.has(c));
103
+ }
104
+ if (rule.operator === 'any') {
105
+ return rule.when.some(c => capabilities.has(c));
106
+ }
107
+ return false;
108
+ }
109
+ // ============================================================================
110
+ // Validation
111
+ // ============================================================================
112
+ /**
113
+ * Validate composition rules for structural correctness.
114
+ * Returns error messages or empty array.
115
+ */
116
+ export function validateCompositionRules(rules, validCapabilities) {
117
+ const errors = [];
118
+ const ruleIds = new Set();
119
+ for (let i = 0; i < rules.length; i++) {
120
+ const rule = rules[i];
121
+ const prefix = `compositions[${i}]`;
122
+ // Unique ID
123
+ if (!rule.id || rule.id.length === 0) {
124
+ errors.push(`${prefix}.id: must be a non-empty string`);
125
+ }
126
+ else if (ruleIds.has(rule.id)) {
127
+ errors.push(`${prefix}.id: duplicate rule id "${rule.id}"`);
128
+ }
129
+ else {
130
+ ruleIds.add(rule.id);
131
+ }
132
+ // when array
133
+ if (!Array.isArray(rule.when) || rule.when.length === 0) {
134
+ errors.push(`${prefix}.when: must be a non-empty array`);
135
+ }
136
+ else {
137
+ for (const capName of rule.when) {
138
+ if (!validCapabilities.has(capName)) {
139
+ errors.push(`${prefix}.when: references unknown capability "${capName}"`);
140
+ }
141
+ }
142
+ }
143
+ // operator
144
+ if (rule.operator !== 'all' && rule.operator !== 'any') {
145
+ errors.push(`${prefix}.operator: must be "all" or "any", got "${String(rule.operator)}"`);
146
+ }
147
+ // add array
148
+ if (!Array.isArray(rule.add) || rule.add.length === 0) {
149
+ errors.push(`${prefix}.add: must be a non-empty array`);
150
+ }
151
+ else {
152
+ for (const capName of rule.add) {
153
+ if (!validCapabilities.has(capName)) {
154
+ errors.push(`${prefix}.add: references unknown capability "${capName}"`);
155
+ }
156
+ }
157
+ }
158
+ // reason
159
+ if (!rule.reason || rule.reason.length === 0) {
160
+ errors.push(`${prefix}.reason: must be a non-empty string`);
161
+ }
162
+ // priority
163
+ if (!['required', 'recommended', 'optional'].includes(rule.priority)) {
164
+ errors.push(`${prefix}.priority: must be "required", "recommended", or "optional"`);
165
+ }
166
+ // Self-reference check
167
+ if (rule.when && rule.add) {
168
+ const overlap = rule.add.filter(c => rule.when.includes(c));
169
+ if (overlap.length > 0) {
170
+ errors.push(`${prefix}: self-referencing — "when" and "add" share capabilities: ${overlap.join(', ')}`);
171
+ }
172
+ }
173
+ }
174
+ return errors;
175
+ }
176
+ /**
177
+ * Detect cycles in composition rules.
178
+ * A cycle occurs when rule A adds capability X, and rule B (triggered by X) adds
179
+ * a capability that triggers rule A.
180
+ */
181
+ export function detectCompositionCycles(rules) {
182
+ // Build adjacency: for each rule, "when" caps point to "add" caps
183
+ const adj = new Map();
184
+ const allNodes = new Set();
185
+ for (const rule of rules) {
186
+ for (const trigger of rule.when) {
187
+ allNodes.add(trigger);
188
+ if (!adj.has(trigger))
189
+ adj.set(trigger, new Set());
190
+ for (const target of rule.add) {
191
+ allNodes.add(target);
192
+ adj.get(trigger).add(target);
193
+ }
194
+ }
195
+ for (const target of rule.add) {
196
+ allNodes.add(target);
197
+ if (!adj.has(target))
198
+ adj.set(target, new Set());
199
+ }
200
+ }
201
+ // Kahn's algorithm
202
+ const inDegree = new Map();
203
+ for (const node of allNodes) {
204
+ inDegree.set(node, 0);
205
+ }
206
+ for (const [, neighbors] of adj) {
207
+ for (const n of neighbors) {
208
+ inDegree.set(n, (inDegree.get(n) ?? 0) + 1);
209
+ }
210
+ }
211
+ const queue = [];
212
+ for (const [node, degree] of inDegree) {
213
+ if (degree === 0)
214
+ queue.push(node);
215
+ }
216
+ const sorted = [];
217
+ while (queue.length > 0) {
218
+ const node = queue.shift();
219
+ sorted.push(node);
220
+ for (const neighbor of adj.get(node) ?? []) {
221
+ const newDegree = (inDegree.get(neighbor) ?? 1) - 1;
222
+ inDegree.set(neighbor, newDegree);
223
+ if (newDegree === 0)
224
+ queue.push(neighbor);
225
+ }
226
+ }
227
+ if (sorted.length < allNodes.size) {
228
+ const cycleNodes = Array.from(allNodes).filter(n => !sorted.includes(n));
229
+ return { hasCycle: true, cycleNodes };
230
+ }
231
+ return { hasCycle: false, cycleNodes: [] };
232
+ }
233
+ /**
234
+ * Format composition result as a human-readable explanation.
235
+ */
236
+ export function formatCompositionExplanation(result) {
237
+ if (result.firedRules.length === 0) {
238
+ return '';
239
+ }
240
+ const lines = [];
241
+ for (const rule of result.firedRules) {
242
+ lines.push(` Composition rule "${rule.ruleId}" triggered:`);
243
+ lines.push(` added: [${rule.addedCapabilities.join(', ')}]`);
244
+ lines.push(` reason: ${rule.reason}`);
245
+ lines.push(` priority: ${rule.priority}`);
246
+ }
247
+ return lines.join('\n');
248
+ }
249
+ //# sourceMappingURL=composition-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition-engine.js","sourceRoot":"","sources":["../../src/routing/composition-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;G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IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChE,KAAK,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACzC,KAAK,CAAC,IAAI,CAAC,iBAAiB,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,71 @@
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 type { StageName } from './graph-loader.js';
13
+ import type { AgentInput } from './weighted-resolver.js';
14
+ import type { CompositionRule } from './composition-engine.js';
15
+ export interface CapabilityFragment {
16
+ readonly capability: string;
17
+ readonly description?: string;
18
+ readonly owner?: string;
19
+ readonly repos: readonly string[];
20
+ readonly agents: readonly AgentInput[];
21
+ readonly stage?: StageName;
22
+ readonly depends_on?: readonly string[];
23
+ readonly tags?: readonly string[];
24
+ }
25
+ export interface FederatedRootGraph {
26
+ readonly version: string;
27
+ readonly description?: string;
28
+ readonly stages?: readonly StageName[];
29
+ readonly fragments_dir: string;
30
+ readonly compositions?: readonly CompositionRule[];
31
+ readonly overrides?: Readonly<Record<string, FragmentOverride>>;
32
+ }
33
+ export interface FragmentOverride {
34
+ readonly max_agents?: number;
35
+ readonly stage?: StageName;
36
+ }
37
+ export interface FederationResult {
38
+ readonly fragments: readonly CapabilityFragment[];
39
+ readonly root: FederatedRootGraph;
40
+ readonly errors: readonly string[];
41
+ readonly warnings: readonly string[];
42
+ }
43
+ /**
44
+ * Detect whether a parsed graph root uses federated mode (v2.0+).
45
+ * Federated graphs have a `fragments_dir` field instead of `capabilities`.
46
+ */
47
+ export declare function isFederatedGraph(data: Record<string, unknown>): boolean;
48
+ /**
49
+ * Load all capability fragments from the fragments directory.
50
+ * Returns the merged result with fragments, warnings, and errors.
51
+ */
52
+ export declare function loadFragments(rootGraphPath: string, fragmentsDir: string): FederationResult;
53
+ /**
54
+ * Split a monolithic graph into capability fragments.
55
+ * Used by the `graph federate` CLI command.
56
+ *
57
+ * @param graphPath - Path to the monolithic ecosystem.graph.json
58
+ * @param outputDir - Directory to write fragments to
59
+ * @returns Summary of the federation operation
60
+ */
61
+ export declare function federateGraph(graphPath: string, outputDir: string): {
62
+ fragmentsCreated: number;
63
+ rootUpdated: boolean;
64
+ errors: string[];
65
+ };
66
+ /**
67
+ * Convert a capability fragment back to the monolithic format.
68
+ * Used internally by the graph loader to unify fragment and inline formats.
69
+ */
70
+ export declare function fragmentToCapabilityEntry(fragment: CapabilityFragment): Record<string, unknown>;
71
+ //# sourceMappingURL=graph-federation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-federation.d.ts","sourceRoot":"","sources":["../../src/routing/graph-federation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM/D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,C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