/** * Memory Repository Interface - Domain Layer * * Defines the contract for memory persistence. * Following DDD, the interface belongs to the domain layer * while implementations belong to infrastructure. * * @module v3/memory/domain/repositories */ import { MemoryEntry, MemoryType, MemoryStatus } from '../entities/memory-entry.js'; /** * Query options for memory retrieval */ export interface MemoryQueryOptions { namespace?: string; type?: MemoryType; status?: MemoryStatus; limit?: number; offset?: number; orderBy?: 'createdAt' | 'updatedAt' | 'accessCount' | 'lastAccessedAt'; orderDirection?: 'asc' | 'desc'; } /** * Vector search options */ export interface VectorSearchOptions { vector: Float32Array; namespace?: string; limit?: number; threshold?: number; type?: MemoryType; } /** * Vector search result */ export interface VectorSearchResult { entry: MemoryEntry; similarity: number; distance: number; } /** * Bulk operation result */ export interface BulkOperationResult { success: number; failed: number; errors: Array<{ id: string; error: string; }>; } /** * Memory statistics */ export interface MemoryStatistics { totalEntries: number; activeEntries: number; archivedEntries: number; deletedEntries: number; totalSize: number; entriesByNamespace: Record; entriesByType: Record; averageAccessCount: number; hottestEntries: string[]; coldestEntries: string[]; } /** * Memory Repository Interface * * Defines all operations for memory persistence. * Implementations can use SQLite, AgentDB, or hybrid backends. */ export interface IMemoryRepository { save(entry: MemoryEntry): Promise; findById(id: string): Promise; findByKey(namespace: string, key: string): Promise; findByCompositeKey(compositeKey: string): Promise; delete(id: string): Promise; exists(id: string): Promise; saveMany(entries: MemoryEntry[]): Promise; findByIds(ids: string[]): Promise; deleteMany(ids: string[]): Promise; findAll(options?: MemoryQueryOptions): Promise; findByNamespace(namespace: string, options?: Omit): Promise; findByType(type: MemoryType, options?: Omit): Promise; findByStatus(status: MemoryStatus, options?: Omit): Promise; searchByVector(options: VectorSearchOptions): Promise; findSimilar(entryId: string, limit?: number): Promise; findExpired(): Promise; deleteExpired(): Promise; findCold(milliseconds: number): Promise; archiveCold(milliseconds: number): Promise; getStatistics(): Promise; count(options?: MemoryQueryOptions): Promise; listNamespaces(): Promise; deleteNamespace(namespace: string): Promise; getNamespaceSize(namespace: string): Promise; initialize(): Promise; shutdown(): Promise; clear(): Promise; } //# sourceMappingURL=memory-repository.interface.d.ts.map