@introspection-ai/recipes 0.28.0 → 0.30.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/agents.d.ts +34 -0
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +87 -0
- package/dist/agents.js.map +1 -1
- package/dist/child/agent.d.ts +5 -0
- package/dist/child/agent.d.ts.map +1 -1
- package/dist/child/agent.js +19 -8
- package/dist/child/agent.js.map +1 -1
- package/dist/child/session.d.ts +33 -4
- package/dist/child/session.d.ts.map +1 -1
- package/dist/child/session.js +68 -3
- package/dist/child/session.js.map +1 -1
- package/dist/mcp-chunks/{auth-command-GQFV6QYP.js → auth-command-SDTBVC2R.js} +22 -21
- package/dist/mcp-chunks/call-arguments-ER7NWEPS.js +16 -0
- package/dist/mcp-chunks/{call-command-LMAREWKD.js → call-command-WOZT2DLX.js} +33 -32
- package/dist/mcp-chunks/{chunk-5B7GRMUK.js → chunk-27XDYSXJ.js} +1 -1
- package/dist/mcp-chunks/{chunk-FONFU4G5.js → chunk-2IO3FXZJ.js} +1 -1
- package/dist/mcp-chunks/{chunk-O4JIUOWF.js → chunk-35JUFDQI.js} +2 -2
- package/dist/mcp-chunks/{chunk-UYJZJXC2.js → chunk-43QNQO5C.js} +3 -3
- package/dist/mcp-chunks/{chunk-LIEFPSSB.js → chunk-4IXQQER3.js} +5 -5
- package/dist/mcp-chunks/{chunk-O2VOMKAS.js → chunk-6XBQDCGX.js} +10 -10
- package/dist/mcp-chunks/{chunk-S2YF442K.js → chunk-7CI6DKEP.js} +2 -2
- package/dist/mcp-chunks/{chunk-H7ARMBV7.js → chunk-7OQUF6V6.js} +26 -10
- package/dist/mcp-chunks/{chunk-S6GJ42I2.js → chunk-7X3JHUMH.js} +1 -1
- package/dist/mcp-chunks/{chunk-D6B2M5V7.js → chunk-7ZZZ7MR2.js} +1 -1
- package/dist/mcp-chunks/{chunk-WHJUDBPR.js → chunk-AHDUZPNI.js} +2 -1
- package/dist/mcp-chunks/{chunk-QALB3DRW.js → chunk-ALLS7CUV.js} +1 -1
- package/dist/mcp-chunks/{chunk-6RG6AD5X.js → chunk-ASFI5AJK.js} +17 -11
- package/dist/mcp-chunks/{chunk-LQIE4PKL.js → chunk-CMDB57MS.js} +2 -2
- package/dist/mcp-chunks/{chunk-HZ2SX5U6.js → chunk-CO4CYU5W.js} +11 -11
- package/dist/mcp-chunks/{chunk-TUQGOYK6.js → chunk-CRX2G22W.js} +1 -1
- package/dist/mcp-chunks/{chunk-UKM35J67.js → chunk-DUJ5WAHC.js} +2 -2
- package/dist/mcp-chunks/{chunk-RIHPVCGI.js → chunk-EIF7GALA.js} +1 -1
- package/dist/mcp-chunks/{chunk-QJNF3A3F.js → chunk-EIXFNLU6.js} +1 -1
- package/dist/mcp-chunks/{chunk-77BZYP72.js → chunk-FMYP6JXX.js} +1 -1
- package/dist/mcp-chunks/{chunk-LXHPDKEF.js → chunk-FQAJT6U2.js} +1 -1
- package/dist/mcp-chunks/{chunk-7WL4TMON.js → chunk-FUKRLUU7.js} +4 -4
- package/dist/mcp-chunks/{chunk-L6OOGZVA.js → chunk-FVZKQMZS.js} +21 -7
- package/dist/mcp-chunks/{chunk-RZIJUJGL.js → chunk-FWWPRZ37.js} +31 -40
- package/dist/mcp-chunks/{chunk-KQCLM7R7.js → chunk-GJ7DWMRT.js} +1 -1
- package/dist/mcp-chunks/{chunk-LCBDVFVA.js → chunk-HM26TIPK.js} +1 -1
- package/dist/mcp-chunks/{chunk-JVYCENPP.js → chunk-IJTZ2ZRM.js} +4 -4
- package/dist/mcp-chunks/{chunk-S5F3HEZZ.js → chunk-IR5SMKTP.js} +425 -445
- package/dist/mcp-chunks/{chunk-7PFJCLXL.js → chunk-IWXEOLJL.js} +20 -16
- package/dist/mcp-chunks/{chunk-D6SVCPN6.js → chunk-JQCSGX6E.js} +1 -1
- package/dist/mcp-chunks/{chunk-P463YBJM.js → chunk-JRU5LZJQ.js} +1 -1
- package/dist/mcp-chunks/{chunk-XNHGMWN2.js → chunk-M7VINGHY.js} +9 -7
- package/dist/mcp-chunks/{chunk-IF6LRV3J.js → chunk-OURSGEZX.js} +8 -8
- package/dist/mcp-chunks/{chunk-H4KL74PV.js → chunk-P3S4OJPI.js} +9 -9
- package/dist/mcp-chunks/{chunk-P3UVILEW.js → chunk-POYT6GCW.js} +29 -5
- package/dist/mcp-chunks/{chunk-5BMCVE2J.js → chunk-R636HUNL.js} +17 -13
- package/dist/mcp-chunks/{chunk-TYYSBILI.js → chunk-SONMFI3S.js} +70 -28
- package/dist/mcp-chunks/{chunk-I6UMKX5E.js → chunk-SVCKS5MW.js} +4 -4
- package/dist/mcp-chunks/{chunk-NQW3ES2G.js → chunk-TDBM2UIR.js} +1 -1
- package/dist/mcp-chunks/{chunk-VJIAHZZG.js → chunk-TKZA4MPW.js} +4 -4
- package/dist/mcp-chunks/{chunk-2P2HVZ3G.js → chunk-UHXTAPEC.js} +1 -1
- package/dist/mcp-chunks/{chunk-CLR6DJV3.js → chunk-UXI26V4F.js} +1 -1
- package/dist/mcp-chunks/{chunk-UIPG6W7N.js → chunk-UYG7PAN2.js} +2 -2
- package/dist/mcp-chunks/{chunk-2HOMVWSA.js → chunk-VCPUZFU7.js} +2 -2
- package/dist/mcp-chunks/{chunk-FBVRU4Y3.js → chunk-VRTH73R5.js} +40 -33
- package/dist/mcp-chunks/{chunk-KOWNVUL2.js → chunk-VWNF5PIF.js} +2 -2
- package/dist/mcp-chunks/{chunk-MJFZM5EV.js → chunk-WQBESOWG.js} +22 -5
- package/dist/mcp-chunks/chunk-XDARNDP3.js +25 -0
- package/dist/mcp-chunks/{chunk-OSYB5GNF.js → chunk-XUJQ6U6M.js} +3 -3
- package/dist/mcp-chunks/{chunk-PJCMJ65D.js → chunk-YGRORKGT.js} +226 -101
- package/dist/mcp-chunks/{chunk-C2VLY7ED.js → chunk-YM7ZVYI2.js} +4 -4
- package/dist/mcp-chunks/{chunk-6QZQZXDJ.js → chunk-YTO7DITJ.js} +3 -3
- package/dist/mcp-chunks/{chunk-UHO6KIUJ.js → chunk-ZLV5S5UP.js} +2 -2
- package/dist/mcp-chunks/{cli-JI7MEAAX.js → cli-67GWFF4R.js} +69 -68
- package/dist/mcp-chunks/client-MQMNAYYW.js +31 -0
- package/dist/mcp-chunks/{config-command-GRZLKD3R.js → config-command-3IKIRWMW.js} +41 -27
- package/dist/mcp-chunks/daemon-command-OMOZ5MP7.js +31 -0
- package/dist/mcp-chunks/{dist-USMCQ22V.js → dist-YL3LFKVP.js} +219 -202
- package/dist/mcp-chunks/{emit-ts-command-7VLESP7H.js → emit-ts-command-YWKROLL2.js} +84 -70
- package/dist/mcp-chunks/{generate-cli-runner-SSW2B72K.js → generate-cli-runner-CZEVY2Y7.js} +51 -48
- package/dist/mcp-chunks/generated-daemon-runtime-SRFULTIT.js +31 -0
- package/dist/mcp-chunks/{inspect-cli-command-NCGCMOIS.js → inspect-cli-command-5Y2LORK5.js} +9 -9
- package/dist/mcp-chunks/{launch-NBONSPNK.js → launch-43TA3HYF.js} +1 -1
- package/dist/mcp-chunks/{lifecycle-CXAKUCN4.js → lifecycle-BY2ILXTB.js} +1 -1
- package/dist/mcp-chunks/{list-command-5T4UF4PF.js → list-command-7RU7NNAV.js} +56 -43
- package/dist/mcp-chunks/{output-utils-YFTWQZ5V.js → output-utils-2R3SA6KR.js} +3 -3
- package/dist/mcp-chunks/{prompt-CH6TK0bC-6DI4RA4E.js → prompt-CH6TK0bC-GKQOEUY4.js} +1 -1
- package/dist/mcp-chunks/{record-command-TE5O7WBL.js → record-command-ROIRRNFS.js} +5 -5
- package/dist/mcp-chunks/{replay-command-QCUL5ASR.js → replay-command-Y2MYVQTL.js} +6 -6
- package/dist/mcp-chunks/{resource-command-XMGF7EAK.js → resource-command-VUV7AYYQ.js} +9 -9
- package/dist/mcp-chunks/{result-utils-HKB42M7Y.js → result-utils-5U7NVXDZ.js} +3 -3
- package/dist/mcp-chunks/runtime-Q4SCCOQE.js +38 -0
- package/dist/mcp-chunks/{runtime-wrapper-MI3HF45J.js → runtime-wrapper-3BVFTSWJ.js} +3 -3
- package/dist/mcp-chunks/{serve-command-5HV3ZE25.js → serve-command-BXLQWHFW.js} +8969 -1147
- package/dist/mcp-chunks/{timeouts-YBFBTLV2.js → timeouts-6GL2F44N.js} +3 -3
- package/dist/mcp-chunks/{vault-command-FC2PD5U6.js → vault-command-JCMW3DQA.js} +4 -4
- package/dist/mcp-chunks/{webapi-IFUPO72B.js → webapi-UMWFGMQV.js} +46 -46
- package/dist/mcp-daemon.js +27 -26
- package/dist/mcp-run-worker.js +27 -26
- package/dist/pi-extension.d.ts.map +1 -1
- package/dist/pi-extension.js +31 -24
- package/dist/pi-extension.js.map +1 -1
- package/dist/recipe/model.d.ts.map +1 -1
- package/dist/recipe/model.js +25 -1
- package/dist/recipe/model.js.map +1 -1
- package/dist/recipe/session.d.ts.map +1 -1
- package/dist/recipe/session.js +2 -0
- package/dist/recipe/session.js.map +1 -1
- package/dist/run-controller.d.ts +13 -3
- package/dist/run-controller.d.ts.map +1 -1
- package/dist/run-controller.js +26 -11
- package/dist/run-controller.js.map +1 -1
- package/dist/session.d.ts +18 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +25 -12
- package/dist/session.js.map +1 -1
- package/docs/agent-composition.md +27 -6
- package/docs/host-api.md +32 -4
- package/docs/pi-extension.md +3 -2
- package/docs/recipe-format.md +23 -8
- package/package.json +10 -10
- package/dist/mcp-chunks/call-arguments-VT7JLNJY.js +0 -16
- package/dist/mcp-chunks/client-QU7ABSNB.js +0 -30
- package/dist/mcp-chunks/daemon-command-3266CYHO.js +0 -30
- package/dist/mcp-chunks/generated-daemon-runtime-7CFVWLC7.js +0 -30
- package/dist/mcp-chunks/runtime-3X2XVS6X.js +0 -37
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm/mcporter@0.
|
|
3
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/package.json
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "mcporter",
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.14.2",
|
|
7
7
|
description: "TypeScript runtime and CLI for connecting to configured Model Context Protocol servers.",
|
|
8
8
|
keywords: [
|
|
9
9
|
"cli",
|
|
@@ -43,35 +43,38 @@ var package_default = {
|
|
|
43
43
|
},
|
|
44
44
|
dependencies: {
|
|
45
45
|
"@iarna/toml": "^2.2.5",
|
|
46
|
-
"@modelcontextprotocol/client": "^2.
|
|
47
|
-
"@modelcontextprotocol/server": "^2.
|
|
46
|
+
"@modelcontextprotocol/client": "^2.2.0",
|
|
47
|
+
"@modelcontextprotocol/server": "^2.2.0",
|
|
48
48
|
acorn: "^8.18.0",
|
|
49
49
|
commander: "^15.0.0",
|
|
50
50
|
"es-toolkit": "^1.52.0",
|
|
51
51
|
"jsonc-parser": "^3.3.1",
|
|
52
52
|
ora: "^9.4.1",
|
|
53
|
-
rolldown: "1.2.
|
|
54
|
-
zod: "^4.6.
|
|
53
|
+
rolldown: "1.2.11",
|
|
54
|
+
zod: "^4.6.5"
|
|
55
55
|
},
|
|
56
56
|
devDependencies: {
|
|
57
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
57
|
+
"@modelcontextprotocol/sdk": "^1.31.0",
|
|
58
58
|
"@types/estree": "^1.0.9",
|
|
59
59
|
"@types/express": "^5.0.6",
|
|
60
|
-
"@types/node": "^26.
|
|
60
|
+
"@types/node": "^26.6.3",
|
|
61
61
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
62
|
-
"@vitest/coverage-v8": "^5.0.
|
|
62
|
+
"@vitest/coverage-v8": "^5.0.2",
|
|
63
63
|
"bun-types": "^1.4.2",
|
|
64
64
|
"cross-env": "^10.1.0",
|
|
65
65
|
express: "^5.2.1",
|
|
66
|
-
oxfmt: "^0.
|
|
67
|
-
oxlint: "^1.
|
|
68
|
-
"oxlint-tsgolint": "^7.0.
|
|
66
|
+
oxfmt: "^0.71.0",
|
|
67
|
+
oxlint: "^1.86.0",
|
|
68
|
+
"oxlint-tsgolint": "^7.0.2003",
|
|
69
69
|
rimraf: "^6.1.3",
|
|
70
|
-
tsx: "^4.23.
|
|
70
|
+
tsx: "^4.23.15",
|
|
71
71
|
typescript: "npm:@typescript/typescript6@^6.0.2",
|
|
72
|
-
vite: "8.3.
|
|
73
|
-
vitest: "^5.0.
|
|
72
|
+
vite: "8.3.1",
|
|
73
|
+
vitest: "^5.0.2"
|
|
74
74
|
},
|
|
75
|
+
bundleDependencies: [
|
|
76
|
+
"@modelcontextprotocol/client"
|
|
77
|
+
],
|
|
75
78
|
devEngines: {
|
|
76
79
|
runtime: [
|
|
77
80
|
{
|
|
@@ -97,6 +100,7 @@ var package_default = {
|
|
|
97
100
|
test: "cross-env MCPORTER_TEST_REPORTER=quiet pnpm test:verbose",
|
|
98
101
|
"test:quiet": "cross-env MCPORTER_TEST_REPORTER=quiet pnpm test:verbose",
|
|
99
102
|
"test:verbose": "pnpm build && node scripts/test-runner.js",
|
|
103
|
+
"test:package": "pnpm build && bash scripts/test-npm-package.sh",
|
|
100
104
|
"test:live": "MCP_LIVE_TESTS=1 vitest run tests/live",
|
|
101
105
|
"test:coverage": "pnpm build && cross-env MCPORTER_TEST_REPORTER=quiet vitest run --coverage",
|
|
102
106
|
clean: "rimraf dist",
|
|
@@ -115,7 +119,7 @@ var package_default = {
|
|
|
115
119
|
}
|
|
116
120
|
};
|
|
117
121
|
|
|
118
|
-
// node_modules/.pnpm/mcporter@0.
|
|
122
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/version.js
|
|
119
123
|
var MCPORTER_VERSION = package_default.version;
|
|
120
124
|
|
|
121
125
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm/mcporter@0.
|
|
3
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/env.js
|
|
4
4
|
import os from "node:os";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
var ENV_DEFAULT_PATTERN = /^\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-|:|-)?([^}]*)\}$/;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm/mcporter@0.
|
|
3
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/logging.js
|
|
4
4
|
var LOG_LEVEL_ORDER = {
|
|
5
5
|
debug: 10,
|
|
6
6
|
info: 20,
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
withFileLock,
|
|
5
5
|
writeJsonFile,
|
|
6
6
|
writeTextFileAtomic
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7OQUF6V6.js";
|
|
8
8
|
|
|
9
|
-
// node_modules/.pnpm/mcporter@0.
|
|
9
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth-vault.js
|
|
10
10
|
import crypto from "node:crypto";
|
|
11
11
|
import path2 from "node:path";
|
|
12
12
|
|
|
13
|
-
// node_modules/.pnpm/mcporter@0.
|
|
13
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth-credential-validation.js
|
|
14
14
|
function isRecord(value) {
|
|
15
15
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
16
16
|
}
|
|
@@ -31,7 +31,7 @@ function isStoredOAuthClientInformation(value) {
|
|
|
31
31
|
return isOptionalString(value, "issuer");
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
// node_modules/.pnpm/mcporter@0.
|
|
34
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth-token-generation.js
|
|
35
35
|
import { randomUUID } from "node:crypto";
|
|
36
36
|
import { isDeepStrictEqual } from "node:util";
|
|
37
37
|
var TOKEN_GENERATION_FIELD = "__mcporter_generation";
|
|
@@ -111,7 +111,7 @@ function sameOAuthClientValue(left, right) {
|
|
|
111
111
|
return isDeepStrictEqual(withoutClientGeneration(left), withoutClientGeneration(right));
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
// node_modules/.pnpm/mcporter@0.
|
|
114
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/runtime/environment.js
|
|
115
115
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
116
116
|
import os from "node:os";
|
|
117
117
|
import path from "node:path";
|
|
@@ -134,7 +134,7 @@ function runtimeStateDir(kind) {
|
|
|
134
134
|
return root && path.isAbsolute(root) ? path.join(root, "mcporter") : path.join(runtimeHome(), ".mcporter");
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
// node_modules/.pnpm/mcporter@0.
|
|
137
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth-vault.js
|
|
138
138
|
function getOAuthVaultPath() {
|
|
139
139
|
return path2.join(runtimeStateDir("data"), "credentials.json");
|
|
140
140
|
}
|
|
@@ -431,7 +431,7 @@ async function clearVaultEntry(definition, scope) {
|
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
-
// node_modules/.pnpm/mcporter@0.
|
|
434
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth-persistence-stores.js
|
|
435
435
|
import fs from "node:fs/promises";
|
|
436
436
|
import path3 from "node:path";
|
|
437
437
|
function withStoredExpiry(tokens) {
|
|
@@ -1000,7 +1000,9 @@ export {
|
|
|
1000
1000
|
runtimeEnvironment,
|
|
1001
1001
|
withRuntimeEnvironment,
|
|
1002
1002
|
runtimeStateDir,
|
|
1003
|
+
withOAuthClientGeneration,
|
|
1003
1004
|
sameOAuthTokenGeneration,
|
|
1005
|
+
sameOAuthClientGeneration,
|
|
1004
1006
|
getOAuthVaultPath,
|
|
1005
1007
|
vaultCredentialKeys,
|
|
1006
1008
|
saveVaultEntry,
|
|
@@ -6,23 +6,23 @@ import {
|
|
|
6
6
|
runtimeStateDir,
|
|
7
7
|
sameOAuthTokenGeneration,
|
|
8
8
|
vaultCredentialKeys
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-M7VINGHY.js";
|
|
10
10
|
import {
|
|
11
11
|
canonicalizeFilePath,
|
|
12
12
|
isFileLockTimeoutError,
|
|
13
13
|
withFileLock
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-7OQUF6V6.js";
|
|
15
15
|
import {
|
|
16
16
|
checkResourceAllowed,
|
|
17
17
|
discoverOAuthServerInfo,
|
|
18
18
|
refreshAuthorization,
|
|
19
19
|
resourceUrlFromServerUrl
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-IR5SMKTP.js";
|
|
21
21
|
|
|
22
|
-
// node_modules/.pnpm/mcporter@0.
|
|
22
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth-token-refresh.js
|
|
23
23
|
import { Buffer } from "node:buffer";
|
|
24
24
|
|
|
25
|
-
// node_modules/.pnpm/mcporter@0.
|
|
25
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth-client-info.js
|
|
26
26
|
function buildStaticClientInformation(definition, options = {}) {
|
|
27
27
|
if (!definition.oauthClientId) {
|
|
28
28
|
return void 0;
|
|
@@ -48,7 +48,7 @@ function resolveOAuthClientSecret(definition, options = {}) {
|
|
|
48
48
|
return definition.oauthClientSecret;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
// node_modules/.pnpm/mcporter@0.
|
|
51
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth-refresh-lock.js
|
|
52
52
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
53
53
|
import crypto from "node:crypto";
|
|
54
54
|
import path from "node:path";
|
|
@@ -111,7 +111,7 @@ function filenameSafeLabel(value) {
|
|
|
111
111
|
return value.replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^[._-]+/, "").slice(0, LOCK_LABEL_MAX);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
// node_modules/.pnpm/mcporter@0.
|
|
114
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth-token-refresh.js
|
|
115
115
|
var TOKEN_EXPIRY_SKEW_SECONDS = 60;
|
|
116
116
|
var TOKEN_REQUEST_TIMEOUT_MS = 1e4;
|
|
117
117
|
var OAuthIssuerMismatchError = class extends Error {
|
|
@@ -506,7 +506,7 @@ function readClientSecret(definition, refreshClientSecretEnv) {
|
|
|
506
506
|
return resolveOAuthClientSecret(definition, { rejectBlank: true });
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
-
// node_modules/.pnpm/mcporter@0.
|
|
509
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth-persistence.js
|
|
510
510
|
async function buildOAuthPersistence(definition, logger) {
|
|
511
511
|
return await createOAuthPersistenceStores(definition, logger);
|
|
512
512
|
}
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
resolveEnvPlaceholders,
|
|
7
7
|
resolveEnvValue
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JQCSGX6E.js";
|
|
9
9
|
|
|
10
|
-
// node_modules/.pnpm/mcporter@0.
|
|
10
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/chrome-devtools-command.js
|
|
11
11
|
var AUTO_CONNECT_FLAGS = /* @__PURE__ */ new Set(["--autoConnect", "--auto-connect"]);
|
|
12
12
|
var NEGATED_AUTO_CONNECT_FLAGS = /* @__PURE__ */ new Set(["--no-autoConnect", "--no-auto-connect"]);
|
|
13
13
|
var CONNECTION_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
@@ -277,7 +277,7 @@ function booleanLiteral(value) {
|
|
|
277
277
|
return void 0;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
// node_modules/.pnpm/mcporter@0.
|
|
280
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/runtime/utils.js
|
|
281
281
|
var ENV_PLACEHOLDER_PATTERN = /\$\{(?:env:[^}]*|[A-Za-z_][A-Za-z0-9_]*(?::-[^}]*)?)\}/;
|
|
282
282
|
var MAX_TIMER_DELAY_MS = 2147483647;
|
|
283
283
|
function resolveCommandArgument(value, env = process.env) {
|
|
@@ -358,13 +358,13 @@ function scheduleDeadline(callback, delayMs) {
|
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
// node_modules/.pnpm/mcporter@0.
|
|
361
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/chrome-devtools-relay.js
|
|
362
362
|
import { createHash as createHash3 } from "node:crypto";
|
|
363
363
|
import fs from "node:fs";
|
|
364
364
|
import os from "node:os";
|
|
365
365
|
import path2 from "node:path";
|
|
366
366
|
|
|
367
|
-
// node_modules/.pnpm/mcporter@0.
|
|
367
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/chrome-devtools-relay-proxy.js
|
|
368
368
|
import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
369
369
|
import http, {} from "node:http";
|
|
370
370
|
var WEBSOCKET_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
|
@@ -520,7 +520,7 @@ async function closeServer(server, sockets) {
|
|
|
520
520
|
await new Promise((resolve) => server.close(() => resolve()));
|
|
521
521
|
}
|
|
522
522
|
|
|
523
|
-
// node_modules/.pnpm/mcporter@0.
|
|
523
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/browser-relay-auth-v2.js
|
|
524
524
|
import { createHmac, hash, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
525
525
|
var BROWSER_RELAY_AUTH_LABEL = "openclaw.browser-relay.auth";
|
|
526
526
|
var BROWSER_RELAY_AUTH_VERSION = 2;
|
|
@@ -589,7 +589,7 @@ function isCanonicalBase64Url(value, bytes) {
|
|
|
589
589
|
return decoded.byteLength === bytes && decoded.toString("base64url") === value;
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
-
// node_modules/.pnpm/mcporter@0.
|
|
592
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/chrome-devtools-relay-client.js
|
|
593
593
|
import { createHash as createHash2, randomBytes as randomBytes2 } from "node:crypto";
|
|
594
594
|
import { lookup } from "node:dns/promises";
|
|
595
595
|
import net from "node:net";
|
|
@@ -1100,7 +1100,7 @@ function isTimeoutError(error) {
|
|
|
1100
1100
|
return Boolean(error && typeof error === "object" && error.reason === "timeout");
|
|
1101
1101
|
}
|
|
1102
1102
|
|
|
1103
|
-
// node_modules/.pnpm/mcporter@0.
|
|
1103
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/chrome-devtools-relay-discovery.js
|
|
1104
1104
|
import { spawn } from "node:child_process";
|
|
1105
1105
|
import { statSync } from "node:fs";
|
|
1106
1106
|
import net2 from "node:net";
|
|
@@ -1554,7 +1554,7 @@ function openClawDiscoveryEnvironment(env) {
|
|
|
1554
1554
|
return filtered;
|
|
1555
1555
|
}
|
|
1556
1556
|
|
|
1557
|
-
// node_modules/.pnpm/mcporter@0.
|
|
1557
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/chrome-devtools-relay.js
|
|
1558
1558
|
var DEFAULT_RELAY_PROBE_TIMEOUT_MS = 2e4;
|
|
1559
1559
|
var MIN_RELAY_PROBE_TIMEOUT_MS = 100;
|
|
1560
1560
|
var MAX_RELAY_PROBE_TIMEOUT_MS = 3e4;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
logWarn
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CMDB57MS.js";
|
|
5
5
|
|
|
6
|
-
// node_modules/.pnpm/mcporter@0.
|
|
6
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/cli/output-utils.js
|
|
7
7
|
import fs from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import { inspect } from "node:util";
|
|
10
10
|
var RAW_INSPECT_DEPTH = 8;
|
|
11
|
+
var TAIL_LOG_LINE_COUNT = 20;
|
|
12
|
+
var TAIL_LOG_MAX_BYTES = 1024 * 1024;
|
|
11
13
|
var PREFERRED_OUTPUT_BY_FORMAT = {
|
|
12
14
|
auto: ["json", "markdown", "text", "raw"],
|
|
13
15
|
text: ["text", "markdown", "json", "raw"],
|
|
@@ -44,9 +46,12 @@ function tailLogIfRequested(result, enabled) {
|
|
|
44
46
|
continue;
|
|
45
47
|
}
|
|
46
48
|
try {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const stats = fs.statSync(candidate);
|
|
50
|
+
if (!stats.isFile()) {
|
|
51
|
+
logWarn(`Refusing to tail non-file log path: ${candidate}`);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const tail = readLastLogLines(candidate, TAIL_LOG_LINE_COUNT);
|
|
50
55
|
console.log(`--- tail ${candidate} ---`);
|
|
51
56
|
for (const line of tail) {
|
|
52
57
|
console.log(line);
|
|
@@ -56,6 +61,25 @@ function tailLogIfRequested(result, enabled) {
|
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
63
|
}
|
|
64
|
+
function readLastLogLines(filePath, lineCount) {
|
|
65
|
+
const fd = fs.openSync(filePath, fs.constants.O_RDONLY | fs.constants.O_NONBLOCK);
|
|
66
|
+
try {
|
|
67
|
+
const stats = fs.fstatSync(fd);
|
|
68
|
+
if (!stats.isFile())
|
|
69
|
+
throw new Error("Refusing to tail non-file log path");
|
|
70
|
+
const readSize = Math.min(stats.size, TAIL_LOG_MAX_BYTES);
|
|
71
|
+
const start = stats.size - readSize;
|
|
72
|
+
const buffer = Buffer.alloc(readSize);
|
|
73
|
+
const bytesRead = fs.readSync(fd, buffer, 0, readSize, start);
|
|
74
|
+
if (bytesRead <= 0) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
const lines = buffer.subarray(0, bytesRead).toString("utf8").trimEnd().split(/\r?\n/);
|
|
78
|
+
return lines.slice(-lineCount);
|
|
79
|
+
} finally {
|
|
80
|
+
fs.closeSync(fd);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
59
83
|
function resolveRenderableOutput(wrapped, raw, preferredKinds) {
|
|
60
84
|
for (const kind of preferredKinds) {
|
|
61
85
|
if (kind === "json") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
launchDaemonDetached
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FQAJT6U2.js";
|
|
5
5
|
import {
|
|
6
6
|
BrokerError,
|
|
7
7
|
DAEMON_PROTOCOL_VERSION,
|
|
@@ -19,33 +19,33 @@ import {
|
|
|
19
19
|
resolveProgressInterval,
|
|
20
20
|
stopVerifiedLegacyDaemons,
|
|
21
21
|
waitForDaemonReady
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-VRTH73R5.js";
|
|
23
23
|
import {
|
|
24
24
|
canonicalUserConfiguration,
|
|
25
25
|
getDaemonLogPath,
|
|
26
26
|
secureDaemonDirectory
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-YGRORKGT.js";
|
|
28
28
|
import {
|
|
29
29
|
ChromeDevtoolsRelayDiscoveryError
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-P3S4OJPI.js";
|
|
31
31
|
import {
|
|
32
32
|
withFileLock,
|
|
33
33
|
writeJsonFile
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-7OQUF6V6.js";
|
|
35
35
|
import {
|
|
36
36
|
expandHome
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-JQCSGX6E.js";
|
|
38
38
|
|
|
39
|
-
// node_modules/.pnpm/mcporter@0.
|
|
39
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/cli/daemon-command.js
|
|
40
40
|
import fsPromises from "node:fs/promises";
|
|
41
41
|
import path2 from "node:path";
|
|
42
42
|
|
|
43
|
-
// node_modules/.pnpm/mcporter@0.
|
|
43
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/daemon/host.js
|
|
44
44
|
import fs from "node:fs/promises";
|
|
45
45
|
import net from "node:net";
|
|
46
46
|
import { randomUUID } from "node:crypto";
|
|
47
47
|
|
|
48
|
-
// node_modules/.pnpm/mcporter@0.
|
|
48
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/daemon/log-context.js
|
|
49
49
|
import fsSync from "node:fs";
|
|
50
50
|
import path from "node:path";
|
|
51
51
|
function createLogContext(options) {
|
|
@@ -97,7 +97,7 @@ async function disposeLogContext(context) {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
// node_modules/.pnpm/mcporter@0.
|
|
100
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/daemon/host.js
|
|
101
101
|
async function runDaemonHost(options) {
|
|
102
102
|
await secureDaemonDirectory();
|
|
103
103
|
await assertLegacyDrained();
|
|
@@ -192,6 +192,8 @@ async function runDaemonHost(options) {
|
|
|
192
192
|
}, resolveProgressInterval(request.progressIntervalMs));
|
|
193
193
|
let result;
|
|
194
194
|
let notices = [];
|
|
195
|
+
const activityServer = "server" in request.params ? request.params.server : void 0;
|
|
196
|
+
const logActivity = log.logAllServers || log.servers.size === 0 || typeof activityServer === "string" && log.servers.has(activityServer);
|
|
195
197
|
switch (request.method) {
|
|
196
198
|
case "status":
|
|
197
199
|
result = status();
|
|
@@ -208,9 +210,11 @@ async function runDaemonHost(options) {
|
|
|
208
210
|
result = true;
|
|
209
211
|
break;
|
|
210
212
|
default:
|
|
211
|
-
|
|
213
|
+
if (logActivity)
|
|
214
|
+
logEvent(log, `${request.method} start`);
|
|
212
215
|
({ result, notices } = await broker.invokeWithNotices(request));
|
|
213
|
-
|
|
216
|
+
if (logActivity)
|
|
217
|
+
logEvent(log, `${request.method} success`);
|
|
214
218
|
}
|
|
215
219
|
frames.write({ id, ok: true, result, notices });
|
|
216
220
|
socket.end();
|
|
@@ -292,7 +296,7 @@ async function cleanupDaemonArtifactsIfOwned(paths, ownerPid) {
|
|
|
292
296
|
await fs.unlink(paths.metadataPath);
|
|
293
297
|
}
|
|
294
298
|
|
|
295
|
-
// node_modules/.pnpm/mcporter@0.
|
|
299
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/cli/daemon-command.js
|
|
296
300
|
async function handleDaemonCli(args, options) {
|
|
297
301
|
const subcommand = args.shift();
|
|
298
302
|
if (!subcommand || subcommand === "help" || subcommand === "--help") {
|
|
@@ -7,35 +7,63 @@ import {
|
|
|
7
7
|
reconcilePersistedTokens,
|
|
8
8
|
withRefreshLock,
|
|
9
9
|
withRefreshRequestTimeout
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OURSGEZX.js";
|
|
11
11
|
import {
|
|
12
12
|
runtimeEnvironment,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
sameOAuthClientGeneration,
|
|
14
|
+
sameOAuthTokenGeneration,
|
|
15
|
+
withOAuthClientGeneration
|
|
16
|
+
} from "./chunk-M7VINGHY.js";
|
|
17
|
+
import {
|
|
18
|
+
OAuthRequestedScopeSchema
|
|
19
|
+
} from "./chunk-FWWPRZ37.js";
|
|
15
20
|
import {
|
|
16
21
|
isFileLockTimeoutError
|
|
17
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-7OQUF6V6.js";
|
|
18
23
|
import {
|
|
19
24
|
analyzeConnectionError
|
|
20
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-35JUFDQI.js";
|
|
21
26
|
import {
|
|
22
27
|
IssuerMismatchError,
|
|
23
28
|
auth,
|
|
24
29
|
validateClientMetadataUrl
|
|
25
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-IR5SMKTP.js";
|
|
26
31
|
|
|
27
|
-
// node_modules/.pnpm/mcporter@0.
|
|
32
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth-browser-suppression.js
|
|
28
33
|
var TRUE_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes"]);
|
|
29
34
|
function suppressBrowserLaunchFromEnv(env = runtimeEnvironment()) {
|
|
30
35
|
const raw = env.MCPORTER_OAUTH_NO_BROWSER;
|
|
31
36
|
return raw !== void 0 && TRUE_VALUES.has(raw.trim().toLowerCase());
|
|
32
37
|
}
|
|
33
38
|
|
|
34
|
-
// node_modules/.pnpm/mcporter@0.
|
|
39
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth.js
|
|
35
40
|
import { spawn } from "node:child_process";
|
|
36
41
|
import { createHash, randomUUID } from "node:crypto";
|
|
37
42
|
import http from "node:http";
|
|
38
|
-
import { URL } from "node:url";
|
|
43
|
+
import { URL as URL2 } from "node:url";
|
|
44
|
+
|
|
45
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth-redirect-uri.js
|
|
46
|
+
function matchesFreshLoopbackRedirect(returned, requested) {
|
|
47
|
+
let redirect;
|
|
48
|
+
try {
|
|
49
|
+
redirect = new URL(returned);
|
|
50
|
+
} catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (requested.protocol !== "http:" || redirect.protocol !== "http:")
|
|
54
|
+
return false;
|
|
55
|
+
if (!["127.0.0.1", "[::1]", "localhost"].includes(requested.hostname))
|
|
56
|
+
return false;
|
|
57
|
+
const sameHost = redirect.hostname === requested.hostname;
|
|
58
|
+
const fastmailShape = requested.hostname === "127.0.0.1" && redirect.hostname === "localhost" && redirect.port === "";
|
|
59
|
+
if (!sameHost && !fastmailShape)
|
|
60
|
+
return false;
|
|
61
|
+
redirect.hostname = requested.hostname;
|
|
62
|
+
redirect.port = requested.port;
|
|
63
|
+
return redirect.href === requested.href;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/oauth.js
|
|
39
67
|
var CALLBACK_HOST = "127.0.0.1";
|
|
40
68
|
var CALLBACK_PATH = "/callback";
|
|
41
69
|
var INTERACTIVE_AUTHORIZATION_TTL_MS = 3e5;
|
|
@@ -110,6 +138,7 @@ var PersistentOAuthClientProvider = class _PersistentOAuthClientProvider {
|
|
|
110
138
|
// prompt, because only one persisted PKCE verifier can complete (issue #247).
|
|
111
139
|
interactiveAuthorization = null;
|
|
112
140
|
pendingVerifiersByChallenge = /* @__PURE__ */ new Map();
|
|
141
|
+
freshClientRegistration;
|
|
113
142
|
server;
|
|
114
143
|
constructor(definition, persistence, redirectUrl, logger, usesDynamicPort, options = {}) {
|
|
115
144
|
this.definition = definition;
|
|
@@ -134,9 +163,11 @@ var PersistentOAuthClientProvider = class _PersistentOAuthClientProvider {
|
|
|
134
163
|
}
|
|
135
164
|
static async create(definition, logger, options = {}) {
|
|
136
165
|
validateClientMetadataUrl(definition.oauthClientMetadataUrl);
|
|
166
|
+
if (definition.oauthRequestedScope !== void 0)
|
|
167
|
+
OAuthRequestedScopeSchema.parse(definition.oauthRequestedScope);
|
|
137
168
|
const persistence = await buildOAuthPersistence(definition, logger);
|
|
138
169
|
const server = http.createServer();
|
|
139
|
-
const overrideRedirect = definition.oauthRedirectUrl ? new
|
|
170
|
+
const overrideRedirect = definition.oauthRedirectUrl ? new URL2(definition.oauthRedirectUrl) : null;
|
|
140
171
|
const listenHost = overrideRedirect?.hostname ?? CALLBACK_HOST;
|
|
141
172
|
const overridePort = overrideRedirect?.port ?? "";
|
|
142
173
|
const usesDynamicPort = !overrideRedirect || overridePort === "" || overridePort === "0";
|
|
@@ -153,7 +184,7 @@ var PersistentOAuthClientProvider = class _PersistentOAuthClientProvider {
|
|
|
153
184
|
});
|
|
154
185
|
server.once("error", (error) => reject(error));
|
|
155
186
|
});
|
|
156
|
-
const redirectUrl = overrideRedirect ? new
|
|
187
|
+
const redirectUrl = overrideRedirect ? new URL2(overrideRedirect.toString()) : new URL2(`http://${listenHost}:${port}${callbackPath}`);
|
|
157
188
|
if (usesDynamicPort) {
|
|
158
189
|
redirectUrl.port = String(port);
|
|
159
190
|
}
|
|
@@ -175,7 +206,7 @@ var PersistentOAuthClientProvider = class _PersistentOAuthClientProvider {
|
|
|
175
206
|
server.on("request", async (req, res) => {
|
|
176
207
|
try {
|
|
177
208
|
const url = req.url ?? "";
|
|
178
|
-
const parsed = new
|
|
209
|
+
const parsed = new URL2(url, this.redirectUrlValue);
|
|
179
210
|
const expectedPath = this.redirectUrlValue.pathname || "/callback";
|
|
180
211
|
if (parsed.pathname !== expectedPath) {
|
|
181
212
|
res.statusCode = 404;
|
|
@@ -264,7 +295,12 @@ var PersistentOAuthClientProvider = class _PersistentOAuthClientProvider {
|
|
|
264
295
|
return stored;
|
|
265
296
|
}
|
|
266
297
|
async saveClientInformation(clientInformation) {
|
|
267
|
-
await this.persistence.
|
|
298
|
+
const previous = await this.persistence.readClientInfo();
|
|
299
|
+
const saved = withOAuthClientGeneration(clientInformation);
|
|
300
|
+
await this.persistence.saveClientInfo(saved);
|
|
301
|
+
if (!previous || previous.client_id !== saved.client_id) {
|
|
302
|
+
this.freshClientRegistration = saved;
|
|
303
|
+
}
|
|
268
304
|
}
|
|
269
305
|
async tokens(ctx) {
|
|
270
306
|
const stored = await this.persistence.readTokens();
|
|
@@ -324,12 +360,14 @@ var PersistentOAuthClientProvider = class _PersistentOAuthClientProvider {
|
|
|
324
360
|
*/
|
|
325
361
|
async onOAuthUnauthorized(context, continueDefault) {
|
|
326
362
|
const rejected = context.presentedTokens;
|
|
327
|
-
if (!rejected) {
|
|
328
|
-
throw new OAuthRefreshUnavailableError(this.definition.name);
|
|
329
|
-
}
|
|
330
363
|
try {
|
|
331
364
|
await withRefreshLock(this.definition, async () => {
|
|
332
365
|
const latest = await reconcilePersistedTokens(this.definition, this.persistence);
|
|
366
|
+
if (!rejected) {
|
|
367
|
+
if (!latest)
|
|
368
|
+
await continueDefault({ fetchFn: withRefreshRequestTimeout(oauthJsonFetch) });
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
333
371
|
if (!latest) {
|
|
334
372
|
throw new OAuthRefreshUnavailableError(this.definition.name);
|
|
335
373
|
}
|
|
@@ -347,6 +385,10 @@ var PersistentOAuthClientProvider = class _PersistentOAuthClientProvider {
|
|
|
347
385
|
}
|
|
348
386
|
async redirectToAuthorization(authorizationUrl) {
|
|
349
387
|
await this.invalidateObsoleteDynamicRegistration();
|
|
388
|
+
if (this.definition.oauthRequestedScope !== void 0) {
|
|
389
|
+
authorizationUrl = new URL2(authorizationUrl);
|
|
390
|
+
authorizationUrl.searchParams.set("scope", this.definition.oauthRequestedScope);
|
|
391
|
+
}
|
|
350
392
|
this.authorizationRedirectStarted = true;
|
|
351
393
|
this.ensureAuthorizationDeferred();
|
|
352
394
|
const challenge = authorizationUrl.searchParams.get("code_challenge");
|
|
@@ -486,11 +528,12 @@ var PersistentOAuthClientProvider = class _PersistentOAuthClientProvider {
|
|
|
486
528
|
if (cachedClient?.client_id === this.definition.oauthClientMetadataUrl) {
|
|
487
529
|
return;
|
|
488
530
|
}
|
|
489
|
-
const
|
|
490
|
-
|
|
531
|
+
const redirects = redirectUris(cachedClient);
|
|
532
|
+
const fresh = this.freshClientRegistration && sameOAuthClientGeneration(cachedClient, this.freshClientRegistration);
|
|
533
|
+
if (!cachedClient || redirects.length === 0 || redirects.some((redirect) => redirect === this.redirectUrlValue.toString() || fresh && matchesFreshLoopbackRedirect(redirect, this.redirectUrlValue))) {
|
|
491
534
|
return;
|
|
492
535
|
}
|
|
493
|
-
this.logger.info(`Redirect URI changed (${
|
|
536
|
+
this.logger.info(`Redirect URI changed (${redirects.join(", ")} \u2192 ${this.redirectUrlValue.toString()}); replacing obsolete client registration before interactive authorization.`);
|
|
494
537
|
try {
|
|
495
538
|
await this.persistence.clearRejectedCredentials(snapshot.tokens, cachedClient);
|
|
496
539
|
} catch (error) {
|
|
@@ -516,16 +559,15 @@ async function createOAuthSession(definition, logger, options = {}) {
|
|
|
516
559
|
function challengeForVerifier(verifier) {
|
|
517
560
|
return createHash("sha256").update(verifier).digest("base64url");
|
|
518
561
|
}
|
|
519
|
-
function
|
|
562
|
+
function redirectUris(client) {
|
|
520
563
|
if (!client || typeof client !== "object") {
|
|
521
|
-
return
|
|
564
|
+
return [];
|
|
522
565
|
}
|
|
523
|
-
const
|
|
524
|
-
if (!Array.isArray(
|
|
525
|
-
return
|
|
566
|
+
const uris = client.redirect_uris;
|
|
567
|
+
if (!Array.isArray(uris)) {
|
|
568
|
+
return [];
|
|
526
569
|
}
|
|
527
|
-
|
|
528
|
-
return typeof first === "string" ? first : void 0;
|
|
570
|
+
return uris.filter((uri) => typeof uri === "string");
|
|
529
571
|
}
|
|
530
572
|
function issuersMatch(first, second) {
|
|
531
573
|
return first === second || first.endsWith("/") && first.slice(0, -1) === second || second.endsWith("/") && second.slice(0, -1) === first;
|
|
@@ -534,7 +576,7 @@ var __oauthInternals = {
|
|
|
534
576
|
openExternal
|
|
535
577
|
};
|
|
536
578
|
|
|
537
|
-
// node_modules/.pnpm/mcporter@0.
|
|
579
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/runtime-oauth-support.js
|
|
538
580
|
function maybeEnableOAuth(definition, logger) {
|
|
539
581
|
if (definition.auth === "oauth" || definition.auth === "refreshable_bearer") {
|
|
540
582
|
return void 0;
|
|
@@ -553,7 +595,7 @@ function isUnauthorizedError(error) {
|
|
|
553
595
|
return issue.kind === "auth";
|
|
554
596
|
}
|
|
555
597
|
|
|
556
|
-
// node_modules/.pnpm/mcporter@0.
|
|
598
|
+
// node_modules/.pnpm/mcporter@0.14.2/node_modules/mcporter/dist/runtime/oauth.js
|
|
557
599
|
var DEFAULT_OAUTH_CODE_TIMEOUT_MS = 3e5;
|
|
558
600
|
var OAUTH_FLOW_ERROR = /* @__PURE__ */ Symbol("oauth-flow-error");
|
|
559
601
|
var POST_AUTH_CONNECT_ERROR = /* @__PURE__ */ Symbol("post-auth-connect-error");
|