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,518 @@
1
+ /**
2
+ * Agent Coordination V2 - Message Storage Implementation
3
+ *
4
+ * MessagePack + Gzip persistence for message bus with queue management.
5
+ * Performance targets:
6
+ * - Save/load: <20ms p95
7
+ * - Compression ratio: >2x
8
+ * - Message queue persistence (undelivered messages)
9
+ * - Dead letter queue persistence
10
+ *
11
+ * Features:
12
+ * - Binary MessagePack serialization (3x faster than JSON)
13
+ * - Gzip compression for storage efficiency
14
+ * - Message queue state persistence
15
+ * - Dead letter queue persistence
16
+ * - Integrity verification with checksums
17
+ * - Schema versioning for backward compatibility
18
+ *
19
+ * @module coordination/v2/memory/message-storage
20
+ */ import * as msgpack from 'msgpack-lite';
21
+ import { gzip, gunzip } from 'zlib';
22
+ import { promisify } from 'util';
23
+ const gzipAsync = promisify(gzip);
24
+ const gunzipAsync = promisify(gunzip);
25
+ /**
26
+ * Schema version for forward/backward compatibility
27
+ */ const SCHEMA_VERSION = 1;
28
+ /**
29
+ * MessageStorage - Artifact-backed message persistence
30
+ *
31
+ * Provides high-performance storage for message bus state using:
32
+ * - MessagePack binary serialization (smaller payloads)
33
+ * - Gzip compression (additional size reduction)
34
+ * - Message queue state preservation
35
+ * - Dead letter queue persistence
36
+ * - Schema versioning for compatibility
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const storage = new MessageStorage(artifactStorage);
41
+ * await storage.initialize();
42
+ *
43
+ * // Save messages and queues
44
+ * await storage.saveMessages('bus-1', messages, queues, deadLetterMessages);
45
+ *
46
+ * // Load messages and queues
47
+ * const state = await storage.loadMessages('bus-1');
48
+ *
49
+ * // Incremental updates
50
+ * await storage.saveMessage('bus-1', message);
51
+ * await storage.saveQueue('bus-1', queue);
52
+ * ```
53
+ */ export class MessageStorage {
54
+ artifactStorage;
55
+ metrics;
56
+ latencyBuffer = [];
57
+ ready = false;
58
+ constructor(artifactStorage){
59
+ this.artifactStorage = artifactStorage;
60
+ this.metrics = this.initializeMetrics();
61
+ }
62
+ // ===========================
63
+ // Lifecycle
64
+ // ===========================
65
+ /**
66
+ * Initialize storage backend
67
+ */ async initialize() {
68
+ if (!this.artifactStorage.isReady()) {
69
+ await this.artifactStorage.initialize();
70
+ }
71
+ this.ready = true;
72
+ }
73
+ /**
74
+ * Close storage connections
75
+ */ async close() {
76
+ this.ready = false;
77
+ }
78
+ /**
79
+ * Check if storage is ready
80
+ */ isReady() {
81
+ return this.ready && this.artifactStorage.isReady();
82
+ }
83
+ // ===========================
84
+ // Core Persistence Operations
85
+ // ===========================
86
+ /**
87
+ * Save complete message bus state to artifact storage
88
+ *
89
+ * Performance target: <20ms p95
90
+ *
91
+ * @param storageId - Unique storage identifier
92
+ * @param messages - Messages to persist
93
+ * @param queues - Message queues to persist
94
+ * @param deadLetterMessages - Dead letter queue messages
95
+ * @throws Error if serialization or storage fails
96
+ */ async saveMessages(storageId, messages, queues, deadLetterMessages) {
97
+ this.ensureReady();
98
+ const startTime = Date.now();
99
+ try {
100
+ // 1. Serialize message bus state to compact format
101
+ const serialized = this.serializeMessageStorage(storageId, messages, queues, deadLetterMessages);
102
+ // 2. Encode with MessagePack (binary)
103
+ const packed = msgpack.encode(serialized);
104
+ // 3. Compress with gzip
105
+ const compressed = await gzipAsync(packed);
106
+ // Calculate compression ratio
107
+ const compressionRatio = packed.length / compressed.length;
108
+ // 4. Store in artifact storage
109
+ await this.artifactStorage.uploadArtifact('message-bus', storageId, compressed, {
110
+ type: 'message-storage',
111
+ filename: `${storageId}.msgpack.gz`,
112
+ tags: [
113
+ 'message-bus',
114
+ 'storage',
115
+ storageId
116
+ ],
117
+ metadata: {
118
+ schemaVersion: SCHEMA_VERSION,
119
+ messageCount: messages.length,
120
+ queueCount: queues.length,
121
+ deadLetterCount: deadLetterMessages.length,
122
+ uncompressedBytes: packed.length,
123
+ compressedBytes: compressed.length,
124
+ compressionRatio
125
+ },
126
+ forceCompression: false // Already compressed
127
+ });
128
+ // Update metrics
129
+ const latency = Date.now() - startTime;
130
+ this.updateSaveMetrics(latency, messages.length, compressionRatio);
131
+ // Performance warning if exceeds target
132
+ if (latency > 20) {
133
+ console.warn(`[MessageStorage] Save latency ${latency}ms exceeds 20ms target for storage ${storageId}`);
134
+ }
135
+ } catch (error) {
136
+ throw new Error(`Failed to save messages for ${storageId}: ${error instanceof Error ? error.message : String(error)}`);
137
+ }
138
+ }
139
+ /**
140
+ * Load message bus state from artifact storage
141
+ *
142
+ * Performance target: <20ms p95
143
+ *
144
+ * @param storageId - Storage identifier
145
+ * @returns Reconstructed message bus state
146
+ * @throws Error if storage not found or deserialization fails
147
+ */ async loadMessages(storageId) {
148
+ this.ensureReady();
149
+ const startTime = Date.now();
150
+ try {
151
+ // 1. Query for storage artifacts
152
+ const artifacts = await this.artifactStorage.queryArtifacts({
153
+ sessionId: storageId,
154
+ type: [
155
+ 'message-storage'
156
+ ],
157
+ sortBy: 'createdAt',
158
+ sortOrder: 'desc',
159
+ limit: 1
160
+ });
161
+ if (artifacts.length === 0) {
162
+ // Return empty state if no storage found
163
+ return {
164
+ messages: [],
165
+ queues: [],
166
+ deadLetterMessages: []
167
+ };
168
+ }
169
+ // 2. Download artifact
170
+ const result = await this.artifactStorage.downloadArtifact(artifacts[0].artifactId);
171
+ // SEC-013: Validate compressed size before decompression
172
+ const MAX_COMPRESSED_SIZE = 50 * 1024 * 1024; // 50MB
173
+ if (result.content.length > MAX_COMPRESSED_SIZE) {
174
+ throw new Error(`Compressed data too large: ${result.content.length} bytes (max: ${MAX_COMPRESSED_SIZE})`);
175
+ }
176
+ // 3. Decompress
177
+ const decompressed = await gunzipAsync(result.content);
178
+ // SEC-013: Validate decompressed size to prevent compression bombs
179
+ const MAX_UNCOMPRESSED_SIZE = 500 * 1024 * 1024; // 500MB
180
+ if (decompressed.length > MAX_UNCOMPRESSED_SIZE) {
181
+ throw new Error(`Decompressed data too large: ${decompressed.length} bytes (max: ${MAX_UNCOMPRESSED_SIZE})`);
182
+ }
183
+ // SEC-013: Validate compression ratio (max 10x expansion)
184
+ const compressionRatio = decompressed.length / result.content.length;
185
+ if (compressionRatio > 10) {
186
+ throw new Error(`Compression ratio too high: ${compressionRatio.toFixed(2)}x (max: 10x) - possible compression bomb`);
187
+ }
188
+ // 4. Decode MessagePack
189
+ const serialized = msgpack.decode(decompressed);
190
+ // 5. Validate schema version
191
+ if (serialized.version > SCHEMA_VERSION) {
192
+ throw new Error(`Unsupported schema version ${serialized.version}, current: ${SCHEMA_VERSION}`);
193
+ }
194
+ // 6. Reconstruct message bus state
195
+ const state = this.deserializeMessageStorage(serialized);
196
+ // Update metrics
197
+ const latency = Date.now() - startTime;
198
+ this.updateLoadMetrics(latency, state.messages.length);
199
+ // Performance warning if exceeds target
200
+ if (latency > 20) {
201
+ console.warn(`[MessageStorage] Load latency ${latency}ms exceeds 20ms target for storage ${storageId}`);
202
+ }
203
+ return state;
204
+ } catch (error) {
205
+ throw new Error(`Failed to load messages for ${storageId}: ${error instanceof Error ? error.message : String(error)}`);
206
+ }
207
+ }
208
+ // ===========================
209
+ // Incremental Update Operations
210
+ // ===========================
211
+ /**
212
+ * Save single message without full reload
213
+ *
214
+ * Performance target: <5ms p95
215
+ *
216
+ * @param storageId - Storage identifier
217
+ * @param message - Message to save
218
+ */ async saveMessage(storageId, message) {
219
+ this.ensureReady();
220
+ const startTime = Date.now();
221
+ try {
222
+ // Load current state
223
+ const state = await this.loadMessages(storageId);
224
+ // Add or update message
225
+ const existingIndex = state.messages.findIndex((m)=>m.id === message.id);
226
+ if (existingIndex >= 0) {
227
+ state.messages[existingIndex] = message;
228
+ } else {
229
+ state.messages.push(message);
230
+ }
231
+ // Save updated state
232
+ await this.saveMessages(storageId, state.messages, state.queues, state.deadLetterMessages);
233
+ const latency = Date.now() - startTime;
234
+ if (latency > 5) {
235
+ console.warn(`[MessageStorage] Message save ${latency}ms exceeds 5ms target`);
236
+ }
237
+ } catch (error) {
238
+ throw new Error(`Failed to save message ${message.id}: ${error instanceof Error ? error.message : String(error)}`);
239
+ }
240
+ }
241
+ /**
242
+ * Save queue state without full reload
243
+ *
244
+ * Performance target: <5ms p95
245
+ *
246
+ * @param storageId - Storage identifier
247
+ * @param queue - Queue to save
248
+ */ async saveQueue(storageId, queue) {
249
+ this.ensureReady();
250
+ const startTime = Date.now();
251
+ try {
252
+ // Load current state
253
+ const state = await this.loadMessages(storageId);
254
+ // Add or update queue
255
+ const existingIndex = state.queues.findIndex((q)=>q.id === queue.id);
256
+ if (existingIndex >= 0) {
257
+ state.queues[existingIndex] = queue;
258
+ } else {
259
+ state.queues.push(queue);
260
+ }
261
+ // Save updated state
262
+ await this.saveMessages(storageId, state.messages, state.queues, state.deadLetterMessages);
263
+ const latency = Date.now() - startTime;
264
+ if (latency > 5) {
265
+ console.warn(`[MessageStorage] Queue save ${latency}ms exceeds 5ms target`);
266
+ }
267
+ } catch (error) {
268
+ throw new Error(`Failed to save queue ${queue.id}: ${error instanceof Error ? error.message : String(error)}`);
269
+ }
270
+ }
271
+ /**
272
+ * Add message to dead letter queue
273
+ *
274
+ * @param storageId - Storage identifier
275
+ * @param message - Failed message
276
+ */ async addToDeadLetterQueue(storageId, message) {
277
+ this.ensureReady();
278
+ try {
279
+ // Load current state
280
+ const state = await this.loadMessages(storageId);
281
+ // Add to dead letter queue
282
+ state.deadLetterMessages.push(message);
283
+ // Save updated state
284
+ await this.saveMessages(storageId, state.messages, state.queues, state.deadLetterMessages);
285
+ } catch (error) {
286
+ throw new Error(`Failed to add message ${message.id} to dead letter queue: ${error instanceof Error ? error.message : String(error)}`);
287
+ }
288
+ }
289
+ // ===========================
290
+ // Serialization Helpers
291
+ // ===========================
292
+ /**
293
+ * Serialize message bus state to compact binary-friendly format
294
+ */ serializeMessageStorage(storageId, messages, queues, deadLetterMessages) {
295
+ // Serialize messages
296
+ const serializedMessages = messages.map((msg)=>({
297
+ id: msg.id,
298
+ type: msg.type,
299
+ sender: {
300
+ id: msg.sender.id,
301
+ name: msg.sender.name
302
+ },
303
+ receivers: msg.receivers.map((r)=>({
304
+ id: r.id,
305
+ name: r.name
306
+ })),
307
+ content: msg.content,
308
+ metadata: msg.metadata,
309
+ timestamp: msg.timestamp.getTime(),
310
+ expiresAt: msg.expiresAt?.getTime(),
311
+ priority: msg.priority,
312
+ reliability: msg.reliability
313
+ }));
314
+ // Serialize dead letter messages
315
+ const serializedDeadLetterMessages = deadLetterMessages.map((msg)=>({
316
+ id: msg.id,
317
+ type: msg.type,
318
+ sender: {
319
+ id: msg.sender.id,
320
+ name: msg.sender.name
321
+ },
322
+ receivers: msg.receivers.map((r)=>({
323
+ id: r.id,
324
+ name: r.name
325
+ })),
326
+ content: msg.content,
327
+ metadata: msg.metadata,
328
+ timestamp: msg.timestamp.getTime(),
329
+ expiresAt: msg.expiresAt?.getTime(),
330
+ priority: msg.priority,
331
+ reliability: msg.reliability
332
+ }));
333
+ // Serialize queues
334
+ const serializedQueues = queues.map((queue)=>({
335
+ id: queue.id,
336
+ name: queue.name,
337
+ type: queue.type,
338
+ messageIds: queue.messages.map((m)=>m.id),
339
+ config: queue.config,
340
+ subscribers: queue.subscribers.map((sub)=>({
341
+ id: sub.id,
342
+ agentId: sub.agent.id,
343
+ agentName: sub.agent.name,
344
+ ackMode: sub.ackMode,
345
+ prefetchCount: sub.prefetchCount,
346
+ lastActivity: sub.lastActivity.getTime()
347
+ })),
348
+ statistics: queue.statistics
349
+ }));
350
+ return {
351
+ version: SCHEMA_VERSION,
352
+ metadata: {
353
+ storageId,
354
+ createdAt: Date.now(),
355
+ updatedAt: Date.now(),
356
+ messageCount: messages.length,
357
+ queueCount: queues.length
358
+ },
359
+ messages: serializedMessages,
360
+ queues: serializedQueues,
361
+ deadLetterMessages: serializedDeadLetterMessages
362
+ };
363
+ }
364
+ /**
365
+ * Deserialize message bus state from storage format
366
+ */ deserializeMessageStorage(serialized) {
367
+ // Reconstruct messages
368
+ const messages = serialized.messages.map((msg)=>({
369
+ id: msg.id,
370
+ type: msg.type,
371
+ sender: {
372
+ id: msg.sender.id,
373
+ name: msg.sender.name
374
+ },
375
+ receivers: msg.receivers.map((r)=>({
376
+ id: r.id,
377
+ name: r.name
378
+ })),
379
+ content: msg.content,
380
+ metadata: msg.metadata,
381
+ timestamp: new Date(msg.timestamp),
382
+ expiresAt: msg.expiresAt ? new Date(msg.expiresAt) : undefined,
383
+ priority: msg.priority,
384
+ reliability: msg.reliability
385
+ }));
386
+ // Reconstruct dead letter messages
387
+ const deadLetterMessages = serialized.deadLetterMessages.map((msg)=>({
388
+ id: msg.id,
389
+ type: msg.type,
390
+ sender: {
391
+ id: msg.sender.id,
392
+ name: msg.sender.name
393
+ },
394
+ receivers: msg.receivers.map((r)=>({
395
+ id: r.id,
396
+ name: r.name
397
+ })),
398
+ content: msg.content,
399
+ metadata: msg.metadata,
400
+ timestamp: new Date(msg.timestamp),
401
+ expiresAt: msg.expiresAt ? new Date(msg.expiresAt) : undefined,
402
+ priority: msg.priority,
403
+ reliability: msg.reliability
404
+ }));
405
+ // Build message lookup map
406
+ const messageMap = new Map(messages.map((m)=>[
407
+ m.id,
408
+ m
409
+ ]));
410
+ // Reconstruct queues
411
+ const queues = serialized.queues.map((queue)=>({
412
+ id: queue.id,
413
+ name: queue.name,
414
+ type: queue.type,
415
+ messages: queue.messageIds.map((id)=>messageMap.get(id)).filter(Boolean),
416
+ config: queue.config,
417
+ subscribers: queue.subscribers.map((sub)=>({
418
+ id: sub.id,
419
+ agent: {
420
+ id: sub.agentId,
421
+ name: sub.agentName
422
+ },
423
+ ackMode: sub.ackMode,
424
+ prefetchCount: sub.prefetchCount,
425
+ lastActivity: new Date(sub.lastActivity)
426
+ })),
427
+ statistics: queue.statistics
428
+ }));
429
+ return {
430
+ messages,
431
+ queues,
432
+ deadLetterMessages
433
+ };
434
+ }
435
+ // ===========================
436
+ // Utility Methods
437
+ // ===========================
438
+ /**
439
+ * Ensure storage is ready for operations
440
+ */ ensureReady() {
441
+ if (!this.ready) {
442
+ throw new Error('MessageStorage not initialized. Call initialize() first.');
443
+ }
444
+ if (!this.artifactStorage.isReady()) {
445
+ throw new Error('Artifact storage backend not ready');
446
+ }
447
+ }
448
+ // ===========================
449
+ // Metrics & Monitoring
450
+ // ===========================
451
+ /**
452
+ * Get storage performance metrics
453
+ */ getMetrics() {
454
+ return {
455
+ ...this.metrics
456
+ };
457
+ }
458
+ /**
459
+ * Initialize metrics structure
460
+ */ initializeMetrics() {
461
+ return {
462
+ totalSaves: 0,
463
+ totalLoads: 0,
464
+ totalMessagesSaved: 0,
465
+ totalMessagesLoaded: 0,
466
+ averageSaveMs: 0,
467
+ averageLoadMs: 0,
468
+ p95SaveMs: 0,
469
+ p95LoadMs: 0,
470
+ averageCompressionRatio: 0,
471
+ lastOperationMs: 0
472
+ };
473
+ }
474
+ /**
475
+ * Update save operation metrics
476
+ */ updateSaveMetrics(latency, messageCount, compressionRatio) {
477
+ this.metrics.totalSaves++;
478
+ this.metrics.totalMessagesSaved += messageCount;
479
+ this.metrics.averageSaveMs = this.updateAverage(this.metrics.averageSaveMs, latency, this.metrics.totalSaves);
480
+ this.latencyBuffer.push(latency);
481
+ this.metrics.p95SaveMs = this.calculateP95();
482
+ this.metrics.lastOperationMs = latency;
483
+ // Update compression ratio
484
+ const totalRatio = this.metrics.averageCompressionRatio * (this.metrics.totalSaves - 1) + compressionRatio;
485
+ this.metrics.averageCompressionRatio = totalRatio / this.metrics.totalSaves;
486
+ }
487
+ /**
488
+ * Update load operation metrics
489
+ */ updateLoadMetrics(latency, messageCount) {
490
+ this.metrics.totalLoads++;
491
+ this.metrics.totalMessagesLoaded += messageCount;
492
+ this.metrics.averageLoadMs = this.updateAverage(this.metrics.averageLoadMs, latency, this.metrics.totalLoads);
493
+ this.latencyBuffer.push(latency);
494
+ this.metrics.p95LoadMs = this.calculateP95();
495
+ this.metrics.lastOperationMs = latency;
496
+ }
497
+ /**
498
+ * Calculate rolling average
499
+ */ updateAverage(current, newValue, count) {
500
+ return (current * (count - 1) + newValue) / count;
501
+ }
502
+ /**
503
+ * Calculate 95th percentile latency
504
+ */ calculateP95() {
505
+ if (this.latencyBuffer.length === 0) return 0;
506
+ // Keep buffer size manageable
507
+ if (this.latencyBuffer.length > 1000) {
508
+ this.latencyBuffer = this.latencyBuffer.slice(-1000);
509
+ }
510
+ const sorted = [
511
+ ...this.latencyBuffer
512
+ ].sort((a, b)=>a - b);
513
+ const index = Math.floor(sorted.length * 0.95);
514
+ return sorted[index] || 0;
515
+ }
516
+ }
517
+
518
+ //# sourceMappingURL=message-storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/memory/message-storage.ts"],"names":["msgpack","gzip","gunzip","promisify","gzipAsync","gunzipAsync","SCHEMA_VERSION","MessageStorage","artifactStorage","metrics","latencyBuffer","ready","initializeMetrics","initialize","isReady","close","saveMessages","storageId","messages","queues","deadLetterMessages","ensureReady","startTime","Date","now","serialized","serializeMessageStorage","packed","encode","compressed","compressionRatio","length","uploadArtifact","type","filename","tags","metadata","schemaVersion","messageCount","queueCount","deadLetterCount","uncompressedBytes","compressedBytes","forceCompression","latency","updateSaveMetrics","console","warn","error","Error","message","String","loadMessages","artifacts","queryArtifacts","sessionId","sortBy","sortOrder","limit","result","downloadArtifact","artifactId","MAX_COMPRESSED_SIZE","content","decompressed","MAX_UNCOMPRESSED_SIZE","toFixed","decode","version","state","deserializeMessageStorage","updateLoadMetrics","saveMessage","existingIndex","findIndex","m","id","push","saveQueue","queue","q","addToDeadLetterQueue","serializedMessages","map","msg","sender","name","receivers","r","timestamp","getTime","expiresAt","priority","reliability","serializedDeadLetterMessages","serializedQueues","messageIds","config","subscribers","sub","agentId","agent","agentName","ackMode","prefetchCount","lastActivity","statistics","createdAt","updatedAt","undefined","messageMap","Map","get","filter","Boolean","getMetrics","totalSaves","totalLoads","totalMessagesSaved","totalMessagesLoaded","averageSaveMs","averageLoadMs","p95SaveMs","p95LoadMs","averageCompressionRatio","lastOperationMs","updateAverage","calculateP95","totalRatio","current","newValue","count","slice","sorted","sort","a","b","index","Math","floor"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;CAmBC,GAGD,YAAYA,aAAa,eAAe;AACxC,SAASC,IAAI,EAAEC,MAAM,QAAQ,OAAO;AACpC,SAASC,SAAS,QAAQ,OAAO;AAwEjC,MAAMC,YAAYD,UAAUF;AAC5B,MAAMI,cAAcF,UAAUD;AAE9B;;CAEC,GACD,MAAMI,iBAAiB;AAgFvB;;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,GACD,OAAO,MAAMC;IACHC,gBAAkC;IAClCC,QAAwB;IACxBC,gBAA0B,EAAE,CAAC;IAC7BC,QAAiB,MAAM;IAE/B,YAAYH,eAAiC,CAAE;QAC7C,IAAI,CAACA,eAAe,GAAGA;QACvB,IAAI,CAACC,OAAO,GAAG,IAAI,CAACG,iBAAiB;IACvC;IAEA,8BAA8B;IAC9B,YAAY;IACZ,8BAA8B;IAE9B;;GAEC,GACD,MAAMC,aAA4B;QAChC,IAAI,CAAC,IAAI,CAACL,eAAe,CAACM,OAAO,IAAI;YACnC,MAAM,IAAI,CAACN,eAAe,CAACK,UAAU;QACvC;QACA,IAAI,CAACF,KAAK,GAAG;IACf;IAEA;;GAEC,GACD,MAAMI,QAAuB;QAC3B,IAAI,CAACJ,KAAK,GAAG;IACf;IAEA;;GAEC,GACDG,UAAmB;QACjB,OAAO,IAAI,CAACH,KAAK,IAAI,IAAI,CAACH,eAAe,CAACM,OAAO;IACnD;IAEA,8BAA8B;IAC9B,8BAA8B;IAC9B,8BAA8B;IAE9B;;;;;;;;;;GAUC,GACD,MAAME,aACJC,SAAiB,EACjBC,QAAmB,EACnBC,MAAsB,EACtBC,kBAA6B,EACd;QACf,IAA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