import { type ModelAuth, type OAuthCredential, type OAuthCredentials, type OAuthLoginCallbacks } from "@earendil-works/pi-ai";
import type { Api, Model } from "@earendil-works/pi-ai/compat";
export interface LegacyOAuthProvider {
    name: string;
    usesCallbackServer?: boolean;
    login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;
    refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;
    getApiKey(credentials: OAuthCredentials): string;
    modifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];
}
export interface OAuthProviderDescriptor extends LegacyOAuthProvider {
    id: string;
    loginLabel?: string;
}
export interface AtomicOAuthLoginCallbacks extends OAuthLoginCallbacks {
    onManualCodeCancel?(): void;
}
export declare function registerLegacyOAuthProvider(providerId: string, provider: LegacyOAuthProvider, sourceId?: string): void;
/** Legacy registry aliases retained for Atomic's extension/test compatibility. */
export declare function registerOAuthProvider(provider: LegacyOAuthProvider & {
    id: string;
}): void;
export declare function getOAuthProvider(providerId: string): OAuthProviderDescriptor | undefined;
export declare function resetLegacyOAuthProviders(): void;
export declare function unregisterLegacyOAuthProviders(sourceId: string): void;
export declare function getLegacyOAuthProvider(providerId: string): LegacyOAuthProvider | undefined;
export declare function getOAuthProviders(): OAuthProviderDescriptor[];
export declare const resetOAuthProviders: typeof resetLegacyOAuthProviders;
export declare function getOAuthProviderDescriptors(): OAuthProviderDescriptor[];
export declare function loginOAuthProvider(providerId: string, callbacks: AtomicOAuthLoginCallbacks): Promise<OAuthCredential>;
export declare function refreshOAuthProvider(providerId: string, credential: OAuthCredential): Promise<{
    credential: OAuthCredential;
    auth: ModelAuth;
} | undefined>;
export declare function oauthCredentialToAuth(providerId: string, credential: OAuthCredential): Promise<ModelAuth | undefined>;
export declare function getOAuthApiKey(providerId: string, credentials: Record<string, OAuthCredentials>): Promise<{
    newCredentials: OAuthCredentials;
    apiKey: string;
} | null>;
//# sourceMappingURL=oauth-provider-bridge.d.ts.map