import type { Api, Model } from "../../types.js";
export type OAuthCredentials = {
    /** The bearer token sent on API calls; it has a short lifetime. */
    access: string;
    /** Long-lived token used to mint a new access token once the current one expires. */
    refresh: string;
    /** Millisecond Unix timestamp at which the access token stops being valid. */
    expires: number;
    /** Millisecond Unix timestamp recording when the credential was issued. */
    issuedAt?: number;
    /** Identifier of the provider this credential belongs to. */
    provider?: string;
    [key: string]: unknown;
};
export declare function makeOAuthCredentials(access: string, refresh: string, expiresMs: number, extra?: Partial<OAuthCredentials>): OAuthCredentials;
export type AuthProviderId = string;
/** Compatibility spelling for {@link AuthProviderId}. Reach for AuthProviderId in new code. */
export type OAuthProviderId = AuthProviderId;
export type AuthInputPrompt = {
    message: string;
    placeholder?: string;
    allowEmpty?: boolean;
};
/** Compatibility spelling for {@link AuthInputPrompt}. Reach for AuthInputPrompt in new code. */
export type OAuthPrompt = AuthInputPrompt;
export type AuthRedirectInfo = {
    url: string;
    instructions?: string;
};
export interface OAuthRefreshResult {
    credentials: OAuthCredentials;
    refreshed: boolean;
}
export interface OAuthFlowCallbacks {
    onAuth: (info: AuthRedirectInfo) => void;
    onPrompt: (prompt: AuthInputPrompt) => Promise<string>;
    onManualCodeInput?: () => Promise<string>;
}
export interface OAuthFlowOptions {
    onProgress?: (message: string) => void;
    signal?: AbortSignal;
}
export type OAuthLoginCallbacks = OAuthFlowCallbacks & OAuthFlowOptions;
export interface AuthProviderContract {
    readonly id: OAuthProviderId;
    readonly name: string;
    /** Run the interactive sign-in and return credentials the caller should persist. */
    login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;
    /** Set when the flow stands up a local listener and can take a pasted code. */
    usesCallbackServer?: boolean;
    /** Swap a stale credential for a fresh one to store. */
    refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;
    /** Extract the string used as this provider's API key from a credential. */
    getApiKey(credentials: OAuthCredentials): string;
    /** Optional pass to tweak this provider's models — e.g. to point baseUrl at a tenant. */
    modifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];
}
/** Compatibility spelling for {@link AuthProviderContract}. Reach for AuthProviderContract in new code. */
export type OAuthProviderInterface = AuthProviderContract;
/** Slim id/name/availability summary of a provider; the full contract is {@link AuthProviderContract}. */
export interface OAuthProviderInfo {
    id: OAuthProviderId;
    name: string;
    available: boolean;
}
export type OAuthTokenStatus = "valid" | "expired" | "missing";
export declare function getTokenStatus(creds: OAuthCredentials | null | undefined): OAuthTokenStatus;
