/**
 * Generation Handler Module
 *
 * Handles text generation execution, result formatting, and tool information extraction.
 * Extracted from BaseProvider to follow Single Responsibility Principle.
 *
 * Responsibilities:
 * - Generation execution with AI SDK
 * - Tool information extraction
 * - Result formatting and enhancement
 * - Response analysis and logging
 *
 * @module core/modules/GenerationHandler
 */
import type { LanguageModel, ModelMessage, Tool } from "ai";
import { generateText } from "ai";
import type { AIProviderName, EnhancedGenerateResult, NeuroLinkEvents, StandardRecord, TextGenerationOptions, TypedEventEmitter } from "../../types/index.js";
/**
 * GenerationHandler class - Handles text generation operations for AI providers
 */
export declare class GenerationHandler {
    private readonly providerName;
    private readonly modelName;
    private readonly supportsToolsFn;
    private readonly getTelemetryConfigFn;
    private readonly handleToolStorageFn;
    private readonly getEmitterFn?;
    constructor(providerName: AIProviderName, modelName: string, supportsToolsFn: () => boolean, getTelemetryConfigFn: (options: TextGenerationOptions, type: string) => {
        isEnabled: boolean;
        functionId?: string;
        metadata?: Record<string, string | number | boolean>;
    } | undefined, handleToolStorageFn: (toolCalls: unknown[], toolResults: unknown[], options: TextGenerationOptions, timestamp: Date) => Promise<void>, getEmitterFn?: (() => TypedEventEmitter<NeuroLinkEvents> | undefined) | undefined);
    /**
     * Helper method to call generateText with optional structured output
     * @private
     */
    private callGenerateText;
    /**
     * Execute the generation with AI SDK
     */
    executeGeneration(model: LanguageModel, messages: ModelMessage[], tools: Record<string, Tool>, options: TextGenerationOptions): Promise<Awaited<ReturnType<typeof generateText>>>;
    /**
     * Extract cache metrics from provider metadata (e.g. Anthropic's providerMetadata.anthropic)
     * The AI SDK's LanguageModelUsage only has inputTokens/outputTokens.
     * Cache metrics are surfaced via providerMetadata by provider-specific SDK adapters.
     */
    private extractCacheMetricsFromProviderMetadata;
    /**
     * Log generation completion information
     */
    logGenerationComplete(generateResult: Awaited<ReturnType<typeof generateText>>): void;
    /**
     * Extract tool information from generation result
     */
    extractToolInformation(generateResult: Awaited<ReturnType<typeof generateText>>): {
        toolsUsed: string[];
        toolExecutions: Array<{
            name: string;
            input: StandardRecord;
            output: unknown;
        }>;
    };
    /**
     * Format the enhanced result
     */
    formatEnhancedResult(generateResult: Awaited<ReturnType<typeof generateText>>, tools: Record<string, Tool>, toolsUsed: string[], toolExecutions: Array<{
        name: string;
        input: StandardRecord;
        output: unknown;
    }>, options: TextGenerationOptions): EnhancedGenerateResult;
    /**
     * Analyze AI response structure and log detailed debugging information
     */
    analyzeAIResponse(result: Record<string, unknown>): void;
}
