@openape/apes 1.28.0 → 1.28.2

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 CHANGED
@@ -1805,7 +1805,12 @@ var TroopClient = class {
1805
1805
  hostname: input.hostname,
1806
1806
  host_id: input.hostId,
1807
1807
  owner_email: input.ownerEmail,
1808
- ...input.pubkeySsh ? { pubkey_ssh: input.pubkeySsh } : {}
1808
+ ...input.pubkeySsh ? { pubkey_ssh: input.pubkeySsh } : {},
1809
+ // Without this the agent's encryption pubkey never reaches troop,
1810
+ // so every sealed-capability bind 409s ("no X25519 public key
1811
+ // yet"). The keypair is written at spawn (agent-bootstrap); we
1812
+ // just have to report the public half here.
1813
+ ...input.pubkeyX25519 ? { pubkey_x25519: input.pubkeyX25519 } : {}
1809
1814
  })
1810
1815
  });
1811
1816
  }
@@ -1845,10 +1850,22 @@ function parseKeyValues(pairs) {
1845
1850
  function missingCapabilities(required, provided) {
1846
1851
  return required.filter((env) => !(env in provided));
1847
1852
  }
1848
- function asArray(v) {
1849
- if (Array.isArray(v)) return v;
1850
- if (typeof v === "string" && v.length > 0) return [v];
1851
- return [];
1853
+ function collectFlag(rawArgs, name) {
1854
+ const out = [];
1855
+ const long = `--${name}`;
1856
+ for (let i = 0; i < rawArgs.length; i++) {
1857
+ const a = rawArgs[i];
1858
+ if (a === long) {
1859
+ const v = rawArgs[i + 1];
1860
+ if (v !== void 0 && !v.startsWith("--")) {
1861
+ out.push(v);
1862
+ i++;
1863
+ }
1864
+ } else if (a.startsWith(`${long}=`)) {
1865
+ out.push(a.slice(long.length + 1));
1866
+ }
1867
+ }
1868
+ return out;
1852
1869
  }
1853
1870
  async function api(url, token, init) {
1854
1871
  const res = await fetch(url, {
@@ -1871,11 +1888,11 @@ var deployAgentCommand = defineCommand20({
1871
1888
  "host-id": { type: "string", description: "Target nest host_id (default: first connected)" },
1872
1889
  json: { type: "boolean", description: "Machine-readable output, no prompts" }
1873
1890
  },
1874
- async run({ args }) {
1891
+ async run({ args, rawArgs }) {
1875
1892
  const repoRef = args.repo;
1876
1893
  if (!repoRef) throw new CliError("usage: apes agent deploy <repo>@<ref> [--param k=v] [--secret ENV=val]");
1877
- const params = parseKeyValues(asArray(args.param));
1878
- const secrets = parseKeyValues(asArray(args.secret));
1894
+ const params = parseKeyValues(collectFlag(rawArgs, "param"));
1895
+ const secrets = parseKeyValues(collectFlag(rawArgs, "secret"));
1879
1896
  const json = !!args.json;
1880
1897
  const token = (await ensureFreshIdpAuth()).access_token;
1881
1898
  const troop = resolveTroopUrl();
@@ -1902,7 +1919,7 @@ var deployAgentCommand = defineCommand20({
1902
1919
  secrets[env] = val;
1903
1920
  }
1904
1921
  }
1905
- if (deploy.required_capabilities.length > 0) {
1922
+ if (Object.keys(secrets).length > 0) {
1906
1923
  if (!json) consola18.start("Waiting for the agent to come online\u2026");
1907
1924
  let online = false;
1908
1925
  for (let i = 0; i < 90 && !online; i++) {
@@ -3541,6 +3558,7 @@ import { openString } from "@openape/core";
3541
3558
  var CONFIG_DIR2 = join5(homedir6(), ".config", "openape");
3542
3559
  var SECRETS_DIR = join5(CONFIG_DIR2, "secrets.d");
3543
3560
  var X25519_KEY_PATH = join5(CONFIG_DIR2, "agent-x25519.key");
3561
+ var X25519_PUBKEY_PATH = `${X25519_KEY_PATH}.pub`;
3544
3562
  function envNameFromFile(file) {
3545
3563
  if (!file.endsWith(".blob")) return null;
3546
3564
  const env = file.slice(0, -".blob".length);
@@ -3551,6 +3569,11 @@ function readAgentEncryptionKey(keyPath = X25519_KEY_PATH) {
3551
3569
  const k = readFileSync6(keyPath, "utf8").trim();
3552
3570
  return k.length > 0 ? k : null;
3553
3571
  }
3572
+ function readAgentEncryptionPublicKey(pubPath = X25519_PUBKEY_PATH) {
3573
+ if (!existsSync7(pubPath)) return null;
3574
+ const k = readFileSync6(pubPath, "utf8").trim();
3575
+ return k.length > 0 ? k : null;
3576
+ }
3554
3577
  function materializeSecrets(opts = {}) {
3555
3578
  const dir = opts.dir ?? SECRETS_DIR;
3556
3579
  const env = opts.env ?? process.env;
@@ -4478,12 +4501,15 @@ var syncAgentCommand = defineCommand31({
4478
4501
  throw new CliError(`${AUTH_PATH3} is missing owner_email \u2014 re-run \`apes agents spawn\` to update.`);
4479
4502
  }
4480
4503
  consola27.start(`Syncing ${agentName} (${host}, hostId ${hostId.slice(0, 8)}\u2026) with ${troopUrl}`);
4504
+ const pubkeyX25519 = readAgentEncryptionPublicKey() ?? void 0;
4481
4505
  const sync = await client.sync({
4482
4506
  hostname: host,
4483
4507
  hostId,
4484
- ownerEmail: auth.owner_email
4508
+ ownerEmail: auth.owner_email,
4509
+ ...pubkeyX25519 ? { pubkeyX25519 } : {}
4485
4510
  });
4486
4511
  consola27.info(sync.first_sync ? "\u2713 first sync \u2014 agent registered" : "\u2713 presence updated");
4512
+ if (!pubkeyX25519) consola27.warn("No X25519 public key found on disk \u2014 sealed capability secrets cannot be bound until the agent is re-spawned.");
4487
4513
  const { system_prompt: systemPrompt, tools, skills, tasks } = await client.listTasks();
4488
4514
  consola27.info(`Pulled ${tasks.length} task${tasks.length === 1 ? "" : "s"}`);
4489
4515
  consola27.info(`Tools enabled: ${tools.length === 0 ? "(none)" : tools.join(", ")}`);
@@ -6690,7 +6716,7 @@ var mcpCommand = defineCommand52({
6690
6716
  if (transport !== "stdio" && transport !== "sse") {
6691
6717
  throw new Error('Transport must be "stdio" or "sse"');
6692
6718
  }
6693
- const { startMcpServer } = await import("./server-UKHYMZ7X.js");
6719
+ const { startMcpServer } = await import("./server-WOOJEA67.js");
6694
6720
  await startMcpServer(transport, port);
6695
6721
  }
6696
6722
  });
@@ -7328,7 +7354,7 @@ async function bestEffortGrantCount(idp) {
7328
7354
  }
7329
7355
  }
7330
7356
  async function runHealth(args) {
7331
- const version = true ? "1.28.0" : "0.0.0";
7357
+ const version = true ? "1.28.2" : "0.0.0";
7332
7358
  const auth = loadAuth();
7333
7359
  if (!auth) {
7334
7360
  throw new CliError("Not logged in. Run `apes login` first.", 1);
@@ -7601,10 +7627,10 @@ if (shellRewrite) {
7601
7627
  if (shellRewrite.action === "rewrite") {
7602
7628
  process.argv = shellRewrite.argv;
7603
7629
  } else if (shellRewrite.action === "version") {
7604
- console.log(`ape-shell ${"1.28.0"} (OpenApe DDISA shell wrapper)`);
7630
+ console.log(`ape-shell ${"1.28.2"} (OpenApe DDISA shell wrapper)`);
7605
7631
  process.exit(0);
7606
7632
  } else if (shellRewrite.action === "help") {
7607
- console.log(`ape-shell ${"1.28.0"} \u2014 OpenApe DDISA shell wrapper`);
7633
+ console.log(`ape-shell ${"1.28.2"} \u2014 OpenApe DDISA shell wrapper`);
7608
7634
  console.log("");
7609
7635
  console.log("Usage:");
7610
7636
  console.log(" ape-shell Start interactive grant-mediated REPL");
@@ -7662,7 +7688,7 @@ var configCommand = defineCommand64({
7662
7688
  var main = defineCommand64({
7663
7689
  meta: {
7664
7690
  name: "apes",
7665
- version: "1.28.0",
7691
+ version: "1.28.2",
7666
7692
  description: "Unified CLI for OpenApe"
7667
7693
  },
7668
7694
  subCommands: {
@@ -7720,7 +7746,7 @@ async function maybeRefreshAuth() {
7720
7746
  }
7721
7747
  }
7722
7748
  await maybeRefreshAuth();
7723
- await maybeWarnStaleVersion("1.28.0").catch(() => {
7749
+ await maybeWarnStaleVersion("1.28.2").catch(() => {
7724
7750
  });
7725
7751
  runMain(main).catch((err) => {
7726
7752
  if (err instanceof CliExit) {