@openape/apes 0.11.2 → 0.12.1
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-O7BTENTJ.js → auth-lock-NYI376IM.js} +2 -2
- package/dist/{chunk-6JSOSD7R.js → chunk-6GPSKAMU.js} +29 -2
- package/dist/chunk-6GPSKAMU.js.map +1 -0
- package/dist/{chunk-U4CI2RBO.js → chunk-O7GSG3OE.js} +131 -12
- package/dist/chunk-O7GSG3OE.js.map +1 -0
- package/dist/{chunk-2S2J4OSK.js → chunk-OFIVF6NH.js} +2 -2
- package/dist/cli.js +52 -21
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.js +2 -2
- package/dist/{orchestrator-CWDQIMJN.js → orchestrator-EHFFTEL5.js} +4 -4
- package/dist/{server-TYXGOFDQ.js → server-RAQYZA5U.js} +4 -4
- package/package.json +4 -4
- package/dist/chunk-6JSOSD7R.js.map +0 -1
- package/dist/chunk-U4CI2RBO.js.map +0 -1
- /package/dist/{auth-lock-O7BTENTJ.js.map → auth-lock-NYI376IM.js.map} +0 -0
- /package/dist/{chunk-2S2J4OSK.js.map → chunk-OFIVF6NH.js.map} +0 -0
- /package/dist/{orchestrator-CWDQIMJN.js.map → orchestrator-EHFFTEL5.js.map} +0 -0
- /package/dist/{server-TYXGOFDQ.js.map → server-RAQYZA5U.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -12,10 +12,12 @@ import {
|
|
|
12
12
|
checkSudoRejection,
|
|
13
13
|
isApesSelfDispatch,
|
|
14
14
|
notifyGrantPending
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OFIVF6NH.js";
|
|
16
16
|
import {
|
|
17
17
|
ApiError,
|
|
18
|
+
GENERIC_OPERATION_ID,
|
|
18
19
|
apiFetch,
|
|
20
|
+
buildGenericResolved,
|
|
19
21
|
buildStructuredCliGrantRequest,
|
|
20
22
|
createShapesGrant,
|
|
21
23
|
extractOption,
|
|
@@ -40,21 +42,23 @@ import {
|
|
|
40
42
|
resolveCapabilityRequest,
|
|
41
43
|
resolveCommand,
|
|
42
44
|
resolveFromGrant,
|
|
45
|
+
resolveGenericOrReject,
|
|
43
46
|
searchAdapters,
|
|
44
47
|
verifyAndExecute,
|
|
45
48
|
waitForGrantStatus
|
|
46
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-O7GSG3OE.js";
|
|
47
50
|
import {
|
|
48
51
|
AUTH_FILE,
|
|
49
52
|
CONFIG_DIR,
|
|
50
53
|
clearAuth,
|
|
51
54
|
getAuthToken,
|
|
52
55
|
getIdpUrl,
|
|
56
|
+
isGenericFallbackEnabled,
|
|
53
57
|
loadAuth,
|
|
54
58
|
loadConfig,
|
|
55
59
|
saveAuth,
|
|
56
60
|
saveConfig
|
|
57
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-6GPSKAMU.js";
|
|
58
62
|
|
|
59
63
|
// src/cli.ts
|
|
60
64
|
import consola27 from "consola";
|
|
@@ -1187,15 +1191,24 @@ var runGrantCommand = defineCommand12({
|
|
|
1187
1191
|
const hasOpenApeCliDetail = authDetails.some((d) => d?.type === "openape_cli");
|
|
1188
1192
|
const isShapesGrant = hasOpenApeCliDetail || audience === "shapes";
|
|
1189
1193
|
if (isShapesGrant) {
|
|
1194
|
+
const isGenericGrant = authDetails.some((d) => d?.operation_id === GENERIC_OPERATION_ID);
|
|
1190
1195
|
let resolved;
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
+
if (isGenericGrant) {
|
|
1197
|
+
const argv = grant.request?.command ?? [];
|
|
1198
|
+
if (argv.length === 0)
|
|
1199
|
+
throw new CliError(`Generic grant ${grant.id} is missing command argv`);
|
|
1200
|
+
const cliId = authDetails.find((d) => d?.operation_id === GENERIC_OPERATION_ID)?.cli_id ?? argv[0];
|
|
1201
|
+
resolved = await buildGenericResolved(cliId, argv);
|
|
1202
|
+
} else {
|
|
1203
|
+
try {
|
|
1204
|
+
resolved = await resolveFromGrant(grant);
|
|
1205
|
+
} catch (err) {
|
|
1206
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1207
|
+
throw new CliError(`Cannot re-resolve grant: ${msg}`);
|
|
1208
|
+
}
|
|
1196
1209
|
}
|
|
1197
1210
|
const token = await fetchGrantToken(idp, grant.id);
|
|
1198
|
-
await verifyAndExecute(token, resolved);
|
|
1211
|
+
await verifyAndExecute(token, resolved, grant.id);
|
|
1199
1212
|
return;
|
|
1200
1213
|
}
|
|
1201
1214
|
if (audience === "escapes") {
|
|
@@ -2244,7 +2257,7 @@ async function tryAdapterModeFromShell(command, idp, args) {
|
|
|
2244
2257
|
if (existingGrantId) {
|
|
2245
2258
|
consola19.info(`Reusing grant ${existingGrantId} for: ${resolved.detail.display}`);
|
|
2246
2259
|
const token = await fetchGrantToken(idp, existingGrantId);
|
|
2247
|
-
await verifyAndExecute(token, resolved);
|
|
2260
|
+
await verifyAndExecute(token, resolved, existingGrantId);
|
|
2248
2261
|
return true;
|
|
2249
2262
|
}
|
|
2250
2263
|
} catch {
|
|
@@ -2275,7 +2288,7 @@ async function tryAdapterModeFromShell(command, idp, args) {
|
|
|
2275
2288
|
if (status !== "approved")
|
|
2276
2289
|
throw new CliError(`Grant ${status}`);
|
|
2277
2290
|
const token = await fetchGrantToken(idp, grant.id);
|
|
2278
|
-
await verifyAndExecute(token, resolved);
|
|
2291
|
+
await verifyAndExecute(token, resolved, grant.id);
|
|
2279
2292
|
return true;
|
|
2280
2293
|
}
|
|
2281
2294
|
printPendingGrantInfo(grant, idp);
|
|
@@ -2311,6 +2324,11 @@ function extractPositionals(rawArgs) {
|
|
|
2311
2324
|
}
|
|
2312
2325
|
return positionals;
|
|
2313
2326
|
}
|
|
2327
|
+
function printGenericWarning(cliId) {
|
|
2328
|
+
process.stderr.write(`\u26A0 No shape registered for \`${cliId}\`.
|
|
2329
|
+
`);
|
|
2330
|
+
process.stderr.write("Generic mode active \u2014 single-use grant will be required.\n");
|
|
2331
|
+
}
|
|
2314
2332
|
async function runAdapterMode(command, rawArgs, args) {
|
|
2315
2333
|
const idp = getIdpUrl(args.idp);
|
|
2316
2334
|
if (!idp)
|
|
@@ -2320,15 +2338,28 @@ async function runAdapterMode(command, rawArgs, args) {
|
|
|
2320
2338
|
return;
|
|
2321
2339
|
}
|
|
2322
2340
|
const adapterOpt = extractOption(rawArgs, "adapter");
|
|
2323
|
-
const
|
|
2324
|
-
|
|
2341
|
+
const cliId = command[0];
|
|
2342
|
+
let resolved;
|
|
2343
|
+
try {
|
|
2344
|
+
const loaded = loadAdapter(cliId, adapterOpt);
|
|
2345
|
+
resolved = await resolveCommand(loaded, command);
|
|
2346
|
+
} catch (err) {
|
|
2347
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2348
|
+
const isNoAdapter = message.startsWith("No adapter found for ");
|
|
2349
|
+
if (!isNoAdapter)
|
|
2350
|
+
throw err;
|
|
2351
|
+
resolved = await resolveGenericOrReject(cliId, command, {
|
|
2352
|
+
genericEnabled: isGenericFallbackEnabled()
|
|
2353
|
+
});
|
|
2354
|
+
printGenericWarning(cliId);
|
|
2355
|
+
}
|
|
2325
2356
|
const approval = args.approval ?? "once";
|
|
2326
2357
|
try {
|
|
2327
2358
|
const existingGrantId = await findExistingGrant(resolved, idp);
|
|
2328
2359
|
if (existingGrantId) {
|
|
2329
2360
|
consola19.info(`Reusing existing grant: ${existingGrantId}`);
|
|
2330
2361
|
const token = await fetchGrantToken(idp, existingGrantId);
|
|
2331
|
-
await verifyAndExecute(token, resolved);
|
|
2362
|
+
await verifyAndExecute(token, resolved, existingGrantId);
|
|
2332
2363
|
return;
|
|
2333
2364
|
}
|
|
2334
2365
|
} catch {
|
|
@@ -2355,7 +2386,7 @@ async function runAdapterMode(command, rawArgs, args) {
|
|
|
2355
2386
|
if (status !== "approved")
|
|
2356
2387
|
throw new Error(`Grant ${status}`);
|
|
2357
2388
|
const token = await fetchGrantToken(idp, grant.id);
|
|
2358
|
-
await verifyAndExecute(token, resolved);
|
|
2389
|
+
await verifyAndExecute(token, resolved, grant.id);
|
|
2359
2390
|
return;
|
|
2360
2391
|
}
|
|
2361
2392
|
printPendingGrantInfo(grant, idp);
|
|
@@ -2692,7 +2723,7 @@ var mcpCommand = defineCommand26({
|
|
|
2692
2723
|
if (transport !== "stdio" && transport !== "sse") {
|
|
2693
2724
|
throw new Error('Transport must be "stdio" or "sse"');
|
|
2694
2725
|
}
|
|
2695
|
-
const { startMcpServer } = await import("./server-
|
|
2726
|
+
const { startMcpServer } = await import("./server-RAQYZA5U.js");
|
|
2696
2727
|
await startMcpServer(transport, port);
|
|
2697
2728
|
}
|
|
2698
2729
|
});
|
|
@@ -3184,7 +3215,7 @@ async function bestEffortGrantCount(idp) {
|
|
|
3184
3215
|
}
|
|
3185
3216
|
}
|
|
3186
3217
|
async function runHealth(args) {
|
|
3187
|
-
const version = true ? "0.
|
|
3218
|
+
const version = true ? "0.12.1" : "0.0.0";
|
|
3188
3219
|
const auth = loadAuth();
|
|
3189
3220
|
if (!auth) {
|
|
3190
3221
|
throw new CliError("Not logged in. Run `apes login` first.", 1);
|
|
@@ -3386,10 +3417,10 @@ if (shellRewrite) {
|
|
|
3386
3417
|
if (shellRewrite.action === "rewrite") {
|
|
3387
3418
|
process.argv = shellRewrite.argv;
|
|
3388
3419
|
} else if (shellRewrite.action === "version") {
|
|
3389
|
-
console.log(`ape-shell ${"0.
|
|
3420
|
+
console.log(`ape-shell ${"0.12.1"} (OpenApe DDISA shell wrapper)`);
|
|
3390
3421
|
process.exit(0);
|
|
3391
3422
|
} else if (shellRewrite.action === "help") {
|
|
3392
|
-
console.log(`ape-shell ${"0.
|
|
3423
|
+
console.log(`ape-shell ${"0.12.1"} \u2014 OpenApe DDISA shell wrapper`);
|
|
3393
3424
|
console.log("");
|
|
3394
3425
|
console.log("Usage:");
|
|
3395
3426
|
console.log(" ape-shell Start interactive grant-mediated REPL");
|
|
@@ -3404,7 +3435,7 @@ if (shellRewrite) {
|
|
|
3404
3435
|
console.log(" --help, -h Show this help message");
|
|
3405
3436
|
process.exit(0);
|
|
3406
3437
|
} else if (shellRewrite.action === "interactive") {
|
|
3407
|
-
const { runInteractiveShell } = await import("./orchestrator-
|
|
3438
|
+
const { runInteractiveShell } = await import("./orchestrator-EHFFTEL5.js");
|
|
3408
3439
|
await runInteractiveShell();
|
|
3409
3440
|
process.exit(0);
|
|
3410
3441
|
} else {
|
|
@@ -3447,7 +3478,7 @@ var configCommand = defineCommand33({
|
|
|
3447
3478
|
var main = defineCommand33({
|
|
3448
3479
|
meta: {
|
|
3449
3480
|
name: "apes",
|
|
3450
|
-
version: "0.
|
|
3481
|
+
version: "0.12.1",
|
|
3451
3482
|
description: "Unified CLI for OpenApe"
|
|
3452
3483
|
},
|
|
3453
3484
|
subCommands: {
|