/**
 * Memory retention policies implementation
 * Provides flexible control over memory retention with various strategies
 */
import { BaseMemory, MemoryItem } from '../BaseMemory.js';
interface ExtendedMemoryItem extends MemoryItem {
    updatedAt?: number;
    relevance?: number;
}
/**
 * Base interface for memory retention policies
 */
export interface RetentionPolicy {
    /**
     * Determine if a memory item should be retained
     * @param item The memory item to evaluate
     * @returns True if the item should be retained, false if it can be removed
     */
    shouldRetain(item: ExtendedMemoryItem): boolean;
    /**
     * Apply the retention policy to a memory store
     * This will evaluate all items and remove those that should not be retained
     * @param memory The memory store to apply the policy to
     */
    applyToMemory(memory: BaseMemory): Promise<number>;
    /**
     * Optional name for the policy for identification
     */
    name?: string;
}
/**
 * Options for time-based retention policy
 */
export interface TimeBasedRetentionOptions {
    /**
     * Maximum age in milliseconds for items to be retained
     * Items older than this will be removed
     */
    maxAgeMs: number;
    /**
     * Field to use for age calculation
     * - 'createdAt': Use item creation time (default)
     * - 'lastAccessedAt': Use last access time
     * - 'updatedAt': Use last update time
     * @default 'createdAt'
     */
    timeField?: 'createdAt' | 'lastAccessedAt' | 'updatedAt';
    /**
     * Name for this policy instance
     */
    name?: string;
}
/**
 * Time-based retention policy
 * Retains items based on their age (creation or access time)
 */
export declare class TimeBasedRetentionPolicy implements RetentionPolicy {
    private maxAgeMs;
    private timeField;
    name?: string;
    constructor(options: TimeBasedRetentionOptions);
    shouldRetain(item: ExtendedMemoryItem): boolean;
    applyToMemory(memory: BaseMemory): Promise<number>;
}
/**
 * Options for count-based retention policy
 */
export interface CountBasedRetentionOptions {
    /**
     * Maximum number of items to retain
     */
    maxItems: number;
    /**
     * Strategy for selecting items to remove when maxItems is exceeded
     * - 'oldest': Remove oldest items first (by creation time)
     * - 'leastAccessed': Remove least recently accessed items first
     * @default 'oldest'
     */
    strategy?: 'oldest' | 'leastAccessed';
    /**
     * Name for this policy instance
     */
    name?: string;
}
/**
 * Count-based retention policy
 * Retains up to a maximum number of items
 */
export declare class CountBasedRetentionPolicy implements RetentionPolicy {
    private maxItems;
    private strategy;
    name?: string;
    constructor(options: CountBasedRetentionOptions);
    shouldRetain(item: MemoryItem): boolean;
    applyToMemory(memory: BaseMemory): Promise<number>;
}
/**
 * Options for relevance-based retention policy
 */
export interface RelevanceBasedRetentionOptions {
    /**
     * Relevance threshold between 0 and 1
     * Items with relevance below this threshold will be removed
     */
    threshold: number;
    /**
     * Optional relevance function to calculate item relevance
     * If not provided, the item's relevance property will be used
     */
    relevanceFn?: (item: MemoryItem) => number;
    /**
     * Name for this policy instance
     */
    name?: string;
}
/**
 * Relevance-based retention policy
 * Retains items based on their calculated relevance score
 */
export declare class RelevanceBasedRetentionPolicy implements RetentionPolicy {
    private threshold;
    private relevanceFn?;
    name?: string;
    constructor(options: RelevanceBasedRetentionOptions);
    shouldRetain(item: MemoryItem): boolean;
    applyToMemory(memory: BaseMemory): Promise<number>;
}
/**
 * Options for composite retention policy
 */
export interface CompositeRetentionOptions {
    /**
     * List of retention policies to combine
     */
    policies: RetentionPolicy[];
    /**
     * Mode for combining policies
     * - 'all': Item must be retained by all policies (AND)
     * - 'any': Item must be retained by at least one policy (OR)
     * @default 'any'
     */
    mode?: 'all' | 'any';
    /**
     * Name for this policy instance
     */
    name?: string;
}
/**
 * Composite retention policy
 * Combines multiple retention policies with AND/OR logic
 */
export declare class CompositeRetentionPolicy implements RetentionPolicy {
    private policies;
    private mode;
    name?: string;
    constructor(options: CompositeRetentionOptions);
    shouldRetain(item: MemoryItem): boolean;
    applyToMemory(memory: BaseMemory): Promise<number>;
}
/**
 * Options for metadata-based retention policy
 */
export interface MetadataBasedRetentionOptions {
    /**
     * Metadata criteria that items must match to be retained
     * If multiple criteria are provided, an item must match all of them (AND logic)
     */
    criteria: Record<string, any>;
    /**
     * Whether to invert the matching logic
     * If true, items that match the criteria will be removed instead of retained
     * @default false
     */
    invert?: boolean;
    /**
     * Name for this policy instance
     */
    name?: string;
}
/**
 * Metadata-based retention policy
 * Retains items based on their metadata properties
 */
export declare class MetadataBasedRetentionPolicy implements RetentionPolicy {
    private criteria;
    private invert;
    name?: string;
    constructor(options: MetadataBasedRetentionOptions);
    shouldRetain(item: MemoryItem): boolean;
    applyToMemory(memory: BaseMemory): Promise<number>;
}
/**
 * Retention policy factory with common policy creation methods
 */
export declare class RetentionPolicyFactory {
    /**
     * Create a policy that retains items based on age
     */
    static createTimeBasedPolicy(maxAgeMs: number, timeField?: 'createdAt' | 'lastAccessedAt' | 'updatedAt'): RetentionPolicy;
    /**
     * Create a policy that retains a maximum number of items
     */
    static createCountBasedPolicy(maxItems: number, strategy?: 'oldest' | 'leastAccessed'): RetentionPolicy;
    /**
     * Create a policy that retains items based on relevance score
     */
    static createRelevanceBasedPolicy(threshold: number, relevanceFn?: (item: MemoryItem) => number): RetentionPolicy;
    /**
     * Create a policy that combines multiple policies
     */
    static createCompositePolicy(policies: RetentionPolicy[], mode?: 'all' | 'any'): RetentionPolicy;
    /**
     * Create a policy that retains items based on metadata
     */
    static createMetadataBasedPolicy(criteria: Record<string, any>, invert?: boolean): RetentionPolicy;
}
export {};
//# sourceMappingURL=RetentionPolicy.d.ts.map