claude-flow 2.0.0-alpha.61 → 2.0.0-alpha.63

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 (1468) hide show
  1. package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +54 -0
  2. package/.claude/commands/analysis/token-efficiency.md +2 -1
  3. package/.claude/commands/automation/self-healing.md +47 -2
  4. package/.claude/commands/automation/session-memory.md +39 -10
  5. package/.claude/commands/automation/smart-agents.md +36 -8
  6. package/.claude/commands/github/code-review-swarm.md +80 -15
  7. package/.claude/commands/github/github-modes.md +14 -14
  8. package/.claude/commands/github/issue-tracker.md +19 -16
  9. package/.claude/commands/github/multi-repo-swarm.md +114 -16
  10. package/.claude/commands/github/pr-manager.md +5 -4
  11. package/.claude/commands/github/project-board-sync.md +38 -5
  12. package/.claude/commands/github/release-manager.md +19 -19
  13. package/.claude/commands/github/release-swarm.md +102 -13
  14. package/.claude/commands/github/repo-architect.md +6 -6
  15. package/.claude/commands/github/swarm-issue.md +139 -17
  16. package/.claude/commands/github/swarm-pr.md +49 -15
  17. package/.claude/commands/github/sync-coordinator.md +33 -33
  18. package/.claude/commands/github/workflow-automation.md +37 -10
  19. package/.claude/commands/hooks/overview.md +2 -2
  20. package/.claude/commands/hooks/setup.md +7 -7
  21. package/.claude/commands/memory/neural.md +10 -5
  22. package/.claude/commands/memory/usage.md +9 -5
  23. package/.claude/commands/monitoring/agents.md +7 -5
  24. package/.claude/commands/monitoring/status.md +8 -5
  25. package/.claude/commands/optimization/auto-topology.md +13 -1
  26. package/.claude/commands/optimization/parallel-execution.md +7 -1
  27. package/.claude/commands/sparc/analyzer.md +28 -2
  28. package/.claude/commands/sparc/architect.md +27 -1
  29. package/.claude/commands/sparc/batch-executor.md +27 -1
  30. package/.claude/commands/sparc/coder.md +27 -1
  31. package/.claude/commands/sparc/debugger.md +27 -1
  32. package/.claude/commands/sparc/designer.md +27 -1
  33. package/.claude/commands/sparc/documenter.md +27 -1
  34. package/.claude/commands/sparc/innovator.md +27 -1
  35. package/.claude/commands/sparc/memory-manager.md +27 -1
  36. package/.claude/commands/sparc/optimizer.md +27 -1
  37. package/.claude/commands/sparc/orchestrator.md +106 -2
  38. package/.claude/commands/sparc/researcher.md +27 -1
  39. package/.claude/commands/sparc/reviewer.md +27 -1
  40. package/.claude/commands/sparc/sparc-modes.md +137 -5
  41. package/.claude/commands/sparc/swarm-coordinator.md +27 -1
  42. package/.claude/commands/sparc/tdd.md +27 -1
  43. package/.claude/commands/sparc/tester.md +27 -1
  44. package/.claude/commands/sparc/workflow-manager.md +27 -1
  45. package/.claude/commands/swarm/analysis.md +82 -5
  46. package/.claude/commands/swarm/development.md +83 -6
  47. package/.claude/commands/swarm/examples.md +141 -3
  48. package/.claude/commands/swarm/maintenance.md +92 -8
  49. package/.claude/commands/swarm/optimization.md +107 -9
  50. package/.claude/commands/swarm/research.md +126 -8
  51. package/.claude/commands/swarm/testing.md +121 -9
  52. package/.claude/commands/training/neural-patterns.md +27 -2
  53. package/.claude/commands/training/specialization.md +13 -3
  54. package/.claude/commands/workflows/development.md +43 -4
  55. package/.claude/commands/workflows/research.md +26 -2
  56. package/CHANGELOG.md +59 -1
  57. package/README.md +8 -0
  58. package/bin/claude-flow +1 -1
  59. package/dist/adapters/cliffy-node.d.ts.map +1 -1
  60. package/dist/adapters/cliffy-node.js +13 -7
  61. package/dist/adapters/cliffy-node.js.map +1 -1
  62. package/dist/agents/agent-manager.d.ts.map +1 -1
  63. package/dist/agents/agent-manager.js +77 -65
  64. package/dist/agents/agent-manager.js.map +1 -1
  65. package/dist/agents/agent-registry.d.ts.map +1 -1
  66. package/dist/agents/agent-registry.js +38 -30
  67. package/dist/agents/agent-registry.js.map +1 -1
  68. package/dist/api/claude-client.d.ts.map +1 -1
  69. package/dist/api/claude-client.js +22 -16
  70. package/dist/api/claude-client.js.map +1 -1
  71. package/dist/cli/agents/analyst.d.ts.map +1 -1
  72. package/dist/cli/agents/analyst.js +94 -114
  73. package/dist/cli/agents/analyst.js.map +1 -1
  74. package/dist/cli/agents/architect.d.ts.map +1 -1
  75. package/dist/cli/agents/architect.js +100 -114
  76. package/dist/cli/agents/architect.js.map +1 -1
  77. package/dist/cli/agents/base-agent.d.ts.map +1 -1
  78. package/dist/cli/agents/base-agent.js +27 -27
  79. package/dist/cli/agents/base-agent.js.map +1 -1
  80. package/dist/cli/agents/capabilities.d.ts.map +1 -1
  81. package/dist/cli/agents/capabilities.js +49 -51
  82. package/dist/cli/agents/capabilities.js.map +1 -1
  83. package/dist/cli/agents/coder.d.ts.map +1 -1
  84. package/dist/cli/agents/coder.js +92 -98
  85. package/dist/cli/agents/coder.js.map +1 -1
  86. package/dist/cli/agents/coordinator.d.ts.map +1 -1
  87. package/dist/cli/agents/coordinator.js +59 -64
  88. package/dist/cli/agents/coordinator.js.map +1 -1
  89. package/dist/cli/agents/hive-agents.d.ts.map +1 -1
  90. package/dist/cli/agents/hive-agents.js +22 -24
  91. package/dist/cli/agents/hive-agents.js.map +1 -1
  92. package/dist/cli/agents/index.d.ts.map +1 -1
  93. package/dist/cli/agents/index.js +17 -17
  94. package/dist/cli/agents/index.js.map +1 -1
  95. package/dist/cli/agents/researcher.d.ts.map +1 -1
  96. package/dist/cli/agents/researcher.js +41 -61
  97. package/dist/cli/agents/researcher.js.map +1 -1
  98. package/dist/cli/agents/tester.d.ts.map +1 -1
  99. package/dist/cli/agents/tester.js +78 -90
  100. package/dist/cli/agents/tester.js.map +1 -1
  101. package/dist/cli/cli-core.d.ts +4 -1
  102. package/dist/cli/cli-core.d.ts.map +1 -1
  103. package/dist/cli/cli-core.js +40 -39
  104. package/dist/cli/cli-core.js.map +1 -1
  105. package/dist/cli/command-registry.d.ts.map +1 -1
  106. package/dist/cli/command-registry.js +55 -64
  107. package/dist/cli/command-registry.js.map +1 -1
  108. package/dist/cli/commands/advanced-memory-commands.d.ts.map +1 -1
  109. package/dist/cli/commands/advanced-memory-commands.js +49 -40
  110. package/dist/cli/commands/advanced-memory-commands.js.map +1 -1
  111. package/dist/cli/commands/agent-simple.d.ts +3 -0
  112. package/dist/cli/commands/agent-simple.d.ts.map +1 -1
  113. package/dist/cli/commands/agent-simple.js +30 -27
  114. package/dist/cli/commands/agent-simple.js.map +1 -1
  115. package/dist/cli/commands/agent.d.ts.map +1 -1
  116. package/dist/cli/commands/agent.js +53 -40
  117. package/dist/cli/commands/agent.js.map +1 -1
  118. package/dist/cli/commands/claude-api.js +4 -4
  119. package/dist/cli/commands/claude-api.js.map +1 -1
  120. package/dist/cli/commands/claude.d.ts.map +1 -1
  121. package/dist/cli/commands/claude.js +2 -2
  122. package/dist/cli/commands/claude.js.map +1 -1
  123. package/dist/cli/commands/config-integration.d.ts +7 -1
  124. package/dist/cli/commands/config-integration.d.ts.map +1 -1
  125. package/dist/cli/commands/config-integration.js +18 -9
  126. package/dist/cli/commands/config-integration.js.map +1 -1
  127. package/dist/cli/commands/config.d.ts.map +1 -1
  128. package/dist/cli/commands/config.js +2 -3
  129. package/dist/cli/commands/config.js.map +1 -1
  130. package/dist/cli/commands/enterprise.d.ts.map +1 -1
  131. package/dist/cli/commands/enterprise.js +115 -95
  132. package/dist/cli/commands/enterprise.js.map +1 -1
  133. package/dist/cli/commands/help-new.js +49 -49
  134. package/dist/cli/commands/help-new.js.map +1 -1
  135. package/dist/cli/commands/help.d.ts.map +1 -1
  136. package/dist/cli/commands/help.js +122 -125
  137. package/dist/cli/commands/help.js.map +1 -1
  138. package/dist/cli/commands/hive-mind/index.d.ts +1 -1
  139. package/dist/cli/commands/hive-mind/index.d.ts.map +1 -1
  140. package/dist/cli/commands/hive-mind/index.js +1 -1
  141. package/dist/cli/commands/hive-mind/index.js.map +1 -1
  142. package/dist/cli/commands/hive-mind/init.d.ts.map +1 -1
  143. package/dist/cli/commands/hive-mind/init.js.map +1 -1
  144. package/dist/cli/commands/hive-mind/optimize-memory.d.ts.map +1 -1
  145. package/dist/cli/commands/hive-mind/optimize-memory.js +35 -26
  146. package/dist/cli/commands/hive-mind/optimize-memory.js.map +1 -1
  147. package/dist/cli/commands/hive-mind/pause.d.ts.map +1 -1
  148. package/dist/cli/commands/hive-mind/pause.js +8 -6
  149. package/dist/cli/commands/hive-mind/pause.js.map +1 -1
  150. package/dist/cli/commands/hive-mind/ps.d.ts.map +1 -1
  151. package/dist/cli/commands/hive-mind/ps.js +17 -12
  152. package/dist/cli/commands/hive-mind/ps.js.map +1 -1
  153. package/dist/cli/commands/hive-mind/resume.js +12 -10
  154. package/dist/cli/commands/hive-mind/resume.js.map +1 -1
  155. package/dist/cli/commands/hive-mind/spawn.d.ts.map +1 -1
  156. package/dist/cli/commands/hive-mind/spawn.js +20 -11
  157. package/dist/cli/commands/hive-mind/spawn.js.map +1 -1
  158. package/dist/cli/commands/hive-mind/status.js +17 -22
  159. package/dist/cli/commands/hive-mind/status.js.map +1 -1
  160. package/dist/cli/commands/hive-mind/stop.d.ts.map +1 -1
  161. package/dist/cli/commands/hive-mind/stop.js +23 -15
  162. package/dist/cli/commands/hive-mind/stop.js.map +1 -1
  163. package/dist/cli/commands/hive-mind/task.d.ts.map +1 -1
  164. package/dist/cli/commands/hive-mind/task.js +25 -19
  165. package/dist/cli/commands/hive-mind/task.js.map +1 -1
  166. package/dist/cli/commands/hive-mind/wizard.d.ts.map +1 -1
  167. package/dist/cli/commands/hive-mind/wizard.js +86 -68
  168. package/dist/cli/commands/hive-mind/wizard.js.map +1 -1
  169. package/dist/cli/commands/hive.js +73 -38
  170. package/dist/cli/commands/hive.js.map +1 -1
  171. package/dist/cli/commands/hook-validator.d.ts.map +1 -1
  172. package/dist/cli/commands/hook-validator.js +4 -2
  173. package/dist/cli/commands/hook-validator.js.map +1 -1
  174. package/dist/cli/commands/hook.d.ts.map +1 -1
  175. package/dist/cli/commands/hook.js +8 -8
  176. package/dist/cli/commands/hook.js.map +1 -1
  177. package/dist/cli/commands/index.d.ts +1 -1
  178. package/dist/cli/commands/index.d.ts.map +1 -1
  179. package/dist/cli/commands/index.js +850 -784
  180. package/dist/cli/commands/index.js.map +1 -1
  181. package/dist/cli/commands/mcp.d.ts.map +1 -1
  182. package/dist/cli/commands/mcp.js +8 -16
  183. package/dist/cli/commands/mcp.js.map +1 -1
  184. package/dist/cli/commands/memory.d.ts.map +1 -1
  185. package/dist/cli/commands/memory.js +8 -8
  186. package/dist/cli/commands/memory.js.map +1 -1
  187. package/dist/cli/commands/migrate.d.ts.map +1 -1
  188. package/dist/cli/commands/migrate.js +3 -3
  189. package/dist/cli/commands/migrate.js.map +1 -1
  190. package/dist/cli/commands/monitor.d.ts.map +1 -1
  191. package/dist/cli/commands/monitor.js +50 -34
  192. package/dist/cli/commands/monitor.js.map +1 -1
  193. package/dist/cli/commands/ruv-swarm.d.ts +7 -1
  194. package/dist/cli/commands/ruv-swarm.d.ts.map +1 -1
  195. package/dist/cli/commands/ruv-swarm.js +6 -6
  196. package/dist/cli/commands/ruv-swarm.js.map +1 -1
  197. package/dist/cli/commands/session.d.ts.map +1 -1
  198. package/dist/cli/commands/session.js +22 -17
  199. package/dist/cli/commands/session.js.map +1 -1
  200. package/dist/cli/commands/sparc.d.ts +1 -1
  201. package/dist/cli/commands/sparc.d.ts.map +1 -1
  202. package/dist/cli/commands/sparc.js +146 -126
  203. package/dist/cli/commands/sparc.js.map +1 -1
  204. package/dist/cli/commands/start/event-emitter.js +1 -1
  205. package/dist/cli/commands/start/event-emitter.js.map +1 -1
  206. package/dist/cli/commands/start/process-manager.d.ts.map +1 -1
  207. package/dist/cli/commands/start/process-manager.js +20 -18
  208. package/dist/cli/commands/start/process-manager.js.map +1 -1
  209. package/dist/cli/commands/start/process-ui-simple.d.ts +4 -0
  210. package/dist/cli/commands/start/process-ui-simple.d.ts.map +1 -1
  211. package/dist/cli/commands/start/process-ui-simple.js +2 -2
  212. package/dist/cli/commands/start/process-ui-simple.js.map +1 -1
  213. package/dist/cli/commands/start/start-command.d.ts.map +1 -1
  214. package/dist/cli/commands/start/start-command.js +27 -15
  215. package/dist/cli/commands/start/start-command.js.map +1 -1
  216. package/dist/cli/commands/start/system-monitor.d.ts +3 -0
  217. package/dist/cli/commands/start/system-monitor.d.ts.map +1 -1
  218. package/dist/cli/commands/start/system-monitor.js +16 -18
  219. package/dist/cli/commands/start/system-monitor.js.map +1 -1
  220. package/dist/cli/commands/status.d.ts.map +1 -1
  221. package/dist/cli/commands/status.js +28 -33
  222. package/dist/cli/commands/status.js.map +1 -1
  223. package/dist/cli/commands/swarm-spawn.d.ts.map +1 -1
  224. package/dist/cli/commands/swarm-spawn.js +1 -1
  225. package/dist/cli/commands/swarm-spawn.js.map +1 -1
  226. package/dist/cli/commands/swarm.d.ts +4 -1
  227. package/dist/cli/commands/swarm.d.ts.map +1 -1
  228. package/dist/cli/commands/swarm.js +23 -18
  229. package/dist/cli/commands/swarm.js.map +1 -1
  230. package/dist/cli/commands/task.d.ts.map +1 -1
  231. package/dist/cli/commands/task.js.map +1 -1
  232. package/dist/cli/commands/workflow.d.ts.map +1 -1
  233. package/dist/cli/commands/workflow.js +49 -45
  234. package/dist/cli/commands/workflow.js.map +1 -1
  235. package/dist/cli/completion.d.ts +3 -0
  236. package/dist/cli/completion.d.ts.map +1 -1
  237. package/dist/cli/completion.js +15 -5
  238. package/dist/cli/completion.js.map +1 -1
  239. package/dist/cli/formatter.d.ts +3 -0
  240. package/dist/cli/formatter.d.ts.map +1 -1
  241. package/dist/cli/formatter.js +3 -3
  242. package/dist/cli/formatter.js.map +1 -1
  243. package/dist/cli/help-formatter.d.ts.map +1 -1
  244. package/dist/cli/help-formatter.js +8 -14
  245. package/dist/cli/help-formatter.js.map +1 -1
  246. package/dist/cli/index-remote.d.ts +4 -0
  247. package/dist/cli/index-remote.d.ts.map +1 -1
  248. package/dist/cli/index-remote.js +1 -1
  249. package/dist/cli/index-remote.js.map +1 -1
  250. package/dist/cli/index.d.ts +1 -1
  251. package/dist/cli/index.d.ts.map +1 -1
  252. package/dist/cli/index.js +32 -34
  253. package/dist/cli/index.js.map +1 -1
  254. package/dist/cli/init/batch-tools.d.ts.map +1 -1
  255. package/dist/cli/init/batch-tools.js.map +1 -1
  256. package/dist/cli/init/claude-config.d.ts.map +1 -1
  257. package/dist/cli/init/claude-config.js +111 -106
  258. package/dist/cli/init/claude-config.js.map +1 -1
  259. package/dist/cli/init/directory-structure.d.ts.map +1 -1
  260. package/dist/cli/init/directory-structure.js +3 -3
  261. package/dist/cli/init/directory-structure.js.map +1 -1
  262. package/dist/cli/init/index.d.ts.map +1 -1
  263. package/dist/cli/init/index.js +1 -1
  264. package/dist/cli/init/index.js.map +1 -1
  265. package/dist/cli/init/sparc-environment.d.ts.map +1 -1
  266. package/dist/cli/init/sparc-environment.js +69 -69
  267. package/dist/cli/init/sparc-environment.js.map +1 -1
  268. package/dist/cli/init/swarm-commands.d.ts.map +1 -1
  269. package/dist/cli/init/swarm-commands.js +1 -1
  270. package/dist/cli/init/swarm-commands.js.map +1 -1
  271. package/dist/cli/main.d.ts +3 -0
  272. package/dist/cli/main.d.ts.map +1 -1
  273. package/dist/cli/main.js +6 -6
  274. package/dist/cli/main.js.map +1 -1
  275. package/dist/cli/node-compat.d.ts.map +1 -1
  276. package/dist/cli/node-compat.js +24 -18
  277. package/dist/cli/node-compat.js.map +1 -1
  278. package/dist/cli/node-repl.d.ts +4 -0
  279. package/dist/cli/node-repl.d.ts.map +1 -1
  280. package/dist/cli/node-repl.js +24 -30
  281. package/dist/cli/node-repl.js.map +1 -1
  282. package/dist/cli/repl.d.ts.map +1 -1
  283. package/dist/cli/repl.js +81 -70
  284. package/dist/cli/repl.js.map +1 -1
  285. package/dist/cli/runtime-detector.d.ts.map +1 -1
  286. package/dist/cli/runtime-detector.js +11 -7
  287. package/dist/cli/runtime-detector.js.map +1 -1
  288. package/dist/cli/simple-cli.d.ts +4 -0
  289. package/dist/cli/simple-cli.d.ts.map +1 -1
  290. package/dist/cli/simple-cli.js +109 -95
  291. package/dist/cli/simple-cli.js.map +1 -1
  292. package/dist/cli/simple-commands/analysis.d.ts.map +1 -1
  293. package/dist/cli/simple-commands/analysis.js +18 -11
  294. package/dist/cli/simple-commands/analysis.js.map +1 -1
  295. package/dist/cli/simple-commands/automation.js +32 -17
  296. package/dist/cli/simple-commands/automation.js.map +1 -1
  297. package/dist/cli/simple-commands/batch-manager.js +44 -39
  298. package/dist/cli/simple-commands/batch-manager.js.map +1 -1
  299. package/dist/cli/simple-commands/config.d.ts.map +1 -1
  300. package/dist/cli/simple-commands/config.js +22 -21
  301. package/dist/cli/simple-commands/config.js.map +1 -1
  302. package/dist/cli/simple-commands/coordination.d.ts.map +1 -1
  303. package/dist/cli/simple-commands/coordination.js +12 -12
  304. package/dist/cli/simple-commands/coordination.js.map +1 -1
  305. package/dist/cli/simple-commands/fix-hook-variables.d.ts.map +1 -1
  306. package/dist/cli/simple-commands/fix-hook-variables.js +36 -30
  307. package/dist/cli/simple-commands/fix-hook-variables.js.map +1 -1
  308. package/dist/cli/simple-commands/github.d.ts.map +1 -1
  309. package/dist/cli/simple-commands/github.js +15 -15
  310. package/dist/cli/simple-commands/github.js.map +1 -1
  311. package/dist/cli/simple-commands/hive-mind/auto-save-middleware.d.ts.map +1 -1
  312. package/dist/cli/simple-commands/hive-mind/auto-save-middleware.js +12 -10
  313. package/dist/cli/simple-commands/hive-mind/auto-save-middleware.js.map +1 -1
  314. package/dist/cli/simple-commands/hive-mind/communication.d.ts.map +1 -1
  315. package/dist/cli/simple-commands/hive-mind/communication.js +42 -45
  316. package/dist/cli/simple-commands/hive-mind/communication.js.map +1 -1
  317. package/dist/cli/simple-commands/hive-mind/core.d.ts.map +1 -1
  318. package/dist/cli/simple-commands/hive-mind/core.js +97 -89
  319. package/dist/cli/simple-commands/hive-mind/core.js.map +1 -1
  320. package/dist/cli/simple-commands/hive-mind/db-optimizer.d.ts.map +1 -1
  321. package/dist/cli/simple-commands/hive-mind/db-optimizer.js +114 -59
  322. package/dist/cli/simple-commands/hive-mind/db-optimizer.js.map +1 -1
  323. package/dist/cli/simple-commands/hive-mind/mcp-wrapper.d.ts +66 -0
  324. package/dist/cli/simple-commands/hive-mind/mcp-wrapper.d.ts.map +1 -1
  325. package/dist/cli/simple-commands/hive-mind/mcp-wrapper.js +402 -105
  326. package/dist/cli/simple-commands/hive-mind/mcp-wrapper.js.map +1 -1
  327. package/dist/cli/simple-commands/hive-mind/memory.d.ts.map +1 -1
  328. package/dist/cli/simple-commands/hive-mind/memory.js +105 -75
  329. package/dist/cli/simple-commands/hive-mind/memory.js.map +1 -1
  330. package/dist/cli/simple-commands/hive-mind/performance-optimizer.d.ts.map +1 -1
  331. package/dist/cli/simple-commands/hive-mind/performance-optimizer.js +45 -43
  332. package/dist/cli/simple-commands/hive-mind/performance-optimizer.js.map +1 -1
  333. package/dist/cli/simple-commands/hive-mind/queen.d.ts.map +1 -1
  334. package/dist/cli/simple-commands/hive-mind/queen.js +101 -88
  335. package/dist/cli/simple-commands/hive-mind/queen.js.map +1 -1
  336. package/dist/cli/simple-commands/hive-mind/session-manager.js +75 -53
  337. package/dist/cli/simple-commands/hive-mind/session-manager.js.map +1 -1
  338. package/dist/cli/simple-commands/hive-mind-optimize.js +18 -18
  339. package/dist/cli/simple-commands/hive-mind-optimize.js.map +1 -1
  340. package/dist/cli/simple-commands/hive-mind.d.ts.map +1 -1
  341. package/dist/cli/simple-commands/hive-mind.js +278 -140
  342. package/dist/cli/simple-commands/hive-mind.js.map +1 -1
  343. package/dist/cli/simple-commands/hook-safety.d.ts.map +1 -1
  344. package/dist/cli/simple-commands/hook-safety.js +19 -19
  345. package/dist/cli/simple-commands/hook-safety.js.map +1 -1
  346. package/dist/cli/simple-commands/hooks.d.ts.map +1 -1
  347. package/dist/cli/simple-commands/hooks.js +85 -71
  348. package/dist/cli/simple-commands/hooks.js.map +1 -1
  349. package/dist/cli/simple-commands/init/batch-init.d.ts.map +1 -1
  350. package/dist/cli/simple-commands/init/batch-init.js +62 -55
  351. package/dist/cli/simple-commands/init/batch-init.js.map +1 -1
  352. package/dist/cli/simple-commands/init/claude-commands/optimized-slash-commands.d.ts.map +1 -1
  353. package/dist/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +2 -2
  354. package/dist/cli/simple-commands/init/claude-commands/optimized-slash-commands.js.map +1 -1
  355. package/dist/cli/simple-commands/init/claude-commands/optimized-sparc-commands.d.ts.map +1 -1
  356. package/dist/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +58 -50
  357. package/dist/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js.map +1 -1
  358. package/dist/cli/simple-commands/init/claude-commands/slash-commands.d.ts.map +1 -1
  359. package/dist/cli/simple-commands/init/claude-commands/slash-commands.js.map +1 -1
  360. package/dist/cli/simple-commands/init/claude-commands/sparc-commands.d.ts.map +1 -1
  361. package/dist/cli/simple-commands/init/claude-commands/sparc-commands.js +34 -28
  362. package/dist/cli/simple-commands/init/claude-commands/sparc-commands.js.map +1 -1
  363. package/dist/cli/simple-commands/init/executable-wrapper.d.ts.map +1 -1
  364. package/dist/cli/simple-commands/init/executable-wrapper.js +7 -4
  365. package/dist/cli/simple-commands/init/executable-wrapper.js.map +1 -1
  366. package/dist/cli/simple-commands/init/gitignore-updater.d.ts.map +1 -1
  367. package/dist/cli/simple-commands/init/gitignore-updater.js +10 -9
  368. package/dist/cli/simple-commands/init/gitignore-updater.js.map +1 -1
  369. package/dist/cli/simple-commands/init/help.d.ts.map +1 -1
  370. package/dist/cli/simple-commands/init/help.js.map +1 -1
  371. package/dist/cli/simple-commands/init/index.d.ts.map +1 -1
  372. package/dist/cli/simple-commands/init/index.js +159 -103
  373. package/dist/cli/simple-commands/init/index.js.map +1 -1
  374. package/dist/cli/simple-commands/init/performance-monitor.d.ts.map +1 -1
  375. package/dist/cli/simple-commands/init/performance-monitor.js +17 -18
  376. package/dist/cli/simple-commands/init/performance-monitor.js.map +1 -1
  377. package/dist/cli/simple-commands/init/rollback/backup-manager.d.ts.map +1 -1
  378. package/dist/cli/simple-commands/init/rollback/backup-manager.js +19 -25
  379. package/dist/cli/simple-commands/init/rollback/backup-manager.js.map +1 -1
  380. package/dist/cli/simple-commands/init/rollback/index.d.ts.map +1 -1
  381. package/dist/cli/simple-commands/init/rollback/index.js +18 -15
  382. package/dist/cli/simple-commands/init/rollback/index.js.map +1 -1
  383. package/dist/cli/simple-commands/init/rollback/recovery-manager.d.ts.map +1 -1
  384. package/dist/cli/simple-commands/init/rollback/recovery-manager.js +49 -68
  385. package/dist/cli/simple-commands/init/rollback/recovery-manager.js.map +1 -1
  386. package/dist/cli/simple-commands/init/rollback/rollback-executor.d.ts.map +1 -1
  387. package/dist/cli/simple-commands/init/rollback/rollback-executor.js +16 -24
  388. package/dist/cli/simple-commands/init/rollback/rollback-executor.js.map +1 -1
  389. package/dist/cli/simple-commands/init/rollback/state-tracker.d.ts.map +1 -1
  390. package/dist/cli/simple-commands/init/rollback/state-tracker.js +25 -25
  391. package/dist/cli/simple-commands/init/rollback/state-tracker.js.map +1 -1
  392. package/dist/cli/simple-commands/init/sparc/roomodes-config.d.ts.map +1 -1
  393. package/dist/cli/simple-commands/init/sparc/roomodes-config.js +57 -57
  394. package/dist/cli/simple-commands/init/sparc/roomodes-config.js.map +1 -1
  395. package/dist/cli/simple-commands/init/sparc/workflows.d.ts.map +1 -1
  396. package/dist/cli/simple-commands/init/sparc/workflows.js +21 -21
  397. package/dist/cli/simple-commands/init/sparc/workflows.js.map +1 -1
  398. package/dist/cli/simple-commands/init/sparc-structure.d.ts.map +1 -1
  399. package/dist/cli/simple-commands/init/sparc-structure.js +1 -1
  400. package/dist/cli/simple-commands/init/sparc-structure.js.map +1 -1
  401. package/dist/cli/simple-commands/init/templates/enhanced-templates.d.ts.map +1 -1
  402. package/dist/cli/simple-commands/init/templates/enhanced-templates.js +69 -78
  403. package/dist/cli/simple-commands/init/templates/enhanced-templates.js.map +1 -1
  404. package/dist/cli/simple-commands/init/templates/sparc-modes.js +2 -2
  405. package/dist/cli/simple-commands/init/validation/config-validator.d.ts.map +1 -1
  406. package/dist/cli/simple-commands/init/validation/config-validator.js +12 -16
  407. package/dist/cli/simple-commands/init/validation/config-validator.js.map +1 -1
  408. package/dist/cli/simple-commands/init/validation/health-checker.d.ts.map +1 -1
  409. package/dist/cli/simple-commands/init/validation/health-checker.js +39 -41
  410. package/dist/cli/simple-commands/init/validation/health-checker.js.map +1 -1
  411. package/dist/cli/simple-commands/init/validation/index.d.ts.map +1 -1
  412. package/dist/cli/simple-commands/init/validation/index.js +8 -8
  413. package/dist/cli/simple-commands/init/validation/index.js.map +1 -1
  414. package/dist/cli/simple-commands/init/validation/mode-validator.d.ts.map +1 -1
  415. package/dist/cli/simple-commands/init/validation/mode-validator.js +12 -12
  416. package/dist/cli/simple-commands/init/validation/mode-validator.js.map +1 -1
  417. package/dist/cli/simple-commands/init/validation/post-init-validator.d.ts.map +1 -1
  418. package/dist/cli/simple-commands/init/validation/post-init-validator.js +13 -13
  419. package/dist/cli/simple-commands/init/validation/post-init-validator.js.map +1 -1
  420. package/dist/cli/simple-commands/init/validation/pre-init-validator.d.ts.map +1 -1
  421. package/dist/cli/simple-commands/init/validation/pre-init-validator.js +19 -24
  422. package/dist/cli/simple-commands/init/validation/pre-init-validator.js.map +1 -1
  423. package/dist/cli/simple-commands/mcp.js +2 -2
  424. package/dist/cli/simple-commands/mcp.js.map +1 -1
  425. package/dist/cli/simple-commands/memory.js +4 -4
  426. package/dist/cli/simple-commands/memory.js.map +1 -1
  427. package/dist/cli/simple-commands/migrate-hooks.d.ts.map +1 -1
  428. package/dist/cli/simple-commands/migrate-hooks.js +3 -3
  429. package/dist/cli/simple-commands/migrate-hooks.js.map +1 -1
  430. package/dist/cli/simple-commands/monitor.d.ts.map +1 -1
  431. package/dist/cli/simple-commands/monitor.js +34 -26
  432. package/dist/cli/simple-commands/monitor.js.map +1 -1
  433. package/dist/cli/simple-commands/process-ui-enhanced.d.ts.map +1 -1
  434. package/dist/cli/simple-commands/process-ui-enhanced.js +53 -39
  435. package/dist/cli/simple-commands/process-ui-enhanced.js.map +1 -1
  436. package/dist/cli/simple-commands/sparc-modes/index.js +11 -11
  437. package/dist/cli/simple-commands/sparc-modes/index.js.map +1 -1
  438. package/dist/cli/simple-commands/sparc-modes/swarm.js +50 -50
  439. package/dist/cli/simple-commands/sparc.d.ts.map +1 -1
  440. package/dist/cli/simple-commands/sparc.js +21 -11
  441. package/dist/cli/simple-commands/sparc.js.map +1 -1
  442. package/dist/cli/simple-commands/start-ui.d.ts.map +1 -1
  443. package/dist/cli/simple-commands/start-ui.js +5 -3
  444. package/dist/cli/simple-commands/start-ui.js.map +1 -1
  445. package/dist/cli/simple-commands/start-wrapper.d.ts.map +1 -1
  446. package/dist/cli/simple-commands/start-wrapper.js +1 -1
  447. package/dist/cli/simple-commands/start-wrapper.js.map +1 -1
  448. package/dist/cli/simple-commands/status.js +14 -14
  449. package/dist/cli/simple-commands/status.js.map +1 -1
  450. package/dist/cli/simple-commands/swarm-executor.d.ts.map +1 -1
  451. package/dist/cli/simple-commands/swarm-executor.js +19 -19
  452. package/dist/cli/simple-commands/swarm-executor.js.map +1 -1
  453. package/dist/cli/simple-commands/swarm-metrics-integration.d.ts.map +1 -1
  454. package/dist/cli/simple-commands/swarm-metrics-integration.js +30 -21
  455. package/dist/cli/simple-commands/swarm-metrics-integration.js.map +1 -1
  456. package/dist/cli/simple-commands/swarm-webui-integration.d.ts.map +1 -1
  457. package/dist/cli/simple-commands/swarm-webui-integration.js +30 -18
  458. package/dist/cli/simple-commands/swarm-webui-integration.js.map +1 -1
  459. package/dist/cli/simple-commands/swarm.d.ts.map +1 -1
  460. package/dist/cli/simple-commands/swarm.js +78 -67
  461. package/dist/cli/simple-commands/swarm.js.map +1 -1
  462. package/dist/cli/simple-commands/training.d.ts.map +1 -1
  463. package/dist/cli/simple-commands/training.js +7 -7
  464. package/dist/cli/simple-commands/training.js.map +1 -1
  465. package/dist/cli/simple-commands/web-server.d.ts.map +1 -1
  466. package/dist/cli/simple-commands/web-server.js +68 -66
  467. package/dist/cli/simple-commands/web-server.js.map +1 -1
  468. package/dist/cli/simple-mcp.d.ts.map +1 -1
  469. package/dist/cli/simple-mcp.js +2 -4
  470. package/dist/cli/simple-mcp.js.map +1 -1
  471. package/dist/cli/simple-orchestrator.d.ts +3 -0
  472. package/dist/cli/simple-orchestrator.d.ts.map +1 -1
  473. package/dist/cli/simple-orchestrator.js +36 -35
  474. package/dist/cli/simple-orchestrator.js.map +1 -1
  475. package/dist/cli/ui/compatible-ui.d.ts +4 -0
  476. package/dist/cli/ui/compatible-ui.d.ts.map +1 -1
  477. package/dist/cli/ui/compatible-ui.js +9 -8
  478. package/dist/cli/ui/compatible-ui.js.map +1 -1
  479. package/dist/cli/ui/fallback-handler.d.ts.map +1 -1
  480. package/dist/cli/ui/fallback-handler.js +4 -4
  481. package/dist/cli/ui/fallback-handler.js.map +1 -1
  482. package/dist/cli/ui/index.d.ts +2 -2
  483. package/dist/cli/ui/index.d.ts.map +1 -1
  484. package/dist/cli/ui/index.js +3 -3
  485. package/dist/cli/ui/index.js.map +1 -1
  486. package/dist/cli/utils/environment-detector.d.ts.map +1 -1
  487. package/dist/cli/utils/environment-detector.js +13 -11
  488. package/dist/cli/utils/environment-detector.js.map +1 -1
  489. package/dist/cli/utils/interactive-detector.d.ts.map +1 -1
  490. package/dist/cli/utils/interactive-detector.js +1 -1
  491. package/dist/cli/utils/interactive-detector.js.map +1 -1
  492. package/dist/cli/utils/prompt-defaults.d.ts.map +1 -1
  493. package/dist/cli/utils/prompt-defaults.js +6 -7
  494. package/dist/cli/utils/prompt-defaults.js.map +1 -1
  495. package/dist/cli/utils/safe-interactive.d.ts.map +1 -1
  496. package/dist/cli/utils/safe-interactive.js +7 -6
  497. package/dist/cli/utils/safe-interactive.js.map +1 -1
  498. package/dist/cli/utils.d.ts.map +1 -1
  499. package/dist/cli/utils.js +58 -50
  500. package/dist/cli/utils.js.map +1 -1
  501. package/dist/cli/validation-helper.d.ts.map +1 -1
  502. package/dist/cli/validation-helper.js.map +1 -1
  503. package/dist/communication/message-bus.d.ts.map +1 -1
  504. package/dist/communication/message-bus.js +80 -74
  505. package/dist/communication/message-bus.js.map +1 -1
  506. package/dist/config/config-manager.d.ts +3 -0
  507. package/dist/config/config-manager.d.ts.map +1 -1
  508. package/dist/config/config-manager.js +23 -6
  509. package/dist/config/config-manager.js.map +1 -1
  510. package/dist/config/ruv-swarm-config.d.ts +6 -0
  511. package/dist/config/ruv-swarm-config.d.ts.map +1 -1
  512. package/dist/config/ruv-swarm-config.js +37 -22
  513. package/dist/config/ruv-swarm-config.js.map +1 -1
  514. package/dist/config/ruv-swarm-integration.d.ts.map +1 -1
  515. package/dist/config/ruv-swarm-integration.js +21 -21
  516. package/dist/config/ruv-swarm-integration.js.map +1 -1
  517. package/dist/constants/agent-types.d.ts +4 -4
  518. package/dist/constants/agent-types.d.ts.map +1 -1
  519. package/dist/constants/agent-types.js +4 -4
  520. package/dist/constants/agent-types.js.map +1 -1
  521. package/dist/coordination/advanced-scheduler.d.ts.map +1 -1
  522. package/dist/coordination/advanced-scheduler.js +6 -10
  523. package/dist/coordination/advanced-scheduler.js.map +1 -1
  524. package/dist/coordination/advanced-task-executor.d.ts.map +1 -1
  525. package/dist/coordination/advanced-task-executor.js +33 -33
  526. package/dist/coordination/advanced-task-executor.js.map +1 -1
  527. package/dist/coordination/background-executor.d.ts.map +1 -1
  528. package/dist/coordination/background-executor.js +17 -16
  529. package/dist/coordination/background-executor.js.map +1 -1
  530. package/dist/coordination/circuit-breaker.d.ts.map +1 -1
  531. package/dist/coordination/circuit-breaker.js +3 -0
  532. package/dist/coordination/circuit-breaker.js.map +1 -1
  533. package/dist/coordination/conflict-resolution.d.ts.map +1 -1
  534. package/dist/coordination/conflict-resolution.js +10 -8
  535. package/dist/coordination/conflict-resolution.js.map +1 -1
  536. package/dist/coordination/dependency-graph.d.ts.map +1 -1
  537. package/dist/coordination/dependency-graph.js +4 -3
  538. package/dist/coordination/dependency-graph.js.map +1 -1
  539. package/dist/coordination/hive-orchestrator.d.ts.map +1 -1
  540. package/dist/coordination/hive-orchestrator.js +29 -25
  541. package/dist/coordination/hive-orchestrator.js.map +1 -1
  542. package/dist/coordination/hive-protocol.d.ts.map +1 -1
  543. package/dist/coordination/hive-protocol.js +22 -23
  544. package/dist/coordination/hive-protocol.js.map +1 -1
  545. package/dist/coordination/index.d.ts +1 -1
  546. package/dist/coordination/index.d.ts.map +1 -1
  547. package/dist/coordination/index.js +1 -1
  548. package/dist/coordination/index.js.map +1 -1
  549. package/dist/coordination/load-balancer.d.ts.map +1 -1
  550. package/dist/coordination/load-balancer.js +55 -56
  551. package/dist/coordination/load-balancer.js.map +1 -1
  552. package/dist/coordination/manager.d.ts.map +1 -1
  553. package/dist/coordination/manager.js +2 -8
  554. package/dist/coordination/manager.js.map +1 -1
  555. package/dist/coordination/messaging.d.ts.map +1 -1
  556. package/dist/coordination/messaging.js +4 -4
  557. package/dist/coordination/messaging.js.map +1 -1
  558. package/dist/coordination/metrics.d.ts.map +1 -1
  559. package/dist/coordination/metrics.js +11 -9
  560. package/dist/coordination/metrics.js.map +1 -1
  561. package/dist/coordination/resources.d.ts.map +1 -1
  562. package/dist/coordination/resources.js +10 -6
  563. package/dist/coordination/resources.js.map +1 -1
  564. package/dist/coordination/scheduler.d.ts.map +1 -1
  565. package/dist/coordination/scheduler.js +4 -4
  566. package/dist/coordination/scheduler.js.map +1 -1
  567. package/dist/coordination/swarm-coordinator.d.ts.map +1 -1
  568. package/dist/coordination/swarm-coordinator.js +32 -34
  569. package/dist/coordination/swarm-coordinator.js.map +1 -1
  570. package/dist/coordination/swarm-monitor.d.ts.map +1 -1
  571. package/dist/coordination/swarm-monitor.js +17 -17
  572. package/dist/coordination/swarm-monitor.js.map +1 -1
  573. package/dist/coordination/work-stealing.d.ts.map +1 -1
  574. package/dist/coordination/work-stealing.js +3 -0
  575. package/dist/coordination/work-stealing.js.map +1 -1
  576. package/dist/core/config.d.ts +4 -0
  577. package/dist/core/config.d.ts.map +1 -1
  578. package/dist/core/config.js +28 -31
  579. package/dist/core/config.js.map +1 -1
  580. package/dist/core/event-bus.d.ts +3 -0
  581. package/dist/core/event-bus.d.ts.map +1 -1
  582. package/dist/core/event-bus.js.map +1 -1
  583. package/dist/core/json-persistence.d.ts +3 -0
  584. package/dist/core/json-persistence.d.ts.map +1 -1
  585. package/dist/core/json-persistence.js +19 -23
  586. package/dist/core/json-persistence.js.map +1 -1
  587. package/dist/core/logger.d.ts +3 -0
  588. package/dist/core/logger.d.ts.map +1 -1
  589. package/dist/core/logger.js +2 -6
  590. package/dist/core/logger.js.map +1 -1
  591. package/dist/core/orchestrator-fixed.d.ts.map +1 -1
  592. package/dist/core/orchestrator-fixed.js +4 -1
  593. package/dist/core/orchestrator-fixed.js.map +1 -1
  594. package/dist/core/orchestrator.d.ts.map +1 -1
  595. package/dist/core/orchestrator.js +66 -33
  596. package/dist/core/orchestrator.js.map +1 -1
  597. package/dist/core/persistence.d.ts +3 -0
  598. package/dist/core/persistence.d.ts.map +1 -1
  599. package/dist/core/persistence.js +25 -19
  600. package/dist/core/persistence.js.map +1 -1
  601. package/dist/enterprise/analytics-manager.d.ts.map +1 -1
  602. package/dist/enterprise/analytics-manager.js +141 -134
  603. package/dist/enterprise/analytics-manager.js.map +1 -1
  604. package/dist/enterprise/audit-manager.d.ts.map +1 -1
  605. package/dist/enterprise/audit-manager.js +144 -122
  606. package/dist/enterprise/audit-manager.js.map +1 -1
  607. package/dist/enterprise/cloud-manager.d.ts.map +1 -1
  608. package/dist/enterprise/cloud-manager.js +104 -99
  609. package/dist/enterprise/cloud-manager.js.map +1 -1
  610. package/dist/enterprise/deployment-manager.d.ts.map +1 -1
  611. package/dist/enterprise/deployment-manager.js +104 -97
  612. package/dist/enterprise/deployment-manager.js.map +1 -1
  613. package/dist/enterprise/index.d.ts +6 -6
  614. package/dist/enterprise/index.d.ts.map +1 -1
  615. package/dist/enterprise/project-manager.d.ts.map +1 -1
  616. package/dist/enterprise/project-manager.js +74 -66
  617. package/dist/enterprise/project-manager.js.map +1 -1
  618. package/dist/enterprise/security-manager.d.ts.map +1 -1
  619. package/dist/enterprise/security-manager.js +137 -129
  620. package/dist/enterprise/security-manager.js.map +1 -1
  621. package/dist/hive-mind/core/Agent.d.ts.map +1 -1
  622. package/dist/hive-mind/core/Agent.js +36 -36
  623. package/dist/hive-mind/core/Agent.js.map +1 -1
  624. package/dist/hive-mind/core/Communication.d.ts.map +1 -1
  625. package/dist/hive-mind/core/Communication.js +17 -17
  626. package/dist/hive-mind/core/Communication.js.map +1 -1
  627. package/dist/hive-mind/core/DatabaseManager.d.ts.map +1 -1
  628. package/dist/hive-mind/core/DatabaseManager.js +104 -58
  629. package/dist/hive-mind/core/DatabaseManager.js.map +1 -1
  630. package/dist/hive-mind/core/HiveMind.d.ts.map +1 -1
  631. package/dist/hive-mind/core/HiveMind.js +35 -35
  632. package/dist/hive-mind/core/HiveMind.js.map +1 -1
  633. package/dist/hive-mind/core/Memory.d.ts.map +1 -1
  634. package/dist/hive-mind/core/Memory.js +78 -71
  635. package/dist/hive-mind/core/Memory.js.map +1 -1
  636. package/dist/hive-mind/core/MemoryMonitor.d.ts.map +1 -1
  637. package/dist/hive-mind/core/MemoryMonitor.js +38 -38
  638. package/dist/hive-mind/core/MemoryMonitor.js.map +1 -1
  639. package/dist/hive-mind/core/Queen.d.ts.map +1 -1
  640. package/dist/hive-mind/core/Queen.js +110 -47
  641. package/dist/hive-mind/core/Queen.js.map +1 -1
  642. package/dist/hive-mind/integration/ConsensusEngine.d.ts.map +1 -1
  643. package/dist/hive-mind/integration/ConsensusEngine.js +25 -23
  644. package/dist/hive-mind/integration/ConsensusEngine.js.map +1 -1
  645. package/dist/hive-mind/integration/MCPToolWrapper.d.ts.map +1 -1
  646. package/dist/hive-mind/integration/MCPToolWrapper.js.map +1 -1
  647. package/dist/hive-mind/integration/SwarmOrchestrator.d.ts.map +1 -1
  648. package/dist/hive-mind/integration/SwarmOrchestrator.js +60 -58
  649. package/dist/hive-mind/integration/SwarmOrchestrator.js.map +1 -1
  650. package/dist/hive-mind/types.d.ts.map +1 -1
  651. package/dist/integration/mock-components.d.ts.map +1 -1
  652. package/dist/integration/mock-components.js +21 -21
  653. package/dist/integration/mock-components.js.map +1 -1
  654. package/dist/integration/system-integration.d.ts.map +1 -1
  655. package/dist/integration/system-integration.js +13 -11
  656. package/dist/integration/system-integration.js.map +1 -1
  657. package/dist/mcp/auth.d.ts +1 -1
  658. package/dist/mcp/auth.d.ts.map +1 -1
  659. package/dist/mcp/auth.js +8 -1
  660. package/dist/mcp/auth.js.map +1 -1
  661. package/dist/mcp/claude-code-wrapper.d.ts.map +1 -1
  662. package/dist/mcp/claude-code-wrapper.js +169 -68
  663. package/dist/mcp/claude-code-wrapper.js.map +1 -1
  664. package/dist/mcp/claude-flow-tools.d.ts.map +1 -1
  665. package/dist/mcp/claude-flow-tools.js +42 -3
  666. package/dist/mcp/claude-flow-tools.js.map +1 -1
  667. package/dist/mcp/client.d.ts.map +1 -1
  668. package/dist/mcp/client.js.map +1 -1
  669. package/dist/mcp/index.d.ts +6 -6
  670. package/dist/mcp/index.d.ts.map +1 -1
  671. package/dist/mcp/index.js +9 -9
  672. package/dist/mcp/index.js.map +1 -1
  673. package/dist/mcp/integrate-wrapper.d.ts.map +1 -1
  674. package/dist/mcp/integrate-wrapper.js +5 -7
  675. package/dist/mcp/integrate-wrapper.js.map +1 -1
  676. package/dist/mcp/lifecycle-manager.d.ts.map +1 -1
  677. package/dist/mcp/lifecycle-manager.js +8 -7
  678. package/dist/mcp/lifecycle-manager.js.map +1 -1
  679. package/dist/mcp/load-balancer.d.ts.map +1 -1
  680. package/dist/mcp/load-balancer.js +5 -1
  681. package/dist/mcp/load-balancer.js.map +1 -1
  682. package/dist/mcp/orchestration-integration.d.ts.map +1 -1
  683. package/dist/mcp/orchestration-integration.js +22 -9
  684. package/dist/mcp/orchestration-integration.js.map +1 -1
  685. package/dist/mcp/performance-monitor.d.ts.map +1 -1
  686. package/dist/mcp/performance-monitor.js +22 -19
  687. package/dist/mcp/performance-monitor.js.map +1 -1
  688. package/dist/mcp/protocol-manager.d.ts.map +1 -1
  689. package/dist/mcp/protocol-manager.js +8 -19
  690. package/dist/mcp/protocol-manager.js.map +1 -1
  691. package/dist/mcp/recovery/connection-health-monitor.d.ts.map +1 -1
  692. package/dist/mcp/recovery/connection-health-monitor.js +5 -5
  693. package/dist/mcp/recovery/connection-health-monitor.js.map +1 -1
  694. package/dist/mcp/recovery/connection-state-manager.d.ts +4 -0
  695. package/dist/mcp/recovery/connection-state-manager.d.ts.map +1 -1
  696. package/dist/mcp/recovery/connection-state-manager.js +13 -13
  697. package/dist/mcp/recovery/connection-state-manager.js.map +1 -1
  698. package/dist/mcp/recovery/fallback-coordinator.d.ts.map +1 -1
  699. package/dist/mcp/recovery/fallback-coordinator.js +5 -5
  700. package/dist/mcp/recovery/fallback-coordinator.js.map +1 -1
  701. package/dist/mcp/recovery/index.d.ts +4 -4
  702. package/dist/mcp/recovery/index.d.ts.map +1 -1
  703. package/dist/mcp/recovery/index.js +4 -4
  704. package/dist/mcp/recovery/index.js.map +1 -1
  705. package/dist/mcp/recovery/reconnection-manager.d.ts.map +1 -1
  706. package/dist/mcp/recovery/reconnection-manager.js +1 -1
  707. package/dist/mcp/recovery/reconnection-manager.js.map +1 -1
  708. package/dist/mcp/recovery/recovery-manager.d.ts.map +1 -1
  709. package/dist/mcp/recovery/recovery-manager.js +2 -4
  710. package/dist/mcp/recovery/recovery-manager.js.map +1 -1
  711. package/dist/mcp/router.d.ts.map +1 -1
  712. package/dist/mcp/router.js +3 -0
  713. package/dist/mcp/router.js.map +1 -1
  714. package/dist/mcp/ruv-swarm-tools.d.ts.map +1 -1
  715. package/dist/mcp/ruv-swarm-tools.js +132 -102
  716. package/dist/mcp/ruv-swarm-tools.js.map +1 -1
  717. package/dist/mcp/server-with-wrapper.d.ts +3 -0
  718. package/dist/mcp/server-with-wrapper.d.ts.map +1 -1
  719. package/dist/mcp/server-with-wrapper.js +2 -3
  720. package/dist/mcp/server-with-wrapper.js.map +1 -1
  721. package/dist/mcp/server-wrapper-mode.d.ts +5 -0
  722. package/dist/mcp/server-wrapper-mode.d.ts.map +1 -1
  723. package/dist/mcp/server-wrapper-mode.js +2 -3
  724. package/dist/mcp/server-wrapper-mode.js.map +1 -1
  725. package/dist/mcp/server.d.ts.map +1 -1
  726. package/dist/mcp/server.js +12 -7
  727. package/dist/mcp/server.js.map +1 -1
  728. package/dist/mcp/session-manager.d.ts.map +1 -1
  729. package/dist/mcp/session-manager.js +4 -3
  730. package/dist/mcp/session-manager.js.map +1 -1
  731. package/dist/mcp/sparc-modes.d.ts.map +1 -1
  732. package/dist/mcp/sparc-modes.js +15 -15
  733. package/dist/mcp/sparc-modes.js.map +1 -1
  734. package/dist/mcp/swarm-tools.d.ts.map +1 -1
  735. package/dist/mcp/swarm-tools.js +100 -80
  736. package/dist/mcp/swarm-tools.js.map +1 -1
  737. package/dist/mcp/tools.d.ts.map +1 -1
  738. package/dist/mcp/tools.js +28 -12
  739. package/dist/mcp/tools.js.map +1 -1
  740. package/dist/mcp/transports/base.d.ts.map +1 -1
  741. package/dist/mcp/transports/base.js +3 -0
  742. package/dist/mcp/transports/base.js.map +1 -1
  743. package/dist/mcp/transports/http.d.ts +3 -0
  744. package/dist/mcp/transports/http.d.ts.map +1 -1
  745. package/dist/mcp/transports/http.js +3 -3
  746. package/dist/mcp/transports/http.js.map +1 -1
  747. package/dist/mcp/transports/stdio.d.ts +3 -0
  748. package/dist/mcp/transports/stdio.d.ts.map +1 -1
  749. package/dist/mcp/transports/stdio.js +3 -0
  750. package/dist/mcp/transports/stdio.js.map +1 -1
  751. package/dist/memory/advanced-memory-manager.d.ts.map +1 -1
  752. package/dist/memory/advanced-memory-manager.js +109 -100
  753. package/dist/memory/advanced-memory-manager.js.map +1 -1
  754. package/dist/memory/backends/base.d.ts.map +1 -1
  755. package/dist/memory/backends/base.js +3 -0
  756. package/dist/memory/backends/base.js.map +1 -1
  757. package/dist/memory/backends/markdown.d.ts +3 -0
  758. package/dist/memory/backends/markdown.d.ts.map +1 -1
  759. package/dist/memory/backends/markdown.js +8 -8
  760. package/dist/memory/backends/markdown.js.map +1 -1
  761. package/dist/memory/backends/sqlite.d.ts +3 -0
  762. package/dist/memory/backends/sqlite.d.ts.map +1 -1
  763. package/dist/memory/backends/sqlite.js +6 -2
  764. package/dist/memory/backends/sqlite.js.map +1 -1
  765. package/dist/memory/cache.d.ts.map +1 -1
  766. package/dist/memory/cache.js +5 -3
  767. package/dist/memory/cache.js.map +1 -1
  768. package/dist/memory/distributed-memory.d.ts.map +1 -1
  769. package/dist/memory/distributed-memory.js +27 -28
  770. package/dist/memory/distributed-memory.js.map +1 -1
  771. package/dist/memory/fallback-store.d.ts +1 -0
  772. package/dist/memory/fallback-store.d.ts.map +1 -1
  773. package/dist/memory/fallback-store.js +25 -3
  774. package/dist/memory/fallback-store.js.map +1 -1
  775. package/dist/memory/in-memory-store.d.ts.map +1 -1
  776. package/dist/memory/in-memory-store.js +8 -8
  777. package/dist/memory/in-memory-store.js.map +1 -1
  778. package/dist/memory/indexer.d.ts.map +1 -1
  779. package/dist/memory/indexer.js +4 -1
  780. package/dist/memory/indexer.js.map +1 -1
  781. package/dist/memory/manager.d.ts.map +1 -1
  782. package/dist/memory/manager.js +17 -20
  783. package/dist/memory/manager.js.map +1 -1
  784. package/dist/memory/sqlite-store.d.ts +34 -0
  785. package/dist/memory/sqlite-store.d.ts.map +1 -0
  786. package/dist/memory/sqlite-store.js +14 -11
  787. package/dist/memory/sqlite-store.js.map +1 -1
  788. package/dist/memory/sqlite-wrapper.d.ts +38 -0
  789. package/dist/memory/sqlite-wrapper.d.ts.map +1 -0
  790. package/dist/memory/sqlite-wrapper.js +157 -0
  791. package/dist/memory/sqlite-wrapper.js.map +1 -0
  792. package/dist/memory/swarm-memory.d.ts.map +1 -1
  793. package/dist/memory/swarm-memory.js +37 -44
  794. package/dist/memory/swarm-memory.js.map +1 -1
  795. package/dist/migration/index.d.ts +4 -0
  796. package/dist/migration/index.d.ts.map +1 -1
  797. package/dist/migration/index.js +8 -8
  798. package/dist/migration/index.js.map +1 -1
  799. package/dist/migration/logger.d.ts.map +1 -1
  800. package/dist/migration/logger.js +5 -5
  801. package/dist/migration/logger.js.map +1 -1
  802. package/dist/migration/migration-analyzer.d.ts +3 -0
  803. package/dist/migration/migration-analyzer.d.ts.map +1 -1
  804. package/dist/migration/migration-analyzer.js +25 -20
  805. package/dist/migration/migration-analyzer.js.map +1 -1
  806. package/dist/migration/migration-runner.d.ts.map +1 -1
  807. package/dist/migration/migration-runner.js +35 -29
  808. package/dist/migration/migration-runner.js.map +1 -1
  809. package/dist/migration/migration-validator.d.ts +3 -0
  810. package/dist/migration/migration-validator.d.ts.map +1 -1
  811. package/dist/migration/migration-validator.js +22 -26
  812. package/dist/migration/migration-validator.js.map +1 -1
  813. package/dist/migration/progress-reporter.d.ts +3 -0
  814. package/dist/migration/progress-reporter.d.ts.map +1 -1
  815. package/dist/migration/progress-reporter.js +8 -8
  816. package/dist/migration/progress-reporter.js.map +1 -1
  817. package/dist/migration/rollback-manager.d.ts +3 -0
  818. package/dist/migration/rollback-manager.d.ts.map +1 -1
  819. package/dist/migration/rollback-manager.js +29 -26
  820. package/dist/migration/rollback-manager.js.map +1 -1
  821. package/dist/monitoring/diagnostics.d.ts.map +1 -1
  822. package/dist/monitoring/diagnostics.js +49 -37
  823. package/dist/monitoring/diagnostics.js.map +1 -1
  824. package/dist/monitoring/health-check.d.ts.map +1 -1
  825. package/dist/monitoring/health-check.js +24 -25
  826. package/dist/monitoring/health-check.js.map +1 -1
  827. package/dist/monitoring/real-time-monitor.d.ts.map +1 -1
  828. package/dist/monitoring/real-time-monitor.js +71 -58
  829. package/dist/monitoring/real-time-monitor.js.map +1 -1
  830. package/dist/resources/resource-manager.d.ts.map +1 -1
  831. package/dist/resources/resource-manager.js +96 -83
  832. package/dist/resources/resource-manager.js.map +1 -1
  833. package/dist/swarm/claude-flow-executor.d.ts.map +1 -1
  834. package/dist/swarm/claude-flow-executor.js +37 -31
  835. package/dist/swarm/claude-flow-executor.js.map +1 -1
  836. package/dist/swarm/coordinator.d.ts.map +1 -1
  837. package/dist/swarm/coordinator.js +330 -280
  838. package/dist/swarm/coordinator.js.map +1 -1
  839. package/dist/swarm/direct-executor.d.ts.map +1 -1
  840. package/dist/swarm/direct-executor.js +44 -37
  841. package/dist/swarm/direct-executor.js.map +1 -1
  842. package/dist/swarm/executor-v2.d.ts.map +1 -1
  843. package/dist/swarm/executor-v2.js +28 -27
  844. package/dist/swarm/executor-v2.js.map +1 -1
  845. package/dist/swarm/executor.d.ts +3 -0
  846. package/dist/swarm/executor.d.ts.map +1 -1
  847. package/dist/swarm/executor.js +58 -52
  848. package/dist/swarm/executor.js.map +1 -1
  849. package/dist/swarm/index.d.ts.map +1 -1
  850. package/dist/swarm/index.js +2 -2
  851. package/dist/swarm/index.js.map +1 -1
  852. package/dist/swarm/json-output-aggregator.d.ts.map +1 -1
  853. package/dist/swarm/json-output-aggregator.js +20 -19
  854. package/dist/swarm/json-output-aggregator.js.map +1 -1
  855. package/dist/swarm/memory.d.ts.map +1 -1
  856. package/dist/swarm/memory.js +67 -67
  857. package/dist/swarm/memory.js.map +1 -1
  858. package/dist/swarm/optimizations/async-file-manager.d.ts +4 -0
  859. package/dist/swarm/optimizations/async-file-manager.d.ts.map +1 -1
  860. package/dist/swarm/optimizations/async-file-manager.js +19 -23
  861. package/dist/swarm/optimizations/async-file-manager.js.map +1 -1
  862. package/dist/swarm/optimizations/circular-buffer.d.ts.map +1 -1
  863. package/dist/swarm/optimizations/circular-buffer.js +2 -4
  864. package/dist/swarm/optimizations/circular-buffer.js.map +1 -1
  865. package/dist/swarm/optimizations/connection-pool.d.ts.map +1 -1
  866. package/dist/swarm/optimizations/connection-pool.js +12 -13
  867. package/dist/swarm/optimizations/connection-pool.js.map +1 -1
  868. package/dist/swarm/optimizations/index.js +2 -2
  869. package/dist/swarm/optimizations/optimized-executor.d.ts.map +1 -1
  870. package/dist/swarm/optimizations/optimized-executor.js +23 -29
  871. package/dist/swarm/optimizations/optimized-executor.js.map +1 -1
  872. package/dist/swarm/optimizations/ttl-map.d.ts.map +1 -1
  873. package/dist/swarm/optimizations/ttl-map.js +4 -4
  874. package/dist/swarm/optimizations/ttl-map.js.map +1 -1
  875. package/dist/swarm/prompt-cli.d.ts.map +1 -1
  876. package/dist/swarm/prompt-cli.js +18 -13
  877. package/dist/swarm/prompt-cli.js.map +1 -1
  878. package/dist/swarm/prompt-copier-enhanced.d.ts.map +1 -1
  879. package/dist/swarm/prompt-copier-enhanced.js +12 -12
  880. package/dist/swarm/prompt-copier-enhanced.js.map +1 -1
  881. package/dist/swarm/prompt-copier.d.ts.map +1 -1
  882. package/dist/swarm/prompt-copier.js +15 -18
  883. package/dist/swarm/prompt-copier.js.map +1 -1
  884. package/dist/swarm/prompt-manager.d.ts.map +1 -1
  885. package/dist/swarm/prompt-manager.js +27 -21
  886. package/dist/swarm/prompt-manager.js.map +1 -1
  887. package/dist/swarm/prompt-utils.d.ts.map +1 -1
  888. package/dist/swarm/prompt-utils.js +34 -32
  889. package/dist/swarm/prompt-utils.js.map +1 -1
  890. package/dist/swarm/sparc-executor.d.ts.map +1 -1
  891. package/dist/swarm/sparc-executor.js +189 -123
  892. package/dist/swarm/sparc-executor.js.map +1 -1
  893. package/dist/swarm/strategies/auto.d.ts.map +1 -1
  894. package/dist/swarm/strategies/auto.js +105 -86
  895. package/dist/swarm/strategies/auto.js.map +1 -1
  896. package/dist/swarm/strategies/base.d.ts.map +1 -1
  897. package/dist/swarm/strategies/base.js +14 -11
  898. package/dist/swarm/strategies/base.js.map +1 -1
  899. package/dist/swarm/strategies/research.d.ts.map +1 -1
  900. package/dist/swarm/strategies/research.js +76 -71
  901. package/dist/swarm/strategies/research.js.map +1 -1
  902. package/dist/swarm/types.d.ts.map +1 -1
  903. package/dist/swarm/types.js +3 -0
  904. package/dist/swarm/types.js.map +1 -1
  905. package/dist/swarm/workers/copy-worker.js +4 -4
  906. package/dist/swarm/workers/copy-worker.js.map +1 -1
  907. package/dist/task/commands.d.ts.map +1 -1
  908. package/dist/task/commands.js +11 -7
  909. package/dist/task/commands.js.map +1 -1
  910. package/dist/task/coordination.d.ts.map +1 -1
  911. package/dist/task/coordination.js +75 -70
  912. package/dist/task/coordination.js.map +1 -1
  913. package/dist/task/engine.d.ts.map +1 -1
  914. package/dist/task/engine.js +34 -32
  915. package/dist/task/engine.js.map +1 -1
  916. package/dist/task/index.d.ts +3 -3
  917. package/dist/task/index.d.ts.map +1 -1
  918. package/dist/task/index.js +11 -11
  919. package/dist/task/index.js.map +1 -1
  920. package/dist/terminal/adapters/native.d.ts.map +1 -1
  921. package/dist/terminal/adapters/native.js +6 -6
  922. package/dist/terminal/adapters/native.js.map +1 -1
  923. package/dist/terminal/adapters/vscode.d.ts +3 -0
  924. package/dist/terminal/adapters/vscode.d.ts.map +1 -1
  925. package/dist/terminal/adapters/vscode.js +6 -4
  926. package/dist/terminal/adapters/vscode.js.map +1 -1
  927. package/dist/terminal/manager.d.ts.map +1 -1
  928. package/dist/terminal/manager.js +6 -8
  929. package/dist/terminal/manager.js.map +1 -1
  930. package/dist/terminal/pool.d.ts.map +1 -1
  931. package/dist/terminal/pool.js +3 -0
  932. package/dist/terminal/pool.js.map +1 -1
  933. package/dist/terminal/session.d.ts.map +1 -1
  934. package/dist/terminal/session.js +6 -2
  935. package/dist/terminal/session.js.map +1 -1
  936. package/dist/ui/hive-dashboard.d.ts.map +1 -1
  937. package/dist/ui/hive-dashboard.js +52 -33
  938. package/dist/ui/hive-dashboard.js.map +1 -1
  939. package/dist/utils/error-handler.d.ts.map +1 -1
  940. package/dist/utils/error-handler.js +1 -1
  941. package/dist/utils/error-handler.js.map +1 -1
  942. package/dist/utils/errors.d.ts.map +1 -1
  943. package/dist/utils/errors.js.map +1 -1
  944. package/dist/utils/helpers.d.ts +3 -0
  945. package/dist/utils/helpers.d.ts.map +1 -1
  946. package/dist/utils/helpers.js +5 -8
  947. package/dist/utils/helpers.js.map +1 -1
  948. package/dist/utils/npx-isolated-cache.js +3 -3
  949. package/dist/utils/npx-isolated-cache.js.map +1 -1
  950. package/dist/utils/paths.d.ts.map +1 -1
  951. package/dist/utils/paths.js +8 -4
  952. package/dist/utils/paths.js.map +1 -1
  953. package/dist/utils/type-guards.d.ts +1 -1
  954. package/dist/utils/type-guards.d.ts.map +1 -1
  955. package/dist/utils/type-guards.js +11 -10
  956. package/dist/utils/type-guards.js.map +1 -1
  957. package/package.json +7 -6
  958. package/src/adapters/cliffy-node.ts +27 -22
  959. package/src/agents/agent-manager.ts +145 -121
  960. package/src/agents/agent-registry.ts +77 -70
  961. package/src/api/claude-api-errors.ts +248 -0
  962. package/src/api/claude-client-enhanced.ts +616 -0
  963. package/src/api/claude-client.ts +338 -49
  964. package/src/api/routes/analysis.js +750 -735
  965. package/src/cli/__tests__/command-registry.test.js +42 -32
  966. package/src/cli/__tests__/simple-cli.test.js +42 -37
  967. package/src/cli/__tests__/utils.test.js +9 -9
  968. package/src/cli/agents/README.md +30 -4
  969. package/src/cli/agents/analyst.ts +161 -163
  970. package/src/cli/agents/architect.ts +126 -131
  971. package/src/cli/agents/base-agent.ts +48 -47
  972. package/src/cli/agents/capabilities.ts +87 -85
  973. package/src/cli/agents/coder.ts +127 -120
  974. package/src/cli/agents/coordinator.ts +72 -72
  975. package/src/cli/agents/hive-agents.ts +96 -70
  976. package/src/cli/agents/index.ts +70 -55
  977. package/src/cli/agents/researcher.ts +63 -74
  978. package/src/cli/agents/tester.ts +91 -98
  979. package/src/cli/cli-core.ts +56 -47
  980. package/src/cli/command-registry.js +82 -83
  981. package/src/cli/commands/advanced-memory-commands.ts +210 -142
  982. package/src/cli/commands/agent-simple.ts +146 -114
  983. package/src/cli/commands/agent.ts +119 -95
  984. package/src/cli/commands/claude-api.ts +19 -15
  985. package/src/cli/commands/claude.ts +96 -88
  986. package/src/cli/commands/config-integration.ts +120 -101
  987. package/src/cli/commands/config.ts +10 -8
  988. package/src/cli/commands/enterprise.ts +323 -187
  989. package/src/cli/commands/help-new.ts +57 -55
  990. package/src/cli/commands/help.ts +162 -159
  991. package/src/cli/commands/hive-mind/index.ts +3 -3
  992. package/src/cli/commands/hive-mind/init.ts +19 -12
  993. package/src/cli/commands/hive-mind/optimize-memory.ts +83 -53
  994. package/src/cli/commands/hive-mind/pause.ts +27 -25
  995. package/src/cli/commands/hive-mind/ps.ts +43 -37
  996. package/src/cli/commands/hive-mind/resume.ts +26 -26
  997. package/src/cli/commands/hive-mind/spawn.ts +37 -29
  998. package/src/cli/commands/hive-mind/status.ts +51 -51
  999. package/src/cli/commands/hive-mind/stop.ts +56 -51
  1000. package/src/cli/commands/hive-mind/task.ts +65 -54
  1001. package/src/cli/commands/hive-mind/wizard.ts +181 -167
  1002. package/src/cli/commands/hive.ts +136 -96
  1003. package/src/cli/commands/hook-types.ts +2 -2
  1004. package/src/cli/commands/hook-validator.ts +8 -4
  1005. package/src/cli/commands/hook.ts +44 -42
  1006. package/src/cli/commands/index.ts +1162 -1031
  1007. package/src/cli/commands/mcp.ts +105 -94
  1008. package/src/cli/commands/memory.ts +24 -21
  1009. package/src/cli/commands/migrate.ts +24 -24
  1010. package/src/cli/commands/monitor.ts +123 -93
  1011. package/src/cli/commands/ruv-swarm.ts +131 -122
  1012. package/src/cli/commands/session.ts +60 -45
  1013. package/src/cli/commands/sparc.ts +170 -139
  1014. package/src/cli/commands/start/event-emitter.ts +2 -2
  1015. package/src/cli/commands/start/index.ts +1 -1
  1016. package/src/cli/commands/start/process-manager.ts +30 -47
  1017. package/src/cli/commands/start/process-ui-simple.ts +60 -49
  1018. package/src/cli/commands/start/process-ui.ts +1 -1
  1019. package/src/cli/commands/start/start-command.ts +104 -75
  1020. package/src/cli/commands/start/system-monitor.ts +35 -41
  1021. package/src/cli/commands/start/types.ts +3 -3
  1022. package/src/cli/commands/start.ts +1 -1
  1023. package/src/cli/commands/status.ts +67 -67
  1024. package/src/cli/commands/swarm-spawn.ts +21 -12
  1025. package/src/cli/commands/swarm.ts +221 -150
  1026. package/src/cli/commands/task.ts +55 -55
  1027. package/src/cli/commands/workflow.ts +174 -157
  1028. package/src/cli/completion.ts +34 -19
  1029. package/src/cli/create-enhanced-task.js +49 -17
  1030. package/src/cli/formatter.ts +38 -37
  1031. package/src/cli/help-formatter.js +23 -33
  1032. package/src/cli/help-formatter.ts +24 -34
  1033. package/src/cli/help-text.js +71 -61
  1034. package/src/cli/index-remote.ts +12 -9
  1035. package/src/cli/index.ts +77 -67
  1036. package/src/cli/init/batch-tools.ts +4 -5
  1037. package/src/cli/init/claude-config.ts +125 -118
  1038. package/src/cli/init/directory-structure.ts +10 -11
  1039. package/src/cli/init/index.ts +13 -13
  1040. package/src/cli/init/sparc-environment.ts +90 -74
  1041. package/src/cli/init/swarm-commands.ts +5 -6
  1042. package/src/cli/init/utils.ts +1 -1
  1043. package/src/cli/main.ts +9 -10
  1044. package/src/cli/node-compat.js +26 -19
  1045. package/src/cli/node-repl.ts +104 -87
  1046. package/src/cli/repl.ts +190 -158
  1047. package/src/cli/runtime-detector.js +24 -19
  1048. package/src/cli/simple-cli.js +460 -385
  1049. package/src/cli/simple-cli.ts +426 -366
  1050. package/src/cli/simple-commands/__tests__/agent.test.js +49 -55
  1051. package/src/cli/simple-commands/__tests__/memory.test.js +4 -401
  1052. package/src/cli/simple-commands/__tests__/swarm.test.js +49 -55
  1053. package/src/cli/simple-commands/__tests__/task.test.js +4 -478
  1054. package/src/cli/simple-commands/agent.js +27 -27
  1055. package/src/cli/simple-commands/analysis.js +179 -161
  1056. package/src/cli/simple-commands/automation.js +226 -205
  1057. package/src/cli/simple-commands/batch-manager.js +98 -88
  1058. package/src/cli/simple-commands/config.js +65 -60
  1059. package/src/cli/simple-commands/coordination.js +220 -184
  1060. package/src/cli/simple-commands/enhanced-ui-views.js +142 -115
  1061. package/src/cli/simple-commands/enhanced-webui-complete.js +267 -167
  1062. package/src/cli/simple-commands/fix-hook-variables.js +73 -67
  1063. package/src/cli/simple-commands/github/gh-coordinator.js +63 -53
  1064. package/src/cli/simple-commands/github/github-api.js +45 -47
  1065. package/src/cli/simple-commands/github.js +33 -34
  1066. package/src/cli/simple-commands/hive-mind/auto-save-middleware.js +50 -46
  1067. package/src/cli/simple-commands/hive-mind/communication.js +198 -185
  1068. package/src/cli/simple-commands/hive-mind/core.js +289 -304
  1069. package/src/cli/simple-commands/hive-mind/db-optimizer.js +278 -168
  1070. package/src/cli/simple-commands/hive-mind/mcp-wrapper.js +676 -263
  1071. package/src/cli/simple-commands/hive-mind/memory.js +356 -287
  1072. package/src/cli/simple-commands/hive-mind/performance-optimizer.js +88 -79
  1073. package/src/cli/simple-commands/hive-mind/performance-test.js +61 -49
  1074. package/src/cli/simple-commands/hive-mind/queen.js +223 -213
  1075. package/src/cli/simple-commands/hive-mind/session-manager.js +522 -240
  1076. package/src/cli/simple-commands/hive-mind-optimize.js +69 -65
  1077. package/src/cli/simple-commands/hive-mind-wizard.js +213 -211
  1078. package/src/cli/simple-commands/hive-mind.js +790 -443
  1079. package/src/cli/simple-commands/hive.js +12 -12
  1080. package/src/cli/simple-commands/hook-safety.js +114 -111
  1081. package/src/cli/simple-commands/hooks.js +1077 -1017
  1082. package/src/cli/simple-commands/init/README.md +8 -1
  1083. package/src/cli/simple-commands/init/VALIDATION_ROLLBACK.md +27 -1
  1084. package/src/cli/simple-commands/init/batch-init.js +105 -100
  1085. package/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +6 -6
  1086. package/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +6 -6
  1087. package/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +64 -37
  1088. package/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +85 -71
  1089. package/src/cli/simple-commands/init/claude-commands/slash-commands.js +40 -19
  1090. package/src/cli/simple-commands/init/claude-commands/sparc-commands.js +149 -63
  1091. package/src/cli/simple-commands/init/copy-revised-templates.js +175 -0
  1092. package/src/cli/simple-commands/init/executable-wrapper.js +13 -10
  1093. package/src/cli/simple-commands/init/gitignore-updater.js +22 -22
  1094. package/src/cli/simple-commands/init/help.js +4 -2
  1095. package/src/cli/simple-commands/init/index.js +451 -428
  1096. package/src/cli/simple-commands/init/performance-monitor.js +71 -64
  1097. package/src/cli/simple-commands/init/rollback/backup-manager.js +44 -64
  1098. package/src/cli/simple-commands/init/rollback/index.js +31 -39
  1099. package/src/cli/simple-commands/init/rollback/recovery-manager.js +71 -101
  1100. package/src/cli/simple-commands/init/rollback/rollback-executor.js +34 -53
  1101. package/src/cli/simple-commands/init/rollback/state-tracker.js +38 -49
  1102. package/src/cli/simple-commands/init/sparc/roo-readme.js +1 -1
  1103. package/src/cli/simple-commands/init/sparc/roomodes-config.js +99 -77
  1104. package/src/cli/simple-commands/init/sparc/workflows.js +37 -33
  1105. package/src/cli/simple-commands/init/sparc-structure.js +9 -10
  1106. package/src/cli/simple-commands/init/template-copier.js +583 -0
  1107. package/src/cli/simple-commands/init/templates/CLAUDE.md +94 -26
  1108. package/src/cli/simple-commands/init/templates/claude-flow-universal +9 -7
  1109. package/src/cli/simple-commands/init/templates/claude-md.js +1 -1
  1110. package/src/cli/simple-commands/init/templates/commands/analysis/bottleneck-detect.md +15 -3
  1111. package/src/cli/simple-commands/init/templates/commands/automation/auto-agent.md +12 -2
  1112. package/src/cli/simple-commands/init/templates/commands/coordination/swarm-init.md +10 -1
  1113. package/src/cli/simple-commands/init/templates/commands/github/github-swarm.md +18 -5
  1114. package/src/cli/simple-commands/init/templates/commands/hooks/notification.md +12 -1
  1115. package/src/cli/simple-commands/init/templates/commands/hooks/post-command.md +12 -1
  1116. package/src/cli/simple-commands/init/templates/commands/hooks/post-edit.md +12 -1
  1117. package/src/cli/simple-commands/init/templates/commands/hooks/post-task.md +12 -1
  1118. package/src/cli/simple-commands/init/templates/commands/hooks/pre-command.md +12 -1
  1119. package/src/cli/simple-commands/init/templates/commands/hooks/pre-edit.md +12 -1
  1120. package/src/cli/simple-commands/init/templates/commands/hooks/pre-search.md +13 -6
  1121. package/src/cli/simple-commands/init/templates/commands/hooks/pre-task.md +12 -1
  1122. package/src/cli/simple-commands/init/templates/commands/hooks/session-end.md +12 -1
  1123. package/src/cli/simple-commands/init/templates/commands/hooks/session-restore.md +13 -5
  1124. package/src/cli/simple-commands/init/templates/commands/hooks/session-start.md +12 -1
  1125. package/src/cli/simple-commands/init/templates/coordination-md.js +1 -1
  1126. package/src/cli/simple-commands/init/templates/coordination.md +16 -0
  1127. package/src/cli/simple-commands/init/templates/enhanced-templates.js +116 -113
  1128. package/src/cli/simple-commands/init/templates/memory-bank-md.js +1 -1
  1129. package/src/cli/simple-commands/init/templates/memory-bank.md +16 -0
  1130. package/src/cli/simple-commands/init/templates/readme-files.js +1 -1
  1131. package/src/cli/simple-commands/init/templates/safe-hook-patterns.js +176 -127
  1132. package/src/cli/simple-commands/init/templates/settings.json +2 -5
  1133. package/src/cli/simple-commands/init/templates/settings.json.enhanced +35 -0
  1134. package/src/cli/simple-commands/init/templates/sparc-modes.js +637 -26
  1135. package/src/cli/simple-commands/init/validation/config-validator.js +17 -28
  1136. package/src/cli/simple-commands/init/validation/health-checker.js +54 -62
  1137. package/src/cli/simple-commands/init/validation/index.js +18 -23
  1138. package/src/cli/simple-commands/init/validation/mode-validator.js +22 -32
  1139. package/src/cli/simple-commands/init/validation/post-init-validator.js +25 -26
  1140. package/src/cli/simple-commands/init/validation/pre-init-validator.js +32 -36
  1141. package/src/cli/simple-commands/init/validation/test-runner.js +55 -63
  1142. package/src/cli/simple-commands/init.js +1 -1
  1143. package/src/cli/simple-commands/mcp-integration-layer.js +179 -110
  1144. package/src/cli/simple-commands/mcp.js +55 -48
  1145. package/src/cli/simple-commands/memory.js +62 -56
  1146. package/src/cli/simple-commands/migrate-hooks.js +9 -10
  1147. package/src/cli/simple-commands/monitor.js +87 -67
  1148. package/src/cli/simple-commands/process-ui-enhanced.js +207 -155
  1149. package/src/cli/simple-commands/process-ui.js +65 -56
  1150. package/src/cli/simple-commands/realtime-update-system.js +136 -129
  1151. package/src/cli/simple-commands/sparc/architecture.js +352 -251
  1152. package/src/cli/simple-commands/sparc/commands.js +122 -94
  1153. package/src/cli/simple-commands/sparc/completion.js +274 -199
  1154. package/src/cli/simple-commands/sparc/coordinator.js +217 -169
  1155. package/src/cli/simple-commands/sparc/index.js +40 -36
  1156. package/src/cli/simple-commands/sparc/phase-base.js +72 -58
  1157. package/src/cli/simple-commands/sparc/pseudocode.js +275 -159
  1158. package/src/cli/simple-commands/sparc/refinement.js +306 -212
  1159. package/src/cli/simple-commands/sparc/specification.js +164 -94
  1160. package/src/cli/simple-commands/sparc-modes/architect.js +1 -1
  1161. package/src/cli/simple-commands/sparc-modes/ask.js +1 -1
  1162. package/src/cli/simple-commands/sparc-modes/code.js +1 -1
  1163. package/src/cli/simple-commands/sparc-modes/debug.js +1 -1
  1164. package/src/cli/simple-commands/sparc-modes/devops.js +1 -1
  1165. package/src/cli/simple-commands/sparc-modes/docs-writer.js +1 -1
  1166. package/src/cli/simple-commands/sparc-modes/generic.js +1 -1
  1167. package/src/cli/simple-commands/sparc-modes/index.js +15 -15
  1168. package/src/cli/simple-commands/sparc-modes/integration.js +1 -1
  1169. package/src/cli/simple-commands/sparc-modes/mcp.js +1 -1
  1170. package/src/cli/simple-commands/sparc-modes/monitoring.js +1 -1
  1171. package/src/cli/simple-commands/sparc-modes/optimization.js +1 -1
  1172. package/src/cli/simple-commands/sparc-modes/security-review.js +1 -1
  1173. package/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +1 -1
  1174. package/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +1 -1
  1175. package/src/cli/simple-commands/sparc-modes/supabase-admin.js +1 -1
  1176. package/src/cli/simple-commands/sparc-modes/swarm.js +52 -52
  1177. package/src/cli/simple-commands/sparc-modes/tdd.js +1 -1
  1178. package/src/cli/simple-commands/sparc-modes/tutorial.js +1 -1
  1179. package/src/cli/simple-commands/sparc.js +87 -69
  1180. package/src/cli/simple-commands/start-ui.js +21 -20
  1181. package/src/cli/simple-commands/start-wrapper.js +29 -31
  1182. package/src/cli/simple-commands/start.js +1 -1
  1183. package/src/cli/simple-commands/status.js +53 -47
  1184. package/src/cli/simple-commands/swarm-executor.js +47 -57
  1185. package/src/cli/simple-commands/swarm-metrics-integration.js +119 -79
  1186. package/src/cli/simple-commands/swarm-ui.js +120 -118
  1187. package/src/cli/simple-commands/swarm-webui-integration.js +48 -27
  1188. package/src/cli/simple-commands/swarm.js +216 -181
  1189. package/src/cli/simple-commands/task.js +29 -29
  1190. package/src/cli/simple-commands/timestamp-fix.js +28 -25
  1191. package/src/cli/simple-commands/tool-execution-framework.js +115 -118
  1192. package/src/cli/simple-commands/training.js +219 -194
  1193. package/src/cli/simple-commands/web-server.js +118 -117
  1194. package/src/cli/simple-commands/webui-validator.js +4 -3
  1195. package/src/cli/simple-mcp.ts +14 -17
  1196. package/src/cli/simple-orchestrator.ts +113 -101
  1197. package/src/cli/swarm-standalone.js +20 -21
  1198. package/src/cli/ui/compatible-ui.ts +55 -44
  1199. package/src/cli/ui/fallback-handler.ts +19 -16
  1200. package/src/cli/ui/index.ts +14 -15
  1201. package/src/cli/utils/environment-detector.ts +75 -67
  1202. package/src/cli/utils/interactive-detector.js +17 -11
  1203. package/src/cli/utils/prompt-defaults.ts +32 -28
  1204. package/src/cli/utils/safe-interactive.js +21 -20
  1205. package/src/cli/utils.js +127 -110
  1206. package/src/cli/validation-helper.js +16 -21
  1207. package/src/cli/validation-helper.ts +21 -34
  1208. package/src/communication/message-bus.ts +137 -124
  1209. package/src/config/config-manager.ts +62 -30
  1210. package/src/config/ruv-swarm-config.ts +105 -86
  1211. package/src/config/ruv-swarm-integration.ts +38 -38
  1212. package/src/constants/agent-types.ts +9 -8
  1213. package/src/coordination/README.md +54 -31
  1214. package/src/coordination/advanced-scheduler.ts +23 -26
  1215. package/src/coordination/advanced-task-executor.ts +74 -68
  1216. package/src/coordination/background-executor.ts +33 -30
  1217. package/src/coordination/circuit-breaker.ts +26 -27
  1218. package/src/coordination/conflict-resolution.ts +18 -27
  1219. package/src/coordination/dependency-graph.ts +15 -18
  1220. package/src/coordination/hive-orchestrator.ts +111 -81
  1221. package/src/coordination/hive-protocol.ts +68 -77
  1222. package/src/coordination/index.ts +3 -7
  1223. package/src/coordination/load-balancer.ts +115 -105
  1224. package/src/coordination/manager.ts +38 -51
  1225. package/src/coordination/messaging.ts +19 -29
  1226. package/src/coordination/metrics.ts +57 -60
  1227. package/src/coordination/resources.ts +32 -37
  1228. package/src/coordination/scheduler.ts +29 -30
  1229. package/src/coordination/swarm-coordinator.ts +81 -70
  1230. package/src/coordination/swarm-monitor.ts +90 -69
  1231. package/src/coordination/work-stealing.ts +6 -13
  1232. package/src/core/config.ts +148 -143
  1233. package/src/core/event-bus.ts +5 -6
  1234. package/src/core/json-persistence.ts +27 -34
  1235. package/src/core/logger.ts +13 -16
  1236. package/src/core/orchestrator-fixed.ts +33 -32
  1237. package/src/core/orchestrator.ts +166 -159
  1238. package/src/core/persistence.ts +47 -36
  1239. package/src/enterprise/analytics-manager.ts +242 -233
  1240. package/src/enterprise/audit-manager.ts +238 -184
  1241. package/src/enterprise/cloud-manager.ts +167 -151
  1242. package/src/enterprise/deployment-manager.ts +223 -180
  1243. package/src/enterprise/index.ts +7 -7
  1244. package/src/enterprise/project-manager.ts +151 -133
  1245. package/src/enterprise/security-manager.ts +278 -223
  1246. package/src/hive-mind/core/Agent.ts +112 -109
  1247. package/src/hive-mind/core/Communication.ts +67 -69
  1248. package/src/hive-mind/core/DatabaseManager.ts +371 -179
  1249. package/src/hive-mind/core/HiveMind.ts +100 -96
  1250. package/src/hive-mind/core/Memory.ts +304 -295
  1251. package/src/hive-mind/core/MemoryMonitor.ts +46 -47
  1252. package/src/hive-mind/core/Queen.ts +187 -114
  1253. package/src/hive-mind/index.ts +2 -2
  1254. package/src/hive-mind/integration/ConsensusEngine.ts +88 -92
  1255. package/src/hive-mind/integration/MCPToolWrapper.ts +20 -72
  1256. package/src/hive-mind/integration/SwarmOrchestrator.ts +173 -165
  1257. package/src/hive-mind/types.ts +24 -12
  1258. package/src/integration/mock-components.ts +42 -30
  1259. package/src/integration/system-integration.ts +79 -78
  1260. package/src/integration/types.ts +7 -7
  1261. package/src/mcp/README.md +23 -4
  1262. package/src/mcp/auth.ts +25 -18
  1263. package/src/mcp/claude-code-wrapper.ts +257 -150
  1264. package/src/mcp/claude-flow-tools.ts +52 -13
  1265. package/src/mcp/client.ts +15 -13
  1266. package/src/mcp/index.ts +22 -27
  1267. package/src/mcp/integrate-wrapper.ts +18 -18
  1268. package/src/mcp/lifecycle-manager.ts +30 -27
  1269. package/src/mcp/load-balancer.ts +10 -11
  1270. package/src/mcp/mcp-server.js +662 -351
  1271. package/src/mcp/orchestration-integration.ts +32 -17
  1272. package/src/mcp/performance-monitor.ts +65 -51
  1273. package/src/mcp/protocol-manager.ts +36 -52
  1274. package/src/mcp/recovery/connection-health-monitor.ts +40 -35
  1275. package/src/mcp/recovery/connection-state-manager.ts +52 -50
  1276. package/src/mcp/recovery/fallback-coordinator.ts +24 -24
  1277. package/src/mcp/recovery/index.ts +23 -4
  1278. package/src/mcp/recovery/reconnection-manager.ts +14 -15
  1279. package/src/mcp/recovery/recovery-manager.ts +52 -68
  1280. package/src/mcp/router.ts +1 -2
  1281. package/src/mcp/ruv-swarm-tools.ts +167 -138
  1282. package/src/mcp/ruv-swarm-wrapper.js +31 -23
  1283. package/src/mcp/server-with-wrapper.ts +4 -5
  1284. package/src/mcp/server-wrapper-mode.ts +5 -6
  1285. package/src/mcp/server.ts +45 -40
  1286. package/src/mcp/session-manager.ts +8 -11
  1287. package/src/mcp/sparc-modes.ts +29 -28
  1288. package/src/mcp/swarm-tools.ts +131 -114
  1289. package/src/mcp/tests/mcp-integration.test.ts +49 -55
  1290. package/src/mcp/tools.ts +53 -38
  1291. package/src/mcp/transports/base.ts +4 -5
  1292. package/src/mcp/transports/http.ts +45 -42
  1293. package/src/mcp/transports/stdio.ts +9 -12
  1294. package/src/memory/README.md +37 -27
  1295. package/src/memory/advanced-memory-manager.ts +336 -279
  1296. package/src/memory/backends/base.ts +4 -5
  1297. package/src/memory/backends/markdown.ts +16 -22
  1298. package/src/memory/backends/sqlite.ts +40 -18
  1299. package/src/memory/cache.ts +18 -18
  1300. package/src/memory/distributed-memory.ts +84 -92
  1301. package/src/memory/enhanced-examples.js +68 -59
  1302. package/src/memory/enhanced-memory.js +99 -80
  1303. package/src/memory/fallback-store.js +49 -8
  1304. package/src/memory/in-memory-store.js +31 -27
  1305. package/src/memory/index.js +4 -4
  1306. package/src/memory/indexer.ts +6 -10
  1307. package/src/memory/manager.ts +45 -59
  1308. package/src/memory/migration.js +107 -90
  1309. package/src/memory/shared-memory.js +155 -157
  1310. package/src/memory/sqlite-store.js +78 -62
  1311. package/src/memory/sqlite-wrapper.js +173 -0
  1312. package/src/memory/swarm-memory.js +138 -131
  1313. package/src/memory/swarm-memory.ts +74 -75
  1314. package/src/memory/test-example.js +28 -30
  1315. package/src/migration/README.md +25 -9
  1316. package/src/migration/index.ts +13 -14
  1317. package/src/migration/logger.ts +9 -7
  1318. package/src/migration/migration-analyzer.ts +66 -52
  1319. package/src/migration/migration-manifest.json +2 -6
  1320. package/src/migration/migration-runner.ts +86 -63
  1321. package/src/migration/migration-validator.ts +93 -68
  1322. package/src/migration/package.json +1 -1
  1323. package/src/migration/progress-reporter.ts +25 -21
  1324. package/src/migration/rollback-manager.ts +79 -63
  1325. package/src/migration/tests/migration-system.test.ts +4 -491
  1326. package/src/migration/tsconfig.json +3 -10
  1327. package/src/migration/types.ts +1 -1
  1328. package/src/monitoring/diagnostics.ts +123 -97
  1329. package/src/monitoring/health-check.ts +45 -51
  1330. package/src/monitoring/real-time-monitor.ts +105 -92
  1331. package/src/resources/resource-manager.ts +205 -159
  1332. package/src/swarm/__tests__/integration.test.ts +59 -65
  1333. package/src/swarm/__tests__/prompt-copier.test.ts +27 -27
  1334. package/src/swarm/claude-flow-executor.ts +50 -49
  1335. package/src/swarm/coordinator.ts +727 -635
  1336. package/src/swarm/direct-executor.ts +80 -86
  1337. package/src/swarm/executor-v2.ts +81 -66
  1338. package/src/swarm/executor.ts +124 -124
  1339. package/src/swarm/index.ts +7 -8
  1340. package/src/swarm/json-output-aggregator.ts +56 -40
  1341. package/src/swarm/memory.ts +152 -147
  1342. package/src/swarm/optimizations/README.md +20 -12
  1343. package/src/swarm/optimizations/__tests__/optimization.test.ts +84 -87
  1344. package/src/swarm/optimizations/async-file-manager.ts +70 -80
  1345. package/src/swarm/optimizations/circular-buffer.ts +37 -37
  1346. package/src/swarm/optimizations/connection-pool.ts +64 -64
  1347. package/src/swarm/optimizations/index.ts +4 -4
  1348. package/src/swarm/optimizations/migration-guide.md +27 -16
  1349. package/src/swarm/optimizations/optimized-executor.ts +104 -114
  1350. package/src/swarm/optimizations/ttl-map.ts +66 -63
  1351. package/src/swarm/prompt-cli.ts +48 -42
  1352. package/src/swarm/prompt-copier-enhanced.ts +54 -55
  1353. package/src/swarm/prompt-copier.ts +59 -65
  1354. package/src/swarm/prompt-copying-README.md +49 -33
  1355. package/src/swarm/prompt-manager.ts +69 -63
  1356. package/src/swarm/prompt-utils.ts +71 -66
  1357. package/src/swarm/sparc-executor.ts +298 -225
  1358. package/src/swarm/strategies/auto.ts +367 -252
  1359. package/src/swarm/strategies/base.ts +24 -20
  1360. package/src/swarm/strategies/research.ts +144 -124
  1361. package/src/swarm/types.ts +340 -309
  1362. package/src/swarm/workers/copy-worker.ts +12 -13
  1363. package/src/task/README.md +99 -70
  1364. package/src/task/commands.ts +16 -8
  1365. package/src/task/coordination.ts +209 -162
  1366. package/src/task/engine.ts +81 -65
  1367. package/src/task/index.ts +28 -31
  1368. package/src/templates/claude-optimized/.claude/BATCHTOOLS_BEST_PRACTICES.md +479 -481
  1369. package/src/templates/claude-optimized/.claude/BATCHTOOLS_GUIDE.md +210 -188
  1370. package/src/templates/claude-optimized/.claude/MIGRATION_GUIDE.md +151 -105
  1371. package/src/templates/claude-optimized/.claude/PERFORMANCE_BENCHMARKS.md +102 -87
  1372. package/src/templates/claude-optimized/.claude/commands/claude-flow-help.md +18 -1
  1373. package/src/templates/claude-optimized/.claude/commands/claude-flow-memory.md +17 -1
  1374. package/src/templates/claude-optimized/.claude/commands/claude-flow-swarm.md +21 -1
  1375. package/src/templates/claude-optimized/.claude/commands/sparc/architect.md +11 -4
  1376. package/src/templates/claude-optimized/.claude/commands/sparc/ask.md +16 -10
  1377. package/src/templates/claude-optimized/.claude/commands/sparc/code.md +26 -7
  1378. package/src/templates/claude-optimized/.claude/commands/sparc/debug.md +14 -4
  1379. package/src/templates/claude-optimized/.claude/commands/sparc/devops.md +23 -10
  1380. package/src/templates/claude-optimized/.claude/commands/sparc/docs-writer.md +8 -4
  1381. package/src/templates/claude-optimized/.claude/commands/sparc/integration.md +43 -27
  1382. package/src/templates/claude-optimized/.claude/commands/sparc/mcp.md +15 -1
  1383. package/src/templates/claude-optimized/.claude/commands/sparc/post-deployment-monitoring-mode.md +45 -30
  1384. package/src/templates/claude-optimized/.claude/commands/sparc/refinement-optimization-mode.md +23 -13
  1385. package/src/templates/claude-optimized/.claude/commands/sparc/security-review.md +31 -17
  1386. package/src/templates/claude-optimized/.claude/commands/sparc/sparc.md +54 -47
  1387. package/src/templates/claude-optimized/.claude/commands/sparc/spec-pseudocode.md +27 -17
  1388. package/src/templates/claude-optimized/.claude/commands/sparc/supabase-admin.md +18 -4
  1389. package/src/templates/claude-optimized/.claude/commands/sparc/tdd.md +23 -9
  1390. package/src/templates/claude-optimized/.claude/commands/sparc/tutorial.md +22 -16
  1391. package/src/templates/claude-optimized/.claude/commands/sparc.md +20 -1
  1392. package/src/templates/claude-optimized/README.md +10 -1
  1393. package/src/templates/claude-optimized/SUMMARY.md +23 -1
  1394. package/src/templates/claude-optimized/deploy-to-project.js +22 -10
  1395. package/src/templates/claude-optimized/install-template.js +14 -10
  1396. package/src/templates/claude-optimized/manifest.json +1 -1
  1397. package/src/templates/claude-optimized/package.json +1 -1
  1398. package/src/templates/claude-optimized/template-manager.js +8 -8
  1399. package/src/templates/claude-optimized/validate-template.js +33 -23
  1400. package/src/terminal/adapters/base.ts +1 -1
  1401. package/src/terminal/adapters/native.ts +47 -47
  1402. package/src/terminal/adapters/vscode.ts +21 -28
  1403. package/src/terminal/manager.ts +27 -22
  1404. package/src/terminal/pool.ts +24 -27
  1405. package/src/terminal/session.ts +18 -18
  1406. package/src/terminal/vscode-bridge.ts +21 -21
  1407. package/src/tests/validation-consistency.test.ts +4 -4
  1408. package/src/types/cliffy.d.ts +11 -14
  1409. package/src/types/global.d.ts +1 -2
  1410. package/src/types/index.ts +2 -2
  1411. package/src/types/mcp.d.ts +11 -17
  1412. package/src/types/vscode.d.ts +18 -5
  1413. package/src/ui/console/README-analysis-tools.md +52 -2
  1414. package/src/ui/console/README.md +33 -1
  1415. package/src/ui/console/WORKFLOW_DESIGNER_README.md +81 -22
  1416. package/src/ui/console/analysis-tools.html +282 -261
  1417. package/src/ui/console/analytics.html +329 -326
  1418. package/src/ui/console/index.html +221 -209
  1419. package/src/ui/console/js/analysis-tools.js +815 -754
  1420. package/src/ui/console/js/command-handler.js +226 -196
  1421. package/src/ui/console/js/console.js +117 -119
  1422. package/src/ui/console/js/daa-tools.js +797 -787
  1423. package/src/ui/console/js/memory-interface.js +676 -638
  1424. package/src/ui/console/js/memory-test.js +49 -46
  1425. package/src/ui/console/js/memory-tools.js +181 -159
  1426. package/src/ui/console/js/settings.js +124 -103
  1427. package/src/ui/console/js/terminal-emulator.js +147 -130
  1428. package/src/ui/console/js/websocket-client.js +71 -71
  1429. package/src/ui/console/js/workflow-designer.js +1126 -1110
  1430. package/src/ui/console/neural-networks-demo.md +45 -16
  1431. package/src/ui/console/styles/analysis-tools.css +571 -561
  1432. package/src/ui/console/styles/console.css +16 -12
  1433. package/src/ui/console/styles/daa-tools.css +322 -319
  1434. package/src/ui/console/styles/responsive.css +71 -70
  1435. package/src/ui/console/styles/settings.css +12 -12
  1436. package/src/ui/console/styles/workflow-designer.css +628 -584
  1437. package/src/ui/console/test-neural-networks.js +59 -54
  1438. package/src/ui/console/test-neural.html +194 -196
  1439. package/src/ui/console/workflow-designer-demo.html +433 -424
  1440. package/src/ui/hive-dashboard.ts +74 -52
  1441. package/src/ui/web-ui/EnhancedProcessUI.js +570 -424
  1442. package/src/ui/web-ui/EnhancedWebUI.js +65 -65
  1443. package/src/ui/web-ui/README.md +16 -16
  1444. package/src/ui/web-ui/components/ComponentLibrary.js +173 -124
  1445. package/src/ui/web-ui/core/EventBus.js +27 -25
  1446. package/src/ui/web-ui/core/MCPIntegrationLayer.js +294 -108
  1447. package/src/ui/web-ui/core/StateManager.js +43 -46
  1448. package/src/ui/web-ui/core/UIManager.js +120 -70
  1449. package/src/ui/web-ui/core/ViewManager.js +16 -19
  1450. package/src/ui/web-ui/index.js +101 -48
  1451. package/src/ui/web-ui/neural-panel-test.js +109 -108
  1452. package/src/ui/web-ui/test-github-view.js +11 -12
  1453. package/src/ui/web-ui/test-neural-panel.html +219 -205
  1454. package/src/ui/web-ui/views/DAAView.js +88 -85
  1455. package/src/ui/web-ui/views/GitHubIntegrationTest.js +42 -42
  1456. package/src/ui/web-ui/views/GitHubIntegrationView.js +59 -53
  1457. package/src/ui/web-ui/views/NeuralNetworkView.js +20 -21
  1458. package/src/ui/web-ui/views/WorkflowAutomationView.js +31 -32
  1459. package/src/utils/error-handler.js +1 -1
  1460. package/src/utils/error-handler.ts +9 -5
  1461. package/src/utils/errors.ts +20 -18
  1462. package/src/utils/formatters.ts +6 -6
  1463. package/src/utils/helpers.ts +53 -55
  1464. package/src/utils/npx-isolated-cache.js +16 -16
  1465. package/src/utils/paths.ts +9 -6
  1466. package/src/utils/timezone-utils.js +16 -16
  1467. package/src/utils/type-guards.ts +37 -26
  1468. package/src/utils/types.ts +2 -2
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Analysis & Monitoring API Routes
3
3
  * Agent 2 - Analysis & Monitoring Tools Developer
4
- *
4
+ *
5
5
  * Provides backend support for all 13 analysis tools:
6
6
  * 1. performance_report - Performance metrics and reports
7
7
  * 2. bottleneck_analyze - Bottleneck detection and analysis
@@ -25,933 +25,948 @@ const { performance } = require('perf_hooks');
25
25
 
26
26
  // In-memory storage for metrics (replace with database in production)
27
27
  let metricsStore = {
28
- performance: [],
29
- tokens: [],
30
- errors: [],
31
- health: [],
32
- load: [],
33
- costs: []
28
+ performance: [],
29
+ tokens: [],
30
+ errors: [],
31
+ health: [],
32
+ load: [],
33
+ costs: [],
34
34
  };
35
35
 
36
36
  // Performance monitoring
37
37
  let performanceMetrics = {
38
- responseTime: [],
39
- throughput: [],
40
- errorRate: 0,
41
- startTime: Date.now(),
42
- requestCount: 0,
43
- errorCount: 0
38
+ responseTime: [],
39
+ throughput: [],
40
+ errorRate: 0,
41
+ startTime: Date.now(),
42
+ requestCount: 0,
43
+ errorCount: 0,
44
44
  };
45
45
 
46
46
  // Middleware to track request metrics
47
47
  router.use((req, res, next) => {
48
- const startTime = performance.now();
49
-
50
- res.on('finish', () => {
51
- const duration = performance.now() - startTime;
52
- performanceMetrics.responseTime.push(duration);
53
- performanceMetrics.requestCount++;
54
-
55
- if (res.statusCode >= 400) {
56
- performanceMetrics.errorCount++;
57
- }
58
-
59
- // Keep only last 100 measurements
60
- if (performanceMetrics.responseTime.length > 100) {
61
- performanceMetrics.responseTime.shift();
62
- }
63
-
64
- // Store metrics
65
- metricsStore.performance.push({
66
- timestamp: Date.now(),
67
- responseTime: duration,
68
- statusCode: res.statusCode,
69
- method: req.method,
70
- url: req.url
71
- });
72
-
73
- // Keep only last 1000 metrics
74
- if (metricsStore.performance.length > 1000) {
75
- metricsStore.performance.shift();
76
- }
48
+ const startTime = performance.now();
49
+
50
+ res.on('finish', () => {
51
+ const duration = performance.now() - startTime;
52
+ performanceMetrics.responseTime.push(duration);
53
+ performanceMetrics.requestCount++;
54
+
55
+ if (res.statusCode >= 400) {
56
+ performanceMetrics.errorCount++;
57
+ }
58
+
59
+ // Keep only last 100 measurements
60
+ if (performanceMetrics.responseTime.length > 100) {
61
+ performanceMetrics.responseTime.shift();
62
+ }
63
+
64
+ // Store metrics
65
+ metricsStore.performance.push({
66
+ timestamp: Date.now(),
67
+ responseTime: duration,
68
+ statusCode: res.statusCode,
69
+ method: req.method,
70
+ url: req.url,
77
71
  });
78
-
79
- next();
72
+
73
+ // Keep only last 1000 metrics
74
+ if (metricsStore.performance.length > 1000) {
75
+ metricsStore.performance.shift();
76
+ }
77
+ });
78
+
79
+ next();
80
80
  });
81
81
 
82
82
  // 1. Performance Report
83
83
  router.get('/performance-report', (req, res) => {
84
- try {
85
- const now = Date.now();
86
- const uptime = now - performanceMetrics.startTime;
87
- const avgResponseTime = performanceMetrics.responseTime.length > 0
88
- ? performanceMetrics.responseTime.reduce((a, b) => a + b, 0) / performanceMetrics.responseTime.length
89
- : 0;
90
-
91
- const throughput = performanceMetrics.requestCount / (uptime / 1000 / 60); // requests per minute
92
- const errorRate = performanceMetrics.requestCount > 0
93
- ? (performanceMetrics.errorCount / performanceMetrics.requestCount) * 100
94
- : 0;
95
-
96
- const report = {
97
- timestamp: now,
98
- summary: 'System performance analysis completed',
99
- metrics: {
100
- averageResponseTime: Math.round(avgResponseTime),
101
- throughput: Math.round(throughput),
102
- errorRate: Math.round(errorRate * 100) / 100,
103
- uptime: formatUptime(uptime),
104
- totalRequests: performanceMetrics.requestCount,
105
- totalErrors: performanceMetrics.errorCount
106
- },
107
- recommendations: generatePerformanceRecommendations(avgResponseTime, throughput, errorRate),
108
- trends: {
109
- responseTime: performanceMetrics.responseTime.slice(-20),
110
- throughput: calculateThroughputTrend(),
111
- errorRate: calculateErrorRateTrend()
112
- }
113
- };
114
-
115
- res.json(report);
116
- } catch (error) {
117
- res.status(500).json({ error: error.message });
118
- }
84
+ try {
85
+ const now = Date.now();
86
+ const uptime = now - performanceMetrics.startTime;
87
+ const avgResponseTime =
88
+ performanceMetrics.responseTime.length > 0
89
+ ? performanceMetrics.responseTime.reduce((a, b) => a + b, 0) /
90
+ performanceMetrics.responseTime.length
91
+ : 0;
92
+
93
+ const throughput = performanceMetrics.requestCount / (uptime / 1000 / 60); // requests per minute
94
+ const errorRate =
95
+ performanceMetrics.requestCount > 0
96
+ ? (performanceMetrics.errorCount / performanceMetrics.requestCount) * 100
97
+ : 0;
98
+
99
+ const report = {
100
+ timestamp: now,
101
+ summary: 'System performance analysis completed',
102
+ metrics: {
103
+ averageResponseTime: Math.round(avgResponseTime),
104
+ throughput: Math.round(throughput),
105
+ errorRate: Math.round(errorRate * 100) / 100,
106
+ uptime: formatUptime(uptime),
107
+ totalRequests: performanceMetrics.requestCount,
108
+ totalErrors: performanceMetrics.errorCount,
109
+ },
110
+ recommendations: generatePerformanceRecommendations(avgResponseTime, throughput, errorRate),
111
+ trends: {
112
+ responseTime: performanceMetrics.responseTime.slice(-20),
113
+ throughput: calculateThroughputTrend(),
114
+ errorRate: calculateErrorRateTrend(),
115
+ },
116
+ };
117
+
118
+ res.json(report);
119
+ } catch (error) {
120
+ res.status(500).json({ error: error.message });
121
+ }
119
122
  });
120
123
 
121
124
  // 2. Bottleneck Analysis
122
125
  router.get('/bottleneck-analyze', (req, res) => {
123
- try {
124
- const bottlenecks = analyzeBottlenecks();
125
- const recommendations = generateBottleneckRecommendations(bottlenecks);
126
-
127
- res.json({
128
- timestamp: Date.now(),
129
- bottlenecks,
130
- recommendations,
131
- summary: `Found ${bottlenecks.length} potential bottlenecks`,
132
- impact: calculateBottleneckImpact(bottlenecks)
133
- });
134
- } catch (error) {
135
- res.status(500).json({ error: error.message });
136
- }
126
+ try {
127
+ const bottlenecks = analyzeBottlenecks();
128
+ const recommendations = generateBottleneckRecommendations(bottlenecks);
129
+
130
+ res.json({
131
+ timestamp: Date.now(),
132
+ bottlenecks,
133
+ recommendations,
134
+ summary: `Found ${bottlenecks.length} potential bottlenecks`,
135
+ impact: calculateBottleneckImpact(bottlenecks),
136
+ });
137
+ } catch (error) {
138
+ res.status(500).json({ error: error.message });
139
+ }
137
140
  });
138
141
 
139
142
  // 3. Token Usage
140
143
  router.get('/token-usage', (req, res) => {
141
- try {
142
- const usage = calculateTokenUsage();
143
-
144
- res.json({
145
- timestamp: Date.now(),
146
- ...usage,
147
- efficiency: calculateTokenEfficiency(usage),
148
- trends: getTokenTrends(),
149
- recommendations: generateTokenRecommendations(usage)
150
- });
151
- } catch (error) {
152
- res.status(500).json({ error: error.message });
153
- }
144
+ try {
145
+ const usage = calculateTokenUsage();
146
+
147
+ res.json({
148
+ timestamp: Date.now(),
149
+ ...usage,
150
+ efficiency: calculateTokenEfficiency(usage),
151
+ trends: getTokenTrends(),
152
+ recommendations: generateTokenRecommendations(usage),
153
+ });
154
+ } catch (error) {
155
+ res.status(500).json({ error: error.message });
156
+ }
154
157
  });
155
158
 
156
159
  // 4. Benchmark Run
157
160
  router.get('/benchmark-run', (req, res) => {
158
- try {
159
- const benchmarks = runBenchmarks();
160
-
161
- res.json({
162
- timestamp: Date.now(),
163
- benchmarks,
164
- summary: 'Benchmark suite completed',
165
- score: calculateOverallScore(benchmarks),
166
- comparisons: generateBenchmarkComparisons(benchmarks)
167
- });
168
- } catch (error) {
169
- res.status(500).json({ error: error.message });
170
- }
161
+ try {
162
+ const benchmarks = runBenchmarks();
163
+
164
+ res.json({
165
+ timestamp: Date.now(),
166
+ benchmarks,
167
+ summary: 'Benchmark suite completed',
168
+ score: calculateOverallScore(benchmarks),
169
+ comparisons: generateBenchmarkComparisons(benchmarks),
170
+ });
171
+ } catch (error) {
172
+ res.status(500).json({ error: error.message });
173
+ }
171
174
  });
172
175
 
173
176
  // 5. Metrics Collection
174
177
  router.get('/metrics-collect', (req, res) => {
175
- try {
176
- const metrics = collectSystemMetrics();
177
-
178
- res.json({
179
- timestamp: Date.now(),
180
- metrics,
181
- summary: 'System metrics collected successfully',
182
- alerts: generateMetricAlerts(metrics)
183
- });
184
- } catch (error) {
185
- res.status(500).json({ error: error.message });
186
- }
178
+ try {
179
+ const metrics = collectSystemMetrics();
180
+
181
+ res.json({
182
+ timestamp: Date.now(),
183
+ metrics,
184
+ summary: 'System metrics collected successfully',
185
+ alerts: generateMetricAlerts(metrics),
186
+ });
187
+ } catch (error) {
188
+ res.status(500).json({ error: error.message });
189
+ }
187
190
  });
188
191
 
189
192
  // 6. Trend Analysis
190
193
  router.get('/trend-analysis', (req, res) => {
191
- try {
192
- const trends = analyzeTrends();
193
-
194
- res.json({
195
- timestamp: Date.now(),
196
- trends,
197
- predictions: generatePredictions(trends),
198
- summary: 'Trend analysis completed',
199
- insights: generateTrendInsights(trends)
200
- });
201
- } catch (error) {
202
- res.status(500).json({ error: error.message });
203
- }
194
+ try {
195
+ const trends = analyzeTrends();
196
+
197
+ res.json({
198
+ timestamp: Date.now(),
199
+ trends,
200
+ predictions: generatePredictions(trends),
201
+ summary: 'Trend analysis completed',
202
+ insights: generateTrendInsights(trends),
203
+ });
204
+ } catch (error) {
205
+ res.status(500).json({ error: error.message });
206
+ }
204
207
  });
205
208
 
206
209
  // 7. Cost Analysis
207
210
  router.get('/cost-analysis', (req, res) => {
208
- try {
209
- const costs = analyzeCosts();
210
-
211
- res.json({
212
- timestamp: Date.now(),
213
- costs,
214
- summary: 'Cost analysis completed',
215
- optimization: generateCostOptimizations(costs),
216
- forecast: generateCostForecast(costs)
217
- });
218
- } catch (error) {
219
- res.status(500).json({ error: error.message });
220
- }
211
+ try {
212
+ const costs = analyzeCosts();
213
+
214
+ res.json({
215
+ timestamp: Date.now(),
216
+ costs,
217
+ summary: 'Cost analysis completed',
218
+ optimization: generateCostOptimizations(costs),
219
+ forecast: generateCostForecast(costs),
220
+ });
221
+ } catch (error) {
222
+ res.status(500).json({ error: error.message });
223
+ }
221
224
  });
222
225
 
223
226
  // 8. Quality Assessment
224
227
  router.get('/quality-assess', (req, res) => {
225
- try {
226
- const quality = assessQuality();
227
-
228
- res.json({
229
- timestamp: Date.now(),
230
- quality,
231
- summary: 'Quality assessment completed',
232
- score: calculateQualityScore(quality),
233
- recommendations: generateQualityRecommendations(quality)
234
- });
235
- } catch (error) {
236
- res.status(500).json({ error: error.message });
237
- }
228
+ try {
229
+ const quality = assessQuality();
230
+
231
+ res.json({
232
+ timestamp: Date.now(),
233
+ quality,
234
+ summary: 'Quality assessment completed',
235
+ score: calculateQualityScore(quality),
236
+ recommendations: generateQualityRecommendations(quality),
237
+ });
238
+ } catch (error) {
239
+ res.status(500).json({ error: error.message });
240
+ }
238
241
  });
239
242
 
240
243
  // 9. Error Analysis
241
244
  router.get('/error-analysis', (req, res) => {
242
- try {
243
- const errors = analyzeErrors();
244
-
245
- res.json({
246
- timestamp: Date.now(),
247
- errors,
248
- summary: 'Error analysis completed',
249
- patterns: identifyErrorPatterns(errors),
250
- resolution: generateErrorResolutions(errors)
251
- });
252
- } catch (error) {
253
- res.status(500).json({ error: error.message });
254
- }
245
+ try {
246
+ const errors = analyzeErrors();
247
+
248
+ res.json({
249
+ timestamp: Date.now(),
250
+ errors,
251
+ summary: 'Error analysis completed',
252
+ patterns: identifyErrorPatterns(errors),
253
+ resolution: generateErrorResolutions(errors),
254
+ });
255
+ } catch (error) {
256
+ res.status(500).json({ error: error.message });
257
+ }
255
258
  });
256
259
 
257
260
  // 10. Usage Statistics
258
261
  router.get('/usage-stats', (req, res) => {
259
- try {
260
- const stats = calculateUsageStats();
261
-
262
- res.json({
263
- timestamp: Date.now(),
264
- stats,
265
- summary: 'Usage statistics generated',
266
- insights: generateUsageInsights(stats),
267
- trends: calculateUsageTrends(stats)
268
- });
269
- } catch (error) {
270
- res.status(500).json({ error: error.message });
271
- }
262
+ try {
263
+ const stats = calculateUsageStats();
264
+
265
+ res.json({
266
+ timestamp: Date.now(),
267
+ stats,
268
+ summary: 'Usage statistics generated',
269
+ insights: generateUsageInsights(stats),
270
+ trends: calculateUsageTrends(stats),
271
+ });
272
+ } catch (error) {
273
+ res.status(500).json({ error: error.message });
274
+ }
272
275
  });
273
276
 
274
277
  // 11. Health Check
275
278
  router.get('/health-check', (req, res) => {
276
- try {
277
- const health = performHealthCheck();
278
-
279
- res.json({
280
- timestamp: Date.now(),
281
- health,
282
- summary: 'System health check completed',
283
- status: calculateOverallHealth(health),
284
- alerts: generateHealthAlerts(health)
285
- });
286
- } catch (error) {
287
- res.status(500).json({ error: error.message });
288
- }
279
+ try {
280
+ const health = performHealthCheck();
281
+
282
+ res.json({
283
+ timestamp: Date.now(),
284
+ health,
285
+ summary: 'System health check completed',
286
+ status: calculateOverallHealth(health),
287
+ alerts: generateHealthAlerts(health),
288
+ });
289
+ } catch (error) {
290
+ res.status(500).json({ error: error.message });
291
+ }
289
292
  });
290
293
 
291
294
  // 12. Load Monitor
292
295
  router.get('/load-monitor', (req, res) => {
293
- try {
294
- const load = monitorLoad();
295
-
296
- res.json({
297
- timestamp: Date.now(),
298
- load,
299
- summary: 'Load monitoring completed',
300
- alerts: generateLoadAlerts(load),
301
- predictions: predictLoadTrends(load)
302
- });
303
- } catch (error) {
304
- res.status(500).json({ error: error.message });
305
- }
296
+ try {
297
+ const load = monitorLoad();
298
+
299
+ res.json({
300
+ timestamp: Date.now(),
301
+ load,
302
+ summary: 'Load monitoring completed',
303
+ alerts: generateLoadAlerts(load),
304
+ predictions: predictLoadTrends(load),
305
+ });
306
+ } catch (error) {
307
+ res.status(500).json({ error: error.message });
308
+ }
306
309
  });
307
310
 
308
311
  // 13. Capacity Planning
309
312
  router.get('/capacity-plan', (req, res) => {
310
- try {
311
- const capacity = planCapacity();
312
-
313
- res.json({
314
- timestamp: Date.now(),
315
- capacity,
316
- summary: 'Capacity planning completed',
317
- recommendations: generateCapacityRecommendations(capacity),
318
- timeline: generateCapacityTimeline(capacity)
319
- });
320
- } catch (error) {
321
- res.status(500).json({ error: error.message });
322
- }
313
+ try {
314
+ const capacity = planCapacity();
315
+
316
+ res.json({
317
+ timestamp: Date.now(),
318
+ capacity,
319
+ summary: 'Capacity planning completed',
320
+ recommendations: generateCapacityRecommendations(capacity),
321
+ timeline: generateCapacityTimeline(capacity),
322
+ });
323
+ } catch (error) {
324
+ res.status(500).json({ error: error.message });
325
+ }
323
326
  });
324
327
 
325
328
  // WebSocket endpoint for real-time metrics
326
329
  router.ws('/ws', (ws, req) => {
327
- console.log('Analysis WebSocket connected');
328
-
329
- // Send initial metrics
330
- ws.send(JSON.stringify({
331
- type: 'metrics_update',
332
- payload: getCurrentMetrics()
333
- }));
334
-
335
- // Set up periodic updates
336
- const interval = setInterval(() => {
337
- if (ws.readyState === ws.OPEN) {
338
- ws.send(JSON.stringify({
339
- type: 'metrics_update',
340
- payload: getCurrentMetrics()
341
- }));
342
- }
343
- }, 5000);
344
-
345
- ws.on('message', (message) => {
346
- try {
347
- const data = JSON.parse(message);
348
- handleWebSocketMessage(ws, data);
349
- } catch (error) {
350
- console.error('WebSocket message error:', error);
351
- }
352
- });
353
-
354
- ws.on('close', () => {
355
- clearInterval(interval);
356
- console.log('Analysis WebSocket disconnected');
357
- });
330
+ console.log('Analysis WebSocket connected');
331
+
332
+ // Send initial metrics
333
+ ws.send(
334
+ JSON.stringify({
335
+ type: 'metrics_update',
336
+ payload: getCurrentMetrics(),
337
+ }),
338
+ );
339
+
340
+ // Set up periodic updates
341
+ const interval = setInterval(() => {
342
+ if (ws.readyState === ws.OPEN) {
343
+ ws.send(
344
+ JSON.stringify({
345
+ type: 'metrics_update',
346
+ payload: getCurrentMetrics(),
347
+ }),
348
+ );
349
+ }
350
+ }, 5000);
351
+
352
+ ws.on('message', (message) => {
353
+ try {
354
+ const data = JSON.parse(message);
355
+ handleWebSocketMessage(ws, data);
356
+ } catch (error) {
357
+ console.error('WebSocket message error:', error);
358
+ }
359
+ });
360
+
361
+ ws.on('close', () => {
362
+ clearInterval(interval);
363
+ console.log('Analysis WebSocket disconnected');
364
+ });
358
365
  });
359
366
 
360
367
  // Helper Functions
361
368
 
362
369
  function formatUptime(milliseconds) {
363
- const seconds = Math.floor(milliseconds / 1000);
364
- const minutes = Math.floor(seconds / 60);
365
- const hours = Math.floor(minutes / 60);
366
- const days = Math.floor(hours / 24);
367
-
368
- if (days > 0) return `${days}d ${hours % 24}h`;
369
- if (hours > 0) return `${hours}h ${minutes % 60}m`;
370
- if (minutes > 0) return `${minutes}m ${seconds % 60}s`;
371
- return `${seconds}s`;
370
+ const seconds = Math.floor(milliseconds / 1000);
371
+ const minutes = Math.floor(seconds / 60);
372
+ const hours = Math.floor(minutes / 60);
373
+ const days = Math.floor(hours / 24);
374
+
375
+ if (days > 0) return `${days}d ${hours % 24}h`;
376
+ if (hours > 0) return `${hours}h ${minutes % 60}m`;
377
+ if (minutes > 0) return `${minutes}m ${seconds % 60}s`;
378
+ return `${seconds}s`;
372
379
  }
373
380
 
374
381
  function generatePerformanceRecommendations(avgResponseTime, throughput, errorRate) {
375
- const recommendations = [];
376
-
377
- if (avgResponseTime > 1000) {
378
- recommendations.push('Consider implementing caching to reduce response times');
379
- recommendations.push('Optimize database queries and API calls');
380
- }
381
-
382
- if (throughput < 100) {
383
- recommendations.push('Consider scaling up server resources');
384
- recommendations.push('Implement load balancing for better distribution');
385
- }
386
-
387
- if (errorRate > 5) {
388
- recommendations.push('Investigate and fix recurring errors');
389
- recommendations.push('Implement better error handling and monitoring');
390
- }
391
-
392
- if (recommendations.length === 0) {
393
- recommendations.push('System performance is within acceptable ranges');
394
- }
395
-
396
- return recommendations;
382
+ const recommendations = [];
383
+
384
+ if (avgResponseTime > 1000) {
385
+ recommendations.push('Consider implementing caching to reduce response times');
386
+ recommendations.push('Optimize database queries and API calls');
387
+ }
388
+
389
+ if (throughput < 100) {
390
+ recommendations.push('Consider scaling up server resources');
391
+ recommendations.push('Implement load balancing for better distribution');
392
+ }
393
+
394
+ if (errorRate > 5) {
395
+ recommendations.push('Investigate and fix recurring errors');
396
+ recommendations.push('Implement better error handling and monitoring');
397
+ }
398
+
399
+ if (recommendations.length === 0) {
400
+ recommendations.push('System performance is within acceptable ranges');
401
+ }
402
+
403
+ return recommendations;
397
404
  }
398
405
 
399
406
  function analyzeBottlenecks() {
400
- const bottlenecks = [];
401
- const cpuUsage = os.loadavg()[0];
402
- const memoryUsage = (os.totalmem() - os.freemem()) / os.totalmem() * 100;
403
-
404
- if (cpuUsage > 0.8) {
405
- bottlenecks.push({
406
- component: 'CPU',
407
- severity: 'high',
408
- impact: 'Response time +25%',
409
- value: cpuUsage,
410
- threshold: 0.8
411
- });
412
- }
413
-
414
- if (memoryUsage > 85) {
415
- bottlenecks.push({
416
- component: 'Memory',
417
- severity: 'medium',
418
- impact: 'Performance degradation',
419
- value: memoryUsage,
420
- threshold: 85
421
- });
422
- }
423
-
424
- const avgResponseTime = performanceMetrics.responseTime.length > 0
425
- ? performanceMetrics.responseTime.reduce((a, b) => a + b, 0) / performanceMetrics.responseTime.length
426
- : 0;
427
-
428
- if (avgResponseTime > 500) {
429
- bottlenecks.push({
430
- component: 'API Response',
431
- severity: 'medium',
432
- impact: 'User experience degradation',
433
- value: avgResponseTime,
434
- threshold: 500
435
- });
436
- }
437
-
438
- return bottlenecks;
407
+ const bottlenecks = [];
408
+ const cpuUsage = os.loadavg()[0];
409
+ const memoryUsage = ((os.totalmem() - os.freemem()) / os.totalmem()) * 100;
410
+
411
+ if (cpuUsage > 0.8) {
412
+ bottlenecks.push({
413
+ component: 'CPU',
414
+ severity: 'high',
415
+ impact: 'Response time +25%',
416
+ value: cpuUsage,
417
+ threshold: 0.8,
418
+ });
419
+ }
420
+
421
+ if (memoryUsage > 85) {
422
+ bottlenecks.push({
423
+ component: 'Memory',
424
+ severity: 'medium',
425
+ impact: 'Performance degradation',
426
+ value: memoryUsage,
427
+ threshold: 85,
428
+ });
429
+ }
430
+
431
+ const avgResponseTime =
432
+ performanceMetrics.responseTime.length > 0
433
+ ? performanceMetrics.responseTime.reduce((a, b) => a + b, 0) /
434
+ performanceMetrics.responseTime.length
435
+ : 0;
436
+
437
+ if (avgResponseTime > 500) {
438
+ bottlenecks.push({
439
+ component: 'API Response',
440
+ severity: 'medium',
441
+ impact: 'User experience degradation',
442
+ value: avgResponseTime,
443
+ threshold: 500,
444
+ });
445
+ }
446
+
447
+ return bottlenecks;
439
448
  }
440
449
 
441
450
  function generateBottleneckRecommendations(bottlenecks) {
442
- const recommendations = [];
443
-
444
- bottlenecks.forEach(bottleneck => {
445
- switch (bottleneck.component) {
446
- case 'CPU':
447
- recommendations.push('Consider upgrading CPU or optimizing CPU-intensive operations');
448
- break;
449
- case 'Memory':
450
- recommendations.push('Implement memory optimization or increase available RAM');
451
- break;
452
- case 'API Response':
453
- recommendations.push('Optimize API endpoints and implement caching');
454
- break;
455
- }
456
- });
457
-
458
- return recommendations;
451
+ const recommendations = [];
452
+
453
+ bottlenecks.forEach((bottleneck) => {
454
+ switch (bottleneck.component) {
455
+ case 'CPU':
456
+ recommendations.push('Consider upgrading CPU or optimizing CPU-intensive operations');
457
+ break;
458
+ case 'Memory':
459
+ recommendations.push('Implement memory optimization or increase available RAM');
460
+ break;
461
+ case 'API Response':
462
+ recommendations.push('Optimize API endpoints and implement caching');
463
+ break;
464
+ }
465
+ });
466
+
467
+ return recommendations;
459
468
  }
460
469
 
461
470
  function calculateTokenUsage() {
462
- // Mock token usage calculation
463
- const baseUsage = {
464
- totalTokens: Math.floor(Math.random() * 1000000) + 500000,
465
- inputTokens: Math.floor(Math.random() * 600000) + 300000,
466
- outputTokens: Math.floor(Math.random() * 400000) + 200000,
467
- cachedTokens: Math.floor(Math.random() * 100000) + 50000
468
- };
469
-
470
- baseUsage.cost = (baseUsage.totalTokens * 0.0001);
471
- return baseUsage;
471
+ // Mock token usage calculation
472
+ const baseUsage = {
473
+ totalTokens: Math.floor(Math.random() * 1000000) + 500000,
474
+ inputTokens: Math.floor(Math.random() * 600000) + 300000,
475
+ outputTokens: Math.floor(Math.random() * 400000) + 200000,
476
+ cachedTokens: Math.floor(Math.random() * 100000) + 50000,
477
+ };
478
+
479
+ baseUsage.cost = baseUsage.totalTokens * 0.0001;
480
+ return baseUsage;
472
481
  }
473
482
 
474
483
  function calculateTokenEfficiency(usage) {
475
- const cacheHitRate = (usage.cachedTokens / usage.totalTokens) * 100;
476
- const inputOutputRatio = usage.outputTokens / usage.inputTokens;
477
-
478
- return {
479
- cacheHitRate: Math.round(cacheHitRate * 100) / 100,
480
- inputOutputRatio: Math.round(inputOutputRatio * 100) / 100,
481
- costPerToken: Math.round((usage.cost / usage.totalTokens) * 10000) / 10000
482
- };
484
+ const cacheHitRate = (usage.cachedTokens / usage.totalTokens) * 100;
485
+ const inputOutputRatio = usage.outputTokens / usage.inputTokens;
486
+
487
+ return {
488
+ cacheHitRate: Math.round(cacheHitRate * 100) / 100,
489
+ inputOutputRatio: Math.round(inputOutputRatio * 100) / 100,
490
+ costPerToken: Math.round((usage.cost / usage.totalTokens) * 10000) / 10000,
491
+ };
483
492
  }
484
493
 
485
494
  function runBenchmarks() {
486
- return {
487
- responseTime: {
488
- name: 'Response Time',
489
- score: Math.floor(Math.random() * 40) + 60,
490
- unit: 'ms',
491
- baseline: 100
492
- },
493
- throughput: {
494
- name: 'Throughput',
495
- score: Math.floor(Math.random() * 30) + 70,
496
- unit: 'req/s',
497
- baseline: 1000
498
- },
499
- errorRate: {
500
- name: 'Error Rate',
501
- score: Math.floor(Math.random() * 20) + 80,
502
- unit: '%',
503
- baseline: 1
504
- },
505
- availability: {
506
- name: 'Availability',
507
- score: Math.floor(Math.random() * 5) + 95,
508
- unit: '%',
509
- baseline: 99.9
510
- }
511
- };
495
+ return {
496
+ responseTime: {
497
+ name: 'Response Time',
498
+ score: Math.floor(Math.random() * 40) + 60,
499
+ unit: 'ms',
500
+ baseline: 100,
501
+ },
502
+ throughput: {
503
+ name: 'Throughput',
504
+ score: Math.floor(Math.random() * 30) + 70,
505
+ unit: 'req/s',
506
+ baseline: 1000,
507
+ },
508
+ errorRate: {
509
+ name: 'Error Rate',
510
+ score: Math.floor(Math.random() * 20) + 80,
511
+ unit: '%',
512
+ baseline: 1,
513
+ },
514
+ availability: {
515
+ name: 'Availability',
516
+ score: Math.floor(Math.random() * 5) + 95,
517
+ unit: '%',
518
+ baseline: 99.9,
519
+ },
520
+ };
512
521
  }
513
522
 
514
523
  function collectSystemMetrics() {
515
- return {
516
- system: {
517
- platform: os.platform(),
518
- architecture: os.arch(),
519
- uptime: os.uptime(),
520
- loadAverage: os.loadavg()
521
- },
522
- memory: {
523
- total: os.totalmem(),
524
- free: os.freemem(),
525
- usage: (os.totalmem() - os.freemem()) / os.totalmem() * 100
526
- },
527
- cpu: {
528
- count: os.cpus().length,
529
- model: os.cpus()[0].model,
530
- usage: os.loadavg()[0]
531
- },
532
- network: {
533
- interfaces: Object.keys(os.networkInterfaces()).length,
534
- hostname: os.hostname()
535
- }
536
- };
524
+ return {
525
+ system: {
526
+ platform: os.platform(),
527
+ architecture: os.arch(),
528
+ uptime: os.uptime(),
529
+ loadAverage: os.loadavg(),
530
+ },
531
+ memory: {
532
+ total: os.totalmem(),
533
+ free: os.freemem(),
534
+ usage: ((os.totalmem() - os.freemem()) / os.totalmem()) * 100,
535
+ },
536
+ cpu: {
537
+ count: os.cpus().length,
538
+ model: os.cpus()[0].model,
539
+ usage: os.loadavg()[0],
540
+ },
541
+ network: {
542
+ interfaces: Object.keys(os.networkInterfaces()).length,
543
+ hostname: os.hostname(),
544
+ },
545
+ };
537
546
  }
538
547
 
539
548
  function performHealthCheck() {
540
- const memoryUsage = (os.totalmem() - os.freemem()) / os.totalmem() * 100;
541
- const cpuUsage = os.loadavg()[0] * 100;
542
-
543
- return {
544
- cpu: Math.max(0, 100 - cpuUsage),
545
- memory: Math.max(0, 100 - memoryUsage),
546
- disk: Math.floor(Math.random() * 20) + 80,
547
- network: Math.floor(Math.random() * 10) + 90,
548
- api: Math.floor(Math.random() * 15) + 85,
549
- database: Math.floor(Math.random() * 10) + 90
550
- };
549
+ const memoryUsage = ((os.totalmem() - os.freemem()) / os.totalmem()) * 100;
550
+ const cpuUsage = os.loadavg()[0] * 100;
551
+
552
+ return {
553
+ cpu: Math.max(0, 100 - cpuUsage),
554
+ memory: Math.max(0, 100 - memoryUsage),
555
+ disk: Math.floor(Math.random() * 20) + 80,
556
+ network: Math.floor(Math.random() * 10) + 90,
557
+ api: Math.floor(Math.random() * 15) + 85,
558
+ database: Math.floor(Math.random() * 10) + 90,
559
+ };
551
560
  }
552
561
 
553
562
  function monitorLoad() {
554
- const loadAvg = os.loadavg();
555
- return {
556
- oneMin: loadAvg[0],
557
- fiveMin: loadAvg[1],
558
- fifteenMin: loadAvg[2],
559
- thirtyMin: Math.random() * 2,
560
- oneHour: Math.random() * 2,
561
- twentyFourHour: Math.random() * 2,
562
- current: loadAvg[0],
563
- peak: Math.max(...loadAvg),
564
- average: loadAvg.reduce((a, b) => a + b, 0) / loadAvg.length
565
- };
563
+ const loadAvg = os.loadavg();
564
+ return {
565
+ oneMin: loadAvg[0],
566
+ fiveMin: loadAvg[1],
567
+ fifteenMin: loadAvg[2],
568
+ thirtyMin: Math.random() * 2,
569
+ oneHour: Math.random() * 2,
570
+ twentyFourHour: Math.random() * 2,
571
+ current: loadAvg[0],
572
+ peak: Math.max(...loadAvg),
573
+ average: loadAvg.reduce((a, b) => a + b, 0) / loadAvg.length,
574
+ };
566
575
  }
567
576
 
568
577
  function getCurrentMetrics() {
569
- const avgResponseTime = performanceMetrics.responseTime.length > 0
570
- ? performanceMetrics.responseTime.reduce((a, b) => a + b, 0) / performanceMetrics.responseTime.length
571
- : 0;
572
-
573
- const throughput = performanceMetrics.requestCount / ((Date.now() - performanceMetrics.startTime) / 1000);
574
- const errorRate = performanceMetrics.requestCount > 0
575
- ? (performanceMetrics.errorCount / performanceMetrics.requestCount) * 100
576
- : 0;
577
-
578
- const uptime = Date.now() - performanceMetrics.startTime;
579
- const tokenUsage = calculateTokenUsage();
580
- const health = performHealthCheck();
581
- const load = monitorLoad();
582
-
583
- return {
584
- performance: {
585
- responseTime: Math.round(avgResponseTime),
586
- throughput: Math.round(throughput),
587
- errorRate: Math.round(errorRate * 100) / 100,
588
- uptime: formatUptime(uptime)
589
- },
590
- tokens: tokenUsage,
591
- health,
592
- load
593
- };
578
+ const avgResponseTime =
579
+ performanceMetrics.responseTime.length > 0
580
+ ? performanceMetrics.responseTime.reduce((a, b) => a + b, 0) /
581
+ performanceMetrics.responseTime.length
582
+ : 0;
583
+
584
+ const throughput =
585
+ performanceMetrics.requestCount / ((Date.now() - performanceMetrics.startTime) / 1000);
586
+ const errorRate =
587
+ performanceMetrics.requestCount > 0
588
+ ? (performanceMetrics.errorCount / performanceMetrics.requestCount) * 100
589
+ : 0;
590
+
591
+ const uptime = Date.now() - performanceMetrics.startTime;
592
+ const tokenUsage = calculateTokenUsage();
593
+ const health = performHealthCheck();
594
+ const load = monitorLoad();
595
+
596
+ return {
597
+ performance: {
598
+ responseTime: Math.round(avgResponseTime),
599
+ throughput: Math.round(throughput),
600
+ errorRate: Math.round(errorRate * 100) / 100,
601
+ uptime: formatUptime(uptime),
602
+ },
603
+ tokens: tokenUsage,
604
+ health,
605
+ load,
606
+ };
594
607
  }
595
608
 
596
609
  function handleWebSocketMessage(ws, data) {
597
- switch (data.type) {
598
- case 'request_metrics':
599
- ws.send(JSON.stringify({
600
- type: 'metrics_update',
601
- payload: getCurrentMetrics()
602
- }));
603
- break;
604
- default:
605
- console.log('Unknown WebSocket message type:', data.type);
606
- }
610
+ switch (data.type) {
611
+ case 'request_metrics':
612
+ ws.send(
613
+ JSON.stringify({
614
+ type: 'metrics_update',
615
+ payload: getCurrentMetrics(),
616
+ }),
617
+ );
618
+ break;
619
+ default:
620
+ console.log('Unknown WebSocket message type:', data.type);
621
+ }
607
622
  }
608
623
 
609
624
  // Additional helper functions for other tools
610
625
  function calculateThroughputTrend() {
611
- // Mock throughput trend calculation
612
- return Array.from({ length: 20 }, (_, i) => Math.random() * 1000 + 500);
626
+ // Mock throughput trend calculation
627
+ return Array.from({ length: 20 }, (_, i) => Math.random() * 1000 + 500);
613
628
  }
614
629
 
615
630
  function calculateErrorRateTrend() {
616
- // Mock error rate trend calculation
617
- return Array.from({ length: 20 }, (_, i) => Math.random() * 5);
631
+ // Mock error rate trend calculation
632
+ return Array.from({ length: 20 }, (_, i) => Math.random() * 5);
618
633
  }
619
634
 
620
635
  function calculateBottleneckImpact(bottlenecks) {
621
- const severityWeights = { low: 1, medium: 2, high: 3 };
622
- const totalImpact = bottlenecks.reduce((sum, b) => sum + severityWeights[b.severity], 0);
623
- return {
624
- score: totalImpact,
625
- level: totalImpact > 6 ? 'critical' : totalImpact > 3 ? 'medium' : 'low'
626
- };
636
+ const severityWeights = { low: 1, medium: 2, high: 3 };
637
+ const totalImpact = bottlenecks.reduce((sum, b) => sum + severityWeights[b.severity], 0);
638
+ return {
639
+ score: totalImpact,
640
+ level: totalImpact > 6 ? 'critical' : totalImpact > 3 ? 'medium' : 'low',
641
+ };
627
642
  }
628
643
 
629
644
  function getTokenTrends() {
630
- return {
631
- daily: Array.from({ length: 7 }, () => Math.random() * 100000 + 50000),
632
- hourly: Array.from({ length: 24 }, () => Math.random() * 10000 + 5000)
633
- };
645
+ return {
646
+ daily: Array.from({ length: 7 }, () => Math.random() * 100000 + 50000),
647
+ hourly: Array.from({ length: 24 }, () => Math.random() * 10000 + 5000),
648
+ };
634
649
  }
635
650
 
636
651
  function generateTokenRecommendations(usage) {
637
- const recommendations = [];
638
- const efficiency = calculateTokenEfficiency(usage);
639
-
640
- if (efficiency.cacheHitRate < 20) {
641
- recommendations.push('Implement better caching strategies to improve token efficiency');
642
- }
643
-
644
- if (efficiency.inputOutputRatio > 2) {
645
- recommendations.push('Consider optimizing output generation to reduce token consumption');
646
- }
647
-
648
- if (usage.cost > 100) {
649
- recommendations.push('Monitor token usage closely to control costs');
650
- }
651
-
652
- return recommendations;
652
+ const recommendations = [];
653
+ const efficiency = calculateTokenEfficiency(usage);
654
+
655
+ if (efficiency.cacheHitRate < 20) {
656
+ recommendations.push('Implement better caching strategies to improve token efficiency');
657
+ }
658
+
659
+ if (efficiency.inputOutputRatio > 2) {
660
+ recommendations.push('Consider optimizing output generation to reduce token consumption');
661
+ }
662
+
663
+ if (usage.cost > 100) {
664
+ recommendations.push('Monitor token usage closely to control costs');
665
+ }
666
+
667
+ return recommendations;
653
668
  }
654
669
 
655
670
  function calculateOverallScore(benchmarks) {
656
- const scores = Object.values(benchmarks).map(b => b.score);
657
- return Math.round(scores.reduce((a, b) => a + b, 0) / scores.length);
671
+ const scores = Object.values(benchmarks).map((b) => b.score);
672
+ return Math.round(scores.reduce((a, b) => a + b, 0) / scores.length);
658
673
  }
659
674
 
660
675
  function generateBenchmarkComparisons(benchmarks) {
661
- return Object.entries(benchmarks).map(([key, value]) => ({
662
- name: value.name,
663
- current: value.score,
664
- baseline: value.baseline,
665
- improvement: ((value.score - value.baseline) / value.baseline * 100).toFixed(1)
666
- }));
676
+ return Object.entries(benchmarks).map(([key, value]) => ({
677
+ name: value.name,
678
+ current: value.score,
679
+ baseline: value.baseline,
680
+ improvement: (((value.score - value.baseline) / value.baseline) * 100).toFixed(1),
681
+ }));
667
682
  }
668
683
 
669
684
  function generateMetricAlerts(metrics) {
670
- const alerts = [];
671
-
672
- if (metrics.memory.usage > 85) {
673
- alerts.push({
674
- type: 'warning',
675
- message: 'High memory usage detected',
676
- value: metrics.memory.usage
677
- });
678
- }
679
-
680
- if (metrics.cpu.usage > 0.8) {
681
- alerts.push({
682
- type: 'critical',
683
- message: 'High CPU usage detected',
684
- value: metrics.cpu.usage
685
- });
686
- }
687
-
688
- return alerts;
685
+ const alerts = [];
686
+
687
+ if (metrics.memory.usage > 85) {
688
+ alerts.push({
689
+ type: 'warning',
690
+ message: 'High memory usage detected',
691
+ value: metrics.memory.usage,
692
+ });
693
+ }
694
+
695
+ if (metrics.cpu.usage > 0.8) {
696
+ alerts.push({
697
+ type: 'critical',
698
+ message: 'High CPU usage detected',
699
+ value: metrics.cpu.usage,
700
+ });
701
+ }
702
+
703
+ return alerts;
689
704
  }
690
705
 
691
706
  function analyzeTrends() {
692
- return {
693
- performance: {
694
- trend: 'improving',
695
- change: '+5.2%',
696
- prediction: 'stable'
697
- },
698
- usage: {
699
- trend: 'increasing',
700
- change: '+12.3%',
701
- prediction: 'continued growth'
702
- },
703
- errors: {
704
- trend: 'decreasing',
705
- change: '-8.1%',
706
- prediction: 'stable'
707
- }
708
- };
707
+ return {
708
+ performance: {
709
+ trend: 'improving',
710
+ change: '+5.2%',
711
+ prediction: 'stable',
712
+ },
713
+ usage: {
714
+ trend: 'increasing',
715
+ change: '+12.3%',
716
+ prediction: 'continued growth',
717
+ },
718
+ errors: {
719
+ trend: 'decreasing',
720
+ change: '-8.1%',
721
+ prediction: 'stable',
722
+ },
723
+ };
709
724
  }
710
725
 
711
726
  function generatePredictions(trends) {
712
- return {
713
- nextWeek: 'Performance expected to remain stable',
714
- nextMonth: 'Usage likely to increase by 15-20%',
715
- nextQuarter: 'Consider scaling resources to handle growth'
716
- };
727
+ return {
728
+ nextWeek: 'Performance expected to remain stable',
729
+ nextMonth: 'Usage likely to increase by 15-20%',
730
+ nextQuarter: 'Consider scaling resources to handle growth',
731
+ };
717
732
  }
718
733
 
719
734
  function generateTrendInsights(trends) {
720
- return [
721
- 'System performance has improved by 5.2% this week',
722
- 'Usage patterns show steady growth indicating system adoption',
723
- 'Error rates are decreasing, suggesting improved stability'
724
- ];
735
+ return [
736
+ 'System performance has improved by 5.2% this week',
737
+ 'Usage patterns show steady growth indicating system adoption',
738
+ 'Error rates are decreasing, suggesting improved stability',
739
+ ];
725
740
  }
726
741
 
727
742
  function analyzeCosts() {
728
- return {
729
- current: {
730
- compute: 125.50,
731
- storage: 45.20,
732
- network: 23.10,
733
- tokens: 89.40
734
- },
735
- previous: {
736
- compute: 118.30,
737
- storage: 42.15,
738
- network: 21.85,
739
- tokens: 76.25
740
- },
741
- change: {
742
- compute: '+6.1%',
743
- storage: '+7.2%',
744
- network: '+5.7%',
745
- tokens: '+17.2%'
746
- }
747
- };
743
+ return {
744
+ current: {
745
+ compute: 125.5,
746
+ storage: 45.2,
747
+ network: 23.1,
748
+ tokens: 89.4,
749
+ },
750
+ previous: {
751
+ compute: 118.3,
752
+ storage: 42.15,
753
+ network: 21.85,
754
+ tokens: 76.25,
755
+ },
756
+ change: {
757
+ compute: '+6.1%',
758
+ storage: '+7.2%',
759
+ network: '+5.7%',
760
+ tokens: '+17.2%',
761
+ },
762
+ };
748
763
  }
749
764
 
750
765
  function generateCostOptimizations(costs) {
751
- return [
752
- 'Optimize token usage to reduce costs by ~15%',
753
- 'Implement better caching to reduce compute costs',
754
- 'Archive old data to reduce storage costs'
755
- ];
766
+ return [
767
+ 'Optimize token usage to reduce costs by ~15%',
768
+ 'Implement better caching to reduce compute costs',
769
+ 'Archive old data to reduce storage costs',
770
+ ];
756
771
  }
757
772
 
758
773
  function generateCostForecast(costs) {
759
- const total = Object.values(costs.current).reduce((a, b) => a + b, 0);
760
- return {
761
- nextMonth: total * 1.1,
762
- nextQuarter: total * 1.35,
763
- nextYear: total * 1.8
764
- };
774
+ const total = Object.values(costs.current).reduce((a, b) => a + b, 0);
775
+ return {
776
+ nextMonth: total * 1.1,
777
+ nextQuarter: total * 1.35,
778
+ nextYear: total * 1.8,
779
+ };
765
780
  }
766
781
 
767
782
  function assessQuality() {
768
- return {
769
- performance: 85,
770
- reliability: 92,
771
- security: 88,
772
- maintainability: 79,
773
- scalability: 83,
774
- documentation: 76
775
- };
783
+ return {
784
+ performance: 85,
785
+ reliability: 92,
786
+ security: 88,
787
+ maintainability: 79,
788
+ scalability: 83,
789
+ documentation: 76,
790
+ };
776
791
  }
777
792
 
778
793
  function calculateQualityScore(quality) {
779
- const scores = Object.values(quality);
780
- return Math.round(scores.reduce((a, b) => a + b, 0) / scores.length);
794
+ const scores = Object.values(quality);
795
+ return Math.round(scores.reduce((a, b) => a + b, 0) / scores.length);
781
796
  }
782
797
 
783
798
  function generateQualityRecommendations(quality) {
784
- const recommendations = [];
785
-
786
- Object.entries(quality).forEach(([key, value]) => {
787
- if (value < 80) {
788
- recommendations.push(`Improve ${key} metrics (current: ${value}%)`);
789
- }
790
- });
791
-
792
- return recommendations;
799
+ const recommendations = [];
800
+
801
+ Object.entries(quality).forEach(([key, value]) => {
802
+ if (value < 80) {
803
+ recommendations.push(`Improve ${key} metrics (current: ${value}%)`);
804
+ }
805
+ });
806
+
807
+ return recommendations;
793
808
  }
794
809
 
795
810
  function analyzeErrors() {
796
- return {
797
- total: 24,
798
- types: {
799
- '4xx': 15,
800
- '5xx': 9
801
- },
802
- common: [
803
- { code: 404, count: 8, message: 'Resource not found' },
804
- { code: 500, count: 5, message: 'Internal server error' },
805
- { code: 401, count: 4, message: 'Unauthorized access' }
806
- ]
807
- };
811
+ return {
812
+ total: 24,
813
+ types: {
814
+ '4xx': 15,
815
+ '5xx': 9,
816
+ },
817
+ common: [
818
+ { code: 404, count: 8, message: 'Resource not found' },
819
+ { code: 500, count: 5, message: 'Internal server error' },
820
+ { code: 401, count: 4, message: 'Unauthorized access' },
821
+ ],
822
+ };
808
823
  }
809
824
 
810
825
  function identifyErrorPatterns(errors) {
811
- return [
812
- 'Most errors occur during peak hours (12-2 PM)',
813
- '404 errors primarily from deprecated API endpoints',
814
- '500 errors correlate with database connection issues'
815
- ];
826
+ return [
827
+ 'Most errors occur during peak hours (12-2 PM)',
828
+ '404 errors primarily from deprecated API endpoints',
829
+ '500 errors correlate with database connection issues',
830
+ ];
816
831
  }
817
832
 
818
833
  function generateErrorResolutions(errors) {
819
- return [
820
- 'Implement proper redirects for deprecated endpoints',
821
- 'Add database connection pooling and retry logic',
822
- 'Enhance authentication error handling'
823
- ];
834
+ return [
835
+ 'Implement proper redirects for deprecated endpoints',
836
+ 'Add database connection pooling and retry logic',
837
+ 'Enhance authentication error handling',
838
+ ];
824
839
  }
825
840
 
826
841
  function calculateUsageStats() {
827
- return {
828
- totalUsers: 1250,
829
- activeUsers: 340,
830
- totalSessions: 2890,
831
- averageSessionDuration: 15.5,
832
- topFeatures: [
833
- { name: 'Analysis Tools', usage: 85 },
834
- { name: 'Monitoring', usage: 78 },
835
- { name: 'Reports', usage: 62 }
836
- ]
837
- };
842
+ return {
843
+ totalUsers: 1250,
844
+ activeUsers: 340,
845
+ totalSessions: 2890,
846
+ averageSessionDuration: 15.5,
847
+ topFeatures: [
848
+ { name: 'Analysis Tools', usage: 85 },
849
+ { name: 'Monitoring', usage: 78 },
850
+ { name: 'Reports', usage: 62 },
851
+ ],
852
+ };
838
853
  }
839
854
 
840
855
  function generateUsageInsights(stats) {
841
- return [
842
- `${stats.activeUsers} active users out of ${stats.totalUsers} total users`,
843
- `Average session duration is ${stats.averageSessionDuration} minutes`,
844
- 'Analysis Tools is the most popular feature'
845
- ];
856
+ return [
857
+ `${stats.activeUsers} active users out of ${stats.totalUsers} total users`,
858
+ `Average session duration is ${stats.averageSessionDuration} minutes`,
859
+ 'Analysis Tools is the most popular feature',
860
+ ];
846
861
  }
847
862
 
848
863
  function calculateUsageTrends(stats) {
849
- return {
850
- users: Array.from({ length: 30 }, () => Math.random() * 50 + stats.activeUsers - 25),
851
- sessions: Array.from({ length: 30 }, () => Math.random() * 100 + stats.totalSessions - 50)
852
- };
864
+ return {
865
+ users: Array.from({ length: 30 }, () => Math.random() * 50 + stats.activeUsers - 25),
866
+ sessions: Array.from({ length: 30 }, () => Math.random() * 100 + stats.totalSessions - 50),
867
+ };
853
868
  }
854
869
 
855
870
  function calculateOverallHealth(health) {
856
- const scores = Object.values(health);
857
- const average = scores.reduce((a, b) => a + b, 0) / scores.length;
858
-
859
- if (average >= 90) return 'excellent';
860
- if (average >= 70) return 'good';
861
- if (average >= 50) return 'warning';
862
- return 'critical';
871
+ const scores = Object.values(health);
872
+ const average = scores.reduce((a, b) => a + b, 0) / scores.length;
873
+
874
+ if (average >= 90) return 'excellent';
875
+ if (average >= 70) return 'good';
876
+ if (average >= 50) return 'warning';
877
+ return 'critical';
863
878
  }
864
879
 
865
880
  function generateHealthAlerts(health) {
866
- const alerts = [];
867
-
868
- Object.entries(health).forEach(([component, score]) => {
869
- if (score < 70) {
870
- alerts.push({
871
- component,
872
- score,
873
- severity: score < 50 ? 'critical' : 'warning',
874
- message: `${component} health score is ${score}%`
875
- });
876
- }
877
- });
878
-
879
- return alerts;
881
+ const alerts = [];
882
+
883
+ Object.entries(health).forEach(([component, score]) => {
884
+ if (score < 70) {
885
+ alerts.push({
886
+ component,
887
+ score,
888
+ severity: score < 50 ? 'critical' : 'warning',
889
+ message: `${component} health score is ${score}%`,
890
+ });
891
+ }
892
+ });
893
+
894
+ return alerts;
880
895
  }
881
896
 
882
897
  function generateLoadAlerts(load) {
883
- const alerts = [];
884
-
885
- if (load.current > 2.0) {
886
- alerts.push({
887
- type: 'critical',
888
- message: 'High system load detected',
889
- value: load.current
890
- });
891
- } else if (load.current > 1.5) {
892
- alerts.push({
893
- type: 'warning',
894
- message: 'Elevated system load',
895
- value: load.current
896
- });
897
- }
898
-
899
- return alerts;
898
+ const alerts = [];
899
+
900
+ if (load.current > 2.0) {
901
+ alerts.push({
902
+ type: 'critical',
903
+ message: 'High system load detected',
904
+ value: load.current,
905
+ });
906
+ } else if (load.current > 1.5) {
907
+ alerts.push({
908
+ type: 'warning',
909
+ message: 'Elevated system load',
910
+ value: load.current,
911
+ });
912
+ }
913
+
914
+ return alerts;
900
915
  }
901
916
 
902
917
  function predictLoadTrends(load) {
903
- return {
904
- nextHour: load.current * (0.9 + Math.random() * 0.2),
905
- nextDay: load.current * (0.8 + Math.random() * 0.4),
906
- nextWeek: load.current * (0.7 + Math.random() * 0.6)
907
- };
918
+ return {
919
+ nextHour: load.current * (0.9 + Math.random() * 0.2),
920
+ nextDay: load.current * (0.8 + Math.random() * 0.4),
921
+ nextWeek: load.current * (0.7 + Math.random() * 0.6),
922
+ };
908
923
  }
909
924
 
910
925
  function planCapacity() {
911
- return {
912
- current: {
913
- cpu: 65,
914
- memory: 72,
915
- storage: 58,
916
- network: 45
917
- },
918
- projected: {
919
- cpu: 78,
920
- memory: 85,
921
- storage: 72,
922
- network: 58
923
- },
924
- timeToLimit: {
925
- cpu: '3 months',
926
- memory: '2 months',
927
- storage: '6 months',
928
- network: '8 months'
929
- }
930
- };
926
+ return {
927
+ current: {
928
+ cpu: 65,
929
+ memory: 72,
930
+ storage: 58,
931
+ network: 45,
932
+ },
933
+ projected: {
934
+ cpu: 78,
935
+ memory: 85,
936
+ storage: 72,
937
+ network: 58,
938
+ },
939
+ timeToLimit: {
940
+ cpu: '3 months',
941
+ memory: '2 months',
942
+ storage: '6 months',
943
+ network: '8 months',
944
+ },
945
+ };
931
946
  }
932
947
 
933
948
  function generateCapacityRecommendations(capacity) {
934
- const recommendations = [];
935
-
936
- Object.entries(capacity.projected).forEach(([resource, usage]) => {
937
- if (usage > 80) {
938
- recommendations.push(`Plan to scale ${resource} resources within next 2 months`);
939
- } else if (usage > 70) {
940
- recommendations.push(`Monitor ${resource} usage closely`);
941
- }
942
- });
943
-
944
- return recommendations;
949
+ const recommendations = [];
950
+
951
+ Object.entries(capacity.projected).forEach(([resource, usage]) => {
952
+ if (usage > 80) {
953
+ recommendations.push(`Plan to scale ${resource} resources within next 2 months`);
954
+ } else if (usage > 70) {
955
+ recommendations.push(`Monitor ${resource} usage closely`);
956
+ }
957
+ });
958
+
959
+ return recommendations;
945
960
  }
946
961
 
947
962
  function generateCapacityTimeline(capacity) {
948
- return {
949
- immediate: 'Monitor current usage patterns',
950
- '1month': 'Prepare for memory scaling',
951
- '2months': 'Implement memory upgrades',
952
- '3months': 'Plan CPU scaling',
953
- '6months': 'Review storage requirements'
954
- };
963
+ return {
964
+ immediate: 'Monitor current usage patterns',
965
+ '1month': 'Prepare for memory scaling',
966
+ '2months': 'Implement memory upgrades',
967
+ '3months': 'Plan CPU scaling',
968
+ '6months': 'Review storage requirements',
969
+ };
955
970
  }
956
971
 
957
- module.exports = router;
972
+ module.exports = router;