/**
 * Retry middleware — surfaces Claude Agent SDK `api_retry` system messages
 * as transient UI state. The SDK emits these while retrying against a flaky
 * upstream (typically 504s from the LLM proxy) with backoff. Without this
 * middleware the user just sees a stuck spinner.
 *
 * Any non-retry message clears the state, so the banner goes away as soon as
 * a real response arrives.
 */
import type { RetryState } from '../wizard-session';
import type { Middleware } from './types';
/**
 * Tiny storm-anchor helper shared by every code path that publishes a
 * {@link RetryState}. It returns the timestamp of the *first* retry of the
 * current storm — `stamp()` records `Date.now()` once and reuses it until
 * `reset()` is called. This is what the UI grace period in
 * `RetryStatusChip` measures against; without a shared anchor, paths that
 * resample `Date.now()` per call (e.g. `publishRetryBanner` in
 * `agent-interface.ts`) would never clear the grace and the chip would
 * never appear during rapid outer-loop retry storms.
 */
export interface StormAnchor {
    /** Returns the storm-start timestamp, lazily stamping it on first call. */
    stamp(): number;
    /** End the current storm — the next `stamp()` will start a new one. */
    reset(): void;
}
export declare function createStormAnchor(): StormAnchor;
/**
 * Build a middleware that publishes retry state transitions. The callback
 * fires with a {@link RetryState} when an `api_retry` message arrives and
 * with `null` when a normal agent message arrives after a retry.
 */
export declare function createRetryMiddleware(onState: (state: RetryState | null) => void): Middleware;
