claude-flow-novice 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/.claude/agents/cfn-loop/product-owner.md +54 -4
  2. package/.claude/commands/cfn-claude-sync.md +303 -0
  3. package/.claude/commands/cfn-loop-epic.md +290 -0
  4. package/.claude/commands/cfn-loop-single.md +168 -0
  5. package/.claude/commands/cfn-loop-sprints.md +384 -0
  6. package/.claude/commands/cfn-loop.md +180 -0
  7. package/.claude/commands/metrics-summary.md +58 -0
  8. package/.claude/commands/parse-epic.md +357 -0
  9. package/.claude/settings.json +4 -4
  10. package/.claude/settings.local.json +9 -2
  11. package/.claude-flow-novice/.claude/agents/cfn-loop/product-owner.md +792 -0
  12. package/.claude-flow-novice/dist/mcp/server.js +21 -2
  13. package/.claude-flow-novice/dist/src/api/claude-client.js +138 -3
  14. package/.claude-flow-novice/dist/src/api/claude-client.js.map +1 -1
  15. package/.claude-flow-novice/dist/src/cfn-loop/phase-orchestrator-example.js +1 -1
  16. package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js +247 -0
  17. package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js.map +1 -0
  18. package/.claude-flow-novice/dist/src/cli/commands/swarm.js +32 -15
  19. package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
  20. package/.claude-flow-novice/dist/src/cli/commands/transparency.js +455 -0
  21. package/.claude-flow-novice/dist/src/cli/commands/transparency.js.map +1 -0
  22. package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/CLAUDE.md +129 -13
  23. package/.claude-flow-novice/dist/src/components/visualizations/index.js +9 -0
  24. package/.claude-flow-novice/dist/src/components/visualizations/index.js.map +1 -0
  25. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +462 -0
  26. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -0
  27. package/.claude-flow-novice/dist/src/coordination/config-translator.js +248 -0
  28. package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -0
  29. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +287 -0
  30. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -0
  31. package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js +68 -9
  32. package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js.map +1 -1
  33. package/.claude-flow-novice/dist/src/coordination/feature-flags.js +166 -0
  34. package/.claude-flow-novice/dist/src/coordination/feature-flags.js.map +1 -0
  35. package/.claude-flow-novice/dist/src/coordination/queen-agent.js +18 -4
  36. package/.claude-flow-novice/dist/src/coordination/queen-agent.js.map +1 -1
  37. package/.claude-flow-novice/dist/src/coordination/role-assignment.js +6 -110
  38. package/.claude-flow-novice/dist/src/coordination/role-assignment.js.map +1 -1
  39. package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js +632 -0
  40. package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js.map +1 -0
  41. package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js +11 -0
  42. package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js.map +1 -0
  43. package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js +318 -0
  44. package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js.map +1 -0
  45. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js +364 -0
  46. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js.map +1 -0
  47. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js +492 -0
  48. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js.map +1 -0
  49. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js +786 -0
  50. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js.map +1 -0
  51. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js +16 -0
  52. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js.map +1 -0
  53. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js +342 -0
  54. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js.map +1 -0
  55. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js +601 -0
  56. package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
  57. package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js +211 -0
  58. package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js.map +1 -0
  59. package/.claude-flow-novice/dist/src/coordination/v2/core/index.js +1 -0
  60. package/.claude-flow-novice/dist/src/coordination/v2/core/index.js.map +1 -1
  61. package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js +365 -6
  62. package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js.map +1 -1
  63. package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js +478 -0
  64. package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js.map +1 -0
  65. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js +5 -2
  66. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js.map +1 -1
  67. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js +189 -0
  68. package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js.map +1 -1
  69. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js +424 -0
  70. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js.map +1 -0
  71. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js +9 -0
  72. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js.map +1 -0
  73. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js +669 -0
  74. package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js.map +1 -0
  75. package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js +451 -0
  76. package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js.map +1 -0
  77. package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js +271 -0
  78. package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js.map +1 -0
  79. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js +335 -0
  80. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js.map +1 -0
  81. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js +439 -0
  82. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js.map +1 -0
  83. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js +92 -0
  84. package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js.map +1 -0
  85. package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js +21 -0
  86. package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js.map +1 -0
  87. package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js +223 -0
  88. package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js.map +1 -0
  89. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js +436 -0
  90. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js.map +1 -0
  91. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js +278 -0
  92. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js.map +1 -0
  93. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js +317 -0
  94. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js.map +1 -0
  95. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js +273 -0
  96. package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js.map +1 -0
  97. package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js +15 -0
  98. package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js.map +1 -0
  99. package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js +512 -0
  100. package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js.map +1 -0
  101. package/.claude-flow-novice/dist/src/coordination/v2/index.js +6 -0
  102. package/.claude-flow-novice/dist/src/coordination/v2/index.js.map +1 -1
  103. package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js +557 -0
  104. package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js.map +1 -0
  105. package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js +14 -0
  106. package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js.map +1 -0
  107. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js +212 -0
  108. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js.map +1 -0
  109. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js +552 -0
  110. package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js.map +1 -0
  111. package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js +367 -0
  112. package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js.map +1 -0
  113. package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js +1 -0
  114. package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js.map +1 -1
  115. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js +371 -0
  116. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js.map +1 -0
  117. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js +355 -0
  118. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js.map +1 -0
  119. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js +424 -0
  120. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js.map +1 -0
  121. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js +16 -0
  122. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js.map +1 -0
  123. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js +295 -0
  124. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js.map +1 -0
  125. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js +411 -0
  126. package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js.map +1 -0
  127. package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js +14 -0
  128. package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js.map +1 -0
  129. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js +387 -0
  130. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js.map +1 -0
  131. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js +589 -0
  132. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js.map +1 -0
  133. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js +444 -0
  134. package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js.map +1 -0
  135. package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js +29 -8
  136. package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js.map +1 -1
  137. package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js +470 -0
  138. package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js.map +1 -0
  139. package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js +450 -0
  140. package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js.map +1 -0
  141. package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js +5 -0
  142. package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js.map +1 -1
  143. package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js +545 -0
  144. package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js.map +1 -0
  145. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js +44 -0
  146. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js.map +1 -1
  147. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js +415 -0
  148. package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js.map +1 -0
  149. package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js +615 -0
  150. package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js.map +1 -0
  151. package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js +259 -0
  152. package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js.map +1 -0
  153. package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js +17 -0
  154. package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js.map +1 -0
  155. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js +357 -0
  156. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js.map +1 -0
  157. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js +679 -0
  158. package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js.map +1 -0
  159. package/.claude-flow-novice/dist/src/core/agent-manager.js +30 -0
  160. package/.claude-flow-novice/dist/src/core/agent-manager.js.map +1 -1
  161. package/.claude-flow-novice/dist/src/mcp/server.js +21 -2
  162. package/.claude-flow-novice/dist/src/mcp/server.js.map +1 -1
  163. package/.claude-flow-novice/dist/src/observability/metrics-counter.js +268 -0
  164. package/.claude-flow-novice/dist/src/observability/metrics-counter.js.map +1 -0
  165. package/.claude-flow-novice/dist/src/observability/metrics-storage.js +265 -0
  166. package/.claude-flow-novice/dist/src/observability/metrics-storage.js.map +1 -0
  167. package/.claude-flow-novice/dist/src/observability/telemetry.js +26 -0
  168. package/.claude-flow-novice/dist/src/observability/telemetry.js.map +1 -1
  169. package/.claude-flow-novice/dist/src/providers/tiered-router.js +64 -10
  170. package/.claude-flow-novice/dist/src/providers/tiered-router.js.map +1 -1
  171. package/.claude-flow-novice/dist/src/providers/zai-provider.js +196 -97
  172. package/.claude-flow-novice/dist/src/providers/zai-provider.js.map +1 -1
  173. package/.claude-flow-novice/dist/src/slash-commands/cfn-claude-sync.js +533 -0
  174. package/.claude-flow-novice/dist/src/slash-commands/index.js +5 -0
  175. package/.claude-flow-novice/dist/src/slash-commands/metrics-summary-class.js +74 -0
  176. package/.claude-flow-novice/dist/src/slash-commands/metrics-summary.js +335 -0
  177. package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +12 -0
  178. package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js +96 -0
  179. package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js.map +1 -0
  180. package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js +406 -0
  181. package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js.map +1 -0
  182. package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js +35 -5
  183. package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js.map +1 -1
  184. package/.claude-flow-novice/dist/src/web/api/config/api-config.js +186 -0
  185. package/.claude-flow-novice/dist/src/web/api/config/api-config.js.map +1 -0
  186. package/.claude-flow-novice/dist/src/web/api/middleware/auth.js +205 -0
  187. package/.claude-flow-novice/dist/src/web/api/middleware/auth.js.map +1 -0
  188. package/.claude-flow-novice/dist/src/web/api/middleware/cache.js +262 -0
  189. package/.claude-flow-novice/dist/src/web/api/middleware/cache.js.map +1 -0
  190. package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js +250 -0
  191. package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js.map +1 -0
  192. package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js +217 -0
  193. package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js.map +1 -0
  194. package/.claude-flow-novice/dist/src/web/api/middleware/validation.js +325 -0
  195. package/.claude-flow-novice/dist/src/web/api/middleware/validation.js.map +1 -0
  196. package/.claude-flow-novice/dist/src/web/api/routes/events.js +465 -0
  197. package/.claude-flow-novice/dist/src/web/api/routes/events.js.map +1 -0
  198. package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js +302 -0
  199. package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js.map +1 -0
  200. package/.claude-flow-novice/dist/src/web/api/routes/index.js +14 -0
  201. package/.claude-flow-novice/dist/src/web/api/routes/index.js.map +1 -0
  202. package/.claude-flow-novice/dist/src/web/api/routes/metrics.js +561 -0
  203. package/.claude-flow-novice/dist/src/web/api/routes/metrics.js.map +1 -0
  204. package/.claude-flow-novice/dist/src/web/api/routes/status.js +450 -0
  205. package/.claude-flow-novice/dist/src/web/api/routes/status.js.map +1 -0
  206. package/.claude-flow-novice/dist/src/web/api/server.js +451 -0
  207. package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -0
  208. package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js +385 -0
  209. package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js.map +1 -0
  210. package/.claude-flow-novice/dist/src/web/dashboard/index.js +87 -0
  211. package/.claude-flow-novice/dist/src/web/dashboard/index.js.map +1 -0
  212. package/.claude-flow-novice/dist/src/web/dashboard/types.js +6 -0
  213. package/.claude-flow-novice/dist/src/web/dashboard/types.js.map +1 -0
  214. package/.claude-flow-novice/metrics.db +0 -0
  215. package/.claude-flow-novice/metrics.db-shm +0 -0
  216. package/.claude-flow-novice/metrics.db-wal +0 -0
  217. package/CLAUDE.md +29 -0
  218. package/README.md +27 -0
  219. package/config/hooks/post-edit-pipeline.js +36 -2
  220. package/examples/metrics-counter-demo.ts +106 -0
  221. package/examples/persistent-metrics-demo.ts +83 -0
  222. package/examples/phase-5-multi-level-control.ts +282 -0
  223. package/examples/session-pool-optimizer-example.ts +311 -0
  224. package/package.json +15 -3
  225. package/scripts/check-routing-stats.cjs +122 -0
  226. package/scripts/pre-publish-validation.cjs +212 -0
  227. package/scripts/test-provider-routing.cjs +228 -0
  228. package/scripts/test-routing-telemetry.cjs +147 -0
  229. package/scripts/test-zai-10k.cjs +81 -0
  230. package/scripts/test-zai-api.cjs +191 -0
  231. package/scripts/test-zai-diagnostic.cjs +151 -0
  232. package/scripts/test-zai-final.cjs +128 -0
  233. package/scripts/test-zai-with-env.cjs +85 -0
  234. package/scripts/validate-coordination-cli.js +69 -0
  235. package/scripts/validate-coordination-toggle-integration.cjs +501 -0
  236. package/src/cli/simple-commands/init/templates/CLAUDE.md +29 -0
  237. package/src/observability/metrics-counter.ts +347 -0
  238. package/src/observability/metrics-storage.ts +356 -0
  239. package/src/observability/telemetry.ts +658 -0
  240. package/src/slash-commands/cfn-claude-sync.js +533 -0
  241. package/src/slash-commands/index.js +5 -0
  242. package/src/slash-commands/metrics-summary-class.js +74 -0
  243. package/src/slash-commands/metrics-summary.js +335 -0
  244. package/src/slash-commands/register-all-commands.js +12 -0
@@ -0,0 +1,364 @@
1
+ /**
2
+ * Cascading Shutdown Coordinator - Usage Examples
3
+ *
4
+ * Demonstrates hierarchical shutdown coordination with top-down notification
5
+ * and bottom-up completion aggregation.
6
+ */ import { CascadingShutdown } from './cascading-shutdown.js';
7
+ /**
8
+ * Example 1: Basic Hierarchical Shutdown
9
+ *
10
+ * Simple 3-level hierarchy with graceful shutdown from root.
11
+ */ async function example1_BasicShutdown() {
12
+ const cascadingShutdown = new CascadingShutdown(undefined, {
13
+ maxShutdownTimeMs: 10000,
14
+ createShutdownCheckpoints: true,
15
+ enableResourceCleanup: true,
16
+ notificationTimeoutMs: 100,
17
+ completionTimeoutMs: 200,
18
+ agentGracePeriodMs: 500
19
+ });
20
+ // Register 3-level hierarchy
21
+ cascadingShutdown.registerHierarchy('swarm-1', 'coordinator-0', [
22
+ {
23
+ agentId: 'coordinator-0',
24
+ level: 0,
25
+ childIds: [
26
+ 'agent-1',
27
+ 'agent-2'
28
+ ],
29
+ resources: [
30
+ {
31
+ type: 'connection',
32
+ id: 'db-conn-1',
33
+ cleaned: false
34
+ },
35
+ {
36
+ type: 'subscription',
37
+ id: 'event-sub-1',
38
+ cleaned: false
39
+ }
40
+ ]
41
+ },
42
+ {
43
+ agentId: 'agent-1',
44
+ level: 1,
45
+ parentId: 'coordinator-0',
46
+ childIds: [
47
+ 'agent-3',
48
+ 'agent-4'
49
+ ],
50
+ resources: [
51
+ {
52
+ type: 'file',
53
+ id: '/tmp/agent-1-cache.json',
54
+ cleaned: false
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ agentId: 'agent-2',
60
+ level: 1,
61
+ parentId: 'coordinator-0',
62
+ childIds: [
63
+ 'agent-5'
64
+ ],
65
+ resources: [
66
+ {
67
+ type: 'process',
68
+ id: 'worker-proc-123',
69
+ cleaned: false
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ agentId: 'agent-3',
75
+ level: 2,
76
+ parentId: 'agent-1',
77
+ resources: []
78
+ },
79
+ {
80
+ agentId: 'agent-4',
81
+ level: 2,
82
+ parentId: 'agent-1',
83
+ resources: []
84
+ },
85
+ {
86
+ agentId: 'agent-5',
87
+ level: 2,
88
+ parentId: 'agent-2',
89
+ resources: []
90
+ }
91
+ ]);
92
+ // Register resource cleanup handlers
93
+ cascadingShutdown.registerResourceCleanup('connection', async (resource)=>{
94
+ console.log(`Closing database connection: ${resource.id}`);
95
+ // await db.close(resource.id);
96
+ });
97
+ cascadingShutdown.registerResourceCleanup('file', async (resource)=>{
98
+ console.log(`Deleting temporary file: ${resource.id}`);
99
+ // await fs.unlink(resource.id);
100
+ });
101
+ cascadingShutdown.registerResourceCleanup('process', async (resource)=>{
102
+ console.log(`Terminating worker process: ${resource.id}`);
103
+ // await killProcess(resource.id);
104
+ });
105
+ // Initiate shutdown from root
106
+ const result = await cascadingShutdown.initiateShutdown('coordinator-0', 'Task completed successfully');
107
+ console.log('Shutdown Results:', {
108
+ success: result.success,
109
+ totalAgents: result.totalAgents,
110
+ successfulShutdowns: result.successfulShutdowns,
111
+ totalLatencyMs: result.totalLatencyMs,
112
+ notificationLatencyMs: result.notificationLatencyMs,
113
+ aggregationLatencyMs: result.aggregationLatencyMs,
114
+ resourcesCleaned: result.totalResourcesCleaned
115
+ });
116
+ // Performance validation
117
+ if (result.totalLatencyMs < 1000 && result.totalAgents <= 20) {
118
+ console.log('✅ Performance target met: <1s for 6 agents');
119
+ }
120
+ }
121
+ /**
122
+ * Example 2: Emergency Shutdown
123
+ *
124
+ * Fast shutdown without checkpoints or resource cleanup (critical errors).
125
+ */ async function example2_EmergencyShutdown() {
126
+ const cascadingShutdown = new CascadingShutdown(undefined, {
127
+ maxShutdownTimeMs: 5000,
128
+ createShutdownCheckpoints: false,
129
+ enableResourceCleanup: false,
130
+ enableEmergencyMode: true
131
+ });
132
+ cascadingShutdown.registerHierarchy('swarm-2', 'root-agent', [
133
+ {
134
+ agentId: 'root-agent',
135
+ level: 0,
136
+ childIds: [
137
+ 'agent-a',
138
+ 'agent-b'
139
+ ]
140
+ },
141
+ {
142
+ agentId: 'agent-a',
143
+ level: 1,
144
+ parentId: 'root-agent'
145
+ },
146
+ {
147
+ agentId: 'agent-b',
148
+ level: 1,
149
+ parentId: 'root-agent'
150
+ }
151
+ ]);
152
+ // Emergency shutdown (skips checkpoints and resource cleanup)
153
+ const result = await cascadingShutdown.emergencyShutdown('root-agent', 'Critical memory leak detected');
154
+ console.log('Emergency Shutdown:', {
155
+ success: result.success,
156
+ latencyMs: result.totalLatencyMs,
157
+ reason: result.reason
158
+ });
159
+ }
160
+ /**
161
+ * Example 3: Deep Hierarchy (10+ levels)
162
+ *
163
+ * Tests cascading shutdown with maximum nesting depth.
164
+ */ async function example3_DeepHierarchy() {
165
+ const cascadingShutdown = new CascadingShutdown();
166
+ // Build 10-level hierarchy
167
+ const nodes = [];
168
+ for(let level = 0; level < 10; level++){
169
+ const agentId = `agent-L${level}`;
170
+ const parentId = level > 0 ? `agent-L${level - 1}` : undefined;
171
+ const childIds = level < 9 ? [
172
+ `agent-L${level + 1}`
173
+ ] : [];
174
+ nodes.push({
175
+ agentId,
176
+ level,
177
+ parentId,
178
+ childIds
179
+ });
180
+ }
181
+ cascadingShutdown.registerHierarchy('deep-swarm', 'agent-L0', nodes);
182
+ // Shutdown from root (Level 0)
183
+ const result = await cascadingShutdown.initiateShutdown('agent-L0', 'Deep hierarchy test completion');
184
+ console.log('Deep Hierarchy Shutdown:', {
185
+ maxDepth: result.maxDepth,
186
+ totalAgents: result.totalAgents,
187
+ notificationLatency: result.notificationLatencyMs,
188
+ aggregationLatency: result.aggregationLatencyMs
189
+ });
190
+ // Verify bottom-up completion order
191
+ const levels = result.agentResults.map((r)=>r.level).sort((a, b)=>b - a);
192
+ console.log('Completion order (by level, desc):', levels);
193
+ // Expected: [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] (leaves first, root last)
194
+ }
195
+ /**
196
+ * Example 4: Event Monitoring
197
+ *
198
+ * Listen to shutdown events for debugging and metrics.
199
+ */ async function example4_EventMonitoring() {
200
+ const cascadingShutdown = new CascadingShutdown();
201
+ // Monitor shutdown events
202
+ cascadingShutdown.on('shutdown:started', (data)=>{
203
+ console.log('[Event] Shutdown started:', data);
204
+ });
205
+ cascadingShutdown.on('agent:notified', (data)=>{
206
+ console.log(`[Event] Agent ${data.agentId} notified at level ${data.level}`);
207
+ });
208
+ cascadingShutdown.on('agent:shutdown', (result)=>{
209
+ console.log(`[Event] Agent ${result.agentId} shutdown:`, {
210
+ success: result.success,
211
+ resourcesCleaned: result.resourcesCleaned,
212
+ latencyMs: result.completionLatencyMs
213
+ });
214
+ });
215
+ cascadingShutdown.on('resource:cleaned', (data)=>{
216
+ console.log(`[Event] Resource cleaned: ${data.resourceType} ${data.resourceId}`);
217
+ });
218
+ cascadingShutdown.on('shutdown:completed', (result)=>{
219
+ console.log('[Event] Shutdown completed:', {
220
+ success: result.success,
221
+ totalLatencyMs: result.totalLatencyMs
222
+ });
223
+ });
224
+ // Register and shutdown
225
+ cascadingShutdown.registerHierarchy('monitored-swarm', 'root', [
226
+ {
227
+ agentId: 'root',
228
+ level: 0,
229
+ childIds: [
230
+ 'child-1',
231
+ 'child-2'
232
+ ]
233
+ },
234
+ {
235
+ agentId: 'child-1',
236
+ level: 1,
237
+ parentId: 'root'
238
+ },
239
+ {
240
+ agentId: 'child-2',
241
+ level: 1,
242
+ parentId: 'root'
243
+ }
244
+ ]);
245
+ await cascadingShutdown.initiateShutdown('root', 'Event monitoring example');
246
+ }
247
+ /**
248
+ * Example 5: Integration with HierarchicalCompletionDetector
249
+ *
250
+ * Combine completion detection with cascading shutdown.
251
+ */ async function example5_CompletionIntegration(hierarchicalDetector) {
252
+ const cascadingShutdown = new CascadingShutdown(hierarchicalDetector, {
253
+ createShutdownCheckpoints: true,
254
+ enableResourceCleanup: true
255
+ });
256
+ // Register hierarchy
257
+ cascadingShutdown.registerHierarchy('completion-swarm', 'pm-agent', [
258
+ {
259
+ agentId: 'pm-agent',
260
+ level: 0,
261
+ childIds: [
262
+ 'worker-1',
263
+ 'worker-2'
264
+ ]
265
+ },
266
+ {
267
+ agentId: 'worker-1',
268
+ level: 1,
269
+ parentId: 'pm-agent'
270
+ },
271
+ {
272
+ agentId: 'worker-2',
273
+ level: 1,
274
+ parentId: 'pm-agent'
275
+ }
276
+ ]);
277
+ // Wait for completion detection
278
+ const completionResult = await hierarchicalDetector.detectCompletion('completion-swarm');
279
+ if (completionResult.completed) {
280
+ console.log('All agents completed. Initiating shutdown...');
281
+ // Shutdown after completion
282
+ const shutdownResult = await cascadingShutdown.initiateShutdown('pm-agent', 'Task completed - graceful shutdown');
283
+ console.log('Shutdown after completion:', {
284
+ checkpointsCreated: shutdownResult.agentResults.filter((r)=>r.checkpointId).length,
285
+ totalLatencyMs: shutdownResult.totalLatencyMs
286
+ });
287
+ }
288
+ }
289
+ /**
290
+ * Example 6: 20-Agent Performance Benchmark
291
+ *
292
+ * Validates <1s shutdown target for 20-agent hierarchy.
293
+ */ async function example6_PerformanceBenchmark() {
294
+ const cascadingShutdown = new CascadingShutdown();
295
+ // Create 20-agent hierarchy (4 levels, 5 agents per level)
296
+ const nodes = [
297
+ {
298
+ agentId: 'root',
299
+ level: 0,
300
+ childIds: [
301
+ 'L1-A',
302
+ 'L1-B',
303
+ 'L1-C',
304
+ 'L1-D',
305
+ 'L1-E'
306
+ ]
307
+ }
308
+ ];
309
+ // Level 1
310
+ for(let i = 0; i < 5; i++){
311
+ const agentId = `L1-${String.fromCharCode(65 + i)}`;
312
+ nodes.push({
313
+ agentId,
314
+ level: 1,
315
+ parentId: 'root',
316
+ childIds: [
317
+ `L2-${String.fromCharCode(65 + i)}`
318
+ ]
319
+ });
320
+ }
321
+ // Level 2
322
+ for(let i = 0; i < 5; i++){
323
+ const agentId = `L2-${String.fromCharCode(65 + i)}`;
324
+ nodes.push({
325
+ agentId,
326
+ level: 2,
327
+ parentId: `L1-${String.fromCharCode(65 + i)}`,
328
+ childIds: [
329
+ `L3-${String.fromCharCode(65 + i)}`
330
+ ]
331
+ });
332
+ }
333
+ // Level 3 (leaf nodes)
334
+ for(let i = 0; i < 5; i++){
335
+ const agentId = `L3-${String.fromCharCode(65 + i)}`;
336
+ nodes.push({
337
+ agentId,
338
+ level: 3,
339
+ parentId: `L2-${String.fromCharCode(65 + i)}`
340
+ });
341
+ }
342
+ cascadingShutdown.registerHierarchy('benchmark-swarm', 'root', nodes);
343
+ console.log('Starting 20-agent shutdown benchmark...');
344
+ const startTime = Date.now();
345
+ const result = await cascadingShutdown.initiateShutdown('root', 'Performance benchmark');
346
+ const totalTime = Date.now() - startTime;
347
+ console.log('Benchmark Results:', {
348
+ totalAgents: result.totalAgents,
349
+ totalLatencyMs: totalTime,
350
+ targetMet: totalTime < 1000,
351
+ notificationLatencyMs: result.notificationLatencyMs,
352
+ aggregationLatencyMs: result.aggregationLatencyMs
353
+ });
354
+ // Assert performance target
355
+ if (totalTime < 1000) {
356
+ console.log('✅ Performance target achieved: <1s for 20 agents');
357
+ } else {
358
+ console.warn(`⚠️ Performance target missed: ${totalTime}ms > 1000ms`);
359
+ }
360
+ }
361
+ // Export examples
362
+ export { example1_BasicShutdown, example2_EmergencyShutdown, example3_DeepHierarchy, example4_EventMonitoring, example5_CompletionIntegration, example6_PerformanceBenchmark };
363
+
364
+ //# sourceMappingURL=cascading-shutdown.example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/coordination/v2/coordinators/cascading-shutdown.example.ts"],"names":["CascadingShutdown","example1_BasicShutdown","cascadingShutdown","undefined","maxShutdownTimeMs","createShutdownCheckpoints","enableResourceCleanup","notificationTimeoutMs","completionTimeoutMs","agentGracePeriodMs","registerHierarchy","agentId","level","childIds","resources","type","id","cleaned","parentId","registerResourceCleanup","resource","console","log","result","initiateShutdown","success","totalAgents","successfulShutdowns","totalLatencyMs","notificationLatencyMs","aggregationLatencyMs","resourcesCleaned","totalResourcesCleaned","example2_EmergencyShutdown","enableEmergencyMode","emergencyShutdown","latencyMs","reason","example3_DeepHierarchy","nodes","push","maxDepth","notificationLatency","aggregationLatency","levels","agentResults","map","r","sort","a","b","example4_EventMonitoring","on","data","completionLatencyMs","resourceType","resourceId","example5_CompletionIntegration","hierarchicalDetector","completionResult","detectCompletion","completed","shutdownResult","checkpointsCreated","filter","checkpointId","length","example6_PerformanceBenchmark","i","String","fromCharCode","startTime","Date","now","totalTime","targetMet","warn"],"mappings":"AAAA;;;;;CAKC,GAED,SAASA,iBAAiB,QAAQ,0BAA0B;AAG5D;;;;CAIC,GACD,eAAeC;IACb,MAAMC,oBAAoB,IAAIF,kBAAkBG,WAAW;QACzDC,mBAAmB;QACnBC,2BAA2B;QAC3BC,uBAAuB;QACvBC,uBAAuB;QACvBC,qBAAqB;QACrBC,oBAAoB;IACtB;IAEA,6BAA6B;IAC7B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