instabox 0.8.133 → 0.8.134
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/bin/instabox.mjs +21 -12
- package/cli/SHA256SUMS +6 -6
- package/cli/instabox-darwin-amd64 +0 -0
- package/cli/instabox-darwin-arm64 +0 -0
- package/cli/instabox-linux-amd64 +0 -0
- package/cli/instabox-linux-arm64 +0 -0
- package/cli/instabox-windows-amd64.exe +0 -0
- package/cli/instabox-windows-arm64.exe +0 -0
- package/package.json +1 -1
- package/skills/instabox/SKILL.md +2 -2
package/bin/instabox.mjs
CHANGED
|
@@ -245,8 +245,10 @@ async function newBox() {
|
|
|
245
245
|
return { id: op.machineId, name: body.name, user };
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
// Runs while the box starts; never fatal. Returns a line to print, or null
|
|
249
|
-
//
|
|
248
|
+
// Runs while the box starts; never fatal. Returns a line to print, or null: a string, or
|
|
249
|
+
// { line, tryLs, more } when `instabox ls` is worth suggesting after it (reportInstalls decides).
|
|
250
|
+
// The CLI comes from this package only (cli/<build>); without one for this machine there is
|
|
251
|
+
// nothing to install.
|
|
250
252
|
async function ensureCli() {
|
|
251
253
|
if (process.argv.includes('--no-cli')) return null;
|
|
252
254
|
const found = findCli();
|
|
@@ -269,7 +271,7 @@ async function ensureBundledCli(bundled, found) {
|
|
|
269
271
|
if (found) {
|
|
270
272
|
const [version, have] = await Promise.all([cliVersion(found), sha256File(found).catch(() => null)]);
|
|
271
273
|
const v = version ? ` ${version}` : '';
|
|
272
|
-
if (want && have === want) return `instabox CLI${v} is up to date
|
|
274
|
+
if (want && have === want) return { line: `instabox CLI${v} is up to date`, tryLs: true };
|
|
273
275
|
if (version === 'dev' || version?.endsWith('-dirty'))
|
|
274
276
|
return `instabox CLI at ${found} is a development build (${version}), left as is`;
|
|
275
277
|
// Replace it where it is, through a symlink the file it points to, so whatever manages the
|
|
@@ -286,20 +288,27 @@ async function ensureBundledCli(bundled, found) {
|
|
|
286
288
|
}
|
|
287
289
|
const r = await installBundled(bundled, { path: real(found) });
|
|
288
290
|
if (r.error) return `instabox CLI${v} at ${found} could not be updated ${dim(`(${r.error})`)}`;
|
|
289
|
-
return `instabox CLI updated${v ? ` from${v}` : ''} to ${r.version} at ${found}
|
|
291
|
+
return { line: `instabox CLI updated${v ? ` from${v}` : ''} to ${r.version} at ${found}`, tryLs: true };
|
|
290
292
|
}
|
|
291
293
|
const r = await installBundled(bundled);
|
|
292
294
|
if (r.error) return `instabox CLI not installed ${dim(`(${r.error})`)}`;
|
|
293
|
-
return
|
|
294
|
-
`instabox CLI ${r.version} installed at ${r.path}
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
return {
|
|
296
|
+
line: `instabox CLI ${r.version} installed at ${r.path}`,
|
|
297
|
+
tryLs: true,
|
|
298
|
+
more: r.pathHint ? `\n ${dim('add it to your PATH:')} ${r.pathHint}` : '',
|
|
299
|
+
};
|
|
297
300
|
}
|
|
298
301
|
|
|
299
302
|
// Waits for the CLI install started earlier, installs the skills, and prints a line for each.
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
+
// With boxShellNext the box's shell opens right after, so no `instabox ls` hint: it would read
|
|
304
|
+
// as something to type in the box, where the CLI is not signed in.
|
|
305
|
+
async function reportInstalls(cli, { boxShellNext = false } = {}) {
|
|
306
|
+
const r = await cli;
|
|
307
|
+
if (r) {
|
|
308
|
+
const { line, tryLs = false, more = '' } = typeof r === 'string' ? { line: r } : r;
|
|
309
|
+
const hint = tryLs && !boxShellNext ? ` ${dim('· try')} instabox ls` : '';
|
|
310
|
+
console.log(` ${green('✓')} ${line}${hint}${more}`);
|
|
311
|
+
}
|
|
303
312
|
if (process.argv.includes('--no-skills')) return;
|
|
304
313
|
const roots = skillRoots([]);
|
|
305
314
|
const skillsLine = describeSkills(installSkills(roots));
|
|
@@ -481,7 +490,7 @@ async function onboard(wantBox) {
|
|
|
481
490
|
process.stdout.write(`\r ${green('✓')} box ${bold(m.name)} ${ready}\n`);
|
|
482
491
|
const note = guestUserNote(box.user, m.name, m.guestUser);
|
|
483
492
|
if (note) console.log(dim(` ${note}`));
|
|
484
|
-
await reportInstalls(cli);
|
|
493
|
+
await reportInstalls(cli, { boxShellNext: true });
|
|
485
494
|
await report('ready', { box_ready_ms: boxMs, ssh: true });
|
|
486
495
|
console.log(dim(` type ${'exit'} to leave · stuck? press Enter, then ~.`));
|
|
487
496
|
// The box's prompt is ~37 columns; narrower terminals make bash scroll the input line sideways.
|
package/cli/SHA256SUMS
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
5a9d1cbd350716ffbdf1d51cbb2276038794fcd5938db8bd90bcc3498b3f9ec9 instabox-darwin-amd64
|
|
2
|
+
4fce48be7129c24421e17aecdfcad2b3549977773ebb63aaa24b1d489d2216a7 instabox-darwin-arm64
|
|
3
|
+
4d16b9f212202a5d61c86e4fb51221cefbed02e36a9fe44e73942565fcd33149 instabox-linux-amd64
|
|
4
|
+
c6748aab4942dc21b9d464ff8e19f2eafd2ef96ea450598f6d73ebb64c64d98a instabox-linux-arm64
|
|
5
|
+
ad0765a08a81a602cc7cbf4cb182c086a8cca5269a9cf2215de07d5a17c4411d instabox-windows-amd64.exe
|
|
6
|
+
32bd9aae564b378ad550b005a5495a35889e22f37b80dbeba5d9dd943ea5db15 instabox-windows-arm64.exe
|
|
Binary file
|
|
Binary file
|
package/cli/instabox-linux-amd64
CHANGED
|
Binary file
|
package/cli/instabox-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/skills/instabox/SKILL.md
CHANGED
|
@@ -88,7 +88,7 @@ instabox rm --yes work # delete the box (without --yes
|
|
|
88
88
|
- `create --devcontainer [PATH|DIR]` (also `run --devcontainer`) builds a box from a repo's devcontainer.json (default `.devcontainer/devcontainer.json` or `.devcontainer.json` here; JSONC): it pushes the repo into `workspaceFolder` (default `/workspaces/<dir>`), writes `containerEnv`/`remoteEnv` to `/etc/profile.d/instabox-devcontainer.sh` (login shells, nested `bash -l` and `instabox ssh BOX -- cmd` all get it; `PATH` entries appear once), installs `features` via their install.sh (ones the template already has, such as node/python/go/docker-in-docker/github-cli at the default version, are skipped), and runs `onCreateCommand`/`updateContentCommand`/`postCreateCommand`/`postStartCommand` in the workspace. Do not install the Dev Containers CLI in a box for this. `image`/`build`/compose are not booted (boxes are VM templates); the summary (stderr, or `--json`'s `devcontainer`: `applied`, `skipped`, `ports`, `steps`, `status`, `failedStep`) says what was skipped, and `forwardPorts` come with `instabox port-forward`/`port publish` commands. A failed step exits with its code and keeps the box (`metadata.setupStep` names it); `--name` defaults to the config's name. `${devcontainerId}` is the box's name; the summary shows commands as written (a `${localEnv:TOKEN}` is not printed), but the profile file keeps env values (readable by root and the box user's group, and in snapshots). In `run`, write `--devcontainer=PATH` when a command follows without `--`.
|
|
89
89
|
- Idle auto-pause defaults to 30 minutes. Paid boxes allow any whole minute from 5 to 30 (a part minute, below 5m or above 30m is refused, nothing created), or `0` to turn it off. Free boxes keep 30 minutes unless an admin grants an idle override; asking another value on a free box fails (`spec_not_allowed`, exit 5, nothing created), so leave `--auto-suspend` out there. Idle means no agent working, no terminal use and little CPU. `create --json` and `get --json` show the effective setting as `autoSuspendAfterSeconds` (`0`: off), and `readyAt` minus `createdAt` is the create time.
|
|
90
90
|
- Max run minutes is independent of idle activity: `-1` is unlimited, `0` pauses immediately, and a positive integer forces a pause after that many running minutes. Free boxes have a fixed 480-minute cap that only an admin session can change; paid boxes default to `-1` and can change it. An idle override does not permit changes to a free box's runtime cap. The first limit reached pauses the box; both timers restart after sleep and wake.
|
|
91
|
-
- A runtime pause blocks every wake path during a server-configured cooldown, 5 to 20 minutes by default (`409 machine_cooldown` with `Retry-After`). Wait until the `cooldownUntil` deadline shown by `instabox get`; edits cannot clear it. Afterward,
|
|
91
|
+
- A runtime pause blocks every wake path during a server-configured cooldown, 5 to 20 minutes by default (`409 machine_cooldown` with `Retry-After`). Wait until the `cooldownUntil` deadline shown by `instabox get`; edits cannot clear it. Afterward, a box that paused itself (idle or runtime) wakes on `exec`, `ssh`, `files`, a public port request or `instabox wake <box>`. A box you paused (`instabox suspend`) or stopped does not wake on any of these, `wake` included: run `instabox resume <box>` or `instabox start <box>`. A zero runtime cap must be changed before waking. A normal pause preserves memory and processes.
|
|
92
92
|
- `sudo reboot` inside a box reboots it: `instabox get` shows `starting`, then `running` (same disks, processes gone); wait for `running` before the next `exec`. `sudo poweroff` inside stops it until `instabox start`. Boxes from older template versions stop on a reboot too: start them.
|
|
93
93
|
- If `exec`/`ssh` stop answering (hang or time out on a running box), run `instabox restart <box>` (alias `recover`; `--timeout 20s` shortens the wait, `--json` prints the box). It stops the box, killing the VM if it has not shut down by the timeout (60 seconds by default), then starts it and waits until it runs. Files on the root disk and `/data` stay; processes do not, so start your servers again. A paused box is not hung: resume it. A box stuck in `starting` with no start in progress cannot be restarted; restart says so.
|
|
94
94
|
- Disk full (`df -h /data`)? Grow it with `instabox resize <box> --disk N` (`/data`, where HOME is), in GB. A running box grows online, no restart. A shrink, a paused box, or an image that can't grow online needs `--restart` (it stops the box, resizes the disk and starts it again; files stay, processes do not), else resize changes nothing and says so. A shrink must fit your data plus 10% (at least 1 GB), else it's refused (`disk_too_small`) and nothing changes. Free-plan boxes keep their size. The system disk (`/`) is the template's; you can't grow it.
|
|
@@ -107,7 +107,7 @@ instabox rm --yes work # delete the box (without --yes
|
|
|
107
107
|
- Output: `--json` (or `-o json`) works on every command (each command's `-h` lists it); the only exceptions are `ssh`, `mosh` and `port-forward`, which are interactive and refuse it with the JSON error code `json_unsupported` (use `exec --json`). With JSON output a failure prints `{"error":{"code","message",...}}` on stdout instead of text on stderr and still exits non-zero (2 for usage errors, code `usage`); API errors keep the server's `code`, `status`, `requestId` and `retryable` (present when true). Piped, the list and status commands (`ls`, `get`, `templates`, `usage`, `snapshot ls`, `port ls`, `keys ls`, `secrets ls`, `vault ls`, `workspace ls|get|members|invites`) print JSON on their own, so `instabox ls | jq` works; `--output table` or `INSTABOX_NO_AUTO_JSON=1` keeps the table. `exec`, `ssh`, `files` and the other commands print the same output piped or not.
|
|
108
108
|
- Exit codes: a failed command exits 1 for any other error, 2 usage, 3 auth (not signed in, a bad or expired key, no permission: 401/403), 4 not found (404), 5 quota or plan limit (`quota_exceeded`, `credit_exhausted`, `spend_limit_reached`, `spec_not_allowed`, other 402/429), 75 retryable (`retryable: true`, such as `no_capacity` and `host_unavailable`, or another 5xx; retry with backoff). `--json` errors exit the same way. Commands that run something (`exec`, `ssh`, `jobs wait`, `output`, `run`, ...) exit with its code instead. Branch on the code (`case $? in 4) ...`), not on message text.
|
|
109
109
|
- The box's HOME has `MACHINE.md` (which box it is, its size, what survives a stop, the installed tools) and `AGENTS.md`, a moment after it starts. They are reference for when a task needs a fact about the box, not steps to run first.
|
|
110
|
-
- A public URL for a web server in the box: `instabox port publish work 3000` prints it (`instabox port ls`, `instabox port unpublish work 3000`). The URL works while the box runs.
|
|
110
|
+
- A public URL for a web server in the box: `instabox port publish work 3000` prints it (`instabox port ls`, `instabox port unpublish work 3000`). The URL works while the box runs. A request wakes a box that paused itself for being idle; a box you paused or stopped answers `503` (Sandbox offline) until you `instabox resume` or `instabox start` it.
|
|
111
111
|
- A raw TCP service (Postgres, Redis) reachable from anywhere, where the server enables it: `instabox port publish work 5432 --tcp` prints `5432-<id>.<tcp domain>:443`; clients connect with TLS and that host as SNI (`psql "host=<host> port=443 sslmode=require user=postgres"`). Otherwise, or for a private tunnel, use `instabox port-forward work 5432`.
|
|
112
112
|
- A private tunnel instead, only from your computer: `instabox port-forward work 8080:3000` (alias `forward`; `LOCAL` defaults to `REMOTE`, several ports at once) serves the box's port 3000 at `http://127.0.0.1:8080` over SSH and stays in the foreground until Ctrl-C, so start it in the background (`instabox port-forward work 8080:3000 &`) and kill it when done. It fails at once when the local port is busy.
|
|
113
113
|
|