@dcyfr/ai 1.0.4 → 2.1.1

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 (411) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/README.md +381 -9
  3. package/dist/ai/agents/agent-loader.d.ts +12 -0
  4. package/dist/ai/agents/agent-loader.d.ts.map +1 -1
  5. package/dist/ai/agents/agent-loader.js +74 -65
  6. package/dist/ai/agents/agent-loader.js.map +1 -1
  7. package/dist/ai/agents/agent-registry.d.ts +2 -0
  8. package/dist/ai/agents/agent-registry.d.ts.map +1 -1
  9. package/dist/ai/agents/agent-registry.js +15 -14
  10. package/dist/ai/agents/agent-registry.js.map +1 -1
  11. package/dist/ai/agents/agent-router.d.ts +20 -5
  12. package/dist/ai/agents/agent-router.d.ts.map +1 -1
  13. package/dist/ai/agents/agent-router.js +89 -43
  14. package/dist/ai/agents/agent-router.js.map +1 -1
  15. package/dist/ai/agents/index.d.ts +6 -1
  16. package/dist/ai/agents/index.d.ts.map +1 -1
  17. package/dist/ai/agents/index.js +9 -3
  18. package/dist/ai/agents/index.js.map +1 -1
  19. package/dist/ai/agents/instruction-template.d.ts +45 -0
  20. package/dist/ai/agents/instruction-template.d.ts.map +1 -0
  21. package/dist/ai/agents/instruction-template.js +197 -0
  22. package/dist/ai/agents/instruction-template.js.map +1 -0
  23. package/dist/ai/agents/persona-resolver.d.ts +90 -0
  24. package/dist/ai/agents/persona-resolver.d.ts.map +1 -0
  25. package/dist/ai/agents/persona-resolver.js +121 -0
  26. package/dist/ai/agents/persona-resolver.js.map +1 -0
  27. package/dist/ai/agents/schema.d.ts +166 -0
  28. package/dist/ai/agents/schema.d.ts.map +1 -0
  29. package/dist/ai/agents/schema.js +94 -0
  30. package/dist/ai/agents/schema.js.map +1 -0
  31. package/dist/ai/agents/types.d.ts +102 -0
  32. package/dist/ai/agents/types.d.ts.map +1 -1
  33. package/dist/ai/agents-builtin/architecture/index.js +3 -3
  34. package/dist/ai/agents-builtin/content/index.js +1 -1
  35. package/dist/ai/agents-builtin/data/index.js +1 -1
  36. package/dist/ai/agents-builtin/development/index.js +4 -4
  37. package/dist/ai/agents-builtin/devops/index.js +1 -1
  38. package/dist/ai/agents-builtin/index.js +33 -33
  39. package/dist/ai/agents-builtin/performance/index.js +1 -1
  40. package/dist/ai/agents-builtin/research/index.js +1 -1
  41. package/dist/ai/agents-builtin/security/index.js +1 -1
  42. package/dist/ai/agents-builtin/testing/index.js +2 -2
  43. package/dist/ai/config/loader.d.ts.map +1 -1
  44. package/dist/ai/config/loader.js +6 -3
  45. package/dist/ai/config/loader.js.map +1 -1
  46. package/dist/ai/config/schema.d.ts +242 -1156
  47. package/dist/ai/config/schema.d.ts.map +1 -1
  48. package/dist/ai/config/schema.js +69 -20
  49. package/dist/ai/config/schema.js.map +1 -1
  50. package/dist/ai/core/provider-registry.d.ts +32 -0
  51. package/dist/ai/core/provider-registry.d.ts.map +1 -1
  52. package/dist/ai/core/provider-registry.js +189 -14
  53. package/dist/ai/core/provider-registry.js.map +1 -1
  54. package/dist/ai/core/telemetry-engine.d.ts +26 -0
  55. package/dist/ai/core/telemetry-engine.d.ts.map +1 -1
  56. package/dist/ai/core/telemetry-engine.js +81 -1
  57. package/dist/ai/core/telemetry-engine.js.map +1 -1
  58. package/dist/ai/delegation/agent-registry.d.ts +143 -0
  59. package/dist/ai/delegation/agent-registry.d.ts.map +1 -0
  60. package/dist/ai/delegation/agent-registry.js +231 -0
  61. package/dist/ai/delegation/agent-registry.js.map +1 -0
  62. package/dist/ai/delegation/blast-radius-tracker.d.ts +65 -0
  63. package/dist/ai/delegation/blast-radius-tracker.d.ts.map +1 -0
  64. package/dist/ai/delegation/blast-radius-tracker.js +81 -0
  65. package/dist/ai/delegation/blast-radius-tracker.js.map +1 -0
  66. package/dist/ai/delegation/capability-bootstrap.d.ts +40 -0
  67. package/dist/ai/delegation/capability-bootstrap.d.ts.map +1 -0
  68. package/dist/ai/delegation/capability-bootstrap.js +431 -0
  69. package/dist/ai/delegation/capability-bootstrap.js.map +1 -0
  70. package/dist/ai/delegation/capability-registry.d.ts +81 -0
  71. package/dist/ai/delegation/capability-registry.d.ts.map +1 -0
  72. package/dist/ai/delegation/capability-registry.js +339 -0
  73. package/dist/ai/delegation/capability-registry.js.map +1 -0
  74. package/dist/ai/delegation/chain-tracker.d.ts +152 -0
  75. package/dist/ai/delegation/chain-tracker.d.ts.map +1 -0
  76. package/dist/ai/delegation/chain-tracker.js +336 -0
  77. package/dist/ai/delegation/chain-tracker.js.map +1 -0
  78. package/dist/ai/delegation/circuit-breaker.d.ts +59 -0
  79. package/dist/ai/delegation/circuit-breaker.d.ts.map +1 -0
  80. package/dist/ai/delegation/circuit-breaker.js +153 -0
  81. package/dist/ai/delegation/circuit-breaker.js.map +1 -0
  82. package/dist/ai/delegation/contract-manager.d.ts +415 -0
  83. package/dist/ai/delegation/contract-manager.d.ts.map +1 -0
  84. package/dist/ai/delegation/contract-manager.js +1258 -0
  85. package/dist/ai/delegation/contract-manager.js.map +1 -0
  86. package/dist/ai/delegation/delegation-manager.d.ts +505 -0
  87. package/dist/ai/delegation/delegation-manager.d.ts.map +1 -0
  88. package/dist/ai/delegation/delegation-manager.js +773 -0
  89. package/dist/ai/delegation/delegation-manager.js.map +1 -0
  90. package/dist/ai/delegation/event-schemas.d.ts +101 -0
  91. package/dist/ai/delegation/event-schemas.d.ts.map +1 -0
  92. package/dist/ai/delegation/event-schemas.js +59 -0
  93. package/dist/ai/delegation/event-schemas.js.map +1 -0
  94. package/dist/ai/delegation/execution-mode-dashboard.d.ts +109 -0
  95. package/dist/ai/delegation/execution-mode-dashboard.d.ts.map +1 -0
  96. package/dist/ai/delegation/execution-mode-dashboard.js +167 -0
  97. package/dist/ai/delegation/execution-mode-dashboard.js.map +1 -0
  98. package/dist/ai/delegation/feature-flags.d.ts +191 -0
  99. package/dist/ai/delegation/feature-flags.d.ts.map +1 -0
  100. package/dist/ai/delegation/feature-flags.js +332 -0
  101. package/dist/ai/delegation/feature-flags.js.map +1 -0
  102. package/dist/ai/delegation/index.d.ts +51 -0
  103. package/dist/ai/delegation/index.d.ts.map +1 -0
  104. package/dist/ai/delegation/index.js +39 -0
  105. package/dist/ai/delegation/index.js.map +1 -0
  106. package/dist/ai/delegation/middleware/chain-depth-middleware.d.ts +39 -0
  107. package/dist/ai/delegation/middleware/chain-depth-middleware.d.ts.map +1 -0
  108. package/dist/ai/delegation/middleware/chain-depth-middleware.js +77 -0
  109. package/dist/ai/delegation/middleware/chain-depth-middleware.js.map +1 -0
  110. package/dist/ai/delegation/middleware/chain-tracker-middleware.d.ts +46 -0
  111. package/dist/ai/delegation/middleware/chain-tracker-middleware.d.ts.map +1 -0
  112. package/dist/ai/delegation/middleware/chain-tracker-middleware.js +89 -0
  113. package/dist/ai/delegation/middleware/chain-tracker-middleware.js.map +1 -0
  114. package/dist/ai/delegation/middleware/content-policy-middleware.d.ts +31 -0
  115. package/dist/ai/delegation/middleware/content-policy-middleware.d.ts.map +1 -0
  116. package/dist/ai/delegation/middleware/content-policy-middleware.js +82 -0
  117. package/dist/ai/delegation/middleware/content-policy-middleware.js.map +1 -0
  118. package/dist/ai/delegation/middleware/feature-flag-middleware.d.ts +46 -0
  119. package/dist/ai/delegation/middleware/feature-flag-middleware.d.ts.map +1 -0
  120. package/dist/ai/delegation/middleware/feature-flag-middleware.js +59 -0
  121. package/dist/ai/delegation/middleware/feature-flag-middleware.js.map +1 -0
  122. package/dist/ai/delegation/middleware/identity-middleware.d.ts +23 -0
  123. package/dist/ai/delegation/middleware/identity-middleware.d.ts.map +1 -0
  124. package/dist/ai/delegation/middleware/identity-middleware.js +64 -0
  125. package/dist/ai/delegation/middleware/identity-middleware.js.map +1 -0
  126. package/dist/ai/delegation/middleware/permissions-middleware.d.ts +48 -0
  127. package/dist/ai/delegation/middleware/permissions-middleware.d.ts.map +1 -0
  128. package/dist/ai/delegation/middleware/permissions-middleware.js +107 -0
  129. package/dist/ai/delegation/middleware/permissions-middleware.js.map +1 -0
  130. package/dist/ai/delegation/middleware/rate-limiter-middleware.d.ts +38 -0
  131. package/dist/ai/delegation/middleware/rate-limiter-middleware.d.ts.map +1 -0
  132. package/dist/ai/delegation/middleware/rate-limiter-middleware.js +65 -0
  133. package/dist/ai/delegation/middleware/rate-limiter-middleware.js.map +1 -0
  134. package/dist/ai/delegation/middleware/reputation-middleware.d.ts +39 -0
  135. package/dist/ai/delegation/middleware/reputation-middleware.d.ts.map +1 -0
  136. package/dist/ai/delegation/middleware/reputation-middleware.js +75 -0
  137. package/dist/ai/delegation/middleware/reputation-middleware.js.map +1 -0
  138. package/dist/ai/delegation/middleware/resource-limiter-middleware.d.ts +52 -0
  139. package/dist/ai/delegation/middleware/resource-limiter-middleware.d.ts.map +1 -0
  140. package/dist/ai/delegation/middleware/resource-limiter-middleware.js +112 -0
  141. package/dist/ai/delegation/middleware/resource-limiter-middleware.js.map +1 -0
  142. package/dist/ai/delegation/middleware/threat-validator-middleware.d.ts +23 -0
  143. package/dist/ai/delegation/middleware/threat-validator-middleware.d.ts.map +1 -0
  144. package/dist/ai/delegation/middleware/threat-validator-middleware.js +83 -0
  145. package/dist/ai/delegation/middleware/threat-validator-middleware.js.map +1 -0
  146. package/dist/ai/delegation/middleware/tlp-middleware.d.ts +23 -0
  147. package/dist/ai/delegation/middleware/tlp-middleware.d.ts.map +1 -0
  148. package/dist/ai/delegation/middleware/tlp-middleware.js +59 -0
  149. package/dist/ai/delegation/middleware/tlp-middleware.js.map +1 -0
  150. package/dist/ai/delegation/monitoring.d.ts +298 -0
  151. package/dist/ai/delegation/monitoring.d.ts.map +1 -0
  152. package/dist/ai/delegation/monitoring.js +584 -0
  153. package/dist/ai/delegation/monitoring.js.map +1 -0
  154. package/dist/ai/delegation/security-middleware-chain.d.ts +71 -0
  155. package/dist/ai/delegation/security-middleware-chain.d.ts.map +1 -0
  156. package/dist/ai/delegation/security-middleware-chain.js +163 -0
  157. package/dist/ai/delegation/security-middleware-chain.js.map +1 -0
  158. package/dist/ai/delegation/session-checkpoint.d.ts +77 -0
  159. package/dist/ai/delegation/session-checkpoint.d.ts.map +1 -0
  160. package/dist/ai/delegation/session-checkpoint.js +131 -0
  161. package/dist/ai/delegation/session-checkpoint.js.map +1 -0
  162. package/dist/ai/delegation/session-manager.d.ts +131 -0
  163. package/dist/ai/delegation/session-manager.d.ts.map +1 -0
  164. package/dist/ai/delegation/session-manager.js +243 -0
  165. package/dist/ai/delegation/session-manager.js.map +1 -0
  166. package/dist/ai/delegation/session-queue.d.ts +95 -0
  167. package/dist/ai/delegation/session-queue.d.ts.map +1 -0
  168. package/dist/ai/delegation/session-queue.js +136 -0
  169. package/dist/ai/delegation/session-queue.js.map +1 -0
  170. package/dist/ai/delegation/timeout-watchdog.d.ts +60 -0
  171. package/dist/ai/delegation/timeout-watchdog.d.ts.map +1 -0
  172. package/dist/ai/delegation/timeout-watchdog.js +100 -0
  173. package/dist/ai/delegation/timeout-watchdog.js.map +1 -0
  174. package/dist/ai/examples/integration-demo.d.ts +27 -0
  175. package/dist/ai/examples/integration-demo.d.ts.map +1 -0
  176. package/dist/ai/examples/integration-demo.js +536 -0
  177. package/dist/ai/examples/integration-demo.js.map +1 -0
  178. package/dist/ai/index.d.ts +25 -0
  179. package/dist/ai/index.d.ts.map +1 -1
  180. package/dist/ai/index.js +34 -11
  181. package/dist/ai/index.js.map +1 -1
  182. package/dist/ai/mcp/servers/analytics/index.js +67 -11
  183. package/dist/ai/mcp/servers/analytics/index.js.map +1 -1
  184. package/dist/ai/mcp/servers/content-manager/index.d.ts.map +1 -1
  185. package/dist/ai/mcp/servers/content-manager/index.js +50 -4
  186. package/dist/ai/mcp/servers/content-manager/index.js.map +1 -1
  187. package/dist/ai/mcp/servers/delegation-monitor/index.d.ts +36 -0
  188. package/dist/ai/mcp/servers/delegation-monitor/index.d.ts.map +1 -0
  189. package/dist/ai/mcp/servers/delegation-monitor/index.js +757 -0
  190. package/dist/ai/mcp/servers/delegation-monitor/index.js.map +1 -0
  191. package/dist/ai/mcp/servers/design-tokens/index.d.ts.map +1 -1
  192. package/dist/ai/mcp/servers/design-tokens/index.js +62 -39
  193. package/dist/ai/mcp/servers/design-tokens/index.js.map +1 -1
  194. package/dist/ai/mcp/servers/promptintel/index.js +15 -3
  195. package/dist/ai/mcp/servers/promptintel/index.js.map +1 -1
  196. package/dist/ai/mcp/servers/shared/rate-limiter.d.ts.map +1 -1
  197. package/dist/ai/mcp/servers/shared/rate-limiter.js +3 -1
  198. package/dist/ai/mcp/servers/shared/rate-limiter.js.map +1 -1
  199. package/dist/ai/mcp/servers/shared/redis-client.d.ts.map +1 -1
  200. package/dist/ai/mcp/servers/shared/redis-client.js +54 -47
  201. package/dist/ai/mcp/servers/shared/redis-client.js.map +1 -1
  202. package/dist/ai/mcp/servers/shared/types.d.ts +9 -0
  203. package/dist/ai/mcp/servers/shared/types.d.ts.map +1 -1
  204. package/dist/ai/mcp/servers/shared/utils.d.ts +9 -1
  205. package/dist/ai/mcp/servers/shared/utils.d.ts.map +1 -1
  206. package/dist/ai/mcp/servers/shared/utils.js +52 -2
  207. package/dist/ai/mcp/servers/shared/utils.js.map +1 -1
  208. package/dist/ai/memory/config.d.ts +18 -3
  209. package/dist/ai/memory/config.d.ts.map +1 -1
  210. package/dist/ai/memory/config.js +61 -15
  211. package/dist/ai/memory/config.js.map +1 -1
  212. package/dist/ai/memory/dcyfr-memory.d.ts +4 -0
  213. package/dist/ai/memory/dcyfr-memory.d.ts.map +1 -1
  214. package/dist/ai/memory/dcyfr-memory.js +44 -6
  215. package/dist/ai/memory/dcyfr-memory.js.map +1 -1
  216. package/dist/ai/memory/mem0-client.d.ts.map +1 -1
  217. package/dist/ai/memory/mem0-client.js +53 -14
  218. package/dist/ai/memory/mem0-client.js.map +1 -1
  219. package/dist/ai/permissions/attenuation-engine.d.ts +159 -0
  220. package/dist/ai/permissions/attenuation-engine.d.ts.map +1 -0
  221. package/dist/ai/permissions/attenuation-engine.js +511 -0
  222. package/dist/ai/permissions/attenuation-engine.js.map +1 -0
  223. package/dist/ai/plugins/plugin-loader.d.ts +4 -0
  224. package/dist/ai/plugins/plugin-loader.d.ts.map +1 -1
  225. package/dist/ai/plugins/plugin-loader.js +28 -28
  226. package/dist/ai/plugins/plugin-loader.js.map +1 -1
  227. package/dist/ai/reputation/execution-mode-reputation.d.ts +104 -0
  228. package/dist/ai/reputation/execution-mode-reputation.d.ts.map +1 -0
  229. package/dist/ai/reputation/execution-mode-reputation.js +142 -0
  230. package/dist/ai/reputation/execution-mode-reputation.js.map +1 -0
  231. package/dist/ai/reputation/reputation-engine.d.ts +204 -0
  232. package/dist/ai/reputation/reputation-engine.d.ts.map +1 -0
  233. package/dist/ai/reputation/reputation-engine.js +426 -0
  234. package/dist/ai/reputation/reputation-engine.js.map +1 -0
  235. package/dist/ai/runtime/agent-runtime.d.ts +193 -0
  236. package/dist/ai/runtime/agent-runtime.d.ts.map +1 -0
  237. package/dist/ai/runtime/agent-runtime.js +1009 -0
  238. package/dist/ai/runtime/agent-runtime.js.map +1 -0
  239. package/dist/ai/runtime/index.d.ts +11 -0
  240. package/dist/ai/runtime/index.d.ts.map +1 -0
  241. package/dist/ai/runtime/index.js +9 -0
  242. package/dist/ai/runtime/index.js.map +1 -0
  243. package/dist/ai/runtime/telemetry-schema.d.ts +192 -0
  244. package/dist/ai/runtime/telemetry-schema.d.ts.map +1 -0
  245. package/dist/ai/runtime/telemetry-schema.js +200 -0
  246. package/dist/ai/runtime/telemetry-schema.js.map +1 -0
  247. package/dist/ai/runtime/types.d.ts +236 -0
  248. package/dist/ai/runtime/types.d.ts.map +1 -0
  249. package/dist/ai/runtime/types.js +10 -0
  250. package/dist/ai/runtime/types.js.map +1 -0
  251. package/dist/ai/src/batch-processor.d.ts +298 -0
  252. package/dist/ai/src/batch-processor.d.ts.map +1 -0
  253. package/dist/ai/src/batch-processor.js +520 -0
  254. package/dist/ai/src/batch-processor.js.map +1 -0
  255. package/dist/ai/src/capability-bootstrap.d.ts +222 -0
  256. package/dist/ai/src/capability-bootstrap.d.ts.map +1 -0
  257. package/dist/ai/src/capability-bootstrap.js +421 -0
  258. package/dist/ai/src/capability-bootstrap.js.map +1 -0
  259. package/dist/ai/src/capability-manifest-generator.d.ts +61 -0
  260. package/dist/ai/src/capability-manifest-generator.d.ts.map +1 -0
  261. package/dist/ai/src/capability-manifest-generator.js +700 -0
  262. package/dist/ai/src/capability-manifest-generator.js.map +1 -0
  263. package/dist/ai/src/capability-registry.d.ts +157 -0
  264. package/dist/ai/src/capability-registry.d.ts.map +1 -0
  265. package/dist/ai/src/capability-registry.js +577 -0
  266. package/dist/ai/src/capability-registry.js.map +1 -0
  267. package/dist/ai/src/cli/telemetry-dashboard.d.ts +132 -0
  268. package/dist/ai/src/cli/telemetry-dashboard.d.ts.map +1 -0
  269. package/dist/ai/src/cli/telemetry-dashboard.js +565 -0
  270. package/dist/ai/src/cli/telemetry-dashboard.js.map +1 -0
  271. package/dist/ai/src/delegation/feature-flags.d.ts +213 -0
  272. package/dist/ai/src/delegation/feature-flags.d.ts.map +1 -0
  273. package/dist/ai/src/delegation/feature-flags.js +395 -0
  274. package/dist/ai/src/delegation/feature-flags.js.map +1 -0
  275. package/dist/ai/src/delegation/liability-firebreak.d.ts +303 -0
  276. package/dist/ai/src/delegation/liability-firebreak.d.ts.map +1 -0
  277. package/dist/ai/src/delegation/liability-firebreak.js +643 -0
  278. package/dist/ai/src/delegation/liability-firebreak.js.map +1 -0
  279. package/dist/ai/src/delegation/security-threat-model.d.ts +171 -0
  280. package/dist/ai/src/delegation/security-threat-model.d.ts.map +1 -0
  281. package/dist/ai/src/delegation/security-threat-model.js +723 -0
  282. package/dist/ai/src/delegation/security-threat-model.js.map +1 -0
  283. package/dist/ai/src/delegation/tlp-enforcement.d.ts +146 -0
  284. package/dist/ai/src/delegation/tlp-enforcement.d.ts.map +1 -0
  285. package/dist/ai/src/delegation/tlp-enforcement.js +382 -0
  286. package/dist/ai/src/delegation/tlp-enforcement.js.map +1 -0
  287. package/dist/ai/src/delegation-capability-integration.d.ts +154 -0
  288. package/dist/ai/src/delegation-capability-integration.d.ts.map +1 -0
  289. package/dist/ai/src/delegation-capability-integration.js +351 -0
  290. package/dist/ai/src/delegation-capability-integration.js.map +1 -0
  291. package/dist/ai/src/end-to-end-workflow-orchestrator.d.ts +325 -0
  292. package/dist/ai/src/end-to-end-workflow-orchestrator.d.ts.map +1 -0
  293. package/dist/ai/src/end-to-end-workflow-orchestrator.js +801 -0
  294. package/dist/ai/src/end-to-end-workflow-orchestrator.js.map +1 -0
  295. package/dist/ai/src/enhanced-capability-detection.d.ts +237 -0
  296. package/dist/ai/src/enhanced-capability-detection.d.ts.map +1 -0
  297. package/dist/ai/src/enhanced-capability-detection.js +448 -0
  298. package/dist/ai/src/enhanced-capability-detection.js.map +1 -0
  299. package/dist/ai/src/intelligent-cache-manager.d.ts +327 -0
  300. package/dist/ai/src/intelligent-cache-manager.d.ts.map +1 -0
  301. package/dist/ai/src/intelligent-cache-manager.js +634 -0
  302. package/dist/ai/src/intelligent-cache-manager.js.map +1 -0
  303. package/dist/ai/src/mcp-auto-configuration.d.ts +232 -0
  304. package/dist/ai/src/mcp-auto-configuration.d.ts.map +1 -0
  305. package/dist/ai/src/mcp-auto-configuration.js +445 -0
  306. package/dist/ai/src/mcp-auto-configuration.js.map +1 -0
  307. package/dist/ai/src/performance-profiler.d.ts +351 -0
  308. package/dist/ai/src/performance-profiler.d.ts.map +1 -0
  309. package/dist/ai/src/performance-profiler.js +475 -0
  310. package/dist/ai/src/performance-profiler.js.map +1 -0
  311. package/dist/ai/src/personas/hooks/before-llm-call.d.ts +96 -0
  312. package/dist/ai/src/personas/hooks/before-llm-call.d.ts.map +1 -0
  313. package/dist/ai/src/personas/hooks/before-llm-call.js +83 -0
  314. package/dist/ai/src/personas/hooks/before-llm-call.js.map +1 -0
  315. package/dist/ai/src/personas/index.d.ts +10 -0
  316. package/dist/ai/src/personas/index.d.ts.map +1 -0
  317. package/dist/ai/src/personas/index.js +10 -0
  318. package/dist/ai/src/personas/index.js.map +1 -0
  319. package/dist/ai/src/personas/persona-loader.d.ts +42 -0
  320. package/dist/ai/src/personas/persona-loader.d.ts.map +1 -0
  321. package/dist/ai/src/personas/persona-loader.js +162 -0
  322. package/dist/ai/src/personas/persona-loader.js.map +1 -0
  323. package/dist/ai/src/personas/types.d.ts +199 -0
  324. package/dist/ai/src/personas/types.d.ts.map +1 -0
  325. package/dist/ai/src/personas/types.js +7 -0
  326. package/dist/ai/src/personas/types.js.map +1 -0
  327. package/dist/ai/src/personas/voice-resolver.d.ts +40 -0
  328. package/dist/ai/src/personas/voice-resolver.d.ts.map +1 -0
  329. package/dist/ai/src/personas/voice-resolver.js +201 -0
  330. package/dist/ai/src/personas/voice-resolver.js.map +1 -0
  331. package/dist/ai/src/resource-monitor.d.ts +311 -0
  332. package/dist/ai/src/resource-monitor.d.ts.map +1 -0
  333. package/dist/ai/src/resource-monitor.js +475 -0
  334. package/dist/ai/src/resource-monitor.js.map +1 -0
  335. package/dist/ai/src/runtime/agent-runtime.d.ts +340 -0
  336. package/dist/ai/src/runtime/agent-runtime.d.ts.map +1 -0
  337. package/dist/ai/src/runtime/agent-runtime.js +1084 -0
  338. package/dist/ai/src/runtime/agent-runtime.js.map +1 -0
  339. package/dist/ai/src/telemetry/delegation-telemetry.d.ts +287 -0
  340. package/dist/ai/src/telemetry/delegation-telemetry.d.ts.map +1 -0
  341. package/dist/ai/src/telemetry/delegation-telemetry.js +389 -0
  342. package/dist/ai/src/telemetry/delegation-telemetry.js.map +1 -0
  343. package/dist/ai/src/telemetry/index.d.ts +48 -0
  344. package/dist/ai/src/telemetry/index.d.ts.map +1 -0
  345. package/dist/ai/src/telemetry/index.js +48 -0
  346. package/dist/ai/src/telemetry/index.js.map +1 -0
  347. package/dist/ai/src/telemetry/runtime-telemetry-integration.d.ts +67 -0
  348. package/dist/ai/src/telemetry/runtime-telemetry-integration.d.ts.map +1 -0
  349. package/dist/ai/src/telemetry/runtime-telemetry-integration.js +415 -0
  350. package/dist/ai/src/telemetry/runtime-telemetry-integration.js.map +1 -0
  351. package/dist/ai/src/telemetry/telemetry-utils.d.ts +119 -0
  352. package/dist/ai/src/telemetry/telemetry-utils.d.ts.map +1 -0
  353. package/dist/ai/src/telemetry/telemetry-utils.js +250 -0
  354. package/dist/ai/src/telemetry/telemetry-utils.js.map +1 -0
  355. package/dist/ai/src/types/agent-capabilities.d.ts +227 -0
  356. package/dist/ai/src/types/agent-capabilities.d.ts.map +1 -0
  357. package/dist/ai/src/types/agent-capabilities.js +11 -0
  358. package/dist/ai/src/types/agent-capabilities.js.map +1 -0
  359. package/dist/ai/src/types/context-verification.d.ts +158 -0
  360. package/dist/ai/src/types/context-verification.d.ts.map +1 -0
  361. package/dist/ai/src/types/context-verification.js +73 -0
  362. package/dist/ai/src/types/context-verification.js.map +1 -0
  363. package/dist/ai/src/types/delegation-contracts.d.ts +296 -0
  364. package/dist/ai/src/types/delegation-contracts.d.ts.map +1 -0
  365. package/dist/ai/src/types/delegation-contracts.js +17 -0
  366. package/dist/ai/src/types/delegation-contracts.js.map +1 -0
  367. package/dist/ai/src/validation-pipeline-integration.d.ts +266 -0
  368. package/dist/ai/src/validation-pipeline-integration.d.ts.map +1 -0
  369. package/dist/ai/src/validation-pipeline-integration.js +695 -0
  370. package/dist/ai/src/validation-pipeline-integration.js.map +1 -0
  371. package/dist/ai/src/verification/multi-modal-formatters.d.ts +57 -0
  372. package/dist/ai/src/verification/multi-modal-formatters.d.ts.map +1 -0
  373. package/dist/ai/src/verification/multi-modal-formatters.js +655 -0
  374. package/dist/ai/src/verification/multi-modal-formatters.js.map +1 -0
  375. package/dist/ai/src/verification/output-formatter.d.ts +186 -0
  376. package/dist/ai/src/verification/output-formatter.d.ts.map +1 -0
  377. package/dist/ai/src/verification/output-formatter.js +296 -0
  378. package/dist/ai/src/verification/output-formatter.js.map +1 -0
  379. package/dist/ai/src/verification/parser-integration.d.ts +137 -0
  380. package/dist/ai/src/verification/parser-integration.d.ts.map +1 -0
  381. package/dist/ai/src/verification/parser-integration.js +273 -0
  382. package/dist/ai/src/verification/parser-integration.js.map +1 -0
  383. package/dist/ai/types/agent-capabilities.d.ts +387 -0
  384. package/dist/ai/types/agent-capabilities.d.ts.map +1 -0
  385. package/dist/ai/types/agent-capabilities.js +32 -0
  386. package/dist/ai/types/agent-capabilities.js.map +1 -0
  387. package/dist/ai/types/delegation-contracts.d.ts +291 -0
  388. package/dist/ai/types/delegation-contracts.d.ts.map +1 -0
  389. package/dist/ai/types/delegation-contracts.js +14 -0
  390. package/dist/ai/types/delegation-contracts.js.map +1 -0
  391. package/dist/ai/types/index.d.ts +4 -1
  392. package/dist/ai/types/index.d.ts.map +1 -1
  393. package/dist/ai/types/index.js +4 -1
  394. package/dist/ai/types/index.js.map +1 -1
  395. package/dist/ai/types/permission-tokens.d.ts +365 -0
  396. package/dist/ai/types/permission-tokens.d.ts.map +1 -0
  397. package/dist/ai/types/permission-tokens.js +13 -0
  398. package/dist/ai/types/permission-tokens.js.map +1 -0
  399. package/dist/ai/types/security-middleware.d.ts +130 -0
  400. package/dist/ai/types/security-middleware.d.ts.map +1 -0
  401. package/dist/ai/types/security-middleware.js +13 -0
  402. package/dist/ai/types/security-middleware.js.map +1 -0
  403. package/dist/ai/utils/storage.d.ts.map +1 -1
  404. package/dist/ai/utils/storage.js +6 -3
  405. package/dist/ai/utils/storage.js.map +1 -1
  406. package/dist/ai/validation/validation-framework.js +1 -1
  407. package/dist/ai/verification/policy-framework.d.ts +161 -0
  408. package/dist/ai/verification/policy-framework.d.ts.map +1 -0
  409. package/dist/ai/verification/policy-framework.js +436 -0
  410. package/dist/ai/verification/policy-framework.js.map +1 -0
  411. package/package.json +36 -8
@@ -0,0 +1,232 @@
1
+ /**
2
+ * MCP Auto-Configuration System
3
+ * TLP:CLEAR
4
+ *
5
+ * Automatically configures MCP servers based on detected agent capabilities
6
+ * and workspace requirements. Provides intelligent MCP server selection and
7
+ * lifecycle management for optimal agent performance.
8
+ *
9
+ * @version 1.0.0
10
+ * @date 2026-02-14
11
+ * @module dcyfr-ai/mcp/auto-configuration
12
+ */
13
+ import { EventEmitter } from 'events';
14
+ import type { MCPServerConfig, MCPServerManifest, MCPServerStatus } from '../mcp/types.js';
15
+ import type { AgentCapabilityManifest } from './types/agent-capabilities.js';
16
+ /**
17
+ * MCP server capability mapping
18
+ */
19
+ export interface MCPCapabilityMapping {
20
+ /**
21
+ * Server name/identifier
22
+ */
23
+ serverName: string;
24
+ /**
25
+ * Capabilities that trigger this server's inclusion
26
+ */
27
+ requiredCapabilities: string[];
28
+ /**
29
+ * Optional capabilities that benefit from this server
30
+ */
31
+ optionalCapabilities?: string[];
32
+ /**
33
+ * Minimum number of agents needing this server to auto-configure
34
+ */
35
+ minAgentThreshold?: number;
36
+ /**
37
+ * Server priority (1-10, higher = more important)
38
+ */
39
+ priority: number;
40
+ /**
41
+ * Configuration template for this server
42
+ */
43
+ configTemplate: MCPServerConfig;
44
+ /**
45
+ * Custom environment variables based on workspace detection
46
+ */
47
+ dynamicEnv?: (workspace: string) => Record<string, string>;
48
+ }
49
+ /**
50
+ * Auto-configuration system configuration
51
+ */
52
+ export interface MCPAutoConfigOptions {
53
+ /**
54
+ * Workspace root path for configuration generation
55
+ */
56
+ workspaceRoot: string;
57
+ /**
58
+ * Enable automatic server startup
59
+ */
60
+ autoStartServers?: boolean;
61
+ /**
62
+ * Enable server health monitoring
63
+ */
64
+ healthMonitoring?: boolean;
65
+ /**
66
+ * Custom capability mappings to extend defaults
67
+ */
68
+ customMappings?: MCPCapabilityMapping[];
69
+ /**
70
+ * Minimum agent threshold for auto-configuration
71
+ */
72
+ globalMinThreshold?: number;
73
+ /**
74
+ * Configuration file output path
75
+ */
76
+ configOutputPath?: string;
77
+ }
78
+ /**
79
+ * Configuration generation result
80
+ */
81
+ export interface ConfigGenerationResult {
82
+ /**
83
+ * Generated MCP servers
84
+ */
85
+ servers: ConfiguredMCPServer[];
86
+ /**
87
+ * Configuration written to file
88
+ */
89
+ configFilePath?: string;
90
+ /**
91
+ * Servers that were started
92
+ */
93
+ startedServers: string[];
94
+ /**
95
+ * Configuration warnings
96
+ */
97
+ warnings: string[];
98
+ /**
99
+ * Server recommendation explanations
100
+ */
101
+ recommendations: ServerRecommendation[];
102
+ }
103
+ /**
104
+ * Configured MCP server
105
+ */
106
+ export interface ConfiguredMCPServer {
107
+ /**
108
+ * Server configuration
109
+ */
110
+ config: MCPServerConfig;
111
+ /**
112
+ * Reason for inclusion
113
+ */
114
+ reason: string;
115
+ /**
116
+ * Number of agents benefiting from this server
117
+ */
118
+ benefitingAgents: number;
119
+ /**
120
+ * Related capability IDs
121
+ */
122
+ relatedCapabilities: string[];
123
+ }
124
+ /**
125
+ * Server recommendation
126
+ */
127
+ export interface ServerRecommendation {
128
+ /**
129
+ * Server name
130
+ */
131
+ serverName: string;
132
+ /**
133
+ * Recommendation type
134
+ */
135
+ type: 'required' | 'recommended' | 'optional';
136
+ /**
137
+ * Explanation
138
+ */
139
+ explanation: string;
140
+ /**
141
+ * Affected agent count
142
+ */
143
+ affectedAgents: number;
144
+ }
145
+ /**
146
+ * MCP Server Auto-Configuration System
147
+ *
148
+ * Analyzes agent capabilities and automatically configures appropriate
149
+ * MCP servers to support agent operations efficiently.
150
+ */
151
+ export declare class MCPAutoConfiguration extends EventEmitter {
152
+ private registry;
153
+ private options;
154
+ private capabilityMappings;
155
+ private registeredAgents;
156
+ constructor(options: MCPAutoConfigOptions);
157
+ /**
158
+ * Default capability to MCP server mappings
159
+ */
160
+ private getDefaultCapabilityMappings;
161
+ /**
162
+ * Setup event handlers
163
+ */
164
+ private setupEventHandlers;
165
+ /**
166
+ * Register agent for auto-configuration analysis
167
+ */
168
+ registerAgent(manifest: AgentCapabilityManifest): Promise<void>;
169
+ /**
170
+ * Unregister agent
171
+ */
172
+ unregisterAgent(agentId: string): Promise<void>;
173
+ /**
174
+ * Analyze current agents and generate MCP server configuration
175
+ */
176
+ generateConfiguration(): Promise<ConfigGenerationResult>;
177
+ /**
178
+ * Reconfigure servers based on current agent set
179
+ */
180
+ reconfigureServers(): Promise<ConfigGenerationResult>;
181
+ /**
182
+ * Analyze agent capabilities and count usage
183
+ */
184
+ private analyzeCapabilities;
185
+ /**
186
+ * Determine which servers are required based on capability analysis
187
+ */
188
+ private determineRequiredServers;
189
+ /**
190
+ * Configure servers with dynamic environment and workspace-specific settings
191
+ */
192
+ private configureServers;
193
+ /**
194
+ * Generate human-readable reason for server inclusion
195
+ */
196
+ private generateServerReason;
197
+ /**
198
+ * Count agents that would benefit from this server
199
+ */
200
+ private countBenefitingAgents;
201
+ /**
202
+ * Generate configuration recommendations
203
+ */
204
+ private generateRecommendations;
205
+ /**
206
+ * Write configuration to file
207
+ */
208
+ private writeConfigurationFile;
209
+ /**
210
+ * Get current server status
211
+ */
212
+ getServerStatus(): Promise<Array<{
213
+ name: string;
214
+ status: MCPServerStatus;
215
+ config: MCPServerConfig;
216
+ manifest?: MCPServerManifest;
217
+ }>>;
218
+ /**
219
+ * Health check all configured servers
220
+ */
221
+ healthCheckServers(): Promise<Map<string, boolean>>;
222
+ /**
223
+ * Cleanup and shutdown
224
+ */
225
+ shutdown(): Promise<void>;
226
+ }
227
+ /**
228
+ * Factory function for creating auto-configuration system
229
+ */
230
+ export declare function createMCPAutoConfiguration(options: MCPAutoConfigOptions): MCPAutoConfiguration;
231
+ export default MCPAutoConfiguration;
232
+ //# sourceMappingURL=mcp-auto-configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-auto-configuration.d.ts","sourceRoot":"","sources":["../../../packages/ai/src/mcp-auto-configuration.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,445 @@
1
+ /**
2
+ * MCP Auto-Configuration System
3
+ * TLP:CLEAR
4
+ *
5
+ * Automatically configures MCP servers based on detected agent capabilities
6
+ * and workspace requirements. Provides intelligent MCP server selection and
7
+ * lifecycle management for optimal agent performance.
8
+ *
9
+ * @version 1.0.0
10
+ * @date 2026-02-14
11
+ * @module dcyfr-ai/mcp/auto-configuration
12
+ */
13
+ import { EventEmitter } from 'events';
14
+ import { MCPRegistry } from '../mcp/mcp-registry.js';
15
+ /**
16
+ * MCP Server Auto-Configuration System
17
+ *
18
+ * Analyzes agent capabilities and automatically configures appropriate
19
+ * MCP servers to support agent operations efficiently.
20
+ */
21
+ export class MCPAutoConfiguration extends EventEmitter {
22
+ registry;
23
+ options;
24
+ capabilityMappings;
25
+ registeredAgents = new Map();
26
+ constructor(options) {
27
+ super();
28
+ this.options = {
29
+ autoStartServers: true,
30
+ healthMonitoring: true,
31
+ globalMinThreshold: 1,
32
+ configOutputPath: '.mcp.json',
33
+ ...options,
34
+ };
35
+ this.registry = new MCPRegistry({
36
+ autoDiscover: false,
37
+ healthMonitoring: this.options.healthMonitoring,
38
+ });
39
+ this.capabilityMappings = this.getDefaultCapabilityMappings();
40
+ if (this.options.customMappings) {
41
+ this.capabilityMappings.push(...this.options.customMappings);
42
+ }
43
+ this.setupEventHandlers();
44
+ }
45
+ /**
46
+ * Default capability to MCP server mappings
47
+ */
48
+ getDefaultCapabilityMappings() {
49
+ return [
50
+ {
51
+ serverName: 'dcyfr-designtokens',
52
+ requiredCapabilities: ['design_token_compliance', 'pattern_enforcement'],
53
+ optionalCapabilities: ['ui_component_generation'],
54
+ minAgentThreshold: 1,
55
+ priority: 9,
56
+ configTemplate: {
57
+ name: 'dcyfr-designtokens',
58
+ description: 'DCYFR Design Token validation and enforcement',
59
+ transport: 'stdio',
60
+ command: 'npx',
61
+ args: ['@dcyfr/ai', 'mcp:tokens'],
62
+ enabled: true,
63
+ tier: 'project',
64
+ tags: ['design', 'tokens', 'validation'],
65
+ },
66
+ dynamicEnv: (workspace) => ({
67
+ DCYFR_WORKSPACE_ROOT: workspace,
68
+ DCYFR_DESIGN_TOKENS_PATH: `${workspace}/src/lib/design-tokens.ts`,
69
+ }),
70
+ },
71
+ {
72
+ serverName: 'dcyfr-analytics',
73
+ requiredCapabilities: ['performance_monitoring', 'telemetry_tracking'],
74
+ optionalCapabilities: ['user_behavior_analysis'],
75
+ minAgentThreshold: 2,
76
+ priority: 7,
77
+ configTemplate: {
78
+ name: 'dcyfr-analytics',
79
+ description: 'DCYFR Analytics and performance monitoring',
80
+ transport: 'stdio',
81
+ command: 'npx',
82
+ args: ['@dcyfr/ai', 'mcp:analytics'],
83
+ enabled: true,
84
+ tier: 'project',
85
+ tags: ['analytics', 'performance', 'monitoring'],
86
+ },
87
+ dynamicEnv: (workspace) => ({
88
+ DCYFR_WORKSPACE_ROOT: workspace,
89
+ REDIS_URL: process.env.REDIS_URL || 'redis://localhost:6379',
90
+ }),
91
+ },
92
+ {
93
+ serverName: 'dcyfr-contentmanager',
94
+ requiredCapabilities: ['content_management', 'blog_post_creation'],
95
+ optionalCapabilities: ['seo_optimization', 'markdown_processing'],
96
+ minAgentThreshold: 1,
97
+ priority: 8,
98
+ configTemplate: {
99
+ name: 'dcyfr-contentmanager',
100
+ description: 'DCYFR Content management for blog and documentation',
101
+ transport: 'stdio',
102
+ command: 'npx',
103
+ args: ['@dcyfr/ai', 'mcp:content'],
104
+ enabled: true,
105
+ tier: 'project',
106
+ tags: ['content', 'blog', 'mdx'],
107
+ },
108
+ dynamicEnv: (workspace) => ({
109
+ DCYFR_WORKSPACE_ROOT: workspace,
110
+ DCYFR_CONTENT_DIR: `${workspace}/src/content`,
111
+ }),
112
+ },
113
+ {
114
+ serverName: 'dcyfr-promptintel',
115
+ requiredCapabilities: ['security_scanning', 'threat_detection'],
116
+ optionalCapabilities: ['prompt_injection_prevention'],
117
+ minAgentThreshold: 1,
118
+ priority: 10,
119
+ configTemplate: {
120
+ name: 'dcyfr-promptintel',
121
+ description: 'DCYFR AI threat intelligence and prompt security',
122
+ transport: 'stdio',
123
+ command: 'npx',
124
+ args: ['@dcyfr/ai', 'mcp:promptintel'],
125
+ enabled: true,
126
+ tier: 'private',
127
+ tags: ['security', 'ai-safety', 'threats'],
128
+ },
129
+ dynamicEnv: (workspace) => ({
130
+ DCYFR_WORKSPACE_ROOT: workspace,
131
+ DCYFR_SECURITY_LEVEL: 'HIGH',
132
+ }),
133
+ },
134
+ {
135
+ serverName: 'dcyfr-delegation',
136
+ requiredCapabilities: ['task_delegation', 'workflow_orchestration'],
137
+ optionalCapabilities: ['agent_coordination'],
138
+ minAgentThreshold: 3,
139
+ priority: 6,
140
+ configTemplate: {
141
+ name: 'dcyfr-delegation',
142
+ description: 'DCYFR Delegation monitoring and coordination',
143
+ transport: 'stdio',
144
+ command: 'npx',
145
+ args: ['@dcyfr/ai', 'mcp:delegation'],
146
+ enabled: true,
147
+ tier: 'private',
148
+ tags: ['delegation', 'coordination', 'workflow'],
149
+ },
150
+ dynamicEnv: (workspace) => ({
151
+ DCYFR_WORKSPACE_ROOT: workspace,
152
+ DCYFR_DELEGATION_MAX_DEPTH: '10',
153
+ }),
154
+ },
155
+ // Standard MCP servers for common capabilities
156
+ {
157
+ serverName: 'playwright',
158
+ requiredCapabilities: ['browser_automation', 'e2e_testing'],
159
+ optionalCapabilities: ['web_scraping', 'ui_testing'],
160
+ minAgentThreshold: 1,
161
+ priority: 5,
162
+ configTemplate: {
163
+ name: 'playwright',
164
+ description: 'Browser automation and testing',
165
+ transport: 'stdio',
166
+ command: 'npx',
167
+ args: ['-y', '@executeautomation/playwright-mcp-server'],
168
+ enabled: true,
169
+ tier: 'public',
170
+ tags: ['browser', 'testing', 'automation'],
171
+ },
172
+ },
173
+ {
174
+ serverName: 'filesystem',
175
+ requiredCapabilities: ['file_operations', 'directory_management'],
176
+ optionalCapabilities: ['code_generation', 'template_processing'],
177
+ minAgentThreshold: 1,
178
+ priority: 4,
179
+ configTemplate: {
180
+ name: 'filesystem',
181
+ description: 'File system operations',
182
+ transport: 'stdio',
183
+ command: 'npx',
184
+ args: ['-y', '@modelcontextprotocol/server-filesystem'],
185
+ enabled: true,
186
+ tier: 'public',
187
+ tags: ['filesystem', 'files', 'storage'],
188
+ },
189
+ dynamicEnv: (workspace) => ({
190
+ ALLOWED_DIRECTORIES: workspace,
191
+ }),
192
+ },
193
+ ];
194
+ }
195
+ /**
196
+ * Setup event handlers
197
+ */
198
+ setupEventHandlers() {
199
+ // Event handlers would be configured if MCPRegistry supported events
200
+ // Currently MCPRegistry doesn't extend EventEmitter
201
+ }
202
+ /**
203
+ * Register agent for auto-configuration analysis
204
+ */
205
+ async registerAgent(manifest) {
206
+ this.registeredAgents.set(manifest.agent_id, manifest);
207
+ this.emit('agent_registered', { agentId: manifest.agent_id });
208
+ // Auto-reconfigure if enabled
209
+ if (this.options.autoStartServers) {
210
+ await this.reconfigureServers();
211
+ }
212
+ }
213
+ /**
214
+ * Unregister agent
215
+ */
216
+ async unregisterAgent(agentId) {
217
+ this.registeredAgents.delete(agentId);
218
+ this.emit('agent_unregistered', { agentId });
219
+ // Auto-reconfigure to potentially remove unused servers
220
+ if (this.options.autoStartServers) {
221
+ await this.reconfigureServers();
222
+ }
223
+ }
224
+ /**
225
+ * Analyze current agents and generate MCP server configuration
226
+ */
227
+ async generateConfiguration() {
228
+ const capabilityCount = this.analyzeCapabilities();
229
+ const requiredServers = this.determineRequiredServers(capabilityCount);
230
+ const configuredServers = this.configureServers(requiredServers);
231
+ const result = {
232
+ servers: configuredServers,
233
+ startedServers: [],
234
+ warnings: [],
235
+ recommendations: this.generateRecommendations(capabilityCount, requiredServers),
236
+ };
237
+ // Write configuration file if specified
238
+ if (this.options.configOutputPath) {
239
+ await this.writeConfigurationFile(configuredServers, this.options.configOutputPath);
240
+ result.configFilePath = this.options.configOutputPath;
241
+ }
242
+ // Start servers if auto-start is enabled
243
+ if (this.options.autoStartServers) {
244
+ for (const server of configuredServers) {
245
+ try {
246
+ await this.registry.registerServer(server.config);
247
+ result.startedServers.push(server.config.name);
248
+ }
249
+ catch (error) {
250
+ result.warnings.push(`Failed to start server ${server.config.name}: ${error.message}`);
251
+ }
252
+ }
253
+ }
254
+ this.emit('configuration_generated', result);
255
+ return result;
256
+ }
257
+ /**
258
+ * Reconfigure servers based on current agent set
259
+ */
260
+ async reconfigureServers() {
261
+ return this.generateConfiguration();
262
+ }
263
+ /**
264
+ * Analyze agent capabilities and count usage
265
+ */
266
+ analyzeCapabilities() {
267
+ const capabilityCount = new Map();
268
+ for (const manifest of this.registeredAgents.values()) {
269
+ for (const capability of manifest.capabilities) {
270
+ capabilityCount.set(capability.capability_id, (capabilityCount.get(capability.capability_id) || 0) + 1);
271
+ }
272
+ }
273
+ return capabilityCount;
274
+ }
275
+ /**
276
+ * Determine which servers are required based on capability analysis
277
+ */
278
+ determineRequiredServers(capabilityCount) {
279
+ const requiredServers = [];
280
+ for (const mapping of this.capabilityMappings) {
281
+ const requiredCapCount = mapping.requiredCapabilities.reduce((sum, cap) => {
282
+ return sum + (capabilityCount.get(cap) || 0);
283
+ }, 0);
284
+ const optionalCapCount = (mapping.optionalCapabilities || []).reduce((sum, cap) => {
285
+ return sum + (capabilityCount.get(cap) || 0);
286
+ }, 0);
287
+ const totalRelevantAgents = requiredCapCount + optionalCapCount;
288
+ const minThreshold = mapping.minAgentThreshold || this.options.globalMinThreshold || 1;
289
+ // Include server if it has required capabilities or meets threshold
290
+ if (requiredCapCount > 0 || totalRelevantAgents >= minThreshold) {
291
+ requiredServers.push(mapping);
292
+ }
293
+ }
294
+ // Sort by priority (higher priority first)
295
+ return requiredServers.sort((a, b) => b.priority - a.priority);
296
+ }
297
+ /**
298
+ * Configure servers with dynamic environment and workspace-specific settings
299
+ */
300
+ configureServers(requiredServers) {
301
+ const configured = [];
302
+ for (const mapping of requiredServers) {
303
+ const config = { ...mapping.configTemplate };
304
+ // Apply dynamic environment variables
305
+ if (mapping.dynamicEnv) {
306
+ config.env = {
307
+ ...config.env,
308
+ ...mapping.dynamicEnv(this.options.workspaceRoot),
309
+ };
310
+ }
311
+ configured.push({
312
+ config,
313
+ reason: this.generateServerReason(mapping),
314
+ benefitingAgents: this.countBenefitingAgents(mapping),
315
+ relatedCapabilities: [...mapping.requiredCapabilities, ...(mapping.optionalCapabilities || [])],
316
+ });
317
+ }
318
+ return configured;
319
+ }
320
+ /**
321
+ * Generate human-readable reason for server inclusion
322
+ */
323
+ generateServerReason(mapping) {
324
+ const agentCount = this.countBenefitingAgents(mapping);
325
+ const capabilityList = mapping.requiredCapabilities.slice(0, 2).join(', ');
326
+ return `Required by ${agentCount} agent(s) for ${capabilityList}${mapping.requiredCapabilities.length > 2 ? ' and more' : ''}`;
327
+ }
328
+ /**
329
+ * Count agents that would benefit from this server
330
+ */
331
+ countBenefitingAgents(mapping) {
332
+ let count = 0;
333
+ const allCapabilities = [...mapping.requiredCapabilities, ...(mapping.optionalCapabilities || [])];
334
+ for (const manifest of this.registeredAgents.values()) {
335
+ const hasRelevantCapability = manifest.capabilities.some(cap => allCapabilities.includes(cap.capability_id));
336
+ if (hasRelevantCapability) {
337
+ count++;
338
+ }
339
+ }
340
+ return count;
341
+ }
342
+ /**
343
+ * Generate configuration recommendations
344
+ */
345
+ generateRecommendations(capabilityCount, requiredServers) {
346
+ const recommendations = [];
347
+ for (const mapping of requiredServers) {
348
+ const agentCount = this.countBenefitingAgents(mapping);
349
+ const requiredCapCount = mapping.requiredCapabilities.reduce((sum, cap) => sum + (capabilityCount.get(cap) || 0), 0);
350
+ let type;
351
+ let explanation;
352
+ if (requiredCapCount > 0) {
353
+ type = 'required';
354
+ explanation = `Essential for ${requiredCapCount} capabilities across ${agentCount} agents`;
355
+ }
356
+ else if (agentCount >= (mapping.minAgentThreshold || 1)) {
357
+ type = 'recommended';
358
+ explanation = `Beneficial for ${agentCount} agents with complementary capabilities`;
359
+ }
360
+ else {
361
+ type = 'optional';
362
+ explanation = `May improve performance for ${agentCount} agents`;
363
+ }
364
+ recommendations.push({
365
+ serverName: mapping.serverName,
366
+ type,
367
+ explanation,
368
+ affectedAgents: agentCount,
369
+ });
370
+ }
371
+ return recommendations;
372
+ }
373
+ /**
374
+ * Write configuration to file
375
+ */
376
+ async writeConfigurationFile(servers, filePath) {
377
+ const config = {
378
+ mcpServers: servers.reduce((acc, server) => {
379
+ acc[server.config.name] = {
380
+ ...server.config,
381
+ // Add metadata for human readers
382
+ _metadata: {
383
+ reason: server.reason,
384
+ benefitingAgents: server.benefitingAgents,
385
+ relatedCapabilities: server.relatedCapabilities,
386
+ autoConfigured: true,
387
+ configuredAt: new Date().toISOString(),
388
+ },
389
+ };
390
+ return acc;
391
+ }, {}),
392
+ };
393
+ const fs = await import('fs/promises');
394
+ const path = await import('path');
395
+ const absolutePath = path.isAbsolute(filePath)
396
+ ? filePath
397
+ : path.resolve(this.options.workspaceRoot, filePath);
398
+ await fs.writeFile(absolutePath, JSON.stringify(config, null, 2), 'utf-8');
399
+ }
400
+ /**
401
+ * Get current server status
402
+ */
403
+ async getServerStatus() {
404
+ const servers = this.registry.getAvailableServers();
405
+ return servers.map((server) => ({
406
+ name: server.config.name,
407
+ status: server.status,
408
+ config: server.config,
409
+ manifest: server.manifest,
410
+ }));
411
+ }
412
+ /**
413
+ * Health check all configured servers
414
+ */
415
+ async healthCheckServers() {
416
+ const results = new Map();
417
+ const servers = this.registry.getAvailableServers();
418
+ for (const server of servers) {
419
+ try {
420
+ // Health check by checking if server has 'available' status
421
+ const isHealthy = server.status === 'available';
422
+ results.set(server.config.name, isHealthy);
423
+ }
424
+ catch (error) {
425
+ results.set(server.config.name, false);
426
+ }
427
+ }
428
+ return results;
429
+ }
430
+ /**
431
+ * Cleanup and shutdown
432
+ */
433
+ async shutdown() {
434
+ this.removeAllListeners();
435
+ await this.registry.shutdown();
436
+ }
437
+ }
438
+ /**
439
+ * Factory function for creating auto-configuration system
440
+ */
441
+ export function createMCPAutoConfiguration(options) {
442
+ return new MCPAutoConfiguration(options);
443
+ }
444
+ export default MCPAutoConfiguration;
445
+ //# sourceMappingURL=mcp-auto-configuration.js.map