You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python snapshotting landed in #1298: Bash and BashTool now expose snapshot(), restore_snapshot(), and from_snapshot(...), with docs/tests covering round-trip, reset+restore, empty snapshots, invalid data, and constructor-kwargs preservation.
Node already has snapshot support on Bash (snapshot(), restoreSnapshot(), Bash.fromSnapshot(data, options?)), but BashTool still has no equivalent surface. That leaves the bindings out of parity for stateful agent workflows built on the tool-contract wrapper.
Current gap
crates/bashkit-js/wrapper.ts: Bash has snapshot APIs; BashTool does not
crates/bashkit-js/src/lib.rs: native Bash exposes snapshot APIs; native BashTool does not
fromSnapshot() should follow the same configuration semantics as the constructor/new instance path: build the instance with caller-provided options first, then restore snapshot bytes into that configured instance so limits and identity settings survive.
Acceptance criteria
BashTool.snapshot() returns Uint8Array bytes containing serialized interpreter state
BashTool.restoreSnapshot(data) restores state from bytes produced by snapshot()
BashTool.fromSnapshot(data, options?) creates a new BashTool instance from snapshot bytes
fromSnapshot() preserves constructor options like username, hostname, maxCommands, and maxLoopIterations
Round-trip works: variables, files, and CWD survive snapshot() → fromSnapshot()
restoreSnapshot() after reset() works correctly
Empty snapshot from a fresh instance round-trips correctly
Invalid/corrupted snapshot data throws BashError / JS-visible error, not a panic
Context
Python snapshotting landed in #1298:
BashandBashToolnow exposesnapshot(),restore_snapshot(), andfrom_snapshot(...), with docs/tests covering round-trip, reset+restore, empty snapshots, invalid data, and constructor-kwargs preservation.Node already has snapshot support on
Bash(snapshot(),restoreSnapshot(),Bash.fromSnapshot(data, options?)), butBashToolstill has no equivalent surface. That leaves the bindings out of parity for stateful agent workflows built on the tool-contract wrapper.Current gap
crates/bashkit-js/wrapper.ts:Bashhas snapshot APIs;BashTooldoes notcrates/bashkit-js/src/lib.rs: nativeBashexposes snapshot APIs; nativeBashTooldoes notcrates/bashkit-js/README.md: no snapshot/restore section today, unlike the Python README after feat(python): add snapshot restore support #1298What to implement
Add snapshot/restore support to
BashToolin the JS bindings, mirroring the Python API shape and existing NodeBashbehavior:fromSnapshot()should follow the same configuration semantics as the constructor/new instance path: build the instance with caller-provided options first, then restore snapshot bytes into that configured instance so limits and identity settings survive.Acceptance criteria
BashTool.snapshot()returnsUint8Arraybytes containing serialized interpreter stateBashTool.restoreSnapshot(data)restores state from bytes produced bysnapshot()BashTool.fromSnapshot(data, options?)creates a newBashToolinstance from snapshot bytesfromSnapshot()preserves constructor options likeusername,hostname,maxCommands, andmaxLoopIterationssnapshot()→fromSnapshot()restoreSnapshot()afterreset()works correctlyBashError/ JS-visible error, not a panicBashToolsnapshot round-trip, reset+restore, empty snapshot, and invalid snapshot casescrates/bashkit-js/README.mdgets a Snapshot/Restore section matching current behaviorReference
Bashimplementation:crates/bashkit-js/src/lib.rs,crates/bashkit-js/wrapper.ts