@openape/apes 1.23.0 → 1.24.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
|
@@ -1773,13 +1773,15 @@ var adminCommand = defineCommand19({
|
|
|
1773
1773
|
import { defineCommand as defineCommand28 } from "citty";
|
|
1774
1774
|
|
|
1775
1775
|
// src/commands/agents/allow.ts
|
|
1776
|
-
import { execFileSync as
|
|
1776
|
+
import { execFileSync as execFileSync4 } from "child_process";
|
|
1777
1777
|
import { defineCommand as defineCommand20 } from "citty";
|
|
1778
1778
|
import consola18 from "consola";
|
|
1779
1779
|
|
|
1780
1780
|
// src/lib/agent-bootstrap.ts
|
|
1781
1781
|
import { Buffer as Buffer3 } from "buffer";
|
|
1782
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
1782
1783
|
import { createPrivateKey, sign } from "crypto";
|
|
1784
|
+
import { rmSync } from "fs";
|
|
1783
1785
|
|
|
1784
1786
|
// ../../node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.mjs
|
|
1785
1787
|
import http from "http";
|
|
@@ -2725,34 +2727,37 @@ mkdir -p "$HOME_DIR/Library/Logs" "$HOME_DIR/.openape/agent/tasks"
|
|
|
2725
2727
|
function buildTroopBootstrapBlock(_troop, _name) {
|
|
2726
2728
|
return "";
|
|
2727
2729
|
}
|
|
2728
|
-
function
|
|
2730
|
+
function runPhaseGTeardownInProcess(input) {
|
|
2729
2731
|
const { name, homeDir } = input;
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2732
|
+
let uid = null;
|
|
2733
|
+
try {
|
|
2734
|
+
const out = execFileSync2("/usr/bin/dscl", [".", "-read", `/Users/${name}`, "UniqueID"], { encoding: "utf8" });
|
|
2735
|
+
const m = out.match(/UniqueID:\s*(\d+)/);
|
|
2736
|
+
if (m) uid = m[1];
|
|
2737
|
+
} catch {
|
|
2738
|
+
}
|
|
2739
|
+
if (uid) {
|
|
2740
|
+
try {
|
|
2741
|
+
execFileSync2("/bin/launchctl", ["bootout", `user/${uid}`], { stdio: "ignore" });
|
|
2742
|
+
} catch {
|
|
2743
|
+
}
|
|
2744
|
+
try {
|
|
2745
|
+
execFileSync2("/usr/bin/pkill", ["-9", "-u", uid], { stdio: "ignore" });
|
|
2746
|
+
} catch {
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
const agentDir = `/var/openape/agents/${name}`;
|
|
2750
|
+
try {
|
|
2751
|
+
rmSync(agentDir, { recursive: true, force: true });
|
|
2752
|
+
} catch {
|
|
2753
|
+
}
|
|
2754
|
+
if (homeDir && homeDir !== "/" && homeDir.startsWith("/var/openape/homes/")) {
|
|
2755
|
+
try {
|
|
2756
|
+
rmSync(homeDir, { recursive: true, force: true });
|
|
2757
|
+
} catch {
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
console.log(`OK Phase-G teardown done for ${name} (dscl record kept as tombstone)`);
|
|
2756
2761
|
}
|
|
2757
2762
|
function buildDestroyTeardownScript(input) {
|
|
2758
2763
|
const { name, homeDir, adminUser } = input;
|
|
@@ -2876,7 +2881,7 @@ print(json.dumps(out))
|
|
|
2876
2881
|
`;
|
|
2877
2882
|
|
|
2878
2883
|
// src/lib/macos-user.ts
|
|
2879
|
-
import { execFileSync as
|
|
2884
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
2880
2885
|
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
|
|
2881
2886
|
function isDarwin() {
|
|
2882
2887
|
return process.platform === "darwin";
|
|
@@ -2884,7 +2889,7 @@ function isDarwin() {
|
|
|
2884
2889
|
function readMacOSUser(name) {
|
|
2885
2890
|
let output;
|
|
2886
2891
|
try {
|
|
2887
|
-
output =
|
|
2892
|
+
output = execFileSync3("dscl", [".", "-read", `/Users/${name}`], {
|
|
2888
2893
|
encoding: "utf-8",
|
|
2889
2894
|
stdio: ["ignore", "pipe", "pipe"]
|
|
2890
2895
|
});
|
|
@@ -2904,7 +2909,7 @@ function readMacOSUser(name) {
|
|
|
2904
2909
|
function listMacOSUserNames() {
|
|
2905
2910
|
let output;
|
|
2906
2911
|
try {
|
|
2907
|
-
output =
|
|
2912
|
+
output = execFileSync3("dscl", [".", "-list", "/Users"], {
|
|
2908
2913
|
encoding: "utf-8",
|
|
2909
2914
|
stdio: ["ignore", "pipe", "pipe"]
|
|
2910
2915
|
});
|
|
@@ -2917,7 +2922,7 @@ function listMacOSUserNames() {
|
|
|
2917
2922
|
}
|
|
2918
2923
|
function whichBinary(name) {
|
|
2919
2924
|
try {
|
|
2920
|
-
const out =
|
|
2925
|
+
const out = execFileSync3("which", [name], {
|
|
2921
2926
|
encoding: "utf-8",
|
|
2922
2927
|
stdio: ["ignore", "pipe", "ignore"]
|
|
2923
2928
|
}).trim();
|
|
@@ -2994,7 +2999,7 @@ PY
|
|
|
2994
2999
|
chmod 600 "$F"
|
|
2995
3000
|
`;
|
|
2996
3001
|
consola18.start(`Adding ${email} to ${agent}'s allowlist\u2026`);
|
|
2997
|
-
|
|
3002
|
+
execFileSync4(apes, ["run", "--as", agent, "--wait", "--", "bash", "-c", script], { stdio: "inherit" });
|
|
2998
3003
|
consola18.success(`${agent} will auto-accept future contact requests from ${email} (within ~30s of next bridge connect).`);
|
|
2999
3004
|
}
|
|
3000
3005
|
});
|
|
@@ -3003,8 +3008,8 @@ function shQuote2(s) {
|
|
|
3003
3008
|
}
|
|
3004
3009
|
|
|
3005
3010
|
// src/commands/agents/destroy.ts
|
|
3006
|
-
import { execFileSync as
|
|
3007
|
-
import { mkdtempSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
3011
|
+
import { execFileSync as execFileSync5 } from "child_process";
|
|
3012
|
+
import { mkdtempSync, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
3008
3013
|
import { tmpdir, userInfo } from "os";
|
|
3009
3014
|
import { join as join3 } from "path";
|
|
3010
3015
|
import { defineCommand as defineCommand21 } from "citty";
|
|
@@ -3136,6 +3141,10 @@ var destroyAgentCommand = defineCommand21({
|
|
|
3136
3141
|
"keep-os-user": {
|
|
3137
3142
|
type: "boolean",
|
|
3138
3143
|
description: "Skip OS-side teardown. Useful for CI where the agent has no OS user."
|
|
3144
|
+
},
|
|
3145
|
+
"root-stage": {
|
|
3146
|
+
type: "boolean",
|
|
3147
|
+
description: "Internal \u2014 destroy.ts re-invokes itself via `apes run --as root --` with this flag set, then runs only the Phase-G teardown (rm home, launchctl bootout, kill processes). Skips IdP + auth + interactive prompts since those already ran in the outer pass."
|
|
3139
3148
|
}
|
|
3140
3149
|
},
|
|
3141
3150
|
async run({ args }) {
|
|
@@ -3145,6 +3154,15 @@ var destroyAgentCommand = defineCommand21({
|
|
|
3145
3154
|
`Invalid agent name "${name}". Must match /^[a-z][a-z0-9-]{0,23}$/.`
|
|
3146
3155
|
);
|
|
3147
3156
|
}
|
|
3157
|
+
if (args["root-stage"]) {
|
|
3158
|
+
if (process.geteuid?.() !== 0) {
|
|
3159
|
+
throw new CliError("--root-stage was passed but this process is not running as root. Refusing to continue.");
|
|
3160
|
+
}
|
|
3161
|
+
const homeDir = readMacOSUser(name)?.homeDir ?? `/var/openape/homes/${name}`;
|
|
3162
|
+
consola19.start(`Running teardown for ${name} (Phase-G, root-stage)\u2026`);
|
|
3163
|
+
runPhaseGTeardownInProcess({ name, homeDir });
|
|
3164
|
+
return;
|
|
3165
|
+
}
|
|
3148
3166
|
const auth = loadAuth();
|
|
3149
3167
|
if (!auth) {
|
|
3150
3168
|
throw new CliError("Not authenticated. Run `apes login` first.");
|
|
@@ -3199,15 +3217,24 @@ ${consequences.join("\n")}`);
|
|
|
3199
3217
|
const homeDir = osUser?.homeDir ?? `/Users/${name}`;
|
|
3200
3218
|
const isPhaseG = homeDir.startsWith("/var/openape/homes/");
|
|
3201
3219
|
if (isPhaseG) {
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
writeFileSync2(scriptPath, script, { mode: 448 });
|
|
3220
|
+
if (process.geteuid?.() === 0) {
|
|
3221
|
+
consola19.start("Running teardown (Phase G \u2014 already root, no grant needed)\u2026");
|
|
3222
|
+
runPhaseGTeardownInProcess({ name, homeDir });
|
|
3223
|
+
} else {
|
|
3207
3224
|
consola19.start("Running teardown (Phase G \u2014 no admin password needed)\u2026");
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3225
|
+
execFileSync5("apes", [
|
|
3226
|
+
"run",
|
|
3227
|
+
"--as",
|
|
3228
|
+
"root",
|
|
3229
|
+
"--wait",
|
|
3230
|
+
"--",
|
|
3231
|
+
"apes",
|
|
3232
|
+
"agents",
|
|
3233
|
+
"destroy",
|
|
3234
|
+
name,
|
|
3235
|
+
"--force",
|
|
3236
|
+
"--root-stage"
|
|
3237
|
+
], { stdio: "inherit" });
|
|
3211
3238
|
}
|
|
3212
3239
|
consola19.info(`dscl record /Users/${name} kept as tombstone (hidden, no home). Run \`sudo sysadminctl -deleteUser ${name}\` to fully remove.`);
|
|
3213
3240
|
} else {
|
|
@@ -3235,14 +3262,14 @@ ${consequences.join("\n")}`);
|
|
|
3235
3262
|
const script = buildDestroyTeardownScript({ name, homeDir, adminUser });
|
|
3236
3263
|
writeFileSync2(scriptPath, script, { mode: 448 });
|
|
3237
3264
|
consola19.start("Running teardown via sudo\u2026");
|
|
3238
|
-
|
|
3265
|
+
execFileSync5(sudo, ["-S", "--prompt=", "--", "bash", scriptPath], {
|
|
3239
3266
|
input: `${adminPassword}
|
|
3240
3267
|
${adminPassword}
|
|
3241
3268
|
`,
|
|
3242
3269
|
stdio: ["pipe", "inherit", "inherit"]
|
|
3243
3270
|
});
|
|
3244
3271
|
} finally {
|
|
3245
|
-
|
|
3272
|
+
rmSync2(scratch, { recursive: true, force: true });
|
|
3246
3273
|
}
|
|
3247
3274
|
}
|
|
3248
3275
|
}
|
|
@@ -3768,8 +3795,8 @@ async function handleInbound(msg, sessions) {
|
|
|
3768
3795
|
}
|
|
3769
3796
|
|
|
3770
3797
|
// src/commands/agents/spawn.ts
|
|
3771
|
-
import { execFileSync as
|
|
3772
|
-
import { mkdtempSync as mkdtempSync2, rmSync as
|
|
3798
|
+
import { execFileSync as execFileSync7 } from "child_process";
|
|
3799
|
+
import { mkdtempSync as mkdtempSync2, rmSync as rmSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
3773
3800
|
import { tmpdir as tmpdir2 } from "os";
|
|
3774
3801
|
import { join as join7 } from "path";
|
|
3775
3802
|
import { defineCommand as defineCommand26 } from "citty";
|
|
@@ -3884,7 +3911,7 @@ function generateKeyPairInMemory() {
|
|
|
3884
3911
|
}
|
|
3885
3912
|
|
|
3886
3913
|
// src/lib/llm-bridge.ts
|
|
3887
|
-
import { execFileSync as
|
|
3914
|
+
import { execFileSync as execFileSync6 } from "child_process";
|
|
3888
3915
|
import { existsSync as existsSync9, readFileSync as readFileSync8 } from "fs";
|
|
3889
3916
|
import { homedir as homedir8 } from "os";
|
|
3890
3917
|
import { dirname as dirname2, join as join6 } from "path";
|
|
@@ -3928,7 +3955,7 @@ function captureHostBinDirs() {
|
|
|
3928
3955
|
for (const bin of ["node", "ape-agent", "apes"]) {
|
|
3929
3956
|
let resolved;
|
|
3930
3957
|
try {
|
|
3931
|
-
resolved =
|
|
3958
|
+
resolved = execFileSync6("/usr/bin/which", [bin], { encoding: "utf8" }).trim();
|
|
3932
3959
|
} catch {
|
|
3933
3960
|
const installCmd = bin === "ape-agent" ? "npm i -g @openape/ape-agent" : bin === "apes" ? "npm i -g @openape/apes" : "install Node.js (e.g. brew install node)";
|
|
3934
3961
|
throw new Error(`'${bin}' not found on host PATH. ${installCmd} before spawning agents \u2014 the bridge runtime resolves these at spawn time and bakes the dir into the agent's launchd plist.`);
|
|
@@ -4192,11 +4219,11 @@ and try again.`
|
|
|
4192
4219
|
const alreadyRoot = process.getuid?.() === 0;
|
|
4193
4220
|
if (alreadyRoot) {
|
|
4194
4221
|
consola23.start("Running privileged setup directly (already root)\u2026");
|
|
4195
|
-
|
|
4222
|
+
execFileSync7("bash", [scriptPath], { stdio: "inherit" });
|
|
4196
4223
|
} else {
|
|
4197
4224
|
consola23.start("Running privileged setup as root via `apes run --as root --wait`\u2026");
|
|
4198
4225
|
consola23.info("You will be asked to approve the as=root grant in your DDISA inbox; this command blocks until you do.");
|
|
4199
|
-
|
|
4226
|
+
execFileSync7(apes, ["run", "--as", "root", "--wait", "--", "bash", scriptPath], { stdio: "inherit" });
|
|
4200
4227
|
}
|
|
4201
4228
|
try {
|
|
4202
4229
|
const uid = readMacOSUidOrNull(name);
|
|
@@ -4225,7 +4252,7 @@ and try again.`
|
|
|
4225
4252
|
console.log("Run as the agent with:");
|
|
4226
4253
|
console.log(` apes run --as ${name} -- claude --session-name ${name} --dangerously-skip-permissions`);
|
|
4227
4254
|
} finally {
|
|
4228
|
-
|
|
4255
|
+
rmSync3(scratch, { recursive: true, force: true });
|
|
4229
4256
|
}
|
|
4230
4257
|
}
|
|
4231
4258
|
});
|
|
@@ -4253,18 +4280,18 @@ async function resolveClaudeToken(opts) {
|
|
|
4253
4280
|
}
|
|
4254
4281
|
|
|
4255
4282
|
// src/commands/agents/sync.ts
|
|
4256
|
-
import { chownSync, existsSync as existsSync10, mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync9, rmSync as
|
|
4283
|
+
import { chownSync, existsSync as existsSync10, mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync9, rmSync as rmSync4, statSync, writeFileSync as writeFileSync5 } from "fs";
|
|
4257
4284
|
import { homedir as homedir9 } from "os";
|
|
4258
4285
|
import { join as join8 } from "path";
|
|
4259
4286
|
import { defineCommand as defineCommand27 } from "citty";
|
|
4260
4287
|
import consola24 from "consola";
|
|
4261
4288
|
|
|
4262
4289
|
// src/lib/macos-host.ts
|
|
4263
|
-
import { execFileSync as
|
|
4290
|
+
import { execFileSync as execFileSync8 } from "child_process";
|
|
4264
4291
|
import { hostname as hostname3 } from "os";
|
|
4265
4292
|
function getHostId() {
|
|
4266
4293
|
try {
|
|
4267
|
-
const output =
|
|
4294
|
+
const output = execFileSync8(
|
|
4268
4295
|
"/usr/sbin/ioreg",
|
|
4269
4296
|
["-d2", "-c", "IOPlatformExpertDevice"],
|
|
4270
4297
|
{ encoding: "utf8", timeout: 2e3 }
|
|
@@ -4397,7 +4424,7 @@ var syncAgentCommand = defineCommand27({
|
|
|
4397
4424
|
for (const entry of readdirSync(skillsDir)) {
|
|
4398
4425
|
if (incomingNames.has(entry)) continue;
|
|
4399
4426
|
try {
|
|
4400
|
-
|
|
4427
|
+
rmSync4(join8(skillsDir, entry), { recursive: true, force: true });
|
|
4401
4428
|
} catch {
|
|
4402
4429
|
}
|
|
4403
4430
|
}
|
|
@@ -4438,7 +4465,7 @@ var agentsCommand = defineCommand28({
|
|
|
4438
4465
|
import { defineCommand as defineCommand36 } from "citty";
|
|
4439
4466
|
|
|
4440
4467
|
// src/commands/nest/authorize.ts
|
|
4441
|
-
import { execFileSync as
|
|
4468
|
+
import { execFileSync as execFileSync9 } from "child_process";
|
|
4442
4469
|
import { existsSync as existsSync12, readFileSync as readFileSync10 } from "fs";
|
|
4443
4470
|
import { join as join10 } from "path";
|
|
4444
4471
|
import { defineCommand as defineCommand30 } from "citty";
|
|
@@ -4605,7 +4632,7 @@ var authorizeNestCommand = defineCommand30({
|
|
|
4605
4632
|
cmdArgs.push("--expires-in", args["expires-in"]);
|
|
4606
4633
|
}
|
|
4607
4634
|
try {
|
|
4608
|
-
|
|
4635
|
+
execFileSync9("apes", cmdArgs, { stdio: "inherit" });
|
|
4609
4636
|
} catch (err) {
|
|
4610
4637
|
throw new CliError(err instanceof Error ? err.message : String(err));
|
|
4611
4638
|
}
|
|
@@ -4615,7 +4642,7 @@ var authorizeNestCommand = defineCommand30({
|
|
|
4615
4642
|
});
|
|
4616
4643
|
|
|
4617
4644
|
// src/commands/nest/destroy.ts
|
|
4618
|
-
import { execFileSync as
|
|
4645
|
+
import { execFileSync as execFileSync10 } from "child_process";
|
|
4619
4646
|
import { defineCommand as defineCommand31 } from "citty";
|
|
4620
4647
|
import consola27 from "consola";
|
|
4621
4648
|
var destroyNestCommand = defineCommand31({
|
|
@@ -4629,7 +4656,7 @@ var destroyNestCommand = defineCommand31({
|
|
|
4629
4656
|
async run({ args }) {
|
|
4630
4657
|
const name = String(args.name);
|
|
4631
4658
|
try {
|
|
4632
|
-
|
|
4659
|
+
execFileSync10("apes", ["run", "--as", "root", "--wait", "--", "apes", "agents", "destroy", name, "--force"], { stdio: "inherit" });
|
|
4633
4660
|
consola27.success(`Nest will tear down ${name}'s pm2 process on its next reconcile (\u22642s).`);
|
|
4634
4661
|
} catch (err) {
|
|
4635
4662
|
const status = err.status ?? 1;
|
|
@@ -4639,7 +4666,7 @@ var destroyNestCommand = defineCommand31({
|
|
|
4639
4666
|
});
|
|
4640
4667
|
|
|
4641
4668
|
// src/commands/nest/install.ts
|
|
4642
|
-
import { execFileSync as
|
|
4669
|
+
import { execFileSync as execFileSync11 } from "child_process";
|
|
4643
4670
|
import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync11, writeFileSync as writeFileSync7 } from "fs";
|
|
4644
4671
|
import { homedir as homedir11, userInfo as userInfo2 } from "os";
|
|
4645
4672
|
import { dirname as dirname3, join as join11 } from "path";
|
|
@@ -4838,10 +4865,10 @@ var installNestCommand = defineCommand32({
|
|
|
4838
4865
|
}
|
|
4839
4866
|
const uid = userInfo2().uid;
|
|
4840
4867
|
try {
|
|
4841
|
-
|
|
4868
|
+
execFileSync11("/bin/launchctl", ["bootout", `gui/${uid}/${PLIST_LABEL}`], { stdio: "ignore" });
|
|
4842
4869
|
} catch {
|
|
4843
4870
|
}
|
|
4844
|
-
|
|
4871
|
+
execFileSync11("/bin/launchctl", ["bootstrap", `gui/${uid}`, plistPath()], { stdio: "inherit" });
|
|
4845
4872
|
consola28.success(`Nest daemon bootstrapped \u2014 http://127.0.0.1:${port}`);
|
|
4846
4873
|
consola28.info("");
|
|
4847
4874
|
consola28.info("Next steps for zero-prompt spawn \u2014 both one-time:");
|
|
@@ -4883,7 +4910,7 @@ var listNestCommand = defineCommand33({
|
|
|
4883
4910
|
});
|
|
4884
4911
|
|
|
4885
4912
|
// src/commands/nest/spawn.ts
|
|
4886
|
-
import { execFileSync as
|
|
4913
|
+
import { execFileSync as execFileSync12 } from "child_process";
|
|
4887
4914
|
import { defineCommand as defineCommand34 } from "citty";
|
|
4888
4915
|
import consola30 from "consola";
|
|
4889
4916
|
var spawnNestCommand = defineCommand34({
|
|
@@ -4916,7 +4943,7 @@ var spawnNestCommand = defineCommand34({
|
|
|
4916
4943
|
if (typeof args["bridge-base-url"] === "string") apesArgs.push("--bridge-base-url", args["bridge-base-url"]);
|
|
4917
4944
|
if (typeof args["bridge-model"] === "string") apesArgs.push("--bridge-model", args["bridge-model"]);
|
|
4918
4945
|
try {
|
|
4919
|
-
|
|
4946
|
+
execFileSync12("apes", apesArgs, { stdio: "inherit" });
|
|
4920
4947
|
consola30.success(`Nest will pick up ${name} on its next reconcile (\u22642s).`);
|
|
4921
4948
|
} catch (err) {
|
|
4922
4949
|
const status = err.status ?? 1;
|
|
@@ -4926,7 +4953,7 @@ var spawnNestCommand = defineCommand34({
|
|
|
4926
4953
|
});
|
|
4927
4954
|
|
|
4928
4955
|
// src/commands/nest/uninstall.ts
|
|
4929
|
-
import { execFileSync as
|
|
4956
|
+
import { execFileSync as execFileSync13 } from "child_process";
|
|
4930
4957
|
import { existsSync as existsSync14, unlinkSync } from "fs";
|
|
4931
4958
|
import { homedir as homedir12, userInfo as userInfo3 } from "os";
|
|
4932
4959
|
import { join as join12 } from "path";
|
|
@@ -4942,7 +4969,7 @@ var uninstallNestCommand = defineCommand35({
|
|
|
4942
4969
|
const uid = userInfo3().uid;
|
|
4943
4970
|
const path2 = join12(homedir12(), "Library", "LaunchAgents", `${PLIST_LABEL2}.plist`);
|
|
4944
4971
|
try {
|
|
4945
|
-
|
|
4972
|
+
execFileSync13("/bin/launchctl", ["bootout", `gui/${uid}/${PLIST_LABEL2}`], { stdio: "ignore" });
|
|
4946
4973
|
consola31.success("Nest daemon stopped");
|
|
4947
4974
|
} catch {
|
|
4948
4975
|
consola31.info("Nest daemon was not loaded");
|
|
@@ -5496,7 +5523,7 @@ var adapterCommand = defineCommand41({
|
|
|
5496
5523
|
});
|
|
5497
5524
|
|
|
5498
5525
|
// src/commands/run.ts
|
|
5499
|
-
import { execFileSync as
|
|
5526
|
+
import { execFileSync as execFileSync14 } from "child_process";
|
|
5500
5527
|
import { hostname as hostname5 } from "os";
|
|
5501
5528
|
import { basename } from "path";
|
|
5502
5529
|
import { defineCommand as defineCommand42 } from "citty";
|
|
@@ -5774,7 +5801,7 @@ function execShellCommand(command) {
|
|
|
5774
5801
|
throw new CliError("No command to execute");
|
|
5775
5802
|
try {
|
|
5776
5803
|
const { APES_SHELL_WRAPPER: _wrapperMarker, ...inheritedEnv } = process.env;
|
|
5777
|
-
|
|
5804
|
+
execFileSync14(command[0], command.slice(1), {
|
|
5778
5805
|
stdio: "inherit",
|
|
5779
5806
|
env: inheritedEnv
|
|
5780
5807
|
});
|
|
@@ -5943,7 +5970,7 @@ function executeWithGrantToken(opts) {
|
|
|
5943
5970
|
consola36.info(`Executing: ${command.join(" ")}`);
|
|
5944
5971
|
try {
|
|
5945
5972
|
const { APES_SHELL_WRAPPER: _wrapperMarker, ...inheritedEnv } = process.env;
|
|
5946
|
-
|
|
5973
|
+
execFileSync14(args["escapes-path"] || "escapes", ["--grant", token, "--", ...command], {
|
|
5947
5974
|
stdio: "inherit",
|
|
5948
5975
|
env: inheritedEnv
|
|
5949
5976
|
});
|
|
@@ -6014,7 +6041,7 @@ note = "VPC-internal hostname suffix"
|
|
|
6014
6041
|
|
|
6015
6042
|
// src/proxy/local-proxy.ts
|
|
6016
6043
|
import { spawn } from "child_process";
|
|
6017
|
-
import { mkdtempSync as mkdtempSync3, rmSync as
|
|
6044
|
+
import { mkdtempSync as mkdtempSync3, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "fs";
|
|
6018
6045
|
import { createRequire } from "module";
|
|
6019
6046
|
import { tmpdir as tmpdir3 } from "os";
|
|
6020
6047
|
import { dirname as dirname4, join as join13, resolve as resolve3 } from "path";
|
|
@@ -6039,7 +6066,7 @@ async function startEphemeralProxy(configToml) {
|
|
|
6039
6066
|
});
|
|
6040
6067
|
const cleanupTmp = () => {
|
|
6041
6068
|
try {
|
|
6042
|
-
|
|
6069
|
+
rmSync5(tmpDir, { recursive: true, force: true });
|
|
6043
6070
|
} catch {
|
|
6044
6071
|
}
|
|
6045
6072
|
};
|
|
@@ -6466,7 +6493,7 @@ var mcpCommand = defineCommand48({
|
|
|
6466
6493
|
if (transport !== "stdio" && transport !== "sse") {
|
|
6467
6494
|
throw new Error('Transport must be "stdio" or "sse"');
|
|
6468
6495
|
}
|
|
6469
|
-
const { startMcpServer } = await import("./server-
|
|
6496
|
+
const { startMcpServer } = await import("./server-K77SHBP2.js");
|
|
6470
6497
|
await startMcpServer(transport, port);
|
|
6471
6498
|
}
|
|
6472
6499
|
});
|
|
@@ -6474,7 +6501,7 @@ var mcpCommand = defineCommand48({
|
|
|
6474
6501
|
// src/commands/init/index.ts
|
|
6475
6502
|
import { existsSync as existsSync15, copyFileSync, writeFileSync as writeFileSync9 } from "fs";
|
|
6476
6503
|
import { randomBytes } from "crypto";
|
|
6477
|
-
import { execFileSync as
|
|
6504
|
+
import { execFileSync as execFileSync15 } from "child_process";
|
|
6478
6505
|
import { join as join14 } from "path";
|
|
6479
6506
|
import { defineCommand as defineCommand49 } from "citty";
|
|
6480
6507
|
import consola40 from "consola";
|
|
@@ -6486,11 +6513,11 @@ async function downloadTemplate(repo, targetDir) {
|
|
|
6486
6513
|
function installDeps(dir) {
|
|
6487
6514
|
const hasLockFile = (name) => existsSync15(join14(dir, name));
|
|
6488
6515
|
if (hasLockFile("pnpm-lock.yaml")) {
|
|
6489
|
-
|
|
6516
|
+
execFileSync15("pnpm", ["install"], { cwd: dir, stdio: "inherit" });
|
|
6490
6517
|
} else if (hasLockFile("bun.lockb")) {
|
|
6491
|
-
|
|
6518
|
+
execFileSync15("bun", ["install"], { cwd: dir, stdio: "inherit" });
|
|
6492
6519
|
} else {
|
|
6493
|
-
|
|
6520
|
+
execFileSync15("npm", ["install"], { cwd: dir, stdio: "inherit" });
|
|
6494
6521
|
}
|
|
6495
6522
|
}
|
|
6496
6523
|
async function promptChoice(message, choices) {
|
|
@@ -7104,7 +7131,7 @@ async function bestEffortGrantCount(idp) {
|
|
|
7104
7131
|
}
|
|
7105
7132
|
}
|
|
7106
7133
|
async function runHealth(args) {
|
|
7107
|
-
const version = true ? "1.
|
|
7134
|
+
const version = true ? "1.24.0" : "0.0.0";
|
|
7108
7135
|
const auth = loadAuth();
|
|
7109
7136
|
if (!auth) {
|
|
7110
7137
|
throw new CliError("Not logged in. Run `apes login` first.", 1);
|
|
@@ -7377,10 +7404,10 @@ if (shellRewrite) {
|
|
|
7377
7404
|
if (shellRewrite.action === "rewrite") {
|
|
7378
7405
|
process.argv = shellRewrite.argv;
|
|
7379
7406
|
} else if (shellRewrite.action === "version") {
|
|
7380
|
-
console.log(`ape-shell ${"1.
|
|
7407
|
+
console.log(`ape-shell ${"1.24.0"} (OpenApe DDISA shell wrapper)`);
|
|
7381
7408
|
process.exit(0);
|
|
7382
7409
|
} else if (shellRewrite.action === "help") {
|
|
7383
|
-
console.log(`ape-shell ${"1.
|
|
7410
|
+
console.log(`ape-shell ${"1.24.0"} \u2014 OpenApe DDISA shell wrapper`);
|
|
7384
7411
|
console.log("");
|
|
7385
7412
|
console.log("Usage:");
|
|
7386
7413
|
console.log(" ape-shell Start interactive grant-mediated REPL");
|
|
@@ -7438,7 +7465,7 @@ var configCommand = defineCommand60({
|
|
|
7438
7465
|
var main = defineCommand60({
|
|
7439
7466
|
meta: {
|
|
7440
7467
|
name: "apes",
|
|
7441
|
-
version: "1.
|
|
7468
|
+
version: "1.24.0",
|
|
7442
7469
|
description: "Unified CLI for OpenApe"
|
|
7443
7470
|
},
|
|
7444
7471
|
subCommands: {
|
|
@@ -7495,7 +7522,7 @@ async function maybeRefreshAuth() {
|
|
|
7495
7522
|
}
|
|
7496
7523
|
}
|
|
7497
7524
|
await maybeRefreshAuth();
|
|
7498
|
-
await maybeWarnStaleVersion("1.
|
|
7525
|
+
await maybeWarnStaleVersion("1.24.0").catch(() => {
|
|
7499
7526
|
});
|
|
7500
7527
|
runMain(main).catch((err) => {
|
|
7501
7528
|
if (err instanceof CliExit) {
|