agentic-qe 3.6.0 → 3.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/v3/qe-devils-advocate.md +218 -0
- package/.claude/agents/v3/qe-quality-criteria-recommender.md +2 -2
- package/.claude/skills/qe-iterative-loop/SKILL.md +1 -1
- package/.claude/skills/release/SKILL.md +17 -31
- package/.claude/skills/skills-manifest.json +1 -1
- package/README.md +38 -35
- package/package.json +1 -1
- package/scripts/cloud-db-config.json +1 -1
- package/v3/CHANGELOG.md +44 -0
- package/v3/README.md +7 -7
- package/v3/assets/agents/v3/qe-devils-advocate.md +218 -0
- package/v3/assets/agents/v3/qe-quality-criteria-recommender.md +2 -2
- package/v3/assets/skills/qe-iterative-loop/SKILL.md +1 -1
- package/v3/dist/agents/devils-advocate/agent.d.ts +103 -0
- package/v3/dist/agents/devils-advocate/agent.d.ts.map +1 -0
- package/v3/dist/agents/devils-advocate/agent.js +240 -0
- package/v3/dist/agents/devils-advocate/agent.js.map +1 -0
- package/v3/dist/agents/devils-advocate/index.d.ts +60 -0
- package/v3/dist/agents/devils-advocate/index.d.ts.map +1 -0
- package/v3/dist/agents/devils-advocate/index.js +72 -0
- package/v3/dist/agents/devils-advocate/index.js.map +1 -0
- package/v3/dist/agents/devils-advocate/strategies.d.ts +59 -0
- package/v3/dist/agents/devils-advocate/strategies.d.ts.map +1 -0
- package/v3/dist/agents/devils-advocate/strategies.js +438 -0
- package/v3/dist/agents/devils-advocate/strategies.js.map +1 -0
- package/v3/dist/agents/devils-advocate/types.d.ts +182 -0
- package/v3/dist/agents/devils-advocate/types.d.ts.map +1 -0
- package/v3/dist/agents/devils-advocate/types.js +96 -0
- package/v3/dist/agents/devils-advocate/types.js.map +1 -0
- package/v3/dist/agents/index.d.ts +20 -0
- package/v3/dist/agents/index.d.ts.map +1 -0
- package/v3/dist/agents/index.js +20 -0
- package/v3/dist/agents/index.js.map +1 -0
- package/v3/dist/cli/bundle.js +4489 -119
- package/v3/dist/coordination/agent-teams/adapter.d.ts +108 -0
- package/v3/dist/coordination/agent-teams/adapter.d.ts.map +1 -0
- package/v3/dist/coordination/agent-teams/adapter.js +316 -0
- package/v3/dist/coordination/agent-teams/adapter.js.map +1 -0
- package/v3/dist/coordination/agent-teams/domain-team-manager.d.ts +164 -0
- package/v3/dist/coordination/agent-teams/domain-team-manager.d.ts.map +1 -0
- package/v3/dist/coordination/agent-teams/domain-team-manager.js +342 -0
- package/v3/dist/coordination/agent-teams/domain-team-manager.js.map +1 -0
- package/v3/dist/coordination/agent-teams/index.d.ts +53 -0
- package/v3/dist/coordination/agent-teams/index.d.ts.map +1 -0
- package/v3/dist/coordination/agent-teams/index.js +61 -0
- package/v3/dist/coordination/agent-teams/index.js.map +1 -0
- package/v3/dist/coordination/agent-teams/mailbox.d.ts +142 -0
- package/v3/dist/coordination/agent-teams/mailbox.d.ts.map +1 -0
- package/v3/dist/coordination/agent-teams/mailbox.js +395 -0
- package/v3/dist/coordination/agent-teams/mailbox.js.map +1 -0
- package/v3/dist/coordination/agent-teams/tracing.d.ts +199 -0
- package/v3/dist/coordination/agent-teams/tracing.d.ts.map +1 -0
- package/v3/dist/coordination/agent-teams/tracing.js +308 -0
- package/v3/dist/coordination/agent-teams/tracing.js.map +1 -0
- package/v3/dist/coordination/agent-teams/types.d.ts +121 -0
- package/v3/dist/coordination/agent-teams/types.d.ts.map +1 -0
- package/v3/dist/coordination/agent-teams/types.js +17 -0
- package/v3/dist/coordination/agent-teams/types.js.map +1 -0
- package/v3/dist/coordination/circuit-breaker/breaker-registry.d.ts +146 -0
- package/v3/dist/coordination/circuit-breaker/breaker-registry.d.ts.map +1 -0
- package/v3/dist/coordination/circuit-breaker/breaker-registry.js +368 -0
- package/v3/dist/coordination/circuit-breaker/breaker-registry.js.map +1 -0
- package/v3/dist/coordination/circuit-breaker/domain-circuit-breaker.d.ts +134 -0
- package/v3/dist/coordination/circuit-breaker/domain-circuit-breaker.d.ts.map +1 -0
- package/v3/dist/coordination/circuit-breaker/domain-circuit-breaker.js +337 -0
- package/v3/dist/coordination/circuit-breaker/domain-circuit-breaker.js.map +1 -0
- package/v3/dist/coordination/circuit-breaker/index.d.ts +46 -0
- package/v3/dist/coordination/circuit-breaker/index.d.ts.map +1 -0
- package/v3/dist/coordination/circuit-breaker/index.js +51 -0
- package/v3/dist/coordination/circuit-breaker/index.js.map +1 -0
- package/v3/dist/coordination/circuit-breaker/types.d.ts +112 -0
- package/v3/dist/coordination/circuit-breaker/types.d.ts.map +1 -0
- package/v3/dist/coordination/circuit-breaker/types.js +10 -0
- package/v3/dist/coordination/circuit-breaker/types.js.map +1 -0
- package/v3/dist/coordination/competing-hypotheses/hypothesis-manager.d.ts +122 -0
- package/v3/dist/coordination/competing-hypotheses/hypothesis-manager.d.ts.map +1 -0
- package/v3/dist/coordination/competing-hypotheses/hypothesis-manager.js +377 -0
- package/v3/dist/coordination/competing-hypotheses/hypothesis-manager.js.map +1 -0
- package/v3/dist/coordination/competing-hypotheses/index.d.ts +34 -0
- package/v3/dist/coordination/competing-hypotheses/index.d.ts.map +1 -0
- package/v3/dist/coordination/competing-hypotheses/index.js +39 -0
- package/v3/dist/coordination/competing-hypotheses/index.js.map +1 -0
- package/v3/dist/coordination/competing-hypotheses/types.d.ts +134 -0
- package/v3/dist/coordination/competing-hypotheses/types.d.ts.map +1 -0
- package/v3/dist/coordination/competing-hypotheses/types.js +20 -0
- package/v3/dist/coordination/competing-hypotheses/types.js.map +1 -0
- package/v3/dist/coordination/dynamic-scaling/dynamic-scaler.d.ts +173 -0
- package/v3/dist/coordination/dynamic-scaling/dynamic-scaler.d.ts.map +1 -0
- package/v3/dist/coordination/dynamic-scaling/dynamic-scaler.js +368 -0
- package/v3/dist/coordination/dynamic-scaling/dynamic-scaler.js.map +1 -0
- package/v3/dist/coordination/dynamic-scaling/index.d.ts +38 -0
- package/v3/dist/coordination/dynamic-scaling/index.d.ts.map +1 -0
- package/v3/dist/coordination/dynamic-scaling/index.js +39 -0
- package/v3/dist/coordination/dynamic-scaling/index.js.map +1 -0
- package/v3/dist/coordination/dynamic-scaling/types.d.ts +147 -0
- package/v3/dist/coordination/dynamic-scaling/types.d.ts.map +1 -0
- package/v3/dist/coordination/dynamic-scaling/types.js +40 -0
- package/v3/dist/coordination/dynamic-scaling/types.js.map +1 -0
- package/v3/dist/coordination/federation/federation-mailbox.d.ts +215 -0
- package/v3/dist/coordination/federation/federation-mailbox.d.ts.map +1 -0
- package/v3/dist/coordination/federation/federation-mailbox.js +442 -0
- package/v3/dist/coordination/federation/federation-mailbox.js.map +1 -0
- package/v3/dist/coordination/federation/index.d.ts +38 -0
- package/v3/dist/coordination/federation/index.d.ts.map +1 -0
- package/v3/dist/coordination/federation/index.js +39 -0
- package/v3/dist/coordination/federation/index.js.map +1 -0
- package/v3/dist/coordination/federation/types.d.ts +103 -0
- package/v3/dist/coordination/federation/types.d.ts.map +1 -0
- package/v3/dist/coordination/federation/types.js +20 -0
- package/v3/dist/coordination/federation/types.js.map +1 -0
- package/v3/dist/coordination/fleet-tiers/index.d.ts +39 -0
- package/v3/dist/coordination/fleet-tiers/index.d.ts.map +1 -0
- package/v3/dist/coordination/fleet-tiers/index.js +44 -0
- package/v3/dist/coordination/fleet-tiers/index.js.map +1 -0
- package/v3/dist/coordination/fleet-tiers/tier-config.d.ts +60 -0
- package/v3/dist/coordination/fleet-tiers/tier-config.d.ts.map +1 -0
- package/v3/dist/coordination/fleet-tiers/tier-config.js +242 -0
- package/v3/dist/coordination/fleet-tiers/tier-config.js.map +1 -0
- package/v3/dist/coordination/fleet-tiers/tier-selector.d.ts +134 -0
- package/v3/dist/coordination/fleet-tiers/tier-selector.d.ts.map +1 -0
- package/v3/dist/coordination/fleet-tiers/tier-selector.js +373 -0
- package/v3/dist/coordination/fleet-tiers/tier-selector.js.map +1 -0
- package/v3/dist/coordination/fleet-tiers/types.d.ts +137 -0
- package/v3/dist/coordination/fleet-tiers/types.d.ts.map +1 -0
- package/v3/dist/coordination/fleet-tiers/types.js +20 -0
- package/v3/dist/coordination/fleet-tiers/types.js.map +1 -0
- package/v3/dist/coordination/index.d.ts +16 -0
- package/v3/dist/coordination/index.d.ts.map +1 -1
- package/v3/dist/coordination/index.js +29 -0
- package/v3/dist/coordination/index.js.map +1 -1
- package/v3/dist/coordination/queen-coordinator.d.ts +79 -0
- package/v3/dist/coordination/queen-coordinator.d.ts.map +1 -1
- package/v3/dist/coordination/queen-coordinator.js +363 -0
- package/v3/dist/coordination/queen-coordinator.js.map +1 -1
- package/v3/dist/coordination/task-dag/dag.d.ts +93 -0
- package/v3/dist/coordination/task-dag/dag.d.ts.map +1 -0
- package/v3/dist/coordination/task-dag/dag.js +496 -0
- package/v3/dist/coordination/task-dag/dag.js.map +1 -0
- package/v3/dist/coordination/task-dag/index.d.ts +54 -0
- package/v3/dist/coordination/task-dag/index.d.ts.map +1 -0
- package/v3/dist/coordination/task-dag/index.js +62 -0
- package/v3/dist/coordination/task-dag/index.js.map +1 -0
- package/v3/dist/coordination/task-dag/scheduler.d.ts +123 -0
- package/v3/dist/coordination/task-dag/scheduler.d.ts.map +1 -0
- package/v3/dist/coordination/task-dag/scheduler.js +262 -0
- package/v3/dist/coordination/task-dag/scheduler.js.map +1 -0
- package/v3/dist/coordination/task-dag/types.d.ts +103 -0
- package/v3/dist/coordination/task-dag/types.d.ts.map +1 -0
- package/v3/dist/coordination/task-dag/types.js +9 -0
- package/v3/dist/coordination/task-dag/types.js.map +1 -0
- package/v3/dist/domains/enterprise-integration/services/odata-service.js +3 -3
- package/v3/dist/domains/enterprise-integration/services/odata-service.js.map +1 -1
- package/v3/dist/domains/enterprise-integration/services/soap-wsdl-service.d.ts.map +1 -1
- package/v3/dist/domains/enterprise-integration/services/soap-wsdl-service.js +9 -4
- package/v3/dist/domains/enterprise-integration/services/soap-wsdl-service.js.map +1 -1
- package/v3/dist/domains/requirements-validation/services/quality-criteria/quality-criteria-service.js +1 -1
- package/v3/dist/domains/requirements-validation/services/quality-criteria/quality-criteria-service.js.map +1 -1
- package/v3/dist/hooks/index.d.ts +8 -1
- package/v3/dist/hooks/index.d.ts.map +1 -1
- package/v3/dist/hooks/index.js +8 -1
- package/v3/dist/hooks/index.js.map +1 -1
- package/v3/dist/hooks/quality-gate-enforcer.d.ts +134 -0
- package/v3/dist/hooks/quality-gate-enforcer.d.ts.map +1 -0
- package/v3/dist/hooks/quality-gate-enforcer.js +265 -0
- package/v3/dist/hooks/quality-gate-enforcer.js.map +1 -0
- package/v3/dist/hooks/reasoning-bank-pattern-store.d.ts +60 -0
- package/v3/dist/hooks/reasoning-bank-pattern-store.d.ts.map +1 -0
- package/v3/dist/hooks/reasoning-bank-pattern-store.js +179 -0
- package/v3/dist/hooks/reasoning-bank-pattern-store.js.map +1 -0
- package/v3/dist/hooks/task-completed-hook.d.ts +174 -0
- package/v3/dist/hooks/task-completed-hook.d.ts.map +1 -0
- package/v3/dist/hooks/task-completed-hook.js +330 -0
- package/v3/dist/hooks/task-completed-hook.js.map +1 -0
- package/v3/dist/hooks/teammate-idle-hook.d.ts +167 -0
- package/v3/dist/hooks/teammate-idle-hook.d.ts.map +1 -0
- package/v3/dist/hooks/teammate-idle-hook.js +332 -0
- package/v3/dist/hooks/teammate-idle-hook.js.map +1 -0
- package/v3/dist/index.d.ts +3 -0
- package/v3/dist/index.d.ts.map +1 -1
- package/v3/dist/index.js +4 -0
- package/v3/dist/index.js.map +1 -1
- package/v3/dist/init/agents-installer.d.ts +5 -1
- package/v3/dist/init/agents-installer.d.ts.map +1 -1
- package/v3/dist/init/agents-installer.js +13 -5
- package/v3/dist/init/agents-installer.js.map +1 -1
- package/v3/dist/init/phases/12-verification.d.ts.map +1 -1
- package/v3/dist/init/phases/12-verification.js +13 -1
- package/v3/dist/init/phases/12-verification.js.map +1 -1
- package/v3/dist/kernel/unified-memory.d.ts.map +1 -1
- package/v3/dist/kernel/unified-memory.js +303 -18
- package/v3/dist/kernel/unified-memory.js.map +1 -1
- package/v3/dist/learning/pattern-store.js +1 -1
- package/v3/dist/learning/pattern-store.js.map +1 -1
- package/v3/dist/learning/qe-patterns.d.ts +2 -0
- package/v3/dist/learning/qe-patterns.d.ts.map +1 -1
- package/v3/dist/learning/qe-patterns.js.map +1 -1
- package/v3/dist/learning/qe-reasoning-bank.d.ts.map +1 -1
- package/v3/dist/learning/qe-reasoning-bank.js +16 -3
- package/v3/dist/learning/qe-reasoning-bank.js.map +1 -1
- package/v3/dist/mcp/bundle.js +4473 -133
- package/v3/dist/sync/cloud/tunnel-manager.d.ts.map +1 -1
- package/v3/dist/sync/cloud/tunnel-manager.js +11 -0
- package/v3/dist/sync/cloud/tunnel-manager.js.map +1 -1
- package/v3/package.json +1 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Task Dependency DAG
|
|
3
|
+
* ADR-064 Phase 1E: Core DAG data structure for task dependency tracking
|
|
4
|
+
*
|
|
5
|
+
* Directed acyclic graph where nodes are tasks and edges represent
|
|
6
|
+
* "blocked-by" dependencies. Topological sort via Kahn's algorithm,
|
|
7
|
+
* cycle detection via DFS coloring, critical path via longest-path DP.
|
|
8
|
+
*/
|
|
9
|
+
import type { DAGTask, AddTaskInput, DAGStats, DAGEventHandler } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Directed acyclic graph for task dependency management.
|
|
12
|
+
*
|
|
13
|
+
* Tasks are nodes with forward edges (blockedBy) and reverse edges (blocks).
|
|
14
|
+
* Acyclicity is enforced through detection, allowing batch insertions.
|
|
15
|
+
*/
|
|
16
|
+
export declare class TaskDAG {
|
|
17
|
+
private readonly nodes;
|
|
18
|
+
private readonly forwardEdges;
|
|
19
|
+
private readonly reverseEdges;
|
|
20
|
+
private readonly eventHandlers;
|
|
21
|
+
/**
|
|
22
|
+
* Add a task to the DAG. Status is 'ready' if no incomplete blockers,
|
|
23
|
+
* otherwise 'blocked'. Reverse edges are computed automatically.
|
|
24
|
+
* @throws Error if a task with the same ID already exists
|
|
25
|
+
*/
|
|
26
|
+
addTask(input: AddTaskInput): DAGTask;
|
|
27
|
+
/**
|
|
28
|
+
* Remove a task, clean up edges, and unblock dependents if appropriate.
|
|
29
|
+
* @returns true if removed, false if not found
|
|
30
|
+
*/
|
|
31
|
+
removeTask(taskId: string): boolean;
|
|
32
|
+
/** Get a task by ID. */
|
|
33
|
+
getTask(taskId: string): DAGTask | undefined;
|
|
34
|
+
/** Get all tasks with 'ready' status. */
|
|
35
|
+
getReady(): DAGTask[];
|
|
36
|
+
/**
|
|
37
|
+
* Mark a task as in_progress.
|
|
38
|
+
* @throws Error if task not found or not in 'ready' status
|
|
39
|
+
*/
|
|
40
|
+
start(taskId: string, agentId: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Mark a task completed and unblock downstream tasks.
|
|
43
|
+
* @returns Array of newly unblocked task IDs
|
|
44
|
+
* @throws Error if task not found or not 'in_progress'
|
|
45
|
+
*/
|
|
46
|
+
complete(taskId: string, result?: unknown): string[];
|
|
47
|
+
/**
|
|
48
|
+
* Mark a task failed and cascade cancellation to dependents.
|
|
49
|
+
* @throws Error if task not found or not in 'in_progress'/'ready'
|
|
50
|
+
*/
|
|
51
|
+
fail(taskId: string, error: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* Topological sort using Kahn's algorithm.
|
|
54
|
+
* @throws Error if cycles exist
|
|
55
|
+
*/
|
|
56
|
+
topologicalSort(): DAGTask[];
|
|
57
|
+
/**
|
|
58
|
+
* Detect cycles using DFS with white/gray/black coloring.
|
|
59
|
+
* @returns Array of cycles, or null if acyclic
|
|
60
|
+
*/
|
|
61
|
+
detectCycles(): string[][] | null;
|
|
62
|
+
/**
|
|
63
|
+
* Find the critical path (longest path through the DAG).
|
|
64
|
+
* @returns Tasks on the critical path in execution order
|
|
65
|
+
*/
|
|
66
|
+
getCriticalPath(): DAGTask[];
|
|
67
|
+
/** Get aggregate statistics about the DAG. */
|
|
68
|
+
getStats(): DAGStats;
|
|
69
|
+
/** Remove all tasks from the DAG. */
|
|
70
|
+
clear(): void;
|
|
71
|
+
/** Serialize the DAG for debugging. */
|
|
72
|
+
toJSON(): {
|
|
73
|
+
tasks: DAGTask[];
|
|
74
|
+
edges: Array<{
|
|
75
|
+
from: string;
|
|
76
|
+
to: string;
|
|
77
|
+
}>;
|
|
78
|
+
stats: DAGStats;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Register a handler to receive DAG events.
|
|
82
|
+
* @returns Unsubscribe function
|
|
83
|
+
*/
|
|
84
|
+
onEvent(handler: DAGEventHandler): () => void;
|
|
85
|
+
private requireTask;
|
|
86
|
+
private computeStatus;
|
|
87
|
+
private setStatus;
|
|
88
|
+
private unblockDependents;
|
|
89
|
+
private cascadeCancellation;
|
|
90
|
+
private dfsCycles;
|
|
91
|
+
private emit;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=dag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dag.d.ts","sourceRoot":"","sources":["../../../src/coordination/task-dag/dag.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,OAAO,EAEP,YAAY,EACZ,QAAQ,EAER,eAAe,EAChB,MAAM,YAAY,CAAC;AAKpB;;;;;GAKG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;IACzD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAuC;IACpE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAuC;IACpE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAyB;IAEvD;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAqDrC;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAmDnC,wBAAwB;IACxB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAI5C,yCAAyC;IACzC,QAAQ,IAAI,OAAO,EAAE;IAQrB;;;OAGG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAa5C;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE;IAgBpD;;;OAGG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAWzC;;;OAGG;IACH,eAAe,IAAI,OAAO,EAAE;IA2C5B;;;OAGG;IACH,YAAY,IAAI,MAAM,EAAE,EAAE,GAAG,IAAI;IAiBjC;;;OAGG;IACH,eAAe,IAAI,OAAO,EAAE;IAyC5B,8CAA8C;IAC9C,QAAQ,IAAI,QAAQ;IAsBpB,qCAAqC;IACrC,KAAK,IAAI,IAAI;IAMb,uCAAuC;IACvC,MAAM,IAAI;QAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAAC,KAAK,EAAE,QAAQ,CAAA;KAAE;IAS3F;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,IAAI;IAU7C,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,SAAS;IASjB,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,mBAAmB;IAgC3B,OAAO,CAAC,SAAS;IA+BjB,OAAO,CAAC,IAAI;CAKb"}
|
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Task Dependency DAG
|
|
3
|
+
* ADR-064 Phase 1E: Core DAG data structure for task dependency tracking
|
|
4
|
+
*
|
|
5
|
+
* Directed acyclic graph where nodes are tasks and edges represent
|
|
6
|
+
* "blocked-by" dependencies. Topological sort via Kahn's algorithm,
|
|
7
|
+
* cycle detection via DFS coloring, critical path via longest-path DP.
|
|
8
|
+
*/
|
|
9
|
+
/** DFS node coloring for cycle detection */
|
|
10
|
+
var NodeColor;
|
|
11
|
+
(function (NodeColor) {
|
|
12
|
+
NodeColor[NodeColor["White"] = 0] = "White";
|
|
13
|
+
NodeColor[NodeColor["Gray"] = 1] = "Gray";
|
|
14
|
+
NodeColor[NodeColor["Black"] = 2] = "Black";
|
|
15
|
+
})(NodeColor || (NodeColor = {}));
|
|
16
|
+
/**
|
|
17
|
+
* Directed acyclic graph for task dependency management.
|
|
18
|
+
*
|
|
19
|
+
* Tasks are nodes with forward edges (blockedBy) and reverse edges (blocks).
|
|
20
|
+
* Acyclicity is enforced through detection, allowing batch insertions.
|
|
21
|
+
*/
|
|
22
|
+
export class TaskDAG {
|
|
23
|
+
nodes = new Map();
|
|
24
|
+
forwardEdges = new Map();
|
|
25
|
+
reverseEdges = new Map();
|
|
26
|
+
eventHandlers = [];
|
|
27
|
+
/**
|
|
28
|
+
* Add a task to the DAG. Status is 'ready' if no incomplete blockers,
|
|
29
|
+
* otherwise 'blocked'. Reverse edges are computed automatically.
|
|
30
|
+
* @throws Error if a task with the same ID already exists
|
|
31
|
+
*/
|
|
32
|
+
addTask(input) {
|
|
33
|
+
if (this.nodes.has(input.id)) {
|
|
34
|
+
throw new Error(`Task '${input.id}' already exists in the DAG`);
|
|
35
|
+
}
|
|
36
|
+
const blockedBy = input.blockedBy ?? [];
|
|
37
|
+
this.forwardEdges.set(input.id, new Set(blockedBy));
|
|
38
|
+
if (!this.reverseEdges.has(input.id)) {
|
|
39
|
+
this.reverseEdges.set(input.id, new Set());
|
|
40
|
+
}
|
|
41
|
+
for (const blockerId of blockedBy) {
|
|
42
|
+
if (!this.reverseEdges.has(blockerId)) {
|
|
43
|
+
this.reverseEdges.set(blockerId, new Set());
|
|
44
|
+
}
|
|
45
|
+
this.reverseEdges.get(blockerId).add(input.id);
|
|
46
|
+
}
|
|
47
|
+
// Blocks array: tasks already in graph that depend on this one
|
|
48
|
+
const blocks = [];
|
|
49
|
+
const existingDeps = this.reverseEdges.get(input.id);
|
|
50
|
+
if (existingDeps) {
|
|
51
|
+
for (const depId of existingDeps)
|
|
52
|
+
blocks.push(depId);
|
|
53
|
+
}
|
|
54
|
+
const status = this.computeStatus(blockedBy);
|
|
55
|
+
const task = {
|
|
56
|
+
id: input.id,
|
|
57
|
+
name: input.name,
|
|
58
|
+
domain: input.domain,
|
|
59
|
+
priority: input.priority ?? 'p2',
|
|
60
|
+
status,
|
|
61
|
+
blockedBy: [...blockedBy],
|
|
62
|
+
blocks: [...blocks],
|
|
63
|
+
metadata: input.metadata,
|
|
64
|
+
createdAt: Date.now(),
|
|
65
|
+
};
|
|
66
|
+
this.nodes.set(input.id, task);
|
|
67
|
+
// Update blocker tasks' blocks arrays
|
|
68
|
+
for (const blockerId of blockedBy) {
|
|
69
|
+
const blocker = this.nodes.get(blockerId);
|
|
70
|
+
if (blocker && !blocker.blocks.includes(input.id)) {
|
|
71
|
+
this.nodes.set(blockerId, { ...blocker, blocks: [...blocker.blocks, input.id] });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (status === 'ready') {
|
|
75
|
+
this.emit({ type: 'task-ready', taskId: input.id, timestamp: Date.now() });
|
|
76
|
+
}
|
|
77
|
+
return task;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Remove a task, clean up edges, and unblock dependents if appropriate.
|
|
81
|
+
* @returns true if removed, false if not found
|
|
82
|
+
*/
|
|
83
|
+
removeTask(taskId) {
|
|
84
|
+
if (!this.nodes.has(taskId))
|
|
85
|
+
return false;
|
|
86
|
+
// Detach from blockers
|
|
87
|
+
const forward = this.forwardEdges.get(taskId);
|
|
88
|
+
if (forward) {
|
|
89
|
+
for (const blockerId of forward) {
|
|
90
|
+
this.reverseEdges.get(blockerId)?.delete(taskId);
|
|
91
|
+
const blocker = this.nodes.get(blockerId);
|
|
92
|
+
if (blocker) {
|
|
93
|
+
this.nodes.set(blockerId, {
|
|
94
|
+
...blocker,
|
|
95
|
+
blocks: blocker.blocks.filter((id) => id !== taskId),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// Detach from dependents and check for unblocking
|
|
101
|
+
const reverse = this.reverseEdges.get(taskId);
|
|
102
|
+
const unblockedIds = [];
|
|
103
|
+
if (reverse) {
|
|
104
|
+
for (const depId of reverse) {
|
|
105
|
+
this.forwardEdges.get(depId)?.delete(taskId);
|
|
106
|
+
const dep = this.nodes.get(depId);
|
|
107
|
+
if (dep) {
|
|
108
|
+
this.nodes.set(depId, {
|
|
109
|
+
...dep,
|
|
110
|
+
blockedBy: dep.blockedBy.filter((id) => id !== taskId),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const updated = this.nodes.get(depId);
|
|
114
|
+
if (updated && (updated.status === 'blocked' || updated.status === 'pending')) {
|
|
115
|
+
if (this.computeStatus(Array.from(this.forwardEdges.get(depId) ?? [])) === 'ready') {
|
|
116
|
+
this.setStatus(depId, 'ready');
|
|
117
|
+
unblockedIds.push(depId);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
this.forwardEdges.delete(taskId);
|
|
123
|
+
this.reverseEdges.delete(taskId);
|
|
124
|
+
this.nodes.delete(taskId);
|
|
125
|
+
if (unblockedIds.length > 0) {
|
|
126
|
+
this.emit({ type: 'tasks-unblocked', unblockedTaskIds: unblockedIds, timestamp: Date.now() });
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
/** Get a task by ID. */
|
|
131
|
+
getTask(taskId) {
|
|
132
|
+
return this.nodes.get(taskId);
|
|
133
|
+
}
|
|
134
|
+
/** Get all tasks with 'ready' status. */
|
|
135
|
+
getReady() {
|
|
136
|
+
const ready = [];
|
|
137
|
+
for (const task of this.nodes.values()) {
|
|
138
|
+
if (task.status === 'ready')
|
|
139
|
+
ready.push(task);
|
|
140
|
+
}
|
|
141
|
+
return ready;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Mark a task as in_progress.
|
|
145
|
+
* @throws Error if task not found or not in 'ready' status
|
|
146
|
+
*/
|
|
147
|
+
start(taskId, agentId) {
|
|
148
|
+
const task = this.requireTask(taskId);
|
|
149
|
+
if (task.status !== 'ready') {
|
|
150
|
+
throw new Error(`Cannot start '${taskId}': status '${task.status}', expected 'ready'`);
|
|
151
|
+
}
|
|
152
|
+
this.nodes.set(taskId, {
|
|
153
|
+
...task,
|
|
154
|
+
status: 'in_progress',
|
|
155
|
+
assignedTo: agentId,
|
|
156
|
+
startedAt: Date.now(),
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Mark a task completed and unblock downstream tasks.
|
|
161
|
+
* @returns Array of newly unblocked task IDs
|
|
162
|
+
* @throws Error if task not found or not 'in_progress'
|
|
163
|
+
*/
|
|
164
|
+
complete(taskId, result) {
|
|
165
|
+
const task = this.requireTask(taskId);
|
|
166
|
+
if (task.status !== 'in_progress') {
|
|
167
|
+
throw new Error(`Cannot complete '${taskId}': status '${task.status}', expected 'in_progress'`);
|
|
168
|
+
}
|
|
169
|
+
const now = Date.now();
|
|
170
|
+
this.nodes.set(taskId, { ...task, status: 'completed', completedAt: now, result });
|
|
171
|
+
this.emit({ type: 'task-completed', taskId, timestamp: now });
|
|
172
|
+
const unblockedIds = this.unblockDependents(taskId);
|
|
173
|
+
if (unblockedIds.length > 0) {
|
|
174
|
+
this.emit({ type: 'tasks-unblocked', unblockedTaskIds: unblockedIds, timestamp: Date.now() });
|
|
175
|
+
}
|
|
176
|
+
return unblockedIds;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Mark a task failed and cascade cancellation to dependents.
|
|
180
|
+
* @throws Error if task not found or not in 'in_progress'/'ready'
|
|
181
|
+
*/
|
|
182
|
+
fail(taskId, error) {
|
|
183
|
+
const task = this.requireTask(taskId);
|
|
184
|
+
if (task.status !== 'in_progress' && task.status !== 'ready') {
|
|
185
|
+
throw new Error(`Cannot fail '${taskId}': status '${task.status}', expected 'in_progress' or 'ready'`);
|
|
186
|
+
}
|
|
187
|
+
const now = Date.now();
|
|
188
|
+
this.nodes.set(taskId, { ...task, status: 'failed', completedAt: now, error });
|
|
189
|
+
this.emit({ type: 'task-failed', taskId, timestamp: now });
|
|
190
|
+
this.cascadeCancellation(taskId);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Topological sort using Kahn's algorithm.
|
|
194
|
+
* @throws Error if cycles exist
|
|
195
|
+
*/
|
|
196
|
+
topologicalSort() {
|
|
197
|
+
const inDegree = new Map();
|
|
198
|
+
for (const nodeId of this.nodes.keys()) {
|
|
199
|
+
let count = 0;
|
|
200
|
+
const fwd = this.forwardEdges.get(nodeId);
|
|
201
|
+
if (fwd) {
|
|
202
|
+
for (const dep of fwd) {
|
|
203
|
+
if (this.nodes.has(dep))
|
|
204
|
+
count++;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
inDegree.set(nodeId, count);
|
|
208
|
+
}
|
|
209
|
+
const queue = [];
|
|
210
|
+
for (const [id, deg] of inDegree) {
|
|
211
|
+
if (deg === 0)
|
|
212
|
+
queue.push(id);
|
|
213
|
+
}
|
|
214
|
+
const sorted = [];
|
|
215
|
+
while (queue.length > 0) {
|
|
216
|
+
const nodeId = queue.shift();
|
|
217
|
+
const task = this.nodes.get(nodeId);
|
|
218
|
+
if (task)
|
|
219
|
+
sorted.push(task);
|
|
220
|
+
const dependents = this.reverseEdges.get(nodeId);
|
|
221
|
+
if (dependents) {
|
|
222
|
+
for (const depId of dependents) {
|
|
223
|
+
if (!this.nodes.has(depId))
|
|
224
|
+
continue;
|
|
225
|
+
const newDeg = (inDegree.get(depId) ?? 0) - 1;
|
|
226
|
+
inDegree.set(depId, newDeg);
|
|
227
|
+
if (newDeg === 0)
|
|
228
|
+
queue.push(depId);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (sorted.length !== this.nodes.size) {
|
|
233
|
+
throw new Error(`Cycle detected: sorted ${sorted.length} of ${this.nodes.size} tasks`);
|
|
234
|
+
}
|
|
235
|
+
return sorted;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Detect cycles using DFS with white/gray/black coloring.
|
|
239
|
+
* @returns Array of cycles, or null if acyclic
|
|
240
|
+
*/
|
|
241
|
+
detectCycles() {
|
|
242
|
+
const color = new Map();
|
|
243
|
+
const parent = new Map();
|
|
244
|
+
const cycles = [];
|
|
245
|
+
for (const id of this.nodes.keys())
|
|
246
|
+
color.set(id, NodeColor.White);
|
|
247
|
+
for (const id of this.nodes.keys()) {
|
|
248
|
+
if (color.get(id) === NodeColor.White) {
|
|
249
|
+
this.dfsCycles(id, color, parent, cycles);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (cycles.length === 0)
|
|
253
|
+
return null;
|
|
254
|
+
this.emit({ type: 'cycle-detected', cycleNodes: cycles.flat(), timestamp: Date.now() });
|
|
255
|
+
return cycles;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Find the critical path (longest path through the DAG).
|
|
259
|
+
* @returns Tasks on the critical path in execution order
|
|
260
|
+
*/
|
|
261
|
+
getCriticalPath() {
|
|
262
|
+
if (this.nodes.size === 0)
|
|
263
|
+
return [];
|
|
264
|
+
let sorted;
|
|
265
|
+
try {
|
|
266
|
+
sorted = this.topologicalSort();
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
return [];
|
|
270
|
+
}
|
|
271
|
+
const dist = new Map();
|
|
272
|
+
const pred = new Map();
|
|
273
|
+
for (const t of sorted) {
|
|
274
|
+
dist.set(t.id, 1);
|
|
275
|
+
pred.set(t.id, null);
|
|
276
|
+
}
|
|
277
|
+
for (const task of sorted) {
|
|
278
|
+
const d = dist.get(task.id);
|
|
279
|
+
const deps = this.reverseEdges.get(task.id);
|
|
280
|
+
if (deps) {
|
|
281
|
+
for (const depId of deps) {
|
|
282
|
+
if (!this.nodes.has(depId))
|
|
283
|
+
continue;
|
|
284
|
+
if (d + 1 > (dist.get(depId) ?? 1)) {
|
|
285
|
+
dist.set(depId, d + 1);
|
|
286
|
+
pred.set(depId, task.id);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
let maxDist = 0;
|
|
292
|
+
let endNode = null;
|
|
293
|
+
for (const [id, d] of dist) {
|
|
294
|
+
if (d > maxDist) {
|
|
295
|
+
maxDist = d;
|
|
296
|
+
endNode = id;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (!endNode)
|
|
300
|
+
return [];
|
|
301
|
+
const path = [];
|
|
302
|
+
let cur = endNode;
|
|
303
|
+
while (cur !== null) {
|
|
304
|
+
const t = this.nodes.get(cur);
|
|
305
|
+
if (t)
|
|
306
|
+
path.unshift(t);
|
|
307
|
+
cur = pred.get(cur) ?? null;
|
|
308
|
+
}
|
|
309
|
+
return path;
|
|
310
|
+
}
|
|
311
|
+
/** Get aggregate statistics about the DAG. */
|
|
312
|
+
getStats() {
|
|
313
|
+
let pending = 0, ready = 0, inProgress = 0, completed = 0;
|
|
314
|
+
let failed = 0, blocked = 0, cancelled = 0;
|
|
315
|
+
for (const task of this.nodes.values()) {
|
|
316
|
+
switch (task.status) {
|
|
317
|
+
case 'pending':
|
|
318
|
+
pending++;
|
|
319
|
+
break;
|
|
320
|
+
case 'ready':
|
|
321
|
+
ready++;
|
|
322
|
+
break;
|
|
323
|
+
case 'in_progress':
|
|
324
|
+
inProgress++;
|
|
325
|
+
break;
|
|
326
|
+
case 'completed':
|
|
327
|
+
completed++;
|
|
328
|
+
break;
|
|
329
|
+
case 'failed':
|
|
330
|
+
failed++;
|
|
331
|
+
break;
|
|
332
|
+
case 'blocked':
|
|
333
|
+
blocked++;
|
|
334
|
+
break;
|
|
335
|
+
case 'cancelled':
|
|
336
|
+
cancelled++;
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return {
|
|
341
|
+
totalTasks: this.nodes.size,
|
|
342
|
+
pending, ready, inProgress, completed, failed, blocked, cancelled,
|
|
343
|
+
longestPath: this.getCriticalPath().length,
|
|
344
|
+
hasCycles: this.detectCycles() !== null,
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
/** Remove all tasks from the DAG. */
|
|
348
|
+
clear() {
|
|
349
|
+
this.nodes.clear();
|
|
350
|
+
this.forwardEdges.clear();
|
|
351
|
+
this.reverseEdges.clear();
|
|
352
|
+
}
|
|
353
|
+
/** Serialize the DAG for debugging. */
|
|
354
|
+
toJSON() {
|
|
355
|
+
const tasks = Array.from(this.nodes.values());
|
|
356
|
+
const edges = [];
|
|
357
|
+
for (const [taskId, deps] of this.forwardEdges) {
|
|
358
|
+
for (const depId of deps)
|
|
359
|
+
edges.push({ from: depId, to: taskId });
|
|
360
|
+
}
|
|
361
|
+
return { tasks, edges, stats: this.getStats() };
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Register a handler to receive DAG events.
|
|
365
|
+
* @returns Unsubscribe function
|
|
366
|
+
*/
|
|
367
|
+
onEvent(handler) {
|
|
368
|
+
this.eventHandlers.push(handler);
|
|
369
|
+
return () => {
|
|
370
|
+
const idx = this.eventHandlers.indexOf(handler);
|
|
371
|
+
if (idx >= 0)
|
|
372
|
+
this.eventHandlers.splice(idx, 1);
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
// --- Internal helpers ---
|
|
376
|
+
requireTask(taskId) {
|
|
377
|
+
const task = this.nodes.get(taskId);
|
|
378
|
+
if (!task)
|
|
379
|
+
throw new Error(`Task '${taskId}' not found in the DAG`);
|
|
380
|
+
return task;
|
|
381
|
+
}
|
|
382
|
+
computeStatus(blockerIds) {
|
|
383
|
+
if (blockerIds.length === 0)
|
|
384
|
+
return 'ready';
|
|
385
|
+
for (const id of blockerIds) {
|
|
386
|
+
const b = this.nodes.get(id);
|
|
387
|
+
if (!b || b.status !== 'completed')
|
|
388
|
+
return 'blocked';
|
|
389
|
+
}
|
|
390
|
+
return 'ready';
|
|
391
|
+
}
|
|
392
|
+
setStatus(taskId, status) {
|
|
393
|
+
const task = this.nodes.get(taskId);
|
|
394
|
+
if (!task)
|
|
395
|
+
return;
|
|
396
|
+
this.nodes.set(taskId, { ...task, status });
|
|
397
|
+
if (status === 'ready') {
|
|
398
|
+
this.emit({ type: 'task-ready', taskId, timestamp: Date.now() });
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
unblockDependents(completedId) {
|
|
402
|
+
const unblockedIds = [];
|
|
403
|
+
const deps = this.reverseEdges.get(completedId);
|
|
404
|
+
if (!deps)
|
|
405
|
+
return unblockedIds;
|
|
406
|
+
for (const depId of deps) {
|
|
407
|
+
const dep = this.nodes.get(depId);
|
|
408
|
+
if (!dep || dep.status !== 'blocked')
|
|
409
|
+
continue;
|
|
410
|
+
const fwd = this.forwardEdges.get(depId);
|
|
411
|
+
if (!fwd)
|
|
412
|
+
continue;
|
|
413
|
+
let allDone = true;
|
|
414
|
+
for (const bId of fwd) {
|
|
415
|
+
const b = this.nodes.get(bId);
|
|
416
|
+
if (!b || b.status !== 'completed') {
|
|
417
|
+
allDone = false;
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
if (allDone) {
|
|
422
|
+
this.setStatus(depId, 'ready');
|
|
423
|
+
unblockedIds.push(depId);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return unblockedIds;
|
|
427
|
+
}
|
|
428
|
+
cascadeCancellation(failedId) {
|
|
429
|
+
const deps = this.reverseEdges.get(failedId);
|
|
430
|
+
if (!deps)
|
|
431
|
+
return;
|
|
432
|
+
for (const depId of deps) {
|
|
433
|
+
const dep = this.nodes.get(depId);
|
|
434
|
+
if (!dep || dep.status === 'completed' || dep.status === 'failed' || dep.status === 'cancelled') {
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
const fwd = this.forwardEdges.get(depId);
|
|
438
|
+
if (!fwd)
|
|
439
|
+
continue;
|
|
440
|
+
let unsatisfiable = false;
|
|
441
|
+
for (const bId of fwd) {
|
|
442
|
+
const b = this.nodes.get(bId);
|
|
443
|
+
if (b && (b.status === 'failed' || b.status === 'cancelled')) {
|
|
444
|
+
unsatisfiable = true;
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
if (unsatisfiable) {
|
|
449
|
+
this.nodes.set(depId, {
|
|
450
|
+
...dep,
|
|
451
|
+
status: 'cancelled',
|
|
452
|
+
completedAt: Date.now(),
|
|
453
|
+
error: `Cancelled: upstream task '${failedId}' failed`,
|
|
454
|
+
});
|
|
455
|
+
this.cascadeCancellation(depId);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
dfsCycles(nodeId, color, parent, cycles) {
|
|
460
|
+
color.set(nodeId, NodeColor.Gray);
|
|
461
|
+
const dependencies = this.forwardEdges.get(nodeId);
|
|
462
|
+
if (dependencies) {
|
|
463
|
+
for (const depId of dependencies) {
|
|
464
|
+
if (!this.nodes.has(depId))
|
|
465
|
+
continue;
|
|
466
|
+
const c = color.get(depId);
|
|
467
|
+
if (c === NodeColor.White) {
|
|
468
|
+
parent.set(depId, nodeId);
|
|
469
|
+
this.dfsCycles(depId, color, parent, cycles);
|
|
470
|
+
}
|
|
471
|
+
else if (c === NodeColor.Gray) {
|
|
472
|
+
const cycle = [depId, nodeId];
|
|
473
|
+
let cur = nodeId;
|
|
474
|
+
while (cur !== depId) {
|
|
475
|
+
const p = parent.get(cur);
|
|
476
|
+
if (p === null || p === undefined || p === depId)
|
|
477
|
+
break;
|
|
478
|
+
cycle.push(p);
|
|
479
|
+
cur = p;
|
|
480
|
+
}
|
|
481
|
+
cycles.push(cycle);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
color.set(nodeId, NodeColor.Black);
|
|
486
|
+
}
|
|
487
|
+
emit(event) {
|
|
488
|
+
for (const handler of this.eventHandlers) {
|
|
489
|
+
try {
|
|
490
|
+
handler(event);
|
|
491
|
+
}
|
|
492
|
+
catch { /* handler errors are silently ignored */ }
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
//# sourceMappingURL=dag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dag.js","sourceRoot":"","sources":["../../../src/coordination/task-dag/dag.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,4CAA4C;AAC5C,IAAW,SAA4C;AAAvD,WAAW,SAAS;IAAG,2CAAS,CAAA;IAAE,yCAAQ,CAAA;IAAE,2CAAS,CAAA;AAAC,CAAC,EAA5C,SAAS,KAAT,SAAS,QAAmC;AAEvD;;;;;GAKG;AACH,MAAM,OAAO,OAAO;IACD,KAAK,GAAyB,IAAI,GAAG,EAAE,CAAC;IACxC,YAAY,GAA6B,IAAI,GAAG,EAAE,CAAC;IACnD,YAAY,GAA6B,IAAI,GAAG,EAAE,CAAC;IACnD,aAAa,GAAsB,EAAE,CAAC;IAEvD;;;;OAIG;IACH,OAAO,CAAC,KAAmB;QACzB,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,SAAS,KAAK,CAAC,EAAE,6BAA6B,CAAC,CAAC;QAClE,CAAC;QAED,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC;QACxC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,YAAY,CAA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ChC,MAAM,KAAK,GAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;oBACxC,IAAI,GAAG,GAAG,MAAM,CAAC;oBACjB,OAAO,GAAG,KAAK,KAAK,EAAE,CAAC;wBACrB,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;wBAC1B,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,KAAK;4BAAE,MAAM;wBACxD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;wBACd,GAAG,GAAG,CAAC,CAAC;oBACV,CAAC;oBACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACrB,CAAC;YACH,CAAC;QACH,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAEO,IAAI,CAAC,KAAe;QAC1B,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACzC,IAAI,CAAC;gBAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,yCAAyC,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Task Dependency DAG
|
|
3
|
+
* ADR-064 Phase 1E: DAG-based task scheduler with dependency tracking
|
|
4
|
+
*
|
|
5
|
+
* Provides a directed acyclic graph for managing task dependencies,
|
|
6
|
+
* with topological sorting, cycle detection, critical path analysis,
|
|
7
|
+
* and priority-aware scheduling.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { createTaskDAG, createDAGScheduler } from './coordination/task-dag';
|
|
12
|
+
*
|
|
13
|
+
* const dag = createTaskDAG();
|
|
14
|
+
* const scheduler = createDAGScheduler(dag, { maxConcurrent: 4 });
|
|
15
|
+
*
|
|
16
|
+
* // Build a dependency graph
|
|
17
|
+
* dag.addTask({ id: 'lint', name: 'Lint', domain: 'ci', priority: 'p2' });
|
|
18
|
+
* dag.addTask({ id: 'build', name: 'Build', domain: 'ci', priority: 'p1' });
|
|
19
|
+
* dag.addTask({ id: 'test', name: 'Test', domain: 'ci', priority: 'p0', blockedBy: ['build'] });
|
|
20
|
+
* dag.addTask({ id: 'deploy', name: 'Deploy', domain: 'ci', priority: 'p0', blockedBy: ['test', 'lint'] });
|
|
21
|
+
*
|
|
22
|
+
* // Schedule ready tasks
|
|
23
|
+
* const batch = scheduler.schedule(); // [build, lint] (ready, sorted by priority)
|
|
24
|
+
*
|
|
25
|
+
* // Execute and process completions
|
|
26
|
+
* dag.start('build', 'agent-1');
|
|
27
|
+
* dag.start('lint', 'agent-2');
|
|
28
|
+
* const unblocked = scheduler.onTaskComplete('build'); // test may now be ready
|
|
29
|
+
*
|
|
30
|
+
* // Check progress
|
|
31
|
+
* const progress = scheduler.getProgress(); // { completed: 1, total: 4, percentage: 25 }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export type { DAGTaskStatus, DAGTask, AddTaskInput, DAGStats, DAGEventType, DAGEvent, DAGSchedulerConfig, DAGEventHandler, } from './types.js';
|
|
35
|
+
export { TaskDAG } from './dag.js';
|
|
36
|
+
export { DAGScheduler } from './scheduler.js';
|
|
37
|
+
import { TaskDAG } from './dag.js';
|
|
38
|
+
import { DAGScheduler } from './scheduler.js';
|
|
39
|
+
import type { DAGSchedulerConfig } from './types.js';
|
|
40
|
+
/**
|
|
41
|
+
* Create a new empty TaskDAG instance.
|
|
42
|
+
*
|
|
43
|
+
* @returns A fresh TaskDAG with no tasks
|
|
44
|
+
*/
|
|
45
|
+
export declare function createTaskDAG(): TaskDAG;
|
|
46
|
+
/**
|
|
47
|
+
* Create a new DAGScheduler wrapping a TaskDAG.
|
|
48
|
+
*
|
|
49
|
+
* @param dag - The TaskDAG to schedule from
|
|
50
|
+
* @param config - Optional scheduler configuration
|
|
51
|
+
* @returns A configured DAGScheduler instance
|
|
52
|
+
*/
|
|
53
|
+
export declare function createDAGScheduler(dag: TaskDAG, config?: Partial<DAGSchedulerConfig>): DAGScheduler;
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/coordination/task-dag/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAMH,YAAY,EACV,aAAa,EACb,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,eAAe,GAChB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAM9C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,OAAO,EACZ,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACnC,YAAY,CAEd"}
|