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,335 @@
1
+ /**
2
+ * Agent Coordination V2 - Dependency Resolver Implementation
3
+ *
4
+ * Provides dependency resolution with:
5
+ * - Full topological resolution (<100ms for 100 tasks)
6
+ * - Incremental batch resolution for concurrent execution
7
+ * - Critical path analysis for minimum execution time estimation
8
+ * - Parallelization factor calculation for agent pool sizing
9
+ * - Comprehensive validation with cycle detection
10
+ *
11
+ * @module coordination/v2/core/dependency-resolver
12
+ */ import { DependencyNodeStatus } from './dependency-node.js';
13
+ /**
14
+ * Dependency Resolver for DAG-based task scheduling.
15
+ *
16
+ * Provides efficient dependency resolution algorithms with performance targets:
17
+ * - Full resolution: <100ms for 100 tasks
18
+ * - Incremental resolution: <10ms per batch
19
+ * - Critical path analysis: <50ms for 100 tasks
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const resolver = new DependencyResolver(graph);
24
+ *
25
+ * // Validate resolution is possible
26
+ * const validation = resolver.canResolve();
27
+ * if (!validation.success) {
28
+ * console.error('Blockers:', validation.blockers);
29
+ * }
30
+ *
31
+ * // Get next batch of ready tasks
32
+ * const batch = resolver.getNextBatch(5);
33
+ *
34
+ * // Analyze critical path
35
+ * const criticalPath = resolver.getCriticalPath();
36
+ * console.log('Min execution time:', criticalPath.estimatedDuration);
37
+ * ```
38
+ */ export class DependencyResolver {
39
+ graph;
40
+ /**
41
+ * Creates a new dependency resolver.
42
+ *
43
+ * @param graph - Dependency graph to resolve
44
+ */ constructor(graph){
45
+ this.graph = graph;
46
+ }
47
+ // ============================================
48
+ // Full Resolution
49
+ // ============================================
50
+ /**
51
+ * Performs full topological resolution of the dependency graph.
52
+ *
53
+ * Returns all nodes in dependency order (dependencies before dependents).
54
+ * Target: <100ms for 100 tasks.
55
+ *
56
+ * @returns Array of nodes in topological order
57
+ * @throws {DependencyGraphError} If graph contains cycles
58
+ */ resolve() {
59
+ const startTime = performance.now();
60
+ // Use graph's topological sort (already optimized with Kahn's algorithm)
61
+ const sortedIds = this.graph.getTopologicalOrder();
62
+ // Map IDs to nodes
63
+ const result = sortedIds.map((id)=>{
64
+ const node = this.graph.getNode(id);
65
+ if (!node) {
66
+ throw new Error(`Node ${id} not found in graph during resolution`);
67
+ }
68
+ return node;
69
+ });
70
+ const duration = performance.now() - startTime;
71
+ // Performance validation
72
+ if (duration > 100 && this.graph.size() === 100) {
73
+ console.warn(`Dependency resolution exceeded 100ms target: ${duration.toFixed(2)}ms for ${this.graph.size()} nodes`);
74
+ }
75
+ return result;
76
+ }
77
+ // ============================================
78
+ // Incremental Resolution
79
+ // ============================================
80
+ /**
81
+ * Gets the next batch of ready tasks for execution.
82
+ *
83
+ * Returns tasks with all dependencies satisfied, limited by maxConcurrency.
84
+ * Tasks are sorted by priority (highest first).
85
+ *
86
+ * @param maxConcurrency - Maximum number of tasks to return
87
+ * @returns Array of ready tasks (up to maxConcurrency)
88
+ */ getNextBatch(maxConcurrency) {
89
+ if (maxConcurrency < 1) {
90
+ throw new Error('maxConcurrency must be at least 1');
91
+ }
92
+ // Get ready tasks from graph (already sorted by priority)
93
+ const ready = this.graph.getReadyTasks();
94
+ // Return up to maxConcurrency tasks
95
+ return ready.slice(0, maxConcurrency);
96
+ }
97
+ // ============================================
98
+ // Critical Path Analysis
99
+ // ============================================
100
+ /**
101
+ * Analyzes the critical path through the dependency graph.
102
+ *
103
+ * The critical path is the longest dependency chain, which determines
104
+ * the minimum possible execution time for the entire graph.
105
+ *
106
+ * This is useful for:
107
+ * - Estimating minimum execution time
108
+ * - Identifying bottleneck tasks
109
+ * - Optimizing task priorities
110
+ *
111
+ * @returns Critical path analysis result
112
+ */ getCriticalPath() {
113
+ const nodes = this.graph.getAllNodes();
114
+ if (nodes.length === 0) {
115
+ return {
116
+ path: [],
117
+ estimatedDuration: 0,
118
+ depth: 0
119
+ };
120
+ }
121
+ // Build depth map: node -> maximum depth from root
122
+ const depthMap = new Map();
123
+ const pathMap = new Map(); // node -> path to node
124
+ // Initialize all nodes to depth 0
125
+ for (const node of nodes){
126
+ depthMap.set(node.id, 0);
127
+ pathMap.set(node.id, [
128
+ node.id
129
+ ]);
130
+ }
131
+ // Process nodes in topological order
132
+ const sortedIds = this.graph.getTopologicalOrder();
133
+ for (const nodeId of sortedIds){
134
+ const node = this.graph.getNode(nodeId);
135
+ const currentDepth = depthMap.get(nodeId);
136
+ const currentPath = pathMap.get(nodeId);
137
+ // Update all dependents
138
+ const dependents = this.graph.getDependents(nodeId);
139
+ for (const dependentId of dependents){
140
+ const dependentNode = this.graph.getNode(dependentId);
141
+ const newDepth = currentDepth + 1; // Each node adds 1 to depth
142
+ const existingDepth = depthMap.get(dependentId);
143
+ // Update if this path is longer
144
+ if (newDepth > existingDepth) {
145
+ depthMap.set(dependentId, newDepth);
146
+ pathMap.set(dependentId, [
147
+ ...currentPath,
148
+ dependentId
149
+ ]);
150
+ }
151
+ }
152
+ }
153
+ // Find node with maximum depth (end of critical path)
154
+ let maxDepth = 0;
155
+ let criticalNodeId = sortedIds[0];
156
+ for (const [nodeId, depth] of depthMap){
157
+ if (depth > maxDepth) {
158
+ maxDepth = depth;
159
+ criticalNodeId = nodeId;
160
+ }
161
+ }
162
+ // Reconstruct critical path
163
+ const criticalPathIds = pathMap.get(criticalNodeId);
164
+ const criticalPathNodes = criticalPathIds.map((id)=>this.graph.getNode(id));
165
+ // Estimate duration (sum of priorities as proxy for execution time)
166
+ const estimatedDuration = criticalPathNodes.reduce((sum, node)=>sum + node.priority, 0);
167
+ return {
168
+ path: criticalPathNodes,
169
+ estimatedDuration,
170
+ depth: maxDepth
171
+ };
172
+ }
173
+ /**
174
+ * Calculates the parallelization factor for the graph.
175
+ *
176
+ * This is the maximum number of tasks that can run concurrently,
177
+ * useful for sizing the agent pool.
178
+ *
179
+ * Algorithm:
180
+ * 1. Group nodes by depth level in topological order
181
+ * 2. Find the level with the most nodes
182
+ * 3. Return that count as max parallelization
183
+ *
184
+ * @returns Maximum number of tasks that can run concurrently
185
+ */ getParallelizationFactor() {
186
+ const nodes = this.graph.getAllNodes();
187
+ if (nodes.length === 0) {
188
+ return 0;
189
+ }
190
+ // Build level map: depth -> count of nodes at that depth
191
+ const levelCounts = new Map();
192
+ // Calculate depth for each node
193
+ const depthMap = new Map();
194
+ const sortedIds = this.graph.getTopologicalOrder();
195
+ // Initialize
196
+ for (const nodeId of sortedIds){
197
+ depthMap.set(nodeId, 0);
198
+ }
199
+ // Calculate depths
200
+ for (const nodeId of sortedIds){
201
+ const dependencies = this.graph.getDependencies(nodeId);
202
+ if (dependencies.size === 0) {
203
+ depthMap.set(nodeId, 0);
204
+ } else {
205
+ // Depth is 1 + max depth of dependencies
206
+ let maxDepDepth = -1;
207
+ for (const depId of dependencies){
208
+ const depDepth = depthMap.get(depId) ?? 0;
209
+ maxDepDepth = Math.max(maxDepDepth, depDepth);
210
+ }
211
+ depthMap.set(nodeId, maxDepDepth + 1);
212
+ }
213
+ }
214
+ // Count nodes at each level
215
+ for (const depth of depthMap.values()){
216
+ levelCounts.set(depth, (levelCounts.get(depth) ?? 0) + 1);
217
+ }
218
+ // Find maximum count
219
+ let maxParallel = 0;
220
+ for (const count of levelCounts.values()){
221
+ maxParallel = Math.max(maxParallel, count);
222
+ }
223
+ return maxParallel;
224
+ }
225
+ // ============================================
226
+ // Validation
227
+ // ============================================
228
+ /**
229
+ * Validates that the dependency graph can be resolved.
230
+ *
231
+ * Checks for:
232
+ * - Circular dependencies (cycles)
233
+ * - Orphaned tasks (no path from root nodes)
234
+ * - Invalid node references
235
+ * - Graph consistency
236
+ *
237
+ * @returns Validation result with blockers and warnings
238
+ */ canResolve() {
239
+ const blockers = [];
240
+ const warnings = [];
241
+ // 1. Check for cycles
242
+ const cycleResult = this.graph.detectCycles();
243
+ if (cycleResult.hasCycle) {
244
+ blockers.push(`Circular dependency detected: ${cycleResult.cycles.map((c)=>c.join(' -> ')).join(', ')}`);
245
+ }
246
+ // 2. Check graph integrity
247
+ const graphErrors = this.graph.validate();
248
+ if (graphErrors.length > 0) {
249
+ blockers.push(...graphErrors.map((err)=>`Graph integrity error: ${err}`));
250
+ }
251
+ // 3. Check for orphaned tasks (nodes with no path to root)
252
+ const orphanedNodes = this.findOrphanedNodes();
253
+ if (orphanedNodes.length > 0) {
254
+ warnings.push(`Found ${orphanedNodes.length} orphaned nodes: ${orphanedNodes.slice(0, 5).join(', ')}${orphanedNodes.length > 5 ? '...' : ''}`);
255
+ }
256
+ // 4. Check for nodes in terminal failure state
257
+ const failedNodes = this.graph.getAllNodes().filter((node)=>node.status === DependencyNodeStatus.FAILED);
258
+ if (failedNodes.length > 0) {
259
+ warnings.push(`${failedNodes.length} nodes in FAILED state: ${failedNodes.slice(0, 3).map((n)=>n.id).join(', ')}${failedNodes.length > 3 ? '...' : ''}`);
260
+ }
261
+ // 5. Check for tasks with unresolvable dependencies
262
+ const unresolvableTasks = this.findUnresolvableTasks();
263
+ if (unresolvableTasks.length > 0) {
264
+ blockers.push(`Tasks with failed dependencies: ${unresolvableTasks.slice(0, 5).join(', ')}${unresolvableTasks.length > 5 ? ` (and ${unresolvableTasks.length - 5} more)` : ''}`);
265
+ }
266
+ return {
267
+ success: blockers.length === 0,
268
+ blockers,
269
+ warnings: warnings.length > 0 ? warnings : undefined
270
+ };
271
+ }
272
+ // ============================================
273
+ // Private Helper Methods
274
+ // ============================================
275
+ /**
276
+ * Finds orphaned nodes (no path from root nodes).
277
+ *
278
+ * A node is orphaned if:
279
+ * - It has dependencies BUT none of its dependencies exist in the graph
280
+ * - This typically indicates a graph construction error
281
+ *
282
+ * @returns Array of orphaned node IDs
283
+ */ findOrphanedNodes() {
284
+ const orphaned = [];
285
+ for (const node of this.graph.getAllNodes()){
286
+ const deps = this.graph.getDependencies(node.id);
287
+ if (deps.size > 0) {
288
+ // Check if any dependencies exist
289
+ let hasValidDependency = false;
290
+ for (const depId of deps){
291
+ if (this.graph.hasNode(depId)) {
292
+ hasValidDependency = true;
293
+ break;
294
+ }
295
+ }
296
+ if (!hasValidDependency) {
297
+ orphaned.push(node.id);
298
+ }
299
+ }
300
+ }
301
+ return orphaned;
302
+ }
303
+ /**
304
+ * Finds tasks that cannot be resolved due to failed dependencies.
305
+ *
306
+ * A task is unresolvable if any of its dependencies (direct or transitive)
307
+ * are in FAILED state.
308
+ *
309
+ * @returns Array of unresolvable task IDs
310
+ */ findUnresolvableTasks() {
311
+ const unresolvable = [];
312
+ const failedNodes = new Set(this.graph.getAllNodes().filter((node)=>node.status === DependencyNodeStatus.FAILED).map((node)=>node.id));
313
+ if (failedNodes.size === 0) {
314
+ return [];
315
+ }
316
+ // For each node, check if it depends on a failed node
317
+ for (const node of this.graph.getAllNodes()){
318
+ if (failedNodes.has(node.id)) {
319
+ continue; // Already failed
320
+ }
321
+ // Get full dependency chain
322
+ const chain = this.graph.getDependencyChain(node.id);
323
+ // Check if any dependency is failed
324
+ for (const depId of chain){
325
+ if (failedNodes.has(depId)) {
326
+ unresolvable.push(node.id);
327
+ break;
328
+ }
329
+ }
330
+ }
331
+ return unresolvable;
332
+ }
333
+ }
334
+
335
+ //# sourceMappingURL=dependency-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/core/dependency-resolver.ts"],"names":["DependencyNodeStatus","DependencyResolver","graph","resolve","startTime","performance","now","sortedIds","getTopologicalOrder","result","map","id","node","getNode","Error","duration","size","console","warn","toFixed","getNextBatch","maxConcurrency","ready","getReadyTasks","slice","getCriticalPath","nodes","getAllNodes","length","path","estimatedDuration","depth","depthMap","Map","pathMap","set","nodeId","currentDepth","get","currentPath","dependents","getDependents","dependentId","dependentNode","newDepth","existingDepth","maxDepth","criticalNodeId","criticalPathIds","criticalPathNodes","reduce","sum","priority","getParallelizationFactor","levelCounts","dependencies","getDependencies","maxDepDepth","depId","depDepth","Math","max","values","maxParallel","count","canResolve","blockers","warnings","cycleResult","detectCycles","hasCycle","push","cycles","c","join","graphErrors","validate","err","orphanedNodes","findOrphanedNodes","failedNodes","filter","status","FAILED","n","unresolvableTasks","findUnresolvableTasks","success","undefined","orphaned","deps","hasValidDependency","hasNode","unresolvable","Set","has","chain","getDependencyChain"],"mappings":"AAAA;;;;;;;;;;;CAWC,GAGD,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ACvB;YACF;QACF;QAEA,OAAO8E;IACT;IAEA;;;;;;;GAOC,GACD,AAAQH,wBAAkC;QACxC,MAAMO,eAAyB,EAAE;QACjC,MAAMb,cAAc,IAAIc,IACtB,IAAI,CAAC5F,KAAK,CACPyB,WAAW,GACXsD,MAAM,CAACrE,CAAAA,OAAQA,KAAKsE,MAAM,KAAKlF,qBAAqBmF,MAAM,EAC1DzE,GAAG,CAACE,CAAAA,OAAQA,KAAKD,EAAE;QAGxB,IAAIqE,YAAYhE,IAAI,KAAK,GAAG;YAC1B,OAAO,EAAE;QACX;QAEA,sDAAsD;QACtD,KAAK,MAAMJ,QAAQ,IAAI,CAACV,KAAK,CAACyB,WAAW,GAAI;YAC3C,IAAIqD,YAAYe,GAAG,CAACnF,KAAKD,EAAE,GAAG;gBAC5B,UAAU,iBAAiB;YAC7B;YAEA,4BAA4B;YAC5B,MAAMqF,QAAQ,IAAI,CAAC9F,KAAK,CAAC+F,kBAAkB,CAACrF,KAAKD,EAAE;YAEnD,oCAAoC;YACpC,KAAK,MAAM+C,SAASsC,MAAO;gBACzB,IAAIhB,YAAYe,GAAG,CAACrC,QAAQ;oBAC1BmC,aAAatB,IAAI,CAAC3D,KAAKD,EAAE;oBACzB;gBACF;YACF;QACF;QAEA,OAAOkF;IACT;AACF"}
@@ -0,0 +1,211 @@
1
+ /**
2
+ * Agent Coordination V2 - Help Request Metrics
3
+ *
4
+ * Tracks metrics for agent help requests and helper state management.
5
+ * Monitors WAITING → HELPING transitions, checkpoint recovery times,
6
+ * and helper collaboration performance.
7
+ *
8
+ * @module coordination/v2/core/help-request-metrics
9
+ */ /**
10
+ * HelpRequestTracker - Manages help request metrics and checkpoint recovery
11
+ */ export class HelpRequestTracker {
12
+ helpRequests = new Map();
13
+ activeHelpers = new Map();
14
+ waitTimes = [];
15
+ helpDurations = [];
16
+ checkpointRecoveryTimes = [];
17
+ metrics = {
18
+ totalRequests: 0,
19
+ completedRequests: 0,
20
+ failedRequests: 0,
21
+ averageWaitTimeMs: 0,
22
+ averageHelpDurationMs: 0,
23
+ p99CheckpointRecoveryMs: 0,
24
+ totalCheckpointRecoveries: 0,
25
+ activeRequests: 0
26
+ };
27
+ /**
28
+ * Create a new help request
29
+ */ createHelpRequest(requestingAgentId, helperAgentId, reason) {
30
+ const requestId = this.generateRequestId(requestingAgentId, helperAgentId);
31
+ const request = {
32
+ id: requestId,
33
+ requestingAgentId,
34
+ helperAgentId,
35
+ requestedAt: Date.now(),
36
+ reason,
37
+ status: 'pending'
38
+ };
39
+ this.helpRequests.set(requestId, request);
40
+ this.metrics.totalRequests++;
41
+ this.metrics.activeRequests++;
42
+ return requestId;
43
+ }
44
+ /**
45
+ * Mark help request as started (helper transitioned to HELPING)
46
+ */ startHelp(requestId, checkpointId) {
47
+ const request = this.helpRequests.get(requestId);
48
+ if (!request) {
49
+ throw new Error(`Help request ${requestId} not found`);
50
+ }
51
+ request.startedAt = Date.now();
52
+ request.status = 'in_progress';
53
+ request.checkpointId = checkpointId;
54
+ // Track wait time
55
+ const waitTime = request.startedAt - request.requestedAt;
56
+ this.waitTimes.push(waitTime);
57
+ this.updateAverageWaitTime();
58
+ // Mark helper as active
59
+ this.activeHelpers.set(request.helperAgentId, requestId);
60
+ }
61
+ /**
62
+ * Mark help request as completed
63
+ */ completeHelp(requestId) {
64
+ const request = this.helpRequests.get(requestId);
65
+ if (!request) {
66
+ throw new Error(`Help request ${requestId} not found`);
67
+ }
68
+ request.completedAt = Date.now();
69
+ request.status = 'completed';
70
+ // Track help duration
71
+ if (request.startedAt) {
72
+ const duration = request.completedAt - request.startedAt;
73
+ this.helpDurations.push(duration);
74
+ this.updateAverageHelpDuration();
75
+ }
76
+ // Update metrics
77
+ this.metrics.completedRequests++;
78
+ this.metrics.activeRequests = Math.max(0, this.metrics.activeRequests - 1);
79
+ // Remove from active helpers
80
+ this.activeHelpers.delete(request.helperAgentId);
81
+ }
82
+ /**
83
+ * Mark help request as failed
84
+ */ failHelp(requestId, error) {
85
+ const request = this.helpRequests.get(requestId);
86
+ if (!request) {
87
+ throw new Error(`Help request ${requestId} not found`);
88
+ }
89
+ request.status = 'failed';
90
+ request.error = error;
91
+ this.metrics.failedRequests++;
92
+ this.metrics.activeRequests = Math.max(0, this.metrics.activeRequests - 1);
93
+ // Remove from active helpers
94
+ this.activeHelpers.delete(request.helperAgentId);
95
+ }
96
+ /**
97
+ * Track checkpoint recovery for helper state preservation
98
+ */ trackCheckpointRecovery(recoveryLatencyMs) {
99
+ this.checkpointRecoveryTimes.push(recoveryLatencyMs);
100
+ this.metrics.totalCheckpointRecoveries++;
101
+ this.updateCheckpointRecoveryMetrics();
102
+ // Enforce p99 < 500ms requirement
103
+ if (recoveryLatencyMs > 500 && this.metrics.totalCheckpointRecoveries >= 100) {
104
+ console.warn(`⚠️ Checkpoint recovery exceeded 500ms: ${recoveryLatencyMs.toFixed(2)}ms (p99: ${this.metrics.p99CheckpointRecoveryMs.toFixed(2)}ms)`);
105
+ }
106
+ }
107
+ /**
108
+ * Get help request by ID
109
+ */ getHelpRequest(requestId) {
110
+ return this.helpRequests.get(requestId);
111
+ }
112
+ /**
113
+ * Get active help request for helper agent
114
+ */ getActiveHelpForAgent(helperAgentId) {
115
+ const requestId = this.activeHelpers.get(helperAgentId);
116
+ if (!requestId) {
117
+ return undefined;
118
+ }
119
+ return this.helpRequests.get(requestId);
120
+ }
121
+ /**
122
+ * Get all active help requests
123
+ */ getActiveHelpRequests() {
124
+ return Array.from(this.helpRequests.values()).filter((r)=>r.status === 'in_progress' || r.status === 'pending');
125
+ }
126
+ /**
127
+ * Get help request metrics
128
+ */ getMetrics() {
129
+ return {
130
+ ...this.metrics
131
+ };
132
+ }
133
+ /**
134
+ * Reset metrics (for testing)
135
+ */ resetMetrics() {
136
+ this.helpRequests.clear();
137
+ this.activeHelpers.clear();
138
+ this.waitTimes = [];
139
+ this.helpDurations = [];
140
+ this.checkpointRecoveryTimes = [];
141
+ this.metrics = {
142
+ totalRequests: 0,
143
+ completedRequests: 0,
144
+ failedRequests: 0,
145
+ averageWaitTimeMs: 0,
146
+ averageHelpDurationMs: 0,
147
+ p99CheckpointRecoveryMs: 0,
148
+ totalCheckpointRecoveries: 0,
149
+ activeRequests: 0
150
+ };
151
+ }
152
+ /**
153
+ * Private: Generate unique request ID
154
+ */ generateRequestId(requestingAgentId, helperAgentId) {
155
+ const timestamp = Date.now();
156
+ return `help_${requestingAgentId}_${helperAgentId}_${timestamp}`;
157
+ }
158
+ /**
159
+ * Private: Update average wait time
160
+ */ updateAverageWaitTime() {
161
+ if (this.waitTimes.length === 0) return;
162
+ const sum = this.waitTimes.reduce((acc, time)=>acc + time, 0);
163
+ this.metrics.averageWaitTimeMs = sum / this.waitTimes.length;
164
+ // Keep only last 1000 samples
165
+ if (this.waitTimes.length > 1000) {
166
+ this.waitTimes = this.waitTimes.slice(-1000);
167
+ }
168
+ }
169
+ /**
170
+ * Private: Update average help duration
171
+ */ updateAverageHelpDuration() {
172
+ if (this.helpDurations.length === 0) return;
173
+ const sum = this.helpDurations.reduce((acc, time)=>acc + time, 0);
174
+ this.metrics.averageHelpDurationMs = sum / this.helpDurations.length;
175
+ // Keep only last 1000 samples
176
+ if (this.helpDurations.length > 1000) {
177
+ this.helpDurations = this.helpDurations.slice(-1000);
178
+ }
179
+ }
180
+ /**
181
+ * Private: Update checkpoint recovery metrics
182
+ */ updateCheckpointRecoveryMetrics() {
183
+ if (this.checkpointRecoveryTimes.length === 0) return;
184
+ // Calculate p99
185
+ const sorted = [
186
+ ...this.checkpointRecoveryTimes
187
+ ].sort((a, b)=>a - b);
188
+ const p99Index = Math.floor(sorted.length * 0.99);
189
+ this.metrics.p99CheckpointRecoveryMs = sorted[p99Index] || sorted[sorted.length - 1];
190
+ // Keep only last 1000 samples for p99 calculation
191
+ if (this.checkpointRecoveryTimes.length > 1000) {
192
+ this.checkpointRecoveryTimes = this.checkpointRecoveryTimes.slice(-1000);
193
+ }
194
+ }
195
+ /**
196
+ * Clean up old completed/failed requests (retention policy)
197
+ */ cleanup(retentionMs = 3600000) {
198
+ const cutoffTime = Date.now() - retentionMs;
199
+ let deletedCount = 0;
200
+ for (const [requestId, request] of this.helpRequests.entries()){
201
+ const isOld = request.completedAt ? request.completedAt < cutoffTime : request.requestedAt < cutoffTime;
202
+ if ((request.status === 'completed' || request.status === 'failed') && isOld) {
203
+ this.helpRequests.delete(requestId);
204
+ deletedCount++;
205
+ }
206
+ }
207
+ return deletedCount;
208
+ }
209
+ }
210
+
211
+ //# sourceMappingURL=help-request-metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/core/help-request-metrics.ts"],"names":["HelpRequestTracker","helpRequests","Map","activeHelpers","waitTimes","helpDurations","checkpointRecoveryTimes","metrics","totalRequests","completedRequests","failedRequests","averageWaitTimeMs","averageHelpDurationMs","p99CheckpointRecoveryMs","totalCheckpointRecoveries","activeRequests","createHelpRequest","requestingAgentId","helperAgentId","reason","requestId","generateRequestId","request","id","requestedAt","Date","now","status","set","startHelp","checkpointId","get","Error","startedAt","waitTime","push","updateAverageWaitTime","completeHelp","completedAt","duration","updateAverageHelpDuration","Math","max","delete","failHelp","error","trackCheckpointRecovery","recoveryLatencyMs","updateCheckpointRecoveryMetrics","console","warn","toFixed","getHelpRequest","getActiveHelpForAgent","undefined","getActiveHelpRequests","Array","from","values","filter","r","getMetrics","resetMetrics","clear","timestamp","length","sum","reduce","acc","time","slice","sorted","sort","a","b","p99Index","floor","cleanup","retentionMs","cutoffTime","deletedCount","entries","isOld"],"mappings":"AAAA;;;;;;;;CAQC,GAgFD;;CAEC,GACD,OAAO,MAAMA;IACHC,eAAyC,IAAIC,MAAM;IACnDC,gBAAqC,IAAID,MAAM;IAC/CE,YAAsB,EAAE,CAAC;IACzBC,gBAA0B,EAAE,CAAC;IAC7BC,0BAAoC,EAAE,CAAC;IAEvCC,UAA8B;QACpCC,eAAe;QACfC,mBAAmB;QACnBC,gBAAgB;QAChBC,mBAA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,OAAO,CAACM,uBAAuB,GAAG0D,MAAM,CAACI,SAAS,IAAIJ,MAAM,CAACA,OAAON,MAAM,GAAG,EAAE;QAEpF,kDAAkD;QAClD,IAAI,IAAI,CAAC3D,uBAAuB,CAAC2D,MAAM,GAAG,MAAM;YAC9C,IAAI,CAAC3D,uBAAuB,GAAG,IAAI,CAACA,uBAAuB,CAACgE,KAAK,CAAC,CAAC;QACrE;IACF;IAEA;;GAEC,GACDO,QAAQC,cAAsB,OAAO,EAAU;QAC7C,MAAMC,aAAatD,KAAKC,GAAG,KAAKoD;QAChC,IAAIE,eAAe;QAEnB,KAAK,MAAM,CAAC5D,WAAWE,QAAQ,IAAI,IAAI,CAACrB,YAAY,CAACgF,OAAO,GAAI;YAC9D,MAAMC,QAAQ5D,QAAQgB,WAAW,GAC7BhB,QAAQgB,WAAW,GAAGyC,aACtBzD,QAAQE,WAAW,GAAGuD;YAE1B,IAAI,AAACzD,CAAAA,QAAQK,MAAM,KAAK,eAAeL,QAAQK,MAAM,KAAK,QAAO,KAAMuD,OAAO;gBAC5E,IAAI,CAACjF,YAAY,CAAC0C,MAAM,CAACvB;gBACzB4D;YACF;QACF;QAEA,OAAOA;IACT;AACF"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Agent Coordination V2 - Core Module Exports
3
+ *
4
+ * Phase 01: State Machine
5
+ * Phase 02: Dependency Graph
6
+ * Phase 03: Message Bus
7
+ *
8
+ * @module coordination/v2/core
9
+ */ // ============================================
10
+ // Phase 01: State Machine
11
+ // ============================================
12
+ export { AgentState } from './agent-state.js';
13
+ export { StateMachine } from './state-machine.js';
14
+ export { STATE_TRANSITIONS, EVENT_STATE_MAPPING, DEFAULT_STATE_MACHINE_CONFIG, validateTransitionMatrix, validateEventMapping, getValidNextStates, isValidTransition, getExpectedStateForEvent, validateStateMachineConfig } from './state-machine-config.js';
15
+ export { TransitionEventType, validateTransition, createTransitionEvent, isEventType, isErrorEvent, isTerminalEvent } from './state-transition.js';
16
+ export { HelpRequestTracker } from './help-request-metrics.js';
17
+ // ============================================
18
+ // Phase 02: Dependency Graph
19
+ // ============================================
20
+ export { DependencyGraph, DependencyGraphError } from './dependency-graph.js';
21
+ export { DependencyNodeImpl, DependencyNodeStatus, DependencyNodeValidationError } from './dependency-node.js';
22
+ export { DependencyResolver } from './dependency-resolver.js';
23
+ export { TaskScheduler } from './task-scheduler.js';
24
+ // ============================================
25
+ // Phase 03: Message Bus
26
+ // ============================================
27
+ export { MessagePriority, DeliverySemantics, MessageValidationError, MessageUtils } from './message.js';
28
+ export { MessageBroker, MessageBrokerError } from './message-broker.js';
29
+ export { TopicManager } from './topic-manager.js';
30
+ export { MessageRouter } from './message-router.js';
31
+ export { DeadLetterQueue } from './dead-letter-queue.js';
32
+
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/core/index.ts"],"names":["AgentState","StateMachine","STATE_TRANSITIONS","EVENT_STATE_MAPPING","DEFAULT_STATE_MACHINE_CONFIG","validateTransitionMatrix","validateEventMapping","getValidNextStates","isValidTransition","getExpectedStateForEvent","validateStateMachineConfig","TransitionEventType","validateTransition","createTransitionEvent","isEventType","isErrorEvent","isTerminalEvent","HelpRequestTracker","DependencyGraph","DependencyGraphError","DependencyNodeImpl","DependencyNodeStatus","DependencyNodeValidationError","DependencyResolver","TaskScheduler","MessagePriority","DeliverySemantics","MessageValidationError","MessageUtils","MessageBroker","MessageBrokerError","TopicManager","MessageRouter","DeadLetterQueue"],"mappings":"AAAA;;;;;;;;CAQC,GAED,+CAA+C;AAC/C,0BAA0B;AAC1B,+CAA+C;AAE/C,SACEA,UAAU,QACL,mBAAmB;AAE1B,SACEC,YAAY,QAMP,qBAAqB;AAE5B,SACEC,iBAAiB,EACjBC,mBAAmB,EAEnBC,4BAA4B,EAC5BC,wBAAwB,EACxBC,oBAAoB,EACpBC,kBAAkB,EAClBC,iBAAiB,EACjBC,wBAAwB,EACxBC,0BAA0B,QACrB,4BAA4B;AAEnC,SACEC,mBAAmB,EASnBC,kBAAkB,EAClBC,qBAAqB,EACrBC,WAAW,EACXC,YAAY,EACZC,eAAe,QACV,wBAAwB;AAE/B,SACEC,kBAAkB,QAIb,4BAA4B;AAEnC,+CAA+C;AAC/C,6BAA6B;AAC7B,+CAA+C;AAE/C,SACEC,eAAe,EAEfC,oBAAoB,QAEf,wBAAwB;AAE/B,SACEC,kBAAkB,EAClBC,oBAAoB,EACpBC,6BAA6B,QAGxB,uBAAuB;AAE9B,SACEC,kBAAkB,QAGb,2BAA2B;AAElC,SACEC,aAAa,QAMR,sBAAsB;AAE7B,+CAA+C;AAC/C,wBAAwB;AACxB,+CAA+C;AAE/C,SAGEC,eAAe,EACfC,iBAAiB,EACjBC,sBAAsB,EAQtBC,YAAY,QACP,eAAe;AAEtB,SACEC,aAAa,EACbC,kBAAkB,QAEb,sBAAsB;AAE7B,SACEC,YAAY,QAGP,qBAAqB;AAE5B,SACEC,aAAa,QAIR,sBAAsB;AAE7B,SACEC,eAAe,QAKV,yBAAyB"}