/**
 * Context Compactor
 *
 * 上下文压缩服务
 * 当上下文超过阈值时自动压缩，防止 token 溢出
 */
import { CompactionConfig, CompactionResult, CompactionStrategy, ICompactionStrategy, CompactorState } from './compactionTypes';
import { SubAgentContext } from '../types';
/**
 * Context Compactor 配置
 */
export interface ContextCompactorConfig extends CompactionConfig {
    /** 是否启用 */
    enabled: boolean;
    /** 是否记录压缩操作 */
    logCompaction?: boolean;
}
/**
 * 默认配置
 */
export declare const DEFAULT_CONTEXT_COMPACTOR_CONFIG: ContextCompactorConfig;
/**
 * Context Compactor
 */
export declare class ContextCompactor {
    private config;
    private tokenEstimator;
    private strategies;
    private sessionStates;
    constructor(config?: Partial<ContextCompactorConfig>);
    /**
     * 注册压缩策略
     */
    registerStrategy(strategy: ICompactionStrategy): void;
    /**
     * 获取策略
     */
    getStrategy(name: CompactionStrategy): ICompactionStrategy | undefined;
    /**
     * 检查是否需要压缩
     */
    needsCompaction(context: SubAgentContext): boolean;
    /**
     * 执行压缩
     */
    compact(context: SubAgentContext, reason?: 'threshold_exceeded' | 'manual' | 'pre_iteration'): Promise<CompactionResult>;
    /**
     * 自动压缩（如果需要）
     */
    compactIfNeeded(context: SubAgentContext): Promise<SubAgentContext>;
    /**
     * 估算上下文 token 数
     */
    estimateTokens(context: SubAgentContext): number;
    /**
     * 获取详细的 token 估算
     */
    getDetailedEstimate(context: SubAgentContext): import("./compactionTypes").TokenEstimate;
    /**
     * 获取会话压缩状态
     */
    getSessionState(sessionId: string): CompactorState | undefined;
    /**
     * 更新会话状态
     */
    private updateSessionState;
    /**
     * 清除会话状态
     */
    clearSessionState(sessionId: string): void;
    /**
     * 启用/禁用压缩
     */
    setEnabled(enabled: boolean): void;
    /**
     * 检查是否启用
     */
    isEnabled(): boolean;
    /**
     * 更新配置
     */
    updateConfig(config: Partial<ContextCompactorConfig>): void;
    /**
     * 获取配置
     */
    getConfig(): ContextCompactorConfig;
    /**
     * 记录压缩结果
     */
    private logCompactionResult;
}
/**
 * 获取全局 Context Compactor
 */
export declare function getContextCompactor(): ContextCompactor;
/**
 * 设置全局 Context Compactor
 */
export declare function setContextCompactor(compactor: ContextCompactor): void;
/**
 * 重置全局 Context Compactor
 */
export declare function resetContextCompactor(): void;
/**
 * 创建 Context Compactor
 */
export declare function createContextCompactor(config?: Partial<ContextCompactorConfig>): ContextCompactor;
export default ContextCompactor;
//# sourceMappingURL=contextCompactor.d.ts.map