/** True when a background refresh was spawned within the debounce window. */ export declare function isRefreshSpawnDebounced(accountsDirPath: string): boolean; /** Record that a background refresh is being spawned now (best-effort). */ export declare function markRefreshSpawned(accountsDirPath: string): void; interface UsageWindow { utilization: number; resets_at?: string; } export interface UsagePayload { five_hour: UsageWindow; seven_day: UsageWindow; seven_day_opus?: UsageWindow | null; seven_day_sonnet?: UsageWindow | null; } export interface UsageCache { fetchedAt: number; /** Email of the account whose token produced this snapshot. Different * accounts have completely independent quotas, so a cache from account * A must never be displayed while account B is active. */ account?: string; payload?: UsagePayload; rateLimitedUntil?: number; } /** * Parse the Retry-After header value into seconds. Defaults to 300s only when * the header is missing/unparseable — `Retry-After: 0` is valid (retry now). */ export declare function parseRetryAfter(header: string | string[] | undefined): number; /** Type predicate for `UsagePayload` — validates both mandatory window fields. */ export declare function isUsagePayloadShaped(v: unknown): v is UsagePayload; /** * Read the legacy global cache file. Kept for back-compat — new callers * should prefer `readUsageCacheForAccount(dir, email)` which checks the * per-account file first. */ export declare function readUsageCache(accountsDirPath: string): UsageCache | null; /** * Read the per-account cache for the given email. Falls back to the * legacy global cache ONLY when (a) the per-account file doesn't exist * AND (b) the legacy file's `account` field matches the requested * email — preserves cached numbers across the v3.7 upgrade without * leaking another account's cache. */ export declare function readUsageCacheForAccount(accountsDirPath: string, email: string): UsageCache | null; export declare function writeUsageCache(accountsDirPath: string, cache: UsageCache): void; /** * Returns true if the cache is missing, missing a payload, older than * STATUSLINE_REFRESH_AFTER_MS, or belongs to a different account than the * one currently active. Always false while a recorded rate-limit back-off * is still in effect, since refreshing into a 429 makes nothing better. */ export declare function isUsageCacheStale(cache: UsageCache | null, currentAccount?: string): boolean; /** * Returns the cache only if it belongs to the given account. Used by display * code (statusline, status) to avoid showing numbers from a different * account's quota. */ export declare function readUsageCacheFor(accountsDirPath: string, account: string): UsageCache | null; /** * Decision helper for the "pre-fetch on switch" path: returns * true when the target account's cache is missing or stale, false when it * is fresh enough that an immediate refresh would be wasted. Kept as a * pure predicate so switcher.ts can call it without pulling in the * spawn/IO side effects. */ export declare function shouldTriggerUsageRefreshAfterSwitch(accountsDirPath: string, email: string): boolean; export {};