deadbyte-mcp 0.15.48 → 0.15.50
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/MANIFEST.SHA256 +121 -91
- package/PROVENANCE.json +11 -22
- package/README.txt +18 -18
- package/RELEASE.json +368 -378
- package/SBOM.cdx.json +2 -2
- package/TEST-MATRIX.json +2 -2
- package/bench/r121-epoch-readhead.mjs +54 -0
- package/bench/r124-epoch-predecessor.mjs +53 -0
- package/controller/deadbyte-process-policy.json +4 -4
- package/docs/HARNESS2-ADAPTATION-20261020.md +24 -0
- package/docs/R128-RELEASE-CANDIDATE.md +26 -0
- package/docs/R130-SDK-SECURITY-PATCH.md +34 -0
- package/node_modules/@modelcontextprotocol/client/README.md +1 -7
- package/node_modules/@modelcontextprotocol/client/dist/{index-BCtJi0p5.d.mts → index-B-4n9P0J.d.mts} +5 -1
- package/node_modules/@modelcontextprotocol/client/dist/index-B-4n9P0J.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/{index-CEk3qkZM.d.cts → index-J2FaQ-KY.d.cts} +5 -1
- package/node_modules/@modelcontextprotocol/client/dist/index-J2FaQ-KY.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.cjs +175 -76
- package/node_modules/@modelcontextprotocol/client/dist/index.cjs.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.d.cts +214 -35
- package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.d.mts +214 -35
- package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.mjs +175 -76
- package/node_modules/@modelcontextprotocol/client/dist/index.mjs.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/{src-D0qEN74R.cjs → src-DpAS0jfg.cjs} +125 -11
- package/node_modules/@modelcontextprotocol/client/dist/src-DpAS0jfg.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/{src-DDAAhLnO.mjs → src-WCy6ifGf.mjs} +102 -12
- package/node_modules/@modelcontextprotocol/client/dist/src-WCy6ifGf.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/package.json +5 -5
- package/node_modules/@modelcontextprotocol/core/dist/{auth--n_Yzytt.d.cts → auth-Anm-lwWi.d.mts} +9 -8
- package/node_modules/@modelcontextprotocol/core/dist/{auth--n_Yzytt.d.cts.map → auth-Anm-lwWi.d.mts.map} +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/{auth-CGP0BDVq.mjs → auth-BNDyLTqp.mjs} +5 -3
- package/node_modules/@modelcontextprotocol/core/dist/{auth-CGP0BDVq.mjs.map → auth-BNDyLTqp.mjs.map} +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/{auth-4-zilcqg.cjs → auth-D1CeV_Jr.cjs} +5 -3
- package/node_modules/@modelcontextprotocol/core/dist/{auth-4-zilcqg.cjs.map → auth-D1CeV_Jr.cjs.map} +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/{auth-YUQV3RRv.d.mts → auth-V9XJSCfa.d.cts} +9 -8
- package/node_modules/@modelcontextprotocol/core/dist/{auth-YUQV3RRv.d.mts.map → auth-V9XJSCfa.d.cts.map} +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/index.cjs +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/index.d.cts +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/index.d.mts +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/index.mjs +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/internal.cjs +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/internal.d.cts +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/internal.d.mts +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/internal.mjs +1 -1
- package/node_modules/@modelcontextprotocol/core/package.json +2 -2
- package/node_modules/@modelcontextprotocol/server/README.md +1 -7
- package/node_modules/@modelcontextprotocol/server/dist/{createMcpHandler-Bt6U_Fqb.d.mts → createMcpHandler-D4NN8WsG.d.mts} +35 -13
- package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-D4NN8WsG.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/{createMcpHandler-BLVe3qmU.d.cts → createMcpHandler-DZmmlN8e.d.cts} +35 -13
- package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-DZmmlN8e.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/index.cjs +32 -5
- package/node_modules/@modelcontextprotocol/server/dist/index.cjs.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/index.d.cts +41 -5
- package/node_modules/@modelcontextprotocol/server/dist/index.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/index.d.mts +41 -5
- package/node_modules/@modelcontextprotocol/server/dist/index.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/index.mjs +32 -5
- package/node_modules/@modelcontextprotocol/server/dist/index.mjs.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/{mcp-DUcCQSTW.cjs → mcp-BumlNux0.cjs} +73 -23
- package/node_modules/@modelcontextprotocol/server/dist/mcp-BumlNux0.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/{mcp-Dw2OlZ1f.mjs → mcp-DIH4cS6P.mjs} +73 -23
- package/node_modules/@modelcontextprotocol/server/dist/mcp-DIH4cS6P.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.cjs +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.mjs +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/{src-CgFsfg3E.cjs → src-BhnGYybN.cjs} +29 -11
- package/node_modules/@modelcontextprotocol/server/dist/src-BhnGYybN.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/{src-D-y6h4N7.mjs → src-Cqbh3MYc.mjs} +29 -11
- package/node_modules/@modelcontextprotocol/server/dist/src-Cqbh3MYc.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/stdio.cjs +2 -2
- package/node_modules/@modelcontextprotocol/server/dist/stdio.d.cts +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/stdio.d.mts +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/stdio.mjs +2 -2
- package/node_modules/@modelcontextprotocol/server/package.json +4 -4
- package/node_modules/which/CHANGELOG.md +166 -0
- package/package.json +3 -3
- package/scripts/npm-release-r48.mjs +0 -4
- package/scripts/verify-authority-epoch-history.mjs +38 -0
- package/src/activation-continuity-engine-r65.mjs +9 -15
- package/src/agent-eval-r42.mjs +30 -0
- package/src/authority-continuity-r65.mjs +182 -13
- package/src/autonomous-local-supervisor.mjs +77 -47
- package/src/deadbyte-cli.mjs +18 -28
- package/src/remote-live-log.mjs +15 -8
- package/src/remote-log-decode-r60.mjs +65 -0
- package/src/remote-session-guardian.mjs +4 -5
- package/src/version.mjs +1 -1
- package/test/autonomous-local-supervisor.test.mjs +1 -1
- package/test/harness2-eval-context-isolation.test.mjs +90 -0
- package/test/r108-remote-powershell-path.test.mjs +59 -0
- package/test/r110-supervisor-powershell-path.test.mjs +28 -0
- package/test/r111-supervisor-marker-cas.test.mjs +116 -0
- package/test/r112-supervisor-claim-cas.test.mjs +63 -0
- package/test/r113-supervisor-cleanup-terminality.test.mjs +100 -0
- package/test/r114-supervisor-absence-proof.test.mjs +45 -0
- package/test/r115-posix-continuity-entrypoint.test.mjs +17 -0
- package/test/r116-authority-crash-matrix.test.mjs +83 -0
- package/test/r117-concurrent-orphan-recovery.test.mjs +54 -0
- package/test/r118-cross-process-orphan-recovery.test.mjs +99 -0
- package/test/r119-recovery-crash-after-commit.test.mjs +91 -0
- package/test/r120-authority-history-audit.test.mjs +103 -0
- package/test/r121-signed-transition-invariant.test.mjs +132 -0
- package/test/r122-epoch-bounded-read.test.mjs +58 -0
- package/test/r123-recovery-bounded-read.test.mjs +64 -0
- package/test/r124-live-log-integrity.test.mjs +66 -0
- package/test/r124-live-log-tail-boundaries.test.mjs +57 -0
- package/test/r124-signed-predecessor-shape.test.mjs +66 -0
- package/test/r125-restore-binding-types.test.mjs +63 -0
- package/test/r126-restore-policy-envelope.test.mjs +89 -0
- package/test/r127-restore-append-policy-boundary.test.mjs +25 -0
- package/test/r129-sdk-security-baseline.test.mjs +38 -0
- package/test/r130-release-security-contract.test.mjs +28 -0
- package/test/r59-tool-surface-compat.test.mjs +1 -1
- package/test/r65-authority-epoch-store.test.mjs +9 -6
- package/test/r74-prepublish-contract.test.mjs +3 -1
- package/node_modules/@modelcontextprotocol/client/dist/index-BCtJi0p5.d.mts.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/index-CEk3qkZM.d.cts.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/src-D0qEN74R.cjs.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/src-DDAAhLnO.mjs.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-BLVe3qmU.d.cts.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-Bt6U_Fqb.d.mts.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/mcp-DUcCQSTW.cjs.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/mcp-Dw2OlZ1f.mjs.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/src-CgFsfg3E.cjs.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/src-D-y6h4N7.mjs.map +0 -1
- package/scripts/npm-release-readiness-r108.mjs +0 -134
package/node_modules/@modelcontextprotocol/client/dist/{src-D0qEN74R.cjs → src-DpAS0jfg.cjs}
RENAMED
|
@@ -439,6 +439,13 @@ function resourceUrlFromServerUrl(url) {
|
|
|
439
439
|
resourceURL.hash = "";
|
|
440
440
|
return resourceURL;
|
|
441
441
|
}
|
|
442
|
+
/** Returns an authorization-server response body without `issuer`, which only the client sets, when it stores a value (SEP-2352). */
|
|
443
|
+
function withoutIssuer(body) {
|
|
444
|
+
if (typeof body !== "object" || body === null || Array.isArray(body)) return body;
|
|
445
|
+
const copy = { ...body };
|
|
446
|
+
delete copy.issuer;
|
|
447
|
+
return copy;
|
|
448
|
+
}
|
|
442
449
|
/**
|
|
443
450
|
* Checks if a requested resource URL matches a configured resource URL.
|
|
444
451
|
* A requested resource matches if it has the same scheme, domain, port,
|
|
@@ -3065,7 +3072,7 @@ function build() {
|
|
|
3065
3072
|
const subscriptionsListenParamsShape = { notifications: SubscriptionFilterSchema$1 };
|
|
3066
3073
|
const SubscriptionsListenRequestSchema$1 = wireRequest("subscriptions/listen", subscriptionsListenParamsShape);
|
|
3067
3074
|
/**
|
|
3068
|
-
* Anchor
|
|
3075
|
+
* Anchor SubscriptionsListenResultMetaObject — required subscriptionId stamp on
|
|
3069
3076
|
* the graceful-close result. Extends `ResultMetaObject` since spec PR
|
|
3070
3077
|
* #3002 (composed, so the serverInfo key and its leniency stay single-sourced).
|
|
3071
3078
|
*/
|
|
@@ -3338,7 +3345,8 @@ function build() {
|
|
|
3338
3345
|
ListResourceTemplatesResultResponseSchema: wireResultResponse(ListResourceTemplatesResultSchema$1),
|
|
3339
3346
|
ReadResourceResultResponseSchema: wireResultResponse(zod_v4.union([ReadResourceResultSchema$1, InputRequiredResultSchema])),
|
|
3340
3347
|
CompleteResultResponseSchema: wireResultResponse(CompleteResultSchema$1),
|
|
3341
|
-
DiscoverResultResponseSchema: wireResultResponse(DiscoverResultSchema$1)
|
|
3348
|
+
DiscoverResultResponseSchema: wireResultResponse(DiscoverResultSchema$1),
|
|
3349
|
+
SubscriptionsListenResultResponseSchema: wireResultResponse(SubscriptionsListenResultSchema$1)
|
|
3342
3350
|
};
|
|
3343
3351
|
}
|
|
3344
3352
|
let memo;
|
|
@@ -3965,6 +3973,8 @@ const rev2026Codec = {
|
|
|
3965
3973
|
const rawInputRequests = raw["inputRequests"];
|
|
3966
3974
|
const inputRequests = isPlainObject$3(rawInputRequests) ? rawInputRequests : {};
|
|
3967
3975
|
const requestState = raw["requestState"];
|
|
3976
|
+
const metaParse = raw["_meta"] === void 0 ? void 0 : buildSchemas2026().ResultMetaSchema.safeParse(raw["_meta"]);
|
|
3977
|
+
const meta = metaParse?.success ? metaParse.data : void 0;
|
|
3968
3978
|
if (Object.keys(inputRequests).length === 0 && typeof requestState !== "string") return {
|
|
3969
3979
|
kind: "invalid",
|
|
3970
3980
|
error: new SdkError(SdkErrorCode.InvalidResult, `Invalid result for ${method}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`, {
|
|
@@ -3975,7 +3985,8 @@ const rev2026Codec = {
|
|
|
3975
3985
|
return {
|
|
3976
3986
|
kind: "input_required",
|
|
3977
3987
|
inputRequests,
|
|
3978
|
-
...typeof requestState === "string" && { requestState }
|
|
3988
|
+
...typeof requestState === "string" && { requestState },
|
|
3989
|
+
...meta !== void 0 && { _meta: meta }
|
|
3979
3990
|
};
|
|
3980
3991
|
}
|
|
3981
3992
|
if (rawResultType !== "complete") return {
|
|
@@ -4083,6 +4094,10 @@ function isSpecRequestMethod(method) {
|
|
|
4083
4094
|
function isSpecNotificationMethod(method) {
|
|
4084
4095
|
return ALL_CODECS.some((codec) => codec.hasNotificationMethod(method));
|
|
4085
4096
|
}
|
|
4097
|
+
/** The names SEP-2663 re-defines for the Tasks extension on the era that removed them from core. */
|
|
4098
|
+
function isExtensionReusedRequestMethod(method) {
|
|
4099
|
+
return method === "tasks/get" || method === "tasks/cancel";
|
|
4100
|
+
}
|
|
4086
4101
|
const ALL_CODECS = [rev2025Codec, rev2026Codec];
|
|
4087
4102
|
|
|
4088
4103
|
//#endregion
|
|
@@ -5019,13 +5034,14 @@ function buildInputRequired(spec) {
|
|
|
5019
5034
|
* @example Write-once tool requesting confirmation
|
|
5020
5035
|
* ```ts
|
|
5021
5036
|
* server.registerTool('deploy', { inputSchema: z.object({ env: z.string() }) }, async ({ env }, ctx) => {
|
|
5022
|
-
* const
|
|
5023
|
-
*
|
|
5037
|
+
* const confirmationSchema = z.object({ confirm: z.boolean() });
|
|
5038
|
+
* const confirmed = acceptedContent(ctx.mcpReq.inputResponses, 'confirm', confirmationSchema);
|
|
5039
|
+
* if (confirmed?.confirm !== true) {
|
|
5024
5040
|
* return inputRequired({
|
|
5025
5041
|
* inputRequests: {
|
|
5026
5042
|
* confirm: inputRequired.elicit({
|
|
5027
5043
|
* message: `Deploy to ${env}?`,
|
|
5028
|
-
* requestedSchema:
|
|
5044
|
+
* requestedSchema: confirmationSchema
|
|
5029
5045
|
* })
|
|
5030
5046
|
* }
|
|
5031
5047
|
* });
|
|
@@ -5636,6 +5652,8 @@ var Protocol = class {
|
|
|
5636
5652
|
_transport;
|
|
5637
5653
|
_requestMessageId = 0;
|
|
5638
5654
|
_requestHandlers = /* @__PURE__ */ new Map();
|
|
5655
|
+
/** Methods registered with an explicit schema; the era gate in `_onrequest` reads it for the Tasks extension names. */
|
|
5656
|
+
_customSchemaRequestMethods = /* @__PURE__ */ new Set();
|
|
5639
5657
|
_requestHandlerAbortControllers = /* @__PURE__ */ new Map();
|
|
5640
5658
|
_notificationHandlers = /* @__PURE__ */ new Map();
|
|
5641
5659
|
_responseHandlers = /* @__PURE__ */ new Map();
|
|
@@ -5917,7 +5935,7 @@ var Protocol = class {
|
|
|
5917
5935
|
return;
|
|
5918
5936
|
}
|
|
5919
5937
|
}
|
|
5920
|
-
if (isSpecRequestMethod(request.method) && !codec.hasRequestMethod(request.method)) {
|
|
5938
|
+
if (isSpecRequestMethod(request.method) && !codec.hasRequestMethod(request.method) && !(isExtensionReusedRequestMethod(request.method) && this._customSchemaRequestMethods.has(request.method))) {
|
|
5921
5939
|
sendErrorResponse(ProtocolErrorCode.MethodNotFound, "Method not found");
|
|
5922
5940
|
return;
|
|
5923
5941
|
}
|
|
@@ -6050,8 +6068,11 @@ var Protocol = class {
|
|
|
6050
6068
|
}
|
|
6051
6069
|
request(request, schemaOrOptions, maybeOptions) {
|
|
6052
6070
|
const codec = this._resolveOutboundCodec(request.method);
|
|
6071
|
+
if (isStandardSchema(schemaOrOptions)) {
|
|
6072
|
+
if (!isExtensionReusedRequestMethod(request.method)) this._assertOutboundRequestInEra(codec, request.method);
|
|
6073
|
+
return this._requestWithSchemaViaCodec(codec, request, schemaOrOptions, maybeOptions);
|
|
6074
|
+
}
|
|
6053
6075
|
this._assertOutboundRequestInEra(codec, request.method);
|
|
6054
|
-
if (isStandardSchema(schemaOrOptions)) return this._requestWithSchemaViaCodec(codec, request, schemaOrOptions, maybeOptions);
|
|
6055
6076
|
const validate = codecResultValidator(codec, request.method);
|
|
6056
6077
|
if (validate === void 0) throw new TypeError(`'${request.method}' is not a spec method; pass a result schema as the second argument to request().`);
|
|
6057
6078
|
return this._requestWithSchemaViaCodec(codec, request, validate, schemaOrOptions);
|
|
@@ -6244,7 +6265,7 @@ var Protocol = class {
|
|
|
6244
6265
|
* Emits a notification, which is a one-way message that does not expect a response.
|
|
6245
6266
|
*/
|
|
6246
6267
|
async notification(notification, options) {
|
|
6247
|
-
return this._notificationViaCodec(this._resolveOutboundCodec(notification.method), notification, options);
|
|
6268
|
+
return await this._notificationViaCodec(this._resolveOutboundCodec(notification.method), notification, options);
|
|
6248
6269
|
}
|
|
6249
6270
|
/**
|
|
6250
6271
|
* The notification funnel proper, keyed by the resolved era codec —
|
|
@@ -6295,6 +6316,8 @@ var Protocol = class {
|
|
|
6295
6316
|
return maybeHandler(parsed.data, ctx);
|
|
6296
6317
|
};
|
|
6297
6318
|
else throw new TypeError("setRequestHandler: handler is required");
|
|
6319
|
+
if (typeof schemasOrHandler === "function") this._customSchemaRequestMethods.delete(method);
|
|
6320
|
+
else this._customSchemaRequestMethods.add(method);
|
|
6298
6321
|
this._requestHandlers.set(method, this._wrapHandler(method, stored));
|
|
6299
6322
|
}
|
|
6300
6323
|
/**
|
|
@@ -6323,6 +6346,7 @@ var Protocol = class {
|
|
|
6323
6346
|
*/
|
|
6324
6347
|
removeRequestHandler(method) {
|
|
6325
6348
|
this._requestHandlers.delete(method);
|
|
6349
|
+
this._customSchemaRequestMethods.delete(method);
|
|
6326
6350
|
}
|
|
6327
6351
|
/**
|
|
6328
6352
|
* Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
|
|
@@ -6541,7 +6565,8 @@ function manualInputRequiredValue(decoded) {
|
|
|
6541
6565
|
return {
|
|
6542
6566
|
resultType: "input_required",
|
|
6543
6567
|
inputRequests: decoded.inputRequests,
|
|
6544
|
-
...decoded.requestState !== void 0 && { requestState: decoded.requestState }
|
|
6568
|
+
...decoded.requestState !== void 0 && { requestState: decoded.requestState },
|
|
6569
|
+
...decoded._meta !== void 0 && { _meta: decoded._meta }
|
|
6545
6570
|
};
|
|
6546
6571
|
}
|
|
6547
6572
|
|
|
@@ -6785,6 +6810,71 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
|
6785
6810
|
});
|
|
6786
6811
|
};
|
|
6787
6812
|
}
|
|
6813
|
+
const REDIRECT_STATUSES = new Set([
|
|
6814
|
+
301,
|
|
6815
|
+
302,
|
|
6816
|
+
303,
|
|
6817
|
+
307,
|
|
6818
|
+
308
|
|
6819
|
+
]);
|
|
6820
|
+
const MAX_REDIRECTS = 5;
|
|
6821
|
+
/** Whether `to` has the scheme, host and port of `from`, or is its https form with both on the default port. */
|
|
6822
|
+
function isWithinOrigin(from, to) {
|
|
6823
|
+
if (from.protocol === to.protocol && from.host === to.host) return true;
|
|
6824
|
+
return from.protocol === "http:" && to.protocol === "https:" && from.hostname === to.hostname && !from.port && !to.port;
|
|
6825
|
+
}
|
|
6826
|
+
/** The URL that a redirect `response` to a request for `url` points at, if it names one. */
|
|
6827
|
+
function redirectTarget(url, response) {
|
|
6828
|
+
const location = REDIRECT_STATUSES.has(response.status) ? response.headers?.get("location") : void 0;
|
|
6829
|
+
if (!location) return void 0;
|
|
6830
|
+
try {
|
|
6831
|
+
return new URL(location, url);
|
|
6832
|
+
} catch {
|
|
6833
|
+
return;
|
|
6834
|
+
}
|
|
6835
|
+
}
|
|
6836
|
+
const leftToFetch = /* @__PURE__ */ new WeakSet();
|
|
6837
|
+
/** A copy of `baseFetch` that `fetchWithinOrigin` returns as it is, which leaves redirects to `baseFetch`. */
|
|
6838
|
+
function fetchLeavingRedirects(baseFetch) {
|
|
6839
|
+
const copy = (url, init) => baseFetch(url, init);
|
|
6840
|
+
leftToFetch.add(copy);
|
|
6841
|
+
return copy;
|
|
6842
|
+
}
|
|
6843
|
+
/** Wraps `baseFetch` to follow a redirect only when it keeps the method and stays within the origin of the request. */
|
|
6844
|
+
function fetchWithinOrigin(baseFetch) {
|
|
6845
|
+
if (leftToFetch.has(baseFetch)) return baseFetch;
|
|
6846
|
+
return async (url, init) => {
|
|
6847
|
+
if (init?.redirect === "error" || init?.redirect === "manual") return baseFetch(url, init);
|
|
6848
|
+
const method = (init?.method ?? "GET").toUpperCase();
|
|
6849
|
+
let current = url;
|
|
6850
|
+
for (let followed = 0;; followed++) {
|
|
6851
|
+
const response = await baseFetch(current, {
|
|
6852
|
+
...init,
|
|
6853
|
+
redirect: "manual"
|
|
6854
|
+
});
|
|
6855
|
+
const target = redirectTarget(current, response);
|
|
6856
|
+
if (!target || followed === MAX_REDIRECTS) return response;
|
|
6857
|
+
const from = new URL(current);
|
|
6858
|
+
const keepsMethod = method === "GET" || response.status === 307 || response.status === 308;
|
|
6859
|
+
const keepsUserinfo = !(target.username || target.password) || target.username === from.username && target.password === from.password;
|
|
6860
|
+
if (!keepsMethod || !keepsUserinfo || !isWithinOrigin(from, target)) return response;
|
|
6861
|
+
await response.text?.().catch(() => {});
|
|
6862
|
+
current = target;
|
|
6863
|
+
}
|
|
6864
|
+
};
|
|
6865
|
+
}
|
|
6866
|
+
/** Error text for a redirect `response` to a request for `url` that was not followed, or `undefined` for any other response. */
|
|
6867
|
+
function unfollowedRedirect(url, response) {
|
|
6868
|
+
if (response.type === "opaqueredirect") return "Redirect not followed: this runtime does not expose where it points";
|
|
6869
|
+
const target = redirectTarget(response.url || url, response);
|
|
6870
|
+
if (!target) return void 0;
|
|
6871
|
+
target.username = target.password = target.search = target.hash = "";
|
|
6872
|
+
if (target.protocol === "http:" && new URL(response.url || url).protocol === "https:") {
|
|
6873
|
+
target.protocol = "https:";
|
|
6874
|
+
return `Redirect from https to plain http not followed; try ${target.href} as the endpoint`;
|
|
6875
|
+
}
|
|
6876
|
+
return `Redirect to ${target.href} not followed; use that URL as the endpoint if it is the intended server`;
|
|
6877
|
+
}
|
|
6788
6878
|
|
|
6789
6879
|
//#endregion
|
|
6790
6880
|
//#region ../core-internal/src/shared/uriTemplate.ts
|
|
@@ -7315,6 +7405,18 @@ Object.defineProperty(exports, 'encodeMcpParamValue', {
|
|
|
7315
7405
|
return encodeMcpParamValue;
|
|
7316
7406
|
}
|
|
7317
7407
|
});
|
|
7408
|
+
Object.defineProperty(exports, 'fetchLeavingRedirects', {
|
|
7409
|
+
enumerable: true,
|
|
7410
|
+
get: function () {
|
|
7411
|
+
return fetchLeavingRedirects;
|
|
7412
|
+
}
|
|
7413
|
+
});
|
|
7414
|
+
Object.defineProperty(exports, 'fetchWithinOrigin', {
|
|
7415
|
+
enumerable: true,
|
|
7416
|
+
get: function () {
|
|
7417
|
+
return fetchWithinOrigin;
|
|
7418
|
+
}
|
|
7419
|
+
});
|
|
7318
7420
|
Object.defineProperty(exports, 'fromJsonSchema', {
|
|
7319
7421
|
enumerable: true,
|
|
7320
7422
|
get: function () {
|
|
@@ -7495,10 +7597,22 @@ Object.defineProperty(exports, 'stampErrorBrands', {
|
|
|
7495
7597
|
return stampErrorBrands;
|
|
7496
7598
|
}
|
|
7497
7599
|
});
|
|
7600
|
+
Object.defineProperty(exports, 'unfollowedRedirect', {
|
|
7601
|
+
enumerable: true,
|
|
7602
|
+
get: function () {
|
|
7603
|
+
return unfollowedRedirect;
|
|
7604
|
+
}
|
|
7605
|
+
});
|
|
7498
7606
|
Object.defineProperty(exports, 'withInputRequired', {
|
|
7499
7607
|
enumerable: true,
|
|
7500
7608
|
get: function () {
|
|
7501
7609
|
return withInputRequired;
|
|
7502
7610
|
}
|
|
7503
7611
|
});
|
|
7504
|
-
|
|
7612
|
+
Object.defineProperty(exports, 'withoutIssuer', {
|
|
7613
|
+
enumerable: true,
|
|
7614
|
+
get: function () {
|
|
7615
|
+
return withoutIssuer;
|
|
7616
|
+
}
|
|
7617
|
+
});
|
|
7618
|
+
//# sourceMappingURL=src-DpAS0jfg.cjs.map
|