@openape/apes 1.0.2 → 1.0.4

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
@@ -1926,21 +1926,20 @@ function buildTroopBlock(troop) {
1926
1926
  return `
1927
1927
  mkdir -p "$HOME_DIR/Library/LaunchAgents" "$HOME_DIR/Library/Logs" "$HOME_DIR/.openape/agent/tasks"
1928
1928
  cat > ${shQuote(troop.plistPath)} ${shHeredoc(troop.plistContent)}
1929
+ chown root:wheel ${shQuote(troop.plistPath)}
1929
1930
  chmod 644 ${shQuote(troop.plistPath)}
1930
1931
  `;
1931
1932
  }
1932
1933
  function buildTroopBootstrapBlock(troop, name) {
1933
1934
  if (!troop) return "";
1934
1935
  return `
1935
- # Bootstrap the troop sync launchd into the agent's user domain so it
1936
- # starts firing every 5 minutes. RunAtLoad in the plist also kicks off
1937
- # an immediate first sync so the agent registers + appears in the troop
1938
- # SP within seconds of spawn finishing.
1936
+ # Bootstrap the troop sync launchd in the system domain. setup.sh runs
1937
+ # as root via \`apes run --as root\`, so we have permission. Stale label
1938
+ # is bootouted first to make re-spawn idempotent.
1939
1939
  echo "==> Installing troop sync launchd as ${name}\u2026"
1940
- NAME_UID="$(id -u ${shQuote(name)})"
1941
- launchctl asuser "$NAME_UID" launchctl bootout "gui/$NAME_UID/${troop.plistLabel}" 2>/dev/null || true
1942
- launchctl asuser "$NAME_UID" launchctl bootstrap "gui/$NAME_UID" ${shQuote(troop.plistPath)} || \\
1943
- echo "warn: troop sync bootstrap failed; run \\\`apes agents sync\\\` manually as ${name} to register at troop.openape.ai"
1940
+ launchctl bootout "system/${troop.plistLabel}" 2>/dev/null || true
1941
+ launchctl bootstrap system ${shQuote(troop.plistPath)} || \\
1942
+ echo "warn: troop sync bootstrap failed; check ${troop.plistPath}"
1944
1943
  `;
1945
1944
  }
1946
1945
  function buildDestroyTeardownScript(input) {
@@ -3277,15 +3276,17 @@ function escape(s) {
3277
3276
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
3278
3277
  }
3279
3278
  function buildSyncPlist(input) {
3279
+ const pathLine = ` <key>PATH</key><string>${escape(input.homeDir)}/.bun/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
3280
+ `;
3280
3281
  const envBlock = input.troopUrl ? ` <key>EnvironmentVariables</key>
3281
3282
  <dict>
3282
3283
  <key>HOME</key><string>${escape(input.homeDir)}</string>
3283
- <key>OPENAPE_TROOP_URL</key><string>${escape(input.troopUrl)}</string>
3284
+ ${pathLine} <key>OPENAPE_TROOP_URL</key><string>${escape(input.troopUrl)}</string>
3284
3285
  </dict>
3285
3286
  ` : ` <key>EnvironmentVariables</key>
3286
3287
  <dict>
3287
3288
  <key>HOME</key><string>${escape(input.homeDir)}</string>
3288
- </dict>
3289
+ ${pathLine} </dict>
3289
3290
  `;
3290
3291
  return `<?xml version="1.0" encoding="UTF-8"?>
3291
3292
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -3293,6 +3294,8 @@ function buildSyncPlist(input) {
3293
3294
  <dict>
3294
3295
  <key>Label</key>
3295
3296
  <string>${escape(syncPlistLabel(input.agentName))}</string>
3297
+ <key>UserName</key>
3298
+ <string>${escape(input.userName)}</string>
3296
3299
  <key>ProgramArguments</key>
3297
3300
  <array>
3298
3301
  <string>${escape(input.apesBin)}</string>
@@ -3611,11 +3614,11 @@ and try again.`
3611
3614
  };
3612
3615
  })() : null;
3613
3616
  const troopPlistLabel = `openape.troop.sync.${name}`;
3614
- const troopPlistPath = `${homeDir}/Library/LaunchAgents/${troopPlistLabel}.plist`;
3617
+ const troopPlistPath = `/Library/LaunchDaemons/${troopPlistLabel}.plist`;
3615
3618
  const troop = {
3616
3619
  plistLabel: troopPlistLabel,
3617
3620
  plistPath: troopPlistPath,
3618
- plistContent: buildSyncPlist({ agentName: name, apesBin: apes, homeDir })
3621
+ plistContent: buildSyncPlist({ agentName: name, apesBin: apes, homeDir, userName: name })
3619
3622
  };
3620
3623
  const script = buildSpawnSetupScript({
3621
3624
  name,
@@ -5260,7 +5263,7 @@ var mcpCommand = defineCommand36({
5260
5263
  if (transport !== "stdio" && transport !== "sse") {
5261
5264
  throw new Error('Transport must be "stdio" or "sse"');
5262
5265
  }
5263
- const { startMcpServer } = await import("./server-467VCCVV.js");
5266
+ const { startMcpServer } = await import("./server-TUNRAZET.js");
5264
5267
  await startMcpServer(transport, port);
5265
5268
  }
5266
5269
  });
@@ -5898,7 +5901,7 @@ async function bestEffortGrantCount(idp) {
5898
5901
  }
5899
5902
  }
5900
5903
  async function runHealth(args) {
5901
- const version = true ? "1.0.2" : "0.0.0";
5904
+ const version = true ? "1.0.4" : "0.0.0";
5902
5905
  const auth = loadAuth();
5903
5906
  if (!auth) {
5904
5907
  throw new CliError("Not logged in. Run `apes login` first.", 1);
@@ -6171,10 +6174,10 @@ if (shellRewrite) {
6171
6174
  if (shellRewrite.action === "rewrite") {
6172
6175
  process.argv = shellRewrite.argv;
6173
6176
  } else if (shellRewrite.action === "version") {
6174
- console.log(`ape-shell ${"1.0.2"} (OpenApe DDISA shell wrapper)`);
6177
+ console.log(`ape-shell ${"1.0.4"} (OpenApe DDISA shell wrapper)`);
6175
6178
  process.exit(0);
6176
6179
  } else if (shellRewrite.action === "help") {
6177
- console.log(`ape-shell ${"1.0.2"} \u2014 OpenApe DDISA shell wrapper`);
6180
+ console.log(`ape-shell ${"1.0.4"} \u2014 OpenApe DDISA shell wrapper`);
6178
6181
  console.log("");
6179
6182
  console.log("Usage:");
6180
6183
  console.log(" ape-shell Start interactive grant-mediated REPL");
@@ -6232,7 +6235,7 @@ var configCommand = defineCommand48({
6232
6235
  var main = defineCommand48({
6233
6236
  meta: {
6234
6237
  name: "apes",
6235
- version: "1.0.2",
6238
+ version: "1.0.4",
6236
6239
  description: "Unified CLI for OpenApe"
6237
6240
  },
6238
6241
  subCommands: {
@@ -6287,7 +6290,7 @@ async function maybeRefreshAuth() {
6287
6290
  }
6288
6291
  }
6289
6292
  await maybeRefreshAuth();
6290
- await maybeWarnStaleVersion("1.0.2").catch(() => {
6293
+ await maybeWarnStaleVersion("1.0.4").catch(() => {
6291
6294
  });
6292
6295
  runMain(main).catch((err) => {
6293
6296
  if (err instanceof CliExit) {