@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.
- package/dist/airtable-V6446SVY.js +792 -0
- package/dist/alt_text_generator_ai-HV7JZPDT.js +72 -0
- package/dist/amap-TTTVB6WS.js +755 -0
- package/dist/anthropic-JH3RA363.js +224 -0
- package/dist/apify-ETNN7ITU.js +262 -0
- package/dist/brave_search-3DDR2MMB.js +322 -0
- package/dist/chunk-CSJEZHQO.js +252 -0
- package/dist/chunk-JLTYA2B3.js +20121 -0
- package/dist/chunk-K7FVSFUX.js +333 -0
- package/dist/{chunk-MQEYFCJB.js → chunk-KGYJEEBI.js} +2770 -21574
- package/dist/circleci-MX3TX3HC.js +409 -0
- package/dist/clerk-MRPORVF4.js +1036 -0
- package/dist/cloudflare_dns-OWP7DD7L.js +605 -0
- package/dist/cohere-GPECP66S.js +197 -0
- package/dist/confluence-BN7LZ6BC.js +436 -0
- package/dist/convertapi-SBEOFOFQ.js +161 -0
- package/dist/currencyapi-P2YY7Y7P.js +306 -0
- package/dist/deepseek-MWB3NYIN.js +205 -0
- package/dist/docker_hub-3JSCIGQ3.js +946 -0
- package/dist/dropbox-RFIBDAXO.js +1308 -0
- package/dist/dub-YVP57ELQ.js +706 -0
- package/dist/e2b-NFSUHTZR.js +305 -0
- package/dist/exa-KTDY6IV3.js +360 -0
- package/dist/fal_ai-OCUENLNQ.js +405 -0
- package/dist/feishu-5CWBQ7E5.js +225 -0
- package/dist/feishu_custom_bot-ZJR22OK6.js +240 -0
- package/dist/figma-YULGANSA.js +798 -0
- package/dist/firehydrant-2V6YSYAP.js +573 -0
- package/dist/fixer-LTCDB3CJ.js +171 -0
- package/dist/fly-IXPKMAML.js +478 -0
- package/dist/front-KRFB4M5X.js +379 -0
- package/dist/geocodio-VVURKYHQ.js +236 -0
- package/dist/ghost-6J2RIOUB.js +341 -0
- package/dist/github-5Z6KQRYH.js +5410 -0
- package/dist/gmail-KU4NZ7VA.js +1894 -0
- package/dist/googlecalendar-X44DFFXG.js +2539 -0
- package/dist/googledocs-WSGLPKSF.js +1322 -0
- package/dist/grafana-4PKSSDXY.js +817 -0
- package/dist/graphhopper-DF65ZNGK.js +336 -0
- package/dist/index.d.ts +181 -2
- package/dist/index.js +2 -1
- package/dist/ip2proxy-UCAQ5P2J.js +118 -0
- package/dist/ipgeolocation_io-UX6FCA2S.js +333 -0
- package/dist/ipqualityscore-MKTRXIZJ.js +287 -0
- package/dist/jina_ai-MRHPCSV5.js +119 -0
- package/dist/jira-EG7ZPOIW.js +627 -0
- package/dist/langsmith-FNO3RCOZ.js +597 -0
- package/dist/lemlist-SN6BJHSG.js +298 -0
- package/dist/linear-H3VU4PSD.js +2163 -0
- package/dist/logsnag-OY2JJT2H.js +167 -0
- package/dist/main.js +246 -2
- package/dist/mattermost-C5SQ7PGD.js +320 -0
- package/dist/mem0-LMLE5BFC.js +567 -0
- package/dist/memos-UWFAMBZC.js +781 -0
- package/dist/metabase-SRYDSDJ6.js +365 -0
- package/dist/mistral_ai-YNIJ7VDM.js +1195 -0
- package/dist/mother_duck-CPGOFEXE.js +322 -0
- package/dist/ngrok-CDJFBSOM.js +375 -0
- package/dist/notes-DIVFH3P3.js +109 -0
- package/dist/notion-HGDKS4HK.js +945 -0
- package/dist/open_exchange_rates-COHHYJDD.js +216 -0
- package/dist/openai-4TRT66GW.js +795 -0
- package/dist/opengraph_io-YKVW4PXI.js +377 -0
- package/dist/openrouter-6CV7B7V5.js +444 -0
- package/dist/outline-YWDUK5F7.js +604 -0
- package/dist/paddle-MEU7HWDZ.js +464 -0
- package/dist/perplexity-MRQUDBIC.js +238 -0
- package/dist/pinecone-JI7X2TAF.js +599 -0
- package/dist/pipedrive-6JQPAW23.js +453 -0
- package/dist/polar-7BF56CMC.js +400 -0
- package/dist/posthog-YPU5ADEN.js +3462 -0
- package/dist/postmark-BEU5OFKU.js +441 -0
- package/dist/prerender-UT5GOOZH.js +180 -0
- package/dist/pubmed-3SGOE24Q.js +1052 -0
- package/dist/railway-CEK4GLRQ.js +452 -0
- package/dist/readwise-DXQUQU67.js +482 -0
- package/dist/render-7TGAU5AW.js +473 -0
- package/dist/replicate-VICFSQ5A.js +347 -0
- package/dist/resend-3E76WK3O.js +100 -0
- package/dist/rootly-36GY46BY.js +345 -0
- package/dist/scrapfly-VDVUYAHX.js +289 -0
- package/dist/scrapingbee-3KTPMAVY.js +247 -0
- package/dist/screenshot_fyi-LKG62C3J.js +116 -0
- package/dist/semantic_scholar-4WREECYO.js +626 -0
- package/dist/sentry-HUQTGXOV.js +1139 -0
- package/dist/shodan-SGRKU4KS.js +303 -0
- package/dist/shopify-YCZ4L5HT.js +620 -0
- package/dist/stripe-OEBKMELB.js +583 -0
- package/dist/supabase-I3DBY7L4.js +937 -0
- package/dist/tavily-B2YHCNRD.js +349 -0
- package/dist/telegram-2VYJELZX.js +1773 -0
- package/dist/telnyx-HHXD3CXL.js +237 -0
- package/dist/todoist-PHFDEEIS.js +672 -0
- package/dist/trello-WUSAK6YN.js +1091 -0
- package/dist/turso-FW56U2B3.js +432 -0
- package/dist/twilio-M5JI7XHA.js +321 -0
- package/dist/umami-HAYODRC4.js +411 -0
- package/dist/unsplash-EDPTNEHJ.js +364 -0
- package/dist/upstash_redis-GC2CLIWD.js +299 -0
- package/dist/uptimerobot-XMSNYLIT.js +481 -0
- package/dist/v2ex-KU4ECD65.js +672 -0
- package/dist/vercel-THPCEFHW.js +1096 -0
- package/dist/wolfram_alpha_api-WHHTH4GU.js +212 -0
- package/dist/wordpress-O6TQEQNF.js +822 -0
- package/dist/workos-A3VHHWI3.js +681 -0
- package/dist/zhihu-BJAI64YJ.js +273 -0
- package/package.json +5 -4
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderPlugin,
|
|
3
|
+
guardedFetch,
|
|
4
|
+
requireCredential,
|
|
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/feishu_custom_bot/api.ts
|
|
15
|
+
var SERVICE = "feishu_custom_bot";
|
|
16
|
+
var API_BASE = "https://open.feishu.cn";
|
|
17
|
+
var WEBHOOK_PREFIX = "/open-apis/bot/v2/hook/";
|
|
18
|
+
var MAX_PAYLOAD_BYTES = 20 * 1024;
|
|
19
|
+
var RATE_LIMITED_CODE = 11232;
|
|
20
|
+
function webhookUrl(ctx) {
|
|
21
|
+
const raw = requireCredential(ctx, SERVICE, "webhook").trim();
|
|
22
|
+
const url = raw.includes("://") ? new URL(raw) : new URL(`${WEBHOOK_PREFIX}${raw}`, API_BASE);
|
|
23
|
+
if (url.origin !== API_BASE || !url.pathname.startsWith(WEBHOOK_PREFIX)) {
|
|
24
|
+
throw new TBError(
|
|
25
|
+
"invalid_argument",
|
|
26
|
+
`${SERVICE} \u7684\u51ED\u8BC1\u5FC5\u987B\u662F ${API_BASE}${WEBHOOK_PREFIX}<token> \u5F62\u5F0F\u7684 webhook \u5730\u5740\u6216\u5176 token`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return url;
|
|
30
|
+
}
|
|
31
|
+
async function sign(timestamp, secret) {
|
|
32
|
+
const key = await crypto.subtle.importKey(
|
|
33
|
+
"raw",
|
|
34
|
+
new TextEncoder().encode(`${timestamp}
|
|
35
|
+
${secret}`),
|
|
36
|
+
{ name: "HMAC", hash: "SHA-256" },
|
|
37
|
+
false,
|
|
38
|
+
["sign"]
|
|
39
|
+
);
|
|
40
|
+
const mac = await crypto.subtle.sign("HMAC", key, new Uint8Array(0));
|
|
41
|
+
return btoa(String.fromCharCode(...new Uint8Array(mac)));
|
|
42
|
+
}
|
|
43
|
+
function envelopeOf(payload) {
|
|
44
|
+
if (payload === null || typeof payload !== "object" || Array.isArray(payload)) return null;
|
|
45
|
+
const record = payload;
|
|
46
|
+
const code = typeof record.code === "number" ? record.code : null;
|
|
47
|
+
const status = typeof record.StatusCode === "number" ? record.StatusCode : null;
|
|
48
|
+
const msg = typeof record.msg === "string" ? record.msg : null;
|
|
49
|
+
const statusMsg = typeof record.StatusMessage === "string" ? record.StatusMessage : null;
|
|
50
|
+
return {
|
|
51
|
+
code: code ?? status,
|
|
52
|
+
msg: msg ?? statusMsg,
|
|
53
|
+
data: typeof record.data === "object" && record.data !== null && !Array.isArray(record.data) ? record.data : {}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
async function send(payload, ctx) {
|
|
57
|
+
const target = webhookUrl(ctx);
|
|
58
|
+
const secret = ctx.credentials?.signingSecret;
|
|
59
|
+
const signed = typeof secret === "string" && secret !== "";
|
|
60
|
+
const body = signed ? { timestamp: Math.floor(Date.now() / 1e3).toString(), sign: "", ...payload } : { ...payload };
|
|
61
|
+
if (signed) {
|
|
62
|
+
body.sign = await sign(body.timestamp, secret);
|
|
63
|
+
}
|
|
64
|
+
const text = JSON.stringify(body);
|
|
65
|
+
if (new TextEncoder().encode(text).byteLength > MAX_PAYLOAD_BYTES) {
|
|
66
|
+
throw new TBError("invalid_argument", `${SERVICE} \u7684\u8BF7\u6C42\u4F53\u4E0D\u5F97\u8D85\u8FC7 20 KB(\u98DE\u4E66\u786C\u9650\u5236)`);
|
|
67
|
+
}
|
|
68
|
+
const response = await guardedFetch(target.toString(), {
|
|
69
|
+
method: "POST",
|
|
70
|
+
headers: { "content-type": "application/json" },
|
|
71
|
+
body: text
|
|
72
|
+
});
|
|
73
|
+
const raw = await response.text();
|
|
74
|
+
let parsed = null;
|
|
75
|
+
try {
|
|
76
|
+
parsed = raw.trim() === "" ? null : JSON.parse(raw);
|
|
77
|
+
} catch {
|
|
78
|
+
parsed = raw.trim();
|
|
79
|
+
}
|
|
80
|
+
const envelope = envelopeOf(parsed);
|
|
81
|
+
const message = envelope?.msg ?? (typeof parsed === "string" ? parsed : "") ?? "";
|
|
82
|
+
if (!response.ok) {
|
|
83
|
+
throw upstreamError(response.status, message || `\u98DE\u4E66\u8FD4\u56DE HTTP ${response.status}`);
|
|
84
|
+
}
|
|
85
|
+
if (envelope?.code !== null && envelope?.code !== void 0 && envelope.code !== 0) {
|
|
86
|
+
if (envelope.code === RATE_LIMITED_CODE) {
|
|
87
|
+
throw new TBError("rate_limited", message || "\u98DE\u4E66\u81EA\u5B9A\u4E49\u673A\u5668\u4EBA\u53D1\u9001\u8FC7\u9891", { retryable: true });
|
|
88
|
+
}
|
|
89
|
+
throw new TBError("invalid_argument", message || `\u98DE\u4E66\u8FD4\u56DE\u4E1A\u52A1\u7801 ${envelope.code}`);
|
|
90
|
+
}
|
|
91
|
+
return { code: envelope?.code ?? 0, msg: envelope?.msg ?? "success", data: envelope?.data ?? {} };
|
|
92
|
+
}
|
|
93
|
+
function sendTextMessage(input, ctx) {
|
|
94
|
+
return send({ msg_type: "text", content: { text: input.text } }, ctx);
|
|
95
|
+
}
|
|
96
|
+
function sendPostMessage(input, ctx) {
|
|
97
|
+
return send({ msg_type: "post", content: { post: input.post } }, ctx);
|
|
98
|
+
}
|
|
99
|
+
function sendImageMessage(input, ctx) {
|
|
100
|
+
return send({ msg_type: "image", content: { image_key: input.imageKey } }, ctx);
|
|
101
|
+
}
|
|
102
|
+
function sendShareChatMessage(input, ctx) {
|
|
103
|
+
return send({ msg_type: "share_chat", content: { share_chat_id: input.shareChatId } }, ctx);
|
|
104
|
+
}
|
|
105
|
+
function sendInteractiveMessage(input, ctx) {
|
|
106
|
+
return send({ msg_type: "interactive", card: input.card }, ctx);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ../plugins/src/feishu_custom_bot/schema.handwritten.ts
|
|
110
|
+
var richTextTag = external_exports.looseObject({}).describe("One Feishu rich-text tag object.");
|
|
111
|
+
var languageBlock = external_exports.looseObject({
|
|
112
|
+
title: external_exports.string().describe("The rich-text title.").optional(),
|
|
113
|
+
content: external_exports.array(
|
|
114
|
+
external_exports.array(richTextTag).min(1).describe("One paragraph of Feishu rich-text tag objects.")
|
|
115
|
+
).min(1).describe("The rich-text paragraphs grouped by line.")
|
|
116
|
+
}).describe("One language block inside the Feishu post payload.");
|
|
117
|
+
var sendPostMessageInput = external_exports.strictObject({
|
|
118
|
+
post: external_exports.looseObject({
|
|
119
|
+
zh_cn: languageBlock.optional(),
|
|
120
|
+
en_us: languageBlock.optional()
|
|
121
|
+
}).refine(
|
|
122
|
+
(value) => value.zh_cn !== void 0 || value.en_us !== void 0,
|
|
123
|
+
{ message: "post \u9700\u8981 zh_cn \u4E0E en_us \u81F3\u5C11\u4E00\u4E2A\u8BED\u8A00\u5757", path: ["zh_cn"] }
|
|
124
|
+
).describe("The Feishu post payload. Provide at least one of zh_cn or en_us.")
|
|
125
|
+
}).describe("Send a Feishu rich-text (post) message through a custom bot webhook.");
|
|
126
|
+
var sendPostMessageOutput = external_exports.looseObject({
|
|
127
|
+
code: external_exports.int().describe("The Feishu response code. 0 means success.").optional(),
|
|
128
|
+
msg: external_exports.string().describe("The Feishu response message.").optional(),
|
|
129
|
+
data: external_exports.looseObject({}).describe("A raw Feishu object payload.").optional()
|
|
130
|
+
}).describe("The Feishu custom bot webhook response.");
|
|
131
|
+
|
|
132
|
+
// ../plugins/src/feishu_custom_bot/schema.ts
|
|
133
|
+
var sendTextMessageInput = external_exports.strictObject({
|
|
134
|
+
text: external_exports.string().min(1).describe("The text message content. You can include Feishu <at ...> tags inline.")
|
|
135
|
+
}).describe("Input for sending a Feishu text message.");
|
|
136
|
+
var sendTextMessageOutput = external_exports.strictObject({
|
|
137
|
+
code: external_exports.int().describe("The Feishu response code. 0 means success."),
|
|
138
|
+
msg: external_exports.string().describe("The Feishu response message."),
|
|
139
|
+
data: external_exports.looseObject({}).describe("A raw Feishu object payload."),
|
|
140
|
+
statusCode: external_exports.int().describe("The legacy response code returned for backward compatibility.").optional(),
|
|
141
|
+
statusMessage: external_exports.string().describe("The legacy response message returned for backward compatibility.").optional()
|
|
142
|
+
}).describe("The normalized Feishu custom bot send result.");
|
|
143
|
+
var sendImageMessageInput = external_exports.strictObject({
|
|
144
|
+
imageKey: external_exports.string().min(1).describe("The Feishu image_key obtained from the image upload API.")
|
|
145
|
+
}).describe("Input for sending a Feishu image message.");
|
|
146
|
+
var sendImageMessageOutput = external_exports.strictObject({
|
|
147
|
+
code: external_exports.int().describe("The Feishu response code. 0 means success."),
|
|
148
|
+
msg: external_exports.string().describe("The Feishu response message."),
|
|
149
|
+
data: external_exports.looseObject({}).describe("A raw Feishu object payload."),
|
|
150
|
+
statusCode: external_exports.int().describe("The legacy response code returned for backward compatibility.").optional(),
|
|
151
|
+
statusMessage: external_exports.string().describe("The legacy response message returned for backward compatibility.").optional()
|
|
152
|
+
}).describe("The normalized Feishu custom bot send result.");
|
|
153
|
+
var sendShareChatMessageInput = external_exports.strictObject({
|
|
154
|
+
shareChatId: external_exports.string().min(1).describe("The Feishu chat ID used in the share_chat message payload.")
|
|
155
|
+
}).describe("Input for sending a Feishu shared-chat message.");
|
|
156
|
+
var sendShareChatMessageOutput = external_exports.strictObject({
|
|
157
|
+
code: external_exports.int().describe("The Feishu response code. 0 means success."),
|
|
158
|
+
msg: external_exports.string().describe("The Feishu response message."),
|
|
159
|
+
data: external_exports.looseObject({}).describe("A raw Feishu object payload."),
|
|
160
|
+
statusCode: external_exports.int().describe("The legacy response code returned for backward compatibility.").optional(),
|
|
161
|
+
statusMessage: external_exports.string().describe("The legacy response message returned for backward compatibility.").optional()
|
|
162
|
+
}).describe("The normalized Feishu custom bot send result.");
|
|
163
|
+
var sendInteractiveMessageInput = external_exports.strictObject({
|
|
164
|
+
card: external_exports.looseObject({}).describe("The Feishu interactive card payload sent as the top-level card object.")
|
|
165
|
+
}).describe("Input for sending a Feishu interactive card message.");
|
|
166
|
+
var sendInteractiveMessageOutput = external_exports.strictObject({
|
|
167
|
+
code: external_exports.int().describe("The Feishu response code. 0 means success."),
|
|
168
|
+
msg: external_exports.string().describe("The Feishu response message."),
|
|
169
|
+
data: external_exports.looseObject({}).describe("A raw Feishu object payload."),
|
|
170
|
+
statusCode: external_exports.int().describe("The legacy response code returned for backward compatibility.").optional(),
|
|
171
|
+
statusMessage: external_exports.string().describe("The legacy response message returned for backward compatibility.").optional()
|
|
172
|
+
}).describe("The normalized Feishu custom bot send result.");
|
|
173
|
+
var feishuCustomBotActions = {
|
|
174
|
+
send_text_message: {
|
|
175
|
+
description: "Send a text message through the Feishu/Lark custom bot webhook.",
|
|
176
|
+
effect: "write",
|
|
177
|
+
inputSchema: sendTextMessageInput,
|
|
178
|
+
outputSchema: external_exports.toJSONSchema(sendTextMessageOutput, { io: "output", unrepresentable: "any" })
|
|
179
|
+
},
|
|
180
|
+
send_post_message: {
|
|
181
|
+
description: "Send a post rich-text message through the Feishu/Lark custom bot webhook.",
|
|
182
|
+
effect: "write",
|
|
183
|
+
inputSchema: sendPostMessageInput,
|
|
184
|
+
outputSchema: external_exports.toJSONSchema(sendPostMessageOutput, { io: "output", unrepresentable: "any" })
|
|
185
|
+
},
|
|
186
|
+
send_image_message: {
|
|
187
|
+
description: "Send an image message through the Feishu/Lark custom bot webhook.",
|
|
188
|
+
effect: "write",
|
|
189
|
+
inputSchema: sendImageMessageInput,
|
|
190
|
+
outputSchema: external_exports.toJSONSchema(sendImageMessageOutput, { io: "output", unrepresentable: "any" })
|
|
191
|
+
},
|
|
192
|
+
send_share_chat_message: {
|
|
193
|
+
description: "Send a shared-chat card through the Feishu/Lark custom bot webhook.",
|
|
194
|
+
effect: "write",
|
|
195
|
+
inputSchema: sendShareChatMessageInput,
|
|
196
|
+
outputSchema: external_exports.toJSONSchema(sendShareChatMessageOutput, { io: "output", unrepresentable: "any" })
|
|
197
|
+
},
|
|
198
|
+
send_interactive_message: {
|
|
199
|
+
description: "Send an interactive card message through the Feishu/Lark custom bot webhook.",
|
|
200
|
+
effect: "write",
|
|
201
|
+
inputSchema: sendInteractiveMessageInput,
|
|
202
|
+
outputSchema: external_exports.toJSONSchema(sendInteractiveMessageOutput, { io: "output", unrepresentable: "any" })
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// ../plugins/src/feishu_custom_bot/index.ts
|
|
207
|
+
function createFeishuCustomBotPlugin() {
|
|
208
|
+
return createProviderPlugin({
|
|
209
|
+
description: "Feishu Custom Bot",
|
|
210
|
+
credentialFields: [
|
|
211
|
+
{
|
|
212
|
+
key: "webhook",
|
|
213
|
+
label: "Webhook",
|
|
214
|
+
required: true,
|
|
215
|
+
secret: true,
|
|
216
|
+
description: "\u7FA4\u673A\u5668\u4EBA\u7684 webhook \u5730\u5740(https://open.feishu.cn/open-apis/bot/v2/hook/<token>)\u6216\u5176 token"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
key: "signingSecret",
|
|
220
|
+
label: "Signing Secret",
|
|
221
|
+
required: false,
|
|
222
|
+
secret: true,
|
|
223
|
+
description: "\u7FA4\u673A\u5668\u4EBA\u5F00\u542F\u300C\u7B7E\u540D\u6821\u9A8C\u300D\u65F6\u7684\u5BC6\u94A5;\u672A\u5F00\u542F\u5219\u7559\u7A7A"
|
|
224
|
+
}
|
|
225
|
+
],
|
|
226
|
+
actions: feishuCustomBotActions,
|
|
227
|
+
handlers: {
|
|
228
|
+
send_text_message: sendTextMessage,
|
|
229
|
+
send_post_message: sendPostMessage,
|
|
230
|
+
send_image_message: sendImageMessage,
|
|
231
|
+
send_share_chat_message: sendShareChatMessage,
|
|
232
|
+
send_interactive_message: sendInteractiveMessage
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
var feishu_custom_bot_default = createFeishuCustomBotPlugin();
|
|
237
|
+
export {
|
|
238
|
+
createFeishuCustomBotPlugin,
|
|
239
|
+
feishu_custom_bot_default as default
|
|
240
|
+
};
|