@tool-bridge/server 0.3.0 → 0.4.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 (108) hide show
  1. package/dist/{airtable-V6446SVY.js → airtable-K3I4W27V.js} +6 -4
  2. package/dist/{alt_text_generator_ai-HV7JZPDT.js → alt_text_generator_ai-NE5YYNW3.js} +6 -4
  3. package/dist/{amap-TTTVB6WS.js → amap-C2Y347XH.js} +6 -4
  4. package/dist/{anthropic-JH3RA363.js → anthropic-HEEOKRI7.js} +6 -4
  5. package/dist/{apify-ETNN7ITU.js → apify-4SCWADEP.js} +6 -4
  6. package/dist/{brave_search-3DDR2MMB.js → brave_search-UDLPBEMQ.js} +6 -4
  7. package/dist/{chunk-CSJEZHQO.js → chunk-CYTI7JDJ.js} +13 -82
  8. package/dist/{chunk-JLTYA2B3.js → chunk-F4O6ZRH7.js} +82 -4
  9. package/dist/{chunk-KGYJEEBI.js → chunk-OKQUN7BC.js} +103 -57
  10. package/dist/chunk-TKKRVFMK.js +90 -0
  11. package/dist/{chunk-K7FVSFUX.js → chunk-XE34TXY6.js} +47 -3
  12. package/dist/{circleci-MX3TX3HC.js → circleci-UJEIISGE.js} +6 -4
  13. package/dist/{clerk-MRPORVF4.js → clerk-I2I22BUO.js} +6 -4
  14. package/dist/{cloudflare_dns-OWP7DD7L.js → cloudflare_dns-5M2EY2RS.js} +6 -4
  15. package/dist/{cohere-GPECP66S.js → cohere-XQWLOLCR.js} +6 -4
  16. package/dist/{confluence-BN7LZ6BC.js → confluence-JHCKTQX4.js} +6 -4
  17. package/dist/{convertapi-SBEOFOFQ.js → convertapi-B56OVE2W.js} +7 -5
  18. package/dist/{currencyapi-P2YY7Y7P.js → currencyapi-UPOFZ5P6.js} +6 -4
  19. package/dist/{deepseek-MWB3NYIN.js → deepseek-OS75U3HY.js} +6 -4
  20. package/dist/{docker_hub-3JSCIGQ3.js → docker_hub-LQVDQTQJ.js} +6 -4
  21. package/dist/{dropbox-RFIBDAXO.js → dropbox-HWO6JJ5L.js} +6 -4
  22. package/dist/{dub-YVP57ELQ.js → dub-3J7YEZZ7.js} +6 -4
  23. package/dist/{e2b-NFSUHTZR.js → e2b-KT6W4M6Y.js} +6 -4
  24. package/dist/{exa-KTDY6IV3.js → exa-GWZZ6BWW.js} +6 -4
  25. package/dist/{fal_ai-OCUENLNQ.js → fal_ai-V4AQIJ5K.js} +6 -4
  26. package/dist/{feishu-5CWBQ7E5.js → feishu-GLQBDJMW.js} +12 -4
  27. package/dist/{feishu_custom_bot-ZJR22OK6.js → feishu_custom_bot-TEEZ3BRW.js} +6 -4
  28. package/dist/{figma-YULGANSA.js → figma-N7L3KF4A.js} +6 -4
  29. package/dist/{firehydrant-2V6YSYAP.js → firehydrant-WJT2MLGI.js} +6 -4
  30. package/dist/{fixer-LTCDB3CJ.js → fixer-TG5NW6OA.js} +6 -4
  31. package/dist/{fly-IXPKMAML.js → fly-LYK5NNBG.js} +6 -4
  32. package/dist/{front-KRFB4M5X.js → front-MUQ4YT7O.js} +6 -4
  33. package/dist/{geocodio-VVURKYHQ.js → geocodio-XXB2D3AN.js} +6 -4
  34. package/dist/{ghost-6J2RIOUB.js → ghost-MWYITKQ5.js} +7 -5
  35. package/dist/{github-5Z6KQRYH.js → github-CIBT2UB2.js} +6 -4
  36. package/dist/{gmail-KU4NZ7VA.js → gmail-JZECDA2U.js} +6 -4
  37. package/dist/{googlecalendar-X44DFFXG.js → googlecalendar-ICIIDGEO.js} +6 -4
  38. package/dist/{googledocs-WSGLPKSF.js → googledocs-AV5CHSH3.js} +6 -4
  39. package/dist/{grafana-4PKSSDXY.js → grafana-SJVGZAV5.js} +13 -5
  40. package/dist/{graphhopper-DF65ZNGK.js → graphhopper-ZVBBXBHD.js} +6 -4
  41. package/dist/index.d.ts +39 -0
  42. package/dist/index.js +2 -2
  43. package/dist/{ip2proxy-UCAQ5P2J.js → ip2proxy-EJMBZ4ZQ.js} +6 -4
  44. package/dist/{ipgeolocation_io-UX6FCA2S.js → ipgeolocation_io-7BP766PO.js} +6 -4
  45. package/dist/{ipqualityscore-MKTRXIZJ.js → ipqualityscore-QSB62FH3.js} +6 -4
  46. package/dist/{jina_ai-MRHPCSV5.js → jina_ai-O5GT4ZZZ.js} +6 -4
  47. package/dist/{jira-EG7ZPOIW.js → jira-DFOD6SAV.js} +7 -5
  48. package/dist/{langsmith-FNO3RCOZ.js → langsmith-B5HC4HNY.js} +19 -4
  49. package/dist/{lemlist-SN6BJHSG.js → lemlist-63EOIXDT.js} +6 -4
  50. package/dist/{linear-H3VU4PSD.js → linear-LBQC6RCY.js} +6 -4
  51. package/dist/{logsnag-OY2JJT2H.js → logsnag-YQL67XIX.js} +6 -4
  52. package/dist/main.js +184 -184
  53. package/dist/{mattermost-C5SQ7PGD.js → mattermost-VWLKWU7X.js} +7 -5
  54. package/dist/{mem0-LMLE5BFC.js → mem0-2J5MMVIP.js} +6 -4
  55. package/dist/{memos-UWFAMBZC.js → memos-ANAGWSHJ.js} +13 -5
  56. package/dist/{metabase-SRYDSDJ6.js → metabase-ONSZZ4E2.js} +13 -5
  57. package/dist/{mistral_ai-YNIJ7VDM.js → mistral_ai-FYNVJRRG.js} +7 -5
  58. package/dist/{mother_duck-CPGOFEXE.js → mother_duck-NRSVBZM7.js} +6 -4
  59. package/dist/{ngrok-CDJFBSOM.js → ngrok-FXSVFLEE.js} +6 -4
  60. package/dist/{notes-DIVFH3P3.js → notes-VO45PFNB.js} +10 -3
  61. package/dist/{notion-HGDKS4HK.js → notion-AQH7ZGLG.js} +6 -4
  62. package/dist/{open_exchange_rates-COHHYJDD.js → open_exchange_rates-G3MSI5KX.js} +6 -4
  63. package/dist/{openai-4TRT66GW.js → openai-SZETZOPF.js} +7 -5
  64. package/dist/{opengraph_io-YKVW4PXI.js → opengraph_io-XNV4BFE5.js} +7 -5
  65. package/dist/{openrouter-6CV7B7V5.js → openrouter-TV5LQ55F.js} +6 -4
  66. package/dist/{outline-YWDUK5F7.js → outline-DTZCJ7NR.js} +13 -5
  67. package/dist/{paddle-MEU7HWDZ.js → paddle-T6RK3QSQ.js} +6 -4
  68. package/dist/{perplexity-MRQUDBIC.js → perplexity-MVT3DWR2.js} +6 -4
  69. package/dist/{pinecone-JI7X2TAF.js → pinecone-Z4IVTJMV.js} +6 -4
  70. package/dist/{pipedrive-6JQPAW23.js → pipedrive-PM2PBDDZ.js} +6 -4
  71. package/dist/{polar-7BF56CMC.js → polar-CKXLVP45.js} +6 -4
  72. package/dist/{posthog-YPU5ADEN.js → posthog-QTYLJI3S.js} +20 -5
  73. package/dist/{postmark-BEU5OFKU.js → postmark-V6QQYQ6X.js} +6 -4
  74. package/dist/{prerender-UT5GOOZH.js → prerender-SQAU4FDE.js} +6 -4
  75. package/dist/{pubmed-3SGOE24Q.js → pubmed-6ZMRZYGK.js} +6 -4
  76. package/dist/{railway-CEK4GLRQ.js → railway-PJBDYQYM.js} +12 -4
  77. package/dist/{readwise-DXQUQU67.js → readwise-KJAOWBS5.js} +6 -4
  78. package/dist/{render-7TGAU5AW.js → render-Z2YG43ZD.js} +6 -4
  79. package/dist/{replicate-VICFSQ5A.js → replicate-AXMIH4OJ.js} +6 -4
  80. package/dist/{resend-3E76WK3O.js → resend-HQBXFMOO.js} +6 -4
  81. package/dist/{rootly-36GY46BY.js → rootly-CJW5SJEL.js} +6 -4
  82. package/dist/{scrapfly-VDVUYAHX.js → scrapfly-7APCZZ7V.js} +6 -4
  83. package/dist/{scrapingbee-3KTPMAVY.js → scrapingbee-HTUP6YCA.js} +6 -4
  84. package/dist/{screenshot_fyi-LKG62C3J.js → screenshot_fyi-N6JAOGFQ.js} +6 -4
  85. package/dist/{semantic_scholar-4WREECYO.js → semantic_scholar-METX5XVW.js} +6 -4
  86. package/dist/{sentry-HUQTGXOV.js → sentry-QM7OGZZK.js} +6 -4
  87. package/dist/{shodan-SGRKU4KS.js → shodan-ZPQCN5RX.js} +6 -4
  88. package/dist/{shopify-YCZ4L5HT.js → shopify-FPLQQJXS.js} +6 -4
  89. package/dist/{stripe-OEBKMELB.js → stripe-NNGIPJRH.js} +6 -4
  90. package/dist/{supabase-I3DBY7L4.js → supabase-HKIEC7JZ.js} +6 -4
  91. package/dist/{tavily-B2YHCNRD.js → tavily-WMQVNVQC.js} +6 -4
  92. package/dist/{telegram-2VYJELZX.js → telegram-VP76Z774.js} +7 -5
  93. package/dist/{telnyx-HHXD3CXL.js → telnyx-7BGNYZMU.js} +6 -4
  94. package/dist/{todoist-PHFDEEIS.js → todoist-MXXO72IA.js} +6 -4
  95. package/dist/{trello-WUSAK6YN.js → trello-7RFKIFYN.js} +6 -4
  96. package/dist/{turso-FW56U2B3.js → turso-SVWKUF5Y.js} +6 -4
  97. package/dist/{twilio-M5JI7XHA.js → twilio-WGXCKTR7.js} +6 -4
  98. package/dist/{umami-HAYODRC4.js → umami-2BB5YCC7.js} +6 -4
  99. package/dist/{unsplash-EDPTNEHJ.js → unsplash-W7TX5OXX.js} +6 -4
  100. package/dist/{upstash_redis-GC2CLIWD.js → upstash_redis-YJEWXBBX.js} +6 -4
  101. package/dist/{uptimerobot-XMSNYLIT.js → uptimerobot-BP4BGPOL.js} +6 -4
  102. package/dist/{v2ex-KU4ECD65.js → v2ex-Y2ENEEYQ.js} +6 -4
  103. package/dist/{vercel-THPCEFHW.js → vercel-6EB3NZZP.js} +6 -4
  104. package/dist/{wolfram_alpha_api-WHHTH4GU.js → wolfram_alpha_api-EF3CZMNC.js} +6 -4
  105. package/dist/{wordpress-O6TQEQNF.js → wordpress-JI3YVGXG.js} +7 -5
  106. package/dist/{workos-A3VHHWI3.js → workos-YDK42RA3.js} +6 -4
  107. package/dist/{zhihu-BJAI64YJ.js → zhihu-CNFASBUW.js} +6 -4
  108. package/package.json +3 -3
@@ -0,0 +1,90 @@
1
+ import {
2
+ createPlugin
3
+ } from "./chunk-XE34TXY6.js";
4
+ import {
5
+ TBError
6
+ } from "./chunk-F4O6ZRH7.js";
7
+
8
+ // ../plugins/src/_runtime/plugin.ts
9
+ function requireApiKey(ctx, service) {
10
+ const key = ctx.upstreamAuth;
11
+ if (key === void 0 || key === "") {
12
+ throw new TBError(
13
+ "unavailable",
14
+ `${service} \u9700\u8981 API key:\u7ED9\u6302\u8F7D\u8282\u70B9\u914D config.authRef \u6307\u5411\u5DF2\u5B58\u5165 system/secret \u7684\u51ED\u8BC1`
15
+ );
16
+ }
17
+ return key;
18
+ }
19
+ function requireCredential(ctx, service, field) {
20
+ const values = ctx.credentials;
21
+ if (values === void 0) {
22
+ throw new TBError(
23
+ "unavailable",
24
+ `${service} \u9700\u8981\u591A\u5B57\u6BB5\u51ED\u8BC1:\u7ED9\u6302\u8F7D\u8282\u70B9\u914D config.authRef \u6307\u5411\u5DF2\u5B58\u5165 system/secret \u7684\u51ED\u8BC1(\u7528 \`tb secret set <name> --field ...\` \u5199\u5165)`
25
+ );
26
+ }
27
+ const value = values[field];
28
+ if (value === void 0 || value === "") {
29
+ throw new TBError("internal", `${service} \u7684\u51ED\u8BC1\u5B57\u6BB5 '${field}' \u672A\u5728 credentialFields \u91CC\u58F0\u660E`);
30
+ }
31
+ return value;
32
+ }
33
+ function createProviderPlugin(input) {
34
+ const names = Object.keys(input.actions);
35
+ const handlerNames = Object.keys(input.handlers);
36
+ const missing = names.filter((name) => !handlerNames.includes(name));
37
+ const extra = handlerNames.filter((name) => !names.includes(name));
38
+ if (missing.length > 0 || extra.length > 0) {
39
+ throw new Error(
40
+ `action \u8868\u4E0E handler \u8868\u4E0D\u543B\u5408:\u7F3A handler [${missing.join(", ")}];\u591A\u4F59 handler [${extra.join(", ")}]`
41
+ );
42
+ }
43
+ const plugin = createPlugin({ token: (env) => env.PLUGIN_TOKEN });
44
+ const tools = plugin.tools(input.exportId ?? "actions", { description: input.description });
45
+ if (input.auth !== void 0) {
46
+ tools.auth(input.auth);
47
+ } else if (input.oauth === void 0 && input.credentialFields === void 0) {
48
+ tools.auth({ kind: "single", required: true });
49
+ }
50
+ if (input.oauth !== void 0) tools.oauth(input.oauth);
51
+ if (input.credentialFields !== void 0) tools.credentials(input.credentialFields);
52
+ if (input.mountConfigFields !== void 0) tools.mountConfig(input.mountConfigFields);
53
+ for (const name of names) {
54
+ tools.register(name, input.actions[name], (args, ctx) => input.handlers[name](args, {
55
+ upstreamAuth: ctx.upstreamAuth,
56
+ credentials: ctx.credentials,
57
+ config: ctx.mountConfig
58
+ }));
59
+ }
60
+ if (input.credentialProbe !== void 0) {
61
+ const effect = input.actions[input.credentialProbe]?.effect;
62
+ if (effect !== "read") {
63
+ throw new Error(
64
+ `credentialProbe '${input.credentialProbe}' \u7684 effect \u662F '${effect ?? "\u672A\u58F0\u660E"}', \u63A2\u9488\u5FC5\u987B\u662F read \u2014\u2014 \u6302\u8F7D\u65F6\u4F1A\u771F\u5B9E\u8C03\u7528\u5B83`
65
+ );
66
+ }
67
+ tools.probeCredentialWith(input.credentialProbe);
68
+ }
69
+ return plugin;
70
+ }
71
+
72
+ // ../plugins/src/_runtime/upstreamError.ts
73
+ function upstreamError(status, message) {
74
+ if (status === 401) {
75
+ return new TBError("permission_denied", message, { httpStatus: 401 });
76
+ }
77
+ if (status === 403) return new TBError("permission_denied", message);
78
+ if (status === 404) return new TBError("not_found", message);
79
+ if (status === 409) return new TBError("conflict", message);
80
+ if (status === 429) return new TBError("rate_limited", message, { retryable: true });
81
+ if (status >= 500) return new TBError("unavailable", message, { retryable: true });
82
+ return new TBError("invalid_argument", message);
83
+ }
84
+
85
+ export {
86
+ requireApiKey,
87
+ requireCredential,
88
+ createProviderPlugin,
89
+ upstreamError
90
+ };
@@ -10,7 +10,7 @@ import {
10
10
  isTBError,
11
11
  parseCredentialValues,
12
12
  toToolResult
13
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
14
14
 
15
15
  // ../plugin-sdk/src/index.ts
16
16
  var CONTEXT_VERB_BY_HANDLER = {
@@ -64,8 +64,10 @@ function createPlugin(opts = {}) {
64
64
  id: state.id,
65
65
  profile: "tools/v1",
66
66
  ...state.description !== void 0 ? { description: state.description } : {},
67
+ ...state.auth !== void 0 ? { auth: state.auth } : {},
67
68
  ...state.kind === "tools" && state.credentialProbe !== void 0 ? { credentialProbe: state.credentialProbe } : {},
68
69
  ...state.credentialFields !== void 0 ? { credentialFields: state.credentialFields } : {},
70
+ ...state.kind === "tools" && state.mountConfigFields !== void 0 ? { mountConfigFields: state.mountConfigFields } : {},
69
71
  ...state.kind === "tools" && state.oauth !== void 0 ? { oauth: state.oauth } : {}
70
72
  };
71
73
  }
@@ -75,8 +77,10 @@ function createPlugin(opts = {}) {
75
77
  id: state.id,
76
78
  profile: "context/v1",
77
79
  ...state.description !== void 0 ? { description: state.description } : {},
80
+ ...state.auth !== void 0 ? { auth: state.auth } : {},
78
81
  methods,
79
- ...capabilities.length > 0 ? { capabilities } : {}
82
+ ...capabilities.length > 0 ? { capabilities } : {},
83
+ ...state.mountConfigFields !== void 0 ? { mountConfigFields: state.mountConfigFields } : {}
80
84
  };
81
85
  })
82
86
  };
@@ -226,16 +230,34 @@ function createPlugin(opts = {}) {
226
230
  tools(id, meta) {
227
231
  assertFreshId(id);
228
232
  const state = {
233
+ auth: void 0,
229
234
  kind: "tools",
230
235
  id,
231
236
  description: meta?.description,
232
237
  credentialProbe: void 0,
233
238
  credentialFields: void 0,
239
+ mountConfigFields: void 0,
234
240
  oauth: void 0,
235
241
  registry: new OperationRegistry()
236
242
  };
237
243
  exports.set(id, state);
238
244
  const surface = {
245
+ auth(config) {
246
+ if (state.oauth !== void 0 || state.credentialFields !== void 0) {
247
+ throw new TBError(
248
+ "invalid_argument",
249
+ `export '${id}' \u5DF2\u58F0\u660E oauth/credentials(),\u4E0D\u80FD\u518D\u58F0\u660E auth`
250
+ );
251
+ }
252
+ if (config.kind === "none" && state.credentialProbe !== void 0) {
253
+ throw new TBError(
254
+ "invalid_argument",
255
+ `export '${id}' \u5DF2\u58F0\u660E credentialProbe,\u4E0D\u80FD\u518D\u58F0\u660E auth:none`
256
+ );
257
+ }
258
+ state.auth = config;
259
+ return surface;
260
+ },
239
261
  register(name, spec, handler) {
240
262
  state.registry.register(name, spec, handler);
241
263
  return surface;
@@ -250,9 +272,19 @@ function createPlugin(opts = {}) {
250
272
  `export '${id}' \u5DF2\u58F0\u660E oauth,\u4E0D\u80FD\u518D\u58F0\u660E credentials()(oauth \u6A21\u5F0F\u4E0B authRef \u6307\u5411\u7684 secret \u56FA\u5B9A\u5B58 clientId/clientSecret)`
251
273
  );
252
274
  }
275
+ if (state.auth !== void 0) {
276
+ throw new TBError("invalid_argument", `export '${id}' \u5DF2\u58F0\u660E auth,\u4E0D\u80FD\u518D\u58F0\u660E credentials()`);
277
+ }
253
278
  state.credentialFields = fields;
254
279
  return surface;
255
280
  },
281
+ mountConfig(fields) {
282
+ if (fields.length === 0) {
283
+ throw new TBError("invalid_argument", "mountConfig() \u81F3\u5C11\u8981\u58F0\u660E\u4E00\u4E2A\u5B57\u6BB5");
284
+ }
285
+ state.mountConfigFields = fields;
286
+ return surface;
287
+ },
256
288
  oauth(config) {
257
289
  if (state.credentialFields !== void 0) {
258
290
  throw new TBError(
@@ -260,6 +292,9 @@ function createPlugin(opts = {}) {
260
292
  `export '${id}' \u5DF2\u58F0\u660E credentials(),\u4E0D\u80FD\u518D\u58F0\u660E oauth(oauth \u6A21\u5F0F\u4E0B authRef \u6307\u5411\u7684 secret \u56FA\u5B9A\u5B58 clientId/clientSecret)`
261
293
  );
262
294
  }
295
+ if (state.auth !== void 0) {
296
+ throw new TBError("invalid_argument", `export '${id}' \u5DF2\u58F0\u660E auth,\u4E0D\u80FD\u518D\u58F0\u660E oauth`);
297
+ }
263
298
  if (state.credentialProbe !== void 0) {
264
299
  throw new TBError(
265
300
  "invalid_argument",
@@ -282,6 +317,9 @@ function createPlugin(opts = {}) {
282
317
  `export '${id}' \u5DF2\u58F0\u660E oauth,\u4E0D\u80FD\u518D\u58F0\u660E credentialProbe(\u51ED\u8BC1\u53EF\u7528\u6027\u7531\u6388\u6743\u6D41\u7A0B\u672C\u8EAB\u8BC1\u660E;\u62FF client \u51ED\u8BC1\u53BB\u8C03\u63A2\u9488\u65E2\u8BC1\u660E\u4E0D\u4E86\u4EC0\u4E48,\u53C8\u4F1A\u628A clientSecret \u9001\u8FDB\u63D2\u4EF6)`
283
318
  );
284
319
  }
320
+ if (state.auth?.kind === "none") {
321
+ throw new TBError("invalid_argument", `export '${id}' \u58F0\u660E auth:none,\u4E0D\u80FD\u518D\u58F0\u660E credentialProbe`);
322
+ }
285
323
  state.credentialProbe = name;
286
324
  return surface;
287
325
  }
@@ -290,7 +328,11 @@ function createPlugin(opts = {}) {
290
328
  },
291
329
  proxyTools(id, handlers) {
292
330
  assertFreshId(id);
331
+ if (handlers.auth !== void 0 && handlers.credentialFields !== void 0) {
332
+ throw new TBError("invalid_argument", `export '${id}' \u7684 auth \u4E0D\u80FD\u4E0E credentialFields \u540C\u65F6\u58F0\u660E`);
333
+ }
293
334
  exports.set(id, {
335
+ auth: handlers.auth,
294
336
  kind: "proxyTools",
295
337
  id,
296
338
  description: handlers.description,
@@ -302,10 +344,12 @@ function createPlugin(opts = {}) {
302
344
  context(id, handlers) {
303
345
  assertFreshId(id);
304
346
  exports.set(id, {
347
+ auth: handlers.auth,
305
348
  kind: "context",
306
349
  id,
307
350
  description: handlers.description,
308
- handlers
351
+ handlers,
352
+ mountConfigFields: handlers.mountConfigFields
309
353
  });
310
354
  return plugin;
311
355
  },
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/circleci/api.ts
@@ -1,13 +1,15 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  external_exports
10
- } from "./chunk-JLTYA2B3.js";
12
+ } from "./chunk-F4O6ZRH7.js";
11
13
  import "./chunk-MLKGABMK.js";
12
14
 
13
15
  // ../plugins/src/clerk/api.ts
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/cloudflare_dns/api.ts
@@ -1,13 +1,15 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  external_exports
10
- } from "./chunk-JLTYA2B3.js";
12
+ } from "./chunk-F4O6ZRH7.js";
11
13
  import "./chunk-MLKGABMK.js";
12
14
 
13
15
  // ../plugins/src/cohere/api.ts
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireCredential,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/confluence/api.ts
@@ -1,15 +1,17 @@
1
1
  import {
2
- assertPublicHttpUrl,
3
2
  createProviderPlugin,
4
- guardedFetch,
5
3
  requireApiKey,
6
4
  upstreamError
7
- } from "./chunk-CSJEZHQO.js";
8
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ assertPublicHttpUrl,
8
+ guardedFetch
9
+ } from "./chunk-CYTI7JDJ.js";
10
+ import "./chunk-XE34TXY6.js";
9
11
  import {
10
12
  TBError,
11
13
  external_exports
12
- } from "./chunk-JLTYA2B3.js";
14
+ } from "./chunk-F4O6ZRH7.js";
13
15
  import "./chunk-MLKGABMK.js";
14
16
 
15
17
  // ../plugins/src/convertapi/schema.ts
@@ -1,13 +1,15 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  external_exports
10
- } from "./chunk-JLTYA2B3.js";
12
+ } from "./chunk-F4O6ZRH7.js";
11
13
  import "./chunk-MLKGABMK.js";
12
14
 
13
15
  // ../plugins/src/currencyapi/api.ts
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/deepseek/api.ts
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/docker_hub/api.ts
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/dropbox/api.ts
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/dub/api.ts
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/e2b/api.ts
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/exa/api.ts
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/fal_ai/api.ts
@@ -1,11 +1,14 @@
1
+ import {
2
+ createGuardedFetch
3
+ } from "./chunk-CYTI7JDJ.js";
1
4
  import {
2
5
  createPlugin
3
- } from "./chunk-K7FVSFUX.js";
6
+ } from "./chunk-XE34TXY6.js";
4
7
  import {
5
8
  TBError,
6
9
  isTBError,
7
10
  normalizeUpstreamError
8
- } from "./chunk-JLTYA2B3.js";
11
+ } from "./chunk-F4O6ZRH7.js";
9
12
  import "./chunk-MLKGABMK.js";
10
13
 
11
14
  // ../plugins/src/feishu/feishuMcp.ts
@@ -17,12 +20,16 @@ import { CfWorkerJsonSchemaValidator } from "@modelcontextprotocol/sdk/validatio
17
20
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
18
21
  var DEFAULT_MCP_URL = "https://mcp.feishu.cn/mcp";
19
22
  var sessions = /* @__PURE__ */ new Map();
23
+ var feishuMcpFetch = createGuardedFetch({
24
+ crossOriginRedirect: "error",
25
+ sensitiveHeaders: ["x-lark-mcp-tat"]
26
+ });
20
27
  var noStandaloneSseFetch = (input, init) => {
21
28
  const method = init?.method ?? (input instanceof Request ? input.method : "GET");
22
29
  if (String(method).toUpperCase() === "GET") {
23
30
  return Promise.resolve(new Response(null, { status: 405, statusText: "Method Not Allowed" }));
24
31
  }
25
- return fetch(input, init);
32
+ return feishuMcpFetch(input, init);
26
33
  };
27
34
  function isSessionInvalid(err) {
28
35
  return err instanceof StreamableHTTPError && (err.code === 404 || err.code === 400);
@@ -111,6 +118,7 @@ async function callTool(cfg, name, args) {
111
118
  // ../plugins/src/feishu/tat.ts
112
119
  var DEFAULT_AUTH_URL = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal";
113
120
  var REFRESH_MARGIN_MS = 5 * 6e4;
121
+ var feishuAuthFetch = createGuardedFetch({ crossOriginRedirect: "error" });
114
122
  var cache = /* @__PURE__ */ new Map();
115
123
  async function tenantAccessToken(cfg, force = false) {
116
124
  const cached = cache.get(cfg.appId);
@@ -119,7 +127,7 @@ async function tenantAccessToken(cfg, force = false) {
119
127
  }
120
128
  let resp;
121
129
  try {
122
- resp = await fetch(cfg.authUrl ?? DEFAULT_AUTH_URL, {
130
+ resp = await feishuAuthFetch(cfg.authUrl ?? DEFAULT_AUTH_URL, {
123
131
  method: "POST",
124
132
  headers: { "content-type": "application/json; charset=utf-8" },
125
133
  body: JSON.stringify({ app_id: cfg.appId, app_secret: cfg.appSecret })
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireCredential,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/feishu_custom_bot/api.ts
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/figma/api.ts
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/firehydrant/api.ts
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createProviderPlugin,
3
- guardedFetch,
4
3
  requireApiKey,
5
4
  upstreamError
6
- } from "./chunk-CSJEZHQO.js";
7
- import "./chunk-K7FVSFUX.js";
5
+ } from "./chunk-TKKRVFMK.js";
6
+ import {
7
+ guardedFetch
8
+ } from "./chunk-CYTI7JDJ.js";
9
+ import "./chunk-XE34TXY6.js";
8
10
  import {
9
11
  TBError,
10
12
  external_exports
11
- } from "./chunk-JLTYA2B3.js";
13
+ } from "./chunk-F4O6ZRH7.js";
12
14
  import "./chunk-MLKGABMK.js";
13
15
 
14
16
  // ../plugins/src/fixer/api.ts