crewai-ts
Version:
TypeScript port of crewAI for agent-based workflows
64 lines • 1.83 kB
TypeScript
export interface MemoryItem {
id: string;
content: string;
metadata?: Record<string, any>;
timestamp: number;
embeddings?: Float32Array;
}
/**
* Long-term memory storage implementation
* Uses efficient file I/O, caching, and memory-optimized data structures
*/
export declare class LongTermMemoryStorage {
private dbPath;
private cache;
/**
* Initialize storage with optimized caching
* @param dbPath Optional custom database path
*/
constructor(dbPath?: string);
/**
* Ensure storage directory exists
*/
private ensureStorageExists;
/**
* Save a memory item
* @param item Memory item to save (with or without ID)
* @returns Saved memory item with ID
*/
save(item: Omit<MemoryItem, 'id' | 'timestamp'> & {
id?: string;
timestamp?: number;
}): Promise<MemoryItem>;
/**
* Load all memory items
* @returns Array of memory items
*/
loadAll(): Promise<MemoryItem[]>;
/**
* Get a memory item by ID
* Uses efficient caching for performance
* @param id Memory item ID
* @returns Memory item or null if not found
*/
getById(id: string): Promise<MemoryItem | null>;
/**
* Delete a memory item by ID
* @param id Memory item ID
* @returns True if deleted, false if not found
*/
delete(id: string): Promise<boolean>;
/**
* Clear all memory items
*/
clear(): Promise<void>;
/**
* Search memory items by content
* Simple text-based search implementation
* @param query Search query
* @param limit Maximum number of results (optional)
* @returns Matching memory items
*/
search(query: string, limit?: number): Promise<MemoryItem[]>;
}
//# sourceMappingURL=LongTermMemoryStorage.d.ts.map