-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Expand file tree
/
Copy pathtypes.ts
More file actions
434 lines (391 loc) · 12.1 KB
/
Copy pathtypes.ts
File metadata and controls
434 lines (391 loc) · 12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
import type { ToolFileData, ToolResponse } from '@/tools/types'
/** Credit accounting fields surfaced on every Context.dev tool output. */
interface CreditFields {
creditsConsumed: number | null
creditsRemaining: number | null
}
export interface ContextDevScrapeMarkdownParams {
apiKey: string
url: string
useMainContentOnly?: boolean
includeLinks?: boolean
includeImages?: boolean
includeFrames?: boolean
maxAgeMs?: number
waitForMs?: number
timeoutMS?: number
}
export interface ContextDevScrapeMarkdownResponse extends ToolResponse {
output: CreditFields & {
markdown: string
url: string
}
}
export interface ContextDevScrapeHtmlParams {
apiKey: string
url: string
useMainContentOnly?: boolean
includeFrames?: boolean
maxAgeMs?: number
waitForMs?: number
timeoutMS?: number
}
export interface ContextDevScrapeHtmlResponse extends ToolResponse {
output: CreditFields & {
html: string
url: string
type: string
}
}
export interface ContextDevScreenshotParams {
apiKey: string
url: string
fullScreenshot?: boolean
handleCookiePopup?: boolean
viewportWidth?: number
viewportHeight?: number
maxAgeMs?: number
waitForMs?: number
timeoutMS?: number
}
export interface ContextDevScreenshotResponse extends ToolResponse {
output: CreditFields & {
file?: ToolFileData
screenshotUrl: string
screenshotType: string | null
domain: string | null
width: number | null
height: number | null
}
}
export interface ContextDevScrapeImagesParams {
apiKey: string
url: string
maxAgeMs?: number
waitForMs?: number
timeoutMS?: number
enrichResolution?: boolean
enrichHostedUrl?: boolean
enrichClassification?: boolean
}
export interface ContextDevScrapeImagesResponse extends ToolResponse {
output: CreditFields & {
success: boolean
images: Array<Record<string, unknown>>
url: string
}
}
export interface ContextDevCrawlParams {
apiKey: string
url: string
maxPages?: number
maxDepth?: number
urlRegex?: string
includeLinks?: boolean
includeImages?: boolean
useMainContentOnly?: boolean
followSubdomains?: boolean
maxAgeMs?: number
waitForMs?: number
stopAfterMs?: number
timeoutMS?: number
}
export interface ContextDevCrawlResponse extends ToolResponse {
output: CreditFields & {
results: Array<{
markdown: string
metadata: Record<string, unknown>
}>
metadata: Record<string, unknown>
}
}
export interface ContextDevMapParams {
apiKey: string
domain: string
maxLinks?: number
urlRegex?: string
timeoutMS?: number
}
export interface ContextDevMapResponse extends ToolResponse {
output: CreditFields & {
domain: string
urls: string[]
meta: Record<string, unknown>
}
}
export interface ContextDevSearchParams {
apiKey: string
query: string
includeDomains?: string[]
excludeDomains?: string[]
freshness?: string
numResults?: number
country?: string
queryFanout?: boolean
markdownEnabled?: boolean
timeoutMS?: number
}
export interface ContextDevSearchResponse extends ToolResponse {
output: CreditFields & {
results: Array<Record<string, unknown>>
query: string
}
}
export interface ContextDevExtractParams {
apiKey: string
url: string
schema: Record<string, unknown>
instructions?: string
factCheck?: boolean
followSubdomains?: boolean
maxPages?: number
maxDepth?: number
maxAgeMs?: number
stopAfterMs?: number
timeoutMS?: number
}
export interface ContextDevExtractResponse extends ToolResponse {
output: CreditFields & {
status: string
url: string
urlsAnalyzed: string[]
data: Record<string, unknown>
metadata: Record<string, unknown>
}
}
export interface ContextDevExtractProductParams {
apiKey: string
url: string
maxAgeMs?: number
timeoutMS?: number
}
export interface ContextDevExtractProductResponse extends ToolResponse {
output: CreditFields & {
isProductPage: boolean
platform: string | null
product: Record<string, unknown> | null
}
}
export interface ContextDevExtractProductsParams {
apiKey: string
domain: string
maxProducts?: number
maxAgeMs?: number
timeoutMS?: number
}
export interface ContextDevExtractProductsResponse extends ToolResponse {
output: CreditFields & {
products: Array<Record<string, unknown>>
}
}
export interface ContextDevScrapeFontsParams {
apiKey: string
domain: string
maxAgeMs?: number
timeoutMS?: number
}
export interface ContextDevScrapeFontsResponse extends ToolResponse {
output: CreditFields & {
status: string
domain: string
fonts: Array<Record<string, unknown>>
fontLinks: Record<string, unknown>
}
}
export interface ContextDevScrapeStyleguideParams {
apiKey: string
domain: string
maxAgeMs?: number
timeoutMS?: number
}
export interface ContextDevScrapeStyleguideResponse extends ToolResponse {
output: CreditFields & {
status: string
domain: string
styleguide: Record<string, unknown> | null
}
}
export interface ContextDevClassifyNaicsParams {
apiKey: string
input: string
minResults?: number
maxResults?: number
timeoutMS?: number
}
export interface ContextDevClassifyNaicsResponse extends ToolResponse {
output: CreditFields & {
status: string
domain: string | null
type: string | null
codes: Array<Record<string, unknown>>
}
}
export interface ContextDevClassifySicParams {
apiKey: string
input: string
type?: string
minResults?: number
maxResults?: number
timeoutMS?: number
}
export interface ContextDevClassifySicResponse extends ToolResponse {
output: CreditFields & {
status: string
domain: string | null
type: string | null
classification: string | null
codes: Array<Record<string, unknown>>
}
}
/** Shared response shape for every brand-returning endpoint (full brand object). */
export interface ContextDevBrandResponse extends ToolResponse {
output: CreditFields & {
status: string
brand: Record<string, unknown> | null
}
}
export interface ContextDevGetBrandParams {
apiKey: string
domain: string
forceLanguage?: string
maxSpeed?: boolean
maxAgeMs?: number
timeoutMS?: number
}
export interface ContextDevGetBrandByNameParams {
apiKey: string
name: string
countryGl?: string
forceLanguage?: string
maxSpeed?: boolean
maxAgeMs?: number
timeoutMS?: number
}
export interface ContextDevGetBrandByEmailParams {
apiKey: string
email: string
forceLanguage?: string
maxSpeed?: boolean
maxAgeMs?: number
timeoutMS?: number
}
export interface ContextDevGetBrandByTickerParams {
apiKey: string
ticker: string
tickerExchange?: string
forceLanguage?: string
maxSpeed?: boolean
maxAgeMs?: number
timeoutMS?: number
}
export interface ContextDevIdentifyTransactionParams {
apiKey: string
transactionInfo: string
countryGl?: string
city?: string
mcc?: string
phone?: number
highConfidenceOnly?: boolean
forceLanguage?: string
maxSpeed?: boolean
timeoutMS?: number
}
/** Output schema for a single web search result. */
export const SEARCH_RESULT_OUTPUT_PROPERTIES = {
url: { type: 'string', description: 'Result page URL' },
title: { type: 'string', description: 'Result page title' },
description: { type: 'string', description: 'Result snippet/description' },
relevance: { type: 'string', description: 'Relevance rating (high, medium, low)' },
markdown: {
type: 'json',
description: 'Scraped markdown for the result (when markdown scraping is enabled)',
},
} as const
/** Output schema for a single crawled page. */
export const CRAWL_RESULT_OUTPUT_PROPERTIES = {
markdown: { type: 'string', description: 'Page content as markdown' },
metadata: { type: 'json', description: 'Page metadata (url, title, crawlDepth, statusCode)' },
} as const
/** Output schema for a single industry classification code. */
export const CLASSIFICATION_CODE_OUTPUT_PROPERTIES = {
code: { type: 'string', description: 'Industry code' },
name: { type: 'string', description: 'Industry name' },
confidence: { type: 'string', description: 'Match confidence (high, medium, low)' },
} as const
/** Output schema for the full brand object returned by brand-intelligence endpoints. */
export const BRAND_OUTPUT_PROPERTIES = {
domain: { type: 'string', description: 'Brand domain' },
title: { type: 'string', description: 'Brand title' },
description: { type: 'string', description: 'Brand description' },
slogan: { type: 'string', description: 'Brand slogan' },
colors: { type: 'json', description: 'Brand colors (hex and name)' },
logos: { type: 'json', description: 'Brand logos with mode, colors, resolution, and type' },
backdrops: { type: 'json', description: 'Brand backdrop images' },
socials: { type: 'json', description: 'Social media profiles (type and url)' },
address: { type: 'json', description: 'Brand address' },
stock: { type: 'json', description: 'Stock info (ticker and exchange)' },
is_nsfw: { type: 'boolean', description: 'Whether the brand contains adult content' },
email: { type: 'string', description: 'Brand contact email' },
phone: { type: 'string', description: 'Brand contact phone' },
industries: { type: 'json', description: 'Industry taxonomy (eic industry/subindustry pairs)' },
links: {
type: 'json',
description: 'Key brand links (careers, privacy, terms, blog, pricing, contact)',
},
primary_language: { type: 'string', description: 'Primary language of the brand site' },
} as const
/** Output schema for the reduced brand object returned by the simplified endpoint. */
export const SIMPLIFIED_BRAND_OUTPUT_PROPERTIES = {
domain: { type: 'string', description: 'Brand domain' },
title: { type: 'string', description: 'Brand title' },
colors: { type: 'json', description: 'Brand colors (hex and name)' },
logos: { type: 'json', description: 'Brand logos with mode, colors, resolution, and type' },
backdrops: { type: 'json', description: 'Brand backdrop images' },
} as const
/** Output schema for a single extracted product. */
export const PRODUCT_OUTPUT_PROPERTIES = {
name: { type: 'string', description: 'Product name' },
description: { type: 'string', description: 'Product description' },
price: { type: 'number', description: 'Product price' },
currency: { type: 'string', description: 'Price currency' },
billing_frequency: {
type: 'string',
description: 'Billing frequency (monthly, yearly, one_time, usage_based)',
},
pricing_model: {
type: 'string',
description: 'Pricing model (per_seat, flat, tiered, freemium, custom)',
},
url: { type: 'string', description: 'Product URL' },
category: { type: 'string', description: 'Product category' },
features: { type: 'json', description: 'Product features' },
target_audience: { type: 'json', description: 'Target audience' },
tags: { type: 'json', description: 'Product tags' },
image_url: { type: 'string', description: 'Primary product image URL' },
images: { type: 'json', description: 'Product image URLs' },
sku: { type: 'string', description: 'Product SKU' },
} as const
/** Output schema for a single font usage entry. */
export const FONT_OUTPUT_PROPERTIES = {
font: { type: 'string', description: 'Font family name' },
uses: { type: 'json', description: 'Where the font is used' },
fallbacks: { type: 'json', description: 'Fallback font families' },
num_elements: { type: 'number', description: 'Number of elements using the font' },
num_words: { type: 'number', description: 'Number of words rendered in the font' },
percent_words: { type: 'number', description: 'Percent of words using the font' },
percent_elements: { type: 'number', description: 'Percent of elements using the font' },
} as const
/** Output schema for a single scraped image. */
export const IMAGE_OUTPUT_PROPERTIES = {
src: { type: 'string', description: 'Image source URL or data' },
element: {
type: 'string',
description: 'Source element (img, svg, link, source, video, css, object, meta, background)',
},
type: { type: 'string', description: 'Image representation (url, html, base64)' },
alt: { type: 'string', description: 'Alt text', optional: true },
enrichment: {
type: 'json',
description: 'Optional enrichment (width, height, mimetype, url, type) when requested',
},
} as const