sunpeak 0.20.64 → 0.20.69
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/bin/commands/dev.mjs +88 -46
- package/bin/lib/inspect/inspect-config.mjs +6 -6
- package/bin/lib/live/live-config.mjs +8 -6
- package/bin/lib/test/test-config.mjs +7 -10
- package/dist/chatgpt/index.cjs +1 -1
- package/dist/chatgpt/index.js +1 -1
- package/dist/claude/index.cjs +1 -1
- package/dist/claude/index.js +1 -1
- package/dist/embed.css +2 -2
- package/dist/host/chatgpt/index.cjs +1 -1
- package/dist/host/chatgpt/index.js +1 -1
- package/dist/index.cjs +22 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +17 -12
- package/dist/index.js.map +1 -1
- package/dist/inspector/index.cjs +1 -1
- package/dist/inspector/index.js +1 -1
- package/dist/{inspector-Cl5w_7yQ.cjs → inspector-BSYXIDUe.cjs} +34 -17
- package/dist/{inspector-Cl5w_7yQ.cjs.map → inspector-BSYXIDUe.cjs.map} +1 -1
- package/dist/{inspector-DPJeSQAd.js → inspector-C5YJHT_c.js} +32 -16
- package/dist/{inspector-DPJeSQAd.js.map → inspector-C5YJHT_c.js.map} +1 -1
- package/dist/mcp/index.cjs +517 -104
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +505 -92
- package/dist/mcp/index.js.map +1 -1
- package/dist/style.css +7 -6
- package/dist/{use-app-D7-OtXBl.js → use-app-D27K0Cjf.js} +82 -32
- package/dist/{use-app-D7-OtXBl.js.map → use-app-D27K0Cjf.js.map} +1 -1
- package/dist/{use-app-BcSuulay.cjs → use-app-LPg2jlv8.cjs} +107 -32
- package/dist/{use-app-BcSuulay.cjs.map → use-app-LPg2jlv8.cjs.map} +1 -1
- package/package.json +21 -21
- package/template/dist/albums/albums.html +3 -3
- package/template/dist/albums/albums.json +1 -1
- package/template/dist/carousel/carousel.html +3 -3
- package/template/dist/carousel/carousel.json +1 -1
- package/template/dist/map/map.html +887 -811
- package/template/dist/map/map.json +1 -1
- package/template/dist/review/review.html +2 -2
- package/template/dist/review/review.json +1 -1
- package/template/node_modules/.bin/vite +2 -2
- package/template/node_modules/.bin/vitest +2 -2
- package/template/node_modules/.vite/deps/_metadata.json +4 -4
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js +83 -31
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js +83 -31
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js +83 -31
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/@testing-library_react.js +4 -4
- package/template/node_modules/.vite-mcp/deps/@testing-library_react.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/_metadata.json +36 -36
- package/template/node_modules/.vite-mcp/deps/{client-ClsaORxz.js → client-96teDLij.js} +6 -6
- package/template/node_modules/.vite-mcp/deps/{client-ClsaORxz.js.map → client-96teDLij.js.map} +1 -1
- package/template/node_modules/.vite-mcp/deps/{dist-CO4R4Zw4.js → dist-Bd8a6mlN.js} +17 -5
- package/template/node_modules/.vite-mcp/deps/{dist-CO4R4Zw4.js.map → dist-Bd8a6mlN.js.map} +1 -1
- package/template/node_modules/.vite-mcp/deps/embla-carousel-react.js +1 -1
- package/template/node_modules/.vite-mcp/deps/embla-carousel-react.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/mapbox-gl.js +15062 -13925
- package/template/node_modules/.vite-mcp/deps/mapbox-gl.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/react-dom.js +3 -3
- package/template/node_modules/.vite-mcp/deps/react-dom.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/react-dom_client.js +1 -1
- package/template/node_modules/.vite-mcp/deps/react.js +3 -3
- package/template/node_modules/.vite-mcp/deps/react.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/react_jsx-dev-runtime.js +2 -2
- package/template/node_modules/.vite-mcp/deps/react_jsx-dev-runtime.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/react_jsx-runtime.js +2 -2
- package/template/node_modules/.vite-mcp/deps/react_jsx-runtime.js.map +1 -1
- package/template/node_modules/.vite-mcp/deps/vitest.js +57 -36
- package/template/node_modules/.vite-mcp/deps/vitest.js.map +1 -1
- package/template/package.json +11 -11
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-chatgpt-linux.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-claude-darwin.png +0 -0
package/dist/mcp/index.cjs
CHANGED
|
@@ -9,11 +9,8 @@ let node_path = require("node:path");
|
|
|
9
9
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
10
10
|
let node_zlib = require("node:zlib");
|
|
11
11
|
let zod = require("zod");
|
|
12
|
-
require("
|
|
13
|
-
let
|
|
14
|
-
let stream = require("stream");
|
|
15
|
-
let crypto$1 = require("crypto");
|
|
16
|
-
crypto$1 = require_rolldown_runtime.__toESM(crypto$1, 1);
|
|
12
|
+
let node_http2 = require("node:http2");
|
|
13
|
+
let node_stream = require("node:stream");
|
|
17
14
|
let node_crypto = require("node:crypto");
|
|
18
15
|
//#region src/mcp/favicon.ts
|
|
19
16
|
var FAVICON_BASE64 = "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAA6BJREFUeAHtm09ME0EUxr+lqIDVlMQEI8aAaPRUmwgmeLEcTLxR7ibASY+QqNfSqxfiDU+UhDvlZuKBcpEELpUTBwWCciDRsMGC8Q/W9y0U+29bu922dHZ/yXRndynp++btzLzZeRryCPqA5AigDQKpgBx9aGhSutiQkMoMsBLNvatln94LAX+mG99oUzalRDKF8Py71xuWjykxvgU1oKvjB3zew5Oi7zejBrBhpZGvymF7kReOPaBvRD6mUQVoaNCfxAP/HgLXDwxjea0QFCHxsVVKG96vtyHBIvXqoA0By7G0ABv8rbCJoP+bYfDIw6+mxv4vmzvnEHvnw6vYZamfhY1I3/CrW7Oz9Wl4+PG2cawG8dULmHl7CVEp9tA0TgEWpBZEBVTb8FzoFeOvrxmeUSFxCrCLo86hbHznDzH9bAOh/l3UA3pCZLazkkdDpwApWICtPRf+ICL8Rj0xvGFKvGHJmjdYEoA9eahfx2mCj4O+7yn7e5Y9QBWa4HBcAeBwHC9A0QiE47zPW99hrlI4TBajqACTT7dkPv8FjQznB0ORm6b3TR+B0H294Y0nnK8Um6KbCjD5ZAuqwDjFjIICsOUrDWNPE/QAMy8oKMCwxPGqYeYFeQJ0dfwUtfagGmZekBcL0PUpgopwuS137dENhuBwXAHgcNxgKPOkVqu69YbL62myRoHUmxU4Ae1R30n95BFQaepbikxb3U4QDscVIF0ptXSkEpm2Zg2DAy9uw2m4wRAcjisAHI4bDOVe4NugQM8BVITDX+5ukjwBaPzCyzWoSPewP+9a3iPAUDG+ehGqQbsKTfYK9gGR2StQjRmTrXUFBVDNC9jy0XIEICp5AXeRmWEqAL0gttSORoctX2wLXclYoNFXivSkp+hOdDcYgsNxBYDDcYMhWEClzdKWBDgaWjzGRqp6D5Mc4oYiNywZT+RbnWNyLDtTbO1TC+ZlgtHurV/4zInawPNbWPvcCovotqTMcE9hLb2BcQqn6pkvOa3+KxGgVzxAm4QNcHsdd5hVa5OVjYanGRUBAjJRPsO0OduyRekJY6EdDIpn2JE2x1D2KEK1zXBB2wSWu4/zBu+GZEScQxVg/8CESZY7Pd+Nc7M8IxqrJ5uRWG/ForR2fNVbzTdWo0yhzcgd7p0QVcKoEbmeUdtXc1pEWn/CqGXfYBIlRUh1QU2YST7KlNn0Ba3w3xnZpMNSArCxb6gTnLElpFHnAW9UutKsGdxfpFM6myaou6kAAAAASUVORK5CYII=";
|
|
@@ -2751,7 +2748,7 @@ var init_data = require_rolldown_runtime.__esmMin((() => {
|
|
|
2751
2748
|
};
|
|
2752
2749
|
}));
|
|
2753
2750
|
//#endregion
|
|
2754
|
-
//#region ../../node_modules/.pnpm/fast-uri@3.1.
|
|
2751
|
+
//#region ../../node_modules/.pnpm/fast-uri@3.1.4/node_modules/fast-uri/lib/utils.js
|
|
2755
2752
|
var require_utils = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
|
|
2756
2753
|
/** @type {(value: string) => boolean} */
|
|
2757
2754
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
@@ -3123,7 +3120,7 @@ var require_utils = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exp
|
|
|
3123
3120
|
};
|
|
3124
3121
|
}));
|
|
3125
3122
|
//#endregion
|
|
3126
|
-
//#region ../../node_modules/.pnpm/fast-uri@3.1.
|
|
3123
|
+
//#region ../../node_modules/.pnpm/fast-uri@3.1.4/node_modules/fast-uri/lib/schemes.js
|
|
3127
3124
|
var require_schemes = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
|
|
3128
3125
|
var { isUUID } = require_utils();
|
|
3129
3126
|
var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
|
|
@@ -3306,7 +3303,7 @@ var require_schemes = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((e
|
|
|
3306
3303
|
};
|
|
3307
3304
|
}));
|
|
3308
3305
|
//#endregion
|
|
3309
|
-
//#region ../../node_modules/.pnpm/fast-uri@3.1.
|
|
3306
|
+
//#region ../../node_modules/.pnpm/fast-uri@3.1.4/node_modules/fast-uri/index.js
|
|
3310
3307
|
var require_fast_uri = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
|
|
3311
3308
|
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
3312
3309
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
@@ -3445,6 +3442,7 @@ var require_fast_uri = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((
|
|
|
3445
3442
|
return uriTokens.join("");
|
|
3446
3443
|
}
|
|
3447
3444
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
3445
|
+
var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
|
|
3448
3446
|
/**
|
|
3449
3447
|
* @param {import('./types/index').URIComponent} parsed
|
|
3450
3448
|
* @param {RegExpMatchArray} matches
|
|
@@ -3475,6 +3473,11 @@ var require_fast_uri = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((
|
|
|
3475
3473
|
let isIP = false;
|
|
3476
3474
|
if (options.reference === "suffix") if (options.scheme) uri = options.scheme + ":" + uri;
|
|
3477
3475
|
else uri = "//" + uri;
|
|
3476
|
+
const authorityMatch = uri.match(AUTHORITY_PREFIX);
|
|
3477
|
+
if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
|
|
3478
|
+
parsed.error = "URI authority must not contain a literal backslash.";
|
|
3479
|
+
malformedAuthorityOrPort = true;
|
|
3480
|
+
}
|
|
3478
3481
|
const matches = uri.match(URI_PARSE);
|
|
3479
3482
|
if (matches) {
|
|
3480
3483
|
parsed.scheme = matches[1];
|
|
@@ -3503,7 +3506,7 @@ var require_fast_uri = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((
|
|
|
3503
3506
|
const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
|
|
3504
3507
|
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
3505
3508
|
if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) try {
|
|
3506
|
-
parsed.host = URL
|
|
3509
|
+
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
3507
3510
|
} catch (e) {
|
|
3508
3511
|
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
3509
3512
|
}
|
|
@@ -7693,13 +7696,29 @@ var EMPTY_COMPLETION_RESULT = { completion: {
|
|
|
7693
7696
|
hasMore: false
|
|
7694
7697
|
} };
|
|
7695
7698
|
//#endregion
|
|
7696
|
-
//#region ../../node_modules/.pnpm/@hono+node-server@
|
|
7699
|
+
//#region ../../node_modules/.pnpm/@hono+node-server@2.0.11_hono@4.12.27/node_modules/@hono/node-server/dist/index.mjs
|
|
7697
7700
|
var RequestError = class extends Error {
|
|
7698
7701
|
constructor(message, options) {
|
|
7699
7702
|
super(message, options);
|
|
7700
7703
|
this.name = "RequestError";
|
|
7701
7704
|
}
|
|
7702
7705
|
};
|
|
7706
|
+
var reValidRequestUrl = /^\/[!#$&-;=?-\[\]_a-z~]*$/;
|
|
7707
|
+
var reDotSegment = /\/\.\.?(?:[/?#]|$)/;
|
|
7708
|
+
var reValidHost = /^[a-z0-9._-]+(?::(?:[1-5]\d{3,4}|[6-9]\d{3}))?$/;
|
|
7709
|
+
var buildUrl = (scheme, host, incomingUrl) => {
|
|
7710
|
+
const url = `${scheme}://${host}${incomingUrl}`;
|
|
7711
|
+
if (!reValidHost.test(host)) {
|
|
7712
|
+
const urlObj = new URL(url);
|
|
7713
|
+
if (urlObj.hostname.length !== host.length && urlObj.hostname !== (host.includes(":") ? host.replace(/:\d+$/, "") : host).toLowerCase()) throw new RequestError("Invalid host header");
|
|
7714
|
+
return urlObj.href;
|
|
7715
|
+
} else if (incomingUrl.length === 0) return url + "/";
|
|
7716
|
+
else {
|
|
7717
|
+
if (incomingUrl.charCodeAt(0) !== 47) throw new RequestError("Invalid URL");
|
|
7718
|
+
if (!reValidRequestUrl.test(incomingUrl) || reDotSegment.test(incomingUrl)) return new URL(url).href;
|
|
7719
|
+
return url;
|
|
7720
|
+
}
|
|
7721
|
+
};
|
|
7703
7722
|
var toRequestError = (e) => {
|
|
7704
7723
|
if (e instanceof RequestError) return e;
|
|
7705
7724
|
return new RequestError(e.message, { cause: e });
|
|
@@ -7707,21 +7726,73 @@ var toRequestError = (e) => {
|
|
|
7707
7726
|
var GlobalRequest = global.Request;
|
|
7708
7727
|
var Request$1 = class extends GlobalRequest {
|
|
7709
7728
|
constructor(input, options) {
|
|
7710
|
-
if (typeof input === "object" && getRequestCache in input)
|
|
7711
|
-
|
|
7729
|
+
if (typeof input === "object" && getRequestCache in input) {
|
|
7730
|
+
const hasReplacementBody = options !== void 0 && "body" in options && options.body != null;
|
|
7731
|
+
if (input[bodyConsumedDirectlyKey] && !hasReplacementBody) throw new TypeError("Cannot construct a Request with a Request object that has already been used.");
|
|
7732
|
+
input = input[getRequestCache]();
|
|
7733
|
+
}
|
|
7734
|
+
if (typeof (options?.body)?.getReader !== "undefined") options.duplex ??= "half";
|
|
7712
7735
|
super(input, options);
|
|
7713
7736
|
}
|
|
7714
7737
|
};
|
|
7715
7738
|
var newHeadersFromIncoming = (incoming) => {
|
|
7716
7739
|
const headerRecord = [];
|
|
7717
7740
|
const rawHeaders = incoming.rawHeaders;
|
|
7718
|
-
for (let i = 0
|
|
7719
|
-
const
|
|
7720
|
-
if (key.charCodeAt(0) !== 58) headerRecord.push([key,
|
|
7741
|
+
for (let i = 0, len = rawHeaders.length; i < len; i += 2) {
|
|
7742
|
+
const key = rawHeaders[i];
|
|
7743
|
+
if (key.charCodeAt(0) !== 58) headerRecord.push([key, rawHeaders[i + 1]]);
|
|
7721
7744
|
}
|
|
7722
7745
|
return new Headers(headerRecord);
|
|
7723
7746
|
};
|
|
7724
7747
|
var wrapBodyStream = Symbol("wrapBodyStream");
|
|
7748
|
+
var byteExactEncodings = /* @__PURE__ */ new Set([
|
|
7749
|
+
"latin1",
|
|
7750
|
+
"binary",
|
|
7751
|
+
"hex",
|
|
7752
|
+
"base64",
|
|
7753
|
+
"base64url"
|
|
7754
|
+
]);
|
|
7755
|
+
var isByteExactEncoding = (encoding) => encoding === null || byteExactEncodings.has(encoding);
|
|
7756
|
+
var bodyBufferedBeforeDisconnectKey = Symbol("bodyBufferedBeforeDisconnect");
|
|
7757
|
+
var bodyBufferedLengthBeforeDisconnectKey = Symbol("bodyBufferedLengthBeforeDisconnect");
|
|
7758
|
+
var toBufferChunk = (chunk, encoding) => Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, encoding ?? "utf8");
|
|
7759
|
+
var isRecoverableDisconnectedIncoming = (incoming) => !(incoming instanceof node_http2.Http2ServerRequest) && !!incoming.complete && !!incoming.readableAborted && typeof incoming.read === "function" && isByteExactEncoding(incoming.readableEncoding);
|
|
7760
|
+
var recordBodyBufferedBeforeDisconnect = (incoming) => {
|
|
7761
|
+
if (incoming.readableDidRead || !isRecoverableDisconnectedIncoming(incoming)) return;
|
|
7762
|
+
const incomingWithRecovery = incoming;
|
|
7763
|
+
incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey] ??= incoming.readableLength;
|
|
7764
|
+
};
|
|
7765
|
+
var readBodyBufferedBeforeDisconnect = (incoming, chunks) => {
|
|
7766
|
+
if (incoming.readableDidRead && !chunks || !isRecoverableDisconnectedIncoming(incoming)) return;
|
|
7767
|
+
const incomingWithRecovery = incoming;
|
|
7768
|
+
if (incomingWithRecovery[bodyBufferedBeforeDisconnectKey] !== void 0) return incomingWithRecovery[bodyBufferedBeforeDisconnectKey];
|
|
7769
|
+
let result;
|
|
7770
|
+
const errored = incoming.errored;
|
|
7771
|
+
if (errored && errored.code !== "ECONNRESET") result = errored;
|
|
7772
|
+
else if (incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey] !== void 0 && incoming.readableLength !== incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey]) result = newBodyUnusableError();
|
|
7773
|
+
else {
|
|
7774
|
+
const bodyChunks = chunks ?? [];
|
|
7775
|
+
const chunk = incoming.read();
|
|
7776
|
+
if (chunk !== null) bodyChunks.push(toBufferChunk(chunk, incoming.readableEncoding));
|
|
7777
|
+
const buffer = bodyChunks.length === 1 ? bodyChunks[0] : Buffer.concat(bodyChunks);
|
|
7778
|
+
result = buffer;
|
|
7779
|
+
const contentLength = incoming.headers["content-length"];
|
|
7780
|
+
if (typeof contentLength === "string" && /^\d+$/.test(contentLength)) {
|
|
7781
|
+
const expectedLength = Number(contentLength);
|
|
7782
|
+
if (Number.isSafeInteger(expectedLength) && buffer.length !== expectedLength) result = newBodyUnusableError();
|
|
7783
|
+
}
|
|
7784
|
+
}
|
|
7785
|
+
incomingWithRecovery[bodyBufferedBeforeDisconnectKey] = result;
|
|
7786
|
+
return result;
|
|
7787
|
+
};
|
|
7788
|
+
var enqueueBufferedBody = (controller, buffered) => {
|
|
7789
|
+
if (buffered instanceof Error) {
|
|
7790
|
+
controller.error(buffered);
|
|
7791
|
+
return;
|
|
7792
|
+
}
|
|
7793
|
+
if (buffered.length > 0) controller.enqueue(buffered);
|
|
7794
|
+
controller.close();
|
|
7795
|
+
};
|
|
7725
7796
|
var newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
|
|
7726
7797
|
const init = {
|
|
7727
7798
|
method,
|
|
@@ -7744,7 +7815,14 @@ var newRequestFromIncoming = (method, url, headers, incoming, abortController) =
|
|
|
7744
7815
|
let reader;
|
|
7745
7816
|
init.body = new ReadableStream({ async pull(controller) {
|
|
7746
7817
|
try {
|
|
7747
|
-
|
|
7818
|
+
if (!reader) {
|
|
7819
|
+
const buffered = readBodyBufferedBeforeDisconnect(incoming);
|
|
7820
|
+
if (buffered !== void 0) {
|
|
7821
|
+
enqueueBufferedBody(controller, buffered);
|
|
7822
|
+
return;
|
|
7823
|
+
}
|
|
7824
|
+
}
|
|
7825
|
+
reader ||= node_stream.Readable.toWeb(incoming).getReader();
|
|
7748
7826
|
const { done, value } = await reader.read();
|
|
7749
7827
|
if (done) controller.close();
|
|
7750
7828
|
else controller.enqueue(value);
|
|
@@ -7752,18 +7830,192 @@ var newRequestFromIncoming = (method, url, headers, incoming, abortController) =
|
|
|
7752
7830
|
controller.error(error);
|
|
7753
7831
|
}
|
|
7754
7832
|
} });
|
|
7755
|
-
} else
|
|
7833
|
+
} else {
|
|
7834
|
+
const buffered = readBodyBufferedBeforeDisconnect(incoming);
|
|
7835
|
+
if (buffered !== void 0) init.body = new ReadableStream({ start(controller) {
|
|
7836
|
+
enqueueBufferedBody(controller, buffered);
|
|
7837
|
+
} });
|
|
7838
|
+
else init.body = node_stream.Readable.toWeb(incoming);
|
|
7839
|
+
}
|
|
7756
7840
|
return new Request$1(url, init);
|
|
7757
7841
|
};
|
|
7758
7842
|
var getRequestCache = Symbol("getRequestCache");
|
|
7759
7843
|
var requestCache = Symbol("requestCache");
|
|
7760
7844
|
var incomingKey = Symbol("incomingKey");
|
|
7761
7845
|
var urlKey = Symbol("urlKey");
|
|
7846
|
+
var methodKey = Symbol("methodKey");
|
|
7762
7847
|
var headersKey = Symbol("headersKey");
|
|
7763
7848
|
var abortControllerKey = Symbol("abortControllerKey");
|
|
7849
|
+
var getAbortController = Symbol("getAbortController");
|
|
7850
|
+
var abortRequest = Symbol("abortRequest");
|
|
7851
|
+
var bodyBufferKey = Symbol("bodyBuffer");
|
|
7852
|
+
var bodyReadPromiseKey = Symbol("bodyReadPromise");
|
|
7853
|
+
var bodyConsumedDirectlyKey = Symbol("bodyConsumedDirectly");
|
|
7854
|
+
var bodyLockReaderKey = Symbol("bodyLockReader");
|
|
7855
|
+
var abortReasonKey = Symbol("abortReason");
|
|
7856
|
+
var newBodyUnusableError = () => {
|
|
7857
|
+
return /* @__PURE__ */ new TypeError("Body is unusable");
|
|
7858
|
+
};
|
|
7859
|
+
var rejectBodyUnusable = () => {
|
|
7860
|
+
return Promise.reject(newBodyUnusableError());
|
|
7861
|
+
};
|
|
7862
|
+
var textDecoder = new TextDecoder();
|
|
7863
|
+
var consumeBodyDirectOnce = (request) => {
|
|
7864
|
+
if (request[bodyConsumedDirectlyKey]) return rejectBodyUnusable();
|
|
7865
|
+
request[bodyConsumedDirectlyKey] = true;
|
|
7866
|
+
};
|
|
7867
|
+
var toArrayBuffer = (buf) => {
|
|
7868
|
+
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
|
|
7869
|
+
};
|
|
7870
|
+
var contentType = (request) => {
|
|
7871
|
+
return (request[headersKey] ||= newHeadersFromIncoming(request[incomingKey])).get("content-type") || "";
|
|
7872
|
+
};
|
|
7873
|
+
var methodTokenRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
7874
|
+
var normalizeIncomingMethod = (method) => {
|
|
7875
|
+
if (typeof method !== "string" || method.length === 0) return "GET";
|
|
7876
|
+
switch (method) {
|
|
7877
|
+
case "DELETE":
|
|
7878
|
+
case "GET":
|
|
7879
|
+
case "HEAD":
|
|
7880
|
+
case "OPTIONS":
|
|
7881
|
+
case "PATCH":
|
|
7882
|
+
case "POST":
|
|
7883
|
+
case "PUT":
|
|
7884
|
+
case "QUERY": return method;
|
|
7885
|
+
}
|
|
7886
|
+
const upper = method.toUpperCase();
|
|
7887
|
+
switch (upper) {
|
|
7888
|
+
case "DELETE":
|
|
7889
|
+
case "GET":
|
|
7890
|
+
case "HEAD":
|
|
7891
|
+
case "OPTIONS":
|
|
7892
|
+
case "POST":
|
|
7893
|
+
case "PUT": return upper;
|
|
7894
|
+
default: return method;
|
|
7895
|
+
}
|
|
7896
|
+
};
|
|
7897
|
+
var validateDirectReadMethod = (method) => {
|
|
7898
|
+
if (!methodTokenRegExp.test(method)) return /* @__PURE__ */ new TypeError(`'${method}' is not a valid HTTP method.`);
|
|
7899
|
+
const normalized = method.toUpperCase();
|
|
7900
|
+
if (normalized === "CONNECT" || normalized === "TRACK" || normalized === "TRACE" && method !== "TRACE") return /* @__PURE__ */ new TypeError(`'${method}' HTTP method is unsupported.`);
|
|
7901
|
+
};
|
|
7902
|
+
var readBodyWithFastPath = (request, method, fromBuffer) => {
|
|
7903
|
+
if (request[bodyConsumedDirectlyKey]) return rejectBodyUnusable();
|
|
7904
|
+
const methodName = request.method;
|
|
7905
|
+
if (methodName === "GET" || methodName === "HEAD") return request[getRequestCache]()[method]();
|
|
7906
|
+
const methodValidationError = validateDirectReadMethod(methodName);
|
|
7907
|
+
if (methodValidationError) return Promise.reject(methodValidationError);
|
|
7908
|
+
if (request[requestCache]) {
|
|
7909
|
+
if (methodName !== "TRACE") return request[requestCache][method]();
|
|
7910
|
+
}
|
|
7911
|
+
const alreadyUsedError = consumeBodyDirectOnce(request);
|
|
7912
|
+
if (alreadyUsedError) return alreadyUsedError;
|
|
7913
|
+
const raw = readRawBodyIfAvailable(request);
|
|
7914
|
+
if (raw) {
|
|
7915
|
+
const result = Promise.resolve(fromBuffer(raw, request));
|
|
7916
|
+
request[bodyBufferKey] = void 0;
|
|
7917
|
+
return result;
|
|
7918
|
+
}
|
|
7919
|
+
return readBodyDirect(request).then((buf) => {
|
|
7920
|
+
const result = fromBuffer(buf, request);
|
|
7921
|
+
request[bodyBufferKey] = void 0;
|
|
7922
|
+
return result;
|
|
7923
|
+
});
|
|
7924
|
+
};
|
|
7925
|
+
var readRawBodyIfAvailable = (request) => {
|
|
7926
|
+
const incoming = request[incomingKey];
|
|
7927
|
+
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) return incoming.rawBody;
|
|
7928
|
+
};
|
|
7929
|
+
var normalizeAbortError = (request, incoming) => {
|
|
7930
|
+
if (incoming.errored) return incoming.errored;
|
|
7931
|
+
const reason = request[abortReasonKey];
|
|
7932
|
+
if (reason !== void 0) return reason instanceof Error ? reason : new Error(String(reason));
|
|
7933
|
+
return /* @__PURE__ */ new Error("Client connection prematurely closed.");
|
|
7934
|
+
};
|
|
7935
|
+
var readBodyDirect = (request) => {
|
|
7936
|
+
if (request[bodyBufferKey]) return Promise.resolve(request[bodyBufferKey]);
|
|
7937
|
+
if (request[bodyReadPromiseKey]) return request[bodyReadPromiseKey];
|
|
7938
|
+
const incoming = request[incomingKey];
|
|
7939
|
+
if (incoming.readableDidRead) return rejectBodyUnusable();
|
|
7940
|
+
const buffered = readBodyBufferedBeforeDisconnect(incoming);
|
|
7941
|
+
if (buffered !== void 0) {
|
|
7942
|
+
if (buffered instanceof Error) return Promise.reject(buffered);
|
|
7943
|
+
request[bodyBufferKey] = buffered;
|
|
7944
|
+
return Promise.resolve(buffered);
|
|
7945
|
+
}
|
|
7946
|
+
const promise = new Promise((resolve, reject) => {
|
|
7947
|
+
const chunks = [];
|
|
7948
|
+
let settled = false;
|
|
7949
|
+
const finish = (callback) => {
|
|
7950
|
+
if (settled) return;
|
|
7951
|
+
settled = true;
|
|
7952
|
+
cleanup();
|
|
7953
|
+
callback();
|
|
7954
|
+
};
|
|
7955
|
+
const recoverCompleteBodyAfterDisconnect = (error) => {
|
|
7956
|
+
const streamError = incoming.errored ?? error;
|
|
7957
|
+
if (!isRecoverableDisconnectedIncoming(incoming) || streamError && streamError.code !== "ECONNRESET") return false;
|
|
7958
|
+
finish(() => {
|
|
7959
|
+
const recovered = readBodyBufferedBeforeDisconnect(incoming, chunks);
|
|
7960
|
+
if (recovered instanceof Error) reject(recovered);
|
|
7961
|
+
else if (recovered === void 0) reject(error ?? normalizeAbortError(request, incoming));
|
|
7962
|
+
else {
|
|
7963
|
+
request[bodyBufferKey] = recovered;
|
|
7964
|
+
resolve(recovered);
|
|
7965
|
+
}
|
|
7966
|
+
});
|
|
7967
|
+
return true;
|
|
7968
|
+
};
|
|
7969
|
+
const onData = (chunk) => {
|
|
7970
|
+
chunks.push(toBufferChunk(chunk, incoming.readableEncoding));
|
|
7971
|
+
};
|
|
7972
|
+
const onEnd = () => {
|
|
7973
|
+
finish(() => {
|
|
7974
|
+
const buffer = chunks.length === 1 ? chunks[0] : Buffer.concat(chunks);
|
|
7975
|
+
request[bodyBufferKey] = buffer;
|
|
7976
|
+
resolve(buffer);
|
|
7977
|
+
});
|
|
7978
|
+
};
|
|
7979
|
+
const onError = (error) => {
|
|
7980
|
+
if (recoverCompleteBodyAfterDisconnect(error)) return;
|
|
7981
|
+
finish(() => {
|
|
7982
|
+
reject(error);
|
|
7983
|
+
});
|
|
7984
|
+
};
|
|
7985
|
+
const onClose = () => {
|
|
7986
|
+
if (incoming.readableEnded) {
|
|
7987
|
+
onEnd();
|
|
7988
|
+
return;
|
|
7989
|
+
}
|
|
7990
|
+
if (recoverCompleteBodyAfterDisconnect()) return;
|
|
7991
|
+
finish(() => {
|
|
7992
|
+
reject(normalizeAbortError(request, incoming));
|
|
7993
|
+
});
|
|
7994
|
+
};
|
|
7995
|
+
const cleanup = () => {
|
|
7996
|
+
incoming.off("data", onData);
|
|
7997
|
+
incoming.off("end", onEnd);
|
|
7998
|
+
incoming.off("error", onError);
|
|
7999
|
+
incoming.off("close", onClose);
|
|
8000
|
+
request[bodyReadPromiseKey] = void 0;
|
|
8001
|
+
};
|
|
8002
|
+
incoming.on("data", onData);
|
|
8003
|
+
incoming.on("end", onEnd);
|
|
8004
|
+
incoming.on("error", onError);
|
|
8005
|
+
incoming.on("close", onClose);
|
|
8006
|
+
queueMicrotask(() => {
|
|
8007
|
+
if (settled) return;
|
|
8008
|
+
if (incoming.readableEnded) onEnd();
|
|
8009
|
+
else if (incoming.errored) onError(incoming.errored);
|
|
8010
|
+
else if (incoming.destroyed) onClose();
|
|
8011
|
+
});
|
|
8012
|
+
});
|
|
8013
|
+
request[bodyReadPromiseKey] = promise;
|
|
8014
|
+
return promise;
|
|
8015
|
+
};
|
|
7764
8016
|
var requestPrototype = {
|
|
7765
8017
|
get method() {
|
|
7766
|
-
return this[
|
|
8018
|
+
return this[methodKey];
|
|
7767
8019
|
},
|
|
7768
8020
|
get url() {
|
|
7769
8021
|
return this[urlKey];
|
|
@@ -7771,18 +8023,57 @@ var requestPrototype = {
|
|
|
7771
8023
|
get headers() {
|
|
7772
8024
|
return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
|
|
7773
8025
|
},
|
|
7774
|
-
[
|
|
7775
|
-
this[
|
|
8026
|
+
[abortRequest](reason) {
|
|
8027
|
+
if (this[abortReasonKey] === void 0) this[abortReasonKey] = reason;
|
|
8028
|
+
const abortController = this[abortControllerKey];
|
|
8029
|
+
if (abortController && !abortController.signal.aborted) abortController.abort(reason);
|
|
8030
|
+
},
|
|
8031
|
+
[getAbortController]() {
|
|
8032
|
+
this[abortControllerKey] ||= new AbortController();
|
|
8033
|
+
if (this[abortReasonKey] !== void 0 && !this[abortControllerKey].signal.aborted) this[abortControllerKey].abort(this[abortReasonKey]);
|
|
7776
8034
|
return this[abortControllerKey];
|
|
7777
8035
|
},
|
|
7778
8036
|
[getRequestCache]() {
|
|
7779
|
-
this[
|
|
7780
|
-
|
|
8037
|
+
const abortController = this[getAbortController]();
|
|
8038
|
+
if (this[requestCache]) return this[requestCache];
|
|
8039
|
+
const method = this.method;
|
|
8040
|
+
if (this[bodyConsumedDirectlyKey] && !(method === "GET" || method === "HEAD")) {
|
|
8041
|
+
this[bodyBufferKey] = void 0;
|
|
8042
|
+
const init = {
|
|
8043
|
+
method: method === "TRACE" ? "GET" : method,
|
|
8044
|
+
headers: this.headers,
|
|
8045
|
+
signal: abortController.signal
|
|
8046
|
+
};
|
|
8047
|
+
if (method !== "TRACE") {
|
|
8048
|
+
init.body = new ReadableStream({ start(c) {
|
|
8049
|
+
c.close();
|
|
8050
|
+
} });
|
|
8051
|
+
init.duplex = "half";
|
|
8052
|
+
}
|
|
8053
|
+
const req = new Request$1(this[urlKey], init);
|
|
8054
|
+
if (method === "TRACE") Object.defineProperty(req, "method", { get() {
|
|
8055
|
+
return "TRACE";
|
|
8056
|
+
} });
|
|
8057
|
+
return this[requestCache] = req;
|
|
8058
|
+
}
|
|
8059
|
+
return this[requestCache] = newRequestFromIncoming(this.method, this[urlKey], this.headers, this[incomingKey], abortController);
|
|
8060
|
+
},
|
|
8061
|
+
get body() {
|
|
8062
|
+
if (!this[bodyConsumedDirectlyKey]) return this[getRequestCache]().body;
|
|
8063
|
+
const request = this[getRequestCache]();
|
|
8064
|
+
if (!this[bodyLockReaderKey] && request.body) this[bodyLockReaderKey] = request.body.getReader();
|
|
8065
|
+
return request.body;
|
|
8066
|
+
},
|
|
8067
|
+
get bodyUsed() {
|
|
8068
|
+
if (this[bodyConsumedDirectlyKey]) return true;
|
|
8069
|
+
if (this[requestCache]) return this[requestCache].bodyUsed;
|
|
8070
|
+
return false;
|
|
7781
8071
|
}
|
|
7782
8072
|
};
|
|
8073
|
+
Object.defineProperty(requestPrototype, "signal", { get() {
|
|
8074
|
+
return this[getAbortController]().signal;
|
|
8075
|
+
} });
|
|
7783
8076
|
[
|
|
7784
|
-
"body",
|
|
7785
|
-
"bodyUsed",
|
|
7786
8077
|
"cache",
|
|
7787
8078
|
"credentials",
|
|
7788
8079
|
"destination",
|
|
@@ -7791,25 +8082,37 @@ var requestPrototype = {
|
|
|
7791
8082
|
"redirect",
|
|
7792
8083
|
"referrer",
|
|
7793
8084
|
"referrerPolicy",
|
|
7794
|
-
"signal",
|
|
7795
8085
|
"keepalive"
|
|
7796
8086
|
].forEach((k) => {
|
|
7797
8087
|
Object.defineProperty(requestPrototype, k, { get() {
|
|
7798
8088
|
return this[getRequestCache]()[k];
|
|
7799
8089
|
} });
|
|
7800
8090
|
});
|
|
7801
|
-
[
|
|
7802
|
-
"arrayBuffer",
|
|
7803
|
-
"blob",
|
|
7804
|
-
"clone",
|
|
7805
|
-
"formData",
|
|
7806
|
-
"json",
|
|
7807
|
-
"text"
|
|
7808
|
-
].forEach((k) => {
|
|
8091
|
+
["clone", "formData"].forEach((k) => {
|
|
7809
8092
|
Object.defineProperty(requestPrototype, k, { value: function() {
|
|
8093
|
+
if (this[bodyConsumedDirectlyKey]) {
|
|
8094
|
+
if (k === "clone") throw newBodyUnusableError();
|
|
8095
|
+
return rejectBodyUnusable();
|
|
8096
|
+
}
|
|
7810
8097
|
return this[getRequestCache]()[k]();
|
|
7811
8098
|
} });
|
|
7812
8099
|
});
|
|
8100
|
+
Object.defineProperty(requestPrototype, "text", { value: function() {
|
|
8101
|
+
return readBodyWithFastPath(this, "text", (buf) => textDecoder.decode(buf));
|
|
8102
|
+
} });
|
|
8103
|
+
Object.defineProperty(requestPrototype, "arrayBuffer", { value: function() {
|
|
8104
|
+
return readBodyWithFastPath(this, "arrayBuffer", (buf) => toArrayBuffer(buf));
|
|
8105
|
+
} });
|
|
8106
|
+
Object.defineProperty(requestPrototype, "blob", { value: function() {
|
|
8107
|
+
return readBodyWithFastPath(this, "blob", (buf, request) => {
|
|
8108
|
+
const type = contentType(request);
|
|
8109
|
+
return new Response(buf, type ? { headers: { "content-type": type } } : void 0).blob();
|
|
8110
|
+
});
|
|
8111
|
+
} });
|
|
8112
|
+
Object.defineProperty(requestPrototype, "json", { value: function() {
|
|
8113
|
+
if (this[bodyConsumedDirectlyKey]) return rejectBodyUnusable();
|
|
8114
|
+
return this.text().then(JSON.parse);
|
|
8115
|
+
} });
|
|
7813
8116
|
Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
|
|
7814
8117
|
return `Request (lightweight) ${inspectFn({
|
|
7815
8118
|
method: this.method,
|
|
@@ -7825,9 +8128,10 @@ Object.setPrototypeOf(requestPrototype, Request$1.prototype);
|
|
|
7825
8128
|
var newRequest = (incoming, defaultHostname) => {
|
|
7826
8129
|
const req = Object.create(requestPrototype);
|
|
7827
8130
|
req[incomingKey] = incoming;
|
|
8131
|
+
req[methodKey] = normalizeIncomingMethod(incoming.method);
|
|
7828
8132
|
const incomingUrl = incoming.url || "";
|
|
7829
8133
|
if (incomingUrl[0] !== "/" && (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
|
7830
|
-
if (incoming instanceof
|
|
8134
|
+
if (incoming instanceof node_http2.Http2ServerRequest) throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
|
7831
8135
|
try {
|
|
7832
8136
|
req[urlKey] = new URL(incomingUrl).href;
|
|
7833
8137
|
} catch (e) {
|
|
@@ -7835,33 +8139,43 @@ var newRequest = (incoming, defaultHostname) => {
|
|
|
7835
8139
|
}
|
|
7836
8140
|
return req;
|
|
7837
8141
|
}
|
|
7838
|
-
const host = (incoming instanceof
|
|
8142
|
+
const host = (incoming instanceof node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
|
|
7839
8143
|
if (!host) throw new RequestError("Missing host header");
|
|
7840
8144
|
let scheme;
|
|
7841
|
-
if (incoming instanceof
|
|
8145
|
+
if (incoming instanceof node_http2.Http2ServerRequest) {
|
|
7842
8146
|
scheme = incoming.scheme;
|
|
7843
8147
|
if (!(scheme === "http" || scheme === "https")) throw new RequestError("Unsupported scheme");
|
|
7844
8148
|
} else scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
8149
|
+
try {
|
|
8150
|
+
req[urlKey] = buildUrl(scheme, host, incomingUrl);
|
|
8151
|
+
} catch (e) {
|
|
8152
|
+
if (e instanceof RequestError) throw e;
|
|
8153
|
+
else throw new RequestError("Invalid URL", { cause: e });
|
|
8154
|
+
}
|
|
7848
8155
|
return req;
|
|
7849
8156
|
};
|
|
8157
|
+
var defaultContentType = "text/plain; charset=UTF-8";
|
|
7850
8158
|
var responseCache = Symbol("responseCache");
|
|
7851
8159
|
var getResponseCache = Symbol("getResponseCache");
|
|
7852
8160
|
var cacheKey = Symbol("cache");
|
|
7853
8161
|
var GlobalResponse = global.Response;
|
|
7854
|
-
var
|
|
8162
|
+
var Response$1 = class Response$1 {
|
|
7855
8163
|
#body;
|
|
7856
8164
|
#init;
|
|
7857
8165
|
[getResponseCache]() {
|
|
8166
|
+
const cache = this[cacheKey];
|
|
8167
|
+
const liveHeaders = cache && cache[2] instanceof Headers ? cache[2] : void 0;
|
|
7858
8168
|
delete this[cacheKey];
|
|
7859
|
-
return this[responseCache] ||= new GlobalResponse(this.#body,
|
|
8169
|
+
return this[responseCache] ||= new GlobalResponse(this.#body, liveHeaders ? {
|
|
8170
|
+
status: this.#init?.status,
|
|
8171
|
+
statusText: this.#init?.statusText,
|
|
8172
|
+
headers: liveHeaders
|
|
8173
|
+
} : this.#init);
|
|
7860
8174
|
}
|
|
7861
8175
|
constructor(body, init) {
|
|
7862
8176
|
let headers;
|
|
7863
8177
|
this.#body = body;
|
|
7864
|
-
if (init instanceof
|
|
8178
|
+
if (init instanceof Response$1) {
|
|
7865
8179
|
const cachedGlobalResponse = init[responseCache];
|
|
7866
8180
|
if (cachedGlobalResponse) {
|
|
7867
8181
|
this.#init = cachedGlobalResponse;
|
|
@@ -7869,19 +8183,19 @@ var Response2 = class _Response {
|
|
|
7869
8183
|
return;
|
|
7870
8184
|
} else {
|
|
7871
8185
|
this.#init = init.#init;
|
|
7872
|
-
headers = new Headers(init
|
|
8186
|
+
headers = new Headers(init.headers);
|
|
7873
8187
|
}
|
|
7874
8188
|
} else this.#init = init;
|
|
7875
|
-
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) this[cacheKey] = [
|
|
8189
|
+
if (body == null || typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) this[cacheKey] = [
|
|
7876
8190
|
init?.status || 200,
|
|
7877
|
-
body,
|
|
8191
|
+
body ?? null,
|
|
7878
8192
|
headers || init?.headers
|
|
7879
8193
|
];
|
|
7880
8194
|
}
|
|
7881
8195
|
get headers() {
|
|
7882
8196
|
const cache = this[cacheKey];
|
|
7883
8197
|
if (cache) {
|
|
7884
|
-
if (!(cache[2] instanceof Headers)) cache[2] = new Headers(cache[2] || { "content-type":
|
|
8198
|
+
if (!(cache[2] instanceof Headers)) cache[2] = new Headers(cache[2] || (cache[1] === null ? void 0 : { "content-type": defaultContentType }));
|
|
7885
8199
|
return cache[2];
|
|
7886
8200
|
}
|
|
7887
8201
|
return this[getResponseCache]().headers;
|
|
@@ -7903,7 +8217,7 @@ var Response2 = class _Response {
|
|
|
7903
8217
|
"type",
|
|
7904
8218
|
"url"
|
|
7905
8219
|
].forEach((k) => {
|
|
7906
|
-
Object.defineProperty(
|
|
8220
|
+
Object.defineProperty(Response$1.prototype, k, { get() {
|
|
7907
8221
|
return this[getResponseCache]()[k];
|
|
7908
8222
|
} });
|
|
7909
8223
|
});
|
|
@@ -7915,11 +8229,11 @@ var Response2 = class _Response {
|
|
|
7915
8229
|
"json",
|
|
7916
8230
|
"text"
|
|
7917
8231
|
].forEach((k) => {
|
|
7918
|
-
Object.defineProperty(
|
|
8232
|
+
Object.defineProperty(Response$1.prototype, k, { value: function() {
|
|
7919
8233
|
return this[getResponseCache]()[k]();
|
|
7920
8234
|
} });
|
|
7921
8235
|
});
|
|
7922
|
-
Object.defineProperty(
|
|
8236
|
+
Object.defineProperty(Response$1.prototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
|
|
7923
8237
|
return `Response (lightweight) ${inspectFn({
|
|
7924
8238
|
status: this.status,
|
|
7925
8239
|
headers: this.headers,
|
|
@@ -7930,8 +8244,51 @@ Object.defineProperty(Response2.prototype, Symbol.for("nodejs.util.inspect.custo
|
|
|
7930
8244
|
depth: depth == null ? null : depth - 1
|
|
7931
8245
|
})}`;
|
|
7932
8246
|
} });
|
|
7933
|
-
Object.setPrototypeOf(
|
|
7934
|
-
Object.setPrototypeOf(
|
|
8247
|
+
Object.setPrototypeOf(Response$1, GlobalResponse);
|
|
8248
|
+
Object.setPrototypeOf(Response$1.prototype, GlobalResponse.prototype);
|
|
8249
|
+
var validRedirectUrl = /^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/;
|
|
8250
|
+
var parseRedirectUrl = (url) => {
|
|
8251
|
+
if (url instanceof URL) return url.href;
|
|
8252
|
+
if (validRedirectUrl.test(url)) return url;
|
|
8253
|
+
return new URL(url).href;
|
|
8254
|
+
};
|
|
8255
|
+
var validRedirectStatuses = /* @__PURE__ */ new Set([
|
|
8256
|
+
301,
|
|
8257
|
+
302,
|
|
8258
|
+
303,
|
|
8259
|
+
307,
|
|
8260
|
+
308
|
|
8261
|
+
]);
|
|
8262
|
+
Object.defineProperty(Response$1, "redirect", {
|
|
8263
|
+
value: function redirect(url, status = 302) {
|
|
8264
|
+
if (!validRedirectStatuses.has(status)) throw new RangeError("Invalid status code");
|
|
8265
|
+
return new Response$1(null, {
|
|
8266
|
+
status,
|
|
8267
|
+
headers: { location: parseRedirectUrl(url) }
|
|
8268
|
+
});
|
|
8269
|
+
},
|
|
8270
|
+
writable: true,
|
|
8271
|
+
configurable: true
|
|
8272
|
+
});
|
|
8273
|
+
Object.defineProperty(Response$1, "json", {
|
|
8274
|
+
value: function json(data, init) {
|
|
8275
|
+
const body = JSON.stringify(data);
|
|
8276
|
+
if (body === void 0) throw new TypeError("The data is not JSON serializable");
|
|
8277
|
+
const initHeaders = init?.headers;
|
|
8278
|
+
let headers;
|
|
8279
|
+
if (initHeaders) {
|
|
8280
|
+
headers = new Headers(initHeaders);
|
|
8281
|
+
if (!headers.has("content-type")) headers.set("content-type", "application/json");
|
|
8282
|
+
} else headers = { "content-type": "application/json" };
|
|
8283
|
+
return new Response$1(body, {
|
|
8284
|
+
status: init?.status ?? 200,
|
|
8285
|
+
statusText: init?.statusText,
|
|
8286
|
+
headers
|
|
8287
|
+
});
|
|
8288
|
+
},
|
|
8289
|
+
writable: true,
|
|
8290
|
+
configurable: true
|
|
8291
|
+
});
|
|
7935
8292
|
async function readWithoutBlocking(readPromise) {
|
|
7936
8293
|
return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
|
|
7937
8294
|
}
|
|
@@ -7962,23 +8319,23 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
|
|
|
7962
8319
|
}
|
|
7963
8320
|
}
|
|
7964
8321
|
}
|
|
7965
|
-
function writeFromReadableStream(stream
|
|
7966
|
-
if (stream
|
|
8322
|
+
function writeFromReadableStream(stream, writable) {
|
|
8323
|
+
if (stream.locked) throw new TypeError("ReadableStream is locked.");
|
|
7967
8324
|
else if (writable.destroyed) return;
|
|
7968
|
-
return writeFromReadableStreamDefaultReader(stream
|
|
8325
|
+
return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
|
|
7969
8326
|
}
|
|
7970
|
-
var buildOutgoingHttpHeaders = (headers) => {
|
|
8327
|
+
var buildOutgoingHttpHeaders = (headers, defaultContentType) => {
|
|
7971
8328
|
const res = {};
|
|
7972
8329
|
if (!(headers instanceof Headers)) headers = new Headers(headers ?? void 0);
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
8330
|
+
if (headers.has("set-cookie")) {
|
|
8331
|
+
const cookies = [];
|
|
8332
|
+
for (const [k, v] of headers) if (k === "set-cookie") cookies.push(v);
|
|
8333
|
+
else res[k] = v;
|
|
8334
|
+
if (cookies.length > 0) res["set-cookie"] = cookies;
|
|
8335
|
+
} else for (const [k, v] of headers) res[k] = v;
|
|
8336
|
+
if (defaultContentType) res["content-type"] ??= defaultContentType;
|
|
7978
8337
|
return res;
|
|
7979
8338
|
};
|
|
7980
|
-
var X_ALREADY_SENT = "x-hono-already-sent";
|
|
7981
|
-
if (typeof global.crypto === "undefined") global.crypto = crypto$1.default;
|
|
7982
8339
|
var outgoingEnded = Symbol("outgoingEnded");
|
|
7983
8340
|
var incomingDraining = Symbol("incomingDraining");
|
|
7984
8341
|
var DRAIN_TIMEOUT_MS = 500;
|
|
@@ -7987,9 +8344,9 @@ var drainIncoming = (incoming) => {
|
|
|
7987
8344
|
const incomingWithDrainState = incoming;
|
|
7988
8345
|
if (incoming.destroyed || incomingWithDrainState[incomingDraining]) return;
|
|
7989
8346
|
incomingWithDrainState[incomingDraining] = true;
|
|
7990
|
-
if (incoming instanceof
|
|
8347
|
+
if (incoming instanceof node_http2.Http2ServerRequest) {
|
|
7991
8348
|
try {
|
|
7992
|
-
incoming.stream?.close?.(
|
|
8349
|
+
incoming.stream?.close?.(node_http2.constants.NGHTTP2_NO_ERROR);
|
|
7993
8350
|
} catch {}
|
|
7994
8351
|
return;
|
|
7995
8352
|
}
|
|
@@ -8016,6 +8373,25 @@ var drainIncoming = (incoming) => {
|
|
|
8016
8373
|
incoming.on("error", cleanup);
|
|
8017
8374
|
incoming.resume();
|
|
8018
8375
|
};
|
|
8376
|
+
var makeCloseHandler = (req, incoming, outgoing, needsBodyCleanup) => () => {
|
|
8377
|
+
if (incoming.errored) {
|
|
8378
|
+
recordBodyBufferedBeforeDisconnect(incoming);
|
|
8379
|
+
req[abortRequest](incoming.errored.toString());
|
|
8380
|
+
} else if (!outgoing.writableFinished) {
|
|
8381
|
+
recordBodyBufferedBeforeDisconnect(incoming);
|
|
8382
|
+
req[abortRequest]("Client connection prematurely closed.");
|
|
8383
|
+
}
|
|
8384
|
+
if (needsBodyCleanup && !incoming.readableEnded) setTimeout(() => {
|
|
8385
|
+
if (!incoming.readableEnded) setTimeout(() => {
|
|
8386
|
+
drainIncoming(incoming);
|
|
8387
|
+
});
|
|
8388
|
+
});
|
|
8389
|
+
};
|
|
8390
|
+
var isImmediateCacheableResponse = (res) => {
|
|
8391
|
+
if (!(cacheKey in res)) return false;
|
|
8392
|
+
const body = res[cacheKey][1];
|
|
8393
|
+
return body === null || typeof body === "string" || body instanceof Uint8Array;
|
|
8394
|
+
};
|
|
8019
8395
|
var handleRequestError = () => new Response(null, { status: 400 });
|
|
8020
8396
|
var handleFetchError = (e) => new Response(null, { status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500 });
|
|
8021
8397
|
var handleResponseError = (e, outgoing) => {
|
|
@@ -8033,15 +8409,44 @@ var flushHeaders = (outgoing) => {
|
|
|
8033
8409
|
};
|
|
8034
8410
|
var responseViaCache = async (res, outgoing) => {
|
|
8035
8411
|
let [status, body, header] = res[cacheKey];
|
|
8412
|
+
if (!header) {
|
|
8413
|
+
if (body === null) {
|
|
8414
|
+
outgoing.writeHead(status);
|
|
8415
|
+
outgoing.end();
|
|
8416
|
+
} else if (typeof body === "string") {
|
|
8417
|
+
outgoing.writeHead(status, {
|
|
8418
|
+
"Content-Type": defaultContentType,
|
|
8419
|
+
"Content-Length": Buffer.byteLength(body)
|
|
8420
|
+
});
|
|
8421
|
+
outgoing.end(body);
|
|
8422
|
+
} else if (body instanceof Uint8Array) {
|
|
8423
|
+
outgoing.writeHead(status, {
|
|
8424
|
+
"Content-Type": defaultContentType,
|
|
8425
|
+
"Content-Length": body.byteLength
|
|
8426
|
+
});
|
|
8427
|
+
outgoing.end(body);
|
|
8428
|
+
} else if (body instanceof Blob) {
|
|
8429
|
+
outgoing.writeHead(status, {
|
|
8430
|
+
"Content-Type": defaultContentType,
|
|
8431
|
+
"Content-Length": body.size
|
|
8432
|
+
});
|
|
8433
|
+
outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
|
8434
|
+
} else {
|
|
8435
|
+
outgoing.writeHead(status, { "Content-Type": defaultContentType });
|
|
8436
|
+
flushHeaders(outgoing);
|
|
8437
|
+
await writeFromReadableStream(body, outgoing)?.catch((e) => handleResponseError(e, outgoing));
|
|
8438
|
+
}
|
|
8439
|
+
outgoing[outgoingEnded]?.();
|
|
8440
|
+
return;
|
|
8441
|
+
}
|
|
8036
8442
|
let hasContentLength = false;
|
|
8037
|
-
if (
|
|
8038
|
-
else if (header instanceof Headers) {
|
|
8443
|
+
if (header instanceof Headers) {
|
|
8039
8444
|
hasContentLength = header.has("content-length");
|
|
8040
|
-
header = buildOutgoingHttpHeaders(header);
|
|
8445
|
+
header = buildOutgoingHttpHeaders(header, body === null ? void 0 : defaultContentType);
|
|
8041
8446
|
} else if (Array.isArray(header)) {
|
|
8042
8447
|
const headerObj = new Headers(header);
|
|
8043
8448
|
hasContentLength = headerObj.has("content-length");
|
|
8044
|
-
header = buildOutgoingHttpHeaders(headerObj);
|
|
8449
|
+
header = buildOutgoingHttpHeaders(headerObj, body === null ? void 0 : defaultContentType);
|
|
8045
8450
|
} else for (const key in header) if (key.length === 14 && key.toLowerCase() === "content-length") {
|
|
8046
8451
|
hasContentLength = true;
|
|
8047
8452
|
break;
|
|
@@ -8052,7 +8457,8 @@ var responseViaCache = async (res, outgoing) => {
|
|
|
8052
8457
|
else if (body instanceof Blob) header["Content-Length"] = body.size;
|
|
8053
8458
|
}
|
|
8054
8459
|
outgoing.writeHead(status, header);
|
|
8055
|
-
if (
|
|
8460
|
+
if (body == null) outgoing.end();
|
|
8461
|
+
else if (typeof body === "string" || body instanceof Uint8Array) outgoing.end(body);
|
|
8056
8462
|
else if (body instanceof Blob) outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
|
8057
8463
|
else {
|
|
8058
8464
|
flushHeaders(outgoing);
|
|
@@ -8071,7 +8477,7 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
|
8071
8477
|
}
|
|
8072
8478
|
else res = await res.catch(handleFetchError);
|
|
8073
8479
|
if (cacheKey in res) return responseViaCache(res, outgoing);
|
|
8074
|
-
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
|
|
8480
|
+
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers, res.body === null ? void 0 : defaultContentType);
|
|
8075
8481
|
if (res.body) {
|
|
8076
8482
|
const reader = res.body.getReader();
|
|
8077
8483
|
const values = [];
|
|
@@ -8111,7 +8517,7 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
|
8111
8517
|
if (values.length === 0) flushHeaders(outgoing);
|
|
8112
8518
|
await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
|
|
8113
8519
|
}
|
|
8114
|
-
} else if (resHeaderRecord[
|
|
8520
|
+
} else if (resHeaderRecord["x-hono-already-sent"]) {} else {
|
|
8115
8521
|
outgoing.writeHead(res.status, resHeaderRecord);
|
|
8116
8522
|
outgoing.end();
|
|
8117
8523
|
}
|
|
@@ -8121,47 +8527,45 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
8121
8527
|
const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
|
|
8122
8528
|
if (options.overrideGlobalObjects !== false && global.Request !== Request$1) {
|
|
8123
8529
|
Object.defineProperty(global, "Request", { value: Request$1 });
|
|
8124
|
-
Object.defineProperty(global, "Response", { value:
|
|
8530
|
+
Object.defineProperty(global, "Response", { value: Response$1 });
|
|
8125
8531
|
}
|
|
8126
8532
|
return async (incoming, outgoing) => {
|
|
8127
8533
|
let res, req;
|
|
8534
|
+
let needsBodyCleanup = false;
|
|
8535
|
+
let closeHandlerAttached = false;
|
|
8536
|
+
const ensureCloseHandler = () => {
|
|
8537
|
+
if (!req || closeHandlerAttached) return;
|
|
8538
|
+
closeHandlerAttached = true;
|
|
8539
|
+
outgoing.on("close", makeCloseHandler(req, incoming, outgoing, needsBodyCleanup));
|
|
8540
|
+
};
|
|
8128
8541
|
try {
|
|
8129
8542
|
req = newRequest(incoming, options.hostname);
|
|
8130
|
-
|
|
8131
|
-
if (
|
|
8543
|
+
needsBodyCleanup = autoCleanupIncoming && !(incoming.method === "GET" || incoming.method === "HEAD");
|
|
8544
|
+
if (needsBodyCleanup) {
|
|
8132
8545
|
incoming[wrapBodyStream] = true;
|
|
8133
|
-
incoming.
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
if (!incomingEnded) setTimeout(() => {
|
|
8139
|
-
drainIncoming(incoming);
|
|
8546
|
+
if (incoming instanceof node_http2.Http2ServerRequest) outgoing[outgoingEnded] = () => {
|
|
8547
|
+
if (!incoming.readableEnded) setTimeout(() => {
|
|
8548
|
+
if (!incoming.readableEnded) setTimeout(() => {
|
|
8549
|
+
incoming.destroy();
|
|
8550
|
+
outgoing.destroy();
|
|
8140
8551
|
});
|
|
8141
8552
|
});
|
|
8142
8553
|
};
|
|
8143
|
-
outgoing.on("finish", () => {
|
|
8144
|
-
if (!incomingEnded) drainIncoming(incoming);
|
|
8145
|
-
});
|
|
8146
8554
|
}
|
|
8147
|
-
outgoing.on("close", () => {
|
|
8148
|
-
if (req[abortControllerKey]) {
|
|
8149
|
-
if (incoming.errored) req[abortControllerKey].abort(incoming.errored.toString());
|
|
8150
|
-
else if (!outgoing.writableFinished) req[abortControllerKey].abort("Client connection prematurely closed.");
|
|
8151
|
-
}
|
|
8152
|
-
if (!incomingEnded) setTimeout(() => {
|
|
8153
|
-
if (!incomingEnded) setTimeout(() => {
|
|
8154
|
-
drainIncoming(incoming);
|
|
8155
|
-
});
|
|
8156
|
-
});
|
|
8157
|
-
});
|
|
8158
8555
|
res = fetchCallback(req, {
|
|
8159
8556
|
incoming,
|
|
8160
8557
|
outgoing
|
|
8161
8558
|
});
|
|
8162
|
-
if (
|
|
8559
|
+
if (!isPromise(res) && isImmediateCacheableResponse(res)) {
|
|
8560
|
+
if (needsBodyCleanup && !incoming.readableEnded) outgoing.once("finish", () => {
|
|
8561
|
+
if (!incoming.readableEnded) drainIncoming(incoming);
|
|
8562
|
+
});
|
|
8563
|
+
return responseViaCache(res, outgoing);
|
|
8564
|
+
}
|
|
8565
|
+
ensureCloseHandler();
|
|
8163
8566
|
} catch (e) {
|
|
8164
8567
|
if (!res) if (options.errorHandler) {
|
|
8568
|
+
ensureCloseHandler();
|
|
8165
8569
|
res = await options.errorHandler(req ? e : toRequestError(e));
|
|
8166
8570
|
if (!res) return;
|
|
8167
8571
|
} else if (!req) res = handleRequestError();
|
|
@@ -8175,6 +8579,8 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
8175
8579
|
}
|
|
8176
8580
|
};
|
|
8177
8581
|
};
|
|
8582
|
+
globalThis.CloseEvent;
|
|
8583
|
+
globalThis.ErrorEvent;
|
|
8178
8584
|
//#endregion
|
|
8179
8585
|
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js
|
|
8180
8586
|
/**
|
|
@@ -8879,16 +9285,18 @@ var StreamableHTTPServerTransport = class {
|
|
|
8879
9285
|
}
|
|
8880
9286
|
};
|
|
8881
9287
|
//#endregion
|
|
8882
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.7.4_@modelcontextprotocol+sdk@1.29.0_zod@4.4.3__react-
|
|
9288
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.7.4_@modelcontextprotocol+sdk@1.29.0_zod@4.4.3__react-_b5c68214f1621bc5f24903738e19c6a8/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.js
|
|
8883
9289
|
((Z) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(Z, { get: ($, J) => (typeof require < "u" ? require : $)[J] }) : Z)(function(Z) {
|
|
8884
9290
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
8885
9291
|
throw Error("Dynamic require of \"" + Z + "\" is not supported");
|
|
8886
9292
|
});
|
|
8887
|
-
var v = require_protocol.union([require_protocol.literal("light"), require_protocol.literal("dark")]).describe("Color theme preference for the host environment.")
|
|
9293
|
+
var v = require_protocol.union([require_protocol.literal("light"), require_protocol.literal("dark")]).describe("Color theme preference for the host environment.");
|
|
9294
|
+
var K = require_protocol.union([
|
|
8888
9295
|
require_protocol.literal("inline"),
|
|
8889
9296
|
require_protocol.literal("fullscreen"),
|
|
8890
9297
|
require_protocol.literal("pip")
|
|
8891
|
-
]).describe("Display mode for UI presentation.")
|
|
9298
|
+
]).describe("Display mode for UI presentation.");
|
|
9299
|
+
var QQ = require_protocol.union([
|
|
8892
9300
|
require_protocol.literal("--color-background-primary"),
|
|
8893
9301
|
require_protocol.literal("--color-background-secondary"),
|
|
8894
9302
|
require_protocol.literal("--color-background-tertiary"),
|
|
@@ -8965,7 +9373,8 @@ var v = require_protocol.union([require_protocol.literal("light"), require_proto
|
|
|
8965
9373
|
require_protocol.literal("--shadow-sm"),
|
|
8966
9374
|
require_protocol.literal("--shadow-md"),
|
|
8967
9375
|
require_protocol.literal("--shadow-lg")
|
|
8968
|
-
]).describe("CSS variable keys available to MCP apps for theming.")
|
|
9376
|
+
]).describe("CSS variable keys available to MCP apps for theming.");
|
|
9377
|
+
var ZQ = require_protocol.record(QQ.describe(`Style variables for theming MCP apps.
|
|
8969
9378
|
|
|
8970
9379
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
8971
9380
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -9003,7 +9412,8 @@ var Y = require_protocol.object({
|
|
|
9003
9412
|
resourceDomains: require_protocol.array(require_protocol.string()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),
|
|
9004
9413
|
frameDomains: require_protocol.array(require_protocol.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),
|
|
9005
9414
|
baseUriDomains: require_protocol.array(require_protocol.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")
|
|
9006
|
-
})
|
|
9415
|
+
});
|
|
9416
|
+
var j = require_protocol.object({
|
|
9007
9417
|
camera: require_protocol.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),
|
|
9008
9418
|
microphone: require_protocol.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),
|
|
9009
9419
|
geolocation: require_protocol.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),
|
|
@@ -9028,7 +9438,8 @@ require_protocol.object({
|
|
|
9028
9438
|
method: require_protocol.literal("ui/notifications/tool-cancelled"),
|
|
9029
9439
|
params: require_protocol.object({ reason: require_protocol.string().optional().describe("Optional reason for the cancellation (e.g., \"user action\", \"timeout\").") })
|
|
9030
9440
|
});
|
|
9031
|
-
var f = require_protocol.object({ fonts: require_protocol.string().optional() })
|
|
9441
|
+
var f = require_protocol.object({ fonts: require_protocol.string().optional() });
|
|
9442
|
+
var u = require_protocol.object({
|
|
9032
9443
|
variables: ZQ.optional().describe("CSS variables for theming the app."),
|
|
9033
9444
|
css: f.optional().describe("CSS blocks that apps can inject.")
|
|
9034
9445
|
});
|
|
@@ -9063,7 +9474,8 @@ var d = require_protocol.object({
|
|
|
9063
9474
|
updateModelContext: O.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
|
|
9064
9475
|
message: O.optional().describe("Host supports receiving content messages (ui/message) from the view."),
|
|
9065
9476
|
sampling: require_protocol.object({ tools: require_protocol.object({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.") }).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")
|
|
9066
|
-
})
|
|
9477
|
+
});
|
|
9478
|
+
var h = require_protocol.object({
|
|
9067
9479
|
experimental: require_protocol.object({}).optional().describe("Experimental features (structure TBD)."),
|
|
9068
9480
|
tools: require_protocol.object({ listChanged: require_protocol.boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
|
|
9069
9481
|
availableDisplayModes: require_protocol.array(K).optional().describe("Display modes the app supports.")
|
|
@@ -9186,7 +9598,8 @@ require_protocol.object({
|
|
|
9186
9598
|
hostCapabilities: d.describe("Features and capabilities provided by the host."),
|
|
9187
9599
|
hostContext: T.describe("Rich context about the host environment.")
|
|
9188
9600
|
}).passthrough();
|
|
9189
|
-
var C = "ui/resourceUri"
|
|
9601
|
+
var C = "ui/resourceUri";
|
|
9602
|
+
var p = "text/html;profile=mcp-app";
|
|
9190
9603
|
function K3(Z, $, J, X) {
|
|
9191
9604
|
let V = J._meta, D = V.ui, L = V[C], W = V;
|
|
9192
9605
|
if (D?.resourceUri && !L) W = {
|