/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 * @plan PLAN-20250909-TOKTRACK.P08
 */
import { type IProvider, type IModel, type ITool, type GenerateChatOptions, type ProviderToolset } from './IProvider.js';
import { type IContent } from '../services/history/IContent.js';
import { Config } from '../config/config.js';
import type { ProviderPerformanceMetrics } from './types.js';
import type { SettingsService } from '../settings/SettingsService.js';
import type { ProviderRuntimeContext } from '../runtime/providerRuntimeContext.js';
export interface ConversationDataRedactor {
    redactMessage(content: IContent, provider: string): IContent;
    redactToolCall(tool: ITool): ITool;
    redactResponseContent(content: string, provider: string): string;
}
/**
 * @plan PLAN-20250909-TOKTRACK.P05
 * @plan:PLAN-20251023-STATELESS-HARDENING.P08
 * @requirement:REQ-SP4-004
 * @requirement:REQ-SP4-005
 * @pseudocode provider-runtime-handling.md lines 14-16
 * @pseudocode logging-wrapper-adjustments.md lines 11-15
 *
 * A minimal logging wrapper that acts as a transparent passthrough to the wrapped provider.
 * Only intercepts generateChatCompletion to log conversations while forwarding all other
 * methods directly to the wrapped provider without modification.
 *
 * In stateless hardening mode (P08), this wrapper:
 * - Drops constructor-captured config/settings
 * - Relies on per-call runtime metadata
 * - Implements runtime context push/pop (via runtimeContextResolver)
 * - Guards against missing runtime with MissingProviderRuntimeError
 */
export declare class LoggingProviderWrapper implements IProvider {
    private readonly wrapped;
    private conversationId;
    private turnNumber;
    private redactor;
    private performanceTracker;
    private runtimeContextResolver?;
    private statelessRuntimeMetadata;
    private debug;
    private optionsNormalizer;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-004
     * Constructor no longer captures config - it's provided per-call via options.
     */
    constructor(wrapped: IProvider, configOrRedactor?: Config | ConversationDataRedactor | null, legacyRedactor?: ConversationDataRedactor);
    attachStatelessRuntimeMetadata(metadata: Record<string, unknown>): void;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P05
     * @requirement:REQ-SP4-001
     * @pseudocode provider-runtime-handling.md lines 10-15
     * Registers a resolver so runtime context is injected per invocation.
     */
    setRuntimeContextResolver(resolver: () => ProviderRuntimeContext): void;
    /**
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement:REQ-SP4-002
     * Allows ProviderManager.normalizeRuntimeInputs to run per invocation.
     */
    setOptionsNormalizer(normalizer: (options: GenerateChatOptions, providerName: string) => GenerateChatOptions): void;
    /**
     * @plan PLAN-20251020-STATELESSPROVIDER3.P12
     * @requirement REQ-SP3-003
     * Access to the wrapped provider for unwrapping if needed.
     */
    get wrappedProvider(): IProvider;
    get name(): string;
    get isDefault(): boolean | undefined;
    getModels(): Promise<IModel[]>;
    getDefaultModel(): string;
    /**
     * @plan PLAN-20251018-STATELESSPROVIDER2.P06
     * @plan:PLAN-20251023-STATELESS-HARDENING.P05
     * @plan:PLAN-20251023-STATELESS-HARDENING.P08
     * @requirement REQ-SP2-001
     * @requirement:REQ-SP4-001
     * @requirement:REQ-SP4-004
     * @requirement:REQ-SP4-005
     * @pseudocode base-provider-call-contract.md lines 3-4
     * @plan PLAN-20250218-STATELESSPROVIDER.P04
     * @requirement REQ-SP-001
     * @pseudocode base-provider.md lines 7-15
     * @pseudocode provider-invocation.md lines 11-15
     * @pseudocode provider-runtime-handling.md lines 14-16
     */
    generateChatCompletion(options: GenerateChatOptions): AsyncIterableIterator<IContent>;
    generateChatCompletion(content: IContent[], tools?: ProviderToolset): AsyncIterableIterator<IContent>;
    private logRequest;
    /**
     * Process stream to extract token metrics without logging
     * @plan PLAN-20250909-TOKTRACK
     */
    private processStreamForMetrics;
    private logResponseStream;
    private extractSimpleContent;
    private logResponse;
    private generateConversationId;
    private generatePromptId;
    /**
     * Extract token counts from tokenUsage metadata
     */
    private extractTokenCountsFromTokenUsage;
    /**
     * Extract token counts from response object or headers
     */
    extractTokenCountsFromResponse(response: unknown): {
        input_token_count: number;
        output_token_count: number;
        cached_content_token_count: number;
        thoughts_token_count: number;
        tool_token_count: number;
        cache_read_input_tokens: number;
        cache_creation_input_tokens: number;
    };
    /**
     * Accumulate token usage for session tracking
     */
    private accumulateTokenUsage;
    private resolveLoggingConfig;
    private logToolCall;
    getCurrentModel?(): string;
    setRuntimeSettingsService?(settingsService: SettingsService): void;
    getToolFormat?(): string;
    isPaidMode?(): boolean;
    clearState?(): void;
    setConfig?(config: unknown): void;
    getServerTools(): string[];
    invokeServerTool(toolName: string, params: unknown, config?: unknown): Promise<unknown>;
    getModelParams?(): Record<string, unknown> | undefined;
    /**
     * Get the latest performance metrics from the tracker
     * @plan PLAN-20250909-TOKTRACK
     */
    getPerformanceMetrics(): ProviderPerformanceMetrics;
    /**
     * Delegate getStats() to wrapped provider if it supports it (e.g., LoadBalancingProvider)
     * @returns Stats from the underlying provider, or undefined if not supported
     */
    getStats(): unknown;
}
