/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
/**
 * Anthropic OAuth Provider Implementation
 */
import { OAuthProvider } from './oauth-manager.js';
import { OAuthToken, TokenStore } from '@vybestack/llxprt-code-core';
import { HistoryItemWithoutId } from '../ui/types.js';
export declare class AnthropicOAuthProvider implements OAuthProvider {
    private _tokenStore?;
    name: string;
    private deviceFlow;
    private authCodeResolver?;
    private authCodeRejecter?;
    private pendingAuthPromise?;
    private initializationState;
    private initializationPromise?;
    private initializationError?;
    private errorHandler;
    private retryHandler;
    private logger;
    private currentAuthAttemptId?;
    private addItem?;
    /**
     * @plan PLAN-20250823-AUTHFIXES.P06
     * @requirement REQ-001.1
     * @pseudocode lines 7-10
     *
     * Constructor completes synchronously - no async calls
     */
    constructor(_tokenStore?: TokenStore | undefined, 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;
    initiateAuth(): Promise<OAuthToken>;
    /**
     * Complete authentication with the authorization code
     * Returns the token for OAuthManager to persist with correct bucket
     */
    completeAuth(authCode: string): Promise<OAuthToken>;
    /**
     * @plan PLAN-20250823-AUTHFIXES.P08
     * @requirement REQ-001.1
     * @pseudocode lines 17-25
     */
    initializeToken(): Promise<void>;
    /**
     * @plan PLAN-20250823-AUTHFIXES.P08
     * @requirement REQ-001.1
     * @pseudocode lines 71-72
     */
    getToken(): Promise<OAuthToken | null>;
    /**
     * @plan PLAN-20250823-AUTHFIXES.P08
     * @requirement REQ-001.1
     * @pseudocode lines 74-98
     *
     * Issue #1159: Prevents race conditions when multiple clients refresh the same token
     * Flow:
     * 1. Check disk for updated token (another client may have already refreshed)
     * 2. Try to acquire refresh lock
     * 3. If lock acquired, re-check disk and refresh if still needed
     * 4. If lock not acquired, wait and re-check disk
     */
    refreshIfNeeded(): Promise<OAuthToken | null>;
    refreshToken(currentToken: OAuthToken): Promise<OAuthToken | null>;
    /**
     * @plan PLAN-20250823-AUTHFIXES.P08
     * @requirement REQ-002.1
     * @pseudocode lines 100-112
     */
    logout(token?: OAuthToken): Promise<void>;
    private hasValidRefreshToken;
    /**
     * @plan PLAN-20250823-AUTHFIXES.P08
     * @requirement REQ-003.1
     * @pseudocode lines 27-30
     */
    private isTokenExpired;
    /**
     * Get usage information from Anthropic OAuth endpoint
     * Returns full usage data for Claude Code/Max plans
     * Only works with OAuth tokens (sk-ant-oat01-...), not API keys
     */
    getUsageInfo(): Promise<Record<string, unknown> | null>;
}
