/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 * @plan PLAN-20250909-TOKTRACK.P08
 */
import { type IProvider, type GenerateChatOptions } from './IProvider.js';
import { type IModel } from './IModel.js';
import { type IProviderManager } from './IProviderManager.js';
import { Config } from '../config/config.js';
import type { ProviderCapabilities, ProviderComparison } from './types.js';
import type { SettingsService } from '../settings/SettingsService.js';
import { type ProviderRuntimeContext } from '../runtime/providerRuntimeContext.js';
interface ProviderManagerInit {
    runtime?: ProviderRuntimeContext;
    config?: Config;
    settingsService?: SettingsService;
}
export interface CacheStatistics {
    totalCacheReads: number;
    /** null means provider doesn't report cache writes; 0 means explicitly reported as zero */
    totalCacheWrites: number | null;
    requestsWithCacheHits: number;
    requestsWithCacheWrites: number;
    hitRate: number;
}
export declare class ProviderManager implements IProviderManager {
    private providers;
    private serverToolsProvider;
    private config?;
    /**
     * @plan PLAN-20250218-STATELESSPROVIDER.P05
     * @requirement REQ-SP-001
     * @pseudocode provider-invocation.md lines 8-15
     */
    private settingsService;
    private runtime?;
    private providerCapabilities;
    private sessionTokenUsage;
    private cacheStats;
    constructor(init?: ProviderManagerInit | ProviderRuntimeContext);
    /**
     * @plan PLAN-20250218-STATELESSPROVIDER.P05
     * @requirement REQ-SP-001
     * @pseudocode provider-invocation.md lines 8-15
     * @plan:PLAN-20251018-STATELESSPROVIDER2.P03
     * @requirement:REQ-SP2-002
     * @pseudocode multi-runtime-baseline.md lines 3-4
     */
    private resolveInit;
    setConfig(config: Config): void;
    /**
     * @plan PLAN-20251018-STATELESSPROVIDER2.P06
     * @requirement REQ-SP2-001
     * @pseudocode base-provider-call-contract.md lines 3-5
     */
    private updateProviderWrapping;
    /**
     * @plan PLAN-20250218-STATELESSPROVIDER.P05
     * @requirement REQ-SP-001
     * @pseudocode provider-invocation.md lines 8-15
     * @plan:PLAN-20251023-STATELESS-HARDENING.P05
     * @requirement:REQ-SP4-001
     * @pseudocode provider-runtime-handling.md lines 10-15
     */
    private syncProviderRuntime;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P05
     * @requirement:REQ-SP4-001
     * @pseudocode provider-runtime-handling.md lines 10-15
     */
    private snapshotRuntimeContext;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002
     * @requirement:REQ-SP4-003
     * @requirement:REQ-SP4-004
     * @requirement:REQ-SP4-005
     * @pseudocode provider-runtime-handling.md lines 10-16
     *
     * Normalize runtime inputs per call - no stored settings/config fallbacks.
     * This method enforces that all runtime context is provided per-call and that
     * providers cannot rely on stored state.
     */
    normalizeRuntimeInputs(rawOptions: GenerateChatOptions, providerName?: string): GenerateChatOptions;
    private buildEphemeralsSnapshot;
    /**
     * @plan PLAN-20251018-STATELESSPROVIDER2.P06
     * @requirement REQ-SP2-001
     * @pseudocode base-provider-call-contract.md lines 3-5
     */
    registerProvider(provider: IProvider): void;
    /**
     * @plan PLAN-20251018-STATELESSPROVIDER2.P06
     * @requirement REQ-SP2-001
     * @pseudocode base-provider-call-contract.md lines 3-5
     */
    setActiveProvider(name: string): void;
    clearActiveProvider(): void;
    getActiveProvider(): IProvider;
    getAvailableModels(providerName?: string): Promise<IModel[]>;
    listProviders(): string[];
    /**
     * Get a provider by name (for OAuth manager)
     */
    getProviderByName(name: string): IProvider | undefined;
    getActiveProviderName(): string;
    hasActiveProvider(): boolean;
    getServerToolsProvider(): IProvider | null;
    setServerToolsProvider(provider: IProvider | null): void;
    private generateConversationId;
    private isContextPreserved;
    private getStoredModelName;
    private captureProviderCapabilities;
    private detectVisionSupport;
    private getProviderMaxTokens;
    private getSupportedToolFormats;
    private createProviderContext;
    private calculateCapabilityCompatibility;
    /**
     * Accumulate token usage for the current session
     */
    accumulateSessionTokens(providerName: string, usage: {
        input: number;
        output: number;
        cache: number;
        tool: number;
        thought: number;
        cacheReads?: number;
        cacheWrites?: number | null;
    }): void;
    /**
     * Reset session token usage counters
     */
    resetSessionTokenUsage(): void;
    /**
     * Get current session token usage
     */
    getSessionTokenUsage(): {
        input: number;
        output: number;
        cache: number;
        tool: number;
        thought: number;
        total: number;
    };
    /**
     * Track cache read/write statistics from a request
     * @param cacheReads - Number of tokens read from cache
     * @param cacheWrites - Number of tokens written to cache, or null if provider doesn't report this
     */
    trackCacheUsage(cacheReads: number, cacheWrites: number | null): void;
    /**
     * Get cache statistics
     */
    getCacheStatistics(): CacheStatistics;
    /**
     * Get performance metrics for the active provider
     * @plan PLAN-20250909-TOKTRACK
     */
    getProviderMetrics(providerName?: string): any;
    resetConversationContext(): void;
    getProviderCapabilities(providerName?: string): ProviderCapabilities | undefined;
    prepareStatelessProviderInvocation(context?: ProviderRuntimeContext): void;
    private attachStatelessRuntimeMetadata;
    compareProviders(provider1: string, provider2: string): ProviderComparison;
    private generateProviderRecommendation;
    private getBaseUrlFromProvider;
}
export {};
