claude-flow-novice 1.6.4 → 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.
- package/.claude/commands/parse-epic.js +180 -0
- package/.claude/settings.local.json +2 -1
- package/.claude-flow-novice/dist/mcp/mcp-server-novice.js +37 -2
- package/.claude-flow-novice/dist/mcp/transports/base.js +5 -0
- package/.claude-flow-novice/dist/mcp/transports/base.js.map +1 -0
- package/.claude-flow-novice/dist/mcp/transports/http.js +414 -0
- package/.claude-flow-novice/dist/mcp/transports/http.js.map +1 -0
- package/.claude-flow-novice/dist/mcp/transports/stdio.js +217 -0
- package/.claude-flow-novice/dist/mcp/transports/stdio.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/commands/parse-epic.js +129 -0
- package/.claude-flow-novice/dist/src/cli/commands/parse-epic.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/index.js +3 -0
- package/.claude-flow-novice/dist/src/cli/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/utils/epic-parser.js +266 -0
- package/.claude-flow-novice/dist/src/cli/utils/epic-parser.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/message-bus.js +105 -2
- package/.claude-flow-novice/dist/src/communication/message-bus.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +1 -1
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/artifact-cache-optimizer.js +632 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/artifact-cache-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/index.js +11 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/checkpoints/checkpoint-compressor.js +318 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/checkpoints/checkpoint-compressor.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/completion-detector.js +234 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/completion-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/hierarchical-detector.js +347 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/hierarchical-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/index.js +13 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/lamport-clock.js +173 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/lamport-clock.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/mesh-detector.js +526 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/mesh-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/sdk-completion-detector.js +443 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/sdk-completion-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/swarm-shutdown.js +366 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/swarm-shutdown.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinator-factory.js +287 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinator-factory.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.example.js +364 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.js +492 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/hierarchical-coordinator.js +786 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/hierarchical-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/parent-child-manager.js +342 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/parent-child-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/swarm-coordinator-v2.js +601 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/agent-state.js +9 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/agent-state.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dead-letter-queue.js +413 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dead-letter-queue.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-graph.js +471 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-graph.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-node.js +379 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-node.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-resolver.js +335 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-resolver.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/help-request-metrics.js +211 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/help-request-metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/index.js +33 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-broker.js +920 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-broker.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-router.js +385 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-router.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message.js +138 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/resource-manager-safe.js +478 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/resource-manager-safe.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine-config.js +358 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine-config.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine.js +588 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-transition.js +153 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-transition.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/task-scheduler.js +360 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/task-scheduler.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/topic-manager.js +337 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/topic-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/deadlock-detector.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/deadlock-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/index.js +9 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/resource-manager.js +669 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/resource-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/artifact-storage.js +451 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/artifact-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/cycle-detector.js +271 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/cycle-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-graph.js +335 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-graph.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-manager.js +439 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-request.js +92 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/index.js +21 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/topological-sort.js +223 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/topological-sort.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-coordinator.js +436 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-matcher.js +278 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-matcher.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request-handler.js +317 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request.js +273 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/index.js +15 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/waiting-agent-pool.js +512 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/waiting-agent-pool.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/index.js +67 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/help-deadlock-integration.js +557 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/help-deadlock-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.example.js +212 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.js +552 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/state-machine-integration.js +635 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/state-machine-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/IArtifactStorage.js +28 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/IArtifactStorage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ICoordinator.js +9 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ICoordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ISessionStore.js +25 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ISessionStore.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/artifact-adapter.js +308 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/artifact-adapter.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/completion-storage.js +439 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/completion-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-graph-storage.js +540 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-graph-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-storage.js +367 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/message-storage.js +518 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/message-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/state-storage.js +377 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/state-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channel.js +371 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/dependency-channel.js +355 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/dependency-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/help-channel.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/help-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/state-channel.js +295 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/state-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/task-channel.js +411 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/task-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-bus.js +387 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-bus.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-persistence.js +589 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-persistence.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-router.js +444 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-router.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/artifact-storage.js +560 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/artifact-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/background-orchestrator.js +335 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/background-orchestrator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/bash-output-monitor.js +104 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/bash-output-monitor.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/checkpoint-manager.js +847 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/checkpoint-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/help-coordinator.js +470 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/hierarchical-background-integration.js +450 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/hierarchical-background-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/index.js +13 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/message-bus-integration.js +625 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/message-bus-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/multi-level-control.js +545 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/multi-level-control.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-controller.js +740 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-controller.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-message-integration.js +415 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-message-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/session-pool-optimizer.js +615 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/session-pool-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-machine-integration.js +547 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-machine-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-sdk-integration.js +342 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-sdk-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/security/payload-validator.js +259 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/security/payload-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/framework-registry.js +273 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/framework-registry.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/index.js +8 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-config-manager.js +310 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-config-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-validator.js +218 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/types/sdk.js +9 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/types/sdk.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/index.js +6 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/priority-queue.js +145 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/priority-queue.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/sdk-helpers.js +122 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/sdk-helpers.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/config-translator.js +17 -43
- package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +34 -76
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/shared/core/agent-state.js +172 -0
- package/.claude-flow-novice/dist/src/coordination/shared/core/agent-state.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/core/index.js +7 -0
- package/.claude-flow-novice/dist/src/coordination/shared/core/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/index.js +19 -0
- package/.claude-flow-novice/dist/src/coordination/shared/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js +24 -0
- package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js +7 -0
- package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js +920 -0
- package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/message.js +138 -0
- package/.claude-flow-novice/dist/src/coordination/shared/message.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js +259 -0
- package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js +17 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js +19 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js +357 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js +679 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/types/index.js +7 -0
- package/.claude-flow-novice/dist/src/coordination/shared/types/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js +10 -0
- package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js.map +1 -0
- package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js +52 -2
- package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js.map +1 -1
- package/.claude-flow-novice/dist/src/mcp/mcp-server-novice.js +37 -2
- package/.claude-flow-novice/dist/src/mcp/session-manager.js +3 -1
- package/.claude-flow-novice/dist/src/mcp/session-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/provider-manager.js +36 -3
- package/.claude-flow-novice/dist/src/providers/provider-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js +65 -41
- package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js.map +1 -1
- package/.claude-flow-novice/dist/src/web/api/server.js +1 -1
- package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -1
- package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js +30 -0
- package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js.map +1 -1
- package/.claude-flow-novice/metrics.db-shm +0 -0
- package/.claude-flow-novice/metrics.db-wal +0 -0
- package/package.json +2 -2
- package/scripts/monitoring/alert-monitor.sh +220 -0
- package/scripts/monitoring/view-alerts.sh +307 -0
- package/scripts/test-zai-api.cjs +2 -2
- package/src/slash-commands/parse-epic.js +1 -1
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Coordination V2 - Cascading Shutdown Coordinator
|
|
3
|
+
*
|
|
4
|
+
* Hierarchical shutdown coordination with top-down notification and bottom-up completion.
|
|
5
|
+
* Implements graceful termination with resource cleanup at all levels.
|
|
6
|
+
*
|
|
7
|
+
* Performance targets:
|
|
8
|
+
* - Complete hierarchy shutdown: <1s for 20 agents
|
|
9
|
+
* - Top-down notification: <100ms per level
|
|
10
|
+
* - Bottom-up aggregation: <200ms total
|
|
11
|
+
* - Resource cleanup: 100% coverage
|
|
12
|
+
*
|
|
13
|
+
* Features:
|
|
14
|
+
* - Top-down shutdown notification (root → leaves)
|
|
15
|
+
* - Bottom-up completion aggregation (leaves → root)
|
|
16
|
+
* - Graceful resource cleanup (connections, files, processes)
|
|
17
|
+
* - Integration with Phase 4 hierarchical completion detection
|
|
18
|
+
* - Emergency shutdown support
|
|
19
|
+
* - Shutdown checkpoint creation
|
|
20
|
+
*
|
|
21
|
+
* @module coordination/v2/coordinators/cascading-shutdown
|
|
22
|
+
*/ import { EventEmitter } from 'events';
|
|
23
|
+
/**
|
|
24
|
+
* CascadingShutdown - Top-down shutdown with bottom-up completion
|
|
25
|
+
*
|
|
26
|
+
* Implements hierarchical shutdown coordination:
|
|
27
|
+
* 1. Top-down: Notify all levels from root → leaves
|
|
28
|
+
* 2. Parallel: Each level executes shutdown simultaneously
|
|
29
|
+
* 3. Bottom-up: Aggregate completion from leaves → root
|
|
30
|
+
* 4. Cleanup: Resource cleanup at each level
|
|
31
|
+
* 5. Checkpoint: Optional checkpoint creation
|
|
32
|
+
*
|
|
33
|
+
* Shutdown flow:
|
|
34
|
+
* - Level 0 (root) initiates shutdown
|
|
35
|
+
* - Notify Level 1 agents → Notify Level 2 agents → ... → Notify Level N agents
|
|
36
|
+
* - Level N agents complete → Level N-1 aggregates → ... → Level 0 completes
|
|
37
|
+
* - Children complete before parents (bottom-up guarantee)
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const cascadingShutdown = new CascadingShutdown(
|
|
42
|
+
* hierarchicalDetector,
|
|
43
|
+
* {
|
|
44
|
+
* maxShutdownTimeMs: 10000,
|
|
45
|
+
* createShutdownCheckpoints: true,
|
|
46
|
+
* enableResourceCleanup: true
|
|
47
|
+
* }
|
|
48
|
+
* );
|
|
49
|
+
*
|
|
50
|
+
* // Register hierarchy
|
|
51
|
+
* cascadingShutdown.registerHierarchy('swarm-1', 'coordinator-0', [
|
|
52
|
+
* { agentId: 'coordinator-0', level: 0, childIds: ['agent-1', 'agent-2'] },
|
|
53
|
+
* { agentId: 'agent-1', level: 1, parentId: 'coordinator-0' },
|
|
54
|
+
* { agentId: 'agent-2', level: 1, parentId: 'coordinator-0' }
|
|
55
|
+
* ]);
|
|
56
|
+
*
|
|
57
|
+
* // Initiate shutdown from root
|
|
58
|
+
* const result = await cascadingShutdown.initiateShutdown('coordinator-0', 'Task completed');
|
|
59
|
+
*
|
|
60
|
+
* console.log(`Shutdown ${result.totalAgents} agents in ${result.totalLatencyMs}ms`);
|
|
61
|
+
* ```
|
|
62
|
+
*/ export class CascadingShutdown extends EventEmitter {
|
|
63
|
+
hierarchies = new Map();
|
|
64
|
+
hierarchicalDetector;
|
|
65
|
+
config;
|
|
66
|
+
shutdownInProgress = new Set();
|
|
67
|
+
resourceCleanupHandlers = new Map();
|
|
68
|
+
constructor(hierarchicalDetector, config){
|
|
69
|
+
super();
|
|
70
|
+
this.hierarchicalDetector = hierarchicalDetector;
|
|
71
|
+
this.config = {
|
|
72
|
+
maxShutdownTimeMs: 10000,
|
|
73
|
+
createShutdownCheckpoints: true,
|
|
74
|
+
enableResourceCleanup: true,
|
|
75
|
+
notificationTimeoutMs: 100,
|
|
76
|
+
completionTimeoutMs: 200,
|
|
77
|
+
enableEmergencyMode: true,
|
|
78
|
+
agentGracePeriodMs: 500,
|
|
79
|
+
...config
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Register hierarchy for shutdown coordination
|
|
84
|
+
*
|
|
85
|
+
* @param swarmId - Swarm identifier
|
|
86
|
+
* @param rootCoordinatorId - Root coordinator agent ID (Level 0)
|
|
87
|
+
* @param nodes - Hierarchy node definitions
|
|
88
|
+
*/ registerHierarchy(swarmId, rootCoordinatorId, nodes) {
|
|
89
|
+
const hierarchyNodes = new Map();
|
|
90
|
+
// Build hierarchy nodes
|
|
91
|
+
for (const node of nodes){
|
|
92
|
+
hierarchyNodes.set(node.agentId, {
|
|
93
|
+
agentId: node.agentId,
|
|
94
|
+
level: node.level,
|
|
95
|
+
parentId: node.parentId,
|
|
96
|
+
childIds: node.childIds || [],
|
|
97
|
+
shutdownStatus: 'pending',
|
|
98
|
+
resources: node.resources || [],
|
|
99
|
+
sessionId: node.sessionId
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// Ensure root coordinator exists
|
|
103
|
+
if (!hierarchyNodes.has(rootCoordinatorId)) {
|
|
104
|
+
hierarchyNodes.set(rootCoordinatorId, {
|
|
105
|
+
agentId: rootCoordinatorId,
|
|
106
|
+
level: 0,
|
|
107
|
+
childIds: [],
|
|
108
|
+
shutdownStatus: 'pending',
|
|
109
|
+
resources: []
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
// Build parent-child relationships if not provided
|
|
113
|
+
const nodesArray2 = Array.from(hierarchyNodes.values());
|
|
114
|
+
for (const node of nodesArray2){
|
|
115
|
+
if (node.parentId && hierarchyNodes.has(node.parentId)) {
|
|
116
|
+
const parent = hierarchyNodes.get(node.parentId);
|
|
117
|
+
if (!parent.childIds.includes(node.agentId)) {
|
|
118
|
+
parent.childIds.push(node.agentId);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
this.hierarchies.set(swarmId, hierarchyNodes);
|
|
123
|
+
const nodesArray = Array.from(hierarchyNodes.values());
|
|
124
|
+
this.emit('hierarchy:registered', {
|
|
125
|
+
swarmId,
|
|
126
|
+
rootCoordinatorId,
|
|
127
|
+
totalAgents: hierarchyNodes.size,
|
|
128
|
+
maxDepth: Math.max(...nodesArray.map((n)=>n.level))
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Register resource cleanup handler for specific resource type
|
|
133
|
+
*
|
|
134
|
+
* @param resourceType - Type of resource to handle
|
|
135
|
+
* @param handler - Cleanup handler function
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* cascadingShutdown.registerResourceCleanup('connection', async (resource) => {
|
|
140
|
+
* await closeConnection(resource.id);
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*/ registerResourceCleanup(resourceType, handler) {
|
|
144
|
+
this.resourceCleanupHandlers.set(resourceType, handler);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Initiate cascading shutdown from root coordinator
|
|
148
|
+
*
|
|
149
|
+
* Performance target: <1s for 20-agent hierarchy
|
|
150
|
+
*
|
|
151
|
+
* Process:
|
|
152
|
+
* 1. Top-down notification (root → leaves)
|
|
153
|
+
* 2. Parallel shutdown execution at each level
|
|
154
|
+
* 3. Bottom-up completion aggregation (leaves → root)
|
|
155
|
+
* 4. Resource cleanup at all levels
|
|
156
|
+
*
|
|
157
|
+
* @param rootCoordinatorId - Root coordinator to initiate from
|
|
158
|
+
* @param reason - Shutdown reason
|
|
159
|
+
* @param swarmId - Optional swarm ID (auto-detect if omitted)
|
|
160
|
+
* @returns Promise resolving to CascadingShutdownResult
|
|
161
|
+
*/ async initiateShutdown(rootCoordinatorId, reason = 'Cascading shutdown initiated', swarmId) {
|
|
162
|
+
const startTime = Date.now();
|
|
163
|
+
// Find swarm containing root coordinator
|
|
164
|
+
const targetSwarmId = swarmId || this.findSwarmByAgent(rootCoordinatorId);
|
|
165
|
+
if (!targetSwarmId) {
|
|
166
|
+
throw new Error(`Root coordinator ${rootCoordinatorId} not found in any hierarchy`);
|
|
167
|
+
}
|
|
168
|
+
const hierarchy = this.hierarchies.get(targetSwarmId);
|
|
169
|
+
if (!hierarchy) {
|
|
170
|
+
throw new Error(`Hierarchy not found for swarm ${targetSwarmId}`);
|
|
171
|
+
}
|
|
172
|
+
const rootNode = hierarchy.get(rootCoordinatorId);
|
|
173
|
+
if (!rootNode) {
|
|
174
|
+
throw new Error(`Root coordinator ${rootCoordinatorId} not found in hierarchy`);
|
|
175
|
+
}
|
|
176
|
+
// Check if shutdown already in progress
|
|
177
|
+
if (this.shutdownInProgress.has(targetSwarmId)) {
|
|
178
|
+
throw new Error(`Shutdown already in progress for swarm ${targetSwarmId}`);
|
|
179
|
+
}
|
|
180
|
+
this.shutdownInProgress.add(targetSwarmId);
|
|
181
|
+
const hierarchyArray = Array.from(hierarchy.values());
|
|
182
|
+
const shutdownResult = {
|
|
183
|
+
rootCoordinatorId,
|
|
184
|
+
success: true,
|
|
185
|
+
totalAgents: hierarchy.size,
|
|
186
|
+
successfulShutdowns: 0,
|
|
187
|
+
failedShutdowns: 0,
|
|
188
|
+
maxDepth: Math.max(...hierarchyArray.map((n)=>n.level)),
|
|
189
|
+
totalLatencyMs: 0,
|
|
190
|
+
notificationLatencyMs: 0,
|
|
191
|
+
aggregationLatencyMs: 0,
|
|
192
|
+
totalResourcesCleaned: 0,
|
|
193
|
+
agentResults: [],
|
|
194
|
+
shutdownAt: new Date(),
|
|
195
|
+
reason
|
|
196
|
+
};
|
|
197
|
+
this.emit('shutdown:started', {
|
|
198
|
+
rootCoordinatorId,
|
|
199
|
+
swarmId: targetSwarmId,
|
|
200
|
+
totalAgents: hierarchy.size,
|
|
201
|
+
reason
|
|
202
|
+
});
|
|
203
|
+
try {
|
|
204
|
+
// Step 1: Top-down shutdown notification (root → leaves)
|
|
205
|
+
const notificationStartTime = Date.now();
|
|
206
|
+
await this.notifyShutdownTopDown(hierarchy, rootCoordinatorId);
|
|
207
|
+
shutdownResult.notificationLatencyMs = Date.now() - notificationStartTime;
|
|
208
|
+
// Step 2: Bottom-up completion aggregation (leaves → root)
|
|
209
|
+
const aggregationStartTime = Date.now();
|
|
210
|
+
shutdownResult.agentResults = await this.aggregateCompletionBottomUp(hierarchy, rootCoordinatorId, reason);
|
|
211
|
+
shutdownResult.aggregationLatencyMs = Date.now() - aggregationStartTime;
|
|
212
|
+
// Calculate metrics
|
|
213
|
+
shutdownResult.successfulShutdowns = shutdownResult.agentResults.filter((r)=>r.success).length;
|
|
214
|
+
shutdownResult.failedShutdowns = shutdownResult.agentResults.filter((r)=>!r.success).length;
|
|
215
|
+
shutdownResult.totalResourcesCleaned = shutdownResult.agentResults.reduce((sum, r)=>sum + r.resourcesCleaned, 0);
|
|
216
|
+
shutdownResult.success = shutdownResult.failedShutdowns === 0;
|
|
217
|
+
shutdownResult.totalLatencyMs = Date.now() - startTime;
|
|
218
|
+
// Performance warning if exceeds target
|
|
219
|
+
if (shutdownResult.totalLatencyMs > 1000 && hierarchy.size <= 20) {
|
|
220
|
+
console.warn(`[CascadingShutdown] Shutdown latency ${shutdownResult.totalLatencyMs}ms exceeds 1s target for ${hierarchy.size} agents`);
|
|
221
|
+
}
|
|
222
|
+
this.emit('shutdown:completed', shutdownResult);
|
|
223
|
+
return shutdownResult;
|
|
224
|
+
} catch (error) {
|
|
225
|
+
shutdownResult.success = false;
|
|
226
|
+
shutdownResult.totalLatencyMs = Date.now() - startTime;
|
|
227
|
+
this.emit('shutdown:failed', {
|
|
228
|
+
error: error instanceof Error ? error.message : String(error),
|
|
229
|
+
result: shutdownResult
|
|
230
|
+
});
|
|
231
|
+
throw error;
|
|
232
|
+
} finally{
|
|
233
|
+
this.shutdownInProgress.delete(targetSwarmId);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Emergency shutdown - immediate termination without checkpoints
|
|
238
|
+
*
|
|
239
|
+
* @param rootCoordinatorId - Root coordinator to shutdown
|
|
240
|
+
* @param reason - Emergency reason
|
|
241
|
+
* @returns Promise resolving when emergency shutdown complete
|
|
242
|
+
*/ async emergencyShutdown(rootCoordinatorId, reason) {
|
|
243
|
+
this.emit('shutdown:emergency', {
|
|
244
|
+
rootCoordinatorId,
|
|
245
|
+
reason
|
|
246
|
+
});
|
|
247
|
+
// Disable checkpoints and resource cleanup for speed
|
|
248
|
+
const originalCheckpointConfig = this.config.createShutdownCheckpoints;
|
|
249
|
+
const originalCleanupConfig = this.config.enableResourceCleanup;
|
|
250
|
+
this.config.createShutdownCheckpoints = false;
|
|
251
|
+
this.config.enableResourceCleanup = false;
|
|
252
|
+
try {
|
|
253
|
+
return await this.initiateShutdown(rootCoordinatorId, `EMERGENCY: ${reason}`);
|
|
254
|
+
} finally{
|
|
255
|
+
this.config.createShutdownCheckpoints = originalCheckpointConfig;
|
|
256
|
+
this.config.enableResourceCleanup = originalCleanupConfig;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Top-down shutdown notification (root → leaves)
|
|
261
|
+
*
|
|
262
|
+
* Notifies all agents in hierarchy using BFS level-by-level traversal.
|
|
263
|
+
* Target: <100ms per level notification.
|
|
264
|
+
*
|
|
265
|
+
* @param hierarchy - Hierarchy nodes map
|
|
266
|
+
* @param rootId - Root agent to start from
|
|
267
|
+
*/ async notifyShutdownTopDown(hierarchy, rootId) {
|
|
268
|
+
const queue = [
|
|
269
|
+
rootId
|
|
270
|
+
];
|
|
271
|
+
const visited = new Set();
|
|
272
|
+
while(queue.length > 0){
|
|
273
|
+
const levelSize = queue.length;
|
|
274
|
+
const levelStartTime = Date.now();
|
|
275
|
+
const notificationPromises = [];
|
|
276
|
+
// Process entire level in parallel
|
|
277
|
+
for(let i = 0; i < levelSize; i++){
|
|
278
|
+
const agentId = queue.shift();
|
|
279
|
+
if (visited.has(agentId)) continue;
|
|
280
|
+
visited.add(agentId);
|
|
281
|
+
const node = hierarchy.get(agentId);
|
|
282
|
+
if (!node) continue;
|
|
283
|
+
// Notify this agent
|
|
284
|
+
notificationPromises.push(this.notifyAgent(node));
|
|
285
|
+
// Add children to queue for next level
|
|
286
|
+
queue.push(...node.childIds);
|
|
287
|
+
}
|
|
288
|
+
// Wait for level notifications to complete
|
|
289
|
+
await Promise.all(notificationPromises);
|
|
290
|
+
const levelLatency = Date.now() - levelStartTime;
|
|
291
|
+
if (levelLatency > this.config.notificationTimeoutMs) {
|
|
292
|
+
console.warn(`[CascadingShutdown] Level notification latency ${levelLatency}ms exceeds ${this.config.notificationTimeoutMs}ms target`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Notify single agent of shutdown
|
|
298
|
+
*
|
|
299
|
+
* @param node - Node to notify
|
|
300
|
+
*/ async notifyAgent(node) {
|
|
301
|
+
node.shutdownStatus = 'notified';
|
|
302
|
+
node.notifiedAt = Date.now();
|
|
303
|
+
this.emit('agent:notified', {
|
|
304
|
+
agentId: node.agentId,
|
|
305
|
+
level: node.level,
|
|
306
|
+
timestamp: node.notifiedAt
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Bottom-up completion aggregation (leaves → root)
|
|
311
|
+
*
|
|
312
|
+
* Aggregates completion from leaf nodes up to root.
|
|
313
|
+
* Children complete before parents (guaranteed bottom-up order).
|
|
314
|
+
*
|
|
315
|
+
* Target: <200ms total aggregation time.
|
|
316
|
+
*
|
|
317
|
+
* @param hierarchy - Hierarchy nodes map
|
|
318
|
+
* @param rootId - Root agent to aggregate to
|
|
319
|
+
* @param reason - Shutdown reason
|
|
320
|
+
* @returns Array of AgentShutdownResult
|
|
321
|
+
*/ async aggregateCompletionBottomUp(hierarchy, rootId, reason) {
|
|
322
|
+
const results = [];
|
|
323
|
+
// DFS post-order traversal (children before parent)
|
|
324
|
+
const processNode = async (agentId)=>{
|
|
325
|
+
const node = hierarchy.get(agentId);
|
|
326
|
+
if (!node) return;
|
|
327
|
+
// First, process all children (recursive)
|
|
328
|
+
await Promise.all(node.childIds.map((childId)=>processNode(childId)));
|
|
329
|
+
// Then, shutdown this node (after children complete)
|
|
330
|
+
const result = await this.shutdownAgent(node, reason);
|
|
331
|
+
results.push(result);
|
|
332
|
+
};
|
|
333
|
+
await processNode(rootId);
|
|
334
|
+
return results;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Shutdown single agent with resource cleanup
|
|
338
|
+
*
|
|
339
|
+
* @param node - Node to shutdown
|
|
340
|
+
* @param reason - Shutdown reason
|
|
341
|
+
* @returns AgentShutdownResult
|
|
342
|
+
*/ async shutdownAgent(node, reason) {
|
|
343
|
+
const notificationLatency = node.notifiedAt ? Date.now() - node.notifiedAt : 0;
|
|
344
|
+
const startTime = Date.now();
|
|
345
|
+
const result = {
|
|
346
|
+
agentId: node.agentId,
|
|
347
|
+
level: node.level,
|
|
348
|
+
success: false,
|
|
349
|
+
notificationLatencyMs: notificationLatency,
|
|
350
|
+
completionLatencyMs: 0,
|
|
351
|
+
resourcesCleaned: 0,
|
|
352
|
+
resourcesFailed: 0
|
|
353
|
+
};
|
|
354
|
+
try {
|
|
355
|
+
node.shutdownStatus = 'completing';
|
|
356
|
+
// Step 1: Create shutdown checkpoint if enabled
|
|
357
|
+
if (this.config.createShutdownCheckpoints) {
|
|
358
|
+
// Checkpoint creation would integrate with Phase 4 checkpoint manager
|
|
359
|
+
// For now, we track the intention
|
|
360
|
+
node.checkpointId = `shutdown-${node.agentId}-${Date.now()}`;
|
|
361
|
+
result.checkpointId = node.checkpointId;
|
|
362
|
+
}
|
|
363
|
+
// Step 2: Resource cleanup
|
|
364
|
+
if (this.config.enableResourceCleanup && node.resources.length > 0) {
|
|
365
|
+
const cleanupResults = await this.cleanupResources(node);
|
|
366
|
+
result.resourcesCleaned = cleanupResults.filter((r)=>r.cleaned).length;
|
|
367
|
+
result.resourcesFailed = cleanupResults.filter((r)=>!r.cleaned).length;
|
|
368
|
+
}
|
|
369
|
+
// Step 3: Mark as completed
|
|
370
|
+
node.shutdownStatus = 'completed';
|
|
371
|
+
node.completedAt = Date.now();
|
|
372
|
+
result.success = true;
|
|
373
|
+
result.completionLatencyMs = Date.now() - startTime;
|
|
374
|
+
this.emit('agent:shutdown', result);
|
|
375
|
+
} catch (error) {
|
|
376
|
+
result.success = false;
|
|
377
|
+
result.error = error instanceof Error ? error.message : String(error);
|
|
378
|
+
result.completionLatencyMs = Date.now() - startTime;
|
|
379
|
+
this.emit('agent:shutdown-failed', result);
|
|
380
|
+
}
|
|
381
|
+
return result;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Cleanup resources for agent
|
|
385
|
+
*
|
|
386
|
+
* @param node - Node with resources to cleanup
|
|
387
|
+
* @returns Array of cleaned ResourceDescriptor
|
|
388
|
+
*/ async cleanupResources(node) {
|
|
389
|
+
const cleanupPromises = node.resources.map(async (resource)=>{
|
|
390
|
+
try {
|
|
391
|
+
const handler = this.resourceCleanupHandlers.get(resource.type);
|
|
392
|
+
if (handler) {
|
|
393
|
+
await handler(resource);
|
|
394
|
+
}
|
|
395
|
+
resource.cleaned = true;
|
|
396
|
+
this.emit('resource:cleaned', {
|
|
397
|
+
agentId: node.agentId,
|
|
398
|
+
resourceType: resource.type,
|
|
399
|
+
resourceId: resource.id
|
|
400
|
+
});
|
|
401
|
+
} catch (error) {
|
|
402
|
+
resource.cleaned = false;
|
|
403
|
+
resource.error = error instanceof Error ? error.message : String(error);
|
|
404
|
+
this.emit('resource:cleanup-failed', {
|
|
405
|
+
agentId: node.agentId,
|
|
406
|
+
resourceType: resource.type,
|
|
407
|
+
resourceId: resource.id,
|
|
408
|
+
error: resource.error
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
return resource;
|
|
412
|
+
});
|
|
413
|
+
return Promise.all(cleanupPromises);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Find swarm containing specific agent
|
|
417
|
+
*
|
|
418
|
+
* @param agentId - Agent to search for
|
|
419
|
+
* @returns Swarm ID or undefined if not found
|
|
420
|
+
*/ findSwarmByAgent(agentId) {
|
|
421
|
+
const entriesArray = Array.from(this.hierarchies.entries());
|
|
422
|
+
for (const [swarmId, hierarchy] of entriesArray){
|
|
423
|
+
if (hierarchy.has(agentId)) {
|
|
424
|
+
return swarmId;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return undefined;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Check if shutdown is in progress for swarm
|
|
431
|
+
*
|
|
432
|
+
* @param swarmId - Swarm to check
|
|
433
|
+
* @returns True if shutdown in progress
|
|
434
|
+
*/ isShutdownInProgress(swarmId) {
|
|
435
|
+
return this.shutdownInProgress.has(swarmId);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Get shutdown status for agent
|
|
439
|
+
*
|
|
440
|
+
* @param agentId - Agent to query
|
|
441
|
+
* @returns Shutdown status or undefined if not found
|
|
442
|
+
*/ getShutdownStatus(agentId) {
|
|
443
|
+
const hierarchiesArray = Array.from(this.hierarchies.values());
|
|
444
|
+
for (const hierarchy of hierarchiesArray){
|
|
445
|
+
const node = hierarchy.get(agentId);
|
|
446
|
+
if (node) {
|
|
447
|
+
return node.shutdownStatus;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return undefined;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Get shutdown configuration
|
|
454
|
+
*/ getConfig() {
|
|
455
|
+
return {
|
|
456
|
+
...this.config
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Unregister hierarchy
|
|
461
|
+
*
|
|
462
|
+
* @param swarmId - Swarm to unregister
|
|
463
|
+
* @returns True if unregistered, false if not found
|
|
464
|
+
*/ unregisterHierarchy(swarmId) {
|
|
465
|
+
return this.hierarchies.delete(swarmId);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Cleanup coordinator resources
|
|
469
|
+
*/ async cleanup() {
|
|
470
|
+
// Shutdown all registered hierarchies
|
|
471
|
+
const hierarchiesArray = Array.from(this.hierarchies.entries());
|
|
472
|
+
const shutdownPromises = hierarchiesArray.map(async ([swarmId, hierarchy])=>{
|
|
473
|
+
const hierarchyArray = Array.from(hierarchy.values());
|
|
474
|
+
const rootNode = hierarchyArray.find((n)=>n.level === 0);
|
|
475
|
+
if (rootNode) {
|
|
476
|
+
try {
|
|
477
|
+
await this.initiateShutdown(rootNode.agentId, 'Coordinator cleanup', swarmId);
|
|
478
|
+
} catch (error) {
|
|
479
|
+
console.error(`Failed to shutdown swarm ${swarmId}:`, error);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
await Promise.all(shutdownPromises);
|
|
484
|
+
// Clear all state
|
|
485
|
+
this.hierarchies.clear();
|
|
486
|
+
this.shutdownInProgress.clear();
|
|
487
|
+
this.resourceCleanupHandlers.clear();
|
|
488
|
+
this.emit('coordinator:cleanup');
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
//# sourceMappingURL=cascading-shutdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.ts"],"names":["EventEmitter","CascadingShutdown","hierarchies","Map","hierarchicalDetector","config","shutdownInProgress","Set","resourceCleanupHandlers","maxShutdownTimeMs","createShutdownCheckpoints","enableResourceCleanup","notificationTimeoutMs","completionTimeoutMs","enableEmergencyMode","agentGracePeriodMs","registerHierarchy","swarmId","rootCoordinatorId","nodes","hierarchyNodes","node","set","agentId","level","parentId","childIds","shutdownStatus","resources","sessionId","has","nodesArray2","Array","from","values","parent","get","includes","push","nodesArray","emit","totalAgents","size","maxDepth","Math","max","map","n","registerResourceCleanup","resourceType","handler","initiateShutdown","reason","startTime","Date","now","targetSwarmId","findSwarmByAgent","Error","hierarchy","rootNode","add","hierarchyArray","shutdownResult","success","successfulShutdowns","failedShutdowns","totalLatencyMs","notificationLatencyMs","aggregationLatencyMs","totalResourcesCleaned","agentResults","shutdownAt","notificationStartTime","notifyShutdownTopDown","aggregationStartTime","aggregateCompletionBottomUp","filter","r","length","reduce","sum","resourcesCleaned","console","warn","error","message","String","result","delete","emergencyShutdown","originalCheckpointConfig","originalCleanupConfig","rootId","queue","visited","levelSize","levelStartTime","notificationPromises","i","shift","notifyAgent","Promise","all","levelLatency","notifiedAt","timestamp","results","processNode","childId","shutdownAgent","notificationLatency","completionLatencyMs","resourcesFailed","checkpointId","cleanupResults","cleanupResources","cleaned","completedAt","cleanupPromises","resource","type","resourceId","id","entriesArray","entries","undefined","isShutdownInProgress","getShutdownStatus","hierarchiesArray","getConfig","unregisterHierarchy","cleanup","shutdownPromises","find","clear"],"mappings":"AA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