import { SqliteConnection } from "./connection.js"; import { Checkpoint, CheckpointId, CheckpointMetadata, CheckpointPutOptions, CheckpointStoreExt, CheckpointTuple, ListOptions, PendingWrite, PruneThreadsOptions } from "@graphorin/core/contracts"; //#region src/checkpoint-store.d.ts /** * Default `CheckpointStore` implementation (including the * `CheckpointStoreExt` retention primitives). Workflow state is * encoded as JSON blobs; per-task pending writes survive partial step * failure. * * @stable */ declare class SqliteCheckpointStore implements CheckpointStoreExt { #private; constructor(conn: SqliteConnection); put(threadId: string, namespace: string, checkpoint: Checkpoint, metadata: CheckpointMetadata, opts?: CheckpointPutOptions): Promise; putWrites(threadId: string, namespace: string, checkpointId: CheckpointId, writes: ReadonlyArray, taskId: string): Promise; getTuple(threadId: string, namespace: string, checkpointId?: CheckpointId): Promise; /** * Enumerate threads whose LATEST checkpoint in `namespace` is * suspended with a due `wake_at`. Latest-per-thread is decided by max * step_number (the same policy as `getTuple`), so a thread whose * newest checkpoint moved on (resumed / completed) never fires. */ listSuspended(namespace: string, opts?: { readonly dueBefore?: number; readonly limit?: number; }): Promise>; list(threadId: string, namespace: string, opts?: ListOptions): AsyncIterable; deleteThread(threadId: string): Promise; /** * Retention sweep. Policy: a `(thread_id, namespace)` pair * qualifies when its LATEST checkpoint (by step_number) is older than * the cutoff and - unless `onlyTerminal: false` - terminal * ('completed' / 'failed' / 'aborted'); suspended pairs hold live * HITL approvals / awakeables and are protected by default. * * CRITICAL: never delegates to `deleteThread` - that primitive is * namespace-blind, and with a reused threadId (e.g. a sessionId used * by two workflows) pruning workflow A's terminal thread would erase * workflow B's suspended checkpoints, breaking the onlyTerminal * guarantee. Each qualifying pair is deleted with namespace-scoped * statements in its own transaction so a long sweep never holds the * writer lock across the whole table. */ pruneThreads(opts: PruneThreadsOptions): Promise; /** * Compaction: keep only the `keepLast` newest checkpoints (by * step_number) of one `(thread_id, namespace)` pair. Resume reads the * latest tuple, so `keepLast >= 1` never breaks resumability; the * oldest surviving checkpoint's parent_id may point at a deleted row, * which getTuple/list never resolve and the CAS compares only the * latest id - safe, but time-travel/fork targets are gone. */ compactThread(threadId: string, namespace: string, keepLast: number): Promise; } //#endregion export { SqliteCheckpointStore }; //# sourceMappingURL=checkpoint-store.d.ts.map