/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
/**
 * Gemini OAuth Provider Implementation
 *
 * Bridges to the existing Google OAuth infrastructure in oauth2.ts
 * while maintaining compatibility with the LOGIN_WITH_GOOGLE flow.
 */
import { OAuthProvider } from './oauth-manager.js';
import { OAuthToken, TokenStore } from './types.js';
import { HistoryItemWithoutId } from '../ui/types.js';
export declare class GeminiOAuthProvider implements OAuthProvider {
    name: string;
    private currentToken;
    private tokenStore?;
    private initializationState;
    private initializationPromise?;
    private initializationError?;
    private errorHandler;
    private retryHandler;
    private logger;
    private addItem?;
    private authCodeResolver?;
    private authCodeRejecter?;
    constructor(tokenStore?: TokenStore, addItem?: (itemData: Omit<HistoryItemWithoutId, 'id'>, baseTimestamp: number) => number);
    /**
     * Set the addItem callback for displaying messages in the UI
     */
    setAddItem(addItem: (itemData: Omit<HistoryItemWithoutId, 'id'>, baseTimestamp: number) => number): void;
    /**
     * Wait for authorization code from UI dialog
     */
    waitForAuthCode(): Promise<string>;
    /**
     * Submit authorization code from UI dialog
     */
    submitAuthCode(code: string): void;
    /**
     * Cancel OAuth flow
     */
    cancelAuth(): void;
    /**
     * Lazy initialization with proper state management
     * Ensures initialization only happens once and handles concurrent calls
     */
    private ensureInitialized;
    initializeToken(): Promise<void>;
    initiateAuth(): Promise<void>;
    getToken(): Promise<OAuthToken | null>;
    refreshIfNeeded(): Promise<OAuthToken | null>;
    logout(): Promise<void>;
    /**
     * Converts Google OAuth Credentials to our OAuthToken format
     */
    private credentialsToOAuthToken;
    /**
     * Gets token from the existing Google OAuth infrastructure
     */
    private getTokenFromGoogleOAuth;
    /**
     * Migrates tokens from legacy locations to new format
     */
    private migrateFromLegacyTokens;
    /**
     * Clears tokens from all legacy locations
     */
    private clearLegacyTokens;
    /**
     * Install auth-code hooks so oauth2.ts can ask the UI for the code instead of readline
     */
    private installAuthCodeHooks;
}
