/**
 * Command Executor Implementation
 *
 * This module provides the CommandExecutor class for managing command
 * execution with dependency resolution using topological sort.
 *
 * @module declarative-api/command/command-executor
 */
import type { IResourceEntity } from '../../../lib/runtime-web/types/declarative-api';
import type { IResourceCommand, ICommandExecutor, CommandAuditEntry } from '../../../lib/runtime-web/types/declarative-api';
/**
 * Error thrown when a cyclic dependency is detected.
 */
export declare class CyclicDependencyError extends Error {
    readonly cycle: readonly string[];
    readonly code = "CYCLIC_DEPENDENCY_ERROR";
    constructor(cycle: readonly string[]);
}
/**
 * Error thrown when a required dependency is missing.
 */
export declare class MissingDependencyError extends Error {
    readonly commandId: string;
    readonly missingDependency: string;
    readonly code = "MISSING_DEPENDENCY_ERROR";
    constructor(commandId: string, missingDependency: string);
}
/**
 * Type guard for CyclicDependencyError.
 */
export declare function isCyclicDependencyError(error: unknown): error is CyclicDependencyError;
/**
 * Type guard for MissingDependencyError.
 */
export declare function isMissingDependencyError(error: unknown): error is MissingDependencyError;
/**
 * Command Executor for managing command execution.
 *
 * The executor collects commands, resolves their dependencies using
 * topological sort, and executes them in the correct order. It also
 * supports rollback of all executed commands.
 *
 * Implements: Command Executor Pattern
 * Validates: Requirements 15.2, 15.5, 15.6
 */
export declare class CommandExecutor implements ICommandExecutor {
    private _queue;
    private _executedCommands;
    private _createdResources;
    /**
     * Add a command to the execution queue.
     *
     * @param command - The command to enqueue
     * @throws Error if a command with the same ID already exists
     */
    enqueue(command: IResourceCommand): void;
    /**
     * Execute all queued commands in dependency order.
     *
     * Commands are executed using topological sort based on their
     * dependencies. If a command fails, execution stops and previously
     * executed commands can be rolled back using rollbackAll().
     *
     * @returns Array of created resource entities
     * @throws CyclicDependencyError if a cycle is detected
     * @throws MissingDependencyError if a dependency is not in the queue
     */
    executeAll(): IResourceEntity[];
    /**
     * Rollback all executed commands in reverse order.
     *
     * This undoes all commands that were successfully executed,
     * in reverse order of execution.
     */
    rollbackAll(): void;
    /**
     * Get the execution plan without executing.
     *
     * This performs a dry-run to show the order in which commands
     * would be executed based on dependencies using topological sort.
     *
     * @returns Array of commands in execution order
     * @throws CyclicDependencyError if a cycle is detected
     * @throws MissingDependencyError if a dependency is not in the queue
     */
    getExecutionPlan(): IResourceCommand[];
    /**
     * Get all audit entries for queued and executed commands.
     *
     * @returns Array of audit entries
     */
    getAuditLog(): CommandAuditEntry[];
    /**
     * Clear all queued commands.
     */
    clear(): void;
    /**
     * Get the count of queued commands.
     */
    getQueueSize(): number;
    /**
     * Get a command by ID.
     *
     * @param commandId - The ID of the command
     * @returns The command or undefined
     */
    getCommand(commandId: string): IResourceCommand | undefined;
    /**
     * Check if a command exists in the queue.
     *
     * @param commandId - The ID of the command
     * @returns True if the command exists
     */
    hasCommand(commandId: string): boolean;
    /**
     * Validate that all dependencies exist in the queue.
     *
     * @throws MissingDependencyError if a dependency is not in the queue
     */
    private validateDependencies;
    /**
     * Perform topological sort using Kahn's algorithm.
     *
     * @returns Commands in execution order
     * @throws CyclicDependencyError if a cycle is detected
     */
    private topologicalSort;
    /**
     * Find a cycle in the dependency graph using DFS.
     *
     * @returns Array of command IDs forming the cycle
     */
    private findCycle;
}
