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,679 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Transparency System Implementation
|
|
3
|
+
*
|
|
4
|
+
* Core transparency system providing real-time monitoring, event streaming,
|
|
5
|
+
* and hierarchy visualization for V2 multi-level agent coordination.
|
|
6
|
+
*
|
|
7
|
+
* @module coordination/shared/transparency/transparency-system
|
|
8
|
+
*/ import { EventEmitter } from 'events';
|
|
9
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
10
|
+
import { Logger } from '../../../core/logger.js';
|
|
11
|
+
/**
|
|
12
|
+
* Transparency System Implementation
|
|
13
|
+
*
|
|
14
|
+
* Provides comprehensive visibility into multi-level agent operations:
|
|
15
|
+
* - Real-time agent hierarchy tracking
|
|
16
|
+
* - Agent lifecycle event streaming
|
|
17
|
+
* - Performance monitoring and alerting
|
|
18
|
+
* - Resource allocation transparency
|
|
19
|
+
*/ export class TransparencySystem extends EventEmitter {
|
|
20
|
+
logger = new Logger({
|
|
21
|
+
level: 'info',
|
|
22
|
+
format: 'text',
|
|
23
|
+
destination: 'console'
|
|
24
|
+
});
|
|
25
|
+
config;
|
|
26
|
+
isInitialized = false;
|
|
27
|
+
isMonitoring = false;
|
|
28
|
+
// Agent tracking
|
|
29
|
+
agentHierarchy = new Map();
|
|
30
|
+
agentStatuses = new Map();
|
|
31
|
+
agentPerformanceMetrics = new Map();
|
|
32
|
+
// Event storage
|
|
33
|
+
lifecycleEvents = [];
|
|
34
|
+
eventListeners = new Set();
|
|
35
|
+
// Monitoring intervals
|
|
36
|
+
metricsUpdateInterval;
|
|
37
|
+
heartbeatInterval;
|
|
38
|
+
// Performance tracking
|
|
39
|
+
performanceThresholds = {
|
|
40
|
+
maxExecutionTimeMs: 300000,
|
|
41
|
+
maxMemoryUsage: 512 * 1024 * 1024,
|
|
42
|
+
maxTokenUsageRate: 100,
|
|
43
|
+
maxPauseLatencyMs: 50,
|
|
44
|
+
maxCpuUsage: 80
|
|
45
|
+
};
|
|
46
|
+
constructor(){
|
|
47
|
+
super();
|
|
48
|
+
this.config = this.getDefaultConfig();
|
|
49
|
+
}
|
|
50
|
+
// ===========================
|
|
51
|
+
// System Lifecycle
|
|
52
|
+
// ===========================
|
|
53
|
+
async initialize(config = {}) {
|
|
54
|
+
if (this.isInitialized) {
|
|
55
|
+
this.logger.warn('TransparencySystem already initialized');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
this.config = {
|
|
59
|
+
...this.getDefaultConfig(),
|
|
60
|
+
...config
|
|
61
|
+
};
|
|
62
|
+
this.logger.info('Initializing TransparencySystem', this.config);
|
|
63
|
+
// Initialize event storage
|
|
64
|
+
this.lifecycleEvents = [];
|
|
65
|
+
this.agentHierarchy.clear();
|
|
66
|
+
this.agentStatuses.clear();
|
|
67
|
+
this.agentPerformanceMetrics.clear();
|
|
68
|
+
this.isInitialized = true;
|
|
69
|
+
this.emit('initialized');
|
|
70
|
+
this.logger.info('TransparencySystem initialized successfully');
|
|
71
|
+
}
|
|
72
|
+
async startMonitoring() {
|
|
73
|
+
if (!this.isInitialized) {
|
|
74
|
+
throw new Error('TransparencySystem not initialized');
|
|
75
|
+
}
|
|
76
|
+
if (this.isMonitoring) {
|
|
77
|
+
this.logger.warn('TransparencySystem monitoring already started');
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
this.logger.info('Starting transparency monitoring');
|
|
81
|
+
// Start metrics update interval
|
|
82
|
+
this.metricsUpdateInterval = setInterval(()=>this.updateMetrics(), this.config.metricsUpdateIntervalMs);
|
|
83
|
+
// Start heartbeat monitoring
|
|
84
|
+
this.heartbeatInterval = setInterval(()=>this.checkAgentHeartbeats(), this.config.heartbeatIntervalMs);
|
|
85
|
+
this.isMonitoring = true;
|
|
86
|
+
this.emit('monitoringStarted');
|
|
87
|
+
this.logger.info('Transparency monitoring started');
|
|
88
|
+
}
|
|
89
|
+
async stopMonitoring() {
|
|
90
|
+
if (!this.isMonitoring) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
this.logger.info('Stopping transparency monitoring');
|
|
94
|
+
// Clear intervals
|
|
95
|
+
if (this.metricsUpdateInterval) {
|
|
96
|
+
clearInterval(this.metricsUpdateInterval);
|
|
97
|
+
this.metricsUpdateInterval = undefined;
|
|
98
|
+
}
|
|
99
|
+
if (this.heartbeatInterval) {
|
|
100
|
+
clearInterval(this.heartbeatInterval);
|
|
101
|
+
this.heartbeatInterval = undefined;
|
|
102
|
+
}
|
|
103
|
+
this.isMonitoring = false;
|
|
104
|
+
this.emit('monitoringStopped');
|
|
105
|
+
this.logger.info('Transparency monitoring stopped');
|
|
106
|
+
}
|
|
107
|
+
async cleanup() {
|
|
108
|
+
this.logger.info('Cleaning up TransparencySystem');
|
|
109
|
+
await this.stopMonitoring();
|
|
110
|
+
// Clear all data
|
|
111
|
+
this.lifecycleEvents = [];
|
|
112
|
+
this.agentHierarchy.clear();
|
|
113
|
+
this.agentStatuses.clear();
|
|
114
|
+
this.agentPerformanceMetrics.clear();
|
|
115
|
+
this.eventListeners.clear();
|
|
116
|
+
this.removeAllListeners();
|
|
117
|
+
this.isInitialized = false;
|
|
118
|
+
this.logger.info('TransparencySystem cleanup complete');
|
|
119
|
+
}
|
|
120
|
+
// ===========================
|
|
121
|
+
// Agent Registration & Tracking
|
|
122
|
+
// ===========================
|
|
123
|
+
/**
|
|
124
|
+
* Register agent with transparency system
|
|
125
|
+
*
|
|
126
|
+
* Called when agent is spawned in coordinator
|
|
127
|
+
*/ registerAgent(agent, parentAgentId) {
|
|
128
|
+
const hierarchyNode = {
|
|
129
|
+
agentId: agent.agentId,
|
|
130
|
+
type: agent.type,
|
|
131
|
+
level: this.calculateAgentLevel(agent.agentId, parentAgentId),
|
|
132
|
+
parentAgentId,
|
|
133
|
+
childAgentIds: [],
|
|
134
|
+
priority: agent.priority,
|
|
135
|
+
state: agent.state,
|
|
136
|
+
sessionId: agent.sessionId,
|
|
137
|
+
createdAt: new Date(),
|
|
138
|
+
lastStateChange: new Date(),
|
|
139
|
+
tokensUsed: 0,
|
|
140
|
+
tokenBudget: agent.metadata.tokenBudget || 10000,
|
|
141
|
+
isPaused: agent.isPaused,
|
|
142
|
+
metadata: agent.metadata,
|
|
143
|
+
metrics: {
|
|
144
|
+
spawnTimeMs: 0,
|
|
145
|
+
totalExecutionTimeMs: 0,
|
|
146
|
+
pauseCount: 0,
|
|
147
|
+
resumeCount: 0,
|
|
148
|
+
checkpointCount: 0
|
|
149
|
+
},
|
|
150
|
+
currentTask: undefined,
|
|
151
|
+
waitingFor: [],
|
|
152
|
+
completedDependencies: []
|
|
153
|
+
};
|
|
154
|
+
this.agentHierarchy.set(agent.agentId, hierarchyNode);
|
|
155
|
+
// Initialize agent status
|
|
156
|
+
const status = {
|
|
157
|
+
agentId: agent.agentId,
|
|
158
|
+
state: agent.state,
|
|
159
|
+
isPaused: agent.isPaused,
|
|
160
|
+
activity: 'Spawned',
|
|
161
|
+
progress: 0,
|
|
162
|
+
tokensUsed: 0,
|
|
163
|
+
tokenUsageRate: 0,
|
|
164
|
+
memoryUsage: 0,
|
|
165
|
+
cpuUsage: 0,
|
|
166
|
+
lastHeartbeat: new Date(),
|
|
167
|
+
recentErrors: []
|
|
168
|
+
};
|
|
169
|
+
this.agentStatuses.set(agent.agentId, status);
|
|
170
|
+
// Update parent's child list
|
|
171
|
+
if (parentAgentId && this.agentHierarchy.has(parentAgentId)) {
|
|
172
|
+
const parent = this.agentHierarchy.get(parentAgentId);
|
|
173
|
+
parent.childAgentIds.push(agent.agentId);
|
|
174
|
+
}
|
|
175
|
+
// Record lifecycle event
|
|
176
|
+
this.recordLifecycleEvent({
|
|
177
|
+
eventId: uuidv4(),
|
|
178
|
+
timestamp: new Date(),
|
|
179
|
+
agentId: agent.agentId,
|
|
180
|
+
eventType: 'spawned',
|
|
181
|
+
eventData: {
|
|
182
|
+
metadata: agent.metadata
|
|
183
|
+
},
|
|
184
|
+
level: hierarchyNode.level,
|
|
185
|
+
parentAgentId,
|
|
186
|
+
sessionId: agent.sessionId,
|
|
187
|
+
tokensUsed: 0,
|
|
188
|
+
performanceImpact: {}
|
|
189
|
+
});
|
|
190
|
+
this.emit('agentRegistered', {
|
|
191
|
+
agentId: agent.agentId,
|
|
192
|
+
hierarchyNode
|
|
193
|
+
});
|
|
194
|
+
this.notifyHierarchyChange('agent_added', agent.agentId, hierarchyNode);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Update agent state
|
|
198
|
+
*
|
|
199
|
+
* Called when agent state changes
|
|
200
|
+
*/ updateAgentState(agentId, newState, reason) {
|
|
201
|
+
const hierarchyNode = this.agentHierarchy.get(agentId);
|
|
202
|
+
const status = this.agentStatuses.get(agentId);
|
|
203
|
+
if (!hierarchyNode || !status) {
|
|
204
|
+
this.logger.warn(`Agent ${agentId} not found in transparency tracking`);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const previousState = hierarchyNode.state;
|
|
208
|
+
hierarchyNode.state = newState;
|
|
209
|
+
hierarchyNode.lastStateChange = new Date();
|
|
210
|
+
status.state = newState;
|
|
211
|
+
// Update activity based on state
|
|
212
|
+
status.activity = this.getActivityForState(newState, reason);
|
|
213
|
+
// Record lifecycle event
|
|
214
|
+
this.recordLifecycleEvent({
|
|
215
|
+
eventId: uuidv4(),
|
|
216
|
+
timestamp: new Date(),
|
|
217
|
+
agentId,
|
|
218
|
+
eventType: 'state_changed',
|
|
219
|
+
eventData: {
|
|
220
|
+
previousState,
|
|
221
|
+
newState,
|
|
222
|
+
reason
|
|
223
|
+
},
|
|
224
|
+
level: hierarchyNode.level,
|
|
225
|
+
parentAgentId: hierarchyNode.parentAgentId,
|
|
226
|
+
sessionId: hierarchyNode.sessionId,
|
|
227
|
+
tokensUsed: hierarchyNode.tokensUsed,
|
|
228
|
+
performanceImpact: {}
|
|
229
|
+
});
|
|
230
|
+
this.emit('agentStateChanged', {
|
|
231
|
+
agentId,
|
|
232
|
+
previousState,
|
|
233
|
+
newState
|
|
234
|
+
});
|
|
235
|
+
this.notifyStateChange(agentId, previousState, newState);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Update agent token usage
|
|
239
|
+
*
|
|
240
|
+
* Called when agent consumes tokens
|
|
241
|
+
*/ updateTokenUsage(agentId, tokensUsed) {
|
|
242
|
+
const hierarchyNode = this.agentHierarchy.get(agentId);
|
|
243
|
+
const status = this.agentStatuses.get(agentId);
|
|
244
|
+
if (!hierarchyNode || !status) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const previousTokens = hierarchyNode.tokensUsed;
|
|
248
|
+
hierarchyNode.tokensUsed = tokensUsed;
|
|
249
|
+
status.tokensUsed = tokensUsed;
|
|
250
|
+
// Calculate token usage rate
|
|
251
|
+
const timeDelta = Date.now() - status.lastHeartbeat.getTime();
|
|
252
|
+
if (timeDelta > 0) {
|
|
253
|
+
status.tokenUsageRate = (tokensUsed - previousTokens) / (timeDelta / 1000);
|
|
254
|
+
}
|
|
255
|
+
// Check performance thresholds
|
|
256
|
+
this.checkPerformanceThresholds(agentId);
|
|
257
|
+
}
|
|
258
|
+
// ===========================
|
|
259
|
+
// Hierarchy Visualization
|
|
260
|
+
// ===========================
|
|
261
|
+
async getAgentHierarchy() {
|
|
262
|
+
return Array.from(this.agentHierarchy.values());
|
|
263
|
+
}
|
|
264
|
+
async getAgentsAtLevel(level) {
|
|
265
|
+
return Array.from(this.agentHierarchy.values()).filter((agent)=>agent.level === level);
|
|
266
|
+
}
|
|
267
|
+
async getChildAgents(parentAgentId) {
|
|
268
|
+
const parent = this.agentHierarchy.get(parentAgentId);
|
|
269
|
+
if (!parent) {
|
|
270
|
+
return [];
|
|
271
|
+
}
|
|
272
|
+
return parent.childAgentIds.map((childId)=>this.agentHierarchy.get(childId)).filter(Boolean);
|
|
273
|
+
}
|
|
274
|
+
async getRootAgents() {
|
|
275
|
+
return Array.from(this.agentHierarchy.values()).filter((agent)=>!agent.parentAgentId);
|
|
276
|
+
}
|
|
277
|
+
// ===========================
|
|
278
|
+
// Real-time Monitoring
|
|
279
|
+
// ===========================
|
|
280
|
+
async getAllAgentStatuses() {
|
|
281
|
+
return Array.from(this.agentStatuses.values());
|
|
282
|
+
}
|
|
283
|
+
async getAgentStatus(agentId) {
|
|
284
|
+
const status = this.agentStatuses.get(agentId);
|
|
285
|
+
if (!status) {
|
|
286
|
+
throw new Error(`Agent ${agentId} not found`);
|
|
287
|
+
}
|
|
288
|
+
return status;
|
|
289
|
+
}
|
|
290
|
+
async getActiveAgents() {
|
|
291
|
+
return Array.from(this.agentStatuses.values()).filter((status)=>!status.isPaused && status.state !== 'terminated');
|
|
292
|
+
}
|
|
293
|
+
async getPausedAgents() {
|
|
294
|
+
return Array.from(this.agentStatuses.values()).filter((status)=>status.isPaused);
|
|
295
|
+
}
|
|
296
|
+
// ===========================
|
|
297
|
+
// Event Streaming
|
|
298
|
+
// ===========================
|
|
299
|
+
async getRecentEvents(limit = 100, eventType) {
|
|
300
|
+
let events = [
|
|
301
|
+
...this.lifecycleEvents
|
|
302
|
+
].reverse();
|
|
303
|
+
if (eventType) {
|
|
304
|
+
events = events.filter((event)=>event.eventType === eventType);
|
|
305
|
+
}
|
|
306
|
+
return events.slice(0, limit);
|
|
307
|
+
}
|
|
308
|
+
async getAgentEvents(agentId, limit = 50) {
|
|
309
|
+
const events = this.lifecycleEvents.filter((event)=>event.agentId === agentId).reverse();
|
|
310
|
+
return events.slice(0, limit);
|
|
311
|
+
}
|
|
312
|
+
async getEventsInTimeRange(startTime, endTime, limit = 100) {
|
|
313
|
+
const events = this.lifecycleEvents.filter((event)=>event.timestamp >= startTime && event.timestamp <= endTime).reverse();
|
|
314
|
+
return events.slice(0, limit);
|
|
315
|
+
}
|
|
316
|
+
// ===========================
|
|
317
|
+
// Metrics & Analytics
|
|
318
|
+
// ===========================
|
|
319
|
+
async getTransparencyMetrics() {
|
|
320
|
+
const agents = Array.from(this.agentHierarchy.values());
|
|
321
|
+
const statuses = Array.from(this.agentStatuses.values());
|
|
322
|
+
// Calculate agents by level
|
|
323
|
+
const agentsByLevel = {};
|
|
324
|
+
agents.forEach((agent)=>{
|
|
325
|
+
agentsByLevel[agent.level] = (agentsByLevel[agent.level] || 0) + 1;
|
|
326
|
+
});
|
|
327
|
+
// Calculate agents by state
|
|
328
|
+
const agentsByState = {};
|
|
329
|
+
agents.forEach((agent)=>{
|
|
330
|
+
agentsByState[agent.state] = (agentsByState[agent.state] || 0) + 1;
|
|
331
|
+
});
|
|
332
|
+
// Calculate agents by type
|
|
333
|
+
const agentsByType = {};
|
|
334
|
+
agents.forEach((agent)=>{
|
|
335
|
+
agentsByType[agent.type] = (agentsByType[agent.type] || 0) + 1;
|
|
336
|
+
});
|
|
337
|
+
// Calculate total tokens
|
|
338
|
+
const totalTokensConsumed = agents.reduce((sum, agent)=>sum + agent.tokensUsed, 0);
|
|
339
|
+
const totalTokensSaved = this.calculateTokensSaved();
|
|
340
|
+
// Calculate performance metrics
|
|
341
|
+
const executionTimes = agents.map((agent)=>agent.metrics.totalExecutionTimeMs);
|
|
342
|
+
const averageExecutionTimeMs = executionTimes.length > 0 ? executionTimes.reduce((sum, time)=>sum + time, 0) / executionTimes.length : 0;
|
|
343
|
+
// Calculate failure rate
|
|
344
|
+
const terminatedAgents = agents.filter((agent)=>agent.state === 'terminated').length;
|
|
345
|
+
const failureRate = agents.length > 0 ? terminatedAgents / agents.length * 100 : 0;
|
|
346
|
+
// Calculate hierarchy depth
|
|
347
|
+
const hierarchyDepth = Math.max(...agents.map((agent)=>agent.level), 0);
|
|
348
|
+
// Calculate dependency resolution rate
|
|
349
|
+
const totalDependencies = agents.reduce((sum, agent)=>sum + agent.waitingFor.length + agent.completedDependencies.length, 0);
|
|
350
|
+
const completedDependencies = agents.reduce((sum, agent)=>sum + agent.completedDependencies.length, 0);
|
|
351
|
+
const dependencyResolutionRate = totalDependencies > 0 ? completedDependencies / totalDependencies * 100 : 100;
|
|
352
|
+
// Event stream statistics
|
|
353
|
+
const eventTypes = {};
|
|
354
|
+
this.lifecycleEvents.forEach((event)=>{
|
|
355
|
+
eventTypes[event.eventType] = (eventTypes[event.eventType] || 0) + 1;
|
|
356
|
+
});
|
|
357
|
+
const recentEvents = this.lifecycleEvents.filter((event)=>Date.now() - event.timestamp.getTime() < 60000 // Last minute
|
|
358
|
+
);
|
|
359
|
+
const eventsPerSecond = recentEvents.length / 60;
|
|
360
|
+
return {
|
|
361
|
+
totalAgents: agents.length,
|
|
362
|
+
agentsByLevel,
|
|
363
|
+
agentsByState,
|
|
364
|
+
agentsByType,
|
|
365
|
+
totalTokensConsumed,
|
|
366
|
+
totalTokensSaved,
|
|
367
|
+
averageExecutionTimeMs,
|
|
368
|
+
failureRate,
|
|
369
|
+
averagePauseResumeLatencyMs: this.calculateAveragePauseResumeLatency(),
|
|
370
|
+
hierarchyDepth,
|
|
371
|
+
dependencyResolutionRate,
|
|
372
|
+
eventStreamStats: {
|
|
373
|
+
totalEvents: this.lifecycleEvents.length,
|
|
374
|
+
eventsPerSecond,
|
|
375
|
+
eventTypes
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
async getAgentPerformanceMetrics(agentId) {
|
|
380
|
+
const hierarchyNode = this.agentHierarchy.get(agentId);
|
|
381
|
+
const status = this.agentStatuses.get(agentId);
|
|
382
|
+
if (!hierarchyNode || !status) {
|
|
383
|
+
throw new Error(`Agent ${agentId} not found`);
|
|
384
|
+
}
|
|
385
|
+
return {
|
|
386
|
+
agentId,
|
|
387
|
+
executionMetrics: hierarchyNode.metrics,
|
|
388
|
+
currentPerformance: {
|
|
389
|
+
tokenUsageRate: status.tokenUsageRate,
|
|
390
|
+
memoryUsage: status.memoryUsage,
|
|
391
|
+
cpuUsage: status.cpuUsage,
|
|
392
|
+
progress: status.progress
|
|
393
|
+
},
|
|
394
|
+
tokenMetrics: {
|
|
395
|
+
totalUsed: hierarchyNode.tokensUsed,
|
|
396
|
+
budget: hierarchyNode.tokenBudget,
|
|
397
|
+
utilizationRate: hierarchyNode.tokenBudget > 0 ? hierarchyNode.tokensUsed / hierarchyNode.tokenBudget * 100 : 0
|
|
398
|
+
},
|
|
399
|
+
stateMetrics: {
|
|
400
|
+
totalStateChanges: this.lifecycleEvents.filter((event)=>event.agentId === agentId && event.eventType === 'state_changed').length,
|
|
401
|
+
pauseCount: hierarchyNode.metrics.pauseCount,
|
|
402
|
+
resumeCount: hierarchyNode.metrics.resumeCount,
|
|
403
|
+
checkpointCount: hierarchyNode.metrics.checkpointCount
|
|
404
|
+
},
|
|
405
|
+
errorMetrics: {
|
|
406
|
+
totalErrors: status.recentErrors.length,
|
|
407
|
+
criticalErrors: status.recentErrors.filter((e)=>e.severity === 'critical').length,
|
|
408
|
+
recentErrors: status.recentErrors.slice(-5)
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
async getHierarchyAnalytics() {
|
|
413
|
+
const agents = Array.from(this.agentHierarchy.values());
|
|
414
|
+
const rootAgents = agents.filter((agent)=>!agent.parentAgentId);
|
|
415
|
+
// Calculate depth
|
|
416
|
+
const depth = Math.max(...agents.map((agent)=>agent.level), 0);
|
|
417
|
+
// Calculate branching factor
|
|
418
|
+
const parentAgents = agents.filter((agent)=>agent.childAgentIds.length > 0);
|
|
419
|
+
const totalChildren = parentAgents.reduce((sum, agent)=>sum + agent.childAgentIds.length, 0);
|
|
420
|
+
const branchingFactor = parentAgents.length > 0 ? totalChildren / parentAgents.length : 0;
|
|
421
|
+
// Calculate balance (standard deviation of children per parent)
|
|
422
|
+
const childCounts = parentAgents.map((agent)=>agent.childAgentIds.length);
|
|
423
|
+
const avgChildren = branchingFactor;
|
|
424
|
+
const variance = childCounts.reduce((sum, count)=>{
|
|
425
|
+
return sum + Math.pow(count - avgChildren, 2);
|
|
426
|
+
}, 0) / (parentAgents.length || 1);
|
|
427
|
+
const balance = Math.max(0, 100 - Math.sqrt(variance));
|
|
428
|
+
// Calculate efficiency (active agents vs total agents)
|
|
429
|
+
const activeAgents = agents.filter((agent)=>!agent.isPaused && agent.state !== 'terminated').length;
|
|
430
|
+
const efficiency = agents.length > 0 ? activeAgents / agents.length * 100 : 0;
|
|
431
|
+
return {
|
|
432
|
+
depth,
|
|
433
|
+
branchingFactor,
|
|
434
|
+
balance,
|
|
435
|
+
efficiency
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
// ===========================
|
|
439
|
+
// Event Listeners
|
|
440
|
+
// ===========================
|
|
441
|
+
async registerEventListener(listener) {
|
|
442
|
+
this.eventListeners.add(listener);
|
|
443
|
+
this.logger.debug('Transparency event listener registered');
|
|
444
|
+
}
|
|
445
|
+
async unregisterEventListener(listener) {
|
|
446
|
+
this.eventListeners.delete(listener);
|
|
447
|
+
this.logger.debug('Transparency event listener unregistered');
|
|
448
|
+
}
|
|
449
|
+
// ===========================
|
|
450
|
+
// Private Helper Methods
|
|
451
|
+
// ===========================
|
|
452
|
+
getDefaultConfig() {
|
|
453
|
+
return {
|
|
454
|
+
enableRealTimeMonitoring: true,
|
|
455
|
+
enableEventStreaming: true,
|
|
456
|
+
eventRetentionHours: 24,
|
|
457
|
+
metricsUpdateIntervalMs: 5000,
|
|
458
|
+
heartbeatIntervalMs: 10000,
|
|
459
|
+
enablePerformanceTracking: true,
|
|
460
|
+
enableDependencyTracking: true,
|
|
461
|
+
maxEventsInMemory: 10000,
|
|
462
|
+
enableHierarchyNotifications: true
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
calculateAgentLevel(agentId, parentAgentId) {
|
|
466
|
+
if (!parentAgentId) {
|
|
467
|
+
return 1; // Root level
|
|
468
|
+
}
|
|
469
|
+
const parent = this.agentHierarchy.get(parentAgentId);
|
|
470
|
+
if (parent) {
|
|
471
|
+
return parent.level + 1;
|
|
472
|
+
}
|
|
473
|
+
return 2; // Default to level 2 if parent not found
|
|
474
|
+
}
|
|
475
|
+
getActivityForState(state, reason) {
|
|
476
|
+
const stateActivities = {
|
|
477
|
+
idle: 'Idle',
|
|
478
|
+
active: 'Executing task',
|
|
479
|
+
paused: 'Paused',
|
|
480
|
+
terminated: 'Terminated',
|
|
481
|
+
error: 'Error state',
|
|
482
|
+
completing: 'Completing task',
|
|
483
|
+
checkpointing: 'Creating checkpoint',
|
|
484
|
+
waiting_for_dependency: 'Waiting for dependency'
|
|
485
|
+
};
|
|
486
|
+
let activity = stateActivities[state] || 'Unknown state';
|
|
487
|
+
if (reason) {
|
|
488
|
+
activity += ` (${reason})`;
|
|
489
|
+
}
|
|
490
|
+
return activity;
|
|
491
|
+
}
|
|
492
|
+
recordLifecycleEvent(event) {
|
|
493
|
+
this.lifecycleEvents.push(event);
|
|
494
|
+
// Enforce event retention limit
|
|
495
|
+
if (this.lifecycleEvents.length > this.config.maxEventsInMemory) {
|
|
496
|
+
const excess = this.lifecycleEvents.length - this.config.maxEventsInMemory;
|
|
497
|
+
this.lifecycleEvents.splice(0, excess);
|
|
498
|
+
}
|
|
499
|
+
// Notify listeners
|
|
500
|
+
this.eventListeners.forEach((listener)=>{
|
|
501
|
+
if (listener.onLifecycleEvent) {
|
|
502
|
+
try {
|
|
503
|
+
listener.onLifecycleEvent(event);
|
|
504
|
+
} catch (error) {
|
|
505
|
+
this.logger.error('Error in lifecycle event listener', error);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
this.emit('lifecycleEvent', event);
|
|
510
|
+
}
|
|
511
|
+
notifyHierarchyChange(type, agentId, data) {
|
|
512
|
+
if (!this.config.enableHierarchyNotifications) {
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
this.eventListeners.forEach((listener)=>{
|
|
516
|
+
if (listener.onHierarchyChange) {
|
|
517
|
+
try {
|
|
518
|
+
listener.onHierarchyChange({
|
|
519
|
+
type,
|
|
520
|
+
agentId,
|
|
521
|
+
data
|
|
522
|
+
});
|
|
523
|
+
} catch (error) {
|
|
524
|
+
this.logger.error('Error in hierarchy change listener', error);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
this.emit('hierarchyChange', {
|
|
529
|
+
type,
|
|
530
|
+
agentId,
|
|
531
|
+
data
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
notifyStateChange(agentId, previousState, newState) {
|
|
535
|
+
const timestamp = new Date();
|
|
536
|
+
this.eventListeners.forEach((listener)=>{
|
|
537
|
+
if (listener.onAgentStateChange) {
|
|
538
|
+
try {
|
|
539
|
+
listener.onAgentStateChange({
|
|
540
|
+
agentId,
|
|
541
|
+
previousState,
|
|
542
|
+
newState,
|
|
543
|
+
timestamp
|
|
544
|
+
});
|
|
545
|
+
} catch (error) {
|
|
546
|
+
this.logger.error('Error in state change listener', error);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
this.emit('agentStateChange', {
|
|
551
|
+
agentId,
|
|
552
|
+
previousState,
|
|
553
|
+
newState,
|
|
554
|
+
timestamp
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
updateMetrics() {
|
|
558
|
+
if (!this.isMonitoring) {
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
this.getTransparencyMetrics().then((metrics)=>{
|
|
562
|
+
this.eventListeners.forEach((listener)=>{
|
|
563
|
+
if (listener.onMetricsUpdate) {
|
|
564
|
+
try {
|
|
565
|
+
listener.onMetricsUpdate(metrics);
|
|
566
|
+
} catch (error) {
|
|
567
|
+
this.logger.error('Error in metrics update listener', error);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
this.emit('metricsUpdate', metrics);
|
|
572
|
+
}).catch((error)=>{
|
|
573
|
+
this.logger.error('Error updating transparency metrics', error);
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
checkAgentHeartbeats() {
|
|
577
|
+
const now = new Date();
|
|
578
|
+
const staleThreshold = this.config.heartbeatIntervalMs * 3; // 3 intervals
|
|
579
|
+
this.agentStatuses.forEach((status, agentId)=>{
|
|
580
|
+
const timeSinceHeartbeat = now.getTime() - status.lastHeartbeat.getTime();
|
|
581
|
+
if (timeSinceHeartbeat > staleThreshold) {
|
|
582
|
+
// Agent hasn't sent heartbeat recently
|
|
583
|
+
status.recentErrors.push({
|
|
584
|
+
timestamp: now,
|
|
585
|
+
error: `Agent heartbeat timeout (${Math.round(timeSinceHeartbeat / 1000)}s)`,
|
|
586
|
+
severity: 'warning'
|
|
587
|
+
});
|
|
588
|
+
// Keep only recent errors
|
|
589
|
+
if (status.recentErrors.length > 10) {
|
|
590
|
+
status.recentErrors.splice(0, status.recentErrors.length - 10);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
checkPerformanceThresholds(agentId) {
|
|
596
|
+
const status = this.agentStatuses.get(agentId);
|
|
597
|
+
if (!status) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
const alerts = [];
|
|
601
|
+
// Check token usage rate
|
|
602
|
+
if (status.tokenUsageRate > this.performanceThresholds.maxTokenUsageRate) {
|
|
603
|
+
alerts.push({
|
|
604
|
+
metric: 'tokenUsageRate',
|
|
605
|
+
value: status.tokenUsageRate,
|
|
606
|
+
threshold: this.performanceThresholds.maxTokenUsageRate,
|
|
607
|
+
severity: status.tokenUsageRate > this.performanceThresholds.maxTokenUsageRate * 1.5 ? 'critical' : 'warning'
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
// Check memory usage
|
|
611
|
+
if (status.memoryUsage > this.performanceThresholds.maxMemoryUsage) {
|
|
612
|
+
alerts.push({
|
|
613
|
+
metric: 'memoryUsage',
|
|
614
|
+
value: status.memoryUsage,
|
|
615
|
+
threshold: this.performanceThresholds.maxMemoryUsage,
|
|
616
|
+
severity: 'critical'
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
// Check CPU usage
|
|
620
|
+
if (status.cpuUsage > this.performanceThresholds.maxCpuUsage) {
|
|
621
|
+
alerts.push({
|
|
622
|
+
metric: 'cpuUsage',
|
|
623
|
+
value: status.cpuUsage,
|
|
624
|
+
threshold: this.performanceThresholds.maxCpuUsage,
|
|
625
|
+
severity: status.cpuUsage > 95 ? 'critical' : 'warning'
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
// Notify listeners of performance alerts
|
|
629
|
+
alerts.forEach((alert)=>{
|
|
630
|
+
this.eventListeners.forEach((listener)=>{
|
|
631
|
+
if (listener.onPerformanceAlert) {
|
|
632
|
+
try {
|
|
633
|
+
listener.onPerformanceAlert({
|
|
634
|
+
agentId,
|
|
635
|
+
...alert
|
|
636
|
+
});
|
|
637
|
+
} catch (error) {
|
|
638
|
+
this.logger.error('Error in performance alert listener', error);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
this.emit('performanceAlert', {
|
|
643
|
+
agentId,
|
|
644
|
+
...alert
|
|
645
|
+
});
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
calculateTokensSaved() {
|
|
649
|
+
const pausedAgents = Array.from(this.agentStatuses.values()).filter((status)=>status.isPaused);
|
|
650
|
+
return pausedAgents.reduce((total, status)=>{
|
|
651
|
+
const timeSincePause = Date.now() - status.lastHeartbeat.getTime();
|
|
652
|
+
const estimatedTokensSaved = status.tokenUsageRate * timeSincePause / 1000;
|
|
653
|
+
return total + Math.max(0, estimatedTokensSaved);
|
|
654
|
+
}, 0);
|
|
655
|
+
}
|
|
656
|
+
calculateAveragePauseResumeLatencyMs() {
|
|
657
|
+
const events = this.lifecycleEvents.filter((event)=>event.eventType === 'paused' || event.eventType === 'resumed');
|
|
658
|
+
if (events.length < 2) {
|
|
659
|
+
return 0;
|
|
660
|
+
}
|
|
661
|
+
// Pair pause/resume events and calculate latencies
|
|
662
|
+
const latencies = [];
|
|
663
|
+
const pauseEvents = new Map();
|
|
664
|
+
events.forEach((event)=>{
|
|
665
|
+
if (event.eventType === 'paused') {
|
|
666
|
+
pauseEvents.set(event.agentId, event);
|
|
667
|
+
} else if (event.eventType === 'resumed') {
|
|
668
|
+
const pauseEvent = pauseEvents.get(event.agentId);
|
|
669
|
+
if (pauseEvent && event.performanceImpact.duration) {
|
|
670
|
+
latencies.push(event.performanceImpact.duration);
|
|
671
|
+
}
|
|
672
|
+
pauseEvents.delete(event.agentId);
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
return latencies.length > 0 ? latencies.reduce((sum, latency)=>sum + latency, 0) / latencies.length : 0;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
//# sourceMappingURL=transparency-system.js.map
|