/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { type IModel } from '../IModel.js';
import { type IContent } from '../../services/history/IContent.js';
import { Config } from '../../config/config.js';
import { AuthType } from '../../core/contentGenerator.js';
import { BaseProvider, type NormalizedGenerateChatOptions } from '../BaseProvider.js';
import { type OAuthManager } from '../../auth/precedence.js';
/**
 * @plan:PLAN-20251023-STATELESS-HARDENING.P08
 * @requirement:REQ-SP4-002
 * @pseudocode lines 10-14
 *
 * Removed module-level client cache to ensure stateless behavior.
 * All runtime caches and cache-related types eliminated per REQ-SP4-002.
 */
/**
 * @plan PLAN-20250822-GEMINIFALLBACK.P12
 * @requirement REQ-003.1, REQ-003.2, REQ-003.3
 * @pseudocode lines 12-18, 21-26
 */
/**
 * Represents the default Gemini provider.
 * This provider is implicitly active when no other provider is explicitly set.
 *
 * NOTE: This provider acts as a configuration layer for the native Gemini integration.
 * It doesn't implement generateChatCompletion directly but instead configures the
 * system to use the native Gemini client with the appropriate authentication.
 */
type GeminiAuthMode = 'oauth' | 'gemini-api-key' | 'vertex-ai' | 'none';
type CodeAssistGeneratorFactory = (typeof import('../../code_assist/codeAssist.js'))['createCodeAssistContentGenerator'];
type CodeAssistContentGenerator = Awaited<ReturnType<CodeAssistGeneratorFactory>>;
export declare class GeminiProvider extends BaseProvider {
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002
     * @pseudocode lines 10-14
     *
     * Removed cached state variables to ensure stateless behavior.
     * Provider now resolves model, auth, and parameters per call.
     * No instance state: authMode, model overrides, modelExplicitlySet, currentModel removed.
     * @requirement:REQ-SP4-003: Auth/model/params come from NormalizedGenerateChatOptions
     */
    private readonly geminiOAuthManager?;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002, REQ-SP4-003
     * @pseudocode lines 10-14
     *
     * Simplified constructor that only stores readonly OAuth manager.
     * All other state is now resolved per call from NormalizedGenerateChatOptions.
     * No loggers cached - created on demand like AnthropicProvider.
     */
    constructor(apiKey?: string, baseURL?: string, config?: Config, oauthManager?: OAuthManager);
    /**
     * @description Cleans a JSON Schema object to ensure it strictly conforms to the Gemini API's supported Schema definition.
     * This function acts as a whitelist, removing any properties not explicitly defined in the OpenAPI 3.03 Schema Object
     * as understood by the Gemini API. This is crucial for compatibility, as external SDKs might generate schemas
     * with unsupported keywords (e.g., `exclusiveMinimum`, `exclusiveMaximum`) which cause API errors.
     *
     * This approach aligns with how `gemini-cli` handles schema compatibility by relying on the `@google/genai` library's
     * internal cleaning mechanisms.
     *
     * @see https://ai.google.dev/api/caching#Schema
     * @param schema The JSON Schema object to clean.
     * @returns A new Schema object containing only supported properties.
     */
    private cleanGeminiSchema;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002
     * Create loggers on-demand to avoid instance state, like AnthropicProvider
     */
    private getLogger;
    private getToolsLogger;
    /**
     * @plan PLAN-20251215-issue813
     * @requirement REQ-RETRY-001: GeminiProvider must use retryWithBackoff for all SDK calls
     *
     * Determines if an error should trigger a retry.
     * - 429 (rate limit) errors are retried
     * - 5xx server errors are retried
     * - 400 (bad request) errors are NOT retried
     * - Network transient errors are retried
     */
    private shouldRetryOnError;
    /**
     * @plan PLAN-20251018-STATELESSPROVIDER2.P12
     * @requirement REQ-SP2-001
     * @pseudocode anthropic-gemini-stateless.md lines 1-2
     */
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-003
     * Determine streaming preference from config settings per call
     */
    private getStreamingPreference;
    protected createOAuthContentGenerator(httpOptions: Record<string, unknown>, config: Config, baseURL?: string): Promise<CodeAssistContentGenerator>;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002
     * No operation - stateless provider has no cache to clear
     */
    clearClientCache(_runtimeKey?: string): void;
    /**
     * Updates OAuth configuration based on current OAuth manager state
     */
    private updateOAuthState;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002, REQ-SP4-003
     * Determines the best available authentication method per call without storing state.
     * Returns both authMode and token - caller must handle both values.
     */
    private determineBestAuth;
    /**
     * Implementation of BaseProvider abstract method
     * Determines if this provider supports OAuth authentication
     */
    protected supportsOAuth(): boolean;
    /**
     * Checks if Vertex AI credentials are available
     */
    private hasVertexAICredentials;
    /**
     * Sets up environment variables for Vertex AI authentication
     */
    private setupVertexAIAuth;
    private createHttpOptions;
    /**
     * Sets the config instance for reading OAuth credentials
     */
    setConfig(config: Config): void;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002
     * Determine auth mode per call instead of using cached state
     */
    getModels(): Promise<IModel[]>;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002
     * Gets the current authentication mode per call without caching
     */
    getAuthMode(): Promise<GeminiAuthMode>;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002
     * Gets the appropriate AuthType for the core library per call
     */
    getCoreAuthType(): Promise<AuthType>;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002
     * No caching - this method is now a no-op. Settings read on demand.
     */
    private refreshCachedSettings;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-003
     * Gets the current model ID from SettingsService per call
     */
    getCurrentModel(): string;
    /**
     * Gets the default model for Gemini
     */
    getDefaultModel(): string;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-003
     * Gets model parameters from SettingsService per call
     */
    getModelParams(): Record<string, unknown> | undefined;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002
     * Checks if using paid mode synchronously via env vars (stateless check)
     */
    isPaidMode(): boolean;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002
     * No state to clear in stateless implementation
     */
    clearState(): void;
    /**
     * Clear all authentication including environment variable
     */
    clearAuth(): void;
    /**
     * Forces re-determination of auth method
     */
    clearAuthCache(): void;
    /**
     * Get the list of server tools supported by this provider
     */
    getServerTools(): string[];
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002
     * Invoke a server tool using per-call auth resolution
     */
    invokeServerTool(toolName: string, params: unknown, _config?: unknown, _signal?: AbortSignal): Promise<unknown>;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002, REQ-SP4-003
     * Generate chat completion using per-call resolution of auth, model, and params
     * All state comes from NormalizedGenerateChatOptions, no instance caching
     */
    protected generateChatCompletionWithOptions(options: NormalizedGenerateChatOptions): AsyncIterableIterator<IContent>;
}
export {};
