@monoes/monomindcli 1.10.54 → 1.10.55

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 (441) hide show
  1. package/.claude/agents/optimization/benchmark-suite.md +2 -0
  2. package/.claude/agents/optimization/load-balancer.md +2 -0
  3. package/.claude/agents/optimization/performance-monitor.md +2 -0
  4. package/.claude/agents/optimization/resource-allocator.md +3 -1
  5. package/.claude/agents/optimization/topology-optimizer.md +2 -0
  6. package/.claude/commands/mastermind/_repeat.md +21 -0
  7. package/.claude/commands/mastermind/_taskfile.md +235 -0
  8. package/.claude/commands/mastermind/adr.md +11 -0
  9. package/.claude/commands/mastermind/approve.md +94 -0
  10. package/.claude/commands/mastermind/autodev.md +32 -0
  11. package/.claude/commands/mastermind/budget.md +7 -0
  12. package/.claude/commands/mastermind/code-review.md +317 -0
  13. package/.claude/commands/mastermind/createorg.md +40 -1
  14. package/.claude/commands/mastermind/createtask.md +383 -0
  15. package/.claude/commands/mastermind/debug.md +22 -0
  16. package/.claude/commands/mastermind/design.md +20 -0
  17. package/.claude/commands/mastermind/do.md +526 -0
  18. package/.claude/commands/mastermind/execute.md +20 -0
  19. package/.claude/commands/mastermind/finish.md +20 -0
  20. package/.claude/commands/mastermind/graph-status.md +7 -0
  21. package/.claude/commands/mastermind/help.md +118 -0
  22. package/.claude/commands/mastermind/ideate.md +261 -0
  23. package/.claude/commands/mastermind/improve.md +345 -0
  24. package/.claude/commands/mastermind/loops.md +7 -0
  25. package/.claude/commands/mastermind/master.md +186 -6
  26. package/.claude/commands/mastermind/memory.md +230 -0
  27. package/.claude/commands/mastermind/plan.md +26 -0
  28. package/.claude/commands/mastermind/receive-review.md +20 -0
  29. package/.claude/commands/mastermind/repeat.md +257 -0
  30. package/.claude/commands/mastermind/runorg.md +3 -0
  31. package/.claude/commands/mastermind/skill-builder.md +20 -0
  32. package/.claude/commands/mastermind/specialagents.md +125 -0
  33. package/.claude/commands/mastermind/swarm.md +161 -0
  34. package/.claude/commands/mastermind/taskdev.md +26 -0
  35. package/.claude/commands/mastermind/tdd.md +22 -0
  36. package/.claude/commands/mastermind/techport.md +4 -0
  37. package/.claude/commands/mastermind/understand.md +139 -0
  38. package/.claude/commands/mastermind/verify.md +22 -0
  39. package/.claude/commands/mastermind/worktree.md +20 -0
  40. package/.claude/helpers/handlers/graph-status-handler.cjs +2 -1
  41. package/.claude/helpers/hook-handler.cjs +19 -0
  42. package/.claude/helpers/skill-registry.json +23 -0
  43. package/.claude/helpers/statusline.cjs +1 -1
  44. package/.claude/skills/mastermind/approve.md +15 -7
  45. package/.claude/skills/mastermind/autodev.md +534 -0
  46. package/.claude/skills/mastermind/createorg.md +21 -5
  47. package/.claude/skills/mastermind/debug.md +232 -0
  48. package/.claude/skills/mastermind/design.md +187 -0
  49. package/.claude/skills/mastermind/execute.md +104 -0
  50. package/.claude/skills/mastermind/finish.md +251 -0
  51. package/.claude/skills/mastermind/plan.md +180 -0
  52. package/.claude/skills/mastermind/receive-review.md +213 -0
  53. package/.claude/skills/mastermind/runorg.md +23 -8
  54. package/.claude/skills/mastermind/skill-builder.md +274 -0
  55. package/.claude/skills/mastermind/taskdev.md +307 -0
  56. package/.claude/skills/mastermind/tdd.md +394 -0
  57. package/.claude/skills/mastermind/verify.md +196 -0
  58. package/.claude/skills/mastermind/worktree.md +160 -132
  59. package/README.md +320 -253
  60. package/dist/src/commands/analyze.d.ts.map +1 -1
  61. package/dist/src/commands/analyze.js +9 -2
  62. package/dist/src/commands/analyze.js.map +1 -1
  63. package/dist/src/commands/benchmark.js.map +1 -1
  64. package/dist/src/commands/completions.js +1 -1
  65. package/dist/src/commands/guidance.js +7 -7
  66. package/dist/src/commands/hooks.d.ts.map +1 -1
  67. package/dist/src/commands/hooks.js +16 -3
  68. package/dist/src/commands/hooks.js.map +1 -1
  69. package/dist/src/commands/index.d.ts +3 -2
  70. package/dist/src/commands/index.d.ts.map +1 -1
  71. package/dist/src/commands/index.js +7 -0
  72. package/dist/src/commands/index.js.map +1 -1
  73. package/dist/src/commands/init.d.ts.map +1 -1
  74. package/dist/src/commands/init.js +47 -13
  75. package/dist/src/commands/init.js.map +1 -1
  76. package/dist/src/commands/neural.d.ts.map +1 -1
  77. package/dist/src/commands/neural.js +100 -14
  78. package/dist/src/commands/neural.js.map +1 -1
  79. package/dist/src/commands/platforms.d.ts +11 -0
  80. package/dist/src/commands/platforms.d.ts.map +1 -0
  81. package/dist/src/commands/platforms.js +195 -0
  82. package/dist/src/commands/platforms.js.map +1 -0
  83. package/dist/src/commands/ruvector/backup.js.map +1 -1
  84. package/dist/src/commands/ruvector/benchmark.js.map +1 -1
  85. package/dist/src/commands/ruvector/init.js.map +1 -1
  86. package/dist/src/commands/ruvector/migrate.js.map +1 -1
  87. package/dist/src/commands/ruvector/optimize.js.map +1 -1
  88. package/dist/src/commands/ruvector/status.js.map +1 -1
  89. package/dist/src/commands/update.js +6 -6
  90. package/dist/src/init/executor.d.ts.map +1 -1
  91. package/dist/src/init/executor.js +28 -0
  92. package/dist/src/init/executor.js.map +1 -1
  93. package/dist/src/init/statusline-generator.js +1 -1
  94. package/dist/src/init/types.d.ts +1 -0
  95. package/dist/src/init/types.d.ts.map +1 -1
  96. package/dist/src/mcp-server.d.ts.map +1 -1
  97. package/dist/src/mcp-server.js +92 -0
  98. package/dist/src/mcp-server.js.map +1 -1
  99. package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
  100. package/dist/src/mcp-tools/hive-mind-tools.js +52 -0
  101. package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
  102. package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
  103. package/dist/src/mcp-tools/hooks-tools.js +106 -5
  104. package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
  105. package/dist/src/mcp-tools/index.d.ts +0 -5
  106. package/dist/src/mcp-tools/index.d.ts.map +1 -1
  107. package/dist/src/mcp-tools/index.js +0 -5
  108. package/dist/src/mcp-tools/index.js.map +1 -1
  109. package/dist/src/mcp-tools/monograph-tools.d.ts.map +1 -1
  110. package/dist/src/mcp-tools/monograph-tools.js +507 -5587
  111. package/dist/src/mcp-tools/monograph-tools.js.map +1 -1
  112. package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
  113. package/dist/src/mcp-tools/neural-tools.js +64 -4
  114. package/dist/src/mcp-tools/neural-tools.js.map +1 -1
  115. package/dist/src/mcp-tools/security-tools.js +4 -4
  116. package/dist/src/memory/intelligence.d.ts +2 -2
  117. package/dist/src/memory/intelligence.d.ts.map +1 -1
  118. package/dist/src/memory/intelligence.js +108 -3
  119. package/dist/src/memory/intelligence.js.map +1 -1
  120. package/dist/src/memory/memory-bridge.js +1 -1
  121. package/dist/src/memory/memory-bridge.js.map +1 -1
  122. package/dist/src/memory/sona-optimizer.d.ts +1 -10
  123. package/dist/src/memory/sona-optimizer.d.ts.map +1 -1
  124. package/dist/src/memory/sona-optimizer.js +0 -46
  125. package/dist/src/memory/sona-optimizer.js.map +1 -1
  126. package/dist/src/runtime/headless.js +3 -3
  127. package/dist/src/ruvector/diff-classifier.d.ts +0 -2
  128. package/dist/src/ruvector/diff-classifier.d.ts.map +1 -1
  129. package/dist/src/ruvector/diff-classifier.js +2 -14
  130. package/dist/src/ruvector/diff-classifier.js.map +1 -1
  131. package/dist/src/ruvector/index.d.ts +26 -9
  132. package/dist/src/ruvector/index.d.ts.map +1 -1
  133. package/dist/src/ruvector/index.js +3 -21
  134. package/dist/src/ruvector/index.js.map +1 -1
  135. package/dist/src/ruvector/ruvllm-wasm.js +2 -2
  136. package/dist/src/ruvector/ruvllm-wasm.js.map +1 -1
  137. package/dist/src/types.d.ts +0 -15
  138. package/dist/src/types.d.ts.map +1 -1
  139. package/dist/src/types.js +0 -18
  140. package/dist/src/types.js.map +1 -1
  141. package/dist/src/ui/dashboard.html +8763 -9766
  142. package/dist/src/ui/orgs.html +1 -1
  143. package/dist/src/ui/server.mjs +504 -35
  144. package/dist/src/update/index.js +1 -1
  145. package/dist/src/update/validator.js +8 -8
  146. package/dist/tsconfig.tsbuildinfo +1 -1
  147. package/package.json +2 -2
  148. package/.claude/agents/academic/academic-anthropologist.md +0 -126
  149. package/.claude/agents/academic/academic-geographer.md +0 -128
  150. package/.claude/agents/academic/academic-historian.md +0 -124
  151. package/.claude/agents/academic/academic-narratologist.md +0 -119
  152. package/.claude/agents/academic/academic-psychologist.md +0 -119
  153. package/.claude/agents/analysis/analyze-code-quality.md +0 -58
  154. package/.claude/agents/analysis/code-analyzer.md +0 -189
  155. package/.claude/agents/analysis/code-review/analyze-code-quality.md +0 -58
  156. package/.claude/agents/consensus/performance-benchmarker.md +0 -831
  157. package/.claude/agents/data/ml/data-ml-model.md +0 -76
  158. package/.claude/agents/development/dev-backend-api.md +0 -178
  159. package/.claude/agents/devops/ci-cd/ops-cicd-github.md +0 -52
  160. package/.claude/agents/documentation/api-docs/docs-api-openapi.md +0 -63
  161. package/.claude/agents/game-development/blender/blender-addon-engineer.md +0 -235
  162. package/.claude/agents/game-development/game-audio-engineer.md +0 -265
  163. package/.claude/agents/game-development/game-designer.md +0 -168
  164. package/.claude/agents/game-development/godot/godot-gameplay-scripter.md +0 -335
  165. package/.claude/agents/game-development/godot/godot-multiplayer-engineer.md +0 -298
  166. package/.claude/agents/game-development/godot/godot-shader-developer.md +0 -267
  167. package/.claude/agents/game-development/level-designer.md +0 -209
  168. package/.claude/agents/game-development/narrative-designer.md +0 -244
  169. package/.claude/agents/game-development/roblox-studio/roblox-avatar-creator.md +0 -298
  170. package/.claude/agents/game-development/roblox-studio/roblox-experience-designer.md +0 -306
  171. package/.claude/agents/game-development/roblox-studio/roblox-systems-scripter.md +0 -326
  172. package/.claude/agents/game-development/technical-artist.md +0 -230
  173. package/.claude/agents/game-development/unity/unity-architect.md +0 -272
  174. package/.claude/agents/game-development/unity/unity-editor-tool-developer.md +0 -311
  175. package/.claude/agents/game-development/unity/unity-multiplayer-engineer.md +0 -322
  176. package/.claude/agents/game-development/unity/unity-shader-graph-artist.md +0 -270
  177. package/.claude/agents/game-development/unreal-engine/unreal-multiplayer-architect.md +0 -314
  178. package/.claude/agents/game-development/unreal-engine/unreal-systems-engineer.md +0 -311
  179. package/.claude/agents/game-development/unreal-engine/unreal-technical-artist.md +0 -257
  180. package/.claude/agents/game-development/unreal-engine/unreal-world-builder.md +0 -274
  181. package/.claude/agents/github/release-swarm.md +0 -597
  182. package/.claude/agents/goal/agent.md +0 -804
  183. package/.claude/agents/goal/code-goal-planner.md +0 -445
  184. package/.claude/agents/marketing/marketing-ai-citation-strategist.md +0 -171
  185. package/.claude/agents/marketing/marketing-app-store-optimizer.md +0 -322
  186. package/.claude/agents/marketing/marketing-baidu-seo-specialist.md +0 -227
  187. package/.claude/agents/marketing/marketing-bilibili-content-strategist.md +0 -200
  188. package/.claude/agents/marketing/marketing-book-co-author.md +0 -111
  189. package/.claude/agents/marketing/marketing-carousel-growth-engine.md +0 -200
  190. package/.claude/agents/marketing/marketing-china-ecommerce-operator.md +0 -284
  191. package/.claude/agents/marketing/marketing-content-creator.md +0 -67
  192. package/.claude/agents/marketing/marketing-cross-border-ecommerce.md +0 -260
  193. package/.claude/agents/marketing/marketing-douyin-strategist.md +0 -150
  194. package/.claude/agents/marketing/marketing-growth-hacker.md +0 -54
  195. package/.claude/agents/marketing/marketing-instagram-curator.md +0 -114
  196. package/.claude/agents/marketing/marketing-kuaishou-strategist.md +0 -224
  197. package/.claude/agents/marketing/marketing-linkedin-content-creator.md +0 -215
  198. package/.claude/agents/marketing/marketing-livestream-commerce-coach.md +0 -306
  199. package/.claude/agents/marketing/marketing-podcast-strategist.md +0 -278
  200. package/.claude/agents/marketing/marketing-private-domain-operator.md +0 -309
  201. package/.claude/agents/marketing/marketing-reddit-community-builder.md +0 -124
  202. package/.claude/agents/marketing/marketing-seo-specialist.md +0 -279
  203. package/.claude/agents/marketing/marketing-short-video-editing-coach.md +0 -413
  204. package/.claude/agents/marketing/marketing-social-media-strategist.md +0 -125
  205. package/.claude/agents/marketing/marketing-tiktok-strategist.md +0 -126
  206. package/.claude/agents/marketing/marketing-twitter-engager.md +0 -127
  207. package/.claude/agents/marketing/marketing-wechat-official-account.md +0 -146
  208. package/.claude/agents/marketing/marketing-weibo-strategist.md +0 -241
  209. package/.claude/agents/marketing/marketing-xiaohongshu-specialist.md +0 -139
  210. package/.claude/agents/marketing/marketing-zhihu-strategist.md +0 -163
  211. package/.claude/agents/neural/safla-neural.md +0 -74
  212. package/.claude/agents/paid-media/paid-media-auditor.md +0 -71
  213. package/.claude/agents/paid-media/paid-media-creative-strategist.md +0 -71
  214. package/.claude/agents/paid-media/paid-media-paid-social-strategist.md +0 -71
  215. package/.claude/agents/paid-media/paid-media-ppc-strategist.md +0 -71
  216. package/.claude/agents/paid-media/paid-media-programmatic-buyer.md +0 -71
  217. package/.claude/agents/paid-media/paid-media-search-query-analyst.md +0 -71
  218. package/.claude/agents/paid-media/paid-media-tracking-specialist.md +0 -71
  219. package/.claude/agents/payments/agentic-payments.md +0 -126
  220. package/.claude/agents/product/product-behavioral-nudge-engine.md +0 -81
  221. package/.claude/agents/product/product-feedback-synthesizer.md +0 -119
  222. package/.claude/agents/product/product-manager.md +0 -469
  223. package/.claude/agents/product/product-sprint-prioritizer.md +0 -154
  224. package/.claude/agents/product/product-trend-researcher.md +0 -159
  225. package/.claude/agents/project-management/project-management-experiment-tracker.md +0 -199
  226. package/.claude/agents/project-management/project-management-jira-workflow-steward.md +0 -231
  227. package/.claude/agents/project-management/project-management-project-shepherd.md +0 -195
  228. package/.claude/agents/project-management/project-management-studio-operations.md +0 -201
  229. package/.claude/agents/project-management/project-management-studio-producer.md +0 -204
  230. package/.claude/agents/project-management/project-manager-senior.md +0 -136
  231. package/.claude/agents/reasoning/agent.md +0 -804
  232. package/.claude/agents/reasoning/goal-planner.md +0 -73
  233. package/.claude/agents/sales/sales-account-strategist.md +0 -228
  234. package/.claude/agents/sales/sales-coach.md +0 -272
  235. package/.claude/agents/sales/sales-deal-strategist.md +0 -181
  236. package/.claude/agents/sales/sales-discovery-coach.md +0 -226
  237. package/.claude/agents/sales/sales-engineer.md +0 -183
  238. package/.claude/agents/sales/sales-outbound-strategist.md +0 -202
  239. package/.claude/agents/sales/sales-pipeline-analyst.md +0 -268
  240. package/.claude/agents/sales/sales-proposal-strategist.md +0 -218
  241. package/.claude/agents/sona/sona-learning-optimizer.md +0 -65
  242. package/.claude/agents/spatial-computing/macos-spatial-metal-engineer.md +0 -338
  243. package/.claude/agents/spatial-computing/terminal-integration-specialist.md +0 -71
  244. package/.claude/agents/spatial-computing/visionos-spatial-engineer.md +0 -55
  245. package/.claude/agents/specialists/memory-specialist.md +0 -298
  246. package/.claude/agents/specialists/performance-engineer.md +0 -387
  247. package/.claude/agents/specialists/queen-coordinator.md +0 -67
  248. package/.claude/agents/specialists/security-architect.md +0 -154
  249. package/.claude/agents/specialized/accounts-payable-agent.md +0 -186
  250. package/.claude/agents/specialized/corporate-training-designer.md +0 -193
  251. package/.claude/agents/specialized/data-consolidation-agent.md +0 -61
  252. package/.claude/agents/specialized/government-digital-presales-consultant.md +0 -364
  253. package/.claude/agents/specialized/healthcare-marketing-compliance.md +0 -396
  254. package/.claude/agents/specialized/recruitment-specialist.md +0 -510
  255. package/.claude/agents/specialized/report-distribution-agent.md +0 -66
  256. package/.claude/agents/specialized/sales-data-extraction-agent.md +0 -68
  257. package/.claude/agents/specialized/specialized-french-consulting-market.md +0 -193
  258. package/.claude/agents/specialized/specialized-korean-business-navigator.md +0 -217
  259. package/.claude/agents/specialized/specialized-salesforce-architect.md +0 -181
  260. package/.claude/agents/specialized/study-abroad-advisor.md +0 -283
  261. package/.claude/agents/specialized/supply-chain-strategist.md +0 -583
  262. package/.claude/agents/sublinear/consensus-coordinator.md +0 -333
  263. package/.claude/agents/sublinear/matrix-optimizer.md +0 -180
  264. package/.claude/agents/sublinear/pagerank-analyzer.md +0 -295
  265. package/.claude/agents/sublinear/performance-optimizer.md +0 -363
  266. package/.claude/agents/sublinear/trading-predictor.md +0 -242
  267. package/.claude/agents/support/support-analytics-reporter.md +0 -366
  268. package/.claude/agents/support/support-executive-summary-generator.md +0 -213
  269. package/.claude/agents/support/support-finance-tracker.md +0 -443
  270. package/.claude/agents/support/support-infrastructure-maintainer.md +0 -619
  271. package/.claude/agents/support/support-legal-compliance-checker.md +0 -589
  272. package/.claude/agents/support/support-support-responder.md +0 -586
  273. package/.claude/agents/swarm/adaptive-coordinator.md +0 -364
  274. package/.claude/agents/swarm/hierarchical-coordinator.md +0 -318
  275. package/.claude/agents/templates/github-pr-manager.md +0 -155
  276. package/.claude/agents/templates/memory-coordinator.md +0 -163
  277. package/.claude/agents/templates/migration-plan.md +0 -724
  278. package/.claude/agents/templates/orchestrator-task.md +0 -120
  279. package/.claude/agents/templates/performance-analyzer.md +0 -179
  280. package/.claude/agents/templates/sparc-coordinator.md +0 -163
  281. package/.claude/agents/testing/testing-reality-checker.md +0 -237
  282. package/.claude/commands/analysis/token-efficiency.md +0 -42
  283. package/.claude/commands/optimization/README.md +0 -73
  284. package/.claude/commands/optimization/parallel-execution.md +0 -76
  285. package/.claude/commands/swarm/swarm-analysis.md +0 -62
  286. package/.claude/commands/swarm/swarm-background.md +0 -65
  287. package/.claude/commands/swarm/swarm-modes.md +0 -67
  288. package/.claude/commands/swarm/swarm-monitor.md +0 -54
  289. package/.claude/commands/swarm/swarm-status.md +0 -44
  290. package/.claude/commands/swarm/swarm-strategies.md +0 -76
  291. package/.claude/commands/training/model-update.md +0 -78
  292. package/.claude/commands/training/pattern-learn.md +0 -69
  293. package/.claude/commands/training/specialization.md +0 -92
  294. package/.claude/commands/verify/check.md +0 -106
  295. package/.claude/commands/verify/start.md +0 -105
  296. package/.claude/helpers/README.md +0 -105
  297. package/.claude/helpers/context-persistence-hook.mjs +0 -1988
  298. package/.claude/helpers/intelligence.cjs +0 -247
  299. package/.claude/helpers/learning-service.mjs +0 -1302
  300. package/.claude/helpers/memory-palace.cjs +0 -461
  301. package/.claude/helpers/memory.cjs +0 -84
  302. package/.claude/helpers/metrics-db.mjs +0 -488
  303. package/.claude/helpers/router.cjs +0 -559
  304. package/.claude/helpers/session.cjs +0 -126
  305. package/.claude/helpers/swarm-hooks.sh +0 -761
  306. package/.claude/helpers/toggle-statusline.cjs +0 -58
  307. package/.claude/helpers/token-tracker.cjs +0 -934
  308. package/.claude/skills/agentdb-advanced/SKILL.md +0 -549
  309. package/.claude/skills/agentdb-learning/SKILL.md +0 -544
  310. package/.claude/skills/agentdb-memory-patterns/SKILL.md +0 -337
  311. package/.claude/skills/agentdb-optimization/SKILL.md +0 -508
  312. package/.claude/skills/agentdb-vector-search/SKILL.md +0 -335
  313. package/.claude/skills/agentic-integration/SKILL.md +0 -265
  314. package/.claude/skills/cli-modernization/SKILL.md +0 -950
  315. package/.claude/skills/core-implementation/SKILL.md +0 -892
  316. package/.claude/skills/ddd-architecture/SKILL.md +0 -444
  317. package/.claude/skills/github-code-review/SKILL.md +0 -1147
  318. package/.claude/skills/github-multi-repo/SKILL.md +0 -912
  319. package/.claude/skills/github-project-management/SKILL.md +0 -1245
  320. package/.claude/skills/github-release-management/SKILL.md +0 -1118
  321. package/.claude/skills/github-workflow-automation/SKILL.md +0 -1107
  322. package/.claude/skills/mcp-optimization/SKILL.md +0 -837
  323. package/.claude/skills/memory-unification/SKILL.md +0 -196
  324. package/.claude/skills/performance-optimization/SKILL.md +0 -416
  325. package/.claude/skills/reasoningbank-agentdb/SKILL.md +0 -444
  326. package/.claude/skills/reasoningbank-intelligence/SKILL.md +0 -199
  327. package/.claude/skills/security-hardening/SKILL.md +0 -101
  328. package/.claude/skills/stream-chain/SKILL.md +0 -560
  329. package/.claude/skills/swarm-coordination/SKILL.md +0 -451
  330. package/bundled-graph/dist/src/analyze.d.ts +0 -32
  331. package/bundled-graph/dist/src/analyze.d.ts.map +0 -1
  332. package/bundled-graph/dist/src/analyze.js +0 -297
  333. package/bundled-graph/dist/src/analyze.js.map +0 -1
  334. package/bundled-graph/dist/src/build.d.ts +0 -8
  335. package/bundled-graph/dist/src/build.d.ts.map +0 -1
  336. package/bundled-graph/dist/src/build.js.map +0 -1
  337. package/bundled-graph/dist/src/cache.d.ts +0 -12
  338. package/bundled-graph/dist/src/cache.d.ts.map +0 -1
  339. package/bundled-graph/dist/src/cache.js +0 -43
  340. package/bundled-graph/dist/src/cache.js.map +0 -1
  341. package/bundled-graph/dist/src/cluster.d.ts +0 -5
  342. package/bundled-graph/dist/src/cluster.d.ts.map +0 -1
  343. package/bundled-graph/dist/src/cluster.js.map +0 -1
  344. package/bundled-graph/dist/src/detect.d.ts +0 -21
  345. package/bundled-graph/dist/src/detect.d.ts.map +0 -1
  346. package/bundled-graph/dist/src/detect.js +0 -195
  347. package/bundled-graph/dist/src/detect.js.map +0 -1
  348. package/bundled-graph/dist/src/export.d.ts +0 -21
  349. package/bundled-graph/dist/src/export.d.ts.map +0 -1
  350. package/bundled-graph/dist/src/export.js +0 -68
  351. package/bundled-graph/dist/src/export.js.map +0 -1
  352. package/bundled-graph/dist/src/extract/index.d.ts +0 -20
  353. package/bundled-graph/dist/src/extract/index.d.ts.map +0 -1
  354. package/bundled-graph/dist/src/extract/index.js +0 -158
  355. package/bundled-graph/dist/src/extract/index.js.map +0 -1
  356. package/bundled-graph/dist/src/extract/languages/c.d.ts +0 -3
  357. package/bundled-graph/dist/src/extract/languages/c.d.ts.map +0 -1
  358. package/bundled-graph/dist/src/extract/languages/c.js +0 -88
  359. package/bundled-graph/dist/src/extract/languages/c.js.map +0 -1
  360. package/bundled-graph/dist/src/extract/languages/cpp.d.ts +0 -3
  361. package/bundled-graph/dist/src/extract/languages/cpp.d.ts.map +0 -1
  362. package/bundled-graph/dist/src/extract/languages/cpp.js +0 -121
  363. package/bundled-graph/dist/src/extract/languages/cpp.js.map +0 -1
  364. package/bundled-graph/dist/src/extract/languages/csharp.d.ts +0 -3
  365. package/bundled-graph/dist/src/extract/languages/csharp.d.ts.map +0 -1
  366. package/bundled-graph/dist/src/extract/languages/csharp.js +0 -121
  367. package/bundled-graph/dist/src/extract/languages/csharp.js.map +0 -1
  368. package/bundled-graph/dist/src/extract/languages/go.d.ts +0 -3
  369. package/bundled-graph/dist/src/extract/languages/go.d.ts.map +0 -1
  370. package/bundled-graph/dist/src/extract/languages/go.js +0 -181
  371. package/bundled-graph/dist/src/extract/languages/go.js.map +0 -1
  372. package/bundled-graph/dist/src/extract/languages/java.d.ts +0 -3
  373. package/bundled-graph/dist/src/extract/languages/java.d.ts.map +0 -1
  374. package/bundled-graph/dist/src/extract/languages/java.js +0 -117
  375. package/bundled-graph/dist/src/extract/languages/java.js.map +0 -1
  376. package/bundled-graph/dist/src/extract/languages/kotlin.d.ts +0 -3
  377. package/bundled-graph/dist/src/extract/languages/kotlin.d.ts.map +0 -1
  378. package/bundled-graph/dist/src/extract/languages/kotlin.js +0 -112
  379. package/bundled-graph/dist/src/extract/languages/kotlin.js.map +0 -1
  380. package/bundled-graph/dist/src/extract/languages/php.d.ts +0 -3
  381. package/bundled-graph/dist/src/extract/languages/php.d.ts.map +0 -1
  382. package/bundled-graph/dist/src/extract/languages/php.js +0 -130
  383. package/bundled-graph/dist/src/extract/languages/php.js.map +0 -1
  384. package/bundled-graph/dist/src/extract/languages/python.d.ts +0 -3
  385. package/bundled-graph/dist/src/extract/languages/python.d.ts.map +0 -1
  386. package/bundled-graph/dist/src/extract/languages/python.js +0 -230
  387. package/bundled-graph/dist/src/extract/languages/python.js.map +0 -1
  388. package/bundled-graph/dist/src/extract/languages/ruby.d.ts +0 -3
  389. package/bundled-graph/dist/src/extract/languages/ruby.d.ts.map +0 -1
  390. package/bundled-graph/dist/src/extract/languages/ruby.js +0 -120
  391. package/bundled-graph/dist/src/extract/languages/ruby.js.map +0 -1
  392. package/bundled-graph/dist/src/extract/languages/rust.d.ts +0 -3
  393. package/bundled-graph/dist/src/extract/languages/rust.d.ts.map +0 -1
  394. package/bundled-graph/dist/src/extract/languages/rust.js +0 -195
  395. package/bundled-graph/dist/src/extract/languages/rust.js.map +0 -1
  396. package/bundled-graph/dist/src/extract/languages/scala.d.ts +0 -3
  397. package/bundled-graph/dist/src/extract/languages/scala.d.ts.map +0 -1
  398. package/bundled-graph/dist/src/extract/languages/scala.js +0 -110
  399. package/bundled-graph/dist/src/extract/languages/scala.js.map +0 -1
  400. package/bundled-graph/dist/src/extract/languages/swift.d.ts +0 -3
  401. package/bundled-graph/dist/src/extract/languages/swift.d.ts.map +0 -1
  402. package/bundled-graph/dist/src/extract/languages/swift.js +0 -122
  403. package/bundled-graph/dist/src/extract/languages/swift.js.map +0 -1
  404. package/bundled-graph/dist/src/extract/languages/typescript.d.ts +0 -3
  405. package/bundled-graph/dist/src/extract/languages/typescript.d.ts.map +0 -1
  406. package/bundled-graph/dist/src/extract/languages/typescript.js +0 -295
  407. package/bundled-graph/dist/src/extract/languages/typescript.js.map +0 -1
  408. package/bundled-graph/dist/src/extract/semantic.d.ts +0 -38
  409. package/bundled-graph/dist/src/extract/semantic.d.ts.map +0 -1
  410. package/bundled-graph/dist/src/extract/semantic.js +0 -242
  411. package/bundled-graph/dist/src/extract/semantic.js.map +0 -1
  412. package/bundled-graph/dist/src/extract/tree-sitter-runner.d.ts +0 -48
  413. package/bundled-graph/dist/src/extract/tree-sitter-runner.d.ts.map +0 -1
  414. package/bundled-graph/dist/src/extract/tree-sitter-runner.js +0 -137
  415. package/bundled-graph/dist/src/extract/tree-sitter-runner.js.map +0 -1
  416. package/bundled-graph/dist/src/extract/types.d.ts +0 -7
  417. package/bundled-graph/dist/src/extract/types.d.ts.map +0 -1
  418. package/bundled-graph/dist/src/extract/types.js +0 -2
  419. package/bundled-graph/dist/src/extract/types.js.map +0 -1
  420. package/bundled-graph/dist/src/index.d.ts +0 -28
  421. package/bundled-graph/dist/src/index.d.ts.map +0 -1
  422. package/bundled-graph/dist/src/index.js +0 -26
  423. package/bundled-graph/dist/src/index.js.map +0 -1
  424. package/bundled-graph/dist/src/pipeline.d.ts +0 -27
  425. package/bundled-graph/dist/src/pipeline.d.ts.map +0 -1
  426. package/bundled-graph/dist/src/pipeline.js +0 -269
  427. package/bundled-graph/dist/src/pipeline.js.map +0 -1
  428. package/bundled-graph/dist/src/report.d.ts +0 -26
  429. package/bundled-graph/dist/src/report.d.ts.map +0 -1
  430. package/bundled-graph/dist/src/report.js +0 -214
  431. package/bundled-graph/dist/src/report.js.map +0 -1
  432. package/bundled-graph/dist/src/types.d.ts +0 -124
  433. package/bundled-graph/dist/src/types.d.ts.map +0 -1
  434. package/bundled-graph/dist/src/types.js +0 -2
  435. package/bundled-graph/dist/src/types.js.map +0 -1
  436. package/bundled-graph/dist/src/visualize.d.ts +0 -4
  437. package/bundled-graph/dist/src/visualize.d.ts.map +0 -1
  438. package/bundled-graph/dist/src/visualize.js +0 -574
  439. package/bundled-graph/dist/src/visualize.js.map +0 -1
  440. package/bundled-graph/dist/tsconfig.tsbuildinfo +0 -1
  441. package/dist/src/ui/dashboard-v2.html +0 -5316
@@ -1,831 +0,0 @@
1
- ---
2
- name: performance-benchmarker
3
- description: Implements comprehensive performance benchmarking for distributed consensus protocols
4
- ---
5
-
6
- # Performance Benchmarker
7
-
8
- Implements comprehensive performance benchmarking and optimization analysis for distributed consensus protocols.
9
-
10
- ## Core Responsibilities
11
-
12
- 1. **Protocol Benchmarking**: Measure throughput, latency, and scalability across consensus algorithms
13
- 2. **Resource Monitoring**: Track CPU, memory, network, and storage utilization patterns
14
- 3. **Comparative Analysis**: Compare Byzantine, Raft, and Gossip protocol performance
15
- 4. **Adaptive Tuning**: Implement real-time parameter optimization and load balancing
16
- 5. **Performance Reporting**: Generate actionable insights and optimization recommendations
17
-
18
- ## Technical Implementation
19
-
20
- ### Core Benchmarking Framework
21
- ```javascript
22
- class ConsensusPerformanceBenchmarker {
23
- constructor() {
24
- this.benchmarkSuites = new Map();
25
- this.performanceMetrics = new Map();
26
- this.historicalData = new TimeSeriesDatabase();
27
- this.currentBenchmarks = new Set();
28
- this.adaptiveOptimizer = new AdaptiveOptimizer();
29
- this.alertSystem = new PerformanceAlertSystem();
30
- }
31
-
32
- // Register benchmark suite for specific consensus protocol
33
- registerBenchmarkSuite(protocolName, benchmarkConfig) {
34
- const suite = new BenchmarkSuite(protocolName, benchmarkConfig);
35
- this.benchmarkSuites.set(protocolName, suite);
36
-
37
- return suite;
38
- }
39
-
40
- // Execute comprehensive performance benchmarks
41
- async runComprehensiveBenchmarks(protocols, scenarios) {
42
- const results = new Map();
43
-
44
- for (const protocol of protocols) {
45
- const protocolResults = new Map();
46
-
47
- for (const scenario of scenarios) {
48
- console.log(`Running ${scenario.name} benchmark for ${protocol}`);
49
-
50
- const benchmarkResult = await this.executeBenchmarkScenario(
51
- protocol, scenario
52
- );
53
-
54
- protocolResults.set(scenario.name, benchmarkResult);
55
-
56
- // Store in historical database
57
- await this.historicalData.store({
58
- protocol: protocol,
59
- scenario: scenario.name,
60
- timestamp: Date.now(),
61
- metrics: benchmarkResult
62
- });
63
- }
64
-
65
- results.set(protocol, protocolResults);
66
- }
67
-
68
- // Generate comparative analysis
69
- const analysis = await this.generateComparativeAnalysis(results);
70
-
71
- // Trigger adaptive optimizations
72
- await this.adaptiveOptimizer.optimizeBasedOnResults(results);
73
-
74
- return {
75
- benchmarkResults: results,
76
- comparativeAnalysis: analysis,
77
- recommendations: await this.generateOptimizationRecommendations(results)
78
- };
79
- }
80
-
81
- async executeBenchmarkScenario(protocol, scenario) {
82
- const benchmark = this.benchmarkSuites.get(protocol);
83
- if (!benchmark) {
84
- throw new Error(`No benchmark suite found for protocol: ${protocol}`);
85
- }
86
-
87
- // Initialize benchmark environment
88
- const environment = await this.setupBenchmarkEnvironment(scenario);
89
-
90
- try {
91
- // Pre-benchmark setup
92
- await benchmark.setup(environment);
93
-
94
- // Execute benchmark phases
95
- const results = {
96
- throughput: await this.measureThroughput(benchmark, scenario),
97
- latency: await this.measureLatency(benchmark, scenario),
98
- resourceUsage: await this.measureResourceUsage(benchmark, scenario),
99
- scalability: await this.measureScalability(benchmark, scenario),
100
- faultTolerance: await this.measureFaultTolerance(benchmark, scenario)
101
- };
102
-
103
- // Post-benchmark analysis
104
- results.analysis = await this.analyzeBenchmarkResults(results);
105
-
106
- return results;
107
-
108
- } finally {
109
- // Cleanup benchmark environment
110
- await this.cleanupBenchmarkEnvironment(environment);
111
- }
112
- }
113
- }
114
- ```
115
-
116
- ### Throughput Measurement System
117
- ```javascript
118
- class ThroughputBenchmark {
119
- constructor(protocol, configuration) {
120
- this.protocol = protocol;
121
- this.config = configuration;
122
- this.metrics = new MetricsCollector();
123
- this.loadGenerator = new LoadGenerator();
124
- }
125
-
126
- async measureThroughput(scenario) {
127
- const measurements = [];
128
- const duration = scenario.duration || 60000; // 1 minute default
129
- const startTime = Date.now();
130
-
131
- // Initialize load generator
132
- await this.loadGenerator.initialize({
133
- requestRate: scenario.initialRate || 10,
134
- rampUp: scenario.rampUp || false,
135
- pattern: scenario.pattern || 'constant'
136
- });
137
-
138
- // Start metrics collection
139
- this.metrics.startCollection(['transactions_per_second', 'success_rate']);
140
-
141
- let currentRate = scenario.initialRate || 10;
142
- const rateIncrement = scenario.rateIncrement || 5;
143
- const measurementInterval = 5000; // 5 seconds
144
-
145
- while (Date.now() - startTime < duration) {
146
- const intervalStart = Date.now();
147
-
148
- // Generate load for this interval
149
- const transactions = await this.generateTransactionLoad(
150
- currentRate, measurementInterval
151
- );
152
-
153
- // Measure throughput for this interval
154
- const intervalMetrics = await this.measureIntervalThroughput(
155
- transactions, measurementInterval
156
- );
157
-
158
- measurements.push({
159
- timestamp: intervalStart,
160
- requestRate: currentRate,
161
- actualThroughput: intervalMetrics.throughput,
162
- successRate: intervalMetrics.successRate,
163
- averageLatency: intervalMetrics.averageLatency,
164
- p95Latency: intervalMetrics.p95Latency,
165
- p99Latency: intervalMetrics.p99Latency
166
- });
167
-
168
- // Adaptive rate adjustment
169
- if (scenario.rampUp && intervalMetrics.successRate > 0.95) {
170
- currentRate += rateIncrement;
171
- } else if (intervalMetrics.successRate < 0.8) {
172
- currentRate = Math.max(1, currentRate - rateIncrement);
173
- }
174
-
175
- // Wait for next interval
176
- const elapsed = Date.now() - intervalStart;
177
- if (elapsed < measurementInterval) {
178
- await this.sleep(measurementInterval - elapsed);
179
- }
180
- }
181
-
182
- // Stop metrics collection
183
- this.metrics.stopCollection();
184
-
185
- // Analyze throughput results
186
- return this.analyzeThroughputMeasurements(measurements);
187
- }
188
-
189
- async generateTransactionLoad(rate, duration) {
190
- const transactions = [];
191
- const interval = 1000 / rate; // Interval between transactions in ms
192
- const endTime = Date.now() + duration;
193
-
194
- while (Date.now() < endTime) {
195
- const transactionStart = Date.now();
196
-
197
- const transaction = {
198
- id: `tx_${Date.now()}_${Math.random()}`,
199
- type: this.getRandomTransactionType(),
200
- data: this.generateTransactionData(),
201
- timestamp: transactionStart
202
- };
203
-
204
- // Submit transaction to consensus protocol
205
- const promise = this.protocol.submitTransaction(transaction)
206
- .then(result => ({
207
- ...transaction,
208
- result: result,
209
- latency: Date.now() - transactionStart,
210
- success: result.committed === true
211
- }))
212
- .catch(error => ({
213
- ...transaction,
214
- error: error,
215
- latency: Date.now() - transactionStart,
216
- success: false
217
- }));
218
-
219
- transactions.push(promise);
220
-
221
- // Wait for next transaction interval
222
- await this.sleep(interval);
223
- }
224
-
225
- // Wait for all transactions to complete
226
- return await Promise.all(transactions);
227
- }
228
-
229
- analyzeThroughputMeasurements(measurements) {
230
- const totalMeasurements = measurements.length;
231
- const avgThroughput = measurements.reduce((sum, m) => sum + m.actualThroughput, 0) / totalMeasurements;
232
- const maxThroughput = Math.max(...measurements.map(m => m.actualThroughput));
233
- const avgSuccessRate = measurements.reduce((sum, m) => sum + m.successRate, 0) / totalMeasurements;
234
-
235
- // Find optimal operating point (highest throughput with >95% success rate)
236
- const optimalPoints = measurements.filter(m => m.successRate >= 0.95);
237
- const optimalThroughput = optimalPoints.length > 0 ?
238
- Math.max(...optimalPoints.map(m => m.actualThroughput)) : 0;
239
-
240
- return {
241
- averageThroughput: avgThroughput,
242
- maxThroughput: maxThroughput,
243
- optimalThroughput: optimalThroughput,
244
- averageSuccessRate: avgSuccessRate,
245
- measurements: measurements,
246
- sustainableThroughput: this.calculateSustainableThroughput(measurements),
247
- throughputVariability: this.calculateThroughputVariability(measurements)
248
- };
249
- }
250
-
251
- calculateSustainableThroughput(measurements) {
252
- // Find the highest throughput that can be sustained for >80% of the time
253
- const sortedThroughputs = measurements.map(m => m.actualThroughput).sort((a, b) => b - a);
254
- const p80Index = Math.floor(sortedThroughputs.length * 0.2);
255
- return sortedThroughputs[p80Index];
256
- }
257
- }
258
- ```
259
-
260
- ### Latency Analysis System
261
- ```javascript
262
- class LatencyBenchmark {
263
- constructor(protocol, configuration) {
264
- this.protocol = protocol;
265
- this.config = configuration;
266
- this.latencyHistogram = new LatencyHistogram();
267
- this.percentileCalculator = new PercentileCalculator();
268
- }
269
-
270
- async measureLatency(scenario) {
271
- const measurements = [];
272
- const sampleSize = scenario.sampleSize || 10000;
273
- const warmupSize = scenario.warmupSize || 1000;
274
-
275
- console.log(`Measuring latency with ${sampleSize} samples (${warmupSize} warmup)`);
276
-
277
- // Warmup phase
278
- await this.performWarmup(warmupSize);
279
-
280
- // Measurement phase
281
- for (let i = 0; i < sampleSize; i++) {
282
- const latencyMeasurement = await this.measureSingleTransactionLatency();
283
- measurements.push(latencyMeasurement);
284
-
285
- // Progress reporting
286
- if (i % 1000 === 0) {
287
- console.log(`Completed ${i}/${sampleSize} latency measurements`);
288
- }
289
- }
290
-
291
- // Analyze latency distribution
292
- return this.analyzeLatencyDistribution(measurements);
293
- }
294
-
295
- async measureSingleTransactionLatency() {
296
- const transaction = {
297
- id: `latency_tx_${Date.now()}_${Math.random()}`,
298
- type: 'benchmark',
299
- data: { value: Math.random() },
300
- phases: {}
301
- };
302
-
303
- // Phase 1: Submission
304
- const submissionStart = performance.now();
305
- const submissionPromise = this.protocol.submitTransaction(transaction);
306
- transaction.phases.submission = performance.now() - submissionStart;
307
-
308
- // Phase 2: Consensus
309
- const consensusStart = performance.now();
310
- const result = await submissionPromise;
311
- transaction.phases.consensus = performance.now() - consensusStart;
312
-
313
- // Phase 3: Application (if applicable)
314
- let applicationLatency = 0;
315
- if (result.applicationTime) {
316
- applicationLatency = result.applicationTime;
317
- }
318
- transaction.phases.application = applicationLatency;
319
-
320
- // Total end-to-end latency
321
- const totalLatency = transaction.phases.submission +
322
- transaction.phases.consensus +
323
- transaction.phases.application;
324
-
325
- return {
326
- transactionId: transaction.id,
327
- totalLatency: totalLatency,
328
- phases: transaction.phases,
329
- success: result.committed === true,
330
- timestamp: Date.now()
331
- };
332
- }
333
-
334
- analyzeLatencyDistribution(measurements) {
335
- const successfulMeasurements = measurements.filter(m => m.success);
336
- const latencies = successfulMeasurements.map(m => m.totalLatency);
337
-
338
- if (latencies.length === 0) {
339
- throw new Error('No successful latency measurements');
340
- }
341
-
342
- // Calculate percentiles
343
- const percentiles = this.percentileCalculator.calculate(latencies, [
344
- 50, 75, 90, 95, 99, 99.9, 99.99
345
- ]);
346
-
347
- // Phase-specific analysis
348
- const phaseAnalysis = this.analyzePhaseLatencies(successfulMeasurements);
349
-
350
- // Latency distribution analysis
351
- const distribution = this.analyzeLatencyHistogram(latencies);
352
-
353
- return {
354
- sampleSize: successfulMeasurements.length,
355
- mean: latencies.reduce((sum, l) => sum + l, 0) / latencies.length,
356
- median: percentiles[50],
357
- standardDeviation: this.calculateStandardDeviation(latencies),
358
- percentiles: percentiles,
359
- phaseAnalysis: phaseAnalysis,
360
- distribution: distribution,
361
- outliers: this.identifyLatencyOutliers(latencies)
362
- };
363
- }
364
-
365
- analyzePhaseLatencies(measurements) {
366
- const phases = ['submission', 'consensus', 'application'];
367
- const phaseAnalysis = {};
368
-
369
- for (const phase of phases) {
370
- const phaseLatencies = measurements.map(m => m.phases[phase]);
371
- const validLatencies = phaseLatencies.filter(l => l > 0);
372
-
373
- if (validLatencies.length > 0) {
374
- phaseAnalysis[phase] = {
375
- mean: validLatencies.reduce((sum, l) => sum + l, 0) / validLatencies.length,
376
- p50: this.percentileCalculator.calculate(validLatencies, [50])[50],
377
- p95: this.percentileCalculator.calculate(validLatencies, [95])[95],
378
- p99: this.percentileCalculator.calculate(validLatencies, [99])[99],
379
- max: Math.max(...validLatencies),
380
- contributionPercent: (validLatencies.reduce((sum, l) => sum + l, 0) /
381
- measurements.reduce((sum, m) => sum + m.totalLatency, 0)) * 100
382
- };
383
- }
384
- }
385
-
386
- return phaseAnalysis;
387
- }
388
- }
389
- ```
390
-
391
- ### Resource Usage Monitor
392
- ```javascript
393
- class ResourceUsageMonitor {
394
- constructor() {
395
- this.monitoringActive = false;
396
- this.samplingInterval = 1000; // 1 second
397
- this.measurements = [];
398
- this.systemMonitor = new SystemMonitor();
399
- }
400
-
401
- async measureResourceUsage(protocol, scenario) {
402
- console.log('Starting resource usage monitoring');
403
-
404
- this.monitoringActive = true;
405
- this.measurements = [];
406
-
407
- // Start monitoring in background
408
- const monitoringPromise = this.startContinuousMonitoring();
409
-
410
- try {
411
- // Execute the benchmark scenario
412
- const benchmarkResult = await this.executeBenchmarkWithMonitoring(
413
- protocol, scenario
414
- );
415
-
416
- // Stop monitoring
417
- this.monitoringActive = false;
418
- await monitoringPromise;
419
-
420
- // Analyze resource usage
421
- const resourceAnalysis = this.analyzeResourceUsage();
422
-
423
- return {
424
- benchmarkResult: benchmarkResult,
425
- resourceUsage: resourceAnalysis
426
- };
427
-
428
- } catch (error) {
429
- this.monitoringActive = false;
430
- throw error;
431
- }
432
- }
433
-
434
- async startContinuousMonitoring() {
435
- while (this.monitoringActive) {
436
- const measurement = await this.collectResourceMeasurement();
437
- this.measurements.push(measurement);
438
-
439
- await this.sleep(this.samplingInterval);
440
- }
441
- }
442
-
443
- async collectResourceMeasurement() {
444
- const timestamp = Date.now();
445
-
446
- // CPU usage
447
- const cpuUsage = await this.systemMonitor.getCPUUsage();
448
-
449
- // Memory usage
450
- const memoryUsage = await this.systemMonitor.getMemoryUsage();
451
-
452
- // Network I/O
453
- const networkIO = await this.systemMonitor.getNetworkIO();
454
-
455
- // Disk I/O
456
- const diskIO = await this.systemMonitor.getDiskIO();
457
-
458
- // Process-specific metrics
459
- const processMetrics = await this.systemMonitor.getProcessMetrics();
460
-
461
- return {
462
- timestamp: timestamp,
463
- cpu: {
464
- totalUsage: cpuUsage.total,
465
- consensusUsage: cpuUsage.process,
466
- loadAverage: cpuUsage.loadAverage,
467
- coreUsage: cpuUsage.cores
468
- },
469
- memory: {
470
- totalUsed: memoryUsage.used,
471
- totalAvailable: memoryUsage.available,
472
- processRSS: memoryUsage.processRSS,
473
- processHeap: memoryUsage.processHeap,
474
- gcStats: memoryUsage.gcStats
475
- },
476
- network: {
477
- bytesIn: networkIO.bytesIn,
478
- bytesOut: networkIO.bytesOut,
479
- packetsIn: networkIO.packetsIn,
480
- packetsOut: networkIO.packetsOut,
481
- connectionsActive: networkIO.connectionsActive
482
- },
483
- disk: {
484
- bytesRead: diskIO.bytesRead,
485
- bytesWritten: diskIO.bytesWritten,
486
- operationsRead: diskIO.operationsRead,
487
- operationsWrite: diskIO.operationsWrite,
488
- queueLength: diskIO.queueLength
489
- },
490
- process: {
491
- consensusThreads: processMetrics.consensusThreads,
492
- fileDescriptors: processMetrics.fileDescriptors,
493
- uptime: processMetrics.uptime
494
- }
495
- };
496
- }
497
-
498
- analyzeResourceUsage() {
499
- if (this.measurements.length === 0) {
500
- return null;
501
- }
502
-
503
- const cpuAnalysis = this.analyzeCPUUsage();
504
- const memoryAnalysis = this.analyzeMemoryUsage();
505
- const networkAnalysis = this.analyzeNetworkUsage();
506
- const diskAnalysis = this.analyzeDiskUsage();
507
-
508
- return {
509
- duration: this.measurements[this.measurements.length - 1].timestamp -
510
- this.measurements[0].timestamp,
511
- sampleCount: this.measurements.length,
512
- cpu: cpuAnalysis,
513
- memory: memoryAnalysis,
514
- network: networkAnalysis,
515
- disk: diskAnalysis,
516
- efficiency: this.calculateResourceEfficiency(),
517
- bottlenecks: this.identifyResourceBottlenecks()
518
- };
519
- }
520
-
521
- analyzeCPUUsage() {
522
- const cpuUsages = this.measurements.map(m => m.cpu.consensusUsage);
523
-
524
- return {
525
- average: cpuUsages.reduce((sum, usage) => sum + usage, 0) / cpuUsages.length,
526
- peak: Math.max(...cpuUsages),
527
- p95: this.calculatePercentile(cpuUsages, 95),
528
- variability: this.calculateStandardDeviation(cpuUsages),
529
- coreUtilization: this.analyzeCoreUtilization(),
530
- trends: this.analyzeCPUTrends()
531
- };
532
- }
533
-
534
- analyzeMemoryUsage() {
535
- const memoryUsages = this.measurements.map(m => m.memory.processRSS);
536
- const heapUsages = this.measurements.map(m => m.memory.processHeap);
537
-
538
- return {
539
- averageRSS: memoryUsages.reduce((sum, usage) => sum + usage, 0) / memoryUsages.length,
540
- peakRSS: Math.max(...memoryUsages),
541
- averageHeap: heapUsages.reduce((sum, usage) => sum + usage, 0) / heapUsages.length,
542
- peakHeap: Math.max(...heapUsages),
543
- memoryLeaks: this.detectMemoryLeaks(),
544
- gcImpact: this.analyzeGCImpact(),
545
- growth: this.calculateMemoryGrowth()
546
- };
547
- }
548
-
549
- identifyResourceBottlenecks() {
550
- const bottlenecks = [];
551
-
552
- // CPU bottleneck detection
553
- const avgCPU = this.measurements.reduce((sum, m) => sum + m.cpu.consensusUsage, 0) /
554
- this.measurements.length;
555
- if (avgCPU > 80) {
556
- bottlenecks.push({
557
- type: 'CPU',
558
- severity: 'HIGH',
559
- description: `High CPU usage (${avgCPU.toFixed(1)}%)`
560
- });
561
- }
562
-
563
- // Memory bottleneck detection
564
- const memoryGrowth = this.calculateMemoryGrowth();
565
- if (memoryGrowth.rate > 1024 * 1024) { // 1MB/s growth
566
- bottlenecks.push({
567
- type: 'MEMORY',
568
- severity: 'MEDIUM',
569
- description: `High memory growth rate (${(memoryGrowth.rate / 1024 / 1024).toFixed(2)} MB/s)`
570
- });
571
- }
572
-
573
- // Network bottleneck detection
574
- const avgNetworkOut = this.measurements.reduce((sum, m) => sum + m.network.bytesOut, 0) /
575
- this.measurements.length;
576
- if (avgNetworkOut > 100 * 1024 * 1024) { // 100 MB/s
577
- bottlenecks.push({
578
- type: 'NETWORK',
579
- severity: 'MEDIUM',
580
- description: `High network output (${(avgNetworkOut / 1024 / 1024).toFixed(2)} MB/s)`
581
- });
582
- }
583
-
584
- return bottlenecks;
585
- }
586
- }
587
- ```
588
-
589
- ### Adaptive Performance Optimizer
590
- ```javascript
591
- class AdaptiveOptimizer {
592
- constructor() {
593
- this.optimizationHistory = new Map();
594
- this.performanceModel = new PerformanceModel();
595
- this.parameterTuner = new ParameterTuner();
596
- this.currentOptimizations = new Map();
597
- }
598
-
599
- async optimizeBasedOnResults(benchmarkResults) {
600
- const optimizations = [];
601
-
602
- for (const [protocol, results] of benchmarkResults) {
603
- const protocolOptimizations = await this.optimizeProtocol(protocol, results);
604
- optimizations.push(...protocolOptimizations);
605
- }
606
-
607
- // Apply optimizations gradually
608
- await this.applyOptimizations(optimizations);
609
-
610
- return optimizations;
611
- }
612
-
613
- async optimizeProtocol(protocol, results) {
614
- const optimizations = [];
615
-
616
- // Analyze performance bottlenecks
617
- const bottlenecks = this.identifyPerformanceBottlenecks(results);
618
-
619
- for (const bottleneck of bottlenecks) {
620
- const optimization = await this.generateOptimization(protocol, bottleneck);
621
- if (optimization) {
622
- optimizations.push(optimization);
623
- }
624
- }
625
-
626
- // Parameter tuning based on performance characteristics
627
- const parameterOptimizations = await this.tuneParameters(protocol, results);
628
- optimizations.push(...parameterOptimizations);
629
-
630
- return optimizations;
631
- }
632
-
633
- identifyPerformanceBottlenecks(results) {
634
- const bottlenecks = [];
635
-
636
- // Throughput bottlenecks
637
- for (const [scenario, result] of results) {
638
- if (result.throughput && result.throughput.optimalThroughput < result.throughput.maxThroughput * 0.8) {
639
- bottlenecks.push({
640
- type: 'THROUGHPUT_DEGRADATION',
641
- scenario: scenario,
642
- severity: 'HIGH',
643
- impact: (result.throughput.maxThroughput - result.throughput.optimalThroughput) /
644
- result.throughput.maxThroughput,
645
- details: result.throughput
646
- });
647
- }
648
-
649
- // Latency bottlenecks
650
- if (result.latency && result.latency.p99 > result.latency.p50 * 10) {
651
- bottlenecks.push({
652
- type: 'LATENCY_TAIL',
653
- scenario: scenario,
654
- severity: 'MEDIUM',
655
- impact: result.latency.p99 / result.latency.p50,
656
- details: result.latency
657
- });
658
- }
659
-
660
- // Resource bottlenecks
661
- if (result.resourceUsage && result.resourceUsage.bottlenecks.length > 0) {
662
- bottlenecks.push({
663
- type: 'RESOURCE_CONSTRAINT',
664
- scenario: scenario,
665
- severity: 'HIGH',
666
- details: result.resourceUsage.bottlenecks
667
- });
668
- }
669
- }
670
-
671
- return bottlenecks;
672
- }
673
-
674
- async generateOptimization(protocol, bottleneck) {
675
- switch (bottleneck.type) {
676
- case 'THROUGHPUT_DEGRADATION':
677
- return await this.optimizeThroughput(protocol, bottleneck);
678
- case 'LATENCY_TAIL':
679
- return await this.optimizeLatency(protocol, bottleneck);
680
- case 'RESOURCE_CONSTRAINT':
681
- return await this.optimizeResourceUsage(protocol, bottleneck);
682
- default:
683
- return null;
684
- }
685
- }
686
-
687
- async optimizeThroughput(protocol, bottleneck) {
688
- const optimizations = [];
689
-
690
- // Batch size optimization
691
- if (protocol === 'raft') {
692
- optimizations.push({
693
- type: 'PARAMETER_ADJUSTMENT',
694
- parameter: 'max_batch_size',
695
- currentValue: await this.getCurrentParameter(protocol, 'max_batch_size'),
696
- recommendedValue: this.calculateOptimalBatchSize(bottleneck.details),
697
- expectedImprovement: '15-25% throughput increase',
698
- confidence: 0.8
699
- });
700
- }
701
-
702
- // Pipelining optimization
703
- if (protocol === 'byzantine') {
704
- optimizations.push({
705
- type: 'FEATURE_ENABLE',
706
- feature: 'request_pipelining',
707
- description: 'Enable request pipelining to improve throughput',
708
- expectedImprovement: '20-30% throughput increase',
709
- confidence: 0.7
710
- });
711
- }
712
-
713
- return optimizations.length > 0 ? optimizations[0] : null;
714
- }
715
-
716
- async tuneParameters(protocol, results) {
717
- const optimizations = [];
718
-
719
- // Use machine learning model to suggest parameter values
720
- const parameterSuggestions = await this.performanceModel.suggestParameters(
721
- protocol, results
722
- );
723
-
724
- for (const suggestion of parameterSuggestions) {
725
- if (suggestion.confidence > 0.6) {
726
- optimizations.push({
727
- type: 'PARAMETER_TUNING',
728
- parameter: suggestion.parameter,
729
- currentValue: suggestion.currentValue,
730
- recommendedValue: suggestion.recommendedValue,
731
- expectedImprovement: suggestion.expectedImprovement,
732
- confidence: suggestion.confidence,
733
- rationale: suggestion.rationale
734
- });
735
- }
736
- }
737
-
738
- return optimizations;
739
- }
740
-
741
- async applyOptimizations(optimizations) {
742
- // Sort by confidence and expected impact
743
- const sortedOptimizations = optimizations.sort((a, b) =>
744
- (b.confidence * parseFloat(b.expectedImprovement)) -
745
- (a.confidence * parseFloat(a.expectedImprovement))
746
- );
747
-
748
- // Apply optimizations gradually
749
- for (const optimization of sortedOptimizations) {
750
- try {
751
- await this.applyOptimization(optimization);
752
-
753
- // Wait and measure impact
754
- await this.sleep(30000); // 30 seconds
755
- const impact = await this.measureOptimizationImpact(optimization);
756
-
757
- if (impact.improvement < 0.05) {
758
- // Revert if improvement is less than 5%
759
- await this.revertOptimization(optimization);
760
- } else {
761
- // Keep optimization and record success
762
- this.recordOptimizationSuccess(optimization, impact);
763
- }
764
-
765
- } catch (error) {
766
- console.error(`Failed to apply optimization:`, error);
767
- await this.revertOptimization(optimization);
768
- }
769
- }
770
- }
771
- }
772
- ```
773
-
774
- ## MCP Integration Hooks
775
-
776
- ### Performance Metrics Storage
777
- ```javascript
778
- // Store comprehensive benchmark results
779
- await this.mcpTools.memory_usage({
780
- action: 'store',
781
- key: `benchmark_results_${protocol}_${Date.now()}`,
782
- value: JSON.stringify({
783
- protocol: protocol,
784
- timestamp: Date.now(),
785
- throughput: throughputResults,
786
- latency: latencyResults,
787
- resourceUsage: resourceResults,
788
- optimizations: appliedOptimizations
789
- }),
790
- namespace: 'performance_benchmarks',
791
- ttl: 604800000 // 7 days
792
- });
793
-
794
- // Real-time performance monitoring
795
- await this.mcpTools.metrics_collect({
796
- components: [
797
- 'consensus_throughput',
798
- 'consensus_latency_p99',
799
- 'cpu_utilization',
800
- 'memory_usage',
801
- 'network_io_rate'
802
- ]
803
- });
804
- ```
805
-
806
- ### Neural Performance Learning
807
- ```javascript
808
- // Learn performance optimization patterns
809
- await this.mcpTools.neural_patterns({
810
- action: 'learn',
811
- operation: 'performance_optimization',
812
- outcome: JSON.stringify({
813
- optimizationType: optimization.type,
814
- performanceGain: measurementResults.improvement,
815
- resourceImpact: measurementResults.resourceDelta,
816
- networkConditions: currentNetworkState
817
- })
818
- });
819
-
820
- // Predict optimal configurations
821
- const configPrediction = await this.mcpTools.neural_predict({
822
- modelId: 'consensus_performance_model',
823
- input: JSON.stringify({
824
- workloadPattern: currentWorkload,
825
- networkTopology: networkState,
826
- resourceConstraints: systemResources
827
- })
828
- });
829
- ```
830
-
831
- This Performance Benchmarker provides comprehensive performance analysis, optimization recommendations, and adaptive tuning capabilities for distributed consensus protocols.