@tool-bridge/server 0.21.1 → 0.23.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/admin.js +170 -0
- package/dist/airtable-VMQVXLHK.js +790 -0
- package/dist/{alt_text_generator_ai-W7O34SNG.js → alt_text_generator_ai-FTWY4RU4.js} +12 -11
- package/dist/{amap-VOX4T2AW.js → amap-OK5VBHYC.js} +221 -220
- package/dist/anthropic-S67AZFZ3.js +203 -0
- package/dist/apify-ZE6MYQI3.js +248 -0
- package/dist/brave_search-TG2M2KOD.js +302 -0
- package/dist/chunk-2JNAI4OC.js +161 -0
- package/dist/{chunk-KMTT3I6D.js → chunk-4XJPN3DY.js} +19392 -26136
- package/dist/chunk-5ICRY3VU.js +8432 -0
- package/dist/chunk-7CTWGTDU.js +302 -0
- package/dist/chunk-BADVCN6K.js +378 -0
- package/dist/{chunk-XYBU3WZH.js → chunk-TDAWLMDE.js} +3 -3
- package/dist/chunk-U7PTOA3U.js +7320 -0
- package/dist/{chunk-E6JCVKW6.js → chunk-VWRUGUSU.js} +3 -3
- package/dist/{chunk-ATK45BXV.js → chunk-WJHG6OK7.js} +4 -2
- package/dist/circleci-3L3WJVSK.js +389 -0
- package/dist/clerk-EZPF2V7T.js +1019 -0
- package/dist/cohere-U27DPO64.js +185 -0
- package/dist/{confluence-B3EWPZVE.js → confluence-G2KL6ERH.js} +105 -104
- package/dist/{convertapi-EUWSQYPF.js → convertapi-L4CLJ2M3.js} +32 -31
- package/dist/{currencyapi-KVTIK3GL.js → currencyapi-YPYXG7YY.js} +71 -71
- package/dist/deepseek-6HT6WF3M.js +210 -0
- package/dist/docker_hub-LPE3PCVB.js +933 -0
- package/dist/dropbox-V56ABHTA.js +1305 -0
- package/dist/dub-6OKQ7MHT.js +680 -0
- package/dist/e2b-JS2U2QFU.js +278 -0
- package/dist/exa-DPWVYXSP.js +332 -0
- package/dist/{fal_ai-23E7JPNT.js → fal_ai-DK6Y27ZF.js} +81 -80
- package/dist/{feishu-7QRIDUV6.js → feishu-K7EGSRF3.js} +528 -572
- package/dist/{feishu_custom_bot-TJ4K7QNJ.js → feishu_custom_bot-2JUGFYNG.js} +57 -53
- package/dist/figma-FT5I7ITD.js +777 -0
- package/dist/firehydrant-EIKLKHX2.js +563 -0
- package/dist/{fixer-BWON27UO.js → fixer-U5QXIAKD.js} +34 -33
- package/dist/fly-T3JYFZ2M.js +469 -0
- package/dist/{front-QCGXYEDJ.js → front-D72MGVOR.js} +104 -104
- package/dist/geocodio-BOTD5TI5.js +213 -0
- package/dist/ghost-KYP7SZGB.js +338 -0
- package/dist/github-AGMZT3VY.js +5421 -0
- package/dist/gmail-BLJNJOBG.js +1887 -0
- package/dist/googlecalendar-GTHWNCF6.js +2524 -0
- package/dist/{googledocs-BUHL4J2H.js → googledocs-6EEDMEBQ.js} +341 -340
- package/dist/{grafana-GLU2DWF2.js → grafana-GMW6EKSQ.js} +221 -220
- package/dist/graphhopper-6OLGBDGB.js +325 -0
- package/dist/index.d.ts +1132 -332
- package/dist/index.js +31 -14
- package/dist/{ip2proxy-EZ64Y4ZH.js → ip2proxy-4QN42E6T.js} +28 -27
- package/dist/ipgeolocation_io-SK4XKDA2.js +315 -0
- package/dist/ipqualityscore-6ANBPXKT.js +279 -0
- package/dist/{jina_ai-EFBHTBXL.js → jina_ai-IHPSVRM5.js} +23 -23
- package/dist/{jira-HQSHAA5K.js → jira-46KKM4LC.js} +118 -117
- package/dist/langsmith-JZA345I5.js +593 -0
- package/dist/lemlist-43IV7DK6.js +289 -0
- package/dist/{linear-K7RYFYAD.js → linear-5LFH7XNL.js} +327 -326
- package/dist/logsnag-5RMYAHIL.js +150 -0
- package/dist/main.js +57 -280
- package/dist/{mattermost-S2BRCWLQ.js → mattermost-XFL6SHGG.js} +59 -58
- package/dist/mem0-NYO4DTP6.js +544 -0
- package/dist/memos-37MPQOLV.js +744 -0
- package/dist/{metabase-MMSEPCOF.js → metabase-KYBKZFMG.js} +90 -89
- package/dist/mistral_ai-6PL3K4PM.js +1196 -0
- package/dist/{mother_duck-H7PCQNZ2.js → mother_duck-2NH7W5M5.js} +94 -93
- package/dist/ngrok-UO6CDYCA.js +356 -0
- package/dist/{notes-PFMKRO33.js → notes-I3P32WP4.js} +11 -9
- package/dist/notion-BEAJFUOE.js +940 -0
- package/dist/open_exchange_rates-CMF62JB4.js +215 -0
- package/dist/openai-IHOMKVND.js +800 -0
- package/dist/opengraph_io-ZQ2FGLHX.js +362 -0
- package/dist/openrouter-HXLW3NR5.js +441 -0
- package/dist/outline-ELCP4NEU.js +599 -0
- package/dist/paddle-O77LALVN.js +454 -0
- package/dist/perplexity-JCU654QV.js +220 -0
- package/dist/pinecone-W5W4LRKL.js +571 -0
- package/dist/{pipedrive-Y2O7QGFF.js → pipedrive-ITMJLLPZ.js} +99 -98
- package/dist/polar-R33XU4L3.js +395 -0
- package/dist/posthog-JVNTOLTV.js +3464 -0
- package/dist/postmark-6SBG7HWV.js +427 -0
- package/dist/{prerender-MENYM2TY.js → prerender-GPNKTNFC.js} +31 -30
- package/dist/{pubmed-GOXUVVH5.js → pubmed-UP6ZEEIH.js} +239 -238
- package/dist/{railway-V2SID4WV.js → railway-KWEWXHTY.js} +118 -117
- package/dist/readwise-BLATSMC3.js +470 -0
- package/dist/render-QYRVIXII.js +461 -0
- package/dist/{replicate-756MXPYX.js → replicate-JYTWH4NF.js} +81 -80
- package/dist/{resend-ZKH3BTBI.js → resend-L5N75SZM.js} +20 -16
- package/dist/rootly-MHCPEQ26.js +336 -0
- package/dist/{scrapfly-NSRHFDIQ.js → scrapfly-PTPGYSJM.js} +62 -61
- package/dist/{scrapingbee-OQHLAVEY.js → scrapingbee-JN6UH5PY.js} +56 -56
- package/dist/{screenshot_fyi-DVWG3AXC.js → screenshot_fyi-4QRVSV55.js} +16 -16
- package/dist/semantic_scholar-LRSWA2GE.js +611 -0
- package/dist/{sentry-546MNDJG.js → sentry-2G6PF5W6.js} +208 -207
- package/dist/{shodan-C3OON3Z3.js → shodan-WKKPP5C6.js} +62 -61
- package/dist/shopify-64YDK5T2.js +610 -0
- package/dist/stripe-QAIGGOTF.js +585 -0
- package/dist/{supabase-U2SL4D63.js → supabase-WHTGR6ND.js} +245 -244
- package/dist/tavily-QIXCDDWO.js +326 -0
- package/dist/telegram-E6G7CWI6.js +1767 -0
- package/dist/{telnyx-CXQ4EZUX.js → telnyx-ZDVVS7PK.js} +57 -56
- package/dist/todoist-DMYF3G7J.js +664 -0
- package/dist/trello-HY2RYIRP.js +1080 -0
- package/dist/turso-HAQWMGRP.js +416 -0
- package/dist/{twilio-4PDBJKWX.js → twilio-MLXYPHJE.js} +70 -69
- package/dist/umami-DZHBLPVG.js +389 -0
- package/dist/unsplash-GS2OPXKE.js +351 -0
- package/dist/{upstash_redis-G4LQBYHA.js → upstash_redis-XMXWTNAJ.js} +51 -50
- package/dist/uptimerobot-TF5WRZ4G.js +483 -0
- package/dist/v2ex-2BVXAPDF.js +667 -0
- package/dist/vercel-YMJGQYJE.js +1076 -0
- package/dist/{wolfram_alpha_api-3G4PUJWB.js → wolfram_alpha_api-I56SXWFZ.js} +36 -35
- package/dist/wordpress-R7TDFZ2P.js +812 -0
- package/dist/workos-HDNHWVMS.js +664 -0
- package/dist/zhihu-LX6AGGDS.js +254 -0
- package/package.json +18 -9
- package/dist/airtable-LLZDFN7M.js +0 -789
- package/dist/anthropic-G23NN3X5.js +0 -202
- package/dist/apify-Y3SS734K.js +0 -247
- package/dist/brave_search-ZC7OAPSZ.js +0 -301
- package/dist/chunk-R6P4XAE5.js +0 -248
- package/dist/chunk-U7B6DS2O.js +0 -977
- package/dist/chunk-UZM2RXZH.js +0 -23436
- package/dist/circleci-3BAX5FCG.js +0 -388
- package/dist/clerk-6LEM6TNU.js +0 -1019
- package/dist/cloudflare_dns-KINYTJUD.js +0 -588
- package/dist/cohere-XCJ5AJ6B.js +0 -185
- package/dist/deepseek-PC5YGNC5.js +0 -209
- package/dist/docker_hub-C3MA5FU6.js +0 -932
- package/dist/dropbox-XBV7Z2IR.js +0 -1304
- package/dist/dub-LDOFG3HC.js +0 -679
- package/dist/e2b-JMCPSVBW.js +0 -277
- package/dist/exa-RAK7O7RD.js +0 -331
- package/dist/figma-E6IX5DTH.js +0 -773
- package/dist/firehydrant-ZBLPQREE.js +0 -562
- package/dist/fly-ZH3HFCZJ.js +0 -468
- package/dist/geocodio-YGNI7DA4.js +0 -212
- package/dist/ghost-EVSGKH2Q.js +0 -337
- package/dist/github-MA2BGRCJ.js +0 -5420
- package/dist/gmail-E5E6AADE.js +0 -1886
- package/dist/googlecalendar-BTLFPXTD.js +0 -2523
- package/dist/graphhopper-WSMB3TCD.js +0 -324
- package/dist/ipgeolocation_io-AA7HAS22.js +0 -315
- package/dist/ipqualityscore-BHJXVTJT.js +0 -277
- package/dist/langsmith-5W6SCT6F.js +0 -592
- package/dist/lemlist-HJWH6UMK.js +0 -288
- package/dist/logsnag-4KFOHL37.js +0 -150
- package/dist/mem0-CAW43CIC.js +0 -543
- package/dist/memos-TWEGPKFM.js +0 -740
- package/dist/mistral_ai-64BGZQHP.js +0 -1195
- package/dist/ngrok-GQCUGZKJ.js +0 -356
- package/dist/notion-DQWZWP4N.js +0 -936
- package/dist/open_exchange_rates-QMMD735E.js +0 -214
- package/dist/openai-W6PX32NZ.js +0 -799
- package/dist/opengraph_io-HNDBXYNW.js +0 -361
- package/dist/openrouter-JJYMEAUL.js +0 -437
- package/dist/outline-MCBNQZYY.js +0 -595
- package/dist/paddle-D2SKLUDN.js +0 -453
- package/dist/perplexity-XIFMKUAE.js +0 -219
- package/dist/pinecone-HUFTALV2.js +0 -570
- package/dist/polar-TYTOMOSR.js +0 -394
- package/dist/posthog-43JAR3VW.js +0 -3463
- package/dist/postmark-KL2QJYSG.js +0 -426
- package/dist/readwise-CI4GIMMJ.js +0 -469
- package/dist/render-SUBJ6YRZ.js +0 -460
- package/dist/rootly-CD2LJHPI.js +0 -336
- package/dist/semantic_scholar-T4A252KW.js +0 -610
- package/dist/shopify-Y2HN2MCQ.js +0 -609
- package/dist/stripe-VE3CD3AY.js +0 -584
- package/dist/tavily-KCZHK6HE.js +0 -326
- package/dist/telegram-3URFBCMY.js +0 -1766
- package/dist/todoist-HNPWNYTD.js +0 -663
- package/dist/trello-3W2MIXRP.js +0 -1079
- package/dist/turso-2EQF7C2Z.js +0 -415
- package/dist/umami-5REN7TGP.js +0 -388
- package/dist/unsplash-EIXL424F.js +0 -350
- package/dist/uptimerobot-KNJ3EYLY.js +0 -482
- package/dist/v2ex-RHJ234PZ.js +0 -666
- package/dist/vercel-AS6NCIC7.js +0 -1075
- package/dist/wordpress-KNDAAUV7.js +0 -811
- package/dist/workos-R6UITSJ7.js +0 -663
- package/dist/zhihu-AGK4HILK.js +0 -253
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderHttpClient
|
|
3
|
+
} from "./chunk-VWRUGUSU.js";
|
|
4
|
+
import {
|
|
5
|
+
asJsonObject,
|
|
6
|
+
booleanValue,
|
|
7
|
+
compactDefined,
|
|
8
|
+
integerValue,
|
|
9
|
+
trimmedText
|
|
10
|
+
} from "./chunk-JXHMDBAY.js";
|
|
11
|
+
import {
|
|
12
|
+
createProviderPlugin,
|
|
13
|
+
requireApiKey,
|
|
14
|
+
upstreamError
|
|
15
|
+
} from "./chunk-WJHG6OK7.js";
|
|
16
|
+
import {
|
|
17
|
+
assertPublicHttpUrl
|
|
18
|
+
} from "./chunk-2JNAI4OC.js";
|
|
19
|
+
import "./chunk-BADVCN6K.js";
|
|
20
|
+
import {
|
|
21
|
+
TBError
|
|
22
|
+
} from "./chunk-5ICRY3VU.js";
|
|
23
|
+
import "./chunk-U67V476Y.js";
|
|
24
|
+
|
|
25
|
+
// ../plugins/src/opengraph_io/api.ts
|
|
26
|
+
var SERVICE = "opengraph_io";
|
|
27
|
+
var API_BASE = "https://opengraph.io";
|
|
28
|
+
var http = createProviderHttpClient({ baseUrl: `${API_BASE}/`, service: SERVICE });
|
|
29
|
+
function errorMessage(payload) {
|
|
30
|
+
if (typeof payload === "string" && payload.trim() !== "") return payload;
|
|
31
|
+
const body = asJsonObject(payload);
|
|
32
|
+
if (body === void 0) return "OpenGraph.io request failed";
|
|
33
|
+
for (const key of ["error_description", "error_message", "error", "message", "detail"]) {
|
|
34
|
+
const found = trimmedText(body[key]);
|
|
35
|
+
if (found !== void 0) return found;
|
|
36
|
+
}
|
|
37
|
+
return "OpenGraph.io request failed";
|
|
38
|
+
}
|
|
39
|
+
async function request(ctx, path, query) {
|
|
40
|
+
const apiKey = requireApiKey(ctx, SERVICE);
|
|
41
|
+
const requestQuery = [["app_id", apiKey], ...Object.entries(query)];
|
|
42
|
+
const { data } = await http.request({
|
|
43
|
+
path,
|
|
44
|
+
query: requestQuery,
|
|
45
|
+
headers: { accept: "application/json" },
|
|
46
|
+
invalidJson: "text",
|
|
47
|
+
mapError: ({ data: payload, status }) => upstreamError(status, errorMessage(payload)),
|
|
48
|
+
mapTransportError: ({ message }) => upstreamError(
|
|
49
|
+
502,
|
|
50
|
+
message === void 0 ? "OpenGraph.io request failed" : `OpenGraph.io request failed: ${message}`
|
|
51
|
+
)
|
|
52
|
+
});
|
|
53
|
+
return data ?? null;
|
|
54
|
+
}
|
|
55
|
+
function unwrap(payload) {
|
|
56
|
+
const body = asJsonObject(payload);
|
|
57
|
+
if (body === void 0) return payload;
|
|
58
|
+
return typeof body.successful === "boolean" && body.data !== void 0 ? body.data : payload;
|
|
59
|
+
}
|
|
60
|
+
function requireObject(payload, context) {
|
|
61
|
+
const body = asJsonObject(unwrap(payload));
|
|
62
|
+
if (body === void 0) throw upstreamError(502, `OpenGraph.io ${context} response was not a JSON object`);
|
|
63
|
+
return body;
|
|
64
|
+
}
|
|
65
|
+
function normalizeRequestInfo(payload) {
|
|
66
|
+
const body = asJsonObject(payload);
|
|
67
|
+
if (body === void 0) return void 0;
|
|
68
|
+
const normalized = compactDefined({
|
|
69
|
+
host: trimmedText(body.host),
|
|
70
|
+
redirects: integerValue(body.redirects),
|
|
71
|
+
responseCode: integerValue(body.responseCode ?? body.response_code),
|
|
72
|
+
responseContentType: trimmedText(body.responseContentType ?? body.response_content_type)
|
|
73
|
+
});
|
|
74
|
+
return Object.keys(normalized).length > 0 ? normalized : void 0;
|
|
75
|
+
}
|
|
76
|
+
function normalizeSiteResult(payload) {
|
|
77
|
+
const body = requireObject(payload, "site");
|
|
78
|
+
const tags = Array.isArray(body.tags) ? body.tags.map((item) => asJsonObject(item)).filter((item) => item !== void 0) : void 0;
|
|
79
|
+
return compactDefined({
|
|
80
|
+
hybridGraph: asJsonObject(body.hybridGraph ?? body.hybrid_graph),
|
|
81
|
+
openGraph: asJsonObject(body.openGraph ?? body.open_graph),
|
|
82
|
+
twitterCard: asJsonObject(body.twitterCard ?? body.twitter_card),
|
|
83
|
+
htmlInferred: asJsonObject(body.htmlInferred ?? body.html_inferred),
|
|
84
|
+
oEmbed: asJsonObject(body.oEmbed ?? body.oembed),
|
|
85
|
+
requestUrl: trimmedText(body.requestUrl ?? body.request_url),
|
|
86
|
+
requestInfo: normalizeRequestInfo(body.requestInfo ?? body.request_info),
|
|
87
|
+
cached: booleanValue(body.cached),
|
|
88
|
+
// createdAt 的 null 是有信息的("非缓存结果"),不能被 compact 当缺失丢掉。
|
|
89
|
+
createdAt: (body.createdAt ?? body.created_at) === null ? null : trimmedText(body.createdAt ?? body.created_at),
|
|
90
|
+
retryInfo: asJsonObject(body.retryInfo ?? body.retry_info),
|
|
91
|
+
aiSafety: asJsonObject(body.aiSafety ?? body.ai_safety ?? body.AI_SAFETY),
|
|
92
|
+
domain: trimmedText(body.domain),
|
|
93
|
+
tags: tags !== void 0 && tags.length > 0 ? tags : void 0
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function targetPath(family, target, field) {
|
|
97
|
+
let normalized;
|
|
98
|
+
try {
|
|
99
|
+
normalized = assertPublicHttpUrl(target).toString();
|
|
100
|
+
} catch {
|
|
101
|
+
throw new TBError("invalid_argument", `${field} \u5FC5\u987B\u662F\u516C\u7F51\u53EF\u8FBE\u7684 http(s) \u5730\u5740`);
|
|
102
|
+
}
|
|
103
|
+
return `/api/1.1/${family}/${encodeURIComponent(normalized)}`;
|
|
104
|
+
}
|
|
105
|
+
function siteQuery(input) {
|
|
106
|
+
return {
|
|
107
|
+
cache_ok: input.cacheOk,
|
|
108
|
+
full_render: input.fullRender,
|
|
109
|
+
use_proxy: input.useProxy,
|
|
110
|
+
use_premium: input.usePremium,
|
|
111
|
+
use_superior: input.useSuperior,
|
|
112
|
+
use_ai: input.useAi,
|
|
113
|
+
max_cache_age: input.maxCacheAge,
|
|
114
|
+
accept_lang: input.acceptLang,
|
|
115
|
+
auto_proxy: input.autoProxy,
|
|
116
|
+
auto_render: input.autoRender,
|
|
117
|
+
retry: input.retry,
|
|
118
|
+
max_retries: input.maxRetries,
|
|
119
|
+
retry_escalate: input.retryEscalate,
|
|
120
|
+
proxy_country: input.proxyCountry
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
async function extractSiteMetadata(input, ctx) {
|
|
124
|
+
const payload = await request(ctx, targetPath("site", input.site, "site"), siteQuery(input));
|
|
125
|
+
return normalizeSiteResult(payload);
|
|
126
|
+
}
|
|
127
|
+
async function extractSite(input, ctx) {
|
|
128
|
+
return extractSiteMetadata(input, ctx);
|
|
129
|
+
}
|
|
130
|
+
async function scrapeSite(input, ctx) {
|
|
131
|
+
return extractSiteMetadata(input, ctx);
|
|
132
|
+
}
|
|
133
|
+
async function scrapeUrl(input, ctx) {
|
|
134
|
+
const payload = await request(ctx, targetPath("scrape", input.url, "url"), {
|
|
135
|
+
cache_ok: input.cacheOk,
|
|
136
|
+
full_render: input.fullRender,
|
|
137
|
+
use_proxy: input.useProxy,
|
|
138
|
+
use_premium: input.usePremium,
|
|
139
|
+
use_superior: input.useSuperior,
|
|
140
|
+
accept_lang: input.acceptLang,
|
|
141
|
+
auto_proxy: input.autoProxy,
|
|
142
|
+
auto_render: input.autoRender,
|
|
143
|
+
retry: input.retry
|
|
144
|
+
});
|
|
145
|
+
const unwrapped = unwrap(payload);
|
|
146
|
+
if (typeof unwrapped === "string") return { htmlContent: unwrapped };
|
|
147
|
+
const body = requireObject(unwrapped, "scrape");
|
|
148
|
+
const htmlContent = trimmedText(body.htmlContent ?? body.html_content ?? body.html);
|
|
149
|
+
if (htmlContent === void 0) {
|
|
150
|
+
throw upstreamError(502, "OpenGraph.io scrape response did not include html content");
|
|
151
|
+
}
|
|
152
|
+
return compactDefined({
|
|
153
|
+
htmlContent,
|
|
154
|
+
requestInfo: normalizeRequestInfo(body.requestInfo ?? body.request_info),
|
|
155
|
+
retryInfo: asJsonObject(body.retryInfo ?? body.retry_info)
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
async function captureScreenshot(input, ctx) {
|
|
159
|
+
const payload = await request(ctx, targetPath("screenshot", input.url, "url"), {
|
|
160
|
+
format: input.format,
|
|
161
|
+
quality: input.quality,
|
|
162
|
+
cache_ok: input.cacheOk,
|
|
163
|
+
selector: input.selector,
|
|
164
|
+
dark_mode: input.darkMode,
|
|
165
|
+
full_page: input.fullPage,
|
|
166
|
+
use_proxy: input.useProxy,
|
|
167
|
+
dimensions: input.dimensions,
|
|
168
|
+
capture_delay: input.captureDelay,
|
|
169
|
+
exclude_selectors: input.excludeSelectors,
|
|
170
|
+
navigation_timeout: input.navigationTimeout,
|
|
171
|
+
block_cookie_banner: input.blockCookieBanner
|
|
172
|
+
});
|
|
173
|
+
const body = requireObject(payload, "screenshot");
|
|
174
|
+
const screenshotUrl = trimmedText(body.screenshotUrl ?? body.screenshot_url);
|
|
175
|
+
if (screenshotUrl === void 0) {
|
|
176
|
+
throw upstreamError(502, "OpenGraph.io screenshot response did not include screenshotUrl");
|
|
177
|
+
}
|
|
178
|
+
const dimensions = asJsonObject(body.dimensions);
|
|
179
|
+
const width = integerValue(dimensions?.width);
|
|
180
|
+
const height = integerValue(dimensions?.height);
|
|
181
|
+
if (width === void 0 || height === void 0) {
|
|
182
|
+
throw upstreamError(502, "OpenGraph.io screenshot response did not include dimensions");
|
|
183
|
+
}
|
|
184
|
+
return compactDefined({
|
|
185
|
+
screenshotUrl,
|
|
186
|
+
dimensions: { width, height },
|
|
187
|
+
requestInfo: normalizeRequestInfo(body.requestInfo ?? body.request_info)
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// ../plugins/src/opengraph_io/schema.ts
|
|
192
|
+
import { z } from "zod/v4";
|
|
193
|
+
var extractSiteInput = z.strictObject({
|
|
194
|
+
site: z.url().describe("The site URL to inspect."),
|
|
195
|
+
cacheOk: z.boolean().describe("Whether cached results may be returned when available.").optional(),
|
|
196
|
+
fullRender: z.boolean().describe("Whether the page should be rendered in a browser before extraction.").optional(),
|
|
197
|
+
useProxy: z.boolean().describe("Whether a proxy should be used for the request.").optional(),
|
|
198
|
+
usePremium: z.boolean().describe("Whether a residential proxy should be used when available.").optional(),
|
|
199
|
+
useSuperior: z.boolean().describe("Whether a mobile-grade proxy should be used when available.").optional(),
|
|
200
|
+
useAi: z.boolean().describe("Whether AI-enhanced metadata extraction should be enabled.").optional(),
|
|
201
|
+
maxCacheAge: z.int().min(0).describe("The maximum accepted cache age in seconds.").optional(),
|
|
202
|
+
acceptLang: z.string().min(1).describe("The Accept-Language header value sent to the target site.").optional(),
|
|
203
|
+
autoProxy: z.boolean().describe("Whether OpenGraph.io may automatically decide whether to use a proxy.").optional(),
|
|
204
|
+
autoRender: z.boolean().describe("Whether OpenGraph.io may automatically decide whether full rendering is needed.").optional(),
|
|
205
|
+
retry: z.boolean().describe("Whether OpenGraph.io should retry with fallback transport strategies.").optional(),
|
|
206
|
+
maxRetries: z.int().min(0).describe("The maximum number of retry attempts.").optional(),
|
|
207
|
+
retryEscalate: z.boolean().describe("Whether retries may escalate to more expensive fallback strategies.").optional(),
|
|
208
|
+
proxyCountry: z.string().min(1).describe("The ISO 3166-1 alpha-2 country code to use for proxy egress.").optional()
|
|
209
|
+
}).describe("The input payload for extracting OpenGraph.io site metadata.");
|
|
210
|
+
var extractSiteOutput = z.looseObject({
|
|
211
|
+
hybridGraph: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
212
|
+
openGraph: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
213
|
+
twitterCard: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
214
|
+
htmlInferred: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
215
|
+
oEmbed: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
216
|
+
requestUrl: z.string().describe("The final URL that OpenGraph.io resolved after redirects.").optional(),
|
|
217
|
+
requestInfo: z.looseObject({
|
|
218
|
+
host: z.string().describe("The host that responded to the request.").optional(),
|
|
219
|
+
redirects: z.int().describe("The number of redirects followed while fetching the URL.").optional(),
|
|
220
|
+
responseCode: z.int().describe("The HTTP response code returned upstream.").optional(),
|
|
221
|
+
responseContentType: z.string().describe("The upstream response Content-Type header when available.").optional()
|
|
222
|
+
}).describe("Information about the upstream request performed by OpenGraph.io.").optional(),
|
|
223
|
+
cached: z.boolean().describe("Whether the result came from cache.").optional(),
|
|
224
|
+
createdAt: z.string().describe("The ISO 8601 timestamp when the cached result was created.").nullable().optional(),
|
|
225
|
+
retryInfo: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
226
|
+
aiSafety: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
227
|
+
domain: z.string().describe("The domain extracted from the requested URL.").optional(),
|
|
228
|
+
tags: z.array(z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.")).describe("Additional tag-level extraction results when returned by the API.").optional()
|
|
229
|
+
}).describe("The normalized metadata payload returned by the OpenGraph.io Site endpoint.");
|
|
230
|
+
var scrapeSiteInput = z.strictObject({
|
|
231
|
+
site: z.url().describe("The site URL to inspect."),
|
|
232
|
+
cacheOk: z.boolean().describe("Whether cached results may be returned when available.").optional(),
|
|
233
|
+
fullRender: z.boolean().describe("Whether the page should be rendered in a browser before extraction.").optional(),
|
|
234
|
+
useProxy: z.boolean().describe("Whether a proxy should be used for the request.").optional(),
|
|
235
|
+
usePremium: z.boolean().describe("Whether a residential proxy should be used when available.").optional(),
|
|
236
|
+
useSuperior: z.boolean().describe("Whether a mobile-grade proxy should be used when available.").optional(),
|
|
237
|
+
useAi: z.boolean().describe("Whether AI-enhanced metadata extraction should be enabled.").optional(),
|
|
238
|
+
maxCacheAge: z.int().min(0).describe("The maximum accepted cache age in seconds.").optional(),
|
|
239
|
+
acceptLang: z.string().min(1).describe("The Accept-Language header value sent to the target site.").optional(),
|
|
240
|
+
autoProxy: z.boolean().describe("Whether OpenGraph.io may automatically decide whether to use a proxy.").optional(),
|
|
241
|
+
autoRender: z.boolean().describe("Whether OpenGraph.io may automatically decide whether full rendering is needed.").optional(),
|
|
242
|
+
retry: z.boolean().describe("Whether OpenGraph.io should retry with fallback transport strategies.").optional(),
|
|
243
|
+
maxRetries: z.int().min(0).describe("The maximum number of retry attempts.").optional(),
|
|
244
|
+
retryEscalate: z.boolean().describe("Whether retries may escalate to more expensive fallback strategies.").optional(),
|
|
245
|
+
proxyCountry: z.string().min(1).describe("The ISO 3166-1 alpha-2 country code to use for proxy egress.").optional(),
|
|
246
|
+
scrape: z.boolean().describe("A reserved compatibility flag. The current official Site endpoint does not expose a separate scrape mode, so this value is ignored.").optional()
|
|
247
|
+
}).describe("The input payload for retrieving OpenGraph.io site metadata.");
|
|
248
|
+
var scrapeSiteOutput = z.looseObject({
|
|
249
|
+
hybridGraph: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
250
|
+
openGraph: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
251
|
+
twitterCard: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
252
|
+
htmlInferred: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
253
|
+
oEmbed: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
254
|
+
requestUrl: z.string().describe("The final URL that OpenGraph.io resolved after redirects.").optional(),
|
|
255
|
+
requestInfo: z.looseObject({
|
|
256
|
+
host: z.string().describe("The host that responded to the request.").optional(),
|
|
257
|
+
redirects: z.int().describe("The number of redirects followed while fetching the URL.").optional(),
|
|
258
|
+
responseCode: z.int().describe("The HTTP response code returned upstream.").optional(),
|
|
259
|
+
responseContentType: z.string().describe("The upstream response Content-Type header when available.").optional()
|
|
260
|
+
}).describe("Information about the upstream request performed by OpenGraph.io.").optional(),
|
|
261
|
+
cached: z.boolean().describe("Whether the result came from cache.").optional(),
|
|
262
|
+
createdAt: z.string().describe("The ISO 8601 timestamp when the cached result was created.").nullable().optional(),
|
|
263
|
+
retryInfo: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
264
|
+
aiSafety: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional(),
|
|
265
|
+
domain: z.string().describe("The domain extracted from the requested URL.").optional(),
|
|
266
|
+
tags: z.array(z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.")).describe("Additional tag-level extraction results when returned by the API.").optional()
|
|
267
|
+
}).describe("The normalized metadata payload returned by the OpenGraph.io Site endpoint.");
|
|
268
|
+
var scrapeUrlInput = z.strictObject({
|
|
269
|
+
url: z.url().describe("The page URL to scrape for raw HTML."),
|
|
270
|
+
cacheOk: z.boolean().describe("Whether cached results may be returned when available.").optional(),
|
|
271
|
+
fullRender: z.boolean().describe("Whether the page should be rendered in a browser before scraping.").optional(),
|
|
272
|
+
useProxy: z.boolean().describe("Whether a proxy should be used for the request.").optional(),
|
|
273
|
+
usePremium: z.boolean().describe("Whether a residential proxy should be used when available.").optional(),
|
|
274
|
+
useSuperior: z.boolean().describe("Whether a mobile-grade proxy should be used when available.").optional(),
|
|
275
|
+
acceptLang: z.string().min(1).describe("The Accept-Language header value sent to the target site.").optional(),
|
|
276
|
+
autoProxy: z.boolean().describe("Whether OpenGraph.io may automatically decide whether to use a proxy.").optional(),
|
|
277
|
+
autoRender: z.boolean().describe("Whether OpenGraph.io may automatically decide whether full rendering is needed.").optional(),
|
|
278
|
+
retry: z.boolean().describe("Whether OpenGraph.io should retry with fallback transport strategies.").optional()
|
|
279
|
+
}).describe("The input payload for scraping a URL with OpenGraph.io.");
|
|
280
|
+
var scrapeUrlOutput = z.looseObject({
|
|
281
|
+
htmlContent: z.string().describe("The raw HTML content returned for the page.").optional(),
|
|
282
|
+
requestInfo: z.looseObject({
|
|
283
|
+
host: z.string().describe("The host that responded to the request.").optional(),
|
|
284
|
+
redirects: z.int().describe("The number of redirects followed while fetching the URL.").optional(),
|
|
285
|
+
responseCode: z.int().describe("The HTTP response code returned upstream.").optional(),
|
|
286
|
+
responseContentType: z.string().describe("The upstream response Content-Type header when available.").optional()
|
|
287
|
+
}).describe("Information about the upstream request performed by OpenGraph.io.").optional(),
|
|
288
|
+
retryInfo: z.looseObject({}).describe("A loose JSON object returned by OpenGraph.io.").optional()
|
|
289
|
+
}).describe("The normalized output payload returned by the OpenGraph.io Scrape endpoint.");
|
|
290
|
+
var captureScreenshotInput = z.strictObject({
|
|
291
|
+
url: z.url().describe("The page URL to capture as an image."),
|
|
292
|
+
format: z.enum(["jpeg", "png", "webp"]).describe("The output image format.").optional(),
|
|
293
|
+
quality: z.int().min(10).max(80).describe("The image quality from 10 to 80.").optional(),
|
|
294
|
+
cacheOk: z.boolean().describe("Whether cached screenshots may be returned when available.").optional(),
|
|
295
|
+
selector: z.string().min(1).describe("An optional CSS selector that limits the capture to a specific element.").optional(),
|
|
296
|
+
darkMode: z.boolean().describe("Whether the page should be rendered with a dark color-scheme preference.").optional(),
|
|
297
|
+
fullPage: z.boolean().describe("Whether the entire scrollable page should be captured.").optional(),
|
|
298
|
+
useProxy: z.boolean().describe("Whether a proxy should be used for the request.").optional(),
|
|
299
|
+
dimensions: z.enum(["xs", "sm", "md", "lg"]).describe("A viewport size preset.").optional(),
|
|
300
|
+
captureDelay: z.int().min(0).max(1e4).describe("The delay in milliseconds before taking the screenshot.").optional(),
|
|
301
|
+
excludeSelectors: z.string().min(1).describe("Comma-separated CSS selectors for elements that should be hidden.").optional(),
|
|
302
|
+
navigationTimeout: z.int().min(1e3).max(6e4).describe("The navigation timeout in milliseconds.").optional(),
|
|
303
|
+
blockCookieBanner: z.boolean().describe("Whether known cookie consent banners should be blocked.").optional()
|
|
304
|
+
}).describe("The input payload for capturing a screenshot with OpenGraph.io.");
|
|
305
|
+
var captureScreenshotOutput = z.looseObject({
|
|
306
|
+
screenshotUrl: z.url().describe("The URL of the generated screenshot image.").optional(),
|
|
307
|
+
dimensions: z.strictObject({
|
|
308
|
+
width: z.int().describe("The screenshot width in pixels.").optional(),
|
|
309
|
+
height: z.int().describe("The screenshot height in pixels.").optional()
|
|
310
|
+
}).describe("The dimensions of the captured screenshot.").optional(),
|
|
311
|
+
requestInfo: z.looseObject({
|
|
312
|
+
host: z.string().describe("The host that responded to the request.").optional(),
|
|
313
|
+
redirects: z.int().describe("The number of redirects followed while fetching the URL.").optional(),
|
|
314
|
+
responseCode: z.int().describe("The HTTP response code returned upstream.").optional(),
|
|
315
|
+
responseContentType: z.string().describe("The upstream response Content-Type header when available.").optional()
|
|
316
|
+
}).describe("Information about the upstream request performed by OpenGraph.io.").optional()
|
|
317
|
+
}).describe("The normalized output payload returned by the OpenGraph.io Screenshot endpoint.");
|
|
318
|
+
var opengraphIoActions = {
|
|
319
|
+
extract_site: {
|
|
320
|
+
description: "Extract Open Graph, Twitter Card, oEmbed, and inferred metadata for a site through the OpenGraph.io Site endpoint.",
|
|
321
|
+
effect: "write",
|
|
322
|
+
inputSchema: extractSiteInput,
|
|
323
|
+
outputSchema: z.toJSONSchema(extractSiteOutput, { io: "output", unrepresentable: "any" })
|
|
324
|
+
},
|
|
325
|
+
scrape_site: {
|
|
326
|
+
description: "Retrieve a site's metadata through the OpenGraph.io Site endpoint with cache, proxy, render, and retry controls.",
|
|
327
|
+
effect: "write",
|
|
328
|
+
inputSchema: scrapeSiteInput,
|
|
329
|
+
outputSchema: z.toJSONSchema(scrapeSiteOutput, { io: "output", unrepresentable: "any" })
|
|
330
|
+
},
|
|
331
|
+
scrape_url: {
|
|
332
|
+
description: "Fetch the raw HTML for a page through the OpenGraph.io Scrape endpoint with optional render and proxy controls.",
|
|
333
|
+
effect: "write",
|
|
334
|
+
inputSchema: scrapeUrlInput,
|
|
335
|
+
outputSchema: z.toJSONSchema(scrapeUrlOutput, { io: "output", unrepresentable: "any" })
|
|
336
|
+
},
|
|
337
|
+
capture_screenshot: {
|
|
338
|
+
description: "Capture a webpage screenshot through the OpenGraph.io Screenshot endpoint with configurable viewport, delay, and element selection.",
|
|
339
|
+
effect: "write",
|
|
340
|
+
inputSchema: captureScreenshotInput,
|
|
341
|
+
outputSchema: z.toJSONSchema(captureScreenshotOutput, { io: "output", unrepresentable: "any" })
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
// ../plugins/src/opengraph_io/index.ts
|
|
346
|
+
function createOpengraphIoPlugin() {
|
|
347
|
+
return createProviderPlugin({
|
|
348
|
+
description: "OpenGraph.io",
|
|
349
|
+
actions: opengraphIoActions,
|
|
350
|
+
handlers: {
|
|
351
|
+
extract_site: extractSite,
|
|
352
|
+
scrape_site: scrapeSite,
|
|
353
|
+
scrape_url: scrapeUrl,
|
|
354
|
+
capture_screenshot: captureScreenshot
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
var opengraph_io_default = createOpengraphIoPlugin();
|
|
359
|
+
export {
|
|
360
|
+
createOpengraphIoPlugin,
|
|
361
|
+
opengraph_io_default as default
|
|
362
|
+
};
|