import type { SessionFailureSummary } from "./events.js"; export { noteTurnFailureAction } from "./turn-failure-actions.js"; export declare const TURN_FAILURE_CLASSES: readonly ["credits_exhausted", "provider_credentials", "provider_billing", "provider_access", "daily_limit", "monthly_limit", "provider_quota", "rate_limited", "provider_error", "model_unavailable", "codex_account", "safety_refusal", "sandbox", "mcp", "context_limit", "connectivity", "pre_start", "other"]; export type TurnFailureClass = (typeof TURN_FAILURE_CLASSES)[number]; export declare const TURN_FAILURE_ACTIONS: readonly ["retry", "switch_model", "buy_credits", "connect_model", "new_session", "send_message", "left"]; export type TurnFailureAction = (typeof TURN_FAILURE_ACTIONS)[number]; /** Hidden this long after the failure was shown, with no action, counts as `left`. */ export declare const TURN_FAILURE_HIDDEN_LEFT_MS: number; /** The closed class of a failure, from its recorded code and closed markers only. */ export declare function turnFailureClass(failure: SessionFailureSummary, creditExhausted?: boolean): TurnFailureClass; type Capture = (name: "turn_failure_viewed" | "turn_failure_action", properties: Record) => void; export type TurnFailureJourneyOptions = { capture?: Capture | undefined; setTimer?: ((callback: () => void, ms: number) => unknown) | undefined; clearTimer?: ((timer: unknown) => void) | undefined; hiddenLeftMs?: number | undefined; }; export type TurnFailureJourney = { /** The banner for this exact failure is visible. Reported once per failure. */ viewed(failureKey: string, failureClass: TurnFailureClass): void; /** The person's first next step for the visible failure; later steps are ignored. */ action(action: Exclude, failureKey?: string): void; /** The banner for this failure went away. Reports `left` when no action came first. */ dismissed(failureKey: string): void; /** Document visibility changed; a long hidden period counts as leaving. */ visibilityChanged(hidden: boolean): void; /** The page is being unloaded. */ pageHidden(): void; /** Currently tracked failure, for tests. */ activeKey(): string | null; }; export declare function createTurnFailureJourney(options?: TurnFailureJourneyOptions): TurnFailureJourney; /** The page-wide journey, created on first use in a browser. */ export declare function turnFailureJourney(): TurnFailureJourney;