@openape/apes 1.28.1 → 1.28.3

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
  }
@@ -3553,6 +3558,7 @@ import { openString } from "@openape/core";
3553
3558
  var CONFIG_DIR2 = join5(homedir6(), ".config", "openape");
3554
3559
  var SECRETS_DIR = join5(CONFIG_DIR2, "secrets.d");
3555
3560
  var X25519_KEY_PATH = join5(CONFIG_DIR2, "agent-x25519.key");
3561
+ var X25519_PUBKEY_PATH = `${X25519_KEY_PATH}.pub`;
3556
3562
  function envNameFromFile(file) {
3557
3563
  if (!file.endsWith(".blob")) return null;
3558
3564
  const env = file.slice(0, -".blob".length);
@@ -3563,6 +3569,11 @@ function readAgentEncryptionKey(keyPath = X25519_KEY_PATH) {
3563
3569
  const k = readFileSync6(keyPath, "utf8").trim();
3564
3570
  return k.length > 0 ? k : null;
3565
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
+ }
3566
3577
  function materializeSecrets(opts = {}) {
3567
3578
  const dir = opts.dir ?? SECRETS_DIR;
3568
3579
  const env = opts.env ?? process.env;
@@ -4490,12 +4501,15 @@ var syncAgentCommand = defineCommand31({
4490
4501
  throw new CliError(`${AUTH_PATH3} is missing owner_email \u2014 re-run \`apes agents spawn\` to update.`);
4491
4502
  }
4492
4503
  consola27.start(`Syncing ${agentName} (${host}, hostId ${hostId.slice(0, 8)}\u2026) with ${troopUrl}`);
4504
+ const pubkeyX25519 = readAgentEncryptionPublicKey() ?? void 0;
4493
4505
  const sync = await client.sync({
4494
4506
  hostname: host,
4495
4507
  hostId,
4496
- ownerEmail: auth.owner_email
4508
+ ownerEmail: auth.owner_email,
4509
+ ...pubkeyX25519 ? { pubkeyX25519 } : {}
4497
4510
  });
4498
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.");
4499
4513
  const { system_prompt: systemPrompt, tools, skills, tasks } = await client.listTasks();
4500
4514
  consola27.info(`Pulled ${tasks.length} task${tasks.length === 1 ? "" : "s"}`);
4501
4515
  consola27.info(`Tools enabled: ${tools.length === 0 ? "(none)" : tools.join(", ")}`);
@@ -5675,6 +5689,16 @@ function getUserMode() {
5675
5689
  return "human";
5676
5690
  return "agent";
5677
5691
  }
5692
+ var writeRealStdout = (s) => {
5693
+ process.stdout.write(s);
5694
+ };
5695
+ function routeDiagnosticsToStderrForWrappedAgentRun() {
5696
+ const original = process.stdout.write.bind(process.stdout);
5697
+ writeRealStdout = (s) => {
5698
+ original(s);
5699
+ };
5700
+ process.stdout.write = ((chunk, ...rest) => process.stderr.write(chunk, ...rest));
5701
+ }
5678
5702
  function getAsyncExitCode() {
5679
5703
  const envValue = process.env.APES_ASYNC_EXIT_CODE;
5680
5704
  if (envValue !== void 0 && envValue !== "") {
@@ -5783,6 +5807,9 @@ var runCommand = defineCommand46({
5783
5807
  },
5784
5808
  async run({ rawArgs, args }) {
5785
5809
  const wrappedCommand = extractWrappedCommand(rawArgs ?? []);
5810
+ if (wrappedCommand.length > 0 && getUserMode() === "agent") {
5811
+ routeDiagnosticsToStderrForWrappedAgentRun();
5812
+ }
5786
5813
  if (args.shell && wrappedCommand.length > 0) {
5787
5814
  await runShellMode(wrappedCommand, args);
5788
5815
  return;
@@ -6112,7 +6139,7 @@ function executeWithGrantToken(opts) {
6112
6139
  throw new CliExit(exitCode);
6113
6140
  }
6114
6141
  } else {
6115
- process.stdout.write(token);
6142
+ writeRealStdout(token);
6116
6143
  }
6117
6144
  }
6118
6145
  async function findReusableAudienceGrant(opts) {
@@ -6702,7 +6729,7 @@ var mcpCommand = defineCommand52({
6702
6729
  if (transport !== "stdio" && transport !== "sse") {
6703
6730
  throw new Error('Transport must be "stdio" or "sse"');
6704
6731
  }
6705
- const { startMcpServer } = await import("./server-RPIK3EDU.js");
6732
+ const { startMcpServer } = await import("./server-5N27B7F2.js");
6706
6733
  await startMcpServer(transport, port);
6707
6734
  }
6708
6735
  });
@@ -7340,7 +7367,7 @@ async function bestEffortGrantCount(idp) {
7340
7367
  }
7341
7368
  }
7342
7369
  async function runHealth(args) {
7343
- const version = true ? "1.28.1" : "0.0.0";
7370
+ const version = true ? "1.28.3" : "0.0.0";
7344
7371
  const auth = loadAuth();
7345
7372
  if (!auth) {
7346
7373
  throw new CliError("Not logged in. Run `apes login` first.", 1);
@@ -7613,10 +7640,10 @@ if (shellRewrite) {
7613
7640
  if (shellRewrite.action === "rewrite") {
7614
7641
  process.argv = shellRewrite.argv;
7615
7642
  } else if (shellRewrite.action === "version") {
7616
- console.log(`ape-shell ${"1.28.1"} (OpenApe DDISA shell wrapper)`);
7643
+ console.log(`ape-shell ${"1.28.3"} (OpenApe DDISA shell wrapper)`);
7617
7644
  process.exit(0);
7618
7645
  } else if (shellRewrite.action === "help") {
7619
- console.log(`ape-shell ${"1.28.1"} \u2014 OpenApe DDISA shell wrapper`);
7646
+ console.log(`ape-shell ${"1.28.3"} \u2014 OpenApe DDISA shell wrapper`);
7620
7647
  console.log("");
7621
7648
  console.log("Usage:");
7622
7649
  console.log(" ape-shell Start interactive grant-mediated REPL");
@@ -7674,7 +7701,7 @@ var configCommand = defineCommand64({
7674
7701
  var main = defineCommand64({
7675
7702
  meta: {
7676
7703
  name: "apes",
7677
- version: "1.28.1",
7704
+ version: "1.28.3",
7678
7705
  description: "Unified CLI for OpenApe"
7679
7706
  },
7680
7707
  subCommands: {
@@ -7732,7 +7759,7 @@ async function maybeRefreshAuth() {
7732
7759
  }
7733
7760
  }
7734
7761
  await maybeRefreshAuth();
7735
- await maybeWarnStaleVersion("1.28.1").catch(() => {
7762
+ await maybeWarnStaleVersion("1.28.3").catch(() => {
7736
7763
  });
7737
7764
  runMain(main).catch((err) => {
7738
7765
  if (err instanceof CliExit) {