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
@@ -0,0 +1,387 @@
1
+ /**
2
+ * Agent Coordination V2 - Message Bus
3
+ *
4
+ * Event-driven message bus with channel abstraction and pub/sub pattern.
5
+ * Provides unified interface for multi-channel communication with routing,
6
+ * priority queuing, and backpressure handling.
7
+ *
8
+ * Features:
9
+ * - Event-driven architecture (EventEmitter pattern)
10
+ * - Channel isolation (4 specialized channels)
11
+ * - Priority queue routing
12
+ * - Pub/sub with topic patterns
13
+ * - Backpressure coordination
14
+ * - Message ordering guarantees
15
+ *
16
+ * @module coordination/v2/messaging/message-bus
17
+ */ import { MessageRouter, ChannelType } from './message-router.js';
18
+ import { EventEmitter } from 'events';
19
+ /**
20
+ * Message bus events.
21
+ */ export var MessageBusEvent = /*#__PURE__*/ function(MessageBusEvent) {
22
+ /** Message published to bus */ MessageBusEvent["MESSAGE_PUBLISHED"] = "message-published";
23
+ /** Message delivered to subscriber */ MessageBusEvent["MESSAGE_DELIVERED"] = "message-delivered";
24
+ /** Message routed to channel */ MessageBusEvent["MESSAGE_ROUTED"] = "message-routed";
25
+ /** Subscription created */ MessageBusEvent["SUBSCRIBED"] = "subscribed";
26
+ /** Subscription removed */ MessageBusEvent["UNSUBSCRIBED"] = "unsubscribed";
27
+ /** Bus error */ MessageBusEvent["ERROR"] = "error";
28
+ return MessageBusEvent;
29
+ }({});
30
+ /**
31
+ * MessageBus - Event-driven message bus with channel abstraction.
32
+ *
33
+ * Unified interface for multi-channel pub/sub communication with
34
+ * priority-based routing, channel isolation, and backpressure handling.
35
+ *
36
+ * Architecture:
37
+ * - EventEmitter-based (event-driven pattern)
38
+ * - MessageRouter for priority queue routing
39
+ * - 4 specialized channels (coordination, task, help, event)
40
+ * - Auto-processing loop for continuous delivery
41
+ *
42
+ * Usage Patterns:
43
+ * - Pub/Sub: publish() + subscribe()
44
+ * - Direct channel access: getChannel()
45
+ * - Topic-based routing: Automatic via routing rules
46
+ *
47
+ * Performance:
48
+ * - publish(): O(log n) for routing + channel enqueue
49
+ * - subscribe(): O(1) for channel subscription
50
+ * - Auto-processing: Continuous background loop
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * const bus = new MessageBus({
55
+ * autoProcess: true,
56
+ * autoProcessInterval: 10
57
+ * });
58
+ *
59
+ * // Subscribe to topics
60
+ * bus.subscribe('task.*', async (message) => {
61
+ * console.log('Task message:', message.payload);
62
+ * });
63
+ *
64
+ * // Publish messages
65
+ * bus.publish({
66
+ * topic: 'task.completed',
67
+ * payload: { taskId: 'task-1', result: 'success' },
68
+ * priority: 5
69
+ * });
70
+ *
71
+ * // Stats monitoring
72
+ * const stats = bus.getStats();
73
+ * console.log('Total published:', stats.totalPublished);
74
+ * ```
75
+ */ export class MessageBus extends EventEmitter {
76
+ /** Configuration */ config;
77
+ /** Message router */ router;
78
+ /** Auto-processing interval handle */ autoProcessTimer;
79
+ /** Statistics tracking */ stats;
80
+ /** Subscription registry (topic pattern -> subscription IDs) */ subscriptions;
81
+ /** Shutdown flag */ isShutdown;
82
+ constructor(config = {}){
83
+ super();
84
+ this.config = {
85
+ router: config.router ?? {},
86
+ autoProcess: config.autoProcess ?? true,
87
+ autoProcessInterval: config.autoProcessInterval ?? 10,
88
+ enableStats: config.enableStats ?? true
89
+ };
90
+ this.router = new MessageRouter(this.config.router);
91
+ this.autoProcessTimer = null;
92
+ this.isShutdown = false;
93
+ this.stats = {
94
+ totalPublished: 0,
95
+ totalDelivered: 0,
96
+ subscriptionCount: 0
97
+ };
98
+ this.subscriptions = new Map();
99
+ // Wire up router events
100
+ this.router.on('message-routed', (event)=>{
101
+ this.emit("message-routed", event);
102
+ });
103
+ this.router.on('error', (event)=>{
104
+ this.emit("error", event);
105
+ });
106
+ // Start auto-processing if enabled
107
+ if (this.config.autoProcess) {
108
+ this.startAutoProcessing();
109
+ }
110
+ }
111
+ /**
112
+ * Publish a message to the bus.
113
+ * Message is routed to appropriate channel based on topic.
114
+ *
115
+ * @param config - Message configuration
116
+ * @returns Created message object
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * const message = bus.publish({
121
+ * topic: 'agent.status',
122
+ * payload: { agentId: 'agent-1', status: 'online' },
123
+ * priority: 5
124
+ * });
125
+ * ```
126
+ */ publish(config) {
127
+ if (this.isShutdown) {
128
+ throw new Error('Message bus is shutdown');
129
+ }
130
+ // Create message
131
+ const message = {
132
+ id: this.generateMessageId(),
133
+ topic: config.topic,
134
+ payload: config.payload,
135
+ priority: config.priority ?? 5,
136
+ timestamp: Date.now(),
137
+ replyTo: config.replyTo,
138
+ correlationId: config.correlationId,
139
+ senderId: config.senderId,
140
+ recipientId: config.recipientId,
141
+ deliverySemantics: config.deliverySemantics,
142
+ metadata: config.metadata
143
+ };
144
+ // Route to appropriate channel
145
+ this.router.route(message);
146
+ // Update statistics
147
+ this.stats.totalPublished++;
148
+ // Emit event
149
+ this.emit("message-published", {
150
+ messageId: message.id,
151
+ topic: message.topic,
152
+ priority: message.priority
153
+ });
154
+ return message;
155
+ }
156
+ /**
157
+ * Subscribe to messages matching topic pattern.
158
+ * Pattern supports wildcards (e.g., 'task.*', 'agent.status.*').
159
+ *
160
+ * @param topicPattern - Topic pattern to subscribe to
161
+ * @param handler - Message handler function
162
+ * @param priority - Handler priority (default: 0)
163
+ * @returns Subscription handle
164
+ *
165
+ * @example
166
+ * ```typescript
167
+ * const sub = bus.subscribe('task.*', async (message) => {
168
+ * console.log('Task message:', message.payload);
169
+ * }, 10);
170
+ *
171
+ * // Later: unsubscribe
172
+ * sub.unsubscribe();
173
+ * ```
174
+ */ subscribe(topicPattern, handler, priority = 0) {
175
+ if (this.isShutdown) {
176
+ throw new Error('Message bus is shutdown');
177
+ }
178
+ // Determine which channel(s) to subscribe to based on pattern
179
+ const channelTypes = this.getChannelsForPattern(topicPattern);
180
+ if (channelTypes.length === 0) {
181
+ // Default to event channel for unknown patterns
182
+ channelTypes.push(ChannelType.EVENT);
183
+ }
184
+ // Subscribe to all matching channels
185
+ const channelSubscriptions = [];
186
+ for (const channelType of channelTypes){
187
+ const channel = this.router.getChannel(channelType);
188
+ if (channel) {
189
+ const sub = channel.subscribe(handler, priority);
190
+ channelSubscriptions.push(sub);
191
+ }
192
+ }
193
+ // Track subscription
194
+ const subscriptionId = `bus-sub-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
195
+ if (!this.subscriptions.has(topicPattern)) {
196
+ this.subscriptions.set(topicPattern, new Set());
197
+ }
198
+ this.subscriptions.get(topicPattern).add(subscriptionId);
199
+ this.stats.subscriptionCount++;
200
+ // Emit event
201
+ this.emit("subscribed", {
202
+ subscriptionId,
203
+ topicPattern,
204
+ channelTypes
205
+ });
206
+ // Return combined subscription
207
+ return {
208
+ id: subscriptionId,
209
+ topic: topicPattern,
210
+ createdAt: Date.now(),
211
+ unsubscribe: ()=>{
212
+ // Unsubscribe from all channels
213
+ for (const sub of channelSubscriptions){
214
+ sub.unsubscribe();
215
+ }
216
+ // Remove from tracking
217
+ const subs = this.subscriptions.get(topicPattern);
218
+ if (subs) {
219
+ subs.delete(subscriptionId);
220
+ if (subs.size === 0) {
221
+ this.subscriptions.delete(topicPattern);
222
+ }
223
+ }
224
+ this.stats.subscriptionCount--;
225
+ this.emit("unsubscribed", {
226
+ subscriptionId,
227
+ topicPattern
228
+ });
229
+ }
230
+ };
231
+ }
232
+ /**
233
+ * Get channel instance by type.
234
+ *
235
+ * @param channelType - Channel type
236
+ * @returns Channel instance or undefined
237
+ *
238
+ * @example
239
+ * ```typescript
240
+ * const taskChannel = bus.getChannel(ChannelType.TASK);
241
+ * const stats = taskChannel.getStats();
242
+ * ```
243
+ */ getChannel(channelType) {
244
+ return this.router.getChannel(channelType);
245
+ }
246
+ /**
247
+ * Get all channels.
248
+ *
249
+ * @returns Map of channel type to channel instance
250
+ */ getAllChannels() {
251
+ return this.router.getAllChannels();
252
+ }
253
+ /**
254
+ * Process message queue manually.
255
+ * Normally handled by auto-processing, but can be called manually.
256
+ *
257
+ * @returns Number of messages processed
258
+ */ async processQueue() {
259
+ return await this.router.processQueue();
260
+ }
261
+ /**
262
+ * Get message bus statistics.
263
+ *
264
+ * @returns Statistics object
265
+ */ getStats() {
266
+ const routerStats = this.router.getStats();
267
+ // Aggregate channel stats
268
+ const channels = {};
269
+ const allChannels = this.router.getAllChannels();
270
+ for (const type of Object.values(ChannelType)){
271
+ const channel = allChannels.get(type);
272
+ if (channel) {
273
+ const channelStats = channel.getStats();
274
+ channels[type] = {
275
+ buffered: channelStats.currentBufferSize,
276
+ delivered: channelStats.totalDelivered,
277
+ dropped: channelStats.totalDropped,
278
+ subscribers: channelStats.totalSubscriptions,
279
+ avgLatencyMs: channelStats.avgLatencyMs
280
+ };
281
+ }
282
+ }
283
+ return {
284
+ totalPublished: this.stats.totalPublished,
285
+ totalDelivered: routerStats.channelStats[ChannelType.COORDINATION].delivered + routerStats.channelStats[ChannelType.TASK].delivered + routerStats.channelStats[ChannelType.HELP].delivered + routerStats.channelStats[ChannelType.EVENT].delivered,
286
+ totalDropped: routerStats.totalDropped,
287
+ totalSubscriptions: this.stats.subscriptionCount,
288
+ messagesByChannel: routerStats.messagesByChannel,
289
+ router: {
290
+ totalRouted: routerStats.totalRouted,
291
+ pendingMessages: routerStats.pendingMessages,
292
+ avgRoutingLatencyMs: routerStats.avgRoutingLatencyMs
293
+ },
294
+ channels
295
+ };
296
+ }
297
+ /**
298
+ * Start auto-processing loop.
299
+ */ startAutoProcessing() {
300
+ if (this.autoProcessTimer || this.isShutdown) {
301
+ return;
302
+ }
303
+ this.autoProcessTimer = setInterval(async ()=>{
304
+ try {
305
+ await this.processQueue();
306
+ } catch (error) {
307
+ this.emit("error", {
308
+ source: 'auto-processing',
309
+ error
310
+ });
311
+ }
312
+ }, this.config.autoProcessInterval);
313
+ // Prevent timer from blocking process exit
314
+ if (this.autoProcessTimer.unref) {
315
+ this.autoProcessTimer.unref();
316
+ }
317
+ }
318
+ /**
319
+ * Stop auto-processing loop.
320
+ */ stopAutoProcessing() {
321
+ if (this.autoProcessTimer) {
322
+ clearInterval(this.autoProcessTimer);
323
+ this.autoProcessTimer = null;
324
+ }
325
+ }
326
+ /**
327
+ * Determine which channels match a topic pattern.
328
+ *
329
+ * @param pattern - Topic pattern
330
+ * @returns Array of matching channel types
331
+ */ getChannelsForPattern(pattern) {
332
+ const channels = [];
333
+ // Simple pattern matching for common prefixes
334
+ if (pattern.startsWith('agent.') || pattern.startsWith('coordinator.') || pattern.startsWith('session.')) {
335
+ channels.push(ChannelType.COORDINATION);
336
+ }
337
+ if (pattern.startsWith('task.') || pattern.startsWith('job.') || pattern.startsWith('execution.')) {
338
+ channels.push(ChannelType.TASK);
339
+ }
340
+ if (pattern.startsWith('help.') || pattern.startsWith('assistance.')) {
341
+ channels.push(ChannelType.HELP);
342
+ }
343
+ // Wildcard or unknown patterns go to event channel
344
+ if (pattern === '*' || channels.length === 0) {
345
+ channels.push(ChannelType.EVENT);
346
+ }
347
+ return channels;
348
+ }
349
+ /**
350
+ * Generate unique message ID.
351
+ *
352
+ * @returns Message ID
353
+ */ generateMessageId() {
354
+ return `msg-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
355
+ }
356
+ /**
357
+ * Clear all messages and statistics.
358
+ * Does not affect subscriptions.
359
+ */ clear() {
360
+ this.router.clear();
361
+ this.stats = {
362
+ totalPublished: 0,
363
+ totalDelivered: 0,
364
+ subscriptionCount: this.stats.subscriptionCount
365
+ };
366
+ }
367
+ /**
368
+ * Shutdown the message bus.
369
+ * Stops auto-processing, closes all channels, and clears subscriptions.
370
+ */ shutdown() {
371
+ if (this.isShutdown) {
372
+ return;
373
+ }
374
+ this.isShutdown = true;
375
+ this.stopAutoProcessing();
376
+ this.router.shutdown();
377
+ this.subscriptions.clear();
378
+ this.removeAllListeners();
379
+ }
380
+ /**
381
+ * Check if bus is shutdown.
382
+ */ get closed() {
383
+ return this.isShutdown;
384
+ }
385
+ }
386
+
387
+ //# sourceMappingURL=message-bus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/messaging/message-bus.ts"],"names":["MessageRouter","ChannelType","EventEmitter","MessageBusEvent","MessageBus","config","router","autoProcessTimer","stats","subscriptions","isShutdown","autoProcess","autoProcessInterval","enableStats","totalPublished","totalDelivered","subscriptionCount","Map","on","event","emit","startAutoProcessing","publish","Error","message","id","generateMessageId","topic","payload","priority","timestamp","Date","now","replyTo","correlationId","senderId","recipientId","deliverySemantics","metadata","route","messageId","subscribe","topicPattern","handler","channelTypes","getChannelsForPattern","length","push","EVENT","channelSubscriptions","channelType","channel","getChannel","sub","subscriptionId","Math","random","toString","substr","has","set","Set","get","add","createdAt","unsubscribe","subs","delete","size","getAllChannels","processQueue","getStats","routerStats","channels","allChannels","type","Object","values","channelStats","buffered","currentBufferSize","delivered","dropped","totalDropped","subscribers","totalSubscriptions","avgLatencyMs","COORDINATION","TASK","HELP","messagesByChannel","totalRouted","pendingMessages","avgRoutingLatencyMs","setInterval","error","source","unref","stopAutoProcessing","clearInterval","pattern","startsWith","clear","shutdown","removeAllListeners","closed"],"mappings":"AAAA;;;;;;;;;;;;;;;;CAgBC,GAGD,SAASA,aAAa,EAAEC,WAAW,QAA2B,sBAAsB;AAEpF,SAASC,YAAY,QAAQ,SAAS;AAuDtC;;CAEC,GACD,OAAO,IAAA,AAAKC,yCAAAA;IACV,6BAA6B;IAG7B,oCAAoC;IAGpC,8BAA8B;IAG9B,yBAAyB;IAGzB,yBAAyB;IAGzB,cAAc;WAhBJA;MAkBX;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CC,GACD,OAAO,MAAMC,mBAAmBF;IAC9B,kBAAkB,GAClB,AAAiBG,OAAmC;IAEpD,mBAAmB,GACnB,AAAiBC,OAAsB;IAEvC,oCAAoC,GACpC,AAAQC,iBAAwC;IAEhD,wBAAwB,GACxB,AAAQC,MAIN;IAEF,8DAA8D,GAC9D,AAAQC,cAAwC;IAEhD,kBAAkB,GAClB,AAAQC,WAAoB;IAE5B,YAAYL,SAA2B,CAAC,CAAC,CAAE;QACzC,KAAK;QAEL,IAAI,CAACA,MAAM,GAAG;YACZC,QAAQD,OAAOC,MAAM,IAAI,CAAC;YAC1BK,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