@lightsage/mcp 0.4.23 → 0.4.25

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.
Files changed (96) hide show
  1. package/README.md +2 -2
  2. package/api/mcp.js +3 -2
  3. package/bin/mcp-server.js +1359 -433
  4. package/bin/mcp-server.js.map +27 -19
  5. package/esm/funcs/pluginEvalsResultsList.d.ts +16 -0
  6. package/esm/funcs/pluginEvalsResultsList.d.ts.map +1 -0
  7. package/esm/funcs/pluginEvalsResultsList.js +86 -0
  8. package/esm/funcs/pluginEvalsResultsList.js.map +1 -0
  9. package/esm/landing-page.js +1 -1
  10. package/esm/lib/config.d.ts +2 -2
  11. package/esm/lib/config.js +2 -2
  12. package/esm/mcp-server/mcp-server.js +1 -1
  13. package/esm/mcp-server/server.d.ts.map +1 -1
  14. package/esm/mcp-server/server.js +3 -1
  15. package/esm/mcp-server/server.js.map +1 -1
  16. package/esm/mcp-server/tools/pluginEvalsResultsList.d.ts +7 -0
  17. package/esm/mcp-server/tools/pluginEvalsResultsList.d.ts.map +1 -0
  18. package/esm/mcp-server/tools/pluginEvalsResultsList.js +35 -0
  19. package/esm/mcp-server/tools/pluginEvalsResultsList.js.map +1 -0
  20. package/esm/models/createv2evalrequest.d.ts +1 -0
  21. package/esm/models/createv2evalrequest.d.ts.map +1 -1
  22. package/esm/models/createv2evalrequest.js +1 -0
  23. package/esm/models/createv2evalrequest.js.map +1 -1
  24. package/esm/models/createv2evalrunrequest.d.ts +1 -0
  25. package/esm/models/createv2evalrunrequest.d.ts.map +1 -1
  26. package/esm/models/createv2evalrunrequest.js +1 -0
  27. package/esm/models/createv2evalrunrequest.js.map +1 -1
  28. package/esm/models/graderdefinition.d.ts +1 -0
  29. package/esm/models/graderdefinition.d.ts.map +1 -1
  30. package/esm/models/graderdefinition.js +1 -0
  31. package/esm/models/graderdefinition.js.map +1 -1
  32. package/esm/models/publiccriterionverdict.d.ts +4 -2
  33. package/esm/models/publiccriterionverdict.d.ts.map +1 -1
  34. package/esm/models/publiccriterionverdict.js +5 -3
  35. package/esm/models/publiccriterionverdict.js.map +1 -1
  36. package/esm/models/publicgraderresult.d.ts +1 -0
  37. package/esm/models/publicgraderresult.d.ts.map +1 -1
  38. package/esm/models/publicgraderresult.js +1 -0
  39. package/esm/models/publicgraderresult.js.map +1 -1
  40. package/esm/models/publicpluginevalresultsdownload.d.ts +12 -0
  41. package/esm/models/publicpluginevalresultsdownload.d.ts.map +1 -0
  42. package/esm/models/publicpluginevalresultsdownload.js +15 -0
  43. package/esm/models/publicpluginevalresultsdownload.js.map +1 -0
  44. package/esm/models/publicpluginevalresultsresponse.d.ts +8 -0
  45. package/esm/models/publicpluginevalresultsresponse.d.ts.map +1 -0
  46. package/esm/models/publicpluginevalresultsresponse.js +11 -0
  47. package/esm/models/publicpluginevalresultsresponse.js.map +1 -0
  48. package/esm/models/updatev2evalrequest.d.ts +1 -0
  49. package/esm/models/updatev2evalrequest.d.ts.map +1 -1
  50. package/esm/models/updatev2evalrequest.js +1 -0
  51. package/esm/models/updatev2evalrequest.js.map +1 -1
  52. package/esm/models/v2eval.d.ts +1 -0
  53. package/esm/models/v2eval.d.ts.map +1 -1
  54. package/esm/models/v2eval.js +1 -0
  55. package/esm/models/v2eval.js.map +1 -1
  56. package/esm/models/v2evalresultsummary.d.ts +2 -0
  57. package/esm/models/v2evalresultsummary.d.ts.map +1 -1
  58. package/esm/models/v2evalresultsummary.js +2 -0
  59. package/esm/models/v2evalresultsummary.js.map +1 -1
  60. package/esm/models/v2pluginevalsresultslistop.d.ts +10 -0
  61. package/esm/models/v2pluginevalsresultslistop.d.ts.map +1 -0
  62. package/esm/models/v2pluginevalsresultslistop.js +15 -0
  63. package/esm/models/v2pluginevalsresultslistop.js.map +1 -0
  64. package/esm/models/v2promptrunjobresponse.js +1 -1
  65. package/esm/models/v2promptrunjobresponse.js.map +1 -1
  66. package/esm/models/v2setupcommandoutput.d.ts +10 -0
  67. package/esm/models/v2setupcommandoutput.d.ts.map +1 -0
  68. package/esm/models/v2setupcommandoutput.js +14 -0
  69. package/esm/models/v2setupcommandoutput.js.map +1 -0
  70. package/esm/tool-names.d.ts.map +1 -1
  71. package/esm/tool-names.js +4 -0
  72. package/esm/tool-names.js.map +1 -1
  73. package/lib/tool-overrides.js +76 -0
  74. package/package.json +3 -2
  75. package/src/funcs/pluginEvalsResultsList.ts +148 -0
  76. package/src/landing-page.ts +1 -1
  77. package/src/lib/config.ts +2 -2
  78. package/src/mcp-server/mcp-server.ts +1 -1
  79. package/src/mcp-server/server.ts +3 -1
  80. package/src/mcp-server/tools/pluginEvalsResultsList.ts +43 -0
  81. package/src/models/createv2evalrequest.ts +4 -0
  82. package/src/models/createv2evalrunrequest.ts +4 -0
  83. package/src/models/graderdefinition.ts +2 -0
  84. package/src/models/publiccriterionverdict.ts +6 -4
  85. package/src/models/publicgraderresult.ts +4 -0
  86. package/src/models/publicpluginevalresultsdownload.ts +38 -0
  87. package/src/models/publicpluginevalresultsresponse.ts +24 -0
  88. package/src/models/updatev2evalrequest.ts +4 -0
  89. package/src/models/v2eval.ts +4 -0
  90. package/src/models/v2evalresultsummary.ts +8 -0
  91. package/src/models/v2pluginevalsresultslistop.ts +35 -0
  92. package/src/models/v2promptrunjobresponse.ts +1 -1
  93. package/src/models/v2setupcommandoutput.ts +31 -0
  94. package/src/tool-names.ts +4 -0
  95. package/test/simulations.test.js +17 -14
  96. package/test/tool-overrides.test.js +85 -0
package/bin/mcp-server.js CHANGED
@@ -6512,11 +6512,38 @@ var init_console_logger = __esm(() => {
6512
6512
  ];
6513
6513
  });
6514
6514
 
6515
+ // node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
6516
+ var X_ALREADY_SENT = "x-hono-already-sent";
6517
+ var init_constants_BLSFu_RU = () => {};
6518
+
6519
+ // node_modules/hono/dist/helper/websocket/index.js
6520
+ var defineWebSocketHelper = (handler) => {
6521
+ return (...args) => {
6522
+ if (typeof args[0] === "function") {
6523
+ const [createEvents, options] = args;
6524
+ return async function upgradeWebSocket(c, next) {
6525
+ const result = await handler(c, await createEvents(c), options);
6526
+ if (result)
6527
+ return result;
6528
+ await next();
6529
+ };
6530
+ } else {
6531
+ const [c, events, options] = args;
6532
+ return (async () => {
6533
+ const upgraded = await handler(c, events, options);
6534
+ if (!upgraded)
6535
+ throw new Error("Failed to upgrade WebSocket");
6536
+ return upgraded;
6537
+ })();
6538
+ }
6539
+ };
6540
+ };
6541
+ var init_websocket = () => {};
6542
+
6515
6543
  // node_modules/@hono/node-server/dist/index.mjs
6516
- import { Http2ServerRequest as Http2ServerRequest2, constants as h2constants } from "http2";
6517
- import { Http2ServerRequest } from "http2";
6518
- import { Readable } from "stream";
6519
- import crypto2 from "crypto";
6544
+ import { STATUS_CODES, ServerResponse, createServer } from "node:http";
6545
+ import { Http2ServerRequest, constants } from "node:http2";
6546
+ import { Readable } from "node:stream";
6520
6547
  async function readWithoutBlocking(readPromise) {
6521
6548
  return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(undefined))]);
6522
6549
  }
@@ -6524,6 +6551,11 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
6524
6551
  const cancel = (error) => {
6525
6552
  reader.cancel(error).catch(() => {});
6526
6553
  };
6554
+ const stream = writable.stream;
6555
+ if (writable.destroyed || stream?.closed || stream?.destroyed) {
6556
+ cancel();
6557
+ return reader.closed;
6558
+ }
6527
6559
  writable.on("close", cancel);
6528
6560
  writable.on("error", cancel);
6529
6561
  (currentReadPromise ?? reader.read()).then(flow, handleStreamError);
@@ -6532,51 +6564,124 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
6532
6564
  writable.off("error", cancel);
6533
6565
  });
6534
6566
  function handleStreamError(error) {
6535
- if (error) {
6567
+ if (error)
6536
6568
  writable.destroy(error);
6537
- }
6538
6569
  }
6539
6570
  function onDrain() {
6540
6571
  reader.read().then(flow, handleStreamError);
6541
6572
  }
6542
6573
  function flow({ done, value }) {
6543
6574
  try {
6544
- if (done) {
6575
+ if (done)
6545
6576
  writable.end();
6546
- } else if (!writable.write(value)) {
6577
+ else if (!writable.write(value))
6547
6578
  writable.once("drain", onDrain);
6548
- } else {
6549
- return reader.read().then(flow, handleStreamError);
6550
- }
6579
+ else
6580
+ reader.read().then(flow, handleStreamError);
6551
6581
  } catch (e) {
6552
6582
  handleStreamError(e);
6553
6583
  }
6554
6584
  }
6555
6585
  }
6556
6586
  function writeFromReadableStream(stream, writable) {
6557
- if (stream.locked) {
6587
+ if (stream.locked)
6558
6588
  throw new TypeError("ReadableStream is locked.");
6559
- } else if (writable.destroyed) {
6589
+ else if (writable.destroyed) {
6590
+ stream.cancel().catch(() => {});
6560
6591
  return;
6561
6592
  }
6562
6593
  return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
6563
6594
  }
6564
- var RequestError, toRequestError = (e) => {
6565
- if (e instanceof RequestError) {
6566
- return e;
6567
- }
6568
- return new RequestError(e.message, { cause: e });
6569
- }, GlobalRequest, Request2, newHeadersFromIncoming = (incoming) => {
6570
- const headerRecord = [];
6571
- const rawHeaders = incoming.rawHeaders;
6595
+ var RequestError, nonJoinedHeaders, validHeaderName, isHttpWhitespace = (code) => code === 9 || code === 10 || code === 13 || code === 32, normalizeHeaderValue = (value) => {
6596
+ if (!isHttpWhitespace(value.charCodeAt(0)) && !isHttpWhitespace(value.charCodeAt(value.length - 1)))
6597
+ return value;
6598
+ let start = 0;
6599
+ let end = value.length;
6600
+ while (start < end && isHttpWhitespace(value.charCodeAt(start)))
6601
+ start++;
6602
+ while (end > start && isHttpWhitespace(value.charCodeAt(end - 1)))
6603
+ end--;
6604
+ return value.slice(start, end);
6605
+ }, forbiddenHeaderValue, GlobalHeaders, materializeHeaders = (rawHeaders, HeadersCtor = GlobalHeaders) => {
6606
+ const headers = new HeadersCtor;
6572
6607
  for (let i = 0;i < rawHeaders.length; i += 2) {
6573
- const { [i]: key, [i + 1]: value } = rawHeaders;
6574
- if (key.charCodeAt(0) !== 58) {
6575
- headerRecord.push([key, value]);
6608
+ const name = rawHeaders[i];
6609
+ if (!name.startsWith(":"))
6610
+ headers.append(name, rawHeaders[i + 1]);
6611
+ }
6612
+ return headers;
6613
+ }, RequestHeaders, newHeadersFromIncoming = (incoming) => globalThis.Headers === GlobalHeaders ? new RequestHeaders(incoming) : materializeHeaders(incoming.rawHeaders, globalThis.Headers), reValidRequestUrl, reDotSegment, reValidHost, validateRequestTarget = (target) => {
6614
+ const backslash = target.indexOf("\\");
6615
+ if (backslash !== -1) {
6616
+ const query = target.indexOf("?");
6617
+ if (query === -1 || backslash < query)
6618
+ throw new RequestError("Backslash in request path");
6619
+ }
6620
+ }, buildUrl = (scheme, host, incomingUrl) => {
6621
+ const url = `${scheme}://${host}${incomingUrl}`;
6622
+ if (!reValidHost.test(host)) {
6623
+ validateRequestTarget(incomingUrl);
6624
+ const urlObj = new URL(url);
6625
+ if (urlObj.hostname.length !== host.length && urlObj.hostname !== (host.includes(":") ? host.replace(/:\d+$/, "") : host).toLowerCase())
6626
+ throw new RequestError("Invalid host header");
6627
+ return urlObj.href;
6628
+ } else if (incomingUrl.length === 0)
6629
+ return url + "/";
6630
+ else {
6631
+ if (incomingUrl.charCodeAt(0) !== 47)
6632
+ throw new RequestError("Invalid URL");
6633
+ if (!reValidRequestUrl.test(incomingUrl) || reDotSegment.test(incomingUrl)) {
6634
+ validateRequestTarget(incomingUrl);
6635
+ return new URL(url).href;
6576
6636
  }
6637
+ return url;
6638
+ }
6639
+ }, toRequestError = (e) => {
6640
+ if (e instanceof RequestError)
6641
+ return e;
6642
+ return new RequestError(e.message, { cause: e });
6643
+ }, GlobalRequest, Request$1, wrapBodyStream, byteExactEncodings, isByteExactEncoding = (encoding) => encoding === null || byteExactEncodings.has(encoding), bodyBufferedBeforeDisconnectKey, bodyBufferedLengthBeforeDisconnectKey, toBufferChunk = (chunk, encoding) => Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, encoding ?? "utf8"), isRecoverableDisconnectedIncoming = (incoming) => !(incoming instanceof Http2ServerRequest) && !!incoming.complete && !!incoming.readableAborted && typeof incoming.read === "function" && isByteExactEncoding(incoming.readableEncoding), recordBodyBufferedBeforeDisconnect = (incoming) => {
6644
+ if (incoming.readableDidRead || !isRecoverableDisconnectedIncoming(incoming))
6645
+ return;
6646
+ const incomingWithRecovery = incoming;
6647
+ incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey] ??= incoming.readableLength;
6648
+ }, readBodyBufferedBeforeDisconnect = (incoming, chunks) => {
6649
+ if (incoming.readableDidRead && !chunks || !isRecoverableDisconnectedIncoming(incoming))
6650
+ return;
6651
+ const incomingWithRecovery = incoming;
6652
+ if (incomingWithRecovery[bodyBufferedBeforeDisconnectKey] !== undefined)
6653
+ return incomingWithRecovery[bodyBufferedBeforeDisconnectKey];
6654
+ let result;
6655
+ const errored = incoming.errored;
6656
+ if (errored && errored.code !== "ECONNRESET")
6657
+ result = errored;
6658
+ else if (incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey] !== undefined && incoming.readableLength !== incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey])
6659
+ result = newBodyUnusableError();
6660
+ else {
6661
+ const bodyChunks = chunks ?? [];
6662
+ const chunk = incoming.read();
6663
+ if (chunk !== null)
6664
+ bodyChunks.push(toBufferChunk(chunk, incoming.readableEncoding));
6665
+ const buffer = bodyChunks.length === 1 ? bodyChunks[0] : Buffer.concat(bodyChunks);
6666
+ result = buffer;
6667
+ const contentLength = incoming.headers["content-length"];
6668
+ if (typeof contentLength === "string" && /^\d+$/.test(contentLength)) {
6669
+ const expectedLength = Number(contentLength);
6670
+ if (Number.isSafeInteger(expectedLength) && buffer.length !== expectedLength)
6671
+ result = newBodyUnusableError();
6672
+ }
6673
+ }
6674
+ incomingWithRecovery[bodyBufferedBeforeDisconnectKey] = result;
6675
+ return result;
6676
+ }, enqueueBufferedBody = (controller, buffered) => {
6677
+ if (buffered instanceof Error) {
6678
+ controller.error(buffered);
6679
+ return;
6577
6680
  }
6578
- return new Headers(headerRecord);
6579
- }, wrapBodyStream, newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
6681
+ if (buffered.length > 0)
6682
+ controller.enqueue(buffered);
6683
+ controller.close();
6684
+ }, newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
6580
6685
  const init = {
6581
6686
  method,
6582
6687
  headers,
@@ -6584,106 +6689,293 @@ var RequestError, toRequestError = (e) => {
6584
6689
  };
6585
6690
  if (method === "TRACE") {
6586
6691
  init.method = "GET";
6587
- const req = new Request2(url, init);
6588
- Object.defineProperty(req, "method", {
6589
- get() {
6590
- return "TRACE";
6591
- }
6592
- });
6692
+ const req = new Request$1(url, init);
6693
+ Object.defineProperty(req, "method", { get() {
6694
+ return "TRACE";
6695
+ } });
6593
6696
  return req;
6594
6697
  }
6595
- if (!(method === "GET" || method === "HEAD")) {
6596
- if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
6597
- init.body = new ReadableStream({
6598
- start(controller) {
6599
- controller.enqueue(incoming.rawBody);
6600
- controller.close();
6601
- }
6602
- });
6603
- } else if (incoming[wrapBodyStream]) {
6698
+ if (!(method === "GET" || method === "HEAD"))
6699
+ if ("rawBody" in incoming && incoming.rawBody instanceof Buffer)
6700
+ init.body = new ReadableStream({ start(controller) {
6701
+ controller.enqueue(incoming.rawBody);
6702
+ controller.close();
6703
+ } });
6704
+ else if (incoming[wrapBodyStream]) {
6604
6705
  let reader;
6605
- init.body = new ReadableStream({
6606
- async pull(controller) {
6607
- try {
6608
- reader ||= Readable.toWeb(incoming).getReader();
6609
- const { done, value } = await reader.read();
6610
- if (done) {
6611
- controller.close();
6612
- } else {
6613
- controller.enqueue(value);
6706
+ init.body = new ReadableStream({ async pull(controller) {
6707
+ try {
6708
+ if (!reader) {
6709
+ const buffered = readBodyBufferedBeforeDisconnect(incoming);
6710
+ if (buffered !== undefined) {
6711
+ enqueueBufferedBody(controller, buffered);
6712
+ return;
6614
6713
  }
6615
- } catch (error) {
6616
- controller.error(error);
6617
6714
  }
6715
+ reader ||= Readable.toWeb(incoming).getReader();
6716
+ const { done, value } = await reader.read();
6717
+ if (done)
6718
+ controller.close();
6719
+ else
6720
+ controller.enqueue(value);
6721
+ } catch (error) {
6722
+ controller.error(error);
6618
6723
  }
6619
- });
6724
+ } });
6620
6725
  } else {
6621
- init.body = Readable.toWeb(incoming);
6622
- }
6726
+ const buffered = readBodyBufferedBeforeDisconnect(incoming);
6727
+ if (buffered !== undefined)
6728
+ init.body = new ReadableStream({ start(controller) {
6729
+ enqueueBufferedBody(controller, buffered);
6730
+ } });
6731
+ else
6732
+ init.body = Readable.toWeb(incoming);
6733
+ }
6734
+ return new Request$1(url, init);
6735
+ }, getRequestCache, requestCache, incomingKey, urlKey, methodKey, headersKey, abortControllerKey, getAbortController, abortRequest, bodyBufferKey, bodyReadPromiseKey, bodyConsumedDirectlyKey, bodyLockReaderKey, abortReasonKey, newBodyUnusableError = () => {
6736
+ return /* @__PURE__ */ new TypeError("Body is unusable");
6737
+ }, rejectBodyUnusable = () => {
6738
+ return Promise.reject(newBodyUnusableError());
6739
+ }, textDecoder, consumeBodyDirectOnce = (request) => {
6740
+ if (request[bodyConsumedDirectlyKey])
6741
+ return rejectBodyUnusable();
6742
+ request[bodyConsumedDirectlyKey] = true;
6743
+ }, toArrayBuffer = (buf) => {
6744
+ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
6745
+ }, contentType = (request) => {
6746
+ return (request[headersKey] ||= newHeadersFromIncoming(request[incomingKey])).get("content-type") || "";
6747
+ }, methodTokenRegExp, normalizeIncomingMethod = (method) => {
6748
+ if (typeof method !== "string" || method.length === 0)
6749
+ return "GET";
6750
+ switch (method) {
6751
+ case "DELETE":
6752
+ case "GET":
6753
+ case "HEAD":
6754
+ case "OPTIONS":
6755
+ case "PATCH":
6756
+ case "POST":
6757
+ case "PUT":
6758
+ case "QUERY":
6759
+ return method;
6760
+ }
6761
+ const upper = method.toUpperCase();
6762
+ switch (upper) {
6763
+ case "DELETE":
6764
+ case "GET":
6765
+ case "HEAD":
6766
+ case "OPTIONS":
6767
+ case "POST":
6768
+ case "PUT":
6769
+ return upper;
6770
+ default:
6771
+ return method;
6772
+ }
6773
+ }, validateDirectReadMethod = (method) => {
6774
+ if (!methodTokenRegExp.test(method))
6775
+ return /* @__PURE__ */ new TypeError(`'${method}' is not a valid HTTP method.`);
6776
+ const normalized = method.toUpperCase();
6777
+ if (normalized === "CONNECT" || normalized === "TRACK" || normalized === "TRACE" && method !== "TRACE")
6778
+ return /* @__PURE__ */ new TypeError(`'${method}' HTTP method is unsupported.`);
6779
+ }, readBodyWithFastPath = (request, method, fromBuffer) => {
6780
+ if (request[bodyConsumedDirectlyKey])
6781
+ return rejectBodyUnusable();
6782
+ const methodName = request.method;
6783
+ if (methodName === "GET" || methodName === "HEAD")
6784
+ return request[getRequestCache]()[method]();
6785
+ const methodValidationError = validateDirectReadMethod(methodName);
6786
+ if (methodValidationError)
6787
+ return Promise.reject(methodValidationError);
6788
+ if (request[requestCache]) {
6789
+ if (methodName !== "TRACE")
6790
+ return request[requestCache][method]();
6791
+ }
6792
+ const alreadyUsedError = consumeBodyDirectOnce(request);
6793
+ if (alreadyUsedError)
6794
+ return alreadyUsedError;
6795
+ const raw = readRawBodyIfAvailable(request);
6796
+ if (raw) {
6797
+ const result = Promise.resolve(fromBuffer(raw, request));
6798
+ request[bodyBufferKey] = undefined;
6799
+ return result;
6623
6800
  }
6624
- return new Request2(url, init);
6625
- }, getRequestCache, requestCache, incomingKey, urlKey, headersKey, abortControllerKey, getAbortController, requestPrototype, newRequest = (incoming, defaultHostname) => {
6801
+ return readBodyDirect(request).then((buf) => {
6802
+ const result = fromBuffer(buf, request);
6803
+ request[bodyBufferKey] = undefined;
6804
+ return result;
6805
+ });
6806
+ }, readRawBodyIfAvailable = (request) => {
6807
+ const incoming = request[incomingKey];
6808
+ if ("rawBody" in incoming && incoming.rawBody instanceof Buffer)
6809
+ return incoming.rawBody;
6810
+ }, normalizeAbortError = (request, incoming) => {
6811
+ if (incoming.errored)
6812
+ return incoming.errored;
6813
+ const reason = request[abortReasonKey];
6814
+ if (reason !== undefined)
6815
+ return reason instanceof Error ? reason : new Error(String(reason));
6816
+ return /* @__PURE__ */ new Error("Client connection prematurely closed.");
6817
+ }, readBodyDirect = (request) => {
6818
+ if (request[bodyBufferKey])
6819
+ return Promise.resolve(request[bodyBufferKey]);
6820
+ if (request[bodyReadPromiseKey])
6821
+ return request[bodyReadPromiseKey];
6822
+ const incoming = request[incomingKey];
6823
+ if (incoming.readableDidRead)
6824
+ return rejectBodyUnusable();
6825
+ const buffered = readBodyBufferedBeforeDisconnect(incoming);
6826
+ if (buffered !== undefined) {
6827
+ if (buffered instanceof Error)
6828
+ return Promise.reject(buffered);
6829
+ request[bodyBufferKey] = buffered;
6830
+ return Promise.resolve(buffered);
6831
+ }
6832
+ const promise = new Promise((resolve, reject) => {
6833
+ const chunks = [];
6834
+ let settled = false;
6835
+ const finish = (callback) => {
6836
+ if (settled)
6837
+ return;
6838
+ settled = true;
6839
+ cleanup();
6840
+ callback();
6841
+ };
6842
+ const recoverCompleteBodyAfterDisconnect = (error) => {
6843
+ const streamError = incoming.errored ?? error;
6844
+ if (!isRecoverableDisconnectedIncoming(incoming) || streamError && streamError.code !== "ECONNRESET")
6845
+ return false;
6846
+ finish(() => {
6847
+ const recovered = readBodyBufferedBeforeDisconnect(incoming, chunks);
6848
+ if (recovered instanceof Error)
6849
+ reject(recovered);
6850
+ else if (recovered === undefined)
6851
+ reject(error ?? normalizeAbortError(request, incoming));
6852
+ else {
6853
+ request[bodyBufferKey] = recovered;
6854
+ resolve(recovered);
6855
+ }
6856
+ });
6857
+ return true;
6858
+ };
6859
+ const onData = (chunk) => {
6860
+ chunks.push(toBufferChunk(chunk, incoming.readableEncoding));
6861
+ };
6862
+ const onEnd = () => {
6863
+ finish(() => {
6864
+ const buffer = chunks.length === 1 ? chunks[0] : Buffer.concat(chunks);
6865
+ request[bodyBufferKey] = buffer;
6866
+ resolve(buffer);
6867
+ });
6868
+ };
6869
+ const onError = (error) => {
6870
+ if (recoverCompleteBodyAfterDisconnect(error))
6871
+ return;
6872
+ finish(() => {
6873
+ reject(error);
6874
+ });
6875
+ };
6876
+ const onClose = () => {
6877
+ if (incoming.readableEnded) {
6878
+ onEnd();
6879
+ return;
6880
+ }
6881
+ if (recoverCompleteBodyAfterDisconnect())
6882
+ return;
6883
+ finish(() => {
6884
+ reject(normalizeAbortError(request, incoming));
6885
+ });
6886
+ };
6887
+ const cleanup = () => {
6888
+ incoming.off("data", onData);
6889
+ incoming.off("end", onEnd);
6890
+ incoming.off("error", onError);
6891
+ incoming.off("close", onClose);
6892
+ request[bodyReadPromiseKey] = undefined;
6893
+ };
6894
+ incoming.on("data", onData);
6895
+ incoming.on("end", onEnd);
6896
+ incoming.on("error", onError);
6897
+ incoming.on("close", onClose);
6898
+ queueMicrotask(() => {
6899
+ if (settled)
6900
+ return;
6901
+ if (incoming.readableEnded)
6902
+ onEnd();
6903
+ else if (incoming.errored)
6904
+ onError(incoming.errored);
6905
+ else if (incoming.destroyed)
6906
+ onClose();
6907
+ });
6908
+ });
6909
+ request[bodyReadPromiseKey] = promise;
6910
+ return promise;
6911
+ }, requestPrototype, newRequest = (incoming, defaultHostname) => {
6626
6912
  const req = Object.create(requestPrototype);
6627
6913
  req[incomingKey] = incoming;
6914
+ req[methodKey] = normalizeIncomingMethod(incoming.method);
6628
6915
  const incomingUrl = incoming.url || "";
6629
6916
  if (incomingUrl[0] !== "/" && (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
6630
- if (incoming instanceof Http2ServerRequest) {
6917
+ if (incoming instanceof Http2ServerRequest)
6631
6918
  throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
6632
- }
6633
6919
  try {
6634
- const url2 = new URL(incomingUrl);
6635
- req[urlKey] = url2.href;
6920
+ validateRequestTarget(incomingUrl);
6921
+ req[urlKey] = new URL(incomingUrl).href;
6636
6922
  } catch (e) {
6637
6923
  throw new RequestError("Invalid absolute URL", { cause: e });
6638
6924
  }
6639
6925
  return req;
6640
6926
  }
6641
6927
  const host = (incoming instanceof Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
6642
- if (!host) {
6928
+ if (!host)
6643
6929
  throw new RequestError("Missing host header");
6644
- }
6645
6930
  let scheme;
6646
6931
  if (incoming instanceof Http2ServerRequest) {
6647
6932
  scheme = incoming.scheme;
6648
- if (!(scheme === "http" || scheme === "https")) {
6933
+ if (!(scheme === "http" || scheme === "https"))
6649
6934
  throw new RequestError("Unsupported scheme");
6650
- }
6651
- } else {
6935
+ } else
6652
6936
  scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
6937
+ try {
6938
+ req[urlKey] = buildUrl(scheme, host, incomingUrl);
6939
+ } catch (e) {
6940
+ if (e instanceof RequestError)
6941
+ throw e;
6942
+ else
6943
+ throw new RequestError("Invalid URL", { cause: e });
6653
6944
  }
6654
- const url = new URL(`${scheme}://${host}${incomingUrl}`);
6655
- if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) {
6656
- throw new RequestError("Invalid host header");
6657
- }
6658
- req[urlKey] = url.href;
6659
6945
  return req;
6660
- }, responseCache, getResponseCache, cacheKey, GlobalResponse, Response2, buildOutgoingHttpHeaders = (headers) => {
6946
+ }, defaultContentType = "text/plain; charset=UTF-8", responseCache, getResponseCache, cacheKey, GlobalResponse, Response$1, validRedirectUrl, parseRedirectUrl = (url) => {
6947
+ if (url instanceof URL)
6948
+ return url.href;
6949
+ if (validRedirectUrl.test(url))
6950
+ return url;
6951
+ return new URL(url).href;
6952
+ }, validRedirectStatuses, buildOutgoingHttpHeaders = (headers, defaultContentType) => {
6661
6953
  const res = {};
6662
- if (!(headers instanceof Headers)) {
6954
+ if (!(headers instanceof Headers))
6663
6955
  headers = new Headers(headers ?? undefined);
6664
- }
6665
- const cookies = [];
6666
- for (const [k, v] of headers) {
6667
- if (k === "set-cookie") {
6668
- cookies.push(v);
6669
- } else {
6956
+ if (headers.has("set-cookie")) {
6957
+ const cookies = [];
6958
+ for (const [k, v] of headers)
6959
+ if (k === "set-cookie")
6960
+ cookies.push(v);
6961
+ else
6962
+ res[k] = v;
6963
+ if (cookies.length > 0)
6964
+ res["set-cookie"] = cookies;
6965
+ } else
6966
+ for (const [k, v] of headers)
6670
6967
  res[k] = v;
6671
- }
6672
- }
6673
- if (cookies.length > 0) {
6674
- res["set-cookie"] = cookies;
6675
- }
6676
- res["content-type"] ??= "text/plain; charset=UTF-8";
6968
+ if (defaultContentType)
6969
+ res["content-type"] ??= defaultContentType;
6677
6970
  return res;
6678
- }, X_ALREADY_SENT = "x-hono-already-sent", outgoingEnded, incomingDraining, DRAIN_TIMEOUT_MS = 500, MAX_DRAIN_BYTES, drainIncoming = (incoming) => {
6971
+ }, outgoingEnded, incomingDraining, DRAIN_TIMEOUT_MS = 500, MAX_DRAIN_BYTES, drainIncoming = (incoming) => {
6679
6972
  const incomingWithDrainState = incoming;
6680
- if (incoming.destroyed || incomingWithDrainState[incomingDraining]) {
6973
+ if (incoming.destroyed || incomingWithDrainState[incomingDraining])
6681
6974
  return;
6682
- }
6683
6975
  incomingWithDrainState[incomingDraining] = true;
6684
- if (incoming instanceof Http2ServerRequest2) {
6976
+ if (incoming instanceof Http2ServerRequest) {
6685
6977
  try {
6686
- incoming.stream?.close?.(h2constants.NGHTTP2_NO_ERROR);
6978
+ incoming.stream?.close?.(constants.NGHTTP2_NO_ERROR);
6687
6979
  } catch {}
6688
6980
  return;
6689
6981
  }
@@ -6698,100 +6990,161 @@ var RequestError, toRequestError = (e) => {
6698
6990
  cleanup();
6699
6991
  const socket = incoming.socket;
6700
6992
  if (socket && !socket.destroyed) {
6701
- socket.destroySoon();
6993
+ if (typeof socket.destroySoon === "function")
6994
+ socket.destroySoon();
6995
+ else if (typeof socket.destroy === "function")
6996
+ socket.destroy();
6702
6997
  }
6703
6998
  };
6704
6999
  const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS);
6705
7000
  timer.unref?.();
6706
7001
  const onData = (chunk) => {
6707
7002
  bytesRead += chunk.length;
6708
- if (bytesRead > MAX_DRAIN_BYTES) {
7003
+ if (bytesRead > MAX_DRAIN_BYTES)
6709
7004
  forceClose();
6710
- }
6711
7005
  };
6712
7006
  incoming.on("data", onData);
6713
7007
  incoming.on("end", cleanup);
6714
7008
  incoming.on("error", cleanup);
6715
7009
  incoming.resume();
6716
- }, handleRequestError = () => new Response(null, {
6717
- status: 400
6718
- }), handleFetchError = (e) => new Response(null, {
6719
- status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500
6720
- }), handleResponseError = (e, outgoing) => {
7010
+ }, makeCloseHandler = (req, incoming, outgoing, needsBodyCleanup) => () => {
7011
+ if (incoming.errored) {
7012
+ recordBodyBufferedBeforeDisconnect(incoming);
7013
+ req[abortRequest](incoming.errored.toString());
7014
+ } else if (!outgoing.writableFinished || incoming instanceof Http2ServerRequest && incoming.aborted) {
7015
+ recordBodyBufferedBeforeDisconnect(incoming);
7016
+ req[abortRequest]("Client connection prematurely closed.");
7017
+ }
7018
+ if (needsBodyCleanup && !incoming.readableEnded)
7019
+ setTimeout(() => {
7020
+ if (!incoming.readableEnded)
7021
+ setTimeout(() => {
7022
+ drainIncoming(incoming);
7023
+ });
7024
+ });
7025
+ }, isImmediateCacheableResponse = (res) => {
7026
+ if (!(cacheKey in res))
7027
+ return false;
7028
+ const body = res[cacheKey][1];
7029
+ return body === null || typeof body === "string" || body instanceof Uint8Array;
7030
+ }, handleRequestError = () => new Response(null, { status: 400 }), handleFetchError = (e) => new Response(null, { status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500 }), handleResponseError = (e, outgoing) => {
6721
7031
  const err = e instanceof Error ? e : new Error("unknown error", { cause: e });
6722
- if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
7032
+ if (err.code === "ERR_STREAM_PREMATURE_CLOSE")
6723
7033
  console.info("The user aborted a request.");
6724
- } else {
7034
+ else {
6725
7035
  console.error(e);
6726
7036
  if (!outgoing.headersSent) {
7037
+ if (outgoing instanceof ServerResponse)
7038
+ outgoing._contentLength = null;
6727
7039
  outgoing.writeHead(500, { "Content-Type": "text/plain" });
6728
7040
  }
6729
7041
  outgoing.end(`Error: ${err.message}`);
6730
7042
  outgoing.destroy(err);
6731
7043
  }
6732
7044
  }, flushHeaders = (outgoing) => {
6733
- if ("flushHeaders" in outgoing && outgoing.writable) {
7045
+ if ("flushHeaders" in outgoing && outgoing.writable)
6734
7046
  outgoing.flushHeaders();
7047
+ }, trySetContentLength = (outgoing, status, length) => {
7048
+ const http1 = outgoing;
7049
+ if (http1._contentLength === null && http1._hasBody && http1.useChunkedEncodingByDefault && !http1._removedContLen && status >= 200 && status !== 204 && status !== 304 && !outgoing.hasHeader("content-length") && !outgoing.hasHeader("transfer-encoding") && !outgoing.hasHeader("trailer")) {
7050
+ http1._contentLength = length;
7051
+ return true;
6735
7052
  }
7053
+ return false;
7054
+ }, writeDefaultHeaders = (outgoing, status, length) => {
7055
+ if (trySetContentLength(outgoing, status, length))
7056
+ outgoing.writeHead(status, { "Content-Type": defaultContentType });
7057
+ else
7058
+ outgoing.writeHead(status, {
7059
+ "Content-Type": defaultContentType,
7060
+ "Content-Length": length
7061
+ });
6736
7062
  }, responseViaCache = async (res, outgoing) => {
6737
7063
  let [status, body, header] = res[cacheKey];
6738
- let hasContentLength = false;
6739
7064
  if (!header) {
6740
- header = { "content-type": "text/plain; charset=UTF-8" };
6741
- } else if (header instanceof Headers) {
7065
+ if (body === null) {
7066
+ outgoing.writeHead(status);
7067
+ outgoing.end();
7068
+ } else if (typeof body === "string") {
7069
+ writeDefaultHeaders(outgoing, status, Buffer.byteLength(body));
7070
+ outgoing.end(body);
7071
+ } else if (body instanceof Uint8Array) {
7072
+ writeDefaultHeaders(outgoing, status, body.byteLength);
7073
+ outgoing.end(body);
7074
+ } else if (body instanceof Blob) {
7075
+ writeDefaultHeaders(outgoing, status, body.size);
7076
+ outgoing.end(new Uint8Array(await body.arrayBuffer()));
7077
+ } else {
7078
+ outgoing.writeHead(status, { "Content-Type": defaultContentType });
7079
+ flushHeaders(outgoing);
7080
+ await writeFromReadableStream(body, outgoing)?.catch((e) => handleResponseError(e, outgoing));
7081
+ }
7082
+ outgoing[outgoingEnded]?.();
7083
+ return;
7084
+ }
7085
+ let hasContentLength = false;
7086
+ let plainHeaders = false;
7087
+ let canAutoLength = true;
7088
+ if (header instanceof Headers) {
6742
7089
  hasContentLength = header.has("content-length");
6743
- header = buildOutgoingHttpHeaders(header);
7090
+ header = buildOutgoingHttpHeaders(header, body === null ? undefined : defaultContentType);
6744
7091
  } else if (Array.isArray(header)) {
6745
7092
  const headerObj = new Headers(header);
6746
7093
  hasContentLength = headerObj.has("content-length");
6747
- header = buildOutgoingHttpHeaders(headerObj);
7094
+ header = buildOutgoingHttpHeaders(headerObj, body === null ? undefined : defaultContentType);
6748
7095
  } else {
7096
+ plainHeaders = true;
6749
7097
  for (const key in header) {
6750
7098
  if (key.length === 14 && key.toLowerCase() === "content-length") {
6751
7099
  hasContentLength = true;
6752
7100
  break;
6753
7101
  }
7102
+ if (key.length === 17 && key.toLowerCase() === "transfer-encoding" || key.length === 7 && key.toLowerCase() === "trailer")
7103
+ canAutoLength = false;
6754
7104
  }
6755
7105
  }
6756
7106
  if (!hasContentLength) {
6757
- if (typeof body === "string") {
6758
- header["Content-Length"] = Buffer.byteLength(body);
6759
- } else if (body instanceof Uint8Array) {
6760
- header["Content-Length"] = body.byteLength;
6761
- } else if (body instanceof Blob) {
6762
- header["Content-Length"] = body.size;
7107
+ let length;
7108
+ if (typeof body === "string")
7109
+ length = Buffer.byteLength(body);
7110
+ else if (body instanceof Uint8Array)
7111
+ length = body.byteLength;
7112
+ else if (body instanceof Blob)
7113
+ length = body.size;
7114
+ if (length !== undefined && (!plainHeaders || !canAutoLength || !trySetContentLength(outgoing, status, length))) {
7115
+ if (plainHeaders)
7116
+ header = { ...header };
7117
+ header["Content-Length"] = length;
6763
7118
  }
6764
7119
  }
6765
7120
  outgoing.writeHead(status, header);
6766
- if (typeof body === "string" || body instanceof Uint8Array) {
7121
+ if (body == null)
7122
+ outgoing.end();
7123
+ else if (typeof body === "string" || body instanceof Uint8Array)
6767
7124
  outgoing.end(body);
6768
- } else if (body instanceof Blob) {
7125
+ else if (body instanceof Blob)
6769
7126
  outgoing.end(new Uint8Array(await body.arrayBuffer()));
6770
- } else {
7127
+ else {
6771
7128
  flushHeaders(outgoing);
6772
7129
  await writeFromReadableStream(body, outgoing)?.catch((e) => handleResponseError(e, outgoing));
6773
7130
  }
6774
7131
  outgoing[outgoingEnded]?.();
6775
7132
  }, isPromise = (res) => typeof res.then === "function", responseViaResponseObject = async (res, outgoing, options = {}) => {
6776
- if (isPromise(res)) {
6777
- if (options.errorHandler) {
7133
+ if (isPromise(res))
7134
+ if (options.errorHandler)
6778
7135
  try {
6779
7136
  res = await res;
6780
7137
  } catch (err) {
6781
7138
  const errRes = await options.errorHandler(err);
6782
- if (!errRes) {
7139
+ if (!errRes)
6783
7140
  return;
6784
- }
6785
7141
  res = errRes;
6786
7142
  }
6787
- } else {
7143
+ else
6788
7144
  res = await res.catch(handleFetchError);
6789
- }
6790
- }
6791
- if (cacheKey in res) {
7145
+ if (cacheKey in res)
6792
7146
  return responseViaCache(res, outgoing);
6793
- }
6794
- const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
7147
+ const resHeaderRecord = buildOutgoingHttpHeaders(res.headers, res.body === null ? undefined : defaultContentType);
6795
7148
  if (res.body) {
6796
7149
  const reader = res.body.getReader();
6797
7150
  const values = [];
@@ -6801,10 +7154,7 @@ var RequestError, toRequestError = (e) => {
6801
7154
  let maxReadCount = 2;
6802
7155
  for (let i = 0;i < maxReadCount; i++) {
6803
7156
  currentReadPromise ||= reader.read();
6804
- const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => {
6805
- console.error(e);
6806
- done = true;
6807
- });
7157
+ const chunk = await readWithoutBlocking(currentReadPromise);
6808
7158
  if (!chunk) {
6809
7159
  if (i === 1) {
6810
7160
  await new Promise((resolve) => setTimeout(resolve));
@@ -6814,28 +7164,25 @@ var RequestError, toRequestError = (e) => {
6814
7164
  break;
6815
7165
  }
6816
7166
  currentReadPromise = undefined;
6817
- if (chunk.value) {
7167
+ if (chunk.value)
6818
7168
  values.push(chunk.value);
6819
- }
6820
7169
  if (chunk.done) {
6821
7170
  done = true;
6822
7171
  break;
6823
7172
  }
6824
7173
  }
6825
- if (done && !("content-length" in resHeaderRecord)) {
7174
+ if (done && !("content-length" in resHeaderRecord))
6826
7175
  resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
6827
- }
6828
7176
  }
6829
7177
  outgoing.writeHead(res.status, resHeaderRecord);
6830
7178
  values.forEach((value) => {
6831
7179
  outgoing.write(value);
6832
7180
  });
6833
- if (done) {
7181
+ if (done)
6834
7182
  outgoing.end();
6835
- } else {
6836
- if (values.length === 0) {
7183
+ else {
7184
+ if (values.length === 0)
6837
7185
  flushHeaders(outgoing);
6838
- }
6839
7186
  await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
6840
7187
  }
6841
7188
  } else if (resHeaderRecord[X_ALREADY_SENT]) {} else {
@@ -6845,81 +7192,63 @@ var RequestError, toRequestError = (e) => {
6845
7192
  outgoing[outgoingEnded]?.();
6846
7193
  }, getRequestListener = (fetchCallback, options = {}) => {
6847
7194
  const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
6848
- if (options.overrideGlobalObjects !== false && global.Request !== Request2) {
6849
- Object.defineProperty(global, "Request", {
6850
- value: Request2
6851
- });
6852
- Object.defineProperty(global, "Response", {
6853
- value: Response2
6854
- });
7195
+ if (options.overrideGlobalObjects !== false && global.Request !== Request$1) {
7196
+ Object.defineProperty(global, "Request", { value: Request$1 });
7197
+ Object.defineProperty(global, "Response", { value: Response$1 });
6855
7198
  }
6856
7199
  return async (incoming, outgoing) => {
6857
7200
  let res, req;
7201
+ let needsBodyCleanup = false;
7202
+ let closeHandlerAttached = false;
7203
+ const ensureCloseHandler = () => {
7204
+ if (!req || closeHandlerAttached)
7205
+ return;
7206
+ closeHandlerAttached = true;
7207
+ outgoing.on("close", makeCloseHandler(req, incoming, outgoing, needsBodyCleanup));
7208
+ };
6858
7209
  try {
6859
7210
  req = newRequest(incoming, options.hostname);
6860
- let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD";
6861
- if (!incomingEnded) {
7211
+ needsBodyCleanup = autoCleanupIncoming && !(incoming.method === "GET" || incoming.method === "HEAD");
7212
+ if (needsBodyCleanup) {
6862
7213
  incoming[wrapBodyStream] = true;
6863
- incoming.on("end", () => {
6864
- incomingEnded = true;
6865
- });
6866
- if (incoming instanceof Http2ServerRequest2) {
7214
+ if (incoming instanceof Http2ServerRequest)
6867
7215
  outgoing[outgoingEnded] = () => {
6868
- if (!incomingEnded) {
7216
+ if (!incoming.readableEnded)
6869
7217
  setTimeout(() => {
6870
- if (!incomingEnded) {
7218
+ if (!incoming.readableEnded)
6871
7219
  setTimeout(() => {
6872
- drainIncoming(incoming);
7220
+ incoming.destroy();
7221
+ outgoing.destroy();
6873
7222
  });
6874
- }
6875
7223
  });
6876
- }
6877
7224
  };
6878
- }
6879
- outgoing.on("finish", () => {
6880
- if (!incomingEnded) {
6881
- drainIncoming(incoming);
6882
- }
6883
- });
6884
7225
  }
6885
- outgoing.on("close", () => {
6886
- const abortController = req[abortControllerKey];
6887
- if (abortController) {
6888
- if (incoming.errored) {
6889
- req[abortControllerKey].abort(incoming.errored.toString());
6890
- } else if (!outgoing.writableFinished) {
6891
- req[abortControllerKey].abort("Client connection prematurely closed.");
6892
- }
6893
- }
6894
- if (!incomingEnded) {
6895
- setTimeout(() => {
6896
- if (!incomingEnded) {
6897
- setTimeout(() => {
6898
- drainIncoming(incoming);
6899
- });
6900
- }
6901
- });
6902
- }
7226
+ res = fetchCallback(req, {
7227
+ incoming,
7228
+ outgoing
6903
7229
  });
6904
- res = fetchCallback(req, { incoming, outgoing });
6905
- if (cacheKey in res) {
7230
+ if (!isPromise(res) && isImmediateCacheableResponse(res)) {
7231
+ if (needsBodyCleanup && !incoming.readableEnded)
7232
+ outgoing.once("finish", () => {
7233
+ if (!incoming.readableEnded)
7234
+ drainIncoming(incoming);
7235
+ });
6906
7236
  return responseViaCache(res, outgoing);
6907
7237
  }
7238
+ ensureCloseHandler();
6908
7239
  } catch (e) {
6909
- if (!res) {
7240
+ if (!res)
6910
7241
  if (options.errorHandler) {
7242
+ ensureCloseHandler();
6911
7243
  res = await options.errorHandler(req ? e : toRequestError(e));
6912
- if (!res) {
7244
+ if (!res)
6913
7245
  return;
6914
- }
6915
- } else if (!req) {
7246
+ } else if (!req)
6916
7247
  res = handleRequestError();
6917
- } else {
7248
+ else
6918
7249
  res = handleFetchError(e);
6919
- }
6920
- } else {
7250
+ else
6921
7251
  return handleResponseError(e, outgoing);
6922
- }
6923
7252
  }
6924
7253
  try {
6925
7254
  return await responseViaResponseObject(res, outgoing, options);
@@ -6927,37 +7256,201 @@ var RequestError, toRequestError = (e) => {
6927
7256
  return handleResponseError(e, outgoing);
6928
7257
  }
6929
7258
  };
6930
- };
7259
+ }, CloseEvent, ErrorEvent, generateConnectionSymbol = () => Symbol("connection"), CONNECTION_SYMBOL_KEY, WAIT_FOR_WEBSOCKET_SYMBOL, responseHeadersToSkip, upgradeWebSocket;
6931
7260
  var init_dist = __esm(() => {
7261
+ init_constants_BLSFu_RU();
7262
+ init_websocket();
6932
7263
  RequestError = class extends Error {
6933
7264
  constructor(message, options) {
6934
7265
  super(message, options);
6935
7266
  this.name = "RequestError";
6936
7267
  }
6937
7268
  };
7269
+ nonJoinedHeaders = new Set([
7270
+ "age",
7271
+ "authorization",
7272
+ "content-length",
7273
+ "content-type",
7274
+ "etag",
7275
+ "expires",
7276
+ "from",
7277
+ "host",
7278
+ "if-modified-since",
7279
+ "if-unmodified-since",
7280
+ "last-modified",
7281
+ "location",
7282
+ "max-forwards",
7283
+ "proxy-authorization",
7284
+ "referer",
7285
+ "retry-after",
7286
+ "server",
7287
+ "user-agent"
7288
+ ]);
7289
+ validHeaderName = /^[!#$%&'*+\-.^_`|~\dA-Za-z]+$/;
7290
+ forbiddenHeaderValue = /[\0\r\n]/;
7291
+ GlobalHeaders = globalThis.Headers;
7292
+ RequestHeaders = class {
7293
+ #incoming;
7294
+ #rawHeaders;
7295
+ #headers;
7296
+ #invalidValue;
7297
+ constructor(incoming) {
7298
+ this.#incoming = incoming;
7299
+ if (incoming instanceof Http2ServerRequest)
7300
+ this.#rawHeaders = incoming.rawHeaders.slice();
7301
+ }
7302
+ get #lazyRawHeaders() {
7303
+ return this.#rawHeaders ??= this.#incoming.rawHeaders.slice();
7304
+ }
7305
+ get #native() {
7306
+ if (!this.#headers) {
7307
+ this.#headers = materializeHeaders(this.#lazyRawHeaders);
7308
+ this.#rawHeaders = undefined;
7309
+ }
7310
+ return this.#headers;
7311
+ }
7312
+ #normalizedName(name) {
7313
+ if (typeof name !== "string")
7314
+ return;
7315
+ if (!validHeaderName.test(name))
7316
+ throw new TypeError(`Invalid header name: ${name}`);
7317
+ return name.toLowerCase();
7318
+ }
7319
+ #lookupHttp1(lowerName) {
7320
+ const headers = this.#incoming instanceof Http2ServerRequest ? undefined : this.#incoming.headers;
7321
+ if (!headers || nonJoinedHeaders.has(lowerName) || lowerName === "set-cookie" || lowerName === "__proto__")
7322
+ return;
7323
+ if (!Object.hasOwn(headers, lowerName))
7324
+ return null;
7325
+ const rawValue = headers[lowerName];
7326
+ if (typeof rawValue === "string") {
7327
+ const value = normalizeHeaderValue(rawValue);
7328
+ return forbiddenHeaderValue.test(value) ? undefined : value;
7329
+ }
7330
+ }
7331
+ #lookup(rawHeaders, lowerName) {
7332
+ const separator = lowerName === "cookie" ? "; " : ", ";
7333
+ let value = null;
7334
+ for (let i = 0;i < rawHeaders.length; i += 2) {
7335
+ const rawName = rawHeaders[i];
7336
+ if (rawName.length === lowerName.length && rawName.toLowerCase() === lowerName) {
7337
+ const rawValue = normalizeHeaderValue(rawHeaders[i + 1]);
7338
+ if (forbiddenHeaderValue.test(rawValue)) {
7339
+ this.#invalidValue = true;
7340
+ return;
7341
+ }
7342
+ value = value === null ? rawValue : value + separator + rawValue;
7343
+ }
7344
+ }
7345
+ return value;
7346
+ }
7347
+ append(name, value) {
7348
+ this.#native.append(name, value);
7349
+ }
7350
+ delete(name) {
7351
+ this.#native.delete(name);
7352
+ }
7353
+ get(name) {
7354
+ const lowerName = this.#normalizedName(name);
7355
+ if (lowerName && !this.#headers && !this.#invalidValue) {
7356
+ const http1Value = this.#lookupHttp1(lowerName);
7357
+ if (http1Value !== undefined)
7358
+ return http1Value;
7359
+ const value = this.#lookup(this.#lazyRawHeaders, lowerName);
7360
+ if (value !== undefined)
7361
+ return value;
7362
+ }
7363
+ return this.#native.get(name);
7364
+ }
7365
+ has(name) {
7366
+ const lowerName = this.#normalizedName(name);
7367
+ if (lowerName && !this.#headers && !this.#invalidValue) {
7368
+ const http1Value = this.#lookupHttp1(lowerName);
7369
+ if (http1Value !== undefined)
7370
+ return http1Value !== null;
7371
+ const value = this.#lookup(this.#lazyRawHeaders, lowerName);
7372
+ if (value !== undefined)
7373
+ return value !== null;
7374
+ }
7375
+ return this.#native.has(name);
7376
+ }
7377
+ set(name, value) {
7378
+ this.#native.set(name, value);
7379
+ }
7380
+ getSetCookie() {
7381
+ return this.#native.getSetCookie();
7382
+ }
7383
+ keys() {
7384
+ return this.#native.keys();
7385
+ }
7386
+ values() {
7387
+ return this.#native.values();
7388
+ }
7389
+ entries() {
7390
+ return this.#native.entries();
7391
+ }
7392
+ forEach(callback, thisArg) {
7393
+ this.#native.forEach((value, key) => {
7394
+ callback.call(thisArg, value, key, this);
7395
+ });
7396
+ }
7397
+ [Symbol.iterator]() {
7398
+ return this.entries();
7399
+ }
7400
+ };
7401
+ Object.defineProperty(RequestHeaders.prototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
7402
+ return `Headers (lightweight) ${inspectFn(Object.fromEntries(this), {
7403
+ ...options,
7404
+ depth: depth == null ? null : depth - 1
7405
+ })}`;
7406
+ } });
7407
+ Object.setPrototypeOf(RequestHeaders.prototype, GlobalHeaders.prototype);
7408
+ reValidRequestUrl = /^\/[!#$&-;=?-\[\]_a-z~]*$/;
7409
+ reDotSegment = /\/\.\.?(?:[/?#]|$)/;
7410
+ reValidHost = /^[a-z0-9._-]+(?::(?:[1-5]\d{3,4}|[6-9]\d{3}))?$/;
6938
7411
  GlobalRequest = global.Request;
6939
- Request2 = class extends GlobalRequest {
7412
+ Request$1 = class extends GlobalRequest {
6940
7413
  constructor(input, options) {
6941
7414
  if (typeof input === "object" && getRequestCache in input) {
7415
+ const hasReplacementBody = options !== undefined && "body" in options && options.body != null;
7416
+ if (input[bodyConsumedDirectlyKey] && !hasReplacementBody)
7417
+ throw new TypeError("Cannot construct a Request with a Request object that has already been used.");
6942
7418
  input = input[getRequestCache]();
6943
7419
  }
6944
- if (typeof options?.body?.getReader !== "undefined") {
7420
+ if (typeof options?.body?.getReader !== "undefined")
6945
7421
  options.duplex ??= "half";
6946
- }
6947
7422
  super(input, options);
6948
7423
  }
6949
7424
  };
6950
7425
  wrapBodyStream = Symbol("wrapBodyStream");
7426
+ byteExactEncodings = new Set([
7427
+ "latin1",
7428
+ "binary",
7429
+ "hex",
7430
+ "base64",
7431
+ "base64url"
7432
+ ]);
7433
+ bodyBufferedBeforeDisconnectKey = Symbol("bodyBufferedBeforeDisconnect");
7434
+ bodyBufferedLengthBeforeDisconnectKey = Symbol("bodyBufferedLengthBeforeDisconnect");
6951
7435
  getRequestCache = Symbol("getRequestCache");
6952
7436
  requestCache = Symbol("requestCache");
6953
7437
  incomingKey = Symbol("incomingKey");
6954
7438
  urlKey = Symbol("urlKey");
7439
+ methodKey = Symbol("methodKey");
6955
7440
  headersKey = Symbol("headersKey");
6956
7441
  abortControllerKey = Symbol("abortControllerKey");
6957
7442
  getAbortController = Symbol("getAbortController");
7443
+ abortRequest = Symbol("abortRequest");
7444
+ bodyBufferKey = Symbol("bodyBuffer");
7445
+ bodyReadPromiseKey = Symbol("bodyReadPromise");
7446
+ bodyConsumedDirectlyKey = Symbol("bodyConsumedDirectly");
7447
+ bodyLockReaderKey = Symbol("bodyLockReader");
7448
+ abortReasonKey = Symbol("abortReason");
7449
+ textDecoder = new TextDecoder;
7450
+ methodTokenRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
6958
7451
  requestPrototype = {
6959
7452
  get method() {
6960
- return this[incomingKey].method || "GET";
7453
+ return this[methodKey];
6961
7454
  },
6962
7455
  get url() {
6963
7456
  return this[urlKey];
@@ -6965,91 +7458,164 @@ var init_dist = __esm(() => {
6965
7458
  get headers() {
6966
7459
  return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
6967
7460
  },
7461
+ [abortRequest](reason) {
7462
+ if (this[abortReasonKey] === undefined)
7463
+ this[abortReasonKey] = reason;
7464
+ const abortController = this[abortControllerKey];
7465
+ if (abortController && !abortController.signal.aborted)
7466
+ abortController.abort(reason);
7467
+ },
6968
7468
  [getAbortController]() {
6969
- this[getRequestCache]();
7469
+ this[abortControllerKey] ||= new AbortController;
7470
+ if (this[abortReasonKey] !== undefined && !this[abortControllerKey].signal.aborted)
7471
+ this[abortControllerKey].abort(this[abortReasonKey]);
6970
7472
  return this[abortControllerKey];
6971
7473
  },
6972
7474
  [getRequestCache]() {
6973
- this[abortControllerKey] ||= new AbortController;
6974
- return this[requestCache] ||= newRequestFromIncoming(this.method, this[urlKey], this.headers, this[incomingKey], this[abortControllerKey]);
7475
+ const abortController = this[getAbortController]();
7476
+ if (this[requestCache])
7477
+ return this[requestCache];
7478
+ const method = this.method;
7479
+ if (this[bodyConsumedDirectlyKey] && !(method === "GET" || method === "HEAD")) {
7480
+ this[bodyBufferKey] = undefined;
7481
+ const init = {
7482
+ method: method === "TRACE" ? "GET" : method,
7483
+ headers: this.headers,
7484
+ signal: abortController.signal
7485
+ };
7486
+ if (method !== "TRACE") {
7487
+ init.body = new ReadableStream({ start(c) {
7488
+ c.close();
7489
+ } });
7490
+ init.duplex = "half";
7491
+ }
7492
+ const req = new Request$1(this[urlKey], init);
7493
+ if (method === "TRACE")
7494
+ Object.defineProperty(req, "method", { get() {
7495
+ return "TRACE";
7496
+ } });
7497
+ return this[requestCache] = req;
7498
+ }
7499
+ return this[requestCache] = newRequestFromIncoming(this.method, this[urlKey], this.headers, this[incomingKey], abortController);
7500
+ },
7501
+ get body() {
7502
+ if (!this[bodyConsumedDirectlyKey])
7503
+ return this[getRequestCache]().body;
7504
+ const request = this[getRequestCache]();
7505
+ if (!this[bodyLockReaderKey] && request.body)
7506
+ this[bodyLockReaderKey] = request.body.getReader();
7507
+ return request.body;
7508
+ },
7509
+ get bodyUsed() {
7510
+ if (this[bodyConsumedDirectlyKey])
7511
+ return true;
7512
+ if (this[requestCache])
7513
+ return this[requestCache].bodyUsed;
7514
+ return false;
6975
7515
  }
6976
7516
  };
7517
+ Object.defineProperty(requestPrototype, "signal", { get() {
7518
+ return this[getAbortController]().signal;
7519
+ } });
6977
7520
  [
6978
- "body",
6979
- "bodyUsed",
6980
7521
  "cache",
6981
7522
  "credentials",
6982
7523
  "destination",
7524
+ "duplex",
6983
7525
  "integrity",
6984
7526
  "mode",
6985
7527
  "redirect",
6986
7528
  "referrer",
6987
7529
  "referrerPolicy",
6988
- "signal",
6989
7530
  "keepalive"
6990
7531
  ].forEach((k) => {
6991
- Object.defineProperty(requestPrototype, k, {
6992
- get() {
6993
- return this[getRequestCache]()[k];
6994
- }
6995
- });
6996
- });
6997
- ["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
6998
- Object.defineProperty(requestPrototype, k, {
6999
- value: function() {
7000
- return this[getRequestCache]()[k]();
7001
- }
7532
+ Object.defineProperty(requestPrototype, k, { get() {
7533
+ return this[getRequestCache]()[k];
7534
+ } });
7535
+ });
7536
+ ["clone", "formData"].forEach((k) => {
7537
+ Object.defineProperty(requestPrototype, k, { value: function() {
7538
+ if (this[bodyConsumedDirectlyKey]) {
7539
+ if (k === "clone")
7540
+ throw newBodyUnusableError();
7541
+ return rejectBodyUnusable();
7542
+ }
7543
+ return this[getRequestCache]()[k]();
7544
+ } });
7545
+ });
7546
+ Object.defineProperty(requestPrototype, "text", { value: function() {
7547
+ return readBodyWithFastPath(this, "text", (buf) => textDecoder.decode(buf));
7548
+ } });
7549
+ Object.defineProperty(requestPrototype, "arrayBuffer", { value: function() {
7550
+ return readBodyWithFastPath(this, "arrayBuffer", (buf) => toArrayBuffer(buf));
7551
+ } });
7552
+ Object.defineProperty(requestPrototype, "blob", { value: function() {
7553
+ return readBodyWithFastPath(this, "blob", (buf, request) => {
7554
+ const type = contentType(request);
7555
+ const init = type ? { headers: { "content-type": type } } : undefined;
7556
+ return new Response(buf, init).blob();
7002
7557
  });
7003
- });
7004
- Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), {
7005
- value: function(depth, options, inspectFn) {
7006
- const props = {
7007
- method: this.method,
7008
- url: this.url,
7009
- headers: this.headers,
7010
- nativeRequest: this[requestCache]
7011
- };
7012
- return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`;
7013
- }
7014
- });
7015
- Object.setPrototypeOf(requestPrototype, Request2.prototype);
7558
+ } });
7559
+ Object.defineProperty(requestPrototype, "json", { value: function() {
7560
+ if (this[bodyConsumedDirectlyKey])
7561
+ return rejectBodyUnusable();
7562
+ return this.text().then(JSON.parse);
7563
+ } });
7564
+ Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
7565
+ return `Request (lightweight) ${inspectFn({
7566
+ method: this.method,
7567
+ url: this.url,
7568
+ headers: this.headers,
7569
+ nativeRequest: this[requestCache]
7570
+ }, {
7571
+ ...options,
7572
+ depth: depth == null ? null : depth - 1
7573
+ })}`;
7574
+ } });
7575
+ Object.setPrototypeOf(requestPrototype, Request$1.prototype);
7016
7576
  responseCache = Symbol("responseCache");
7017
7577
  getResponseCache = Symbol("getResponseCache");
7018
7578
  cacheKey = Symbol("cache");
7019
7579
  GlobalResponse = global.Response;
7020
- Response2 = class _Response {
7580
+ Response$1 = class Response$1 {
7021
7581
  #body;
7022
7582
  #init;
7023
7583
  [getResponseCache]() {
7584
+ const cache = this[cacheKey];
7585
+ const liveHeaders = cache && cache[2] instanceof Headers ? cache[2] : undefined;
7024
7586
  delete this[cacheKey];
7025
- return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
7587
+ return this[responseCache] ||= new GlobalResponse(this.#body, liveHeaders ? {
7588
+ status: this.#init?.status,
7589
+ statusText: this.#init?.statusText,
7590
+ headers: liveHeaders
7591
+ } : this.#init);
7026
7592
  }
7027
7593
  constructor(body, init) {
7028
7594
  let headers;
7029
7595
  this.#body = body;
7030
- if (init instanceof _Response) {
7596
+ if (init instanceof GlobalResponse) {
7031
7597
  const cachedGlobalResponse = init[responseCache];
7032
7598
  if (cachedGlobalResponse) {
7033
7599
  this.#init = cachedGlobalResponse;
7034
7600
  this[getResponseCache]();
7035
7601
  return;
7036
- } else {
7037
- this.#init = init.#init;
7038
- headers = new Headers(init.#init.headers);
7039
7602
  }
7040
- } else {
7603
+ this.#init = init instanceof Response$1 ? init.#init : init;
7604
+ headers = new Headers(init.headers);
7605
+ } else
7041
7606
  this.#init = init;
7042
- }
7043
- if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
7044
- this[cacheKey] = [init?.status || 200, body, headers || init?.headers];
7045
- }
7607
+ if (body == null || typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array)
7608
+ this[cacheKey] = [
7609
+ init?.status || 200,
7610
+ body ?? null,
7611
+ headers || init?.headers
7612
+ ];
7046
7613
  }
7047
7614
  get headers() {
7048
7615
  const cache = this[cacheKey];
7049
7616
  if (cache) {
7050
- if (!(cache[2] instanceof Headers)) {
7051
- cache[2] = new Headers(cache[2] || { "content-type": "text/plain; charset=UTF-8" });
7052
- }
7617
+ if (!(cache[2] instanceof Headers))
7618
+ cache[2] = new Headers(cache[2] || (cache[1] === null ? undefined : { "content-type": defaultContentType }));
7053
7619
  return cache[2];
7054
7620
  }
7055
7621
  return this[getResponseCache]().headers;
@@ -7062,39 +7628,219 @@ var init_dist = __esm(() => {
7062
7628
  return status >= 200 && status < 300;
7063
7629
  }
7064
7630
  };
7065
- ["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => {
7066
- Object.defineProperty(Response2.prototype, k, {
7067
- get() {
7068
- return this[getResponseCache]()[k];
7069
- }
7070
- });
7631
+ [
7632
+ "body",
7633
+ "bodyUsed",
7634
+ "redirected",
7635
+ "statusText",
7636
+ "trailers",
7637
+ "type",
7638
+ "url"
7639
+ ].forEach((k) => {
7640
+ Object.defineProperty(Response$1.prototype, k, { get() {
7641
+ return this[getResponseCache]()[k];
7642
+ } });
7071
7643
  });
7072
- ["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
7073
- Object.defineProperty(Response2.prototype, k, {
7074
- value: function() {
7075
- return this[getResponseCache]()[k]();
7076
- }
7077
- });
7644
+ [
7645
+ "arrayBuffer",
7646
+ "blob",
7647
+ "clone",
7648
+ "formData",
7649
+ "json",
7650
+ "text"
7651
+ ].forEach((k) => {
7652
+ Object.defineProperty(Response$1.prototype, k, { value: function() {
7653
+ return this[getResponseCache]()[k]();
7654
+ } });
7655
+ });
7656
+ Object.defineProperty(Response$1.prototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
7657
+ return `Response (lightweight) ${inspectFn({
7658
+ status: this.status,
7659
+ headers: this.headers,
7660
+ ok: this.ok,
7661
+ nativeResponse: this[responseCache]
7662
+ }, {
7663
+ ...options,
7664
+ depth: depth == null ? null : depth - 1
7665
+ })}`;
7666
+ } });
7667
+ Object.setPrototypeOf(Response$1, GlobalResponse);
7668
+ Object.setPrototypeOf(Response$1.prototype, GlobalResponse.prototype);
7669
+ validRedirectUrl = /^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/;
7670
+ validRedirectStatuses = new Set([
7671
+ 301,
7672
+ 302,
7673
+ 303,
7674
+ 307,
7675
+ 308
7676
+ ]);
7677
+ Object.defineProperty(Response$1, "redirect", {
7678
+ value: function redirect(url, status = 302) {
7679
+ if (!validRedirectStatuses.has(status))
7680
+ throw new RangeError("Invalid status code");
7681
+ return new Response$1(null, {
7682
+ status,
7683
+ headers: { location: parseRedirectUrl(url) }
7684
+ });
7685
+ },
7686
+ writable: true,
7687
+ configurable: true
7078
7688
  });
7079
- Object.defineProperty(Response2.prototype, Symbol.for("nodejs.util.inspect.custom"), {
7080
- value: function(depth, options, inspectFn) {
7081
- const props = {
7082
- status: this.status,
7083
- headers: this.headers,
7084
- ok: this.ok,
7085
- nativeResponse: this[responseCache]
7086
- };
7087
- return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`;
7088
- }
7689
+ Object.defineProperty(Response$1, "json", {
7690
+ value: function json(data, init) {
7691
+ const body = JSON.stringify(data);
7692
+ if (body === undefined)
7693
+ throw new TypeError("The data is not JSON serializable");
7694
+ const initHeaders = init?.headers;
7695
+ let headers;
7696
+ if (initHeaders) {
7697
+ headers = new Headers(initHeaders);
7698
+ if (!headers.has("content-type"))
7699
+ headers.set("content-type", "application/json");
7700
+ } else
7701
+ headers = { "content-type": "application/json" };
7702
+ return new Response$1(body, {
7703
+ status: init?.status ?? 200,
7704
+ statusText: init?.statusText,
7705
+ headers
7706
+ });
7707
+ },
7708
+ writable: true,
7709
+ configurable: true
7089
7710
  });
7090
- Object.setPrototypeOf(Response2, GlobalResponse);
7091
- Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
7092
- if (typeof global.crypto === "undefined") {
7093
- global.crypto = crypto2;
7094
- }
7095
7711
  outgoingEnded = Symbol("outgoingEnded");
7096
7712
  incomingDraining = Symbol("incomingDraining");
7097
7713
  MAX_DRAIN_BYTES = 64 * 1024 * 1024;
7714
+ CloseEvent = globalThis.CloseEvent ?? class extends Event {
7715
+ #eventInitDict;
7716
+ constructor(type, eventInitDict = {}) {
7717
+ super(type, eventInitDict);
7718
+ this.#eventInitDict = eventInitDict;
7719
+ }
7720
+ get wasClean() {
7721
+ return this.#eventInitDict.wasClean ?? false;
7722
+ }
7723
+ get code() {
7724
+ return this.#eventInitDict.code ?? 0;
7725
+ }
7726
+ get reason() {
7727
+ return this.#eventInitDict.reason ?? "";
7728
+ }
7729
+ };
7730
+ ErrorEvent = globalThis.ErrorEvent ?? class extends Event {
7731
+ #eventInitDict;
7732
+ constructor(type, eventInitDict = {}) {
7733
+ super(type, eventInitDict);
7734
+ this.#eventInitDict = eventInitDict;
7735
+ }
7736
+ get message() {
7737
+ return this.#eventInitDict.message ?? "";
7738
+ }
7739
+ get filename() {
7740
+ return this.#eventInitDict.filename ?? "";
7741
+ }
7742
+ get lineno() {
7743
+ return this.#eventInitDict.lineno ?? 0;
7744
+ }
7745
+ get colno() {
7746
+ return this.#eventInitDict.colno ?? 0;
7747
+ }
7748
+ get error() {
7749
+ return this.#eventInitDict.error ?? null;
7750
+ }
7751
+ };
7752
+ CONNECTION_SYMBOL_KEY = Symbol("CONNECTION_SYMBOL_KEY");
7753
+ WAIT_FOR_WEBSOCKET_SYMBOL = Symbol("WAIT_FOR_WEBSOCKET_SYMBOL");
7754
+ responseHeadersToSkip = new Set([
7755
+ "connection",
7756
+ "content-length",
7757
+ "keep-alive",
7758
+ "proxy-authenticate",
7759
+ "proxy-authorization",
7760
+ "te",
7761
+ "trailer",
7762
+ "transfer-encoding",
7763
+ "upgrade",
7764
+ "sec-websocket-accept",
7765
+ "sec-websocket-extensions",
7766
+ "sec-websocket-protocol"
7767
+ ]);
7768
+ upgradeWebSocket = defineWebSocketHelper(async (c, events, options) => {
7769
+ if (c.req.header("upgrade")?.toLowerCase() !== "websocket")
7770
+ return;
7771
+ const env = c.env;
7772
+ const waitForWebSocket = env[WAIT_FOR_WEBSOCKET_SYMBOL];
7773
+ if (!waitForWebSocket || !env.incoming)
7774
+ return new Response(null, { status: 500 });
7775
+ const connectionSymbol = generateConnectionSymbol();
7776
+ env[CONNECTION_SYMBOL_KEY] = connectionSymbol;
7777
+ (async () => {
7778
+ let ws;
7779
+ try {
7780
+ ws = await waitForWebSocket(env.incoming, connectionSymbol);
7781
+ } catch {
7782
+ return;
7783
+ }
7784
+ const messagesReceivedInStarting = [];
7785
+ const bufferMessage = (data, isBinary) => {
7786
+ messagesReceivedInStarting.push([data, isBinary]);
7787
+ };
7788
+ ws.on("message", bufferMessage);
7789
+ const ctx = {
7790
+ binaryType: "arraybuffer",
7791
+ close(code, reason) {
7792
+ ws.close(code, reason);
7793
+ },
7794
+ protocol: ws.protocol,
7795
+ raw: ws,
7796
+ get readyState() {
7797
+ return ws.readyState;
7798
+ },
7799
+ send(source, opts) {
7800
+ ws.send(source, { compress: opts?.compress });
7801
+ },
7802
+ url: new URL(c.req.url)
7803
+ };
7804
+ try {
7805
+ events?.onOpen?.(new Event("open"), ctx);
7806
+ } catch (e) {
7807
+ (options?.onError ?? console.error)(e);
7808
+ }
7809
+ const handleMessage = (data, isBinary) => {
7810
+ const datas = Array.isArray(data) ? data : [data];
7811
+ for (const data of datas)
7812
+ try {
7813
+ events?.onMessage?.(new MessageEvent("message", { data: isBinary ? data instanceof ArrayBuffer ? data : data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength) : typeof data === "string" ? data : Buffer.from(data).toString("utf-8") }), ctx);
7814
+ } catch (e) {
7815
+ (options?.onError ?? console.error)(e);
7816
+ }
7817
+ };
7818
+ ws.off("message", bufferMessage);
7819
+ for (const message of messagesReceivedInStarting)
7820
+ handleMessage(...message);
7821
+ ws.on("message", (data, isBinary) => {
7822
+ handleMessage(data, isBinary);
7823
+ });
7824
+ ws.on("close", (code, reason) => {
7825
+ try {
7826
+ events?.onClose?.(new CloseEvent("close", {
7827
+ code,
7828
+ reason: reason.toString()
7829
+ }), ctx);
7830
+ } catch (e) {
7831
+ (options?.onError ?? console.error)(e);
7832
+ }
7833
+ });
7834
+ ws.on("error", (error) => {
7835
+ try {
7836
+ events?.onError?.(new ErrorEvent("error", { error }), ctx);
7837
+ } catch (e) {
7838
+ (options?.onError ?? console.error)(e);
7839
+ }
7840
+ });
7841
+ })();
7842
+ return new Response;
7843
+ });
7098
7844
  });
7099
7845
 
7100
7846
  // node_modules/content-type/index.js
@@ -27418,7 +28164,7 @@ var require_encodeurl = __commonJS(function(exports, module) {
27418
28164
  * MIT Licensed
27419
28165
  */
27420
28166
  module.exports = encodeUrl;
27421
- var ENCODE_CHARS_REGEXP = /(?:[^\x21\x23-\x3B\x3D\x3F-\x5F\x61-\x7A\x7C\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g;
28167
+ var ENCODE_CHARS_REGEXP = /(?:[^\x21\x23-\x3B\x3D\x3F-\x5F\x61-\x7A\x7C\x7E]+|%+(?![0-9A-Fa-f]{2})){1,1024}/g;
27422
28168
  var SURROGATE_REGEXP = /([\uD800-\uDBFF][\uDC00-\uDFFF])|[\uD800-\uDFFF]/g;
27423
28169
  function encodeUrl(url) {
27424
28170
  return String(url).replace(SURROGATE_REGEXP, function(_, pair) {
@@ -53747,9 +54493,9 @@ var init_config = __esm(() => {
53747
54493
  SDK_METADATA = {
53748
54494
  language: "typescript",
53749
54495
  openapiDocVersion: "1.0.0",
53750
- sdkVersion: "0.4.23",
54496
+ sdkVersion: "0.4.25",
53751
54497
  genVersion: "2.948.4",
53752
- userAgent: "speakeasy-sdk/mcp-typescript 0.4.23 2.948.4 1.0.0 @lightsage/mcp"
54498
+ userAgent: "speakeasy-sdk/mcp-typescript 0.4.25 2.948.4 1.0.0 @lightsage/mcp"
53753
54499
  };
53754
54500
  });
53755
54501
 
@@ -58922,6 +59668,7 @@ var init_createv2evalrequest = __esm(() => {
58922
59668
  agent: array(string2()).optional().describe("Runnable agents from `GET /v2/agents`. An empty array saves the eval without default agents. CLI clients expose repeatable `--agent`."),
58923
59669
  cleanup_commands: array(string2()).optional().describe("Best-effort shell commands run sequentially after agent execution and result capture, before sandbox deletion. CLI clients expose repeatable `--cleanup-command`."),
58924
59670
  clis: array(string2()).optional().describe("Saved CLI IDs or shell installation commands. UUID values resolve saved CLIs from `GET /v2/clis`; every other value is run as an installation command. CLI clients expose repeatable `--cli`."),
59671
+ include_env_vars: boolean2().default(true).describe("Whether runs get environment variables. Set false to run with no environment: neither a configuration's environment nor the organization's default environment is attached. This is the same setting as Environment: Off in the app."),
58925
59672
  judges: array(string2()).describe("Plain-text success criteria. CLI clients expose this as repeatable `--judge`."),
58926
59673
  mcps: array(union([
58927
59674
  V2InlineMcpDefinition$zodSchema,
@@ -59091,6 +59838,7 @@ var init_v2eval = __esm(() => {
59091
59838
  ])).optional(),
59092
59839
  created_at: string2().nullable().optional(),
59093
59840
  id: string2(),
59841
+ include_env_vars: boolean2().default(true).describe("Whether runs get environment variables. false means runs use no environment, as Environment: Off in the app."),
59094
59842
  judges: array(string2()).optional(),
59095
59843
  mcps: array(union([
59096
59844
  V2InlineMcpDefinition$zodSchema,
@@ -59257,12 +60005,13 @@ var init_publiccriterionverdict = __esm(() => {
59257
60005
  Verdict$zodSchema = _enum([
59258
60006
  "PASS",
59259
60007
  "FAIL",
59260
- "NOT_VERIFIED"
59261
- ]).describe("`PASS` when the evidence shows the requirement was met, `FAIL` when it shows it was not, and `NOT_VERIFIED` when the evidence cannot confirm it. Any `FAIL` or `NOT_VERIFIED` fails the run, whatever the score.");
60008
+ "NOT_VERIFIED",
60009
+ "NOT_APPLICABLE"
60010
+ ]).describe('`PASS` when the evidence shows the requirement was met, `FAIL` when it shows it was not, and `NOT_VERIFIED` when the evidence cannot confirm it. Any `FAIL` or `NOT_VERIFIED` fails the run, whatever the score. `NOT_APPLICABLE` when the requirement states its own condition ("If X is used, ...") and that condition did not occur; it neither passes nor fails the run.');
59262
60011
  PublicCriterionVerdict$zodSchema = object({
59263
60012
  criterion: string2().describe("One mandatory requirement from the judge criteria."),
59264
60013
  evidence: string2().nullable().optional().describe("Short evidence the judge gave for the verdict."),
59265
- verdict: Verdict$zodSchema.describe("`PASS` when the evidence shows the requirement was met, `FAIL` when it shows it was not, and `NOT_VERIFIED` when the evidence cannot confirm it. Any `FAIL` or `NOT_VERIFIED` fails the run, whatever the score.")
60014
+ verdict: Verdict$zodSchema.describe('`PASS` when the evidence shows the requirement was met, `FAIL` when it shows it was not, and `NOT_VERIFIED` when the evidence cannot confirm it. Any `FAIL` or `NOT_VERIFIED` fails the run, whatever the score. `NOT_APPLICABLE` when the requirement states its own condition ("If X is used, ...") and that condition did not occur; it neither passes nor fails the run.')
59266
60015
  });
59267
60016
  });
59268
60017
 
@@ -59277,6 +60026,7 @@ var init_publicgraderresult = __esm(() => {
59277
60026
  details: string2().nullable().optional().describe("Reasoning or check output explaining the verdict."),
59278
60027
  label: string2().nullable().optional().describe("Display name for the check, when the grader sets one."),
59279
60028
  name: string2().describe("Grader name as configured on the eval."),
60029
+ not_applicable: boolean2().default(false).describe("Judges only: true when every requirement was `NOT_APPLICABLE`. The check is left out of the run's score and does not fail the run."),
59280
60030
  passed: boolean2().nullable().optional().describe("Whether this check passed."),
59281
60031
  score: number2().nullable().optional().describe("Score from 0 to 1 for checks that score partially, such as judges; null for pass/fail checks.")
59282
60032
  });
@@ -59301,6 +60051,19 @@ var init_v2evalresulttoolcall = __esm(() => {
59301
60051
  }).describe("How long one tool call of an eval result took.");
59302
60052
  });
59303
60053
 
60054
+ // src/models/v2setupcommandoutput.ts
60055
+ var V2SetupCommandOutput$zodSchema;
60056
+ var init_v2setupcommandoutput = __esm(() => {
60057
+ init_zod();
60058
+ V2SetupCommandOutput$zodSchema = object({
60059
+ command: string2().describe("The setup command as saved on the eval."),
60060
+ exit_code: int().nullable().optional().describe("The command's exit code."),
60061
+ output: string2().nullable().optional().describe("The end of what the command printed (up to 4,000 characters), with secret values redacted."),
60062
+ output_truncated: boolean2().default(false).describe("True when earlier output was cut off."),
60063
+ status: string2().nullable().optional().describe("`succeeded` for a completed command.")
60064
+ });
60065
+ });
60066
+
59304
60067
  // src/models/v2evalresultsummary.ts
59305
60068
  var V2EvalResultSummary$zodSchema;
59306
60069
  var init_v2evalresultsummary = __esm(() => {
@@ -59310,6 +60073,7 @@ var init_v2evalresultsummary = __esm(() => {
59310
60073
  init_searchgroundingmode();
59311
60074
  init_v2evalresulttoolcall();
59312
60075
  init_v2preferenceresult();
60076
+ init_v2setupcommandoutput();
59313
60077
  V2EvalResultSummary$zodSchema = object({
59314
60078
  agent: string2().nullable().optional().describe("Runnable agent combining the harness and model."),
59315
60079
  created_at: string2().nullable().optional(),
@@ -59329,6 +60093,7 @@ var init_v2evalresultsummary = __esm(() => {
59329
60093
  score: number2().nullable().optional().describe("Score from 0 to 1."),
59330
60094
  search_grounding: SearchGroundingMode$zodSchema.nullable().optional(),
59331
60095
  search_observed: boolean2().nullable().optional(),
60096
+ setup_output: array(V2SetupCommandOutput$zodSchema).optional().describe("Setup commands run before the agent started, in order, with the end of what each printed. Secret values are redacted. Empty when the eval has no setup commands or the attempt ran before setup output was recorded."),
59332
60097
  tool_calls: array(V2EvalResultToolCall$zodSchema).optional().describe("Every tool call the agent made, in order, with how long each took. Empty when the agent made no tool calls or the model does not use tools."),
59333
60098
  web_retrieval_observed: boolean2().nullable().optional()
59334
60099
  });
@@ -59758,6 +60523,7 @@ var init_createv2evalrunrequest = __esm(() => {
59758
60523
  configuration_id: string2().optional().describe("Saved-run form only. Optional saved repository, environment, skills, and legacy tool configuration."),
59759
60524
  env: record(string2(), string2()).optional().describe("Write-only environment variables for this launch. Values are stored only in the queued job's private configuration."),
59760
60525
  eval_id: string2().optional().describe("Saved-run form only. Existing eval definition to run. Omit this field to use the direct create-and-run form."),
60526
+ include_env_vars: boolean2().optional().describe("Either request form. false runs this launch with no environment: neither the configuration's environment nor the organization's default environment is attached. Omit it to use the eval's saved setting. Cannot be false when `env` is sent."),
59761
60527
  judges: array(string2()).nullable().optional().describe("Success criteria. Required in direct mode; in saved mode, replaces saved judges for this launch. CLI clients expose repeatable `--judge`."),
59762
60528
  mcps: array(union([
59763
60529
  V2InlineMcpDefinition$zodSchema,
@@ -60089,6 +60855,7 @@ var init_updatev2evalrequest = __esm(() => {
60089
60855
  agent: array(string2()).nullable().optional(),
60090
60856
  cleanup_commands: array(string2()).nullable().optional().describe("Replacement cleanup commands. Pass an empty array to clear all saved cleanup commands."),
60091
60857
  clis: array(string2()).nullable().optional().describe("Replacement saved CLI IDs or shell installation commands. UUID values resolve saved CLIs; every other value is an installation command. Pass an empty array to clear all CLIs."),
60858
+ include_env_vars: boolean2().optional().describe("Replacement environment setting. false runs the eval with no environment; omit it to keep the saved value."),
60092
60859
  judges: array(string2()).nullable().optional().describe("Replacement success criteria for the eval."),
60093
60860
  mcps: array(union([
60094
60861
  V2InlineMcpDefinition$zodSchema,
@@ -60290,6 +61057,7 @@ var init_graderdefinition = __esm(() => {
60290
61057
  needle: string2().nullable().optional(),
60291
61058
  needles: array(string2()).nullable().optional(),
60292
61059
  pattern: string2().nullable().optional(),
61060
+ plugin: string2().nullable().optional(),
60293
61061
  type: string2(),
60294
61062
  weight: number2().default(1)
60295
61063
  });
@@ -61533,6 +62301,158 @@ Returns one computed opportunity and its execution context for the selected date
61533
62301
  };
61534
62302
  });
61535
62303
 
62304
+ // src/models/publicpluginevalresultsdownload.ts
62305
+ var PublicPluginEvalResultsDownload$zodSchema;
62306
+ var init_publicpluginevalresultsdownload = __esm(() => {
62307
+ init_zod();
62308
+ PublicPluginEvalResultsDownload$zodSchema = object({
62309
+ created_at: datetime2({ offset: true }).nullable().optional().describe("When the results were prepared."),
62310
+ download_url: string2().describe('Downloads the zip of the day\'s runs and their insights report. It works without an API key until `expires_at`, so any HTTP client can fetch it, for example `curl -o results.zip "<download_url>"`. List the results again for a new link.'),
62311
+ expires_at: datetime2({ offset: true }).describe("When `download_url` stops working, 15 minutes after the list was requested."),
62312
+ filename: string2().nullable().optional().describe("The zip file's name."),
62313
+ plugin: string2().describe("The plugin's slug, such as `firecrawl`."),
62314
+ prompts: int().nullable().optional().describe("Distinct prompts included in the download."),
62315
+ runs: int().nullable().optional().describe("Runs included in the download.")
62316
+ });
62317
+ });
62318
+
62319
+ // src/models/publicpluginevalresultsresponse.ts
62320
+ var PublicPluginEvalResultsResponse$zodSchema;
62321
+ var init_publicpluginevalresultsresponse = __esm(() => {
62322
+ init_zod();
62323
+ init_publicpluginevalresultsdownload();
62324
+ PublicPluginEvalResultsResponse$zodSchema = object({
62325
+ date: string2().describe("The day the results cover, as YYYY-MM-DD."),
62326
+ results: array(PublicPluginEvalResultsDownload$zodSchema).describe("One download per plugin with results on that day.")
62327
+ });
62328
+ });
62329
+
62330
+ // src/models/v2pluginevalsresultslistop.ts
62331
+ var V2PluginEvalsResultsListRequest$zodSchema, V2PluginEvalsResultsListResponse$zodSchema;
62332
+ var init_v2pluginevalsresultslistop = __esm(() => {
62333
+ init_zod();
62334
+ init_httpvalidationerror();
62335
+ init_publicpluginevalresultsresponse();
62336
+ V2PluginEvalsResultsListRequest$zodSchema = object({
62337
+ date: string2().date().describe("The day to get results for, as YYYY-MM-DD (UTC).")
62338
+ });
62339
+ V2PluginEvalsResultsListResponse$zodSchema = union([
62340
+ PublicPluginEvalResultsResponse$zodSchema,
62341
+ HTTPValidationError$zodSchema
62342
+ ]);
62343
+ });
62344
+
62345
+ // src/funcs/pluginEvalsResultsList.ts
62346
+ function pluginEvalsResultsList(client$, request, options) {
62347
+ return new APIPromise($do42(client$, request, options));
62348
+ }
62349
+ async function $do42(client$, request, options) {
62350
+ const parsed$ = safeParse4(request, (value$) => V2PluginEvalsResultsListRequest$zodSchema.parse(value$), "Input validation failed");
62351
+ if (!parsed$.ok) {
62352
+ return [parsed$, { status: "invalid" }];
62353
+ }
62354
+ const payload$ = parsed$.value;
62355
+ const body$ = null;
62356
+ const path$ = pathToFunc("/v2/plugin-evals/results")();
62357
+ const query$ = encodeFormQuery({
62358
+ date: payload$.date
62359
+ });
62360
+ const headers$ = new Headers(compactMap({
62361
+ Accept: "application/json"
62362
+ }));
62363
+ const securityInput = await extractSecurity(client$._options.security);
62364
+ const requestSecurity = resolveGlobalSecurity(securityInput);
62365
+ const context = {
62366
+ options: client$._options,
62367
+ baseURL: options?.serverURL ?? client$._baseURL ?? "",
62368
+ operationID: "v2_plugin_evals_results_list",
62369
+ oAuth2Scopes: null,
62370
+ resolvedSecurity: requestSecurity,
62371
+ securitySource: client$._options.security,
62372
+ retryConfig: options?.retries || client$._options.retryConfig || { strategy: "none" },
62373
+ retryCodes: options?.retryCodes || [
62374
+ "429",
62375
+ "500",
62376
+ "502",
62377
+ "503",
62378
+ "504"
62379
+ ]
62380
+ };
62381
+ const requestRes = client$._createRequest(context, {
62382
+ security: requestSecurity,
62383
+ method: "GET",
62384
+ baseURL: options?.serverURL,
62385
+ path: path$,
62386
+ headers: headers$,
62387
+ query: query$,
62388
+ body: body$,
62389
+ userAgent: client$._options.userAgent,
62390
+ timeoutMs: options?.timeoutMs || client$._options.timeoutMs || -1
62391
+ }, options);
62392
+ if (!requestRes.ok) {
62393
+ return [requestRes, { status: "invalid" }];
62394
+ }
62395
+ const req$ = requestRes.value;
62396
+ const doResult = await client$._do(req$, {
62397
+ context,
62398
+ errorCodes: [],
62399
+ retryConfig: context.retryConfig,
62400
+ retryCodes: context.retryCodes
62401
+ });
62402
+ if (!doResult.ok) {
62403
+ return [doResult, { status: "request-error", request: req$ }];
62404
+ }
62405
+ return [doResult, {
62406
+ status: "complete",
62407
+ request: req$,
62408
+ response: doResult.value
62409
+ }];
62410
+ }
62411
+ var init_pluginEvalsResultsList = __esm(() => {
62412
+ init_encodings();
62413
+ init_primitives();
62414
+ init_schemas4();
62415
+ init_security();
62416
+ init_url();
62417
+ init_v2pluginevalsresultslistop();
62418
+ init_async();
62419
+ });
62420
+
62421
+ // src/mcp-server/tools/pluginEvalsResultsList.ts
62422
+ var args33, tool$pluginEvalsResultsList;
62423
+ var init_pluginEvalsResultsList2 = __esm(() => {
62424
+ init_pluginEvalsResultsList();
62425
+ init_v2pluginevalsresultslistop();
62426
+ init_tools();
62427
+ args33 = {
62428
+ request: V2PluginEvalsResultsListRequest$zodSchema
62429
+ };
62430
+ tool$pluginEvalsResultsList = {
62431
+ name: "plugin-evals-results-list",
62432
+ description: `List Plugin Eval Results
62433
+
62434
+ Returns a day's plugin eval results, one per plugin with results that day. Each has a \`download_url\` for a zip of every run with and without the plugin installed, plus the insights report written from them. The link works without an API key until \`expires_at\` (15 minutes), so fetch it with any HTTP client, for example \`curl -o results.zip "<download_url>"\`. Returns 404 when no results exist for the date.`,
62435
+ annotations: {
62436
+ title: "",
62437
+ destructiveHint: false,
62438
+ idempotentHint: false,
62439
+ openWorldHint: false,
62440
+ readOnlyHint: true
62441
+ },
62442
+ args: args33,
62443
+ tool: async (client, args, ctx) => {
62444
+ const [result] = await pluginEvalsResultsList(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
62445
+ if (!result.ok) {
62446
+ return {
62447
+ content: [{ type: "text", text: result.error.message }],
62448
+ isError: true
62449
+ };
62450
+ }
62451
+ return formatResult(result.value);
62452
+ }
62453
+ };
62454
+ });
62455
+
61536
62456
  // src/models/v2promptrunsettingsinput.ts
61537
62457
  var V2PromptRunSettingsInputWebSearchInstruction$zodSchema, V2PromptRunSettingsInput$zodSchema;
61538
62458
  var init_v2promptrunsettingsinput = __esm(() => {
@@ -61574,9 +62494,9 @@ var init_createv2promptsrequest = __esm(() => {
61574
62494
 
61575
62495
  // src/funcs/promptsCreate.ts
61576
62496
  function promptsCreate(client$, request, options) {
61577
- return new APIPromise($do42(client$, request, options));
62497
+ return new APIPromise($do43(client$, request, options));
61578
62498
  }
61579
- async function $do42(client$, request, options) {
62499
+ async function $do43(client$, request, options) {
61580
62500
  const parsed$ = safeParse4(request, (value$) => CreateV2PromptsRequest$zodSchema.parse(value$), "Input validation failed");
61581
62501
  if (!parsed$.ok) {
61582
62502
  return [parsed$, { status: "invalid" }];
@@ -61646,12 +62566,12 @@ var init_promptsCreate = __esm(() => {
61646
62566
  });
61647
62567
 
61648
62568
  // src/mcp-server/tools/promptsCreate.ts
61649
- var args33, tool$promptsCreate;
62569
+ var args34, tool$promptsCreate;
61650
62570
  var init_promptsCreate2 = __esm(() => {
61651
62571
  init_promptsCreate();
61652
62572
  init_createv2promptsrequest();
61653
62573
  init_tools();
61654
- args33 = {
62574
+ args34 = {
61655
62575
  request: CreateV2PromptsRequest$zodSchema
61656
62576
  };
61657
62577
  tool$promptsCreate = {
@@ -61666,7 +62586,7 @@ Creates prompts in a batch. Each item is validated independently, so the respons
61666
62586
  openWorldHint: false,
61667
62587
  readOnlyHint: false
61668
62588
  },
61669
- args: args33,
62589
+ args: args34,
61670
62590
  tool: async (client, args, ctx) => {
61671
62591
  const [result] = await promptsCreate(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
61672
62592
  if (!result.ok) {
@@ -61706,9 +62626,9 @@ var init_v2promptsdeleteop = __esm(() => {
61706
62626
 
61707
62627
  // src/funcs/promptsDelete.ts
61708
62628
  function promptsDelete(client$, request, options) {
61709
- return new APIPromise($do43(client$, request, options));
62629
+ return new APIPromise($do44(client$, request, options));
61710
62630
  }
61711
- async function $do43(client$, request, options) {
62631
+ async function $do44(client$, request, options) {
61712
62632
  const parsed$ = safeParse4(request, (value$) => V2PromptsDeleteRequest$zodSchema.parse(value$), "Input validation failed");
61713
62633
  if (!parsed$.ok) {
61714
62634
  return [parsed$, { status: "invalid" }];
@@ -61783,12 +62703,12 @@ var init_promptsDelete = __esm(() => {
61783
62703
  });
61784
62704
 
61785
62705
  // src/mcp-server/tools/promptsDelete.ts
61786
- var args34, tool$promptsDelete;
62706
+ var args35, tool$promptsDelete;
61787
62707
  var init_promptsDelete2 = __esm(() => {
61788
62708
  init_promptsDelete();
61789
62709
  init_v2promptsdeleteop();
61790
62710
  init_tools();
61791
- args34 = {
62711
+ args35 = {
61792
62712
  request: V2PromptsDeleteRequest$zodSchema
61793
62713
  };
61794
62714
  tool$promptsDelete = {
@@ -61803,7 +62723,7 @@ Archives the prompt and excludes it from normal listings while preserving its hi
61803
62723
  openWorldHint: false,
61804
62724
  readOnlyHint: false
61805
62725
  },
61806
- args: args34,
62726
+ args: args35,
61807
62727
  tool: async (client, args, ctx) => {
61808
62728
  const [result] = await promptsDelete(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
61809
62729
  if (!result.ok) {
@@ -61936,9 +62856,9 @@ var init_v2promptslistop = __esm(() => {
61936
62856
 
61937
62857
  // src/funcs/promptsList.ts
61938
62858
  function promptsList(client$, request, options) {
61939
- return new APIPromise($do44(client$, request, options));
62859
+ return new APIPromise($do45(client$, request, options));
61940
62860
  }
61941
- async function $do44(client$, request, options) {
62861
+ async function $do45(client$, request, options) {
61942
62862
  const parsed$ = safeParse4(request, (value$) => V2PromptsListRequest$zodSchema.optional().parse(value$), "Input validation failed");
61943
62863
  if (!parsed$.ok) {
61944
62864
  return [parsed$, { status: "invalid" }];
@@ -62015,12 +62935,12 @@ var init_promptsList = __esm(() => {
62015
62935
  });
62016
62936
 
62017
62937
  // src/mcp-server/tools/promptsList.ts
62018
- var args35, tool$promptsList;
62938
+ var args36, tool$promptsList;
62019
62939
  var init_promptsList2 = __esm(() => {
62020
62940
  init_promptsList();
62021
62941
  init_v2promptslistop();
62022
62942
  init_tools();
62023
- args35 = {
62943
+ args36 = {
62024
62944
  request: V2PromptsListRequest$zodSchema.optional()
62025
62945
  };
62026
62946
  tool$promptsList = {
@@ -62035,7 +62955,7 @@ Returns active and inactive prompts by default, newest first. Set \`include_arch
62035
62955
  openWorldHint: false,
62036
62956
  readOnlyHint: true
62037
62957
  },
62038
- args: args35,
62958
+ args: args36,
62039
62959
  tool: async (client, args, ctx) => {
62040
62960
  const [result] = await promptsList(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
62041
62961
  if (!result.ok) {
@@ -62066,9 +62986,9 @@ var init_v2promptsretrieveop = __esm(() => {
62066
62986
 
62067
62987
  // src/funcs/promptsRetrieve.ts
62068
62988
  function promptsRetrieve(client$, request, options) {
62069
- return new APIPromise($do45(client$, request, options));
62989
+ return new APIPromise($do46(client$, request, options));
62070
62990
  }
62071
- async function $do45(client$, request, options) {
62991
+ async function $do46(client$, request, options) {
62072
62992
  const parsed$ = safeParse4(request, (value$) => V2PromptsRetrieveRequest$zodSchema.parse(value$), "Input validation failed");
62073
62993
  if (!parsed$.ok) {
62074
62994
  return [parsed$, { status: "invalid" }];
@@ -62143,12 +63063,12 @@ var init_promptsRetrieve = __esm(() => {
62143
63063
  });
62144
63064
 
62145
63065
  // src/mcp-server/tools/promptsRetrieve.ts
62146
- var args36, tool$promptsRetrieve;
63066
+ var args37, tool$promptsRetrieve;
62147
63067
  var init_promptsRetrieve2 = __esm(() => {
62148
63068
  init_promptsRetrieve();
62149
63069
  init_v2promptsretrieveop();
62150
63070
  init_tools();
62151
- args36 = {
63071
+ args37 = {
62152
63072
  request: V2PromptsRetrieveRequest$zodSchema
62153
63073
  };
62154
63074
  tool$promptsRetrieve = {
@@ -62163,7 +63083,7 @@ Returns a prompt with its topic, platforms, tags, lifecycle status, and coding-a
62163
63083
  openWorldHint: false,
62164
63084
  readOnlyHint: true
62165
63085
  },
62166
- args: args36,
63086
+ args: args37,
62167
63087
  tool: async (client, args, ctx) => {
62168
63088
  const [result] = await promptsRetrieve(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
62169
63089
  if (!result.ok) {
@@ -62190,9 +63110,9 @@ var init_createv2promptrunrequest = __esm(() => {
62190
63110
 
62191
63111
  // src/funcs/promptsRun.ts
62192
63112
  function promptsRun(client$, request, options) {
62193
- return new APIPromise($do46(client$, request, options));
63113
+ return new APIPromise($do47(client$, request, options));
62194
63114
  }
62195
- async function $do46(client$, request, options) {
63115
+ async function $do47(client$, request, options) {
62196
63116
  const parsed$ = safeParse4(request, (value$) => CreateV2PromptRunRequest$zodSchema.parse(value$), "Input validation failed");
62197
63117
  if (!parsed$.ok) {
62198
63118
  return [parsed$, { status: "invalid" }];
@@ -62262,12 +63182,12 @@ var init_promptsRun = __esm(() => {
62262
63182
  });
62263
63183
 
62264
63184
  // src/mcp-server/tools/promptsRun.ts
62265
- var args37, tool$promptsRun;
63185
+ var args38, tool$promptsRun;
62266
63186
  var init_promptsRun2 = __esm(() => {
62267
63187
  init_promptsRun();
62268
63188
  init_createv2promptrunrequest();
62269
63189
  init_tools();
62270
- args37 = {
63190
+ args38 = {
62271
63191
  request: CreateV2PromptRunRequest$zodSchema
62272
63192
  };
62273
63193
  tool$promptsRun = {
@@ -62292,7 +63212,7 @@ coding-agent targets. The response returns a run ID to poll with
62292
63212
  openWorldHint: false,
62293
63213
  readOnlyHint: false
62294
63214
  },
62295
- args: args37,
63215
+ args: args38,
62296
63216
  tool: async (client, args, ctx) => {
62297
63217
  const [result] = await promptsRun(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
62298
63218
  if (!result.ok) {
@@ -62329,7 +63249,7 @@ var init_v2promptrunjobresponse = __esm(() => {
62329
63249
  created_at: string2().nullable().optional(),
62330
63250
  dispatch_id: string2().nullable().optional(),
62331
63251
  error: string2().nullable().optional(),
62332
- estimated_cost: number2().nullable().optional().describe("The estimated credit cost for prompt jobs or estimated USD cost for API Performance jobs. Null when no estimate is available."),
63252
+ estimated_cost: number2().nullable().optional().describe("Estimated credits for the run, worked out when it was queued. Credits actually used can differ by agent and model. Null when no estimate is available."),
62333
63253
  eval_count: int().nullable().optional(),
62334
63254
  id: string2().describe("Run ID to poll with `GET /v2/prompts/runs/{run_id}/status`."),
62335
63255
  job_id: string2().describe("Parent job ID. It currently matches `id`."),
@@ -62379,9 +63299,9 @@ var init_v2promptrunscancelop = __esm(() => {
62379
63299
 
62380
63300
  // src/funcs/promptsRunCancel.ts
62381
63301
  function promptsRunCancel(client$, request, options) {
62382
- return new APIPromise($do47(client$, request, options));
63302
+ return new APIPromise($do48(client$, request, options));
62383
63303
  }
62384
- async function $do47(client$, request, options) {
63304
+ async function $do48(client$, request, options) {
62385
63305
  const parsed$ = safeParse4(request, (value$) => V2PromptRunsCancelRequest$zodSchema.parse(value$), "Input validation failed");
62386
63306
  if (!parsed$.ok) {
62387
63307
  return [parsed$, { status: "invalid" }];
@@ -62456,12 +63376,12 @@ var init_promptsRunCancel = __esm(() => {
62456
63376
  });
62457
63377
 
62458
63378
  // src/mcp-server/tools/promptsRunCancel.ts
62459
- var args38, tool$promptsRunCancel;
63379
+ var args39, tool$promptsRunCancel;
62460
63380
  var init_promptsRunCancel2 = __esm(() => {
62461
63381
  init_promptsRunCancel();
62462
63382
  init_v2promptrunscancelop();
62463
63383
  init_tools();
62464
- args38 = {
63384
+ args39 = {
62465
63385
  request: V2PromptRunsCancelRequest$zodSchema
62466
63386
  };
62467
63387
  tool$promptsRunCancel = {
@@ -62476,7 +63396,7 @@ Marks an active prompt run as cancelled and prevents queued prompts from startin
62476
63396
  openWorldHint: false,
62477
63397
  readOnlyHint: false
62478
63398
  },
62479
- args: args38,
63399
+ args: args39,
62480
63400
  tool: async (client, args, ctx) => {
62481
63401
  const [result] = await promptsRunCancel(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
62482
63402
  if (!result.ok) {
@@ -62590,9 +63510,9 @@ var init_v2promptrunslistop = __esm(() => {
62590
63510
 
62591
63511
  // src/funcs/promptsRunsList.ts
62592
63512
  function promptsRunsList(client$, request, options) {
62593
- return new APIPromise($do48(client$, request, options));
63513
+ return new APIPromise($do49(client$, request, options));
62594
63514
  }
62595
- async function $do48(client$, request, options) {
63515
+ async function $do49(client$, request, options) {
62596
63516
  const parsed$ = safeParse4(request, (value$) => V2PromptRunsListRequest$zodSchema.optional().parse(value$), "Input validation failed");
62597
63517
  if (!parsed$.ok) {
62598
63518
  return [parsed$, { status: "invalid" }];
@@ -62670,12 +63590,12 @@ var init_promptsRunsList = __esm(() => {
62670
63590
  });
62671
63591
 
62672
63592
  // src/mcp-server/tools/promptsRunsList.ts
62673
- var args39, tool$promptsRunsList;
63593
+ var args40, tool$promptsRunsList;
62674
63594
  var init_promptsRunsList2 = __esm(() => {
62675
63595
  init_promptsRunsList();
62676
63596
  init_v2promptrunslistop();
62677
63597
  init_tools();
62678
- args39 = {
63598
+ args40 = {
62679
63599
  request: V2PromptRunsListRequest$zodSchema.optional()
62680
63600
  };
62681
63601
  tool$promptsRunsList = {
@@ -62690,7 +63610,7 @@ Returns stored prompt runs with limit-and-offset pagination, without exposing ra
62690
63610
  openWorldHint: false,
62691
63611
  readOnlyHint: true
62692
63612
  },
62693
- args: args39,
63613
+ args: args40,
62694
63614
  tool: async (client, args, ctx) => {
62695
63615
  const [result] = await promptsRunsList(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
62696
63616
  if (!result.ok) {
@@ -62803,9 +63723,9 @@ var init_v2promptrunsretrieveop = __esm(() => {
62803
63723
 
62804
63724
  // src/funcs/promptsRunsRetrieve.ts
62805
63725
  function promptsRunsRetrieve(client$, request, options) {
62806
- return new APIPromise($do49(client$, request, options));
63726
+ return new APIPromise($do50(client$, request, options));
62807
63727
  }
62808
- async function $do49(client$, request, options) {
63728
+ async function $do50(client$, request, options) {
62809
63729
  const parsed$ = safeParse4(request, (value$) => V2PromptRunsRetrieveRequest$zodSchema.parse(value$), "Input validation failed");
62810
63730
  if (!parsed$.ok) {
62811
63731
  return [parsed$, { status: "invalid" }];
@@ -62880,12 +63800,12 @@ var init_promptsRunsRetrieve = __esm(() => {
62880
63800
  });
62881
63801
 
62882
63802
  // src/mcp-server/tools/promptsRunsRetrieve.ts
62883
- var args40, tool$promptsRunsRetrieve;
63803
+ var args41, tool$promptsRunsRetrieve;
62884
63804
  var init_promptsRunsRetrieve2 = __esm(() => {
62885
63805
  init_promptsRunsRetrieve();
62886
63806
  init_v2promptrunsretrieveop();
62887
63807
  init_tools();
62888
- args40 = {
63808
+ args41 = {
62889
63809
  request: V2PromptRunsRetrieveRequest$zodSchema
62890
63810
  };
62891
63811
  tool$promptsRunsRetrieve = {
@@ -62900,7 +63820,7 @@ Returns one stored prompt run, including mentions, citations, and any sanitized
62900
63820
  openWorldHint: false,
62901
63821
  readOnlyHint: true
62902
63822
  },
62903
- args: args40,
63823
+ args: args41,
62904
63824
  tool: async (client, args, ctx) => {
62905
63825
  const [result] = await promptsRunsRetrieve(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
62906
63826
  if (!result.ok) {
@@ -62939,9 +63859,9 @@ var init_v2promptrunstatusretrieveop = __esm(() => {
62939
63859
 
62940
63860
  // src/funcs/promptsRunStatus.ts
62941
63861
  function promptsRunStatus(client$, request, options) {
62942
- return new APIPromise($do50(client$, request, options));
63862
+ return new APIPromise($do51(client$, request, options));
62943
63863
  }
62944
- async function $do50(client$, request, options) {
63864
+ async function $do51(client$, request, options) {
62945
63865
  const parsed$ = safeParse4(request, (value$) => V2PromptRunStatusRetrieveRequest$zodSchema.parse(value$), "Input validation failed");
62946
63866
  if (!parsed$.ok) {
62947
63867
  return [parsed$, { status: "invalid" }];
@@ -63016,12 +63936,12 @@ var init_promptsRunStatus = __esm(() => {
63016
63936
  });
63017
63937
 
63018
63938
  // src/mcp-server/tools/promptsRunStatus.ts
63019
- var args41, tool$promptsRunStatus;
63939
+ var args42, tool$promptsRunStatus;
63020
63940
  var init_promptsRunStatus2 = __esm(() => {
63021
63941
  init_promptsRunStatus();
63022
63942
  init_v2promptrunstatusretrieveop();
63023
63943
  init_tools();
63024
- args41 = {
63944
+ args42 = {
63025
63945
  request: V2PromptRunStatusRetrieveRequest$zodSchema
63026
63946
  };
63027
63947
  tool$promptsRunStatus = {
@@ -63039,7 +63959,7 @@ Individual stored results are available from \`GET /v2/prompts/runs\`.`,
63039
63959
  openWorldHint: false,
63040
63960
  readOnlyHint: true
63041
63961
  },
63042
- args: args41,
63962
+ args: args42,
63043
63963
  tool: async (client, args, ctx) => {
63044
63964
  const [result] = await promptsRunStatus(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
63045
63965
  if (!result.ok) {
@@ -63109,9 +64029,9 @@ var init_v2prompttargetslistop = __esm(() => {
63109
64029
 
63110
64030
  // src/funcs/promptsTargetsList.ts
63111
64031
  function promptsTargetsList(client$, request, options) {
63112
- return new APIPromise($do51(client$, request, options));
64032
+ return new APIPromise($do52(client$, request, options));
63113
64033
  }
63114
- async function $do51(client$, request, options) {
64034
+ async function $do52(client$, request, options) {
63115
64035
  const parsed$ = safeParse4(request, (value$) => V2PromptTargetsListRequest$zodSchema.optional().parse(value$), "Input validation failed");
63116
64036
  if (!parsed$.ok) {
63117
64037
  return [parsed$, { status: "invalid" }];
@@ -63184,12 +64104,12 @@ var init_promptsTargetsList = __esm(() => {
63184
64104
  });
63185
64105
 
63186
64106
  // src/mcp-server/tools/promptsTargetsList.ts
63187
- var args42, tool$promptsTargetsList;
64107
+ var args43, tool$promptsTargetsList;
63188
64108
  var init_promptsTargetsList2 = __esm(() => {
63189
64109
  init_promptsTargetsList();
63190
64110
  init_v2prompttargetslistop();
63191
64111
  init_tools();
63192
- args42 = {
64112
+ args43 = {
63193
64113
  request: V2PromptTargetsListRequest$zodSchema.optional()
63194
64114
  };
63195
64115
  tool$promptsTargetsList = {
@@ -63204,7 +64124,7 @@ Returns the answer engines and coding agents that run the organization's prompts
63204
64124
  openWorldHint: false,
63205
64125
  readOnlyHint: true
63206
64126
  },
63207
- args: args42,
64127
+ args: args43,
63208
64128
  tool: async (client, args, ctx) => {
63209
64129
  const [result] = await promptsTargetsList(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
63210
64130
  if (!result.ok) {
@@ -63257,9 +64177,9 @@ var init_setv2prompttargetsrequest = __esm(() => {
63257
64177
 
63258
64178
  // src/funcs/promptsTargetsSet.ts
63259
64179
  function promptsTargetsSet(client$, request, options) {
63260
- return new APIPromise($do52(client$, request, options));
64180
+ return new APIPromise($do53(client$, request, options));
63261
64181
  }
63262
- async function $do52(client$, request, options) {
64182
+ async function $do53(client$, request, options) {
63263
64183
  const parsed$ = safeParse4(request, (value$) => SetV2PromptTargetsRequest$zodSchema.parse(value$), "Input validation failed");
63264
64184
  if (!parsed$.ok) {
63265
64185
  return [parsed$, { status: "invalid" }];
@@ -63329,12 +64249,12 @@ var init_promptsTargetsSet = __esm(() => {
63329
64249
  });
63330
64250
 
63331
64251
  // src/mcp-server/tools/promptsTargetsSet.ts
63332
- var args43, tool$promptsTargetsSet;
64252
+ var args44, tool$promptsTargetsSet;
63333
64253
  var init_promptsTargetsSet2 = __esm(() => {
63334
64254
  init_promptsTargetsSet();
63335
64255
  init_setv2prompttargetsrequest();
63336
64256
  init_tools();
63337
- args43 = {
64257
+ args44 = {
63338
64258
  request: SetV2PromptTargetsRequest$zodSchema
63339
64259
  };
63340
64260
  tool$promptsTargetsSet = {
@@ -63349,7 +64269,7 @@ Sets which answer engines and coding agents run a topic's prompts on schedule, t
63349
64269
  openWorldHint: false,
63350
64270
  readOnlyHint: false
63351
64271
  },
63352
- args: args43,
64272
+ args: args44,
63353
64273
  tool: async (client, args, ctx) => {
63354
64274
  const [result] = await promptsTargetsSet(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
63355
64275
  if (!result.ok) {
@@ -63374,9 +64294,9 @@ var init_createprompttopicrequest = __esm(() => {
63374
64294
 
63375
64295
  // src/funcs/promptsTopicsCreate.ts
63376
64296
  function promptsTopicsCreate(client$, request, options) {
63377
- return new APIPromise($do53(client$, request, options));
64297
+ return new APIPromise($do54(client$, request, options));
63378
64298
  }
63379
- async function $do53(client$, request, options) {
64299
+ async function $do54(client$, request, options) {
63380
64300
  const parsed$ = safeParse4(request, (value$) => CreatePromptTopicRequest$zodSchema.parse(value$), "Input validation failed");
63381
64301
  if (!parsed$.ok) {
63382
64302
  return [parsed$, { status: "invalid" }];
@@ -63446,12 +64366,12 @@ var init_promptsTopicsCreate = __esm(() => {
63446
64366
  });
63447
64367
 
63448
64368
  // src/mcp-server/tools/promptsTopicsCreate.ts
63449
- var args44, tool$promptsTopicsCreate;
64369
+ var args45, tool$promptsTopicsCreate;
63450
64370
  var init_promptsTopicsCreate2 = __esm(() => {
63451
64371
  init_promptsTopicsCreate();
63452
64372
  init_createprompttopicrequest();
63453
64373
  init_tools();
63454
- args44 = {
64374
+ args45 = {
63455
64375
  request: CreatePromptTopicRequest$zodSchema
63456
64376
  };
63457
64377
  tool$promptsTopicsCreate = {
@@ -63466,7 +64386,7 @@ Creates a prompt topic and returns the saved topic.`,
63466
64386
  openWorldHint: false,
63467
64387
  readOnlyHint: false
63468
64388
  },
63469
- args: args44,
64389
+ args: args45,
63470
64390
  tool: async (client, args, ctx) => {
63471
64391
  const [result] = await promptsTopicsCreate(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
63472
64392
  if (!result.ok) {
@@ -63498,9 +64418,9 @@ var init_v2prompttopicsdeleteop = __esm(() => {
63498
64418
 
63499
64419
  // src/funcs/promptsTopicsDelete.ts
63500
64420
  function promptsTopicsDelete(client$, request, options) {
63501
- return new APIPromise($do54(client$, request, options));
64421
+ return new APIPromise($do55(client$, request, options));
63502
64422
  }
63503
- async function $do54(client$, request, options) {
64423
+ async function $do55(client$, request, options) {
63504
64424
  const parsed$ = safeParse4(request, (value$) => V2PromptTopicsDeleteRequest$zodSchema.parse(value$), "Input validation failed");
63505
64425
  if (!parsed$.ok) {
63506
64426
  return [parsed$, { status: "invalid" }];
@@ -63579,12 +64499,12 @@ var init_promptsTopicsDelete = __esm(() => {
63579
64499
  });
63580
64500
 
63581
64501
  // src/mcp-server/tools/promptsTopicsDelete.ts
63582
- var args45, tool$promptsTopicsDelete;
64502
+ var args46, tool$promptsTopicsDelete;
63583
64503
  var init_promptsTopicsDelete2 = __esm(() => {
63584
64504
  init_promptsTopicsDelete();
63585
64505
  init_v2prompttopicsdeleteop();
63586
64506
  init_tools();
63587
- args45 = {
64507
+ args46 = {
63588
64508
  request: V2PromptTopicsDeleteRequest$zodSchema
63589
64509
  };
63590
64510
  tool$promptsTopicsDelete = {
@@ -63599,7 +64519,7 @@ Archives a prompt topic. Set \`archive_prompts\` to archive remaining prompts; o
63599
64519
  openWorldHint: false,
63600
64520
  readOnlyHint: false
63601
64521
  },
63602
- args: args45,
64522
+ args: args46,
63603
64523
  tool: async (client, args, ctx) => {
63604
64524
  const [result] = await promptsTopicsDelete(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
63605
64525
  if (!result.ok) {
@@ -63615,9 +64535,9 @@ Archives a prompt topic. Set \`archive_prompts\` to archive remaining prompts; o
63615
64535
 
63616
64536
  // src/funcs/promptsTopicsList.ts
63617
64537
  function promptsTopicsList(client$, options) {
63618
- return new APIPromise($do55(client$, options));
64538
+ return new APIPromise($do56(client$, options));
63619
64539
  }
63620
- async function $do55(client$, options) {
64540
+ async function $do56(client$, options) {
63621
64541
  const path$ = pathToFunc("/v2/prompts/topics")();
63622
64542
  const headers$ = new Headers(compactMap({
63623
64543
  Accept: "application/json"
@@ -63733,9 +64653,9 @@ var init_v2prompttopicsupdateop = __esm(() => {
63733
64653
 
63734
64654
  // src/funcs/promptsTopicsUpdate.ts
63735
64655
  function promptsTopicsUpdate(client$, request, options) {
63736
- return new APIPromise($do56(client$, request, options));
64656
+ return new APIPromise($do57(client$, request, options));
63737
64657
  }
63738
- async function $do56(client$, request, options) {
64658
+ async function $do57(client$, request, options) {
63739
64659
  const parsed$ = safeParse4(request, (value$) => V2PromptTopicsUpdateRequest$zodSchema.parse(value$), "Input validation failed");
63740
64660
  if (!parsed$.ok) {
63741
64661
  return [parsed$, { status: "invalid" }];
@@ -63811,12 +64731,12 @@ var init_promptsTopicsUpdate = __esm(() => {
63811
64731
  });
63812
64732
 
63813
64733
  // src/mcp-server/tools/promptsTopicsUpdate.ts
63814
- var args46, tool$promptsTopicsUpdate;
64734
+ var args47, tool$promptsTopicsUpdate;
63815
64735
  var init_promptsTopicsUpdate2 = __esm(() => {
63816
64736
  init_promptsTopicsUpdate();
63817
64737
  init_v2prompttopicsupdateop();
63818
64738
  init_tools();
63819
- args46 = {
64739
+ args47 = {
63820
64740
  request: V2PromptTopicsUpdateRequest$zodSchema
63821
64741
  };
63822
64742
  tool$promptsTopicsUpdate = {
@@ -63831,7 +64751,7 @@ Renames a prompt topic and returns the updated topic.`,
63831
64751
  openWorldHint: false,
63832
64752
  readOnlyHint: false
63833
64753
  },
63834
- args: args46,
64754
+ args: args47,
63835
64755
  tool: async (client, args, ctx) => {
63836
64756
  const [result] = await promptsTopicsUpdate(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
63837
64757
  if (!result.ok) {
@@ -63883,9 +64803,9 @@ var init_v2promptsupdateop = __esm(() => {
63883
64803
 
63884
64804
  // src/funcs/promptsUpdate.ts
63885
64805
  function promptsUpdate(client$, request, options) {
63886
- return new APIPromise($do57(client$, request, options));
64806
+ return new APIPromise($do58(client$, request, options));
63887
64807
  }
63888
- async function $do57(client$, request, options) {
64808
+ async function $do58(client$, request, options) {
63889
64809
  const parsed$ = safeParse4(request, (value$) => V2PromptsUpdateRequest$zodSchema.parse(value$), "Input validation failed");
63890
64810
  if (!parsed$.ok) {
63891
64811
  return [parsed$, { status: "invalid" }];
@@ -63961,12 +64881,12 @@ var init_promptsUpdate = __esm(() => {
63961
64881
  });
63962
64882
 
63963
64883
  // src/mcp-server/tools/promptsUpdate.ts
63964
- var args47, tool$promptsUpdate;
64884
+ var args48, tool$promptsUpdate;
63965
64885
  var init_promptsUpdate2 = __esm(() => {
63966
64886
  init_promptsUpdate();
63967
64887
  init_v2promptsupdateop();
63968
64888
  init_tools();
63969
- args47 = {
64889
+ args48 = {
63970
64890
  request: V2PromptsUpdateRequest$zodSchema
63971
64891
  };
63972
64892
  tool$promptsUpdate = {
@@ -63981,7 +64901,7 @@ Updates a prompt's text, topic, platforms, lifecycle status, or coding-agent run
63981
64901
  openWorldHint: false,
63982
64902
  readOnlyHint: false
63983
64903
  },
63984
- args: args47,
64904
+ args: args48,
63985
64905
  tool: async (client, args, ctx) => {
63986
64906
  const [result] = await promptsUpdate(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
63987
64907
  if (!result.ok) {
@@ -64024,9 +64944,9 @@ var init_createv2repositoryrequest = __esm(() => {
64024
64944
 
64025
64945
  // src/funcs/repositoriesCreate.ts
64026
64946
  function repositoriesCreate(client$, request, options) {
64027
- return new APIPromise($do58(client$, request, options));
64947
+ return new APIPromise($do59(client$, request, options));
64028
64948
  }
64029
- async function $do58(client$, request, options) {
64949
+ async function $do59(client$, request, options) {
64030
64950
  const parsed$ = safeParse4(request, (value$) => CreateV2RepositoryRequest$zodSchema.parse(value$), "Input validation failed");
64031
64951
  if (!parsed$.ok) {
64032
64952
  return [parsed$, { status: "invalid" }];
@@ -64096,12 +65016,12 @@ var init_repositoriesCreate = __esm(() => {
64096
65016
  });
64097
65017
 
64098
65018
  // src/mcp-server/tools/repositoriesCreate.ts
64099
- var args48, tool$repositoriesCreate;
65019
+ var args49, tool$repositoriesCreate;
64100
65020
  var init_repositoriesCreate2 = __esm(() => {
64101
65021
  init_repositoriesCreate();
64102
65022
  init_createv2repositoryrequest();
64103
65023
  init_tools();
64104
- args48 = {
65024
+ args49 = {
64105
65025
  request: CreateV2RepositoryRequest$zodSchema
64106
65026
  };
64107
65027
  tool$repositoriesCreate = {
@@ -64116,7 +65036,7 @@ Adds a reusable Git repository workspace for eval configurations.`,
64116
65036
  openWorldHint: false,
64117
65037
  readOnlyHint: false
64118
65038
  },
64119
- args: args48,
65039
+ args: args49,
64120
65040
  tool: async (client, args, ctx) => {
64121
65041
  const [result] = await repositoriesCreate(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64122
65042
  if (!result.ok) {
@@ -64182,9 +65102,9 @@ var init_v2repositoriesdeleteop = __esm(() => {
64182
65102
 
64183
65103
  // src/funcs/repositoriesDelete.ts
64184
65104
  function repositoriesDelete(client$, request, options) {
64185
- return new APIPromise($do59(client$, request, options));
65105
+ return new APIPromise($do60(client$, request, options));
64186
65106
  }
64187
- async function $do59(client$, request, options) {
65107
+ async function $do60(client$, request, options) {
64188
65108
  const parsed$ = safeParse4(request, (value$) => V2RepositoriesDeleteRequest$zodSchema.parse(value$), "Input validation failed");
64189
65109
  if (!parsed$.ok) {
64190
65110
  return [parsed$, { status: "invalid" }];
@@ -64259,12 +65179,12 @@ var init_repositoriesDelete = __esm(() => {
64259
65179
  });
64260
65180
 
64261
65181
  // src/mcp-server/tools/repositoriesDelete.ts
64262
- var args49, tool$repositoriesDelete;
65182
+ var args50, tool$repositoriesDelete;
64263
65183
  var init_repositoriesDelete2 = __esm(() => {
64264
65184
  init_repositoriesDelete();
64265
65185
  init_v2repositoriesdeleteop();
64266
65186
  init_tools();
64267
- args49 = {
65187
+ args50 = {
64268
65188
  request: V2RepositoriesDeleteRequest$zodSchema
64269
65189
  };
64270
65190
  tool$repositoriesDelete = {
@@ -64279,7 +65199,7 @@ Permanently deletes a repository workspace and returns its last saved state.`,
64279
65199
  openWorldHint: false,
64280
65200
  readOnlyHint: false
64281
65201
  },
64282
- args: args49,
65202
+ args: args50,
64283
65203
  tool: async (client, args, ctx) => {
64284
65204
  const [result] = await repositoriesDelete(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64285
65205
  if (!result.ok) {
@@ -64295,9 +65215,9 @@ Permanently deletes a repository workspace and returns its last saved state.`,
64295
65215
 
64296
65216
  // src/funcs/repositoriesList.ts
64297
65217
  function repositoriesList(client$, options) {
64298
- return new APIPromise($do60(client$, options));
65218
+ return new APIPromise($do61(client$, options));
64299
65219
  }
64300
- async function $do60(client$, options) {
65220
+ async function $do61(client$, options) {
64301
65221
  const path$ = pathToFunc("/v2/repositories")();
64302
65222
  const headers$ = new Headers(compactMap({
64303
65223
  Accept: "application/json"
@@ -64402,9 +65322,9 @@ var init_v2repositoriesretrieveop = __esm(() => {
64402
65322
 
64403
65323
  // src/funcs/repositoriesRetrieve.ts
64404
65324
  function repositoriesRetrieve(client$, request, options) {
64405
- return new APIPromise($do61(client$, request, options));
65325
+ return new APIPromise($do62(client$, request, options));
64406
65326
  }
64407
- async function $do61(client$, request, options) {
65327
+ async function $do62(client$, request, options) {
64408
65328
  const parsed$ = safeParse4(request, (value$) => V2RepositoriesRetrieveRequest$zodSchema.parse(value$), "Input validation failed");
64409
65329
  if (!parsed$.ok) {
64410
65330
  return [parsed$, { status: "invalid" }];
@@ -64479,12 +65399,12 @@ var init_repositoriesRetrieve = __esm(() => {
64479
65399
  });
64480
65400
 
64481
65401
  // src/mcp-server/tools/repositoriesRetrieve.ts
64482
- var args50, tool$repositoriesRetrieve;
65402
+ var args51, tool$repositoriesRetrieve;
64483
65403
  var init_repositoriesRetrieve2 = __esm(() => {
64484
65404
  init_repositoriesRetrieve();
64485
65405
  init_v2repositoriesretrieveop();
64486
65406
  init_tools();
64487
- args50 = {
65407
+ args51 = {
64488
65408
  request: V2RepositoriesRetrieveRequest$zodSchema
64489
65409
  };
64490
65410
  tool$repositoriesRetrieve = {
@@ -64499,7 +65419,7 @@ Returns one reusable repository workspace.`,
64499
65419
  openWorldHint: false,
64500
65420
  readOnlyHint: true
64501
65421
  },
64502
- args: args50,
65422
+ args: args51,
64503
65423
  tool: async (client, args, ctx) => {
64504
65424
  const [result] = await repositoriesRetrieve(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64505
65425
  if (!result.ok) {
@@ -64559,9 +65479,9 @@ var init_v2repositoriesupdateop = __esm(() => {
64559
65479
 
64560
65480
  // src/funcs/repositoriesUpdate.ts
64561
65481
  function repositoriesUpdate(client$, request, options) {
64562
- return new APIPromise($do62(client$, request, options));
65482
+ return new APIPromise($do63(client$, request, options));
64563
65483
  }
64564
- async function $do62(client$, request, options) {
65484
+ async function $do63(client$, request, options) {
64565
65485
  const parsed$ = safeParse4(request, (value$) => V2RepositoriesUpdateRequest$zodSchema.parse(value$), "Input validation failed");
64566
65486
  if (!parsed$.ok) {
64567
65487
  return [parsed$, { status: "invalid" }];
@@ -64637,12 +65557,12 @@ var init_repositoriesUpdate = __esm(() => {
64637
65557
  });
64638
65558
 
64639
65559
  // src/mcp-server/tools/repositoriesUpdate.ts
64640
- var args51, tool$repositoriesUpdate;
65560
+ var args52, tool$repositoriesUpdate;
64641
65561
  var init_repositoriesUpdate2 = __esm(() => {
64642
65562
  init_repositoriesUpdate();
64643
65563
  init_v2repositoriesupdateop();
64644
65564
  init_tools();
64645
- args51 = {
65565
+ args52 = {
64646
65566
  request: V2RepositoriesUpdateRequest$zodSchema
64647
65567
  };
64648
65568
  tool$repositoriesUpdate = {
@@ -64657,7 +65577,7 @@ Updates a repository workspace; omitted fields remain unchanged.`,
64657
65577
  openWorldHint: false,
64658
65578
  readOnlyHint: false
64659
65579
  },
64660
- args: args51,
65580
+ args: args52,
64661
65581
  tool: async (client, args, ctx) => {
64662
65582
  const [result] = await repositoriesUpdate(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64663
65583
  if (!result.ok) {
@@ -64673,9 +65593,9 @@ Updates a repository workspace; omitted fields remain unchanged.`,
64673
65593
 
64674
65594
  // src/funcs/siteAuditsList.ts
64675
65595
  function siteAuditsList(client$, options) {
64676
- return new APIPromise($do63(client$, options));
65596
+ return new APIPromise($do64(client$, options));
64677
65597
  }
64678
- async function $do63(client$, options) {
65598
+ async function $do64(client$, options) {
64679
65599
  const path$ = pathToFunc("/v2/site-audits")();
64680
65600
  const headers$ = new Headers(compactMap({
64681
65601
  Accept: "application/json"
@@ -64816,9 +65736,9 @@ var init_v2siteauditsretrieveop = __esm(() => {
64816
65736
 
64817
65737
  // src/funcs/siteAuditsRetrieve.ts
64818
65738
  function siteAuditsRetrieve(client$, request, options) {
64819
- return new APIPromise($do64(client$, request, options));
65739
+ return new APIPromise($do65(client$, request, options));
64820
65740
  }
64821
- async function $do64(client$, request, options) {
65741
+ async function $do65(client$, request, options) {
64822
65742
  const parsed$ = safeParse4(request, (value$) => V2SiteAuditsRetrieveRequest$zodSchema.parse(value$), "Input validation failed");
64823
65743
  if (!parsed$.ok) {
64824
65744
  return [parsed$, { status: "invalid" }];
@@ -64893,12 +65813,12 @@ var init_siteAuditsRetrieve = __esm(() => {
64893
65813
  });
64894
65814
 
64895
65815
  // src/mcp-server/tools/siteAuditsRetrieve.ts
64896
- var args52, tool$siteAuditsRetrieve;
65816
+ var args53, tool$siteAuditsRetrieve;
64897
65817
  var init_siteAuditsRetrieve2 = __esm(() => {
64898
65818
  init_siteAuditsRetrieve();
64899
65819
  init_v2siteauditsretrieveop();
64900
65820
  init_tools();
64901
- args52 = {
65821
+ args53 = {
64902
65822
  request: V2SiteAuditsRetrieveRequest$zodSchema
64903
65823
  };
64904
65824
  tool$siteAuditsRetrieve = {
@@ -64913,7 +65833,7 @@ Returns one audited page with its score, priority, supporting evidence, and reco
64913
65833
  openWorldHint: false,
64914
65834
  readOnlyHint: true
64915
65835
  },
64916
- args: args52,
65836
+ args: args53,
64917
65837
  tool: async (client, args, ctx) => {
64918
65838
  const [result] = await siteAuditsRetrieve(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64919
65839
  if (!result.ok) {
@@ -64929,9 +65849,9 @@ Returns one audited page with its score, priority, supporting evidence, and reco
64929
65849
 
64930
65850
  // src/funcs/skillsList.ts
64931
65851
  function skillsList(client$, options) {
64932
- return new APIPromise($do65(client$, options));
65852
+ return new APIPromise($do66(client$, options));
64933
65853
  }
64934
- async function $do65(client$, options) {
65854
+ async function $do66(client$, options) {
64935
65855
  const path$ = pathToFunc("/v2/skills")();
64936
65856
  const headers$ = new Headers(compactMap({
64937
65857
  Accept: "application/json"
@@ -65021,9 +65941,9 @@ Returns reusable skills available to workflows and eval configurations.`,
65021
65941
 
65022
65942
  // src/funcs/statusAuthStatusGet.ts
65023
65943
  function statusAuthStatusGet(client$, options) {
65024
- return new APIPromise($do66(client$, options));
65944
+ return new APIPromise($do67(client$, options));
65025
65945
  }
65026
- async function $do66(client$, options) {
65946
+ async function $do67(client$, options) {
65027
65947
  const path$ = pathToFunc("/v2/auth/status")();
65028
65948
  const headers$ = new Headers(compactMap({
65029
65949
  Accept: "application/json"
@@ -65113,9 +66033,9 @@ Validates the API key and returns its organization ID, API key ID, scopes, and a
65113
66033
 
65114
66034
  // src/funcs/statusGet.ts
65115
66035
  function statusGet(client$, options) {
65116
- return new APIPromise($do67(client$, options));
66036
+ return new APIPromise($do68(client$, options));
65117
66037
  }
65118
- async function $do67(client$, options) {
66038
+ async function $do68(client$, options) {
65119
66039
  const path$ = pathToFunc("/v2/status")();
65120
66040
  const headers$ = new Headers(compactMap({
65121
66041
  Accept: "application/json"
@@ -65244,9 +66164,9 @@ var init_createtaskrequest = __esm(() => {
65244
66164
 
65245
66165
  // src/funcs/tasksCreate.ts
65246
66166
  function tasksCreate(client$, request, options) {
65247
- return new APIPromise($do68(client$, request, options));
66167
+ return new APIPromise($do69(client$, request, options));
65248
66168
  }
65249
- async function $do68(client$, request, options) {
66169
+ async function $do69(client$, request, options) {
65250
66170
  const parsed$ = safeParse4(request, (value$) => CreateTaskRequest$zodSchema.parse(value$), "Input validation failed");
65251
66171
  if (!parsed$.ok) {
65252
66172
  return [parsed$, { status: "invalid" }];
@@ -65316,12 +66236,12 @@ var init_tasksCreate = __esm(() => {
65316
66236
  });
65317
66237
 
65318
66238
  // src/mcp-server/tools/tasksCreate.ts
65319
- var args53, tool$tasksCreate;
66239
+ var args54, tool$tasksCreate;
65320
66240
  var init_tasksCreate2 = __esm(() => {
65321
66241
  init_tasksCreate();
65322
66242
  init_createtaskrequest();
65323
66243
  init_tools();
65324
- args53 = {
66244
+ args54 = {
65325
66245
  request: CreateTaskRequest$zodSchema
65326
66246
  };
65327
66247
  tool$tasksCreate = {
@@ -65336,7 +66256,7 @@ Adds a task to today's queue and returns it with its execution prompt. New tasks
65336
66256
  openWorldHint: false,
65337
66257
  readOnlyHint: false
65338
66258
  },
65339
- args: args53,
66259
+ args: args54,
65340
66260
  tool: async (client, args, ctx) => {
65341
66261
  const [result] = await tasksCreate(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
65342
66262
  if (!result.ok) {
@@ -65496,9 +66416,9 @@ var init_v2taskslistop = __esm(() => {
65496
66416
 
65497
66417
  // src/funcs/tasksList.ts
65498
66418
  function tasksList(client$, request, options) {
65499
- return new APIPromise($do69(client$, request, options));
66419
+ return new APIPromise($do70(client$, request, options));
65500
66420
  }
65501
- async function $do69(client$, request, options) {
66421
+ async function $do70(client$, request, options) {
65502
66422
  const parsed$ = safeParse4(request, (value$) => V2TasksListRequest$zodSchema.optional().parse(value$), "Input validation failed");
65503
66423
  if (!parsed$.ok) {
65504
66424
  return [parsed$, { status: "invalid" }];
@@ -65572,12 +66492,12 @@ var init_tasksList = __esm(() => {
65572
66492
  });
65573
66493
 
65574
66494
  // src/mcp-server/tools/tasksList.ts
65575
- var args54, tool$tasksList;
66495
+ var args55, tool$tasksList;
65576
66496
  var init_tasksList2 = __esm(() => {
65577
66497
  init_tasksList();
65578
66498
  init_v2taskslistop();
65579
66499
  init_tools();
65580
- args54 = {
66500
+ args55 = {
65581
66501
  request: V2TasksListRequest$zodSchema.optional()
65582
66502
  };
65583
66503
  tool$tasksList = {
@@ -65592,7 +66512,7 @@ Returns persisted daily tasks with execution instructions. Includes per-status c
65592
66512
  openWorldHint: false,
65593
66513
  readOnlyHint: true
65594
66514
  },
65595
- args: args54,
66515
+ args: args55,
65596
66516
  tool: async (client, args, ctx) => {
65597
66517
  const [result] = await tasksList(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
65598
66518
  if (!result.ok) {
@@ -65623,9 +66543,9 @@ var init_v2tasksretrieveop = __esm(() => {
65623
66543
 
65624
66544
  // src/funcs/tasksRetrieve.ts
65625
66545
  function tasksRetrieve(client$, request, options) {
65626
- return new APIPromise($do70(client$, request, options));
66546
+ return new APIPromise($do71(client$, request, options));
65627
66547
  }
65628
- async function $do70(client$, request, options) {
66548
+ async function $do71(client$, request, options) {
65629
66549
  const parsed$ = safeParse4(request, (value$) => V2TasksRetrieveRequest$zodSchema.parse(value$), "Input validation failed");
65630
66550
  if (!parsed$.ok) {
65631
66551
  return [parsed$, { status: "invalid" }];
@@ -65700,12 +66620,12 @@ var init_tasksRetrieve = __esm(() => {
65700
66620
  });
65701
66621
 
65702
66622
  // src/mcp-server/tools/tasksRetrieve.ts
65703
- var args55, tool$tasksRetrieve;
66623
+ var args56, tool$tasksRetrieve;
65704
66624
  var init_tasksRetrieve2 = __esm(() => {
65705
66625
  init_tasksRetrieve();
65706
66626
  init_v2tasksretrieveop();
65707
66627
  init_tools();
65708
- args55 = {
66628
+ args56 = {
65709
66629
  request: V2TasksRetrieveRequest$zodSchema
65710
66630
  };
65711
66631
  tool$tasksRetrieve = {
@@ -65720,7 +66640,7 @@ Returns one persisted task and its execution prompt.`,
65720
66640
  openWorldHint: false,
65721
66641
  readOnlyHint: true
65722
66642
  },
65723
- args: args55,
66643
+ args: args56,
65724
66644
  tool: async (client, args, ctx) => {
65725
66645
  const [result] = await tasksRetrieve(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
65726
66646
  if (!result.ok) {
@@ -65783,9 +66703,9 @@ var init_v2tasksupdateop = __esm(() => {
65783
66703
 
65784
66704
  // src/funcs/tasksUpdate.ts
65785
66705
  function tasksUpdate(client$, request, options) {
65786
- return new APIPromise($do71(client$, request, options));
66706
+ return new APIPromise($do72(client$, request, options));
65787
66707
  }
65788
- async function $do71(client$, request, options) {
66708
+ async function $do72(client$, request, options) {
65789
66709
  const parsed$ = safeParse4(request, (value$) => V2TasksUpdateRequest$zodSchema.parse(value$), "Input validation failed");
65790
66710
  if (!parsed$.ok) {
65791
66711
  return [parsed$, { status: "invalid" }];
@@ -65861,12 +66781,12 @@ var init_tasksUpdate = __esm(() => {
65861
66781
  });
65862
66782
 
65863
66783
  // src/mcp-server/tools/tasksUpdate.ts
65864
- var args56, tool$tasksUpdate;
66784
+ var args57, tool$tasksUpdate;
65865
66785
  var init_tasksUpdate2 = __esm(() => {
65866
66786
  init_tasksUpdate();
65867
66787
  init_v2tasksupdateop();
65868
66788
  init_tools();
65869
- args56 = {
66789
+ args57 = {
65870
66790
  request: V2TasksUpdateRequest$zodSchema
65871
66791
  };
65872
66792
  tool$tasksUpdate = {
@@ -65881,7 +66801,7 @@ Updates a task's status, priority, assignee, or action type. Only sent fields ar
65881
66801
  openWorldHint: false,
65882
66802
  readOnlyHint: false
65883
66803
  },
65884
- args: args56,
66804
+ args: args57,
65885
66805
  tool: async (client, args, ctx) => {
65886
66806
  const [result] = await tasksUpdate(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
65887
66807
  if (!result.ok) {
@@ -66073,9 +66993,9 @@ var init_v2visibilitycitationslistop = __esm(() => {
66073
66993
 
66074
66994
  // src/funcs/visibilityCitationsList.ts
66075
66995
  function visibilityCitationsList(client$, request, options) {
66076
- return new APIPromise($do72(client$, request, options));
66996
+ return new APIPromise($do73(client$, request, options));
66077
66997
  }
66078
- async function $do72(client$, request, options) {
66998
+ async function $do73(client$, request, options) {
66079
66999
  const parsed$ = safeParse4(request, (value$) => V2VisibilityCitationsListRequest$zodSchema.optional().parse(value$), "Input validation failed");
66080
67000
  if (!parsed$.ok) {
66081
67001
  return [parsed$, { status: "invalid" }];
@@ -66153,12 +67073,12 @@ var init_visibilityCitationsList = __esm(() => {
66153
67073
  });
66154
67074
 
66155
67075
  // src/mcp-server/tools/visibilityCitationsList.ts
66156
- var args57, tool$visibilityCitationsList;
67076
+ var args58, tool$visibilityCitationsList;
66157
67077
  var init_visibilityCitationsList2 = __esm(() => {
66158
67078
  init_visibilityCitationsList();
66159
67079
  init_v2visibilitycitationslistop();
66160
67080
  init_tools();
66161
- args57 = {
67081
+ args58 = {
66162
67082
  request: V2VisibilityCitationsListRequest$zodSchema.optional()
66163
67083
  };
66164
67084
  tool$visibilityCitationsList = {
@@ -66173,7 +67093,7 @@ Returns URL-level citation counts ranked from most to least cited. Results can b
66173
67093
  openWorldHint: false,
66174
67094
  readOnlyHint: true
66175
67095
  },
66176
- args: args57,
67096
+ args: args58,
66177
67097
  tool: async (client, args, ctx) => {
66178
67098
  const [result] = await visibilityCitationsList(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
66179
67099
  if (!result.ok) {
@@ -66298,9 +67218,9 @@ var init_v2visibilitycitationssummaryretrieveop = __esm(() => {
66298
67218
 
66299
67219
  // src/funcs/visibilityCitationsSummaryRetrieve.ts
66300
67220
  function visibilityCitationsSummaryRetrieve(client$, request, options) {
66301
- return new APIPromise($do73(client$, request, options));
67221
+ return new APIPromise($do74(client$, request, options));
66302
67222
  }
66303
- async function $do73(client$, request, options) {
67223
+ async function $do74(client$, request, options) {
66304
67224
  const parsed$ = safeParse4(request, (value$) => V2VisibilityCitationsSummaryRetrieveRequest$zodSchema.optional().parse(value$), "Input validation failed");
66305
67225
  if (!parsed$.ok) {
66306
67226
  return [parsed$, { status: "invalid" }];
@@ -66380,12 +67300,12 @@ var init_visibilityCitationsSummaryRetrieve = __esm(() => {
66380
67300
  });
66381
67301
 
66382
67302
  // src/mcp-server/tools/visibilityCitationsSummaryRetrieve.ts
66383
- var args58, tool$visibilityCitationsSummaryRetrieve;
67303
+ var args59, tool$visibilityCitationsSummaryRetrieve;
66384
67304
  var init_visibilityCitationsSummaryRetrieve2 = __esm(() => {
66385
67305
  init_visibilityCitationsSummaryRetrieve();
66386
67306
  init_v2visibilitycitationssummaryretrieveop();
66387
67307
  init_tools();
66388
- args58 = {
67308
+ args59 = {
66389
67309
  request: V2VisibilityCitationsSummaryRetrieveRequest$zodSchema.optional()
66390
67310
  };
66391
67311
  tool$visibilityCitationsSummaryRetrieve = {
@@ -66400,7 +67320,7 @@ Returns citation totals grouped by URL prefix (domain and first path segment, su
66400
67320
  openWorldHint: false,
66401
67321
  readOnlyHint: true
66402
67322
  },
66403
- args: args58,
67323
+ args: args59,
66404
67324
  tool: async (client, args, ctx) => {
66405
67325
  const [result] = await visibilityCitationsSummaryRetrieve(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
66406
67326
  if (!result.ok) {
@@ -66489,9 +67409,9 @@ var init_v2visibilitycurrentretrieveop = __esm(() => {
66489
67409
 
66490
67410
  // src/funcs/visibilityCurrentRetrieve.ts
66491
67411
  function visibilityCurrentRetrieve(client$, request, options) {
66492
- return new APIPromise($do74(client$, request, options));
67412
+ return new APIPromise($do75(client$, request, options));
66493
67413
  }
66494
- async function $do74(client$, request, options) {
67414
+ async function $do75(client$, request, options) {
66495
67415
  const parsed$ = safeParse4(request, (value$) => V2VisibilityCurrentRetrieveRequest$zodSchema.optional().parse(value$), "Input validation failed");
66496
67416
  if (!parsed$.ok) {
66497
67417
  return [parsed$, { status: "invalid" }];
@@ -66566,12 +67486,12 @@ var init_visibilityCurrentRetrieve = __esm(() => {
66566
67486
  });
66567
67487
 
66568
67488
  // src/mcp-server/tools/visibilityCurrentRetrieve.ts
66569
- var args59, tool$visibilityCurrentRetrieve;
67489
+ var args60, tool$visibilityCurrentRetrieve;
66570
67490
  var init_visibilityCurrentRetrieve2 = __esm(() => {
66571
67491
  init_visibilityCurrentRetrieve();
66572
67492
  init_v2visibilitycurrentretrieveop();
66573
67493
  init_tools();
66574
- args59 = {
67494
+ args60 = {
66575
67495
  request: V2VisibilityCurrentRetrieveRequest$zodSchema.optional()
66576
67496
  };
66577
67497
  tool$visibilityCurrentRetrieve = {
@@ -66586,7 +67506,7 @@ Returns recommendation score, visibility score, ranks, and date-range metadata f
66586
67506
  openWorldHint: false,
66587
67507
  readOnlyHint: true
66588
67508
  },
66589
- args: args59,
67509
+ args: args60,
66590
67510
  tool: async (client, args, ctx) => {
66591
67511
  const [result] = await visibilityCurrentRetrieve(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
66592
67512
  if (!result.ok) {
@@ -66742,9 +67662,9 @@ var init_v2visibilityoverviewretrieveop = __esm(() => {
66742
67662
 
66743
67663
  // src/funcs/visibilityOverviewRetrieve.ts
66744
67664
  function visibilityOverviewRetrieve(client$, request, options) {
66745
- return new APIPromise($do75(client$, request, options));
67665
+ return new APIPromise($do76(client$, request, options));
66746
67666
  }
66747
- async function $do75(client$, request, options) {
67667
+ async function $do76(client$, request, options) {
66748
67668
  const parsed$ = safeParse4(request, (value$) => V2VisibilityOverviewRetrieveRequest$zodSchema.optional().parse(value$), "Input validation failed");
66749
67669
  if (!parsed$.ok) {
66750
67670
  return [parsed$, { status: "invalid" }];
@@ -66819,12 +67739,12 @@ var init_visibilityOverviewRetrieve = __esm(() => {
66819
67739
  });
66820
67740
 
66821
67741
  // src/mcp-server/tools/visibilityOverviewRetrieve.ts
66822
- var args60, tool$visibilityOverviewRetrieve;
67742
+ var args61, tool$visibilityOverviewRetrieve;
66823
67743
  var init_visibilityOverviewRetrieve2 = __esm(() => {
66824
67744
  init_visibilityOverviewRetrieve();
66825
67745
  init_v2visibilityoverviewretrieveop();
66826
67746
  init_tools();
66827
- args60 = {
67747
+ args61 = {
66828
67748
  request: V2VisibilityOverviewRetrieveRequest$zodSchema.optional()
66829
67749
  };
66830
67750
  tool$visibilityOverviewRetrieve = {
@@ -66839,7 +67759,7 @@ Returns aggregate snapshot, daily trends, per-platform breakdowns, and competito
66839
67759
  openWorldHint: false,
66840
67760
  readOnlyHint: true
66841
67761
  },
66842
- args: args60,
67762
+ args: args61,
66843
67763
  tool: async (client, args, ctx) => {
66844
67764
  const [result] = await visibilityOverviewRetrieve(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
66845
67765
  if (!result.ok) {
@@ -66961,9 +67881,9 @@ var init_v2visibilitypromptsretrieveop = __esm(() => {
66961
67881
 
66962
67882
  // src/funcs/visibilityPromptsRetrieve.ts
66963
67883
  function visibilityPromptsRetrieve(client$, request, options) {
66964
- return new APIPromise($do76(client$, request, options));
67884
+ return new APIPromise($do77(client$, request, options));
66965
67885
  }
66966
- async function $do76(client$, request, options) {
67886
+ async function $do77(client$, request, options) {
66967
67887
  const parsed$ = safeParse4(request, (value$) => V2VisibilityPromptsRetrieveRequest$zodSchema.optional().parse(value$), "Input validation failed");
66968
67888
  if (!parsed$.ok) {
66969
67889
  return [parsed$, { status: "invalid" }];
@@ -67038,12 +67958,12 @@ var init_visibilityPromptsRetrieve = __esm(() => {
67038
67958
  });
67039
67959
 
67040
67960
  // src/mcp-server/tools/visibilityPromptsRetrieve.ts
67041
- var args61, tool$visibilityPromptsRetrieve;
67961
+ var args62, tool$visibilityPromptsRetrieve;
67042
67962
  var init_visibilityPromptsRetrieve2 = __esm(() => {
67043
67963
  init_visibilityPromptsRetrieve();
67044
67964
  init_v2visibilitypromptsretrieveop();
67045
67965
  init_tools();
67046
- args61 = {
67966
+ args62 = {
67047
67967
  request: V2VisibilityPromptsRetrieveRequest$zodSchema.optional()
67048
67968
  };
67049
67969
  tool$visibilityPromptsRetrieve = {
@@ -67058,7 +67978,7 @@ Returns per-topic and per-prompt visibility metrics including recommendation sco
67058
67978
  openWorldHint: false,
67059
67979
  readOnlyHint: true
67060
67980
  },
67061
- args: args61,
67981
+ args: args62,
67062
67982
  tool: async (client, args, ctx) => {
67063
67983
  const [result] = await visibilityPromptsRetrieve(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
67064
67984
  if (!result.ok) {
@@ -67082,7 +68002,7 @@ function createMCPServer(deps) {
67082
68002
  sizes: ["any"]
67083
68003
  }],
67084
68004
  name: "LightsageMcp",
67085
- version: "0.4.23"
68005
+ version: "0.4.25"
67086
68006
  });
67087
68007
  const getClient = deps.getSDK || (() => new LightsageMcpCore({
67088
68008
  security: deps.security,
@@ -67167,6 +68087,7 @@ function createMCPServer(deps) {
67167
68087
  tool(tool$agentPreferenceEvalsUpdate);
67168
68088
  tool(tool$agentPreferenceEvalsDelete);
67169
68089
  tool(tool$agentPreferenceEvalsResultsList);
68090
+ tool(tool$pluginEvalsResultsList);
67170
68091
  tool(tool$agentsList);
67171
68092
  tool(tool$repositoriesList);
67172
68093
  tool(tool$repositoriesCreate);
@@ -67228,6 +68149,7 @@ var init_server3 = __esm(() => {
67228
68149
  init_mcpServersList2();
67229
68150
  init_opportunitiesList2();
67230
68151
  init_opportunitiesRetrieve2();
68152
+ init_pluginEvalsResultsList2();
67231
68153
  init_promptsCreate2();
67232
68154
  init_promptsDelete2();
67233
68155
  init_promptsList2();
@@ -67615,6 +68537,10 @@ Permanently deletes an Agent Preference eval and returns its last saved state.`
67615
68537
 
67616
68538
  Returns recorded attempts for an Agent Preference eval, newest first, each with whether your company won, lost, or tied against the competitor.`
67617
68539
  },
68540
+ {
68541
+ name: "plugin-evals-results-list",
68542
+ description: 'List Plugin Eval Results\n\nReturns a day\'s plugin eval results, one per plugin with results that day. Each has a `download_url` for a zip of every run with and without the plugin installed, plus the insights report written from them. The link works without an API key until `expires_at` (15 minutes), so fetch it with any HTTP client, for example `curl -o results.zip "<download_url>"`. Returns 404 when no results exist for the date.'
68543
+ },
67618
68544
  {
67619
68545
  name: "agents-list",
67620
68546
  description: "List Agents\n\nReturns the coding-agent harness-and-model combinations your plan can run, as single agent IDs. Pass them as `agent` to `POST /v2/prompts/runs` to see how coding agents answer your prompts, with mentions and citations, or to `PUT /v2/prompts/targets` to run them on a schedule; to `POST /v2/agent-preference/evals` to see whether agents recommend your company over one competitor; or to `POST /v2/evals` and `POST /v2/eval-runs` to measure how well agents complete tasks with your product."
@@ -68577,7 +69503,7 @@ http_headers = { "lightsage-api-key-auth" = "YOUR_LIGHTSAGE_API_KEY_AUTH" }`;
68577
69503
  <h1>Instructions</h1>
68578
69504
  <p>One-click installation for Claude Desktop users</p>
68579
69505
  <div class="instruction-item">
68580
- <a href="https://github.com/lightsagehq/mcp/releases/download/v0.4.23/mcp-server.mcpb" download="mcp-server.mcpb" class="action-button header-action" style="display: inline-flex; margin-bottom: 16px;">
69506
+ <a href="https://github.com/lightsagehq/mcp/releases/download/v0.4.25/mcp-server.mcpb" download="mcp-server.mcpb" class="action-button header-action" style="display: inline-flex; margin-bottom: 16px;">
68581
69507
  \uD83D\uDCE5 Download MCP Bundle
68582
69508
  </a>
68583
69509
  </div>
@@ -71477,7 +72403,7 @@ var routes = buildRouteMap({
71477
72403
  var app = buildApplication(routes, {
71478
72404
  name: "mcp",
71479
72405
  versionInfo: {
71480
- currentVersion: "0.4.23"
72406
+ currentVersion: "0.4.25"
71481
72407
  }
71482
72408
  });
71483
72409
  run(app, process3.argv.slice(2), buildContext(process3));
@@ -71485,5 +72411,5 @@ export {
71485
72411
  app
71486
72412
  };
71487
72413
 
71488
- //# debugId=0F32808266457F4964756E2164756E21
72414
+ //# debugId=98ECBEB84095AB7964756E2164756E21
71489
72415
  //# sourceMappingURL=mcp-server.js.map