@openape/apes 1.14.0 → 1.15.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.
package/dist/cli.js CHANGED
@@ -2643,6 +2643,12 @@ if dscl . -read "/Users/$NAME" >/dev/null 2>&1; then
2643
2643
  exit 1
2644
2644
  fi
2645
2645
 
2646
+ # Phase G: agent home dirs live under /var/openape/homes/, not
2647
+ # /Users/. Pre-create the parent and chmod it world-traversable
2648
+ # so per-agent dirs can be reached by their respective uids.
2649
+ mkdir -p /var/openape/homes
2650
+ chmod 755 /var/openape/homes
2651
+
2646
2652
  # Pick the next free UID in the [200, 500) hidden service-account range.
2647
2653
  # Starts the running max at 199 so an empty range yields 200 after the
2648
2654
  # floor check; otherwise NEXT_UID = max(existing in-range UIDs) + 1.
@@ -2846,10 +2852,12 @@ function readMacOSUser(name) {
2846
2852
  }
2847
2853
  const uidMatch = output.match(/UniqueID:\s*(\d+)/);
2848
2854
  const shellMatch = output.match(/UserShell:\s*(\S.*)$/m);
2855
+ const homeMatch = output.match(/NFSHomeDirectory:\s*(\S.*)$/m);
2849
2856
  return {
2850
2857
  name,
2851
2858
  uid: uidMatch ? Number.parseInt(uidMatch[1], 10) : null,
2852
- shell: shellMatch ? shellMatch[1].trim() : null
2859
+ shell: shellMatch ? shellMatch[1].trim() : null,
2860
+ homeDir: homeMatch ? homeMatch[1].trim() : null
2853
2861
  };
2854
2862
  }
2855
2863
  function listMacOSUserNames() {
@@ -3107,14 +3115,18 @@ var destroyAgentCommand = defineCommand21({
3107
3115
  const owned = await apiFetch("/api/my-agents", { idp });
3108
3116
  const idpAgent = owned.find((u) => u.name === name);
3109
3117
  const idpExists = idpAgent !== void 0;
3110
- const osUserExists = !args["keep-os-user"] && isDarwin() && readMacOSUser(name) !== null;
3118
+ const osUser = isDarwin() ? readMacOSUser(name) : null;
3119
+ const osUserExists = !args["keep-os-user"] && osUser !== null;
3111
3120
  if (!idpExists && !osUserExists) {
3112
3121
  consola19.info(`Nothing to destroy: no IdP agent and no OS user named "${name}".`);
3113
3122
  return;
3114
3123
  }
3115
3124
  if (!args.force) {
3116
3125
  const consequences = [];
3117
- if (osUserExists) consequences.push(`\u2022 Remove macOS user ${name} and rm -rf /Users/${name}`);
3126
+ if (osUserExists) {
3127
+ const home = osUser?.homeDir ?? `/Users/${name}`;
3128
+ consequences.push(`\u2022 Remove macOS user ${name} and rm -rf ${home}`);
3129
+ }
3118
3130
  if (idpExists) {
3119
3131
  consequences.push(args.soft ? `\u2022 Deactivate IdP agent ${idpAgent.email} (PATCH isActive=false)` : `\u2022 Hard-delete IdP agent ${idpAgent.email} and all its SSH keys`);
3120
3132
  }
@@ -3152,7 +3164,8 @@ ${consequences.join("\n")}`);
3152
3164
  const scratch = mkdtempSync(join3(tmpdir(), `apes-destroy-${name}-`));
3153
3165
  const scriptPath = join3(scratch, "teardown.sh");
3154
3166
  try {
3155
- const script = buildDestroyTeardownScript({ name, homeDir: `/Users/${name}`, adminUser });
3167
+ const homeDir = osUser?.homeDir ?? `/Users/${name}`;
3168
+ const script = buildDestroyTeardownScript({ name, homeDir, adminUser });
3156
3169
  writeFileSync2(scriptPath, script, { mode: 448 });
3157
3170
  consola19.start("Running teardown via sudo\u2026");
3158
3171
  execFileSync4(sudo, ["-S", "--prompt=", "--", "bash", scriptPath], {
@@ -3215,13 +3228,17 @@ var listAgentsCommand = defineCommand22({
3215
3228
  const all = await apiFetch("/api/my-agents", { idp });
3216
3229
  const filtered = args["include-inactive"] ? all : all.filter((u) => u.isActive !== false);
3217
3230
  const osUsers = isDarwin() ? listMacOSUserNames() : /* @__PURE__ */ new Set();
3218
- const home = (name) => `/Users/${name}`;
3231
+ const homeOf = (name) => {
3232
+ if (!osUsers.has(name)) return null;
3233
+ const u = readMacOSUser(name);
3234
+ return u?.homeDir ?? `/Users/${name}`;
3235
+ };
3219
3236
  const rows = filtered.map((u) => ({
3220
3237
  name: u.name,
3221
3238
  email: u.email,
3222
3239
  isActive: u.isActive !== false,
3223
3240
  osUser: osUsers.has(u.name),
3224
- home: osUsers.has(u.name) ? home(u.name) : null
3241
+ home: homeOf(u.name)
3225
3242
  }));
3226
3243
  if (args.json) {
3227
3244
  process.stdout.write(`${JSON.stringify(rows, null, 2)}
@@ -4029,7 +4046,7 @@ and try again.`
4029
4046
  if (existing) {
4030
4047
  throw new CliError(`macOS user "${name}" already exists (uid=${existing.uid ?? "?"}). Refusing to overwrite.`);
4031
4048
  }
4032
- const homeDir = `/Users/${name}`;
4049
+ const homeDir = `/var/openape/homes/${name}`;
4033
4050
  const scratch = mkdtempSync2(join7(tmpdir2(), `apes-spawn-${name}-`));
4034
4051
  const scriptPath = join7(scratch, "setup.sh");
4035
4052
  try {
@@ -6306,7 +6323,7 @@ var mcpCommand = defineCommand48({
6306
6323
  if (transport !== "stdio" && transport !== "sse") {
6307
6324
  throw new Error('Transport must be "stdio" or "sse"');
6308
6325
  }
6309
- const { startMcpServer } = await import("./server-P2XXAHS5.js");
6326
+ const { startMcpServer } = await import("./server-A24A4ILW.js");
6310
6327
  await startMcpServer(transport, port);
6311
6328
  }
6312
6329
  });
@@ -6944,7 +6961,7 @@ async function bestEffortGrantCount(idp) {
6944
6961
  }
6945
6962
  }
6946
6963
  async function runHealth(args) {
6947
- const version = true ? "1.14.0" : "0.0.0";
6964
+ const version = true ? "1.15.0" : "0.0.0";
6948
6965
  const auth = loadAuth();
6949
6966
  if (!auth) {
6950
6967
  throw new CliError("Not logged in. Run `apes login` first.", 1);
@@ -7217,10 +7234,10 @@ if (shellRewrite) {
7217
7234
  if (shellRewrite.action === "rewrite") {
7218
7235
  process.argv = shellRewrite.argv;
7219
7236
  } else if (shellRewrite.action === "version") {
7220
- console.log(`ape-shell ${"1.14.0"} (OpenApe DDISA shell wrapper)`);
7237
+ console.log(`ape-shell ${"1.15.0"} (OpenApe DDISA shell wrapper)`);
7221
7238
  process.exit(0);
7222
7239
  } else if (shellRewrite.action === "help") {
7223
- console.log(`ape-shell ${"1.14.0"} \u2014 OpenApe DDISA shell wrapper`);
7240
+ console.log(`ape-shell ${"1.15.0"} \u2014 OpenApe DDISA shell wrapper`);
7224
7241
  console.log("");
7225
7242
  console.log("Usage:");
7226
7243
  console.log(" ape-shell Start interactive grant-mediated REPL");
@@ -7278,7 +7295,7 @@ var configCommand = defineCommand60({
7278
7295
  var main = defineCommand60({
7279
7296
  meta: {
7280
7297
  name: "apes",
7281
- version: "1.14.0",
7298
+ version: "1.15.0",
7282
7299
  description: "Unified CLI for OpenApe"
7283
7300
  },
7284
7301
  subCommands: {
@@ -7335,7 +7352,7 @@ async function maybeRefreshAuth() {
7335
7352
  }
7336
7353
  }
7337
7354
  await maybeRefreshAuth();
7338
- await maybeWarnStaleVersion("1.14.0").catch(() => {
7355
+ await maybeWarnStaleVersion("1.15.0").catch(() => {
7339
7356
  });
7340
7357
  runMain(main).catch((err) => {
7341
7358
  if (err instanceof CliExit) {