import type { AgentTurnParams, AgentTurnResult } from "../../agents/unified-runner.js";
import type { TurnMiddleware } from "./turn-middleware.js";
/**
 * Default recovery prompt — tells the model the previous turn aborted on
 * consecutive tool errors and instructs it to answer from context. Same
 * wording as the inline version in unified-runner.ts so callers see no
 * behaviour change.
 */
export declare const DEFAULT_CIRCUIT_BREAKER_RECOVERY_PROMPT: string;
export interface WithCircuitBreakerRecoveryOptions {
    /**
     * Prompt to use for the recovery turn. The default reproduces the
     * production string from unified-runner.ts so wiring this middleware
     * in is a behaviour-preserving change.
     */
    recoveryPrompt?: string;
    /**
     * Override the runId-generation strategy on the recovery turn. Defaults
     * to a fresh UUID. Tests pin this to a known value.
     */
    generateRunId?: () => string;
    /**
     * Notification hook fired when the breaker fires and a recovery is
     * about to start. Useful for telemetry / logs without coupling the
     * middleware to a specific logger.
     */
    onRecoveryStart?: (info: {
        originalParams: AgentTurnParams;
        breakerResult: AgentTurnResult;
    }) => void | Promise<void>;
}
/**
 * Detect the circuit-breaker-aborted condition on a turn result.
 *
 * Exposed for tests and callers that want to manually replicate the
 * predicate without invoking the middleware itself. The sole condition
 * today is `rawResult.meta.circuitBreakerAborted === true`; if that
 * structure ever changes, this is the single point to update.
 */
export declare function isCircuitBreakerAborted(result: AgentTurnResult): boolean;
/**
 * Middleware: detect a circuit-breaker abort on the inner runner's result
 * and re-invoke the inner runner ONCE with tools disabled and a recovery
 * prompt.
 *
 * The retry is bounded: even if the recovery turn ALSO trips the breaker,
 * its result is returned as-is (no third attempt). This bound is enforced
 * by control flow inside the middleware — there is no flag passed to the
 * inner runner.
 */
export declare function withCircuitBreakerRecovery(opts?: WithCircuitBreakerRecoveryOptions): TurnMiddleware;
