@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,287 @@
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/ipqualityscore/api.ts
15
+ var SERVICE = "ipqualityscore";
16
+ var API_BASE = "https://www.ipqualityscore.com";
17
+ var IP_LITERAL = external_exports.union([external_exports.ipv4(), external_exports.ipv6()]);
18
+ function optionalText(value) {
19
+ return value?.trim() || void 0;
20
+ }
21
+ function pathValue(value, field) {
22
+ const trimmed = value.trim();
23
+ if (trimmed === "") throw new TBError("invalid_argument", `${field} \u4E0D\u80FD\u4E3A\u7A7A`);
24
+ return trimmed;
25
+ }
26
+ function messageOf(payload) {
27
+ if (typeof payload === "string") return optionalText(payload);
28
+ if (payload === null || typeof payload !== "object" || Array.isArray(payload)) return void 0;
29
+ const record = payload;
30
+ const pick = (value) => typeof value === "string" ? optionalText(value) : void 0;
31
+ return pick(record.message) ?? pick(record.error);
32
+ }
33
+ function ipqsError(response, payload) {
34
+ const message = messageOf(payload) ?? optionalText(response.statusText) ?? `IPQualityScore request failed with ${response.status}`;
35
+ const lower = message.toLowerCase();
36
+ if (response.status === 429 || response.status === 402 || lower.includes("insufficient credits")) {
37
+ return upstreamError(429, message);
38
+ }
39
+ if (lower.includes("invalid api key") || lower.includes("api key") || response.status === 401 || response.status === 403) {
40
+ return upstreamError(401, message);
41
+ }
42
+ if (response.status === 400 || lower.includes("invalid ip") || lower.includes("invalid email") || lower.includes("invalid phone") || lower.includes("invalid url")) {
43
+ return upstreamError(400, message);
44
+ }
45
+ return upstreamError(response.status >= 400 ? response.status : 502, message);
46
+ }
47
+ async function readPayload(response) {
48
+ const body = await response.text();
49
+ if (body === "") return null;
50
+ try {
51
+ return JSON.parse(body);
52
+ } catch {
53
+ return body;
54
+ }
55
+ }
56
+ async function request(ctx, family, value, query = []) {
57
+ const path = `/api/json/${family}/${encodeURIComponent(requireApiKey(ctx, SERVICE))}/${encodeURIComponent(value)}`;
58
+ const url = new URL(path, API_BASE);
59
+ for (const [key, queryValue] of query) {
60
+ if (queryValue !== void 0) url.searchParams.append(key, queryValue);
61
+ }
62
+ let response;
63
+ let payload;
64
+ try {
65
+ response = await guardedFetch(url.toString(), {
66
+ method: "GET",
67
+ headers: { accept: "application/json" }
68
+ });
69
+ payload = await readPayload(response);
70
+ } catch (error) {
71
+ throw new TBError(
72
+ "unavailable",
73
+ error instanceof Error ? `IPQualityScore \u8BF7\u6C42\u5931\u8D25: ${error.message}` : "IPQualityScore \u8BF7\u6C42\u5931\u8D25",
74
+ { retryable: true }
75
+ );
76
+ }
77
+ if (!response.ok) throw ipqsError(response, payload);
78
+ if (payload === null || typeof payload !== "object" || Array.isArray(payload)) {
79
+ throw new TBError("unavailable", `IPQualityScore \u5BF9 ${family} \u7684\u54CD\u5E94\u4E0D\u662F JSON \u5BF9\u8C61`, { retryable: true });
80
+ }
81
+ if (payload.success === false) throw ipqsError(response, payload);
82
+ return payload;
83
+ }
84
+ async function checkIpReputation(input, ctx) {
85
+ const ipAddress = pathValue(input.ipAddress, "ipAddress");
86
+ if (!IP_LITERAL.safeParse(ipAddress).success) {
87
+ throw new TBError("invalid_argument", "ipAddress \u5FC5\u987B\u662F\u5408\u6CD5\u7684 IPv4 \u6216 IPv6 \u5730\u5740");
88
+ }
89
+ return await request(ctx, "ip", ipAddress, [
90
+ ["strictness", input.strictness?.toString()],
91
+ ["allow_public_access_points", input.allowPublicAccessPoints?.toString()],
92
+ ["user_agent", optionalText(input.userAgent)],
93
+ ["user_language", optionalText(input.userLanguage)]
94
+ ]);
95
+ }
96
+ async function validateEmail(input, ctx) {
97
+ return await request(ctx, "email", pathValue(input.email, "email"), [
98
+ ["timeout", input.timeout?.toString()],
99
+ ["abuse_strictness", input.abuseStrictness?.toString()]
100
+ ]);
101
+ }
102
+ async function validatePhone(input, ctx) {
103
+ return await request(ctx, "phone", pathValue(input.phone, "phone"), [
104
+ ["strictness", input.strictness?.toString()],
105
+ // 多个候选国家是重复的 `country[]`,且上游只认大写的 ISO alpha-2。
106
+ ...(input.country ?? []).map((code) => ["country[]", code.toUpperCase()])
107
+ ]);
108
+ }
109
+ async function scanUrl(input, ctx) {
110
+ return await request(ctx, "url", pathValue(input.url, "url"), [
111
+ ["strictness", input.strictness?.toString()]
112
+ ]);
113
+ }
114
+
115
+ // ../plugins/src/ipqualityscore/schema.ts
116
+ var checkIpReputationInput = external_exports.strictObject({
117
+ ipAddress: external_exports.string().min(1).describe("The IPv4 or IPv6 address to inspect."),
118
+ strictness: external_exports.int().min(0).max(3).describe("How strict IPQS should be when scoring the lookup. Higher values may increase false positives.").optional(),
119
+ allowPublicAccessPoints: external_exports.boolean().describe("Whether to reduce risk flags for public access points such as schools or libraries.").optional(),
120
+ userAgent: external_exports.string().min(1).describe("The user agent associated with the IP lookup.").optional(),
121
+ userLanguage: external_exports.string().min(1).describe("The browser language associated with the IP lookup.").optional()
122
+ }).describe("Input for checking IP address reputation with IPQualityScore.");
123
+ var checkIpReputationOutput = external_exports.looseObject({
124
+ success: external_exports.boolean().describe("Whether IPQS completed the IP reputation lookup successfully."),
125
+ message: external_exports.string().describe("Human-readable status message returned by IPQS."),
126
+ fraud_score: external_exports.int().min(0).max(100).describe("The risk score returned by IPQS from 0 to 100."),
127
+ country_code: external_exports.string().describe("The two-letter country code associated with the IP.").nullable().optional(),
128
+ region: external_exports.string().describe("The region associated with the IP.").nullable().optional(),
129
+ city: external_exports.string().describe("The city associated with the IP.").nullable().optional(),
130
+ ISP: external_exports.string().describe("The internet service provider associated with the IP.").nullable().optional(),
131
+ ASN: external_exports.int().describe("The autonomous system number associated with the IP.").nullable().optional(),
132
+ organization: external_exports.string().describe("The organization associated with the IP.").nullable().optional(),
133
+ is_crawler: external_exports.boolean().describe("Whether IPQS identified the IP as a crawler.").optional(),
134
+ timezone: external_exports.string().describe("The timezone associated with the IP.").nullable().optional(),
135
+ mobile: external_exports.boolean().describe("Whether the IP appears to belong to a mobile connection.").optional(),
136
+ host: external_exports.string().describe("The host associated with the IP.").nullable().optional(),
137
+ proxy: external_exports.boolean().describe("Whether IPQS identified the IP as a proxy.").optional(),
138
+ vpn: external_exports.boolean().describe("Whether IPQS identified the IP as a VPN.").optional(),
139
+ tor: external_exports.boolean().describe("Whether IPQS identified the IP as Tor.").optional(),
140
+ active_vpn: external_exports.boolean().describe("Whether IPQS identified an active VPN connection.").optional(),
141
+ active_tor: external_exports.boolean().describe("Whether IPQS identified an active Tor connection.").optional(),
142
+ recent_abuse: external_exports.boolean().describe("Whether IPQS has seen recent abuse from the IP.").optional(),
143
+ bot_status: external_exports.boolean().describe("Whether IPQS identified bot behavior for the IP.").optional(),
144
+ connection_type: external_exports.string().describe("The connection type associated with the IP.").nullable().optional(),
145
+ abuse_velocity: external_exports.string().describe("The recent abuse velocity associated with the IP.").nullable().optional(),
146
+ request_id: external_exports.string().describe("The IPQS request identifier for support and tracing.").optional()
147
+ }).describe("IP reputation result returned by IPQualityScore.");
148
+ var validateEmailInput = external_exports.strictObject({
149
+ email: external_exports.email().describe("The email address to validate."),
150
+ timeout: external_exports.int().min(1).max(60).describe("Maximum number of seconds IPQS should spend on mail service provider checks.").optional(),
151
+ abuseStrictness: external_exports.int().min(0).max(3).describe("How strict IPQS should be when scoring the lookup. Higher values may increase false positives.").optional()
152
+ }).describe("Input for validating an email address with IPQualityScore.");
153
+ var validateEmailOutput = external_exports.looseObject({
154
+ success: external_exports.boolean().describe("Whether IPQS completed the email validation lookup successfully."),
155
+ message: external_exports.string().describe("Human-readable status message returned by IPQS."),
156
+ valid: external_exports.boolean().describe("Whether IPQS considers the email address valid."),
157
+ disposable: external_exports.boolean().describe("Whether the email address belongs to a disposable email provider.").optional(),
158
+ smtp_score: external_exports.int().describe("The SMTP deliverability score returned by IPQS.").nullable().optional(),
159
+ overall_score: external_exports.int().describe("The overall email quality score returned by IPQS.").nullable().optional(),
160
+ first_name: external_exports.string().describe("The first name inferred by IPQS, when available.").nullable().optional(),
161
+ generic: external_exports.boolean().describe("Whether IPQS considers the email address generic.").optional(),
162
+ common: external_exports.boolean().describe("Whether the email address is commonly used.").optional(),
163
+ dns_valid: external_exports.boolean().describe("Whether DNS records for the email domain are valid.").optional(),
164
+ honeypot: external_exports.boolean().describe("Whether IPQS identified the email as a honeypot.").optional(),
165
+ deliverability: external_exports.string().describe("The deliverability classification returned by IPQS.").nullable().optional(),
166
+ frequent_complainer: external_exports.boolean().describe("Whether the email is associated with frequent complaints.").optional(),
167
+ spam_trap_score: external_exports.string().describe("The spam trap score returned by IPQS.").nullable().optional(),
168
+ catch_all: external_exports.boolean().describe("Whether the email domain accepts all mailbox names.").optional(),
169
+ timed_out: external_exports.boolean().describe("Whether IPQS timed out during provider checks.").optional(),
170
+ suspect: external_exports.boolean().describe("Whether IPQS considers the email suspicious.").optional(),
171
+ recent_abuse: external_exports.boolean().describe("Whether IPQS has seen recent abuse for the email.").optional(),
172
+ fraud_score: external_exports.int().min(0).max(100).describe("The risk score returned by IPQS from 0 to 100.").optional(),
173
+ suggested_domain: external_exports.string().describe("Suggested corrected domain for possible typos.").nullable().optional(),
174
+ leaked: external_exports.boolean().describe("Whether IPQS found the email in leaked data.").optional(),
175
+ sanitized_email: external_exports.email().describe("The normalized email address returned by IPQS.").optional(),
176
+ request_id: external_exports.string().describe("The IPQS request identifier for support and tracing.").optional()
177
+ }).describe("Email validation result returned by IPQualityScore.");
178
+ var validatePhoneInput = external_exports.strictObject({
179
+ phone: external_exports.string().min(1).describe("The phone number to validate."),
180
+ country: external_exports.array(external_exports.string().min(2).max(2).regex(new RegExp("^[A-Za-z]{2}$")).describe("An ISO 3166-1 alpha-2 country code.")).min(1).describe("Optional ISO 3166-1 alpha-2 countries to use when interpreting local numbers.").optional(),
181
+ strictness: external_exports.int().min(0).max(3).describe("How strict IPQS should be when scoring the lookup. Higher values may increase false positives.").optional()
182
+ }).describe("Input for validating a phone number with IPQualityScore.");
183
+ var validatePhoneOutput = external_exports.looseObject({
184
+ success: external_exports.boolean().describe("Whether IPQS completed the phone validation lookup successfully."),
185
+ message: external_exports.string().describe("Human-readable status message returned by IPQS."),
186
+ formatted: external_exports.string().describe("The formatted phone number returned by IPQS.").nullable().optional(),
187
+ local_format: external_exports.string().describe("The local phone number format returned by IPQS.").nullable().optional(),
188
+ valid: external_exports.boolean().describe("Whether IPQS considers the phone number valid."),
189
+ fraud_score: external_exports.int().min(0).max(100).describe("The risk score returned by IPQS from 0 to 100.").optional(),
190
+ recent_abuse: external_exports.boolean().describe("Whether IPQS has seen recent abuse for the phone number.").optional(),
191
+ VOIP: external_exports.boolean().describe("Whether the phone number appears to be a VoIP number.").optional(),
192
+ prepaid: external_exports.boolean().describe("Whether the phone number appears to be prepaid.").optional(),
193
+ risky: external_exports.boolean().describe("Whether IPQS considers the phone number risky.").optional(),
194
+ active: external_exports.boolean().describe("Whether IPQS considers the phone number active.").optional(),
195
+ name: external_exports.string().describe("The phone owner name returned by IPQS, when available.").nullable().optional(),
196
+ carrier: external_exports.string().describe("The carrier associated with the phone number.").nullable().optional(),
197
+ line_type: external_exports.string().describe("The line type associated with the phone number.").nullable().optional(),
198
+ country: external_exports.string().describe("The country associated with the phone number.").nullable().optional(),
199
+ city: external_exports.string().describe("The city associated with the phone number.").nullable().optional(),
200
+ zip_code: external_exports.string().describe("The postal code associated with the phone number.").nullable().optional(),
201
+ region: external_exports.string().describe("The region associated with the phone number.").nullable().optional(),
202
+ dialing_code: external_exports.int().describe("The international dialing code associated with the phone number.").nullable().optional(),
203
+ sms_pumping: external_exports.looseObject({
204
+ risk_score: external_exports.int().min(0).max(100).describe("The risk score returned by IPQS from 0 to 100.").optional(),
205
+ message: external_exports.string().describe("Human-readable SMS pumping risk message returned by IPQS.").optional(),
206
+ velocity: external_exports.string().describe("SMS pumping velocity classification returned by IPQS.").optional()
207
+ }).describe("SMS pumping risk details returned by IPQS.").optional(),
208
+ request_id: external_exports.string().describe("The IPQS request identifier for support and tracing.").optional()
209
+ }).describe("Phone validation result returned by IPQualityScore.");
210
+ var scanUrlInput = external_exports.strictObject({
211
+ url: external_exports.string().min(1).describe("The URL or domain to scan."),
212
+ strictness: external_exports.int().min(0).max(2).describe("How strict IPQS should be when scanning the URL. Higher values may increase false positives.").optional()
213
+ }).describe("Input for scanning a URL or domain with IPQualityScore.");
214
+ var scanUrlOutput = external_exports.looseObject({
215
+ success: external_exports.boolean().describe("Whether IPQS completed the URL scan successfully."),
216
+ message: external_exports.string().describe("Human-readable status message returned by IPQS."),
217
+ unsafe: external_exports.boolean().describe("Whether IPQS considers the URL unsafe."),
218
+ domain: external_exports.string().describe("The domain parsed from the submitted URL.").nullable().optional(),
219
+ root_domain: external_exports.string().describe("The root domain parsed from the submitted URL.").nullable().optional(),
220
+ ip_address: external_exports.string().describe("The IP address associated with the domain.").nullable().optional(),
221
+ server: external_exports.string().describe("The server header or hosting stack returned by IPQS.").nullable().optional(),
222
+ content_type: external_exports.string().describe("The content type returned by IPQS.").nullable().optional(),
223
+ status_code: external_exports.int().describe("The HTTP status code returned by IPQS.").nullable().optional(),
224
+ page_size: external_exports.int().describe("The page size returned by IPQS.").nullable().optional(),
225
+ domain_rank: external_exports.int().describe("The domain rank returned by IPQS.").nullable().optional(),
226
+ dns_valid: external_exports.boolean().describe("Whether DNS records for the domain are valid.").optional(),
227
+ parking: external_exports.boolean().describe("Whether IPQS considers the domain parked.").optional(),
228
+ spamming: external_exports.boolean().describe("Whether IPQS associates the URL with spam.").optional(),
229
+ malware: external_exports.boolean().describe("Whether IPQS associates the URL with malware.").optional(),
230
+ phishing: external_exports.boolean().describe("Whether IPQS associates the URL with phishing.").optional(),
231
+ suspicious: external_exports.boolean().describe("Whether IPQS considers the URL suspicious.").optional(),
232
+ adult: external_exports.boolean().describe("Whether IPQS classifies the URL as adult content.").optional(),
233
+ risk_score: external_exports.int().min(0).max(100).describe("The risk score returned by IPQS from 0 to 100.").optional(),
234
+ domain_age: external_exports.looseObject({
235
+ human: external_exports.string().describe("Human-readable domain age returned by IPQS.").nullable().optional(),
236
+ timestamp: external_exports.int().describe("Domain creation timestamp returned by IPQS.").nullable().optional(),
237
+ iso: external_exports.string().describe("Domain creation date returned by IPQS.").nullable().optional()
238
+ }).describe("Domain age details returned by IPQualityScore.").optional(),
239
+ category: external_exports.string().describe("The content category returned by IPQS.").nullable().optional(),
240
+ domain_trust: external_exports.string().describe("The domain trust classification returned by IPQS.").nullable().optional(),
241
+ request_id: external_exports.string().describe("The IPQS request identifier for support and tracing.").optional()
242
+ }).describe("URL reputation result returned by IPQualityScore.");
243
+ var ipqualityscoreActions = {
244
+ check_ip_reputation: {
245
+ description: "Check an IP address for proxy, VPN, Tor, bot, and abuse risk signals.",
246
+ effect: "read",
247
+ inputSchema: checkIpReputationInput,
248
+ outputSchema: external_exports.toJSONSchema(checkIpReputationOutput, { io: "output", unrepresentable: "any" })
249
+ },
250
+ validate_email: {
251
+ description: "Validate an email address and return deliverability and abuse risk signals.",
252
+ effect: "write",
253
+ inputSchema: validateEmailInput,
254
+ outputSchema: external_exports.toJSONSchema(validateEmailOutput, { io: "output", unrepresentable: "any" })
255
+ },
256
+ validate_phone: {
257
+ description: "Validate a phone number and return carrier, activity, and risk signals.",
258
+ effect: "write",
259
+ inputSchema: validatePhoneInput,
260
+ outputSchema: external_exports.toJSONSchema(validatePhoneOutput, { io: "output", unrepresentable: "any" })
261
+ },
262
+ scan_url: {
263
+ description: "Scan a URL or domain and return malware, phishing, and domain risk signals.",
264
+ effect: "write",
265
+ inputSchema: scanUrlInput,
266
+ outputSchema: external_exports.toJSONSchema(scanUrlOutput, { io: "output", unrepresentable: "any" })
267
+ }
268
+ };
269
+
270
+ // ../plugins/src/ipqualityscore/index.ts
271
+ function createIpqualityscorePlugin() {
272
+ return createProviderPlugin({
273
+ description: "IPQualityScore",
274
+ actions: ipqualityscoreActions,
275
+ handlers: {
276
+ check_ip_reputation: checkIpReputation,
277
+ validate_email: validateEmail,
278
+ validate_phone: validatePhone,
279
+ scan_url: scanUrl
280
+ }
281
+ });
282
+ }
283
+ var ipqualityscore_default = createIpqualityscorePlugin();
284
+ export {
285
+ createIpqualityscorePlugin,
286
+ ipqualityscore_default as default
287
+ };
@@ -0,0 +1,119 @@
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/jina_ai/api.ts
15
+ var SERVICE = "jina_ai";
16
+ var API_BASE = "https://api.jina.ai";
17
+ var REQUEST_TIMEOUT_MS = 3e4;
18
+ function record(value) {
19
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
20
+ }
21
+ function text(value) {
22
+ if (typeof value !== "string") return void 0;
23
+ const trimmed = value.trim();
24
+ return trimmed === "" ? void 0 : trimmed;
25
+ }
26
+ function errorMessage(status, body, payload) {
27
+ const top = record(payload);
28
+ return text(top?.detail) ?? text(top?.message) ?? text(body) ?? `Jina AI request failed with ${status}`;
29
+ }
30
+ async function request(ctx, path, body) {
31
+ const apiKey = requireApiKey(ctx, SERVICE);
32
+ const timeoutSignal = AbortSignal.timeout(REQUEST_TIMEOUT_MS);
33
+ let response;
34
+ try {
35
+ response = await guardedFetch(`${API_BASE}${path}`, {
36
+ method: "POST",
37
+ headers: {
38
+ "accept": "application/json",
39
+ "authorization": `Bearer ${apiKey}`,
40
+ "content-type": "application/json"
41
+ },
42
+ body: JSON.stringify(body),
43
+ signal: timeoutSignal
44
+ });
45
+ } catch (error) {
46
+ if (error instanceof TBError) throw error;
47
+ if (timeoutSignal.aborted) throw upstreamError(504, `Jina AI ${REQUEST_TIMEOUT_MS / 1e3}s \u5185\u6CA1\u6709\u8FD4\u56DE`);
48
+ const message = error instanceof Error ? error.message : "unknown network error";
49
+ throw upstreamError(502, `Jina AI \u8BF7\u6C42\u5931\u8D25: ${message}`);
50
+ }
51
+ const raw = await response.text();
52
+ let payload = null;
53
+ if (raw !== "") {
54
+ try {
55
+ payload = JSON.parse(raw);
56
+ } catch {
57
+ if (response.ok) {
58
+ throw new TBError("unavailable", "Jina AI \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94", { retryable: true });
59
+ }
60
+ }
61
+ }
62
+ if (!response.ok) throw upstreamError(response.status, errorMessage(response.status, raw, payload));
63
+ return payload;
64
+ }
65
+ async function createEmbeddings(input, ctx) {
66
+ return request(ctx, "/v1/embeddings", input);
67
+ }
68
+ async function rerankDocuments(input, ctx) {
69
+ return request(ctx, "/v1/rerank", input);
70
+ }
71
+
72
+ // ../plugins/src/jina_ai/schema.ts
73
+ var createEmbeddingsInput = external_exports.strictObject({
74
+ model: external_exports.string().describe("The Jina AI embedding model identifier."),
75
+ input: external_exports.array(external_exports.union([external_exports.string().describe("Text to embed."), external_exports.looseObject({}).describe("A JSON object returned by Jina AI.")]).describe("A text or multimodal embedding input.")).min(1).describe("The texts or multimodal inputs to embed."),
76
+ encoding_format: external_exports.string().describe("The encoding format for returned embeddings.").optional(),
77
+ dimensions: external_exports.int().describe("The requested embedding dimensionality.").optional(),
78
+ normalized: external_exports.boolean().describe("Whether returned embeddings should be normalized.").optional()
79
+ }).describe("Input for generating embeddings with Jina AI.");
80
+ var createEmbeddingsOutput = external_exports.looseObject({}).describe("A JSON object returned by Jina AI.");
81
+ var rerankDocumentsInput = external_exports.strictObject({
82
+ model: external_exports.string().describe("The Jina AI reranker model identifier."),
83
+ query: external_exports.string().describe("The query used to rank documents."),
84
+ documents: external_exports.array(external_exports.string().describe("A document to rank.")).min(1).describe("The documents to rank."),
85
+ top_n: external_exports.int().describe("The maximum number of results to return.").optional(),
86
+ return_documents: external_exports.boolean().describe("Whether to include document text in each result.").optional()
87
+ }).describe("Input for ranking documents by relevance with Jina AI.");
88
+ var rerankDocumentsOutput = external_exports.looseObject({}).describe("A JSON object returned by Jina AI.");
89
+ var jinaAiActions = {
90
+ create_embeddings: {
91
+ description: "Create vector embeddings for text or multimodal inputs with Jina AI.",
92
+ effect: "write",
93
+ inputSchema: createEmbeddingsInput,
94
+ outputSchema: external_exports.toJSONSchema(createEmbeddingsOutput, { io: "output", unrepresentable: "any" })
95
+ },
96
+ rerank_documents: {
97
+ description: "Rank documents by relevance to a query with Jina AI.",
98
+ effect: "write",
99
+ inputSchema: rerankDocumentsInput,
100
+ outputSchema: external_exports.toJSONSchema(rerankDocumentsOutput, { io: "output", unrepresentable: "any" })
101
+ }
102
+ };
103
+
104
+ // ../plugins/src/jina_ai/index.ts
105
+ function createJinaAiPlugin() {
106
+ return createProviderPlugin({
107
+ description: "Jina AI",
108
+ actions: jinaAiActions,
109
+ handlers: {
110
+ create_embeddings: createEmbeddings,
111
+ rerank_documents: rerankDocuments
112
+ }
113
+ });
114
+ }
115
+ var jina_ai_default = createJinaAiPlugin();
116
+ export {
117
+ createJinaAiPlugin,
118
+ jina_ai_default as default
119
+ };