group:member, or artifact path.
Use ctx.snapshots.get(name) for a history and ctx.checkpoints.get(id) for one checkpoint. Both collections retain the selected provider. Cloud supports individual disk checkpoints. Spawning from an exact remote checkpoint requires a managed ID. An explicit host-volume path restore selects the contents currently at that path.
Sandbox capture
sandbox.snapshot()
Sandbox; an existing group is refused.
sandbox.snapshotWith()
Example
Example
Snapshot are now accessed through Checkpoint. Existing Checkpoint, builder, archive, ID, and verification type names remain; this public object rename does not rewrite persisted artifact IDs. Retained artifact helpers below also cover supported cloud workflows, where local group operations return unsupported.
Snapshot group methods
Snapshot.open()
get (Get in Go) to select a bare group name from the default store.
Snapshot.get()
Snapshot.list()
group.name
group.head()
null after explicit clearing.
group.checkpoints()
group.getCheckpoint()
group.setHead()
group.clearHead()
group.checkpoint()
group.checkpointWith()
group.spawnSandbox()
group.spawnSandboxWith()
group.spawnSandboxWithProgress()
progress or iterate the returned object. Call awaitSandbox() for authoritative completion; stream exhaustion is not success. cancel() requests cancellation.
group.spawnSandboxWithProgressWith()
awaitSandbox() even when progress is ignored or cancellation was requested.
Snapshot.groupHead()
head() or setHead(member); new code should not use a combined selector to mutate selection.
Save an exact checkpoint
Example
Example
.msb archive. saveTo retains its explicit options form for compatibility. See the archive compatibility option below before sending output to an older reader.
Group archive import
Snapshot.load()
Snapshot.loadWith()
Example
Example
files is string[]. Returns SnapshotImportResult: snapshot, checkpoints, added, reused, headUpdate, operationId, and warnings.
The result contains every unique supplied checkpoint, including bundled dependencies, in stable ID order. added and reused identify what was new versus already installed at publication; archive argument order does not select the head. The head outcome belongs to this operation and does not change when another operation edits the group. Multiple incomparable tips can commit a headless group; explicit head selection refuses ambiguous tips.
A successful return confirms publication and catalog completion. Warnings describe deferred cleanup after commit. A structured import error distinguishes no publication, confirmed publication with a later failure, and an unknown outcome needing recovery. Import never binds a group to a source sandbox. See atomic import requirements for filesystem capabilities and maintenance requirements.
Group inspection
group.inspect()
checkpointCount, source.recordedName, source.currentName, source.databaseUuid, source.sandboxId. The source is absent for an unbound history; otherwise its status is available, missing_sandbox or different_catalog. Saved and current names distinguish renames; identity is the catalog UUID plus sandbox row ID, so deleting and recreating the same name does not rebind the group.
Source availability is observed separately from group metadata and is not a guarantee of later capture readiness. Inspection does not change the selected head or create a missing catalog identity. Invalid metadata and database failures remain errors, rather than being reported as unbound. Obtain a member with getCheckpoint for its immutable metadata.
Group verification
group.verify()
await (await Snapshot.get("worker")).verify() checks every pinned member and returns SnapshotGroupVerifyReport: group, state, checkpoints, and payloadHashes. States are complete, incomplete, invalid, or empty; an empty group explicitly means zero checkpoints checked. Each member has id, path, state, report (the existing SnapshotVerifyReport, or null), and specific findings. Shared physical files are hashed once per algorithm; independent copies are checked separately. Headless groups can be verified. To verify only head, obtain the optional checkpoint with head() and call its verify().
Unrecorded checksums produce incomplete coverage. Corruption, missing files, unsupported requirements, and operational failures reject with SnapshotVerificationError, whose report retains all selected members and findings. Errors before a meaningful group report exists retain their ordinary error type. Cancellation does not release reader protection while hashing continues.
Selected members remain protected through hashing, including cancellation. Same-group captures, imports and head changes wait until verification finishes. Concurrent older removers must be stopped or upgraded; reads and sandbox execution can continue.
Whole-group removal
group.remove()
SnapshotRemoveResult with group, removed, headUpdate, and warnings. The member IDs and cleared-head outcome belong to this operation. Empty groups can be removed. Active readers and surviving external dependents refuse removal; there is no force bypass for an entire group.
If publication commits but catalog cleanup fails, the call rejects with SnapshotGroupRemovalRecoveryError with result and detail. The attached result means removal already happened. Cleanup warnings after successful catalog reconciliation are returned in the result. An uncertain durability outcome is an error requiring recovery rather than a claimed successful removal. Later listing recovers pending cleanup without deleting a replacement group.
Exact checkpoint removal
Example
Example
CheckpointRemoveResult with id, optional headUpdate, and warnings. The head outcome belongs to this operation; later head edits do not change it. Removing the head selects its surviving same-group parent or clears selection. Removing another member reports an unchanged head. Standalone artifacts have no head outcome.
Force permits removal despite indexed children, but never bypasses reader protection. A repeated removal reports a missing checkpoint rather than fabricating another successful result. Backends or native libraries without exact-removal reporting return unsupported instead of falling back to deletion by name.
If removal commits but catalog cleanup fails, the call rejects with SnapshotRemovalRecoveryError, with result and detail. Its result is authoritative: removal already happened. Recover the affected storage before retrying cleanup; do not assume an error means the checkpoint still exists.
Group options and results
SnapshotCaptureOptions
options.name()
options.initialCheckpoint()
name, intended for the first capture.
options.destDir()
options.full()
options.recordIntegrity()
options.guestFlush()
"auto"; see guest writeback.
options.label()
SnapshotLoadOptions
options.base()
options.destDir()
options.maximumDiskBytes()
LoadOpts accepts the same maximumDiskBytes property.
options.setHead()
SnapshotCreateResult
snapshotSnapshotThe newly created group.
checkpointCheckpointThe exact first checkpoint created by this call.
headUpdateHeadUpdateHead outcome from this operation; later selection changes do not alter it. See head outcomes.
CheckpointCaptureResult
checkpointCheckpointThe exact checkpoint created by this append.
headUpdateHeadUpdateHead outcome from this operation; later selection changes do not alter it. See head outcomes.
SnapshotImportResult
operationIdstringIdentifier of this import attempt.
snapshotSnapshotThe destination group.
checkpointsCheckpoint[]All unique supplied members, including bundled dependencies, in stable ID order.
addedstring[]Stable IDs newly installed by this operation.
reusedstring[]Stable IDs already installed at publication.
headUpdateHeadUpdateHead outcome from this operation; later selection changes do not alter it. See head outcomes.
warningsstring[]Cleanup warnings after confirmed publication and catalog completion; empty when none.
HeadUpdate
groupstringGroup name.
previousstring | nullPrevious selected member ID; absent when headless.
headstring | nullResulting selected member ID; absent after clearing or a headless import.
reasonstringSelection reason: initialized, fast_forwarded, selected, unchanged, diverged, unknown_ancestry, ambiguous_candidates, cleared or parent_selected.
changedbooleanWhether this operation changed the selected head.
Capture recovery
A failed capture can still have published its requested artifact before source recovery failed.SnapshotSourceRecoveryError preserves the source checkpoint recovery locator and, when publication completed, the published artifact’s kind, path, identity, digest and headUpdate. The head outcome belongs to that publication even if another operation changes the group afterward. Archive-only capture and older producers omit it; do not infer it by reading the current head. Inspect those details before retrying or removing the source. The error does not prove that the source is running or safely paused.
Guest writeback
Use.guestFlush("required") on snapshot builders or { guestFlush: "required" } in source.fork, source.forkMany, and source.pause options.
The default "auto" flushes live disk-only captures, but adds no optional flush to full captures, forks, or pause. "skip" retains mandatory storage barriers.
A paused disk capture needs a matching prior flush; cloud rejects non-Auto policies. See guest flush policy reference.
Checkpoint
A snapshot retains the backend that created or opened it.Static methods
Checkpoint.builder()
fromSandbox(); see SnapshotBuilder for options.
Parameters
namestringMember name within its group; generated when omitted.
Returns
Builder for configuring the snapshot.
Example
Example
builder.createArchive()
Example
Example
Checkpoint.open()
Example
Example
group:member, or path. Cheap metadata validation only; it does not read the upper file. Use verify() for content checks.
Parameters
pathOrNamestringGroup head or
group:member selector or filesystem path.Returns
The opened snapshot.
Checkpoint.get()
Example
Example
Checkpoint.
Parameters
nameOrDigeststringPublic identifier understood by the active backend, such as a local name/digest or cloud snapshot ID.
Returns
Operational snapshot with metadata loaded on demand.
Checkpoint.list()
Example
Example
Returns
All indexed snapshot resources.
Checkpoint.listDir()
UnsupportedError.
Parameters
dirstringDirectory to scan for artifact subdirectories.
Returns
Parsed snapshots found in the directory.
Checkpoint.remove()
Example
Example
force is set. A group’s head cannot be removed while other members remain, even with force; select another head first.
Parameters
pathOrNamestringGroup head,
group:member, unambiguous snapshot ID or digest, or artifact path.opts.forcebooleanRemove even if the snapshot has indexed children. Defaults to
false.Checkpoint.reindex()
Example
Example
UnsupportedError.
Parameters
dirstringDirectory to scan. Defaults to the configured snapshots dir.
Returns
Promise<number>
Count of artifacts indexed.
Checkpoint.save()
.msb archive. The recorded manifest is archived as-is, so create the snapshot with recordIntegrity() if receivers must verify content. See SaveOpts for bundling options.
Parameters
nameOrPathstringGroup head,
group:member, or artifact path to bundle.outstringOutput archive path.
optsSaveOptsBundling options. All fields default to
false.Example
Example
Checkpoint.load()
.msb or .tar) into the snapshots directory. Structural and archive-entry checks run during import; recorded payload integrity is preserved for explicit verify(). Compression is detected from magic bytes.
Parameters
archivestringPath to the archive to unpack.
deststringDestination directory. Defaults to the snapshots directory.
Returns
Handle to the loaded snapshot.
Example
Example
Checkpoint.loadWithOptions()
Checkpoint.loadMany()
Checkpoint.groupHead()
Import options
Options forLoadOpts.
With divergent tips, the existing head stays selected; a new group has no head. Select a member explicitly. Identical members may be reused; conflicting identities fail. See archive imports.
Sandbox
handle.checkpoint()
Sandbox. Local live disk captures preserve the source’s running or paused state. Cloud requires a stopped persistent source. Use the returned artifact path or sandbox:member to open it later.
Parameters
namestringMember name within the source sandbox’s group.
Returns
The created snapshot artifact.
Example
Example
Checkpoint instance members
snap.state()
snap.manifest()
state() uses one descriptor observation; neither method silently returns cached data.
snap.id
string
Stable opaque snap_... identity, separate from the descriptor digest.
snap.path
string
Local artifact directory. Throws UnsupportedError for cloud snapshots; use the snapshot object or its typed reference for backend-neutral operations.
snap.reference
string
Stable backend-relative value. Pass the snapshot object to Sandbox.restore(snapshot) to preserve both this value and its reference kind.
snap.referenceKind
"id" \| "path"
How the selected backend resolves reference. Most callers can pass the snapshot object directly and never inspect this value.
snap.digest
string
Canonical descriptor digest (sha256:hex), separate from the stable snapshot ID.
snap.sizeBytes
bigint \| null
Backend-reported stored payload size in bytes, or null when unavailable.
snap.imageRef
string
Image reference the snapshot was taken from.
snap.imageManifestDigest()
snap.format
"raw" \| "qcow2" \| null
On-disk format of the upper layer.
snap.scope
SnapshotScope
Checkpoint scope: "disk" for a disk-only snapshot or "full" for disk plus VM execution state. See SnapshotScope.
snap.fstype
string \| null
Filesystem type inside the upper (e.g. "ext4").
snap.parent
string \| null
Manifest digest of the parent snapshot, or null for a root.
snap.createdAt
string
RFC 3339 timestamp when the snapshot was created.
snap.labels()
labels(): Promise<ReadonlyArray<readonly [string, string]>>
User-supplied labels (sorted by key in canonical form), as [key, value] pairs.
snap.sourceSandbox()
null when the manifest has no source recorded.
snap.saveTo()
UnsupportedError.
Example
Example
snap.copyTo()
UnsupportedError when save() is awaited.
Example
Example
snap.verify()
Example
Example
report.checkpoint.
Returns
Verification result.
snap.name
string \| null
Member name within its group, or null when no alias is recorded.
snap.destroy()
Unsupported until the provider supports atomic conditional deletion. Explicit path-selected static removal remains available. Managed remote snapshot deletion uses its captured server ID; local deletion retains its identity checks. Force does not bypass this restriction.
Remove this installed snapshot copy and its index row using the handle’s stored artifact path. Other groups containing the same snapshot ID or digest remain unchanged. Refuses if the snapshot has indexed children unless force is set.
Example
Example
SnapshotBuilder
Fluent builder for a snapshot, returned byCheckpoint.builder(name). Every setter mutates in place and returns this, so calls chain. The source sandbox is required: call .fromSandbox() before .create().
.fromSandbox()
.create() fails without it.
Parameters
sourceSandboxstringName of the source sandbox. Local disk capture supports running, paused, stopped, and crashed sources. Cloud requires a stopped persistent source.
.group()
.destDir()
Parameters
destDirstringParent directory to create the artifact in (e.g. a larger volume).
.label()
key=value label to the snapshot manifest. May be called repeatedly.
Parameters
keystringLabel key.
valuestringLabel value.
.force()
.recordIntegrity()
snapshot.full()
.guestFlush()
"auto". See SDK usage.
.create()
Example
Example
Returns
The created snapshot artifact.
SnapshotCopyBuilder
Returned bysnapshot.copyTo(). Each setter mutates the builder
and returns this.
Forking
Fork a running or paused local sandbox to create a child with copy-on-write memory. The source returns to its previous state, and each child needs an unused name.Sandbox has the same methods. See the forking guide for backend limits and disk bindings.
fork()
Example
Example
forkMany()
Example
Example
name and either a started sandbox or an error. Validation or capture errors reject the whole call; a child startup error leaves successful siblings running. Stop successful children when finished.
ForkOptions
recordIntegrity records disk hashes. guestFlush defaults to "auto". Each volumes key is a captured disk’s guest path; its callback configures the replacement mount. Forks cannot add new block devices, and batch children cannot share a writable disk image. See fork disk bindings. branch(), branchMany(), and BranchOutcome remain deprecated aliases.
RestoreBuilder
Restore into a new detached sandbox. Disk boots fresh; full resumes execution. See restore examples and progress.Example
Example
restore.cowMemory()
restore.forked()
restore.diskOnly()
restore.snapshotBase()
restore.restore()
restore.restoreWithProgress()
awaitSandbox() for the sandbox.
restore.init()
"auto". Full-memory resume rejects an explicit choice, including "auto"; use diskOnly() for a new boot. Available on group and checkpoint spawn callbacks, including progress variants.
restore.initWith()
restore.hostname()
allowMissingResources() to resume with unavailable devices (full restore records warnings). This is separate from strict/relaxed validation of supplied mappings; inheritance does not waive missing backing. Root and owned storage remain required.
restore.cpus()
restore.memory()
restore.maxCpus()
restore.maxMemory()
Destination command defaults
Useworkdir, shell, entrypoint, cmd, env and envs to configure new commands in the destination. They work for disk boots and full resumes without changing captured processes or starting a workload during restoration. An explicit empty entrypoint or CMD clears that default; omission keeps existing resolution. Environment defaults combine with per-command overrides through the ordinary SDK rules. Guest working directories must exist. These are explicit destination settings, not automatically saved snapshot configuration. Unsupported native bindings reject new explicit options before dispatch.
restore.label()
restore.labels()
restore.networkPolicy()
restore.pullPolicy()
if-missing and explicit never can use complete local/archive content offline. always revalidates that exact digest through its registry, even when cached, and fails if the registry cannot provide it. This never follows the original mutable tag or changes the source snapshot. Explicit use requires an updated native binding and is refused before dispatch when unsupported.
restore.proxy()
restore.maxConnections()
restore.disableNetwork()
restore.security()
restore.maxDuration()
restore.idleTimeout()
restore.guestClock()
restore.port()
restore.portBind()
restore.portUdp()
restore.portUdpBind()
restore.vsock()
restore.vsockDgram()
restore.user()
restore.logLevel()
restore.dangerouslyInheritResources()
restore.externalMountPolicy()
NetworkPolicy or NetworkPolicyBuilder. Use v => v.captured() for a private captured volume.
Full capture records the source clock policy; current disk capture does not. An explicit sync policy overrides a saved off policy. The same option is available on group and checkpoint spawn, including progress variants. Clock selection controls guest wall-clock synchronization. Unsupported native SDKs or runtimes refuse unsupported explicit selection before launching the destination.
restore.volume()
v => v.captured() to select its captured private volume.
Example
Example
restore.allowMissingResources()
Compaction
Compact a local sandbox’s root or owned disks. See compaction for examples and recovery requirements.diskSelect one owned disk by guest path;
/ selects the root.rootDiskOnlySelect only the root. Cannot combine with the disk selector.
layersOldest sealed layers to merge, including the base. Minimum two; omit for all. Excludes the writable layer.
dryRunPreview without changing storage.
guestPath. materializedBytes counts copied bytes, not reclaimed space. Times are microseconds: per-disk totalUs covers preparation; aggregate totalUs also includes switching; pauseUs measures the shared VM pause.
Types
SaveOpts interface
Bundle options forCheckpoint.save() and instance saveTo() methods. Boolean fields default to false; selective-export fields are omitted by default.
compatibility”current” | “0.7.8”Defaults to
“current”; explicit targets require a native library advertising supportsincestringOmit disk layers and RAM objects supplied by an exact base; incompatible with
lastLayers and withParents.lastLayersnumberInclude the newest N sealed root-disk layers; owned disks and full execution state remain complete.
withParentsbooleanWalk the parent chain and include each ancestor in the archive.
withImagebooleanInclude the OCI image cache so the archive boots offline.
plainTarbooleanSkip zstd compression and write a plain
.tar.SnapshotScope type
Scope of what a snapshot captures:"disk" for filesystem state or "full" for disk plus VM execution state.
SnapshotVerifyReport union
Result ofsnap.verify(). Checkpoint snapshots add checkpoint: { kind: "verified", root: string }; the existing upper projection stays intact for disk-snapshot compatibility.
digeststringCheckpoint’s manifest digest.
pathstringArtifact directory path.
coverageSnapshotVerifyCoveragecomplete, incomplete with unrecorded paths, or unknown on older native libraries.upper.kind”notRecorded” | “verified”Whether an integrity hash was recorded and checked.
upper.algorithmstringHash algorithm (
“verified” only).checkpoint{ kind: “verified”; root: string }Verified checkpoint closure identity when state is full.
upper.digeststringRecomputed upper-layer digest (
“verified” only).