agental 0.25.0 → 0.25.2

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 -39
  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.0" : "dev";
7414
+ var CLI_VERSION = true ? "0.25.2" : "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}`;
@@ -8946,7 +8946,7 @@ async function saveCard(base, key2, term, message) {
8946
8946
  `);
8947
8947
  return false;
8948
8948
  }
8949
- if (!await yes(` Save a card in your browser now? Nothing is charged, and each month's first $4.95 of use is free. [Y/n] `)) {
8949
+ if (!await yes(` Save a card in your browser now? Nothing is charged, and each month's first $5 of use is free. [Y/n] `)) {
8950
8950
  term.say(` Save one when you like: ${page}
8951
8951
  `);
8952
8952
  return false;
@@ -12103,25 +12103,31 @@ var MACHINE_SIZES = {
12103
12103
  large: { vcpu: 8, memoryMb: 16384, diskGb: 160 }
12104
12104
  };
12105
12105
  var MACHINE_SIZE_NAMES = ["tiny", "small", "medium", "large"];
12106
- var LIST_PRICE_MICROS_PER_HOUR = {
12107
- tiny: 13500,
12108
- small: 27e3,
12109
- medium: 54e3,
12110
- large: 108e3
12111
- };
12112
- var STOPPED_PRICE_PERCENT = 5;
12113
- var STOPPED_WITH_MEMORY_PRICE_PERCENT = 10;
12114
- var STOPPED_MICROS_PER_HOUR = {
12115
- tiny: Math.round(LIST_PRICE_MICROS_PER_HOUR.tiny * STOPPED_PRICE_PERCENT / 100),
12116
- small: Math.round(LIST_PRICE_MICROS_PER_HOUR.small * STOPPED_PRICE_PERCENT / 100),
12117
- medium: Math.round(LIST_PRICE_MICROS_PER_HOUR.medium * STOPPED_PRICE_PERCENT / 100),
12118
- large: Math.round(LIST_PRICE_MICROS_PER_HOUR.large * STOPPED_PRICE_PERCENT / 100)
12106
+ var HOURS_PER_MONTH = 730;
12107
+ var STOPPED_MICROS_PER_GB_MONTH = 5e4;
12108
+ var BYTES_PER_GB = 1e9;
12109
+ var NEVER_PAID_MAX_STORED_BYTES = 20 * BYTES_PER_GB;
12110
+ function stoppedMicrosPerHour(storedBytes) {
12111
+ if (storedBytes <= 0) {
12112
+ return 0;
12113
+ }
12114
+ return Math.max(1, Math.round(storedBytes * STOPPED_MICROS_PER_GB_MONTH / (BYTES_PER_GB * HOURS_PER_MONTH)));
12115
+ }
12116
+ function wholeStoredBytes(size2, withMemory) {
12117
+ const resources = MACHINE_SIZES[size2];
12118
+ return resources.diskGb * 2 ** 30 + (withMemory ? resources.memoryMb * 2 ** 20 : 0);
12119
+ }
12120
+ var STOPPED_MAX_MICROS_PER_HOUR = {
12121
+ tiny: stoppedMicrosPerHour(wholeStoredBytes("tiny", false)),
12122
+ small: stoppedMicrosPerHour(wholeStoredBytes("small", false)),
12123
+ medium: stoppedMicrosPerHour(wholeStoredBytes("medium", false)),
12124
+ large: stoppedMicrosPerHour(wholeStoredBytes("large", false))
12119
12125
  };
12120
- var STOPPED_WITH_MEMORY_MICROS_PER_HOUR = {
12121
- tiny: Math.round(LIST_PRICE_MICROS_PER_HOUR.tiny * STOPPED_WITH_MEMORY_PRICE_PERCENT / 100),
12122
- small: Math.round(LIST_PRICE_MICROS_PER_HOUR.small * STOPPED_WITH_MEMORY_PRICE_PERCENT / 100),
12123
- medium: Math.round(LIST_PRICE_MICROS_PER_HOUR.medium * STOPPED_WITH_MEMORY_PRICE_PERCENT / 100),
12124
- large: Math.round(LIST_PRICE_MICROS_PER_HOUR.large * STOPPED_WITH_MEMORY_PRICE_PERCENT / 100)
12126
+ var STOPPED_WITH_MEMORY_MAX_MICROS_PER_HOUR = {
12127
+ tiny: stoppedMicrosPerHour(wholeStoredBytes("tiny", true)),
12128
+ small: stoppedMicrosPerHour(wholeStoredBytes("small", true)),
12129
+ medium: stoppedMicrosPerHour(wholeStoredBytes("medium", true)),
12130
+ large: stoppedMicrosPerHour(wholeStoredBytes("large", true))
12125
12131
  };
12126
12132
  var SANDBOX_STATUSES = ["creating", "running", "stopped", "error", "deleted"];
12127
12133
  var SHOWN_STATUSES = [...SANDBOX_STATUSES, "restoring", "migrating"];
@@ -13068,7 +13074,7 @@ async function summary(asJson, filter, facets) {
13068
13074
  process.stdout.write(line("total", read2.total));
13069
13075
  const running = read2.byState["running"];
13070
13076
  if (running && running.count > 0) {
13071
- process.stdout.write(`Stopped, the ${running.count} running would cost ${dollarsOf(read2.ifStopped.microsPerHour)} an hour, ${dollarsOf(running.microsPerHour - read2.ifStopped.microsPerHour)} less.
13077
+ 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.
13072
13078
  `);
13073
13079
  }
13074
13080
  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");
@@ -14675,6 +14681,9 @@ Nothing is charged until it is paid. agental billing shows it within a minute of
14675
14681
  throw new Error(usage);
14676
14682
  }
14677
14683
  }
14684
+ function wholeOrCents(micros) {
14685
+ return micros % 1e6 === 0 ? wholeMoney(micros) : money(micros);
14686
+ }
14678
14687
  function money(micros) {
14679
14688
  return `$${(micros / 1e6).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
14680
14689
  }
@@ -14894,7 +14903,7 @@ function pricesForPeople(body) {
14894
14903
  ...body.tiers.map((tier) => [
14895
14904
  (tier.id ? PLAN_NAMES[tier.id] : void 0) ?? (tier.dollarsPerMonth === 0 ? "Free" : `$${tier.dollarsPerMonth.toLocaleString("en-US")}`),
14896
14905
  wholeMoney(tier.dollarsPerMonth * 1e6),
14897
- tier.dollarsPerMonth === 0 ? body.free ? `${money(body.free.allowanceMicros)} free` : "none" : wholeMoney(tier.includedMicros),
14906
+ tier.dollarsPerMonth === 0 ? body.free ? `${wholeOrCents(body.free.allowanceMicros)} free` : "none" : wholeMoney(tier.includedMicros),
14898
14907
  count(tier.runningUnits ?? tier.sandboxesAtOnce),
14899
14908
  count(tier.freeBurstUnits),
14900
14909
  tier.sizes === void 0 ? "" : tier.sizes.length === body.plans.length ? "every size" : tier.sizes.join(", ")
@@ -14909,16 +14918,10 @@ function pricesForPeople(body) {
14909
14918
  section(
14910
14919
  "Sizes",
14911
14920
  [
14912
- ["", "VCPU", "MEMORY", "AN HOUR", ...body.storage ? ["STOPPED, AN HOUR"] : []],
14913
- ...body.plans.map((size2) => [
14914
- size2.size,
14915
- String(size2.vcpu),
14916
- `${size2.memoryMb / 1024} GiB`,
14917
- `$${size2.listPriceMicrosPerHour / 1e6}`,
14918
- ...body.storage ? [size2.stoppedMicrosPerHour === void 0 ? "" : `$${size2.stoppedMicrosPerHour / 1e6}`] : []
14919
- ])
14921
+ ["", "VCPU", "MEMORY", "AN HOUR"],
14922
+ ...body.plans.map((size2) => [size2.size, String(size2.vcpu), `${size2.memoryMb / 1024} GiB`, `$${size2.listPriceMicrosPerHour / 1e6}`])
14920
14923
  ],
14921
- [`Charged by the second.${body.storage ? ` Stopped, a sandbox costs ${body.storage.stoppedPercent}% while its disk is kept.` : ""}`]
14924
+ [`Charged by the second.${body.storage ? ` ${stoppedWords(body.storage)}` : ""}`]
14922
14925
  );
14923
14926
  if (body.topUps?.length) {
14924
14927
  const range = body.topUpRange;
@@ -14960,12 +14963,12 @@ function describePrices(body) {
14960
14963
  const sizes = tier.sizes === void 0 ? "" : tier.sizes.length === body.plans.length ? "every size" : tier.sizes.join(", ");
14961
14964
  const speed = tier.runningUnits !== void 0 && tier.freeBurstUnits !== void 0 ? `${tier.runningUnits.toLocaleString("en-US")} running, ${tier.freeBurstUnits.toLocaleString("en-US")} start free` : tier.burst ? `${(tier.burst.perQuarterMb / 1024).toLocaleString("en-US")} GiB per 15 minutes` : typeof tier.sandboxesAtOnce === "number" ? `${tier.sandboxesAtOnce.toLocaleString("en-US")} sandboxes at once` : "";
14962
14965
  const price = tier.dollarsPerMonth === 0 ? "Free" : `$${tier.dollarsPerMonth.toLocaleString("en-US")}`;
14963
- const included = tier.dollarsPerMonth === 0 ? body.free ? `${money(body.free.allowanceMicros)} free, then as you go` : "pay as you go" : `${wholeMoney(tier.includedMicros)} of credits`;
14966
+ const included = tier.dollarsPerMonth === 0 ? body.free ? `${wholeOrCents(body.free.allowanceMicros)} free, then as you go` : "pay as you go" : `${wholeMoney(tier.includedMicros)} of credits`;
14964
14967
  out.push(` ${price.padEnd(8)}${included.padEnd(28)}${speed.padEnd(34)}${sizes}`.trimEnd());
14965
14968
  }
14966
14969
  if (body.free) {
14967
14970
  out.push(
14968
- ` Free needs a card saved, charged nothing. Each month's first ${money(body.free.allowanceMicros)} of use is free: 183 hours of a small sandbox, 366 of a tiny one, or 11,000 CI minutes on small. It runs ${body.free.unpaidUnits} small sandboxes at once until you buy a top-up.`
14971
+ ` Free needs a card saved, charged nothing. Each month's first ${wholeOrCents(body.free.allowanceMicros)} of use is free: 185 hours of a small sandbox, 370 of a tiny one, or 11,100 CI minutes on small. It runs ${body.free.unpaidUnits} small sandboxes at once until you buy a top-up.`
14969
14972
  );
14970
14973
  }
14971
14974
  if (body.tiers.some((tier) => tier.runningUnits !== void 0)) {
@@ -14997,19 +15000,21 @@ function describePrices(body) {
14997
15000
  );
14998
15001
  }
14999
15002
  }
15000
- out.push(body.storage ? "Sizes, an hour at list price, running and stopped" : "Sizes, an hour at list price");
15003
+ out.push("Sizes, an hour at list price");
15001
15004
  for (const size2 of body.plans) {
15002
- const stopped = body.storage && size2.stoppedMicrosPerHour !== void 0 ? `$${size2.stoppedMicrosPerHour / 1e6} stopped` : "";
15003
- out.push(` ${size2.size.padEnd(8)}${`${size2.vcpu} vCPU, ${size2.memoryMb / 1024} GiB`.padEnd(20)}${`$${size2.listPriceMicrosPerHour / 1e6}`.padEnd(12)}${stopped}`.trimEnd());
15005
+ out.push(` ${size2.size.padEnd(8)}${`${size2.vcpu} vCPU, ${size2.memoryMb / 1024} GiB`.padEnd(20)}$${size2.listPriceMicrosPerHour / 1e6}`);
15004
15006
  }
15005
15007
  if (body.storage) {
15006
15008
  const month = body.storage.snapshotMicrosPerHour * 730 / 1e6;
15007
- out.push(`A stopped sandbox costs ${body.storage.stoppedPercent}% of its running price, by the second, while its disk is kept.`);
15009
+ out.push(stoppedWords(body.storage));
15008
15010
  out.push(`Snapshots: the ${body.storage.freeSnapshots} oldest are free, and each one past them is $${month.toFixed(2)} a month, by the second.`);
15009
15011
  }
15010
15012
  return `${out.join("\n")}
15011
15013
  `;
15012
15014
  }
15015
+ function stoppedWords(storage) {
15016
+ 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.`;
15017
+ }
15013
15018
  var BURST_DOCS = "https://agental.io/docs/usage#bursts";
15014
15019
  async function headroom(positionals, options) {
15015
15020
  if (positionals[0] === "budget") {
@@ -15507,7 +15512,8 @@ bash) in ~/.bashrc, or agental completion fish | source in ~/.config/fish/config
15507
15512
  The key is kept in ~/.config/agental/credentials.json, readable by you alone. logout deletes the
15508
15513
  key from your account and that file. whoami says who the command is signed in as, and with which
15509
15514
  key. AGENTAL_API_KEY, when it is set, is used in place of what is kept.
15510
- Stop keeps the sandbox filesystem, and a stopped sandbox costs 5% of its running price. Processes do not survive a stop.
15515
+ Stop keeps the sandbox filesystem. A stopped sandbox is free for 14 days, then $0.05 a GB a month of
15516
+ what it stores, until it is started or deleted. Processes do not survive a stop.
15511
15517
  resize gives a sandbox a larger size, with more vCPUs, memory and disk, and its files in place; a
15512
15518
  smaller one is refused, as its disk is not made smaller. A stopped sandbox takes it at once, and its
15513
15519
  next start boots it at it. A running one keeps running, and paying, as its size until it is
@@ -15713,7 +15719,7 @@ newest first, each with its day, number, state, total and what it was for, and w
15713
15719
  one that is not paid yet; --limit lists that many of the newest, and --json gives each one's
15714
15720
  page and PDF to the account's owner. details says who the invoices are made out to: the email
15715
15721
  they go to, the name, address and tax ids on them, to the account's owner alone. The free plan costs nothing a month and has each month's
15716
- first $4.95 of use free, 183 small hours or 11,000 CI minutes, and pays for the rest from
15722
+ first $5 of use free, 185 small hours or 11,100 CI minutes, and pays for the rest from
15717
15723
  credits; it makes tiny and small sandboxes. prices lists the plans with the sizes each
15718
15724
  makes, the top-ups with their bonus and the hourly price of each size. card names the card the account
15719
15725
  pays with, and card save prints the address of a page to save one for the free plan: nothing is charged, and once it is saved the account
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agental",
3
- "version": "0.25.0",
3
+ "version": "0.25.2",
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",