@tool-bridge/server 0.21.0 → 0.21.1

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 (110) hide show
  1. package/dist/{airtable-DMJEEGJP.js → airtable-LLZDFN7M.js} +5 -5
  2. package/dist/{alt_text_generator_ai-RELFQ5FV.js → alt_text_generator_ai-W7O34SNG.js} +4 -4
  3. package/dist/{amap-YSYEACKQ.js → amap-VOX4T2AW.js} +4 -4
  4. package/dist/{anthropic-D5X5GSYE.js → anthropic-G23NN3X5.js} +5 -5
  5. package/dist/{apify-5NVFU3IZ.js → apify-Y3SS734K.js} +5 -5
  6. package/dist/{brave_search-X557FMGO.js → brave_search-ZC7OAPSZ.js} +5 -5
  7. package/dist/{chunk-QR4LK3HF.js → chunk-ATK45BXV.js} +1 -1
  8. package/dist/{chunk-Q74GLIDK.js → chunk-E6JCVKW6.js} +6 -5
  9. package/dist/{chunk-MDY7K5CX.js → chunk-KMTT3I6D.js} +23 -263
  10. package/dist/chunk-R6P4XAE5.js +248 -0
  11. package/dist/{chunk-ZTTN6AJG.js → chunk-U7B6DS2O.js} +1 -1
  12. package/dist/{chunk-MZCIPUNQ.js → chunk-UZM2RXZH.js} +18 -6
  13. package/dist/{chunk-JEWFX6Z6.js → chunk-XYBU3WZH.js} +3 -3
  14. package/dist/{circleci-3P3QTUX2.js → circleci-3BAX5FCG.js} +5 -5
  15. package/dist/{clerk-GNMZQ2MY.js → clerk-6LEM6TNU.js} +5 -5
  16. package/dist/{cloudflare_dns-VWZH3ZTR.js → cloudflare_dns-KINYTJUD.js} +5 -5
  17. package/dist/{cohere-C7QVIIMG.js → cohere-XCJ5AJ6B.js} +5 -5
  18. package/dist/{confluence-52I37IUT.js → confluence-B3EWPZVE.js} +5 -5
  19. package/dist/{convertapi-3TRJ3WEO.js → convertapi-EUWSQYPF.js} +3 -3
  20. package/dist/{currencyapi-LWEANWVI.js → currencyapi-KVTIK3GL.js} +5 -5
  21. package/dist/{deepseek-5U24YG4P.js → deepseek-PC5YGNC5.js} +5 -5
  22. package/dist/{docker_hub-CMISLRSE.js → docker_hub-C3MA5FU6.js} +4 -4
  23. package/dist/{dropbox-TW4QN6FT.js → dropbox-XBV7Z2IR.js} +5 -5
  24. package/dist/{dub-EFXGI5UH.js → dub-LDOFG3HC.js} +5 -5
  25. package/dist/{e2b-PHM63OVF.js → e2b-JMCPSVBW.js} +5 -5
  26. package/dist/{exa-DYOQWURR.js → exa-RAK7O7RD.js} +5 -5
  27. package/dist/{fal_ai-VJPMCNRH.js → fal_ai-23E7JPNT.js} +5 -5
  28. package/dist/feishu-7QRIDUV6.js +12019 -0
  29. package/dist/{feishu_custom_bot-ADSE23KU.js → feishu_custom_bot-TJ4K7QNJ.js} +3 -3
  30. package/dist/{figma-4AK47AYY.js → figma-E6IX5DTH.js} +5 -5
  31. package/dist/{firehydrant-RGPTW4EA.js → firehydrant-ZBLPQREE.js} +5 -5
  32. package/dist/{fixer-OAMF4DKP.js → fixer-BWON27UO.js} +4 -4
  33. package/dist/{fly-YB4AQD4O.js → fly-ZH3HFCZJ.js} +5 -5
  34. package/dist/{front-6GTVYKUM.js → front-QCGXYEDJ.js} +5 -5
  35. package/dist/{geocodio-YRT4K25M.js → geocodio-YGNI7DA4.js} +4 -4
  36. package/dist/{ghost-JCW6UIP2.js → ghost-EVSGKH2Q.js} +4 -4
  37. package/dist/{github-CEGVRMNX.js → github-MA2BGRCJ.js} +5 -5
  38. package/dist/{gmail-JCMJD55P.js → gmail-E5E6AADE.js} +5 -5
  39. package/dist/{googlecalendar-2EAW4MNM.js → googlecalendar-BTLFPXTD.js} +11 -10
  40. package/dist/{googledocs-YNKKBM6Q.js → googledocs-BUHL4J2H.js} +6 -5
  41. package/dist/{grafana-353VSGXN.js → grafana-GLU2DWF2.js} +5 -5
  42. package/dist/{graphhopper-H3IVJNDS.js → graphhopper-WSMB3TCD.js} +4 -4
  43. package/dist/index.js +4 -3
  44. package/dist/{ip2proxy-DBGRWH7S.js → ip2proxy-EZ64Y4ZH.js} +4 -4
  45. package/dist/{ipgeolocation_io-5I2BDVMG.js → ipgeolocation_io-AA7HAS22.js} +4 -4
  46. package/dist/{ipqualityscore-ILV7TQCV.js → ipqualityscore-BHJXVTJT.js} +4 -4
  47. package/dist/{jina_ai-L5BH455V.js → jina_ai-EFBHTBXL.js} +5 -5
  48. package/dist/{jira-IGTILUZA.js → jira-HQSHAA5K.js} +5 -5
  49. package/dist/{langsmith-BYRX4AOF.js → langsmith-5W6SCT6F.js} +5 -5
  50. package/dist/{lemlist-ZGNYTIQO.js → lemlist-HJWH6UMK.js} +5 -5
  51. package/dist/{linear-HLGOWISN.js → linear-K7RYFYAD.js} +6 -5
  52. package/dist/{logsnag-5RGTMTU2.js → logsnag-4KFOHL37.js} +5 -5
  53. package/dist/main.js +103 -102
  54. package/dist/{mattermost-BONGXVC7.js → mattermost-S2BRCWLQ.js} +5 -5
  55. package/dist/{mem0-RUVNUPTE.js → mem0-CAW43CIC.js} +5 -5
  56. package/dist/{memos-TED4HI54.js → memos-TWEGPKFM.js} +8 -7
  57. package/dist/{metabase-ZHXHRHZK.js → metabase-MMSEPCOF.js} +5 -5
  58. package/dist/{mistral_ai-NGP5SHU7.js → mistral_ai-64BGZQHP.js} +5 -5
  59. package/dist/{mother_duck-TKVQM35M.js → mother_duck-H7PCQNZ2.js} +5 -5
  60. package/dist/{ngrok-BYCUJ7QV.js → ngrok-GQCUGZKJ.js} +5 -5
  61. package/dist/{notes-KXRNNYDW.js → notes-PFMKRO33.js} +1 -1
  62. package/dist/{notion-2ILYKJOO.js → notion-DQWZWP4N.js} +5 -5
  63. package/dist/{open_exchange_rates-JU4DC6HZ.js → open_exchange_rates-QMMD735E.js} +4 -4
  64. package/dist/{openai-6SOT26ZK.js → openai-W6PX32NZ.js} +5 -5
  65. package/dist/{opengraph_io-ZEFHV2OL.js → opengraph_io-HNDBXYNW.js} +4 -4
  66. package/dist/{openrouter-R4P7JL5L.js → openrouter-JJYMEAUL.js} +5 -5
  67. package/dist/{outline-VCTQ5V2X.js → outline-MCBNQZYY.js} +5 -5
  68. package/dist/{paddle-AZOAKBJS.js → paddle-D2SKLUDN.js} +5 -5
  69. package/dist/{perplexity-OMRLGVAT.js → perplexity-XIFMKUAE.js} +5 -5
  70. package/dist/{pinecone-DI62W3ZX.js → pinecone-HUFTALV2.js} +5 -5
  71. package/dist/{pipedrive-CW7HONYW.js → pipedrive-Y2O7QGFF.js} +5 -5
  72. package/dist/{polar-5DRGTXNR.js → polar-TYTOMOSR.js} +5 -5
  73. package/dist/{posthog-3DTHFCKE.js → posthog-43JAR3VW.js} +5 -5
  74. package/dist/{postmark-ME2V2XXI.js → postmark-KL2QJYSG.js} +5 -5
  75. package/dist/{prerender-5EAY7GDM.js → prerender-MENYM2TY.js} +4 -4
  76. package/dist/{pubmed-GRQUBGVA.js → pubmed-GOXUVVH5.js} +6 -5
  77. package/dist/{railway-FTM75TMX.js → railway-V2SID4WV.js} +3 -3
  78. package/dist/{readwise-IJQGV6IQ.js → readwise-CI4GIMMJ.js} +5 -5
  79. package/dist/{render-TMSPHRTY.js → render-SUBJ6YRZ.js} +5 -5
  80. package/dist/{replicate-RJCMDB7H.js → replicate-756MXPYX.js} +5 -5
  81. package/dist/{resend-YYN22NIL.js → resend-ZKH3BTBI.js} +5 -5
  82. package/dist/{rootly-7RXE4K7L.js → rootly-CD2LJHPI.js} +5 -5
  83. package/dist/{scrapfly-ZJJ6XM4Q.js → scrapfly-NSRHFDIQ.js} +4 -4
  84. package/dist/{scrapingbee-QNGEOD6D.js → scrapingbee-OQHLAVEY.js} +4 -4
  85. package/dist/{screenshot_fyi-SPZAABVD.js → screenshot_fyi-DVWG3AXC.js} +4 -4
  86. package/dist/{semantic_scholar-SDPVGDDI.js → semantic_scholar-T4A252KW.js} +5 -5
  87. package/dist/{sentry-SJ5NN4C4.js → sentry-546MNDJG.js} +5 -5
  88. package/dist/{shodan-YMGOY7KW.js → shodan-C3OON3Z3.js} +4 -4
  89. package/dist/{shopify-SU5ABP54.js → shopify-Y2HN2MCQ.js} +5 -5
  90. package/dist/{stripe-JAC425KE.js → stripe-VE3CD3AY.js} +3 -3
  91. package/dist/{supabase-GQ2OFVIL.js → supabase-U2SL4D63.js} +5 -5
  92. package/dist/{tavily-Y7MDA5CI.js → tavily-KCZHK6HE.js} +5 -5
  93. package/dist/{telegram-OIDT3ZLH.js → telegram-3URFBCMY.js} +4 -4
  94. package/dist/{telnyx-4JGMC3K7.js → telnyx-CXQ4EZUX.js} +5 -5
  95. package/dist/{todoist-O7S2OUGX.js → todoist-HNPWNYTD.js} +5 -5
  96. package/dist/{trello-3LDE4TAQ.js → trello-3W2MIXRP.js} +4 -4
  97. package/dist/{turso-MUQ44KCA.js → turso-2EQF7C2Z.js} +5 -5
  98. package/dist/{twilio-VYF3HUU6.js → twilio-4PDBJKWX.js} +6 -5
  99. package/dist/{umami-SVQIK26J.js → umami-5REN7TGP.js} +5 -5
  100. package/dist/{unsplash-333XYDCJ.js → unsplash-EIXL424F.js} +5 -5
  101. package/dist/{upstash_redis-IUM2HDLU.js → upstash_redis-G4LQBYHA.js} +5 -5
  102. package/dist/{uptimerobot-7ZRU2NJV.js → uptimerobot-KNJ3EYLY.js} +3 -3
  103. package/dist/{v2ex-AVSJCQPS.js → v2ex-RHJ234PZ.js} +5 -5
  104. package/dist/{vercel-J7RGXNSA.js → vercel-AS6NCIC7.js} +5 -5
  105. package/dist/{wolfram_alpha_api-6CRVUZOJ.js → wolfram_alpha_api-3G4PUJWB.js} +4 -4
  106. package/dist/{wordpress-THOJLPKA.js → wordpress-KNDAAUV7.js} +5 -5
  107. package/dist/{workos-ENTGRWF2.js → workos-R6UITSJ7.js} +5 -5
  108. package/dist/{zhihu-W2BXICTX.js → zhihu-AGK4HILK.js} +5 -5
  109. package/package.json +3 -3
  110. package/dist/feishu-TFIZXPIN.js +0 -231
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createAuthedClient
3
- } from "./chunk-JEWFX6Z6.js";
4
- import "./chunk-Q74GLIDK.js";
3
+ } from "./chunk-XYBU3WZH.js";
4
+ import "./chunk-E6JCVKW6.js";
5
5
  import {
6
6
  asJsonObject,
7
7
  booleanValue,
@@ -12,12 +12,12 @@ import {
12
12
  import {
13
13
  createProviderPlugin,
14
14
  upstreamError
15
- } from "./chunk-QR4LK3HF.js";
16
- import "./chunk-ZTTN6AJG.js";
15
+ } from "./chunk-ATK45BXV.js";
16
+ import "./chunk-U7B6DS2O.js";
17
17
  import {
18
18
  TBError,
19
19
  external_exports
20
- } from "./chunk-MZCIPUNQ.js";
20
+ } from "./chunk-UZM2RXZH.js";
21
21
  import "./chunk-U67V476Y.js";
22
22
 
23
23
  // ../plugins/src/airtable/api.ts
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  createProviderHttpClient
3
- } from "./chunk-Q74GLIDK.js";
3
+ } from "./chunk-E6JCVKW6.js";
4
4
  import "./chunk-JXHMDBAY.js";
5
5
  import {
6
6
  createProviderPlugin,
7
7
  requireApiKey,
8
8
  upstreamError
9
- } from "./chunk-QR4LK3HF.js";
10
- import "./chunk-ZTTN6AJG.js";
9
+ } from "./chunk-ATK45BXV.js";
10
+ import "./chunk-U7B6DS2O.js";
11
11
  import {
12
12
  TBError,
13
13
  external_exports
14
- } from "./chunk-MZCIPUNQ.js";
14
+ } from "./chunk-UZM2RXZH.js";
15
15
  import "./chunk-U67V476Y.js";
16
16
 
17
17
  // ../plugins/src/alt_text_generator_ai/schema.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createProviderHttpClient
3
- } from "./chunk-Q74GLIDK.js";
3
+ } from "./chunk-E6JCVKW6.js";
4
4
  import {
5
5
  asJsonObject,
6
6
  booleanValue,
@@ -10,12 +10,12 @@ import {
10
10
  createProviderPlugin,
11
11
  requireApiKey,
12
12
  upstreamError
13
- } from "./chunk-QR4LK3HF.js";
14
- import "./chunk-ZTTN6AJG.js";
13
+ } from "./chunk-ATK45BXV.js";
14
+ import "./chunk-U7B6DS2O.js";
15
15
  import {
16
16
  TBError,
17
17
  external_exports
18
- } from "./chunk-MZCIPUNQ.js";
18
+ } from "./chunk-UZM2RXZH.js";
19
19
  import "./chunk-U67V476Y.js";
20
20
 
21
21
  // ../plugins/src/amap/api.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createAuthedClient
3
- } from "./chunk-JEWFX6Z6.js";
4
- import "./chunk-Q74GLIDK.js";
3
+ } from "./chunk-XYBU3WZH.js";
4
+ import "./chunk-E6JCVKW6.js";
5
5
  import {
6
6
  compactDefined,
7
7
  trimmedText
@@ -9,12 +9,12 @@ import {
9
9
  import {
10
10
  createProviderPlugin,
11
11
  upstreamError
12
- } from "./chunk-QR4LK3HF.js";
13
- import "./chunk-ZTTN6AJG.js";
12
+ } from "./chunk-ATK45BXV.js";
13
+ import "./chunk-U7B6DS2O.js";
14
14
  import {
15
15
  TBError,
16
16
  external_exports
17
- } from "./chunk-MZCIPUNQ.js";
17
+ } from "./chunk-UZM2RXZH.js";
18
18
  import "./chunk-U67V476Y.js";
19
19
 
20
20
  // ../plugins/src/anthropic/api.ts
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  createAuthedClient
3
- } from "./chunk-JEWFX6Z6.js";
4
- import "./chunk-Q74GLIDK.js";
3
+ } from "./chunk-XYBU3WZH.js";
4
+ import "./chunk-E6JCVKW6.js";
5
5
  import {
6
6
  asJsonObject
7
7
  } from "./chunk-JXHMDBAY.js";
8
8
  import {
9
9
  createProviderPlugin,
10
10
  upstreamError
11
- } from "./chunk-QR4LK3HF.js";
12
- import "./chunk-ZTTN6AJG.js";
11
+ } from "./chunk-ATK45BXV.js";
12
+ import "./chunk-U7B6DS2O.js";
13
13
  import {
14
14
  TBError,
15
15
  external_exports
16
- } from "./chunk-MZCIPUNQ.js";
16
+ } from "./chunk-UZM2RXZH.js";
17
17
  import "./chunk-U67V476Y.js";
18
18
 
19
19
  // ../plugins/src/apify/api.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createAuthedClient
3
- } from "./chunk-JEWFX6Z6.js";
4
- import "./chunk-Q74GLIDK.js";
3
+ } from "./chunk-XYBU3WZH.js";
4
+ import "./chunk-E6JCVKW6.js";
5
5
  import {
6
6
  asJsonObject,
7
7
  compactDefined,
@@ -10,12 +10,12 @@ import {
10
10
  import {
11
11
  createProviderPlugin,
12
12
  upstreamError
13
- } from "./chunk-QR4LK3HF.js";
14
- import "./chunk-ZTTN6AJG.js";
13
+ } from "./chunk-ATK45BXV.js";
14
+ import "./chunk-U7B6DS2O.js";
15
15
  import {
16
16
  TBError,
17
17
  external_exports
18
- } from "./chunk-MZCIPUNQ.js";
18
+ } from "./chunk-UZM2RXZH.js";
19
19
  import "./chunk-U67V476Y.js";
20
20
 
21
21
  // ../plugins/src/brave_search/api.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TBError,
3
3
  createPlugin
4
- } from "./chunk-MZCIPUNQ.js";
4
+ } from "./chunk-UZM2RXZH.js";
5
5
 
6
6
  // ../plugins/src/_runtime/plugin.ts
7
7
  function requireApiKey(ctx, service) {
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  upstreamError
3
- } from "./chunk-QR4LK3HF.js";
3
+ } from "./chunk-ATK45BXV.js";
4
4
  import {
5
5
  createGuardedFetch
6
- } from "./chunk-ZTTN6AJG.js";
6
+ } from "./chunk-U7B6DS2O.js";
7
7
  import {
8
- TBError
9
- } from "./chunk-MZCIPUNQ.js";
8
+ TBError,
9
+ isTBError
10
+ } from "./chunk-UZM2RXZH.js";
10
11
 
11
12
  // ../plugins/src/_runtime/providerHttp.ts
12
13
  function credentialLike(name) {
@@ -241,7 +242,7 @@ function createProviderHttpClient(options) {
241
242
  return { parsed: parsed2, response: response2 };
242
243
  })());
243
244
  } catch (error) {
244
- if (error instanceof TBError && signal?.aborted !== true) throw error;
245
+ if (isTBError(error) && signal?.aborted !== true) throw error;
245
246
  const kind = signal?.aborted === true ? "timeout" : "network";
246
247
  const rawMessage = error instanceof Error ? error.message : void 0;
247
248
  const context = {
@@ -1,6 +1,10 @@
1
+ import {
2
+ EventSourceParserStream,
3
+ pkceChallenge
4
+ } from "./chunk-R6P4XAE5.js";
1
5
  import {
2
6
  createGuardedFetch
3
- } from "./chunk-ZTTN6AJG.js";
7
+ } from "./chunk-U7B6DS2O.js";
4
8
  import {
5
9
  AnnotationStore,
6
10
  CONTEXT_CAPABILITIES,
@@ -172,7 +176,7 @@ import {
172
176
  resolveIntegration,
173
177
  resolveUpstreamTool,
174
178
  rewriteRemotePath,
175
- safeParse,
179
+ safeParse2 as safeParse,
176
180
  selectFeedbackSearchText,
177
181
  serializeToolSearchSnapshot,
178
182
  sha256Hex,
@@ -197,7 +201,7 @@ import {
197
201
  url,
198
202
  validatePath,
199
203
  virtualizeTools
200
- } from "./chunk-MZCIPUNQ.js";
204
+ } from "./chunk-UZM2RXZH.js";
201
205
 
202
206
  // src/config.ts
203
207
  var DEFAULT_PORT = 8787;
@@ -14056,250 +14060,6 @@ var Ajv = import_ajv.Ajv;
14056
14060
  // ../../node_modules/.pnpm/@modelcontextprotocol+client@2.0.0/node_modules/@modelcontextprotocol/client/dist/shimsNode.mjs
14057
14061
  var CORS_IS_POSSIBLE = false;
14058
14062
 
14059
- // ../../node_modules/.pnpm/pkce-challenge@5.0.1/node_modules/pkce-challenge/dist/index.node.js
14060
- var crypto2;
14061
- crypto2 = globalThis.crypto?.webcrypto ?? // Node.js [18-16] REPL
14062
- globalThis.crypto ?? // Node.js >18
14063
- import("crypto").then((m) => m.webcrypto);
14064
- async function getRandomValues(size) {
14065
- return (await crypto2).getRandomValues(new Uint8Array(size));
14066
- }
14067
- async function random(size) {
14068
- const mask = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
14069
- const evenDistCutoff = Math.pow(2, 8) - Math.pow(2, 8) % mask.length;
14070
- let result = "";
14071
- while (result.length < size) {
14072
- const randomBytes = await getRandomValues(size - result.length);
14073
- for (const randomByte of randomBytes) {
14074
- if (randomByte < evenDistCutoff) {
14075
- result += mask[randomByte % mask.length];
14076
- }
14077
- }
14078
- }
14079
- return result;
14080
- }
14081
- async function generateVerifier(length) {
14082
- return await random(length);
14083
- }
14084
- async function generateChallenge(code_verifier) {
14085
- const buffer = await (await crypto2).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
14086
- return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
14087
- }
14088
- async function pkceChallenge(length) {
14089
- if (!length)
14090
- length = 43;
14091
- if (length < 43 || length > 128) {
14092
- throw `Expected a length between 43 and 128. Received ${length}.`;
14093
- }
14094
- const verifier = await generateVerifier(length);
14095
- const challenge = await generateChallenge(verifier);
14096
- return {
14097
- code_verifier: verifier,
14098
- code_challenge: challenge
14099
- };
14100
- }
14101
-
14102
- // ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/index.js
14103
- var ParseError = class extends Error {
14104
- constructor(message, options) {
14105
- super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
14106
- }
14107
- };
14108
- var LF = 10;
14109
- var CR = 13;
14110
- var SPACE = 32;
14111
- function noop(_arg) {
14112
- }
14113
- function createParser(config) {
14114
- if (typeof config == "function")
14115
- throw new TypeError(
14116
- "`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?"
14117
- );
14118
- const { onEvent = noop, onError = noop, onRetry = noop, onComment, maxBufferSize } = config, pendingFragments = [];
14119
- let pendingFragmentsLength = 0, isFirstChunk = true, id, data = "", dataLines = 0, eventType, terminated = false;
14120
- function feed(chunk) {
14121
- if (terminated)
14122
- throw new Error(
14123
- "Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing."
14124
- );
14125
- if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
14126
- const trailing2 = processLines(chunk);
14127
- trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
14128
- return;
14129
- }
14130
- if (chunk.indexOf(`
14131
- `) === -1 && chunk.indexOf("\r") === -1) {
14132
- pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
14133
- return;
14134
- }
14135
- pendingFragments.push(chunk);
14136
- const input = pendingFragments.join("");
14137
- pendingFragments.length = 0, pendingFragmentsLength = 0;
14138
- const trailing = processLines(input);
14139
- trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
14140
- }
14141
- function checkBufferSize() {
14142
- maxBufferSize !== void 0 && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = true, pendingFragments.length = 0, pendingFragmentsLength = 0, id = void 0, data = "", dataLines = 0, eventType = void 0, onError(
14143
- new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {
14144
- type: "max-buffer-size-exceeded"
14145
- })
14146
- )));
14147
- }
14148
- function processLines(chunk) {
14149
- let searchIndex = 0;
14150
- if (chunk.indexOf("\r") === -1) {
14151
- let lfIndex = chunk.indexOf(`
14152
- `, searchIndex);
14153
- for (; lfIndex !== -1; ) {
14154
- if (searchIndex === lfIndex) {
14155
- dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
14156
- `, searchIndex);
14157
- continue;
14158
- }
14159
- const firstCharCode = chunk.charCodeAt(searchIndex);
14160
- if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
14161
- const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
14162
- if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
14163
- onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
14164
- `, searchIndex);
14165
- continue;
14166
- }
14167
- data = dataLines === 0 ? value : `${data}
14168
- ${value}`, dataLines++;
14169
- } else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
14170
- chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
14171
- lfIndex
14172
- ) || void 0 : parseLine(chunk, searchIndex, lfIndex);
14173
- searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
14174
- `, searchIndex);
14175
- }
14176
- return chunk.slice(searchIndex);
14177
- }
14178
- for (; searchIndex < chunk.length; ) {
14179
- const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
14180
- `, searchIndex);
14181
- let lineEnd = -1;
14182
- if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
14183
- break;
14184
- parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
14185
- }
14186
- return chunk.slice(searchIndex);
14187
- }
14188
- function parseLine(chunk, start, end) {
14189
- if (start === end) {
14190
- dispatchEvent();
14191
- return;
14192
- }
14193
- const firstCharCode = chunk.charCodeAt(start);
14194
- if (isDataPrefix(chunk, start, firstCharCode)) {
14195
- const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
14196
- data = dataLines === 0 ? value2 : `${data}
14197
- ${value2}`, dataLines++;
14198
- return;
14199
- }
14200
- if (isEventPrefix(chunk, start, firstCharCode)) {
14201
- eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
14202
- return;
14203
- }
14204
- if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
14205
- const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
14206
- id = value2.includes("\0") ? void 0 : value2;
14207
- return;
14208
- }
14209
- if (firstCharCode === 58) {
14210
- if (onComment) {
14211
- const line2 = chunk.slice(start, end);
14212
- onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
14213
- }
14214
- return;
14215
- }
14216
- const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
14217
- if (fieldSeparatorIndex === -1) {
14218
- processField(line, "", line);
14219
- return;
14220
- }
14221
- const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
14222
- processField(field, value, line);
14223
- }
14224
- function processField(field, value, line) {
14225
- switch (field) {
14226
- case "event":
14227
- eventType = value || void 0;
14228
- break;
14229
- case "data":
14230
- data = dataLines === 0 ? value : `${data}
14231
- ${value}`, dataLines++;
14232
- break;
14233
- case "id":
14234
- id = value.includes("\0") ? void 0 : value;
14235
- break;
14236
- case "retry":
14237
- /^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
14238
- new ParseError(`Invalid \`retry\` value: "${value}"`, {
14239
- type: "invalid-retry",
14240
- value,
14241
- line
14242
- })
14243
- );
14244
- break;
14245
- default:
14246
- onError(
14247
- new ParseError(
14248
- `Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`,
14249
- { type: "unknown-field", field, value, line }
14250
- )
14251
- );
14252
- break;
14253
- }
14254
- }
14255
- function dispatchEvent() {
14256
- dataLines > 0 && onEvent({
14257
- id,
14258
- event: eventType,
14259
- data
14260
- }), id = void 0, data = "", dataLines = 0, eventType = void 0;
14261
- }
14262
- function reset(options = {}) {
14263
- if (options.consume && pendingFragments.length > 0) {
14264
- const incompleteLine = pendingFragments.join("");
14265
- parseLine(incompleteLine, 0, incompleteLine.length);
14266
- }
14267
- isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = false;
14268
- }
14269
- return { feed, reset };
14270
- }
14271
- function isDataPrefix(chunk, i, firstCharCode) {
14272
- return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
14273
- }
14274
- function isEventPrefix(chunk, i, firstCharCode) {
14275
- return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
14276
- }
14277
-
14278
- // ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
14279
- var EventSourceParserStream = class extends TransformStream {
14280
- constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
14281
- let parser;
14282
- super({
14283
- start(controller) {
14284
- parser = createParser({
14285
- onEvent: (event) => {
14286
- controller.enqueue(event);
14287
- },
14288
- onError(error) {
14289
- typeof onError == "function" && onError(error), (onError === "terminate" || error.type === "max-buffer-size-exceeded") && controller.error(error);
14290
- },
14291
- onRetry,
14292
- onComment,
14293
- maxBufferSize
14294
- });
14295
- },
14296
- transform(chunk) {
14297
- parser.feed(chunk);
14298
- }
14299
- });
14300
- }
14301
- };
14302
-
14303
14063
  // ../../node_modules/.pnpm/@modelcontextprotocol+client@2.0.0/node_modules/@modelcontextprotocol/client/dist/index.mjs
14304
14064
  var OAuthClientFlowError = class extends Error {
14305
14065
  static {
@@ -19185,7 +18945,7 @@ async function guardOAuth(fn) {
19185
18945
  try {
19186
18946
  return await fn();
19187
18947
  } catch (err) {
19188
- if (err instanceof TBError) throw err;
18948
+ if (isTBError(err)) throw err;
19189
18949
  if (err instanceof Error && /does not support dynamic client registration/i.test(err.message)) {
19190
18950
  throw new TBError(
19191
18951
  "invalid_argument",
@@ -36640,7 +36400,7 @@ async function readRemoteResponseBody(response, maxBytes, signal) {
36640
36400
  chunks.push(result.value);
36641
36401
  }
36642
36402
  } catch (error) {
36643
- if (error instanceof TBError) throw error;
36403
+ if (isTBError(error)) throw error;
36644
36404
  if (isAbortError(error, signal)) throw remoteAbortError();
36645
36405
  throw normalizeUpstreamError({
36646
36406
  kind: "network",
@@ -37467,7 +37227,7 @@ async function mailboxJsonObject(c, opts = {}) {
37467
37227
  }
37468
37228
  raw += decoder.decode();
37469
37229
  } catch (cause) {
37470
- if (cause instanceof TBError) throw cause;
37230
+ if (isTBError(cause)) throw cause;
37471
37231
  throw invalidRequest("body must be valid UTF-8 JSON");
37472
37232
  }
37473
37233
  }
@@ -38531,7 +38291,7 @@ function parseRecord(value) {
38531
38291
  topologyDigest: value.topologyDigest
38532
38292
  });
38533
38293
  } catch (error) {
38534
- if (error instanceof TBError) throw error;
38294
+ if (isTBError(error)) throw error;
38535
38295
  throw corruptSession();
38536
38296
  }
38537
38297
  }
@@ -38905,7 +38665,7 @@ function isPrefix(prefix, path) {
38905
38665
  return prefix === "" || prefix === path || path.startsWith(`${prefix}/`);
38906
38666
  }
38907
38667
  function controlledStatus(error) {
38908
- if (error instanceof TBError) {
38668
+ if (isTBError(error)) {
38909
38669
  if (error.message.includes("\u73AF")) return "cycle";
38910
38670
  if (error.message.includes("\u8DF3\u6570")) return "hop_limit";
38911
38671
  if (error.message.includes("aborted")) return "timed_out";
@@ -38924,7 +38684,7 @@ function invalidContinuation() {
38924
38684
  });
38925
38685
  }
38926
38686
  function continuationSourceError(error) {
38927
- if (error instanceof TBError) {
38687
+ if (isTBError(error)) {
38928
38688
  if (error.code === "invalid_argument") return error;
38929
38689
  if (error.message.includes("source work budget exhausted")) return invalidContinuation();
38930
38690
  }
@@ -39460,7 +39220,7 @@ async function computePage(deps, input, sources, remoteNodes, deadline, expiresA
39460
39220
  await assertFederatedCapability(deps, input, node, headers, deadline);
39461
39221
  return null;
39462
39222
  } catch (error) {
39463
- const status = error instanceof TBError && error.message.includes("unsupported") ? "unsupported" : controlledStatus(error);
39223
+ const status = isTBError(error) && error.message.includes("unsupported") ? "unsupported" : controlledStatus(error);
39464
39224
  return { error, source, status };
39465
39225
  }
39466
39226
  }
@@ -39468,7 +39228,7 @@ async function computePage(deps, input, sources, remoteNodes, deadline, expiresA
39468
39228
  for (const failure of capabilityFailures) {
39469
39229
  if (failure === null) continue;
39470
39230
  if (!initial) {
39471
- if (failure.error instanceof TBError && failure.error.code === "invalid_argument") {
39231
+ if (isTBError(failure.error) && failure.error.code === "invalid_argument") {
39472
39232
  throw failure.error;
39473
39233
  }
39474
39234
  throw failure.status === "unsupported" ? invalidContinuation() : retryableContinuationError();
@@ -39734,7 +39494,7 @@ async function executeFederatedSearch(deps, input) {
39734
39494
  requestDigest
39735
39495
  });
39736
39496
  } catch (error) {
39737
- if (!(error instanceof TBError) || error.code !== "invalid_argument") throw error;
39497
+ if (!isTBError(error) || error.code !== "invalid_argument") throw error;
39738
39498
  }
39739
39499
  if (next !== void 0) assertNextRecord(current, next, digest);
39740
39500
  const cachedNext = next !== void 0;
@@ -41110,7 +40870,7 @@ var DeviceHub = class {
41110
40870
  this.handleUpgrade(req, socket, head).catch((err) => {
41111
40871
  rejectUpgrade(
41112
40872
  socket,
41113
- err instanceof TBError ? err : new TBError("internal", "upgrade failed")
40873
+ isTBError(err) ? err : new TBError("internal", "upgrade failed")
41114
40874
  );
41115
40875
  });
41116
40876
  });
@@ -41240,7 +41000,7 @@ var DeviceHub = class {
41240
41000
  close: (code) => ws.close(code),
41241
41001
  onHello: (hello) => {
41242
41002
  this.acceptHello(conn, hello).catch((err) => {
41243
- conn.session.reject(err instanceof TBError ? err : new TBError("internal", "hello \u5931\u8D25"));
41003
+ conn.session.reject(isTBError(err) ? err : new TBError("internal", "hello \u5931\u8D25"));
41244
41004
  });
41245
41005
  }
41246
41006
  },
@@ -41263,7 +41023,7 @@ var DeviceHub = class {
41263
41023
  try {
41264
41024
  conn.session.handleFrame(decodeDeviceFrame(data.toString()));
41265
41025
  } catch (err) {
41266
- conn.session.reject(err instanceof TBError ? err : new TBError("invalid_argument", "\u975E\u6CD5\u5E27"));
41026
+ conn.session.reject(isTBError(err) ? err : new TBError("invalid_argument", "\u975E\u6CD5\u5E27"));
41267
41027
  }
41268
41028
  });
41269
41029
  ws.on("close", () => {
@@ -41699,7 +41459,7 @@ var FsObjectStore = class {
41699
41459
  if (!st.isFile()) continue;
41700
41460
  files.push({ key, meta: this.metaOf(key, st) });
41701
41461
  } catch (e) {
41702
- if (e instanceof TBError || isErrnoCode(e, "ENOENT")) continue;
41462
+ if (isTBError(e) || isErrnoCode(e, "ENOENT")) continue;
41703
41463
  throw e;
41704
41464
  }
41705
41465
  }
@@ -41766,7 +41526,7 @@ var FsObjectStore = class {
41766
41526
  if (real !== rootReal && !real.startsWith(rootReal + sep)) throw escapeError(key);
41767
41527
  return;
41768
41528
  } catch (e) {
41769
- if (e instanceof TBError) throw e;
41529
+ if (isTBError(e)) throw e;
41770
41530
  if (!isErrnoCode(e, "ENOENT")) throw e;
41771
41531
  const parent = dirname(probe);
41772
41532
  if (parent === probe) throw escapeError(key);
@@ -41908,7 +41668,7 @@ async function assertAncestorInRoot(root, full, key) {
41908
41668
  }
41909
41669
  return;
41910
41670
  } catch (error) {
41911
- if (error instanceof TBError) throw error;
41671
+ if (isTBError(error)) throw error;
41912
41672
  if (!isErrnoCode2(error, "ENOENT")) throw error;
41913
41673
  const parent = dirname2(probe);
41914
41674
  if (parent === probe) {
@@ -42441,7 +42201,7 @@ import { join as join4 } from "path";
42441
42201
  // package.json
42442
42202
  var package_default = {
42443
42203
  name: "@tool-bridge/server",
42444
- version: "0.21.0",
42204
+ version: "0.21.1",
42445
42205
  description: "tool-bridge self-hosted server: run the HTBP gateway on Node with SQLite or PostgreSQL persistence, filesystem object storage and WebSocket device channel \u2014 single container via docker run",
42446
42206
  type: "module",
42447
42207
  license: "MIT",