agental 0.33.0 → 0.36.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 +42 -26
- 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.36.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}`;
|
|
@@ -9389,7 +9389,7 @@ var COMMANDS = [
|
|
|
9389
9389
|
[" --allow <addresses>", "reach only these addresses, comma-separated"],
|
|
9390
9390
|
[" --egress <egress>", "box, or residential:<country>[:sticky|rotating]"],
|
|
9391
9391
|
[" --spot", "half the price, in spare room taken back when needed"],
|
|
9392
|
-
[" --on-reclaim <what>", "with --spot: stop (default)
|
|
9392
|
+
[" --on-reclaim <what>", "with --spot: stop (default) or delete"],
|
|
9393
9393
|
[" --warn-at <chance>", "with --spot: warn at this chance, as 0.5 or 50%"],
|
|
9394
9394
|
[" --ssh-key <key or file>", "let this key in over SSH (may be given again)"],
|
|
9395
9395
|
[" --tag <tag>", "label it (may be given again)"],
|
|
@@ -9515,8 +9515,8 @@ var COMMANDS = [
|
|
|
9515
9515
|
{ name: "egress", summary: "Say where a sandbox's web traffic leaves from, or read your residential egress.", examples: ["agental egress sbx_2a9a47e50daec64a residential de"] },
|
|
9516
9516
|
{
|
|
9517
9517
|
name: "spot",
|
|
9518
|
-
summary: "Read a spot sandbox's chance of being stopped, change what a reclaim does to it, or
|
|
9519
|
-
examples: ["agental spot sbx_2a9a47e50daec64a", "agental spot sbx_2a9a47e50daec64a --on-reclaim
|
|
9518
|
+
summary: "Read a spot sandbox's chance of being stopped, change what a reclaim does to it, or turn off spot.",
|
|
9519
|
+
examples: ["agental spot sbx_2a9a47e50daec64a", "agental spot sbx_2a9a47e50daec64a --on-reclaim delete --warn-at 30%", "agental spot sbx_2a9a47e50daec64a off"]
|
|
9520
9520
|
},
|
|
9521
9521
|
{ name: "templates", summary: "List your templates: what new sandboxes start from." },
|
|
9522
9522
|
{
|
|
@@ -12470,10 +12470,14 @@ var SPOT_PRICE_MICROS_PER_HOUR = {
|
|
|
12470
12470
|
medium: LIST_PRICE_MICROS_PER_HOUR.medium / 2,
|
|
12471
12471
|
large: LIST_PRICE_MICROS_PER_HOUR.large / 2
|
|
12472
12472
|
};
|
|
12473
|
+
var SPOT_ON_RECLAIM = ["delete", "stop"];
|
|
12474
|
+
var SPOT_ON_RECLAIM_READ = [...SPOT_ON_RECLAIM, "upgrade"];
|
|
12475
|
+
var SPOT_RUN_LIMIT_SECONDS = 24 * 60 * 60;
|
|
12473
12476
|
var HOURS_PER_MONTH = 730;
|
|
12474
12477
|
var STOPPED_MICROS_PER_GB_MONTH = 5e4;
|
|
12475
12478
|
var BYTES_PER_GB = 1e9;
|
|
12476
12479
|
var NEVER_PAID_MAX_STORED_BYTES = 20 * BYTES_PER_GB;
|
|
12480
|
+
var STOPPED_DELETION_NOTICE_MS = 3 * 864e5;
|
|
12477
12481
|
function stoppedMicrosPerHour(storedBytes) {
|
|
12478
12482
|
if (storedBytes <= 0) {
|
|
12479
12483
|
return 0;
|
|
@@ -13892,7 +13896,7 @@ async function autoStop(id, inText, at4, never, asJson) {
|
|
|
13892
13896
|
);
|
|
13893
13897
|
return;
|
|
13894
13898
|
}
|
|
13895
|
-
const by = body.setBy === "sandbox" ? "as the sandbox itself set" : body.setBy === "account" ? "as moved from its account" : `its last start and ${body.ttlSeconds === null ? "the deployment's time limit" : timeInWords(body.ttlSeconds)}`;
|
|
13899
|
+
const by = body.setBy === "spot_limit" ? "a spot sandbox runs at most 24 hours at a time; agental spot <sandbox-id> off runs it on at the list price" : body.setBy === "sandbox" ? "as the sandbox itself set" : body.setBy === "account" ? "as moved from its account" : `its last start and ${body.ttlSeconds === null ? "the deployment's time limit" : timeInWords(body.ttlSeconds)}`;
|
|
13896
13900
|
process.stdout.write(`${body.sandboxId} stops at ${body.autoStopAt}, in ${timeInWords(body.secondsLeft ?? 0)}: ${by}.
|
|
13897
13901
|
`);
|
|
13898
13902
|
}
|
|
@@ -14276,8 +14280,8 @@ async function egress(positionals, values) {
|
|
|
14276
14280
|
}
|
|
14277
14281
|
function spotSettingsFrom(values) {
|
|
14278
14282
|
const onReclaim = values["on-reclaim"];
|
|
14279
|
-
if (onReclaim !== void 0 && onReclaim !== "delete" && onReclaim !== "stop"
|
|
14280
|
-
throw new Error("--on-reclaim is delete
|
|
14283
|
+
if (onReclaim !== void 0 && onReclaim !== "delete" && onReclaim !== "stop") {
|
|
14284
|
+
throw new Error("--on-reclaim is delete or stop: what is done to a spot sandbox when its room is taken back.");
|
|
14281
14285
|
}
|
|
14282
14286
|
const given = values["warn-at"];
|
|
14283
14287
|
const percent = given?.endsWith("%") ? Number(given.slice(0, -1)) / 100 : Number(given);
|
|
@@ -14289,29 +14293,29 @@ function spotSettingsFrom(values) {
|
|
|
14289
14293
|
function spotInWords(sandbox) {
|
|
14290
14294
|
const spot2 = sandbox?.["spot"];
|
|
14291
14295
|
if (!spot2) {
|
|
14292
|
-
return "a
|
|
14296
|
+
return "spot off: a standard sandbox, at the list price";
|
|
14293
14297
|
}
|
|
14294
14298
|
const done2 = {
|
|
14295
14299
|
delete: "deleted when its room is taken back",
|
|
14296
|
-
stop: "stopped when its room is taken back, its disk kept"
|
|
14297
|
-
upgrade: "made normal at the list price when its room is taken back, or stopped where that frees nothing"
|
|
14300
|
+
stop: "stopped when its room is taken back, its disk kept"
|
|
14298
14301
|
};
|
|
14299
14302
|
const chance = typeof spot2.reclaimChance === "number" ? `${Math.round(spot2.reclaimChance * 100)}% chance of being stopped in the next minute` : "no chance worked out while it is not running";
|
|
14300
14303
|
const warnAt = typeof spot2.warnAt === "number" ? `, warned at ${Math.round(spot2.warnAt * 100)}%` : "";
|
|
14301
14304
|
return `spot, ${done2[String(spot2.onReclaim)] ?? String(spot2.onReclaim)}; ${chance}${warnAt}`;
|
|
14302
14305
|
}
|
|
14303
14306
|
async function spot(positionals, values) {
|
|
14304
|
-
const [id,
|
|
14305
|
-
const
|
|
14306
|
-
|
|
14307
|
+
const [id, given, ...rest] = positionals;
|
|
14308
|
+
const word = given === "normal" ? "off" : given;
|
|
14309
|
+
const how = "spot takes <sandbox-id>, and then nothing, off, or --on-reclaim delete|stop and --warn-at <chance>, as agental spot sbx_2a9a47e50daec64a --on-reclaim delete.";
|
|
14310
|
+
if (id === void 0 || rest.length > 0 || word !== void 0 && word !== "off") {
|
|
14307
14311
|
throw new Error(how);
|
|
14308
14312
|
}
|
|
14309
14313
|
const settings = spotSettingsFrom(values);
|
|
14310
|
-
if (word === "
|
|
14314
|
+
if (word === "off" && Object.keys(settings).length > 0) {
|
|
14311
14315
|
throw new Error(how);
|
|
14312
14316
|
}
|
|
14313
14317
|
const path6 = `/v1/sandboxes/${encodeURIComponent(id)}`;
|
|
14314
|
-
const change = word === "
|
|
14318
|
+
const change = word === "off" ? { spot: null } : Object.keys(settings).length > 0 ? { spot: settings } : null;
|
|
14315
14319
|
const body = await call2(path6, change === null ? { method: "GET" } : { method: "PATCH", body: JSON.stringify(change) });
|
|
14316
14320
|
process.stdout.write(values.json ? `${JSON.stringify(body?.["spot"] ?? null, null, 2)}
|
|
14317
14321
|
` : `${id}: ${spotInWords(body)}
|
|
@@ -15026,9 +15030,9 @@ async function telemetry(positionals, given, asJson) {
|
|
|
15026
15030
|
}
|
|
15027
15031
|
async function billing(positionals, asJson, limit) {
|
|
15028
15032
|
const [what, amount, ...rest] = positionals;
|
|
15029
|
-
const kinds = ["prices", "compare", "invoices", "card", "details", "top-up", "auto-reload"];
|
|
15033
|
+
const kinds = ["prices", "compare", "invoices", "card", "details", "top-up", "auto-reload", "email-copy"];
|
|
15030
15034
|
const near = what !== void 0 && !kinds.includes(what) ? nearest(what, kinds) : null;
|
|
15031
|
-
const usage = `${near ? `billing has no ${what}: did you mean billing ${near}? ` : ""}billing takes nothing, prices, compare, invoices, card, card save, details, top-up <dollars>,
|
|
15035
|
+
const usage = `${near ? `billing has no ${what}: did you mean billing ${near}? ` : ""}billing takes nothing, prices, compare, invoices, card, card save, details, top-up <dollars>, auto-reload <dollars | off>, or email-copy`;
|
|
15032
15036
|
if (rest.length > 0 || what !== "top-up" && what !== "auto-reload" && !(what === "card" && amount === "save") && amount !== void 0) {
|
|
15033
15037
|
throw new Error(usage);
|
|
15034
15038
|
}
|
|
@@ -15111,6 +15115,17 @@ Nothing is charged until it is paid. agental billing shows it within a minute of
|
|
|
15111
15115
|
`);
|
|
15112
15116
|
return;
|
|
15113
15117
|
}
|
|
15118
|
+
case "email-copy": {
|
|
15119
|
+
const body = await asked("/v1/billing/email-copy", { method: "GET" });
|
|
15120
|
+
print4(
|
|
15121
|
+
body,
|
|
15122
|
+
() => body.address === null ? "Billing emails go to the owners alone. An owner can add an address for a copy of each under Billing in the console.\n" : body.confirmed === false ? `${body.address} gets no copies yet: it has to confirm by the link sent to it. An owner can send a new one under Billing in the console.
|
|
15123
|
+
` : body.waiting === true ? `${body.address} gets no copies for now: whoever set it is no longer an owner. An owner keeps it or removes it under Billing in the console.
|
|
15124
|
+
` : `Billing emails also go to ${body.address}: out of credit, reloads, a failed payment, the free allowance. An owner changes it under Billing in the console.
|
|
15125
|
+
`
|
|
15126
|
+
);
|
|
15127
|
+
return;
|
|
15128
|
+
}
|
|
15114
15129
|
default:
|
|
15115
15130
|
throw new Error(usage);
|
|
15116
15131
|
}
|
|
@@ -15179,7 +15194,7 @@ function describeBilling(body, card = null) {
|
|
|
15179
15194
|
if (free.cardSaved) {
|
|
15180
15195
|
lines.push([
|
|
15181
15196
|
"Allowance",
|
|
15182
|
-
allowance > 0 ? `${money(allowance)}, ${money(Math.max(0, allowance - (free.allowanceUsedMicros ?? 0)))} left. It starts again on
|
|
15197
|
+
allowance > 0 ? `${money(allowance)}, ${money(Math.max(0, allowance - (free.allowanceUsedMicros ?? 0)))} left. It starts again ${body.period ? `on ${dayOf(body.period.end)}` : "next month"}.` : "none: the card you saved had the free allowance on another account."
|
|
15183
15198
|
]);
|
|
15184
15199
|
}
|
|
15185
15200
|
lines.push(["Credits left", `${money(body.topUpMicros)} of top-ups, used after the free allowance. They do not expire.`]);
|
|
@@ -15834,7 +15849,7 @@ Setting up
|
|
|
15834
15849
|
|
|
15835
15850
|
Usage
|
|
15836
15851
|
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>]
|
|
15837
|
-
[--spot [--on-reclaim delete|stop
|
|
15852
|
+
[--spot [--on-reclaim delete|stop] [--warn-at <chance>]]
|
|
15838
15853
|
${operator ? "[--box <name-or-id>] " : ""}[--allow <address>[,<address>...]] [--egress box | residential:<country>[:sticky|rotating]] [--max-burst-fee <dollars>]
|
|
15839
15854
|
[--ssh-key <public-key-or-file>]... [--tag <tag>[,<tag>...]]... [--meta <key>=<value>]...
|
|
15840
15855
|
agental summary [--where '<words>'] [--tag <tag>[,<tag>...]]... [--meta <key>=<value>]... [--facets <field>[,<field>...]] [--json]
|
|
@@ -15860,7 +15875,7 @@ Usage
|
|
|
15860
15875
|
agental auto-stop <sandbox-id> [--in <time> | --at <date-time> | --never] [--json]
|
|
15861
15876
|
agental network <sandbox-id> [--allow <address>[,<address>...] | --none] [--json]
|
|
15862
15877
|
agental egress <sandbox-id> [box | residential <country> [sticky | rotating]] [--json]
|
|
15863
|
-
agental spot <sandbox-id> [
|
|
15878
|
+
agental spot <sandbox-id> [off] [--on-reclaim delete|stop] [--warn-at <chance>] [--json]
|
|
15864
15879
|
agental templates [--json]
|
|
15865
15880
|
agental template create <name> [--tag <tag>[,<tag>...]]... [--meta <key>=<value>]...
|
|
15866
15881
|
agental template show <template> [--json]
|
|
@@ -15942,7 +15957,7 @@ Usage
|
|
|
15942
15957
|
agental key show <key> [--json]
|
|
15943
15958
|
agental key allow-from <key> (<address-or-range>... | --anywhere) [--json]
|
|
15944
15959
|
agental key delete <key>
|
|
15945
|
-
agental billing [prices | compare | card [save] | details | top-up <dollars> | auto-reload <dollars | off>] [--json]
|
|
15960
|
+
agental billing [prices | compare | card [save] | details | top-up <dollars> | auto-reload <dollars | off> | email-copy] [--json]
|
|
15946
15961
|
agental billing invoices [--limit <n>] [--json]
|
|
15947
15962
|
agental headroom [--from <day or date-time>] [--to <day or date-time>] [--step 10m|hour|day] [--json]
|
|
15948
15963
|
agental headroom budget <dollars> | budget default [--json]
|
|
@@ -16018,13 +16033,12 @@ memory_needs_top_up); agental stop always keeps the disk. auto-stop
|
|
|
16018
16033
|
says when a running sandbox is to be stopped, with --in or --at moves that stop, later or sooner,
|
|
16019
16034
|
for the run under way, and with --never takes its time limit away, for this run and the next.
|
|
16020
16035
|
create --spot makes a spot sandbox: half the list price, in room on our servers nobody else is
|
|
16021
|
-
paying for, taken back when a
|
|
16022
|
-
stop (the default) stops it and keeps its disk, never its memory; delete deletes it
|
|
16023
|
-
|
|
16024
|
-
needed, and stops it otherwise. It is not counted in the plan's running count, and comes with
|
|
16036
|
+
paying for, taken back when a standard sandbox needs it. --on-reclaim says what is then done to it:
|
|
16037
|
+
stop (the default) stops it and keeps its disk, never its memory; delete deletes it. One run
|
|
16038
|
+
lasts at most 24 hours, and is then stopped with its disk. It is not counted in the plan's running count, and comes with
|
|
16025
16039
|
the account's first top-up. agental spot shows its chance of being stopped in the next minute, a
|
|
16026
16040
|
hint and not a promise, and with --warn-at sets the chance at which sandbox.reclaim_chance is sent
|
|
16027
|
-
(0.5 when left out); agental spot <sandbox-id>
|
|
16041
|
+
(0.5 when left out); agental spot <sandbox-id> off turns off spot: a standard sandbox from then on.
|
|
16028
16042
|
${operator ? operator.OPERATOR_HELP : ""}template network says what a sandbox on a template may reach outside itself, and with open,
|
|
16029
16043
|
blocked or allowlist sets it: everything, nothing, or only the addresses that follow, which are
|
|
16030
16044
|
IPv4 addresses and ranges such as 203.0.113.7 and 198.51.100.0/24. The rule that is given takes
|
|
@@ -16227,6 +16241,8 @@ Nothing is charged until it is paid there. auto-reload <dollars> has the card sa
|
|
|
16227
16241
|
last purchase charged for a top-up of that much, with tax, when your credits run out, and the
|
|
16228
16242
|
credits added before any sandbox is stopped: at most three times a day, and not again for a
|
|
16229
16243
|
day after a card that would not pay. auto-reload off turns it off.
|
|
16244
|
+
email-copy shows the address a copy of each billing email goes to, beside the owner, if any:
|
|
16245
|
+
an owner sets it under Billing in the console.
|
|
16230
16246
|
account export prints everything agental keeps about your account and you, as JSON: the
|
|
16231
16247
|
account, its sessions with the address and browser each began from, its keys by name, billing,
|
|
16232
16248
|
payments, usage, and what it has made. Secrets are named, never given. --out writes it to a file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agental",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.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",
|