import type { AgentId } from './types.js';
export declare function setUsageBackoffDirForTest(dir: string | null): string | null;
/**
 * Parse a `Retry-After` header. HTTP allows either delta-seconds or an HTTP
 * date; both appear in the wild, so handle both and ignore anything else.
 * Returns milliseconds from `now`, or null when there is nothing usable.
 */
export declare function parseRetryAfterMs(header: string | null | undefined, now?: number): number | null;
/**
 * Record that `agent`'s usage endpoint threw a 429. `retryAfter` is the raw
 * header; when it is absent or unparseable we still back off for `fallbackMs`,
 * because continuing to poll an endpoint that just said no is what created the
 * loop in the first place.
 */
export declare function noteUsageRateLimited(agent: AgentId, retryAfter: string | null | undefined, opts?: {
    now?: number;
    fallbackMs?: number;
    account?: string | null;
}): void;
/**
 * Epoch ms until which `agent`'s usage endpoint should not be called, or null
 * when it is free — the furthest recorded deadline still in the future, so a
 * concurrently-written shorter one can never pull it in.
 *
 * Sweeps elapsed files while it is here: they can only accumulate at the rate
 * penalties are issued, and this is the one place that already lists them.
 */
export declare function usageRateLimitedUntil(agent: AgentId, now?: number, account?: string | null): number | null;
/** Human-readable remaining backoff, for the error a skipped read returns. */
export declare function formatBackoffRemaining(untilMs: number, now?: number): string;
