claude-flow-novice 1.6.4 → 1.6.6
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/mcp-server-sdk.js +45 -0
- 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/config/.env.example +178 -0
- package/config/DEPLOYMENT_GUIDE.md +692 -0
- package/config/README-CONFIG.md +331 -0
- package/config/coordination-config.sh +327 -0
- package/config/docker/env.development +53 -0
- package/config/docker/env.production +83 -0
- package/config/docker/env.staging +70 -0
- package/config/k8s/configmap-development.yaml +60 -0
- package/config/k8s/configmap-production.yaml +85 -0
- package/config/k8s/configmap-staging.yaml +76 -0
- package/config/k8s/secret-production.yaml +62 -0
- package/config/k8s/secret-staging.yaml +36 -0
- package/package.json +2 -2
- package/scripts/monitoring/alert-monitor.sh +220 -0
- package/scripts/monitoring/dashboards/rate-limiting-dashboard.json +211 -0
- package/scripts/monitoring/quick-test-alerting.sh +118 -0
- package/scripts/monitoring/quick-test-rate-limiting.sh +206 -0
- package/scripts/monitoring/rate-limiting-monitor.sh +380 -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,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Coordination V2 - Topological Sort Implementation
|
|
3
|
+
*
|
|
4
|
+
* Kahn's algorithm for topological sorting of dependency graphs.
|
|
5
|
+
* Provides O(V+E) complexity for computing execution ordering.
|
|
6
|
+
*
|
|
7
|
+
* @module coordination/v2/dependency/topological-sort
|
|
8
|
+
*/ /**
|
|
9
|
+
* Topological Sort using Kahn's Algorithm.
|
|
10
|
+
*
|
|
11
|
+
* Kahn's algorithm works by:
|
|
12
|
+
* 1. Computing in-degree for all nodes
|
|
13
|
+
* 2. Starting with nodes having in-degree 0 (no dependencies)
|
|
14
|
+
* 3. Removing nodes from queue and decrementing in-degrees
|
|
15
|
+
* 4. Adding nodes with in-degree 0 to queue
|
|
16
|
+
* 5. Repeating until all nodes processed or cycle detected
|
|
17
|
+
*
|
|
18
|
+
* Time Complexity: O(V + E)
|
|
19
|
+
* Space Complexity: O(V)
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const sorter = new TopologicalSort(graph);
|
|
24
|
+
* const result = sorter.sort();
|
|
25
|
+
*
|
|
26
|
+
* if (result.success) {
|
|
27
|
+
* console.log('Execution order:', result.order);
|
|
28
|
+
* } else {
|
|
29
|
+
* console.error('Cycle detected:', result.cycles);
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/ export class TopologicalSort {
|
|
33
|
+
graph;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new topological sorter.
|
|
36
|
+
*
|
|
37
|
+
* @param graph - Dependency graph to sort
|
|
38
|
+
*/ constructor(graph){
|
|
39
|
+
this.graph = graph;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Performs topological sort using Kahn's algorithm.
|
|
43
|
+
*
|
|
44
|
+
* Returns nodes in dependency order (dependencies before dependents).
|
|
45
|
+
* If graph contains cycles, sort fails and cycles are reported.
|
|
46
|
+
*
|
|
47
|
+
* Algorithm:
|
|
48
|
+
* 1. Calculate in-degree for each node (count of incoming edges)
|
|
49
|
+
* 2. Queue all nodes with in-degree 0 (no dependencies)
|
|
50
|
+
* 3. While queue not empty:
|
|
51
|
+
* a. Dequeue node and add to result
|
|
52
|
+
* b. For each dependent of node:
|
|
53
|
+
* - Decrement its in-degree
|
|
54
|
+
* - If in-degree becomes 0, enqueue it
|
|
55
|
+
* 4. If result contains all nodes → success
|
|
56
|
+
* Else → cycle exists
|
|
57
|
+
*
|
|
58
|
+
* @returns Topological sort result
|
|
59
|
+
*/ sort() {
|
|
60
|
+
const inDegree = new Map();
|
|
61
|
+
const queue = [];
|
|
62
|
+
const result = [];
|
|
63
|
+
// Step 1: Initialize in-degrees
|
|
64
|
+
for (const nodeId of this.graph.getAllNodes().map((n)=>n.id)){
|
|
65
|
+
const dependencies = this.graph.getDependencies(nodeId);
|
|
66
|
+
inDegree.set(nodeId, dependencies.size);
|
|
67
|
+
// Step 2: Enqueue nodes with no dependencies
|
|
68
|
+
if (dependencies.size === 0) {
|
|
69
|
+
queue.push(nodeId);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Step 3: Process nodes with zero in-degree (BFS)
|
|
73
|
+
while(queue.length > 0){
|
|
74
|
+
const nodeId = queue.shift();
|
|
75
|
+
result.push(nodeId);
|
|
76
|
+
// Step 4: Update in-degrees for dependents
|
|
77
|
+
const dependents = this.graph.getDependents(nodeId);
|
|
78
|
+
for (const dependentId of dependents){
|
|
79
|
+
const currentInDegree = inDegree.get(dependentId);
|
|
80
|
+
const newInDegree = currentInDegree - 1;
|
|
81
|
+
inDegree.set(dependentId, newInDegree);
|
|
82
|
+
// Enqueue if all dependencies satisfied
|
|
83
|
+
if (newInDegree === 0) {
|
|
84
|
+
queue.push(dependentId);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Step 5: Validate result (all nodes processed?)
|
|
89
|
+
const totalNodes = this.graph.size();
|
|
90
|
+
const success = result.length === totalNodes;
|
|
91
|
+
if (!success) {
|
|
92
|
+
// Cycle detected - identify cycles
|
|
93
|
+
const cycleDetection = this.graph.detectCycles();
|
|
94
|
+
return {
|
|
95
|
+
order: result,
|
|
96
|
+
success: false,
|
|
97
|
+
error: `Cannot compute topological order: graph contains cycles. Processed ${result.length}/${totalNodes} nodes.`,
|
|
98
|
+
cycles: cycleDetection.cycles
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
order: result,
|
|
103
|
+
success: true
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Validates if graph is acyclic (DAG).
|
|
108
|
+
*
|
|
109
|
+
* @returns True if graph is a DAG (can be topologically sorted)
|
|
110
|
+
*/ isDAG() {
|
|
111
|
+
return this.sort().success;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Gets ready nodes (nodes with all dependencies satisfied).
|
|
115
|
+
*
|
|
116
|
+
* This is useful for incremental execution - get next batch of
|
|
117
|
+
* executable tasks without sorting the entire graph.
|
|
118
|
+
*
|
|
119
|
+
* @param completed - Set of already completed node IDs
|
|
120
|
+
* @returns Array of node IDs ready for execution
|
|
121
|
+
*/ getReadyNodes(completed) {
|
|
122
|
+
const ready = [];
|
|
123
|
+
for (const node of this.graph.getAllNodes()){
|
|
124
|
+
// Skip completed nodes
|
|
125
|
+
if (completed.has(node.id)) {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
// Check if all dependencies are completed
|
|
129
|
+
const dependencies = this.graph.getDependencies(node.id);
|
|
130
|
+
let allDepsCompleted = true;
|
|
131
|
+
for (const depId of dependencies){
|
|
132
|
+
if (!completed.has(depId)) {
|
|
133
|
+
allDepsCompleted = false;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (allDepsCompleted) {
|
|
138
|
+
ready.push(node.id);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return ready;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Computes partial topological order for a subset of nodes.
|
|
145
|
+
*
|
|
146
|
+
* This is useful when you only care about ordering a subset of nodes
|
|
147
|
+
* (e.g., tasks for a specific agent).
|
|
148
|
+
*
|
|
149
|
+
* @param nodeIds - Subset of node IDs to order
|
|
150
|
+
* @returns Topological order for subset (or null if cycles exist)
|
|
151
|
+
*/ sortSubset(nodeIds) {
|
|
152
|
+
const subsetInDegree = new Map();
|
|
153
|
+
const queue = [];
|
|
154
|
+
const result = [];
|
|
155
|
+
// Initialize in-degrees for subset only
|
|
156
|
+
for (const nodeId of nodeIds){
|
|
157
|
+
const dependencies = this.graph.getDependencies(nodeId);
|
|
158
|
+
// Count dependencies within subset
|
|
159
|
+
let inDegreeCount = 0;
|
|
160
|
+
for (const depId of dependencies){
|
|
161
|
+
if (nodeIds.has(depId)) {
|
|
162
|
+
inDegreeCount++;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
subsetInDegree.set(nodeId, inDegreeCount);
|
|
166
|
+
if (inDegreeCount === 0) {
|
|
167
|
+
queue.push(nodeId);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// BFS processing
|
|
171
|
+
while(queue.length > 0){
|
|
172
|
+
const nodeId = queue.shift();
|
|
173
|
+
result.push(nodeId);
|
|
174
|
+
const dependents = this.graph.getDependents(nodeId);
|
|
175
|
+
for (const dependentId of dependents){
|
|
176
|
+
if (!nodeIds.has(dependentId)) continue;
|
|
177
|
+
const currentInDegree = subsetInDegree.get(dependentId);
|
|
178
|
+
const newInDegree = currentInDegree - 1;
|
|
179
|
+
subsetInDegree.set(dependentId, newInDegree);
|
|
180
|
+
if (newInDegree === 0) {
|
|
181
|
+
queue.push(dependentId);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// Validate complete
|
|
186
|
+
if (result.length !== nodeIds.size) {
|
|
187
|
+
return null; // Cycle in subset
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Computes execution levels (nodes at same depth can run in parallel).
|
|
193
|
+
*
|
|
194
|
+
* Returns nodes grouped by execution level:
|
|
195
|
+
* - Level 0: Nodes with no dependencies
|
|
196
|
+
* - Level 1: Nodes depending only on Level 0
|
|
197
|
+
* - Level N: Nodes depending on Level N-1 or earlier
|
|
198
|
+
*
|
|
199
|
+
* @returns Array of levels, each containing node IDs at that level
|
|
200
|
+
*/ computeLevels() {
|
|
201
|
+
const levels = [];
|
|
202
|
+
const nodeLevel = new Map();
|
|
203
|
+
const completed = new Set();
|
|
204
|
+
// Process nodes level by level
|
|
205
|
+
let currentLevel = 0;
|
|
206
|
+
while(completed.size < this.graph.size()){
|
|
207
|
+
const levelNodes = this.getReadyNodes(completed);
|
|
208
|
+
if (levelNodes.length === 0) {
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
levels.push(levelNodes);
|
|
212
|
+
// Mark nodes as completed and assign level
|
|
213
|
+
for (const nodeId of levelNodes){
|
|
214
|
+
completed.add(nodeId);
|
|
215
|
+
nodeLevel.set(nodeId, currentLevel);
|
|
216
|
+
}
|
|
217
|
+
currentLevel++;
|
|
218
|
+
}
|
|
219
|
+
return levels;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
//# sourceMappingURL=topological-sort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/dependency/topological-sort.ts"],"names":["TopologicalSort","graph","sort","inDegree","Map","queue","result","nodeId","getAllNodes","map","n","id","dependencies","getDependencies","set","size","push","length","shift","dependents","getDependents","dependentId","currentInDegree","get","newInDegree","totalNodes","success","cycleDetection","detectCycles","order","error","cycles","isDAG","getReadyNodes","completed","ready","node","has","allDepsCompleted","depId","sortSubset","nodeIds","subsetInDegree","inDegreeCount","computeLevels","levels","nodeLevel","Set","currentLevel","levelNodes","add"],"mappings":"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"}
|
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Coordination V2 - Help Coordinator
|
|
3
|
+
*
|
|
4
|
+
* Help routing and lifecycle management with MessageBroker integration.
|
|
5
|
+
* Target: <200ms p95 latency for routing help requests to best-match agents.
|
|
6
|
+
*
|
|
7
|
+
* @module coordination/v2/help-system/help-coordinator
|
|
8
|
+
*/ import { HelpRequest, HelpRequestPriority } from './help-request.js';
|
|
9
|
+
import { HelpMatcher } from './help-matcher.js';
|
|
10
|
+
import { MessagePriority } from '../core/message.js';
|
|
11
|
+
/**
|
|
12
|
+
* Help coordinator implementation with routing and lifecycle management
|
|
13
|
+
*/ export class HelpCoordinator {
|
|
14
|
+
/** Help request matcher */ matcher;
|
|
15
|
+
/** Active help requests */ activeRequests;
|
|
16
|
+
/** Request queue (overflow when max concurrent reached) */ requestQueue;
|
|
17
|
+
/** Routing results history */ routingHistory;
|
|
18
|
+
/** Coordinator configuration */ config;
|
|
19
|
+
/** Performance metrics */ metrics;
|
|
20
|
+
/** Recent routing latencies for percentile calculation */ recentLatencies;
|
|
21
|
+
/** Request ID counter */ requestCounter;
|
|
22
|
+
constructor(config){
|
|
23
|
+
this.matcher = new HelpMatcher(config?.matcherConfig);
|
|
24
|
+
this.activeRequests = new Map();
|
|
25
|
+
this.requestQueue = [];
|
|
26
|
+
this.routingHistory = [];
|
|
27
|
+
this.recentLatencies = [];
|
|
28
|
+
this.requestCounter = 0;
|
|
29
|
+
this.config = {
|
|
30
|
+
matcherConfig: config?.matcherConfig ?? {},
|
|
31
|
+
maxConcurrentRequests: config?.maxConcurrentRequests ?? 100,
|
|
32
|
+
autoRetry: config?.autoRetry ?? true,
|
|
33
|
+
maxRoutingAttempts: config?.maxRoutingAttempts ?? 3,
|
|
34
|
+
enableQueue: config?.enableQueue ?? true,
|
|
35
|
+
maxQueueSize: config?.maxQueueSize ?? 500,
|
|
36
|
+
messageBroker: config?.messageBroker,
|
|
37
|
+
enableEventPublishing: config?.enableEventPublishing ?? config?.messageBroker !== undefined
|
|
38
|
+
};
|
|
39
|
+
this.metrics = {
|
|
40
|
+
totalRequests: 0,
|
|
41
|
+
successfulRoutes: 0,
|
|
42
|
+
failedRoutes: 0,
|
|
43
|
+
averageRoutingLatencyMs: 0,
|
|
44
|
+
p95RoutingLatencyMs: 0,
|
|
45
|
+
p99RoutingLatencyMs: 0,
|
|
46
|
+
activeRequests: 0,
|
|
47
|
+
queuedRequests: 0,
|
|
48
|
+
resolvedRequests: 0,
|
|
49
|
+
expiredRequests: 0
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create and route help request
|
|
54
|
+
* Target: <200ms p95 latency
|
|
55
|
+
*/ async createHelpRequest(requesterId, description, capabilities, priority = HelpRequestPriority.NORMAL, metadata) {
|
|
56
|
+
const startTime = performance.now();
|
|
57
|
+
// Generate unique request ID
|
|
58
|
+
const requestId = this.generateRequestId();
|
|
59
|
+
// Create help request
|
|
60
|
+
const request = new HelpRequest({
|
|
61
|
+
requestId,
|
|
62
|
+
requesterId,
|
|
63
|
+
priority,
|
|
64
|
+
capabilities,
|
|
65
|
+
description,
|
|
66
|
+
metadata
|
|
67
|
+
});
|
|
68
|
+
this.metrics.totalRequests++;
|
|
69
|
+
// Check concurrent request limit
|
|
70
|
+
if (this.activeRequests.size >= this.config.maxConcurrentRequests) {
|
|
71
|
+
if (this.config.enableQueue && this.requestQueue.length < this.config.maxQueueSize) {
|
|
72
|
+
this.requestQueue.push(request);
|
|
73
|
+
this.metrics.queuedRequests++;
|
|
74
|
+
return {
|
|
75
|
+
routingId: this.generateRoutingId(),
|
|
76
|
+
request,
|
|
77
|
+
match: null,
|
|
78
|
+
status: 'no_match',
|
|
79
|
+
latencyMs: performance.now() - startTime,
|
|
80
|
+
timestamp: new Date(),
|
|
81
|
+
error: 'Request queued - max concurrent requests reached'
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
routingId: this.generateRoutingId(),
|
|
86
|
+
request,
|
|
87
|
+
match: null,
|
|
88
|
+
status: 'failed',
|
|
89
|
+
latencyMs: performance.now() - startTime,
|
|
90
|
+
timestamp: new Date(),
|
|
91
|
+
error: 'Max concurrent requests reached and queue is full'
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
// Route request to best match
|
|
95
|
+
const result = await this.routeRequest(request);
|
|
96
|
+
const latency = performance.now() - startTime;
|
|
97
|
+
result.latencyMs = latency;
|
|
98
|
+
this.recordRoutingMetrics(latency, result.status === 'success');
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Route help request to best matching agent
|
|
103
|
+
*/ async routeRequest(request) {
|
|
104
|
+
const routingId = this.generateRoutingId();
|
|
105
|
+
const startTime = performance.now();
|
|
106
|
+
try {
|
|
107
|
+
// Find best match
|
|
108
|
+
const match = await this.matcher.findMatch(request);
|
|
109
|
+
if (!match) {
|
|
110
|
+
this.metrics.failedRoutes++;
|
|
111
|
+
return {
|
|
112
|
+
routingId,
|
|
113
|
+
request,
|
|
114
|
+
match: null,
|
|
115
|
+
status: 'no_match',
|
|
116
|
+
latencyMs: performance.now() - startTime,
|
|
117
|
+
timestamp: new Date(),
|
|
118
|
+
error: 'No matching agent found'
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
// Mark request as matched
|
|
122
|
+
request.markMatched(match.agentId);
|
|
123
|
+
// Track active request
|
|
124
|
+
this.activeRequests.set(request.requestId, request);
|
|
125
|
+
this.metrics.activeRequests = this.activeRequests.size;
|
|
126
|
+
this.metrics.successfulRoutes++;
|
|
127
|
+
const result = {
|
|
128
|
+
routingId,
|
|
129
|
+
request,
|
|
130
|
+
match,
|
|
131
|
+
status: 'success',
|
|
132
|
+
latencyMs: performance.now() - startTime,
|
|
133
|
+
timestamp: new Date()
|
|
134
|
+
};
|
|
135
|
+
this.routingHistory.push(result);
|
|
136
|
+
// Publish routing success event via MessageBroker
|
|
137
|
+
await this.publishRoutingEvent(result);
|
|
138
|
+
return result;
|
|
139
|
+
} catch (error) {
|
|
140
|
+
this.metrics.failedRoutes++;
|
|
141
|
+
return {
|
|
142
|
+
routingId,
|
|
143
|
+
request,
|
|
144
|
+
match: null,
|
|
145
|
+
status: 'failed',
|
|
146
|
+
latencyMs: performance.now() - startTime,
|
|
147
|
+
timestamp: new Date(),
|
|
148
|
+
error: error instanceof Error ? error.message : 'Unknown routing error'
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Mark help request as in progress
|
|
154
|
+
*/ async startHelp(requestId) {
|
|
155
|
+
const request = this.activeRequests.get(requestId);
|
|
156
|
+
if (!request) {
|
|
157
|
+
throw new Error(`Help request ${requestId} not found`);
|
|
158
|
+
}
|
|
159
|
+
request.markInProgress();
|
|
160
|
+
// Publish help started event
|
|
161
|
+
await this.publishHelpStartedEvent(request);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Mark help request as resolved
|
|
165
|
+
*/ async resolveHelp(requestId, metadata) {
|
|
166
|
+
const request = this.activeRequests.get(requestId);
|
|
167
|
+
if (!request) {
|
|
168
|
+
throw new Error(`Help request ${requestId} not found`);
|
|
169
|
+
}
|
|
170
|
+
request.markResolved(metadata);
|
|
171
|
+
this.activeRequests.delete(requestId);
|
|
172
|
+
this.metrics.activeRequests = this.activeRequests.size;
|
|
173
|
+
this.metrics.resolvedRequests++;
|
|
174
|
+
// Publish help resolved event
|
|
175
|
+
await this.publishHelpResolvedEvent(request, metadata);
|
|
176
|
+
// Process next queued request
|
|
177
|
+
this.processQueue();
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Mark help request as failed
|
|
181
|
+
*/ async failHelp(requestId, reason, metadata) {
|
|
182
|
+
const request = this.activeRequests.get(requestId);
|
|
183
|
+
if (!request) {
|
|
184
|
+
throw new Error(`Help request ${requestId} not found`);
|
|
185
|
+
}
|
|
186
|
+
request.markFailed(reason, metadata);
|
|
187
|
+
this.activeRequests.delete(requestId);
|
|
188
|
+
this.metrics.activeRequests = this.activeRequests.size;
|
|
189
|
+
// Publish help failed event
|
|
190
|
+
await this.publishHelpFailedEvent(request, reason, metadata);
|
|
191
|
+
// Retry if enabled and possible
|
|
192
|
+
if (this.config.autoRetry && request.canRetry()) {
|
|
193
|
+
const retried = await request.retry();
|
|
194
|
+
if (retried) {
|
|
195
|
+
// Re-route retried request
|
|
196
|
+
await this.routeRequest(request);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// Process next queued request
|
|
200
|
+
this.processQueue();
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Cancel help request
|
|
204
|
+
*/ async cancelHelp(requestId, reason) {
|
|
205
|
+
const request = this.activeRequests.get(requestId);
|
|
206
|
+
if (!request) {
|
|
207
|
+
throw new Error(`Help request ${requestId} not found`);
|
|
208
|
+
}
|
|
209
|
+
request.cancel(reason);
|
|
210
|
+
this.activeRequests.delete(requestId);
|
|
211
|
+
this.metrics.activeRequests = this.activeRequests.size;
|
|
212
|
+
// Process next queued request
|
|
213
|
+
this.processQueue();
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Get help request status
|
|
217
|
+
*/ getRequestStatus(requestId) {
|
|
218
|
+
const request = this.activeRequests.get(requestId);
|
|
219
|
+
return request ? request.status : null;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Get help request details
|
|
223
|
+
*/ getRequest(requestId) {
|
|
224
|
+
return this.activeRequests.get(requestId) || null;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Register agent profile for matching
|
|
228
|
+
*/ registerAgent(profile) {
|
|
229
|
+
this.matcher.registerAgent(profile);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Unregister agent profile
|
|
233
|
+
*/ unregisterAgent(agentId) {
|
|
234
|
+
this.matcher.unregisterAgent(agentId);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Update agent state
|
|
238
|
+
*/ updateAgentState(agentId, state) {
|
|
239
|
+
this.matcher.updateAgentState(agentId, state);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Update agent workload
|
|
243
|
+
*/ updateAgentWorkload(agentId, workload) {
|
|
244
|
+
this.matcher.updateAgentWorkload(agentId, workload);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Process queued requests
|
|
248
|
+
*/ async processQueue() {
|
|
249
|
+
if (this.requestQueue.length === 0) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (this.activeRequests.size >= this.config.maxConcurrentRequests) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
// Process highest priority queued request
|
|
256
|
+
this.requestQueue.sort((a, b)=>b.priority - a.priority);
|
|
257
|
+
const nextRequest = this.requestQueue.shift();
|
|
258
|
+
if (nextRequest) {
|
|
259
|
+
this.metrics.queuedRequests = this.requestQueue.length;
|
|
260
|
+
await this.routeRequest(nextRequest);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Record routing metrics
|
|
265
|
+
*/ recordRoutingMetrics(latencyMs, success) {
|
|
266
|
+
this.recentLatencies.push(latencyMs);
|
|
267
|
+
// Keep only last 1000 latencies
|
|
268
|
+
if (this.recentLatencies.length > 1000) {
|
|
269
|
+
this.recentLatencies.shift();
|
|
270
|
+
}
|
|
271
|
+
// Update average latency
|
|
272
|
+
const totalRoutes = this.metrics.successfulRoutes + this.metrics.failedRoutes;
|
|
273
|
+
this.metrics.averageRoutingLatencyMs = (this.metrics.averageRoutingLatencyMs * (totalRoutes - 1) + latencyMs) / totalRoutes;
|
|
274
|
+
// Update percentiles
|
|
275
|
+
const sorted = [
|
|
276
|
+
...this.recentLatencies
|
|
277
|
+
].sort((a, b)=>a - b);
|
|
278
|
+
this.metrics.p95RoutingLatencyMs = sorted[Math.floor(sorted.length * 0.95)] || 0;
|
|
279
|
+
this.metrics.p99RoutingLatencyMs = sorted[Math.floor(sorted.length * 0.99)] || 0;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Generate unique request ID
|
|
283
|
+
*/ generateRequestId() {
|
|
284
|
+
return `help_req_${Date.now()}_${++this.requestCounter}`;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Generate unique routing ID
|
|
288
|
+
*/ generateRoutingId() {
|
|
289
|
+
return `route_${Date.now()}_${this.requestCounter}`;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Get coordinator metrics
|
|
293
|
+
*/ getMetrics() {
|
|
294
|
+
return {
|
|
295
|
+
...this.metrics,
|
|
296
|
+
matcherMetrics: this.matcher.getMetrics()
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Get all active requests
|
|
301
|
+
*/ getActiveRequests() {
|
|
302
|
+
return Array.from(this.activeRequests.values());
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Get queued requests
|
|
306
|
+
*/ getQueuedRequests() {
|
|
307
|
+
return [
|
|
308
|
+
...this.requestQueue
|
|
309
|
+
];
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Get routing history
|
|
313
|
+
*/ getRoutingHistory(limit) {
|
|
314
|
+
return limit ? this.routingHistory.slice(-limit) : [
|
|
315
|
+
...this.routingHistory
|
|
316
|
+
];
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Clear coordinator state
|
|
320
|
+
*/ clear() {
|
|
321
|
+
this.activeRequests.clear();
|
|
322
|
+
this.requestQueue = [];
|
|
323
|
+
this.routingHistory = [];
|
|
324
|
+
this.matcher.clear();
|
|
325
|
+
this.recentLatencies = [];
|
|
326
|
+
this.requestCounter = 0;
|
|
327
|
+
this.metrics = {
|
|
328
|
+
totalRequests: 0,
|
|
329
|
+
successfulRoutes: 0,
|
|
330
|
+
failedRoutes: 0,
|
|
331
|
+
averageRoutingLatencyMs: 0,
|
|
332
|
+
p95RoutingLatencyMs: 0,
|
|
333
|
+
p99RoutingLatencyMs: 0,
|
|
334
|
+
activeRequests: 0,
|
|
335
|
+
queuedRequests: 0,
|
|
336
|
+
resolvedRequests: 0,
|
|
337
|
+
expiredRequests: 0
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
// ============================================
|
|
341
|
+
// MessageBroker Event Publishing
|
|
342
|
+
// ============================================
|
|
343
|
+
/**
|
|
344
|
+
* Publish routing event to MessageBroker
|
|
345
|
+
*/ async publishRoutingEvent(result) {
|
|
346
|
+
if (!this.config.enableEventPublishing || !this.config.messageBroker) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
try {
|
|
350
|
+
await this.config.messageBroker.publish({
|
|
351
|
+
topic: 'help.event.routed',
|
|
352
|
+
payload: {
|
|
353
|
+
routingId: result.routingId,
|
|
354
|
+
requestId: result.request.requestId,
|
|
355
|
+
requesterId: result.request.requesterId,
|
|
356
|
+
status: result.status,
|
|
357
|
+
latencyMs: result.latencyMs,
|
|
358
|
+
match: result.match ? {
|
|
359
|
+
agentId: result.match.agentId,
|
|
360
|
+
score: result.match.score
|
|
361
|
+
} : null,
|
|
362
|
+
timestamp: result.timestamp
|
|
363
|
+
},
|
|
364
|
+
priority: MessagePriority.LOW
|
|
365
|
+
});
|
|
366
|
+
} catch (error) {
|
|
367
|
+
console.error('[HelpCoordinator] Error publishing routing event:', error);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Publish help started event to MessageBroker
|
|
372
|
+
*/ async publishHelpStartedEvent(request) {
|
|
373
|
+
if (!this.config.enableEventPublishing || !this.config.messageBroker) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
try {
|
|
377
|
+
await this.config.messageBroker.publish({
|
|
378
|
+
topic: `help.accepted.${request.requestId}`,
|
|
379
|
+
payload: {
|
|
380
|
+
requestId: request.requestId,
|
|
381
|
+
helperId: request.matchedHelperId,
|
|
382
|
+
timestamp: new Date()
|
|
383
|
+
},
|
|
384
|
+
priority: MessagePriority.HIGH
|
|
385
|
+
});
|
|
386
|
+
} catch (error) {
|
|
387
|
+
console.error('[HelpCoordinator] Error publishing help started event:', error);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Publish help resolved event to MessageBroker
|
|
392
|
+
*/ async publishHelpResolvedEvent(request, metadata) {
|
|
393
|
+
if (!this.config.enableEventPublishing || !this.config.messageBroker) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
try {
|
|
397
|
+
await this.config.messageBroker.publish({
|
|
398
|
+
topic: `help.completed.${request.requestId}`,
|
|
399
|
+
payload: {
|
|
400
|
+
requestId: request.requestId,
|
|
401
|
+
helperId: request.matchedHelperId,
|
|
402
|
+
success: true,
|
|
403
|
+
result: metadata,
|
|
404
|
+
timestamp: new Date()
|
|
405
|
+
},
|
|
406
|
+
priority: MessagePriority.HIGH
|
|
407
|
+
});
|
|
408
|
+
} catch (error) {
|
|
409
|
+
console.error('[HelpCoordinator] Error publishing help resolved event:', error);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Publish help failed event to MessageBroker
|
|
414
|
+
*/ async publishHelpFailedEvent(request, reason, metadata) {
|
|
415
|
+
if (!this.config.enableEventPublishing || !this.config.messageBroker) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
try {
|
|
419
|
+
await this.config.messageBroker.publish({
|
|
420
|
+
topic: `help.completed.${request.requestId}`,
|
|
421
|
+
payload: {
|
|
422
|
+
requestId: request.requestId,
|
|
423
|
+
helperId: request.matchedHelperId,
|
|
424
|
+
success: false,
|
|
425
|
+
error: reason,
|
|
426
|
+
timestamp: new Date()
|
|
427
|
+
},
|
|
428
|
+
priority: MessagePriority.HIGH
|
|
429
|
+
});
|
|
430
|
+
} catch (error) {
|
|
431
|
+
console.error('[HelpCoordinator] Error publishing help failed event:', error);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
//# sourceMappingURL=help-coordinator.js.map
|