claude-flow-novice 1.6.4 → 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 (269) hide show
  1. package/.claude/commands/parse-epic.js +180 -0
  2. package/.claude/settings.local.json +2 -1
  3. package/.claude-flow-novice/dist/mcp/mcp-server-novice.js +37 -2
  4. package/.claude-flow-novice/dist/mcp/transports/base.js +5 -0
  5. package/.claude-flow-novice/dist/mcp/transports/base.js.map +1 -0
  6. package/.claude-flow-novice/dist/mcp/transports/http.js +414 -0
  7. package/.claude-flow-novice/dist/mcp/transports/http.js.map +1 -0
  8. package/.claude-flow-novice/dist/mcp/transports/stdio.js +217 -0
  9. package/.claude-flow-novice/dist/mcp/transports/stdio.js.map +1 -0
  10. package/.claude-flow-novice/dist/src/cli/commands/parse-epic.js +129 -0
  11. package/.claude-flow-novice/dist/src/cli/commands/parse-epic.js.map +1 -0
  12. package/.claude-flow-novice/dist/src/cli/index.js +3 -0
  13. package/.claude-flow-novice/dist/src/cli/index.js.map +1 -1
  14. package/.claude-flow-novice/dist/src/cli/utils/epic-parser.js +266 -0
  15. package/.claude-flow-novice/dist/src/cli/utils/epic-parser.js.map +1 -0
  16. package/.claude-flow-novice/dist/src/communication/message-bus.js +105 -2
  17. package/.claude-flow-novice/dist/src/communication/message-bus.js.map +1 -1
  18. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +1 -1
  19. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -1
  20. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/artifact-cache-optimizer.js +632 -0
  21. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/artifact-cache-optimizer.js.map +1 -0
  22. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/index.js +11 -0
  23. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/index.js.map +1 -0
  24. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/checkpoints/checkpoint-compressor.js +318 -0
  25. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/checkpoints/checkpoint-compressor.js.map +1 -0
  26. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/completion-detector.js +234 -0
  27. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/completion-detector.js.map +1 -0
  28. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/hierarchical-detector.js +347 -0
  29. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/hierarchical-detector.js.map +1 -0
  30. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/index.js +13 -0
  31. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/index.js.map +1 -0
  32. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/lamport-clock.js +173 -0
  33. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/lamport-clock.js.map +1 -0
  34. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/mesh-detector.js +526 -0
  35. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/mesh-detector.js.map +1 -0
  36. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/sdk-completion-detector.js +443 -0
  37. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/sdk-completion-detector.js.map +1 -0
  38. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/swarm-shutdown.js +366 -0
  39. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/swarm-shutdown.js.map +1 -0
  40. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinator-factory.js +287 -0
  41. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinator-factory.js.map +1 -0
  42. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.example.js +364 -0
  43. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.example.js.map +1 -0
  44. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.js +492 -0
  45. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.js.map +1 -0
  46. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/hierarchical-coordinator.js +786 -0
  47. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/hierarchical-coordinator.js.map +1 -0
  48. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/index.js +16 -0
  49. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/index.js.map +1 -0
  50. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/parent-child-manager.js +342 -0
  51. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/parent-child-manager.js.map +1 -0
  52. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/swarm-coordinator-v2.js +601 -0
  53. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
  54. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/agent-state.js +9 -0
  55. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/agent-state.js.map +1 -0
  56. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dead-letter-queue.js +413 -0
  57. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dead-letter-queue.js.map +1 -0
  58. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-graph.js +471 -0
  59. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-graph.js.map +1 -0
  60. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-node.js +379 -0
  61. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-node.js.map +1 -0
  62. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-resolver.js +335 -0
  63. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-resolver.js.map +1 -0
  64. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/help-request-metrics.js +211 -0
  65. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/help-request-metrics.js.map +1 -0
  66. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/index.js +33 -0
  67. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/index.js.map +1 -0
  68. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-broker.js +920 -0
  69. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-broker.js.map +1 -0
  70. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-router.js +385 -0
  71. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-router.js.map +1 -0
  72. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message.js +138 -0
  73. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message.js.map +1 -0
  74. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/resource-manager-safe.js +478 -0
  75. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/resource-manager-safe.js.map +1 -0
  76. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine-config.js +358 -0
  77. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine-config.js.map +1 -0
  78. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine.js +588 -0
  79. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine.js.map +1 -0
  80. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-transition.js +153 -0
  81. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-transition.js.map +1 -0
  82. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/task-scheduler.js +360 -0
  83. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/task-scheduler.js.map +1 -0
  84. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/topic-manager.js +337 -0
  85. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/topic-manager.js.map +1 -0
  86. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/deadlock-detector.js +424 -0
  87. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/deadlock-detector.js.map +1 -0
  88. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/index.js +9 -0
  89. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/index.js.map +1 -0
  90. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/resource-manager.js +669 -0
  91. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/resource-manager.js.map +1 -0
  92. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/artifact-storage.js +451 -0
  93. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/artifact-storage.js.map +1 -0
  94. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/cycle-detector.js +271 -0
  95. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/cycle-detector.js.map +1 -0
  96. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-graph.js +335 -0
  97. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-graph.js.map +1 -0
  98. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-manager.js +439 -0
  99. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-manager.js.map +1 -0
  100. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-request.js +92 -0
  101. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-request.js.map +1 -0
  102. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/index.js +21 -0
  103. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/index.js.map +1 -0
  104. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/topological-sort.js +223 -0
  105. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/topological-sort.js.map +1 -0
  106. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-coordinator.js +436 -0
  107. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-coordinator.js.map +1 -0
  108. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-matcher.js +278 -0
  109. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-matcher.js.map +1 -0
  110. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request-handler.js +317 -0
  111. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request-handler.js.map +1 -0
  112. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request.js +273 -0
  113. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request.js.map +1 -0
  114. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/index.js +15 -0
  115. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/index.js.map +1 -0
  116. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/waiting-agent-pool.js +512 -0
  117. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/waiting-agent-pool.js.map +1 -0
  118. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/index.js +67 -0
  119. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/index.js.map +1 -0
  120. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/help-deadlock-integration.js +557 -0
  121. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/help-deadlock-integration.js.map +1 -0
  122. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/index.js +14 -0
  123. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/index.js.map +1 -0
  124. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.example.js +212 -0
  125. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.example.js.map +1 -0
  126. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.js +552 -0
  127. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.js.map +1 -0
  128. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/state-machine-integration.js +635 -0
  129. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/state-machine-integration.js.map +1 -0
  130. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/IArtifactStorage.js +28 -0
  131. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/IArtifactStorage.js.map +1 -0
  132. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ICoordinator.js +9 -0
  133. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ICoordinator.js.map +1 -0
  134. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ISessionStore.js +25 -0
  135. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ISessionStore.js.map +1 -0
  136. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/index.js +14 -0
  137. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/index.js.map +1 -0
  138. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/artifact-adapter.js +308 -0
  139. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/artifact-adapter.js.map +1 -0
  140. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/completion-storage.js +439 -0
  141. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/completion-storage.js.map +1 -0
  142. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-graph-storage.js +540 -0
  143. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-graph-storage.js.map +1 -0
  144. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-storage.js +367 -0
  145. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-storage.js.map +1 -0
  146. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/index.js +14 -0
  147. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/index.js.map +1 -0
  148. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/message-storage.js +518 -0
  149. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/message-storage.js.map +1 -0
  150. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/state-storage.js +377 -0
  151. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/state-storage.js.map +1 -0
  152. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channel.js +371 -0
  153. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channel.js.map +1 -0
  154. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/dependency-channel.js +355 -0
  155. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/dependency-channel.js.map +1 -0
  156. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/help-channel.js +424 -0
  157. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/help-channel.js.map +1 -0
  158. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/index.js +16 -0
  159. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/index.js.map +1 -0
  160. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/state-channel.js +295 -0
  161. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/state-channel.js.map +1 -0
  162. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/task-channel.js +411 -0
  163. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/task-channel.js.map +1 -0
  164. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/index.js +14 -0
  165. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/index.js.map +1 -0
  166. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-bus.js +387 -0
  167. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-bus.js.map +1 -0
  168. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-persistence.js +589 -0
  169. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-persistence.js.map +1 -0
  170. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-router.js +444 -0
  171. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-router.js.map +1 -0
  172. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/artifact-storage.js +560 -0
  173. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/artifact-storage.js.map +1 -0
  174. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/background-orchestrator.js +335 -0
  175. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/background-orchestrator.js.map +1 -0
  176. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/bash-output-monitor.js +104 -0
  177. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/bash-output-monitor.js.map +1 -0
  178. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/checkpoint-manager.js +847 -0
  179. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/checkpoint-manager.js.map +1 -0
  180. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/help-coordinator.js +470 -0
  181. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/help-coordinator.js.map +1 -0
  182. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/hierarchical-background-integration.js +450 -0
  183. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/hierarchical-background-integration.js.map +1 -0
  184. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/index.js +13 -0
  185. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/index.js.map +1 -0
  186. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/message-bus-integration.js +625 -0
  187. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/message-bus-integration.js.map +1 -0
  188. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/multi-level-control.js +545 -0
  189. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/multi-level-control.js.map +1 -0
  190. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-controller.js +740 -0
  191. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-controller.js.map +1 -0
  192. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-message-integration.js +415 -0
  193. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-message-integration.js.map +1 -0
  194. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/session-pool-optimizer.js +615 -0
  195. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/session-pool-optimizer.js.map +1 -0
  196. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-machine-integration.js +547 -0
  197. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-machine-integration.js.map +1 -0
  198. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-sdk-integration.js +342 -0
  199. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-sdk-integration.js.map +1 -0
  200. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/security/payload-validator.js +259 -0
  201. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/security/payload-validator.js.map +1 -0
  202. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/framework-registry.js +273 -0
  203. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/framework-registry.js.map +1 -0
  204. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/index.js +8 -0
  205. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/index.js.map +1 -0
  206. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-config-manager.js +310 -0
  207. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-config-manager.js.map +1 -0
  208. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-validator.js +218 -0
  209. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-validator.js.map +1 -0
  210. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/types/sdk.js +9 -0
  211. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/types/sdk.js.map +1 -0
  212. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/index.js +6 -0
  213. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/index.js.map +1 -0
  214. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/priority-queue.js +145 -0
  215. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/priority-queue.js.map +1 -0
  216. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/sdk-helpers.js +122 -0
  217. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/sdk-helpers.js.map +1 -0
  218. package/.claude-flow-novice/dist/src/coordination/config-translator.js +17 -43
  219. package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -1
  220. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +34 -76
  221. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -1
  222. package/.claude-flow-novice/dist/src/coordination/shared/core/agent-state.js +172 -0
  223. package/.claude-flow-novice/dist/src/coordination/shared/core/agent-state.js.map +1 -0
  224. package/.claude-flow-novice/dist/src/coordination/shared/core/index.js +7 -0
  225. package/.claude-flow-novice/dist/src/coordination/shared/core/index.js.map +1 -0
  226. package/.claude-flow-novice/dist/src/coordination/shared/index.js +19 -0
  227. package/.claude-flow-novice/dist/src/coordination/shared/index.js.map +1 -0
  228. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js +24 -0
  229. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js.map +1 -0
  230. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js +7 -0
  231. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js.map +1 -0
  232. package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js +920 -0
  233. package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js.map +1 -0
  234. package/.claude-flow-novice/dist/src/coordination/shared/message.js +138 -0
  235. package/.claude-flow-novice/dist/src/coordination/shared/message.js.map +1 -0
  236. package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js +259 -0
  237. package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js.map +1 -0
  238. package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js +17 -0
  239. package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js.map +1 -0
  240. package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js +19 -0
  241. package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js.map +1 -0
  242. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js +357 -0
  243. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js.map +1 -0
  244. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js +679 -0
  245. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js.map +1 -0
  246. package/.claude-flow-novice/dist/src/coordination/shared/types/index.js +7 -0
  247. package/.claude-flow-novice/dist/src/coordination/shared/types/index.js.map +1 -0
  248. package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js +10 -0
  249. package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js.map +1 -0
  250. package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js +52 -2
  251. package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js.map +1 -1
  252. package/.claude-flow-novice/dist/src/mcp/mcp-server-novice.js +37 -2
  253. package/.claude-flow-novice/dist/src/mcp/session-manager.js +3 -1
  254. package/.claude-flow-novice/dist/src/mcp/session-manager.js.map +1 -1
  255. package/.claude-flow-novice/dist/src/providers/provider-manager.js +36 -3
  256. package/.claude-flow-novice/dist/src/providers/provider-manager.js.map +1 -1
  257. package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js +65 -41
  258. package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js.map +1 -1
  259. package/.claude-flow-novice/dist/src/web/api/server.js +1 -1
  260. package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -1
  261. package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js +30 -0
  262. package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js.map +1 -1
  263. package/.claude-flow-novice/metrics.db-shm +0 -0
  264. package/.claude-flow-novice/metrics.db-wal +0 -0
  265. package/package.json +2 -2
  266. package/scripts/monitoring/alert-monitor.sh +220 -0
  267. package/scripts/monitoring/view-alerts.sh +307 -0
  268. package/scripts/test-zai-api.cjs +2 -2
  269. package/src/slash-commands/parse-epic.js +1 -1
@@ -0,0 +1,444 @@
1
+ /**
2
+ * Agent Coordination V2 - Message Router (Channel-Based)
3
+ *
4
+ * Priority queue-based message router for channel abstraction.
5
+ * Routes messages to channels with fairness guarantees and ordering preservation.
6
+ *
7
+ * Features:
8
+ * - Priority queue routing (high priority messages delivered first)
9
+ * - Channel-based isolation (4 specialized channels)
10
+ * - Fairness guarantees (prevent channel starvation)
11
+ * - Message ordering per channel (FIFO within channel)
12
+ * - Backpressure coordination across channels
13
+ *
14
+ * @module coordination/v2/messaging/message-router
15
+ */ import { PriorityQueue } from '../utils/priority-queue.js';
16
+ import { Channel, BackpressurePolicy } from './channel.js';
17
+ import { EventEmitter } from 'events';
18
+ /**
19
+ * Channel type enumeration.
20
+ * Defines the 4 specialized channels for agent coordination.
21
+ */ export var ChannelType = /*#__PURE__*/ function(ChannelType) {
22
+ /** Coordination messages (agent status, lifecycle) */ ChannelType["COORDINATION"] = "coordination";
23
+ /** Task execution messages (task assignment, completion) */ ChannelType["TASK"] = "task";
24
+ /** Help system messages (help requests, matches) */ ChannelType["HELP"] = "help";
25
+ /** Event notifications (system events, alerts) */ ChannelType["EVENT"] = "event";
26
+ return ChannelType;
27
+ }({});
28
+ /**
29
+ * Router events.
30
+ */ export var RouterEvent = /*#__PURE__*/ function(RouterEvent) {
31
+ /** Message routed to channel */ RouterEvent["MESSAGE_ROUTED"] = "message-routed";
32
+ /** Message dropped (no matching route) */ RouterEvent["MESSAGE_DROPPED"] = "message-dropped";
33
+ /** Backpressure threshold exceeded */ RouterEvent["BACKPRESSURE"] = "backpressure";
34
+ /** Router error */ RouterEvent["ERROR"] = "error";
35
+ return RouterEvent;
36
+ }({});
37
+ /**
38
+ * MessageRouter - Priority queue routing with channel isolation.
39
+ *
40
+ * Routes messages to specialized channels based on topic patterns,
41
+ * with priority queue ordering and fairness guarantees to prevent
42
+ * channel starvation.
43
+ *
44
+ * Architecture:
45
+ * - Global priority queue (all incoming messages)
46
+ * - 4 specialized channels (coordination, task, help, event)
47
+ * - Round-robin fairness scheduler
48
+ * - Per-channel FIFO ordering
49
+ *
50
+ * Performance:
51
+ * - route(): O(log n) for priority queue + O(1) channel lookup
52
+ * - processQueue(): O(k * q) where k = channel count, q = fairness quantum
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * const router = new MessageRouter({
57
+ * enableFairness: true,
58
+ * fairnessQuantum: 10
59
+ * });
60
+ *
61
+ * // Route messages
62
+ * router.route({
63
+ * id: 'msg-1',
64
+ * topic: 'agent.status',
65
+ * payload: { agentId: 'agent-1', status: 'online' },
66
+ * priority: 5,
67
+ * timestamp: Date.now()
68
+ * });
69
+ *
70
+ * // Process router queue
71
+ * await router.processQueue();
72
+ * ```
73
+ */ export class MessageRouter extends EventEmitter {
74
+ /** Configuration */ config;
75
+ /** Priority queue for incoming messages */ incomingQueue;
76
+ /** Channel instances by type */ channels;
77
+ /** Routing rules (pattern -> channel type) */ routingRules;
78
+ /** Statistics tracking */ stats;
79
+ /** Fairness scheduler state (last channel processed) */ fairnessState;
80
+ /** Processing lock */ isProcessing;
81
+ constructor(config = {}){
82
+ super();
83
+ this.config = {
84
+ channels: config.channels ?? {},
85
+ customRules: config.customRules ?? [],
86
+ enableFairness: config.enableFairness ?? true,
87
+ fairnessQuantum: config.fairnessQuantum ?? 10,
88
+ maxPendingMessages: config.maxPendingMessages ?? 5000
89
+ };
90
+ this.incomingQueue = new PriorityQueue();
91
+ this.channels = new Map();
92
+ this.routingRules = [];
93
+ this.isProcessing = false;
94
+ this.stats = {
95
+ totalRouted: 0,
96
+ totalDropped: 0,
97
+ messagesByChannel: new Map(),
98
+ routingLatencies: []
99
+ };
100
+ this.fairnessState = {
101
+ lastChannelIndex: -1,
102
+ channelOrder: [
103
+ "coordination",
104
+ "task",
105
+ "help",
106
+ "event"
107
+ ]
108
+ };
109
+ this.initializeChannels();
110
+ this.initializeRoutingRules();
111
+ }
112
+ /**
113
+ * Initialize the 4 specialized channels.
114
+ */ initializeChannels() {
115
+ // Coordination channel (agent status, lifecycle)
116
+ this.channels.set("coordination", new Channel({
117
+ channelId: 'coordination',
118
+ name: 'Coordination Channel',
119
+ capacity: 1000,
120
+ backpressurePolicy: BackpressurePolicy.DROP_OLDEST,
121
+ priority: 8,
122
+ ...this.config.channels["coordination"]
123
+ }));
124
+ // Task channel (task execution, completion)
125
+ this.channels.set("task", new Channel({
126
+ channelId: 'task',
127
+ name: 'Task Channel',
128
+ capacity: 2000,
129
+ backpressurePolicy: BackpressurePolicy.DROP_OLDEST,
130
+ priority: 7,
131
+ ...this.config.channels["task"]
132
+ }));
133
+ // Help channel (help requests, matching)
134
+ this.channels.set("help", new Channel({
135
+ channelId: 'help',
136
+ name: 'Help Channel',
137
+ capacity: 500,
138
+ backpressurePolicy: BackpressurePolicy.DROP_NEWEST,
139
+ priority: 9,
140
+ ...this.config.channels["help"]
141
+ }));
142
+ // Event channel (notifications, alerts)
143
+ this.channels.set("event", new Channel({
144
+ channelId: 'event',
145
+ name: 'Event Channel',
146
+ capacity: 1500,
147
+ backpressurePolicy: BackpressurePolicy.DROP_OLDEST,
148
+ priority: 5,
149
+ ...this.config.channels["event"]
150
+ }));
151
+ }
152
+ /**
153
+ * Initialize default routing rules.
154
+ */ initializeRoutingRules() {
155
+ // Add custom rules first (higher priority)
156
+ this.routingRules.push(...this.config.customRules);
157
+ // Default routing rules (pattern matching)
158
+ const defaultRules = [
159
+ // Coordination patterns
160
+ {
161
+ pattern: 'agent.*',
162
+ channelType: "coordination",
163
+ priority: 100
164
+ },
165
+ {
166
+ pattern: 'coordinator.*',
167
+ channelType: "coordination",
168
+ priority: 100
169
+ },
170
+ {
171
+ pattern: 'session.*',
172
+ channelType: "coordination",
173
+ priority: 100
174
+ },
175
+ // Task patterns
176
+ {
177
+ pattern: 'task.*',
178
+ channelType: "task",
179
+ priority: 90
180
+ },
181
+ {
182
+ pattern: 'job.*',
183
+ channelType: "task",
184
+ priority: 90
185
+ },
186
+ {
187
+ pattern: 'execution.*',
188
+ channelType: "task",
189
+ priority: 90
190
+ },
191
+ // Help patterns
192
+ {
193
+ pattern: 'help.*',
194
+ channelType: "help",
195
+ priority: 95
196
+ },
197
+ {
198
+ pattern: 'assistance.*',
199
+ channelType: "help",
200
+ priority: 95
201
+ },
202
+ // Event patterns (catch-all)
203
+ {
204
+ pattern: '*',
205
+ channelType: "event",
206
+ priority: 0
207
+ }
208
+ ];
209
+ this.routingRules.push(...defaultRules);
210
+ // Sort by priority (highest first)
211
+ this.routingRules.sort((a, b)=>b.priority - a.priority);
212
+ }
213
+ /**
214
+ * Route a message to appropriate channel.
215
+ *
216
+ * @param message - Message to route
217
+ *
218
+ * @example
219
+ * ```typescript
220
+ * router.route({
221
+ * id: 'msg-1',
222
+ * topic: 'task.completed',
223
+ * payload: { taskId: 'task-1', result: 'success' },
224
+ * priority: 5,
225
+ * timestamp: Date.now()
226
+ * });
227
+ * ```
228
+ */ route(message) {
229
+ // Check backpressure threshold
230
+ if (this.incomingQueue.size() >= this.config.maxPendingMessages) {
231
+ this.stats.totalDropped++;
232
+ this.emit("backpressure", {
233
+ pendingMessages: this.incomingQueue.size(),
234
+ maxPending: this.config.maxPendingMessages,
235
+ droppedMessageId: message.id
236
+ });
237
+ return;
238
+ }
239
+ // Add to priority queue
240
+ this.incomingQueue.enqueue(message, message.priority);
241
+ // Auto-process if not already processing
242
+ if (!this.isProcessing) {
243
+ setImmediate(()=>this.processQueue());
244
+ }
245
+ }
246
+ /**
247
+ * Process incoming message queue and route to channels.
248
+ *
249
+ * @returns Number of messages routed
250
+ */ async processQueue() {
251
+ if (this.isProcessing) {
252
+ return 0;
253
+ }
254
+ this.isProcessing = true;
255
+ let routedCount = 0;
256
+ try {
257
+ // Route all pending messages
258
+ while(!this.incomingQueue.isEmpty()){
259
+ const message = this.incomingQueue.dequeue();
260
+ if (!message) break;
261
+ const startTime = performance.now();
262
+ // Find matching channel
263
+ const channelType = this.findChannelForMessage(message);
264
+ if (!channelType) {
265
+ // No matching rule - drop message
266
+ this.stats.totalDropped++;
267
+ this.emit("message-dropped", {
268
+ messageId: message.id,
269
+ topic: message.topic,
270
+ reason: 'no-matching-route'
271
+ });
272
+ continue;
273
+ }
274
+ // Route to channel
275
+ const channel = this.channels.get(channelType);
276
+ if (channel) {
277
+ channel.publish(message);
278
+ routedCount++;
279
+ // Update statistics
280
+ this.stats.totalRouted++;
281
+ this.stats.messagesByChannel.set(channelType, (this.stats.messagesByChannel.get(channelType) ?? 0) + 1);
282
+ const latency = performance.now() - startTime;
283
+ this.stats.routingLatencies.push(latency);
284
+ // Keep only last 1000 latencies
285
+ if (this.stats.routingLatencies.length > 1000) {
286
+ this.stats.routingLatencies.shift();
287
+ }
288
+ this.emit("message-routed", {
289
+ messageId: message.id,
290
+ topic: message.topic,
291
+ channelType,
292
+ latencyMs: latency
293
+ });
294
+ }
295
+ }
296
+ // Process channels with fairness guarantees
297
+ if (this.config.enableFairness) {
298
+ await this.processFairScheduler();
299
+ } else {
300
+ // Process all channels in priority order
301
+ await this.processAllChannels();
302
+ }
303
+ } finally{
304
+ this.isProcessing = false;
305
+ }
306
+ return routedCount;
307
+ }
308
+ /**
309
+ * Find appropriate channel for message based on routing rules.
310
+ *
311
+ * @param message - Message to route
312
+ * @returns Channel type or null if no match
313
+ */ findChannelForMessage(message) {
314
+ for (const rule of this.routingRules){
315
+ if (this.matchesPattern(message.topic, rule.pattern)) {
316
+ return rule.channelType;
317
+ }
318
+ }
319
+ return null;
320
+ }
321
+ /**
322
+ * Match topic against pattern (supports * wildcard).
323
+ *
324
+ * @param topic - Message topic
325
+ * @param pattern - Pattern with wildcards
326
+ * @returns True if topic matches pattern
327
+ */ matchesPattern(topic, pattern) {
328
+ if (pattern === '*') {
329
+ return true;
330
+ }
331
+ const regexPattern = pattern.replace(/\./g, '\\.').replace(/\*/g, '.*');
332
+ const regex = new RegExp(`^${regexPattern}$`);
333
+ return regex.test(topic);
334
+ }
335
+ /**
336
+ * Process channels with fairness scheduler.
337
+ * Round-robin with quantum-based processing.
338
+ */ async processFairScheduler() {
339
+ const quantum = this.config.fairnessQuantum;
340
+ // Process each channel in round-robin order
341
+ for(let i = 0; i < this.fairnessState.channelOrder.length; i++){
342
+ const channelType = this.fairnessState.channelOrder[i];
343
+ const channel = this.channels.get(channelType);
344
+ if (channel && channel.getBufferSize() > 0) {
345
+ // Process up to quantum messages from this channel
346
+ let processed = 0;
347
+ while(processed < quantum && channel.getBufferSize() > 0){
348
+ await channel.processBuffer();
349
+ processed++;
350
+ }
351
+ }
352
+ }
353
+ }
354
+ /**
355
+ * Process all channels in priority order (no fairness).
356
+ */ async processAllChannels() {
357
+ // Get channels sorted by priority (highest first)
358
+ const sortedChannels = Array.from(this.channels.entries()).sort(([, a], [, b])=>b.priority - a.priority);
359
+ for (const [, channel] of sortedChannels){
360
+ await channel.processBuffer();
361
+ }
362
+ }
363
+ /**
364
+ * Get channel by type.
365
+ *
366
+ * @param channelType - Channel type
367
+ * @returns Channel instance or undefined
368
+ */ getChannel(channelType) {
369
+ return this.channels.get(channelType);
370
+ }
371
+ /**
372
+ * Get all channels.
373
+ *
374
+ * @returns Map of channel type to channel instance
375
+ */ getAllChannels() {
376
+ return new Map(this.channels);
377
+ }
378
+ /**
379
+ * Get router statistics.
380
+ *
381
+ * @returns Router statistics
382
+ */ getStats() {
383
+ const avgRoutingLatencyMs = this.stats.routingLatencies.length > 0 ? this.stats.routingLatencies.reduce((sum, l)=>sum + l, 0) / this.stats.routingLatencies.length : 0;
384
+ const messagesByChannel = {
385
+ ["coordination"]: this.stats.messagesByChannel.get("coordination") ?? 0,
386
+ ["task"]: this.stats.messagesByChannel.get("task") ?? 0,
387
+ ["help"]: this.stats.messagesByChannel.get("help") ?? 0,
388
+ ["event"]: this.stats.messagesByChannel.get("event") ?? 0
389
+ };
390
+ const channelStats = {};
391
+ for (const type of Object.values(ChannelType)){
392
+ const channel = this.channels.get(type);
393
+ if (channel) {
394
+ const stats = channel.getStats();
395
+ channelStats[type] = {
396
+ buffered: stats.currentBufferSize,
397
+ delivered: stats.totalDelivered,
398
+ dropped: stats.totalDropped,
399
+ subscribers: stats.totalSubscriptions
400
+ };
401
+ }
402
+ }
403
+ return {
404
+ totalRouted: this.stats.totalRouted,
405
+ totalDropped: this.stats.totalDropped,
406
+ messagesByChannel,
407
+ pendingMessages: this.incomingQueue.size(),
408
+ avgRoutingLatencyMs,
409
+ channelStats
410
+ };
411
+ }
412
+ /**
413
+ * Clear all channels and reset router.
414
+ */ clear() {
415
+ this.incomingQueue.clear();
416
+ for (const type of Object.values(ChannelType)){
417
+ const channel = this.channels.get(type);
418
+ if (channel) {
419
+ channel.clearBuffer();
420
+ channel.resetStats();
421
+ }
422
+ }
423
+ this.stats = {
424
+ totalRouted: 0,
425
+ totalDropped: 0,
426
+ messagesByChannel: new Map(),
427
+ routingLatencies: []
428
+ };
429
+ }
430
+ /**
431
+ * Shutdown router and close all channels.
432
+ */ shutdown() {
433
+ this.clear();
434
+ for (const type of Object.values(ChannelType)){
435
+ const channel = this.channels.get(type);
436
+ if (channel) {
437
+ channel.close();
438
+ }
439
+ }
440
+ this.removeAllListeners();
441
+ }
442
+ }
443
+
444
+ //# sourceMappingURL=message-router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/messaging/message-router.ts"],"names":["PriorityQueue","Channel","BackpressurePolicy","EventEmitter","ChannelType","RouterEvent","MessageRouter","config","incomingQueue","channels","routingRules","stats","fairnessState","isProcessing","customRules","enableFairness","fairnessQuantum","maxPendingMessages","Map","totalRouted","totalDropped","messagesByChannel","routingLatencies","lastChannelIndex","channelOrder","initializeChannels","initializeRoutingRules","set","channelId","name","capacity","backpressurePolicy","DROP_OLDEST","priority","DROP_NEWEST","push","defaultRules","pattern","channelType","sort","a","b","route","message","size","emit","pendingMessages","maxPending","droppedMessageId","id","enqueue","setImmediate","processQueue","routedCount","isEmpty","dequeue","startTime","performance","now","findChannelForMessage","messageId","topic","reason","channel","get","publish","latency","length","shift","latencyMs","processFairScheduler","processAllChannels","rule","matchesPattern","regexPattern","replace","regex","RegExp","test","quantum","i","getBufferSize","processed","processBuffer","sortedChannels","Array","from","entries","getChannel","getAllChannels","getStats","avgRoutingLatencyMs","reduce","sum","l","channelStats","type","Object","values","buffered","currentBufferSize","delivered","totalDelivered","dropped","subscribers","totalSubscriptions","clear","clearBuffer","resetStats","shutdown","close","removeAllListeners"],"mappings":"AAAA;;;;;;;;;;;;;;CAcC,GAGD,SAASA,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,OAAO,EAAsBC,kBAAkB,QAAQ,eAAe;AAC/E,SAASC,YAAY,QAAQ,SAAS;AAEtC;;;CAGC,GACD,OAAO,IAAA,AAAKC,qCAAAA;IACV,oDAAoD;IAGpD,0DAA0D;IAG1D,kDAAkD;IAGlD,gDAAgD;WAVtCA;MAYX;AAgED;;CAEC,GACD,OAAO,IAAA,AAAKC,qCAAAA;IACV,8BAA8B;IAG9B,wCAAwC;IAGxC,oCAAoC;IAGpC,iBAAiB;WAVPA;MAYX;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCC,GACD,OAAO,MAAMC,sBAAsBH;IACjC,kBAAkB,GAClB,AAAiBI,OAA+B;IAEhD,yCAAyC,GACzC,AAAiBC,cAAsC;IAEvD,8BAA8B,GAC9B,AAAiBC,SAAoC;IAErD,4CAA4C,GAC5C,AAAiBC,aAA4B;IAE7C,wBAAwB,GACxB,AAAQC,MAKN;IAEF,sDAAsD,GACtD,AAAQC,cAGN;IAEF,oBAAoB,GACpB,AAAQC,aAAsB;IAE9B,YAAYN,SAAuB,CAAC,CAAC,CAAE;QACrC,KAAK;QAEL,I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