@introspection-ai/recipes 0.36.2 → 0.38.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/ask-user-question.d.ts +82 -0
- package/dist/ask-user-question.d.ts.map +1 -0
- package/dist/ask-user-question.js +314 -0
- package/dist/ask-user-question.js.map +1 -0
- package/dist/connector-tools.d.ts.map +1 -1
- package/dist/connector-tools.js +10 -2
- package/dist/connector-tools.js.map +1 -1
- package/dist/documents/index.d.ts +7 -0
- package/dist/documents/index.d.ts.map +1 -0
- package/dist/documents/index.js +4 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/documents/module.d.ts +61 -0
- package/dist/documents/module.d.ts.map +1 -0
- package/dist/documents/module.js +133 -0
- package/dist/documents/module.js.map +1 -0
- package/dist/documents/profile.d.ts +34 -0
- package/dist/documents/profile.d.ts.map +1 -0
- package/dist/documents/profile.js +94 -0
- package/dist/documents/profile.js.map +1 -0
- package/dist/documents/tools.d.ts +40 -0
- package/dist/documents/tools.d.ts.map +1 -0
- package/dist/documents/tools.js +327 -0
- package/dist/documents/tools.js.map +1 -0
- package/dist/documents/types.d.ts +144 -0
- package/dist/documents/types.d.ts.map +1 -0
- package/dist/documents/types.js +10 -0
- package/dist/documents/types.js.map +1 -0
- package/dist/extensions.d.ts +2 -0
- package/dist/extensions.d.ts.map +1 -1
- package/dist/extensions.js +3 -0
- package/dist/extensions.js.map +1 -1
- package/dist/interaction-tui.d.ts +1 -1
- package/dist/interaction-tui.d.ts.map +1 -1
- package/dist/interaction-tui.js +2 -2
- package/dist/interaction-tui.js.map +1 -1
- package/dist/mcp-chunks/{auth-command-GMMLBU24.js → auth-command-M7TQE3AL.js} +26 -23
- package/dist/mcp-chunks/call-arguments-GCXZA4HC.js +16 -0
- package/dist/mcp-chunks/{call-command-2VF6IKAZ.js → call-command-7LD7UEFK.js} +33 -33
- package/dist/mcp-chunks/{chunk-TYL2NVXI.js → chunk-2AKSS7WR.js} +2 -2
- package/dist/mcp-chunks/{chunk-LZUKBEQZ.js → chunk-2YV72LUA.js} +12 -12
- package/dist/mcp-chunks/{chunk-2JTXIMGE.js → chunk-3ETUDW7N.js} +1 -1
- package/dist/mcp-chunks/{chunk-5UK2JLTN.js → chunk-3FRLDHVD.js} +5 -5
- package/dist/mcp-chunks/{chunk-ENBJFQ6H.js → chunk-3HSC6NHZ.js} +1 -1
- package/dist/mcp-chunks/{chunk-IHOU2BEL.js → chunk-3LENTPGE.js} +2 -2
- package/dist/mcp-chunks/{chunk-ZJWZY54X.js → chunk-3P3KGT4H.js} +2 -2
- package/dist/mcp-chunks/{chunk-IMXPLUKE.js → chunk-3SXP4S2A.js} +2 -2
- package/dist/mcp-chunks/{chunk-22WCLO4D.js → chunk-5Z6WSV5D.js} +5 -5
- package/dist/mcp-chunks/{chunk-QNZGFUKC.js → chunk-63L6SHK3.js} +2 -2
- package/dist/mcp-chunks/{chunk-OI3RTQXY.js → chunk-66VSGFXA.js} +1 -1
- package/dist/mcp-chunks/{chunk-DUBQHYW4.js → chunk-6O42UGLI.js} +9 -9
- package/dist/mcp-chunks/{chunk-R4OYHQ4V.js → chunk-6P3KAQ5N.js} +1 -1
- package/dist/mcp-chunks/{chunk-5OO6WVPL.js → chunk-7U5NSQ5T.js} +1 -1
- package/dist/mcp-chunks/{chunk-O2C3HXGS.js → chunk-B6S43WID.js} +1 -1
- package/dist/mcp-chunks/{chunk-VWPKJFK4.js → chunk-BHXCAVFP.js} +1 -1
- package/dist/mcp-chunks/{chunk-WXNGATQ7.js → chunk-BUOGKTKK.js} +2 -1
- package/dist/mcp-chunks/{chunk-4U4BUXQD.js → chunk-CXST5CVH.js} +33 -17
- package/dist/mcp-chunks/{chunk-YWFQPA4D.js → chunk-DU4SDPEV.js} +2 -2
- package/dist/mcp-chunks/{chunk-ZI5XYM4C.js → chunk-E76ZUBOJ.js} +4 -4
- package/dist/mcp-chunks/{chunk-D2SZ7KRY.js → chunk-ELHS763C.js} +1 -1
- package/dist/mcp-chunks/chunk-EQCSXVQ7.js +10650 -0
- package/dist/mcp-chunks/{chunk-RHXZKYM7.js → chunk-F2X4Y2TQ.js} +1 -1
- package/dist/mcp-chunks/{chunk-6XC5JJWD.js → chunk-GTETFUPQ.js} +28 -25
- package/dist/mcp-chunks/{chunk-UQUM7ICD.js → chunk-GZ53GNFP.js} +10 -10
- package/dist/mcp-chunks/{chunk-LUVLTUKR.js → chunk-H5PBSJP3.js} +1 -1
- package/dist/mcp-chunks/{chunk-FLUF2FRN.js → chunk-HNQSUT44.js} +3 -3
- package/dist/mcp-chunks/{chunk-CN5KSNWG.js → chunk-I6UFV7RW.js} +1 -1
- package/dist/mcp-chunks/{chunk-OSTHIELS.js → chunk-IRARVOUM.js} +1 -1
- package/dist/mcp-chunks/{webapi-NNCZGUMZ.js → chunk-IRSL7JRH.js} +255 -249
- package/dist/mcp-chunks/{chunk-ZXIF7MKN.js → chunk-IWCVZ46B.js} +2 -2
- package/dist/mcp-chunks/{chunk-RZZO3ZD4.js → chunk-JEHI2YU4.js} +3 -3
- package/dist/mcp-chunks/{chunk-ANNJGB6F.js → chunk-JTPTAO4M.js} +13 -13
- package/dist/mcp-chunks/{chunk-U5QZHPCC.js → chunk-KJ5FPQF6.js} +1 -1
- package/dist/mcp-chunks/{chunk-7IVXKYTI.js → chunk-L2MSWQDL.js} +1 -1
- package/dist/mcp-chunks/{chunk-DBNBEWRX.js → chunk-MEQXX43K.js} +1 -1
- package/dist/mcp-chunks/{chunk-3AAF3FSI.js → chunk-MHUMLEBO.js} +1 -1
- package/dist/mcp-chunks/{chunk-HFHIY5TO.js → chunk-N2U2FODH.js} +4 -4
- package/dist/mcp-chunks/{chunk-YFCNRWLV.js → chunk-N6YUOYDS.js} +2 -2
- package/dist/mcp-chunks/{chunk-C4TJGC4F.js → chunk-O3RTM5HD.js} +1 -1
- package/dist/mcp-chunks/{chunk-35LLRCRA.js → chunk-O7SIXJM6.js} +1308 -912
- package/dist/mcp-chunks/{chunk-QDFL757K.js → chunk-PSE442BC.js} +91 -77
- package/dist/mcp-chunks/{chunk-YPSODIQX.js → chunk-QNXOIF5U.js} +15 -14
- package/dist/mcp-chunks/{chunk-RKQC2EE6.js → chunk-RUF27IUF.js} +2 -2
- package/dist/mcp-chunks/{chunk-SS7V7GVT.js → chunk-S2F7DDP5.js} +4 -4
- package/dist/mcp-chunks/{chunk-D65GOMYV.js → chunk-TC2JPBFB.js} +2 -2
- package/dist/mcp-chunks/{chunk-7BVYBZ4J.js → chunk-THRMUZZD.js} +39 -14
- package/dist/mcp-chunks/{chunk-P5YLK5G2.js → chunk-UFV6SVQG.js} +11 -11
- package/dist/mcp-chunks/{chunk-LISNXOIQ.js → chunk-US63Y6XE.js} +1 -1
- package/dist/mcp-chunks/{chunk-HI6VG5LR.js → chunk-UVRJ3AAD.js} +2 -2
- package/dist/mcp-chunks/{chunk-6TIU2CDB.js → chunk-V42T3QNK.js} +456 -64
- package/dist/mcp-chunks/{chunk-347GOMV4.js → chunk-WDWSA7RL.js} +4 -4
- package/dist/mcp-chunks/{chunk-4PN2J74H.js → chunk-WQL7FJQ3.js} +4 -4
- package/dist/mcp-chunks/{chunk-LRGMFF5S.js → chunk-ZEA3Y5ZD.js} +7 -7
- package/dist/mcp-chunks/{cli-4OQD3H4N.js → cli-IYD7Y7MO.js} +67 -67
- package/dist/mcp-chunks/client-5MNBV3Z7.js +32 -0
- package/dist/mcp-chunks/{config-command-72TCIWPV.js → config-command-6DXILFNO.js} +129 -34
- package/dist/mcp-chunks/daemon-command-V3B3EMXD.js +32 -0
- package/dist/mcp-chunks/{dist-74UCKZK5.js → dist-Q7WSCBBK.js} +74 -55
- package/dist/mcp-chunks/{emit-ts-command-KD4ON2SE.js → emit-ts-command-NDCDFDRM.js} +17 -17
- package/dist/mcp-chunks/{generate-cli-runner-HWGI6HPL.js → generate-cli-runner-PW5WJ7KI.js} +136 -92
- package/dist/mcp-chunks/generated-daemon-runtime-3C4NWGAU.js +32 -0
- package/dist/mcp-chunks/{inspect-cli-command-FT5JSB7V.js → inspect-cli-command-4MGF5CPP.js} +9 -9
- package/dist/mcp-chunks/{launch-AHLKP2VM.js → launch-UG7IH27P.js} +1 -1
- package/dist/mcp-chunks/{lifecycle-BJDITFWN.js → lifecycle-QBYGUHQ3.js} +1 -1
- package/dist/mcp-chunks/{list-command-YKF7RN6Y.js → list-command-SDITI3ZM.js} +36 -35
- package/dist/mcp-chunks/{output-utils-LYB5IJRD.js → output-utils-YTMZTA7J.js} +3 -3
- package/dist/mcp-chunks/{prompt-CH6TK0bC-B3USYOND.js → prompt-DkftHXS7-N7UENQ4C.js} +1 -1
- package/dist/mcp-chunks/{record-command-MJW3Z5E5.js → record-command-JGTMATYI.js} +5 -5
- package/dist/mcp-chunks/{replay-command-5ZHBUOLE.js → replay-command-S2VAC4RW.js} +6 -6
- package/dist/mcp-chunks/{resource-command-L4I24AX5.js → resource-command-SRFQQROJ.js} +9 -9
- package/dist/mcp-chunks/{result-utils-5WRI66KV.js → result-utils-JASGNHXK.js} +3 -3
- package/dist/mcp-chunks/runtime-RMI3XCYJ.js +39 -0
- package/dist/mcp-chunks/{runtime-wrapper-WFMNIHD5.js → runtime-wrapper-7HYO3NM5.js} +3 -3
- package/dist/mcp-chunks/{serve-command-KNCSJUXS.js → serve-command-UF5SVREV.js} +1111 -697
- package/dist/mcp-chunks/{timeouts-2ZHGSB3R.js → timeouts-BJWDJEMH.js} +3 -3
- package/dist/mcp-chunks/{vault-command-7EDL45AA.js → vault-command-EYOIFWEY.js} +5 -4
- package/dist/mcp-chunks/webapi-WMMA3OEC.js +82 -0
- package/dist/mcp-daemon.js +28 -27
- package/dist/mcp-run-worker.js +28 -27
- package/dist/pi-extension.d.ts.map +1 -1
- package/dist/pi-extension.js +6 -0
- package/dist/pi-extension.js.map +1 -1
- package/dist/recipe/package.d.ts +15 -0
- package/dist/recipe/package.d.ts.map +1 -1
- package/dist/recipe/package.js +96 -2
- package/dist/recipe/package.js.map +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +6 -0
- package/dist/session.js.map +1 -1
- package/docs/documents.md +344 -0
- package/docs/index.md +1 -0
- package/docs/interactions.md +76 -8
- package/docs/mcp-configuration.md +10 -5
- package/docs/recipe-format.md +69 -1
- package/documents/SKILL.md +63 -0
- package/package.json +16 -11
- package/dist/mcp-chunks/call-arguments-WSURHOLV.js +0 -16
- package/dist/mcp-chunks/chunk-BIVX2WFX.js +0 -3349
- package/dist/mcp-chunks/client-LXKCCVMT.js +0 -31
- package/dist/mcp-chunks/daemon-command-QHS3ACBM.js +0 -31
- package/dist/mcp-chunks/generated-daemon-runtime-7ORS5KBR.js +0 -31
- package/dist/mcp-chunks/runtime-IKWDQLZF.js +0 -38
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
createKeepAliveRuntime
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HNQSUT44.js";
|
|
5
5
|
import {
|
|
6
6
|
DaemonClient
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GTETFUPQ.js";
|
|
8
8
|
import {
|
|
9
9
|
createRuntime
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-PSE442BC.js";
|
|
11
|
+
import "./chunk-6P3KAQ5N.js";
|
|
12
12
|
import {
|
|
13
13
|
createNonInteractiveElicitationResponder
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-F2X4Y2TQ.js";
|
|
15
|
+
import "./chunk-2AKSS7WR.js";
|
|
16
|
+
import "./chunk-2YV72LUA.js";
|
|
17
|
+
import "./chunk-THRMUZZD.js";
|
|
18
|
+
import "./chunk-V42T3QNK.js";
|
|
19
|
+
import "./chunk-O3RTM5HD.js";
|
|
20
|
+
import "./chunk-3ETUDW7N.js";
|
|
21
21
|
import {
|
|
22
22
|
MCPORTER_VERSION
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-QNXOIF5U.js";
|
|
24
|
+
import "./chunk-6O42UGLI.js";
|
|
25
|
+
import "./chunk-CXST5CVH.js";
|
|
26
|
+
import "./chunk-7U5NSQ5T.js";
|
|
27
|
+
import "./chunk-3LENTPGE.js";
|
|
28
|
+
import "./chunk-JEHI2YU4.js";
|
|
29
|
+
import "./chunk-IWCVZ46B.js";
|
|
30
30
|
import "./chunk-T4MQCFIK.js";
|
|
31
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-BHXCAVFP.js";
|
|
32
32
|
import {
|
|
33
33
|
isKeepAliveServer
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
34
|
+
} from "./chunk-MHUMLEBO.js";
|
|
35
|
+
import "./chunk-IRSL7JRH.js";
|
|
36
|
+
import "./chunk-UVRJ3AAD.js";
|
|
37
|
+
import "./chunk-O7SIXJM6.js";
|
|
37
38
|
import {
|
|
38
39
|
__export
|
|
39
40
|
} from "./chunk-LRKZP7DJ.js";
|
|
40
41
|
|
|
41
|
-
// node_modules/.pnpm/mcporter@0.
|
|
42
|
+
// node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/dist/serve.js
|
|
42
43
|
import http from "node:http";
|
|
43
44
|
import { Readable } from "node:stream";
|
|
44
45
|
import { pipeline } from "node:stream/promises";
|
|
45
46
|
|
|
46
|
-
// node_modules/.pnpm/@modelcontextprotocol+server@2.
|
|
47
|
+
// node_modules/.pnpm/@modelcontextprotocol+server@2.4.0/node_modules/@modelcontextprotocol/server/dist/chunk-vYduTEsO.mjs
|
|
47
48
|
var __create = Object.create;
|
|
48
49
|
var __defProp = Object.defineProperty;
|
|
49
50
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -83,7 +84,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
83
84
|
enumerable: true
|
|
84
85
|
}) : target, mod));
|
|
85
86
|
|
|
86
|
-
// node_modules/.pnpm/@modelcontextprotocol+server@2.
|
|
87
|
+
// node_modules/.pnpm/@modelcontextprotocol+server@2.4.0/node_modules/@modelcontextprotocol/server/dist/dialects-CDpMbily.mjs
|
|
87
88
|
var DRAFT_2020_12_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2020-12/schema", "http://json-schema.org/draft/2020-12/schema"]);
|
|
88
89
|
var DRAFT_2019_09_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2019-09/schema", "http://json-schema.org/draft/2019-09/schema"]);
|
|
89
90
|
var DRAFT_07_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft-07/schema", "http://json-schema.org/draft-07/schema"]);
|
|
@@ -6939,7 +6940,7 @@ function date3(params) {
|
|
|
6939
6940
|
return _coercedDate(ZodDate, params);
|
|
6940
6941
|
}
|
|
6941
6942
|
|
|
6942
|
-
// node_modules/.pnpm/@modelcontextprotocol+core@2.
|
|
6943
|
+
// node_modules/.pnpm/@modelcontextprotocol+core@2.4.0/node_modules/@modelcontextprotocol/core/dist/schemas-DscsoNZN.mjs
|
|
6943
6944
|
var LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
6944
6945
|
var DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-03-26";
|
|
6945
6946
|
var SUPPORTED_PROTOCOL_VERSIONS = [
|
|
@@ -7728,6 +7729,8 @@ var ServerResultSchema = union([
|
|
|
7728
7729
|
ListToolsResultSchema,
|
|
7729
7730
|
SubscriptionsListenResultSchema
|
|
7730
7731
|
]);
|
|
7732
|
+
|
|
7733
|
+
// node_modules/.pnpm/@modelcontextprotocol+core@2.4.0/node_modules/@modelcontextprotocol/core/dist/auth-UMQCo-ad.mjs
|
|
7731
7734
|
var SafeUrlSchema = url().superRefine((val, ctx) => {
|
|
7732
7735
|
if (!URL.canParse(val)) {
|
|
7733
7736
|
ctx.addIssue({
|
|
@@ -7881,7 +7884,7 @@ var OAuthTokenRevocationRequestSchema = object({
|
|
|
7881
7884
|
token_type_hint: string2().optional()
|
|
7882
7885
|
}).strip();
|
|
7883
7886
|
|
|
7884
|
-
// node_modules/.pnpm/@modelcontextprotocol+server@2.
|
|
7887
|
+
// node_modules/.pnpm/@modelcontextprotocol+server@2.4.0/node_modules/@modelcontextprotocol/server/dist/src-DdvbAHrR.mjs
|
|
7885
7888
|
var BRANDS = /* @__PURE__ */ Symbol.for("mcp.sdk.errorBrands");
|
|
7886
7889
|
function stampErrorBrands(instance, ctor) {
|
|
7887
7890
|
const brands = /* @__PURE__ */ new Set();
|
|
@@ -10869,12 +10872,12 @@ var RFC9110_TOKEN = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
|
10869
10872
|
var PERMITTED_X_MCP_HEADER_TYPES = /* @__PURE__ */ new Set([
|
|
10870
10873
|
"string",
|
|
10871
10874
|
"integer",
|
|
10872
|
-
"boolean"
|
|
10873
|
-
"number"
|
|
10875
|
+
"boolean"
|
|
10874
10876
|
]);
|
|
10875
10877
|
function scanXMcpHeaderDeclarations(inputSchema) {
|
|
10876
10878
|
const declarations = [];
|
|
10877
10879
|
const seenLower = /* @__PURE__ */ new Map();
|
|
10880
|
+
let numberFault;
|
|
10878
10881
|
const visit = (node2, path, reachable) => {
|
|
10879
10882
|
if (node2 === null || typeof node2 !== "object") return void 0;
|
|
10880
10883
|
const schema = node2;
|
|
@@ -10884,7 +10887,11 @@ function scanXMcpHeaderDeclarations(inputSchema) {
|
|
|
10884
10887
|
if (typeof raw !== "string" || raw.length === 0) return `${pathName(path)}: x-mcp-header MUST be a non-empty string`;
|
|
10885
10888
|
if (!RFC9110_TOKEN.test(raw)) return `${pathName(path)}: x-mcp-header '${raw}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;
|
|
10886
10889
|
const type = typeof schema.type === "string" ? schema.type : void 0;
|
|
10887
|
-
if (type === void 0 || !PERMITTED_X_MCP_HEADER_TYPES.has(type))
|
|
10890
|
+
if (type === void 0 || !PERMITTED_X_MCP_HEADER_TYPES.has(type)) {
|
|
10891
|
+
const fault$1 = `${pathName(path)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${type ?? "<none>"}`;
|
|
10892
|
+
if (type !== "number") return fault$1;
|
|
10893
|
+
numberFault ??= fault$1;
|
|
10894
|
+
}
|
|
10888
10895
|
const lower = raw.toLowerCase();
|
|
10889
10896
|
const prior = seenLower.get(lower);
|
|
10890
10897
|
if (prior !== void 0) return `x-mcp-header '${raw}' is not case-insensitively unique (also declared as '${prior}')`;
|
|
@@ -10911,12 +10918,17 @@ function scanXMcpHeaderDeclarations(inputSchema) {
|
|
|
10911
10918
|
}
|
|
10912
10919
|
};
|
|
10913
10920
|
const fault = visit(inputSchema, [], true);
|
|
10914
|
-
|
|
10921
|
+
if (fault !== void 0) return {
|
|
10922
|
+
valid: false,
|
|
10923
|
+
reason: numberFault ?? fault
|
|
10924
|
+
};
|
|
10925
|
+
return numberFault === void 0 ? {
|
|
10915
10926
|
valid: true,
|
|
10916
10927
|
declarations
|
|
10917
10928
|
} : {
|
|
10918
10929
|
valid: false,
|
|
10919
|
-
reason:
|
|
10930
|
+
reason: numberFault,
|
|
10931
|
+
declarations
|
|
10920
10932
|
};
|
|
10921
10933
|
}
|
|
10922
10934
|
var NON_REACHABLE_SUBSCHEMA_KEYWORDS = [
|
|
@@ -11370,15 +11382,18 @@ function standardSchemaToJsonSchema(schema, io = "input") {
|
|
|
11370
11382
|
...result
|
|
11371
11383
|
};
|
|
11372
11384
|
}
|
|
11373
|
-
|
|
11385
|
+
var LOCAL_DEFINITION_REF = /^#\/(\$defs|definitions)\/([^/~%]+)$/;
|
|
11386
|
+
function isProvablyObjectShapedRoot(schema, root = schema) {
|
|
11374
11387
|
if ("properties" in schema || "patternProperties" in schema || "additionalProperties" in schema || "required" in schema) return true;
|
|
11388
|
+
const ref = typeof schema.$ref === "string" && LOCAL_DEFINITION_REF.exec(schema.$ref);
|
|
11389
|
+
if (ref && root[ref[1]]?.[ref[2]]?.type === "object") return true;
|
|
11375
11390
|
for (const key of [
|
|
11376
11391
|
"oneOf",
|
|
11377
11392
|
"anyOf",
|
|
11378
11393
|
"allOf"
|
|
11379
11394
|
]) {
|
|
11380
11395
|
const members2 = schema[key];
|
|
11381
|
-
if (Array.isArray(members2) && members2.length > 0) return members2.every((m) => m !== null && typeof m === "object" && (m.type === "object" || isProvablyObjectShapedRoot(m)));
|
|
11396
|
+
if (Array.isArray(members2) && members2.length > 0) return members2.every((m) => m !== null && typeof m === "object" && (m.type === "object" || isProvablyObjectShapedRoot(m, "$id" in m ? {} : root)));
|
|
11382
11397
|
}
|
|
11383
11398
|
return false;
|
|
11384
11399
|
}
|
|
@@ -12836,7 +12851,7 @@ function normalizeRawShapeSchema(schema) {
|
|
|
12836
12851
|
return schema;
|
|
12837
12852
|
}
|
|
12838
12853
|
|
|
12839
|
-
// node_modules/.pnpm/@modelcontextprotocol+server@2.
|
|
12854
|
+
// node_modules/.pnpm/@modelcontextprotocol+server@2.4.0/node_modules/@modelcontextprotocol/server/dist/ajvProvider-DyjnscPj.mjs
|
|
12840
12855
|
var require_code$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
12841
12856
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12842
12857
|
exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
|
|
@@ -15518,6 +15533,22 @@ var require_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15518
15533
|
var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15519
15534
|
const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
15520
15535
|
const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
15536
|
+
const isPort = RegExp.prototype.test.bind(/^\d*$/u);
|
|
15537
|
+
const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
15538
|
+
const isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
15539
|
+
const isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
|
|
15540
|
+
const isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
|
|
15541
|
+
const isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
|
|
15542
|
+
const BYTE_HEX = new Array(256);
|
|
15543
|
+
{
|
|
15544
|
+
const HEX_DIGITS = "0123456789ABCDEF";
|
|
15545
|
+
for (let i = 0; i < 256; i++) BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
|
|
15546
|
+
}
|
|
15547
|
+
function percentEncodeNonAscii(cp) {
|
|
15548
|
+
if (cp < 2048) return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
|
|
15549
|
+
if (cp < 65536) return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
15550
|
+
return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
15551
|
+
}
|
|
15521
15552
|
function stringArrayToHexStripped(input) {
|
|
15522
15553
|
let acc = "";
|
|
15523
15554
|
let code = 0;
|
|
@@ -15536,83 +15567,120 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15536
15567
|
}
|
|
15537
15568
|
return acc;
|
|
15538
15569
|
}
|
|
15570
|
+
const isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
|
|
15571
|
+
const isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
|
|
15572
|
+
const isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
|
|
15539
15573
|
const nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
15540
|
-
function
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
if (hex !== "") address.push(hex);
|
|
15548
|
-
else {
|
|
15549
|
-
output.error = true;
|
|
15550
|
-
return false;
|
|
15574
|
+
function isZoneIdentifier(zone) {
|
|
15575
|
+
if (zone.length === 0) return false;
|
|
15576
|
+
for (let i = 0; i < zone.length; i++) {
|
|
15577
|
+
if (isZoneCharacter(zone[i])) continue;
|
|
15578
|
+
if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
|
|
15579
|
+
i += 2;
|
|
15580
|
+
continue;
|
|
15551
15581
|
}
|
|
15552
|
-
|
|
15582
|
+
return false;
|
|
15553
15583
|
}
|
|
15554
15584
|
return true;
|
|
15555
15585
|
}
|
|
15556
|
-
function
|
|
15557
|
-
let
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
|
|
15572
|
-
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
|
|
15577
|
-
|
|
15578
|
-
|
|
15579
|
-
|
|
15580
|
-
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15584
|
-
|
|
15585
|
-
|
|
15586
|
+
function compressIPv6ZeroRun(hextets) {
|
|
15587
|
+
let bestStart = -1;
|
|
15588
|
+
let bestLength = 0;
|
|
15589
|
+
let runStart = -1;
|
|
15590
|
+
let runLength = 0;
|
|
15591
|
+
for (let i = 0; i < hextets.length; i++) if (hextets[i] === "0") {
|
|
15592
|
+
if (runStart === -1) runStart = i;
|
|
15593
|
+
runLength++;
|
|
15594
|
+
if (runLength > bestLength) {
|
|
15595
|
+
bestLength = runLength;
|
|
15596
|
+
bestStart = runStart;
|
|
15597
|
+
}
|
|
15598
|
+
} else {
|
|
15599
|
+
runStart = -1;
|
|
15600
|
+
runLength = 0;
|
|
15601
|
+
}
|
|
15602
|
+
if (bestLength < 2) return hextets.join(":");
|
|
15603
|
+
const head = hextets.slice(0, bestStart).join(":");
|
|
15604
|
+
const tail = hextets.slice(bestStart + bestLength).join(":");
|
|
15605
|
+
return head + "::" + tail;
|
|
15606
|
+
}
|
|
15607
|
+
function normalizeIPv6Address(input) {
|
|
15608
|
+
const compression = input.indexOf("::");
|
|
15609
|
+
if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
|
|
15610
|
+
const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
|
|
15611
|
+
const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
|
|
15612
|
+
if (compression !== -1) {
|
|
15613
|
+
if (left.length === 1 && left[0] === "") left.length = 0;
|
|
15614
|
+
if (right.length === 1 && right[0] === "") right.length = 0;
|
|
15615
|
+
}
|
|
15616
|
+
const parts = left.concat(right);
|
|
15617
|
+
let hextetCount = 0;
|
|
15618
|
+
for (let i = 0; i < parts.length; i++) {
|
|
15619
|
+
const part = parts[i];
|
|
15620
|
+
if (part === "") return void 0;
|
|
15621
|
+
if (part.indexOf(".") !== -1) {
|
|
15622
|
+
if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
|
|
15623
|
+
hextetCount += 2;
|
|
15586
15624
|
continue;
|
|
15587
15625
|
}
|
|
15626
|
+
if (!isHextet(part)) return void 0;
|
|
15627
|
+
parts[i] = parseInt(part, 16).toString(16);
|
|
15628
|
+
hextetCount++;
|
|
15588
15629
|
}
|
|
15589
|
-
if (
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
return
|
|
15630
|
+
if (compression === -1) {
|
|
15631
|
+
if (hextetCount !== 8) return void 0;
|
|
15632
|
+
return compressIPv6ZeroRun(parts);
|
|
15633
|
+
}
|
|
15634
|
+
if (hextetCount >= 8) return void 0;
|
|
15635
|
+
const expanded = parts.slice(0, left.length);
|
|
15636
|
+
for (let i = hextetCount; i < 8; i++) expanded.push("0");
|
|
15637
|
+
for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
|
|
15638
|
+
return compressIPv6ZeroRun(expanded);
|
|
15594
15639
|
}
|
|
15595
15640
|
function normalizeIPv6(host) {
|
|
15596
|
-
|
|
15641
|
+
const bracketed = host[0] === "[" && host[host.length - 1] === "]";
|
|
15642
|
+
if ((host[0] === "[" || host[host.length - 1] === "]") && !bracketed) return {
|
|
15597
15643
|
host,
|
|
15598
|
-
isIPV6: false
|
|
15644
|
+
isIPV6: false,
|
|
15645
|
+
error: true
|
|
15599
15646
|
};
|
|
15600
|
-
|
|
15601
|
-
if (
|
|
15602
|
-
|
|
15603
|
-
let escapedHost = ipv62.address;
|
|
15604
|
-
if (ipv62.zone) {
|
|
15605
|
-
newHost += "%" + ipv62.zone;
|
|
15606
|
-
escapedHost += "%25" + ipv62.zone;
|
|
15607
|
-
}
|
|
15647
|
+
let input = bracketed ? host.slice(1, -1) : host;
|
|
15648
|
+
if (bracketed && isIPvFuture(input)) {
|
|
15649
|
+
input = input.toLowerCase();
|
|
15608
15650
|
return {
|
|
15609
|
-
host:
|
|
15610
|
-
|
|
15611
|
-
|
|
15651
|
+
host: `[${input}]`,
|
|
15652
|
+
escapedHost: input,
|
|
15653
|
+
isIPV6: false,
|
|
15654
|
+
isIPVFuture: true
|
|
15655
|
+
};
|
|
15656
|
+
}
|
|
15657
|
+
if (findToken(input, ":") < 2) return {
|
|
15658
|
+
host,
|
|
15659
|
+
isIPV6: false,
|
|
15660
|
+
error: bracketed
|
|
15661
|
+
};
|
|
15662
|
+
let zoneIdentifier = "";
|
|
15663
|
+
const zoneSeparator = input.indexOf("%");
|
|
15664
|
+
if (zoneSeparator !== -1) {
|
|
15665
|
+
const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
|
|
15666
|
+
zoneIdentifier = input.slice(zoneSeparator + separatorLength);
|
|
15667
|
+
if (!isZoneIdentifier(zoneIdentifier)) return {
|
|
15668
|
+
host,
|
|
15669
|
+
isIPV6: false,
|
|
15670
|
+
error: true
|
|
15612
15671
|
};
|
|
15613
|
-
|
|
15672
|
+
input = input.slice(0, zoneSeparator);
|
|
15673
|
+
}
|
|
15674
|
+
const address = normalizeIPv6Address(input);
|
|
15675
|
+
if (address === void 0) return {
|
|
15614
15676
|
host,
|
|
15615
|
-
isIPV6: false
|
|
15677
|
+
isIPV6: false,
|
|
15678
|
+
error: true
|
|
15679
|
+
};
|
|
15680
|
+
return {
|
|
15681
|
+
host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
|
|
15682
|
+
escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
|
|
15683
|
+
isIPV6: true
|
|
15616
15684
|
};
|
|
15617
15685
|
}
|
|
15618
15686
|
function findToken(str, token) {
|
|
@@ -15688,41 +15756,225 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15688
15756
|
}
|
|
15689
15757
|
return output.join("");
|
|
15690
15758
|
}
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
15759
|
+
const HOST_DELIMS = {
|
|
15760
|
+
"@": "%40",
|
|
15761
|
+
"/": "%2F",
|
|
15762
|
+
"?": "%3F",
|
|
15763
|
+
"#": "%23",
|
|
15764
|
+
":": "%3A"
|
|
15765
|
+
};
|
|
15766
|
+
const HOST_DELIM_RE = /[@/?#:]/g;
|
|
15767
|
+
const HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
|
|
15768
|
+
function reescapeHostDelimiters(host, isIP) {
|
|
15769
|
+
const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
|
|
15770
|
+
re.lastIndex = 0;
|
|
15771
|
+
return host.replace(re, (ch) => HOST_DELIMS[ch]);
|
|
15772
|
+
}
|
|
15773
|
+
function normalizePercentEncoding(input, decodeUnreserved = false) {
|
|
15774
|
+
if (input.indexOf("%") === -1) return input;
|
|
15775
|
+
let output = "";
|
|
15776
|
+
for (let i = 0; i < input.length; i++) {
|
|
15777
|
+
if (input[i] === "%" && i + 2 < input.length) {
|
|
15778
|
+
const hex = input.slice(i + 1, i + 3);
|
|
15779
|
+
if (isHexPair(hex)) {
|
|
15780
|
+
const normalizedHex = hex.toUpperCase();
|
|
15781
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
15782
|
+
if (decodeUnreserved && isUnreserved(decoded)) output += decoded;
|
|
15783
|
+
else output += "%" + normalizedHex;
|
|
15784
|
+
i += 2;
|
|
15785
|
+
continue;
|
|
15786
|
+
}
|
|
15787
|
+
}
|
|
15788
|
+
output += input[i];
|
|
15789
|
+
}
|
|
15790
|
+
return output;
|
|
15791
|
+
}
|
|
15792
|
+
function normalizePathEncoding(input) {
|
|
15793
|
+
let output = "";
|
|
15794
|
+
for (let i = 0; i < input.length; i++) {
|
|
15795
|
+
const ch = input[i];
|
|
15796
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
15797
|
+
const hex = input.slice(i + 1, i + 3);
|
|
15798
|
+
if (isHexPair(hex)) {
|
|
15799
|
+
const normalizedHex = hex.toUpperCase();
|
|
15800
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
15801
|
+
if (decoded !== "." && isUnreserved(decoded)) output += decoded;
|
|
15802
|
+
else output += "%" + normalizedHex;
|
|
15803
|
+
i += 2;
|
|
15804
|
+
continue;
|
|
15805
|
+
}
|
|
15806
|
+
}
|
|
15807
|
+
if (isPathCharacter(ch)) output += ch;
|
|
15808
|
+
else {
|
|
15809
|
+
const code = input.charCodeAt(i);
|
|
15810
|
+
if (code < 128) output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
|
|
15811
|
+
else if (code < 55296 || code > 57343) output += percentEncodeNonAscii(code);
|
|
15812
|
+
else if (code <= 56319 && i + 1 < input.length) {
|
|
15813
|
+
const low = input.charCodeAt(i + 1);
|
|
15814
|
+
if (low >= 56320 && low <= 57343) {
|
|
15815
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
15816
|
+
i++;
|
|
15817
|
+
} else output += percentEncodeNonAscii(65533);
|
|
15818
|
+
} else output += percentEncodeNonAscii(65533);
|
|
15819
|
+
}
|
|
15820
|
+
}
|
|
15821
|
+
return output;
|
|
15822
|
+
}
|
|
15823
|
+
function serializePathEncoding(input, pathNoScheme = false) {
|
|
15824
|
+
let output = "";
|
|
15825
|
+
let firstSegment = pathNoScheme && input[0] !== "/";
|
|
15826
|
+
for (let i = 0; i < input.length; i++) {
|
|
15827
|
+
const ch = input[i];
|
|
15828
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
15829
|
+
const hex = input.slice(i + 1, i + 3);
|
|
15830
|
+
if (isHexPair(hex)) {
|
|
15831
|
+
output += "%" + hex.toUpperCase();
|
|
15832
|
+
i += 2;
|
|
15833
|
+
continue;
|
|
15834
|
+
}
|
|
15835
|
+
}
|
|
15836
|
+
if (ch === "/") firstSegment = false;
|
|
15837
|
+
if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) output += ch;
|
|
15838
|
+
else {
|
|
15839
|
+
const code = input.charCodeAt(i);
|
|
15840
|
+
if (code < 128) output += BYTE_HEX[code];
|
|
15841
|
+
else if (code < 55296 || code > 57343) output += percentEncodeNonAscii(code);
|
|
15842
|
+
else if (code <= 56319 && i + 1 < input.length) {
|
|
15843
|
+
const low = input.charCodeAt(i + 1);
|
|
15844
|
+
if (low >= 56320 && low <= 57343) {
|
|
15845
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
15846
|
+
i++;
|
|
15847
|
+
} else output += percentEncodeNonAscii(65533);
|
|
15848
|
+
} else output += percentEncodeNonAscii(65533);
|
|
15849
|
+
}
|
|
15850
|
+
}
|
|
15851
|
+
return output;
|
|
15852
|
+
}
|
|
15853
|
+
function encodeComponent(input, isAllowed) {
|
|
15854
|
+
let output = "";
|
|
15855
|
+
for (let i = 0; i < input.length; i++) {
|
|
15856
|
+
const ch = input[i];
|
|
15857
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
15858
|
+
const hex = input.slice(i + 1, i + 3);
|
|
15859
|
+
if (isHexPair(hex)) {
|
|
15860
|
+
output += "%" + hex.toUpperCase();
|
|
15861
|
+
i += 2;
|
|
15862
|
+
continue;
|
|
15863
|
+
}
|
|
15864
|
+
}
|
|
15865
|
+
if (isAllowed(ch)) output += ch;
|
|
15866
|
+
else {
|
|
15867
|
+
const code = input.charCodeAt(i);
|
|
15868
|
+
if (code < 128) output += BYTE_HEX[code];
|
|
15869
|
+
else if (code < 55296 || code > 57343) output += percentEncodeNonAscii(code);
|
|
15870
|
+
else if (code <= 56319 && i + 1 < input.length) {
|
|
15871
|
+
const low = input.charCodeAt(i + 1);
|
|
15872
|
+
if (low >= 56320 && low <= 57343) {
|
|
15873
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
15874
|
+
i++;
|
|
15875
|
+
} else output += percentEncodeNonAscii(65533);
|
|
15876
|
+
} else output += percentEncodeNonAscii(65533);
|
|
15877
|
+
}
|
|
15878
|
+
}
|
|
15879
|
+
return output;
|
|
15880
|
+
}
|
|
15881
|
+
function encodeUserinfo(input) {
|
|
15882
|
+
return encodeComponent(input, isUserinfoCharacter);
|
|
15883
|
+
}
|
|
15884
|
+
function encodeQuery(input) {
|
|
15885
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
15886
|
+
}
|
|
15887
|
+
function encodeFragment(input) {
|
|
15888
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
15889
|
+
}
|
|
15890
|
+
function isEscapeSafe(cp) {
|
|
15891
|
+
return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95;
|
|
15892
|
+
}
|
|
15893
|
+
function normalizeQueryFragmentEncoding(input) {
|
|
15894
|
+
let output = "";
|
|
15895
|
+
for (let i = 0; i < input.length; i++) {
|
|
15896
|
+
const ch = input[i];
|
|
15897
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
15898
|
+
const hex = input.slice(i + 1, i + 3);
|
|
15899
|
+
if (isHexPair(hex)) {
|
|
15900
|
+
const normalizedHex = hex.toUpperCase();
|
|
15901
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
15902
|
+
if (isUnreserved(decoded)) output += decoded;
|
|
15903
|
+
else output += "%" + normalizedHex;
|
|
15904
|
+
i += 2;
|
|
15905
|
+
continue;
|
|
15906
|
+
}
|
|
15907
|
+
}
|
|
15908
|
+
if (isQueryFragmentCharacter(ch)) output += ch;
|
|
15909
|
+
else {
|
|
15910
|
+
const code = input.charCodeAt(i);
|
|
15911
|
+
if (code < 128) output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
|
|
15912
|
+
else if (code < 55296 || code > 57343) output += percentEncodeNonAscii(code);
|
|
15913
|
+
else if (code <= 56319 && i + 1 < input.length) {
|
|
15914
|
+
const low = input.charCodeAt(i + 1);
|
|
15915
|
+
if (low >= 56320 && low <= 57343) {
|
|
15916
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
15917
|
+
i++;
|
|
15918
|
+
} else output += percentEncodeNonAscii(65533);
|
|
15919
|
+
} else output += percentEncodeNonAscii(65533);
|
|
15920
|
+
}
|
|
15921
|
+
}
|
|
15922
|
+
return output;
|
|
15923
|
+
}
|
|
15924
|
+
function escapePreservingEscapes(input) {
|
|
15925
|
+
let output = "";
|
|
15926
|
+
for (let i = 0; i < input.length; i++) {
|
|
15927
|
+
if (input[i] === "%" && i + 2 < input.length) {
|
|
15928
|
+
const hex = input.slice(i + 1, i + 3);
|
|
15929
|
+
if (isHexPair(hex)) {
|
|
15930
|
+
output += "%" + hex.toUpperCase();
|
|
15931
|
+
i += 2;
|
|
15932
|
+
continue;
|
|
15933
|
+
}
|
|
15934
|
+
}
|
|
15935
|
+
output += escape(input[i]);
|
|
15936
|
+
}
|
|
15937
|
+
return output;
|
|
15700
15938
|
}
|
|
15701
15939
|
function recomposeAuthority(component) {
|
|
15702
15940
|
const uriTokens = [];
|
|
15703
15941
|
if (component.userinfo !== void 0) {
|
|
15704
|
-
uriTokens.push(component.userinfo);
|
|
15942
|
+
uriTokens.push(encodeUserinfo(component.userinfo));
|
|
15705
15943
|
uriTokens.push("@");
|
|
15706
15944
|
}
|
|
15707
15945
|
if (component.host !== void 0) {
|
|
15708
|
-
let host =
|
|
15946
|
+
let host = component.host;
|
|
15709
15947
|
if (!isIPv4(host)) {
|
|
15710
|
-
|
|
15711
|
-
if (ipV6res.isIPV6
|
|
15712
|
-
|
|
15948
|
+
let ipV6res = normalizeIPv6(host);
|
|
15949
|
+
if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
|
|
15950
|
+
host = normalizePercentEncoding(host, true);
|
|
15951
|
+
ipV6res = normalizeIPv6(host);
|
|
15952
|
+
}
|
|
15953
|
+
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) host = `[${ipV6res.escapedHost}]`;
|
|
15954
|
+
else host = reescapeHostDelimiters(host, false);
|
|
15713
15955
|
}
|
|
15714
15956
|
uriTokens.push(host);
|
|
15715
15957
|
}
|
|
15716
15958
|
if (typeof component.port === "number" || typeof component.port === "string") {
|
|
15959
|
+
const port = String(component.port);
|
|
15960
|
+
if (!isPort(port)) throw new TypeError("URI port is malformed.");
|
|
15717
15961
|
uriTokens.push(":");
|
|
15718
|
-
uriTokens.push(
|
|
15962
|
+
uriTokens.push(port);
|
|
15719
15963
|
}
|
|
15720
15964
|
return uriTokens.length ? uriTokens.join("") : void 0;
|
|
15721
15965
|
}
|
|
15722
15966
|
module.exports = {
|
|
15723
15967
|
nonSimpleDomain,
|
|
15724
15968
|
recomposeAuthority,
|
|
15725
|
-
|
|
15969
|
+
reescapeHostDelimiters,
|
|
15970
|
+
normalizePercentEncoding,
|
|
15971
|
+
normalizePathEncoding,
|
|
15972
|
+
serializePathEncoding,
|
|
15973
|
+
normalizeQueryFragmentEncoding,
|
|
15974
|
+
encodeUserinfo,
|
|
15975
|
+
encodeQuery,
|
|
15976
|
+
encodeFragment,
|
|
15977
|
+
escapePreservingEscapes,
|
|
15726
15978
|
removeDotSegments,
|
|
15727
15979
|
isIPv4,
|
|
15728
15980
|
isUUID,
|
|
@@ -15732,7 +15984,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15732
15984
|
}));
|
|
15733
15985
|
var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15734
15986
|
const { isUUID } = require_utils();
|
|
15735
|
-
const URN_REG =
|
|
15987
|
+
const URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
|
|
15736
15988
|
const supportedSchemeNames = [
|
|
15737
15989
|
"http",
|
|
15738
15990
|
"https",
|
|
@@ -15774,9 +16026,10 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15774
16026
|
wsComponent.secure = void 0;
|
|
15775
16027
|
}
|
|
15776
16028
|
if (wsComponent.resourceName) {
|
|
15777
|
-
const
|
|
16029
|
+
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
16030
|
+
const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
15778
16031
|
wsComponent.path = path && path !== "/" ? path : void 0;
|
|
15779
|
-
wsComponent.query =
|
|
16032
|
+
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
15780
16033
|
wsComponent.resourceName = void 0;
|
|
15781
16034
|
}
|
|
15782
16035
|
wsComponent.fragment = void 0;
|
|
@@ -15788,7 +16041,7 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15788
16041
|
return urnComponent;
|
|
15789
16042
|
}
|
|
15790
16043
|
const matches = urnComponent.path.match(URN_REG);
|
|
15791
|
-
if (matches) {
|
|
16044
|
+
if (matches && matches[0] === urnComponent.path) {
|
|
15792
16045
|
const scheme = options.scheme || urnComponent.scheme || "urn";
|
|
15793
16046
|
urnComponent.nid = matches[1].toLowerCase();
|
|
15794
16047
|
urnComponent.nss = matches[2];
|
|
@@ -15878,16 +16131,32 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15878
16131
|
};
|
|
15879
16132
|
}));
|
|
15880
16133
|
var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15881
|
-
const { normalizeIPv6, removeDotSegments, recomposeAuthority,
|
|
16134
|
+
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
15882
16135
|
const { SCHEMES, getSchemeHandler } = require_schemes();
|
|
16136
|
+
const VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
16137
|
+
const MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
16138
|
+
function decodeValidScheme(scheme) {
|
|
16139
|
+
const decodedScheme = unescape(String(scheme));
|
|
16140
|
+
if (!VALID_SCHEME.test(decodedScheme)) throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
16141
|
+
return decodedScheme;
|
|
16142
|
+
}
|
|
15883
16143
|
function normalize(uri, options) {
|
|
15884
|
-
if (typeof uri === "string") uri =
|
|
16144
|
+
if (typeof uri === "string") uri = normalizeString(uri, options);
|
|
15885
16145
|
else if (typeof uri === "object") uri = parse2(serialize(uri, options), options);
|
|
15886
16146
|
return uri;
|
|
15887
16147
|
}
|
|
15888
16148
|
function resolve(baseURI, relativeURI, options) {
|
|
15889
16149
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
15890
|
-
const
|
|
16150
|
+
const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed, malformedPercentEncoding: baseMalformedPercentEncoding, malformedSchemeSpecific: baseMalformedSchemeSpecific, malformedHost: baseMalformedHost, malformedScheme: baseMalformedScheme } = parseWithStatus(baseURI, schemelessOptions);
|
|
16151
|
+
const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed, malformedPercentEncoding: relativeMalformedPercentEncoding, malformedSchemeSpecific: relativeMalformedSchemeSpecific, malformedHost: relativeMalformedHost, malformedScheme: relativeMalformedScheme } = parseWithStatus(relativeURI, schemelessOptions);
|
|
16152
|
+
if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
16153
|
+
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
16154
|
+
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
16155
|
+
const resolvedHost = resolved.host;
|
|
16156
|
+
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
16157
|
+
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
16158
|
+
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
|
|
16159
|
+
if (resolved.error && !encodedASCIIHost) throw new Error(resolved.error);
|
|
15891
16160
|
schemelessOptions.skipEscape = true;
|
|
15892
16161
|
return serialize(resolved, schemelessOptions);
|
|
15893
16162
|
}
|
|
@@ -15937,27 +16206,9 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15937
16206
|
return target;
|
|
15938
16207
|
}
|
|
15939
16208
|
function equal(uriA, uriB, options) {
|
|
15940
|
-
|
|
15941
|
-
|
|
15942
|
-
|
|
15943
|
-
...options,
|
|
15944
|
-
skipEscape: true
|
|
15945
|
-
});
|
|
15946
|
-
} else if (typeof uriA === "object") uriA = serialize(normalizeComponentEncoding(uriA, true), {
|
|
15947
|
-
...options,
|
|
15948
|
-
skipEscape: true
|
|
15949
|
-
});
|
|
15950
|
-
if (typeof uriB === "string") {
|
|
15951
|
-
uriB = unescape(uriB);
|
|
15952
|
-
uriB = serialize(normalizeComponentEncoding(parse2(uriB, options), true), {
|
|
15953
|
-
...options,
|
|
15954
|
-
skipEscape: true
|
|
15955
|
-
});
|
|
15956
|
-
} else if (typeof uriB === "object") uriB = serialize(normalizeComponentEncoding(uriB, true), {
|
|
15957
|
-
...options,
|
|
15958
|
-
skipEscape: true
|
|
15959
|
-
});
|
|
15960
|
-
return uriA.toLowerCase() === uriB.toLowerCase();
|
|
16209
|
+
const normalizedA = normalizeComparableURI(uriA, options);
|
|
16210
|
+
const normalizedB = normalizeComparableURI(uriB, options);
|
|
16211
|
+
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
|
|
15961
16212
|
}
|
|
15962
16213
|
function serialize(cmpts, opts) {
|
|
15963
16214
|
const component = {
|
|
@@ -15978,13 +16229,17 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15978
16229
|
};
|
|
15979
16230
|
const options = Object.assign({}, opts);
|
|
15980
16231
|
const uriTokens = [];
|
|
16232
|
+
if (component.scheme) component.scheme = decodeValidScheme(component.scheme);
|
|
15981
16233
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
15982
16234
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
|
|
15987
|
-
if (options.reference !== "suffix" && component.scheme)
|
|
16235
|
+
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
16236
|
+
const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
|
|
16237
|
+
if (component.path !== void 0) if (!options.skipEscape) component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
16238
|
+
else component.path = normalizePercentEncoding(component.path);
|
|
16239
|
+
if (options.reference !== "suffix" && component.scheme) {
|
|
16240
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
16241
|
+
uriTokens.push(component.scheme, ":");
|
|
16242
|
+
}
|
|
15988
16243
|
const authority = recomposeAuthority(component);
|
|
15989
16244
|
if (authority !== void 0) {
|
|
15990
16245
|
if (options.reference !== "suffix") uriTokens.push("//");
|
|
@@ -15994,15 +16249,47 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15994
16249
|
if (component.path !== void 0) {
|
|
15995
16250
|
let s = component.path;
|
|
15996
16251
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) s = removeDotSegments(s);
|
|
16252
|
+
if (pathNoScheme) s = serializePathEncoding(s, true);
|
|
15997
16253
|
if (authority === void 0 && s[0] === "/" && s[1] === "/") s = "/%2F" + s.slice(2);
|
|
15998
16254
|
uriTokens.push(s);
|
|
15999
16255
|
}
|
|
16000
|
-
if (component.query !== void 0) uriTokens.push("?", component.query);
|
|
16001
|
-
if (component.fragment !== void 0) uriTokens.push("#", component.fragment);
|
|
16256
|
+
if (component.query !== void 0) uriTokens.push("?", encodeQuery(component.query));
|
|
16257
|
+
if (component.fragment !== void 0) uriTokens.push("#", encodeFragment(component.fragment));
|
|
16002
16258
|
return uriTokens.join("");
|
|
16003
16259
|
}
|
|
16004
16260
|
const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
16005
|
-
|
|
16261
|
+
const AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
|
|
16262
|
+
const AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
|
|
16263
|
+
function getParseError(parsed, matches) {
|
|
16264
|
+
if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") return 'URI path must start with "/" when authority is present.';
|
|
16265
|
+
if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) return "URI port is malformed.";
|
|
16266
|
+
}
|
|
16267
|
+
function hasMalformedPercentEncoding(component) {
|
|
16268
|
+
if (component === void 0) return false;
|
|
16269
|
+
let percent = component.indexOf("%");
|
|
16270
|
+
while (percent !== -1) {
|
|
16271
|
+
if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) return true;
|
|
16272
|
+
percent = component.indexOf("%", percent + 3);
|
|
16273
|
+
}
|
|
16274
|
+
return false;
|
|
16275
|
+
}
|
|
16276
|
+
function isIPLiteral(host) {
|
|
16277
|
+
return host[0] === "[" && host[host.length - 1] === "]";
|
|
16278
|
+
}
|
|
16279
|
+
function hasMalformedComponentPercentEncoding(matches) {
|
|
16280
|
+
const host = matches[4];
|
|
16281
|
+
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
16282
|
+
}
|
|
16283
|
+
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
16284
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) try {
|
|
16285
|
+
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
16286
|
+
} catch (e) {
|
|
16287
|
+
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
16288
|
+
return true;
|
|
16289
|
+
}
|
|
16290
|
+
return false;
|
|
16291
|
+
}
|
|
16292
|
+
function parseWithStatus(uri, opts) {
|
|
16006
16293
|
const options = Object.assign({}, opts);
|
|
16007
16294
|
const parsed = {
|
|
16008
16295
|
scheme: void 0,
|
|
@@ -16013,9 +16300,34 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
16013
16300
|
query: void 0,
|
|
16014
16301
|
fragment: void 0
|
|
16015
16302
|
};
|
|
16303
|
+
let malformedAuthorityOrPort = false;
|
|
16304
|
+
let malformedPercentEncoding = false;
|
|
16305
|
+
let malformedSchemeSpecific = false;
|
|
16306
|
+
let malformedHost = false;
|
|
16307
|
+
let malformedIPLiteral = false;
|
|
16308
|
+
let malformedScheme = false;
|
|
16016
16309
|
let isIP = false;
|
|
16017
16310
|
if (options.reference === "suffix") if (options.scheme) uri = options.scheme + ":" + uri;
|
|
16018
16311
|
else uri = "//" + uri;
|
|
16312
|
+
const authorityMatch = uri.match(AUTHORITY_PREFIX);
|
|
16313
|
+
if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
|
|
16314
|
+
parsed.error = "URI authority must not contain a literal backslash.";
|
|
16315
|
+
malformedAuthorityOrPort = true;
|
|
16316
|
+
}
|
|
16317
|
+
const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
|
|
16318
|
+
if (introducerMatch !== null) {
|
|
16319
|
+
const region = introducerMatch[1];
|
|
16320
|
+
const normalizedRegion = region.replace(/[\t\n\r]/g, "");
|
|
16321
|
+
if (normalizedRegion.length >= 2) {
|
|
16322
|
+
if (normalizedRegion.slice(0, 2) !== "//") {
|
|
16323
|
+
parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
|
|
16324
|
+
malformedAuthorityOrPort = true;
|
|
16325
|
+
} else if (region.length !== normalizedRegion.length) {
|
|
16326
|
+
parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
|
|
16327
|
+
malformedAuthorityOrPort = true;
|
|
16328
|
+
}
|
|
16329
|
+
}
|
|
16330
|
+
}
|
|
16019
16331
|
const matches = uri.match(URI_PARSE);
|
|
16020
16332
|
if (matches) {
|
|
16021
16333
|
parsed.scheme = matches[1];
|
|
@@ -16025,11 +16337,33 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
16025
16337
|
parsed.path = matches[6] || "";
|
|
16026
16338
|
parsed.query = matches[7];
|
|
16027
16339
|
parsed.fragment = matches[8];
|
|
16340
|
+
if (parsed.scheme !== void 0) {
|
|
16341
|
+
const decodedScheme = unescape(parsed.scheme);
|
|
16342
|
+
if (VALID_SCHEME.test(decodedScheme)) parsed.scheme = decodedScheme.toLowerCase();
|
|
16343
|
+
else {
|
|
16344
|
+
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
|
|
16345
|
+
malformedScheme = true;
|
|
16346
|
+
}
|
|
16347
|
+
}
|
|
16348
|
+
malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
|
|
16349
|
+
if (malformedPercentEncoding) parsed.error = parsed.error || "URI contains malformed percent-encoding.";
|
|
16028
16350
|
if (isNaN(parsed.port)) parsed.port = matches[5];
|
|
16351
|
+
const parseError = getParseError(parsed, matches);
|
|
16352
|
+
if (parseError !== void 0) {
|
|
16353
|
+
parsed.error = parsed.error || parseError;
|
|
16354
|
+
malformedAuthorityOrPort = true;
|
|
16355
|
+
}
|
|
16029
16356
|
if (parsed.host) if (isIPv4(parsed.host) === false) {
|
|
16357
|
+
const bracketedIPLiteral = isIPLiteral(parsed.host);
|
|
16358
|
+
const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
|
|
16030
16359
|
const ipv6result = normalizeIPv6(parsed.host);
|
|
16031
|
-
|
|
16032
|
-
|
|
16360
|
+
isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
|
|
16361
|
+
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
16362
|
+
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
16363
|
+
if (malformedIPLiteral) {
|
|
16364
|
+
parsed.error = parsed.error || "URI host is malformed.";
|
|
16365
|
+
malformedAuthorityOrPort = true;
|
|
16366
|
+
}
|
|
16033
16367
|
} else isIP = true;
|
|
16034
16368
|
if (parsed.scheme === void 0 && parsed.userinfo === void 0 && parsed.host === void 0 && parsed.port === void 0 && parsed.query === void 0 && !parsed.path) parsed.reference = "same-document";
|
|
16035
16369
|
else if (parsed.scheme === void 0) parsed.reference = "relative";
|
|
@@ -16037,24 +16371,58 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
16037
16371
|
else parsed.reference = "uri";
|
|
16038
16372
|
if (options.reference && options.reference !== "suffix" && options.reference !== parsed.reference) parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
|
|
16039
16373
|
const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
|
|
16040
|
-
if (!
|
|
16041
|
-
|
|
16042
|
-
|
|
16043
|
-
|
|
16044
|
-
|
|
16045
|
-
}
|
|
16374
|
+
if (!malformedIPLiteral) malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
|
|
16375
|
+
if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
|
|
16376
|
+
let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
|
|
16377
|
+
if (!isIP) host = normalizePercentEncoding(host.toLowerCase());
|
|
16378
|
+
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
16046
16379
|
}
|
|
16047
16380
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
16048
|
-
if (
|
|
16049
|
-
|
|
16050
|
-
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
|
|
16381
|
+
if (parsed.path) parsed.path = normalizePathEncoding(parsed.path);
|
|
16382
|
+
if (parsed.query) parsed.query = normalizeQueryFragmentEncoding(parsed.query);
|
|
16383
|
+
if (parsed.fragment) parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
|
|
16384
|
+
}
|
|
16385
|
+
if (schemeHandler && schemeHandler.parse) {
|
|
16386
|
+
schemeHandler.parse(parsed, options);
|
|
16387
|
+
if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) malformedSchemeSpecific = true;
|
|
16054
16388
|
}
|
|
16055
|
-
if (schemeHandler && schemeHandler.parse) schemeHandler.parse(parsed, options);
|
|
16056
16389
|
} else parsed.error = parsed.error || "URI can not be parsed.";
|
|
16057
|
-
return
|
|
16390
|
+
return {
|
|
16391
|
+
parsed,
|
|
16392
|
+
malformedAuthorityOrPort,
|
|
16393
|
+
malformedPercentEncoding,
|
|
16394
|
+
malformedSchemeSpecific,
|
|
16395
|
+
malformedHost,
|
|
16396
|
+
malformedScheme
|
|
16397
|
+
};
|
|
16398
|
+
}
|
|
16399
|
+
function parse2(uri, opts) {
|
|
16400
|
+
return parseWithStatus(uri, opts).parsed;
|
|
16401
|
+
}
|
|
16402
|
+
function normalizeString(uri, opts) {
|
|
16403
|
+
return normalizeStringWithStatus(uri, opts).normalized;
|
|
16404
|
+
}
|
|
16405
|
+
function normalizeStringWithStatus(uri, opts) {
|
|
16406
|
+
const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
16407
|
+
return {
|
|
16408
|
+
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
|
|
16409
|
+
malformedAuthorityOrPort,
|
|
16410
|
+
malformedPercentEncoding,
|
|
16411
|
+
malformedSchemeSpecific,
|
|
16412
|
+
malformedHost,
|
|
16413
|
+
malformedScheme
|
|
16414
|
+
};
|
|
16415
|
+
}
|
|
16416
|
+
function normalizeComparableURI(uri, opts) {
|
|
16417
|
+
if (typeof uri !== "string" && typeof uri !== "object") return;
|
|
16418
|
+
let value;
|
|
16419
|
+
try {
|
|
16420
|
+
value = typeof uri === "string" ? uri : serialize(uri, opts);
|
|
16421
|
+
} catch {
|
|
16422
|
+
return;
|
|
16423
|
+
}
|
|
16424
|
+
const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
|
|
16425
|
+
return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
|
|
16058
16426
|
}
|
|
16059
16427
|
const fastUri = {
|
|
16060
16428
|
SCHEMES,
|
|
@@ -19846,10 +20214,10 @@ var AjvJsonSchemaValidator = class {
|
|
|
19846
20214
|
};
|
|
19847
20215
|
var Ajv = import_ajv.Ajv;
|
|
19848
20216
|
|
|
19849
|
-
// node_modules/.pnpm/@modelcontextprotocol+server@2.
|
|
20217
|
+
// node_modules/.pnpm/@modelcontextprotocol+server@2.4.0/node_modules/@modelcontextprotocol/server/dist/shimsNode.mjs
|
|
19850
20218
|
import process2 from "node:process";
|
|
19851
20219
|
|
|
19852
|
-
// node_modules/.pnpm/@modelcontextprotocol+server@2.
|
|
20220
|
+
// node_modules/.pnpm/@modelcontextprotocol+server@2.4.0/node_modules/@modelcontextprotocol/server/dist/mcp-oHn3ureC.mjs
|
|
19853
20221
|
var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
|
|
19854
20222
|
function isCompletable(schema) {
|
|
19855
20223
|
return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
|
|
@@ -19865,209 +20233,190 @@ function armSseKeepAlive(intervalMs, onTick) {
|
|
|
19865
20233
|
timer.unref?.();
|
|
19866
20234
|
return timer;
|
|
19867
20235
|
}
|
|
19868
|
-
var
|
|
19869
|
-
|
|
20236
|
+
var readClassification;
|
|
20237
|
+
var PerRequestHTTPServerTransport = class {
|
|
20238
|
+
static {
|
|
20239
|
+
readClassification = (transport) => transport._classification;
|
|
20240
|
+
}
|
|
20241
|
+
onclose;
|
|
20242
|
+
onerror;
|
|
20243
|
+
onmessage;
|
|
20244
|
+
_classification;
|
|
20245
|
+
_responseMode;
|
|
20246
|
+
_started = false;
|
|
20247
|
+
_used = false;
|
|
20248
|
+
_closed = false;
|
|
20249
|
+
_terminalDelivered = false;
|
|
19870
20250
|
/**
|
|
19871
|
-
*
|
|
19872
|
-
*
|
|
20251
|
+
* `true` only while the inbound message is being delivered synchronously
|
|
20252
|
+
* to the connected protocol layer. The pre-handler gates (the era
|
|
20253
|
+
* registry gate, the edge→instance handoff check, the missing-handler
|
|
20254
|
+
* rejection) answer inside this window; request handlers always run
|
|
20255
|
+
* after it (the protocol layer defers them to a microtask). An error
|
|
20256
|
+
* sent inside the window is therefore ladder-originated, and an error
|
|
20257
|
+
* sent after it is handler-produced.
|
|
19873
20258
|
*/
|
|
19874
|
-
|
|
19875
|
-
|
|
20259
|
+
_dispatchWindowOpen = false;
|
|
20260
|
+
_requestId;
|
|
20261
|
+
_deferredResponse;
|
|
20262
|
+
_sse;
|
|
20263
|
+
_abortCleanup;
|
|
20264
|
+
_keepAliveMs;
|
|
20265
|
+
constructor(options) {
|
|
20266
|
+
this._classification = options.classification;
|
|
20267
|
+
this._responseMode = options.responseMode ?? "auto";
|
|
20268
|
+
this._keepAliveMs = options.keepAliveMs ?? DEFAULT_SSE_KEEP_ALIVE_MS;
|
|
19876
20269
|
}
|
|
19877
|
-
|
|
19878
|
-
|
|
19879
|
-
|
|
19880
|
-
} catch (error2) {
|
|
19881
|
-
this.onerror?.(error2 instanceof Error ? error2 : new Error(String(error2)));
|
|
19882
|
-
}
|
|
20270
|
+
async start() {
|
|
20271
|
+
if (this._started) throw new Error("PerRequestHTTPServerTransport is already started");
|
|
20272
|
+
this._started = true;
|
|
19883
20273
|
}
|
|
19884
|
-
|
|
19885
|
-
|
|
19886
|
-
|
|
19887
|
-
|
|
19888
|
-
|
|
19889
|
-
|
|
19890
|
-
|
|
20274
|
+
/**
|
|
20275
|
+
* Serves the single exchange: delivers the classified message to the
|
|
20276
|
+
* connected server instance and resolves with the HTTP response.
|
|
20277
|
+
*
|
|
20278
|
+
* Throws when called a second time (the transport is strictly
|
|
20279
|
+
* single-use), or before a server has been connected to the transport.
|
|
20280
|
+
* The returned promise rejects with a connection-closed error when the
|
|
20281
|
+
* transport is closed before a response was produced (for example because
|
|
20282
|
+
* the client disconnected).
|
|
20283
|
+
*/
|
|
20284
|
+
async handleMessage(message, extra) {
|
|
20285
|
+
if (this._used) throw new Error("PerRequestHTTPServerTransport serves exactly one exchange; construct a new transport per request");
|
|
20286
|
+
if (!this._started || this.onmessage === void 0) throw new Error("PerRequestHTTPServerTransport is not connected: connect a server to this transport before handling a message");
|
|
20287
|
+
if (this._closed) throw new Error("PerRequestHTTPServerTransport is closed");
|
|
20288
|
+
this._used = true;
|
|
20289
|
+
const signal = extra?.request?.signal;
|
|
20290
|
+
if (signal?.aborted) {
|
|
20291
|
+
await this.close();
|
|
20292
|
+
throw new SdkError(SdkErrorCode.ConnectionClosed, "The request was aborted before it could be handled");
|
|
20293
|
+
}
|
|
20294
|
+
const messageExtra = {
|
|
20295
|
+
classification: this._classification,
|
|
20296
|
+
...extra?.request !== void 0 && { request: extra.request },
|
|
20297
|
+
...extra?.authInfo !== void 0 && { authInfo: extra.authInfo }
|
|
19891
20298
|
};
|
|
20299
|
+
if (isJSONRPCRequest(message)) {
|
|
20300
|
+
this._requestId = message.id;
|
|
20301
|
+
let resolve;
|
|
20302
|
+
let reject;
|
|
20303
|
+
const promise = new Promise((promiseResolve, promiseReject) => {
|
|
20304
|
+
resolve = promiseResolve;
|
|
20305
|
+
reject = promiseReject;
|
|
20306
|
+
});
|
|
20307
|
+
this._deferredResponse = {
|
|
20308
|
+
promise,
|
|
20309
|
+
resolve,
|
|
20310
|
+
reject,
|
|
20311
|
+
settled: false
|
|
20312
|
+
};
|
|
20313
|
+
if (signal !== void 0) {
|
|
20314
|
+
const onAbort = () => void this.close();
|
|
20315
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
20316
|
+
this._abortCleanup = () => signal.removeEventListener("abort", onAbort);
|
|
20317
|
+
}
|
|
20318
|
+
this._dispatchWindowOpen = true;
|
|
20319
|
+
try {
|
|
20320
|
+
this.onmessage(message, messageExtra);
|
|
20321
|
+
} finally {
|
|
20322
|
+
this._dispatchWindowOpen = false;
|
|
20323
|
+
}
|
|
20324
|
+
if (this._responseMode === "sse" && !this._closed && !this._deferredResponse.settled) this.upgradeToSse();
|
|
20325
|
+
return promise;
|
|
20326
|
+
}
|
|
20327
|
+
this.onmessage(message, messageExtra);
|
|
20328
|
+
return new Response(null, { status: 202 });
|
|
19892
20329
|
}
|
|
19893
|
-
|
|
19894
|
-
|
|
19895
|
-
|
|
19896
|
-
|
|
19897
|
-
|
|
19898
|
-
|
|
19899
|
-
|
|
19900
|
-
toolsChanged: () => bus.publish({ kind: "tools_list_changed" }),
|
|
19901
|
-
promptsChanged: () => bus.publish({ kind: "prompts_list_changed" }),
|
|
19902
|
-
resourcesChanged: () => bus.publish({ kind: "resources_list_changed" }),
|
|
19903
|
-
resourceUpdated: (uri) => bus.publish({
|
|
19904
|
-
kind: "resource_updated",
|
|
19905
|
-
uri
|
|
19906
|
-
})
|
|
19907
|
-
};
|
|
19908
|
-
}
|
|
19909
|
-
function listenFilterAccepts(filter, event) {
|
|
19910
|
-
switch (event.kind) {
|
|
19911
|
-
case "tools_list_changed":
|
|
19912
|
-
return filter.toolsListChanged === true;
|
|
19913
|
-
case "prompts_list_changed":
|
|
19914
|
-
return filter.promptsListChanged === true;
|
|
19915
|
-
case "resources_list_changed":
|
|
19916
|
-
return filter.resourcesListChanged === true;
|
|
19917
|
-
case "resource_updated":
|
|
19918
|
-
return filter.resourceSubscriptions !== void 0 && filter.resourceSubscriptions.includes(event.uri);
|
|
19919
|
-
}
|
|
19920
|
-
}
|
|
19921
|
-
function honoredSubset(requested, capabilities) {
|
|
19922
|
-
const honored = {};
|
|
19923
|
-
const allow = (bit) => capabilities === void 0 || bit === true;
|
|
19924
|
-
if (requested.toolsListChanged === true && allow(capabilities?.tools?.listChanged)) honored.toolsListChanged = true;
|
|
19925
|
-
if (requested.promptsListChanged === true && allow(capabilities?.prompts?.listChanged)) honored.promptsListChanged = true;
|
|
19926
|
-
if (requested.resourcesListChanged === true && allow(capabilities?.resources?.listChanged)) honored.resourcesListChanged = true;
|
|
19927
|
-
if (requested.resourceSubscriptions !== void 0 && requested.resourceSubscriptions.length > 0 && allow(capabilities?.resources?.subscribe)) honored.resourceSubscriptions = [...requested.resourceSubscriptions];
|
|
19928
|
-
return honored;
|
|
19929
|
-
}
|
|
19930
|
-
function serverEventToNotification(event) {
|
|
19931
|
-
switch (event.kind) {
|
|
19932
|
-
case "tools_list_changed":
|
|
19933
|
-
return { method: "notifications/tools/list_changed" };
|
|
19934
|
-
case "prompts_list_changed":
|
|
19935
|
-
return { method: "notifications/prompts/list_changed" };
|
|
19936
|
-
case "resources_list_changed":
|
|
19937
|
-
return { method: "notifications/resources/list_changed" };
|
|
19938
|
-
case "resource_updated":
|
|
19939
|
-
return {
|
|
19940
|
-
method: "notifications/resources/updated",
|
|
19941
|
-
params: { uri: event.uri }
|
|
19942
|
-
};
|
|
19943
|
-
}
|
|
19944
|
-
}
|
|
19945
|
-
var DEFAULT_MAX_SUBSCRIPTIONS = 1024;
|
|
19946
|
-
function jsonRpcError(id, code, message) {
|
|
19947
|
-
return Response.json({
|
|
19948
|
-
jsonrpc: "2.0",
|
|
19949
|
-
error: {
|
|
19950
|
-
code,
|
|
19951
|
-
message
|
|
19952
|
-
},
|
|
19953
|
-
id
|
|
19954
|
-
}, { status: 200 });
|
|
19955
|
-
}
|
|
19956
|
-
function stampSubscriptionId(notification, subscriptionId) {
|
|
19957
|
-
return {
|
|
19958
|
-
method: notification.method,
|
|
19959
|
-
params: {
|
|
19960
|
-
...notification.params,
|
|
19961
|
-
_meta: {
|
|
19962
|
-
...notification.params?._meta,
|
|
19963
|
-
[SUBSCRIPTION_ID_META_KEY]: subscriptionId
|
|
19964
|
-
}
|
|
19965
|
-
}
|
|
19966
|
-
};
|
|
19967
|
-
}
|
|
19968
|
-
function parseListenFilter(message) {
|
|
19969
|
-
const outcome = codecForVersion(MODERN_WIRE_REVISION).validateRequest("subscriptions/listen", message);
|
|
19970
|
-
return outcome.ok ? outcome.value.params?.notifications : void 0;
|
|
19971
|
-
}
|
|
19972
|
-
function createListenRouter(options) {
|
|
19973
|
-
const { bus, onerror } = options;
|
|
19974
|
-
const maxSubscriptions = options.maxSubscriptions ?? DEFAULT_MAX_SUBSCRIPTIONS;
|
|
19975
|
-
const keepAliveMs = options.keepAliveMs ?? DEFAULT_SSE_KEEP_ALIVE_MS;
|
|
19976
|
-
const open2 = /* @__PURE__ */ new Set();
|
|
19977
|
-
function serve(message, signal, capabilities, serverInfo) {
|
|
19978
|
-
if (open2.size >= maxSubscriptions) {
|
|
19979
|
-
onerror?.(/* @__PURE__ */ new Error(`subscriptions/listen refused: subscription limit reached (${maxSubscriptions})`));
|
|
19980
|
-
return jsonRpcError(message.id, -32603, "Subscription limit reached");
|
|
20330
|
+
async send(message, options) {
|
|
20331
|
+
if (this._closed) return;
|
|
20332
|
+
const isResponse = isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message);
|
|
20333
|
+
const relatedId = isResponse ? message.id : options?.relatedRequestId;
|
|
20334
|
+
if (this._requestId === void 0 || relatedId === void 0 || relatedId !== this._requestId) {
|
|
20335
|
+
if (isResponse) this.onerror?.(/* @__PURE__ */ new Error(`Received a response for an unknown request id: ${String(message.id)}`));
|
|
20336
|
+
return;
|
|
19981
20337
|
}
|
|
19982
|
-
|
|
19983
|
-
|
|
19984
|
-
|
|
19985
|
-
|
|
19986
|
-
|
|
19987
|
-
|
|
19988
|
-
|
|
19989
|
-
|
|
19990
|
-
|
|
19991
|
-
|
|
19992
|
-
|
|
19993
|
-
|
|
19994
|
-
try {
|
|
19995
|
-
controller.enqueue(encoder.encode(frame));
|
|
19996
|
-
} catch (error2) {
|
|
19997
|
-
onerror?.(error2 instanceof Error ? error2 : new Error(String(error2)));
|
|
20338
|
+
if (isResponse) {
|
|
20339
|
+
if (this._terminalDelivered) return;
|
|
20340
|
+
this._terminalDelivered = true;
|
|
20341
|
+
const errorCode = isJSONRPCErrorResponse(message) ? message.error.code : void 0;
|
|
20342
|
+
const ladderStatus = errorCode !== void 0 && (this._dispatchWindowOpen || errorCode === ProtocolErrorCode.MissingRequiredClientCapability) ? LADDER_ERROR_HTTP_STATUS[errorCode] : void 0;
|
|
20343
|
+
if (ladderStatus !== void 0 && this._sse === void 0) {
|
|
20344
|
+
this.settleResponse(Response.json(message, {
|
|
20345
|
+
status: ladderStatus,
|
|
20346
|
+
headers: { "Content-Type": "application/json" }
|
|
20347
|
+
}));
|
|
20348
|
+
queueMicrotask(() => void this.close());
|
|
20349
|
+
return;
|
|
19998
20350
|
}
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
|
|
20002
|
-
|
|
20003
|
-
|
|
20004
|
-
|
|
20005
|
-
|
|
20006
|
-
|
|
20007
|
-
|
|
20008
|
-
|
|
20009
|
-
|
|
20010
|
-
|
|
20011
|
-
|
|
20012
|
-
|
|
20013
|
-
|
|
20014
|
-
|
|
20015
|
-
|
|
20016
|
-
|
|
20017
|
-
|
|
20018
|
-
|
|
20019
|
-
|
|
20020
|
-
|
|
20021
|
-
|
|
20022
|
-
|
|
20023
|
-
|
|
20351
|
+
if (this._sse !== void 0 || this._responseMode === "sse") {
|
|
20352
|
+
if (this._sse === void 0) this.upgradeToSse();
|
|
20353
|
+
this.writeMessageFrame(message);
|
|
20354
|
+
this.finalizeStream();
|
|
20355
|
+
return;
|
|
20356
|
+
}
|
|
20357
|
+
this.settleResponse(Response.json(message, {
|
|
20358
|
+
status: 200,
|
|
20359
|
+
headers: { "Content-Type": "application/json" }
|
|
20360
|
+
}));
|
|
20361
|
+
queueMicrotask(() => void this.close());
|
|
20362
|
+
return;
|
|
20363
|
+
}
|
|
20364
|
+
if (this._responseMode === "json") return;
|
|
20365
|
+
if (this._sse === void 0) this.upgradeToSse();
|
|
20366
|
+
this.writeMessageFrame(message);
|
|
20367
|
+
}
|
|
20368
|
+
/**
|
|
20369
|
+
* Writes an SSE comment frame (a keep-alive heartbeat). Dropped when the
|
|
20370
|
+
* exchange is not currently streaming.
|
|
20371
|
+
*/
|
|
20372
|
+
writeCommentFrame(comment) {
|
|
20373
|
+
if (this._closed || this._sse === void 0 || this._sse.closed) return;
|
|
20374
|
+
const frame = comment.split("\n").map((line) => `: ${line}`).join("\n");
|
|
20375
|
+
this.writeFrame(`${frame}
|
|
20024
20376
|
|
|
20025
20377
|
`);
|
|
20026
|
-
|
|
20027
|
-
|
|
20028
|
-
|
|
20029
|
-
|
|
20030
|
-
|
|
20031
|
-
|
|
20032
|
-
|
|
20033
|
-
|
|
20034
|
-
|
|
20378
|
+
}
|
|
20379
|
+
async close() {
|
|
20380
|
+
if (this._closed) return;
|
|
20381
|
+
this._closed = true;
|
|
20382
|
+
this._abortCleanup?.();
|
|
20383
|
+
this._abortCleanup = void 0;
|
|
20384
|
+
if (this._sse?.keepAliveTimer !== void 0) clearInterval(this._sse.keepAliveTimer);
|
|
20385
|
+
if (this._sse !== void 0 && !this._sse.closed) {
|
|
20386
|
+
this._sse.closed = true;
|
|
20035
20387
|
try {
|
|
20036
|
-
controller.close();
|
|
20388
|
+
this._sse.controller.close();
|
|
20037
20389
|
} catch {
|
|
20038
20390
|
}
|
|
20039
|
-
}
|
|
20391
|
+
}
|
|
20392
|
+
if (this._deferredResponse !== void 0 && !this._deferredResponse.settled) {
|
|
20393
|
+
this._deferredResponse.settled = true;
|
|
20394
|
+
this._deferredResponse.reject(new SdkError(SdkErrorCode.ConnectionClosed, "Connection closed before a response was produced"));
|
|
20395
|
+
}
|
|
20396
|
+
this.onclose?.();
|
|
20397
|
+
}
|
|
20398
|
+
settleResponse(response) {
|
|
20399
|
+
if (this._deferredResponse === void 0 || this._deferredResponse.settled) return;
|
|
20400
|
+
this._deferredResponse.settled = true;
|
|
20401
|
+
this._deferredResponse.resolve(response);
|
|
20402
|
+
}
|
|
20403
|
+
upgradeToSse() {
|
|
20404
|
+
let controller;
|
|
20040
20405
|
const readable = new ReadableStream({
|
|
20041
|
-
start(streamController) {
|
|
20406
|
+
start: (streamController) => {
|
|
20042
20407
|
controller = streamController;
|
|
20043
|
-
const ack = stampSubscriptionId({
|
|
20044
|
-
method: "notifications/subscriptions/acknowledged",
|
|
20045
|
-
params: { notifications: honored }
|
|
20046
|
-
}, subscriptionId);
|
|
20047
|
-
writeNotification(ack.method, ack.params);
|
|
20048
|
-
if (Object.keys(honored).length === 0) {
|
|
20049
|
-
teardown(true);
|
|
20050
|
-
return;
|
|
20051
|
-
}
|
|
20052
|
-
unsubscribe = bus.subscribe((event) => {
|
|
20053
|
-
if (closed || !listenFilterAccepts(honored, event)) return;
|
|
20054
|
-
const note = stampSubscriptionId(serverEventToNotification(event), subscriptionId);
|
|
20055
|
-
writeNotification(note.method, note.params);
|
|
20056
|
-
});
|
|
20057
|
-
keepAliveTimer = armSseKeepAlive(keepAliveMs, () => writeFrame(": keepalive\n\n"));
|
|
20058
|
-
open2.add(teardown);
|
|
20059
20408
|
},
|
|
20060
|
-
cancel() {
|
|
20061
|
-
|
|
20409
|
+
cancel: () => {
|
|
20410
|
+
this.close();
|
|
20062
20411
|
}
|
|
20063
20412
|
});
|
|
20064
|
-
|
|
20065
|
-
|
|
20066
|
-
|
|
20067
|
-
|
|
20068
|
-
|
|
20069
|
-
|
|
20070
|
-
|
|
20413
|
+
this._sse = {
|
|
20414
|
+
controller,
|
|
20415
|
+
encoder: new TextEncoder(),
|
|
20416
|
+
closed: false
|
|
20417
|
+
};
|
|
20418
|
+
this._sse.keepAliveTimer = armSseKeepAlive(this._keepAliveMs, () => this.writeCommentFrame("keepalive"));
|
|
20419
|
+
this.settleResponse(new Response(readable, {
|
|
20071
20420
|
status: 200,
|
|
20072
20421
|
headers: {
|
|
20073
20422
|
"Content-Type": "text/event-stream",
|
|
@@ -20075,163 +20424,36 @@ data: ${JSON.stringify({
|
|
|
20075
20424
|
Connection: "keep-alive",
|
|
20076
20425
|
"X-Accel-Buffering": "no"
|
|
20077
20426
|
}
|
|
20078
|
-
});
|
|
20427
|
+
}));
|
|
20079
20428
|
}
|
|
20080
|
-
|
|
20081
|
-
|
|
20082
|
-
|
|
20083
|
-
|
|
20084
|
-
|
|
20085
|
-
|
|
20086
|
-
|
|
20429
|
+
finalizeStream() {
|
|
20430
|
+
if (this._sse?.keepAliveTimer !== void 0) clearInterval(this._sse.keepAliveTimer);
|
|
20431
|
+
if (this._sse !== void 0 && !this._sse.closed) {
|
|
20432
|
+
this._sse.closed = true;
|
|
20433
|
+
try {
|
|
20434
|
+
this._sse.controller.close();
|
|
20435
|
+
} catch {
|
|
20436
|
+
}
|
|
20087
20437
|
}
|
|
20088
|
-
|
|
20089
|
-
}
|
|
20090
|
-
var CHANGE_NOTIFICATION_METHODS = /* @__PURE__ */ new Set([
|
|
20091
|
-
"notifications/tools/list_changed",
|
|
20092
|
-
"notifications/prompts/list_changed",
|
|
20093
|
-
"notifications/resources/list_changed",
|
|
20094
|
-
"notifications/resources/updated"
|
|
20095
|
-
]);
|
|
20096
|
-
var StdioListenRouter = class {
|
|
20097
|
-
/** Active subscriptions, keyed by the listen request's JSON-RPC id verbatim. */
|
|
20098
|
-
_subs = /* @__PURE__ */ new Map();
|
|
20099
|
-
/**
|
|
20100
|
-
* The serving instance's declared capabilities. Filled in by the entry
|
|
20101
|
-
* once the modern instance is constructed (the router is created before
|
|
20102
|
-
* the instance exists), so the acknowledged filter is narrowed against
|
|
20103
|
-
* what the server can actually deliver.
|
|
20104
|
-
*/
|
|
20105
|
-
_serverCapabilities;
|
|
20106
|
-
/**
|
|
20107
|
-
* The serving instance's identity, stamped onto the graceful-close
|
|
20108
|
-
* results' `_meta` (the spec's `SubscriptionsListenResultMetaObject` extends
|
|
20109
|
-
* `ResultMetaObject`). Handed over together with the capabilities.
|
|
20110
|
-
*/
|
|
20111
|
-
_serverInfo;
|
|
20112
|
-
constructor(_maxSubscriptions = DEFAULT_MAX_SUBSCRIPTIONS, serverCapabilities, serverInfo) {
|
|
20113
|
-
this._maxSubscriptions = _maxSubscriptions;
|
|
20114
|
-
this._serverCapabilities = serverCapabilities;
|
|
20115
|
-
this._serverInfo = serverInfo;
|
|
20116
|
-
}
|
|
20117
|
-
/**
|
|
20118
|
-
* Record the serving instance's declared capabilities and identity once
|
|
20119
|
-
* it has been constructed. Called by `serveStdio`'s connect path;
|
|
20120
|
-
* subsequent `serve()` calls narrow the honored filter against the
|
|
20121
|
-
* capabilities, and `teardownAll()` stamps the identity.
|
|
20122
|
-
*/
|
|
20123
|
-
setServerCapabilities(capabilities, serverInfo) {
|
|
20124
|
-
this._serverCapabilities = capabilities;
|
|
20125
|
-
if (serverInfo !== void 0) this._serverInfo = serverInfo;
|
|
20126
|
-
}
|
|
20127
|
-
/** Whether `id` is an active listen subscription on this connection. */
|
|
20128
|
-
has(id) {
|
|
20129
|
-
return this._subs.has(id);
|
|
20130
|
-
}
|
|
20131
|
-
/**
|
|
20132
|
-
* Serve one inbound `subscriptions/listen` request: registers the
|
|
20133
|
-
* subscription and returns the stamped acknowledged notification (or, on
|
|
20134
|
-
* capacity / params rejection, the in-band JSON-RPC error response).
|
|
20135
|
-
*
|
|
20136
|
-
* @throws when called before {@linkcode setServerCapabilities} (or the
|
|
20137
|
-
* constructor) has supplied the serving instance's capabilities. Honoring a
|
|
20138
|
-
* filter without knowing the server's advertised capabilities would fail
|
|
20139
|
-
* open (deliver unadvertised types); the entry guarantees capabilities are
|
|
20140
|
-
* set before any listen request is routed here.
|
|
20141
|
-
*/
|
|
20142
|
-
serve(message) {
|
|
20143
|
-
if (this._serverCapabilities === void 0) throw new Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");
|
|
20144
|
-
if (this._subs.size >= this._maxSubscriptions) return {
|
|
20145
|
-
jsonrpc: "2.0",
|
|
20146
|
-
id: message.id,
|
|
20147
|
-
error: {
|
|
20148
|
-
code: -32603,
|
|
20149
|
-
message: "Subscription limit reached"
|
|
20150
|
-
}
|
|
20151
|
-
};
|
|
20152
|
-
const filter = parseListenFilter(message);
|
|
20153
|
-
if (filter === void 0) return {
|
|
20154
|
-
jsonrpc: "2.0",
|
|
20155
|
-
id: message.id,
|
|
20156
|
-
error: {
|
|
20157
|
-
code: -32602,
|
|
20158
|
-
message: "Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"
|
|
20159
|
-
}
|
|
20160
|
-
};
|
|
20161
|
-
const honored = honoredSubset(filter, this._serverCapabilities);
|
|
20162
|
-
this._subs.set(message.id, honored);
|
|
20163
|
-
return stampSubscriptionId({
|
|
20164
|
-
method: "notifications/subscriptions/acknowledged",
|
|
20165
|
-
params: { notifications: honored }
|
|
20166
|
-
}, message.id);
|
|
20167
|
-
}
|
|
20168
|
-
/**
|
|
20169
|
-
* Tear down one subscription (inbound `notifications/cancelled`). Returns
|
|
20170
|
-
* `true` when a subscription was removed. After this call NOTHING further
|
|
20171
|
-
* is delivered for that subscription id (the post-cancel hardening).
|
|
20172
|
-
*/
|
|
20173
|
-
cancel(id) {
|
|
20174
|
-
return this._subs.delete(id);
|
|
20438
|
+
queueMicrotask(() => void this.close());
|
|
20175
20439
|
}
|
|
20176
|
-
|
|
20177
|
-
|
|
20178
|
-
|
|
20179
|
-
|
|
20180
|
-
|
|
20181
|
-
* dropped — the modern era never delivers an un-requested change type).
|
|
20182
|
-
* - For any other outbound message, returns `'passthrough'` (the entry
|
|
20183
|
-
* forwards it as-is).
|
|
20184
|
-
*/
|
|
20185
|
-
routeOutbound(message) {
|
|
20186
|
-
if (!CHANGE_NOTIFICATION_METHODS.has(message.method)) return "passthrough";
|
|
20187
|
-
const uriParam = message.params?.["uri"];
|
|
20188
|
-
const uri = typeof uriParam === "string" ? uriParam : void 0;
|
|
20189
|
-
const event = notificationToServerEvent(message.method, uri);
|
|
20190
|
-
const out = [];
|
|
20191
|
-
for (const [subscriptionId, filter] of this._subs) if (listenFilterAccepts(filter, event)) out.push(stampSubscriptionId({
|
|
20192
|
-
method: message.method,
|
|
20193
|
-
params: message.params ?? {}
|
|
20194
|
-
}, subscriptionId));
|
|
20195
|
-
return out;
|
|
20440
|
+
writeMessageFrame(message) {
|
|
20441
|
+
this.writeFrame(`event: message
|
|
20442
|
+
data: ${JSON.stringify(message)}
|
|
20443
|
+
|
|
20444
|
+
`);
|
|
20196
20445
|
}
|
|
20197
|
-
|
|
20198
|
-
|
|
20199
|
-
|
|
20200
|
-
|
|
20201
|
-
|
|
20202
|
-
|
|
20203
|
-
|
|
20204
|
-
teardownAll() {
|
|
20205
|
-
const out = [];
|
|
20206
|
-
for (const id of this._subs.keys()) out.push({
|
|
20207
|
-
jsonrpc: "2.0",
|
|
20208
|
-
id,
|
|
20209
|
-
result: {
|
|
20210
|
-
resultType: "complete",
|
|
20211
|
-
_meta: {
|
|
20212
|
-
[SUBSCRIPTION_ID_META_KEY]: id,
|
|
20213
|
-
...this._serverInfo !== void 0 && { [SERVER_INFO_META_KEY]: this._serverInfo }
|
|
20214
|
-
}
|
|
20215
|
-
}
|
|
20216
|
-
});
|
|
20217
|
-
this._subs.clear();
|
|
20218
|
-
return out;
|
|
20446
|
+
writeFrame(frame) {
|
|
20447
|
+
if (this._sse === void 0 || this._sse.closed) return;
|
|
20448
|
+
try {
|
|
20449
|
+
this._sse.controller.enqueue(this._sse.encoder.encode(frame));
|
|
20450
|
+
} catch (error2) {
|
|
20451
|
+
this.onerror?.(/* @__PURE__ */ new Error(`Failed to write to the response stream: ${error2}`));
|
|
20452
|
+
}
|
|
20219
20453
|
}
|
|
20220
20454
|
};
|
|
20221
|
-
function
|
|
20222
|
-
|
|
20223
|
-
case "notifications/tools/list_changed":
|
|
20224
|
-
return { kind: "tools_list_changed" };
|
|
20225
|
-
case "notifications/prompts/list_changed":
|
|
20226
|
-
return { kind: "prompts_list_changed" };
|
|
20227
|
-
case "notifications/resources/list_changed":
|
|
20228
|
-
return { kind: "resources_list_changed" };
|
|
20229
|
-
default:
|
|
20230
|
-
return {
|
|
20231
|
-
kind: "resource_updated",
|
|
20232
|
-
uri: uri ?? ""
|
|
20233
|
-
};
|
|
20234
|
-
}
|
|
20455
|
+
function perRequestClassificationOf(transport) {
|
|
20456
|
+
return transport instanceof PerRequestHTTPServerTransport ? readClassification(transport) : void 0;
|
|
20235
20457
|
}
|
|
20236
20458
|
function headerQuotedValue(value) {
|
|
20237
20459
|
return value.replaceAll(/[\\"]/g, String.raw`\$&`).replaceAll(/[^\u0020-\u007E]/g, " ");
|
|
@@ -20482,6 +20704,7 @@ var Server = class extends Protocol {
|
|
|
20482
20704
|
_requestStateVerify;
|
|
20483
20705
|
_inputRequiredServing;
|
|
20484
20706
|
_legacyShim;
|
|
20707
|
+
_boundFromTransport = false;
|
|
20485
20708
|
/** Lazily-built legacy shim; the loop lives in legacyInputRequiredShim.ts behind a narrow host contract. */
|
|
20486
20709
|
_legacyInputRequiredShim() {
|
|
20487
20710
|
return this._legacyShim ??= new LegacyInputRequiredShim({
|
|
@@ -20521,6 +20744,15 @@ var Server = class extends Protocol {
|
|
|
20521
20744
|
/** Attaches to the given transport; rejects while this instance is connected to another one. */
|
|
20522
20745
|
async connect(transport) {
|
|
20523
20746
|
if (this.transport !== void 0) throw new SdkError(SdkErrorCode.AlreadyConnected, "Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");
|
|
20747
|
+
if (this._boundFromTransport) {
|
|
20748
|
+
this._boundFromTransport = false;
|
|
20749
|
+
this._negotiatedProtocolVersion = void 0;
|
|
20750
|
+
}
|
|
20751
|
+
const revision = perRequestClassificationOf(transport)?.revision;
|
|
20752
|
+
if (revision !== void 0 && !this._servedModernEra() && SUPPORTED_MODERN_PROTOCOL_VERSIONS.includes(revision) && modernProtocolVersions(this._supportedProtocolVersions).includes(revision)) {
|
|
20753
|
+
this._negotiatedProtocolVersion = revision;
|
|
20754
|
+
this._boundFromTransport = true;
|
|
20755
|
+
}
|
|
20524
20756
|
await super.connect(transport);
|
|
20525
20757
|
}
|
|
20526
20758
|
/**
|
|
@@ -20846,8 +21078,8 @@ var Server = class extends Protocol {
|
|
|
20846
21078
|
* @deprecated Read client identity from the per-request handler context instead: on
|
|
20847
21079
|
* 2026-07-28 (per-request envelope) requests `ctx.mcpReq.envelope` carries the client's
|
|
20848
21080
|
* declared capabilities, while on 2025-era connections this accessor keeps returning the
|
|
20849
|
-
* `initialize`-scoped value. The accessor remains functional
|
|
20850
|
-
* 2026-07-28 era
|
|
21081
|
+
* `initialize`-scoped value. The accessor remains functional where `createMcpHandler`
|
|
21082
|
+
* serves the 2026-07-28 era: it backfills it per request from the validated envelope.
|
|
20851
21083
|
*/
|
|
20852
21084
|
getClientCapabilities() {
|
|
20853
21085
|
return this._clientCapabilities;
|
|
@@ -20858,8 +21090,8 @@ var Server = class extends Protocol {
|
|
|
20858
21090
|
* @deprecated Read client identity from the per-request handler context instead: on
|
|
20859
21091
|
* 2026-07-28 (per-request envelope) requests `ctx.mcpReq.envelope` carries the client's
|
|
20860
21092
|
* name and version, while on 2025-era connections this accessor keeps returning the
|
|
20861
|
-
* `initialize`-scoped value. The accessor remains functional
|
|
20862
|
-
* 2026-07-28 era
|
|
21093
|
+
* `initialize`-scoped value. The accessor remains functional where `createMcpHandler`
|
|
21094
|
+
* serves the 2026-07-28 era: it backfills it per request from the validated envelope.
|
|
20863
21095
|
*/
|
|
20864
21096
|
getClientVersion() {
|
|
20865
21097
|
return this._clientVersion;
|
|
@@ -21434,8 +21666,14 @@ var McpServer = class {
|
|
|
21434
21666
|
if (updates.uri) this._registeredResources[updates.uri] = registeredResource;
|
|
21435
21667
|
}
|
|
21436
21668
|
if (updates.name !== void 0) registeredResource.name = updates.name;
|
|
21437
|
-
if (updates.title !== void 0) registeredResource.title = updates.title;
|
|
21438
21669
|
if (updates.metadata !== void 0) registeredResource.metadata = updates.metadata;
|
|
21670
|
+
if (updates.title !== void 0) {
|
|
21671
|
+
registeredResource.title = updates.title;
|
|
21672
|
+
registeredResource.metadata = {
|
|
21673
|
+
...registeredResource.metadata,
|
|
21674
|
+
title: updates.title
|
|
21675
|
+
};
|
|
21676
|
+
}
|
|
21439
21677
|
if (updates.callback !== void 0) registeredResource.readCallback = updates.callback;
|
|
21440
21678
|
if (updates.scopeChallenge !== void 0) registeredResource.scopeChallenge = updates.scopeChallenge === null ? void 0 : updates.scopeChallenge;
|
|
21441
21679
|
if (updates.enabled !== void 0) registeredResource.enabled = updates.enabled;
|
|
@@ -21461,9 +21699,15 @@ var McpServer = class {
|
|
|
21461
21699
|
delete this._registeredResourceTemplates[name];
|
|
21462
21700
|
if (updates.name) this._registeredResourceTemplates[updates.name] = registeredResourceTemplate;
|
|
21463
21701
|
}
|
|
21464
|
-
if (updates.title !== void 0) registeredResourceTemplate.title = updates.title;
|
|
21465
21702
|
if (updates.template !== void 0) registeredResourceTemplate.resourceTemplate = updates.template;
|
|
21466
21703
|
if (updates.metadata !== void 0) registeredResourceTemplate.metadata = updates.metadata;
|
|
21704
|
+
if (updates.title !== void 0) {
|
|
21705
|
+
registeredResourceTemplate.title = updates.title;
|
|
21706
|
+
registeredResourceTemplate.metadata = {
|
|
21707
|
+
...registeredResourceTemplate.metadata,
|
|
21708
|
+
title: updates.title
|
|
21709
|
+
};
|
|
21710
|
+
}
|
|
21467
21711
|
if (updates.callback !== void 0) registeredResourceTemplate.readCallback = updates.callback;
|
|
21468
21712
|
if (updates.scopeChallenge !== void 0) registeredResourceTemplate.scopeChallenge = updates.scopeChallenge === null ? void 0 : updates.scopeChallenge;
|
|
21469
21713
|
if (updates.enabled !== void 0) registeredResourceTemplate.enabled = updates.enabled;
|
|
@@ -21719,187 +21963,222 @@ function unwrapOptionalSchema(schema) {
|
|
|
21719
21963
|
return schema.def?.innerType ?? schema;
|
|
21720
21964
|
}
|
|
21721
21965
|
|
|
21722
|
-
// node_modules/.pnpm/@modelcontextprotocol+server@2.
|
|
21723
|
-
var
|
|
21724
|
-
|
|
21725
|
-
onerror;
|
|
21726
|
-
onmessage;
|
|
21727
|
-
_classification;
|
|
21728
|
-
_responseMode;
|
|
21729
|
-
_started = false;
|
|
21730
|
-
_used = false;
|
|
21731
|
-
_closed = false;
|
|
21732
|
-
_terminalDelivered = false;
|
|
21966
|
+
// node_modules/.pnpm/@modelcontextprotocol+server@2.4.0/node_modules/@modelcontextprotocol/server/dist/listenRouter-Bartj63y.mjs
|
|
21967
|
+
var InMemoryServerEventBus = class {
|
|
21968
|
+
_listeners = /* @__PURE__ */ new Set();
|
|
21733
21969
|
/**
|
|
21734
|
-
*
|
|
21735
|
-
*
|
|
21736
|
-
* registry gate, the edge→instance handoff check, the missing-handler
|
|
21737
|
-
* rejection) answer inside this window; request handlers always run
|
|
21738
|
-
* after it (the protocol layer defers them to a microtask). An error
|
|
21739
|
-
* sent inside the window is therefore ladder-originated, and an error
|
|
21740
|
-
* sent after it is handler-produced.
|
|
21970
|
+
* @param onerror - Optional callback for errors thrown by listeners
|
|
21971
|
+
* during dispatch.
|
|
21741
21972
|
*/
|
|
21742
|
-
|
|
21743
|
-
|
|
21744
|
-
_deferredResponse;
|
|
21745
|
-
_sse;
|
|
21746
|
-
_abortCleanup;
|
|
21747
|
-
_keepAliveMs;
|
|
21748
|
-
constructor(options) {
|
|
21749
|
-
this._classification = options.classification;
|
|
21750
|
-
this._responseMode = options.responseMode ?? "auto";
|
|
21751
|
-
this._keepAliveMs = options.keepAliveMs ?? DEFAULT_SSE_KEEP_ALIVE_MS;
|
|
21752
|
-
}
|
|
21753
|
-
async start() {
|
|
21754
|
-
if (this._started) throw new Error("PerRequestHTTPServerTransport is already started");
|
|
21755
|
-
this._started = true;
|
|
21973
|
+
constructor(onerror) {
|
|
21974
|
+
this.onerror = onerror;
|
|
21756
21975
|
}
|
|
21757
|
-
|
|
21758
|
-
|
|
21759
|
-
|
|
21760
|
-
|
|
21761
|
-
|
|
21762
|
-
* single-use), or before a server has been connected to the transport.
|
|
21763
|
-
* The returned promise rejects with a connection-closed error when the
|
|
21764
|
-
* transport is closed before a response was produced (for example because
|
|
21765
|
-
* the client disconnected).
|
|
21766
|
-
*/
|
|
21767
|
-
async handleMessage(message, extra) {
|
|
21768
|
-
if (this._used) throw new Error("PerRequestHTTPServerTransport serves exactly one exchange; construct a new transport per request");
|
|
21769
|
-
if (!this._started || this.onmessage === void 0) throw new Error("PerRequestHTTPServerTransport is not connected: connect a server to this transport before handling a message");
|
|
21770
|
-
if (this._closed) throw new Error("PerRequestHTTPServerTransport is closed");
|
|
21771
|
-
this._used = true;
|
|
21772
|
-
const signal = extra?.request?.signal;
|
|
21773
|
-
if (signal?.aborted) {
|
|
21774
|
-
await this.close();
|
|
21775
|
-
throw new SdkError(SdkErrorCode.ConnectionClosed, "The request was aborted before it could be handled");
|
|
21976
|
+
publish(event) {
|
|
21977
|
+
for (const listener of this._listeners) try {
|
|
21978
|
+
listener(event);
|
|
21979
|
+
} catch (error2) {
|
|
21980
|
+
this.onerror?.(error2 instanceof Error ? error2 : new Error(String(error2)));
|
|
21776
21981
|
}
|
|
21777
|
-
|
|
21778
|
-
|
|
21779
|
-
|
|
21780
|
-
|
|
21982
|
+
}
|
|
21983
|
+
subscribe(listener) {
|
|
21984
|
+
this._listeners.add(listener);
|
|
21985
|
+
let live = true;
|
|
21986
|
+
return () => {
|
|
21987
|
+
if (!live) return;
|
|
21988
|
+
live = false;
|
|
21989
|
+
this._listeners.delete(listener);
|
|
21781
21990
|
};
|
|
21782
|
-
|
|
21783
|
-
|
|
21784
|
-
|
|
21785
|
-
|
|
21786
|
-
|
|
21787
|
-
|
|
21788
|
-
|
|
21789
|
-
|
|
21790
|
-
|
|
21791
|
-
|
|
21792
|
-
|
|
21793
|
-
|
|
21794
|
-
|
|
21991
|
+
}
|
|
21992
|
+
/** The number of currently registered listeners (test/introspection only — the routers track capacity via their own open-subscription set). */
|
|
21993
|
+
get listenerCount() {
|
|
21994
|
+
return this._listeners.size;
|
|
21995
|
+
}
|
|
21996
|
+
};
|
|
21997
|
+
function createServerNotifier(bus) {
|
|
21998
|
+
return {
|
|
21999
|
+
toolsChanged: () => bus.publish({ kind: "tools_list_changed" }),
|
|
22000
|
+
promptsChanged: () => bus.publish({ kind: "prompts_list_changed" }),
|
|
22001
|
+
resourcesChanged: () => bus.publish({ kind: "resources_list_changed" }),
|
|
22002
|
+
resourceUpdated: (uri) => bus.publish({
|
|
22003
|
+
kind: "resource_updated",
|
|
22004
|
+
uri
|
|
22005
|
+
})
|
|
22006
|
+
};
|
|
22007
|
+
}
|
|
22008
|
+
function listenFilterAccepts(filter, event) {
|
|
22009
|
+
switch (event.kind) {
|
|
22010
|
+
case "tools_list_changed":
|
|
22011
|
+
return filter.toolsListChanged === true;
|
|
22012
|
+
case "prompts_list_changed":
|
|
22013
|
+
return filter.promptsListChanged === true;
|
|
22014
|
+
case "resources_list_changed":
|
|
22015
|
+
return filter.resourcesListChanged === true;
|
|
22016
|
+
case "resource_updated":
|
|
22017
|
+
return filter.resourceSubscriptions !== void 0 && filter.resourceSubscriptions.includes(event.uri);
|
|
22018
|
+
}
|
|
22019
|
+
}
|
|
22020
|
+
function honoredSubset(requested, capabilities) {
|
|
22021
|
+
const honored = {};
|
|
22022
|
+
const allow = (bit) => capabilities === void 0 || bit === true;
|
|
22023
|
+
if (requested.toolsListChanged === true && allow(capabilities?.tools?.listChanged)) honored.toolsListChanged = true;
|
|
22024
|
+
if (requested.promptsListChanged === true && allow(capabilities?.prompts?.listChanged)) honored.promptsListChanged = true;
|
|
22025
|
+
if (requested.resourcesListChanged === true && allow(capabilities?.resources?.listChanged)) honored.resourcesListChanged = true;
|
|
22026
|
+
if (requested.resourceSubscriptions !== void 0 && requested.resourceSubscriptions.length > 0 && allow(capabilities?.resources?.subscribe)) honored.resourceSubscriptions = [...requested.resourceSubscriptions];
|
|
22027
|
+
return honored;
|
|
22028
|
+
}
|
|
22029
|
+
function serverEventToNotification(event) {
|
|
22030
|
+
switch (event.kind) {
|
|
22031
|
+
case "tools_list_changed":
|
|
22032
|
+
return {
|
|
22033
|
+
method: "notifications/tools/list_changed",
|
|
22034
|
+
...event.params !== void 0 && { params: event.params }
|
|
21795
22035
|
};
|
|
21796
|
-
|
|
21797
|
-
|
|
21798
|
-
|
|
21799
|
-
|
|
21800
|
-
}
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
|
|
21805
|
-
|
|
22036
|
+
case "prompts_list_changed":
|
|
22037
|
+
return {
|
|
22038
|
+
method: "notifications/prompts/list_changed",
|
|
22039
|
+
...event.params !== void 0 && { params: event.params }
|
|
22040
|
+
};
|
|
22041
|
+
case "resources_list_changed":
|
|
22042
|
+
return {
|
|
22043
|
+
method: "notifications/resources/list_changed",
|
|
22044
|
+
...event.params !== void 0 && { params: event.params }
|
|
22045
|
+
};
|
|
22046
|
+
case "resource_updated":
|
|
22047
|
+
return {
|
|
22048
|
+
method: "notifications/resources/updated",
|
|
22049
|
+
params: {
|
|
22050
|
+
...event.params,
|
|
22051
|
+
uri: event.uri
|
|
22052
|
+
}
|
|
22053
|
+
};
|
|
22054
|
+
}
|
|
22055
|
+
}
|
|
22056
|
+
var DEFAULT_MAX_SUBSCRIPTIONS = 1024;
|
|
22057
|
+
function jsonRpcError(id, code, message) {
|
|
22058
|
+
return Response.json({
|
|
22059
|
+
jsonrpc: "2.0",
|
|
22060
|
+
error: {
|
|
22061
|
+
code,
|
|
22062
|
+
message
|
|
22063
|
+
},
|
|
22064
|
+
id
|
|
22065
|
+
}, { status: 200 });
|
|
22066
|
+
}
|
|
22067
|
+
function stampSubscriptionId(notification, subscriptionId) {
|
|
22068
|
+
return {
|
|
22069
|
+
method: notification.method,
|
|
22070
|
+
params: {
|
|
22071
|
+
...notification.params,
|
|
22072
|
+
_meta: {
|
|
22073
|
+
...notification.params?._meta,
|
|
22074
|
+
[SUBSCRIPTION_ID_META_KEY]: subscriptionId
|
|
21806
22075
|
}
|
|
21807
|
-
if (this._responseMode === "sse" && !this._closed && !this._deferredResponse.settled) this.upgradeToSse();
|
|
21808
|
-
return promise;
|
|
21809
22076
|
}
|
|
21810
|
-
|
|
21811
|
-
|
|
21812
|
-
|
|
21813
|
-
|
|
21814
|
-
|
|
21815
|
-
|
|
21816
|
-
|
|
21817
|
-
|
|
21818
|
-
|
|
21819
|
-
|
|
22077
|
+
};
|
|
22078
|
+
}
|
|
22079
|
+
function parseListenFilter(message) {
|
|
22080
|
+
const outcome = codecForVersion(MODERN_WIRE_REVISION).validateRequest("subscriptions/listen", message);
|
|
22081
|
+
return outcome.ok ? outcome.value.params?.notifications : void 0;
|
|
22082
|
+
}
|
|
22083
|
+
function createListenRouter(options) {
|
|
22084
|
+
const { bus, onerror } = options;
|
|
22085
|
+
const maxSubscriptions = options.maxSubscriptions ?? DEFAULT_MAX_SUBSCRIPTIONS;
|
|
22086
|
+
const keepAliveMs = options.keepAliveMs ?? DEFAULT_SSE_KEEP_ALIVE_MS;
|
|
22087
|
+
const open2 = /* @__PURE__ */ new Set();
|
|
22088
|
+
function serve(message, signal, capabilities, serverInfo) {
|
|
22089
|
+
if (open2.size >= maxSubscriptions) {
|
|
22090
|
+
onerror?.(/* @__PURE__ */ new Error(`subscriptions/listen refused: subscription limit reached (${maxSubscriptions})`));
|
|
22091
|
+
return jsonRpcError(message.id, -32603, "Subscription limit reached");
|
|
21820
22092
|
}
|
|
21821
|
-
|
|
21822
|
-
|
|
21823
|
-
|
|
21824
|
-
|
|
21825
|
-
|
|
21826
|
-
|
|
21827
|
-
|
|
21828
|
-
|
|
21829
|
-
|
|
21830
|
-
|
|
21831
|
-
|
|
21832
|
-
|
|
21833
|
-
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
|
|
21837
|
-
this.finalizeStream();
|
|
21838
|
-
return;
|
|
22093
|
+
const filter = parseListenFilter(message);
|
|
22094
|
+
if (filter === void 0) return jsonRpcError(message.id, -32602, "Invalid params: 'notifications' is required and must be a valid SubscriptionFilter");
|
|
22095
|
+
const honored = honoredSubset(filter, capabilities);
|
|
22096
|
+
const subscriptionId = message.id;
|
|
22097
|
+
const encoder = new TextEncoder();
|
|
22098
|
+
let controller;
|
|
22099
|
+
let closed = false;
|
|
22100
|
+
let unsubscribe;
|
|
22101
|
+
let keepAliveTimer;
|
|
22102
|
+
let abortCleanup;
|
|
22103
|
+
const writeFrame = (frame) => {
|
|
22104
|
+
if (closed) return;
|
|
22105
|
+
try {
|
|
22106
|
+
controller.enqueue(encoder.encode(frame));
|
|
22107
|
+
} catch (error2) {
|
|
22108
|
+
onerror?.(error2 instanceof Error ? error2 : new Error(String(error2)));
|
|
21839
22109
|
}
|
|
21840
|
-
|
|
21841
|
-
|
|
21842
|
-
|
|
21843
|
-
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
|
|
21853
|
-
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
|
|
21857
|
-
|
|
21858
|
-
|
|
22110
|
+
};
|
|
22111
|
+
const writeNotification = (method, params) => {
|
|
22112
|
+
writeFrame(`event: message
|
|
22113
|
+
data: ${JSON.stringify({
|
|
22114
|
+
jsonrpc: "2.0",
|
|
22115
|
+
method,
|
|
22116
|
+
params
|
|
22117
|
+
})}
|
|
22118
|
+
|
|
22119
|
+
`);
|
|
22120
|
+
};
|
|
22121
|
+
const teardown = (graceful) => {
|
|
22122
|
+
if (closed) return;
|
|
22123
|
+
if (graceful) writeFrame(`event: message
|
|
22124
|
+
data: ${JSON.stringify({
|
|
22125
|
+
jsonrpc: "2.0",
|
|
22126
|
+
id: subscriptionId,
|
|
22127
|
+
result: {
|
|
22128
|
+
resultType: "complete",
|
|
22129
|
+
_meta: {
|
|
22130
|
+
[SUBSCRIPTION_ID_META_KEY]: subscriptionId,
|
|
22131
|
+
[SERVER_INFO_META_KEY]: serverInfo
|
|
22132
|
+
}
|
|
22133
|
+
}
|
|
22134
|
+
})}
|
|
21859
22135
|
|
|
21860
22136
|
`);
|
|
21861
|
-
|
|
21862
|
-
async close() {
|
|
21863
|
-
if (this._closed) return;
|
|
21864
|
-
this._closed = true;
|
|
21865
|
-
this._abortCleanup?.();
|
|
21866
|
-
this._abortCleanup = void 0;
|
|
21867
|
-
if (this._sse?.keepAliveTimer !== void 0) clearInterval(this._sse.keepAliveTimer);
|
|
21868
|
-
if (this._sse !== void 0 && !this._sse.closed) {
|
|
21869
|
-
this._sse.closed = true;
|
|
22137
|
+
closed = true;
|
|
21870
22138
|
try {
|
|
21871
|
-
|
|
22139
|
+
unsubscribe?.();
|
|
22140
|
+
} catch (error2) {
|
|
22141
|
+
onerror?.(error2 instanceof Error ? error2 : new Error(String(error2)));
|
|
22142
|
+
}
|
|
22143
|
+
if (keepAliveTimer !== void 0) clearInterval(keepAliveTimer);
|
|
22144
|
+
abortCleanup?.();
|
|
22145
|
+
open2.delete(teardown);
|
|
22146
|
+
try {
|
|
22147
|
+
controller.close();
|
|
21872
22148
|
} catch {
|
|
21873
22149
|
}
|
|
21874
|
-
}
|
|
21875
|
-
if (this._deferredResponse !== void 0 && !this._deferredResponse.settled) {
|
|
21876
|
-
this._deferredResponse.settled = true;
|
|
21877
|
-
this._deferredResponse.reject(new SdkError(SdkErrorCode.ConnectionClosed, "Connection closed before a response was produced"));
|
|
21878
|
-
}
|
|
21879
|
-
this.onclose?.();
|
|
21880
|
-
}
|
|
21881
|
-
settleResponse(response) {
|
|
21882
|
-
if (this._deferredResponse === void 0 || this._deferredResponse.settled) return;
|
|
21883
|
-
this._deferredResponse.settled = true;
|
|
21884
|
-
this._deferredResponse.resolve(response);
|
|
21885
|
-
}
|
|
21886
|
-
upgradeToSse() {
|
|
21887
|
-
let controller;
|
|
22150
|
+
};
|
|
21888
22151
|
const readable = new ReadableStream({
|
|
21889
|
-
start
|
|
22152
|
+
start(streamController) {
|
|
21890
22153
|
controller = streamController;
|
|
22154
|
+
const ack = stampSubscriptionId({
|
|
22155
|
+
method: "notifications/subscriptions/acknowledged",
|
|
22156
|
+
params: { notifications: honored }
|
|
22157
|
+
}, subscriptionId);
|
|
22158
|
+
writeNotification(ack.method, ack.params);
|
|
22159
|
+
if (Object.keys(honored).length === 0) {
|
|
22160
|
+
teardown(true);
|
|
22161
|
+
return;
|
|
22162
|
+
}
|
|
22163
|
+
unsubscribe = bus.subscribe((event) => {
|
|
22164
|
+
if (closed || !listenFilterAccepts(honored, event)) return;
|
|
22165
|
+
const note = stampSubscriptionId(serverEventToNotification(event), subscriptionId);
|
|
22166
|
+
writeNotification(note.method, note.params);
|
|
22167
|
+
});
|
|
22168
|
+
keepAliveTimer = armSseKeepAlive(keepAliveMs, () => writeFrame(": keepalive\n\n"));
|
|
22169
|
+
open2.add(teardown);
|
|
21891
22170
|
},
|
|
21892
|
-
cancel
|
|
21893
|
-
|
|
22171
|
+
cancel() {
|
|
22172
|
+
teardown(false);
|
|
21894
22173
|
}
|
|
21895
22174
|
});
|
|
21896
|
-
|
|
21897
|
-
|
|
21898
|
-
|
|
21899
|
-
|
|
21900
|
-
|
|
21901
|
-
|
|
21902
|
-
|
|
22175
|
+
if (signal !== void 0) if (signal.aborted) teardown(false);
|
|
22176
|
+
else {
|
|
22177
|
+
const onAbort = () => teardown(false);
|
|
22178
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
22179
|
+
abortCleanup = () => signal.removeEventListener("abort", onAbort);
|
|
22180
|
+
}
|
|
22181
|
+
return new Response(readable, {
|
|
21903
22182
|
status: 200,
|
|
21904
22183
|
headers: {
|
|
21905
22184
|
"Content-Type": "text/event-stream",
|
|
@@ -21907,34 +22186,166 @@ var PerRequestHTTPServerTransport = class {
|
|
|
21907
22186
|
Connection: "keep-alive",
|
|
21908
22187
|
"X-Accel-Buffering": "no"
|
|
21909
22188
|
}
|
|
21910
|
-
})
|
|
22189
|
+
});
|
|
21911
22190
|
}
|
|
21912
|
-
|
|
21913
|
-
|
|
21914
|
-
|
|
21915
|
-
|
|
21916
|
-
|
|
21917
|
-
|
|
21918
|
-
|
|
21919
|
-
}
|
|
22191
|
+
return {
|
|
22192
|
+
serve,
|
|
22193
|
+
closeAll() {
|
|
22194
|
+
for (const teardown of open2) teardown(true);
|
|
22195
|
+
},
|
|
22196
|
+
get openCount() {
|
|
22197
|
+
return open2.size;
|
|
21920
22198
|
}
|
|
21921
|
-
|
|
22199
|
+
};
|
|
22200
|
+
}
|
|
22201
|
+
var CHANGE_NOTIFICATION_METHODS = /* @__PURE__ */ new Set([
|
|
22202
|
+
"notifications/tools/list_changed",
|
|
22203
|
+
"notifications/prompts/list_changed",
|
|
22204
|
+
"notifications/resources/list_changed",
|
|
22205
|
+
"notifications/resources/updated"
|
|
22206
|
+
]);
|
|
22207
|
+
var StdioListenRouter = class {
|
|
22208
|
+
/** Active subscriptions, keyed by the listen request's JSON-RPC id verbatim. */
|
|
22209
|
+
_subs = /* @__PURE__ */ new Map();
|
|
22210
|
+
/**
|
|
22211
|
+
* The serving instance's declared capabilities. Filled in by the entry
|
|
22212
|
+
* once the modern instance is constructed (the router is created before
|
|
22213
|
+
* the instance exists), so the acknowledged filter is narrowed against
|
|
22214
|
+
* what the server can actually deliver.
|
|
22215
|
+
*/
|
|
22216
|
+
_serverCapabilities;
|
|
22217
|
+
/**
|
|
22218
|
+
* The serving instance's identity, stamped onto the graceful-close
|
|
22219
|
+
* results' `_meta` (the spec's `SubscriptionsListenResultMetaObject` extends
|
|
22220
|
+
* `ResultMetaObject`). Handed over together with the capabilities.
|
|
22221
|
+
*/
|
|
22222
|
+
_serverInfo;
|
|
22223
|
+
constructor(_maxSubscriptions = DEFAULT_MAX_SUBSCRIPTIONS, serverCapabilities, serverInfo) {
|
|
22224
|
+
this._maxSubscriptions = _maxSubscriptions;
|
|
22225
|
+
this._serverCapabilities = serverCapabilities;
|
|
22226
|
+
this._serverInfo = serverInfo;
|
|
21922
22227
|
}
|
|
21923
|
-
|
|
21924
|
-
|
|
21925
|
-
|
|
21926
|
-
|
|
21927
|
-
`)
|
|
22228
|
+
/**
|
|
22229
|
+
* Record the serving instance's declared capabilities and identity once
|
|
22230
|
+
* it has been constructed. Called by `serveStdio`'s connect path;
|
|
22231
|
+
* subsequent `serve()` calls narrow the honored filter against the
|
|
22232
|
+
* capabilities, and `teardownAll()` stamps the identity.
|
|
22233
|
+
*/
|
|
22234
|
+
setServerCapabilities(capabilities, serverInfo) {
|
|
22235
|
+
this._serverCapabilities = capabilities;
|
|
22236
|
+
if (serverInfo !== void 0) this._serverInfo = serverInfo;
|
|
21928
22237
|
}
|
|
21929
|
-
|
|
21930
|
-
|
|
21931
|
-
|
|
21932
|
-
|
|
21933
|
-
|
|
21934
|
-
|
|
21935
|
-
|
|
22238
|
+
/** Whether `id` is an active listen subscription on this connection. */
|
|
22239
|
+
has(id) {
|
|
22240
|
+
return this._subs.has(id);
|
|
22241
|
+
}
|
|
22242
|
+
/**
|
|
22243
|
+
* Serve one inbound `subscriptions/listen` request: registers the
|
|
22244
|
+
* subscription and returns the stamped acknowledged notification (or, on
|
|
22245
|
+
* capacity / params rejection, the in-band JSON-RPC error response).
|
|
22246
|
+
*
|
|
22247
|
+
* @throws when called before {@linkcode setServerCapabilities} (or the
|
|
22248
|
+
* constructor) has supplied the serving instance's capabilities. Honoring a
|
|
22249
|
+
* filter without knowing the server's advertised capabilities would fail
|
|
22250
|
+
* open (deliver unadvertised types); the entry guarantees capabilities are
|
|
22251
|
+
* set before any listen request is routed here.
|
|
22252
|
+
*/
|
|
22253
|
+
serve(message) {
|
|
22254
|
+
if (this._serverCapabilities === void 0) throw new Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");
|
|
22255
|
+
if (this._subs.size >= this._maxSubscriptions) return {
|
|
22256
|
+
jsonrpc: "2.0",
|
|
22257
|
+
id: message.id,
|
|
22258
|
+
error: {
|
|
22259
|
+
code: -32603,
|
|
22260
|
+
message: "Subscription limit reached"
|
|
22261
|
+
}
|
|
22262
|
+
};
|
|
22263
|
+
const filter = parseListenFilter(message);
|
|
22264
|
+
if (filter === void 0) return {
|
|
22265
|
+
jsonrpc: "2.0",
|
|
22266
|
+
id: message.id,
|
|
22267
|
+
error: {
|
|
22268
|
+
code: -32602,
|
|
22269
|
+
message: "Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"
|
|
22270
|
+
}
|
|
22271
|
+
};
|
|
22272
|
+
const honored = honoredSubset(filter, this._serverCapabilities);
|
|
22273
|
+
this._subs.set(message.id, honored);
|
|
22274
|
+
return stampSubscriptionId({
|
|
22275
|
+
method: "notifications/subscriptions/acknowledged",
|
|
22276
|
+
params: { notifications: honored }
|
|
22277
|
+
}, message.id);
|
|
22278
|
+
}
|
|
22279
|
+
/**
|
|
22280
|
+
* Tear down one subscription (inbound `notifications/cancelled`). Returns
|
|
22281
|
+
* `true` when a subscription was removed. After this call NOTHING further
|
|
22282
|
+
* is delivered for that subscription id (the post-cancel hardening).
|
|
22283
|
+
*/
|
|
22284
|
+
cancel(id) {
|
|
22285
|
+
return this._subs.delete(id);
|
|
22286
|
+
}
|
|
22287
|
+
/**
|
|
22288
|
+
* Route an outbound notification through the active subscriptions.
|
|
22289
|
+
*
|
|
22290
|
+
* - For a subscription-gated change notification, returns one stamped copy
|
|
22291
|
+
* per subscription that opted in to it (an empty array means it is
|
|
22292
|
+
* dropped — the modern era never delivers an un-requested change type).
|
|
22293
|
+
* - For any other outbound message, returns `'passthrough'` (the entry
|
|
22294
|
+
* forwards it as-is).
|
|
22295
|
+
*/
|
|
22296
|
+
routeOutbound(message) {
|
|
22297
|
+
if (!CHANGE_NOTIFICATION_METHODS.has(message.method)) return "passthrough";
|
|
22298
|
+
const uriParam = message.params?.["uri"];
|
|
22299
|
+
const uri = typeof uriParam === "string" ? uriParam : void 0;
|
|
22300
|
+
const event = notificationToServerEvent(message.method, uri);
|
|
22301
|
+
const out = [];
|
|
22302
|
+
for (const [subscriptionId, filter] of this._subs) if (listenFilterAccepts(filter, event)) out.push(stampSubscriptionId({
|
|
22303
|
+
method: message.method,
|
|
22304
|
+
params: message.params ?? {}
|
|
22305
|
+
}, subscriptionId));
|
|
22306
|
+
return out;
|
|
22307
|
+
}
|
|
22308
|
+
/**
|
|
22309
|
+
* Server-side graceful teardown of every active subscription: returns the
|
|
22310
|
+
* empty `subscriptions/listen` JSON-RPC result for each subscription id —
|
|
22311
|
+
* the spec's graceful-close signal, `_meta` carrying the subscription id
|
|
22312
|
+
* and the serving instance's identity — for the entry to emit before
|
|
22313
|
+
* closing the wire. Clears the set so nothing further is delivered.
|
|
22314
|
+
*/
|
|
22315
|
+
teardownAll() {
|
|
22316
|
+
const out = [];
|
|
22317
|
+
for (const id of this._subs.keys()) out.push({
|
|
22318
|
+
jsonrpc: "2.0",
|
|
22319
|
+
id,
|
|
22320
|
+
result: {
|
|
22321
|
+
resultType: "complete",
|
|
22322
|
+
_meta: {
|
|
22323
|
+
[SUBSCRIPTION_ID_META_KEY]: id,
|
|
22324
|
+
...this._serverInfo !== void 0 && { [SERVER_INFO_META_KEY]: this._serverInfo }
|
|
22325
|
+
}
|
|
22326
|
+
}
|
|
22327
|
+
});
|
|
22328
|
+
this._subs.clear();
|
|
22329
|
+
return out;
|
|
21936
22330
|
}
|
|
21937
22331
|
};
|
|
22332
|
+
function notificationToServerEvent(method, uri) {
|
|
22333
|
+
switch (method) {
|
|
22334
|
+
case "notifications/tools/list_changed":
|
|
22335
|
+
return { kind: "tools_list_changed" };
|
|
22336
|
+
case "notifications/prompts/list_changed":
|
|
22337
|
+
return { kind: "prompts_list_changed" };
|
|
22338
|
+
case "notifications/resources/list_changed":
|
|
22339
|
+
return { kind: "resources_list_changed" };
|
|
22340
|
+
default:
|
|
22341
|
+
return {
|
|
22342
|
+
kind: "resource_updated",
|
|
22343
|
+
uri: uri ?? ""
|
|
22344
|
+
};
|
|
22345
|
+
}
|
|
22346
|
+
}
|
|
22347
|
+
|
|
22348
|
+
// node_modules/.pnpm/@modelcontextprotocol+server@2.4.0/node_modules/@modelcontextprotocol/server/dist/index.mjs
|
|
21938
22349
|
async function invoke(server, message, ctx) {
|
|
21939
22350
|
const transport = new PerRequestHTTPServerTransport({
|
|
21940
22351
|
classification: ctx.classification,
|
|
@@ -22660,7 +23071,10 @@ function jsonRpcErrorResponse(httpStatus, code, message, data, id = null) {
|
|
|
22660
23071
|
...data !== void 0 && { data }
|
|
22661
23072
|
},
|
|
22662
23073
|
id
|
|
22663
|
-
}, {
|
|
23074
|
+
}, {
|
|
23075
|
+
status: httpStatus,
|
|
23076
|
+
...httpStatus === 405 && { headers: { Allow: "POST" } }
|
|
23077
|
+
});
|
|
22664
23078
|
}
|
|
22665
23079
|
function rejectionResponse(rejection2, id = null) {
|
|
22666
23080
|
return jsonRpcErrorResponse(rejection2.httpStatus, rejection2.code, rejection2.message, rejection2.data, id);
|
|
@@ -22867,7 +23281,7 @@ function createMcpHandler(factory, options = {}) {
|
|
|
22867
23281
|
const inputSchema = toolName === void 0 ? void 0 : product.toolInputSchemaJson(toolName);
|
|
22868
23282
|
if (inputSchema !== void 0) {
|
|
22869
23283
|
const scan = scanXMcpHeaderDeclarations(inputSchema);
|
|
22870
|
-
if (scan.
|
|
23284
|
+
if (scan.declarations !== void 0 && scan.declarations.length > 0) {
|
|
22871
23285
|
const rejection2 = validateMcpParamHeaders(scan.declarations, callParams?.arguments, request.headers);
|
|
22872
23286
|
if (rejection2 !== void 0) {
|
|
22873
23287
|
product.close().catch(reportError);
|
|
@@ -22986,7 +23400,7 @@ function createMcpHandler(factory, options = {}) {
|
|
|
22986
23400
|
};
|
|
22987
23401
|
}
|
|
22988
23402
|
|
|
22989
|
-
// node_modules/.pnpm/@modelcontextprotocol+server@2.
|
|
23403
|
+
// node_modules/.pnpm/@modelcontextprotocol+server@2.4.0/node_modules/@modelcontextprotocol/server/dist/stdio.mjs
|
|
22990
23404
|
var swallowsErrorsAfterClose = /* @__PURE__ */ Symbol("swallowsErrorsAfterClose");
|
|
22991
23405
|
var StdioServerTransport = class {
|
|
22992
23406
|
_readBuffer;
|
|
@@ -23484,7 +23898,7 @@ function toError2(value) {
|
|
|
23484
23898
|
return value instanceof Error ? value : new Error(String(value));
|
|
23485
23899
|
}
|
|
23486
23900
|
|
|
23487
|
-
// node_modules/.pnpm/mcporter@0.
|
|
23901
|
+
// node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/dist/serve.js
|
|
23488
23902
|
var TOOL_SEPARATOR = "__";
|
|
23489
23903
|
var DEFAULT_OBJECT_SCHEMA = { type: "object" };
|
|
23490
23904
|
var DEFAULT_SERVE_HTTP_HOST = "127.0.0.1";
|
|
@@ -23768,7 +24182,7 @@ function describeError(error2) {
|
|
|
23768
24182
|
return error2 instanceof Error ? error2.message : String(error2);
|
|
23769
24183
|
}
|
|
23770
24184
|
|
|
23771
|
-
// node_modules/.pnpm/mcporter@0.
|
|
24185
|
+
// node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/dist/cli/serve-command.js
|
|
23772
24186
|
async function handleServeCli(args, options) {
|
|
23773
24187
|
const parsed = parseServeArgs(args);
|
|
23774
24188
|
const elicitation = createNonInteractiveElicitationResponder({
|