@tool-bridge/server 0.20.0 → 0.21.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 (109) hide show
  1. package/dist/{airtable-ZNWHIJMO.js → airtable-DMJEEGJP.js} +19 -16
  2. package/dist/{alt_text_generator_ai-X7RMDDM5.js → alt_text_generator_ai-RELFQ5FV.js} +4 -4
  3. package/dist/{amap-3VER75VH.js → amap-YSYEACKQ.js} +4 -4
  4. package/dist/{anthropic-N7NTB3UC.js → anthropic-D5X5GSYE.js} +23 -25
  5. package/dist/{apify-JB5P5AJI.js → apify-5NVFU3IZ.js} +20 -19
  6. package/dist/{brave_search-USL5OOBS.js → brave_search-X557FMGO.js} +16 -14
  7. package/dist/chunk-JEWFX6Z6.js +71 -0
  8. package/dist/{chunk-RVUERWUZ.js → chunk-MDY7K5CX.js} +748 -788
  9. package/dist/{chunk-WIGQCP6O.js → chunk-MZCIPUNQ.js} +141 -176
  10. package/dist/{chunk-6X55ALDX.js → chunk-Q74GLIDK.js} +3 -3
  11. package/dist/{chunk-6ANLYNFB.js → chunk-QR4LK3HF.js} +1 -1
  12. package/dist/{chunk-3WL6EXYX.js → chunk-ZTTN6AJG.js} +1 -1
  13. package/dist/{circleci-LBGB25LP.js → circleci-3P3QTUX2.js} +20 -24
  14. package/dist/{clerk-6RX37CNZ.js → clerk-GNMZQ2MY.js} +22 -21
  15. package/dist/{cloudflare_dns-NQGW7FHV.js → cloudflare_dns-VWZH3ZTR.js} +21 -17
  16. package/dist/{cohere-XPC2NAEW.js → cohere-C7QVIIMG.js} +19 -17
  17. package/dist/{confluence-ZUG2LT5A.js → confluence-52I37IUT.js} +16 -11
  18. package/dist/{convertapi-ZLXKWV3L.js → convertapi-3TRJ3WEO.js} +3 -3
  19. package/dist/{currencyapi-T3A3HSOD.js → currencyapi-LWEANWVI.js} +23 -26
  20. package/dist/{deepseek-NJMOD23E.js → deepseek-5U24YG4P.js} +27 -17
  21. package/dist/{docker_hub-D2MQCSJ7.js → docker_hub-CMISLRSE.js} +4 -4
  22. package/dist/{dropbox-MI6U3SOT.js → dropbox-TW4QN6FT.js} +9 -8
  23. package/dist/{dub-P2BYBYV4.js → dub-EFXGI5UH.js} +22 -19
  24. package/dist/{e2b-BGKIAE54.js → e2b-PHM63OVF.js} +20 -20
  25. package/dist/{exa-EUY7VV4C.js → exa-DYOQWURR.js} +22 -25
  26. package/dist/{fal_ai-AAOG5FYJ.js → fal_ai-VJPMCNRH.js} +18 -17
  27. package/dist/{feishu-AN5IJYOW.js → feishu-TFIZXPIN.js} +2 -2
  28. package/dist/{feishu_custom_bot-BWGMNVXF.js → feishu_custom_bot-ADSE23KU.js} +3 -3
  29. package/dist/{figma-SJSWYCGD.js → figma-4AK47AYY.js} +21 -23
  30. package/dist/{firehydrant-MOXK2PST.js → firehydrant-RGPTW4EA.js} +15 -15
  31. package/dist/{fixer-ISIDUDZU.js → fixer-OAMF4DKP.js} +4 -4
  32. package/dist/{fly-U4KPSGBF.js → fly-YB4AQD4O.js} +20 -16
  33. package/dist/{front-ZHM2YX2E.js → front-6GTVYKUM.js} +20 -23
  34. package/dist/{geocodio-SVCCAXAV.js → geocodio-YRT4K25M.js} +4 -4
  35. package/dist/{ghost-INTR7FIY.js → ghost-JCW6UIP2.js} +4 -4
  36. package/dist/{github-T275VVWR.js → github-CEGVRMNX.js} +28 -27
  37. package/dist/{gmail-KSSPOE67.js → gmail-JCMJD55P.js} +17 -17
  38. package/dist/{googlecalendar-JB5RW27L.js → googlecalendar-2EAW4MNM.js} +16 -14
  39. package/dist/{googledocs-G522PUGW.js → googledocs-YNKKBM6Q.js} +3 -3
  40. package/dist/{grafana-44ZPIV5P.js → grafana-353VSGXN.js} +24 -25
  41. package/dist/{graphhopper-2MORXLOW.js → graphhopper-H3IVJNDS.js} +4 -4
  42. package/dist/index.d.ts +31 -30
  43. package/dist/index.js +3 -3
  44. package/dist/{ip2proxy-R4K4KEMI.js → ip2proxy-DBGRWH7S.js} +4 -4
  45. package/dist/{ipgeolocation_io-H4J55OGI.js → ipgeolocation_io-5I2BDVMG.js} +4 -4
  46. package/dist/{ipqualityscore-XGID4OHA.js → ipqualityscore-ILV7TQCV.js} +4 -4
  47. package/dist/{jina_ai-7ZVDOR3Z.js → jina_ai-L5BH455V.js} +20 -21
  48. package/dist/{jira-CTIYZTT3.js → jira-IGTILUZA.js} +20 -16
  49. package/dist/{langsmith-ISP567FS.js → langsmith-BYRX4AOF.js} +25 -25
  50. package/dist/{lemlist-OGKK272F.js → lemlist-ZGNYTIQO.js} +23 -24
  51. package/dist/{linear-6JX4E3JI.js → linear-HLGOWISN.js} +3 -3
  52. package/dist/{logsnag-BVB36ZCL.js → logsnag-5RGTMTU2.js} +20 -22
  53. package/dist/main.js +102 -102
  54. package/dist/{mattermost-UECVPZGY.js → mattermost-BONGXVC7.js} +21 -17
  55. package/dist/{mem0-EUA7S2OO.js → mem0-RUVNUPTE.js} +15 -15
  56. package/dist/{memos-BYSBJRWZ.js → memos-TED4HI54.js} +36 -32
  57. package/dist/{metabase-4JXZH3YG.js → metabase-ZHXHRHZK.js} +22 -18
  58. package/dist/{mistral_ai-2C5BTBKW.js → mistral_ai-NGP5SHU7.js} +24 -21
  59. package/dist/{mother_duck-ZGNNNR3X.js → mother_duck-TKVQM35M.js} +23 -19
  60. package/dist/{ngrok-NTPGMRXI.js → ngrok-BYCUJ7QV.js} +17 -22
  61. package/dist/{notes-KGYXX6N6.js → notes-KXRNNYDW.js} +1 -1
  62. package/dist/{notion-EX3X2G7G.js → notion-2ILYKJOO.js} +20 -17
  63. package/dist/{open_exchange_rates-2V2LIGPS.js → open_exchange_rates-JU4DC6HZ.js} +4 -4
  64. package/dist/{openai-KQFQPK7Z.js → openai-6SOT26ZK.js} +22 -16
  65. package/dist/{opengraph_io-B63SEYJY.js → opengraph_io-ZEFHV2OL.js} +4 -4
  66. package/dist/{openrouter-62A4H62Q.js → openrouter-R4P7JL5L.js} +19 -14
  67. package/dist/{outline-QC33XLCK.js → outline-VCTQ5V2X.js} +18 -20
  68. package/dist/{paddle-HDZG35Y7.js → paddle-AZOAKBJS.js} +17 -15
  69. package/dist/{perplexity-M7LOMJWA.js → perplexity-OMRLGVAT.js} +19 -23
  70. package/dist/{pinecone-Y7YCJRZM.js → pinecone-DI62W3ZX.js} +19 -24
  71. package/dist/{pipedrive-FLJA62UX.js → pipedrive-CW7HONYW.js} +22 -23
  72. package/dist/{polar-AE55Q425.js → polar-5DRGTXNR.js} +19 -17
  73. package/dist/{posthog-IAY5D3YW.js → posthog-3DTHFCKE.js} +29 -24
  74. package/dist/{postmark-NMKAXDXZ.js → postmark-ME2V2XXI.js} +19 -17
  75. package/dist/{prerender-CDJM7I7N.js → prerender-5EAY7GDM.js} +4 -4
  76. package/dist/{pubmed-N437ZJOR.js → pubmed-GRQUBGVA.js} +3 -3
  77. package/dist/{railway-NBWYXCUM.js → railway-FTM75TMX.js} +3 -3
  78. package/dist/{readwise-QRO3UC3R.js → readwise-IJQGV6IQ.js} +16 -15
  79. package/dist/{render-NEW7SROG.js → render-TMSPHRTY.js} +21 -20
  80. package/dist/{replicate-73YQLRTY.js → replicate-RJCMDB7H.js} +20 -21
  81. package/dist/{resend-R5BAZFHZ.js → resend-YYN22NIL.js} +15 -11
  82. package/dist/{rootly-5BLALPCS.js → rootly-7RXE4K7L.js} +19 -18
  83. package/dist/{scrapfly-EHFLNNUZ.js → scrapfly-ZJJ6XM4Q.js} +4 -4
  84. package/dist/{scrapingbee-UXLYS72S.js → scrapingbee-QNGEOD6D.js} +4 -4
  85. package/dist/{screenshot_fyi-KC3NLTJ6.js → screenshot_fyi-SPZAABVD.js} +4 -4
  86. package/dist/{semantic_scholar-SA5OIUWA.js → semantic_scholar-SDPVGDDI.js} +21 -20
  87. package/dist/{sentry-BAE3XLJN.js → sentry-SJ5NN4C4.js} +22 -19
  88. package/dist/{shodan-FJR6MKKW.js → shodan-YMGOY7KW.js} +4 -4
  89. package/dist/{shopify-7OA6SLN5.js → shopify-SU5ABP54.js} +23 -19
  90. package/dist/{stripe-MUWDZGGF.js → stripe-JAC425KE.js} +3 -3
  91. package/dist/{supabase-SWWGNWYR.js → supabase-GQ2OFVIL.js} +18 -17
  92. package/dist/{tavily-XQNJ5EDI.js → tavily-Y7MDA5CI.js} +20 -20
  93. package/dist/{telegram-RR6JPZOG.js → telegram-OIDT3ZLH.js} +4 -4
  94. package/dist/{telnyx-7PKXOWSO.js → telnyx-4JGMC3K7.js} +19 -19
  95. package/dist/{todoist-63X5IUJE.js → todoist-O7S2OUGX.js} +18 -17
  96. package/dist/{trello-MOG63DAI.js → trello-3LDE4TAQ.js} +4 -4
  97. package/dist/{turso-ENWTSHDL.js → turso-MUQ44KCA.js} +23 -30
  98. package/dist/{twilio-FDXUN7VX.js → twilio-VYF3HUU6.js} +3 -3
  99. package/dist/{umami-TM7PROWF.js → umami-SVQIK26J.js} +23 -28
  100. package/dist/{unsplash-NWXLKSOW.js → unsplash-333XYDCJ.js} +19 -18
  101. package/dist/{upstash_redis-CUTQ5L2N.js → upstash_redis-IUM2HDLU.js} +17 -13
  102. package/dist/{uptimerobot-NNO32M3I.js → uptimerobot-7ZRU2NJV.js} +3 -3
  103. package/dist/{v2ex-24KMSWS7.js → v2ex-AVSJCQPS.js} +35 -18
  104. package/dist/{vercel-B45LPF6I.js → vercel-J7RGXNSA.js} +21 -18
  105. package/dist/{wolfram_alpha_api-DKJWVR6G.js → wolfram_alpha_api-6CRVUZOJ.js} +4 -4
  106. package/dist/{wordpress-XYFSDZXY.js → wordpress-THOJLPKA.js} +21 -17
  107. package/dist/{workos-BEM7EPHM.js → workos-ENTGRWF2.js} +26 -27
  108. package/dist/{zhihu-CFHZ4NC7.js → zhihu-W2BXICTX.js} +21 -21
  109. package/package.json +5 -5
@@ -1,19 +1,19 @@
1
1
  import {
2
- createProviderHttpClient
3
- } from "./chunk-6X55ALDX.js";
2
+ createAuthedClient
3
+ } from "./chunk-JEWFX6Z6.js";
4
+ import "./chunk-Q74GLIDK.js";
4
5
  import {
5
6
  asJsonObject
6
7
  } from "./chunk-JXHMDBAY.js";
7
8
  import {
8
9
  createProviderPlugin,
9
- requireApiKey,
10
10
  upstreamError
11
- } from "./chunk-6ANLYNFB.js";
12
- import "./chunk-3WL6EXYX.js";
11
+ } from "./chunk-QR4LK3HF.js";
12
+ import "./chunk-ZTTN6AJG.js";
13
13
  import {
14
14
  TBError,
15
15
  external_exports
16
- } from "./chunk-WIGQCP6O.js";
16
+ } from "./chunk-MZCIPUNQ.js";
17
17
  import "./chunk-U67V476Y.js";
18
18
 
19
19
  // ../plugins/src/semantic_scholar/api.ts
@@ -21,11 +21,6 @@ var SERVICE = "semantic_scholar";
21
21
  var GRAPH_BASE = "https://api.semanticscholar.org/graph/v1";
22
22
  var RECOMMENDATIONS_BASE = "https://api.semanticscholar.org/recommendations/v1";
23
23
  var REQUEST_TIMEOUT_MS = 3e4;
24
- var graphHttp = createProviderHttpClient({ baseUrl: `${GRAPH_BASE}/`, service: SERVICE });
25
- var recommendationsHttp = createProviderHttpClient({
26
- baseUrl: `${RECOMMENDATIONS_BASE}/`,
27
- service: SERVICE
28
- });
29
24
  function trimmed(value) {
30
25
  if (typeof value !== "string") return void 0;
31
26
  const result = value.trim();
@@ -82,23 +77,29 @@ function errorMessage(payload, status) {
82
77
  const body = asJsonObject(payload);
83
78
  return trimmed(body?.message) ?? trimmed(body?.error) ?? trimmed(body?.detail) ?? `Semantic Scholar \u8FD4\u56DE HTTP ${status}`;
84
79
  }
80
+ function s2Client(baseUrl) {
81
+ return createAuthedClient({
82
+ baseUrl,
83
+ service: SERVICE,
84
+ auth: { kind: "header", name: "x-api-key" },
85
+ headers: { accept: "application/json" },
86
+ // invalid-json 与常规错误体走不同分支,标准键序提取表达不了,整段覆写。
87
+ mapError: ({ bodyKind, data, status }) => bodyKind === "invalid-json" ? new TBError("unavailable", "Semantic Scholar \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94", { retryable: true }) : upstreamError(status, errorMessage(data, status)),
88
+ mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Semantic Scholar \u8BF7\u6C42\u8D85\u65F6(${REQUEST_TIMEOUT_MS / 1e3} \u79D2)`) : upstreamError(502, `Semantic Scholar \u8BF7\u6C42\u5931\u8D25:${message ?? "unknown network error"}`)
89
+ });
90
+ }
91
+ var graphHttp = s2Client(`${GRAPH_BASE}/`);
92
+ var recommendationsHttp = s2Client(`${RECOMMENDATIONS_BASE}/`);
85
93
  async function request(ctx, input) {
86
- const headers = {
87
- "accept": "application/json",
88
- "x-api-key": requireApiKey(ctx, SERVICE)
89
- };
90
94
  const http = input.family === "graph" ? graphHttp : recommendationsHttp;
91
- const response = await http.request({
95
+ const response = await http.request(ctx, {
92
96
  method: input.method,
93
97
  path: input.path,
94
98
  query: Object.entries(input.params ?? {}),
95
- headers,
96
99
  // 上游对 POST 一律发 body(没给就发 `{}`),保留:batch 端点不接受空请求。
97
100
  ...input.method === "POST" ? { json: input.body ?? {} } : {},
98
101
  timeoutMs: REQUEST_TIMEOUT_MS,
99
- invalidJsonMessage: "Semantic Scholar \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94",
100
- mapError: ({ bodyKind, data, status }) => bodyKind === "invalid-json" ? new TBError("unavailable", "Semantic Scholar \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94", { retryable: true }) : upstreamError(status, errorMessage(data, status)),
101
- mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Semantic Scholar \u8BF7\u6C42\u8D85\u65F6(${REQUEST_TIMEOUT_MS / 1e3} \u79D2)`) : upstreamError(502, `Semantic Scholar \u8BF7\u6C42\u5931\u8D25:${message ?? "unknown network error"}`)
102
+ invalidJsonMessage: "Semantic Scholar \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
102
103
  });
103
104
  return response.bodyKind === "empty" ? null : response.data;
104
105
  }
@@ -1,26 +1,25 @@
1
1
  import {
2
- createProviderHttpClient
3
- } from "./chunk-6X55ALDX.js";
2
+ createAuthedClient
3
+ } from "./chunk-JEWFX6Z6.js";
4
+ import "./chunk-Q74GLIDK.js";
4
5
  import {
5
6
  asJsonObject,
6
7
  compactDefined
7
8
  } from "./chunk-JXHMDBAY.js";
8
9
  import {
9
10
  createProviderPlugin,
10
- requireApiKey,
11
11
  upstreamError
12
- } from "./chunk-6ANLYNFB.js";
13
- import "./chunk-3WL6EXYX.js";
12
+ } from "./chunk-QR4LK3HF.js";
13
+ import "./chunk-ZTTN6AJG.js";
14
14
  import {
15
15
  TBError,
16
16
  external_exports
17
- } from "./chunk-WIGQCP6O.js";
17
+ } from "./chunk-MZCIPUNQ.js";
18
18
  import "./chunk-U67V476Y.js";
19
19
 
20
20
  // ../plugins/src/sentry/api.ts
21
21
  var SERVICE = "sentry";
22
22
  var API_BASE = "https://sentry.io/api/0/";
23
- var http = createProviderHttpClient({ baseUrl: API_BASE, service: SERVICE });
24
23
  function str(value) {
25
24
  return typeof value === "string" ? value : void 0;
26
25
  }
@@ -77,26 +76,30 @@ function errorMessage(payload, status) {
77
76
  const nested = str(asJsonObject(body?.detail)?.message);
78
77
  return pickStr(body?.error_description, body?.detail, body?.error, body?.message) ?? (nonEmpty(nested) ? nested : void 0) ?? `Sentry \u8FD4\u56DE HTTP ${status}`;
79
78
  }
79
+ var http = createAuthedClient({
80
+ baseUrl: API_BASE,
81
+ service: SERVICE,
82
+ auth: { kind: "bearer" },
83
+ headers: { accept: "application/json" },
84
+ mapError: ({ bodyKind, data, headers, status }) => {
85
+ const payload = headers.get("content-type")?.includes("application/json") === true && bodyKind === "json" ? data : null;
86
+ return upstreamError(status, errorMessage(payload, status));
87
+ },
88
+ mapTransportError: ({ message }) => upstreamError(
89
+ 502,
90
+ `Sentry \u8BF7\u6C42\u5931\u8D25:${message ?? "\u672A\u77E5\u9519\u8BEF"}`
91
+ )
92
+ });
80
93
  async function request(ctx, path, options = {}) {
81
- const token = requireApiKey(ctx, SERVICE);
82
- const result = await http.request({
94
+ const result = await http.request(ctx, {
83
95
  // path 不带前导斜杠 —— 见文件头注释,否则 /api/0 前缀会被整段吃掉。
84
96
  path,
85
97
  method: options.method ?? "GET",
86
98
  // 多值过滤器(environment / project / field …)展开成重复的同名参数。
87
99
  query: Object.entries(options.query ?? {}),
88
- headers: { accept: "application/json", authorization: `Bearer ${token}` },
89
100
  ...options.body === void 0 ? {} : { json: options.body },
90
101
  invalidJson: "text",
91
- responseType: "auto",
92
- mapError: ({ bodyKind, data, headers, status }) => {
93
- const payload2 = headers.get("content-type")?.includes("application/json") === true && bodyKind === "json" ? data : null;
94
- return upstreamError(status, errorMessage(payload2, status));
95
- },
96
- mapTransportError: ({ message }) => upstreamError(
97
- 502,
98
- `Sentry \u8BF7\u6C42\u5931\u8D25:${message ?? "\u672A\u77E5\u9519\u8BEF"}`
99
- )
102
+ responseType: "auto"
100
103
  });
101
104
  const payload = result.headers.get("content-type")?.includes("application/json") === true && result.bodyKind === "json" ? result.data : null;
102
105
  return { payload, headers: result.headers };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createProviderHttpClient
3
- } from "./chunk-6X55ALDX.js";
3
+ } from "./chunk-Q74GLIDK.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-6ANLYNFB.js";
14
- import "./chunk-3WL6EXYX.js";
13
+ } from "./chunk-QR4LK3HF.js";
14
+ import "./chunk-ZTTN6AJG.js";
15
15
  import {
16
16
  TBError,
17
17
  external_exports
18
- } from "./chunk-WIGQCP6O.js";
18
+ } from "./chunk-MZCIPUNQ.js";
19
19
  import "./chunk-U67V476Y.js";
20
20
 
21
21
  // ../plugins/src/shodan/api.ts
@@ -1,6 +1,7 @@
1
1
  import {
2
- createProviderHttpClient
3
- } from "./chunk-6X55ALDX.js";
2
+ createAuthedClient
3
+ } from "./chunk-JEWFX6Z6.js";
4
+ import "./chunk-Q74GLIDK.js";
4
5
  import {
5
6
  asJsonObject,
6
7
  trimmedText
@@ -9,19 +10,18 @@ import {
9
10
  createProviderPlugin,
10
11
  requireCredential,
11
12
  upstreamError
12
- } from "./chunk-6ANLYNFB.js";
13
- import "./chunk-3WL6EXYX.js";
13
+ } from "./chunk-QR4LK3HF.js";
14
+ import "./chunk-ZTTN6AJG.js";
14
15
  import {
15
16
  TBError,
16
17
  external_exports
17
- } from "./chunk-WIGQCP6O.js";
18
+ } from "./chunk-MZCIPUNQ.js";
18
19
  import "./chunk-U67V476Y.js";
19
20
 
20
21
  // ../plugins/src/shopify/api.ts
21
22
  var SERVICE = "shopify";
22
23
  var REST_API_VERSION = "2026-04";
23
24
  var MYSHOPIFY_SUFFIX = ".myshopify.com";
24
- var http = createProviderHttpClient({ service: SERVICE });
25
25
  function requireRecord(value, label) {
26
26
  const result = asJsonObject(value);
27
27
  if (result === void 0) throw new TBError("unavailable", `Shopify \u54CD\u5E94\u7F3A\u5C11 ${label}`, { retryable: true });
@@ -102,23 +102,27 @@ function pageInfoForRel(linkHeader, rel) {
102
102
  }
103
103
  return null;
104
104
  }
105
+ var http = createAuthedClient({
106
+ service: SERVICE,
107
+ auth: {
108
+ kind: "custom",
109
+ headers: (ctx) => ({ "x-shopify-access-token": requireCredential(ctx, SERVICE, "apiKey") })
110
+ },
111
+ headers: { accept: "application/json" },
112
+ mapError: ({ data, status }) => {
113
+ const detail = errorDetail(data);
114
+ return upstreamError(
115
+ status,
116
+ detail === void 0 ? `Shopify REST \u8FD4\u56DE HTTP ${status}` : `Shopify REST \u8FD4\u56DE HTTP ${status}: ${detail}`
117
+ );
118
+ }
119
+ });
105
120
  async function request(ctx, path, query) {
106
- const result = await http.request({
121
+ const result = await http.request(ctx, {
107
122
  baseUrl: `https://${shopHost(ctx)}/admin/api/${REST_API_VERSION}/`,
108
123
  path,
109
124
  query: Object.entries(query ?? {}),
110
- headers: {
111
- "accept": "application/json",
112
- "x-shopify-access-token": requireCredential(ctx, SERVICE, "apiKey")
113
- },
114
- invalidJsonMessage: "Shopify REST \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94",
115
- mapError: ({ data, status }) => {
116
- const detail = errorDetail(data);
117
- return upstreamError(
118
- status,
119
- detail === void 0 ? `Shopify REST \u8FD4\u56DE HTTP ${status}` : `Shopify REST \u8FD4\u56DE HTTP ${status}: ${detail}`
120
- );
121
- }
125
+ invalidJsonMessage: "Shopify REST \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
122
126
  });
123
127
  return {
124
128
  payload: result.data === void 0 ? null : result.data,
@@ -2,14 +2,14 @@ import {
2
2
  createProviderPlugin,
3
3
  requireApiKey,
4
4
  upstreamError
5
- } from "./chunk-6ANLYNFB.js";
5
+ } from "./chunk-QR4LK3HF.js";
6
6
  import {
7
7
  guardedFetch
8
- } from "./chunk-3WL6EXYX.js";
8
+ } from "./chunk-ZTTN6AJG.js";
9
9
  import {
10
10
  TBError,
11
11
  external_exports
12
- } from "./chunk-WIGQCP6O.js";
12
+ } from "./chunk-MZCIPUNQ.js";
13
13
  import "./chunk-U67V476Y.js";
14
14
 
15
15
  // ../plugins/src/stripe/api.ts
@@ -1,6 +1,7 @@
1
1
  import {
2
- createProviderHttpClient
3
- } from "./chunk-6X55ALDX.js";
2
+ createAuthedClient
3
+ } from "./chunk-JEWFX6Z6.js";
4
+ import "./chunk-Q74GLIDK.js";
4
5
  import {
5
6
  asJsonObject,
6
7
  compactDefined,
@@ -8,20 +9,18 @@ import {
8
9
  } from "./chunk-JXHMDBAY.js";
9
10
  import {
10
11
  createProviderPlugin,
11
- requireApiKey,
12
12
  upstreamError
13
- } from "./chunk-6ANLYNFB.js";
14
- import "./chunk-3WL6EXYX.js";
13
+ } from "./chunk-QR4LK3HF.js";
14
+ import "./chunk-ZTTN6AJG.js";
15
15
  import {
16
16
  TBError,
17
17
  external_exports
18
- } from "./chunk-WIGQCP6O.js";
18
+ } from "./chunk-MZCIPUNQ.js";
19
19
  import "./chunk-U67V476Y.js";
20
20
 
21
21
  // ../plugins/src/supabase/api.ts
22
22
  var SERVICE = "supabase";
23
23
  var API_BASE = "https://api.supabase.com/v1";
24
- var http = createProviderHttpClient({ baseUrl: `${API_BASE}/`, service: SERVICE });
25
24
  var PROJECT_STATUSES = /* @__PURE__ */ new Set([
26
25
  "ACTIVE_HEALTHY",
27
26
  "ACTIVE_UNHEALTHY",
@@ -84,23 +83,25 @@ function errorMessage(status, payload) {
84
83
  if (code === "invalid_grant") return "supabase grant is invalid or expired";
85
84
  return trimmedText(detail.message) ?? trimmedText(detail.msg) ?? trimmedText(detail.error_description) ?? `supabase request failed with ${status}`;
86
85
  }
86
+ var http = createAuthedClient({
87
+ baseUrl: `${API_BASE}/`,
88
+ service: SERVICE,
89
+ auth: { kind: "bearer" },
90
+ headers: { accept: "application/json" },
91
+ mapError: ({ data: payload, status }) => upstreamError(
92
+ status,
93
+ errorMessage(status, typeof payload === "string" ? { message: payload } : payload)
94
+ )
95
+ });
87
96
  async function request(ctx, input) {
88
97
  const hasBody = input.body !== void 0;
89
- const { data } = await http.request({
98
+ const { data } = await http.request(ctx, {
90
99
  path: input.path,
91
100
  method: input.method ?? "GET",
92
101
  // health 的 services 靠**重复同名参数**表达;statuses 那种逗号串在调用处就拼好了。
93
102
  query: Object.entries(input.query ?? {}),
94
- headers: {
95
- accept: "application/json",
96
- authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`
97
- },
98
103
  ...hasBody ? { json: input.body } : {},
99
- invalidJsonMessage: "malformed supabase response: malformed supabase json response",
100
- mapError: ({ data: payload2, status }) => upstreamError(
101
- status,
102
- errorMessage(status, typeof payload2 === "string" ? { message: payload2 } : payload2)
103
- )
104
+ invalidJsonMessage: "malformed supabase response: malformed supabase json response"
104
105
  });
105
106
  const payload = data ?? null;
106
107
  if (payload === null && input.allowEmpty !== true) throw malformed("empty body");
@@ -1,41 +1,41 @@
1
1
  import {
2
- createProviderHttpClient
3
- } from "./chunk-6X55ALDX.js";
2
+ createAuthedClient
3
+ } from "./chunk-JEWFX6Z6.js";
4
+ import "./chunk-Q74GLIDK.js";
4
5
  import {
5
- asJsonObject,
6
- messageFrom
6
+ asJsonObject
7
7
  } from "./chunk-JXHMDBAY.js";
8
8
  import {
9
9
  createProviderPlugin,
10
- requireApiKey,
11
10
  upstreamError
12
- } from "./chunk-6ANLYNFB.js";
13
- import "./chunk-3WL6EXYX.js";
11
+ } from "./chunk-QR4LK3HF.js";
12
+ import "./chunk-ZTTN6AJG.js";
14
13
  import {
15
14
  external_exports
16
- } from "./chunk-WIGQCP6O.js";
15
+ } from "./chunk-MZCIPUNQ.js";
17
16
  import "./chunk-U67V476Y.js";
18
17
 
19
18
  // ../plugins/src/tavily/api.ts
20
19
  var SERVICE = "tavily";
21
20
  var REQUEST_TIMEOUT_MS = 3e4;
22
- var http = createProviderHttpClient({ baseUrl: "https://api.tavily.com/", service: SERVICE });
21
+ var http = createAuthedClient({
22
+ baseUrl: "https://api.tavily.com/",
23
+ service: SERVICE,
24
+ auth: { kind: "bearer" },
25
+ headers: { accept: "application/json" },
26
+ errorMessage: {
27
+ keys: ["detail", "error", "message"],
28
+ fallback: (status) => `Tavily \u8FD4\u56DE HTTP ${status}`
29
+ },
30
+ mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Tavily ${REQUEST_TIMEOUT_MS / 1e3}s \u5185\u6CA1\u6709\u8FD4\u56DE`) : upstreamError(502, message === void 0 ? "Tavily \u8BF7\u6C42\u5931\u8D25" : `Tavily \u8BF7\u6C42\u5931\u8D25:${message}`)
31
+ });
23
32
  async function request(ctx, options) {
24
- const { data } = await http.request({
33
+ const { data } = await http.request(ctx, {
25
34
  path: options.path,
26
35
  method: options.method,
27
- headers: {
28
- accept: "application/json",
29
- authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`
30
- },
31
36
  ...options.body === void 0 ? {} : { json: options.body },
32
37
  timeoutMs: REQUEST_TIMEOUT_MS,
33
- invalidJsonMessage: "Tavily \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94",
34
- mapError: ({ data: payload, status }) => upstreamError(
35
- status,
36
- messageFrom(payload, ["detail", "error", "message"], `Tavily \u8FD4\u56DE HTTP ${status}`)
37
- ),
38
- mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Tavily ${REQUEST_TIMEOUT_MS / 1e3}s \u5185\u6CA1\u6709\u8FD4\u56DE`) : upstreamError(502, message === void 0 ? "Tavily \u8BF7\u6C42\u5931\u8D25" : `Tavily \u8BF7\u6C42\u5931\u8D25:${message}`)
38
+ invalidJsonMessage: "Tavily \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
39
39
  });
40
40
  if (data === void 0) return {};
41
41
  const result = asJsonObject(data);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createProviderHttpClient
3
- } from "./chunk-6X55ALDX.js";
3
+ } from "./chunk-Q74GLIDK.js";
4
4
  import {
5
5
  asJsonObject,
6
6
  booleanValue,
@@ -12,14 +12,14 @@ import {
12
12
  createProviderPlugin,
13
13
  requireApiKey,
14
14
  upstreamError
15
- } from "./chunk-6ANLYNFB.js";
15
+ } from "./chunk-QR4LK3HF.js";
16
16
  import {
17
17
  assertPublicHttpUrl
18
- } from "./chunk-3WL6EXYX.js";
18
+ } from "./chunk-ZTTN6AJG.js";
19
19
  import {
20
20
  TBError,
21
21
  external_exports
22
- } from "./chunk-WIGQCP6O.js";
22
+ } from "./chunk-MZCIPUNQ.js";
23
23
  import "./chunk-U67V476Y.js";
24
24
 
25
25
  // ../plugins/src/telegram/api.ts
@@ -1,26 +1,25 @@
1
1
  import {
2
- createProviderHttpClient
3
- } from "./chunk-6X55ALDX.js";
2
+ createAuthedClient
3
+ } from "./chunk-JEWFX6Z6.js";
4
+ import "./chunk-Q74GLIDK.js";
4
5
  import {
5
6
  asJsonObject,
6
7
  trimmedText
7
8
  } from "./chunk-JXHMDBAY.js";
8
9
  import {
9
10
  createProviderPlugin,
10
- requireApiKey,
11
11
  upstreamError
12
- } from "./chunk-6ANLYNFB.js";
13
- import "./chunk-3WL6EXYX.js";
12
+ } from "./chunk-QR4LK3HF.js";
13
+ import "./chunk-ZTTN6AJG.js";
14
14
  import {
15
15
  TBError,
16
16
  external_exports
17
- } from "./chunk-WIGQCP6O.js";
17
+ } from "./chunk-MZCIPUNQ.js";
18
18
  import "./chunk-U67V476Y.js";
19
19
 
20
20
  // ../plugins/src/telnyx/api.ts
21
21
  var SERVICE = "telnyx";
22
22
  var API_BASE = "https://api.telnyx.com/v2";
23
- var http = createProviderHttpClient({ baseUrl: `${API_BASE}/`, service: SERVICE });
24
23
  function errorMessage(payload, status, statusText) {
25
24
  if (typeof payload === "string" && payload.trim() !== "") return payload;
26
25
  const record = asJsonObject(payload);
@@ -29,27 +28,28 @@ function errorMessage(payload, status, statusText) {
29
28
  const message = first === void 0 ? trimmedText(record?.detail) ?? trimmedText(record?.message) ?? trimmedText(record?.error) ?? trimmedText(record?.title) : trimmedText(first.detail) ?? trimmedText(first.title) ?? trimmedText(first.code);
30
29
  return message ?? (statusText || `Telnyx \u8FD4\u56DE HTTP ${status}`);
31
30
  }
31
+ var http = createAuthedClient({
32
+ baseUrl: `${API_BASE}/`,
33
+ service: SERVICE,
34
+ auth: { kind: "bearer" },
35
+ headers: { accept: "application/json" },
36
+ mapError: ({ bodyKind, data, status, statusText }) => bodyKind === "invalid-json" ? upstreamError(status === 429 ? 429 : 502, "Telnyx \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94") : upstreamError(status, errorMessage(bodyKind === "empty" ? null : data, status, statusText)),
37
+ mapTransportError: ({ message }) => upstreamError(
38
+ 502,
39
+ message === void 0 ? "telnyx request failed" : `telnyx request failed: ${message}`
40
+ )
41
+ });
32
42
  async function request(ctx, path, input = {}) {
33
- const headers = {
34
- accept: "application/json",
35
- authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`
36
- };
37
- const response = await http.request({
43
+ const response = await http.request(ctx, {
38
44
  method: input.method ?? "GET",
39
45
  path,
40
46
  // 空串不进 query:Telnyx 会把 `filter[name]=` 读成"匹配空名字",而调用方省略一个
41
47
  // 可选筛选时想要的是"不筛选"。
42
48
  query: (input.query ?? []).filter(([, value]) => value !== void 0 && value !== null && value !== ""),
43
- headers,
44
49
  // JSON.stringify 自己会丢掉值为 undefined 的键,故不必复制上游的 removeUndefined;
45
50
  // 但 null 必须留住 —— schema 允许 sendAt 显式传 null,那是要发给 Telnyx 的值。
46
51
  ...input.body === void 0 ? {} : { json: input.body },
47
- invalidJsonMessage: "Telnyx \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94",
48
- mapError: ({ bodyKind, data, status, statusText }) => bodyKind === "invalid-json" ? upstreamError(status === 429 ? 429 : 502, "Telnyx \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94") : upstreamError(status, errorMessage(bodyKind === "empty" ? null : data, status, statusText)),
49
- mapTransportError: ({ message }) => upstreamError(
50
- 502,
51
- message === void 0 ? "telnyx request failed" : `telnyx request failed: ${message}`
52
- )
52
+ invalidJsonMessage: "Telnyx \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
53
53
  });
54
54
  const record = asJsonObject(response.bodyKind === "empty" ? null : response.data);
55
55
  if (record === void 0) {
@@ -1,6 +1,7 @@
1
1
  import {
2
- createProviderHttpClient
3
- } from "./chunk-6X55ALDX.js";
2
+ createAuthedClient
3
+ } from "./chunk-JEWFX6Z6.js";
4
+ import "./chunk-Q74GLIDK.js";
4
5
  import {
5
6
  asJsonObject,
6
7
  compactDefined,
@@ -8,21 +9,19 @@ import {
8
9
  } from "./chunk-JXHMDBAY.js";
9
10
  import {
10
11
  createProviderPlugin,
11
- requireApiKey,
12
12
  upstreamError
13
- } from "./chunk-6ANLYNFB.js";
14
- import "./chunk-3WL6EXYX.js";
13
+ } from "./chunk-QR4LK3HF.js";
14
+ import "./chunk-ZTTN6AJG.js";
15
15
  import {
16
16
  TBError,
17
17
  external_exports
18
- } from "./chunk-WIGQCP6O.js";
18
+ } from "./chunk-MZCIPUNQ.js";
19
19
  import "./chunk-U67V476Y.js";
20
20
 
21
21
  // ../plugins/src/todoist/api.ts
22
22
  var SERVICE = "todoist";
23
23
  var API_BASE = "https://api.todoist.com/api/v1";
24
24
  var USER_PATH = "/user";
25
- var http = createProviderHttpClient({ baseUrl: `${API_BASE}/`, service: SERVICE });
26
25
  function requireText(value, field) {
27
26
  const result = trimmedText(value);
28
27
  if (result === void 0) throw new TBError("invalid_argument", `${field} is required.`);
@@ -48,6 +47,16 @@ function errorMessage(status, payload) {
48
47
  }
49
48
  return `todoist request failed with ${status}`;
50
49
  }
50
+ var http = createAuthedClient({
51
+ baseUrl: `${API_BASE}/`,
52
+ service: SERVICE,
53
+ auth: { kind: "bearer" },
54
+ headers: { accept: "application/json" },
55
+ mapError: ({ data, status }) => upstreamError(
56
+ status,
57
+ errorMessage(status, typeof data === "string" ? { message: data } : data)
58
+ )
59
+ });
51
60
  async function request(ctx, input) {
52
61
  const hasBody = input.body !== void 0;
53
62
  const query = Object.entries(input.query ?? {}).map(([key, value]) => [
@@ -55,20 +64,12 @@ async function request(ctx, input) {
55
64
  // 多值参数(list_tasks 的 ids)是**逗号串**,不是重复的同名参数。
56
65
  Array.isArray(value) ? value.join(",") : value
57
66
  ]);
58
- const { data } = await http.request({
67
+ const { data } = await http.request(ctx, {
59
68
  path: input.path,
60
69
  method: input.method ?? "GET",
61
70
  query,
62
- headers: {
63
- accept: "application/json",
64
- authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`
65
- },
66
71
  ...hasBody ? { json: input.body } : {},
67
- invalidJsonMessage: "Todoist \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94",
68
- mapError: ({ data: data2, status }) => upstreamError(
69
- status,
70
- errorMessage(status, typeof data2 === "string" ? { message: data2 } : data2)
71
- )
72
+ invalidJsonMessage: "Todoist \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
72
73
  });
73
74
  return data ?? {};
74
75
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createProviderHttpClient
3
- } from "./chunk-6X55ALDX.js";
3
+ } from "./chunk-Q74GLIDK.js";
4
4
  import {
5
5
  asJsonObject,
6
6
  booleanValue,
@@ -11,12 +11,12 @@ import {
11
11
  createProviderPlugin,
12
12
  requireCredential,
13
13
  upstreamError
14
- } from "./chunk-6ANLYNFB.js";
15
- import "./chunk-3WL6EXYX.js";
14
+ } from "./chunk-QR4LK3HF.js";
15
+ import "./chunk-ZTTN6AJG.js";
16
16
  import {
17
17
  TBError,
18
18
  external_exports
19
- } from "./chunk-WIGQCP6O.js";
19
+ } from "./chunk-MZCIPUNQ.js";
20
20
  import "./chunk-U67V476Y.js";
21
21
 
22
22
  // ../plugins/src/trello/api.ts