pi-mono/packages/session-backends/sqlite-node
2026-08-14 13:58:16 +02:00
..
scripts fix(sqlite): ENOENT, copy migs into dist 2026-08-13 14:26:09 +02:00
src feat(sqlite): wire repo to return real session 2026-08-14 13:58:16 +02:00
test feat(sqlite): wire repo to return real session 2026-08-14 13:58:16 +02:00
CHANGELOG.md Add [Unreleased] section for next cycle 2026-08-14 12:00:04 +02:00
package.json Merge remote-tracking branch 'origin/main' into dev 2026-08-14 10:25:49 +00:00
README.md refactor: search (#7797) 2026-08-11 13:27:48 +02:00
tsconfig.build.json chore: rename storage package to session-backends 2026-08-05 09:28:44 +02:00
vitest.config.ts feat(agent): add SQLite storage conformance coverage 2026-08-14 10:50:23 +02:00

@earendil-works/pi-session-backend-sqlite-node

Node sqlite session backend for @earendil-works/pi-agent-core sessions. Provides the node:sqlite adapter (SqliteDatabase implementation), SQLite session repository, migrations, materialized views, and optional FTS search.

await using repository = new SqliteSessionRepository(options);
const search = createSqliteSessionSearch(options);
const session = await repository.create({ cwd });
await session.appendMessage(message);

const hits = [];
for await (const hit of search.search("needle")) hits.push(hit);

The repository lazily owns one shared database connection. Search is an independent service over the same canonical database: repositories do not expose search(). The FTS table and triggers are created lazily on the first non-blank search; when FTS is first created, search performs a one-time rebuild from canonical entries. After that, SQLite triggers keep FTS in sync with canonical entry inserts, deletes, and payload updates.