@openape/apes 1.15.0 → 1.16.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
|
@@ -2713,6 +2713,35 @@ mkdir -p "$HOME_DIR/Library/Logs" "$HOME_DIR/.openape/agent/tasks"
|
|
|
2713
2713
|
function buildTroopBootstrapBlock(_troop, _name) {
|
|
2714
2714
|
return "";
|
|
2715
2715
|
}
|
|
2716
|
+
function buildPhaseGTeardownScript(input) {
|
|
2717
|
+
const { name, homeDir } = input;
|
|
2718
|
+
return `#!/bin/bash
|
|
2719
|
+
set -u
|
|
2720
|
+
|
|
2721
|
+
NAME=${shQuote(name)}
|
|
2722
|
+
HOME_DIR=${shQuote(homeDir)}
|
|
2723
|
+
|
|
2724
|
+
UID_OF=$(dscl . -read "/Users/$NAME" UniqueID 2>/dev/null | awk '/UniqueID:/ {print $2}')
|
|
2725
|
+
|
|
2726
|
+
if [ -n "$UID_OF" ]; then
|
|
2727
|
+
launchctl bootout "user/$UID_OF" 2>/dev/null || true
|
|
2728
|
+
pkill -9 -u "$UID_OF" 2>/dev/null || true
|
|
2729
|
+
fi
|
|
2730
|
+
|
|
2731
|
+
# Per-agent ecosystem files written by the Nest's pm2-supervisor.
|
|
2732
|
+
rm -rf "/var/openape/agents/$NAME"
|
|
2733
|
+
|
|
2734
|
+
# Home dir lives under /var/openape/homes/ \u2014 no FDA wall, root can
|
|
2735
|
+
# remove directly.
|
|
2736
|
+
if [ -d "$HOME_DIR" ] && [ "$HOME_DIR" != "/" ] && [ "$HOME_DIR" != "" ]; then
|
|
2737
|
+
rm -rf "$HOME_DIR"
|
|
2738
|
+
fi
|
|
2739
|
+
|
|
2740
|
+
# dscl record stays as a tombstone. Operators run
|
|
2741
|
+
# \`sudo sysadminctl -deleteUser $NAME\` to fully clean up if desired.
|
|
2742
|
+
echo "OK Phase-G teardown done for $NAME (dscl record kept as tombstone)"
|
|
2743
|
+
`;
|
|
2744
|
+
}
|
|
2716
2745
|
function buildDestroyTeardownScript(input) {
|
|
2717
2746
|
const { name, homeDir, adminUser } = input;
|
|
2718
2747
|
return `#!/bin/bash
|
|
@@ -3155,27 +3184,42 @@ ${consequences.join("\n")}`);
|
|
|
3155
3184
|
consola19.info("No IdP agent to remove (skipped).");
|
|
3156
3185
|
}
|
|
3157
3186
|
if (osUserExists) {
|
|
3158
|
-
const
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3187
|
+
const homeDir = osUser?.homeDir ?? `/Users/${name}`;
|
|
3188
|
+
const isPhaseG = homeDir.startsWith("/var/openape/homes/");
|
|
3189
|
+
if (isPhaseG) {
|
|
3190
|
+
const scratch = mkdtempSync(join3(tmpdir(), `apes-destroy-${name}-`));
|
|
3191
|
+
const scriptPath = join3(scratch, "teardown.sh");
|
|
3192
|
+
try {
|
|
3193
|
+
const script = buildPhaseGTeardownScript({ name, homeDir });
|
|
3194
|
+
writeFileSync2(scriptPath, script, { mode: 448 });
|
|
3195
|
+
consola19.start("Running teardown (Phase G \u2014 no admin password needed)\u2026");
|
|
3196
|
+
execFileSync4("apes", ["run", "--as", "root", "--wait", "--", "bash", scriptPath], { stdio: "inherit" });
|
|
3197
|
+
} finally {
|
|
3198
|
+
rmSync(scratch, { recursive: true, force: true });
|
|
3199
|
+
}
|
|
3200
|
+
consola19.info(`dscl record /Users/${name} kept as tombstone (hidden, no home). Run \`sudo sysadminctl -deleteUser ${name}\` to fully remove.`);
|
|
3201
|
+
} else {
|
|
3202
|
+
const sudo = whichBinary("sudo");
|
|
3203
|
+
if (!sudo) {
|
|
3204
|
+
throw new CliError("`sudo` not found on PATH; required for OS teardown.");
|
|
3205
|
+
}
|
|
3206
|
+
const adminUser = userInfo().username;
|
|
3207
|
+
const adminPassword = await collectAdminPassword({ adminUser });
|
|
3208
|
+
const scratch = mkdtempSync(join3(tmpdir(), `apes-destroy-${name}-`));
|
|
3209
|
+
const scriptPath = join3(scratch, "teardown.sh");
|
|
3210
|
+
try {
|
|
3211
|
+
const script = buildDestroyTeardownScript({ name, homeDir, adminUser });
|
|
3212
|
+
writeFileSync2(scriptPath, script, { mode: 448 });
|
|
3213
|
+
consola19.start("Running teardown via sudo\u2026");
|
|
3214
|
+
execFileSync4(sudo, ["-S", "--prompt=", "--", "bash", scriptPath], {
|
|
3215
|
+
input: `${adminPassword}
|
|
3173
3216
|
${adminPassword}
|
|
3174
3217
|
`,
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3218
|
+
stdio: ["pipe", "inherit", "inherit"]
|
|
3219
|
+
});
|
|
3220
|
+
} finally {
|
|
3221
|
+
rmSync(scratch, { recursive: true, force: true });
|
|
3222
|
+
}
|
|
3179
3223
|
}
|
|
3180
3224
|
} else if (!args["keep-os-user"] && isDarwin()) {
|
|
3181
3225
|
consola19.info("No macOS user to remove (skipped).");
|
|
@@ -6323,7 +6367,7 @@ var mcpCommand = defineCommand48({
|
|
|
6323
6367
|
if (transport !== "stdio" && transport !== "sse") {
|
|
6324
6368
|
throw new Error('Transport must be "stdio" or "sse"');
|
|
6325
6369
|
}
|
|
6326
|
-
const { startMcpServer } = await import("./server-
|
|
6370
|
+
const { startMcpServer } = await import("./server-FVFFPVVN.js");
|
|
6327
6371
|
await startMcpServer(transport, port);
|
|
6328
6372
|
}
|
|
6329
6373
|
});
|
|
@@ -6961,7 +7005,7 @@ async function bestEffortGrantCount(idp) {
|
|
|
6961
7005
|
}
|
|
6962
7006
|
}
|
|
6963
7007
|
async function runHealth(args) {
|
|
6964
|
-
const version = true ? "1.
|
|
7008
|
+
const version = true ? "1.16.0" : "0.0.0";
|
|
6965
7009
|
const auth = loadAuth();
|
|
6966
7010
|
if (!auth) {
|
|
6967
7011
|
throw new CliError("Not logged in. Run `apes login` first.", 1);
|
|
@@ -7234,10 +7278,10 @@ if (shellRewrite) {
|
|
|
7234
7278
|
if (shellRewrite.action === "rewrite") {
|
|
7235
7279
|
process.argv = shellRewrite.argv;
|
|
7236
7280
|
} else if (shellRewrite.action === "version") {
|
|
7237
|
-
console.log(`ape-shell ${"1.
|
|
7281
|
+
console.log(`ape-shell ${"1.16.0"} (OpenApe DDISA shell wrapper)`);
|
|
7238
7282
|
process.exit(0);
|
|
7239
7283
|
} else if (shellRewrite.action === "help") {
|
|
7240
|
-
console.log(`ape-shell ${"1.
|
|
7284
|
+
console.log(`ape-shell ${"1.16.0"} \u2014 OpenApe DDISA shell wrapper`);
|
|
7241
7285
|
console.log("");
|
|
7242
7286
|
console.log("Usage:");
|
|
7243
7287
|
console.log(" ape-shell Start interactive grant-mediated REPL");
|
|
@@ -7295,7 +7339,7 @@ var configCommand = defineCommand60({
|
|
|
7295
7339
|
var main = defineCommand60({
|
|
7296
7340
|
meta: {
|
|
7297
7341
|
name: "apes",
|
|
7298
|
-
version: "1.
|
|
7342
|
+
version: "1.16.0",
|
|
7299
7343
|
description: "Unified CLI for OpenApe"
|
|
7300
7344
|
},
|
|
7301
7345
|
subCommands: {
|
|
@@ -7352,7 +7396,7 @@ async function maybeRefreshAuth() {
|
|
|
7352
7396
|
}
|
|
7353
7397
|
}
|
|
7354
7398
|
await maybeRefreshAuth();
|
|
7355
|
-
await maybeWarnStaleVersion("1.
|
|
7399
|
+
await maybeWarnStaleVersion("1.16.0").catch(() => {
|
|
7356
7400
|
});
|
|
7357
7401
|
runMain(main).catch((err) => {
|
|
7358
7402
|
if (err instanceof CliExit) {
|