agental 0.25.1 → 0.26.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 +29 -23
  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.25.1" : "dev";
7414
+ var CLI_VERSION = true ? "0.26.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}`;
@@ -7739,9 +7739,10 @@ var FILES_USAGE = [
7739
7739
  "agental files <sandbox-id> get <path> [<local-file>]",
7740
7740
  "agental files <sandbox-id> mkdir <folder>",
7741
7741
  "agental files <sandbox-id> mv <from> <to>",
7742
- "agental files <sandbox-id> rm <path> [--recursive]"
7742
+ "agental files <sandbox-id> rm <path> [--recursive]",
7743
+ "agental files <sandbox-id> link put|get <path> [--json]"
7743
7744
  ];
7744
- var USAGE2 = `files takes a sandbox's id and one of ls, cat, put, get, mkdir, mv and rm:
7745
+ var USAGE2 = `files takes a sandbox's id and one of ls, cat, put, get, mkdir, mv, rm and link:
7745
7746
  ${FILES_USAGE.join("\n ")}`;
7746
7747
  var LIMIT = 1e7;
7747
7748
  async function readObject2(response) {
@@ -7855,6 +7856,25 @@ ${USAGE2}`);
7855
7856
  await ask2(client, "DELETE", `${base}/files?path=${encodeURIComponent(path5)}${options.recursive ? "&recursive=true" : ""}`);
7856
7857
  return;
7857
7858
  }
7859
+ case "link": {
7860
+ const way = need(first, "put or get, and a path");
7861
+ if (way !== "put" && way !== "get") {
7862
+ throw new Error(`files link takes put or get, not ${way}.
7863
+ ${USAGE2}`);
7864
+ }
7865
+ const body = await ask2(client, "POST", `${base}/files/${way === "put" ? "upload" : "download"}-link`, { path: need(second, "a path in the sandbox") });
7866
+ if (options.json) {
7867
+ process.stdout.write(`${JSON.stringify(body, null, 2)}
7868
+ `);
7869
+ return;
7870
+ }
7871
+ process.stdout.write(`${String(body["url"])}
7872
+ `);
7873
+ const example = way === "put" ? `curl -fsS -T <local-file> "<url>"` : `curl -fsS -o <local-file> "<url>"`;
7874
+ process.stderr.write(`${way === "put" ? "Writes" : "Reads"} ${String(body["path"])}, with no key, until ${String(body["expiresAt"])}: ${example}
7875
+ `);
7876
+ return;
7877
+ }
7858
7878
  default:
7859
7879
  throw new Error(`files does not ${verb}.
7860
7880
  ${USAGE2}`);
@@ -13074,8 +13094,7 @@ async function summary(asJson, filter, facets) {
13074
13094
  process.stdout.write(line("total", read2.total));
13075
13095
  const running = read2.byState["running"];
13076
13096
  if (running && running.count > 0) {
13077
- const free = read2.ifStopped.freeDays === void 0 ? "" : ` for their first ${read2.ifStopped.freeDays} days`;
13078
- process.stdout.write(`Stopped, the ${running.count} running would cost ${dollarsOf(read2.ifStopped.microsPerHour)} an hour${free}, ${dollarsOf(running.microsPerHour - read2.ifStopped.microsPerHour)} less.
13097
+ process.stdout.write(`Stopped, the ${running.count} running would cost ${dollarsOf(read2.ifStopped.microsPerHour)} an hour for their first ${read2.ifStopped.freeDays} days, ${dollarsOf(running.microsPerHour - read2.ifStopped.microsPerHour)} less.
13079
13098
  `);
13080
13099
  }
13081
13100
  process.stdout.write("A day is at the rate of now. Today is the UTC day, and spent is for these sandboxes alone: the account's month is on Billing.\n");
@@ -14919,14 +14938,8 @@ function pricesForPeople(body) {
14919
14938
  section(
14920
14939
  "Sizes",
14921
14940
  [
14922
- ["", "VCPU", "MEMORY", "AN HOUR", ...stoppedByShare(body) ? ["STOPPED, AN HOUR"] : []],
14923
- ...body.plans.map((size2) => [
14924
- size2.size,
14925
- String(size2.vcpu),
14926
- `${size2.memoryMb / 1024} GiB`,
14927
- `$${size2.listPriceMicrosPerHour / 1e6}`,
14928
- ...stoppedByShare(body) ? [size2.stoppedMicrosPerHour === void 0 ? "" : `$${size2.stoppedMicrosPerHour / 1e6}`] : []
14929
- ])
14941
+ ["", "VCPU", "MEMORY", "AN HOUR"],
14942
+ ...body.plans.map((size2) => [size2.size, String(size2.vcpu), `${size2.memoryMb / 1024} GiB`, `$${size2.listPriceMicrosPerHour / 1e6}`])
14930
14943
  ],
14931
14944
  [`Charged by the second.${body.storage ? ` ${stoppedWords(body.storage)}` : ""}`]
14932
14945
  );
@@ -15007,10 +15020,9 @@ function describePrices(body) {
15007
15020
  );
15008
15021
  }
15009
15022
  }
15010
- out.push(stoppedByShare(body) ? "Sizes, an hour at list price, running and stopped" : "Sizes, an hour at list price");
15023
+ out.push("Sizes, an hour at list price");
15011
15024
  for (const size2 of body.plans) {
15012
- const stopped = stoppedByShare(body) && size2.stoppedMicrosPerHour !== void 0 ? `$${size2.stoppedMicrosPerHour / 1e6} stopped` : "";
15013
- out.push(` ${size2.size.padEnd(8)}${`${size2.vcpu} vCPU, ${size2.memoryMb / 1024} GiB`.padEnd(20)}${`$${size2.listPriceMicrosPerHour / 1e6}`.padEnd(12)}${stopped}`.trimEnd());
15025
+ out.push(` ${size2.size.padEnd(8)}${`${size2.vcpu} vCPU, ${size2.memoryMb / 1024} GiB`.padEnd(20)}$${size2.listPriceMicrosPerHour / 1e6}`);
15014
15026
  }
15015
15027
  if (body.storage) {
15016
15028
  const month = body.storage.snapshotMicrosPerHour * 730 / 1e6;
@@ -15020,14 +15032,8 @@ function describePrices(body) {
15020
15032
  return `${out.join("\n")}
15021
15033
  `;
15022
15034
  }
15023
- function stoppedByShare(body) {
15024
- return body.storage !== void 0 && body.storage.stoppedMicrosPerGbMonth === void 0;
15025
- }
15026
15035
  function stoppedWords(storage) {
15027
- if (storage.stoppedMicrosPerGbMonth === void 0) {
15028
- return `A stopped sandbox costs ${storage.stoppedPercent}% of its running price, by the second, while its disk is kept.`;
15029
- }
15030
- return `A stopped sandbox is free for ${storage.stoppedFreeDays ?? 14} days after each stop, then $${storage.stoppedMicrosPerGbMonth / 1e6} a GB a month of what it stores, by the second.`;
15036
+ 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.`;
15031
15037
  }
15032
15038
  var BURST_DOCS = "https://agental.io/docs/usage#bursts";
15033
15039
  async function headroom(positionals, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agental",
3
- "version": "0.25.1",
3
+ "version": "0.26.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",