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,450 @@
1
+ /**
2
+ * Agent Coordination V2 - Hierarchical Background Integration
3
+ *
4
+ * Sprint 5.2 Integration Layer
5
+ * Connects HierarchicalCoordinator with BackgroundOrchestrator for
6
+ * multi-level bash process spawning with 500ms failure detection.
7
+ *
8
+ * Key Features:
9
+ * - Multi-level spawning (Level 1-N) via BackgroundOrchestrator
10
+ * - Child process monitoring via BashOutputMonitor
11
+ * - 500ms failure detection latency
12
+ * - Cascade termination support
13
+ * - Clean process lifecycle management
14
+ *
15
+ * @module coordination/v2/sdk/hierarchical-background-integration
16
+ */ import { EventEmitter } from 'events';
17
+ import { BackgroundOrchestrator } from './background-orchestrator.js';
18
+ import { BashOutputMonitor } from './bash-output-monitor.js';
19
+ import { Logger } from '../../../core/logger.js';
20
+ /**
21
+ * Integration layer connecting HierarchicalCoordinator to BackgroundOrchestrator
22
+ *
23
+ * Manages background bash process spawning for hierarchical agent coordination.
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * const integration = new HierarchicalBackgroundIntegration(hierarchicalCoordinator, {
28
+ * maxLevels: 10,
29
+ * failureDetectionTimeout: 500
30
+ * });
31
+ *
32
+ * await integration.initialize();
33
+ *
34
+ * // Spawn child agent at Level 3
35
+ * const childProcess = await integration.spawnChildAgent(parentAgent, childConfig, 3);
36
+ *
37
+ * // Monitor all child processes
38
+ * await integration.monitorChildren(parentAgentId);
39
+ * ```
40
+ */ export class HierarchicalBackgroundIntegration extends EventEmitter {
41
+ logger;
42
+ config;
43
+ coordinator;
44
+ backgroundOrchestrator;
45
+ bashOutputMonitor;
46
+ agentToProcessMap = new Map();
47
+ processToAgentMap = new Map();
48
+ failureDetectionTimers = new Map();
49
+ isInitialized = false;
50
+ constructor(coordinator, config){
51
+ super();
52
+ this.coordinator = coordinator;
53
+ this.logger = new Logger({
54
+ level: 'info',
55
+ format: 'json',
56
+ destination: 'console'
57
+ }, {
58
+ component: 'HierarchicalBackgroundIntegration'
59
+ });
60
+ this.config = {
61
+ maxLevels: 10,
62
+ maxProcessesPerLevel: 20,
63
+ monitoringInterval: 500,
64
+ failureDetectionTimeout: 500,
65
+ autoCleanup: true,
66
+ cleanupRetentionMs: 60000,
67
+ ...config
68
+ };
69
+ this.backgroundOrchestrator = new BackgroundOrchestrator({
70
+ maxLevels: this.config.maxLevels,
71
+ maxProcessesPerLevel: this.config.maxProcessesPerLevel,
72
+ monitoringInterval: this.config.monitoringInterval,
73
+ autoCleanup: this.config.autoCleanup,
74
+ cleanupRetentionMs: this.config.cleanupRetentionMs
75
+ });
76
+ this.bashOutputMonitor = new BashOutputMonitor();
77
+ }
78
+ /**
79
+ * Initialize integration layer
80
+ */ async initialize() {
81
+ if (this.isInitialized) {
82
+ this.logger.warn('Integration already initialized');
83
+ return;
84
+ }
85
+ this.logger.info('Initializing hierarchical background integration...');
86
+ // Setup event listeners
87
+ this.setupEventHandlers();
88
+ this.isInitialized = true;
89
+ this.logger.info('Hierarchical background integration initialized');
90
+ this.emit('integration:initialized');
91
+ }
92
+ /**
93
+ * Spawn child agent as background bash process
94
+ *
95
+ * @param parentAgent - Parent hierarchical agent
96
+ * @param childConfig - Child agent configuration
97
+ * @param level - Spawning level (1-N)
98
+ * @returns Promise resolving to spawned BackgroundProcess
99
+ */ async spawnChildAgent(parentAgent, childConfig, level) {
100
+ if (!this.isInitialized) {
101
+ throw new Error('Integration not initialized. Call initialize() first.');
102
+ }
103
+ this.logger.info(`Spawning child agent at level ${level}`, {
104
+ parentId: parentAgent.id,
105
+ childId: childConfig.agentId,
106
+ level
107
+ });
108
+ // Create agent definition for BackgroundOrchestrator
109
+ const agent = {
110
+ agentId: childConfig.agentId,
111
+ type: childConfig.type,
112
+ priority: childConfig.priority || 5,
113
+ sessionId: childConfig.sessionId,
114
+ capabilities: childConfig.capabilities,
115
+ metadata: {
116
+ ...childConfig.metadata,
117
+ parentAgentId: parentAgent.id,
118
+ parentLevel: parentAgent.level,
119
+ coordinatorIntegration: true
120
+ }
121
+ };
122
+ // Get parent process ID if exists
123
+ const parentProcess = this.agentToProcessMap.get(parentAgent.id);
124
+ const parentProcessId = parentProcess?.id;
125
+ // Spawn background process via BackgroundOrchestrator
126
+ const childProcess = await this.backgroundOrchestrator.spawnBackground(agent, level, parentProcessId);
127
+ // Register mappings
128
+ this.agentToProcessMap.set(childConfig.agentId, childProcess);
129
+ this.processToAgentMap.set(childProcess.id, childConfig.agentId);
130
+ // Start bash output monitoring
131
+ this.bashOutputMonitor.startMonitoring(childProcess);
132
+ // Start failure detection with 500ms timeout
133
+ this.startFailureDetection(childProcess);
134
+ this.logger.info(`Child agent spawned at level ${level}`, {
135
+ processId: childProcess.id,
136
+ agentId: childConfig.agentId,
137
+ parentId: parentAgent.id
138
+ });
139
+ this.emit('child:spawned', {
140
+ processId: childProcess.id,
141
+ agentId: childConfig.agentId,
142
+ level,
143
+ parentId: parentAgent.id
144
+ });
145
+ return childProcess;
146
+ }
147
+ /**
148
+ * Monitor all child processes for a given parent agent
149
+ *
150
+ * @param parentAgentId - Parent agent ID to monitor children for
151
+ * @returns Array of monitored child processes
152
+ */ async monitorChildren(parentAgentId) {
153
+ const parentProcess = this.agentToProcessMap.get(parentAgentId);
154
+ if (!parentProcess) {
155
+ this.logger.warn('Parent agent has no associated process', {
156
+ parentAgentId
157
+ });
158
+ return [];
159
+ }
160
+ const children = this.backgroundOrchestrator.getChildProcesses(parentProcess.id);
161
+ this.logger.debug(`Monitoring ${children.length} children for parent ${parentAgentId}`);
162
+ // Ensure all children are being monitored
163
+ for (const child of children){
164
+ if (!this.bashOutputMonitor.getOutputs(child.id).length) {
165
+ this.bashOutputMonitor.startMonitoring(child);
166
+ }
167
+ // Ensure failure detection is active
168
+ if (!this.failureDetectionTimers.has(child.id)) {
169
+ this.startFailureDetection(child);
170
+ }
171
+ }
172
+ return children;
173
+ }
174
+ /**
175
+ * Get all processes at specific nesting level
176
+ *
177
+ * @param level - Nesting level to query
178
+ * @returns Array of BackgroundProcess at specified level
179
+ */ getProcessesAtLevel(level) {
180
+ return this.backgroundOrchestrator.getProcessesAtLevel(level);
181
+ }
182
+ /**
183
+ * Get child processes for a specific agent
184
+ *
185
+ * @param agentId - Agent ID to get children for
186
+ * @returns Array of child BackgroundProcess instances
187
+ */ getChildrenForAgent(agentId) {
188
+ const process = this.agentToProcessMap.get(agentId);
189
+ if (!process) {
190
+ return [];
191
+ }
192
+ return this.backgroundOrchestrator.getChildProcesses(process.id);
193
+ }
194
+ /**
195
+ * Pause background process for agent
196
+ *
197
+ * @param agentId - Agent to pause
198
+ */ async pauseAgent(agentId) {
199
+ const process = this.agentToProcessMap.get(agentId);
200
+ if (!process) {
201
+ throw new Error(`No background process for agent ${agentId}`);
202
+ }
203
+ await this.backgroundOrchestrator.pauseProcess(process.id);
204
+ this.logger.info('Agent background process paused', {
205
+ agentId,
206
+ processId: process.id
207
+ });
208
+ this.emit('agent:paused', {
209
+ agentId,
210
+ processId: process.id
211
+ });
212
+ }
213
+ /**
214
+ * Resume background process for agent
215
+ *
216
+ * @param agentId - Agent to resume
217
+ */ async resumeAgent(agentId) {
218
+ const process = this.agentToProcessMap.get(agentId);
219
+ if (!process) {
220
+ throw new Error(`No background process for agent ${agentId}`);
221
+ }
222
+ await this.backgroundOrchestrator.resumeProcess(process.id);
223
+ this.logger.info('Agent background process resumed', {
224
+ agentId,
225
+ processId: process.id
226
+ });
227
+ this.emit('agent:resumed', {
228
+ agentId,
229
+ processId: process.id
230
+ });
231
+ }
232
+ /**
233
+ * Terminate agent and all children (cascade)
234
+ *
235
+ * @param agentId - Agent to terminate
236
+ */ async terminateAgent(agentId) {
237
+ const process = this.agentToProcessMap.get(agentId);
238
+ if (!process) {
239
+ this.logger.warn('No background process found for agent', {
240
+ agentId
241
+ });
242
+ return;
243
+ }
244
+ // Clear failure detection timer
245
+ this.clearFailureDetection(process.id);
246
+ // Terminate process (cascade to children)
247
+ await this.backgroundOrchestrator.terminateProcess(process.id);
248
+ // Stop monitoring
249
+ this.bashOutputMonitor.stopMonitoring(process.id);
250
+ // Clean up mappings
251
+ this.agentToProcessMap.delete(agentId);
252
+ this.processToAgentMap.delete(process.id);
253
+ this.logger.info('Agent background process terminated', {
254
+ agentId,
255
+ processId: process.id
256
+ });
257
+ this.emit('agent:terminated', {
258
+ agentId,
259
+ processId: process.id
260
+ });
261
+ }
262
+ /**
263
+ * Terminate all processes at level and deeper (cascade)
264
+ *
265
+ * @param level - Starting level for termination
266
+ */ async terminateLevel(level) {
267
+ this.logger.info(`Terminating all processes at level ${level} and deeper`);
268
+ const processes = this.backgroundOrchestrator.getProcessesAtLevel(level);
269
+ for (const process of processes){
270
+ const agentId = this.processToAgentMap.get(process.id);
271
+ if (agentId) {
272
+ await this.terminateAgent(agentId);
273
+ }
274
+ }
275
+ await this.backgroundOrchestrator.terminateLevel(level);
276
+ this.logger.info(`Terminated all processes at level ${level}+`);
277
+ this.emit('level:terminated', {
278
+ level
279
+ });
280
+ }
281
+ /**
282
+ * Get background process for agent
283
+ *
284
+ * @param agentId - Agent ID
285
+ * @returns BackgroundProcess or undefined
286
+ */ getProcessForAgent(agentId) {
287
+ return this.agentToProcessMap.get(agentId);
288
+ }
289
+ /**
290
+ * Get agent ID for background process
291
+ *
292
+ * @param processId - Process ID
293
+ * @returns Agent ID or undefined
294
+ */ getAgentForProcess(processId) {
295
+ return this.processToAgentMap.get(processId);
296
+ }
297
+ /**
298
+ * Get bash output for agent process
299
+ *
300
+ * @param agentId - Agent ID
301
+ * @returns Combined stdout or empty string
302
+ */ getAgentOutput(agentId) {
303
+ const process = this.agentToProcessMap.get(agentId);
304
+ if (!process) {
305
+ return '';
306
+ }
307
+ return this.bashOutputMonitor.getCombinedStdout(process.id);
308
+ }
309
+ /**
310
+ * Get bash stderr for agent process
311
+ *
312
+ * @param agentId - Agent ID
313
+ * @returns Combined stderr or empty string
314
+ */ getAgentErrors(agentId) {
315
+ const process = this.agentToProcessMap.get(agentId);
316
+ if (!process) {
317
+ return '';
318
+ }
319
+ return this.bashOutputMonitor.getCombinedStderr(process.id);
320
+ }
321
+ /**
322
+ * Get integration statistics
323
+ */ getStats() {
324
+ const bgStats = this.backgroundOrchestrator.getStats();
325
+ const monitorStats = this.bashOutputMonitor.getStats();
326
+ return {
327
+ backgroundOrchestrator: bgStats,
328
+ bashOutputMonitor: monitorStats,
329
+ agentMappings: this.agentToProcessMap.size,
330
+ activeFailureDetection: this.failureDetectionTimers.size
331
+ };
332
+ }
333
+ /**
334
+ * Cleanup and shutdown integration
335
+ */ async cleanup() {
336
+ this.logger.info('Cleaning up hierarchical background integration...');
337
+ // Clear all failure detection timers
338
+ for (const [processId, timer] of Array.from(this.failureDetectionTimers.entries())){
339
+ clearTimeout(timer);
340
+ }
341
+ this.failureDetectionTimers.clear();
342
+ // Cleanup background orchestrator
343
+ await this.backgroundOrchestrator.cleanup();
344
+ // Cleanup bash output monitor
345
+ this.bashOutputMonitor.cleanup();
346
+ // Clear mappings
347
+ this.agentToProcessMap.clear();
348
+ this.processToAgentMap.clear();
349
+ this.isInitialized = false;
350
+ this.logger.info('Hierarchical background integration cleanup complete');
351
+ this.emit('integration:cleanup');
352
+ }
353
+ /**
354
+ * Start failure detection for background process
355
+ * Detects failures within 500ms
356
+ */ startFailureDetection(process) {
357
+ const timer = setTimeout(()=>{
358
+ // Check if process is still running
359
+ if (process.status === 'running') {
360
+ const latestOutput = this.bashOutputMonitor.getLatestOutput(process.id);
361
+ const stderr = this.bashOutputMonitor.getCombinedStderr(process.id);
362
+ // Check for error indicators
363
+ if (stderr && stderr.length > 0) {
364
+ this.handleProcessFailure(process.id, new Error(`Process stderr: ${stderr.substring(0, 200)}`));
365
+ }
366
+ }
367
+ // Re-schedule failure detection
368
+ this.failureDetectionTimers.delete(process.id);
369
+ if (process.status === 'running') {
370
+ this.startFailureDetection(process);
371
+ }
372
+ }, this.config.failureDetectionTimeout);
373
+ this.failureDetectionTimers.set(process.id, timer);
374
+ }
375
+ /**
376
+ * Clear failure detection timer
377
+ */ clearFailureDetection(processId) {
378
+ const timer = this.failureDetectionTimers.get(processId);
379
+ if (timer) {
380
+ clearTimeout(timer);
381
+ this.failureDetectionTimers.delete(processId);
382
+ }
383
+ }
384
+ /**
385
+ * Handle process failure
386
+ */ async handleProcessFailure(processId, error) {
387
+ const agentId = this.processToAgentMap.get(processId);
388
+ this.logger.error('Background process failed', {
389
+ processId,
390
+ agentId,
391
+ error: error.message
392
+ });
393
+ // Mark process as failed in orchestrator
394
+ await this.backgroundOrchestrator.failProcess(processId, error);
395
+ // Clear failure detection
396
+ this.clearFailureDetection(processId);
397
+ this.emit('process:failed', {
398
+ processId,
399
+ agentId,
400
+ error: error.message
401
+ });
402
+ }
403
+ /**
404
+ * Setup event handlers for integration
405
+ */ setupEventHandlers() {
406
+ // BackgroundOrchestrator events
407
+ this.backgroundOrchestrator.on('process:spawned', (process)=>{
408
+ this.logger.debug('Background process spawned', {
409
+ processId: process.id
410
+ });
411
+ });
412
+ this.backgroundOrchestrator.on('process:terminated', (process)=>{
413
+ this.logger.debug('Background process terminated', {
414
+ processId: process.id
415
+ });
416
+ this.clearFailureDetection(process.id);
417
+ });
418
+ this.backgroundOrchestrator.on('process:failed', (process, error)=>{
419
+ this.logger.error('Background process failed event', {
420
+ processId: process.id,
421
+ error: error.message
422
+ });
423
+ this.clearFailureDetection(process.id);
424
+ });
425
+ // BashOutputMonitor events
426
+ this.bashOutputMonitor.on('process:error', ({ processId, stderr })=>{
427
+ this.logger.warn('Process stderr output detected', {
428
+ processId,
429
+ stderr: stderr.substring(0, 200)
430
+ });
431
+ });
432
+ this.bashOutputMonitor.on('monitoring:completed', ({ processId, exitCode })=>{
433
+ this.logger.debug('Process monitoring completed', {
434
+ processId,
435
+ exitCode
436
+ });
437
+ if (exitCode !== 0) {
438
+ const error = new Error(`Process exited with code ${exitCode}`);
439
+ this.handleProcessFailure(processId, error);
440
+ }
441
+ });
442
+ }
443
+ }
444
+ /**
445
+ * Factory function to create integration layer
446
+ */ export function createHierarchicalBackgroundIntegration(coordinator, config) {
447
+ return new HierarchicalBackgroundIntegration(coordinator, config);
448
+ }
449
+
450
+ //# sourceMappingURL=hierarchical-background-integration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/coordination/v2/sdk/hierarchical-background-integration.ts"],"names":["EventEmitter","BackgroundOrchestrator","BashOutputMonitor","Logger","HierarchicalBackgroundIntegration","logger","config","coordinator","backgroundOrchestrator","bashOutputMonitor","agentToProcessMap","Map","processToAgentMap","failureDetectionTimers","isInitialized","level","format","destination","component","maxLevels","maxProcessesPerLevel","monitoringInterval","failureDetectionTimeout","autoCleanup","cleanupRetentionMs","initialize","warn","info","setupEventHandlers","emit","spawnChildAgent","parentAgent","childConfig","Error","parentId","id","childId","agentId","agent","type","priority","sessionId","capabilities","metadata","parentAgentId","parentLevel","coordinatorIntegration","parentProcess","get","parentProcessId","childProcess","spawnBackground","set","startMonitoring","startFailureDetection","processId","monitorChildren","children","getChildProcesses","debug","length","child","getOutputs","has","getProcessesAtLevel","getChildrenForAgent","process","pauseAgent","pauseProcess","resumeAgent","resumeProcess","terminateAgent","clearFailureDetection","terminateProcess","stopMonitoring","delete","terminateLevel","processes","getProcessForAgent","getAgentForProcess","getAgentOutput","getCombinedStdout","getAgentErrors","getCombinedStderr","getStats","bgStats","monitorStats","agentMappings","size","activeFailureDetection","cleanup","timer","Array","from","entries","clearTimeout","clear","setTimeout","status","latestOutput","getLatestOutput","stderr","handleProcessFailure","substring","error","message","failProcess","on","exitCode","createHierarchicalBackgroundIntegration"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,YAAY,QAAQ,SAAS;AAEtC,SAASC,sBAAsB,QAAQ,+BAA+B;AACtE,SAASC,iBAAiB,QAAQ,2BAA2B;AAE7D,SAASC,MAAM,QAAQ,0BAA0B;AAyBjD;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,MAAMC,0CAA0CJ;IAC7CK,OAAe;IACfC,OAAqC;IACrCC,YAAqC;IACrCC,uBAA+C;IAC/CC,kBAAqC;IACrCC,oBAAoD,IAAIC,MAAM;IAC9DC,oBAAyC,IAAID,MAAM;IACnDE,yBAAsD,IAAIF,MAAM;IAChEG,gBAAyB,MAAM;IAEvC,YACEP,WAAoC,EACpCD,MAA8C,CAC9C;QACA,KAAK;QAEL,IAAI,CAACC,WAAW,GAAGA;QACnB,IAAI,CAACF,MAAM,GAAG,IAAIF,OAChB;YAAEY,OAAO;YAAQC,QAAQ;YAAQC,aAAa;QAAU,GACxD;YAAEC,WAAW;QAAoC;QAGnD,IAAI,CAACZ,MAAM,GAAG;YACZa,WAAW;YACXC,sBAAsB;YACtBC,oBAAoB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vC;QACF;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAASK,wCACdtG,WAAoC,EACpCD,MAA8C;IAE9C,OAAO,IAAIF,kCAAkCG,aAAaD;AAC5D"}
@@ -2,7 +2,12 @@
2
2
  * Agent Coordination V2 - SDK Module Exports
3
3
  */ export { CheckpointManager, CheckpointData, CheckpointMetrics, RestoreResult } from './checkpoint-manager.js';
4
4
  export { QueryController, QueryControllerConfig } from './query-controller.js';
5
+ export { HelpCoordinator, HelpCoordinatorConfig, HelpCoordinatorMetrics, HelperAgent, HelpRequest, HelpAssignment } from './help-coordinator.js';
5
6
  export { FilesystemArtifactStorage } from './artifact-storage.js';
6
7
  export { StateSDKIntegration, StateSDKIntegrationConfig, StateSDKMetrics, StateChangeEventData } from './state-sdk-integration.js';
8
+ export { BackgroundOrchestrator, BackgroundOrchestratorConfig, ProcessStats } from './background-orchestrator.js';
9
+ export { BashOutputMonitor, ProcessOutput } from './bash-output-monitor.js';
10
+ export { HierarchicalBackgroundIntegration, HierarchicalBackgroundConfig, createHierarchicalBackgroundIntegration } from './hierarchical-background-integration.js';
11
+ export { SessionPoolOptimizer, SessionPoolConfig, PooledSession, PoolMetrics, SessionRequest } from './session-pool-optimizer.js';
7
12
 
8
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/coordination/v2/sdk/index.ts"],"names":["CheckpointManager","CheckpointData","CheckpointMetrics","RestoreResult","QueryController","QueryControllerConfig","FilesystemArtifactStorage","StateSDKIntegration","StateSDKIntegrationConfig","StateSDKMetrics","StateChangeEventData"],"mappings":"AAAA;;CAEC,GAED,SACEA,iBAAiB,EACjBC,cAAc,EACdC,iBAAiB,EACjBC,aAAa,QACR,0BAA0B;AAEjC,SACEC,eAAe,EACfC,qBAAqB,QAChB,wBAAwB;AAE/B,SAASC,yBAAyB,QAAQ,wBAAwB;AAElE,SACEC,mBAAmB,EACnBC,yBAAyB,EACzBC,eAAe,EACfC,oBAAoB,QACf,6BAA6B"}
1
+ {"version":3,"sources":["../../../../../../src/coordination/v2/sdk/index.ts"],"names":["CheckpointManager","CheckpointData","CheckpointMetrics","RestoreResult","QueryController","QueryControllerConfig","HelpCoordinator","HelpCoordinatorConfig","HelpCoordinatorMetrics","HelperAgent","HelpRequest","HelpAssignment","FilesystemArtifactStorage","StateSDKIntegration","StateSDKIntegrationConfig","StateSDKMetrics","StateChangeEventData","BackgroundOrchestrator","BackgroundOrchestratorConfig","ProcessStats","BashOutputMonitor","ProcessOutput","HierarchicalBackgroundIntegration","HierarchicalBackgroundConfig","createHierarchicalBackgroundIntegration","SessionPoolOptimizer","SessionPoolConfig","PooledSession","PoolMetrics","SessionRequest"],"mappings":"AAAA;;CAEC,GAED,SACEA,iBAAiB,EACjBC,cAAc,EACdC,iBAAiB,EACjBC,aAAa,QACR,0BAA0B;AAEjC,SACEC,eAAe,EACfC,qBAAqB,QAChB,wBAAwB;AAE/B,SACEC,eAAe,EACfC,qBAAqB,EACrBC,sBAAsB,EACtBC,WAAW,EACXC,WAAW,EACXC,cAAc,QACT,wBAAwB;AAE/B,SAASC,yBAAyB,QAAQ,wBAAwB;AAElE,SACEC,mBAAmB,EACnBC,yBAAyB,EACzBC,eAAe,EACfC,oBAAoB,QACf,6BAA6B;AAEpC,SACEC,sBAAsB,EACtBC,4BAA4B,EAC5BC,YAAY,QACP,+BAA+B;AAEtC,SACEC,iBAAiB,EACjBC,aAAa,QACR,2BAA2B;AAElC,SACEC,iCAAiC,EACjCC,4BAA4B,EAC5BC,uCAAuC,QAClC,2CAA2C;AAElD,SACEC,oBAAoB,EACpBC,iBAAiB,EACjBC,aAAa,EACbC,WAAW,EACXC,cAAc,QACT,8BAA8B"}