mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-18 21:00:49 +00:00
feat: add session persistence examples and SQLite driver
This commit is contained in:
parent
64d1324628
commit
3c2a9cbbbb
14 changed files with 524 additions and 11 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { DatabaseSync } from "node:sqlite";
|
||||
import Database from "better-sqlite3";
|
||||
import type {
|
||||
ListEventsRequest,
|
||||
ListPage,
|
||||
|
|
@ -12,16 +12,13 @@ const DEFAULT_LIST_LIMIT = 100;
|
|||
|
||||
export interface SQLiteSessionPersistDriverOptions {
|
||||
filename?: string;
|
||||
open?: boolean;
|
||||
}
|
||||
|
||||
export class SQLiteSessionPersistDriver implements SessionPersistDriver {
|
||||
private readonly db: DatabaseSync;
|
||||
private readonly db: Database.Database;
|
||||
|
||||
constructor(options: SQLiteSessionPersistDriverOptions = {}) {
|
||||
this.db = new DatabaseSync(options.filename ?? ":memory:", {
|
||||
open: options.open ?? true,
|
||||
});
|
||||
this.db = new Database(options.filename ?? ":memory:");
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue