@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,360 @@
|
|
|
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/exa/api.ts
|
|
15
|
+
var SERVICE = "exa";
|
|
16
|
+
var API_BASE = "https://api.exa.ai";
|
|
17
|
+
var SEARCH_PATH = "/search";
|
|
18
|
+
var CONTENTS_PATH = "/contents";
|
|
19
|
+
var ANSWER_PATH = "/answer";
|
|
20
|
+
var FIND_SIMILAR_PATH = "/findSimilar";
|
|
21
|
+
function asRecord(value) {
|
|
22
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
23
|
+
}
|
|
24
|
+
function optionalText(value) {
|
|
25
|
+
if (typeof value !== "string") return void 0;
|
|
26
|
+
const trimmed = value.trim();
|
|
27
|
+
return trimmed === "" ? void 0 : trimmed;
|
|
28
|
+
}
|
|
29
|
+
function compact(input) {
|
|
30
|
+
const output = {};
|
|
31
|
+
for (const [key, value] of Object.entries(input)) {
|
|
32
|
+
if (value !== void 0) output[key] = value;
|
|
33
|
+
}
|
|
34
|
+
return output;
|
|
35
|
+
}
|
|
36
|
+
async function readPayload(response) {
|
|
37
|
+
const text = await response.text().catch(() => "");
|
|
38
|
+
if (text.trim() === "") return null;
|
|
39
|
+
try {
|
|
40
|
+
return JSON.parse(text);
|
|
41
|
+
} catch {
|
|
42
|
+
return text;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function errorMessage(payload) {
|
|
46
|
+
if (typeof payload === "string") return optionalText(payload);
|
|
47
|
+
const object = asRecord(payload);
|
|
48
|
+
if (object === void 0) return void 0;
|
|
49
|
+
return optionalText(object.error) ?? optionalText(object.message) ?? optionalText(object.detail);
|
|
50
|
+
}
|
|
51
|
+
async function request(ctx, path, body) {
|
|
52
|
+
const apiKey = requireApiKey(ctx, SERVICE);
|
|
53
|
+
let response;
|
|
54
|
+
let payload;
|
|
55
|
+
try {
|
|
56
|
+
response = await guardedFetch(new URL(path, API_BASE).toString(), {
|
|
57
|
+
method: "POST",
|
|
58
|
+
headers: {
|
|
59
|
+
"accept": "application/json",
|
|
60
|
+
"content-type": "application/json",
|
|
61
|
+
"x-api-key": apiKey
|
|
62
|
+
},
|
|
63
|
+
body: JSON.stringify(body)
|
|
64
|
+
});
|
|
65
|
+
payload = await readPayload(response);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
if (error instanceof TBError) throw error;
|
|
68
|
+
throw upstreamError(502, error instanceof Error ? `exa \u8BF7\u6C42\u5931\u8D25: ${error.message}` : "exa \u8BF7\u6C42\u5931\u8D25");
|
|
69
|
+
}
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
throw upstreamError(
|
|
72
|
+
response.status,
|
|
73
|
+
errorMessage(payload) ?? (response.statusText || `exa \u8FD4\u56DE HTTP ${response.status}`)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
if (payload === null) return {};
|
|
77
|
+
if (typeof payload === "string") {
|
|
78
|
+
throw upstreamError(502, "exa \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94");
|
|
79
|
+
}
|
|
80
|
+
return payload;
|
|
81
|
+
}
|
|
82
|
+
function responseText(value, field) {
|
|
83
|
+
const text = optionalText(value);
|
|
84
|
+
if (text === void 0) throw upstreamError(502, `exa \u54CD\u5E94\u7F3A\u5C11 ${field}`);
|
|
85
|
+
return text;
|
|
86
|
+
}
|
|
87
|
+
function responseRecord(payload, field) {
|
|
88
|
+
const object = asRecord(payload);
|
|
89
|
+
if (object === void 0) throw upstreamError(502, `exa ${field} \u54CD\u5E94\u4E0D\u662F\u5BF9\u8C61`);
|
|
90
|
+
return object;
|
|
91
|
+
}
|
|
92
|
+
function responseArray(value, field) {
|
|
93
|
+
if (!Array.isArray(value)) throw upstreamError(502, `exa \u54CD\u5E94\u7684 ${field} \u4E0D\u662F\u6570\u7EC4`);
|
|
94
|
+
return value;
|
|
95
|
+
}
|
|
96
|
+
function resultItems(value, field) {
|
|
97
|
+
return responseArray(value, field).map((item) => responseRecord(item, `${field} \u7ED3\u679C\u9879`));
|
|
98
|
+
}
|
|
99
|
+
function assertDomainFilters(input) {
|
|
100
|
+
if (input.includeDomains !== void 0 && input.excludeDomains !== void 0) {
|
|
101
|
+
throw new TBError("invalid_argument", "includeDomains \u4E0E excludeDomains \u4E0D\u80FD\u540C\u65F6\u63D0\u4F9B");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function normalizeResults(object, extra = {}) {
|
|
105
|
+
return compact({
|
|
106
|
+
requestId: responseText(object.requestId, "requestId"),
|
|
107
|
+
results: resultItems(object.results, "results"),
|
|
108
|
+
...extra,
|
|
109
|
+
costDollars: asRecord(object.costDollars)
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
async function search(input, ctx) {
|
|
113
|
+
assertDomainFilters(input);
|
|
114
|
+
const object = responseRecord(await request(ctx, SEARCH_PATH, compact(input)), "\u641C\u7D22");
|
|
115
|
+
return normalizeResults(object, {
|
|
116
|
+
searchType: optionalText(object.searchType),
|
|
117
|
+
output: asRecord(object.output)
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
async function getContents(input, ctx) {
|
|
121
|
+
const object = responseRecord(await request(ctx, CONTENTS_PATH, compact(input)), "contents");
|
|
122
|
+
return compact({
|
|
123
|
+
requestId: responseText(object.requestId, "requestId"),
|
|
124
|
+
results: resultItems(object.results, "results"),
|
|
125
|
+
// statuses 是可选的:字段缺席与"空数组"不是一回事,前者不该被伪造成后者。
|
|
126
|
+
statuses: object.statuses === void 0 ? void 0 : resultItems(object.statuses, "statuses"),
|
|
127
|
+
costDollars: asRecord(object.costDollars)
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
async function answer(input, ctx) {
|
|
131
|
+
const object = responseRecord(await request(ctx, ANSWER_PATH, compact(input)), "answer");
|
|
132
|
+
return compact({
|
|
133
|
+
// answer 既可能是一段文本,也可能是结构化对象(取决于 Exa 选的答案形态)。
|
|
134
|
+
// 文本这里**不 trim**:它是内容而非标识符,首尾空白由调用方自己决定怎么处理。
|
|
135
|
+
answer: typeof object.answer === "string" ? object.answer : asRecord(object.answer),
|
|
136
|
+
citations: resultItems(object.citations, "citations"),
|
|
137
|
+
costDollars: asRecord(object.costDollars)
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
async function findSimilar(input, ctx) {
|
|
141
|
+
assertDomainFilters(input);
|
|
142
|
+
return normalizeResults(responseRecord(await request(ctx, FIND_SIMILAR_PATH, compact(input)), "\u641C\u7D22"));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ../plugins/src/exa/schema.ts
|
|
146
|
+
var searchInput = external_exports.strictObject({
|
|
147
|
+
query: external_exports.string().min(1).describe("The search query to send to Exa."),
|
|
148
|
+
additionalQueries: external_exports.array(external_exports.string().min(1)).min(1).describe("Additional query variations to use with deep or deep-reasoning search.").optional(),
|
|
149
|
+
type: external_exports.enum(["neural", "fast", "auto", "deep", "deep-reasoning", "instant"]).describe("The Exa search mode to execute.").optional(),
|
|
150
|
+
category: external_exports.enum(["company", "research paper", "news", "pdf", "github", "personal site", "people", "financial report"]).describe("The Exa category used to narrow search results.").optional(),
|
|
151
|
+
numResults: external_exports.int().min(1).max(100).describe("The number of search results to return, up to 100.").optional(),
|
|
152
|
+
userLocation: external_exports.string().min(2).max(2).describe("A two-letter ISO country code used to localize search results.").optional(),
|
|
153
|
+
includeDomains: external_exports.array(external_exports.string().min(1)).min(1).describe("Only return results from these domains.").optional(),
|
|
154
|
+
excludeDomains: external_exports.array(external_exports.string().min(1)).min(1).describe("Exclude results from these domains.").optional(),
|
|
155
|
+
startCrawlDate: external_exports.iso.datetime({ offset: true }).describe("Only return results crawled after this timestamp.").optional(),
|
|
156
|
+
endCrawlDate: external_exports.iso.datetime({ offset: true }).describe("Only return results crawled before this timestamp.").optional(),
|
|
157
|
+
startPublishedDate: external_exports.iso.datetime({ offset: true }).describe("Only return results published after this timestamp.").optional(),
|
|
158
|
+
endPublishedDate: external_exports.iso.datetime({ offset: true }).describe("Only return results published before this timestamp.").optional(),
|
|
159
|
+
includeText: external_exports.array(external_exports.string().min(1)).min(1).describe("Phrases that must appear in the result text.").optional(),
|
|
160
|
+
excludeText: external_exports.array(external_exports.string().min(1)).min(1).describe("Phrases that must not appear in the result text.").optional(),
|
|
161
|
+
moderation: external_exports.boolean().describe("Whether Exa should filter unsafe content from results.").optional(),
|
|
162
|
+
contents: external_exports.strictObject({
|
|
163
|
+
text: external_exports.union([external_exports.boolean().describe("Whether Exa should return extracted text."), external_exports.strictObject({
|
|
164
|
+
maxCharacters: external_exports.int().min(1).describe("The maximum number of characters to return for extracted text.").optional(),
|
|
165
|
+
includeHtmlTags: external_exports.boolean().describe("Whether Exa should preserve HTML tags in extracted text.").optional(),
|
|
166
|
+
verbosity: external_exports.enum(["compact", "standard", "full"]).describe("The verbosity level for extracted page text.").optional(),
|
|
167
|
+
includeSections: external_exports.array(external_exports.enum(["header", "navigation", "banner", "body", "sidebar", "footer", "metadata"]).describe("A semantic page section used by Exa content extraction.")).min(1).describe("Only include content from these semantic page sections.").optional(),
|
|
168
|
+
excludeSections: external_exports.array(external_exports.enum(["header", "navigation", "banner", "body", "sidebar", "footer", "metadata"]).describe("A semantic page section used by Exa content extraction.")).min(1).describe("Exclude content from these semantic page sections.").optional()
|
|
169
|
+
}).describe("Advanced configuration for Exa text extraction.")]).optional(),
|
|
170
|
+
highlights: external_exports.union([external_exports.boolean().describe("Whether Exa should return highlights."), external_exports.strictObject({
|
|
171
|
+
maxCharacters: external_exports.int().min(1).describe("The maximum number of characters to return across highlights.").optional(),
|
|
172
|
+
numSentences: external_exports.int().min(1).describe("Deprecated by Exa. The number of sentences to include in each highlight snippet.").optional(),
|
|
173
|
+
highlightsPerUrl: external_exports.int().min(1).describe("Deprecated by Exa. The number of highlight snippets to return per URL.").optional(),
|
|
174
|
+
query: external_exports.string().min(1).describe("A custom query that guides Exa highlight selection.").optional()
|
|
175
|
+
}).describe("Advanced configuration for Exa highlights.")]).optional(),
|
|
176
|
+
summary: external_exports.strictObject({
|
|
177
|
+
query: external_exports.string().min(1).describe("A custom query that guides Exa summary generation.").optional(),
|
|
178
|
+
schema: external_exports.looseObject({}).describe("A JSON Schema object used for structured Exa summaries.").optional()
|
|
179
|
+
}).describe("Configuration for an Exa summary response.").optional(),
|
|
180
|
+
livecrawlTimeout: external_exports.int().min(0).describe("The livecrawl timeout in milliseconds.").optional(),
|
|
181
|
+
maxAgeHours: external_exports.union([external_exports.literal(-1), external_exports.int().min(0).describe("A non-negative cache age in hours.")]).describe("Maximum age of cached content in hours. Use -1 to always use cache, 0 to always livecrawl, or a positive integer to require fresher content.").optional(),
|
|
182
|
+
subpages: external_exports.int().min(0).describe("The maximum number of subpages Exa should crawl per result.").optional(),
|
|
183
|
+
subpageTarget: external_exports.union([external_exports.string().min(1).describe("A single keyword used to locate relevant subpages."), external_exports.array(external_exports.string().min(1)).min(1).describe("A list of keywords used to locate relevant subpages.")]).describe("Keywords Exa should use when selecting subpages.").optional(),
|
|
184
|
+
extras: external_exports.strictObject({
|
|
185
|
+
links: external_exports.int().min(0).describe("The maximum number of webpage links to return for each result.").optional(),
|
|
186
|
+
imageLinks: external_exports.int().min(0).describe("The maximum number of image links to return for each result.").optional()
|
|
187
|
+
}).describe("Additional Exa extraction options.").optional()
|
|
188
|
+
}).describe("The Exa contents request object.").optional()
|
|
189
|
+
}).describe("The input payload for an Exa search request. includeDomains and excludeDomains cannot be provided together.");
|
|
190
|
+
var searchOutput = external_exports.strictObject({
|
|
191
|
+
requestId: external_exports.string().describe("The unique identifier for this Exa request."),
|
|
192
|
+
results: external_exports.array(external_exports.looseObject({
|
|
193
|
+
id: external_exports.string().describe("The temporary Exa document identifier.").optional(),
|
|
194
|
+
url: external_exports.string().describe("The result URL.").optional(),
|
|
195
|
+
title: external_exports.string().describe("The result title.").optional(),
|
|
196
|
+
publishedDate: external_exports.string().describe("The estimated publication timestamp for the result.").nullable().optional(),
|
|
197
|
+
author: external_exports.string().describe("The result author.").nullable().optional(),
|
|
198
|
+
score: external_exports.number().describe("The result relevance score.").nullable().optional()
|
|
199
|
+
}).describe("An Exa search or contents result object.")).describe("The Exa search results."),
|
|
200
|
+
searchType: external_exports.string().describe("The search type Exa selected for the request.").optional(),
|
|
201
|
+
output: external_exports.looseObject({}).describe("The Exa deep search output object.").optional(),
|
|
202
|
+
costDollars: external_exports.looseObject({
|
|
203
|
+
total: external_exports.number().describe("The total request cost in US dollars.").optional()
|
|
204
|
+
}).describe("The Exa costDollars object.").optional()
|
|
205
|
+
}).describe("The response payload for exa.search.");
|
|
206
|
+
var getContentsInput = external_exports.strictObject({
|
|
207
|
+
urls: external_exports.array(external_exports.url().describe("One URL to retrieve content for.")).min(1).describe("The list of URLs to retrieve content for."),
|
|
208
|
+
ids: external_exports.array(external_exports.string().min(1)).min(1).describe("Deprecated. A backward-compatibility list of Exa document IDs.").optional(),
|
|
209
|
+
text: external_exports.union([external_exports.boolean().describe("Whether Exa should return extracted text."), external_exports.strictObject({
|
|
210
|
+
maxCharacters: external_exports.int().min(1).describe("The maximum number of characters to return for extracted text.").optional(),
|
|
211
|
+
includeHtmlTags: external_exports.boolean().describe("Whether Exa should preserve HTML tags in extracted text.").optional(),
|
|
212
|
+
verbosity: external_exports.enum(["compact", "standard", "full"]).describe("The verbosity level for extracted page text.").optional(),
|
|
213
|
+
includeSections: external_exports.array(external_exports.enum(["header", "navigation", "banner", "body", "sidebar", "footer", "metadata"]).describe("A semantic page section used by Exa content extraction.")).min(1).describe("Only include content from these semantic page sections.").optional(),
|
|
214
|
+
excludeSections: external_exports.array(external_exports.enum(["header", "navigation", "banner", "body", "sidebar", "footer", "metadata"]).describe("A semantic page section used by Exa content extraction.")).min(1).describe("Exclude content from these semantic page sections.").optional()
|
|
215
|
+
}).describe("Advanced configuration for Exa text extraction.")]).optional(),
|
|
216
|
+
highlights: external_exports.union([external_exports.boolean().describe("Whether Exa should return highlights."), external_exports.strictObject({
|
|
217
|
+
maxCharacters: external_exports.int().min(1).describe("The maximum number of characters to return across highlights.").optional(),
|
|
218
|
+
numSentences: external_exports.int().min(1).describe("Deprecated by Exa. The number of sentences to include in each highlight snippet.").optional(),
|
|
219
|
+
highlightsPerUrl: external_exports.int().min(1).describe("Deprecated by Exa. The number of highlight snippets to return per URL.").optional(),
|
|
220
|
+
query: external_exports.string().min(1).describe("A custom query that guides Exa highlight selection.").optional()
|
|
221
|
+
}).describe("Advanced configuration for Exa highlights.")]).optional(),
|
|
222
|
+
summary: external_exports.strictObject({
|
|
223
|
+
query: external_exports.string().min(1).describe("A custom query that guides Exa summary generation.").optional(),
|
|
224
|
+
schema: external_exports.looseObject({}).describe("A JSON Schema object used for structured Exa summaries.").optional()
|
|
225
|
+
}).describe("Configuration for an Exa summary response.").optional(),
|
|
226
|
+
livecrawlTimeout: external_exports.int().min(0).describe("The livecrawl timeout in milliseconds.").optional(),
|
|
227
|
+
maxAgeHours: external_exports.union([external_exports.literal(-1), external_exports.int().min(0).describe("A non-negative cache age in hours.")]).describe("Maximum age of cached content in hours. Use -1 to always use cache, 0 to always livecrawl, or a positive integer to require fresher content.").optional(),
|
|
228
|
+
subpages: external_exports.int().min(0).describe("The maximum number of subpages Exa should crawl per result.").optional(),
|
|
229
|
+
subpageTarget: external_exports.union([external_exports.string().min(1).describe("A single keyword used to locate relevant subpages."), external_exports.array(external_exports.string().min(1)).min(1).describe("A list of keywords used to locate relevant subpages.")]).describe("Keywords Exa should use when selecting subpages.").optional(),
|
|
230
|
+
extras: external_exports.strictObject({
|
|
231
|
+
links: external_exports.int().min(0).describe("The maximum number of webpage links to return for each result.").optional(),
|
|
232
|
+
imageLinks: external_exports.int().min(0).describe("The maximum number of image links to return for each result.").optional()
|
|
233
|
+
}).describe("Additional Exa extraction options.").optional()
|
|
234
|
+
}).describe("The input payload for fetching Exa contents by URL.");
|
|
235
|
+
var getContentsOutput = external_exports.strictObject({
|
|
236
|
+
requestId: external_exports.string().describe("The unique identifier for this Exa request."),
|
|
237
|
+
results: external_exports.array(external_exports.looseObject({
|
|
238
|
+
id: external_exports.string().describe("The temporary Exa document identifier.").optional(),
|
|
239
|
+
url: external_exports.string().describe("The result URL.").optional(),
|
|
240
|
+
title: external_exports.string().describe("The result title.").optional(),
|
|
241
|
+
publishedDate: external_exports.string().describe("The estimated publication timestamp for the result.").nullable().optional(),
|
|
242
|
+
author: external_exports.string().describe("The result author.").nullable().optional(),
|
|
243
|
+
score: external_exports.number().describe("The result relevance score.").nullable().optional()
|
|
244
|
+
}).describe("An Exa search or contents result object.")).describe("The Exa content results returned successfully."),
|
|
245
|
+
statuses: external_exports.array(external_exports.looseObject({}).describe("One Exa content status.")).describe("The fetch status for each requested input item.").optional(),
|
|
246
|
+
costDollars: external_exports.looseObject({
|
|
247
|
+
total: external_exports.number().describe("The total request cost in US dollars.").optional()
|
|
248
|
+
}).describe("The Exa costDollars object.").optional()
|
|
249
|
+
}).describe("The response payload for exa.get_contents.");
|
|
250
|
+
var answerInput = external_exports.strictObject({
|
|
251
|
+
query: external_exports.string().min(1).describe("The question or prompt Exa should answer."),
|
|
252
|
+
text: external_exports.boolean().describe("Whether citations should include the full source text.").optional()
|
|
253
|
+
}).describe("The input payload for an Exa answer request.");
|
|
254
|
+
var answerOutput = external_exports.strictObject({
|
|
255
|
+
answer: external_exports.union([external_exports.string().describe("The text answer returned by Exa."), external_exports.looseObject({}).describe("The structured answer returned by Exa.")]).optional(),
|
|
256
|
+
citations: external_exports.array(external_exports.looseObject({}).describe("An Exa answer citation.")).describe("The citations supporting the Exa answer."),
|
|
257
|
+
costDollars: external_exports.looseObject({
|
|
258
|
+
total: external_exports.number().describe("The total request cost in US dollars.").optional()
|
|
259
|
+
}).describe("The Exa costDollars object.").optional()
|
|
260
|
+
}).describe("The response payload for exa.answer.");
|
|
261
|
+
var findSimilarInput = external_exports.strictObject({
|
|
262
|
+
url: external_exports.url().describe("The URL used to find similar pages."),
|
|
263
|
+
excludeSourceDomain: external_exports.boolean().describe("Whether to exclude results from the same domain as the input URL.").optional(),
|
|
264
|
+
numResults: external_exports.int().min(1).max(100).describe("The number of similar results to return, up to 100.").optional(),
|
|
265
|
+
includeDomains: external_exports.array(external_exports.string().min(1)).min(1).describe("Only return results from these domains.").optional(),
|
|
266
|
+
excludeDomains: external_exports.array(external_exports.string().min(1)).min(1).describe("Exclude results from these domains.").optional(),
|
|
267
|
+
startCrawlDate: external_exports.iso.datetime({ offset: true }).describe("Only return results crawled after this timestamp.").optional(),
|
|
268
|
+
endCrawlDate: external_exports.iso.datetime({ offset: true }).describe("Only return results crawled before this timestamp.").optional(),
|
|
269
|
+
startPublishedDate: external_exports.iso.datetime({ offset: true }).describe("Only return results published after this timestamp.").optional(),
|
|
270
|
+
endPublishedDate: external_exports.iso.datetime({ offset: true }).describe("Only return results published before this timestamp.").optional(),
|
|
271
|
+
includeText: external_exports.array(external_exports.string().min(1)).min(1).describe("Phrases that must appear in the result text.").optional(),
|
|
272
|
+
excludeText: external_exports.array(external_exports.string().min(1)).min(1).describe("Phrases that must not appear in the result text.").optional(),
|
|
273
|
+
moderation: external_exports.boolean().describe("Whether Exa should filter unsafe content from results.").optional(),
|
|
274
|
+
contents: external_exports.strictObject({
|
|
275
|
+
text: external_exports.union([external_exports.boolean().describe("Whether Exa should return extracted text."), external_exports.strictObject({
|
|
276
|
+
maxCharacters: external_exports.int().min(1).describe("The maximum number of characters to return for extracted text.").optional(),
|
|
277
|
+
includeHtmlTags: external_exports.boolean().describe("Whether Exa should preserve HTML tags in extracted text.").optional(),
|
|
278
|
+
verbosity: external_exports.enum(["compact", "standard", "full"]).describe("The verbosity level for extracted page text.").optional(),
|
|
279
|
+
includeSections: external_exports.array(external_exports.enum(["header", "navigation", "banner", "body", "sidebar", "footer", "metadata"]).describe("A semantic page section used by Exa content extraction.")).min(1).describe("Only include content from these semantic page sections.").optional(),
|
|
280
|
+
excludeSections: external_exports.array(external_exports.enum(["header", "navigation", "banner", "body", "sidebar", "footer", "metadata"]).describe("A semantic page section used by Exa content extraction.")).min(1).describe("Exclude content from these semantic page sections.").optional()
|
|
281
|
+
}).describe("Advanced configuration for Exa text extraction.")]).optional(),
|
|
282
|
+
highlights: external_exports.union([external_exports.boolean().describe("Whether Exa should return highlights."), external_exports.strictObject({
|
|
283
|
+
maxCharacters: external_exports.int().min(1).describe("The maximum number of characters to return across highlights.").optional(),
|
|
284
|
+
numSentences: external_exports.int().min(1).describe("Deprecated by Exa. The number of sentences to include in each highlight snippet.").optional(),
|
|
285
|
+
highlightsPerUrl: external_exports.int().min(1).describe("Deprecated by Exa. The number of highlight snippets to return per URL.").optional(),
|
|
286
|
+
query: external_exports.string().min(1).describe("A custom query that guides Exa highlight selection.").optional()
|
|
287
|
+
}).describe("Advanced configuration for Exa highlights.")]).optional(),
|
|
288
|
+
summary: external_exports.strictObject({
|
|
289
|
+
query: external_exports.string().min(1).describe("A custom query that guides Exa summary generation.").optional(),
|
|
290
|
+
schema: external_exports.looseObject({}).describe("A JSON Schema object used for structured Exa summaries.").optional()
|
|
291
|
+
}).describe("Configuration for an Exa summary response.").optional(),
|
|
292
|
+
livecrawlTimeout: external_exports.int().min(0).describe("The livecrawl timeout in milliseconds.").optional(),
|
|
293
|
+
maxAgeHours: external_exports.union([external_exports.literal(-1), external_exports.int().min(0).describe("A non-negative cache age in hours.")]).describe("Maximum age of cached content in hours. Use -1 to always use cache, 0 to always livecrawl, or a positive integer to require fresher content.").optional(),
|
|
294
|
+
subpages: external_exports.int().min(0).describe("The maximum number of subpages Exa should crawl per result.").optional(),
|
|
295
|
+
subpageTarget: external_exports.union([external_exports.string().min(1).describe("A single keyword used to locate relevant subpages."), external_exports.array(external_exports.string().min(1)).min(1).describe("A list of keywords used to locate relevant subpages.")]).describe("Keywords Exa should use when selecting subpages.").optional(),
|
|
296
|
+
extras: external_exports.strictObject({
|
|
297
|
+
links: external_exports.int().min(0).describe("The maximum number of webpage links to return for each result.").optional(),
|
|
298
|
+
imageLinks: external_exports.int().min(0).describe("The maximum number of image links to return for each result.").optional()
|
|
299
|
+
}).describe("Additional Exa extraction options.").optional()
|
|
300
|
+
}).describe("The Exa contents request object.").optional()
|
|
301
|
+
}).describe("The input payload for an Exa findSimilar request. includeDomains and excludeDomains cannot be provided together.");
|
|
302
|
+
var findSimilarOutput = external_exports.strictObject({
|
|
303
|
+
requestId: external_exports.string().describe("The unique identifier for this Exa request."),
|
|
304
|
+
results: external_exports.array(external_exports.looseObject({
|
|
305
|
+
id: external_exports.string().describe("The temporary Exa document identifier.").optional(),
|
|
306
|
+
url: external_exports.string().describe("The result URL.").optional(),
|
|
307
|
+
title: external_exports.string().describe("The result title.").optional(),
|
|
308
|
+
publishedDate: external_exports.string().describe("The estimated publication timestamp for the result.").nullable().optional(),
|
|
309
|
+
author: external_exports.string().describe("The result author.").nullable().optional(),
|
|
310
|
+
score: external_exports.number().describe("The result relevance score.").nullable().optional()
|
|
311
|
+
}).describe("An Exa search or contents result object.")).describe("The Exa similar-page results."),
|
|
312
|
+
costDollars: external_exports.looseObject({
|
|
313
|
+
total: external_exports.number().describe("The total request cost in US dollars.").optional()
|
|
314
|
+
}).describe("The Exa costDollars object.").optional()
|
|
315
|
+
}).describe("The response payload for exa.find_similar.");
|
|
316
|
+
var exaActions = {
|
|
317
|
+
search: {
|
|
318
|
+
description: "Search the web with Exa and optionally enrich each result with contents.",
|
|
319
|
+
effect: "write",
|
|
320
|
+
inputSchema: searchInput,
|
|
321
|
+
outputSchema: external_exports.toJSONSchema(searchOutput, { io: "output", unrepresentable: "any" })
|
|
322
|
+
},
|
|
323
|
+
get_contents: {
|
|
324
|
+
description: "Fetch text, highlights, or summaries from Exa for URLs or document IDs.",
|
|
325
|
+
effect: "read",
|
|
326
|
+
inputSchema: getContentsInput,
|
|
327
|
+
outputSchema: external_exports.toJSONSchema(getContentsOutput, { io: "output", unrepresentable: "any" })
|
|
328
|
+
},
|
|
329
|
+
answer: {
|
|
330
|
+
description: "Generate a citation-backed answer from Exa search results.",
|
|
331
|
+
effect: "write",
|
|
332
|
+
inputSchema: answerInput,
|
|
333
|
+
outputSchema: external_exports.toJSONSchema(answerOutput, { io: "output", unrepresentable: "any" })
|
|
334
|
+
},
|
|
335
|
+
find_similar: {
|
|
336
|
+
description: "Find pages similar to a given URL and optionally enrich them with contents.",
|
|
337
|
+
effect: "read",
|
|
338
|
+
inputSchema: findSimilarInput,
|
|
339
|
+
outputSchema: external_exports.toJSONSchema(findSimilarOutput, { io: "output", unrepresentable: "any" })
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
// ../plugins/src/exa/index.ts
|
|
344
|
+
function createExaPlugin() {
|
|
345
|
+
return createProviderPlugin({
|
|
346
|
+
description: "Exa",
|
|
347
|
+
actions: exaActions,
|
|
348
|
+
handlers: {
|
|
349
|
+
search,
|
|
350
|
+
get_contents: getContents,
|
|
351
|
+
answer,
|
|
352
|
+
find_similar: findSimilar
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
var exa_default = createExaPlugin();
|
|
357
|
+
export {
|
|
358
|
+
createExaPlugin,
|
|
359
|
+
exa_default as default
|
|
360
|
+
};
|