/**
 * ROLLBACK PLANNER
 *
 * Generates rollback/compensation steps for execution plans.
 * Supports partial rollback and compensation patterns.
 */
import type { ExecutionStep } from './types.js';
/**
 * Rollback strategy for a specific action type
 */
export interface RollbackStrategy {
    /** The action type this strategy handles */
    actionType: string;
    /** Generate rollback action type */
    rollbackAction: string | ((step: ExecutionStep) => string);
    /** Transform parameters for rollback */
    transformParams?: (params: Record<string, unknown>, step: ExecutionStep) => Record<string, unknown>;
    /** Whether this action is reversible */
    reversible: boolean;
    /** Description of the rollback operation */
    description?: string | ((step: ExecutionStep) => string);
}
/**
 * Built-in compensation patterns for common operations
 */
export declare const COMPENSATION_PATTERNS: Record<string, RollbackStrategy>;
/**
 * Rollback scope options
 */
export type RollbackScope = 'full' | 'partial' | 'none';
/**
 * Partial rollback options
 */
export interface PartialRollbackOptions {
    /** Steps to include in rollback (by ID) */
    includeSteps?: string[];
    /** Steps to exclude from rollback (by ID) */
    excludeSteps?: string[];
    /** Only rollback critical steps */
    criticalOnly?: boolean;
    /** Custom filter function */
    filter?: (step: ExecutionStep) => boolean;
}
/**
 * RollbackPlanner - Generates compensation/rollback steps
 */
export declare class RollbackPlanner {
    private customStrategies;
    constructor();
    /**
     * Register a custom rollback strategy for an action type
     */
    registerStrategy(strategy: RollbackStrategy): void;
    /**
     * Generate rollback steps for a list of execution steps
     * Returns steps in reverse order (last executed first to rollback)
     */
    generateRollbackSteps(steps: ExecutionStep[]): ExecutionStep[];
    /**
     * Generate partial rollback steps
     */
    generatePartialRollbackSteps(steps: ExecutionStep[], completedStepIds: string[], options?: PartialRollbackOptions): ExecutionStep[];
    /**
     * Create a rollback step for a single execution step
     */
    createRollbackStep(step: ExecutionStep): ExecutionStep | null;
    /**
     * Create a generic rollback step when no strategy is defined
     */
    private createGenericRollbackStep;
    /**
     * Determine rollback scope based on failure context
     */
    determineRollbackScope(failedStep: ExecutionStep, completedSteps: ExecutionStep[]): RollbackScope;
    /**
     * Get rollback steps for a specific scope
     */
    getRollbackStepsForScope(scope: RollbackScope, allSteps: ExecutionStep[], completedStepIds: string[], failedStepId?: string): ExecutionStep[];
    /**
     * Check if a step can be rolled back
     */
    canRollback(step: ExecutionStep): boolean;
    /**
     * Get all action types that have rollback strategies
     */
    getSupportedActions(): string[];
}
/**
 * Create a new rollback planner instance
 */
export declare function createRollbackPlanner(): RollbackPlanner;
//# sourceMappingURL=rollback.d.ts.map