/**
 * Conversation Memory Utilities
 * Handles configuration merging and conversation memory operations
 */
import type { ConversationMemoryManager } from "../core/conversationMemoryManager.js";
import type { RedisConversationMemoryManager } from "../core/redisConversationMemoryManager.js";
import type { ChatMessage, ConversationMemoryConfig, SessionMemory } from "../types/conversation.js";
import type { TextGenerationOptions, TextGenerationResult } from "../types/generateTypes.js";
/**
 * Apply conversation memory defaults to user configuration
 * Merges user config with environment variables and default values
 */
export declare function applyConversationMemoryDefaults(userConfig?: Partial<ConversationMemoryConfig>): ConversationMemoryConfig;
/**
 * Get conversation history as message array, summarizing if needed.
 */
export declare function getConversationMessages(conversationMemory: ConversationMemoryManager | RedisConversationMemoryManager | null | undefined, options: TextGenerationOptions): Promise<ChatMessage[]>;
/**
 * Store conversation turn for future context
 * Saves user messages and AI responses for conversation memory
 */
export declare function storeConversationTurn(conversationMemory: ConversationMemoryManager | RedisConversationMemoryManager | null | undefined, originalOptions: TextGenerationOptions, result: TextGenerationResult, startTimeStamp?: Date | undefined, requestId?: string): Promise<void>;
/**
 * Build context messages from pointer onwards (token-based memory)
 * Returns summary message (if exists) + all messages after the summarized pointer
 * @param session - Session memory with pointer
 * @returns Context messages to send to LLM
 */
export declare function buildContextFromPointer(session: SessionMemory, requestId?: string): ChatMessage[];
/**
 * Create summarization prompt from message history
 * Used by both in-memory and Redis conversation managers
 * @param history - Messages to summarize
 * @param previousSummary - Optional previous summary to build upon
 */
export declare function createSummarizationPrompt(history: ChatMessage[], previousSummary?: string): string;
/**
 * Calculate token threshold based on model's context window and available input tokens
 * Uses context window registry for accurate per-provider, per-model limits
 * @param provider - AI provider name
 * @param model - Model name
 * @param maxTokens - Optional explicit maxTokens for output reserve calculation
 * @returns Token threshold (80% of available input tokens)
 */
export declare function calculateTokenThreshold(provider?: string, model?: string, maxTokens?: number): number;
/**
 * Get effective token threshold for a session
 * Priority: session override > env var > model-based (80%) > fallback
 * @param provider - AI provider name
 * @param model - Model name
 * @param envOverride - Environment variable override
 * @param sessionOverride - Per-session token threshold override
 * @returns Effective token threshold
 */
export declare function getEffectiveTokenThreshold(provider: string, model: string, envOverride?: number, sessionOverride?: number): number;
/**
 * Generate summary using configured provider and model
 * Centralized summarization logic used by both ConversationMemoryManager and RedisConversationMemoryManager
 * @param messages - Messages to summarize
 * @param config - Conversation memory configuration containing provider/model settings
 * @param previousSummary - Optional previous summary to build upon
 * @param logPrefix - Prefix for log messages (e.g., "[ConversationMemory]" or "[RedisConversationMemoryManager]")
 * @param requestId - Optional request ID for request-scoped tracing
 * @returns Summary text or null if generation fails
 */
export declare function generateSummary(messages: ChatMessage[], config: Partial<ConversationMemoryConfig>, logPrefix?: string, previousSummary?: string, requestId?: string): Promise<string | null>;
/**
 * Check if Redis is available for conversation memory.
 * Migrated from the deprecated conversationMemoryUtils.ts.
 */
export declare function checkRedisAvailability(): Promise<boolean>;
