Skip to content

SnapshotStorage

Defined in: src/session/storage.ts:47

Interface for snapshot persistence. Implementations provide storage backends (S3, filesystem, etc.).

File layout convention:

sessions/<session_id>/
scopes/
agent/<scope_id>/
snapshots/
snapshot_latest.json
immutable_history/
snapshot_<uuid>.json
snapshot_<uuid>.json
saveSnapshot(params): Promise<void>;

Defined in: src/session/storage.ts:51

Persists a snapshot to storage.

ParameterType
params{ location: SnapshotLocation; snapshotId: string; isLatest: boolean; snapshot: Snapshot; }
params.locationSnapshotLocation
params.snapshotIdstring
params.isLatestboolean
params.snapshotSnapshot

Promise<void>


loadSnapshot(params): Promise<Snapshot>;

Defined in: src/session/storage.ts:61

Loads a snapshot from storage.

ParameterType
params{ location: SnapshotLocation; snapshotId?: string; }
params.locationSnapshotLocation
params.snapshotId?string

Promise<Snapshot>


listSnapshotIds(params): Promise<string[]>;

Defined in: src/session/storage.ts:77

Lists all available immutable snapshot IDs for a session scope, sorted chronologically. Snapshot IDs are UUID v7 strings vended by the SDK — callers should treat them as opaque handles and never construct them manually.

Typical pagination pattern:

const page1 = await storage.listSnapshotIds({ location })
const page2 = await storage.listSnapshotIds({ location, startAfter: page1.at(-1) })

limit caps the number of returned IDs. startAfter is an exclusive cursor (the last ID from the previous page); it must be a UUID v7 obtained from a prior listSnapshotIds call.

ParameterType
params{ location: SnapshotLocation; limit?: number; startAfter?: string; }
params.locationSnapshotLocation
params.limit?number
params.startAfter?string

Promise<string[]>


deleteSession(params): Promise<void>;

Defined in: src/session/storage.ts:82

Deletes all snapshots and directories belonging to the session ID.

ParameterType
params{ sessionId: string; }
params.sessionIdstring

Promise<void>


loadManifest(params): Promise<SnapshotManifest>;

Defined in: src/session/storage.ts:87

Loads the snapshot manifest.

ParameterType
params{ location: SnapshotLocation; }
params.locationSnapshotLocation

Promise<SnapshotManifest>


saveManifest(params): Promise<void>;

Defined in: src/session/storage.ts:92

Saves the snapshot manifest.

ParameterType
params{ location: SnapshotLocation; manifest: SnapshotManifest; }
params.locationSnapshotLocation
params.manifestSnapshotManifest

Promise<void>