@tool-bridge/server 0.1.0 → 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-6SMIQ6QU.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,212 @@
|
|
|
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/wolfram_alpha_api/api.ts
|
|
15
|
+
var SERVICE = "wolfram_alpha_api";
|
|
16
|
+
var API_BASE = "https://api.wolframalpha.com";
|
|
17
|
+
var RECOGNIZER_URL = "https://www.wolframalpha.com/queryrecognizer/query.jsp";
|
|
18
|
+
var REQUEST_TIMEOUT_MS = 3e4;
|
|
19
|
+
function text(value) {
|
|
20
|
+
if (typeof value !== "string") return void 0;
|
|
21
|
+
const trimmed = value.trim();
|
|
22
|
+
return trimmed === "" ? void 0 : trimmed;
|
|
23
|
+
}
|
|
24
|
+
function record(value) {
|
|
25
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
26
|
+
}
|
|
27
|
+
function nullableText(value) {
|
|
28
|
+
return text(value) ?? null;
|
|
29
|
+
}
|
|
30
|
+
function nullableNumber(value) {
|
|
31
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : null;
|
|
32
|
+
if (typeof value === "string") {
|
|
33
|
+
const parsed = Number(value);
|
|
34
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
function booleanLike(value) {
|
|
39
|
+
if (typeof value === "boolean") return value;
|
|
40
|
+
if (typeof value === "string") return value.toLowerCase() === "true";
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
function searchTerm(value) {
|
|
44
|
+
const query = text(value);
|
|
45
|
+
if (query === void 0) throw new TBError("invalid_argument", "query \u4E0D\u80FD\u662F\u7A7A\u767D");
|
|
46
|
+
return query;
|
|
47
|
+
}
|
|
48
|
+
function looksLikeCredentialError(body) {
|
|
49
|
+
const normalized = body.toLowerCase();
|
|
50
|
+
return normalized.includes("invalid appid") || normalized.includes("appid missing");
|
|
51
|
+
}
|
|
52
|
+
function wolframError(status, body) {
|
|
53
|
+
const message = body.trim() || `Wolfram|Alpha \u8FD4\u56DE HTTP ${status}`;
|
|
54
|
+
if (status === 400 || status === 501) return upstreamError(400, message);
|
|
55
|
+
if (status === 401 || status === 403 || looksLikeCredentialError(message)) return upstreamError(401, message);
|
|
56
|
+
return upstreamError(status, message);
|
|
57
|
+
}
|
|
58
|
+
async function requestText(url) {
|
|
59
|
+
let response;
|
|
60
|
+
try {
|
|
61
|
+
response = await guardedFetch(url, {
|
|
62
|
+
method: "GET",
|
|
63
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
64
|
+
});
|
|
65
|
+
} catch (error) {
|
|
66
|
+
if (error instanceof Error && error.name === "TimeoutError") {
|
|
67
|
+
throw upstreamError(504, `Wolfram|Alpha ${REQUEST_TIMEOUT_MS / 1e3} \u79D2\u5185\u6CA1\u6709\u8FD4\u56DE`);
|
|
68
|
+
}
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
const body = await response.text();
|
|
72
|
+
if (!response.ok) throw wolframError(response.status, body);
|
|
73
|
+
if (looksLikeCredentialError(body)) throw upstreamError(401, body.trim());
|
|
74
|
+
return body;
|
|
75
|
+
}
|
|
76
|
+
function authorizedUrl(base, ctx, params) {
|
|
77
|
+
const url = new URL(base);
|
|
78
|
+
url.searchParams.set("appid", requireApiKey(ctx, SERVICE));
|
|
79
|
+
for (const [key, value] of Object.entries(params)) {
|
|
80
|
+
if (value !== void 0) url.searchParams.set(key, value);
|
|
81
|
+
}
|
|
82
|
+
return url;
|
|
83
|
+
}
|
|
84
|
+
async function textQuery(path, ctx, params) {
|
|
85
|
+
const answer = await requestText(authorizedUrl(`${API_BASE}${path}`, ctx, params));
|
|
86
|
+
if (answer === "") {
|
|
87
|
+
throw new TBError("unavailable", "Wolfram|Alpha \u8FD4\u56DE\u4E86\u7A7A\u54CD\u5E94", { retryable: true });
|
|
88
|
+
}
|
|
89
|
+
return answer;
|
|
90
|
+
}
|
|
91
|
+
async function validateQuery(input, ctx) {
|
|
92
|
+
const query = searchTerm(input.query);
|
|
93
|
+
const mode = input.mode === "voice" ? "voice" : "default";
|
|
94
|
+
const url = authorizedUrl(RECOGNIZER_URL, ctx, { input: query, mode, output: "json" });
|
|
95
|
+
const body = await requestText(url);
|
|
96
|
+
let payload;
|
|
97
|
+
try {
|
|
98
|
+
payload = JSON.parse(body);
|
|
99
|
+
} catch {
|
|
100
|
+
throw new TBError("unavailable", "Wolfram|Alpha \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94", { retryable: true });
|
|
101
|
+
}
|
|
102
|
+
const result = record(payload);
|
|
103
|
+
const queries = result?.query;
|
|
104
|
+
const first = Array.isArray(queries) ? record(queries[0]) : void 0;
|
|
105
|
+
if (first === void 0) {
|
|
106
|
+
throw new TBError("unavailable", "Wolfram|Alpha recognizer \u6CA1\u6709\u8FD4\u56DE\u67E5\u8BE2\u7ED3\u679C", { retryable: true });
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
query,
|
|
110
|
+
mode,
|
|
111
|
+
accepted: booleanLike(first.accepted),
|
|
112
|
+
domain: nullableText(first.domain),
|
|
113
|
+
// timing 在**顶层**,不在 query[0] 里。
|
|
114
|
+
timingMs: nullableNumber(result?.timing),
|
|
115
|
+
resultSignificanceScore: nullableNumber(first.resultsignificancescore),
|
|
116
|
+
spellingCorrection: nullableText(first.spellingCorrection),
|
|
117
|
+
summaryBoxPath: nullableText(record(first.summarybox)?.path)
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
async function getShortAnswer(input, ctx) {
|
|
121
|
+
const query = searchTerm(input.query);
|
|
122
|
+
const answer = await textQuery("/v1/result", ctx, {
|
|
123
|
+
i: query,
|
|
124
|
+
units: input.units,
|
|
125
|
+
timeout: input.timeout === void 0 ? void 0 : String(input.timeout)
|
|
126
|
+
});
|
|
127
|
+
return { query, answer };
|
|
128
|
+
}
|
|
129
|
+
async function getSpokenResult(input, ctx) {
|
|
130
|
+
const query = searchTerm(input.query);
|
|
131
|
+
const result = await textQuery("/v1/spoken", ctx, {
|
|
132
|
+
i: query,
|
|
133
|
+
units: input.units,
|
|
134
|
+
timeout: input.timeout === void 0 ? void 0 : String(input.timeout)
|
|
135
|
+
});
|
|
136
|
+
return { query, result };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// ../plugins/src/wolfram_alpha_api/schema.ts
|
|
140
|
+
var validateQueryInput = external_exports.strictObject({
|
|
141
|
+
query: external_exports.string().min(1).describe("Natural-language query or mathematical expression sent to Wolfram|Alpha."),
|
|
142
|
+
mode: external_exports.enum(["default", "voice"]).describe("Recognizer mode. Use default for general queries or voice for spoken phrasing.").optional()
|
|
143
|
+
}).describe("Input parameters for validating whether Wolfram|Alpha can interpret a query.");
|
|
144
|
+
var validateQueryOutput = external_exports.strictObject({
|
|
145
|
+
query: external_exports.string().describe("Original query sent to the recognizer endpoint."),
|
|
146
|
+
mode: external_exports.enum(["default", "voice"]).describe("Recognizer mode. Use default for general queries or voice for spoken phrasing."),
|
|
147
|
+
accepted: external_exports.boolean().describe("Whether Wolfram|Alpha accepted the query."),
|
|
148
|
+
domain: external_exports.string().describe("Recognized Wolfram|Alpha domain for the query, when available.").nullable(),
|
|
149
|
+
timingMs: external_exports.number().describe("Recognizer timing value returned by Wolfram|Alpha in milliseconds.").nullable(),
|
|
150
|
+
resultSignificanceScore: external_exports.number().describe("Recognizer significance score returned by Wolfram|Alpha, when available.").nullable(),
|
|
151
|
+
spellingCorrection: external_exports.string().describe("Suggested spelling correction returned by Wolfram|Alpha, when available.").nullable(),
|
|
152
|
+
summaryBoxPath: external_exports.string().describe("Summary box path returned by Wolfram|Alpha, when available.").nullable()
|
|
153
|
+
}).describe("Normalized query validation result returned by Wolfram|Alpha.");
|
|
154
|
+
var getShortAnswerInput = external_exports.strictObject({
|
|
155
|
+
query: external_exports.string().min(1).describe("Natural-language query or mathematical expression sent to Wolfram|Alpha."),
|
|
156
|
+
units: external_exports.enum(["metric", "imperial"]).describe("Measurement system requested by Wolfram|Alpha for unit-sensitive answers.").optional(),
|
|
157
|
+
timeout: external_exports.int().min(1).describe("Maximum processing time in seconds accepted by Wolfram|Alpha.").optional()
|
|
158
|
+
}).describe("Input parameters for retrieving a concise short answer from Wolfram|Alpha.");
|
|
159
|
+
var getShortAnswerOutput = external_exports.strictObject({
|
|
160
|
+
query: external_exports.string().describe("Original query sent to the short answer endpoint."),
|
|
161
|
+
answer: external_exports.string().describe("Short textual answer returned by Wolfram|Alpha.")
|
|
162
|
+
}).describe("Normalized short answer payload returned by Wolfram|Alpha.");
|
|
163
|
+
var getSpokenResultInput = external_exports.strictObject({
|
|
164
|
+
query: external_exports.string().min(1).describe("Natural-language query or mathematical expression sent to Wolfram|Alpha."),
|
|
165
|
+
units: external_exports.enum(["metric", "imperial"]).describe("Measurement system requested by Wolfram|Alpha for unit-sensitive answers.").optional(),
|
|
166
|
+
timeout: external_exports.int().min(1).describe("Maximum processing time in seconds accepted by Wolfram|Alpha.").optional()
|
|
167
|
+
}).describe("Input parameters for retrieving a spoken-style result from Wolfram|Alpha.");
|
|
168
|
+
var getSpokenResultOutput = external_exports.strictObject({
|
|
169
|
+
query: external_exports.string().describe("Original query sent to the spoken result endpoint."),
|
|
170
|
+
result: external_exports.string().describe("Spoken-style text returned by Wolfram|Alpha.")
|
|
171
|
+
}).describe("Normalized spoken result payload returned by Wolfram|Alpha.");
|
|
172
|
+
var wolframAlphaApiActions = {
|
|
173
|
+
validate_query: {
|
|
174
|
+
description: "Validate whether Wolfram|Alpha can interpret a query.",
|
|
175
|
+
effect: "write",
|
|
176
|
+
inputSchema: validateQueryInput,
|
|
177
|
+
outputSchema: external_exports.toJSONSchema(validateQueryOutput, { io: "output", unrepresentable: "any" })
|
|
178
|
+
},
|
|
179
|
+
get_short_answer: {
|
|
180
|
+
description: "Get a concise short answer from Wolfram|Alpha.",
|
|
181
|
+
effect: "read",
|
|
182
|
+
inputSchema: getShortAnswerInput,
|
|
183
|
+
outputSchema: external_exports.toJSONSchema(getShortAnswerOutput, { io: "output", unrepresentable: "any" })
|
|
184
|
+
},
|
|
185
|
+
get_spoken_result: {
|
|
186
|
+
description: "Get a spoken-style single-sentence result from Wolfram|Alpha.",
|
|
187
|
+
effect: "read",
|
|
188
|
+
inputSchema: getSpokenResultInput,
|
|
189
|
+
outputSchema: external_exports.toJSONSchema(getSpokenResultOutput, { io: "output", unrepresentable: "any" })
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// ../plugins/src/wolfram_alpha_api/index.ts
|
|
194
|
+
function createWolframAlphaApiPlugin() {
|
|
195
|
+
return createProviderPlugin({
|
|
196
|
+
description: "Wolfram|Alpha",
|
|
197
|
+
actions: wolframAlphaApiActions,
|
|
198
|
+
// 不设 credentialProbe:三个 action 都必填 `query`,平台空参调探针会被 Zod 拦成
|
|
199
|
+
// invalid_argument —— 那个错误看起来像凭证问题,实际是探针选错了。上游
|
|
200
|
+
// credentialValidators 打的 queryrecognizer 端点同样要带 input,没有"空转"调用。
|
|
201
|
+
handlers: {
|
|
202
|
+
validate_query: validateQuery,
|
|
203
|
+
get_short_answer: getShortAnswer,
|
|
204
|
+
get_spoken_result: getSpokenResult
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
var wolfram_alpha_api_default = createWolframAlphaApiPlugin();
|
|
209
|
+
export {
|
|
210
|
+
createWolframAlphaApiPlugin,
|
|
211
|
+
wolfram_alpha_api_default as default
|
|
212
|
+
};
|