ofw-mcp 2.24.0 → 2.25.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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +3 -3
- package/dist/bundle.js +1035 -324
- package/dist/config.js +4 -3
- package/dist/sync.js +10 -1
- package/dist/tools/messages.js +131 -10
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/server.json +3 -3
- package/skills/ofw/SKILL.md +1 -1
package/dist/bundle.js
CHANGED
|
@@ -3775,7 +3775,7 @@ function callerAcceptsFormElicitation(ctx) {
|
|
|
3775
3775
|
return namedModes.length === 0 || namedModes.includes("form");
|
|
3776
3776
|
}
|
|
3777
3777
|
|
|
3778
|
-
// node_modules/@modelcontextprotocol/server/dist/chunk-
|
|
3778
|
+
// node_modules/@modelcontextprotocol/server/dist/chunk-vYduTEsO.mjs
|
|
3779
3779
|
var __create2 = Object.create;
|
|
3780
3780
|
var __defProp2 = Object.defineProperty;
|
|
3781
3781
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -3815,7 +3815,7 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__
|
|
|
3815
3815
|
enumerable: true
|
|
3816
3816
|
}) : target, mod));
|
|
3817
3817
|
|
|
3818
|
-
// node_modules/@modelcontextprotocol/server/dist/dialects-
|
|
3818
|
+
// node_modules/@modelcontextprotocol/server/dist/dialects-CDpMbily.mjs
|
|
3819
3819
|
var DRAFT_2020_12_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2020-12/schema", "http://json-schema.org/draft/2020-12/schema"]);
|
|
3820
3820
|
var DRAFT_2019_09_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2019-09/schema", "http://json-schema.org/draft/2019-09/schema"]);
|
|
3821
3821
|
var DRAFT_07_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft-07/schema", "http://json-schema.org/draft-07/schema"]);
|
|
@@ -23549,7 +23549,7 @@ function date4(params) {
|
|
|
23549
23549
|
return _coercedDate(ZodDate, params);
|
|
23550
23550
|
}
|
|
23551
23551
|
|
|
23552
|
-
// node_modules/@modelcontextprotocol/
|
|
23552
|
+
// node_modules/@modelcontextprotocol/core/dist/schemas-DscsoNZN.mjs
|
|
23553
23553
|
var LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
23554
23554
|
var SUPPORTED_PROTOCOL_VERSIONS = [
|
|
23555
23555
|
LATEST_PROTOCOL_VERSION,
|
|
@@ -24337,6 +24337,8 @@ var ServerResultSchema = union([
|
|
|
24337
24337
|
ListToolsResultSchema,
|
|
24338
24338
|
SubscriptionsListenResultSchema
|
|
24339
24339
|
]);
|
|
24340
|
+
|
|
24341
|
+
// node_modules/@modelcontextprotocol/core/dist/auth-UMQCo-ad.mjs
|
|
24340
24342
|
var SafeUrlSchema = url().superRefine((val, ctx) => {
|
|
24341
24343
|
if (!URL.canParse(val)) {
|
|
24342
24344
|
ctx.addIssue({
|
|
@@ -24490,7 +24492,7 @@ var OAuthTokenRevocationRequestSchema = object({
|
|
|
24490
24492
|
token_type_hint: string2().optional()
|
|
24491
24493
|
}).strip();
|
|
24492
24494
|
|
|
24493
|
-
// node_modules/@modelcontextprotocol/server/dist/src-
|
|
24495
|
+
// node_modules/@modelcontextprotocol/server/dist/src-DdvbAHrR.mjs
|
|
24494
24496
|
var BRANDS = /* @__PURE__ */ Symbol.for("mcp.sdk.errorBrands");
|
|
24495
24497
|
function stampErrorBrands(instance, ctor) {
|
|
24496
24498
|
const brands = /* @__PURE__ */ new Set();
|
|
@@ -27449,12 +27451,12 @@ var RFC9110_TOKEN = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
|
27449
27451
|
var PERMITTED_X_MCP_HEADER_TYPES = /* @__PURE__ */ new Set([
|
|
27450
27452
|
"string",
|
|
27451
27453
|
"integer",
|
|
27452
|
-
"boolean"
|
|
27453
|
-
"number"
|
|
27454
|
+
"boolean"
|
|
27454
27455
|
]);
|
|
27455
27456
|
function scanXMcpHeaderDeclarations(inputSchema) {
|
|
27456
27457
|
const declarations = [];
|
|
27457
27458
|
const seenLower = /* @__PURE__ */ new Map();
|
|
27459
|
+
let numberFault;
|
|
27458
27460
|
const visit2 = (node2, path, reachable) => {
|
|
27459
27461
|
if (node2 === null || typeof node2 !== "object") return void 0;
|
|
27460
27462
|
const schema = node2;
|
|
@@ -27464,7 +27466,11 @@ function scanXMcpHeaderDeclarations(inputSchema) {
|
|
|
27464
27466
|
if (typeof raw !== "string" || raw.length === 0) return `${pathName(path)}: x-mcp-header MUST be a non-empty string`;
|
|
27465
27467
|
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)`;
|
|
27466
27468
|
const type = typeof schema.type === "string" ? schema.type : void 0;
|
|
27467
|
-
if (type === void 0 || !PERMITTED_X_MCP_HEADER_TYPES.has(type))
|
|
27469
|
+
if (type === void 0 || !PERMITTED_X_MCP_HEADER_TYPES.has(type)) {
|
|
27470
|
+
const fault$1 = `${pathName(path)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${type ?? "<none>"}`;
|
|
27471
|
+
if (type !== "number") return fault$1;
|
|
27472
|
+
numberFault ??= fault$1;
|
|
27473
|
+
}
|
|
27468
27474
|
const lower = raw.toLowerCase();
|
|
27469
27475
|
const prior = seenLower.get(lower);
|
|
27470
27476
|
if (prior !== void 0) return `x-mcp-header '${raw}' is not case-insensitively unique (also declared as '${prior}')`;
|
|
@@ -27491,12 +27497,17 @@ function scanXMcpHeaderDeclarations(inputSchema) {
|
|
|
27491
27497
|
}
|
|
27492
27498
|
};
|
|
27493
27499
|
const fault = visit2(inputSchema, [], true);
|
|
27494
|
-
|
|
27500
|
+
if (fault !== void 0) return {
|
|
27501
|
+
valid: false,
|
|
27502
|
+
reason: numberFault ?? fault
|
|
27503
|
+
};
|
|
27504
|
+
return numberFault === void 0 ? {
|
|
27495
27505
|
valid: true,
|
|
27496
27506
|
declarations
|
|
27497
27507
|
} : {
|
|
27498
27508
|
valid: false,
|
|
27499
|
-
reason:
|
|
27509
|
+
reason: numberFault,
|
|
27510
|
+
declarations
|
|
27500
27511
|
};
|
|
27501
27512
|
}
|
|
27502
27513
|
var NON_REACHABLE_SUBSCHEMA_KEYWORDS = [
|
|
@@ -27697,15 +27708,18 @@ function standardSchemaToJsonSchema(schema, io = "input") {
|
|
|
27697
27708
|
...result
|
|
27698
27709
|
};
|
|
27699
27710
|
}
|
|
27700
|
-
|
|
27711
|
+
var LOCAL_DEFINITION_REF = /^#\/(\$defs|definitions)\/([^/~%]+)$/;
|
|
27712
|
+
function isProvablyObjectShapedRoot(schema, root = schema) {
|
|
27701
27713
|
if ("properties" in schema || "patternProperties" in schema || "additionalProperties" in schema || "required" in schema) return true;
|
|
27714
|
+
const ref = typeof schema.$ref === "string" && LOCAL_DEFINITION_REF.exec(schema.$ref);
|
|
27715
|
+
if (ref && root[ref[1]]?.[ref[2]]?.type === "object") return true;
|
|
27702
27716
|
for (const key of [
|
|
27703
27717
|
"oneOf",
|
|
27704
27718
|
"anyOf",
|
|
27705
27719
|
"allOf"
|
|
27706
27720
|
]) {
|
|
27707
27721
|
const members2 = schema[key];
|
|
27708
|
-
if (Array.isArray(members2) && members2.length > 0) return members2.every((m) => m !== null && typeof m === "object" && (m.type === "object" || isProvablyObjectShapedRoot(m)));
|
|
27722
|
+
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)));
|
|
27709
27723
|
}
|
|
27710
27724
|
return false;
|
|
27711
27725
|
}
|
|
@@ -29180,7 +29194,7 @@ function normalizeRawShapeSchema(schema) {
|
|
|
29180
29194
|
return schema;
|
|
29181
29195
|
}
|
|
29182
29196
|
|
|
29183
|
-
// node_modules/@modelcontextprotocol/server/dist/ajvProvider-
|
|
29197
|
+
// node_modules/@modelcontextprotocol/server/dist/ajvProvider-DyjnscPj.mjs
|
|
29184
29198
|
var require_code$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
29185
29199
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29186
29200
|
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;
|
|
@@ -31862,6 +31876,22 @@ var require_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31862
31876
|
var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
31863
31877
|
const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
31864
31878
|
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);
|
|
31879
|
+
const isPort = RegExp.prototype.test.bind(/^\d*$/u);
|
|
31880
|
+
const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
31881
|
+
const isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
31882
|
+
const isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
|
|
31883
|
+
const isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
|
|
31884
|
+
const isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
|
|
31885
|
+
const BYTE_HEX = new Array(256);
|
|
31886
|
+
{
|
|
31887
|
+
const HEX_DIGITS = "0123456789ABCDEF";
|
|
31888
|
+
for (let i = 0; i < 256; i++) BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
|
|
31889
|
+
}
|
|
31890
|
+
function percentEncodeNonAscii(cp) {
|
|
31891
|
+
if (cp < 2048) return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
|
|
31892
|
+
if (cp < 65536) return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
31893
|
+
return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
31894
|
+
}
|
|
31865
31895
|
function stringArrayToHexStripped(input2) {
|
|
31866
31896
|
let acc = "";
|
|
31867
31897
|
let code2 = 0;
|
|
@@ -31880,83 +31910,120 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
31880
31910
|
}
|
|
31881
31911
|
return acc;
|
|
31882
31912
|
}
|
|
31913
|
+
const isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
|
|
31914
|
+
const isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
|
|
31915
|
+
const isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
|
|
31883
31916
|
const nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
31884
|
-
function
|
|
31885
|
-
|
|
31886
|
-
|
|
31887
|
-
|
|
31888
|
-
|
|
31889
|
-
|
|
31890
|
-
|
|
31891
|
-
if (hex3 !== "") address.push(hex3);
|
|
31892
|
-
else {
|
|
31893
|
-
output2.error = true;
|
|
31894
|
-
return false;
|
|
31917
|
+
function isZoneIdentifier(zone) {
|
|
31918
|
+
if (zone.length === 0) return false;
|
|
31919
|
+
for (let i = 0; i < zone.length; i++) {
|
|
31920
|
+
if (isZoneCharacter(zone[i])) continue;
|
|
31921
|
+
if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
|
|
31922
|
+
i += 2;
|
|
31923
|
+
continue;
|
|
31895
31924
|
}
|
|
31896
|
-
|
|
31925
|
+
return false;
|
|
31897
31926
|
}
|
|
31898
31927
|
return true;
|
|
31899
31928
|
}
|
|
31900
|
-
function
|
|
31901
|
-
let
|
|
31902
|
-
|
|
31903
|
-
|
|
31904
|
-
|
|
31905
|
-
|
|
31906
|
-
|
|
31907
|
-
|
|
31908
|
-
|
|
31909
|
-
|
|
31910
|
-
|
|
31911
|
-
|
|
31912
|
-
|
|
31913
|
-
|
|
31914
|
-
|
|
31915
|
-
|
|
31916
|
-
|
|
31917
|
-
|
|
31918
|
-
|
|
31919
|
-
|
|
31920
|
-
|
|
31921
|
-
|
|
31922
|
-
|
|
31923
|
-
|
|
31924
|
-
|
|
31925
|
-
|
|
31926
|
-
|
|
31927
|
-
|
|
31928
|
-
|
|
31929
|
-
|
|
31929
|
+
function compressIPv6ZeroRun(hextets) {
|
|
31930
|
+
let bestStart = -1;
|
|
31931
|
+
let bestLength = 0;
|
|
31932
|
+
let runStart = -1;
|
|
31933
|
+
let runLength = 0;
|
|
31934
|
+
for (let i = 0; i < hextets.length; i++) if (hextets[i] === "0") {
|
|
31935
|
+
if (runStart === -1) runStart = i;
|
|
31936
|
+
runLength++;
|
|
31937
|
+
if (runLength > bestLength) {
|
|
31938
|
+
bestLength = runLength;
|
|
31939
|
+
bestStart = runStart;
|
|
31940
|
+
}
|
|
31941
|
+
} else {
|
|
31942
|
+
runStart = -1;
|
|
31943
|
+
runLength = 0;
|
|
31944
|
+
}
|
|
31945
|
+
if (bestLength < 2) return hextets.join(":");
|
|
31946
|
+
const head = hextets.slice(0, bestStart).join(":");
|
|
31947
|
+
const tail = hextets.slice(bestStart + bestLength).join(":");
|
|
31948
|
+
return head + "::" + tail;
|
|
31949
|
+
}
|
|
31950
|
+
function normalizeIPv6Address(input2) {
|
|
31951
|
+
const compression = input2.indexOf("::");
|
|
31952
|
+
if (compression !== -1 && input2.indexOf("::", compression + 1) !== -1) return void 0;
|
|
31953
|
+
const left = compression === -1 ? input2.split(":") : input2.slice(0, compression).split(":");
|
|
31954
|
+
const right = compression === -1 ? [] : input2.slice(compression + 2).split(":");
|
|
31955
|
+
if (compression !== -1) {
|
|
31956
|
+
if (left.length === 1 && left[0] === "") left.length = 0;
|
|
31957
|
+
if (right.length === 1 && right[0] === "") right.length = 0;
|
|
31958
|
+
}
|
|
31959
|
+
const parts = left.concat(right);
|
|
31960
|
+
let hextetCount = 0;
|
|
31961
|
+
for (let i = 0; i < parts.length; i++) {
|
|
31962
|
+
const part = parts[i];
|
|
31963
|
+
if (part === "") return void 0;
|
|
31964
|
+
if (part.indexOf(".") !== -1) {
|
|
31965
|
+
if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
|
|
31966
|
+
hextetCount += 2;
|
|
31930
31967
|
continue;
|
|
31931
31968
|
}
|
|
31969
|
+
if (!isHextet(part)) return void 0;
|
|
31970
|
+
parts[i] = parseInt(part, 16).toString(16);
|
|
31971
|
+
hextetCount++;
|
|
31932
31972
|
}
|
|
31933
|
-
if (
|
|
31934
|
-
|
|
31935
|
-
|
|
31936
|
-
|
|
31937
|
-
return
|
|
31973
|
+
if (compression === -1) {
|
|
31974
|
+
if (hextetCount !== 8) return void 0;
|
|
31975
|
+
return compressIPv6ZeroRun(parts);
|
|
31976
|
+
}
|
|
31977
|
+
if (hextetCount >= 8) return void 0;
|
|
31978
|
+
const expanded = parts.slice(0, left.length);
|
|
31979
|
+
for (let i = hextetCount; i < 8; i++) expanded.push("0");
|
|
31980
|
+
for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
|
|
31981
|
+
return compressIPv6ZeroRun(expanded);
|
|
31938
31982
|
}
|
|
31939
31983
|
function normalizeIPv6(host) {
|
|
31940
|
-
|
|
31984
|
+
const bracketed = host[0] === "[" && host[host.length - 1] === "]";
|
|
31985
|
+
if ((host[0] === "[" || host[host.length - 1] === "]") && !bracketed) return {
|
|
31941
31986
|
host,
|
|
31942
|
-
isIPV6: false
|
|
31987
|
+
isIPV6: false,
|
|
31988
|
+
error: true
|
|
31943
31989
|
};
|
|
31944
|
-
|
|
31945
|
-
if (
|
|
31946
|
-
|
|
31947
|
-
let escapedHost = ipv63.address;
|
|
31948
|
-
if (ipv63.zone) {
|
|
31949
|
-
newHost += "%" + ipv63.zone;
|
|
31950
|
-
escapedHost += "%25" + ipv63.zone;
|
|
31951
|
-
}
|
|
31990
|
+
let input2 = bracketed ? host.slice(1, -1) : host;
|
|
31991
|
+
if (bracketed && isIPvFuture(input2)) {
|
|
31992
|
+
input2 = input2.toLowerCase();
|
|
31952
31993
|
return {
|
|
31953
|
-
host:
|
|
31954
|
-
|
|
31955
|
-
|
|
31994
|
+
host: `[${input2}]`,
|
|
31995
|
+
escapedHost: input2,
|
|
31996
|
+
isIPV6: false,
|
|
31997
|
+
isIPVFuture: true
|
|
31998
|
+
};
|
|
31999
|
+
}
|
|
32000
|
+
if (findToken(input2, ":") < 2) return {
|
|
32001
|
+
host,
|
|
32002
|
+
isIPV6: false,
|
|
32003
|
+
error: bracketed
|
|
32004
|
+
};
|
|
32005
|
+
let zoneIdentifier = "";
|
|
32006
|
+
const zoneSeparator = input2.indexOf("%");
|
|
32007
|
+
if (zoneSeparator !== -1) {
|
|
32008
|
+
const separatorLength = input2.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
|
|
32009
|
+
zoneIdentifier = input2.slice(zoneSeparator + separatorLength);
|
|
32010
|
+
if (!isZoneIdentifier(zoneIdentifier)) return {
|
|
32011
|
+
host,
|
|
32012
|
+
isIPV6: false,
|
|
32013
|
+
error: true
|
|
31956
32014
|
};
|
|
31957
|
-
|
|
32015
|
+
input2 = input2.slice(0, zoneSeparator);
|
|
32016
|
+
}
|
|
32017
|
+
const address = normalizeIPv6Address(input2);
|
|
32018
|
+
if (address === void 0) return {
|
|
31958
32019
|
host,
|
|
31959
|
-
isIPV6: false
|
|
32020
|
+
isIPV6: false,
|
|
32021
|
+
error: true
|
|
32022
|
+
};
|
|
32023
|
+
return {
|
|
32024
|
+
host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
|
|
32025
|
+
escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
|
|
32026
|
+
isIPV6: true
|
|
31960
32027
|
};
|
|
31961
32028
|
}
|
|
31962
32029
|
function findToken(str, token) {
|
|
@@ -32032,41 +32099,225 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32032
32099
|
}
|
|
32033
32100
|
return output2.join("");
|
|
32034
32101
|
}
|
|
32035
|
-
|
|
32036
|
-
|
|
32037
|
-
|
|
32038
|
-
|
|
32039
|
-
|
|
32040
|
-
|
|
32041
|
-
|
|
32042
|
-
|
|
32043
|
-
|
|
32102
|
+
const HOST_DELIMS = {
|
|
32103
|
+
"@": "%40",
|
|
32104
|
+
"/": "%2F",
|
|
32105
|
+
"?": "%3F",
|
|
32106
|
+
"#": "%23",
|
|
32107
|
+
":": "%3A"
|
|
32108
|
+
};
|
|
32109
|
+
const HOST_DELIM_RE = /[@/?#:]/g;
|
|
32110
|
+
const HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
|
|
32111
|
+
function reescapeHostDelimiters(host, isIP2) {
|
|
32112
|
+
const re = isIP2 ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
|
|
32113
|
+
re.lastIndex = 0;
|
|
32114
|
+
return host.replace(re, (ch) => HOST_DELIMS[ch]);
|
|
32115
|
+
}
|
|
32116
|
+
function normalizePercentEncoding(input2, decodeUnreserved = false) {
|
|
32117
|
+
if (input2.indexOf("%") === -1) return input2;
|
|
32118
|
+
let output2 = "";
|
|
32119
|
+
for (let i = 0; i < input2.length; i++) {
|
|
32120
|
+
if (input2[i] === "%" && i + 2 < input2.length) {
|
|
32121
|
+
const hex3 = input2.slice(i + 1, i + 3);
|
|
32122
|
+
if (isHexPair(hex3)) {
|
|
32123
|
+
const normalizedHex = hex3.toUpperCase();
|
|
32124
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
32125
|
+
if (decodeUnreserved && isUnreserved(decoded)) output2 += decoded;
|
|
32126
|
+
else output2 += "%" + normalizedHex;
|
|
32127
|
+
i += 2;
|
|
32128
|
+
continue;
|
|
32129
|
+
}
|
|
32130
|
+
}
|
|
32131
|
+
output2 += input2[i];
|
|
32132
|
+
}
|
|
32133
|
+
return output2;
|
|
32134
|
+
}
|
|
32135
|
+
function normalizePathEncoding(input2) {
|
|
32136
|
+
let output2 = "";
|
|
32137
|
+
for (let i = 0; i < input2.length; i++) {
|
|
32138
|
+
const ch = input2[i];
|
|
32139
|
+
if (ch === "%" && i + 2 < input2.length) {
|
|
32140
|
+
const hex3 = input2.slice(i + 1, i + 3);
|
|
32141
|
+
if (isHexPair(hex3)) {
|
|
32142
|
+
const normalizedHex = hex3.toUpperCase();
|
|
32143
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
32144
|
+
if (decoded !== "." && isUnreserved(decoded)) output2 += decoded;
|
|
32145
|
+
else output2 += "%" + normalizedHex;
|
|
32146
|
+
i += 2;
|
|
32147
|
+
continue;
|
|
32148
|
+
}
|
|
32149
|
+
}
|
|
32150
|
+
if (isPathCharacter(ch)) output2 += ch;
|
|
32151
|
+
else {
|
|
32152
|
+
const code2 = input2.charCodeAt(i);
|
|
32153
|
+
if (code2 < 128) output2 += isEscapeSafe(code2) ? ch : BYTE_HEX[code2];
|
|
32154
|
+
else if (code2 < 55296 || code2 > 57343) output2 += percentEncodeNonAscii(code2);
|
|
32155
|
+
else if (code2 <= 56319 && i + 1 < input2.length) {
|
|
32156
|
+
const low = input2.charCodeAt(i + 1);
|
|
32157
|
+
if (low >= 56320 && low <= 57343) {
|
|
32158
|
+
output2 += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
|
|
32159
|
+
i++;
|
|
32160
|
+
} else output2 += percentEncodeNonAscii(65533);
|
|
32161
|
+
} else output2 += percentEncodeNonAscii(65533);
|
|
32162
|
+
}
|
|
32163
|
+
}
|
|
32164
|
+
return output2;
|
|
32165
|
+
}
|
|
32166
|
+
function serializePathEncoding(input2, pathNoScheme = false) {
|
|
32167
|
+
let output2 = "";
|
|
32168
|
+
let firstSegment = pathNoScheme && input2[0] !== "/";
|
|
32169
|
+
for (let i = 0; i < input2.length; i++) {
|
|
32170
|
+
const ch = input2[i];
|
|
32171
|
+
if (ch === "%" && i + 2 < input2.length) {
|
|
32172
|
+
const hex3 = input2.slice(i + 1, i + 3);
|
|
32173
|
+
if (isHexPair(hex3)) {
|
|
32174
|
+
output2 += "%" + hex3.toUpperCase();
|
|
32175
|
+
i += 2;
|
|
32176
|
+
continue;
|
|
32177
|
+
}
|
|
32178
|
+
}
|
|
32179
|
+
if (ch === "/") firstSegment = false;
|
|
32180
|
+
if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) output2 += ch;
|
|
32181
|
+
else {
|
|
32182
|
+
const code2 = input2.charCodeAt(i);
|
|
32183
|
+
if (code2 < 128) output2 += BYTE_HEX[code2];
|
|
32184
|
+
else if (code2 < 55296 || code2 > 57343) output2 += percentEncodeNonAscii(code2);
|
|
32185
|
+
else if (code2 <= 56319 && i + 1 < input2.length) {
|
|
32186
|
+
const low = input2.charCodeAt(i + 1);
|
|
32187
|
+
if (low >= 56320 && low <= 57343) {
|
|
32188
|
+
output2 += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
|
|
32189
|
+
i++;
|
|
32190
|
+
} else output2 += percentEncodeNonAscii(65533);
|
|
32191
|
+
} else output2 += percentEncodeNonAscii(65533);
|
|
32192
|
+
}
|
|
32193
|
+
}
|
|
32194
|
+
return output2;
|
|
32195
|
+
}
|
|
32196
|
+
function encodeComponent(input2, isAllowed) {
|
|
32197
|
+
let output2 = "";
|
|
32198
|
+
for (let i = 0; i < input2.length; i++) {
|
|
32199
|
+
const ch = input2[i];
|
|
32200
|
+
if (ch === "%" && i + 2 < input2.length) {
|
|
32201
|
+
const hex3 = input2.slice(i + 1, i + 3);
|
|
32202
|
+
if (isHexPair(hex3)) {
|
|
32203
|
+
output2 += "%" + hex3.toUpperCase();
|
|
32204
|
+
i += 2;
|
|
32205
|
+
continue;
|
|
32206
|
+
}
|
|
32207
|
+
}
|
|
32208
|
+
if (isAllowed(ch)) output2 += ch;
|
|
32209
|
+
else {
|
|
32210
|
+
const code2 = input2.charCodeAt(i);
|
|
32211
|
+
if (code2 < 128) output2 += BYTE_HEX[code2];
|
|
32212
|
+
else if (code2 < 55296 || code2 > 57343) output2 += percentEncodeNonAscii(code2);
|
|
32213
|
+
else if (code2 <= 56319 && i + 1 < input2.length) {
|
|
32214
|
+
const low = input2.charCodeAt(i + 1);
|
|
32215
|
+
if (low >= 56320 && low <= 57343) {
|
|
32216
|
+
output2 += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
|
|
32217
|
+
i++;
|
|
32218
|
+
} else output2 += percentEncodeNonAscii(65533);
|
|
32219
|
+
} else output2 += percentEncodeNonAscii(65533);
|
|
32220
|
+
}
|
|
32221
|
+
}
|
|
32222
|
+
return output2;
|
|
32223
|
+
}
|
|
32224
|
+
function encodeUserinfo(input2) {
|
|
32225
|
+
return encodeComponent(input2, isUserinfoCharacter);
|
|
32226
|
+
}
|
|
32227
|
+
function encodeQuery(input2) {
|
|
32228
|
+
return encodeComponent(input2, isQueryFragmentCharacter);
|
|
32229
|
+
}
|
|
32230
|
+
function encodeFragment(input2) {
|
|
32231
|
+
return encodeComponent(input2, isQueryFragmentCharacter);
|
|
32232
|
+
}
|
|
32233
|
+
function isEscapeSafe(cp) {
|
|
32234
|
+
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;
|
|
32235
|
+
}
|
|
32236
|
+
function normalizeQueryFragmentEncoding(input2) {
|
|
32237
|
+
let output2 = "";
|
|
32238
|
+
for (let i = 0; i < input2.length; i++) {
|
|
32239
|
+
const ch = input2[i];
|
|
32240
|
+
if (ch === "%" && i + 2 < input2.length) {
|
|
32241
|
+
const hex3 = input2.slice(i + 1, i + 3);
|
|
32242
|
+
if (isHexPair(hex3)) {
|
|
32243
|
+
const normalizedHex = hex3.toUpperCase();
|
|
32244
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
32245
|
+
if (isUnreserved(decoded)) output2 += decoded;
|
|
32246
|
+
else output2 += "%" + normalizedHex;
|
|
32247
|
+
i += 2;
|
|
32248
|
+
continue;
|
|
32249
|
+
}
|
|
32250
|
+
}
|
|
32251
|
+
if (isQueryFragmentCharacter(ch)) output2 += ch;
|
|
32252
|
+
else {
|
|
32253
|
+
const code2 = input2.charCodeAt(i);
|
|
32254
|
+
if (code2 < 128) output2 += isEscapeSafe(code2) ? ch : BYTE_HEX[code2];
|
|
32255
|
+
else if (code2 < 55296 || code2 > 57343) output2 += percentEncodeNonAscii(code2);
|
|
32256
|
+
else if (code2 <= 56319 && i + 1 < input2.length) {
|
|
32257
|
+
const low = input2.charCodeAt(i + 1);
|
|
32258
|
+
if (low >= 56320 && low <= 57343) {
|
|
32259
|
+
output2 += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
|
|
32260
|
+
i++;
|
|
32261
|
+
} else output2 += percentEncodeNonAscii(65533);
|
|
32262
|
+
} else output2 += percentEncodeNonAscii(65533);
|
|
32263
|
+
}
|
|
32264
|
+
}
|
|
32265
|
+
return output2;
|
|
32266
|
+
}
|
|
32267
|
+
function escapePreservingEscapes(input2) {
|
|
32268
|
+
let output2 = "";
|
|
32269
|
+
for (let i = 0; i < input2.length; i++) {
|
|
32270
|
+
if (input2[i] === "%" && i + 2 < input2.length) {
|
|
32271
|
+
const hex3 = input2.slice(i + 1, i + 3);
|
|
32272
|
+
if (isHexPair(hex3)) {
|
|
32273
|
+
output2 += "%" + hex3.toUpperCase();
|
|
32274
|
+
i += 2;
|
|
32275
|
+
continue;
|
|
32276
|
+
}
|
|
32277
|
+
}
|
|
32278
|
+
output2 += escape(input2[i]);
|
|
32279
|
+
}
|
|
32280
|
+
return output2;
|
|
32044
32281
|
}
|
|
32045
32282
|
function recomposeAuthority(component) {
|
|
32046
32283
|
const uriTokens = [];
|
|
32047
32284
|
if (component.userinfo !== void 0) {
|
|
32048
|
-
uriTokens.push(component.userinfo);
|
|
32285
|
+
uriTokens.push(encodeUserinfo(component.userinfo));
|
|
32049
32286
|
uriTokens.push("@");
|
|
32050
32287
|
}
|
|
32051
32288
|
if (component.host !== void 0) {
|
|
32052
|
-
let host =
|
|
32289
|
+
let host = component.host;
|
|
32053
32290
|
if (!isIPv4(host)) {
|
|
32054
|
-
|
|
32055
|
-
if (ipV6res.isIPV6
|
|
32056
|
-
|
|
32291
|
+
let ipV6res = normalizeIPv6(host);
|
|
32292
|
+
if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
|
|
32293
|
+
host = normalizePercentEncoding(host, true);
|
|
32294
|
+
ipV6res = normalizeIPv6(host);
|
|
32295
|
+
}
|
|
32296
|
+
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) host = `[${ipV6res.escapedHost}]`;
|
|
32297
|
+
else host = reescapeHostDelimiters(host, false);
|
|
32057
32298
|
}
|
|
32058
32299
|
uriTokens.push(host);
|
|
32059
32300
|
}
|
|
32060
32301
|
if (typeof component.port === "number" || typeof component.port === "string") {
|
|
32302
|
+
const port = String(component.port);
|
|
32303
|
+
if (!isPort(port)) throw new TypeError("URI port is malformed.");
|
|
32061
32304
|
uriTokens.push(":");
|
|
32062
|
-
uriTokens.push(
|
|
32305
|
+
uriTokens.push(port);
|
|
32063
32306
|
}
|
|
32064
32307
|
return uriTokens.length ? uriTokens.join("") : void 0;
|
|
32065
32308
|
}
|
|
32066
32309
|
module.exports = {
|
|
32067
32310
|
nonSimpleDomain,
|
|
32068
32311
|
recomposeAuthority,
|
|
32069
|
-
|
|
32312
|
+
reescapeHostDelimiters,
|
|
32313
|
+
normalizePercentEncoding,
|
|
32314
|
+
normalizePathEncoding,
|
|
32315
|
+
serializePathEncoding,
|
|
32316
|
+
normalizeQueryFragmentEncoding,
|
|
32317
|
+
encodeUserinfo,
|
|
32318
|
+
encodeQuery,
|
|
32319
|
+
encodeFragment,
|
|
32320
|
+
escapePreservingEscapes,
|
|
32070
32321
|
removeDotSegments,
|
|
32071
32322
|
isIPv4,
|
|
32072
32323
|
isUUID,
|
|
@@ -32076,7 +32327,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32076
32327
|
}));
|
|
32077
32328
|
var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32078
32329
|
const { isUUID } = require_utils();
|
|
32079
|
-
const URN_REG =
|
|
32330
|
+
const URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
|
|
32080
32331
|
const supportedSchemeNames = [
|
|
32081
32332
|
"http",
|
|
32082
32333
|
"https",
|
|
@@ -32118,9 +32369,10 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32118
32369
|
wsComponent.secure = void 0;
|
|
32119
32370
|
}
|
|
32120
32371
|
if (wsComponent.resourceName) {
|
|
32121
|
-
const
|
|
32372
|
+
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
32373
|
+
const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
32122
32374
|
wsComponent.path = path && path !== "/" ? path : void 0;
|
|
32123
|
-
wsComponent.query =
|
|
32375
|
+
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
32124
32376
|
wsComponent.resourceName = void 0;
|
|
32125
32377
|
}
|
|
32126
32378
|
wsComponent.fragment = void 0;
|
|
@@ -32132,7 +32384,7 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32132
32384
|
return urnComponent;
|
|
32133
32385
|
}
|
|
32134
32386
|
const matches = urnComponent.path.match(URN_REG);
|
|
32135
|
-
if (matches) {
|
|
32387
|
+
if (matches && matches[0] === urnComponent.path) {
|
|
32136
32388
|
const scheme = options.scheme || urnComponent.scheme || "urn";
|
|
32137
32389
|
urnComponent.nid = matches[1].toLowerCase();
|
|
32138
32390
|
urnComponent.nss = matches[2];
|
|
@@ -32222,16 +32474,32 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32222
32474
|
};
|
|
32223
32475
|
}));
|
|
32224
32476
|
var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32225
|
-
const { normalizeIPv6, removeDotSegments, recomposeAuthority,
|
|
32477
|
+
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
32226
32478
|
const { SCHEMES, getSchemeHandler } = require_schemes();
|
|
32479
|
+
const VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
32480
|
+
const MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
32481
|
+
function decodeValidScheme(scheme) {
|
|
32482
|
+
const decodedScheme = unescape(String(scheme));
|
|
32483
|
+
if (!VALID_SCHEME.test(decodedScheme)) throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
32484
|
+
return decodedScheme;
|
|
32485
|
+
}
|
|
32227
32486
|
function normalize(uri, options) {
|
|
32228
|
-
if (typeof uri === "string") uri =
|
|
32487
|
+
if (typeof uri === "string") uri = normalizeString(uri, options);
|
|
32229
32488
|
else if (typeof uri === "object") uri = parse3(serialize(uri, options), options);
|
|
32230
32489
|
return uri;
|
|
32231
32490
|
}
|
|
32232
32491
|
function resolve8(baseURI, relativeURI, options) {
|
|
32233
32492
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
32234
|
-
const
|
|
32493
|
+
const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed, malformedPercentEncoding: baseMalformedPercentEncoding, malformedSchemeSpecific: baseMalformedSchemeSpecific, malformedHost: baseMalformedHost, malformedScheme: baseMalformedScheme } = parseWithStatus(baseURI, schemelessOptions);
|
|
32494
|
+
const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed, malformedPercentEncoding: relativeMalformedPercentEncoding, malformedSchemeSpecific: relativeMalformedSchemeSpecific, malformedHost: relativeMalformedHost, malformedScheme: relativeMalformedScheme } = parseWithStatus(relativeURI, schemelessOptions);
|
|
32495
|
+
if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
32496
|
+
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
32497
|
+
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
32498
|
+
const resolvedHost = resolved.host;
|
|
32499
|
+
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
32500
|
+
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
32501
|
+
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
|
|
32502
|
+
if (resolved.error && !encodedASCIIHost) throw new Error(resolved.error);
|
|
32235
32503
|
schemelessOptions.skipEscape = true;
|
|
32236
32504
|
return serialize(resolved, schemelessOptions);
|
|
32237
32505
|
}
|
|
@@ -32281,27 +32549,9 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32281
32549
|
return target;
|
|
32282
32550
|
}
|
|
32283
32551
|
function equal(uriA, uriB, options) {
|
|
32284
|
-
|
|
32285
|
-
|
|
32286
|
-
|
|
32287
|
-
...options,
|
|
32288
|
-
skipEscape: true
|
|
32289
|
-
});
|
|
32290
|
-
} else if (typeof uriA === "object") uriA = serialize(normalizeComponentEncoding(uriA, true), {
|
|
32291
|
-
...options,
|
|
32292
|
-
skipEscape: true
|
|
32293
|
-
});
|
|
32294
|
-
if (typeof uriB === "string") {
|
|
32295
|
-
uriB = unescape(uriB);
|
|
32296
|
-
uriB = serialize(normalizeComponentEncoding(parse3(uriB, options), true), {
|
|
32297
|
-
...options,
|
|
32298
|
-
skipEscape: true
|
|
32299
|
-
});
|
|
32300
|
-
} else if (typeof uriB === "object") uriB = serialize(normalizeComponentEncoding(uriB, true), {
|
|
32301
|
-
...options,
|
|
32302
|
-
skipEscape: true
|
|
32303
|
-
});
|
|
32304
|
-
return uriA.toLowerCase() === uriB.toLowerCase();
|
|
32552
|
+
const normalizedA = normalizeComparableURI(uriA, options);
|
|
32553
|
+
const normalizedB = normalizeComparableURI(uriB, options);
|
|
32554
|
+
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
|
|
32305
32555
|
}
|
|
32306
32556
|
function serialize(cmpts, opts) {
|
|
32307
32557
|
const component = {
|
|
@@ -32322,13 +32572,17 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32322
32572
|
};
|
|
32323
32573
|
const options = Object.assign({}, opts);
|
|
32324
32574
|
const uriTokens = [];
|
|
32575
|
+
if (component.scheme) component.scheme = decodeValidScheme(component.scheme);
|
|
32325
32576
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
32326
32577
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
|
|
32327
|
-
|
|
32328
|
-
|
|
32329
|
-
|
|
32330
|
-
|
|
32331
|
-
if (options.reference !== "suffix" && component.scheme)
|
|
32578
|
+
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
32579
|
+
const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
|
|
32580
|
+
if (component.path !== void 0) if (!options.skipEscape) component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
32581
|
+
else component.path = normalizePercentEncoding(component.path);
|
|
32582
|
+
if (options.reference !== "suffix" && component.scheme) {
|
|
32583
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
32584
|
+
uriTokens.push(component.scheme, ":");
|
|
32585
|
+
}
|
|
32332
32586
|
const authority = recomposeAuthority(component);
|
|
32333
32587
|
if (authority !== void 0) {
|
|
32334
32588
|
if (options.reference !== "suffix") uriTokens.push("//");
|
|
@@ -32338,15 +32592,47 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32338
32592
|
if (component.path !== void 0) {
|
|
32339
32593
|
let s = component.path;
|
|
32340
32594
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) s = removeDotSegments(s);
|
|
32595
|
+
if (pathNoScheme) s = serializePathEncoding(s, true);
|
|
32341
32596
|
if (authority === void 0 && s[0] === "/" && s[1] === "/") s = "/%2F" + s.slice(2);
|
|
32342
32597
|
uriTokens.push(s);
|
|
32343
32598
|
}
|
|
32344
|
-
if (component.query !== void 0) uriTokens.push("?", component.query);
|
|
32345
|
-
if (component.fragment !== void 0) uriTokens.push("#", component.fragment);
|
|
32599
|
+
if (component.query !== void 0) uriTokens.push("?", encodeQuery(component.query));
|
|
32600
|
+
if (component.fragment !== void 0) uriTokens.push("#", encodeFragment(component.fragment));
|
|
32346
32601
|
return uriTokens.join("");
|
|
32347
32602
|
}
|
|
32348
32603
|
const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
32349
|
-
|
|
32604
|
+
const AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
|
|
32605
|
+
const AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
|
|
32606
|
+
function getParseError(parsed, matches) {
|
|
32607
|
+
if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") return 'URI path must start with "/" when authority is present.';
|
|
32608
|
+
if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) return "URI port is malformed.";
|
|
32609
|
+
}
|
|
32610
|
+
function hasMalformedPercentEncoding(component) {
|
|
32611
|
+
if (component === void 0) return false;
|
|
32612
|
+
let percent = component.indexOf("%");
|
|
32613
|
+
while (percent !== -1) {
|
|
32614
|
+
if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) return true;
|
|
32615
|
+
percent = component.indexOf("%", percent + 3);
|
|
32616
|
+
}
|
|
32617
|
+
return false;
|
|
32618
|
+
}
|
|
32619
|
+
function isIPLiteral(host) {
|
|
32620
|
+
return host[0] === "[" && host[host.length - 1] === "]";
|
|
32621
|
+
}
|
|
32622
|
+
function hasMalformedComponentPercentEncoding(matches) {
|
|
32623
|
+
const host = matches[4];
|
|
32624
|
+
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
32625
|
+
}
|
|
32626
|
+
function canonicalizeHost(parsed, options, schemeHandler, isIP2) {
|
|
32627
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP2 === false && nonSimpleDomain(parsed.host)) try {
|
|
32628
|
+
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
32629
|
+
} catch (e) {
|
|
32630
|
+
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
32631
|
+
return true;
|
|
32632
|
+
}
|
|
32633
|
+
return false;
|
|
32634
|
+
}
|
|
32635
|
+
function parseWithStatus(uri, opts) {
|
|
32350
32636
|
const options = Object.assign({}, opts);
|
|
32351
32637
|
const parsed = {
|
|
32352
32638
|
scheme: void 0,
|
|
@@ -32357,9 +32643,34 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32357
32643
|
query: void 0,
|
|
32358
32644
|
fragment: void 0
|
|
32359
32645
|
};
|
|
32646
|
+
let malformedAuthorityOrPort = false;
|
|
32647
|
+
let malformedPercentEncoding = false;
|
|
32648
|
+
let malformedSchemeSpecific = false;
|
|
32649
|
+
let malformedHost = false;
|
|
32650
|
+
let malformedIPLiteral = false;
|
|
32651
|
+
let malformedScheme = false;
|
|
32360
32652
|
let isIP2 = false;
|
|
32361
32653
|
if (options.reference === "suffix") if (options.scheme) uri = options.scheme + ":" + uri;
|
|
32362
32654
|
else uri = "//" + uri;
|
|
32655
|
+
const authorityMatch = uri.match(AUTHORITY_PREFIX);
|
|
32656
|
+
if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
|
|
32657
|
+
parsed.error = "URI authority must not contain a literal backslash.";
|
|
32658
|
+
malformedAuthorityOrPort = true;
|
|
32659
|
+
}
|
|
32660
|
+
const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
|
|
32661
|
+
if (introducerMatch !== null) {
|
|
32662
|
+
const region = introducerMatch[1];
|
|
32663
|
+
const normalizedRegion = region.replace(/[\t\n\r]/g, "");
|
|
32664
|
+
if (normalizedRegion.length >= 2) {
|
|
32665
|
+
if (normalizedRegion.slice(0, 2) !== "//") {
|
|
32666
|
+
parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
|
|
32667
|
+
malformedAuthorityOrPort = true;
|
|
32668
|
+
} else if (region.length !== normalizedRegion.length) {
|
|
32669
|
+
parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
|
|
32670
|
+
malformedAuthorityOrPort = true;
|
|
32671
|
+
}
|
|
32672
|
+
}
|
|
32673
|
+
}
|
|
32363
32674
|
const matches = uri.match(URI_PARSE);
|
|
32364
32675
|
if (matches) {
|
|
32365
32676
|
parsed.scheme = matches[1];
|
|
@@ -32369,11 +32680,33 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32369
32680
|
parsed.path = matches[6] || "";
|
|
32370
32681
|
parsed.query = matches[7];
|
|
32371
32682
|
parsed.fragment = matches[8];
|
|
32683
|
+
if (parsed.scheme !== void 0) {
|
|
32684
|
+
const decodedScheme = unescape(parsed.scheme);
|
|
32685
|
+
if (VALID_SCHEME.test(decodedScheme)) parsed.scheme = decodedScheme.toLowerCase();
|
|
32686
|
+
else {
|
|
32687
|
+
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
|
|
32688
|
+
malformedScheme = true;
|
|
32689
|
+
}
|
|
32690
|
+
}
|
|
32691
|
+
malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
|
|
32692
|
+
if (malformedPercentEncoding) parsed.error = parsed.error || "URI contains malformed percent-encoding.";
|
|
32372
32693
|
if (isNaN(parsed.port)) parsed.port = matches[5];
|
|
32694
|
+
const parseError = getParseError(parsed, matches);
|
|
32695
|
+
if (parseError !== void 0) {
|
|
32696
|
+
parsed.error = parsed.error || parseError;
|
|
32697
|
+
malformedAuthorityOrPort = true;
|
|
32698
|
+
}
|
|
32373
32699
|
if (parsed.host) if (isIPv4(parsed.host) === false) {
|
|
32700
|
+
const bracketedIPLiteral = isIPLiteral(parsed.host);
|
|
32701
|
+
const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
|
|
32374
32702
|
const ipv6result = normalizeIPv6(parsed.host);
|
|
32375
|
-
|
|
32376
|
-
|
|
32703
|
+
isIP2 = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
|
|
32704
|
+
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
32705
|
+
parsed.host = isIP2 ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
32706
|
+
if (malformedIPLiteral) {
|
|
32707
|
+
parsed.error = parsed.error || "URI host is malformed.";
|
|
32708
|
+
malformedAuthorityOrPort = true;
|
|
32709
|
+
}
|
|
32377
32710
|
} else isIP2 = true;
|
|
32378
32711
|
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";
|
|
32379
32712
|
else if (parsed.scheme === void 0) parsed.reference = "relative";
|
|
@@ -32381,24 +32714,58 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32381
32714
|
else parsed.reference = "uri";
|
|
32382
32715
|
if (options.reference && options.reference !== "suffix" && options.reference !== parsed.reference) parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
|
|
32383
32716
|
const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
|
|
32384
|
-
if (!
|
|
32385
|
-
|
|
32386
|
-
|
|
32387
|
-
|
|
32388
|
-
|
|
32389
|
-
}
|
|
32717
|
+
if (!malformedIPLiteral) malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP2);
|
|
32718
|
+
if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
|
|
32719
|
+
let host = isIP2 ? parsed.host : normalizePercentEncoding(parsed.host, true);
|
|
32720
|
+
if (!isIP2) host = normalizePercentEncoding(host.toLowerCase());
|
|
32721
|
+
parsed.host = reescapeHostDelimiters(host, isIP2);
|
|
32390
32722
|
}
|
|
32391
32723
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
32392
|
-
if (
|
|
32393
|
-
|
|
32394
|
-
|
|
32395
|
-
|
|
32396
|
-
|
|
32397
|
-
|
|
32724
|
+
if (parsed.path) parsed.path = normalizePathEncoding(parsed.path);
|
|
32725
|
+
if (parsed.query) parsed.query = normalizeQueryFragmentEncoding(parsed.query);
|
|
32726
|
+
if (parsed.fragment) parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
|
|
32727
|
+
}
|
|
32728
|
+
if (schemeHandler && schemeHandler.parse) {
|
|
32729
|
+
schemeHandler.parse(parsed, options);
|
|
32730
|
+
if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) malformedSchemeSpecific = true;
|
|
32398
32731
|
}
|
|
32399
|
-
if (schemeHandler && schemeHandler.parse) schemeHandler.parse(parsed, options);
|
|
32400
32732
|
} else parsed.error = parsed.error || "URI can not be parsed.";
|
|
32401
|
-
return
|
|
32733
|
+
return {
|
|
32734
|
+
parsed,
|
|
32735
|
+
malformedAuthorityOrPort,
|
|
32736
|
+
malformedPercentEncoding,
|
|
32737
|
+
malformedSchemeSpecific,
|
|
32738
|
+
malformedHost,
|
|
32739
|
+
malformedScheme
|
|
32740
|
+
};
|
|
32741
|
+
}
|
|
32742
|
+
function parse3(uri, opts) {
|
|
32743
|
+
return parseWithStatus(uri, opts).parsed;
|
|
32744
|
+
}
|
|
32745
|
+
function normalizeString(uri, opts) {
|
|
32746
|
+
return normalizeStringWithStatus(uri, opts).normalized;
|
|
32747
|
+
}
|
|
32748
|
+
function normalizeStringWithStatus(uri, opts) {
|
|
32749
|
+
const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
32750
|
+
return {
|
|
32751
|
+
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
|
|
32752
|
+
malformedAuthorityOrPort,
|
|
32753
|
+
malformedPercentEncoding,
|
|
32754
|
+
malformedSchemeSpecific,
|
|
32755
|
+
malformedHost,
|
|
32756
|
+
malformedScheme
|
|
32757
|
+
};
|
|
32758
|
+
}
|
|
32759
|
+
function normalizeComparableURI(uri, opts) {
|
|
32760
|
+
if (typeof uri !== "string" && typeof uri !== "object") return;
|
|
32761
|
+
let value;
|
|
32762
|
+
try {
|
|
32763
|
+
value = typeof uri === "string" ? uri : serialize(uri, opts);
|
|
32764
|
+
} catch {
|
|
32765
|
+
return;
|
|
32766
|
+
}
|
|
32767
|
+
const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
|
|
32768
|
+
return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
|
|
32402
32769
|
}
|
|
32403
32770
|
const fastUri = {
|
|
32404
32771
|
SCHEMES,
|
|
@@ -36193,7 +36560,7 @@ var Ajv = import_ajv.Ajv;
|
|
|
36193
36560
|
// node_modules/@modelcontextprotocol/server/dist/shimsNode.mjs
|
|
36194
36561
|
import process2 from "node:process";
|
|
36195
36562
|
|
|
36196
|
-
// node_modules/@modelcontextprotocol/server/dist/mcp-
|
|
36563
|
+
// node_modules/@modelcontextprotocol/server/dist/mcp-oHn3ureC.mjs
|
|
36197
36564
|
var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
|
|
36198
36565
|
function isCompletable(schema) {
|
|
36199
36566
|
return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
|
|
@@ -36201,190 +36568,235 @@ function isCompletable(schema) {
|
|
|
36201
36568
|
function getCompleter(schema) {
|
|
36202
36569
|
return schema[COMPLETABLE_SYMBOL]?.complete;
|
|
36203
36570
|
}
|
|
36571
|
+
var DEFAULT_SSE_KEEP_ALIVE_MS = 15e3;
|
|
36204
36572
|
var MAX_TIMER_DELAY_MS = 2 ** 31 - 1;
|
|
36205
|
-
function
|
|
36206
|
-
|
|
36207
|
-
|
|
36208
|
-
|
|
36209
|
-
|
|
36210
|
-
|
|
36211
|
-
|
|
36212
|
-
|
|
36213
|
-
|
|
36214
|
-
|
|
36215
|
-
}
|
|
36216
|
-
}
|
|
36217
|
-
function honoredSubset(requested, capabilities) {
|
|
36218
|
-
const honored = {};
|
|
36219
|
-
const allow = (bit) => capabilities === void 0 || bit === true;
|
|
36220
|
-
if (requested.toolsListChanged === true && allow(capabilities?.tools?.listChanged)) honored.toolsListChanged = true;
|
|
36221
|
-
if (requested.promptsListChanged === true && allow(capabilities?.prompts?.listChanged)) honored.promptsListChanged = true;
|
|
36222
|
-
if (requested.resourcesListChanged === true && allow(capabilities?.resources?.listChanged)) honored.resourcesListChanged = true;
|
|
36223
|
-
if (requested.resourceSubscriptions !== void 0 && requested.resourceSubscriptions.length > 0 && allow(capabilities?.resources?.subscribe)) honored.resourceSubscriptions = [...requested.resourceSubscriptions];
|
|
36224
|
-
return honored;
|
|
36225
|
-
}
|
|
36226
|
-
var DEFAULT_MAX_SUBSCRIPTIONS = 1024;
|
|
36227
|
-
function stampSubscriptionId(notification, subscriptionId) {
|
|
36228
|
-
return {
|
|
36229
|
-
method: notification.method,
|
|
36230
|
-
params: {
|
|
36231
|
-
...notification.params,
|
|
36232
|
-
_meta: {
|
|
36233
|
-
...notification.params?._meta,
|
|
36234
|
-
[SUBSCRIPTION_ID_META_KEY]: subscriptionId
|
|
36235
|
-
}
|
|
36236
|
-
}
|
|
36237
|
-
};
|
|
36238
|
-
}
|
|
36239
|
-
function parseListenFilter(message) {
|
|
36240
|
-
const outcome = codecForVersion(MODERN_WIRE_REVISION).validateRequest("subscriptions/listen", message);
|
|
36241
|
-
return outcome.ok ? outcome.value.params?.notifications : void 0;
|
|
36242
|
-
}
|
|
36243
|
-
var CHANGE_NOTIFICATION_METHODS = /* @__PURE__ */ new Set([
|
|
36244
|
-
"notifications/tools/list_changed",
|
|
36245
|
-
"notifications/prompts/list_changed",
|
|
36246
|
-
"notifications/resources/list_changed",
|
|
36247
|
-
"notifications/resources/updated"
|
|
36248
|
-
]);
|
|
36249
|
-
var StdioListenRouter = class {
|
|
36250
|
-
/** Active subscriptions, keyed by the listen request's JSON-RPC id verbatim. */
|
|
36251
|
-
_subs = /* @__PURE__ */ new Map();
|
|
36252
|
-
/**
|
|
36253
|
-
* The serving instance's declared capabilities. Filled in by the entry
|
|
36254
|
-
* once the modern instance is constructed (the router is created before
|
|
36255
|
-
* the instance exists), so the acknowledged filter is narrowed against
|
|
36256
|
-
* what the server can actually deliver.
|
|
36257
|
-
*/
|
|
36258
|
-
_serverCapabilities;
|
|
36259
|
-
/**
|
|
36260
|
-
* The serving instance's identity, stamped onto the graceful-close
|
|
36261
|
-
* results' `_meta` (the spec's `SubscriptionsListenResultMetaObject` extends
|
|
36262
|
-
* `ResultMetaObject`). Handed over together with the capabilities.
|
|
36263
|
-
*/
|
|
36264
|
-
_serverInfo;
|
|
36265
|
-
constructor(_maxSubscriptions = DEFAULT_MAX_SUBSCRIPTIONS, serverCapabilities, serverInfo) {
|
|
36266
|
-
this._maxSubscriptions = _maxSubscriptions;
|
|
36267
|
-
this._serverCapabilities = serverCapabilities;
|
|
36268
|
-
this._serverInfo = serverInfo;
|
|
36573
|
+
function armSseKeepAlive(intervalMs, onTick) {
|
|
36574
|
+
if (!Number.isFinite(intervalMs) || intervalMs < 1) return;
|
|
36575
|
+
const timer = setInterval(onTick, Math.min(intervalMs, MAX_TIMER_DELAY_MS));
|
|
36576
|
+
timer.unref?.();
|
|
36577
|
+
return timer;
|
|
36578
|
+
}
|
|
36579
|
+
var readClassification;
|
|
36580
|
+
var PerRequestHTTPServerTransport = class {
|
|
36581
|
+
static {
|
|
36582
|
+
readClassification = (transport) => transport._classification;
|
|
36269
36583
|
}
|
|
36584
|
+
onclose;
|
|
36585
|
+
onerror;
|
|
36586
|
+
onmessage;
|
|
36587
|
+
_classification;
|
|
36588
|
+
_responseMode;
|
|
36589
|
+
_started = false;
|
|
36590
|
+
_used = false;
|
|
36591
|
+
_closed = false;
|
|
36592
|
+
_terminalDelivered = false;
|
|
36270
36593
|
/**
|
|
36271
|
-
*
|
|
36272
|
-
*
|
|
36273
|
-
*
|
|
36274
|
-
*
|
|
36594
|
+
* `true` only while the inbound message is being delivered synchronously
|
|
36595
|
+
* to the connected protocol layer. The pre-handler gates (the era
|
|
36596
|
+
* registry gate, the edge→instance handoff check, the missing-handler
|
|
36597
|
+
* rejection) answer inside this window; request handlers always run
|
|
36598
|
+
* after it (the protocol layer defers them to a microtask). An error
|
|
36599
|
+
* sent inside the window is therefore ladder-originated, and an error
|
|
36600
|
+
* sent after it is handler-produced.
|
|
36275
36601
|
*/
|
|
36276
|
-
|
|
36277
|
-
|
|
36278
|
-
|
|
36602
|
+
_dispatchWindowOpen = false;
|
|
36603
|
+
_requestId;
|
|
36604
|
+
_deferredResponse;
|
|
36605
|
+
_sse;
|
|
36606
|
+
_abortCleanup;
|
|
36607
|
+
_keepAliveMs;
|
|
36608
|
+
constructor(options) {
|
|
36609
|
+
this._classification = options.classification;
|
|
36610
|
+
this._responseMode = options.responseMode ?? "auto";
|
|
36611
|
+
this._keepAliveMs = options.keepAliveMs ?? DEFAULT_SSE_KEEP_ALIVE_MS;
|
|
36279
36612
|
}
|
|
36280
|
-
|
|
36281
|
-
|
|
36282
|
-
|
|
36613
|
+
async start() {
|
|
36614
|
+
if (this._started) throw new Error("PerRequestHTTPServerTransport is already started");
|
|
36615
|
+
this._started = true;
|
|
36283
36616
|
}
|
|
36284
36617
|
/**
|
|
36285
|
-
*
|
|
36286
|
-
*
|
|
36287
|
-
* capacity / params rejection, the in-band JSON-RPC error response).
|
|
36618
|
+
* Serves the single exchange: delivers the classified message to the
|
|
36619
|
+
* connected server instance and resolves with the HTTP response.
|
|
36288
36620
|
*
|
|
36289
|
-
*
|
|
36290
|
-
*
|
|
36291
|
-
*
|
|
36292
|
-
*
|
|
36293
|
-
*
|
|
36621
|
+
* Throws when called a second time (the transport is strictly
|
|
36622
|
+
* single-use), or before a server has been connected to the transport.
|
|
36623
|
+
* The returned promise rejects with a connection-closed error when the
|
|
36624
|
+
* transport is closed before a response was produced (for example because
|
|
36625
|
+
* the client disconnected).
|
|
36294
36626
|
*/
|
|
36295
|
-
|
|
36296
|
-
if (this.
|
|
36297
|
-
if (this.
|
|
36298
|
-
|
|
36299
|
-
|
|
36300
|
-
|
|
36301
|
-
|
|
36302
|
-
|
|
36303
|
-
|
|
36627
|
+
async handleMessage(message, extra) {
|
|
36628
|
+
if (this._used) throw new Error("PerRequestHTTPServerTransport serves exactly one exchange; construct a new transport per request");
|
|
36629
|
+
if (!this._started || this.onmessage === void 0) throw new Error("PerRequestHTTPServerTransport is not connected: connect a server to this transport before handling a message");
|
|
36630
|
+
if (this._closed) throw new Error("PerRequestHTTPServerTransport is closed");
|
|
36631
|
+
this._used = true;
|
|
36632
|
+
const signal = extra?.request?.signal;
|
|
36633
|
+
if (signal?.aborted) {
|
|
36634
|
+
await this.close();
|
|
36635
|
+
throw new SdkError(SdkErrorCode.ConnectionClosed, "The request was aborted before it could be handled");
|
|
36636
|
+
}
|
|
36637
|
+
const messageExtra = {
|
|
36638
|
+
classification: this._classification,
|
|
36639
|
+
...extra?.request !== void 0 && { request: extra.request },
|
|
36640
|
+
...extra?.authInfo !== void 0 && { authInfo: extra.authInfo }
|
|
36304
36641
|
};
|
|
36305
|
-
|
|
36306
|
-
|
|
36307
|
-
|
|
36308
|
-
|
|
36309
|
-
|
|
36310
|
-
|
|
36311
|
-
|
|
36642
|
+
if (isJSONRPCRequest(message)) {
|
|
36643
|
+
this._requestId = message.id;
|
|
36644
|
+
let resolve8;
|
|
36645
|
+
let reject;
|
|
36646
|
+
const promise2 = new Promise((promiseResolve, promiseReject) => {
|
|
36647
|
+
resolve8 = promiseResolve;
|
|
36648
|
+
reject = promiseReject;
|
|
36649
|
+
});
|
|
36650
|
+
this._deferredResponse = {
|
|
36651
|
+
promise: promise2,
|
|
36652
|
+
resolve: resolve8,
|
|
36653
|
+
reject,
|
|
36654
|
+
settled: false
|
|
36655
|
+
};
|
|
36656
|
+
if (signal !== void 0) {
|
|
36657
|
+
const onAbort = () => void this.close();
|
|
36658
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
36659
|
+
this._abortCleanup = () => signal.removeEventListener("abort", onAbort);
|
|
36312
36660
|
}
|
|
36313
|
-
|
|
36314
|
-
|
|
36315
|
-
|
|
36316
|
-
|
|
36317
|
-
|
|
36318
|
-
|
|
36319
|
-
|
|
36661
|
+
this._dispatchWindowOpen = true;
|
|
36662
|
+
try {
|
|
36663
|
+
this.onmessage(message, messageExtra);
|
|
36664
|
+
} finally {
|
|
36665
|
+
this._dispatchWindowOpen = false;
|
|
36666
|
+
}
|
|
36667
|
+
if (this._responseMode === "sse" && !this._closed && !this._deferredResponse.settled) this.upgradeToSse();
|
|
36668
|
+
return promise2;
|
|
36669
|
+
}
|
|
36670
|
+
this.onmessage(message, messageExtra);
|
|
36671
|
+
return new Response(null, { status: 202 });
|
|
36320
36672
|
}
|
|
36321
|
-
|
|
36322
|
-
|
|
36323
|
-
|
|
36324
|
-
|
|
36325
|
-
|
|
36326
|
-
|
|
36327
|
-
|
|
36673
|
+
async send(message, options) {
|
|
36674
|
+
if (this._closed) return;
|
|
36675
|
+
const isResponse = isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message);
|
|
36676
|
+
const relatedId = isResponse ? message.id : options?.relatedRequestId;
|
|
36677
|
+
if (this._requestId === void 0 || relatedId === void 0 || relatedId !== this._requestId) {
|
|
36678
|
+
if (isResponse) this.onerror?.(/* @__PURE__ */ new Error(`Received a response for an unknown request id: ${String(message.id)}`));
|
|
36679
|
+
return;
|
|
36680
|
+
}
|
|
36681
|
+
if (isResponse) {
|
|
36682
|
+
if (this._terminalDelivered) return;
|
|
36683
|
+
this._terminalDelivered = true;
|
|
36684
|
+
const errorCode = isJSONRPCErrorResponse(message) ? message.error.code : void 0;
|
|
36685
|
+
const ladderStatus = errorCode !== void 0 && (this._dispatchWindowOpen || errorCode === ProtocolErrorCode.MissingRequiredClientCapability) ? LADDER_ERROR_HTTP_STATUS[errorCode] : void 0;
|
|
36686
|
+
if (ladderStatus !== void 0 && this._sse === void 0) {
|
|
36687
|
+
this.settleResponse(Response.json(message, {
|
|
36688
|
+
status: ladderStatus,
|
|
36689
|
+
headers: { "Content-Type": "application/json" }
|
|
36690
|
+
}));
|
|
36691
|
+
queueMicrotask(() => void this.close());
|
|
36692
|
+
return;
|
|
36693
|
+
}
|
|
36694
|
+
if (this._sse !== void 0 || this._responseMode === "sse") {
|
|
36695
|
+
if (this._sse === void 0) this.upgradeToSse();
|
|
36696
|
+
this.writeMessageFrame(message);
|
|
36697
|
+
this.finalizeStream();
|
|
36698
|
+
return;
|
|
36699
|
+
}
|
|
36700
|
+
this.settleResponse(Response.json(message, {
|
|
36701
|
+
status: 200,
|
|
36702
|
+
headers: { "Content-Type": "application/json" }
|
|
36703
|
+
}));
|
|
36704
|
+
queueMicrotask(() => void this.close());
|
|
36705
|
+
return;
|
|
36706
|
+
}
|
|
36707
|
+
if (this._responseMode === "json") return;
|
|
36708
|
+
if (this._sse === void 0) this.upgradeToSse();
|
|
36709
|
+
this.writeMessageFrame(message);
|
|
36328
36710
|
}
|
|
36329
36711
|
/**
|
|
36330
|
-
*
|
|
36331
|
-
*
|
|
36332
|
-
* - For a subscription-gated change notification, returns one stamped copy
|
|
36333
|
-
* per subscription that opted in to it (an empty array means it is
|
|
36334
|
-
* dropped — the modern era never delivers an un-requested change type).
|
|
36335
|
-
* - For any other outbound message, returns `'passthrough'` (the entry
|
|
36336
|
-
* forwards it as-is).
|
|
36712
|
+
* Writes an SSE comment frame (a keep-alive heartbeat). Dropped when the
|
|
36713
|
+
* exchange is not currently streaming.
|
|
36337
36714
|
*/
|
|
36338
|
-
|
|
36339
|
-
if (
|
|
36340
|
-
const
|
|
36341
|
-
|
|
36342
|
-
|
|
36343
|
-
|
|
36344
|
-
for (const [subscriptionId, filter] of this._subs) if (listenFilterAccepts(filter, event)) out.push(stampSubscriptionId({
|
|
36345
|
-
method: message.method,
|
|
36346
|
-
params: message.params ?? {}
|
|
36347
|
-
}, subscriptionId));
|
|
36348
|
-
return out;
|
|
36715
|
+
writeCommentFrame(comment) {
|
|
36716
|
+
if (this._closed || this._sse === void 0 || this._sse.closed) return;
|
|
36717
|
+
const frame = comment.split("\n").map((line) => `: ${line}`).join("\n");
|
|
36718
|
+
this.writeFrame(`${frame}
|
|
36719
|
+
|
|
36720
|
+
`);
|
|
36349
36721
|
}
|
|
36350
|
-
|
|
36351
|
-
|
|
36352
|
-
|
|
36353
|
-
|
|
36354
|
-
|
|
36355
|
-
|
|
36356
|
-
|
|
36357
|
-
|
|
36358
|
-
|
|
36359
|
-
|
|
36360
|
-
|
|
36361
|
-
|
|
36362
|
-
|
|
36363
|
-
|
|
36364
|
-
|
|
36365
|
-
|
|
36366
|
-
|
|
36367
|
-
|
|
36722
|
+
async close() {
|
|
36723
|
+
if (this._closed) return;
|
|
36724
|
+
this._closed = true;
|
|
36725
|
+
this._abortCleanup?.();
|
|
36726
|
+
this._abortCleanup = void 0;
|
|
36727
|
+
if (this._sse?.keepAliveTimer !== void 0) clearInterval(this._sse.keepAliveTimer);
|
|
36728
|
+
if (this._sse !== void 0 && !this._sse.closed) {
|
|
36729
|
+
this._sse.closed = true;
|
|
36730
|
+
try {
|
|
36731
|
+
this._sse.controller.close();
|
|
36732
|
+
} catch {
|
|
36733
|
+
}
|
|
36734
|
+
}
|
|
36735
|
+
if (this._deferredResponse !== void 0 && !this._deferredResponse.settled) {
|
|
36736
|
+
this._deferredResponse.settled = true;
|
|
36737
|
+
this._deferredResponse.reject(new SdkError(SdkErrorCode.ConnectionClosed, "Connection closed before a response was produced"));
|
|
36738
|
+
}
|
|
36739
|
+
this.onclose?.();
|
|
36740
|
+
}
|
|
36741
|
+
settleResponse(response) {
|
|
36742
|
+
if (this._deferredResponse === void 0 || this._deferredResponse.settled) return;
|
|
36743
|
+
this._deferredResponse.settled = true;
|
|
36744
|
+
this._deferredResponse.resolve(response);
|
|
36745
|
+
}
|
|
36746
|
+
upgradeToSse() {
|
|
36747
|
+
let controller;
|
|
36748
|
+
const readable = new ReadableStream({
|
|
36749
|
+
start: (streamController) => {
|
|
36750
|
+
controller = streamController;
|
|
36751
|
+
},
|
|
36752
|
+
cancel: () => {
|
|
36753
|
+
this.close();
|
|
36368
36754
|
}
|
|
36369
36755
|
});
|
|
36370
|
-
this.
|
|
36371
|
-
|
|
36756
|
+
this._sse = {
|
|
36757
|
+
controller,
|
|
36758
|
+
encoder: new TextEncoder(),
|
|
36759
|
+
closed: false
|
|
36760
|
+
};
|
|
36761
|
+
this._sse.keepAliveTimer = armSseKeepAlive(this._keepAliveMs, () => this.writeCommentFrame("keepalive"));
|
|
36762
|
+
this.settleResponse(new Response(readable, {
|
|
36763
|
+
status: 200,
|
|
36764
|
+
headers: {
|
|
36765
|
+
"Content-Type": "text/event-stream",
|
|
36766
|
+
"Cache-Control": "no-cache, no-transform",
|
|
36767
|
+
Connection: "keep-alive",
|
|
36768
|
+
"X-Accel-Buffering": "no"
|
|
36769
|
+
}
|
|
36770
|
+
}));
|
|
36372
36771
|
}
|
|
36373
|
-
|
|
36374
|
-
|
|
36375
|
-
|
|
36376
|
-
|
|
36377
|
-
|
|
36378
|
-
|
|
36379
|
-
|
|
36380
|
-
|
|
36381
|
-
|
|
36382
|
-
|
|
36383
|
-
|
|
36384
|
-
|
|
36385
|
-
|
|
36386
|
-
|
|
36772
|
+
finalizeStream() {
|
|
36773
|
+
if (this._sse?.keepAliveTimer !== void 0) clearInterval(this._sse.keepAliveTimer);
|
|
36774
|
+
if (this._sse !== void 0 && !this._sse.closed) {
|
|
36775
|
+
this._sse.closed = true;
|
|
36776
|
+
try {
|
|
36777
|
+
this._sse.controller.close();
|
|
36778
|
+
} catch {
|
|
36779
|
+
}
|
|
36780
|
+
}
|
|
36781
|
+
queueMicrotask(() => void this.close());
|
|
36782
|
+
}
|
|
36783
|
+
writeMessageFrame(message) {
|
|
36784
|
+
this.writeFrame(`event: message
|
|
36785
|
+
data: ${JSON.stringify(message)}
|
|
36786
|
+
|
|
36787
|
+
`);
|
|
36788
|
+
}
|
|
36789
|
+
writeFrame(frame) {
|
|
36790
|
+
if (this._sse === void 0 || this._sse.closed) return;
|
|
36791
|
+
try {
|
|
36792
|
+
this._sse.controller.enqueue(this._sse.encoder.encode(frame));
|
|
36793
|
+
} catch (error62) {
|
|
36794
|
+
this.onerror?.(/* @__PURE__ */ new Error(`Failed to write to the response stream: ${error62}`));
|
|
36795
|
+
}
|
|
36387
36796
|
}
|
|
36797
|
+
};
|
|
36798
|
+
function perRequestClassificationOf(transport) {
|
|
36799
|
+
return transport instanceof PerRequestHTTPServerTransport ? readClassification(transport) : void 0;
|
|
36388
36800
|
}
|
|
36389
36801
|
function supportsScopeChallengeResolver(transport) {
|
|
36390
36802
|
return typeof transport === "object" && transport !== null && "setScopeChallengeResolver" in transport && typeof transport.setScopeChallengeResolver === "function";
|
|
@@ -36554,6 +36966,7 @@ var Server = class extends Protocol {
|
|
|
36554
36966
|
_requestStateVerify;
|
|
36555
36967
|
_inputRequiredServing;
|
|
36556
36968
|
_legacyShim;
|
|
36969
|
+
_boundFromTransport = false;
|
|
36557
36970
|
/** Lazily-built legacy shim; the loop lives in legacyInputRequiredShim.ts behind a narrow host contract. */
|
|
36558
36971
|
_legacyInputRequiredShim() {
|
|
36559
36972
|
return this._legacyShim ??= new LegacyInputRequiredShim({
|
|
@@ -36593,6 +37006,15 @@ var Server = class extends Protocol {
|
|
|
36593
37006
|
/** Attaches to the given transport; rejects while this instance is connected to another one. */
|
|
36594
37007
|
async connect(transport) {
|
|
36595
37008
|
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.");
|
|
37009
|
+
if (this._boundFromTransport) {
|
|
37010
|
+
this._boundFromTransport = false;
|
|
37011
|
+
this._negotiatedProtocolVersion = void 0;
|
|
37012
|
+
}
|
|
37013
|
+
const revision = perRequestClassificationOf(transport)?.revision;
|
|
37014
|
+
if (revision !== void 0 && !this._servedModernEra() && SUPPORTED_MODERN_PROTOCOL_VERSIONS.includes(revision) && modernProtocolVersions(this._supportedProtocolVersions).includes(revision)) {
|
|
37015
|
+
this._negotiatedProtocolVersion = revision;
|
|
37016
|
+
this._boundFromTransport = true;
|
|
37017
|
+
}
|
|
36596
37018
|
await super.connect(transport);
|
|
36597
37019
|
}
|
|
36598
37020
|
/**
|
|
@@ -36918,8 +37340,8 @@ var Server = class extends Protocol {
|
|
|
36918
37340
|
* @deprecated Read client identity from the per-request handler context instead: on
|
|
36919
37341
|
* 2026-07-28 (per-request envelope) requests `ctx.mcpReq.envelope` carries the client's
|
|
36920
37342
|
* declared capabilities, while on 2025-era connections this accessor keeps returning the
|
|
36921
|
-
* `initialize`-scoped value. The accessor remains functional
|
|
36922
|
-
* 2026-07-28 era
|
|
37343
|
+
* `initialize`-scoped value. The accessor remains functional where `createMcpHandler`
|
|
37344
|
+
* serves the 2026-07-28 era: it backfills it per request from the validated envelope.
|
|
36923
37345
|
*/
|
|
36924
37346
|
getClientCapabilities() {
|
|
36925
37347
|
return this._clientCapabilities;
|
|
@@ -36930,8 +37352,8 @@ var Server = class extends Protocol {
|
|
|
36930
37352
|
* @deprecated Read client identity from the per-request handler context instead: on
|
|
36931
37353
|
* 2026-07-28 (per-request envelope) requests `ctx.mcpReq.envelope` carries the client's
|
|
36932
37354
|
* name and version, while on 2025-era connections this accessor keeps returning the
|
|
36933
|
-
* `initialize`-scoped value. The accessor remains functional
|
|
36934
|
-
* 2026-07-28 era
|
|
37355
|
+
* `initialize`-scoped value. The accessor remains functional where `createMcpHandler`
|
|
37356
|
+
* serves the 2026-07-28 era: it backfills it per request from the validated envelope.
|
|
36935
37357
|
*/
|
|
36936
37358
|
getClientVersion() {
|
|
36937
37359
|
return this._clientVersion;
|
|
@@ -37506,8 +37928,14 @@ var McpServer = class {
|
|
|
37506
37928
|
if (updates.uri) this._registeredResources[updates.uri] = registeredResource;
|
|
37507
37929
|
}
|
|
37508
37930
|
if (updates.name !== void 0) registeredResource.name = updates.name;
|
|
37509
|
-
if (updates.title !== void 0) registeredResource.title = updates.title;
|
|
37510
37931
|
if (updates.metadata !== void 0) registeredResource.metadata = updates.metadata;
|
|
37932
|
+
if (updates.title !== void 0) {
|
|
37933
|
+
registeredResource.title = updates.title;
|
|
37934
|
+
registeredResource.metadata = {
|
|
37935
|
+
...registeredResource.metadata,
|
|
37936
|
+
title: updates.title
|
|
37937
|
+
};
|
|
37938
|
+
}
|
|
37511
37939
|
if (updates.callback !== void 0) registeredResource.readCallback = updates.callback;
|
|
37512
37940
|
if (updates.scopeChallenge !== void 0) registeredResource.scopeChallenge = updates.scopeChallenge === null ? void 0 : updates.scopeChallenge;
|
|
37513
37941
|
if (updates.enabled !== void 0) registeredResource.enabled = updates.enabled;
|
|
@@ -37533,9 +37961,15 @@ var McpServer = class {
|
|
|
37533
37961
|
delete this._registeredResourceTemplates[name];
|
|
37534
37962
|
if (updates.name) this._registeredResourceTemplates[updates.name] = registeredResourceTemplate;
|
|
37535
37963
|
}
|
|
37536
|
-
if (updates.title !== void 0) registeredResourceTemplate.title = updates.title;
|
|
37537
37964
|
if (updates.template !== void 0) registeredResourceTemplate.resourceTemplate = updates.template;
|
|
37538
37965
|
if (updates.metadata !== void 0) registeredResourceTemplate.metadata = updates.metadata;
|
|
37966
|
+
if (updates.title !== void 0) {
|
|
37967
|
+
registeredResourceTemplate.title = updates.title;
|
|
37968
|
+
registeredResourceTemplate.metadata = {
|
|
37969
|
+
...registeredResourceTemplate.metadata,
|
|
37970
|
+
title: updates.title
|
|
37971
|
+
};
|
|
37972
|
+
}
|
|
37539
37973
|
if (updates.callback !== void 0) registeredResourceTemplate.readCallback = updates.callback;
|
|
37540
37974
|
if (updates.scopeChallenge !== void 0) registeredResourceTemplate.scopeChallenge = updates.scopeChallenge === null ? void 0 : updates.scopeChallenge;
|
|
37541
37975
|
if (updates.enabled !== void 0) registeredResourceTemplate.enabled = updates.enabled;
|
|
@@ -37791,6 +38225,192 @@ function unwrapOptionalSchema(schema) {
|
|
|
37791
38225
|
return schema.def?.innerType ?? schema;
|
|
37792
38226
|
}
|
|
37793
38227
|
|
|
38228
|
+
// node_modules/@modelcontextprotocol/server/dist/listenRouter-Bartj63y.mjs
|
|
38229
|
+
function listenFilterAccepts(filter, event) {
|
|
38230
|
+
switch (event.kind) {
|
|
38231
|
+
case "tools_list_changed":
|
|
38232
|
+
return filter.toolsListChanged === true;
|
|
38233
|
+
case "prompts_list_changed":
|
|
38234
|
+
return filter.promptsListChanged === true;
|
|
38235
|
+
case "resources_list_changed":
|
|
38236
|
+
return filter.resourcesListChanged === true;
|
|
38237
|
+
case "resource_updated":
|
|
38238
|
+
return filter.resourceSubscriptions !== void 0 && filter.resourceSubscriptions.includes(event.uri);
|
|
38239
|
+
}
|
|
38240
|
+
}
|
|
38241
|
+
function honoredSubset(requested, capabilities) {
|
|
38242
|
+
const honored = {};
|
|
38243
|
+
const allow = (bit) => capabilities === void 0 || bit === true;
|
|
38244
|
+
if (requested.toolsListChanged === true && allow(capabilities?.tools?.listChanged)) honored.toolsListChanged = true;
|
|
38245
|
+
if (requested.promptsListChanged === true && allow(capabilities?.prompts?.listChanged)) honored.promptsListChanged = true;
|
|
38246
|
+
if (requested.resourcesListChanged === true && allow(capabilities?.resources?.listChanged)) honored.resourcesListChanged = true;
|
|
38247
|
+
if (requested.resourceSubscriptions !== void 0 && requested.resourceSubscriptions.length > 0 && allow(capabilities?.resources?.subscribe)) honored.resourceSubscriptions = [...requested.resourceSubscriptions];
|
|
38248
|
+
return honored;
|
|
38249
|
+
}
|
|
38250
|
+
var DEFAULT_MAX_SUBSCRIPTIONS = 1024;
|
|
38251
|
+
function stampSubscriptionId(notification, subscriptionId) {
|
|
38252
|
+
return {
|
|
38253
|
+
method: notification.method,
|
|
38254
|
+
params: {
|
|
38255
|
+
...notification.params,
|
|
38256
|
+
_meta: {
|
|
38257
|
+
...notification.params?._meta,
|
|
38258
|
+
[SUBSCRIPTION_ID_META_KEY]: subscriptionId
|
|
38259
|
+
}
|
|
38260
|
+
}
|
|
38261
|
+
};
|
|
38262
|
+
}
|
|
38263
|
+
function parseListenFilter(message) {
|
|
38264
|
+
const outcome = codecForVersion(MODERN_WIRE_REVISION).validateRequest("subscriptions/listen", message);
|
|
38265
|
+
return outcome.ok ? outcome.value.params?.notifications : void 0;
|
|
38266
|
+
}
|
|
38267
|
+
var CHANGE_NOTIFICATION_METHODS = /* @__PURE__ */ new Set([
|
|
38268
|
+
"notifications/tools/list_changed",
|
|
38269
|
+
"notifications/prompts/list_changed",
|
|
38270
|
+
"notifications/resources/list_changed",
|
|
38271
|
+
"notifications/resources/updated"
|
|
38272
|
+
]);
|
|
38273
|
+
var StdioListenRouter = class {
|
|
38274
|
+
/** Active subscriptions, keyed by the listen request's JSON-RPC id verbatim. */
|
|
38275
|
+
_subs = /* @__PURE__ */ new Map();
|
|
38276
|
+
/**
|
|
38277
|
+
* The serving instance's declared capabilities. Filled in by the entry
|
|
38278
|
+
* once the modern instance is constructed (the router is created before
|
|
38279
|
+
* the instance exists), so the acknowledged filter is narrowed against
|
|
38280
|
+
* what the server can actually deliver.
|
|
38281
|
+
*/
|
|
38282
|
+
_serverCapabilities;
|
|
38283
|
+
/**
|
|
38284
|
+
* The serving instance's identity, stamped onto the graceful-close
|
|
38285
|
+
* results' `_meta` (the spec's `SubscriptionsListenResultMetaObject` extends
|
|
38286
|
+
* `ResultMetaObject`). Handed over together with the capabilities.
|
|
38287
|
+
*/
|
|
38288
|
+
_serverInfo;
|
|
38289
|
+
constructor(_maxSubscriptions = DEFAULT_MAX_SUBSCRIPTIONS, serverCapabilities, serverInfo) {
|
|
38290
|
+
this._maxSubscriptions = _maxSubscriptions;
|
|
38291
|
+
this._serverCapabilities = serverCapabilities;
|
|
38292
|
+
this._serverInfo = serverInfo;
|
|
38293
|
+
}
|
|
38294
|
+
/**
|
|
38295
|
+
* Record the serving instance's declared capabilities and identity once
|
|
38296
|
+
* it has been constructed. Called by `serveStdio`'s connect path;
|
|
38297
|
+
* subsequent `serve()` calls narrow the honored filter against the
|
|
38298
|
+
* capabilities, and `teardownAll()` stamps the identity.
|
|
38299
|
+
*/
|
|
38300
|
+
setServerCapabilities(capabilities, serverInfo) {
|
|
38301
|
+
this._serverCapabilities = capabilities;
|
|
38302
|
+
if (serverInfo !== void 0) this._serverInfo = serverInfo;
|
|
38303
|
+
}
|
|
38304
|
+
/** Whether `id` is an active listen subscription on this connection. */
|
|
38305
|
+
has(id2) {
|
|
38306
|
+
return this._subs.has(id2);
|
|
38307
|
+
}
|
|
38308
|
+
/**
|
|
38309
|
+
* Serve one inbound `subscriptions/listen` request: registers the
|
|
38310
|
+
* subscription and returns the stamped acknowledged notification (or, on
|
|
38311
|
+
* capacity / params rejection, the in-band JSON-RPC error response).
|
|
38312
|
+
*
|
|
38313
|
+
* @throws when called before {@linkcode setServerCapabilities} (or the
|
|
38314
|
+
* constructor) has supplied the serving instance's capabilities. Honoring a
|
|
38315
|
+
* filter without knowing the server's advertised capabilities would fail
|
|
38316
|
+
* open (deliver unadvertised types); the entry guarantees capabilities are
|
|
38317
|
+
* set before any listen request is routed here.
|
|
38318
|
+
*/
|
|
38319
|
+
serve(message) {
|
|
38320
|
+
if (this._serverCapabilities === void 0) throw new Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");
|
|
38321
|
+
if (this._subs.size >= this._maxSubscriptions) return {
|
|
38322
|
+
jsonrpc: "2.0",
|
|
38323
|
+
id: message.id,
|
|
38324
|
+
error: {
|
|
38325
|
+
code: -32603,
|
|
38326
|
+
message: "Subscription limit reached"
|
|
38327
|
+
}
|
|
38328
|
+
};
|
|
38329
|
+
const filter = parseListenFilter(message);
|
|
38330
|
+
if (filter === void 0) return {
|
|
38331
|
+
jsonrpc: "2.0",
|
|
38332
|
+
id: message.id,
|
|
38333
|
+
error: {
|
|
38334
|
+
code: -32602,
|
|
38335
|
+
message: "Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"
|
|
38336
|
+
}
|
|
38337
|
+
};
|
|
38338
|
+
const honored = honoredSubset(filter, this._serverCapabilities);
|
|
38339
|
+
this._subs.set(message.id, honored);
|
|
38340
|
+
return stampSubscriptionId({
|
|
38341
|
+
method: "notifications/subscriptions/acknowledged",
|
|
38342
|
+
params: { notifications: honored }
|
|
38343
|
+
}, message.id);
|
|
38344
|
+
}
|
|
38345
|
+
/**
|
|
38346
|
+
* Tear down one subscription (inbound `notifications/cancelled`). Returns
|
|
38347
|
+
* `true` when a subscription was removed. After this call NOTHING further
|
|
38348
|
+
* is delivered for that subscription id (the post-cancel hardening).
|
|
38349
|
+
*/
|
|
38350
|
+
cancel(id2) {
|
|
38351
|
+
return this._subs.delete(id2);
|
|
38352
|
+
}
|
|
38353
|
+
/**
|
|
38354
|
+
* Route an outbound notification through the active subscriptions.
|
|
38355
|
+
*
|
|
38356
|
+
* - For a subscription-gated change notification, returns one stamped copy
|
|
38357
|
+
* per subscription that opted in to it (an empty array means it is
|
|
38358
|
+
* dropped — the modern era never delivers an un-requested change type).
|
|
38359
|
+
* - For any other outbound message, returns `'passthrough'` (the entry
|
|
38360
|
+
* forwards it as-is).
|
|
38361
|
+
*/
|
|
38362
|
+
routeOutbound(message) {
|
|
38363
|
+
if (!CHANGE_NOTIFICATION_METHODS.has(message.method)) return "passthrough";
|
|
38364
|
+
const uriParam = message.params?.["uri"];
|
|
38365
|
+
const uri = typeof uriParam === "string" ? uriParam : void 0;
|
|
38366
|
+
const event = notificationToServerEvent(message.method, uri);
|
|
38367
|
+
const out = [];
|
|
38368
|
+
for (const [subscriptionId, filter] of this._subs) if (listenFilterAccepts(filter, event)) out.push(stampSubscriptionId({
|
|
38369
|
+
method: message.method,
|
|
38370
|
+
params: message.params ?? {}
|
|
38371
|
+
}, subscriptionId));
|
|
38372
|
+
return out;
|
|
38373
|
+
}
|
|
38374
|
+
/**
|
|
38375
|
+
* Server-side graceful teardown of every active subscription: returns the
|
|
38376
|
+
* empty `subscriptions/listen` JSON-RPC result for each subscription id —
|
|
38377
|
+
* the spec's graceful-close signal, `_meta` carrying the subscription id
|
|
38378
|
+
* and the serving instance's identity — for the entry to emit before
|
|
38379
|
+
* closing the wire. Clears the set so nothing further is delivered.
|
|
38380
|
+
*/
|
|
38381
|
+
teardownAll() {
|
|
38382
|
+
const out = [];
|
|
38383
|
+
for (const id2 of this._subs.keys()) out.push({
|
|
38384
|
+
jsonrpc: "2.0",
|
|
38385
|
+
id: id2,
|
|
38386
|
+
result: {
|
|
38387
|
+
resultType: "complete",
|
|
38388
|
+
_meta: {
|
|
38389
|
+
[SUBSCRIPTION_ID_META_KEY]: id2,
|
|
38390
|
+
...this._serverInfo !== void 0 && { [SERVER_INFO_META_KEY]: this._serverInfo }
|
|
38391
|
+
}
|
|
38392
|
+
}
|
|
38393
|
+
});
|
|
38394
|
+
this._subs.clear();
|
|
38395
|
+
return out;
|
|
38396
|
+
}
|
|
38397
|
+
};
|
|
38398
|
+
function notificationToServerEvent(method, uri) {
|
|
38399
|
+
switch (method) {
|
|
38400
|
+
case "notifications/tools/list_changed":
|
|
38401
|
+
return { kind: "tools_list_changed" };
|
|
38402
|
+
case "notifications/prompts/list_changed":
|
|
38403
|
+
return { kind: "prompts_list_changed" };
|
|
38404
|
+
case "notifications/resources/list_changed":
|
|
38405
|
+
return { kind: "resources_list_changed" };
|
|
38406
|
+
default:
|
|
38407
|
+
return {
|
|
38408
|
+
kind: "resource_updated",
|
|
38409
|
+
uri: uri ?? ""
|
|
38410
|
+
};
|
|
38411
|
+
}
|
|
38412
|
+
}
|
|
38413
|
+
|
|
37794
38414
|
// node_modules/@modelcontextprotocol/server/dist/stdio.mjs
|
|
37795
38415
|
var swallowsErrorsAfterClose = /* @__PURE__ */ Symbol("swallowsErrorsAfterClose");
|
|
37796
38416
|
var StdioServerTransport = class {
|
|
@@ -47063,7 +47683,7 @@ function describeTokenlessLogin(record2) {
|
|
|
47063
47683
|
|
|
47064
47684
|
// src/version.ts
|
|
47065
47685
|
var SERVER_NAME = "ofw-mcp";
|
|
47066
|
-
var VERSION = "2.
|
|
47686
|
+
var VERSION = "2.25.0";
|
|
47067
47687
|
|
|
47068
47688
|
// src/auth.ts
|
|
47069
47689
|
function fetchproxyDisabled() {
|
|
@@ -48322,6 +48942,9 @@ async function syncDrafts(client2, draftsFolderId, store, budget) {
|
|
|
48322
48942
|
await markFolderVerified(store, "drafts", now);
|
|
48323
48943
|
return { synced, done: true };
|
|
48324
48944
|
}
|
|
48945
|
+
function unreadInboxNote(count) {
|
|
48946
|
+
return `${count} unread inbox messages cached without bodies. Call ofw_get_message(id) to read them \u2014 this will mark them as read on OFW.`;
|
|
48947
|
+
}
|
|
48325
48948
|
async function syncAll(client2, opts, store) {
|
|
48326
48949
|
const requested = opts.folders ?? ["inbox", "sent", "drafts"];
|
|
48327
48950
|
const folders = [
|
|
@@ -48383,7 +49006,7 @@ async function syncAll(client2, opts, store) {
|
|
|
48383
49006
|
notes.push('The drafts folder was NOT checked against OurFamilyWizard on this call (the request budget ran out first), so no drafts count is reported and the cached drafts are marked "unverified". Cached draft bodies may be behind the server. Call ofw_sync_messages again \u2014 or ofw_sync_messages with folders:["drafts"] \u2014 before editing or deleting a draft.');
|
|
48384
49007
|
}
|
|
48385
49008
|
if (unreadInbox.length > 0) {
|
|
48386
|
-
notes.push(
|
|
49009
|
+
notes.push(unreadInboxNote(unreadInbox.length));
|
|
48387
49010
|
}
|
|
48388
49011
|
if (notRefreshed.length > 0) {
|
|
48389
49012
|
notes.push(`NOT checked against OurFamilyWizard on this call: ${notRefreshed.join(", ")}. No count is reported for ${notRefreshed.length > 1 ? "those folders" : "that folder"} \u2014 absence of a count means "not looked at", not "no changes". Cached contents may be behind the server; call ofw_sync_messages again to finish, or ofw_check_freshness for a cheap live confirmation.`);
|
|
@@ -50363,6 +50986,44 @@ function unverifiedEmptyResponse(input2) {
|
|
|
50363
50986
|
function markReadPermitted() {
|
|
50364
50987
|
return getAllowMarkRead() && readingBlockedToday() === null && !getConfirmMarkRead();
|
|
50365
50988
|
}
|
|
50989
|
+
function markReadCeiling() {
|
|
50990
|
+
if (!getAllowMarkRead()) {
|
|
50991
|
+
return {
|
|
50992
|
+
gate: "OFW_ALLOW_MARK_READ",
|
|
50993
|
+
reason: "This server is configured with OFW_ALLOW_MARK_READ=false, so no tool may mark a message read on OurFamilyWizard. Unread inbox bodies were NOT fetched, and no per-call argument can change that."
|
|
50994
|
+
};
|
|
50995
|
+
}
|
|
50996
|
+
const blocked = readingBlockedToday();
|
|
50997
|
+
if (blocked !== null) {
|
|
50998
|
+
return {
|
|
50999
|
+
gate: "OFW_READ_DAYS",
|
|
51000
|
+
reason: "Today is a no-read day (OFW_READ_DAYS / OFW_NO_READ_DAYS), so no message body was fetched. readingBlocked says when reading resumes.",
|
|
51001
|
+
readingBlocked: blocked
|
|
51002
|
+
};
|
|
51003
|
+
}
|
|
51004
|
+
return null;
|
|
51005
|
+
}
|
|
51006
|
+
var MAX_SYNC_OPEN_UNREAD = 25;
|
|
51007
|
+
async function unreadCandidates(cache) {
|
|
51008
|
+
const all = (await cache.listMessages({ folder: "inbox", page: 1, size: 1e3 })).filter((row) => row.body === null && !deriveRead(row));
|
|
51009
|
+
return { rows: all.slice(0, MAX_SYNC_OPEN_UNREAD), remaining: Math.max(0, all.length - MAX_SYNC_OPEN_UNREAD) };
|
|
51010
|
+
}
|
|
51011
|
+
async function openUnreadBody(client2, cache, cached2) {
|
|
51012
|
+
const detail = parseLenient(
|
|
51013
|
+
MessageDetailSchema,
|
|
51014
|
+
await client2.request("GET", `/pub/v3/messages/${cached2.id}`),
|
|
51015
|
+
{ label: "ofw-mcp", context: "GET /pub/v3/messages/{id} (sync, confirmed mark-read)" }
|
|
51016
|
+
);
|
|
51017
|
+
await cache.upsertMessage({
|
|
51018
|
+
...cached2,
|
|
51019
|
+
recipients: detail.recipients ? mapRecipients(detail.recipients) : cached2.recipients,
|
|
51020
|
+
body: detail.body ?? "",
|
|
51021
|
+
fetchedBodyAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
51022
|
+
});
|
|
51023
|
+
if (Array.isArray(detail.files) && detail.files.length > 0) {
|
|
51024
|
+
await fetchAttachmentMetaForMessage(client2, cached2.id, detail.files, cache);
|
|
51025
|
+
}
|
|
51026
|
+
}
|
|
50366
51027
|
async function confirmMarkRead(ctx, cached2, args) {
|
|
50367
51028
|
if (!getConfirmMarkRead()) return void 0;
|
|
50368
51029
|
if (cached2 !== null && !(cached2.folder === "inbox" && !deriveRead(cached2))) return void 0;
|
|
@@ -51557,26 +52218,76 @@ ${jsonText(
|
|
|
51557
52218
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },
|
|
51558
52219
|
inputSchema: external_exports.object({
|
|
51559
52220
|
folders: external_exports.array(external_exports.enum(["inbox", "sent", "drafts"])).min(1).describe("Folders to sync (default: all three). Must be non-empty if given \u2014 an empty list would sync nothing while reporting success.").optional(),
|
|
51560
|
-
fetchUnreadBodies: external_exports.boolean().describe(
|
|
52221
|
+
fetchUnreadBodies: external_exports.boolean().describe(`If true, also fetch bodies for unread inbox messages \u2014 which marks each one READ on OurFamilyWizard and stamps a co-parent-visible "First Viewed" time that cannot be undone. Defaults to the OFW_FETCH_UNREAD_BODIES env var (false unless set). Applies only when the inbox is among the folders synced. Refused outright when OFW_ALLOW_MARK_READ=false or on a no-read day (the response's unreadBodies says which). When the server runs with OFW_CONFIRM_MARK_READ=true, the sync runs WITHOUT marking anything read and then asks the user to confirm opening the listed unread messages (newest ` + MAX_SYNC_OPEN_UNREAD + " per call): a confirmation prompt where the client supports one; otherwise it returns that list plus a confirmToken, and only a repeat call with that token opens them. Show the user the list and wait for their yes.").optional(),
|
|
51561
52222
|
deep: external_exports.boolean().describe("If true, walk every OFW page until empty regardless of cache state. Use to backfill gaps. Default false.").optional(),
|
|
51562
|
-
maxRequests: external_exports.number().int().min(1).describe("Maximum OFW requests this single call may make before pausing. When hit, the response reports done:false \u2014 call again with the same arguments to continue. Omit to use the server default (OFW_SYNC_MAX_REQUESTS, or unbounded on local installs).").optional()
|
|
52223
|
+
maxRequests: external_exports.number().int().min(1).describe("Maximum OFW requests this single call may make before pausing. When hit, the response reports done:false \u2014 call again with the same arguments to continue. Omit to use the server default (OFW_SYNC_MAX_REQUESTS, or unbounded on local installs).").optional(),
|
|
52224
|
+
confirmToken: confirmTokenParam
|
|
51563
52225
|
})
|
|
51564
|
-
}, async (args) => {
|
|
52226
|
+
}, async (args, ctx) => {
|
|
51565
52227
|
const cache = cacheProvider();
|
|
52228
|
+
const syncsInbox = (args.folders ?? ["inbox"]).includes("inbox");
|
|
52229
|
+
const requested = syncsInbox && (args.fetchUnreadBodies ?? getFetchUnreadBodies());
|
|
52230
|
+
const ceiling = requested ? markReadCeiling() : null;
|
|
52231
|
+
const askFirst = requested && ceiling === null && getConfirmMarkRead();
|
|
51566
52232
|
const result = await syncAll(client2, {
|
|
51567
52233
|
folders: args.folders,
|
|
51568
|
-
//
|
|
51569
|
-
// the
|
|
51570
|
-
|
|
51571
|
-
fetchUnreadBodies: markReadPermitted() && (args.fetchUnreadBodies ?? getFetchUnreadBodies()),
|
|
52234
|
+
// Under confirmation the sync itself never stamps: it walks list pages
|
|
52235
|
+
// only, and the approved bodies are opened below, one by one.
|
|
52236
|
+
fetchUnreadBodies: requested && ceiling === null && !askFirst,
|
|
51572
52237
|
deep: args.deep,
|
|
51573
52238
|
maxRequests: args.maxRequests ?? getSyncMaxRequests()
|
|
51574
52239
|
}, cache);
|
|
52240
|
+
let unreadBodies;
|
|
52241
|
+
if (ceiling !== null) {
|
|
52242
|
+
unreadBodies = { requested: true, fetched: false, ...ceiling };
|
|
52243
|
+
} else if (askFirst) {
|
|
52244
|
+
const { rows, remaining } = await unreadCandidates(cache);
|
|
52245
|
+
if (rows.length > 0) {
|
|
52246
|
+
const messages = rows.map((row) => ({
|
|
52247
|
+
messageId: row.id,
|
|
52248
|
+
subject: row.subject,
|
|
52249
|
+
from: senderOf(row),
|
|
52250
|
+
// The preview never passes through jsonResponse, so normalize here.
|
|
52251
|
+
...normalizeTimestampsInValue({ sentAt: row.sentAt })
|
|
52252
|
+
}));
|
|
52253
|
+
const lines = messages.map((m) => `"${m.subject}" \u2014 ${String(m.sentAtDisplay ?? m.sentAt)}`);
|
|
52254
|
+
const gate = await confirmWrite2(ctx, {
|
|
52255
|
+
args,
|
|
52256
|
+
tool: "ofw_sync_messages",
|
|
52257
|
+
action: "ofw.message.mark_read",
|
|
52258
|
+
message: `Open ${rows.length} unread OurFamilyWizard message${rows.length === 1 ? "" : "s"} and mark ${rows.length === 1 ? "it" : "them"} read? ${lines.join("; ")}.${remaining > 0 ? ` (Older unread messages not listed here: ${remaining}; they wait for the next sync.)` : ""} Opening stamps a "First Viewed" time your co-parent can see; that cannot be undone.`,
|
|
52259
|
+
target: "messages:unread-inbox",
|
|
52260
|
+
// The approval binds to THIS set: a message arriving (or being read
|
|
52261
|
+
// elsewhere) between the preview and the confirming call changes
|
|
52262
|
+
// the revision, and the stale approval is refused.
|
|
52263
|
+
revision: rows.map((row) => row.id).join(","),
|
|
52264
|
+
payload: { messageIds: rows.map((row) => row.id), markRead: true },
|
|
52265
|
+
preview: {
|
|
52266
|
+
action: `Open ${rows.length} unread OurFamilyWizard message${rows.length === 1 ? "" : "s"} (marks ${rows.length === 1 ? "it" : "them"} READ)`,
|
|
52267
|
+
warning: 'Opening these messages marks each one read on OurFamilyWizard and stamps a "First Viewed" time your co-parent can see. It is part of the record and cannot be undone. The sync itself already ran and marked nothing read.',
|
|
52268
|
+
messages,
|
|
52269
|
+
...remaining > 0 ? { remaining } : {}
|
|
52270
|
+
},
|
|
52271
|
+
confirmToken: args.confirmToken
|
|
52272
|
+
});
|
|
52273
|
+
if (gate) return gate;
|
|
52274
|
+
for (const row of rows) await openUnreadBody(client2, cache, row);
|
|
52275
|
+
}
|
|
52276
|
+
const opened = new Set(rows.map((row) => row.id));
|
|
52277
|
+
const before = result.unreadInbox.length;
|
|
52278
|
+
result.unreadInbox = result.unreadInbox.filter((hint) => !opened.has(hint.id));
|
|
52279
|
+
if (result.unreadInbox.length !== before) {
|
|
52280
|
+
const notes = result.note.split("\n\n").filter((n) => n !== unreadInboxNote(before));
|
|
52281
|
+
if (result.unreadInbox.length > 0) notes.push(unreadInboxNote(result.unreadInbox.length));
|
|
52282
|
+
result.note = notes.length > 0 ? notes.join("\n\n") : void 0;
|
|
52283
|
+
}
|
|
52284
|
+
unreadBodies = { requested: true, fetched: true, opened: [...opened], ...remaining > 0 ? { remaining } : {} };
|
|
52285
|
+
}
|
|
51575
52286
|
const freshness = await buildFreshness(cache, {
|
|
51576
52287
|
source: "cache",
|
|
51577
52288
|
folders: args.folders ?? ["inbox", "sent", "drafts"]
|
|
51578
52289
|
});
|
|
51579
|
-
return jsonResponse({ ...result, freshness });
|
|
52290
|
+
return jsonResponse({ ...result, ...unreadBodies ? { unreadBodies } : {}, freshness });
|
|
51580
52291
|
});
|
|
51581
52292
|
server.registerTool("ofw_check_freshness", {
|
|
51582
52293
|
// Not read-only, and destructive: allowMarkRead:true probes unread inbox
|
|
@@ -53840,7 +54551,7 @@ await runMcp({
|
|
|
53840
54551
|
});
|
|
53841
54552
|
/*! Bundled license information:
|
|
53842
54553
|
|
|
53843
|
-
@modelcontextprotocol/server/dist/src-
|
|
54554
|
+
@modelcontextprotocol/server/dist/src-DdvbAHrR.mjs:
|
|
53844
54555
|
(*!
|
|
53845
54556
|
* content-type
|
|
53846
54557
|
* Copyright(c) 2015 Douglas Christopher Wilson
|