import type { RefreshableAccount, RefreshResult, TokenPersistTarget } from "../types/index.js";
export declare function needsRefresh(account: RefreshableAccount): boolean;
export declare function isPermanentRefreshFailure(result: RefreshResult): boolean;
/**
 * Serialize refreshes by refresh-token value. OAuth refresh tokens may rotate,
 * so concurrent refreshes with the same old token can make all but the first
 * request fail with invalid_grant. A short success cache covers callers that
 * loaded either the old token or the newly rotated token around persistence.
 */
export declare function refreshToken(account: RefreshableAccount): Promise<RefreshResult>;
/**
 * Refreshes against the latest persisted credential generation. Queued
 * requests can otherwise reject a rotated refresh token and disable a newer
 * login that was saved while they were waiting.
 */
export declare function refreshTokenFromLatest(account: RefreshableAccount, target?: TokenPersistTarget): Promise<RefreshResult>;
export declare function clearRefreshStateForTests(): void;
export declare function persistTokens(target: TokenPersistTarget, account: RefreshableAccount): Promise<void>;
