@openape/apes 1.0.1 → 1.0.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
@@ -1884,7 +1884,7 @@ if [ -f "$HOME_DIR/.config/openape/claude-token.env" ]; then
1884
1884
  fi
1885
1885
 
1886
1886
  echo "OK $NAME uid=$NEXT_UID home=$HOME_DIR"
1887
- ${buildBridgeBootstrapBlock(input.bridge)}${buildTroopBootstrapBlock(input.troop)}`;
1887
+ ${buildBridgeBootstrapBlock(input.bridge, name)}${buildTroopBootstrapBlock(input.troop, name)}`;
1888
1888
  }
1889
1889
  function buildBridgeBlock(bridge) {
1890
1890
  if (!bridge) return "";
@@ -1903,11 +1903,11 @@ chown root:wheel ${shQuote(bridge.plistPath)}
1903
1903
  chmod 644 ${shQuote(bridge.plistPath)}
1904
1904
  `;
1905
1905
  }
1906
- function buildBridgeBootstrapBlock(bridge) {
1906
+ function buildBridgeBootstrapBlock(bridge, name) {
1907
1907
  if (!bridge) return "";
1908
1908
  return `
1909
- echo "==> Installing bridge stack as \${NAME} via bun (one-time)\u2026"
1910
- su - "$NAME" -c '
1909
+ echo "==> Installing bridge stack as ${name} via bun (one-time)\u2026"
1910
+ su - ${shQuote(name)} -c '
1911
1911
  set -euo pipefail
1912
1912
  export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:$HOME/.bun/install/global/bin"
1913
1913
  bun add -g @openape/chat-bridge @openape/apes
@@ -1926,24 +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
- function buildTroopBootstrapBlock(troop) {
1933
+ function buildTroopBootstrapBlock(troop, name) {
1933
1934
  if (!troop) return "";
1934
1935
  return `
1935
- # Bootstrap the troop sync launchd into the agent's GUI domain so it
1936
- # starts firing every 5 minutes. RunAtLoad in the plist also kicks
1937
- # off an immediate first sync so the agent registers + appears in
1938
- # the troop SP within seconds of spawn finishing.
1939
- echo "==> Installing troop sync launchd as \${NAME}\u2026"
1940
- su - "$NAME" -c '
1941
- set -euo pipefail
1942
- NAME_UID="$(id -u)"
1943
- launchctl bootout "gui/$NAME_UID/${troop.plistLabel}" 2>/dev/null || true
1944
- launchctl bootstrap "gui/$NAME_UID" ${shQuote(troop.plistPath)} || \\
1945
- echo "warn: troop sync bootstrap failed; run \\\`apes agents sync\\\` manually as $NAME to register at troop.openape.ai"
1946
- '
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
+ echo "==> Installing troop sync launchd as ${name}\u2026"
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}"
1947
1943
  `;
1948
1944
  }
1949
1945
  function buildDestroyTeardownScript(input) {
@@ -3296,6 +3292,8 @@ function buildSyncPlist(input) {
3296
3292
  <dict>
3297
3293
  <key>Label</key>
3298
3294
  <string>${escape(syncPlistLabel(input.agentName))}</string>
3295
+ <key>UserName</key>
3296
+ <string>${escape(input.userName)}</string>
3299
3297
  <key>ProgramArguments</key>
3300
3298
  <array>
3301
3299
  <string>${escape(input.apesBin)}</string>
@@ -3614,11 +3612,11 @@ and try again.`
3614
3612
  };
3615
3613
  })() : null;
3616
3614
  const troopPlistLabel = `openape.troop.sync.${name}`;
3617
- const troopPlistPath = `${homeDir}/Library/LaunchAgents/${troopPlistLabel}.plist`;
3615
+ const troopPlistPath = `/Library/LaunchDaemons/${troopPlistLabel}.plist`;
3618
3616
  const troop = {
3619
3617
  plistLabel: troopPlistLabel,
3620
3618
  plistPath: troopPlistPath,
3621
- plistContent: buildSyncPlist({ agentName: name, apesBin: apes, homeDir })
3619
+ plistContent: buildSyncPlist({ agentName: name, apesBin: apes, homeDir, userName: name })
3622
3620
  };
3623
3621
  const script = buildSpawnSetupScript({
3624
3622
  name,
@@ -5263,7 +5261,7 @@ var mcpCommand = defineCommand36({
5263
5261
  if (transport !== "stdio" && transport !== "sse") {
5264
5262
  throw new Error('Transport must be "stdio" or "sse"');
5265
5263
  }
5266
- const { startMcpServer } = await import("./server-F6CJ5B5O.js");
5264
+ const { startMcpServer } = await import("./server-E5RX55NL.js");
5267
5265
  await startMcpServer(transport, port);
5268
5266
  }
5269
5267
  });
@@ -5901,7 +5899,7 @@ async function bestEffortGrantCount(idp) {
5901
5899
  }
5902
5900
  }
5903
5901
  async function runHealth(args) {
5904
- const version = true ? "1.0.1" : "0.0.0";
5902
+ const version = true ? "1.0.3" : "0.0.0";
5905
5903
  const auth = loadAuth();
5906
5904
  if (!auth) {
5907
5905
  throw new CliError("Not logged in. Run `apes login` first.", 1);
@@ -6174,10 +6172,10 @@ if (shellRewrite) {
6174
6172
  if (shellRewrite.action === "rewrite") {
6175
6173
  process.argv = shellRewrite.argv;
6176
6174
  } else if (shellRewrite.action === "version") {
6177
- console.log(`ape-shell ${"1.0.1"} (OpenApe DDISA shell wrapper)`);
6175
+ console.log(`ape-shell ${"1.0.3"} (OpenApe DDISA shell wrapper)`);
6178
6176
  process.exit(0);
6179
6177
  } else if (shellRewrite.action === "help") {
6180
- console.log(`ape-shell ${"1.0.1"} \u2014 OpenApe DDISA shell wrapper`);
6178
+ console.log(`ape-shell ${"1.0.3"} \u2014 OpenApe DDISA shell wrapper`);
6181
6179
  console.log("");
6182
6180
  console.log("Usage:");
6183
6181
  console.log(" ape-shell Start interactive grant-mediated REPL");
@@ -6235,7 +6233,7 @@ var configCommand = defineCommand48({
6235
6233
  var main = defineCommand48({
6236
6234
  meta: {
6237
6235
  name: "apes",
6238
- version: "1.0.1",
6236
+ version: "1.0.3",
6239
6237
  description: "Unified CLI for OpenApe"
6240
6238
  },
6241
6239
  subCommands: {
@@ -6290,7 +6288,7 @@ async function maybeRefreshAuth() {
6290
6288
  }
6291
6289
  }
6292
6290
  await maybeRefreshAuth();
6293
- await maybeWarnStaleVersion("1.0.1").catch(() => {
6291
+ await maybeWarnStaleVersion("1.0.3").catch(() => {
6294
6292
  });
6295
6293
  runMain(main).catch((err) => {
6296
6294
  if (err instanceof CliExit) {