Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,35 @@
This file records user-visible changes to the BoxCompute CLI. GitHub Releases
use the same notes and bind them to the exact source commit.

## [0.13.0] - 2026-11-16

The retired gVisor options are gone, and the CLI's own guide says where it
keeps its credential.

### CLI users

- `bxc sandbox start` no longer offers `--gvisor` or `--cpu`. BoxCompute
retired gVisor container sandboxes in October and refuses `vmSandbox:
false`, so both options already failed at the server. They now fail before
any request, naming the change; choose a VM size with `--size small|large`.
Help, the README and the bundled `boxcompute-sandbox` skill no longer show
them, so coding agents stop trying them.
- The README said the credential lives under `~/.config/boxcompute`. The CLI
uses `~/boxcompute`, or `$XDG_CONFIG_HOME/boxcompute` when that is set; no
files move.
- Includes 0.12.1, which was never published to npm: help says a VM can have
up to three previews.
- Update with `bxc update` or `npm install --global @boxcompute/cli@latest`.
Scripts that pass `--gvisor` or `--cpu` must drop them.

### Security

- No change to authentication or credential storage.

## [0.12.1] - 2026-11-06

Not published to npm; its change ships in 0.13.0.

### CLI users

- `bxc sandbox preview` help and the README no longer say a VM has at most one
Expand Down
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ bxc login
```

`bxc login` opens BoxCompute in your browser. After you approve the device, the
CLI stores its credential outside the project under `~/.config/boxcompute` with
CLI stores its credential outside the project under `~/boxcompute` (or
`$XDG_CONFIG_HOME/boxcompute` when that is set) with
restrictive file permissions. The credential is never included in the agent
skill.

Expand Down Expand Up @@ -47,18 +48,13 @@ bxc doctor
bxc workspaces
bxc sandboxes
bxc sandbox start WORKSPACE_ID
# Optionally request 0.1–4 scheduler CPUs for this sandbox.
bxc sandbox start WORKSPACE_ID --cpu 2
# Use the returned sandbox instance ID for later commands.
bxc sandbox logs SANDBOX_ID --source execute
bxc sandbox exec SANDBOX_ID -- python -m pytest
# Forward VM port 3000 to local loopback for up to one hour.
bxc sandbox expose SANDBOX_ID --port 3000
```

When `--cpu` is omitted, BoxCompute uses the server's default scheduler CPU
allocation.

### VM sandboxes

Any authenticated account can create a VM; VM is the default runtime, so a
Expand All @@ -76,8 +72,6 @@ bxc --json sandbox status SANDBOX_ID
bxc --json sandbox resume SANDBOX_ID
# Stop a running VM now; its disk and files stay for the next resume.
bxc --json sandbox stop SANDBOX_ID
# Container sandbox instead (supports --cpu); explicit gVisor opt-out.
bxc sandbox start WORKSPACE_ID --gvisor --cpu 2
bxc sandbox upload SANDBOX_ID fixture.txt /workspace/fixture.txt
bxc sandbox exec SANDBOX_ID --timeout 10 -- /bin/cat /workspace/fixture.txt
bxc sandbox download SANDBOX_ID /workspace/fixture.txt downloaded.txt
Expand All @@ -88,8 +82,7 @@ See [Test tools in a VM sandbox](docs/vm-sandbox-beta.md) for the CLI and API
walkthroughs, retry recovery, and Hermes limitations. VMs default to the
`small` profile (0.5 CPU, 1024 MiB memory) and `--size large` selects the 3x
profile (1.5 CPU, 3072 MiB memory). Both use a 30 GiB thin-provisioned
workspace. Sizing is VM only: the
gVisor runtime ignores `small` and rejects `large`. VMs have outbound Internet
workspace. VMs have outbound Internet
access by default, no automatic lifetime expiry, and no SSH access. A running
VM bills until it stops: stop it when done if you will reuse it, or delete it
when its files are no longer needed. Uploads are limited to 8 MiB; downloads
Expand Down
13 changes: 6 additions & 7 deletions docs/vm-sandbox-beta.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ workloads or always-on services, and running VMs bill until they stop.
**CLI support:** CLI 0.4.0 or newer creates VMs by default — `bxc sandbox start`
omits the runtime selector and waits up to 180 seconds for `running` — plus
`upload` and `download`. Use `--vm --idempotency-key KEY` for an explicit VM
create with your own retry key, `--no-wait` for the receipt only, and
`--gvisor` for a container sandbox instead. CLI 0.5.0 or newer adds `--size
create with your own retry key and `--no-wait` for the receipt only. Every
sandbox is a VM; CLI 0.13.0 removed the retired `--gvisor` and `--cpu` options. CLI 0.5.0 or newer adds `--size
small|large` for the VM profile. The [CLI walkthrough](#cli-walkthrough-040-or-newer)
uses browser login and the CLI's saved credential. The direct API walkthrough
uses a separately loaded account API key; do not extract the CLI's credential.
Expand All @@ -30,7 +30,7 @@ sizing (`size`) added September 17, 2026.
| Capability | Current VM profile |
| --- | --- |
| Availability | Any authenticated account. No separate VM approval. |
| Selection | Omitted `vmSandbox` selects the VM runtime (the default); `vmSandbox: false` explicitly selects a gVisor container sandbox. Rejected VM requests do not fall back to that path. |
| Selection | Every sandbox is a VM. Omitted `vmSandbox` or `true` creates one; `vmSandbox: false` is refused with `400 INVALID_REQUEST` since gVisor container sandboxes were retired. |
| Resources | Sizing is chosen at create with `size`. `small` (default) is 500m CPU (0.5 CPU), 1,024 MiB RAM; `large` is 1,536m CPU (1.5 CPU), 3,072 MiB RAM. Both get a 30 GiB thin-provisioned workspace. |
| Lifetime | No automatic expiry. The VM exists until you delete it and bills while it runs. A running VM stops, keeping its files, when you call stop or 30 minutes after its last start, execute, file call or preview request; reads, logs, operation polling and work inside the VM do not count. |
| Image | Immutable, server-selected approved minimal Ubuntu image. No arbitrary image override, library profile, or attached volumes. |
Expand Down Expand Up @@ -245,10 +245,9 @@ generates a new key. Restore any saved sandbox ID from `vm-sandbox-id.txt`.
Only `workspaceId`, optional `name` (1–80 trimmed characters), `vmSandbox`,
`size` (VM only: `small` or `large`, default `small`), and `blockNetwork` (VM
only; omitted means outbound Internet) configure public creation. `small` is
0.5 CPU / 1,024 MiB and `large` is 1.5 CPU / 3,072 MiB. `size` applies to VMs
only: gVisor ignores `small` and rejects `large`. Unknown fields are currently
discarded, not sizing controls. Do not send `image`, `backend`, `cpu`
(container sandboxes only), `memoryMiB`, `workspaceMiB`, `timeoutSeconds`,
0.5 CPU / 1,024 MiB and `large` is 1.5 CPU / 3,072 MiB. Unknown fields are
currently discarded, not sizing controls. Do not send `image`, `backend`, `cpu`,
`memoryMiB`, `workspaceMiB`, `timeoutSeconds`,
`libraries`, or `volumes`.

An explicit `vmSandbox:true` requires `Idempotency-Key`: 1–255 visible ASCII
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@boxcompute/cli",
"version": "0.12.1",
"version": "0.13.0",
"description": "Connect local AI agents to BoxCompute sandboxes",
"keywords": [
"boxcompute",
Expand Down
5 changes: 2 additions & 3 deletions skills/boxcompute-sandbox/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ and waits up to 180 seconds for `state: running`, reporting the sandbox either
way. For an explicit VM create with your own retry key, add `--vm
--idempotency-key KEY`; reuse the same key, workspace, and optional `--name` on
retry, and save the returned ID even when pending. `--no-wait` returns the
creation receipt immediately. Use `--gvisor` for a container sandbox instead.
creation receipt immediately. Every sandbox is a VM: there is no container option.
Never change keys to recover a stuck create.

With CLI 0.9.0+, use `bxc --json sandbox resume SANDBOX_ID` when the task
Expand All @@ -49,8 +49,7 @@ logs, analytics, costs and processes running inside the VM do not count.

VMs are sized at create with `--size small|large` (default `small`): small is
0.5 CPU / 1024 MiB RAM and large is 1.5 CPU / 3072 MiB RAM, both with a 30 GiB
workspace. Sizing is VM only: gVisor ignores `small` and rejects `large`, and
VM sizing is mutually exclusive with `--cpu`. Use `--size large` only when the
workspace. Use `--size large` only when the
task needs more than the default profile; it bills more. VMs have outbound
Internet access by default, no SSH, and no automatic lifetime expiry. A running
VM bills until it is stopped: stop it when finished if you will reuse it, or
Expand Down
29 changes: 7 additions & 22 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ Examples:
$ bxc skill install
$ bxc workspaces
$ bxc sandbox start WORKSPACE_ID
$ bxc sandbox start WORKSPACE_ID --cpu 2
$ bxc sandbox start WORKSPACE_ID --size large --idempotency-key SAVED_UNIQUE_KEY
$ bxc sandbox logs SANDBOX_ID --source execute
$ bxc sandbox exec SANDBOX_ID -- python -m pytest
Expand Down Expand Up @@ -175,16 +174,11 @@ Start options:
small = 0.5 CPU / 1024 MiB; large = 1.5 CPU / 3072 MiB
--vm Explicitly request a VM sandbox; requires
--idempotency-key, reused with the same options on retry
--gvisor Explicitly request a gVisor container sandbox
--cpu CPU gVisor only: scheduler CPU allocation (0.1–4);
implies --gvisor
--idempotency-key KEY Required for --vm; reusable for any create
--name NAME Optional sandbox name (1–80 trimmed characters)
--no-wait Return the creation receipt without waiting

Without --vm or --gvisor, the server's default runtime is selected (VM).
--size is VM only: gVisor ignores small and rejects large. VM sizing is
mutually exclusive with --cpu.
Every sandbox is a VM; --vm only makes that explicit.
Start waits up to 180 seconds for a pending sandbox to reach running and
reports its state either way. No automatic retries or replacement VMs.
Transfers never retry; downloads stop after five minutes and discard partial
Expand Down Expand Up @@ -625,15 +619,6 @@ export function serviceMappings(tokens: string[]): ServiceMapping[] {
return mappings;
}

function schedulerCpu(value: string | undefined): number | undefined {
if (value === undefined) return undefined;
const parsed = Number(value);
if (!Number.isFinite(parsed) || parsed < 0.1 || parsed > 4) {
throw new UsageError("--cpu must be a number from 0.1 to 4");
}
return parsed;
}

function timestamp(value: string | undefined, name: string): string | undefined {
if (value === undefined) return undefined;
const parsed = new Date(value);
Expand Down Expand Up @@ -1330,22 +1315,22 @@ export async function runCli(argv: string[], supplied: CliDependencies = {}): Pr
return sandbox.state === "running" || (noWait && sandbox.state === "pending") ? 0 : 1;
}
if (action === "start") {
const cpu = schedulerCpu(option(args, "cpu"));
// Still read, so the refusal names gVisor rather than an unknown option:
// BoxCompute 0.51.1 retired gVisor, and the server refuses `vmSandbox: false`.
const cpu = option(args, "cpu");
const vmSandbox = flag(args, "vm");
const gvisor = flag(args, "gvisor");
const size: SandboxSize = oneOf(option(args, "size"), "--size", ["small", "large"] as const) ?? "small";
const idempotencyKey = option(args, "idempotency-key");
const name = option(args, "name");
const noWait = flag(args, "no-wait");
if (args.length) throw new UsageError(`Unknown sandbox start option: ${args[0]}`);
if (vmSandbox && gvisor) throw new UsageError("sandbox start accepts either --vm or --gvisor, not both");
if (vmSandbox && cpu !== undefined) throw new UsageError("VM sandboxes use a fixed CPU profile; --cpu selects the gVisor runtime");
if (gvisor || cpu !== undefined) {
throw new UsageError("gVisor sandboxes are retired: every sandbox is a VM. Drop --gvisor and --cpu, and choose a size with --size small|large");
}
if (vmSandbox && !idempotencyKey) throw new UsageError("sandbox start --vm requires --idempotency-key; save and reuse it with the same options on retry");
if (gvisor && size === "large") throw new UsageError("--size large is VM only; gVisor container sandboxes ignore --size small");
let sandbox = await client.sandboxes.create(buildCreateSandboxRequest(id, {
cpu,
vmSandbox,
gvisor: gvisor || cpu !== undefined,
size,
idempotencyKey,
name,
Expand Down
19 changes: 4 additions & 15 deletions src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ export function validateFilePath(path: string): void {
}

export type SandboxStartInput = {
cpu?: number;
vmSandbox?: boolean;
gvisor?: boolean;
size?: SandboxSize;
idempotencyKey?: string;
name?: string;
Expand All @@ -29,33 +27,24 @@ export type SandboxStartInput = {
/**
* Validate the create options and build the SDK create request. The runtime
* selection rules live here so the CLI never reimplements the v2 contract:
* - `gvisor` selects `vmSandbox: false` (the CLI derives this from `--gvisor`
* or the gVisor-only `--cpu` flag);
* - an explicit `vmSandbox` selects `vmSandbox: true` and requires a key;
* - otherwise `vmSandbox` is omitted and the server default (VM) applies.
* `cpu` is a gVisor-only scheduler request carried on the create body; the
* public v2 contract keeps `additionalProperties` open for it.
* There is no gVisor opt-out: the server refuses `vmSandbox: false`.
*/
export function buildCreateSandboxRequest(
workspaceId: string,
input: SandboxStartInput = {},
): CreateSandboxRequest & { idempotencyKey?: string } {
if (input.vmSandbox && input.gvisor) throw new Error("VM and gVisor selection are mutually exclusive");
if (input.vmSandbox && input.cpu !== undefined) throw new Error("VM sandboxes use a fixed CPU profile; --cpu selects the gVisor runtime");
if (input.vmSandbox && !input.idempotencyKey) throw new Error("VM creation requires --idempotency-key; reuse the same key and options on retry");
if (input.gvisor && input.size === "large") throw new Error("--size large is VM only; gVisor container sandboxes ignore --size small");
if (input.idempotencyKey !== undefined && !/^[\x21-\x7e]{1,255}$/.test(input.idempotencyKey)) {
throw new Error("Idempotency key must contain 1–255 visible ASCII characters without spaces");
}
const name = input.name?.trim();
if (name !== undefined && (!name || name.length > 80)) throw new Error("Sandbox name must contain 1–80 trimmed characters");

const body: CreateSandboxRequest & { cpu?: number } = { workspaceId };
if (input.cpu !== undefined) body.cpu = input.cpu;
if (input.gvisor) body.vmSandbox = false;
else if (input.vmSandbox) body.vmSandbox = true;
// VM sizing only: gVisor uses the default profile and must not receive size.
if (!input.gvisor && input.size !== undefined) body.size = input.size;
const body: CreateSandboxRequest = { workspaceId };
if (input.vmSandbox) body.vmSandbox = true;
if (input.size !== undefined) body.size = input.size;
if (name !== undefined) body.name = name;

return { ...body, ...(input.idempotencyKey ? { idempotencyKey: input.idempotencyKey } : {}) };
Expand Down
62 changes: 10 additions & 52 deletions test/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,39 +193,20 @@ describe("bxc CLI", () => {
expect(output(io.stdout)).toBe("workspace-one\tDemo\n");
});

it("sets scheduler CPU when starting a sandbox", async () => {
const connection = { url: "https://app.boxcompute.ai", token: "bc_live_test", tokenFile: "/credential" };
const bodies: unknown[] = [];
it("refuses the retired gVisor options before calling the server", async () => {
const dependencies = {
io: streams(),
env: {},
loadConnection: async () => connection,
fetch: (async (_input: string | URL | Request, init?: RequestInit) => {
bodies.push(JSON.parse(String(init?.body)));
return new Response(JSON.stringify({ sandbox: {
id: "sandbox-one",
workspaceId: "workspace-one",
name: "Demo",
state: "running",
runtimeId: "runtime-one",
retainedRuntimeId: null,
image: null,
createdAt: 1,
lastUsedAt: 1,
} }), { status: 201, headers: { "content-type": "application/json" } });
}) as typeof globalThis.fetch,
loadConnection: async () => ({ url: "https://app.boxcompute.ai", token: "bc_live_test", tokenFile: "/credential" }),
fetch: (async () => { throw new Error("should not fetch"); }) as unknown as typeof globalThis.fetch,
};

expect(await runCli(["sandbox", "start", "workspace-one", "--cpu", "0.1"], dependencies)).toBe(0);
expect(await runCli(["sandbox", "start", "workspace-one", "--cpu", "4"], dependencies)).toBe(0);

expect(bodies).toEqual([
{ workspaceId: "workspace-one", cpu: 0.1, vmSandbox: false },
{ workspaceId: "workspace-one", cpu: 4, vmSandbox: false },
]);
for (const args of [["--cpu", "2"], ["--gvisor"], ["--gvisor", "--cpu", "0.5"], ["--vm", "--gvisor", "--idempotency-key", "k"]]) {
await expect(runCli(["sandbox", "start", "workspace-one", ...args], dependencies))
.rejects.toThrow("gVisor sandboxes are retired");
}
});

it("sends the VM size, defaulting to small, and rejects large on gVisor", async () => {
it("sends the VM size, defaulting to small", async () => {
const connection = { url: "https://app.boxcompute.ai", token: "bc_live_test", tokenFile: "/credential" };
const bodies: unknown[] = [];
const dependencies = {
Expand Down Expand Up @@ -269,30 +250,6 @@ describe("bxc CLI", () => {
};
await expect(runCli(["sandbox", "start", "workspace-one", "--size", "medium"], rejected))
.rejects.toThrow("--size must be one of: small, large");
await expect(runCli(["sandbox", "start", "workspace-one", "--gvisor", "--size", "large"], rejected))
.rejects.toThrow("--size large is VM only");
await expect(runCli(["sandbox", "start", "workspace-one", "--cpu", "2", "--size", "large"], rejected))
.rejects.toThrow("--size large is VM only");
});

it("rejects scheduler CPU outside the supported range before calling the server", async () => {
const dependencies = {
io: streams(),
env: {},
loadConnection: async () => ({
url: "https://app.boxcompute.ai",
token: "bc_live_test",
tokenFile: "/credential",
}),
fetch: (async () => { throw new Error("should not fetch"); }) as unknown as typeof globalThis.fetch,
};

await expect(runCli(["sandbox", "start", "workspace-one", "--cpu", "0.09"], dependencies))
.rejects.toThrow("--cpu must be a number from 0.1 to 4");
await expect(runCli(["sandbox", "start", "workspace-one", "--cpu", "4.01"], dependencies))
.rejects.toThrow("--cpu must be a number from 0.1 to 4");
await expect(runCli(["sandbox", "start", "workspace-one", "--cpu", "fast"], dependencies))
.rejects.toThrow("--cpu must be a number from 0.1 to 4");
});

it("reads retained sandbox logs with filters without starting compute", async () => {
Expand Down Expand Up @@ -479,7 +436,8 @@ describe("bxc CLI", () => {
const sandboxIo = streams();
expect(await runCli(["sandbox", "--help"], { io: sandboxIo, env: {} })).toBe(0);
const sandboxHelp = output(sandboxIo.stdout);
expect(sandboxHelp).toContain("--cpu CPU");
expect(sandboxHelp).not.toContain("--cpu");
expect(sandboxHelp).not.toContain("--gvisor");
expect(sandboxHelp).toContain("--size small|large");
expect(sandboxHelp).toContain("stop SANDBOX_ID");

Expand Down
Loading