UNPKG

crewai-ts

Version:

TypeScript port of crewAI for agent-based workflows

73 lines 2.26 kB
export interface ShortTermMemoryEntry { id: string; content: string; timestamp: number; expiresAt?: number; metadata?: Record<string, any>; } /** * Short-term memory storage implementation * Uses efficient storage patterns with time-based expiration */ export declare class ShortTermMemoryStorage { private dbPath; private cache; private lastCleanup; private cleanupInterval; private defaultTtl; /** * Initialize storage with optimized caching * @param dbPath Optional custom database path * @param defaultTtl Default time-to-live in milliseconds */ constructor(dbPath?: string, defaultTtl?: number); /** * Ensure storage directory exists */ private ensureStorageExists; /** * Add a memory entry * @param entry Memory entry to add (with or without ID and timestamp) * @param ttl Optional time-to-live in milliseconds * @returns Memory entry with ID and timestamps */ add(entry: Omit<ShortTermMemoryEntry, 'id' | 'timestamp'> & { id?: string; timestamp?: number; }, ttl?: number): Promise<ShortTermMemoryEntry>; /** * Get all active memory entries * Uses memory-efficient loading and automatic expiration * @returns Array of active memory entries */ getAll(): Promise<ShortTermMemoryEntry[]>; /** * Get a memory entry by ID * @param id Memory entry ID * @returns Memory entry or null if not found or expired */ getById(id: string): Promise<ShortTermMemoryEntry | null>; /** * Delete a memory entry by ID * @param id Memory entry ID * @returns True if deleted, false if not found */ delete(id: string): Promise<boolean>; /** * Clear all memory entries */ clear(): Promise<void>; /** * Clean up expired entries * Uses efficient batch processing for performance */ private cleanup; /** * Get memory entries by content search * @param query Text to search for * @param limit Maximum number of results * @returns Matching memory entries */ search(query: string, limit?: number): Promise<ShortTermMemoryEntry[]>; } //# sourceMappingURL=ShortTermMemoryStorage.d.ts.map