A running sandbox can be suspended and reconstructed on demand. Nothing keeps
running in between, so there is no daemon and no background process to manage.
Only the memory pages that changed since boot are written, which keeps a delta
at a couple of megabytes rather than the size of the snapshot.
The delta is bytes, not a location
This is the one place the TypeScript SDK deliberately differs from the Python
one. A browser tab has nowhere to put a file, so suspend() hands you the state
and lets you decide where it goes. For a hosted app that is usually your own
backend.
Letting the browser hold it
In a browser you can skip the round trip and keep the delta in origin-private
storage:
This is what makes an export MARKER=1, a refresh, and an echo $MARKER that
still answers work in a single tab.
Managing instances
sandbox.close() shuts down a running sandbox and leaves suspended instances
alone. Use Sandbox.destroy(id) to remove one, or
snapshots.clear({ instances: true }) to drop them all.
A delta only resumes against the snapshot it was taken from. snapshotId is
recorded for exactly that reason, so keep it with the bytes if you store them
yourself.