import type { TelescopeEntry, TelescopeStorage, ListOptions, EntryType } from './types.js'; export declare function createEntry(type: EntryType, content: Record, options?: { batchId?: string; tags?: string[]; familyHash?: string; }): TelescopeEntry; export declare class MemoryStorage implements TelescopeStorage { private readonly maxEntries; private entries; constructor(maxEntries?: number); store(entry: TelescopeEntry): void; storeBatch(entries: TelescopeEntry[]): void; list(options: ListOptions): TelescopeEntry[]; find(id: string): TelescopeEntry | null; count(type?: EntryType): number; prune(type?: EntryType): void; pruneOlderThan(date: Date): void; } /** * SQLite-backed telescope storage — persistent across restarts, shared * across the dev server and CLI processes. * * **Peer resolution** — `better-sqlite3` is loaded via * `createRequire(import.meta.url)` rather than a top-level `import`. * Two reasons: * 1. better-sqlite3 ships native bindings; bundlers (Vite SSR, Webpack, * esbuild) can't statically resolve them. createRequire pushes the * lookup to runtime where Node's loader handles `.node` files. * 2. Telescope's package.json lists `better-sqlite3` under * `optionalDependencies`. Apps that pick `storage: 'memory'` never * need it; we shouldn't force its install. * * The `globalThis.__betterSqlite3` escape hatch is for bundled * environments where `createRequire` can't reach the module (e.g. when * telescope is pre-bundled into a single file). Pre-stash the module * there and the loader will pick it up. If neither path resolves, the * constructor throws loudly — it does NOT silently fall back to memory. * * **WAL mode** — enabled in `migrate()`. Without it, `pnpm rudder ...` * commands hit "database is locked" while `pnpm dev` is running. WAL * (Write-Ahead Logging) lets the dev server and CLI processes read/write * concurrently. `synchronous = NORMAL` is paired with WAL for the * standard "durable on commit, fast on crash recovery" tradeoff. */ export declare class SqliteStorage implements TelescopeStorage { private readonly dbPath; private db; constructor(dbPath: string); private getDb; private migrate; private toRow; private fromRow; store(entry: TelescopeEntry): void; storeBatch(entries: TelescopeEntry[]): void; list(options: ListOptions): TelescopeEntry[]; find(id: string): TelescopeEntry | null; count(type?: EntryType): number; prune(type?: EntryType): void; pruneOlderThan(date: Date): void; } //# sourceMappingURL=storage.d.ts.map