claude-flow-novice 1.6.3 → 1.6.5

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 (290) hide show
  1. package/.claude/commands/parse-epic.js +180 -0
  2. package/.claude/settings.json +12 -2
  3. package/.claude/settings.local.json +4 -2
  4. package/.claude-flow-novice/dist/mcp/mcp-server-novice.js +37 -2
  5. package/.claude-flow-novice/dist/mcp/transports/base.js +5 -0
  6. package/.claude-flow-novice/dist/mcp/transports/base.js.map +1 -0
  7. package/.claude-flow-novice/dist/mcp/transports/http.js +414 -0
  8. package/.claude-flow-novice/dist/mcp/transports/http.js.map +1 -0
  9. package/.claude-flow-novice/dist/mcp/transports/stdio.js +217 -0
  10. package/.claude-flow-novice/dist/mcp/transports/stdio.js.map +1 -0
  11. package/.claude-flow-novice/dist/src/cli/commands/parse-epic.js +129 -0
  12. package/.claude-flow-novice/dist/src/cli/commands/parse-epic.js.map +1 -0
  13. package/.claude-flow-novice/dist/src/cli/index.js +3 -0
  14. package/.claude-flow-novice/dist/src/cli/index.js.map +1 -1
  15. package/.claude-flow-novice/dist/src/cli/utils/epic-parser.js +266 -0
  16. package/.claude-flow-novice/dist/src/cli/utils/epic-parser.js.map +1 -0
  17. package/.claude-flow-novice/dist/src/communication/message-bus.js +105 -2
  18. package/.claude-flow-novice/dist/src/communication/message-bus.js.map +1 -1
  19. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +1 -1
  20. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -1
  21. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/artifact-cache-optimizer.js +632 -0
  22. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/artifact-cache-optimizer.js.map +1 -0
  23. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/index.js +11 -0
  24. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/index.js.map +1 -0
  25. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/checkpoints/checkpoint-compressor.js +318 -0
  26. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/checkpoints/checkpoint-compressor.js.map +1 -0
  27. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/completion-detector.js +234 -0
  28. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/completion-detector.js.map +1 -0
  29. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/hierarchical-detector.js +347 -0
  30. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/hierarchical-detector.js.map +1 -0
  31. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/index.js +13 -0
  32. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/index.js.map +1 -0
  33. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/lamport-clock.js +173 -0
  34. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/lamport-clock.js.map +1 -0
  35. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/mesh-detector.js +526 -0
  36. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/mesh-detector.js.map +1 -0
  37. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/sdk-completion-detector.js +443 -0
  38. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/sdk-completion-detector.js.map +1 -0
  39. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/swarm-shutdown.js +366 -0
  40. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/swarm-shutdown.js.map +1 -0
  41. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinator-factory.js +287 -0
  42. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinator-factory.js.map +1 -0
  43. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.example.js +364 -0
  44. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.example.js.map +1 -0
  45. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.js +492 -0
  46. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.js.map +1 -0
  47. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/hierarchical-coordinator.js +786 -0
  48. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/hierarchical-coordinator.js.map +1 -0
  49. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/index.js +16 -0
  50. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/index.js.map +1 -0
  51. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/parent-child-manager.js +342 -0
  52. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/parent-child-manager.js.map +1 -0
  53. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/swarm-coordinator-v2.js +601 -0
  54. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
  55. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/agent-state.js +9 -0
  56. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/agent-state.js.map +1 -0
  57. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dead-letter-queue.js +413 -0
  58. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dead-letter-queue.js.map +1 -0
  59. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-graph.js +471 -0
  60. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-graph.js.map +1 -0
  61. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-node.js +379 -0
  62. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-node.js.map +1 -0
  63. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-resolver.js +335 -0
  64. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-resolver.js.map +1 -0
  65. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/help-request-metrics.js +211 -0
  66. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/help-request-metrics.js.map +1 -0
  67. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/index.js +33 -0
  68. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/index.js.map +1 -0
  69. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-broker.js +920 -0
  70. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-broker.js.map +1 -0
  71. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-router.js +385 -0
  72. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-router.js.map +1 -0
  73. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message.js +138 -0
  74. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message.js.map +1 -0
  75. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/resource-manager-safe.js +478 -0
  76. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/resource-manager-safe.js.map +1 -0
  77. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine-config.js +358 -0
  78. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine-config.js.map +1 -0
  79. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine.js +588 -0
  80. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine.js.map +1 -0
  81. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-transition.js +153 -0
  82. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-transition.js.map +1 -0
  83. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/task-scheduler.js +360 -0
  84. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/task-scheduler.js.map +1 -0
  85. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/topic-manager.js +337 -0
  86. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/topic-manager.js.map +1 -0
  87. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/deadlock-detector.js +424 -0
  88. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/deadlock-detector.js.map +1 -0
  89. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/index.js +9 -0
  90. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/index.js.map +1 -0
  91. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/resource-manager.js +669 -0
  92. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/resource-manager.js.map +1 -0
  93. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/artifact-storage.js +451 -0
  94. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/artifact-storage.js.map +1 -0
  95. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/cycle-detector.js +271 -0
  96. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/cycle-detector.js.map +1 -0
  97. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-graph.js +335 -0
  98. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-graph.js.map +1 -0
  99. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-manager.js +439 -0
  100. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-manager.js.map +1 -0
  101. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-request.js +92 -0
  102. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-request.js.map +1 -0
  103. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/index.js +21 -0
  104. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/index.js.map +1 -0
  105. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/topological-sort.js +223 -0
  106. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/topological-sort.js.map +1 -0
  107. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-coordinator.js +436 -0
  108. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-coordinator.js.map +1 -0
  109. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-matcher.js +278 -0
  110. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-matcher.js.map +1 -0
  111. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request-handler.js +317 -0
  112. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request-handler.js.map +1 -0
  113. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request.js +273 -0
  114. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request.js.map +1 -0
  115. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/index.js +15 -0
  116. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/index.js.map +1 -0
  117. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/waiting-agent-pool.js +512 -0
  118. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/waiting-agent-pool.js.map +1 -0
  119. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/index.js +67 -0
  120. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/index.js.map +1 -0
  121. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/help-deadlock-integration.js +557 -0
  122. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/help-deadlock-integration.js.map +1 -0
  123. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/index.js +14 -0
  124. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/index.js.map +1 -0
  125. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.example.js +212 -0
  126. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.example.js.map +1 -0
  127. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.js +552 -0
  128. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.js.map +1 -0
  129. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/state-machine-integration.js +635 -0
  130. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/state-machine-integration.js.map +1 -0
  131. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/IArtifactStorage.js +28 -0
  132. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/IArtifactStorage.js.map +1 -0
  133. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ICoordinator.js +9 -0
  134. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ICoordinator.js.map +1 -0
  135. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ISessionStore.js +25 -0
  136. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ISessionStore.js.map +1 -0
  137. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/index.js +14 -0
  138. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/index.js.map +1 -0
  139. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/artifact-adapter.js +308 -0
  140. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/artifact-adapter.js.map +1 -0
  141. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/completion-storage.js +439 -0
  142. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/completion-storage.js.map +1 -0
  143. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-graph-storage.js +540 -0
  144. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-graph-storage.js.map +1 -0
  145. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-storage.js +367 -0
  146. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-storage.js.map +1 -0
  147. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/index.js +14 -0
  148. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/index.js.map +1 -0
  149. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/message-storage.js +518 -0
  150. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/message-storage.js.map +1 -0
  151. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/state-storage.js +377 -0
  152. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/state-storage.js.map +1 -0
  153. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channel.js +371 -0
  154. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channel.js.map +1 -0
  155. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/dependency-channel.js +355 -0
  156. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/dependency-channel.js.map +1 -0
  157. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/help-channel.js +424 -0
  158. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/help-channel.js.map +1 -0
  159. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/index.js +16 -0
  160. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/index.js.map +1 -0
  161. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/state-channel.js +295 -0
  162. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/state-channel.js.map +1 -0
  163. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/task-channel.js +411 -0
  164. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/task-channel.js.map +1 -0
  165. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/index.js +14 -0
  166. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/index.js.map +1 -0
  167. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-bus.js +387 -0
  168. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-bus.js.map +1 -0
  169. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-persistence.js +589 -0
  170. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-persistence.js.map +1 -0
  171. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-router.js +444 -0
  172. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-router.js.map +1 -0
  173. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/artifact-storage.js +560 -0
  174. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/artifact-storage.js.map +1 -0
  175. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/background-orchestrator.js +335 -0
  176. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/background-orchestrator.js.map +1 -0
  177. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/bash-output-monitor.js +104 -0
  178. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/bash-output-monitor.js.map +1 -0
  179. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/checkpoint-manager.js +847 -0
  180. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/checkpoint-manager.js.map +1 -0
  181. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/help-coordinator.js +470 -0
  182. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/help-coordinator.js.map +1 -0
  183. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/hierarchical-background-integration.js +450 -0
  184. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/hierarchical-background-integration.js.map +1 -0
  185. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/index.js +13 -0
  186. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/index.js.map +1 -0
  187. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/message-bus-integration.js +625 -0
  188. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/message-bus-integration.js.map +1 -0
  189. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/multi-level-control.js +545 -0
  190. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/multi-level-control.js.map +1 -0
  191. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-controller.js +740 -0
  192. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-controller.js.map +1 -0
  193. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-message-integration.js +415 -0
  194. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-message-integration.js.map +1 -0
  195. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/session-pool-optimizer.js +615 -0
  196. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/session-pool-optimizer.js.map +1 -0
  197. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-machine-integration.js +547 -0
  198. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-machine-integration.js.map +1 -0
  199. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-sdk-integration.js +342 -0
  200. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-sdk-integration.js.map +1 -0
  201. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/security/payload-validator.js +259 -0
  202. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/security/payload-validator.js.map +1 -0
  203. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/framework-registry.js +273 -0
  204. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/framework-registry.js.map +1 -0
  205. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/index.js +8 -0
  206. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/index.js.map +1 -0
  207. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-config-manager.js +310 -0
  208. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-config-manager.js.map +1 -0
  209. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-validator.js +218 -0
  210. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-validator.js.map +1 -0
  211. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/types/sdk.js +9 -0
  212. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/types/sdk.js.map +1 -0
  213. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/index.js +6 -0
  214. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/index.js.map +1 -0
  215. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/priority-queue.js +145 -0
  216. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/priority-queue.js.map +1 -0
  217. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/sdk-helpers.js +122 -0
  218. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/sdk-helpers.js.map +1 -0
  219. package/.claude-flow-novice/dist/src/coordination/config-translator.js +17 -43
  220. package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -1
  221. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +34 -76
  222. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -1
  223. package/.claude-flow-novice/dist/src/coordination/index.js +3 -0
  224. package/.claude-flow-novice/dist/src/coordination/index.js.map +1 -1
  225. package/.claude-flow-novice/dist/src/coordination/shared/core/agent-state.js +172 -0
  226. package/.claude-flow-novice/dist/src/coordination/shared/core/agent-state.js.map +1 -0
  227. package/.claude-flow-novice/dist/src/coordination/shared/core/index.js +7 -0
  228. package/.claude-flow-novice/dist/src/coordination/shared/core/index.js.map +1 -0
  229. package/.claude-flow-novice/dist/src/coordination/shared/index.js +19 -0
  230. package/.claude-flow-novice/dist/src/coordination/shared/index.js.map +1 -0
  231. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js +24 -0
  232. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js.map +1 -0
  233. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js +7 -0
  234. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js.map +1 -0
  235. package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js +920 -0
  236. package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js.map +1 -0
  237. package/.claude-flow-novice/dist/src/coordination/shared/message.js +138 -0
  238. package/.claude-flow-novice/dist/src/coordination/shared/message.js.map +1 -0
  239. package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js +259 -0
  240. package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js.map +1 -0
  241. package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js +17 -0
  242. package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js.map +1 -0
  243. package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js +19 -0
  244. package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js.map +1 -0
  245. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js +357 -0
  246. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js.map +1 -0
  247. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js +679 -0
  248. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js.map +1 -0
  249. package/.claude-flow-novice/dist/src/coordination/shared/types/index.js +7 -0
  250. package/.claude-flow-novice/dist/src/coordination/shared/types/index.js.map +1 -0
  251. package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js +10 -0
  252. package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js.map +1 -0
  253. package/.claude-flow-novice/dist/src/coordination/v1-transparency/interfaces/v1-transparency-system.js +12 -0
  254. package/.claude-flow-novice/dist/src/coordination/v1-transparency/interfaces/v1-transparency-system.js.map +1 -0
  255. package/.claude-flow-novice/dist/src/coordination/v1-transparency/v1-to-v2-bridge.js +433 -0
  256. package/.claude-flow-novice/dist/src/coordination/v1-transparency/v1-to-v2-bridge.js.map +1 -0
  257. package/.claude-flow-novice/dist/src/coordination/v1-transparency/v1-transparency-adapter.js +1468 -0
  258. package/.claude-flow-novice/dist/src/coordination/v1-transparency/v1-transparency-adapter.js.map +1 -0
  259. package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js +52 -2
  260. package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js.map +1 -1
  261. package/.claude-flow-novice/dist/src/mcp/mcp-server-novice.js +37 -2
  262. package/.claude-flow-novice/dist/src/mcp/session-manager.js +3 -1
  263. package/.claude-flow-novice/dist/src/mcp/session-manager.js.map +1 -1
  264. package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js +5 -0
  265. package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js.map +1 -1
  266. package/.claude-flow-novice/dist/src/providers/provider-manager.js +41 -6
  267. package/.claude-flow-novice/dist/src/providers/provider-manager.js.map +1 -1
  268. package/.claude-flow-novice/dist/src/providers/tiered-router.js +9 -17
  269. package/.claude-flow-novice/dist/src/providers/tiered-router.js.map +1 -1
  270. package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js +65 -41
  271. package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js.map +1 -1
  272. package/.claude-flow-novice/dist/src/web/api/server.js +1 -1
  273. package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -1
  274. package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js +30 -0
  275. package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js.map +1 -1
  276. package/.claude-flow-novice/metrics.db +0 -0
  277. package/.claude-flow-novice/metrics.db-shm +0 -0
  278. package/.claude-flow-novice/metrics.db-wal +0 -0
  279. package/CLAUDE.md +72 -0
  280. package/config/hooks/post-edit-pipeline.js +68 -118
  281. package/config/hooks/pre-tool-memory-safety.js +209 -0
  282. package/package.json +7 -4
  283. package/scripts/cleanup-idle-sessions.sh +59 -0
  284. package/scripts/monitoring/alert-monitor.sh +220 -0
  285. package/scripts/monitoring/view-alerts.sh +307 -0
  286. package/scripts/test-provider-routing.cjs +7 -9
  287. package/scripts/test-zai-api.cjs +2 -2
  288. package/src/slash-commands/parse-epic.js +1 -1
  289. package/wiki/Provider-Routing.md +57 -69
  290. package/MEMORY_LEAK_ROOT_CAUSE.md +0 -149
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "claude-flow-novice",
3
- "version": "1.6.3",
4
- "description": "Standalone Claude Flow for beginners - AI agent orchestration made easy with enhanced TDD testing pipeline. Enhanced init command creates complete agent system, MCP configuration with 30 essential tools, and automated hooks with single-file testing, real-time coverage analysis, and advanced validation. Fully standalone with zero external dependencies, complete project setup in one command.",
3
+ "version": "1.6.5",
4
+ "description": "Standalone Claude Flow for beginners - AI agent orchestration made easy with enhanced TDD testing pipeline, memory safety protection, and automated hooks. Enhanced init command creates complete agent system, MCP configuration with 30 essential tools, and automated hooks with single-file testing, real-time coverage analysis, and advanced validation. Features memory leak prevention for WSL/Windows environments and pre-tool safety validation. Fully standalone with zero external dependencies, complete project setup in one command.",
5
5
  "mcpName": "io.github.ruvnet/claude-flow",
6
6
  "main": ".claude-flow-novice/dist/index.js",
7
7
  "bin": {
@@ -10,7 +10,8 @@
10
10
  "swarm": ".claude/commands/swarm.js",
11
11
  "sparc": ".claude/commands/sparc.js",
12
12
  "hooks": ".claude/commands/hooks.js",
13
- "enhanced-hooks": ".claude-flow-novice/dist/src/hooks/enhanced-hooks-cli.js"
13
+ "enhanced-hooks": ".claude-flow-novice/dist/src/hooks/enhanced-hooks-cli.js",
14
+ "memory-safety": "config/hooks/pre-tool-memory-safety.js"
14
15
  },
15
16
  "scripts": {
16
17
  "claude-soul": "node src/slash-commands/claude-soul.js",
@@ -18,6 +19,8 @@
18
19
  "sparc": "node .claude/commands/sparc.js",
19
20
  "hooks": "node .claude/commands/hooks.js",
20
21
  "enhanced-hooks": "node .claude-flow-novice/dist/src/hooks/enhanced-hooks-cli.js",
22
+ "memory-safety": "node config/hooks/pre-tool-memory-safety.js",
23
+ "check:memory": "node config/hooks/pre-tool-memory-safety.js",
21
24
  "neural": "node .claude/commands/neural.js",
22
25
  "performance": "node .claude/commands/performance.js",
23
26
  "github": "node .claude/commands/github.js",
@@ -269,6 +272,7 @@
269
272
  "helmet": "^7.2.0",
270
273
  "inquirer": "^12.9.6",
271
274
  "isomorphic-dompurify": "^2.28.0",
275
+ "jsdom": "^27.0.0",
272
276
  "jsonwebtoken": "^9.0.2",
273
277
  "limiter": "^3.0.0",
274
278
  "lru-cache": "^11.2.2",
@@ -313,7 +317,6 @@
313
317
  "eslint-plugin-react": "^7.37.5",
314
318
  "express": "^5.1.0",
315
319
  "jest": "^29.7.0",
316
- "jsdom": "^27.0.0",
317
320
  "node-fetch": "^3.3.2",
318
321
  "prettier": "^3.1.1",
319
322
  "socket.io-client": "^4.8.1",
@@ -0,0 +1,59 @@
1
+ #!/bin/bash
2
+ # Cleanup Idle Claude Sessions
3
+ # Kills Claude processes with 0% CPU (idle/orphaned) older than 30 minutes
4
+ # Safe for automated execution - preserves active sessions
5
+
6
+ set -e
7
+
8
+ LOGFILE="${HOME}/.claude-flow/logs/session-cleanup.log"
9
+ mkdir -p "$(dirname "$LOGFILE")"
10
+
11
+ log() {
12
+ echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" | tee -a "$LOGFILE"
13
+ }
14
+
15
+ log "=== Starting Idle Session Cleanup ==="
16
+
17
+ # Get list of idle Claude sessions (0% CPU), excluding this script and bash processes
18
+ IDLE_PIDS=$(ps -eo pid,%cpu,etime,cmd | grep claude | grep -v grep | grep -v "cleanup-idle-sessions" | grep -v "^[[:space:]]*[0-9]*[[:space:]]*0.0.*bash" | awk '$2 == 0.0 {print $1}' || true)
19
+
20
+ if [ -z "$IDLE_PIDS" ]; then
21
+ log "No idle sessions found. All sessions active."
22
+ exit 0
23
+ fi
24
+
25
+ # Count idle sessions
26
+ IDLE_COUNT=$(echo "$IDLE_PIDS" | wc -l)
27
+ log "Found $IDLE_COUNT idle Claude session(s)"
28
+
29
+ # Get memory before cleanup
30
+ BEFORE_MEM=$(ps aux | grep -E '(claude|node)' | grep -v grep | grep -v snapfuse | awk '{sum+=$6} END {printf "%.1f", sum/1024/1024}')
31
+ log "Memory before cleanup: ${BEFORE_MEM}GB"
32
+
33
+ # Kill idle sessions
34
+ for PID in $IDLE_PIDS; do
35
+ # Get process details before killing
36
+ DETAILS=$(ps -eo pid,etime,cputime,%cpu,%mem,rss,cmd | grep "^${PID}" | head -1 || echo "N/A")
37
+ log "Killing idle session: $DETAILS"
38
+
39
+ kill -9 "$PID" 2>/dev/null || log " Warning: Could not kill PID $PID (already terminated?)"
40
+ done
41
+
42
+ # Wait for processes to terminate
43
+ sleep 2
44
+
45
+ # Get memory after cleanup
46
+ AFTER_MEM=$(ps aux | grep -E '(claude|node)' | grep -v grep | grep -v snapfuse | awk '{sum+=$6} END {printf "%.1f", sum/1024/1024}')
47
+ FREED_MEM=$(echo "$BEFORE_MEM - $AFTER_MEM" | bc)
48
+ log "Memory after cleanup: ${AFTER_MEM}GB"
49
+ log "Memory freed: ${FREED_MEM}GB"
50
+
51
+ # Get remaining active sessions
52
+ ACTIVE_COUNT=$(ps aux | grep claude | grep -v grep | wc -l)
53
+ log "Active sessions remaining: $ACTIVE_COUNT"
54
+
55
+ log "=== Cleanup Complete ==="
56
+ log ""
57
+
58
+ # Return summary
59
+ echo "{\"idle_killed\": $IDLE_COUNT, \"active_remaining\": $ACTIVE_COUNT, \"memory_freed_gb\": $FREED_MEM}"
@@ -0,0 +1,220 @@
1
+ #!/usr/bin/env bash
2
+ # scripts/monitoring/alert-monitor.sh - Continuous monitoring daemon with alerting
3
+ # Phase 1 Sprint 1.1: Monitoring loop integration
4
+
5
+ set -euo pipefail
6
+
7
+ # ==============================================================================
8
+ # CONFIGURATION
9
+ # ==============================================================================
10
+
11
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
+ LIB_DIR="${SCRIPT_DIR}/../../lib"
13
+ METRICS_FILE="${METRICS_FILE:-/dev/shm/cfn-metrics.jsonl}"
14
+ ALERT_LOG_FILE="${ALERT_LOG_FILE:-/dev/shm/cfn-alerts.jsonl}"
15
+ MONITOR_PID_FILE="${MONITOR_PID_FILE:-/dev/shm/alert-monitor.pid}"
16
+
17
+ # Check interval (seconds)
18
+ CHECK_INTERVAL="${CHECK_INTERVAL:-30}"
19
+
20
+ # Cleanup retention (hours)
21
+ ALERT_RETENTION_HOURS="${ALERT_RETENTION_HOURS:-24}"
22
+ METRICS_RETENTION_HOURS="${METRICS_RETENTION_HOURS:-48}"
23
+
24
+ # ==============================================================================
25
+ # DEPENDENCIES
26
+ # ==============================================================================
27
+
28
+ # Source alerting library
29
+ if [ -f "$LIB_DIR/alerting.sh" ]; then
30
+ # shellcheck source=../../lib/alerting.sh
31
+ source "$LIB_DIR/alerting.sh"
32
+ else
33
+ echo "[ERROR] Alerting library not found at $LIB_DIR/alerting.sh" >&2
34
+ exit 1
35
+ fi
36
+
37
+ # ==============================================================================
38
+ # SIGNAL HANDLERS
39
+ # ==============================================================================
40
+
41
+ cleanup() {
42
+ echo "[INFO] Shutting down alert monitor (PID: $$)" >&2
43
+ rm -f "$MONITOR_PID_FILE"
44
+ exit 0
45
+ }
46
+
47
+ trap cleanup SIGTERM SIGINT
48
+
49
+ # ==============================================================================
50
+ # MONITORING FUNCTIONS
51
+ # ==============================================================================
52
+
53
+ # start_monitor - Begin continuous threshold monitoring
54
+ start_monitor() {
55
+ local iteration=0
56
+
57
+ echo "[INFO] Alert monitor started (PID: $$)" >&2
58
+ echo "[INFO] Check interval: ${CHECK_INTERVAL}s" >&2
59
+ echo "[INFO] Metrics file: $METRICS_FILE" >&2
60
+ echo "[INFO] Alert log: $ALERT_LOG_FILE" >&2
61
+
62
+ # Write PID file
63
+ echo $$ > "$MONITOR_PID_FILE"
64
+
65
+ while true; do
66
+ iteration=$((iteration + 1))
67
+
68
+ # Check thresholds
69
+ if [ -f "$METRICS_FILE" ]; then
70
+ check_thresholds "$METRICS_FILE" 2>&1 | while IFS= read -r line; do
71
+ echo "[$(date -u +"%Y-%m-%dT%H:%M:%SZ")] $line"
72
+ done
73
+ fi
74
+
75
+ # Periodic cleanup (every 100 iterations)
76
+ if [ $((iteration % 100)) -eq 0 ]; then
77
+ echo "[INFO] Running periodic cleanup (iteration $iteration)" >&2
78
+ cleanup_old_data
79
+ fi
80
+
81
+ # Sleep until next check
82
+ sleep "$CHECK_INTERVAL"
83
+ done
84
+ }
85
+
86
+ # cleanup_old_data - Remove old metrics and alerts
87
+ cleanup_old_data() {
88
+ # Clear old alerts
89
+ if [ -f "$ALERT_LOG_FILE" ]; then
90
+ local alert_count_before
91
+ alert_count_before=$(wc -l < "$ALERT_LOG_FILE" 2>/dev/null || echo "0")
92
+
93
+ clear_old_alerts "$ALERT_RETENTION_HOURS"
94
+
95
+ local alert_count_after
96
+ alert_count_after=$(wc -l < "$ALERT_LOG_FILE" 2>/dev/null || echo "0")
97
+
98
+ echo "[INFO] Cleared $((alert_count_before - alert_count_after)) old alerts" >&2
99
+ fi
100
+
101
+ # Clear old metrics
102
+ if [ -f "$METRICS_FILE" ]; then
103
+ local metrics_count_before
104
+ metrics_count_before=$(wc -l < "$METRICS_FILE" 2>/dev/null || echo "0")
105
+
106
+ local cutoff_time
107
+ cutoff_time=$(date -u -d "$METRICS_RETENTION_HOURS hours ago" +"%Y-%m-%dT%H:%M:%S" 2>/dev/null || \
108
+ date -u -v-"${METRICS_RETENTION_HOURS}H" +"%Y-%m-%dT%H:%M:%S" 2>/dev/null || \
109
+ echo "1970-01-01T00:00:00")
110
+
111
+ local temp_file="${METRICS_FILE}.tmp"
112
+ jq -c --arg cutoff "$cutoff_time" \
113
+ 'select(.timestamp >= $cutoff)' \
114
+ "$METRICS_FILE" > "$temp_file" 2>/dev/null || true
115
+
116
+ if [ -f "$temp_file" ]; then
117
+ mv "$temp_file" "$METRICS_FILE"
118
+
119
+ local metrics_count_after
120
+ metrics_count_after=$(wc -l < "$METRICS_FILE" 2>/dev/null || echo "0")
121
+
122
+ echo "[INFO] Cleared $((metrics_count_before - metrics_count_after)) old metrics" >&2
123
+ fi
124
+ fi
125
+ }
126
+
127
+ # get_monitor_status - Check if monitor is running
128
+ get_monitor_status() {
129
+ if [ -f "$MONITOR_PID_FILE" ]; then
130
+ local pid
131
+ pid=$(cat "$MONITOR_PID_FILE")
132
+
133
+ if kill -0 "$pid" 2>/dev/null; then
134
+ echo "running (PID: $pid)"
135
+ return 0
136
+ else
137
+ echo "stale (PID file exists but process not running)"
138
+ rm -f "$MONITOR_PID_FILE"
139
+ return 1
140
+ fi
141
+ else
142
+ echo "stopped"
143
+ return 1
144
+ fi
145
+ }
146
+
147
+ # stop_monitor - Stop running monitor
148
+ stop_monitor() {
149
+ if [ -f "$MONITOR_PID_FILE" ]; then
150
+ local pid
151
+ pid=$(cat "$MONITOR_PID_FILE")
152
+
153
+ if kill -0 "$pid" 2>/dev/null; then
154
+ echo "[INFO] Stopping monitor (PID: $pid)" >&2
155
+ kill -TERM "$pid"
156
+
157
+ # Wait for graceful shutdown (max 5 seconds)
158
+ for i in {1..10}; do
159
+ if ! kill -0 "$pid" 2>/dev/null; then
160
+ echo "[INFO] Monitor stopped successfully" >&2
161
+ return 0
162
+ fi
163
+ sleep 0.5
164
+ done
165
+
166
+ # Force kill if still running
167
+ if kill -0 "$pid" 2>/dev/null; then
168
+ echo "[WARN] Monitor did not stop gracefully, forcing..." >&2
169
+ kill -KILL "$pid" 2>/dev/null || true
170
+ fi
171
+ fi
172
+
173
+ rm -f "$MONITOR_PID_FILE"
174
+ else
175
+ echo "[INFO] No monitor running" >&2
176
+ fi
177
+ }
178
+
179
+ # ==============================================================================
180
+ # MAIN EXECUTION
181
+ # ==============================================================================
182
+
183
+ case "${1:-start}" in
184
+ start)
185
+ if [ -f "$MONITOR_PID_FILE" ]; then
186
+ echo "[ERROR] Monitor already running (PID: $(cat "$MONITOR_PID_FILE"))" >&2
187
+ exit 1
188
+ fi
189
+ start_monitor
190
+ ;;
191
+
192
+ stop)
193
+ stop_monitor
194
+ ;;
195
+
196
+ restart)
197
+ stop_monitor
198
+ sleep 1
199
+ start_monitor
200
+ ;;
201
+
202
+ status)
203
+ get_monitor_status
204
+ ;;
205
+
206
+ background)
207
+ # Start in background
208
+ if [ -f "$MONITOR_PID_FILE" ]; then
209
+ echo "[ERROR] Monitor already running (PID: $(cat "$MONITOR_PID_FILE"))" >&2
210
+ exit 1
211
+ fi
212
+ nohup "$0" start > /dev/shm/alert-monitor.log 2>&1 &
213
+ echo "[INFO] Monitor started in background (PID: $!)" >&2
214
+ ;;
215
+
216
+ *)
217
+ echo "Usage: $0 {start|stop|restart|status|background}" >&2
218
+ exit 1
219
+ ;;
220
+ esac
@@ -0,0 +1,307 @@
1
+ #!/usr/bin/env bash
2
+ # scripts/monitoring/view-alerts.sh - Real-time alert visualization dashboard
3
+ # Phase 1 Sprint 1.1: Alert dashboard
4
+
5
+ set -euo pipefail
6
+
7
+ # ==============================================================================
8
+ # CONFIGURATION
9
+ # ==============================================================================
10
+
11
+ ALERT_LOG_FILE="${ALERT_LOG_FILE:-/dev/shm/cfn-alerts.jsonl}"
12
+ REFRESH_INTERVAL="${REFRESH_INTERVAL:-1}" # Seconds
13
+
14
+ # ==============================================================================
15
+ # DISPLAY FUNCTIONS
16
+ # ==============================================================================
17
+
18
+ # format_alert - Convert alert JSON to human-readable format
19
+ format_alert() {
20
+ local line="$1"
21
+
22
+ # Parse JSON fields
23
+ local timestamp alert_type message severity
24
+
25
+ timestamp=$(echo "$line" | jq -r '.timestamp // "unknown"' 2>/dev/null || echo "unknown")
26
+ alert_type=$(echo "$line" | jq -r '.alert // "unknown"' 2>/dev/null || echo "unknown")
27
+ message=$(echo "$line" | jq -r '.message // "no message"' 2>/dev/null || echo "no message")
28
+ severity=$(echo "$line" | jq -r '.severity // "info"' 2>/dev/null || echo "info")
29
+
30
+ # Format timestamp (remove milliseconds for readability)
31
+ local display_time
32
+ display_time=$(echo "$timestamp" | cut -d'.' -f1 | sed 's/T/ /')
33
+
34
+ # Color-code based on severity
35
+ local color_code reset_code
36
+ reset_code="\033[0m"
37
+
38
+ case "$severity" in
39
+ critical)
40
+ color_code="\033[1;31m" # Bright red
41
+ ;;
42
+ warning)
43
+ color_code="\033[1;33m" # Bright yellow
44
+ ;;
45
+ info)
46
+ color_code="\033[1;36m" # Bright cyan
47
+ ;;
48
+ *)
49
+ color_code="\033[0m" # Default
50
+ ;;
51
+ esac
52
+
53
+ # Format output: [timestamp] [severity] alert_type: message
54
+ echo -e "${color_code}[${display_time}] [${severity^^}] ${alert_type}: ${message}${reset_code}"
55
+ }
56
+
57
+ # show_alert_summary - Display alert statistics
58
+ show_alert_summary() {
59
+ local time_window="${1:-60}" # Minutes
60
+
61
+ echo ""
62
+ echo "=========================================="
63
+ echo "ALERT SUMMARY (Last ${time_window} minutes)"
64
+ echo "=========================================="
65
+
66
+ if [ ! -f "$ALERT_LOG_FILE" ]; then
67
+ echo "No alerts found."
68
+ return
69
+ fi
70
+
71
+ # Get cutoff time
72
+ local cutoff_time
73
+ cutoff_time=$(date -u -d "$time_window minutes ago" +"%Y-%m-%dT%H:%M:%S" 2>/dev/null || \
74
+ date -u -v-"${time_window}M" +"%Y-%m-%dT%H:%M:%S" 2>/dev/null || \
75
+ echo "1970-01-01T00:00:00")
76
+
77
+ # Calculate statistics
78
+ local total_alerts critical_count warning_count info_count
79
+
80
+ total_alerts=$(jq -c --arg cutoff "$cutoff_time" \
81
+ 'select(.timestamp >= $cutoff)' \
82
+ "$ALERT_LOG_FILE" 2>/dev/null | wc -l)
83
+
84
+ critical_count=$(jq -c --arg cutoff "$cutoff_time" \
85
+ 'select(.timestamp >= $cutoff and .severity == "critical")' \
86
+ "$ALERT_LOG_FILE" 2>/dev/null | wc -l)
87
+
88
+ warning_count=$(jq -c --arg cutoff "$cutoff_time" \
89
+ 'select(.timestamp >= $cutoff and .severity == "warning")' \
90
+ "$ALERT_LOG_FILE" 2>/dev/null | wc -l)
91
+
92
+ info_count=$(jq -c --arg cutoff "$cutoff_time" \
93
+ 'select(.timestamp >= $cutoff and .severity == "info")' \
94
+ "$ALERT_LOG_FILE" 2>/dev/null | wc -l)
95
+
96
+ echo "Total Alerts: $total_alerts"
97
+ echo -e " \033[1;31mCritical: $critical_count\033[0m"
98
+ echo -e " \033[1;33mWarning: $warning_count\033[0m"
99
+ echo -e " \033[1;36mInfo: $info_count\033[0m"
100
+
101
+ # Show top alert types
102
+ echo ""
103
+ echo "Top Alert Types:"
104
+ jq -c --arg cutoff "$cutoff_time" \
105
+ 'select(.timestamp >= $cutoff) | .alert' \
106
+ "$ALERT_LOG_FILE" 2>/dev/null | \
107
+ sort | uniq -c | sort -rn | head -5 | \
108
+ awk '{printf " %s: %d\n", $2, $1}'
109
+
110
+ echo "=========================================="
111
+ echo ""
112
+ }
113
+
114
+ # tail_alerts - Live alert stream (like tail -f)
115
+ tail_alerts() {
116
+ echo "[INFO] Watching for alerts (Ctrl+C to exit)..."
117
+ echo ""
118
+
119
+ # Show recent alerts first
120
+ if [ -f "$ALERT_LOG_FILE" ]; then
121
+ tail -n 10 "$ALERT_LOG_FILE" | while IFS= read -r line; do
122
+ format_alert "$line"
123
+ done
124
+ fi
125
+
126
+ # Follow new alerts
127
+ tail -f "$ALERT_LOG_FILE" 2>/dev/null | while IFS= read -r line; do
128
+ format_alert "$line"
129
+ done
130
+ }
131
+
132
+ # show_recent_alerts - Display N most recent alerts
133
+ show_recent_alerts() {
134
+ local count="${1:-20}"
135
+
136
+ if [ ! -f "$ALERT_LOG_FILE" ]; then
137
+ echo "No alerts found."
138
+ return
139
+ fi
140
+
141
+ echo "=========================================="
142
+ echo "Recent Alerts (Last $count)"
143
+ echo "=========================================="
144
+ echo ""
145
+
146
+ tail -n "$count" "$ALERT_LOG_FILE" | while IFS= read -r line; do
147
+ format_alert "$line"
148
+ done
149
+
150
+ echo ""
151
+ }
152
+
153
+ # filter_alerts - Show alerts matching criteria
154
+ filter_alerts() {
155
+ local filter_type="${1:-}"
156
+ local filter_value="${2:-}"
157
+
158
+ if [ -z "$filter_type" ]; then
159
+ echo "Usage: $0 filter <severity|alert|time> <value>" >&2
160
+ exit 1
161
+ fi
162
+
163
+ if [ ! -f "$ALERT_LOG_FILE" ]; then
164
+ echo "No alerts found."
165
+ return
166
+ fi
167
+
168
+ case "$filter_type" in
169
+ severity)
170
+ jq -c --arg sev "$filter_value" \
171
+ 'select(.severity == $sev)' \
172
+ "$ALERT_LOG_FILE" | while IFS= read -r line; do
173
+ format_alert "$line"
174
+ done
175
+ ;;
176
+
177
+ alert)
178
+ jq -c --arg alert "$filter_value" \
179
+ 'select(.alert == $alert)' \
180
+ "$ALERT_LOG_FILE" | while IFS= read -r line; do
181
+ format_alert "$line"
182
+ done
183
+ ;;
184
+
185
+ time)
186
+ # Filter by time range (e.g., "10m", "1h", "30s")
187
+ local minutes
188
+ case "$filter_value" in
189
+ *m) minutes="${filter_value%m}" ;;
190
+ *h) minutes=$((${filter_value%h} * 60)) ;;
191
+ *s) minutes=$((${filter_value%s} / 60)) ;;
192
+ *) minutes="$filter_value" ;;
193
+ esac
194
+
195
+ local cutoff_time
196
+ cutoff_time=$(date -u -d "$minutes minutes ago" +"%Y-%m-%dT%H:%M:%S" 2>/dev/null || \
197
+ date -u -v-"${minutes}M" +"%Y-%m-%dT%H:%M:%S" 2>/dev/null || \
198
+ echo "1970-01-01T00:00:00")
199
+
200
+ jq -c --arg cutoff "$cutoff_time" \
201
+ 'select(.timestamp >= $cutoff)' \
202
+ "$ALERT_LOG_FILE" | while IFS= read -r line; do
203
+ format_alert "$line"
204
+ done
205
+ ;;
206
+
207
+ *)
208
+ echo "[ERROR] Unknown filter type: $filter_type" >&2
209
+ echo "Valid types: severity, alert, time" >&2
210
+ exit 1
211
+ ;;
212
+ esac
213
+ }
214
+
215
+ # interactive_dashboard - Real-time updating dashboard
216
+ interactive_dashboard() {
217
+ while true; do
218
+ clear
219
+ echo "╔═══════════════════════════════════════════════════════════╗"
220
+ echo "║ CLAUDE FLOW NOVICE - ALERT DASHBOARD ║"
221
+ echo "╚═══════════════════════════════════════════════════════════╝"
222
+ echo ""
223
+
224
+ show_alert_summary 60
225
+
226
+ echo ""
227
+ echo "Recent Alerts (Last 10):"
228
+ echo "----------------------------------------"
229
+
230
+ if [ -f "$ALERT_LOG_FILE" ]; then
231
+ tail -n 10 "$ALERT_LOG_FILE" | while IFS= read -r line; do
232
+ format_alert "$line"
233
+ done
234
+ else
235
+ echo "No alerts yet."
236
+ fi
237
+
238
+ echo ""
239
+ echo "Press Ctrl+C to exit | Refreshing every ${REFRESH_INTERVAL}s..."
240
+
241
+ sleep "$REFRESH_INTERVAL"
242
+ done
243
+ }
244
+
245
+ # ==============================================================================
246
+ # MAIN EXECUTION
247
+ # ==============================================================================
248
+
249
+ case "${1:-tail}" in
250
+ tail)
251
+ tail_alerts
252
+ ;;
253
+
254
+ recent)
255
+ show_recent_alerts "${2:-20}"
256
+ ;;
257
+
258
+ summary)
259
+ show_alert_summary "${2:-60}"
260
+ ;;
261
+
262
+ filter)
263
+ filter_alerts "${2:-}" "${3:-}"
264
+ ;;
265
+
266
+ dashboard)
267
+ interactive_dashboard
268
+ ;;
269
+
270
+ help)
271
+ cat << EOF
272
+ Alert Viewer - Real-time alert monitoring and visualization
273
+
274
+ Usage: $0 <command> [options]
275
+
276
+ Commands:
277
+ tail Live alert stream (default)
278
+ recent [N] Show N most recent alerts (default: 20)
279
+ summary [M] Show alert statistics for last M minutes (default: 60)
280
+ filter <type> <value>
281
+ Filter alerts by severity, alert type, or time
282
+ Examples:
283
+ $0 filter severity critical
284
+ $0 filter alert coordination_time_exceeded
285
+ $0 filter time 30m
286
+ dashboard Interactive real-time dashboard
287
+ help Show this help message
288
+
289
+ Environment Variables:
290
+ ALERT_LOG_FILE Path to alert log (default: /dev/shm/cfn-alerts.jsonl)
291
+ REFRESH_INTERVAL Dashboard refresh rate in seconds (default: 1)
292
+
293
+ Examples:
294
+ $0 tail # Live alert stream
295
+ $0 recent 50 # Last 50 alerts
296
+ $0 summary 120 # Stats for last 2 hours
297
+ $0 filter severity critical # Show only critical alerts
298
+ $0 dashboard # Interactive dashboard
299
+ EOF
300
+ ;;
301
+
302
+ *)
303
+ echo "Unknown command: $1" >&2
304
+ echo "Run '$0 help' for usage information" >&2
305
+ exit 1
306
+ ;;
307
+ esac
@@ -107,8 +107,8 @@ if (fs.existsSync(routerPath)) {
107
107
 
108
108
  if (hasTiers && hasZai) {
109
109
  console.log(' ✅ Agents will route through tiered system:\n');
110
- console.log(' Tier 1: coordinator/architect/system-architect → Anthropic');
111
- console.log(' Tier 2: All other agents → Z.ai\n');
110
+ console.log(' Tier 0: Main chat → Anthropic Claude Max');
111
+ console.log(' Tier 1: ALL Task tool agents → Z.ai\n');
112
112
  }
113
113
  } else {
114
114
  console.log(' ⚠️ Compiled router not found (run npm run build)\n');
@@ -208,16 +208,14 @@ console.log('═'.repeat(80) + '\n');
208
208
  console.log('📊 Configuration Summary\n');
209
209
 
210
210
  console.log('✅ WORKING AS DESIGNED:\n');
211
- console.log(' 1. Main Chat Z.ai (via global settings after restart)');
212
- console.log(' 2. Tier 1 Agents Anthropic (coordinator/architect/system-architect)');
213
- console.log(' 3. Tier 2 Agents Z.ai (all other agents)');
214
- console.log(' 4. Agent SDK → Anthropic (hardcoded, no alternative)');
211
+ console.log(' 1. Main Chat Anthropic Claude Max (default routing)');
212
+ console.log(' 2. ALL Task Tool Agents Z.ai (coder, tester, reviewer, backend-dev, etc.)');
213
+ console.log(' 3. Agent SDK Anthropic (hardcoded, no alternative)');
215
214
  console.log();
216
215
 
217
216
  console.log('💰 COST OPTIMIZATION:\n');
218
- console.log(' • Main chat uses Z.ai (lowest cost)');
219
- console.log(' • Worker agents use Z.ai (bulk operations)');
220
- console.log(' • Strategic agents use Anthropic (quality-critical)');
217
+ console.log(' • Main chat uses Claude Max subscription (highest quality)');
218
+ console.log(' • ALL Task tool agents use Z.ai (cost-effective bulk operations)');
221
219
  console.log(' • Agent SDK provides 90% cost savings via caching\n');
222
220
 
223
221
  console.log('🔍 VERIFICATION:\n');
@@ -69,9 +69,9 @@ async function testZaiAPI() {
69
69
  if (!API_KEY) {
70
70
  console.error('❌ ERROR: Z_AI_API_KEY or ZAI_API_KEY environment variable not set');
71
71
  console.log('\nPlease set your Z.ai API key:');
72
- console.log(' export ZAI_API_KEY="your-api-key-here"');
72
+ console.log(' export ZAI_API_KEY=$YOUR_KEY');
73
73
  console.log(' or');
74
- console.log(' ZAI_API_KEY="your-api-key-here" node scripts/test-zai-api.cjs\n');
74
+ console.log(' ZAI_API_KEY=$YOUR_KEY node scripts/test-zai-api.cjs\n');
75
75
  process.exit(1);
76
76
  }
77
77
 
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import { SlashCommand } from '../core/slash-command.js';
15
- import { EpicParser } from '../parsers/epic-parser.js';
15
+ import { EpicParser } from '../parsers/epic-parser.ts';
16
16
  import * as path from 'path';
17
17
  import * as fs from 'fs';
18
18