Skip to content

v0.10.0 — Streaming File I/O & Stateful Sessions

Choose a tag to compare

@clemlesne clemlesne released this 19 Feb 17:54
· 343 commits to main since this release

What's New

Stateful Sessions

New session() API — variables, imports, files, and environment persist across calls.

async with await scheduler.session(language=Language.PYTHON) as session:
    await session.exec("x = 42")
    await session.write_file("data.csv", csv_bytes)
    await session.exec("import pandas; df = pandas.read_csv('data.csv')")
    await session.read_file("result.json", destination=Path("./result.json"))

Persistent REPLs for Python, JavaScript, and Shell. Idle timeout with automatic cleanup.

Streaming File I/O

write_file(), read_file(), list_files() with zstd-compressed 128 KB chunks over virtio-serial.

  • O(chunk_size) memory — bounded queues, ~800 KB in-flight regardless of file size
  • 500 MB max — files larger than VM RAM transfer fine (150 MB in 128 MB VM)
  • Concurrent transfers via op_id multiplexing
  • Path traversal prevention, symlink containment, atomic writes

CLI: sbx run --upload ./local.csv:remote.csv --download result.json:./out.json "python analyze.py"

JavaScript Fixes

  • Bun.Transpiler replMode for correct evaluation semantics
  • Bun global, Web API globals (fetch, crypto, etc.), top-level await

Other

  • Thread pool offload for all file I/O (Python asyncio + Rust tokio)
  • SNI proxy tolerates TLS ECH/GREASE (Chrome 117+, Bun)
  • Package installs scoped to /home/user/

New API

All additions — existing run() is unchanged.

scheduler.session() Stateful session with persistent REPL
session.exec() Execute code with persisted state
session.write_file() Upload bytes or Path to guest
session.read_file() Stream guest file to local Path
session.list_files() List guest directory
--upload LOCAL:GUEST CLI file upload
--download GUEST:LOCAL CLI file download

Full Changelog: v0.9.0...v0.10.0