@lightsage/mcp 0.4.13 → 0.4.15
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/README.md +2 -2
- package/api/mcp.js +21 -5
- package/bin/mcp-server.js +1242 -397
- package/bin/mcp-server.js.map +43 -39
- package/esm/funcs/evalRunsList.d.ts +1 -1
- package/esm/funcs/evalRunsList.js +1 -1
- package/esm/landing-page.js +1 -1
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/mcp-server/mcp-server.js +1 -1
- package/esm/mcp-server/server.js +1 -1
- package/esm/mcp-server/tools/evalRunsList.js +1 -1
- package/esm/mcp-server/tools/evalRunsList.js.map +1 -1
- package/esm/models/createevaltemplaterequest.d.ts +2 -1
- package/esm/models/createevaltemplaterequest.d.ts.map +1 -1
- package/esm/models/createevaltemplaterequest.js +2 -1
- package/esm/models/createevaltemplaterequest.js.map +1 -1
- package/esm/models/evaltemplate.d.ts +1 -0
- package/esm/models/evaltemplate.d.ts.map +1 -1
- package/esm/models/evaltemplate.js +1 -0
- package/esm/models/evaltemplate.js.map +1 -1
- package/esm/models/updateevaltemplaterequest.d.ts +1 -0
- package/esm/models/updateevaltemplaterequest.d.ts.map +1 -1
- package/esm/models/updateevaltemplaterequest.js +1 -0
- package/esm/models/updateevaltemplaterequest.js.map +1 -1
- package/esm/models/v2publictask.d.ts +24 -0
- package/esm/models/v2publictask.d.ts.map +1 -1
- package/esm/models/v2publictask.js +24 -1
- package/esm/models/v2publictask.js.map +1 -1
- package/esm/tool-names.js +1 -1
- package/esm/tool-names.js.map +1 -1
- package/lib/oauth.js +182 -9
- package/lib/profile.js +79 -0
- package/package.json +7 -4
- package/src/funcs/evalRunsList.ts +1 -1
- package/src/landing-page.ts +1 -1
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/mcp-server/tools/evalRunsList.ts +1 -1
- package/src/models/createevaltemplaterequest.ts +6 -2
- package/src/models/evaltemplate.ts +4 -0
- package/src/models/updateevaltemplaterequest.ts +2 -0
- package/src/models/v2publictask.ts +43 -1
- package/src/tool-names.ts +1 -1
- package/test/mcp-auth.test.js +203 -0
package/bin/mcp-server.js
CHANGED
|
@@ -385,6 +385,18 @@ function prefixIssues(path, issues) {
|
|
|
385
385
|
function unwrapMessage(message) {
|
|
386
386
|
return typeof message === "string" ? message : message?.message;
|
|
387
387
|
}
|
|
388
|
+
function sizeCaps(defChecks) {
|
|
389
|
+
const caps = [];
|
|
390
|
+
for (const ch of defChecks ?? []) {
|
|
391
|
+
const d = ch._zod.def;
|
|
392
|
+
if (!/_(length|size)$|_equals$/.test(d.check))
|
|
393
|
+
break;
|
|
394
|
+
const max = d.maximum ?? d.length ?? d.size;
|
|
395
|
+
if (max >= 0)
|
|
396
|
+
caps.push([max, ch]);
|
|
397
|
+
}
|
|
398
|
+
return caps;
|
|
399
|
+
}
|
|
388
400
|
function attachSchema(issues, start, inst) {
|
|
389
401
|
var _a;
|
|
390
402
|
for (let i = start;i < issues.length; i++) {
|
|
@@ -1453,7 +1465,7 @@ var init_versions = __esm(() => {
|
|
|
1453
1465
|
version2 = {
|
|
1454
1466
|
major: 4,
|
|
1455
1467
|
minor: 6,
|
|
1456
|
-
patch:
|
|
1468
|
+
patch: 7
|
|
1457
1469
|
};
|
|
1458
1470
|
});
|
|
1459
1471
|
|
|
@@ -1579,6 +1591,28 @@ function isValidJWT(token, algorithm = null) {
|
|
|
1579
1591
|
return false;
|
|
1580
1592
|
}
|
|
1581
1593
|
}
|
|
1594
|
+
function capSize(inst, size) {
|
|
1595
|
+
const caps = sizeCaps(inst._zod.def.checks);
|
|
1596
|
+
if (!caps.length)
|
|
1597
|
+
return;
|
|
1598
|
+
const cap = Math.min(...caps.map((c) => c[0]));
|
|
1599
|
+
const parse = inst._zod.parse;
|
|
1600
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1601
|
+
const n = size(payload.value);
|
|
1602
|
+
if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
1603
|
+
for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
|
|
1604
|
+
if (n > max && ch._zod.def.when(payload)) {
|
|
1605
|
+
const start = payload.issues.length;
|
|
1606
|
+
ch._zod.check(payload);
|
|
1607
|
+
payload.issues[start].continue = false;
|
|
1608
|
+
attachSchema(payload.issues, start, inst);
|
|
1609
|
+
return payload;
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
return parse(payload, ctx);
|
|
1614
|
+
};
|
|
1615
|
+
}
|
|
1582
1616
|
function handleArrayResult(result, final, index) {
|
|
1583
1617
|
if (result.issues.length) {
|
|
1584
1618
|
final.issues.push(...prefixIssues(index, result.issues));
|
|
@@ -1884,7 +1918,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
1884
1918
|
payload.issues.push(issue(_iss));
|
|
1885
1919
|
}
|
|
1886
1920
|
}
|
|
1887
|
-
var $ZodType, toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value }, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, URL_BAD_FORMAT = 1, URL_UNPARSEABLE = 2, asciiTabOrNewline, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, ipv6Alphabet, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, base64Charset, $ZodBase64, base64urlCharset, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, $ZodArray, NO_SYMBOL_KEYS, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodPreprocess, $ZodReadonly, $ZodLazy, $ZodCustom;
|
|
1921
|
+
var $ZodType, toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value }, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, URL_BAD_FORMAT = 1, URL_UNPARSEABLE = 2, asciiTabOrNewline, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, ipv6Alphabet, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, base64Charset, $ZodBase64, base64urlCharset, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, arraySize = (input) => Array.isArray(input) ? input.length : -1, $ZodArray, NO_SYMBOL_KEYS, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodPreprocess, $ZodReadonly, $ZodLazy, $ZodCustom;
|
|
1888
1922
|
var init_schemas = __esm(() => {
|
|
1889
1923
|
init_checks();
|
|
1890
1924
|
init_core();
|
|
@@ -2374,6 +2408,7 @@ var init_schemas = __esm(() => {
|
|
|
2374
2408
|
}
|
|
2375
2409
|
return payload;
|
|
2376
2410
|
};
|
|
2411
|
+
capSize(inst, arraySize);
|
|
2377
2412
|
});
|
|
2378
2413
|
NO_SYMBOL_KEYS = [];
|
|
2379
2414
|
$ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
@@ -7062,6 +7097,161 @@ var init_dist = __esm(() => {
|
|
|
7062
7097
|
MAX_DRAIN_BYTES = 64 * 1024 * 1024;
|
|
7063
7098
|
});
|
|
7064
7099
|
|
|
7100
|
+
// node_modules/content-type/index.js
|
|
7101
|
+
function parse5(string) {
|
|
7102
|
+
if (!string) {
|
|
7103
|
+
throw new TypeError("argument string is required");
|
|
7104
|
+
}
|
|
7105
|
+
var header = typeof string === "object" ? getcontenttype(string) : string;
|
|
7106
|
+
if (typeof header !== "string") {
|
|
7107
|
+
throw new TypeError("argument string is required to be a string");
|
|
7108
|
+
}
|
|
7109
|
+
var index = header.indexOf(";");
|
|
7110
|
+
var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
|
|
7111
|
+
if (!TYPE_REGEXP.test(type)) {
|
|
7112
|
+
throw new TypeError("invalid media type");
|
|
7113
|
+
}
|
|
7114
|
+
var obj = new ContentType(type.toLowerCase());
|
|
7115
|
+
if (index !== -1) {
|
|
7116
|
+
var key;
|
|
7117
|
+
var match;
|
|
7118
|
+
var value;
|
|
7119
|
+
PARAM_REGEXP.lastIndex = index;
|
|
7120
|
+
while (match = PARAM_REGEXP.exec(header)) {
|
|
7121
|
+
if (match.index !== index) {
|
|
7122
|
+
throw new TypeError("invalid parameter format");
|
|
7123
|
+
}
|
|
7124
|
+
index += match[0].length;
|
|
7125
|
+
key = match[1].toLowerCase();
|
|
7126
|
+
value = match[2];
|
|
7127
|
+
if (value.charCodeAt(0) === 34) {
|
|
7128
|
+
value = value.slice(1, -1);
|
|
7129
|
+
if (value.indexOf("\\") !== -1) {
|
|
7130
|
+
value = value.replace(QESC_REGEXP, "$1");
|
|
7131
|
+
}
|
|
7132
|
+
}
|
|
7133
|
+
obj.parameters[key] = value;
|
|
7134
|
+
}
|
|
7135
|
+
if (index !== header.length) {
|
|
7136
|
+
throw new TypeError("invalid parameter format");
|
|
7137
|
+
}
|
|
7138
|
+
}
|
|
7139
|
+
return obj;
|
|
7140
|
+
}
|
|
7141
|
+
function getcontenttype(obj) {
|
|
7142
|
+
var header;
|
|
7143
|
+
if (typeof obj.getHeader === "function") {
|
|
7144
|
+
header = obj.getHeader("content-type");
|
|
7145
|
+
} else if (typeof obj.headers === "object") {
|
|
7146
|
+
header = obj.headers && obj.headers["content-type"];
|
|
7147
|
+
}
|
|
7148
|
+
if (typeof header !== "string") {
|
|
7149
|
+
throw new TypeError("content-type header is missing from object");
|
|
7150
|
+
}
|
|
7151
|
+
return header;
|
|
7152
|
+
}
|
|
7153
|
+
function ContentType(type) {
|
|
7154
|
+
this.parameters = Object.create(null);
|
|
7155
|
+
this.type = type;
|
|
7156
|
+
}
|
|
7157
|
+
var PARAM_REGEXP, QESC_REGEXP, TYPE_REGEXP, $parse;
|
|
7158
|
+
var init_content_type = __esm(() => {
|
|
7159
|
+
/*!
|
|
7160
|
+
* content-type
|
|
7161
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
7162
|
+
* MIT Licensed
|
|
7163
|
+
*/
|
|
7164
|
+
PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
7165
|
+
QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
7166
|
+
TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
7167
|
+
$parse = parse5;
|
|
7168
|
+
});
|
|
7169
|
+
|
|
7170
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js
|
|
7171
|
+
function mediaTypeEssence(header) {
|
|
7172
|
+
if (!header) {
|
|
7173
|
+
return;
|
|
7174
|
+
}
|
|
7175
|
+
try {
|
|
7176
|
+
return $parse(header).type;
|
|
7177
|
+
} catch {
|
|
7178
|
+
const essence = (header.split(";", 1)[0] ?? "").trim().toLowerCase();
|
|
7179
|
+
if (essence === "" || header.slice(essence.length).includes(",")) {
|
|
7180
|
+
return;
|
|
7181
|
+
}
|
|
7182
|
+
return essence;
|
|
7183
|
+
}
|
|
7184
|
+
}
|
|
7185
|
+
function isJsonContentType(header) {
|
|
7186
|
+
if (header === "application/json") {
|
|
7187
|
+
return true;
|
|
7188
|
+
}
|
|
7189
|
+
return mediaTypeEssence(header) === "application/json";
|
|
7190
|
+
}
|
|
7191
|
+
var init_mediaType = __esm(() => {
|
|
7192
|
+
init_content_type();
|
|
7193
|
+
});
|
|
7194
|
+
|
|
7195
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.js
|
|
7196
|
+
function requestBodyTooLargeMessage(maxBytes) {
|
|
7197
|
+
return `Payload Too Large: Request body must not exceed ${maxBytes} bytes`;
|
|
7198
|
+
}
|
|
7199
|
+
function resolveMaxRequestBodySize(value) {
|
|
7200
|
+
if (value === undefined) {
|
|
7201
|
+
return DEFAULT_MAX_REQUEST_BODY_SIZE;
|
|
7202
|
+
}
|
|
7203
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
7204
|
+
throw new RangeError(`maxRequestBodySize must be a positive number of bytes, got ${String(value)}`);
|
|
7205
|
+
}
|
|
7206
|
+
return value;
|
|
7207
|
+
}
|
|
7208
|
+
async function readRequestBody(request, maxBytes = DEFAULT_MAX_REQUEST_BODY_SIZE) {
|
|
7209
|
+
if (Number(request.headers.get("content-length")) > maxBytes) {
|
|
7210
|
+
return { tooLarge: true };
|
|
7211
|
+
}
|
|
7212
|
+
if (request.body === null) {
|
|
7213
|
+
return { tooLarge: false, text: "" };
|
|
7214
|
+
}
|
|
7215
|
+
const reader = request.body.getReader();
|
|
7216
|
+
const decoder = new TextDecoder;
|
|
7217
|
+
let received = 0;
|
|
7218
|
+
let text = "";
|
|
7219
|
+
try {
|
|
7220
|
+
for (;; ) {
|
|
7221
|
+
const { done, value } = await reader.read();
|
|
7222
|
+
if (done) {
|
|
7223
|
+
break;
|
|
7224
|
+
}
|
|
7225
|
+
received += value.byteLength;
|
|
7226
|
+
if (received > maxBytes) {
|
|
7227
|
+
return { tooLarge: true };
|
|
7228
|
+
}
|
|
7229
|
+
text += decoder.decode(value, { stream: true });
|
|
7230
|
+
}
|
|
7231
|
+
} finally {
|
|
7232
|
+
reader.releaseLock();
|
|
7233
|
+
}
|
|
7234
|
+
return { tooLarge: false, text: text + decoder.decode() };
|
|
7235
|
+
}
|
|
7236
|
+
var DEFAULT_MAX_REQUEST_BODY_SIZE, MAX_BATCH_SIZE = 100;
|
|
7237
|
+
var init_requestBody = __esm(() => {
|
|
7238
|
+
DEFAULT_MAX_REQUEST_BODY_SIZE = 4 * 1024 * 1024;
|
|
7239
|
+
});
|
|
7240
|
+
|
|
7241
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js
|
|
7242
|
+
function armSseKeepAlive(intervalMs, onTick) {
|
|
7243
|
+
if (!Number.isFinite(intervalMs) || intervalMs < 1) {
|
|
7244
|
+
return;
|
|
7245
|
+
}
|
|
7246
|
+
const timer = setInterval(onTick, Math.min(intervalMs, MAX_TIMER_DELAY_MS));
|
|
7247
|
+
timer.unref?.();
|
|
7248
|
+
return timer;
|
|
7249
|
+
}
|
|
7250
|
+
var DEFAULT_SSE_KEEP_ALIVE_MS = 15000, MAX_TIMER_DELAY_MS;
|
|
7251
|
+
var init_sseKeepAlive = __esm(() => {
|
|
7252
|
+
MAX_TIMER_DELAY_MS = 2 ** 31 - 1;
|
|
7253
|
+
});
|
|
7254
|
+
|
|
7065
7255
|
// node_modules/zod/v4/classic/index.js
|
|
7066
7256
|
var init_classic = __esm(() => {
|
|
7067
7257
|
init_external();
|
|
@@ -7091,7 +7281,7 @@ var init_types = __esm(() => {
|
|
|
7091
7281
|
ProgressTokenSchema = union([string2(), number2().int()]);
|
|
7092
7282
|
CursorSchema = string2();
|
|
7093
7283
|
TaskCreationParamsSchema = looseObject({
|
|
7094
|
-
ttl:
|
|
7284
|
+
ttl: number2().optional(),
|
|
7095
7285
|
pollInterval: number2().optional()
|
|
7096
7286
|
});
|
|
7097
7287
|
TaskMetadataSchema = object({
|
|
@@ -7239,7 +7429,8 @@ var init_types = __esm(() => {
|
|
|
7239
7429
|
roots: object({
|
|
7240
7430
|
listChanged: boolean2().optional()
|
|
7241
7431
|
}).optional(),
|
|
7242
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
7432
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
7433
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
7243
7434
|
});
|
|
7244
7435
|
InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
7245
7436
|
protocolVersion: string2(),
|
|
@@ -7264,7 +7455,8 @@ var init_types = __esm(() => {
|
|
|
7264
7455
|
tools: object({
|
|
7265
7456
|
listChanged: boolean2().optional()
|
|
7266
7457
|
}).optional(),
|
|
7267
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
7458
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
7459
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
7268
7460
|
});
|
|
7269
7461
|
InitializeResultSchema = ResultSchema.extend({
|
|
7270
7462
|
protocolVersion: string2(),
|
|
@@ -7379,6 +7571,7 @@ var init_types = __esm(() => {
|
|
|
7379
7571
|
uri: string2(),
|
|
7380
7572
|
description: optional(string2()),
|
|
7381
7573
|
mimeType: optional(string2()),
|
|
7574
|
+
size: optional(number2()),
|
|
7382
7575
|
annotations: AnnotationsSchema.optional(),
|
|
7383
7576
|
_meta: optional(looseObject({}))
|
|
7384
7577
|
});
|
|
@@ -7914,10 +8107,12 @@ class WebStandardStreamableHTTPServerTransport {
|
|
|
7914
8107
|
this._hasHandledRequest = false;
|
|
7915
8108
|
this._streamMapping = new Map;
|
|
7916
8109
|
this._requestToStreamMapping = new Map;
|
|
8110
|
+
this._resumableStreams = new Set;
|
|
7917
8111
|
this._requestResponseMap = new Map;
|
|
7918
8112
|
this._initialized = false;
|
|
7919
8113
|
this._enableJsonResponse = false;
|
|
7920
8114
|
this._standaloneSseStreamId = "_GET_stream";
|
|
8115
|
+
this._closed = false;
|
|
7921
8116
|
this.sessionIdGenerator = options.sessionIdGenerator;
|
|
7922
8117
|
this._enableJsonResponse = options.enableJsonResponse ?? false;
|
|
7923
8118
|
this._eventStore = options.eventStore;
|
|
@@ -7927,6 +8122,23 @@ class WebStandardStreamableHTTPServerTransport {
|
|
|
7927
8122
|
this._allowedOrigins = options.allowedOrigins;
|
|
7928
8123
|
this._enableDnsRebindingProtection = options.enableDnsRebindingProtection ?? false;
|
|
7929
8124
|
this._retryInterval = options.retryInterval;
|
|
8125
|
+
this._keepAliveMs = options.keepAliveMs ?? DEFAULT_SSE_KEEP_ALIVE_MS;
|
|
8126
|
+
this._maxRequestBodySize = resolveMaxRequestBodySize(options.maxRequestBodySize);
|
|
8127
|
+
}
|
|
8128
|
+
startKeepAlive(controller, encoder) {
|
|
8129
|
+
if (this._closed)
|
|
8130
|
+
return;
|
|
8131
|
+
const timer = armSseKeepAlive(this._keepAliveMs, () => {
|
|
8132
|
+
try {
|
|
8133
|
+
controller.enqueue(encoder.encode(`: keepalive
|
|
8134
|
+
|
|
8135
|
+
`));
|
|
8136
|
+
} catch {
|
|
8137
|
+
if (timer !== undefined)
|
|
8138
|
+
clearInterval(timer);
|
|
8139
|
+
}
|
|
8140
|
+
});
|
|
8141
|
+
return timer;
|
|
7930
8142
|
}
|
|
7931
8143
|
async start() {
|
|
7932
8144
|
if (this._started) {
|
|
@@ -7974,6 +8186,9 @@ class WebStandardStreamableHTTPServerTransport {
|
|
|
7974
8186
|
return;
|
|
7975
8187
|
}
|
|
7976
8188
|
async handleRequest(req, options) {
|
|
8189
|
+
if (this._closed) {
|
|
8190
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
8191
|
+
}
|
|
7977
8192
|
if (!this.sessionIdGenerator && this._hasHandledRequest) {
|
|
7978
8193
|
throw new Error("Stateless transport cannot be reused across requests. Create a new transport per request.");
|
|
7979
8194
|
}
|
|
@@ -8013,10 +8228,12 @@ data:
|
|
|
8013
8228
|
`;
|
|
8014
8229
|
}
|
|
8015
8230
|
controller.enqueue(encoder.encode(primingEvent));
|
|
8231
|
+
this._resumableStreams.add(streamId);
|
|
8016
8232
|
}
|
|
8017
8233
|
async handleGetRequest(req) {
|
|
8018
8234
|
const acceptHeader = req.headers.get("accept");
|
|
8019
8235
|
if (!acceptHeader?.includes("text/event-stream")) {
|
|
8236
|
+
this.onerror?.(new Error("Not Acceptable: Client must accept text/event-stream"));
|
|
8020
8237
|
return this.createJsonErrorResponse(406, -32000, "Not Acceptable: Client must accept text/event-stream");
|
|
8021
8238
|
}
|
|
8022
8239
|
const sessionError = this.validateSession(req);
|
|
@@ -8034,22 +8251,30 @@ data:
|
|
|
8034
8251
|
}
|
|
8035
8252
|
}
|
|
8036
8253
|
if (this._streamMapping.get(this._standaloneSseStreamId) !== undefined) {
|
|
8254
|
+
this.onerror?.(new Error("Conflict: Only one SSE stream is allowed per session"));
|
|
8037
8255
|
return this.createJsonErrorResponse(409, -32000, "Conflict: Only one SSE stream is allowed per session");
|
|
8038
8256
|
}
|
|
8039
8257
|
const encoder = new TextEncoder;
|
|
8040
8258
|
let streamController;
|
|
8259
|
+
let keepAliveTimer = undefined;
|
|
8041
8260
|
const readable = new ReadableStream({
|
|
8042
8261
|
start: (controller) => {
|
|
8043
8262
|
streamController = controller;
|
|
8044
8263
|
},
|
|
8045
8264
|
cancel: () => {
|
|
8046
|
-
|
|
8265
|
+
if (keepAliveTimer !== undefined) {
|
|
8266
|
+
clearInterval(keepAliveTimer);
|
|
8267
|
+
}
|
|
8268
|
+
if (this._streamMapping.get(this._standaloneSseStreamId)?.controller === streamController) {
|
|
8269
|
+
this._streamMapping.delete(this._standaloneSseStreamId);
|
|
8270
|
+
}
|
|
8047
8271
|
}
|
|
8048
8272
|
});
|
|
8049
8273
|
const headers = {
|
|
8050
8274
|
"Content-Type": "text/event-stream",
|
|
8051
8275
|
"Cache-Control": "no-cache, no-transform",
|
|
8052
|
-
Connection: "keep-alive"
|
|
8276
|
+
Connection: "keep-alive",
|
|
8277
|
+
"X-Accel-Buffering": "no"
|
|
8053
8278
|
};
|
|
8054
8279
|
if (this.sessionId !== undefined) {
|
|
8055
8280
|
headers["mcp-session-id"] = this.sessionId;
|
|
@@ -8058,16 +8283,21 @@ data:
|
|
|
8058
8283
|
controller: streamController,
|
|
8059
8284
|
encoder,
|
|
8060
8285
|
cleanup: () => {
|
|
8286
|
+
if (keepAliveTimer !== undefined) {
|
|
8287
|
+
clearInterval(keepAliveTimer);
|
|
8288
|
+
}
|
|
8061
8289
|
this._streamMapping.delete(this._standaloneSseStreamId);
|
|
8062
8290
|
try {
|
|
8063
8291
|
streamController.close();
|
|
8064
8292
|
} catch {}
|
|
8065
8293
|
}
|
|
8066
8294
|
});
|
|
8295
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
8067
8296
|
return new Response(readable, { headers });
|
|
8068
8297
|
}
|
|
8069
8298
|
async replayEvents(lastEventId) {
|
|
8070
8299
|
if (!this._eventStore) {
|
|
8300
|
+
this.onerror?.(new Error("Event store not configured"));
|
|
8071
8301
|
return this.createJsonErrorResponse(400, -32000, "Event store not configured");
|
|
8072
8302
|
}
|
|
8073
8303
|
try {
|
|
@@ -8075,29 +8305,44 @@ data:
|
|
|
8075
8305
|
if (this._eventStore.getStreamIdForEventId) {
|
|
8076
8306
|
streamId = await this._eventStore.getStreamIdForEventId(lastEventId);
|
|
8077
8307
|
if (!streamId) {
|
|
8308
|
+
this.onerror?.(new Error("Invalid event ID format"));
|
|
8078
8309
|
return this.createJsonErrorResponse(400, -32000, "Invalid event ID format");
|
|
8079
8310
|
}
|
|
8080
8311
|
if (this._streamMapping.get(streamId) !== undefined) {
|
|
8312
|
+
this.onerror?.(new Error("Conflict: Stream already has an active connection"));
|
|
8081
8313
|
return this.createJsonErrorResponse(409, -32000, "Conflict: Stream already has an active connection");
|
|
8082
8314
|
}
|
|
8083
8315
|
}
|
|
8084
8316
|
const headers = {
|
|
8085
8317
|
"Content-Type": "text/event-stream",
|
|
8086
8318
|
"Cache-Control": "no-cache, no-transform",
|
|
8087
|
-
Connection: "keep-alive"
|
|
8319
|
+
Connection: "keep-alive",
|
|
8320
|
+
"X-Accel-Buffering": "no"
|
|
8088
8321
|
};
|
|
8089
8322
|
if (this.sessionId !== undefined) {
|
|
8090
8323
|
headers["mcp-session-id"] = this.sessionId;
|
|
8091
8324
|
}
|
|
8092
8325
|
const encoder = new TextEncoder;
|
|
8093
8326
|
let streamController;
|
|
8327
|
+
let keepAliveTimer = undefined;
|
|
8328
|
+
let replayedStreamId = undefined;
|
|
8329
|
+
let cancelled = false;
|
|
8094
8330
|
const readable = new ReadableStream({
|
|
8095
8331
|
start: (controller) => {
|
|
8096
8332
|
streamController = controller;
|
|
8097
8333
|
},
|
|
8098
|
-
cancel: () => {
|
|
8334
|
+
cancel: () => {
|
|
8335
|
+
cancelled = true;
|
|
8336
|
+
if (keepAliveTimer !== undefined) {
|
|
8337
|
+
clearInterval(keepAliveTimer);
|
|
8338
|
+
}
|
|
8339
|
+
if (replayedStreamId !== undefined && this._streamMapping.get(replayedStreamId)?.controller === streamController) {
|
|
8340
|
+
this._streamMapping.delete(replayedStreamId);
|
|
8341
|
+
}
|
|
8342
|
+
}
|
|
8099
8343
|
});
|
|
8100
|
-
const
|
|
8344
|
+
const replayedEventIds = new Set;
|
|
8345
|
+
replayedStreamId = await this._eventStore.replayEventsAfter(lastEventId, {
|
|
8101
8346
|
send: async (eventId, message) => {
|
|
8102
8347
|
const success = this.writeSSEEvent(streamController, encoder, message, eventId);
|
|
8103
8348
|
if (!success) {
|
|
@@ -8105,19 +8350,34 @@ data:
|
|
|
8105
8350
|
try {
|
|
8106
8351
|
streamController.close();
|
|
8107
8352
|
} catch {}
|
|
8353
|
+
} else {
|
|
8354
|
+
replayedEventIds.add(eventId);
|
|
8108
8355
|
}
|
|
8109
8356
|
}
|
|
8110
8357
|
});
|
|
8358
|
+
if (this._closed || cancelled) {
|
|
8359
|
+
try {
|
|
8360
|
+
streamController.close();
|
|
8361
|
+
} catch {}
|
|
8362
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
8363
|
+
}
|
|
8364
|
+
this._streamMapping.get(replayedStreamId)?.cleanup();
|
|
8111
8365
|
this._streamMapping.set(replayedStreamId, {
|
|
8112
8366
|
controller: streamController,
|
|
8113
8367
|
encoder,
|
|
8368
|
+
replayedEventIds,
|
|
8114
8369
|
cleanup: () => {
|
|
8370
|
+
if (keepAliveTimer !== undefined) {
|
|
8371
|
+
clearInterval(keepAliveTimer);
|
|
8372
|
+
}
|
|
8115
8373
|
this._streamMapping.delete(replayedStreamId);
|
|
8116
8374
|
try {
|
|
8117
8375
|
streamController.close();
|
|
8118
8376
|
} catch {}
|
|
8119
8377
|
}
|
|
8120
8378
|
});
|
|
8379
|
+
this._resumableStreams.add(replayedStreamId);
|
|
8380
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
8121
8381
|
return new Response(readable, { headers });
|
|
8122
8382
|
} catch (error) {
|
|
8123
8383
|
this.onerror?.(error);
|
|
@@ -8137,11 +8397,13 @@ data:
|
|
|
8137
8397
|
`;
|
|
8138
8398
|
controller.enqueue(encoder.encode(eventData));
|
|
8139
8399
|
return true;
|
|
8140
|
-
} catch {
|
|
8400
|
+
} catch (error) {
|
|
8401
|
+
this.onerror?.(error);
|
|
8141
8402
|
return false;
|
|
8142
8403
|
}
|
|
8143
8404
|
}
|
|
8144
8405
|
handleUnsupportedRequest() {
|
|
8406
|
+
this.onerror?.(new Error("Method not allowed."));
|
|
8145
8407
|
return new Response(JSON.stringify({
|
|
8146
8408
|
jsonrpc: "2.0",
|
|
8147
8409
|
error: {
|
|
@@ -8161,25 +8423,39 @@ data:
|
|
|
8161
8423
|
try {
|
|
8162
8424
|
const acceptHeader = req.headers.get("accept");
|
|
8163
8425
|
if (!acceptHeader?.includes("application/json") || !acceptHeader.includes("text/event-stream")) {
|
|
8426
|
+
this.onerror?.(new Error("Not Acceptable: Client must accept both application/json and text/event-stream"));
|
|
8164
8427
|
return this.createJsonErrorResponse(406, -32000, "Not Acceptable: Client must accept both application/json and text/event-stream");
|
|
8165
8428
|
}
|
|
8166
8429
|
const ct = req.headers.get("content-type");
|
|
8167
|
-
if (!ct
|
|
8430
|
+
if (!isJsonContentType(ct)) {
|
|
8431
|
+
this.onerror?.(new Error("Unsupported Media Type: Content-Type must be application/json"));
|
|
8168
8432
|
return this.createJsonErrorResponse(415, -32000, "Unsupported Media Type: Content-Type must be application/json");
|
|
8169
8433
|
}
|
|
8170
8434
|
const requestInfo = {
|
|
8171
|
-
headers: Object.fromEntries(req.headers.entries())
|
|
8435
|
+
headers: Object.fromEntries(req.headers.entries()),
|
|
8436
|
+
url: new URL(req.url)
|
|
8172
8437
|
};
|
|
8173
8438
|
let rawMessage;
|
|
8174
8439
|
if (options?.parsedBody !== undefined) {
|
|
8175
8440
|
rawMessage = options.parsedBody;
|
|
8176
8441
|
} else {
|
|
8177
8442
|
try {
|
|
8178
|
-
|
|
8443
|
+
const body = await readRequestBody(req, this._maxRequestBodySize);
|
|
8444
|
+
if (body.tooLarge) {
|
|
8445
|
+
const message = requestBodyTooLargeMessage(this._maxRequestBodySize);
|
|
8446
|
+
this.onerror?.(new Error(message));
|
|
8447
|
+
return this.createJsonErrorResponse(413, -32000, message);
|
|
8448
|
+
}
|
|
8449
|
+
rawMessage = JSON.parse(body.text);
|
|
8179
8450
|
} catch {
|
|
8451
|
+
this.onerror?.(new Error("Parse error: Invalid JSON"));
|
|
8180
8452
|
return this.createJsonErrorResponse(400, -32700, "Parse error: Invalid JSON");
|
|
8181
8453
|
}
|
|
8182
8454
|
}
|
|
8455
|
+
if (Array.isArray(rawMessage) && rawMessage.length > MAX_BATCH_SIZE) {
|
|
8456
|
+
this.onerror?.(new Error(`Invalid Request: Batch must not exceed ${MAX_BATCH_SIZE} messages`));
|
|
8457
|
+
return this.createJsonErrorResponse(400, -32600, `Invalid Request: Batch must not exceed ${MAX_BATCH_SIZE} messages`);
|
|
8458
|
+
}
|
|
8183
8459
|
let messages;
|
|
8184
8460
|
try {
|
|
8185
8461
|
if (Array.isArray(rawMessage)) {
|
|
@@ -8188,14 +8464,20 @@ data:
|
|
|
8188
8464
|
messages = [JSONRPCMessageSchema.parse(rawMessage)];
|
|
8189
8465
|
}
|
|
8190
8466
|
} catch {
|
|
8467
|
+
this.onerror?.(new Error("Parse error: Invalid JSON-RPC message"));
|
|
8191
8468
|
return this.createJsonErrorResponse(400, -32700, "Parse error: Invalid JSON-RPC message");
|
|
8192
8469
|
}
|
|
8470
|
+
if (this._closed) {
|
|
8471
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
8472
|
+
}
|
|
8193
8473
|
const isInitializationRequest = messages.some(isInitializeRequest);
|
|
8194
8474
|
if (isInitializationRequest) {
|
|
8195
8475
|
if (this._initialized && this.sessionId !== undefined) {
|
|
8476
|
+
this.onerror?.(new Error("Invalid Request: Server already initialized"));
|
|
8196
8477
|
return this.createJsonErrorResponse(400, -32600, "Invalid Request: Server already initialized");
|
|
8197
8478
|
}
|
|
8198
8479
|
if (messages.length > 1) {
|
|
8480
|
+
this.onerror?.(new Error("Invalid Request: Only one initialization request is allowed"));
|
|
8199
8481
|
return this.createJsonErrorResponse(400, -32600, "Invalid Request: Only one initialization request is allowed");
|
|
8200
8482
|
}
|
|
8201
8483
|
this.sessionId = this.sessionIdGenerator?.();
|
|
@@ -8214,6 +8496,9 @@ data:
|
|
|
8214
8496
|
return protocolError;
|
|
8215
8497
|
}
|
|
8216
8498
|
}
|
|
8499
|
+
if (this._closed) {
|
|
8500
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
8501
|
+
}
|
|
8217
8502
|
const hasRequests = messages.some(isJSONRPCRequest);
|
|
8218
8503
|
if (!hasRequests) {
|
|
8219
8504
|
for (const message of messages) {
|
|
@@ -8244,18 +8529,25 @@ data:
|
|
|
8244
8529
|
}
|
|
8245
8530
|
const encoder = new TextEncoder;
|
|
8246
8531
|
let streamController;
|
|
8532
|
+
let keepAliveTimer = undefined;
|
|
8247
8533
|
const readable = new ReadableStream({
|
|
8248
8534
|
start: (controller) => {
|
|
8249
8535
|
streamController = controller;
|
|
8250
8536
|
},
|
|
8251
8537
|
cancel: () => {
|
|
8252
|
-
|
|
8538
|
+
if (keepAliveTimer !== undefined) {
|
|
8539
|
+
clearInterval(keepAliveTimer);
|
|
8540
|
+
}
|
|
8541
|
+
if (this._streamMapping.get(streamId)?.controller === streamController) {
|
|
8542
|
+
this._streamMapping.delete(streamId);
|
|
8543
|
+
}
|
|
8253
8544
|
}
|
|
8254
8545
|
});
|
|
8255
8546
|
const headers = {
|
|
8256
8547
|
"Content-Type": "text/event-stream",
|
|
8257
|
-
"Cache-Control": "no-cache",
|
|
8258
|
-
Connection: "keep-alive"
|
|
8548
|
+
"Cache-Control": "no-cache, no-transform",
|
|
8549
|
+
Connection: "keep-alive",
|
|
8550
|
+
"X-Accel-Buffering": "no"
|
|
8259
8551
|
};
|
|
8260
8552
|
if (this.sessionId !== undefined) {
|
|
8261
8553
|
headers["mcp-session-id"] = this.sessionId;
|
|
@@ -8266,6 +8558,9 @@ data:
|
|
|
8266
8558
|
controller: streamController,
|
|
8267
8559
|
encoder,
|
|
8268
8560
|
cleanup: () => {
|
|
8561
|
+
if (keepAliveTimer !== undefined) {
|
|
8562
|
+
clearInterval(keepAliveTimer);
|
|
8563
|
+
}
|
|
8269
8564
|
this._streamMapping.delete(streamId);
|
|
8270
8565
|
try {
|
|
8271
8566
|
streamController.close();
|
|
@@ -8275,19 +8570,33 @@ data:
|
|
|
8275
8570
|
this._requestToStreamMapping.set(message.id, streamId);
|
|
8276
8571
|
}
|
|
8277
8572
|
}
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8573
|
+
try {
|
|
8574
|
+
await this.writePrimingEvent(streamController, encoder, streamId, clientProtocolVersion);
|
|
8575
|
+
for (const message of messages) {
|
|
8576
|
+
let closeSSEStream;
|
|
8577
|
+
let closeStandaloneSSEStream;
|
|
8578
|
+
if (isJSONRPCRequest(message) && this._eventStore && clientProtocolVersion >= "2025-11-25") {
|
|
8579
|
+
closeSSEStream = () => {
|
|
8580
|
+
this.closeSSEStream(message.id);
|
|
8581
|
+
};
|
|
8582
|
+
closeStandaloneSSEStream = () => {
|
|
8583
|
+
this.closeStandaloneSSEStream();
|
|
8584
|
+
};
|
|
8585
|
+
}
|
|
8586
|
+
this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo, closeSSEStream, closeStandaloneSSEStream });
|
|
8289
8587
|
}
|
|
8290
|
-
|
|
8588
|
+
} catch (error) {
|
|
8589
|
+
this._streamMapping.get(streamId)?.cleanup();
|
|
8590
|
+
this._resumableStreams.delete(streamId);
|
|
8591
|
+
for (const message of messages) {
|
|
8592
|
+
if (isJSONRPCRequest(message)) {
|
|
8593
|
+
this._requestToStreamMapping.delete(message.id);
|
|
8594
|
+
}
|
|
8595
|
+
}
|
|
8596
|
+
throw error;
|
|
8597
|
+
}
|
|
8598
|
+
if (this._streamMapping.get(streamId)?.controller === streamController) {
|
|
8599
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
8291
8600
|
}
|
|
8292
8601
|
return new Response(readable, { status: 200, headers });
|
|
8293
8602
|
} catch (error) {
|
|
@@ -8304,22 +8613,28 @@ data:
|
|
|
8304
8613
|
if (protocolError) {
|
|
8305
8614
|
return protocolError;
|
|
8306
8615
|
}
|
|
8307
|
-
|
|
8308
|
-
|
|
8309
|
-
|
|
8616
|
+
try {
|
|
8617
|
+
await Promise.resolve(this._onsessionclosed?.(this.sessionId));
|
|
8618
|
+
return new Response(null, { status: 200 });
|
|
8619
|
+
} finally {
|
|
8620
|
+
await this.close();
|
|
8621
|
+
}
|
|
8310
8622
|
}
|
|
8311
8623
|
validateSession(req) {
|
|
8312
8624
|
if (this.sessionIdGenerator === undefined) {
|
|
8313
8625
|
return;
|
|
8314
8626
|
}
|
|
8315
8627
|
if (!this._initialized) {
|
|
8628
|
+
this.onerror?.(new Error("Bad Request: Server not initialized"));
|
|
8316
8629
|
return this.createJsonErrorResponse(400, -32000, "Bad Request: Server not initialized");
|
|
8317
8630
|
}
|
|
8318
8631
|
const sessionId = req.headers.get("mcp-session-id");
|
|
8319
8632
|
if (!sessionId) {
|
|
8633
|
+
this.onerror?.(new Error("Bad Request: Mcp-Session-Id header is required"));
|
|
8320
8634
|
return this.createJsonErrorResponse(400, -32000, "Bad Request: Mcp-Session-Id header is required");
|
|
8321
8635
|
}
|
|
8322
8636
|
if (sessionId !== this.sessionId) {
|
|
8637
|
+
this.onerror?.(new Error("Session not found"));
|
|
8323
8638
|
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
8324
8639
|
}
|
|
8325
8640
|
return;
|
|
@@ -8327,16 +8642,22 @@ data:
|
|
|
8327
8642
|
validateProtocolVersion(req) {
|
|
8328
8643
|
const protocolVersion = req.headers.get("mcp-protocol-version");
|
|
8329
8644
|
if (protocolVersion !== null && !SUPPORTED_PROTOCOL_VERSIONS.includes(protocolVersion)) {
|
|
8645
|
+
this.onerror?.(new Error(`Bad Request: Unsupported protocol version: ${protocolVersion}` + ` (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(", ")})`));
|
|
8330
8646
|
return this.createJsonErrorResponse(400, -32000, `Bad Request: Unsupported protocol version: ${protocolVersion} (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(", ")})`);
|
|
8331
8647
|
}
|
|
8332
8648
|
return;
|
|
8333
8649
|
}
|
|
8334
8650
|
async close() {
|
|
8651
|
+
if (this._closed) {
|
|
8652
|
+
return;
|
|
8653
|
+
}
|
|
8654
|
+
this._closed = true;
|
|
8335
8655
|
this._streamMapping.forEach(({ cleanup }) => {
|
|
8336
8656
|
cleanup();
|
|
8337
8657
|
});
|
|
8338
8658
|
this._streamMapping.clear();
|
|
8339
8659
|
this._requestResponseMap.clear();
|
|
8660
|
+
this._resumableStreams.clear();
|
|
8340
8661
|
this.onclose?.();
|
|
8341
8662
|
}
|
|
8342
8663
|
closeSSEStream(requestId) {
|
|
@@ -8371,7 +8692,7 @@ data:
|
|
|
8371
8692
|
if (standaloneSse === undefined) {
|
|
8372
8693
|
return;
|
|
8373
8694
|
}
|
|
8374
|
-
if (standaloneSse.controller && standaloneSse.encoder) {
|
|
8695
|
+
if (standaloneSse.controller && standaloneSse.encoder && (eventId === undefined || !standaloneSse.replayedEventIds?.has(eventId))) {
|
|
8375
8696
|
this.writeSSEEvent(standaloneSse.controller, standaloneSse.encoder, message, eventId);
|
|
8376
8697
|
}
|
|
8377
8698
|
return;
|
|
@@ -8380,13 +8701,19 @@ data:
|
|
|
8380
8701
|
if (!streamId) {
|
|
8381
8702
|
throw new Error(`No connection established for request ID: ${String(requestId)}`);
|
|
8382
8703
|
}
|
|
8383
|
-
|
|
8384
|
-
if (!this._enableJsonResponse
|
|
8704
|
+
let stream = this._streamMapping.get(streamId);
|
|
8705
|
+
if (!this._enableJsonResponse) {
|
|
8385
8706
|
let eventId;
|
|
8386
8707
|
if (this._eventStore) {
|
|
8387
8708
|
eventId = await this._eventStore.storeEvent(streamId, message);
|
|
8709
|
+
stream = this._streamMapping.get(streamId);
|
|
8710
|
+
}
|
|
8711
|
+
if (stream?.controller && stream?.encoder && (eventId === undefined || !stream.replayedEventIds?.has(eventId))) {
|
|
8712
|
+
const written = this.writeSSEEvent(stream.controller, stream.encoder, message, eventId);
|
|
8713
|
+
if (written && eventId !== undefined) {
|
|
8714
|
+
this._resumableStreams.add(streamId);
|
|
8715
|
+
}
|
|
8388
8716
|
}
|
|
8389
|
-
this.writeSSEEvent(stream.controller, stream.encoder, message, eventId);
|
|
8390
8717
|
}
|
|
8391
8718
|
if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) {
|
|
8392
8719
|
this._requestResponseMap.set(requestId, message);
|
|
@@ -8394,6 +8721,25 @@ data:
|
|
|
8394
8721
|
const allResponsesReady = relatedIds.every((id) => this._requestResponseMap.has(id));
|
|
8395
8722
|
if (allResponsesReady) {
|
|
8396
8723
|
if (!stream) {
|
|
8724
|
+
if (this._closed) {
|
|
8725
|
+
for (const id of relatedIds) {
|
|
8726
|
+
this._requestResponseMap.delete(id);
|
|
8727
|
+
this._requestToStreamMapping.delete(id);
|
|
8728
|
+
}
|
|
8729
|
+
return;
|
|
8730
|
+
}
|
|
8731
|
+
if (!this._enableJsonResponse && this._eventStore && this._resumableStreams.has(streamId)) {
|
|
8732
|
+
for (const id of relatedIds) {
|
|
8733
|
+
this._requestResponseMap.delete(id);
|
|
8734
|
+
this._requestToStreamMapping.delete(id);
|
|
8735
|
+
}
|
|
8736
|
+
this._resumableStreams.delete(streamId);
|
|
8737
|
+
return;
|
|
8738
|
+
}
|
|
8739
|
+
for (const id of relatedIds) {
|
|
8740
|
+
this._requestResponseMap.delete(id);
|
|
8741
|
+
this._requestToStreamMapping.delete(id);
|
|
8742
|
+
}
|
|
8397
8743
|
throw new Error(`No connection established for request ID: ${String(requestId)}`);
|
|
8398
8744
|
}
|
|
8399
8745
|
if (this._enableJsonResponse && stream.resolveJson) {
|
|
@@ -8416,11 +8762,15 @@ data:
|
|
|
8416
8762
|
this._requestResponseMap.delete(id);
|
|
8417
8763
|
this._requestToStreamMapping.delete(id);
|
|
8418
8764
|
}
|
|
8765
|
+
this._resumableStreams.delete(streamId);
|
|
8419
8766
|
}
|
|
8420
8767
|
}
|
|
8421
8768
|
}
|
|
8422
8769
|
}
|
|
8423
8770
|
var init_webStandardStreamableHttp = __esm(() => {
|
|
8771
|
+
init_mediaType();
|
|
8772
|
+
init_requestBody();
|
|
8773
|
+
init_sseKeepAlive();
|
|
8424
8774
|
init_types();
|
|
8425
8775
|
});
|
|
8426
8776
|
|
|
@@ -25872,6 +26222,17 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
25872
26222
|
var setMaxIndex = function setMaxIndex(obj, maxIndex) {
|
|
25873
26223
|
overflowChannel.set(obj, maxIndex);
|
|
25874
26224
|
};
|
|
26225
|
+
var conflictChannel = getSideChannel();
|
|
26226
|
+
var markConflict = function markConflict(obj, maxIndex) {
|
|
26227
|
+
conflictChannel.set(obj, maxIndex);
|
|
26228
|
+
return obj;
|
|
26229
|
+
};
|
|
26230
|
+
var isConflict = function isConflict(obj) {
|
|
26231
|
+
return conflictChannel.has(obj);
|
|
26232
|
+
};
|
|
26233
|
+
var getConflictIndex = function getConflictIndex(obj) {
|
|
26234
|
+
return conflictChannel.get(obj);
|
|
26235
|
+
};
|
|
25875
26236
|
var hexTable = function() {
|
|
25876
26237
|
var array = [];
|
|
25877
26238
|
for (var i = 0;i < 256; ++i) {
|
|
@@ -25915,6 +26276,27 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
25915
26276
|
obj[key] = value;
|
|
25916
26277
|
}
|
|
25917
26278
|
};
|
|
26279
|
+
var maxNumericIndex = function maxNumericIndex(obj, min) {
|
|
26280
|
+
var max = min;
|
|
26281
|
+
var keys = Object.keys(obj);
|
|
26282
|
+
for (var i = 0;i < keys.length; ++i) {
|
|
26283
|
+
var num = parseInt(keys[i], 10);
|
|
26284
|
+
if (String(num) === keys[i] && num > max) {
|
|
26285
|
+
max = num;
|
|
26286
|
+
}
|
|
26287
|
+
}
|
|
26288
|
+
return max;
|
|
26289
|
+
};
|
|
26290
|
+
var limitedPair = function limitedPair(first, second, options) {
|
|
26291
|
+
var pair = [first, second];
|
|
26292
|
+
if (options && typeof options.arrayLimit === "number" && pair.length > options.arrayLimit) {
|
|
26293
|
+
if (options.throwOnLimitExceeded) {
|
|
26294
|
+
throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
26295
|
+
}
|
|
26296
|
+
return markOverflow(arrayToObject(pair, options), 1);
|
|
26297
|
+
}
|
|
26298
|
+
return pair;
|
|
26299
|
+
};
|
|
25918
26300
|
var merge = function merge(target, source, options) {
|
|
25919
26301
|
if (!source) {
|
|
25920
26302
|
return target;
|
|
@@ -25934,13 +26316,21 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
25934
26316
|
var newIndex = getMaxIndex(target) + 1;
|
|
25935
26317
|
target[newIndex] = source;
|
|
25936
26318
|
setMaxIndex(target, newIndex);
|
|
26319
|
+
} else if (options && options.strictMerge && isConflict(target)) {
|
|
26320
|
+
var nextConflict = getConflictIndex(target) + 1;
|
|
26321
|
+
if (options.throwOnLimitExceeded && typeof options.arrayLimit === "number" && nextConflict >= options.arrayLimit) {
|
|
26322
|
+
throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
26323
|
+
}
|
|
26324
|
+
target[nextConflict] = source;
|
|
26325
|
+
markConflict(target, nextConflict);
|
|
25937
26326
|
} else if (options && options.strictMerge) {
|
|
25938
|
-
|
|
26327
|
+
var conflict = limitedPair(target, source, options);
|
|
26328
|
+
return isArray(conflict) ? markConflict(conflict, 1) : conflict;
|
|
25939
26329
|
} else if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) {
|
|
25940
26330
|
target[source] = true;
|
|
25941
26331
|
}
|
|
25942
26332
|
} else {
|
|
25943
|
-
return
|
|
26333
|
+
return limitedPair(target, source, options);
|
|
25944
26334
|
}
|
|
25945
26335
|
return target;
|
|
25946
26336
|
}
|
|
@@ -25966,6 +26356,9 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
25966
26356
|
var mergeTarget = target;
|
|
25967
26357
|
if (isArray(target) && !isArray(source)) {
|
|
25968
26358
|
mergeTarget = arrayToObject(target, options);
|
|
26359
|
+
if (isConflict(target)) {
|
|
26360
|
+
markConflict(mergeTarget, target.length - 1);
|
|
26361
|
+
}
|
|
25969
26362
|
}
|
|
25970
26363
|
if (isArray(target) && isArray(source)) {
|
|
25971
26364
|
source.forEach(function(item, i) {
|
|
@@ -25996,7 +26389,7 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
25996
26389
|
setProperty(acc, key, value);
|
|
25997
26390
|
}
|
|
25998
26391
|
if (isOverflow(source) && !isOverflow(acc)) {
|
|
25999
|
-
markOverflow(acc, getMaxIndex(source));
|
|
26392
|
+
markOverflow(acc, maxNumericIndex(acc, getMaxIndex(source)));
|
|
26000
26393
|
}
|
|
26001
26394
|
if (isOverflow(acc)) {
|
|
26002
26395
|
var keyNum = parseInt(key, 10);
|
|
@@ -26004,6 +26397,12 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
26004
26397
|
setMaxIndex(acc, keyNum);
|
|
26005
26398
|
}
|
|
26006
26399
|
}
|
|
26400
|
+
if (isConflict(acc)) {
|
|
26401
|
+
var conflictKey = parseInt(key, 10);
|
|
26402
|
+
if (String(conflictKey) === key && conflictKey > getConflictIndex(acc)) {
|
|
26403
|
+
markConflict(acc, conflictKey);
|
|
26404
|
+
}
|
|
26405
|
+
}
|
|
26007
26406
|
return acc;
|
|
26008
26407
|
}, mergeTarget);
|
|
26009
26408
|
};
|
|
@@ -26014,6 +26413,9 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
26014
26413
|
}, target);
|
|
26015
26414
|
};
|
|
26016
26415
|
var decode = function(str, defaultDecoder, charset) {
|
|
26416
|
+
if (typeof str === "string" && str.indexOf("%") === -1) {
|
|
26417
|
+
return str.indexOf("+") === -1 ? str : str.replace(/\+/g, " ");
|
|
26418
|
+
}
|
|
26017
26419
|
var strWithoutPlus = str.replace(/\+/g, " ");
|
|
26018
26420
|
if (charset === "iso-8859-1") {
|
|
26019
26421
|
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
@@ -26024,6 +26426,52 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
26024
26426
|
return strWithoutPlus;
|
|
26025
26427
|
}
|
|
26026
26428
|
};
|
|
26429
|
+
var hasToPrimitive = typeof Symbol === "function" && typeof Symbol.toPrimitive === "symbol";
|
|
26430
|
+
var arrayJoin = Array.prototype.join;
|
|
26431
|
+
var arrayToString = Array.prototype.toString;
|
|
26432
|
+
var objectToString = Object.prototype.toString;
|
|
26433
|
+
var toCoercible = function toCoercible(value, joining) {
|
|
26434
|
+
if (!value || typeof value !== "object" && typeof value !== "function") {
|
|
26435
|
+
return value;
|
|
26436
|
+
}
|
|
26437
|
+
if (hasToPrimitive && value[Symbol.toPrimitive] != null) {
|
|
26438
|
+
return value;
|
|
26439
|
+
}
|
|
26440
|
+
if (isArray(value) && value.toString === arrayToString && value.join === arrayJoin) {
|
|
26441
|
+
var ancestors = joining || getSideChannel();
|
|
26442
|
+
if (ancestors.has(value)) {
|
|
26443
|
+
return "";
|
|
26444
|
+
}
|
|
26445
|
+
ancestors.set(value, true);
|
|
26446
|
+
var copy;
|
|
26447
|
+
for (var i = 0;i < value.length; i += 1) {
|
|
26448
|
+
var item = value[i];
|
|
26449
|
+
var coerced = toCoercible(item, ancestors);
|
|
26450
|
+
if (!copy && coerced !== item) {
|
|
26451
|
+
copy = [];
|
|
26452
|
+
for (var j = 0;j < i; j += 1) {
|
|
26453
|
+
copy[j] = value[j];
|
|
26454
|
+
}
|
|
26455
|
+
}
|
|
26456
|
+
if (copy) {
|
|
26457
|
+
copy[i] = coerced;
|
|
26458
|
+
}
|
|
26459
|
+
}
|
|
26460
|
+
ancestors["delete"](value);
|
|
26461
|
+
return copy || value;
|
|
26462
|
+
}
|
|
26463
|
+
if (typeof value.toString === "function") {
|
|
26464
|
+
return value;
|
|
26465
|
+
}
|
|
26466
|
+
var valueOf = value.valueOf;
|
|
26467
|
+
if (typeof valueOf === "function") {
|
|
26468
|
+
var primitive = valueOf.call(value);
|
|
26469
|
+
if (!primitive || typeof primitive !== "object" && typeof primitive !== "function") {
|
|
26470
|
+
return String(primitive);
|
|
26471
|
+
}
|
|
26472
|
+
}
|
|
26473
|
+
return objectToString.call(value);
|
|
26474
|
+
};
|
|
26027
26475
|
var limit = 1024;
|
|
26028
26476
|
var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
|
26029
26477
|
if (str.length === 0) {
|
|
@@ -26033,12 +26481,12 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
26033
26481
|
if (typeof str === "symbol") {
|
|
26034
26482
|
string = Symbol.prototype.toString.call(str);
|
|
26035
26483
|
} else if (typeof str !== "string") {
|
|
26036
|
-
string = String(str);
|
|
26484
|
+
string = String(toCoercible(str));
|
|
26037
26485
|
}
|
|
26038
26486
|
if (charset === "iso-8859-1") {
|
|
26039
26487
|
return escape(string).replace(/%u[0-9a-f]{4}/gi, function($0) {
|
|
26040
26488
|
return "%26%23" + parseInt($0.slice(2), 16) + "%3B";
|
|
26041
|
-
});
|
|
26489
|
+
}).replace(/\+/g, "%2B");
|
|
26042
26490
|
}
|
|
26043
26491
|
var out = "";
|
|
26044
26492
|
for (var j = 0;j < string.length; j += limit) {
|
|
@@ -26150,7 +26598,8 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
26150
26598
|
isRegExp,
|
|
26151
26599
|
markOverflow,
|
|
26152
26600
|
maybeMap,
|
|
26153
|
-
merge
|
|
26601
|
+
merge,
|
|
26602
|
+
toCoercible
|
|
26154
26603
|
};
|
|
26155
26604
|
});
|
|
26156
26605
|
|
|
@@ -26261,17 +26710,17 @@ var require_stringify = __commonJS(function(exports, module) {
|
|
|
26261
26710
|
if (generateArrayPrefix === "comma" && isArray(obj)) {
|
|
26262
26711
|
if (encodeValuesOnly && encoder) {
|
|
26263
26712
|
obj = utils.maybeMap(obj, function(v) {
|
|
26264
|
-
return v == null ? v : encoder(v);
|
|
26713
|
+
return v == null ? v : encoder(v, defaults.encoder, charset, "value", format);
|
|
26265
26714
|
});
|
|
26266
26715
|
}
|
|
26267
|
-
objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : undefined }];
|
|
26716
|
+
objKeys = [{ value: obj.length > 0 ? utils.toCoercible(obj).join(",") || null : undefined }];
|
|
26268
26717
|
} else if (isArray(filter)) {
|
|
26269
26718
|
objKeys = filter;
|
|
26270
26719
|
} else {
|
|
26271
26720
|
var keys = Object.keys(obj);
|
|
26272
26721
|
objKeys = sort ? keys.sort(sort) : keys;
|
|
26273
26722
|
}
|
|
26274
|
-
var encodedPrefix =
|
|
26723
|
+
var encodedPrefix = String(prefix);
|
|
26275
26724
|
var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix;
|
|
26276
26725
|
if (allowEmptyArrays && isArray(obj) && obj.length === 0 && Object.keys(obj).length === 0) {
|
|
26277
26726
|
return adjustedPrefix + "[]";
|
|
@@ -26321,7 +26770,7 @@ var require_stringify = __commonJS(function(exports, module) {
|
|
|
26321
26770
|
filter = opts.filter;
|
|
26322
26771
|
}
|
|
26323
26772
|
var arrayFormat;
|
|
26324
|
-
if (opts.arrayFormat
|
|
26773
|
+
if (has.call(arrayPrefixGenerators, opts.arrayFormat)) {
|
|
26325
26774
|
arrayFormat = opts.arrayFormat;
|
|
26326
26775
|
} else if ("indices" in opts) {
|
|
26327
26776
|
arrayFormat = opts.indices ? "indices" : "repeat";
|
|
@@ -26407,9 +26856,53 @@ var require_stringify = __commonJS(function(exports, module) {
|
|
|
26407
26856
|
|
|
26408
26857
|
// node_modules/qs/lib/parse.js
|
|
26409
26858
|
var require_parse = __commonJS(function(exports, module) {
|
|
26859
|
+
var getSideChannel = require_side_channel();
|
|
26410
26860
|
var utils = require_utils2();
|
|
26411
26861
|
var has = Object.prototype.hasOwnProperty;
|
|
26412
26862
|
var isArray = Array.isArray;
|
|
26863
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
|
26864
|
+
var isPlainContainer = function isPlainContainer(value) {
|
|
26865
|
+
if (!value || typeof value !== "object") {
|
|
26866
|
+
return false;
|
|
26867
|
+
}
|
|
26868
|
+
if (isArray(value)) {
|
|
26869
|
+
return true;
|
|
26870
|
+
}
|
|
26871
|
+
var proto = getPrototypeOf(value);
|
|
26872
|
+
return proto === Object.prototype || proto === null;
|
|
26873
|
+
};
|
|
26874
|
+
var emptyCopyOf = function emptyCopyOf(value) {
|
|
26875
|
+
if (isArray(value)) {
|
|
26876
|
+
var arr = [];
|
|
26877
|
+
arr.length = value.length;
|
|
26878
|
+
return arr;
|
|
26879
|
+
}
|
|
26880
|
+
return getPrototypeOf(value) === null ? { __proto__: null } : {};
|
|
26881
|
+
};
|
|
26882
|
+
var copyInput = function copyInput(input) {
|
|
26883
|
+
var copies = getSideChannel();
|
|
26884
|
+
var result = {};
|
|
26885
|
+
var queue = [{ source: input, target: result }];
|
|
26886
|
+
for (var i = 0;i < queue.length; ++i) {
|
|
26887
|
+
var source = queue[i].source;
|
|
26888
|
+
var target = queue[i].target;
|
|
26889
|
+
var keys = Object.keys(source);
|
|
26890
|
+
for (var j = 0;j < keys.length; ++j) {
|
|
26891
|
+
var value = source[keys[j]];
|
|
26892
|
+
if (isPlainContainer(value)) {
|
|
26893
|
+
if (!copies.has(value)) {
|
|
26894
|
+
var copy = emptyCopyOf(value);
|
|
26895
|
+
copies.set(value, copy);
|
|
26896
|
+
queue[queue.length] = { source: value, target: copy };
|
|
26897
|
+
}
|
|
26898
|
+
target[keys[j]] = copies.get(value);
|
|
26899
|
+
} else {
|
|
26900
|
+
target[keys[j]] = value;
|
|
26901
|
+
}
|
|
26902
|
+
}
|
|
26903
|
+
}
|
|
26904
|
+
return result;
|
|
26905
|
+
};
|
|
26413
26906
|
var defaults = {
|
|
26414
26907
|
allowDots: false,
|
|
26415
26908
|
allowEmptyArrays: false,
|
|
@@ -26493,6 +26986,7 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
26493
26986
|
var part = parts[i];
|
|
26494
26987
|
var bracketEqualsPos = part.indexOf("]=");
|
|
26495
26988
|
var pos = bracketEqualsPos === -1 ? part.indexOf("=") : bracketEqualsPos + 1;
|
|
26989
|
+
var isEmptyBracketKey = pos > 1 && part.slice(pos - 2, pos) === "[]";
|
|
26496
26990
|
var key;
|
|
26497
26991
|
var val;
|
|
26498
26992
|
if (pos === -1) {
|
|
@@ -26509,7 +27003,7 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
26509
27003
|
if (val && options.interpretNumericEntities && charset === "iso-8859-1") {
|
|
26510
27004
|
val = interpretNumericEntities(String(val));
|
|
26511
27005
|
}
|
|
26512
|
-
if (
|
|
27006
|
+
if (isEmptyBracketKey) {
|
|
26513
27007
|
val = isArray(val) ? [val] : val;
|
|
26514
27008
|
}
|
|
26515
27009
|
if (options.comma && isArray(val) && val.length > options.arrayLimit) {
|
|
@@ -26517,7 +27011,7 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
26517
27011
|
}
|
|
26518
27012
|
if (key !== null) {
|
|
26519
27013
|
var existing = has.call(obj, key);
|
|
26520
|
-
if (existing && (options.duplicates === "combine" ||
|
|
27014
|
+
if (existing && (options.duplicates === "combine" || isEmptyBracketKey)) {
|
|
26521
27015
|
obj[key] = utils.combine(obj[key], val, options.arrayLimit, options.plainObjects, options.throwOnLimitExceeded);
|
|
26522
27016
|
} else if (!existing || options.duplicates === "last") {
|
|
26523
27017
|
obj[key] = val;
|
|
@@ -26566,8 +27060,35 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
26566
27060
|
}
|
|
26567
27061
|
return leaf;
|
|
26568
27062
|
};
|
|
27063
|
+
var topLevelDotsToBrackets = function topLevelDotsToBrackets(key) {
|
|
27064
|
+
var result = "";
|
|
27065
|
+
var depth = 0;
|
|
27066
|
+
for (var i = 0;i < key.length; i += 1) {
|
|
27067
|
+
var cu = key.charCodeAt(i);
|
|
27068
|
+
if (cu === 91) {
|
|
27069
|
+
depth += 1;
|
|
27070
|
+
result += "[";
|
|
27071
|
+
} else if (cu === 93) {
|
|
27072
|
+
if (depth > 0) {
|
|
27073
|
+
depth -= 1;
|
|
27074
|
+
}
|
|
27075
|
+
result += "]";
|
|
27076
|
+
} else if (cu === 46 && depth === 0 && i + 1 < key.length && key.charCodeAt(i + 1) !== 46 && key.charCodeAt(i + 1) !== 91) {
|
|
27077
|
+
var start = i + 1;
|
|
27078
|
+
var j = start;
|
|
27079
|
+
while (j < key.length && key.charCodeAt(j) !== 46 && key.charCodeAt(j) !== 91) {
|
|
27080
|
+
j += 1;
|
|
27081
|
+
}
|
|
27082
|
+
result += "[" + key.slice(start, j) + "]";
|
|
27083
|
+
i = j - 1;
|
|
27084
|
+
} else {
|
|
27085
|
+
result += key.charAt(i);
|
|
27086
|
+
}
|
|
27087
|
+
}
|
|
27088
|
+
return result;
|
|
27089
|
+
};
|
|
26569
27090
|
var splitKeyIntoSegments = function splitKeyIntoSegments(originalKey, options) {
|
|
26570
|
-
var key = options.allowDots ? originalKey
|
|
27091
|
+
var key = options.allowDots ? topLevelDotsToBrackets(originalKey) : originalKey;
|
|
26571
27092
|
if (options.depth <= 0) {
|
|
26572
27093
|
if (!options.plainObjects && has.call(Object.prototype, key)) {
|
|
26573
27094
|
if (!options.allowPrototypes) {
|
|
@@ -26692,7 +27213,7 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
26692
27213
|
if (str === "" || str === null || typeof str === "undefined") {
|
|
26693
27214
|
return options.plainObjects ? { __proto__: null } : {};
|
|
26694
27215
|
}
|
|
26695
|
-
var tempObj = typeof str === "string" ? parseValues(str, options) : str;
|
|
27216
|
+
var tempObj = typeof str === "string" ? parseValues(str, options) : copyInput(str);
|
|
26696
27217
|
var obj = options.plainObjects ? { __proto__: null } : {};
|
|
26697
27218
|
var keys = Object.keys(tempObj);
|
|
26698
27219
|
for (var i = 0;i < keys.length; ++i) {
|
|
@@ -27233,109 +27754,144 @@ var require_view = __commonJS(function(exports, module) {
|
|
|
27233
27754
|
}
|
|
27234
27755
|
});
|
|
27235
27756
|
|
|
27236
|
-
// node_modules/content-type/index.js
|
|
27237
|
-
var
|
|
27757
|
+
// node_modules/express/node_modules/content-type/dist/index.js
|
|
27758
|
+
var require_dist3 = __commonJS(function(exports) {
|
|
27238
27759
|
/*!
|
|
27239
27760
|
* content-type
|
|
27240
27761
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
27241
27762
|
* MIT Licensed
|
|
27242
27763
|
*/
|
|
27243
|
-
|
|
27244
|
-
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
|
|
27245
|
-
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
27246
|
-
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
27247
|
-
var QUOTE_REGEXP = /([\\"])/g;
|
|
27248
|
-
var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
27764
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27249
27765
|
exports.format = format;
|
|
27250
27766
|
exports.parse = parse;
|
|
27767
|
+
var TEXT_REGEXP = /^[\u0009\u0020-\u007e\u0080-\u00ff]*$/;
|
|
27768
|
+
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
27769
|
+
var QUOTE_REGEXP = /[\\"]/g;
|
|
27770
|
+
var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
27771
|
+
var NullObject = /* @__PURE__ */ (() => {
|
|
27772
|
+
const C = function() {};
|
|
27773
|
+
C.prototype = Object.create(null);
|
|
27774
|
+
return C;
|
|
27775
|
+
})();
|
|
27251
27776
|
function format(obj) {
|
|
27252
|
-
|
|
27253
|
-
throw new TypeError("argument obj is required");
|
|
27254
|
-
}
|
|
27255
|
-
var parameters = obj.parameters;
|
|
27256
|
-
var type = obj.type;
|
|
27777
|
+
const { type, parameters } = obj;
|
|
27257
27778
|
if (!type || !TYPE_REGEXP.test(type)) {
|
|
27258
|
-
throw new TypeError(
|
|
27779
|
+
throw new TypeError(`Invalid type: ${type}`);
|
|
27259
27780
|
}
|
|
27260
|
-
|
|
27261
|
-
if (parameters
|
|
27262
|
-
|
|
27263
|
-
var params = Object.keys(parameters).sort();
|
|
27264
|
-
for (var i = 0;i < params.length; i++) {
|
|
27265
|
-
param = params[i];
|
|
27781
|
+
let result = type;
|
|
27782
|
+
if (parameters) {
|
|
27783
|
+
for (const param of Object.keys(parameters)) {
|
|
27266
27784
|
if (!TOKEN_REGEXP.test(param)) {
|
|
27267
|
-
throw new TypeError(
|
|
27785
|
+
throw new TypeError(`Invalid parameter name: ${param}`);
|
|
27268
27786
|
}
|
|
27269
|
-
|
|
27787
|
+
result += `; ${param}=${qstring(parameters[param])}`;
|
|
27270
27788
|
}
|
|
27271
27789
|
}
|
|
27272
|
-
return
|
|
27790
|
+
return result;
|
|
27273
27791
|
}
|
|
27274
|
-
function parse(
|
|
27275
|
-
|
|
27276
|
-
|
|
27277
|
-
|
|
27278
|
-
|
|
27279
|
-
|
|
27280
|
-
|
|
27281
|
-
|
|
27282
|
-
|
|
27283
|
-
|
|
27284
|
-
if (!TYPE_REGEXP.test(type)) {
|
|
27285
|
-
throw new TypeError("invalid media type");
|
|
27792
|
+
function parse(header, options) {
|
|
27793
|
+
const stopChar = options?.comma === true ? COMMA : 65536;
|
|
27794
|
+
const len = header.length;
|
|
27795
|
+
let index = skipOWS(header, options?.start ?? 0, len);
|
|
27796
|
+
const valueStart = index;
|
|
27797
|
+
index = skipValue(header, index, len, stopChar);
|
|
27798
|
+
const valueEnd = trailingOWS(header, valueStart, index);
|
|
27799
|
+
const type = header.slice(valueStart, valueEnd).toLowerCase();
|
|
27800
|
+
if (options?.parameters === false) {
|
|
27801
|
+
return { type, index, parameters: new NullObject };
|
|
27286
27802
|
}
|
|
27287
|
-
|
|
27288
|
-
|
|
27289
|
-
|
|
27290
|
-
|
|
27291
|
-
|
|
27292
|
-
|
|
27293
|
-
|
|
27294
|
-
|
|
27295
|
-
|
|
27296
|
-
|
|
27297
|
-
|
|
27298
|
-
|
|
27299
|
-
|
|
27300
|
-
if (
|
|
27301
|
-
|
|
27302
|
-
|
|
27303
|
-
|
|
27803
|
+
return parseParameters(header, type, index, len, stopChar);
|
|
27804
|
+
}
|
|
27805
|
+
var SP = 32;
|
|
27806
|
+
var HTAB = 9;
|
|
27807
|
+
var SEMI = 59;
|
|
27808
|
+
var EQ = 61;
|
|
27809
|
+
var DQUOTE = 34;
|
|
27810
|
+
var BSLASH = 92;
|
|
27811
|
+
var COMMA = 44;
|
|
27812
|
+
function parseParameters(header, type, index, len, stopChar) {
|
|
27813
|
+
const parameters = new NullObject;
|
|
27814
|
+
parameter:
|
|
27815
|
+
while (index < len) {
|
|
27816
|
+
if (header.charCodeAt(index) === stopChar)
|
|
27817
|
+
break;
|
|
27818
|
+
index = skipOWS(header, index + 1, len);
|
|
27819
|
+
const keyStart = index;
|
|
27820
|
+
while (index < len) {
|
|
27821
|
+
const code = header.charCodeAt(index);
|
|
27822
|
+
if (code === stopChar)
|
|
27823
|
+
break parameter;
|
|
27824
|
+
if (code === SEMI)
|
|
27825
|
+
continue parameter;
|
|
27826
|
+
if (code === EQ) {
|
|
27827
|
+
const keyEnd = trailingOWS(header, keyStart, index);
|
|
27828
|
+
const key = header.slice(keyStart, keyEnd).toLowerCase();
|
|
27829
|
+
index = skipOWS(header, index + 1, len);
|
|
27830
|
+
if (index < len && header.charCodeAt(index) === DQUOTE) {
|
|
27831
|
+
index++;
|
|
27832
|
+
let value = "";
|
|
27833
|
+
while (index < len) {
|
|
27834
|
+
const code = header.charCodeAt(index++);
|
|
27835
|
+
if (code === DQUOTE) {
|
|
27836
|
+
index = skipValue(header, index, len, stopChar);
|
|
27837
|
+
if (parameters[key] === undefined)
|
|
27838
|
+
parameters[key] = value;
|
|
27839
|
+
break;
|
|
27840
|
+
}
|
|
27841
|
+
if (code === BSLASH && index < len) {
|
|
27842
|
+
value += header[index++];
|
|
27843
|
+
continue;
|
|
27844
|
+
}
|
|
27845
|
+
value += String.fromCharCode(code);
|
|
27846
|
+
}
|
|
27847
|
+
continue parameter;
|
|
27848
|
+
}
|
|
27849
|
+
const valueStart = index;
|
|
27850
|
+
index = skipValue(header, index, len, stopChar);
|
|
27851
|
+
if (parameters[key] === undefined) {
|
|
27852
|
+
const valueEnd = trailingOWS(header, valueStart, index);
|
|
27853
|
+
parameters[key] = header.slice(valueStart, valueEnd);
|
|
27854
|
+
}
|
|
27855
|
+
continue parameter;
|
|
27304
27856
|
}
|
|
27857
|
+
index++;
|
|
27305
27858
|
}
|
|
27306
|
-
obj.parameters[key] = value;
|
|
27307
|
-
}
|
|
27308
|
-
if (index !== header.length) {
|
|
27309
|
-
throw new TypeError("invalid parameter format");
|
|
27310
27859
|
}
|
|
27311
|
-
}
|
|
27312
|
-
return obj;
|
|
27860
|
+
return { type, index, parameters };
|
|
27313
27861
|
}
|
|
27314
|
-
function
|
|
27315
|
-
|
|
27316
|
-
|
|
27317
|
-
|
|
27318
|
-
|
|
27319
|
-
|
|
27320
|
-
}
|
|
27321
|
-
if (typeof header !== "string") {
|
|
27322
|
-
throw new TypeError("content-type header is missing from object");
|
|
27862
|
+
function skipValue(str, index, len, stopChar) {
|
|
27863
|
+
while (index < len) {
|
|
27864
|
+
const code = str.charCodeAt(index);
|
|
27865
|
+
if (code === SEMI || code === stopChar)
|
|
27866
|
+
break;
|
|
27867
|
+
index++;
|
|
27323
27868
|
}
|
|
27324
|
-
return
|
|
27869
|
+
return index;
|
|
27325
27870
|
}
|
|
27326
|
-
function
|
|
27327
|
-
|
|
27328
|
-
|
|
27329
|
-
|
|
27871
|
+
function skipOWS(header, index, len) {
|
|
27872
|
+
while (index < len) {
|
|
27873
|
+
const char = header.charCodeAt(index);
|
|
27874
|
+
if (char !== SP && char !== HTAB)
|
|
27875
|
+
break;
|
|
27876
|
+
index++;
|
|
27330
27877
|
}
|
|
27331
|
-
|
|
27332
|
-
|
|
27878
|
+
return index;
|
|
27879
|
+
}
|
|
27880
|
+
function trailingOWS(header, start, end) {
|
|
27881
|
+
while (end > start) {
|
|
27882
|
+
const char = header.charCodeAt(end - 1);
|
|
27883
|
+
if (char !== SP && char !== HTAB)
|
|
27884
|
+
break;
|
|
27885
|
+
end--;
|
|
27333
27886
|
}
|
|
27334
|
-
return
|
|
27887
|
+
return end;
|
|
27335
27888
|
}
|
|
27336
|
-
function
|
|
27337
|
-
|
|
27338
|
-
|
|
27889
|
+
function qstring(str) {
|
|
27890
|
+
if (TOKEN_REGEXP.test(str))
|
|
27891
|
+
return str;
|
|
27892
|
+
if (TEXT_REGEXP.test(str))
|
|
27893
|
+
return `"${str.replace(QUOTE_REGEXP, "\\$&")}"`;
|
|
27894
|
+
throw new TypeError(`Invalid parameter value: ${str}`);
|
|
27339
27895
|
}
|
|
27340
27896
|
});
|
|
27341
27897
|
|
|
@@ -28241,7 +28797,7 @@ var require_utils3 = __commonJS(function(exports) {
|
|
|
28241
28797
|
* MIT Licensed
|
|
28242
28798
|
*/
|
|
28243
28799
|
var { METHODS } = __require("node:http");
|
|
28244
|
-
var contentType =
|
|
28800
|
+
var contentType = require_dist3();
|
|
28245
28801
|
var etag = require_etag();
|
|
28246
28802
|
var mime = require_mime_types();
|
|
28247
28803
|
var proxyaddr = require_proxy_addr();
|
|
@@ -28446,7 +29002,7 @@ var require_is_promise = __commonJS(function(exports, module) {
|
|
|
28446
29002
|
});
|
|
28447
29003
|
|
|
28448
29004
|
// node_modules/path-to-regexp/dist/index.js
|
|
28449
|
-
var
|
|
29005
|
+
var require_dist4 = __commonJS(function(exports) {
|
|
28450
29006
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28451
29007
|
exports.PathError = exports.TokenData = undefined;
|
|
28452
29008
|
exports.parse = parse;
|
|
@@ -28822,7 +29378,7 @@ var require_layer = __commonJS(function(exports, module) {
|
|
|
28822
29378
|
* MIT Licensed
|
|
28823
29379
|
*/
|
|
28824
29380
|
var isPromise = require_is_promise();
|
|
28825
|
-
var pathRegexp =
|
|
29381
|
+
var pathRegexp = require_dist4();
|
|
28826
29382
|
var debug = require_src()("router:layer");
|
|
28827
29383
|
var deprecate = require_depd()("router");
|
|
28828
29384
|
var TRAILING_SLASH_REGEXP = /\/+$/;
|
|
@@ -29702,7 +30258,7 @@ var require_application = __commonJS(function(exports, module) {
|
|
|
29702
30258
|
var cache = this.cache;
|
|
29703
30259
|
var done = callback;
|
|
29704
30260
|
var engines = this.engines;
|
|
29705
|
-
var opts = options;
|
|
30261
|
+
var opts = options || {};
|
|
29706
30262
|
var view;
|
|
29707
30263
|
if (typeof options === "function") {
|
|
29708
30264
|
done = options;
|
|
@@ -29745,7 +30301,7 @@ var require_application = __commonJS(function(exports, module) {
|
|
|
29745
30301
|
};
|
|
29746
30302
|
function logerror(err) {
|
|
29747
30303
|
if (this.get("env") !== "test")
|
|
29748
|
-
console.error(err
|
|
30304
|
+
console.error(err);
|
|
29749
30305
|
}
|
|
29750
30306
|
function tryRender(view, options, callback) {
|
|
29751
30307
|
try {
|
|
@@ -29757,7 +30313,7 @@ var require_application = __commonJS(function(exports, module) {
|
|
|
29757
30313
|
});
|
|
29758
30314
|
|
|
29759
30315
|
// node_modules/negotiator/node_modules/content-type/dist/index.js
|
|
29760
|
-
var
|
|
30316
|
+
var require_dist5 = __commonJS(function(exports) {
|
|
29761
30317
|
/*!
|
|
29762
30318
|
* content-type
|
|
29763
30319
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
@@ -29904,7 +30460,7 @@ var require_accept = __commonJS(function(exports, module) {
|
|
|
29904
30460
|
* Copyright(c) 2026 Blake Embrey
|
|
29905
30461
|
* MIT Licensed
|
|
29906
30462
|
*/
|
|
29907
|
-
var contentType =
|
|
30463
|
+
var contentType = require_dist5();
|
|
29908
30464
|
module.exports = parseAccept;
|
|
29909
30465
|
function parseAccept(header) {
|
|
29910
30466
|
var values = [];
|
|
@@ -30098,7 +30654,7 @@ var require_encoding = __commonJS(function(exports, module) {
|
|
|
30098
30654
|
|
|
30099
30655
|
// node_modules/negotiator/lib/language.js
|
|
30100
30656
|
var require_language = __commonJS(function(exports, module) {
|
|
30101
|
-
var contentType =
|
|
30657
|
+
var contentType = require_dist5();
|
|
30102
30658
|
var parseAccept = require_accept();
|
|
30103
30659
|
module.exports = preferredLanguages;
|
|
30104
30660
|
module.exports.preferredLanguages = preferredLanguages;
|
|
@@ -30182,7 +30738,7 @@ var require_language = __commonJS(function(exports, module) {
|
|
|
30182
30738
|
|
|
30183
30739
|
// node_modules/negotiator/lib/mediaType.js
|
|
30184
30740
|
var require_mediaType = __commonJS(function(exports, module) {
|
|
30185
|
-
var contentType =
|
|
30741
|
+
var contentType = require_dist5();
|
|
30186
30742
|
var parseAcceptHeader = require_accept();
|
|
30187
30743
|
module.exports = preferredMediaTypes;
|
|
30188
30744
|
module.exports.preferredMediaTypes = preferredMediaTypes;
|
|
@@ -30635,9 +31191,9 @@ var require_request = __commonJS(function(exports, module) {
|
|
|
30635
31191
|
var accept = accepts(this);
|
|
30636
31192
|
return accept.encodings.apply(accept, arguments);
|
|
30637
31193
|
};
|
|
30638
|
-
req.acceptsCharsets = function() {
|
|
30639
|
-
|
|
30640
|
-
return accept.charsets
|
|
31194
|
+
req.acceptsCharsets = function(...charsets) {
|
|
31195
|
+
const accept = accepts(this);
|
|
31196
|
+
return accept.charsets(...charsets);
|
|
30641
31197
|
};
|
|
30642
31198
|
req.acceptsLanguages = function(...languages) {
|
|
30643
31199
|
return accepts(this).languages(...languages);
|
|
@@ -30706,7 +31262,7 @@ var require_request = __commonJS(function(exports, module) {
|
|
|
30706
31262
|
if (!val || !trust(this.socket.remoteAddress, 0)) {
|
|
30707
31263
|
val = this.get("Host");
|
|
30708
31264
|
} else if (val.indexOf(",") !== -1) {
|
|
30709
|
-
val = val.substring(0, val.indexOf(",")).
|
|
31265
|
+
val = val.substring(0, val.indexOf(",")).trimEnd();
|
|
30710
31266
|
}
|
|
30711
31267
|
return val || undefined;
|
|
30712
31268
|
});
|
|
@@ -30722,7 +31278,7 @@ var require_request = __commonJS(function(exports, module) {
|
|
|
30722
31278
|
var method = this.method;
|
|
30723
31279
|
var res = this.res;
|
|
30724
31280
|
var status = res.statusCode;
|
|
30725
|
-
if (method !== "GET" && method !== "HEAD")
|
|
31281
|
+
if (method !== "GET" && method !== "HEAD" && method !== "QUERY")
|
|
30726
31282
|
return false;
|
|
30727
31283
|
if (status >= 200 && status < 300 || status === 304) {
|
|
30728
31284
|
return fresh(this.headers, {
|
|
@@ -30748,199 +31304,279 @@ var require_request = __commonJS(function(exports, module) {
|
|
|
30748
31304
|
}
|
|
30749
31305
|
});
|
|
30750
31306
|
|
|
30751
|
-
// node_modules/content-disposition/index.js
|
|
30752
|
-
var
|
|
31307
|
+
// node_modules/content-disposition/dist/index.js
|
|
31308
|
+
var require_dist6 = __commonJS(function(exports) {
|
|
30753
31309
|
/*!
|
|
30754
31310
|
* content-disposition
|
|
30755
31311
|
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
|
30756
31312
|
* MIT Licensed
|
|
30757
31313
|
*/
|
|
30758
|
-
|
|
30759
|
-
|
|
30760
|
-
|
|
31314
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31315
|
+
exports.create = create;
|
|
31316
|
+
exports.parse = parse;
|
|
31317
|
+
exports.decodeExtended = decodeExtended;
|
|
31318
|
+
exports.format = format;
|
|
31319
|
+
exports.encodeExtended = encodeExtended;
|
|
31320
|
+
var NullObject = /* @__PURE__ */ (() => {
|
|
31321
|
+
const C = function() {};
|
|
31322
|
+
C.prototype = Object.create(null);
|
|
31323
|
+
return C;
|
|
31324
|
+
})();
|
|
31325
|
+
function create(filename, options) {
|
|
31326
|
+
const type = options?.type || "attachment";
|
|
31327
|
+
const parameters = createParameters(filename, options?.fallback);
|
|
31328
|
+
return format({ type, parameters }, { extended: false });
|
|
31329
|
+
}
|
|
31330
|
+
var SP = 32;
|
|
31331
|
+
var HTAB = 9;
|
|
31332
|
+
var SEMI = 59;
|
|
31333
|
+
var EQ = 61;
|
|
31334
|
+
var DQUOTE = 34;
|
|
31335
|
+
var BSLASH = 92;
|
|
31336
|
+
var ASTERISK = 42;
|
|
31337
|
+
function parse(header, options) {
|
|
31338
|
+
const len = header.length;
|
|
31339
|
+
const multipart = options?.multipart === true;
|
|
31340
|
+
const extended = options?.extended !== false;
|
|
31341
|
+
let index = skipOWS(header, 0, header.length);
|
|
31342
|
+
const typeStart = index;
|
|
31343
|
+
index = parseToken(header, index, len);
|
|
31344
|
+
const typeEnd = trailingOWS(header, typeStart, index);
|
|
31345
|
+
const type = header.slice(typeStart, typeEnd).toLowerCase();
|
|
31346
|
+
const parameters = new NullObject;
|
|
31347
|
+
parameter:
|
|
31348
|
+
while (index < len) {
|
|
31349
|
+
index = skipOWS(header, index + 1, len);
|
|
31350
|
+
const keyStart = index;
|
|
31351
|
+
while (index < len) {
|
|
31352
|
+
const char = header.charCodeAt(index);
|
|
31353
|
+
if (char === SEMI)
|
|
31354
|
+
continue parameter;
|
|
31355
|
+
if (char === EQ) {
|
|
31356
|
+
const keyEnd = trailingOWS(header, keyStart, index);
|
|
31357
|
+
const key = header.slice(keyStart, keyEnd).toLowerCase();
|
|
31358
|
+
index = skipOWS(header, index + 1, len);
|
|
31359
|
+
if (index < len && header.charCodeAt(index) === DQUOTE) {
|
|
31360
|
+
index++;
|
|
31361
|
+
let value = "";
|
|
31362
|
+
if (multipart) {
|
|
31363
|
+
while (index < len) {
|
|
31364
|
+
const code = header.charCodeAt(index++);
|
|
31365
|
+
if (code === DQUOTE) {
|
|
31366
|
+
index = parseToken(header, index, len);
|
|
31367
|
+
if (parameters[key] === undefined)
|
|
31368
|
+
parameters[key] = value;
|
|
31369
|
+
break;
|
|
31370
|
+
}
|
|
31371
|
+
if (code === 37 && index + 1 < len) {
|
|
31372
|
+
const code2 = header.charCodeAt(index);
|
|
31373
|
+
const code3 = header.charCodeAt(index + 1);
|
|
31374
|
+
if (code2 === 50 && code3 === 50) {
|
|
31375
|
+
value += '"';
|
|
31376
|
+
index += 2;
|
|
31377
|
+
continue;
|
|
31378
|
+
}
|
|
31379
|
+
if (code2 === 48) {
|
|
31380
|
+
if (code3 === 100 || code3 === 68) {
|
|
31381
|
+
value += "\r";
|
|
31382
|
+
index += 2;
|
|
31383
|
+
continue;
|
|
31384
|
+
}
|
|
31385
|
+
if (code3 === 97 || code3 === 65) {
|
|
31386
|
+
value += `
|
|
31387
|
+
`;
|
|
31388
|
+
index += 2;
|
|
31389
|
+
continue;
|
|
31390
|
+
}
|
|
31391
|
+
}
|
|
31392
|
+
}
|
|
31393
|
+
value += String.fromCharCode(code);
|
|
31394
|
+
}
|
|
31395
|
+
} else {
|
|
31396
|
+
while (index < len) {
|
|
31397
|
+
const code = header.charCodeAt(index++);
|
|
31398
|
+
if (code === DQUOTE) {
|
|
31399
|
+
index = parseToken(header, index, len);
|
|
31400
|
+
if (parameters[key] === undefined)
|
|
31401
|
+
parameters[key] = value;
|
|
31402
|
+
break;
|
|
31403
|
+
}
|
|
31404
|
+
if (code === BSLASH && index < len) {
|
|
31405
|
+
value += header[index++];
|
|
31406
|
+
continue;
|
|
31407
|
+
}
|
|
31408
|
+
value += String.fromCharCode(code);
|
|
31409
|
+
}
|
|
31410
|
+
}
|
|
31411
|
+
continue parameter;
|
|
31412
|
+
}
|
|
31413
|
+
const valueStart = index;
|
|
31414
|
+
index = parseToken(header, index, len);
|
|
31415
|
+
const valueEnd = trailingOWS(header, valueStart, index);
|
|
31416
|
+
const value = header.slice(valueStart, valueEnd);
|
|
31417
|
+
if (parameters[key] === undefined) {
|
|
31418
|
+
parameters[key] = value;
|
|
31419
|
+
if (extended && key.charCodeAt(key.length - 1) === ASTERISK) {
|
|
31420
|
+
const normalizedKey = key.slice(0, -1);
|
|
31421
|
+
const decoded = decodeExtended(value);
|
|
31422
|
+
if (decoded !== undefined)
|
|
31423
|
+
parameters[normalizedKey] = decoded;
|
|
31424
|
+
}
|
|
31425
|
+
}
|
|
31426
|
+
continue parameter;
|
|
31427
|
+
}
|
|
31428
|
+
index++;
|
|
31429
|
+
}
|
|
31430
|
+
}
|
|
31431
|
+
return { type, parameters };
|
|
31432
|
+
}
|
|
30761
31433
|
var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g;
|
|
30762
|
-
var
|
|
30763
|
-
var
|
|
30764
|
-
var
|
|
30765
|
-
var
|
|
30766
|
-
var
|
|
31434
|
+
var NON_ASCII_REGEXP = /[^\x20-\x7e]/g;
|
|
31435
|
+
var QUOTE_REGEXP = /[\\"]/g;
|
|
31436
|
+
var INVALID_FILENAME_REGEXP = /%[0-9A-Fa-f]{2}/;
|
|
31437
|
+
var TEXT_REGEXP = /^[\x20-\x7e\x80-\xff]*$/;
|
|
31438
|
+
var ASCII_TEXT_REGEXP = /^[\x20-\x7e]*$/;
|
|
30767
31439
|
var TOKEN_REGEXP = /^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/;
|
|
30768
|
-
|
|
30769
|
-
|
|
30770
|
-
function contentDisposition(filename, options) {
|
|
30771
|
-
var opts = options || {};
|
|
30772
|
-
var type = opts.type || "attachment";
|
|
30773
|
-
var params = createparams(filename, opts.fallback);
|
|
30774
|
-
return format(new ContentDisposition(type, params));
|
|
30775
|
-
}
|
|
30776
|
-
function createparams(filename, fallback) {
|
|
30777
|
-
if (filename === undefined) {
|
|
31440
|
+
function createParameters(filename, fallback = true) {
|
|
31441
|
+
if (filename === undefined)
|
|
30778
31442
|
return;
|
|
31443
|
+
if (typeof fallback === "string") {
|
|
31444
|
+
if (!ASCII_TEXT_REGEXP.test(fallback)) {
|
|
31445
|
+
throw new TypeError("Fallback must be valid US-ASCII: " + fallback);
|
|
31446
|
+
}
|
|
31447
|
+
if (fallback === filename)
|
|
31448
|
+
return { filename };
|
|
31449
|
+
return { filename: fallback, "filename*": encodeExtended(filename) };
|
|
30779
31450
|
}
|
|
30780
|
-
|
|
30781
|
-
|
|
30782
|
-
throw new TypeError("filename must be a string");
|
|
30783
|
-
}
|
|
30784
|
-
if (fallback === undefined) {
|
|
30785
|
-
fallback = true;
|
|
30786
|
-
}
|
|
30787
|
-
if (typeof fallback !== "string" && typeof fallback !== "boolean") {
|
|
30788
|
-
throw new TypeError("fallback must be a string or boolean");
|
|
30789
|
-
}
|
|
30790
|
-
if (typeof fallback === "string" && NON_LATIN1_REGEXP.test(fallback)) {
|
|
30791
|
-
throw new TypeError("fallback must be ISO-8859-1 string");
|
|
30792
|
-
}
|
|
30793
|
-
var name = basename(filename);
|
|
30794
|
-
var isQuotedString = TEXT_REGEXP.test(name);
|
|
30795
|
-
var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name) : basename(fallback);
|
|
30796
|
-
var hasFallback = typeof fallbackName === "string" && fallbackName !== name;
|
|
30797
|
-
if (hasFallback || !isQuotedString || hasHexEscape(name)) {
|
|
30798
|
-
params["filename*"] = name;
|
|
31451
|
+
if (ASCII_TEXT_REGEXP.test(filename) && !INVALID_FILENAME_REGEXP.test(filename)) {
|
|
31452
|
+
return { filename };
|
|
30799
31453
|
}
|
|
30800
|
-
if (
|
|
30801
|
-
|
|
31454
|
+
if (fallback === false) {
|
|
31455
|
+
return { "filename*": encodeExtended(filename) };
|
|
30802
31456
|
}
|
|
30803
|
-
return
|
|
31457
|
+
return {
|
|
31458
|
+
filename: getAscii(filename),
|
|
31459
|
+
"filename*": encodeExtended(filename)
|
|
31460
|
+
};
|
|
30804
31461
|
}
|
|
30805
|
-
function
|
|
30806
|
-
|
|
30807
|
-
|
|
30808
|
-
|
|
30809
|
-
throw new TypeError("invalid type");
|
|
30810
|
-
}
|
|
30811
|
-
var string = String(type).toLowerCase();
|
|
30812
|
-
if (parameters && typeof parameters === "object") {
|
|
30813
|
-
var param;
|
|
30814
|
-
var params = Object.keys(parameters).sort();
|
|
30815
|
-
for (var i = 0;i < params.length; i++) {
|
|
30816
|
-
param = params[i];
|
|
30817
|
-
var val = param.slice(-1) === "*" ? ustring(parameters[param]) : qstring(parameters[param]);
|
|
30818
|
-
string += "; " + param + "=" + val;
|
|
30819
|
-
}
|
|
31462
|
+
function decodeExtended(str) {
|
|
31463
|
+
const charsetEnd = str.indexOf("'");
|
|
31464
|
+
if (charsetEnd <= 0) {
|
|
31465
|
+
return;
|
|
30820
31466
|
}
|
|
30821
|
-
|
|
30822
|
-
|
|
30823
|
-
|
|
30824
|
-
const match = EXT_VALUE_REGEXP.exec(str);
|
|
30825
|
-
if (!match) {
|
|
30826
|
-
throw new TypeError("invalid extended field value");
|
|
31467
|
+
const languageEnd = str.indexOf("'", charsetEnd + 1);
|
|
31468
|
+
if (languageEnd === -1) {
|
|
31469
|
+
return;
|
|
30827
31470
|
}
|
|
30828
|
-
const charset =
|
|
30829
|
-
const encoded =
|
|
31471
|
+
const charset = str.slice(0, charsetEnd).toLowerCase();
|
|
31472
|
+
const encoded = str.slice(languageEnd + 1);
|
|
30830
31473
|
switch (charset) {
|
|
30831
31474
|
case "iso-8859-1": {
|
|
30832
|
-
|
|
30833
|
-
return getlatin1(binary);
|
|
31475
|
+
return decodeHexEscapes(encoded);
|
|
30834
31476
|
}
|
|
30835
31477
|
case "utf-8":
|
|
30836
31478
|
case "utf8": {
|
|
30837
|
-
|
|
30838
|
-
return decodeURIComponent(encoded);
|
|
30839
|
-
} catch {
|
|
30840
|
-
const binary = decodeHexEscapes(encoded);
|
|
30841
|
-
const bytes = new Uint8Array(binary.length);
|
|
30842
|
-
for (let idx = 0;idx < binary.length; idx++) {
|
|
30843
|
-
bytes[idx] = binary.charCodeAt(idx);
|
|
30844
|
-
}
|
|
30845
|
-
return utf8Decoder.decode(bytes);
|
|
30846
|
-
}
|
|
31479
|
+
return tryDecodeURIComponent(encoded);
|
|
30847
31480
|
}
|
|
30848
31481
|
}
|
|
30849
|
-
|
|
31482
|
+
return;
|
|
30850
31483
|
}
|
|
30851
|
-
function
|
|
30852
|
-
|
|
31484
|
+
function tryDecodeURIComponent(str) {
|
|
31485
|
+
try {
|
|
31486
|
+
return decodeURIComponent(str);
|
|
31487
|
+
} catch {
|
|
31488
|
+
return;
|
|
31489
|
+
}
|
|
30853
31490
|
}
|
|
30854
|
-
function
|
|
30855
|
-
|
|
30856
|
-
|
|
31491
|
+
function parseToken(str, index, len) {
|
|
31492
|
+
while (index < len) {
|
|
31493
|
+
const char = str.charCodeAt(index);
|
|
31494
|
+
if (char === SEMI)
|
|
31495
|
+
break;
|
|
31496
|
+
index++;
|
|
30857
31497
|
}
|
|
30858
|
-
|
|
30859
|
-
|
|
30860
|
-
|
|
31498
|
+
return index;
|
|
31499
|
+
}
|
|
31500
|
+
function skipOWS(str, index, len) {
|
|
31501
|
+
while (index < len) {
|
|
31502
|
+
const char = str.charCodeAt(index);
|
|
31503
|
+
if (char !== SP && char !== HTAB)
|
|
31504
|
+
break;
|
|
31505
|
+
index++;
|
|
30861
31506
|
}
|
|
30862
|
-
|
|
30863
|
-
|
|
30864
|
-
|
|
30865
|
-
|
|
30866
|
-
|
|
30867
|
-
|
|
30868
|
-
|
|
30869
|
-
|
|
30870
|
-
if (match.index !== index) {
|
|
30871
|
-
throw new TypeError("invalid parameter format");
|
|
30872
|
-
}
|
|
30873
|
-
index += match[0].length;
|
|
30874
|
-
key = match[1].toLowerCase();
|
|
30875
|
-
value = match[2];
|
|
30876
|
-
if (names.indexOf(key) !== -1) {
|
|
30877
|
-
throw new TypeError("invalid duplicate parameter");
|
|
30878
|
-
}
|
|
30879
|
-
names.push(key);
|
|
30880
|
-
if (key.indexOf("*") + 1 === key.length) {
|
|
30881
|
-
key = key.slice(0, -1);
|
|
30882
|
-
value = decodefield(value);
|
|
30883
|
-
params[key] = value;
|
|
30884
|
-
continue;
|
|
30885
|
-
}
|
|
30886
|
-
if (typeof params[key] === "string") {
|
|
30887
|
-
continue;
|
|
30888
|
-
}
|
|
30889
|
-
if (value[0] === '"') {
|
|
30890
|
-
value = value.slice(1, -1).replace(QESC_REGEXP, "$1");
|
|
30891
|
-
}
|
|
30892
|
-
params[key] = value;
|
|
31507
|
+
return index;
|
|
31508
|
+
}
|
|
31509
|
+
function trailingOWS(str, start, end) {
|
|
31510
|
+
while (end > start) {
|
|
31511
|
+
const char = str.charCodeAt(end - 1);
|
|
31512
|
+
if (char !== SP && char !== HTAB)
|
|
31513
|
+
break;
|
|
31514
|
+
end--;
|
|
30893
31515
|
}
|
|
30894
|
-
|
|
30895
|
-
|
|
31516
|
+
return end;
|
|
31517
|
+
}
|
|
31518
|
+
function format(obj, options) {
|
|
31519
|
+
const { type, parameters } = obj;
|
|
31520
|
+
const multipart = options?.multipart === true;
|
|
31521
|
+
const extended = options?.extended !== false;
|
|
31522
|
+
if (!type || !TOKEN_REGEXP.test(type)) {
|
|
31523
|
+
throw new TypeError("Invalid type: " + type);
|
|
31524
|
+
}
|
|
31525
|
+
let result = type;
|
|
31526
|
+
if (parameters) {
|
|
31527
|
+
for (const param of Object.keys(parameters)) {
|
|
31528
|
+
const value = parameters[param];
|
|
31529
|
+
if (!TOKEN_REGEXP.test(param)) {
|
|
31530
|
+
throw new TypeError("Invalid parameter name: " + param);
|
|
31531
|
+
}
|
|
31532
|
+
if (multipart) {
|
|
31533
|
+
result += "; " + param + "=" + qmultipart(value);
|
|
31534
|
+
continue;
|
|
31535
|
+
}
|
|
31536
|
+
if (TOKEN_REGEXP.test(value)) {
|
|
31537
|
+
result += "; " + param + "=" + value;
|
|
31538
|
+
continue;
|
|
31539
|
+
}
|
|
31540
|
+
if (TEXT_REGEXP.test(value)) {
|
|
31541
|
+
result += "; " + param + "=" + qstring(value);
|
|
31542
|
+
continue;
|
|
31543
|
+
}
|
|
31544
|
+
if (!extended) {
|
|
31545
|
+
throw new TypeError("Invalid parameter value: " + value);
|
|
31546
|
+
}
|
|
31547
|
+
result += "; " + param + "*=" + encodeExtended(value);
|
|
31548
|
+
}
|
|
30896
31549
|
}
|
|
30897
|
-
return
|
|
31550
|
+
return result;
|
|
31551
|
+
}
|
|
31552
|
+
function getAscii(val) {
|
|
31553
|
+
return val.replace(NON_ASCII_REGEXP, "?");
|
|
30898
31554
|
}
|
|
30899
31555
|
function pencode(char) {
|
|
30900
|
-
return "%" +
|
|
31556
|
+
return "%" + char.charCodeAt(0).toString(16).toUpperCase();
|
|
30901
31557
|
}
|
|
30902
|
-
function qstring(
|
|
30903
|
-
|
|
30904
|
-
return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
|
|
31558
|
+
function qstring(str) {
|
|
31559
|
+
return '"' + str.replace(QUOTE_REGEXP, "\\$&") + '"';
|
|
30905
31560
|
}
|
|
30906
|
-
function
|
|
30907
|
-
|
|
30908
|
-
var encoded = encodeURIComponent(str).replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode);
|
|
30909
|
-
return "UTF-8''" + encoded;
|
|
31561
|
+
function qmultipart(str) {
|
|
31562
|
+
return '"' + str.replace(/[\n\r"]/g, multipartEscape) + '"';
|
|
30910
31563
|
}
|
|
30911
|
-
function
|
|
30912
|
-
|
|
30913
|
-
|
|
31564
|
+
function multipartEscape(char) {
|
|
31565
|
+
if (char === `
|
|
31566
|
+
`)
|
|
31567
|
+
return "%0A";
|
|
31568
|
+
if (char === "\r")
|
|
31569
|
+
return "%0D";
|
|
31570
|
+
return "%22";
|
|
30914
31571
|
}
|
|
30915
|
-
function
|
|
30916
|
-
const
|
|
30917
|
-
|
|
30918
|
-
while (end > 0 && normalized[end - 1] === "/") {
|
|
30919
|
-
end--;
|
|
30920
|
-
}
|
|
30921
|
-
if (end === 0) {
|
|
30922
|
-
return "";
|
|
30923
|
-
}
|
|
30924
|
-
let start = end - 1;
|
|
30925
|
-
while (start >= 0 && normalized[start] !== "/") {
|
|
30926
|
-
start--;
|
|
30927
|
-
}
|
|
30928
|
-
return normalized.slice(start + 1, end);
|
|
31572
|
+
function encodeExtended(str) {
|
|
31573
|
+
const encoded = encodeURIComponent(str).replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode);
|
|
31574
|
+
return "UTF-8''" + encoded;
|
|
30929
31575
|
}
|
|
30930
31576
|
function isHexDigit(char) {
|
|
30931
31577
|
const code = char.charCodeAt(0);
|
|
30932
31578
|
return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
|
|
30933
31579
|
}
|
|
30934
|
-
function hasHexEscape(str) {
|
|
30935
|
-
const maxIndex = str.length - 3;
|
|
30936
|
-
let lastIndex = -1;
|
|
30937
|
-
while ((lastIndex = str.indexOf("%", lastIndex + 1)) !== -1 && lastIndex <= maxIndex) {
|
|
30938
|
-
if (isHexDigit(str[lastIndex + 1]) && isHexDigit(str[lastIndex + 2])) {
|
|
30939
|
-
return true;
|
|
30940
|
-
}
|
|
30941
|
-
}
|
|
30942
|
-
return false;
|
|
30943
|
-
}
|
|
30944
31580
|
function decodeHexEscapes(str) {
|
|
30945
31581
|
const firstEscape = str.indexOf("%");
|
|
30946
31582
|
if (firstEscape === -1)
|
|
@@ -31741,7 +32377,7 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
31741
32377
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
31742
32378
|
* MIT Licensed
|
|
31743
32379
|
*/
|
|
31744
|
-
var contentDisposition =
|
|
32380
|
+
var contentDisposition = require_dist6();
|
|
31745
32381
|
var createError = require_http_errors();
|
|
31746
32382
|
var deprecate = require_depd()("express");
|
|
31747
32383
|
var encodeUrl = require_encodeurl();
|
|
@@ -31760,6 +32396,7 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
31760
32396
|
var send = require_send();
|
|
31761
32397
|
var extname = path.extname;
|
|
31762
32398
|
var resolve = path.resolve;
|
|
32399
|
+
var basename = path.basename;
|
|
31763
32400
|
var vary = require_vary();
|
|
31764
32401
|
var { Buffer: Buffer2 } = __require("node:buffer");
|
|
31765
32402
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -31792,11 +32429,14 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
31792
32429
|
var chunk = body;
|
|
31793
32430
|
var encoding;
|
|
31794
32431
|
var req = this.req;
|
|
31795
|
-
var type;
|
|
31796
32432
|
var app = this.app;
|
|
31797
32433
|
switch (typeof chunk) {
|
|
31798
32434
|
case "string":
|
|
31799
|
-
|
|
32435
|
+
encoding = "utf8";
|
|
32436
|
+
const type = this.get("Content-Type");
|
|
32437
|
+
if (typeof type === "string") {
|
|
32438
|
+
this.set("Content-Type", setCharset(type, "utf-8"));
|
|
32439
|
+
} else {
|
|
31800
32440
|
this.type("html");
|
|
31801
32441
|
}
|
|
31802
32442
|
break;
|
|
@@ -31814,13 +32454,6 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
31814
32454
|
}
|
|
31815
32455
|
break;
|
|
31816
32456
|
}
|
|
31817
|
-
if (typeof chunk === "string") {
|
|
31818
|
-
encoding = "utf8";
|
|
31819
|
-
type = this.get("Content-Type");
|
|
31820
|
-
if (typeof type === "string") {
|
|
31821
|
-
this.set("Content-Type", setCharset(type, "utf-8"));
|
|
31822
|
-
}
|
|
31823
|
-
}
|
|
31824
32457
|
var etagFn = app.get("etag fn");
|
|
31825
32458
|
var generateETag = !this.get("ETag") && typeof etagFn === "function";
|
|
31826
32459
|
var len;
|
|
@@ -31834,7 +32467,9 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
31834
32467
|
encoding = undefined;
|
|
31835
32468
|
len = chunk.length;
|
|
31836
32469
|
}
|
|
31837
|
-
this.
|
|
32470
|
+
if (!this.get("Transfer-Encoding")) {
|
|
32471
|
+
this.set("Content-Length", len);
|
|
32472
|
+
}
|
|
31838
32473
|
}
|
|
31839
32474
|
var etag;
|
|
31840
32475
|
if (generateETag && len !== undefined) {
|
|
@@ -31955,7 +32590,7 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
31955
32590
|
opts = filename;
|
|
31956
32591
|
}
|
|
31957
32592
|
var headers = {
|
|
31958
|
-
"Content-Disposition": contentDisposition(name || path)
|
|
32593
|
+
"Content-Disposition": contentDisposition.create(basename(name || path))
|
|
31959
32594
|
};
|
|
31960
32595
|
if (opts && opts.headers) {
|
|
31961
32596
|
var keys = Object.keys(opts.headers);
|
|
@@ -31998,10 +32633,11 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
31998
32633
|
return this;
|
|
31999
32634
|
};
|
|
32000
32635
|
res.attachment = function attachment(filename) {
|
|
32001
|
-
|
|
32002
|
-
|
|
32636
|
+
const name = filename !== undefined ? basename(filename) : undefined;
|
|
32637
|
+
if (name) {
|
|
32638
|
+
this.type(extname(name));
|
|
32003
32639
|
}
|
|
32004
|
-
this.set("Content-Disposition", contentDisposition(
|
|
32640
|
+
this.set("Content-Disposition", contentDisposition.create(name));
|
|
32005
32641
|
return this;
|
|
32006
32642
|
};
|
|
32007
32643
|
res.append = function append(field, val) {
|
|
@@ -32088,7 +32724,7 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
32088
32724
|
},
|
|
32089
32725
|
html: function() {
|
|
32090
32726
|
var u = escapeHtml(address);
|
|
32091
|
-
body = "<p>" + statuses.message[status] + ". Redirecting to " + u + "</p>";
|
|
32727
|
+
body = "<!DOCTYPE html><head><title>" + statuses.message[status] + "</title></head>" + "<body><p>" + statuses.message[status] + ". Redirecting to " + u + "</p></body>";
|
|
32092
32728
|
},
|
|
32093
32729
|
default: function() {
|
|
32094
32730
|
body = "";
|
|
@@ -36391,17 +37027,34 @@ function normalizeObjectSchema(schema) {
|
|
|
36391
37027
|
}
|
|
36392
37028
|
return;
|
|
36393
37029
|
}
|
|
37030
|
+
function getDotPath(path) {
|
|
37031
|
+
if (path.length === 0) {
|
|
37032
|
+
return "object root";
|
|
37033
|
+
}
|
|
37034
|
+
return path.reduce((acc, seg, index) => {
|
|
37035
|
+
if (index === 0) {
|
|
37036
|
+
return String(seg);
|
|
37037
|
+
}
|
|
37038
|
+
if (typeof seg === "number") {
|
|
37039
|
+
return `${acc}[${seg}]`;
|
|
37040
|
+
}
|
|
37041
|
+
return `${acc}.${seg}`;
|
|
37042
|
+
}, "");
|
|
37043
|
+
}
|
|
36394
37044
|
function getParseErrorMessage(error) {
|
|
36395
37045
|
if (error && typeof error === "object") {
|
|
37046
|
+
if ("issues" in error && Array.isArray(error.issues) && error.issues.length > 0) {
|
|
37047
|
+
return error.issues.map((i) => {
|
|
37048
|
+
if (!i.path?.length) {
|
|
37049
|
+
return i.message;
|
|
37050
|
+
}
|
|
37051
|
+
return `${i.message} at ${getDotPath(i.path)}`;
|
|
37052
|
+
}).join(`
|
|
37053
|
+
`);
|
|
37054
|
+
}
|
|
36396
37055
|
if ("message" in error && typeof error.message === "string") {
|
|
36397
37056
|
return error.message;
|
|
36398
37057
|
}
|
|
36399
|
-
if ("issues" in error && Array.isArray(error.issues) && error.issues.length > 0) {
|
|
36400
|
-
const firstIssue = error.issues[0];
|
|
36401
|
-
if (firstIssue && typeof firstIssue === "object" && "message" in firstIssue) {
|
|
36402
|
-
return String(firstIssue.message);
|
|
36403
|
-
}
|
|
36404
|
-
}
|
|
36405
37058
|
try {
|
|
36406
37059
|
return JSON.stringify(error);
|
|
36407
37060
|
} catch {
|
|
@@ -37942,6 +38595,9 @@ class Protocol {
|
|
|
37942
38595
|
this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
|
|
37943
38596
|
const handleTaskResult = async () => {
|
|
37944
38597
|
const taskId = request.params.taskId;
|
|
38598
|
+
if (!await this._taskStore.getTask(taskId, extra.sessionId)) {
|
|
38599
|
+
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
|
38600
|
+
}
|
|
37945
38601
|
if (this._taskMessageQueue) {
|
|
37946
38602
|
let queuedMessage;
|
|
37947
38603
|
while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
|
|
@@ -37972,12 +38628,12 @@ class Protocol {
|
|
|
37972
38628
|
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
|
37973
38629
|
}
|
|
37974
38630
|
if (!isTerminal(task.status)) {
|
|
37975
|
-
await this._waitForTaskUpdate(taskId, extra.signal);
|
|
38631
|
+
await this._waitForTaskUpdate(taskId, extra.signal, extra.sessionId);
|
|
37976
38632
|
return await handleTaskResult();
|
|
37977
38633
|
}
|
|
37978
38634
|
if (isTerminal(task.status)) {
|
|
37979
38635
|
const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
|
|
37980
|
-
this._clearTaskQueue(taskId);
|
|
38636
|
+
this._clearTaskQueue(taskId, extra.sessionId);
|
|
37981
38637
|
return {
|
|
37982
38638
|
...result,
|
|
37983
38639
|
_meta: {
|
|
@@ -38014,7 +38670,7 @@ class Protocol {
|
|
|
38014
38670
|
throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
|
|
38015
38671
|
}
|
|
38016
38672
|
await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
|
|
38017
|
-
this._clearTaskQueue(request.params.taskId);
|
|
38673
|
+
this._clearTaskQueue(request.params.taskId, extra.sessionId);
|
|
38018
38674
|
const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
|
|
38019
38675
|
if (!cancelledTask) {
|
|
38020
38676
|
throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
|
|
@@ -38108,6 +38764,10 @@ class Protocol {
|
|
|
38108
38764
|
this._progressHandlers.clear();
|
|
38109
38765
|
this._taskProgressTokens.clear();
|
|
38110
38766
|
this._pendingDebouncedNotifications.clear();
|
|
38767
|
+
for (const info of this._timeoutInfo.values()) {
|
|
38768
|
+
clearTimeout(info.timeoutId);
|
|
38769
|
+
}
|
|
38770
|
+
this._timeoutInfo.clear();
|
|
38111
38771
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
38112
38772
|
controller.abort();
|
|
38113
38773
|
}
|
|
@@ -38133,6 +38793,19 @@ class Protocol {
|
|
|
38133
38793
|
const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
|
|
38134
38794
|
const capturedTransport = this._transport;
|
|
38135
38795
|
const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
|
|
38796
|
+
const sessionId = capturedTransport?.sessionId;
|
|
38797
|
+
const store = this._taskStore;
|
|
38798
|
+
let relatedTaskFound = true;
|
|
38799
|
+
let relatedTaskLookup;
|
|
38800
|
+
if (relatedTaskId && store && this._taskMessageQueue && sessionId !== undefined) {
|
|
38801
|
+
relatedTaskFound = false;
|
|
38802
|
+
relatedTaskLookup = (async () => {
|
|
38803
|
+
if (!await store.getTask(relatedTaskId, sessionId)) {
|
|
38804
|
+
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
|
|
38805
|
+
}
|
|
38806
|
+
relatedTaskFound = true;
|
|
38807
|
+
})();
|
|
38808
|
+
}
|
|
38136
38809
|
if (handler === undefined) {
|
|
38137
38810
|
const errorResponse = {
|
|
38138
38811
|
jsonrpc: "2.0",
|
|
@@ -38142,7 +38815,10 @@ class Protocol {
|
|
|
38142
38815
|
message: "Method not found"
|
|
38143
38816
|
}
|
|
38144
38817
|
};
|
|
38145
|
-
if (relatedTaskId &&
|
|
38818
|
+
if (relatedTaskId && relatedTaskLookup) {
|
|
38819
|
+
const queuedError = { type: "error", message: errorResponse, timestamp: Date.now() };
|
|
38820
|
+
relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse)).catch((error) => this._onerror(new Error(`Failed to send an error response: ${error}`)));
|
|
38821
|
+
} else if (relatedTaskId && this._taskMessageQueue) {
|
|
38146
38822
|
this._enqueueTaskMessage(relatedTaskId, {
|
|
38147
38823
|
type: "error",
|
|
38148
38824
|
message: errorResponse,
|
|
@@ -38193,7 +38869,10 @@ class Protocol {
|
|
|
38193
38869
|
closeSSEStream: extra?.closeSSEStream,
|
|
38194
38870
|
closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
|
|
38195
38871
|
};
|
|
38196
|
-
Promise.resolve().then(() => {
|
|
38872
|
+
(relatedTaskLookup ?? Promise.resolve()).then(() => {
|
|
38873
|
+
if (relatedTaskLookup && abortController.signal.aborted) {
|
|
38874
|
+
throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
|
|
38875
|
+
}
|
|
38197
38876
|
if (taskCreationParams) {
|
|
38198
38877
|
this.assertTaskHandlerCapability(request.method);
|
|
38199
38878
|
}
|
|
@@ -38228,7 +38907,7 @@ class Protocol {
|
|
|
38228
38907
|
...error["data"] !== undefined && { data: error["data"] }
|
|
38229
38908
|
}
|
|
38230
38909
|
};
|
|
38231
|
-
if (relatedTaskId && this._taskMessageQueue) {
|
|
38910
|
+
if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) {
|
|
38232
38911
|
await this._enqueueTaskMessage(relatedTaskId, {
|
|
38233
38912
|
type: "error",
|
|
38234
38913
|
message: errorResponse,
|
|
@@ -38238,7 +38917,9 @@ class Protocol {
|
|
|
38238
38917
|
await capturedTransport?.send(errorResponse);
|
|
38239
38918
|
}
|
|
38240
38919
|
}).catch((error) => this._onerror(new Error(`Failed to send response: ${error}`))).finally(() => {
|
|
38241
|
-
this._requestHandlerAbortControllers.
|
|
38920
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
38921
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
38922
|
+
}
|
|
38242
38923
|
});
|
|
38243
38924
|
}
|
|
38244
38925
|
_onprogress(notification) {
|
|
@@ -38614,7 +39295,7 @@ class Protocol {
|
|
|
38614
39295
|
throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
|
|
38615
39296
|
}
|
|
38616
39297
|
const maxQueueSize = this._options?.maxTaskQueueSize;
|
|
38617
|
-
await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
|
|
39298
|
+
await this._taskMessageQueue.enqueue(taskId, message, sessionId ?? this._transport?.sessionId, maxQueueSize);
|
|
38618
39299
|
}
|
|
38619
39300
|
async _clearTaskQueue(taskId, sessionId) {
|
|
38620
39301
|
if (this._taskMessageQueue) {
|
|
@@ -38633,10 +39314,10 @@ class Protocol {
|
|
|
38633
39314
|
}
|
|
38634
39315
|
}
|
|
38635
39316
|
}
|
|
38636
|
-
async _waitForTaskUpdate(taskId, signal) {
|
|
39317
|
+
async _waitForTaskUpdate(taskId, signal, sessionId) {
|
|
38637
39318
|
let interval = this._options?.defaultTaskPollInterval ?? 1000;
|
|
38638
39319
|
try {
|
|
38639
|
-
const task = await this._taskStore?.getTask(taskId);
|
|
39320
|
+
const task = await this._taskStore?.getTask(taskId, sessionId);
|
|
38640
39321
|
if (task?.pollInterval) {
|
|
38641
39322
|
interval = task.pollInterval;
|
|
38642
39323
|
}
|
|
@@ -41757,6 +42438,8 @@ var require_utils4 = __commonJS(function(exports, module) {
|
|
|
41757
42438
|
var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
|
|
41758
42439
|
var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
|
|
41759
42440
|
var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
|
|
42441
|
+
var isRegNameCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=]$/u);
|
|
42442
|
+
var isLiteralRegName = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=]*$/u);
|
|
41760
42443
|
function stringArrayToHexStripped(input) {
|
|
41761
42444
|
let acc = "";
|
|
41762
42445
|
let code = 0;
|
|
@@ -41986,13 +42669,16 @@ var require_utils4 = __commonJS(function(exports, module) {
|
|
|
41986
42669
|
}
|
|
41987
42670
|
return output.join("");
|
|
41988
42671
|
}
|
|
41989
|
-
var
|
|
41990
|
-
var
|
|
41991
|
-
|
|
41992
|
-
|
|
41993
|
-
|
|
41994
|
-
|
|
41995
|
-
|
|
42672
|
+
var IP_HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23" };
|
|
42673
|
+
var IP_HOST_DELIM_RE = /[@/?#]/g;
|
|
42674
|
+
function encodeHost(host, isIP, allowNonAscii = false) {
|
|
42675
|
+
if (!isIP) {
|
|
42676
|
+
if (isLiteralRegName(host))
|
|
42677
|
+
return host;
|
|
42678
|
+
return encodeComponent(host, isRegNameCharacter, allowNonAscii);
|
|
42679
|
+
}
|
|
42680
|
+
IP_HOST_DELIM_RE.lastIndex = 0;
|
|
42681
|
+
return host.replace(IP_HOST_DELIM_RE, (ch) => IP_HOST_DELIMS[ch]);
|
|
41996
42682
|
}
|
|
41997
42683
|
function normalizePercentEncoding(input, decodeUnreserved = false) {
|
|
41998
42684
|
if (input.indexOf("%") === -1) {
|
|
@@ -42158,7 +42844,7 @@ var require_utils4 = __commonJS(function(exports, module) {
|
|
|
42158
42844
|
}
|
|
42159
42845
|
return output;
|
|
42160
42846
|
}
|
|
42161
|
-
function encodeComponent(input, isAllowed) {
|
|
42847
|
+
function encodeComponent(input, isAllowed, allowNonAscii = false) {
|
|
42162
42848
|
let output = "";
|
|
42163
42849
|
for (let i = 0;i < input.length; i++) {
|
|
42164
42850
|
const ch = input[i];
|
|
@@ -42177,17 +42863,17 @@ var require_utils4 = __commonJS(function(exports, module) {
|
|
|
42177
42863
|
if (code < 128) {
|
|
42178
42864
|
output += BYTE_HEX[code];
|
|
42179
42865
|
} else if (code < 55296 || code > 57343) {
|
|
42180
|
-
output += percentEncodeNonAscii(code);
|
|
42866
|
+
output += allowNonAscii ? ch : percentEncodeNonAscii(code);
|
|
42181
42867
|
} else if (code <= 56319 && i + 1 < input.length) {
|
|
42182
42868
|
const low = input.charCodeAt(i + 1);
|
|
42183
42869
|
if (low >= 56320 && low <= 57343) {
|
|
42184
|
-
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
42870
|
+
output += allowNonAscii ? ch + input[i + 1] : percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
42185
42871
|
i++;
|
|
42186
42872
|
} else {
|
|
42187
|
-
output += percentEncodeNonAscii(65533);
|
|
42873
|
+
output += allowNonAscii ? "�" : percentEncodeNonAscii(65533);
|
|
42188
42874
|
}
|
|
42189
42875
|
} else {
|
|
42190
|
-
output += percentEncodeNonAscii(65533);
|
|
42876
|
+
output += allowNonAscii ? "�" : percentEncodeNonAscii(65533);
|
|
42191
42877
|
}
|
|
42192
42878
|
}
|
|
42193
42879
|
}
|
|
@@ -42249,7 +42935,7 @@ var require_utils4 = __commonJS(function(exports, module) {
|
|
|
42249
42935
|
}
|
|
42250
42936
|
return;
|
|
42251
42937
|
}
|
|
42252
|
-
function recomposeAuthority(component) {
|
|
42938
|
+
function recomposeAuthority(component, allowNonAscii = false) {
|
|
42253
42939
|
const uriTokens = [];
|
|
42254
42940
|
if (component.userinfo !== undefined) {
|
|
42255
42941
|
uriTokens.push(encodeUserinfo(component.userinfo));
|
|
@@ -42270,7 +42956,7 @@ var require_utils4 = __commonJS(function(exports, module) {
|
|
|
42270
42956
|
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
|
|
42271
42957
|
host = `[${ipV6res.escapedHost}]`;
|
|
42272
42958
|
} else {
|
|
42273
|
-
host =
|
|
42959
|
+
host = encodeHost(host, false, allowNonAscii);
|
|
42274
42960
|
}
|
|
42275
42961
|
}
|
|
42276
42962
|
}
|
|
@@ -42292,7 +42978,7 @@ var require_utils4 = __commonJS(function(exports, module) {
|
|
|
42292
42978
|
nonSimpleDomain,
|
|
42293
42979
|
nonSimpleMailtoDomain,
|
|
42294
42980
|
recomposeAuthority,
|
|
42295
|
-
|
|
42981
|
+
encodeHost,
|
|
42296
42982
|
normalizePercentEncoding,
|
|
42297
42983
|
normalizePathEncoding,
|
|
42298
42984
|
serializePathEncoding,
|
|
@@ -42457,7 +43143,8 @@ var require_schemes = __commonJS(function(exports, module) {
|
|
|
42457
43143
|
scheme: "urn",
|
|
42458
43144
|
parse: urnParse,
|
|
42459
43145
|
serialize: urnSerialize,
|
|
42460
|
-
skipNormalize: true
|
|
43146
|
+
skipNormalize: true,
|
|
43147
|
+
absolutePath: true
|
|
42461
43148
|
};
|
|
42462
43149
|
var urnuuid = {
|
|
42463
43150
|
scheme: "urn:uuid",
|
|
@@ -42736,7 +43423,7 @@ var require_schemes = __commonJS(function(exports, module) {
|
|
|
42736
43423
|
|
|
42737
43424
|
// node_modules/fast-uri/index.js
|
|
42738
43425
|
var require_fast_uri = __commonJS(function(exports, module) {
|
|
42739
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment,
|
|
43426
|
+
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, encodeHost, isIPv4, nonSimpleDomain } = require_utils4();
|
|
42740
43427
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
42741
43428
|
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
42742
43429
|
var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
@@ -42760,6 +43447,7 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
42760
43447
|
const {
|
|
42761
43448
|
parsed: baseParsed,
|
|
42762
43449
|
malformedAuthorityOrPort: baseMalformed,
|
|
43450
|
+
malformedReferenceEdge: baseMalformedReferenceEdge,
|
|
42763
43451
|
malformedPercentEncoding: baseMalformedPercentEncoding,
|
|
42764
43452
|
malformedSchemeSpecific: baseMalformedSchemeSpecific,
|
|
42765
43453
|
malformedHost: baseMalformedHost,
|
|
@@ -42768,17 +43456,21 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
42768
43456
|
const {
|
|
42769
43457
|
parsed: relativeParsed,
|
|
42770
43458
|
malformedAuthorityOrPort: relativeMalformed,
|
|
43459
|
+
malformedReferenceEdge: relativeMalformedReferenceEdge,
|
|
42771
43460
|
malformedPercentEncoding: relativeMalformedPercentEncoding,
|
|
42772
43461
|
malformedSchemeSpecific: relativeMalformedSchemeSpecific,
|
|
42773
43462
|
malformedHost: relativeMalformedHost,
|
|
42774
43463
|
malformedScheme: relativeMalformedScheme
|
|
42775
43464
|
} = parseWithStatus(relativeURI, schemelessOptions);
|
|
42776
|
-
if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
|
|
43465
|
+
if (baseMalformed || relativeMalformed || baseMalformedReferenceEdge || relativeMalformedReferenceEdge || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
|
|
42777
43466
|
throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
42778
43467
|
}
|
|
42779
43468
|
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
42780
43469
|
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
42781
43470
|
const resolvedHost = resolved.host;
|
|
43471
|
+
if ((resolved.scheme === "http" || resolved.scheme === "https") && !resolvedHost) {
|
|
43472
|
+
throw new Error("HTTP URIs must have a host.");
|
|
43473
|
+
}
|
|
42782
43474
|
const resolvedHostIsIP = resolvedHost !== undefined && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
42783
43475
|
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
42784
43476
|
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
|
|
@@ -42786,6 +43478,9 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
42786
43478
|
throw new Error(resolved.error);
|
|
42787
43479
|
}
|
|
42788
43480
|
schemelessOptions.skipEscape = true;
|
|
43481
|
+
if (resolvedSchemeHandler && resolvedSchemeHandler.absolutePath) {
|
|
43482
|
+
schemelessOptions.absolutePath = true;
|
|
43483
|
+
}
|
|
42789
43484
|
return serialize(resolved, schemelessOptions);
|
|
42790
43485
|
}
|
|
42791
43486
|
function copyHost(target, source) {
|
|
@@ -42806,7 +43501,8 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
42806
43501
|
target.userinfo = relative.userinfo;
|
|
42807
43502
|
copyHost(target, relative);
|
|
42808
43503
|
target.port = relative.port;
|
|
42809
|
-
|
|
43504
|
+
const relativeSchemeHandler = getSchemeHandler(relative.scheme);
|
|
43505
|
+
target.path = relativeSchemeHandler && relativeSchemeHandler.absolutePath ? relative.path || "" : removeDotSegments(relative.path || "");
|
|
42810
43506
|
target.query = relative.query;
|
|
42811
43507
|
} else {
|
|
42812
43508
|
if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
|
|
@@ -42895,7 +43591,8 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
42895
43591
|
component.scheme = decodeValidScheme(component.scheme);
|
|
42896
43592
|
uriTokens.push(component.scheme, ":");
|
|
42897
43593
|
}
|
|
42898
|
-
const
|
|
43594
|
+
const allowNonAsciiHost = options.unicodeSupport === true || Boolean(schemeHandler && schemeHandler.unicodeSupport);
|
|
43595
|
+
const authority = recomposeAuthority(component, allowNonAsciiHost);
|
|
42899
43596
|
if (authority !== undefined) {
|
|
42900
43597
|
if (options.reference !== "suffix") {
|
|
42901
43598
|
uriTokens.push("//");
|
|
@@ -42981,6 +43678,7 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
42981
43678
|
fragment: undefined
|
|
42982
43679
|
};
|
|
42983
43680
|
let malformedAuthorityOrPort = false;
|
|
43681
|
+
const malformedReferenceEdge = uri.length !== 0 && (uri.charCodeAt(0) <= 32 || uri.charCodeAt(uri.length - 1) <= 32);
|
|
42984
43682
|
let malformedPercentEncoding = false;
|
|
42985
43683
|
let malformedSchemeSpecific = false;
|
|
42986
43684
|
let malformedHost = false;
|
|
@@ -43013,6 +43711,9 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
43013
43711
|
}
|
|
43014
43712
|
}
|
|
43015
43713
|
}
|
|
43714
|
+
if (malformedReferenceEdge) {
|
|
43715
|
+
parsed.error = parsed.error || "URI must not contain leading or trailing C0 controls or spaces.";
|
|
43716
|
+
}
|
|
43016
43717
|
const matches = uri.match(URI_PARSE);
|
|
43017
43718
|
if (matches) {
|
|
43018
43719
|
parsed.scheme = matches[1];
|
|
@@ -43079,12 +43780,18 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
43079
43780
|
if (!malformedIPLiteral) {
|
|
43080
43781
|
malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
|
|
43081
43782
|
}
|
|
43082
|
-
if (
|
|
43083
|
-
let host =
|
|
43084
|
-
if (!isIP) {
|
|
43783
|
+
if (parsed.host !== undefined && !malformedIPLiteral) {
|
|
43784
|
+
let host = parsed.host;
|
|
43785
|
+
if (uri.indexOf("%") !== -1 && !isIP) {
|
|
43786
|
+
host = normalizePercentEncoding(host, true);
|
|
43085
43787
|
host = normalizePercentEncoding(host.toLowerCase());
|
|
43086
43788
|
}
|
|
43087
|
-
|
|
43789
|
+
if (options.scheme !== "null") {
|
|
43790
|
+
const allowNonAsciiHost = options.unicodeSupport === true || Boolean(schemeHandler && schemeHandler.unicodeSupport);
|
|
43791
|
+
parsed.host = encodeHost(host, isIP, allowNonAsciiHost);
|
|
43792
|
+
} else {
|
|
43793
|
+
parsed.host = host;
|
|
43794
|
+
}
|
|
43088
43795
|
}
|
|
43089
43796
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
43090
43797
|
if (parsed.path) {
|
|
@@ -43106,7 +43813,7 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
43106
43813
|
} else {
|
|
43107
43814
|
parsed.error = parsed.error || "URI can not be parsed.";
|
|
43108
43815
|
}
|
|
43109
|
-
return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
|
|
43816
|
+
return { parsed, malformedAuthorityOrPort, malformedReferenceEdge, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
|
|
43110
43817
|
}
|
|
43111
43818
|
function parse(uri, opts) {
|
|
43112
43819
|
return parseWithStatus(uri, opts).parsed;
|
|
@@ -43115,10 +43822,11 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
43115
43822
|
return normalizeStringWithStatus(uri, opts).normalized;
|
|
43116
43823
|
}
|
|
43117
43824
|
function normalizeStringWithStatus(uri, opts) {
|
|
43118
|
-
const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
43825
|
+
const { parsed, malformedAuthorityOrPort, malformedReferenceEdge, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
43119
43826
|
return {
|
|
43120
|
-
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
|
|
43827
|
+
normalized: malformedAuthorityOrPort || malformedReferenceEdge || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
|
|
43121
43828
|
malformedAuthorityOrPort,
|
|
43829
|
+
malformedReferenceEdge,
|
|
43122
43830
|
malformedPercentEncoding,
|
|
43123
43831
|
malformedSchemeSpecific,
|
|
43124
43832
|
malformedHost,
|
|
@@ -43135,8 +43843,8 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
43135
43843
|
} catch {
|
|
43136
43844
|
return;
|
|
43137
43845
|
}
|
|
43138
|
-
const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
|
|
43139
|
-
return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? undefined : normalized;
|
|
43846
|
+
const { normalized, malformedAuthorityOrPort, malformedReferenceEdge, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
|
|
43847
|
+
return malformedAuthorityOrPort || malformedReferenceEdge || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? undefined : normalized;
|
|
43140
43848
|
}
|
|
43141
43849
|
var fastUri = {
|
|
43142
43850
|
SCHEMES,
|
|
@@ -51369,7 +52077,7 @@ var require_limit = __commonJS(function(exports) {
|
|
|
51369
52077
|
});
|
|
51370
52078
|
|
|
51371
52079
|
// node_modules/ajv-formats/dist/index.js
|
|
51372
|
-
var
|
|
52080
|
+
var require_dist7 = __commonJS(function(exports, module) {
|
|
51373
52081
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51374
52082
|
var formats_1 = require_formats2();
|
|
51375
52083
|
var limit_1 = require_limit();
|
|
@@ -51447,7 +52155,7 @@ class AjvJsonSchemaValidator {
|
|
|
51447
52155
|
var import_ajv, import_ajv_formats;
|
|
51448
52156
|
var init_ajv_provider = __esm(() => {
|
|
51449
52157
|
import_ajv = __toESM(require_ajv(), 1);
|
|
51450
|
-
import_ajv_formats = __toESM(
|
|
52158
|
+
import_ajv_formats = __toESM(require_dist7(), 1);
|
|
51451
52159
|
});
|
|
51452
52160
|
|
|
51453
52161
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
@@ -51458,6 +52166,62 @@ class ExperimentalServerTasks {
|
|
|
51458
52166
|
requestStream(request, resultSchema, options) {
|
|
51459
52167
|
return this._server.requestStream(request, resultSchema, options);
|
|
51460
52168
|
}
|
|
52169
|
+
createMessageStream(params, options) {
|
|
52170
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
52171
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
52172
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
52173
|
+
}
|
|
52174
|
+
if (params.messages.length > 0) {
|
|
52175
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
52176
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
52177
|
+
const hasToolResults = lastContent.some((c) => c.type === "tool_result");
|
|
52178
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
|
|
52179
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
52180
|
+
const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
|
|
52181
|
+
if (hasToolResults) {
|
|
52182
|
+
if (lastContent.some((c) => c.type !== "tool_result")) {
|
|
52183
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
52184
|
+
}
|
|
52185
|
+
if (!hasPreviousToolUse) {
|
|
52186
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
52187
|
+
}
|
|
52188
|
+
}
|
|
52189
|
+
if (hasPreviousToolUse) {
|
|
52190
|
+
const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
|
|
52191
|
+
const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
|
|
52192
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
52193
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
52194
|
+
}
|
|
52195
|
+
}
|
|
52196
|
+
}
|
|
52197
|
+
return this.requestStream({
|
|
52198
|
+
method: "sampling/createMessage",
|
|
52199
|
+
params
|
|
52200
|
+
}, CreateMessageResultSchema, options);
|
|
52201
|
+
}
|
|
52202
|
+
elicitInputStream(params, options) {
|
|
52203
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
52204
|
+
const mode = params.mode ?? "form";
|
|
52205
|
+
switch (mode) {
|
|
52206
|
+
case "url": {
|
|
52207
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
52208
|
+
throw new Error("Client does not support url elicitation.");
|
|
52209
|
+
}
|
|
52210
|
+
break;
|
|
52211
|
+
}
|
|
52212
|
+
case "form": {
|
|
52213
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
52214
|
+
throw new Error("Client does not support form elicitation.");
|
|
52215
|
+
}
|
|
52216
|
+
break;
|
|
52217
|
+
}
|
|
52218
|
+
}
|
|
52219
|
+
const normalizedParams = mode === "form" && params.mode === undefined ? { ...params, mode: "form" } : params;
|
|
52220
|
+
return this.requestStream({
|
|
52221
|
+
method: "elicitation/create",
|
|
52222
|
+
params: normalizedParams
|
|
52223
|
+
}, ElicitResultSchema, options);
|
|
52224
|
+
}
|
|
51461
52225
|
async getTask(taskId, options) {
|
|
51462
52226
|
return this._server.getTask({ taskId }, options);
|
|
51463
52227
|
}
|
|
@@ -51471,6 +52235,9 @@ class ExperimentalServerTasks {
|
|
|
51471
52235
|
return this._server.cancelTask({ taskId }, options);
|
|
51472
52236
|
}
|
|
51473
52237
|
}
|
|
52238
|
+
var init_server = __esm(() => {
|
|
52239
|
+
init_types();
|
|
52240
|
+
});
|
|
51474
52241
|
|
|
51475
52242
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
51476
52243
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
@@ -51509,11 +52276,12 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
51509
52276
|
|
|
51510
52277
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
51511
52278
|
var Server;
|
|
51512
|
-
var
|
|
52279
|
+
var init_server2 = __esm(() => {
|
|
51513
52280
|
init_protocol();
|
|
51514
52281
|
init_types();
|
|
51515
52282
|
init_ajv_provider();
|
|
51516
52283
|
init_zod_compat();
|
|
52284
|
+
init_server();
|
|
51517
52285
|
Server = class Server extends Protocol {
|
|
51518
52286
|
constructor(_serverInfo, options) {
|
|
51519
52287
|
super(options);
|
|
@@ -51561,16 +52329,7 @@ var init_server = __esm(() => {
|
|
|
51561
52329
|
if (!methodSchema) {
|
|
51562
52330
|
throw new Error("Schema is missing a method literal");
|
|
51563
52331
|
}
|
|
51564
|
-
|
|
51565
|
-
if (isZ4Schema(methodSchema)) {
|
|
51566
|
-
const v4Schema = methodSchema;
|
|
51567
|
-
const v4Def = v4Schema._zod?.def;
|
|
51568
|
-
methodValue = v4Def?.value ?? v4Schema.value;
|
|
51569
|
-
} else {
|
|
51570
|
-
const v3Schema = methodSchema;
|
|
51571
|
-
const legacyDef = v3Schema._def;
|
|
51572
|
-
methodValue = legacyDef?.value ?? v3Schema.value;
|
|
51573
|
-
}
|
|
52332
|
+
const methodValue = getLiteralValue(methodSchema);
|
|
51574
52333
|
if (typeof methodValue !== "string") {
|
|
51575
52334
|
throw new Error("Schema method literal must be a string");
|
|
51576
52335
|
}
|
|
@@ -51939,6 +52698,43 @@ class ExperimentalMcpServerTasks {
|
|
|
51939
52698
|
}
|
|
51940
52699
|
|
|
51941
52700
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
52701
|
+
function toolInputElementCount(value, max) {
|
|
52702
|
+
let count = 0;
|
|
52703
|
+
const stack = [value];
|
|
52704
|
+
while (stack.length > 0) {
|
|
52705
|
+
const node = stack.pop();
|
|
52706
|
+
if (node === null || typeof node !== "object")
|
|
52707
|
+
continue;
|
|
52708
|
+
if (Array.isArray(node)) {
|
|
52709
|
+
for (const child of node) {
|
|
52710
|
+
if (++count > max)
|
|
52711
|
+
return count;
|
|
52712
|
+
if (child !== null && typeof child === "object")
|
|
52713
|
+
stack.push(child);
|
|
52714
|
+
}
|
|
52715
|
+
} else {
|
|
52716
|
+
for (const key in node) {
|
|
52717
|
+
if (!Object.prototype.hasOwnProperty.call(node, key))
|
|
52718
|
+
continue;
|
|
52719
|
+
if (++count > max)
|
|
52720
|
+
return count;
|
|
52721
|
+
const child = node[key];
|
|
52722
|
+
if (child !== null && typeof child === "object")
|
|
52723
|
+
stack.push(child);
|
|
52724
|
+
}
|
|
52725
|
+
}
|
|
52726
|
+
}
|
|
52727
|
+
return count;
|
|
52728
|
+
}
|
|
52729
|
+
function resolveMaxToolInputElements(value) {
|
|
52730
|
+
if (value === undefined || value === Infinity)
|
|
52731
|
+
return;
|
|
52732
|
+
if (typeof value !== "number" || Number.isNaN(value) || value < 1) {
|
|
52733
|
+
throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(value)}`);
|
|
52734
|
+
}
|
|
52735
|
+
return value;
|
|
52736
|
+
}
|
|
52737
|
+
|
|
51942
52738
|
class McpServer {
|
|
51943
52739
|
constructor(serverInfo, options) {
|
|
51944
52740
|
this._registeredResources = {};
|
|
@@ -51950,6 +52746,7 @@ class McpServer {
|
|
|
51950
52746
|
this._resourceHandlersInitialized = false;
|
|
51951
52747
|
this._promptHandlersInitialized = false;
|
|
51952
52748
|
this.server = new Server(serverInfo, options);
|
|
52749
|
+
this._maxToolInputElements = resolveMaxToolInputElements(options?.maxToolInputElements);
|
|
51953
52750
|
}
|
|
51954
52751
|
get experimental() {
|
|
51955
52752
|
if (!this._experimental) {
|
|
@@ -52056,12 +52853,15 @@ class McpServer {
|
|
|
52056
52853
|
};
|
|
52057
52854
|
}
|
|
52058
52855
|
async validateToolInput(tool, args, toolName) {
|
|
52856
|
+
if (this._maxToolInputElements !== undefined && toolInputElementCount(args, this._maxToolInputElements) > this._maxToolInputElements) {
|
|
52857
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for tool ${toolName}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);
|
|
52858
|
+
}
|
|
52059
52859
|
if (!tool.inputSchema) {
|
|
52060
52860
|
return;
|
|
52061
52861
|
}
|
|
52062
52862
|
const inputObj = normalizeObjectSchema(tool.inputSchema);
|
|
52063
52863
|
const schemaToParse = inputObj ?? tool.inputSchema;
|
|
52064
|
-
const parseResult = await safeParseAsync3(schemaToParse, args);
|
|
52864
|
+
const parseResult = await safeParseAsync3(schemaToParse, args ?? {});
|
|
52065
52865
|
if (!parseResult.success) {
|
|
52066
52866
|
const error = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
52067
52867
|
const errorMessage = getParseErrorMessage(error);
|
|
@@ -52286,7 +53086,7 @@ class McpServer {
|
|
|
52286
53086
|
}
|
|
52287
53087
|
if (prompt.argsSchema) {
|
|
52288
53088
|
const argsObj = normalizeObjectSchema(prompt.argsSchema);
|
|
52289
|
-
const parseResult = await safeParseAsync3(argsObj, request.params.arguments);
|
|
53089
|
+
const parseResult = await safeParseAsync3(argsObj, request.params.arguments ?? {});
|
|
52290
53090
|
if (!parseResult.success) {
|
|
52291
53091
|
const error = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
52292
53092
|
const errorMessage = getParseErrorMessage(error);
|
|
@@ -52522,6 +53322,9 @@ class McpServer {
|
|
|
52522
53322
|
annotations = rest.shift();
|
|
52523
53323
|
}
|
|
52524
53324
|
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
53325
|
+
if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
|
|
53326
|
+
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
53327
|
+
}
|
|
52525
53328
|
annotations = rest.shift();
|
|
52526
53329
|
}
|
|
52527
53330
|
}
|
|
@@ -52610,6 +53413,9 @@ function getZodSchemaObject(schema) {
|
|
|
52610
53413
|
if (isZodRawShapeCompat(schema)) {
|
|
52611
53414
|
return objectFromShape(schema);
|
|
52612
53415
|
}
|
|
53416
|
+
if (!isZodSchemaInstance(schema)) {
|
|
53417
|
+
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
53418
|
+
}
|
|
52613
53419
|
return schema;
|
|
52614
53420
|
}
|
|
52615
53421
|
function promptArgumentsFromSchema(schema) {
|
|
@@ -52649,7 +53455,7 @@ function createCompletionResult(suggestions) {
|
|
|
52649
53455
|
}
|
|
52650
53456
|
var EMPTY_OBJECT_JSON_SCHEMA, EMPTY_COMPLETION_RESULT;
|
|
52651
53457
|
var init_mcp = __esm(() => {
|
|
52652
|
-
|
|
53458
|
+
init_server2();
|
|
52653
53459
|
init_zod_compat();
|
|
52654
53460
|
init_zod_json_schema_compat();
|
|
52655
53461
|
init_types();
|
|
@@ -52844,9 +53650,9 @@ var init_config = __esm(() => {
|
|
|
52844
53650
|
SDK_METADATA = {
|
|
52845
53651
|
language: "typescript",
|
|
52846
53652
|
openapiDocVersion: "1.0.0",
|
|
52847
|
-
sdkVersion: "0.4.
|
|
52848
|
-
genVersion: "2.
|
|
52849
|
-
userAgent: "speakeasy-sdk/mcp-typescript 0.4.
|
|
53653
|
+
sdkVersion: "0.4.15",
|
|
53654
|
+
genVersion: "2.948.4",
|
|
53655
|
+
userAgent: "speakeasy-sdk/mcp-typescript 0.4.15 2.948.4 1.0.0 @lightsage/mcp"
|
|
52850
53656
|
};
|
|
52851
53657
|
});
|
|
52852
53658
|
|
|
@@ -55927,7 +56733,7 @@ var init_evalRunsList2 = __esm(() => {
|
|
|
55927
56733
|
name: "eval-runs-list",
|
|
55928
56734
|
description: `List Runs
|
|
55929
56735
|
|
|
55930
|
-
Returns
|
|
56736
|
+
Returns custom eval runs, ordered newest first, with lifecycle state and progress. Includes scheduled, onboarding, and pull request runs and runs started in the Lightsage app, as well as runs started through \`POST /v2/eval-runs\`.`,
|
|
55931
56737
|
annotations: {
|
|
55932
56738
|
title: "",
|
|
55933
56739
|
destructiveHint: false,
|
|
@@ -58370,12 +59176,13 @@ var init_createevaltemplaterequest = __esm(() => {
|
|
|
58370
59176
|
judges: array(GraderDefinition$zodSchema).optional().describe("Judge definitions copied when `judges` is included. May be empty to explicitly create the eval without template judges."),
|
|
58371
59177
|
name: string2().describe("Organization-visible name for this reusable template."),
|
|
58372
59178
|
persona: string2().optional().describe("Optional persona copied when `persona` is included."),
|
|
59179
|
+
prompt: string2().optional().describe('Prompt filled into the new eval form when the template is applied, or the scenario for Agent Preference, where `{{"{{"}}competitor_name}}` names the brand each comparison is against. Requests that create evals from a template still supply their own prompts.'),
|
|
58373
59180
|
runs_per_execution: int().default(1).describe("Attempt count copied when `runs` is included."),
|
|
58374
59181
|
runtime: EvalTemplateRuntime$zodSchema.optional().describe("Reusable runtime resources copied into each created eval."),
|
|
58375
59182
|
schedule: EvalTemplateSchedule$zodSchema.optional().describe("Schedule copied into every eval created from the template."),
|
|
58376
59183
|
tag: string2().optional().describe("Optional tag copied when `tag` is included."),
|
|
58377
59184
|
target_keys: array(string2()).optional().describe("Runnable target keys copied when `targets` is included, such as `agent:codex:gpt-5.6-terra`.")
|
|
58378
|
-
}).describe("Create reusable
|
|
59185
|
+
}).describe("Create a reusable eval that can be applied to many brands or prompts.");
|
|
58379
59186
|
});
|
|
58380
59187
|
|
|
58381
59188
|
// src/funcs/evalTemplatesCreate.ts
|
|
@@ -58530,6 +59337,7 @@ var init_evaltemplate = __esm(() => {
|
|
|
58530
59337
|
name: string2().describe("Organization-visible name for this reusable template."),
|
|
58531
59338
|
org_id: string2(),
|
|
58532
59339
|
persona: string2().nullable().optional().describe("Optional persona copied when `persona` is included."),
|
|
59340
|
+
prompt: string2().nullable().optional().describe('Prompt filled into the new eval form when the template is applied, or the scenario for Agent Preference, where `{{"{{"}}competitor_name}}` names the brand each comparison is against. Requests that create evals from a template still supply their own prompts.'),
|
|
58533
59341
|
runs_per_execution: int().default(1).describe("Attempt count copied when `runs` is included."),
|
|
58534
59342
|
runtime: EvalTemplateRuntime$zodSchema.optional().describe("Reusable runtime resources copied into each created eval."),
|
|
58535
59343
|
schedule: EvalTemplateSchedule$zodSchema.optional().describe("Schedule copied into every eval created from the template."),
|
|
@@ -58940,6 +59748,7 @@ var init_updateevaltemplaterequest = __esm(() => {
|
|
|
58940
59748
|
judges: array(GraderDefinition$zodSchema).nullable().optional(),
|
|
58941
59749
|
name: string2().optional(),
|
|
58942
59750
|
persona: string2().optional(),
|
|
59751
|
+
prompt: string2().optional(),
|
|
58943
59752
|
runs_per_execution: int().optional(),
|
|
58944
59753
|
runtime: EvalTemplateRuntime$zodSchema.nullable().optional(),
|
|
58945
59754
|
schedule: EvalTemplateSchedule$zodSchema.nullable().optional(),
|
|
@@ -62771,15 +63580,24 @@ Checks API liveness without authentication. Use \`GET /v2/auth/status\` to valid
|
|
|
62771
63580
|
});
|
|
62772
63581
|
|
|
62773
63582
|
// src/models/v2publictask.ts
|
|
62774
|
-
var V2PublicTask$zodSchema, V2PublicTask$zodSchemaOutbound;
|
|
63583
|
+
var ContentStatus$zodSchema, V2PublicTask$zodSchema, V2PublicTask$zodSchemaOutbound;
|
|
62775
63584
|
var init_v2publictask = __esm(() => {
|
|
62776
63585
|
init_zod();
|
|
62777
63586
|
init_schemas4();
|
|
63587
|
+
ContentStatus$zodSchema = _enum([
|
|
63588
|
+
"none",
|
|
63589
|
+
"writing",
|
|
63590
|
+
"ready",
|
|
63591
|
+
"failed"
|
|
63592
|
+
]).describe("Progress of the Markdown write-up in `content`.");
|
|
62778
63593
|
V2PublicTask$zodSchema = collectExtraKeys(object({
|
|
62779
63594
|
action_date: string2(),
|
|
62780
63595
|
action_type: string2().nullable().optional(),
|
|
62781
63596
|
assignee_user_id: string2().nullable().optional(),
|
|
62782
63597
|
batch_number: int(),
|
|
63598
|
+
content: string2().nullable().optional().describe("The task's Markdown write-up covering what went wrong, how to fix it, the impact, and the evidence. Null until the write-up is generated; see `content_status`."),
|
|
63599
|
+
content_status: ContentStatus$zodSchema.default("none").describe("Progress of the Markdown write-up in `content`."),
|
|
63600
|
+
content_written_at: string2().nullable().optional().describe("When the write-up in `content` was last generated."),
|
|
62783
63601
|
created_at: string2().nullable().optional(),
|
|
62784
63602
|
description: string2().nullable().optional(),
|
|
62785
63603
|
effort: string2().describe("A free-form effort estimate such as `Low` or `Medium`; this field is not an enum."),
|
|
@@ -62797,7 +63615,8 @@ var init_v2publictask = __esm(() => {
|
|
|
62797
63615
|
source_key: string2().describe("A finding key namespaced by source, such as `api_perf:https://example.com/docs/cli`."),
|
|
62798
63616
|
source_refs: record(string2(), any()).optional().describe("Source references needed to understand or execute the task."),
|
|
62799
63617
|
source_type: string2().nullable().optional().describe("A free-form source type such as `api_performance`; manually created tasks may not have a source."),
|
|
62800
|
-
status: string2().describe("The workflow status. New tasks start as `new
|
|
63618
|
+
status: string2().describe("The workflow status. New tasks start as `new`. A task is `in_review` while its content waits to go live, as an open pull request or a CMS draft; it is listed with `in_progress` tasks. `added_to_sheet` and `snoozed` tasks are listed only when `status=all`."),
|
|
63619
|
+
target_url: string2().nullable().optional().describe("The page the fix should be made on, when the task targets one."),
|
|
62801
63620
|
task_type: string2().describe("A free-form label such as `Redirect` or `Docs`; this field is not an enum."),
|
|
62802
63621
|
title: string2(),
|
|
62803
63622
|
updated_at: string2().nullable().optional(),
|
|
@@ -62809,6 +63628,9 @@ var init_v2publictask = __esm(() => {
|
|
|
62809
63628
|
action_type: nullable(string2()).optional(),
|
|
62810
63629
|
assignee_user_id: nullable(string2()).optional(),
|
|
62811
63630
|
batch_number: int(),
|
|
63631
|
+
content: nullable(string2()).optional(),
|
|
63632
|
+
content_status: ContentStatus$zodSchema.default("none"),
|
|
63633
|
+
content_written_at: nullable(string2()).optional(),
|
|
62812
63634
|
created_at: nullable(string2()).optional(),
|
|
62813
63635
|
description: nullable(string2()).optional(),
|
|
62814
63636
|
effort: string2(),
|
|
@@ -62827,6 +63649,7 @@ var init_v2publictask = __esm(() => {
|
|
|
62827
63649
|
source_refs: record(string2(), any()).optional(),
|
|
62828
63650
|
source_type: nullable(string2()).optional(),
|
|
62829
63651
|
status: string2(),
|
|
63652
|
+
target_url: nullable(string2()).optional(),
|
|
62830
63653
|
task_type: string2(),
|
|
62831
63654
|
title: string2(),
|
|
62832
63655
|
updated_at: nullable(string2()).optional(),
|
|
@@ -64117,7 +64940,7 @@ function createMCPServer(deps) {
|
|
|
64117
64940
|
sizes: ["any"]
|
|
64118
64941
|
}],
|
|
64119
64942
|
name: "LightsageMcp",
|
|
64120
|
-
version: "0.4.
|
|
64943
|
+
version: "0.4.15"
|
|
64121
64944
|
});
|
|
64122
64945
|
const getClient = deps.getSDK || (() => new LightsageMcpCore({
|
|
64123
64946
|
security: deps.security,
|
|
@@ -64206,7 +65029,7 @@ function createMCPServer(deps) {
|
|
|
64206
65029
|
}
|
|
64207
65030
|
return { server, tools };
|
|
64208
65031
|
}
|
|
64209
|
-
var
|
|
65032
|
+
var init_server3 = __esm(() => {
|
|
64210
65033
|
init_mcp();
|
|
64211
65034
|
init_core3();
|
|
64212
65035
|
init_resources();
|
|
@@ -64535,7 +65358,7 @@ Soft-deletes an Eval template. Evals previously created from it remain independe
|
|
|
64535
65358
|
},
|
|
64536
65359
|
{
|
|
64537
65360
|
name: "eval-runs-list",
|
|
64538
|
-
description: "List Runs\n\nReturns
|
|
65361
|
+
description: "List Runs\n\nReturns custom eval runs, ordered newest first, with lifecycle state and progress. Includes scheduled, onboarding, and pull request runs and runs started in the Lightsage app, as well as runs started through `POST /v2/eval-runs`."
|
|
64539
65362
|
},
|
|
64540
65363
|
{
|
|
64541
65364
|
name: "agent-preference-competitors-list",
|
|
@@ -65541,7 +66364,7 @@ http_headers = { "lightsage-api-key-auth" = "YOUR_LIGHTSAGE_API_KEY_AUTH" }`;
|
|
|
65541
66364
|
<h1>Instructions</h1>
|
|
65542
66365
|
<p>One-click installation for Claude Desktop users</p>
|
|
65543
66366
|
<div class="instruction-item">
|
|
65544
|
-
<a href="https://github.com/lightsagehq/mcp/releases/download/v0.4.
|
|
66367
|
+
<a href="https://github.com/lightsagehq/mcp/releases/download/v0.4.15/mcp-server.mcpb" download="mcp-server.mcpb" class="action-button header-action" style="display: inline-flex; margin-bottom: 16px;">
|
|
65545
66368
|
\uD83D\uDCE5 Download MCP Bundle
|
|
65546
66369
|
</a>
|
|
65547
66370
|
</div>
|
|
@@ -65761,7 +66584,7 @@ var import_express;
|
|
|
65761
66584
|
var init_impl = __esm(() => {
|
|
65762
66585
|
init_streamableHttp();
|
|
65763
66586
|
init_console_logger();
|
|
65764
|
-
|
|
66587
|
+
init_server3();
|
|
65765
66588
|
init_tools();
|
|
65766
66589
|
init_tools();
|
|
65767
66590
|
init_landing_page();
|
|
@@ -65770,6 +66593,7 @@ var init_impl = __esm(() => {
|
|
|
65770
66593
|
|
|
65771
66594
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.js
|
|
65772
66595
|
import { randomUUID } from "node:crypto";
|
|
66596
|
+
import { TLSSocket } from "node:tls";
|
|
65773
66597
|
import { URL as URL2 } from "node:url";
|
|
65774
66598
|
|
|
65775
66599
|
class SSEServerTransport {
|
|
@@ -65833,10 +66657,16 @@ data: ${relativeUrlWithSession}
|
|
|
65833
66657
|
return;
|
|
65834
66658
|
}
|
|
65835
66659
|
const authInfo = req.auth;
|
|
65836
|
-
const
|
|
66660
|
+
const host = req.headers.host;
|
|
66661
|
+
const protocol = req.socket instanceof TLSSocket ? "https" : "http";
|
|
66662
|
+
const fullUrl = host && req.url ? new URL2(req.url, `${protocol}://${host}`) : undefined;
|
|
66663
|
+
const requestInfo = {
|
|
66664
|
+
headers: req.headers,
|
|
66665
|
+
url: fullUrl
|
|
66666
|
+
};
|
|
65837
66667
|
let body;
|
|
65838
66668
|
try {
|
|
65839
|
-
const ct =
|
|
66669
|
+
const ct = $parse(req.headers["content-type"] ?? "");
|
|
65840
66670
|
if (ct.type !== "application/json") {
|
|
65841
66671
|
throw new Error(`Unsupported content-type: ${ct.type}`);
|
|
65842
66672
|
}
|
|
@@ -65885,16 +66715,24 @@ data: ${JSON.stringify(message)}
|
|
|
65885
66715
|
return this._sessionId;
|
|
65886
66716
|
}
|
|
65887
66717
|
}
|
|
65888
|
-
var import_raw_body,
|
|
66718
|
+
var import_raw_body, MAXIMUM_MESSAGE_SIZE = "4mb";
|
|
65889
66719
|
var init_sse = __esm(() => {
|
|
65890
66720
|
init_types();
|
|
66721
|
+
init_content_type();
|
|
65891
66722
|
import_raw_body = __toESM(require_raw_body(), 1);
|
|
65892
|
-
import_content_type = __toESM(require_content_type(), 1);
|
|
65893
66723
|
});
|
|
65894
66724
|
|
|
65895
66725
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
65896
66726
|
class ReadBuffer {
|
|
66727
|
+
constructor(options) {
|
|
66728
|
+
this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
66729
|
+
}
|
|
65897
66730
|
append(chunk) {
|
|
66731
|
+
const newSize = (this._buffer?.length ?? 0) + chunk.length;
|
|
66732
|
+
if (newSize > this._maxBufferSize) {
|
|
66733
|
+
this.clear();
|
|
66734
|
+
throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
|
|
66735
|
+
}
|
|
65898
66736
|
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
|
|
65899
66737
|
}
|
|
65900
66738
|
readMessage() {
|
|
@@ -65921,26 +66759,33 @@ function serializeMessage(message) {
|
|
|
65921
66759
|
return JSON.stringify(message) + `
|
|
65922
66760
|
`;
|
|
65923
66761
|
}
|
|
66762
|
+
var STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
65924
66763
|
var init_stdio = __esm(() => {
|
|
65925
66764
|
init_types();
|
|
66765
|
+
STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
|
|
65926
66766
|
});
|
|
65927
66767
|
|
|
65928
66768
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
65929
66769
|
import process2 from "node:process";
|
|
65930
66770
|
|
|
65931
66771
|
class StdioServerTransport {
|
|
65932
|
-
constructor(_stdin = process2.stdin, _stdout = process2.stdout) {
|
|
66772
|
+
constructor(_stdin = process2.stdin, _stdout = process2.stdout, options) {
|
|
65933
66773
|
this._stdin = _stdin;
|
|
65934
66774
|
this._stdout = _stdout;
|
|
65935
|
-
this._readBuffer = new ReadBuffer;
|
|
65936
66775
|
this._started = false;
|
|
65937
66776
|
this._ondata = (chunk) => {
|
|
65938
|
-
|
|
65939
|
-
|
|
66777
|
+
try {
|
|
66778
|
+
this._readBuffer.append(chunk);
|
|
66779
|
+
this.processReadBuffer();
|
|
66780
|
+
} catch (error) {
|
|
66781
|
+
this.onerror?.(error);
|
|
66782
|
+
this.close().catch(() => {});
|
|
66783
|
+
}
|
|
65940
66784
|
};
|
|
65941
66785
|
this._onerror = (error) => {
|
|
65942
66786
|
this.onerror?.(error);
|
|
65943
66787
|
};
|
|
66788
|
+
this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
|
|
65944
66789
|
}
|
|
65945
66790
|
async start() {
|
|
65946
66791
|
if (this._started) {
|
|
@@ -66147,7 +66992,7 @@ var init_impl2 = __esm(() => {
|
|
|
66147
66992
|
init_sse();
|
|
66148
66993
|
init_stdio2();
|
|
66149
66994
|
init_console_logger();
|
|
66150
|
-
|
|
66995
|
+
init_server3();
|
|
66151
66996
|
init_tools();
|
|
66152
66997
|
init_landing_page();
|
|
66153
66998
|
import_express2 = __toESM(require_express(), 1);
|
|
@@ -68419,7 +69264,7 @@ var routes = buildRouteMap({
|
|
|
68419
69264
|
var app = buildApplication(routes, {
|
|
68420
69265
|
name: "mcp",
|
|
68421
69266
|
versionInfo: {
|
|
68422
|
-
currentVersion: "0.4.
|
|
69267
|
+
currentVersion: "0.4.15"
|
|
68423
69268
|
}
|
|
68424
69269
|
});
|
|
68425
69270
|
run(app, process3.argv.slice(2), buildContext(process3));
|
|
@@ -68427,5 +69272,5 @@ export {
|
|
|
68427
69272
|
app
|
|
68428
69273
|
};
|
|
68429
69274
|
|
|
68430
|
-
//# debugId=
|
|
69275
|
+
//# debugId=E3C4ACAC8665A9C164756E2164756E21
|
|
68431
69276
|
//# sourceMappingURL=mcp-server.js.map
|