claude-flow-novice 1.6.4 → 1.6.6

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 (286) 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/mcp-server-sdk.js +45 -0
  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/shared/core/agent-state.js +172 -0
  224. package/.claude-flow-novice/dist/src/coordination/shared/core/agent-state.js.map +1 -0
  225. package/.claude-flow-novice/dist/src/coordination/shared/core/index.js +7 -0
  226. package/.claude-flow-novice/dist/src/coordination/shared/core/index.js.map +1 -0
  227. package/.claude-flow-novice/dist/src/coordination/shared/index.js +19 -0
  228. package/.claude-flow-novice/dist/src/coordination/shared/index.js.map +1 -0
  229. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js +24 -0
  230. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js.map +1 -0
  231. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js +7 -0
  232. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js.map +1 -0
  233. package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js +920 -0
  234. package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js.map +1 -0
  235. package/.claude-flow-novice/dist/src/coordination/shared/message.js +138 -0
  236. package/.claude-flow-novice/dist/src/coordination/shared/message.js.map +1 -0
  237. package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js +259 -0
  238. package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js.map +1 -0
  239. package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js +17 -0
  240. package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js.map +1 -0
  241. package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js +19 -0
  242. package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js.map +1 -0
  243. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js +357 -0
  244. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js.map +1 -0
  245. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js +679 -0
  246. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js.map +1 -0
  247. package/.claude-flow-novice/dist/src/coordination/shared/types/index.js +7 -0
  248. package/.claude-flow-novice/dist/src/coordination/shared/types/index.js.map +1 -0
  249. package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js +10 -0
  250. package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js.map +1 -0
  251. package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js +52 -2
  252. package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js.map +1 -1
  253. package/.claude-flow-novice/dist/src/mcp/mcp-server-novice.js +37 -2
  254. package/.claude-flow-novice/dist/src/mcp/session-manager.js +3 -1
  255. package/.claude-flow-novice/dist/src/mcp/session-manager.js.map +1 -1
  256. package/.claude-flow-novice/dist/src/providers/provider-manager.js +36 -3
  257. package/.claude-flow-novice/dist/src/providers/provider-manager.js.map +1 -1
  258. package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js +65 -41
  259. package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js.map +1 -1
  260. package/.claude-flow-novice/dist/src/web/api/server.js +1 -1
  261. package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -1
  262. package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js +30 -0
  263. package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js.map +1 -1
  264. package/.claude-flow-novice/metrics.db-shm +0 -0
  265. package/.claude-flow-novice/metrics.db-wal +0 -0
  266. package/config/.env.example +178 -0
  267. package/config/DEPLOYMENT_GUIDE.md +692 -0
  268. package/config/README-CONFIG.md +331 -0
  269. package/config/coordination-config.sh +327 -0
  270. package/config/docker/env.development +53 -0
  271. package/config/docker/env.production +83 -0
  272. package/config/docker/env.staging +70 -0
  273. package/config/k8s/configmap-development.yaml +60 -0
  274. package/config/k8s/configmap-production.yaml +85 -0
  275. package/config/k8s/configmap-staging.yaml +76 -0
  276. package/config/k8s/secret-production.yaml +62 -0
  277. package/config/k8s/secret-staging.yaml +36 -0
  278. package/package.json +2 -2
  279. package/scripts/monitoring/alert-monitor.sh +220 -0
  280. package/scripts/monitoring/dashboards/rate-limiting-dashboard.json +211 -0
  281. package/scripts/monitoring/quick-test-alerting.sh +118 -0
  282. package/scripts/monitoring/quick-test-rate-limiting.sh +206 -0
  283. package/scripts/monitoring/rate-limiting-monitor.sh +380 -0
  284. package/scripts/monitoring/view-alerts.sh +307 -0
  285. package/scripts/test-zai-api.cjs +2 -2
  286. package/src/slash-commands/parse-epic.js +1 -1
@@ -0,0 +1,443 @@
1
+ /**
2
+ * Agent Coordination V2 - SDK Completion Detector
3
+ *
4
+ * Event-driven completion detection with checkpoint validation and recovery.
5
+ * Zero polling overhead - listens to session lifecycle events.
6
+ *
7
+ * Features:
8
+ * - Event-driven detection (SessionManager.on('session_completed'))
9
+ * - Zero polling overhead (push-based notifications)
10
+ * - Checkpoint validation before declaring completion
11
+ * - <500ms recovery from checkpoint (p99)
12
+ * - Multi-level hierarchy support (10+ nested levels)
13
+ *
14
+ * @module coordination/v2/completion/sdk-completion-detector
15
+ */ import { EventEmitter } from 'node:events';
16
+ import { AgentState } from '../../shared/core/agent-state.js';
17
+ /**
18
+ * SDKCompletionDetector - Event-driven completion detection with checkpoint validation
19
+ *
20
+ * Workflow:
21
+ * 1. Listen for 'session_completed' events from StateSDKIntegration
22
+ * 2. Validate all checkpoints for completeness and integrity
23
+ * 3. If validation fails, attempt recovery from last valid checkpoint
24
+ * 4. Emit 'completion:validated' or 'completion:failed' events
25
+ *
26
+ * Performance targets:
27
+ * - Validation: <100ms for single swarm
28
+ * - Recovery: <500ms (p99)
29
+ * - Multi-level support: 10+ nested hierarchy levels
30
+ */ export class SDKCompletionDetector extends EventEmitter {
31
+ checkpointManager;
32
+ queryController;
33
+ stateSDKIntegration;
34
+ config;
35
+ metrics;
36
+ validationLatencies = [];
37
+ recoveryLatencies = [];
38
+ hierarchyTracking = new Map();
39
+ initialized = false;
40
+ constructor(checkpointManager, queryController, stateSDKIntegration, config = {}){
41
+ super();
42
+ this.checkpointManager = checkpointManager;
43
+ this.queryController = queryController;
44
+ this.stateSDKIntegration = stateSDKIntegration;
45
+ this.config = {
46
+ checkpointValidationTimeoutMs: config.checkpointValidationTimeoutMs ?? 100,
47
+ checkpointRecoveryTimeoutMs: config.checkpointRecoveryTimeoutMs ?? 500,
48
+ strictValidation: config.strictValidation ?? true,
49
+ maxHierarchyDepth: config.maxHierarchyDepth ?? 10,
50
+ autoRecovery: config.autoRecovery ?? true,
51
+ enableLogging: config.enableLogging ?? false
52
+ };
53
+ this.metrics = this.initializeMetrics();
54
+ }
55
+ /**
56
+ * Initialize detector and set up event listeners
57
+ */ async initialize() {
58
+ if (this.initialized) {
59
+ return;
60
+ }
61
+ // Listen for session completion events from StateSDKIntegration
62
+ this.stateSDKIntegration.on('state_change', async (eventData)=>{
63
+ // Detect when agent transitions to COMPLETED state
64
+ if (eventData.to === AgentState.COMPLETED) {
65
+ await this.handleAgentCompletion(eventData);
66
+ }
67
+ });
68
+ // Listen for session lifecycle events
69
+ this.stateSDKIntegration.on('session:completed', async (data)=>{
70
+ await this.handleSessionCompletion(data.sessionId, data.swarmId, data.hierarchyLevel ?? 0);
71
+ });
72
+ // Listen for swarm completion events
73
+ this.stateSDKIntegration.on('swarm:all_completed', async (data)=>{
74
+ await this.handleSwarmCompletion(data.swarmId, data.hierarchyLevel ?? 0);
75
+ });
76
+ this.initialized = true;
77
+ if (this.config.enableLogging) {
78
+ console.log('✅ SDKCompletionDetector initialized');
79
+ }
80
+ }
81
+ /**
82
+ * Handle individual agent completion
83
+ *
84
+ * @param eventData - Agent completion event data
85
+ */ async handleAgentCompletion(eventData) {
86
+ try {
87
+ // Get all active sessions to find the one with matching sessionId
88
+ const activeSessions = this.queryController.getActiveSessions();
89
+ const session = activeSessions.find((s)=>s.sessionId === eventData.sessionId);
90
+ if (!session) {
91
+ return;
92
+ }
93
+ // Get all sessions in the same swarm
94
+ const swarmId = session.metadata?.swarmId;
95
+ if (!swarmId) {
96
+ return;
97
+ }
98
+ // Check if all agents in swarm are completed
99
+ const allCompleted = await this.checkSwarmCompletion(swarmId);
100
+ if (allCompleted) {
101
+ const hierarchyLevel = session.metadata?.hierarchyLevel ?? 0;
102
+ this.emit('swarm:all_completed', {
103
+ swarmId,
104
+ hierarchyLevel
105
+ });
106
+ }
107
+ } catch (error) {
108
+ console.error('❌ Error handling agent completion:', error);
109
+ }
110
+ }
111
+ /**
112
+ * Handle session completion event
113
+ */ async handleSessionCompletion(sessionId, swarmId, hierarchyLevel) {
114
+ this.metrics.totalCompletionsDetected++;
115
+ try {
116
+ // Validate completion with checkpoint verification
117
+ const validationResult = await this.validateCompletionCheckpoint(swarmId);
118
+ if (validationResult.isValid) {
119
+ this.metrics.totalSuccessfulValidations++;
120
+ this.emit('completion:validated', validationResult);
121
+ if (this.config.enableLogging) {
122
+ console.log(`✅ Completion validated for swarm ${swarmId} (level ${hierarchyLevel})`);
123
+ }
124
+ } else {
125
+ this.metrics.totalFailedValidations++;
126
+ if (this.config.autoRecovery) {
127
+ // Attempt recovery from checkpoint
128
+ const recoveryResult = await this.recoverFromCheckpoint(swarmId);
129
+ if (recoveryResult.success) {
130
+ this.emit('completion:recovered', recoveryResult);
131
+ if (this.config.enableLogging) {
132
+ console.log(`🔄 Recovered swarm ${swarmId} from checkpoint`);
133
+ }
134
+ } else {
135
+ this.emit('completion:failed', {
136
+ validationResult,
137
+ recoveryResult
138
+ });
139
+ console.error(`❌ Completion validation and recovery failed for swarm ${swarmId}`);
140
+ }
141
+ } else {
142
+ this.emit('completion:failed', {
143
+ validationResult
144
+ });
145
+ console.error(`❌ Completion validation failed for swarm ${swarmId}`);
146
+ }
147
+ }
148
+ } catch (error) {
149
+ console.error(`❌ Error handling session completion for ${swarmId}:`, error);
150
+ this.emit('completion:error', {
151
+ swarmId,
152
+ error
153
+ });
154
+ }
155
+ }
156
+ /**
157
+ * Handle swarm completion event
158
+ */ async handleSwarmCompletion(swarmId, hierarchyLevel) {
159
+ await this.handleSessionCompletion(`swarm_${swarmId}`, swarmId, hierarchyLevel);
160
+ }
161
+ /**
162
+ * Validate completion checkpoint
163
+ *
164
+ * Checks:
165
+ * 1. All agents in COMPLETED state
166
+ * 2. All checkpoints exist and are valid
167
+ * 3. Checkpoint integrity (checksums)
168
+ * 4. No pending dependencies
169
+ */ async validateCompletionCheckpoint(swarmId) {
170
+ const startTime = performance.now();
171
+ this.metrics.totalValidations++;
172
+ const result = {
173
+ swarmId,
174
+ isValid: false,
175
+ allAgentsCompleted: false,
176
+ allCheckpointsValid: false,
177
+ checkpointResults: new Map(),
178
+ validationTimeMs: 0,
179
+ hierarchyLevel: this.hierarchyTracking.get(swarmId) ?? 0,
180
+ errors: []
181
+ };
182
+ try {
183
+ // Get all sessions for swarm
184
+ const sessions = await this.getSwarmSessions(swarmId);
185
+ if (sessions.length === 0) {
186
+ result.errors.push('No sessions found for swarm');
187
+ return result;
188
+ }
189
+ // Check if all agents are in COMPLETED state
190
+ result.allAgentsCompleted = sessions.every((session)=>session.state === AgentState.COMPLETED);
191
+ if (!result.allAgentsCompleted) {
192
+ result.errors.push('Not all agents in COMPLETED state');
193
+ }
194
+ // Validate checkpoints for each agent
195
+ const checkpointValidations = await Promise.all(sessions.map((session)=>this.validateAgentCheckpoint(session)));
196
+ for (const validation of checkpointValidations){
197
+ result.checkpointResults.set(validation.agentId, validation);
198
+ if (!validation.isValid) {
199
+ result.errors.push(`Checkpoint validation failed for agent ${validation.agentId}: ${validation.error}`);
200
+ }
201
+ }
202
+ result.allCheckpointsValid = checkpointValidations.every((v)=>v.isValid);
203
+ // Overall validation passes if:
204
+ // - All agents completed
205
+ // - All checkpoints valid (or strictValidation disabled)
206
+ result.isValid = result.allAgentsCompleted && (result.allCheckpointsValid || !this.config.strictValidation);
207
+ const validationTime = performance.now() - startTime;
208
+ result.validationTimeMs = validationTime;
209
+ // Update metrics
210
+ this.validationLatencies.push(validationTime);
211
+ this.metrics.averageValidationTimeMs = (this.metrics.averageValidationTimeMs * (this.metrics.totalValidations - 1) + validationTime) / this.metrics.totalValidations;
212
+ this.updatePercentileMetrics();
213
+ // Verify performance target
214
+ if (validationTime > this.config.checkpointValidationTimeoutMs) {
215
+ console.warn(`⚠️ Checkpoint validation exceeded target: ${validationTime.toFixed(2)}ms (target: ${this.config.checkpointValidationTimeoutMs}ms)`);
216
+ }
217
+ // Track hierarchy depth
218
+ const hierarchyLevel = result.hierarchyLevel;
219
+ if (hierarchyLevel > this.metrics.maxHierarchyDepth) {
220
+ this.metrics.maxHierarchyDepth = hierarchyLevel;
221
+ }
222
+ return result;
223
+ } catch (error) {
224
+ result.errors.push(`Validation error: ${error}`);
225
+ result.validationTimeMs = performance.now() - startTime;
226
+ return result;
227
+ }
228
+ }
229
+ /**
230
+ * Validate checkpoint for individual agent
231
+ */ async validateAgentCheckpoint(session) {
232
+ const startTime = performance.now();
233
+ const result = {
234
+ checkpointId: '',
235
+ agentId: session.agentId,
236
+ isValid: false,
237
+ state: session.state,
238
+ latencyMs: 0
239
+ };
240
+ try {
241
+ // Get latest checkpoint for session
242
+ const checkpoint = await this.checkpointManager.getLatestCheckpoint(session.sessionId);
243
+ if (!checkpoint) {
244
+ result.error = 'No checkpoint found';
245
+ result.latencyMs = performance.now() - startTime;
246
+ return result;
247
+ }
248
+ result.checkpointId = checkpoint.id;
249
+ // Verify checkpoint integrity
250
+ const integrityValid = await this.checkpointManager.verifyCheckpointIntegrity(checkpoint.id);
251
+ if (!integrityValid) {
252
+ result.error = 'Checkpoint integrity check failed';
253
+ result.latencyMs = performance.now() - startTime;
254
+ return result;
255
+ }
256
+ // Verify checkpoint state matches session state
257
+ if (checkpoint.state !== session.state) {
258
+ result.error = `State mismatch: checkpoint=${checkpoint.state}, session=${session.state}`;
259
+ result.latencyMs = performance.now() - startTime;
260
+ return result;
261
+ }
262
+ // Verify no pending dependencies
263
+ const pendingDeps = checkpoint.metadata?.pendingDependencies || [];
264
+ if (pendingDeps.length > 0) {
265
+ result.error = `Pending dependencies: ${pendingDeps.join(', ')}`;
266
+ result.latencyMs = performance.now() - startTime;
267
+ return result;
268
+ }
269
+ result.isValid = true;
270
+ result.latencyMs = performance.now() - startTime;
271
+ return result;
272
+ } catch (error) {
273
+ result.error = `Validation exception: ${error}`;
274
+ result.latencyMs = performance.now() - startTime;
275
+ return result;
276
+ }
277
+ }
278
+ /**
279
+ * Recover from checkpoint after validation failure
280
+ *
281
+ * Recovery strategy:
282
+ * 1. Find last valid checkpoint for each agent
283
+ * 2. Restore agents to checkpoint state
284
+ * 3. Resume execution from checkpoint
285
+ *
286
+ * Target: <500ms recovery time (p99)
287
+ */ async recoverFromCheckpoint(swarmId) {
288
+ const startTime = performance.now();
289
+ this.metrics.totalRecoveries++;
290
+ const result = {
291
+ success: false,
292
+ swarmId,
293
+ recoveredAgents: [],
294
+ recoveryTimeMs: 0,
295
+ errors: []
296
+ };
297
+ try {
298
+ // Get all sessions for swarm
299
+ const sessions = await this.getSwarmSessions(swarmId);
300
+ // Attempt recovery for each agent
301
+ for (const session of sessions){
302
+ try {
303
+ // Get latest valid checkpoint
304
+ const checkpoint = await this.checkpointManager.getLatestCheckpoint(session.sessionId);
305
+ if (!checkpoint) {
306
+ result.errors.push(`No checkpoint found for agent ${session.agentId}`);
307
+ continue;
308
+ }
309
+ // Restore checkpoint
310
+ const restoreResult = await this.checkpointManager.restoreCheckpoint(checkpoint.id);
311
+ if (!restoreResult.success) {
312
+ result.errors.push(`Restore failed for agent ${session.agentId}`);
313
+ continue;
314
+ }
315
+ // Resume session from checkpoint
316
+ await this.queryController.resumeSessionAt(session.sessionId, checkpoint.messageUUID);
317
+ result.recoveredAgents.push(session.agentId);
318
+ result.checkpointId = checkpoint.id;
319
+ } catch (error) {
320
+ result.errors.push(`Recovery failed for agent ${session.agentId}: ${error}`);
321
+ }
322
+ }
323
+ result.success = result.recoveredAgents.length === sessions.length;
324
+ result.recoveryTimeMs = performance.now() - startTime;
325
+ // Update metrics
326
+ if (result.success) {
327
+ this.metrics.totalSuccessfulRecoveries++;
328
+ }
329
+ this.recoveryLatencies.push(result.recoveryTimeMs);
330
+ this.metrics.averageRecoveryTimeMs = (this.metrics.averageRecoveryTimeMs * (this.metrics.totalRecoveries - 1) + result.recoveryTimeMs) / this.metrics.totalRecoveries;
331
+ this.updateRecoveryPercentiles();
332
+ // Verify performance target (p99 < 500ms)
333
+ if (result.recoveryTimeMs > this.config.checkpointRecoveryTimeoutMs) {
334
+ console.warn(`⚠️ Checkpoint recovery exceeded target: ${result.recoveryTimeMs.toFixed(2)}ms (target: ${this.config.checkpointRecoveryTimeoutMs}ms)`);
335
+ }
336
+ return result;
337
+ } catch (error) {
338
+ result.errors.push(`Recovery error: ${error}`);
339
+ result.recoveryTimeMs = performance.now() - startTime;
340
+ return result;
341
+ }
342
+ }
343
+ /**
344
+ * Check if all agents in swarm are completed
345
+ */ async checkSwarmCompletion(swarmId) {
346
+ const sessions = await this.getSwarmSessions(swarmId);
347
+ return sessions.length > 0 && sessions.every((s)=>s.state === AgentState.COMPLETED);
348
+ }
349
+ /**
350
+ * Get all sessions for a swarm
351
+ */ async getSwarmSessions(swarmId) {
352
+ // Get all sessions (active and paused) by swarm ID from metadata
353
+ const activeSessions = this.queryController.getActiveSessions();
354
+ const pausedSessions = this.queryController.getPausedSessions();
355
+ const allSessions = [
356
+ ...activeSessions,
357
+ ...pausedSessions
358
+ ];
359
+ return allSessions.filter((session)=>session.metadata?.swarmId === swarmId);
360
+ }
361
+ /**
362
+ * Register swarm hierarchy level
363
+ */ registerSwarm(swarmId, hierarchyLevel) {
364
+ this.hierarchyTracking.set(swarmId, hierarchyLevel);
365
+ if (hierarchyLevel > this.config.maxHierarchyDepth) {
366
+ console.warn(`⚠️ Swarm hierarchy level ${hierarchyLevel} exceeds maximum ${this.config.maxHierarchyDepth}`);
367
+ }
368
+ }
369
+ /**
370
+ * Get completion detector metrics
371
+ */ getMetrics() {
372
+ return {
373
+ ...this.metrics
374
+ };
375
+ }
376
+ /**
377
+ * Update percentile metrics for validation latency
378
+ */ updatePercentileMetrics() {
379
+ if (this.validationLatencies.length === 0) return;
380
+ const sorted = [
381
+ ...this.validationLatencies
382
+ ].sort((a, b)=>a - b);
383
+ const p95Index = Math.floor(sorted.length * 0.95);
384
+ const p99Index = Math.floor(sorted.length * 0.99);
385
+ this.metrics.p95ValidationTimeMs = sorted[p95Index] || 0;
386
+ this.metrics.p99ValidationTimeMs = sorted[p99Index] || 0;
387
+ // Keep only last 1000 samples
388
+ if (this.validationLatencies.length > 1000) {
389
+ this.validationLatencies = this.validationLatencies.slice(-1000);
390
+ }
391
+ }
392
+ /**
393
+ * Update percentile metrics for recovery latency
394
+ */ updateRecoveryPercentiles() {
395
+ if (this.recoveryLatencies.length === 0) return;
396
+ const sorted = [
397
+ ...this.recoveryLatencies
398
+ ].sort((a, b)=>a - b);
399
+ const p99Index = Math.floor(sorted.length * 0.99);
400
+ this.metrics.p99RecoveryTimeMs = sorted[p99Index] || 0;
401
+ // Keep only last 1000 samples
402
+ if (this.recoveryLatencies.length > 1000) {
403
+ this.recoveryLatencies = this.recoveryLatencies.slice(-1000);
404
+ }
405
+ }
406
+ /**
407
+ * Initialize metrics
408
+ */ initializeMetrics() {
409
+ return {
410
+ totalCompletionsDetected: 0,
411
+ totalValidations: 0,
412
+ totalSuccessfulValidations: 0,
413
+ totalFailedValidations: 0,
414
+ totalRecoveries: 0,
415
+ totalSuccessfulRecoveries: 0,
416
+ averageValidationTimeMs: 0,
417
+ averageRecoveryTimeMs: 0,
418
+ p95ValidationTimeMs: 0,
419
+ p99ValidationTimeMs: 0,
420
+ p99RecoveryTimeMs: 0,
421
+ maxHierarchyDepth: 0
422
+ };
423
+ }
424
+ /**
425
+ * Check if detector is ready
426
+ */ isReady() {
427
+ return this.initialized;
428
+ }
429
+ /**
430
+ * Cleanup resources
431
+ */ async cleanup() {
432
+ this.removeAllListeners();
433
+ this.hierarchyTracking.clear();
434
+ this.validationLatencies = [];
435
+ this.recoveryLatencies = [];
436
+ this.initialized = false;
437
+ if (this.config.enableLogging) {
438
+ console.log('✅ SDKCompletionDetector cleaned up');
439
+ }
440
+ }
441
+ }
442
+
443
+ //# sourceMappingURL=sdk-completion-detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/completion/sdk-completion-detector.ts"],"names":["EventEmitter","AgentState","SDKCompletionDetector","checkpointManager","queryController","stateSDKIntegration","config","metrics","validationLatencies","recoveryLatencies","hierarchyTracking","Map","initialized","checkpointValidationTimeoutMs","checkpointRecoveryTimeoutMs","strictValidation","maxHierarchyDepth","autoRecovery","enableLogging","initializeMetrics","initialize","on","eventData","to","COMPLETED","handleAgentCompletion","data","handleSessionCompletion","sessionId","swarmId","hierarchyLevel","handleSwarmCompletion","console","log","activeSessions","getActiveSessions","session","find","s","metadata","allCompleted","checkSwarmCompletion","emit","error","totalCompletionsDetected","validationResult","validateCompletionCheckpoint","isValid","totalSuccessfulValidations","totalFailedValidations","recoveryResult","recoverFromCheckpoint","success","startTime","performance","now","totalValidations","result","allAgentsCompleted","allCheckpointsValid","checkpointResults","validationTimeMs","get","errors","sessions","getSwarmSessions","length","push","every","state","checkpointValidations","Promise","all","map","validateAgentCheckpoint","validation","set","agentId","v","validationTime","averageValidationTimeMs","updatePercentileMetrics","warn","toFixed","checkpointId","latencyMs","checkpoint","getLatestCheckpoint","id","integrityValid","verifyCheckpointIntegrity","pendingDeps","pendingDependencies","join","totalRecoveries","recoveredAgents","recoveryTimeMs","restoreResult","restoreCheckpoint","resumeSessionAt","messageUUID","totalSuccessfulRecoveries","averageRecoveryTimeMs","updateRecoveryPercentiles","pausedSessions","getPausedSessions","allSessions","filter","registerSwarm","getMetrics","sorted","sort","a","b","p95Index","Math","floor","p99Index","p95ValidationTimeMs","p99ValidationTimeMs","slice","p99RecoveryTimeMs","isReady","cleanup","removeAllListeners","clear"],"mappings":"AAAA;;;;;;;;;;;;;;CAcC,GAED,SAASA,YAAY,QAAQ,cAAc;AAI3C,SAASC,UAAU,QAAQ,mCAAmC;AA2K9D;;;;;;;;;;;;;CAaC,GACD,OAAO,MAAMC,8BAA8BF;IACxBG,kBAAqC;IACrCC,gBAAiC;IACjCC,oBAAyC;IACzCC,OAA8C;IAEvDC,QAAmC;IACnCC,sBAAgC,EAAE,CAAC;IACnCC,oBAA8B,EAAE,CAAC;IACjCC,oBAAyC,IAAIC,MAAM;IACnDC,cAAuB,MAAM;IAErC,YACET,iBAAoC,EACpCC,eAAgC,EAChCC,mBAAwC,EACxCC,SAAsC,CAAC,CAAC,CACxC;QACA,KAAK;QAEL,IAAI,CAACH,iBAAiB,GAAGA;QACzB,IAAI,CAACC,eAAe,GAAGA;QACvB,IAAI,CAACC,mBAAmB,GAAGA;QAE3B,IAAI,CAACC,MAAM,GAAG;YACZO,+BAA+BP,OAAOO,6BAA6B,IAAI;YACvEC,6BAA6BR,OAAOQ,2BAA2B,IAAI;YACnEC,kBAAkBT,OAAOS,gBAAgB,IAAI;YAC7CC,mBAAmBV,OAAOU,iBAAiB,IAAI;YAC/CC,cAAcX,OAAOW,YAAY,IAAI;YACrCC,eAAeZ,OAAOY,aAAa,IAAI;QACzC;QAEA,IAAI,CAACX,OAAO,GAAG,IAAI,CAACY,iBAAiB;IACvC;IAEA;;GAE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