agental 0.31.0 → 0.32.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 +27 -28
  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.31.0" : "dev";
7414
+ var CLI_VERSION = true ? "0.32.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}`;
@@ -12332,14 +12332,15 @@ var METRICS_STEP_SECONDS = 60;
12332
12332
 
12333
12333
  // ../src/plans.ts
12334
12334
  var MICROS_PER_DOLLAR = 1e6;
12335
- function plan(id, dollarsPerMonth, sizes, runningUnits, freeBurstUnits) {
12336
- return { id, dollarsPerMonth, includedMicros: dollarsPerMonth * MICROS_PER_DOLLAR, sizes, runningUnits, freeBurstUnits };
12335
+ var FREE_STARTS_PER_RUNNING = 3;
12336
+ function plan(id, dollarsPerMonth, sizes, runningUnits) {
12337
+ return { id, dollarsPerMonth, includedMicros: dollarsPerMonth * MICROS_PER_DOLLAR, sizes, runningUnits, freeBurstUnits: runningUnits * FREE_STARTS_PER_RUNNING };
12337
12338
  }
12338
- var FREE_PLAN = plan("free", 0, ["tiny", "small"], 20, 20);
12339
+ var FREE_PLAN = plan("free", 0, ["tiny", "small"], 40);
12339
12340
  var PAID_PLANS = [
12340
- plan("plan100", 100, ["tiny", "small", "medium"], 100, 100),
12341
- plan("plan500", 500, MACHINE_SIZE_NAMES, 600, 200),
12342
- plan("plan2000", 2e3, MACHINE_SIZE_NAMES, 2e3, 400)
12341
+ plan("plan100", 100, ["tiny", "small", "medium"], 200),
12342
+ plan("plan500", 500, MACHINE_SIZE_NAMES, 1200),
12343
+ plan("plan2000", 2e3, MACHINE_SIZE_NAMES, 4e3)
12343
12344
  ];
12344
12345
  var PLANS = [FREE_PLAN, ...PAID_PLANS];
12345
12346
  var PLAN_NAMES = { free: "Free", plan100: "Fleet", plan500: "Platform", plan2000: "Scale" };
@@ -13048,7 +13049,7 @@ function maxBurstFeeHeaders(given) {
13048
13049
  function sayBurstFee(response) {
13049
13050
  const micros = Number(response.headers.get("Agental-Burst-Fee") ?? "0");
13050
13051
  if (micros > 0) {
13051
- process.stderr.write(`This start cost a burst fee of ${money(micros)}, as the account started sandboxes faster than its plan's free burst. agental headroom says where it stands.
13052
+ 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.
13052
13053
  `);
13053
13054
  }
13054
13055
  }
@@ -14907,7 +14908,7 @@ function describeBilling(body, card = null) {
14907
14908
  lines.push(["Card", describeCard(card)]);
14908
14909
  }
14909
14910
  if (free.cardSaved && !free.paid) {
14910
- lines.push(["At once", `${free.unpaidUnits} small sandboxes until you buy a top-up, then ${(body.plan.runningUnits ?? 20).toLocaleString("en-US")}. A tiny counts half.`]);
14911
+ lines.push(["At once", `${free.unpaidUnits} units until you buy a top-up, then ${(body.plan.runningUnits ?? 40).toLocaleString("en-US")}. A tiny sandbox is 1 unit, a small 2.`]);
14911
14912
  }
14912
14913
  lines.push(["Used", `${money(body.usedMicros)} this month at list price${usedParts(body)}`]);
14913
14914
  const allowance = free.allowanceMicros ?? 0;
@@ -15102,7 +15103,7 @@ function pricesForPeople(body) {
15102
15103
  section(
15103
15104
  "Plans",
15104
15105
  [
15105
- ["", "A MONTH", "CREDITS BACK", "RUN AT ONCE", "START FREE", "SIZES"],
15106
+ ["", "A MONTH", "CREDITS BACK", "RUN AT ONCE", "FREE STARTS, 15 MIN", "SIZES"],
15106
15107
  ...body.tiers.map((tier) => [
15107
15108
  (tier.id ? PLAN_NAMES[tier.id] : void 0) ?? (tier.dollarsPerMonth === 0 ? "Free" : `$${tier.dollarsPerMonth.toLocaleString("en-US")}`),
15108
15109
  wholeMoney(tier.dollarsPerMonth * 1e6),
@@ -15113,8 +15114,8 @@ function pricesForPeople(body) {
15113
15114
  ])
15114
15115
  ],
15115
15116
  [
15116
- ...body.free ? [`Free needs a card saved, charged nothing; it runs ${body.free.unpaidUnits} at once until your first top-up.`] : [],
15117
- ...body.tiers.some((tier) => tier.runningUnits !== void 0) ? ["Counted in small sandboxes: a medium is 2, a large 4, a tiny half."] : []
15117
+ ...body.free ? [`Free needs a card saved, charged nothing; it runs ${body.free.unpaidUnits} units at once until your first top-up.`] : [],
15118
+ ...body.tiers.some((tier) => tier.runningUnits !== void 0) ? ["Counted in units: a tiny sandbox is 1, a small 2, a medium 4, a large 8."] : []
15118
15119
  ]
15119
15120
  );
15120
15121
  }
@@ -15164,23 +15165,23 @@ function describePrices(body) {
15164
15165
  out.push(withSizes ? "Plans, a month, and the sizes each makes" : "Plans, a month");
15165
15166
  for (const tier of body.tiers) {
15166
15167
  const sizes = tier.sizes === void 0 ? "" : tier.sizes.length === body.plans.length ? "every size" : tier.sizes.join(", ");
15167
- 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` : "";
15168
+ const speed = tier.runningUnits !== void 0 && tier.freeBurstUnits !== void 0 ? `${tier.runningUnits.toLocaleString("en-US")} running, ${tier.freeBurstUnits.toLocaleString("en-US")} free starts` : 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` : "";
15168
15169
  const price = tier.dollarsPerMonth === 0 ? "Free" : `$${tier.dollarsPerMonth.toLocaleString("en-US")}`;
15169
15170
  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`;
15170
15171
  out.push(` ${price.padEnd(8)}${included.padEnd(28)}${speed.padEnd(34)}${sizes}`.trimEnd());
15171
15172
  }
15172
15173
  if (body.free) {
15173
15174
  out.push(
15174
- ` 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.`
15175
+ ` 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} units at once until you buy a top-up.`
15175
15176
  );
15176
15177
  }
15177
15178
  if (body.tiers.some((tier) => tier.runningUnits !== void 0)) {
15178
- out.push(" Counted in small sandboxes: a medium is 2, a large 4, a tiny half.");
15179
+ out.push(" Counted in units: a tiny sandbox is 1, a small 2, a medium 4, a large 8. Free starts are in any 15 minutes.");
15179
15180
  }
15180
15181
  }
15181
15182
  if (body.burstFee) {
15182
15183
  out.push(
15183
- `Starting faster than the free burst costs a fee: $0.027 for each small sandbox past it, $0.108 for a large, never more than one more hour of what you start. What was started falls by half every ${body.burstFee.halfLifeMinutes} minutes. At most ${wholeMoney(body.burstFee.defaultBudgetMicros)} a month unless you set another budget: agental headroom budget <dollars>.`
15184
+ `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>.`
15184
15185
  );
15185
15186
  }
15186
15187
  if (body.topUps?.length) {
@@ -15267,8 +15268,8 @@ function describeHeadroom(body, today, endsNow) {
15267
15268
  const answer3 = body && typeof body === "object" ? body : {};
15268
15269
  const now = answer3["now"] && typeof answer3["now"] === "object" ? answer3["now"] : {};
15269
15270
  const number = (from, name) => typeof from[name] === "number" ? from[name] : 0;
15270
- const smalls = (mb) => {
15271
- const value = mb / 4096;
15271
+ const units = (mb) => {
15272
+ const value = mb / 2048;
15272
15273
  return (Number.isInteger(value) ? value : Math.round(value * 10) / 10).toLocaleString("en-US");
15273
15274
  };
15274
15275
  const clock = (iso) => {
@@ -15277,22 +15278,20 @@ function describeHeadroom(body, today, endsNow) {
15277
15278
  };
15278
15279
  const range = today ? "today (UTC)" : `from ${String(answer3["from"] ?? "")} to ${String(answer3["to"] ?? "")}`;
15279
15280
  const lines = [
15280
- `running: ${smalls(number(now, "runningMb"))} of ${number(now, "runningUnits").toLocaleString("en-US")} small sandboxes (a medium is 2, a large 4, a tiny half); at the running count ${duration(number(answer3, "atRunningCountMs"))} ${range}`
15281
+ `running: ${units(number(now, "runningMb"))} of ${number(now, "runningUnits").toLocaleString("en-US")} units (a tiny is 1, a small 2, a medium 4, a large 8); at the running count ${duration(number(answer3, "atRunningCountMs"))} ${range}`
15281
15282
  ];
15282
15283
  const bursts = Array.isArray(answer3["bursts"]) ? answer3["bursts"] : [];
15283
15284
  const open = endsNow ? bursts.find((one) => one["endedAt"] === null && typeof one["startedAt"] === "string") : void 0;
15284
- const meterMb = number(now, "meterMb");
15285
- const freeMb = number(now, "freeMb");
15286
- const halfLife = number(now, "halfLifeMinutes");
15287
15285
  const over = number(now, "overMb") > 0;
15288
- const freeAgain = !over || freeMb <= 0 || halfLife <= 0 ? null : Math.ceil(halfLife * Math.log2(meterMb / freeMb));
15289
- const freeAgainWords = freeAgain === null ? "" : `; free again in ${freeAgain.toLocaleString("en-US")} min`;
15286
+ const nextStart = Array.isArray(now["nextStart"]) ? now["nextStart"] : [];
15287
+ const wait = typeof nextStart[0]?.["freeInSeconds"] === "number" ? nextStart[0]["freeInSeconds"] : null;
15288
+ const freeAgainWords = !over || wait === null || wait <= 0 ? "" : `; free at ${clock(new Date(Math.ceil((Date.now() + wait * 1e3) / 6e4) * 6e4).toISOString())}`;
15290
15289
  if (open && over) {
15291
- lines.push(`burst: in a burst since ${clock(String(open["startedAt"]))}: every start pays a fee${freeAgainWords}`);
15290
+ lines.push(`free starts: over since ${clock(String(open["startedAt"]))}: every start pays a fee${freeAgainWords}`);
15292
15291
  } else if (over) {
15293
- lines.push(`burst: over the free burst: every start pays a fee${freeAgainWords}`);
15292
+ lines.push(`free starts: over: every start pays a fee${freeAgainWords}`);
15294
15293
  } else {
15295
- lines.push(`burst: free burst ${smalls(number(now, "freeNowMb"))} of ${number(now, "freeBurstUnits").toLocaleString("en-US")} small free now; the meter falls by half every ${halfLife} minutes`);
15294
+ lines.push(`free starts: ${units(number(now, "meterMb"))} of ${number(now, "freeBurstUnits").toLocaleString("en-US")} units used in the last 15 min`);
15296
15295
  }
15297
15296
  lines.push(`fees: ${money(number(now, "spentMicros"))} this month of a ${money(number(now, "budgetMicros"))} budget`);
15298
15297
  const refused = answer3["refused"] && typeof answer3["refused"] === "object" ? answer3["refused"] : {};
@@ -15936,7 +15935,7 @@ first $5 of use free, 185 small hours or 11,100 CI minutes, and pays for the res
15936
15935
  credits; it makes tiny and small sandboxes. prices lists the plans with the sizes each
15937
15936
  makes, the top-ups with their bonus and the hourly price of each size. card names the card the account
15938
15937
  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
15939
- has the monthly allowance, once a card. Until it buys a top-up it runs 2 small sandboxes at once, then 20.
15938
+ has the monthly allowance, once a card. Until it buys a top-up it runs 4 units at once (2 small sandboxes), then 40.
15940
15939
  top-up <dollars> starts buying credits for
15941
15940
  any whole number of dollars from 15 to 100,000, and prints the address of the page to pay on.
15942
15941
  From $200 a top-up adds a bonus, 2% there and growing to 25% at $10,000: $500 adds $537.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agental",
3
- "version": "0.31.0",
3
+ "version": "0.32.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",