@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,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
  trimmedText
@@ -9,14 +9,14 @@ import {
9
9
  createProviderPlugin,
10
10
  requireCredential,
11
11
  upstreamError
12
- } from "./chunk-6ANLYNFB.js";
12
+ } from "./chunk-QR4LK3HF.js";
13
13
  import {
14
14
  assertPublicHttpUrl
15
- } from "./chunk-3WL6EXYX.js";
15
+ } from "./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/ghost/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,14 +9,13 @@ 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/github/api/shared.ts
@@ -23,7 +23,6 @@ var SERVICE = "github";
23
23
  var API_BASE = "https://api.github.com";
24
24
  var API_VERSION = "2022-11-28";
25
25
  var USER_AGENT = "tool-bridge";
26
- var http = createProviderHttpClient({ baseUrl: `${API_BASE}/`, service: SERVICE });
27
26
  var text = trimmedText;
28
27
  var record = asJsonObject;
29
28
  function objectArray(value) {
@@ -68,14 +67,6 @@ function requireBranchOrTagRef(ref) {
68
67
  }
69
68
  return ref;
70
69
  }
71
- function headers(ctx) {
72
- return {
73
- "accept": "application/vnd.github+json",
74
- "authorization": `Bearer ${requireApiKey(ctx, SERVICE)}`,
75
- "x-github-api-version": API_VERSION,
76
- "user-agent": USER_AGENT
77
- };
78
- }
79
70
  function payloadOf(result) {
80
71
  if (result.bodyKind === "empty") return null;
81
72
  if (result.bodyKind === "json") return result.data;
@@ -108,25 +99,35 @@ function githubError(response, payload) {
108
99
  }
109
100
  return upstreamError(response.status, message);
110
101
  }
102
+ var http = createAuthedClient({
103
+ baseUrl: `${API_BASE}/`,
104
+ service: SERVICE,
105
+ auth: { kind: "bearer" },
106
+ headers: {
107
+ "accept": "application/vnd.github+json",
108
+ "x-github-api-version": API_VERSION,
109
+ "user-agent": USER_AGENT
110
+ },
111
+ // 403 双职分账 + 422 validation 摘要,整段覆写而不用标准键序提取。
112
+ mapError: (context) => githubError(
113
+ {
114
+ headers: context.headers,
115
+ ok: false,
116
+ status: context.status,
117
+ statusText: context.statusText
118
+ },
119
+ payloadOf(context)
120
+ )
121
+ });
111
122
  async function requestRaw(ctx, input) {
112
- const result = await http.request({
123
+ const result = await http.request(ctx, {
113
124
  method: input.method ?? "GET",
114
125
  path: input.path,
115
126
  query: Object.entries(input.query ?? {}),
116
- headers: headers(ctx),
117
127
  ...input.body === void 0 ? {} : { json: input.body },
118
128
  invalidJson: "text",
119
129
  // GitHub 有三个 action 用 404 表达 false;其他调用方仍在下面将它映射为错误。
120
- acceptStatuses: [404],
121
- mapError: (context) => githubError(
122
- {
123
- headers: context.headers,
124
- ok: false,
125
- status: context.status,
126
- statusText: context.statusText
127
- },
128
- payloadOf(context)
129
- )
130
+ acceptStatuses: [404]
130
131
  });
131
132
  return {
132
133
  payload: payloadOf(result),
@@ -1,25 +1,24 @@
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/gmail/api/shared.ts
20
20
  var SERVICE = "gmail";
21
21
  var API_BASE = "https://gmail.googleapis.com/gmail/v1";
22
- var http = createProviderHttpClient({ baseUrl: `${API_BASE}/`, service: SERVICE });
23
22
  var USER_ID = "me";
24
23
  var RATE_LIMIT_REASONS = /* @__PURE__ */ new Set([
25
24
  "dailyLimitExceeded",
@@ -100,22 +99,23 @@ function gmailError(status, payload) {
100
99
  }
101
100
  return upstreamError(status, message);
102
101
  }
102
+ var http = createAuthedClient({
103
+ baseUrl: `${API_BASE}/`,
104
+ service: SERVICE,
105
+ auth: { kind: "bearer" },
106
+ mapError: ({ bodyKind, data, status }) => gmailError(
107
+ status,
108
+ bodyKind === "json" ? data : null
109
+ )
110
+ });
103
111
  async function send(ctx, input) {
104
112
  const hasBody = input.body !== void 0;
105
- const headers = {
106
- authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`
107
- };
108
- const response = await http.request({
113
+ const response = await http.request(ctx, {
109
114
  method: input.method ?? "GET",
110
115
  path: buildPath(input.path),
111
116
  query: Object.entries(input.query ?? {}),
112
- headers,
113
117
  ...hasBody ? { json: input.body } : {},
114
- invalidJson: "text",
115
- mapError: ({ bodyKind, data, status }) => gmailError(
116
- status,
117
- bodyKind === "json" ? data : null
118
- )
118
+ invalidJson: "text"
119
119
  });
120
120
  if (response.bodyKind === "invalid-json") {
121
121
  throw new TBError("unavailable", "Gmail \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94", { retryable: true });
@@ -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,14 +9,13 @@ 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/googlecalendar/api/shared.ts
@@ -23,7 +23,6 @@ var SERVICE = "googlecalendar";
23
23
  var API_BASE = "https://www.googleapis.com/calendar/v3";
24
24
  var REQUEST_TIMEOUT_MS = 3e4;
25
25
  var GOOGLE_API_ORIGIN = new URL(API_BASE).origin;
26
- var http = createProviderHttpClient({ baseUrl: `${GOOGLE_API_ORIGIN}/`, service: SERVICE });
27
26
  var MAX_ERROR_MESSAGE_LENGTH = 500;
28
27
  var RATE_LIMIT_REASONS = /* @__PURE__ */ new Set([
29
28
  "rateLimitExceeded",
@@ -102,22 +101,25 @@ function calendarError(context, syncTokenAware) {
102
101
  }
103
102
  return upstreamError(context.status, message);
104
103
  }
104
+ var http = createAuthedClient({
105
+ baseUrl: `${GOOGLE_API_ORIGIN}/`,
106
+ service: SERVICE,
107
+ auth: { kind: "bearer" },
108
+ headers: { accept: "application/json" },
109
+ mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Google Calendar \u8BF7\u6C42\u8D85\u65F6(${REQUEST_TIMEOUT_MS / 1e3} \u79D2)`) : upstreamError(502, `Google Calendar \u8BF7\u6C42\u5931\u8D25:${message ?? "unknown network error"}`)
110
+ });
105
111
  async function send(ctx, input) {
106
112
  const hasBody = input.body !== void 0;
107
113
  const target = requestTarget(input.url, input.query);
108
- return await http.request({
114
+ return await http.request(ctx, {
109
115
  method: input.method ?? (hasBody ? "POST" : "GET"),
110
116
  path: target.path,
111
117
  query: target.query,
112
- headers: {
113
- accept: "application/json",
114
- authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`
115
- },
116
118
  ...hasBody ? { json: input.body } : {},
117
119
  invalidJson: "text",
118
120
  timeoutMs: REQUEST_TIMEOUT_MS,
119
- mapError: (context) => calendarError(context, input.syncTokenAware ?? false),
120
- mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Google Calendar \u8BF7\u6C42\u8D85\u65F6(${REQUEST_TIMEOUT_MS / 1e3} \u79D2)`) : upstreamError(502, `Google Calendar \u8BF7\u6C42\u5931\u8D25:${message ?? "unknown network error"}`)
121
+ // 410 syncToken 解读随每次请求走(见文件头第 2 条),故 mapError 只能逐请求给。
122
+ mapError: (context) => calendarError(context, input.syncTokenAware ?? false)
121
123
  });
122
124
  }
123
125
  async function requestJson(ctx, input) {
@@ -9,14 +9,14 @@ import {
9
9
  createProviderPlugin,
10
10
  requireApiKey,
11
11
  upstreamError
12
- } from "./chunk-6ANLYNFB.js";
12
+ } from "./chunk-QR4LK3HF.js";
13
13
  import {
14
14
  guardedFetch
15
- } from "./chunk-3WL6EXYX.js";
15
+ } from "./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/googledocs/api/shared.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
  booleanValue,
@@ -12,14 +13,14 @@ import {
12
13
  createProviderPlugin,
13
14
  requireApiKey,
14
15
  upstreamError
15
- } from "./chunk-6ANLYNFB.js";
16
+ } from "./chunk-QR4LK3HF.js";
16
17
  import {
17
18
  assertPublicHttpUrl
18
- } from "./chunk-3WL6EXYX.js";
19
+ } from "./chunk-ZTTN6AJG.js";
19
20
  import {
20
21
  TBError,
21
22
  external_exports
22
- } from "./chunk-WIGQCP6O.js";
23
+ } from "./chunk-MZCIPUNQ.js";
23
24
  import "./chunk-U67V476Y.js";
24
25
 
25
26
  // ../plugins/src/grafana/api.ts
@@ -33,7 +34,20 @@ var API_GROUPS = {
33
34
  folders: "folder.grafana.app"
34
35
  };
35
36
  var API_VERSION_CACHE_MAX = 256;
36
- var http = createProviderHttpClient({ service: SERVICE });
37
+ var http = createAuthedClient({
38
+ service: SERVICE,
39
+ auth: { kind: "bearer" },
40
+ headers: { accept: "application/json" },
41
+ // Grafana 的错误消息在 `message` / `error` / `detail` / `title` 之一,或整个体就是一段文本。
42
+ errorMessage: {
43
+ keys: ["message", "error", "detail", "title"],
44
+ fallback: (status, statusText) => trimmedText(statusText) ?? `Grafana request failed with ${status}`
45
+ },
46
+ mapTransportError: ({ message }) => upstreamError(
47
+ 502,
48
+ `Grafana request failed: ${message ?? "unknown network error"}`
49
+ )
50
+ });
37
51
  var apiVersionCache = /* @__PURE__ */ new Map();
38
52
  function requireText(value, field) {
39
53
  const result = trimmedText(value);
@@ -86,37 +100,22 @@ function resolveBaseUrl(ctx) {
86
100
  return `${url.origin}${url.pathname.replace(/\/+$/, "")}`;
87
101
  }
88
102
  function resolveTarget(ctx) {
89
- return { apiKey: requireApiKey(ctx, SERVICE), baseUrl: resolveBaseUrl(ctx) };
90
- }
91
- function errorMessage(payload, status, statusText) {
92
- const direct = trimmedText(payload);
93
- if (direct !== void 0) return direct;
94
- const fields = asJsonObject(payload);
95
- const message = trimmedText(fields?.message) ?? trimmedText(fields?.error) ?? trimmedText(fields?.detail) ?? trimmedText(fields?.title);
96
- return message ?? trimmedText(statusText) ?? `Grafana request failed with ${status}`;
103
+ requireApiKey(ctx, SERVICE);
104
+ return { baseUrl: resolveBaseUrl(ctx), ctx };
97
105
  }
98
106
  async function request(target, input) {
99
107
  const query = [
100
108
  ...Object.entries(input.query ?? {}),
101
109
  ...Object.entries(input.multiValueQuery ?? {})
102
110
  ];
103
- const result = await http.request({
111
+ const result = await http.request(target.ctx, {
104
112
  // 尾斜杠保住实例部署上下文路径(`/grafana`);薄层再强制 path 不得换 origin。
105
113
  baseUrl: `${target.baseUrl}/`,
106
114
  path: input.path,
107
115
  method: input.method,
108
116
  query,
109
- headers: { accept: "application/json", authorization: `Bearer ${target.apiKey}` },
110
117
  ...input.body === void 0 ? {} : { json: input.body },
111
- invalidJson: "text",
112
- mapError: ({ data, status, statusText }) => upstreamError(
113
- status,
114
- errorMessage(data, status, statusText)
115
- ),
116
- mapTransportError: ({ message }) => upstreamError(
117
- 502,
118
- `Grafana request failed: ${message ?? "unknown network error"}`
119
- )
118
+ invalidJson: "text"
120
119
  });
121
120
  return result.data === void 0 ? null : result.data;
122
121
  }
@@ -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
  } from "./chunk-JXHMDBAY.js";
@@ -8,12 +8,12 @@ import {
8
8
  createProviderPlugin,
9
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/graphhopper/api.ts
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import * as z from './v4/classic/external.cjs';
2
1
  import * as http from 'node:http';
3
2
  import { Sql } from 'postgres';
4
3
  import { Hono } from 'hono';
@@ -135,9 +134,14 @@ interface TBErrorBody {
135
134
  * 信任根不自举存储(spec-digest)。主密钥缺失/格式非法时能力禁用:Set 抛 unavailable。
136
135
  *
137
136
  * 纯逻辑,仅依赖 WebCrypto(core 无宿主依赖)。`crypto` / `TextEncoder` / `TextDecoder`
138
- * 在 Workers 与 Node 20+ 均为全局;此处以模块作用域最小声明补齐类型(不改 tsconfig、不污染全局)。
137
+ * 在 Workers 与 Node 20+ 均为全局;类型经 webGlobals.ts 统一承接(不改 tsconfig、不污染全局)。
139
138
  */
140
139
 
140
+ /** system/secret list 的一行(名字与时间戳,永不含值);CLI/Dashboard 经 SDK 消费同一命名。 */
141
+ interface SecretEntrySummary {
142
+ name: string;
143
+ updatedAt: Timestamp;
144
+ }
141
145
  /**
142
146
  * SecretStore 的纯逻辑实现。以注入的 StateStore 为后端。
143
147
  *
@@ -168,10 +172,7 @@ declare class SecretStoreImpl {
168
172
  * 枚举 secret 元数据。**绝不返回明文/密文**——只出 name + updatedAt(只进不出)。
169
173
  * limit 默认 50、上限 200 钳制。
170
174
  */
171
- list(opts?: ListOptions): Promise<Page<{
172
- name: string;
173
- updatedAt: Timestamp;
174
- }>>;
175
+ list(opts?: ListOptions): Promise<Page<SecretEntrySummary>>;
175
176
  /** 删除 secret;不存在 → not_found。 */
176
177
  delete(name: string): Promise<void>;
177
178
  /**
@@ -200,31 +201,26 @@ declare class SecretStoreImpl {
200
201
  * 的落点。
201
202
  */
202
203
 
203
- declare const pluginOAuthSchema: z.ZodObject<{
204
- authorizationUrl: z.ZodString;
205
- tokenUrl: z.ZodString;
206
- refreshUrl: z.ZodOptional<z.ZodString>;
207
- scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
208
- scopeSeparator: z.ZodOptional<z.ZodEnum<{
209
- " ": " ";
210
- ",": ",";
211
- }>>;
212
- clientAuth: z.ZodOptional<z.ZodEnum<{
213
- client_secret_basic: "client_secret_basic";
214
- client_secret_post: "client_secret_post";
215
- none: "none";
216
- }>>;
217
- authorizationParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
218
- responseEnvelope: z.ZodOptional<z.ZodString>;
219
- pkce: z.ZodOptional<z.ZodBoolean>;
220
- }, z.core.$strip>;
204
+ /** 令牌端点的客户端认证方式。 */
205
+ declare const OAUTH_CLIENT_AUTH_METHODS: readonly ["client_secret_basic", "client_secret_post", "none"];
206
+ type OAuthClientAuthMethod = (typeof OAUTH_CLIENT_AUTH_METHODS)[number];
221
207
  /**
222
208
  * provider 型 OAuth2 的声明。
223
209
  *
224
210
  * client_id / client_secret **不在这里** —— 它们是每个部署自己的应用凭证,走
225
211
  * `authRef` 指向的 secret(多字段:`clientId` + `clientSecret`),与其他上游凭证同一通道。
226
212
  */
227
- type PluginOAuth = z.infer<typeof pluginOAuthSchema>;
213
+ interface PluginOAuth {
214
+ authorizationParams?: Record<string, string>;
215
+ authorizationUrl: string;
216
+ clientAuth?: OAuthClientAuthMethod;
217
+ pkce?: boolean;
218
+ refreshUrl?: string;
219
+ responseEnvelope?: string;
220
+ scopes?: string[];
221
+ scopeSeparator?: ' ' | ',';
222
+ tokenUrl: string;
223
+ }
228
224
 
229
225
  /**
230
226
  * 注册时契约校验(plugin/v2)。
@@ -663,7 +659,12 @@ interface RuntimeRemoteSettings {
663
659
  maxHops: number;
664
660
  }
665
661
 
666
- type SearchCapability = 'search' | 'search:federated' | 'search:semantic';
662
+ /**
663
+ * pre-launch 收口:曾预留 'search:semantic' 全链路(wire/cursor/CLI/Dashboard 穿透)
664
+ * 但仓内从无任何 SearchIndex 声明或实现,唯一作用是被拒绝——已整链删除。
665
+ * 语义检索将来作为新 capability + 新 mode 一并落地,不留空档字段。
666
+ */
667
+ type SearchCapability = 'search' | 'search:federated';
667
668
  /** 全局工具搜索的完整结果;只在权限和可见性候选筛选后 hydrate。 */
668
669
  interface ToolSearchHit {
669
670
  path: TreePath;
@@ -691,7 +692,7 @@ interface ToolSearchOptions {
691
692
  limit?: number;
692
693
  matching?: ToolSearchMatching;
693
694
  minCoverage?: number;
694
- mode?: 'keyword' | 'semantic';
695
+ mode?: 'keyword';
695
696
  pathPrefix?: TreePath;
696
697
  }
697
698
  /** 会改变候选集合或分页档位的规范化约束;cursor 必须绑定其完整指纹。 */
@@ -704,7 +705,7 @@ interface NormalizedToolSearchOptions {
704
705
  /** 宿主提供的全局工具索引;权限和虚拟化仍由 gateway 处理。 */
705
706
  interface SearchIndex {
706
707
  readonly capabilities: readonly SearchCapability[];
707
- cursorFor(query: string, candidate: ToolSearchCandidate, mode?: 'keyword' | 'semantic'): Promise<string>;
708
+ cursorFor(query: string, candidate: ToolSearchCandidate, mode?: 'keyword'): Promise<string>;
708
709
  /** 联邦 continuation 的 topology binding;不实现的自定义 adapter 只能提供 local search。 */
709
710
  revision?(): Promise<number | string>;
710
711
  search(query: string, opts?: ToolSearchOptions): Promise<Page<ToolSearchCandidate>>;
@@ -830,9 +831,9 @@ interface SqlSearchDriver {
830
831
  write: (statements: readonly SqlSearchStatement[]) => Promise<void>;
831
832
  }
832
833
  declare class SqlSearchIndex implements MutableSearchIndex {
833
- protected readonly driver: SqlSearchDriver;
834
834
  readonly capabilities: readonly SearchCapability[];
835
835
  protected readonly dialect: SqlSearchDialect;
836
+ protected readonly driver: SqlSearchDriver;
836
837
  constructor(driver: SqlSearchDriver, dialect?: SqlSearchDialect);
837
838
  /** 容量 trigger 的 ABORT 在各驱动里错误形状不同,统一按标记串归一。 */
838
839
  private writeOrCapacity;
@@ -847,7 +848,7 @@ declare class SqlSearchIndex implements MutableSearchIndex {
847
848
  removePrefix(path: TreePath): Promise<void>;
848
849
  rebuild(documents: readonly ToolSearchDocument[]): Promise<void>;
849
850
  search(query: string, opts?: ToolSearchOptions): Promise<Page<ToolSearchCandidate>>;
850
- cursorFor(query: string, candidate: ToolSearchCandidate, mode?: 'keyword' | 'semantic'): Promise<string>;
851
+ cursorFor(query: string, candidate: ToolSearchCandidate, mode?: 'keyword'): Promise<string>;
851
852
  }
852
853
 
853
854
  /**
package/dist/index.js CHANGED
@@ -12,9 +12,9 @@ import {
12
12
  configFromEnv,
13
13
  createDataObjectStore,
14
14
  createTbServer
15
- } from "./chunk-RVUERWUZ.js";
16
- import "./chunk-3WL6EXYX.js";
17
- import "./chunk-WIGQCP6O.js";
15
+ } from "./chunk-MDY7K5CX.js";
16
+ import "./chunk-ZTTN6AJG.js";
17
+ import "./chunk-MZCIPUNQ.js";
18
18
  import "./chunk-U67V476Y.js";
19
19
  export {
20
20
  DEVICE_FORWARD_TIMEOUT_MS,
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  createProviderHttpClient
3
- } from "./chunk-6X55ALDX.js";
3
+ } from "./chunk-Q74GLIDK.js";
4
4
  import "./chunk-JXHMDBAY.js";
5
5
  import {
6
6
  createProviderPlugin,
7
7
  requireApiKey,
8
8
  upstreamError
9
- } from "./chunk-6ANLYNFB.js";
10
- import "./chunk-3WL6EXYX.js";
9
+ } from "./chunk-QR4LK3HF.js";
10
+ import "./chunk-ZTTN6AJG.js";
11
11
  import {
12
12
  TBError,
13
13
  external_exports
14
- } from "./chunk-WIGQCP6O.js";
14
+ } from "./chunk-MZCIPUNQ.js";
15
15
  import "./chunk-U67V476Y.js";
16
16
 
17
17
  // ../plugins/src/ip2proxy/schema.ts
@@ -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
  } from "./chunk-JXHMDBAY.js";
@@ -8,11 +8,11 @@ import {
8
8
  createProviderPlugin,
9
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
  external_exports
15
- } from "./chunk-WIGQCP6O.js";
15
+ } from "./chunk-MZCIPUNQ.js";
16
16
  import "./chunk-U67V476Y.js";
17
17
 
18
18
  // ../plugins/src/ipgeolocation_io/api.ts
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  createProviderHttpClient
3
- } from "./chunk-6X55ALDX.js";
3
+ } from "./chunk-Q74GLIDK.js";
4
4
  import "./chunk-JXHMDBAY.js";
5
5
  import {
6
6
  createProviderPlugin,
7
7
  requireApiKey,
8
8
  upstreamError
9
- } from "./chunk-6ANLYNFB.js";
10
- import "./chunk-3WL6EXYX.js";
9
+ } from "./chunk-QR4LK3HF.js";
10
+ import "./chunk-ZTTN6AJG.js";
11
11
  import {
12
12
  TBError,
13
13
  external_exports
14
- } from "./chunk-WIGQCP6O.js";
14
+ } from "./chunk-MZCIPUNQ.js";
15
15
  import "./chunk-U67V476Y.js";
16
16
 
17
17
  // ../plugins/src/ipqualityscore/api.ts
@@ -1,40 +1,39 @@
1
1
  import {
2
- createProviderHttpClient
3
- } from "./chunk-6X55ALDX.js";
4
- import {
5
- messageFrom
6
- } from "./chunk-JXHMDBAY.js";
2
+ createAuthedClient
3
+ } from "./chunk-JEWFX6Z6.js";
4
+ import "./chunk-Q74GLIDK.js";
5
+ import "./chunk-JXHMDBAY.js";
7
6
  import {
8
7
  createProviderPlugin,
9
- requireApiKey,
10
8
  upstreamError
11
- } from "./chunk-6ANLYNFB.js";
12
- import "./chunk-3WL6EXYX.js";
9
+ } from "./chunk-QR4LK3HF.js";
10
+ import "./chunk-ZTTN6AJG.js";
13
11
  import {
14
12
  external_exports
15
- } from "./chunk-WIGQCP6O.js";
13
+ } from "./chunk-MZCIPUNQ.js";
16
14
  import "./chunk-U67V476Y.js";
17
15
 
18
16
  // ../plugins/src/jina_ai/api.ts
19
17
  var SERVICE = "jina_ai";
20
18
  var REQUEST_TIMEOUT_MS = 3e4;
21
- var http = createProviderHttpClient({ baseUrl: "https://api.jina.ai/", service: SERVICE });
19
+ var http = createAuthedClient({
20
+ baseUrl: "https://api.jina.ai/",
21
+ service: SERVICE,
22
+ auth: { kind: "bearer" },
23
+ headers: { accept: "application/json" },
24
+ errorMessage: {
25
+ keys: ["detail", "message"],
26
+ fallback: (status) => `Jina AI request failed with ${status}`
27
+ },
28
+ mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Jina AI ${REQUEST_TIMEOUT_MS / 1e3}s \u5185\u6CA1\u6709\u8FD4\u56DE`) : upstreamError(502, `Jina AI \u8BF7\u6C42\u5931\u8D25: ${message ?? "unknown network error"}`)
29
+ });
22
30
  async function request(ctx, path, body) {
23
- const { data } = await http.request({
31
+ const { data } = await http.request(ctx, {
24
32
  path,
25
33
  method: "POST",
26
- headers: {
27
- accept: "application/json",
28
- authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`
29
- },
30
34
  json: body,
31
35
  timeoutMs: REQUEST_TIMEOUT_MS,
32
- invalidJsonMessage: "Jina AI \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94",
33
- mapError: ({ data: payload, status }) => upstreamError(
34
- status,
35
- messageFrom(payload, ["detail", "message"], `Jina AI request failed with ${status}`)
36
- ),
37
- mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Jina AI ${REQUEST_TIMEOUT_MS / 1e3}s \u5185\u6CA1\u6709\u8FD4\u56DE`) : upstreamError(502, `Jina AI \u8BF7\u6C42\u5931\u8D25: ${message ?? "unknown network error"}`)
36
+ invalidJsonMessage: "Jina AI \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
38
37
  });
39
38
  return data ?? null;
40
39
  }