import type { AgentMessage } from "@earendil-works/pi-agent-core";
export declare const PROVIDER_RETRY_BASE_MS = 15000;
export declare const PROVIDER_RETRY_CAP_MS: number;
export declare const PROVIDER_RETRY_WAKE_CAP_MS: number;
/**
 * Prefer a provider's structured usage reset, then its retry-after marker. Legacy
 * pool guidance falls back to the earliest future ISO instant in the error only.
 */
export declare function providerRetryAt(messages: readonly AgentMessage[], now: number): number | undefined;
/** Re-checks of a limit that never clears before the goal parks until a sign-in, a block reset or input (senpi#4085). */
export declare const GOAL_LIMIT_WAIT_WAKE_LIMIT = 48;
/** The shortest wait before the `attempt`-th limit re-check: the provider backoff, 15 s doubling to 30 min. */
export declare function limitWaitFloorMs(attempt: number): number;
/**
 * The turn ended on a provider refusing for a usage or rate limit, not on an outage (senpi#4085). An OpenAI-compatible
 * adapter reports a bare 429 as a status-only diagnostic (`unknown` + 429); that status is still a limit.
 */
export declare function isLimitRefusal(messages: readonly AgentMessage[]): boolean;
/**
 * How long to wait before the `attempt`-th consecutive provider-recovery
 * continuation (senpi#3264). A stated unblock time is the wake; otherwise the
 * first retry is immediate and later ones back off exponentially, so a
 * provider that is certainly down is not hammered and the goal is still there
 * when it comes back.
 */
/**
 * The wait before the one resume after an exhausted fallback ladder (senpi#3709). Unlike
 * `providerRetryDelayMs` it is not capped at the wake cap: an earlier wake would only hit the
 * same limits again.
 */
export declare function exhaustedLadderResumeDelayMs(resumeAt: number, now: number): number;
export declare function providerRetryDelayMs(attempt: number, retryAt: number | undefined, now: number): number;
//# sourceMappingURL=provider-retry.d.ts.map