agental 0.36.0 → 0.39.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 +45 -34
  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.36.0" : "dev";
7414
+ var CLI_VERSION = true ? "0.39.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}`;
@@ -8538,12 +8538,14 @@ function placesFrom(env = process.env) {
8538
8538
  home,
8539
8539
  config: env["XDG_CONFIG_HOME"]?.trim() || path2.join(home, ".config"),
8540
8540
  claudeDir: env["CLAUDE_CONFIG_DIR"]?.trim() || path2.join(home, ".claude"),
8541
- codexDir: env["CODEX_HOME"]?.trim() || path2.join(home, ".codex")
8541
+ codexDir: env["CODEX_HOME"]?.trim() || path2.join(home, ".codex"),
8542
+ grokDir: env["GROK_HOME"]?.trim() || path2.join(home, ".grok")
8542
8543
  };
8543
8544
  }
8544
8545
  var SIGN_IN = {
8545
8546
  "Claude Code": "/mcp, then agental, then Authenticate",
8546
8547
  Codex: "codex mcp login agental",
8548
+ "Grok Build": "/mcps in grok, then agental",
8547
8549
  Cursor: "Settings \u203A MCP, turn agental on, then log in",
8548
8550
  Windsurf: "its MCP servers list, then agental",
8549
8551
  "Gemini CLI": "/mcp auth agental",
@@ -8606,30 +8608,30 @@ function addToJson(agent, places, url) {
8606
8608
  `);
8607
8609
  return { agent: agent.agent, did: "added" };
8608
8610
  }
8609
- function codexHas(text) {
8611
+ function tomlHasConnector(text) {
8610
8612
  const has = /^\s*\[\s*mcp_servers\s*\.\s*["']?agental["']?\s*[\].]/m.test(text) || /^\s*mcp_servers\s*\.\s*["']?agental["']?\s*[.=]/m.test(text) || /^\s*\[\s*mcp_servers\s*\]/m.test(text) && /^\s*["']?agental["']?\s*[.=]/m.test(text);
8611
8613
  if (has) {
8612
8614
  return "agental";
8613
8615
  }
8614
8616
  return /^\s*mcp_servers\s*=/m.test(text) ? "inline" : null;
8615
8617
  }
8616
- function addToCodex(places, url) {
8617
- if (!existsSync(places.codexDir)) {
8618
+ function addToToml(agent, folder, url) {
8619
+ if (!existsSync(folder)) {
8618
8620
  return null;
8619
8621
  }
8620
- const file = path2.join(places.codexDir, "config.toml");
8622
+ const file = path2.join(folder, "config.toml");
8621
8623
  const text = existsSync(file) ? readFileSync2(file, "utf8") : "";
8622
- const has = codexHas(text);
8624
+ const has = tomlHasConnector(text);
8623
8625
  if (has === "agental") {
8624
- return { agent: "Codex", did: "already" };
8626
+ return { agent, did: "already" };
8625
8627
  }
8626
8628
  if (has === "inline") {
8627
- return { agent: "Codex", did: "left", why: `${file} lists its servers inline, so it was left as it is: add agental = { url = "${url}" } to them` };
8629
+ return { agent, did: "left", why: `${file} lists its servers inline, so it was left as it is: add agental = { url = "${url}" } to them` };
8628
8630
  }
8629
8631
  const eol = text.includes("\r\n") ? "\r\n" : "\n";
8630
8632
  const lead = text === "" ? "" : text.endsWith("\n") ? eol : eol + eol;
8631
8633
  replaceFile(file, `${text}${lead}[mcp_servers.${CONNECTOR_NAME}]${eol}url = "${url}"${eol}`);
8632
- return { agent: "Codex", did: "added" };
8634
+ return { agent, did: "added" };
8633
8635
  }
8634
8636
  function run(command2, args, cwd) {
8635
8637
  return new Promise((resolve) => {
@@ -8667,7 +8669,11 @@ async function step(agent, add) {
8667
8669
  }
8668
8670
  }
8669
8671
  async function addConnector(url, places = placesFrom()) {
8670
- const outcomes = [await step("Claude Code", () => addToClaudeCode(places, url)), await step("Codex", () => addToCodex(places, url))];
8672
+ const outcomes = [
8673
+ await step("Claude Code", () => addToClaudeCode(places, url)),
8674
+ await step("Codex", () => addToToml("Codex", places.codexDir, url)),
8675
+ await step("Grok Build", () => addToToml("Grok Build", places.grokDir, url))
8676
+ ];
8671
8677
  for (const agent of JSON_AGENTS) {
8672
8678
  outcomes.push(await step(agent.agent, () => addToJson(agent, places, url)));
8673
8679
  }
@@ -9628,7 +9634,7 @@ var COMMANDS = [
9628
9634
  { name: "members", summary: "List or remove the members of a team." },
9629
9635
  { name: "invite", summary: "Invite someone to your team by email." },
9630
9636
  { name: "billing", summary: "Your plan, credits, invoices and card, and buying credits.", examples: ["agental billing", "agental billing compare", "agental billing invoices", "agental billing top-up 500"] },
9631
- { name: "headroom", summary: "How close you run to your plan's limits, and your burst budget." },
9637
+ { name: "limits", summary: "How close you run to your plan's limits, and your burst budget." },
9632
9638
  { name: "account", summary: "Export everything agental keeps about your account and you." },
9633
9639
  { name: "login", summary: "Sign in through the browser, or with a key from standard input." },
9634
9640
  { name: "logout", summary: "Delete this computer's key from your account and from here." },
@@ -9732,7 +9738,7 @@ var MAP = [
9732
9738
  [
9733
9739
  ["template", "what new sandboxes start from"],
9734
9740
  ["billing", "plan, credits, invoices and card"],
9735
- ["headroom", "how close you run to your plan's limits"],
9741
+ ["limits", "how close you run to your plan's limits"],
9736
9742
  ["key", "API keys"],
9737
9743
  ["org, member", "teams"],
9738
9744
  ["webhook", "events sent to an address of yours"],
@@ -9972,7 +9978,7 @@ var SUBCOMMANDS = {
9972
9978
  key: ["list"],
9973
9979
  webhook: ["list"],
9974
9980
  job: ["list"],
9975
- headroom: ["budget"],
9981
+ limits: ["budget"],
9976
9982
  egress: ["budget", "use-case"],
9977
9983
  telemetry: ["set", "test", "unset"],
9978
9984
  ci: ["set", "reset"],
@@ -11503,7 +11509,8 @@ var LIFECYCLE_EVENTS = [
11503
11509
  "sandbox.labels_changed",
11504
11510
  "sandbox.low_cpu",
11505
11511
  "sandbox.upgraded",
11506
- "sandbox.reclaim_chance"
11512
+ "sandbox.reclaim_chance",
11513
+ "sandbox.lost"
11507
11514
  ];
11508
11515
  var WEBHOOK_EVENTS = [...LIFECYCLE_EVENTS, "prompt.created"];
11509
11516
  var EMAIL_EVENTS = ["email.received", "email.delivered", "email.bounced"];
@@ -12834,7 +12841,7 @@ async function main() {
12834
12841
  raw: { type: "boolean", default: false },
12835
12842
  subject: { type: "string" },
12836
12843
  from: { type: "string" },
12837
- // agental headroom: where its range ends (--from is where it begins).
12844
+ // agental limits: where its range ends (--from is where it begins).
12838
12845
  to: { type: "string" },
12839
12846
  "from-name": { type: "string" },
12840
12847
  "reply-to": { type: "string" },
@@ -13165,8 +13172,8 @@ async function main() {
13165
13172
  case "billing":
13166
13173
  await billing(positionals.slice(1), values.json, values.limit);
13167
13174
  return;
13168
- case "headroom":
13169
- await headroom(positionals.slice(1), { json: values.json, from: values.from, to: values.to, step: values.step });
13175
+ case "limits":
13176
+ await showLimits(positionals.slice(1), { json: values.json, from: values.from, to: values.to, step: values.step });
13170
13177
  return;
13171
13178
  case "account":
13172
13179
  await account2(positionals.slice(1), values.out);
@@ -13274,7 +13281,7 @@ function maxBurstFeeHeaders(given) {
13274
13281
  function sayBurstFee(response) {
13275
13282
  const micros = Number(response.headers.get("Agental-Burst-Fee") ?? "0");
13276
13283
  if (micros > 0) {
13277
- process.stderr.write(`This start cost a burst fee of ${money(micros)}: the account started more than its plan's free starts in the last 15 minutes. Starts are free again within 15 minutes; agental headroom says the minute.
13284
+ process.stderr.write(`This start cost a burst fee of ${money(micros)}: the account started more than its plan's free starts in the last 15 minutes. Starts are free again within 15 minutes; agental limits says the minute.
13278
13285
  `);
13279
13286
  }
13280
13287
  }
@@ -14923,6 +14930,10 @@ async function ci(positionals, options) {
14923
14930
  `${item.repository} pool ${item.poolMax ?? `${body.defaultPoolMax} (default)`} template ${item.templateId ?? "runs-on (empty)"} agental is ${item.size} ${item.sandboxes.length} sandboxes, ${busy} busy
14924
14931
  `
14925
14932
  );
14933
+ for (const job2 of item.waiting ?? []) {
14934
+ process.stdout.write(` job ${job2.jobId} waiting since ${job2.since}: ${job2.message}
14935
+ `);
14936
+ }
14926
14937
  }
14927
14938
  return;
14928
14939
  }
@@ -15433,7 +15444,7 @@ function pricesForPeople(body) {
15433
15444
  if (also.length > 0) {
15434
15445
  out.push(strong("Also"), ...fitted(also).trimEnd().split("\n").map((line) => ` ${line}`), "");
15435
15446
  }
15436
- out.push(faint("agental billing top-up <dollars> \xB7 agental headroom budget <dollars> \xB7 https://agental.io/pricing"));
15447
+ out.push(faint("agental billing top-up <dollars> \xB7 agental limits budget <dollars> \xB7 https://agental.io/pricing"));
15437
15448
  return `${out.join("\n")}
15438
15449
  `;
15439
15450
  }
@@ -15460,7 +15471,7 @@ function describePrices(body) {
15460
15471
  }
15461
15472
  if (body.burstFee) {
15462
15473
  out.push(
15463
- `A start past your free starts in any ${body.burstFee.windowMinutes} minutes costs one hour of its price: $${body.burstFee.feeMicrosPerUnit / 1e6} a unit, $0.027 a small, $0.108 a large. At most ${wholeMoney(body.burstFee.defaultBudgetMicros)} a month unless you set another budget: agental headroom budget <dollars>.`
15474
+ `A start past your free starts in any ${body.burstFee.windowMinutes} minutes costs one hour of its price: $${body.burstFee.feeMicrosPerUnit / 1e6} a unit, $0.027 a small, $0.108 a large. At most ${wholeMoney(body.burstFee.defaultBudgetMicros)} a month unless you set another budget: agental limits budget <dollars>.`
15464
15475
  );
15465
15476
  }
15466
15477
  if (body.topUps?.length) {
@@ -15499,17 +15510,17 @@ function stoppedWords(storage) {
15499
15510
  return `A stopped sandbox is free for ${storage.stoppedFreeDays} days after each stop, then $${storage.stoppedMicrosPerGbMonth / 1e6} a GB a month of what it stores, by the second.`;
15500
15511
  }
15501
15512
  var BURST_DOCS = "https://agental.io/docs/usage#bursts";
15502
- async function headroom(positionals, options) {
15513
+ async function showLimits(positionals, options) {
15503
15514
  if (positionals[0] === "budget") {
15504
15515
  const given = positionals[1];
15505
15516
  if (given === void 0 || positionals.length > 2) {
15506
- throw new Error("headroom budget takes the most to spend on burst fees in a month, in US dollars, as agental headroom budget 20, or default.");
15517
+ throw new Error("limits budget takes the most to spend on burst fees in a month, in US dollars, as agental limits budget 20, or default.");
15507
15518
  }
15508
15519
  const dollars = Number(given.replace(/^\$/, ""));
15509
15520
  if (given !== "default" && (!Number.isFinite(dollars) || dollars < 0)) {
15510
- throw new Error(`headroom budget takes US dollars, as 20 or 0, or default. It was given ${given}.`);
15521
+ throw new Error(`limits budget takes US dollars, as 20 or 0, or default. It was given ${given}.`);
15511
15522
  }
15512
- const body2 = await asked("/v1/headroom/budget", { method: "PUT", body: JSON.stringify({ budgetMicros: given === "default" ? null : Math.round(dollars * 1e6) }) });
15523
+ const body2 = await asked("/v1/limits/budget", { method: "PUT", body: JSON.stringify({ budgetMicros: given === "default" ? null : Math.round(dollars * 1e6) }) });
15513
15524
  if (options.json) {
15514
15525
  process.stdout.write(`${JSON.stringify(body2, null, 2)}
15515
15526
  `);
@@ -15523,7 +15534,7 @@ async function headroom(positionals, options) {
15523
15534
  return;
15524
15535
  }
15525
15536
  if (positionals.length > 0) {
15526
- throw new Error(`headroom takes nothing, or budget <dollars>: it is the account's. It was given ${positionals.join(" ")}.`);
15537
+ throw new Error(`limits takes nothing, or budget <dollars>: it is the account's. It was given ${positionals.join(" ")}.`);
15527
15538
  }
15528
15539
  if (options.step !== void 0 && !["10m", "hour", "day"].includes(options.step)) {
15529
15540
  throw new Error(`--step is 10m, hour or day. It was given ${options.step}.`);
@@ -15535,15 +15546,15 @@ async function headroom(positionals, options) {
15535
15546
  }
15536
15547
  }
15537
15548
  const asks = query.toString();
15538
- const body = await asked(`/v1/headroom${asks === "" ? "" : `?${asks}`}`, { method: "GET" });
15549
+ const body = await asked(`/v1/limits${asks === "" ? "" : `?${asks}`}`, { method: "GET" });
15539
15550
  if (options.json) {
15540
15551
  process.stdout.write(`${JSON.stringify(body, null, 2)}
15541
15552
  `);
15542
15553
  return;
15543
15554
  }
15544
- process.stdout.write(describeHeadroom(body, options.from === void 0 && options.to === void 0, options.to === void 0));
15555
+ process.stdout.write(describeLimits(body, options.from === void 0 && options.to === void 0, options.to === void 0));
15545
15556
  }
15546
- function describeHeadroom(body, today, endsNow) {
15557
+ function describeLimits(body, today, endsNow) {
15547
15558
  const answer3 = body && typeof body === "object" ? body : {};
15548
15559
  const now = answer3["now"] && typeof answer3["now"] === "object" ? answer3["now"] : {};
15549
15560
  const number = (from, name) => typeof from[name] === "number" ? from[name] : 0;
@@ -15803,12 +15814,12 @@ function refusedWords(body) {
15803
15814
  if (!isApiError(body)) {
15804
15815
  return "";
15805
15816
  }
15806
- const { refusedLastHour, headroomUrl } = body.error;
15807
- if (typeof refusedLastHour !== "number" || typeof headroomUrl !== "string") {
15817
+ const { refusedLastHour, limitsUrl } = body.error;
15818
+ if (typeof refusedLastHour !== "number" || typeof limitsUrl !== "string") {
15808
15819
  return "";
15809
15820
  }
15810
15821
  return `Refused this way in the last hour: ${refusedLastHour.toLocaleString("en-US")}.
15811
- ${headroomUrl}
15822
+ ${limitsUrl}
15812
15823
  `;
15813
15824
  }
15814
15825
  async function readBody(response) {
@@ -15959,8 +15970,8 @@ Usage
15959
15970
  agental key delete <key>
15960
15971
  agental billing [prices | compare | card [save] | details | top-up <dollars> | auto-reload <dollars | off> | email-copy] [--json]
15961
15972
  agental billing invoices [--limit <n>] [--json]
15962
- agental headroom [--from <day or date-time>] [--to <day or date-time>] [--step 10m|hour|day] [--json]
15963
- agental headroom budget <dollars> | budget default [--json]
15973
+ agental limits [--from <day or date-time>] [--to <day or date-time>] [--step 10m|hour|day] [--json]
15974
+ agental limits budget <dollars> | budget default [--json]
15964
15975
  agental egress [budget <dollars> | budget default] [--json]
15965
15976
  agental egress use-case "<what your sandboxes will use it for>" [--json]
15966
15977
  agental account export [--out <file>]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agental",
3
- "version": "0.36.0",
3
+ "version": "0.39.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",