/**
 * Context Compression
 *
 * Provides various strategies to reduce the token count of a conversation
 * while maintaining its coherence and essential instructions.
 */
import { CodeBuddyMessage } from '../codebuddy/client.js';
import { TokenCounter } from './token-counter.js';
import { CompressionResult } from './types.js';
/**
 * Options to control the compression process.
 */
export interface CompressionOptions {
    /** Target ratio to compress the older parts of the conversation. */
    targetRatio?: number;
    /** Whether to ensure the system prompt is never removed. */
    preserveSystemPrompt?: boolean;
    /** Number of most recent messages to protect from any compression. */
    preserveRecentMessages?: number;
}
/**
 * Context Compression Engine.
 * Implements a multi-stage approach to context reduction:
 * 1. Tool Truncation: Shortens long tool outputs (logs, file contents).
 * 2. Sliding Window: Removes the oldest non-system messages.
 * 3. Hard Truncation: Emergency strategy to force-fit into the limit.
 */
export declare class ContextCompressor {
    private tokenCounter;
    /**
     * Creates a new ContextCompressor.
     * @param tokenCounter - Implementation used to measure the impact of compression.
     */
    constructor(tokenCounter: TokenCounter);
    /**
     * Compresses a list of messages to fit within a specific token limit.
     *
     * @param messages - The messages to compress.
     * @param tokenLimit - The maximum allowed tokens.
     * @param options - Compression constraints.
     * @returns A result object containing the new message list and compression stats.
     */
    compress(messages: CodeBuddyMessage[], tokenLimit: number, options?: CompressionOptions): CompressionResult;
    /**
     * Helper to count tokens for a list of messages.
     */
    private countTotalTokens;
    /**
     * Helper to count tokens for a single message (for incremental calculations).
     */
    private countSingleMessageTokens;
    /**
     * Strategy: Truncate long content from tool messages.
     */
    private truncateToolOutputs;
    /**
     * Emergency strategy: remove messages from the middle/end until limit is met.
     * Prioritizes keeping the system prompt and the very latest messages.
     */
    private hardTruncate;
}
