agental 0.30.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.
- package/dist/cli.js +34 -33
- 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.
|
|
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
|
-
|
|
12336
|
-
|
|
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"],
|
|
12339
|
+
var FREE_PLAN = plan("free", 0, ["tiny", "small"], 40);
|
|
12339
12340
|
var PAID_PLANS = [
|
|
12340
|
-
plan("plan100", 100, ["tiny", "small", "medium"],
|
|
12341
|
-
plan("plan500", 500, MACHINE_SIZE_NAMES,
|
|
12342
|
-
plan("plan2000", 2e3, MACHINE_SIZE_NAMES,
|
|
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" };
|
|
@@ -12984,8 +12985,8 @@ async function create(values) {
|
|
|
12984
12985
|
const burstHeaders = maxBurstFeeHeaders(values["max-burst-fee"]);
|
|
12985
12986
|
const ttlSeconds = ttlOption(values.ttl);
|
|
12986
12987
|
const onTimeout = values["on-timeout"];
|
|
12987
|
-
if (onTimeout !== void 0 && onTimeout !== "delete" && onTimeout !== "stop") {
|
|
12988
|
-
throw new Error("--on-timeout is delete or stop: what the sandbox's time limit does when it runs out");
|
|
12988
|
+
if (onTimeout !== void 0 && onTimeout !== "delete" && onTimeout !== "stop" && onTimeout !== "stop-with-memory" && onTimeout !== "stop_with_memory") {
|
|
12989
|
+
throw new Error("--on-timeout is delete, stop or stop-with-memory: what the sandbox's time limit does when it runs out");
|
|
12989
12990
|
}
|
|
12990
12991
|
if (values.size !== void 0 && !isMachineSize(values.size)) {
|
|
12991
12992
|
throw new Error("--size must be tiny, small, medium or large");
|
|
@@ -13012,7 +13013,7 @@ async function create(values) {
|
|
|
13012
13013
|
...allow ? { network: { allow } } : {},
|
|
13013
13014
|
...egressAsked ? { egress: egressAsked } : {},
|
|
13014
13015
|
...ttlSeconds === void 0 ? {} : { ttlSeconds },
|
|
13015
|
-
...onTimeout === void 0 ? {} : { onTimeout },
|
|
13016
|
+
...onTimeout === void 0 ? {} : { onTimeout: onTimeout.replaceAll("-", "_") },
|
|
13016
13017
|
...sshKeys2 === void 0 ? {} : { sshKeys: sshKeys2 },
|
|
13017
13018
|
...given
|
|
13018
13019
|
})
|
|
@@ -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)}
|
|
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}
|
|
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", "
|
|
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
|
|
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")}
|
|
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}
|
|
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
|
|
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
|
-
`
|
|
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
|
|
15271
|
-
const value = mb /
|
|
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: ${
|
|
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
|
|
15289
|
-
const
|
|
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(`
|
|
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(`
|
|
15292
|
+
lines.push(`free starts: over: every start pays a fee${freeAgainWords}`);
|
|
15294
15293
|
} else {
|
|
15295
|
-
lines.push(`
|
|
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"] : {};
|
|
@@ -15561,7 +15560,7 @@ Setting up
|
|
|
15561
15560
|
agental completion zsh|bash|fish
|
|
15562
15561
|
|
|
15563
15562
|
Usage
|
|
15564
|
-
agental create [--name <name>] [--template <template>] [--size tiny|small|medium|large] [--region <region>[,<region>...]] [--ttl <time> | --ttl default] [--on-timeout delete|stop] [--idempotency-key <key>]
|
|
15563
|
+
agental create [--name <name>] [--template <template>] [--size tiny|small|medium|large] [--region <region>[,<region>...]] [--ttl <time> | --ttl default] [--on-timeout delete|stop|stop-with-memory] [--idempotency-key <key>]
|
|
15565
15564
|
${operator ? "[--box <name-or-id>] " : ""}[--allow <address>[,<address>...]] [--egress box | residential:<country>[:sticky|rotating]] [--max-burst-fee <dollars>]
|
|
15566
15565
|
[--ssh-key <public-key-or-file>]... [--tag <tag>[,<tag>...]]... [--meta <key>=<value>]...
|
|
15567
15566
|
agental summary [--where '<words>'] [--tag <tag>[,<tag>...]]... [--meta <key>=<value>]... [--facets <field>[,<field>...]] [--json]
|
|
@@ -15737,7 +15736,9 @@ A sandbox runs until it is stopped, unless it has a time limit: then it is stopp
|
|
|
15737
15736
|
run that long since its last start. create --ttl and template start --ttl set one, as 45m, 2h or
|
|
15738
15737
|
1d, and --ttl default takes the deployment's, which is none unless it says otherwise. When the
|
|
15739
15738
|
time limit runs out the sandbox is deleted, with its disk, unless create --on-timeout stop said to
|
|
15740
|
-
stop it and keep its disk
|
|
15739
|
+
stop it and keep its disk, or --on-timeout stop-with-memory to keep its memory too, so its next
|
|
15740
|
+
start carries on where it was (after the account's first top-up: before it, refused with
|
|
15741
|
+
memory_needs_top_up); agental stop always keeps the disk. auto-stop
|
|
15741
15742
|
says when a running sandbox is to be stopped, with --in or --at moves that stop, later or sooner,
|
|
15742
15743
|
for the run under way, and with --never takes its time limit away, for this run and the next.
|
|
15743
15744
|
${operator ? operator.OPERATOR_HELP : ""}template network says what a sandbox on a template may reach outside itself, and with open,
|
|
@@ -15934,7 +15935,7 @@ first $5 of use free, 185 small hours or 11,100 CI minutes, and pays for the res
|
|
|
15934
15935
|
credits; it makes tiny and small sandboxes. prices lists the plans with the sizes each
|
|
15935
15936
|
makes, the top-ups with their bonus and the hourly price of each size. card names the card the account
|
|
15936
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
|
|
15937
|
-
has the monthly allowance, once a card. Until it buys a top-up it runs 2 small sandboxes
|
|
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.
|
|
15938
15939
|
top-up <dollars> starts buying credits for
|
|
15939
15940
|
any whole number of dollars from 15 to 100,000, and prints the address of the page to pay on.
|
|
15940
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.
|
|
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",
|