@howells/fieldwork-sdk 0.5.1 → 0.6.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/README.md +25 -24
- package/dist/{adapter-BgdfLBs-.d.ts → adapter-Bh8EIrNe.d.ts} +20 -6
- package/dist/brave.d.ts +22 -4
- package/dist/brave.js +71 -2
- package/dist/browserbase.d.ts +29 -4
- package/dist/browserbase.js +9 -4
- package/dist/{document-Dpj01mGx.js → document-Clmi51Sf.js} +5 -2
- package/dist/{errors-Yvk42oZH.js → errors-DROZyb9T.js} +13 -0
- package/dist/exa.d.ts +49 -7
- package/dist/exa.js +80 -13
- package/dist/{fieldwork-CXNIcqSN.d.ts → fieldwork-BaWqUNI3.d.ts} +20 -4
- package/dist/firecrawl.d.ts +64 -4
- package/dist/firecrawl.js +181 -54
- package/dist/index.d.ts +3 -3
- package/dist/index.js +26 -2
- package/dist/job-CWHOfhP_.js +102 -0
- package/dist/kernel.d.ts +99 -0
- package/dist/kernel.js +313 -0
- package/dist/llamaparse.d.ts +7 -2
- package/dist/llamaparse.js +23 -12
- package/dist/parallel.d.ts +83 -7
- package/dist/parallel.js +186 -26
- package/dist/{parse-n8MmaK1x.js → parse-COHKvfH9.js} +115 -17
- package/dist/perplexity.d.ts +37 -5
- package/dist/perplexity.js +146 -36
- package/dist/reducto.d.ts +16 -2
- package/dist/reducto.js +28 -15
- package/dist/{schema-Cupy7-7q.d.ts → schema-BWWiMvkg.d.ts} +1 -1
- package/dist/{schema-DbSIABP0.js → schema-BYcXgfuZ.js} +8 -4
- package/dist/serpapi.d.ts +25 -5
- package/dist/serpapi.js +99 -2
- package/dist/tavily.d.ts +44 -4
- package/dist/tavily.js +45 -13
- package/dist/tools.d.ts +16 -18
- package/dist/tools.js +150 -16
- package/package.json +9 -2
- package/dist/job-BGTwH3F-.js +0 -41
package/dist/firecrawl.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { B as ParsedDocument, C as DocumentInput, E as Extraction, F as MonitorEvents, I as MonitorInfo, K as Recency, L as MonitorSchedule, Q as SiteMap, R as Page, U as Product, Y as SearchResponse, _ as Crawl, a as RawClient, c as ActResult, d as BrowserSession, j as ImageSearch, p as CallOptions, q as Research, s as AccountUsage, t as Adapter, z as PageBatch } from "./adapter-
|
|
2
|
-
import { t as OutputSchema } from "./schema-
|
|
1
|
+
import { B as ParsedDocument, C as DocumentInput, E as Extraction, F as MonitorEvents, I as MonitorInfo, K as Recency, L as MonitorSchedule, Q as SiteMap, R as Page, U as Product, Y as SearchResponse, _ as Crawl, a as RawClient, c as ActResult, d as BrowserSession, j as ImageSearch, p as CallOptions, q as Research, s as AccountUsage, t as Adapter, z as PageBatch } from "./adapter-Bh8EIrNe.js";
|
|
2
|
+
import { t as OutputSchema } from "./schema-BWWiMvkg.js";
|
|
3
|
+
/** Settings for the Firecrawl adapter. */
|
|
3
4
|
interface FirecrawlConfig {
|
|
4
5
|
/** Defaults to the FIRECRAWL_API_KEY environment variable. */
|
|
5
6
|
apiKey?: string;
|
|
7
|
+
/** Defaults to https://api.firecrawl.dev/v2. */
|
|
6
8
|
baseUrl?: string;
|
|
9
|
+
/** Sends every request instead of the global `fetch`. */
|
|
7
10
|
fetch?: typeof fetch;
|
|
8
11
|
/** Repeats of a request that can succeed on repeat; 2 unless set. `0` turns retrying off. */
|
|
9
12
|
retries?: number;
|
|
@@ -54,6 +57,7 @@ type FirecrawlAction = {
|
|
|
54
57
|
type FirecrawlParser = "pdf" | "image" | FirecrawlPdfParser | {
|
|
55
58
|
type: "image";
|
|
56
59
|
};
|
|
60
|
+
/** Settings for Firecrawl's PDF parser. */
|
|
57
61
|
interface FirecrawlPdfParser {
|
|
58
62
|
type: "pdf";
|
|
59
63
|
/** "fast" reads embedded text only, "ocr" always runs OCR, "auto" falls back to OCR. */
|
|
@@ -71,7 +75,7 @@ interface FirecrawlPageSettings {
|
|
|
71
75
|
onlyMainContent?: boolean;
|
|
72
76
|
includeTags?: string[];
|
|
73
77
|
excludeTags?: string[];
|
|
74
|
-
/** Seconds a cached copy may be old; 0 always fetches fresh. */
|
|
78
|
+
/** Seconds a cached copy may be old; 0 always fetches fresh. Sent to Firecrawl in milliseconds. */
|
|
75
79
|
maxAge?: number;
|
|
76
80
|
/** Milliseconds to wait for the page before reading it. */
|
|
77
81
|
waitFor?: number;
|
|
@@ -92,6 +96,7 @@ interface FirecrawlPageSettings {
|
|
|
92
96
|
actions?: FirecrawlAction[];
|
|
93
97
|
parsers?: FirecrawlParser[];
|
|
94
98
|
}
|
|
99
|
+
/** A format `include` can ask for beside Markdown. */
|
|
95
100
|
type FirecrawlFormat = "html" | "rawHtml" | "links" | "images" | "screenshot" | "summary";
|
|
96
101
|
/** What to read from each page, beside its Markdown. */
|
|
97
102
|
interface FirecrawlReadSettings extends FirecrawlPageSettings {
|
|
@@ -106,9 +111,17 @@ interface FirecrawlReadSettings extends FirecrawlPageSettings {
|
|
|
106
111
|
*/
|
|
107
112
|
queryFormat?: "highlights" | "question";
|
|
108
113
|
}
|
|
114
|
+
/** Options for `product`, and the page settings `extract` takes. */
|
|
109
115
|
interface FirecrawlPageOptions extends CallOptions, FirecrawlPageSettings {}
|
|
116
|
+
/** Options for `read`. With `query`, the page has `excerpts`. */
|
|
110
117
|
interface FirecrawlReadOptions extends CallOptions, FirecrawlReadSettings {}
|
|
118
|
+
/**
|
|
119
|
+
* Options for `readMany`, which runs one Firecrawl batch scrape as an
|
|
120
|
+
* asynchronous job. URLs Firecrawl rejects at the start, and pages that
|
|
121
|
+
* failed or answered 404 or 410, are listed in `failed`.
|
|
122
|
+
*/
|
|
111
123
|
interface FirecrawlReadManyOptions extends FirecrawlReadOptions {
|
|
124
|
+
/** Most pages Firecrawl scrapes at the same time. */
|
|
112
125
|
maxConcurrency?: number;
|
|
113
126
|
/** Firecrawl defaults to true: invalid URLs go to `failed` instead of failing the job. */
|
|
114
127
|
ignoreInvalidURLs?: boolean;
|
|
@@ -121,9 +134,16 @@ interface FirecrawlReadManyOptions extends FirecrawlReadOptions {
|
|
|
121
134
|
*/
|
|
122
135
|
resume?: string;
|
|
123
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Options for `search`. `tbs` and `recency` cannot be combined with each other
|
|
139
|
+
* or with the published dates, and `includeDomains` cannot be combined with
|
|
140
|
+
* `excludeDomains`; the adapter throws `InvalidRequest` before sending when
|
|
141
|
+
* they are.
|
|
142
|
+
*/
|
|
124
143
|
interface FirecrawlSearchOptions extends CallOptions {
|
|
125
144
|
/** Results per source; Firecrawl allows up to 100. */
|
|
126
145
|
limit?: number;
|
|
146
|
+
/** Which result lists to ask for. `images` fills `images` on the response. */
|
|
127
147
|
sources?: ("web" | "news" | "images")[];
|
|
128
148
|
/** "gov" cannot be combined with another category. */
|
|
129
149
|
categories?: ("developer" | "gov" | "research" | "pdf")[];
|
|
@@ -140,7 +160,7 @@ interface FirecrawlSearchOptions extends CallOptions {
|
|
|
140
160
|
country?: string;
|
|
141
161
|
/** A place name such as "San Francisco,California,United States". */
|
|
142
162
|
location?: string;
|
|
143
|
-
/** Google time filter such as "sbd:1,qdr:w", for when the named options do not fit. */
|
|
163
|
+
/** Google time filter such as "sbd:1,qdr:w", for when the named options do not fit. Not with `recency`, `publishedAfter` or `publishedBefore`. */
|
|
144
164
|
tbs?: string;
|
|
145
165
|
/** Include each result's page text as Markdown. */
|
|
146
166
|
content?: boolean;
|
|
@@ -148,16 +168,22 @@ interface FirecrawlSearchOptions extends CallOptions {
|
|
|
148
168
|
safe?: boolean;
|
|
149
169
|
ignoreInvalidURLs?: boolean;
|
|
150
170
|
}
|
|
171
|
+
/** Options for `images`, which searches Firecrawl's image source only. */
|
|
151
172
|
interface FirecrawlImagesOptions extends CallOptions {
|
|
152
173
|
limit?: number;
|
|
153
174
|
country?: string;
|
|
154
175
|
location?: string;
|
|
155
176
|
safe?: boolean;
|
|
156
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Options for `extract`: a scrape that asks Firecrawl for JSON in the shape of
|
|
180
|
+
* `schema`, which is checked on return.
|
|
181
|
+
*/
|
|
157
182
|
interface FirecrawlExtractOptions<T = unknown> extends FirecrawlPageOptions {
|
|
158
183
|
schema: OutputSchema<T>;
|
|
159
184
|
prompt?: string;
|
|
160
185
|
}
|
|
186
|
+
/** Options for `map`. */
|
|
161
187
|
interface FirecrawlMapOptions extends CallOptions {
|
|
162
188
|
limit?: number;
|
|
163
189
|
/** Order links by relevance to this text. */
|
|
@@ -173,6 +199,11 @@ interface FirecrawlMapOptions extends CallOptions {
|
|
|
173
199
|
languages?: string[];
|
|
174
200
|
};
|
|
175
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Options for `crawl`, which runs a Firecrawl crawl as an asynchronous job and
|
|
204
|
+
* returns every page. Pages that failed are in `failed` and pages robots.txt
|
|
205
|
+
* blocked in `robotsBlocked`.
|
|
206
|
+
*/
|
|
176
207
|
interface FirecrawlCrawlOptions extends CallOptions {
|
|
177
208
|
limit?: number;
|
|
178
209
|
/** Plain-words crawl instructions; the options you set override it. */
|
|
@@ -202,7 +233,13 @@ interface FirecrawlCrawlOptions extends CallOptions {
|
|
|
202
233
|
*/
|
|
203
234
|
resume?: string;
|
|
204
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Options for `research`, which starts a Firecrawl agent run and waits for it
|
|
238
|
+
* as an asynchronous job. A run that fails but leaves partial output is
|
|
239
|
+
* returned with status `partial` and a `stopReason`.
|
|
240
|
+
*/
|
|
205
241
|
interface FirecrawlResearchOptions<T = unknown> extends CallOptions {
|
|
242
|
+
/** Output in the shape of this schema, checked on return. */
|
|
206
243
|
schema?: OutputSchema<T>;
|
|
207
244
|
/** Pages to start from. */
|
|
208
245
|
urls?: string[];
|
|
@@ -224,6 +261,7 @@ interface FirecrawlResearchOptions<T = unknown> extends CallOptions {
|
|
|
224
261
|
*/
|
|
225
262
|
resume?: string;
|
|
226
263
|
}
|
|
264
|
+
/** How a new browser session is set up. */
|
|
227
265
|
interface FirecrawlSessionSettings {
|
|
228
266
|
/** Seconds the browser session may live (30 to 3600). */
|
|
229
267
|
ttl?: number;
|
|
@@ -237,7 +275,13 @@ interface FirecrawlSessionSettings {
|
|
|
237
275
|
/** ISO 3166-1 alpha-2 country the browser connects from. */
|
|
238
276
|
country?: string;
|
|
239
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* Options for `act`, which runs a script in a browser session. The call's
|
|
280
|
+
* `timeout` also limits the script, to at most 300 seconds. Session settings
|
|
281
|
+
* (`ttl`, `activityTtl`, `profile`, `country`) are refused together with `session`.
|
|
282
|
+
*/
|
|
240
283
|
interface FirecrawlActOptions extends CallOptions, FirecrawlSessionSettings {
|
|
284
|
+
/** Defaults to "node". */
|
|
241
285
|
language?: "node" | "python" | "bash";
|
|
242
286
|
/**
|
|
243
287
|
* Run in this open session (from `browser.open` or an earlier `act` with
|
|
@@ -251,7 +295,13 @@ interface FirecrawlActOptions extends CallOptions, FirecrawlSessionSettings {
|
|
|
251
295
|
*/
|
|
252
296
|
keepSession?: boolean;
|
|
253
297
|
}
|
|
298
|
+
/** Options for `browser.open`. */
|
|
254
299
|
type FirecrawlBrowserOptions = CallOptions & FirecrawlSessionSettings;
|
|
300
|
+
/**
|
|
301
|
+
* Options for `parse`, which reads a local file to Markdown. The adapter sends
|
|
302
|
+
* these as Firecrawl's PDF parser settings, and refuses a file type it does
|
|
303
|
+
* not know, a file over 50 MB, and a `timeout` over 300 seconds.
|
|
304
|
+
*/
|
|
255
305
|
interface FirecrawlParseOptions extends CallOptions {
|
|
256
306
|
/** "fast" reads embedded text only, "ocr" always runs OCR, "auto" falls back to OCR. */
|
|
257
307
|
mode?: "auto" | "fast" | "ocr";
|
|
@@ -263,6 +313,11 @@ interface FirecrawlParseOptions extends CallOptions {
|
|
|
263
313
|
/** Mark page breaks in the Markdown. */
|
|
264
314
|
pageMarkers?: boolean;
|
|
265
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Options for `monitor.create`. A monitor either watches `urls` or runs a
|
|
318
|
+
* search for `query`; one of the two is required. `searchWindow`, `maxResults`
|
|
319
|
+
* and the domain lists apply to search monitors and are refused with `urls`.
|
|
320
|
+
*/
|
|
266
321
|
interface FirecrawlMonitorOptions extends CallOptions {
|
|
267
322
|
/** A name for the monitor; defaults to the query or first URL. */
|
|
268
323
|
name?: string;
|
|
@@ -289,6 +344,11 @@ interface FirecrawlMonitorOptions extends CallOptions {
|
|
|
289
344
|
/** Search monitors only. */
|
|
290
345
|
excludeDomains?: string[];
|
|
291
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* What Firecrawl can do: search, images, read, readMany, extract, product,
|
|
349
|
+
* map, crawl, research, act, browser, parse, monitor and usage. `readMany`,
|
|
350
|
+
* `crawl` and `research` are asynchronous jobs and accept `resume`.
|
|
351
|
+
*/
|
|
292
352
|
interface FirecrawlOperations {
|
|
293
353
|
search: (query: string, options?: FirecrawlSearchOptions) => Promise<SearchResponse>;
|
|
294
354
|
images: (query: string, options?: FirecrawlImagesOptions) => Promise<ImageSearch>;
|