@openape/apes 1.22.2 → 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 }
|
|
@@ -4347,11 +4374,10 @@ var syncAgentCommand = defineCommand27({
|
|
|
4347
4374
|
ownerEmail: auth.owner_email
|
|
4348
4375
|
});
|
|
4349
4376
|
consola24.info(sync.first_sync ? "\u2713 first sync \u2014 agent registered" : "\u2713 presence updated");
|
|
4350
|
-
const { system_prompt: systemPrompt, tools,
|
|
4377
|
+
const { system_prompt: systemPrompt, tools, skills, tasks } = await client.listTasks();
|
|
4351
4378
|
consola24.info(`Pulled ${tasks.length} task${tasks.length === 1 ? "" : "s"}`);
|
|
4352
4379
|
consola24.info(`Tools enabled: ${tools.length === 0 ? "(none)" : tools.join(", ")}`);
|
|
4353
4380
|
consola24.info(`Skills: ${skills.length === 0 ? "(none)" : skills.map((s) => s.name).join(", ")}`);
|
|
4354
|
-
consola24.info(`SOUL.md: ${soul.length > 0 ? `${soul.length} chars` : "(empty)"}`);
|
|
4355
4381
|
let agentUid = null;
|
|
4356
4382
|
let agentGid = null;
|
|
4357
4383
|
if (process.geteuid?.() === 0) {
|
|
@@ -4390,10 +4416,6 @@ var syncAgentCommand = defineCommand27({
|
|
|
4390
4416
|
`, { mode: 384 });
|
|
4391
4417
|
chownToAgent(path2);
|
|
4392
4418
|
}
|
|
4393
|
-
const soulPath = join8(agentDir, "SOUL.md");
|
|
4394
|
-
writeFileSync5(soulPath, soul.endsWith("\n") ? soul : `${soul}
|
|
4395
|
-
`, { mode: 384 });
|
|
4396
|
-
chownToAgent(soulPath);
|
|
4397
4419
|
const skillsDir = join8(agentDir, "skills");
|
|
4398
4420
|
mkdirSync3(skillsDir, { recursive: true });
|
|
4399
4421
|
chownToAgent(skillsDir);
|
|
@@ -4402,7 +4424,7 @@ var syncAgentCommand = defineCommand27({
|
|
|
4402
4424
|
for (const entry of readdirSync(skillsDir)) {
|
|
4403
4425
|
if (incomingNames.has(entry)) continue;
|
|
4404
4426
|
try {
|
|
4405
|
-
|
|
4427
|
+
rmSync4(join8(skillsDir, entry), { recursive: true, force: true });
|
|
4406
4428
|
} catch {
|
|
4407
4429
|
}
|
|
4408
4430
|
}
|
|
@@ -4443,7 +4465,7 @@ var agentsCommand = defineCommand28({
|
|
|
4443
4465
|
import { defineCommand as defineCommand36 } from "citty";
|
|
4444
4466
|
|
|
4445
4467
|
// src/commands/nest/authorize.ts
|
|
4446
|
-
import { execFileSync as
|
|
4468
|
+
import { execFileSync as execFileSync9 } from "child_process";
|
|
4447
4469
|
import { existsSync as existsSync12, readFileSync as readFileSync10 } from "fs";
|
|
4448
4470
|
import { join as join10 } from "path";
|
|
4449
4471
|
import { defineCommand as defineCommand30 } from "citty";
|
|
@@ -4610,7 +4632,7 @@ var authorizeNestCommand = defineCommand30({
|
|
|
4610
4632
|
cmdArgs.push("--expires-in", args["expires-in"]);
|
|
4611
4633
|
}
|
|
4612
4634
|
try {
|
|
4613
|
-
|
|
4635
|
+
execFileSync9("apes", cmdArgs, { stdio: "inherit" });
|
|
4614
4636
|
} catch (err) {
|
|
4615
4637
|
throw new CliError(err instanceof Error ? err.message : String(err));
|
|
4616
4638
|
}
|
|
@@ -4620,7 +4642,7 @@ var authorizeNestCommand = defineCommand30({
|
|
|
4620
4642
|
});
|
|
4621
4643
|
|
|
4622
4644
|
// src/commands/nest/destroy.ts
|
|
4623
|
-
import { execFileSync as
|
|
4645
|
+
import { execFileSync as execFileSync10 } from "child_process";
|
|
4624
4646
|
import { defineCommand as defineCommand31 } from "citty";
|
|
4625
4647
|
import consola27 from "consola";
|
|
4626
4648
|
var destroyNestCommand = defineCommand31({
|
|
@@ -4634,7 +4656,7 @@ var destroyNestCommand = defineCommand31({
|
|
|
4634
4656
|
async run({ args }) {
|
|
4635
4657
|
const name = String(args.name);
|
|
4636
4658
|
try {
|
|
4637
|
-
|
|
4659
|
+
execFileSync10("apes", ["run", "--as", "root", "--wait", "--", "apes", "agents", "destroy", name, "--force"], { stdio: "inherit" });
|
|
4638
4660
|
consola27.success(`Nest will tear down ${name}'s pm2 process on its next reconcile (\u22642s).`);
|
|
4639
4661
|
} catch (err) {
|
|
4640
4662
|
const status = err.status ?? 1;
|
|
@@ -4644,7 +4666,7 @@ var destroyNestCommand = defineCommand31({
|
|
|
4644
4666
|
});
|
|
4645
4667
|
|
|
4646
4668
|
// src/commands/nest/install.ts
|
|
4647
|
-
import { execFileSync as
|
|
4669
|
+
import { execFileSync as execFileSync11 } from "child_process";
|
|
4648
4670
|
import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync11, writeFileSync as writeFileSync7 } from "fs";
|
|
4649
4671
|
import { homedir as homedir11, userInfo as userInfo2 } from "os";
|
|
4650
4672
|
import { dirname as dirname3, join as join11 } from "path";
|
|
@@ -4843,10 +4865,10 @@ var installNestCommand = defineCommand32({
|
|
|
4843
4865
|
}
|
|
4844
4866
|
const uid = userInfo2().uid;
|
|
4845
4867
|
try {
|
|
4846
|
-
|
|
4868
|
+
execFileSync11("/bin/launchctl", ["bootout", `gui/${uid}/${PLIST_LABEL}`], { stdio: "ignore" });
|
|
4847
4869
|
} catch {
|
|
4848
4870
|
}
|
|
4849
|
-
|
|
4871
|
+
execFileSync11("/bin/launchctl", ["bootstrap", `gui/${uid}`, plistPath()], { stdio: "inherit" });
|
|
4850
4872
|
consola28.success(`Nest daemon bootstrapped \u2014 http://127.0.0.1:${port}`);
|
|
4851
4873
|
consola28.info("");
|
|
4852
4874
|
consola28.info("Next steps for zero-prompt spawn \u2014 both one-time:");
|
|
@@ -4888,7 +4910,7 @@ var listNestCommand = defineCommand33({
|
|
|
4888
4910
|
});
|
|
4889
4911
|
|
|
4890
4912
|
// src/commands/nest/spawn.ts
|
|
4891
|
-
import { execFileSync as
|
|
4913
|
+
import { execFileSync as execFileSync12 } from "child_process";
|
|
4892
4914
|
import { defineCommand as defineCommand34 } from "citty";
|
|
4893
4915
|
import consola30 from "consola";
|
|
4894
4916
|
var spawnNestCommand = defineCommand34({
|
|
@@ -4921,7 +4943,7 @@ var spawnNestCommand = defineCommand34({
|
|
|
4921
4943
|
if (typeof args["bridge-base-url"] === "string") apesArgs.push("--bridge-base-url", args["bridge-base-url"]);
|
|
4922
4944
|
if (typeof args["bridge-model"] === "string") apesArgs.push("--bridge-model", args["bridge-model"]);
|
|
4923
4945
|
try {
|
|
4924
|
-
|
|
4946
|
+
execFileSync12("apes", apesArgs, { stdio: "inherit" });
|
|
4925
4947
|
consola30.success(`Nest will pick up ${name} on its next reconcile (\u22642s).`);
|
|
4926
4948
|
} catch (err) {
|
|
4927
4949
|
const status = err.status ?? 1;
|
|
@@ -4931,7 +4953,7 @@ var spawnNestCommand = defineCommand34({
|
|
|
4931
4953
|
});
|
|
4932
4954
|
|
|
4933
4955
|
// src/commands/nest/uninstall.ts
|
|
4934
|
-
import { execFileSync as
|
|
4956
|
+
import { execFileSync as execFileSync13 } from "child_process";
|
|
4935
4957
|
import { existsSync as existsSync14, unlinkSync } from "fs";
|
|
4936
4958
|
import { homedir as homedir12, userInfo as userInfo3 } from "os";
|
|
4937
4959
|
import { join as join12 } from "path";
|
|
@@ -4947,7 +4969,7 @@ var uninstallNestCommand = defineCommand35({
|
|
|
4947
4969
|
const uid = userInfo3().uid;
|
|
4948
4970
|
const path2 = join12(homedir12(), "Library", "LaunchAgents", `${PLIST_LABEL2}.plist`);
|
|
4949
4971
|
try {
|
|
4950
|
-
|
|
4972
|
+
execFileSync13("/bin/launchctl", ["bootout", `gui/${uid}/${PLIST_LABEL2}`], { stdio: "ignore" });
|
|
4951
4973
|
consola31.success("Nest daemon stopped");
|
|
4952
4974
|
} catch {
|
|
4953
4975
|
consola31.info("Nest daemon was not loaded");
|
|
@@ -5501,7 +5523,7 @@ var adapterCommand = defineCommand41({
|
|
|
5501
5523
|
});
|
|
5502
5524
|
|
|
5503
5525
|
// src/commands/run.ts
|
|
5504
|
-
import { execFileSync as
|
|
5526
|
+
import { execFileSync as execFileSync14 } from "child_process";
|
|
5505
5527
|
import { hostname as hostname5 } from "os";
|
|
5506
5528
|
import { basename } from "path";
|
|
5507
5529
|
import { defineCommand as defineCommand42 } from "citty";
|
|
@@ -5779,7 +5801,7 @@ function execShellCommand(command) {
|
|
|
5779
5801
|
throw new CliError("No command to execute");
|
|
5780
5802
|
try {
|
|
5781
5803
|
const { APES_SHELL_WRAPPER: _wrapperMarker, ...inheritedEnv } = process.env;
|
|
5782
|
-
|
|
5804
|
+
execFileSync14(command[0], command.slice(1), {
|
|
5783
5805
|
stdio: "inherit",
|
|
5784
5806
|
env: inheritedEnv
|
|
5785
5807
|
});
|
|
@@ -5948,7 +5970,7 @@ function executeWithGrantToken(opts) {
|
|
|
5948
5970
|
consola36.info(`Executing: ${command.join(" ")}`);
|
|
5949
5971
|
try {
|
|
5950
5972
|
const { APES_SHELL_WRAPPER: _wrapperMarker, ...inheritedEnv } = process.env;
|
|
5951
|
-
|
|
5973
|
+
execFileSync14(args["escapes-path"] || "escapes", ["--grant", token, "--", ...command], {
|
|
5952
5974
|
stdio: "inherit",
|
|
5953
5975
|
env: inheritedEnv
|
|
5954
5976
|
});
|
|
@@ -6019,7 +6041,7 @@ note = "VPC-internal hostname suffix"
|
|
|
6019
6041
|
|
|
6020
6042
|
// src/proxy/local-proxy.ts
|
|
6021
6043
|
import { spawn } from "child_process";
|
|
6022
|
-
import { mkdtempSync as mkdtempSync3, rmSync as
|
|
6044
|
+
import { mkdtempSync as mkdtempSync3, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "fs";
|
|
6023
6045
|
import { createRequire } from "module";
|
|
6024
6046
|
import { tmpdir as tmpdir3 } from "os";
|
|
6025
6047
|
import { dirname as dirname4, join as join13, resolve as resolve3 } from "path";
|
|
@@ -6044,7 +6066,7 @@ async function startEphemeralProxy(configToml) {
|
|
|
6044
6066
|
});
|
|
6045
6067
|
const cleanupTmp = () => {
|
|
6046
6068
|
try {
|
|
6047
|
-
|
|
6069
|
+
rmSync5(tmpDir, { recursive: true, force: true });
|
|
6048
6070
|
} catch {
|
|
6049
6071
|
}
|
|
6050
6072
|
};
|
|
@@ -6471,7 +6493,7 @@ var mcpCommand = defineCommand48({
|
|
|
6471
6493
|
if (transport !== "stdio" && transport !== "sse") {
|
|
6472
6494
|
throw new Error('Transport must be "stdio" or "sse"');
|
|
6473
6495
|
}
|
|
6474
|
-
const { startMcpServer } = await import("./server-
|
|
6496
|
+
const { startMcpServer } = await import("./server-K77SHBP2.js");
|
|
6475
6497
|
await startMcpServer(transport, port);
|
|
6476
6498
|
}
|
|
6477
6499
|
});
|
|
@@ -6479,7 +6501,7 @@ var mcpCommand = defineCommand48({
|
|
|
6479
6501
|
// src/commands/init/index.ts
|
|
6480
6502
|
import { existsSync as existsSync15, copyFileSync, writeFileSync as writeFileSync9 } from "fs";
|
|
6481
6503
|
import { randomBytes } from "crypto";
|
|
6482
|
-
import { execFileSync as
|
|
6504
|
+
import { execFileSync as execFileSync15 } from "child_process";
|
|
6483
6505
|
import { join as join14 } from "path";
|
|
6484
6506
|
import { defineCommand as defineCommand49 } from "citty";
|
|
6485
6507
|
import consola40 from "consola";
|
|
@@ -6491,11 +6513,11 @@ async function downloadTemplate(repo, targetDir) {
|
|
|
6491
6513
|
function installDeps(dir) {
|
|
6492
6514
|
const hasLockFile = (name) => existsSync15(join14(dir, name));
|
|
6493
6515
|
if (hasLockFile("pnpm-lock.yaml")) {
|
|
6494
|
-
|
|
6516
|
+
execFileSync15("pnpm", ["install"], { cwd: dir, stdio: "inherit" });
|
|
6495
6517
|
} else if (hasLockFile("bun.lockb")) {
|
|
6496
|
-
|
|
6518
|
+
execFileSync15("bun", ["install"], { cwd: dir, stdio: "inherit" });
|
|
6497
6519
|
} else {
|
|
6498
|
-
|
|
6520
|
+
execFileSync15("npm", ["install"], { cwd: dir, stdio: "inherit" });
|
|
6499
6521
|
}
|
|
6500
6522
|
}
|
|
6501
6523
|
async function promptChoice(message, choices) {
|
|
@@ -7109,7 +7131,7 @@ async function bestEffortGrantCount(idp) {
|
|
|
7109
7131
|
}
|
|
7110
7132
|
}
|
|
7111
7133
|
async function runHealth(args) {
|
|
7112
|
-
const version = true ? "1.
|
|
7134
|
+
const version = true ? "1.24.0" : "0.0.0";
|
|
7113
7135
|
const auth = loadAuth();
|
|
7114
7136
|
if (!auth) {
|
|
7115
7137
|
throw new CliError("Not logged in. Run `apes login` first.", 1);
|
|
@@ -7382,10 +7404,10 @@ if (shellRewrite) {
|
|
|
7382
7404
|
if (shellRewrite.action === "rewrite") {
|
|
7383
7405
|
process.argv = shellRewrite.argv;
|
|
7384
7406
|
} else if (shellRewrite.action === "version") {
|
|
7385
|
-
console.log(`ape-shell ${"1.
|
|
7407
|
+
console.log(`ape-shell ${"1.24.0"} (OpenApe DDISA shell wrapper)`);
|
|
7386
7408
|
process.exit(0);
|
|
7387
7409
|
} else if (shellRewrite.action === "help") {
|
|
7388
|
-
console.log(`ape-shell ${"1.
|
|
7410
|
+
console.log(`ape-shell ${"1.24.0"} \u2014 OpenApe DDISA shell wrapper`);
|
|
7389
7411
|
console.log("");
|
|
7390
7412
|
console.log("Usage:");
|
|
7391
7413
|
console.log(" ape-shell Start interactive grant-mediated REPL");
|
|
@@ -7443,7 +7465,7 @@ var configCommand = defineCommand60({
|
|
|
7443
7465
|
var main = defineCommand60({
|
|
7444
7466
|
meta: {
|
|
7445
7467
|
name: "apes",
|
|
7446
|
-
version: "1.
|
|
7468
|
+
version: "1.24.0",
|
|
7447
7469
|
description: "Unified CLI for OpenApe"
|
|
7448
7470
|
},
|
|
7449
7471
|
subCommands: {
|
|
@@ -7500,7 +7522,7 @@ async function maybeRefreshAuth() {
|
|
|
7500
7522
|
}
|
|
7501
7523
|
}
|
|
7502
7524
|
await maybeRefreshAuth();
|
|
7503
|
-
await maybeWarnStaleVersion("1.
|
|
7525
|
+
await maybeWarnStaleVersion("1.24.0").catch(() => {
|
|
7504
7526
|
});
|
|
7505
7527
|
runMain(main).catch((err) => {
|
|
7506
7528
|
if (err instanceof CliExit) {
|