agental 0.59.0 → 0.60.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.
Files changed (2) hide show
  1. package/dist/cli.js +28 -3
  2. 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.59.0" : "dev";
7414
+ var CLI_VERSION = true ? "0.60.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}`;
@@ -9433,6 +9433,7 @@ var COMMANDS = [
9433
9433
  [" --allow <addresses>", "reach only these addresses, comma-separated"],
9434
9434
  [" --egress <egress>", "box, or residential:<country>[:sticky|rotating]"],
9435
9435
  [" --tailnet <tags> | off", "join the tailnet tagged so (tag:ci), or off for none"],
9436
+ [" --guild <g[:roles]>", "a guild it may join, in roles or any (repeatable)"],
9436
9437
  [" --spot", "half the price, in spare room taken back when needed"],
9437
9438
  [" --on-reclaim <what>", "with --spot: stop (default) or delete"],
9438
9439
  [" --warn-at <chance>", "with --spot: warn at this chance, as 0.5 or 50%"],
@@ -9611,7 +9612,7 @@ var COMMANDS = [
9611
9612
  usage: [
9612
9613
  "agental guild [list] | show <guild> | delete <guild> [--yes]",
9613
9614
  "agental guild create <guild> --roles <name[:seats],...> [--brief <text>] [--form <file.json>]",
9614
- "agental guild attach <guild> <template> [--roles <role,...>] | detach <guild> <template>",
9615
+ "agental guild attach <guild> <template|sandbox> [--roles <role,...>] | detach <guild> <template|sandbox>",
9615
9616
  "agental guild mine",
9616
9617
  "agental guild join <guild> --as <name> --role <role> [--answer <key=value>]...",
9617
9618
  "agental guild members <guild> | leave <guild> <identity> | handover <guild> <identity> <sandbox>",
@@ -14077,6 +14078,13 @@ ${members2.map((member) => ` ${memberLine(member)}`).join("") || " none\n"}`
14077
14078
  return;
14078
14079
  }
14079
14080
  case "attach": {
14081
+ if (third?.startsWith("sbx_")) {
14082
+ const roles2 = options.roles === void 0 ? {} : { roles: rolesOf(options.roles).map((role) => role.name) };
14083
+ const opened = await ask11(client, "PUT", `${at4(needed(name, "attach takes a guild"))}/sandboxes/${encodeURIComponent(third)}`, roles2);
14084
+ print4(options.json, opened, `Sandbox ${third} may join ${String(name)}${opened["roles"] ? ` as ${opened["roles"].join(" or ")}` : ", in any role"}.
14085
+ `);
14086
+ return;
14087
+ }
14080
14088
  const template2 = await client.templateId(needed(third, "attach takes a guild and a template"));
14081
14089
  const roles = options.roles === void 0 ? {} : { roles: rolesOf(options.roles).map((role) => role.name) };
14082
14090
  const attached = await ask11(client, "PUT", `${at4(needed(name, "attach takes a guild"))}/templates/${encodeURIComponent(template2)}`, roles);
@@ -14085,6 +14093,12 @@ ${members2.map((member) => ` ${memberLine(member)}`).join("") || " none\n"}`
14085
14093
  return;
14086
14094
  }
14087
14095
  case "detach": {
14096
+ if (third?.startsWith("sbx_")) {
14097
+ await ask11(client, "DELETE", `${at4(needed(name, "detach takes a guild"))}/sandboxes/${encodeURIComponent(third)}`);
14098
+ print4(options.json, { detached: third }, `Sandbox ${third} may no longer join ${String(name)}, but for identities it holds.
14099
+ `);
14100
+ return;
14101
+ }
14088
14102
  const template2 = await client.templateId(needed(third, "detach takes a guild and a template"));
14089
14103
  await ask11(client, "DELETE", `${at4(needed(name, "detach takes a guild"))}/templates/${encodeURIComponent(template2)}`);
14090
14104
  print4(options.json, { detached: template2 }, `Sandboxes of ${template2} may no longer join ${String(name)}.
@@ -15618,6 +15632,8 @@ async function main() {
15618
15632
  brief: { type: "string" },
15619
15633
  form: { type: "string" },
15620
15634
  as: { type: "string" },
15635
+ // create: a guild it may join beside its template's, as name or name:role,role (may be given again).
15636
+ guild: { type: "string", multiple: true },
15621
15637
  answer: { type: "string", multiple: true },
15622
15638
  // 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
15639
  "to-role": { type: "string" },
@@ -15997,6 +16013,7 @@ async function create(values) {
15997
16013
  ...allow ? { network: { allow } } : {},
15998
16014
  ...egressAsked ? { egress: egressAsked } : {},
15999
16015
  ...tailnetAsked === void 0 ? {} : { tailnet: tailnetAsked },
16016
+ ...values.guild === void 0 ? {} : { guilds: values.guild.map(guildAsked) },
16000
16017
  ...ttlSeconds === void 0 ? {} : { ttlSeconds },
16001
16018
  ...onTimeout === void 0 ? {} : { onTimeout: onTimeout.replaceAll("-", "_") },
16002
16019
  ...spotAsked === void 0 ? {} : { spot: spotAsked },
@@ -17895,7 +17912,7 @@ async function ciJobs(repo, limit, asJson) {
17895
17912
  for (const job2 of body.jobs) {
17896
17913
  const title = [job2.workflow, job2.name].filter(Boolean).join(" / ") || `job ${job2.jobId}`;
17897
17914
  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(" ");
17915
+ const detail = [job2.repository, job2.branch, job2.event?.replaceAll("_", " "), job2.size, took, job2.sandboxId, job2.error].filter(Boolean).join(" ");
17899
17916
  process.stdout.write(`${job2.state.padEnd(9)} ${title} ${detail}
17900
17917
  `);
17901
17918
  }
@@ -18690,6 +18707,14 @@ function boxNamed(value) {
18690
18707
  }
18691
18708
  return value?.trim();
18692
18709
  }
18710
+ function guildAsked(given) {
18711
+ const colon = given.indexOf(":");
18712
+ if (colon === -1) {
18713
+ return { guild: given.trim() };
18714
+ }
18715
+ const roles = given.slice(colon + 1).split(",").map((role) => role.trim()).filter((role) => role !== "");
18716
+ return { guild: given.slice(0, colon).trim(), ...roles.length === 0 ? {} : { roles } };
18717
+ }
18693
18718
  function apiBase() {
18694
18719
  return resolveApi(DEFAULT_URL, DEV_KEY).base;
18695
18720
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agental",
3
- "version": "0.59.0",
3
+ "version": "0.60.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",