@openape/apes 1.24.0 → 1.24.1
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
|
@@ -2652,9 +2652,30 @@ NAME=${shQuote(name)}
|
|
|
2652
2652
|
HOME_DIR=${shQuote(homeDir)}
|
|
2653
2653
|
SHELL_PATH=${shQuote(shellPath)}
|
|
2654
2654
|
|
|
2655
|
+
# Tombstone-reuse: \`apes agents destroy\` leaves the dscl user
|
|
2656
|
+
# record behind (opendirectoryd refuses \`dscl . -delete\` from
|
|
2657
|
+
# escapes' setuid-root context without admin auth, so we accept the
|
|
2658
|
+
# stranded record as a harmless tombstone \u2014 see
|
|
2659
|
+
# runPhaseGTeardownInProcess). When the operator re-spawns with the
|
|
2660
|
+
# same name, we recycle the tombstone instead of refusing: if the
|
|
2661
|
+
# previously-recorded home dir is gone from disk (matching the
|
|
2662
|
+
# Phase-G teardown's \`rm -rf\`), we reuse the existing UID +
|
|
2663
|
+
# overwrite the home. If the home is still on disk it's a real,
|
|
2664
|
+
# live agent \u2014 refuse.
|
|
2665
|
+
TOMBSTONE_REUSE=0
|
|
2655
2666
|
if dscl . -read "/Users/$NAME" >/dev/null 2>&1; then
|
|
2656
|
-
|
|
2657
|
-
|
|
2667
|
+
EXISTING_HOME=$(dscl . -read "/Users/$NAME" NFSHomeDirectory 2>/dev/null | awk '/NFSHomeDirectory:/ {print $2}')
|
|
2668
|
+
if [ -n "$EXISTING_HOME" ] && [ -d "$EXISTING_HOME" ]; then
|
|
2669
|
+
echo "User $NAME already exists with a live home at $EXISTING_HOME; refusing to overwrite." >&2
|
|
2670
|
+
exit 1
|
|
2671
|
+
fi
|
|
2672
|
+
NEXT_UID=$(dscl . -read "/Users/$NAME" UniqueID 2>/dev/null | awk '/UniqueID:/ {print $2}')
|
|
2673
|
+
if [ -z "$NEXT_UID" ]; then
|
|
2674
|
+
echo "User $NAME exists but has no UniqueID; record is malformed, refusing to recycle." >&2
|
|
2675
|
+
exit 1
|
|
2676
|
+
fi
|
|
2677
|
+
echo "Recycling tombstone dscl record for $NAME (uid=$NEXT_UID, prior home $EXISTING_HOME \u2014 gone)"
|
|
2678
|
+
TOMBSTONE_REUSE=1
|
|
2658
2679
|
fi
|
|
2659
2680
|
|
|
2660
2681
|
# Phase G: agent home dirs live under /var/openape/homes/, not
|
|
@@ -2663,24 +2684,30 @@ fi
|
|
|
2663
2684
|
mkdir -p /var/openape/homes
|
|
2664
2685
|
chmod 755 /var/openape/homes
|
|
2665
2686
|
|
|
2666
|
-
|
|
2667
|
-
#
|
|
2668
|
-
#
|
|
2669
|
-
NEXT_UID=
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2687
|
+
if [ "$TOMBSTONE_REUSE" = "0" ]; then
|
|
2688
|
+
# Pick the next free UID in the [200, 500) hidden service-account range.
|
|
2689
|
+
# Starts the running max at 199 so an empty range yields 200 after the
|
|
2690
|
+
# floor check; otherwise NEXT_UID = max(existing in-range UIDs) + 1.
|
|
2691
|
+
NEXT_UID=199
|
|
2692
|
+
for uid in $(dscl . -list /Users UniqueID | awk '$2 >= 200 && $2 < 500 {print $2}'); do
|
|
2693
|
+
if [ "$uid" -ge "$NEXT_UID" ]; then
|
|
2694
|
+
NEXT_UID=$((uid + 1))
|
|
2695
|
+
fi
|
|
2696
|
+
done
|
|
2697
|
+
if [ "$NEXT_UID" -lt 200 ]; then
|
|
2698
|
+
NEXT_UID=200
|
|
2673
2699
|
fi
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
fi
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
exit 1
|
|
2700
|
+
if [ "$NEXT_UID" -ge 500 ]; then
|
|
2701
|
+
echo "No free UID in [200, 500) \u2014 refusing to clobber a real user." >&2
|
|
2702
|
+
exit 1
|
|
2703
|
+
fi
|
|
2704
|
+
|
|
2705
|
+
dscl . -create "/Users/$NAME"
|
|
2681
2706
|
fi
|
|
2682
2707
|
|
|
2683
|
-
dscl . -create
|
|
2708
|
+
# Idempotent attribute writes \u2014 \`dscl . -create\` on an existing
|
|
2709
|
+
# property overwrites in place, so the tombstone-reuse path lands
|
|
2710
|
+
# the same end-state as a fresh create.
|
|
2684
2711
|
dscl . -create "/Users/$NAME" UserShell "$SHELL_PATH"
|
|
2685
2712
|
dscl . -create "/Users/$NAME" RealName "OpenApe Agent $NAME"
|
|
2686
2713
|
dscl . -create "/Users/$NAME" UniqueID "$NEXT_UID"
|
|
@@ -6493,7 +6520,7 @@ var mcpCommand = defineCommand48({
|
|
|
6493
6520
|
if (transport !== "stdio" && transport !== "sse") {
|
|
6494
6521
|
throw new Error('Transport must be "stdio" or "sse"');
|
|
6495
6522
|
}
|
|
6496
|
-
const { startMcpServer } = await import("./server-
|
|
6523
|
+
const { startMcpServer } = await import("./server-KR6GVKRI.js");
|
|
6497
6524
|
await startMcpServer(transport, port);
|
|
6498
6525
|
}
|
|
6499
6526
|
});
|
|
@@ -7131,7 +7158,7 @@ async function bestEffortGrantCount(idp) {
|
|
|
7131
7158
|
}
|
|
7132
7159
|
}
|
|
7133
7160
|
async function runHealth(args) {
|
|
7134
|
-
const version = true ? "1.24.
|
|
7161
|
+
const version = true ? "1.24.1" : "0.0.0";
|
|
7135
7162
|
const auth = loadAuth();
|
|
7136
7163
|
if (!auth) {
|
|
7137
7164
|
throw new CliError("Not logged in. Run `apes login` first.", 1);
|
|
@@ -7404,10 +7431,10 @@ if (shellRewrite) {
|
|
|
7404
7431
|
if (shellRewrite.action === "rewrite") {
|
|
7405
7432
|
process.argv = shellRewrite.argv;
|
|
7406
7433
|
} else if (shellRewrite.action === "version") {
|
|
7407
|
-
console.log(`ape-shell ${"1.24.
|
|
7434
|
+
console.log(`ape-shell ${"1.24.1"} (OpenApe DDISA shell wrapper)`);
|
|
7408
7435
|
process.exit(0);
|
|
7409
7436
|
} else if (shellRewrite.action === "help") {
|
|
7410
|
-
console.log(`ape-shell ${"1.24.
|
|
7437
|
+
console.log(`ape-shell ${"1.24.1"} \u2014 OpenApe DDISA shell wrapper`);
|
|
7411
7438
|
console.log("");
|
|
7412
7439
|
console.log("Usage:");
|
|
7413
7440
|
console.log(" ape-shell Start interactive grant-mediated REPL");
|
|
@@ -7465,7 +7492,7 @@ var configCommand = defineCommand60({
|
|
|
7465
7492
|
var main = defineCommand60({
|
|
7466
7493
|
meta: {
|
|
7467
7494
|
name: "apes",
|
|
7468
|
-
version: "1.24.
|
|
7495
|
+
version: "1.24.1",
|
|
7469
7496
|
description: "Unified CLI for OpenApe"
|
|
7470
7497
|
},
|
|
7471
7498
|
subCommands: {
|
|
@@ -7522,7 +7549,7 @@ async function maybeRefreshAuth() {
|
|
|
7522
7549
|
}
|
|
7523
7550
|
}
|
|
7524
7551
|
await maybeRefreshAuth();
|
|
7525
|
-
await maybeWarnStaleVersion("1.24.
|
|
7552
|
+
await maybeWarnStaleVersion("1.24.1").catch(() => {
|
|
7526
7553
|
});
|
|
7527
7554
|
runMain(main).catch((err) => {
|
|
7528
7555
|
if (err instanceof CliExit) {
|