@lizard-build/cli 4.0.124 → 4.0.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,8 @@ A sandbox starts in `us-east-1` unless `--region` names another; with `--volume`
32
32
 
33
33
  `--allow-host <host>` (repeatable, implies `--no-internet`) keeps a few destinations reachable: a host name such as `pypi.org`, or `*.pythonhosted.org` for its subdomains, on ports 80 and 443; or an IPv4 address or range such as `140.82.112.0/20` on every port. Up to 50; private ranges, IPv6 and ports are refused. With a host name in the list, DNS (8.8.8.8) is open too so names resolve, which means code can still send data out inside DNS lookups; a list of addresses only keeps DNS closed.
34
34
 
35
+ `--proxy <url>` on `sandbox create`, or `lizard sandbox proxy <id> <url>` on a running sandbox, sends every internet connection the sandbox opens through your own proxy, from any supplier (residential, ISP, datacenter): `http://user:pass@host:port`, `https://...` or `socks5://user:pass@host:port`. It is applied outside the sandbox, so every program uses it with no setup inside (no `HTTP_PROXY` needed) and nothing in the sandbox can go around it; sites see the proxy's IP. Check with `lizard sandbox exec <id> -- curl -s https://ipv4.webshare.io/`. `lizard sandbox proxy <id> --off` goes direct again, `lizard sandbox proxy <id>` shows the current one (never the password). A change applies to new connections at once; connections already open keep their route. A proxy that is down or refuses the password makes connections fail, never fall back to direct. Only TCP is proxied: DNS and other UDP (QUIC) go out directly. The sandbox must be running to change it; the proxy stays through pause/resume and is copied to forks. Not available with a container volume or snapshot.
36
+
35
37
  ## Running commands
36
38
 
37
39
  `lizard sandbox exec <id> -- <cmd> [args...]` runs the command in the sandbox, streams stdout and stderr, and exits with the command's exit code. Each argument stays one word: `exec <id> 'cd /workspace && npm test'` fails with `not found`, so put a shell line in `-- sh -c '…'`. Without a terminal it prints the raw output without the `$ <cmd>` header. Each call is a new process that starts in `/root`, so `cd` and exported variables don't carry over: chain steps in one call, e.g. `lizard sandbox exec <id> -- sh -c 'cd /workspace && npm test'`, and keep results in files.
@@ -72,7 +74,7 @@ lizard sandbox files rm <id> <path>
72
74
 
73
75
  ## Size and pricing
74
76
 
75
- `lizard sandbox create -s/--size nano|mini|small|medium|large` picks the machine; the default is `medium`. The Pro trial runs 1 Small, 2 Mini and 2 Nano at a time, in US regions only (no size = small); Medium and Large unlock after the first payment. Medium or Large answers 403 `TRIAL_SANDBOX_SIZE` (`allowedSizes: ["small", "mini", "nano"]`), another region 403 `TRIAL_SANDBOX_REGION`, and a second Small or a third Mini or Nano 403 `TRIAL_SIZE_RUNNING` (`size`, `sizeLimit`, `sizeLimits: {"small": 1, "mini": 2, "nano": 2}`): pause or delete one. Trial sandboxes are deleted 1 hour after they start at the latest (a longer `--timeout` answers 403 `TRIAL_SANDBOX_LIFETIME`, see [Lifetime](#lifetime)). `lizard billing start-now` lifts these limits. There are exactly five sizes:
77
+ `lizard sandbox create -s/--size nano|mini|small|medium|large|big` picks the machine; the default is `medium`. The Pro trial runs 1 Small, 2 Mini and 2 Nano at a time, in US regions only (no size = small); Medium, Large and Big unlock after the first payment. Medium or Large answers 403 `TRIAL_SANDBOX_SIZE` (`allowedSizes: ["small", "mini", "nano"]`), another region 403 `TRIAL_SANDBOX_REGION`, and a second Small or a third Mini or Nano 403 `TRIAL_SIZE_RUNNING` (`size`, `sizeLimit`, `sizeLimits: {"small": 1, "mini": 2, "nano": 2}`): pause or delete one. Trial sandboxes are deleted 1 hour after they start at the latest (a longer `--timeout` answers 403 `TRIAL_SANDBOX_LIFETIME`, see [Lifetime](#lifetime)). `lizard billing start-now` lifts these limits. There are exactly six sizes:
76
78
 
77
79
  | Size | vCPU | RAM | Disk | Price |
78
80
  |---|---|---|---|---|
@@ -81,12 +83,15 @@ lizard sandbox files rm <id> <path>
81
83
  | `small` | 2 | 4 GiB | 20 GB | $0.0162/h |
82
84
  | `medium` (default) | 4 | 8 GiB | 40 GB | $0.0324/h |
83
85
  | `large` | 8 | 16 GiB | 80 GB | $0.0648/h |
86
+ | `big` | 16 | 32 GiB | 120 GB | $0.1296/h |
84
87
 
85
88
  Mini has no warm pool, so it starts only from templates with a disk-only build: `base`, `claude`, `codex` and `interpreter`. Any other template answers 400 `SANDBOX_SIZE_NOT_ALLOWED`; use `small` or larger for it.
86
89
 
90
+ Big has no warm pool either, so it starts only from templates with a disk-only build: `base`, `claude`, `codex`, `interpreter` and `desktop` (not `android`); it takes a few seconds longer to start than Large. On the trial it answers 403 `SANDBOX_SIZE_NOT_ALLOWED` (the trial runs up to 4 vCPU per sandbox).
91
+
87
92
  Nano is half a vCPU: the sandbox sees 1 CPU (`nproc` says 1) but gets at most half a core of time, so CPU-bound work takes about twice as long as on Mini (the rest shows as steal time). It suits an idle shell or a coding agent waiting on a model. Nano starts only from `base`, `claude` and `codex`; any other template answers 400 `SANDBOX_SIZE_NOT_ALLOWED` with `templates`.
88
93
 
89
- Disk is the sandbox's root file system (`/`): its home directory, `/workspace` and everything it installs share it (a volume, if attached, mounts over `/workspace`). `df -h` prints GiB, so it shows about 4.7G / 9.4G / 18.8G / 37.6G / 75.2G for `nano` / `mini` / `small` / `medium` / `large`. A sandbox restored from a snapshot keeps at least its snapshot's disk.
94
+ Disk is the sandbox's root file system (`/`): its home directory, `/workspace` and everything it installs share it (a volume, if attached, mounts over `/workspace`). `df -h` prints GiB, so it shows about 4.7G / 9.4G / 18.8G / 37.6G / 75.2G / 112.8G for `nano` / `mini` / `small` / `medium` / `large` / `big`. A sandbox restored from a snapshot keeps at least its snapshot's disk.
90
95
 
91
96
  Prices are per hour, billed per second while the sandbox runs, flat by size: measured CPU/RAM is not charged, and disk and egress are included. A paused sandbox costs nothing. Attached volumes bill separately. `--size` cannot be combined with `--snapshot`: a snapshot restores at the size it was captured at (see [private snapshots](#snapshots-and-pauseresume)).
92
97
 
@@ -36,7 +36,7 @@ Options for `create()` (TypeScript / Python):
36
36
 
37
37
  | Option | Purpose |
38
38
  |---|---|
39
- | `size` | `mini` (1 vCPU / 2 GB, $0.0081/h; `base`, `claude`, `codex` and `interpreter` templates only; SDK 1.0.12 or later), `small` (2 vCPU / 4 GB, $0.0162/h), `medium` (4 vCPU / 8 GB, $0.0324/h, default), `large` (8 vCPU / 16 GB, $0.0648/h) |
39
+ | `size` | `mini` (1 vCPU / 2 GB, $0.0081/h; `base`, `claude`, `codex` and `interpreter` templates only; SDK 1.0.12 or later), `small` (2 vCPU / 4 GB, $0.0162/h), `medium` (4 vCPU / 8 GB, $0.0324/h, default), `large` (8 vCPU / 16 GB, $0.0648/h), `big` (16 vCPU / 32 GB, $0.1296/h; `base`, `claude`, `codex`, `interpreter`, `desktop` templates; paid accounts) |
40
40
  | `timeoutMs` / `timeout_ms` | Lifetime; default 300,000 ms (5 minutes); `0` means no deadline (the VM still stops after 596 hours). Pro trial: at most 3,600,000 (1 hour), `0` gets 1 hour, longer is 403 `TRIAL_SANDBOX_LIFETIME` |
41
41
  | `envs` | Environment variables for every command in the sandbox (up to 256) |
42
42
  | `metadata` | Your own string labels, returned by `getInfo()` / `get_info()` (up to 64) |
@@ -47,7 +47,7 @@ Options for `create()` (TypeScript / Python):
47
47
 
48
48
  Templates: `base` (default), `interpreter` (Python with data libraries, plus Node 22), `codex`, `claude`, `opencode`, `pi`, `prime` (one coding agent each), `desktop`. The SDK and CLI give a sandbox 5 minutes by default; the raw API and the dashboard give none. Commands do not reset the deadline. Pricing is flat by size, billed per second while the sandbox runs; a sandbox restored from a snapshot runs at the source's size and is billed at that size; volumes bill separately.
49
49
 
50
- An account's limit counts vCPU of running sandboxes (Mini 1, Small 2, Medium 4, Large 8): 40 vCPU on Pro, 220 on Pro 5x and 1,200 on Pro 20x. The trial runs 1 Small and 2 Mini at a time, US regions only (no size = small); Medium and Large unlock after the first payment (403 `TRIAL_SANDBOX_SIZE` / `TRIAL_SANDBOX_REGION`, and 403 `TRIAL_SIZE_RUNNING` for a second Small or a third Mini). A trial sandbox is deleted 1 hour after it starts at the latest: a longer `timeoutMs` or `setTimeout` past that answers 403 `TRIAL_SANDBOX_LIFETIME`. Starts are limited only on the trial (6 a minute, 30 an hour, 100 a day); Pro, Pro 5x and Pro 20x have unlimited starts. Over a limit, a `LimitExceededError` (status 429) with `code` `SANDBOX_LIMIT_REACHED` (`unit` `vcpu`, `limit`, `running`, `needed`) or `SANDBOX_RATE_LIMITED` (`retryAfterS`). More than 32 commands at once in one sandbox gives `EXEC_LIMIT_REACHED`.
50
+ An account's limit counts vCPU of running sandboxes (Mini 1, Small 2, Medium 4, Large 8, Big 16): 40 vCPU on Pro, 220 on Pro 5x and 1,200 on Pro 20x. The trial runs 1 Small and 2 Mini at a time, US regions only (no size = small); Medium and Large unlock after the first payment (403 `TRIAL_SANDBOX_SIZE` / `TRIAL_SANDBOX_REGION`, and 403 `TRIAL_SIZE_RUNNING` for a second Small or a third Mini). A trial sandbox is deleted 1 hour after it starts at the latest: a longer `timeoutMs` or `setTimeout` past that answers 403 `TRIAL_SANDBOX_LIFETIME`. Starts are limited only on the trial (6 a minute, 30 an hour, 100 a day); Pro, Pro 5x and Pro 20x have unlimited starts. Over a limit, a `LimitExceededError` (status 429) with `code` `SANDBOX_LIMIT_REACHED` (`unit` `vcpu`, `limit`, `running`, `needed`) or `SANDBOX_RATE_LIMITED` (`retryAfterS`). More than 32 commands at once in one sandbox gives `EXEC_LIMIT_REACHED`.
51
51
 
52
52
  ## Quickstart
53
53
 
@@ -274,7 +274,7 @@ export function describeSubscription(sub: Subscription, now = Date.now()): strin
274
274
  lines.push(label("Replicas: ") + `up to ${n} per service`);
275
275
  if (sub.limits.tier === "trial") {
276
276
  // The trial is limited by size, not vCPU: 1 Small and 2 Mini at a time, US regions only.
277
- lines.push(label("Sandboxes: ") + "1 Small and 2 Mini at a time (US regions only); Medium and Large unlock after the first payment");
277
+ lines.push(label("Sandboxes: ") + "1 Small and 2 Mini at a time (US regions only); Medium, Large and Big unlock after the first payment");
278
278
  } else if (sub.limits.sandboxVcpu) {
279
279
  lines.push(label("Sandboxes: ") + `up to ${sub.limits.sandboxVcpu.toLocaleString("en-US")} vCPU at once`);
280
280
  }
@@ -24,13 +24,14 @@ import { success, info, warn, error, isJSONMode, printJSON, table, statusColor,
24
24
  // so let it.
25
25
  const TEMPLATE_HINT = "base, interpreter, codex, claude, opencode, pi, prime, desktop";
26
26
 
27
- // The five machines a sandbox can be, each priced per hour, billed per second by the server. The
27
+ // The six machines a sandbox can be, each priced per hour, billed per second by the server. The
28
28
  // platform rejects anything else, so the CLI offers exactly these. Mini has no warm pool, so it
29
29
  // starts only from templates with a disk-only build (MINI_TEMPLATES); Nano (half a vCPU: 1 vCPU
30
30
  // held to 50% of a core) only from NANO_TEMPLATES. The server answers SANDBOX_SIZE_NOT_ALLOWED
31
- // for any other template.
32
- const SANDBOX_SIZES = ["nano", "mini", "small", "medium", "large"] as const;
33
- const SIZE_HINT = "nano 0.5 vCPU/1 GB RAM/5 GB disk, mini 1/2/10, small 2/4/20, medium 4/8/40, large 8/16/80";
31
+ // for any other template. Big (16 vCPU) likewise boots only from a disk-only build, and needs a
32
+ // paid account (the trial runs up to 4 vCPU per sandbox).
33
+ const SANDBOX_SIZES = ["nano", "mini", "small", "medium", "large", "big"] as const;
34
+ const SIZE_HINT = "nano 0.5 vCPU/1 GB RAM/5 GB disk, mini 1/2/10, small 2/4/20, medium 4/8/40, large 8/16/80, big 16/32/120";
34
35
  const MINI_TEMPLATES = "base, claude, codex and interpreter";
35
36
  const NANO_TEMPLATES = "base, claude and codex";
36
37
 
@@ -50,6 +51,8 @@ interface SandboxRecord {
50
51
  internetAccess?: boolean;
51
52
  /** With no internet: what is still reachable (--allow-host). */
52
53
  allowedHosts?: string[];
54
+ /** The sandbox's proxy without its password (--proxy, `sandbox proxy`); null: none. Absent from older platforms. */
55
+ proxy?: string | null;
53
56
  guestIp?: string;
54
57
  startedAt: number | string;
55
58
  endAt?: number | string;
@@ -176,7 +179,7 @@ export function registerSandbox(program: Command) {
176
179
  sb.command("create")
177
180
  .description("Create a sandbox")
178
181
  .option("-t, --template <name>", `Template (${TEMPLATE_HINT}; server validates)`, "base")
179
- .addOption(new Option("-s, --size <size>", `Machine size (${SIZE_HINT}); default medium, small on the Pro trial (1 Small, 2 Mini and 2 Nano at a time, US regions only; Medium and Large unlock after the first payment). Mini works only with the ${MINI_TEMPLATES} templates, Nano only with ${NANO_TEMPLATES}`).choices(SANDBOX_SIZES))
182
+ .addOption(new Option("-s, --size <size>", `Machine size (${SIZE_HINT}); default medium, small on the Pro trial (1 Small, 2 Mini and 2 Nano at a time, US regions only; Medium, Large and Big unlock after the first payment). Mini works only with the ${MINI_TEMPLATES} templates, Nano only with ${NANO_TEMPLATES}`).choices(SANDBOX_SIZES))
180
183
  .option("--timeout <ms>", "Lifetime in milliseconds; 0 disables expiration (Pro trial: at most 3600000 = 1 hour, and 0 means 1 hour)", parseTimeoutOption, 300_000)
181
184
  .option("--region <code>", `Region to create the sandbox in (default ${DEFAULT_REGION}; with --volume or --snapshot, theirs)`)
182
185
  .option("--snapshot <id>", "Create from a private saved snapshot, at the size it was taken at")
@@ -185,6 +188,7 @@ export function registerSandbox(program: Command) {
185
188
  .option("-p, --project <id>", "Project to create the sandbox in (name, slug, or ID). Defaults to the linked project.")
186
189
  .option("--allow-host <host>", "With no internet, still allow this host name (pypi.org, *.pythonhosted.org: ports 80/443) or IPv4 address/range (every port); repeat for more. Implies --no-internet", (v: string, all: string[] = []) => [...all, v])
187
190
  .option("--no-internet", "Fully closed sandbox, for its whole life (its resumes and forks too): no internet and no public ports; commands and files still work")
191
+ .option("--proxy <url>", "Send all of the sandbox's internet traffic through your proxy, any supplier: http://user:pass@host:port or socks5://user:pass@host:port. See `lizard sandbox proxy --help`")
188
192
  .action(async (opts) => {
189
193
  // A snapshot restores at its source's size (a Firecracker VM's memory is part of it; a
190
194
  // pod snapshot goes back onto the machine it was captured on), so the server ignores a
@@ -263,6 +267,7 @@ export function registerSandbox(program: Command) {
263
267
  // Sent only when asked: every other create stays byte-for-byte what it was.
264
268
  ...(opts.internet === false || opts.allowHost?.length ? { internetAccess: false } : {}),
265
269
  ...(opts.allowHost?.length ? { allowedHosts: opts.allowHost } : {}),
270
+ ...(opts.proxy ? { proxy: opts.proxy } : {}),
266
271
  };
267
272
  try {
268
273
  sandbox = await createInDefaultRegion(body, defaultRegion);
@@ -297,6 +302,12 @@ export function registerSandbox(program: Command) {
297
302
  throw new Error("This region's platform does not support --allow-host yet; the sandbox was deleted.");
298
303
  }
299
304
 
305
+ // A platform that predates --proxy ignores it: the sandbox would go out directly, so it is deleted.
306
+ if (opts.proxy && !sandbox.proxy) {
307
+ await api.delete(`/api/sandboxes/${sandbox.id}`).catch(() => {});
308
+ throw new Error("This region's platform does not support --proxy yet; the sandbox it started went out directly and was deleted.");
309
+ }
310
+
300
311
  if (isJSONMode()) {
301
312
  printJSON(sandbox);
302
313
  return;
@@ -314,6 +325,7 @@ export function registerSandbox(program: Command) {
314
325
  if (sandbox.internetAccess === false) {
315
326
  info(chalk.dim(sandbox.allowedHosts?.length ? ` Internet: only ${sandbox.allowedHosts.join(", ")}` : " Internet: off"));
316
327
  }
328
+ if (sandbox.proxy) info(chalk.dim(` Proxy: ${sandbox.proxy}`));
317
329
  info("");
318
330
  info(sandboxNextSteps(sandbox.id));
319
331
  });
@@ -367,6 +379,53 @@ export function registerSandbox(program: Command) {
367
379
  else success(`Sandbox ${chalk.bold(id)} timeout set to ${ms}ms`);
368
380
  });
369
381
 
382
+ sb.command("proxy")
383
+ .argument("<id>", "Sandbox ID")
384
+ .argument("[url]", "Proxy URL: http://user:pass@host:port, https://user:pass@host:port or socks5://user:pass@host:port")
385
+ .option("--off", "Stop using a proxy: the sandbox goes out directly again")
386
+ .description("Route a running sandbox's internet traffic through a proxy, or stop (no URL: show the current one)")
387
+ .addHelpText(
388
+ "after",
389
+ `
390
+ Sends every internet connection the sandbox opens through your proxy, from any
391
+ supplier (residential, ISP, datacenter). It is applied outside the sandbox, so
392
+ every program goes through it with no setup inside (no HTTP_PROXY needed) and
393
+ nothing in the sandbox can go around it. Sites see the proxy's IP.
394
+
395
+ lizard sandbox proxy <id> http://user:pass@host:port turn on (or switch)
396
+ lizard sandbox proxy <id> socks5://user:pass@host:port SOCKS5 works the same
397
+ lizard sandbox proxy <id> --off back to direct
398
+ lizard sandbox proxy <id> show the current one
399
+
400
+ Check it from inside:
401
+ lizard sandbox exec <id> -- curl -s https://ipv4.webshare.io/
402
+
403
+ - Takes effect at once for new connections; connections already open keep
404
+ going the way they went (restart a long-running client to move it).
405
+ - If the proxy is down or the password is wrong, connections fail: traffic
406
+ never falls back to a direct connection.
407
+ - Only TCP is proxied: DNS and other UDP (QUIC/HTTP3) go out directly.
408
+ - The sandbox must be running. The proxy stays through pause/resume and is
409
+ copied to forks. Set it at create with \`sandbox create --proxy <url>\`.
410
+ - The password is stored encrypted and never shown again.
411
+ `,
412
+ )
413
+ .action(async (id: string, url: string | undefined, opts: { off?: boolean }) => {
414
+ if (url && opts.off) throw new Error("Give a proxy URL or --off, not both.");
415
+ if (!url && !opts.off) {
416
+ const sandbox = await api.get<SandboxRecord>(`/api/sandboxes/${id}`);
417
+ if (isJSONMode()) printJSON({ id, proxy: sandbox.proxy ?? null });
418
+ else console.log(sandbox.proxy ? sandbox.proxy : "No proxy: the sandbox goes out directly");
419
+ return;
420
+ }
421
+ const result = url
422
+ ? await api.put<{ id: string; proxy: string | null }>(`/api/sandboxes/${id}/proxy`, { proxy: url })
423
+ : await api.delete<{ id: string; proxy: string | null }>(`/api/sandboxes/${id}/proxy`);
424
+ if (isJSONMode()) printJSON(result);
425
+ else if (result?.proxy) success(`Sandbox ${chalk.bold(id)} now goes out through ${result.proxy}`);
426
+ else success(`Sandbox ${chalk.bold(id)} goes out directly again`);
427
+ });
428
+
370
429
  // The host's CPU by name: inside a Firecracker sandbox /proc/cpuinfo only says "AMD EPYC",
371
430
  // so the platform reads it from the node. source "guest" means it could not, and this is
372
431
  // what the sandbox itself reports.
@@ -5,7 +5,7 @@ import { join, dirname } from "node:path";
5
5
  import os from "node:os";
6
6
  import { spawn } from "node:child_process";
7
7
 
8
- export const CURRENT_VERSION = "4.0.124";
8
+ export const CURRENT_VERSION = "4.0.126";
9
9
  const RELEASES_API = "https://api.github.com/repos/lizard-build/lizard-cli/releases/latest";
10
10
  const RELEASE_BASE = "https://github.com/lizard-build/lizard-cli/releases/latest/download";
11
11
 
@@ -9,7 +9,7 @@ vi.mock("../../src/lib/api.js", () => {
9
9
  class APIError extends Error {
10
10
  constructor(public status: number, message: string, public code = "", public body: unknown = null) { super(message); }
11
11
  }
12
- return { api: { post: vi.fn(), get: vi.fn(), delete: vi.fn() }, APIError };
12
+ return { api: { post: vi.fn(), get: vi.fn(), put: vi.fn(), delete: vi.fn() }, APIError };
13
13
  });
14
14
  vi.mock("open", () => ({ default: vi.fn().mockResolvedValue(undefined) }));
15
15
  vi.mock("../../src/lib/config.js", () => ({
@@ -55,13 +55,13 @@ describe("sandbox create size", () => {
55
55
  vi.mocked(api.post).mockResolvedValue({ id: "sandbox-test" });
56
56
  });
57
57
 
58
- it.each(["nano", "mini", "small", "medium", "large"])("sends --size %s to the API", async (size) => {
58
+ it.each(["nano", "mini", "small", "medium", "large", "big"])("sends --size %s to the API", async (size) => {
59
59
  await create(["--size", size]);
60
60
  expect(api.post).toHaveBeenCalledWith("/api/sandboxes", expect.objectContaining({ size }));
61
61
  });
62
62
 
63
63
  it("rejects an unknown size before making a request", async () => {
64
- await expect(create(["--size", "tiny"])).rejects.toThrow(/nano, mini, small, medium, large|"nano", "mini", "small", "medium", "large"/);
64
+ await expect(create(["--size", "tiny"])).rejects.toThrow(/nano, mini, small, medium, large, big|"nano", "mini", "small", "medium", "large", "big"/);
65
65
  expect(api.post).not.toHaveBeenCalled();
66
66
  });
67
67
 
@@ -70,10 +70,10 @@ describe("sandbox create size", () => {
70
70
  registerSandbox(program);
71
71
  const createCmd = program.commands.find((c) => c.name() === "sandbox")!.commands.find((c) => c.name() === "create")!;
72
72
  const help = createCmd.helpInformation().replace(/\s+/g, " ");
73
- expect(help).toContain("nano 0.5 vCPU/1 GB RAM/5 GB disk, mini 1/2/5, small 2/4/20, medium 4/8/40, large 8/16/80");
73
+ expect(help).toContain("nano 0.5 vCPU/1 GB RAM/5 GB disk, mini 1/2/10, small 2/4/20, medium 4/8/40, large 8/16/80, big 16/32/120");
74
74
  expect(help).toContain("Nano only with base, claude and codex");
75
75
  expect(help).toContain("Mini works only with the base, claude, codex and interpreter templates");
76
- expect(help).toContain('(choices: "nano", "mini", "small", "medium", "large")');
76
+ expect(help).toContain('(choices: "nano", "mini", "small", "medium", "large", "big")');
77
77
  });
78
78
  });
79
79
 
@@ -418,3 +418,47 @@ describe("sandbox cpu in a terminal", () => {
418
418
  vi.doUnmock("../../src/lib/format.js");
419
419
  });
420
420
  });
421
+
422
+ describe("sandbox proxy", () => {
423
+ function run(args: string[]) {
424
+ const program = new Command().exitOverride();
425
+ registerSandbox(program);
426
+ return program.parseAsync(["sandbox", ...args], { from: "user" });
427
+ }
428
+ beforeEach(() => { vi.clearAllMocks(); });
429
+
430
+ it("sends --proxy at create and keeps a sandbox that has it", async () => {
431
+ vi.mocked(api.post).mockResolvedValue({ id: "sb1", proxy: "http://u@h.example.com:8000" });
432
+ await run(["create", "--proxy", "http://u:p@h.example.com:8000"]);
433
+ expect(api.post).toHaveBeenCalledWith("/api/sandboxes", expect.objectContaining({ proxy: "http://u:p@h.example.com:8000" }));
434
+ expect(api.delete).not.toHaveBeenCalled();
435
+ });
436
+
437
+ it("deletes the sandbox when the platform ignored --proxy", async () => {
438
+ vi.mocked(api.post).mockResolvedValue({ id: "sb1" });
439
+ vi.mocked(api.delete).mockResolvedValue({});
440
+ await expect(run(["create", "--proxy", "http://u:p@h.example.com:8000"])).rejects.toThrow(/does not support --proxy/);
441
+ expect(api.delete).toHaveBeenCalledWith("/api/sandboxes/sb1");
442
+ });
443
+
444
+ it("turns it on, off, and refuses both at once", async () => {
445
+ vi.mocked(api.put).mockResolvedValue({ id: "sb1", proxy: "socks5://u@h.example.com:1080" });
446
+ await run(["proxy", "sb1", "socks5://u:p@h.example.com:1080"]);
447
+ expect(api.put).toHaveBeenCalledWith("/api/sandboxes/sb1/proxy", { proxy: "socks5://u:p@h.example.com:1080" });
448
+ vi.mocked(api.delete).mockResolvedValue({ id: "sb1", proxy: null });
449
+ await run(["proxy", "sb1", "--off"]);
450
+ expect(api.delete).toHaveBeenCalledWith("/api/sandboxes/sb1/proxy");
451
+ await expect(run(["proxy", "sb1", "http://h.example.com:1", "--off"])).rejects.toThrow(/not both/);
452
+ });
453
+
454
+ it("explains itself in --help", () => {
455
+ const program = new Command();
456
+ registerSandbox(program);
457
+ const cmd = program.commands.find((c) => c.name() === "sandbox")!.commands.find((c) => c.name() === "proxy")!;
458
+ let help = "";
459
+ cmd.configureOutput({ writeOut: (s) => { help += s; } });
460
+ cmd.outputHelp();
461
+ expect(help).toContain("never falls back to a direct connection");
462
+ expect(help).toContain("ipv4.webshare.io");
463
+ });
464
+ });