export type SqliteRow = Record; export interface SqliteRunResult { changes: number; lastInsertRowid: number | bigint; } export interface SqliteStatement { get(...params: unknown[]): unknown; all(...params: unknown[]): unknown[]; run(...params: unknown[]): SqliteRunResult; iterate(...params: unknown[]): IterableIterator; } export interface SqliteDatabase { prepare(sql: string): SqliteStatement; exec(sql: string): void; /** Accepts better-sqlite3's forms: `'user_version'` to read, `'foo = bar'` to set. */ pragma(source: string): SqliteRow[]; transaction(fn: (...args: A) => void): (...args: A) => void; close(): void; } export type SqliteDriverName = 'node:sqlite' | 'better-sqlite3'; export interface OpenSqliteOptions { /** Opens without write access, so reading never disturbs the writing process. */ readonly?: boolean; } /** * Which driver this process will use. Reported by `ai-usage status` so a bug * report says which SQLite implementation produced the numbers. */ export declare function sqliteDriver(): SqliteDriverName; export declare function openSqlite(path: string, options?: OpenSqliteOptions): SqliteDatabase;