@lizard-build/cli 4.0.114 → 4.0.116
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.
- package/dist/commands/billing.js +5 -1
- package/dist/commands/billing.js.map +1 -1
- package/dist/commands/sandbox-schedules.js +9 -11
- package/dist/commands/sandbox-schedules.js.map +1 -1
- package/dist/commands/sandbox.js +27 -38
- package/dist/commands/sandbox.js.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/lib/skills-data.generated.js +3 -3
- package/dist/lib/skills-data.generated.js.map +1 -1
- package/dist/lib/updater.d.ts +1 -1
- package/dist/lib/updater.js +1 -1
- package/package.json +1 -1
- package/skill-data/core/SKILL.md +4 -4
- package/skill-data/core/references/sandboxes.md +5 -7
- package/skill-data/core/references/sdk.md +2 -3
- package/src/commands/billing.ts +4 -1
- package/src/commands/sandbox-schedules.ts +9 -10
- package/src/commands/sandbox.ts +25 -33
- package/src/index.ts +2 -0
- package/src/lib/updater.ts +1 -1
- package/test/unit/billing.test.ts +13 -0
- package/test/unit/sandbox.test.ts +7 -14
package/dist/lib/updater.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Readable } from "node:stream";
|
|
|
4
4
|
import { join, dirname } from "node:path";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
|
-
export const CURRENT_VERSION = "4.0.
|
|
7
|
+
export const CURRENT_VERSION = "4.0.116";
|
|
8
8
|
const RELEASES_API = "https://api.github.com/repos/lizard-build/lizard-cli/releases/latest";
|
|
9
9
|
const RELEASE_BASE = "https://github.com/lizard-build/lizard-cli/releases/latest/download";
|
|
10
10
|
/** Minimum gap between background update checks. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lizard-build/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.116",
|
|
4
4
|
"description": "Lizard CLI — deploy apps, databases and sandboxes to Lizard (lizard.build) from your terminal or your coding agent. Detects Go, Node, Python, Rust, Ruby, PHP, Java and static sites; adds Managed Postgres, Managed Redis and Managed Object Storage in one command.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/skill-data/core/SKILL.md
CHANGED
|
@@ -105,20 +105,20 @@ lizard sandbox exec <id> -- python3 /workspace/app.py
|
|
|
105
105
|
lizard sandbox expose <id> 8000 --json # an HTTPS URL for a port in the sandbox
|
|
106
106
|
lizard sandbox timeout <id> 3600000 # keep it for an hour from now
|
|
107
107
|
lizard sandbox cpu <id> # the CPU model it runs on, e.g. AMD EPYC 7351P 16-Core Processor
|
|
108
|
-
lizard sandbox pause <id> # stop billing, keep files (~1 s); `resume <id>` brings it back (
|
|
108
|
+
lizard sandbox pause <id> # stop billing, keep files (~1 s); `resume <id>` brings it back (processes restart)
|
|
109
109
|
lizard sandbox rm <id> # delete it now (alias kill): no prompt without a terminal
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
`lizard sandbox list --json` shows the project's sandboxes; `--all` shows every one you have.
|
|
113
113
|
|
|
114
114
|
- **Templates:** `base` (default, Python 3.11 on Alpine Linux), `interpreter` (Python with numpy, pandas, matplotlib and scipy, plus Node 22), `codex`, `claude`, `opencode`, `pi`, `prime` (one coding agent each), `desktop` (graphical desktop with Chromium).
|
|
115
|
-
- **Sizes:** `-s mini|small|medium|large`, $0.0081 / $0.0162 / $0.0324 (default) / $0.0648 per hour, billed per second while it runs. A paused sandbox costs nothing. Mini (1 vCPU / 2 GB) works only with the `base`, `claude`, `codex` and `interpreter` templates; another template answers 400 `SANDBOX_SIZE_NOT_ALLOWED`.
|
|
115
|
+
- **Sizes:** `-s mini|small|medium|large`, $0.0081 / $0.0162 / $0.0324 (default) / $0.0648 per hour, billed per second while it runs. A paused sandbox costs nothing. Mini (1 vCPU / 2 GB) works only with the `base`, `claude`, `codex` and `interpreter` templates; another template answers 400 `SANDBOX_SIZE_NOT_ALLOWED`. The Pro trial runs 1 Small and 2 Mini at a time, in US regions only (no size = small); Medium and Large unlock after the first payment. Until then Medium or Large answers 403 `TRIAL_SANDBOX_SIZE`, another region 403 `TRIAL_SANDBOX_REGION`, and a second Small or a third Mini 403 `TRIAL_SIZE_RUNNING` (pause or delete one).
|
|
116
116
|
- **Region:** `us-east-1` unless `--region` names another (`lizard regions`). With `--volume` or `--snapshot` the sandbox starts in their region.
|
|
117
117
|
- **Lifetime:** 5 minutes by default, then the sandbox is deleted with its files. `--timeout 0` at create means no limit; `lizard sandbox timeout <id> <ms>` sets a new lifetime from now. Commands do not reset it.
|
|
118
118
|
- **Commands:** `exec <id> -- <cmd> [args…]` passes each argument as one word, so a whole shell line in one quoted string fails with `not found`: wrap it, `-- sh -c 'cd /workspace && npm test'`. Each call is a new process that starts in `/root`, gives up after 150 seconds (exit `4`, `EXEC_TIMEOUT`; the command may still be running) and keeps at most 512 KB of output. Run longer jobs in the background and poll a log: `-- sh -c 'cd /workspace && nohup npm run build > build.log 2>&1 &'`, then `-- tail -n 50 /workspace/build.log`. `ssh` needs a real terminal: from an agent, use `exec`.
|
|
119
119
|
- **Ports:** `lizard sandbox expose <id> <port> --json` gives `url` with `?lizard_token=…`, which works in a browser: it swaps the token for a cookie and redirects. `curl -L` without a cookie jar gets `401`; from a script send the token as a header instead: `curl -H "X-Lizard-Access-Token: <accessToken>" https://<hostname>/`. The token opens every port of that sandbox: treat the URL like a password. Start the server in the background (as above) so `exec` returns.
|
|
120
120
|
- **Keeping work:** files outlive a sandbox on a volume (`--volume <name>`) or in a snapshot.
|
|
121
|
-
- **Pausing:** plain `pause` stops billing in about a second at any memory size and keeps every file; running processes end, and `resume` boots the sandbox fresh
|
|
121
|
+
- **Pausing:** plain `pause` stops billing in about a second at any memory size and keeps every file; running processes end, and `resume` boots the sandbox fresh, so start your processes again after it.
|
|
122
122
|
- **Copies:** `lizard sandbox fork <id> -n 8 --json` starts live copies of a running sandbox (memory, processes, files) from one capture, e.g. a worker that has its tools installed and its app loaded. Each copy is a sandbox start: it counts toward the limits and bills at the source's size. The JSON has one entry per copy, `sandbox` or `error`; the command exits `1` if any copy failed, so delete the ones that started.
|
|
123
123
|
- **Network:** outbound internet works (mail ports are blocked), but Lizard's own hosts answer only on ports 80 and 443, so a managed Postgres or Redis URL cannot be reached from a sandbox. Work with those databases from a deployed service, or from the user's machine with `lizard run --service postgres -- <cmd>`.
|
|
124
124
|
- **Agents in a sandbox:** `lizard sandbox create -t codex --timeout 3600000`, then `lizard sandbox prompt <id> "task" --json`. Give it a real lifetime: at 5 minutes the sandbox and the agent are deleted mid-task.
|
|
@@ -345,7 +345,7 @@ tier <pro|5x|20x>`: up is charged now, prorated, and the new limits apply at onc
|
|
|
345
345
|
down starts with the next period. `lizard billing --json` shows `tier` and
|
|
346
346
|
`pendingTier`. Sandbox limits count vCPU of running sandboxes (Mini 1, Small 2,
|
|
347
347
|
Medium 4, Large 8; paused ones don't count), across all of the owner's workspaces: the trial
|
|
348
|
-
runs
|
|
348
|
+
runs 1 Small and 2 Mini at a time, Pro 40 vCPU, Pro 5x 220, Pro 20x 1,200. Sandbox
|
|
349
349
|
starts are limited only on the trial (6 a minute, 30 an hour, 100 a day); Pro,
|
|
350
350
|
Pro 5x and Pro 20x have unlimited starts. Trial
|
|
351
351
|
accounts run 1 replica per app; after the first paid invoice, 5. Pro cards are changed or removed on the Billing page;
|
|
@@ -72,7 +72,7 @@ lizard sandbox files rm <id> <path>
|
|
|
72
72
|
|
|
73
73
|
## Size and pricing
|
|
74
74
|
|
|
75
|
-
`lizard sandbox create -s/--size mini|small|medium|large` picks the machine; the default is `medium`.
|
|
75
|
+
`lizard sandbox create -s/--size mini|small|medium|large` picks the machine; the default is `medium`. The Pro trial runs 1 Small and 2 Mini 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"]`), another region 403 `TRIAL_SANDBOX_REGION`, and a second Small or a third Mini 403 `TRIAL_SIZE_RUNNING` (`size`, `sizeLimit`, `sizeLimits: {"small": 1, "mini": 2}`): pause or delete one. `lizard billing start-now` lifts these limits. There are exactly four sizes:
|
|
76
76
|
|
|
77
77
|
| Size | vCPU | RAM | Disk | Price |
|
|
78
78
|
|---|---|---|---|---|
|
|
@@ -87,7 +87,7 @@ Prices are per hour, billed per second while the sandbox runs, flat by size: mea
|
|
|
87
87
|
|
|
88
88
|
Lizard Sandboxes run as Firecracker microVMs, each with its own kernel. If a sandbox cannot start, creation fails with an error.
|
|
89
89
|
|
|
90
|
-
An account's limit counts vCPU of running sandboxes (Mini 1, Small 2, Medium 4, Large 8; paused ones don't count), across all of the owner's workspaces:
|
|
90
|
+
An account's limit counts vCPU of running sandboxes (Mini 1, Small 2, Medium 4, Large 8; paused ones don't count), across all of the owner's workspaces: 1 Small and 2 Mini at a time on the trial (counted by size, not vCPU), 40 vCPU on Pro, 220 on Pro 5x and 1,200 on Pro 20x. 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. Enterprise has no fixed limit on sandboxes running at once: each customer's agreement sets the limit per workspace, and running, paused and crashed sandboxes all count toward it. Over a limit the API answers 429 `SANDBOX_LIMIT_REACHED` (with `unit: "vcpu"`, `limit`, `running` and `needed`, all in vCPU) or `SANDBOX_RATE_LIMITED` (with `retryAfterS`).
|
|
91
91
|
|
|
92
92
|
## Interactive shell
|
|
93
93
|
|
|
@@ -143,8 +143,7 @@ lizard sandbox unschedule <sch_id>
|
|
|
143
143
|
`sandbox prompt`). Keep state in files: tell the agent to read and update a notes file.
|
|
144
144
|
- `--command` runs in `/workspace` as root; success = exit code 0. Background processes it leaves
|
|
145
145
|
end when the sandbox sleeps.
|
|
146
|
-
- Sleep is files
|
|
147
|
-
keeps processes and open apps between runs (e.g. a desktop's browser), with a slower pause.
|
|
146
|
+
- Sleep is files only (fast; processes end, the next wake boots fresh).
|
|
148
147
|
- A sandbox that was already running when a run starts is left running afterwards.
|
|
149
148
|
- A run still going when the next is due makes that one skip. `--timeout` (default 10m) stops a
|
|
150
149
|
run. Five failed runs in a row switch the schedule off (`schedules` shows why).
|
|
@@ -199,10 +198,9 @@ A volume attaches to one sandbox at a time (409 `Volume is already attached to a
|
|
|
199
198
|
|
|
200
199
|
## Snapshots and pause/resume
|
|
201
200
|
|
|
202
|
-
- `lizard sandbox snapshot <sandbox-id> --name my-app` saves the sandbox's files (about a second whatever its RAM); sandboxes started from it boot fresh with them
|
|
201
|
+
- `lizard sandbox snapshot <sandbox-id> --name my-app` saves the sandbox's files (about a second whatever its RAM); sandboxes started from it boot fresh with them (memory and running processes are not saved). You and the members of its project can list, restore and delete it. A snapshot restores only in its own project and region. A Firecracker snapshot is ready as soon as the capture ends; the command waits until ready; `--no-wait` returns the queued capture.
|
|
203
202
|
- `lizard sandbox restore <snapshot-id> [--timeout <ms>]` starts a new sandbox from it in the snapshot's project (five-minute lifetime by default); naming any other project fails with 403 `SNAPSHOT_SCOPE`. `--volume <volume>` mounts a volume at `/workspace` in the restored sandbox (Firecracker snapshots of a sandbox that had no volume attached; the volume must be in the snapshot's project and region). `sandbox create --snapshot <id> [--volume <volume>]` also works; in a folder linked to another project, add `--project` with the snapshot's project. A snapshot restores at its source's size and bills flat at that size. `--size` with `--snapshot` is an error.
|
|
204
203
|
- `lizard sandbox snapshots --project <project>` lists a project's snapshots; `--mine` lists every snapshot you took. `sandbox snapshot-rm <id>` deletes the snapshot; sandboxes already started from it keep running.
|
|
205
204
|
- `lizard sandbox fork <sandbox-id> [-n <count>] [--timeout <ms>] --json` starts 1–100 live copies of a running sandbox: the platform pauses it for a moment, captures memory, processes and files once, and boots every copy from that capture; the source keeps its id and lifetime. Use it to fan out work from one prepared sandbox (tools installed, app loaded) without repeating the setup. Each copy is a sandbox start: it counts toward the running and start limits, runs at the source's size and bills like a new sandbox. The JSON is one entry per copy, `{ "sandbox": {…} }` or `{ "error": "…" }` (for example `Sandbox limit reached`); if any copy failed the command exits `1`, and the copies that did start keep running until you delete them. `--timeout` takes at least `1000`; leave it out to keep the source's lifetime. A sandbox with a volume attached can't be forked (409), and `fork` needs a running sandbox (409 for a paused one).
|
|
206
|
-
- `lizard sandbox pause <id>` (API `POST /api/sandboxes/<id>/pause` with no body) saves files only: it stops billing in about a second whatever the sandbox's RAM, ends running processes, and `sandbox resume <id>` boots the sandbox fresh with its files
|
|
207
|
-
- `lizard sandbox pause <id> --full` (API `{"full": true}` or `{"memory": true}`, SDK `pause({ full: true })` / `pause(full=True)`) also saves memory and processes, so it takes longer the more RAM is in use (minutes for a large sandbox that filled its memory). Use it only to come back to running processes: a dev server you don't want to restart, a REPL or notebook with state, an agent mid-task. Either pause stops billing and freezes the remaining lifetime; `sandbox resume <id>` restores the same sandbox ID, files, published ports and remaining lifetime (and, after `--full`, processes and memory). The pause JSON says what was kept (`pausedWithMemory`). Both support `--no-wait`. When the pause answer (and `--json` output) carries `tip`, a faster option fits: follow it next time.
|
|
205
|
+
- `lizard sandbox pause <id>` (API `POST /api/sandboxes/<id>/pause` with no body, SDK `pause()`) saves files only: it stops billing in about a second whatever the sandbox's RAM, ends running processes, and `sandbox resume <id>` boots the sandbox fresh with its files, the same sandbox ID, published ports and remaining lifetime (`memoryRestored: false` in the resume JSON). Start your processes again after a resume. Pause freezes the remaining lifetime. Both support `--no-wait`.
|
|
208
206
|
- Disconnect clients and terminals and stop workspace writes before capturing or pausing. To reuse one snapshot across sandboxes that each keep their own data, snapshot a sandbox with no volume attached and pass `--volume` on each restore; a snapshot taken with a volume attached cannot take a different one.
|
|
@@ -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):
|
|
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). 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
|
|
|
@@ -166,8 +166,7 @@ Names are unique within a project: `getOrCreate` returns the existing volume, `c
|
|
|
166
166
|
| New lifetime from now (1000–2147483647 ms) | `sandbox.setTimeout(ms)` | `sandbox.set_timeout(ms)` |
|
|
167
167
|
| List a project's sandboxes | `Sandbox.list({ projectId })` | `Sandbox.list(project_id=...)` |
|
|
168
168
|
| Kill | `sandbox.kill()` | `sandbox.kill()` |
|
|
169
|
-
| Pause
|
|
170
|
-
| Pause keeping memory and processes (slower the more RAM is in use; only when processes must survive) and resume | `pause()`, `resume()`, `waitForStatus(s)` | `pause()`, `resume()`, `wait_for_status(s)` |
|
|
169
|
+
| Pause (files only, ~1 s at any RAM, processes end; resume boots fresh) and resume | `pause()`, `resume()`, `waitForStatus(s)` | `pause()`, `resume()`, `wait_for_status(s)` |
|
|
171
170
|
| Snapshot (about 2 s, the source keeps running) | `snapshot(name)` | `snapshot(name)` |
|
|
172
171
|
| Start a sandbox from a snapshot (about 0.4 s) | `Sandbox.restore(id)` | `Sandbox.restore(id)` |
|
|
173
172
|
| Live copies of a running sandbox (each counts toward the running limit) | `fork({ count })` | `fork(count=...)` |
|
package/src/commands/billing.ts
CHANGED
|
@@ -272,7 +272,10 @@ export function describeSubscription(sub: Subscription, now = Date.now()): strin
|
|
|
272
272
|
if (sub.limits) {
|
|
273
273
|
const n = sub.limits.replicasPerApp;
|
|
274
274
|
lines.push(label("Replicas: ") + `up to ${n} per service`);
|
|
275
|
-
if (sub.limits.
|
|
275
|
+
if (sub.limits.tier === "trial") {
|
|
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");
|
|
278
|
+
} else if (sub.limits.sandboxVcpu) {
|
|
276
279
|
lines.push(label("Sandboxes: ") + `up to ${sub.limits.sandboxVcpu.toLocaleString("en-US")} vCPU at once`);
|
|
277
280
|
}
|
|
278
281
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import fs from "node:fs";
|
|
3
|
-
import { Command, InvalidArgumentError } from "commander";
|
|
3
|
+
import { Command, InvalidArgumentError, Option } from "commander";
|
|
4
4
|
import { api } from "../lib/api.js";
|
|
5
5
|
import { success, info, isJSONMode, printJSON, table, timeAgo, fail } from "../lib/format.js";
|
|
6
6
|
|
|
@@ -51,7 +51,7 @@ function printSchedule(s: Schedule) {
|
|
|
51
51
|
console.log(` sandbox ${s.sandboxId}`);
|
|
52
52
|
console.log(` when ${when(s)}${s.enabled && s.nextRunAt ? chalk.dim(` (next ${inFuture(s.nextRunAt)})`) : ""}`);
|
|
53
53
|
console.log(` runs ${what(s)}`);
|
|
54
|
-
console.log(` timeout ${s.timeoutSeconds}s${s.keepMemory ? " sleeps with memory" : "
|
|
54
|
+
console.log(` timeout ${s.timeoutSeconds}s${s.keepMemory ? " sleeps with memory" : ""}`);
|
|
55
55
|
if (s.lastRunAt) console.log(` last run ${runStatus(s.running ? "running" : s.lastStatus)} ${chalk.dim(timeAgo(s.lastRunAt))}`);
|
|
56
56
|
if (s.disabledReason) console.log(chalk.yellow(` off: ${s.disabledReason}`));
|
|
57
57
|
}
|
|
@@ -68,8 +68,10 @@ function addTaskOptions(c: Command, forCreate: boolean) {
|
|
|
68
68
|
.option("-m, --model <model>", "Model for --prompt")
|
|
69
69
|
.option("--effort <level>", "Reasoning effort for --prompt (minimal, low, medium, high, xhigh)")
|
|
70
70
|
.option("--timeout <duration>", forCreate ? "Stop a run after this long (default 10m)" : "Stop a run after this long", parseDuration)
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
// Memory pauses are off for now: a schedule always sleeps files-only. Both flags stay
|
|
72
|
+
// accepted (out of the help) so older scripts still run; --keep-memory is not sent.
|
|
73
|
+
.addOption(new Option("--keep-memory").hideHelp())
|
|
74
|
+
.addOption(new Option("--files-only").hideHelp())
|
|
73
75
|
.option("--name <name>", "A label for the schedule");
|
|
74
76
|
}
|
|
75
77
|
|
|
@@ -85,7 +87,6 @@ function taskBody(opts: Record<string, any>): Record<string, unknown> {
|
|
|
85
87
|
if (opts.model) body.model = opts.model;
|
|
86
88
|
if (opts.effort) body.reasoningEffort = opts.effort;
|
|
87
89
|
if (opts.timeout) body.timeoutSeconds = opts.timeout;
|
|
88
|
-
if (opts.keepMemory) body.keepMemory = true;
|
|
89
90
|
if (opts.filesOnly) body.keepMemory = false;
|
|
90
91
|
if (opts.name) body.name = opts.name;
|
|
91
92
|
return body;
|
|
@@ -101,9 +102,8 @@ export function registerSandboxScheduleCommands(sb: Command) {
|
|
|
101
102
|
.option("--disabled", "Create it switched off")
|
|
102
103
|
.addHelpText("after", `
|
|
103
104
|
Each run: a paused sandbox is woken (about a second), the prompt or command runs, and the
|
|
104
|
-
sandbox goes back to sleep. A sandbox that was already running is
|
|
105
|
-
while it is awake. Files in /workspace carry over between runs
|
|
106
|
-
processes and open apps (a desktop's browser) do too.
|
|
105
|
+
sandbox goes back to sleep (files only: processes end). A sandbox that was already running is
|
|
106
|
+
left running. You pay only while it is awake. Files in /workspace carry over between runs.
|
|
107
107
|
|
|
108
108
|
A run that is still going when the next one is due makes that one skip. Five failed runs in
|
|
109
109
|
a row switch the schedule off.
|
|
@@ -111,8 +111,7 @@ a row switch the schedule off.
|
|
|
111
111
|
Examples:
|
|
112
112
|
lizard sandbox schedule sb_abc123 --every 5m --prompt "Continue the research in /workspace/research; append findings to notes.md"
|
|
113
113
|
lizard sandbox schedule sb_abc123 --every 10m --command "python3 /workspace/job.py"
|
|
114
|
-
lizard sandbox schedule sb_abc123 --cron "0 9 * * mon-fri" --tz Europe/Berlin --command "./report.sh"
|
|
115
|
-
lizard sandbox schedule sb_desktop --every 30m --keep-memory --command "node /workspace/check.js"`)
|
|
114
|
+
lizard sandbox schedule sb_abc123 --cron "0 9 * * mon-fri" --tz Europe/Berlin --command "./report.sh"`)
|
|
116
115
|
.action(async (id: string, opts) => {
|
|
117
116
|
if (!opts.every && !opts.cron) fail("Say how often: --every 5m, or --cron \"*/5 * * * *\"", 2, "USAGE");
|
|
118
117
|
if (!opts.prompt && !opts.promptFile && !opts.command) fail("Say what to run: --prompt \"...\" or --command \"...\"", 2, "USAGE");
|
package/src/commands/sandbox.ts
CHANGED
|
@@ -174,7 +174,7 @@ export function registerSandbox(program: Command) {
|
|
|
174
174
|
sb.command("create")
|
|
175
175
|
.description("Create a sandbox")
|
|
176
176
|
.option("-t, --template <name>", `Template (${TEMPLATE_HINT}; server validates)`, "base")
|
|
177
|
-
.addOption(new Option("-s, --size <size>", `Machine size (${SIZE_HINT}); default medium, small on the Pro trial (US regions only). Mini works only with the ${MINI_TEMPLATES} templates`).choices(SANDBOX_SIZES))
|
|
177
|
+
.addOption(new Option("-s, --size <size>", `Machine size (${SIZE_HINT}); default medium, small on the Pro trial (1 Small and 2 Mini at a time, US regions only; Medium and Large unlock after the first payment). Mini works only with the ${MINI_TEMPLATES} templates`).choices(SANDBOX_SIZES))
|
|
178
178
|
.option("--timeout <ms>", "Lifetime in milliseconds; 0 disables expiration", parseTimeoutOption, 300_000)
|
|
179
179
|
.option("--region <code>", `Region to create the sandbox in (default ${DEFAULT_REGION}; with --volume or --snapshot, theirs)`)
|
|
180
180
|
.option("--snapshot <id>", "Create from a private saved snapshot, at the size it was taken at")
|
|
@@ -604,26 +604,24 @@ Examples:
|
|
|
604
604
|
// older scripts still run; it is no longer sent.
|
|
605
605
|
.addOption(new Option("--scope <scope>").choices(SNAPSHOT_SCOPES).hideHelp())
|
|
606
606
|
.option("--no-wait", "Return once capture is queued")
|
|
607
|
-
//
|
|
608
|
-
//
|
|
609
|
-
//
|
|
610
|
-
.
|
|
611
|
-
.
|
|
612
|
-
.description("Save a running sandbox's files
|
|
607
|
+
// Snapshots are files only: about a second whatever the RAM, sandboxes started from it boot
|
|
608
|
+
// fresh. Memory snapshots are off for now; --full/--fast stay accepted (out of the help) so
|
|
609
|
+
// older scripts still run, and are not sent: the platform's default applies.
|
|
610
|
+
.addOption(new Option("--full").hideHelp())
|
|
611
|
+
.addOption(new Option("--fast").hideHelp())
|
|
612
|
+
.description("Save a running sandbox's files")
|
|
613
613
|
.action(async (id: string, opts) => {
|
|
614
|
-
if (opts.full && opts.fast) throw new Error("Use either --full or --fast, not both");
|
|
615
614
|
if (opts.scope && opts.scope !== "project") warn(`--scope ${opts.scope} has no effect: a snapshot now restores only in its own project.`);
|
|
615
|
+
if (opts.full) warn("--full has no effect: snapshots keep files only.");
|
|
616
616
|
// No pool size: Firecracker and gVisor snapshots keep no warm copies, and a runc pod
|
|
617
617
|
// (the fallback when a Firecracker create fails) gets the server's default.
|
|
618
|
-
const
|
|
619
|
-
const taken = await api.post<SnapshotRecord & { withMemory?: boolean; fastSnapshotUnavailable?: string }>(`/api/sandboxes/${id}/snapshot`, { name: opts.name, ...choice });
|
|
618
|
+
const taken = await api.post<SnapshotRecord & { withMemory?: boolean; fastSnapshotUnavailable?: string }>(`/api/sandboxes/${id}/snapshot`, { name: opts.name });
|
|
620
619
|
let snapshot: SnapshotRecord = taken;
|
|
621
620
|
if (opts.wait) snapshot = await waitForSnapshot(taken.id);
|
|
622
|
-
if (isJSONMode()) printJSON({ ...snapshot, ...(taken.withMemory !== undefined ? { withMemory: taken.withMemory } : {})
|
|
621
|
+
if (isJSONMode()) printJSON({ ...snapshot, ...(taken.withMemory !== undefined ? { withMemory: taken.withMemory } : {}) });
|
|
623
622
|
else {
|
|
624
|
-
success(`Snapshot ${chalk.bold(snapshot.id)}: ${snapshot.status}
|
|
625
|
-
if (taken.withMemory === false) info(
|
|
626
|
-
if (taken.fastSnapshotUnavailable) info(taken.fastSnapshotUnavailable + ".");
|
|
623
|
+
success(`Snapshot ${chalk.bold(snapshot.id)}: ${snapshot.status}`);
|
|
624
|
+
if (taken.withMemory === false) info("Sandboxes started from it boot fresh with these files.");
|
|
627
625
|
}
|
|
628
626
|
});
|
|
629
627
|
|
|
@@ -631,32 +629,26 @@ Examples:
|
|
|
631
629
|
const cmd = sb.command(operation)
|
|
632
630
|
.argument("<id>", "Sandbox ID")
|
|
633
631
|
.option("--no-wait", "Return once the operation is queued");
|
|
634
|
-
//
|
|
635
|
-
// resume boots fresh)
|
|
636
|
-
//
|
|
637
|
-
// (not "full") so it also works against servers older than the "full" name.
|
|
632
|
+
// One kind of pause: the platform's default (files only, about a second whatever the RAM;
|
|
633
|
+
// processes end and the resume boots fresh). Memory pauses are off for now; --full/--fast stay
|
|
634
|
+
// accepted (out of the help) so older scripts still run, and send nothing.
|
|
638
635
|
if (operation === "pause") {
|
|
639
|
-
cmd.
|
|
640
|
-
cmd.
|
|
636
|
+
cmd.addOption(new Option("--full").hideHelp());
|
|
637
|
+
cmd.addOption(new Option("--fast").hideHelp());
|
|
641
638
|
}
|
|
642
639
|
cmd
|
|
643
|
-
.description(operation === "pause" ? "Pause the sandbox: keeps its files
|
|
640
|
+
.description(operation === "pause" ? "Pause the sandbox: keeps its files, ends running processes" : "Restore a paused sandbox with its saved files")
|
|
644
641
|
.action(async (id: string, opts) => {
|
|
645
|
-
if (operation === "pause" && opts.full
|
|
646
|
-
const
|
|
647
|
-
const queued = await api.post<{ id: string; status: string; snapshotId?: string; memoryRestored?: boolean; pausedWithMemory?: boolean; fastPauseUnavailable?: string; tip?: string }>(`/api/sandboxes/${id}/${operation}`, choice);
|
|
642
|
+
if (operation === "pause" && opts.full) warn("--full has no effect: pause keeps files only.");
|
|
643
|
+
const queued = await api.post<{ id: string; status: string; snapshotId?: string; memoryRestored?: boolean; pausedWithMemory?: boolean }>(`/api/sandboxes/${id}/${operation}`, {});
|
|
648
644
|
if (opts.wait && operation === 'pause' && queued.snapshotId) await waitForSnapshot(queued.snapshotId);
|
|
649
645
|
const result = opts.wait ? await waitForSandbox(id, operation === "pause" ? "paused" : "running") : queued;
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
if (isJSONMode()) printJSON({ ...result, ...(operation === "resume" && queued.memoryRestored !== undefined ? { memoryRestored: queued.memoryRestored } : {}), ...(operation === "pause" && queued.pausedWithMemory !== undefined ? { pausedWithMemory: queued.pausedWithMemory } : {}), ...(queued.fastPauseUnavailable ? { fastPauseUnavailable: queued.fastPauseUnavailable } : {}), ...(queued.tip ? { tip: queued.tip } : {}) });
|
|
646
|
+
const filesOnly = operation === "pause" && queued.pausedWithMemory === false;
|
|
647
|
+
if (isJSONMode()) printJSON({ ...result, ...(operation === "resume" && queued.memoryRestored !== undefined ? { memoryRestored: queued.memoryRestored } : {}), ...(operation === "pause" && queued.pausedWithMemory !== undefined ? { pausedWithMemory: queued.pausedWithMemory } : {}) });
|
|
653
648
|
else {
|
|
654
|
-
success(`Sandbox ${chalk.bold(id)}: ${result.status}
|
|
655
|
-
if (filesOnly) info(
|
|
656
|
-
if (queued.
|
|
657
|
-
// The server says when a faster option fits (a large sandbox paused with its memory).
|
|
658
|
-
if (queued.tip) info(`Tip: ${queued.tip.replace('{"fast": true} (CLI: pause --fast)', chalk.bold(`lizard sandbox pause ${id} --fast`))}`);
|
|
659
|
-
if (operation === "resume" && queued.memoryRestored === false) info("It was paused without memory: booted fresh with its files; start your processes again.");
|
|
649
|
+
success(`Sandbox ${chalk.bold(id)}: ${result.status}`);
|
|
650
|
+
if (filesOnly) info("Processes ended. Resume boots it fresh with your files intact.");
|
|
651
|
+
if (operation === "resume" && queued.memoryRestored === false) info("Booted fresh with its files; start your processes again.");
|
|
660
652
|
}
|
|
661
653
|
});
|
|
662
654
|
}
|
package/src/index.ts
CHANGED
|
@@ -484,6 +484,8 @@ async function main() {
|
|
|
484
484
|
? `${baseMsg}\n Your key is limited to specific workspaces or projects. Run this with an unscoped key, or see per-workspace spend with \`lizard metrics\`.`
|
|
485
485
|
: limitCode === "WORKSPACE_SANDBOX_LIMIT"
|
|
486
486
|
? `${baseMsg}\n \`lizard sandbox list\` shows them; \`lizard sandbox pause <id>\` or \`lizard sandbox rm <id>\` frees one. Limits: \`lizard workspace limits <workspace>\`.`
|
|
487
|
+
: limitCode === "TRIAL_SIZE_RUNNING" || limitCode === "TRIAL_MEDIUM_RUNNING"
|
|
488
|
+
? `${baseMsg}\n \`lizard sandbox list --all\` shows them; \`lizard sandbox pause <id>\` or \`lizard sandbox rm <id>\` frees one.`
|
|
487
489
|
: limitCode === "WORKSPACE_USAGE_LIMIT"
|
|
488
490
|
? `${baseMsg}\n \`lizard workspace limits <workspace>\` shows use against the limits; \`lizard metrics\` shows each service. Free CPU/memory by stopping or scaling down a service, SSD by deleting data or a volume; the workspace owner can raise them.`
|
|
489
491
|
: causeDetail && !baseMsg.includes(causeDetail)
|
package/src/lib/updater.ts
CHANGED
|
@@ -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.
|
|
8
|
+
export const CURRENT_VERSION = "4.0.116";
|
|
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
|
|
|
@@ -174,6 +174,19 @@ describe("lizard billing (status)", () => {
|
|
|
174
174
|
expect(text).toContain("Sandboxes: up to 1,200 vCPU at once");
|
|
175
175
|
});
|
|
176
176
|
|
|
177
|
+
test("the trial shows its sandbox sizes instead of a vCPU limit", async () => {
|
|
178
|
+
routes({
|
|
179
|
+
"GET /api/billing/subscription": () => reply(200, {
|
|
180
|
+
...paid, tiers,
|
|
181
|
+
limits: { tier: "trial", replicasPerApp: 1, sandboxVcpu: 8, maxSandboxCpus: 4 },
|
|
182
|
+
}),
|
|
183
|
+
});
|
|
184
|
+
await run(["billing"]);
|
|
185
|
+
const text = out();
|
|
186
|
+
expect(text).toContain("Sandboxes: 1 Small and 2 Mini at a time (US regions only)");
|
|
187
|
+
expect(text).not.toContain("vCPU at once");
|
|
188
|
+
});
|
|
189
|
+
|
|
177
190
|
test("no plan offers the trial", async () => {
|
|
178
191
|
routes({ "GET /api/billing/subscription": () => reply(200, { ...none, trial: { ...none.trial, promoCode: "ROST", days: 31, creditCents: 10000 } }) });
|
|
179
192
|
await run(["billing"]);
|
|
@@ -228,10 +228,10 @@ describe("private sandbox snapshots", () => {
|
|
|
228
228
|
expect(api.post).toHaveBeenCalledWith('/api/sandboxes/sandbox-test/snapshot', { name: 'My app' });
|
|
229
229
|
expect(warn).not.toHaveBeenCalled();
|
|
230
230
|
});
|
|
231
|
-
it.each([[
|
|
231
|
+
it.each([['--full'], ['--fast']])("snapshot still takes %s from older scripts and sends no memory choice", async flag => {
|
|
232
232
|
const program = new Command().exitOverride(); registerSandbox(program);
|
|
233
|
-
await program.parseAsync(['sandbox', 'snapshot', 'sandbox-test', '--name', 'My app',
|
|
234
|
-
expect(api.post).toHaveBeenCalledWith('/api/sandboxes/sandbox-test/snapshot', { name: 'My app'
|
|
233
|
+
await program.parseAsync(['sandbox', 'snapshot', 'sandbox-test', '--name', 'My app', flag, '--no-wait'], { from: 'user' });
|
|
234
|
+
expect(api.post).toHaveBeenCalledWith('/api/sandboxes/sandbox-test/snapshot', { name: 'My app' });
|
|
235
235
|
});
|
|
236
236
|
it.each(['user', 'workspace'])("still takes --scope %s from older scripts, warns and sends no scope", async scope => {
|
|
237
237
|
const program = new Command().exitOverride(); registerSandbox(program);
|
|
@@ -279,19 +279,12 @@ describe("private sandbox snapshots", () => {
|
|
|
279
279
|
await program.parseAsync(['sandbox', operation, 'sandbox-test', '--no-wait'], { from: 'user' });
|
|
280
280
|
expect(api.post).toHaveBeenCalledWith(`/api/sandboxes/sandbox-test/${operation}`, {});
|
|
281
281
|
});
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
[['--fast'], { memory: false }],
|
|
286
|
-
])("pause %j sends %j", async (flags, body) => {
|
|
282
|
+
// Memory pauses are off: every pause is the platform's default (files only); the old flags
|
|
283
|
+
// are still accepted so older scripts run, and send nothing.
|
|
284
|
+
it.each([[[]], [['--full']], [['--fast']], [['--full', '--fast']]])("pause %j sends the default pause", async flags => {
|
|
287
285
|
const program = new Command().exitOverride(); registerSandbox(program);
|
|
288
286
|
await program.parseAsync(['sandbox', 'pause', 'sandbox-test', ...flags as string[], '--no-wait'], { from: 'user' });
|
|
289
|
-
expect(api.post).toHaveBeenCalledWith('/api/sandboxes/sandbox-test/pause',
|
|
290
|
-
});
|
|
291
|
-
it("refuses --full together with --fast", async () => {
|
|
292
|
-
const program = new Command().exitOverride(); registerSandbox(program);
|
|
293
|
-
await expect(program.parseAsync(['sandbox', 'pause', 'sandbox-test', '--full', '--fast', '--no-wait'], { from: 'user' })).rejects.toThrow(/either --full or --fast/);
|
|
294
|
-
expect(api.post).not.toHaveBeenCalled();
|
|
287
|
+
expect(api.post).toHaveBeenCalledWith('/api/sandboxes/sandbox-test/pause', {});
|
|
295
288
|
});
|
|
296
289
|
it("passes the private snapshot ID to create", async () => {
|
|
297
290
|
await create(['--snapshot', 'snap-test']);
|