UNPKG

mcp-adr-analysis-server

Version:

MCP server for analyzing Architectural Decision Records and project architecture

106 lines 2.79 kB
/** * DAG Executor for Bootstrap Validation Loop * * Executes tasks in a Directed Acyclic Graph (DAG) with: * - Dependency resolution via topological sort * - Parallel execution within layers * - Fine-grained error handling and retry logic * - Task-level validation and timeout support */ import { SystemCardManager } from './system-card-manager.js'; /** * A single executable task node in the DAG */ export interface TaskNode { id: string; name: string; description: string; command?: string; commandArgs?: string[]; expectedExitCode?: number; timeout?: number; dependsOn: string[]; canFailSafely?: boolean; platforms?: string[]; retryCount?: number; retryDelay?: number; validationCheck?: (output: string) => boolean; category: 'infrastructure' | 'application'; severity: 'critical' | 'error' | 'warning' | 'info'; } /** * Result of executing a single task */ export interface TaskResult { taskId: string; success: boolean; exitCode?: number; stdout: string; stderr: string; duration: number; error?: Error; skipped?: boolean; skipReason?: string; } /** * Result of executing the entire DAG */ export interface DAGExecutionResult { success: boolean; executedTasks: string[]; failedTasks: string[]; skippedTasks: string[]; duration: number; taskResults: Map<string, TaskResult>; } /** * DAG Executor with dependency resolution and parallel execution */ export declare class DAGExecutor { private logger; private maxParallelism; private systemCardManager; private resourceExtractor; constructor(maxParallelism?: number, systemCardManager?: SystemCardManager); /** * Execute DAG with topological sort and parallel execution */ execute(tasks: TaskNode[]): Promise<DAGExecutionResult>; /** * Execute all tasks in a layer in parallel (with concurrency limit) */ private executeLayer; /** * Execute tasks with concurrency limit */ private executeWithConcurrencyLimit; /** * Execute a single task with retry logic */ private executeTask; /** * Execute shell command with timeout */ private executeCommand; /** * Validate DAG structure (no cycles, valid dependencies) */ private validateDAG; /** * Detect cycles in DAG using DFS */ private detectCycles; /** * Build dependency graph from tasks */ private buildDependencyGraph; /** * Topological sort to determine execution order (Kahn's algorithm) */ private topologicalSort; /** * Get all tasks that depend on the given task (recursively) */ private getDependentTasks; } //# sourceMappingURL=dag-executor.d.ts.map