UNPKG

crewai-ts

Version:

TypeScript port of crewAI for agent-based workflows

63 lines 2.31 kB
/** * UserMemoryAdapter * * Adapts UserMemory to implement the BaseMemory interface * Optimized for performance with proper type safety */ import { BaseMemory, MemoryItem, MemorySearchParams, MemorySearchResult } from '../BaseMemory.js'; import { UserMemory } from '../UserMemory.js'; /** * Adapter class to make UserMemory compatible with BaseMemory interface * This adapter implements all required methods of BaseMemory, delegating to the * wrapped UserMemory instance where possible and providing optimized * implementations. */ export declare class UserMemoryAdapter implements BaseMemory { private userMemory; constructor(userMemory: UserMemory); /** * Add an item to memory with memory-efficient implementation */ add(content: string, metadata?: Record<string, any>): Promise<MemoryItem>; /** * Search for items in memory with optimized retrieval */ search(params: MemorySearchParams): Promise<MemorySearchResult>; /** * Get an item by ID with optimized access time tracking */ get(id: string): Promise<MemoryItem | null>; /** * Update an existing memory item with efficient index management */ update(id: string, updates: Partial<Omit<MemoryItem, 'id' | 'createdAt'>>): Promise<MemoryItem | null>; /** * Remove an item from memory with proper index cleanup */ remove(id: string): Promise<boolean>; /** * Clear all items from memory with optimized resource cleanup */ clear(): Promise<void>; /** * Reset the memory system with efficient reinitialization */ reset(): Promise<void>; /** * Get all memory items for a specific user with optimized retrieval */ getUserItems(userId: string, limit?: number): Promise<MemorySearchResult>; /** * Get user preferences with efficient data aggregation */ getUserPreferences(userId: string): Promise<Record<string, any>>; /** * Store a user preference with optimized indexing */ setUserPreference(userId: string, key: string, value: any): Promise<void>; /** * Add a user interaction to memory with efficient storage */ addUserInteraction(userId: string, interaction: Record<string, any>): Promise<void>; } //# sourceMappingURL=UserMemoryAdapter.d.ts.map