import type { Logger } from '../logger.js';
import type { BlueprintLog } from '../types.js';
/** Delay before the first operation poll. Override with SANITY_OPERATION_POLL_INITIAL_DELAY_MS. */
export declare const OPERATION_POLL_INITIAL_DELAY_MS: number;
/** Interval between operation status polls. Override with SANITY_OPERATION_POLL_INTERVAL_MS. */
export declare const OPERATION_POLL_INTERVAL_MS: number;
/** Consecutive failed polls tolerated before giving up on confirming status. */
export declare const OPERATION_POLL_MAX_CONSECUTIVE_ERRORS = 5;
/** Result of waiting for a deploy/destroy operation to settle. */
export type OperationOutcome = {
    type: 'completed';
} | {
    type: 'failed';
    logHints: string[];
} | {
    type: 'unconfirmed';
    error?: string;
};
type EndState = 'completed' | 'failed';
export type StateInfo = {
    state: EndState;
} | {
    state: 'pending';
    /** Used to avoid repeatedly outputting pending status messages. */
    latestStatus: string;
    verboseMessage: string;
} | {
    state: 'not_found';
    verboseError: string;
} | {
    state: 'error';
    error: string | null;
    verboseError: string;
};
type WaitForOptions = {
    /**
     * Requests the latest state and returns it to the main loop for processing.
     * @returns The current state of the thing we are waiting for
     */
    onRequestLatestState: () => Promise<StateInfo>;
    /**
     * Called when the waitFor logic should start reading logs.
     * @returns A function that stops the polling process when invoked.
     */
    onStartLogPolling: (options: {
        onActivity?: () => void;
        onLogEntry?: (log: BlueprintLog, previousLog: BlueprintLog | undefined) => void;
    }) => () => void;
    getIdleMessage: () => string;
};
export type WaitForFn = (options: WaitForOptions) => Promise<OperationOutcome>;
export declare function createWaitFor({ bin, log, verbose, initialDelayMs, pollIntervalMs, idleSpinnerDelayMs, }: {
    bin: string;
    log: Logger;
    verbose?: boolean;
    initialDelayMs?: number;
    pollIntervalMs?: number;
    idleSpinnerDelayMs?: number;
}): WaitForFn;
export {};
