claude-flow-novice 1.6.1 → 1.6.2

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 (244) hide show
  1. package/.claude/agents/cfn-loop/product-owner.md +54 -4
  2. package/.claude/commands/cfn-claude-sync.md +303 -0
  3. package/.claude/commands/cfn-loop-epic.md +290 -0
  4. package/.claude/commands/cfn-loop-single.md +168 -0
  5. package/.claude/commands/cfn-loop-sprints.md +384 -0
  6. package/.claude/commands/cfn-loop.md +180 -0
  7. package/.claude/commands/metrics-summary.md +58 -0
  8. package/.claude/commands/parse-epic.md +357 -0
  9. package/.claude/settings.json +4 -4
  10. package/.claude/settings.local.json +9 -2
  11. package/.claude-flow-novice/.claude/agents/cfn-loop/product-owner.md +792 -0
  12. package/.claude-flow-novice/dist/mcp/server.js +21 -2
  13. package/.claude-flow-novice/dist/src/api/claude-client.js +138 -3
  14. package/.claude-flow-novice/dist/src/api/claude-client.js.map +1 -1
  15. package/.claude-flow-novice/dist/src/cfn-loop/phase-orchestrator-example.js +1 -1
  16. package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js +247 -0
  17. package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js.map +1 -0
  18. package/.claude-flow-novice/dist/src/cli/commands/swarm.js +32 -15
  19. package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
  20. package/.claude-flow-novice/dist/src/cli/commands/transparency.js +455 -0
  21. package/.claude-flow-novice/dist/src/cli/commands/transparency.js.map +1 -0
  22. package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/CLAUDE.md +129 -13
  23. package/.claude-flow-novice/dist/src/components/visualizations/index.js +9 -0
  24. package/.claude-flow-novice/dist/src/components/visualizations/index.js.map +1 -0
  25. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +462 -0
  26. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -0
  27. package/.claude-flow-novice/dist/src/coordination/config-translator.js +248 -0
  28. package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -0
  29. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +287 -0
  30. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -0
  31. package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js +68 -9
  32. package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js.map +1 -1
  33. package/.claude-flow-novice/dist/src/coordination/feature-flags.js +166 -0
  34. package/.claude-flow-novice/dist/src/coordination/feature-flags.js.map +1 -0
  35. package/.claude-flow-novice/dist/src/coordination/queen-agent.js +18 -4
  36. package/.claude-flow-novice/dist/src/coordination/queen-agent.js.map +1 -1
  37. package/.claude-flow-novice/dist/src/coordination/role-assignment.js +6 -110
  38. package/.claude-flow-novice/dist/src/coordination/role-assignment.js.map +1 -1
  39. package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js +632 -0
  40. package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js.map +1 -0
  41. package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js +11 -0
  42. package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js.map +1 -0
  43. package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js +318 -0
  44. package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js.map +1 -0
  45. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js +364 -0
  46. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js.map +1 -0
  47. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js +492 -0
  48. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js.map +1 -0
  49. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js +786 -0
  50. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js.map +1 -0
  51. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js +16 -0
  52. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js.map +1 -0
  53. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js +342 -0
  54. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js.map +1 -0
  55. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js +601 -0
  56. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
  57. package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js +211 -0
  58. package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js.map +1 -0
  59. package/.claude-flow-novice/dist/src/coordination/v2/core/index.js +1 -0
  60. package/.claude-flow-novice/dist/src/coordination/v2/core/index.js.map +1 -1
  61. package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js +365 -6
  62. package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js.map +1 -1
  63. package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js +478 -0
  64. package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js.map +1 -0
  65. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js +5 -2
  66. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js.map +1 -1
  67. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js +189 -0
  68. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js.map +1 -1
  69. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js +424 -0
  70. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js.map +1 -0
  71. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js +9 -0
  72. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js.map +1 -0
  73. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js +669 -0
  74. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js.map +1 -0
  75. package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js +451 -0
  76. package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js.map +1 -0
  77. package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js +271 -0
  78. package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js.map +1 -0
  79. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js +335 -0
  80. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js.map +1 -0
  81. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js +439 -0
  82. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js.map +1 -0
  83. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js +92 -0
  84. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js.map +1 -0
  85. package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js +21 -0
  86. package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js.map +1 -0
  87. package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js +223 -0
  88. package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js.map +1 -0
  89. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js +436 -0
  90. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js.map +1 -0
  91. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js +278 -0
  92. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js.map +1 -0
  93. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js +317 -0
  94. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js.map +1 -0
  95. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js +273 -0
  96. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js.map +1 -0
  97. package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js +15 -0
  98. package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js.map +1 -0
  99. package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js +512 -0
  100. package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js.map +1 -0
  101. package/.claude-flow-novice/dist/src/coordination/v2/index.js +6 -0
  102. package/.claude-flow-novice/dist/src/coordination/v2/index.js.map +1 -1
  103. package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js +557 -0
  104. package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js.map +1 -0
  105. package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js +14 -0
  106. package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js.map +1 -0
  107. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js +212 -0
  108. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js.map +1 -0
  109. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js +552 -0
  110. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js.map +1 -0
  111. package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js +367 -0
  112. package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js.map +1 -0
  113. package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js +1 -0
  114. package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js.map +1 -1
  115. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js +371 -0
  116. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js.map +1 -0
  117. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js +355 -0
  118. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js.map +1 -0
  119. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js +424 -0
  120. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js.map +1 -0
  121. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js +16 -0
  122. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js.map +1 -0
  123. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js +295 -0
  124. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js.map +1 -0
  125. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js +411 -0
  126. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js.map +1 -0
  127. package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js +14 -0
  128. package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js.map +1 -0
  129. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js +387 -0
  130. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js.map +1 -0
  131. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js +589 -0
  132. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js.map +1 -0
  133. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js +444 -0
  134. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js.map +1 -0
  135. package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js +29 -8
  136. package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js.map +1 -1
  137. package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js +470 -0
  138. package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js.map +1 -0
  139. package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js +450 -0
  140. package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js.map +1 -0
  141. package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js +5 -0
  142. package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js.map +1 -1
  143. package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js +545 -0
  144. package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js.map +1 -0
  145. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js +44 -0
  146. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js.map +1 -1
  147. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js +415 -0
  148. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js.map +1 -0
  149. package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js +615 -0
  150. package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js.map +1 -0
  151. package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js +259 -0
  152. package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js.map +1 -0
  153. package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js +17 -0
  154. package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js.map +1 -0
  155. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js +357 -0
  156. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js.map +1 -0
  157. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js +679 -0
  158. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js.map +1 -0
  159. package/.claude-flow-novice/dist/src/core/agent-manager.js +30 -0
  160. package/.claude-flow-novice/dist/src/core/agent-manager.js.map +1 -1
  161. package/.claude-flow-novice/dist/src/mcp/server.js +21 -2
  162. package/.claude-flow-novice/dist/src/mcp/server.js.map +1 -1
  163. package/.claude-flow-novice/dist/src/observability/metrics-counter.js +268 -0
  164. package/.claude-flow-novice/dist/src/observability/metrics-counter.js.map +1 -0
  165. package/.claude-flow-novice/dist/src/observability/metrics-storage.js +265 -0
  166. package/.claude-flow-novice/dist/src/observability/metrics-storage.js.map +1 -0
  167. package/.claude-flow-novice/dist/src/observability/telemetry.js +26 -0
  168. package/.claude-flow-novice/dist/src/observability/telemetry.js.map +1 -1
  169. package/.claude-flow-novice/dist/src/providers/tiered-router.js +64 -10
  170. package/.claude-flow-novice/dist/src/providers/tiered-router.js.map +1 -1
  171. package/.claude-flow-novice/dist/src/providers/zai-provider.js +196 -97
  172. package/.claude-flow-novice/dist/src/providers/zai-provider.js.map +1 -1
  173. package/.claude-flow-novice/dist/src/slash-commands/cfn-claude-sync.js +533 -0
  174. package/.claude-flow-novice/dist/src/slash-commands/index.js +5 -0
  175. package/.claude-flow-novice/dist/src/slash-commands/metrics-summary-class.js +74 -0
  176. package/.claude-flow-novice/dist/src/slash-commands/metrics-summary.js +335 -0
  177. package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +12 -0
  178. package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js +96 -0
  179. package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js.map +1 -0
  180. package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js +406 -0
  181. package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js.map +1 -0
  182. package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js +35 -5
  183. package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js.map +1 -1
  184. package/.claude-flow-novice/dist/src/web/api/config/api-config.js +186 -0
  185. package/.claude-flow-novice/dist/src/web/api/config/api-config.js.map +1 -0
  186. package/.claude-flow-novice/dist/src/web/api/middleware/auth.js +205 -0
  187. package/.claude-flow-novice/dist/src/web/api/middleware/auth.js.map +1 -0
  188. package/.claude-flow-novice/dist/src/web/api/middleware/cache.js +262 -0
  189. package/.claude-flow-novice/dist/src/web/api/middleware/cache.js.map +1 -0
  190. package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js +250 -0
  191. package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js.map +1 -0
  192. package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js +217 -0
  193. package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js.map +1 -0
  194. package/.claude-flow-novice/dist/src/web/api/middleware/validation.js +325 -0
  195. package/.claude-flow-novice/dist/src/web/api/middleware/validation.js.map +1 -0
  196. package/.claude-flow-novice/dist/src/web/api/routes/events.js +465 -0
  197. package/.claude-flow-novice/dist/src/web/api/routes/events.js.map +1 -0
  198. package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js +302 -0
  199. package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js.map +1 -0
  200. package/.claude-flow-novice/dist/src/web/api/routes/index.js +14 -0
  201. package/.claude-flow-novice/dist/src/web/api/routes/index.js.map +1 -0
  202. package/.claude-flow-novice/dist/src/web/api/routes/metrics.js +561 -0
  203. package/.claude-flow-novice/dist/src/web/api/routes/metrics.js.map +1 -0
  204. package/.claude-flow-novice/dist/src/web/api/routes/status.js +450 -0
  205. package/.claude-flow-novice/dist/src/web/api/routes/status.js.map +1 -0
  206. package/.claude-flow-novice/dist/src/web/api/server.js +451 -0
  207. package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -0
  208. package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js +385 -0
  209. package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js.map +1 -0
  210. package/.claude-flow-novice/dist/src/web/dashboard/index.js +87 -0
  211. package/.claude-flow-novice/dist/src/web/dashboard/index.js.map +1 -0
  212. package/.claude-flow-novice/dist/src/web/dashboard/types.js +6 -0
  213. package/.claude-flow-novice/dist/src/web/dashboard/types.js.map +1 -0
  214. package/.claude-flow-novice/metrics.db +0 -0
  215. package/.claude-flow-novice/metrics.db-shm +0 -0
  216. package/.claude-flow-novice/metrics.db-wal +0 -0
  217. package/CLAUDE.md +29 -0
  218. package/README.md +27 -0
  219. package/config/hooks/post-edit-pipeline.js +36 -2
  220. package/examples/metrics-counter-demo.ts +106 -0
  221. package/examples/persistent-metrics-demo.ts +83 -0
  222. package/examples/phase-5-multi-level-control.ts +282 -0
  223. package/examples/session-pool-optimizer-example.ts +311 -0
  224. package/package.json +15 -3
  225. package/scripts/check-routing-stats.cjs +122 -0
  226. package/scripts/pre-publish-validation.cjs +212 -0
  227. package/scripts/test-provider-routing.cjs +228 -0
  228. package/scripts/test-routing-telemetry.cjs +147 -0
  229. package/scripts/test-zai-10k.cjs +81 -0
  230. package/scripts/test-zai-api.cjs +191 -0
  231. package/scripts/test-zai-diagnostic.cjs +151 -0
  232. package/scripts/test-zai-final.cjs +128 -0
  233. package/scripts/test-zai-with-env.cjs +85 -0
  234. package/scripts/validate-coordination-cli.js +69 -0
  235. package/scripts/validate-coordination-toggle-integration.cjs +501 -0
  236. package/src/cli/simple-commands/init/templates/CLAUDE.md +29 -0
  237. package/src/observability/metrics-counter.ts +347 -0
  238. package/src/observability/metrics-storage.ts +356 -0
  239. package/src/observability/telemetry.ts +658 -0
  240. package/src/slash-commands/cfn-claude-sync.js +533 -0
  241. package/src/slash-commands/index.js +5 -0
  242. package/src/slash-commands/metrics-summary-class.js +74 -0
  243. package/src/slash-commands/metrics-summary.js +335 -0
  244. package/src/slash-commands/register-all-commands.js +12 -0
@@ -0,0 +1,601 @@
1
+ /**
2
+ * Agent Coordination V2 - Swarm Coordinator (Unified API)
3
+ *
4
+ * Unified facade integrating all V2 coordination components:
5
+ * - Phase 1: State machine with auto-checkpointing
6
+ * - Phase 2: Dependency graph resolution
7
+ * - Phase 3: Event-driven message bus
8
+ * - Phase 4: Completion detection (hierarchical + mesh)
9
+ * - Phase 5: Hierarchical coordination (PM-based)
10
+ * - Phase 6: Mesh coordination (peer-to-peer) - future
11
+ * - Phase 7: Help system with capability matching
12
+ * - Phase 8: Deadlock detection and recovery
13
+ *
14
+ * Features:
15
+ * - Topology selection (hierarchical vs mesh)
16
+ * - Auto mode switching based on swarm size
17
+ * - Unified agent lifecycle API
18
+ * - Event-driven coordination
19
+ * - Cross-phase integration
20
+ *
21
+ * Performance Targets:
22
+ * - Agent spawn: <2s for 10 agents
23
+ * - State transition: <100ms (p99)
24
+ * - Checkpoint recovery: <500ms (p99)
25
+ * - Completion detection: <2s for 10 agents
26
+ *
27
+ * @module coordination/v2/coordinators/swarm-coordinator-v2
28
+ */ import { EventEmitter } from 'node:events';
29
+ import { Logger } from '../../../core/logger.js';
30
+ /**
31
+ * Swarm topology types
32
+ */ export var SwarmTopology = /*#__PURE__*/ function(SwarmTopology) {
33
+ /** Hierarchical PM-based topology (2-7+ agents) */ SwarmTopology["HIERARCHICAL"] = "hierarchical";
34
+ /** Mesh peer-to-peer topology (2-10 agents) */ SwarmTopology["MESH"] = "mesh";
35
+ /** Auto-select topology based on swarm size */ SwarmTopology["AUTO"] = "auto";
36
+ return SwarmTopology;
37
+ }({});
38
+ /**
39
+ * SwarmCoordinatorV2
40
+ *
41
+ * Unified coordinator facade integrating all V2 components:
42
+ *
43
+ * Architecture:
44
+ * - State Machine: Agent lifecycle with auto-checkpointing (Phase 1)
45
+ * - Dependency Manager: Task dependency resolution (Phase 2)
46
+ * - Message Bus: Event-driven communication (Phase 3)
47
+ * - Completion Detection: Hierarchical/Mesh detection (Phase 4)
48
+ * - Hierarchical Coordinator: PM-based coordination (Phase 5)
49
+ * - Help System: Capability-based help matching (Phase 7)
50
+ * - Deadlock Detection: Resource deadlock prevention (Phase 8)
51
+ *
52
+ * Topology Selection:
53
+ * - AUTO: <10 agents = Mesh, ≥10 agents = Hierarchical
54
+ * - HIERARCHICAL: PM-based, any size
55
+ * - MESH: Peer-to-peer, optimal for 2-10 agents
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * const coordinator = new SwarmCoordinatorV2(
60
+ * stateMachine,
61
+ * dependencyManager,
62
+ * messageBus,
63
+ * hierarchicalDetector,
64
+ * meshDetector,
65
+ * hierarchicalCoordinator,
66
+ * checkpointManager,
67
+ * helpCoordinator,
68
+ * deadlockDetector,
69
+ * { swarmId: 'swarm-1', topology: SwarmTopology.AUTO }
70
+ * );
71
+ *
72
+ * await coordinator.initialize();
73
+ *
74
+ * // Spawn agents
75
+ * const pm = await coordinator.spawnAgent({
76
+ * agentId: 'pm-1',
77
+ * type: 'pm',
78
+ * isProjectManager: true,
79
+ * priority: 10
80
+ * });
81
+ *
82
+ * const worker = await coordinator.spawnAgent({
83
+ * agentId: 'worker-1',
84
+ * type: 'coder',
85
+ * parentId: 'pm-1',
86
+ * priority: 5
87
+ * });
88
+ *
89
+ * // Wait for completion
90
+ * const result = await coordinator.waitForCompletion();
91
+ * console.log(`Swarm completed: ${result.completed}`);
92
+ * ```
93
+ */ export class SwarmCoordinatorV2 extends EventEmitter {
94
+ logger;
95
+ config;
96
+ // Core components (Phase 1-8)
97
+ stateMachine;
98
+ dependencyManager;
99
+ messageBus;
100
+ hierarchicalDetector;
101
+ meshDetector;
102
+ hierarchicalCoordinator;
103
+ checkpointManager;
104
+ helpCoordinator;
105
+ deadlockDetector;
106
+ // Swarm state
107
+ activeTopology;
108
+ agents;
109
+ rootPmId;
110
+ initialized;
111
+ // Completion tracking
112
+ completionPromise;
113
+ constructor(stateMachine, dependencyManager, messageBus, hierarchicalDetector, meshDetector, hierarchicalCoordinator, checkpointManager, helpCoordinator, deadlockDetector, config){
114
+ super();
115
+ this.logger = new Logger({
116
+ level: config?.enableLogging ? 'debug' : 'info',
117
+ format: 'text',
118
+ destination: 'console'
119
+ });
120
+ this.config = {
121
+ swarmId: config?.swarmId || `swarm_${Date.now()}`,
122
+ topology: config?.topology ?? "auto",
123
+ maxAgents: config?.maxAgents ?? 20,
124
+ autoCheckpoint: config?.autoCheckpoint ?? true,
125
+ enableCompletionDetection: config?.enableCompletionDetection ?? true,
126
+ enableHelpSystem: config?.enableHelpSystem ?? true,
127
+ enableDeadlockDetection: config?.enableDeadlockDetection ?? true,
128
+ enableLogging: config?.enableLogging ?? false
129
+ };
130
+ this.stateMachine = stateMachine;
131
+ this.dependencyManager = dependencyManager;
132
+ this.messageBus = messageBus;
133
+ this.hierarchicalDetector = hierarchicalDetector;
134
+ this.meshDetector = meshDetector;
135
+ this.hierarchicalCoordinator = hierarchicalCoordinator;
136
+ this.checkpointManager = checkpointManager;
137
+ this.helpCoordinator = helpCoordinator;
138
+ this.deadlockDetector = deadlockDetector;
139
+ this.activeTopology = this.config.topology;
140
+ this.agents = new Map();
141
+ this.initialized = false;
142
+ this.logger.info('SwarmCoordinatorV2 created', {
143
+ swarmId: this.config.swarmId,
144
+ topology: this.config.topology,
145
+ maxAgents: this.config.maxAgents
146
+ });
147
+ }
148
+ /**
149
+ * Initialize coordinator and all integrated components
150
+ */ async initialize() {
151
+ if (this.initialized) {
152
+ this.logger.warn('SwarmCoordinatorV2 already initialized');
153
+ return;
154
+ }
155
+ this.logger.info('Initializing SwarmCoordinatorV2', {
156
+ swarmId: this.config.swarmId
157
+ });
158
+ // Wire up event listeners
159
+ this.setupEventListeners();
160
+ // Initialize hierarchical coordinator (always needed for agent spawn)
161
+ await this.hierarchicalCoordinator.initialize();
162
+ this.initialized = true;
163
+ this.logger.info('SwarmCoordinatorV2 initialized successfully');
164
+ }
165
+ /**
166
+ * Spawn agent in swarm
167
+ *
168
+ * @param request - Agent spawn request
169
+ * @returns Spawned agent node
170
+ */ async spawnAgent(request) {
171
+ this.validateInitialized();
172
+ const { agentId, type, priority, parentId, isProjectManager, initialState, metadata } = request;
173
+ this.logger.debug('Spawning agent', {
174
+ agentId,
175
+ type,
176
+ isProjectManager
177
+ });
178
+ // Auto-select topology based on swarm size
179
+ if (this.config.topology === "auto") {
180
+ this.activeTopology = this.agents.size < 10 ? "mesh" : "hierarchical";
181
+ }
182
+ let node;
183
+ // Spawn via hierarchical coordinator
184
+ if (isProjectManager) {
185
+ const level = parentId ? this.getAgentLevel(parentId) + 1 : 0;
186
+ node = await this.hierarchicalCoordinator.spawnProjectManager(agentId, level, parentId);
187
+ if (!this.rootPmId && !parentId) {
188
+ this.rootPmId = agentId;
189
+ }
190
+ } else {
191
+ // Spawn as worker
192
+ const parent = parentId ? this.agents.get(parentId) : undefined;
193
+ const level = parent ? parent.level + 1 : 0;
194
+ // Create agent via state machine
195
+ const sessionId = `session_${agentId}_${Date.now()}`;
196
+ await this.stateMachine.registerAgent(agentId, sessionId, initialState);
197
+ node = {
198
+ agentId,
199
+ type,
200
+ state: initialState || 'IDLE',
201
+ level,
202
+ parentId,
203
+ childIds: [],
204
+ isProjectManager: false,
205
+ sessionId,
206
+ priority: priority ?? 5,
207
+ lastUpdated: Date.now(),
208
+ metadata
209
+ };
210
+ // Register with hierarchical coordinator if has parent
211
+ if (parentId && parent) {
212
+ parent.childIds.push(agentId);
213
+ }
214
+ }
215
+ this.agents.set(agentId, node);
216
+ // Register with help system if enabled
217
+ if (this.config.enableHelpSystem && this.helpCoordinator) {
218
+ // Agent profiles registered via help coordinator
219
+ }
220
+ // Emit agent spawned event
221
+ this.emit('agent:spawned', {
222
+ swarmId: this.config.swarmId,
223
+ agentId,
224
+ type,
225
+ isProjectManager,
226
+ topology: this.activeTopology
227
+ });
228
+ this.logger.info('Agent spawned', {
229
+ agentId,
230
+ type,
231
+ level: node.level,
232
+ parentId,
233
+ topology: this.activeTopology
234
+ });
235
+ return node;
236
+ }
237
+ /**
238
+ * Transition agent state
239
+ *
240
+ * @param agentId - Agent to transition
241
+ * @param newState - Target state
242
+ * @param metadata - Optional transition metadata
243
+ */ async transitionAgent(agentId, newState, metadata) {
244
+ this.validateInitialized();
245
+ await this.stateMachine.transition(agentId, newState, {
246
+ metadata
247
+ });
248
+ // Update local agent state
249
+ const agent = this.agents.get(agentId);
250
+ if (agent) {
251
+ agent.state = newState;
252
+ agent.lastUpdated = Date.now();
253
+ }
254
+ }
255
+ /**
256
+ * Delegate task from PM to worker
257
+ *
258
+ * @param pmId - Project Manager agent ID
259
+ * @param workerId - Worker agent ID
260
+ * @param taskId - Task identifier
261
+ * @param description - Task description
262
+ * @param priority - Task priority
263
+ */ async delegateTask(pmId, workerId, taskId, description, priority = 5) {
264
+ this.validateInitialized();
265
+ await this.hierarchicalCoordinator.delegateTask({
266
+ taskId,
267
+ description,
268
+ workerId,
269
+ pmId,
270
+ priority
271
+ });
272
+ // Register task in dependency manager
273
+ this.dependencyManager.registerTask({
274
+ id: taskId,
275
+ agentId: workerId,
276
+ taskId,
277
+ priority,
278
+ metadata: {
279
+ pmId,
280
+ description
281
+ }
282
+ });
283
+ }
284
+ /**
285
+ * Request help from another agent
286
+ *
287
+ * @param requestingAgentId - Agent requesting help
288
+ * @param helperAgentId - Agent to provide help
289
+ * @param reason - Help request reason
290
+ */ async requestHelp(requestingAgentId, helperAgentId, reason) {
291
+ this.validateInitialized();
292
+ if (!this.config.enableHelpSystem || !this.helpCoordinator) {
293
+ throw new Error('Help system not enabled');
294
+ }
295
+ // Transition requesting agent to WAITING
296
+ await this.transitionAgent(requestingAgentId, 'WAITING', {
297
+ reason
298
+ });
299
+ // Request help via state machine (handles HELPING transition)
300
+ const result = await this.stateMachine.requestHelp(requestingAgentId, helperAgentId, reason);
301
+ this.emit('help:requested', {
302
+ swarmId: this.config.swarmId,
303
+ requestingAgentId,
304
+ helperAgentId,
305
+ requestId: result.requestId
306
+ });
307
+ return result;
308
+ }
309
+ /**
310
+ * Complete help request
311
+ *
312
+ * @param requestId - Help request ID
313
+ */ async completeHelp(requestId) {
314
+ this.validateInitialized();
315
+ await this.stateMachine.completeHelp(requestId);
316
+ this.emit('help:completed', {
317
+ swarmId: this.config.swarmId,
318
+ requestId
319
+ });
320
+ }
321
+ /**
322
+ * Pause child agent (parent control)
323
+ *
324
+ * @param parentId - Parent agent ID
325
+ * @param childId - Child agent ID
326
+ * @param reason - Pause reason
327
+ */ async pauseChild(parentId, childId, reason) {
328
+ this.validateInitialized();
329
+ await this.hierarchicalCoordinator.pauseChild(parentId, childId, reason);
330
+ }
331
+ /**
332
+ * Resume child agent (parent control)
333
+ *
334
+ * @param parentId - Parent agent ID
335
+ * @param childId - Child agent ID
336
+ * @param checkpointId - Optional checkpoint ID
337
+ * @param reason - Resume reason
338
+ */ async resumeChild(parentId, childId, checkpointId, reason) {
339
+ this.validateInitialized();
340
+ await this.hierarchicalCoordinator.resumeChild(parentId, childId, checkpointId, reason);
341
+ }
342
+ /**
343
+ * Detect swarm completion
344
+ *
345
+ * Uses active topology detector (hierarchical or mesh).
346
+ *
347
+ * @returns Completion result
348
+ */ async detectCompletion() {
349
+ this.validateInitialized();
350
+ if (!this.config.enableCompletionDetection) {
351
+ throw new Error('Completion detection not enabled');
352
+ }
353
+ const startTime = performance.now();
354
+ // Use appropriate detector based on active topology
355
+ if (this.activeTopology === "hierarchical" && this.rootPmId) {
356
+ // Hierarchical completion detection
357
+ const agentConfigs = Array.from(this.agents.values()).map((node)=>({
358
+ agentId: node.agentId,
359
+ parentId: node.parentId,
360
+ isProjectManager: node.isProjectManager
361
+ }));
362
+ this.hierarchicalDetector.registerSwarm(this.config.swarmId, this.rootPmId, agentConfigs);
363
+ const result = await this.hierarchicalDetector.detectCompletion(this.config.swarmId);
364
+ return {
365
+ completed: result.completed,
366
+ swarmId: result.swarmId,
367
+ timestamp: result.timestamp,
368
+ agentStates: result.agentStates,
369
+ completedCount: result.completedCount,
370
+ totalCount: result.totalCount,
371
+ latencyMs: result.latencyMs,
372
+ checkpointId: result.checkpointId,
373
+ metadata: {
374
+ ...result.metadata,
375
+ topology: "hierarchical"
376
+ }
377
+ };
378
+ } else {
379
+ // Mesh completion detection
380
+ const agentIds = Array.from(this.agents.keys());
381
+ await this.meshDetector.initializeSwarm(this.config.swarmId, agentIds);
382
+ await this.meshDetector.startMonitoring(this.config.swarmId);
383
+ const completed = await this.meshDetector.detectCompletion(this.config.swarmId);
384
+ const agentStates = new Map();
385
+ for (const [agentId, node] of this.agents.entries()){
386
+ agentStates.set(agentId, node.state);
387
+ }
388
+ return {
389
+ completed,
390
+ swarmId: this.config.swarmId,
391
+ timestamp: new Date(),
392
+ agentStates,
393
+ completedCount: Array.from(agentStates.values()).filter((s)=>s === 'COMPLETED').length,
394
+ totalCount: this.agents.size,
395
+ latencyMs: performance.now() - startTime,
396
+ metadata: {
397
+ topology: "mesh"
398
+ }
399
+ };
400
+ }
401
+ }
402
+ /**
403
+ * Wait for swarm completion
404
+ *
405
+ * Blocks until swarm completes or timeout.
406
+ *
407
+ * @param timeoutMs - Optional timeout in milliseconds
408
+ * @returns Completion result
409
+ */ async waitForCompletion(timeoutMs) {
410
+ this.validateInitialized();
411
+ return new Promise((resolve, reject)=>{
412
+ this.completionPromise = {
413
+ resolve,
414
+ reject
415
+ };
416
+ // Set timeout if specified
417
+ if (timeoutMs) {
418
+ setTimeout(()=>{
419
+ if (this.completionPromise) {
420
+ this.completionPromise.reject(new Error(`Swarm completion timeout after ${timeoutMs}ms`));
421
+ this.completionPromise = undefined;
422
+ }
423
+ }, timeoutMs);
424
+ }
425
+ // Poll for completion
426
+ const pollInterval = setInterval(async ()=>{
427
+ try {
428
+ const result = await this.detectCompletion();
429
+ if (result.completed && this.completionPromise) {
430
+ clearInterval(pollInterval);
431
+ this.completionPromise.resolve(result);
432
+ this.completionPromise = undefined;
433
+ }
434
+ } catch (error) {
435
+ clearInterval(pollInterval);
436
+ if (this.completionPromise) {
437
+ this.completionPromise.reject(error);
438
+ this.completionPromise = undefined;
439
+ }
440
+ }
441
+ }, 1000);
442
+ });
443
+ }
444
+ /**
445
+ * Get swarm statistics
446
+ */ getStatistics() {
447
+ const stateMachineMetrics = this.stateMachine.getMetrics();
448
+ const dependencyStats = this.dependencyManager.getStatistics();
449
+ const messageBusStats = this.messageBus.getStats();
450
+ const completedCount = Array.from(this.agents.values()).filter((a)=>a.state === 'COMPLETED').length;
451
+ const stats = {
452
+ swarmId: this.config.swarmId,
453
+ topology: this.activeTopology,
454
+ totalAgents: this.agents.size,
455
+ activeAgents: Array.from(this.agents.values()).filter((a)=>a.state !== 'COMPLETED' && a.state !== 'PAUSED').length,
456
+ completedAgents: completedCount,
457
+ completionPercentage: this.agents.size > 0 ? completedCount / this.agents.size * 100 : 0,
458
+ stateMachine: {
459
+ totalTransitions: stateMachineMetrics.totalTransitions,
460
+ averageLatencyMs: stateMachineMetrics.averageTransitionLatencyMs,
461
+ p99LatencyMs: stateMachineMetrics.p99TransitionLatencyMs
462
+ },
463
+ dependencies: {
464
+ totalTasks: dependencyStats.totalTasks,
465
+ completedTasks: dependencyStats.completedTasks,
466
+ readyTasks: dependencyStats.readyTasks,
467
+ blockedTasks: dependencyStats.blockedTasks
468
+ },
469
+ messaging: {
470
+ totalPublished: messageBusStats.totalPublished,
471
+ totalDelivered: messageBusStats.totalDelivered,
472
+ totalSubscriptions: messageBusStats.totalSubscriptions
473
+ }
474
+ };
475
+ // Add help system metrics if enabled
476
+ if (this.config.enableHelpSystem && this.helpCoordinator) {
477
+ const helpMetrics = this.helpCoordinator.getMetrics();
478
+ stats.helpSystem = {
479
+ totalRequests: helpMetrics.totalRequests,
480
+ successfulMatches: helpMetrics.successfulMatches,
481
+ averageMatchTimeMs: helpMetrics.averageMatchTimeMs
482
+ };
483
+ }
484
+ // Add deadlock metrics if enabled
485
+ if (this.config.enableDeadlockDetection && this.deadlockDetector) {
486
+ const deadlockMetrics = this.deadlockDetector.getMetrics();
487
+ stats.deadlockDetection = {
488
+ cyclesDetected: deadlockMetrics.cyclesDetected,
489
+ recoveryActions: deadlockMetrics.recoveryActions
490
+ };
491
+ }
492
+ return stats;
493
+ }
494
+ /**
495
+ * Get agent by ID
496
+ */ getAgent(agentId) {
497
+ return this.agents.get(agentId);
498
+ }
499
+ /**
500
+ * Get all agents
501
+ */ getAllAgents() {
502
+ return Array.from(this.agents.values());
503
+ }
504
+ /**
505
+ * Get active topology
506
+ */ getTopology() {
507
+ return this.activeTopology;
508
+ }
509
+ /**
510
+ * Setup event listeners for cross-component integration
511
+ */ setupEventListeners() {
512
+ // State machine events
513
+ this.stateMachine.on('state:transition', (event)=>{
514
+ const agent = this.agents.get(event.agentId);
515
+ if (agent) {
516
+ agent.state = event.toState;
517
+ agent.lastUpdated = Date.now();
518
+ }
519
+ this.emit('agent:state:changed', {
520
+ swarmId: this.config.swarmId,
521
+ ...event
522
+ });
523
+ });
524
+ // Hierarchical coordinator events
525
+ this.hierarchicalCoordinator.on('task:delegated', (event)=>{
526
+ this.emit('task:delegated', {
527
+ swarmId: this.config.swarmId,
528
+ ...event
529
+ });
530
+ });
531
+ this.hierarchicalCoordinator.on('parent:control', (event)=>{
532
+ this.emit('parent:control', {
533
+ swarmId: this.config.swarmId,
534
+ ...event
535
+ });
536
+ });
537
+ // Message bus events
538
+ this.messageBus.on('message-published', (event)=>{
539
+ this.emit('message:published', {
540
+ swarmId: this.config.swarmId,
541
+ ...event
542
+ });
543
+ });
544
+ // Help system events (if enabled)
545
+ if (this.config.enableHelpSystem && this.helpCoordinator) {
546
+ this.helpCoordinator.on('help:matched', (event)=>{
547
+ this.emit('help:matched', {
548
+ swarmId: this.config.swarmId,
549
+ ...event
550
+ });
551
+ });
552
+ }
553
+ // Deadlock events (if enabled)
554
+ if (this.config.enableDeadlockDetection && this.deadlockDetector) {
555
+ this.deadlockDetector.on('deadlock:detected', (event)=>{
556
+ this.emit('deadlock:detected', {
557
+ swarmId: this.config.swarmId,
558
+ ...event
559
+ });
560
+ });
561
+ }
562
+ }
563
+ /**
564
+ * Get agent hierarchy level
565
+ */ getAgentLevel(agentId) {
566
+ const agent = this.agents.get(agentId);
567
+ return agent ? agent.level : 0;
568
+ }
569
+ /**
570
+ * Validate coordinator is initialized
571
+ */ validateInitialized() {
572
+ if (!this.initialized) {
573
+ throw new Error('SwarmCoordinatorV2 not initialized. Call initialize() first.');
574
+ }
575
+ }
576
+ /**
577
+ * Cleanup coordinator and release resources
578
+ */ async cleanup() {
579
+ this.logger.info('Cleaning up SwarmCoordinatorV2', {
580
+ swarmId: this.config.swarmId
581
+ });
582
+ // Cleanup hierarchical coordinator
583
+ await this.hierarchicalCoordinator.cleanup();
584
+ // Cleanup state machine
585
+ await this.stateMachine.cleanup();
586
+ // Cleanup mesh detector
587
+ if (this.activeTopology === "mesh") {
588
+ this.meshDetector.cleanup(this.config.swarmId);
589
+ }
590
+ // Shutdown message bus
591
+ this.messageBus.shutdown();
592
+ // Clear state
593
+ this.agents.clear();
594
+ this.initialized = false;
595
+ this.completionPromise = undefined;
596
+ this.removeAllListeners();
597
+ this.logger.info('SwarmCoordinatorV2 cleaned up successfully');
598
+ }
599
+ }
600
+
601
+ //# sourceMappingURL=swarm-coordinator-v2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/coordination/v2/coordinators/swarm-coordinator-v2.ts"],"names":["EventEmitter","Logger","SwarmTopology","SwarmCoordinatorV2","logger","config","stateMachine","dependencyManager","messageBus","hierarchicalDetector","meshDetector","hierarchicalCoordinator","checkpointManager","helpCoordinator","deadlockDetector","activeTopology","agents","rootPmId","initialized","completionPromise","level","enableLogging","format","destination","swarmId","Date","now","topology","maxAgents","autoCheckpoint","enableCompletionDetection","enableHelpSystem","enableDeadlockDetection","Map","info","initialize","warn","setupEventListeners","spawnAgent","request","validateInitialized","agentId","type","priority","parentId","isProjectManager","initialState","metadata","debug","size","node","getAgentLevel","spawnProjectManager","parent","get","undefined","sessionId","registerAgent","state","childIds","lastUpdated","push","set","emit","transitionAgent","newState","transition","agent","delegateTask","pmId","workerId","taskId","description","registerTask","id","requestHelp","requestingAgentId","helperAgentId","reason","Error","result","requestId","completeHelp","pauseChild","childId","resumeChild","checkpointId","detectCompletion","startTime","performance","agentConfigs","Array","from","values","map","registerSwarm","completed","timestamp","agentStates","completedCount","totalCount","latencyMs","agentIds","keys","initializeSwarm","startMonitoring","entries","filter","s","length","waitForCompletion","timeoutMs","Promise","resolve","reject","setTimeout","pollInterval","setInterval","clearInterval","error","getStatistics","stateMachineMetrics","getMetrics","dependencyStats","messageBusStats","getStats","a","stats","totalAgents","activeAgents","completedAgents","completionPercentage","totalTransitions","averageLatencyMs","averageTransitionLatencyMs","p99LatencyMs","p99TransitionLatencyMs","dependencies","totalTasks","completedTasks","readyTasks","blockedTasks","messaging","totalPublished","totalDelivered","totalSubscriptions","helpMetrics","helpSystem","totalRequests","successfulMatches","averageMatchTimeMs","deadlockMetrics","deadlockDetection","cyclesDetected","recoveryActions","getAgent","getAllAgents","getTopology","on","event","toState","cleanup","shutdown","clear","removeAllListeners"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BC,GAED,SAASA,YAAY,QAAQ,cAAc;AAW3C,SAASC,MAAM,QAAQ,0BAA0B;AAEjD;;CAEC,GACD,OAAO,IAAA,AAAKC,uCAAAA;IACV,iDAAiD;IAGjD,6CAA6C;IAG7C,6CAA6C;WAPnCA;MASX;AAmJD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDC,GACD,OAAO,MAAMC,2BAA2BH;IACrBI,OAAe;IACfC,OAAyC;IAE1D,8BAA8B;IACbC,aAA2B;IAC3BC,kBAAqC;IACrCC,WAAuB;IACvBC,qBAAqD;IACrDC,aAAqC;IACrCC,wBAAiD;IACjDC,kBAAqC;IACrCC,gBAAkC;IAClCC,iBAAoC;IAErD,cAAc;IACNC,eAA8B;IAC9BC,OAA2C;IAC3CC,SAAkB;IAClBC,YAAqB;IAE7B,sBAAsB;IACdC,kBAGN;IAEF,YACEb,YAA0B,EAC1BC,iBAAoC,EACpCC,UAAsB,EACtBC,oBAAoD,EACpDC,YAAoC,EACpCC,uBAAgD,EAChDC,iBAAoC,EACpCC,eAAiC,EACjCC,gBAAmC,EACnCT,MAA+B,CAC/B;QACA,KAAK;QAEL,IAAI,CAACD,MAAM,GAAG,IAAIH,OAAO;YACvBmB,OAAOf,QAAQgB,gBAAgB,UAAU;YACzCC,QAAQ;YACRC,aAAa;QACf;QAEA,IAAI,CAAClB,MAAM,GAAG;YACZmB,SAASnB,QAAQmB,WAAW,CAAC,MAAM,EAAEC,KAAKC,GAAG,IAAI;YACjDC,UAAUtB,QAAQsB;YAClBC,WAAWvB,QAAQuB,aAAa;YAChCC,gBAAgBxB,QAAQwB,kBAAkB;YAC1CC,2BAA2Bz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