@langwatch/mcp-server 0.7.0 → 0.8.0

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 (225) hide show
  1. package/.release-please-shim +1 -0
  2. package/CHANGELOG.md +66 -0
  3. package/dist/{archive-scenario-WJ2A7ETN.js → archive-scenario-YKGLJ4MZ.js} +4 -4
  4. package/dist/{archive-suite-4JOM4SSL.js → archive-suite-QFNDO3Y3.js} +4 -4
  5. package/dist/{assign-prompt-tag-GL7EAAF3.js → assign-prompt-tag-Y2B4CBBT.js} +3 -3
  6. package/dist/{chunk-E5JYYU3J.js → chunk-B57MZ4WI.js} +89 -83
  7. package/dist/{chunk-CCWCIJJ3.js → chunk-CPUPGDNA.js} +2 -2
  8. package/dist/{chunk-LUMEZEHL.js → chunk-FBRKHHJV.js} +2 -2
  9. package/dist/{chunk-HYMIWO3U.js → chunk-HDJDFKZR.js} +2 -2
  10. package/dist/{chunk-BWWY5KEF.js → chunk-KOO5733S.js} +3 -2
  11. package/dist/{chunk-EUQDVOSU.js → chunk-KZNBCKWG.js} +2 -2
  12. package/dist/{chunk-IE4M5OGE.js → chunk-L6QENXYA.js} +2 -2
  13. package/dist/{chunk-2GT7IFWK.js → chunk-NACSR6B7.js} +2 -2
  14. package/dist/{chunk-WQG2DFHX.js → chunk-OVQF3D5R.js} +2 -2
  15. package/dist/{chunk-ZVS4UKN2.js → chunk-PO7FM7IX.js} +2 -2
  16. package/dist/{chunk-EGH5RPXM.js → chunk-PZUWCWOS.js} +2 -2
  17. package/dist/{chunk-2WPLXEKF.js → chunk-YH2IBTEL.js} +7 -3
  18. package/dist/{chunk-4AUB2BIA.js → chunk-YI3OG4PI.js} +3 -3
  19. package/dist/config.js +1 -1
  20. package/dist/{create-agent-MBOOT3XK.js → create-agent-YRSDH7P7.js} +4 -4
  21. package/dist/{create-annotation-XMV6A7ED.js → create-annotation-FYQNKMVJ.js} +4 -4
  22. package/dist/{create-dashboard-VRKLFVZJ.js → create-dashboard-CORBR4YQ.js} +4 -4
  23. package/dist/{create-dataset-7HQPZCRE.js → create-dataset-ZC63T6BB.js} +4 -4
  24. package/dist/{create-dataset-records-2NIVFYTV.js → create-dataset-records-ILVNVKVR.js} +4 -4
  25. package/dist/{create-evaluator-WYFRFLRC.js → create-evaluator-2AU3PXFB.js} +4 -4
  26. package/dist/create-mcp-server.js +2 -2
  27. package/dist/{create-prompt-IEN7O6JT.js → create-prompt-NKRJ47YY.js} +3 -3
  28. package/dist/{create-prompt-tag-CAEZ45VO.js → create-prompt-tag-S4JX3ULL.js} +3 -3
  29. package/dist/{create-scenario-6YHSMGLP.js → create-scenario-BPRF75KF.js} +4 -4
  30. package/dist/{create-suite-H5XOFDE5.js → create-suite-4YN7D6K2.js} +4 -4
  31. package/dist/{delete-agent-JKTNBWAA.js → delete-agent-Y72R2YQA.js} +4 -4
  32. package/dist/{delete-annotation-ACMDV6QO.js → delete-annotation-UHWDMHSH.js} +4 -4
  33. package/dist/{delete-dashboard-VJSR7CRU.js → delete-dashboard-LPWT36KN.js} +4 -4
  34. package/dist/{delete-dataset-RTTTWP4D.js → delete-dataset-GGPQRHKX.js} +4 -4
  35. package/dist/{delete-dataset-records-KNQTIPQK.js → delete-dataset-records-LTG5LT26.js} +4 -4
  36. package/dist/{delete-evaluator-7FVC5WM4.js → delete-evaluator-F7QLXDHU.js} +4 -4
  37. package/dist/{delete-prompt-tag-ZMZUAGFW.js → delete-prompt-tag-B5UKZL45.js} +3 -3
  38. package/dist/{delete-workflow-EYQ3T4RQ.js → delete-workflow-4DGUDIDE.js} +4 -4
  39. package/dist/{get-agent-E3QSTVKG.js → get-agent-YEVICUX4.js} +4 -4
  40. package/dist/{get-analytics-2OHV763I.js → get-analytics-3W5CMU3F.js} +3 -3
  41. package/dist/{get-dashboard-PC7JDHH6.js → get-dashboard-NCQHN6MW.js} +4 -4
  42. package/dist/{get-dataset-H5IK5FVU.js → get-dataset-KBK6PH36.js} +4 -4
  43. package/dist/{get-evaluator-UWVUPYTM.js → get-evaluator-QDUL5LXR.js} +4 -4
  44. package/dist/{get-prompt-WZUOLLQC.js → get-prompt-XCSSNRKR.js} +3 -3
  45. package/dist/{get-scenario-Q6LCNUYN.js → get-scenario-FNRKOY7E.js} +4 -4
  46. package/dist/{get-simulation-run-Z2XKO256.js → get-simulation-run-WOEKUF7K.js} +4 -4
  47. package/dist/{get-suite-BXK5TN7P.js → get-suite-U5AOD5TC.js} +4 -4
  48. package/dist/{get-trace-4EJAYVBG.js → get-trace-MUWEJM2Z.js} +3 -3
  49. package/dist/{get-workflow-O34QJLHD.js → get-workflow-SOA7MT7L.js} +4 -4
  50. package/dist/{http-server-ISHF7NJX.js → http-server-7DMOCB75.js} +3 -3
  51. package/dist/index.js +423 -241
  52. package/dist/{langwatch-api-annotations-ERBG27RF.js → langwatch-api-annotations-Q57NDUVR.js} +4 -4
  53. package/dist/{langwatch-api-dashboards-G6TR7VVO.js → langwatch-api-dashboards-VBWWXV3Y.js} +4 -4
  54. package/dist/{langwatch-api-monitors-WSXZLS2B.js → langwatch-api-monitors-L3IY7FDT.js} +3 -3
  55. package/dist/{langwatch-api-secrets-RR5DKG2X.js → langwatch-api-secrets-S5HHF3XR.js} +3 -3
  56. package/dist/{langwatch-api-triggers-2RTNSWQY.js → langwatch-api-triggers-ME33QE26.js} +3 -3
  57. package/dist/langwatch-api-workflows-4CJQAYP2.js +15 -0
  58. package/dist/{list-agents-AW3P6FJV.js → list-agents-3HGIBJFM.js} +4 -4
  59. package/dist/{list-annotations-QNCGWPQ3.js → list-annotations-KWXYVEPI.js} +4 -4
  60. package/dist/{list-dashboards-R7RK2IXL.js → list-dashboards-VQ2LH666.js} +4 -4
  61. package/dist/{list-dataset-records-WVCSQP7P.js → list-dataset-records-RNRGROJP.js} +4 -4
  62. package/dist/{list-datasets-KEXRLDEU.js → list-datasets-I4A2LT2S.js} +4 -4
  63. package/dist/{list-evaluators-7R2LB4JH.js → list-evaluators-AKKRJ5MX.js} +4 -4
  64. package/dist/{list-model-providers-OBYJCKBX.js → list-model-providers-DVFEHFHZ.js} +4 -4
  65. package/dist/{list-prompt-tags-6LY3ZPYI.js → list-prompt-tags-PL5OISUA.js} +3 -3
  66. package/dist/{list-prompts-VWEZ4CDE.js → list-prompts-7VTFWE2Z.js} +3 -3
  67. package/dist/{list-scenarios-TXD4W2ZJ.js → list-scenarios-5BZWZ6ZN.js} +4 -4
  68. package/dist/{list-simulation-runs-RHPOLMFI.js → list-simulation-runs-WCZ6RLPE.js} +4 -4
  69. package/dist/{list-suites-FSGBX27Z.js → list-suites-RRQ2JX5Y.js} +4 -4
  70. package/dist/{list-workflows-VRGEZ3EN.js → list-workflows-UQB5FCX5.js} +4 -4
  71. package/dist/{rename-prompt-tag-VOJJLX4M.js → rename-prompt-tag-TURD6KYU.js} +3 -3
  72. package/dist/{run-agent-KTCC7TB7.js → run-agent-BEJ4K4CM.js} +4 -4
  73. package/dist/{run-evaluation-2X3V3Q6L.js → run-evaluation-AJ7WZNQD.js} +3 -3
  74. package/dist/{run-suite-BTMHGI2D.js → run-suite-U7V432G2.js} +4 -4
  75. package/dist/{run-workflow-IGAYGKJL.js → run-workflow-5WX7DK5T.js} +4 -4
  76. package/dist/{search-traces-VYFUIMXH.js → search-traces-ZCHNOMTX.js} +3 -3
  77. package/dist/{set-model-provider-W5IUI326.js → set-model-provider-6CFHMCNE.js} +4 -4
  78. package/dist/{update-agent-4BB7EYLR.js → update-agent-UE6UWLZP.js} +4 -4
  79. package/dist/{update-dataset-CXBKZ4W3.js → update-dataset-4XQZZE4S.js} +4 -4
  80. package/dist/{update-dataset-record-HOHAMHXG.js → update-dataset-record-GNNM5TKM.js} +4 -4
  81. package/dist/{update-evaluator-IVOR6FTR.js → update-evaluator-LHVDXIZD.js} +4 -4
  82. package/dist/{update-prompt-OWQAKE7K.js → update-prompt-3XEHECJ7.js} +3 -3
  83. package/dist/{update-scenario-GDFVILPN.js → update-scenario-DFPREYCD.js} +4 -4
  84. package/dist/{update-suite-BXYUYSPT.js → update-suite-RATU5THO.js} +4 -4
  85. package/package.json +6 -6
  86. package/src/__tests__/all-tools.integration.test.ts +9 -0
  87. package/src/__tests__/datasets.integration.test.ts +17 -0
  88. package/src/__tests__/datasets.unit.test.ts +4 -0
  89. package/src/__tests__/scenario-tools.unit.test.ts +3 -0
  90. package/src/config.ts +2 -0
  91. package/src/langwatch-api.ts +5 -1
  92. package/uv.lock +188 -530
  93. package/Dockerfile +0 -22
  94. package/build.js +0 -12
  95. package/dist/archive-scenario-WJ2A7ETN.js.map +0 -1
  96. package/dist/archive-suite-4JOM4SSL.js.map +0 -1
  97. package/dist/assign-prompt-tag-GL7EAAF3.js.map +0 -1
  98. package/dist/chunk-2GT7IFWK.js.map +0 -1
  99. package/dist/chunk-2WPLXEKF.js.map +0 -1
  100. package/dist/chunk-4AUB2BIA.js.map +0 -1
  101. package/dist/chunk-BWWY5KEF.js.map +0 -1
  102. package/dist/chunk-CCWCIJJ3.js.map +0 -1
  103. package/dist/chunk-E5JYYU3J.js.map +0 -1
  104. package/dist/chunk-EGH5RPXM.js.map +0 -1
  105. package/dist/chunk-EUQDVOSU.js.map +0 -1
  106. package/dist/chunk-HYMIWO3U.js.map +0 -1
  107. package/dist/chunk-IE4M5OGE.js.map +0 -1
  108. package/dist/chunk-LUMEZEHL.js.map +0 -1
  109. package/dist/chunk-NUFPTHKU.js.map +0 -1
  110. package/dist/chunk-WQG2DFHX.js.map +0 -1
  111. package/dist/chunk-WVI5CJ6S.js.map +0 -1
  112. package/dist/chunk-ZVS4UKN2.js.map +0 -1
  113. package/dist/chunk-ZXKLPC2E.js.map +0 -1
  114. package/dist/config.js.map +0 -1
  115. package/dist/create-agent-MBOOT3XK.js.map +0 -1
  116. package/dist/create-annotation-XMV6A7ED.js.map +0 -1
  117. package/dist/create-dashboard-VRKLFVZJ.js.map +0 -1
  118. package/dist/create-dataset-7HQPZCRE.js.map +0 -1
  119. package/dist/create-dataset-records-2NIVFYTV.js.map +0 -1
  120. package/dist/create-evaluator-WYFRFLRC.js.map +0 -1
  121. package/dist/create-mcp-server.js.map +0 -1
  122. package/dist/create-prompt-IEN7O6JT.js.map +0 -1
  123. package/dist/create-prompt-tag-CAEZ45VO.js.map +0 -1
  124. package/dist/create-scenario-6YHSMGLP.js.map +0 -1
  125. package/dist/create-suite-H5XOFDE5.js.map +0 -1
  126. package/dist/delete-agent-JKTNBWAA.js.map +0 -1
  127. package/dist/delete-annotation-ACMDV6QO.js.map +0 -1
  128. package/dist/delete-dashboard-VJSR7CRU.js.map +0 -1
  129. package/dist/delete-dataset-RTTTWP4D.js.map +0 -1
  130. package/dist/delete-dataset-records-KNQTIPQK.js.map +0 -1
  131. package/dist/delete-evaluator-7FVC5WM4.js.map +0 -1
  132. package/dist/delete-prompt-tag-ZMZUAGFW.js.map +0 -1
  133. package/dist/delete-workflow-EYQ3T4RQ.js.map +0 -1
  134. package/dist/discover-evaluator-schema-H23XCLNE.js.map +0 -1
  135. package/dist/discover-scenario-schema-MEEEVND7.js.map +0 -1
  136. package/dist/discover-schema-3T52ORPB.js.map +0 -1
  137. package/dist/get-agent-E3QSTVKG.js.map +0 -1
  138. package/dist/get-analytics-2OHV763I.js.map +0 -1
  139. package/dist/get-dashboard-PC7JDHH6.js.map +0 -1
  140. package/dist/get-dataset-H5IK5FVU.js.map +0 -1
  141. package/dist/get-evaluator-UWVUPYTM.js.map +0 -1
  142. package/dist/get-prompt-WZUOLLQC.js.map +0 -1
  143. package/dist/get-scenario-Q6LCNUYN.js.map +0 -1
  144. package/dist/get-simulation-run-Z2XKO256.js.map +0 -1
  145. package/dist/get-suite-BXK5TN7P.js.map +0 -1
  146. package/dist/get-trace-4EJAYVBG.js.map +0 -1
  147. package/dist/get-workflow-O34QJLHD.js.map +0 -1
  148. package/dist/http-server-ISHF7NJX.js.map +0 -1
  149. package/dist/index.js.map +0 -1
  150. package/dist/langwatch-api-annotations-ERBG27RF.js.map +0 -1
  151. package/dist/langwatch-api-dashboards-G6TR7VVO.js.map +0 -1
  152. package/dist/langwatch-api-monitors-WSXZLS2B.js.map +0 -1
  153. package/dist/langwatch-api-secrets-RR5DKG2X.js.map +0 -1
  154. package/dist/langwatch-api-triggers-2RTNSWQY.js.map +0 -1
  155. package/dist/langwatch-api-workflows-VJRIIDZ7.js +0 -15
  156. package/dist/langwatch-api-workflows-VJRIIDZ7.js.map +0 -1
  157. package/dist/list-agents-AW3P6FJV.js.map +0 -1
  158. package/dist/list-annotations-QNCGWPQ3.js.map +0 -1
  159. package/dist/list-dashboards-R7RK2IXL.js.map +0 -1
  160. package/dist/list-dataset-records-WVCSQP7P.js.map +0 -1
  161. package/dist/list-datasets-KEXRLDEU.js.map +0 -1
  162. package/dist/list-evaluators-7R2LB4JH.js.map +0 -1
  163. package/dist/list-model-providers-OBYJCKBX.js.map +0 -1
  164. package/dist/list-prompt-tags-6LY3ZPYI.js.map +0 -1
  165. package/dist/list-prompts-VWEZ4CDE.js.map +0 -1
  166. package/dist/list-scenarios-TXD4W2ZJ.js.map +0 -1
  167. package/dist/list-simulation-runs-RHPOLMFI.js.map +0 -1
  168. package/dist/list-suites-FSGBX27Z.js.map +0 -1
  169. package/dist/list-workflows-VRGEZ3EN.js.map +0 -1
  170. package/dist/rename-prompt-tag-VOJJLX4M.js.map +0 -1
  171. package/dist/run-agent-KTCC7TB7.js.map +0 -1
  172. package/dist/run-evaluation-2X3V3Q6L.js.map +0 -1
  173. package/dist/run-suite-BTMHGI2D.js.map +0 -1
  174. package/dist/run-workflow-IGAYGKJL.js.map +0 -1
  175. package/dist/search-traces-VYFUIMXH.js.map +0 -1
  176. package/dist/set-model-provider-W5IUI326.js.map +0 -1
  177. package/dist/update-agent-4BB7EYLR.js.map +0 -1
  178. package/dist/update-dataset-CXBKZ4W3.js.map +0 -1
  179. package/dist/update-dataset-record-HOHAMHXG.js.map +0 -1
  180. package/dist/update-evaluator-IVOR6FTR.js.map +0 -1
  181. package/dist/update-prompt-OWQAKE7K.js.map +0 -1
  182. package/dist/update-scenario-GDFVILPN.js.map +0 -1
  183. package/dist/update-suite-BXYUYSPT.js.map +0 -1
  184. package/tests/evaluations.ipynb +0 -649
  185. package/tests/fixtures/azure/azure_openai_stream_bot_expected.py +0 -102
  186. package/tests/fixtures/azure/azure_openai_stream_bot_input.py +0 -78
  187. package/tests/fixtures/dspy/dspy_bot_expected.py +0 -61
  188. package/tests/fixtures/dspy/dspy_bot_input.py +0 -53
  189. package/tests/fixtures/fastapi/fastapi_app_expected.py +0 -68
  190. package/tests/fixtures/fastapi/fastapi_app_input.py +0 -60
  191. package/tests/fixtures/fastapi/prompt_management_fastapi_expected.py +0 -114
  192. package/tests/fixtures/fastapi/prompt_management_fastapi_input.py +0 -88
  193. package/tests/fixtures/haystack/haystack_bot_expected.py +0 -141
  194. package/tests/fixtures/haystack/haystack_bot_input.py +0 -69
  195. package/tests/fixtures/langchain/langchain_bot_expected.py +0 -53
  196. package/tests/fixtures/langchain/langchain_bot_input.py +0 -45
  197. package/tests/fixtures/langchain/langchain_bot_with_memory_expected.py +0 -69
  198. package/tests/fixtures/langchain/langchain_bot_with_memory_input.py +0 -61
  199. package/tests/fixtures/langchain/langchain_rag_bot_expected.py +0 -97
  200. package/tests/fixtures/langchain/langchain_rag_bot_input.py +0 -77
  201. package/tests/fixtures/langchain/langchain_rag_bot_vertex_ai_expected.py +0 -116
  202. package/tests/fixtures/langchain/langchain_rag_bot_vertex_ai_input.py +0 -81
  203. package/tests/fixtures/langchain/langgraph_rag_bot_with_threads_expected.py +0 -331
  204. package/tests/fixtures/langchain/langgraph_rag_bot_with_threads_input.py +0 -106
  205. package/tests/fixtures/litellm/litellm_bot_expected.py +0 -40
  206. package/tests/fixtures/litellm/litellm_bot_input.py +0 -35
  207. package/tests/fixtures/openai/openai_bot_expected.py +0 -43
  208. package/tests/fixtures/openai/openai_bot_function_call_expected.py +0 -91
  209. package/tests/fixtures/openai/openai_bot_function_call_input.py +0 -82
  210. package/tests/fixtures/openai/openai_bot_input.py +0 -36
  211. package/tests/fixtures/openai/openai_bot_rag_expected.py +0 -73
  212. package/tests/fixtures/openai/openai_bot_rag_input.py +0 -51
  213. package/tests/fixtures/opentelemetry/openinference_dspy_bot_expected.py +0 -63
  214. package/tests/fixtures/opentelemetry/openinference_dspy_bot_input.py +0 -58
  215. package/tests/fixtures/opentelemetry/openinference_langchain_bot_expected.py +0 -53
  216. package/tests/fixtures/opentelemetry/openinference_langchain_bot_input.py +0 -52
  217. package/tests/fixtures/opentelemetry/openinference_openai_bot_expected.py +0 -49
  218. package/tests/fixtures/opentelemetry/openinference_openai_bot_input.py +0 -41
  219. package/tests/fixtures/opentelemetry/openllmetry_openai_bot_expected.py +0 -44
  220. package/tests/fixtures/opentelemetry/openllmetry_openai_bot_input.py +0 -40
  221. package/tests/fixtures/strands/strands_bot_expected.py +0 -84
  222. package/tests/fixtures/strands/strands_bot_input.py +0 -52
  223. package/tests/scenario-openai.test.ts +0 -160
  224. package/tsup.config.ts +0 -14
  225. package/vitest.config.js +0 -7
package/dist/index.js CHANGED
@@ -15919,7 +15919,8 @@ function initConfig(args) {
15919
15919
  const state = getGlobalState();
15920
15920
  state.globalConfig = {
15921
15921
  apiKey: args.apiKey || process.env.LANGWATCH_API_KEY,
15922
- endpoint: args.endpoint || process.env.LANGWATCH_ENDPOINT || "https://app.langwatch.ai"
15922
+ endpoint: args.endpoint || process.env.LANGWATCH_ENDPOINT || "https://app.langwatch.ai",
15923
+ projectId: process.env.LANGWATCH_PROJECT_ID
15923
15924
  };
15924
15925
  }
15925
15926
  function getConfig() {
@@ -25821,12 +25822,15 @@ var require_data = __commonJS({
25821
25822
  }
25822
25823
  });
25823
25824
 
25824
- // node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js
25825
+ // node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/utils.js
25825
25826
  var require_utils = __commonJS({
25826
- "node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js"(exports, module) {
25827
+ "node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/utils.js"(exports, module) {
25827
25828
  "use strict";
25828
25829
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
25829
25830
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
25831
+ var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
25832
+ var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
25833
+ var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
25830
25834
  function stringArrayToHexStripped(input) {
25831
25835
  let acc = "";
25832
25836
  let code = 0;
@@ -26019,27 +26023,77 @@ var require_utils = __commonJS({
26019
26023
  }
26020
26024
  return output.join("");
26021
26025
  }
26022
- function normalizeComponentEncoding(component, esc2) {
26023
- const func = esc2 !== true ? escape : unescape;
26024
- if (component.scheme !== void 0) {
26025
- component.scheme = func(component.scheme);
26026
- }
26027
- if (component.userinfo !== void 0) {
26028
- component.userinfo = func(component.userinfo);
26029
- }
26030
- if (component.host !== void 0) {
26031
- component.host = func(component.host);
26026
+ var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
26027
+ var HOST_DELIM_RE = /[@/?#:]/g;
26028
+ var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
26029
+ function reescapeHostDelimiters(host, isIP) {
26030
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
26031
+ re.lastIndex = 0;
26032
+ return host.replace(re, (ch) => HOST_DELIMS[ch]);
26033
+ }
26034
+ function normalizePercentEncoding(input, decodeUnreserved = false) {
26035
+ if (input.indexOf("%") === -1) {
26036
+ return input;
26032
26037
  }
26033
- if (component.path !== void 0) {
26034
- component.path = func(component.path);
26038
+ let output = "";
26039
+ for (let i = 0; i < input.length; i++) {
26040
+ if (input[i] === "%" && i + 2 < input.length) {
26041
+ const hex3 = input.slice(i + 1, i + 3);
26042
+ if (isHexPair(hex3)) {
26043
+ const normalizedHex = hex3.toUpperCase();
26044
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
26045
+ if (decodeUnreserved && isUnreserved(decoded)) {
26046
+ output += decoded;
26047
+ } else {
26048
+ output += "%" + normalizedHex;
26049
+ }
26050
+ i += 2;
26051
+ continue;
26052
+ }
26053
+ }
26054
+ output += input[i];
26035
26055
  }
26036
- if (component.query !== void 0) {
26037
- component.query = func(component.query);
26056
+ return output;
26057
+ }
26058
+ function normalizePathEncoding(input) {
26059
+ let output = "";
26060
+ for (let i = 0; i < input.length; i++) {
26061
+ if (input[i] === "%" && i + 2 < input.length) {
26062
+ const hex3 = input.slice(i + 1, i + 3);
26063
+ if (isHexPair(hex3)) {
26064
+ const normalizedHex = hex3.toUpperCase();
26065
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
26066
+ if (decoded !== "." && isUnreserved(decoded)) {
26067
+ output += decoded;
26068
+ } else {
26069
+ output += "%" + normalizedHex;
26070
+ }
26071
+ i += 2;
26072
+ continue;
26073
+ }
26074
+ }
26075
+ if (isPathCharacter(input[i])) {
26076
+ output += input[i];
26077
+ } else {
26078
+ output += escape(input[i]);
26079
+ }
26038
26080
  }
26039
- if (component.fragment !== void 0) {
26040
- component.fragment = func(component.fragment);
26081
+ return output;
26082
+ }
26083
+ function escapePreservingEscapes(input) {
26084
+ let output = "";
26085
+ for (let i = 0; i < input.length; i++) {
26086
+ if (input[i] === "%" && i + 2 < input.length) {
26087
+ const hex3 = input.slice(i + 1, i + 3);
26088
+ if (isHexPair(hex3)) {
26089
+ output += "%" + hex3.toUpperCase();
26090
+ i += 2;
26091
+ continue;
26092
+ }
26093
+ }
26094
+ output += escape(input[i]);
26041
26095
  }
26042
- return component;
26096
+ return output;
26043
26097
  }
26044
26098
  function recomposeAuthority(component) {
26045
26099
  const uriTokens = [];
@@ -26054,7 +26108,7 @@ var require_utils = __commonJS({
26054
26108
  if (ipV6res.isIPV6 === true) {
26055
26109
  host = `[${ipV6res.escapedHost}]`;
26056
26110
  } else {
26057
- host = component.host;
26111
+ host = reescapeHostDelimiters(host, false);
26058
26112
  }
26059
26113
  }
26060
26114
  uriTokens.push(host);
@@ -26068,7 +26122,10 @@ var require_utils = __commonJS({
26068
26122
  module.exports = {
26069
26123
  nonSimpleDomain,
26070
26124
  recomposeAuthority,
26071
- normalizeComponentEncoding,
26125
+ reescapeHostDelimiters,
26126
+ normalizePercentEncoding,
26127
+ normalizePathEncoding,
26128
+ escapePreservingEscapes,
26072
26129
  removeDotSegments,
26073
26130
  isIPv4,
26074
26131
  isUUID,
@@ -26078,9 +26135,9 @@ var require_utils = __commonJS({
26078
26135
  }
26079
26136
  });
26080
26137
 
26081
- // node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js
26138
+ // node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/schemes.js
26082
26139
  var require_schemes = __commonJS({
26083
- "node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js"(exports, module) {
26140
+ "node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/schemes.js"(exports, module) {
26084
26141
  "use strict";
26085
26142
  var { isUUID } = require_utils();
26086
26143
  var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
@@ -26288,16 +26345,16 @@ var require_schemes = __commonJS({
26288
26345
  }
26289
26346
  });
26290
26347
 
26291
- // node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js
26348
+ // node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/index.js
26292
26349
  var require_fast_uri = __commonJS({
26293
- "node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js"(exports, module) {
26350
+ "node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/index.js"(exports, module) {
26294
26351
  "use strict";
26295
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
26352
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
26296
26353
  var { SCHEMES, getSchemeHandler } = require_schemes();
26297
26354
  function normalize2(uri, options) {
26298
26355
  if (typeof uri === "string") {
26299
26356
  uri = /** @type {T} */
26300
- serialize(parse3(uri, options), options);
26357
+ normalizeString(uri, options);
26301
26358
  } else if (typeof uri === "object") {
26302
26359
  uri = /** @type {T} */
26303
26360
  parse3(serialize(uri, options), options);
@@ -26364,19 +26421,9 @@ var require_fast_uri = __commonJS({
26364
26421
  return target;
26365
26422
  }
26366
26423
  function equal(uriA, uriB, options) {
26367
- if (typeof uriA === "string") {
26368
- uriA = unescape(uriA);
26369
- uriA = serialize(normalizeComponentEncoding(parse3(uriA, options), true), { ...options, skipEscape: true });
26370
- } else if (typeof uriA === "object") {
26371
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
26372
- }
26373
- if (typeof uriB === "string") {
26374
- uriB = unescape(uriB);
26375
- uriB = serialize(normalizeComponentEncoding(parse3(uriB, options), true), { ...options, skipEscape: true });
26376
- } else if (typeof uriB === "object") {
26377
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
26378
- }
26379
- return uriA.toLowerCase() === uriB.toLowerCase();
26424
+ const normalizedA = normalizeComparableURI(uriA, options);
26425
+ const normalizedB = normalizeComparableURI(uriB, options);
26426
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
26380
26427
  }
26381
26428
  function serialize(cmpts, opts) {
26382
26429
  const component = {
@@ -26401,12 +26448,12 @@ var require_fast_uri = __commonJS({
26401
26448
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
26402
26449
  if (component.path !== void 0) {
26403
26450
  if (!options.skipEscape) {
26404
- component.path = escape(component.path);
26451
+ component.path = escapePreservingEscapes(component.path);
26405
26452
  if (component.scheme !== void 0) {
26406
26453
  component.path = component.path.split("%3A").join(":");
26407
26454
  }
26408
26455
  } else {
26409
- component.path = unescape(component.path);
26456
+ component.path = normalizePercentEncoding(component.path);
26410
26457
  }
26411
26458
  }
26412
26459
  if (options.reference !== "suffix" && component.scheme) {
@@ -26441,7 +26488,16 @@ var require_fast_uri = __commonJS({
26441
26488
  return uriTokens.join("");
26442
26489
  }
26443
26490
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
26444
- function parse3(uri, opts) {
26491
+ function getParseError(parsed, matches) {
26492
+ if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
26493
+ return 'URI path must start with "/" when authority is present.';
26494
+ }
26495
+ if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
26496
+ return "URI port is malformed.";
26497
+ }
26498
+ return void 0;
26499
+ }
26500
+ function parseWithStatus(uri, opts) {
26445
26501
  const options = Object.assign({}, opts);
26446
26502
  const parsed = {
26447
26503
  scheme: void 0,
@@ -26452,6 +26508,7 @@ var require_fast_uri = __commonJS({
26452
26508
  query: void 0,
26453
26509
  fragment: void 0
26454
26510
  };
26511
+ let malformedAuthorityOrPort = false;
26455
26512
  let isIP = false;
26456
26513
  if (options.reference === "suffix") {
26457
26514
  if (options.scheme) {
@@ -26472,6 +26529,11 @@ var require_fast_uri = __commonJS({
26472
26529
  if (isNaN(parsed.port)) {
26473
26530
  parsed.port = matches[5];
26474
26531
  }
26532
+ const parseError = getParseError(parsed, matches);
26533
+ if (parseError !== void 0) {
26534
+ parsed.error = parsed.error || parseError;
26535
+ malformedAuthorityOrPort = true;
26536
+ }
26475
26537
  if (parsed.host) {
26476
26538
  const ipv4result = isIPv4(parsed.host);
26477
26539
  if (ipv4result === false) {
@@ -26510,14 +26572,18 @@ var require_fast_uri = __commonJS({
26510
26572
  parsed.scheme = unescape(parsed.scheme);
26511
26573
  }
26512
26574
  if (parsed.host !== void 0) {
26513
- parsed.host = unescape(parsed.host);
26575
+ parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
26514
26576
  }
26515
26577
  }
26516
26578
  if (parsed.path) {
26517
- parsed.path = escape(unescape(parsed.path));
26579
+ parsed.path = normalizePathEncoding(parsed.path);
26518
26580
  }
26519
26581
  if (parsed.fragment) {
26520
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
26582
+ try {
26583
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
26584
+ } catch {
26585
+ parsed.error = parsed.error || "URI malformed";
26586
+ }
26521
26587
  }
26522
26588
  }
26523
26589
  if (schemeHandler && schemeHandler.parse) {
@@ -26526,7 +26592,29 @@ var require_fast_uri = __commonJS({
26526
26592
  } else {
26527
26593
  parsed.error = parsed.error || "URI can not be parsed.";
26528
26594
  }
26529
- return parsed;
26595
+ return { parsed, malformedAuthorityOrPort };
26596
+ }
26597
+ function parse3(uri, opts) {
26598
+ return parseWithStatus(uri, opts).parsed;
26599
+ }
26600
+ function normalizeString(uri, opts) {
26601
+ return normalizeStringWithStatus(uri, opts).normalized;
26602
+ }
26603
+ function normalizeStringWithStatus(uri, opts) {
26604
+ const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
26605
+ return {
26606
+ normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
26607
+ malformedAuthorityOrPort
26608
+ };
26609
+ }
26610
+ function normalizeComparableURI(uri, opts) {
26611
+ if (typeof uri === "string") {
26612
+ const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
26613
+ return malformedAuthorityOrPort ? void 0 : normalized;
26614
+ }
26615
+ if (typeof uri === "object") {
26616
+ return serialize(uri, opts);
26617
+ }
26530
26618
  }
26531
26619
  var fastUri = {
26532
26620
  SCHEMES,
@@ -31021,7 +31109,7 @@ var init_package = __esm({
31021
31109
  "package.json"() {
31022
31110
  package_default = {
31023
31111
  name: "@langwatch/mcp-server",
31024
- version: "0.7.0",
31112
+ version: "0.8.0",
31025
31113
  description: "An MCP server for Langwatch.",
31026
31114
  type: "module",
31027
31115
  main: "./dist/index.js",
@@ -31063,19 +31151,19 @@ var init_package = __esm({
31063
31151
  },
31064
31152
  devDependencies: {
31065
31153
  "@ai-sdk/anthropic": "^3.0.44",
31066
- "@anthropic-ai/claude-code": "^2.1.72",
31067
- "@eslint/js": "^9.4.0",
31154
+ "@anthropic-ai/claude-code": "^2.1.119",
31155
+ "@eslint/js": "^10.0.1",
31068
31156
  "@langwatch/scenario": "^0.4.6",
31069
31157
  "@types/debug": "^4.1.12",
31070
31158
  "@types/eslint__js": "^8.42.3",
31071
31159
  "@types/express": "^5.0.6",
31072
- "@types/node": "^16.0.0",
31160
+ "@types/node": "^25.6.0",
31073
31161
  "@types/yargs": "^17.0.33",
31074
31162
  "@typescript/native-preview": "7.0.0-dev.20250911.1",
31075
31163
  ai: "^6.0.0",
31076
31164
  dotenv: "^17.2.2",
31077
31165
  esbuild: "^0.25.0",
31078
- eslint: "^8.57.0",
31166
+ eslint: "^10.2.1",
31079
31167
  tsup: "^8.1.0",
31080
31168
  tsx: "^4.20.5",
31081
31169
  typescript: "^5.0.0",
@@ -31084,7 +31172,7 @@ var init_package = __esm({
31084
31172
  dependencies: {
31085
31173
  "@modelcontextprotocol/sdk": "^1.26.0",
31086
31174
  "@opentelemetry/context-async-hooks": "^2.1.0",
31087
- "@opentelemetry/sdk-node": "^0.204.0",
31175
+ "@opentelemetry/sdk-node": "^0.217.0",
31088
31176
  chalk: "^5.6.2",
31089
31177
  "date-fns": "^4.1.0",
31090
31178
  express: "^5.2.1",
@@ -31096,6 +31184,12 @@ var init_package = __esm({
31096
31184
  },
31097
31185
  bin: {
31098
31186
  "langwatch-mcp-server": "./dist/index.js"
31187
+ },
31188
+ pnpm: {
31189
+ overrides: {
31190
+ protobufjs: ">=7.5.6 <8.0.0 || >=8.0.2",
31191
+ "fast-uri@<3.1.2": "3.1.2"
31192
+ }
31099
31193
  }
31100
31194
  };
31101
31195
  }
@@ -33093,10 +33187,14 @@ var init_discover_schema = __esm({
33093
33187
 
33094
33188
  // src/langwatch-api.ts
33095
33189
  async function makeRequest(method, path, body) {
33096
- const url2 = getConfig().endpoint + path;
33190
+ const config2 = getConfig();
33191
+ const url2 = config2.endpoint + path;
33097
33192
  const headers = {
33098
33193
  "X-Auth-Token": requireApiKey()
33099
33194
  };
33195
+ if (config2.projectId) {
33196
+ headers["X-Project-Id"] = config2.projectId;
33197
+ }
33100
33198
  if (body !== void 0) {
33101
33199
  headers["Content-Type"] = "application/json";
33102
33200
  }
@@ -57102,9 +57200,9 @@ var require_is_promise = __commonJS({
57102
57200
  }
57103
57201
  });
57104
57202
 
57105
- // node_modules/.pnpm/path-to-regexp@8.3.0/node_modules/path-to-regexp/dist/index.js
57203
+ // node_modules/.pnpm/path-to-regexp@8.4.2/node_modules/path-to-regexp/dist/index.js
57106
57204
  var require_dist2 = __commonJS({
57107
- "node_modules/.pnpm/path-to-regexp@8.3.0/node_modules/path-to-regexp/dist/index.js"(exports) {
57205
+ "node_modules/.pnpm/path-to-regexp@8.4.2/node_modules/path-to-regexp/dist/index.js"(exports) {
57108
57206
  "use strict";
57109
57207
  Object.defineProperty(exports, "__esModule", { value: true });
57110
57208
  exports.PathError = exports.TokenData = void 0;
@@ -57117,19 +57215,7 @@ var require_dist2 = __commonJS({
57117
57215
  var NOOP_VALUE = (value) => value;
57118
57216
  var ID_START = /^[$_\p{ID_Start}]$/u;
57119
57217
  var ID_CONTINUE = /^[$\u200c\u200d\p{ID_Continue}]$/u;
57120
- var SIMPLE_TOKENS = {
57121
- // Groups.
57122
- "{": "{",
57123
- "}": "}",
57124
- // Reserved.
57125
- "(": "(",
57126
- ")": ")",
57127
- "[": "[",
57128
- "]": "]",
57129
- "+": "+",
57130
- "?": "?",
57131
- "!": "!"
57132
- };
57218
+ var ID = /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;
57133
57219
  function escapeText(str) {
57134
57220
  return str.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
57135
57221
  }
@@ -57157,97 +57243,90 @@ var require_dist2 = __commonJS({
57157
57243
  function parse3(str, options = {}) {
57158
57244
  const { encodePath = NOOP_VALUE } = options;
57159
57245
  const chars = [...str];
57160
- const tokens = [];
57161
57246
  let index = 0;
57162
- let pos = 0;
57163
- function name() {
57164
- let value = "";
57165
- if (ID_START.test(chars[index])) {
57166
- do {
57167
- value += chars[index++];
57168
- } while (ID_CONTINUE.test(chars[index]));
57169
- } else if (chars[index] === '"') {
57170
- let quoteStart = index;
57171
- while (index++ < chars.length) {
57172
- if (chars[index] === '"') {
57173
- index++;
57174
- quoteStart = 0;
57175
- break;
57176
- }
57177
- if (chars[index] === "\\")
57178
- index++;
57179
- value += chars[index];
57180
- }
57181
- if (quoteStart) {
57182
- throw new PathError(`Unterminated quote at index ${quoteStart}`, str);
57183
- }
57184
- }
57185
- if (!value) {
57186
- throw new PathError(`Missing parameter name at index ${index}`, str);
57187
- }
57188
- return value;
57189
- }
57190
- while (index < chars.length) {
57191
- const value = chars[index];
57192
- const type = SIMPLE_TOKENS[value];
57193
- if (type) {
57194
- tokens.push({ type, index: index++, value });
57195
- } else if (value === "\\") {
57196
- tokens.push({ type: "escape", index: index++, value: chars[index++] });
57197
- } else if (value === ":") {
57198
- tokens.push({ type: "param", index: index++, value: name() });
57199
- } else if (value === "*") {
57200
- tokens.push({ type: "wildcard", index: index++, value: name() });
57201
- } else {
57202
- tokens.push({ type: "char", index: index++, value });
57203
- }
57204
- }
57205
- tokens.push({ type: "end", index, value: "" });
57206
- function consumeUntil(endType) {
57247
+ function consumeUntil(end) {
57207
57248
  const output = [];
57208
- while (true) {
57209
- const token = tokens[pos++];
57210
- if (token.type === endType)
57211
- break;
57212
- if (token.type === "char" || token.type === "escape") {
57213
- let path = token.value;
57214
- let cur = tokens[pos];
57215
- while (cur.type === "char" || cur.type === "escape") {
57216
- path += cur.value;
57217
- cur = tokens[++pos];
57249
+ let path = "";
57250
+ function writePath() {
57251
+ if (!path)
57252
+ return;
57253
+ output.push({
57254
+ type: "text",
57255
+ value: encodePath(path)
57256
+ });
57257
+ path = "";
57258
+ }
57259
+ while (index < chars.length) {
57260
+ const value = chars[index++];
57261
+ if (value === end) {
57262
+ writePath();
57263
+ return output;
57264
+ }
57265
+ if (value === "\\") {
57266
+ if (index === chars.length) {
57267
+ throw new PathError(`Unexpected end after \\ at index ${index}`, str);
57218
57268
  }
57219
- output.push({
57220
- type: "text",
57221
- value: encodePath(path)
57222
- });
57269
+ path += chars[index++];
57223
57270
  continue;
57224
57271
  }
57225
- if (token.type === "param" || token.type === "wildcard") {
57226
- output.push({
57227
- type: token.type,
57228
- name: token.value
57229
- });
57272
+ if (value === ":" || value === "*") {
57273
+ const type = value === ":" ? "param" : "wildcard";
57274
+ let name = "";
57275
+ if (ID_START.test(chars[index])) {
57276
+ do {
57277
+ name += chars[index++];
57278
+ } while (ID_CONTINUE.test(chars[index]));
57279
+ } else if (chars[index] === '"') {
57280
+ let quoteStart = index;
57281
+ while (index < chars.length) {
57282
+ if (chars[++index] === '"') {
57283
+ index++;
57284
+ quoteStart = 0;
57285
+ break;
57286
+ }
57287
+ if (chars[index] === "\\")
57288
+ index++;
57289
+ name += chars[index];
57290
+ }
57291
+ if (quoteStart) {
57292
+ throw new PathError(`Unterminated quote at index ${quoteStart}`, str);
57293
+ }
57294
+ }
57295
+ if (!name) {
57296
+ throw new PathError(`Missing parameter name at index ${index}`, str);
57297
+ }
57298
+ writePath();
57299
+ output.push({ type, name });
57230
57300
  continue;
57231
57301
  }
57232
- if (token.type === "{") {
57302
+ if (value === "{") {
57303
+ writePath();
57233
57304
  output.push({
57234
57305
  type: "group",
57235
57306
  tokens: consumeUntil("}")
57236
57307
  });
57237
57308
  continue;
57238
57309
  }
57239
- throw new PathError(`Unexpected ${token.type} at index ${token.index}, expected ${endType}`, str);
57310
+ if (value === "}" || value === "(" || value === ")" || value === "[" || value === "]" || value === "+" || value === "?" || value === "!") {
57311
+ throw new PathError(`Unexpected ${value} at index ${index - 1}`, str);
57312
+ }
57313
+ path += value;
57240
57314
  }
57315
+ if (end) {
57316
+ throw new PathError(`Unexpected end at index ${index}, expected ${end}`, str);
57317
+ }
57318
+ writePath();
57241
57319
  return output;
57242
57320
  }
57243
- return new TokenData(consumeUntil("end"), str);
57321
+ return new TokenData(consumeUntil(""), str);
57244
57322
  }
57245
57323
  function compile(path, options = {}) {
57246
57324
  const { encode: encode3 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
57247
57325
  const data = typeof path === "object" ? path : parse3(path, options);
57248
57326
  const fn = tokensToFunction(data.tokens, delimiter, encode3);
57249
57327
  return function path2(params = {}) {
57250
- const [path3, ...missing] = fn(params);
57328
+ const missing = [];
57329
+ const path3 = fn(params, missing);
57251
57330
  if (missing.length) {
57252
57331
  throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
57253
57332
  }
@@ -57256,55 +57335,61 @@ var require_dist2 = __commonJS({
57256
57335
  }
57257
57336
  function tokensToFunction(tokens, delimiter, encode3) {
57258
57337
  const encoders = tokens.map((token) => tokenToFunction(token, delimiter, encode3));
57259
- return (data) => {
57260
- const result = [""];
57338
+ return (data, missing) => {
57339
+ let result = "";
57261
57340
  for (const encoder of encoders) {
57262
- const [value, ...extras] = encoder(data);
57263
- result[0] += value;
57264
- result.push(...extras);
57341
+ result += encoder(data, missing);
57265
57342
  }
57266
57343
  return result;
57267
57344
  };
57268
57345
  }
57269
57346
  function tokenToFunction(token, delimiter, encode3) {
57270
57347
  if (token.type === "text")
57271
- return () => [token.value];
57348
+ return () => token.value;
57272
57349
  if (token.type === "group") {
57273
57350
  const fn = tokensToFunction(token.tokens, delimiter, encode3);
57274
- return (data) => {
57275
- const [value, ...missing] = fn(data);
57276
- if (!missing.length)
57277
- return [value];
57278
- return [""];
57351
+ return (data, missing) => {
57352
+ const len = missing.length;
57353
+ const value = fn(data, missing);
57354
+ if (missing.length === len)
57355
+ return value;
57356
+ missing.length = len;
57357
+ return "";
57279
57358
  };
57280
57359
  }
57281
57360
  const encodeValue = encode3 || NOOP_VALUE;
57282
57361
  if (token.type === "wildcard" && encode3 !== false) {
57283
- return (data) => {
57362
+ return (data, missing) => {
57284
57363
  const value = data[token.name];
57285
- if (value == null)
57286
- return ["", token.name];
57364
+ if (value == null) {
57365
+ missing.push(token.name);
57366
+ return "";
57367
+ }
57287
57368
  if (!Array.isArray(value) || value.length === 0) {
57288
57369
  throw new TypeError(`Expected "${token.name}" to be a non-empty array`);
57289
57370
  }
57290
- return [
57291
- value.map((value2, index) => {
57292
- if (typeof value2 !== "string") {
57293
- throw new TypeError(`Expected "${token.name}/${index}" to be a string`);
57294
- }
57295
- return encodeValue(value2);
57296
- }).join(delimiter)
57297
- ];
57371
+ let result = "";
57372
+ for (let i = 0; i < value.length; i++) {
57373
+ if (typeof value[i] !== "string") {
57374
+ throw new TypeError(`Expected "${token.name}/${i}" to be a string`);
57375
+ }
57376
+ if (i > 0)
57377
+ result += delimiter;
57378
+ result += encodeValue(value[i]);
57379
+ }
57380
+ return result;
57298
57381
  };
57299
57382
  }
57300
- return (data) => {
57383
+ return (data, missing) => {
57301
57384
  const value = data[token.name];
57302
- if (value == null)
57303
- return ["", token.name];
57385
+ if (value == null) {
57386
+ missing.push(token.name);
57387
+ return "";
57388
+ }
57304
57389
  if (typeof value !== "string") {
57305
57390
  throw new TypeError(`Expected "${token.name}" to be a string`);
57306
57391
  }
57307
- return [encodeValue(value)];
57392
+ return encodeValue(value);
57308
57393
  };
57309
57394
  }
57310
57395
  function match(path, options = {}) {
@@ -57336,106 +57421,134 @@ var require_dist2 = __commonJS({
57336
57421
  function pathToRegexp(path, options = {}) {
57337
57422
  const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
57338
57423
  const keys = [];
57339
- const flags = sensitive ? "" : "i";
57340
- const sources = [];
57341
- for (const input of pathsToArray(path, [])) {
57342
- const data = typeof input === "object" ? input : parse3(input, options);
57343
- for (const tokens of flatten(data.tokens, 0, [])) {
57344
- sources.push(toRegExpSource(tokens, delimiter, keys, data.originalPath));
57424
+ let source = "";
57425
+ let combinations = 0;
57426
+ function process4(path2) {
57427
+ if (Array.isArray(path2)) {
57428
+ for (const p of path2)
57429
+ process4(p);
57430
+ return;
57345
57431
  }
57432
+ const data = typeof path2 === "object" ? path2 : parse3(path2, options);
57433
+ flatten(data.tokens, 0, [], (tokens) => {
57434
+ if (combinations >= 256) {
57435
+ throw new PathError("Too many path combinations", data.originalPath);
57436
+ }
57437
+ if (combinations > 0)
57438
+ source += "|";
57439
+ source += toRegExpSource(tokens, delimiter, keys, data.originalPath);
57440
+ combinations++;
57441
+ });
57346
57442
  }
57347
- let pattern = `^(?:${sources.join("|")})`;
57443
+ process4(path);
57444
+ let pattern = `^(?:${source})`;
57348
57445
  if (trailing)
57349
- pattern += `(?:${escape2(delimiter)}$)?`;
57350
- pattern += end ? "$" : `(?=${escape2(delimiter)}|$)`;
57351
- const regexp = new RegExp(pattern, flags);
57352
- return { regexp, keys };
57353
- }
57354
- function pathsToArray(paths, init) {
57355
- if (Array.isArray(paths)) {
57356
- for (const p of paths)
57357
- pathsToArray(p, init);
57358
- } else {
57359
- init.push(paths);
57360
- }
57361
- return init;
57446
+ pattern += "(?:" + escape2(delimiter) + "$)?";
57447
+ pattern += end ? "$" : "(?=" + escape2(delimiter) + "|$)";
57448
+ return { regexp: new RegExp(pattern, sensitive ? "" : "i"), keys };
57362
57449
  }
57363
- function* flatten(tokens, index, init) {
57364
- if (index === tokens.length) {
57365
- return yield init;
57366
- }
57367
- const token = tokens[index];
57368
- if (token.type === "group") {
57369
- for (const seq of flatten(token.tokens, 0, init.slice())) {
57370
- yield* flatten(tokens, index + 1, seq);
57450
+ function flatten(tokens, index, result, callback) {
57451
+ while (index < tokens.length) {
57452
+ const token = tokens[index++];
57453
+ if (token.type === "group") {
57454
+ const len = result.length;
57455
+ flatten(token.tokens, 0, result, (seq) => flatten(tokens, index, seq, callback));
57456
+ result.length = len;
57457
+ continue;
57371
57458
  }
57372
- } else {
57373
- init.push(token);
57459
+ result.push(token);
57374
57460
  }
57375
- yield* flatten(tokens, index + 1, init);
57461
+ callback(result);
57376
57462
  }
57377
57463
  function toRegExpSource(tokens, delimiter, keys, originalPath) {
57378
57464
  let result = "";
57379
57465
  let backtrack = "";
57380
- let isSafeSegmentParam = true;
57381
- for (const token of tokens) {
57466
+ let wildcardBacktrack = "";
57467
+ let prevCaptureType = 0;
57468
+ let hasSegmentCapture = 0;
57469
+ let index = 0;
57470
+ function hasInSegment(index2, type) {
57471
+ while (index2 < tokens.length) {
57472
+ const token = tokens[index2++];
57473
+ if (token.type === type)
57474
+ return true;
57475
+ if (token.type === "text") {
57476
+ if (token.value.includes(delimiter))
57477
+ break;
57478
+ }
57479
+ }
57480
+ return false;
57481
+ }
57482
+ function peekText(index2) {
57483
+ let result2 = "";
57484
+ while (index2 < tokens.length) {
57485
+ const token = tokens[index2++];
57486
+ if (token.type !== "text")
57487
+ break;
57488
+ result2 += token.value;
57489
+ }
57490
+ return result2;
57491
+ }
57492
+ while (index < tokens.length) {
57493
+ const token = tokens[index++];
57382
57494
  if (token.type === "text") {
57383
57495
  result += escape2(token.value);
57384
57496
  backtrack += token.value;
57385
- isSafeSegmentParam || (isSafeSegmentParam = token.value.includes(delimiter));
57497
+ if (prevCaptureType === 2)
57498
+ wildcardBacktrack += token.value;
57499
+ if (token.value.includes(delimiter))
57500
+ hasSegmentCapture = 0;
57386
57501
  continue;
57387
57502
  }
57388
57503
  if (token.type === "param" || token.type === "wildcard") {
57389
- if (!isSafeSegmentParam && !backtrack) {
57504
+ if (prevCaptureType && !backtrack) {
57390
57505
  throw new PathError(`Missing text before "${token.name}" ${token.type}`, originalPath);
57391
57506
  }
57392
57507
  if (token.type === "param") {
57393
- result += `(${negate(delimiter, isSafeSegmentParam ? "" : backtrack)}+)`;
57508
+ result += hasSegmentCapture & 2 ? `(${negate(delimiter, backtrack)}+)` : hasInSegment(index, "wildcard") ? `(${negate(delimiter, peekText(index))}+)` : hasSegmentCapture & 1 ? `(${negate(delimiter, backtrack)}+|${escape2(backtrack)})` : `(${negate(delimiter, "")}+)`;
57509
+ hasSegmentCapture |= prevCaptureType = 1;
57394
57510
  } else {
57395
- result += `([\\s\\S]+)`;
57511
+ result += hasSegmentCapture & 2 ? `(${negate(backtrack, "")}+)` : wildcardBacktrack ? `(${negate(wildcardBacktrack, "")}+|${negate(delimiter, "")}+)` : `([^]+)`;
57512
+ wildcardBacktrack = "";
57513
+ hasSegmentCapture |= prevCaptureType = 2;
57396
57514
  }
57397
57515
  keys.push(token);
57398
57516
  backtrack = "";
57399
- isSafeSegmentParam = false;
57400
57517
  continue;
57401
57518
  }
57519
+ throw new TypeError(`Unknown token type: ${token.type}`);
57402
57520
  }
57403
57521
  return result;
57404
57522
  }
57405
- function negate(delimiter, backtrack) {
57406
- if (backtrack.length < 2) {
57407
- if (delimiter.length < 2)
57408
- return `[^${escape2(delimiter + backtrack)}]`;
57409
- return `(?:(?!${escape2(delimiter)})[^${escape2(backtrack)}])`;
57410
- }
57411
- if (delimiter.length < 2) {
57412
- return `(?:(?!${escape2(backtrack)})[^${escape2(delimiter)}])`;
57413
- }
57414
- return `(?:(?!${escape2(backtrack)}|${escape2(delimiter)})[\\s\\S])`;
57415
- }
57416
- function stringifyTokens(tokens) {
57523
+ function negate(a, b) {
57524
+ if (b.length > a.length)
57525
+ return negate(b, a);
57526
+ if (a === b)
57527
+ b = "";
57528
+ if (b.length > 1)
57529
+ return `(?:(?!${escape2(a)}|${escape2(b)})[^])`;
57530
+ if (a.length > 1)
57531
+ return `(?:(?!${escape2(a)})[^${escape2(b)}])`;
57532
+ return `[^${escape2(a + b)}]`;
57533
+ }
57534
+ function stringifyTokens(tokens, index) {
57417
57535
  let value = "";
57418
- let i = 0;
57419
- function name(value2) {
57420
- const isSafe = isNameSafe(value2) && isNextNameSafe(tokens[i]);
57421
- return isSafe ? value2 : JSON.stringify(value2);
57422
- }
57423
- while (i < tokens.length) {
57424
- const token = tokens[i++];
57536
+ while (index < tokens.length) {
57537
+ const token = tokens[index++];
57425
57538
  if (token.type === "text") {
57426
57539
  value += escapeText(token.value);
57427
57540
  continue;
57428
57541
  }
57429
57542
  if (token.type === "group") {
57430
- value += `{${stringifyTokens(token.tokens)}}`;
57543
+ value += "{" + stringifyTokens(token.tokens, 0) + "}";
57431
57544
  continue;
57432
57545
  }
57433
57546
  if (token.type === "param") {
57434
- value += `:${name(token.name)}`;
57547
+ value += ":" + stringifyName(token.name, tokens[index]);
57435
57548
  continue;
57436
57549
  }
57437
57550
  if (token.type === "wildcard") {
57438
- value += `*${name(token.name)}`;
57551
+ value += "*" + stringifyName(token.name, tokens[index]);
57439
57552
  continue;
57440
57553
  }
57441
57554
  throw new TypeError(`Unknown token type: ${token.type}`);
@@ -57443,16 +57556,15 @@ var require_dist2 = __commonJS({
57443
57556
  return value;
57444
57557
  }
57445
57558
  function stringify(data) {
57446
- return stringifyTokens(data.tokens);
57447
- }
57448
- function isNameSafe(name) {
57449
- const [first, ...rest] = name;
57450
- return ID_START.test(first) && rest.every((char) => ID_CONTINUE.test(char));
57559
+ return stringifyTokens(data.tokens, 0);
57451
57560
  }
57452
- function isNextNameSafe(token) {
57453
- if (token && token.type === "text")
57454
- return !ID_CONTINUE.test(token.value[0]);
57455
- return true;
57561
+ function stringifyName(name, next) {
57562
+ if (!ID.test(name))
57563
+ return JSON.stringify(name);
57564
+ if ((next === null || next === void 0 ? void 0 : next.type) === "text" && ID_CONTINUE.test(next.value[0])) {
57565
+ return JSON.stringify(name);
57566
+ }
57567
+ return name;
57456
57568
  }
57457
57569
  }
57458
57570
  });
@@ -60806,8 +60918,8 @@ var require_express2 = __commonJS({
60806
60918
  }
60807
60919
  });
60808
60920
 
60809
- // node_modules/.pnpm/@hono+node-server@1.19.11_hono@4.12.5/node_modules/@hono/node-server/dist/index.mjs
60810
- import { Http2ServerRequest as Http2ServerRequest2 } from "http2";
60921
+ // node_modules/.pnpm/@hono+node-server@1.19.14_hono@4.12.14/node_modules/@hono/node-server/dist/index.mjs
60922
+ import { Http2ServerRequest as Http2ServerRequest2, constants as h2constants } from "http2";
60811
60923
  import { Http2ServerRequest } from "http2";
60812
60924
  import { Readable } from "stream";
60813
60925
  import crypto2 from "crypto";
@@ -60856,9 +60968,9 @@ function writeFromReadableStream(stream, writable) {
60856
60968
  }
60857
60969
  return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
60858
60970
  }
60859
- var RequestError, toRequestError, GlobalRequest, Request, newHeadersFromIncoming, wrapBodyStream, newRequestFromIncoming, getRequestCache, requestCache, incomingKey, urlKey, headersKey, abortControllerKey, getAbortController, requestPrototype, newRequest, responseCache, getResponseCache, cacheKey, GlobalResponse, Response2, buildOutgoingHttpHeaders, X_ALREADY_SENT, outgoingEnded, handleRequestError, handleFetchError, handleResponseError, flushHeaders, responseViaCache, isPromise2, responseViaResponseObject, getRequestListener;
60971
+ var RequestError, toRequestError, GlobalRequest, Request, newHeadersFromIncoming, wrapBodyStream, newRequestFromIncoming, getRequestCache, requestCache, incomingKey, urlKey, headersKey, abortControllerKey, getAbortController, requestPrototype, newRequest, responseCache, getResponseCache, cacheKey, GlobalResponse, Response2, buildOutgoingHttpHeaders, X_ALREADY_SENT, outgoingEnded, incomingDraining, DRAIN_TIMEOUT_MS, MAX_DRAIN_BYTES, drainIncoming, handleRequestError, handleFetchError, handleResponseError, flushHeaders, responseViaCache, isPromise2, responseViaResponseObject, getRequestListener;
60860
60972
  var init_dist = __esm({
60861
- "node_modules/.pnpm/@hono+node-server@1.19.11_hono@4.12.5/node_modules/@hono/node-server/dist/index.mjs"() {
60973
+ "node_modules/.pnpm/@hono+node-server@1.19.14_hono@4.12.14/node_modules/@hono/node-server/dist/index.mjs"() {
60862
60974
  RequestError = class extends Error {
60863
60975
  constructor(message, options) {
60864
60976
  super(message, options);
@@ -61003,6 +61115,17 @@ var init_dist = __esm({
61003
61115
  }
61004
61116
  });
61005
61117
  });
61118
+ Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), {
61119
+ value: function(depth, options, inspectFn) {
61120
+ const props = {
61121
+ method: this.method,
61122
+ url: this.url,
61123
+ headers: this.headers,
61124
+ nativeRequest: this[requestCache]
61125
+ };
61126
+ return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`;
61127
+ }
61128
+ });
61006
61129
  Object.setPrototypeOf(requestPrototype, Request.prototype);
61007
61130
  newRequest = (incoming, defaultHostname) => {
61008
61131
  const req = Object.create(requestPrototype);
@@ -61107,6 +61230,17 @@ var init_dist = __esm({
61107
61230
  }
61108
61231
  });
61109
61232
  });
61233
+ Object.defineProperty(Response2.prototype, Symbol.for("nodejs.util.inspect.custom"), {
61234
+ value: function(depth, options, inspectFn) {
61235
+ const props = {
61236
+ status: this.status,
61237
+ headers: this.headers,
61238
+ ok: this.ok,
61239
+ nativeResponse: this[responseCache]
61240
+ };
61241
+ return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`;
61242
+ }
61243
+ });
61110
61244
  Object.setPrototypeOf(Response2, GlobalResponse);
61111
61245
  Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
61112
61246
  buildOutgoingHttpHeaders = (headers) => {
@@ -61133,6 +61267,50 @@ var init_dist = __esm({
61133
61267
  global.crypto = crypto2;
61134
61268
  }
61135
61269
  outgoingEnded = Symbol("outgoingEnded");
61270
+ incomingDraining = Symbol("incomingDraining");
61271
+ DRAIN_TIMEOUT_MS = 500;
61272
+ MAX_DRAIN_BYTES = 64 * 1024 * 1024;
61273
+ drainIncoming = (incoming) => {
61274
+ const incomingWithDrainState = incoming;
61275
+ if (incoming.destroyed || incomingWithDrainState[incomingDraining]) {
61276
+ return;
61277
+ }
61278
+ incomingWithDrainState[incomingDraining] = true;
61279
+ if (incoming instanceof Http2ServerRequest2) {
61280
+ try {
61281
+ ;
61282
+ incoming.stream?.close?.(h2constants.NGHTTP2_NO_ERROR);
61283
+ } catch {
61284
+ }
61285
+ return;
61286
+ }
61287
+ let bytesRead = 0;
61288
+ const cleanup = () => {
61289
+ clearTimeout(timer);
61290
+ incoming.off("data", onData);
61291
+ incoming.off("end", cleanup);
61292
+ incoming.off("error", cleanup);
61293
+ };
61294
+ const forceClose = () => {
61295
+ cleanup();
61296
+ const socket = incoming.socket;
61297
+ if (socket && !socket.destroyed) {
61298
+ socket.destroySoon();
61299
+ }
61300
+ };
61301
+ const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS);
61302
+ timer.unref?.();
61303
+ const onData = (chunk) => {
61304
+ bytesRead += chunk.length;
61305
+ if (bytesRead > MAX_DRAIN_BYTES) {
61306
+ forceClose();
61307
+ }
61308
+ };
61309
+ incoming.on("data", onData);
61310
+ incoming.on("end", cleanup);
61311
+ incoming.on("error", cleanup);
61312
+ incoming.resume();
61313
+ };
61136
61314
  handleRequestError = () => new Response(null, {
61137
61315
  status: 400
61138
61316
  });
@@ -61304,14 +61482,18 @@ var init_dist = __esm({
61304
61482
  setTimeout(() => {
61305
61483
  if (!incomingEnded) {
61306
61484
  setTimeout(() => {
61307
- incoming.destroy();
61308
- outgoing.destroy();
61485
+ drainIncoming(incoming);
61309
61486
  });
61310
61487
  }
61311
61488
  });
61312
61489
  }
61313
61490
  };
61314
61491
  }
61492
+ outgoing.on("finish", () => {
61493
+ if (!incomingEnded) {
61494
+ drainIncoming(incoming);
61495
+ }
61496
+ });
61315
61497
  }
61316
61498
  outgoing.on("close", () => {
61317
61499
  const abortController = req[abortControllerKey];
@@ -61326,7 +61508,7 @@ var init_dist = __esm({
61326
61508
  setTimeout(() => {
61327
61509
  if (!incomingEnded) {
61328
61510
  setTimeout(() => {
61329
- incoming.destroy();
61511
+ drainIncoming(incoming);
61330
61512
  });
61331
61513
  }
61332
61514
  });