/** * Database Module - Exports for persistence layer * * Usage (Python-like simplicity): * import { db } from 'praisonai'; * * const agent = new Agent({ * instructions: "You are helpful", * db: db("sqlite:./data.db"), // URL-style string, persists to a file * sessionId: "my-session" * }); * * What is durable today: * - db("sqlite:./data.db") persists to disk and survives the process * - db("sqlite::memory:") real SQLite, but process-local * - db("memory:") in-process Maps, lost when the process exits * * postgres:// and redis:// still throw -- see createDbAdapter below. */ export * from './types'; export { MemoryDbAdapter } from './memory-adapter'; export { SqliteDbAdapter, createSqliteDbAdapter, SQLITE_SCHEMA_VERSION, } from './sqlite-adapter'; export type { SqliteDbAdapterOptions, SqliteDriver, SqliteDriverName, SqliteConnection, SqliteStatement, } from './sqlite-adapter'; import type { DbAdapter, DbConfig } from './types'; /** * Create a database adapter based on configuration */ export declare function createDbAdapter(config: DbConfig): DbAdapter; /** * Get or create the default database adapter */ export declare function getDefaultDbAdapter(): DbAdapter; /** * Set the default database adapter */ export declare function setDefaultDbAdapter(adapter: DbAdapter): void; /** * Factory function for creating a database adapter * * Accepts either: * - URL string: db("sqlite:./data.db"), db("memory:") * - Config object: db({ type: 'sqlite', path: './data.db' }) * * Examples: * db("sqlite:./data.db") // SQLite file -- durable, survives restarts * db("sqlite::memory:") // real SQLite, process-local * db("memory:") // in-process Maps (default), lost on exit * db() // same as db("memory:") * * Not yet implemented -- these parse, then throw with the reason: * db("postgres://localhost/mydb") // throws: transport is Neon-HTTP only * db("redis://localhost:6379") // throws: transport is Upstash-REST only * * The returned adapter connects lazily, so a sqlite URL is cheap to build and * any driver problem surfaces on the first read or write -- as a rejection, * never as a silent fall back to memory. */ export declare function db(configOrUrl?: string | DbConfig): DbAdapter;