import type { ITelemetryService } from "@clinebot/shared";
import type { OAuthCredentials, OAuthLoginCallbacks, OAuthProviderInterface } from "./types";
export type ClineTokenResolution = {
    forceRefresh?: boolean;
    refreshBufferMs?: number;
    retryableTokenGraceMs?: number;
};
interface ClineAuthApiUser {
    subject: string | null;
    email: string;
    name: string;
    clineUserId: string | null;
    accounts: string[] | null;
}
type HeaderMap = Record<string, string>;
type HeaderInput = HeaderMap | (() => Promise<HeaderMap> | HeaderMap);
export interface ClineOAuthProviderOptions {
    apiBaseUrl: string;
    headers?: HeaderInput;
    callbackPath?: string;
    callbackPorts?: number[];
    requestTimeoutMs?: number;
    telemetry?: ITelemetryService;
    /**
     * Optional identity provider name for token exchange.
     */
    provider?: string;
}
export interface ClineOAuthCredentials extends OAuthCredentials {
    metadata?: {
        provider?: string;
        tokenType?: string;
        userInfo?: ClineAuthApiUser;
        [key: string]: unknown;
    };
}
export declare function loginClineOAuth(options: ClineOAuthProviderOptions & {
    callbacks: OAuthLoginCallbacks;
}): Promise<ClineOAuthCredentials>;
export declare function refreshClineToken(current: ClineOAuthCredentials, options: ClineOAuthProviderOptions): Promise<ClineOAuthCredentials>;
export declare function getValidClineCredentials(currentCredentials: ClineOAuthCredentials | null, providerOptions: ClineOAuthProviderOptions, options?: ClineTokenResolution): Promise<ClineOAuthCredentials | null>;
export declare function createClineOAuthProvider(options: ClineOAuthProviderOptions): OAuthProviderInterface;
export {};
//# sourceMappingURL=cline.d.ts.map