claude-flow-novice 1.3.5 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (356) hide show
  1. package/.claude/agents/analysis/code-analyzer.md +3 -20
  2. package/.claude/agents/analysis/code-review/analyze-code-quality.md +1 -1
  3. package/.claude/agents/analyst.md +300 -0
  4. package/.claude/agents/architect.md +557 -0
  5. package/.claude/agents/architecture/system-architect.md +630 -0
  6. package/.claude/agents/architecture/system-design/arch-system-design.md +1 -1
  7. package/.claude/agents/base-template-generator.md +24 -1
  8. package/.claude/agents/coder.md +180 -0
  9. package/.claude/agents/consensus/byzantine-coordinator.md +4 -21
  10. package/.claude/agents/consensus/consensus-builder.md +3 -20
  11. package/.claude/agents/consensus/crdt-synchronizer.md +4 -21
  12. package/.claude/agents/consensus/gossip-coordinator.md +4 -21
  13. package/.claude/agents/consensus/performance-benchmarker.md +4 -21
  14. package/.claude/agents/consensus/quorum-manager.md +4 -21
  15. package/.claude/agents/consensus/raft-manager.md +4 -21
  16. package/.claude/agents/consensus/security-manager.md +4 -21
  17. package/.claude/agents/coordinator.md +842 -0
  18. package/.claude/agents/data/ml/data-ml-model.md +2 -2
  19. package/.claude/agents/development/backend/dev-backend-api.md +2 -2
  20. package/.claude/agents/devops/ci-cd/ops-cicd-github.md +2 -2
  21. package/.claude/agents/devops/devops-engineer.md +638 -0
  22. package/.claude/agents/documentation/api-docs/docs-api-openapi.md +2 -2
  23. package/.claude/agents/github/code-review-swarm.md +1 -1
  24. package/.claude/agents/github/github-specialist.md +856 -0
  25. package/.claude/agents/github/pr-manager.md +1 -1
  26. package/.claude/agents/github/release-manager.md +1 -1
  27. package/.claude/agents/neural/neural-pattern-agent.md +762 -0
  28. package/.claude/agents/optimization/benchmark-suite.md +1 -1
  29. package/.claude/agents/optimization/perf-analyzer.md +725 -0
  30. package/.claude/agents/optimization/performance-monitor.md +1 -1
  31. package/.claude/agents/planner.md +135 -0
  32. package/.claude/agents/researcher.md +185 -0
  33. package/.claude/agents/reviewer.md +291 -0
  34. package/.claude/agents/security/security-specialist.md +978 -0
  35. package/.claude/agents/sparc/architecture.md +1 -1
  36. package/.claude/agents/sparc/pseudocode.md +1 -1
  37. package/.claude/agents/sparc/refinement.md +1 -1
  38. package/.claude/agents/sparc/specification.md +1 -1
  39. package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +2 -2
  40. package/.claude/agents/swarm/adaptive-coordinator-enhanced.md +746 -0
  41. package/.claude/agents/tester.md +663 -0
  42. package/.claude/agents/testing/unit/tdd-london-swarm.md +1 -1
  43. package/.claude/agents/testing/validation/production-validator.md +1 -1
  44. package/.claude/commands/claude-soul.js +1 -1
  45. package/.claude/hooks.json +12 -15
  46. package/{.claude → .claude-flow-novice/.claude}/agents/MIGRATION_SUMMARY.md +1 -1
  47. package/.claude-flow-novice/.claude/agents/analysis/code-analyzer.md +192 -0
  48. package/.claude-flow-novice/.claude/agents/analysis/code-review/analyze-code-quality.md +180 -0
  49. package/.claude-flow-novice/.claude/agents/analyst.md +300 -0
  50. package/.claude-flow-novice/.claude/agents/architect.md +557 -0
  51. package/.claude-flow-novice/.claude/agents/architecture/system-architect.md +630 -0
  52. package/.claude-flow-novice/.claude/agents/architecture/system-design/arch-system-design.md +156 -0
  53. package/.claude-flow-novice/.claude/agents/backend-dev.json +42 -0
  54. package/.claude-flow-novice/.claude/agents/base-template-generator.md +65 -0
  55. package/.claude-flow-novice/.claude/agents/code-analyzer.json +39 -0
  56. package/.claude-flow-novice/.claude/agents/coder.json +42 -0
  57. package/.claude-flow-novice/.claude/agents/coder.md +180 -0
  58. package/.claude-flow-novice/.claude/agents/consensus/byzantine-coordinator.md +46 -0
  59. package/.claude-flow-novice/.claude/agents/consensus/consensus-builder.md +225 -0
  60. package/.claude-flow-novice/.claude/agents/consensus/crdt-synchronizer.md +980 -0
  61. package/.claude-flow-novice/.claude/agents/consensus/gossip-coordinator.md +46 -0
  62. package/.claude-flow-novice/.claude/agents/consensus/performance-benchmarker.md +834 -0
  63. package/.claude-flow-novice/.claude/agents/consensus/quorum-manager.md +806 -0
  64. package/.claude-flow-novice/.claude/agents/consensus/raft-manager.md +46 -0
  65. package/.claude-flow-novice/.claude/agents/consensus/security-manager.md +605 -0
  66. package/.claude-flow-novice/.claude/agents/coordinator.md +842 -0
  67. package/.claude-flow-novice/.claude/agents/data/ml/data-ml-model.md +193 -0
  68. package/.claude-flow-novice/.claude/agents/development/backend/dev-backend-api.md +142 -0
  69. package/.claude-flow-novice/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
  70. package/.claude-flow-novice/.claude/agents/devops/devops-engineer.md +638 -0
  71. package/.claude-flow-novice/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
  72. package/.claude-flow-novice/.claude/agents/github/code-review-swarm.md +538 -0
  73. package/.claude-flow-novice/.claude/agents/github/github-modes.md +173 -0
  74. package/.claude-flow-novice/.claude/agents/github/github-specialist.md +856 -0
  75. package/.claude-flow-novice/.claude/agents/github/issue-tracker.md +319 -0
  76. package/.claude-flow-novice/.claude/agents/github/multi-repo-swarm.md +553 -0
  77. package/.claude-flow-novice/.claude/agents/github/pr-manager.md +191 -0
  78. package/.claude-flow-novice/.claude/agents/github/project-board-sync.md +509 -0
  79. package/.claude-flow-novice/.claude/agents/github/release-manager.md +367 -0
  80. package/.claude-flow-novice/.claude/agents/github/release-swarm.md +583 -0
  81. package/.claude-flow-novice/.claude/agents/github/repo-architect.md +398 -0
  82. package/.claude-flow-novice/.claude/agents/github/swarm-issue.md +573 -0
  83. package/.claude-flow-novice/.claude/agents/github/swarm-pr.md +428 -0
  84. package/.claude-flow-novice/.claude/agents/github/sync-coordinator.md +452 -0
  85. package/.claude-flow-novice/.claude/agents/github/workflow-automation.md +635 -0
  86. package/.claude-flow-novice/.claude/agents/goal/goal-planner.md +73 -0
  87. package/.claude-flow-novice/.claude/agents/neural/neural-pattern-agent.md +762 -0
  88. package/.claude-flow-novice/.claude/agents/neural/safla-neural.md +74 -0
  89. package/.claude-flow-novice/.claude/agents/optimization/benchmark-suite.md +665 -0
  90. package/.claude-flow-novice/.claude/agents/optimization/load-balancer.md +431 -0
  91. package/.claude-flow-novice/.claude/agents/optimization/perf-analyzer.md +725 -0
  92. package/.claude-flow-novice/.claude/agents/optimization/performance-monitor.md +672 -0
  93. package/.claude-flow-novice/.claude/agents/optimization/resource-allocator.md +674 -0
  94. package/.claude-flow-novice/.claude/agents/optimization/topology-optimizer.md +808 -0
  95. package/.claude-flow-novice/.claude/agents/planner.json +41 -0
  96. package/.claude-flow-novice/.claude/agents/planner.md +135 -0
  97. package/.claude-flow-novice/.claude/agents/researcher.json +41 -0
  98. package/.claude-flow-novice/.claude/agents/researcher.md +185 -0
  99. package/.claude-flow-novice/.claude/agents/reviewer.json +39 -0
  100. package/.claude-flow-novice/.claude/agents/reviewer.md +291 -0
  101. package/.claude-flow-novice/.claude/agents/security/security-specialist.md +978 -0
  102. package/.claude-flow-novice/.claude/agents/sparc/architecture.md +472 -0
  103. package/.claude-flow-novice/.claude/agents/sparc/pseudocode.md +318 -0
  104. package/.claude-flow-novice/.claude/agents/sparc/refinement.md +525 -0
  105. package/.claude-flow-novice/.claude/agents/sparc/specification.md +276 -0
  106. package/.claude-flow-novice/.claude/agents/specialized/mobile/spec-mobile-react-native.md +226 -0
  107. package/.claude-flow-novice/.claude/agents/sublinear/consciousness-evolution-agent.md +499 -0
  108. package/.claude-flow-novice/.claude/agents/sublinear/matrix-solver-agent.md +113 -0
  109. package/.claude-flow-novice/.claude/agents/sublinear/nanosecond-scheduler-agent.md +644 -0
  110. package/.claude-flow-novice/.claude/agents/sublinear/pagerank-agent.md +699 -0
  111. package/.claude-flow-novice/.claude/agents/sublinear/phi-calculator-agent.md +749 -0
  112. package/.claude-flow-novice/.claude/agents/sublinear/psycho-symbolic-agent.md +543 -0
  113. package/.claude-flow-novice/.claude/agents/sublinear/sublinear.md +816 -0
  114. package/.claude-flow-novice/.claude/agents/sublinear/temporal-advantage-agent.md +360 -0
  115. package/.claude-flow-novice/.claude/agents/swarm/adaptive-coordinator-enhanced.md +746 -0
  116. package/.claude-flow-novice/.claude/agents/swarm/adaptive-coordinator.md +396 -0
  117. package/.claude-flow-novice/.claude/agents/swarm/hierarchical-coordinator.md +300 -0
  118. package/.claude-flow-novice/.claude/agents/swarm/mesh-coordinator.md +435 -0
  119. package/.claude-flow-novice/.claude/agents/system-architect.json +40 -0
  120. package/.claude-flow-novice/.claude/agents/templates/automation-smart-agent.md +205 -0
  121. package/.claude-flow-novice/.claude/agents/templates/coordinator-swarm-init.md +90 -0
  122. package/.claude-flow-novice/.claude/agents/templates/github-pr-manager.md +177 -0
  123. package/.claude-flow-novice/.claude/agents/templates/implementer-sparc-coder.md +259 -0
  124. package/.claude-flow-novice/.claude/agents/templates/memory-coordinator.md +187 -0
  125. package/.claude-flow-novice/.claude/agents/templates/migration-plan.md +746 -0
  126. package/.claude-flow-novice/.claude/agents/templates/orchestrator-task.md +139 -0
  127. package/.claude-flow-novice/.claude/agents/templates/performance-analyzer.md +199 -0
  128. package/.claude-flow-novice/.claude/agents/templates/sparc-coordinator.md +183 -0
  129. package/.claude-flow-novice/.claude/agents/tester.json +40 -0
  130. package/.claude-flow-novice/.claude/agents/tester.md +663 -0
  131. package/.claude-flow-novice/.claude/agents/testing/e2e/playwright-agent.md +249 -0
  132. package/.claude-flow-novice/.claude/agents/testing/unit/tdd-london-swarm.md +244 -0
  133. package/.claude-flow-novice/.claude/agents/testing/validation/production-validator.md +395 -0
  134. package/.claude-flow-novice/dist/index.js +12 -24
  135. package/.claude-flow-novice/dist/index.js.map +1 -0
  136. package/.claude-flow-novice/dist/src/agents/agent-manager.js +123 -69
  137. package/.claude-flow-novice/dist/src/agents/agent-manager.js.map +1 -1
  138. package/.claude-flow-novice/dist/src/agents/github/utils/hook-integration.js +7 -7
  139. package/.claude-flow-novice/dist/src/agents/github/utils/hook-integration.js.map +1 -1
  140. package/.claude-flow-novice/dist/src/agents/stage3-integration-validator.js +485 -0
  141. package/.claude-flow-novice/dist/src/agents/stage3-integration-validator.js.map +1 -0
  142. package/.claude-flow-novice/dist/src/agents/unified-ultra-fast-agent-manager.js +630 -0
  143. package/.claude-flow-novice/dist/src/agents/unified-ultra-fast-agent-manager.js.map +1 -0
  144. package/.claude-flow-novice/dist/src/cli/commands/agent.js +1 -1
  145. package/.claude-flow-novice/dist/src/cli/commands/agent.js.map +1 -1
  146. package/.claude-flow-novice/dist/src/cli/commands/config-integration.js +6 -6
  147. package/.claude-flow-novice/dist/src/cli/commands/enterprise.js +18 -18
  148. package/.claude-flow-novice/dist/src/cli/commands/enterprise.js.map +1 -1
  149. package/.claude-flow-novice/dist/src/cli/commands/goal-init.js +4 -4
  150. package/.claude-flow-novice/dist/src/cli/commands/help-new.js +23 -23
  151. package/.claude-flow-novice/dist/src/cli/commands/help-new.js.map +1 -1
  152. package/.claude-flow-novice/dist/src/cli/commands/help.js +74 -74
  153. package/.claude-flow-novice/dist/src/cli/commands/help.js.map +1 -1
  154. package/.claude-flow-novice/dist/src/cli/commands/hive-mind/pause.js +2 -2
  155. package/.claude-flow-novice/dist/src/cli/commands/hive-mind/pause.js.map +1 -1
  156. package/.claude-flow-novice/dist/src/cli/commands/hive.js +4 -4
  157. package/.claude-flow-novice/dist/src/cli/commands/index.js +103 -132
  158. package/.claude-flow-novice/dist/src/cli/commands/index.js.map +1 -1
  159. package/.claude-flow-novice/dist/src/cli/commands/mcp.js +1 -1
  160. package/.claude-flow-novice/dist/src/cli/commands/migrate.js +4 -4
  161. package/.claude-flow-novice/dist/src/cli/commands/migrate.js.map +1 -1
  162. package/.claude-flow-novice/dist/src/cli/commands/monitor.js +1 -1
  163. package/.claude-flow-novice/dist/src/cli/commands/neural-init.js +4 -4
  164. package/.claude-flow-novice/dist/src/cli/commands/ruv-swarm.js +8 -8
  165. package/.claude-flow-novice/dist/src/cli/commands/sparc.js +12 -12
  166. package/.claude-flow-novice/dist/src/cli/commands/sparc.js.map +1 -1
  167. package/.claude-flow-novice/dist/src/cli/commands/start/start-command.js +3 -3
  168. package/.claude-flow-novice/dist/src/cli/commands/status.js +1 -1
  169. package/.claude-flow-novice/dist/src/cli/commands/swarm.js +7 -7
  170. package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
  171. package/.claude-flow-novice/dist/src/cli/commands/verification.js +18 -18
  172. package/.claude-flow-novice/dist/src/cli/completion.js +54 -54
  173. package/.claude-flow-novice/dist/src/cli/completion.js.map +1 -1
  174. package/.claude-flow-novice/dist/src/cli/consolidated/ConsolidatedCLI.js +11 -11
  175. package/.claude-flow-novice/dist/src/cli/consolidated/ConsolidatedCLI.js.map +1 -1
  176. package/.claude-flow-novice/dist/src/cli/consolidated/core/CommandHandlers.js +31 -31
  177. package/.claude-flow-novice/dist/src/cli/consolidated/core/TierManager.js +39 -39
  178. package/.claude-flow-novice/dist/src/cli/consolidated/core/TierManager.js.map +1 -1
  179. package/.claude-flow-novice/dist/src/cli/consolidated/help/InteractiveHelp.js +25 -25
  180. package/.claude-flow-novice/dist/src/cli/consolidated/help/InteractiveHelp.js.map +1 -1
  181. package/.claude-flow-novice/dist/src/cli/consolidated/routing/CommandRouter.js +8 -8
  182. package/.claude-flow-novice/dist/src/cli/consolidated/routing/CommandRouter.js.map +1 -1
  183. package/.claude-flow-novice/dist/src/cli/consolidated/utils/IntelligentDefaults.js +6 -6
  184. package/.claude-flow-novice/dist/src/cli/consolidated/utils/IntelligentDefaults.js.map +1 -1
  185. package/.claude-flow-novice/dist/src/cli/consolidated/utils/PerformanceOptimizer.js +7 -7
  186. package/.claude-flow-novice/dist/src/cli/consolidated/utils/PerformanceOptimizer.js.map +1 -1
  187. package/.claude-flow-novice/dist/src/cli/index-remote.js +10 -10
  188. package/.claude-flow-novice/dist/src/cli/index.js +1 -1
  189. package/.claude-flow-novice/dist/src/cli/init/directory-structure.js +8 -8
  190. package/.claude-flow-novice/dist/src/cli/init/index.js +3 -3
  191. package/.claude-flow-novice/dist/src/cli/init/sparc-environment.js +67 -67
  192. package/.claude-flow-novice/dist/src/cli/init/swarm-commands.js +18 -18
  193. package/.claude-flow-novice/dist/src/cli/node-repl.js +2 -2
  194. package/.claude-flow-novice/dist/src/cli/repl.js +1 -1
  195. package/.claude-flow-novice/dist/src/cli/simple-cli.js +68 -68
  196. package/.claude-flow-novice/dist/src/cli/simple-cli.js.map +1 -1
  197. package/.claude-flow-novice/dist/src/cli/simple-commands/session-start-soul.js +271 -0
  198. package/.claude-flow-novice/dist/src/cli/simple-orchestrator.js +7 -7
  199. package/.claude-flow-novice/dist/src/cli/simple-orchestrator.js.map +1 -1
  200. package/.claude-flow-novice/dist/src/cli/ui/fallback-handler.js +7 -7
  201. package/.claude-flow-novice/dist/src/communication/enhanced-event-bus.js +816 -0
  202. package/.claude-flow-novice/dist/src/communication/enhanced-event-bus.js.map +1 -0
  203. package/.claude-flow-novice/dist/src/communication/failure-recovery-system.js +812 -0
  204. package/.claude-flow-novice/dist/src/communication/failure-recovery-system.js.map +1 -0
  205. package/.claude-flow-novice/dist/src/communication/optimized-serialization.js +369 -0
  206. package/.claude-flow-novice/dist/src/communication/optimized-serialization.js.map +1 -0
  207. package/.claude-flow-novice/dist/src/communication/performance-optimizations.js +526 -0
  208. package/.claude-flow-novice/dist/src/communication/performance-optimizations.js.map +1 -0
  209. package/.claude-flow-novice/dist/src/communication/performance-validator.js +532 -0
  210. package/.claude-flow-novice/dist/src/communication/performance-validator.js.map +1 -0
  211. package/.claude-flow-novice/dist/src/communication/priority-message-queue.js +525 -0
  212. package/.claude-flow-novice/dist/src/communication/priority-message-queue.js.map +1 -0
  213. package/.claude-flow-novice/dist/src/communication/shared-buffer-bus.js +218 -0
  214. package/.claude-flow-novice/dist/src/communication/shared-buffer-bus.js.map +1 -0
  215. package/.claude-flow-novice/dist/src/communication/ultra-fast-communication-bus.js +521 -0
  216. package/.claude-flow-novice/dist/src/communication/ultra-fast-communication-bus.js.map +1 -0
  217. package/.claude-flow-novice/dist/src/communication/ultra-fast-serialization.js +563 -0
  218. package/.claude-flow-novice/dist/src/communication/ultra-fast-serialization.js.map +1 -0
  219. package/.claude-flow-novice/dist/src/communication/websocket-cluster.js +344 -0
  220. package/.claude-flow-novice/dist/src/communication/websocket-cluster.js.map +1 -0
  221. package/.claude-flow-novice/dist/src/communication/zero-copy-structures.js +369 -0
  222. package/.claude-flow-novice/dist/src/communication/zero-copy-structures.js.map +1 -0
  223. package/.claude-flow-novice/dist/src/config/config-manager.js +1 -1
  224. package/.claude-flow-novice/dist/src/config/config-manager.js.map +1 -1
  225. package/.claude-flow-novice/dist/src/config/core/intelligent-configuration-manager.js +1 -1
  226. package/.claude-flow-novice/dist/src/config/integration/hooks-integration.js +6 -6
  227. package/.claude-flow-novice/dist/src/config/integration/hooks-integration.js.map +1 -1
  228. package/.claude-flow-novice/dist/src/config/migration/config-migration.js +1 -1
  229. package/.claude-flow-novice/dist/src/config/ruv-swarm-integration.js +1 -1
  230. package/.claude-flow-novice/dist/src/config/utils/zero-config-setup.js +1 -1
  231. package/.claude-flow-novice/dist/src/config/utils/zero-config-setup.js.map +1 -1
  232. package/.claude-flow-novice/dist/src/config/web-portal-config.js +0 -9
  233. package/.claude-flow-novice/dist/src/config/web-portal-config.js.map +1 -1
  234. package/.claude-flow-novice/dist/src/config/zero-config-setup.js +18 -18
  235. package/.claude-flow-novice/dist/src/config/zero-config-setup.js.map +1 -1
  236. package/.claude-flow-novice/dist/src/core/logger.js +33 -10
  237. package/.claude-flow-novice/dist/src/core/logger.js.map +1 -1
  238. package/.claude-flow-novice/dist/src/migration/index.js +1 -1
  239. package/.claude-flow-novice/dist/src/migration/index.js.map +1 -1
  240. package/.claude-flow-novice/dist/src/migration/migration-runner.js +4 -4
  241. package/.claude-flow-novice/dist/src/migration/migration-runner.js.map +1 -1
  242. package/.claude-flow-novice/dist/src/monitoring/agent-health-monitor.js +430 -0
  243. package/.claude-flow-novice/dist/src/monitoring/agent-health-monitor.js.map +1 -0
  244. package/.claude-flow-novice/dist/src/slash-commands/claude-soul.js +248 -365
  245. package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +1 -1
  246. package/.claude-flow-novice/dist/src/swarm/claude-code-interface.js +1 -1
  247. package/.claude-flow-novice/dist/src/swarm/claude-flow-executor.js +1 -1
  248. package/.claude-flow-novice/dist/src/swarm/consensus-coordinator.js +471 -0
  249. package/.claude-flow-novice/dist/src/swarm/consensus-coordinator.js.map +1 -0
  250. package/.claude-flow-novice/dist/src/swarm/hive-mind-integration.js +1 -1
  251. package/.claude-flow-novice/dist/src/swarm/large-scale-coordinator.js +543 -0
  252. package/.claude-flow-novice/dist/src/swarm/large-scale-coordinator.js.map +1 -0
  253. package/.claude-flow-novice/dist/src/swarm/optimizations/connection-pool.js +1 -1
  254. package/.claude-flow-novice/dist/src/swarm/optimizations/optimized-executor.js +1 -1
  255. package/.claude-flow-novice/dist/src/swarm/types.js.map +1 -1
  256. package/.claude-flow-novice/dist/src/swarm-fullstack/integrations/communication-bridge.js +709 -0
  257. package/.claude-flow-novice/dist/src/swarm-fullstack/integrations/communication-bridge.js.map +1 -0
  258. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/api-contract-validator.js +612 -0
  259. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/api-contract-validator.js.map +1 -0
  260. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/backend-test-orchestrator.js +679 -0
  261. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/backend-test-orchestrator.js.map +1 -0
  262. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/frontend-test-orchestrator.js +654 -0
  263. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/frontend-test-orchestrator.js.map +1 -0
  264. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/visual-regression.js +402 -0
  265. package/.claude-flow-novice/dist/src/swarm-fullstack/testing/visual-regression.js.map +1 -0
  266. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/convergence-detector.js +459 -0
  267. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/convergence-detector.js.map +1 -0
  268. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/fix-coordinator.js +513 -0
  269. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/fix-coordinator.js.map +1 -0
  270. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/index.js +19 -0
  271. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/index.js.map +1 -0
  272. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/iterative-build-test.js +568 -0
  273. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/iterative-build-test.js.map +1 -0
  274. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/regression-test-manager.js +418 -0
  275. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/regression-test-manager.js.map +1 -0
  276. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/test-result-analyzer.js +530 -0
  277. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/test-result-analyzer.js.map +1 -0
  278. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/workflow-metrics.js +250 -0
  279. package/.claude-flow-novice/dist/src/swarm-fullstack/workflows/workflow-metrics.js.map +1 -0
  280. package/.claude-flow-novice/dist/src/task/index.js +7 -7
  281. package/.claude-flow-novice/dist/src/validation/fullstack-integration-validator.js +420 -0
  282. package/.claude-flow-novice/dist/src/validation/fullstack-integration-validator.js.map +1 -0
  283. package/.claude-flow-novice/dist/src/validation/production-validator.js +1435 -0
  284. package/.claude-flow-novice/dist/src/validation/production-validator.js.map +1 -0
  285. package/.claude-flow-novice/dist/src/verification/cli-integration.js +3 -3
  286. package/.claude-flow-novice/dist/src/verification/hooks.js +1 -1
  287. package/CHANGELOG.md +13 -0
  288. package/CLAUDE.md +1032 -61
  289. package/README.md +0 -1
  290. package/config/build/babel.config.cjs +19 -11
  291. package/config/typescript/tsconfig.json +1 -1
  292. package/examples/02-workflows/claude-workflow.json +5 -5
  293. package/examples/claude-api-error-handling.ts +2 -2
  294. package/examples/frontend-testing-demo.ts +470 -0
  295. package/examples/litellm/config/config.yaml +1 -1
  296. package/package.json +13 -7
  297. package/scripts/build/unified-builder.sh +6 -6
  298. package/scripts/build/validate-agents.js +238 -0
  299. package/scripts/post-install-claude-md.js +28 -0
  300. package/scripts/run-production-validation.ts +590 -0
  301. package/scripts/test/test-coordination-features.ts +2 -2
  302. package/scripts/validate-stage3-performance.ts +377 -0
  303. package/src/cli/simple-commands/hooks.js +1 -0
  304. package/src/cli/simple-commands/init/agent-copier.js +0 -2
  305. package/src/cli/simple-commands/init/index.js +18 -110
  306. package/src/cli/simple-commands/init/templates/CLAUDE.md +162 -1158
  307. package/src/cli/simple-commands/init/templates/claude-md.js +38 -157
  308. package/src/swarm-fullstack/integrations/communication-bridge.ts +931 -0
  309. package/src/swarm-fullstack/testing/api-contract-validator.ts +909 -0
  310. package/src/swarm-fullstack/testing/backend-test-orchestrator.ts +791 -0
  311. package/src/swarm-fullstack/testing/frontend-test-orchestrator.ts +853 -0
  312. package/src/swarm-fullstack/testing/visual-regression.ts +507 -0
  313. package/src/swarm-fullstack/workflows/convergence-detector.ts +736 -0
  314. package/src/swarm-fullstack/workflows/fix-coordinator.ts +677 -0
  315. package/src/swarm-fullstack/workflows/index.ts +75 -0
  316. package/src/swarm-fullstack/workflows/iterative-build-test.ts +829 -0
  317. package/src/swarm-fullstack/workflows/regression-test-manager.ts +590 -0
  318. package/src/swarm-fullstack/workflows/test-result-analyzer.ts +739 -0
  319. package/src/swarm-fullstack/workflows/workflow-metrics.ts +399 -0
  320. package/wiki/command-reference/README.md +1 -2
  321. package/wiki/command-reference/mcp-tools/README.md +1 -1
  322. package/wiki/getting-started/claude-code-mcp/README.md +1 -2
  323. package/wiki/getting-started/installation/README.md +2 -10
  324. package/.claude/agents/backend-dev.json +0 -9
  325. package/.claude/agents/code-analyzer.json +0 -9
  326. package/.claude/agents/coder.json +0 -9
  327. package/.claude/agents/planner.json +0 -9
  328. package/.claude/agents/researcher.json +0 -9
  329. package/.claude/agents/reviewer.json +0 -9
  330. package/.claude/agents/system-architect.json +0 -9
  331. package/.claude/agents/tester.json +0 -9
  332. package/.claude/commands/flow-nexus/app-store.md +0 -124
  333. package/.claude/commands/flow-nexus/challenges.md +0 -120
  334. package/.claude/commands/flow-nexus/login-registration.md +0 -65
  335. package/.claude/commands/flow-nexus/neural-network.md +0 -134
  336. package/.claude/commands/flow-nexus/payments.md +0 -116
  337. package/.claude/commands/flow-nexus/sandbox.md +0 -83
  338. package/.claude/commands/flow-nexus/swarm.md +0 -87
  339. package/.claude/commands/flow-nexus/user-tools.md +0 -152
  340. package/.claude/commands/flow-nexus/workflow.md +0 -115
  341. package/.claude-flow-novice/dist/cli/index.js +0 -45
  342. package/.claude-flow-novice/dist/core/index.js +0 -22
  343. package/.claude-flow-novice/dist/mcp/mcp-server-novice.js +0 -595
  344. package/.claude-flow-novice/dist/mcp/mcp-server-sdk.js +0 -649
  345. package/.claude-flow-novice/dist/mcp/mcp-server-with-slash-commands.js +0 -776
  346. package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/claude-md.js +0 -1101
  347. package/src/cli/simple-commands/init/templates/CLAUDE.md.optimized +0 -265
  348. /package/{.claude → .claude-flow-novice/.claude}/agents/README.md +0 -0
  349. /package/{.claude → .claude-flow-novice/.claude}/agents/consensus/README.md +0 -0
  350. /package/{.claude → .claude-flow-novice/.claude}/agents/core/coder.md +0 -0
  351. /package/{.claude → .claude-flow-novice/.claude}/agents/core/planner.md +0 -0
  352. /package/{.claude → .claude-flow-novice/.claude}/agents/core/researcher.md +0 -0
  353. /package/{.claude → .claude-flow-novice/.claude}/agents/core/reviewer.md +0 -0
  354. /package/{.claude → .claude-flow-novice/.claude}/agents/core/tester.md +0 -0
  355. /package/{.claude → .claude-flow-novice/.claude}/agents/optimization/README.md +0 -0
  356. /package/{.claude → .claude-flow-novice/.claude}/agents/swarm/README.md +0 -0
@@ -0,0 +1,526 @@
1
+ /**
2
+ * High-Performance Monitoring and Optimization System
3
+ * Nanosecond-precision timing and real-time performance tracking
4
+ * Target: Sub-microsecond measurement overhead
5
+ */ import { performance } from 'perf_hooks';
6
+ // High-resolution timer with RDTSC support simulation
7
+ export class NanosecondTimer {
8
+ static PERFORMANCE_NOW_TO_NS = 1_000_000;
9
+ static calibrationOffset = 0n;
10
+ static{
11
+ // Calibrate timer on module load
12
+ this.calibrate();
13
+ }
14
+ static calibrate() {
15
+ // Simulate RDTSC calibration
16
+ const samples = 100;
17
+ let totalDiff = 0n;
18
+ for(let i = 0; i < samples; i++){
19
+ const start = this.now();
20
+ // Simulate minimal work
21
+ const end = this.now();
22
+ totalDiff += end - start;
23
+ }
24
+ this.calibrationOffset = totalDiff / BigInt(samples);
25
+ }
26
+ // High-precision timestamp in nanoseconds
27
+ static now() {
28
+ return BigInt(Math.floor(performance.now() * this.PERFORMANCE_NOW_TO_NS));
29
+ }
30
+ // RDTSC simulation for even higher precision
31
+ static rdtsc() {
32
+ // In a real implementation, this would use native RDTSC instruction
33
+ // For simulation, we use high-resolution performance.now()
34
+ const hrTime = process.hrtime.bigint();
35
+ return hrTime;
36
+ }
37
+ // Measure execution time with minimal overhead
38
+ static measure(fn) {
39
+ const start = this.rdtsc();
40
+ const result = fn();
41
+ const end = this.rdtsc();
42
+ return {
43
+ result,
44
+ duration: end - start - this.calibrationOffset
45
+ };
46
+ }
47
+ // Async measurement
48
+ static async measureAsync(fn) {
49
+ const start = this.rdtsc();
50
+ const result = await fn();
51
+ const end = this.rdtsc();
52
+ return {
53
+ result,
54
+ duration: end - start - this.calibrationOffset
55
+ };
56
+ }
57
+ }
58
+ // Real-time latency histogram with logarithmic buckets
59
+ export class LatencyHistogram {
60
+ buckets;
61
+ bucketBoundaries;
62
+ count = 0;
63
+ sum = 0n;
64
+ min = Number.MAX_SAFE_INTEGER;
65
+ max = 0;
66
+ maxLatencyNs;
67
+ constructor(maxLatencyMs = 10, bucketCount = 200){
68
+ this.maxLatencyNs = maxLatencyMs * 1_000_000;
69
+ this.buckets = new Uint32Array(bucketCount);
70
+ this.bucketBoundaries = this.generateLogBuckets(bucketCount);
71
+ }
72
+ generateLogBuckets(count) {
73
+ const boundaries = [];
74
+ const logMax = Math.log10(this.maxLatencyNs);
75
+ const logMin = Math.log10(10); // 10ns minimum
76
+ const step = (logMax - logMin) / (count - 1);
77
+ for(let i = 0; i < count; i++){
78
+ const logValue = logMin + i * step;
79
+ boundaries.push(Math.pow(10, logValue));
80
+ }
81
+ return boundaries;
82
+ }
83
+ record(latencyNs) {
84
+ this.count++;
85
+ this.sum += BigInt(latencyNs);
86
+ this.min = Math.min(this.min, latencyNs);
87
+ this.max = Math.max(this.max, latencyNs);
88
+ // Find appropriate bucket using binary search
89
+ const bucketIndex = this.findBucket(latencyNs);
90
+ if (bucketIndex < this.buckets.length) {
91
+ this.buckets[bucketIndex]++;
92
+ }
93
+ }
94
+ findBucket(value) {
95
+ let left = 0;
96
+ let right = this.bucketBoundaries.length - 1;
97
+ while(left <= right){
98
+ const mid = Math.floor((left + right) / 2);
99
+ if (value <= this.bucketBoundaries[mid]) {
100
+ right = mid - 1;
101
+ } else {
102
+ left = mid + 1;
103
+ }
104
+ }
105
+ return Math.min(left, this.buckets.length - 1);
106
+ }
107
+ getPercentile(percentile) {
108
+ if (this.count === 0) return 0;
109
+ const targetCount = Math.floor(this.count * percentile / 100);
110
+ let currentCount = 0;
111
+ for(let i = 0; i < this.buckets.length; i++){
112
+ currentCount += this.buckets[i];
113
+ if (currentCount >= targetCount) {
114
+ return this.bucketBoundaries[i];
115
+ }
116
+ }
117
+ return this.maxLatencyNs;
118
+ }
119
+ getStats() {
120
+ const mean = this.count > 0 ? Number(this.sum) / this.count : 0;
121
+ return {
122
+ count: this.count,
123
+ mean,
124
+ min: this.count > 0 ? this.min : 0,
125
+ max: this.max,
126
+ p50: this.getPercentile(50),
127
+ p90: this.getPercentile(90),
128
+ p95: this.getPercentile(95),
129
+ p99: this.getPercentile(99),
130
+ p999: this.getPercentile(99.9)
131
+ };
132
+ }
133
+ reset() {
134
+ this.buckets.fill(0);
135
+ this.count = 0;
136
+ this.sum = 0n;
137
+ this.min = Number.MAX_SAFE_INTEGER;
138
+ this.max = 0;
139
+ }
140
+ // Export histogram data for analysis
141
+ exportData() {
142
+ return {
143
+ boundaries: [
144
+ ...this.bucketBoundaries
145
+ ],
146
+ counts: Array.from(this.buckets)
147
+ };
148
+ }
149
+ }
150
+ // Memory usage tracker with NUMA awareness
151
+ export class MemoryTracker {
152
+ samples = [];
153
+ maxSamples;
154
+ gcCount = 0;
155
+ lastGCTime = 0n;
156
+ constructor(maxSamples = 1000){
157
+ this.maxSamples = maxSamples;
158
+ this.setupGCTracking();
159
+ }
160
+ setupGCTracking() {
161
+ // Track garbage collection events
162
+ if (global.gc) {
163
+ const originalGC = global.gc;
164
+ global.gc = (...args)=>{
165
+ const start = NanosecondTimer.rdtsc();
166
+ const result = originalGC.apply(global, args);
167
+ const duration = NanosecondTimer.rdtsc() - start;
168
+ this.gcCount++;
169
+ this.lastGCTime = duration;
170
+ return result;
171
+ };
172
+ }
173
+ }
174
+ sample() {
175
+ const usage = process.memoryUsage();
176
+ const timestamp = NanosecondTimer.rdtsc();
177
+ this.samples.push({
178
+ timestamp,
179
+ usage
180
+ });
181
+ // Maintain sliding window
182
+ if (this.samples.length > this.maxSamples) {
183
+ this.samples.shift();
184
+ }
185
+ return usage;
186
+ }
187
+ getStats() {
188
+ if (this.samples.length === 0) {
189
+ const current = process.memoryUsage();
190
+ return {
191
+ current,
192
+ peak: current,
193
+ trend: {
194
+ rss: 0,
195
+ heapUsed: 0,
196
+ heapTotal: 0
197
+ },
198
+ gcStats: {
199
+ count: this.gcCount,
200
+ lastDuration: Number(this.lastGCTime)
201
+ }
202
+ };
203
+ }
204
+ const current = this.samples[this.samples.length - 1].usage;
205
+ // Calculate peak usage
206
+ const peak = this.samples.reduce((max, sample)=>({
207
+ rss: Math.max(max.rss, sample.usage.rss),
208
+ heapTotal: Math.max(max.heapTotal, sample.usage.heapTotal),
209
+ heapUsed: Math.max(max.heapUsed, sample.usage.heapUsed),
210
+ external: Math.max(max.external, sample.usage.external),
211
+ arrayBuffers: Math.max(max.arrayBuffers, sample.usage.arrayBuffers)
212
+ }), current);
213
+ // Calculate trend (simple linear regression)
214
+ const trend = this.calculateTrend();
215
+ return {
216
+ current,
217
+ peak,
218
+ trend,
219
+ gcStats: {
220
+ count: this.gcCount,
221
+ lastDuration: Number(this.lastGCTime)
222
+ }
223
+ };
224
+ }
225
+ calculateTrend() {
226
+ if (this.samples.length < 2) {
227
+ return {
228
+ rss: 0,
229
+ heapUsed: 0,
230
+ heapTotal: 0
231
+ };
232
+ }
233
+ const n = this.samples.length;
234
+ const recent = this.samples.slice(-Math.min(100, n)); // Last 100 samples
235
+ const calculateSlope = (values)=>{
236
+ const m = values.length;
237
+ if (m < 2) return 0;
238
+ let sumX = 0, sumY = 0, sumXY = 0, sumXX = 0;
239
+ for(let i = 0; i < m; i++){
240
+ sumX += i;
241
+ sumY += values[i];
242
+ sumXY += i * values[i];
243
+ sumXX += i * i;
244
+ }
245
+ return (m * sumXY - sumX * sumY) / (m * sumXX - sumX * sumX);
246
+ };
247
+ return {
248
+ rss: calculateSlope(recent.map((s)=>s.usage.rss)),
249
+ heapUsed: calculateSlope(recent.map((s)=>s.usage.heapUsed)),
250
+ heapTotal: calculateSlope(recent.map((s)=>s.usage.heapTotal))
251
+ };
252
+ }
253
+ }
254
+ // CPU usage and thread performance tracker
255
+ export class CPUTracker {
256
+ samples = [];
257
+ maxSamples;
258
+ lastCpuUsage;
259
+ constructor(maxSamples = 1000){
260
+ this.maxSamples = maxSamples;
261
+ }
262
+ sample() {
263
+ const timestamp = NanosecondTimer.rdtsc();
264
+ const cpuUsage = process.cpuUsage(this.lastCpuUsage);
265
+ this.samples.push({
266
+ timestamp,
267
+ cpuUsage
268
+ });
269
+ this.lastCpuUsage = process.cpuUsage();
270
+ if (this.samples.length > this.maxSamples) {
271
+ this.samples.shift();
272
+ }
273
+ return cpuUsage;
274
+ }
275
+ getCPUPercentage() {
276
+ if (this.samples.length < 2) return 0;
277
+ const recent = this.samples.slice(-10); // Last 10 samples
278
+ const totalUser = recent.reduce((sum, s)=>sum + s.cpuUsage.user, 0);
279
+ const totalSystem = recent.reduce((sum, s)=>sum + s.cpuUsage.system, 0);
280
+ const totalCPU = totalUser + totalSystem;
281
+ const timeSpan = Number(recent[recent.length - 1].timestamp - recent[0].timestamp) / 1_000_000; // Convert to ms
282
+ return timeSpan > 0 ? totalCPU / 1000 / timeSpan * 100 : 0;
283
+ }
284
+ getStats() {
285
+ const current = this.samples[this.samples.length - 1]?.cpuUsage || {
286
+ user: 0,
287
+ system: 0
288
+ };
289
+ const cpuPercentage = this.getCPUPercentage();
290
+ const avgUser = this.samples.length > 0 ? this.samples.reduce((sum, s)=>sum + s.cpuUsage.user, 0) / this.samples.length / 1000 : 0;
291
+ const avgSystem = this.samples.length > 0 ? this.samples.reduce((sum, s)=>sum + s.cpuUsage.system, 0) / this.samples.length / 1000 : 0;
292
+ return {
293
+ currentUsage: current,
294
+ cpuPercentage,
295
+ averageUser: avgUser,
296
+ averageSystem: avgSystem
297
+ };
298
+ }
299
+ }
300
+ // Comprehensive performance monitoring system
301
+ export class PerformanceMonitor {
302
+ latencyHistogram;
303
+ memoryTracker;
304
+ cpuTracker;
305
+ alertThresholds;
306
+ alerts = [];
307
+ monitoringInterval;
308
+ constructor(options = {}){
309
+ this.latencyHistogram = new LatencyHistogram();
310
+ this.memoryTracker = new MemoryTracker();
311
+ this.cpuTracker = new CPUTracker();
312
+ this.alertThresholds = {
313
+ latencyP95Ms: options.latencyP95Ms || 1,
314
+ memoryUsageMB: options.memoryUsageMB || 1024,
315
+ cpuPercentage: options.cpuPercentage || 80 // 80% default
316
+ };
317
+ if (options.monitoringIntervalMs) {
318
+ this.startMonitoring(options.monitoringIntervalMs);
319
+ }
320
+ }
321
+ // Record message latency
322
+ recordLatency(latencyNs) {
323
+ this.latencyHistogram.record(latencyNs);
324
+ // Check for latency alerts
325
+ const p95 = this.latencyHistogram.getPercentile(95) / 1_000_000; // Convert to ms
326
+ if (p95 > this.alertThresholds.latencyP95Ms) {
327
+ this.addAlert('HIGH_LATENCY', `P95 latency ${p95.toFixed(2)}ms exceeds threshold ${this.alertThresholds.latencyP95Ms}ms`);
328
+ }
329
+ }
330
+ // Start continuous monitoring
331
+ startMonitoring(intervalMs = 1000) {
332
+ if (this.monitoringInterval) {
333
+ clearInterval(this.monitoringInterval);
334
+ }
335
+ this.monitoringInterval = setInterval(()=>{
336
+ this.performHealthCheck();
337
+ }, intervalMs);
338
+ }
339
+ stopMonitoring() {
340
+ if (this.monitoringInterval) {
341
+ clearInterval(this.monitoringInterval);
342
+ this.monitoringInterval = undefined;
343
+ }
344
+ }
345
+ performHealthCheck() {
346
+ // Sample system resources
347
+ const memoryUsage = this.memoryTracker.sample();
348
+ const cpuUsage = this.cpuTracker.sample();
349
+ // Check memory alerts
350
+ const memoryMB = memoryUsage.heapUsed / (1024 * 1024);
351
+ if (memoryMB > this.alertThresholds.memoryUsageMB) {
352
+ this.addAlert('HIGH_MEMORY', `Memory usage ${memoryMB.toFixed(2)}MB exceeds threshold ${this.alertThresholds.memoryUsageMB}MB`);
353
+ }
354
+ // Check CPU alerts
355
+ const cpuPercentage = this.cpuTracker.getCPUPercentage();
356
+ if (cpuPercentage > this.alertThresholds.cpuPercentage) {
357
+ this.addAlert('HIGH_CPU', `CPU usage ${cpuPercentage.toFixed(2)}% exceeds threshold ${this.alertThresholds.cpuPercentage}%`);
358
+ }
359
+ }
360
+ addAlert(type, message) {
361
+ const alert = {
362
+ timestamp: NanosecondTimer.rdtsc(),
363
+ type,
364
+ message
365
+ };
366
+ this.alerts.push(alert);
367
+ // Keep only last 100 alerts
368
+ if (this.alerts.length > 100) {
369
+ this.alerts.shift();
370
+ }
371
+ console.warn(`[PERFORMANCE ALERT] ${type}: ${message}`);
372
+ }
373
+ // Get comprehensive performance report
374
+ getReport() {
375
+ const latency = this.latencyHistogram.getStats();
376
+ const memory = this.memoryTracker.getStats();
377
+ const cpu = this.cpuTracker.getStats();
378
+ const recommendations = this.generateRecommendations(latency, memory, cpu);
379
+ return {
380
+ latency,
381
+ memory,
382
+ cpu,
383
+ alerts: [
384
+ ...this.alerts
385
+ ],
386
+ recommendations
387
+ };
388
+ }
389
+ generateRecommendations(latency, memory, cpu) {
390
+ const recommendations = [];
391
+ // Latency recommendations
392
+ if (latency.p95 > 1_000_000) {
393
+ recommendations.push('Consider optimizing message routing or reducing payload size');
394
+ if (latency.p95 > 10_000_000) {
395
+ recommendations.push('Critical: Latency is extremely high, investigate bottlenecks');
396
+ }
397
+ }
398
+ // Memory recommendations
399
+ if (memory.trend.heapUsed > 0) {
400
+ recommendations.push('Memory usage is trending upward, check for memory leaks');
401
+ }
402
+ if (memory.current.heapUsed / memory.current.heapTotal > 0.9) {
403
+ recommendations.push('Heap utilization is high, consider increasing heap size');
404
+ }
405
+ // CPU recommendations
406
+ if (cpu.cpuPercentage > 70) {
407
+ recommendations.push('CPU usage is high, consider load balancing or optimization');
408
+ }
409
+ // GC recommendations
410
+ if (memory.gcStats.lastDuration > 10_000_000) {
411
+ recommendations.push('GC pauses are long, consider tuning garbage collection');
412
+ }
413
+ return recommendations;
414
+ }
415
+ // Export performance data for external analysis
416
+ exportData() {
417
+ return {
418
+ latencyHistogram: this.latencyHistogram.exportData(),
419
+ timestamp: NanosecondTimer.rdtsc(),
420
+ systemInfo: {
421
+ platform: process.platform,
422
+ arch: process.arch,
423
+ nodeVersion: process.version,
424
+ cpuCount: require('os').cpus().length
425
+ }
426
+ };
427
+ }
428
+ // Reset all metrics
429
+ reset() {
430
+ this.latencyHistogram.reset();
431
+ this.alerts.length = 0;
432
+ }
433
+ }
434
+ // Performance validation utilities
435
+ export class PerformanceValidator {
436
+ monitor;
437
+ constructor(){
438
+ this.monitor = new PerformanceMonitor({
439
+ latencyP95Ms: 1,
440
+ monitoringIntervalMs: 100
441
+ });
442
+ }
443
+ // Validate latency target with statistical significance
444
+ async validateLatencyTarget(messageCount = 1_000_000, targetP95Ms = 1) {
445
+ const startTime = NanosecondTimer.rdtsc();
446
+ // Simulate message processing with actual timing
447
+ for(let i = 0; i < messageCount; i++){
448
+ const messageStart = NanosecondTimer.rdtsc();
449
+ // Simulate minimal message processing
450
+ await new Promise((resolve)=>setImmediate(resolve));
451
+ const messageEnd = NanosecondTimer.rdtsc();
452
+ const latency = messageEnd - messageStart;
453
+ this.monitor.recordLatency(Number(latency));
454
+ }
455
+ const endTime = NanosecondTimer.rdtsc();
456
+ const totalDuration = Number(endTime - startTime) / 1_000_000_000; // Convert to seconds
457
+ const messageRate = messageCount / totalDuration;
458
+ const stats = this.monitor.getReport();
459
+ const actualP95Ms = stats.latency.p95 / 1_000_000; // Convert to ms
460
+ return {
461
+ passed: actualP95Ms < targetP95Ms,
462
+ actualP95Ms,
463
+ messageRate,
464
+ recommendations: stats.recommendations
465
+ };
466
+ }
467
+ // Benchmark different components
468
+ async benchmarkComponents() {
469
+ const iterations = 100_000;
470
+ // Benchmark serialization
471
+ const { duration: serializationTime } = await NanosecondTimer.measureAsync(async ()=>{
472
+ for(let i = 0; i < iterations; i++){
473
+ JSON.stringify({
474
+ id: i,
475
+ data: 'test message',
476
+ timestamp: Date.now()
477
+ });
478
+ }
479
+ });
480
+ // Benchmark routing (topic matching)
481
+ const { duration: routingTime } = await NanosecondTimer.measureAsync(async ()=>{
482
+ const topics = [
483
+ 'task.assignment',
484
+ 'task.result',
485
+ 'coordination',
486
+ 'heartbeat'
487
+ ];
488
+ for(let i = 0; i < iterations; i++){
489
+ const topic = topics[i % topics.length];
490
+ topic.startsWith('task'); // Simulate routing logic
491
+ }
492
+ });
493
+ // Benchmark queueing operations
494
+ const { duration: queueingTime } = await NanosecondTimer.measureAsync(async ()=>{
495
+ const queue = [];
496
+ for(let i = 0; i < iterations; i++){
497
+ queue.push({
498
+ id: i
499
+ });
500
+ if (i % 100 === 0) queue.shift();
501
+ }
502
+ });
503
+ // Benchmark networking simulation
504
+ const { duration: networkingTime } = await NanosecondTimer.measureAsync(async ()=>{
505
+ for(let i = 0; i < iterations / 100; i++){
506
+ await new Promise((resolve)=>setImmediate(resolve));
507
+ }
508
+ });
509
+ return {
510
+ serialization: Number(serializationTime / BigInt(iterations)),
511
+ routing: Number(routingTime / BigInt(iterations)),
512
+ queueing: Number(queueingTime / BigInt(iterations)),
513
+ networking: Number(networkingTime / BigInt(iterations / 100))
514
+ };
515
+ }
516
+ }
517
+ // Export singleton instances
518
+ export const globalPerformanceMonitor = new PerformanceMonitor({
519
+ latencyP95Ms: 1,
520
+ memoryUsageMB: 1024,
521
+ cpuPercentage: 80,
522
+ monitoringIntervalMs: 1000
523
+ });
524
+ export const performanceValidator = new PerformanceValidator();
525
+
526
+ //# sourceMappingURL=performance-optimizations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/communication/performance-optimizations.ts"],"names":["performance","NanosecondTimer","PERFORMANCE_NOW_TO_NS","calibrationOffset","calibrate","samples","totalDiff","i","start","now","end","BigInt","Math","floor","rdtsc","hrTime","process","hrtime","bigint","measure","fn","result","duration","measureAsync","LatencyHistogram","buckets","bucketBoundaries","count","sum","min","Number","MAX_SAFE_INTEGER","max","maxLatencyNs","maxLatencyMs","bucketCount","Uint32Array","generateLogBuckets","boundaries","logMax","log10","logMin","step","logValue","push","pow","record","latencyNs","bucketIndex","findBucket","length","value","left","right","mid","getPercentile","percentile","targetCount","currentCount","getStats","mean","p50","p90","p95","p99","p999","reset","fill","exportData","counts","Array","from","MemoryTracker","maxSamples","gcCount","lastGCTime","setupGCTracking","global","gc","originalGC","args","apply","sample","usage","memoryUsage","timestamp","shift","current","peak","trend","rss","heapUsed","heapTotal","gcStats","lastDuration","reduce","external","arrayBuffers","calculateTrend","n","recent","slice","calculateSlope","values","m","sumX","sumY","sumXY","sumXX","map","s","CPUTracker","lastCpuUsage","cpuUsage","getCPUPercentage","totalUser","user","totalSystem","system","totalCPU","timeSpan","cpuPercentage","avgUser","avgSystem","currentUsage","averageUser","averageSystem","PerformanceMonitor","latencyHistogram","memoryTracker","cpuTracker","alertThresholds","alerts","monitoringInterval","options","latencyP95Ms","memoryUsageMB","monitoringIntervalMs","startMonitoring","recordLatency","addAlert","toFixed","intervalMs","clearInterval","setInterval","performHealthCheck","stopMonitoring","undefined","memoryMB","type","message","alert","console","warn","getReport","latency","memory","cpu","recommendations","generateRecommendations","systemInfo","platform","arch","nodeVersion","version","cpuCount","require","cpus","PerformanceValidator","monitor","validateLatencyTarget","messageCount","targetP95Ms","startTime","messageStart","Promise","resolve","setImmediate","messageEnd","endTime","totalDuration","messageRate","stats","actualP95Ms","passed","benchmarkComponents","iterations","serializationTime","JSON","stringify","id","data","Date","routingTime","topics","topic","startsWith","queueingTime","queue","networkingTime","serialization","routing","queueing","networking","globalPerformanceMonitor","performanceValidator"],"mappings":"AAAA;;;;CAIC,GAED,SAASA,WAAW,QAAQ,aAAa;AAGzC,sDAAsD;AACtD,OAAO,MAAMC;IACX,OAAwBC,wBAAwB,UAAU;IAC1D,OAAeC,oBAAoB,EAAE,CAAC;IAEtC,MAAO;QACL,iCAAiC;QACjC,IAAI,CAACC,SAAS;IAChB,CAAC;IAED,OAAeA,YAAkB;QAC/B,6BAA6B;QAC7B,MAAMC,UAAU;QAChB,IAAIC,YAAY,EAAE;QAElB,IAAK,IAAIC,IAAI,GAAGA,IAAIF,SAASE,IAAK;YAChC,MAAMC,QAAQ,IAAI,CAACC,GAAG;YACtB,wBAAwB;YACxB,MAAMC,MAAM,IAAI,CAACD,GAAG;YACpBH,aAAaI,MAAMF;QACrB;QAEA,IAAI,CAACL,iBAAiB,GAAGG,YAAYK,OAAON;IAC9C;IAEA,0CAA0C;IAC1C,OAAOI,MAAc;QACnB,OAAOE,OAAOC,KAAKC,KAAK,CAACb,YAAYS,GAAG,KAAK,IAAI,CAACP,qBAAqB;IACzE;IAEA,6CAA6C;IAC7C,OAAOY,QAAgB;QACrB,oEAAoE;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