claude-flow-novice 1.6.3 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/parse-epic.js +180 -0
- package/.claude/settings.json +12 -2
- package/.claude/settings.local.json +4 -2
- 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/index.js +3 -0
- package/.claude-flow-novice/dist/src/coordination/index.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/coordination/v1-transparency/interfaces/v1-transparency-system.js +12 -0
- package/.claude-flow-novice/dist/src/coordination/v1-transparency/interfaces/v1-transparency-system.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v1-transparency/v1-to-v2-bridge.js +433 -0
- package/.claude-flow-novice/dist/src/coordination/v1-transparency/v1-to-v2-bridge.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v1-transparency/v1-transparency-adapter.js +1468 -0
- package/.claude-flow-novice/dist/src/coordination/v1-transparency/v1-transparency-adapter.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/monitoring/apm/apm-integration.js +5 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/provider-manager.js +41 -6
- package/.claude-flow-novice/dist/src/providers/provider-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/tiered-router.js +9 -17
- package/.claude-flow-novice/dist/src/providers/tiered-router.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 +0 -0
- package/.claude-flow-novice/metrics.db-shm +0 -0
- package/.claude-flow-novice/metrics.db-wal +0 -0
- package/CLAUDE.md +72 -0
- package/config/hooks/post-edit-pipeline.js +68 -118
- package/config/hooks/pre-tool-memory-safety.js +209 -0
- package/package.json +7 -4
- package/scripts/cleanup-idle-sessions.sh +59 -0
- package/scripts/monitoring/alert-monitor.sh +220 -0
- package/scripts/monitoring/view-alerts.sh +307 -0
- package/scripts/test-provider-routing.cjs +7 -9
- package/scripts/test-zai-api.cjs +2 -2
- package/src/slash-commands/parse-epic.js +1 -1
- package/wiki/Provider-Routing.md +57 -69
- package/MEMORY_LEAK_ROOT_CAUSE.md +0 -149
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/sdk/query-controller.ts"],"names":["EventEmitter","Logger","generateId","HelpCoordinator","AgentState","AgentStateEnum","QueryController","logger","config","sessions","checkpoints","resourceAllocations","metrics","agents","coordinatorMetrics","ready","startTime","helpCoordinator","level","format","destination","maxConcurrentAgents","defaultTokenBudget","pauseTimeoutMs","resumeTimeoutMs","enableDynamicAllocation","Map","initializeMetrics","initializeCoordinatorMetrics","Date","now","info","registerSession","agentId","sessionId","priority","session","state","isPaused","metadata","set","tokenBudget","currentUsage","paused","agent","type","debug","interrupt","reason","get","Error","warn","success","pausedAt","checkpoint","length","latencyMs","id","messageUUID","currentMessageUUID","timestamp","autoCheckpoint","context","push","checkpointList","allocation","Math","max","totalPauses","averagePauseLatencyMs","idleAgents","result","checkpointId","emit","resumeSessionAt","resumedAt","find","cp","totalResumes","averageResumeLatencyMs","resumedFromCheckpoint","pauseLowPriorityAgents","priorityThreshold","results","entries","tokensSaved","error","message","String","agentsPaused","handleResumeTrigger","trigger","targetSession","values","triggerType","undefined","getQueryControlMetrics","getPausedSessions","Array","from","filter","s","getActiveSessions","getCheckpoints","getResourceAllocation","updateTokenUsageInternal","tokensUsed","current","budget","catch","err","getHelpCoordinator","cleanup","totalSessions","size","pausedAgents","clear","removeAllListeners","initialize","isReady","spawnAgent","initialState","capabilities","isArray","agentProfile","workload","registerAgent","map","c","name","totalAgentsSpawned","activeAgents","pauseAgent","updateAgentState","PAUSED","resumeAgent","terminateAgent","createCheckpoint","unregisterAgent","delete","totalTerminations","getAgentState","getAgentSession","totalCheckpoints","averageCheckpointTimeMs","restoreCheckpoint","foundCheckpoint","foundSessionId","totalRestores","averageRestoreTimeMs","p99RestoreTimeMs","listCheckpoints","limit","sorted","sort","a","b","getTime","slice","getMetrics","uptimeMs","getActiveAgents","getPausedAgents","updateTokenUsage","totalTokensUsed","min","updateAgentWorkload"],"mappings":"AAAA;;;;;;CAMC,GAED,SAASA,YAAY,QAAQ,cAAc;AAC3C,SAASC,MAAM,QAAQ,0BAA0B;AACjD,SAASC,UAAU,QAAQ,4BAA4B;AAkBvD,SAASC,eAAe,QAAQ,qCAAqC;AAErE,SAASC,cAAcC,cAAc,QAAQ,mCAAmC;AAUhF;;;;;;;;;CASC,GACD,OAAO,MAAMC,wBAAwBN;IAClBO,OAAe;IACfC,OAAwC;IAEjDC,SAAoC;IACpCC,YAA8C;IAC9CC,oBAAqD;IACrDC,QAA6B;IAE7BC,OAA2B;IAC3BC,mBAAuC;IACvCC,MAAe;IACfC,UAAkB;IAE1B,mDAAmD,GACnD,AAAQC,gBAAiC;IAEzC,YAAYT,SAAgC,CAAC,CAAC,CAAE;QAC9C,KAAK;QAEL,IAAI,CAACD,MAAM,GAAG,IAAIN,OAAO;YACvBiB,OAAO;YACPC,QAAQ;YACRC,aAAa;QACf;QACA,IAAI,CAACZ,MAAM,GAAG;YACZa,qBAAqBb,OAAOa,mBAAmB,IAAI;YACnDC,oBAAoBd,OAAOc,kBAAkB,IAAI;YACjDC,gBAAgBf,OAAOe,cAAc,IAAI;YACzCC,iBAAiBhB,OAAOgB,eAAe,IAAI;YAC3CC,yBAAyBjB,OAAOiB,uBAAuB,IAAI;QAC7D;QAEA,IAAI,CAAChB,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AA0D;QAC1D,MAAMzC,aAAa,IAAI,CAACtD,mBAAmB,CAACsC,GAAG,CAAChB;QAChD,IAAIgC,YAAY;YACd,MAAM4D,WAAW3D,KAAKmG,GAAG,CAAC,KAAKpG,WAAWvB,YAAY,GAAGuB,WAAWxB,WAAW;YAC/E,IAAI,CAACxB,eAAe,CAACqJ,mBAAmB,CAACrI,SAAS4F;QACpD;IACF;IAEA,8BAA8B;IAC9B,kBAAkB;IAClB,8BAA8B;IAEtBlG,oBAAyC;QAC/C,OAAO;YACLyC,aAAa;YACbU,cAAc;YACdT,uBAAuB;YACvBU,wBAAwB;YACxBM,aAAa;YACbf,YAAY;QACd;IACF;IAEQ1C,+BAAmD;QACzD,OAAO;YACLsG,oBAAoB;YACpBC,cAAc;YACdhB,cAAc;YACdyB,mBAAmB;YACnBG,kBAAkB;YAClBK,eAAe;YACfJ,yBAAyB;YACzBK,sBAAsB;YACtBC,kBAAkB;YAClBjE,aAAa;YACb+E,iBAAiB;YACjBJ,UAAU;QACZ;IACF;AACF"}
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Coordination V2 - Query Control + Message Bus Integration
|
|
3
|
+
*
|
|
4
|
+
* Sprint 3.2: SDK Query Control Integration for Message-Driven Agent Lifecycle
|
|
5
|
+
*
|
|
6
|
+
* Implements:
|
|
7
|
+
* - Agent pause during idle periods (zero token cost)
|
|
8
|
+
* - Agent resume on message arrival (event-driven, <50ms latency)
|
|
9
|
+
* - Dynamic message routing based on agent state
|
|
10
|
+
* - Queue-empty → pause agent
|
|
11
|
+
* - Message-arrived → resume agent
|
|
12
|
+
*
|
|
13
|
+
* @module coordination/v2/sdk/query-message-integration
|
|
14
|
+
*/ import { EventEmitter } from 'node:events';
|
|
15
|
+
import { Logger } from '../../../core/logger.js';
|
|
16
|
+
/**
|
|
17
|
+
* QueryMessageIntegration - Event-driven agent pause/resume on message events
|
|
18
|
+
*
|
|
19
|
+
* Key Features:
|
|
20
|
+
* - Zero-cost agent pausing when message queue is empty
|
|
21
|
+
* - Sub-50ms agent resume on message arrival
|
|
22
|
+
* - Dynamic routing based on agent state (paused/active)
|
|
23
|
+
* - Token savings tracking for idle agents
|
|
24
|
+
*
|
|
25
|
+
* Event Flow:
|
|
26
|
+
* 1. Queue empty → Auto-pause agent (zero token cost)
|
|
27
|
+
* 2. Message arrives → Auto-resume agent (<50ms)
|
|
28
|
+
* 3. Message delivered → Check queue depth
|
|
29
|
+
* 4. If queue empty again → Auto-pause agent
|
|
30
|
+
*/ export class QueryMessageIntegration extends EventEmitter {
|
|
31
|
+
logger;
|
|
32
|
+
config;
|
|
33
|
+
agentQueues;
|
|
34
|
+
channelSubscriptions;
|
|
35
|
+
resumeLatencies;
|
|
36
|
+
metrics;
|
|
37
|
+
cleanupHandlers;
|
|
38
|
+
constructor(config){
|
|
39
|
+
super();
|
|
40
|
+
this.logger = new Logger({
|
|
41
|
+
level: 'info',
|
|
42
|
+
format: 'text',
|
|
43
|
+
destination: 'console'
|
|
44
|
+
});
|
|
45
|
+
this.config = {
|
|
46
|
+
...config,
|
|
47
|
+
autoPauseOnQueueEmpty: config.autoPauseOnQueueEmpty ?? true,
|
|
48
|
+
autoResumeOnMessage: config.autoResumeOnMessage ?? true,
|
|
49
|
+
resumeLatencyThresholdMs: config.resumeLatencyThresholdMs ?? 50,
|
|
50
|
+
enableMetrics: config.enableMetrics ?? true
|
|
51
|
+
};
|
|
52
|
+
this.agentQueues = new Map();
|
|
53
|
+
this.channelSubscriptions = new Map();
|
|
54
|
+
this.resumeLatencies = [];
|
|
55
|
+
this.cleanupHandlers = [];
|
|
56
|
+
this.metrics = {
|
|
57
|
+
totalAutoPauses: 0,
|
|
58
|
+
totalAutoResumes: 0,
|
|
59
|
+
avgResumeLatencyMs: 0,
|
|
60
|
+
p95ResumeLatencyMs: 0,
|
|
61
|
+
p99ResumeLatencyMs: 0,
|
|
62
|
+
totalTokensSaved: 0,
|
|
63
|
+
activeSubscriptions: 0,
|
|
64
|
+
failedResumes: 0
|
|
65
|
+
};
|
|
66
|
+
this.setupMessageBusListeners();
|
|
67
|
+
this.logger.info('QueryMessageIntegration initialized', {
|
|
68
|
+
autoPause: this.config.autoPauseOnQueueEmpty,
|
|
69
|
+
autoResume: this.config.autoResumeOnMessage,
|
|
70
|
+
latencyThreshold: this.config.resumeLatencyThresholdMs
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
// ============================================
|
|
74
|
+
// Message Bus Event Listeners
|
|
75
|
+
// ============================================
|
|
76
|
+
/**
|
|
77
|
+
* Setup message bus event listeners for agent lifecycle management
|
|
78
|
+
*/ setupMessageBusListeners() {
|
|
79
|
+
// 1. Queue empty → Auto-pause agent (zero token cost)
|
|
80
|
+
const onQueueEmpty = async (data)=>{
|
|
81
|
+
if (!this.config.autoPauseOnQueueEmpty) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const { channelId, agentIds } = data;
|
|
85
|
+
const targetAgents = agentIds || this.channelSubscriptions.get(channelId) || [];
|
|
86
|
+
for (const agentId of targetAgents){
|
|
87
|
+
await this.autoPauseAgent(agentId, channelId, 'queue-empty');
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
this.config.messageBus.on('queue-empty', onQueueEmpty);
|
|
91
|
+
this.cleanupHandlers.push(()=>this.config.messageBus.off('queue-empty', onQueueEmpty));
|
|
92
|
+
// 2. Message arrived → Auto-resume agent (<50ms)
|
|
93
|
+
const onMessageArrived = async (data)=>{
|
|
94
|
+
if (!this.config.autoResumeOnMessage) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const { channelId, message, targetAgentId } = data;
|
|
98
|
+
// Determine target agent from message or channel subscribers
|
|
99
|
+
const agentId = targetAgentId || this.extractTargetAgent(message, channelId);
|
|
100
|
+
if (agentId) {
|
|
101
|
+
await this.autoResumeAgent(agentId, channelId, message);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
this.config.messageBus.on('message-arrived', onMessageArrived);
|
|
105
|
+
this.cleanupHandlers.push(()=>this.config.messageBus.off('message-arrived', onMessageArrived));
|
|
106
|
+
// 3. Message delivered → Update queue state
|
|
107
|
+
const onMessageDelivered = async (data)=>{
|
|
108
|
+
const agentId = data.subscriber.id;
|
|
109
|
+
const queueState = this.agentQueues.get(agentId);
|
|
110
|
+
if (queueState) {
|
|
111
|
+
// Remove delivered message from pending
|
|
112
|
+
queueState.pendingMessages = queueState.pendingMessages.filter((m)=>m.id !== data.message.id);
|
|
113
|
+
queueState.queueDepth = queueState.pendingMessages.length;
|
|
114
|
+
queueState.lastActivity = Date.now();
|
|
115
|
+
// Check if queue is now empty → Auto-pause
|
|
116
|
+
if (queueState.queueDepth === 0 && !queueState.isPaused) {
|
|
117
|
+
await this.autoPauseAgent(agentId, queueState.channelId, 'message-delivered-queue-empty');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
this.config.messageBus.on('message:delivered', onMessageDelivered);
|
|
122
|
+
this.cleanupHandlers.push(()=>this.config.messageBus.off('message:delivered', onMessageDelivered));
|
|
123
|
+
this.logger.debug('Message bus event listeners registered');
|
|
124
|
+
}
|
|
125
|
+
// ============================================
|
|
126
|
+
// Agent Lifecycle Management
|
|
127
|
+
// ============================================
|
|
128
|
+
/**
|
|
129
|
+
* Auto-pause agent when queue is empty (zero token cost)
|
|
130
|
+
*/ async autoPauseAgent(agentId, channelId, reason) {
|
|
131
|
+
const queueState = this.agentQueues.get(agentId);
|
|
132
|
+
// Skip if agent doesn't exist or already paused
|
|
133
|
+
if (!queueState || queueState.isPaused) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
// Verify queue is actually empty
|
|
137
|
+
if (queueState.queueDepth > 0) {
|
|
138
|
+
this.logger.warn('Attempted to pause agent with non-empty queue', {
|
|
139
|
+
agentId,
|
|
140
|
+
queueDepth: queueState.queueDepth
|
|
141
|
+
});
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
// Pause agent via QueryController
|
|
146
|
+
await this.config.queryController.pauseAgent(agentId, `Auto-pause: ${reason}`);
|
|
147
|
+
// Update queue state
|
|
148
|
+
queueState.isPaused = true;
|
|
149
|
+
// Update metrics
|
|
150
|
+
this.metrics.totalAutoPauses++;
|
|
151
|
+
// Estimate token savings (assuming avg 50 tokens/sec for active agent)
|
|
152
|
+
const idleTimeMs = Date.now() - queueState.lastActivity;
|
|
153
|
+
const tokensSaved = Math.floor(idleTimeMs / 1000 * 50); // 50 tokens/sec
|
|
154
|
+
this.metrics.totalTokensSaved += tokensSaved;
|
|
155
|
+
this.logger.debug('Agent auto-paused (zero token cost)', {
|
|
156
|
+
agentId,
|
|
157
|
+
channelId,
|
|
158
|
+
reason,
|
|
159
|
+
tokensSaved
|
|
160
|
+
});
|
|
161
|
+
this.emit('agent:auto-paused', {
|
|
162
|
+
agentId,
|
|
163
|
+
channelId,
|
|
164
|
+
reason,
|
|
165
|
+
tokensSaved
|
|
166
|
+
});
|
|
167
|
+
} catch (error) {
|
|
168
|
+
this.logger.error('Failed to auto-pause agent', {
|
|
169
|
+
agentId,
|
|
170
|
+
error: error instanceof Error ? error.message : String(error)
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Auto-resume agent on message arrival (<50ms latency)
|
|
176
|
+
*/ async autoResumeAgent(agentId, channelId, message) {
|
|
177
|
+
const startTime = Date.now();
|
|
178
|
+
const queueState = this.agentQueues.get(agentId);
|
|
179
|
+
// Skip if agent doesn't exist or not paused
|
|
180
|
+
if (!queueState || !queueState.isPaused) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
try {
|
|
184
|
+
// Resume agent via QueryController
|
|
185
|
+
await this.config.queryController.resumeAgent(agentId);
|
|
186
|
+
// Update queue state
|
|
187
|
+
queueState.isPaused = false;
|
|
188
|
+
queueState.pendingMessages.push(message);
|
|
189
|
+
queueState.queueDepth = queueState.pendingMessages.length;
|
|
190
|
+
queueState.lastActivity = Date.now();
|
|
191
|
+
// Calculate resume latency
|
|
192
|
+
const latencyMs = Date.now() - startTime;
|
|
193
|
+
this.trackResumeLatency(latencyMs);
|
|
194
|
+
// Update metrics
|
|
195
|
+
this.metrics.totalAutoResumes++;
|
|
196
|
+
this.logger.debug('Agent auto-resumed on message arrival', {
|
|
197
|
+
agentId,
|
|
198
|
+
channelId,
|
|
199
|
+
messageId: message.id,
|
|
200
|
+
latencyMs
|
|
201
|
+
});
|
|
202
|
+
// Emit warning if latency exceeds threshold
|
|
203
|
+
if (latencyMs > this.config.resumeLatencyThresholdMs) {
|
|
204
|
+
this.logger.warn('Resume latency exceeded threshold', {
|
|
205
|
+
agentId,
|
|
206
|
+
latencyMs,
|
|
207
|
+
threshold: this.config.resumeLatencyThresholdMs
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
this.emit('agent:auto-resumed', {
|
|
211
|
+
agentId,
|
|
212
|
+
channelId,
|
|
213
|
+
message,
|
|
214
|
+
latencyMs
|
|
215
|
+
});
|
|
216
|
+
} catch (error) {
|
|
217
|
+
this.metrics.failedResumes++;
|
|
218
|
+
this.logger.error('Failed to auto-resume agent', {
|
|
219
|
+
agentId,
|
|
220
|
+
error: error instanceof Error ? error.message : String(error)
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
// ============================================
|
|
225
|
+
// Agent Registration
|
|
226
|
+
// ============================================
|
|
227
|
+
/**
|
|
228
|
+
* Register agent for message-driven lifecycle management
|
|
229
|
+
*
|
|
230
|
+
* @param agentId - Agent ID
|
|
231
|
+
* @param sessionId - Session ID
|
|
232
|
+
* @param channelId - Message channel ID
|
|
233
|
+
*/ registerAgent(agentId, sessionId, channelId) {
|
|
234
|
+
// Create queue state
|
|
235
|
+
const queueState = {
|
|
236
|
+
agentId,
|
|
237
|
+
sessionId,
|
|
238
|
+
channelId,
|
|
239
|
+
queueDepth: 0,
|
|
240
|
+
lastActivity: Date.now(),
|
|
241
|
+
isPaused: false,
|
|
242
|
+
pendingMessages: []
|
|
243
|
+
};
|
|
244
|
+
this.agentQueues.set(agentId, queueState);
|
|
245
|
+
// Add to channel subscriptions
|
|
246
|
+
if (!this.channelSubscriptions.has(channelId)) {
|
|
247
|
+
this.channelSubscriptions.set(channelId, []);
|
|
248
|
+
}
|
|
249
|
+
this.channelSubscriptions.get(channelId).push(agentId);
|
|
250
|
+
this.metrics.activeSubscriptions++;
|
|
251
|
+
this.logger.debug('Agent registered for message-driven lifecycle', {
|
|
252
|
+
agentId,
|
|
253
|
+
sessionId,
|
|
254
|
+
channelId
|
|
255
|
+
});
|
|
256
|
+
this.emit('agent:registered', {
|
|
257
|
+
agentId,
|
|
258
|
+
sessionId,
|
|
259
|
+
channelId
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Unregister agent from message-driven lifecycle management
|
|
264
|
+
*
|
|
265
|
+
* @param agentId - Agent ID
|
|
266
|
+
*/ unregisterAgent(agentId) {
|
|
267
|
+
const queueState = this.agentQueues.get(agentId);
|
|
268
|
+
if (!queueState) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
// Remove from channel subscriptions
|
|
272
|
+
const channelAgents = this.channelSubscriptions.get(queueState.channelId);
|
|
273
|
+
if (channelAgents) {
|
|
274
|
+
const index = channelAgents.indexOf(agentId);
|
|
275
|
+
if (index !== -1) {
|
|
276
|
+
channelAgents.splice(index, 1);
|
|
277
|
+
}
|
|
278
|
+
// Remove channel if no agents left
|
|
279
|
+
if (channelAgents.length === 0) {
|
|
280
|
+
this.channelSubscriptions.delete(queueState.channelId);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// Remove queue state
|
|
284
|
+
this.agentQueues.delete(agentId);
|
|
285
|
+
this.metrics.activeSubscriptions--;
|
|
286
|
+
this.logger.debug('Agent unregistered from message-driven lifecycle', {
|
|
287
|
+
agentId,
|
|
288
|
+
channelId: queueState.channelId
|
|
289
|
+
});
|
|
290
|
+
this.emit('agent:unregistered', {
|
|
291
|
+
agentId
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
// ============================================
|
|
295
|
+
// Utilities
|
|
296
|
+
// ============================================
|
|
297
|
+
/**
|
|
298
|
+
* Extract target agent from message or channel
|
|
299
|
+
*/ extractTargetAgent(message, channelId) {
|
|
300
|
+
// Check message recipients
|
|
301
|
+
if (message.receivers && message.receivers.length > 0) {
|
|
302
|
+
return message.receivers[0].id;
|
|
303
|
+
}
|
|
304
|
+
// Get first subscribed agent on channel
|
|
305
|
+
const channelAgents = this.channelSubscriptions.get(channelId);
|
|
306
|
+
if (channelAgents && channelAgents.length > 0) {
|
|
307
|
+
return channelAgents[0];
|
|
308
|
+
}
|
|
309
|
+
return undefined;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Track resume latency for metrics
|
|
313
|
+
*/ trackResumeLatency(latencyMs) {
|
|
314
|
+
this.resumeLatencies.push(latencyMs);
|
|
315
|
+
// Keep only last 1000 latencies
|
|
316
|
+
if (this.resumeLatencies.length > 1000) {
|
|
317
|
+
this.resumeLatencies.shift();
|
|
318
|
+
}
|
|
319
|
+
// Update average
|
|
320
|
+
const sum = this.resumeLatencies.reduce((acc, val)=>acc + val, 0);
|
|
321
|
+
this.metrics.avgResumeLatencyMs = sum / this.resumeLatencies.length;
|
|
322
|
+
// Update p95 and p99
|
|
323
|
+
const sorted = [
|
|
324
|
+
...this.resumeLatencies
|
|
325
|
+
].sort((a, b)=>a - b);
|
|
326
|
+
const p95Index = Math.floor(sorted.length * 0.95);
|
|
327
|
+
const p99Index = Math.floor(sorted.length * 0.99);
|
|
328
|
+
this.metrics.p95ResumeLatencyMs = sorted[p95Index] || 0;
|
|
329
|
+
this.metrics.p99ResumeLatencyMs = sorted[p99Index] || 0;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Get agent queue state
|
|
333
|
+
*/ getAgentQueueState(agentId) {
|
|
334
|
+
return this.agentQueues.get(agentId);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Get all agents on channel
|
|
338
|
+
*/ getChannelAgents(channelId) {
|
|
339
|
+
return this.channelSubscriptions.get(channelId) || [];
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Check if agent is paused
|
|
343
|
+
*/ isAgentPaused(agentId) {
|
|
344
|
+
const queueState = this.agentQueues.get(agentId);
|
|
345
|
+
return queueState?.isPaused ?? false;
|
|
346
|
+
}
|
|
347
|
+
// ============================================
|
|
348
|
+
// Metrics and Monitoring
|
|
349
|
+
// ============================================
|
|
350
|
+
/**
|
|
351
|
+
* Get integration metrics
|
|
352
|
+
*/ getMetrics() {
|
|
353
|
+
return {
|
|
354
|
+
...this.metrics
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Get health status
|
|
359
|
+
*/ getHealthStatus() {
|
|
360
|
+
const metrics = this.getMetrics();
|
|
361
|
+
const issues = [];
|
|
362
|
+
// Check resume latency
|
|
363
|
+
if (metrics.p95ResumeLatencyMs > this.config.resumeLatencyThresholdMs) {
|
|
364
|
+
issues.push(`High resume latency: p95 ${metrics.p95ResumeLatencyMs}ms (threshold: ${this.config.resumeLatencyThresholdMs}ms)`);
|
|
365
|
+
}
|
|
366
|
+
// Check failed resumes
|
|
367
|
+
const totalResumes = metrics.totalAutoResumes + metrics.failedResumes;
|
|
368
|
+
const failureRate = totalResumes > 0 ? metrics.failedResumes / totalResumes : 0;
|
|
369
|
+
if (failureRate > 0.05) {
|
|
370
|
+
issues.push(`High resume failure rate: ${(failureRate * 100).toFixed(1)}%`);
|
|
371
|
+
}
|
|
372
|
+
return {
|
|
373
|
+
healthy: issues.length === 0,
|
|
374
|
+
issues,
|
|
375
|
+
metrics
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Reset metrics
|
|
380
|
+
*/ resetMetrics() {
|
|
381
|
+
this.metrics = {
|
|
382
|
+
totalAutoPauses: 0,
|
|
383
|
+
totalAutoResumes: 0,
|
|
384
|
+
avgResumeLatencyMs: 0,
|
|
385
|
+
p95ResumeLatencyMs: 0,
|
|
386
|
+
p99ResumeLatencyMs: 0,
|
|
387
|
+
totalTokensSaved: 0,
|
|
388
|
+
activeSubscriptions: this.metrics.activeSubscriptions,
|
|
389
|
+
failedResumes: 0
|
|
390
|
+
};
|
|
391
|
+
this.resumeLatencies = [];
|
|
392
|
+
this.logger.info('Metrics reset');
|
|
393
|
+
}
|
|
394
|
+
// ============================================
|
|
395
|
+
// Lifecycle Management
|
|
396
|
+
// ============================================
|
|
397
|
+
/**
|
|
398
|
+
* Cleanup integration
|
|
399
|
+
*/ async cleanup() {
|
|
400
|
+
this.logger.info('Cleaning up query-message integration');
|
|
401
|
+
// Remove message bus listeners
|
|
402
|
+
for (const cleanup of this.cleanupHandlers){
|
|
403
|
+
cleanup();
|
|
404
|
+
}
|
|
405
|
+
this.cleanupHandlers = [];
|
|
406
|
+
// Clear state
|
|
407
|
+
this.agentQueues.clear();
|
|
408
|
+
this.channelSubscriptions.clear();
|
|
409
|
+
this.resumeLatencies = [];
|
|
410
|
+
this.removeAllListeners();
|
|
411
|
+
this.logger.info('Query-message integration cleanup complete');
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
//# sourceMappingURL=query-message-integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/sdk/query-message-integration.ts"],"names":["EventEmitter","Logger","QueryMessageIntegration","logger","config","agentQueues","channelSubscriptions","resumeLatencies","metrics","cleanupHandlers","level","format","destination","autoPauseOnQueueEmpty","autoResumeOnMessage","resumeLatencyThresholdMs","enableMetrics","Map","totalAutoPauses","totalAutoResumes","avgResumeLatencyMs","p95ResumeLatencyMs","p99ResumeLatencyMs","totalTokensSaved","activeSubscriptions","failedResumes","setupMessageBusListeners","info","autoPause","autoResume","latencyThreshold","onQueueEmpty","data","channelId","agentIds","targetAgents","get","agentId","autoPauseAgent","messageBus","on","push","off","onMessageArrived","message","targetAgentId","extractTargetAgent","autoResumeAgent","onMessageDelivered","subscriber","id","queueState","pendingMessages","filter","m","queueDepth","length","lastActivity","Date","now","isPaused","debug","reason","warn","queryController","pauseAgent","idleTimeMs","tokensSaved","Math","floor","emit","error","Error","String","startTime","resumeAgent","latencyMs","trackResumeLatency","messageId","threshold","registerAgent","sessionId","set","has","unregisterAgent","channelAgents","index","indexOf","splice","delete","receivers","undefined","shift","sum","reduce","acc","val","sorted","sort","a","b","p95Index","p99Index","getAgentQueueState","getChannelAgents","isAgentPaused","getMetrics","getHealthStatus","issues","totalResumes","failureRate","toFixed","healthy","resetMetrics","cleanup","clear","removeAllListeners"],"mappings":"AAAA;;;;;;;;;;;;;CAaC,GAED,SAASA,YAAY,QAAQ,cAAc;AAI3C,SAASC,MAAM,QAAQ,0BAA0B;AAoEjD;;;;;;;;;;;;;;CAcC,GACD,OAAO,MAAMC,gCAAgCF;IAC1BG,OAAe;IACfC,OAAqC;IAE9CC,YAA0C;IAC1CC,qBAA4C;IAC5CC,gBAA0B;IAC1BC,QAA6B;IAE7BC,gBAAgC;IAExC,YAAYL,MAA0B,CAAE;QACtC,KAAK;QAEL,IAAI,CAACD,MAAM,GAAG,IAAIF,OAAO;YACvBS,OAAO;YACPC,QAAQ;YACRC,aAAa;QACf;QAEA,IAAI,CAACR,MAAM,GAAG;YACZ,GAAGA,MAAM;YACTS,uBAAuBT,OAAOS,qBAAqB,IAAI;YACvDC,qBAAqBV,OAAOU,mBAAmB,IAAI;YACnDC,0BAA0BX,OAAOW,wBAAwB,IAAI;YAC7DC,eAAeZ,OAAOY,aAAa,IAAI;QACzC;QAEA,IAAI,CAACX,WAAW,GAAG,IAAIY;QACvB,IAAI,CAACX,oBAAoB,GAAG,IAAIW;QAChC,IAAI,CAACV,eAAe,GAAG,EAAE;QACzB,IAAI,CAACE,eAAe,GAAG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