agental 0.25.0 → 0.25.1

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 +52 -32
  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.1" : "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,8 @@ 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
+ 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.
13072
13079
  `);
13073
13080
  }
13074
13081
  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 +14682,9 @@ Nothing is charged until it is paid. agental billing shows it within a minute of
14675
14682
  throw new Error(usage);
14676
14683
  }
14677
14684
  }
14685
+ function wholeOrCents(micros) {
14686
+ return micros % 1e6 === 0 ? wholeMoney(micros) : money(micros);
14687
+ }
14678
14688
  function money(micros) {
14679
14689
  return `$${(micros / 1e6).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
14680
14690
  }
@@ -14894,7 +14904,7 @@ function pricesForPeople(body) {
14894
14904
  ...body.tiers.map((tier) => [
14895
14905
  (tier.id ? PLAN_NAMES[tier.id] : void 0) ?? (tier.dollarsPerMonth === 0 ? "Free" : `$${tier.dollarsPerMonth.toLocaleString("en-US")}`),
14896
14906
  wholeMoney(tier.dollarsPerMonth * 1e6),
14897
- tier.dollarsPerMonth === 0 ? body.free ? `${money(body.free.allowanceMicros)} free` : "none" : wholeMoney(tier.includedMicros),
14907
+ tier.dollarsPerMonth === 0 ? body.free ? `${wholeOrCents(body.free.allowanceMicros)} free` : "none" : wholeMoney(tier.includedMicros),
14898
14908
  count(tier.runningUnits ?? tier.sandboxesAtOnce),
14899
14909
  count(tier.freeBurstUnits),
14900
14910
  tier.sizes === void 0 ? "" : tier.sizes.length === body.plans.length ? "every size" : tier.sizes.join(", ")
@@ -14909,16 +14919,16 @@ function pricesForPeople(body) {
14909
14919
  section(
14910
14920
  "Sizes",
14911
14921
  [
14912
- ["", "VCPU", "MEMORY", "AN HOUR", ...body.storage ? ["STOPPED, AN HOUR"] : []],
14922
+ ["", "VCPU", "MEMORY", "AN HOUR", ...stoppedByShare(body) ? ["STOPPED, AN HOUR"] : []],
14913
14923
  ...body.plans.map((size2) => [
14914
14924
  size2.size,
14915
14925
  String(size2.vcpu),
14916
14926
  `${size2.memoryMb / 1024} GiB`,
14917
14927
  `$${size2.listPriceMicrosPerHour / 1e6}`,
14918
- ...body.storage ? [size2.stoppedMicrosPerHour === void 0 ? "" : `$${size2.stoppedMicrosPerHour / 1e6}`] : []
14928
+ ...stoppedByShare(body) ? [size2.stoppedMicrosPerHour === void 0 ? "" : `$${size2.stoppedMicrosPerHour / 1e6}`] : []
14919
14929
  ])
14920
14930
  ],
14921
- [`Charged by the second.${body.storage ? ` Stopped, a sandbox costs ${body.storage.stoppedPercent}% while its disk is kept.` : ""}`]
14931
+ [`Charged by the second.${body.storage ? ` ${stoppedWords(body.storage)}` : ""}`]
14922
14932
  );
14923
14933
  if (body.topUps?.length) {
14924
14934
  const range = body.topUpRange;
@@ -14960,12 +14970,12 @@ function describePrices(body) {
14960
14970
  const sizes = tier.sizes === void 0 ? "" : tier.sizes.length === body.plans.length ? "every size" : tier.sizes.join(", ");
14961
14971
  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
14972
  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`;
14973
+ 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
14974
  out.push(` ${price.padEnd(8)}${included.padEnd(28)}${speed.padEnd(34)}${sizes}`.trimEnd());
14965
14975
  }
14966
14976
  if (body.free) {
14967
14977
  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.`
14978
+ ` 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
14979
  );
14970
14980
  }
14971
14981
  if (body.tiers.some((tier) => tier.runningUnits !== void 0)) {
@@ -14997,19 +15007,28 @@ function describePrices(body) {
14997
15007
  );
14998
15008
  }
14999
15009
  }
15000
- out.push(body.storage ? "Sizes, an hour at list price, running and stopped" : "Sizes, an hour at list price");
15010
+ out.push(stoppedByShare(body) ? "Sizes, an hour at list price, running and stopped" : "Sizes, an hour at list price");
15001
15011
  for (const size2 of body.plans) {
15002
- const stopped = body.storage && size2.stoppedMicrosPerHour !== void 0 ? `$${size2.stoppedMicrosPerHour / 1e6} stopped` : "";
15012
+ const stopped = stoppedByShare(body) && size2.stoppedMicrosPerHour !== void 0 ? `$${size2.stoppedMicrosPerHour / 1e6} stopped` : "";
15003
15013
  out.push(` ${size2.size.padEnd(8)}${`${size2.vcpu} vCPU, ${size2.memoryMb / 1024} GiB`.padEnd(20)}${`$${size2.listPriceMicrosPerHour / 1e6}`.padEnd(12)}${stopped}`.trimEnd());
15004
15014
  }
15005
15015
  if (body.storage) {
15006
15016
  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.`);
15017
+ out.push(stoppedWords(body.storage));
15008
15018
  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
15019
  }
15010
15020
  return `${out.join("\n")}
15011
15021
  `;
15012
15022
  }
15023
+ function stoppedByShare(body) {
15024
+ return body.storage !== void 0 && body.storage.stoppedMicrosPerGbMonth === void 0;
15025
+ }
15026
+ 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.`;
15031
+ }
15013
15032
  var BURST_DOCS = "https://agental.io/docs/usage#bursts";
15014
15033
  async function headroom(positionals, options) {
15015
15034
  if (positionals[0] === "budget") {
@@ -15507,7 +15526,8 @@ bash) in ~/.bashrc, or agental completion fish | source in ~/.config/fish/config
15507
15526
  The key is kept in ~/.config/agental/credentials.json, readable by you alone. logout deletes the
15508
15527
  key from your account and that file. whoami says who the command is signed in as, and with which
15509
15528
  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.
15529
+ Stop keeps the sandbox filesystem. A stopped sandbox is free for 14 days, then $0.05 a GB a month of
15530
+ what it stores, until it is started or deleted. Processes do not survive a stop.
15511
15531
  resize gives a sandbox a larger size, with more vCPUs, memory and disk, and its files in place; a
15512
15532
  smaller one is refused, as its disk is not made smaller. A stopped sandbox takes it at once, and its
15513
15533
  next start boots it at it. A running one keeps running, and paying, as its size until it is
@@ -15713,7 +15733,7 @@ newest first, each with its day, number, state, total and what it was for, and w
15713
15733
  one that is not paid yet; --limit lists that many of the newest, and --json gives each one's
15714
15734
  page and PDF to the account's owner. details says who the invoices are made out to: the email
15715
15735
  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
15736
+ first $5 of use free, 185 small hours or 11,100 CI minutes, and pays for the rest from
15717
15737
  credits; it makes tiny and small sandboxes. prices lists the plans with the sizes each
15718
15738
  makes, the top-ups with their bonus and the hourly price of each size. card names the card the account
15719
15739
  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.1",
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",