@openape/apes 0.18.0 → 0.20.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
@@ -63,7 +63,7 @@ import {
63
63
  } from "./chunk-IDPV5SNB.js";
64
64
 
65
65
  // src/cli.ts
66
- import consola33 from "consola";
66
+ import consola35 from "consola";
67
67
 
68
68
  // src/ape-shell.ts
69
69
  import path from "path";
@@ -93,7 +93,7 @@ function rewriteApeShellArgs(argv, argv0) {
93
93
  }
94
94
 
95
95
  // src/cli.ts
96
- import { defineCommand as defineCommand41, runMain } from "citty";
96
+ import { defineCommand as defineCommand44, runMain } from "citty";
97
97
 
98
98
  // src/commands/auth/login.ts
99
99
  import { Buffer } from "buffer";
@@ -2327,7 +2327,7 @@ function generateKeyPairInMemory() {
2327
2327
  var spawnAgentCommand = defineCommand23({
2328
2328
  meta: {
2329
2329
  name: "spawn",
2330
- description: "Provision a local macOS agent end-to-end (OS user, keypair, IdP agent, ape-shell, Claude hook)"
2330
+ description: "Provision a local macOS agent end-to-end (OS user, keypair, IdP agent, Claude hook)"
2331
2331
  },
2332
2332
  args: {
2333
2333
  name: {
@@ -2337,7 +2337,7 @@ var spawnAgentCommand = defineCommand23({
2337
2337
  },
2338
2338
  shell: {
2339
2339
  type: "string",
2340
- description: "Override login shell. Default: $(which ape-shell)"
2340
+ description: "Login shell for the macOS user. Default: /bin/zsh. Pass $(which ape-shell) to opt into the grant-mediated REPL as login shell."
2341
2341
  },
2342
2342
  "no-claude-hook": {
2343
2343
  type: "boolean",
@@ -2364,10 +2364,7 @@ var spawnAgentCommand = defineCommand23({
2364
2364
  if (!idp) {
2365
2365
  throw new CliError("No IdP URL configured. Run `apes login` first.");
2366
2366
  }
2367
- const apeShell = args.shell ?? whichBinary("ape-shell");
2368
- if (!apeShell) {
2369
- throw new CliError("`ape-shell` not found on PATH. Install @openape/apes globally first.");
2370
- }
2367
+ const loginShell = (args.shell ?? "/bin/zsh").toString();
2371
2368
  const apes = whichBinary("apes");
2372
2369
  if (!apes) {
2373
2370
  throw new CliError("`apes` not found on PATH. Install @openape/apes globally first.");
@@ -2378,10 +2375,10 @@ var spawnAgentCommand = defineCommand23({
2378
2375
  "`escapes` not found on PATH. spawn delegates the privileged setup phase to escapes; install it before running spawn."
2379
2376
  );
2380
2377
  }
2381
- if (!isShellRegistered(apeShell)) {
2378
+ if (!isShellRegistered(loginShell)) {
2382
2379
  throw new CliError(
2383
- `${apeShell} is not registered in /etc/shells. macOS refuses to set it as a login shell. Run:
2384
- echo ${apeShell} | sudo tee -a /etc/shells
2380
+ `${loginShell} is not registered in /etc/shells. macOS refuses to set it as a login shell. Run:
2381
+ echo ${loginShell} | sudo tee -a /etc/shells
2385
2382
  and try again.`
2386
2383
  );
2387
2384
  }
@@ -2414,7 +2411,7 @@ and try again.`
2414
2411
  const script = buildSpawnSetupScript({
2415
2412
  name,
2416
2413
  homeDir,
2417
- shellPath: apeShell,
2414
+ shellPath: loginShell,
2418
2415
  privateKeyPem: privatePem,
2419
2416
  publicKeySshLine: publicSshLine,
2420
2417
  authJson,
@@ -3701,7 +3698,7 @@ var mcpCommand = defineCommand32({
3701
3698
  if (transport !== "stdio" && transport !== "sse") {
3702
3699
  throw new Error('Transport must be "stdio" or "sse"');
3703
3700
  }
3704
- const { startMcpServer } = await import("./server-RPC46G4J.js");
3701
+ const { startMcpServer } = await import("./server-XZHBOWRD.js");
3705
3702
  await startMcpServer(transport, port);
3706
3703
  }
3707
3704
  });
@@ -4172,11 +4169,81 @@ var utilsCommand = defineCommand37({
4172
4169
  }
4173
4170
  });
4174
4171
 
4175
- // src/commands/dns-check.ts
4172
+ // src/commands/sessions/index.ts
4173
+ import { defineCommand as defineCommand40 } from "citty";
4174
+
4175
+ // src/commands/sessions/list.ts
4176
4176
  import { defineCommand as defineCommand38 } from "citty";
4177
4177
  import consola31 from "consola";
4178
+ var sessionsListCommand = defineCommand38({
4179
+ meta: {
4180
+ name: "list",
4181
+ description: "List your active refresh-token families (one per logged-in device)."
4182
+ },
4183
+ args: {
4184
+ json: { type: "boolean", description: "JSON output" },
4185
+ limit: { type: "string", description: "Max rows (default 50)" }
4186
+ },
4187
+ async run({ args }) {
4188
+ const path2 = args.limit ? `/api/me/sessions?limit=${encodeURIComponent(String(args.limit))}` : "/api/me/sessions";
4189
+ const result = await apiFetch(path2);
4190
+ if (args.json) {
4191
+ process.stdout.write(`${JSON.stringify(result, null, 2)}
4192
+ `);
4193
+ return;
4194
+ }
4195
+ if (result.data.length === 0) {
4196
+ consola31.info("No active sessions.");
4197
+ return;
4198
+ }
4199
+ for (const f of result.data) {
4200
+ const created = new Date(f.createdAt).toISOString();
4201
+ const expires = new Date(f.expiresAt).toISOString();
4202
+ console.log(`${f.familyId} client=${f.clientId} created=${created} expires=${expires}`);
4203
+ }
4204
+ }
4205
+ });
4206
+
4207
+ // src/commands/sessions/remove.ts
4208
+ import { defineCommand as defineCommand39 } from "citty";
4209
+ import consola32 from "consola";
4210
+ var sessionsRemoveCommand = defineCommand39({
4211
+ meta: {
4212
+ name: "remove",
4213
+ description: "Revoke one of your active refresh-token families by id."
4214
+ },
4215
+ args: {
4216
+ familyId: {
4217
+ type: "positional",
4218
+ required: true,
4219
+ description: "Family id (from `apes sessions list`)."
4220
+ }
4221
+ },
4222
+ async run({ args }) {
4223
+ const id = String(args.familyId).trim();
4224
+ if (!id) throw new CliError("familyId required");
4225
+ await apiFetch(`/api/me/sessions/${encodeURIComponent(id)}`, { method: "DELETE" });
4226
+ consola32.success(`Session ${id} revoked. The device using it will need to \`apes login\` again on its next refresh.`);
4227
+ }
4228
+ });
4229
+
4230
+ // src/commands/sessions/index.ts
4231
+ var sessionsCommand = defineCommand40({
4232
+ meta: {
4233
+ name: "sessions",
4234
+ description: "Manage your active refresh-token sessions across devices"
4235
+ },
4236
+ subCommands: {
4237
+ list: sessionsListCommand,
4238
+ remove: sessionsRemoveCommand
4239
+ }
4240
+ });
4241
+
4242
+ // src/commands/dns-check.ts
4243
+ import { defineCommand as defineCommand41 } from "citty";
4244
+ import consola33 from "consola";
4178
4245
  import { resolveDDISA as resolveDDISA3 } from "@openape/core";
4179
- var dnsCheckCommand = defineCommand38({
4246
+ var dnsCheckCommand = defineCommand41({
4180
4247
  meta: {
4181
4248
  name: "dns-check",
4182
4249
  description: "Validate DDISA DNS TXT records for a domain"
@@ -4190,7 +4257,7 @@ var dnsCheckCommand = defineCommand38({
4190
4257
  },
4191
4258
  async run({ args }) {
4192
4259
  const domain = args.domain;
4193
- consola31.start(`Checking _ddisa.${domain}...`);
4260
+ consola33.start(`Checking _ddisa.${domain}...`);
4194
4261
  try {
4195
4262
  const result = await resolveDDISA3(domain);
4196
4263
  if (!result) {
@@ -4199,7 +4266,7 @@ var dnsCheckCommand = defineCommand38({
4199
4266
  console.log(` _ddisa.${domain} TXT "v=ddisa1 idp=https://id.${domain}"`);
4200
4267
  throw new CliError(`No DDISA record found for ${domain}`);
4201
4268
  }
4202
- consola31.success(`_ddisa.${domain} \u2192 ${result.idp}`);
4269
+ consola33.success(`_ddisa.${domain} \u2192 ${result.idp}`);
4203
4270
  console.log("");
4204
4271
  console.log(` Version: ${result.version || "ddisa1"}`);
4205
4272
  console.log(` IdP URL: ${result.idp}`);
@@ -4208,14 +4275,14 @@ var dnsCheckCommand = defineCommand38({
4208
4275
  if (result.priority !== void 0)
4209
4276
  console.log(` Priority: ${result.priority}`);
4210
4277
  console.log("");
4211
- consola31.start(`Verifying IdP at ${result.idp}...`);
4278
+ consola33.start(`Verifying IdP at ${result.idp}...`);
4212
4279
  const discoResp = await fetch(`${result.idp}/.well-known/openid-configuration`);
4213
4280
  if (!discoResp.ok) {
4214
- consola31.warn(`IdP discovery failed (${discoResp.status}). Is the IdP running at ${result.idp}?`);
4281
+ consola33.warn(`IdP discovery failed (${discoResp.status}). Is the IdP running at ${result.idp}?`);
4215
4282
  return;
4216
4283
  }
4217
4284
  const disco = await discoResp.json();
4218
- consola31.success(`IdP is reachable`);
4285
+ consola33.success(`IdP is reachable`);
4219
4286
  console.log(` Issuer: ${disco.issuer}`);
4220
4287
  console.log(` DDISA: v${disco.ddisa_version || "?"}`);
4221
4288
  if (disco.ddisa_auth_methods_supported) {
@@ -4233,7 +4300,7 @@ var dnsCheckCommand = defineCommand38({
4233
4300
  // src/commands/health.ts
4234
4301
  import { exec } from "child_process";
4235
4302
  import { promisify } from "util";
4236
- import { defineCommand as defineCommand39 } from "citty";
4303
+ import { defineCommand as defineCommand42 } from "citty";
4237
4304
  var execAsync = promisify(exec);
4238
4305
  async function resolveApeShellPath() {
4239
4306
  try {
@@ -4269,7 +4336,7 @@ async function bestEffortGrantCount(idp) {
4269
4336
  }
4270
4337
  }
4271
4338
  async function runHealth(args) {
4272
- const version = true ? "0.18.0" : "0.0.0";
4339
+ const version = true ? "0.20.0" : "0.0.0";
4273
4340
  const auth = loadAuth();
4274
4341
  if (!auth) {
4275
4342
  throw new CliError("Not logged in. Run `apes login` first.", 1);
@@ -4332,7 +4399,7 @@ async function runHealth(args) {
4332
4399
  throw new CliError(`IdP ${auth.idp} unreachable: ${idpProbe.error}`, 1);
4333
4400
  }
4334
4401
  }
4335
- var healthCommand = defineCommand39({
4402
+ var healthCommand = defineCommand42({
4336
4403
  meta: {
4337
4404
  name: "health",
4338
4405
  description: "Report CLI diagnostic state (auth, IdP, grants, binaries)"
@@ -4350,8 +4417,8 @@ var healthCommand = defineCommand39({
4350
4417
  });
4351
4418
 
4352
4419
  // src/commands/workflows.ts
4353
- import { defineCommand as defineCommand40 } from "citty";
4354
- import consola32 from "consola";
4420
+ import { defineCommand as defineCommand43 } from "citty";
4421
+ import consola34 from "consola";
4355
4422
 
4356
4423
  // src/guides/index.ts
4357
4424
  var guides = [
@@ -4401,7 +4468,7 @@ var guides = [
4401
4468
  ];
4402
4469
 
4403
4470
  // src/commands/workflows.ts
4404
- var workflowsCommand = defineCommand40({
4471
+ var workflowsCommand = defineCommand43({
4405
4472
  meta: {
4406
4473
  name: "workflows",
4407
4474
  description: "Discover workflow guides"
@@ -4422,7 +4489,7 @@ var workflowsCommand = defineCommand40({
4422
4489
  if (args.id) {
4423
4490
  const guide = guides.find((g) => g.id === String(args.id));
4424
4491
  if (!guide) {
4425
- consola32.info(`Available: ${guides.map((g) => g.id).join(", ")}`);
4492
+ consola34.info(`Available: ${guides.map((g) => g.id).join(", ")}`);
4426
4493
  throw new CliError(`Guide not found: ${args.id}`);
4427
4494
  }
4428
4495
  if (args.json) {
@@ -4471,10 +4538,10 @@ if (shellRewrite) {
4471
4538
  if (shellRewrite.action === "rewrite") {
4472
4539
  process.argv = shellRewrite.argv;
4473
4540
  } else if (shellRewrite.action === "version") {
4474
- console.log(`ape-shell ${"0.18.0"} (OpenApe DDISA shell wrapper)`);
4541
+ console.log(`ape-shell ${"0.20.0"} (OpenApe DDISA shell wrapper)`);
4475
4542
  process.exit(0);
4476
4543
  } else if (shellRewrite.action === "help") {
4477
- console.log(`ape-shell ${"0.18.0"} \u2014 OpenApe DDISA shell wrapper`);
4544
+ console.log(`ape-shell ${"0.20.0"} \u2014 OpenApe DDISA shell wrapper`);
4478
4545
  console.log("");
4479
4546
  console.log("Usage:");
4480
4547
  console.log(" ape-shell Start interactive grant-mediated REPL");
@@ -4489,7 +4556,7 @@ if (shellRewrite) {
4489
4556
  console.log(" --help, -h Show this help message");
4490
4557
  process.exit(0);
4491
4558
  } else if (shellRewrite.action === "interactive") {
4492
- const { runInteractiveShell } = await import("./orchestrator-FJVDWH45.js");
4559
+ const { runInteractiveShell } = await import("./orchestrator-RWTALOSA.js");
4493
4560
  await runInteractiveShell();
4494
4561
  process.exit(0);
4495
4562
  } else {
@@ -4498,7 +4565,7 @@ if (shellRewrite) {
4498
4565
  }
4499
4566
  }
4500
4567
  var debug = process.argv.includes("--debug");
4501
- var grantsCommand = defineCommand41({
4568
+ var grantsCommand = defineCommand44({
4502
4569
  meta: {
4503
4570
  name: "grants",
4504
4571
  description: "Grant management"
@@ -4519,7 +4586,7 @@ var grantsCommand = defineCommand41({
4519
4586
  "delegation-revoke": delegationRevokeCommand
4520
4587
  }
4521
4588
  });
4522
- var configCommand = defineCommand41({
4589
+ var configCommand = defineCommand44({
4523
4590
  meta: {
4524
4591
  name: "config",
4525
4592
  description: "Configuration management"
@@ -4529,10 +4596,10 @@ var configCommand = defineCommand41({
4529
4596
  set: configSetCommand
4530
4597
  }
4531
4598
  });
4532
- var main = defineCommand41({
4599
+ var main = defineCommand44({
4533
4600
  meta: {
4534
4601
  name: "apes",
4535
- version: "0.18.0",
4602
+ version: "0.20.0",
4536
4603
  description: "Unified CLI for OpenApe"
4537
4604
  },
4538
4605
  subCommands: {
@@ -4541,6 +4608,7 @@ var main = defineCommand41({
4541
4608
  "register-user": registerUserCommand,
4542
4609
  "dns-check": dnsCheckCommand,
4543
4610
  utils: utilsCommand,
4611
+ sessions: sessionsCommand,
4544
4612
  login: loginCommand,
4545
4613
  logout: logoutCommand,
4546
4614
  whoami: whoamiCommand,
@@ -4591,13 +4659,13 @@ runMain(main).catch((err) => {
4591
4659
  process.exit(err.exitCode);
4592
4660
  }
4593
4661
  if (err instanceof CliError) {
4594
- consola33.error(err.message);
4662
+ consola35.error(err.message);
4595
4663
  process.exit(err.exitCode);
4596
4664
  }
4597
4665
  if (debug) {
4598
- consola33.error(err);
4666
+ consola35.error(err);
4599
4667
  } else {
4600
- consola33.error(err instanceof ApiError ? err.message : err instanceof Error ? err.message : String(err));
4668
+ consola35.error(err instanceof ApiError ? err.message : err instanceof Error ? err.message : String(err));
4601
4669
  }
4602
4670
  process.exit(1);
4603
4671
  });