diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 122f686..7041b08 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -12,7 +12,7 @@ "name": "deploygate", "source": "./plugin", "description": "Upload apps, manage distribution pages, add team members, and set up CI/CD integration with DeployGate", - "version": "1.5.1" + "version": "1.5.2" } ] } diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e20d7e8..453ca4c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.5.1" + ".": "1.5.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index c38bcaa..ac3d865 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.5.2](https://github.com/DeployGate/deploygate-agent-plugin/compare/deploygate--v1.5.1...deploygate--v1.5.2) (2026-10-07) + + +### Bug Fixes + +* mark the plugin bundle as ESM so it loads on Node 20.0-20.18 and 22.0-22.6 ([#79](https://github.com/DeployGate/deploygate-agent-plugin/issues/79)) ([579ba6a](https://github.com/DeployGate/deploygate-agent-plugin/commit/579ba6a54c58a83f0d98334082a195be05dd73e9)) + ## [1.5.1](https://github.com/DeployGate/deploygate-agent-plugin/compare/deploygate--v1.5.0...deploygate--v1.5.1) (2026-06-03) diff --git a/package-lock.json b/package-lock.json index fb3d0af..7b839f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@deploygate/mcp", - "version": "1.5.1", + "version": "1.5.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@deploygate/mcp", - "version": "1.5.1", + "version": "1.5.2", "license": "MIT", "bin": { "deploygate-mcp": "plugin/scripts/bundle.js" diff --git a/package.json b/package.json index 7aa4867..ffe63d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@deploygate/mcp", - "version": "1.5.1", + "version": "1.5.2", "description": "DeployGate MCP server: upload mobile apps, manage distribution pages, set up CI/CD, and onboard your team. Supports iOS (IPA) and Android (APK/AAB).", "type": "module", "bin": { diff --git a/plugin/.claude-plugin/plugin.json b/plugin/.claude-plugin/plugin.json index 977c041..4a032d1 100644 --- a/plugin/.claude-plugin/plugin.json +++ b/plugin/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "deploygate", - "version": "1.5.1", + "version": "1.5.2", "description": "DeployGate agent integration: upload mobile apps, manage distribution pages, set up CI/CD, and onboard your team. Supports iOS (IPA) and Android (APK/AAB).", "author": { "name": "DeployGate", diff --git a/plugin/.codex-plugin/plugin.json b/plugin/.codex-plugin/plugin.json index bdcf958..020abe1 100644 --- a/plugin/.codex-plugin/plugin.json +++ b/plugin/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "deploygate", - "version": "1.5.1", + "version": "1.5.2", "description": "DeployGate agent integration: upload mobile apps, manage distribution pages, set up CI/CD, and onboard your team. Supports iOS (IPA) and Android (APK/AAB).", "author": { "name": "DeployGate", diff --git a/plugin/scripts/bundle.js b/plugin/scripts/bundle.js index c308186..134f259 100755 --- a/plugin/scripts/bundle.js +++ b/plugin/scripts/bundle.js @@ -6,7 +6,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + try { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + } catch (e) { + throw mod = 0, e; + } }; var __export = (target, all) => { for (var name in all) @@ -3105,9 +3109,28 @@ var require_utils = __commonJS({ "use strict"; var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu); var 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); + var isPort = RegExp.prototype.test.bind(/^\d*$/u); var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu); var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu); - var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu); + var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u); + var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u); + var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u); + var BYTE_HEX = new Array(256); + { + const HEX_DIGITS = "0123456789ABCDEF"; + for (let i = 0; i < 256; i++) { + BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15]; + } + } + function percentEncodeNonAscii(cp) { + if (cp < 2048) { + return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63]; + } + if (cp < 65536) { + return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63]; + } + return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63]; + } function stringArrayToHexStripped(input) { let acc = ""; let code = 0; @@ -3132,91 +3155,105 @@ var require_utils = __commonJS({ } return acc; } + var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/); + var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/); + var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/); var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u); - function consumeIsZone(buffer) { - buffer.length = 0; - return true; - } - function consumeHextets(buffer, address, output) { - if (buffer.length) { - const hex3 = stringArrayToHexStripped(buffer); - if (hex3 !== "") { - address.push(hex3); - } else { - output.error = true; - return false; + function isZoneIdentifier(zone) { + if (zone.length === 0) return false; + for (let i = 0; i < zone.length; i++) { + if (isZoneCharacter(zone[i])) continue; + if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) { + i += 2; + continue; } - buffer.length = 0; + return false; } return true; } - function getIPV6(input) { - let tokenCount = 0; - const output = { error: false, address: "", zone: "" }; - const address = []; - const buffer = []; - let endipv6Encountered = false; - let endIpv6 = false; - let consume = consumeHextets; - for (let i = 0; i < input.length; i++) { - const cursor = input[i]; - if (cursor === "[" || cursor === "]") { - continue; - } - if (cursor === ":") { - if (endipv6Encountered === true) { - endIpv6 = true; - } - if (!consume(buffer, address, output)) { - break; - } - if (++tokenCount > 7) { - output.error = true; - break; - } - if (i > 0 && input[i - 1] === ":") { - endipv6Encountered = true; + function compressIPv6ZeroRun(hextets) { + let bestStart = -1; + let bestLength = 0; + let runStart = -1; + let runLength = 0; + for (let i = 0; i < hextets.length; i++) { + if (hextets[i] === "0") { + if (runStart === -1) runStart = i; + runLength++; + if (runLength > bestLength) { + bestLength = runLength; + bestStart = runStart; } - address.push(":"); - continue; - } else if (cursor === "%") { - if (!consume(buffer, address, output)) { - break; - } - consume = consumeIsZone; } else { - buffer.push(cursor); + runStart = -1; + runLength = 0; + } + } + if (bestLength < 2) return hextets.join(":"); + const head = hextets.slice(0, bestStart).join(":"); + const tail = hextets.slice(bestStart + bestLength).join(":"); + return head + "::" + tail; + } + function normalizeIPv6Address(input) { + const compression = input.indexOf("::"); + if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0; + const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":"); + const right = compression === -1 ? [] : input.slice(compression + 2).split(":"); + if (compression !== -1) { + if (left.length === 1 && left[0] === "") left.length = 0; + if (right.length === 1 && right[0] === "") right.length = 0; + } + const parts = left.concat(right); + let hextetCount = 0; + for (let i = 0; i < parts.length; i++) { + const part = parts[i]; + if (part === "") return void 0; + if (part.indexOf(".") !== -1) { + if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0; + hextetCount += 2; continue; } + if (!isHextet(part)) return void 0; + parts[i] = parseInt(part, 16).toString(16); + hextetCount++; } - if (buffer.length) { - if (consume === consumeIsZone) { - output.zone = buffer.join(""); - } else if (endIpv6) { - address.push(buffer.join("")); - } else { - address.push(stringArrayToHexStripped(buffer)); - } + if (compression === -1) { + if (hextetCount !== 8) return void 0; + return compressIPv6ZeroRun(parts); } - output.address = address.join(""); - return output; + if (hextetCount >= 8) return void 0; + const expanded = parts.slice(0, left.length); + for (let i = hextetCount; i < 8; i++) expanded.push("0"); + for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]); + return compressIPv6ZeroRun(expanded); } function normalizeIPv6(host) { - if (findToken(host, ":") < 2) { - return { host, isIPV6: false }; - } - const ipv63 = getIPV6(host); - if (!ipv63.error) { - let newHost = ipv63.address; - let escapedHost = ipv63.address; - if (ipv63.zone) { - newHost += "%" + ipv63.zone; - escapedHost += "%25" + ipv63.zone; - } - return { host: newHost, isIPV6: true, escapedHost }; - } else { - return { host, isIPV6: false }; - } + const bracketed = host[0] === "[" && host[host.length - 1] === "]"; + const hasBracket = host[0] === "[" || host[host.length - 1] === "]"; + if (hasBracket && !bracketed) return { host, isIPV6: false, error: true }; + let input = bracketed ? host.slice(1, -1) : host; + if (bracketed && isIPvFuture(input)) { + input = input.toLowerCase(); + return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true }; + } + if (findToken(input, ":") < 2) { + return { host, isIPV6: false, error: bracketed }; + } + let zoneIdentifier = ""; + const zoneSeparator = input.indexOf("%"); + if (zoneSeparator !== -1) { + const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1; + zoneIdentifier = input.slice(zoneSeparator + separatorLength); + if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true }; + input = input.slice(0, zoneSeparator); + } + const address = normalizeIPv6Address(input); + if (address === void 0) return { host, isIPV6: false, error: true }; + return { + host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""), + escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""), + isIPV6: true + }; } function findToken(str, token) { let ind = 0; @@ -3335,7 +3372,8 @@ var require_utils = __commonJS({ function normalizePathEncoding(input) { let output = ""; for (let i = 0; i < input.length; i++) { - if (input[i] === "%" && i + 2 < input.length) { + const ch = input[i]; + if (ch === "%" && i + 2 < input.length) { const hex3 = input.slice(i + 1, i + 3); if (isHexPair(hex3)) { const normalizedHex = hex3.toUpperCase(); @@ -3349,10 +3387,152 @@ var require_utils = __commonJS({ continue; } } - if (isPathCharacter(input[i])) { - output += input[i]; + if (isPathCharacter(ch)) { + output += ch; + } else { + const code = input.charCodeAt(i); + if (code < 128) { + output += isEscapeSafe(code) ? ch : BYTE_HEX[code]; + } else if (code < 55296 || code > 57343) { + output += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input.length) { + const low = input.charCodeAt(i + 1); + if (low >= 56320 && low <= 57343) { + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + i++; + } else { + output += percentEncodeNonAscii(65533); + } + } else { + output += percentEncodeNonAscii(65533); + } + } + } + return output; + } + function serializePathEncoding(input, pathNoScheme = false) { + let output = ""; + let firstSegment = pathNoScheme && input[0] !== "/"; + for (let i = 0; i < input.length; i++) { + const ch = input[i]; + if (ch === "%" && i + 2 < input.length) { + const hex3 = input.slice(i + 1, i + 3); + if (isHexPair(hex3)) { + output += "%" + hex3.toUpperCase(); + i += 2; + continue; + } + } + if (ch === "/") { + firstSegment = false; + } + if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) { + output += ch; + } else { + const code = input.charCodeAt(i); + if (code < 128) { + output += BYTE_HEX[code]; + } else if (code < 55296 || code > 57343) { + output += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input.length) { + const low = input.charCodeAt(i + 1); + if (low >= 56320 && low <= 57343) { + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + i++; + } else { + output += percentEncodeNonAscii(65533); + } + } else { + output += percentEncodeNonAscii(65533); + } + } + } + return output; + } + function encodeComponent(input, isAllowed) { + let output = ""; + for (let i = 0; i < input.length; i++) { + const ch = input[i]; + if (ch === "%" && i + 2 < input.length) { + const hex3 = input.slice(i + 1, i + 3); + if (isHexPair(hex3)) { + output += "%" + hex3.toUpperCase(); + i += 2; + continue; + } + } + if (isAllowed(ch)) { + output += ch; } else { - output += escape(input[i]); + const code = input.charCodeAt(i); + if (code < 128) { + output += BYTE_HEX[code]; + } else if (code < 55296 || code > 57343) { + output += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input.length) { + const low = input.charCodeAt(i + 1); + if (low >= 56320 && low <= 57343) { + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + i++; + } else { + output += percentEncodeNonAscii(65533); + } + } else { + output += percentEncodeNonAscii(65533); + } + } + } + return output; + } + function encodeUserinfo(input) { + return encodeComponent(input, isUserinfoCharacter); + } + function encodeQuery(input) { + return encodeComponent(input, isQueryFragmentCharacter); + } + function encodeFragment(input) { + return encodeComponent(input, isQueryFragmentCharacter); + } + function isEscapeSafe(cp) { + 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; + } + function normalizeQueryFragmentEncoding(input) { + let output = ""; + for (let i = 0; i < input.length; i++) { + const ch = input[i]; + if (ch === "%" && i + 2 < input.length) { + const hex3 = input.slice(i + 1, i + 3); + if (isHexPair(hex3)) { + const normalizedHex = hex3.toUpperCase(); + const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); + if (isUnreserved(decoded)) { + output += decoded; + } else { + output += "%" + normalizedHex; + } + i += 2; + continue; + } + } + if (isQueryFragmentCharacter(ch)) { + output += ch; + } else { + const code = input.charCodeAt(i); + if (code < 128) { + output += isEscapeSafe(code) ? ch : BYTE_HEX[code]; + } else if (code < 55296 || code > 57343) { + output += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input.length) { + const low = input.charCodeAt(i + 1); + if (low >= 56320 && low <= 57343) { + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + i++; + } else { + output += percentEncodeNonAscii(65533); + } + } else { + output += percentEncodeNonAscii(65533); + } } } return output; @@ -3375,14 +3555,18 @@ var require_utils = __commonJS({ function recomposeAuthority(component) { const uriTokens = []; if (component.userinfo !== void 0) { - uriTokens.push(component.userinfo); + uriTokens.push(encodeUserinfo(component.userinfo)); uriTokens.push("@"); } if (component.host !== void 0) { - let host = unescape(component.host); + let host = component.host; if (!isIPv4(host)) { - const ipV6res = normalizeIPv6(host); - if (ipV6res.isIPV6 === true) { + let ipV6res = normalizeIPv6(host); + if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) { + host = normalizePercentEncoding(host, true); + ipV6res = normalizeIPv6(host); + } + if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) { host = `[${ipV6res.escapedHost}]`; } else { host = reescapeHostDelimiters(host, false); @@ -3391,8 +3575,12 @@ var require_utils = __commonJS({ uriTokens.push(host); } if (typeof component.port === "number" || typeof component.port === "string") { + const port = String(component.port); + if (!isPort(port)) { + throw new TypeError("URI port is malformed."); + } uriTokens.push(":"); - uriTokens.push(String(component.port)); + uriTokens.push(port); } return uriTokens.length ? uriTokens.join("") : void 0; } @@ -3402,6 +3590,11 @@ var require_utils = __commonJS({ reescapeHostDelimiters, normalizePercentEncoding, normalizePathEncoding, + serializePathEncoding, + normalizeQueryFragmentEncoding, + encodeUserinfo, + encodeQuery, + encodeFragment, escapePreservingEscapes, removeDotSegments, isIPv4, @@ -3417,7 +3610,7 @@ var require_schemes = __commonJS({ "node_modules/fast-uri/lib/schemes.js"(exports, module) { "use strict"; var { isUUID } = require_utils(); - var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu; + var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu; var supportedSchemeNames = ( /** @type {const} */ [ @@ -3478,9 +3671,10 @@ var require_schemes = __commonJS({ wsComponent.secure = void 0; } if (wsComponent.resourceName) { - const [path, query] = wsComponent.resourceName.split("?"); + const queryIndex = wsComponent.resourceName.indexOf("?"); + const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex); wsComponent.path = path && path !== "/" ? path : void 0; - wsComponent.query = query; + wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1); wsComponent.resourceName = void 0; } wsComponent.fragment = void 0; @@ -3492,7 +3686,7 @@ var require_schemes = __commonJS({ return urnComponent; } const matches = urnComponent.path.match(URN_REG); - if (matches) { + if (matches && matches[0] === urnComponent.path) { const scheme = options.scheme || urnComponent.scheme || "urn"; urnComponent.nid = matches[1].toLowerCase(); urnComponent.nss = matches[2]; @@ -3626,8 +3820,17 @@ var require_schemes = __commonJS({ var require_fast_uri = __commonJS({ "node_modules/fast-uri/index.js"(exports, module) { "use strict"; - var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils(); + var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils(); var { SCHEMES, getSchemeHandler } = require_schemes(); + var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u; + var MALFORMED_SCHEME_ERROR = "URI scheme is malformed."; + function decodeValidScheme(scheme) { + const decodedScheme = unescape(String(scheme)); + if (!VALID_SCHEME.test(decodedScheme)) { + throw new TypeError(MALFORMED_SCHEME_ERROR); + } + return decodedScheme; + } function normalize(uri, options) { if (typeof uri === "string") { uri = /** @type {T} */ @@ -3640,7 +3843,34 @@ var require_fast_uri = __commonJS({ } function resolve(baseURI, relativeURI, options) { const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" }; - const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true); + const { + parsed: baseParsed, + malformedAuthorityOrPort: baseMalformed, + malformedPercentEncoding: baseMalformedPercentEncoding, + malformedSchemeSpecific: baseMalformedSchemeSpecific, + malformedHost: baseMalformedHost, + malformedScheme: baseMalformedScheme + } = parseWithStatus(baseURI, schemelessOptions); + const { + parsed: relativeParsed, + malformedAuthorityOrPort: relativeMalformed, + malformedPercentEncoding: relativeMalformedPercentEncoding, + malformedSchemeSpecific: relativeMalformedSchemeSpecific, + malformedHost: relativeMalformedHost, + malformedScheme: relativeMalformedScheme + } = parseWithStatus(relativeURI, schemelessOptions); + if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) { + throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed."); + } + const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true); + const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme); + const resolvedHost = resolved.host; + const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6); + canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP); + const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost); + if (resolved.error && !encodedASCIIHost) { + throw new Error(resolved.error); + } schemelessOptions.skipEscape = true; return serialize(resolved, schemelessOptions); } @@ -3700,7 +3930,7 @@ var require_fast_uri = __commonJS({ function equal(uriA, uriB, options) { const normalizedA = normalizeComparableURI(uriA, options); const normalizedB = normalizeComparableURI(uriB, options); - return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase(); + return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB; } function serialize(cmpts, opts) { const component = { @@ -3721,19 +3951,22 @@ var require_fast_uri = __commonJS({ }; const options = Object.assign({}, opts); const uriTokens = []; + if (component.scheme) { + component.scheme = decodeValidScheme(component.scheme); + } const schemeHandler = getSchemeHandler(options.scheme || component.scheme); if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options); + const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0; + const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority; if (component.path !== void 0) { if (!options.skipEscape) { - component.path = escapePreservingEscapes(component.path); - if (component.scheme !== void 0) { - component.path = component.path.split("%3A").join(":"); - } + component.path = serializePathEncoding(component.path, pathNoScheme); } else { component.path = normalizePercentEncoding(component.path); } } if (options.reference !== "suffix" && component.scheme) { + component.scheme = decodeValidScheme(component.scheme); uriTokens.push(component.scheme, ":"); } const authority = recomposeAuthority(component); @@ -3751,20 +3984,25 @@ var require_fast_uri = __commonJS({ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) { s = removeDotSegments(s); } + if (pathNoScheme) { + s = serializePathEncoding(s, true); + } if (authority === void 0 && s[0] === "/" && s[1] === "/") { s = "/%2F" + s.slice(2); } uriTokens.push(s); } if (component.query !== void 0) { - uriTokens.push("?", component.query); + uriTokens.push("?", encodeQuery(component.query)); } if (component.fragment !== void 0) { - uriTokens.push("#", component.fragment); + uriTokens.push("#", encodeFragment(component.fragment)); } return uriTokens.join(""); } var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u; + var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/; + var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/; function getParseError(parsed, matches) { if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") { return 'URI path must start with "/" when authority is present.'; @@ -3774,6 +4012,35 @@ var require_fast_uri = __commonJS({ } return void 0; } + function hasMalformedPercentEncoding(component) { + if (component === void 0) return false; + let percent = component.indexOf("%"); + while (percent !== -1) { + if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) { + return true; + } + percent = component.indexOf("%", percent + 3); + } + return false; + } + function isIPLiteral(host) { + return host[0] === "[" && host[host.length - 1] === "]"; + } + function hasMalformedComponentPercentEncoding(matches) { + const host = matches[4]; + return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]); + } + function canonicalizeHost(parsed, options, schemeHandler, isIP) { + if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) { + try { + parsed.host = new URL("http://" + parsed.host).hostname; + } catch (e) { + parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e; + return true; + } + } + return false; + } function parseWithStatus(uri, opts) { const options = Object.assign({}, opts); const parsed = { @@ -3786,6 +4053,11 @@ var require_fast_uri = __commonJS({ fragment: void 0 }; let malformedAuthorityOrPort = false; + let malformedPercentEncoding = false; + let malformedSchemeSpecific = false; + let malformedHost = false; + let malformedIPLiteral = false; + let malformedScheme = false; let isIP = false; if (options.reference === "suffix") { if (options.scheme) { @@ -3794,6 +4066,25 @@ var require_fast_uri = __commonJS({ uri = "//" + uri; } } + const authorityMatch = uri.match(AUTHORITY_PREFIX); + if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) { + parsed.error = "URI authority must not contain a literal backslash."; + malformedAuthorityOrPort = true; + } + const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION); + if (introducerMatch !== null) { + const region = introducerMatch[1]; + const normalizedRegion = region.replace(/[\t\n\r]/g, ""); + if (normalizedRegion.length >= 2) { + if (normalizedRegion.slice(0, 2) !== "//") { + parsed.error = parsed.error || "URI authority must not contain a literal backslash."; + malformedAuthorityOrPort = true; + } else if (region.length !== normalizedRegion.length) { + parsed.error = parsed.error || "URI authority introducer must not contain whitespace."; + malformedAuthorityOrPort = true; + } + } + } const matches = uri.match(URI_PARSE); if (matches) { parsed.scheme = matches[1]; @@ -3803,6 +4094,19 @@ var require_fast_uri = __commonJS({ parsed.path = matches[6] || ""; parsed.query = matches[7]; parsed.fragment = matches[8]; + if (parsed.scheme !== void 0) { + const decodedScheme = unescape(parsed.scheme); + if (VALID_SCHEME.test(decodedScheme)) { + parsed.scheme = decodedScheme.toLowerCase(); + } else { + parsed.error = parsed.error || MALFORMED_SCHEME_ERROR; + malformedScheme = true; + } + } + malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches); + if (malformedPercentEncoding) { + parsed.error = parsed.error || "URI contains malformed percent-encoding."; + } if (isNaN(parsed.port)) { parsed.port = matches[5]; } @@ -3814,9 +4118,16 @@ var require_fast_uri = __commonJS({ if (parsed.host) { const ipv4result = isIPv4(parsed.host); if (ipv4result === false) { + const bracketedIPLiteral = isIPLiteral(parsed.host); + const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1; const ipv6result = normalizeIPv6(parsed.host); - parsed.host = ipv6result.host.toLowerCase(); - isIP = ipv6result.isIPV6; + isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true; + malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true); + parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase(); + if (malformedIPLiteral) { + parsed.error = parsed.error || "URI host is malformed."; + malformedAuthorityOrPort = true; + } } else { isIP = true; } @@ -3834,42 +4145,36 @@ var require_fast_uri = __commonJS({ parsed.error = parsed.error || "URI is not a " + options.reference + " reference."; } const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme); - if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) { - if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) { - try { - parsed.host = URL.domainToASCII(parsed.host.toLowerCase()); - } catch (e) { - parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e; - } - } + if (!malformedIPLiteral) { + malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP); } if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) { if (uri.indexOf("%") !== -1) { - if (parsed.scheme !== void 0) { - parsed.scheme = unescape(parsed.scheme); - } - if (parsed.host !== void 0) { - parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP); + if (parsed.host !== void 0 && !malformedIPLiteral) { + const host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true); + parsed.host = reescapeHostDelimiters(host, isIP); } } if (parsed.path) { parsed.path = normalizePathEncoding(parsed.path); } + if (parsed.query) { + parsed.query = normalizeQueryFragmentEncoding(parsed.query); + } if (parsed.fragment) { - try { - parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment)); - } catch { - parsed.error = parsed.error || "URI malformed"; - } + parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment); } } if (schemeHandler && schemeHandler.parse) { schemeHandler.parse(parsed, options); + if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) { + malformedSchemeSpecific = true; + } } } else { parsed.error = parsed.error || "URI can not be parsed."; } - return { parsed, malformedAuthorityOrPort }; + return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme }; } function parse3(uri, opts) { return parseWithStatus(uri, opts).parsed; @@ -3878,20 +4183,28 @@ var require_fast_uri = __commonJS({ return normalizeStringWithStatus(uri, opts).normalized; } function normalizeStringWithStatus(uri, opts) { - const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts); + const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts); return { - normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts), - malformedAuthorityOrPort + normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts), + malformedAuthorityOrPort, + malformedPercentEncoding, + malformedSchemeSpecific, + malformedHost, + malformedScheme }; } function normalizeComparableURI(uri, opts) { - if (typeof uri === "string") { - const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts); - return malformedAuthorityOrPort ? void 0 : normalized; + if (typeof uri !== "string" && typeof uri !== "object") { + return void 0; } - if (typeof uri === "object") { - return serialize(uri, opts); + let value; + try { + value = typeof uri === "string" ? uri : serialize(uri, opts); + } catch { + return void 0; } + const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts); + return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized; } var fastUri = { SCHEMES, @@ -23038,17 +23351,33 @@ function normalizeObjectSchema(schema) { } return void 0; } +function getDotPath(path) { + if (path.length === 0) { + return "object root"; + } + return path.reduce((acc, seg, index) => { + if (index === 0) { + return String(seg); + } + if (typeof seg === "number") { + return `${acc}[${seg}]`; + } + return `${acc}.${seg}`; + }, ""); +} function getParseErrorMessage(error51) { if (error51 && typeof error51 === "object") { + if ("issues" in error51 && Array.isArray(error51.issues) && error51.issues.length > 0) { + return error51.issues.map((i) => { + if (!i.path?.length) { + return i.message; + } + return `${i.message} at ${getDotPath(i.path)}`; + }).join("\n"); + } if ("message" in error51 && typeof error51.message === "string") { return error51.message; } - if ("issues" in error51 && Array.isArray(error51.issues) && error51.issues.length > 0) { - const firstIssue = error51.issues[0]; - if (firstIssue && typeof firstIssue === "object" && "message" in firstIssue) { - return String(firstIssue.message); - } - } try { return JSON.stringify(error51); } catch { @@ -29663,16 +29992,7 @@ var Server = class extends Protocol { if (!methodSchema) { throw new Error("Schema is missing a method literal"); } - let methodValue; - if (isZ4Schema(methodSchema)) { - const v4Schema = methodSchema; - const v4Def = v4Schema._zod?.def; - methodValue = v4Def?.value ?? v4Schema.value; - } else { - const v3Schema = methodSchema; - const legacyDef = v3Schema._def; - methodValue = legacyDef?.value ?? v3Schema.value; - } + const methodValue = getLiteralValue(methodSchema); if (typeof methodValue !== "string") { throw new Error("Schema method literal must be a string"); } @@ -30860,8 +31180,17 @@ var EMPTY_COMPLETION_RESULT = { import process3 from "node:process"; // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js +var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024; var ReadBuffer = class { + constructor(options) { + this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE; + } append(chunk) { + const newSize = (this._buffer?.length ?? 0) + chunk.length; + if (newSize > this._maxBufferSize) { + this.clear(); + throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`); + } this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk; } readMessage() { @@ -30889,18 +31218,24 @@ function serializeMessage(message) { // node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js var StdioServerTransport = class { - constructor(_stdin = process3.stdin, _stdout = process3.stdout) { + constructor(_stdin = process3.stdin, _stdout = process3.stdout, options) { this._stdin = _stdin; this._stdout = _stdout; - this._readBuffer = new ReadBuffer(); this._started = false; this._ondata = (chunk) => { - this._readBuffer.append(chunk); - this.processReadBuffer(); + try { + this._readBuffer.append(chunk); + this.processReadBuffer(); + } catch (error51) { + this.onerror?.(error51); + this.close().catch(() => { + }); + } }; this._onerror = (error51) => { this.onerror?.(error51); }; + this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize }); } /** * Starts listening for messages on stdin. @@ -30954,7 +31289,7 @@ import { homedir } from "node:os"; import { basename, join } from "node:path"; // dist/version.js -var VERSION = true ? "1.5.1" : "dev"; +var VERSION = true ? "1.5.2" : "dev"; // dist/client.js var BASE_URL = "https://deploygate.com";