claude-flow 3.25.5 → 3.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/.claude/helpers/.helpers-version +1 -1
  2. package/.claude/helpers/helpers.manifest.json +5 -4
  3. package/.claude/helpers/hook-handler.cjs +129 -0
  4. package/.claude/helpers/statusline.cjs +300 -123
  5. package/.claude/proven-config.json +1 -1
  6. package/.claude/security-scans/scan-all-standard.json +321 -0
  7. package/.claude/security-scans/scan-code-deep.json +1209 -0
  8. package/.claude/security-scans/scan-deps-full.json +14 -0
  9. package/package.json +3 -1
  10. package/v3/@claude-flow/cli/catalog-manifest.json +12 -0
  11. package/v3/@claude-flow/cli/dist/src/commands/advisor.d.ts +15 -0
  12. package/v3/@claude-flow/cli/dist/src/commands/advisor.js +94 -0
  13. package/v3/@claude-flow/cli/dist/src/commands/doctor.js +151 -32
  14. package/v3/@claude-flow/cli/dist/src/commands/funnel.d.ts +13 -0
  15. package/v3/@claude-flow/cli/dist/src/commands/funnel.js +103 -0
  16. package/v3/@claude-flow/cli/dist/src/commands/hooks.js +112 -46
  17. package/v3/@claude-flow/cli/dist/src/commands/index.js +10 -0
  18. package/v3/@claude-flow/cli/dist/src/commands/init.js +44 -0
  19. package/v3/@claude-flow/cli/dist/src/commands/proxy.d.ts +21 -0
  20. package/v3/@claude-flow/cli/dist/src/commands/proxy.js +310 -0
  21. package/v3/@claude-flow/cli/dist/src/commands/security.js +29 -0
  22. package/v3/@claude-flow/cli/dist/src/commands/settings.d.ts +19 -0
  23. package/v3/@claude-flow/cli/dist/src/commands/settings.js +180 -0
  24. package/v3/@claude-flow/cli/dist/src/commands/version.d.ts +42 -0
  25. package/v3/@claude-flow/cli/dist/src/commands/version.js +106 -0
  26. package/v3/@claude-flow/cli/dist/src/funnel/advisor-tip.d.ts +58 -0
  27. package/v3/@claude-flow/cli/dist/src/funnel/advisor-tip.js +92 -0
  28. package/v3/@claude-flow/cli/dist/src/funnel/attribution.d.ts +37 -0
  29. package/v3/@claude-flow/cli/dist/src/funnel/attribution.js +101 -0
  30. package/v3/@claude-flow/cli/dist/src/funnel/consent.d.ts +22 -0
  31. package/v3/@claude-flow/cli/dist/src/funnel/consent.js +55 -0
  32. package/v3/@claude-flow/cli/dist/src/funnel/credit-errors.d.ts +31 -0
  33. package/v3/@claude-flow/cli/dist/src/funnel/credit-errors.js +88 -0
  34. package/v3/@claude-flow/cli/dist/src/funnel/credit-notifier.d.ts +44 -0
  35. package/v3/@claude-flow/cli/dist/src/funnel/credit-notifier.js +74 -0
  36. package/v3/@claude-flow/cli/dist/src/funnel/disclosure.d.ts +46 -0
  37. package/v3/@claude-flow/cli/dist/src/funnel/disclosure.js +97 -0
  38. package/v3/@claude-flow/cli/dist/src/funnel/enrollment.d.ts +36 -0
  39. package/v3/@claude-flow/cli/dist/src/funnel/enrollment.js +64 -0
  40. package/v3/@claude-flow/cli/dist/src/funnel/environment.d.ts +17 -0
  41. package/v3/@claude-flow/cli/dist/src/funnel/environment.js +39 -0
  42. package/v3/@claude-flow/cli/dist/src/funnel/event-transport.d.ts +51 -0
  43. package/v3/@claude-flow/cli/dist/src/funnel/event-transport.js +199 -0
  44. package/v3/@claude-flow/cli/dist/src/funnel/events.d.ts +42 -0
  45. package/v3/@claude-flow/cli/dist/src/funnel/events.js +150 -0
  46. package/v3/@claude-flow/cli/dist/src/funnel/index.d.ts +20 -0
  47. package/v3/@claude-flow/cli/dist/src/funnel/index.js +20 -0
  48. package/v3/@claude-flow/cli/dist/src/funnel/insights.d.ts +49 -0
  49. package/v3/@claude-flow/cli/dist/src/funnel/insights.js +120 -0
  50. package/v3/@claude-flow/cli/dist/src/funnel/local-signals.d.ts +15 -0
  51. package/v3/@claude-flow/cli/dist/src/funnel/local-signals.js +68 -0
  52. package/v3/@claude-flow/cli/dist/src/funnel/message-transport.d.ts +51 -0
  53. package/v3/@claude-flow/cli/dist/src/funnel/message-transport.js +149 -0
  54. package/v3/@claude-flow/cli/dist/src/funnel/messages.d.ts +55 -0
  55. package/v3/@claude-flow/cli/dist/src/funnel/messages.js +160 -0
  56. package/v3/@claude-flow/cli/dist/src/funnel/power-saver-notifier.d.ts +44 -0
  57. package/v3/@claude-flow/cli/dist/src/funnel/power-saver-notifier.js +92 -0
  58. package/v3/@claude-flow/cli/dist/src/funnel/precedence.d.ts +16 -0
  59. package/v3/@claude-flow/cli/dist/src/funnel/precedence.js +85 -0
  60. package/v3/@claude-flow/cli/dist/src/funnel/promo.d.ts +41 -0
  61. package/v3/@claude-flow/cli/dist/src/funnel/promo.js +144 -0
  62. package/v3/@claude-flow/cli/dist/src/funnel/rate-limit-notifier.d.ts +55 -0
  63. package/v3/@claude-flow/cli/dist/src/funnel/rate-limit-notifier.js +102 -0
  64. package/v3/@claude-flow/cli/dist/src/funnel/rotation.d.ts +19 -0
  65. package/v3/@claude-flow/cli/dist/src/funnel/rotation.js +70 -0
  66. package/v3/@claude-flow/cli/dist/src/funnel/state.d.ts +13 -0
  67. package/v3/@claude-flow/cli/dist/src/funnel/state.js +52 -0
  68. package/v3/@claude-flow/cli/dist/src/funnel/toggle-cooldown.d.ts +17 -0
  69. package/v3/@claude-flow/cli/dist/src/funnel/toggle-cooldown.js +32 -0
  70. package/v3/@claude-flow/cli/dist/src/funnel/types.d.ts +86 -0
  71. package/v3/@claude-flow/cli/dist/src/funnel/types.js +26 -0
  72. package/v3/@claude-flow/cli/dist/src/init/executor.js +25 -19
  73. package/v3/@claude-flow/cli/dist/src/init/helper-refresh.d.ts +33 -2
  74. package/v3/@claude-flow/cli/dist/src/init/helper-refresh.js +102 -12
  75. package/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +52 -0
  76. package/v3/@claude-flow/cli/dist/src/init/mcp-generator.js +11 -6
  77. package/v3/@claude-flow/cli/dist/src/init/statusline-generator.js +282 -116
  78. package/v3/@claude-flow/cli/dist/src/services/daemon-autostart.js +28 -5
  79. package/v3/@claude-flow/cli/dist/src/services/fable-harness.d.ts +39 -0
  80. package/v3/@claude-flow/cli/dist/src/services/fable-harness.js +41 -0
  81. package/v3/@claude-flow/cli/package.json +16 -4
  82. package/v3/README.md +493 -0
  83. package/.claude/coordinator/config.json +0 -24
  84. package/.claude/coordinator/state.json +0 -37
  85. package/.claude/coordinator/tick-log/tick-01.json +0 -17
  86. package/.claude/coordinator/tick-log/tick-02.json +0 -17
  87. package/.claude/coordinator/tick-log/tick-03.json +0 -17
  88. package/.claude/coordinator/tick-log/tick-04.json +0 -14
  89. package/.claude/coordinator/tick-log/tick-05.json +0 -16
  90. package/.claude/settings.local.json +0 -11
  91. package/v3/@claude-flow/cli/dist/src/ruvector/lattice-wasm.d.ts +0 -14
  92. package/v3/@claude-flow/cli/dist/src/ruvector/lattice-wasm.js +0 -144
  93. package/v3/@claude-flow/guidance/dist/adversarial.d.ts +0 -284
  94. package/v3/@claude-flow/guidance/dist/adversarial.js +0 -572
  95. package/v3/@claude-flow/guidance/dist/analyzer.d.ts +0 -530
  96. package/v3/@claude-flow/guidance/dist/analyzer.js +0 -2587
  97. package/v3/@claude-flow/guidance/dist/artifacts.d.ts +0 -283
  98. package/v3/@claude-flow/guidance/dist/artifacts.js +0 -356
  99. package/v3/@claude-flow/guidance/dist/authority.d.ts +0 -290
  100. package/v3/@claude-flow/guidance/dist/authority.js +0 -558
  101. package/v3/@claude-flow/guidance/dist/capabilities.d.ts +0 -209
  102. package/v3/@claude-flow/guidance/dist/capabilities.js +0 -485
  103. package/v3/@claude-flow/guidance/dist/coherence.d.ts +0 -233
  104. package/v3/@claude-flow/guidance/dist/coherence.js +0 -372
  105. package/v3/@claude-flow/guidance/dist/compiler.d.ts +0 -87
  106. package/v3/@claude-flow/guidance/dist/compiler.js +0 -410
  107. package/v3/@claude-flow/guidance/dist/conformance-kit.d.ts +0 -225
  108. package/v3/@claude-flow/guidance/dist/conformance-kit.js +0 -629
  109. package/v3/@claude-flow/guidance/dist/continue-gate.d.ts +0 -214
  110. package/v3/@claude-flow/guidance/dist/continue-gate.js +0 -353
  111. package/v3/@claude-flow/guidance/dist/crypto-utils.d.ts +0 -17
  112. package/v3/@claude-flow/guidance/dist/crypto-utils.js +0 -24
  113. package/v3/@claude-flow/guidance/dist/evolution.d.ts +0 -282
  114. package/v3/@claude-flow/guidance/dist/evolution.js +0 -500
  115. package/v3/@claude-flow/guidance/dist/gates.d.ts +0 -79
  116. package/v3/@claude-flow/guidance/dist/gates.js +0 -302
  117. package/v3/@claude-flow/guidance/dist/gateway.d.ts +0 -206
  118. package/v3/@claude-flow/guidance/dist/gateway.js +0 -452
  119. package/v3/@claude-flow/guidance/dist/generators.d.ts +0 -153
  120. package/v3/@claude-flow/guidance/dist/generators.js +0 -682
  121. package/v3/@claude-flow/guidance/dist/headless.d.ts +0 -177
  122. package/v3/@claude-flow/guidance/dist/headless.js +0 -342
  123. package/v3/@claude-flow/guidance/dist/hooks.d.ts +0 -109
  124. package/v3/@claude-flow/guidance/dist/hooks.js +0 -347
  125. package/v3/@claude-flow/guidance/dist/index.d.ts +0 -205
  126. package/v3/@claude-flow/guidance/dist/index.js +0 -321
  127. package/v3/@claude-flow/guidance/dist/ledger.d.ts +0 -162
  128. package/v3/@claude-flow/guidance/dist/ledger.js +0 -375
  129. package/v3/@claude-flow/guidance/dist/manifest-validator.d.ts +0 -289
  130. package/v3/@claude-flow/guidance/dist/manifest-validator.js +0 -838
  131. package/v3/@claude-flow/guidance/dist/memory-gate.d.ts +0 -222
  132. package/v3/@claude-flow/guidance/dist/memory-gate.js +0 -382
  133. package/v3/@claude-flow/guidance/dist/meta-governance.d.ts +0 -265
  134. package/v3/@claude-flow/guidance/dist/meta-governance.js +0 -348
  135. package/v3/@claude-flow/guidance/dist/optimizer.d.ts +0 -104
  136. package/v3/@claude-flow/guidance/dist/optimizer.js +0 -329
  137. package/v3/@claude-flow/guidance/dist/persistence.d.ts +0 -189
  138. package/v3/@claude-flow/guidance/dist/persistence.js +0 -464
  139. package/v3/@claude-flow/guidance/dist/proof.d.ts +0 -185
  140. package/v3/@claude-flow/guidance/dist/proof.js +0 -238
  141. package/v3/@claude-flow/guidance/dist/retriever.d.ts +0 -172
  142. package/v3/@claude-flow/guidance/dist/retriever.js +0 -596
  143. package/v3/@claude-flow/guidance/dist/ruvbot-integration.d.ts +0 -370
  144. package/v3/@claude-flow/guidance/dist/ruvbot-integration.js +0 -738
  145. package/v3/@claude-flow/guidance/dist/temporal.d.ts +0 -426
  146. package/v3/@claude-flow/guidance/dist/temporal.js +0 -658
  147. package/v3/@claude-flow/guidance/dist/trust.d.ts +0 -283
  148. package/v3/@claude-flow/guidance/dist/trust.js +0 -473
  149. package/v3/@claude-flow/guidance/dist/truth-anchors.d.ts +0 -276
  150. package/v3/@claude-flow/guidance/dist/truth-anchors.js +0 -488
  151. package/v3/@claude-flow/guidance/dist/types.d.ts +0 -378
  152. package/v3/@claude-flow/guidance/dist/types.js +0 -10
  153. package/v3/@claude-flow/guidance/dist/uncertainty.d.ts +0 -372
  154. package/v3/@claude-flow/guidance/dist/uncertainty.js +0 -619
  155. package/v3/@claude-flow/guidance/dist/wasm-kernel.d.ts +0 -48
  156. package/v3/@claude-flow/guidance/dist/wasm-kernel.js +0 -158
  157. package/v3/@claude-flow/shared/dist/core/config/defaults.d.ts +0 -41
  158. package/v3/@claude-flow/shared/dist/core/config/defaults.js +0 -186
  159. package/v3/@claude-flow/shared/dist/core/config/index.d.ts +0 -8
  160. package/v3/@claude-flow/shared/dist/core/config/index.js +0 -12
  161. package/v3/@claude-flow/shared/dist/core/config/loader.d.ts +0 -45
  162. package/v3/@claude-flow/shared/dist/core/config/loader.js +0 -238
  163. package/v3/@claude-flow/shared/dist/core/config/schema.d.ts +0 -1728
  164. package/v3/@claude-flow/shared/dist/core/config/schema.js +0 -160
  165. package/v3/@claude-flow/shared/dist/core/config/validator.d.ts +0 -92
  166. package/v3/@claude-flow/shared/dist/core/config/validator.js +0 -147
  167. package/v3/@claude-flow/shared/dist/core/event-bus.d.ts +0 -31
  168. package/v3/@claude-flow/shared/dist/core/event-bus.js +0 -197
  169. package/v3/@claude-flow/shared/dist/core/index.d.ts +0 -15
  170. package/v3/@claude-flow/shared/dist/core/index.js +0 -19
  171. package/v3/@claude-flow/shared/dist/core/interfaces/agent.interface.d.ts +0 -200
  172. package/v3/@claude-flow/shared/dist/core/interfaces/agent.interface.js +0 -6
  173. package/v3/@claude-flow/shared/dist/core/interfaces/coordinator.interface.d.ts +0 -310
  174. package/v3/@claude-flow/shared/dist/core/interfaces/coordinator.interface.js +0 -7
  175. package/v3/@claude-flow/shared/dist/core/interfaces/event.interface.d.ts +0 -224
  176. package/v3/@claude-flow/shared/dist/core/interfaces/event.interface.js +0 -46
  177. package/v3/@claude-flow/shared/dist/core/interfaces/index.d.ts +0 -10
  178. package/v3/@claude-flow/shared/dist/core/interfaces/index.js +0 -15
  179. package/v3/@claude-flow/shared/dist/core/interfaces/memory.interface.d.ts +0 -298
  180. package/v3/@claude-flow/shared/dist/core/interfaces/memory.interface.js +0 -7
  181. package/v3/@claude-flow/shared/dist/core/interfaces/task.interface.d.ts +0 -185
  182. package/v3/@claude-flow/shared/dist/core/interfaces/task.interface.js +0 -6
  183. package/v3/@claude-flow/shared/dist/core/orchestrator/event-coordinator.d.ts +0 -35
  184. package/v3/@claude-flow/shared/dist/core/orchestrator/event-coordinator.js +0 -101
  185. package/v3/@claude-flow/shared/dist/core/orchestrator/health-monitor.d.ts +0 -60
  186. package/v3/@claude-flow/shared/dist/core/orchestrator/health-monitor.js +0 -166
  187. package/v3/@claude-flow/shared/dist/core/orchestrator/index.d.ts +0 -46
  188. package/v3/@claude-flow/shared/dist/core/orchestrator/index.js +0 -64
  189. package/v3/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.d.ts +0 -56
  190. package/v3/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.js +0 -195
  191. package/v3/@claude-flow/shared/dist/core/orchestrator/session-manager.d.ts +0 -83
  192. package/v3/@claude-flow/shared/dist/core/orchestrator/session-manager.js +0 -193
  193. package/v3/@claude-flow/shared/dist/core/orchestrator/task-manager.d.ts +0 -49
  194. package/v3/@claude-flow/shared/dist/core/orchestrator/task-manager.js +0 -253
  195. package/v3/@claude-flow/shared/dist/events/domain-events.d.ts +0 -282
  196. package/v3/@claude-flow/shared/dist/events/domain-events.js +0 -165
  197. package/v3/@claude-flow/shared/dist/events/event-store.d.ts +0 -126
  198. package/v3/@claude-flow/shared/dist/events/event-store.js +0 -427
  199. package/v3/@claude-flow/shared/dist/events/event-store.test.d.ts +0 -8
  200. package/v3/@claude-flow/shared/dist/events/event-store.test.js +0 -293
  201. package/v3/@claude-flow/shared/dist/events/example-usage.d.ts +0 -10
  202. package/v3/@claude-flow/shared/dist/events/example-usage.js +0 -193
  203. package/v3/@claude-flow/shared/dist/events/index.d.ts +0 -21
  204. package/v3/@claude-flow/shared/dist/events/index.js +0 -22
  205. package/v3/@claude-flow/shared/dist/events/projections.d.ts +0 -177
  206. package/v3/@claude-flow/shared/dist/events/projections.js +0 -421
  207. package/v3/@claude-flow/shared/dist/events/rvf-event-log.d.ts +0 -82
  208. package/v3/@claude-flow/shared/dist/events/rvf-event-log.js +0 -340
  209. package/v3/@claude-flow/shared/dist/events/state-reconstructor.d.ts +0 -101
  210. package/v3/@claude-flow/shared/dist/events/state-reconstructor.js +0 -263
  211. package/v3/@claude-flow/shared/dist/events.d.ts +0 -80
  212. package/v3/@claude-flow/shared/dist/events.js +0 -249
  213. package/v3/@claude-flow/shared/dist/hooks/example-usage.d.ts +0 -42
  214. package/v3/@claude-flow/shared/dist/hooks/example-usage.js +0 -351
  215. package/v3/@claude-flow/shared/dist/hooks/executor.d.ts +0 -100
  216. package/v3/@claude-flow/shared/dist/hooks/executor.js +0 -267
  217. package/v3/@claude-flow/shared/dist/hooks/hooks.test.d.ts +0 -9
  218. package/v3/@claude-flow/shared/dist/hooks/hooks.test.js +0 -322
  219. package/v3/@claude-flow/shared/dist/hooks/index.d.ts +0 -52
  220. package/v3/@claude-flow/shared/dist/hooks/index.js +0 -51
  221. package/v3/@claude-flow/shared/dist/hooks/registry.d.ts +0 -133
  222. package/v3/@claude-flow/shared/dist/hooks/registry.js +0 -277
  223. package/v3/@claude-flow/shared/dist/hooks/safety/bash-safety.d.ts +0 -105
  224. package/v3/@claude-flow/shared/dist/hooks/safety/bash-safety.js +0 -481
  225. package/v3/@claude-flow/shared/dist/hooks/safety/file-organization.d.ts +0 -144
  226. package/v3/@claude-flow/shared/dist/hooks/safety/file-organization.js +0 -328
  227. package/v3/@claude-flow/shared/dist/hooks/safety/git-commit.d.ts +0 -158
  228. package/v3/@claude-flow/shared/dist/hooks/safety/git-commit.js +0 -450
  229. package/v3/@claude-flow/shared/dist/hooks/safety/index.d.ts +0 -17
  230. package/v3/@claude-flow/shared/dist/hooks/safety/index.js +0 -17
  231. package/v3/@claude-flow/shared/dist/hooks/session-hooks.d.ts +0 -234
  232. package/v3/@claude-flow/shared/dist/hooks/session-hooks.js +0 -334
  233. package/v3/@claude-flow/shared/dist/hooks/task-hooks.d.ts +0 -163
  234. package/v3/@claude-flow/shared/dist/hooks/task-hooks.js +0 -326
  235. package/v3/@claude-flow/shared/dist/hooks/types.d.ts +0 -267
  236. package/v3/@claude-flow/shared/dist/hooks/types.js +0 -62
  237. package/v3/@claude-flow/shared/dist/hooks/verify-exports.test.d.ts +0 -9
  238. package/v3/@claude-flow/shared/dist/hooks/verify-exports.test.js +0 -93
  239. package/v3/@claude-flow/shared/dist/index.d.ts +0 -20
  240. package/v3/@claude-flow/shared/dist/index.js +0 -50
  241. package/v3/@claude-flow/shared/dist/mcp/connection-pool.d.ts +0 -98
  242. package/v3/@claude-flow/shared/dist/mcp/connection-pool.js +0 -364
  243. package/v3/@claude-flow/shared/dist/mcp/index.d.ts +0 -69
  244. package/v3/@claude-flow/shared/dist/mcp/index.js +0 -84
  245. package/v3/@claude-flow/shared/dist/mcp/server.d.ts +0 -166
  246. package/v3/@claude-flow/shared/dist/mcp/server.js +0 -590
  247. package/v3/@claude-flow/shared/dist/mcp/session-manager.d.ts +0 -136
  248. package/v3/@claude-flow/shared/dist/mcp/session-manager.js +0 -335
  249. package/v3/@claude-flow/shared/dist/mcp/tool-registry.d.ts +0 -178
  250. package/v3/@claude-flow/shared/dist/mcp/tool-registry.js +0 -439
  251. package/v3/@claude-flow/shared/dist/mcp/transport/http.d.ts +0 -104
  252. package/v3/@claude-flow/shared/dist/mcp/transport/http.js +0 -476
  253. package/v3/@claude-flow/shared/dist/mcp/transport/index.d.ts +0 -102
  254. package/v3/@claude-flow/shared/dist/mcp/transport/index.js +0 -238
  255. package/v3/@claude-flow/shared/dist/mcp/transport/stdio.d.ts +0 -104
  256. package/v3/@claude-flow/shared/dist/mcp/transport/stdio.js +0 -263
  257. package/v3/@claude-flow/shared/dist/mcp/transport/websocket.d.ts +0 -133
  258. package/v3/@claude-flow/shared/dist/mcp/transport/websocket.js +0 -396
  259. package/v3/@claude-flow/shared/dist/mcp/types.d.ts +0 -436
  260. package/v3/@claude-flow/shared/dist/mcp/types.js +0 -54
  261. package/v3/@claude-flow/shared/dist/plugin-interface.d.ts +0 -544
  262. package/v3/@claude-flow/shared/dist/plugin-interface.js +0 -23
  263. package/v3/@claude-flow/shared/dist/plugin-loader.d.ts +0 -139
  264. package/v3/@claude-flow/shared/dist/plugin-loader.js +0 -434
  265. package/v3/@claude-flow/shared/dist/plugin-registry.d.ts +0 -183
  266. package/v3/@claude-flow/shared/dist/plugin-registry.js +0 -457
  267. package/v3/@claude-flow/shared/dist/plugins/index.d.ts +0 -10
  268. package/v3/@claude-flow/shared/dist/plugins/index.js +0 -10
  269. package/v3/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.d.ts +0 -106
  270. package/v3/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.js +0 -241
  271. package/v3/@claude-flow/shared/dist/plugins/official/index.d.ts +0 -10
  272. package/v3/@claude-flow/shared/dist/plugins/official/index.js +0 -10
  273. package/v3/@claude-flow/shared/dist/plugins/official/maestro-plugin.d.ts +0 -121
  274. package/v3/@claude-flow/shared/dist/plugins/official/maestro-plugin.js +0 -355
  275. package/v3/@claude-flow/shared/dist/plugins/types.d.ts +0 -93
  276. package/v3/@claude-flow/shared/dist/plugins/types.js +0 -9
  277. package/v3/@claude-flow/shared/dist/resilience/bulkhead.d.ts +0 -105
  278. package/v3/@claude-flow/shared/dist/resilience/bulkhead.js +0 -206
  279. package/v3/@claude-flow/shared/dist/resilience/circuit-breaker.d.ts +0 -132
  280. package/v3/@claude-flow/shared/dist/resilience/circuit-breaker.js +0 -233
  281. package/v3/@claude-flow/shared/dist/resilience/index.d.ts +0 -19
  282. package/v3/@claude-flow/shared/dist/resilience/index.js +0 -19
  283. package/v3/@claude-flow/shared/dist/resilience/rate-limiter.d.ts +0 -168
  284. package/v3/@claude-flow/shared/dist/resilience/rate-limiter.js +0 -314
  285. package/v3/@claude-flow/shared/dist/resilience/retry.d.ts +0 -91
  286. package/v3/@claude-flow/shared/dist/resilience/retry.js +0 -159
  287. package/v3/@claude-flow/shared/dist/security/index.d.ts +0 -10
  288. package/v3/@claude-flow/shared/dist/security/index.js +0 -12
  289. package/v3/@claude-flow/shared/dist/security/input-validation.d.ts +0 -73
  290. package/v3/@claude-flow/shared/dist/security/input-validation.js +0 -201
  291. package/v3/@claude-flow/shared/dist/security/secure-random.d.ts +0 -92
  292. package/v3/@claude-flow/shared/dist/security/secure-random.js +0 -142
  293. package/v3/@claude-flow/shared/dist/services/index.d.ts +0 -7
  294. package/v3/@claude-flow/shared/dist/services/index.js +0 -7
  295. package/v3/@claude-flow/shared/dist/services/v3-progress.service.d.ts +0 -124
  296. package/v3/@claude-flow/shared/dist/services/v3-progress.service.js +0 -402
  297. package/v3/@claude-flow/shared/dist/types/agent.types.d.ts +0 -137
  298. package/v3/@claude-flow/shared/dist/types/agent.types.js +0 -6
  299. package/v3/@claude-flow/shared/dist/types/index.d.ts +0 -11
  300. package/v3/@claude-flow/shared/dist/types/index.js +0 -17
  301. package/v3/@claude-flow/shared/dist/types/mcp.types.d.ts +0 -266
  302. package/v3/@claude-flow/shared/dist/types/mcp.types.js +0 -7
  303. package/v3/@claude-flow/shared/dist/types/memory.types.d.ts +0 -236
  304. package/v3/@claude-flow/shared/dist/types/memory.types.js +0 -7
  305. package/v3/@claude-flow/shared/dist/types/swarm.types.d.ts +0 -186
  306. package/v3/@claude-flow/shared/dist/types/swarm.types.js +0 -65
  307. package/v3/@claude-flow/shared/dist/types/task.types.d.ts +0 -178
  308. package/v3/@claude-flow/shared/dist/types/task.types.js +0 -32
  309. package/v3/@claude-flow/shared/dist/types.d.ts +0 -197
  310. package/v3/@claude-flow/shared/dist/types.js +0 -21
  311. package/v3/@claude-flow/shared/dist/utils/secure-logger.d.ts +0 -69
  312. package/v3/@claude-flow/shared/dist/utils/secure-logger.js +0 -208
@@ -1,590 +0,0 @@
1
- /**
2
- * V3 MCP Server Implementation
3
- *
4
- * Optimized MCP server with:
5
- * - Connection pooling for efficient resource usage
6
- * - Fast tool registration (<10ms)
7
- * - Optimized request routing (<50ms overhead)
8
- * - Multiple transport support (stdio, http, websocket, in-process)
9
- * - Session management with timeout handling
10
- * - Comprehensive metrics and monitoring
11
- *
12
- * Performance Targets:
13
- * - Server startup: <400ms
14
- * - Tool registration: <10ms
15
- * - Tool execution: <50ms overhead
16
- */
17
- import { EventEmitter } from 'events';
18
- import { platform, arch } from 'os';
19
- import { MCPServerError, ErrorCodes, } from './types.js';
20
- import { createToolRegistry } from './tool-registry.js';
21
- import { createSessionManager } from './session-manager.js';
22
- import { createConnectionPool } from './connection-pool.js';
23
- import { createTransport, createTransportManager } from './transport/index.js';
24
- /**
25
- * Default server configuration
26
- */
27
- const DEFAULT_CONFIG = {
28
- name: 'Claude-Flow MCP Server V3',
29
- version: '3.0.0',
30
- transport: 'stdio',
31
- host: 'localhost',
32
- port: 3000,
33
- enableMetrics: true,
34
- enableCaching: true,
35
- cacheTTL: 10000,
36
- logLevel: 'info',
37
- requestTimeout: 30000,
38
- maxRequestSize: 10 * 1024 * 1024,
39
- };
40
- /**
41
- * V3 MCP Server
42
- */
43
- export class MCPServer extends EventEmitter {
44
- logger;
45
- orchestrator;
46
- swarmCoordinator;
47
- config;
48
- toolRegistry;
49
- sessionManager;
50
- connectionPool;
51
- transportManager;
52
- transport;
53
- running = false;
54
- startTime;
55
- startupDuration;
56
- currentSession;
57
- // Server information
58
- serverInfo = {
59
- name: 'Claude-Flow MCP Server V3',
60
- version: '3.0.0',
61
- };
62
- // MCP protocol version — spec-required YYYY-MM-DD date string (#1874).
63
- // Claude Code's Zod validator rejects any other shape.
64
- protocolVersion = '2024-11-05';
65
- // Server capabilities
66
- capabilities = {
67
- logging: { level: 'info' },
68
- tools: { listChanged: true },
69
- resources: { listChanged: false, subscribe: false },
70
- prompts: { listChanged: false },
71
- };
72
- // Request statistics
73
- requestStats = {
74
- total: 0,
75
- successful: 0,
76
- failed: 0,
77
- totalResponseTime: 0,
78
- };
79
- constructor(config, logger, orchestrator, swarmCoordinator) {
80
- super();
81
- this.logger = logger;
82
- this.orchestrator = orchestrator;
83
- this.swarmCoordinator = swarmCoordinator;
84
- this.config = { ...DEFAULT_CONFIG, ...config };
85
- // Initialize components
86
- this.toolRegistry = createToolRegistry(logger);
87
- this.sessionManager = createSessionManager(logger, {
88
- maxSessions: 100,
89
- sessionTimeout: 30 * 60 * 1000,
90
- });
91
- this.transportManager = createTransportManager(logger);
92
- // Initialize connection pool if enabled
93
- if (this.config.connectionPool) {
94
- this.connectionPool = createConnectionPool(this.config.connectionPool, logger, this.config.transport);
95
- }
96
- // Setup event handlers
97
- this.setupEventHandlers();
98
- }
99
- /**
100
- * Start the MCP server
101
- */
102
- async start() {
103
- if (this.running) {
104
- throw new MCPServerError('Server already running');
105
- }
106
- const startTime = performance.now();
107
- this.startTime = new Date();
108
- this.logger.info('Starting MCP server', {
109
- name: this.config.name,
110
- version: this.config.version,
111
- transport: this.config.transport,
112
- });
113
- try {
114
- // Create and start transport
115
- this.transport = createTransport(this.config.transport, this.logger, {
116
- type: this.config.transport,
117
- host: this.config.host,
118
- port: this.config.port,
119
- corsEnabled: this.config.corsEnabled,
120
- corsOrigins: this.config.corsOrigins,
121
- auth: this.config.auth,
122
- maxRequestSize: String(this.config.maxRequestSize),
123
- requestTimeout: this.config.requestTimeout,
124
- });
125
- // Setup request handler
126
- this.transport.onRequest(async (request) => {
127
- return await this.handleRequest(request);
128
- });
129
- // Setup notification handler
130
- this.transport.onNotification(async (notification) => {
131
- await this.handleNotification(notification);
132
- });
133
- // Start transport
134
- await this.transport.start();
135
- // Register built-in tools
136
- await this.registerBuiltInTools();
137
- this.running = true;
138
- this.startupDuration = performance.now() - startTime;
139
- this.logger.info('MCP server started', {
140
- startupTime: `${this.startupDuration.toFixed(2)}ms`,
141
- tools: this.toolRegistry.getToolCount(),
142
- });
143
- this.emit('server:started', {
144
- startupTime: this.startupDuration,
145
- tools: this.toolRegistry.getToolCount(),
146
- });
147
- }
148
- catch (error) {
149
- this.logger.error('Failed to start MCP server', { error });
150
- throw new MCPServerError('Failed to start server', ErrorCodes.INTERNAL_ERROR, { error });
151
- }
152
- }
153
- /**
154
- * Stop the MCP server
155
- */
156
- async stop() {
157
- if (!this.running) {
158
- return;
159
- }
160
- this.logger.info('Stopping MCP server');
161
- try {
162
- // Stop transport
163
- if (this.transport) {
164
- await this.transport.stop();
165
- this.transport = undefined;
166
- }
167
- // Clear sessions
168
- this.sessionManager.clearAll();
169
- // Clear connection pool
170
- if (this.connectionPool) {
171
- await this.connectionPool.clear();
172
- }
173
- this.running = false;
174
- this.currentSession = undefined;
175
- this.logger.info('MCP server stopped');
176
- this.emit('server:stopped');
177
- }
178
- catch (error) {
179
- this.logger.error('Error stopping MCP server', { error });
180
- throw error;
181
- }
182
- }
183
- /**
184
- * Register a tool
185
- */
186
- registerTool(tool) {
187
- return this.toolRegistry.register(tool);
188
- }
189
- /**
190
- * Register multiple tools
191
- */
192
- registerTools(tools) {
193
- return this.toolRegistry.registerBatch(tools);
194
- }
195
- /**
196
- * Unregister a tool
197
- */
198
- unregisterTool(name) {
199
- return this.toolRegistry.unregister(name);
200
- }
201
- /**
202
- * Get health status
203
- */
204
- async getHealthStatus() {
205
- try {
206
- const transportHealth = this.transport
207
- ? await this.transport.getHealthStatus()
208
- : { healthy: false, error: 'Transport not initialized' };
209
- const sessionMetrics = this.sessionManager.getSessionMetrics();
210
- const poolStats = this.connectionPool?.getStats();
211
- const metrics = {
212
- registeredTools: this.toolRegistry.getToolCount(),
213
- totalRequests: this.requestStats.total,
214
- successfulRequests: this.requestStats.successful,
215
- failedRequests: this.requestStats.failed,
216
- totalSessions: sessionMetrics.total,
217
- activeSessions: sessionMetrics.active,
218
- ...(transportHealth.metrics || {}),
219
- };
220
- if (poolStats) {
221
- metrics.poolConnections = poolStats.totalConnections;
222
- metrics.poolIdleConnections = poolStats.idleConnections;
223
- metrics.poolBusyConnections = poolStats.busyConnections;
224
- }
225
- return {
226
- healthy: this.running && transportHealth.healthy,
227
- error: transportHealth.error,
228
- metrics,
229
- };
230
- }
231
- catch (error) {
232
- return {
233
- healthy: false,
234
- error: error instanceof Error ? error.message : 'Unknown error',
235
- };
236
- }
237
- }
238
- /**
239
- * Get server metrics
240
- */
241
- getMetrics() {
242
- const sessionMetrics = this.sessionManager.getSessionMetrics();
243
- const registryStats = this.toolRegistry.getStats();
244
- return {
245
- totalRequests: this.requestStats.total,
246
- successfulRequests: this.requestStats.successful,
247
- failedRequests: this.requestStats.failed,
248
- averageResponseTime: this.requestStats.total > 0
249
- ? this.requestStats.totalResponseTime / this.requestStats.total
250
- : 0,
251
- activeSessions: sessionMetrics.active,
252
- toolInvocations: Object.fromEntries(registryStats.topTools.map((t) => [t.name, t.calls])),
253
- errors: {},
254
- lastReset: this.startTime || new Date(),
255
- startupTime: this.startupDuration,
256
- uptime: this.startTime ? Date.now() - this.startTime.getTime() : 0,
257
- };
258
- }
259
- /**
260
- * Get all sessions
261
- */
262
- getSessions() {
263
- return this.sessionManager.getActiveSessions();
264
- }
265
- /**
266
- * Get session by ID
267
- */
268
- getSession(sessionId) {
269
- return this.sessionManager.getSession(sessionId);
270
- }
271
- /**
272
- * Terminate a session
273
- */
274
- terminateSession(sessionId) {
275
- const result = this.sessionManager.closeSession(sessionId, 'Terminated by server');
276
- if (this.currentSession?.id === sessionId) {
277
- this.currentSession = undefined;
278
- }
279
- return result;
280
- }
281
- /**
282
- * Handle incoming request
283
- */
284
- async handleRequest(request) {
285
- const startTime = performance.now();
286
- this.requestStats.total++;
287
- this.logger.debug('Handling request', {
288
- id: request.id,
289
- method: request.method,
290
- });
291
- try {
292
- // Handle initialization
293
- if (request.method === 'initialize') {
294
- return await this.handleInitialize(request);
295
- }
296
- // Get or create session
297
- const session = this.getOrCreateSession();
298
- // Check initialization
299
- if (!session.isInitialized && request.method !== 'initialized') {
300
- return this.createErrorResponse(request.id, ErrorCodes.SERVER_NOT_INITIALIZED, 'Server not initialized');
301
- }
302
- // Update session activity
303
- this.sessionManager.updateActivity(session.id);
304
- // Route request
305
- const response = await this.routeRequest(request);
306
- const duration = performance.now() - startTime;
307
- this.requestStats.successful++;
308
- this.requestStats.totalResponseTime += duration;
309
- this.logger.debug('Request completed', {
310
- id: request.id,
311
- method: request.method,
312
- duration: `${duration.toFixed(2)}ms`,
313
- });
314
- return response;
315
- }
316
- catch (error) {
317
- const duration = performance.now() - startTime;
318
- this.requestStats.failed++;
319
- this.requestStats.totalResponseTime += duration;
320
- this.logger.error('Request failed', {
321
- id: request.id,
322
- method: request.method,
323
- error,
324
- });
325
- return this.createErrorResponse(request.id, ErrorCodes.INTERNAL_ERROR, error instanceof Error ? error.message : 'Internal error');
326
- }
327
- }
328
- /**
329
- * Handle notification
330
- */
331
- async handleNotification(notification) {
332
- this.logger.debug('Handling notification', { method: notification.method });
333
- switch (notification.method) {
334
- case 'initialized':
335
- this.logger.info('Client initialized notification received');
336
- break;
337
- case 'notifications/cancelled':
338
- this.logger.debug('Request cancelled', notification.params);
339
- break;
340
- default:
341
- this.logger.debug('Unknown notification', { method: notification.method });
342
- }
343
- }
344
- /**
345
- * Handle initialize request
346
- */
347
- async handleInitialize(request) {
348
- const params = request.params;
349
- if (!params) {
350
- return this.createErrorResponse(request.id, ErrorCodes.INVALID_PARAMS, 'Invalid params');
351
- }
352
- // Create and initialize session
353
- const session = this.sessionManager.createSession(this.config.transport);
354
- this.sessionManager.initializeSession(session.id, params);
355
- this.currentSession = session;
356
- const result = {
357
- protocolVersion: this.protocolVersion,
358
- capabilities: this.capabilities,
359
- serverInfo: this.serverInfo,
360
- instructions: 'Claude-Flow MCP Server V3 ready for tool execution',
361
- };
362
- this.logger.info('Session initialized', {
363
- sessionId: session.id,
364
- clientInfo: params.clientInfo,
365
- });
366
- return {
367
- jsonrpc: '2.0',
368
- id: request.id,
369
- result,
370
- };
371
- }
372
- /**
373
- * Route request to appropriate handler
374
- */
375
- async routeRequest(request) {
376
- switch (request.method) {
377
- case 'tools/list':
378
- return this.handleToolsList(request);
379
- case 'tools/call':
380
- return this.handleToolsCall(request);
381
- case 'resources/list':
382
- return this.handleResourcesList(request);
383
- case 'prompts/list':
384
- return this.handlePromptsList(request);
385
- case 'ping':
386
- return {
387
- jsonrpc: '2.0',
388
- id: request.id,
389
- result: { pong: true, timestamp: Date.now() },
390
- };
391
- default:
392
- // Try to execute as tool call (backwards compatibility)
393
- if (this.toolRegistry.hasTool(request.method)) {
394
- return this.handleToolExecution(request);
395
- }
396
- return this.createErrorResponse(request.id, ErrorCodes.METHOD_NOT_FOUND, `Method not found: ${request.method}`);
397
- }
398
- }
399
- /**
400
- * Handle tools/list request
401
- */
402
- handleToolsList(request) {
403
- const tools = this.toolRegistry.listTools().map((t) => ({
404
- name: t.name,
405
- description: t.description,
406
- inputSchema: this.toolRegistry.getTool(t.name)?.inputSchema,
407
- }));
408
- return {
409
- jsonrpc: '2.0',
410
- id: request.id,
411
- result: { tools },
412
- };
413
- }
414
- /**
415
- * Handle tools/call request
416
- */
417
- async handleToolsCall(request) {
418
- const params = request.params;
419
- if (!params?.name) {
420
- return this.createErrorResponse(request.id, ErrorCodes.INVALID_PARAMS, 'Tool name is required');
421
- }
422
- const context = {
423
- sessionId: this.currentSession?.id || 'unknown',
424
- requestId: request.id,
425
- orchestrator: this.orchestrator,
426
- swarmCoordinator: this.swarmCoordinator,
427
- };
428
- const result = await this.toolRegistry.execute(params.name, params.arguments || {}, context);
429
- return {
430
- jsonrpc: '2.0',
431
- id: request.id,
432
- result,
433
- };
434
- }
435
- /**
436
- * Handle direct tool execution (backwards compatibility)
437
- */
438
- async handleToolExecution(request) {
439
- const context = {
440
- sessionId: this.currentSession?.id || 'unknown',
441
- requestId: request.id,
442
- orchestrator: this.orchestrator,
443
- swarmCoordinator: this.swarmCoordinator,
444
- };
445
- const result = await this.toolRegistry.execute(request.method, request.params || {}, context);
446
- return {
447
- jsonrpc: '2.0',
448
- id: request.id,
449
- result,
450
- };
451
- }
452
- /**
453
- * Handle resources/list request
454
- */
455
- handleResourcesList(request) {
456
- return {
457
- jsonrpc: '2.0',
458
- id: request.id,
459
- result: { resources: [] },
460
- };
461
- }
462
- /**
463
- * Handle prompts/list request
464
- */
465
- handlePromptsList(request) {
466
- return {
467
- jsonrpc: '2.0',
468
- id: request.id,
469
- result: { prompts: [] },
470
- };
471
- }
472
- /**
473
- * Get or create current session
474
- */
475
- getOrCreateSession() {
476
- if (this.currentSession) {
477
- return this.currentSession;
478
- }
479
- const session = this.sessionManager.createSession(this.config.transport);
480
- this.currentSession = session;
481
- return session;
482
- }
483
- /**
484
- * Create error response
485
- */
486
- createErrorResponse(id, code, message) {
487
- return {
488
- jsonrpc: '2.0',
489
- id,
490
- error: { code, message },
491
- };
492
- }
493
- /**
494
- * Register built-in tools
495
- */
496
- async registerBuiltInTools() {
497
- // System info tool
498
- this.registerTool({
499
- name: 'system/info',
500
- description: 'Get system information',
501
- inputSchema: { type: 'object', properties: {} },
502
- handler: async () => ({
503
- name: this.serverInfo.name,
504
- version: this.serverInfo.version,
505
- platform: platform(),
506
- arch: arch(),
507
- runtime: 'Node.js',
508
- uptime: this.startTime ? Date.now() - this.startTime.getTime() : 0,
509
- }),
510
- category: 'system',
511
- });
512
- // Health check tool
513
- this.registerTool({
514
- name: 'system/health',
515
- description: 'Get system health status',
516
- inputSchema: { type: 'object', properties: {} },
517
- handler: async () => await this.getHealthStatus(),
518
- category: 'system',
519
- cacheable: true,
520
- cacheTTL: 2000,
521
- });
522
- // Metrics tool
523
- this.registerTool({
524
- name: 'system/metrics',
525
- description: 'Get server metrics',
526
- inputSchema: { type: 'object', properties: {} },
527
- handler: async () => this.getMetrics(),
528
- category: 'system',
529
- cacheable: true,
530
- cacheTTL: 1000,
531
- });
532
- // Tools list tool
533
- this.registerTool({
534
- name: 'tools/list-detailed',
535
- description: 'List all registered tools with details',
536
- inputSchema: {
537
- type: 'object',
538
- properties: {
539
- category: { type: 'string', description: 'Filter by category' },
540
- },
541
- },
542
- handler: async (input) => {
543
- const params = input;
544
- if (params.category) {
545
- return this.toolRegistry.getByCategory(params.category);
546
- }
547
- return this.toolRegistry.listTools();
548
- },
549
- category: 'system',
550
- });
551
- this.logger.info('Built-in tools registered', {
552
- count: 4,
553
- });
554
- }
555
- /**
556
- * Setup event handlers
557
- */
558
- setupEventHandlers() {
559
- // Tool events
560
- this.toolRegistry.on('tool:registered', (name) => {
561
- this.emit('tool:registered', name);
562
- });
563
- this.toolRegistry.on('tool:called', (data) => {
564
- this.emit('tool:called', data);
565
- });
566
- this.toolRegistry.on('tool:completed', (data) => {
567
- this.emit('tool:completed', data);
568
- });
569
- this.toolRegistry.on('tool:error', (data) => {
570
- this.emit('tool:error', data);
571
- });
572
- // Session events
573
- this.sessionManager.on('session:created', (session) => {
574
- this.emit('session:created', session);
575
- });
576
- this.sessionManager.on('session:closed', (data) => {
577
- this.emit('session:closed', data);
578
- });
579
- this.sessionManager.on('session:expired', (session) => {
580
- this.emit('session:expired', session);
581
- });
582
- }
583
- }
584
- /**
585
- * Create an MCP server instance
586
- */
587
- export function createMCPServer(config, logger, orchestrator, swarmCoordinator) {
588
- return new MCPServer(config, logger, orchestrator, swarmCoordinator);
589
- }
590
- //# sourceMappingURL=server.js.map