claude-flow-novice 1.6.1 → 1.6.2
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/agents/cfn-loop/product-owner.md +54 -4
- package/.claude/commands/cfn-claude-sync.md +303 -0
- package/.claude/commands/cfn-loop-epic.md +290 -0
- package/.claude/commands/cfn-loop-single.md +168 -0
- package/.claude/commands/cfn-loop-sprints.md +384 -0
- package/.claude/commands/cfn-loop.md +180 -0
- package/.claude/commands/metrics-summary.md +58 -0
- package/.claude/commands/parse-epic.md +357 -0
- package/.claude/settings.json +4 -4
- package/.claude/settings.local.json +9 -2
- package/.claude-flow-novice/.claude/agents/cfn-loop/product-owner.md +792 -0
- package/.claude-flow-novice/dist/mcp/server.js +21 -2
- package/.claude-flow-novice/dist/src/api/claude-client.js +138 -3
- package/.claude-flow-novice/dist/src/api/claude-client.js.map +1 -1
- package/.claude-flow-novice/dist/src/cfn-loop/phase-orchestrator-example.js +1 -1
- package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js +247 -0
- package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js +32 -15
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/transparency.js +455 -0
- package/.claude-flow-novice/dist/src/cli/commands/transparency.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/CLAUDE.md +129 -13
- package/.claude-flow-novice/dist/src/components/visualizations/index.js +9 -0
- package/.claude-flow-novice/dist/src/components/visualizations/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +462 -0
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/config-translator.js +248 -0
- package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +287 -0
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js +68 -9
- package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/feature-flags.js +166 -0
- package/.claude-flow-novice/dist/src/coordination/feature-flags.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/queen-agent.js +18 -4
- package/.claude-flow-novice/dist/src/coordination/queen-agent.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/role-assignment.js +6 -110
- package/.claude-flow-novice/dist/src/coordination/role-assignment.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js +632 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js +11 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js +318 -0
- package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js +364 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js +492 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js +786 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js +342 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js +601 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js +211 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/index.js +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js +365 -6
- package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js +478 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js +5 -2
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js +189 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js +9 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js +669 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js +451 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js +271 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js +335 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js +439 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js +92 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js +21 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js +223 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js +436 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js +278 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js +317 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js +273 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js +15 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js +512 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/index.js +6 -0
- package/.claude-flow-novice/dist/src/coordination/v2/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js +557 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js +212 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js +552 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js +367 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js +371 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js +355 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js +295 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js +411 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js +387 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js +589 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js +444 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js +29 -8
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js +470 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js +450 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js +5 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js +545 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js +44 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js +415 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js +615 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js +259 -0
- package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js +17 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js +357 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js +679 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js.map +1 -0
- package/.claude-flow-novice/dist/src/core/agent-manager.js +30 -0
- package/.claude-flow-novice/dist/src/core/agent-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/mcp/server.js +21 -2
- package/.claude-flow-novice/dist/src/mcp/server.js.map +1 -1
- package/.claude-flow-novice/dist/src/observability/metrics-counter.js +268 -0
- package/.claude-flow-novice/dist/src/observability/metrics-counter.js.map +1 -0
- package/.claude-flow-novice/dist/src/observability/metrics-storage.js +265 -0
- package/.claude-flow-novice/dist/src/observability/metrics-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/observability/telemetry.js +26 -0
- package/.claude-flow-novice/dist/src/observability/telemetry.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/tiered-router.js +64 -10
- package/.claude-flow-novice/dist/src/providers/tiered-router.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/zai-provider.js +196 -97
- package/.claude-flow-novice/dist/src/providers/zai-provider.js.map +1 -1
- package/.claude-flow-novice/dist/src/slash-commands/cfn-claude-sync.js +533 -0
- package/.claude-flow-novice/dist/src/slash-commands/index.js +5 -0
- package/.claude-flow-novice/dist/src/slash-commands/metrics-summary-class.js +74 -0
- package/.claude-flow-novice/dist/src/slash-commands/metrics-summary.js +335 -0
- package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +12 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js +96 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js.map +1 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js +406 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js.map +1 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js +35 -5
- package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/web/api/config/api-config.js +186 -0
- package/.claude-flow-novice/dist/src/web/api/config/api-config.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/auth.js +205 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/auth.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/cache.js +262 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/cache.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js +250 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js +217 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/validation.js +325 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/validation.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/events.js +465 -0
- package/.claude-flow-novice/dist/src/web/api/routes/events.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js +302 -0
- package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/index.js +14 -0
- package/.claude-flow-novice/dist/src/web/api/routes/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/metrics.js +561 -0
- package/.claude-flow-novice/dist/src/web/api/routes/metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/status.js +450 -0
- package/.claude-flow-novice/dist/src/web/api/routes/status.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/server.js +451 -0
- package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js +385 -0
- package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/index.js +87 -0
- package/.claude-flow-novice/dist/src/web/dashboard/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/types.js +6 -0
- package/.claude-flow-novice/dist/src/web/dashboard/types.js.map +1 -0
- package/.claude-flow-novice/metrics.db +0 -0
- package/.claude-flow-novice/metrics.db-shm +0 -0
- package/.claude-flow-novice/metrics.db-wal +0 -0
- package/CLAUDE.md +29 -0
- package/README.md +27 -0
- package/config/hooks/post-edit-pipeline.js +36 -2
- package/examples/metrics-counter-demo.ts +106 -0
- package/examples/persistent-metrics-demo.ts +83 -0
- package/examples/phase-5-multi-level-control.ts +282 -0
- package/examples/session-pool-optimizer-example.ts +311 -0
- package/package.json +15 -3
- package/scripts/check-routing-stats.cjs +122 -0
- package/scripts/pre-publish-validation.cjs +212 -0
- package/scripts/test-provider-routing.cjs +228 -0
- package/scripts/test-routing-telemetry.cjs +147 -0
- package/scripts/test-zai-10k.cjs +81 -0
- package/scripts/test-zai-api.cjs +191 -0
- package/scripts/test-zai-diagnostic.cjs +151 -0
- package/scripts/test-zai-final.cjs +128 -0
- package/scripts/test-zai-with-env.cjs +85 -0
- package/scripts/validate-coordination-cli.js +69 -0
- package/scripts/validate-coordination-toggle-integration.cjs +501 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md +29 -0
- package/src/observability/metrics-counter.ts +347 -0
- package/src/observability/metrics-storage.ts +356 -0
- package/src/observability/telemetry.ts +658 -0
- package/src/slash-commands/cfn-claude-sync.js +533 -0
- package/src/slash-commands/index.js +5 -0
- package/src/slash-commands/metrics-summary-class.js +74 -0
- package/src/slash-commands/metrics-summary.js +335 -0
- package/src/slash-commands/register-all-commands.js +12 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deadlock Detection Engine
|
|
3
|
+
*
|
|
4
|
+
* Implements Tarjan's strongly connected components (SCC) algorithm for efficient
|
|
5
|
+
* cycle detection in agent dependency graphs. Detects circular wait conditions
|
|
6
|
+
* in <50ms for graphs with 50+ nodes.
|
|
7
|
+
*
|
|
8
|
+
* @module coordination/v2/deadlock/deadlock-detector
|
|
9
|
+
*/ import { EventEmitter } from 'events';
|
|
10
|
+
/**
|
|
11
|
+
* Deadlock Detection Engine using Tarjan's SCC algorithm
|
|
12
|
+
*
|
|
13
|
+
* Efficiently detects circular wait conditions in agent dependency graphs.
|
|
14
|
+
* Emits events when deadlocks are detected for resolution handling.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const detector = new DeadlockDetector({
|
|
19
|
+
* detectionInterval: 500,
|
|
20
|
+
* maxDetectionTime: 50
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* detector.on('deadlock', (cycle: DeadlockCycle) => {
|
|
24
|
+
* console.log(`Deadlock detected: ${cycle.agents.join(' -> ')}`);
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Register agents and dependencies
|
|
28
|
+
* detector.registerAgent('agent-1', { state: 'waiting', priority: 5 });
|
|
29
|
+
* detector.addDependency('agent-1', 'agent-2', 'agent');
|
|
30
|
+
*
|
|
31
|
+
* // Start automatic detection
|
|
32
|
+
* detector.startDetection();
|
|
33
|
+
* ```
|
|
34
|
+
*/ export class DeadlockDetector extends EventEmitter {
|
|
35
|
+
config;
|
|
36
|
+
agents = new Map();
|
|
37
|
+
detectionTimer;
|
|
38
|
+
metrics;
|
|
39
|
+
index = 0;
|
|
40
|
+
stack = [];
|
|
41
|
+
tarjanData = new Map();
|
|
42
|
+
operationLock = Promise.resolve();
|
|
43
|
+
constructor(config = {}){
|
|
44
|
+
super(), this.config = config;
|
|
45
|
+
this.metrics = {
|
|
46
|
+
totalDetections: 0,
|
|
47
|
+
deadlocksDetected: 0,
|
|
48
|
+
avgDetectionTime: 0,
|
|
49
|
+
maxDetectionTime: 0,
|
|
50
|
+
lastDetectionTime: 0,
|
|
51
|
+
graphSize: 0
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Register an agent in the dependency graph
|
|
56
|
+
*
|
|
57
|
+
* @param agentId - Unique agent identifier
|
|
58
|
+
* @param options - Agent configuration
|
|
59
|
+
*/ registerAgent(agentId, options = {}) {
|
|
60
|
+
const maxAgents = this.config.maxAgents || 1000;
|
|
61
|
+
if (this.agents.size >= maxAgents && !this.agents.has(agentId)) {
|
|
62
|
+
throw new Error(`Agent limit reached (${maxAgents} max)`);
|
|
63
|
+
}
|
|
64
|
+
const node = {
|
|
65
|
+
agentId,
|
|
66
|
+
holdingResources: new Set(options.holdingResources || []),
|
|
67
|
+
waitingForResources: new Set(options.waitingForResources || []),
|
|
68
|
+
state: options.state || 'idle',
|
|
69
|
+
stateChangedAt: Date.now(),
|
|
70
|
+
priority: options.priority
|
|
71
|
+
};
|
|
72
|
+
this.agents.set(agentId, node);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Unregister an agent from the dependency graph
|
|
76
|
+
*
|
|
77
|
+
* @param agentId - Agent identifier to remove
|
|
78
|
+
*/ unregisterAgent(agentId) {
|
|
79
|
+
this.agents.delete(agentId);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Add a dependency relationship between agents/resources
|
|
83
|
+
*
|
|
84
|
+
* @param fromAgentId - Agent waiting for resource
|
|
85
|
+
* @param toResourceId - Resource or agent being waited on
|
|
86
|
+
* @param resourceType - Type of the resource
|
|
87
|
+
*/ async addDependency(fromAgentId, toResourceId, resourceType = 'other') {
|
|
88
|
+
return this.withLock(async ()=>{
|
|
89
|
+
const agent = this.agents.get(fromAgentId);
|
|
90
|
+
if (!agent) {
|
|
91
|
+
throw new Error(`Agent not registered: ${fromAgentId}`);
|
|
92
|
+
}
|
|
93
|
+
// SEC-DOS-001: Enforce edge limit per agent
|
|
94
|
+
const maxEdgesPerAgent = this.config.maxEdgesPerAgent || 100;
|
|
95
|
+
if (agent.waitingForResources.size >= maxEdgesPerAgent) {
|
|
96
|
+
throw new Error(`Edge limit reached for agent ${fromAgentId} (${maxEdgesPerAgent} max)`);
|
|
97
|
+
}
|
|
98
|
+
agent.waitingForResources.add(toResourceId);
|
|
99
|
+
// If resource is another agent, update their holding resources
|
|
100
|
+
if (resourceType === 'agent') {
|
|
101
|
+
const targetAgent = this.agents.get(toResourceId);
|
|
102
|
+
if (targetAgent) {
|
|
103
|
+
targetAgent.holdingResources.add(fromAgentId);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Remove a dependency relationship
|
|
110
|
+
*
|
|
111
|
+
* @param fromAgentId - Agent that was waiting
|
|
112
|
+
* @param toResourceId - Resource that was being waited on
|
|
113
|
+
*/ async removeDependency(fromAgentId, toResourceId) {
|
|
114
|
+
return this.withLock(async ()=>{
|
|
115
|
+
const agent = this.agents.get(fromAgentId);
|
|
116
|
+
if (agent) {
|
|
117
|
+
agent.waitingForResources.delete(toResourceId);
|
|
118
|
+
}
|
|
119
|
+
const targetAgent = this.agents.get(toResourceId);
|
|
120
|
+
if (targetAgent) {
|
|
121
|
+
targetAgent.holdingResources.delete(fromAgentId);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Update agent state
|
|
127
|
+
*
|
|
128
|
+
* @param agentId - Agent to update
|
|
129
|
+
* @param state - New state
|
|
130
|
+
*/ updateAgentState(agentId, state) {
|
|
131
|
+
const agent = this.agents.get(agentId);
|
|
132
|
+
if (agent) {
|
|
133
|
+
agent.state = state;
|
|
134
|
+
agent.stateChangedAt = Date.now();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Detect deadlocks using Tarjan's SCC algorithm
|
|
139
|
+
*
|
|
140
|
+
* Finds all strongly connected components in the wait-for graph.
|
|
141
|
+
* Components with size ≥ minCycleLength are considered deadlocks.
|
|
142
|
+
*
|
|
143
|
+
* @returns Array of detected deadlock cycles
|
|
144
|
+
*/ async detectDeadlocks() {
|
|
145
|
+
const maxDetectionTime = this.config.maxDetectionTime || 50;
|
|
146
|
+
const controller = new AbortController();
|
|
147
|
+
const timeout = setTimeout(()=>controller.abort(), maxDetectionTime);
|
|
148
|
+
try {
|
|
149
|
+
return await this.detectWithTimeout(controller.signal);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
if (controller.signal.aborted) {
|
|
152
|
+
this.emit('warning', {
|
|
153
|
+
type: 'detection-timeout',
|
|
154
|
+
maxTime: maxDetectionTime,
|
|
155
|
+
graphSize: this.agents.size
|
|
156
|
+
});
|
|
157
|
+
return []; // Return empty on timeout to prevent hanging
|
|
158
|
+
}
|
|
159
|
+
throw error;
|
|
160
|
+
} finally{
|
|
161
|
+
clearTimeout(timeout);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Internal detection with timeout enforcement (SEC-DOS-002)
|
|
166
|
+
*
|
|
167
|
+
* @param signal - AbortSignal for timeout control
|
|
168
|
+
* @returns Array of detected deadlock cycles
|
|
169
|
+
*/ async detectWithTimeout(signal) {
|
|
170
|
+
const startTime = performance.now();
|
|
171
|
+
const cycles = [];
|
|
172
|
+
// Reset Tarjan algorithm state
|
|
173
|
+
this.index = 0;
|
|
174
|
+
this.stack = [];
|
|
175
|
+
this.tarjanData.clear();
|
|
176
|
+
// Run Tarjan's algorithm for each unvisited node
|
|
177
|
+
for (const agentId of Array.from(this.agents.keys())){
|
|
178
|
+
if (signal.aborted) {
|
|
179
|
+
throw new Error('Detection aborted due to timeout');
|
|
180
|
+
}
|
|
181
|
+
if (!this.tarjanData.has(agentId)) {
|
|
182
|
+
this.strongConnect(agentId, cycles);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// Update metrics
|
|
186
|
+
const detectionTime = performance.now() - startTime;
|
|
187
|
+
this.updateMetrics(detectionTime, cycles.length);
|
|
188
|
+
// Emit deadlock events
|
|
189
|
+
cycles.forEach((cycle)=>{
|
|
190
|
+
this.emit('deadlock', cycle);
|
|
191
|
+
});
|
|
192
|
+
// Check if detection exceeded time limit
|
|
193
|
+
if (this.config.maxDetectionTime && detectionTime > this.config.maxDetectionTime) {
|
|
194
|
+
this.emit('warning', {
|
|
195
|
+
type: 'slow-detection',
|
|
196
|
+
detectionTime,
|
|
197
|
+
maxTime: this.config.maxDetectionTime,
|
|
198
|
+
graphSize: this.agents.size
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return cycles;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Tarjan's strongly connected components algorithm (recursive DFS)
|
|
205
|
+
*
|
|
206
|
+
* @param agentId - Current agent being visited
|
|
207
|
+
* @param cycles - Array to collect detected cycles
|
|
208
|
+
*/ strongConnect(agentId, cycles) {
|
|
209
|
+
const agent = this.agents.get(agentId);
|
|
210
|
+
if (!agent) return;
|
|
211
|
+
// Initialize node data
|
|
212
|
+
const nodeData = {
|
|
213
|
+
index: this.index,
|
|
214
|
+
lowLink: this.index,
|
|
215
|
+
onStack: true
|
|
216
|
+
};
|
|
217
|
+
this.tarjanData.set(agentId, nodeData);
|
|
218
|
+
this.index++;
|
|
219
|
+
this.stack.push(agentId);
|
|
220
|
+
// Visit all waiting dependencies
|
|
221
|
+
for (const waitingFor of Array.from(agent.waitingForResources)){
|
|
222
|
+
// Only follow agent dependencies for cycle detection
|
|
223
|
+
const waitingAgent = this.agents.get(waitingFor);
|
|
224
|
+
if (!waitingAgent) continue;
|
|
225
|
+
const waitingData = this.tarjanData.get(waitingFor);
|
|
226
|
+
if (!waitingData) {
|
|
227
|
+
// Not visited yet, recurse
|
|
228
|
+
this.strongConnect(waitingFor, cycles);
|
|
229
|
+
const updatedWaitingData = this.tarjanData.get(waitingFor);
|
|
230
|
+
nodeData.lowLink = Math.min(nodeData.lowLink, updatedWaitingData.lowLink);
|
|
231
|
+
} else if (waitingData.onStack) {
|
|
232
|
+
// Already on stack, found back edge
|
|
233
|
+
nodeData.lowLink = Math.min(nodeData.lowLink, waitingData.index);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// If this is a root node, extract SCC
|
|
237
|
+
if (nodeData.lowLink === nodeData.index) {
|
|
238
|
+
const scc = [];
|
|
239
|
+
let currentAgentId;
|
|
240
|
+
do {
|
|
241
|
+
currentAgentId = this.stack.pop();
|
|
242
|
+
const currentData = this.tarjanData.get(currentAgentId);
|
|
243
|
+
currentData.onStack = false;
|
|
244
|
+
scc.push(currentAgentId);
|
|
245
|
+
}while (currentAgentId !== agentId)
|
|
246
|
+
// Check if SCC is a deadlock (cycle with ≥ minCycleLength nodes)
|
|
247
|
+
const minCycleLength = this.config.minCycleLength || 2;
|
|
248
|
+
if (scc.length >= minCycleLength) {
|
|
249
|
+
const cycle = this.createDeadlockCycle(scc);
|
|
250
|
+
cycles.push(cycle);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Create a DeadlockCycle object from detected SCC
|
|
256
|
+
*
|
|
257
|
+
* @param agentIds - Agents involved in the cycle
|
|
258
|
+
* @returns Deadlock cycle metadata
|
|
259
|
+
*/ createDeadlockCycle(agentIds) {
|
|
260
|
+
const resources = new Set();
|
|
261
|
+
let totalPriority = 0;
|
|
262
|
+
// Collect all resources and calculate severity
|
|
263
|
+
agentIds.forEach((agentId)=>{
|
|
264
|
+
const agent = this.agents.get(agentId);
|
|
265
|
+
if (agent) {
|
|
266
|
+
agent.waitingForResources.forEach((res)=>resources.add(res));
|
|
267
|
+
totalPriority += agent.priority || 0;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
// Calculate severity (higher for longer cycles and higher priority agents)
|
|
271
|
+
const severity = agentIds.length * 10 + (totalPriority / agentIds.length || 0);
|
|
272
|
+
// Determine resolution strategy (prioritize cycle complexity)
|
|
273
|
+
let resolution = 'abort';
|
|
274
|
+
if (agentIds.length === 2) {
|
|
275
|
+
resolution = 'priority-based'; // Simple cycle, use priority
|
|
276
|
+
} else if (agentIds.length > 5) {
|
|
277
|
+
resolution = 'timeout'; // Complex cycle, use timeout
|
|
278
|
+
} else if (severity > 50) {
|
|
279
|
+
resolution = 'rollback'; // High priority agents, try rollback
|
|
280
|
+
}
|
|
281
|
+
return {
|
|
282
|
+
cycleId: `cycle-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
283
|
+
agents: agentIds,
|
|
284
|
+
resources: Array.from(resources),
|
|
285
|
+
detectedAt: Date.now(),
|
|
286
|
+
severity,
|
|
287
|
+
resolution
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Update detection metrics
|
|
292
|
+
*
|
|
293
|
+
* @param detectionTime - Time taken for detection in ms
|
|
294
|
+
* @param cyclesFound - Number of cycles detected
|
|
295
|
+
*/ updateMetrics(detectionTime, cyclesFound) {
|
|
296
|
+
if (!this.config.enableMetrics) return;
|
|
297
|
+
this.metrics.totalDetections++;
|
|
298
|
+
this.metrics.deadlocksDetected += cyclesFound;
|
|
299
|
+
this.metrics.lastDetectionTime = detectionTime;
|
|
300
|
+
this.metrics.maxDetectionTime = Math.max(this.metrics.maxDetectionTime, detectionTime);
|
|
301
|
+
this.metrics.graphSize = this.agents.size;
|
|
302
|
+
// Calculate running average
|
|
303
|
+
const totalTime = this.metrics.avgDetectionTime * (this.metrics.totalDetections - 1) + detectionTime;
|
|
304
|
+
this.metrics.avgDetectionTime = totalTime / this.metrics.totalDetections;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Start automatic deadlock detection
|
|
308
|
+
*
|
|
309
|
+
* Runs detection at configured intervals
|
|
310
|
+
*/ startDetection() {
|
|
311
|
+
if (this.detectionTimer) {
|
|
312
|
+
return; // Already running
|
|
313
|
+
}
|
|
314
|
+
const interval = this.config.detectionInterval || 1000;
|
|
315
|
+
this.detectionTimer = setInterval(()=>{
|
|
316
|
+
if (this.agents.size > 0) {
|
|
317
|
+
this.detectDeadlocks().catch((error)=>{
|
|
318
|
+
this.emit('error', {
|
|
319
|
+
type: 'detection-error',
|
|
320
|
+
error: error instanceof Error ? error.message : String(error)
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}, interval);
|
|
325
|
+
this.emit('detection-started', {
|
|
326
|
+
interval
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Stop automatic deadlock detection
|
|
331
|
+
*/ stopDetection() {
|
|
332
|
+
if (this.detectionTimer) {
|
|
333
|
+
clearInterval(this.detectionTimer);
|
|
334
|
+
this.detectionTimer = undefined;
|
|
335
|
+
this.emit('detection-stopped');
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Get current detection metrics
|
|
340
|
+
*
|
|
341
|
+
* @returns Performance metrics
|
|
342
|
+
*/ getMetrics() {
|
|
343
|
+
return {
|
|
344
|
+
...this.metrics
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Get current dependency graph state
|
|
349
|
+
*
|
|
350
|
+
* @returns Map of agent nodes
|
|
351
|
+
*/ getGraph() {
|
|
352
|
+
return new Map(this.agents);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Clear all agents and dependencies
|
|
356
|
+
*/ clear() {
|
|
357
|
+
this.agents.clear();
|
|
358
|
+
this.tarjanData.clear();
|
|
359
|
+
this.stack = [];
|
|
360
|
+
this.index = 0;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Export graph to DOT format for visualization
|
|
364
|
+
*
|
|
365
|
+
* @returns DOT format string
|
|
366
|
+
*/ toDot() {
|
|
367
|
+
let dot = 'digraph WaitForGraph {\n';
|
|
368
|
+
dot += ' rankdir=LR;\n';
|
|
369
|
+
dot += ' node [shape=box];\n\n';
|
|
370
|
+
// Add nodes
|
|
371
|
+
for (const [agentId, agent] of Array.from(this.agents)){
|
|
372
|
+
let color = 'white';
|
|
373
|
+
if (agent.state === 'waiting') color = 'yellow';
|
|
374
|
+
if (agent.state === 'blocked') color = 'red';
|
|
375
|
+
if (agent.state === 'working') color = 'lightgreen';
|
|
376
|
+
dot += ` "${agentId}" [style=filled, fillcolor=${color}, label="${agentId}\\n${agent.state}"];\n`;
|
|
377
|
+
}
|
|
378
|
+
dot += '\n';
|
|
379
|
+
// Add edges (wait-for relationships)
|
|
380
|
+
for (const [agentId, agent] of Array.from(this.agents)){
|
|
381
|
+
for (const waitingFor of Array.from(agent.waitingForResources)){
|
|
382
|
+
dot += ` "${agentId}" -> "${waitingFor}" [label="waits for"];\n`;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
dot += '}\n';
|
|
386
|
+
return dot;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Cleanup resources
|
|
390
|
+
*/ destroy() {
|
|
391
|
+
this.stopDetection();
|
|
392
|
+
this.clear();
|
|
393
|
+
this.removeAllListeners();
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Lock helper for atomic operations (SEC-RACE-001 fix)
|
|
397
|
+
*
|
|
398
|
+
* Prevents TOCTOU race conditions by ensuring exclusive access
|
|
399
|
+
* to shared state during critical sections.
|
|
400
|
+
*
|
|
401
|
+
* Rust equivalent pattern:
|
|
402
|
+
* ```rust
|
|
403
|
+
* async fn with_lock<T, F>(&self, f: F) -> T
|
|
404
|
+
* where F: FnOnce() -> T {
|
|
405
|
+
* let _guard = self.lock.lock().await;
|
|
406
|
+
* f()
|
|
407
|
+
* }
|
|
408
|
+
* ```
|
|
409
|
+
*/ async withLock(fn) {
|
|
410
|
+
const currentLock = this.operationLock;
|
|
411
|
+
let resolveLock;
|
|
412
|
+
this.operationLock = new Promise((resolve)=>{
|
|
413
|
+
resolveLock = resolve;
|
|
414
|
+
});
|
|
415
|
+
try {
|
|
416
|
+
await currentLock;
|
|
417
|
+
return await fn();
|
|
418
|
+
} finally{
|
|
419
|
+
resolveLock();
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
//# sourceMappingURL=deadlock-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/coordination/v2/deadlock/deadlock-detector.ts"],"names":["EventEmitter","DeadlockDetector","agents","Map","detectionTimer","metrics","index","stack","tarjanData","operationLock","Promise","resolve","config","totalDetections","deadlocksDetected","avgDetectionTime","maxDetectionTime","lastDetectionTime","graphSize","registerAgent","agentId","options","maxAgents","size","has","Error","node","holdingResources","Set","waitingForResources","state","stateChangedAt","Date","now","priority","set","unregisterAgent","delete","addDependency","fromAgentId","toResourceId","resourceType","withLock","agent","get","maxEdgesPerAgent","add","targetAgent","removeDependency","updateAgentState","detectDeadlocks","controller","AbortController","timeout","setTimeout","abort","detectWithTimeout","signal","error","aborted","emit","type","maxTime","clearTimeout","startTime","performance","cycles","clear","Array","from","keys","strongConnect","detectionTime","updateMetrics","length","forEach","cycle","nodeData","lowLink","onStack","push","waitingFor","waitingAgent","waitingData","updatedWaitingData","Math","min","scc","currentAgentId","pop","currentData","minCycleLength","createDeadlockCycle","agentIds","resources","totalPriority","res","severity","resolution","cycleId","random","toString","slice","detectedAt","cyclesFound","enableMetrics","max","totalTime","startDetection","interval","detectionInterval","setInterval","catch","message","String","stopDetection","clearInterval","undefined","getMetrics","getGraph","toDot","dot","color","destroy","removeAllListeners","fn","currentLock","resolveLock"],"mappings":"AAAA;;;;;;;;CAQC,GAED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