import type { MemoryEntry, MemorySummary } from "../types.ts"; import { type MemorySearchOptions } from "./search.ts"; export interface MemoryListOptions { scope?: string; category?: string; limit?: number; sort?: "recent" | "relevance" | "accessed"; minRelevance?: string; } export type { MemorySearchOptions } from "./search.ts"; export declare class MemoryStore { private db; private constructor(); /** * Async factory: resolve the runtime driver (Bun or Node), open the * database, and run schema migration. */ static create(workspaceDir: string): Promise; private ensureSchema; /** * Write a new memory entry. Generates the ID from title + timestamp, * sets timestamps, and inserts atomically. Returns the new ID. */ write(entry: Omit): string; /** * Read a memory entry by ID. Returns null if not found. * Parses `tags` and `source_sessions` from JSON strings to arrays. */ read(id: string): MemoryEntry | null; /** * Update an existing memory entry. Only the provided fields are changed. * Automatically sets `updated_at` to the current time. * Serializes `tags` and `source_sessions` to JSON strings if present. */ update(id: string, fields: Partial): void; /** * Delete a memory entry by ID. The AFTER DELETE trigger cleans up the FTS index. */ delete(id: string): void; /** * List memory summaries with optional filters. * Returns only summary fields (id, title, category, relevance, updated_at). */ list(options?: MemoryListOptions): MemorySummary[]; /** * Full-text search across memories using FTS5 MATCH. * Returns full MemoryEntry[] ranked by relevance. * Supports optional scope and category filtering. */ search(options: MemorySearchOptions): MemoryEntry[]; /** * Update the accessed_at timestamp and increment access_count for a memory. * Called when a memory is recalled via search or direct read. */ touch(id: string): void; /** * Return aggregated statistics about the memory store. */ stats(): { total: number; byScope: Record; byCategory: Record; byRelevance: Record; }; /** * Close the database connection. Call when the store is no longer needed. */ close(): void; } //# sourceMappingURL=store.d.ts.map