/** * MemoryRetentionStrategy - Retention strategy for Memory element entries * * Implements IRetentionStrategy for Memory entries, which have: * - Individual entries with expiresAt dates * - TTL-based expiration * - Capacity limits (max entries) * * @module MemoryRetentionStrategy */ import { ElementType } from '../../../portfolio/types.js'; import type { MemoryEntry } from '../../../elements/memories/types.js'; import { IRetentionStrategy, IRetainableItem, ElementRetentionConfig, RetentionCheckResult } from '../types.js'; /** * Adapter to make MemoryEntry conform to IRetainableItem */ interface RetainableMemoryEntry extends IRetainableItem { originalEntry: MemoryEntry; } /** * Retention strategy for Memory element entries */ export declare class MemoryRetentionStrategy implements IRetentionStrategy { readonly elementType = ElementType.MEMORY; /** * Extract retainable items from a Memory element * Converts Memory entries to IRetainableItem interface for retention processing * * @param element - The Memory instance to extract entries from * @returns Map of entry IDs to retainable item wrappers * @throws {TypeError} If element is not a valid Memory instance */ getRetainableItems(element: unknown): Map; /** * Check if a memory entry should be retained based on retention policy * Evaluates expiration, pinning status, and policy configuration * * @param item - The retainable memory entry to check * @param config - Retention configuration for this element type * @returns Result indicating whether to retain and the reason * * Retention reasons: * - 'pinned': Entry is marked as permanent/pinned * - 'policy_disabled': Retention is disabled in config * - 'no_expiry': Entry has no expiration date * - 'valid': Entry has not expired yet * - 'within_warning': Entry expires within warning threshold * - 'expired': Entry has passed its expiration date */ checkItem(item: RetainableMemoryEntry, config: ElementRetentionConfig): RetentionCheckResult; /** * Remove a memory entry by ID * Uses Memory.removeEntry() public API (no reflection) * * @param element - The Memory instance * @param itemId - The entry ID to remove * @throws {Error} If element is not a valid Memory instance * * SECURITY: Normalizes itemId to prevent Unicode bypass attacks */ removeItem(element: unknown, itemId: string): void; /** * Calculate expiry date for a new memory entry based on TTL config * * @param config - Retention configuration with defaultTtlDays * @returns Date when entry expires, or undefined if permanent (negative TTL) */ calculateExpiryDate(config: ElementRetentionConfig): Date | undefined; /** * Check if a memory entry is pinned (protected from deletion) * Pinned entries are never deleted by retention policy * * @param item - The retainable memory entry to check * @returns true if entry has pinned or permanent flag in metadata */ isPinned(item: RetainableMemoryEntry): boolean; /** * Get truncated content preview for display in retention reports * * @param item - The retainable memory entry * @param maxLength - Maximum preview length (default: RETENTION_DEFAULTS.MAX_PREVIEW_LENGTH) * @returns Truncated content with ellipsis if needed */ getContentPreview(item: RetainableMemoryEntry, maxLength?: number): string; /** * Convert MemoryEntry to IRetainableItem */ private toRetainableItem; /** * Get entries from a Memory element * Uses the public getEntries() API (Issue #51) */ private getMemoryEntries; /** * Truncate content for preview */ private truncateContent; } export {}; //# sourceMappingURL=MemoryRetentionStrategy.d.ts.map