trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
43 lines • 1.46 kB
TypeScript
/**
* SQLite-backed Kernel Backend
*
* Replaces the P0 JsonOpLog with a proper WAL-mode SQLite database.
* Stores ops, snapshots, and blobs in a single database file.
*
* @module trellis/core
*/
import type { KernelOp, KernelBackend } from './backend.js';
export declare class SqliteKernelBackend implements KernelBackend {
private dbPath;
private db;
private _stmts;
constructor(dbPath: string);
init(): void;
private _prepareStatements;
append(op: KernelOp): void;
appendBatch(ops: KernelOp[]): void;
readAll(): KernelOp[];
readUntil(hash: string): KernelOp[];
readAfter(hash: string): KernelOp[];
readUntilTimestamp(isoTimestamp: string): KernelOp[];
getLastOp(): KernelOp | undefined;
getByHash(hash: string): KernelOp | undefined;
getOpCount(): number;
getOpByHash(hash: string): KernelOp | undefined;
count(): number;
/**
* Find the common ancestor op of two op hashes by walking
* previousHash chains until they converge.
*/
findCommonAncestor(hashA: string, hashB: string): KernelOp | undefined;
saveSnapshot(lastOpHash: string, data: any): void;
loadLatestSnapshot(): {
lastOpHash: string;
data: any;
} | undefined;
putBlob(hash: string, content: Uint8Array): void;
getBlob(hash: string): Uint8Array | undefined;
hasBlob(hash: string): boolean;
close(): void;
}
//# sourceMappingURL=sqlite-backend.d.ts.map