-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.d.ts
More file actions
112 lines (97 loc) · 3.12 KB
/
index.d.ts
File metadata and controls
112 lines (97 loc) · 3.12 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
declare module 'spectrawl' {
interface SpectrawlConfig {
search?: {
cascade?: string[]
scrapeTop?: number
geminiKey?: string
'gemini-grounded'?: { apiKey?: string; model?: string }
tavily?: { apiKey?: string; searchDepth?: string; maxResults?: number }
llm?: { provider: string; model?: string; apiKey?: string }
sourceRanker?: {
weights?: Record<string, number>
boost?: string[]
block?: string[]
}
}
browse?: {
defaultEngine?: string
proxy?: { type: string; host: string; port: number; username?: string; password?: string }
humanlike?: { minDelay?: number; maxDelay?: number; scrollBehavior?: boolean }
captcha?: { apiKey?: string; model?: string }
}
auth?: {
refreshInterval?: string
cookieStore?: string
}
cache?: {
path?: string
searchTtl?: number
scrapeTtl?: number
screenshotTtl?: number
}
rateLimit?: Record<string, { postsPerHour?: number; minDelayMs?: number }>
proxy?: {
localPort?: number
strategy?: 'round-robin' | 'random' | 'least-used'
upstreams?: { url: string }[]
}
}
interface SearchResult {
title: string
url: string
snippet: string
content?: string
score?: number
engine?: string
}
interface SearchResponse {
answer: string | null
sources: SearchResult[]
cached: boolean
}
interface DeepSearchResponse {
answer: string | null
sources: SearchResult[]
queries: string[]
cached: boolean
}
interface DeepSearchOptions {
mode?: 'fast' | 'snippets' | 'full'
scrapeTop?: number
scrapeTimeout?: number
expand?: boolean
rerank?: boolean
summarize?: boolean
}
interface BrowseResult {
content: string
text?: string
screenshot?: Buffer
engine: string
url: string
}
interface AuthStatus {
platform: string
account: string
status: 'valid' | 'expired' | 'unknown'
expiresAt?: string
}
class Spectrawl {
constructor(config?: SpectrawlConfig | string)
/** Basic search — raw results from cascade engines */
search(query: string, opts?: { summarize?: boolean; scrapeTop?: number; engines?: string[] }): Promise<SearchResponse>
/** Deep search — Tavily-equivalent with citations. Set GEMINI_API_KEY for best results. */
deepSearch(query: string, opts?: DeepSearchOptions): Promise<DeepSearchResponse>
/** Browse a URL with stealth anti-detection */
browse(url: string, opts?: { screenshot?: boolean; timeout?: number; extractText?: boolean }): Promise<BrowseResult>
/** Act on a platform (post, comment, submit) */
act(platform: string, action: string, params: Record<string, any>): Promise<any>
/** Check auth health for all configured accounts */
status(): Promise<AuthStatus[]>
/** Get raw Playwright page for custom automation */
getPage(url: string, opts?: any): Promise<any>
/** Close all connections */
close(): Promise<void>
}
export { Spectrawl, SpectrawlConfig, SearchResult, SearchResponse, DeepSearchResponse, DeepSearchOptions, BrowseResult, AuthStatus }
}