@lizard-build/cli 4.0.113 → 4.0.115

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.
@@ -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, preferred (files only, ~1 s at any RAM, processes end; resume boots fresh) | `pause({ fast: true })` | `pause(fast=True)` |
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=...)` |
@@ -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" : " sleeps files-only"}`);
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
- .option("--keep-memory", "Sleep with memory: processes and open apps survive between runs (slower pause)")
72
- .option("--files-only", "Sleep with files only (the default): fast, processes end")
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 left running. You pay only
105
- while it is awake. Files in /workspace carry over between runs; with --keep-memory, running
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");
@@ -187,7 +186,7 @@ Examples:
187
186
  for (let i = 0; i < 24 * 60 * 6; i++) {
188
187
  await new Promise((r) => setTimeout(r, 5000));
189
188
  const { runs } = await api.get<{ runs: Run[] }>(`/api/sandbox-schedules/${sid}/runs?limit=1`);
190
- if (runs[0] && runs[0].id !== prev) { run = runs[0]; if (run.status !== "running") break; }
189
+ if (runs[0] && runs[0].id !== prev) { run = runs[0]; if (run.endedAt) break; }
191
190
  }
192
191
  if (isJSONMode()) return printJSON(run ?? null);
193
192
  if (run) printRun(run, true);
@@ -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
- // Files only by default (the platform's): about a second whatever the RAM, sandboxes started
608
- // from it boot fresh. --full keeps memory and processes too. Sent as memory: true/false, which
609
- // servers older than the "full" name accept; no flag = the platform's default.
610
- .option("--full", "Also save memory and running processes: sandboxes started from it continue where this one was (slower to take)")
611
- .option("--fast", "Files only (the default)")
612
- .description("Save a running sandbox's files (--full: also its memory and running processes)")
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 choice = opts.full ? { memory: true } : opts.fast ? { memory: false } : {};
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 } : {}), ...(taken.fastSnapshotUnavailable ? { fastSnapshotUnavailable: taken.fastSnapshotUnavailable } : {}) });
621
+ if (isJSONMode()) printJSON({ ...snapshot, ...(taken.withMemory !== undefined ? { withMemory: taken.withMemory } : {}) });
623
622
  else {
624
- success(`Snapshot ${chalk.bold(snapshot.id)}: ${snapshot.status}${taken.withMemory === true ? " (with memory)" : taken.withMemory === false ? " (files only)" : ""}`);
625
- if (taken.withMemory === false) info(`Sandboxes started from it boot fresh with these files (use ${chalk.bold("--full")} to keep running processes).`);
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
- // Two kinds of pause. Fast (files only, about a second whatever the RAM; processes end and the
635
- // resume boots fresh) is the platform's default. --full keeps memory and running processes.
636
- // Neither flag sends no choice, so the platform's default applies. --full sends {"memory": true}
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.option("--full", "Keep memory and running processes too (slower pause, resume picks up where it left off)");
640
- cmd.option("--fast", "Same as a plain pause: keep files only and end processes");
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 (--full: also its memory and running processes)" : "Restore a paused sandbox with its saved files (and memory, if paused with --full)")
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 && opts.fast) throw new Error("Use either --full or --fast, not both");
646
- const choice = operation !== "pause" ? {} : opts.full ? { memory: true } : opts.fast ? { memory: false } : {};
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
- // What the pause actually kept: the answer says (the default is the platform's to choose).
651
- const filesOnly = operation === "pause" && (queued.pausedWithMemory === false || (queued.pausedWithMemory === undefined && !!opts.fast));
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}${filesOnly ? " (files only)" : operation === "pause" && queued.pausedWithMemory === true ? " (with memory)" : ""}`);
655
- if (filesOnly) info(`Processes ended. Resume boots it fresh with your files intact (use ${chalk.bold("--full")} to keep running processes).`);
656
- if (queued.fastPauseUnavailable) info(`Kept memory: ${queued.fastPauseUnavailable.replace(/; paused with memory instead$/, "")}.`);
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
  }
@@ -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.113";
8
+ export const CURRENT_VERSION = "4.0.115";
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
 
@@ -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([[['--full'], { memory: true }], [['--fast'], { memory: false }]])("snapshot %j sends %j", async (flags, choice) => {
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', ...flags as string[], '--no-wait'], { from: 'user' });
234
- expect(api.post).toHaveBeenCalledWith('/api/sandboxes/sandbox-test/snapshot', { name: 'My app', ...choice });
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
- it.each([
283
- [[], {}], // no choice: the platform's default (files only)
284
- [['--full'], { memory: true }], // memory + processes; "memory" works on older servers
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', body);
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']);