Skip to content

v0.19.1

Choose a tag to compare

@ggoodman ggoodman released this 31 Aug 20:46
3dc0dd5

Sandbox v0.19.1 makes blob-backed disk lifecycle fully sandbox-owned. Applications no longer need to call getLifecycle() around a booted disk.

Acquire the disk, mount it, and dispose the sandbox normally:

import { block, defineSandbox } from "@torkbot/sandbox";
import { image as alpine } from "@torkbot/sandbox-image-alpine-3.23-agent";

const sandbox = defineSandbox({ rootfs: alpine });
const disk = await block.blob.acquire({
  provider: {
    kind: "s3",
    bucket: "agent-disks",
    region: "us-east-1",
    auth: { kind: "environment" },
  },
  volume: "agent-42-workspace",
  sizeBytes: 64n * 1024n * 1024n,
});

await using vm = await sandbox.boot({
  mounts: { "/workspace": disk },
  cwd: "/workspace",
});

await vm.exec("sh", ["-lc", "echo ready > state.txt"]);

Once boot() accepts the device, Sandbox retains its lifecycle capability. Closing or disposing the sandbox flushes the guest, closes the device, waits for its final outcome, and releases the lease. Repeated or concurrent close calls share the same result.

If boot fails after taking ownership, Sandbox still closes the device and releases custody. If device shutdown or lease release fails, sandbox close now rejects with the typed block-device failure so the caller can apply its lane-level retry or outage policy.