agental 0.64.0 → 0.71.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 +452 -142
- 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.71.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}`;
|
|
@@ -7923,6 +7923,7 @@ var KEY_ACTIONS = [
|
|
|
7923
7923
|
"ssh",
|
|
7924
7924
|
"desktop",
|
|
7925
7925
|
"host",
|
|
7926
|
+
"site.open",
|
|
7926
7927
|
"network.write",
|
|
7927
7928
|
"secret.read",
|
|
7928
7929
|
"secret.write",
|
|
@@ -9445,7 +9446,7 @@ var COMMANDS = [
|
|
|
9445
9446
|
["-t, --template <template>", "what it starts from (default: your default template)"],
|
|
9446
9447
|
[" --snapshot <snapshot-id>", "start it from this snapshot's disk"],
|
|
9447
9448
|
[" --image <image>[@<build>]", "start it from your image: its newest ready build, or that build"],
|
|
9448
|
-
["-s, --size <size>", "tiny, small, medium or
|
|
9449
|
+
["-s, --size <size>", "tiny, small, medium, large or xlarge (default: the template's)"],
|
|
9449
9450
|
[" --region <region>", "where it runs; agental regions lists them"],
|
|
9450
9451
|
[" --ttl <time>", "stop it after this long, as 30m or 2h"],
|
|
9451
9452
|
[" --allow <addresses>", "reach only these addresses, comma-separated"],
|
|
@@ -9542,19 +9543,22 @@ var COMMANDS = [
|
|
|
9542
9543
|
{ name: "ssh-off", summary: "Turn SSH off for a sandbox and close its port." },
|
|
9543
9544
|
{
|
|
9544
9545
|
name: "site",
|
|
9545
|
-
summary: "List, add and remove a sandbox's sites,
|
|
9546
|
+
summary: "List, add and remove a sandbox's sites, links to its ports, choose who may open each, and see their visits.",
|
|
9546
9547
|
examples: [
|
|
9547
9548
|
"agental site sbx_2a9a47e50daec64a",
|
|
9548
9549
|
"agental site add sbx_2a9a47e50daec64a 3000",
|
|
9550
|
+
"agental site add sbx_2a9a47e50daec64a 5173 --private",
|
|
9551
|
+
"agental site access sbx_2a9a47e50daec64a rte_0123456789abcdef organization",
|
|
9549
9552
|
"agental site rm sbx_2a9a47e50daec64a rte_0123456789abcdef",
|
|
9550
9553
|
"agental site stats sbx_2a9a47e50daec64a rte_0123456789abcdef --range 24h",
|
|
9551
9554
|
"agental site analytics off sbx_2a9a47e50daec64a rte_0123456789abcdef",
|
|
9552
9555
|
"agental site analytics org"
|
|
9553
9556
|
],
|
|
9554
9557
|
flags: [
|
|
9555
|
-
["--json", "list, add, stats, analytics: print as JSON"],
|
|
9558
|
+
["--json", "list, add, access, stats, analytics: print as JSON"],
|
|
9559
|
+
["--private", "add: only your organization's people, signed in, and keys with site.open may open it"],
|
|
9556
9560
|
["--range <24h|7d>", "stats: the last 24 hours, or 7 days, the default"],
|
|
9557
|
-
["--yes", "analytics off: delete the figures without asking"],
|
|
9561
|
+
["--yes", "analytics off: delete the figures without asking; access anyone: open a private site without asking"],
|
|
9558
9562
|
["--informed", "analytics org on: you have read what is kept, on Enterprise or with your own server"]
|
|
9559
9563
|
]
|
|
9560
9564
|
},
|
|
@@ -9572,13 +9576,31 @@ var COMMANDS = [
|
|
|
9572
9576
|
{
|
|
9573
9577
|
name: "stop",
|
|
9574
9578
|
summary: "Stop a sandbox, or every one --where finds. Its disk is kept.",
|
|
9575
|
-
examples: ["agental stop sbx_2a9a47e50daec64a", "agental stop
|
|
9579
|
+
examples: ["agental stop sbx_2a9a47e50daec64a", "agental stop --where 'bench'"],
|
|
9576
9580
|
flags: [
|
|
9577
|
-
["--keep-memory", "keep what runs in memory too, so it carries on from where it was"],
|
|
9578
9581
|
["--where '<words>'", "every sandbox the words find, as one bulk action"],
|
|
9579
9582
|
["--yes", "with --where: stop them without asking"]
|
|
9580
9583
|
]
|
|
9581
9584
|
},
|
|
9585
|
+
{
|
|
9586
|
+
name: "pause",
|
|
9587
|
+
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.",
|
|
9588
|
+
examples: ["agental pause sbx_2a9a47e50daec64a", "agental pause --where 'bench'"],
|
|
9589
|
+
flags: [
|
|
9590
|
+
["--where '<words>'", "every sandbox the words find, as one bulk action"],
|
|
9591
|
+
["--yes", "with --where: pause them without asking"]
|
|
9592
|
+
]
|
|
9593
|
+
},
|
|
9594
|
+
{
|
|
9595
|
+
name: "resume",
|
|
9596
|
+
summary: "Resume a paused sandbox, or every paused one --where finds: every process carries on where it was.",
|
|
9597
|
+
examples: ["agental resume sbx_2a9a47e50daec64a", "agental resume --where 'bench'"],
|
|
9598
|
+
flags: [
|
|
9599
|
+
["--where '<words>'", "every paused sandbox the words find, as one bulk action"],
|
|
9600
|
+
["--yes", "with --where: resume them without asking"],
|
|
9601
|
+
["--max-burst-fee <dollars>", "the most this resume of one sandbox may pay in burst fees"]
|
|
9602
|
+
]
|
|
9603
|
+
},
|
|
9582
9604
|
{
|
|
9583
9605
|
name: "delete",
|
|
9584
9606
|
summary: "Delete a sandbox, or every one --where finds. It cannot be undone.",
|
|
@@ -9629,7 +9651,8 @@ var COMMANDS = [
|
|
|
9629
9651
|
summary: "Set up a guild, where agents work together under identities of its design, or join one as an agent.",
|
|
9630
9652
|
usage: [
|
|
9631
9653
|
"agental guild [list] | show <guild> | delete <guild> [--yes]",
|
|
9632
|
-
"agental guild
|
|
9654
|
+
"agental guild plan <guild> --roles <name[:seats],...> [--brief <text>] [--form <file.json>] [--template <template[:role,...]>]...",
|
|
9655
|
+
"agental guild create <guild> --roles <name[:seats],...> [--brief <text>] [--form <file.json>] [--template <template[:role,...]>]...",
|
|
9633
9656
|
"agental guild attach <guild> <template|sandbox> [--roles <role,...>] | detach <guild> <template|sandbox>",
|
|
9634
9657
|
"agental guild mine",
|
|
9635
9658
|
"agental guild join <guild> --as <name> --role <role> [--answer <key=value>]...",
|
|
@@ -9639,21 +9662,24 @@ var COMMANDS = [
|
|
|
9639
9662
|
"agental guild requests <guild> | claim <guild> <request> | answer <guild> <request> <text> | close <guild> <request>",
|
|
9640
9663
|
"agental guild notes <guild> [<identity>] [--text <notes>] | pause <guild> | resume <guild>",
|
|
9641
9664
|
"agental guild mail <guild> [<mail>]",
|
|
9642
|
-
"agental guild work <guild> --as <name> [--role <role>] [--parallel <n>] [--answer-chars <n>] -- <command> [args...]"
|
|
9665
|
+
"agental guild work <guild> --as <name> [--role <role>] [--parallel <n>] [--answer-chars <n>] [--once] -- <command> [args...]"
|
|
9643
9666
|
],
|
|
9644
9667
|
examples: [
|
|
9668
|
+
'agental guild plan marketing --roles "blog manager:1,reviewer:2" --brief "Reviewers answer pass or fail." --template writers:reviewer',
|
|
9645
9669
|
'agental guild create marketing --roles "blog manager:1,reviewer:2" --brief "Reviewers answer pass or fail."',
|
|
9646
9670
|
"agental guild attach marketing writers",
|
|
9647
9671
|
"agental guild join marketing --as Atlas --role reviewer --answer model=claude",
|
|
9648
9672
|
'agental guild post marketing "Review a1b2c3, please." --to-role reviewer --request',
|
|
9649
9673
|
"agental guild read marketing --wait-seconds 30 --done",
|
|
9650
9674
|
"agental guild mail marketing",
|
|
9651
|
-
"agental guild work marketing --as builder-1 --role builder -- claude -p --permission-mode acceptEdits"
|
|
9675
|
+
"agental guild work marketing --as builder-1 --role builder -- claude -p --permission-mode acceptEdits",
|
|
9676
|
+
"agental guild work marketing --as builder-1 --once -- claude -p"
|
|
9652
9677
|
],
|
|
9653
9678
|
flags: [
|
|
9654
|
-
["--roles <name[:seats],...>", "create: the roles, each with its seats; attach: the roles its sandboxes may take"],
|
|
9655
|
-
["--brief <text>", "create: what the guild is for, read by every member"],
|
|
9679
|
+
["--roles <name[:seats],...>", "plan, create: the roles, each with its seats; attach: the roles its sandboxes may take"],
|
|
9680
|
+
["--brief <text>", "plan, create: what the guild is for, read by every member"],
|
|
9656
9681
|
["--form <file.json>", "create: the fields an agent fills in to join, as the API takes them"],
|
|
9682
|
+
["--template <template[:role,...]>", "plan, create: a template whose sandboxes may join, in those roles or any (may be given again)"],
|
|
9657
9683
|
["--as <name>", "join: the name you will be known by in the guild"],
|
|
9658
9684
|
["--role <role>", "join: one of the guild's roles with a free seat"],
|
|
9659
9685
|
["--answer <key=value>", "join: an answer to the guild's form (may be given again)"],
|
|
@@ -9669,6 +9695,7 @@ var COMMANDS = [
|
|
|
9669
9695
|
["--as <name> --role <role>", "work: the identity it works as, joined in the role where it is not held yet"],
|
|
9670
9696
|
["--parallel <n>", "work: how many agents run at once; 1 by default"],
|
|
9671
9697
|
["--answer-chars <n>", "work: how much of the end of a run's output its answer keeps; 16000, the most, by default"],
|
|
9698
|
+
["--once", "work: answer what is owed now, then exit 0 once nothing is owed and nothing runs: the command of a job a request wakes"],
|
|
9672
9699
|
["-- <command> [args...]", "work: the agent run for each request, its prompt on stdin; what it prints last is its answer"]
|
|
9673
9700
|
]
|
|
9674
9701
|
},
|
|
@@ -9776,7 +9803,7 @@ var COMMANDS = [
|
|
|
9776
9803
|
["--at <date-time>", "add, update: once, at that moment"],
|
|
9777
9804
|
["--timeout <time>", "how long a run may take (default 10m, at most 6h)"],
|
|
9778
9805
|
["--if-stopped start|skip", "start a stopped sandbox for the run and stop it after (start), or skip"],
|
|
9779
|
-
["--
|
|
9806
|
+
["--pause-after", "when the run started the sandbox, pause it again after, keeping its memory"],
|
|
9780
9807
|
["--delete-after", "with --at: delete the sandbox after a run that exits 0"],
|
|
9781
9808
|
["--disk-only", "update: stop it after keeping its disk, as by default"],
|
|
9782
9809
|
["--overlap skip|replace|parallel", "when the last run still goes: skip this one, stop that one, or run both"],
|
|
@@ -9787,6 +9814,7 @@ var COMMANDS = [
|
|
|
9787
9814
|
["--input <NAME>=<value>", "run: a value for one of its inputs, over the default"],
|
|
9788
9815
|
["--after-job <job>[:succeeded|failed]", "add, update: run it when a run of that job ends (any end, or that one)"],
|
|
9789
9816
|
["--on-mail <sandbox>", "add, update: run it when mail arrives at that sandbox's address"],
|
|
9817
|
+
["--on-guild-request <guild>:<identity>", "add, update: run it when a request to that identity, one its sandbox holds, finds the sandbox stopped"],
|
|
9790
9818
|
["--no-events", "update: take away every event that starts it"],
|
|
9791
9819
|
["--name <name>", "update: a new name"],
|
|
9792
9820
|
["--wait[=<seconds>]", "run, again: wait for it to end, print its output, exit with its exit code"],
|
|
@@ -9885,7 +9913,7 @@ var COMMANDS = [
|
|
|
9885
9913
|
usage: [
|
|
9886
9914
|
"agental sandbox list [flags]",
|
|
9887
9915
|
"agental sandbox create [--name <name>] [flags]",
|
|
9888
|
-
"agental sandbox start|stop|delete|recover <sandbox-id> [flags]",
|
|
9916
|
+
"agental sandbox start|stop|pause|resume|delete|recover <sandbox-id> [flags]",
|
|
9889
9917
|
"agental sandbox exec <sandbox-id> -- <command> [args...]",
|
|
9890
9918
|
"agental sandbox shell <sandbox-id>",
|
|
9891
9919
|
"agental sandbox summary [flags]"
|
|
@@ -10126,7 +10154,7 @@ ${faint("agental help lists every command.", stream)}
|
|
|
10126
10154
|
`;
|
|
10127
10155
|
}
|
|
10128
10156
|
var LISTED = { template: "templates", key: "keys", webhook: "webhooks", job: "jobs", server: "servers" };
|
|
10129
|
-
var SANDBOX_VERBS = /* @__PURE__ */ new Set(["list", "create", "start", "stop", "delete", "recover", "exec", "shell", "summary"]);
|
|
10157
|
+
var SANDBOX_VERBS = /* @__PURE__ */ new Set(["list", "create", "start", "stop", "pause", "resume", "delete", "recover", "exec", "shell", "summary"]);
|
|
10130
10158
|
var SECRET_VERBS = /* @__PURE__ */ new Set(["list", "get", "set", "unset", "hosts", "get-file", "put-file", "rm-file"]);
|
|
10131
10159
|
var ACCOUNT_SECRET_VERBS = /* @__PURE__ */ new Set(["use", "unuse", "seal", "delete"]);
|
|
10132
10160
|
var ACCOUNT_SECRET_WORDS = /* @__PURE__ */ new Map([
|
|
@@ -10161,7 +10189,7 @@ function spelledOut(args, operator = false) {
|
|
|
10161
10189
|
};
|
|
10162
10190
|
switch (thing) {
|
|
10163
10191
|
case "sandbox":
|
|
10164
|
-
return verb !== void 0 && SANDBOX_VERBS.has(verb) ? [verb, ...rest] : wrong("list, create, start, stop, delete, recover, exec, shell or summary");
|
|
10192
|
+
return verb !== void 0 && SANDBOX_VERBS.has(verb) ? [verb, ...rest] : wrong("list, create, start, stop, pause, resume, delete, recover, exec, shell or summary");
|
|
10165
10193
|
case "region":
|
|
10166
10194
|
return verb === "list" ? ["regions", ...rest] : wrong("list");
|
|
10167
10195
|
case "bulk":
|
|
@@ -10244,7 +10272,7 @@ var SUBCOMMANDS = {
|
|
|
10244
10272
|
limits: ["budget"],
|
|
10245
10273
|
egress: ["budget", "use-case"],
|
|
10246
10274
|
tailscale: ["status", "connect", "disconnect"],
|
|
10247
|
-
guild: ["list", "show", "create", "delete", "attach", "detach", "mine", "join", "members", "leave", "handover", "post", "read", "requests", "claim", "answer", "close", "notes", "pause", "resume", "work"],
|
|
10275
|
+
guild: ["list", "show", "plan", "create", "delete", "attach", "detach", "mine", "join", "members", "leave", "handover", "post", "read", "requests", "claim", "answer", "close", "notes", "pause", "resume", "work"],
|
|
10248
10276
|
subscriptions: ["list", "sign-in", "delete"],
|
|
10249
10277
|
telemetry: ["set", "test", "unset"],
|
|
10250
10278
|
ci: ["jobs", "set", "reset"],
|
|
@@ -10297,7 +10325,7 @@ function flagsOf(usages) {
|
|
|
10297
10325
|
return flags2;
|
|
10298
10326
|
}
|
|
10299
10327
|
var SANDBOX = /^<sandbox-id>/;
|
|
10300
|
-
var SANDBOX_VERBS2 = /* @__PURE__ */ new Set(["list", "create", "start", "stop", "delete", "recover", "exec", "shell", "summary"]);
|
|
10328
|
+
var SANDBOX_VERBS2 = /* @__PURE__ */ new Set(["list", "create", "start", "stop", "pause", "resume", "delete", "recover", "exec", "shell", "summary"]);
|
|
10301
10329
|
var TEMPLATE = /^<template>/;
|
|
10302
10330
|
var SNAPSHOT = /^<snapshot/;
|
|
10303
10331
|
var IMAGE = /^<image>/;
|
|
@@ -10342,7 +10370,7 @@ async function complete(typed, reference, operator, fetchJson) {
|
|
|
10342
10370
|
const usages = [...found?.usage ?? [], ...usageOf(reference).get(name) ?? []];
|
|
10343
10371
|
const flags2 = flagsOf(usages);
|
|
10344
10372
|
const last = before[before.length - 1];
|
|
10345
|
-
const valueOf = flags2.get(last) ?? (last === "-t" ? "<template>" : last === "-s" ? "tiny|small|medium|large" : void 0);
|
|
10373
|
+
const valueOf = flags2.get(last) ?? (last === "-t" ? "<template>" : last === "-s" ? "tiny|small|medium|large|xlarge" : void 0);
|
|
10346
10374
|
if (valueOf !== void 0 && valueOf !== null) {
|
|
10347
10375
|
if (TEMPLATE.test(valueOf)) {
|
|
10348
10376
|
return starting(await templates(fetchJson));
|
|
@@ -10943,8 +10971,8 @@ function afterOf(job2) {
|
|
|
10943
10971
|
switch (job2.after) {
|
|
10944
10972
|
case "delete":
|
|
10945
10973
|
return "deletes the sandbox, if the command exits 0";
|
|
10946
|
-
case "
|
|
10947
|
-
return "
|
|
10974
|
+
case "pause":
|
|
10975
|
+
return "pauses it again if the run started it, keeping its memory";
|
|
10948
10976
|
default:
|
|
10949
10977
|
return "stops it again if the run started it, keeping its disk";
|
|
10950
10978
|
}
|
|
@@ -11040,8 +11068,8 @@ function targetOf(options) {
|
|
|
11040
11068
|
throw new Error("--size is the size of each fresh sandbox, and goes with --template.");
|
|
11041
11069
|
}
|
|
11042
11070
|
if (template2 !== void 0) {
|
|
11043
|
-
if ([options["if-stopped"], options["
|
|
11044
|
-
throw new Error("--if-stopped, --
|
|
11071
|
+
if ([options["if-stopped"], options["pause-after"], options["delete-after"], options["disk-only"]].some((given) => given !== void 0 && given !== false)) {
|
|
11072
|
+
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.");
|
|
11045
11073
|
}
|
|
11046
11074
|
return { template: template2, ...options.size === void 0 ? {} : { size: options.size } };
|
|
11047
11075
|
}
|
|
@@ -11100,13 +11128,14 @@ function runInputsOf(options) {
|
|
|
11100
11128
|
function eventsOf(options) {
|
|
11101
11129
|
const afterJob = options["after-job"] ?? [];
|
|
11102
11130
|
const onMail = options["on-mail"] ?? [];
|
|
11131
|
+
const onGuildRequest = options["on-guild-request"] ?? [];
|
|
11103
11132
|
if (options["no-events"]) {
|
|
11104
|
-
if (afterJob.length > 0 || onMail.length > 0) {
|
|
11105
|
-
throw new Error("--no-events takes away every event that starts the job: give it without --after-job and --on-
|
|
11133
|
+
if (afterJob.length > 0 || onMail.length > 0 || onGuildRequest.length > 0) {
|
|
11134
|
+
throw new Error("--no-events takes away every event that starts the job: give it without --after-job, --on-mail and --on-guild-request.");
|
|
11106
11135
|
}
|
|
11107
11136
|
return [];
|
|
11108
11137
|
}
|
|
11109
|
-
if (afterJob.length === 0 && onMail.length === 0) {
|
|
11138
|
+
if (afterJob.length === 0 && onMail.length === 0 && onGuildRequest.length === 0) {
|
|
11110
11139
|
return void 0;
|
|
11111
11140
|
}
|
|
11112
11141
|
return [
|
|
@@ -11118,7 +11147,15 @@ function eventsOf(options) {
|
|
|
11118
11147
|
}
|
|
11119
11148
|
return { on: "job.run_finished", job: job2, outcome };
|
|
11120
11149
|
}),
|
|
11121
|
-
...onMail.map((sandbox) => ({ on: "email.received", sandbox }))
|
|
11150
|
+
...onMail.map((sandbox) => ({ on: "email.received", sandbox })),
|
|
11151
|
+
...onGuildRequest.map((given) => {
|
|
11152
|
+
const colon = given.indexOf(":");
|
|
11153
|
+
const [guild2, member] = colon < 0 ? ["", ""] : [given.slice(0, colon), given.slice(colon + 1)];
|
|
11154
|
+
if (guild2 === "" || member === "") {
|
|
11155
|
+
throw new Error(`--on-guild-request is a guild and an identity its sandbox holds, each by its name or id, as --on-guild-request shop:builder-1: ${given} is not.`);
|
|
11156
|
+
}
|
|
11157
|
+
return { on: "guild.request", guild: guild2, member };
|
|
11158
|
+
})
|
|
11122
11159
|
];
|
|
11123
11160
|
}
|
|
11124
11161
|
function eventsOfJob(job2) {
|
|
@@ -11126,7 +11163,15 @@ function eventsOfJob(job2) {
|
|
|
11126
11163
|
if (events.length === 0) {
|
|
11127
11164
|
return null;
|
|
11128
11165
|
}
|
|
11129
|
-
return events.map((event) =>
|
|
11166
|
+
return events.map((event) => {
|
|
11167
|
+
if (event.on === "job.run_finished") {
|
|
11168
|
+
return `after ${event.jobName ?? event.job}${event.outcome === "any" ? "" : ` (${event.outcome})`}`;
|
|
11169
|
+
}
|
|
11170
|
+
if (event.on === "guild.request") {
|
|
11171
|
+
return `requests to ${event.memberName ?? event.member} in ${event.guildName ?? event.guild}`;
|
|
11172
|
+
}
|
|
11173
|
+
return `mail to ${event.sandboxName ?? event.sandbox}`;
|
|
11174
|
+
}).join(", ");
|
|
11130
11175
|
}
|
|
11131
11176
|
function waitSecondsOf(options) {
|
|
11132
11177
|
const given = options["wait-seconds"];
|
|
@@ -11142,8 +11187,8 @@ function fieldsOf(options) {
|
|
|
11142
11187
|
if ([options.every, options.cron, options.at].filter((given) => given !== void 0).length > 1) {
|
|
11143
11188
|
throw new Error("Give one of --every, --cron or --at.");
|
|
11144
11189
|
}
|
|
11145
|
-
if ([options["
|
|
11146
|
-
throw new Error("Give one of --
|
|
11190
|
+
if ([options["pause-after"], options["delete-after"], options["disk-only"]].filter(Boolean).length > 1) {
|
|
11191
|
+
throw new Error("Give one of --pause-after, --delete-after or --disk-only.");
|
|
11147
11192
|
}
|
|
11148
11193
|
if (options.overlap !== void 0 && !OVERLAPS.includes(options.overlap)) {
|
|
11149
11194
|
throw new Error(`--overlap is skip, replace or parallel, not ${options.overlap}.`);
|
|
@@ -11171,7 +11216,7 @@ function fieldsOf(options) {
|
|
|
11171
11216
|
...options.timeout === void 0 ? {} : { timeoutMs: timeoutMsOf(options.timeout) },
|
|
11172
11217
|
...options.overlap === void 0 ? {} : { overlap: options.overlap },
|
|
11173
11218
|
...ifStopped === void 0 ? {} : { ifStopped },
|
|
11174
|
-
...options["
|
|
11219
|
+
...options["pause-after"] ? { after: "pause" } : options["delete-after"] ? { after: "delete" } : options["disk-only"] ? { after: "stop" } : {},
|
|
11175
11220
|
...options["keep-failed-for"] === void 0 ? {} : { keepFailedFor: options["keep-failed-for"] },
|
|
11176
11221
|
...options.retries === void 0 ? {} : { retries: Number(options.retries.trim()) },
|
|
11177
11222
|
...options.alerts === void 0 ? {} : { alerts: options.alerts },
|
|
@@ -11315,8 +11360,8 @@ async function job(client, positionals, command3, options) {
|
|
|
11315
11360
|
if ((options.input !== void 0 || options["secret-input"] !== void 0) && !["add", "update", "run"].includes(what)) {
|
|
11316
11361
|
throw new Error("--input goes with job add, update or run, and --secret-input with add or update.");
|
|
11317
11362
|
}
|
|
11318
|
-
if ((options["after-job"] !== void 0 || options["on-mail"] !== void 0 || options["no-events"]) && !["add", "update"].includes(what)) {
|
|
11319
|
-
throw new Error("--after-job, --on-mail and --no-events go with job add or update.");
|
|
11363
|
+
if ((options["after-job"] !== void 0 || options["on-mail"] !== void 0 || options["on-guild-request"] !== void 0 || options["no-events"]) && !["add", "update"].includes(what)) {
|
|
11364
|
+
throw new Error("--after-job, --on-mail, --on-guild-request and --no-events go with job add or update.");
|
|
11320
11365
|
}
|
|
11321
11366
|
if (rest.length > (what === "logs" || what === "keep" || what === "again" ? 1 : 0)) {
|
|
11322
11367
|
throw new Error(what === "add" ? "job add takes its name, then its command after --: agental job add nightly --sandbox <sandbox> --every 1h -- npm test" : USAGE4);
|
|
@@ -11351,7 +11396,7 @@ async function job(client, positionals, command3, options) {
|
|
|
11351
11396
|
const changes = { ...fieldsOf(options), ...options.name === void 0 ? {} : { name: options.name }, ...command3 !== null && command3.length > 0 ? { command: commandLine(command3) } : {} };
|
|
11352
11397
|
if (Object.keys(changes).length === 0) {
|
|
11353
11398
|
throw new Error(
|
|
11354
|
-
"job update needs something to change: --sandbox, --template (and --size), --keep-failed-for, --every, --cron, --at, --tz, --timeout, --overlap, --if-stopped, --
|
|
11399
|
+
"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 --."
|
|
11355
11400
|
);
|
|
11356
11401
|
}
|
|
11357
11402
|
print3(await ask6(client, "PATCH", path9, changes), options.json);
|
|
@@ -12454,8 +12499,8 @@ async function writeStdin(client, sandbox, id, one) {
|
|
|
12454
12499
|
}
|
|
12455
12500
|
|
|
12456
12501
|
// ../src/cli-servers.ts
|
|
12457
|
-
var SERVER_USAGE = "server takes list, add, show, readings, token, drain, gone or remove. agental server --help shows each.";
|
|
12458
|
-
var SERVERS_USAGE = "servers takes nothing to list them, offload [on|off] [--over <percent>], or core-days [--month <yyyy-mm>].";
|
|
12502
|
+
var SERVER_USAGE = "server takes list, add, show, readings, token, drain, open, gone or remove. agental server --help shows each.";
|
|
12503
|
+
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], or core-days [--month <yyyy-mm>].";
|
|
12459
12504
|
var READING_MINUTES = ["1", "5", "15", "60"];
|
|
12460
12505
|
async function ask8(client, method, pathname, body) {
|
|
12461
12506
|
const response = await client.request(pathname, { method, ...body === void 0 ? {} : { body: JSON.stringify(body) } });
|
|
@@ -12523,6 +12568,19 @@ function holdsOf(server2) {
|
|
|
12523
12568
|
}
|
|
12524
12569
|
return parts.join(", ");
|
|
12525
12570
|
}
|
|
12571
|
+
function smtOf(server2) {
|
|
12572
|
+
const smt = server2.smt;
|
|
12573
|
+
if (smt === void 0 || smt.on === null) {
|
|
12574
|
+
return "not read yet";
|
|
12575
|
+
}
|
|
12576
|
+
if (smt.allowed === null) {
|
|
12577
|
+
return `${smt.on ? "on, so it takes no new sandbox" : "off"}: whether it may be on is not said by this server's agent yet`;
|
|
12578
|
+
}
|
|
12579
|
+
if (!smt.allowed) {
|
|
12580
|
+
return smt.on ? "on, though installed with --smt off: it takes no new sandbox until it is off" : "off, installed with --smt off";
|
|
12581
|
+
}
|
|
12582
|
+
return smt.on ? "on" : "off (allowed on: the processor or the server has it off)";
|
|
12583
|
+
}
|
|
12526
12584
|
function describe3(server2) {
|
|
12527
12585
|
const rows = [
|
|
12528
12586
|
["id", server2.id],
|
|
@@ -12532,9 +12590,15 @@ function describe3(server2) {
|
|
|
12532
12590
|
["address", server2.publicAddress ?? "none yet"],
|
|
12533
12591
|
// Null for a joined server too, whose cores could not be told: it is not counted until a count is agreed with agental.
|
|
12534
12592
|
["cores", server2.cores !== null ? String(server2.cores) : server2.agent.state === "waiting" ? "counted once it joins" : "not known: not counted until a count is agreed with us"],
|
|
12593
|
+
["smt", smtOf(server2)],
|
|
12594
|
+
["ksm", server2.ksm?.on === true ? "on: it takes no new sandbox until it is off" : server2.ksm?.on === false ? "off" : "not read yet"],
|
|
12535
12595
|
["holds", holdsOf(server2)],
|
|
12536
12596
|
["added", utc(server2.addedAt)]
|
|
12537
12597
|
];
|
|
12598
|
+
const update = server2.update;
|
|
12599
|
+
if (update !== void 0 && update.wanted !== null && update.runs !== null && update.runs !== update.wanted) {
|
|
12600
|
+
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`]);
|
|
12601
|
+
}
|
|
12538
12602
|
if (server2.agent.state === "waiting" && server2.agent.joinTokenExpiresAt !== null) {
|
|
12539
12603
|
rows.push(["token", `works once, until ${utc(server2.agent.joinTokenExpiresAt)}`]);
|
|
12540
12604
|
}
|
|
@@ -12549,6 +12613,7 @@ Run this as root on the server, with the disk for sandboxes in place of /dev/DIS
|
|
|
12549
12613
|
${joined.join.installCommand}
|
|
12550
12614
|
|
|
12551
12615
|
`);
|
|
12616
|
+
process.stdout.write("SMT stays on: the server holds only your own sandboxes. Add --smt off to the line for a server whose sandboxes run code of your own customers.\n\n");
|
|
12552
12617
|
process.stdout.write(`token: ${joined.join.token}
|
|
12553
12618
|
works once, until ${utc(joined.join.expiresAt)}
|
|
12554
12619
|
`);
|
|
@@ -12582,6 +12647,10 @@ async function servers(client, positionals, options) {
|
|
|
12582
12647
|
await offload(client, rest, options);
|
|
12583
12648
|
return;
|
|
12584
12649
|
}
|
|
12650
|
+
if (what === "window" && rest.length === 0) {
|
|
12651
|
+
await updateWindow(client, options);
|
|
12652
|
+
return;
|
|
12653
|
+
}
|
|
12585
12654
|
if (what === "core-days" && rest.length === 0) {
|
|
12586
12655
|
await coreDays(client, options);
|
|
12587
12656
|
return;
|
|
@@ -12633,6 +12702,47 @@ async function offload(client, words2, options) {
|
|
|
12633
12702
|
sayOffload(set2);
|
|
12634
12703
|
}
|
|
12635
12704
|
}
|
|
12705
|
+
function sayWindow(set2) {
|
|
12706
|
+
if (set2.window === null) {
|
|
12707
|
+
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");
|
|
12708
|
+
return;
|
|
12709
|
+
}
|
|
12710
|
+
const { day, hour, timeZone, hours } = set2.window;
|
|
12711
|
+
process.stdout.write(
|
|
12712
|
+
`Your servers take a new agent on ${day}s from ${String(hour).padStart(2, "0")}:00 for ${hours} hour${hours === 1 ? "" : "s"}, ${timeZone} time.
|
|
12713
|
+
` + (set2.nextStart === null ? "" : `It next opens ${utc(set2.nextStart)}.
|
|
12714
|
+
`) + "A security release reaches them outside it too. Their sandboxes run on while the agent updates.\n"
|
|
12715
|
+
);
|
|
12716
|
+
}
|
|
12717
|
+
async function updateWindow(client, options) {
|
|
12718
|
+
const setting = options.day !== void 0 || options.hour !== void 0 || options.tz !== void 0 || options.hours !== void 0;
|
|
12719
|
+
if (options.off === true && setting) {
|
|
12720
|
+
throw new Error("servers window takes --off alone, or --day, --hour and --tz with --hours.");
|
|
12721
|
+
}
|
|
12722
|
+
let answer6;
|
|
12723
|
+
if (options.off === true) {
|
|
12724
|
+
answer6 = await ask8(client, "PUT", "/v1/update-window", { window: null });
|
|
12725
|
+
} else if (setting) {
|
|
12726
|
+
if (options.day === void 0 || options.hour === void 0 || options.tz === void 0) {
|
|
12727
|
+
throw new Error("servers window needs --day, --hour and --tz together: as agental servers window --day sunday --hour 2 --tz Europe/Berlin.");
|
|
12728
|
+
}
|
|
12729
|
+
const whole = (flag, value) => {
|
|
12730
|
+
if (!/^\d{1,2}$/.test(value)) {
|
|
12731
|
+
throw new Error(`--${flag} is a whole number, as 2.`);
|
|
12732
|
+
}
|
|
12733
|
+
return Number.parseInt(value, 10);
|
|
12734
|
+
};
|
|
12735
|
+
const window = { day: options.day.toLowerCase(), hour: whole("hour", options.hour), timeZone: options.tz, ...options.hours === void 0 ? {} : { hours: whole("hours", options.hours) } };
|
|
12736
|
+
answer6 = await ask8(client, "PUT", "/v1/update-window", { window });
|
|
12737
|
+
} else {
|
|
12738
|
+
answer6 = await ask8(client, "GET", "/v1/update-window");
|
|
12739
|
+
}
|
|
12740
|
+
if (options.json) {
|
|
12741
|
+
printJson2(answer6);
|
|
12742
|
+
} else {
|
|
12743
|
+
sayWindow(answer6);
|
|
12744
|
+
}
|
|
12745
|
+
}
|
|
12636
12746
|
async function coreDays(client, options) {
|
|
12637
12747
|
const query = options.month === void 0 ? "" : `?month=${encodeURIComponent(options.month)}`;
|
|
12638
12748
|
const body = await ask8(client, "GET", `/v1/core-days${query}`);
|
|
@@ -12709,6 +12819,17 @@ async function server(client, positionals, options) {
|
|
|
12709
12819
|
process.stderr.write("It takes no new sandbox. Nothing on it was stopped or moved.\n");
|
|
12710
12820
|
return;
|
|
12711
12821
|
}
|
|
12822
|
+
case "open": {
|
|
12823
|
+
const found = await serverNamed(client, target, "open");
|
|
12824
|
+
const opened = await ask8(client, "POST", `/v1/servers/${encodeURIComponent(found.id)}/open`);
|
|
12825
|
+
if (options.json) {
|
|
12826
|
+
printJson2(opened);
|
|
12827
|
+
return;
|
|
12828
|
+
}
|
|
12829
|
+
process.stdout.write(describe3(opened));
|
|
12830
|
+
process.stderr.write("It takes new sandboxes again.\n");
|
|
12831
|
+
return;
|
|
12832
|
+
}
|
|
12712
12833
|
case "gone": {
|
|
12713
12834
|
const found = await serverNamed(client, target, "gone");
|
|
12714
12835
|
if (options.reason === void 0 || options.reason.trim().length < 3) {
|
|
@@ -12824,6 +12945,9 @@ var LIFECYCLE_EVENTS = [
|
|
|
12824
12945
|
"sandbox.created",
|
|
12825
12946
|
"sandbox.started",
|
|
12826
12947
|
"sandbox.stopped",
|
|
12948
|
+
// A stop that kept its memory, and the start that carried on from it, under their own names (docs/pause-resume.md).
|
|
12949
|
+
"sandbox.paused",
|
|
12950
|
+
"sandbox.resumed",
|
|
12827
12951
|
"sandbox.archived",
|
|
12828
12952
|
"sandbox.error",
|
|
12829
12953
|
"sandbox.moved",
|
|
@@ -12851,7 +12975,7 @@ var HEADROOM_EVENTS = [
|
|
|
12851
12975
|
var JOB_EVENTS = ["job.created", "job.updated", "job.deleted", "job.run_started", "job.run_finished", "job.run_failed", "job.recovered", "job.paused"];
|
|
12852
12976
|
var TAILSCALE_EVENTS = ["tailscale.node_down", "tailscale.disconnected"];
|
|
12853
12977
|
var GUILD_EVENTS = ["guild.message", "guild.request_open", "guild.member_joined", "guild.member_left", "guild.paused", "guild.resumed"];
|
|
12854
|
-
var CONNECTION_EVENTS = ["connection.connected", "connection.signed_out", "connection.removed", "connection.sign_in_failed", "connection.renewal_failed"];
|
|
12978
|
+
var CONNECTION_EVENTS = ["connection.connected", "connection.signed_out", "connection.removed", "connection.sign_in_failed", "connection.renewal_failed", "connection.request_refused", "connection.service_refused"];
|
|
12855
12979
|
var WEBHOOK_KINDS = [...WEBHOOK_EVENTS, ...EMAIL_EVENTS, ...MEMBER_EVENTS, ...TEMPLATE_EVENTS, ...HEADROOM_EVENTS, ...JOB_EVENTS, ...TAILSCALE_EVENTS, ...GUILD_EVENTS, ...CONNECTION_EVENTS];
|
|
12856
12980
|
var WEBHOOK_GROUPS = [...new Set(WEBHOOK_KINDS.map((kind) => kind.slice(0, kind.indexOf("."))))];
|
|
12857
12981
|
function closestEvent(asked2) {
|
|
@@ -13163,20 +13287,23 @@ var MACHINE_SIZES = {
|
|
|
13163
13287
|
tiny: { vcpu: 1, memoryMb: 2048, diskGb: 20 },
|
|
13164
13288
|
small: { vcpu: 2, memoryMb: 4096, diskGb: 40 },
|
|
13165
13289
|
medium: { vcpu: 4, memoryMb: 8192, diskGb: 80 },
|
|
13166
|
-
large: { vcpu: 8, memoryMb: 16384, diskGb: 160 }
|
|
13290
|
+
large: { vcpu: 8, memoryMb: 16384, diskGb: 160 },
|
|
13291
|
+
xlarge: { vcpu: 16, memoryMb: 32768, diskGb: 320 }
|
|
13167
13292
|
};
|
|
13168
|
-
var MACHINE_SIZE_NAMES = ["tiny", "small", "medium", "large"];
|
|
13293
|
+
var MACHINE_SIZE_NAMES = ["tiny", "small", "medium", "large", "xlarge"];
|
|
13169
13294
|
var LIST_PRICE_MICROS_PER_HOUR = {
|
|
13170
13295
|
tiny: 13500,
|
|
13171
13296
|
small: 27e3,
|
|
13172
13297
|
medium: 54e3,
|
|
13173
|
-
large: 108e3
|
|
13298
|
+
large: 108e3,
|
|
13299
|
+
xlarge: 216e3
|
|
13174
13300
|
};
|
|
13175
13301
|
var SPOT_PRICE_MICROS_PER_HOUR = {
|
|
13176
13302
|
tiny: LIST_PRICE_MICROS_PER_HOUR.tiny / 2,
|
|
13177
13303
|
small: LIST_PRICE_MICROS_PER_HOUR.small / 2,
|
|
13178
13304
|
medium: LIST_PRICE_MICROS_PER_HOUR.medium / 2,
|
|
13179
|
-
large: LIST_PRICE_MICROS_PER_HOUR.large / 2
|
|
13305
|
+
large: LIST_PRICE_MICROS_PER_HOUR.large / 2,
|
|
13306
|
+
xlarge: LIST_PRICE_MICROS_PER_HOUR.xlarge / 2
|
|
13180
13307
|
};
|
|
13181
13308
|
var SPOT_ON_RECLAIM = ["delete", "stop"];
|
|
13182
13309
|
var SPOT_ON_RECLAIM_READ = [...SPOT_ON_RECLAIM, "upgrade"];
|
|
@@ -13199,16 +13326,18 @@ var STOPPED_MAX_MICROS_PER_HOUR = {
|
|
|
13199
13326
|
tiny: stoppedMicrosPerHour(wholeStoredBytes("tiny", false)),
|
|
13200
13327
|
small: stoppedMicrosPerHour(wholeStoredBytes("small", false)),
|
|
13201
13328
|
medium: stoppedMicrosPerHour(wholeStoredBytes("medium", false)),
|
|
13202
|
-
large: stoppedMicrosPerHour(wholeStoredBytes("large", false))
|
|
13329
|
+
large: stoppedMicrosPerHour(wholeStoredBytes("large", false)),
|
|
13330
|
+
xlarge: stoppedMicrosPerHour(wholeStoredBytes("xlarge", false))
|
|
13203
13331
|
};
|
|
13204
13332
|
var STOPPED_WITH_MEMORY_MAX_MICROS_PER_HOUR = {
|
|
13205
13333
|
tiny: stoppedMicrosPerHour(wholeStoredBytes("tiny", true)),
|
|
13206
13334
|
small: stoppedMicrosPerHour(wholeStoredBytes("small", true)),
|
|
13207
13335
|
medium: stoppedMicrosPerHour(wholeStoredBytes("medium", true)),
|
|
13208
|
-
large: stoppedMicrosPerHour(wholeStoredBytes("large", true))
|
|
13336
|
+
large: stoppedMicrosPerHour(wholeStoredBytes("large", true)),
|
|
13337
|
+
xlarge: stoppedMicrosPerHour(wholeStoredBytes("xlarge", true))
|
|
13209
13338
|
};
|
|
13210
13339
|
var SANDBOX_STATUSES = ["creating", "running", "stopped", "error", "deleted"];
|
|
13211
|
-
var SHOWN_STATUSES = [...SANDBOX_STATUSES, "restoring", "migrating"];
|
|
13340
|
+
var SHOWN_STATUSES = [...SANDBOX_STATUSES, "restoring", "migrating", "paused"];
|
|
13212
13341
|
var OUTBOUND_MODES = ["open", "blocked", "allowlist"];
|
|
13213
13342
|
function isMachineSize(value) {
|
|
13214
13343
|
return Object.hasOwn(MACHINE_SIZES, value);
|
|
@@ -14188,7 +14317,7 @@ function parseDockerfile(dockerfile, args = {}) {
|
|
|
14188
14317
|
refuse(`a heredoc (<<) in ${instruction} is not supported; put the text in a file in the build's folder and COPY it`);
|
|
14189
14318
|
}
|
|
14190
14319
|
const hash = createHash5("sha256").update(text).digest("hex");
|
|
14191
|
-
const word = (input) => expandWords(input, lookup, false, refuse)[0] ?? "";
|
|
14320
|
+
const word = (input) => expandWords(input, lookup, false, refuse)[0]?.value ?? "";
|
|
14192
14321
|
const words2 = (input) => expandWords(input, lookup, true, refuse);
|
|
14193
14322
|
switch (instruction) {
|
|
14194
14323
|
case "FROM":
|
|
@@ -14385,23 +14514,23 @@ function copyOf(rest, instruction, workdir, word, words2, refuse) {
|
|
|
14385
14514
|
refuse(`${instruction} --${name} is not supported; remove it`);
|
|
14386
14515
|
}
|
|
14387
14516
|
const argv = jsonArgv(remaining);
|
|
14388
|
-
const paths = argv === null ? words2(remaining) : argv.map(word);
|
|
14517
|
+
const paths = argv === null ? words2(remaining) : argv.map((written) => ({ value: word(written), written }));
|
|
14389
14518
|
if (paths.length < 2) refuse(`${instruction} needs a source in the build's folder and a destination`);
|
|
14390
|
-
const sources = paths.slice(0, -1).map((source) => {
|
|
14519
|
+
const sources = paths.slice(0, -1).map(({ value: source, written }) => {
|
|
14391
14520
|
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(source) || source.startsWith("git@")) {
|
|
14392
14521
|
refuse(`${instruction} of a URL is not supported; download it with RUN curl or RUN git clone`);
|
|
14393
14522
|
}
|
|
14394
|
-
if (source.startsWith("/")) refuse(`${instruction} ${
|
|
14523
|
+
if (source.startsWith("/")) refuse(`${instruction} ${written}: a source is a path in the build's folder, not an absolute path`);
|
|
14395
14524
|
const normalised = posix.normalize(source);
|
|
14396
14525
|
if (normalised === ".." || normalised.startsWith("../")) {
|
|
14397
|
-
refuse(`${instruction} ${
|
|
14526
|
+
refuse(`${instruction} ${written}: a source cannot leave the build's folder`);
|
|
14398
14527
|
}
|
|
14399
14528
|
if (instruction === "ADD" && ARCHIVE.test(normalised)) {
|
|
14400
|
-
refuse(`ADD of an archive (${
|
|
14529
|
+
refuse(`ADD of an archive (${written}) is not supported, since Docker would unpack it and agental does not; COPY it and unpack it with RUN tar or RUN unzip`);
|
|
14401
14530
|
}
|
|
14402
14531
|
return normalised;
|
|
14403
14532
|
});
|
|
14404
|
-
const given = paths.at(-1);
|
|
14533
|
+
const given = paths.at(-1).value;
|
|
14405
14534
|
const intoDirectory = given.endsWith("/") || /(^|\/)\.\.?$/.test(given);
|
|
14406
14535
|
if (sources.length > 1 && !intoDirectory) {
|
|
14407
14536
|
refuse(`${instruction} of more than one source needs a destination directory ending in /`);
|
|
@@ -14416,44 +14545,56 @@ function envOf2(rest, word, words2, refuse) {
|
|
|
14416
14545
|
if (!firstWord.includes("=")) {
|
|
14417
14546
|
const value = rest.slice(firstWord.length).trim();
|
|
14418
14547
|
if (firstWord === "" || value === "") refuse("ENV needs name=value, or a name and a value");
|
|
14419
|
-
variables = [{ name: firstWord, value: word(value) }];
|
|
14548
|
+
variables = [{ name: firstWord, value: word(value), written: firstWord }];
|
|
14420
14549
|
} else {
|
|
14421
14550
|
variables = words2(rest).map((pair) => {
|
|
14422
|
-
const equals = pair.indexOf("=");
|
|
14423
|
-
if (equals < 0) refuse(`ENV ${pair} has no value; write ${pair}=value`);
|
|
14424
|
-
return { name: pair.slice(0, equals), value: pair.slice(equals + 1) };
|
|
14551
|
+
const equals = pair.value.indexOf("=");
|
|
14552
|
+
if (equals < 0) refuse(`ENV ${pair.written} has no value; write ${pair.written}=value`);
|
|
14553
|
+
return { name: pair.value.slice(0, equals), value: pair.value.slice(equals + 1), written: nameAsWritten(pair) };
|
|
14425
14554
|
});
|
|
14426
14555
|
}
|
|
14427
|
-
for (const { name } of variables) {
|
|
14428
|
-
if (!NAME.test(name)) refuse(`ENV ${
|
|
14556
|
+
for (const { name, written } of variables) {
|
|
14557
|
+
if (!NAME.test(name)) refuse(`ENV ${written} is not a name a variable can have: letters, digits and _, not starting with a digit`);
|
|
14429
14558
|
}
|
|
14430
|
-
return variables;
|
|
14559
|
+
return variables.map(({ name, value }) => ({ name, value }));
|
|
14431
14560
|
}
|
|
14432
14561
|
function argsOf(declarations, given, refuse) {
|
|
14433
14562
|
if (declarations.length === 0) refuse("ARG needs a name");
|
|
14434
14563
|
return declarations.map((declaration) => {
|
|
14435
|
-
const equals = declaration.indexOf("=");
|
|
14436
|
-
const name = equals < 0 ? declaration : declaration.slice(0, equals);
|
|
14437
|
-
if (!NAME.test(name)) refuse(`ARG ${
|
|
14438
|
-
const fallback = equals < 0 ? null : declaration.slice(equals + 1);
|
|
14564
|
+
const equals = declaration.value.indexOf("=");
|
|
14565
|
+
const name = equals < 0 ? declaration.value : declaration.value.slice(0, equals);
|
|
14566
|
+
if (!NAME.test(name)) refuse(`ARG ${nameAsWritten(declaration)} is not a name a variable can have: letters, digits and _, not starting with a digit`);
|
|
14567
|
+
const fallback = equals < 0 ? null : declaration.value.slice(equals + 1);
|
|
14439
14568
|
return { name, value: Object.hasOwn(given, name) ? given[name] : fallback };
|
|
14440
14569
|
});
|
|
14441
14570
|
}
|
|
14571
|
+
function nameAsWritten(pair) {
|
|
14572
|
+
const equals = pair.written.indexOf("=");
|
|
14573
|
+
return equals < 0 ? pair.written : pair.written.slice(0, equals);
|
|
14574
|
+
}
|
|
14442
14575
|
function portsOf(given, refuse) {
|
|
14443
14576
|
if (given.length === 0) refuse("EXPOSE needs a port");
|
|
14444
|
-
return given.map((written) => {
|
|
14445
|
-
const port = /^([0-9]+)(?:\/(tcp|udp))?$/i.exec(
|
|
14577
|
+
return given.map(({ value, written }) => {
|
|
14578
|
+
const port = /^([0-9]+)(?:\/(tcp|udp))?$/i.exec(value);
|
|
14446
14579
|
if (port === null) refuse(`EXPOSE ${written} is not supported; list each port as a number, with /tcp or /udp`);
|
|
14447
14580
|
const number = Number(port[1]);
|
|
14448
14581
|
if (number < 1 || number > 65535) refuse(`EXPOSE ${written}: a port is from 1 to 65535`);
|
|
14449
14582
|
return { port: number, protocol: port[2]?.toLowerCase() ?? "tcp" };
|
|
14450
14583
|
});
|
|
14451
14584
|
}
|
|
14585
|
+
var EXPANDED_MOST = 65536;
|
|
14452
14586
|
function expandWords(input, lookup, split, refuse) {
|
|
14453
14587
|
const words2 = [];
|
|
14454
14588
|
let word = "";
|
|
14455
14589
|
let inWord = false;
|
|
14590
|
+
let start2 = 0;
|
|
14456
14591
|
let at5 = 0;
|
|
14592
|
+
const capped = (grown) => {
|
|
14593
|
+
if (grown.length > EXPANDED_MOST) {
|
|
14594
|
+
refuse(`a word expands to more than ${EXPANDED_MOST} characters; no step of a build takes one so long`);
|
|
14595
|
+
}
|
|
14596
|
+
return grown;
|
|
14597
|
+
};
|
|
14457
14598
|
const variable = () => {
|
|
14458
14599
|
at5++;
|
|
14459
14600
|
if (input[at5] !== "{") {
|
|
@@ -14495,7 +14636,7 @@ function expandWords(input, lookup, split, refuse) {
|
|
|
14495
14636
|
text += input[at5 + 1];
|
|
14496
14637
|
at5 += 2;
|
|
14497
14638
|
} else if (input[at5] === "$") {
|
|
14498
|
-
text
|
|
14639
|
+
text = capped(text + variable());
|
|
14499
14640
|
} else {
|
|
14500
14641
|
text += input[at5];
|
|
14501
14642
|
at5++;
|
|
@@ -14508,12 +14649,13 @@ function expandWords(input, lookup, split, refuse) {
|
|
|
14508
14649
|
while (at5 < input.length) {
|
|
14509
14650
|
const char = input[at5];
|
|
14510
14651
|
if (split && /\s/.test(char)) {
|
|
14511
|
-
if (inWord) words2.push(word);
|
|
14652
|
+
if (inWord) words2.push({ value: word, written: input.slice(start2, at5) });
|
|
14512
14653
|
word = "";
|
|
14513
14654
|
inWord = false;
|
|
14514
14655
|
at5++;
|
|
14515
14656
|
continue;
|
|
14516
14657
|
}
|
|
14658
|
+
if (!inWord) start2 = at5;
|
|
14517
14659
|
inWord = true;
|
|
14518
14660
|
if (char === "\\") {
|
|
14519
14661
|
word += at5 + 1 < input.length ? input[at5 + 1] : char;
|
|
@@ -14530,7 +14672,7 @@ function expandWords(input, lookup, split, refuse) {
|
|
|
14530
14672
|
word += input[at5 + 1];
|
|
14531
14673
|
at5 += 2;
|
|
14532
14674
|
} else if (input[at5] === "$") {
|
|
14533
|
-
word
|
|
14675
|
+
word = capped(word + variable());
|
|
14534
14676
|
} else {
|
|
14535
14677
|
word += input[at5];
|
|
14536
14678
|
at5++;
|
|
@@ -14539,13 +14681,13 @@ function expandWords(input, lookup, split, refuse) {
|
|
|
14539
14681
|
if (at5 >= input.length) refuse('a " is not closed');
|
|
14540
14682
|
at5++;
|
|
14541
14683
|
} else if (char === "$") {
|
|
14542
|
-
word
|
|
14684
|
+
word = capped(word + variable());
|
|
14543
14685
|
} else {
|
|
14544
14686
|
word += char;
|
|
14545
14687
|
at5++;
|
|
14546
14688
|
}
|
|
14547
14689
|
}
|
|
14548
|
-
if (inWord) words2.push(word);
|
|
14690
|
+
if (inWord) words2.push({ value: word, written: input.slice(start2, at5) });
|
|
14549
14691
|
return words2;
|
|
14550
14692
|
}
|
|
14551
14693
|
|
|
@@ -15065,7 +15207,7 @@ var AgentalError = class extends Error {
|
|
|
15065
15207
|
// ../sdk/typescript/src/sealed.ts
|
|
15066
15208
|
var SEALED_SUITE = "x25519-hkdf-sha256-aes256gcm";
|
|
15067
15209
|
var ROOT_PUBLIC_KEYS = ["jNdFf3FKdbFQ5J-1e_NE7ZzuaNPRdci-mzlGj384Rmw"];
|
|
15068
|
-
var SEALED_PURPOSES = ["variable", "tailscale-oauth", "sign-in-code"];
|
|
15210
|
+
var SEALED_PURPOSES = ["variable", "tailscale-oauth", "sign-in-code", "connection-app"];
|
|
15069
15211
|
var KEM_ID = 32;
|
|
15070
15212
|
var KDF_ID = 1;
|
|
15071
15213
|
var AEAD_ID = 2;
|
|
@@ -15785,7 +15927,8 @@ async function work(options) {
|
|
|
15785
15927
|
});
|
|
15786
15928
|
};
|
|
15787
15929
|
const take = async (request2) => {
|
|
15788
|
-
const
|
|
15930
|
+
const mine = (await call3("GET", "/v1/guilds/mine")).body.guilds ?? [];
|
|
15931
|
+
const guild2 = mine.find((each) => each.guild.name === options.guild)?.guild ?? {};
|
|
15789
15932
|
const notes = (await call3("GET", `${at5}/members/${encodeURIComponent(identity.id)}/notes`)).body.text ?? "";
|
|
15790
15933
|
let claimMinutes = null;
|
|
15791
15934
|
if (request2.toRole !== null) {
|
|
@@ -15926,6 +16069,10 @@ async function work(options) {
|
|
|
15926
16069
|
await sleep4(backoffMs, done2);
|
|
15927
16070
|
continue;
|
|
15928
16071
|
}
|
|
16072
|
+
if (options.once === true && runs.size === 0 && pending.length === 0) {
|
|
16073
|
+
say("Nothing is owed and nothing runs: done.");
|
|
16074
|
+
return 0;
|
|
16075
|
+
}
|
|
15929
16076
|
const nextDue = Math.min(...pending.map((one) => one.dueAt));
|
|
15930
16077
|
await rest(Math.max(0, Math.min(timing.recheckMs, nextDue - Date.now())));
|
|
15931
16078
|
}
|
|
@@ -15966,7 +16113,7 @@ async function work(options) {
|
|
|
15966
16113
|
}
|
|
15967
16114
|
|
|
15968
16115
|
// ../src/cli-guilds.ts
|
|
15969
|
-
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.";
|
|
16116
|
+
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.";
|
|
15970
16117
|
async function ask12(client, method, pathname, body) {
|
|
15971
16118
|
const response = await client.request(pathname, { method, ...body === void 0 ? {} : { body: JSON.stringify(body) } });
|
|
15972
16119
|
let answered = null;
|
|
@@ -16036,6 +16183,45 @@ function formFrom(file) {
|
|
|
16036
16183
|
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}].`);
|
|
16037
16184
|
}
|
|
16038
16185
|
}
|
|
16186
|
+
function templateAsked(given) {
|
|
16187
|
+
const colon = given.indexOf(":");
|
|
16188
|
+
const named = (colon === -1 ? given : given.slice(0, colon)).trim();
|
|
16189
|
+
const roles = colon === -1 ? [] : given.slice(colon + 1).split(",").map((role) => role.trim()).filter((role) => role !== "");
|
|
16190
|
+
return { ...named.startsWith("tpl_") ? { templateId: named } : { templateName: named }, ...roles.length === 0 ? {} : { roles } };
|
|
16191
|
+
}
|
|
16192
|
+
function guildAsked(name, options, verb) {
|
|
16193
|
+
return {
|
|
16194
|
+
name: needed(name, `${verb} takes a guild's name`),
|
|
16195
|
+
roles: rolesOf(needed(options.roles, `${verb} takes --roles, such as "blog manager:1,reviewer:2"`)),
|
|
16196
|
+
...options.brief === void 0 ? {} : { brief: options.brief },
|
|
16197
|
+
...options.form === void 0 ? {} : { form: formFrom(options.form) }
|
|
16198
|
+
};
|
|
16199
|
+
}
|
|
16200
|
+
function problemLines(plan2) {
|
|
16201
|
+
return plan2.problems.map((problem) => ` ${problem.field} ${problem.code}: ${problem.message}
|
|
16202
|
+
`).join("");
|
|
16203
|
+
}
|
|
16204
|
+
function planWords(plan2) {
|
|
16205
|
+
const { guild: planned } = plan2;
|
|
16206
|
+
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"}`;
|
|
16207
|
+
return [
|
|
16208
|
+
`${planned.name}, as it would be made
|
|
16209
|
+
`,
|
|
16210
|
+
planned.brief ? ` ${planned.brief}
|
|
16211
|
+
` : "",
|
|
16212
|
+
`roles
|
|
16213
|
+
${planned.roles.map((role) => ` ${roleLine(role)}${rules(role)}
|
|
16214
|
+
`).join("")}`,
|
|
16215
|
+
planned.form.length ? `form
|
|
16216
|
+
${planned.form.map((field) => ` ${String(field["key"])}: ${String(field["label"])}${field["required"] ? " (required)" : ""}
|
|
16217
|
+
`).join("")}` : "",
|
|
16218
|
+
`templates
|
|
16219
|
+
${planned.templates.map((one) => ` ${one.templateName} (${one.templateId})${one.roles ? ` as ${one.roles.join(", ")}` : ", any role"}
|
|
16220
|
+
`).join("") || " none\n"}`,
|
|
16221
|
+
plan2.ok ? "No problems: agental guild create with the same words makes it.\n" : `problems
|
|
16222
|
+
${problemLines(plan2)}`
|
|
16223
|
+
].join("");
|
|
16224
|
+
}
|
|
16039
16225
|
function roleLine(role) {
|
|
16040
16226
|
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"])}` : ""}`;
|
|
16041
16227
|
}
|
|
@@ -16110,15 +16296,35 @@ ${members2.map((member) => ` ${memberLine(member)}`).join("") || " none\n"}`
|
|
|
16110
16296
|
print4(options.json, { ...found, members: members2 }, words2);
|
|
16111
16297
|
return;
|
|
16112
16298
|
}
|
|
16299
|
+
case "plan": {
|
|
16300
|
+
const plan2 = await ask12(client, "POST", "/v1/guilds/plan", { ...guildAsked(name, options, "plan"), templates: (options.template ?? []).map(templateAsked) });
|
|
16301
|
+
print4(options.json, plan2, planWords(plan2));
|
|
16302
|
+
if (!plan2.ok) {
|
|
16303
|
+
process.exitCode = 1;
|
|
16304
|
+
}
|
|
16305
|
+
return;
|
|
16306
|
+
}
|
|
16113
16307
|
case "create": {
|
|
16114
|
-
const body =
|
|
16115
|
-
|
|
16116
|
-
|
|
16117
|
-
|
|
16118
|
-
|
|
16119
|
-
|
|
16308
|
+
const body = guildAsked(name, options, "create");
|
|
16309
|
+
let templates2 = [];
|
|
16310
|
+
if (options.template !== void 0 && options.template.length > 0) {
|
|
16311
|
+
const plan2 = await ask12(client, "POST", "/v1/guilds/plan", { ...body, templates: options.template.map(templateAsked) });
|
|
16312
|
+
if (!plan2.ok) {
|
|
16313
|
+
throw new Error(`Nothing was created:
|
|
16314
|
+
${problemLines(plan2)}`);
|
|
16315
|
+
}
|
|
16316
|
+
templates2 = plan2.guild.templates;
|
|
16317
|
+
}
|
|
16120
16318
|
const made = await ask12(client, "POST", "/v1/guilds", body);
|
|
16121
|
-
|
|
16319
|
+
for (const template2 of templates2) {
|
|
16320
|
+
try {
|
|
16321
|
+
await ask12(client, "PUT", `${at4(String(made["name"]))}/templates/${encodeURIComponent(template2.templateId)}`, template2.roles === null ? {} : { roles: template2.roles });
|
|
16322
|
+
} catch (error) {
|
|
16323
|
+
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}.`);
|
|
16324
|
+
}
|
|
16325
|
+
}
|
|
16326
|
+
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.`;
|
|
16327
|
+
print4(options.json, { ...made, templates: templates2 }, `Made guild ${String(made["name"])}.${joining}
|
|
16122
16328
|
`);
|
|
16123
16329
|
return;
|
|
16124
16330
|
}
|
|
@@ -16338,6 +16544,7 @@ ${list7.map((one) => ` ${messageLine(one)}`).join("")}` : "";
|
|
|
16338
16544
|
role: options.role,
|
|
16339
16545
|
parallel: wholeNumber(options.parallel, "--parallel", 1, 1, 1e3),
|
|
16340
16546
|
answerChars: wholeNumber(options.answerChars, "--answer-chars", ANSWER_CHARS, FEWEST_ANSWER_CHARS, ANSWER_CHARS),
|
|
16547
|
+
once: options.once === true,
|
|
16341
16548
|
command: command3,
|
|
16342
16549
|
stop: stop.signal,
|
|
16343
16550
|
env,
|
|
@@ -16491,7 +16698,7 @@ async function answer4(client, path9, init) {
|
|
|
16491
16698
|
}
|
|
16492
16699
|
|
|
16493
16700
|
// ../src/cli-sites.ts
|
|
16494
|
-
var USAGE12 = "site takes a sandbox, or list, add, rm, stats or analytics, then the sandbox. agental site --help shows each.";
|
|
16701
|
+
var USAGE12 = "site takes a sandbox, or list, add, rm, access, stats or analytics, then the sandbox. agental site --help shows each.";
|
|
16495
16702
|
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.";
|
|
16496
16703
|
var REPORT_ROWS = 5;
|
|
16497
16704
|
async function bodyOf2(response) {
|
|
@@ -16677,7 +16884,7 @@ async function site(client, positionals, options) {
|
|
|
16677
16884
|
if (turn === "on" || turn === "off") return siteSwitch(client, turn, words2, options);
|
|
16678
16885
|
throw new Error(ANALYTICS_USAGE);
|
|
16679
16886
|
}
|
|
16680
|
-
const verb = positionals[0] === "list" || positionals[0] === "add" || positionals[0] === "rm" || positionals[0] === "stats" ? positionals[0] : null;
|
|
16887
|
+
const verb = positionals[0] === "list" || positionals[0] === "add" || positionals[0] === "rm" || positionals[0] === "stats" || positionals[0] === "access" ? positionals[0] : null;
|
|
16681
16888
|
const [sandbox, target, ...rest] = verb === null ? positionals : positionals.slice(1);
|
|
16682
16889
|
if (sandbox === void 0) {
|
|
16683
16890
|
throw new Error(USAGE12);
|
|
@@ -16699,7 +16906,7 @@ async function site(client, positionals, options) {
|
|
|
16699
16906
|
`);
|
|
16700
16907
|
return;
|
|
16701
16908
|
}
|
|
16702
|
-
const rows = [["ID", "ADDRESS", "PORT", "STATE"], ...sites.map((route) => [route.id, route.url ?? "no public address here", String(route.port), stateOf4(route)])];
|
|
16909
|
+
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)])];
|
|
16703
16910
|
const terminal2 = isTerminal(process.stdout);
|
|
16704
16911
|
process.stdout.write(fitted(rows, { ...terminal2 ? { give: 1 } : { width: Number.MAX_SAFE_INTEGER }, paint: (cell, row) => row === 0 ? faint(cell) : cell }));
|
|
16705
16912
|
return;
|
|
@@ -16709,7 +16916,18 @@ async function site(client, positionals, options) {
|
|
|
16709
16916
|
throw new Error(USAGE12);
|
|
16710
16917
|
}
|
|
16711
16918
|
const port = portFrom(target);
|
|
16712
|
-
const
|
|
16919
|
+
const response = await client.request(`/v1/sandboxes/${encodeURIComponent(sandbox)}/host`, {
|
|
16920
|
+
method: "POST",
|
|
16921
|
+
body: JSON.stringify({ port, title: `port-${port}`, public: true, ...options.private ? { access: "organization" } : {} })
|
|
16922
|
+
});
|
|
16923
|
+
const answered = await bodyOf2(response);
|
|
16924
|
+
if (!response.ok) {
|
|
16925
|
+
if (response.status === 409 && answered?.error?.code === "port_private") {
|
|
16926
|
+
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.`);
|
|
16927
|
+
}
|
|
16928
|
+
client.fail(response.status, answered);
|
|
16929
|
+
}
|
|
16930
|
+
const made = routeOf(answered);
|
|
16713
16931
|
if (options.json) {
|
|
16714
16932
|
process.stdout.write(`${JSON.stringify(made, null, 2)}
|
|
16715
16933
|
`);
|
|
@@ -16724,7 +16942,31 @@ async function site(client, positionals, options) {
|
|
|
16724
16942
|
process.stdout.write(`${made.url}
|
|
16725
16943
|
`);
|
|
16726
16944
|
process.stderr.write(
|
|
16727
|
-
`
|
|
16945
|
+
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.
|
|
16946
|
+
` : `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.
|
|
16947
|
+
`
|
|
16948
|
+
);
|
|
16949
|
+
return;
|
|
16950
|
+
}
|
|
16951
|
+
case "access": {
|
|
16952
|
+
const [who] = rest;
|
|
16953
|
+
if (target === void 0 || who !== "anyone" && who !== "organization" || rest.length > 1) {
|
|
16954
|
+
throw new Error(`site access needs the sandbox, the site's id, and anyone or organization: agental site access ${sandbox} rte_\u2026 organization.`);
|
|
16955
|
+
}
|
|
16956
|
+
const found = await siteOn(client, sandbox, target);
|
|
16957
|
+
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.`)) {
|
|
16958
|
+
process.stdout.write("Nothing was changed.\n");
|
|
16959
|
+
return;
|
|
16960
|
+
}
|
|
16961
|
+
const changed = routeOf(await ask13(client, "PUT", `/v1/host-routes/${encodeURIComponent(target)}/access`, { access: who }));
|
|
16962
|
+
if (options.json) {
|
|
16963
|
+
process.stdout.write(`${JSON.stringify(changed, null, 2)}
|
|
16964
|
+
`);
|
|
16965
|
+
return;
|
|
16966
|
+
}
|
|
16967
|
+
process.stdout.write(
|
|
16968
|
+
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.
|
|
16969
|
+
` : `${changed.url ?? target} is open to anyone with the link now, at every address of port ${changed.port}.
|
|
16728
16970
|
`
|
|
16729
16971
|
);
|
|
16730
16972
|
return;
|
|
@@ -17397,6 +17639,7 @@ function whereQuery(text, query = new URLSearchParams()) {
|
|
|
17397
17639
|
query.append("status", "error");
|
|
17398
17640
|
} else if (each === "archived") {
|
|
17399
17641
|
query.append("status", "stopped");
|
|
17642
|
+
query.append("status", "paused");
|
|
17400
17643
|
query.set("archived", "true");
|
|
17401
17644
|
} else {
|
|
17402
17645
|
query.append("status", each);
|
|
@@ -17641,7 +17884,10 @@ async function main() {
|
|
|
17641
17884
|
unlink: { type: "string" },
|
|
17642
17885
|
expires: { type: "string" },
|
|
17643
17886
|
"keep-streams": { type: "boolean" },
|
|
17887
|
+
// Pause's earlier spelling, on stop and on jobs: kept only to say what replaced it (docs/pause-resume.md, 4).
|
|
17644
17888
|
"keep-memory": { type: "boolean" },
|
|
17889
|
+
// agental job create and job update: a run that started the sandbox pauses it again after.
|
|
17890
|
+
"pause-after": { type: "boolean" },
|
|
17645
17891
|
"without-memory": { type: "boolean" },
|
|
17646
17892
|
// agental delete and template delete: delete a sandbox that jobs run in, or a template they make their sandboxes from, and pause them.
|
|
17647
17893
|
"pause-jobs": { type: "boolean" },
|
|
@@ -17673,6 +17919,7 @@ async function main() {
|
|
|
17673
17919
|
// agental job add and update: the events that start a job, another job's run ending and mail to a sandbox; or none.
|
|
17674
17920
|
"after-job": { type: "string", multiple: true },
|
|
17675
17921
|
"on-mail": { type: "string", multiple: true },
|
|
17922
|
+
"on-guild-request": { type: "string", multiple: true },
|
|
17676
17923
|
"no-events": { type: "boolean", default: false },
|
|
17677
17924
|
// agental job apply: delete the jobs the file does not name, or say what it would do and change nothing.
|
|
17678
17925
|
prune: { type: "boolean", default: false },
|
|
@@ -17747,10 +17994,16 @@ async function main() {
|
|
|
17747
17994
|
// 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.
|
|
17748
17995
|
over: { type: "string" },
|
|
17749
17996
|
month: { type: "string" },
|
|
17997
|
+
// agental servers window: the weekly window the organization's servers take a new agent in, with --tz and --off.
|
|
17998
|
+
day: { type: "string" },
|
|
17999
|
+
hour: { type: "string" },
|
|
18000
|
+
hours: { type: "string" },
|
|
17750
18001
|
// agental site stats: 24h or 7d.
|
|
17751
18002
|
range: { type: "string" },
|
|
17752
18003
|
// agental site analytics org on: the person has read what is kept.
|
|
17753
18004
|
informed: { type: "boolean", default: false },
|
|
18005
|
+
// agental site add: only the organization opens it.
|
|
18006
|
+
private: { type: "boolean", default: false },
|
|
17754
18007
|
sort: { type: "string" },
|
|
17755
18008
|
role: { type: "string" },
|
|
17756
18009
|
// Guilds: the roles of a create or an attach, its brief and form, and who joins with what answers.
|
|
@@ -17772,6 +18025,8 @@ async function main() {
|
|
|
17772
18025
|
// agental guild work: how many agents run at once, and how much of a run's output its answer keeps.
|
|
17773
18026
|
parallel: { type: "string" },
|
|
17774
18027
|
"answer-chars": { type: "string" },
|
|
18028
|
+
// agental guild work --once: end once nothing is owed and nothing runs, as a job a request wakes runs it.
|
|
18029
|
+
once: { type: "boolean" },
|
|
17775
18030
|
"revoke-keys": { type: "boolean", default: false },
|
|
17776
18031
|
// agental list in a terminal: every column, as piped.
|
|
17777
18032
|
wide: { type: "boolean", default: false },
|
|
@@ -17787,6 +18042,11 @@ async function main() {
|
|
|
17787
18042
|
}
|
|
17788
18043
|
});
|
|
17789
18044
|
const command3 = positionals[0];
|
|
18045
|
+
if (values["keep-memory"] !== void 0) {
|
|
18046
|
+
throw new Error(
|
|
18047
|
+
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."
|
|
18048
|
+
);
|
|
18049
|
+
}
|
|
17790
18050
|
if (!command3) {
|
|
17791
18051
|
process.stdout.write(isTerminal(process.stdout) ? shortHelp() : await helpText());
|
|
17792
18052
|
return;
|
|
@@ -17849,10 +18109,30 @@ async function main() {
|
|
|
17849
18109
|
return;
|
|
17850
18110
|
case "stop":
|
|
17851
18111
|
if (values.where !== void 0) {
|
|
17852
|
-
await bulk("stop", whereQuery(values.where, labelsFilter(values)),
|
|
18112
|
+
await bulk("stop", whereQuery(values.where, labelsFilter(values)), {}, values.yes === true, values.json);
|
|
18113
|
+
return;
|
|
18114
|
+
}
|
|
18115
|
+
await lifecycle("stop", positionals[1]);
|
|
18116
|
+
return;
|
|
18117
|
+
case "pause":
|
|
18118
|
+
if (values.where !== void 0 && positionals[1] !== void 0) {
|
|
18119
|
+
throw new Error("pause takes a sandbox's ID or --where, not both");
|
|
18120
|
+
}
|
|
18121
|
+
if (values.where !== void 0) {
|
|
18122
|
+
await bulk("stop", whereQuery(values.where, labelsFilter(values)), { keepMemory: true }, values.yes === true, values.json, void 0, "Pause");
|
|
18123
|
+
return;
|
|
18124
|
+
}
|
|
18125
|
+
await lifecycle("pause", positionals[1]);
|
|
18126
|
+
return;
|
|
18127
|
+
case "resume":
|
|
18128
|
+
if (values.where !== void 0 && positionals[1] !== void 0) {
|
|
18129
|
+
throw new Error("resume takes a sandbox's ID or --where, not both");
|
|
18130
|
+
}
|
|
18131
|
+
if (values.where !== void 0) {
|
|
18132
|
+
await bulk("start", pausedOnly(whereQuery(values.where, labelsFilter(values))), {}, values.yes === true, values.json, void 0, "Resume");
|
|
17853
18133
|
return;
|
|
17854
18134
|
}
|
|
17855
|
-
await lifecycle("
|
|
18135
|
+
await lifecycle("resume", positionals[1], maxBurstFeeHeaders(values["max-burst-fee"]));
|
|
17856
18136
|
return;
|
|
17857
18137
|
case "recover":
|
|
17858
18138
|
await lifecycle("recover", positionals[1], maxBurstFeeHeaders(values["max-burst-fee"]));
|
|
@@ -17911,7 +18191,7 @@ async function main() {
|
|
|
17911
18191
|
await browser(positionals[1], values.headless, values.headed, values.off, values.status);
|
|
17912
18192
|
return;
|
|
17913
18193
|
case "site":
|
|
17914
|
-
await site({ request, fail, confirmed }, positionals.slice(1), { json: values.json, range: values.range, yes: values.yes === true, informed: values.informed === true });
|
|
18194
|
+
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 });
|
|
17915
18195
|
return;
|
|
17916
18196
|
case "network":
|
|
17917
18197
|
await network(positionals.slice(1), values);
|
|
@@ -17940,6 +18220,7 @@ async function main() {
|
|
|
17940
18220
|
...values.role === void 0 ? {} : { role: values.role },
|
|
17941
18221
|
...values.brief === void 0 ? {} : { brief: values.brief },
|
|
17942
18222
|
...values.form === void 0 ? {} : { form: values.form },
|
|
18223
|
+
...values.template === void 0 ? {} : { template: values.template },
|
|
17943
18224
|
...values.as === void 0 ? {} : { as: values.as },
|
|
17944
18225
|
...values.answer === void 0 ? {} : { answer: values.answer },
|
|
17945
18226
|
...values.to === void 0 ? {} : { to: values.to },
|
|
@@ -17954,6 +18235,7 @@ async function main() {
|
|
|
17954
18235
|
...values.text === void 0 ? {} : { text: values.text },
|
|
17955
18236
|
...values.parallel === void 0 ? {} : { parallel: values.parallel },
|
|
17956
18237
|
...values["answer-chars"] === void 0 ? {} : { answerChars: values["answer-chars"] },
|
|
18238
|
+
...values.once === void 0 ? {} : { once: values.once },
|
|
17957
18239
|
...command4 === null ? {} : { command: command4 }
|
|
17958
18240
|
}
|
|
17959
18241
|
);
|
|
@@ -18113,11 +18395,11 @@ async function create(values) {
|
|
|
18113
18395
|
const burstHeaders = maxBurstFeeHeaders(values["max-burst-fee"]);
|
|
18114
18396
|
const ttlSeconds = ttlOption(values.ttl);
|
|
18115
18397
|
const onTimeout = values["on-timeout"];
|
|
18116
|
-
if (onTimeout !== void 0 && onTimeout !== "delete" && onTimeout !== "stop" && onTimeout !== "
|
|
18117
|
-
throw new Error("--on-timeout is delete, stop or
|
|
18398
|
+
if (onTimeout !== void 0 && onTimeout !== "delete" && onTimeout !== "stop" && onTimeout !== "pause") {
|
|
18399
|
+
throw new Error("--on-timeout is delete, stop or pause: what the sandbox's time limit does when it runs out");
|
|
18118
18400
|
}
|
|
18119
18401
|
if (values.size !== void 0 && !isMachineSize(values.size)) {
|
|
18120
|
-
throw new Error("--size must be tiny, small, medium or
|
|
18402
|
+
throw new Error("--size must be tiny, small, medium, large or xlarge");
|
|
18121
18403
|
}
|
|
18122
18404
|
if (!values.spot && (values["on-reclaim"] !== void 0 || values["warn-at"] !== void 0)) {
|
|
18123
18405
|
throw new Error("--on-reclaim and --warn-at are for a spot sandbox: add --spot.");
|
|
@@ -18165,9 +18447,9 @@ async function create(values) {
|
|
|
18165
18447
|
...allow ? { network: { allow } } : {},
|
|
18166
18448
|
...egressAsked ? { egress: egressAsked } : {},
|
|
18167
18449
|
...tailnetAsked === void 0 ? {} : { tailnet: tailnetAsked },
|
|
18168
|
-
...values.guild === void 0 ? {} : { guilds: values.guild.map(
|
|
18450
|
+
...values.guild === void 0 ? {} : { guilds: values.guild.map(guildAsked2) },
|
|
18169
18451
|
...ttlSeconds === void 0 ? {} : { ttlSeconds },
|
|
18170
|
-
...onTimeout === void 0 ? {} : { onTimeout
|
|
18452
|
+
...onTimeout === void 0 ? {} : { onTimeout },
|
|
18171
18453
|
...spotAsked === void 0 ? {} : { spot: spotAsked },
|
|
18172
18454
|
...sshKeys2 === void 0 ? {} : { sshKeys: sshKeys2 },
|
|
18173
18455
|
...given
|
|
@@ -18496,14 +18778,23 @@ async function confirmed(question) {
|
|
|
18496
18778
|
lines.close();
|
|
18497
18779
|
}
|
|
18498
18780
|
}
|
|
18499
|
-
|
|
18781
|
+
function pausedOnly(filter) {
|
|
18782
|
+
const statuses = filter.getAll("status");
|
|
18783
|
+
if (statuses.some((status) => status !== "paused")) {
|
|
18784
|
+
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.");
|
|
18785
|
+
}
|
|
18786
|
+
filter.delete("status");
|
|
18787
|
+
filter.append("status", "paused");
|
|
18788
|
+
return filter;
|
|
18789
|
+
}
|
|
18790
|
+
async function bulk(action, filter, options, yes2, asJson, confirm, word) {
|
|
18500
18791
|
const previewed = await request("/v1/bulk-actions/preview", { method: "POST", body: JSON.stringify({ action, options, select: { filter: filterOf(filter) } }) });
|
|
18501
18792
|
const preview = await readBody(previewed);
|
|
18502
18793
|
if (!previewed.ok) {
|
|
18503
18794
|
fail(previewed.status, preview);
|
|
18504
18795
|
}
|
|
18505
18796
|
const read2 = preview;
|
|
18506
|
-
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` : ""}.
|
|
18797
|
+
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` : ""}.
|
|
18507
18798
|
`);
|
|
18508
18799
|
process.stderr.write(`They cost ${dollarsOf(read2.microsPerHour.now)} an hour now, and ${dollarsOf(read2.microsPerHour.after)} an hour after.
|
|
18509
18800
|
`);
|
|
@@ -18648,8 +18939,8 @@ async function lifecycle(action, id, headers = {}, sent) {
|
|
|
18648
18939
|
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.
|
|
18649
18940
|
`);
|
|
18650
18941
|
}
|
|
18651
|
-
if (
|
|
18652
|
-
process.stderr.write(`
|
|
18942
|
+
if (action === "pause") {
|
|
18943
|
+
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.
|
|
18653
18944
|
`);
|
|
18654
18945
|
}
|
|
18655
18946
|
const response = await request(`/v1/sandboxes/${encodeURIComponent(id)}/${action}`, { method: "POST", headers, ...sent === void 0 ? {} : { body: JSON.stringify(sent) } });
|
|
@@ -18658,34 +18949,34 @@ async function lifecycle(action, id, headers = {}, sent) {
|
|
|
18658
18949
|
fail(response.status, body);
|
|
18659
18950
|
}
|
|
18660
18951
|
sayBurstFee(response);
|
|
18661
|
-
if (action === "stop" && response.status === 202) {
|
|
18662
|
-
body = await stoppedAfter(id, response.headers.get("operation-id"));
|
|
18952
|
+
if ((action === "stop" || action === "pause") && response.status === 202) {
|
|
18953
|
+
body = await stoppedAfter(id, response.headers.get("operation-id"), action === "pause" ? "pause" : "stop");
|
|
18663
18954
|
}
|
|
18664
18955
|
process.stdout.write(`${JSON.stringify(body, null, 2)}
|
|
18665
18956
|
`);
|
|
18666
18957
|
const memoryLost = Boolean(body) && typeof body === "object" ? body["memoryLost"] : null;
|
|
18667
|
-
if (typeof memoryLost === "string" && memoryLost !== "" && (action === "start" ||
|
|
18958
|
+
if (typeof memoryLost === "string" && memoryLost !== "" && (action === "start" || action === "resume" || action === "pause")) {
|
|
18668
18959
|
process.stderr.write(`${memoryLost}
|
|
18669
18960
|
`);
|
|
18670
18961
|
}
|
|
18671
|
-
if (action === "start" && response.status === 202) {
|
|
18962
|
+
if ((action === "start" || action === "resume") && response.status === 202) {
|
|
18672
18963
|
const archived = Boolean(body) && typeof body === "object" && body["archived"] === true;
|
|
18673
18964
|
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";
|
|
18674
18965
|
process.stderr.write(
|
|
18675
|
-
|
|
18966
|
+
`${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.
|
|
18676
18967
|
`
|
|
18677
18968
|
);
|
|
18678
18969
|
}
|
|
18679
18970
|
}
|
|
18680
18971
|
async function resize(id, size2, now, cancel, maxBurstFee, asJson) {
|
|
18681
18972
|
if (!id) {
|
|
18682
|
-
throw new Error("resize requires <sandbox-id> and its new size: tiny, small, medium or
|
|
18973
|
+
throw new Error("resize requires <sandbox-id> and its new size: tiny, small, medium, large or xlarge");
|
|
18683
18974
|
}
|
|
18684
18975
|
if (cancel && (size2 !== void 0 || now)) {
|
|
18685
18976
|
throw new Error("--cancel takes away a size that waits for the next start, and goes with no size and no --now");
|
|
18686
18977
|
}
|
|
18687
18978
|
if (!cancel && (size2 === void 0 || !isMachineSize(size2))) {
|
|
18688
|
-
throw new Error("resize takes the new size: tiny, small, medium or
|
|
18979
|
+
throw new Error("resize takes the new size: tiny, small, medium, large or xlarge");
|
|
18689
18980
|
}
|
|
18690
18981
|
if (maxBurstFee !== void 0 && !now) {
|
|
18691
18982
|
throw new Error("--max-burst-fee goes with --now: it caps what the restart's start pays in burst fees");
|
|
@@ -18734,22 +19025,24 @@ function sizeOf2(sandbox) {
|
|
|
18734
19025
|
const size2 = typeof sandbox["size"] === "string" ? sandbox["size"] : "";
|
|
18735
19026
|
return typeof sandbox["pendingSize"] === "string" ? `${size2} (${sandbox["pendingSize"]} from its next start)` : size2;
|
|
18736
19027
|
}
|
|
18737
|
-
async function stoppedAfter(id, operationId) {
|
|
18738
|
-
|
|
19028
|
+
async function stoppedAfter(id, operationId, word = "stop") {
|
|
19029
|
+
const done2 = word === "pause" ? "paused" : "stopped";
|
|
19030
|
+
process.stderr.write(`Still writing its memory. Waiting until it has ${done2}.
|
|
19031
|
+
`);
|
|
18739
19032
|
const deadline = Date.now() + 6e5;
|
|
18740
19033
|
for (; ; ) {
|
|
18741
19034
|
const sandbox = await call2(`/v1/sandboxes/${encodeURIComponent(id)}`, { method: "GET" });
|
|
18742
|
-
if (sandbox["status"] === "stopped") {
|
|
19035
|
+
if (sandbox["status"] === "stopped" || sandbox["status"] === "paused") {
|
|
18743
19036
|
return sandbox;
|
|
18744
19037
|
}
|
|
18745
19038
|
if (operationId !== null) {
|
|
18746
19039
|
const { operation } = await call2(`/v1/operations/${encodeURIComponent(operationId)}`, { method: "GET" });
|
|
18747
19040
|
if (operation.status === "failed") {
|
|
18748
|
-
throw new Error(`${id} was not
|
|
19041
|
+
throw new Error(`${id} was not ${done2}: ${operation.error ?? `the ${word} failed`}`);
|
|
18749
19042
|
}
|
|
18750
19043
|
}
|
|
18751
19044
|
if (Date.now() > deadline) {
|
|
18752
|
-
throw new Error(`${id} was still writing its memory after ten minutes. The
|
|
19045
|
+
throw new Error(`${id} was still writing its memory after ten minutes. The ${word} goes on: agental list says when it has ${done2}.`);
|
|
18753
19046
|
}
|
|
18754
19047
|
await new Promise((resolve) => setTimeout(resolve, 3e3));
|
|
18755
19048
|
}
|
|
@@ -19493,7 +19786,7 @@ async function template(positionals, values) {
|
|
|
19493
19786
|
throw new Error("--snapshot, --image and --new-machine say two things: give one.");
|
|
19494
19787
|
}
|
|
19495
19788
|
if (values.size !== void 0 && !isMachineSize(values.size)) {
|
|
19496
|
-
throw new Error("--size must be tiny, small, medium or
|
|
19789
|
+
throw new Error("--size must be tiny, small, medium, large or xlarge");
|
|
19497
19790
|
}
|
|
19498
19791
|
const ttlSeconds = ttlOption(values.ttl);
|
|
19499
19792
|
if (values.spot && values.standard) {
|
|
@@ -19929,7 +20222,7 @@ async function dataRetention(positionals, asJson) {
|
|
|
19929
20222
|
}
|
|
19930
20223
|
async function ci(positionals, options) {
|
|
19931
20224
|
const [what, repo, ...rest] = positionals;
|
|
19932
|
-
const usage = "ci takes nothing, jobs [<owner/repo>] [--limit <n>], set <owner/repo> [--size tiny|small|medium|large | --size default] [--pool <n> | --pool default] [--template <template> | --template default], or reset <owner/repo>";
|
|
20225
|
+
const usage = "ci takes nothing, jobs [<owner/repo>] [--limit <n>], set <owner/repo> [--size tiny|small|medium|large|xlarge | --size default] [--pool <n> | --pool default] [--template <template> | --template default], or reset <owner/repo>";
|
|
19933
20226
|
if (rest.length > 0 || what === void 0 && repo !== void 0 || what !== void 0 && what !== "set" && what !== "reset" && what !== "jobs") {
|
|
19934
20227
|
throw new Error(usage);
|
|
19935
20228
|
}
|
|
@@ -20011,8 +20304,8 @@ async function ci(positionals, options) {
|
|
|
20011
20304
|
let size2;
|
|
20012
20305
|
if (options.size !== void 0) {
|
|
20013
20306
|
size2 = options.size === "default" ? null : options.size;
|
|
20014
|
-
if (size2 !== null && !["tiny", "small", "medium", "large"].includes(size2)) {
|
|
20015
|
-
throw new Error("--size is tiny, small, medium or
|
|
20307
|
+
if (size2 !== null && !["tiny", "small", "medium", "large", "xlarge"].includes(size2)) {
|
|
20308
|
+
throw new Error("--size is tiny, small, medium, large or xlarge, or default.");
|
|
20016
20309
|
}
|
|
20017
20310
|
}
|
|
20018
20311
|
let templateId = before?.templateId ?? null;
|
|
@@ -20245,6 +20538,9 @@ function wholeOrCents(micros) {
|
|
|
20245
20538
|
return micros % 1e6 === 0 ? wholeMoney(micros) : money(micros);
|
|
20246
20539
|
}
|
|
20247
20540
|
function money(micros) {
|
|
20541
|
+
if (micros > 0 && micros < 5e3) {
|
|
20542
|
+
return "<$0.01";
|
|
20543
|
+
}
|
|
20248
20544
|
return `$${(micros / 1e6).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
20249
20545
|
}
|
|
20250
20546
|
var REPLAY_WHY = {
|
|
@@ -20506,7 +20802,7 @@ function pricesForPeople(body) {
|
|
|
20506
20802
|
],
|
|
20507
20803
|
[
|
|
20508
20804
|
...body.free ? [`Free needs a card saved, charged nothing; it runs ${body.free.unpaidUnits} units at once until your first top-up.`] : [],
|
|
20509
|
-
...body.tiers.some((tier) => tier.runningUnits !== void 0) ? ["Counted in units: a tiny sandbox is 1, a small 2, a medium 4, a large 8."] : []
|
|
20805
|
+
...body.tiers.some((tier) => tier.runningUnits !== void 0) ? ["Counted in units: a tiny sandbox is 1, a small 2, a medium 4, a large 8, an xlarge 16."] : []
|
|
20510
20806
|
]
|
|
20511
20807
|
);
|
|
20512
20808
|
}
|
|
@@ -20567,7 +20863,7 @@ function describePrices(body) {
|
|
|
20567
20863
|
);
|
|
20568
20864
|
}
|
|
20569
20865
|
if (body.tiers.some((tier) => tier.runningUnits !== void 0)) {
|
|
20570
|
-
out2.push(" Counted in units: a tiny sandbox is 1, a small 2, a medium 4, a large 8. Free starts are in any 15 minutes.");
|
|
20866
|
+
out2.push(" Counted in units: a tiny sandbox is 1, a small 2, a medium 4, a large 8, an xlarge 16. Free starts are in any 15 minutes.");
|
|
20571
20867
|
}
|
|
20572
20868
|
}
|
|
20573
20869
|
if (body.burstFee) {
|
|
@@ -20673,7 +20969,7 @@ function describeLimits(body, today, endsNow) {
|
|
|
20673
20969
|
};
|
|
20674
20970
|
const range = today ? "today (UTC)" : `from ${String(answer6["from"] ?? "")} to ${String(answer6["to"] ?? "")}`;
|
|
20675
20971
|
const lines = [
|
|
20676
|
-
`running: ${units(number(now, "runningMb"))} of ${number(now, "runningUnits").toLocaleString("en-US")} units (a tiny is 1, a small 2, a medium 4, a large 8); at the running count ${duration(number(answer6, "atRunningCountMs"))} ${range}`
|
|
20972
|
+
`running: ${units(number(now, "runningMb"))} of ${number(now, "runningUnits").toLocaleString("en-US")} units (a tiny is 1, a small 2, a medium 4, a large 8, an xlarge 16); at the running count ${duration(number(answer6, "atRunningCountMs"))} ${range}`
|
|
20677
20973
|
];
|
|
20678
20974
|
const bursts = Array.isArray(answer6["bursts"]) ? answer6["bursts"] : [];
|
|
20679
20975
|
const open2 = endsNow ? bursts.find((one) => one["endedAt"] === null && typeof one["startedAt"] === "string") : void 0;
|
|
@@ -20814,8 +21110,8 @@ function sandboxesForPeople(sandboxes2, names2, sorted) {
|
|
|
20814
21110
|
const status = (sandbox) => {
|
|
20815
21111
|
const word = text(sandbox["status"]) || "unknown";
|
|
20816
21112
|
const stops = word === "running" ? until(text(sandbox["autoStopAt"])) : null;
|
|
20817
|
-
const stopped = word === "stopped" ? ago(text(sandbox["stoppedAt"])) : null;
|
|
20818
|
-
return stops ? `running, stops ${stops}` : stopped ?
|
|
21113
|
+
const stopped = word === "stopped" || word === "paused" ? ago(text(sandbox["stoppedAt"])) : null;
|
|
21114
|
+
return stops ? `running, stops ${stops}` : stopped ? `${word} ${stopped}` : word;
|
|
20819
21115
|
};
|
|
20820
21116
|
const rows = [
|
|
20821
21117
|
["", "ID", "NAME", "SIZE", "TEMPLATE", "STATUS", ...showSpot ? ["SPOT"] : [], ...showVm ? ["VM"] : [], ...showOutbound ? ["OUTBOUND"] : [], ...showTags ? ["TAGS"] : []],
|
|
@@ -20863,7 +21159,7 @@ function boxNamed(value) {
|
|
|
20863
21159
|
}
|
|
20864
21160
|
return value?.trim();
|
|
20865
21161
|
}
|
|
20866
|
-
function
|
|
21162
|
+
function guildAsked2(given) {
|
|
20867
21163
|
const colon = given.indexOf(":");
|
|
20868
21164
|
if (colon === -1) {
|
|
20869
21165
|
return { guild: given.trim() };
|
|
@@ -21006,7 +21302,7 @@ Setting up
|
|
|
21006
21302
|
agental completion zsh|bash|fish
|
|
21007
21303
|
|
|
21008
21304
|
Usage
|
|
21009
|
-
agental create [--name <name>] [--template <template>] [--snapshot <snapshot-id> | --image <image>] [--size tiny|small|medium|large] [--region <region>[,<region>...]] [--ttl <time> | --ttl default] [--on-timeout delete|stop|
|
|
21305
|
+
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>]
|
|
21010
21306
|
[--spot [--on-reclaim delete|stop] [--warn-at <chance>] | --standard]
|
|
21011
21307
|
${operator ? "[--box <name-or-id>] " : ""}[--allow <address>[,<address>...]] [--egress box | residential:<country>[:sticky|rotating]] [--max-burst-fee <dollars>]
|
|
21012
21308
|
[--ssh-key <public-key-or-file>]... [--tag <tag>[,<tag>...]]... [--meta <key>=<value>]...
|
|
@@ -21030,13 +21326,17 @@ Usage
|
|
|
21030
21326
|
agental shell <sandbox-id> --close <shell> end a kept shell
|
|
21031
21327
|
agental delete <sandbox-id>
|
|
21032
21328
|
agental start <sandbox-id> [--max-burst-fee <dollars>] [--without-memory]
|
|
21033
|
-
agental stop <sandbox-id>
|
|
21034
|
-
agental
|
|
21329
|
+
agental stop <sandbox-id>
|
|
21330
|
+
agental pause <sandbox-id> stop it with its memory kept, to resume where it was
|
|
21331
|
+
agental resume <sandbox-id> [--max-burst-fee <dollars>]
|
|
21332
|
+
agental pause --where '<words>' [--yes]
|
|
21333
|
+
agental resume --where '<words>' [--yes] the paused sandboxes the words find
|
|
21334
|
+
agental stop --where '<words>' [--yes] every sandbox the words find, as one bulk action
|
|
21035
21335
|
agental start --where '<words>' [--yes]
|
|
21036
21336
|
agental delete --where '<words>' [--confirm <count>] asks for the count to be typed
|
|
21037
21337
|
agental bulk-actions [list | show <id> | cancel <id>] [--json]
|
|
21038
21338
|
agental recover <sandbox-id> [--max-burst-fee <dollars>]
|
|
21039
|
-
agental resize <sandbox-id> tiny|small|medium|large [--now] [--max-burst-fee <dollars>] [--json]
|
|
21339
|
+
agental resize <sandbox-id> tiny|small|medium|large|xlarge [--now] [--max-burst-fee <dollars>] [--json]
|
|
21040
21340
|
agental resize <sandbox-id> --cancel [--json] a size that waits for its next start, taken away
|
|
21041
21341
|
agental auto-stop <sandbox-id> [--in <time> | --at <date-time> | --never] [--json]
|
|
21042
21342
|
agental network <sandbox-id> [--allow <address-or-name>[,<address-or-name>...] | --none] [--json]
|
|
@@ -21051,7 +21351,7 @@ Usage
|
|
|
21051
21351
|
agental template show <template> [--json]
|
|
21052
21352
|
agental template rename <template> <new-name>
|
|
21053
21353
|
agental template delete <template> [--pause-jobs]
|
|
21054
|
-
agental template start <template> [--size tiny|small|medium|large] [--snapshot <snapshot-id> | --image <image> | --new-machine] [--ttl <time> | --ttl default] [--region <region> | --region default] [--spot [--on-reclaim delete|stop] [--warn-at <chance>] | --standard]
|
|
21354
|
+
agental template start <template> [--size tiny|small|medium|large|xlarge] [--snapshot <snapshot-id> | --image <image> | --new-machine] [--ttl <time> | --ttl default] [--region <region> | --region default] [--spot [--on-reclaim delete|stop] [--warn-at <chance>] | --standard]
|
|
21055
21355
|
agental template network <template> [open | blocked | allowlist <address-or-name>...] [--json]
|
|
21056
21356
|
agental template egress <template> [box | residential <country> [sticky | rotating]] [--json]
|
|
21057
21357
|
agental template tailnet <template> [join --tag <tag>... [--accept <range>]... [--exit-node <ip>] [--keep-address] | off] [--json]
|
|
@@ -21072,24 +21372,24 @@ Usage
|
|
|
21072
21372
|
agental metrics <sandbox-id> [--since <date-time>] [--until <date-time>] [--step <seconds>] [--json]
|
|
21073
21373
|
agental metrics --running [--since <date-time>] [--until <date-time>] [--step <seconds>] [--json]
|
|
21074
21374
|
agental telemetry [set <endpoint> [-H <name>=<value>]... | test | unset] [--json]
|
|
21075
|
-
agental ci [jobs [<owner/repo>] [--limit <n>] | set <owner/repo> [--size tiny|small|medium|large | --size default] [--pool <n> | --pool default] [--template <template> | --template default] | reset <owner/repo>] [--json]
|
|
21375
|
+
agental ci [jobs [<owner/repo>] [--limit <n>] | set <owner/repo> [--size tiny|small|medium|large|xlarge | --size default] [--pool <n> | --pool default] [--template <template> | --template default] | reset <owner/repo>] [--json]
|
|
21076
21376
|
agental data-retention [1 | 7 | 30 | 90 | never] [--json]
|
|
21077
21377
|
agental jobs [--sandbox <sandbox-id> | --template <template>] [--json]
|
|
21078
21378
|
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>]
|
|
21079
|
-
[--if-stopped start|skip] [--
|
|
21379
|
+
[--if-stopped start|skip] [--pause-after | --delete-after] [--overlap skip|replace|parallel] [--retries <0-5>] [--alerts email|webhook|both|none]
|
|
21080
21380
|
[--max-monthly-spend <dollars>]
|
|
21081
|
-
[--input <NAME>[=<default>]]... [--secret-input <NAME>[=<default>]]... [--after-job <job>[:succeeded|failed]]... [--on-mail <sandbox>]...
|
|
21381
|
+
[--input <NAME>[=<default>]]... [--secret-input <NAME>[=<default>]]... [--after-job <job>[:succeeded|failed]]... [--on-mail <sandbox>]... [--on-guild-request <guild>:<identity>]...
|
|
21082
21382
|
[--json] -- <command> [args...]
|
|
21083
|
-
agental job add [<name>] --template <template> [--size tiny|small|medium|large] [--keep-failed-for 0|30m|24h|7d] [--every 1m|15m|1h|1d | --cron "<m h dom mon dow>" [--tz <zone>] | --at <date-time>]
|
|
21383
|
+
agental job add [<name>] --template <template> [--size tiny|small|medium|large|xlarge] [--keep-failed-for 0|30m|24h|7d] [--every 1m|15m|1h|1d | --cron "<m h dom mon dow>" [--tz <zone>] | --at <date-time>]
|
|
21084
21384
|
[--timeout <time>] [--overlap skip|replace|parallel] [--retries <0-5>] [--alerts email|webhook|both|none] [--max-monthly-spend <dollars>]
|
|
21085
|
-
[--input <NAME>[=<default>]]... [--secret-input <NAME>[=<default>]]... [--after-job <job>[:succeeded|failed]]... [--on-mail <sandbox>]...
|
|
21385
|
+
[--input <NAME>[=<default>]]... [--secret-input <NAME>[=<default>]]... [--after-job <job>[:succeeded|failed]]... [--on-mail <sandbox>]... [--on-guild-request <guild>:<identity>]...
|
|
21086
21386
|
[--json] -- <command> [args...] a fresh sandbox for each run
|
|
21087
21387
|
agental job list [--sandbox <sandbox-id> | --template <template>] [--json]
|
|
21088
21388
|
agental job get|delete|pause|resume <job> [--json]
|
|
21089
21389
|
agental job update <job> [--sandbox <sandbox-id> | --template <template> [--size <size>]] [--keep-failed-for <time>] [--every <time> | --cron "<expr>" | --at <date-time>] [--tz <zone>]
|
|
21090
|
-
[--name <name>] [--timeout <time>] [--if-stopped start|skip] [--
|
|
21390
|
+
[--name <name>] [--timeout <time>] [--if-stopped start|skip] [--pause-after | --delete-after | --disk-only] [--overlap skip|replace|parallel]
|
|
21091
21391
|
[--retries <0-5>] [--alerts email|webhook|both|none] [--max-monthly-spend <dollars>|none] [--input <NAME>[=<default>]]... [--secret-input <NAME>[=<default>]]...
|
|
21092
|
-
[--after-job <job>[:succeeded|failed]]... [--on-mail <sandbox>]... [--no-events] [--json] [-- <command> [args...]]
|
|
21392
|
+
[--after-job <job>[:succeeded|failed]]... [--on-mail <sandbox>]... [--on-guild-request <guild>:<identity>]... [--no-events] [--json] [-- <command> [args...]]
|
|
21093
21393
|
agental job run <job> [--input <NAME>=<value>]... [--wait[=<seconds>]] [--json]
|
|
21094
21394
|
agental job again <job> <run-id> [--wait[=<seconds>]] [--json] run it again with what that run was given
|
|
21095
21395
|
agental job runs <job> [--limit <n>] [--json]
|
|
@@ -21123,12 +21423,14 @@ Usage
|
|
|
21123
21423
|
agental webhook delete <webhook-id>
|
|
21124
21424
|
agental servers [--json]
|
|
21125
21425
|
agental servers offload [on|off] [--over <percent>] [--json]
|
|
21426
|
+
agental servers window [--day <day> --hour <0-23> --tz <zone> [--hours <1-12>] | --off] [--json]
|
|
21126
21427
|
agental servers core-days [--month <yyyy-mm>] [--json]
|
|
21127
21428
|
agental server add <label> [--json] its install line and join token, shown once
|
|
21128
21429
|
agental server show <server> [--json]
|
|
21129
21430
|
agental server readings <server> [--since <date-time>] [--until <date-time>] [--every 1|5|15|60] [--json]
|
|
21130
21431
|
agental server token <server> [--json] a new join token; the old one stops at once
|
|
21131
21432
|
agental server drain <server> [--json]
|
|
21433
|
+
agental server open <server> [--json] takes new sandboxes again after a drain
|
|
21132
21434
|
agental server gone <server> --reason <text> [--yes] [--json] cannot be undone
|
|
21133
21435
|
agental server remove <server> [--json]
|
|
21134
21436
|
agental claude [--json]
|
|
@@ -21162,10 +21464,11 @@ ${FILES_USAGE.map((line) => ` ${line}`).join("\n")}
|
|
|
21162
21464
|
agental ssh-config <sandbox-id>
|
|
21163
21465
|
agental ssh-keys <sandbox-id> [--remove <key-id>] [--json]
|
|
21164
21466
|
agental ssh-off <sandbox-id>
|
|
21165
|
-
agental site <sandbox-id> [--json] its sites:
|
|
21467
|
+
agental site <sandbox-id> [--json] its sites: links to its ports, and who may open each
|
|
21166
21468
|
agental site list <sandbox-id> [--json]
|
|
21167
|
-
agental site add <sandbox-id> <port> [--json]
|
|
21469
|
+
agental site add <sandbox-id> <port> [--private] [--json] a link to a port, printed; --private: your organization only
|
|
21168
21470
|
agental site rm <sandbox-id> <site-id> the link stops working, for good
|
|
21471
|
+
agental site access <sandbox-id> <site-id> anyone|organization [--json] who may open it
|
|
21169
21472
|
agental site stats <sandbox-id> <site-id> [--range 24h|7d] [--json] its visits, pages, sources, countries
|
|
21170
21473
|
agental site analytics on|off <sandbox-id> <site-id> [--yes] [--json] off deletes its figures
|
|
21171
21474
|
agental site analytics org [on|off] [--informed] [--yes] [--json] the organization's switch
|
|
@@ -21213,7 +21516,7 @@ next start boots it at it. A running one keeps running, and paying, as its size
|
|
|
21213
21516
|
stopped, and its next start gives it the new one, whoever starts it; --now stops it and starts it
|
|
21214
21517
|
again at the new size now, and every process in it ends, as on a stop. --cancel takes a size that
|
|
21215
21518
|
waits away. Memory a stop kept is let go: the next start boots from the disk. While a size waits,
|
|
21216
|
-
|
|
21519
|
+
pause is refused.
|
|
21217
21520
|
recover gets a sandbox that is stuck going again: what runs in it is killed, its disk is kept,
|
|
21218
21521
|
and it ends running. One that is stopped is started, and pays a burst fee as a start does.
|
|
21219
21522
|
Start of a sandbox that was archived is accepted and finished afterwards: list shows it as
|
|
@@ -21222,8 +21525,8 @@ A sandbox runs until it is stopped, unless it has a time limit: then it is stopp
|
|
|
21222
21525
|
run that long since its last start. create --ttl and template start --ttl set one, as 45m, 2h or
|
|
21223
21526
|
1d, and --ttl default takes the deployment's, which is none unless it says otherwise. When the
|
|
21224
21527
|
time limit runs out the sandbox is deleted, with its disk, unless create --on-timeout stop said to
|
|
21225
|
-
stop it and keep its disk, or --on-timeout
|
|
21226
|
-
|
|
21528
|
+
stop it and keep its disk, or --on-timeout pause to keep its memory too, so agental resume
|
|
21529
|
+
carries on where it was (after the account's first top-up: before it, refused with
|
|
21227
21530
|
memory_needs_top_up); agental stop always keeps the disk. auto-stop
|
|
21228
21531
|
says when a running sandbox is to be stopped, with --in or --at moves that stop, later or sooner,
|
|
21229
21532
|
for the run under way, and with --never takes its time limit away, for this run and the next.
|
|
@@ -21337,8 +21640,8 @@ or 1d, counted from now, never more often than every minute, or --cron with five
|
|
|
21337
21640
|
time zone --tz names, UTC unless it does, says when; --at a date and time runs it once. With none
|
|
21338
21641
|
of them it runs only when asked, by job run. Its name is lower-case letters, digits and dashes,
|
|
21339
21642
|
job-1, job-2 and so on when none is given. When a run finds the sandbox stopped it starts it,
|
|
21340
|
-
runs, and stops it again when the command ends, keeping its disk, or
|
|
21341
|
-
--
|
|
21643
|
+
runs, and stops it again when the command ends, keeping its disk, or pauses it with
|
|
21644
|
+
--pause-after; with --if-stopped skip it runs only while the sandbox runs. A sandbox someone
|
|
21342
21645
|
started again, sent a command or moved the stop of meanwhile is left running. With --at,
|
|
21343
21646
|
--delete-after deletes the sandbox after the run, if the command exits 0, with a key that may
|
|
21344
21647
|
delete it; a run that fails leaves it to be looked at, and update --disk-only takes it back.
|
|
@@ -21361,9 +21664,13 @@ to update, they replace the ones the job had. A run by the clock is given the de
|
|
|
21361
21664
|
one of its runs was given, secret values too.
|
|
21362
21665
|
Events start a job too: add and update take --after-job JOB to run it when a run of JOB ends,
|
|
21363
21666
|
--after-job JOB:succeeded or JOB:failed for one end alone (failed: for good, after its retries),
|
|
21364
|
-
|
|
21365
|
-
|
|
21366
|
-
|
|
21667
|
+
--on-mail SANDBOX to run it when mail arrives at that sandbox's address, and --on-guild-request
|
|
21668
|
+
GUILD:IDENTITY, an identity its sandbox holds, to start the stopped sandbox for a request to it
|
|
21669
|
+
(for a role, one stopped holder alone, and none while a holder runs), its command then as
|
|
21670
|
+
agental guild work GUILD --as IDENTITY --once -- claude -p. Its command is told what started it:
|
|
21671
|
+
AGENTAL_TRIGGER_JOB, AGENTAL_TRIGGER_RUN and AGENTAL_TRIGGER_OUTCOME; AGENTAL_TRIGGER_SANDBOX and
|
|
21672
|
+
AGENTAL_TRIGGER_EMAIL, the message's id; or AGENTAL_TRIGGER_GUILD, AGENTAL_TRIGGER_MEMBER and
|
|
21673
|
+
AGENTAL_TRIGGER_REQUEST. Given to update, they replace
|
|
21367
21674
|
the events the job had; --no-events takes them all away. A chain that comes back to the job is
|
|
21368
21675
|
refused, and events that start 60 runs of a job in a minute pause it.
|
|
21369
21676
|
--max-monthly-spend 25 gives a job a spending limit in dollars: once its runs this calendar month
|
|
@@ -21425,13 +21732,16 @@ the one-time token in that line, shown this once; it needs an Enterprise contrac
|
|
|
21425
21732
|
gives a server that has not joined a new token, and the old one stops working. A <server> is its id
|
|
21426
21733
|
or its label. show says how it stands; readings is its memory, CPU and disk over the last day, a
|
|
21427
21734
|
line an hour unless --every says otherwise, noting the times it did not answer. drain takes it out
|
|
21428
|
-
of placement and stops or moves nothing. remove removes one that holds nothing and prints the line
|
|
21735
|
+
of placement and stops or moves nothing, and open puts it back. remove removes one that holds nothing and prints the line
|
|
21429
21736
|
that takes its agent off. gone says a server is gone for good, once it is drained and its agent has
|
|
21430
21737
|
been away 24 hours: its sandboxes are said lost, and it cannot be undone, so it asks first unless
|
|
21431
21738
|
--yes, and --reason says why. servers offload says whether a new sandbox that names no region
|
|
21432
21739
|
starts on agental's servers when none of yours has room under --over percent of its memory, CPU
|
|
21433
21740
|
and disk (80 to begin with); on and off turn it on and off. Such a sandbox is a hosted one, billed as
|
|
21434
|
-
one, from your credits. servers
|
|
21741
|
+
one, from your credits. servers window says, and sets, the weekly window in which your servers take
|
|
21742
|
+
a new agent: --day, --hour on the clock of --tz (an IANA zone, as Europe/Berlin) and --hours (4 to
|
|
21743
|
+
begin with); --off has them take one at once. A security release reaches them outside it too.
|
|
21744
|
+
servers core-days is the month's cores as they are counted for billing, day by day.
|
|
21435
21745
|
org lists the organizations you are in, your own and your teams, and marks the one this command
|
|
21436
21746
|
acts in. A key acts in the organization it was made in, for good, so org use signs in again in
|
|
21437
21747
|
the browser for a key made in the one given, by its id or name, and deletes the key the command
|