/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import type { CodexOAuthToken, TokenStore } from '@vybestack/llxprt-code-core';
import { OAuthProvider } from './oauth-manager.js';
import type { HistoryItemWithoutId } from '../ui/types.js';
/**
 * Codex OAuth Provider Implementation
 * Implements OAuth 2.0 PKCE flow for Codex authentication
 */
export declare class CodexOAuthProvider implements OAuthProvider {
    name: "codex";
    private deviceFlow;
    private logger;
    private tokenStore;
    private addItem?;
    private initializationState;
    private initializationPromise?;
    private authInProgress;
    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;
    /**
     * Lazy initialization pattern
     * Ensures initialization only happens once and handles concurrent calls
     */
    private ensureInitialized;
    /**
     * Initialize token from storage if available
     */
    private initializeToken;
    /**
     * Initiate Codex OAuth authentication flow
     * Starts local callback server and opens browser for authentication
     */
    initiateAuth(): Promise<void>;
    /**
     * Perform the actual OAuth authentication flow
     */
    private performAuth;
    /**
     * Complete authentication by exchanging authorization code for tokens
     * @param authCode Authorization code from OAuth callback
     * @param redirectUri Callback URL used in the flow
     * @param state State parameter from OAuth callback
     */
    completeAuth(authCode: string, redirectUri: string, state: string): Promise<void>;
    /**
     * Perform device authorization flow (browserless authentication)
     * For Codex, the user code is generated by OpenAI and displayed in the terminal.
     * User copies this code FROM the terminal TO the browser at auth.openai.com/codex/device
     */
    private performDeviceAuth;
    /**
     * Get OAuth token for Codex
     * Tries primary location first, then falls back to reading from Codex CLI's auth file
     * @returns CodexOAuthToken if available, null otherwise
     */
    getToken(): Promise<CodexOAuthToken | null>;
    /**
     * Refresh token if expired or about to expire
     * @returns Refreshed token or null if refresh failed
     */
    refreshIfNeeded(): Promise<CodexOAuthToken | null>;
    /**
     * Logout from Codex
     * Only removes from llxprt storage - never touches ~/.codex/
     */
    logout(): Promise<void>;
}
