claude-flow-novice 1.6.4 → 1.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/.claude/commands/parse-epic.js +180 -0
  2. package/.claude/settings.local.json +2 -1
  3. package/.claude-flow-novice/dist/mcp/mcp-server-novice.js +37 -2
  4. package/.claude-flow-novice/dist/mcp/transports/base.js +5 -0
  5. package/.claude-flow-novice/dist/mcp/transports/base.js.map +1 -0
  6. package/.claude-flow-novice/dist/mcp/transports/http.js +414 -0
  7. package/.claude-flow-novice/dist/mcp/transports/http.js.map +1 -0
  8. package/.claude-flow-novice/dist/mcp/transports/stdio.js +217 -0
  9. package/.claude-flow-novice/dist/mcp/transports/stdio.js.map +1 -0
  10. package/.claude-flow-novice/dist/src/cli/commands/parse-epic.js +129 -0
  11. package/.claude-flow-novice/dist/src/cli/commands/parse-epic.js.map +1 -0
  12. package/.claude-flow-novice/dist/src/cli/index.js +3 -0
  13. package/.claude-flow-novice/dist/src/cli/index.js.map +1 -1
  14. package/.claude-flow-novice/dist/src/cli/utils/epic-parser.js +266 -0
  15. package/.claude-flow-novice/dist/src/cli/utils/epic-parser.js.map +1 -0
  16. package/.claude-flow-novice/dist/src/communication/message-bus.js +105 -2
  17. package/.claude-flow-novice/dist/src/communication/message-bus.js.map +1 -1
  18. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +1 -1
  19. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -1
  20. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/artifact-cache-optimizer.js +632 -0
  21. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/artifact-cache-optimizer.js.map +1 -0
  22. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/index.js +11 -0
  23. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/index.js.map +1 -0
  24. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/checkpoints/checkpoint-compressor.js +318 -0
  25. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/checkpoints/checkpoint-compressor.js.map +1 -0
  26. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/completion-detector.js +234 -0
  27. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/completion-detector.js.map +1 -0
  28. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/hierarchical-detector.js +347 -0
  29. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/hierarchical-detector.js.map +1 -0
  30. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/index.js +13 -0
  31. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/index.js.map +1 -0
  32. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/lamport-clock.js +173 -0
  33. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/lamport-clock.js.map +1 -0
  34. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/mesh-detector.js +526 -0
  35. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/mesh-detector.js.map +1 -0
  36. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/sdk-completion-detector.js +443 -0
  37. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/sdk-completion-detector.js.map +1 -0
  38. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/swarm-shutdown.js +366 -0
  39. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/swarm-shutdown.js.map +1 -0
  40. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinator-factory.js +287 -0
  41. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinator-factory.js.map +1 -0
  42. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.example.js +364 -0
  43. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.example.js.map +1 -0
  44. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.js +492 -0
  45. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.js.map +1 -0
  46. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/hierarchical-coordinator.js +786 -0
  47. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/hierarchical-coordinator.js.map +1 -0
  48. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/index.js +16 -0
  49. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/index.js.map +1 -0
  50. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/parent-child-manager.js +342 -0
  51. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/parent-child-manager.js.map +1 -0
  52. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/swarm-coordinator-v2.js +601 -0
  53. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
  54. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/agent-state.js +9 -0
  55. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/agent-state.js.map +1 -0
  56. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dead-letter-queue.js +413 -0
  57. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dead-letter-queue.js.map +1 -0
  58. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-graph.js +471 -0
  59. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-graph.js.map +1 -0
  60. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-node.js +379 -0
  61. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-node.js.map +1 -0
  62. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-resolver.js +335 -0
  63. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-resolver.js.map +1 -0
  64. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/help-request-metrics.js +211 -0
  65. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/help-request-metrics.js.map +1 -0
  66. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/index.js +33 -0
  67. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/index.js.map +1 -0
  68. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-broker.js +920 -0
  69. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-broker.js.map +1 -0
  70. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-router.js +385 -0
  71. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-router.js.map +1 -0
  72. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message.js +138 -0
  73. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message.js.map +1 -0
  74. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/resource-manager-safe.js +478 -0
  75. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/resource-manager-safe.js.map +1 -0
  76. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine-config.js +358 -0
  77. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine-config.js.map +1 -0
  78. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine.js +588 -0
  79. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine.js.map +1 -0
  80. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-transition.js +153 -0
  81. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-transition.js.map +1 -0
  82. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/task-scheduler.js +360 -0
  83. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/task-scheduler.js.map +1 -0
  84. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/topic-manager.js +337 -0
  85. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/topic-manager.js.map +1 -0
  86. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/deadlock-detector.js +424 -0
  87. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/deadlock-detector.js.map +1 -0
  88. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/index.js +9 -0
  89. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/index.js.map +1 -0
  90. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/resource-manager.js +669 -0
  91. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/resource-manager.js.map +1 -0
  92. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/artifact-storage.js +451 -0
  93. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/artifact-storage.js.map +1 -0
  94. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/cycle-detector.js +271 -0
  95. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/cycle-detector.js.map +1 -0
  96. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-graph.js +335 -0
  97. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-graph.js.map +1 -0
  98. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-manager.js +439 -0
  99. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-manager.js.map +1 -0
  100. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-request.js +92 -0
  101. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-request.js.map +1 -0
  102. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/index.js +21 -0
  103. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/index.js.map +1 -0
  104. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/topological-sort.js +223 -0
  105. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/topological-sort.js.map +1 -0
  106. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-coordinator.js +436 -0
  107. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-coordinator.js.map +1 -0
  108. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-matcher.js +278 -0
  109. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-matcher.js.map +1 -0
  110. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request-handler.js +317 -0
  111. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request-handler.js.map +1 -0
  112. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request.js +273 -0
  113. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request.js.map +1 -0
  114. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/index.js +15 -0
  115. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/index.js.map +1 -0
  116. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/waiting-agent-pool.js +512 -0
  117. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/waiting-agent-pool.js.map +1 -0
  118. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/index.js +67 -0
  119. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/index.js.map +1 -0
  120. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/help-deadlock-integration.js +557 -0
  121. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/help-deadlock-integration.js.map +1 -0
  122. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/index.js +14 -0
  123. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/index.js.map +1 -0
  124. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.example.js +212 -0
  125. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.example.js.map +1 -0
  126. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.js +552 -0
  127. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.js.map +1 -0
  128. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/state-machine-integration.js +635 -0
  129. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/state-machine-integration.js.map +1 -0
  130. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/IArtifactStorage.js +28 -0
  131. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/IArtifactStorage.js.map +1 -0
  132. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ICoordinator.js +9 -0
  133. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ICoordinator.js.map +1 -0
  134. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ISessionStore.js +25 -0
  135. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ISessionStore.js.map +1 -0
  136. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/index.js +14 -0
  137. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/index.js.map +1 -0
  138. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/artifact-adapter.js +308 -0
  139. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/artifact-adapter.js.map +1 -0
  140. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/completion-storage.js +439 -0
  141. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/completion-storage.js.map +1 -0
  142. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-graph-storage.js +540 -0
  143. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-graph-storage.js.map +1 -0
  144. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-storage.js +367 -0
  145. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-storage.js.map +1 -0
  146. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/index.js +14 -0
  147. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/index.js.map +1 -0
  148. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/message-storage.js +518 -0
  149. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/message-storage.js.map +1 -0
  150. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/state-storage.js +377 -0
  151. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/state-storage.js.map +1 -0
  152. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channel.js +371 -0
  153. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channel.js.map +1 -0
  154. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/dependency-channel.js +355 -0
  155. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/dependency-channel.js.map +1 -0
  156. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/help-channel.js +424 -0
  157. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/help-channel.js.map +1 -0
  158. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/index.js +16 -0
  159. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/index.js.map +1 -0
  160. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/state-channel.js +295 -0
  161. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/state-channel.js.map +1 -0
  162. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/task-channel.js +411 -0
  163. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/task-channel.js.map +1 -0
  164. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/index.js +14 -0
  165. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/index.js.map +1 -0
  166. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-bus.js +387 -0
  167. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-bus.js.map +1 -0
  168. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-persistence.js +589 -0
  169. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-persistence.js.map +1 -0
  170. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-router.js +444 -0
  171. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-router.js.map +1 -0
  172. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/artifact-storage.js +560 -0
  173. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/artifact-storage.js.map +1 -0
  174. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/background-orchestrator.js +335 -0
  175. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/background-orchestrator.js.map +1 -0
  176. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/bash-output-monitor.js +104 -0
  177. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/bash-output-monitor.js.map +1 -0
  178. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/checkpoint-manager.js +847 -0
  179. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/checkpoint-manager.js.map +1 -0
  180. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/help-coordinator.js +470 -0
  181. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/help-coordinator.js.map +1 -0
  182. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/hierarchical-background-integration.js +450 -0
  183. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/hierarchical-background-integration.js.map +1 -0
  184. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/index.js +13 -0
  185. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/index.js.map +1 -0
  186. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/message-bus-integration.js +625 -0
  187. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/message-bus-integration.js.map +1 -0
  188. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/multi-level-control.js +545 -0
  189. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/multi-level-control.js.map +1 -0
  190. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-controller.js +740 -0
  191. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-controller.js.map +1 -0
  192. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-message-integration.js +415 -0
  193. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-message-integration.js.map +1 -0
  194. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/session-pool-optimizer.js +615 -0
  195. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/session-pool-optimizer.js.map +1 -0
  196. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-machine-integration.js +547 -0
  197. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-machine-integration.js.map +1 -0
  198. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-sdk-integration.js +342 -0
  199. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-sdk-integration.js.map +1 -0
  200. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/security/payload-validator.js +259 -0
  201. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/security/payload-validator.js.map +1 -0
  202. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/framework-registry.js +273 -0
  203. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/framework-registry.js.map +1 -0
  204. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/index.js +8 -0
  205. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/index.js.map +1 -0
  206. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-config-manager.js +310 -0
  207. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-config-manager.js.map +1 -0
  208. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-validator.js +218 -0
  209. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-validator.js.map +1 -0
  210. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/types/sdk.js +9 -0
  211. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/types/sdk.js.map +1 -0
  212. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/index.js +6 -0
  213. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/index.js.map +1 -0
  214. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/priority-queue.js +145 -0
  215. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/priority-queue.js.map +1 -0
  216. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/sdk-helpers.js +122 -0
  217. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/sdk-helpers.js.map +1 -0
  218. package/.claude-flow-novice/dist/src/coordination/config-translator.js +17 -43
  219. package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -1
  220. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +34 -76
  221. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -1
  222. package/.claude-flow-novice/dist/src/coordination/shared/core/agent-state.js +172 -0
  223. package/.claude-flow-novice/dist/src/coordination/shared/core/agent-state.js.map +1 -0
  224. package/.claude-flow-novice/dist/src/coordination/shared/core/index.js +7 -0
  225. package/.claude-flow-novice/dist/src/coordination/shared/core/index.js.map +1 -0
  226. package/.claude-flow-novice/dist/src/coordination/shared/index.js +19 -0
  227. package/.claude-flow-novice/dist/src/coordination/shared/index.js.map +1 -0
  228. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js +24 -0
  229. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js.map +1 -0
  230. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js +7 -0
  231. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js.map +1 -0
  232. package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js +920 -0
  233. package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js.map +1 -0
  234. package/.claude-flow-novice/dist/src/coordination/shared/message.js +138 -0
  235. package/.claude-flow-novice/dist/src/coordination/shared/message.js.map +1 -0
  236. package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js +259 -0
  237. package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js.map +1 -0
  238. package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js +17 -0
  239. package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js.map +1 -0
  240. package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js +19 -0
  241. package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js.map +1 -0
  242. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js +357 -0
  243. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js.map +1 -0
  244. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js +679 -0
  245. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js.map +1 -0
  246. package/.claude-flow-novice/dist/src/coordination/shared/types/index.js +7 -0
  247. package/.claude-flow-novice/dist/src/coordination/shared/types/index.js.map +1 -0
  248. package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js +10 -0
  249. package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js.map +1 -0
  250. package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js +52 -2
  251. package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js.map +1 -1
  252. package/.claude-flow-novice/dist/src/mcp/mcp-server-novice.js +37 -2
  253. package/.claude-flow-novice/dist/src/mcp/session-manager.js +3 -1
  254. package/.claude-flow-novice/dist/src/mcp/session-manager.js.map +1 -1
  255. package/.claude-flow-novice/dist/src/providers/provider-manager.js +36 -3
  256. package/.claude-flow-novice/dist/src/providers/provider-manager.js.map +1 -1
  257. package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js +65 -41
  258. package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js.map +1 -1
  259. package/.claude-flow-novice/dist/src/web/api/server.js +1 -1
  260. package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -1
  261. package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js +30 -0
  262. package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js.map +1 -1
  263. package/.claude-flow-novice/metrics.db-shm +0 -0
  264. package/.claude-flow-novice/metrics.db-wal +0 -0
  265. package/package.json +2 -2
  266. package/scripts/monitoring/alert-monitor.sh +220 -0
  267. package/scripts/monitoring/view-alerts.sh +307 -0
  268. package/scripts/test-zai-api.cjs +2 -2
  269. package/src/slash-commands/parse-epic.js +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/help-system/help-coordinator.ts"],"names":["HelpRequest","HelpRequestPriority","HelpMatcher","MessagePriority","HelpCoordinator","matcher","activeRequests","requestQueue","routingHistory","config","metrics","recentLatencies","requestCounter","matcherConfig","Map","maxConcurrentRequests","autoRetry","maxRoutingAttempts","enableQueue","maxQueueSize","messageBroker","enableEventPublishing","undefined","totalRequests","successfulRoutes","failedRoutes","averageRoutingLatencyMs","p95RoutingLatencyMs","p99RoutingLatencyMs","queuedRequests","resolvedRequests","expiredRequests","createHelpRequest","requesterId","description","capabilities","priority","NORMAL","metadata","startTime","performance","now","requestId","generateRequestId","request","size","length","push","routingId","generateRoutingId","match","status","latencyMs","timestamp","Date","error","result","routeRequest","latency","recordRoutingMetrics","findMatch","markMatched","agentId","set","publishRoutingEvent","Error","message","startHelp","get","markInProgress","publishHelpStartedEvent","resolveHelp","markResolved","delete","publishHelpResolvedEvent","processQueue","failHelp","reason","markFailed","publishHelpFailedEvent","canRetry","retried","retry","cancelHelp","cancel","getRequestStatus","getRequest","registerAgent","profile","unregisterAgent","updateAgentState","state","updateAgentWorkload","workload","sort","a","b","nextRequest","shift","success","totalRoutes","sorted","Math","floor","getMetrics","matcherMetrics","getActiveRequests","Array","from","values","getQueuedRequests","getRoutingHistory","limit","slice","clear","publish","topic","payload","score","LOW","console","helperId","matchedHelperId","HIGH"],"mappings":"AAAA;;;;;;;CAOC,GAED,SACEA,WAAW,EAGXC,mBAAmB,QACd,oBAAoB;AAC3B,SACEC,WAAW,QAIN,oBAAoB;AAG3B,SAASC,eAAe,QAAQ,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AK,CAAC,yDAAyDA;QACzE;IACF;AACF"}
@@ -0,0 +1,278 @@
1
+ /**
2
+ * Agent Coordination V2 - Help Matcher
3
+ *
4
+ * Optimized capability matching algorithm for help requests.
5
+ * Target: <100ms p95 latency for capability matching.
6
+ *
7
+ * @module coordination/v2/help-system/help-matcher
8
+ */ import { AgentState } from '../../shared/core/agent-state.js';
9
+ /**
10
+ * Help matcher implementation with optimized capability matching
11
+ */ export class HelpMatcher {
12
+ /** Registered agent profiles */ agents;
13
+ /** Capability index for fast matching */ capabilityIndex;
14
+ /** Matcher configuration */ config;
15
+ /** Performance metrics */ metrics;
16
+ /** Recent match latencies for percentile calculation */ recentLatencies;
17
+ constructor(config){
18
+ this.agents = new Map();
19
+ this.capabilityIndex = new Map();
20
+ this.recentLatencies = [];
21
+ this.config = {
22
+ minMatchScore: config?.minMatchScore ?? 0.6,
23
+ proficiencyWeight: config?.proficiencyWeight ?? 0.4,
24
+ availabilityWeight: config?.availabilityWeight ?? 0.3,
25
+ workloadWeight: config?.workloadWeight ?? 0.2,
26
+ priorityWeight: config?.priorityWeight ?? 0.1,
27
+ enableCaching: config?.enableCaching ?? true,
28
+ maxCacheSize: config?.maxCacheSize ?? 1000,
29
+ cacheTTLMs: config?.cacheTTLMs ?? 60000
30
+ };
31
+ this.metrics = {
32
+ totalMatches: 0,
33
+ successfulMatches: 0,
34
+ averageLatencyMs: 0,
35
+ p95LatencyMs: 0,
36
+ p99LatencyMs: 0,
37
+ cacheHits: 0,
38
+ cacheMisses: 0
39
+ };
40
+ }
41
+ /**
42
+ * Register agent profile for capability matching
43
+ */ registerAgent(profile) {
44
+ this.agents.set(profile.agentId, profile);
45
+ this.rebuildCapabilityIndex();
46
+ }
47
+ /**
48
+ * Unregister agent profile
49
+ */ unregisterAgent(agentId) {
50
+ this.agents.delete(agentId);
51
+ this.rebuildCapabilityIndex();
52
+ }
53
+ /**
54
+ * Update agent state
55
+ */ updateAgentState(agentId, state) {
56
+ const agent = this.agents.get(agentId);
57
+ if (agent) {
58
+ agent.state = state;
59
+ }
60
+ }
61
+ /**
62
+ * Update agent workload
63
+ */ updateAgentWorkload(agentId, workload) {
64
+ const agent = this.agents.get(agentId);
65
+ if (agent) {
66
+ agent.workload = Math.max(0, Math.min(1, workload));
67
+ this.rebuildCapabilityIndex();
68
+ }
69
+ }
70
+ /**
71
+ * Find best matching agent for help request
72
+ * Target: <100ms p95 latency
73
+ */ async findMatch(request) {
74
+ const startTime = performance.now();
75
+ try {
76
+ // Get available agents (IDLE or WORKING with low workload)
77
+ const availableAgents = this.getAvailableAgents();
78
+ if (availableAgents.length === 0) {
79
+ return null;
80
+ }
81
+ // Score all available agents
82
+ const matches = availableAgents.map((agent)=>this.scoreAgent(agent, request)).filter((match)=>match.score >= this.config.minMatchScore).sort((a, b)=>b.score - a.score);
83
+ if (matches.length === 0) {
84
+ return null;
85
+ }
86
+ // Return best match
87
+ const bestMatch = matches[0];
88
+ const latency = performance.now() - startTime;
89
+ bestMatch.latencyMs = latency;
90
+ this.recordMatchMetrics(latency, true);
91
+ this.metrics.successfulMatches++;
92
+ return bestMatch;
93
+ } catch (error) {
94
+ const latency = performance.now() - startTime;
95
+ this.recordMatchMetrics(latency, false);
96
+ throw error;
97
+ }
98
+ }
99
+ /**
100
+ * Find multiple matching agents (top N)
101
+ */ async findMatches(request, limit = 5) {
102
+ const startTime = performance.now();
103
+ const availableAgents = this.getAvailableAgents();
104
+ const matches = availableAgents.map((agent)=>this.scoreAgent(agent, request)).filter((match)=>match.score >= this.config.minMatchScore).sort((a, b)=>b.score - a.score).slice(0, limit);
105
+ const latency = performance.now() - startTime;
106
+ matches.forEach((match)=>{
107
+ match.latencyMs = latency;
108
+ });
109
+ this.recordMatchMetrics(latency, matches.length > 0);
110
+ return matches;
111
+ }
112
+ /**
113
+ * Get available agents for help requests
114
+ */ getAvailableAgents() {
115
+ return Array.from(this.agents.values()).filter((agent)=>{
116
+ // IDLE agents are always available
117
+ if (agent.state === AgentState.IDLE) {
118
+ return true;
119
+ }
120
+ // WORKING agents with low workload can help
121
+ if (agent.state === AgentState.WORKING && agent.workload < 0.7) {
122
+ return true;
123
+ }
124
+ // HELPING agents can help multiple requests if workload allows
125
+ if (agent.state === AgentState.HELPING && agent.workload < 0.8) {
126
+ return true;
127
+ }
128
+ return false;
129
+ });
130
+ }
131
+ /**
132
+ * Score agent against help request requirements
133
+ */ scoreAgent(agent, request) {
134
+ const matched = [];
135
+ const missing = [];
136
+ let totalCapabilityScore = 0;
137
+ let requiredCapabilitiesMet = 0;
138
+ let totalRequiredCapabilities = 0;
139
+ // Check each required capability
140
+ for (const requirement of request.capabilities){
141
+ const agentCapability = agent.capabilities.find((c)=>c.name === requirement.capability);
142
+ if (requirement.required) {
143
+ totalRequiredCapabilities++;
144
+ }
145
+ if (agentCapability) {
146
+ const proficiencyScore = agentCapability.proficiency;
147
+ const meetsMinProficiency = !requirement.minProficiency || proficiencyScore >= requirement.minProficiency;
148
+ if (meetsMinProficiency) {
149
+ matched.push({
150
+ capability: requirement.capability,
151
+ proficiency: proficiencyScore,
152
+ required: requirement.required
153
+ });
154
+ totalCapabilityScore += proficiencyScore;
155
+ if (requirement.required) {
156
+ requiredCapabilitiesMet++;
157
+ }
158
+ } else if (requirement.required) {
159
+ missing.push(requirement.capability);
160
+ }
161
+ } else if (requirement.required) {
162
+ missing.push(requirement.capability);
163
+ }
164
+ }
165
+ // If any required capabilities are missing, score is 0
166
+ if (missing.length > 0) {
167
+ return {
168
+ agentId: agent.agentId,
169
+ score: 0,
170
+ matchedCapabilities: matched,
171
+ missingCapabilities: missing,
172
+ confidence: 0,
173
+ latencyMs: 0
174
+ };
175
+ }
176
+ // Calculate component scores
177
+ const avgCapabilityScore = matched.length > 0 ? totalCapabilityScore / matched.length : 0;
178
+ const availabilityScore = this.calculateAvailabilityScore(agent.state);
179
+ const workloadScore = 1 - agent.workload;
180
+ const priorityScore = agent.priority / 10;
181
+ // Weighted composite score
182
+ const score = avgCapabilityScore * this.config.proficiencyWeight + availabilityScore * this.config.availabilityWeight + workloadScore * this.config.workloadWeight + priorityScore * this.config.priorityWeight;
183
+ // Confidence based on required capabilities coverage
184
+ const confidence = totalRequiredCapabilities > 0 ? requiredCapabilitiesMet / totalRequiredCapabilities : 1.0;
185
+ return {
186
+ agentId: agent.agentId,
187
+ score,
188
+ matchedCapabilities: matched,
189
+ missingCapabilities: missing,
190
+ confidence,
191
+ latencyMs: 0
192
+ };
193
+ }
194
+ /**
195
+ * Calculate availability score based on agent state
196
+ */ calculateAvailabilityScore(state) {
197
+ switch(state){
198
+ case AgentState.IDLE:
199
+ return 1.0;
200
+ case AgentState.HELPING:
201
+ return 0.8;
202
+ case AgentState.WORKING:
203
+ return 0.6;
204
+ case AgentState.WAITING:
205
+ return 0.4;
206
+ default:
207
+ return 0.0;
208
+ }
209
+ }
210
+ /**
211
+ * Rebuild capability index for optimized lookups
212
+ */ rebuildCapabilityIndex() {
213
+ this.capabilityIndex.clear();
214
+ for (const agent of Array.from(this.agents.values())){
215
+ for (const capability of agent.capabilities){
216
+ let index = this.capabilityIndex.get(capability.name);
217
+ if (!index) {
218
+ index = {
219
+ capability: capability.name,
220
+ agents: [],
221
+ lastUpdated: new Date()
222
+ };
223
+ this.capabilityIndex.set(capability.name, index);
224
+ }
225
+ index.agents.push({
226
+ agentId: agent.agentId,
227
+ proficiency: capability.proficiency,
228
+ workload: agent.workload
229
+ });
230
+ }
231
+ }
232
+ // Sort agents by proficiency descending
233
+ for (const index of Array.from(this.capabilityIndex.values())){
234
+ index.agents.sort((a, b)=>b.proficiency - a.proficiency);
235
+ }
236
+ }
237
+ /**
238
+ * Record match metrics for performance tracking
239
+ */ recordMatchMetrics(latencyMs, success) {
240
+ this.metrics.totalMatches++;
241
+ this.recentLatencies.push(latencyMs);
242
+ // Keep only last 1000 latencies for percentile calculation
243
+ if (this.recentLatencies.length > 1000) {
244
+ this.recentLatencies.shift();
245
+ }
246
+ // Update average latency
247
+ this.metrics.averageLatencyMs = (this.metrics.averageLatencyMs * (this.metrics.totalMatches - 1) + latencyMs) / this.metrics.totalMatches;
248
+ // Update percentiles
249
+ const sorted = [
250
+ ...this.recentLatencies
251
+ ].sort((a, b)=>a - b);
252
+ this.metrics.p95LatencyMs = sorted[Math.floor(sorted.length * 0.95)] || 0;
253
+ this.metrics.p99LatencyMs = sorted[Math.floor(sorted.length * 0.99)] || 0;
254
+ }
255
+ /**
256
+ * Get matcher performance metrics
257
+ */ getMetrics() {
258
+ return {
259
+ ...this.metrics,
260
+ registeredAgents: this.agents.size,
261
+ indexedCapabilities: this.capabilityIndex.size,
262
+ averageAgentsPerCapability: this.capabilityIndex.size > 0 ? Array.from(this.capabilityIndex.values()).reduce((sum, idx)=>sum + idx.agents.length, 0) / this.capabilityIndex.size : 0
263
+ };
264
+ }
265
+ /**
266
+ * Get registered agents count
267
+ */ getRegisteredAgentsCount() {
268
+ return this.agents.size;
269
+ }
270
+ /**
271
+ * Clear all agents and reset index
272
+ */ clear() {
273
+ this.agents.clear();
274
+ this.capabilityIndex.clear();
275
+ }
276
+ }
277
+
278
+ //# sourceMappingURL=help-matcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/help-system/help-matcher.ts"],"names":["AgentState","HelpMatcher","agents","capabilityIndex","config","metrics","recentLatencies","Map","minMatchScore","proficiencyWeight","availabilityWeight","workloadWeight","priorityWeight","enableCaching","maxCacheSize","cacheTTLMs","totalMatches","successfulMatches","averageLatencyMs","p95LatencyMs","p99LatencyMs","cacheHits","cacheMisses","registerAgent","profile","set","agentId","rebuildCapabilityIndex","unregisterAgent","delete","updateAgentState","state","agent","get","updateAgentWorkload","workload","Math","max","min","findMatch","request","startTime","performance","now","availableAgents","getAvailableAgents","length","matches","map","scoreAgent","filter","match","score","sort","a","b","bestMatch","latency","latencyMs","recordMatchMetrics","error","findMatches","limit","slice","forEach","Array","from","values","IDLE","WORKING","HELPING","matched","missing","totalCapabilityScore","requiredCapabilitiesMet","totalRequiredCapabilities","requirement","capabilities","agentCapability","find","c","name","capability","required","proficiencyScore","proficiency","meetsMinProficiency","minProficiency","push","matchedCapabilities","missingCapabilities","confidence","avgCapabilityScore","availabilityScore","calculateAvailabilityScore","workloadScore","priorityScore","priority","WAITING","clear","index","lastUpdated","Date","success","shift","sorted","floor","getMetrics","registeredAgents","size","indexedCapabilities","averageAgentsPerCapability","reduce","sum","idx","getRegisteredAgentsCount"],"mappings":"AAAA;;;;;;;CAOC,GAGD,SAASA,UAAU,QAAQ,mCAAmC;AA0H9D;;CAEC,GACD,OAAO,MAAMC;IACX,8BAA8B,GAC9B,AAAQC,OAAkC;IAE1C,uCAAuC,GACvC,AAAQC,gBAA8C;IAEtD,0BAA0B,GAC1B,AAAQC,OAAgC;IAExC,wBAAwB,GACxB,AAAQC,QAQN;IAEF,sDAAsD,GACtD,AAAQC,gBAA0B;IAElC,YAAYF,MAAsB,CAAE;QAClC,IAAI,CAACF,MAAM,GAAG,IAAIK;QAClB,IAAI,CAACJ,eAAe,GAAG,IAAII;QAC3B,IAAI,CAACD,eAAe,GAAG,EAAE;QAEzB,IAAI,CAACF,MAAM,GAAG;YACZI,eAAeJ,QAAQI,iBAAiB;YACxCC,mBAAmBL,QAAQK,qBAAqB;YAChDC,oBAAoBN,QAAQM,sBAAsB;YAClDC,gBAAgBP,QAAQO,kBAAkB;YAC1CC,gBAAgBR,QAAQQ,kBAAkB;YAC1CC,eAAeT,QAAQS,iBAAiB;YACxCC,cAAcV,QAAQU,gBAAgB;YACtCC,YAAYX,QAAQW,cAAc;QACpC;QAEA,IAAI,CAACV,OAAO,GAAG;YACbW,cAAc;YACdC,mBAAmB;YACnBC,kBAAkB;YAClBC,cAAc;YACdC,cAAc;YACdC,WAAW;YACXC,aAAa;QACf;IACF;IAEA;;GAEC,GACD,AAAOC,cAAcC,OAAqB,EAAQ;QAChD,IAAI,CAACtB,MAAM,CAACuB,GAAG,CAACD,QAAQE,OAAO,EAAEF;QACjC,IAA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,IAAI;QACxE,IAAI,CAACzC,OAAO,CAACe,YAAY,GAAGqF,MAAM,CAACrE,KAAKsE,KAAK,CAACD,OAAO3D,MAAM,GAAG,MAAM,IAAI;IAC1E;IAEA;;GAEC,GACD,AAAO6D,aAAa;QAClB,OAAO;YACL,GAAG,IAAI,CAACtG,OAAO;YACfuG,kBAAkB,IAAI,CAAC1G,MAAM,CAAC2G,IAAI;YAClCC,qBAAqB,IAAI,CAAC3G,eAAe,CAAC0G,IAAI;YAC9CE,4BACE,IAAI,CAAC5G,eAAe,CAAC0G,IAAI,GAAG,IACxB5C,MAAMC,IAAI,CAAC,IAAI,CAAC/D,eAAe,CAACgE,MAAM,IAAI6C,MAAM,CAAC,CAACC,KAAKC,MAAQD,MAAMC,IAAIhH,MAAM,CAAC4C,MAAM,EAAE,KACxF,IAAI,CAAC3C,eAAe,CAAC0G,IAAI,GACzB;QACR;IACF;IAEA;;GAEC,GACD,AAAOM,2BAAmC;QACxC,OAAO,IAAI,CAACjH,MAAM,CAAC2G,IAAI;IACzB;IAEA;;GAEC,GACD,AAAOV,QAAc;QACnB,IAAI,CAACjG,MAAM,CAACiG,KAAK;QACjB,IAAI,CAAChG,eAAe,CAACgG,KAAK;IAC5B;AACF"}
@@ -0,0 +1,317 @@
1
+ /**
2
+ * Agent Coordination V2 - Help Request Handler
3
+ *
4
+ * MessageBroker-based help request routing implementation.
5
+ * Subscribes to help topics and routes requests to HelpCoordinator.
6
+ *
7
+ * Topics:
8
+ * - help.request.{priority} - New help requests
9
+ * - help.accepted.{requestId} - Help accepted notifications
10
+ * - help.completed.{requestId} - Help completion notifications
11
+ *
12
+ * @module coordination/v2/help-system/help-request-handler
13
+ */ import { MessagePriority } from '../core/message.js';
14
+ import { HelpRequestPriority } from './help-request.js';
15
+ /**
16
+ * Help request handler implementation with MessageBroker integration.
17
+ *
18
+ * Provides request/reply pattern for help requests with:
19
+ * - Priority-based routing
20
+ * - Timeout handling
21
+ * - Event emission for monitoring
22
+ * - Automatic retry on failure
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const broker = new MessageBroker();
27
+ * const coordinator = new HelpCoordinator();
28
+ * const handler = new HelpRequestHandler({ broker, coordinator });
29
+ *
30
+ * await handler.start();
31
+ *
32
+ * // Request help via message broker
33
+ * const reply = await broker.request('help.request.HIGH', {
34
+ * requesterId: 'agent-1',
35
+ * description: 'Need help with API design',
36
+ * capabilities: [{ capability: 'api-design', required: true }],
37
+ * priority: HelpRequestPriority.HIGH
38
+ * });
39
+ *
40
+ * console.log('Routing result:', reply.payload);
41
+ * ```
42
+ */ export class HelpRequestHandler {
43
+ broker;
44
+ coordinator;
45
+ config;
46
+ subscriptions;
47
+ metrics;
48
+ started;
49
+ constructor(config){
50
+ this.broker = config.broker;
51
+ this.coordinator = config.coordinator;
52
+ this.subscriptions = [];
53
+ this.started = false;
54
+ this.config = {
55
+ requestTimeout: config.requestTimeout ?? 30000,
56
+ enableMonitoring: config.enableMonitoring ?? true
57
+ };
58
+ this.metrics = {
59
+ totalRequests: 0,
60
+ successfulRoutes: 0,
61
+ failedRequests: 0,
62
+ acceptedRequests: 0,
63
+ completedRequests: 0,
64
+ avgRoutingLatencyMs: 0,
65
+ timeoutEvents: 0
66
+ };
67
+ }
68
+ /**
69
+ * Start the help request handler and subscribe to topics
70
+ */ async start() {
71
+ if (this.started) {
72
+ throw new Error('HelpRequestHandler already started');
73
+ }
74
+ // Subscribe to help request topics for all priority levels
75
+ const priorities = Object.values(HelpRequestPriority).filter((v)=>typeof v === 'number');
76
+ for (const priority of priorities){
77
+ const priorityName = this.getPriorityName(priority);
78
+ const sub = await this.broker.subscribe({
79
+ topic: `help.request.${priorityName}`,
80
+ handler: (msg)=>this.handleHelpRequest(msg),
81
+ priority: priority
82
+ });
83
+ this.subscriptions.push(sub);
84
+ }
85
+ // Subscribe to help acceptance notifications
86
+ const acceptedSub = await this.broker.subscribe({
87
+ topic: 'help.accepted.*',
88
+ handler: (msg)=>this.handleHelpAccepted(msg),
89
+ priority: MessagePriority.HIGH
90
+ });
91
+ this.subscriptions.push(acceptedSub);
92
+ // Subscribe to help completion notifications
93
+ const completedSub = await this.broker.subscribe({
94
+ topic: 'help.completed.*',
95
+ handler: (msg)=>this.handleHelpCompleted(msg),
96
+ priority: MessagePriority.HIGH
97
+ });
98
+ this.subscriptions.push(completedSub);
99
+ this.started = true;
100
+ }
101
+ /**
102
+ * Stop the help request handler and unsubscribe from topics
103
+ */ async stop() {
104
+ if (!this.started) {
105
+ return;
106
+ }
107
+ // Unsubscribe from all topics
108
+ for (const sub of this.subscriptions){
109
+ sub.unsubscribe();
110
+ }
111
+ this.subscriptions = [];
112
+ this.started = false;
113
+ }
114
+ /**
115
+ * Register an agent profile for help matching
116
+ */ registerAgent(profile) {
117
+ this.coordinator.registerAgent(profile);
118
+ }
119
+ /**
120
+ * Unregister an agent profile
121
+ */ unregisterAgent(agentId) {
122
+ this.coordinator.unregisterAgent(agentId);
123
+ }
124
+ /**
125
+ * Handle incoming help request
126
+ */ async handleHelpRequest(message) {
127
+ const startTime = performance.now();
128
+ this.metrics.totalRequests++;
129
+ console.log('[HelpRequestHandler] Received help request:', {
130
+ topic: message.topic,
131
+ requesterId: message.payload?.requesterId,
132
+ hasReplyTo: !!message.replyTo,
133
+ correlationId: message.correlationId
134
+ });
135
+ try {
136
+ const payload = message.payload;
137
+ // Validate payload
138
+ if (!payload.requesterId || !payload.description || !payload.capabilities) {
139
+ throw new Error('Invalid help request payload: missing required fields');
140
+ }
141
+ // Create and route help request via coordinator
142
+ const routingResult = await this.coordinator.createHelpRequest(payload.requesterId, payload.description, payload.capabilities, payload.priority, payload.metadata);
143
+ // Update metrics
144
+ const latency = performance.now() - startTime;
145
+ this.updateRoutingMetrics(latency, routingResult.status === 'success');
146
+ // Send reply with routing result
147
+ // Always include routing data in payload, success flag indicates match found
148
+ console.log('[HelpRequestHandler] Sending reply:', {
149
+ status: routingResult.status,
150
+ success: routingResult.status === 'success',
151
+ hasMatch: !!routingResult.match
152
+ });
153
+ await this.broker.reply(message, {
154
+ routingId: routingResult.routingId,
155
+ requestId: routingResult.request.requestId,
156
+ status: routingResult.status,
157
+ match: routingResult.match,
158
+ latencyMs: routingResult.latencyMs,
159
+ timestamp: routingResult.timestamp,
160
+ error: routingResult.error
161
+ }, routingResult.status === 'success', routingResult.error);
162
+ console.log('[HelpRequestHandler] Reply sent');
163
+ // Emit monitoring event
164
+ if (this.config.enableMonitoring) {
165
+ await this.emitRoutingEvent(routingResult);
166
+ }
167
+ } catch (error) {
168
+ this.metrics.failedRequests++;
169
+ // Send error reply
170
+ await this.broker.reply(message, null, false, error instanceof Error ? error.message : 'Unknown error during help routing');
171
+ }
172
+ }
173
+ /**
174
+ * Handle help acceptance notification
175
+ */ async handleHelpAccepted(message) {
176
+ try {
177
+ const payload = message.payload;
178
+ if (!payload.requestId || !payload.helperId) {
179
+ throw new Error('Invalid help accepted payload: missing requestId or helperId');
180
+ }
181
+ // Mark request as in progress in coordinator
182
+ await this.coordinator.startHelp(payload.requestId);
183
+ this.metrics.acceptedRequests++;
184
+ // Emit monitoring event
185
+ if (this.config.enableMonitoring) {
186
+ await this.broker.publish({
187
+ topic: 'help.event.accepted',
188
+ payload: {
189
+ requestId: payload.requestId,
190
+ helperId: payload.helperId,
191
+ timestamp: payload.timestamp
192
+ },
193
+ priority: MessagePriority.NORMAL
194
+ });
195
+ }
196
+ } catch (error) {
197
+ console.error('[HelpRequestHandler] Error handling help acceptance:', error);
198
+ }
199
+ }
200
+ /**
201
+ * Handle help completion notification
202
+ */ async handleHelpCompleted(message) {
203
+ try {
204
+ const payload = message.payload;
205
+ if (!payload.requestId || !payload.helperId) {
206
+ throw new Error('Invalid help completed payload: missing requestId or helperId');
207
+ }
208
+ if (payload.success) {
209
+ // Mark request as resolved
210
+ await this.coordinator.resolveHelp(payload.requestId, {
211
+ result: payload.result,
212
+ completedAt: payload.timestamp
213
+ });
214
+ } else {
215
+ // Mark request as failed
216
+ await this.coordinator.failHelp(payload.requestId, payload.error || 'Help request failed', {
217
+ error: payload.error,
218
+ failedAt: payload.timestamp
219
+ });
220
+ }
221
+ this.metrics.completedRequests++;
222
+ // Emit monitoring event
223
+ if (this.config.enableMonitoring) {
224
+ await this.broker.publish({
225
+ topic: 'help.event.completed',
226
+ payload: {
227
+ requestId: payload.requestId,
228
+ helperId: payload.helperId,
229
+ success: payload.success,
230
+ error: payload.error,
231
+ timestamp: payload.timestamp
232
+ },
233
+ priority: MessagePriority.NORMAL
234
+ });
235
+ }
236
+ } catch (error) {
237
+ console.error('[HelpRequestHandler] Error handling help completion:', error);
238
+ }
239
+ }
240
+ /**
241
+ * Emit routing event for monitoring
242
+ */ async emitRoutingEvent(result) {
243
+ await this.broker.publish({
244
+ topic: 'help.event.routed',
245
+ payload: {
246
+ routingId: result.routingId,
247
+ requestId: result.request.requestId,
248
+ requesterId: result.request.requesterId,
249
+ status: result.status,
250
+ latencyMs: result.latencyMs,
251
+ match: result.match ? {
252
+ agentId: result.match.agentId,
253
+ score: result.match.score
254
+ } : null,
255
+ timestamp: result.timestamp
256
+ },
257
+ priority: MessagePriority.LOW
258
+ });
259
+ }
260
+ /**
261
+ * Update routing metrics
262
+ */ updateRoutingMetrics(latencyMs, success) {
263
+ if (success) {
264
+ this.metrics.successfulRoutes++;
265
+ } else {
266
+ this.metrics.failedRequests++;
267
+ }
268
+ const totalRoutes = this.metrics.successfulRoutes + this.metrics.failedRequests;
269
+ this.metrics.avgRoutingLatencyMs = (this.metrics.avgRoutingLatencyMs * (totalRoutes - 1) + latencyMs) / totalRoutes;
270
+ }
271
+ /**
272
+ * Get priority name from enum value
273
+ */ getPriorityName(priority) {
274
+ switch(priority){
275
+ case HelpRequestPriority.CRITICAL:
276
+ return 'CRITICAL';
277
+ case HelpRequestPriority.HIGH:
278
+ return 'HIGH';
279
+ case HelpRequestPriority.NORMAL:
280
+ return 'NORMAL';
281
+ case HelpRequestPriority.LOW:
282
+ return 'LOW';
283
+ case HelpRequestPriority.MINIMAL:
284
+ return 'MINIMAL';
285
+ default:
286
+ return 'NORMAL';
287
+ }
288
+ }
289
+ /**
290
+ * Get handler metrics
291
+ */ getMetrics() {
292
+ return {
293
+ ...this.metrics,
294
+ coordinatorMetrics: this.coordinator.getMetrics()
295
+ };
296
+ }
297
+ /**
298
+ * Check if handler is started
299
+ */ isStarted() {
300
+ return this.started;
301
+ }
302
+ /**
303
+ * Reset metrics
304
+ */ resetMetrics() {
305
+ this.metrics = {
306
+ totalRequests: 0,
307
+ successfulRoutes: 0,
308
+ failedRequests: 0,
309
+ acceptedRequests: 0,
310
+ completedRequests: 0,
311
+ avgRoutingLatencyMs: 0,
312
+ timeoutEvents: 0
313
+ };
314
+ }
315
+ }
316
+
317
+ //# sourceMappingURL=help-request-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request-handler.ts"],"names":["MessagePriority","HelpRequestPriority","HelpRequestHandler","broker","coordinator","config","subscriptions","metrics","started","requestTimeout","enableMonitoring","totalRequests","successfulRoutes","failedRequests","acceptedRequests","completedRequests","avgRoutingLatencyMs","timeoutEvents","start","Error","priorities","Object","values","filter","v","priority","priorityName","getPriorityName","sub","subscribe","topic","handler","msg","handleHelpRequest","push","acceptedSub","handleHelpAccepted","HIGH","completedSub","handleHelpCompleted","stop","unsubscribe","registerAgent","profile","unregisterAgent","agentId","message","startTime","performance","now","console","log","requesterId","payload","hasReplyTo","replyTo","correlationId","description","capabilities","routingResult","createHelpRequest","metadata","latency","updateRoutingMetrics","status","success","hasMatch","match","reply","routingId","requestId","request","latencyMs","timestamp","error","emitRoutingEvent","helperId","startHelp","publish","NORMAL","resolveHelp","result","completedAt","failHelp","failedAt","score","LOW","totalRoutes","CRITICAL","MINIMAL","getMetrics","coordinatorMetrics","isStarted","resetMetrics"],"mappings":"AAAA;;;;;;;;;;;;CAYC,GAGD,SAEEA,eAAe,QAGV,qBAAqB;AAK5B,SAEEC,mBAAmB,QAGd,oBA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