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,413 @@
1
+ /**
2
+ * Agent Coordination V2 - Dead Letter Queue Implementation
3
+ *
4
+ * Handles failed message deliveries with retry logic and persistence.
5
+ * Features:
6
+ * - Exponential backoff retry strategy
7
+ * - Max retry limit configuration
8
+ * - Integration with MessageStorage
9
+ * - Failure analysis and reporting
10
+ * - Dead letter message inspection
11
+ *
12
+ * @module coordination/v2/core/dead-letter-queue
13
+ */ import { EventEmitter } from 'events';
14
+ /**
15
+ * DeadLetterQueue - Failure handling with retry logic
16
+ *
17
+ * Provides robust handling of failed message deliveries:
18
+ * - Exponential backoff retry strategy (prevents thundering herd)
19
+ * - Configurable max retry limits (circuit breaker)
20
+ * - Persistent storage integration (survives restarts)
21
+ * - Failure analysis and inspection tools
22
+ * - Automatic cleanup of expired messages
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const dlq = new DeadLetterQueue(storage, {
27
+ * maxRetries: 3,
28
+ * initialDelayMs: 1000,
29
+ * maxDelayMs: 30000,
30
+ * backoffMultiplier: 2,
31
+ * enableJitter: true,
32
+ * retentionMs: 86400000, // 24 hours
33
+ * enablePersistence: true,
34
+ * storageId: 'bus-1'
35
+ * });
36
+ *
37
+ * await dlq.initialize();
38
+ *
39
+ * // Add failed message
40
+ * await dlq.addMessage(message, 'delivery_timeout', 'agent-123');
41
+ *
42
+ * // Process retries
43
+ * await dlq.processRetries(async (entry) => {
44
+ * // Retry delivery logic
45
+ * return { success: true };
46
+ * });
47
+ *
48
+ * // Inspect failures
49
+ * const stats = dlq.getStatistics();
50
+ * const permanentFailures = dlq.getPermanentFailures();
51
+ * ```
52
+ */ export class DeadLetterQueue extends EventEmitter {
53
+ config;
54
+ storage;
55
+ entries = new Map();
56
+ retryTimer = null;
57
+ stats;
58
+ constructor(storage, config = {}){
59
+ super();
60
+ this.storage = storage;
61
+ this.config = {
62
+ maxRetries: 3,
63
+ initialDelayMs: 1000,
64
+ maxDelayMs: 30000,
65
+ backoffMultiplier: 2,
66
+ enableJitter: true,
67
+ retentionMs: 86400000,
68
+ enablePersistence: true,
69
+ storageId: 'default-bus',
70
+ ...config
71
+ };
72
+ this.stats = this.initializeStats();
73
+ }
74
+ // ===========================
75
+ // Lifecycle
76
+ // ===========================
77
+ /**
78
+ * Initialize dead letter queue
79
+ */ async initialize() {
80
+ // Load persisted entries if enabled
81
+ if (this.config.enablePersistence && this.storage) {
82
+ await this.loadFromStorage();
83
+ }
84
+ // Start retry processor
85
+ this.startRetryProcessor();
86
+ this.emit('dlq:initialized');
87
+ }
88
+ /**
89
+ * Shutdown dead letter queue
90
+ */ async shutdown() {
91
+ // Stop retry processor
92
+ this.stopRetryProcessor();
93
+ // Persist entries if enabled
94
+ if (this.config.enablePersistence && this.storage) {
95
+ await this.saveToStorage();
96
+ }
97
+ this.emit('dlq:shutdown');
98
+ }
99
+ // ===========================
100
+ // Core Operations
101
+ // ===========================
102
+ /**
103
+ * Add failed message to dead letter queue
104
+ *
105
+ * @param message - Failed message
106
+ * @param reason - Failure reason
107
+ * @param target - Delivery target
108
+ * @param error - Error details
109
+ */ async addMessage(message, reason, target, error) {
110
+ const entry = {
111
+ message,
112
+ reason,
113
+ failedAt: new Date(),
114
+ retryAttempts: 0,
115
+ target,
116
+ lastError: error,
117
+ permanentFailure: false
118
+ };
119
+ // Calculate next retry time
120
+ if (entry.retryAttempts < this.config.maxRetries) {
121
+ entry.nextRetryAt = this.calculateNextRetry(entry.retryAttempts);
122
+ } else {
123
+ entry.permanentFailure = true;
124
+ }
125
+ this.entries.set(message.id, entry);
126
+ this.updateStats();
127
+ // Persist if enabled
128
+ if (this.config.enablePersistence && this.storage) {
129
+ await this.storage.addToDeadLetterQueue(this.config.storageId, message);
130
+ }
131
+ this.emit('dlq:message-added', {
132
+ entry
133
+ });
134
+ }
135
+ /**
136
+ * Process retry attempts for pending messages
137
+ *
138
+ * @param retryHandler - Function to attempt message redelivery
139
+ * @returns Number of messages processed
140
+ */ async processRetries(retryHandler) {
141
+ const now = Date.now();
142
+ const entriesToRetry = [];
143
+ // Find entries ready for retry
144
+ for (const entry of this.entries.values()){
145
+ if (!entry.permanentFailure && entry.nextRetryAt && entry.nextRetryAt.getTime() <= now) {
146
+ entriesToRetry.push(entry);
147
+ }
148
+ }
149
+ // Process each retry
150
+ let processedCount = 0;
151
+ for (const entry of entriesToRetry){
152
+ try {
153
+ this.stats.totalRetries++;
154
+ entry.retryAttempts++;
155
+ const result = await retryHandler(entry);
156
+ if (result.success) {
157
+ // Remove from dead letter queue on successful retry
158
+ this.entries.delete(entry.message.id);
159
+ this.stats.successfulRetries++;
160
+ processedCount++;
161
+ this.emit('dlq:retry-success', {
162
+ entry
163
+ });
164
+ } else {
165
+ // Update entry with failure info
166
+ this.stats.failedRetries++;
167
+ entry.lastError = result.error;
168
+ // Check if max retries reached
169
+ if (entry.retryAttempts >= this.config.maxRetries) {
170
+ entry.permanentFailure = true;
171
+ entry.nextRetryAt = undefined;
172
+ this.emit('dlq:permanent-failure', {
173
+ entry
174
+ });
175
+ } else {
176
+ // Schedule next retry
177
+ entry.nextRetryAt = result.nextRetryAt || this.calculateNextRetry(entry.retryAttempts);
178
+ this.emit('dlq:retry-failed', {
179
+ entry
180
+ });
181
+ }
182
+ }
183
+ } catch (error) {
184
+ // Handle unexpected errors during retry
185
+ this.stats.failedRetries++;
186
+ entry.lastError = error instanceof Error ? error.message : String(error);
187
+ if (entry.retryAttempts >= this.config.maxRetries) {
188
+ entry.permanentFailure = true;
189
+ entry.nextRetryAt = undefined;
190
+ } else {
191
+ entry.nextRetryAt = this.calculateNextRetry(entry.retryAttempts);
192
+ }
193
+ this.emit('dlq:retry-error', {
194
+ entry,
195
+ error
196
+ });
197
+ }
198
+ }
199
+ this.updateStats();
200
+ // Persist changes if enabled
201
+ if (this.config.enablePersistence && this.storage && processedCount > 0) {
202
+ await this.saveToStorage();
203
+ }
204
+ return processedCount;
205
+ }
206
+ /**
207
+ * Remove message from dead letter queue
208
+ *
209
+ * @param messageId - Message ID to remove
210
+ * @returns True if message was found and removed
211
+ */ async removeMessage(messageId) {
212
+ const removed = this.entries.delete(messageId);
213
+ if (removed) {
214
+ this.updateStats();
215
+ // Persist if enabled
216
+ if (this.config.enablePersistence && this.storage) {
217
+ await this.saveToStorage();
218
+ }
219
+ this.emit('dlq:message-removed', {
220
+ messageId
221
+ });
222
+ }
223
+ return removed;
224
+ }
225
+ /**
226
+ * Cleanup expired messages based on retention policy
227
+ *
228
+ * @returns Number of messages removed
229
+ */ async cleanup() {
230
+ const cutoffTime = Date.now() - this.config.retentionMs;
231
+ const toRemove = [];
232
+ for (const [id, entry] of this.entries.entries()){
233
+ if (entry.failedAt.getTime() < cutoffTime) {
234
+ toRemove.push(id);
235
+ }
236
+ }
237
+ // Remove expired entries
238
+ for (const id of toRemove){
239
+ this.entries.delete(id);
240
+ }
241
+ if (toRemove.length > 0) {
242
+ this.updateStats();
243
+ // Persist if enabled
244
+ if (this.config.enablePersistence && this.storage) {
245
+ await this.saveToStorage();
246
+ }
247
+ this.emit('dlq:cleanup-complete', {
248
+ removedCount: toRemove.length
249
+ });
250
+ }
251
+ return toRemove.length;
252
+ }
253
+ // ===========================
254
+ // Query Operations
255
+ // ===========================
256
+ /**
257
+ * Get all dead letter entries
258
+ */ getAllEntries() {
259
+ return Array.from(this.entries.values());
260
+ }
261
+ /**
262
+ * Get entry by message ID
263
+ */ getEntry(messageId) {
264
+ return this.entries.get(messageId);
265
+ }
266
+ /**
267
+ * Get permanent failure entries
268
+ */ getPermanentFailures() {
269
+ return Array.from(this.entries.values()).filter((e)=>e.permanentFailure);
270
+ }
271
+ /**
272
+ * Get entries pending retry
273
+ */ getPendingRetries() {
274
+ return Array.from(this.entries.values()).filter((e)=>!e.permanentFailure && e.nextRetryAt);
275
+ }
276
+ /**
277
+ * Get entries by failure reason
278
+ */ getEntriesByReason(reason) {
279
+ return Array.from(this.entries.values()).filter((e)=>e.reason === reason);
280
+ }
281
+ /**
282
+ * Get statistics
283
+ */ getStatistics() {
284
+ return {
285
+ ...this.stats
286
+ };
287
+ }
288
+ // ===========================
289
+ // Private Helpers
290
+ // ===========================
291
+ /**
292
+ * Calculate next retry timestamp with exponential backoff
293
+ */ calculateNextRetry(attemptNumber) {
294
+ // Base delay with exponential backoff
295
+ let delayMs = this.config.initialDelayMs * Math.pow(this.config.backoffMultiplier, attemptNumber);
296
+ // Cap at max delay
297
+ delayMs = Math.min(delayMs, this.config.maxDelayMs);
298
+ // Add jitter if enabled
299
+ if (this.config.enableJitter) {
300
+ const jitter = Math.random() * 0.3 * delayMs; // ±30% jitter
301
+ delayMs = delayMs + jitter - 0.15 * delayMs;
302
+ }
303
+ return new Date(Date.now() + delayMs);
304
+ }
305
+ /**
306
+ * Start retry processor timer
307
+ */ startRetryProcessor() {
308
+ // Check for retries every second
309
+ this.retryTimer = setInterval(()=>{
310
+ this.emit('dlq:retry-check');
311
+ }, 1000);
312
+ }
313
+ /**
314
+ * Stop retry processor timer
315
+ */ stopRetryProcessor() {
316
+ if (this.retryTimer) {
317
+ clearInterval(this.retryTimer);
318
+ this.retryTimer = null;
319
+ }
320
+ }
321
+ /**
322
+ * Load entries from storage
323
+ */ async loadFromStorage() {
324
+ if (!this.storage) return;
325
+ try {
326
+ const state = await this.storage.loadMessages(this.config.storageId);
327
+ // Reconstruct entries from dead letter messages
328
+ for (const message of state.deadLetterMessages){
329
+ const entry = {
330
+ message,
331
+ reason: message.metadata.deadLetterReason || 'unknown',
332
+ failedAt: message.metadata.deadLetterTimestamp || new Date(),
333
+ retryAttempts: 0,
334
+ permanentFailure: false
335
+ };
336
+ // Calculate next retry
337
+ if (entry.retryAttempts < this.config.maxRetries) {
338
+ entry.nextRetryAt = this.calculateNextRetry(entry.retryAttempts);
339
+ } else {
340
+ entry.permanentFailure = true;
341
+ }
342
+ this.entries.set(message.id, entry);
343
+ }
344
+ this.updateStats();
345
+ } catch (error) {
346
+ this.emit('dlq:load-error', {
347
+ error
348
+ });
349
+ }
350
+ }
351
+ /**
352
+ * Save entries to storage
353
+ */ async saveToStorage() {
354
+ if (!this.storage) return;
355
+ try {
356
+ // Load current state
357
+ const state = await this.storage.loadMessages(this.config.storageId);
358
+ // Convert entries to messages
359
+ const deadLetterMessages = Array.from(this.entries.values()).map((entry)=>({
360
+ ...entry.message,
361
+ metadata: {
362
+ ...entry.message.metadata,
363
+ deadLetterReason: entry.reason,
364
+ deadLetterTimestamp: entry.failedAt
365
+ }
366
+ }));
367
+ // Save updated state
368
+ await this.storage.saveMessages(this.config.storageId, state.messages, state.queues, deadLetterMessages);
369
+ } catch (error) {
370
+ this.emit('dlq:save-error', {
371
+ error
372
+ });
373
+ }
374
+ }
375
+ /**
376
+ * Initialize statistics
377
+ */ initializeStats() {
378
+ return {
379
+ totalMessages: 0,
380
+ pendingRetries: 0,
381
+ permanentFailures: 0,
382
+ totalRetries: 0,
383
+ successfulRetries: 0,
384
+ failedRetries: 0,
385
+ averageRetryCount: 0,
386
+ oldestMessageAgeMs: 0
387
+ };
388
+ }
389
+ /**
390
+ * Update statistics from current entries
391
+ */ updateStats() {
392
+ this.stats.totalMessages = this.entries.size;
393
+ this.stats.pendingRetries = 0;
394
+ this.stats.permanentFailures = 0;
395
+ let totalRetryCount = 0;
396
+ let oldestTimestamp = Date.now();
397
+ for (const entry of this.entries.values()){
398
+ if (entry.permanentFailure) {
399
+ this.stats.permanentFailures++;
400
+ } else if (entry.nextRetryAt) {
401
+ this.stats.pendingRetries++;
402
+ }
403
+ totalRetryCount += entry.retryAttempts;
404
+ if (entry.failedAt.getTime() < oldestTimestamp) {
405
+ oldestTimestamp = entry.failedAt.getTime();
406
+ }
407
+ }
408
+ this.stats.averageRetryCount = this.entries.size > 0 ? totalRetryCount / this.entries.size : 0;
409
+ this.stats.oldestMessageAgeMs = this.entries.size > 0 ? Date.now() - oldestTimestamp : 0;
410
+ }
411
+ }
412
+
413
+ //# sourceMappingURL=dead-letter-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/core/dead-letter-queue.ts"],"names":["EventEmitter","DeadLetterQueue","config","storage","entries","Map","retryTimer","stats","maxRetries","initialDelayMs","maxDelayMs","backoffMultiplier","enableJitter","retentionMs","enablePersistence","storageId","initializeStats","initialize","loadFromStorage","startRetryProcessor","emit","shutdown","stopRetryProcessor","saveToStorage","addMessage","message","reason","target","error","entry","failedAt","Date","retryAttempts","lastError","permanentFailure","nextRetryAt","calculateNextRetry","set","id","updateStats","addToDeadLetterQueue","processRetries","retryHandler","now","entriesToRetry","values","getTime","push","processedCount","totalRetries","result","success","delete","successfulRetries","failedRetries","undefined","Error","String","removeMessage","messageId","removed","cleanup","cutoffTime","toRemove","length","removedCount","getAllEntries","Array","from","getEntry","get","getPermanentFailures","filter","e","getPendingRetries","getEntriesByReason","getStatistics","attemptNumber","delayMs","Math","pow","min","jitter","random","setInterval","clearInterval","state","loadMessages","deadLetterMessages","metadata","deadLetterReason","deadLetterTimestamp","map","saveMessages","messages","queues","totalMessages","pendingRetries","permanentFailures","averageRetryCount","oldestMessageAgeMs","size","totalRetryCount","oldestTimestamp"],"mappings":"AAAA;;;;;;;;;;;;CAYC,GAED,SAASA,YAAY,QAAQ,SAAS;AAwHtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCC,GACD,OAAO,MAAMC,wBAAwBD;IAC3BE,OAA8B;IAC9BC,QAA+B;IAC/BC,UAAwC,IAAIC,MAAM;IAClDC,aAAoC,KAAK;IACzCC,MAA4B;IAEpC,YAAYJ,OAA8B,EAAED,SAAyC,CAAC,CAAC,CAAE;QACvF,KAAK;QACL,IAAI,CAACC,OAAO,GAAGA;QACf,IAAI,CAACD,MAAM,GAAG;YACZM,YAAY;YACZC,gBAAgB;YAChBC,YAAY;YACZC,mBAAmB;YACnBC,cAAc;YACdC,aAAa;YACbC,mBAAmB;YACnBC,WAAW;YACX,GAAGb,MAAM;QACX;QACA,IAAI,CAACK,KAAK,GAAG,IAAI,CAACS,eAAe;IACnC;IAEA,8BAA8B;IAC9B,YAAY;IACZ,8BAA8B;IAE9B;;GAEC,GACD,MAAMC,aAA4B;QAChC,oCAAoC;QACpC,IAAI,IAAI,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