claude-flow-novice 1.6.1 → 1.6.3

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 (273) hide show
  1. package/.claude/agents/cfn-loop/product-owner.md +54 -4
  2. package/.claude/commands/cfn-claude-sync.md +303 -0
  3. package/.claude/commands/cfn-loop-epic.md +290 -0
  4. package/.claude/commands/cfn-loop-single.md +168 -0
  5. package/.claude/commands/cfn-loop-sprints.md +384 -0
  6. package/.claude/commands/cfn-loop.md +180 -0
  7. package/.claude/commands/metrics-summary.md +58 -0
  8. package/.claude/commands/parse-epic.md +357 -0
  9. package/.claude/settings.json +5 -4
  10. package/.claude/settings.local.json +9 -2
  11. package/.claude-flow-novice/.claude/agents/cfn-loop/product-owner.md +792 -0
  12. package/.claude-flow-novice/dist/mcp/server.js +21 -2
  13. package/.claude-flow-novice/dist/src/api/auth-service.js +84 -38
  14. package/.claude-flow-novice/dist/src/api/auth-service.js.map +1 -1
  15. package/.claude-flow-novice/dist/src/api/claude-client.js +138 -3
  16. package/.claude-flow-novice/dist/src/api/claude-client.js.map +1 -1
  17. package/.claude-flow-novice/dist/src/cfn-loop/phase-orchestrator-example.js +1 -1
  18. package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js +247 -0
  19. package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js.map +1 -0
  20. package/.claude-flow-novice/dist/src/cli/commands/swarm.js +32 -15
  21. package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
  22. package/.claude-flow-novice/dist/src/cli/commands/transparency.js +455 -0
  23. package/.claude-flow-novice/dist/src/cli/commands/transparency.js.map +1 -0
  24. package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/CLAUDE.md +129 -13
  25. package/.claude-flow-novice/dist/src/components/visualizations/index.js +9 -0
  26. package/.claude-flow-novice/dist/src/components/visualizations/index.js.map +1 -0
  27. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +462 -0
  28. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -0
  29. package/.claude-flow-novice/dist/src/coordination/config-translator.js +248 -0
  30. package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -0
  31. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +287 -0
  32. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -0
  33. package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js +68 -9
  34. package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js.map +1 -1
  35. package/.claude-flow-novice/dist/src/coordination/feature-flags.js +166 -0
  36. package/.claude-flow-novice/dist/src/coordination/feature-flags.js.map +1 -0
  37. package/.claude-flow-novice/dist/src/coordination/queen-agent.js +18 -4
  38. package/.claude-flow-novice/dist/src/coordination/queen-agent.js.map +1 -1
  39. package/.claude-flow-novice/dist/src/coordination/role-assignment.js +6 -110
  40. package/.claude-flow-novice/dist/src/coordination/role-assignment.js.map +1 -1
  41. package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js +632 -0
  42. package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js.map +1 -0
  43. package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js +11 -0
  44. package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js.map +1 -0
  45. package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js +318 -0
  46. package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js.map +1 -0
  47. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js +364 -0
  48. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js.map +1 -0
  49. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js +492 -0
  50. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js.map +1 -0
  51. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js +786 -0
  52. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js.map +1 -0
  53. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js +16 -0
  54. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js.map +1 -0
  55. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js +342 -0
  56. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js.map +1 -0
  57. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js +601 -0
  58. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
  59. package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js +211 -0
  60. package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js.map +1 -0
  61. package/.claude-flow-novice/dist/src/coordination/v2/core/index.js +1 -0
  62. package/.claude-flow-novice/dist/src/coordination/v2/core/index.js.map +1 -1
  63. package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js +365 -6
  64. package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js.map +1 -1
  65. package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js +478 -0
  66. package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js.map +1 -0
  67. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js +5 -2
  68. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js.map +1 -1
  69. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js +189 -0
  70. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js.map +1 -1
  71. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js +424 -0
  72. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js.map +1 -0
  73. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js +9 -0
  74. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js.map +1 -0
  75. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js +669 -0
  76. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js.map +1 -0
  77. package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js +451 -0
  78. package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js.map +1 -0
  79. package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js +271 -0
  80. package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js.map +1 -0
  81. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js +335 -0
  82. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js.map +1 -0
  83. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js +439 -0
  84. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js.map +1 -0
  85. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js +92 -0
  86. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js.map +1 -0
  87. package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js +21 -0
  88. package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js.map +1 -0
  89. package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js +223 -0
  90. package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js.map +1 -0
  91. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js +436 -0
  92. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js.map +1 -0
  93. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js +278 -0
  94. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js.map +1 -0
  95. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js +317 -0
  96. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js.map +1 -0
  97. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js +273 -0
  98. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js.map +1 -0
  99. package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js +15 -0
  100. package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js.map +1 -0
  101. package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js +512 -0
  102. package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js.map +1 -0
  103. package/.claude-flow-novice/dist/src/coordination/v2/index.js +6 -0
  104. package/.claude-flow-novice/dist/src/coordination/v2/index.js.map +1 -1
  105. package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js +557 -0
  106. package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js.map +1 -0
  107. package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js +14 -0
  108. package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js.map +1 -0
  109. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js +212 -0
  110. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js.map +1 -0
  111. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js +552 -0
  112. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js.map +1 -0
  113. package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js +367 -0
  114. package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js.map +1 -0
  115. package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js +1 -0
  116. package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js.map +1 -1
  117. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js +371 -0
  118. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js.map +1 -0
  119. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js +355 -0
  120. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js.map +1 -0
  121. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js +424 -0
  122. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js.map +1 -0
  123. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js +16 -0
  124. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js.map +1 -0
  125. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js +295 -0
  126. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js.map +1 -0
  127. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js +411 -0
  128. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js.map +1 -0
  129. package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js +14 -0
  130. package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js.map +1 -0
  131. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js +387 -0
  132. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js.map +1 -0
  133. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js +589 -0
  134. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js.map +1 -0
  135. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js +444 -0
  136. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js.map +1 -0
  137. package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js +29 -8
  138. package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js.map +1 -1
  139. package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js +470 -0
  140. package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js.map +1 -0
  141. package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js +450 -0
  142. package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js.map +1 -0
  143. package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js +5 -0
  144. package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js.map +1 -1
  145. package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js +545 -0
  146. package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js.map +1 -0
  147. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js +44 -0
  148. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js.map +1 -1
  149. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js +415 -0
  150. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js.map +1 -0
  151. package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js +615 -0
  152. package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js.map +1 -0
  153. package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js +259 -0
  154. package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js.map +1 -0
  155. package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js +17 -0
  156. package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js.map +1 -0
  157. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js +357 -0
  158. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js.map +1 -0
  159. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js +679 -0
  160. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js.map +1 -0
  161. package/.claude-flow-novice/dist/src/core/agent-manager.js +30 -0
  162. package/.claude-flow-novice/dist/src/core/agent-manager.js.map +1 -1
  163. package/.claude-flow-novice/dist/src/mcp/server.js +21 -2
  164. package/.claude-flow-novice/dist/src/mcp/server.js.map +1 -1
  165. package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js +719 -0
  166. package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js.map +1 -0
  167. package/.claude-flow-novice/dist/src/monitoring/apm/datadog-collector.js +363 -0
  168. package/.claude-flow-novice/dist/src/monitoring/apm/datadog-collector.js.map +1 -0
  169. package/.claude-flow-novice/dist/src/monitoring/apm/index.js +97 -0
  170. package/.claude-flow-novice/dist/src/monitoring/apm/index.js.map +1 -0
  171. package/.claude-flow-novice/dist/src/monitoring/apm/newrelic-collector.js +384 -0
  172. package/.claude-flow-novice/dist/src/monitoring/apm/newrelic-collector.js.map +1 -0
  173. package/.claude-flow-novice/dist/src/monitoring/apm/performance-optimizer.js +612 -0
  174. package/.claude-flow-novice/dist/src/monitoring/apm/performance-optimizer.js.map +1 -0
  175. package/.claude-flow-novice/dist/src/monitoring/metrics-collector.js +282 -0
  176. package/.claude-flow-novice/dist/src/monitoring/metrics-collector.js.map +1 -0
  177. package/.claude-flow-novice/dist/src/observability/metrics-counter.js +268 -0
  178. package/.claude-flow-novice/dist/src/observability/metrics-counter.js.map +1 -0
  179. package/.claude-flow-novice/dist/src/observability/metrics-storage.js +265 -0
  180. package/.claude-flow-novice/dist/src/observability/metrics-storage.js.map +1 -0
  181. package/.claude-flow-novice/dist/src/observability/telemetry.js +26 -0
  182. package/.claude-flow-novice/dist/src/observability/telemetry.js.map +1 -1
  183. package/.claude-flow-novice/dist/src/providers/tiered-router.js +64 -10
  184. package/.claude-flow-novice/dist/src/providers/tiered-router.js.map +1 -1
  185. package/.claude-flow-novice/dist/src/providers/zai-provider.js +196 -97
  186. package/.claude-flow-novice/dist/src/providers/zai-provider.js.map +1 -1
  187. package/.claude-flow-novice/dist/src/slash-commands/cfn-claude-sync.js +533 -0
  188. package/.claude-flow-novice/dist/src/slash-commands/index.js +5 -0
  189. package/.claude-flow-novice/dist/src/slash-commands/metrics-summary-class.js +74 -0
  190. package/.claude-flow-novice/dist/src/slash-commands/metrics-summary.js +335 -0
  191. package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +12 -0
  192. package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js +96 -0
  193. package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js.map +1 -0
  194. package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js +406 -0
  195. package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js.map +1 -0
  196. package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js +35 -5
  197. package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js.map +1 -1
  198. package/.claude-flow-novice/dist/src/web/api/apm-routes.js +355 -0
  199. package/.claude-flow-novice/dist/src/web/api/apm-routes.js.map +1 -0
  200. package/.claude-flow-novice/dist/src/web/api/config/api-config.js +186 -0
  201. package/.claude-flow-novice/dist/src/web/api/config/api-config.js.map +1 -0
  202. package/.claude-flow-novice/dist/src/web/api/middleware/auth.js +205 -0
  203. package/.claude-flow-novice/dist/src/web/api/middleware/auth.js.map +1 -0
  204. package/.claude-flow-novice/dist/src/web/api/middleware/cache.js +262 -0
  205. package/.claude-flow-novice/dist/src/web/api/middleware/cache.js.map +1 -0
  206. package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js +250 -0
  207. package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js.map +1 -0
  208. package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js +217 -0
  209. package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js.map +1 -0
  210. package/.claude-flow-novice/dist/src/web/api/middleware/validation.js +325 -0
  211. package/.claude-flow-novice/dist/src/web/api/middleware/validation.js.map +1 -0
  212. package/.claude-flow-novice/dist/src/web/api/routes/events.js +465 -0
  213. package/.claude-flow-novice/dist/src/web/api/routes/events.js.map +1 -0
  214. package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js +302 -0
  215. package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js.map +1 -0
  216. package/.claude-flow-novice/dist/src/web/api/routes/index.js +14 -0
  217. package/.claude-flow-novice/dist/src/web/api/routes/index.js.map +1 -0
  218. package/.claude-flow-novice/dist/src/web/api/routes/metrics.js +561 -0
  219. package/.claude-flow-novice/dist/src/web/api/routes/metrics.js.map +1 -0
  220. package/.claude-flow-novice/dist/src/web/api/routes/status.js +450 -0
  221. package/.claude-flow-novice/dist/src/web/api/routes/status.js.map +1 -0
  222. package/.claude-flow-novice/dist/src/web/api/server.js +451 -0
  223. package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -0
  224. package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js +385 -0
  225. package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js.map +1 -0
  226. package/.claude-flow-novice/dist/src/web/dashboard/index.js +87 -0
  227. package/.claude-flow-novice/dist/src/web/dashboard/index.js.map +1 -0
  228. package/.claude-flow-novice/dist/src/web/dashboard/types.js +6 -0
  229. package/.claude-flow-novice/dist/src/web/dashboard/types.js.map +1 -0
  230. package/.claude-flow-novice/dist/src/web/frontend/src/utils/security.js +425 -0
  231. package/.claude-flow-novice/dist/src/web/frontend/src/utils/security.js.map +1 -0
  232. package/.claude-flow-novice/dist/src/web/security/security-middleware.js +379 -0
  233. package/.claude-flow-novice/dist/src/web/security/security-middleware.js.map +1 -0
  234. package/.claude-flow-novice/dist/src/web/websocket/apm-websocket-handler.js +441 -0
  235. package/.claude-flow-novice/dist/src/web/websocket/apm-websocket-handler.js.map +1 -0
  236. package/.claude-flow-novice/dist/src/web/websocket/websocket-manager.js +255 -1
  237. package/.claude-flow-novice/dist/src/web/websocket/websocket-manager.js.map +1 -1
  238. package/.claude-flow-novice/metrics.db +0 -0
  239. package/.claude-flow-novice/metrics.db-shm +0 -0
  240. package/.claude-flow-novice/metrics.db-wal +0 -0
  241. package/AGENT_PERFORMANCE_GUIDELINES.md +88 -0
  242. package/CLAUDE.md +60 -3
  243. package/MEMORY_LEAK_ROOT_CAUSE.md +149 -0
  244. package/README.md +27 -0
  245. package/config/hooks/post-edit-pipeline.js +36 -2
  246. package/examples/metrics-counter-demo.ts +106 -0
  247. package/examples/persistent-metrics-demo.ts +83 -0
  248. package/examples/phase-5-multi-level-control.ts +282 -0
  249. package/examples/session-pool-optimizer-example.ts +311 -0
  250. package/package.json +18 -4
  251. package/scripts/check-routing-stats.cjs +122 -0
  252. package/scripts/monitor-loop.sh +65 -0
  253. package/scripts/monitor-memory.sh +47 -0
  254. package/scripts/monitor.py +43 -0
  255. package/scripts/pre-publish-validation.cjs +212 -0
  256. package/scripts/test-provider-routing.cjs +228 -0
  257. package/scripts/test-routing-telemetry.cjs +147 -0
  258. package/scripts/test-zai-10k.cjs +81 -0
  259. package/scripts/test-zai-api.cjs +191 -0
  260. package/scripts/test-zai-diagnostic.cjs +151 -0
  261. package/scripts/test-zai-final.cjs +128 -0
  262. package/scripts/test-zai-with-env.cjs +85 -0
  263. package/scripts/validate-coordination-cli.js +69 -0
  264. package/scripts/validate-coordination-toggle-integration.cjs +501 -0
  265. package/src/cli/simple-commands/init/templates/CLAUDE.md +29 -0
  266. package/src/observability/metrics-counter.ts +347 -0
  267. package/src/observability/metrics-storage.ts +356 -0
  268. package/src/observability/telemetry.ts +658 -0
  269. package/src/slash-commands/cfn-claude-sync.js +533 -0
  270. package/src/slash-commands/index.js +5 -0
  271. package/src/slash-commands/metrics-summary-class.js +74 -0
  272. package/src/slash-commands/metrics-summary.js +335 -0
  273. package/src/slash-commands/register-all-commands.js +12 -0
@@ -0,0 +1,384 @@
1
+ /**
2
+ * New Relic APM Integration for Claude Flow Novice
3
+ * Provides comprehensive monitoring, tracing, and metrics collection
4
+ */ import { Logger } from '../../utils/logger.js';
5
+ export class NewRelicCollector {
6
+ config;
7
+ logger;
8
+ activeTransactions = new Map();
9
+ activeSpans = new Map();
10
+ metricsQueue = [];
11
+ logsQueue = [];
12
+ flushInterval;
13
+ constructor(config){
14
+ this.config = {
15
+ appName: 'Claude Flow Novice',
16
+ env: process.env.NODE_ENV || 'production',
17
+ version: process.env.npm_package_version || '1.6.2',
18
+ tracing: {
19
+ enabled: true,
20
+ distributedTracing: true,
21
+ transactionEvents: true,
22
+ spanEvents: true
23
+ },
24
+ metrics: {
25
+ enabled: true,
26
+ apiHost: 'https://metric-api.newrelic.com',
27
+ metricApiPath: '/metric/v1'
28
+ },
29
+ logs: {
30
+ enabled: true,
31
+ apiHost: 'https://log-api.newrelic.com',
32
+ logApiPath: '/log/v1'
33
+ },
34
+ browserMonitoring: {
35
+ enabled: false
36
+ },
37
+ ...config
38
+ };
39
+ this.logger = new Logger('NewRelicCollector');
40
+ this.startFlushing();
41
+ }
42
+ // Transaction Management
43
+ startTransaction(name, type, attributes) {
44
+ if (!this.config.tracing?.enabled) return '';
45
+ const transactionId = this.generateId();
46
+ const transaction = {
47
+ name,
48
+ type,
49
+ startTime: Date.now(),
50
+ duration: 0,
51
+ attributes: {
52
+ 'service.name': this.config.appName,
53
+ 'service.version': this.config.version,
54
+ 'environment': this.config.env,
55
+ ...attributes
56
+ }
57
+ };
58
+ this.activeTransactions.set(transactionId, transaction);
59
+ return transactionId;
60
+ }
61
+ finishTransaction(transactionId, attributes, error) {
62
+ if (!transactionId || !this.activeTransactions.has(transactionId)) return;
63
+ const transaction = this.activeTransactions.get(transactionId);
64
+ transaction.duration = Date.now() - transaction.startTime;
65
+ if (attributes) {
66
+ transaction.attributes = {
67
+ ...transaction.attributes,
68
+ ...attributes
69
+ };
70
+ }
71
+ if (error) {
72
+ transaction.error = true;
73
+ transaction.attributes['error.type'] = error.constructor.name;
74
+ transaction.attributes['error.message'] = error.message;
75
+ transaction.attributes['error.stack'] = error.stack || '';
76
+ }
77
+ this.sendTransaction(transaction);
78
+ this.activeTransactions.delete(transactionId);
79
+ }
80
+ // Span Management
81
+ startSpan(transactionId, name, type, parentId, attributes) {
82
+ if (!this.config.tracing?.enabled || !this.activeTransactions.has(transactionId)) return '';
83
+ const spanId = this.generateId();
84
+ const transaction = this.activeTransactions.get(transactionId);
85
+ const span = {
86
+ id: spanId,
87
+ traceId: this.generateId(),
88
+ transactionId,
89
+ parentId,
90
+ name,
91
+ type,
92
+ startTime: Date.now(),
93
+ duration: 0,
94
+ attributes: {
95
+ 'service.name': this.config.appName,
96
+ ...attributes
97
+ }
98
+ };
99
+ this.activeSpans.set(spanId, span);
100
+ return spanId;
101
+ }
102
+ finishSpan(spanId, attributes, error) {
103
+ if (!spanId || !this.activeSpans.has(spanId)) return;
104
+ const span = this.activeSpans.get(spanId);
105
+ span.duration = Date.now() - span.startTime;
106
+ if (attributes) {
107
+ span.attributes = {
108
+ ...span.attributes,
109
+ ...attributes
110
+ };
111
+ }
112
+ if (error) {
113
+ span.error = true;
114
+ span.attributes['error.type'] = error.constructor.name;
115
+ span.attributes['error.message'] = error.message;
116
+ span.attributes['error.stack'] = error.stack || '';
117
+ }
118
+ this.sendSpan(span);
119
+ this.activeSpans.delete(spanId);
120
+ }
121
+ // Metrics Collection
122
+ recordMetric(name, value, type, attributes) {
123
+ if (!this.config.metrics?.enabled) return;
124
+ const metric = {
125
+ name,
126
+ type,
127
+ value,
128
+ timestamp: Date.now() * 1000000,
129
+ attributes: {
130
+ 'service.name': this.config.appName,
131
+ 'environment': this.config.env,
132
+ ...attributes
133
+ }
134
+ };
135
+ this.metricsQueue.push(metric);
136
+ }
137
+ // Business Metrics for Agent Operations
138
+ recordAgentOperation(agentType, operation, duration, success) {
139
+ this.recordMetric('AgentOperation', duration, 'histogram', {
140
+ 'agent.type': agentType,
141
+ 'operation.name': operation,
142
+ 'operation.status': success ? 'success' : 'failure'
143
+ });
144
+ this.recordMetric('AgentOperations', 1, 'count', {
145
+ 'agent.type': agentType,
146
+ 'operation.name': operation,
147
+ 'operation.status': success ? 'success' : 'failure'
148
+ });
149
+ if (!success) {
150
+ this.recordMetric('AgentErrors', 1, 'count', {
151
+ 'agent.type': agentType,
152
+ 'operation.name': operation
153
+ });
154
+ }
155
+ }
156
+ recordSwarmActivity(swarmSize, topology, duration, success) {
157
+ this.recordMetric('SwarmSize', swarmSize, 'gauge', {
158
+ 'swarm.topology': topology
159
+ });
160
+ this.recordMetric('SwarmExecution', duration, 'histogram', {
161
+ 'swarm.topology': topology,
162
+ 'execution.status': success ? 'success' : 'failure'
163
+ });
164
+ this.recordMetric('SwarmExecutions', 1, 'count', {
165
+ 'swarm.topology': topology,
166
+ 'execution.status': success ? 'success' : 'failure'
167
+ });
168
+ }
169
+ recordWebSocketEvent(eventType, duration, success) {
170
+ this.recordMetric('WebSocketEvent', duration, 'histogram', {
171
+ 'event.type': eventType,
172
+ 'event.status': success ? 'success' : 'failure'
173
+ });
174
+ this.recordMetric('WebSocketEvents', 1, 'count', {
175
+ 'event.type': eventType,
176
+ 'event.status': success ? 'success' : 'failure'
177
+ });
178
+ // Track active connections
179
+ if (eventType === 'connection') {
180
+ this.recordMetric('ActiveWebSocketConnections', 1, 'gauge');
181
+ } else if (eventType === 'disconnection') {
182
+ this.recordMetric('ActiveWebSocketConnections', -1, 'gauge');
183
+ }
184
+ }
185
+ recordAPICall(method, route, statusCode, duration) {
186
+ this.recordMetric('APICall', duration, 'histogram', {
187
+ 'http.method': method,
188
+ 'http.route': route,
189
+ 'http.status_code': statusCode.toString()
190
+ });
191
+ this.recordMetric('APICalls', 1, 'count', {
192
+ 'http.method': method,
193
+ 'http.route': route,
194
+ 'http.status_code': statusCode.toString()
195
+ });
196
+ if (statusCode >= 400) {
197
+ this.recordMetric('APIErrors', 1, 'count', {
198
+ 'http.method': method,
199
+ 'http.route': route,
200
+ 'http.status_code': statusCode.toString()
201
+ });
202
+ }
203
+ }
204
+ // Custom Event Tracking
205
+ recordCustomEvent(eventType, attributes) {
206
+ this.recordMetric('CustomEvent', 1, 'count', {
207
+ 'event.type': eventType,
208
+ ...attributes
209
+ });
210
+ }
211
+ // Logging Integration
212
+ log(message, level, attributes, traceId, spanId) {
213
+ if (!this.config.logs?.enabled) return;
214
+ const logEntry = {
215
+ message,
216
+ timestamp: Date.now() * 1000000,
217
+ level: level.toUpperCase(),
218
+ attributes: {
219
+ 'service.name': this.config.appName,
220
+ 'environment': this.config.env,
221
+ ...attributes
222
+ },
223
+ traceId,
224
+ spanId
225
+ };
226
+ this.logsQueue.push(logEntry);
227
+ }
228
+ // Performance Monitoring
229
+ recordPerformanceMetric(operation, duration, attributes) {
230
+ this.recordMetric('PerformanceOperation', duration, 'histogram', {
231
+ 'operation.name': operation,
232
+ ...attributes
233
+ });
234
+ if (duration > 5000) {
235
+ this.log(`Slow operation detected: ${operation}`, 'warn', {
236
+ duration,
237
+ operation,
238
+ ...attributes
239
+ });
240
+ }
241
+ }
242
+ // Browser Monitoring
243
+ getBrowserMonitoringScript() {
244
+ if (!this.config.browserMonitoring?.enabled || !this.config.licenseKey) return '';
245
+ // Return the New Relic browser monitoring script
246
+ return `
247
+ (function(window){
248
+ window.NREUM||(window.NREUM={});
249
+ NREUM.init={...}; // Configuration would go here
250
+ })(window);
251
+ `;
252
+ }
253
+ // Health Check
254
+ async healthCheck() {
255
+ try {
256
+ const health = {
257
+ status: 'healthy',
258
+ details: {
259
+ config: {
260
+ tracing: this.config.tracing?.enabled || false,
261
+ metrics: this.config.metrics?.enabled || false,
262
+ logs: this.config.logs?.enabled || false,
263
+ browserMonitoring: this.config.browserMonitoring?.enabled || false
264
+ },
265
+ activeTransactions: this.activeTransactions.size,
266
+ activeSpans: this.activeSpans.size,
267
+ queuedMetrics: this.metricsQueue.length,
268
+ queuedLogs: this.logsQueue.length,
269
+ lastFlush: Date.now()
270
+ }
271
+ };
272
+ // Check if queues are growing too large
273
+ if (this.metricsQueue.length > 1000 || this.logsQueue.length > 1000) {
274
+ health.status = 'degraded';
275
+ health.details.queues = 'high';
276
+ }
277
+ return health;
278
+ } catch (error) {
279
+ return {
280
+ status: 'unhealthy',
281
+ details: {
282
+ error: error.message
283
+ }
284
+ };
285
+ }
286
+ }
287
+ // Private Methods
288
+ generateId() {
289
+ return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
290
+ }
291
+ sendTransaction(transaction) {
292
+ if (!this.config.licenseKey) return;
293
+ // In a real implementation, you would send this to New Relic's API
294
+ this.logger.debug('Sending transaction to New Relic', {
295
+ name: transaction.name,
296
+ duration: transaction.duration,
297
+ error: transaction.error
298
+ });
299
+ }
300
+ sendSpan(span) {
301
+ if (!this.config.licenseKey) return;
302
+ // In a real implementation, you would send this to New Relic's API
303
+ this.logger.debug('Sending span to New Relic', {
304
+ id: span.id,
305
+ name: span.name,
306
+ duration: span.duration,
307
+ error: span.error
308
+ });
309
+ }
310
+ async flushMetrics() {
311
+ if (!this.config.licenseKey || this.metricsQueue.length === 0) return;
312
+ const metricsToSend = [
313
+ ...this.metricsQueue
314
+ ];
315
+ this.metricsQueue = [];
316
+ try {
317
+ // In a real implementation, send to New Relic's metrics API
318
+ this.logger.debug(`Flushing ${metricsToSend.length} metrics to New Relic`);
319
+ } catch (error) {
320
+ this.logger.error('Failed to flush metrics to New Relic', {
321
+ error: error.message
322
+ });
323
+ // Re-queue failed metrics
324
+ this.metricsQueue.unshift(...metricsToSend);
325
+ }
326
+ }
327
+ async flushLogs() {
328
+ if (!this.config.logs?.enabled || !this.config.licenseKey || this.logsQueue.length === 0) return;
329
+ const logsToSend = [
330
+ ...this.logsQueue
331
+ ];
332
+ this.logsQueue = [];
333
+ try {
334
+ // In a real implementation, send to New Relic's logs API
335
+ this.logger.debug(`Flushing ${logsToSend.length} logs to New Relic`);
336
+ } catch (error) {
337
+ this.logger.error('Failed to flush logs to New Relic', {
338
+ error: error.message
339
+ });
340
+ // Re-queue failed logs
341
+ this.logsQueue.unshift(...logsToSend);
342
+ }
343
+ }
344
+ startFlushing() {
345
+ this.flushInterval = setInterval(async ()=>{
346
+ await Promise.all([
347
+ this.flushMetrics(),
348
+ this.flushLogs()
349
+ ]);
350
+ }, 10000); // Flush every 10 seconds
351
+ }
352
+ // Shutdown
353
+ async shutdown() {
354
+ this.logger.info('Shutting down New Relic collector');
355
+ if (this.flushInterval) {
356
+ clearInterval(this.flushInterval);
357
+ }
358
+ // Flush any remaining data
359
+ await Promise.all([
360
+ this.flushMetrics(),
361
+ this.flushLogs()
362
+ ]);
363
+ // Clean up any remaining transactions and spans
364
+ for (const transactionId of this.activeTransactions.keys()){
365
+ this.finishTransaction(transactionId, {
366
+ 'shutdown': 'true'
367
+ });
368
+ }
369
+ for (const spanId of this.activeSpans.keys()){
370
+ this.finishSpan(spanId, {
371
+ 'shutdown': 'true'
372
+ });
373
+ }
374
+ this.logger.info('New Relic collector shutdown complete');
375
+ }
376
+ }
377
+ export function createNewRelicCollector(config = {}) {
378
+ return new NewRelicCollector({
379
+ enabled: true,
380
+ ...config
381
+ });
382
+ }
383
+
384
+ //# sourceMappingURL=newrelic-collector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/monitoring/apm/newrelic-collector.ts"],"names":["Logger","NewRelicCollector","config","logger","activeTransactions","Map","activeSpans","metricsQueue","logsQueue","flushInterval","appName","env","process","NODE_ENV","version","npm_package_version","tracing","enabled","distributedTracing","transactionEvents","spanEvents","metrics","apiHost","metricApiPath","logs","logApiPath","browserMonitoring","startFlushing","startTransaction","name","type","attributes","transactionId","generateId","transaction","startTime","Date","now","duration","set","finishTransaction","error","has","get","message","stack","sendTransaction","delete","startSpan","parentId","spanId","span","id","traceId","finishSpan","sendSpan","recordMetric","value","metric","timestamp","push","recordAgentOperation","agentType","operation","success","recordSwarmActivity","swarmSize","topology","recordWebSocketEvent","eventType","recordAPICall","method","route","statusCode","toString","recordCustomEvent","log","level","logEntry","toUpperCase","recordPerformanceMetric","getBrowserMonitoringScript","licenseKey","healthCheck","health","status","details","size","queuedMetrics","length","queuedLogs","lastFlush","queues","Math","random","substring","debug","flushMetrics","metricsToSend","unshift","flushLogs","logsToSend","setInterval","Promise","all","shutdown","info","clearInterval","keys","createNewRelicCollector"],"mappings":"AAAA;;;CAGC,GAED,SAASA,MAAM,QAAQ,wBAAwB;AAsE/C,OAAO,MAAMC;IACHC,OAAuB;IACvBC,OAAe;IACfC,qBAAuD,IAAIC,MAAM;IACjEC,cAAyC,IAAID,MAAM;IACnDE,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