import type { PermissionEngine } from '../permissions/engine';
import type { Tool, ToolResult } from '../types';
export type WorkflowRiskLevel = 'low' | 'medium' | 'high';
export type WorkflowRunStatus = 'pending' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled';
export type WorkflowStepStatus = 'pending' | 'running' | 'completed' | 'failed' | 'skipped' | 'denied';
export interface WorkflowStep {
    id: string;
    tool: string;
    input?: Record<string, unknown>;
    description?: string;
    /** When true, a failure does not abort the run. */
    continueOnError?: boolean;
}
export interface WorkflowDefinition {
    name: string;
    description?: string;
    riskLevel?: WorkflowRiskLevel;
    variables?: Record<string, unknown>;
    steps: WorkflowStep[];
    filePath: string;
}
export interface WorkflowStepExecution {
    step: WorkflowStep;
    status: WorkflowStepStatus;
    startedAt?: string;
    finishedAt?: string;
    result?: ToolResult;
    resolvedInput?: Record<string, unknown>;
    permissionReason?: string;
    error?: string;
    /** True when this step was simulated rather than executed. */
    dryRun?: boolean;
}
export interface WorkflowRun {
    id: string;
    workflowName: string;
    status: WorkflowRunStatus;
    dryRun: boolean;
    startedAt: string;
    finishedAt?: string;
    variables: Record<string, unknown>;
    steps: WorkflowStepExecution[];
    currentStepIndex: number;
    cancelReason?: string;
    pauseReason?: string;
}
export interface WorkflowRunDeps {
    tools: Tool[];
    permissions: PermissionEngine;
}
export declare class WorkflowRegistry {
    private workflowsDir;
    private runs;
    private signals;
    private pendingPersists;
    constructor(workflowsDir: string);
    flush(): Promise<void>;
    private trackPersist;
    private runsDir;
    private runFilePath;
    private persistRun;
    restoreRuns(): Promise<{
        restored: number;
        demoted: number;
    }>;
    list(): Promise<WorkflowDefinition[]>;
    load(name: string): Promise<WorkflowDefinition | null>;
    private loadFile;
    startRun(definition: WorkflowDefinition, options?: {
        dryRun?: boolean;
        variables?: Record<string, unknown>;
    }): WorkflowRun;
    getRun(id: string): WorkflowRun | undefined;
    listRuns(): WorkflowRun[];
    pause(id: string, reason?: string): boolean;
    resume(id: string): boolean;
    cancel(id: string, reason?: string): boolean;
    execute(runId: string, deps: WorkflowRunDeps): Promise<WorkflowRun>;
    private runStep;
}
//# sourceMappingURL=workflowRegistry.d.ts.map