agental 0.50.0 → 0.52.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 +44 -6
  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.50.0" : "dev";
7414
+ var CLI_VERSION = true ? "0.52.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}`;
@@ -7905,6 +7905,8 @@ var KEY_ACTIONS = [
7905
7905
  "network.write",
7906
7906
  "secret.read",
7907
7907
  "secret.write",
7908
+ "tailscale.read",
7909
+ "tailscale.write",
7908
7910
  "email.read",
7909
7911
  "email.send",
7910
7912
  "email.manage",
@@ -13272,17 +13274,25 @@ async function snapshot(client, positionals, options) {
13272
13274
  }
13273
13275
  }
13274
13276
 
13277
+ // ../sdk/typescript/src/errors.ts
13278
+ var AgentalError = class extends Error {
13279
+ constructor(message, options) {
13280
+ super(message, options);
13281
+ this.name = new.target.name;
13282
+ }
13283
+ };
13284
+
13275
13285
  // ../sdk/typescript/src/sealed.ts
13276
13286
  var SEALED_SUITE = "x25519-hkdf-sha256-aes256gcm";
13277
- var ROOT_PUBLIC_KEYS = [];
13287
+ var ROOT_PUBLIC_KEYS = ["jNdFf3FKdbFQ5J-1e_NE7ZzuaNPRdci-mzlGj384Rmw"];
13288
+ var SEALED_PURPOSES = ["variable", "tailscale-oauth"];
13278
13289
  var KEM_ID = 32;
13279
13290
  var KDF_ID = 1;
13280
13291
  var AEAD_ID = 2;
13281
13292
  var INFO = "agental sealed secret v1";
13282
13293
  var AAD_LABEL = "agental sealed secret aad v1";
13283
13294
  var KEY_MESSAGE_LABEL = "agental sealing key v1";
13284
- var SealingError = class extends Error {
13285
- name = "SealingError";
13295
+ var SealingError = class extends AgentalError {
13286
13296
  };
13287
13297
  async function seal(key2, secret2, roots = ROOT_PUBLIC_KEYS) {
13288
13298
  await verifySealingKey(key2, roots);
@@ -13329,7 +13339,14 @@ async function sealWith(key2, secret2, ephemeral) {
13329
13339
  const sharedSecret = await kemSharedSecret(dh, enc, fromBase64url(key2.publicKey));
13330
13340
  const { aeadKey, baseNonce } = await keySchedule(sharedSecret, utf8(INFO));
13331
13341
  const plaintext = utf8(
13332
- JSON.stringify({ value: secret2.value, hosts: secret2.hosts, org: secret2.org, name: secret2.name, sealedAt: secret2.sealedAt ?? (/* @__PURE__ */ new Date()).toISOString() })
13342
+ JSON.stringify({
13343
+ value: secret2.value,
13344
+ hosts: secret2.hosts,
13345
+ org: secret2.org,
13346
+ name: secret2.name,
13347
+ purpose: secret2.purpose ?? "variable",
13348
+ sealedAt: secret2.sealedAt ?? (/* @__PURE__ */ new Date()).toISOString()
13349
+ })
13333
13350
  );
13334
13351
  const aes = await subtle().importKey("raw", aeadKey, { name: "AES-GCM" }, false, ["encrypt"]);
13335
13352
  const ct = new Uint8Array(
@@ -13342,6 +13359,9 @@ function checkSecret(key2, secret2) {
13342
13359
  throw new SealingError(`sealing key ${key2.kid} holds ${key2.owner}'s secrets, not ${secret2.org}'s`);
13343
13360
  }
13344
13361
  if (!secret2.org || !secret2.name) throw new SealingError("a secret needs its organization and its name");
13362
+ if (secret2.purpose !== void 0 && !SEALED_PURPOSES.includes(secret2.purpose)) {
13363
+ throw new SealingError(`a secret is sealed for one of ${SEALED_PURPOSES.join(", ")}, not ${String(secret2.purpose)}`);
13364
+ }
13345
13365
  if (secret2.org.includes("\0") || secret2.name.includes("\0")) throw new SealingError("an organization or a name cannot hold a NUL");
13346
13366
  if (!Array.isArray(secret2.hosts) || secret2.hosts.length === 0) throw new SealingError("a secret needs at least one host it may be sent to");
13347
13367
  if (secret2.hosts.some((host) => typeof host !== "string" || host === "")) throw new SealingError("a host cannot be empty");
@@ -13575,7 +13595,7 @@ async function sealFor(client, name, value, hosts) {
13575
13595
  for (const key2 of mine) {
13576
13596
  await verifySealingKey(key2, client.roots ?? ROOT_KEYS);
13577
13597
  }
13578
- const sealed = await Promise.all(mine.map((key2) => seal(key2, { value, hosts, org: org2, name }, client.roots ?? ROOT_KEYS)));
13598
+ const sealed = await Promise.all(mine.map((key2) => seal(key2, { value, hosts, org: org2, name, purpose: "variable" }, client.roots ?? ROOT_KEYS)));
13579
13599
  return { sealed, org: org2 };
13580
13600
  }
13581
13601
  function nameOf2(given, verb) {
@@ -16983,6 +17003,15 @@ async function ci(positionals, options) {
16983
17003
  process.stdout.write(` job ${job2.jobId} waiting since ${job2.since}: ${job2.message}
16984
17004
  `);
16985
17005
  }
17006
+ if (item.waits && item.waits.waited > 0) {
17007
+ const reasons = item.waits.byReason.map((each) => `${ciWaitWords(each.reason)} ${each.jobs} for ${ciHours(each.seconds)}`).join(", ");
17008
+ process.stdout.write(` since ${item.waits.since.slice(0, 10)} ${item.waits.waited} of ${item.waits.jobs} jobs waited over a minute, ${ciHours(item.waits.waitedSeconds)} in all: ${reasons}
17009
+ `);
17010
+ if (item.waits.byReason[0]?.reason === "pool_full") {
17011
+ process.stdout.write(` a bigger pool would have started most of them at once: agental ci set ${item.repository} --pool <n>
17012
+ `);
17013
+ }
17014
+ }
16986
17015
  }
16987
17016
  return;
16988
17017
  }
@@ -17022,6 +17051,15 @@ async function ci(positionals, options) {
17022
17051
  process.stdout.write(`${repo}: pool ${poolMax ?? "default"}, template ${templateId ?? "runs-on (empty)"}. Sandboxes made from now on take it; a fork's job always gets the empty template.
17023
17052
  `);
17024
17053
  }
17054
+ function ciWaitWords(reason2) {
17055
+ if (reason2 === null) return "starting its sandbox";
17056
+ if (reason2 === "pool_full") return "pool full";
17057
+ if (reason2 === "no_room") return "our servers full";
17058
+ return reason2.replaceAll("_", " ");
17059
+ }
17060
+ function ciHours(seconds2) {
17061
+ return seconds2 >= 3600 ? `${(seconds2 / 3600).toFixed(1)} h` : `${Math.round(seconds2 / 60)} min`;
17062
+ }
17025
17063
  async function ciJobs(repo, limit, asJson) {
17026
17064
  if (repo !== void 0 && !/^[^/\s]+\/[^/\s]+$/.test(repo)) {
17027
17065
  throw new Error("ci jobs takes a repository as owner/name, as agental ci jobs acme/app");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agental",
3
- "version": "0.50.0",
3
+ "version": "0.52.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",