@openape/apes 1.2.1 → 1.3.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
@@ -379,7 +379,7 @@ async function loginWithPKCE(idp) {
379
379
  consola2.success(`Logged in as ${payload.email || payload.sub}`);
380
380
  }
381
381
  async function loginWithKey(idp, keyPath, agentEmail) {
382
- const { readFileSync: readFileSync14 } = await import("fs");
382
+ const { readFileSync: readFileSync13 } = await import("fs");
383
383
  const { sign: sign3 } = await import("crypto");
384
384
  const { loadEd25519PrivateKey: loadEd25519PrivateKey2 } = await import("./ssh-key-YBNNG5K5.js");
385
385
  const challengeUrl = await getAgentChallengeEndpoint(idp);
@@ -392,7 +392,7 @@ async function loginWithKey(idp, keyPath, agentEmail) {
392
392
  throw new CliError(`Challenge failed: ${await challengeResp.text()}`);
393
393
  }
394
394
  const { challenge } = await challengeResp.json();
395
- const keyContent = readFileSync14(keyPath, "utf-8");
395
+ const keyContent = readFileSync13(keyPath, "utf-8");
396
396
  const privateKey = loadEd25519PrivateKey2(keyContent);
397
397
  const signature = sign3(null, Buffer2.from(challenge), privateKey).toString("base64");
398
398
  const authenticateUrl = await getAgentAuthenticateEndpoint(idp);
@@ -3750,208 +3750,18 @@ async function resolveClaudeToken(opts) {
3750
3750
  }
3751
3751
 
3752
3752
  // src/commands/agents/sync.ts
3753
- import { chownSync, existsSync as existsSync9, mkdirSync as mkdirSync4, readFileSync as readFileSync10, statSync, writeFileSync as writeFileSync6 } from "fs";
3753
+ import { chownSync, existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync9, statSync, writeFileSync as writeFileSync5 } from "fs";
3754
3754
  import { homedir as homedir9 } from "os";
3755
- import { join as join8 } from "path";
3755
+ import { join as join7 } from "path";
3756
3756
  import { defineCommand as defineCommand27 } from "citty";
3757
3757
  import consola24 from "consola";
3758
3758
 
3759
- // src/lib/launchd-reconcile.ts
3760
- import { execFileSync as execFileSync8 } from "child_process";
3761
- import { mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync9, unlinkSync, writeFileSync as writeFileSync5 } from "fs";
3762
- import { userInfo as userInfo2 } from "os";
3763
- import { join as join7 } from "path";
3764
- var PLIST_PREFIX = "openape.troop.";
3765
- function plistDir() {
3766
- return "/Library/LaunchDaemons";
3767
- }
3768
- function plistPath(agentName, taskId) {
3769
- return join7(plistDir(), `${PLIST_PREFIX}${agentName}.${taskId}.plist`);
3770
- }
3771
- function plistLabel(agentName, taskId) {
3772
- return `${PLIST_PREFIX}${agentName}.${taskId}`;
3773
- }
3774
- function fieldValues(token, range) {
3775
- const [min, max] = range;
3776
- if (token === "*") return null;
3777
- if (token.startsWith("*/")) {
3778
- const step = Number(token.slice(2));
3779
- if (!Number.isInteger(step) || step < 1) return [];
3780
- const values = [];
3781
- for (let i = min; i <= max; i++) {
3782
- if (i % step === 0) values.push(i);
3783
- }
3784
- return values;
3785
- }
3786
- const n = Number(token);
3787
- return Number.isInteger(n) ? [n] : [];
3788
- }
3789
- function cronToSchedule(expr) {
3790
- const parts = expr.trim().split(/\s+/);
3791
- if (parts.length !== 5) return [];
3792
- const [m, h, dom, mo, dow] = parts;
3793
- const minutes = fieldValues(m, [0, 59]);
3794
- const hours = fieldValues(h, [0, 23]);
3795
- const doms = fieldValues(dom, [1, 31]);
3796
- const months = fieldValues(mo, [1, 12]);
3797
- const dows = fieldValues(dow, [0, 7]);
3798
- const slots = [];
3799
- const minList = minutes ?? [null];
3800
- const hourList = hours ?? [null];
3801
- const domList = doms ?? [null];
3802
- const monthList = months ?? [null];
3803
- const dowList = dows ?? [null];
3804
- for (const M of minList) {
3805
- for (const H of hourList) {
3806
- for (const D of domList) {
3807
- for (const Mo of monthList) {
3808
- for (const W of dowList) {
3809
- const slot = {};
3810
- if (M !== null) slot.Minute = M;
3811
- if (H !== null) slot.Hour = H;
3812
- if (D !== null) slot.Day = D;
3813
- if (Mo !== null) slot.Month = Mo;
3814
- if (W !== null) slot.Weekday = W === 7 ? 0 : W;
3815
- slots.push(slot);
3816
- }
3817
- }
3818
- }
3819
- }
3820
- }
3821
- return slots;
3822
- }
3823
- function escape2(s) {
3824
- return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
3825
- }
3826
- function plistBody(input) {
3827
- const calendarBlocks = input.schedule.map((slot) => {
3828
- const lines = [];
3829
- if (slot.Minute !== void 0) lines.push(` <key>Minute</key><integer>${slot.Minute}</integer>`);
3830
- if (slot.Hour !== void 0) lines.push(` <key>Hour</key><integer>${slot.Hour}</integer>`);
3831
- if (slot.Day !== void 0) lines.push(` <key>Day</key><integer>${slot.Day}</integer>`);
3832
- if (slot.Month !== void 0) lines.push(` <key>Month</key><integer>${slot.Month}</integer>`);
3833
- if (slot.Weekday !== void 0) lines.push(` <key>Weekday</key><integer>${slot.Weekday}</integer>`);
3834
- return ` <dict>
3835
- ${lines.join("\n")}
3836
- </dict>`;
3837
- }).join("\n");
3838
- const calendarKey = input.schedule.length === 1 ? ` <key>StartCalendarInterval</key>
3839
- <dict>
3840
- ${calendarBlocks.replace(/^ {4}/gm, " ").replace(/^ {2}<dict>\n|\n {2}<\/dict>$/g, "")}
3841
- </dict>` : ` <key>StartCalendarInterval</key>
3842
- <array>
3843
- ${calendarBlocks}
3844
- </array>`;
3845
- return `<?xml version="1.0" encoding="UTF-8"?>
3846
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3847
- <plist version="1.0">
3848
- <dict>
3849
- <key>Label</key>
3850
- <string>${escape2(input.label)}</string>
3851
- <key>UserName</key>
3852
- <string>${escape2(input.userName)}</string>
3853
- <key>ProgramArguments</key>
3854
- <array>
3855
- <string>${escape2(input.apesBin)}</string>
3856
- <string>agents</string>
3857
- <string>run</string>
3858
- <string>${escape2(input.taskId)}</string>
3859
- </array>
3860
- <key>WorkingDirectory</key>
3861
- <string>${escape2(input.homeDir)}</string>
3862
- <key>EnvironmentVariables</key>
3863
- <dict>
3864
- <key>HOME</key>
3865
- <string>${escape2(input.homeDir)}</string>
3866
- <key>PATH</key>
3867
- <string>${escape2(input.homeDir)}/.bun/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
3868
- </dict>
3869
- ${calendarKey}
3870
- <key>StandardOutPath</key>
3871
- <string>${escape2(input.homeDir)}/Library/Logs/openape-troop-${escape2(input.taskId)}.log</string>
3872
- <key>StandardErrorPath</key>
3873
- <string>${escape2(input.homeDir)}/Library/Logs/openape-troop-${escape2(input.taskId)}.log</string>
3874
- </dict>
3875
- </plist>
3876
- `;
3877
- }
3878
- function buildPlistContent(args) {
3879
- return plistBody({
3880
- label: plistLabel(args.agentName, args.task.taskId),
3881
- apesBin: args.apesBin,
3882
- taskId: args.task.taskId,
3883
- schedule: cronToSchedule(args.task.cron),
3884
- homeDir: args.homeDir,
3885
- userName: args.userName ?? userInfo2().username
3886
- });
3887
- }
3888
- function bootstrap(label, path2) {
3889
- try {
3890
- execFileSync8("/bin/launchctl", ["bootout", `system/${label}`], { stdio: "ignore" });
3891
- } catch {
3892
- }
3893
- execFileSync8("/bin/launchctl", ["bootstrap", "system", path2], { stdio: "ignore" });
3894
- }
3895
- function bootout(label) {
3896
- try {
3897
- execFileSync8("/bin/launchctl", ["bootout", `system/${label}`], { stdio: "ignore" });
3898
- } catch {
3899
- }
3900
- }
3901
- function reconcile(input) {
3902
- mkdirSync3(plistDir(), { recursive: true });
3903
- const present = readdirSync(plistDir()).filter((f) => f.startsWith(`${PLIST_PREFIX}${input.agentName}.`) && f.endsWith(".plist"));
3904
- const presentTaskIds = new Set(
3905
- present.map((f) => f.slice(`${PLIST_PREFIX}${input.agentName}.`.length, -".plist".length))
3906
- );
3907
- const desiredById = new Map(input.desired.map((t) => [t.taskId, t]));
3908
- const result = { added: [], updated: [], removed: [], unchanged: [] };
3909
- for (const taskId of presentTaskIds) {
3910
- if (!desiredById.has(taskId)) {
3911
- const path2 = plistPath(input.agentName, taskId);
3912
- bootout(plistLabel(input.agentName, taskId));
3913
- try {
3914
- unlinkSync(path2);
3915
- } catch {
3916
- }
3917
- result.removed.push(taskId);
3918
- }
3919
- }
3920
- for (const task of input.desired) {
3921
- const path2 = plistPath(input.agentName, task.taskId);
3922
- const desiredContent = buildPlistContent({
3923
- agentName: input.agentName,
3924
- apesBin: input.apesBin,
3925
- homeDir: input.homeDir,
3926
- task,
3927
- userName: input.userName
3928
- });
3929
- let existingContent = "";
3930
- try {
3931
- existingContent = readFileSync9(path2, "utf8");
3932
- } catch {
3933
- }
3934
- if (existingContent === desiredContent) {
3935
- if (task.enabled) bootstrap(plistLabel(input.agentName, task.taskId), path2);
3936
- else bootout(plistLabel(input.agentName, task.taskId));
3937
- result.unchanged.push(task.taskId);
3938
- continue;
3939
- }
3940
- writeFileSync5(path2, desiredContent, { mode: 420 });
3941
- if (task.enabled) bootstrap(plistLabel(input.agentName, task.taskId), path2);
3942
- else bootout(plistLabel(input.agentName, task.taskId));
3943
- if (presentTaskIds.has(task.taskId)) result.updated.push(task.taskId);
3944
- else result.added.push(task.taskId);
3945
- }
3946
- return result;
3947
- }
3948
-
3949
3759
  // src/lib/macos-host.ts
3950
- import { execFileSync as execFileSync9 } from "child_process";
3760
+ import { execFileSync as execFileSync8 } from "child_process";
3951
3761
  import { hostname as hostname3 } from "os";
3952
3762
  function getHostId() {
3953
3763
  try {
3954
- const output = execFileSync9(
3764
+ const output = execFileSync8(
3955
3765
  "/usr/sbin/ioreg",
3956
3766
  ["-d2", "-c", "IOPlatformExpertDevice"],
3957
3767
  { encoding: "utf8", timeout: 2e3 }
@@ -3971,15 +3781,15 @@ function getHostname() {
3971
3781
  }
3972
3782
 
3973
3783
  // src/commands/agents/sync.ts
3974
- var AUTH_PATH3 = join8(homedir9(), ".config", "apes", "auth.json");
3975
- var TASK_CACHE_DIR2 = join8(homedir9(), ".openape", "agent", "tasks");
3784
+ var AUTH_PATH3 = join7(homedir9(), ".config", "apes", "auth.json");
3785
+ var TASK_CACHE_DIR2 = join7(homedir9(), ".openape", "agent", "tasks");
3976
3786
  function readAuthJson() {
3977
3787
  if (!existsSync9(AUTH_PATH3)) {
3978
3788
  throw new CliError(
3979
3789
  `No agent auth found at ${AUTH_PATH3}. Run \`apes agents spawn <name>\` to provision an agent first.`
3980
3790
  );
3981
3791
  }
3982
- const raw = readFileSync10(AUTH_PATH3, "utf8");
3792
+ const raw = readFileSync9(AUTH_PATH3, "utf8");
3983
3793
  let parsed;
3984
3794
  try {
3985
3795
  parsed = JSON.parse(raw);
@@ -4003,14 +3813,6 @@ function agentNameFromEmail(email) {
4003
3813
  }
4004
3814
  return before.slice(0, dashIdx);
4005
3815
  }
4006
- function findApesBin() {
4007
- const argv1 = process.argv[1];
4008
- if (argv1 && existsSync9(argv1)) return argv1;
4009
- for (const candidate of ["/opt/homebrew/bin/apes", "/usr/local/bin/apes"]) {
4010
- if (existsSync9(candidate)) return candidate;
4011
- }
4012
- throw new CliError("Could not locate the apes binary path for launchd. Set APES_BIN env var to point at it.");
4013
- }
4014
3816
  var syncAgentCommand = defineCommand27({
4015
3817
  meta: {
4016
3818
  name: "sync",
@@ -4062,41 +3864,26 @@ var syncAgentCommand = defineCommand27({
4062
3864
  }
4063
3865
  }
4064
3866
  }
4065
- const agentDir = join8(homedir9(), ".openape", "agent");
4066
- mkdirSync4(agentDir, { recursive: true });
4067
- chownToAgent(join8(homedir9(), ".openape"));
3867
+ const agentDir = join7(homedir9(), ".openape", "agent");
3868
+ mkdirSync3(agentDir, { recursive: true });
3869
+ chownToAgent(join7(homedir9(), ".openape"));
4068
3870
  chownToAgent(agentDir);
4069
- const agentJsonPath = join8(agentDir, "agent.json");
4070
- writeFileSync6(
3871
+ const agentJsonPath = join7(agentDir, "agent.json");
3872
+ writeFileSync5(
4071
3873
  agentJsonPath,
4072
3874
  `${JSON.stringify({ systemPrompt }, null, 2)}
4073
3875
  `,
4074
3876
  { mode: 384 }
4075
3877
  );
4076
3878
  chownToAgent(agentJsonPath);
4077
- mkdirSync4(TASK_CACHE_DIR2, { recursive: true });
3879
+ mkdirSync3(TASK_CACHE_DIR2, { recursive: true });
4078
3880
  chownToAgent(TASK_CACHE_DIR2);
4079
3881
  for (const task of tasks) {
4080
- const path2 = join8(TASK_CACHE_DIR2, `${task.taskId}.json`);
4081
- writeFileSync6(path2, `${JSON.stringify(task, null, 2)}
3882
+ const path2 = join7(TASK_CACHE_DIR2, `${task.taskId}.json`);
3883
+ writeFileSync5(path2, `${JSON.stringify(task, null, 2)}
4082
3884
  `, { mode: 384 });
4083
3885
  chownToAgent(path2);
4084
3886
  }
4085
- const apesBin = findApesBin();
4086
- const result = reconcile({
4087
- agentName,
4088
- apesBin,
4089
- homeDir: homedir9(),
4090
- desired: tasks,
4091
- // Sync runs as root in production — pass the agent username
4092
- // explicitly for the UserName plist key (launchd will then run
4093
- // each task daemon AS the agent, not as root).
4094
- userName: process.env.AGENT_USER || void 0
4095
- });
4096
- if (result.added.length) consola24.success(`launchd: added ${result.added.join(", ")}`);
4097
- if (result.updated.length) consola24.success(`launchd: updated ${result.updated.join(", ")}`);
4098
- if (result.removed.length) consola24.warn(`launchd: removed ${result.removed.join(", ")}`);
4099
- if (result.unchanged.length) consola24.info(`launchd: ${result.unchanged.length} unchanged`);
4100
3887
  consola24.success("Sync complete.");
4101
3888
  }
4102
3889
  });
@@ -4448,7 +4235,7 @@ var adapterCommand = defineCommand29({
4448
4235
  });
4449
4236
 
4450
4237
  // src/commands/run.ts
4451
- import { execFileSync as execFileSync10 } from "child_process";
4238
+ import { execFileSync as execFileSync9 } from "child_process";
4452
4239
  import { hostname as hostname4 } from "os";
4453
4240
  import { basename } from "path";
4454
4241
  import { defineCommand as defineCommand30 } from "citty";
@@ -4726,7 +4513,7 @@ function execShellCommand(command) {
4726
4513
  throw new CliError("No command to execute");
4727
4514
  try {
4728
4515
  const { APES_SHELL_WRAPPER: _wrapperMarker, ...inheritedEnv } = process.env;
4729
- execFileSync10(command[0], command.slice(1), {
4516
+ execFileSync9(command[0], command.slice(1), {
4730
4517
  stdio: "inherit",
4731
4518
  env: inheritedEnv
4732
4519
  });
@@ -4878,7 +4665,7 @@ async function runAudienceMode(audience, action, args) {
4878
4665
  consola26.info(`Executing: ${command.join(" ")}`);
4879
4666
  try {
4880
4667
  const { APES_SHELL_WRAPPER: _wrapperMarker, ...inheritedEnv } = process.env;
4881
- execFileSync10(args["escapes-path"] || "escapes", ["--grant", authz_jwt, "--", ...command], {
4668
+ execFileSync9(args["escapes-path"] || "escapes", ["--grant", authz_jwt, "--", ...command], {
4882
4669
  stdio: "inherit",
4883
4670
  env: inheritedEnv
4884
4671
  });
@@ -4928,10 +4715,10 @@ note = "VPC-internal hostname suffix"
4928
4715
 
4929
4716
  // src/proxy/local-proxy.ts
4930
4717
  import { spawn } from "child_process";
4931
- import { mkdtempSync as mkdtempSync3, rmSync as rmSync3, writeFileSync as writeFileSync7 } from "fs";
4718
+ import { mkdtempSync as mkdtempSync3, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "fs";
4932
4719
  import { createRequire } from "module";
4933
4720
  import { tmpdir as tmpdir3 } from "os";
4934
- import { dirname as dirname3, join as join9, resolve as resolve4 } from "path";
4721
+ import { dirname as dirname3, join as join8, resolve as resolve4 } from "path";
4935
4722
  var require2 = createRequire(import.meta.url);
4936
4723
  function findProxyBin() {
4937
4724
  const pkgPath = require2.resolve("@openape/proxy/package.json");
@@ -4943,9 +4730,9 @@ function findProxyBin() {
4943
4730
  return resolve4(dirname3(pkgPath), binRel);
4944
4731
  }
4945
4732
  async function startEphemeralProxy(configToml) {
4946
- const tmpDir = mkdtempSync3(join9(tmpdir3(), "openape-proxy-"));
4947
- const configPath = join9(tmpDir, "config.toml");
4948
- writeFileSync7(configPath, configToml, { mode: 384 });
4733
+ const tmpDir = mkdtempSync3(join8(tmpdir3(), "openape-proxy-"));
4734
+ const configPath = join8(tmpDir, "config.toml");
4735
+ writeFileSync6(configPath, configToml, { mode: 384 });
4949
4736
  const binPath = findProxyBin();
4950
4737
  const child = spawn(process.execPath, [binPath, "-c", configPath], {
4951
4738
  stdio: ["ignore", "pipe", "pipe"],
@@ -5380,16 +5167,16 @@ var mcpCommand = defineCommand36({
5380
5167
  if (transport !== "stdio" && transport !== "sse") {
5381
5168
  throw new Error('Transport must be "stdio" or "sse"');
5382
5169
  }
5383
- const { startMcpServer } = await import("./server-YDC3S4PC.js");
5170
+ const { startMcpServer } = await import("./server-W5ZP3FWK.js");
5384
5171
  await startMcpServer(transport, port);
5385
5172
  }
5386
5173
  });
5387
5174
 
5388
5175
  // src/commands/init/index.ts
5389
- import { existsSync as existsSync10, copyFileSync, writeFileSync as writeFileSync8 } from "fs";
5176
+ import { existsSync as existsSync10, copyFileSync, writeFileSync as writeFileSync7 } from "fs";
5390
5177
  import { randomBytes } from "crypto";
5391
- import { execFileSync as execFileSync11 } from "child_process";
5392
- import { join as join10 } from "path";
5178
+ import { execFileSync as execFileSync10 } from "child_process";
5179
+ import { join as join9 } from "path";
5393
5180
  import { defineCommand as defineCommand37 } from "citty";
5394
5181
  import consola30 from "consola";
5395
5182
  var DEFAULT_IDP_URL = "https://id.openape.at";
@@ -5398,13 +5185,13 @@ async function downloadTemplate(repo, targetDir) {
5398
5185
  await gigetDownload(`gh:${repo}`, { dir: targetDir, force: false });
5399
5186
  }
5400
5187
  function installDeps(dir) {
5401
- const hasLockFile = (name) => existsSync10(join10(dir, name));
5188
+ const hasLockFile = (name) => existsSync10(join9(dir, name));
5402
5189
  if (hasLockFile("pnpm-lock.yaml")) {
5403
- execFileSync11("pnpm", ["install"], { cwd: dir, stdio: "inherit" });
5190
+ execFileSync10("pnpm", ["install"], { cwd: dir, stdio: "inherit" });
5404
5191
  } else if (hasLockFile("bun.lockb")) {
5405
- execFileSync11("bun", ["install"], { cwd: dir, stdio: "inherit" });
5192
+ execFileSync10("bun", ["install"], { cwd: dir, stdio: "inherit" });
5406
5193
  } else {
5407
- execFileSync11("npm", ["install"], { cwd: dir, stdio: "inherit" });
5194
+ execFileSync10("npm", ["install"], { cwd: dir, stdio: "inherit" });
5408
5195
  }
5409
5196
  }
5410
5197
  async function promptChoice(message, choices) {
@@ -5463,7 +5250,7 @@ var initCommand = defineCommand37({
5463
5250
  });
5464
5251
  async function initSP(targetDir) {
5465
5252
  const dir = targetDir || "my-app";
5466
- if (existsSync10(join10(dir, "package.json"))) {
5253
+ if (existsSync10(join9(dir, "package.json"))) {
5467
5254
  throw new CliError(`Directory "${dir}" already contains a project.`);
5468
5255
  }
5469
5256
  consola30.start("Scaffolding SP starter...");
@@ -5472,8 +5259,8 @@ async function initSP(targetDir) {
5472
5259
  consola30.start("Installing dependencies...");
5473
5260
  installDeps(dir);
5474
5261
  consola30.success("Dependencies installed");
5475
- const envExample = join10(dir, ".env.example");
5476
- const envFile = join10(dir, ".env");
5262
+ const envExample = join9(dir, ".env.example");
5263
+ const envFile = join9(dir, ".env");
5477
5264
  if (existsSync10(envExample) && !existsSync10(envFile)) {
5478
5265
  copyFileSync(envExample, envFile);
5479
5266
  consola30.success(`\`.env\` created (using Free IdP at ${DEFAULT_IDP_URL})`);
@@ -5488,7 +5275,7 @@ async function initSP(targetDir) {
5488
5275
  }
5489
5276
  async function initIdP(targetDir) {
5490
5277
  const dir = targetDir || "my-idp";
5491
- if (existsSync10(join10(dir, "package.json"))) {
5278
+ if (existsSync10(join9(dir, "package.json"))) {
5492
5279
  throw new CliError(`Directory "${dir}" already contains a project.`);
5493
5280
  }
5494
5281
  const domain = await promptText("Domain for the IdP", "localhost");
@@ -5520,7 +5307,7 @@ async function initIdP(targetDir) {
5520
5307
  `NUXT_OPENAPE_RP_ID=${domain}`,
5521
5308
  `NUXT_OPENAPE_RP_ORIGIN=${origin}`
5522
5309
  ].join("\n");
5523
- writeFileSync8(join10(dir, ".env"), `${envContent}
5310
+ writeFileSync7(join9(dir, ".env"), `${envContent}
5524
5311
  `, { mode: 384 });
5525
5312
  consola30.success(".env created");
5526
5313
  console.log("");
@@ -5541,7 +5328,7 @@ async function initIdP(targetDir) {
5541
5328
 
5542
5329
  // src/commands/enroll.ts
5543
5330
  import { Buffer as Buffer5 } from "buffer";
5544
- import { existsSync as existsSync11, readFileSync as readFileSync11 } from "fs";
5331
+ import { existsSync as existsSync11, readFileSync as readFileSync10 } from "fs";
5545
5332
  import { execFile as execFile2 } from "child_process";
5546
5333
  import { sign as sign2 } from "crypto";
5547
5334
  import { defineCommand as defineCommand38 } from "citty";
@@ -5557,7 +5344,7 @@ function openBrowser2(url) {
5557
5344
  }
5558
5345
  async function pollForEnrollment(idp, agentEmail, keyPath) {
5559
5346
  const resolvedKey = resolveKeyPath(keyPath);
5560
- const keyContent = readFileSync11(resolvedKey, "utf-8");
5347
+ const keyContent = readFileSync10(resolvedKey, "utf-8");
5561
5348
  const privateKey = loadEd25519PrivateKey(keyContent);
5562
5349
  const challengeUrl = await getAgentChallengeEndpoint(idp);
5563
5350
  const authenticateUrl = await getAgentAuthenticateEndpoint(idp);
@@ -5669,7 +5456,7 @@ var enrollCommand = defineCommand38({
5669
5456
  });
5670
5457
 
5671
5458
  // src/commands/register-user.ts
5672
- import { existsSync as existsSync12, readFileSync as readFileSync12 } from "fs";
5459
+ import { existsSync as existsSync12, readFileSync as readFileSync11 } from "fs";
5673
5460
  import { defineCommand as defineCommand39 } from "citty";
5674
5461
  import consola32 from "consola";
5675
5462
  var registerUserCommand = defineCommand39({
@@ -5709,7 +5496,7 @@ var registerUserCommand = defineCommand39({
5709
5496
  }
5710
5497
  let publicKey = args.key;
5711
5498
  if (existsSync12(args.key)) {
5712
- publicKey = readFileSync12(args.key, "utf-8").trim();
5499
+ publicKey = readFileSync11(args.key, "utf-8").trim();
5713
5500
  }
5714
5501
  if (!publicKey.startsWith("ssh-ed25519 ")) {
5715
5502
  throw new CliError("Public key must be in ssh-ed25519 format.");
@@ -6018,7 +5805,7 @@ async function bestEffortGrantCount(idp) {
6018
5805
  }
6019
5806
  }
6020
5807
  async function runHealth(args) {
6021
- const version = true ? "1.2.1" : "0.0.0";
5808
+ const version = true ? "1.3.0" : "0.0.0";
6022
5809
  const auth = loadAuth();
6023
5810
  if (!auth) {
6024
5811
  throw new CliError("Not logged in. Run `apes login` first.", 1);
@@ -6211,26 +5998,26 @@ var workflowsCommand = defineCommand47({
6211
5998
  });
6212
5999
 
6213
6000
  // src/version-check.ts
6214
- import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync13, writeFileSync as writeFileSync9 } from "fs";
6001
+ import { existsSync as existsSync13, mkdirSync as mkdirSync4, readFileSync as readFileSync12, writeFileSync as writeFileSync8 } from "fs";
6215
6002
  import { homedir as homedir10 } from "os";
6216
- import { join as join11 } from "path";
6003
+ import { join as join10 } from "path";
6217
6004
  import consola38 from "consola";
6218
6005
  var PACKAGE_NAME = "@openape/apes";
6219
6006
  var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
6220
- var CACHE_FILE = join11(homedir10(), ".config", "apes", ".version-check.json");
6007
+ var CACHE_FILE = join10(homedir10(), ".config", "apes", ".version-check.json");
6221
6008
  function readCache() {
6222
6009
  if (!existsSync13(CACHE_FILE)) return null;
6223
6010
  try {
6224
- return JSON.parse(readFileSync13(CACHE_FILE, "utf-8"));
6011
+ return JSON.parse(readFileSync12(CACHE_FILE, "utf-8"));
6225
6012
  } catch {
6226
6013
  return null;
6227
6014
  }
6228
6015
  }
6229
6016
  function writeCache(entry) {
6230
6017
  try {
6231
- const dir = join11(homedir10(), ".config", "apes");
6232
- if (!existsSync13(dir)) mkdirSync5(dir, { recursive: true, mode: 448 });
6233
- writeFileSync9(CACHE_FILE, JSON.stringify(entry), { mode: 384 });
6018
+ const dir = join10(homedir10(), ".config", "apes");
6019
+ if (!existsSync13(dir)) mkdirSync4(dir, { recursive: true, mode: 448 });
6020
+ writeFileSync8(CACHE_FILE, JSON.stringify(entry), { mode: 384 });
6234
6021
  } catch {
6235
6022
  }
6236
6023
  }
@@ -6291,10 +6078,10 @@ if (shellRewrite) {
6291
6078
  if (shellRewrite.action === "rewrite") {
6292
6079
  process.argv = shellRewrite.argv;
6293
6080
  } else if (shellRewrite.action === "version") {
6294
- console.log(`ape-shell ${"1.2.1"} (OpenApe DDISA shell wrapper)`);
6081
+ console.log(`ape-shell ${"1.3.0"} (OpenApe DDISA shell wrapper)`);
6295
6082
  process.exit(0);
6296
6083
  } else if (shellRewrite.action === "help") {
6297
- console.log(`ape-shell ${"1.2.1"} \u2014 OpenApe DDISA shell wrapper`);
6084
+ console.log(`ape-shell ${"1.3.0"} \u2014 OpenApe DDISA shell wrapper`);
6298
6085
  console.log("");
6299
6086
  console.log("Usage:");
6300
6087
  console.log(" ape-shell Start interactive grant-mediated REPL");
@@ -6352,7 +6139,7 @@ var configCommand = defineCommand48({
6352
6139
  var main = defineCommand48({
6353
6140
  meta: {
6354
6141
  name: "apes",
6355
- version: "1.2.1",
6142
+ version: "1.3.0",
6356
6143
  description: "Unified CLI for OpenApe"
6357
6144
  },
6358
6145
  subCommands: {
@@ -6407,7 +6194,7 @@ async function maybeRefreshAuth() {
6407
6194
  }
6408
6195
  }
6409
6196
  await maybeRefreshAuth();
6410
- await maybeWarnStaleVersion("1.2.1").catch(() => {
6197
+ await maybeWarnStaleVersion("1.3.0").catch(() => {
6411
6198
  });
6412
6199
  runMain(main).catch((err) => {
6413
6200
  if (err instanceof CliExit) {