agental 0.76.0 → 0.79.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 +302 -126
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7424,7 +7424,7 @@ function requestHeaders(given) {
|
|
|
7424
7424
|
|
|
7425
7425
|
// ../src/cli-build.ts
|
|
7426
7426
|
var PUBLISHED = true;
|
|
7427
|
-
var CLI_VERSION = true ? "0.
|
|
7427
|
+
var CLI_VERSION = true ? "0.79.0" : "dev";
|
|
7428
7428
|
var DEFAULT_API_URL = true ? "https://agental.io" : "http://127.0.0.1:8741";
|
|
7429
7429
|
var PACKAGE_NAME = "agental";
|
|
7430
7430
|
var USER_AGENT = `agental-cli/${CLI_VERSION}`;
|
|
@@ -9511,7 +9511,7 @@ var COMMANDS = [
|
|
|
9511
9511
|
["-t, --template <template>", "what it starts from (default: your default template)"],
|
|
9512
9512
|
[" --snapshot <snapshot-id>", "start it from this snapshot's disk"],
|
|
9513
9513
|
[" --image <image>[@<build>]", "start it from your image: its newest ready build, or that build"],
|
|
9514
|
-
["-s, --size <size>", "tiny
|
|
9514
|
+
["-s, --size <size>", "tiny to xlarge, or one of your own (default: the template's)"],
|
|
9515
9515
|
[" --region <region>", "where it runs; agental regions lists them"],
|
|
9516
9516
|
[" --ttl <time>", "delete it after this long, as 30m or 2h"],
|
|
9517
9517
|
[" --on-timeout <what>", "what the limit does: delete (default), stop (keeps its disk) or pause"],
|
|
@@ -9706,6 +9706,12 @@ var COMMANDS = [
|
|
|
9706
9706
|
also: "meta <sandbox-id> [set <key>=<value>... | unset <key>...]"
|
|
9707
9707
|
},
|
|
9708
9708
|
{ name: "regions", summary: "List where sandboxes run, and how much room each has now." },
|
|
9709
|
+
{
|
|
9710
|
+
name: "sizes",
|
|
9711
|
+
summary: "List the sizes, and make or retire your organization's own.",
|
|
9712
|
+
usage: ["agental sizes [--json]", "agental sizes add <name> --vcpus <n> --memory <GiB> --disk <GB> [--where own|agental|both] [--json]", "agental sizes retire <name> [--json]"],
|
|
9713
|
+
examples: ["agental sizes add build-64 --vcpus 16 --memory 64 --disk 200", "agental create --size build-64"]
|
|
9714
|
+
},
|
|
9709
9715
|
{ name: "network", summary: "Say what a sandbox may reach outside itself.", examples: ["agental network sbx_2a9a47e50daec64a --allow github.com,registry.npmjs.org", "agental network sbx_2a9a47e50daec64a --none"] },
|
|
9710
9716
|
{ name: "egress", summary: "Say where a sandbox's web traffic leaves from, or read your residential egress.", examples: ["agental egress sbx_2a9a47e50daec64a residential de"] },
|
|
9711
9717
|
{
|
|
@@ -9857,11 +9863,17 @@ var COMMANDS = [
|
|
|
9857
9863
|
{
|
|
9858
9864
|
name: "secret",
|
|
9859
9865
|
summary: "Keep your organization's secrets, sealed on this machine before they are sent, and give them to templates and sandboxes.",
|
|
9860
|
-
examples: [
|
|
9866
|
+
examples: [
|
|
9867
|
+
"agental secret set GITHUB_TOKEN --host api.github.com,github.com",
|
|
9868
|
+
"agental secret use GITHUB_TOKEN --template default",
|
|
9869
|
+
"agental secret use GH_TOKEN_REVIEWER --template reviewer --as GH_TOKEN",
|
|
9870
|
+
"agental secret list"
|
|
9871
|
+
],
|
|
9861
9872
|
flags: [
|
|
9862
9873
|
["--host <host>[,<host>...]", "set, seal: the hosts its value may go to, and no other"],
|
|
9863
9874
|
["--template <template>", "use, unuse: the template whose sandboxes see it"],
|
|
9864
9875
|
["--sandbox <sandbox-id>", "use, unuse: the one sandbox that sees it"],
|
|
9876
|
+
["--as <VARIABLE>", "use: the variable its commands see it under, where not its own name"],
|
|
9865
9877
|
["--yes", "delete: go on without asking"],
|
|
9866
9878
|
["--json", "print as JSON"]
|
|
9867
9879
|
]
|
|
@@ -10351,6 +10363,78 @@ function sandboxIn(words2, valued = []) {
|
|
|
10351
10363
|
return { sandbox: void 0, others: words2 };
|
|
10352
10364
|
}
|
|
10353
10365
|
|
|
10366
|
+
// ../src/domain.ts
|
|
10367
|
+
var MACHINE_SIZES = {
|
|
10368
|
+
tiny: { vcpu: 1, memoryMb: 2048, diskGb: 20 },
|
|
10369
|
+
small: { vcpu: 2, memoryMb: 4096, diskGb: 40 },
|
|
10370
|
+
medium: { vcpu: 4, memoryMb: 8192, diskGb: 80 },
|
|
10371
|
+
large: { vcpu: 8, memoryMb: 16384, diskGb: 160 },
|
|
10372
|
+
xlarge: { vcpu: 16, memoryMb: 32768, diskGb: 320 }
|
|
10373
|
+
};
|
|
10374
|
+
var MACHINE_SIZE_NAMES = ["tiny", "small", "medium", "large", "xlarge"];
|
|
10375
|
+
var CUSTOM_SIZES = /* @__PURE__ */ new Map();
|
|
10376
|
+
var LIST_PRICE_MICROS_PER_HOUR = {
|
|
10377
|
+
tiny: 13500,
|
|
10378
|
+
small: 27e3,
|
|
10379
|
+
medium: 54e3,
|
|
10380
|
+
large: 108e3,
|
|
10381
|
+
xlarge: 216e3
|
|
10382
|
+
};
|
|
10383
|
+
var SPOT_PRICE_MICROS_PER_HOUR = {
|
|
10384
|
+
tiny: LIST_PRICE_MICROS_PER_HOUR.tiny / 2,
|
|
10385
|
+
small: LIST_PRICE_MICROS_PER_HOUR.small / 2,
|
|
10386
|
+
medium: LIST_PRICE_MICROS_PER_HOUR.medium / 2,
|
|
10387
|
+
large: LIST_PRICE_MICROS_PER_HOUR.large / 2,
|
|
10388
|
+
xlarge: LIST_PRICE_MICROS_PER_HOUR.xlarge / 2
|
|
10389
|
+
};
|
|
10390
|
+
var SPOT_ON_RECLAIM = ["delete", "stop"];
|
|
10391
|
+
var SPOT_ON_RECLAIM_READ = [...SPOT_ON_RECLAIM, "upgrade"];
|
|
10392
|
+
var HOURS_PER_MONTH = 730;
|
|
10393
|
+
var STOPPED_MICROS_PER_GB_MONTH = 5e4;
|
|
10394
|
+
var BYTES_PER_GB = 1e9;
|
|
10395
|
+
var NEVER_PAID_MAX_STORED_BYTES = 20 * BYTES_PER_GB;
|
|
10396
|
+
var STOPPED_DELETION_NOTICE_MS = 3 * 864e5;
|
|
10397
|
+
function stoppedMicrosPerHour(storedBytes) {
|
|
10398
|
+
if (storedBytes <= 0) {
|
|
10399
|
+
return 0;
|
|
10400
|
+
}
|
|
10401
|
+
return Math.max(1, Math.round(storedBytes * STOPPED_MICROS_PER_GB_MONTH / (BYTES_PER_GB * HOURS_PER_MONTH)));
|
|
10402
|
+
}
|
|
10403
|
+
function wholeStoredBytes(size2, withMemory) {
|
|
10404
|
+
const resources = resourcesFor(size2);
|
|
10405
|
+
return resources.diskGb * 2 ** 30 + (withMemory ? resources.memoryMb * 2 ** 20 : 0);
|
|
10406
|
+
}
|
|
10407
|
+
var STOPPED_MAX_MICROS_PER_HOUR = {
|
|
10408
|
+
tiny: stoppedMicrosPerHour(wholeStoredBytes("tiny", false)),
|
|
10409
|
+
small: stoppedMicrosPerHour(wholeStoredBytes("small", false)),
|
|
10410
|
+
medium: stoppedMicrosPerHour(wholeStoredBytes("medium", false)),
|
|
10411
|
+
large: stoppedMicrosPerHour(wholeStoredBytes("large", false)),
|
|
10412
|
+
xlarge: stoppedMicrosPerHour(wholeStoredBytes("xlarge", false))
|
|
10413
|
+
};
|
|
10414
|
+
var STOPPED_WITH_MEMORY_MAX_MICROS_PER_HOUR = {
|
|
10415
|
+
tiny: stoppedMicrosPerHour(wholeStoredBytes("tiny", true)),
|
|
10416
|
+
small: stoppedMicrosPerHour(wholeStoredBytes("small", true)),
|
|
10417
|
+
medium: stoppedMicrosPerHour(wholeStoredBytes("medium", true)),
|
|
10418
|
+
large: stoppedMicrosPerHour(wholeStoredBytes("large", true)),
|
|
10419
|
+
xlarge: stoppedMicrosPerHour(wholeStoredBytes("xlarge", true))
|
|
10420
|
+
};
|
|
10421
|
+
var SANDBOX_STATUSES = ["creating", "running", "stopped", "error", "deleted"];
|
|
10422
|
+
var SHOWN_STATUSES = [...SANDBOX_STATUSES, "restoring", "paused"];
|
|
10423
|
+
var OUTBOUND_MODES = ["open", "blocked", "allowlist"];
|
|
10424
|
+
function isMachineSize(value) {
|
|
10425
|
+
return Object.hasOwn(MACHINE_SIZES, value);
|
|
10426
|
+
}
|
|
10427
|
+
function resourcesFor(size2) {
|
|
10428
|
+
if (isMachineSize(size2)) {
|
|
10429
|
+
return MACHINE_SIZES[size2];
|
|
10430
|
+
}
|
|
10431
|
+
const custom = CUSTOM_SIZES.get(size2);
|
|
10432
|
+
if (custom === void 0) {
|
|
10433
|
+
throw new Error(`Size ${size2} is neither one of the five nor a custom size there is.`);
|
|
10434
|
+
}
|
|
10435
|
+
return { vcpu: custom.vcpu, memoryMb: custom.memoryMb, diskGb: custom.diskGb };
|
|
10436
|
+
}
|
|
10437
|
+
|
|
10354
10438
|
// ../src/cli-completion.ts
|
|
10355
10439
|
var SHELLS = ["zsh", "bash", "fish"];
|
|
10356
10440
|
var SUBCOMMANDS = {
|
|
@@ -10424,6 +10508,7 @@ var SNAPSHOT = /^<snapshot/;
|
|
|
10424
10508
|
var IMAGE = /^<image>/;
|
|
10425
10509
|
var SERVER = /^<server>/;
|
|
10426
10510
|
var JOB = /^<job>/;
|
|
10511
|
+
var SIZE = /^<size>/;
|
|
10427
10512
|
var KEPT_SHELL = /^<shell>/;
|
|
10428
10513
|
var COMMAND_ID = /^<command-id>/;
|
|
10429
10514
|
async function complete(typed, reference, operator, fetchJson) {
|
|
@@ -10463,7 +10548,7 @@ async function complete(typed, reference, operator, fetchJson) {
|
|
|
10463
10548
|
const usages = [...found?.usage ?? [], ...usageOf(reference).get(name) ?? []];
|
|
10464
10549
|
const flags2 = flagsOf(usages);
|
|
10465
10550
|
const last = before[before.length - 1];
|
|
10466
|
-
const valueOf = flags2.get(last) ?? (last === "-t" ? "<template>" : last === "-s" ? "
|
|
10551
|
+
const valueOf = flags2.get(last) ?? (last === "-t" ? "<template>" : last === "-s" ? "<size>" : void 0);
|
|
10467
10552
|
if (valueOf !== void 0 && valueOf !== null) {
|
|
10468
10553
|
if (TEMPLATE.test(valueOf)) {
|
|
10469
10554
|
return starting(await templates(fetchJson));
|
|
@@ -10477,6 +10562,9 @@ async function complete(typed, reference, operator, fetchJson) {
|
|
|
10477
10562
|
if (IMAGE.test(valueOf)) {
|
|
10478
10563
|
return starting(await images(fetchJson));
|
|
10479
10564
|
}
|
|
10565
|
+
if (SIZE.test(valueOf)) {
|
|
10566
|
+
return starting(await sizes(fetchJson));
|
|
10567
|
+
}
|
|
10480
10568
|
if (KEPT_SHELL.test(valueOf)) {
|
|
10481
10569
|
const sandbox2 = before.slice(1).find((word) => /^sbx_[A-Za-z0-9]+$/.test(word));
|
|
10482
10570
|
return sandbox2 ? starting(await keptShells(fetchJson, sandbox2)) : [];
|
|
@@ -10504,6 +10592,7 @@ async function complete(typed, reference, operator, fetchJson) {
|
|
|
10504
10592
|
let wantsCommand = false;
|
|
10505
10593
|
let wantsServer = false;
|
|
10506
10594
|
let wantsImage = false;
|
|
10595
|
+
let wantsSize = false;
|
|
10507
10596
|
for (const usage of usages) {
|
|
10508
10597
|
const parts = partsOf(usage).slice(1);
|
|
10509
10598
|
const fits = positionals.every((word, index) => {
|
|
@@ -10529,6 +10618,7 @@ async function complete(typed, reference, operator, fetchJson) {
|
|
|
10529
10618
|
wantsCommand ||= COMMAND_ID.test(inner);
|
|
10530
10619
|
wantsServer ||= SERVER.test(inner);
|
|
10531
10620
|
wantsImage ||= IMAGE.test(inner);
|
|
10621
|
+
wantsSize ||= SIZE.test(inner);
|
|
10532
10622
|
}
|
|
10533
10623
|
if (positionals.length === 0) {
|
|
10534
10624
|
for (const word of SUBCOMMANDS[name] ?? []) {
|
|
@@ -10546,7 +10636,8 @@ async function complete(typed, reference, operator, fetchJson) {
|
|
|
10546
10636
|
...wantsSnapshot ? await snapshots(fetchJson) : [],
|
|
10547
10637
|
...wantsCommand && sandbox !== void 0 ? await commandsIn(fetchJson, sandbox) : [],
|
|
10548
10638
|
...wantsServer ? await ownServers(fetchJson) : [],
|
|
10549
|
-
...wantsImage ? await images(fetchJson) : []
|
|
10639
|
+
...wantsImage ? await images(fetchJson) : [],
|
|
10640
|
+
...wantsSize ? await sizes(fetchJson) : []
|
|
10550
10641
|
];
|
|
10551
10642
|
return starting([...candidates.values(), ...asked2]);
|
|
10552
10643
|
}
|
|
@@ -10598,6 +10689,11 @@ async function ownServers(api2) {
|
|
|
10598
10689
|
const listed2 = Array.isArray(body?.servers) ? body.servers : [];
|
|
10599
10690
|
return listed2.filter((each) => typeof each["id"] === "string").map((each) => typeof each["label"] === "string" ? { value: each["id"], about: each["label"] } : { value: each["id"] });
|
|
10600
10691
|
}
|
|
10692
|
+
async function sizes(api2) {
|
|
10693
|
+
const body = await cached("sizes", api2.as, () => api2.get("/v1/sizes"));
|
|
10694
|
+
const listed2 = Array.isArray(body?.sizes) ? body.sizes : MACHINE_SIZE_NAMES.map((name) => ({ name }));
|
|
10695
|
+
return listed2.filter((each) => typeof each["name"] === "string" && !each["retiredAt"]).map((each) => ({ value: each["name"] }));
|
|
10696
|
+
}
|
|
10601
10697
|
async function templates(api2) {
|
|
10602
10698
|
const body = await cached("templates", api2.as, () => api2.get("/v1/templates"));
|
|
10603
10699
|
const listed2 = Array.isArray(body) ? body : body?.templates ?? [];
|
|
@@ -12593,7 +12689,7 @@ async function writeStdin(client, sandbox, id, one2) {
|
|
|
12593
12689
|
|
|
12594
12690
|
// ../src/cli-servers.ts
|
|
12595
12691
|
var SERVER_USAGE = "server takes list, add, show, readings, token, drain, open, gone or remove. agental server --help shows each.";
|
|
12596
|
-
var SERVERS_USAGE = "servers takes nothing to list them, offload [on|off] [--over <percent>], window [--day <day> --hour <0-23> --tz <zone> [--hours <1-12>] | --off], core-days [--month <yyyy-mm>], or key-lost <key id>.";
|
|
12692
|
+
var SERVERS_USAGE = "servers takes nothing to list them, offload [on|off] [--over <percent>], offload sent [--since <time>], offload load [--since <time>] [--until <time>], window [--day <day> --hour <0-23> --tz <zone> [--hours <1-12>] | --off], core-days [--month <yyyy-mm>], or key-lost <key id>.";
|
|
12597
12693
|
var READING_MINUTES = ["1", "5", "15", "60"];
|
|
12598
12694
|
async function ask8(client, method, pathname, body) {
|
|
12599
12695
|
const response = await client.request(pathname, { method, ...body === void 0 ? {} : { body: JSON.stringify(body) } });
|
|
@@ -12754,16 +12850,80 @@ function sayOffload(offload2) {
|
|
|
12754
12850
|
if (offload2.enabled) {
|
|
12755
12851
|
process.stdout.write(
|
|
12756
12852
|
`Offload is on, over ${offload2.overPercent}%.
|
|
12757
|
-
A new sandbox that names no region starts on agental's servers when none of yours has room under ${offload2.overPercent}% of its memory, CPU and disk. It is then a hosted sandbox, billed as one, from your credits. A sandbox made with --region own is never sent there.
|
|
12853
|
+
A new sandbox that names no region starts on agental's servers when none of yours has room under ${offload2.overPercent}% of its memory, CPU and disk. It is then a hosted sandbox, billed as one, from your credits. A sandbox made with --region own is never sent there. agental servers offload sent lists what it sent.
|
|
12758
12854
|
`
|
|
12759
12855
|
);
|
|
12760
|
-
|
|
12761
|
-
|
|
12762
|
-
|
|
12763
|
-
`Offload is off (over ${offload2.overPercent}% when it is on).
|
|
12856
|
+
} else {
|
|
12857
|
+
process.stdout.write(
|
|
12858
|
+
`Offload is off (over ${offload2.overPercent}% when it is on).
|
|
12764
12859
|
A new sandbox that names no region starts on your own servers only, and is refused with capacity_exceeded when none of them has room. agental servers offload on turns it on.
|
|
12765
12860
|
`
|
|
12766
|
-
|
|
12861
|
+
);
|
|
12862
|
+
}
|
|
12863
|
+
if (offload2.changedAt !== null) {
|
|
12864
|
+
const by = offload2.changedBy ?? "a key of no account";
|
|
12865
|
+
process.stdout.write(`Set so ${offload2.changedAt.slice(0, 16).replace("T", " ")} UTC, by ${by}${offload2.changedByKey === null ? "" : ` with key ${offload2.changedByKey}`}.
|
|
12866
|
+
`);
|
|
12867
|
+
}
|
|
12868
|
+
}
|
|
12869
|
+
function momentsAsked(options, names2) {
|
|
12870
|
+
const query = new URLSearchParams();
|
|
12871
|
+
for (const name of names2) {
|
|
12872
|
+
const given = options[name];
|
|
12873
|
+
if (given === void 0) {
|
|
12874
|
+
continue;
|
|
12875
|
+
}
|
|
12876
|
+
const moment2 = new Date(given);
|
|
12877
|
+
if (Number.isNaN(moment2.getTime())) {
|
|
12878
|
+
throw new Error(`--${name} is a date and time, as 2026-11-30T10:00:00Z.`);
|
|
12879
|
+
}
|
|
12880
|
+
query.set(name, moment2.toISOString());
|
|
12881
|
+
}
|
|
12882
|
+
return query;
|
|
12883
|
+
}
|
|
12884
|
+
async function offloadLoad(client, options) {
|
|
12885
|
+
const query = momentsAsked(options, ["since", "until"]).toString();
|
|
12886
|
+
const answered = await ask8(client, "GET", `/v1/offload/load${query === "" ? "" : `?${query}`}`);
|
|
12887
|
+
if (options.json) {
|
|
12888
|
+
printJson2(answered);
|
|
12889
|
+
return;
|
|
12890
|
+
}
|
|
12891
|
+
const loads = answered.points.map((point) => point.loadPercent).filter((load) => load !== null);
|
|
12892
|
+
if (loads.length === 0) {
|
|
12893
|
+
process.stdout.write(`No server of yours was read since ${answered.since.slice(0, 10)}: there is nothing to count.
|
|
12894
|
+
`);
|
|
12895
|
+
return;
|
|
12896
|
+
}
|
|
12897
|
+
process.stdout.write(`Your ${answered.servers === 1 ? "server" : `${answered.servers} servers`} since ${answered.since.slice(0, 10)}: busiest at ${Math.round(Math.max(...loads))}%.
|
|
12898
|
+
`);
|
|
12899
|
+
const rows = [["LINE", "CROSSED", "HOURS OVER"]];
|
|
12900
|
+
for (const line of answered.lines) {
|
|
12901
|
+
rows.push([`${line.overPercent}%`, `${line.crossings} ${line.crossings === 1 ? "time" : "times"}`, (line.minutesOver / 60).toFixed(1)]);
|
|
12902
|
+
}
|
|
12903
|
+
process.stdout.write(fitted(rows, { give: 0 }));
|
|
12904
|
+
process.stdout.write(`${answered.method}
|
|
12905
|
+
`);
|
|
12906
|
+
}
|
|
12907
|
+
async function offloadSent(client, options) {
|
|
12908
|
+
const query = momentsAsked(options, ["since"]).toString();
|
|
12909
|
+
const answered = await ask8(client, "GET", `/v1/offload/sent${query === "" ? "" : `?${query}`}`);
|
|
12910
|
+
if (options.json) {
|
|
12911
|
+
printJson2(answered);
|
|
12912
|
+
return;
|
|
12913
|
+
}
|
|
12914
|
+
if (answered.count === 0) {
|
|
12915
|
+
process.stdout.write(`Offload sent nothing to agental's servers since ${answered.since.slice(0, 10)}.
|
|
12916
|
+
`);
|
|
12917
|
+
return;
|
|
12918
|
+
}
|
|
12919
|
+
const rows = [["SENT", "SANDBOX", "NAME", "SIZE", "REGION", "OVER"]];
|
|
12920
|
+
for (const one2 of answered.sent) {
|
|
12921
|
+
rows.push([ago(one2.sentAt) ?? one2.sentAt, one2.sandboxId, one2.name, one2.size, one2.region, `${one2.overPercent}%`]);
|
|
12922
|
+
}
|
|
12923
|
+
process.stdout.write(fitted(rows, { give: 2 }));
|
|
12924
|
+
const listed2 = answered.sent.length < answered.count ? `, the newest ${answered.sent.length} listed` : "";
|
|
12925
|
+
process.stdout.write(`${answered.count} sent to agental's servers since ${answered.since.slice(0, 10)}${listed2}. Each is a hosted sandbox, billed from your credits.
|
|
12926
|
+
`);
|
|
12767
12927
|
}
|
|
12768
12928
|
function percentOf(value) {
|
|
12769
12929
|
return value === null ? "-" : `${Math.round(value)}%`;
|
|
@@ -12827,8 +12987,16 @@ async function listServers(client, asJson) {
|
|
|
12827
12987
|
}
|
|
12828
12988
|
async function offload(client, words2, options) {
|
|
12829
12989
|
const [turn, ...extra] = words2;
|
|
12990
|
+
if (turn === "sent" && extra.length === 0) {
|
|
12991
|
+
await offloadSent(client, options);
|
|
12992
|
+
return;
|
|
12993
|
+
}
|
|
12994
|
+
if (turn === "load" && extra.length === 0) {
|
|
12995
|
+
await offloadLoad(client, options);
|
|
12996
|
+
return;
|
|
12997
|
+
}
|
|
12830
12998
|
if (extra.length > 0 || turn !== void 0 && turn !== "on" && turn !== "off") {
|
|
12831
|
-
throw new Error("servers offload takes on or off, and --over <percent>: as agental servers offload on --over 80.");
|
|
12999
|
+
throw new Error("servers offload takes on or off, and --over <percent>: as agental servers offload on --over 80. servers offload sent lists what it sent, and servers offload load how often each line was crossed.");
|
|
12832
13000
|
}
|
|
12833
13001
|
let overPercent;
|
|
12834
13002
|
if (options.over !== void 0) {
|
|
@@ -13031,16 +13199,7 @@ async function readings(client, found, options) {
|
|
|
13031
13199
|
throw new Error(`--every is the minutes a line covers: ${READING_MINUTES.join(", ")}.`);
|
|
13032
13200
|
}
|
|
13033
13201
|
const query = new URLSearchParams({ everyMinutes: every });
|
|
13034
|
-
|
|
13035
|
-
if (given === void 0) {
|
|
13036
|
-
continue;
|
|
13037
|
-
}
|
|
13038
|
-
const moment2 = new Date(given);
|
|
13039
|
-
if (Number.isNaN(moment2.getTime())) {
|
|
13040
|
-
throw new Error(`--${name} is a date and time, as 2026-11-30T10:00:00Z.`);
|
|
13041
|
-
}
|
|
13042
|
-
query.set(name, moment2.toISOString());
|
|
13043
|
-
}
|
|
13202
|
+
momentsAsked(options, ["since", "until"]).forEach((value, name) => query.set(name, value));
|
|
13044
13203
|
const body = await ask8(client, "GET", `/v1/servers/${encodeURIComponent(found.id)}/readings?${query}`);
|
|
13045
13204
|
if (options.json) {
|
|
13046
13205
|
printJson2(body);
|
|
@@ -13436,80 +13595,6 @@ function needId(id, what) {
|
|
|
13436
13595
|
|
|
13437
13596
|
// ../src/cli-snapshots.ts
|
|
13438
13597
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
13439
|
-
|
|
13440
|
-
// ../src/domain.ts
|
|
13441
|
-
var MACHINE_SIZES = {
|
|
13442
|
-
tiny: { vcpu: 1, memoryMb: 2048, diskGb: 20 },
|
|
13443
|
-
small: { vcpu: 2, memoryMb: 4096, diskGb: 40 },
|
|
13444
|
-
medium: { vcpu: 4, memoryMb: 8192, diskGb: 80 },
|
|
13445
|
-
large: { vcpu: 8, memoryMb: 16384, diskGb: 160 },
|
|
13446
|
-
xlarge: { vcpu: 16, memoryMb: 32768, diskGb: 320 }
|
|
13447
|
-
};
|
|
13448
|
-
var MACHINE_SIZE_NAMES = ["tiny", "small", "medium", "large", "xlarge"];
|
|
13449
|
-
var CUSTOM_SIZES = /* @__PURE__ */ new Map();
|
|
13450
|
-
var LIST_PRICE_MICROS_PER_HOUR = {
|
|
13451
|
-
tiny: 13500,
|
|
13452
|
-
small: 27e3,
|
|
13453
|
-
medium: 54e3,
|
|
13454
|
-
large: 108e3,
|
|
13455
|
-
xlarge: 216e3
|
|
13456
|
-
};
|
|
13457
|
-
var SPOT_PRICE_MICROS_PER_HOUR = {
|
|
13458
|
-
tiny: LIST_PRICE_MICROS_PER_HOUR.tiny / 2,
|
|
13459
|
-
small: LIST_PRICE_MICROS_PER_HOUR.small / 2,
|
|
13460
|
-
medium: LIST_PRICE_MICROS_PER_HOUR.medium / 2,
|
|
13461
|
-
large: LIST_PRICE_MICROS_PER_HOUR.large / 2,
|
|
13462
|
-
xlarge: LIST_PRICE_MICROS_PER_HOUR.xlarge / 2
|
|
13463
|
-
};
|
|
13464
|
-
var SPOT_ON_RECLAIM = ["delete", "stop"];
|
|
13465
|
-
var SPOT_ON_RECLAIM_READ = [...SPOT_ON_RECLAIM, "upgrade"];
|
|
13466
|
-
var HOURS_PER_MONTH = 730;
|
|
13467
|
-
var STOPPED_MICROS_PER_GB_MONTH = 5e4;
|
|
13468
|
-
var BYTES_PER_GB = 1e9;
|
|
13469
|
-
var NEVER_PAID_MAX_STORED_BYTES = 20 * BYTES_PER_GB;
|
|
13470
|
-
var STOPPED_DELETION_NOTICE_MS = 3 * 864e5;
|
|
13471
|
-
function stoppedMicrosPerHour(storedBytes) {
|
|
13472
|
-
if (storedBytes <= 0) {
|
|
13473
|
-
return 0;
|
|
13474
|
-
}
|
|
13475
|
-
return Math.max(1, Math.round(storedBytes * STOPPED_MICROS_PER_GB_MONTH / (BYTES_PER_GB * HOURS_PER_MONTH)));
|
|
13476
|
-
}
|
|
13477
|
-
function wholeStoredBytes(size2, withMemory) {
|
|
13478
|
-
const resources = resourcesFor(size2);
|
|
13479
|
-
return resources.diskGb * 2 ** 30 + (withMemory ? resources.memoryMb * 2 ** 20 : 0);
|
|
13480
|
-
}
|
|
13481
|
-
var STOPPED_MAX_MICROS_PER_HOUR = {
|
|
13482
|
-
tiny: stoppedMicrosPerHour(wholeStoredBytes("tiny", false)),
|
|
13483
|
-
small: stoppedMicrosPerHour(wholeStoredBytes("small", false)),
|
|
13484
|
-
medium: stoppedMicrosPerHour(wholeStoredBytes("medium", false)),
|
|
13485
|
-
large: stoppedMicrosPerHour(wholeStoredBytes("large", false)),
|
|
13486
|
-
xlarge: stoppedMicrosPerHour(wholeStoredBytes("xlarge", false))
|
|
13487
|
-
};
|
|
13488
|
-
var STOPPED_WITH_MEMORY_MAX_MICROS_PER_HOUR = {
|
|
13489
|
-
tiny: stoppedMicrosPerHour(wholeStoredBytes("tiny", true)),
|
|
13490
|
-
small: stoppedMicrosPerHour(wholeStoredBytes("small", true)),
|
|
13491
|
-
medium: stoppedMicrosPerHour(wholeStoredBytes("medium", true)),
|
|
13492
|
-
large: stoppedMicrosPerHour(wholeStoredBytes("large", true)),
|
|
13493
|
-
xlarge: stoppedMicrosPerHour(wholeStoredBytes("xlarge", true))
|
|
13494
|
-
};
|
|
13495
|
-
var SANDBOX_STATUSES = ["creating", "running", "stopped", "error", "deleted"];
|
|
13496
|
-
var SHOWN_STATUSES = [...SANDBOX_STATUSES, "restoring", "paused"];
|
|
13497
|
-
var OUTBOUND_MODES = ["open", "blocked", "allowlist"];
|
|
13498
|
-
function isMachineSize(value) {
|
|
13499
|
-
return Object.hasOwn(MACHINE_SIZES, value);
|
|
13500
|
-
}
|
|
13501
|
-
function resourcesFor(size2) {
|
|
13502
|
-
if (isMachineSize(size2)) {
|
|
13503
|
-
return MACHINE_SIZES[size2];
|
|
13504
|
-
}
|
|
13505
|
-
const custom = CUSTOM_SIZES.get(size2);
|
|
13506
|
-
if (custom === void 0) {
|
|
13507
|
-
throw new Error(`Size ${size2} is neither one of the five nor a custom size there is.`);
|
|
13508
|
-
}
|
|
13509
|
-
return { vcpu: custom.vcpu, memoryMb: custom.memoryMb, diskGb: custom.diskGb };
|
|
13510
|
-
}
|
|
13511
|
-
|
|
13512
|
-
// ../src/cli-snapshots.ts
|
|
13513
13598
|
var KEPT_WORDS = {
|
|
13514
13599
|
server_and_storage: "server and storage",
|
|
13515
13600
|
storage: "storage only",
|
|
@@ -15644,7 +15729,8 @@ async function get(client, name, options) {
|
|
|
15644
15729
|
goes to ${view.hosts.join(", ")}
|
|
15645
15730
|
sealed to ${view.sealedTo.join(", ")}
|
|
15646
15731
|
used by ${usedWords(view)}
|
|
15647
|
-
|
|
15732
|
+
` + (view.usedAs ?? []).map((use2) => ` as ${use2.variable} on the ${use2.kind} ${use2.id}
|
|
15733
|
+
`).join("") + ` changed ${view.updatedAt}
|
|
15648
15734
|
Its value is sealed, and nothing shows it: not the API, the console or this command.
|
|
15649
15735
|
`
|
|
15650
15736
|
);
|
|
@@ -15702,12 +15788,22 @@ async function use(client, on, name, options) {
|
|
|
15702
15788
|
const where = options.template !== void 0 ? { path: `/v1/templates/${encodeURIComponent(await client.templateId(options.template))}`, words: `the template ${options.template}` } : { path: `/v1/sandboxes/${encodeURIComponent(options.sandbox ?? "")}`, words: `the sandbox ${options.sandbox}` };
|
|
15703
15789
|
const path9 = `${where.path}/secrets/${encodeURIComponent(name)}`;
|
|
15704
15790
|
if (on) {
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
|
|
15708
|
-
|
|
15791
|
+
if (options.as !== void 0 && !NAME2.test(options.as)) {
|
|
15792
|
+
throw new Error(`--as ${options.as} is not a variable's name: letters, digits and underscores, not starting with a digit.`);
|
|
15793
|
+
}
|
|
15794
|
+
const init = options.as === void 0 ? { method: "PUT" } : { method: "PUT", headers: JSON_HEADERS, body: JSON.stringify({ as: options.as }) };
|
|
15795
|
+
const view = await answer2(client, path9, init);
|
|
15796
|
+
const variable = options.as ?? name;
|
|
15797
|
+
process.stdout.write(
|
|
15798
|
+
options.json ? `${JSON.stringify(view, null, 2)}
|
|
15799
|
+
` : `${where.words} uses ${name}${variable === name ? "" : ` as ${variable}`}: its commands see the variable ${variable}, and its value goes only to ${view.hosts.join(", ")}.
|
|
15800
|
+
`
|
|
15801
|
+
);
|
|
15709
15802
|
return;
|
|
15710
15803
|
}
|
|
15804
|
+
if (options.as !== void 0) {
|
|
15805
|
+
throw new Error("secret unuse takes the secret's own name, without --as.");
|
|
15806
|
+
}
|
|
15711
15807
|
const res = await client.request(path9, { method: "DELETE" });
|
|
15712
15808
|
if (!res.ok) {
|
|
15713
15809
|
refused(client, res.status, await res.json().catch(() => null));
|
|
@@ -18108,8 +18204,8 @@ var METRICS_STEP_SECONDS = 60;
|
|
|
18108
18204
|
// ../src/plans.ts
|
|
18109
18205
|
var MICROS_PER_DOLLAR = 1e6;
|
|
18110
18206
|
var FREE_STARTS_PER_RUNNING = 3;
|
|
18111
|
-
function plan(id, dollarsPerMonth,
|
|
18112
|
-
return { id, dollarsPerMonth, includedMicros: dollarsPerMonth * MICROS_PER_DOLLAR, sizes, runningUnits, freeBurstUnits: runningUnits * FREE_STARTS_PER_RUNNING };
|
|
18207
|
+
function plan(id, dollarsPerMonth, sizes3, runningUnits) {
|
|
18208
|
+
return { id, dollarsPerMonth, includedMicros: dollarsPerMonth * MICROS_PER_DOLLAR, sizes: sizes3, runningUnits, freeBurstUnits: runningUnits * FREE_STARTS_PER_RUNNING };
|
|
18113
18209
|
}
|
|
18114
18210
|
var FREE_PLAN = plan("free", 0, ["tiny", "small"], 40);
|
|
18115
18211
|
var PAID_PLANS = [
|
|
@@ -18545,8 +18641,11 @@ async function main() {
|
|
|
18545
18641
|
// agental servers offload: how used a server of the organization's own may be and still take a new sandbox. servers core-days: which month.
|
|
18546
18642
|
over: { type: "string" },
|
|
18547
18643
|
month: { type: "string" },
|
|
18548
|
-
// agental server add and token: the disk for sandboxes, put in the install line.
|
|
18644
|
+
// agental server add and token: the disk for sandboxes, put in the install line. agental sizes add: the size's disk in GB.
|
|
18549
18645
|
disk: { type: "string" },
|
|
18646
|
+
// agental sizes add: a size's vCPUs and its memory in GiB.
|
|
18647
|
+
vcpus: { type: "string" },
|
|
18648
|
+
memory: { type: "string" },
|
|
18550
18649
|
// agental servers window: the weekly window the organization's servers take a new agent in, with --tz and --off.
|
|
18551
18650
|
day: { type: "string" },
|
|
18552
18651
|
hour: { type: "string" },
|
|
@@ -18611,6 +18710,9 @@ async function main() {
|
|
|
18611
18710
|
process.stdout.write(isTerminal(process.stdout) ? shortHelp() : await helpText());
|
|
18612
18711
|
return;
|
|
18613
18712
|
}
|
|
18713
|
+
if ((values.vcpus !== void 0 || values.memory !== void 0) && !(command3 === "sizes" && positionals[1] === "add")) {
|
|
18714
|
+
throw new Error("--vcpus and --memory go with agental sizes add, which makes a size; create and the others take it by name, as --size build-64.");
|
|
18715
|
+
}
|
|
18614
18716
|
switch (command3) {
|
|
18615
18717
|
case "create":
|
|
18616
18718
|
await create({ ...values, template: once(values.template, "--template") });
|
|
@@ -18633,6 +18735,9 @@ async function main() {
|
|
|
18633
18735
|
case "regions":
|
|
18634
18736
|
await regions(values.json);
|
|
18635
18737
|
return;
|
|
18738
|
+
case "sizes":
|
|
18739
|
+
await sizes2(positionals.slice(1), { vcpus: values.vcpus, memory: values.memory, disk: values.disk, where: values.where, json: values.json });
|
|
18740
|
+
return;
|
|
18636
18741
|
case "exec":
|
|
18637
18742
|
await exec(positionals.slice(1));
|
|
18638
18743
|
return;
|
|
@@ -18841,7 +18946,7 @@ async function main() {
|
|
|
18841
18946
|
await secret(
|
|
18842
18947
|
{ request, fail, confirmed, templateId: async (given) => (await templateNamed(given)).id, readValue: hiddenValue },
|
|
18843
18948
|
positionals.slice(1),
|
|
18844
|
-
{ json: values.json, ...values.host === void 0 ? {} : { host: values.host }, template: once(values.template, "--template"), sandbox: once(values.sandbox, "--sandbox"), yes: values.yes === true }
|
|
18949
|
+
{ json: values.json, ...values.host === void 0 ? {} : { host: values.host }, template: once(values.template, "--template"), sandbox: once(values.sandbox, "--sandbox"), yes: values.yes === true, ...values.as === void 0 ? {} : { as: values.as } }
|
|
18845
18950
|
);
|
|
18846
18951
|
return;
|
|
18847
18952
|
case "metrics":
|
|
@@ -18976,9 +19081,6 @@ async function create(values) {
|
|
|
18976
19081
|
if (onTimeout !== void 0 && onTimeout !== "delete" && onTimeout !== "stop" && onTimeout !== "pause") {
|
|
18977
19082
|
throw new Error("--on-timeout is delete, stop or pause: what the sandbox's time limit does when it runs out");
|
|
18978
19083
|
}
|
|
18979
|
-
if (values.size !== void 0 && !isMachineSize(values.size)) {
|
|
18980
|
-
throw new Error("--size must be tiny, small, medium, large or xlarge");
|
|
18981
|
-
}
|
|
18982
19084
|
if (!values.spot && (values["on-reclaim"] !== void 0 || values["warn-at"] !== void 0)) {
|
|
18983
19085
|
throw new Error("--on-reclaim and --warn-at are for a spot sandbox: add --spot.");
|
|
18984
19086
|
}
|
|
@@ -19255,6 +19357,74 @@ async function regions(asJson) {
|
|
|
19255
19357
|
}
|
|
19256
19358
|
process.stdout.write("* where a sandbox is made when no region is named\n");
|
|
19257
19359
|
}
|
|
19360
|
+
async function sizes2(args, options) {
|
|
19361
|
+
const [action, name, ...extra] = args;
|
|
19362
|
+
if (extra.length > 0) {
|
|
19363
|
+
throw new Error(`agental sizes ${action} takes one name; ${extra.join(" ")} is more.`);
|
|
19364
|
+
}
|
|
19365
|
+
if (action !== "add" && [options.vcpus, options.memory, options.disk, options.where].some((each) => each !== void 0)) {
|
|
19366
|
+
throw new Error("--vcpus, --memory, --disk and --where go with agental sizes add.");
|
|
19367
|
+
}
|
|
19368
|
+
const show4 = (size2, line) => process.stdout.write(options.json ? `${JSON.stringify(size2, null, 2)}
|
|
19369
|
+
` : `${line}
|
|
19370
|
+
`);
|
|
19371
|
+
if (action === "add") {
|
|
19372
|
+
if (!name) {
|
|
19373
|
+
throw new Error("sizes add takes the size's name: agental sizes add build-64 --vcpus 16 --memory 64 --disk 200");
|
|
19374
|
+
}
|
|
19375
|
+
const whole = (value, flag, what) => {
|
|
19376
|
+
if (value === void 0 || !/^[1-9][0-9]*$/.test(value)) {
|
|
19377
|
+
throw new Error(`sizes add takes ${flag}, ${what}, as a whole number. Nothing was created.`);
|
|
19378
|
+
}
|
|
19379
|
+
return Number(value);
|
|
19380
|
+
};
|
|
19381
|
+
const where = options.where;
|
|
19382
|
+
if (where !== void 0 && where !== "own" && where !== "agental" && where !== "both") {
|
|
19383
|
+
throw new Error("--where is own, agental or both: your organization's servers, agental's, or either. Nothing was created.");
|
|
19384
|
+
}
|
|
19385
|
+
const body = { name, vcpus: whole(options.vcpus, "--vcpus", "its vCPUs"), memoryGb: whole(options.memory, "--memory", "its memory in GiB"), diskGb: whole(options.disk, "--disk", "its disk in GB"), ...where ? { where } : {} };
|
|
19386
|
+
const made = await call2("/v1/sizes", { method: "POST", body: JSON.stringify(body) });
|
|
19387
|
+
show4(made, `Made ${name}: ${sizeShape(made)}, ${sizePrice(made)}. Use it as --size ${name}.`);
|
|
19388
|
+
return;
|
|
19389
|
+
}
|
|
19390
|
+
if (action === "retire") {
|
|
19391
|
+
if (!name) {
|
|
19392
|
+
throw new Error("sizes retire takes the size's name: agental sizes retire build-64");
|
|
19393
|
+
}
|
|
19394
|
+
const retired = await call2(`/v1/sizes/${encodeURIComponent(name)}`, { method: "DELETE" });
|
|
19395
|
+
show4(retired, `Retired ${name}: nothing new takes it from now, and what was made with it keeps it.`);
|
|
19396
|
+
return;
|
|
19397
|
+
}
|
|
19398
|
+
if (action !== void 0) {
|
|
19399
|
+
throw new Error("agental sizes lists the sizes; agental sizes add <name> and agental sizes retire <name> make and retire your own.");
|
|
19400
|
+
}
|
|
19401
|
+
const catalog = await call2("/v1/sizes", { method: "GET" });
|
|
19402
|
+
const listed2 = catalog.sizes ?? [];
|
|
19403
|
+
if (options.json) {
|
|
19404
|
+
process.stdout.write(`${JSON.stringify(listed2, null, 2)}
|
|
19405
|
+
`);
|
|
19406
|
+
return;
|
|
19407
|
+
}
|
|
19408
|
+
const named = listed2.map((size2) => `${String(size2["name"] ?? "")}${size2["retiredAt"] ? " (retired)" : ""}`);
|
|
19409
|
+
const width = Math.max(4, ...named.map((name2) => name2.length));
|
|
19410
|
+
process.stdout.write(`${["SIZE".padEnd(width), pad2("SHAPE"), "PRICE"].join(" ")}
|
|
19411
|
+
`);
|
|
19412
|
+
listed2.forEach((size2, index) => {
|
|
19413
|
+
process.stdout.write(`${[named[index].padEnd(width), pad2(sizeShape(size2)), size2["custom"] === true ? sizePrice(size2) : "-"].join(" ")}
|
|
19414
|
+
`);
|
|
19415
|
+
});
|
|
19416
|
+
}
|
|
19417
|
+
function sizeShape(size2) {
|
|
19418
|
+
return `${String(size2["vcpu"])} vCPU ${Number(size2["memoryMb"]) / 1024} GiB ${String(size2["diskGb"])} GB`;
|
|
19419
|
+
}
|
|
19420
|
+
function sizePrice(size2) {
|
|
19421
|
+
const micros = size2["priceMicrosPerHour"];
|
|
19422
|
+
if (typeof micros !== "number") {
|
|
19423
|
+
return "free on your own servers";
|
|
19424
|
+
}
|
|
19425
|
+
const hosted = `$${(micros / 1e6).toFixed(4)} an hour on agental's servers`;
|
|
19426
|
+
return size2["where"] === "both" ? `${hosted}, free on your own` : hosted;
|
|
19427
|
+
}
|
|
19258
19428
|
async function list7(asJson, filter, sort, limit, wide = false) {
|
|
19259
19429
|
const sandboxes2 = [];
|
|
19260
19430
|
let cursor = null;
|
|
@@ -19646,13 +19816,13 @@ async function lifecycle(action, id, headers = {}, sent) {
|
|
|
19646
19816
|
}
|
|
19647
19817
|
async function resize(id, size2, now, cancel, maxBurstFee, asJson) {
|
|
19648
19818
|
if (!id) {
|
|
19649
|
-
throw new Error("resize requires <sandbox-id> and its new size: tiny, small, medium, large or
|
|
19819
|
+
throw new Error("resize requires <sandbox-id> and its new size: tiny, small, medium, large, xlarge or one of your organization's own");
|
|
19650
19820
|
}
|
|
19651
19821
|
if (cancel && (size2 !== void 0 || now)) {
|
|
19652
19822
|
throw new Error("--cancel takes away a size that waits for the next start, and goes with no size and no --now");
|
|
19653
19823
|
}
|
|
19654
|
-
if (!cancel &&
|
|
19655
|
-
throw new Error("resize takes the new size: tiny, small, medium, large or
|
|
19824
|
+
if (!cancel && size2 === void 0) {
|
|
19825
|
+
throw new Error("resize takes the new size: tiny, small, medium, large, xlarge or one of your organization's own");
|
|
19656
19826
|
}
|
|
19657
19827
|
if (maxBurstFee !== void 0 && !now) {
|
|
19658
19828
|
throw new Error("--max-burst-fee goes with --now: it caps what the restart's start pays in burst fees");
|
|
@@ -19669,10 +19839,11 @@ async function resize(id, size2, now, cancel, maxBurstFee, asJson) {
|
|
|
19669
19839
|
return;
|
|
19670
19840
|
}
|
|
19671
19841
|
const to = cancel ? before.size : size2;
|
|
19672
|
-
const larger = MACHINE_SIZE_NAMES.indexOf(to) > MACHINE_SIZE_NAMES.indexOf(before.size);
|
|
19842
|
+
const larger = isMachineSize(to) && isMachineSize(before.size) ? MACHINE_SIZE_NAMES.indexOf(to) > MACHINE_SIZE_NAMES.indexOf(before.size) : to !== before.size;
|
|
19673
19843
|
const restart = now && before.status === "running" && larger;
|
|
19674
19844
|
if (restart) {
|
|
19675
|
-
|
|
19845
|
+
const sure = isMachineSize(to) && isMachineSize(before.size);
|
|
19846
|
+
process.stderr.write(`${sure ? "Restarting" : "Asking to restart"} ${name} as a ${to}: every process in it ends, as on a stop. Its files stay.
|
|
19676
19847
|
`);
|
|
19677
19848
|
}
|
|
19678
19849
|
const response = await request(`${path9}/resize`, { method: "POST", headers: restart ? headers : {}, body: JSON.stringify({ size: to, ...restart ? { restart: true } : {} }) });
|
|
@@ -20461,9 +20632,6 @@ async function template(positionals, values) {
|
|
|
20461
20632
|
if ([values.snapshot !== void 0, values.image !== void 0, values["new-machine"]].filter(Boolean).length > 1) {
|
|
20462
20633
|
throw new Error("--snapshot, --image and --new-machine say two things: give one.");
|
|
20463
20634
|
}
|
|
20464
|
-
if (values.size !== void 0 && !isMachineSize(values.size)) {
|
|
20465
|
-
throw new Error("--size must be tiny, small, medium, large or xlarge");
|
|
20466
|
-
}
|
|
20467
20635
|
const ttlSeconds = ttlOption(values.ttl);
|
|
20468
20636
|
if (values.spot && values.standard) {
|
|
20469
20637
|
throw new Error("--spot and --standard say two things: give one.");
|
|
@@ -20944,7 +21112,7 @@ async function ci(positionals, options) {
|
|
|
20944
21112
|
}
|
|
20945
21113
|
if (item.waits && item.waits.waited > 0) {
|
|
20946
21114
|
const reasons = item.waits.byReason.map((each) => `${ciWaitWords(each.reason)} ${each.jobs} for ${ciHours(each.seconds)}`).join(", ");
|
|
20947
|
-
process.stdout.write(` since ${item.waits.since.slice(0, 10)} ${item.waits.waited} of ${item.waits.jobs} jobs waited over a minute, ${ciHours(item.waits.waitedSeconds)} in all
|
|
21115
|
+
process.stdout.write(` since ${item.waits.since.slice(0, 10)} ${item.waits.waited} of ${item.waits.jobs} jobs waited over a minute, ${ciHours(item.waits.waitedSeconds)} in all${reasons ? `: ${reasons}` : ""}
|
|
20948
21116
|
`);
|
|
20949
21117
|
if (item.waits.byReason[0]?.reason === "pool_full") {
|
|
20950
21118
|
process.stdout.write(` a bigger pool would have started most of them at once: agental ci set ${item.repository} --pool <n>
|
|
@@ -21527,11 +21695,11 @@ function describePrices(body) {
|
|
|
21527
21695
|
const withSizes = body.tiers.some((tier) => tier.sizes !== void 0);
|
|
21528
21696
|
out2.push(withSizes ? "Plans, a month, and the sizes each makes" : "Plans, a month");
|
|
21529
21697
|
for (const tier of body.tiers) {
|
|
21530
|
-
const
|
|
21698
|
+
const sizes3 = tier.sizes === void 0 ? "" : tier.sizes.length === body.plans.length ? "every size" : tier.sizes.join(", ");
|
|
21531
21699
|
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` : "";
|
|
21532
21700
|
const price = tier.dollarsPerMonth === 0 ? "Free" : `$${tier.dollarsPerMonth.toLocaleString("en-US")}`;
|
|
21533
21701
|
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`;
|
|
21534
|
-
out2.push(` ${price.padEnd(8)}${included.padEnd(28)}${speed.padEnd(34)}${
|
|
21702
|
+
out2.push(` ${price.padEnd(8)}${included.padEnd(28)}${speed.padEnd(34)}${sizes3}`.trimEnd());
|
|
21535
21703
|
}
|
|
21536
21704
|
if (body.free) {
|
|
21537
21705
|
out2.push(
|
|
@@ -21978,7 +22146,7 @@ Setting up
|
|
|
21978
22146
|
agental completion zsh|bash|fish
|
|
21979
22147
|
|
|
21980
22148
|
Usage
|
|
21981
|
-
agental create [--name <name>] [--template <template>] [--snapshot <snapshot-id> | --image <image>] [--size
|
|
22149
|
+
agental create [--name <name>] [--template <template>] [--snapshot <snapshot-id> | --image <image>] [--size <size>] [--region <region>[,<region>...]] [--ttl <time> | --ttl default] [--on-timeout delete|stop|pause] [--idempotency-key <key>]
|
|
21982
22150
|
[--spot [--on-reclaim delete|stop] [--warn-at <chance>] | --standard]
|
|
21983
22151
|
${operator ? "[--box <name-or-id>] " : ""}[--allow <address>[,<address>...]] [--egress box | residential:<country>[:sticky|rotating]] [--max-burst-fee <dollars>]
|
|
21984
22152
|
[--ssh-key <public-key-or-file>]... [--tag <tag>[,<tag>...]]... [--meta <key>=<value>]... [--connection <name>[,<name>...]]...
|
|
@@ -21987,6 +22155,9 @@ Usage
|
|
|
21987
22155
|
agental tags <sandbox-id> [add|rm <tag>...] [--json]
|
|
21988
22156
|
agental meta <sandbox-id> [set <key>=<value>... | unset <key>...] [--json]
|
|
21989
22157
|
agental regions [--json]
|
|
22158
|
+
agental sizes [--json] the five sizes and your organization's own
|
|
22159
|
+
agental sizes add <name> --vcpus <n> --memory <GiB> --disk <GB> [--where own|agental|both] [--json]
|
|
22160
|
+
agental sizes retire <name> [--json] nothing new takes it; what has it keeps it
|
|
21990
22161
|
agental exec <sandbox-id> -- <command> [args...]
|
|
21991
22162
|
agental command start <sandbox-id> [--name <name>] [--cwd <dir>] [--env <NAME>=<value>]... [--timeout <seconds> | --no-timeout] [--stdin] [--json] -- <command> [args...]
|
|
21992
22163
|
agental command list <sandbox-id> [--limit <n>] [--json]
|
|
@@ -22012,7 +22183,7 @@ Usage
|
|
|
22012
22183
|
agental delete --where '<words>' [--confirm <count>] asks for the count to be typed
|
|
22013
22184
|
agental bulk-actions [list | show <id> | cancel <id>] [--json]
|
|
22014
22185
|
agental recover <sandbox-id> [--max-burst-fee <dollars>]
|
|
22015
|
-
agental resize <sandbox-id>
|
|
22186
|
+
agental resize <sandbox-id> <size> [--now] [--max-burst-fee <dollars>] [--json]
|
|
22016
22187
|
agental resize <sandbox-id> --cancel [--json] a size that waits for its next start, taken away
|
|
22017
22188
|
agental auto-stop <sandbox-id> [--in <time> | --at <date-time> | --never] [--json]
|
|
22018
22189
|
agental network <sandbox-id> [--allow <address-or-name>[,<address-or-name>...] | --none] [--json]
|
|
@@ -22032,7 +22203,7 @@ Usage
|
|
|
22032
22203
|
agental template show <template> [--json]
|
|
22033
22204
|
agental template rename <template> <new-name>
|
|
22034
22205
|
agental template delete <template> [--pause-jobs]
|
|
22035
|
-
agental template start <template> [--size
|
|
22206
|
+
agental template start <template> [--size <size>] [--snapshot <snapshot-id> | --image <image> | --new-machine] [--ttl <time> | --ttl default] [--region <region> | --region default] [--spot [--on-reclaim delete|stop] [--warn-at <chance>] | --standard]
|
|
22036
22207
|
agental template network <template> [open | blocked | allowlist <address-or-name>...] [--json]
|
|
22037
22208
|
agental template egress <template> [box | residential <country> [sticky | rotating]] [--json]
|
|
22038
22209
|
agental template tailnet <template> [join --tag <tag>... [--accept <range>]... [--exit-node <ip>] [--keep-address] | off] [--json]
|
|
@@ -22061,7 +22232,7 @@ Usage
|
|
|
22061
22232
|
[--max-monthly-spend <dollars>]
|
|
22062
22233
|
[--input <NAME>[=<default>]]... [--secret-input <NAME>[=<default>]]... [--after-job <job>[:succeeded|failed]]... [--on-mail <sandbox>]... [--on-guild-request <guild>:<identity>]...
|
|
22063
22234
|
[--json] -- <command> [args...]
|
|
22064
|
-
agental job add [<name>] --template <template> [--size
|
|
22235
|
+
agental job add [<name>] --template <template> [--size <size>] [--keep-failed-for 0|30m|24h|7d] [--every 1m|15m|1h|1d | --cron "<m h dom mon dow>" [--tz <zone>] | --at <date-time>]
|
|
22065
22236
|
[--timeout <time>] [--overlap skip|replace|parallel] [--retries <0-5>] [--alerts email|webhook|both|none] [--max-monthly-spend <dollars>]
|
|
22066
22237
|
[--input <NAME>[=<default>]]... [--secret-input <NAME>[=<default>]]... [--after-job <job>[:succeeded|failed]]... [--on-mail <sandbox>]... [--on-guild-request <guild>:<identity>]...
|
|
22067
22238
|
[--json] -- <command> [args...] a fresh sandbox for each run
|
|
@@ -22104,6 +22275,8 @@ Usage
|
|
|
22104
22275
|
agental webhook delete <webhook-id>
|
|
22105
22276
|
agental servers [--json]
|
|
22106
22277
|
agental servers offload [on|off] [--over <percent>] [--json]
|
|
22278
|
+
agental servers offload sent [--since <time>] [--json] the sandboxes it sent to agental's servers
|
|
22279
|
+
agental servers offload load [--since <time>] [--until <time>] [--json] how often each line was crossed
|
|
22107
22280
|
agental servers window [--day <day> --hour <0-23> --tz <zone> [--hours <1-12>] | --off] [--json]
|
|
22108
22281
|
agental servers core-days [--month <yyyy-mm>] [--json]
|
|
22109
22282
|
agental servers key-lost <key-id> [--yes] [--json] an organization key gone for good: its archives are lost
|
|
@@ -22425,8 +22598,11 @@ that takes its agent off. gone says a server is gone for good, once it is draine
|
|
|
22425
22598
|
been away 24 hours: its sandboxes are said lost, and it cannot be undone, so it asks first unless
|
|
22426
22599
|
--yes, and --reason says why. servers offload says whether a new sandbox that names no region
|
|
22427
22600
|
starts on agental's servers when none of yours has room under --over percent of its memory, CPU
|
|
22428
|
-
and disk (80 to begin with); on and off turn it on and off. Such a sandbox
|
|
22429
|
-
one, from your credits. servers
|
|
22601
|
+
and disk (80 to begin with), and who set it so and when; on and off turn it on and off. Such a sandbox
|
|
22602
|
+
is a hosted one, billed as one, from your credits. servers offload sent lists the sandboxes it sent,
|
|
22603
|
+
newest first, over the last 7 days or since --since. servers offload load says how busy your servers
|
|
22604
|
+
were together over the same time, and how many times and hours each line from 70% to 90% was
|
|
22605
|
+
crossed, worked out from the readings kept 15 days. servers window says, and sets, the weekly window in which your servers take
|
|
22430
22606
|
a new agent: --day, --hour on the clock of --tz (an IANA zone, as Europe/Berlin) and --hours (4 to
|
|
22431
22607
|
begin with); --off has them take one at once. A security release reaches them outside it too.
|
|
22432
22608
|
servers core-days is the month's cores as they are counted for billing, day by day.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agental",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.79.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",
|