claude-flow-novice 1.6.1 → 1.6.3

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 (273) 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 +5 -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/auth-service.js +84 -38
  14. package/.claude-flow-novice/dist/src/api/auth-service.js.map +1 -1
  15. package/.claude-flow-novice/dist/src/api/claude-client.js +138 -3
  16. package/.claude-flow-novice/dist/src/api/claude-client.js.map +1 -1
  17. package/.claude-flow-novice/dist/src/cfn-loop/phase-orchestrator-example.js +1 -1
  18. package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js +247 -0
  19. package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js.map +1 -0
  20. package/.claude-flow-novice/dist/src/cli/commands/swarm.js +32 -15
  21. package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
  22. package/.claude-flow-novice/dist/src/cli/commands/transparency.js +455 -0
  23. package/.claude-flow-novice/dist/src/cli/commands/transparency.js.map +1 -0
  24. package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/CLAUDE.md +129 -13
  25. package/.claude-flow-novice/dist/src/components/visualizations/index.js +9 -0
  26. package/.claude-flow-novice/dist/src/components/visualizations/index.js.map +1 -0
  27. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +462 -0
  28. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -0
  29. package/.claude-flow-novice/dist/src/coordination/config-translator.js +248 -0
  30. package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -0
  31. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +287 -0
  32. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -0
  33. package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js +68 -9
  34. package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js.map +1 -1
  35. package/.claude-flow-novice/dist/src/coordination/feature-flags.js +166 -0
  36. package/.claude-flow-novice/dist/src/coordination/feature-flags.js.map +1 -0
  37. package/.claude-flow-novice/dist/src/coordination/queen-agent.js +18 -4
  38. package/.claude-flow-novice/dist/src/coordination/queen-agent.js.map +1 -1
  39. package/.claude-flow-novice/dist/src/coordination/role-assignment.js +6 -110
  40. package/.claude-flow-novice/dist/src/coordination/role-assignment.js.map +1 -1
  41. package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js +632 -0
  42. package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js.map +1 -0
  43. package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js +11 -0
  44. package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js.map +1 -0
  45. package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js +318 -0
  46. package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js.map +1 -0
  47. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js +364 -0
  48. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js.map +1 -0
  49. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js +492 -0
  50. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js.map +1 -0
  51. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js +786 -0
  52. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js.map +1 -0
  53. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js +16 -0
  54. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js.map +1 -0
  55. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js +342 -0
  56. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js.map +1 -0
  57. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js +601 -0
  58. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
  59. package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js +211 -0
  60. package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js.map +1 -0
  61. package/.claude-flow-novice/dist/src/coordination/v2/core/index.js +1 -0
  62. package/.claude-flow-novice/dist/src/coordination/v2/core/index.js.map +1 -1
  63. package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js +365 -6
  64. package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js.map +1 -1
  65. package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js +478 -0
  66. package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js.map +1 -0
  67. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js +5 -2
  68. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js.map +1 -1
  69. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js +189 -0
  70. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js.map +1 -1
  71. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js +424 -0
  72. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js.map +1 -0
  73. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js +9 -0
  74. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js.map +1 -0
  75. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js +669 -0
  76. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js.map +1 -0
  77. package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js +451 -0
  78. package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js.map +1 -0
  79. package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js +271 -0
  80. package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js.map +1 -0
  81. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js +335 -0
  82. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js.map +1 -0
  83. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js +439 -0
  84. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js.map +1 -0
  85. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js +92 -0
  86. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js.map +1 -0
  87. package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js +21 -0
  88. package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js.map +1 -0
  89. package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js +223 -0
  90. package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js.map +1 -0
  91. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js +436 -0
  92. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js.map +1 -0
  93. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js +278 -0
  94. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js.map +1 -0
  95. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js +317 -0
  96. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js.map +1 -0
  97. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js +273 -0
  98. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js.map +1 -0
  99. package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js +15 -0
  100. package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js.map +1 -0
  101. package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js +512 -0
  102. package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js.map +1 -0
  103. package/.claude-flow-novice/dist/src/coordination/v2/index.js +6 -0
  104. package/.claude-flow-novice/dist/src/coordination/v2/index.js.map +1 -1
  105. package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js +557 -0
  106. package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js.map +1 -0
  107. package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js +14 -0
  108. package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js.map +1 -0
  109. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js +212 -0
  110. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js.map +1 -0
  111. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js +552 -0
  112. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js.map +1 -0
  113. package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js +367 -0
  114. package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js.map +1 -0
  115. package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js +1 -0
  116. package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js.map +1 -1
  117. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js +371 -0
  118. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js.map +1 -0
  119. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js +355 -0
  120. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js.map +1 -0
  121. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js +424 -0
  122. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js.map +1 -0
  123. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js +16 -0
  124. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js.map +1 -0
  125. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js +295 -0
  126. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js.map +1 -0
  127. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js +411 -0
  128. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js.map +1 -0
  129. package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js +14 -0
  130. package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js.map +1 -0
  131. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js +387 -0
  132. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js.map +1 -0
  133. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js +589 -0
  134. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js.map +1 -0
  135. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js +444 -0
  136. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js.map +1 -0
  137. package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js +29 -8
  138. package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js.map +1 -1
  139. package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js +470 -0
  140. package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js.map +1 -0
  141. package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js +450 -0
  142. package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js.map +1 -0
  143. package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js +5 -0
  144. package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js.map +1 -1
  145. package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js +545 -0
  146. package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js.map +1 -0
  147. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js +44 -0
  148. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js.map +1 -1
  149. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js +415 -0
  150. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js.map +1 -0
  151. package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js +615 -0
  152. package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js.map +1 -0
  153. package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js +259 -0
  154. package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js.map +1 -0
  155. package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js +17 -0
  156. package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js.map +1 -0
  157. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js +357 -0
  158. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js.map +1 -0
  159. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js +679 -0
  160. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js.map +1 -0
  161. package/.claude-flow-novice/dist/src/core/agent-manager.js +30 -0
  162. package/.claude-flow-novice/dist/src/core/agent-manager.js.map +1 -1
  163. package/.claude-flow-novice/dist/src/mcp/server.js +21 -2
  164. package/.claude-flow-novice/dist/src/mcp/server.js.map +1 -1
  165. package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js +719 -0
  166. package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js.map +1 -0
  167. package/.claude-flow-novice/dist/src/monitoring/apm/datadog-collector.js +363 -0
  168. package/.claude-flow-novice/dist/src/monitoring/apm/datadog-collector.js.map +1 -0
  169. package/.claude-flow-novice/dist/src/monitoring/apm/index.js +97 -0
  170. package/.claude-flow-novice/dist/src/monitoring/apm/index.js.map +1 -0
  171. package/.claude-flow-novice/dist/src/monitoring/apm/newrelic-collector.js +384 -0
  172. package/.claude-flow-novice/dist/src/monitoring/apm/newrelic-collector.js.map +1 -0
  173. package/.claude-flow-novice/dist/src/monitoring/apm/performance-optimizer.js +612 -0
  174. package/.claude-flow-novice/dist/src/monitoring/apm/performance-optimizer.js.map +1 -0
  175. package/.claude-flow-novice/dist/src/monitoring/metrics-collector.js +282 -0
  176. package/.claude-flow-novice/dist/src/monitoring/metrics-collector.js.map +1 -0
  177. package/.claude-flow-novice/dist/src/observability/metrics-counter.js +268 -0
  178. package/.claude-flow-novice/dist/src/observability/metrics-counter.js.map +1 -0
  179. package/.claude-flow-novice/dist/src/observability/metrics-storage.js +265 -0
  180. package/.claude-flow-novice/dist/src/observability/metrics-storage.js.map +1 -0
  181. package/.claude-flow-novice/dist/src/observability/telemetry.js +26 -0
  182. package/.claude-flow-novice/dist/src/observability/telemetry.js.map +1 -1
  183. package/.claude-flow-novice/dist/src/providers/tiered-router.js +64 -10
  184. package/.claude-flow-novice/dist/src/providers/tiered-router.js.map +1 -1
  185. package/.claude-flow-novice/dist/src/providers/zai-provider.js +196 -97
  186. package/.claude-flow-novice/dist/src/providers/zai-provider.js.map +1 -1
  187. package/.claude-flow-novice/dist/src/slash-commands/cfn-claude-sync.js +533 -0
  188. package/.claude-flow-novice/dist/src/slash-commands/index.js +5 -0
  189. package/.claude-flow-novice/dist/src/slash-commands/metrics-summary-class.js +74 -0
  190. package/.claude-flow-novice/dist/src/slash-commands/metrics-summary.js +335 -0
  191. package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +12 -0
  192. package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js +96 -0
  193. package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js.map +1 -0
  194. package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js +406 -0
  195. package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js.map +1 -0
  196. package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js +35 -5
  197. package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js.map +1 -1
  198. package/.claude-flow-novice/dist/src/web/api/apm-routes.js +355 -0
  199. package/.claude-flow-novice/dist/src/web/api/apm-routes.js.map +1 -0
  200. package/.claude-flow-novice/dist/src/web/api/config/api-config.js +186 -0
  201. package/.claude-flow-novice/dist/src/web/api/config/api-config.js.map +1 -0
  202. package/.claude-flow-novice/dist/src/web/api/middleware/auth.js +205 -0
  203. package/.claude-flow-novice/dist/src/web/api/middleware/auth.js.map +1 -0
  204. package/.claude-flow-novice/dist/src/web/api/middleware/cache.js +262 -0
  205. package/.claude-flow-novice/dist/src/web/api/middleware/cache.js.map +1 -0
  206. package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js +250 -0
  207. package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js.map +1 -0
  208. package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js +217 -0
  209. package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js.map +1 -0
  210. package/.claude-flow-novice/dist/src/web/api/middleware/validation.js +325 -0
  211. package/.claude-flow-novice/dist/src/web/api/middleware/validation.js.map +1 -0
  212. package/.claude-flow-novice/dist/src/web/api/routes/events.js +465 -0
  213. package/.claude-flow-novice/dist/src/web/api/routes/events.js.map +1 -0
  214. package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js +302 -0
  215. package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js.map +1 -0
  216. package/.claude-flow-novice/dist/src/web/api/routes/index.js +14 -0
  217. package/.claude-flow-novice/dist/src/web/api/routes/index.js.map +1 -0
  218. package/.claude-flow-novice/dist/src/web/api/routes/metrics.js +561 -0
  219. package/.claude-flow-novice/dist/src/web/api/routes/metrics.js.map +1 -0
  220. package/.claude-flow-novice/dist/src/web/api/routes/status.js +450 -0
  221. package/.claude-flow-novice/dist/src/web/api/routes/status.js.map +1 -0
  222. package/.claude-flow-novice/dist/src/web/api/server.js +451 -0
  223. package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -0
  224. package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js +385 -0
  225. package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js.map +1 -0
  226. package/.claude-flow-novice/dist/src/web/dashboard/index.js +87 -0
  227. package/.claude-flow-novice/dist/src/web/dashboard/index.js.map +1 -0
  228. package/.claude-flow-novice/dist/src/web/dashboard/types.js +6 -0
  229. package/.claude-flow-novice/dist/src/web/dashboard/types.js.map +1 -0
  230. package/.claude-flow-novice/dist/src/web/frontend/src/utils/security.js +425 -0
  231. package/.claude-flow-novice/dist/src/web/frontend/src/utils/security.js.map +1 -0
  232. package/.claude-flow-novice/dist/src/web/security/security-middleware.js +379 -0
  233. package/.claude-flow-novice/dist/src/web/security/security-middleware.js.map +1 -0
  234. package/.claude-flow-novice/dist/src/web/websocket/apm-websocket-handler.js +441 -0
  235. package/.claude-flow-novice/dist/src/web/websocket/apm-websocket-handler.js.map +1 -0
  236. package/.claude-flow-novice/dist/src/web/websocket/websocket-manager.js +255 -1
  237. package/.claude-flow-novice/dist/src/web/websocket/websocket-manager.js.map +1 -1
  238. package/.claude-flow-novice/metrics.db +0 -0
  239. package/.claude-flow-novice/metrics.db-shm +0 -0
  240. package/.claude-flow-novice/metrics.db-wal +0 -0
  241. package/AGENT_PERFORMANCE_GUIDELINES.md +88 -0
  242. package/CLAUDE.md +60 -3
  243. package/MEMORY_LEAK_ROOT_CAUSE.md +149 -0
  244. package/README.md +27 -0
  245. package/config/hooks/post-edit-pipeline.js +36 -2
  246. package/examples/metrics-counter-demo.ts +106 -0
  247. package/examples/persistent-metrics-demo.ts +83 -0
  248. package/examples/phase-5-multi-level-control.ts +282 -0
  249. package/examples/session-pool-optimizer-example.ts +311 -0
  250. package/package.json +18 -4
  251. package/scripts/check-routing-stats.cjs +122 -0
  252. package/scripts/monitor-loop.sh +65 -0
  253. package/scripts/monitor-memory.sh +47 -0
  254. package/scripts/monitor.py +43 -0
  255. package/scripts/pre-publish-validation.cjs +212 -0
  256. package/scripts/test-provider-routing.cjs +228 -0
  257. package/scripts/test-routing-telemetry.cjs +147 -0
  258. package/scripts/test-zai-10k.cjs +81 -0
  259. package/scripts/test-zai-api.cjs +191 -0
  260. package/scripts/test-zai-diagnostic.cjs +151 -0
  261. package/scripts/test-zai-final.cjs +128 -0
  262. package/scripts/test-zai-with-env.cjs +85 -0
  263. package/scripts/validate-coordination-cli.js +69 -0
  264. package/scripts/validate-coordination-toggle-integration.cjs +501 -0
  265. package/src/cli/simple-commands/init/templates/CLAUDE.md +29 -0
  266. package/src/observability/metrics-counter.ts +347 -0
  267. package/src/observability/metrics-storage.ts +356 -0
  268. package/src/observability/telemetry.ts +658 -0
  269. package/src/slash-commands/cfn-claude-sync.js +533 -0
  270. package/src/slash-commands/index.js +5 -0
  271. package/src/slash-commands/metrics-summary-class.js +74 -0
  272. package/src/slash-commands/metrics-summary.js +335 -0
  273. package/src/slash-commands/register-all-commands.js +12 -0
@@ -0,0 +1,439 @@
1
+ /**
2
+ * Agent Coordination V2 - Dependency Manager Implementation
3
+ *
4
+ * Coordinates dependency resolution using topological sorting and graph analysis.
5
+ * Provides high-level API for managing agent task dependencies.
6
+ *
7
+ * @module coordination/v2/dependency/dependency-manager
8
+ */ import { DependencyGraph } from '../core/dependency-graph.js';
9
+ import { DependencyNodeStatus, DependencyNodeImpl } from '../core/dependency-node.js';
10
+ import { TopologicalSort } from './topological-sort.js';
11
+ /**
12
+ * Dependency Manager for Agent Coordination.
13
+ *
14
+ * Provides high-level dependency management operations:
15
+ * - Task registration with dependency tracking
16
+ * - Topological resolution for execution ordering
17
+ * - Incremental batch resolution for concurrent execution
18
+ * - Status tracking and propagation
19
+ * - Cycle detection and validation
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const manager = new DependencyManager();
24
+ *
25
+ * // Register tasks with dependencies
26
+ * manager.registerTask({
27
+ * id: 'task-1',
28
+ * agentId: 'agent-a',
29
+ * taskId: 'implement-auth',
30
+ * dependencies: []
31
+ * });
32
+ *
33
+ * manager.registerTask({
34
+ * id: 'task-2',
35
+ * agentId: 'agent-b',
36
+ * taskId: 'test-auth',
37
+ * dependencies: ['task-1']
38
+ * });
39
+ *
40
+ * // Resolve dependencies
41
+ * const resolution = manager.resolveDependencies({
42
+ * agentId: 'agent-b',
43
+ * taskId: 'test-auth'
44
+ * });
45
+ *
46
+ * console.log('Execution order:', resolution.executionOrder);
47
+ * console.log('Ready tasks:', resolution.readyTasks);
48
+ * ```
49
+ */ export class DependencyManager {
50
+ graph;
51
+ sorter;
52
+ config;
53
+ completedTasks;
54
+ /**
55
+ * Creates a new dependency manager.
56
+ *
57
+ * @param config - Manager configuration
58
+ */ constructor(config){
59
+ this.config = {
60
+ maxGraphSize: config?.maxGraphSize ?? 10000,
61
+ autoValidate: config?.autoValidate ?? true,
62
+ trackPerformance: config?.trackPerformance ?? false
63
+ };
64
+ this.graph = new DependencyGraph({
65
+ maxSize: this.config.maxGraphSize,
66
+ autoValidate: this.config.autoValidate
67
+ });
68
+ this.sorter = new TopologicalSort(this.graph);
69
+ this.completedTasks = new Set();
70
+ }
71
+ // ============================================
72
+ // Task Registration
73
+ // ============================================
74
+ /**
75
+ * Registers a new task with its dependencies.
76
+ *
77
+ * @param config - Task configuration
78
+ * @throws {DependencyNodeValidationError} If task configuration is invalid
79
+ * @throws {DependencyGraphError} If adding task would create cycle
80
+ */ registerTask(config) {
81
+ const startTime = this.config.trackPerformance ? performance.now() : 0;
82
+ // Create dependency node
83
+ const node = new DependencyNodeImpl({
84
+ id: config.id,
85
+ agentId: config.agentId,
86
+ taskId: config.taskId,
87
+ dependencies: config.dependencies || [],
88
+ priority: config.priority,
89
+ metadata: config.metadata
90
+ });
91
+ // Add to graph
92
+ this.graph.addNode(node);
93
+ // Add dependency edges
94
+ if (config.dependencies && config.dependencies.length > 0) {
95
+ for (const depId of config.dependencies){
96
+ this.graph.addDependency(config.id, depId);
97
+ }
98
+ }
99
+ if (this.config.trackPerformance) {
100
+ const duration = performance.now() - startTime;
101
+ console.debug(`[DependencyManager] registerTask(${config.id}): ${duration.toFixed(2)}ms`);
102
+ }
103
+ }
104
+ /**
105
+ * Unregisters a task from the dependency graph.
106
+ *
107
+ * @param taskId - Task ID to unregister
108
+ * @returns True if task was removed, false if not found
109
+ */ unregisterTask(taskId) {
110
+ const removed = this.graph.removeNode(taskId);
111
+ if (removed) {
112
+ this.completedTasks.delete(taskId);
113
+ }
114
+ return removed;
115
+ }
116
+ /**
117
+ * Adds a dependency between two tasks.
118
+ *
119
+ * @param fromId - Task that depends on another
120
+ * @param toId - Task that is depended upon
121
+ * @throws {DependencyGraphError} If dependency would create cycle
122
+ */ addDependency(fromId, toId) {
123
+ this.graph.addDependency(fromId, toId);
124
+ }
125
+ /**
126
+ * Removes a dependency between two tasks.
127
+ *
128
+ * @param fromId - Dependent task ID
129
+ * @param toId - Dependency task ID
130
+ * @returns True if dependency was removed
131
+ */ removeDependency(fromId, toId) {
132
+ return this.graph.removeDependency(fromId, toId);
133
+ }
134
+ // ============================================
135
+ // Dependency Resolution
136
+ // ============================================
137
+ /**
138
+ * Resolves dependencies for a task and returns execution plan.
139
+ *
140
+ * Uses topological sorting to compute valid execution order.
141
+ * Returns ready tasks for immediate execution and execution levels
142
+ * for parallel processing.
143
+ *
144
+ * @param request - Resolution request
145
+ * @returns Resolution response with execution plan
146
+ */ resolveDependencies(request) {
147
+ const startTime = this.config.trackPerformance ? performance.now() : 0;
148
+ // Perform topological sort
149
+ const sortResult = this.sorter.sort();
150
+ if (!sortResult.success) {
151
+ // Cycle detected - cannot resolve
152
+ return {
153
+ success: false,
154
+ executionOrder: [],
155
+ readyTasks: [],
156
+ blockedTasks: [],
157
+ error: sortResult.error,
158
+ cycles: sortResult.cycles
159
+ };
160
+ }
161
+ // Get ready tasks (all dependencies satisfied)
162
+ const readyTasks = this.graph.getReadyTasks();
163
+ // Get blocked tasks (waiting on dependencies)
164
+ const blockedTasks = this.graph.getBlockedTasks();
165
+ // Compute execution levels (for parallel execution)
166
+ const levels = this.sorter.computeLevels();
167
+ // Apply concurrency limit if specified
168
+ let readyForExecution = readyTasks;
169
+ if (request.maxConcurrency && request.maxConcurrency > 0) {
170
+ readyForExecution = readyTasks.slice(0, request.maxConcurrency);
171
+ }
172
+ if (this.config.trackPerformance) {
173
+ const duration = performance.now() - startTime;
174
+ console.debug(`[DependencyManager] resolveDependencies(): ${duration.toFixed(2)}ms`);
175
+ }
176
+ return {
177
+ success: true,
178
+ executionOrder: sortResult.order,
179
+ readyTasks: readyForExecution,
180
+ blockedTasks,
181
+ levels
182
+ };
183
+ }
184
+ /**
185
+ * Gets the next batch of ready tasks for execution.
186
+ *
187
+ * This is useful for incremental execution without re-sorting entire graph.
188
+ *
189
+ * @param maxConcurrency - Maximum tasks to return
190
+ * @returns Array of ready tasks
191
+ */ getNextBatch(maxConcurrency = 1) {
192
+ const ready = this.sorter.getReadyNodes(this.completedTasks);
193
+ // Get node objects and apply concurrency limit
194
+ const readyNodes = ready.slice(0, maxConcurrency).map((id)=>this.graph.getNode(id)).filter((node)=>node !== undefined);
195
+ return readyNodes;
196
+ }
197
+ /**
198
+ * Resolves dependencies for a specific agent's tasks only.
199
+ *
200
+ * @param agentId - Agent ID to resolve for
201
+ * @returns Execution order for agent's tasks
202
+ */ resolveForAgent(agentId) {
203
+ // Get all tasks for this agent
204
+ const agentTasks = this.graph.getAllNodes().filter((node)=>node.agentId === agentId).map((node)=>node.id);
205
+ // Compute subset topological order
206
+ const order = this.sorter.sortSubset(new Set(agentTasks));
207
+ return order ?? [];
208
+ }
209
+ // ============================================
210
+ // Status Management
211
+ // ============================================
212
+ /**
213
+ * Updates the status of a task.
214
+ *
215
+ * @param update - Status update
216
+ */ updateTaskStatus(update) {
217
+ this.graph.updateStatus(update.taskId, update.status);
218
+ // Track completed tasks
219
+ if (update.status === DependencyNodeStatus.COMPLETED) {
220
+ this.completedTasks.add(update.taskId);
221
+ } else {
222
+ this.completedTasks.delete(update.taskId);
223
+ }
224
+ }
225
+ /**
226
+ * Marks a task as completed.
227
+ *
228
+ * @param taskId - Task ID to complete
229
+ */ completeTask(taskId) {
230
+ this.updateTaskStatus({
231
+ taskId,
232
+ status: DependencyNodeStatus.COMPLETED,
233
+ timestamp: Date.now()
234
+ });
235
+ }
236
+ /**
237
+ * Marks a task as failed.
238
+ *
239
+ * @param taskId - Task ID to mark as failed
240
+ */ failTask(taskId) {
241
+ this.updateTaskStatus({
242
+ taskId,
243
+ status: DependencyNodeStatus.FAILED,
244
+ timestamp: Date.now()
245
+ });
246
+ }
247
+ /**
248
+ * Gets all tasks that are blocked due to failed dependencies.
249
+ *
250
+ * @returns Array of task IDs that cannot proceed
251
+ */ getUnresolvableTasks() {
252
+ const failedNodes = new Set(this.graph.getAllNodes().filter((node)=>node.status === DependencyNodeStatus.FAILED).map((node)=>node.id));
253
+ const unresolvable = [];
254
+ for (const node of this.graph.getAllNodes()){
255
+ if (failedNodes.has(node.id)) continue;
256
+ const chain = this.graph.getDependencyChain(node.id);
257
+ for (const depId of chain){
258
+ if (failedNodes.has(depId)) {
259
+ unresolvable.push(node.id);
260
+ break;
261
+ }
262
+ }
263
+ }
264
+ return unresolvable;
265
+ }
266
+ // ============================================
267
+ // Graph Queries
268
+ // ============================================
269
+ /**
270
+ * Checks if graph contains cycles.
271
+ *
272
+ * @returns True if cycles exist
273
+ */ hasCycles() {
274
+ return !this.sorter.isDAG();
275
+ }
276
+ /**
277
+ * Gets detailed cycle information.
278
+ *
279
+ * @returns Cycle detection result
280
+ */ getCycles() {
281
+ return this.graph.detectCycles().cycles;
282
+ }
283
+ /**
284
+ * Gets execution levels (nodes at same depth can run in parallel).
285
+ *
286
+ * @returns Array of execution levels
287
+ */ getExecutionLevels() {
288
+ return this.sorter.computeLevels();
289
+ }
290
+ /**
291
+ * Gets maximum parallelization factor (max concurrent tasks).
292
+ *
293
+ * @returns Maximum number of tasks that can run concurrently
294
+ */ getMaxParallelism() {
295
+ const levels = this.sorter.computeLevels();
296
+ return Math.max(...levels.map((level)=>level.length), 0);
297
+ }
298
+ /**
299
+ * Gets graph statistics.
300
+ *
301
+ * @returns Graph metrics
302
+ */ getStatistics() {
303
+ const stats = this.graph.getStatistics();
304
+ return {
305
+ totalTasks: stats.nodeCount,
306
+ completedTasks: stats.completedNodeCount,
307
+ readyTasks: stats.readyNodeCount,
308
+ blockedTasks: stats.blockedNodeCount,
309
+ failedTasks: this.graph.getAllNodes().filter((n)=>n.status === DependencyNodeStatus.FAILED).length,
310
+ maxParallelism: this.getMaxParallelism(),
311
+ hasCycles: this.hasCycles()
312
+ };
313
+ }
314
+ /**
315
+ * Gets a specific task node.
316
+ *
317
+ * @param taskId - Task ID
318
+ * @returns Task node or undefined
319
+ */ getTask(taskId) {
320
+ return this.graph.getNode(taskId);
321
+ }
322
+ /**
323
+ * Gets all tasks.
324
+ *
325
+ * @returns Array of all task nodes
326
+ */ getAllTasks() {
327
+ return this.graph.getAllNodes();
328
+ }
329
+ /**
330
+ * Gets dependencies for a task.
331
+ *
332
+ * @param taskId - Task ID
333
+ * @returns Set of dependency task IDs
334
+ */ getDependencies(taskId) {
335
+ return this.graph.getDependencies(taskId);
336
+ }
337
+ /**
338
+ * Gets dependents for a task (tasks that depend on it).
339
+ *
340
+ * @param taskId - Task ID
341
+ * @returns Set of dependent task IDs
342
+ */ getDependents(taskId) {
343
+ return this.graph.getDependents(taskId);
344
+ }
345
+ /**
346
+ * Gets the full dependency chain for a task (transitive dependencies).
347
+ *
348
+ * @param taskId - Task ID
349
+ * @returns Array of task IDs in dependency order
350
+ */ getDependencyChain(taskId) {
351
+ return this.graph.getDependencyChain(taskId);
352
+ }
353
+ // ============================================
354
+ // Validation
355
+ // ============================================
356
+ /**
357
+ * Validates graph integrity.
358
+ *
359
+ * @returns Array of validation errors (empty if valid)
360
+ */ validate() {
361
+ const errors = this.graph.validate();
362
+ // Additional manager-level validations
363
+ if (this.hasCycles()) {
364
+ const cycles = this.getCycles();
365
+ errors.push(`Graph contains ${cycles.length} cycle(s): ${JSON.stringify(cycles)}`);
366
+ }
367
+ return errors;
368
+ }
369
+ /**
370
+ * Checks if graph is in valid state for execution.
371
+ *
372
+ * @returns True if graph can be executed
373
+ */ canExecute() {
374
+ const errors = this.validate();
375
+ return errors.length === 0;
376
+ }
377
+ // ============================================
378
+ // Utility Methods
379
+ // ============================================
380
+ /**
381
+ * Clears all tasks from the manager.
382
+ */ clear() {
383
+ this.graph.clear();
384
+ this.completedTasks.clear();
385
+ }
386
+ /**
387
+ * Gets the number of tasks in the graph.
388
+ *
389
+ * @returns Task count
390
+ */ size() {
391
+ return this.graph.size();
392
+ }
393
+ /**
394
+ * Exports graph to DOT format for visualization.
395
+ *
396
+ * @returns DOT format string
397
+ */ toDOT() {
398
+ let dot = 'digraph DependencyGraph {\n';
399
+ dot += ' rankdir=LR;\n';
400
+ dot += ' node [shape=box];\n\n';
401
+ // Add nodes with status colors
402
+ for (const node of this.graph.getAllNodes()){
403
+ const color = this.getNodeColor(node.status);
404
+ dot += ` "${node.id}" [label="${node.taskId}\\n(${node.agentId})" style=filled fillcolor="${color}"];\n`;
405
+ }
406
+ dot += '\n';
407
+ // Add edges
408
+ for (const node of this.graph.getAllNodes()){
409
+ const deps = this.graph.getDependencies(node.id);
410
+ for (const depId of deps){
411
+ dot += ` "${depId}" -> "${node.id}";\n`;
412
+ }
413
+ }
414
+ dot += '}\n';
415
+ return dot;
416
+ }
417
+ /**
418
+ * Gets color for node based on status.
419
+ *
420
+ * @param status - Node status
421
+ * @returns Color code
422
+ */ getNodeColor(status) {
423
+ switch(status){
424
+ case DependencyNodeStatus.COMPLETED:
425
+ return 'lightgreen';
426
+ case DependencyNodeStatus.EXECUTING:
427
+ return 'lightblue';
428
+ case DependencyNodeStatus.READY:
429
+ return 'lightyellow';
430
+ case DependencyNodeStatus.FAILED:
431
+ return 'lightcoral';
432
+ case DependencyNodeStatus.PENDING:
433
+ default:
434
+ return 'lightgray';
435
+ }
436
+ }
437
+ }
438
+
439
+ //# sourceMappingURL=dependency-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/coordination/v2/dependency/dependency-manager.ts"],"names":["DependencyGraph","DependencyNodeStatus","DependencyNodeImpl","TopologicalSort","DependencyManager","graph","sorter","config","completedTasks","maxGraphSize","autoValidate","trackPerformance","maxSize","Set","registerTask","startTime","performance","now","node","id","agentId","taskId","dependencies","priority","metadata","addNode","length","depId","addDependency","duration","console","debug","toFixed","unregisterTask","removed","removeNode","delete","fromId","toId","removeDependency","resolveDependencies","request","sortResult","sort","success","executionOrder","readyTasks","blockedTasks","error","cycles","getReadyTasks","getBlockedTasks","levels","computeLevels","readyForExecution","maxConcurrency","slice","order","getNextBatch","ready","getReadyNodes","readyNodes","map","getNode","filter","undefined","resolveForAgent","agentTasks","getAllNodes","sortSubset","updateTaskStatus","update","updateStatus","status","COMPLETED","add","completeTask","timestamp","Date","failTask","FAILED","getUnresolvableTasks","failedNodes","unresolvable","has","chain","getDependencyChain","push","hasCycles","isDAG","getCycles","detectCycles","getExecutionLevels","getMaxParallelism","Math","max","level","getStatistics","stats","totalTasks","nodeCount","completedNodeCount","readyNodeCount","blockedNodeCount","failedTasks","n","maxParallelism","getTask","getAllTasks","getDependencies","getDependents","validate","errors","JSON","stringify","canExecute","clear","size","toDOT","dot","color","getNodeColor","deps","EXECUTING","READY","PENDING"],"mappings":"AAAA;;;;;;;CAOC,GAED,SAASA,eAAe,QAAQ,8BAA8B;AAC9D,SAAyBC,oBAAoB,EAAEC,kBAAkB,QAAQ,6BAA6B;AACtG,SAASC,eAAe,QAA+B,wBAAwB;A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ErG,KAAKC,EAAE,CAAC,UAAU,EAAED,KAAKG,MAAM,CAAC,IAAI,EAAEH,KAAKE,OAAO,CAAC,2BAA2B,EAAEoG,MAAM,KAAK,CAAC;QAC3G;QAEAD,OAAO;QAEP,YAAY;QACZ,KAAK,MAAMrG,QAAQ,IAAI,CAACb,KAAK,CAAC+D,WAAW,GAAI;YAC3C,MAAMsD,OAAO,IAAI,CAACrH,KAAK,CAACwG,eAAe,CAAC3F,KAAKC,EAAE;YAC/C,KAAK,MAAMQ,SAAS+F,KAAM;gBACxBH,OAAO,CAAC,GAAG,EAAE5F,MAAM,MAAM,EAAET,KAAKC,EAAE,CAAC,IAAI,CAAC;YAC1C;QACF;QAEAoG,OAAO;QACP,OAAOA;IACT;IAEA;;;;;GAKC,GACD,AAAQE,aAAahD,MAA4B,EAAU;QACzD,OAAQA;YACN,KAAKxE,qBAAqByE,SAAS;gBACjC,OAAO;YACT,KAAKzE,qBAAqB0H,SAAS;gBACjC,OAAO;YACT,KAAK1H,qBAAqB2H,KAAK;gBAC7B,OAAO;YACT,KAAK3H,qBAAqB+E,MAAM;gBAC9B,OAAO;YACT,KAAK/E,qBAAqB4H,OAAO;YACjC;gBACE,OAAO;QACX;IACF;AACF"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Agent Coordination V2 - Dependency Request Types
3
+ *
4
+ * Type-safe structures for dependency requests and resolutions.
5
+ * Enables agents to declare dependencies and track resolution state.
6
+ *
7
+ * @module coordination/v2/dependency/dependency-request
8
+ */ /**
9
+ * Dependency request priority levels
10
+ */ export var DependencyPriority = /*#__PURE__*/ function(DependencyPriority) {
11
+ /** Low priority - can be deferred */ DependencyPriority[DependencyPriority["LOW"] = 1] = "LOW";
12
+ /** Normal priority - standard processing */ DependencyPriority[DependencyPriority["NORMAL"] = 5] = "NORMAL";
13
+ /** High priority - expedite processing */ DependencyPriority[DependencyPriority["HIGH"] = 8] = "HIGH";
14
+ /** Critical priority - blocking agent progress */ DependencyPriority[DependencyPriority["CRITICAL"] = 10] = "CRITICAL";
15
+ return DependencyPriority;
16
+ }({});
17
+ /**
18
+ * Dependency request status
19
+ */ export var DependencyStatus = /*#__PURE__*/ function(DependencyStatus) {
20
+ /** Request created, awaiting processing */ DependencyStatus["PENDING"] = "pending";
21
+ /** Dependency being resolved */ DependencyStatus["RESOLVING"] = "resolving";
22
+ /** Dependency successfully resolved */ DependencyStatus["RESOLVED"] = "resolved";
23
+ /** Dependency resolution failed */ DependencyStatus["FAILED"] = "failed";
24
+ /** Request cancelled by requestor */ DependencyStatus["CANCELLED"] = "cancelled";
25
+ return DependencyStatus;
26
+ }({});
27
+ /**
28
+ * Type guard to check if request is pending
29
+ */ export function isPendingRequest(request) {
30
+ return request.status === "pending";
31
+ }
32
+ /**
33
+ * Type guard to check if request is resolved
34
+ */ export function isResolvedRequest(request) {
35
+ return request.status === "resolved" && request.resolution !== undefined;
36
+ }
37
+ /**
38
+ * Type guard to check if request is failed
39
+ */ export function isFailedRequest(request) {
40
+ return request.status === "failed";
41
+ }
42
+ /**
43
+ * Type guard to check if request is active (pending or resolving)
44
+ */ export function isActiveRequest(request) {
45
+ return request.status === "pending" || request.status === "resolving";
46
+ }
47
+ /**
48
+ * Create a new dependency request
49
+ */ export function createDependencyRequest(requestorId, sessionId, dependencyType, metadata, options) {
50
+ return {
51
+ requestId: `dep_${Date.now()}_${Math.random().toString(36).substring(7)}`,
52
+ requestorId,
53
+ sessionId,
54
+ targetAgentId: options?.targetAgentId,
55
+ dependencyType,
56
+ priority: options?.priority ?? 5,
57
+ status: "pending",
58
+ metadata,
59
+ createdAt: new Date()
60
+ };
61
+ }
62
+ /**
63
+ * Create a dependency resolution
64
+ */ export function createDependencyResolution(resolverId, data, latencyMs) {
65
+ return {
66
+ resolutionId: `res_${Date.now()}_${Math.random().toString(36).substring(7)}`,
67
+ resolverId,
68
+ resolvedAt: new Date(),
69
+ data,
70
+ latencyMs
71
+ };
72
+ }
73
+ /**
74
+ * Update request status
75
+ */ export function updateRequestStatus(request, status, resolution, error) {
76
+ const updated = {
77
+ ...request,
78
+ status
79
+ };
80
+ if (resolution) {
81
+ updated.resolution = resolution;
82
+ }
83
+ if (error) {
84
+ updated.error = {
85
+ ...error,
86
+ timestamp: new Date()
87
+ };
88
+ }
89
+ return updated;
90
+ }
91
+
92
+ //# sourceMappingURL=dependency-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/coordination/v2/dependency/dependency-request.ts"],"names":["DependencyPriority","DependencyStatus","isPendingRequest","request","status","isResolvedRequest","resolution","undefined","isFailedRequest","isActiveRequest","createDependencyRequest","requestorId","sessionId","dependencyType","metadata","options","requestId","Date","now","Math","random","toString","substring","targetAgentId","priority","createdAt","createDependencyResolution","resolverId","data","latencyMs","resolutionId","resolvedAt","updateRequestStatus","error","updated","timestamp"],"mappings":"AAAA;;;;;;;CAOC,GAID;;CAEC,GACD,OAAO,IAAA,AAAKA,4CAAAA;IACV,mCAAmC;IAGnC,0CAA0C;IAG1C,wCAAwC;IAGxC,gDAAgD;WAVtCA;MAYX;AAED;;CAEC,GACD,OAAO,IAAA,AAAKC,0CAAAA;IACV,yCAAyC;IAGzC,8BAA8B;IAG9B,qCAAqC;IAGrC,iCAAiC;IAGjC,mCAAmC;WAbzBA;MAeX;AAuFD;;CAEC,GACD,OAAO,SAASC,iBAAiBC,OAA0B;IACzD,OAAOA,QAAQC,MAAM;AACvB;AAEA;;CAEC,GACD,OAAO,SAASC,kBAAkBF,OAA0B;IAC1D,OAAOA,QAAQC,MAAM,mBAAkCD,QAAQG,UAAU,KAAKC;AAChF;AAEA;;CAEC,GACD,OAAO,SAASC,gBAAgBL,OAA0B;IACxD,OAAOA,QAAQC,MAAM;AACvB;AAEA;;CAEC,GACD,OAAO,SAASK,gBAAgBN,OAA0B;IACxD,OAAOA,QAAQC,MAAM,kBAAiCD,QAAQC,MAAM;AACtE;AAEA;;CAEC,GACD,OAAO,SAASM,wBACdC,WAAmB,EACnBC,SAAiB,EACjBC,cAAsB,EACtBC,QAA4B,EAC5BC,OAGC;IAED,OAAO;QACLC,WAAW,CAAC,IAAI,EAAEC,KAAKC,GAAG,GAAG,CAAC,EAAEC,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC,IAAI;QACzEX;QACAC;QACAW,eAAeR,SAASQ;QACxBV;QACAW,UAAUT,SAASS;QACnBpB,MAAM;QACNU;QACAW,WAAW,IAAIR;IACjB;AACF;AAEA;;CAEC,GACD,OAAO,SAASS,2BACdC,UAAkB,EAClBC,IAAyB,EACzBC,SAAiB;IAEjB,OAAO;QACLC,cAAc,CAAC,IAAI,EAAEb,KAAKC,GAAG,GAAG,CAAC,EAAEC,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC,IAAI;QAC5EK;QACAI,YAAY,IAAId;QAChBW;QACAC;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAASG,oBACd7B,OAA0B,EAC1BC,MAAwB,EACxBE,UAAiC,EACjC2B,KAAyC;IAEzC,MAAMC,UAAU;QAAE,GAAG/B,OAAO;QAAEC;IAAO;IAErC,IAAIE,YAAY;QACd4B,QAAQ5B,UAAU,GAAGA;IACvB;IAEA,IAAI2B,OAAO;QACTC,QAAQD,KAAK,GAAG;YACd,GAAGA,KAAK;YACRE,WAAW,IAAIlB;QACjB;IACF;IAEA,OAAOiB;AACT"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Agent Coordination V2 - Dependency Module Exports
3
+ *
4
+ * Unified exports for dependency management system.
5
+ * Provides DAG data structures, cycle detection, and request/resolution types.
6
+ *
7
+ * @module coordination/v2/dependency
8
+ */ // Dependency request types
9
+ export { DependencyPriority, DependencyStatus, isPendingRequest, isResolvedRequest, isFailedRequest, isActiveRequest, createDependencyRequest, createDependencyResolution, updateRequestStatus } from './dependency-request.js';
10
+ // Dependency graph (DAG)
11
+ export { DependencyGraph } from './dependency-graph.js';
12
+ // Cycle detection
13
+ export { CycleDetector, detectCycle, wouldCreateCycle } from './cycle-detector.js';
14
+ // Artifact storage backend
15
+ export { DependencyArtifactStorage } from './artifact-storage.js';
16
+ // Topological sort (Kahn's algorithm)
17
+ export { TopologicalSort } from './topological-sort.js';
18
+ // Dependency manager (coordination)
19
+ export { DependencyManager } from './dependency-manager.js';
20
+
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/coordination/v2/dependency/index.ts"],"names":["DependencyPriority","DependencyStatus","isPendingRequest","isResolvedRequest","isFailedRequest","isActiveRequest","createDependencyRequest","createDependencyResolution","updateRequestStatus","DependencyGraph","CycleDetector","detectCycle","wouldCreateCycle","DependencyArtifactStorage","TopologicalSort","DependencyManager"],"mappings":"AAAA;;;;;;;CAOC,GAED,2BAA2B;AAC3B,SACEA,kBAAkB,EAClBC,gBAAgB,EAIhBC,gBAAgB,EAChBC,iBAAiB,EACjBC,eAAe,EACfC,eAAe,EACfC,uBAAuB,EACvBC,0BAA0B,EAC1BC,mBAAmB,QACd,0BAA0B;AAEjC,yBAAyB;AACzB,SAKEC,eAAe,QACV,wBAAwB;AAE/B,kBAAkB;AAClB,SAGEC,aAAa,EACbC,WAAW,EACXC,gBAAgB,QACX,sBAAsB;AAE7B,2BAA2B;AAC3B,SACEC,yBAAyB,QACpB,wBAAwB;AAE/B,sCAAsC;AACtC,SACEC,eAAe,QAEV,wBAAwB;AAE/B,oCAAoC;AACpC,SACEC,iBAAiB,QAKZ,0BAA0B"}