Session Snapshot
session_snapshotSave, restore, list, or delete session workspace snapshots. Snapshots are stored outside the workspace to prevent tampering, and restore files into a new or existing session.
Instructions
Archive or restore a session's workspace files. action:
"save": tar.gz the session's current files (same rules as session_artifacts: .codecalc-run/ excluded, symlinks/hardlinks refused) into a snapshot stored OUTSIDE the workspace, so sandboxed code can never read or tamper with it. Returns snapshot_id.
"restore": extract snapshot_id's files into a brand-new session (default) or, with replace=True, wipe and recreate session_id's OWN workspace first. Only files are restored — a python3/node session's REPL variables/imports are never part of a snapshot.
"list": snapshots saved for session_id, oldest first.
"delete": remove one snapshot (snapshot_id required).
Snapshots are deleted when their session is stopped (session_stop(keep_snapshots=True) to keep them).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | No | Optional human-readable label to store with a new snapshot; only used by action='save' | |
| action | No | One of 'save', 'restore', 'list', 'delete'; default 'save' archives the workspace | save |
| replace | No | For action='restore', wipe and reuse session_id's own workspace instead of creating a new session | |
| session_id | Yes | Id of the session the snapshot belongs to or is restored into | |
| snapshot_id | No | Id of an existing snapshot; required for action='restore' or action='delete' |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||