agental 0.59.0 → 0.61.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 +54 -25
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7411,7 +7411,7 @@ import { parseArgs } from "node:util";
|
|
|
7411
7411
|
|
|
7412
7412
|
// ../src/cli-build.ts
|
|
7413
7413
|
var PUBLISHED = true;
|
|
7414
|
-
var CLI_VERSION = true ? "0.
|
|
7414
|
+
var CLI_VERSION = true ? "0.61.0" : "dev";
|
|
7415
7415
|
var DEFAULT_API_URL = true ? "https://agental.io" : "http://127.0.0.1:8741";
|
|
7416
7416
|
var PACKAGE_NAME = "agental";
|
|
7417
7417
|
var USER_AGENT = `agental-cli/${CLI_VERSION}`;
|
|
@@ -7924,6 +7924,9 @@ var KEY_ACTIONS = [
|
|
|
7924
7924
|
"template.write",
|
|
7925
7925
|
"bucket.read",
|
|
7926
7926
|
"bucket.write",
|
|
7927
|
+
"image.read",
|
|
7928
|
+
"image.build",
|
|
7929
|
+
"image.delete",
|
|
7927
7930
|
"guild.read",
|
|
7928
7931
|
"guild.write",
|
|
7929
7932
|
"guild.join",
|
|
@@ -7950,10 +7953,10 @@ var FULL_SANDBOX = [
|
|
|
7950
7953
|
];
|
|
7951
7954
|
var PRESETS = {
|
|
7952
7955
|
// Every read, apart from secrets and mail, which are the two an agent should be given by name.
|
|
7953
|
-
"read-only": ["sandbox.read", "file.read", "job.read", "snapshot.read", "template.read", "bucket.read", "guild.read", "account.read"],
|
|
7956
|
+
"read-only": ["sandbox.read", "file.read", "job.read", "snapshot.read", "template.read", "bucket.read", "image.read", "guild.read", "account.read"],
|
|
7954
7957
|
"full-sandbox": [...FULL_SANDBOX, "job.read", "job.write", "job.run"],
|
|
7955
|
-
// A CI system runs the jobs it is given and reads how they went; it does not make them.
|
|
7956
|
-
ci: [...FULL_SANDBOX, "sandbox.create", "sandbox.fork", "sandbox.resume", "sandbox.delete-own", "job.read", "job.run"],
|
|
7958
|
+
// A CI system runs the jobs it is given and reads how they went; it does not make them. It builds images, and deletes none.
|
|
7959
|
+
ci: [...FULL_SANDBOX, "sandbox.create", "sandbox.fork", "sandbox.resume", "sandbox.delete-own", "job.read", "job.run", "image.read", "image.build"],
|
|
7957
7960
|
admin: [ALL_ACTIONS]
|
|
7958
7961
|
};
|
|
7959
7962
|
var PRESET_NAMES = Object.keys(PRESETS);
|
|
@@ -9433,6 +9436,7 @@ var COMMANDS = [
|
|
|
9433
9436
|
[" --allow <addresses>", "reach only these addresses, comma-separated"],
|
|
9434
9437
|
[" --egress <egress>", "box, or residential:<country>[:sticky|rotating]"],
|
|
9435
9438
|
[" --tailnet <tags> | off", "join the tailnet tagged so (tag:ci), or off for none"],
|
|
9439
|
+
[" --guild <g[:roles]>", "a guild it may join, in roles or any (repeatable)"],
|
|
9436
9440
|
[" --spot", "half the price, in spare room taken back when needed"],
|
|
9437
9441
|
[" --on-reclaim <what>", "with --spot: stop (default) or delete"],
|
|
9438
9442
|
[" --warn-at <chance>", "with --spot: warn at this chance, as 0.5 or 50%"],
|
|
@@ -9611,7 +9615,7 @@ var COMMANDS = [
|
|
|
9611
9615
|
usage: [
|
|
9612
9616
|
"agental guild [list] | show <guild> | delete <guild> [--yes]",
|
|
9613
9617
|
"agental guild create <guild> --roles <name[:seats],...> [--brief <text>] [--form <file.json>]",
|
|
9614
|
-
"agental guild attach <guild> <template> [--roles <role,...>] | detach <guild> <template>",
|
|
9618
|
+
"agental guild attach <guild> <template|sandbox> [--roles <role,...>] | detach <guild> <template|sandbox>",
|
|
9615
9619
|
"agental guild mine",
|
|
9616
9620
|
"agental guild join <guild> --as <name> --role <role> [--answer <key=value>]...",
|
|
9617
9621
|
"agental guild members <guild> | leave <guild> <identity> | handover <guild> <identity> <sandbox>",
|
|
@@ -9698,7 +9702,7 @@ var COMMANDS = [
|
|
|
9698
9702
|
{
|
|
9699
9703
|
name: "secrets",
|
|
9700
9704
|
summary: "Keep values and files out of a sandbox, or out of every sandbox of a template.",
|
|
9701
|
-
examples: ["agental secrets --template default set
|
|
9705
|
+
examples: ["agental secrets --template default set NODE_ENV=development", "agental secrets sbx_2a9a47e50daec64a"],
|
|
9702
9706
|
flags: [
|
|
9703
9707
|
["--template <template>", "the template's secrets, for every sandbox made from it"],
|
|
9704
9708
|
["--host <host>[,<host>...]", "set, hosts: keep the value out of the sandbox, sent only to these hosts"],
|
|
@@ -14077,6 +14081,13 @@ ${members2.map((member) => ` ${memberLine(member)}`).join("") || " none\n"}`
|
|
|
14077
14081
|
return;
|
|
14078
14082
|
}
|
|
14079
14083
|
case "attach": {
|
|
14084
|
+
if (third?.startsWith("sbx_")) {
|
|
14085
|
+
const roles2 = options.roles === void 0 ? {} : { roles: rolesOf(options.roles).map((role) => role.name) };
|
|
14086
|
+
const opened = await ask11(client, "PUT", `${at4(needed(name, "attach takes a guild"))}/sandboxes/${encodeURIComponent(third)}`, roles2);
|
|
14087
|
+
print4(options.json, opened, `Sandbox ${third} may join ${String(name)}${opened["roles"] ? ` as ${opened["roles"].join(" or ")}` : ", in any role"}.
|
|
14088
|
+
`);
|
|
14089
|
+
return;
|
|
14090
|
+
}
|
|
14080
14091
|
const template2 = await client.templateId(needed(third, "attach takes a guild and a template"));
|
|
14081
14092
|
const roles = options.roles === void 0 ? {} : { roles: rolesOf(options.roles).map((role) => role.name) };
|
|
14082
14093
|
const attached = await ask11(client, "PUT", `${at4(needed(name, "attach takes a guild"))}/templates/${encodeURIComponent(template2)}`, roles);
|
|
@@ -14085,6 +14096,12 @@ ${members2.map((member) => ` ${memberLine(member)}`).join("") || " none\n"}`
|
|
|
14085
14096
|
return;
|
|
14086
14097
|
}
|
|
14087
14098
|
case "detach": {
|
|
14099
|
+
if (third?.startsWith("sbx_")) {
|
|
14100
|
+
await ask11(client, "DELETE", `${at4(needed(name, "detach takes a guild"))}/sandboxes/${encodeURIComponent(third)}`);
|
|
14101
|
+
print4(options.json, { detached: third }, `Sandbox ${third} may no longer join ${String(name)}, but for identities it holds.
|
|
14102
|
+
`);
|
|
14103
|
+
return;
|
|
14104
|
+
}
|
|
14088
14105
|
const template2 = await client.templateId(needed(third, "detach takes a guild and a template"));
|
|
14089
14106
|
await ask11(client, "DELETE", `${at4(needed(name, "detach takes a guild"))}/templates/${encodeURIComponent(template2)}`);
|
|
14090
14107
|
print4(options.json, { detached: template2 }, `Sandboxes of ${template2} may no longer join ${String(name)}.
|
|
@@ -15618,6 +15635,8 @@ async function main() {
|
|
|
15618
15635
|
brief: { type: "string" },
|
|
15619
15636
|
form: { type: "string" },
|
|
15620
15637
|
as: { type: "string" },
|
|
15638
|
+
// create: a guild it may join beside its template's, as name or name:role,role (may be given again).
|
|
15639
|
+
guild: { type: "string", multiple: true },
|
|
15621
15640
|
answer: { type: "string", multiple: true },
|
|
15622
15641
|
// Guild messages: a role it is to, a request, the request it answers, the channel, a retry key, where to read from, and a place confirmed.
|
|
15623
15642
|
"to-role": { type: "string" },
|
|
@@ -15997,6 +16016,7 @@ async function create(values) {
|
|
|
15997
16016
|
...allow ? { network: { allow } } : {},
|
|
15998
16017
|
...egressAsked ? { egress: egressAsked } : {},
|
|
15999
16018
|
...tailnetAsked === void 0 ? {} : { tailnet: tailnetAsked },
|
|
16019
|
+
...values.guild === void 0 ? {} : { guilds: values.guild.map(guildAsked) },
|
|
16000
16020
|
...ttlSeconds === void 0 ? {} : { ttlSeconds },
|
|
16001
16021
|
...onTimeout === void 0 ? {} : { onTimeout: onTimeout.replaceAll("-", "_") },
|
|
16002
16022
|
...spotAsked === void 0 ? {} : { spot: spotAsked },
|
|
@@ -17552,8 +17572,11 @@ async function secrets(positionals, values) {
|
|
|
17552
17572
|
if (hosts !== void 0 && values.plain) {
|
|
17553
17573
|
throw new Error("--host and --plain say two things: give one.");
|
|
17554
17574
|
}
|
|
17555
|
-
if (hosts !== void 0
|
|
17556
|
-
|
|
17575
|
+
if (hosts !== void 0) {
|
|
17576
|
+
const where = sandboxId === void 0 ? `--template ${values.template ?? "<template>"}` : `--sandbox ${sandboxId}`;
|
|
17577
|
+
throw new Error(
|
|
17578
|
+
`secrets set --host sent the value as it is, and is retired: a value kept out of the sandbox is one of the account's secrets, sealed on this computer. Run agental secret set <NAME> --host <host>, then agental secret use <NAME> ${where}. Nothing was sent.`
|
|
17579
|
+
);
|
|
17557
17580
|
}
|
|
17558
17581
|
const pairs = args.map((arg) => {
|
|
17559
17582
|
const at5 = arg.indexOf("=");
|
|
@@ -17568,23 +17591,20 @@ async function secrets(positionals, values) {
|
|
|
17568
17591
|
for (const [name] of pairs) {
|
|
17569
17592
|
if (await keptOutNow(path6(name))) {
|
|
17570
17593
|
throw new Error(
|
|
17571
|
-
`${name} is kept out of the sandbox. Set without --host it would be plain, and its commands would read its value.
|
|
17594
|
+
`${name} is kept out of the sandbox. Set without --host it would be plain, and its commands would read its value. To keep a new value out, use agental secret set and agental secret use; --plain says its commands are to read it. Nothing was set.`
|
|
17572
17595
|
);
|
|
17573
17596
|
}
|
|
17574
17597
|
if (byTemplate.includes(name)) {
|
|
17575
17598
|
throw new Error(
|
|
17576
|
-
`${name} is kept out of the sandbox by its template. Set as the sandbox's own without --host, it would be used in place of the template's, and its commands would read its value.
|
|
17599
|
+
`${name} is kept out of the sandbox by its template. Set as the sandbox's own without --host, it would be used in place of the template's, and its commands would read its value. To keep the sandbox's own out, use agental secret set and agental secret use; --plain says its commands are to read it. Nothing was set.`
|
|
17577
17600
|
);
|
|
17578
17601
|
}
|
|
17579
17602
|
}
|
|
17580
17603
|
}
|
|
17581
17604
|
for (const [name, value] of pairs) {
|
|
17582
|
-
|
|
17583
|
-
process.stdout.write(
|
|
17584
|
-
|
|
17585
|
-
` : `set ${name}
|
|
17586
|
-
`
|
|
17587
|
-
);
|
|
17605
|
+
await call2(path6(name), { method: "PUT", body: JSON.stringify({ value }) });
|
|
17606
|
+
process.stdout.write(`set ${name}
|
|
17607
|
+
`);
|
|
17588
17608
|
}
|
|
17589
17609
|
return;
|
|
17590
17610
|
}
|
|
@@ -17895,7 +17915,7 @@ async function ciJobs(repo, limit, asJson) {
|
|
|
17895
17915
|
for (const job2 of body.jobs) {
|
|
17896
17916
|
const title = [job2.workflow, job2.name].filter(Boolean).join(" / ") || `job ${job2.jobId}`;
|
|
17897
17917
|
const took = job2.startedAt && job2.endedAt ? `${Math.round((Date.parse(job2.endedAt) - Date.parse(job2.startedAt)) / 1e3)}s` : "";
|
|
17898
|
-
const detail = [job2.repository, job2.branch, job2.size, took, job2.sandboxId, job2.error].filter(Boolean).join(" ");
|
|
17918
|
+
const detail = [job2.repository, job2.branch, job2.event?.replaceAll("_", " "), job2.size, took, job2.sandboxId, job2.error].filter(Boolean).join(" ");
|
|
17899
17919
|
process.stdout.write(`${job2.state.padEnd(9)} ${title} ${detail}
|
|
17900
17920
|
`);
|
|
17901
17921
|
}
|
|
@@ -18690,6 +18710,14 @@ function boxNamed(value) {
|
|
|
18690
18710
|
}
|
|
18691
18711
|
return value?.trim();
|
|
18692
18712
|
}
|
|
18713
|
+
function guildAsked(given) {
|
|
18714
|
+
const colon = given.indexOf(":");
|
|
18715
|
+
if (colon === -1) {
|
|
18716
|
+
return { guild: given.trim() };
|
|
18717
|
+
}
|
|
18718
|
+
const roles = given.slice(colon + 1).split(",").map((role) => role.trim()).filter((role) => role !== "");
|
|
18719
|
+
return { guild: given.slice(0, colon).trim(), ...roles.length === 0 ? {} : { roles } };
|
|
18720
|
+
}
|
|
18693
18721
|
function apiBase() {
|
|
18694
18722
|
return resolveApi(DEFAULT_URL, DEV_KEY).base;
|
|
18695
18723
|
}
|
|
@@ -18891,7 +18919,7 @@ Usage
|
|
|
18891
18919
|
agental template put <template> <sandbox-id>
|
|
18892
18920
|
agental secrets (<sandbox-id> | --template <template>) [--json]
|
|
18893
18921
|
agental secrets (<sandbox-id> | --template <template>) get <NAME> [--json] | unset <NAME>...
|
|
18894
|
-
agental secrets (<sandbox-id> | --template <template>) set <NAME>=<value>... [--
|
|
18922
|
+
agental secrets (<sandbox-id> | --template <template>) set <NAME>=<value>... [--plain]
|
|
18895
18923
|
agental secrets (<sandbox-id> | --template <template>) hosts <NAME> --host <host>[,<host>...] [--json]
|
|
18896
18924
|
agental secrets (<sandbox-id> | --template <template>) get-file <path> | put-file <path> (<local-file> | --text <text>) | rm-file <path>
|
|
18897
18925
|
agental metrics [--at <date-time>] [--json]
|
|
@@ -19092,8 +19120,10 @@ when template apply names it, or names none, which is every running sandbox on i
|
|
|
19092
19120
|
template put puts a sandbox on another template: it has that template's from its next command.
|
|
19093
19121
|
secrets lists a sandbox's own variables and files, or with --template a template's, and says
|
|
19094
19122
|
which variables are kept out of the sandbox. get prints a variable's value, and set sets one.
|
|
19095
|
-
|
|
19096
|
-
|
|
19123
|
+
A value kept out of the sandbox is one of the account's secrets: agental secret set seals it
|
|
19124
|
+
here and agental secret use gives it to a sandbox or a template; set with --host, which sent the
|
|
19125
|
+
value as it is, is refused. A variable kept out that way before stays so: its commands see a
|
|
19126
|
+
stand-in in place of its value, and the proxy on the sandbox's server puts the value in place of the stand-in on
|
|
19097
19127
|
HTTPS requests to those hosts, and nowhere else. Sent anywhere else, the stand-in is worth
|
|
19098
19128
|
nothing. A host is a name such as api.github.com, or *.example.com for every name under
|
|
19099
19129
|
example.com, with no scheme, port or path, and a variable has 1 to 10 of them. A name on the
|
|
@@ -19101,11 +19131,10 @@ Public Suffix List, such as github.io, is refused, and so is a wildcard over one
|
|
|
19101
19131
|
or *.co.uk. The value is never given back, to you or anyone: get prints the stand-in and the
|
|
19102
19132
|
hosts instead. The stand-in stays the same when the value is replaced, so a file that holds it
|
|
19103
19133
|
keeps working. hosts narrows the hosts without sending the value again: a host it is not sent
|
|
19104
|
-
to now is refused
|
|
19134
|
+
to now is refused. Set without --host, a
|
|
19105
19135
|
variable kept out would be plain, and its commands would read its value, and a sandbox's own
|
|
19106
19136
|
plain one would be used in place of one its template keeps out: set refuses both unless --plain
|
|
19107
|
-
says it is meant. Hosts do not open the template's outbound rule.
|
|
19108
|
-
/v1/policy says hiddenVariables.
|
|
19137
|
+
says it is meant. Hosts do not open the template's outbound rule.
|
|
19109
19138
|
metrics says what each of your sandboxes read at one moment, a line a sandbox: its CPU as a
|
|
19110
19139
|
percent, its memory and its disk as what is in use of what there is, and what its network
|
|
19111
19140
|
received and sent a second. The moment is now, or the one --at names. A sandbox that was stopped
|
|
@@ -19248,8 +19277,8 @@ owner or admin and a member's own for a member: what each may do, what it reache
|
|
|
19248
19277
|
the addresses it may be used from, and when and from where it was last used. key add makes one
|
|
19249
19278
|
that may do what --preset gives it, or what --actions names, and nothing more. The presets are
|
|
19250
19279
|
read-only, every read but secrets and mail; full-sandbox, the use of sandboxes that are there,
|
|
19251
|
-
stopping them included; ci, that and making, forking and resuming sandboxes
|
|
19252
|
-
own; and admin, everything. The actions are ${KEY_ACTIONS.join(", ")}, or * for every one.
|
|
19280
|
+
stopping them included; ci, that and making, forking and resuming sandboxes, deleting its
|
|
19281
|
+
own and building images; and admin, everything. The actions are ${KEY_ACTIONS.join(", ")}, or * for every one.
|
|
19253
19282
|
A preset is written out into its actions as the key is made, so a preset that grows later does
|
|
19254
19283
|
not widen it. --sandbox limits the key to those sandboxes, and --template to those templates
|
|
19255
19284
|
and the sandboxes on them; it reaches the sandboxes it makes as well. --expires stops it
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agental",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.61.0",
|
|
4
4
|
"description": "The agental command: Linux sandboxes for your agents, from the terminal. npx agental@latest signs you in and installs the agent skills.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "VERTIXER LTD",
|