agental 0.67.1 → 0.73.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 +426 -97
- 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.73.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}`;
|
|
@@ -9448,7 +9448,8 @@ var COMMANDS = [
|
|
|
9448
9448
|
[" --image <image>[@<build>]", "start it from your image: its newest ready build, or that build"],
|
|
9449
9449
|
["-s, --size <size>", "tiny, small, medium, large or xlarge (default: the template's)"],
|
|
9450
9450
|
[" --region <region>", "where it runs; agental regions lists them"],
|
|
9451
|
-
[" --ttl <time>", "
|
|
9451
|
+
[" --ttl <time>", "delete it after this long, as 30m or 2h"],
|
|
9452
|
+
[" --on-timeout <what>", "what the limit does: delete (default), stop (keeps its disk) or pause"],
|
|
9452
9453
|
[" --allow <addresses>", "reach only these addresses, comma-separated"],
|
|
9453
9454
|
[" --egress <egress>", "box, or residential:<country>[:sticky|rotating]"],
|
|
9454
9455
|
[" --tailnet <tags> | off", "join the tailnet tagged so (tag:ci), or off for none"],
|
|
@@ -9543,19 +9544,22 @@ var COMMANDS = [
|
|
|
9543
9544
|
{ name: "ssh-off", summary: "Turn SSH off for a sandbox and close its port." },
|
|
9544
9545
|
{
|
|
9545
9546
|
name: "site",
|
|
9546
|
-
summary: "List, add and remove a sandbox's sites,
|
|
9547
|
+
summary: "List, add and remove a sandbox's sites, links to its ports, choose who may open each, and see their visits.",
|
|
9547
9548
|
examples: [
|
|
9548
9549
|
"agental site sbx_2a9a47e50daec64a",
|
|
9549
9550
|
"agental site add sbx_2a9a47e50daec64a 3000",
|
|
9551
|
+
"agental site add sbx_2a9a47e50daec64a 5173 --private",
|
|
9552
|
+
"agental site access sbx_2a9a47e50daec64a rte_0123456789abcdef organization",
|
|
9550
9553
|
"agental site rm sbx_2a9a47e50daec64a rte_0123456789abcdef",
|
|
9551
9554
|
"agental site stats sbx_2a9a47e50daec64a rte_0123456789abcdef --range 24h",
|
|
9552
9555
|
"agental site analytics off sbx_2a9a47e50daec64a rte_0123456789abcdef",
|
|
9553
9556
|
"agental site analytics org"
|
|
9554
9557
|
],
|
|
9555
9558
|
flags: [
|
|
9556
|
-
["--json", "list, add, stats, analytics: print as JSON"],
|
|
9559
|
+
["--json", "list, add, access, stats, analytics: print as JSON"],
|
|
9560
|
+
["--private", "add: only your organization's people, signed in, and keys with site.open may open it"],
|
|
9557
9561
|
["--range <24h|7d>", "stats: the last 24 hours, or 7 days, the default"],
|
|
9558
|
-
["--yes", "analytics off: delete the figures without asking"],
|
|
9562
|
+
["--yes", "analytics off: delete the figures without asking; access anyone: open a private site without asking"],
|
|
9559
9563
|
["--informed", "analytics org on: you have read what is kept, on Enterprise or with your own server"]
|
|
9560
9564
|
]
|
|
9561
9565
|
},
|
|
@@ -9573,13 +9577,31 @@ var COMMANDS = [
|
|
|
9573
9577
|
{
|
|
9574
9578
|
name: "stop",
|
|
9575
9579
|
summary: "Stop a sandbox, or every one --where finds. Its disk is kept.",
|
|
9576
|
-
examples: ["agental stop sbx_2a9a47e50daec64a", "agental stop
|
|
9580
|
+
examples: ["agental stop sbx_2a9a47e50daec64a", "agental stop --where 'bench'"],
|
|
9577
9581
|
flags: [
|
|
9578
|
-
["--keep-memory", "keep what runs in memory too, so it carries on from where it was"],
|
|
9579
9582
|
["--where '<words>'", "every sandbox the words find, as one bulk action"],
|
|
9580
9583
|
["--yes", "with --where: stop them without asking"]
|
|
9581
9584
|
]
|
|
9582
9585
|
},
|
|
9586
|
+
{
|
|
9587
|
+
name: "pause",
|
|
9588
|
+
summary: "Pause a sandbox, or every one --where finds: stop it with its memory kept, so resume carries on where it was. A spot sandbox never keeps its memory: with --where it is stopped with its disk only.",
|
|
9589
|
+
examples: ["agental pause sbx_2a9a47e50daec64a", "agental pause --where 'bench'"],
|
|
9590
|
+
flags: [
|
|
9591
|
+
["--where '<words>'", "every sandbox the words find, as one bulk action"],
|
|
9592
|
+
["--yes", "with --where: pause them without asking"]
|
|
9593
|
+
]
|
|
9594
|
+
},
|
|
9595
|
+
{
|
|
9596
|
+
name: "resume",
|
|
9597
|
+
summary: "Resume a paused sandbox, or every paused one --where finds: every process carries on where it was.",
|
|
9598
|
+
examples: ["agental resume sbx_2a9a47e50daec64a", "agental resume --where 'bench'"],
|
|
9599
|
+
flags: [
|
|
9600
|
+
["--where '<words>'", "every paused sandbox the words find, as one bulk action"],
|
|
9601
|
+
["--yes", "with --where: resume them without asking"],
|
|
9602
|
+
["--max-burst-fee <dollars>", "the most this resume of one sandbox may pay in burst fees"]
|
|
9603
|
+
]
|
|
9604
|
+
},
|
|
9583
9605
|
{
|
|
9584
9606
|
name: "delete",
|
|
9585
9607
|
summary: "Delete a sandbox, or every one --where finds. It cannot be undone.",
|
|
@@ -9630,7 +9652,8 @@ var COMMANDS = [
|
|
|
9630
9652
|
summary: "Set up a guild, where agents work together under identities of its design, or join one as an agent.",
|
|
9631
9653
|
usage: [
|
|
9632
9654
|
"agental guild [list] | show <guild> | delete <guild> [--yes]",
|
|
9633
|
-
"agental guild
|
|
9655
|
+
"agental guild plan <guild> --roles <name[:seats],...> [--brief <text>] [--form <file.json>] [--template <template[:role,...]>]...",
|
|
9656
|
+
"agental guild create <guild> --roles <name[:seats],...> [--brief <text>] [--form <file.json>] [--template <template[:role,...]>]...",
|
|
9634
9657
|
"agental guild attach <guild> <template|sandbox> [--roles <role,...>] | detach <guild> <template|sandbox>",
|
|
9635
9658
|
"agental guild mine",
|
|
9636
9659
|
"agental guild join <guild> --as <name> --role <role> [--answer <key=value>]...",
|
|
@@ -9643,6 +9666,7 @@ var COMMANDS = [
|
|
|
9643
9666
|
"agental guild work <guild> --as <name> [--role <role>] [--parallel <n>] [--answer-chars <n>] [--once] -- <command> [args...]"
|
|
9644
9667
|
],
|
|
9645
9668
|
examples: [
|
|
9669
|
+
'agental guild plan marketing --roles "blog manager:1,reviewer:2" --brief "Reviewers answer pass or fail." --template writers:reviewer',
|
|
9646
9670
|
'agental guild create marketing --roles "blog manager:1,reviewer:2" --brief "Reviewers answer pass or fail."',
|
|
9647
9671
|
"agental guild attach marketing writers",
|
|
9648
9672
|
"agental guild join marketing --as Atlas --role reviewer --answer model=claude",
|
|
@@ -9653,9 +9677,10 @@ var COMMANDS = [
|
|
|
9653
9677
|
"agental guild work marketing --as builder-1 --once -- claude -p"
|
|
9654
9678
|
],
|
|
9655
9679
|
flags: [
|
|
9656
|
-
["--roles <name[:seats],...>", "create: the roles, each with its seats; attach: the roles its sandboxes may take"],
|
|
9657
|
-
["--brief <text>", "create: what the guild is for, read by every member"],
|
|
9680
|
+
["--roles <name[:seats],...>", "plan, create: the roles, each with its seats; attach: the roles its sandboxes may take"],
|
|
9681
|
+
["--brief <text>", "plan, create: what the guild is for, read by every member"],
|
|
9658
9682
|
["--form <file.json>", "create: the fields an agent fills in to join, as the API takes them"],
|
|
9683
|
+
["--template <template[:role,...]>", "plan, create: a template whose sandboxes may join, in those roles or any (may be given again)"],
|
|
9659
9684
|
["--as <name>", "join: the name you will be known by in the guild"],
|
|
9660
9685
|
["--role <role>", "join: one of the guild's roles with a free seat"],
|
|
9661
9686
|
["--answer <key=value>", "join: an answer to the guild's form (may be given again)"],
|
|
@@ -9720,7 +9745,7 @@ var COMMANDS = [
|
|
|
9720
9745
|
["--snapshot <snapshot-id>", "start: start them from this snapshot"],
|
|
9721
9746
|
["--image <image>[@<build>]", "start: start them from your image, its newest ready build or that one"],
|
|
9722
9747
|
["--new-machine", "start: start them as a new machine of our own image, from no snapshot or image of yours"],
|
|
9723
|
-
["--ttl <time> | default", "start:
|
|
9748
|
+
["--ttl <time> | default", "start: delete them after this long, as 2h"],
|
|
9724
9749
|
["--tag <tag>, --meta <key>=<value>", "create: label it (may be given again)"],
|
|
9725
9750
|
["--pause-jobs", "delete: delete it even where jobs make their fresh sandboxes from it, and pause them"],
|
|
9726
9751
|
["--json", "print as JSON"]
|
|
@@ -9779,7 +9804,7 @@ var COMMANDS = [
|
|
|
9779
9804
|
["--at <date-time>", "add, update: once, at that moment"],
|
|
9780
9805
|
["--timeout <time>", "how long a run may take (default 10m, at most 6h)"],
|
|
9781
9806
|
["--if-stopped start|skip", "start a stopped sandbox for the run and stop it after (start), or skip"],
|
|
9782
|
-
["--
|
|
9807
|
+
["--pause-after", "when the run started the sandbox, pause it again after, keeping its memory"],
|
|
9783
9808
|
["--delete-after", "with --at: delete the sandbox after a run that exits 0"],
|
|
9784
9809
|
["--disk-only", "update: stop it after keeping its disk, as by default"],
|
|
9785
9810
|
["--overlap skip|replace|parallel", "when the last run still goes: skip this one, stop that one, or run both"],
|
|
@@ -9889,7 +9914,7 @@ var COMMANDS = [
|
|
|
9889
9914
|
usage: [
|
|
9890
9915
|
"agental sandbox list [flags]",
|
|
9891
9916
|
"agental sandbox create [--name <name>] [flags]",
|
|
9892
|
-
"agental sandbox start|stop|delete|recover <sandbox-id> [flags]",
|
|
9917
|
+
"agental sandbox start|stop|pause|resume|delete|recover <sandbox-id> [flags]",
|
|
9893
9918
|
"agental sandbox exec <sandbox-id> -- <command> [args...]",
|
|
9894
9919
|
"agental sandbox shell <sandbox-id>",
|
|
9895
9920
|
"agental sandbox summary [flags]"
|
|
@@ -10130,7 +10155,7 @@ ${faint("agental help lists every command.", stream)}
|
|
|
10130
10155
|
`;
|
|
10131
10156
|
}
|
|
10132
10157
|
var LISTED = { template: "templates", key: "keys", webhook: "webhooks", job: "jobs", server: "servers" };
|
|
10133
|
-
var SANDBOX_VERBS = /* @__PURE__ */ new Set(["list", "create", "start", "stop", "delete", "recover", "exec", "shell", "summary"]);
|
|
10158
|
+
var SANDBOX_VERBS = /* @__PURE__ */ new Set(["list", "create", "start", "stop", "pause", "resume", "delete", "recover", "exec", "shell", "summary"]);
|
|
10134
10159
|
var SECRET_VERBS = /* @__PURE__ */ new Set(["list", "get", "set", "unset", "hosts", "get-file", "put-file", "rm-file"]);
|
|
10135
10160
|
var ACCOUNT_SECRET_VERBS = /* @__PURE__ */ new Set(["use", "unuse", "seal", "delete"]);
|
|
10136
10161
|
var ACCOUNT_SECRET_WORDS = /* @__PURE__ */ new Map([
|
|
@@ -10165,7 +10190,7 @@ function spelledOut(args, operator = false) {
|
|
|
10165
10190
|
};
|
|
10166
10191
|
switch (thing) {
|
|
10167
10192
|
case "sandbox":
|
|
10168
|
-
return verb !== void 0 && SANDBOX_VERBS.has(verb) ? [verb, ...rest] : wrong("list, create, start, stop, delete, recover, exec, shell or summary");
|
|
10193
|
+
return verb !== void 0 && SANDBOX_VERBS.has(verb) ? [verb, ...rest] : wrong("list, create, start, stop, pause, resume, delete, recover, exec, shell or summary");
|
|
10169
10194
|
case "region":
|
|
10170
10195
|
return verb === "list" ? ["regions", ...rest] : wrong("list");
|
|
10171
10196
|
case "bulk":
|
|
@@ -10248,7 +10273,7 @@ var SUBCOMMANDS = {
|
|
|
10248
10273
|
limits: ["budget"],
|
|
10249
10274
|
egress: ["budget", "use-case"],
|
|
10250
10275
|
tailscale: ["status", "connect", "disconnect"],
|
|
10251
|
-
guild: ["list", "show", "create", "delete", "attach", "detach", "mine", "join", "members", "leave", "handover", "post", "read", "requests", "claim", "answer", "close", "notes", "pause", "resume", "work"],
|
|
10276
|
+
guild: ["list", "show", "plan", "create", "delete", "attach", "detach", "mine", "join", "members", "leave", "handover", "post", "read", "requests", "claim", "answer", "close", "notes", "pause", "resume", "work"],
|
|
10252
10277
|
subscriptions: ["list", "sign-in", "delete"],
|
|
10253
10278
|
telemetry: ["set", "test", "unset"],
|
|
10254
10279
|
ci: ["jobs", "set", "reset"],
|
|
@@ -10301,7 +10326,7 @@ function flagsOf(usages) {
|
|
|
10301
10326
|
return flags2;
|
|
10302
10327
|
}
|
|
10303
10328
|
var SANDBOX = /^<sandbox-id>/;
|
|
10304
|
-
var SANDBOX_VERBS2 = /* @__PURE__ */ new Set(["list", "create", "start", "stop", "delete", "recover", "exec", "shell", "summary"]);
|
|
10329
|
+
var SANDBOX_VERBS2 = /* @__PURE__ */ new Set(["list", "create", "start", "stop", "pause", "resume", "delete", "recover", "exec", "shell", "summary"]);
|
|
10305
10330
|
var TEMPLATE = /^<template>/;
|
|
10306
10331
|
var SNAPSHOT = /^<snapshot/;
|
|
10307
10332
|
var IMAGE = /^<image>/;
|
|
@@ -10948,7 +10973,6 @@ function afterOf(job2) {
|
|
|
10948
10973
|
case "delete":
|
|
10949
10974
|
return "deletes the sandbox, if the command exits 0";
|
|
10950
10975
|
case "pause":
|
|
10951
|
-
case "stop_with_memory":
|
|
10952
10976
|
return "pauses it again if the run started it, keeping its memory";
|
|
10953
10977
|
default:
|
|
10954
10978
|
return "stops it again if the run started it, keeping its disk";
|
|
@@ -11045,8 +11069,8 @@ function targetOf(options) {
|
|
|
11045
11069
|
throw new Error("--size is the size of each fresh sandbox, and goes with --template.");
|
|
11046
11070
|
}
|
|
11047
11071
|
if (template2 !== void 0) {
|
|
11048
|
-
if ([options["if-stopped"], options["
|
|
11049
|
-
throw new Error("--if-stopped, --
|
|
11072
|
+
if ([options["if-stopped"], options["pause-after"], options["delete-after"], options["disk-only"]].some((given) => given !== void 0 && given !== false)) {
|
|
11073
|
+
throw new Error("--if-stopped, --pause-after, --delete-after and --disk-only are for a sandbox you keep. A fresh sandbox is made running for each run, and deleted after a run that succeeds.");
|
|
11050
11074
|
}
|
|
11051
11075
|
return { template: template2, ...options.size === void 0 ? {} : { size: options.size } };
|
|
11052
11076
|
}
|
|
@@ -11164,8 +11188,8 @@ function fieldsOf(options) {
|
|
|
11164
11188
|
if ([options.every, options.cron, options.at].filter((given) => given !== void 0).length > 1) {
|
|
11165
11189
|
throw new Error("Give one of --every, --cron or --at.");
|
|
11166
11190
|
}
|
|
11167
|
-
if ([options["
|
|
11168
|
-
throw new Error("Give one of --
|
|
11191
|
+
if ([options["pause-after"], options["delete-after"], options["disk-only"]].filter(Boolean).length > 1) {
|
|
11192
|
+
throw new Error("Give one of --pause-after, --delete-after or --disk-only.");
|
|
11169
11193
|
}
|
|
11170
11194
|
if (options.overlap !== void 0 && !OVERLAPS.includes(options.overlap)) {
|
|
11171
11195
|
throw new Error(`--overlap is skip, replace or parallel, not ${options.overlap}.`);
|
|
@@ -11193,7 +11217,7 @@ function fieldsOf(options) {
|
|
|
11193
11217
|
...options.timeout === void 0 ? {} : { timeoutMs: timeoutMsOf(options.timeout) },
|
|
11194
11218
|
...options.overlap === void 0 ? {} : { overlap: options.overlap },
|
|
11195
11219
|
...ifStopped === void 0 ? {} : { ifStopped },
|
|
11196
|
-
...options["
|
|
11220
|
+
...options["pause-after"] ? { after: "pause" } : options["delete-after"] ? { after: "delete" } : options["disk-only"] ? { after: "stop" } : {},
|
|
11197
11221
|
...options["keep-failed-for"] === void 0 ? {} : { keepFailedFor: options["keep-failed-for"] },
|
|
11198
11222
|
...options.retries === void 0 ? {} : { retries: Number(options.retries.trim()) },
|
|
11199
11223
|
...options.alerts === void 0 ? {} : { alerts: options.alerts },
|
|
@@ -11373,7 +11397,7 @@ async function job(client, positionals, command3, options) {
|
|
|
11373
11397
|
const changes = { ...fieldsOf(options), ...options.name === void 0 ? {} : { name: options.name }, ...command3 !== null && command3.length > 0 ? { command: commandLine(command3) } : {} };
|
|
11374
11398
|
if (Object.keys(changes).length === 0) {
|
|
11375
11399
|
throw new Error(
|
|
11376
|
-
"job update needs something to change: --sandbox, --template (and --size), --keep-failed-for, --every, --cron, --at, --tz, --timeout, --overlap, --if-stopped, --
|
|
11400
|
+
"job update needs something to change: --sandbox, --template (and --size), --keep-failed-for, --every, --cron, --at, --tz, --timeout, --overlap, --if-stopped, --pause-after, --delete-after or --disk-only, --retries, --alerts, --max-monthly-spend, --input or --secret-input, --after-job, --on-mail, --on-guild-request or --no-events, --name for a new name, or a new command after --."
|
|
11377
11401
|
);
|
|
11378
11402
|
}
|
|
11379
11403
|
print3(await ask6(client, "PATCH", path9, changes), options.json);
|
|
@@ -12477,7 +12501,7 @@ async function writeStdin(client, sandbox, id, one) {
|
|
|
12477
12501
|
|
|
12478
12502
|
// ../src/cli-servers.ts
|
|
12479
12503
|
var SERVER_USAGE = "server takes list, add, show, readings, token, drain, open, gone or remove. agental server --help shows each.";
|
|
12480
|
-
var SERVERS_USAGE = "servers takes nothing to list them, offload [on|off] [--over <percent>],
|
|
12504
|
+
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>.";
|
|
12481
12505
|
var READING_MINUTES = ["1", "5", "15", "60"];
|
|
12482
12506
|
async function ask8(client, method, pathname, body) {
|
|
12483
12507
|
const response = await client.request(pathname, { method, ...body === void 0 ? {} : { body: JSON.stringify(body) } });
|
|
@@ -12558,6 +12582,20 @@ function smtOf(server2) {
|
|
|
12558
12582
|
}
|
|
12559
12583
|
return smt.on ? "on" : "off (allowed on: the processor or the server has it off)";
|
|
12560
12584
|
}
|
|
12585
|
+
function bucketOf(server2) {
|
|
12586
|
+
const bucket = server2.ownBucket;
|
|
12587
|
+
if (bucket === void 0) {
|
|
12588
|
+
return "not said by this API";
|
|
12589
|
+
}
|
|
12590
|
+
if (bucket === null) {
|
|
12591
|
+
return "none: its sandboxes are not archived, and stay on it. sudo agental-agent bucket set, on the server, sets one";
|
|
12592
|
+
}
|
|
12593
|
+
const key2 = bucket.keyIds[0] === void 0 ? "no organization key: sudo agental-agent bucket key new makes one" : `sealed under key ${bucket.keyIds[0]}${bucket.keyIds.length > 1 ? ` (and holds ${bucket.keyIds.length - 1} more)` : ""}`;
|
|
12594
|
+
const checked = ago(bucket.checkedAt) ?? utc(bucket.checkedAt);
|
|
12595
|
+
const check = bucket.ok ? `works, checked ${checked}` : `did not work when checked ${checked}: nothing is archived or brought back`;
|
|
12596
|
+
return `${bucket.bucketId.slice(0, 12)}, ${key2}, ${check}${bucket.differs === null ? "" : `
|
|
12597
|
+
${bucket.differs}`}`;
|
|
12598
|
+
}
|
|
12561
12599
|
function describe3(server2) {
|
|
12562
12600
|
const rows = [
|
|
12563
12601
|
["id", server2.id],
|
|
@@ -12570,8 +12608,16 @@ function describe3(server2) {
|
|
|
12570
12608
|
["smt", smtOf(server2)],
|
|
12571
12609
|
["ksm", server2.ksm?.on === true ? "on: it takes no new sandbox until it is off" : server2.ksm?.on === false ? "off" : "not read yet"],
|
|
12572
12610
|
["holds", holdsOf(server2)],
|
|
12611
|
+
["bucket", bucketOf(server2)],
|
|
12573
12612
|
["added", utc(server2.addedAt)]
|
|
12574
12613
|
];
|
|
12614
|
+
for (const stays of server2.stays ?? []) {
|
|
12615
|
+
rows.push(["stays", `${stays.name} (${stays.sandboxId}): ${stays.why}`]);
|
|
12616
|
+
}
|
|
12617
|
+
const update = server2.update;
|
|
12618
|
+
if (update !== void 0 && update.wanted !== null && update.runs !== null && update.runs !== update.wanted) {
|
|
12619
|
+
rows.push(["update", update.urgent ? `to ${update.wanted} now: a security release` : update.waitingFor !== null ? `${update.wanted} waits for your window, ${utc(update.waitingFor)}` : `to ${update.wanted} now`]);
|
|
12620
|
+
}
|
|
12575
12621
|
if (server2.agent.state === "waiting" && server2.agent.joinTokenExpiresAt !== null) {
|
|
12576
12622
|
rows.push(["token", `works once, until ${utc(server2.agent.joinTokenExpiresAt)}`]);
|
|
12577
12623
|
}
|
|
@@ -12580,8 +12626,9 @@ function describe3(server2) {
|
|
|
12580
12626
|
}
|
|
12581
12627
|
function sayJoin(joined) {
|
|
12582
12628
|
process.stdout.write(describe3({ ...joined.server, agent: { ...joined.server.agent, joinTokenExpiresAt: null } }));
|
|
12629
|
+
const where = joined.join.installCommand.includes("/dev/DISK") ? ", with the disk for sandboxes in place of /dev/DISK" : ". The disk it names has to hold nothing: no partition, and nothing written on it";
|
|
12583
12630
|
process.stdout.write(`
|
|
12584
|
-
Run this as root on the server
|
|
12631
|
+
Run this as root on the server${where}:
|
|
12585
12632
|
|
|
12586
12633
|
${joined.join.installCommand}
|
|
12587
12634
|
|
|
@@ -12620,12 +12667,37 @@ async function servers(client, positionals, options) {
|
|
|
12620
12667
|
await offload(client, rest, options);
|
|
12621
12668
|
return;
|
|
12622
12669
|
}
|
|
12670
|
+
if (what === "window" && rest.length === 0) {
|
|
12671
|
+
await updateWindow(client, options);
|
|
12672
|
+
return;
|
|
12673
|
+
}
|
|
12623
12674
|
if (what === "core-days" && rest.length === 0) {
|
|
12624
12675
|
await coreDays(client, options);
|
|
12625
12676
|
return;
|
|
12626
12677
|
}
|
|
12678
|
+
if (what === "key-lost" && rest.length === 1) {
|
|
12679
|
+
await keyLost(client, rest[0], options);
|
|
12680
|
+
return;
|
|
12681
|
+
}
|
|
12627
12682
|
throw new Error(SERVERS_USAGE);
|
|
12628
12683
|
}
|
|
12684
|
+
async function keyLost(client, keyId, options) {
|
|
12685
|
+
if (!/^[0-9a-f]{32}$/.test(keyId)) {
|
|
12686
|
+
throw new Error("servers key-lost needs the key's id, 32 hex digits, as agental server show <server> gives it.");
|
|
12687
|
+
}
|
|
12688
|
+
process.stderr.write(`This says your organization's key ${keyId} is lost for good, and cannot be undone. Every sandbox archived under it is said lost: nobody, agental included, can open its archive.
|
|
12689
|
+
`);
|
|
12690
|
+
if (!options.yes && !await client.confirmed("Say the key is lost?")) {
|
|
12691
|
+
throw new Error("Nothing was changed.");
|
|
12692
|
+
}
|
|
12693
|
+
const said = await ask8(client, "POST", `/v1/own-bucket/keys/${keyId}/lost`, {});
|
|
12694
|
+
if (options.json) {
|
|
12695
|
+
printJson2(said);
|
|
12696
|
+
return;
|
|
12697
|
+
}
|
|
12698
|
+
process.stdout.write(said.sandboxesLost.length === 0 ? "No archive was sealed under it.\n" : `Said lost: ${said.sandboxesLost.join(", ")}. Delete them when you are ready.
|
|
12699
|
+
`);
|
|
12700
|
+
}
|
|
12629
12701
|
async function listServers(client, asJson) {
|
|
12630
12702
|
if (asJson) {
|
|
12631
12703
|
printJson2(await ask8(client, "GET", "/v1/servers"));
|
|
@@ -12671,6 +12743,47 @@ async function offload(client, words2, options) {
|
|
|
12671
12743
|
sayOffload(set2);
|
|
12672
12744
|
}
|
|
12673
12745
|
}
|
|
12746
|
+
function sayWindow(set2) {
|
|
12747
|
+
if (set2.window === null) {
|
|
12748
|
+
process.stdout.write("No update window: your servers take a new agent as soon as agental releases one.\nagental servers window --day sunday --hour 2 --tz Europe/Berlin sets one.\n");
|
|
12749
|
+
return;
|
|
12750
|
+
}
|
|
12751
|
+
const { day, hour, timeZone, hours } = set2.window;
|
|
12752
|
+
process.stdout.write(
|
|
12753
|
+
`Your servers take a new agent on ${day}s from ${String(hour).padStart(2, "0")}:00 for ${hours} hour${hours === 1 ? "" : "s"}, ${timeZone} time.
|
|
12754
|
+
` + (set2.nextStart === null ? "" : `It next opens ${utc(set2.nextStart)}.
|
|
12755
|
+
`) + "A security release reaches them outside it too. Their sandboxes run on while the agent updates.\n"
|
|
12756
|
+
);
|
|
12757
|
+
}
|
|
12758
|
+
async function updateWindow(client, options) {
|
|
12759
|
+
const setting = options.day !== void 0 || options.hour !== void 0 || options.tz !== void 0 || options.hours !== void 0;
|
|
12760
|
+
if (options.off === true && setting) {
|
|
12761
|
+
throw new Error("servers window takes --off alone, or --day, --hour and --tz with --hours.");
|
|
12762
|
+
}
|
|
12763
|
+
let answer6;
|
|
12764
|
+
if (options.off === true) {
|
|
12765
|
+
answer6 = await ask8(client, "PUT", "/v1/update-window", { window: null });
|
|
12766
|
+
} else if (setting) {
|
|
12767
|
+
if (options.day === void 0 || options.hour === void 0 || options.tz === void 0) {
|
|
12768
|
+
throw new Error("servers window needs --day, --hour and --tz together: as agental servers window --day sunday --hour 2 --tz Europe/Berlin.");
|
|
12769
|
+
}
|
|
12770
|
+
const whole = (flag, value) => {
|
|
12771
|
+
if (!/^\d{1,2}$/.test(value)) {
|
|
12772
|
+
throw new Error(`--${flag} is a whole number, as 2.`);
|
|
12773
|
+
}
|
|
12774
|
+
return Number.parseInt(value, 10);
|
|
12775
|
+
};
|
|
12776
|
+
const window = { day: options.day.toLowerCase(), hour: whole("hour", options.hour), timeZone: options.tz, ...options.hours === void 0 ? {} : { hours: whole("hours", options.hours) } };
|
|
12777
|
+
answer6 = await ask8(client, "PUT", "/v1/update-window", { window });
|
|
12778
|
+
} else {
|
|
12779
|
+
answer6 = await ask8(client, "GET", "/v1/update-window");
|
|
12780
|
+
}
|
|
12781
|
+
if (options.json) {
|
|
12782
|
+
printJson2(answer6);
|
|
12783
|
+
} else {
|
|
12784
|
+
sayWindow(answer6);
|
|
12785
|
+
}
|
|
12786
|
+
}
|
|
12674
12787
|
async function coreDays(client, options) {
|
|
12675
12788
|
const query = options.month === void 0 ? "" : `?month=${encodeURIComponent(options.month)}`;
|
|
12676
12789
|
const body = await ask8(client, "GET", `/v1/core-days${query}`);
|
|
@@ -12692,6 +12805,9 @@ async function coreDays(client, options) {
|
|
|
12692
12805
|
process.stdout.write(`${body.coreDays} core-days in all, ${body.extraCoreDays} of them past the commitment.
|
|
12693
12806
|
`);
|
|
12694
12807
|
}
|
|
12808
|
+
function diskOf(options) {
|
|
12809
|
+
return options.disk === void 0 ? {} : { disk: options.disk };
|
|
12810
|
+
}
|
|
12695
12811
|
async function server(client, positionals, options) {
|
|
12696
12812
|
const [what, target, ...rest] = positionals;
|
|
12697
12813
|
if (rest.length > 0) {
|
|
@@ -12702,7 +12818,7 @@ async function server(client, positionals, options) {
|
|
|
12702
12818
|
if (target === void 0) {
|
|
12703
12819
|
throw new Error("server add needs your own name for the server, as agental server add rack-2-server-01.");
|
|
12704
12820
|
}
|
|
12705
|
-
const joined = await ask8(client, "POST", "/v1/servers", { label: target });
|
|
12821
|
+
const joined = await ask8(client, "POST", "/v1/servers", { label: target, ...diskOf(options) });
|
|
12706
12822
|
if (options.json) {
|
|
12707
12823
|
printJson2(joined);
|
|
12708
12824
|
process.stderr.write("join.token and join.installCommand are shown this once.\n");
|
|
@@ -12726,7 +12842,7 @@ async function server(client, positionals, options) {
|
|
|
12726
12842
|
}
|
|
12727
12843
|
case "token": {
|
|
12728
12844
|
const found = await serverNamed(client, target, "token");
|
|
12729
|
-
const joined = await ask8(client, "POST", `/v1/servers/${encodeURIComponent(found.id)}/join-token`,
|
|
12845
|
+
const joined = await ask8(client, "POST", `/v1/servers/${encodeURIComponent(found.id)}/join-token`, diskOf(options));
|
|
12730
12846
|
if (options.json) {
|
|
12731
12847
|
printJson2(joined);
|
|
12732
12848
|
process.stderr.write("join.token and join.installCommand are shown this once. The token it had stopped working just now.\n");
|
|
@@ -13267,8 +13383,6 @@ var STOPPED_WITH_MEMORY_MAX_MICROS_PER_HOUR = {
|
|
|
13267
13383
|
var SANDBOX_STATUSES = ["creating", "running", "stopped", "error", "deleted"];
|
|
13268
13384
|
var SHOWN_STATUSES = [...SANDBOX_STATUSES, "restoring", "migrating", "paused"];
|
|
13269
13385
|
var OUTBOUND_MODES = ["open", "blocked", "allowlist"];
|
|
13270
|
-
var ON_TIMEOUT = ["delete", "stop", "pause"];
|
|
13271
|
-
var ON_TIMEOUT_SENT = [...ON_TIMEOUT, "stop_with_memory"];
|
|
13272
13386
|
function isMachineSize(value) {
|
|
13273
13387
|
return Object.hasOwn(MACHINE_SIZES, value);
|
|
13274
13388
|
}
|
|
@@ -14871,6 +14985,33 @@ async function uploadContext(context, upload, bytes4) {
|
|
|
14871
14985
|
}
|
|
14872
14986
|
return { sha256: packed.sha256, etags };
|
|
14873
14987
|
}
|
|
14988
|
+
async function dropContext(client, contextPath) {
|
|
14989
|
+
try {
|
|
14990
|
+
const response = await client.request(contextPath, { method: "DELETE" });
|
|
14991
|
+
await response.body?.cancel();
|
|
14992
|
+
if (response.ok) {
|
|
14993
|
+
return "dropped";
|
|
14994
|
+
}
|
|
14995
|
+
if (response.status === 409) {
|
|
14996
|
+
return "taken";
|
|
14997
|
+
}
|
|
14998
|
+
process.stderr.write(`The uploaded context was not let go (HTTP ${response.status}): it is deleted a day after it was sent.
|
|
14999
|
+
`);
|
|
15000
|
+
} catch (error) {
|
|
15001
|
+
process.stderr.write(`The uploaded context was not let go (${causeOf(error)}): it is deleted a day after it was sent.
|
|
15002
|
+
`);
|
|
15003
|
+
}
|
|
15004
|
+
return "kept";
|
|
15005
|
+
}
|
|
15006
|
+
async function askOrDrop(client, drop, method, pathname, body) {
|
|
15007
|
+
const response = await client.request(pathname, { method, body: JSON.stringify(body) });
|
|
15008
|
+
const answered = await readJson(response);
|
|
15009
|
+
if (!response.ok) {
|
|
15010
|
+
await drop();
|
|
15011
|
+
client.fail(response.status, answered);
|
|
15012
|
+
}
|
|
15013
|
+
return answered;
|
|
15014
|
+
}
|
|
14874
15015
|
async function build(client, dir, options) {
|
|
14875
15016
|
const name = options.name;
|
|
14876
15017
|
if (name === void 0 || name === "") {
|
|
@@ -14927,24 +15068,55 @@ async function build(client, dir, options) {
|
|
|
14927
15068
|
const parts = upload.parts.length;
|
|
14928
15069
|
process.stderr.write(`Sending ${context.entries.length} files and folders, ${bytesInWords(bytes4)}${parts > 1 ? ` in ${parts} parts` : ""}.
|
|
14929
15070
|
`);
|
|
14930
|
-
|
|
15071
|
+
const contextPath = `${imagePath(name)}/contexts/${encodeURIComponent(upload.context.id)}`;
|
|
15072
|
+
let dropping = null;
|
|
15073
|
+
const drop = () => dropping ??= dropContext(client, contextPath);
|
|
15074
|
+
let stopped = false;
|
|
15075
|
+
const interrupted = () => {
|
|
15076
|
+
stopped = true;
|
|
15077
|
+
void drop().then((became) => {
|
|
15078
|
+
process.stderr.write(
|
|
15079
|
+
became === "taken" ? `
|
|
15080
|
+
Stopped, but the build had started already: agental image show ${name} shows it, and agental image cancel cancels it.
|
|
15081
|
+
` : "\nStopped. Nothing was built.\n"
|
|
15082
|
+
);
|
|
15083
|
+
process.exit(130);
|
|
15084
|
+
});
|
|
15085
|
+
};
|
|
15086
|
+
const unlessStopped = async () => {
|
|
15087
|
+
if (stopped) {
|
|
15088
|
+
await new Promise(() => void 0);
|
|
15089
|
+
}
|
|
15090
|
+
};
|
|
15091
|
+
process.once("SIGINT", interrupted);
|
|
15092
|
+
let started;
|
|
14931
15093
|
try {
|
|
14932
|
-
sent
|
|
14933
|
-
|
|
14934
|
-
|
|
14935
|
-
|
|
15094
|
+
let sent;
|
|
15095
|
+
try {
|
|
15096
|
+
sent = await uploadContext(context, upload, bytes4);
|
|
15097
|
+
} catch (error) {
|
|
15098
|
+
if (error instanceof ContextRefused) {
|
|
15099
|
+
throw new Error(`${error.message}. Nothing was built.`);
|
|
15100
|
+
}
|
|
15101
|
+
throw error;
|
|
14936
15102
|
}
|
|
15103
|
+
await unlessStopped();
|
|
15104
|
+
await askOrDrop(client, drop, "POST", `${contextPath}/complete`, { etags: sent.etags });
|
|
15105
|
+
await unlessStopped();
|
|
15106
|
+
started = await askOrDrop(client, drop, "POST", `${imagePath(name)}/builds`, {
|
|
15107
|
+
contextId: upload.context.id,
|
|
15108
|
+
contextHash: sent.sha256,
|
|
15109
|
+
dockerfile,
|
|
15110
|
+
...context.dockerfile === "Dockerfile" ? {} : { dockerfilePath: context.dockerfile },
|
|
15111
|
+
...Object.keys(args).length === 0 ? {} : { args },
|
|
15112
|
+
copyHashes
|
|
15113
|
+
});
|
|
15114
|
+
} catch (error) {
|
|
15115
|
+
await drop();
|
|
14937
15116
|
throw error;
|
|
15117
|
+
} finally {
|
|
15118
|
+
process.off("SIGINT", interrupted);
|
|
14938
15119
|
}
|
|
14939
|
-
await ask11(client, "POST", `${imagePath(name)}/contexts/${encodeURIComponent(upload.context.id)}/complete`, { etags: sent.etags });
|
|
14940
|
-
const started = await ask11(client, "POST", `${imagePath(name)}/builds`, {
|
|
14941
|
-
contextId: upload.context.id,
|
|
14942
|
-
contextHash: sent.sha256,
|
|
14943
|
-
dockerfile,
|
|
14944
|
-
...context.dockerfile === "Dockerfile" ? {} : { dockerfilePath: context.dockerfile },
|
|
14945
|
-
...Object.keys(args).length === 0 ? {} : { args },
|
|
14946
|
-
copyHashes
|
|
14947
|
-
});
|
|
14948
15120
|
if (options.detach) {
|
|
14949
15121
|
if (options.json) {
|
|
14950
15122
|
printJson3(started);
|
|
@@ -15137,7 +15309,7 @@ var AgentalError = class extends Error {
|
|
|
15137
15309
|
// ../sdk/typescript/src/sealed.ts
|
|
15138
15310
|
var SEALED_SUITE = "x25519-hkdf-sha256-aes256gcm";
|
|
15139
15311
|
var ROOT_PUBLIC_KEYS = ["jNdFf3FKdbFQ5J-1e_NE7ZzuaNPRdci-mzlGj384Rmw"];
|
|
15140
|
-
var SEALED_PURPOSES = ["variable", "tailscale-oauth", "sign-in-code"];
|
|
15312
|
+
var SEALED_PURPOSES = ["variable", "tailscale-oauth", "sign-in-code", "connection-app"];
|
|
15141
15313
|
var KEM_ID = 32;
|
|
15142
15314
|
var KDF_ID = 1;
|
|
15143
15315
|
var AEAD_ID = 2;
|
|
@@ -16043,7 +16215,7 @@ async function work(options) {
|
|
|
16043
16215
|
}
|
|
16044
16216
|
|
|
16045
16217
|
// ../src/cli-guilds.ts
|
|
16046
|
-
var USAGE10 = "guild takes list, show, create, delete, attach, detach, mine, join, members, leave, handover, post, read, requests, claim, answer, close, notes, pause, resume, mail or work. agental guild --help shows each.";
|
|
16218
|
+
var USAGE10 = "guild takes list, show, plan, create, delete, attach, detach, mine, join, members, leave, handover, post, read, requests, claim, answer, close, notes, pause, resume, mail or work. agental guild --help shows each.";
|
|
16047
16219
|
async function ask12(client, method, pathname, body) {
|
|
16048
16220
|
const response = await client.request(pathname, { method, ...body === void 0 ? {} : { body: JSON.stringify(body) } });
|
|
16049
16221
|
let answered = null;
|
|
@@ -16113,6 +16285,45 @@ function formFrom(file) {
|
|
|
16113
16285
|
throw new Error(`--form ${file} is not JSON. It is an array of fields: [{"key": "model", "label": "Which model are you?", "kind": "choice", "choices": ["claude", "codex"], "required": true}].`);
|
|
16114
16286
|
}
|
|
16115
16287
|
}
|
|
16288
|
+
function templateAsked(given) {
|
|
16289
|
+
const colon = given.indexOf(":");
|
|
16290
|
+
const named = (colon === -1 ? given : given.slice(0, colon)).trim();
|
|
16291
|
+
const roles = colon === -1 ? [] : given.slice(colon + 1).split(",").map((role) => role.trim()).filter((role) => role !== "");
|
|
16292
|
+
return { ...named.startsWith("tpl_") ? { templateId: named } : { templateName: named }, ...roles.length === 0 ? {} : { roles } };
|
|
16293
|
+
}
|
|
16294
|
+
function guildAsked(name, options, verb) {
|
|
16295
|
+
return {
|
|
16296
|
+
name: needed(name, `${verb} takes a guild's name`),
|
|
16297
|
+
roles: rolesOf(needed(options.roles, `${verb} takes --roles, such as "blog manager:1,reviewer:2"`)),
|
|
16298
|
+
...options.brief === void 0 ? {} : { brief: options.brief },
|
|
16299
|
+
...options.form === void 0 ? {} : { form: formFrom(options.form) }
|
|
16300
|
+
};
|
|
16301
|
+
}
|
|
16302
|
+
function problemLines(plan2) {
|
|
16303
|
+
return plan2.problems.map((problem) => ` ${problem.field} ${problem.code}: ${problem.message}
|
|
16304
|
+
`).join("");
|
|
16305
|
+
}
|
|
16306
|
+
function planWords(plan2) {
|
|
16307
|
+
const { guild: planned } = plan2;
|
|
16308
|
+
const rules = (role) => `, takes a request for ${String(role["claimMinutes"] ?? 30)} min, ${String(role["postsPerMinute"] ?? 6)} posts a minute, posts to ${role["postsTo"] === null ? "everyone" : role["postsTo"].join(", ") || "no one"}`;
|
|
16309
|
+
return [
|
|
16310
|
+
`${planned.name}, as it would be made
|
|
16311
|
+
`,
|
|
16312
|
+
planned.brief ? ` ${planned.brief}
|
|
16313
|
+
` : "",
|
|
16314
|
+
`roles
|
|
16315
|
+
${planned.roles.map((role) => ` ${roleLine(role)}${rules(role)}
|
|
16316
|
+
`).join("")}`,
|
|
16317
|
+
planned.form.length ? `form
|
|
16318
|
+
${planned.form.map((field) => ` ${String(field["key"])}: ${String(field["label"])}${field["required"] ? " (required)" : ""}
|
|
16319
|
+
`).join("")}` : "",
|
|
16320
|
+
`templates
|
|
16321
|
+
${planned.templates.map((one) => ` ${one.templateName} (${one.templateId})${one.roles ? ` as ${one.roles.join(", ")}` : ", any role"}
|
|
16322
|
+
`).join("") || " none\n"}`,
|
|
16323
|
+
plan2.ok ? "No problems: agental guild create with the same words makes it.\n" : `problems
|
|
16324
|
+
${problemLines(plan2)}`
|
|
16325
|
+
].join("");
|
|
16326
|
+
}
|
|
16116
16327
|
function roleLine(role) {
|
|
16117
16328
|
return `${String(role["name"])} (${role["seats"] === null ? "any number" : `${String(role["seats"])} seat${role["seats"] === 1 ? "" : "s"}`}, ${String(role["onDelete"])} at a delete)${role["address"] ? ` ${String(role["address"])}` : ""}`;
|
|
16118
16329
|
}
|
|
@@ -16187,15 +16398,35 @@ ${members2.map((member) => ` ${memberLine(member)}`).join("") || " none\n"}`
|
|
|
16187
16398
|
print4(options.json, { ...found, members: members2 }, words2);
|
|
16188
16399
|
return;
|
|
16189
16400
|
}
|
|
16401
|
+
case "plan": {
|
|
16402
|
+
const plan2 = await ask12(client, "POST", "/v1/guilds/plan", { ...guildAsked(name, options, "plan"), templates: (options.template ?? []).map(templateAsked) });
|
|
16403
|
+
print4(options.json, plan2, planWords(plan2));
|
|
16404
|
+
if (!plan2.ok) {
|
|
16405
|
+
process.exitCode = 1;
|
|
16406
|
+
}
|
|
16407
|
+
return;
|
|
16408
|
+
}
|
|
16190
16409
|
case "create": {
|
|
16191
|
-
const body =
|
|
16192
|
-
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
|
|
16410
|
+
const body = guildAsked(name, options, "create");
|
|
16411
|
+
let templates2 = [];
|
|
16412
|
+
if (options.template !== void 0 && options.template.length > 0) {
|
|
16413
|
+
const plan2 = await ask12(client, "POST", "/v1/guilds/plan", { ...body, templates: options.template.map(templateAsked) });
|
|
16414
|
+
if (!plan2.ok) {
|
|
16415
|
+
throw new Error(`Nothing was created:
|
|
16416
|
+
${problemLines(plan2)}`);
|
|
16417
|
+
}
|
|
16418
|
+
templates2 = plan2.guild.templates;
|
|
16419
|
+
}
|
|
16197
16420
|
const made = await ask12(client, "POST", "/v1/guilds", body);
|
|
16198
|
-
|
|
16421
|
+
for (const template2 of templates2) {
|
|
16422
|
+
try {
|
|
16423
|
+
await ask12(client, "PUT", `${at4(String(made["name"]))}/templates/${encodeURIComponent(template2.templateId)}`, template2.roles === null ? {} : { roles: template2.roles });
|
|
16424
|
+
} catch (error) {
|
|
16425
|
+
throw new Error(`Made guild ${String(made["name"])}, but ${template2.templateName} could not be let in: ${error instanceof Error ? error.message : String(error)} Let it in with agental guild attach ${String(made["name"])} ${template2.templateName}.`);
|
|
16426
|
+
}
|
|
16427
|
+
}
|
|
16428
|
+
const joining = templates2.length === 0 ? ` agental guild attach ${String(made["name"])} <template> lets that template's sandboxes join it.` : ` Sandboxes of ${templates2.map((one) => one.templateName).join(", ")} may join it.`;
|
|
16429
|
+
print4(options.json, { ...made, templates: templates2 }, `Made guild ${String(made["name"])}.${joining}
|
|
16199
16430
|
`);
|
|
16200
16431
|
return;
|
|
16201
16432
|
}
|
|
@@ -16569,7 +16800,7 @@ async function answer4(client, path9, init) {
|
|
|
16569
16800
|
}
|
|
16570
16801
|
|
|
16571
16802
|
// ../src/cli-sites.ts
|
|
16572
|
-
var USAGE12 = "site takes a sandbox, or list, add, rm, stats or analytics, then the sandbox. agental site --help shows each.";
|
|
16803
|
+
var USAGE12 = "site takes a sandbox, or list, add, rm, access, stats or analytics, then the sandbox. agental site --help shows each.";
|
|
16573
16804
|
var ANALYTICS_USAGE = "site analytics takes on or off, then the sandbox and the site's id, or org, with on or off to change it.";
|
|
16574
16805
|
var REPORT_ROWS = 5;
|
|
16575
16806
|
async function bodyOf2(response) {
|
|
@@ -16755,7 +16986,7 @@ async function site(client, positionals, options) {
|
|
|
16755
16986
|
if (turn === "on" || turn === "off") return siteSwitch(client, turn, words2, options);
|
|
16756
16987
|
throw new Error(ANALYTICS_USAGE);
|
|
16757
16988
|
}
|
|
16758
|
-
const verb = positionals[0] === "list" || positionals[0] === "add" || positionals[0] === "rm" || positionals[0] === "stats" ? positionals[0] : null;
|
|
16989
|
+
const verb = positionals[0] === "list" || positionals[0] === "add" || positionals[0] === "rm" || positionals[0] === "stats" || positionals[0] === "access" ? positionals[0] : null;
|
|
16759
16990
|
const [sandbox, target, ...rest] = verb === null ? positionals : positionals.slice(1);
|
|
16760
16991
|
if (sandbox === void 0) {
|
|
16761
16992
|
throw new Error(USAGE12);
|
|
@@ -16777,7 +17008,7 @@ async function site(client, positionals, options) {
|
|
|
16777
17008
|
`);
|
|
16778
17009
|
return;
|
|
16779
17010
|
}
|
|
16780
|
-
const rows = [["ID", "ADDRESS", "PORT", "STATE"], ...sites.map((route) => [route.id, route.url ?? "no public address here", String(route.port), stateOf4(route)])];
|
|
17011
|
+
const rows = [["ID", "ADDRESS", "PORT", "WHO MAY OPEN", "STATE"], ...sites.map((route) => [route.id, route.url ?? "no public address here", String(route.port), route.access === "organization" ? "organization" : "anyone", stateOf4(route)])];
|
|
16781
17012
|
const terminal2 = isTerminal(process.stdout);
|
|
16782
17013
|
process.stdout.write(fitted(rows, { ...terminal2 ? { give: 1 } : { width: Number.MAX_SAFE_INTEGER }, paint: (cell, row) => row === 0 ? faint(cell) : cell }));
|
|
16783
17014
|
return;
|
|
@@ -16787,7 +17018,18 @@ async function site(client, positionals, options) {
|
|
|
16787
17018
|
throw new Error(USAGE12);
|
|
16788
17019
|
}
|
|
16789
17020
|
const port = portFrom(target);
|
|
16790
|
-
const
|
|
17021
|
+
const response = await client.request(`/v1/sandboxes/${encodeURIComponent(sandbox)}/host`, {
|
|
17022
|
+
method: "POST",
|
|
17023
|
+
body: JSON.stringify({ port, title: `port-${port}`, public: true, ...options.private ? { access: "organization" } : {} })
|
|
17024
|
+
});
|
|
17025
|
+
const answered = await bodyOf2(response);
|
|
17026
|
+
if (!response.ok) {
|
|
17027
|
+
if (response.status === 409 && answered?.error?.code === "port_private") {
|
|
17028
|
+
throw new Error(`Port ${port} has a private link already. Add this one with --private, or open the port to anyone first with agental site access ${sandbox} <site-id> anyone.`);
|
|
17029
|
+
}
|
|
17030
|
+
client.fail(response.status, answered);
|
|
17031
|
+
}
|
|
17032
|
+
const made = routeOf(answered);
|
|
16791
17033
|
if (options.json) {
|
|
16792
17034
|
process.stdout.write(`${JSON.stringify(made, null, 2)}
|
|
16793
17035
|
`);
|
|
@@ -16802,7 +17044,31 @@ async function site(client, positionals, options) {
|
|
|
16802
17044
|
process.stdout.write(`${made.url}
|
|
16803
17045
|
`);
|
|
16804
17046
|
process.stderr.write(
|
|
16805
|
-
`
|
|
17047
|
+
made.access === "organization" ? `Only your organization's people, signed in to agental, and keys with site.open in X-Agental-Key can open port ${port}, at every link it has. The server must listen on 0.0.0.0. agental site rm ${sandbox} ${made.id} takes it away.
|
|
17048
|
+
` : `Anyone with the link can open port ${port} while the sandbox runs. The server must listen on 0.0.0.0. agental site rm ${sandbox} ${made.id} takes it away.
|
|
17049
|
+
`
|
|
17050
|
+
);
|
|
17051
|
+
return;
|
|
17052
|
+
}
|
|
17053
|
+
case "access": {
|
|
17054
|
+
const [who] = rest;
|
|
17055
|
+
if (target === void 0 || who !== "anyone" && who !== "organization" || rest.length > 1) {
|
|
17056
|
+
throw new Error(`site access needs the sandbox, the site's id, and anyone or organization: agental site access ${sandbox} rte_\u2026 organization.`);
|
|
17057
|
+
}
|
|
17058
|
+
const found = await siteOn(client, sandbox, target);
|
|
17059
|
+
if (who === "anyone" && found.access === "organization" && !options.yes && !await client.confirmed(`Open ${found.url ?? target} to anyone with the link? The app on port ${found.port} is then used with no sign-in, and everyone signed in to it is signed out.`)) {
|
|
17060
|
+
process.stdout.write("Nothing was changed.\n");
|
|
17061
|
+
return;
|
|
17062
|
+
}
|
|
17063
|
+
const changed = routeOf(await ask13(client, "PUT", `/v1/host-routes/${encodeURIComponent(target)}/access`, { access: who }));
|
|
17064
|
+
if (options.json) {
|
|
17065
|
+
process.stdout.write(`${JSON.stringify(changed, null, 2)}
|
|
17066
|
+
`);
|
|
17067
|
+
return;
|
|
17068
|
+
}
|
|
17069
|
+
process.stdout.write(
|
|
17070
|
+
who === "organization" ? `${changed.url ?? target} is private now, at every address of port ${changed.port}: only your organization's people, signed in, and keys with site.open open it.
|
|
17071
|
+
` : `${changed.url ?? target} is open to anyone with the link now, at every address of port ${changed.port}.
|
|
16806
17072
|
`
|
|
16807
17073
|
);
|
|
16808
17074
|
return;
|
|
@@ -17720,7 +17986,10 @@ async function main() {
|
|
|
17720
17986
|
unlink: { type: "string" },
|
|
17721
17987
|
expires: { type: "string" },
|
|
17722
17988
|
"keep-streams": { type: "boolean" },
|
|
17989
|
+
// Pause's earlier spelling, on stop and on jobs: kept only to say what replaced it (docs/pause-resume.md, 4).
|
|
17723
17990
|
"keep-memory": { type: "boolean" },
|
|
17991
|
+
// agental job create and job update: a run that started the sandbox pauses it again after.
|
|
17992
|
+
"pause-after": { type: "boolean" },
|
|
17724
17993
|
"without-memory": { type: "boolean" },
|
|
17725
17994
|
// agental delete and template delete: delete a sandbox that jobs run in, or a template they make their sandboxes from, and pause them.
|
|
17726
17995
|
"pause-jobs": { type: "boolean" },
|
|
@@ -17827,10 +18096,18 @@ async function main() {
|
|
|
17827
18096
|
// 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.
|
|
17828
18097
|
over: { type: "string" },
|
|
17829
18098
|
month: { type: "string" },
|
|
18099
|
+
// agental server add and token: the disk for sandboxes, put in the install line.
|
|
18100
|
+
disk: { type: "string" },
|
|
18101
|
+
// agental servers window: the weekly window the organization's servers take a new agent in, with --tz and --off.
|
|
18102
|
+
day: { type: "string" },
|
|
18103
|
+
hour: { type: "string" },
|
|
18104
|
+
hours: { type: "string" },
|
|
17830
18105
|
// agental site stats: 24h or 7d.
|
|
17831
18106
|
range: { type: "string" },
|
|
17832
18107
|
// agental site analytics org on: the person has read what is kept.
|
|
17833
18108
|
informed: { type: "boolean", default: false },
|
|
18109
|
+
// agental site add: only the organization opens it.
|
|
18110
|
+
private: { type: "boolean", default: false },
|
|
17834
18111
|
sort: { type: "string" },
|
|
17835
18112
|
role: { type: "string" },
|
|
17836
18113
|
// Guilds: the roles of a create or an attach, its brief and form, and who joins with what answers.
|
|
@@ -17869,6 +18146,11 @@ async function main() {
|
|
|
17869
18146
|
}
|
|
17870
18147
|
});
|
|
17871
18148
|
const command3 = positionals[0];
|
|
18149
|
+
if (values["keep-memory"] !== void 0) {
|
|
18150
|
+
throw new Error(
|
|
18151
|
+
command3 === "job" ? "--keep-memory is now --pause-after: a run that started the sandbox pauses it again after, keeping its memory." : "--keep-memory is gone: agental pause <sandbox-id> keeps a sandbox's memory, and agental resume <sandbox-id> carries on from it."
|
|
18152
|
+
);
|
|
18153
|
+
}
|
|
17872
18154
|
if (!command3) {
|
|
17873
18155
|
process.stdout.write(isTerminal(process.stdout) ? shortHelp() : await helpText());
|
|
17874
18156
|
return;
|
|
@@ -17931,10 +18213,30 @@ async function main() {
|
|
|
17931
18213
|
return;
|
|
17932
18214
|
case "stop":
|
|
17933
18215
|
if (values.where !== void 0) {
|
|
17934
|
-
await bulk("stop", whereQuery(values.where, labelsFilter(values)),
|
|
18216
|
+
await bulk("stop", whereQuery(values.where, labelsFilter(values)), {}, values.yes === true, values.json);
|
|
18217
|
+
return;
|
|
18218
|
+
}
|
|
18219
|
+
await lifecycle("stop", positionals[1]);
|
|
18220
|
+
return;
|
|
18221
|
+
case "pause":
|
|
18222
|
+
if (values.where !== void 0 && positionals[1] !== void 0) {
|
|
18223
|
+
throw new Error("pause takes a sandbox's ID or --where, not both");
|
|
18224
|
+
}
|
|
18225
|
+
if (values.where !== void 0) {
|
|
18226
|
+
await bulk("stop", whereQuery(values.where, labelsFilter(values)), { keepMemory: true }, values.yes === true, values.json, void 0, "Pause");
|
|
17935
18227
|
return;
|
|
17936
18228
|
}
|
|
17937
|
-
await lifecycle("
|
|
18229
|
+
await lifecycle("pause", positionals[1]);
|
|
18230
|
+
return;
|
|
18231
|
+
case "resume":
|
|
18232
|
+
if (values.where !== void 0 && positionals[1] !== void 0) {
|
|
18233
|
+
throw new Error("resume takes a sandbox's ID or --where, not both");
|
|
18234
|
+
}
|
|
18235
|
+
if (values.where !== void 0) {
|
|
18236
|
+
await bulk("start", pausedOnly(whereQuery(values.where, labelsFilter(values))), {}, values.yes === true, values.json, void 0, "Resume");
|
|
18237
|
+
return;
|
|
18238
|
+
}
|
|
18239
|
+
await lifecycle("resume", positionals[1], maxBurstFeeHeaders(values["max-burst-fee"]));
|
|
17938
18240
|
return;
|
|
17939
18241
|
case "recover":
|
|
17940
18242
|
await lifecycle("recover", positionals[1], maxBurstFeeHeaders(values["max-burst-fee"]));
|
|
@@ -17993,7 +18295,7 @@ async function main() {
|
|
|
17993
18295
|
await browser(positionals[1], values.headless, values.headed, values.off, values.status);
|
|
17994
18296
|
return;
|
|
17995
18297
|
case "site":
|
|
17996
|
-
await site({ request, fail, confirmed }, positionals.slice(1), { json: values.json, range: values.range, yes: values.yes === true, informed: values.informed === true });
|
|
18298
|
+
await site({ request, fail, confirmed }, positionals.slice(1), { json: values.json, range: values.range, yes: values.yes === true, informed: values.informed === true, private: values.private === true });
|
|
17997
18299
|
return;
|
|
17998
18300
|
case "network":
|
|
17999
18301
|
await network(positionals.slice(1), values);
|
|
@@ -18022,6 +18324,7 @@ async function main() {
|
|
|
18022
18324
|
...values.role === void 0 ? {} : { role: values.role },
|
|
18023
18325
|
...values.brief === void 0 ? {} : { brief: values.brief },
|
|
18024
18326
|
...values.form === void 0 ? {} : { form: values.form },
|
|
18327
|
+
...values.template === void 0 ? {} : { template: values.template },
|
|
18025
18328
|
...values.as === void 0 ? {} : { as: values.as },
|
|
18026
18329
|
...values.answer === void 0 ? {} : { answer: values.answer },
|
|
18027
18330
|
...values.to === void 0 ? {} : { to: values.to },
|
|
@@ -18196,8 +18499,8 @@ async function create(values) {
|
|
|
18196
18499
|
const burstHeaders = maxBurstFeeHeaders(values["max-burst-fee"]);
|
|
18197
18500
|
const ttlSeconds = ttlOption(values.ttl);
|
|
18198
18501
|
const onTimeout = values["on-timeout"];
|
|
18199
|
-
if (onTimeout !== void 0 && onTimeout !== "delete" && onTimeout !== "stop" && onTimeout !== "
|
|
18200
|
-
throw new Error("--on-timeout is delete, stop or
|
|
18502
|
+
if (onTimeout !== void 0 && onTimeout !== "delete" && onTimeout !== "stop" && onTimeout !== "pause") {
|
|
18503
|
+
throw new Error("--on-timeout is delete, stop or pause: what the sandbox's time limit does when it runs out");
|
|
18201
18504
|
}
|
|
18202
18505
|
if (values.size !== void 0 && !isMachineSize(values.size)) {
|
|
18203
18506
|
throw new Error("--size must be tiny, small, medium, large or xlarge");
|
|
@@ -18248,9 +18551,9 @@ async function create(values) {
|
|
|
18248
18551
|
...allow ? { network: { allow } } : {},
|
|
18249
18552
|
...egressAsked ? { egress: egressAsked } : {},
|
|
18250
18553
|
...tailnetAsked === void 0 ? {} : { tailnet: tailnetAsked },
|
|
18251
|
-
...values.guild === void 0 ? {} : { guilds: values.guild.map(
|
|
18554
|
+
...values.guild === void 0 ? {} : { guilds: values.guild.map(guildAsked2) },
|
|
18252
18555
|
...ttlSeconds === void 0 ? {} : { ttlSeconds },
|
|
18253
|
-
...onTimeout === void 0 ? {} : { onTimeout
|
|
18556
|
+
...onTimeout === void 0 ? {} : { onTimeout },
|
|
18254
18557
|
...spotAsked === void 0 ? {} : { spot: spotAsked },
|
|
18255
18558
|
...sshKeys2 === void 0 ? {} : { sshKeys: sshKeys2 },
|
|
18256
18559
|
...given
|
|
@@ -18579,14 +18882,23 @@ async function confirmed(question) {
|
|
|
18579
18882
|
lines.close();
|
|
18580
18883
|
}
|
|
18581
18884
|
}
|
|
18582
|
-
|
|
18885
|
+
function pausedOnly(filter) {
|
|
18886
|
+
const statuses = filter.getAll("status");
|
|
18887
|
+
if (statuses.some((status) => status !== "paused")) {
|
|
18888
|
+
throw new Error("resume --where finds the paused sandboxes its words name: leave other statuses out of the words, and say archived:true for the archived ones.");
|
|
18889
|
+
}
|
|
18890
|
+
filter.delete("status");
|
|
18891
|
+
filter.append("status", "paused");
|
|
18892
|
+
return filter;
|
|
18893
|
+
}
|
|
18894
|
+
async function bulk(action, filter, options, yes2, asJson, confirm, word) {
|
|
18583
18895
|
const previewed = await request("/v1/bulk-actions/preview", { method: "POST", body: JSON.stringify({ action, options, select: { filter: filterOf(filter) } }) });
|
|
18584
18896
|
const preview = await readBody(previewed);
|
|
18585
18897
|
if (!previewed.ok) {
|
|
18586
18898
|
fail(previewed.status, preview);
|
|
18587
18899
|
}
|
|
18588
18900
|
const read2 = preview;
|
|
18589
|
-
process.stderr.write(`${action === "stop" ? "Stop" : action === "start" ? "Start" : "Delete"} ${read2.count} ${read2.count === 1 ? "sandbox" : "sandboxes"}: ${read2.sample.map((each) => each.name).join(", ")}${read2.count > read2.sample.length ? `, and ${read2.count - read2.sample.length} more` : ""}.
|
|
18901
|
+
process.stderr.write(`${word ?? (action === "stop" ? "Stop" : action === "start" ? "Start" : "Delete")} ${read2.count} ${read2.count === 1 ? "sandbox" : "sandboxes"}: ${read2.sample.map((each) => each.name).join(", ")}${read2.count > read2.sample.length ? `, and ${read2.count - read2.sample.length} more` : ""}.
|
|
18590
18902
|
`);
|
|
18591
18903
|
process.stderr.write(`They cost ${dollarsOf(read2.microsPerHour.now)} an hour now, and ${dollarsOf(read2.microsPerHour.after)} an hour after.
|
|
18592
18904
|
`);
|
|
@@ -18731,8 +19043,8 @@ async function lifecycle(action, id, headers = {}, sent) {
|
|
|
18731
19043
|
process.stderr.write(`Starting ${id} from its disk. The memory it was stopped with is let go for good: its files are kept, and the programs that ran in it are not.
|
|
18732
19044
|
`);
|
|
18733
19045
|
}
|
|
18734
|
-
if (
|
|
18735
|
-
process.stderr.write(`
|
|
19046
|
+
if (action === "pause") {
|
|
19047
|
+
process.stderr.write(`Pausing ${id} with its memory kept. It ends once the memory is written, about a second for every 2 to 3 GiB.
|
|
18736
19048
|
`);
|
|
18737
19049
|
}
|
|
18738
19050
|
const response = await request(`/v1/sandboxes/${encodeURIComponent(id)}/${action}`, { method: "POST", headers, ...sent === void 0 ? {} : { body: JSON.stringify(sent) } });
|
|
@@ -18741,21 +19053,21 @@ async function lifecycle(action, id, headers = {}, sent) {
|
|
|
18741
19053
|
fail(response.status, body);
|
|
18742
19054
|
}
|
|
18743
19055
|
sayBurstFee(response);
|
|
18744
|
-
if (action === "stop" && response.status === 202) {
|
|
18745
|
-
body = await stoppedAfter(id, response.headers.get("operation-id"));
|
|
19056
|
+
if ((action === "stop" || action === "pause") && response.status === 202) {
|
|
19057
|
+
body = await stoppedAfter(id, response.headers.get("operation-id"), action === "pause" ? "pause" : "stop");
|
|
18746
19058
|
}
|
|
18747
19059
|
process.stdout.write(`${JSON.stringify(body, null, 2)}
|
|
18748
19060
|
`);
|
|
18749
19061
|
const memoryLost = Boolean(body) && typeof body === "object" ? body["memoryLost"] : null;
|
|
18750
|
-
if (typeof memoryLost === "string" && memoryLost !== "" && (action === "start" ||
|
|
19062
|
+
if (typeof memoryLost === "string" && memoryLost !== "" && (action === "start" || action === "resume" || action === "pause")) {
|
|
18751
19063
|
process.stderr.write(`${memoryLost}
|
|
18752
19064
|
`);
|
|
18753
19065
|
}
|
|
18754
|
-
if (action === "start" && response.status === 202) {
|
|
19066
|
+
if ((action === "start" || action === "resume") && response.status === 202) {
|
|
18755
19067
|
const archived = Boolean(body) && typeof body === "object" && body["archived"] === true;
|
|
18756
19068
|
const why2 = archived ? "it is archived and is being brought back, which takes as long as its disk is large" : "its machine was being archived, and is started as soon as that has ended";
|
|
18757
19069
|
process.stderr.write(
|
|
18758
|
-
|
|
19070
|
+
`${action === "resume" ? "Resume" : "Start"} was accepted. ${id} is restoring: ${why2}. It is running when agental list says so. If list shows it ${action === "resume" ? "paused" : "stopped"} again, the ${action} failed, and agental list --json has its error.
|
|
18759
19071
|
`
|
|
18760
19072
|
);
|
|
18761
19073
|
}
|
|
@@ -18817,8 +19129,10 @@ function sizeOf2(sandbox) {
|
|
|
18817
19129
|
const size2 = typeof sandbox["size"] === "string" ? sandbox["size"] : "";
|
|
18818
19130
|
return typeof sandbox["pendingSize"] === "string" ? `${size2} (${sandbox["pendingSize"]} from its next start)` : size2;
|
|
18819
19131
|
}
|
|
18820
|
-
async function stoppedAfter(id, operationId) {
|
|
18821
|
-
|
|
19132
|
+
async function stoppedAfter(id, operationId, word = "stop") {
|
|
19133
|
+
const done2 = word === "pause" ? "paused" : "stopped";
|
|
19134
|
+
process.stderr.write(`Still writing its memory. Waiting until it has ${done2}.
|
|
19135
|
+
`);
|
|
18822
19136
|
const deadline = Date.now() + 6e5;
|
|
18823
19137
|
for (; ; ) {
|
|
18824
19138
|
const sandbox = await call2(`/v1/sandboxes/${encodeURIComponent(id)}`, { method: "GET" });
|
|
@@ -18828,11 +19142,11 @@ async function stoppedAfter(id, operationId) {
|
|
|
18828
19142
|
if (operationId !== null) {
|
|
18829
19143
|
const { operation } = await call2(`/v1/operations/${encodeURIComponent(operationId)}`, { method: "GET" });
|
|
18830
19144
|
if (operation.status === "failed") {
|
|
18831
|
-
throw new Error(`${id} was not
|
|
19145
|
+
throw new Error(`${id} was not ${done2}: ${operation.error ?? `the ${word} failed`}`);
|
|
18832
19146
|
}
|
|
18833
19147
|
}
|
|
18834
19148
|
if (Date.now() > deadline) {
|
|
18835
|
-
throw new Error(`${id} was still writing its memory after ten minutes. The
|
|
19149
|
+
throw new Error(`${id} was still writing its memory after ten minutes. The ${word} goes on: agental list says when it has ${done2}.`);
|
|
18836
19150
|
}
|
|
18837
19151
|
await new Promise((resolve) => setTimeout(resolve, 3e3));
|
|
18838
19152
|
}
|
|
@@ -20949,7 +21263,7 @@ function boxNamed(value) {
|
|
|
20949
21263
|
}
|
|
20950
21264
|
return value?.trim();
|
|
20951
21265
|
}
|
|
20952
|
-
function
|
|
21266
|
+
function guildAsked2(given) {
|
|
20953
21267
|
const colon = given.indexOf(":");
|
|
20954
21268
|
if (colon === -1) {
|
|
20955
21269
|
return { guild: given.trim() };
|
|
@@ -21092,7 +21406,7 @@ Setting up
|
|
|
21092
21406
|
agental completion zsh|bash|fish
|
|
21093
21407
|
|
|
21094
21408
|
Usage
|
|
21095
|
-
agental create [--name <name>] [--template <template>] [--snapshot <snapshot-id> | --image <image>] [--size tiny|small|medium|large|xlarge] [--region <region>[,<region>...]] [--ttl <time> | --ttl default] [--on-timeout delete|stop|
|
|
21409
|
+
agental create [--name <name>] [--template <template>] [--snapshot <snapshot-id> | --image <image>] [--size tiny|small|medium|large|xlarge] [--region <region>[,<region>...]] [--ttl <time> | --ttl default] [--on-timeout delete|stop|pause] [--idempotency-key <key>]
|
|
21096
21410
|
[--spot [--on-reclaim delete|stop] [--warn-at <chance>] | --standard]
|
|
21097
21411
|
${operator ? "[--box <name-or-id>] " : ""}[--allow <address>[,<address>...]] [--egress box | residential:<country>[:sticky|rotating]] [--max-burst-fee <dollars>]
|
|
21098
21412
|
[--ssh-key <public-key-or-file>]... [--tag <tag>[,<tag>...]]... [--meta <key>=<value>]...
|
|
@@ -21116,8 +21430,12 @@ Usage
|
|
|
21116
21430
|
agental shell <sandbox-id> --close <shell> end a kept shell
|
|
21117
21431
|
agental delete <sandbox-id>
|
|
21118
21432
|
agental start <sandbox-id> [--max-burst-fee <dollars>] [--without-memory]
|
|
21119
|
-
agental stop <sandbox-id>
|
|
21120
|
-
agental
|
|
21433
|
+
agental stop <sandbox-id>
|
|
21434
|
+
agental pause <sandbox-id> stop it with its memory kept, to resume where it was
|
|
21435
|
+
agental resume <sandbox-id> [--max-burst-fee <dollars>]
|
|
21436
|
+
agental pause --where '<words>' [--yes]
|
|
21437
|
+
agental resume --where '<words>' [--yes] the paused sandboxes the words find
|
|
21438
|
+
agental stop --where '<words>' [--yes] every sandbox the words find, as one bulk action
|
|
21121
21439
|
agental start --where '<words>' [--yes]
|
|
21122
21440
|
agental delete --where '<words>' [--confirm <count>] asks for the count to be typed
|
|
21123
21441
|
agental bulk-actions [list | show <id> | cancel <id>] [--json]
|
|
@@ -21162,7 +21480,7 @@ Usage
|
|
|
21162
21480
|
agental data-retention [1 | 7 | 30 | 90 | never] [--json]
|
|
21163
21481
|
agental jobs [--sandbox <sandbox-id> | --template <template>] [--json]
|
|
21164
21482
|
agental job add [<name>] --sandbox <sandbox-id> [--every 1m|15m|1h|1d | --cron "<m h dom mon dow>" [--tz <zone>] | --at <date-time>] [--timeout <time>]
|
|
21165
|
-
[--if-stopped start|skip] [--
|
|
21483
|
+
[--if-stopped start|skip] [--pause-after | --delete-after] [--overlap skip|replace|parallel] [--retries <0-5>] [--alerts email|webhook|both|none]
|
|
21166
21484
|
[--max-monthly-spend <dollars>]
|
|
21167
21485
|
[--input <NAME>[=<default>]]... [--secret-input <NAME>[=<default>]]... [--after-job <job>[:succeeded|failed]]... [--on-mail <sandbox>]... [--on-guild-request <guild>:<identity>]...
|
|
21168
21486
|
[--json] -- <command> [args...]
|
|
@@ -21173,7 +21491,7 @@ Usage
|
|
|
21173
21491
|
agental job list [--sandbox <sandbox-id> | --template <template>] [--json]
|
|
21174
21492
|
agental job get|delete|pause|resume <job> [--json]
|
|
21175
21493
|
agental job update <job> [--sandbox <sandbox-id> | --template <template> [--size <size>]] [--keep-failed-for <time>] [--every <time> | --cron "<expr>" | --at <date-time>] [--tz <zone>]
|
|
21176
|
-
[--name <name>] [--timeout <time>] [--if-stopped start|skip] [--
|
|
21494
|
+
[--name <name>] [--timeout <time>] [--if-stopped start|skip] [--pause-after | --delete-after | --disk-only] [--overlap skip|replace|parallel]
|
|
21177
21495
|
[--retries <0-5>] [--alerts email|webhook|both|none] [--max-monthly-spend <dollars>|none] [--input <NAME>[=<default>]]... [--secret-input <NAME>[=<default>]]...
|
|
21178
21496
|
[--after-job <job>[:succeeded|failed]]... [--on-mail <sandbox>]... [--on-guild-request <guild>:<identity>]... [--no-events] [--json] [-- <command> [args...]]
|
|
21179
21497
|
agental job run <job> [--input <NAME>=<value>]... [--wait[=<seconds>]] [--json]
|
|
@@ -21209,11 +21527,13 @@ Usage
|
|
|
21209
21527
|
agental webhook delete <webhook-id>
|
|
21210
21528
|
agental servers [--json]
|
|
21211
21529
|
agental servers offload [on|off] [--over <percent>] [--json]
|
|
21530
|
+
agental servers window [--day <day> --hour <0-23> --tz <zone> [--hours <1-12>] | --off] [--json]
|
|
21212
21531
|
agental servers core-days [--month <yyyy-mm>] [--json]
|
|
21213
|
-
agental
|
|
21532
|
+
agental servers key-lost <key-id> [--yes] [--json] an organization key gone for good: its archives are lost
|
|
21533
|
+
agental server add <label> [--disk <device>] [--json] its install line and join token, shown once
|
|
21214
21534
|
agental server show <server> [--json]
|
|
21215
21535
|
agental server readings <server> [--since <date-time>] [--until <date-time>] [--every 1|5|15|60] [--json]
|
|
21216
|
-
agental server token <server> [--json]
|
|
21536
|
+
agental server token <server> [--disk <device>] [--json] a new join token; the old one stops at once
|
|
21217
21537
|
agental server drain <server> [--json]
|
|
21218
21538
|
agental server open <server> [--json] takes new sandboxes again after a drain
|
|
21219
21539
|
agental server gone <server> --reason <text> [--yes] [--json] cannot be undone
|
|
@@ -21249,10 +21569,11 @@ ${FILES_USAGE.map((line) => ` ${line}`).join("\n")}
|
|
|
21249
21569
|
agental ssh-config <sandbox-id>
|
|
21250
21570
|
agental ssh-keys <sandbox-id> [--remove <key-id>] [--json]
|
|
21251
21571
|
agental ssh-off <sandbox-id>
|
|
21252
|
-
agental site <sandbox-id> [--json] its sites:
|
|
21572
|
+
agental site <sandbox-id> [--json] its sites: links to its ports, and who may open each
|
|
21253
21573
|
agental site list <sandbox-id> [--json]
|
|
21254
|
-
agental site add <sandbox-id> <port> [--json]
|
|
21574
|
+
agental site add <sandbox-id> <port> [--private] [--json] a link to a port, printed; --private: your organization only
|
|
21255
21575
|
agental site rm <sandbox-id> <site-id> the link stops working, for good
|
|
21576
|
+
agental site access <sandbox-id> <site-id> anyone|organization [--json] who may open it
|
|
21256
21577
|
agental site stats <sandbox-id> <site-id> [--range 24h|7d] [--json] its visits, pages, sources, countries
|
|
21257
21578
|
agental site analytics on|off <sandbox-id> <site-id> [--yes] [--json] off deletes its figures
|
|
21258
21579
|
agental site analytics org [on|off] [--informed] [--yes] [--json] the organization's switch
|
|
@@ -21300,17 +21621,17 @@ next start boots it at it. A running one keeps running, and paying, as its size
|
|
|
21300
21621
|
stopped, and its next start gives it the new one, whoever starts it; --now stops it and starts it
|
|
21301
21622
|
again at the new size now, and every process in it ends, as on a stop. --cancel takes a size that
|
|
21302
21623
|
waits away. Memory a stop kept is let go: the next start boots from the disk. While a size waits,
|
|
21303
|
-
|
|
21624
|
+
pause is refused.
|
|
21304
21625
|
recover gets a sandbox that is stuck going again: what runs in it is killed, its disk is kept,
|
|
21305
21626
|
and it ends running. One that is stopped is started, and pays a burst fee as a start does.
|
|
21306
21627
|
Start of a sandbox that was archived is accepted and finished afterwards: list shows it as
|
|
21307
21628
|
restoring, and as running when it runs.
|
|
21308
|
-
A sandbox runs until it is stopped, unless it has a time limit: then
|
|
21629
|
+
A sandbox runs until it is stopped, unless it has a time limit: then its time limit runs out once it has
|
|
21309
21630
|
run that long since its last start. create --ttl and template start --ttl set one, as 45m, 2h or
|
|
21310
21631
|
1d, and --ttl default takes the deployment's, which is none unless it says otherwise. When the
|
|
21311
21632
|
time limit runs out the sandbox is deleted, with its disk, unless create --on-timeout stop said to
|
|
21312
|
-
stop it and keep its disk, or --on-timeout
|
|
21313
|
-
|
|
21633
|
+
stop it and keep its disk, or --on-timeout pause to keep its memory too, so agental resume
|
|
21634
|
+
carries on where it was (after the account's first top-up: before it, refused with
|
|
21314
21635
|
memory_needs_top_up); agental stop always keeps the disk. auto-stop
|
|
21315
21636
|
says when a running sandbox is to be stopped, with --in or --at moves that stop, later or sooner,
|
|
21316
21637
|
for the run under way, and with --never takes its time limit away, for this run and the next.
|
|
@@ -21424,8 +21745,8 @@ or 1d, counted from now, never more often than every minute, or --cron with five
|
|
|
21424
21745
|
time zone --tz names, UTC unless it does, says when; --at a date and time runs it once. With none
|
|
21425
21746
|
of them it runs only when asked, by job run. Its name is lower-case letters, digits and dashes,
|
|
21426
21747
|
job-1, job-2 and so on when none is given. When a run finds the sandbox stopped it starts it,
|
|
21427
|
-
runs, and stops it again when the command ends, keeping its disk, or
|
|
21428
|
-
--
|
|
21748
|
+
runs, and stops it again when the command ends, keeping its disk, or pauses it with
|
|
21749
|
+
--pause-after; with --if-stopped skip it runs only while the sandbox runs. A sandbox someone
|
|
21429
21750
|
started again, sent a command or moved the stop of meanwhile is left running. With --at,
|
|
21430
21751
|
--delete-after deletes the sandbox after the run, if the command exits 0, with a key that may
|
|
21431
21752
|
delete it; a run that fails leaves it to be looked at, and update --disk-only takes it back.
|
|
@@ -21512,17 +21833,25 @@ disconnect forgets the key and claims no more of its work.
|
|
|
21512
21833
|
servers lists your organization's own servers, on the Enterprise plan: each one's state, whether
|
|
21513
21834
|
its agent is heard from, its cores and the sandboxes on it. Only an owner or an admin manages them.
|
|
21514
21835
|
server add <label> adds one by your own name for it, and prints the line to run as root on it and
|
|
21515
|
-
the one-time token in that line, shown this once; it needs an Enterprise contract in force.
|
|
21836
|
+
the one-time token in that line, shown this once; it needs an Enterprise contract in force. --disk
|
|
21837
|
+
names the disk for sandboxes in the line, as /dev/nvme1n1, which has to hold nothing. token
|
|
21516
21838
|
gives a server that has not joined a new token, and the old one stops working. A <server> is its id
|
|
21517
21839
|
or its label. show says how it stands; readings is its memory, CPU and disk over the last day, a
|
|
21518
21840
|
line an hour unless --every says otherwise, noting the times it did not answer. drain takes it out
|
|
21519
|
-
of placement
|
|
21841
|
+
of placement; where the server has a bucket of your own set, its stopped sandboxes are archived to it, to come back on
|
|
21842
|
+
another of your servers, and show says which stay and why. open puts it back. remove removes one that holds nothing and prints the line
|
|
21520
21843
|
that takes its agent off. gone says a server is gone for good, once it is drained and its agent has
|
|
21521
21844
|
been away 24 hours: its sandboxes are said lost, and it cannot be undone, so it asks first unless
|
|
21522
21845
|
--yes, and --reason says why. servers offload says whether a new sandbox that names no region
|
|
21523
21846
|
starts on agental's servers when none of yours has room under --over percent of its memory, CPU
|
|
21524
21847
|
and disk (80 to begin with); on and off turn it on and off. Such a sandbox is a hosted one, billed as
|
|
21525
|
-
one, from your credits. servers
|
|
21848
|
+
one, from your credits. servers window says, and sets, the weekly window in which your servers take
|
|
21849
|
+
a new agent: --day, --hour on the clock of --tz (an IANA zone, as Europe/Berlin) and --hours (4 to
|
|
21850
|
+
begin with); --off has them take one at once. A security release reaches them outside it too.
|
|
21851
|
+
servers core-days is the month's cores as they are counted for billing, day by day.
|
|
21852
|
+
servers key-lost says an organization key of your own bucket is lost for good: every archive sealed under it
|
|
21853
|
+
is then said lost, since nobody, agental included, can open it. It asks first unless --yes, and is refused while
|
|
21854
|
+
a server of yours still holds the key.
|
|
21526
21855
|
org lists the organizations you are in, your own and your teams, and marks the one this command
|
|
21527
21856
|
acts in. A key acts in the organization it was made in, for good, so org use signs in again in
|
|
21528
21857
|
the browser for a key made in the one given, by its id or name, and deletes the key the command
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agental",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.73.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",
|