import { type OpenGeniText } from "../messages/runtime.js"; /** Backoff between attempts: about ten seconds in all before anything is shown. */ export declare const TRANSIENT_RETRY_DELAYS_MS: readonly number[]; /** After the quiet retries give up, try once at this pace until Opengeni answers. */ export declare const TRANSIENT_RECONNECT_INTERVAL_MS = 3000; /** The one line shown while Opengeni is briefly unreachable. */ export declare const OPENGENI_UPDATING_NOTICE: (t: OpenGeniText) => string; /** * An explicit action (Stop, Resume, Steer, a direct send) that failed only * because Opengeni is updating. It is not retried automatically, so it never * reads as "we'll reconnect": the person is told calmly to try again. */ export declare const OPENGENI_UPDATING_ACTION_NOTICE: (t: OpenGeniText) => string; /** Record that `error` is the failure of an explicit action, not a background read or save. */ export declare function markActionFailure(error: T): T; /** True for a failure recorded with {@link markActionFailure}. */ export declare function isActionFailure(error: unknown): boolean; /** * True for a failure that says the service is briefly unreachable, not that * the request was wrong: a gateway or availability status, a 500 the API marks * retryable, or a request that never got a response. */ export declare function isTransientServiceFailure(error: unknown): boolean; /** * How long an ordinary transient failure stays calm (shown as "updating" * rather than as an error). A normal deploy or failover ends well inside it; * a failure that outlasts it is reported as the error it is. The maintenance * marker is a planned update and stays calm for as long as it lasts. */ export declare const SERVICE_UPDATING_CALM_WINDOW_MS = 120000; /** * True when `error` should read as "updating, reconnecting" rather than as a * failure: the maintenance marker, or a transient failure first seen at * `since` and not yet past the calm window at `now`. */ export declare function isCalmServiceFailure(error: unknown, since: number, now?: number): boolean; export type RetryTransientOptions = { /** Stop waiting (and rethrow the last failure) once this returns false. */ shouldContinue?: () => boolean; signal?: AbortSignal; delaysMs?: readonly number[]; sleep?: (ms: number, signal?: AbortSignal) => Promise; }; /** * Run a read, retrying only transient service failures with backoff. Never use * this for a request whose repeat could apply twice: it is for reads and for * writes that are idempotent by construction. */ export declare function retryTransient(operation: () => Promise, options?: RetryTransientOptions): Promise;