/** * PostgreSQL Database Adapter * For persistent storage of sessions, messages, and runs */ export interface PostgresConfig { connectionString?: string; host?: string; port?: number; database?: string; user?: string; password?: string; ssl?: boolean; } export interface PostgresAdapter { query(sql: string, params?: any[]): Promise; execute(sql: string, params?: any[]): Promise<{ rowCount: number; }>; transaction(fn: (client: PostgresAdapter) => Promise): Promise; connect(): Promise; disconnect(): Promise; isConnected(): boolean; } /** * PostgreSQL Adapter using pg-compatible REST APIs (like Neon, Supabase) */ export declare class NeonPostgresAdapter implements PostgresAdapter { private connectionString; private connected; constructor(config: PostgresConfig); query(sql: string, params?: any[]): Promise; execute(sql: string, params?: any[]): Promise<{ rowCount: number; }>; transaction(fn: (client: PostgresAdapter) => Promise): Promise; connect(): Promise; disconnect(): Promise; isConnected(): boolean; } /** * In-memory PostgreSQL-like adapter for testing */ export declare class MemoryPostgresAdapter implements PostgresAdapter { private tables; private connected; query(sql: string, params?: any[]): Promise; private handleSelect; private handleInsert; private handleUpdate; private handleDelete; private handleCreateTable; execute(sql: string, params?: any[]): Promise<{ rowCount: number; }>; transaction(fn: (client: PostgresAdapter) => Promise): Promise; connect(): Promise; disconnect(): Promise; isConnected(): boolean; getTable(name: string): any[]; } /** * PostgreSQL Session Storage */ export declare class PostgresSessionStorage { private db; private tableName; private initialized; constructor(db: PostgresAdapter, tableName?: string); init(): Promise; createSession(id: string, data?: Record): Promise; getSession(id: string): Promise | null>; updateSession(id: string, data: Record): Promise; deleteSession(id: string): Promise; addMessage(sessionId: string, message: { id: string; role: string; content: string; toolCalls?: any; }): Promise; getMessages(sessionId: string, limit?: number): Promise; } export declare function createNeonPostgres(config: PostgresConfig): NeonPostgresAdapter; export declare function createMemoryPostgres(): MemoryPostgresAdapter; export declare function createPostgresSessionStorage(db: PostgresAdapter, tableName?: string): PostgresSessionStorage;