UNPKG

crewai-ts

Version:

TypeScript port of crewAI for agent-based workflows

105 lines 2.54 kB
/** * SQLiteStorageAdapter * * A SQLite-based implementation of the StorageAdapter interface * Optimized for efficient local persistence with high performance */ import { BaseStorageAdapter, StorageAdapterOptions } from './StorageAdapter.js'; /** * SQLiteStorageAdapter Options */ export interface SQLiteStorageOptions extends StorageAdapterOptions { /** * Path to SQLite database file */ dbPath: string; /** * Schema version for automatic migrations */ schemaVersion?: number; /** * Enable WAL mode for better performance */ enableWAL?: boolean; /** * Enable query caching for better performance */ enableQueryCache?: boolean; /** * Cache size in memory items */ cacheSize?: number; } /** * SQLiteStorageAdapter implements the StorageAdapter interface * using SQLite for efficient and durable storage * * Note: This implementation requires the 'better-sqlite3' package * npm install better-sqlite3 */ export declare class SQLiteStorageAdapter extends BaseStorageAdapter { private db; private statements; private cache; private cacheSize; private initialized; private addCacheMutex; constructor(options: SQLiteStorageOptions); /** * Set up the database schema */ private setupDatabase; /** * Prepare common SQL statements */ private prepareStatements; /** * Migrate database schema */ private migrateSchema; /** * Ensure database is initialized */ private ensureInitialized; /** * Add an item to the cache with LRU eviction */ private addToCache; /** * Save a value with transaction support */ save(key: string, value: any): Promise<void>; /** * Load a value with caching */ load(key: string): Promise<any | null>; /** * Delete a value with proper cleanup */ delete(key: string): Promise<boolean>; /** * Clear all values for the current namespace */ clear(): Promise<void>; /** * Get all keys with namespace and expiration handling */ keys(): Promise<string[]>; /** * Close the database connection */ close(): Promise<void>; /** * Run vacuum to optimize database */ optimize(): Promise<void>; /** * Get storage statistics */ getStats(): { itemCount: number; cacheSize: number; dbSize: number; }; } //# sourceMappingURL=SQLiteStorageAdapter.d.ts.map