@lizard-build/cli 4.0.114 → 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.
- package/dist/commands/sandbox-schedules.js +9 -11
- package/dist/commands/sandbox-schedules.js.map +1 -1
- package/dist/commands/sandbox.js +26 -37
- package/dist/commands/sandbox.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 +2 -2
- package/skill-data/core/references/sandboxes.md +3 -5
- package/skill-data/core/references/sdk.md +1 -2
- package/src/commands/sandbox-schedules.ts +9 -10
- package/src/commands/sandbox.ts +24 -32
- package/src/lib/updater.ts +1 -1
- package/test/unit/sandbox.test.ts +7 -14
|
@@ -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=...)` |
|
|
@@ -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
|
@@ -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/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.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([[
|
|
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']);
|