/**
 * DAG Scheduler — Multi-step agent workflow execution via directed acyclic graphs.
 *
 * Each workflow step depends on zero or more predecessor steps. When all
 * dependencies are met, the step is enqueued in the WorkerPool for execution.
 *
 * @module trellis/core/agents
 */
import type { WorkerPool } from './worker-pool.js';
import type { DAGGate } from './gate-keeper.js';
export declare function detectCycle(workflow: DAGWorkflow): string | null;
export type DAGStepStatus = 'pending' | 'ready' | 'running' | 'completed' | 'failed' | 'skipped';
export interface DAGEdge {
    targetStepId: string;
    condition?: string;
}
export interface DAGStep {
    id: string;
    agentId: string;
    input: string;
    dependsOn?: string[];
    edges?: DAGEdge[];
    gate?: DAGGate;
}
export interface DAGWorkflow {
    id: string;
    name: string;
    steps: DAGStep[];
}
export interface DAGRunStep {
    step: DAGStep;
    status: DAGStepStatus;
    runId?: string;
    result?: string;
    error?: string;
    startedAt?: string;
    completedAt?: string;
}
export interface DAGRun {
    workflowId: string;
    status: 'running' | 'completed' | 'failed' | 'cancelled';
    steps: DAGRunStep[];
    startedAt: string;
    completedAt?: string;
}
export interface DAGSchedulerConfig {
    failOnError?: boolean;
    /** Persist DAGRun state to the graph (survives restarts). Requires pool persistence. */
    persistToGraph?: boolean;
    /** Enable conditional edge-based routing. Steps with edges are evaluated for conditional dependency satisfaction. */
    enableEdgeRouting?: boolean;
    /** Enable pre/post-execution gate checks (test, manual, ac_check, semantic_diff). */
    enableGates?: boolean;
}
export declare class DAGScheduler {
    private pool;
    private config;
    private runs;
    private boundHandler;
    constructor(pool: WorkerPool, config?: DAGSchedulerConfig);
    /** Restore in-progress DAGRuns from the graph. Call after construction. */
    restore(): Promise<void>;
    private _ensureKernel;
    private _saveRun;
    private _updateRun;
    dispose(): void;
    run(workflow: DAGWorkflow): Promise<string>;
    getRun(runId: string): DAGRun | undefined;
    listRuns(): DAGRun[];
    /** Wait for a run to complete (terminal status). Returns the final run state. */
    waitForRun(runId: string, pollMs?: number): Promise<DAGRun>;
    private _evaluate;
    private _buildEdgeIndex;
    private _isPreGate;
    private _execute;
    private _onPoolEvent;
    private _checkCompletion;
    private _failWorkflow;
}
//# sourceMappingURL=dag-scheduler.d.ts.map