import type { ClaudeAiOauth } from './keychain.js'; import { type HttpPort } from '../platform/http.js'; /** True when the access token is expired or within the refresh buffer. */ export declare function isAccessTokenStale(oauth: ClaudeAiOauth | undefined): boolean; /** * Exchange a refresh_token for a fresh access_token by hitting the * Anthropic OAuth endpoint. Returns the FULL refreshed * `claudeAiOauth` block (mirroring the shape we already store in the * Keychain) or null on any failure. * * The HTTP call goes through an injected `HttpPort` (defaults to the global * fetch via `fetchHttpAdapter`), keeping this Node 18+ compatible without a * runtime dependency. Tests inject a fake via `deps.http`. */ export declare function refreshAccessToken(refreshToken: string, deps?: { http?: HttpPort; }): Promise; /** * Convenience wrapper: refreshes only if the access token is stale. * Returns the (possibly-refreshed) oauth block, or null if refresh * failed and we have no usable fallback. */ export declare function refreshIfStale(oauth: ClaudeAiOauth | undefined, deps?: { http?: HttpPort; }): Promise;