claude-flow-novice 1.6.4 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/parse-epic.js +180 -0
- package/.claude/settings.local.json +2 -1
- package/.claude-flow-novice/dist/mcp/mcp-server-novice.js +37 -2
- package/.claude-flow-novice/dist/mcp/transports/base.js +5 -0
- package/.claude-flow-novice/dist/mcp/transports/base.js.map +1 -0
- package/.claude-flow-novice/dist/mcp/transports/http.js +414 -0
- package/.claude-flow-novice/dist/mcp/transports/http.js.map +1 -0
- package/.claude-flow-novice/dist/mcp/transports/stdio.js +217 -0
- package/.claude-flow-novice/dist/mcp/transports/stdio.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/commands/parse-epic.js +129 -0
- package/.claude-flow-novice/dist/src/cli/commands/parse-epic.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/index.js +3 -0
- package/.claude-flow-novice/dist/src/cli/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/utils/epic-parser.js +266 -0
- package/.claude-flow-novice/dist/src/cli/utils/epic-parser.js.map +1 -0
- package/.claude-flow-novice/dist/src/communication/message-bus.js +105 -2
- package/.claude-flow-novice/dist/src/communication/message-bus.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +1 -1
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/artifact-cache-optimizer.js +632 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/artifact-cache-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/index.js +11 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/cache/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/checkpoints/checkpoint-compressor.js +318 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/checkpoints/checkpoint-compressor.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/completion-detector.js +234 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/completion-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/hierarchical-detector.js +347 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/hierarchical-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/index.js +13 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/lamport-clock.js +173 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/lamport-clock.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/mesh-detector.js +526 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/mesh-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/sdk-completion-detector.js +443 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/sdk-completion-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/swarm-shutdown.js +366 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/completion/swarm-shutdown.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinator-factory.js +287 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinator-factory.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.example.js +364 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.js +492 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/cascading-shutdown.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/hierarchical-coordinator.js +786 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/hierarchical-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/parent-child-manager.js +342 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/parent-child-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/swarm-coordinator-v2.js +601 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/agent-state.js +9 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/agent-state.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dead-letter-queue.js +413 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dead-letter-queue.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-graph.js +471 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-graph.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-node.js +379 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-node.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-resolver.js +335 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/dependency-resolver.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/help-request-metrics.js +211 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/help-request-metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/index.js +33 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-broker.js +920 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-broker.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-router.js +385 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message-router.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message.js +138 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/message.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/resource-manager-safe.js +478 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/resource-manager-safe.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine-config.js +358 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine-config.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine.js +588 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-machine.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-transition.js +153 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/state-transition.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/task-scheduler.js +360 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/task-scheduler.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/topic-manager.js +337 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/core/topic-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/deadlock-detector.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/deadlock-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/index.js +9 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/resource-manager.js +669 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/deadlock/resource-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/artifact-storage.js +451 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/artifact-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/cycle-detector.js +271 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/cycle-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-graph.js +335 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-graph.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-manager.js +439 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-request.js +92 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/index.js +21 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/topological-sort.js +223 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/dependency/topological-sort.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-coordinator.js +436 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-matcher.js +278 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-matcher.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request-handler.js +317 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request.js +273 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/help-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/index.js +15 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/waiting-agent-pool.js +512 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/help-system/waiting-agent-pool.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/index.js +67 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/help-deadlock-integration.js +557 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/help-deadlock-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.example.js +212 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.js +552 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/message-bus-completion-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/state-machine-integration.js +635 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/integration/state-machine-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/IArtifactStorage.js +28 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/IArtifactStorage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ICoordinator.js +9 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ICoordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ISessionStore.js +25 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/ISessionStore.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/interfaces/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/artifact-adapter.js +308 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/artifact-adapter.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/completion-storage.js +439 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/completion-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-graph-storage.js +540 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-graph-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-storage.js +367 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/dependency-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/message-storage.js +518 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/message-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/state-storage.js +377 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/memory/state-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channel.js +371 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/dependency-channel.js +355 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/dependency-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/help-channel.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/help-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/state-channel.js +295 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/state-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/task-channel.js +411 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/channels/task-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-bus.js +387 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-bus.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-persistence.js +589 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-persistence.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-router.js +444 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/messaging/message-router.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/artifact-storage.js +560 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/artifact-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/background-orchestrator.js +335 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/background-orchestrator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/bash-output-monitor.js +104 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/bash-output-monitor.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/checkpoint-manager.js +847 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/checkpoint-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/help-coordinator.js +470 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/hierarchical-background-integration.js +450 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/hierarchical-background-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/index.js +13 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/message-bus-integration.js +625 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/message-bus-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/multi-level-control.js +545 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/multi-level-control.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-controller.js +740 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-controller.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-message-integration.js +415 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/query-message-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/session-pool-optimizer.js +615 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/session-pool-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-machine-integration.js +547 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-machine-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-sdk-integration.js +342 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/sdk/state-sdk-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/security/payload-validator.js +259 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/security/payload-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/framework-registry.js +273 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/framework-registry.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/index.js +8 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-config-manager.js +310 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-config-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-validator.js +218 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/truth/truth-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/types/sdk.js +9 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/types/sdk.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/index.js +6 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/priority-queue.js +145 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/priority-queue.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/sdk-helpers.js +122 -0
- package/.claude-flow-novice/dist/src/coordination/archives/v2-sdk-typescript/v2/utils/sdk-helpers.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/config-translator.js +17 -43
- package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +34 -76
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/shared/core/agent-state.js +172 -0
- package/.claude-flow-novice/dist/src/coordination/shared/core/agent-state.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/core/index.js +7 -0
- package/.claude-flow-novice/dist/src/coordination/shared/core/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/index.js +19 -0
- package/.claude-flow-novice/dist/src/coordination/shared/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js +24 -0
- package/.claude-flow-novice/dist/src/coordination/shared/interfaces/ICoordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js +7 -0
- package/.claude-flow-novice/dist/src/coordination/shared/interfaces/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js +920 -0
- package/.claude-flow-novice/dist/src/coordination/shared/message-broker.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/message.js +138 -0
- package/.claude-flow-novice/dist/src/coordination/shared/message.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js +259 -0
- package/.claude-flow-novice/dist/src/coordination/shared/security/payload-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js +17 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js +19 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/interfaces/transparency-system.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js +357 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js +679 -0
- package/.claude-flow-novice/dist/src/coordination/shared/transparency/transparency-system.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/types/index.js +7 -0
- package/.claude-flow-novice/dist/src/coordination/shared/types/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js +10 -0
- package/.claude-flow-novice/dist/src/coordination/shared/types/sdk.js.map +1 -0
- package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js +52 -2
- package/.claude-flow-novice/dist/src/feature-flags/core/FeatureFlagManager.js.map +1 -1
- package/.claude-flow-novice/dist/src/mcp/mcp-server-novice.js +37 -2
- package/.claude-flow-novice/dist/src/mcp/session-manager.js +3 -1
- package/.claude-flow-novice/dist/src/mcp/session-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/provider-manager.js +36 -3
- package/.claude-flow-novice/dist/src/providers/provider-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js +65 -41
- package/.claude-flow-novice/dist/src/utils/markdown-sanitizer.js.map +1 -1
- package/.claude-flow-novice/dist/src/web/api/server.js +1 -1
- package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -1
- package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js +30 -0
- package/.claude-flow-novice/dist/src/workflows/progressive-rollout-manager.js.map +1 -1
- package/.claude-flow-novice/metrics.db-shm +0 -0
- package/.claude-flow-novice/metrics.db-wal +0 -0
- package/package.json +2 -2
- package/scripts/monitoring/alert-monitor.sh +220 -0
- package/scripts/monitoring/view-alerts.sh +307 -0
- package/scripts/test-zai-api.cjs +2 -2
- package/src/slash-commands/parse-epic.js +1 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Coordination V2 - Cycle Detector
|
|
3
|
+
*
|
|
4
|
+
* DFS-based cycle detection algorithm for dependency graphs.
|
|
5
|
+
* Uses three-color marking (white/gray/black) for O(V+E) detection.
|
|
6
|
+
*
|
|
7
|
+
* Algorithm:
|
|
8
|
+
* - White nodes: unvisited
|
|
9
|
+
* - Gray nodes: currently being visited (on stack)
|
|
10
|
+
* - Black nodes: fully processed
|
|
11
|
+
* - Cycle detected when gray node encountered during DFS
|
|
12
|
+
*
|
|
13
|
+
* @module coordination/v2/dependency/cycle-detector
|
|
14
|
+
*/ /**
|
|
15
|
+
* Node color for cycle detection
|
|
16
|
+
*/ var NodeColor = /*#__PURE__*/ function(NodeColor) {
|
|
17
|
+
/** Unvisited node */ NodeColor["WHITE"] = "white";
|
|
18
|
+
/** Currently being visited (on DFS stack) */ NodeColor["GRAY"] = "gray";
|
|
19
|
+
/** Fully processed */ NodeColor["BLACK"] = "black";
|
|
20
|
+
return NodeColor;
|
|
21
|
+
}(NodeColor || {});
|
|
22
|
+
/**
|
|
23
|
+
* CycleDetector - DFS-based cycle detection
|
|
24
|
+
*
|
|
25
|
+
* Time complexity: O(V + E) where V = nodes, E = edges
|
|
26
|
+
* Space complexity: O(V) for color map and recursion stack
|
|
27
|
+
*
|
|
28
|
+
* Algorithm:
|
|
29
|
+
* 1. Initialize all nodes as WHITE (unvisited)
|
|
30
|
+
* 2. For each WHITE node, start DFS
|
|
31
|
+
* 3. Mark node GRAY (on stack)
|
|
32
|
+
* 4. Visit all dependencies
|
|
33
|
+
* 5. If GRAY node encountered -> cycle detected
|
|
34
|
+
* 6. Mark node BLACK (processed)
|
|
35
|
+
*/ export class CycleDetector {
|
|
36
|
+
/** Node color map for DFS */ colorMap;
|
|
37
|
+
/** DFS recursion stack for cycle path reconstruction */ stack;
|
|
38
|
+
/** Nodes visited during current detection */ nodesVisited;
|
|
39
|
+
/** Cycle detection metrics */ metrics;
|
|
40
|
+
constructor(){
|
|
41
|
+
this.colorMap = new Map();
|
|
42
|
+
this.stack = [];
|
|
43
|
+
this.nodesVisited = 0;
|
|
44
|
+
this.metrics = {
|
|
45
|
+
totalDetections: 0,
|
|
46
|
+
cyclesFound: 0,
|
|
47
|
+
averageLatencyMs: 0
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Detect cycles in dependency graph
|
|
52
|
+
* O(V + E) time complexity
|
|
53
|
+
*
|
|
54
|
+
* @param graph - Dependency graph to analyze
|
|
55
|
+
* @returns CycleDetectionResult with cycle details
|
|
56
|
+
*/ detectCycle(graph) {
|
|
57
|
+
const startTime = performance.now();
|
|
58
|
+
// Reset detection state
|
|
59
|
+
this.colorMap.clear();
|
|
60
|
+
this.stack = [];
|
|
61
|
+
this.nodesVisited = 0;
|
|
62
|
+
// Initialize all nodes as WHITE
|
|
63
|
+
const allNodes = graph.getAllNodes();
|
|
64
|
+
for (const node of allNodes){
|
|
65
|
+
this.colorMap.set(node.agentId, "white");
|
|
66
|
+
}
|
|
67
|
+
// Run DFS from each WHITE node
|
|
68
|
+
for (const node of allNodes){
|
|
69
|
+
if (this.colorMap.get(node.agentId) === "white") {
|
|
70
|
+
const cycleResult = this.dfsVisit(graph, node.agentId);
|
|
71
|
+
if (cycleResult) {
|
|
72
|
+
// Cycle detected
|
|
73
|
+
const latencyMs = performance.now() - startTime;
|
|
74
|
+
this.updateMetrics(latencyMs, true);
|
|
75
|
+
return {
|
|
76
|
+
hasCycle: true,
|
|
77
|
+
cyclePath: cycleResult,
|
|
78
|
+
latencyMs,
|
|
79
|
+
nodesVisited: this.nodesVisited,
|
|
80
|
+
timestamp: new Date()
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// No cycle found
|
|
86
|
+
const latencyMs = performance.now() - startTime;
|
|
87
|
+
this.updateMetrics(latencyMs, false);
|
|
88
|
+
return {
|
|
89
|
+
hasCycle: false,
|
|
90
|
+
latencyMs,
|
|
91
|
+
nodesVisited: this.nodesVisited,
|
|
92
|
+
timestamp: new Date()
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* DFS visit with three-color marking
|
|
97
|
+
* Detects cycle when GRAY node encountered
|
|
98
|
+
*
|
|
99
|
+
* @param graph - Dependency graph
|
|
100
|
+
* @param nodeId - Current node being visited
|
|
101
|
+
* @returns Cycle path if cycle detected, undefined otherwise
|
|
102
|
+
*/ dfsVisit(graph, nodeId) {
|
|
103
|
+
// Mark node as GRAY (on stack)
|
|
104
|
+
this.colorMap.set(nodeId, "gray");
|
|
105
|
+
this.stack.push(nodeId);
|
|
106
|
+
this.nodesVisited++;
|
|
107
|
+
// Visit all dependencies (outgoing edges)
|
|
108
|
+
const dependencies = graph.getDependencies(nodeId);
|
|
109
|
+
for (const depId of dependencies){
|
|
110
|
+
const depColor = this.colorMap.get(depId);
|
|
111
|
+
if (depColor === "gray") {
|
|
112
|
+
// CYCLE DETECTED: Gray node encountered (on stack)
|
|
113
|
+
const cycleStartIndex = this.stack.indexOf(depId);
|
|
114
|
+
const cyclePath = this.stack.slice(cycleStartIndex);
|
|
115
|
+
cyclePath.push(depId); // Close the cycle
|
|
116
|
+
return cyclePath;
|
|
117
|
+
}
|
|
118
|
+
if (depColor === "white") {
|
|
119
|
+
// Unvisited node - continue DFS
|
|
120
|
+
const cycleResult = this.dfsVisit(graph, depId);
|
|
121
|
+
if (cycleResult) {
|
|
122
|
+
return cycleResult; // Propagate cycle up the call stack
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// BLACK nodes are already processed - skip
|
|
126
|
+
}
|
|
127
|
+
// Mark node as BLACK (fully processed)
|
|
128
|
+
this.colorMap.set(nodeId, "black");
|
|
129
|
+
this.stack.pop();
|
|
130
|
+
return undefined; // No cycle found from this node
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Get detailed cycle information
|
|
134
|
+
*
|
|
135
|
+
* @param cyclePath - Cycle path from detection
|
|
136
|
+
* @returns CycleDetails with formatted cycle information
|
|
137
|
+
*/ getCycleDetails(cyclePath) {
|
|
138
|
+
if (cyclePath.length < 2) {
|
|
139
|
+
throw new Error('Invalid cycle path: must contain at least 2 nodes');
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
agents: cyclePath,
|
|
143
|
+
startNode: cyclePath[0],
|
|
144
|
+
endNode: cyclePath[cyclePath.length - 1],
|
|
145
|
+
length: cyclePath.length - 1,
|
|
146
|
+
detectedAt: new Date()
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Detect all cycles in graph (not just first one)
|
|
151
|
+
* More expensive: O(V * (V + E))
|
|
152
|
+
*
|
|
153
|
+
* @param graph - Dependency graph to analyze
|
|
154
|
+
* @returns Array of all detected cycles
|
|
155
|
+
*/ detectAllCycles(graph) {
|
|
156
|
+
const cycles = [];
|
|
157
|
+
const visited = new Set();
|
|
158
|
+
const allNodes = graph.getAllNodes();
|
|
159
|
+
for (const node of allNodes){
|
|
160
|
+
if (!visited.has(node.agentId)) {
|
|
161
|
+
// Reset for each new DFS tree
|
|
162
|
+
this.colorMap.clear();
|
|
163
|
+
this.stack = [];
|
|
164
|
+
for (const n of allNodes){
|
|
165
|
+
this.colorMap.set(n.agentId, "white");
|
|
166
|
+
}
|
|
167
|
+
const cycleResult = this.dfsVisit(graph, node.agentId);
|
|
168
|
+
if (cycleResult) {
|
|
169
|
+
cycles.push(this.getCycleDetails(cycleResult));
|
|
170
|
+
// Mark all nodes in cycle as visited
|
|
171
|
+
for (const agentId of cycleResult){
|
|
172
|
+
visited.add(agentId);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return cycles;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Check if specific path would create cycle
|
|
181
|
+
* Used for pre-validation before adding edges
|
|
182
|
+
*
|
|
183
|
+
* @param graph - Current dependency graph
|
|
184
|
+
* @param from - Source agent
|
|
185
|
+
* @param to - Target agent
|
|
186
|
+
* @returns True if adding edge would create cycle
|
|
187
|
+
*/ wouldCreateCycle(graph, from, to) {
|
|
188
|
+
// Adding edge from -> to creates cycle if:
|
|
189
|
+
// There's already a path from to -> from
|
|
190
|
+
// Check if 'to' can reach 'from' via existing dependencies
|
|
191
|
+
const reachable = this.getReachableNodes(graph, to);
|
|
192
|
+
return reachable.has(from);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Get all nodes reachable from start node
|
|
196
|
+
* Uses BFS for efficient traversal
|
|
197
|
+
*
|
|
198
|
+
* @param graph - Dependency graph
|
|
199
|
+
* @param startNode - Starting node
|
|
200
|
+
* @returns Set of reachable node IDs
|
|
201
|
+
*/ getReachableNodes(graph, startNode) {
|
|
202
|
+
const reachable = new Set();
|
|
203
|
+
const queue = [
|
|
204
|
+
startNode
|
|
205
|
+
];
|
|
206
|
+
const visited = new Set();
|
|
207
|
+
while(queue.length > 0){
|
|
208
|
+
const current = queue.shift();
|
|
209
|
+
if (visited.has(current)) {
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
visited.add(current);
|
|
213
|
+
reachable.add(current);
|
|
214
|
+
// Add all dependencies to queue
|
|
215
|
+
const dependencies = graph.getDependencies(current);
|
|
216
|
+
for (const dep of dependencies){
|
|
217
|
+
if (!visited.has(dep)) {
|
|
218
|
+
queue.push(dep);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return reachable;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Update cycle detection metrics
|
|
226
|
+
*/ updateMetrics(latencyMs, cycleFound) {
|
|
227
|
+
this.metrics.totalDetections++;
|
|
228
|
+
if (cycleFound) {
|
|
229
|
+
this.metrics.cyclesFound++;
|
|
230
|
+
}
|
|
231
|
+
// Update running average
|
|
232
|
+
this.metrics.averageLatencyMs = (this.metrics.averageLatencyMs * (this.metrics.totalDetections - 1) + latencyMs) / this.metrics.totalDetections;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Get cycle detection metrics
|
|
236
|
+
*/ getMetrics() {
|
|
237
|
+
return {
|
|
238
|
+
...this.metrics
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Reset detector state
|
|
243
|
+
*/ reset() {
|
|
244
|
+
this.colorMap.clear();
|
|
245
|
+
this.stack = [];
|
|
246
|
+
this.nodesVisited = 0;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Utility function to detect cycle in graph
|
|
251
|
+
* Convenience wrapper around CycleDetector
|
|
252
|
+
*
|
|
253
|
+
* @param graph - Dependency graph to check
|
|
254
|
+
* @returns CycleDetectionResult
|
|
255
|
+
*/ export function detectCycle(graph) {
|
|
256
|
+
const detector = new CycleDetector();
|
|
257
|
+
return detector.detectCycle(graph);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Utility function to check if adding edge would create cycle
|
|
261
|
+
*
|
|
262
|
+
* @param graph - Current dependency graph
|
|
263
|
+
* @param from - Source agent
|
|
264
|
+
* @param to - Target agent
|
|
265
|
+
* @returns True if edge would create cycle
|
|
266
|
+
*/ export function wouldCreateCycle(graph, from, to) {
|
|
267
|
+
const detector = new CycleDetector();
|
|
268
|
+
return detector.wouldCreateCycle(graph, from, to);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
//# sourceMappingURL=cycle-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/dependency/cycle-detector.ts"],"names":["NodeColor","CycleDetector","colorMap","stack","nodesVisited","metrics","Map","totalDetections","cyclesFound","averageLatencyMs","detectCycle","graph","startTime","performance","now","clear","allNodes","getAllNodes","node","set","agentId","get","cycleResult","dfsVisit","latencyMs","updateMetrics","hasCycle","cyclePath","timestamp","Date","nodeId","push","dependencies","getDependencies","depId","depColor","cycleStartIndex","indexOf","slice","pop","undefined","getCycleDetails","length","Error","agents","startNode","endNode","detectedAt","detectAllCycles","cycles","visited","Set","has","n","add","wouldCreateCycle","from","to","reachable","getReachableNodes","queue","current","shift","dep","cycleFound","getMetrics","reset","detector"],"mappings":"AAAA;;;;;;;;;;;;;CAaC,GAID;;CAEC,GACD,IAAA,AAAKA,mCAAAA;IACH,mBAAmB;IAGnB,2CAA2C;IAG3C,oBAAoB;WAPjBA;EAAAA;AAmDL;;;;;;;;;;;;;CAaC,GACD,OAAO,MAAMC;IACX,2BAA2B,GAC3B,AAAQC,SAAiC;IAEzC,sDAAsD,GACtD,AAAQC,MAAgB;IAEx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B,eAAerB,MAAMsB,eAAe,CAAC4B;YAC3C,KAAK,MAAME,OAAO/B,aAAc;gBAC9B,IAAI,CAACkB,QAAQE,GAAG,CAACW,MAAM;oBACrBH,MAAM7B,IAAI,CAACgC;gBACb;YACF;QACF;QAEA,OAAOL;IACT;IAEA;;GAEC,GACD,AAAQjC,cAAcD,SAAiB,EAAEwC,UAAmB,EAAQ;QAClE,IAAI,CAAC3D,OAAO,CAACE,eAAe;QAE5B,IAAIyD,YAAY;YACd,IAAI,CAAC3D,OAAO,CAACG,WAAW;QAC1B;QAEA,yBAAyB;QACzB,IAAI,CAACH,OAAO,CAACI,gBAAgB,GAC3B,AAAC,CAAA,IAAI,CAACJ,OAAO,CAACI,gBAAgB,GAAI,CAAA,IAAI,CAACJ,OAAO,CAACE,eAAe,GAAG,CAAA,IAAKiB,SAAQ,IAC9E,IAAI,CAACnB,OAAO,CAACE,eAAe;IAChC;IAEA;;GAEC,GACD0D,aAAa;QACX,OAAO;YAAE,GAAG,IAAI,CAAC5D,OAAO;QAAC;IAC3B;IAEA;;GAEC,GACD6D,QAAc;QACZ,IAAI,CAAChE,QAAQ,CAACa,KAAK;QACnB,IAAI,CAACZ,KAAK,GAAG,EAAE;QACf,IAAI,CAACC,YAAY,GAAG;IACtB;AACF;AAEA;;;;;;CAMC,GACD,OAAO,SAASM,YAAYC,KAAsB;IAChD,MAAMwD,WAAW,IAAIlE;IACrB,OAAOkE,SAASzD,WAAW,CAACC;AAC9B;AAEA;;;;;;;CAOC,GACD,OAAO,SAAS4C,iBACd5C,KAAsB,EACtB6C,IAAY,EACZC,EAAU;IAEV,MAAMU,WAAW,IAAIlE;IACrB,OAAOkE,SAASZ,gBAAgB,CAAC5C,OAAO6C,MAAMC;AAChD"}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Coordination V2 - Dependency Graph (DAG)
|
|
3
|
+
*
|
|
4
|
+
* Directed Acyclic Graph (DAG) data structure for managing agent dependencies.
|
|
5
|
+
* Uses adjacency list representation for O(V+E) space complexity.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Adjacency list representation
|
|
9
|
+
* - Topological sorting
|
|
10
|
+
* - Transitive dependency resolution
|
|
11
|
+
* - Cycle detection integration
|
|
12
|
+
*
|
|
13
|
+
* @module coordination/v2/dependency/dependency-graph
|
|
14
|
+
*/ /**
|
|
15
|
+
* DependencyGraph - DAG implementation using adjacency list
|
|
16
|
+
*
|
|
17
|
+
* Space complexity: O(V + E) where V = nodes, E = edges
|
|
18
|
+
* Time complexity:
|
|
19
|
+
* - addNode: O(1)
|
|
20
|
+
* - addEdge: O(1)
|
|
21
|
+
* - removeEdge: O(1)
|
|
22
|
+
* - getDependencies: O(1)
|
|
23
|
+
* - topologicalSort: O(V + E)
|
|
24
|
+
*/ export class DependencyGraph {
|
|
25
|
+
/** Adjacency list: agentId -> DependencyNode */ nodes;
|
|
26
|
+
/** Edge list for quick edge lookups */ edges;
|
|
27
|
+
/** Graph creation timestamp */ createdAt;
|
|
28
|
+
/** Graph metrics */ metrics;
|
|
29
|
+
constructor(){
|
|
30
|
+
this.nodes = new Map();
|
|
31
|
+
this.edges = new Map();
|
|
32
|
+
this.createdAt = new Date();
|
|
33
|
+
this.metrics = {
|
|
34
|
+
totalNodesAdded: 0,
|
|
35
|
+
totalEdgesAdded: 0,
|
|
36
|
+
totalNodesRemoved: 0,
|
|
37
|
+
totalEdgesRemoved: 0
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Add node to graph
|
|
42
|
+
* O(1) time complexity
|
|
43
|
+
*/ addNode(agentId, priority = 5) {
|
|
44
|
+
if (this.nodes.has(agentId)) {
|
|
45
|
+
return; // Node already exists
|
|
46
|
+
}
|
|
47
|
+
const node = {
|
|
48
|
+
agentId,
|
|
49
|
+
dependencies: new Set(),
|
|
50
|
+
dependents: new Set(),
|
|
51
|
+
requests: new Map(),
|
|
52
|
+
metadata: {
|
|
53
|
+
createdAt: new Date(),
|
|
54
|
+
lastUpdated: new Date(),
|
|
55
|
+
priority
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
this.nodes.set(agentId, node);
|
|
59
|
+
this.metrics.totalNodesAdded++;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Add directed edge: from -> to (from depends on to)
|
|
63
|
+
* O(1) time complexity
|
|
64
|
+
*
|
|
65
|
+
* @throws Error if edge would create cycle
|
|
66
|
+
*/ addEdge(from, to, request) {
|
|
67
|
+
// Ensure both nodes exist
|
|
68
|
+
this.addNode(from);
|
|
69
|
+
this.addNode(to);
|
|
70
|
+
const edgeKey = `${from}->${to}`;
|
|
71
|
+
// Skip if edge already exists
|
|
72
|
+
if (this.edges.has(edgeKey)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
// Create edge
|
|
76
|
+
const edge = {
|
|
77
|
+
from,
|
|
78
|
+
to,
|
|
79
|
+
requestId: request.requestId,
|
|
80
|
+
weight: request.priority,
|
|
81
|
+
createdAt: new Date()
|
|
82
|
+
};
|
|
83
|
+
// Update adjacency lists
|
|
84
|
+
const fromNode = this.nodes.get(from);
|
|
85
|
+
const toNode = this.nodes.get(to);
|
|
86
|
+
fromNode.dependencies.add(to);
|
|
87
|
+
fromNode.requests.set(request.requestId, request);
|
|
88
|
+
fromNode.metadata.lastUpdated = new Date();
|
|
89
|
+
toNode.dependents.add(from);
|
|
90
|
+
toNode.metadata.lastUpdated = new Date();
|
|
91
|
+
// Store edge
|
|
92
|
+
this.edges.set(edgeKey, edge);
|
|
93
|
+
this.metrics.totalEdgesAdded++;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Remove edge from graph
|
|
97
|
+
* O(1) time complexity
|
|
98
|
+
*/ removeEdge(from, to) {
|
|
99
|
+
const edgeKey = `${from}->${to}`;
|
|
100
|
+
if (!this.edges.has(edgeKey)) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
// Update adjacency lists
|
|
104
|
+
const fromNode = this.nodes.get(from);
|
|
105
|
+
const toNode = this.nodes.get(to);
|
|
106
|
+
if (fromNode) {
|
|
107
|
+
fromNode.dependencies.delete(to);
|
|
108
|
+
fromNode.metadata.lastUpdated = new Date();
|
|
109
|
+
}
|
|
110
|
+
if (toNode) {
|
|
111
|
+
toNode.dependents.delete(from);
|
|
112
|
+
toNode.metadata.lastUpdated = new Date();
|
|
113
|
+
}
|
|
114
|
+
// Remove edge
|
|
115
|
+
this.edges.delete(edgeKey);
|
|
116
|
+
this.metrics.totalEdgesRemoved++;
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Remove node and all associated edges
|
|
121
|
+
* O(E) time complexity where E = edges connected to node
|
|
122
|
+
*/ removeNode(agentId) {
|
|
123
|
+
const node = this.nodes.get(agentId);
|
|
124
|
+
if (!node) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
// Remove all incoming edges (from dependents)
|
|
128
|
+
for (const dependent of node.dependents){
|
|
129
|
+
this.removeEdge(dependent, agentId);
|
|
130
|
+
}
|
|
131
|
+
// Remove all outgoing edges (to dependencies)
|
|
132
|
+
for (const dependency of node.dependencies){
|
|
133
|
+
this.removeEdge(agentId, dependency);
|
|
134
|
+
}
|
|
135
|
+
// Remove node
|
|
136
|
+
this.nodes.delete(agentId);
|
|
137
|
+
this.metrics.totalNodesRemoved++;
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Get direct dependencies for an agent
|
|
142
|
+
* O(1) time complexity
|
|
143
|
+
*/ getDependencies(agentId) {
|
|
144
|
+
const node = this.nodes.get(agentId);
|
|
145
|
+
return node ? new Set(node.dependencies) : new Set();
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get direct dependents for an agent
|
|
149
|
+
* O(1) time complexity
|
|
150
|
+
*/ getDependents(agentId) {
|
|
151
|
+
const node = this.nodes.get(agentId);
|
|
152
|
+
return node ? new Set(node.dependents) : new Set();
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Get all transitive dependencies (recursive)
|
|
156
|
+
* O(V + E) time complexity with memoization
|
|
157
|
+
*/ getTransitiveDependencies(agentId) {
|
|
158
|
+
const visited = new Set();
|
|
159
|
+
const transitive = new Set();
|
|
160
|
+
const traverse = (nodeId)=>{
|
|
161
|
+
if (visited.has(nodeId)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
visited.add(nodeId);
|
|
165
|
+
const dependencies = this.getDependencies(nodeId);
|
|
166
|
+
for (const dep of dependencies){
|
|
167
|
+
transitive.add(dep);
|
|
168
|
+
traverse(dep);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
traverse(agentId);
|
|
172
|
+
return transitive;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Check if agent has any dependencies
|
|
176
|
+
*/ hasDependencies(agentId) {
|
|
177
|
+
const node = this.nodes.get(agentId);
|
|
178
|
+
return node ? node.dependencies.size > 0 : false;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Check if agent has any dependents
|
|
182
|
+
*/ hasDependents(agentId) {
|
|
183
|
+
const node = this.nodes.get(agentId);
|
|
184
|
+
return node ? node.dependents.size > 0 : false;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Get node by agent ID
|
|
188
|
+
*/ getNode(agentId) {
|
|
189
|
+
return this.nodes.get(agentId);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Get edge between two agents
|
|
193
|
+
*/ getEdge(from, to) {
|
|
194
|
+
return this.edges.get(`${from}->${to}`);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Get all nodes in graph
|
|
198
|
+
*/ getAllNodes() {
|
|
199
|
+
return Array.from(this.nodes.values());
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get all edges in graph
|
|
203
|
+
*/ getAllEdges() {
|
|
204
|
+
return Array.from(this.edges.values());
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Topological sort using Kahn's algorithm
|
|
208
|
+
* O(V + E) time complexity
|
|
209
|
+
*
|
|
210
|
+
* @returns TopologicalSortResult with sorted order or cycle info
|
|
211
|
+
*/ topologicalSort() {
|
|
212
|
+
// Calculate in-degree for each node
|
|
213
|
+
const inDegree = new Map();
|
|
214
|
+
const queue = [];
|
|
215
|
+
for (const [agentId, node] of this.nodes){
|
|
216
|
+
inDegree.set(agentId, node.dependencies.size);
|
|
217
|
+
if (node.dependencies.size === 0) {
|
|
218
|
+
queue.push(agentId);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const order = [];
|
|
222
|
+
// Process nodes with in-degree 0
|
|
223
|
+
while(queue.length > 0){
|
|
224
|
+
const current = queue.shift();
|
|
225
|
+
order.push(current);
|
|
226
|
+
// Reduce in-degree for all dependents
|
|
227
|
+
const dependents = this.getDependents(current);
|
|
228
|
+
for (const dependent of dependents){
|
|
229
|
+
const degree = inDegree.get(dependent) - 1;
|
|
230
|
+
inDegree.set(dependent, degree);
|
|
231
|
+
if (degree === 0) {
|
|
232
|
+
queue.push(dependent);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// If all nodes processed, graph is acyclic
|
|
237
|
+
if (order.length === this.nodes.size) {
|
|
238
|
+
return {
|
|
239
|
+
success: true,
|
|
240
|
+
order
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
// Cycle detected - find remaining nodes
|
|
244
|
+
const remainingNodes = Array.from(this.nodes.keys()).filter((agentId)=>!order.includes(agentId));
|
|
245
|
+
return {
|
|
246
|
+
success: false,
|
|
247
|
+
cycle: {
|
|
248
|
+
agents: remainingNodes,
|
|
249
|
+
detectedAt: new Date()
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Get graph statistics
|
|
255
|
+
*/ getStatistics() {
|
|
256
|
+
const sourceNodes = [];
|
|
257
|
+
const sinkNodes = [];
|
|
258
|
+
let totalDependencies = 0;
|
|
259
|
+
let maxDepth = 0;
|
|
260
|
+
for (const [agentId, node] of this.nodes){
|
|
261
|
+
// Source nodes: no dependencies
|
|
262
|
+
if (node.dependencies.size === 0) {
|
|
263
|
+
sourceNodes.push(agentId);
|
|
264
|
+
}
|
|
265
|
+
// Sink nodes: no dependents
|
|
266
|
+
if (node.dependents.size === 0) {
|
|
267
|
+
sinkNodes.push(agentId);
|
|
268
|
+
}
|
|
269
|
+
totalDependencies += node.dependencies.size;
|
|
270
|
+
// Calculate depth from source nodes
|
|
271
|
+
const depth = this.calculateDepth(agentId);
|
|
272
|
+
if (depth > maxDepth) {
|
|
273
|
+
maxDepth = depth;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
nodeCount: this.nodes.size,
|
|
278
|
+
edgeCount: this.edges.size,
|
|
279
|
+
maxDepth,
|
|
280
|
+
averageDependencies: this.nodes.size > 0 ? totalDependencies / this.nodes.size : 0,
|
|
281
|
+
sourceNodes,
|
|
282
|
+
sinkNodes
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Calculate depth of node from source nodes
|
|
287
|
+
* O(V + E) time complexity
|
|
288
|
+
*/ calculateDepth(agentId) {
|
|
289
|
+
const visited = new Set();
|
|
290
|
+
const dfs = (nodeId)=>{
|
|
291
|
+
if (visited.has(nodeId)) {
|
|
292
|
+
return 0; // Avoid cycles
|
|
293
|
+
}
|
|
294
|
+
visited.add(nodeId);
|
|
295
|
+
const dependencies = this.getDependencies(nodeId);
|
|
296
|
+
if (dependencies.size === 0) {
|
|
297
|
+
return 0; // Source node
|
|
298
|
+
}
|
|
299
|
+
let maxDepth = 0;
|
|
300
|
+
for (const dep of dependencies){
|
|
301
|
+
const depth = dfs(dep) + 1;
|
|
302
|
+
if (depth > maxDepth) {
|
|
303
|
+
maxDepth = depth;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return maxDepth;
|
|
307
|
+
};
|
|
308
|
+
return dfs(agentId);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Get graph metrics
|
|
312
|
+
*/ getMetrics() {
|
|
313
|
+
return {
|
|
314
|
+
...this.metrics
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Clear entire graph
|
|
319
|
+
*/ clear() {
|
|
320
|
+
this.nodes.clear();
|
|
321
|
+
this.edges.clear();
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Get graph size
|
|
325
|
+
*/ size() {
|
|
326
|
+
return this.nodes.size;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Check if graph is empty
|
|
330
|
+
*/ isEmpty() {
|
|
331
|
+
return this.nodes.size === 0;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
//# sourceMappingURL=dependency-graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/coordination/archives/v2-sdk-typescript/v2/dependency/dependency-graph.ts"],"names":["DependencyGraph","nodes","edges","createdAt","metrics","Map","Date","totalNodesAdded","totalEdgesAdded","totalNodesRemoved","totalEdgesRemoved","addNode","agentId","priority","has","node","dependencies","Set","dependents","requests","metadata","lastUpdated","set","addEdge","from","to","request","edgeKey","edge","requestId","weight","fromNode","get","toNode","add","removeEdge","delete","removeNode","dependent","dependency","getDependencies","getDependents","getTransitiveDependencies","visited","transitive","traverse","nodeId","dep","hasDependencies","size","hasDependents","getNode","getEdge","getAllNodes","Array","values","getAllEdges","topologicalSort","inDegree","queue","push","order","length","current","shift","degree","success","remainingNodes","keys","filter","includes","cycle","agents","detectedAt","getStatistics","sourceNodes","sinkNodes","totalDependencies","maxDepth","depth","calculateDepth","nodeCount","edgeCount","averageDependencies","dfs","getMetrics","clear","isEmpty"],"mappings":"AAAA;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