/**
 * Context Manager V3
 *
 * Orchestrates conversation history, token counting, and context compression.
 * Ensures the conversation fits within the LLM's context window while
 * preserving critical information (system prompt, recent messages).
 *
 * @note V3 is used by the server API routes. The main agents use ContextManagerV2
 * from context-manager-v2.ts for backwards compatibility. V3 differs from V2:
 * - Uses external ContextCompressor module instead of inline summarization
 * - Has higher default token limits (128k vs 4k)
 * - Simplified API focused on compression/stats
 */
import { CodeBuddyMessage } from '../codebuddy/client.js';
import { ContextManagerConfig, ContextStats, ContextWarning } from './types.js';
/**
 * Advanced manager for handling conversation context.
 * Features:
 * - Accurate token counting via tiktoken.
 * - Multi-stage compression (tool truncation, sliding window).
 * - Proactive warning system for context limits.
 */
export declare class ContextManagerV3 {
    private config;
    private tokenCounter;
    private compressor;
    private triggeredWarnings;
    /** Default configuration values for modern LLMs. */
    static readonly DEFAULT_CONFIG: ContextManagerConfig;
    /**
     * Creates a new ContextManager instance.
     * @param config - Optional partial configuration to override defaults.
     */
    constructor(config?: Partial<ContextManagerConfig>);
    /**
     * Updates the manager's configuration at runtime.
     * Re-initializes the token counter if the model name changes.
     *
     * @param config - New configuration properties.
     */
    updateConfig(config: Partial<ContextManagerConfig>): void;
    /**
     * Calculates current context statistics for a set of messages.
     *
     * @param messages - The messages to analyze.
     * @returns Detailed statistics including token count and usage percentage.
     */
    getStats(messages: CodeBuddyMessage[]): ContextStats;
    /**
     * Determines if a warning should be issued based on current usage.
     * Implements a "debounce" mechanism to avoid repeating warnings for the same threshold.
     *
     * @param messages - The messages to check.
     * @returns A ContextWarning object.
     */
    shouldWarn(messages: CodeBuddyMessage[]): ContextWarning;
    /**
     * Prepares messages for an API call by applying compression if necessary.
     *
     * @param messages - The full conversation history.
     * @returns A potentially reduced set of messages that fits within the limits.
     */
    prepareMessages(messages: CodeBuddyMessage[]): CodeBuddyMessage[];
    /**
     * Releases resources (like the tiktoken encoder).
     */
    dispose(): void;
}
/**
 * Factory function to create a ContextManager instance.
 *
 * @param model - The model name for token counting.
 * @param maxTokens - Optional override for max context tokens.
 * @returns A new ContextManagerV3 instance.
 */
export declare function createContextManager(model: string, maxTokens?: number): ContextManagerV3;
