Repository navigation
v0.7.2
Dynamic Directory Aliases (--mount) & Adapter Sessions
Core Improvements
Added --mount flag (CLI) and mounts parameter (SDK) to mount a host directory into the sandbox under an alias.
# Mount a session workspace and expose it as "workspace" inside the task
capsule run main.py --mount restricted-folder/sessions/abc123_workspace::workspace
# Multiple directories
capsule run main.py \
--mount restricted-folder/sessions/abc123_workspace::workspace \
--mount restricted-folder/sessions/bce456_workspace::workspace:rofrom capsule import run
result = await run(
file="main.py",
mounts=["restricted-folder/sessions/abc123_workspace::workspace"],
)Python & TypeScript Adapter Sessions
A new sandboxed session system is now available.
from capsule_adapter import Session
async with Session() as s:
await s.run("x = 1")
result = await s.run("x += 1; x")
print(result) # 2You can also import files within a session:
async with Session() as s:
# Import a single file
await s.import_file("./notes.txt", "notes.txt")
result = await s.run("""
with open("workspace/notes.txt") as f:
content = f.read()
content
""")
# Delete the file
await s.delete_file("./notes.txt")SDK
Added more built-ins to the TypeScript SDK.