@keystrokehq/exa 0.0.16 → 0.0.55
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/LICENSE +1 -1
- package/README.md +90 -2
- package/dist/actions/index.cjs +17 -0
- package/dist/actions/index.d.cts +2 -0
- package/dist/actions/index.d.mts +2 -0
- package/dist/actions/index.mjs +2 -0
- package/dist/actions-Bl-9uz6K.cjs +491 -0
- package/dist/actions-Bl-9uz6K.cjs.map +1 -0
- package/dist/actions-DnHafheX.mjs +373 -0
- package/dist/actions-DnHafheX.mjs.map +1 -0
- package/dist/credential-BWous9Uu.cjs +16 -0
- package/dist/credential-BWous9Uu.cjs.map +1 -0
- package/dist/credential-NfXyV_Vy.mjs +11 -0
- package/dist/credential-NfXyV_Vy.mjs.map +1 -0
- package/dist/index-BwCGHs6v.d.cts +357 -0
- package/dist/index-BwCGHs6v.d.cts.map +1 -0
- package/dist/index-BwCGHs6v.d.mts +357 -0
- package/dist/index-BwCGHs6v.d.mts.map +1 -0
- package/dist/index.cjs +14 -0
- package/dist/index.d.cts +20 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +20 -4
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +4 -5
- package/dist/mcp.cjs +57 -0
- package/dist/mcp.cjs.map +1 -0
- package/dist/mcp.d.cts +16 -0
- package/dist/mcp.d.cts.map +1 -0
- package/dist/mcp.d.mts +16 -0
- package/dist/mcp.d.mts.map +1 -0
- package/dist/mcp.mjs +54 -0
- package/dist/mcp.mjs.map +1 -0
- package/package.json +49 -54
- package/dist/contents.schema-BNgTB2DN.mjs +0 -133
- package/dist/credential-sets/index.d.mts +0 -2
- package/dist/credential-sets/index.mjs +0 -3
- package/dist/exa.credential-set-BGLENRlR.d.mts +0 -14
- package/dist/exa.credential-set-Ba-RsxL2.mjs +0 -15
- package/dist/operations/index.d.mts +0 -2
- package/dist/operations/index.mjs +0 -3
- package/dist/schemas/index.d.mts +0 -2
- package/dist/schemas/index.mjs +0 -3
- package/dist/search.schema-Cw-d91N6.d.mts +0 -204
- package/dist/update-monitor.operation-D-vWJFP3.mjs +0 -478
- package/dist/update-monitor.operation-Dm50YoS7.d.mts +0 -570
|
@@ -1,478 +0,0 @@
|
|
|
1
|
-
import { t as exaCredentialSet } from "./exa.credential-set-Ba-RsxL2.mjs";
|
|
2
|
-
import { a as exaMonitorRunListResponseSchema, c as exaTriggerMonitorResponseSchema, i as exaMonitorListResponseSchema, n as exaContentsResponseSchema, o as exaMonitorRunSchema, r as exaSearchResponseSchema, s as exaMonitorSchema, t as contentsOptionsSchema, u as exaAnswerResponseSchema } from "./contents.schema-BNgTB2DN.mjs";
|
|
3
|
-
import { Operation } from "@keystrokehq/core";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import Exa from "exa-js";
|
|
6
|
-
|
|
7
|
-
//#region src/utils/client.ts
|
|
8
|
-
function createExaClient(credentials) {
|
|
9
|
-
return new Exa(credentials.EXA_API_KEY);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/operations/answer.operation.ts
|
|
14
|
-
const answerOperation = new Operation({
|
|
15
|
-
id: "exa.answer",
|
|
16
|
-
name: "Exa Answer",
|
|
17
|
-
description: "Get an AI-generated answer to a query with citations from web sources using Exa.",
|
|
18
|
-
credentialSets: [exaCredentialSet],
|
|
19
|
-
input: z.object({
|
|
20
|
-
query: z.string(),
|
|
21
|
-
text: z.boolean().optional(),
|
|
22
|
-
model: z.enum(["exa"]).optional(),
|
|
23
|
-
systemPrompt: z.string().optional(),
|
|
24
|
-
outputSchema: z.record(z.string(), z.unknown()).optional(),
|
|
25
|
-
userLocation: z.string().optional()
|
|
26
|
-
}),
|
|
27
|
-
output: exaAnswerResponseSchema,
|
|
28
|
-
run: async (input, context) => {
|
|
29
|
-
const client = createExaClient(context.credentials.exa);
|
|
30
|
-
const { query, ...options } = input;
|
|
31
|
-
return await client.answer(query, options);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region src/operations/create-monitor.operation.ts
|
|
37
|
-
const createMonitorOperation = new Operation({
|
|
38
|
-
id: "exa.create-monitor",
|
|
39
|
-
name: "Create Exa Monitor",
|
|
40
|
-
description: "Create a new Exa monitor to track search results over time.",
|
|
41
|
-
credentialSets: [exaCredentialSet],
|
|
42
|
-
needsApproval: true,
|
|
43
|
-
input: z.object({
|
|
44
|
-
name: z.string().optional(),
|
|
45
|
-
search: z.object({
|
|
46
|
-
query: z.string(),
|
|
47
|
-
numResults: z.number().optional(),
|
|
48
|
-
contents: z.unknown().optional()
|
|
49
|
-
}),
|
|
50
|
-
trigger: z.object({
|
|
51
|
-
type: z.string(),
|
|
52
|
-
period: z.string().optional()
|
|
53
|
-
}).optional(),
|
|
54
|
-
outputSchema: z.record(z.string(), z.unknown()).optional(),
|
|
55
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
56
|
-
webhook: z.object({
|
|
57
|
-
url: z.string(),
|
|
58
|
-
events: z.array(z.string()).optional()
|
|
59
|
-
})
|
|
60
|
-
}),
|
|
61
|
-
output: exaMonitorSchema,
|
|
62
|
-
run: async (input, context) => {
|
|
63
|
-
return await createExaClient(context.credentials.exa).monitors.create(input);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region src/operations/delete-monitor.operation.ts
|
|
69
|
-
const deleteMonitorOperation = new Operation({
|
|
70
|
-
id: "exa.delete-monitor",
|
|
71
|
-
name: "Delete Exa Monitor",
|
|
72
|
-
description: "Delete an Exa monitor by ID. Returns the deleted monitor object.",
|
|
73
|
-
credentialSets: [exaCredentialSet],
|
|
74
|
-
needsApproval: true,
|
|
75
|
-
input: z.object({ monitorId: z.string() }),
|
|
76
|
-
output: exaMonitorSchema,
|
|
77
|
-
run: async (input, context) => {
|
|
78
|
-
return await createExaClient(context.credentials.exa).monitors.delete(input.monitorId);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/operations/find-similar.operation.ts
|
|
84
|
-
const findSimilarOperation = new Operation({
|
|
85
|
-
id: "exa.find-similar",
|
|
86
|
-
name: "Exa Find Similar",
|
|
87
|
-
description: "Find web pages similar to a given URL.",
|
|
88
|
-
credentialSets: [exaCredentialSet],
|
|
89
|
-
input: z.object({
|
|
90
|
-
url: z.string(),
|
|
91
|
-
excludeSourceDomain: z.boolean().optional(),
|
|
92
|
-
numResults: z.number().min(1).max(100).optional(),
|
|
93
|
-
includeDomains: z.array(z.string()).optional(),
|
|
94
|
-
excludeDomains: z.array(z.string()).optional(),
|
|
95
|
-
startCrawlDate: z.string().optional(),
|
|
96
|
-
endCrawlDate: z.string().optional(),
|
|
97
|
-
startPublishedDate: z.string().optional(),
|
|
98
|
-
endPublishedDate: z.string().optional(),
|
|
99
|
-
includeText: z.array(z.string()).optional(),
|
|
100
|
-
excludeText: z.array(z.string()).optional(),
|
|
101
|
-
moderation: z.boolean().optional()
|
|
102
|
-
}),
|
|
103
|
-
output: exaSearchResponseSchema,
|
|
104
|
-
run: async (input, context) => {
|
|
105
|
-
const client = createExaClient(context.credentials.exa);
|
|
106
|
-
const { url, ...options } = input;
|
|
107
|
-
return await client.findSimilar(url, {
|
|
108
|
-
...options,
|
|
109
|
-
contents: false
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region src/operations/find-similar-with-contents.operation.ts
|
|
116
|
-
const findSimilarWithContentsOperation = new Operation({
|
|
117
|
-
id: "exa.find-similar-with-contents",
|
|
118
|
-
name: "Exa Find Similar with Contents",
|
|
119
|
-
description: "Find web pages similar to a given URL and retrieve their contents in a single request.",
|
|
120
|
-
credentialSets: [exaCredentialSet],
|
|
121
|
-
input: z.object({
|
|
122
|
-
url: z.string(),
|
|
123
|
-
excludeSourceDomain: z.boolean().optional(),
|
|
124
|
-
numResults: z.number().min(1).max(100).optional(),
|
|
125
|
-
includeDomains: z.array(z.string()).optional(),
|
|
126
|
-
excludeDomains: z.array(z.string()).optional(),
|
|
127
|
-
startCrawlDate: z.string().optional(),
|
|
128
|
-
endCrawlDate: z.string().optional(),
|
|
129
|
-
startPublishedDate: z.string().optional(),
|
|
130
|
-
endPublishedDate: z.string().optional(),
|
|
131
|
-
includeText: z.array(z.string()).optional(),
|
|
132
|
-
excludeText: z.array(z.string()).optional(),
|
|
133
|
-
moderation: z.boolean().optional(),
|
|
134
|
-
text: z.union([z.literal(true), z.object({
|
|
135
|
-
maxCharacters: z.number().optional(),
|
|
136
|
-
includeHtmlTags: z.boolean().optional(),
|
|
137
|
-
verbosity: z.enum([
|
|
138
|
-
"compact",
|
|
139
|
-
"standard",
|
|
140
|
-
"full"
|
|
141
|
-
]).optional()
|
|
142
|
-
})]).optional(),
|
|
143
|
-
highlights: z.union([z.literal(true), z.object({
|
|
144
|
-
maxCharacters: z.number().optional(),
|
|
145
|
-
query: z.string().optional()
|
|
146
|
-
})]).optional(),
|
|
147
|
-
summary: z.object({
|
|
148
|
-
query: z.string().optional(),
|
|
149
|
-
schema: z.record(z.string(), z.unknown()).optional()
|
|
150
|
-
}).optional(),
|
|
151
|
-
livecrawl: z.enum([
|
|
152
|
-
"always",
|
|
153
|
-
"fallback",
|
|
154
|
-
"never",
|
|
155
|
-
"auto",
|
|
156
|
-
"preferred"
|
|
157
|
-
]).optional(),
|
|
158
|
-
livecrawlTimeout: z.number().optional(),
|
|
159
|
-
maxAgeHours: z.number().optional(),
|
|
160
|
-
subpages: z.number().optional(),
|
|
161
|
-
subpageTarget: z.union([z.string(), z.array(z.string())]).optional(),
|
|
162
|
-
extras: z.record(z.string(), z.unknown()).optional(),
|
|
163
|
-
filterEmptyResults: z.boolean().optional()
|
|
164
|
-
}),
|
|
165
|
-
output: exaSearchResponseSchema,
|
|
166
|
-
run: async (input, context) => {
|
|
167
|
-
const client = createExaClient(context.credentials.exa);
|
|
168
|
-
const { url, text, highlights, summary, livecrawl, livecrawlTimeout, maxAgeHours, subpages, subpageTarget, extras, filterEmptyResults, ...searchOptions } = input;
|
|
169
|
-
const contents = {
|
|
170
|
-
text,
|
|
171
|
-
highlights,
|
|
172
|
-
summary,
|
|
173
|
-
livecrawl,
|
|
174
|
-
livecrawlTimeout,
|
|
175
|
-
maxAgeHours,
|
|
176
|
-
subpages,
|
|
177
|
-
subpageTarget,
|
|
178
|
-
extras,
|
|
179
|
-
filterEmptyResults
|
|
180
|
-
};
|
|
181
|
-
return await client.findSimilar(url, {
|
|
182
|
-
...searchOptions,
|
|
183
|
-
contents
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
//#endregion
|
|
189
|
-
//#region src/operations/get-contents.operation.ts
|
|
190
|
-
const getContentsOperation = new Operation({
|
|
191
|
-
id: "exa.get-contents",
|
|
192
|
-
name: "Exa Get Contents",
|
|
193
|
-
description: "Retrieve page contents (text, highlights, summaries) for a list of URLs.",
|
|
194
|
-
credentialSets: [exaCredentialSet],
|
|
195
|
-
input: z.object({
|
|
196
|
-
urls: z.array(z.string()).min(1),
|
|
197
|
-
text: z.union([z.literal(true), z.object({
|
|
198
|
-
maxCharacters: z.number().optional(),
|
|
199
|
-
includeHtmlTags: z.boolean().optional(),
|
|
200
|
-
verbosity: z.enum([
|
|
201
|
-
"compact",
|
|
202
|
-
"standard",
|
|
203
|
-
"full"
|
|
204
|
-
]).optional()
|
|
205
|
-
})]).optional(),
|
|
206
|
-
highlights: z.union([z.literal(true), z.object({
|
|
207
|
-
maxCharacters: z.number().optional(),
|
|
208
|
-
query: z.string().optional()
|
|
209
|
-
})]).optional(),
|
|
210
|
-
summary: z.object({
|
|
211
|
-
query: z.string().optional(),
|
|
212
|
-
schema: z.record(z.string(), z.unknown()).optional()
|
|
213
|
-
}).optional(),
|
|
214
|
-
livecrawl: z.enum([
|
|
215
|
-
"always",
|
|
216
|
-
"fallback",
|
|
217
|
-
"never",
|
|
218
|
-
"auto",
|
|
219
|
-
"preferred"
|
|
220
|
-
]).optional(),
|
|
221
|
-
livecrawlTimeout: z.number().optional(),
|
|
222
|
-
maxAgeHours: z.number().optional(),
|
|
223
|
-
subpages: z.number().optional(),
|
|
224
|
-
subpageTarget: z.union([z.string(), z.array(z.string())]).optional(),
|
|
225
|
-
extras: z.record(z.string(), z.unknown()).optional(),
|
|
226
|
-
filterEmptyResults: z.boolean().optional()
|
|
227
|
-
}),
|
|
228
|
-
output: exaContentsResponseSchema,
|
|
229
|
-
run: async (input, context) => {
|
|
230
|
-
const client = createExaClient(context.credentials.exa);
|
|
231
|
-
const { urls, ...options } = input;
|
|
232
|
-
return await client.getContents(urls, options);
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
//#endregion
|
|
237
|
-
//#region src/operations/get-monitor.operation.ts
|
|
238
|
-
const getMonitorOperation = new Operation({
|
|
239
|
-
id: "exa.get-monitor",
|
|
240
|
-
name: "Get Exa Monitor",
|
|
241
|
-
description: "Get details of a specific Exa monitor by ID.",
|
|
242
|
-
credentialSets: [exaCredentialSet],
|
|
243
|
-
input: z.object({ monitorId: z.string() }),
|
|
244
|
-
output: exaMonitorSchema,
|
|
245
|
-
run: async (input, context) => {
|
|
246
|
-
return await createExaClient(context.credentials.exa).monitors.get(input.monitorId);
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
//#endregion
|
|
251
|
-
//#region src/operations/get-monitor-run.operation.ts
|
|
252
|
-
const getMonitorRunOperation = new Operation({
|
|
253
|
-
id: "exa.get-monitor-run",
|
|
254
|
-
name: "Get Exa Monitor Run",
|
|
255
|
-
description: "Get details of a specific Exa monitor run.",
|
|
256
|
-
credentialSets: [exaCredentialSet],
|
|
257
|
-
input: z.object({
|
|
258
|
-
monitorId: z.string(),
|
|
259
|
-
runId: z.string()
|
|
260
|
-
}),
|
|
261
|
-
output: exaMonitorRunSchema,
|
|
262
|
-
run: async (input, context) => {
|
|
263
|
-
return await createExaClient(context.credentials.exa).monitors.runs.get(input.monitorId, input.runId);
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
//#endregion
|
|
268
|
-
//#region src/operations/list-monitor-runs.operation.ts
|
|
269
|
-
const listMonitorRunsOperation = new Operation({
|
|
270
|
-
id: "exa.list-monitor-runs",
|
|
271
|
-
name: "List Exa Monitor Runs",
|
|
272
|
-
description: "List runs for a specific Exa monitor with pagination.",
|
|
273
|
-
credentialSets: [exaCredentialSet],
|
|
274
|
-
input: z.object({
|
|
275
|
-
monitorId: z.string(),
|
|
276
|
-
cursor: z.string().optional(),
|
|
277
|
-
limit: z.number().min(1).max(100).optional()
|
|
278
|
-
}),
|
|
279
|
-
output: exaMonitorRunListResponseSchema,
|
|
280
|
-
run: async (input, context) => {
|
|
281
|
-
const client = createExaClient(context.credentials.exa);
|
|
282
|
-
const { monitorId, ...rest } = input;
|
|
283
|
-
return await client.monitors.runs.list(monitorId, rest);
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
//#endregion
|
|
288
|
-
//#region src/operations/list-monitors.operation.ts
|
|
289
|
-
const listMonitorsOperation = new Operation({
|
|
290
|
-
id: "exa.list-monitors",
|
|
291
|
-
name: "List Exa Monitors",
|
|
292
|
-
description: "List all Exa monitors with optional status filtering and pagination.",
|
|
293
|
-
credentialSets: [exaCredentialSet],
|
|
294
|
-
input: z.object({
|
|
295
|
-
status: z.enum([
|
|
296
|
-
"active",
|
|
297
|
-
"paused",
|
|
298
|
-
"disabled"
|
|
299
|
-
]).optional(),
|
|
300
|
-
cursor: z.string().optional(),
|
|
301
|
-
limit: z.number().min(1).max(100).optional()
|
|
302
|
-
}),
|
|
303
|
-
output: exaMonitorListResponseSchema,
|
|
304
|
-
run: async (input, context) => {
|
|
305
|
-
return await createExaClient(context.credentials.exa).monitors.list(input);
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
//#endregion
|
|
310
|
-
//#region src/operations/search.operation.ts
|
|
311
|
-
const searchOperation = new Operation({
|
|
312
|
-
id: "exa.search",
|
|
313
|
-
name: "Exa Search",
|
|
314
|
-
description: "Search the web using Exa semantic, keyword, or hybrid search.",
|
|
315
|
-
credentialSets: [exaCredentialSet],
|
|
316
|
-
input: z.object({
|
|
317
|
-
query: z.string(),
|
|
318
|
-
type: z.enum([
|
|
319
|
-
"auto",
|
|
320
|
-
"neural",
|
|
321
|
-
"fast",
|
|
322
|
-
"instant",
|
|
323
|
-
"deep-lite",
|
|
324
|
-
"deep",
|
|
325
|
-
"deep-reasoning",
|
|
326
|
-
"keyword",
|
|
327
|
-
"hybrid"
|
|
328
|
-
]).optional(),
|
|
329
|
-
category: z.enum([
|
|
330
|
-
"company",
|
|
331
|
-
"research paper",
|
|
332
|
-
"news",
|
|
333
|
-
"personal site",
|
|
334
|
-
"financial report",
|
|
335
|
-
"people",
|
|
336
|
-
"pdf"
|
|
337
|
-
]).optional(),
|
|
338
|
-
numResults: z.number().min(1).max(100).optional(),
|
|
339
|
-
includeDomains: z.array(z.string()).optional(),
|
|
340
|
-
excludeDomains: z.array(z.string()).optional(),
|
|
341
|
-
startPublishedDate: z.string().optional(),
|
|
342
|
-
endPublishedDate: z.string().optional(),
|
|
343
|
-
startCrawlDate: z.string().optional(),
|
|
344
|
-
endCrawlDate: z.string().optional(),
|
|
345
|
-
includeText: z.array(z.string()).optional(),
|
|
346
|
-
excludeText: z.array(z.string()).optional(),
|
|
347
|
-
moderation: z.boolean().optional(),
|
|
348
|
-
useAutoprompt: z.boolean().optional(),
|
|
349
|
-
userLocation: z.string().optional()
|
|
350
|
-
}),
|
|
351
|
-
output: exaSearchResponseSchema,
|
|
352
|
-
run: async (input, context) => {
|
|
353
|
-
const client = createExaClient(context.credentials.exa);
|
|
354
|
-
const { query, ...options } = input;
|
|
355
|
-
return await client.search(query, {
|
|
356
|
-
...options,
|
|
357
|
-
contents: false
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
//#endregion
|
|
363
|
-
//#region src/operations/search-with-contents.operation.ts
|
|
364
|
-
const searchWithContentsOperation = new Operation({
|
|
365
|
-
id: "exa.search-with-contents",
|
|
366
|
-
name: "Exa Search with Contents",
|
|
367
|
-
description: "Search the web using Exa and retrieve page contents (text, highlights, summaries) in a single request.",
|
|
368
|
-
credentialSets: [exaCredentialSet],
|
|
369
|
-
input: z.object({
|
|
370
|
-
query: z.string(),
|
|
371
|
-
type: z.enum([
|
|
372
|
-
"auto",
|
|
373
|
-
"neural",
|
|
374
|
-
"fast",
|
|
375
|
-
"instant",
|
|
376
|
-
"deep-lite",
|
|
377
|
-
"deep",
|
|
378
|
-
"deep-reasoning",
|
|
379
|
-
"keyword",
|
|
380
|
-
"hybrid"
|
|
381
|
-
]).optional(),
|
|
382
|
-
category: z.enum([
|
|
383
|
-
"company",
|
|
384
|
-
"research paper",
|
|
385
|
-
"news",
|
|
386
|
-
"personal site",
|
|
387
|
-
"financial report",
|
|
388
|
-
"people",
|
|
389
|
-
"pdf"
|
|
390
|
-
]).optional(),
|
|
391
|
-
numResults: z.number().min(1).max(100).optional(),
|
|
392
|
-
includeDomains: z.array(z.string()).optional(),
|
|
393
|
-
excludeDomains: z.array(z.string()).optional(),
|
|
394
|
-
startPublishedDate: z.string().optional(),
|
|
395
|
-
endPublishedDate: z.string().optional(),
|
|
396
|
-
startCrawlDate: z.string().optional(),
|
|
397
|
-
endCrawlDate: z.string().optional(),
|
|
398
|
-
includeText: z.array(z.string()).optional(),
|
|
399
|
-
excludeText: z.array(z.string()).optional(),
|
|
400
|
-
moderation: z.boolean().optional(),
|
|
401
|
-
useAutoprompt: z.boolean().optional(),
|
|
402
|
-
userLocation: z.string().optional()
|
|
403
|
-
}).merge(contentsOptionsSchema),
|
|
404
|
-
output: exaSearchResponseSchema,
|
|
405
|
-
run: async (input, context) => {
|
|
406
|
-
const client = createExaClient(context.credentials.exa);
|
|
407
|
-
const { query, text, highlights, summary, livecrawl, livecrawlTimeout, maxAgeHours, subpages, subpageTarget, extras, filterEmptyResults, ...searchOptions } = input;
|
|
408
|
-
const contents = {
|
|
409
|
-
text,
|
|
410
|
-
highlights,
|
|
411
|
-
summary,
|
|
412
|
-
livecrawl,
|
|
413
|
-
livecrawlTimeout,
|
|
414
|
-
maxAgeHours,
|
|
415
|
-
subpages,
|
|
416
|
-
subpageTarget,
|
|
417
|
-
extras,
|
|
418
|
-
filterEmptyResults
|
|
419
|
-
};
|
|
420
|
-
return await client.search(query, {
|
|
421
|
-
...searchOptions,
|
|
422
|
-
contents
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
//#endregion
|
|
428
|
-
//#region src/operations/trigger-monitor.operation.ts
|
|
429
|
-
const triggerMonitorOperation = new Operation({
|
|
430
|
-
id: "exa.trigger-monitor",
|
|
431
|
-
name: "Trigger Exa Monitor",
|
|
432
|
-
description: "Manually trigger an Exa monitor to run immediately.",
|
|
433
|
-
credentialSets: [exaCredentialSet],
|
|
434
|
-
needsApproval: true,
|
|
435
|
-
input: z.object({ monitorId: z.string() }),
|
|
436
|
-
output: exaTriggerMonitorResponseSchema,
|
|
437
|
-
run: async (input, context) => {
|
|
438
|
-
return await createExaClient(context.credentials.exa).monitors.trigger(input.monitorId);
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
//#endregion
|
|
443
|
-
//#region src/operations/update-monitor.operation.ts
|
|
444
|
-
const updateMonitorOperation = new Operation({
|
|
445
|
-
id: "exa.update-monitor",
|
|
446
|
-
name: "Update Exa Monitor",
|
|
447
|
-
description: "Update an existing Exa monitor configuration.",
|
|
448
|
-
credentialSets: [exaCredentialSet],
|
|
449
|
-
needsApproval: true,
|
|
450
|
-
input: z.object({
|
|
451
|
-
monitorId: z.string(),
|
|
452
|
-
name: z.string().optional(),
|
|
453
|
-
search: z.object({
|
|
454
|
-
query: z.string(),
|
|
455
|
-
numResults: z.number().optional(),
|
|
456
|
-
contents: z.unknown().optional()
|
|
457
|
-
}).optional(),
|
|
458
|
-
trigger: z.object({
|
|
459
|
-
type: z.string(),
|
|
460
|
-
period: z.string().optional()
|
|
461
|
-
}).optional(),
|
|
462
|
-
outputSchema: z.record(z.string(), z.unknown()).optional(),
|
|
463
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
464
|
-
webhook: z.object({
|
|
465
|
-
url: z.string(),
|
|
466
|
-
events: z.array(z.string()).optional()
|
|
467
|
-
}).optional()
|
|
468
|
-
}),
|
|
469
|
-
output: exaMonitorSchema,
|
|
470
|
-
run: async (input, context) => {
|
|
471
|
-
const client = createExaClient(context.credentials.exa);
|
|
472
|
-
const { monitorId, ...rest } = input;
|
|
473
|
-
return await client.monitors.update(monitorId, rest);
|
|
474
|
-
}
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
//#endregion
|
|
478
|
-
export { listMonitorsOperation as a, getMonitorOperation as c, findSimilarOperation as d, deleteMonitorOperation as f, searchOperation as i, getContentsOperation as l, answerOperation as m, triggerMonitorOperation as n, listMonitorRunsOperation as o, createMonitorOperation as p, searchWithContentsOperation as r, getMonitorRunOperation as s, updateMonitorOperation as t, findSimilarWithContentsOperation as u };
|