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,450 @@
1
+ /**
2
+ * Status API Routes
3
+ *
4
+ * REST API endpoints for agent status monitoring and real-time information
5
+ *
6
+ * @module web/api/routes/status
7
+ */ import { Router } from 'express';
8
+ import { asyncHandler } from '../middleware/error-handler.js';
9
+ import { validationMiddleware, commonSchemas } from '../middleware/validation.js';
10
+ /**
11
+ * Create status routes
12
+ */ export function statusRoutes(transparencySystem, logger) {
13
+ const router = Router();
14
+ /**
15
+ * GET /api/v1/status
16
+ * Get all agent statuses
17
+ */ router.get('/', validationMiddleware({
18
+ query: {
19
+ ...commonSchemas.pagination,
20
+ ...commonSchemas.stateFilter
21
+ }
22
+ }), asyncHandler(async (req, res)=>{
23
+ const { page = 1, limit = 20, sort = 'lastHeartbeat', order = 'desc', state } = req.query;
24
+ logger.info('Getting all agent statuses', {
25
+ page,
26
+ limit,
27
+ sort,
28
+ order,
29
+ state
30
+ });
31
+ let statuses = await transparencySystem.getAllAgentStatuses();
32
+ // Apply state filter
33
+ if (state) {
34
+ statuses = statuses.filter((status)=>status.state === state);
35
+ }
36
+ // Apply sorting
37
+ statuses = sortStatuses(statuses, sort, order);
38
+ // Apply pagination
39
+ const startIndex = (page - 1) * limit;
40
+ const endIndex = startIndex + limit;
41
+ const paginatedStatuses = statuses.slice(startIndex, endIndex);
42
+ res.json({
43
+ data: paginatedStatuses,
44
+ pagination: {
45
+ page,
46
+ limit,
47
+ total: statuses.length,
48
+ pages: Math.ceil(statuses.length / limit)
49
+ },
50
+ meta: {
51
+ sort,
52
+ order,
53
+ filters: {
54
+ state
55
+ },
56
+ timestamp: new Date().toISOString()
57
+ }
58
+ });
59
+ }));
60
+ /**
61
+ * GET /api/v1/status/agent/:agentId
62
+ * Get specific agent status
63
+ */ router.get('/agent/:agentId', validationMiddleware({
64
+ params: commonSchemas.agentIdParam
65
+ }), asyncHandler(async (req, res)=>{
66
+ const { agentId } = req.params;
67
+ logger.info(`Getting status for agent ${agentId}`);
68
+ try {
69
+ const status = await transparencySystem.getAgentStatus(agentId);
70
+ res.json({
71
+ data: status,
72
+ meta: {
73
+ timestamp: new Date().toISOString()
74
+ }
75
+ });
76
+ } catch (error) {
77
+ res.status(404).json({
78
+ error: 'NOT_FOUND',
79
+ message: `Agent ${agentId} not found`,
80
+ timestamp: new Date().toISOString()
81
+ });
82
+ }
83
+ }));
84
+ /**
85
+ * GET /api/v1/status/active
86
+ * Get currently active agents
87
+ */ router.get('/active', validationMiddleware({
88
+ query: commonSchemas.pagination
89
+ }), asyncHandler(async (req, res)=>{
90
+ const { page = 1, limit = 20 } = req.query;
91
+ logger.info('Getting active agents');
92
+ const activeAgents = await transparencySystem.getActiveAgents();
93
+ // Apply pagination
94
+ const startIndex = (page - 1) * limit;
95
+ const endIndex = startIndex + limit;
96
+ const paginatedAgents = activeAgents.slice(startIndex, endIndex);
97
+ res.json({
98
+ data: paginatedAgents,
99
+ pagination: {
100
+ page,
101
+ limit,
102
+ total: activeAgents.length,
103
+ pages: Math.ceil(activeAgents.length / limit)
104
+ },
105
+ meta: {
106
+ timestamp: new Date().toISOString()
107
+ }
108
+ });
109
+ }));
110
+ /**
111
+ * GET /api/v1/status/paused
112
+ * Get currently paused agents
113
+ */ router.get('/paused', validationMiddleware({
114
+ query: commonSchemas.pagination
115
+ }), asyncHandler(async (req, res)=>{
116
+ const { page = 1, limit = 20 } = req.query;
117
+ logger.info('Getting paused agents');
118
+ const pausedAgents = await transparencySystem.getPausedAgents();
119
+ // Apply pagination
120
+ const startIndex = (page - 1) * limit;
121
+ const endIndex = startIndex + limit;
122
+ const paginatedAgents = pausedAgents.slice(startIndex, endIndex);
123
+ res.json({
124
+ data: paginatedAgents,
125
+ pagination: {
126
+ page,
127
+ limit,
128
+ total: pausedAgents.length,
129
+ pages: Math.ceil(pausedAgents.length / limit)
130
+ },
131
+ meta: {
132
+ timestamp: new Date().toISOString()
133
+ }
134
+ });
135
+ }));
136
+ /**
137
+ * GET /api/v1/status/summary
138
+ * Get status summary statistics
139
+ */ router.get('/summary', asyncHandler(async (req, res)=>{
140
+ logger.info('Getting status summary');
141
+ const allStatuses = await transparencySystem.getAllAgentStatuses();
142
+ const summary = calculateStatusSummary(allStatuses);
143
+ res.json({
144
+ data: summary,
145
+ meta: {
146
+ timestamp: new Date().toISOString()
147
+ }
148
+ });
149
+ }));
150
+ /**
151
+ * GET /api/v1/status/errors
152
+ * Get agents with recent errors
153
+ */ router.get('/errors', validationMiddleware({
154
+ query: {
155
+ ...commonSchemas.pagination,
156
+ severity: {
157
+ type: 'string',
158
+ enum: [
159
+ 'warning',
160
+ 'error',
161
+ 'critical'
162
+ ],
163
+ description: 'Error severity filter'
164
+ }
165
+ }
166
+ }), asyncHandler(async (req, res)=>{
167
+ const { page = 1, limit = 20, severity } = req.query;
168
+ logger.info('Getting agents with errors', {
169
+ severity
170
+ });
171
+ const allStatuses = await transparencySystem.getAllAgentStatuses();
172
+ const agentsWithErrors = allStatuses.filter((status)=>{
173
+ if (!status.recentErrors || status.recentErrors.length === 0) {
174
+ return false;
175
+ }
176
+ if (severity) {
177
+ return status.recentErrors.some((error)=>error.severity === severity);
178
+ }
179
+ return true;
180
+ });
181
+ // Sort by most recent error
182
+ agentsWithErrors.sort((a, b)=>{
183
+ const aLatestError = a.recentErrors[0];
184
+ const bLatestError = b.recentErrors[0];
185
+ return bLatestError.timestamp.getTime() - aLatestError.timestamp.getTime();
186
+ });
187
+ // Apply pagination
188
+ const startIndex = (page - 1) * limit;
189
+ const endIndex = startIndex + limit;
190
+ const paginatedAgents = agentsWithErrors.slice(startIndex, endIndex);
191
+ res.json({
192
+ data: paginatedAgents,
193
+ pagination: {
194
+ page,
195
+ limit,
196
+ total: agentsWithErrors.length,
197
+ pages: Math.ceil(agentsWithErrors.length / limit)
198
+ },
199
+ meta: {
200
+ severity,
201
+ timestamp: new Date().toISOString()
202
+ }
203
+ });
204
+ }));
205
+ /**
206
+ * GET /api/v1/status/performance
207
+ * Get performance metrics for all agents
208
+ */ router.get('/performance', validationMiddleware({
209
+ query: {
210
+ ...commonSchemas.pagination,
211
+ sortBy: {
212
+ type: 'string',
213
+ enum: [
214
+ 'tokenUsageRate',
215
+ 'memoryUsage',
216
+ 'cpuUsage',
217
+ 'progress'
218
+ ],
219
+ default: 'tokenUsageRate',
220
+ description: 'Performance metric to sort by'
221
+ },
222
+ threshold: {
223
+ type: 'number',
224
+ minimum: 0,
225
+ maximum: 100,
226
+ description: 'Performance threshold filter'
227
+ }
228
+ }
229
+ }), asyncHandler(async (req, res)=>{
230
+ const { page = 1, limit = 20, sortBy = 'tokenUsageRate', threshold } = req.query;
231
+ logger.info('Getting agent performance metrics', {
232
+ sortBy,
233
+ threshold
234
+ });
235
+ const allStatuses = await transparencySystem.getAllAgentStatuses();
236
+ // Apply threshold filter if specified
237
+ let filteredStatuses = allStatuses;
238
+ if (threshold !== undefined) {
239
+ filteredStatuses = allStatuses.filter((status)=>{
240
+ switch(sortBy){
241
+ case 'tokenUsageRate':
242
+ return status.tokenUsageRate >= threshold;
243
+ case 'memoryUsage':
244
+ return status.memoryUsage / (1024 * 1024) >= threshold; // Convert to MB
245
+ case 'cpuUsage':
246
+ return status.cpuUsage >= threshold;
247
+ case 'progress':
248
+ return status.progress >= threshold;
249
+ default:
250
+ return true;
251
+ }
252
+ });
253
+ }
254
+ // Sort by performance metric
255
+ filteredStatuses.sort((a, b)=>{
256
+ const aValue = getPerformanceMetric(a, sortBy);
257
+ const bValue = getPerformanceMetric(b, sortBy);
258
+ return bValue - aValue; // Descending order
259
+ });
260
+ // Apply pagination
261
+ const startIndex = (page - 1) * limit;
262
+ const endIndex = startIndex + limit;
263
+ const paginatedAgents = filteredStatuses.slice(startIndex, endIndex);
264
+ res.json({
265
+ data: paginatedAgents,
266
+ pagination: {
267
+ page,
268
+ limit,
269
+ total: filteredStatuses.length,
270
+ pages: Math.ceil(filteredStatuses.length / limit)
271
+ },
272
+ meta: {
273
+ sortBy,
274
+ threshold,
275
+ timestamp: new Date().toISOString()
276
+ }
277
+ });
278
+ }));
279
+ /**
280
+ * GET /api/v1/status/heartbeat
281
+ * Get recent heartbeat information
282
+ */ router.get('/heartbeat', validationMiddleware({
283
+ query: {
284
+ staleMinutes: {
285
+ type: 'integer',
286
+ minimum: 1,
287
+ maximum: 60,
288
+ default: 5,
289
+ description: 'Minutes since last heartbeat to consider stale'
290
+ }
291
+ }
292
+ }), asyncHandler(async (req, res)=>{
293
+ const { staleMinutes = 5 } = req.query;
294
+ logger.info('Getting heartbeat information', {
295
+ staleMinutes
296
+ });
297
+ const allStatuses = await transparencySystem.getAllAgentStatuses();
298
+ const now = new Date();
299
+ const staleThreshold = staleMinutes * 60 * 1000; // Convert to milliseconds
300
+ const heartbeatInfo = allStatuses.map((status)=>{
301
+ const timeSinceLastHeartbeat = now.getTime() - status.lastHeartbeat.getTime();
302
+ const isStale = timeSinceLastHeartbeat > staleThreshold;
303
+ return {
304
+ agentId: status.agentId,
305
+ lastHeartbeat: status.lastHeartbeat,
306
+ timeSinceLastHeartbeatMs: timeSinceLastHeartbeat,
307
+ isStale,
308
+ status: isStale ? 'stale' : 'healthy'
309
+ };
310
+ });
311
+ // Sort by most recent heartbeat
312
+ heartbeatInfo.sort((a, b)=>a.timeSinceLastHeartbeatMs - b.timeSinceLastHeartbeatMs);
313
+ res.json({
314
+ data: heartbeatInfo,
315
+ meta: {
316
+ staleThresholdMinutes: staleMinutes,
317
+ totalAgents: allStatuses.length,
318
+ staleAgents: heartbeatInfo.filter((info)=>info.isStale).length,
319
+ timestamp: new Date().toISOString()
320
+ }
321
+ });
322
+ }));
323
+ return router;
324
+ }
325
+ /**
326
+ * Sort agent statuses by specified field
327
+ */ function sortStatuses(statuses, sortBy, order) {
328
+ const sorted = [
329
+ ...statuses
330
+ ].sort((a, b)=>{
331
+ let aValue, bValue;
332
+ switch(sortBy){
333
+ case 'agentId':
334
+ aValue = a.agentId;
335
+ bValue = b.agentId;
336
+ break;
337
+ case 'state':
338
+ aValue = a.state;
339
+ bValue = b.state;
340
+ break;
341
+ case 'activity':
342
+ aValue = a.activity;
343
+ bValue = b.activity;
344
+ break;
345
+ case 'progress':
346
+ aValue = a.progress;
347
+ bValue = b.progress;
348
+ break;
349
+ case 'tokensUsed':
350
+ aValue = a.tokensUsed;
351
+ bValue = b.tokensUsed;
352
+ break;
353
+ case 'tokenUsageRate':
354
+ aValue = a.tokenUsageRate;
355
+ bValue = b.tokenUsageRate;
356
+ break;
357
+ case 'memoryUsage':
358
+ aValue = a.memoryUsage;
359
+ bValue = b.memoryUsage;
360
+ break;
361
+ case 'cpuUsage':
362
+ aValue = a.cpuUsage;
363
+ bValue = b.cpuUsage;
364
+ break;
365
+ case 'lastHeartbeat':
366
+ aValue = a.lastHeartbeat.getTime();
367
+ bValue = b.lastHeartbeat.getTime();
368
+ break;
369
+ default:
370
+ aValue = a.agentId;
371
+ bValue = b.agentId;
372
+ }
373
+ if (typeof aValue === 'string') {
374
+ return order === 'asc' ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
375
+ }
376
+ return order === 'asc' ? aValue - bValue : bValue - aValue;
377
+ });
378
+ return sorted;
379
+ }
380
+ /**
381
+ * Calculate status summary statistics
382
+ */ function calculateStatusSummary(statuses) {
383
+ const summary = {
384
+ totalAgents: statuses.length,
385
+ agentsByState: {},
386
+ agentsByActivity: {},
387
+ totalTokensUsed: 0,
388
+ averageTokenUsageRate: 0,
389
+ totalMemoryUsage: 0,
390
+ averageCpuUsage: 0,
391
+ averageProgress: 0,
392
+ activeAgents: 0,
393
+ pausedAgents: 0,
394
+ agentsWithErrors: 0,
395
+ totalErrors: 0
396
+ };
397
+ let totalTokenUsageRate = 0;
398
+ let totalCpuUsage = 0;
399
+ let totalProgress = 0;
400
+ statuses.forEach((status)=>{
401
+ // Count by state
402
+ summary.agentsByState[status.state] = (summary.agentsByState[status.state] || 0) + 1;
403
+ // Count by activity
404
+ summary.agentsByActivity[status.activity] = (summary.agentsByActivity[status.activity] || 0) + 1;
405
+ // Token metrics
406
+ summary.totalTokensUsed += status.tokensUsed;
407
+ totalTokenUsageRate += status.tokenUsageRate;
408
+ // Performance metrics
409
+ summary.totalMemoryUsage += status.memoryUsage;
410
+ totalCpuUsage += status.cpuUsage;
411
+ totalProgress += status.progress;
412
+ // Agent status counts
413
+ if (!status.isPaused && status.state !== 'terminated') {
414
+ summary.activeAgents++;
415
+ }
416
+ if (status.isPaused) {
417
+ summary.pausedAgents++;
418
+ }
419
+ // Error metrics
420
+ if (status.recentErrors && status.recentErrors.length > 0) {
421
+ summary.agentsWithErrors++;
422
+ summary.totalErrors += status.recentErrors.length;
423
+ }
424
+ });
425
+ // Calculate averages
426
+ summary.averageTokenUsageRate = statuses.length > 0 ? totalTokenUsageRate / statuses.length : 0;
427
+ summary.averageCpuUsage = statuses.length > 0 ? totalCpuUsage / statuses.length : 0;
428
+ summary.averageProgress = statuses.length > 0 ? totalProgress / statuses.length : 0;
429
+ return summary;
430
+ }
431
+ /**
432
+ * Get specific performance metric from agent status
433
+ */ function getPerformanceMetric(status, metric) {
434
+ switch(metric){
435
+ case 'tokenUsageRate':
436
+ return status.tokenUsageRate;
437
+ case 'memoryUsage':
438
+ return status.memoryUsage;
439
+ case 'cpuUsage':
440
+ return status.cpuUsage;
441
+ case 'progress':
442
+ return status.progress;
443
+ case 'tokensUsed':
444
+ return status.tokensUsed;
445
+ default:
446
+ return 0;
447
+ }
448
+ }
449
+
450
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/web/api/routes/status.ts"],"names":["Router","asyncHandler","validationMiddleware","commonSchemas","statusRoutes","transparencySystem","logger","router","get","query","pagination","stateFilter","req","res","page","limit","sort","order","state","info","statuses","getAllAgentStatuses","filter","status","sortStatuses","startIndex","endIndex","paginatedStatuses","slice","json","data","total","length","pages","Math","ceil","meta","filters","timestamp","Date","toISOString","params","agentIdParam","agentId","getAgentStatus","error","message","activeAgents","getActiveAgents","paginatedAgents","pausedAgents","getPausedAgents","allStatuses","summary","calculateStatusSummary","severity","type","enum","description","agentsWithErrors","recentErrors","some","a","b","aLatestError","bLatestError","getTime","sortBy","default","threshold","minimum","maximum","filteredStatuses","undefined","tokenUsageRate","memoryUsage","cpuUsage","progress","aValue","getPerformanceMetric","bValue","staleMinutes","now","staleThreshold","heartbeatInfo","map","timeSinceLastHeartbeat","lastHeartbeat","isStale","timeSinceLastHeartbeatMs","staleThresholdMinutes","totalAgents","staleAgents","sorted","activity","tokensUsed","localeCompare","agentsByState","agentsByActivity","totalTokensUsed","averageTokenUsageRate","totalMemoryUsage","averageCpuUsage","averageProgress","totalErrors","totalTokenUsageRate","totalCpuUsage","totalProgress","forEach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