/**
 * Session Pruning Manager
 *
 * Manages automatic pruning of sessions, messages, and memories
 * based on configurable rules.
 */
import { EventEmitter } from 'events';
import type { PruningConfig, PruningRule, PruningCondition, PrunableItem, PruningResult, SessionPruningConfig } from './types.js';
export type ConditionEvaluator = (item: PrunableItem, condition: PruningCondition, context: EvaluationContext) => boolean;
export interface EvaluationContext {
    now: Date;
    sessionStats: Map<string, SessionStats>;
    globalStats: GlobalStats;
    customEvaluators?: Map<string, ConditionEvaluator>;
}
export interface SessionStats {
    messageCount: number;
    totalTokens: number;
    totalBytes: number;
    oldestItem?: Date;
    newestItem?: Date;
}
export interface GlobalStats {
    totalSessions: number;
    totalItems: number;
    totalTokens: number;
    totalBytes: number;
}
export declare class PruningManager extends EventEmitter {
    private config;
    private checkInterval;
    private lastPruneTime;
    private customEvaluators;
    private sessionConfigs;
    private items;
    private archivedItems;
    constructor(config?: Partial<PruningConfig>);
    /**
     * Get current configuration
     */
    getConfig(): PruningConfig;
    /**
     * Update configuration
     */
    updateConfig(config: Partial<PruningConfig>): void;
    /**
     * Add a pruning rule
     */
    addRule(rule: PruningRule): void;
    /**
     * Remove a pruning rule
     */
    removeRule(ruleId: string): boolean;
    /**
     * Enable/disable a rule
     */
    setRuleEnabled(ruleId: string, enabled: boolean): boolean;
    /**
     * Set session-specific configuration
     */
    setSessionConfig(sessionId: string, config: Partial<SessionPruningConfig>): void;
    /**
     * Remove session-specific configuration
     */
    removeSessionConfig(sessionId: string): boolean;
    /**
     * Register a custom condition evaluator
     */
    registerEvaluator(name: string, evaluator: ConditionEvaluator): void;
    /**
     * Add an item to be managed
     */
    addItem(item: PrunableItem): void;
    /**
     * Remove an item
     */
    removeItem(id: string): boolean;
    /**
     * Get an item
     */
    getItem(id: string): PrunableItem | undefined;
    /**
     * Get all items
     */
    getAllItems(): PrunableItem[];
    /**
     * Get items for a session
     */
    getSessionItems(sessionId: string): PrunableItem[];
    /**
     * Get archived items
     */
    getArchivedItems(): PrunableItem[];
    /**
     * Clear all items
     */
    clearItems(): void;
    /**
     * Start automatic pruning
     */
    start(): void;
    /**
     * Stop automatic pruning
     */
    stop(): void;
    /**
     * Check if pruning should run and execute if needed
     */
    checkAndPrune(): Promise<PruningResult | null>;
    /**
     * Check if pruning should occur
     */
    private shouldPrune;
    /**
     * Execute pruning operation
     */
    prune(options?: {
        force?: boolean;
        sessionId?: string;
    }): Promise<PruningResult>;
    /**
     * Build evaluation context
     */
    private buildEvaluationContext;
    /**
     * Calculate global stats
     */
    private calculateGlobalStats;
    /**
     * Find pruning candidates
     */
    private findCandidates;
    /**
     * Evaluate all conditions for an item
     */
    private evaluateConditions;
    /**
     * Describe a condition in human-readable format
     */
    private describeCondition;
    /**
     * Execute pruning action
     */
    private executeAction;
    /**
     * Calculate pruning statistics
     */
    private calculateStats;
    /**
     * Get current statistics
     */
    getStats(): {
        config: PruningConfig;
        globalStats: GlobalStats;
        sessionStats: Map<string, SessionStats>;
        lastPruneTime: number;
    };
}
export declare function getPruningManager(config?: Partial<PruningConfig>): PruningManager;
export declare function resetPruningManager(): void;
