import { type StoredOAuthAuth, type TokenResponse } from "./tokens.js"; export type OAuthResolveResult = { accessToken: string; accountId?: string; refresh: string; expires: number; }; export type OAuthAuthClient = { auth: { set: (input: { path: { id: string; }; body: { type: "oauth"; refresh: string; access: string; expires: number; accountId?: string; }; }) => Promise; }; }; export type CreateOAuthRefresherOptions = { providerId: string; client: OAuthAuthClient; /** Default 5 minutes — refresh ahead of true expiry. */ skewMs?: number; now?: () => number; refreshFn?: (refreshToken: string) => Promise; reloadAuth?: () => Promise; lockDir?: string | false; }; /** * OpenCode Codex-style OAuth resolver: singleflight refresh + always persist a * rotated refresh_token before handing out the new access token. * * Concurrent callers share one network refresh so a rotating RT is never spent twice. */ export declare function createOAuthRefresher(opts: CreateOAuthRefresherOptions): { resolve: (auth: StoredOAuthAuth, reloadAuth?: (() => Promise) | undefined) => Promise; }; //# sourceMappingURL=refresh.d.ts.map