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,512 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Coordination V2 - Waiting Agent Pool
|
|
3
|
+
*
|
|
4
|
+
* Zero-cost agent pool using SDK pause capabilities for dependency waiting.
|
|
5
|
+
* Supports 50+ paused agents with event-driven resume on help request arrival.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Zero token consumption while paused (SDK pause integration)
|
|
9
|
+
* - <50ms resume latency on dependency resolution
|
|
10
|
+
* - Event-driven resume triggers
|
|
11
|
+
* - Timeout and retry logic
|
|
12
|
+
* - Priority-based resume ordering
|
|
13
|
+
* - Dependency tracking per waiting agent
|
|
14
|
+
*
|
|
15
|
+
* @module coordination/v2/help-system/waiting-agent-pool
|
|
16
|
+
*/ import { EventEmitter } from 'node:events';
|
|
17
|
+
import { Logger } from '../../../core/logger.js';
|
|
18
|
+
import { generateId } from '../../../utils/helpers.js';
|
|
19
|
+
/**
|
|
20
|
+
* Waiting Agent Pool - Zero-cost paused agent management.
|
|
21
|
+
*
|
|
22
|
+
* Manages agents waiting for dependencies using SDK pause capabilities.
|
|
23
|
+
* Agents consume zero tokens while waiting, and are resumed within <50ms
|
|
24
|
+
* when their dependencies are resolved.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const pool = new WaitingAgentPool(queryController);
|
|
29
|
+
* await pool.initialize();
|
|
30
|
+
*
|
|
31
|
+
* // Agent waiting for help
|
|
32
|
+
* await pool.addWaitingAgent({
|
|
33
|
+
* agentId: 'agent-1',
|
|
34
|
+
* sessionId: 'session-1',
|
|
35
|
+
* state: 'waiting',
|
|
36
|
+
* priority: 8,
|
|
37
|
+
* pendingDependencies: ['help-request-123'],
|
|
38
|
+
* metadata: { reason: 'waiting for assistance', taskId: 'task-1' }
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* // Dependency resolved - agent auto-resumes
|
|
42
|
+
* await pool.resolveDependency('help-request-123');
|
|
43
|
+
*
|
|
44
|
+
* // Cleanup
|
|
45
|
+
* await pool.shutdown();
|
|
46
|
+
* ```
|
|
47
|
+
*/ export class WaitingAgentPool extends EventEmitter {
|
|
48
|
+
logger;
|
|
49
|
+
config;
|
|
50
|
+
queryController;
|
|
51
|
+
waitingAgents;
|
|
52
|
+
agentsByDependency;
|
|
53
|
+
timeoutCheckTimer;
|
|
54
|
+
metrics;
|
|
55
|
+
initialized = false;
|
|
56
|
+
startTime;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new waiting agent pool.
|
|
59
|
+
*
|
|
60
|
+
* @param queryController - QueryController instance for pause/resume operations
|
|
61
|
+
* @param config - Pool configuration options
|
|
62
|
+
*/ constructor(queryController, config){
|
|
63
|
+
super();
|
|
64
|
+
this.logger = new Logger({
|
|
65
|
+
level: 'info',
|
|
66
|
+
format: 'text',
|
|
67
|
+
destination: 'console'
|
|
68
|
+
});
|
|
69
|
+
this.queryController = queryController;
|
|
70
|
+
this.config = {
|
|
71
|
+
maxConcurrentWaiting: config?.maxConcurrentWaiting ?? 50,
|
|
72
|
+
defaultMaxWaitMs: config?.defaultMaxWaitMs ?? 300000,
|
|
73
|
+
defaultMaxRetries: config?.defaultMaxRetries ?? 3,
|
|
74
|
+
timeoutCheckIntervalMs: config?.timeoutCheckIntervalMs ?? 5000,
|
|
75
|
+
tokenSavingsRate: config?.tokenSavingsRate ?? 0.1
|
|
76
|
+
};
|
|
77
|
+
this.waitingAgents = new Map();
|
|
78
|
+
this.agentsByDependency = new Map();
|
|
79
|
+
this.metrics = this.initializeMetrics();
|
|
80
|
+
this.startTime = Date.now();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Initializes the waiting agent pool.
|
|
84
|
+
* Starts timeout checker and sets up event listeners.
|
|
85
|
+
*/ async initialize() {
|
|
86
|
+
if (this.initialized) {
|
|
87
|
+
this.logger.warn('WaitingAgentPool already initialized');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.logger.info('Initializing waiting agent pool', {
|
|
91
|
+
maxConcurrentWaiting: this.config.maxConcurrentWaiting,
|
|
92
|
+
defaultMaxWaitMs: this.config.defaultMaxWaitMs
|
|
93
|
+
});
|
|
94
|
+
// Start timeout check timer
|
|
95
|
+
this.startTimeoutChecker();
|
|
96
|
+
// Listen for QueryController resume events
|
|
97
|
+
this.queryController.on('agent:resumed', (event)=>{
|
|
98
|
+
this.handleAgentResumed(event.agentId);
|
|
99
|
+
});
|
|
100
|
+
this.initialized = true;
|
|
101
|
+
this.emit('pool:initialized');
|
|
102
|
+
this.logger.info('Waiting agent pool initialized');
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Adds an agent to the waiting pool with SDK pause.
|
|
106
|
+
*
|
|
107
|
+
* @param config - Waiting agent configuration
|
|
108
|
+
* @returns Waiting agent entry ID
|
|
109
|
+
* @throws Error if pool is at capacity or agent already waiting
|
|
110
|
+
*/ async addWaitingAgent(config) {
|
|
111
|
+
const startTime = Date.now();
|
|
112
|
+
if (!this.initialized) {
|
|
113
|
+
throw new Error('WaitingAgentPool not initialized. Call initialize() first.');
|
|
114
|
+
}
|
|
115
|
+
// Check capacity
|
|
116
|
+
if (this.waitingAgents.size >= this.config.maxConcurrentWaiting) {
|
|
117
|
+
throw new Error(`Waiting agent pool at capacity (${this.config.maxConcurrentWaiting} agents)`);
|
|
118
|
+
}
|
|
119
|
+
// Check if agent already waiting
|
|
120
|
+
const existingAgent = Array.from(this.waitingAgents.values()).find((a)=>a.agentId === config.agentId);
|
|
121
|
+
if (existingAgent) {
|
|
122
|
+
throw new Error(`Agent ${config.agentId} is already in waiting pool`);
|
|
123
|
+
}
|
|
124
|
+
// Validate dependencies
|
|
125
|
+
if (config.pendingDependencies.length === 0) {
|
|
126
|
+
throw new Error('Agent must have at least one pending dependency');
|
|
127
|
+
}
|
|
128
|
+
// Create waiting agent entry
|
|
129
|
+
const waitingId = generateId('waiting');
|
|
130
|
+
const waitingAgent = {
|
|
131
|
+
id: waitingId,
|
|
132
|
+
agentId: config.agentId,
|
|
133
|
+
sessionId: config.sessionId,
|
|
134
|
+
state: config.state,
|
|
135
|
+
priority: config.priority,
|
|
136
|
+
pendingDependencies: [
|
|
137
|
+
...config.pendingDependencies
|
|
138
|
+
],
|
|
139
|
+
waitingSince: new Date(),
|
|
140
|
+
maxWaitMs: config.maxWaitMs ?? this.config.defaultMaxWaitMs,
|
|
141
|
+
retryCount: 0,
|
|
142
|
+
maxRetries: config.maxRetries ?? this.config.defaultMaxRetries,
|
|
143
|
+
metadata: config.metadata
|
|
144
|
+
};
|
|
145
|
+
// Add to pool
|
|
146
|
+
this.waitingAgents.set(waitingId, waitingAgent);
|
|
147
|
+
// Index by dependencies
|
|
148
|
+
for (const depId of config.pendingDependencies){
|
|
149
|
+
if (!this.agentsByDependency.has(depId)) {
|
|
150
|
+
this.agentsByDependency.set(depId, new Set());
|
|
151
|
+
}
|
|
152
|
+
this.agentsByDependency.get(depId).add(config.agentId);
|
|
153
|
+
}
|
|
154
|
+
// Pause agent via SDK (zero token consumption)
|
|
155
|
+
try {
|
|
156
|
+
await this.queryController.interrupt(config.sessionId, `Waiting for dependencies: ${config.pendingDependencies.join(', ')}`);
|
|
157
|
+
this.logger.info('Agent added to waiting pool and paused', {
|
|
158
|
+
agentId: config.agentId,
|
|
159
|
+
waitingId,
|
|
160
|
+
dependencies: config.pendingDependencies,
|
|
161
|
+
priority: config.priority
|
|
162
|
+
});
|
|
163
|
+
} catch (error) {
|
|
164
|
+
// Rollback on pause failure
|
|
165
|
+
this.waitingAgents.delete(waitingId);
|
|
166
|
+
for (const depId of config.pendingDependencies){
|
|
167
|
+
this.agentsByDependency.get(depId)?.delete(config.agentId);
|
|
168
|
+
}
|
|
169
|
+
throw new Error(`Failed to pause agent ${config.agentId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
170
|
+
}
|
|
171
|
+
// Update metrics
|
|
172
|
+
this.metrics.totalWaiting = this.waitingAgents.size;
|
|
173
|
+
this.metrics.totalPaused++;
|
|
174
|
+
this.metrics.maxConcurrentWaiting = Math.max(this.metrics.maxConcurrentWaiting, this.waitingAgents.size);
|
|
175
|
+
const latencyMs = Date.now() - startTime;
|
|
176
|
+
this.emit('agent:waiting', {
|
|
177
|
+
waitingAgent,
|
|
178
|
+
latencyMs
|
|
179
|
+
});
|
|
180
|
+
return waitingId;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Resolves a dependency and resumes all agents waiting for it.
|
|
184
|
+
*
|
|
185
|
+
* @param dependencyId - ID of the resolved dependency
|
|
186
|
+
* @returns Array of resumed agent IDs
|
|
187
|
+
*/ async resolveDependency(dependencyId) {
|
|
188
|
+
const startTime = Date.now();
|
|
189
|
+
const waitingAgentIds = this.agentsByDependency.get(dependencyId);
|
|
190
|
+
if (!waitingAgentIds || waitingAgentIds.size === 0) {
|
|
191
|
+
this.logger.debug('No agents waiting for dependency', {
|
|
192
|
+
dependencyId
|
|
193
|
+
});
|
|
194
|
+
return [];
|
|
195
|
+
}
|
|
196
|
+
const resumedAgents = [];
|
|
197
|
+
// Resume agents waiting for this dependency
|
|
198
|
+
for (const agentId of Array.from(waitingAgentIds)){
|
|
199
|
+
try {
|
|
200
|
+
const resumed = await this.resumeAgentForDependency(agentId, dependencyId);
|
|
201
|
+
if (resumed) {
|
|
202
|
+
resumedAgents.push(agentId);
|
|
203
|
+
}
|
|
204
|
+
} catch (error) {
|
|
205
|
+
this.logger.error('Failed to resume agent for dependency', {
|
|
206
|
+
agentId,
|
|
207
|
+
dependencyId,
|
|
208
|
+
error: error instanceof Error ? error.message : String(error)
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// Clean up dependency index
|
|
213
|
+
this.agentsByDependency.delete(dependencyId);
|
|
214
|
+
const latencyMs = Date.now() - startTime;
|
|
215
|
+
this.logger.info('Dependency resolved, agents resumed', {
|
|
216
|
+
dependencyId,
|
|
217
|
+
resumedCount: resumedAgents.length,
|
|
218
|
+
latencyMs
|
|
219
|
+
});
|
|
220
|
+
this.emit('dependency:resolved', {
|
|
221
|
+
dependencyId,
|
|
222
|
+
resumedAgents,
|
|
223
|
+
latencyMs
|
|
224
|
+
});
|
|
225
|
+
return resumedAgents;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Manually resumes a waiting agent.
|
|
229
|
+
*
|
|
230
|
+
* @param agentId - Agent ID to resume
|
|
231
|
+
* @param reason - Reason for manual resume
|
|
232
|
+
* @returns True if agent was resumed, false if not found
|
|
233
|
+
*/ async resumeAgent(agentId, reason = 'Manual resume') {
|
|
234
|
+
const waitingAgent = this.findWaitingAgent(agentId);
|
|
235
|
+
if (!waitingAgent) {
|
|
236
|
+
this.logger.warn('Agent not found in waiting pool', {
|
|
237
|
+
agentId
|
|
238
|
+
});
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
return await this.resumeWaitingAgent(waitingAgent, {
|
|
242
|
+
type: 'manual',
|
|
243
|
+
agentId,
|
|
244
|
+
metadata: {
|
|
245
|
+
reason
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Removes an agent from the waiting pool without resuming.
|
|
251
|
+
*
|
|
252
|
+
* @param agentId - Agent ID to remove
|
|
253
|
+
* @returns True if removed, false if not found
|
|
254
|
+
*/ removeWaitingAgent(agentId) {
|
|
255
|
+
const waitingAgent = this.findWaitingAgent(agentId);
|
|
256
|
+
if (!waitingAgent) {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
// Clean up dependency indices
|
|
260
|
+
for (const depId of waitingAgent.pendingDependencies){
|
|
261
|
+
this.agentsByDependency.get(depId)?.delete(agentId);
|
|
262
|
+
if (this.agentsByDependency.get(depId)?.size === 0) {
|
|
263
|
+
this.agentsByDependency.delete(depId);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// Remove from pool
|
|
267
|
+
this.waitingAgents.delete(waitingAgent.id);
|
|
268
|
+
this.metrics.totalWaiting = this.waitingAgents.size;
|
|
269
|
+
this.logger.debug('Agent removed from waiting pool', {
|
|
270
|
+
agentId
|
|
271
|
+
});
|
|
272
|
+
this.emit('agent:removed', {
|
|
273
|
+
agentId
|
|
274
|
+
});
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Gets all waiting agents sorted by priority (descending).
|
|
279
|
+
*
|
|
280
|
+
* @returns Array of waiting agents
|
|
281
|
+
*/ getWaitingAgents() {
|
|
282
|
+
return Array.from(this.waitingAgents.values()).sort((a, b)=>b.priority - a.priority);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Gets waiting agent by agent ID.
|
|
286
|
+
*
|
|
287
|
+
* @param agentId - Agent ID to find
|
|
288
|
+
* @returns Waiting agent if found, undefined otherwise
|
|
289
|
+
*/ getWaitingAgent(agentId) {
|
|
290
|
+
return this.findWaitingAgent(agentId);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Gets all agents waiting for a specific dependency.
|
|
294
|
+
*
|
|
295
|
+
* @param dependencyId - Dependency ID
|
|
296
|
+
* @returns Array of agent IDs
|
|
297
|
+
*/ getAgentsWaitingFor(dependencyId) {
|
|
298
|
+
return Array.from(this.agentsByDependency.get(dependencyId) || []);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Gets pool metrics.
|
|
302
|
+
*
|
|
303
|
+
* @returns Current pool metrics
|
|
304
|
+
*/ getMetrics() {
|
|
305
|
+
// Update token savings estimate
|
|
306
|
+
const uptimeSeconds = (Date.now() - this.startTime) / 1000;
|
|
307
|
+
this.metrics.estimatedTokensSaved = Math.floor(this.metrics.totalPaused * this.config.tokenSavingsRate * uptimeSeconds);
|
|
308
|
+
return {
|
|
309
|
+
...this.metrics
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Shuts down the waiting agent pool.
|
|
314
|
+
* Stops timeout checker and cleans up resources.
|
|
315
|
+
*/ async shutdown() {
|
|
316
|
+
if (!this.initialized) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
this.logger.info('Shutting down waiting agent pool', {
|
|
320
|
+
waitingAgents: this.waitingAgents.size
|
|
321
|
+
});
|
|
322
|
+
// Stop timeout checker
|
|
323
|
+
if (this.timeoutCheckTimer) {
|
|
324
|
+
clearInterval(this.timeoutCheckTimer);
|
|
325
|
+
this.timeoutCheckTimer = undefined;
|
|
326
|
+
}
|
|
327
|
+
// Clear all data
|
|
328
|
+
this.waitingAgents.clear();
|
|
329
|
+
this.agentsByDependency.clear();
|
|
330
|
+
this.removeAllListeners();
|
|
331
|
+
this.initialized = false;
|
|
332
|
+
this.emit('pool:shutdown');
|
|
333
|
+
this.logger.info('Waiting agent pool shut down');
|
|
334
|
+
}
|
|
335
|
+
// ============================================
|
|
336
|
+
// Private Methods
|
|
337
|
+
// ============================================
|
|
338
|
+
/**
|
|
339
|
+
* Initializes pool metrics.
|
|
340
|
+
*/ initializeMetrics() {
|
|
341
|
+
return {
|
|
342
|
+
totalWaiting: 0,
|
|
343
|
+
totalPaused: 0,
|
|
344
|
+
totalResumes: 0,
|
|
345
|
+
totalTimeouts: 0,
|
|
346
|
+
averageResumeLatencyMs: 0,
|
|
347
|
+
maxConcurrentWaiting: 0,
|
|
348
|
+
totalRetries: 0,
|
|
349
|
+
estimatedTokensSaved: 0
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Starts the timeout checker interval.
|
|
354
|
+
*/ startTimeoutChecker() {
|
|
355
|
+
this.timeoutCheckTimer = setInterval(()=>{
|
|
356
|
+
this.checkTimeouts();
|
|
357
|
+
}, this.config.timeoutCheckIntervalMs);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Checks for timed-out waiting agents and handles them.
|
|
361
|
+
*/ checkTimeouts() {
|
|
362
|
+
const now = Date.now();
|
|
363
|
+
for (const waitingAgent of Array.from(this.waitingAgents.values())){
|
|
364
|
+
const waitTimeMs = now - waitingAgent.waitingSince.getTime();
|
|
365
|
+
if (waitTimeMs >= waitingAgent.maxWaitMs) {
|
|
366
|
+
this.handleTimeout(waitingAgent);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Handles timeout for a waiting agent.
|
|
372
|
+
*
|
|
373
|
+
* @param waitingAgent - Timed-out agent
|
|
374
|
+
*/ async handleTimeout(waitingAgent) {
|
|
375
|
+
this.logger.warn('Agent wait timeout', {
|
|
376
|
+
agentId: waitingAgent.agentId,
|
|
377
|
+
waitTimeMs: Date.now() - waitingAgent.waitingSince.getTime(),
|
|
378
|
+
maxWaitMs: waitingAgent.maxWaitMs,
|
|
379
|
+
pendingDependencies: waitingAgent.pendingDependencies
|
|
380
|
+
});
|
|
381
|
+
// Check retry count
|
|
382
|
+
if (waitingAgent.retryCount < waitingAgent.maxRetries) {
|
|
383
|
+
// Retry - extend wait time
|
|
384
|
+
waitingAgent.retryCount++;
|
|
385
|
+
waitingAgent.waitingSince = new Date();
|
|
386
|
+
this.metrics.totalRetries++;
|
|
387
|
+
this.logger.info('Retrying timed-out agent', {
|
|
388
|
+
agentId: waitingAgent.agentId,
|
|
389
|
+
retryCount: waitingAgent.retryCount,
|
|
390
|
+
maxRetries: waitingAgent.maxRetries
|
|
391
|
+
});
|
|
392
|
+
this.emit('agent:retry', {
|
|
393
|
+
agentId: waitingAgent.agentId,
|
|
394
|
+
retryCount: waitingAgent.retryCount
|
|
395
|
+
});
|
|
396
|
+
} else {
|
|
397
|
+
// Max retries exceeded - resume with timeout trigger
|
|
398
|
+
this.metrics.totalTimeouts++;
|
|
399
|
+
await this.resumeWaitingAgent(waitingAgent, {
|
|
400
|
+
type: 'timeout',
|
|
401
|
+
agentId: waitingAgent.agentId,
|
|
402
|
+
metadata: {
|
|
403
|
+
reason: 'Max wait time exceeded',
|
|
404
|
+
pendingDependencies: waitingAgent.pendingDependencies
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Resumes an agent waiting for a specific dependency.
|
|
411
|
+
*
|
|
412
|
+
* @param agentId - Agent ID
|
|
413
|
+
* @param dependencyId - Resolved dependency ID
|
|
414
|
+
* @returns True if resumed, false otherwise
|
|
415
|
+
*/ async resumeAgentForDependency(agentId, dependencyId) {
|
|
416
|
+
const waitingAgent = this.findWaitingAgent(agentId);
|
|
417
|
+
if (!waitingAgent) {
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
// Remove dependency from pending list
|
|
421
|
+
const depIndex = waitingAgent.pendingDependencies.indexOf(dependencyId);
|
|
422
|
+
if (depIndex !== -1) {
|
|
423
|
+
waitingAgent.pendingDependencies.splice(depIndex, 1);
|
|
424
|
+
}
|
|
425
|
+
// Check if all dependencies resolved
|
|
426
|
+
if (waitingAgent.pendingDependencies.length === 0) {
|
|
427
|
+
// All dependencies resolved - resume agent
|
|
428
|
+
return await this.resumeWaitingAgent(waitingAgent, {
|
|
429
|
+
type: 'dependency_resolved',
|
|
430
|
+
agentId,
|
|
431
|
+
resolvedDependencyId: dependencyId
|
|
432
|
+
});
|
|
433
|
+
} else {
|
|
434
|
+
// Still has pending dependencies - keep waiting
|
|
435
|
+
this.logger.debug('Agent still waiting for dependencies', {
|
|
436
|
+
agentId,
|
|
437
|
+
resolvedDependency: dependencyId,
|
|
438
|
+
remainingDependencies: waitingAgent.pendingDependencies
|
|
439
|
+
});
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Resumes a waiting agent via SDK.
|
|
445
|
+
*
|
|
446
|
+
* @param waitingAgent - Agent to resume
|
|
447
|
+
* @param trigger - Resume trigger event
|
|
448
|
+
* @returns True if resumed successfully
|
|
449
|
+
*/ async resumeWaitingAgent(waitingAgent, trigger) {
|
|
450
|
+
const startTime = Date.now();
|
|
451
|
+
try {
|
|
452
|
+
// Resume via QueryController
|
|
453
|
+
await this.queryController.resumeSessionAt(waitingAgent.sessionId, undefined, `Resume trigger: ${trigger.type}`);
|
|
454
|
+
// Remove from pool
|
|
455
|
+
this.waitingAgents.delete(waitingAgent.id);
|
|
456
|
+
// Clean up dependency indices
|
|
457
|
+
for (const depId of waitingAgent.pendingDependencies){
|
|
458
|
+
this.agentsByDependency.get(depId)?.delete(waitingAgent.agentId);
|
|
459
|
+
}
|
|
460
|
+
const latencyMs = Date.now() - startTime;
|
|
461
|
+
// Update metrics
|
|
462
|
+
this.metrics.totalWaiting = this.waitingAgents.size;
|
|
463
|
+
this.metrics.totalResumes++;
|
|
464
|
+
this.metrics.averageResumeLatencyMs = (this.metrics.averageResumeLatencyMs * (this.metrics.totalResumes - 1) + latencyMs) / this.metrics.totalResumes;
|
|
465
|
+
this.logger.info('Waiting agent resumed', {
|
|
466
|
+
agentId: waitingAgent.agentId,
|
|
467
|
+
triggerType: trigger.type,
|
|
468
|
+
latencyMs,
|
|
469
|
+
waitTimeMs: Date.now() - waitingAgent.waitingSince.getTime()
|
|
470
|
+
});
|
|
471
|
+
this.emit('agent:resumed', {
|
|
472
|
+
waitingAgent,
|
|
473
|
+
trigger,
|
|
474
|
+
latencyMs
|
|
475
|
+
});
|
|
476
|
+
return true;
|
|
477
|
+
} catch (error) {
|
|
478
|
+
this.logger.error('Failed to resume waiting agent', {
|
|
479
|
+
agentId: waitingAgent.agentId,
|
|
480
|
+
error: error instanceof Error ? error.message : String(error)
|
|
481
|
+
});
|
|
482
|
+
this.emit('agent:resume-failed', {
|
|
483
|
+
agentId: waitingAgent.agentId,
|
|
484
|
+
error
|
|
485
|
+
});
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Finds a waiting agent by agent ID.
|
|
491
|
+
*
|
|
492
|
+
* @param agentId - Agent ID to find
|
|
493
|
+
* @returns Waiting agent if found
|
|
494
|
+
*/ findWaitingAgent(agentId) {
|
|
495
|
+
for (const waitingAgent of Array.from(this.waitingAgents.values())){
|
|
496
|
+
if (waitingAgent.agentId === agentId) {
|
|
497
|
+
return waitingAgent;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return undefined;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Handles agent resumed event from QueryController.
|
|
504
|
+
*
|
|
505
|
+
* @param agentId - Resumed agent ID
|
|
506
|
+
*/ handleAgentResumed(agentId) {
|
|
507
|
+
// Ensure agent is removed from pool if still present
|
|
508
|
+
this.removeWaitingAgent(agentId);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
//# sourceMappingURL=waiting-agent-pool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/help-system/waiting-agent-pool.ts"],"names":["EventEmitter","Logger","generateId","WaitingAgentPool","logger","config","queryController","waitingAgents","agentsByDependency","timeoutCheckTimer","metrics","initialized","startTime","level","format","destination","maxConcurrentWaiting","defaultMaxWaitMs","defaultMaxRetries","timeoutCheckIntervalMs","tokenSavingsRate","Map","initializeMetrics","Date","now","initialize","warn","info","startTimeoutChecker","on","event","handleAgentResumed","agentId","emit","addWaitingAgent","Error","size","existingAgent","Array","from","values","find","a","pendingDependencies","length","waitingId","waitingAgent","id","sessionId","state","priority","waitingSince","maxWaitMs","retryCount","maxRetries","metadata","set","depId","has","Set","get","add","interrupt","join","dependencies","error","delete","message","String","totalWaiting","totalPaused","Math","max","latencyMs","resolveDependency","dependencyId","waitingAgentIds","debug","resumedAgents","resumed","resumeAgentForDependency","push","resumedCount","resumeAgent","reason","findWaitingAgent","resumeWaitingAgent","type","removeWaitingAgent","getWaitingAgents","sort","b","getWaitingAgent","getAgentsWaitingFor","getMetrics","uptimeSeconds","estimatedTokensSaved","floor","shutdown","clearInterval","undefined","clear","removeAllListeners","totalResumes","totalTimeouts","averageResumeLatencyMs","totalRetries","setInterval","checkTimeouts","waitTimeMs","getTime","handleTimeout","depIndex","indexOf","splice","resolvedDependencyId","resolvedDependency","remainingDependencies","trigger","resumeSessionAt","triggerType"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,YAAY,QAAQ,cAAc;AAC3C,SAASC,MAAM,QAAQ,0BAA0B;AACjD,SAASC,UAAU,QAAQ,4BAA4B;AAiHvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BC,GACD,OAAO,MAAMC,yBAAyBH;IACnBI,OAAe;IACfC,OAAyC;IACzCC,gBAAiC;IAE1CC,cAAyC;IACzCC,mBAA6C;IAC7CC,kBAAmC;IACnCC,QAAqB;IACrBC,cAAuB,MAAM;IAC7BC,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A,SAAS;gBACpC,OAAOc;YACT;QACF;QACA,OAAOsD;IACT;IAEA;;;;GAIC,GACD,AAAQrE,mBAAmBC,OAAe,EAAQ;QAChD,qDAAqD;QACrD,IAAI,CAACwD,kBAAkB,CAACxD;IAC1B;AACF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Coordination V2 - Public API
|
|
3
|
+
*
|
|
4
|
+
* Unified coordination architecture with CLI/SDK/Hybrid mode support.
|
|
5
|
+
* Provides zero-cost agent pausing, resume-from-checkpoint, and dynamic resource allocation.
|
|
6
|
+
*
|
|
7
|
+
* @module coordination/v2
|
|
8
|
+
*/ // Factory for coordinator creation
|
|
9
|
+
export { CoordinatorFactory } from './coordinator-factory.js';
|
|
10
|
+
// Unified SwarmCoordinatorV2 (Phase 9 - integrates all V2 components)
|
|
11
|
+
export { SwarmCoordinatorV2, SwarmTopology } from './coordinators/swarm-coordinator-v2.js';
|
|
12
|
+
// SDK implementation (QueryController)
|
|
13
|
+
export { QueryController } from './sdk/query-controller.js';
|
|
14
|
+
// SDK utilities and helpers
|
|
15
|
+
export { BackgroundOrchestrator } from './sdk/background-orchestrator.js';
|
|
16
|
+
export { BashOutputMonitor } from './sdk/bash-output-monitor.js';
|
|
17
|
+
export { FilesystemArtifactStorage } from './sdk/artifact-storage.js';
|
|
18
|
+
export * from './utils/sdk-helpers.js';
|
|
19
|
+
// Core messaging components
|
|
20
|
+
export { MessageRouter } from './core/message-router.js';
|
|
21
|
+
export { DeadLetterQueue } from './core/dead-letter-queue.js';
|
|
22
|
+
export { MessageStorage } from './memory/message-storage.js';
|
|
23
|
+
// Help System
|
|
24
|
+
export { HelpRequest, HelpRequestStatus, HelpRequestPriority, HelpMatcher, HelpCoordinator } from './help-system/index.js';
|
|
25
|
+
// Deadlock Detection & Recovery
|
|
26
|
+
export { DeadlockDetector } from './deadlock/index.js';
|
|
27
|
+
/**
|
|
28
|
+
* Quick Start Examples:
|
|
29
|
+
*
|
|
30
|
+
* @example Auto-detect mode and create coordinator
|
|
31
|
+
* ```typescript
|
|
32
|
+
* import { CoordinatorFactory } from './coordination/v2';
|
|
33
|
+
*
|
|
34
|
+
* const coordinator = await CoordinatorFactory.create();
|
|
35
|
+
* const agent = await coordinator.spawnAgent({
|
|
36
|
+
* agentId: 'coder-001',
|
|
37
|
+
* type: 'coder',
|
|
38
|
+
* priority: 8,
|
|
39
|
+
* tokenBudget: 10000,
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example Explicit SDK mode with configuration
|
|
44
|
+
* ```typescript
|
|
45
|
+
* import { CoordinatorFactory } from './coordination/v2';
|
|
46
|
+
*
|
|
47
|
+
* const coordinator = await CoordinatorFactory.create({
|
|
48
|
+
* mode: 'sdk',
|
|
49
|
+
* apiKey: process.env.ANTHROPIC_API_KEY,
|
|
50
|
+
* maxConcurrentAgents: 5,
|
|
51
|
+
* defaultTokenBudget: 20000,
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example Direct QueryController usage
|
|
56
|
+
* ```typescript
|
|
57
|
+
* import { QueryController } from './coordination/v2';
|
|
58
|
+
*
|
|
59
|
+
* const controller = new QueryController({
|
|
60
|
+
* maxConcurrentAgents: 10,
|
|
61
|
+
* enableDynamicAllocation: true,
|
|
62
|
+
* });
|
|
63
|
+
*
|
|
64
|
+
* await controller.initialize();
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/index.ts"],"names":["CoordinatorFactory","SwarmCoordinatorV2","SwarmTopology","QueryController","BackgroundOrchestrator","BashOutputMonitor","FilesystemArtifactStorage","MessageRouter","DeadLetterQueue","MessageStorage","HelpRequest","HelpRequestStatus","HelpRequestPriority","HelpMatcher","HelpCoordinator","DeadlockDetector"],"mappings":"AAAA;;;;;;;CAOC,GAED,mCAAmC;AACnC,SAASA,kBAAkB,QAAoD,2BAA2B;AAW1G,sEAAsE;AACtE,SACEC,kBAAkB,EAClBC,aAAa,QAKR,yCAAyC;AAEhD,uCAAuC;AACvC,SAASC,eAAe,QAAoC,4BAA4B;AAExF,4BAA4B;AAC5B,SAASC,sBAAsB,QAA2C,mCAAmC;AAC7G,SAASC,iBAAiB,QAA4B,+BAA+B;AACrF,SAASC,yBAAyB,QAAoC,4BAA4B;AAClG,cAAc,yBAAyB;AAEvC,4BAA4B;AAC5B,SAASC,aAAa,QAAQ,2BAA2B;AACzD,SAASC,eAAe,QAA+D,8BAA8B;AACrH,SAASC,cAAc,QAAQ,8BAA8B;AAE7D,cAAc;AACd,SACEC,WAAW,EACXC,iBAAiB,EACjBC,mBAAmB,EACnBC,WAAW,EACXC,eAAe,QAaV,yBAAyB;AAEhC,gCAAgC;AAChC,SACEC,gBAAgB,QAMX,sBAAsB;CAe7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCC"}
|