@openape/apes 0.17.0 → 0.19.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/{auth-lock-NYI376IM.js → auth-lock-GPLHRXOM.js} +2 -2
- package/dist/chunk-7NUT2PFT.js +220 -0
- package/dist/chunk-7NUT2PFT.js.map +1 -0
- package/dist/{chunk-OFIVF6NH.js → chunk-EDYICCBC.js} +2 -2
- package/dist/{chunk-6GPSKAMU.js → chunk-IDPV5SNB.js} +1 -1
- package/dist/{chunk-O7GSG3OE.js → chunk-IT6T6AKX.js} +31 -240
- package/dist/chunk-IT6T6AKX.js.map +1 -0
- package/dist/cli.js +138 -37
- package/dist/cli.js.map +1 -1
- package/dist/config-JH2IEPIR.js +30 -0
- package/dist/config-JH2IEPIR.js.map +1 -0
- package/dist/http-JZT4XV5I.js +23 -0
- package/dist/http-JZT4XV5I.js.map +1 -0
- package/dist/index.js +7 -5
- package/dist/{orchestrator-PUAO57CY.js → orchestrator-FJVDWH45.js} +8 -6
- package/dist/{orchestrator-PUAO57CY.js.map → orchestrator-FJVDWH45.js.map} +1 -1
- package/dist/{server-YGRMW3OW.js → server-GYHLAJXV.js} +8 -6
- package/dist/{server-YGRMW3OW.js.map → server-GYHLAJXV.js.map} +1 -1
- package/package.json +3 -3
- package/dist/chunk-O7GSG3OE.js.map +0 -1
- /package/dist/{auth-lock-NYI376IM.js.map → auth-lock-GPLHRXOM.js.map} +0 -0
- /package/dist/{chunk-OFIVF6NH.js.map → chunk-EDYICCBC.js.map} +0 -0
- /package/dist/{chunk-6GPSKAMU.js.map → chunk-IDPV5SNB.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -12,11 +12,9 @@ import {
|
|
|
12
12
|
checkSudoRejection,
|
|
13
13
|
isApesSelfDispatch,
|
|
14
14
|
notifyGrantPending
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EDYICCBC.js";
|
|
16
16
|
import {
|
|
17
|
-
ApiError,
|
|
18
17
|
GENERIC_OPERATION_ID,
|
|
19
|
-
apiFetch,
|
|
20
18
|
buildGenericResolved,
|
|
21
19
|
buildStructuredCliGrantRequest,
|
|
22
20
|
createShapesGrant,
|
|
@@ -28,10 +26,6 @@ import {
|
|
|
28
26
|
findAdapter,
|
|
29
27
|
findConflictingAdapters,
|
|
30
28
|
findExistingGrant,
|
|
31
|
-
getAgentAuthenticateEndpoint,
|
|
32
|
-
getAgentChallengeEndpoint,
|
|
33
|
-
getDelegationsEndpoint,
|
|
34
|
-
getGrantsEndpoint,
|
|
35
29
|
getInstalledDigest,
|
|
36
30
|
installAdapter,
|
|
37
31
|
isInstalled,
|
|
@@ -46,7 +40,15 @@ import {
|
|
|
46
40
|
searchAdapters,
|
|
47
41
|
verifyAndExecute,
|
|
48
42
|
waitForGrantStatus
|
|
49
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-IT6T6AKX.js";
|
|
44
|
+
import {
|
|
45
|
+
ApiError,
|
|
46
|
+
apiFetch,
|
|
47
|
+
getAgentAuthenticateEndpoint,
|
|
48
|
+
getAgentChallengeEndpoint,
|
|
49
|
+
getDelegationsEndpoint,
|
|
50
|
+
getGrantsEndpoint
|
|
51
|
+
} from "./chunk-7NUT2PFT.js";
|
|
50
52
|
import {
|
|
51
53
|
AUTH_FILE,
|
|
52
54
|
CONFIG_DIR,
|
|
@@ -58,10 +60,10 @@ import {
|
|
|
58
60
|
loadConfig,
|
|
59
61
|
saveAuth,
|
|
60
62
|
saveConfig
|
|
61
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-IDPV5SNB.js";
|
|
62
64
|
|
|
63
65
|
// src/cli.ts
|
|
64
|
-
import
|
|
66
|
+
import consola35 from "consola";
|
|
65
67
|
|
|
66
68
|
// src/ape-shell.ts
|
|
67
69
|
import path from "path";
|
|
@@ -91,7 +93,7 @@ function rewriteApeShellArgs(argv, argv0) {
|
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
// src/cli.ts
|
|
94
|
-
import { defineCommand as
|
|
96
|
+
import { defineCommand as defineCommand44, runMain } from "citty";
|
|
95
97
|
|
|
96
98
|
// src/commands/auth/login.ts
|
|
97
99
|
import { Buffer } from "buffer";
|
|
@@ -462,7 +464,7 @@ var whoamiCommand = defineCommand3({
|
|
|
462
464
|
console.log(`IdP: ${auth.idp}`);
|
|
463
465
|
console.log(`Token: ${isExpired ? "\u26A0 EXPIRED" : "valid"} (until ${expiresAt})`);
|
|
464
466
|
if (isExpired) {
|
|
465
|
-
consola4.warn("Token is expired. Run `apes login` to re-authenticate.");
|
|
467
|
+
consola4.warn("Token is expired and could not be auto-refreshed. Run `apes login` to re-authenticate.");
|
|
466
468
|
}
|
|
467
469
|
}
|
|
468
470
|
});
|
|
@@ -3699,7 +3701,7 @@ var mcpCommand = defineCommand32({
|
|
|
3699
3701
|
if (transport !== "stdio" && transport !== "sse") {
|
|
3700
3702
|
throw new Error('Transport must be "stdio" or "sse"');
|
|
3701
3703
|
}
|
|
3702
|
-
const { startMcpServer } = await import("./server-
|
|
3704
|
+
const { startMcpServer } = await import("./server-GYHLAJXV.js");
|
|
3703
3705
|
await startMcpServer(transport, port);
|
|
3704
3706
|
}
|
|
3705
3707
|
});
|
|
@@ -4170,11 +4172,81 @@ var utilsCommand = defineCommand37({
|
|
|
4170
4172
|
}
|
|
4171
4173
|
});
|
|
4172
4174
|
|
|
4173
|
-
// src/commands/
|
|
4175
|
+
// src/commands/sessions/index.ts
|
|
4176
|
+
import { defineCommand as defineCommand40 } from "citty";
|
|
4177
|
+
|
|
4178
|
+
// src/commands/sessions/list.ts
|
|
4174
4179
|
import { defineCommand as defineCommand38 } from "citty";
|
|
4175
4180
|
import consola31 from "consola";
|
|
4181
|
+
var sessionsListCommand = defineCommand38({
|
|
4182
|
+
meta: {
|
|
4183
|
+
name: "list",
|
|
4184
|
+
description: "List your active refresh-token families (one per logged-in device)."
|
|
4185
|
+
},
|
|
4186
|
+
args: {
|
|
4187
|
+
json: { type: "boolean", description: "JSON output" },
|
|
4188
|
+
limit: { type: "string", description: "Max rows (default 50)" }
|
|
4189
|
+
},
|
|
4190
|
+
async run({ args }) {
|
|
4191
|
+
const path2 = args.limit ? `/api/me/sessions?limit=${encodeURIComponent(String(args.limit))}` : "/api/me/sessions";
|
|
4192
|
+
const result = await apiFetch(path2);
|
|
4193
|
+
if (args.json) {
|
|
4194
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
4195
|
+
`);
|
|
4196
|
+
return;
|
|
4197
|
+
}
|
|
4198
|
+
if (result.data.length === 0) {
|
|
4199
|
+
consola31.info("No active sessions.");
|
|
4200
|
+
return;
|
|
4201
|
+
}
|
|
4202
|
+
for (const f of result.data) {
|
|
4203
|
+
const created = new Date(f.createdAt).toISOString();
|
|
4204
|
+
const expires = new Date(f.expiresAt).toISOString();
|
|
4205
|
+
console.log(`${f.familyId} client=${f.clientId} created=${created} expires=${expires}`);
|
|
4206
|
+
}
|
|
4207
|
+
}
|
|
4208
|
+
});
|
|
4209
|
+
|
|
4210
|
+
// src/commands/sessions/remove.ts
|
|
4211
|
+
import { defineCommand as defineCommand39 } from "citty";
|
|
4212
|
+
import consola32 from "consola";
|
|
4213
|
+
var sessionsRemoveCommand = defineCommand39({
|
|
4214
|
+
meta: {
|
|
4215
|
+
name: "remove",
|
|
4216
|
+
description: "Revoke one of your active refresh-token families by id."
|
|
4217
|
+
},
|
|
4218
|
+
args: {
|
|
4219
|
+
familyId: {
|
|
4220
|
+
type: "positional",
|
|
4221
|
+
required: true,
|
|
4222
|
+
description: "Family id (from `apes sessions list`)."
|
|
4223
|
+
}
|
|
4224
|
+
},
|
|
4225
|
+
async run({ args }) {
|
|
4226
|
+
const id = String(args.familyId).trim();
|
|
4227
|
+
if (!id) throw new CliError("familyId required");
|
|
4228
|
+
await apiFetch(`/api/me/sessions/${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
4229
|
+
consola32.success(`Session ${id} revoked. The device using it will need to \`apes login\` again on its next refresh.`);
|
|
4230
|
+
}
|
|
4231
|
+
});
|
|
4232
|
+
|
|
4233
|
+
// src/commands/sessions/index.ts
|
|
4234
|
+
var sessionsCommand = defineCommand40({
|
|
4235
|
+
meta: {
|
|
4236
|
+
name: "sessions",
|
|
4237
|
+
description: "Manage your active refresh-token sessions across devices"
|
|
4238
|
+
},
|
|
4239
|
+
subCommands: {
|
|
4240
|
+
list: sessionsListCommand,
|
|
4241
|
+
remove: sessionsRemoveCommand
|
|
4242
|
+
}
|
|
4243
|
+
});
|
|
4244
|
+
|
|
4245
|
+
// src/commands/dns-check.ts
|
|
4246
|
+
import { defineCommand as defineCommand41 } from "citty";
|
|
4247
|
+
import consola33 from "consola";
|
|
4176
4248
|
import { resolveDDISA as resolveDDISA3 } from "@openape/core";
|
|
4177
|
-
var dnsCheckCommand =
|
|
4249
|
+
var dnsCheckCommand = defineCommand41({
|
|
4178
4250
|
meta: {
|
|
4179
4251
|
name: "dns-check",
|
|
4180
4252
|
description: "Validate DDISA DNS TXT records for a domain"
|
|
@@ -4188,7 +4260,7 @@ var dnsCheckCommand = defineCommand38({
|
|
|
4188
4260
|
},
|
|
4189
4261
|
async run({ args }) {
|
|
4190
4262
|
const domain = args.domain;
|
|
4191
|
-
|
|
4263
|
+
consola33.start(`Checking _ddisa.${domain}...`);
|
|
4192
4264
|
try {
|
|
4193
4265
|
const result = await resolveDDISA3(domain);
|
|
4194
4266
|
if (!result) {
|
|
@@ -4197,7 +4269,7 @@ var dnsCheckCommand = defineCommand38({
|
|
|
4197
4269
|
console.log(` _ddisa.${domain} TXT "v=ddisa1 idp=https://id.${domain}"`);
|
|
4198
4270
|
throw new CliError(`No DDISA record found for ${domain}`);
|
|
4199
4271
|
}
|
|
4200
|
-
|
|
4272
|
+
consola33.success(`_ddisa.${domain} \u2192 ${result.idp}`);
|
|
4201
4273
|
console.log("");
|
|
4202
4274
|
console.log(` Version: ${result.version || "ddisa1"}`);
|
|
4203
4275
|
console.log(` IdP URL: ${result.idp}`);
|
|
@@ -4206,14 +4278,14 @@ var dnsCheckCommand = defineCommand38({
|
|
|
4206
4278
|
if (result.priority !== void 0)
|
|
4207
4279
|
console.log(` Priority: ${result.priority}`);
|
|
4208
4280
|
console.log("");
|
|
4209
|
-
|
|
4281
|
+
consola33.start(`Verifying IdP at ${result.idp}...`);
|
|
4210
4282
|
const discoResp = await fetch(`${result.idp}/.well-known/openid-configuration`);
|
|
4211
4283
|
if (!discoResp.ok) {
|
|
4212
|
-
|
|
4284
|
+
consola33.warn(`IdP discovery failed (${discoResp.status}). Is the IdP running at ${result.idp}?`);
|
|
4213
4285
|
return;
|
|
4214
4286
|
}
|
|
4215
4287
|
const disco = await discoResp.json();
|
|
4216
|
-
|
|
4288
|
+
consola33.success(`IdP is reachable`);
|
|
4217
4289
|
console.log(` Issuer: ${disco.issuer}`);
|
|
4218
4290
|
console.log(` DDISA: v${disco.ddisa_version || "?"}`);
|
|
4219
4291
|
if (disco.ddisa_auth_methods_supported) {
|
|
@@ -4231,7 +4303,7 @@ var dnsCheckCommand = defineCommand38({
|
|
|
4231
4303
|
// src/commands/health.ts
|
|
4232
4304
|
import { exec } from "child_process";
|
|
4233
4305
|
import { promisify } from "util";
|
|
4234
|
-
import { defineCommand as
|
|
4306
|
+
import { defineCommand as defineCommand42 } from "citty";
|
|
4235
4307
|
var execAsync = promisify(exec);
|
|
4236
4308
|
async function resolveApeShellPath() {
|
|
4237
4309
|
try {
|
|
@@ -4267,7 +4339,7 @@ async function bestEffortGrantCount(idp) {
|
|
|
4267
4339
|
}
|
|
4268
4340
|
}
|
|
4269
4341
|
async function runHealth(args) {
|
|
4270
|
-
const version = true ? "0.
|
|
4342
|
+
const version = true ? "0.19.0" : "0.0.0";
|
|
4271
4343
|
const auth = loadAuth();
|
|
4272
4344
|
if (!auth) {
|
|
4273
4345
|
throw new CliError("Not logged in. Run `apes login` first.", 1);
|
|
@@ -4330,7 +4402,7 @@ async function runHealth(args) {
|
|
|
4330
4402
|
throw new CliError(`IdP ${auth.idp} unreachable: ${idpProbe.error}`, 1);
|
|
4331
4403
|
}
|
|
4332
4404
|
}
|
|
4333
|
-
var healthCommand =
|
|
4405
|
+
var healthCommand = defineCommand42({
|
|
4334
4406
|
meta: {
|
|
4335
4407
|
name: "health",
|
|
4336
4408
|
description: "Report CLI diagnostic state (auth, IdP, grants, binaries)"
|
|
@@ -4348,8 +4420,8 @@ var healthCommand = defineCommand39({
|
|
|
4348
4420
|
});
|
|
4349
4421
|
|
|
4350
4422
|
// src/commands/workflows.ts
|
|
4351
|
-
import { defineCommand as
|
|
4352
|
-
import
|
|
4423
|
+
import { defineCommand as defineCommand43 } from "citty";
|
|
4424
|
+
import consola34 from "consola";
|
|
4353
4425
|
|
|
4354
4426
|
// src/guides/index.ts
|
|
4355
4427
|
var guides = [
|
|
@@ -4399,7 +4471,7 @@ var guides = [
|
|
|
4399
4471
|
];
|
|
4400
4472
|
|
|
4401
4473
|
// src/commands/workflows.ts
|
|
4402
|
-
var workflowsCommand =
|
|
4474
|
+
var workflowsCommand = defineCommand43({
|
|
4403
4475
|
meta: {
|
|
4404
4476
|
name: "workflows",
|
|
4405
4477
|
description: "Discover workflow guides"
|
|
@@ -4420,7 +4492,7 @@ var workflowsCommand = defineCommand40({
|
|
|
4420
4492
|
if (args.id) {
|
|
4421
4493
|
const guide = guides.find((g) => g.id === String(args.id));
|
|
4422
4494
|
if (!guide) {
|
|
4423
|
-
|
|
4495
|
+
consola34.info(`Available: ${guides.map((g) => g.id).join(", ")}`);
|
|
4424
4496
|
throw new CliError(`Guide not found: ${args.id}`);
|
|
4425
4497
|
}
|
|
4426
4498
|
if (args.json) {
|
|
@@ -4469,10 +4541,10 @@ if (shellRewrite) {
|
|
|
4469
4541
|
if (shellRewrite.action === "rewrite") {
|
|
4470
4542
|
process.argv = shellRewrite.argv;
|
|
4471
4543
|
} else if (shellRewrite.action === "version") {
|
|
4472
|
-
console.log(`ape-shell ${"0.
|
|
4544
|
+
console.log(`ape-shell ${"0.19.0"} (OpenApe DDISA shell wrapper)`);
|
|
4473
4545
|
process.exit(0);
|
|
4474
4546
|
} else if (shellRewrite.action === "help") {
|
|
4475
|
-
console.log(`ape-shell ${"0.
|
|
4547
|
+
console.log(`ape-shell ${"0.19.0"} \u2014 OpenApe DDISA shell wrapper`);
|
|
4476
4548
|
console.log("");
|
|
4477
4549
|
console.log("Usage:");
|
|
4478
4550
|
console.log(" ape-shell Start interactive grant-mediated REPL");
|
|
@@ -4487,7 +4559,7 @@ if (shellRewrite) {
|
|
|
4487
4559
|
console.log(" --help, -h Show this help message");
|
|
4488
4560
|
process.exit(0);
|
|
4489
4561
|
} else if (shellRewrite.action === "interactive") {
|
|
4490
|
-
const { runInteractiveShell } = await import("./orchestrator-
|
|
4562
|
+
const { runInteractiveShell } = await import("./orchestrator-FJVDWH45.js");
|
|
4491
4563
|
await runInteractiveShell();
|
|
4492
4564
|
process.exit(0);
|
|
4493
4565
|
} else {
|
|
@@ -4496,7 +4568,7 @@ if (shellRewrite) {
|
|
|
4496
4568
|
}
|
|
4497
4569
|
}
|
|
4498
4570
|
var debug = process.argv.includes("--debug");
|
|
4499
|
-
var grantsCommand =
|
|
4571
|
+
var grantsCommand = defineCommand44({
|
|
4500
4572
|
meta: {
|
|
4501
4573
|
name: "grants",
|
|
4502
4574
|
description: "Grant management"
|
|
@@ -4517,7 +4589,7 @@ var grantsCommand = defineCommand41({
|
|
|
4517
4589
|
"delegation-revoke": delegationRevokeCommand
|
|
4518
4590
|
}
|
|
4519
4591
|
});
|
|
4520
|
-
var configCommand =
|
|
4592
|
+
var configCommand = defineCommand44({
|
|
4521
4593
|
meta: {
|
|
4522
4594
|
name: "config",
|
|
4523
4595
|
description: "Configuration management"
|
|
@@ -4527,10 +4599,10 @@ var configCommand = defineCommand41({
|
|
|
4527
4599
|
set: configSetCommand
|
|
4528
4600
|
}
|
|
4529
4601
|
});
|
|
4530
|
-
var main =
|
|
4602
|
+
var main = defineCommand44({
|
|
4531
4603
|
meta: {
|
|
4532
4604
|
name: "apes",
|
|
4533
|
-
version: "0.
|
|
4605
|
+
version: "0.19.0",
|
|
4534
4606
|
description: "Unified CLI for OpenApe"
|
|
4535
4607
|
},
|
|
4536
4608
|
subCommands: {
|
|
@@ -4539,6 +4611,7 @@ var main = defineCommand41({
|
|
|
4539
4611
|
"register-user": registerUserCommand,
|
|
4540
4612
|
"dns-check": dnsCheckCommand,
|
|
4541
4613
|
utils: utilsCommand,
|
|
4614
|
+
sessions: sessionsCommand,
|
|
4542
4615
|
login: loginCommand,
|
|
4543
4616
|
logout: logoutCommand,
|
|
4544
4617
|
whoami: whoamiCommand,
|
|
@@ -4556,18 +4629,46 @@ var main = defineCommand41({
|
|
|
4556
4629
|
workflows: workflowsCommand
|
|
4557
4630
|
}
|
|
4558
4631
|
});
|
|
4632
|
+
var NO_REFRESH_COMMANDS = /* @__PURE__ */ new Set([
|
|
4633
|
+
"login",
|
|
4634
|
+
"logout",
|
|
4635
|
+
"init",
|
|
4636
|
+
"enroll",
|
|
4637
|
+
"register-user",
|
|
4638
|
+
"dns-check",
|
|
4639
|
+
"utils",
|
|
4640
|
+
"explain",
|
|
4641
|
+
"workflows",
|
|
4642
|
+
"--help",
|
|
4643
|
+
"-h",
|
|
4644
|
+
"help",
|
|
4645
|
+
"--version",
|
|
4646
|
+
"-v"
|
|
4647
|
+
]);
|
|
4648
|
+
async function maybeRefreshAuth() {
|
|
4649
|
+
const sub = process.argv[2];
|
|
4650
|
+
if (!sub || NO_REFRESH_COMMANDS.has(sub)) return;
|
|
4651
|
+
const { loadAuth: loadAuth2 } = await import("./config-JH2IEPIR.js");
|
|
4652
|
+
if (!loadAuth2()) return;
|
|
4653
|
+
try {
|
|
4654
|
+
const { ensureFreshToken } = await import("./http-JZT4XV5I.js");
|
|
4655
|
+
await ensureFreshToken();
|
|
4656
|
+
} catch {
|
|
4657
|
+
}
|
|
4658
|
+
}
|
|
4659
|
+
await maybeRefreshAuth();
|
|
4559
4660
|
runMain(main).catch((err) => {
|
|
4560
4661
|
if (err instanceof CliExit) {
|
|
4561
4662
|
process.exit(err.exitCode);
|
|
4562
4663
|
}
|
|
4563
4664
|
if (err instanceof CliError) {
|
|
4564
|
-
|
|
4665
|
+
consola35.error(err.message);
|
|
4565
4666
|
process.exit(err.exitCode);
|
|
4566
4667
|
}
|
|
4567
4668
|
if (debug) {
|
|
4568
|
-
|
|
4669
|
+
consola35.error(err);
|
|
4569
4670
|
} else {
|
|
4570
|
-
|
|
4671
|
+
consola35.error(err instanceof ApiError ? err.message : err instanceof Error ? err.message : String(err));
|
|
4571
4672
|
}
|
|
4572
4673
|
process.exit(1);
|
|
4573
4674
|
});
|