@tool-bridge/server 0.1.1 → 0.3.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 (107) hide show
  1. package/dist/airtable-V6446SVY.js +792 -0
  2. package/dist/alt_text_generator_ai-HV7JZPDT.js +72 -0
  3. package/dist/amap-TTTVB6WS.js +755 -0
  4. package/dist/anthropic-JH3RA363.js +224 -0
  5. package/dist/apify-ETNN7ITU.js +262 -0
  6. package/dist/brave_search-3DDR2MMB.js +322 -0
  7. package/dist/chunk-CSJEZHQO.js +252 -0
  8. package/dist/chunk-JLTYA2B3.js +20121 -0
  9. package/dist/chunk-K7FVSFUX.js +333 -0
  10. package/dist/{chunk-MQEYFCJB.js → chunk-KGYJEEBI.js} +2770 -21574
  11. package/dist/circleci-MX3TX3HC.js +409 -0
  12. package/dist/clerk-MRPORVF4.js +1036 -0
  13. package/dist/cloudflare_dns-OWP7DD7L.js +605 -0
  14. package/dist/cohere-GPECP66S.js +197 -0
  15. package/dist/confluence-BN7LZ6BC.js +436 -0
  16. package/dist/convertapi-SBEOFOFQ.js +161 -0
  17. package/dist/currencyapi-P2YY7Y7P.js +306 -0
  18. package/dist/deepseek-MWB3NYIN.js +205 -0
  19. package/dist/docker_hub-3JSCIGQ3.js +946 -0
  20. package/dist/dropbox-RFIBDAXO.js +1308 -0
  21. package/dist/dub-YVP57ELQ.js +706 -0
  22. package/dist/e2b-NFSUHTZR.js +305 -0
  23. package/dist/exa-KTDY6IV3.js +360 -0
  24. package/dist/fal_ai-OCUENLNQ.js +405 -0
  25. package/dist/feishu-5CWBQ7E5.js +225 -0
  26. package/dist/feishu_custom_bot-ZJR22OK6.js +240 -0
  27. package/dist/figma-YULGANSA.js +798 -0
  28. package/dist/firehydrant-2V6YSYAP.js +573 -0
  29. package/dist/fixer-LTCDB3CJ.js +171 -0
  30. package/dist/fly-IXPKMAML.js +478 -0
  31. package/dist/front-KRFB4M5X.js +379 -0
  32. package/dist/geocodio-VVURKYHQ.js +236 -0
  33. package/dist/ghost-6J2RIOUB.js +341 -0
  34. package/dist/github-5Z6KQRYH.js +5410 -0
  35. package/dist/gmail-KU4NZ7VA.js +1894 -0
  36. package/dist/googlecalendar-X44DFFXG.js +2539 -0
  37. package/dist/googledocs-WSGLPKSF.js +1322 -0
  38. package/dist/grafana-4PKSSDXY.js +817 -0
  39. package/dist/graphhopper-DF65ZNGK.js +336 -0
  40. package/dist/index.d.ts +181 -2
  41. package/dist/index.js +2 -1
  42. package/dist/ip2proxy-UCAQ5P2J.js +118 -0
  43. package/dist/ipgeolocation_io-UX6FCA2S.js +333 -0
  44. package/dist/ipqualityscore-MKTRXIZJ.js +287 -0
  45. package/dist/jina_ai-MRHPCSV5.js +119 -0
  46. package/dist/jira-EG7ZPOIW.js +627 -0
  47. package/dist/langsmith-FNO3RCOZ.js +597 -0
  48. package/dist/lemlist-SN6BJHSG.js +298 -0
  49. package/dist/linear-H3VU4PSD.js +2163 -0
  50. package/dist/logsnag-OY2JJT2H.js +167 -0
  51. package/dist/main.js +246 -2
  52. package/dist/mattermost-C5SQ7PGD.js +320 -0
  53. package/dist/mem0-LMLE5BFC.js +567 -0
  54. package/dist/memos-UWFAMBZC.js +781 -0
  55. package/dist/metabase-SRYDSDJ6.js +365 -0
  56. package/dist/mistral_ai-YNIJ7VDM.js +1195 -0
  57. package/dist/mother_duck-CPGOFEXE.js +322 -0
  58. package/dist/ngrok-CDJFBSOM.js +375 -0
  59. package/dist/notes-DIVFH3P3.js +109 -0
  60. package/dist/notion-HGDKS4HK.js +945 -0
  61. package/dist/open_exchange_rates-COHHYJDD.js +216 -0
  62. package/dist/openai-4TRT66GW.js +795 -0
  63. package/dist/opengraph_io-YKVW4PXI.js +377 -0
  64. package/dist/openrouter-6CV7B7V5.js +444 -0
  65. package/dist/outline-YWDUK5F7.js +604 -0
  66. package/dist/paddle-MEU7HWDZ.js +464 -0
  67. package/dist/perplexity-MRQUDBIC.js +238 -0
  68. package/dist/pinecone-JI7X2TAF.js +599 -0
  69. package/dist/pipedrive-6JQPAW23.js +453 -0
  70. package/dist/polar-7BF56CMC.js +400 -0
  71. package/dist/posthog-YPU5ADEN.js +3462 -0
  72. package/dist/postmark-BEU5OFKU.js +441 -0
  73. package/dist/prerender-UT5GOOZH.js +180 -0
  74. package/dist/pubmed-3SGOE24Q.js +1052 -0
  75. package/dist/railway-CEK4GLRQ.js +452 -0
  76. package/dist/readwise-DXQUQU67.js +482 -0
  77. package/dist/render-7TGAU5AW.js +473 -0
  78. package/dist/replicate-VICFSQ5A.js +347 -0
  79. package/dist/resend-3E76WK3O.js +100 -0
  80. package/dist/rootly-36GY46BY.js +345 -0
  81. package/dist/scrapfly-VDVUYAHX.js +289 -0
  82. package/dist/scrapingbee-3KTPMAVY.js +247 -0
  83. package/dist/screenshot_fyi-LKG62C3J.js +116 -0
  84. package/dist/semantic_scholar-4WREECYO.js +626 -0
  85. package/dist/sentry-HUQTGXOV.js +1139 -0
  86. package/dist/shodan-SGRKU4KS.js +303 -0
  87. package/dist/shopify-YCZ4L5HT.js +620 -0
  88. package/dist/stripe-OEBKMELB.js +583 -0
  89. package/dist/supabase-I3DBY7L4.js +937 -0
  90. package/dist/tavily-B2YHCNRD.js +349 -0
  91. package/dist/telegram-2VYJELZX.js +1773 -0
  92. package/dist/telnyx-HHXD3CXL.js +237 -0
  93. package/dist/todoist-PHFDEEIS.js +672 -0
  94. package/dist/trello-WUSAK6YN.js +1091 -0
  95. package/dist/turso-FW56U2B3.js +432 -0
  96. package/dist/twilio-M5JI7XHA.js +321 -0
  97. package/dist/umami-HAYODRC4.js +411 -0
  98. package/dist/unsplash-EDPTNEHJ.js +364 -0
  99. package/dist/upstash_redis-GC2CLIWD.js +299 -0
  100. package/dist/uptimerobot-XMSNYLIT.js +481 -0
  101. package/dist/v2ex-KU4ECD65.js +672 -0
  102. package/dist/vercel-THPCEFHW.js +1096 -0
  103. package/dist/wolfram_alpha_api-WHHTH4GU.js +212 -0
  104. package/dist/wordpress-O6TQEQNF.js +822 -0
  105. package/dist/workos-A3VHHWI3.js +681 -0
  106. package/dist/zhihu-BJAI64YJ.js +273 -0
  107. package/package.json +5 -4
@@ -0,0 +1,237 @@
1
+ import {
2
+ createProviderPlugin,
3
+ guardedFetch,
4
+ requireApiKey,
5
+ upstreamError
6
+ } from "./chunk-CSJEZHQO.js";
7
+ import "./chunk-K7FVSFUX.js";
8
+ import {
9
+ TBError,
10
+ external_exports
11
+ } from "./chunk-JLTYA2B3.js";
12
+ import "./chunk-MLKGABMK.js";
13
+
14
+ // ../plugins/src/telnyx/api.ts
15
+ var SERVICE = "telnyx";
16
+ var API_BASE = "https://api.telnyx.com/v2";
17
+ function toRecord(value) {
18
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
19
+ }
20
+ function text(value) {
21
+ if (typeof value !== "string") return void 0;
22
+ const trimmed = value.trim();
23
+ return trimmed === "" ? void 0 : trimmed;
24
+ }
25
+ function errorMessage(payload, response) {
26
+ if (typeof payload === "string" && payload.trim() !== "") return payload;
27
+ const record = toRecord(payload);
28
+ const errors = Array.isArray(record?.errors) ? record.errors : [];
29
+ const first = errors.map(toRecord).find(Boolean);
30
+ const message = first === void 0 ? text(record?.detail) ?? text(record?.message) ?? text(record?.error) ?? text(record?.title) : text(first.detail) ?? text(first.title) ?? text(first.code);
31
+ return message ?? (response.statusText || `Telnyx \u8FD4\u56DE HTTP ${response.status}`);
32
+ }
33
+ async function readPayload(response) {
34
+ const body = await response.text().catch(() => "");
35
+ if (body.trim() === "") return null;
36
+ try {
37
+ return JSON.parse(body);
38
+ } catch {
39
+ throw upstreamError(response.status === 429 ? 429 : 502, "Telnyx \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94");
40
+ }
41
+ }
42
+ async function send(url, init) {
43
+ try {
44
+ return await guardedFetch(url.toString(), init);
45
+ } catch (error) {
46
+ if (error instanceof TypeError) {
47
+ throw upstreamError(502, `telnyx request failed: ${error.message}`);
48
+ }
49
+ throw error;
50
+ }
51
+ }
52
+ async function request(ctx, path, input = {}) {
53
+ const url = new URL(`${API_BASE}${path}`);
54
+ for (const [name, value] of input.query ?? []) {
55
+ if (value === void 0 || value === null || value === "") continue;
56
+ url.searchParams.set(name, String(value));
57
+ }
58
+ const headers = {
59
+ accept: "application/json",
60
+ authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`
61
+ };
62
+ if (input.body !== void 0) headers["content-type"] = "application/json";
63
+ const response = await send(url, {
64
+ method: input.method ?? "GET",
65
+ headers,
66
+ // JSON.stringify 自己会丢掉值为 undefined 的键,故不必复制上游的 removeUndefined;
67
+ // 但 null 必须留住 —— schema 允许 sendAt 显式传 null,那是要发给 Telnyx 的值。
68
+ ...input.body === void 0 ? {} : { body: JSON.stringify(input.body) }
69
+ });
70
+ const payload = await readPayload(response);
71
+ if (!response.ok) throw upstreamError(response.status, errorMessage(payload, response));
72
+ const record = toRecord(payload);
73
+ if (record === void 0) {
74
+ throw upstreamError(502, "Telnyx \u7684\u6210\u529F\u54CD\u5E94\u4E0D\u662F\u4E00\u4E2A\u5BF9\u8C61");
75
+ }
76
+ return record;
77
+ }
78
+ async function sendMessage(input, ctx) {
79
+ if (input.from === void 0 && input.messagingProfileId === void 0) {
80
+ throw new TBError("invalid_argument", "send_message \u9700\u8981 from \u6216 messagingProfileId");
81
+ }
82
+ if (input.type === "SMS" && input.text === void 0) {
83
+ throw new TBError("invalid_argument", "type \u4E3A SMS \u65F6\u9700\u8981 text");
84
+ }
85
+ if (input.type === "MMS" && input.mediaUrls === void 0) {
86
+ throw new TBError("invalid_argument", "type \u4E3A MMS \u65F6\u9700\u8981 mediaUrls");
87
+ }
88
+ if (input.type === void 0 && input.text === void 0 && input.mediaUrls === void 0) {
89
+ throw new TBError("invalid_argument", "send_message \u9700\u8981 text \u6216 mediaUrls");
90
+ }
91
+ return request(ctx, "/messages", {
92
+ method: "POST",
93
+ body: {
94
+ // 上游对每个字符串字段都过一遍 optionalString(即 trim)再发。这里只对自由文本
95
+ // 字段保留 trim —— 其余字段的 schema(uuid / url / datetime)要么本就不接受带空白的
96
+ // 值,要么 Zod 已经替我们 trim 过,再调一次是死代码。
97
+ // 这几个字段 schema 都要求 `\S`,故 trim 后不会变成空。
98
+ to: input.to.trim(),
99
+ from: input.from?.trim(),
100
+ messaging_profile_id: input.messagingProfileId,
101
+ text: input.text?.trim(),
102
+ subject: input.subject?.trim(),
103
+ media_urls: input.mediaUrls,
104
+ webhook_url: input.webhookUrl,
105
+ webhook_failover_url: input.webhookFailoverUrl,
106
+ use_profile_webhooks: input.useProfileWebhooks,
107
+ type: input.type,
108
+ auto_detect: input.autoDetect,
109
+ // null 与 undefined 在这里语义不同:null 是"清掉排期,立刻发",要原样发给 Telnyx;
110
+ // undefined 是没给,由 JSON.stringify 丢掉整个键。
111
+ send_at: input.sendAt,
112
+ encoding: input.encoding
113
+ }
114
+ });
115
+ }
116
+ async function retrieveMessage(input, ctx) {
117
+ return request(ctx, `/messages/${encodeURIComponent(input.id)}`);
118
+ }
119
+ async function listMessagingProfiles(input, ctx) {
120
+ return request(ctx, "/messaging_profiles", {
121
+ query: [
122
+ ["filter[name]", input.filterName],
123
+ ["filter[name][eq]", input.filterNameEq],
124
+ ["filter[name][contains]", input.filterNameContains],
125
+ ["page[number]", input.pageNumber],
126
+ ["page[size]", input.pageSize]
127
+ ]
128
+ });
129
+ }
130
+ async function retrieveMessagingProfile(input, ctx) {
131
+ return request(ctx, `/messaging_profiles/${encodeURIComponent(input.id)}`);
132
+ }
133
+
134
+ // ../plugins/src/telnyx/schema.ts
135
+ var sendMessageInput = external_exports.strictObject({
136
+ to: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The sending or receiving address, such as an E.164 phone number, alphanumeric sender ID, short code, or number pool."),
137
+ from: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The sending or receiving address, such as an E.164 phone number, alphanumeric sender ID, short code, or number pool.").optional(),
138
+ messagingProfileId: external_exports.uuid().describe("The Telnyx messaging profile ID.").optional(),
139
+ text: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The SMS message body.").optional(),
140
+ subject: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The MMS message subject.").optional(),
141
+ mediaUrls: external_exports.array(external_exports.url().describe("One media URL for the MMS message.")).min(1).describe("The media URLs Telnyx should attach to an MMS message.").optional(),
142
+ webhookUrl: external_exports.url().describe("The URL where Telnyx should send message webhooks.").optional(),
143
+ webhookFailoverUrl: external_exports.url().describe("The failover URL Telnyx should use if the primary message webhook URL fails.").optional(),
144
+ useProfileWebhooks: external_exports.boolean().describe("Whether Telnyx should use webhooks configured on the messaging profile.").optional(),
145
+ type: external_exports.enum(["SMS", "MMS"]).describe("The protocol Telnyx should use for the message.").optional(),
146
+ autoDetect: external_exports.boolean().describe("Whether Telnyx should detect SMS messages that exceed a recommended part limit.").optional(),
147
+ sendAt: external_exports.iso.datetime({ offset: true }).describe("The ISO 8601 timestamp when Telnyx should send the message.").nullable().optional(),
148
+ encoding: external_exports.enum(["auto", "gsm7", "ucs2"]).describe("The encoding Telnyx should use for the message.").optional()
149
+ }).describe("The input payload for sending a Telnyx message.");
150
+ var sendMessageOutput = external_exports.strictObject({
151
+ data: external_exports.looseObject({
152
+ id: external_exports.uuid().describe("The Telnyx resource ID."),
153
+ record_type: external_exports.string().describe("The Telnyx resource type.")
154
+ }).describe("The Telnyx resource object returned by the API.")
155
+ }).describe("The response returned when Telnyx sends a message.");
156
+ var retrieveMessageInput = external_exports.strictObject({
157
+ id: external_exports.uuid().describe("The Telnyx message ID.")
158
+ }).describe("The input payload for retrieving a Telnyx message.");
159
+ var retrieveMessageOutput = external_exports.strictObject({
160
+ data: external_exports.looseObject({
161
+ id: external_exports.uuid().describe("The Telnyx resource ID."),
162
+ record_type: external_exports.string().describe("The Telnyx resource type.")
163
+ }).describe("The Telnyx resource object returned by the API.")
164
+ }).describe("The response returned when retrieving a Telnyx message.");
165
+ var listMessagingProfilesInput = external_exports.strictObject({
166
+ filterName: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The profile name filter passed as filter[name].").optional(),
167
+ filterNameEq: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The exact profile name filter.").optional(),
168
+ filterNameContains: external_exports.string().min(1).regex(new RegExp("\\S")).describe("The partial profile name filter.").optional(),
169
+ pageNumber: external_exports.int().min(1).describe("The Telnyx page number to load.").optional(),
170
+ pageSize: external_exports.int().min(1).max(250).describe("The number of Telnyx profiles to load per page.").optional()
171
+ }).describe("The input payload for listing Telnyx messaging profiles.");
172
+ var listMessagingProfilesOutput = external_exports.strictObject({
173
+ data: external_exports.array(external_exports.looseObject({
174
+ id: external_exports.uuid().describe("The Telnyx resource ID."),
175
+ record_type: external_exports.string().describe("The Telnyx resource type.")
176
+ }).describe("The Telnyx resource object returned by the API.")).describe("The Telnyx messaging profiles returned by the API."),
177
+ meta: external_exports.looseObject({
178
+ page_number: external_exports.int().describe("The current Telnyx page number.").optional(),
179
+ page_size: external_exports.int().describe("The current Telnyx page size.").optional(),
180
+ total_pages: external_exports.int().describe("The total number of pages available from Telnyx.").optional(),
181
+ total_results: external_exports.int().describe("The total number of matching Telnyx resources.").optional()
182
+ }).describe("The pagination metadata returned by Telnyx.")
183
+ }).describe("The response returned when listing Telnyx messaging profiles.");
184
+ var retrieveMessagingProfileInput = external_exports.strictObject({
185
+ id: external_exports.uuid().describe("The Telnyx messaging profile ID.")
186
+ }).describe("The input payload for retrieving a Telnyx messaging profile.");
187
+ var retrieveMessagingProfileOutput = external_exports.strictObject({
188
+ data: external_exports.looseObject({
189
+ id: external_exports.uuid().describe("The Telnyx resource ID."),
190
+ record_type: external_exports.string().describe("The Telnyx resource type.")
191
+ }).describe("The Telnyx resource object returned by the API.")
192
+ }).describe("The response returned when retrieving a Telnyx messaging profile.");
193
+ var telnyxActions = {
194
+ send_message: {
195
+ description: "Send an SMS or MMS message through Telnyx Messaging.",
196
+ effect: "write",
197
+ inputSchema: sendMessageInput,
198
+ outputSchema: external_exports.toJSONSchema(sendMessageOutput, { io: "output", unrepresentable: "any" })
199
+ },
200
+ retrieve_message: {
201
+ description: "Retrieve a Telnyx message by ID.",
202
+ effect: "read",
203
+ inputSchema: retrieveMessageInput,
204
+ outputSchema: external_exports.toJSONSchema(retrieveMessageOutput, { io: "output", unrepresentable: "any" })
205
+ },
206
+ list_messaging_profiles: {
207
+ description: "List Telnyx messaging profiles with optional name filters and pagination.",
208
+ effect: "read",
209
+ inputSchema: listMessagingProfilesInput,
210
+ outputSchema: external_exports.toJSONSchema(listMessagingProfilesOutput, { io: "output", unrepresentable: "any" })
211
+ },
212
+ retrieve_messaging_profile: {
213
+ description: "Retrieve a Telnyx messaging profile by ID.",
214
+ effect: "read",
215
+ inputSchema: retrieveMessagingProfileInput,
216
+ outputSchema: external_exports.toJSONSchema(retrieveMessagingProfileOutput, { io: "output", unrepresentable: "any" })
217
+ }
218
+ };
219
+
220
+ // ../plugins/src/telnyx/index.ts
221
+ function createTelnyxPlugin() {
222
+ return createProviderPlugin({
223
+ description: "Telnyx",
224
+ actions: telnyxActions,
225
+ handlers: {
226
+ send_message: sendMessage,
227
+ retrieve_message: retrieveMessage,
228
+ list_messaging_profiles: listMessagingProfiles,
229
+ retrieve_messaging_profile: retrieveMessagingProfile
230
+ }
231
+ });
232
+ }
233
+ var telnyx_default = createTelnyxPlugin();
234
+ export {
235
+ createTelnyxPlugin,
236
+ telnyx_default as default
237
+ };