import type { AgentMessage } from "@earendil-works/pi-agent-core";
import type { AssistantMessage } from "@earendil-works/pi-ai";
import { type Container } from "@earendil-works/pi-tui";
/** Presentation classification only. Retry eligibility remains owned by AgentSession. */
export declare function isNetworkProviderError(raw: string | undefined, envelopeOnly?: boolean): boolean;
/**
 * True when a provider failure should take the quiet presentation path (one banner, a
 * status-line countdown while retrying, raw JSON only on expand): any transient failure,
 * which is a network drop, a 429 rate-limit, or a 5xx. Hard quota/auth/billing failures
 * classify non-retryable here and stay verbose, because they need a credential or plan
 * change, not a wait. Delegates to the shared classifier so the transcript decision and
 * the retry engine never disagree about what is transient.
 */
export declare function isRetryableProviderError(raw: string | undefined): boolean;
/** The session facts row ownership reads: the model whose window decides a context overflow. */
export type RetryOwnershipSession = {
    readonly model?: {
        readonly contextWindow: number;
    } | undefined;
} | undefined;
/**
 * True when a failed attempt's row belongs to the quiet retry episode instead of painting its raw error. It requires
 * the retry engine's own decision (`isTurnRetryableFailure`, which excludes a suppressed replay, a local failure, a
 * model-config failure and a context overflow) AND transient wording, so a row is folded only for a failure the
 * engine retries (senpi#6012). A failure a classifier already describes in plain language keeps its row.
 */
export declare function isRetryableProviderMessage(message: AssistantMessage, session: RetryOwnershipSession): boolean;
/** True when the turn's last failed attempt belongs to an active quiet episode, which owes its one final notice. */
export declare function episodeOwnsFailure(messages: readonly AgentMessage[], presentation: ProviderErrorPresentation | undefined, session: RetryOwnershipSession): boolean;
/** Owns one display episode, not session messages or retry/fallback policy. */
export declare class ProviderErrorPresentation {
    private readonly chat;
    private notice;
    private pending;
    private lastReason;
    constructor(chat: Container);
    record(raw: string, expanded?: boolean): void;
    retrying(raw: string, expanded: boolean): void;
    /** A success or cleanup ends the episode: no finish is owed afterward. */
    clear(): void;
    /**
     * The retry engine finishing (summarization_retry_finished): clears the transient row but keeps
     * the episode marker, because the terminal compaction_end that follows still closes the
     * exhausted episode out via finish().
     */
    clearTransient(): void;
    /** True while a retry episode is active (a retry was recorded and not yet finished/cleared). */
    get hasActiveRetry(): boolean;
    /**
     * True only while a retry has been recorded in the CURRENT episode and not yet closed out by
     * finish(). A fresh terminal failure after an episode that already finished returns false, so
     * it surfaces as a plain error instead of reopening the stale banner.
     */
    get awaitingRetryFinish(): boolean;
    private retryAwaitingFinish;
    finish(raw?: string, attempts?: number): void;
    newTurn(): void;
}
//# sourceMappingURL=provider-error-presentation.d.ts.map