claude-flow-novice 1.6.3 → 1.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/.claude/commands/parse-epic.js +180 -0
  2. package/.claude/settings.json +12 -2
  3. package/.claude/settings.local.json +4 -2
  4. package/.claude-flow-novice/dist/mcp/mcp-server-novice.js +37 -2
  5. package/.claude-flow-novice/dist/mcp/transports/base.js +5 -0
  6. package/.claude-flow-novice/dist/mcp/transports/base.js.map +1 -0
  7. package/.claude-flow-novice/dist/mcp/transports/http.js +414 -0
  8. package/.claude-flow-novice/dist/mcp/transports/http.js.map +1 -0
  9. package/.claude-flow-novice/dist/mcp/transports/stdio.js +217 -0
  10. package/.claude-flow-novice/dist/mcp/transports/stdio.js.map +1 -0
  11. package/.claude-flow-novice/dist/src/cli/commands/parse-epic.js +129 -0
  12. package/.claude-flow-novice/dist/src/cli/commands/parse-epic.js.map +1 -0
  13. package/.claude-flow-novice/dist/src/cli/index.js +3 -0
  14. package/.claude-flow-novice/dist/src/cli/index.js.map +1 -1
  15. package/.claude-flow-novice/dist/src/cli/utils/epic-parser.js +266 -0
  16. package/.claude-flow-novice/dist/src/cli/utils/epic-parser.js.map +1 -0
  17. package/.claude-flow-novice/dist/src/communication/message-bus.js +105 -2
  18. package/.claude-flow-novice/dist/src/communication/message-bus.js.map +1 -1
  19. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +1 -1
  20. package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -1
  21. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/artifact-cache-optimizer.js +632 -0
  22. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/artifact-cache-optimizer.js.map +1 -0
  23. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/index.js +11 -0
  24. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/index.js.map +1 -0
  25. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/checkpoints/checkpoint-compressor.js +318 -0
  26. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/checkpoints/checkpoint-compressor.js.map +1 -0
  27. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/completion-detector.js +234 -0
  28. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/completion-detector.js.map +1 -0
  29. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/hierarchical-detector.js +347 -0
  30. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/hierarchical-detector.js.map +1 -0
  31. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/index.js +13 -0
  32. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/index.js.map +1 -0
  33. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/lamport-clock.js +173 -0
  34. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/lamport-clock.js.map +1 -0
  35. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/mesh-detector.js +526 -0
  36. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/mesh-detector.js.map +1 -0
  37. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/sdk-completion-detector.js +443 -0
  38. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/sdk-completion-detector.js.map +1 -0
  39. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/swarm-shutdown.js +366 -0
  40. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/swarm-shutdown.js.map +1 -0
  41. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinator-factory.js +287 -0
  42. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinator-factory.js.map +1 -0
  43. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.example.js +364 -0
  44. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.example.js.map +1 -0
  45. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.js +492 -0
  46. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.js.map +1 -0
  47. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/hierarchical-coordinator.js +786 -0
  48. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/hierarchical-coordinator.js.map +1 -0
  49. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/index.js +16 -0
  50. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/index.js.map +1 -0
  51. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/parent-child-manager.js +342 -0
  52. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/parent-child-manager.js.map +1 -0
  53. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/swarm-coordinator-v2.js +601 -0
  54. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
  55. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/agent-state.js +9 -0
  56. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/agent-state.js.map +1 -0
  57. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dead-letter-queue.js +413 -0
  58. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dead-letter-queue.js.map +1 -0
  59. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-graph.js +471 -0
  60. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-graph.js.map +1 -0
  61. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-node.js +379 -0
  62. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-node.js.map +1 -0
  63. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-resolver.js +335 -0
  64. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-resolver.js.map +1 -0
  65. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/help-request-metrics.js +211 -0
  66. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/help-request-metrics.js.map +1 -0
  67. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/index.js +33 -0
  68. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/index.js.map +1 -0
  69. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-broker.js +920 -0
  70. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-broker.js.map +1 -0
  71. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-router.js +385 -0
  72. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-router.js.map +1 -0
  73. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message.js +138 -0
  74. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message.js.map +1 -0
  75. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/resource-manager-safe.js +478 -0
  76. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/resource-manager-safe.js.map +1 -0
  77. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine-config.js +358 -0
  78. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine-config.js.map +1 -0
  79. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine.js +588 -0
  80. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine.js.map +1 -0
  81. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-transition.js +153 -0
  82. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-transition.js.map +1 -0
  83. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/task-scheduler.js +360 -0
  84. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/task-scheduler.js.map +1 -0
  85. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/topic-manager.js +337 -0
  86. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/topic-manager.js.map +1 -0
  87. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/deadlock-detector.js +424 -0
  88. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/deadlock-detector.js.map +1 -0
  89. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/index.js +9 -0
  90. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/index.js.map +1 -0
  91. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/resource-manager.js +669 -0
  92. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/resource-manager.js.map +1 -0
  93. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/artifact-storage.js +451 -0
  94. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/artifact-storage.js.map +1 -0
  95. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/cycle-detector.js +271 -0
  96. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/cycle-detector.js.map +1 -0
  97. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-graph.js +335 -0
  98. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-graph.js.map +1 -0
  99. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-manager.js +439 -0
  100. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-manager.js.map +1 -0
  101. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-request.js +92 -0
  102. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-request.js.map +1 -0
  103. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/index.js +21 -0
  104. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/index.js.map +1 -0
  105. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/topological-sort.js +223 -0
  106. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/topological-sort.js.map +1 -0
  107. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-coordinator.js +436 -0
  108. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-coordinator.js.map +1 -0
  109. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-matcher.js +278 -0
  110. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-matcher.js.map +1 -0
  111. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request-handler.js +317 -0
  112. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request-handler.js.map +1 -0
  113. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request.js +273 -0
  114. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request.js.map +1 -0
  115. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/index.js +15 -0
  116. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/index.js.map +1 -0
  117. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/waiting-agent-pool.js +512 -0
  118. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/waiting-agent-pool.js.map +1 -0
  119. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/index.js +67 -0
  120. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/index.js.map +1 -0
  121. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/help-deadlock-integration.js +557 -0
  122. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/help-deadlock-integration.js.map +1 -0
  123. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/index.js +14 -0
  124. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/index.js.map +1 -0
  125. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.example.js +212 -0
  126. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.example.js.map +1 -0
  127. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.js +552 -0
  128. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.js.map +1 -0
  129. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/state-machine-integration.js +635 -0
  130. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/state-machine-integration.js.map +1 -0
  131. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/IArtifactStorage.js +28 -0
  132. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/IArtifactStorage.js.map +1 -0
  133. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ICoordinator.js +9 -0
  134. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ICoordinator.js.map +1 -0
  135. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ISessionStore.js +25 -0
  136. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ISessionStore.js.map +1 -0
  137. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/index.js +14 -0
  138. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/index.js.map +1 -0
  139. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/artifact-adapter.js +308 -0
  140. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/artifact-adapter.js.map +1 -0
  141. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/completion-storage.js +439 -0
  142. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/completion-storage.js.map +1 -0
  143. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-graph-storage.js +540 -0
  144. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-graph-storage.js.map +1 -0
  145. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-storage.js +367 -0
  146. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-storage.js.map +1 -0
  147. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/index.js +14 -0
  148. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/index.js.map +1 -0
  149. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/message-storage.js +518 -0
  150. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/message-storage.js.map +1 -0
  151. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/state-storage.js +377 -0
  152. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/state-storage.js.map +1 -0
  153. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channel.js +371 -0
  154. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channel.js.map +1 -0
  155. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/dependency-channel.js +355 -0
  156. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/dependency-channel.js.map +1 -0
  157. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/help-channel.js +424 -0
  158. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/help-channel.js.map +1 -0
  159. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/index.js +16 -0
  160. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/index.js.map +1 -0
  161. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/state-channel.js +295 -0
  162. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/state-channel.js.map +1 -0
  163. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/task-channel.js +411 -0
  164. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/task-channel.js.map +1 -0
  165. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/index.js +14 -0
  166. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/index.js.map +1 -0
  167. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-bus.js +387 -0
  168. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-bus.js.map +1 -0
  169. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-persistence.js +589 -0
  170. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-persistence.js.map +1 -0
  171. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-router.js +444 -0
  172. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-router.js.map +1 -0
  173. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/artifact-storage.js +560 -0
  174. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/artifact-storage.js.map +1 -0
  175. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/background-orchestrator.js +335 -0
  176. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/background-orchestrator.js.map +1 -0
  177. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/bash-output-monitor.js +104 -0
  178. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/bash-output-monitor.js.map +1 -0
  179. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/checkpoint-manager.js +847 -0
  180. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/checkpoint-manager.js.map +1 -0
  181. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/help-coordinator.js +470 -0
  182. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/help-coordinator.js.map +1 -0
  183. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/hierarchical-background-integration.js +450 -0
  184. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/hierarchical-background-integration.js.map +1 -0
  185. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/index.js +13 -0
  186. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/index.js.map +1 -0
  187. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/message-bus-integration.js +625 -0
  188. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/message-bus-integration.js.map +1 -0
  189. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/multi-level-control.js +545 -0
  190. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/multi-level-control.js.map +1 -0
  191. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-controller.js +740 -0
  192. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-controller.js.map +1 -0
  193. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-message-integration.js +415 -0
  194. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-message-integration.js.map +1 -0
  195. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/session-pool-optimizer.js +615 -0
  196. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/session-pool-optimizer.js.map +1 -0
  197. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-machine-integration.js +547 -0
  198. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-machine-integration.js.map +1 -0
  199. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-sdk-integration.js +342 -0
  200. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-sdk-integration.js.map +1 -0
  201. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/security/payload-validator.js +259 -0
  202. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/security/payload-validator.js.map +1 -0
  203. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/framework-registry.js +273 -0
  204. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/framework-registry.js.map +1 -0
  205. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/index.js +8 -0
  206. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/index.js.map +1 -0
  207. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-config-manager.js +310 -0
  208. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-config-manager.js.map +1 -0
  209. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-validator.js +218 -0
  210. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-validator.js.map +1 -0
  211. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/types/sdk.js +9 -0
  212. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/types/sdk.js.map +1 -0
  213. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/index.js +6 -0
  214. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/index.js.map +1 -0
  215. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/priority-queue.js +145 -0
  216. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/priority-queue.js.map +1 -0
  217. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/sdk-helpers.js +122 -0
  218. package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/sdk-helpers.js.map +1 -0
  219. package/.claude-flow-novice/dist/src/coordination/config-translator.js +17 -43
  220. package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -1
  221. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +34 -76
  222. package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -1
  223. package/.claude-flow-novice/dist/src/coordination/index.js +3 -0
  224. package/.claude-flow-novice/dist/src/coordination/index.js.map +1 -1
  225. package/.claude-flow-novice/dist/src/coordination/shared/core/agent-state.js +172 -0
  226. package/.claude-flow-novice/dist/src/coordination/shared/core/agent-state.js.map +1 -0
  227. package/.claude-flow-novice/dist/src/coordination/shared/core/index.js +7 -0
  228. package/.claude-flow-novice/dist/src/coordination/shared/core/index.js.map +1 -0
  229. package/.claude-flow-novice/dist/src/coordination/shared/index.js +19 -0
  230. package/.claude-flow-novice/dist/src/coordination/shared/index.js.map +1 -0
  231. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js +24 -0
  232. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js.map +1 -0
  233. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js +7 -0
  234. package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js.map +1 -0
  235. package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js +920 -0
  236. package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js.map +1 -0
  237. package/.claude-flow-novice/dist/src/coordination/shared/message.js +138 -0
  238. package/.claude-flow-novice/dist/src/coordination/shared/message.js.map +1 -0
  239. package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js +259 -0
  240. package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js.map +1 -0
  241. package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js +17 -0
  242. package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js.map +1 -0
  243. package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js +19 -0
  244. package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js.map +1 -0
  245. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js +357 -0
  246. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js.map +1 -0
  247. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js +679 -0
  248. package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js.map +1 -0
  249. package/.claude-flow-novice/dist/src/coordination/shared/types/index.js +7 -0
  250. package/.claude-flow-novice/dist/src/coordination/shared/types/index.js.map +1 -0
  251. package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js +10 -0
  252. package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js.map +1 -0
  253. package/.claude-flow-novice/dist/src/coordination/v1-transparency/interfaces/v1-transparency-system.js +12 -0
  254. package/.claude-flow-novice/dist/src/coordination/v1-transparency/interfaces/v1-transparency-system.js.map +1 -0
  255. package/.claude-flow-novice/dist/src/coordination/v1-transparency/v1-to-v2-bridge.js +433 -0
  256. package/.claude-flow-novice/dist/src/coordination/v1-transparency/v1-to-v2-bridge.js.map +1 -0
  257. package/.claude-flow-novice/dist/src/coordination/v1-transparency/v1-transparency-adapter.js +1468 -0
  258. package/.claude-flow-novice/dist/src/coordination/v1-transparency/v1-transparency-adapter.js.map +1 -0
  259. package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js +52 -2
  260. package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js.map +1 -1
  261. package/.claude-flow-novice/dist/src/mcp/mcp-server-novice.js +37 -2
  262. package/.claude-flow-novice/dist/src/mcp/session-manager.js +3 -1
  263. package/.claude-flow-novice/dist/src/mcp/session-manager.js.map +1 -1
  264. package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js +5 -0
  265. package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js.map +1 -1
  266. package/.claude-flow-novice/dist/src/providers/provider-manager.js +41 -6
  267. package/.claude-flow-novice/dist/src/providers/provider-manager.js.map +1 -1
  268. package/.claude-flow-novice/dist/src/providers/tiered-router.js +9 -17
  269. package/.claude-flow-novice/dist/src/providers/tiered-router.js.map +1 -1
  270. package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js +65 -41
  271. package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js.map +1 -1
  272. package/.claude-flow-novice/dist/src/web/api/server.js +1 -1
  273. package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -1
  274. package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js +30 -0
  275. package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js.map +1 -1
  276. package/.claude-flow-novice/metrics.db +0 -0
  277. package/.claude-flow-novice/metrics.db-shm +0 -0
  278. package/.claude-flow-novice/metrics.db-wal +0 -0
  279. package/CLAUDE.md +72 -0
  280. package/config/hooks/post-edit-pipeline.js +68 -118
  281. package/config/hooks/pre-tool-memory-safety.js +209 -0
  282. package/package.json +7 -4
  283. package/scripts/cleanup-idle-sessions.sh +59 -0
  284. package/scripts/monitoring/alert-monitor.sh +220 -0
  285. package/scripts/monitoring/view-alerts.sh +307 -0
  286. package/scripts/test-provider-routing.cjs +7 -9
  287. package/scripts/test-zai-api.cjs +2 -2
  288. package/src/slash-commands/parse-epic.js +1 -1
  289. package/wiki/Provider-Routing.md +57 -69
  290. package/MEMORY_LEAK_ROOT_CAUSE.md +0 -149
@@ -0,0 +1,545 @@
1
+ /**
2
+ * Phase 5 - Sprint 5.2: Multi-Level Agent Control
3
+ *
4
+ * Implements pause/inject/resume from Level 0 to any child level:
5
+ * - Parent can pause any descendant at any level
6
+ * - Inject commands to paused agents (modify state, update tasks)
7
+ * - Resume agents from Level 0 supervisor
8
+ * - Propagate control commands down hierarchy with <100ms latency
9
+ *
10
+ * @module coordination/v2/sdk/multi-level-control
11
+ */ import { EventEmitter } from 'node:events';
12
+ import { Logger } from '../../../core/logger.js';
13
+ import { generateId } from '../../../utils/helpers.js';
14
+ // ============================================================================
15
+ // Types and Interfaces
16
+ // ============================================================================
17
+ /**
18
+ * Command types that can be injected into paused agents
19
+ */ export var InjectedCommandType = /*#__PURE__*/ function(InjectedCommandType) {
20
+ /** Modify agent internal state */ InjectedCommandType["STATE_UPDATE"] = "state_update";
21
+ /** Assign new task to agent */ InjectedCommandType["TASK_UPDATE"] = "task_update";
22
+ /** Update agent priority */ InjectedCommandType["PRIORITY_UPDATE"] = "priority_update";
23
+ /** Modify agent metadata */ InjectedCommandType["METADATA_UPDATE"] = "metadata_update";
24
+ /** Custom command with arbitrary payload */ InjectedCommandType["CUSTOM"] = "custom";
25
+ return InjectedCommandType;
26
+ }({});
27
+ // ============================================================================
28
+ // Multi-Level Control Integration Layer
29
+ // ============================================================================
30
+ /**
31
+ * MultiLevelController - Enables Level 0 to control any descendant
32
+ *
33
+ * Integrates QueryController (pause/resume) with HierarchicalCoordinator
34
+ * (hierarchy management) to provide:
35
+ * - Pause any agent at any level from Level 0
36
+ * - Inject commands into paused agents
37
+ * - Resume agents with injected commands applied
38
+ * - <100ms latency for control operations
39
+ */ export class MultiLevelController extends EventEmitter {
40
+ logger;
41
+ config;
42
+ queryController;
43
+ hierarchicalCoordinator;
44
+ /** Command injection queue per agent */ commandQueues;
45
+ /** Agent level cache for fast lookups */ agentLevelCache;
46
+ /** Control operation metrics */ metrics;
47
+ constructor(queryController, config = {}){
48
+ super();
49
+ this.logger = new Logger({
50
+ level: 'info',
51
+ format: 'text',
52
+ destination: 'console'
53
+ });
54
+ this.config = {
55
+ maxControlLatencyMs: 100,
56
+ enableCommandQueue: true,
57
+ maxQueuedCommands: 50,
58
+ enableLogging: config.enableLogging ?? true,
59
+ ...config
60
+ };
61
+ this.queryController = queryController;
62
+ this.commandQueues = new Map();
63
+ this.agentLevelCache = new Map();
64
+ this.metrics = this.initializeMetrics();
65
+ this.logger.info('MultiLevelController initialized', {
66
+ maxControlLatencyMs: this.config.maxControlLatencyMs,
67
+ enableCommandQueue: this.config.enableCommandQueue
68
+ });
69
+ }
70
+ /**
71
+ * Register hierarchical coordinator for level tracking
72
+ */ registerHierarchicalCoordinator(coordinator) {
73
+ this.hierarchicalCoordinator = coordinator;
74
+ // Build agent level cache from hierarchy
75
+ if (coordinator && typeof coordinator.getHierarchyStructure === 'function') {
76
+ const hierarchy = coordinator.getHierarchyStructure();
77
+ for (const agent of hierarchy.agents){
78
+ this.agentLevelCache.set(agent.id, agent.level);
79
+ }
80
+ this.logger.info('Hierarchical coordinator registered', {
81
+ totalAgents: hierarchy.agents.length,
82
+ hierarchyDepth: hierarchy.depth
83
+ });
84
+ }
85
+ }
86
+ /**
87
+ * Update agent level cache when hierarchy changes
88
+ */ updateAgentLevel(agentId, level) {
89
+ this.agentLevelCache.set(agentId, level);
90
+ }
91
+ /**
92
+ * Get agent hierarchy level (cached)
93
+ */ getAgentLevel(agentId) {
94
+ // Try cache first
95
+ const cachedLevel = this.agentLevelCache.get(agentId);
96
+ if (cachedLevel !== undefined) {
97
+ return cachedLevel;
98
+ }
99
+ // Fallback to hierarchical coordinator lookup
100
+ if (this.hierarchicalCoordinator) {
101
+ const agentStatus = this.hierarchicalCoordinator.getAgentStatus(agentId);
102
+ if (agentStatus) {
103
+ this.agentLevelCache.set(agentId, agentStatus.level);
104
+ return agentStatus.level;
105
+ }
106
+ }
107
+ // Default to Level 0 if not found
108
+ return 0;
109
+ }
110
+ // ============================================================================
111
+ // Multi-Level Control Operations (Level 0 → Level N)
112
+ // ============================================================================
113
+ /**
114
+ * Pause agent at any level from Level 0 parent
115
+ *
116
+ * @param parentAgentId - Parent issuing the pause (Level 0 supervisor)
117
+ * @param targetAgentId - Child agent to pause (any level)
118
+ * @param reason - Reason for pause
119
+ * @returns Control operation result
120
+ */ async pauseChildAgent(parentAgentId, targetAgentId, reason) {
121
+ const startTime = Date.now();
122
+ try {
123
+ const targetLevel = this.getAgentLevel(targetAgentId);
124
+ // Use QueryController to pause agent
125
+ await this.queryController.pauseAgent(targetAgentId, reason ?? `Paused by parent ${parentAgentId}`);
126
+ const latencyMs = Date.now() - startTime;
127
+ // Update metrics
128
+ this.updateControlMetrics(latencyMs);
129
+ this.metrics.totalPauses++;
130
+ const result = {
131
+ operation: 'pause',
132
+ success: true,
133
+ agentId: targetAgentId,
134
+ level: targetLevel,
135
+ latencyMs,
136
+ data: {
137
+ parentAgentId,
138
+ reason
139
+ }
140
+ };
141
+ if (this.config.enableLogging) {
142
+ this.logger.info('Agent paused from parent', {
143
+ parentAgentId,
144
+ targetAgentId,
145
+ level: targetLevel,
146
+ latencyMs
147
+ });
148
+ }
149
+ this.emit('agent:paused', result);
150
+ return result;
151
+ } catch (error) {
152
+ const latencyMs = Date.now() - startTime;
153
+ const errorMessage = error instanceof Error ? error.message : String(error);
154
+ this.logger.error('Failed to pause child agent', {
155
+ parentAgentId,
156
+ targetAgentId,
157
+ error: errorMessage
158
+ });
159
+ return {
160
+ operation: 'pause',
161
+ success: false,
162
+ agentId: targetAgentId,
163
+ level: this.getAgentLevel(targetAgentId),
164
+ latencyMs,
165
+ error: errorMessage
166
+ };
167
+ }
168
+ }
169
+ /**
170
+ * Inject command into paused agent at any level
171
+ *
172
+ * Commands are queued and applied when agent resumes.
173
+ * This allows parents to modify child state, assign tasks, update priorities.
174
+ *
175
+ * @param parentAgentId - Parent issuing the command
176
+ * @param targetAgentId - Child agent to receive command
177
+ * @param commandType - Type of command to inject
178
+ * @param payload - Command payload
179
+ * @param immediate - Execute immediately vs queue for resume
180
+ * @returns Injection result
181
+ */ async injectCommand(parentAgentId, targetAgentId, commandType, payload, immediate = false) {
182
+ const startTime = Date.now();
183
+ try {
184
+ const targetLevel = this.getAgentLevel(targetAgentId);
185
+ // Verify agent is paused
186
+ const session = await this.queryController.getAgentSession(targetAgentId);
187
+ if (!session.isPaused && !immediate) {
188
+ throw new Error(`Agent ${targetAgentId} must be paused before command injection`);
189
+ }
190
+ // Create injected command
191
+ const command = {
192
+ id: generateId('cmd'),
193
+ type: commandType,
194
+ payload,
195
+ issuedBy: parentAgentId,
196
+ targetAgentId,
197
+ targetLevel,
198
+ timestamp: new Date(),
199
+ immediate
200
+ };
201
+ // Queue command for agent
202
+ if (this.config.enableCommandQueue) {
203
+ this.queueCommand(targetAgentId, command);
204
+ }
205
+ // Apply command to agent session metadata
206
+ await this.applyCommandToSession(session, command);
207
+ const latencyMs = Date.now() - startTime;
208
+ // Update metrics
209
+ this.updateControlMetrics(latencyMs);
210
+ this.metrics.totalInjections++;
211
+ const result = {
212
+ success: true,
213
+ commandId: command.id,
214
+ agentId: targetAgentId,
215
+ level: targetLevel,
216
+ latencyMs
217
+ };
218
+ if (this.config.enableLogging) {
219
+ this.logger.info('Command injected', {
220
+ commandId: command.id,
221
+ commandType,
222
+ parentAgentId,
223
+ targetAgentId,
224
+ level: targetLevel,
225
+ latencyMs,
226
+ immediate
227
+ });
228
+ }
229
+ this.emit('command:injected', {
230
+ command,
231
+ result
232
+ });
233
+ return result;
234
+ } catch (error) {
235
+ const latencyMs = Date.now() - startTime;
236
+ const errorMessage = error instanceof Error ? error.message : String(error);
237
+ this.logger.error('Failed to inject command', {
238
+ parentAgentId,
239
+ targetAgentId,
240
+ commandType,
241
+ error: errorMessage
242
+ });
243
+ return {
244
+ success: false,
245
+ commandId: '',
246
+ agentId: targetAgentId,
247
+ level: this.getAgentLevel(targetAgentId),
248
+ latencyMs,
249
+ error: errorMessage
250
+ };
251
+ }
252
+ }
253
+ /**
254
+ * Resume agent from Level 0 parent
255
+ *
256
+ * Applies all queued commands and resumes agent execution.
257
+ *
258
+ * @param parentAgentId - Parent issuing the resume
259
+ * @param targetAgentId - Child agent to resume
260
+ * @param checkpointId - Optional checkpoint to resume from
261
+ * @returns Control operation result
262
+ */ async resumeChildAgent(parentAgentId, targetAgentId, checkpointId) {
263
+ const startTime = Date.now();
264
+ try {
265
+ const targetLevel = this.getAgentLevel(targetAgentId);
266
+ // Apply queued commands before resume
267
+ const queuedCommands = this.getQueuedCommands(targetAgentId);
268
+ if (queuedCommands.length > 0) {
269
+ const session = await this.queryController.getAgentSession(targetAgentId);
270
+ for (const command of queuedCommands){
271
+ await this.applyCommandToSession(session, command);
272
+ }
273
+ // Clear command queue
274
+ this.clearCommandQueue(targetAgentId);
275
+ if (this.config.enableLogging) {
276
+ this.logger.debug('Applied queued commands before resume', {
277
+ agentId: targetAgentId,
278
+ commandCount: queuedCommands.length
279
+ });
280
+ }
281
+ }
282
+ // Resume agent via QueryController
283
+ await this.queryController.resumeAgent(targetAgentId, checkpointId);
284
+ const latencyMs = Date.now() - startTime;
285
+ // Update metrics
286
+ this.updateControlMetrics(latencyMs);
287
+ this.metrics.totalResumes++;
288
+ const result = {
289
+ operation: 'resume',
290
+ success: true,
291
+ agentId: targetAgentId,
292
+ level: targetLevel,
293
+ latencyMs,
294
+ data: {
295
+ parentAgentId,
296
+ checkpointId,
297
+ appliedCommands: queuedCommands.length
298
+ }
299
+ };
300
+ if (this.config.enableLogging) {
301
+ this.logger.info('Agent resumed from parent', {
302
+ parentAgentId,
303
+ targetAgentId,
304
+ level: targetLevel,
305
+ latencyMs,
306
+ appliedCommands: queuedCommands.length
307
+ });
308
+ }
309
+ this.emit('agent:resumed', result);
310
+ return result;
311
+ } catch (error) {
312
+ const latencyMs = Date.now() - startTime;
313
+ const errorMessage = error instanceof Error ? error.message : String(error);
314
+ this.logger.error('Failed to resume child agent', {
315
+ parentAgentId,
316
+ targetAgentId,
317
+ error: errorMessage
318
+ });
319
+ return {
320
+ operation: 'resume',
321
+ success: false,
322
+ agentId: targetAgentId,
323
+ level: this.getAgentLevel(targetAgentId),
324
+ latencyMs,
325
+ error: errorMessage
326
+ };
327
+ }
328
+ }
329
+ /**
330
+ * Cascade control operation to all descendants
331
+ *
332
+ * Propagates pause/resume down the hierarchy tree.
333
+ *
334
+ * @param parentAgentId - Root parent issuing cascade
335
+ * @param operation - Operation to cascade
336
+ * @returns Array of control operation results
337
+ */ async cascadeControlOperation(parentAgentId, operation) {
338
+ const results = [];
339
+ if (!this.hierarchicalCoordinator) {
340
+ this.logger.warn('Cannot cascade without hierarchical coordinator');
341
+ return results;
342
+ }
343
+ const parentAgent = this.hierarchicalCoordinator.getAgentStatus(parentAgentId);
344
+ if (!parentAgent) {
345
+ this.logger.warn('Parent agent not found in hierarchy', {
346
+ parentAgentId
347
+ });
348
+ return results;
349
+ }
350
+ // Get all descendants (DFS traversal)
351
+ const descendants = await this.getAllDescendants(parentAgentId);
352
+ if (this.config.enableLogging) {
353
+ this.logger.info('Cascading control operation', {
354
+ parentAgentId,
355
+ operation,
356
+ descendantCount: descendants.length
357
+ });
358
+ }
359
+ // Apply operation to all descendants in parallel
360
+ const operations = descendants.map(async (descendantId)=>{
361
+ if (operation === 'pause') {
362
+ return await this.pauseChildAgent(parentAgentId, descendantId, `Cascaded from ${parentAgentId}`);
363
+ } else {
364
+ return await this.resumeChildAgent(parentAgentId, descendantId);
365
+ }
366
+ });
367
+ results.push(...await Promise.all(operations));
368
+ this.emit('control:cascaded', {
369
+ parentAgentId,
370
+ operation,
371
+ results
372
+ });
373
+ return results;
374
+ }
375
+ // ============================================================================
376
+ // Command Queue Management
377
+ // ============================================================================
378
+ /**
379
+ * Queue command for paused agent
380
+ */ queueCommand(agentId, command) {
381
+ let queue = this.commandQueues.get(agentId);
382
+ if (!queue) {
383
+ queue = [];
384
+ this.commandQueues.set(agentId, queue);
385
+ }
386
+ // Enforce max queue size
387
+ if (queue.length >= this.config.maxQueuedCommands) {
388
+ this.logger.warn('Command queue full, removing oldest command', {
389
+ agentId,
390
+ maxQueueSize: this.config.maxQueuedCommands
391
+ });
392
+ queue.shift();
393
+ }
394
+ queue.push(command);
395
+ }
396
+ /**
397
+ * Get queued commands for agent
398
+ */ getQueuedCommands(agentId) {
399
+ return this.commandQueues.get(agentId) ?? [];
400
+ }
401
+ /**
402
+ * Clear command queue for agent
403
+ */ clearCommandQueue(agentId) {
404
+ this.commandQueues.delete(agentId);
405
+ }
406
+ /**
407
+ * Apply command to agent session
408
+ */ async applyCommandToSession(session, command) {
409
+ // Store command in session metadata for agent to process
410
+ if (!session.metadata.injectedCommands) {
411
+ session.metadata.injectedCommands = [];
412
+ }
413
+ session.metadata.injectedCommands.push({
414
+ commandId: command.id,
415
+ type: command.type,
416
+ payload: command.payload,
417
+ issuedBy: command.issuedBy,
418
+ timestamp: command.timestamp
419
+ });
420
+ // Apply command effects based on type
421
+ switch(command.type){
422
+ case "state_update":
423
+ if (command.payload.state) {
424
+ session.state = command.payload.state;
425
+ }
426
+ break;
427
+ case "priority_update":
428
+ if (command.payload.priority !== undefined) {
429
+ session.priority = command.payload.priority;
430
+ }
431
+ break;
432
+ case "metadata_update":
433
+ if (command.payload.metadata) {
434
+ session.metadata = {
435
+ ...session.metadata,
436
+ ...command.payload.metadata
437
+ };
438
+ }
439
+ break;
440
+ case "task_update":
441
+ case "custom":
442
+ break;
443
+ default:
444
+ this.logger.warn('Unknown command type', {
445
+ type: command.type
446
+ });
447
+ }
448
+ }
449
+ // ============================================================================
450
+ // Hierarchy Traversal Helpers
451
+ // ============================================================================
452
+ /**
453
+ * Get all descendants of an agent (DFS)
454
+ */ async getAllDescendants(agentId) {
455
+ const descendants = [];
456
+ if (!this.hierarchicalCoordinator) {
457
+ return descendants;
458
+ }
459
+ const agent = this.hierarchicalCoordinator.getAgentStatus(agentId);
460
+ if (!agent) {
461
+ return descendants;
462
+ }
463
+ // DFS traversal
464
+ const stack = [
465
+ ...agent.childIds
466
+ ];
467
+ while(stack.length > 0){
468
+ const childId = stack.pop();
469
+ descendants.push(childId);
470
+ const child = this.hierarchicalCoordinator.getAgentStatus(childId);
471
+ if (child && child.childIds.length > 0) {
472
+ stack.push(...child.childIds);
473
+ }
474
+ }
475
+ return descendants;
476
+ }
477
+ // ============================================================================
478
+ // Metrics and Monitoring
479
+ // ============================================================================
480
+ /**
481
+ * Update control operation metrics
482
+ */ updateControlMetrics(latencyMs) {
483
+ const totalOps = this.metrics.totalPauses + this.metrics.totalInjections + this.metrics.totalResumes;
484
+ this.metrics.averageControlLatencyMs = (this.metrics.averageControlLatencyMs * totalOps + latencyMs) / (totalOps + 1);
485
+ this.metrics.maxControlLatencyMs = Math.max(this.metrics.maxControlLatencyMs, latencyMs);
486
+ // Warn if exceeding latency target
487
+ if (latencyMs > this.config.maxControlLatencyMs) {
488
+ this.logger.warn('Control operation exceeded latency target', {
489
+ latencyMs,
490
+ targetMs: this.config.maxControlLatencyMs
491
+ });
492
+ }
493
+ }
494
+ /**
495
+ * Get control operation metrics
496
+ */ getMetrics() {
497
+ return {
498
+ ...this.metrics,
499
+ latencyTargetMs: this.config.maxControlLatencyMs,
500
+ withinTarget: this.metrics.averageControlLatencyMs <= this.config.maxControlLatencyMs
501
+ };
502
+ }
503
+ /**
504
+ * Get queued commands count for agent
505
+ */ getQueuedCommandsCount(agentId) {
506
+ return this.commandQueues.get(agentId)?.length ?? 0;
507
+ }
508
+ /**
509
+ * Cleanup - clear all queues and caches
510
+ */ async cleanup() {
511
+ this.commandQueues.clear();
512
+ this.agentLevelCache.clear();
513
+ this.removeAllListeners();
514
+ this.logger.info('MultiLevelController cleaned up');
515
+ }
516
+ // ============================================================================
517
+ // Private Helpers
518
+ // ============================================================================
519
+ initializeMetrics() {
520
+ return {
521
+ totalPauses: 0,
522
+ totalInjections: 0,
523
+ totalResumes: 0,
524
+ averageControlLatencyMs: 0,
525
+ maxControlLatencyMs: 0
526
+ };
527
+ }
528
+ }
529
+ // ============================================================================
530
+ // Factory Functions
531
+ // ============================================================================
532
+ /**
533
+ * Create multi-level controller with QueryController
534
+ */ export function createMultiLevelController(queryController, config) {
535
+ return new MultiLevelController(queryController, config);
536
+ }
537
+ /**
538
+ * Create multi-level controller with hierarchical coordinator integration
539
+ */ export function createMultiLevelControllerWithHierarchy(queryController, hierarchicalCoordinator, config) {
540
+ const controller = new MultiLevelController(queryController, config);
541
+ controller.registerHierarchicalCoordinator(hierarchicalCoordinator);
542
+ return controller;
543
+ } // Types are already exported inline above - no duplicate export needed
544
+
545
+ //# sourceMappingURL=multi-level-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/sdk/multi-level-control.ts"],"names":["EventEmitter","Logger","generateId","InjectedCommandType","MultiLevelController","logger","config","queryController","hierarchicalCoordinator","commandQueues","agentLevelCache","metrics","level","format","destination","maxControlLatencyMs","enableCommandQueue","maxQueuedCommands","enableLogging","Map","initializeMetrics","info","registerHierarchicalCoordinator","coordinator","getHierarchyStructure","hierarchy","agent","agents","set","id","totalAgents","length","hierarchyDepth","depth","updateAgentLevel","agentId","getAgentLevel","cachedLevel","get","undefined","agentStatus","getAgentStatus","pauseChildAgent","parentAgentId","targetAgentId","reason","startTime","Date","now","targetLevel","pauseAgent","latencyMs","updateControlMetrics","totalPauses","result","operation","success","data","emit","error","errorMessage","Error","message","String","injectCommand","commandType","payload","immediate","session","getAgentSession","isPaused","command","type","issuedBy","timestamp","queueCommand","applyCommandToSession","totalInjections","commandId","resumeChildAgent","checkpointId","queuedCommands","getQueuedCommands","clearCommandQueue","debug","commandCount","resumeAgent","totalResumes","appliedCommands","cascadeControlOperation","results","warn","parentAgent","descendants","getAllDescendants","descendantCount","operations","map","descendantId","push","Promise","all","queue","maxQueueSize","shift","delete","metadata","injectedCommands","state","priority","stack","childIds","childId","pop","child","totalOps","averageControlLatencyMs","Math","max","targetMs","getMetrics","latencyTargetMs","withinTarget","getQueuedCommandsCount","cleanup","clear","removeAllListeners","createMultiLevelController","createMultiLevelControllerWithHierarchy","controller"],"mappings":"AAAA;;;;;;;;;;CAUC,GAED,SAASA,YAAY,QAA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