@tool-bridge/server 0.21.1 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/admin.js +170 -0
  2. package/dist/airtable-ML2GIGCH.js +790 -0
  3. package/dist/{alt_text_generator_ai-W7O34SNG.js → alt_text_generator_ai-FGYQAF2A.js} +12 -11
  4. package/dist/{amap-VOX4T2AW.js → amap-G7V65NGK.js} +221 -220
  5. package/dist/anthropic-6ZK24TBB.js +203 -0
  6. package/dist/apify-VDGYHP6W.js +248 -0
  7. package/dist/brave_search-TAATLZOS.js +302 -0
  8. package/dist/chunk-2IAI3XQM.js +302 -0
  9. package/dist/chunk-7ISGFRC6.js +161 -0
  10. package/dist/{chunk-E6JCVKW6.js → chunk-BNMLA2RC.js} +3 -3
  11. package/dist/chunk-HA4BGL6C.js +8429 -0
  12. package/dist/{chunk-KMTT3I6D.js → chunk-RMAWSG7E.js} +19172 -25717
  13. package/dist/{chunk-XYBU3WZH.js → chunk-RTW5VRTK.js} +3 -3
  14. package/dist/chunk-U7PTOA3U.js +7320 -0
  15. package/dist/chunk-UY6ANCOY.js +378 -0
  16. package/dist/{chunk-ATK45BXV.js → chunk-X7ZUTKHR.js} +4 -2
  17. package/dist/circleci-BQ2UWXL2.js +389 -0
  18. package/dist/clerk-2JYWQNOI.js +1019 -0
  19. package/dist/cohere-6MI7AQM4.js +185 -0
  20. package/dist/{confluence-B3EWPZVE.js → confluence-6Y6GDETF.js} +105 -104
  21. package/dist/{convertapi-EUWSQYPF.js → convertapi-HBZCSWOX.js} +32 -31
  22. package/dist/{currencyapi-KVTIK3GL.js → currencyapi-337U5TGI.js} +71 -71
  23. package/dist/deepseek-OSPASO7O.js +210 -0
  24. package/dist/docker_hub-3ATQOY5L.js +933 -0
  25. package/dist/dropbox-LSA4GM2Y.js +1305 -0
  26. package/dist/dub-VZPJSPI6.js +680 -0
  27. package/dist/e2b-6SDYQZL2.js +278 -0
  28. package/dist/exa-B6EUYDVP.js +332 -0
  29. package/dist/{fal_ai-23E7JPNT.js → fal_ai-K4Q27IME.js} +81 -80
  30. package/dist/{feishu-7QRIDUV6.js → feishu-4TKXG4SU.js} +528 -572
  31. package/dist/{feishu_custom_bot-TJ4K7QNJ.js → feishu_custom_bot-7CTEAKRB.js} +57 -53
  32. package/dist/figma-OUKSZLD5.js +777 -0
  33. package/dist/firehydrant-7MOYL7QH.js +563 -0
  34. package/dist/{fixer-BWON27UO.js → fixer-H2BV2NO4.js} +34 -33
  35. package/dist/fly-PXKY6PNH.js +469 -0
  36. package/dist/{front-QCGXYEDJ.js → front-UZYIV5DW.js} +104 -104
  37. package/dist/geocodio-NSYO7TFP.js +213 -0
  38. package/dist/ghost-QBKKQQMF.js +338 -0
  39. package/dist/github-ENLSJ4CL.js +5421 -0
  40. package/dist/gmail-KQSDEB47.js +1887 -0
  41. package/dist/googlecalendar-5YCX4SZF.js +2524 -0
  42. package/dist/{googledocs-BUHL4J2H.js → googledocs-SSWIVFKA.js} +341 -340
  43. package/dist/{grafana-GLU2DWF2.js → grafana-TF2LXDQA.js} +221 -220
  44. package/dist/graphhopper-CURBVHYK.js +325 -0
  45. package/dist/index.d.ts +1132 -332
  46. package/dist/index.js +31 -14
  47. package/dist/{ip2proxy-EZ64Y4ZH.js → ip2proxy-YNVMTZEM.js} +28 -27
  48. package/dist/ipgeolocation_io-NAU7VJ4J.js +315 -0
  49. package/dist/ipqualityscore-OT63L4TI.js +279 -0
  50. package/dist/{jina_ai-EFBHTBXL.js → jina_ai-6WBMBGWM.js} +23 -23
  51. package/dist/{jira-HQSHAA5K.js → jira-DVDVTHNO.js} +118 -117
  52. package/dist/langsmith-IM5N4YAU.js +593 -0
  53. package/dist/lemlist-277SHUQF.js +289 -0
  54. package/dist/{linear-K7RYFYAD.js → linear-AEPH7B5V.js} +327 -326
  55. package/dist/logsnag-VEWRAGBG.js +150 -0
  56. package/dist/main.js +57 -280
  57. package/dist/{mattermost-S2BRCWLQ.js → mattermost-Q3A2BIZA.js} +59 -58
  58. package/dist/mem0-AXS7GZGI.js +544 -0
  59. package/dist/memos-7TXG4ZTU.js +744 -0
  60. package/dist/{metabase-MMSEPCOF.js → metabase-NSVACWQM.js} +90 -89
  61. package/dist/mistral_ai-YZ52RGD4.js +1196 -0
  62. package/dist/{mother_duck-H7PCQNZ2.js → mother_duck-XLLL6FVL.js} +94 -93
  63. package/dist/ngrok-4O4W3WZW.js +356 -0
  64. package/dist/{notes-PFMKRO33.js → notes-YTB3TJOO.js} +11 -9
  65. package/dist/notion-4W4O7J7V.js +940 -0
  66. package/dist/open_exchange_rates-23QJXVO5.js +215 -0
  67. package/dist/openai-ZS7GLSLH.js +800 -0
  68. package/dist/opengraph_io-PMVH7OYI.js +362 -0
  69. package/dist/openrouter-ONRGFNB6.js +441 -0
  70. package/dist/outline-UCUYZZ7J.js +599 -0
  71. package/dist/paddle-35HTKTUL.js +454 -0
  72. package/dist/perplexity-NVOBYN24.js +220 -0
  73. package/dist/pinecone-55CJY73C.js +571 -0
  74. package/dist/{pipedrive-Y2O7QGFF.js → pipedrive-WMCAKS72.js} +99 -98
  75. package/dist/polar-SM4ZM53B.js +395 -0
  76. package/dist/posthog-NWCXVXNJ.js +3464 -0
  77. package/dist/postmark-QJV5PHUQ.js +427 -0
  78. package/dist/{prerender-MENYM2TY.js → prerender-2W7UT4SC.js} +31 -30
  79. package/dist/{pubmed-GOXUVVH5.js → pubmed-VVV7XYLU.js} +239 -238
  80. package/dist/{railway-V2SID4WV.js → railway-KGI57S3O.js} +118 -117
  81. package/dist/readwise-AGHTQB42.js +470 -0
  82. package/dist/render-O4HBROCK.js +461 -0
  83. package/dist/{replicate-756MXPYX.js → replicate-KWBOMX7D.js} +81 -80
  84. package/dist/{resend-ZKH3BTBI.js → resend-DRH6Y6I4.js} +20 -16
  85. package/dist/rootly-XGCUDW6X.js +336 -0
  86. package/dist/{scrapfly-NSRHFDIQ.js → scrapfly-OIQ3OY6L.js} +62 -61
  87. package/dist/{scrapingbee-OQHLAVEY.js → scrapingbee-OCZO4FHX.js} +56 -56
  88. package/dist/{screenshot_fyi-DVWG3AXC.js → screenshot_fyi-CUNGFZOC.js} +16 -16
  89. package/dist/semantic_scholar-3UJRLKES.js +611 -0
  90. package/dist/{sentry-546MNDJG.js → sentry-5BWVZFJV.js} +208 -207
  91. package/dist/{shodan-C3OON3Z3.js → shodan-HI37CTEW.js} +62 -61
  92. package/dist/shopify-LJ2EV2HH.js +610 -0
  93. package/dist/stripe-3LHMV55K.js +585 -0
  94. package/dist/{supabase-U2SL4D63.js → supabase-H2KPX3Q2.js} +245 -244
  95. package/dist/tavily-FBEWGH3Z.js +326 -0
  96. package/dist/telegram-MYYO3JND.js +1767 -0
  97. package/dist/{telnyx-CXQ4EZUX.js → telnyx-H4ALEGAX.js} +57 -56
  98. package/dist/todoist-OBWICA5Q.js +664 -0
  99. package/dist/trello-GUFUJRWO.js +1080 -0
  100. package/dist/turso-NIAK4UMS.js +416 -0
  101. package/dist/{twilio-4PDBJKWX.js → twilio-K6SLK2CX.js} +70 -69
  102. package/dist/umami-42RS2EPS.js +389 -0
  103. package/dist/unsplash-V7TOTETT.js +351 -0
  104. package/dist/{upstash_redis-G4LQBYHA.js → upstash_redis-AWQMB6Y3.js} +51 -50
  105. package/dist/uptimerobot-AZC2DHOT.js +483 -0
  106. package/dist/v2ex-4TVRNMLS.js +667 -0
  107. package/dist/vercel-DPHTJ3XR.js +1076 -0
  108. package/dist/{wolfram_alpha_api-3G4PUJWB.js → wolfram_alpha_api-XAG7IXBW.js} +36 -35
  109. package/dist/wordpress-KMPKVGUX.js +812 -0
  110. package/dist/workos-PKB2YR7S.js +664 -0
  111. package/dist/zhihu-Y4H4XYPB.js +254 -0
  112. package/package.json +18 -9
  113. package/dist/airtable-LLZDFN7M.js +0 -789
  114. package/dist/anthropic-G23NN3X5.js +0 -202
  115. package/dist/apify-Y3SS734K.js +0 -247
  116. package/dist/brave_search-ZC7OAPSZ.js +0 -301
  117. package/dist/chunk-R6P4XAE5.js +0 -248
  118. package/dist/chunk-U7B6DS2O.js +0 -977
  119. package/dist/chunk-UZM2RXZH.js +0 -23436
  120. package/dist/circleci-3BAX5FCG.js +0 -388
  121. package/dist/clerk-6LEM6TNU.js +0 -1019
  122. package/dist/cloudflare_dns-KINYTJUD.js +0 -588
  123. package/dist/cohere-XCJ5AJ6B.js +0 -185
  124. package/dist/deepseek-PC5YGNC5.js +0 -209
  125. package/dist/docker_hub-C3MA5FU6.js +0 -932
  126. package/dist/dropbox-XBV7Z2IR.js +0 -1304
  127. package/dist/dub-LDOFG3HC.js +0 -679
  128. package/dist/e2b-JMCPSVBW.js +0 -277
  129. package/dist/exa-RAK7O7RD.js +0 -331
  130. package/dist/figma-E6IX5DTH.js +0 -773
  131. package/dist/firehydrant-ZBLPQREE.js +0 -562
  132. package/dist/fly-ZH3HFCZJ.js +0 -468
  133. package/dist/geocodio-YGNI7DA4.js +0 -212
  134. package/dist/ghost-EVSGKH2Q.js +0 -337
  135. package/dist/github-MA2BGRCJ.js +0 -5420
  136. package/dist/gmail-E5E6AADE.js +0 -1886
  137. package/dist/googlecalendar-BTLFPXTD.js +0 -2523
  138. package/dist/graphhopper-WSMB3TCD.js +0 -324
  139. package/dist/ipgeolocation_io-AA7HAS22.js +0 -315
  140. package/dist/ipqualityscore-BHJXVTJT.js +0 -277
  141. package/dist/langsmith-5W6SCT6F.js +0 -592
  142. package/dist/lemlist-HJWH6UMK.js +0 -288
  143. package/dist/logsnag-4KFOHL37.js +0 -150
  144. package/dist/mem0-CAW43CIC.js +0 -543
  145. package/dist/memos-TWEGPKFM.js +0 -740
  146. package/dist/mistral_ai-64BGZQHP.js +0 -1195
  147. package/dist/ngrok-GQCUGZKJ.js +0 -356
  148. package/dist/notion-DQWZWP4N.js +0 -936
  149. package/dist/open_exchange_rates-QMMD735E.js +0 -214
  150. package/dist/openai-W6PX32NZ.js +0 -799
  151. package/dist/opengraph_io-HNDBXYNW.js +0 -361
  152. package/dist/openrouter-JJYMEAUL.js +0 -437
  153. package/dist/outline-MCBNQZYY.js +0 -595
  154. package/dist/paddle-D2SKLUDN.js +0 -453
  155. package/dist/perplexity-XIFMKUAE.js +0 -219
  156. package/dist/pinecone-HUFTALV2.js +0 -570
  157. package/dist/polar-TYTOMOSR.js +0 -394
  158. package/dist/posthog-43JAR3VW.js +0 -3463
  159. package/dist/postmark-KL2QJYSG.js +0 -426
  160. package/dist/readwise-CI4GIMMJ.js +0 -469
  161. package/dist/render-SUBJ6YRZ.js +0 -460
  162. package/dist/rootly-CD2LJHPI.js +0 -336
  163. package/dist/semantic_scholar-T4A252KW.js +0 -610
  164. package/dist/shopify-Y2HN2MCQ.js +0 -609
  165. package/dist/stripe-VE3CD3AY.js +0 -584
  166. package/dist/tavily-KCZHK6HE.js +0 -326
  167. package/dist/telegram-3URFBCMY.js +0 -1766
  168. package/dist/todoist-HNPWNYTD.js +0 -663
  169. package/dist/trello-3W2MIXRP.js +0 -1079
  170. package/dist/turso-2EQF7C2Z.js +0 -415
  171. package/dist/umami-5REN7TGP.js +0 -388
  172. package/dist/unsplash-EIXL424F.js +0 -350
  173. package/dist/uptimerobot-KNJ3EYLY.js +0 -482
  174. package/dist/v2ex-RHJ234PZ.js +0 -666
  175. package/dist/vercel-AS6NCIC7.js +0 -1075
  176. package/dist/wordpress-KNDAAUV7.js +0 -811
  177. package/dist/workos-R6UITSJ7.js +0 -663
  178. package/dist/zhihu-AGK4HILK.js +0 -253
@@ -1,592 +0,0 @@
1
- import {
2
- createAuthedClient
3
- } from "./chunk-XYBU3WZH.js";
4
- import "./chunk-E6JCVKW6.js";
5
- import {
6
- asJsonObject,
7
- compactDefined,
8
- finiteNumber,
9
- integerValue,
10
- trimmedText
11
- } from "./chunk-JXHMDBAY.js";
12
- import {
13
- createProviderPlugin,
14
- requireApiKey,
15
- upstreamError
16
- } from "./chunk-ATK45BXV.js";
17
- import "./chunk-U7B6DS2O.js";
18
- import {
19
- TBError,
20
- external_exports
21
- } from "./chunk-UZM2RXZH.js";
22
- import "./chunk-U67V476Y.js";
23
-
24
- // ../plugins/src/langsmith/api.ts
25
- var SERVICE = "langsmith";
26
- var WORKSPACES_PATH = "/api/v1/workspaces";
27
- var DEFAULT_REGION = "us";
28
- var http = createAuthedClient({
29
- service: SERVICE,
30
- auth: { kind: "header", name: "X-Api-Key" },
31
- headers: { accept: "application/json" },
32
- // 错误消息四处之一;拿不到就退回状态行。
33
- errorMessage: {
34
- keys: ["detail", "message", "error", "title"],
35
- fallback: (status, statusText) => trimmedText(statusText) ?? `langsmith \u8FD4\u56DE HTTP ${status}`
36
- },
37
- mapTransportError: ({ message }) => upstreamError(
38
- 502,
39
- `langsmith \u8BF7\u6C42\u5931\u8D25: ${message ?? "\u672A\u77E5\u9519\u8BEF"}`
40
- )
41
- });
42
- var REGION_BASE_URLS = {
43
- us: "https://api.smith.langchain.com",
44
- eu: "https://eu.api.smith.langchain.com",
45
- apac: "https://apac.api.smith.langchain.com",
46
- aws_us: "https://aws.api.smith.langchain.com"
47
- };
48
- function configError(message) {
49
- return new TBError("invalid_argument", `${SERVICE} \u7684 ${message}`);
50
- }
51
- function resolveApiBase(ctx) {
52
- const configured = ctx.config?.region;
53
- if (configured !== void 0 && typeof configured !== "string") throw configError("region \u5FC5\u987B\u662F\u5B57\u7B26\u4E32");
54
- const raw = trimmedText(configured) ?? DEFAULT_REGION;
55
- const region = raw === "aws" ? "aws_us" : raw;
56
- const base = REGION_BASE_URLS[region];
57
- if (base === void 0) throw configError("region \u5FC5\u987B\u662F us\u3001eu\u3001apac \u6216 aws_us \u4E4B\u4E00");
58
- return base;
59
- }
60
- function resolveWorkspaceId(ctx) {
61
- const configured = ctx.config?.workspaceId;
62
- if (configured !== void 0 && typeof configured !== "string") throw configError("workspaceId \u5FC5\u987B\u662F\u5B57\u7B26\u4E32");
63
- return trimmedText(configured);
64
- }
65
- function queryPairs(query) {
66
- return Object.entries(query ?? {}).flatMap(([key, value]) => {
67
- if (value === void 0 || value === null) return [];
68
- return Array.isArray(value) ? value.flatMap((item) => item === void 0 || item === null ? [] : [[key, String(item)]]) : [[key, String(value)]];
69
- });
70
- }
71
- async function request(ctx, input) {
72
- requireApiKey(ctx, SERVICE);
73
- const workspaceId = resolveWorkspaceId(ctx);
74
- const result = await http.request(ctx, {
75
- baseUrl: resolveApiBase(ctx),
76
- path: input.path,
77
- method: input.method ?? "GET",
78
- query: queryPairs(input.query),
79
- // 一个 API key 能看到多个 workspace 时,靠 `X-Tenant-Id` 指定用哪个。
80
- ...workspaceId === void 0 ? {} : { headers: { "X-Tenant-Id": workspaceId } },
81
- ...input.body === void 0 ? {} : { json: input.body },
82
- invalidJson: "text"
83
- });
84
- return result.data === void 0 ? null : result.data;
85
- }
86
- function ensureObject(value, label) {
87
- const result = asJsonObject(value);
88
- if (result === void 0) {
89
- throw new TBError("unavailable", `${label} response is not an object`, { retryable: true });
90
- }
91
- return result;
92
- }
93
- function ensureObjectArray(value, label) {
94
- if (!Array.isArray(value)) {
95
- throw new TBError("unavailable", `${label} response is not an array`, { retryable: true });
96
- }
97
- return value.map((item) => ensureObject(item, label));
98
- }
99
- function requirePathId(value, field) {
100
- const id = trimmedText(value);
101
- if (id === void 0) throw new TBError("invalid_argument", `${field} \u4E0D\u80FD\u4E3A\u7A7A`);
102
- return encodeURIComponent(id);
103
- }
104
- function normalizeWorkspace(value) {
105
- return {
106
- id: String(value.id ?? ""),
107
- organization_id: trimmedText(value.organization_id) ?? null,
108
- display_name: trimmedText(value.display_name) ?? "",
109
- is_personal: value.is_personal === true,
110
- is_deleted: value.is_deleted === true,
111
- tenant_handle: trimmedText(value.tenant_handle) ?? null,
112
- data_plane_url: trimmedText(value.data_plane_url) ?? null,
113
- // 裁剪后的字段是稳定契约,`raw` 是逃生阀:上游加了新字段也不必等我们改代码。
114
- raw: value
115
- };
116
- }
117
- function normalizeProject(value) {
118
- return {
119
- id: String(value.id ?? ""),
120
- tenant_id: String(value.tenant_id ?? ""),
121
- name: trimmedText(value.name) ?? null,
122
- description: trimmedText(value.description) ?? null,
123
- start_time: trimmedText(value.start_time) ?? null,
124
- end_time: trimmedText(value.end_time) ?? null,
125
- run_count: integerValue(value.run_count) ?? null,
126
- error_rate: finiteNumber(value.error_rate) ?? null,
127
- default_dataset_id: trimmedText(value.default_dataset_id) ?? null,
128
- reference_dataset_id: trimmedText(value.reference_dataset_id) ?? null,
129
- raw: value
130
- };
131
- }
132
- function nullableObject(value) {
133
- if (value === null || value === void 0) return null;
134
- return asJsonObject(value) ?? {};
135
- }
136
- function normalizeDataset(value) {
137
- return {
138
- id: String(value.id ?? ""),
139
- tenant_id: String(value.tenant_id ?? ""),
140
- name: trimmedText(value.name) ?? "",
141
- description: trimmedText(value.description) ?? null,
142
- data_type: trimmedText(value.data_type) ?? null,
143
- created_at: trimmedText(value.created_at) ?? null,
144
- modified_at: trimmedText(value.modified_at) ?? null,
145
- example_count: integerValue(value.example_count) ?? null,
146
- session_count: integerValue(value.session_count) ?? null,
147
- metadata: nullableObject(value.metadata),
148
- raw: value
149
- };
150
- }
151
- function normalizeExample(value) {
152
- return {
153
- id: String(value.id ?? ""),
154
- dataset_id: String(value.dataset_id ?? ""),
155
- name: trimmedText(value.name) ?? null,
156
- created_at: trimmedText(value.created_at) ?? null,
157
- modified_at: trimmedText(value.modified_at) ?? null,
158
- inputs: asJsonObject(value.inputs) ?? {},
159
- outputs: nullableObject(value.outputs),
160
- metadata: nullableObject(value.metadata),
161
- raw: value
162
- };
163
- }
164
- async function listWorkspaces(input, ctx) {
165
- const payload = await request(ctx, {
166
- path: WORKSPACES_PATH,
167
- query: compactDefined({ include_deleted: input.include_deleted, data_plane_id: trimmedText(input.data_plane_id) })
168
- });
169
- return { workspaces: ensureObjectArray(payload, "LangSmith workspace list").map(normalizeWorkspace) };
170
- }
171
- async function listProjects(input, ctx) {
172
- const payload = await request(ctx, {
173
- path: "/api/v1/sessions",
174
- query: compactDefined({
175
- name: trimmedText(input.name),
176
- name_contains: trimmedText(input.name_contains),
177
- include_stats: input.include_stats,
178
- sort_by_desc: input.sort_by_desc,
179
- offset: input.offset,
180
- limit: input.limit
181
- })
182
- });
183
- return { projects: ensureObjectArray(payload, "LangSmith project list").map(normalizeProject) };
184
- }
185
- async function getProject(input, ctx) {
186
- const payload = await request(ctx, {
187
- path: `/api/v1/sessions/${requirePathId(input.projectId, "projectId")}`,
188
- query: compactDefined({ include_stats: input.include_stats })
189
- });
190
- return { project: normalizeProject(ensureObject(payload, "LangSmith project")) };
191
- }
192
- async function createProject(input, ctx) {
193
- const payload = await request(ctx, {
194
- method: "POST",
195
- path: "/api/v1/sessions",
196
- // upsert 是 query 参数而不是 body 字段 —— 放进 body 会被忽略,同名项目直接 409。
197
- query: compactDefined({ upsert: input.upsert }),
198
- body: compactDefined({
199
- name: trimmedText(input.name),
200
- description: trimmedText(input.description),
201
- start_time: trimmedText(input.start_time),
202
- end_time: trimmedText(input.end_time),
203
- extra: input.extra,
204
- default_dataset_id: trimmedText(input.default_dataset_id),
205
- reference_dataset_id: trimmedText(input.reference_dataset_id)
206
- })
207
- });
208
- return { project: normalizeProject(ensureObject(payload, "LangSmith created project")) };
209
- }
210
- async function listDatasets(input, ctx) {
211
- const payload = await request(ctx, {
212
- path: "/api/v1/datasets",
213
- query: compactDefined({
214
- name: trimmedText(input.name),
215
- name_contains: trimmedText(input.name_contains),
216
- data_type: trimmedText(input.data_type),
217
- offset: input.offset,
218
- limit: input.limit
219
- })
220
- });
221
- return { datasets: ensureObjectArray(payload, "LangSmith dataset list").map(normalizeDataset) };
222
- }
223
- async function getDataset(input, ctx) {
224
- const payload = await request(ctx, { path: `/api/v1/datasets/${requirePathId(input.datasetId, "datasetId")}` });
225
- return { dataset: normalizeDataset(ensureObject(payload, "LangSmith dataset")) };
226
- }
227
- async function createDataset(input, ctx) {
228
- const payload = await request(ctx, {
229
- method: "POST",
230
- path: "/api/v1/datasets",
231
- body: compactDefined({
232
- name: trimmedText(input.name),
233
- description: trimmedText(input.description),
234
- data_type: trimmedText(input.data_type),
235
- inputs_schema_definition: input.inputs_schema_definition,
236
- outputs_schema_definition: input.outputs_schema_definition,
237
- metadata: input.metadata,
238
- externally_managed: input.externally_managed
239
- })
240
- });
241
- return { dataset: normalizeDataset(ensureObject(payload, "LangSmith created dataset")) };
242
- }
243
- async function listExamples(input, ctx) {
244
- const payload = await request(ctx, {
245
- path: "/api/v1/examples",
246
- query: compactDefined({
247
- // 线上参数名是 `dataset`,不是入参里的 `datasetId`。
248
- dataset: trimmedText(input.datasetId),
249
- full_text_contains: input.full_text_contains,
250
- as_of: trimmedText(input.as_of),
251
- offset: input.offset,
252
- limit: input.limit
253
- })
254
- });
255
- return { examples: ensureObjectArray(payload, "LangSmith example list").map(normalizeExample) };
256
- }
257
- async function getExample(input, ctx) {
258
- const payload = await request(ctx, {
259
- path: `/api/v1/examples/${requirePathId(input.exampleId, "exampleId")}`,
260
- query: compactDefined({ dataset: trimmedText(input.datasetId), as_of: trimmedText(input.as_of) })
261
- });
262
- return { example: normalizeExample(ensureObject(payload, "LangSmith example")) };
263
- }
264
- async function createExample(input, ctx) {
265
- const payload = await request(ctx, {
266
- method: "POST",
267
- path: "/api/v1/examples",
268
- body: compactDefined({
269
- // 建例子时又叫 `dataset_id`(与 list/get 的 `dataset` 不是一个名字)。
270
- dataset_id: trimmedText(input.datasetId),
271
- inputs: input.inputs,
272
- outputs: input.outputs,
273
- metadata: input.metadata,
274
- split: input.split,
275
- id: trimmedText(input.id),
276
- created_at: trimmedText(input.created_at)
277
- })
278
- });
279
- return { example: normalizeExample(ensureObject(payload, "LangSmith created example")) };
280
- }
281
-
282
- // ../plugins/src/langsmith/schema.ts
283
- var listWorkspacesInput = external_exports.strictObject({
284
- include_deleted: external_exports.boolean().describe("Whether to include deleted workspaces in the response.").optional(),
285
- data_plane_id: external_exports.uuid().describe("The LangSmith UUID.").optional()
286
- }).describe("Input parameters for listing LangSmith workspaces.");
287
- var listWorkspacesOutput = external_exports.strictObject({
288
- workspaces: external_exports.array(external_exports.strictObject({
289
- id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
290
- organization_id: external_exports.uuid().describe("The organization ID that owns the workspace.").nullable().optional(),
291
- display_name: external_exports.string().describe("The workspace display name.").optional(),
292
- is_personal: external_exports.boolean().describe("Whether this is a personal workspace.").optional(),
293
- is_deleted: external_exports.boolean().describe("Whether LangSmith marks the workspace as deleted.").optional(),
294
- tenant_handle: external_exports.string().describe("The workspace handle when returned.").nullable().optional(),
295
- data_plane_url: external_exports.string().describe("The workspace data-plane URL when returned.").nullable().optional(),
296
- raw: external_exports.looseObject({}).describe("The raw workspace object returned by LangSmith.").optional()
297
- }).describe("A LangSmith workspace visible to the API key.")).describe("The workspaces returned by LangSmith.").optional()
298
- }).describe("The response returned when listing LangSmith workspaces.");
299
- var listProjectsInput = external_exports.strictObject({
300
- name: external_exports.string().min(1).describe("A non-empty project name.").optional(),
301
- name_contains: external_exports.string().min(1).describe("A non-empty project name fragment.").optional(),
302
- include_stats: external_exports.boolean().describe("Whether LangSmith should include project statistics.").optional(),
303
- sort_by_desc: external_exports.boolean().describe("Whether LangSmith should sort descending.").optional(),
304
- offset: external_exports.int().min(0).describe("The number of records to skip.").optional(),
305
- limit: external_exports.int().min(1).max(100).describe("The maximum number of records to return.").optional()
306
- }).describe("Input parameters for listing LangSmith projects.");
307
- var listProjectsOutput = external_exports.strictObject({
308
- projects: external_exports.array(external_exports.strictObject({
309
- id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
310
- tenant_id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
311
- name: external_exports.string().describe("The project name when returned.").nullable().optional(),
312
- description: external_exports.string().describe("The project description when returned.").nullable().optional(),
313
- start_time: external_exports.string().describe("The project start timestamp when returned.").nullable().optional(),
314
- end_time: external_exports.string().describe("The project end timestamp when returned.").nullable().optional(),
315
- run_count: external_exports.int().describe("The number of runs in the project when returned.").nullable().optional(),
316
- error_rate: external_exports.number().describe("The project error rate when returned.").nullable().optional(),
317
- default_dataset_id: external_exports.uuid().describe("The default dataset ID when returned.").nullable().optional(),
318
- reference_dataset_id: external_exports.uuid().describe("The reference dataset ID when returned.").nullable().optional(),
319
- raw: external_exports.looseObject({}).describe("The raw project object returned by LangSmith.").optional()
320
- }).describe("A LangSmith tracing project.")).describe("The projects returned by LangSmith.").optional()
321
- }).describe("The response returned when listing LangSmith projects.");
322
- var getProjectInput = external_exports.strictObject({
323
- projectId: external_exports.uuid().describe("The LangSmith UUID."),
324
- include_stats: external_exports.boolean().describe("Whether LangSmith should include project statistics.").optional()
325
- }).describe("Input parameters for getting a LangSmith project.");
326
- var getProjectOutput = external_exports.strictObject({
327
- project: external_exports.strictObject({
328
- id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
329
- tenant_id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
330
- name: external_exports.string().describe("The project name when returned.").nullable().optional(),
331
- description: external_exports.string().describe("The project description when returned.").nullable().optional(),
332
- start_time: external_exports.string().describe("The project start timestamp when returned.").nullable().optional(),
333
- end_time: external_exports.string().describe("The project end timestamp when returned.").nullable().optional(),
334
- run_count: external_exports.int().describe("The number of runs in the project when returned.").nullable().optional(),
335
- error_rate: external_exports.number().describe("The project error rate when returned.").nullable().optional(),
336
- default_dataset_id: external_exports.uuid().describe("The default dataset ID when returned.").nullable().optional(),
337
- reference_dataset_id: external_exports.uuid().describe("The reference dataset ID when returned.").nullable().optional(),
338
- raw: external_exports.looseObject({}).describe("The raw project object returned by LangSmith.").optional()
339
- }).describe("A LangSmith tracing project.").optional()
340
- }).describe("The response returned when getting a LangSmith project.");
341
- var createProjectInput = external_exports.strictObject({
342
- name: external_exports.string().min(1).describe("The project name."),
343
- description: external_exports.string().describe("The project description.").optional(),
344
- start_time: external_exports.string().describe("The project start timestamp.").optional(),
345
- end_time: external_exports.string().describe("The project end timestamp.").optional(),
346
- extra: external_exports.looseObject({}).describe("A JSON object forwarded to or returned by LangSmith.").optional(),
347
- default_dataset_id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
348
- reference_dataset_id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
349
- upsert: external_exports.boolean().describe("Whether LangSmith should upsert a project with the same name.").optional()
350
- }).describe("Input parameters for creating a LangSmith project.");
351
- var createProjectOutput = external_exports.strictObject({
352
- project: external_exports.strictObject({
353
- id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
354
- tenant_id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
355
- name: external_exports.string().describe("The project name when returned.").nullable().optional(),
356
- description: external_exports.string().describe("The project description when returned.").nullable().optional(),
357
- start_time: external_exports.string().describe("The project start timestamp when returned.").nullable().optional(),
358
- end_time: external_exports.string().describe("The project end timestamp when returned.").nullable().optional(),
359
- run_count: external_exports.int().describe("The number of runs in the project when returned.").nullable().optional(),
360
- error_rate: external_exports.number().describe("The project error rate when returned.").nullable().optional(),
361
- default_dataset_id: external_exports.uuid().describe("The default dataset ID when returned.").nullable().optional(),
362
- reference_dataset_id: external_exports.uuid().describe("The reference dataset ID when returned.").nullable().optional(),
363
- raw: external_exports.looseObject({}).describe("The raw project object returned by LangSmith.").optional()
364
- }).describe("A LangSmith tracing project.").optional()
365
- }).describe("The response returned when creating a LangSmith project.");
366
- var listDatasetsInput = external_exports.strictObject({
367
- name: external_exports.string().min(1).describe("A non-empty dataset name.").optional(),
368
- name_contains: external_exports.string().min(1).describe("A non-empty dataset name fragment.").optional(),
369
- data_type: external_exports.enum(["kv", "llm", "chat"]).describe("The LangSmith dataset data type.").optional(),
370
- offset: external_exports.int().min(0).describe("The number of records to skip.").optional(),
371
- limit: external_exports.int().min(1).max(100).describe("The maximum number of records to return.").optional()
372
- }).describe("Input parameters for listing LangSmith datasets.");
373
- var listDatasetsOutput = external_exports.strictObject({
374
- datasets: external_exports.array(external_exports.strictObject({
375
- id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
376
- tenant_id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
377
- name: external_exports.string().describe("The dataset name.").optional(),
378
- description: external_exports.string().describe("The dataset description when returned.").nullable().optional(),
379
- data_type: external_exports.enum(["kv", "llm", "chat"]).describe("The LangSmith dataset data type.").nullable().optional(),
380
- created_at: external_exports.string().describe("The dataset creation timestamp when returned.").nullable().optional(),
381
- modified_at: external_exports.string().describe("The dataset modification timestamp when returned.").nullable().optional(),
382
- example_count: external_exports.int().describe("The dataset example count when returned.").nullable().optional(),
383
- session_count: external_exports.int().describe("The dataset experiment session count when returned.").nullable().optional(),
384
- metadata: external_exports.looseObject({}).describe("Provider-defined metadata forwarded to LangSmith.").nullable().optional(),
385
- raw: external_exports.looseObject({}).describe("The raw dataset object returned by LangSmith.").optional()
386
- }).describe("A LangSmith dataset.")).describe("The datasets returned by LangSmith.").optional()
387
- }).describe("The response returned when listing LangSmith datasets.");
388
- var getDatasetInput = external_exports.strictObject({
389
- datasetId: external_exports.uuid().describe("The LangSmith UUID.").optional()
390
- }).describe("Input parameters for getting a LangSmith dataset.");
391
- var getDatasetOutput = external_exports.strictObject({
392
- dataset: external_exports.strictObject({
393
- id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
394
- tenant_id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
395
- name: external_exports.string().describe("The dataset name.").optional(),
396
- description: external_exports.string().describe("The dataset description when returned.").nullable().optional(),
397
- data_type: external_exports.enum(["kv", "llm", "chat"]).describe("The LangSmith dataset data type.").nullable().optional(),
398
- created_at: external_exports.string().describe("The dataset creation timestamp when returned.").nullable().optional(),
399
- modified_at: external_exports.string().describe("The dataset modification timestamp when returned.").nullable().optional(),
400
- example_count: external_exports.int().describe("The dataset example count when returned.").nullable().optional(),
401
- session_count: external_exports.int().describe("The dataset experiment session count when returned.").nullable().optional(),
402
- metadata: external_exports.looseObject({}).describe("Provider-defined metadata forwarded to LangSmith.").nullable().optional(),
403
- raw: external_exports.looseObject({}).describe("The raw dataset object returned by LangSmith.").optional()
404
- }).describe("A LangSmith dataset.").optional()
405
- }).describe("The response returned when getting a LangSmith dataset.");
406
- var createDatasetInput = external_exports.strictObject({
407
- name: external_exports.string().min(1).describe("The dataset name."),
408
- description: external_exports.string().describe("The dataset description.").optional(),
409
- data_type: external_exports.enum(["kv", "llm", "chat"]).describe("The LangSmith dataset data type.").optional(),
410
- inputs_schema_definition: external_exports.looseObject({}).describe("A JSON object forwarded to or returned by LangSmith.").optional(),
411
- outputs_schema_definition: external_exports.looseObject({}).describe("A JSON object forwarded to or returned by LangSmith.").optional(),
412
- metadata: external_exports.looseObject({}).describe("Provider-defined metadata forwarded to LangSmith.").optional(),
413
- externally_managed: external_exports.boolean().describe("Whether the dataset is externally managed.").optional()
414
- }).describe("Input parameters for creating a LangSmith dataset.");
415
- var createDatasetOutput = external_exports.strictObject({
416
- dataset: external_exports.strictObject({
417
- id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
418
- tenant_id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
419
- name: external_exports.string().describe("The dataset name.").optional(),
420
- description: external_exports.string().describe("The dataset description when returned.").nullable().optional(),
421
- data_type: external_exports.enum(["kv", "llm", "chat"]).describe("The LangSmith dataset data type.").nullable().optional(),
422
- created_at: external_exports.string().describe("The dataset creation timestamp when returned.").nullable().optional(),
423
- modified_at: external_exports.string().describe("The dataset modification timestamp when returned.").nullable().optional(),
424
- example_count: external_exports.int().describe("The dataset example count when returned.").nullable().optional(),
425
- session_count: external_exports.int().describe("The dataset experiment session count when returned.").nullable().optional(),
426
- metadata: external_exports.looseObject({}).describe("Provider-defined metadata forwarded to LangSmith.").nullable().optional(),
427
- raw: external_exports.looseObject({}).describe("The raw dataset object returned by LangSmith.").optional()
428
- }).describe("A LangSmith dataset.").optional()
429
- }).describe("The response returned when creating a LangSmith dataset.");
430
- var listExamplesInput = external_exports.strictObject({
431
- datasetId: external_exports.uuid().describe("The LangSmith UUID.").optional(),
432
- full_text_contains: external_exports.array(external_exports.string().min(1).describe("A text fragment.")).min(1).describe("Text fragments that LangSmith should search for.").optional(),
433
- as_of: external_exports.string().describe("The dataset version timestamp or latest.").optional(),
434
- offset: external_exports.int().min(0).describe("The number of records to skip.").optional(),
435
- limit: external_exports.int().min(1).max(100).describe("The maximum number of records to return.").optional()
436
- }).describe("Input parameters for listing LangSmith examples.");
437
- var listExamplesOutput = external_exports.strictObject({
438
- examples: external_exports.array(external_exports.strictObject({
439
- id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
440
- dataset_id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
441
- name: external_exports.string().describe("The example name when returned.").nullable().optional(),
442
- created_at: external_exports.string().describe("The example creation timestamp when returned.").nullable().optional(),
443
- modified_at: external_exports.string().describe("The example modification timestamp when returned.").nullable().optional(),
444
- inputs: external_exports.looseObject({}).describe("The example input values.").optional(),
445
- outputs: external_exports.looseObject({}).describe("A JSON object forwarded to or returned by LangSmith.").nullable().optional(),
446
- metadata: external_exports.looseObject({}).describe("Provider-defined metadata forwarded to LangSmith.").nullable().optional(),
447
- raw: external_exports.looseObject({}).describe("The raw example object returned by LangSmith.").optional()
448
- }).describe("A LangSmith dataset example.")).describe("The examples returned by LangSmith.").optional()
449
- }).describe("The response returned when listing LangSmith examples.");
450
- var getExampleInput = external_exports.strictObject({
451
- exampleId: external_exports.uuid().describe("The LangSmith UUID."),
452
- datasetId: external_exports.uuid().describe("The LangSmith UUID.").optional(),
453
- as_of: external_exports.string().describe("The dataset version timestamp or latest.").optional()
454
- }).describe("Input parameters for getting a LangSmith example.");
455
- var getExampleOutput = external_exports.strictObject({
456
- example: external_exports.strictObject({
457
- id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
458
- dataset_id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
459
- name: external_exports.string().describe("The example name when returned.").nullable().optional(),
460
- created_at: external_exports.string().describe("The example creation timestamp when returned.").nullable().optional(),
461
- modified_at: external_exports.string().describe("The example modification timestamp when returned.").nullable().optional(),
462
- inputs: external_exports.looseObject({}).describe("The example input values.").optional(),
463
- outputs: external_exports.looseObject({}).describe("A JSON object forwarded to or returned by LangSmith.").nullable().optional(),
464
- metadata: external_exports.looseObject({}).describe("Provider-defined metadata forwarded to LangSmith.").nullable().optional(),
465
- raw: external_exports.looseObject({}).describe("The raw example object returned by LangSmith.").optional()
466
- }).describe("A LangSmith dataset example.").optional()
467
- }).describe("The response returned when getting a LangSmith example.");
468
- var createExampleInput = external_exports.strictObject({
469
- datasetId: external_exports.uuid().describe("The LangSmith UUID."),
470
- inputs: external_exports.looseObject({}).describe("A JSON object forwarded to or returned by LangSmith.").optional(),
471
- outputs: external_exports.looseObject({}).describe("A JSON object forwarded to or returned by LangSmith.").optional(),
472
- metadata: external_exports.looseObject({}).describe("Provider-defined metadata forwarded to LangSmith.").optional(),
473
- split: external_exports.union([external_exports.string().min(1).describe("A single split name."), external_exports.array(external_exports.string().min(1).describe("A split name.")).min(1).describe("A list of split names.")]).describe("One or more LangSmith dataset splits.").optional(),
474
- id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
475
- created_at: external_exports.string().describe("The example creation timestamp.").optional()
476
- }).describe("Input parameters for creating a LangSmith example.");
477
- var createExampleOutput = external_exports.strictObject({
478
- example: external_exports.strictObject({
479
- id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
480
- dataset_id: external_exports.uuid().describe("The LangSmith UUID.").optional(),
481
- name: external_exports.string().describe("The example name when returned.").nullable().optional(),
482
- created_at: external_exports.string().describe("The example creation timestamp when returned.").nullable().optional(),
483
- modified_at: external_exports.string().describe("The example modification timestamp when returned.").nullable().optional(),
484
- inputs: external_exports.looseObject({}).describe("The example input values.").optional(),
485
- outputs: external_exports.looseObject({}).describe("A JSON object forwarded to or returned by LangSmith.").nullable().optional(),
486
- metadata: external_exports.looseObject({}).describe("Provider-defined metadata forwarded to LangSmith.").nullable().optional(),
487
- raw: external_exports.looseObject({}).describe("The raw example object returned by LangSmith.").optional()
488
- }).describe("A LangSmith dataset example.").optional()
489
- }).describe("The response returned when creating a LangSmith example.");
490
- var langsmithActions = {
491
- list_workspaces: {
492
- description: "List LangSmith workspaces visible to the connected API key.",
493
- effect: "read",
494
- inputSchema: listWorkspacesInput,
495
- outputSchema: external_exports.toJSONSchema(listWorkspacesOutput, { io: "output", unrepresentable: "any" })
496
- },
497
- list_projects: {
498
- description: "List LangSmith tracing projects with optional name and pagination filters.",
499
- effect: "read",
500
- inputSchema: listProjectsInput,
501
- outputSchema: external_exports.toJSONSchema(listProjectsOutput, { io: "output", unrepresentable: "any" })
502
- },
503
- get_project: {
504
- description: "Get a LangSmith tracing project by ID.",
505
- effect: "read",
506
- inputSchema: getProjectInput,
507
- outputSchema: external_exports.toJSONSchema(getProjectOutput, { io: "output", unrepresentable: "any" })
508
- },
509
- create_project: {
510
- description: "Create a LangSmith tracing project.",
511
- effect: "write",
512
- inputSchema: createProjectInput,
513
- outputSchema: external_exports.toJSONSchema(createProjectOutput, { io: "output", unrepresentable: "any" })
514
- },
515
- list_datasets: {
516
- description: "List LangSmith datasets with optional name, type, and pagination filters.",
517
- effect: "read",
518
- inputSchema: listDatasetsInput,
519
- outputSchema: external_exports.toJSONSchema(listDatasetsOutput, { io: "output", unrepresentable: "any" })
520
- },
521
- get_dataset: {
522
- description: "Get a LangSmith dataset by ID.",
523
- effect: "read",
524
- inputSchema: getDatasetInput,
525
- outputSchema: external_exports.toJSONSchema(getDatasetOutput, { io: "output", unrepresentable: "any" })
526
- },
527
- create_dataset: {
528
- description: "Create a LangSmith dataset.",
529
- effect: "write",
530
- inputSchema: createDatasetInput,
531
- outputSchema: external_exports.toJSONSchema(createDatasetOutput, { io: "output", unrepresentable: "any" })
532
- },
533
- list_examples: {
534
- description: "List LangSmith dataset examples with optional dataset and text filters.",
535
- effect: "read",
536
- inputSchema: listExamplesInput,
537
- outputSchema: external_exports.toJSONSchema(listExamplesOutput, { io: "output", unrepresentable: "any" })
538
- },
539
- get_example: {
540
- description: "Get a LangSmith dataset example by ID.",
541
- effect: "read",
542
- inputSchema: getExampleInput,
543
- outputSchema: external_exports.toJSONSchema(getExampleOutput, { io: "output", unrepresentable: "any" })
544
- },
545
- create_example: {
546
- description: "Create a LangSmith dataset example with JSON inputs, outputs, and metadata.",
547
- effect: "write",
548
- inputSchema: createExampleInput,
549
- outputSchema: external_exports.toJSONSchema(createExampleOutput, { io: "output", unrepresentable: "any" })
550
- }
551
- };
552
-
553
- // ../plugins/src/langsmith/index.ts
554
- function createLangsmithPlugin() {
555
- return createProviderPlugin({
556
- description: "LangSmith",
557
- actions: langsmithActions,
558
- // 上游 credentialValidators 就是打 /api/v1/workspaces 试凭证,这里对应到同一个 action:
559
- // effect 是 read、入参全可选,满足探针的三个条件。
560
- credentialProbe: "list_workspaces",
561
- // 两者均非必配:region 缺省走 us,workspaceId 缺省用凭证的默认 workspace。
562
- mountConfigFields: [
563
- {
564
- key: "region",
565
- label: "\u533A\u57DF",
566
- description: "us\u3001eu\u3001apac \u6216 aws_us \u4E4B\u4E00;\u7559\u7A7A\u7528 us"
567
- },
568
- {
569
- key: "workspaceId",
570
- label: "Workspace ID",
571
- description: "\u9650\u5B9A\u5230\u67D0\u4E2A workspace;\u7559\u7A7A\u7528\u51ED\u8BC1\u7684\u9ED8\u8BA4 workspace"
572
- }
573
- ],
574
- handlers: {
575
- list_workspaces: listWorkspaces,
576
- list_projects: listProjects,
577
- get_project: getProject,
578
- create_project: createProject,
579
- list_datasets: listDatasets,
580
- get_dataset: getDataset,
581
- create_dataset: createDataset,
582
- list_examples: listExamples,
583
- get_example: getExample,
584
- create_example: createExample
585
- }
586
- });
587
- }
588
- var langsmith_default = createLangsmithPlugin();
589
- export {
590
- createLangsmithPlugin,
591
- langsmith_default as default
592
- };