@introspection-ai/recipes 0.25.1 → 0.26.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/mcp-chunks/{auth-command-4WFRNU2I.js → auth-command-JBYNHHMV.js} +23 -27
- package/dist/mcp-chunks/call-arguments-S4EGFKUQ.js +15 -0
- package/dist/mcp-chunks/{call-command-JBIKXOGC.js → call-command-467BVXTE.js} +32 -33
- package/dist/mcp-chunks/{chunk-IPNSPKQK.js → chunk-3Q2Q7SBU.js} +12 -14
- package/dist/mcp-chunks/chunk-66P5FXP3.js +31 -0
- package/dist/mcp-chunks/{chunk-TF2YTYE4.js → chunk-6DVS7RBO.js} +1 -1
- package/dist/mcp-chunks/{chunk-IME7DGLJ.js → chunk-AK5ZEDEF.js} +2 -2
- package/dist/mcp-chunks/{chunk-OP3IW2V6.js → chunk-AP5VHS73.js} +2 -2
- package/dist/mcp-chunks/{chunk-B2LNXGAP.js → chunk-AS27BTCS.js} +1 -1
- package/dist/mcp-chunks/{chunk-MOEZ43ZL.js → chunk-BC2HDCYV.js} +1 -1
- package/dist/mcp-chunks/{chunk-RSTKSBVF.js → chunk-BSCNF4NY.js} +2 -2
- package/dist/mcp-chunks/chunk-BTU34BUG.js +1182 -0
- package/dist/mcp-chunks/{chunk-HN7WPMCA.js → chunk-CN5YF3IQ.js} +21042 -3688
- package/dist/mcp-chunks/{chunk-G6OMDUNG.js → chunk-CZ43ZITK.js} +1 -1
- package/dist/mcp-chunks/{chunk-JG4TRUPF.js → chunk-D2P2IV4H.js} +1 -1
- package/dist/mcp-chunks/{chunk-3R2WK3NB.js → chunk-DMBE47LM.js} +6 -6
- package/dist/mcp-chunks/{chunk-WTMJMM3B.js → chunk-EP22XMWK.js} +3 -30
- package/dist/mcp-chunks/{chunk-ITCCROID.js → chunk-EUDC3ICZ.js} +5 -5
- package/dist/mcp-chunks/{chunk-FX5NYWBH.js → chunk-G4H535MI.js} +3 -21
- package/dist/mcp-chunks/{chunk-HCOKLSOB.js → chunk-GA4ZYSRX.js} +4 -4
- package/dist/mcp-chunks/{chunk-C2KNLFZR.js → chunk-GEVQ2GJW.js} +2 -2
- package/dist/mcp-chunks/{chunk-WYLHHXI6.js → chunk-GK4LA4E6.js} +26 -11
- package/dist/mcp-chunks/{chunk-QZUC2T72.js → chunk-GL4AA5QV.js} +2 -2
- package/dist/mcp-chunks/{chunk-KW3ANJ36.js → chunk-HBN3ESMH.js} +4 -4
- package/dist/mcp-chunks/{chunk-ELA77TDC.js → chunk-HKZZGSDV.js} +4 -4
- package/dist/mcp-chunks/{chunk-36VIJRYY.js → chunk-HTXQPQPB.js} +4 -4
- package/dist/mcp-chunks/{chunk-3JGS7LQB.js → chunk-I7JR2GIC.js} +2 -2
- package/dist/mcp-chunks/{chunk-AIKLVBYU.js → chunk-IO2IMWYS.js} +2 -2
- package/dist/mcp-chunks/{chunk-RD7NHCRK.js → chunk-J2WP6ERZ.js} +39 -42
- package/dist/mcp-chunks/{chunk-HLRCUHNO.js → chunk-KJNNO5Z6.js} +1 -1
- package/dist/mcp-chunks/{chunk-4ZNBWL65.js → chunk-L2LGMX5P.js} +2 -2
- package/dist/mcp-chunks/chunk-LG3GLOSA.js +513 -0
- package/dist/mcp-chunks/{chunk-CZKDJZER.js → chunk-LTR626QF.js} +1 -1
- package/dist/mcp-chunks/{chunk-FS5JIKT6.js → chunk-LYWEATXZ.js} +6 -6
- package/dist/mcp-chunks/{chunk-YIRGLKDA.js → chunk-M62ESEOY.js} +45 -14
- package/dist/mcp-chunks/{chunk-V5AYEKSL.js → chunk-MJHMXYMO.js} +52 -81
- package/dist/mcp-chunks/{chunk-7WOKCV6Q.js → chunk-N7ZWX3WW.js} +1 -1
- package/dist/mcp-chunks/chunk-NTABJCUL.js +123 -0
- package/dist/mcp-chunks/{chunk-EPT4MYOF.js → chunk-OABFKFSL.js} +11 -11
- package/dist/mcp-chunks/{chunk-SCOMDV54.js → chunk-OB256NMD.js} +1 -1
- package/dist/mcp-chunks/{chunk-IYWYVHHD.js → chunk-OZQTZWW4.js} +1 -1
- package/dist/mcp-chunks/{chunk-ITR7FQM3.js → chunk-QIBGY4IX.js} +2 -2
- package/dist/mcp-chunks/{chunk-ZOAQDFAO.js → chunk-REEFOL44.js} +1 -1
- package/dist/mcp-chunks/{chunk-ED2WN5BI.js → chunk-SUNOYTQJ.js} +3 -3
- package/dist/mcp-chunks/{chunk-Y3EDWN2P.js → chunk-TFU4NKFJ.js} +1 -1
- package/dist/mcp-chunks/{chunk-EMSNQHZZ.js → chunk-TGPIW6F6.js} +1 -1
- package/dist/mcp-chunks/{chunk-SNKXMWDB.js → chunk-UCJ7YDFN.js} +1 -1
- package/dist/mcp-chunks/{chunk-TPHPAEDH.js → chunk-WUEDIOR5.js} +1 -1
- package/dist/mcp-chunks/{chunk-FAJPJTOC.js → chunk-XCNWICLD.js} +1 -1
- package/dist/mcp-chunks/{chunk-6YZW3XAE.js → chunk-XFQSUC7T.js} +5 -5
- package/dist/mcp-chunks/{chunk-GQ6NSIDS.js → chunk-Y3L5LWBY.js} +3037 -747
- package/dist/mcp-chunks/{chunk-53NRFMB3.js → chunk-YI5SMRFH.js} +46 -25
- package/dist/mcp-chunks/{chunk-GUXMP7QB.js → chunk-YPTN46JQ.js} +2 -2
- package/dist/mcp-chunks/{chunk-I5GI2A2D.js → chunk-YVH36MGQ.js} +2 -2
- package/dist/mcp-chunks/{chunk-ASG4OY3M.js → chunk-Z6QEOUMK.js} +22 -23
- package/dist/mcp-chunks/{cli-XU26MUCN.js → cli-TN6JTLTS.js} +108 -77
- package/dist/mcp-chunks/client-G33HPQAC.js +29 -0
- package/dist/mcp-chunks/{config-command-UQMMIK2U.js → config-command-LICU56ZH.js} +27 -28
- package/dist/mcp-chunks/daemon-command-JLVHGWHB.js +29 -0
- package/dist/mcp-chunks/{dist-DM2RXZMU.js → dist-MFAWSKGH.js} +80 -46
- package/dist/mcp-chunks/{emit-ts-command-KAOL6DAN.js → emit-ts-command-FVX3JMSN.js} +18 -18
- package/dist/mcp-chunks/{generate-cli-runner-AK6XNRTK.js → generate-cli-runner-L2L7VMCA.js} +53 -51
- package/dist/mcp-chunks/generated-daemon-runtime-DC6IL7E7.js +29 -0
- package/dist/mcp-chunks/{inspect-cli-command-6FVJO7H2.js → inspect-cli-command-Y5D3GRE2.js} +9 -10
- package/dist/mcp-chunks/{launch-EIT73HX4.js → launch-ZFY6CM2A.js} +1 -1
- package/dist/mcp-chunks/{lifecycle-QH4TUI3K.js → lifecycle-H7DIW5DM.js} +1 -1
- package/dist/mcp-chunks/{list-command-UOB2XZK7.js → list-command-55LCLW4S.js} +34 -35
- package/dist/mcp-chunks/{output-utils-6YXH23T7.js → output-utils-YYHI637S.js} +3 -3
- package/dist/mcp-chunks/{prompt-CH6TK0bC-ZB6RFAXR.js → prompt-CH6TK0bC-DZLFAAPK.js} +1 -1
- package/dist/mcp-chunks/{record-command-FO5TTERC.js → record-command-PWIBYC5J.js} +5 -5
- package/dist/mcp-chunks/{replay-command-SCBPCGQ7.js → replay-command-QHZZZMXF.js} +6 -6
- package/dist/mcp-chunks/{resource-command-S2J7XEMV.js → resource-command-HMR2KXWK.js} +9 -10
- package/dist/mcp-chunks/{result-utils-OME6HGS6.js → result-utils-UGCQSRJ4.js} +3 -4
- package/dist/mcp-chunks/runtime-ZNFPZXKE.js +36 -0
- package/dist/mcp-chunks/runtime-wrapper-I4B3OROR.js +10 -0
- package/dist/mcp-chunks/{serve-command-DDBZZSG6.js → serve-command-NTDI3YPN.js} +29 -34
- package/dist/mcp-chunks/{timeouts-HNGNKDQN.js → timeouts-35UDWFA7.js} +3 -3
- package/dist/mcp-chunks/{vault-command-TJZYS3YI.js → vault-command-D5QZL4FI.js} +4 -6
- package/dist/mcp-daemon.js +26 -31
- package/dist/mcp-run-worker.js +26 -31
- package/docs/pi-extension.md +1 -1
- package/docs/recipe-format.md +7 -3
- package/docs/recipe-templates.md +46 -0
- package/package.json +14 -14
- package/dist/mcp-chunks/call-arguments-4DWPBLQP.js +0 -15
- package/dist/mcp-chunks/chunk-3Z7MFS6K.js +0 -86
- package/dist/mcp-chunks/chunk-AD3FQ73K.js +0 -39
- package/dist/mcp-chunks/chunk-BWW4XRUC.js +0 -1931
- package/dist/mcp-chunks/chunk-DTZHEVKC.js +0 -12
- package/dist/mcp-chunks/chunk-H3JCYHGS.js +0 -1018
- package/dist/mcp-chunks/chunk-IRTJXFWA.js +0 -28
- package/dist/mcp-chunks/chunk-NTHUNCXJ.js +0 -526
- package/dist/mcp-chunks/chunk-OD3MSMXY.js +0 -15
- package/dist/mcp-chunks/chunk-PZ323CXI.js +0 -17394
- package/dist/mcp-chunks/client-OT34CKRH.js +0 -21
- package/dist/mcp-chunks/daemon-command-YCIOZGPZ.js +0 -35
- package/dist/mcp-chunks/runtime-QIPMLIJI.js +0 -39
- package/dist/mcp-chunks/runtime-wrapper-X4YFKMJI.js +0 -16
|
@@ -4,17 +4,13 @@ import {
|
|
|
4
4
|
withFileLock,
|
|
5
5
|
writeJsonFile,
|
|
6
6
|
writeTextFileAtomic
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
legacyMcporterDir,
|
|
10
|
-
mcporterDir
|
|
11
|
-
} from "./chunk-FS5JIKT6.js";
|
|
7
|
+
} from "./chunk-QIBGY4IX.js";
|
|
12
8
|
|
|
13
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
9
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/oauth-vault.js
|
|
14
10
|
import crypto from "node:crypto";
|
|
15
|
-
import
|
|
11
|
+
import path2 from "node:path";
|
|
16
12
|
|
|
17
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
13
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/oauth-credential-validation.js
|
|
18
14
|
function isRecord(value) {
|
|
19
15
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
20
16
|
}
|
|
@@ -35,7 +31,7 @@ function isStoredOAuthClientInformation(value) {
|
|
|
35
31
|
return isOptionalString(value, "issuer");
|
|
36
32
|
}
|
|
37
33
|
|
|
38
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
34
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/oauth-token-generation.js
|
|
39
35
|
import { randomUUID } from "node:crypto";
|
|
40
36
|
import { isDeepStrictEqual } from "node:util";
|
|
41
37
|
var TOKEN_GENERATION_FIELD = "__mcporter_generation";
|
|
@@ -115,9 +111,32 @@ function sameOAuthClientValue(left, right) {
|
|
|
115
111
|
return isDeepStrictEqual(withoutClientGeneration(left), withoutClientGeneration(right));
|
|
116
112
|
}
|
|
117
113
|
|
|
118
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
114
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/runtime/environment.js
|
|
115
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
116
|
+
import os from "node:os";
|
|
117
|
+
import path from "node:path";
|
|
118
|
+
var connectionEnvironment = new AsyncLocalStorage();
|
|
119
|
+
function runtimeEnvironment() {
|
|
120
|
+
return connectionEnvironment.getStore() ?? process.env;
|
|
121
|
+
}
|
|
122
|
+
function withRuntimeEnvironment(env, action) {
|
|
123
|
+
return connectionEnvironment.run(env, action);
|
|
124
|
+
}
|
|
125
|
+
function runtimeHome() {
|
|
126
|
+
if (!connectionEnvironment.getStore())
|
|
127
|
+
return os.homedir();
|
|
128
|
+
const env = runtimeEnvironment();
|
|
129
|
+
return env.HOME ?? env.USERPROFILE ?? os.userInfo().homedir;
|
|
130
|
+
}
|
|
131
|
+
function runtimeStateDir(kind) {
|
|
132
|
+
const env = runtimeEnvironment();
|
|
133
|
+
const root = env[kind === "data" ? "XDG_DATA_HOME" : "XDG_CACHE_HOME"];
|
|
134
|
+
return root && path.isAbsolute(root) ? path.join(root, "mcporter") : path.join(runtimeHome(), ".mcporter");
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/oauth-vault.js
|
|
119
138
|
function getOAuthVaultPath() {
|
|
120
|
-
return
|
|
139
|
+
return path2.join(runtimeStateDir("data"), "credentials.json");
|
|
121
140
|
}
|
|
122
141
|
async function readVaultState() {
|
|
123
142
|
try {
|
|
@@ -412,10 +431,9 @@ async function clearVaultEntry(definition, scope) {
|
|
|
412
431
|
});
|
|
413
432
|
}
|
|
414
433
|
|
|
415
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
434
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/oauth-persistence-stores.js
|
|
416
435
|
import fs from "node:fs/promises";
|
|
417
|
-
import
|
|
418
|
-
import path2 from "node:path";
|
|
436
|
+
import path3 from "node:path";
|
|
419
437
|
function withStoredExpiry(tokens) {
|
|
420
438
|
const stored = tokens;
|
|
421
439
|
if (typeof stored.expires_at === "number" || typeof stored.expiresAt === "number") {
|
|
@@ -450,14 +468,14 @@ var DirectoryPersistence = class {
|
|
|
450
468
|
this.logger = logger;
|
|
451
469
|
this.serverUrl = serverUrl;
|
|
452
470
|
this.skipUrlMarkerWhenMissing = skipUrlMarkerWhenMissing;
|
|
453
|
-
this.tokenPath =
|
|
454
|
-
this.clientInfoPath =
|
|
455
|
-
this.codeVerifierPath =
|
|
456
|
-
this.statePath =
|
|
457
|
-
this.serverUrlPath =
|
|
458
|
-
this.discoveryStatePath =
|
|
459
|
-
this.authorizationServerUrlPath =
|
|
460
|
-
this.resourceUrlPath =
|
|
471
|
+
this.tokenPath = path3.join(root, "tokens.json");
|
|
472
|
+
this.clientInfoPath = path3.join(root, "client.json");
|
|
473
|
+
this.codeVerifierPath = path3.join(root, "code_verifier.txt");
|
|
474
|
+
this.statePath = path3.join(root, "state.txt");
|
|
475
|
+
this.serverUrlPath = path3.join(root, "server_url.txt");
|
|
476
|
+
this.discoveryStatePath = path3.join(root, "discovery.json");
|
|
477
|
+
this.authorizationServerUrlPath = path3.join(root, "authorization_server_url.txt");
|
|
478
|
+
this.resourceUrlPath = path3.join(root, "resource_url.txt");
|
|
461
479
|
}
|
|
462
480
|
describe() {
|
|
463
481
|
return this.root;
|
|
@@ -925,7 +943,7 @@ async function createOAuthPersistenceStores(definition, logger) {
|
|
|
925
943
|
if (definition.tokenCacheDir) {
|
|
926
944
|
stores.unshift(new DirectoryPersistence(definition.tokenCacheDir, logger, serverUrl));
|
|
927
945
|
}
|
|
928
|
-
const legacyDir =
|
|
946
|
+
const legacyDir = path3.join(path3.join(runtimeHome(), ".mcporter"), definition.name);
|
|
929
947
|
if (!definition.tokenCacheDir) {
|
|
930
948
|
const legacy = new DirectoryPersistence(legacyDir, logger, serverUrl, true);
|
|
931
949
|
const snapshot = await legacy.readSnapshot();
|
|
@@ -957,14 +975,14 @@ async function createOAuthPersistenceStores(definition, logger) {
|
|
|
957
975
|
return stores.length === 1 ? vault : new CompositePersistence(stores);
|
|
958
976
|
}
|
|
959
977
|
async function clearLegacyOAuthArtifacts(definition, logger, scope) {
|
|
960
|
-
const legacyDir =
|
|
978
|
+
const legacyDir = path3.join(path3.join(runtimeHome(), ".mcporter"), definition.name);
|
|
961
979
|
if (!definition.tokenCacheDir || legacyDir !== definition.tokenCacheDir) {
|
|
962
980
|
const legacy = new DirectoryPersistence(legacyDir, logger);
|
|
963
981
|
await legacy.clear(scope);
|
|
964
982
|
}
|
|
965
983
|
const legacyFiles = [];
|
|
966
984
|
if (definition.name.toLowerCase() === "gmail") {
|
|
967
|
-
legacyFiles.push(
|
|
985
|
+
legacyFiles.push(path3.join(runtimeHome(), ".gmail-mcp", "credentials.json"));
|
|
968
986
|
}
|
|
969
987
|
await Promise.all(legacyFiles.map(async (file) => {
|
|
970
988
|
try {
|
|
@@ -979,6 +997,9 @@ async function clearLegacyOAuthArtifacts(definition, logger, scope) {
|
|
|
979
997
|
}
|
|
980
998
|
|
|
981
999
|
export {
|
|
1000
|
+
runtimeEnvironment,
|
|
1001
|
+
withRuntimeEnvironment,
|
|
1002
|
+
runtimeStateDir,
|
|
982
1003
|
sameOAuthTokenGeneration,
|
|
983
1004
|
getOAuthVaultPath,
|
|
984
1005
|
vaultCredentialKeys,
|
|
@@ -2,9 +2,9 @@ import { createRequire as __createRequire } from "node:module"; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
createPrefixedConsoleLogger,
|
|
4
4
|
resolveLogLevelFromEnv
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-N7ZWX3WW.js";
|
|
6
6
|
|
|
7
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
7
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/cli/logger-context.js
|
|
8
8
|
var activeLogLevel = resolveLogLevelFromEnv();
|
|
9
9
|
var activeLogger = createPrefixedConsoleLogger("mcporter", activeLogLevel);
|
|
10
10
|
function getActiveLogLevel() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
resolveEnvPlaceholders
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EP22XMWK.js";
|
|
5
5
|
|
|
6
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
6
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/runtime/utils.js
|
|
7
7
|
var ENV_PLACEHOLDER_PATTERN = /\$\{(?:env:[^}]*|[A-Za-z_][A-Za-z0-9_]*(?::-[^}]*)?)\}/;
|
|
8
8
|
var MAX_TIMER_DELAY_MS = 2147483647;
|
|
9
9
|
function resolveCommandArgument(value, env = process.env) {
|
|
@@ -2,31 +2,30 @@ import { createRequire as __createRequire } from "node:module"; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
clearLegacyOAuthArtifacts,
|
|
4
4
|
createOAuthPersistenceStores,
|
|
5
|
+
runtimeEnvironment,
|
|
6
|
+
runtimeStateDir,
|
|
5
7
|
sameOAuthTokenGeneration,
|
|
6
8
|
vaultCredentialKeys
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
checkResourceAllowed,
|
|
10
|
-
discoverOAuthServerInfo,
|
|
11
|
-
refreshAuthorization,
|
|
12
|
-
resourceUrlFromServerUrl
|
|
13
|
-
} from "./chunk-PZ323CXI.js";
|
|
9
|
+
} from "./chunk-YI5SMRFH.js";
|
|
14
10
|
import {
|
|
15
11
|
canonicalizeFilePath,
|
|
16
12
|
isFileLockTimeoutError,
|
|
17
13
|
withFileLock
|
|
18
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QIBGY4IX.js";
|
|
19
15
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
checkResourceAllowed,
|
|
17
|
+
discoverOAuthServerInfo,
|
|
18
|
+
refreshAuthorization,
|
|
19
|
+
resourceUrlFromServerUrl
|
|
20
|
+
} from "./chunk-CN5YF3IQ.js";
|
|
22
21
|
|
|
23
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
22
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/oauth-persistence.js
|
|
24
23
|
import fs from "node:fs/promises";
|
|
25
24
|
|
|
26
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
25
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/oauth-token-refresh.js
|
|
27
26
|
import { Buffer } from "node:buffer";
|
|
28
27
|
|
|
29
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
28
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/oauth-client-info.js
|
|
30
29
|
function buildStaticClientInformation(definition, options = {}) {
|
|
31
30
|
if (!definition.oauthClientId) {
|
|
32
31
|
return void 0;
|
|
@@ -43,7 +42,7 @@ function buildStaticClientInformation(definition, options = {}) {
|
|
|
43
42
|
}
|
|
44
43
|
function resolveOAuthClientSecret(definition, options = {}) {
|
|
45
44
|
if (definition.oauthClientSecretEnv) {
|
|
46
|
-
const value = process.env[definition.oauthClientSecretEnv];
|
|
45
|
+
const value = (definition.env ?? process.env)[definition.oauthClientSecretEnv];
|
|
47
46
|
if (!value || options.rejectBlank && value.trim().length === 0) {
|
|
48
47
|
throw new Error(`Environment variable '${definition.oauthClientSecretEnv}' is required for OAuth client secret.`);
|
|
49
48
|
}
|
|
@@ -52,7 +51,7 @@ function resolveOAuthClientSecret(definition, options = {}) {
|
|
|
52
51
|
return definition.oauthClientSecret;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
54
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/oauth-refresh-lock.js
|
|
56
55
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
57
56
|
import crypto from "node:crypto";
|
|
58
57
|
import path from "node:path";
|
|
@@ -62,7 +61,7 @@ var IDENTITY_HASH_LENGTH = 16;
|
|
|
62
61
|
var TIMEOUT_OVERRIDE_ENV = "MCPORTER_TEST_REFRESH_LOCK_TIMEOUT_MS";
|
|
63
62
|
var heldLockPaths = new AsyncLocalStorage();
|
|
64
63
|
function refreshLockDir() {
|
|
65
|
-
return path.join(
|
|
64
|
+
return path.join(runtimeStateDir("data"), REFRESH_LOCK_DIR);
|
|
66
65
|
}
|
|
67
66
|
async function refreshLockPaths(definition) {
|
|
68
67
|
const paths = [];
|
|
@@ -99,7 +98,7 @@ function resolveTimeoutMs(explicit) {
|
|
|
99
98
|
if (explicit !== void 0) {
|
|
100
99
|
return explicit;
|
|
101
100
|
}
|
|
102
|
-
const raw =
|
|
101
|
+
const raw = runtimeEnvironment()[TIMEOUT_OVERRIDE_ENV];
|
|
103
102
|
if (raw === void 0 || raw.trim().length === 0) {
|
|
104
103
|
return void 0;
|
|
105
104
|
}
|
|
@@ -115,7 +114,7 @@ function filenameSafeLabel(value) {
|
|
|
115
114
|
return value.replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^[._-]+/, "").slice(0, LOCK_LABEL_MAX);
|
|
116
115
|
}
|
|
117
116
|
|
|
118
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
117
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/oauth-token-refresh.js
|
|
119
118
|
var TOKEN_EXPIRY_SKEW_SECONDS = 60;
|
|
120
119
|
var TOKEN_REQUEST_TIMEOUT_MS = 1e4;
|
|
121
120
|
var OAuthIssuerMismatchError = class extends Error {
|
|
@@ -418,7 +417,7 @@ async function refreshBearerToken(definition, refreshToken) {
|
|
|
418
417
|
if (!refresh) {
|
|
419
418
|
throw new Error("Missing refresh configuration.");
|
|
420
419
|
}
|
|
421
|
-
const clientId = readEnvOrConfig(refresh.clientIdEnv, definition.oauthClientId);
|
|
420
|
+
const clientId = readEnvOrConfig(refresh.clientIdEnv, definition.oauthClientId, definition.env);
|
|
422
421
|
const method = refresh.clientAuthMethod ?? definition.oauthTokenEndpointAuthMethod ?? "client_secret_basic";
|
|
423
422
|
const clientSecret = method === "none" ? void 0 : readClientSecret(definition, refresh.clientSecretEnv);
|
|
424
423
|
const body = new URLSearchParams({
|
|
@@ -490,11 +489,11 @@ function coerceExpiresIn(value) {
|
|
|
490
489
|
}
|
|
491
490
|
return {};
|
|
492
491
|
}
|
|
493
|
-
function readEnvOrConfig(envName, fallback) {
|
|
492
|
+
function readEnvOrConfig(envName, fallback, env = process.env) {
|
|
494
493
|
if (!envName) {
|
|
495
494
|
return fallback;
|
|
496
495
|
}
|
|
497
|
-
const value =
|
|
496
|
+
const value = env[envName];
|
|
498
497
|
if (value === void 0 || value.trim().length === 0) {
|
|
499
498
|
throw new Error(`Environment variable '${envName}' is required for bearer token refresh.`);
|
|
500
499
|
}
|
|
@@ -505,12 +504,12 @@ function formEncodeCredential(value) {
|
|
|
505
504
|
}
|
|
506
505
|
function readClientSecret(definition, refreshClientSecretEnv) {
|
|
507
506
|
if (refreshClientSecretEnv) {
|
|
508
|
-
return readEnvOrConfig(refreshClientSecretEnv, void 0);
|
|
507
|
+
return readEnvOrConfig(refreshClientSecretEnv, void 0, definition.env);
|
|
509
508
|
}
|
|
510
509
|
return resolveOAuthClientSecret(definition, { rejectBlank: true });
|
|
511
510
|
}
|
|
512
511
|
|
|
513
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
512
|
+
// node_modules/.pnpm/mcporter@0.13.10/node_modules/mcporter/dist/oauth-persistence.js
|
|
514
513
|
async function buildOAuthPersistence(definition, logger) {
|
|
515
514
|
return await createOAuthPersistenceStores(definition, logger);
|
|
516
515
|
}
|