agental 0.41.0 → 0.42.0

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.
Files changed (2) hide show
  1. package/dist/cli.js +24 -10
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -7411,7 +7411,7 @@ import { parseArgs } from "node:util";
7411
7411
 
7412
7412
  // ../src/cli-build.ts
7413
7413
  var PUBLISHED = true;
7414
- var CLI_VERSION = true ? "0.41.0" : "dev";
7414
+ var CLI_VERSION = true ? "0.42.0" : "dev";
7415
7415
  var DEFAULT_API_URL = true ? "https://agental.io" : "http://127.0.0.1:8741";
7416
7416
  var PACKAGE_NAME = "agental";
7417
7417
  var USER_AGENT = `agental-cli/${CLI_VERSION}`;
@@ -9450,7 +9450,7 @@ var COMMANDS = [
9450
9450
  name: "command",
9451
9451
  summary: "Start a command in a sandbox that runs on by itself, follow its output, write its stdin and signal it.",
9452
9452
  examples: [
9453
- "agental command start sbx_2a9a47e50daec64a --no-timeout -- npm run build",
9453
+ "agental command start sbx_2a9a47e50daec64a --name build --no-timeout -- npm run build",
9454
9454
  "agental command logs sbx_2a9a47e50daec64a cmd_0123456789abcdef --follow",
9455
9455
  "agental command start sbx_2a9a47e50daec64a --stdin -- sh -c 'wc -l'",
9456
9456
  "agental command stdin sbx_2a9a47e50daec64a cmd_0123456789abcdef < big.csv",
@@ -9458,6 +9458,7 @@ var COMMANDS = [
9458
9458
  ],
9459
9459
  flags: [
9460
9460
  ["-- <command> [args...]", "start: what to run, with no shell; everything after -- is the command's own"],
9461
+ ["--name <name>", 'start: what it is for, as lists and the console show it, such as "dev server"; never a secret'],
9461
9462
  ["--cwd <dir>", "start: the absolute folder it runs in (default: the sandbox's work folder)"],
9462
9463
  ["--env <NAME>=<value>", "start: a variable for it alone, or NAME for the value it has here (may be given again); never printed"],
9463
9464
  ["--timeout <seconds>", "start: end it after this long, as 90 or 10m, up to 10m (default 60s)"],
@@ -9521,8 +9522,9 @@ var COMMANDS = [
9521
9522
  {
9522
9523
  name: "start",
9523
9524
  summary: "Start a stopped sandbox, or every one --where finds.",
9524
- examples: ["agental start sbx_2a9a47e50daec64a"],
9525
+ examples: ["agental start sbx_2a9a47e50daec64a", "agental start sbx_2a9a47e50daec64a --without-memory"],
9525
9526
  flags: [
9527
+ ["--without-memory", "start from its disk and let its kept memory go for good: files kept, running programs lost"],
9526
9528
  ["--where '<words>'", "every sandbox the words find, as one bulk action"],
9527
9529
  ["--yes", "with --where: start them without asking"],
9528
9530
  ["--max-burst-fee <dollars>", "the most this start may pay in burst fees"]
@@ -11729,7 +11731,8 @@ async function start(client, sandbox, commands, run3, extra, options) {
11729
11731
  ...options["no-timeout"] === true ? { timeoutMs: null } : options.timeout !== void 0 ? { timeoutMs: timeoutMsOf2(options.timeout) } : {},
11730
11732
  ...options.cwd !== void 0 ? { cwd: options.cwd } : {},
11731
11733
  ...options.env !== void 0 && options.env.length > 0 ? { env: envOf(options.env) } : {},
11732
- ...options.stdin === true ? { stdin: true } : {}
11734
+ ...options.stdin === true ? { stdin: true } : {},
11735
+ ...options.name !== void 0 ? { name: options.name } : {}
11733
11736
  };
11734
11737
  const started = await ask7(client, "POST", commands, body);
11735
11738
  if (options.json) {
@@ -11832,9 +11835,10 @@ async function list2(client, sandbox, commands, options) {
11832
11835
  const terminal2 = isTerminal(process.stdout);
11833
11836
  const sized = listed.some((each) => typeof each.stdoutBytes === "number");
11834
11837
  const written = (count) => typeof count === "number" ? bytes2(count) : "-";
11838
+ const named = listed.some((each) => each.name != null);
11835
11839
  const rows = [
11836
- ["ID", "STATE", "STARTED", "TOOK", ...sized ? ["STDOUT", "STDERR"] : []],
11837
- ...listed.map((each) => [each.id, stateOf(each), moment(each.startedAt), tookOf2(each), ...sized ? [written(each.stdoutBytes), written(each.stderrBytes)] : []])
11840
+ ["ID", ...named ? ["NAME"] : [], "STATE", "STARTED", "TOOK", ...sized ? ["STDOUT", "STDERR"] : []],
11841
+ ...listed.map((each) => [each.id, ...named ? [each.name ?? "-"] : [], stateOf(each), moment(each.startedAt), tookOf2(each), ...sized ? [written(each.stdoutBytes), written(each.stderrBytes)] : []])
11838
11842
  ];
11839
11843
  process.stdout.write(fitted(rows, { ...terminal2 ? { give: 1 } : { width: Number.MAX_SAFE_INTEGER }, paint: (cell, row) => row === 0 ? faint(cell) : cell }));
11840
11844
  }
@@ -11853,6 +11857,7 @@ function show(command3, sandbox, asJson) {
11853
11857
  };
11854
11858
  const rows = [
11855
11859
  ["id", command3.id],
11860
+ ...command3.name == null ? [] : [["name", command3.name]],
11856
11861
  ["sandbox", command3.sandboxId],
11857
11862
  ["state", stateOf(command3)],
11858
11863
  ...command3.pid === null ? [] : [["pid", String(command3.pid)]],
@@ -13737,6 +13742,7 @@ async function main() {
13737
13742
  expires: { type: "string" },
13738
13743
  "keep-streams": { type: "boolean" },
13739
13744
  "keep-memory": { type: "boolean" },
13745
+ "without-memory": { type: "boolean" },
13740
13746
  // agental delete and template delete: delete a sandbox that jobs run in, or a template they make their sandboxes from, and pause them.
13741
13747
  "pause-jobs": { type: "boolean" },
13742
13748
  // agental resize: the size now, with a restart, or a waiting size taken away.
@@ -13899,10 +13905,13 @@ async function main() {
13899
13905
  return;
13900
13906
  case "start":
13901
13907
  if (values.where !== void 0) {
13908
+ if (values["without-memory"] === true) {
13909
+ throw new Error("--without-memory starts one sandbox at a time: name it, without --where.");
13910
+ }
13902
13911
  await bulk("start", whereQuery(values.where, labelsFilter(values)), {}, values.yes === true, values.json);
13903
13912
  return;
13904
13913
  }
13905
- await lifecycle("start", positionals[1], maxBurstFeeHeaders(values["max-burst-fee"]));
13914
+ await lifecycle("start", positionals[1], maxBurstFeeHeaders(values["max-burst-fee"]), values["without-memory"] === true ? { withoutMemory: true } : void 0);
13906
13915
  return;
13907
13916
  case "auto-stop":
13908
13917
  await autoStop(positionals[1], values.in, values.at, values.never === true, values.json);
@@ -14542,6 +14551,10 @@ async function lifecycle(action, id, headers = {}, sent) {
14542
14551
  if (!id) {
14543
14552
  throw new Error(`${action} requires <sandbox-id>`);
14544
14553
  }
14554
+ if (sent?.["withoutMemory"] === true) {
14555
+ process.stderr.write(`Starting ${id} from its disk. The memory it was stopped with is let go for good: its files are kept, and the programs that ran in it are not.
14556
+ `);
14557
+ }
14545
14558
  if (sent?.["keepMemory"] === true) {
14546
14559
  process.stderr.write(`Stopping ${id} with its memory kept. It ends once the memory is written, about a second for every 2 to 3 GiB.
14547
14560
  `);
@@ -16772,7 +16785,7 @@ Usage
16772
16785
  agental meta <sandbox-id> [set <key>=<value>... | unset <key>...] [--json]
16773
16786
  agental regions [--json]
16774
16787
  agental exec <sandbox-id> -- <command> [args...]
16775
- agental command start <sandbox-id> [--cwd <dir>] [--env <NAME>=<value>]... [--timeout <seconds> | --no-timeout] [--stdin] [--json] -- <command> [args...]
16788
+ agental command start <sandbox-id> [--name <name>] [--cwd <dir>] [--env <NAME>=<value>]... [--timeout <seconds> | --no-timeout] [--stdin] [--json] -- <command> [args...]
16776
16789
  agental command list <sandbox-id> [--limit <n>] [--json]
16777
16790
  agental command get <sandbox-id> <command-id> [--json]
16778
16791
  agental command logs <sandbox-id> <command-id> [--follow]
@@ -16785,7 +16798,7 @@ Usage
16785
16798
  agental shell <sandbox-id> --list [--json] the shells kept in it
16786
16799
  agental shell <sandbox-id> --close <shell> end a kept shell
16787
16800
  agental delete <sandbox-id>
16788
- agental start <sandbox-id> [--max-burst-fee <dollars>]
16801
+ agental start <sandbox-id> [--max-burst-fee <dollars>] [--without-memory]
16789
16802
  agental stop <sandbox-id> [--keep-memory]
16790
16803
  agental stop --where '<words>' [--keep-memory] [--yes] every sandbox the words find, as one bulk action
16791
16804
  agental start --where '<words>' [--yes]
@@ -17175,7 +17188,8 @@ payments, usage, and what it has made. Secrets are named, never given. --out wri
17175
17188
  only you can read. An account is closed from Settings in the console: a key cannot close one.
17176
17189
  command start starts a command in a running sandbox and prints its id: what comes after -- is
17177
17190
  its program and arguments, run as root with no shell (sh -c "..." for pipes), which runs on
17178
- whether or not anything watches it. It runs in the sandbox's work folder unless --cwd names an
17191
+ whether or not anything watches it. --name gives it a short name that lists and the console show,
17192
+ since agental keeps no command line. It runs in the sandbox's work folder unless --cwd names an
17179
17193
  absolute one, with the sandbox's variables and those --env gives it, NAME=VALUE or NAME alone for
17180
17194
  the value it has here; their values are never printed or kept in agental's records. It is ended
17181
17195
  after 60 seconds unless --timeout says, up to 10m, or --no-timeout gives it no limit of its own:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agental",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "description": "The agental command: Linux sandboxes for your agents, from the terminal. npx agental@latest signs you in and installs the agent skills.",
5
5
  "license": "MIT",
6
6
  "author": "VERTIXER LTD",