firecrawl 4.35.0 → 4.37.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/{chunk-666CR5HH.js → chunk-LFX7WDGT.js} +1 -1
- package/dist/index.cjs +92 -15
- package/dist/index.d.cts +174 -2
- package/dist/index.d.ts +174 -2
- package/dist/index.js +93 -16
- package/dist/{package-ZOVFJE7Z.js → package-SHMK2LJE.js} +1 -1
- package/package.json +1 -1
- package/src/__tests__/unit/v2/agent-effort-trace.unit.test.ts +140 -0
- package/src/__tests__/unit/v2/scrapeAutoResume.test.ts +145 -0
- package/src/v1/index.ts +1 -0
- package/src/v2/client.ts +22 -4
- package/src/v2/methods/agent.ts +34 -1
- package/src/v2/methods/scrape.ts +123 -19
- package/src/v2/types.ts +165 -0
- package/src/v2/utils/httpClient.ts +6 -0
|
@@ -12,7 +12,7 @@ var require_package = __commonJS({
|
|
|
12
12
|
"package.json"(exports, module) {
|
|
13
13
|
module.exports = {
|
|
14
14
|
name: "@mendable/firecrawl-js",
|
|
15
|
-
version: "4.
|
|
15
|
+
version: "4.37.0",
|
|
16
16
|
description: "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
|
|
17
17
|
main: "dist/index.js",
|
|
18
18
|
types: "dist/index.d.ts",
|
package/dist/index.cjs
CHANGED
|
@@ -39,7 +39,7 @@ var require_package = __commonJS({
|
|
|
39
39
|
"package.json"(exports2, module2) {
|
|
40
40
|
module2.exports = {
|
|
41
41
|
name: "@mendable/firecrawl-js",
|
|
42
|
-
version: "4.
|
|
42
|
+
version: "4.37.0",
|
|
43
43
|
description: "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
|
|
44
44
|
main: "dist/index.js",
|
|
45
45
|
types: "dist/index.d.ts",
|
|
@@ -179,6 +179,11 @@ var HttpClient = class {
|
|
|
179
179
|
getApiKey() {
|
|
180
180
|
return this.apiKey;
|
|
181
181
|
}
|
|
182
|
+
/** The client-wide default request timeout, for callers that need to
|
|
183
|
+
* extend a specific request beyond it (e.g. scrape auto-resume). */
|
|
184
|
+
getTimeoutMs() {
|
|
185
|
+
return this.instance.defaults.timeout ?? 3e5;
|
|
186
|
+
}
|
|
182
187
|
async request(config) {
|
|
183
188
|
const version = getVersion();
|
|
184
189
|
config.headers = {
|
|
@@ -559,26 +564,60 @@ function isRetryableError(err) {
|
|
|
559
564
|
}
|
|
560
565
|
|
|
561
566
|
// src/v2/methods/scrape.ts
|
|
562
|
-
|
|
567
|
+
var RESUME_MAX_ATTEMPTS = 5;
|
|
568
|
+
var RESUME_MAX_TOTAL_WAIT_MS = 20 * 60 * 1e3;
|
|
569
|
+
var RESUME_MIN_DELAY_MS = 5 * 1e3;
|
|
570
|
+
var RESUME_MAX_DELAY_MS = 10 * 60 * 1e3;
|
|
571
|
+
function processingContinuesDelayMs(err) {
|
|
572
|
+
const response = err?.isAxiosError ? err.response : void 0;
|
|
573
|
+
if (!response || response.status !== 408) return void 0;
|
|
574
|
+
const body = response.data;
|
|
575
|
+
if (body?.code !== "SCRAPE_TIMEOUT" || body?.details?.state !== "processing_continues") {
|
|
576
|
+
return void 0;
|
|
577
|
+
}
|
|
578
|
+
const headerSeconds = Number(response.headers?.["retry-after"]);
|
|
579
|
+
const seconds = typeof body.details.retryAfterSeconds === "number" && Number.isFinite(body.details.retryAfterSeconds) ? body.details.retryAfterSeconds : Number.isFinite(headerSeconds) ? headerSeconds : 60;
|
|
580
|
+
return Math.min(RESUME_MAX_DELAY_MS, Math.max(RESUME_MIN_DELAY_MS, seconds * 1e3));
|
|
581
|
+
}
|
|
582
|
+
async function scrape(http, url, options, deps = {}) {
|
|
583
|
+
const sleep = deps.sleepImpl ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
563
584
|
if (!url || !url.trim()) {
|
|
564
585
|
throw new Error("URL cannot be empty");
|
|
565
586
|
}
|
|
566
587
|
if (options) ensureValidScrapeOptions(options);
|
|
588
|
+
const { autoResume, ...requestOptions } = options ?? {};
|
|
567
589
|
const payload = { url: url.trim() };
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
"
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
590
|
+
Object.assign(payload, requestOptions);
|
|
591
|
+
const requestTimeout = autoResume === false ? typeof options?.timeout === "number" ? { timeoutMs: options.timeout + 5e3 } : {} : {
|
|
592
|
+
timeoutMs: Math.max(
|
|
593
|
+
typeof options?.timeout === "number" ? options.timeout : 3e5,
|
|
594
|
+
typeof http.getTimeoutMs === "function" ? http.getTimeoutMs() : 0
|
|
595
|
+
) + 3e4
|
|
596
|
+
};
|
|
597
|
+
let resumes = 0;
|
|
598
|
+
let resumeWaitedMs = 0;
|
|
599
|
+
while (true) {
|
|
600
|
+
try {
|
|
601
|
+
const res = await http.post(
|
|
602
|
+
"/v2/scrape",
|
|
603
|
+
payload,
|
|
604
|
+
requestTimeout
|
|
605
|
+
);
|
|
606
|
+
if (res.status !== 200 || !res.data?.success) {
|
|
607
|
+
throwForBadResponse(res, "scrape");
|
|
608
|
+
}
|
|
609
|
+
return res.data.data || {};
|
|
610
|
+
} catch (err) {
|
|
611
|
+
const delayMs = autoResume !== false ? processingContinuesDelayMs(err) : void 0;
|
|
612
|
+
if (delayMs !== void 0 && resumes < RESUME_MAX_ATTEMPTS && resumeWaitedMs + delayMs <= RESUME_MAX_TOTAL_WAIT_MS) {
|
|
613
|
+
resumes += 1;
|
|
614
|
+
resumeWaitedMs += delayMs;
|
|
615
|
+
await sleep(delayMs);
|
|
616
|
+
continue;
|
|
617
|
+
}
|
|
618
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "scrape");
|
|
619
|
+
throw err;
|
|
577
620
|
}
|
|
578
|
-
return res.data.data || {};
|
|
579
|
-
} catch (err) {
|
|
580
|
-
if (err?.isAxiosError) return normalizeAxiosError(err, "scrape");
|
|
581
|
-
throw err;
|
|
582
621
|
}
|
|
583
622
|
}
|
|
584
623
|
async function interact(http, jobId, args) {
|
|
@@ -1326,6 +1365,7 @@ function prepareAgentPayload(args) {
|
|
|
1326
1365
|
if (args.maxCredits !== null && args.maxCredits !== void 0) body.maxCredits = args.maxCredits;
|
|
1327
1366
|
if (args.strictConstrainToURLs !== null && args.strictConstrainToURLs !== void 0) body.strictConstrainToURLs = args.strictConstrainToURLs;
|
|
1328
1367
|
if (args.model !== null && args.model !== void 0) body.model = args.model;
|
|
1368
|
+
if (args.effort !== null && args.effort !== void 0) body.effort = args.effort;
|
|
1329
1369
|
if (args.webhook != null) body.webhook = args.webhook;
|
|
1330
1370
|
if (args.threatProtection != null)
|
|
1331
1371
|
body.threatProtection = args.threatProtection;
|
|
@@ -1369,6 +1409,27 @@ async function agent(http, args) {
|
|
|
1369
1409
|
if (!jobId) return started;
|
|
1370
1410
|
return waitAgent(http, jobId, args.pollInterval ?? 2, args.timeout);
|
|
1371
1411
|
}
|
|
1412
|
+
async function getAgentTrace(http, jobId, options) {
|
|
1413
|
+
try {
|
|
1414
|
+
const query = options?.liveView ? "?liveView=true" : "";
|
|
1415
|
+
const res = await http.get(`/v2/agent/${jobId}/trace${query}`);
|
|
1416
|
+
if (res.status !== 200) throwForBadResponse(res, "agent trace");
|
|
1417
|
+
return res.data;
|
|
1418
|
+
} catch (err) {
|
|
1419
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "agent trace");
|
|
1420
|
+
throw err;
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
async function getAgentSnapshot(http, jobId, snapshotId) {
|
|
1424
|
+
try {
|
|
1425
|
+
const res = await http.get(`/v2/agent/${jobId}/snapshots/${snapshotId}`);
|
|
1426
|
+
if (res.status !== 200) throwForBadResponse(res, "agent snapshot");
|
|
1427
|
+
return res.data;
|
|
1428
|
+
} catch (err) {
|
|
1429
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "agent snapshot");
|
|
1430
|
+
throw err;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1372
1433
|
async function cancelAgent(http, jobId) {
|
|
1373
1434
|
try {
|
|
1374
1435
|
const res = await http.delete(`/v2/agent/${jobId}`);
|
|
@@ -2370,6 +2431,22 @@ var FirecrawlClient = class {
|
|
|
2370
2431
|
async cancelAgent(jobId) {
|
|
2371
2432
|
return cancelAgent(this.http, jobId);
|
|
2372
2433
|
}
|
|
2434
|
+
/**
|
|
2435
|
+
* Get the execution trace of an agent job (spark-2 runs only).
|
|
2436
|
+
* @param jobId Agent job id.
|
|
2437
|
+
* @param options.liveView Also include currently active browser sessions with live view URLs.
|
|
2438
|
+
*/
|
|
2439
|
+
async getAgentTrace(jobId, options) {
|
|
2440
|
+
return getAgentTrace(this.http, jobId, options);
|
|
2441
|
+
}
|
|
2442
|
+
/**
|
|
2443
|
+
* Get the full content of an artifact snapshot referenced by a trace event.
|
|
2444
|
+
* @param jobId Agent job id.
|
|
2445
|
+
* @param snapshotId Snapshot id from an artifact.updated trace event.
|
|
2446
|
+
*/
|
|
2447
|
+
async getAgentSnapshot(jobId, snapshotId) {
|
|
2448
|
+
return getAgentSnapshot(this.http, jobId, snapshotId);
|
|
2449
|
+
}
|
|
2373
2450
|
// Browser
|
|
2374
2451
|
/**
|
|
2375
2452
|
* Create a new browser session.
|
package/dist/index.d.cts
CHANGED
|
@@ -16,6 +16,7 @@ interface JsonFormat extends Format {
|
|
|
16
16
|
type: "json";
|
|
17
17
|
prompt?: string;
|
|
18
18
|
schema?: Record<string, unknown> | ZodTypeAny;
|
|
19
|
+
checkPromptInjection?: boolean;
|
|
19
20
|
}
|
|
20
21
|
interface ScreenshotFormat {
|
|
21
22
|
type: "screenshot";
|
|
@@ -1102,9 +1103,140 @@ interface AgentStatusResponse {
|
|
|
1102
1103
|
* names makes every future model a type error at the call site.
|
|
1103
1104
|
*/
|
|
1104
1105
|
model?: "spark-1-pro" | "spark-1-mini" | "spark-2" | (string & {});
|
|
1106
|
+
/**
|
|
1107
|
+
* Reasoning effort the job ran with. Only set for runs that specified it;
|
|
1108
|
+
* older rows and default runs have no effort.
|
|
1109
|
+
*/
|
|
1110
|
+
effort?: "low" | "medium" | "high";
|
|
1105
1111
|
expiresAt: string;
|
|
1106
1112
|
creditsUsed?: number;
|
|
1107
1113
|
}
|
|
1114
|
+
/** Reasoning effort for agent jobs. Every level runs spark-2. */
|
|
1115
|
+
type AgentEffort = "low" | "medium" | "high";
|
|
1116
|
+
type AgentTraceAgentRole = "orchestrator" | "subagent" | "browser" | "system";
|
|
1117
|
+
interface AgentTraceAgentIdentity {
|
|
1118
|
+
id: string;
|
|
1119
|
+
role: AgentTraceAgentRole;
|
|
1120
|
+
name: string;
|
|
1121
|
+
parentId?: string;
|
|
1122
|
+
}
|
|
1123
|
+
interface AgentTraceError {
|
|
1124
|
+
code: "cancelled" | "credit_limit_reached" | "parent_finished" | "refused" | "internal";
|
|
1125
|
+
source: "agent" | "tool" | "billing" | "system";
|
|
1126
|
+
retryable: boolean;
|
|
1127
|
+
message: string;
|
|
1128
|
+
}
|
|
1129
|
+
interface AgentTraceArtifactChange {
|
|
1130
|
+
kind: "json" | "markdown" | "html" | "screenshot" | "text";
|
|
1131
|
+
artifactId: string;
|
|
1132
|
+
path?: string;
|
|
1133
|
+
/** Fetch the full content via getAgentSnapshot(jobId, snapshotId). */
|
|
1134
|
+
snapshotId: string;
|
|
1135
|
+
change: "init" | "partial" | "append" | "modify" | "update";
|
|
1136
|
+
changedFields?: string[];
|
|
1137
|
+
itemCount?: number;
|
|
1138
|
+
sourceToolCallId?: string;
|
|
1139
|
+
}
|
|
1140
|
+
interface AgentTraceEventBase {
|
|
1141
|
+
schemaVersion: 1;
|
|
1142
|
+
eventId: string;
|
|
1143
|
+
runId: string;
|
|
1144
|
+
occurredAt: string;
|
|
1145
|
+
producerSequence: number;
|
|
1146
|
+
agent: AgentTraceAgentIdentity;
|
|
1147
|
+
}
|
|
1148
|
+
interface AgentTraceRunStartedEvent extends AgentTraceEventBase {
|
|
1149
|
+
type: "run.started";
|
|
1150
|
+
}
|
|
1151
|
+
interface AgentTraceRunCancelRequestedEvent extends AgentTraceEventBase {
|
|
1152
|
+
type: "run.cancel_requested";
|
|
1153
|
+
reason: "user";
|
|
1154
|
+
}
|
|
1155
|
+
interface AgentTraceRunFinishedEvent extends AgentTraceEventBase {
|
|
1156
|
+
type: "run.finished";
|
|
1157
|
+
outcome: "succeeded" | "failed" | "cancelled" | "refused" | "credit_limit_reached";
|
|
1158
|
+
/** The canonical schema always writes this key (nullable), but older rows may omit it. */
|
|
1159
|
+
error?: AgentTraceError | null;
|
|
1160
|
+
}
|
|
1161
|
+
interface AgentTraceAgentStartedEvent extends AgentTraceEventBase {
|
|
1162
|
+
type: "agent.started";
|
|
1163
|
+
}
|
|
1164
|
+
interface AgentTraceAgentFinishedEvent extends AgentTraceEventBase {
|
|
1165
|
+
type: "agent.finished";
|
|
1166
|
+
outcome: "succeeded" | "failed" | "cancelled" | "refused";
|
|
1167
|
+
durationMs: number;
|
|
1168
|
+
/** The canonical schema always writes this key (nullable), but older rows may omit it. */
|
|
1169
|
+
error?: AgentTraceError | null;
|
|
1170
|
+
}
|
|
1171
|
+
interface AgentTraceBrowserSessionStartedEvent extends AgentTraceEventBase {
|
|
1172
|
+
type: "browser.session.started";
|
|
1173
|
+
sessionId: string;
|
|
1174
|
+
}
|
|
1175
|
+
interface AgentTraceBrowserSessionFinishedEvent extends AgentTraceEventBase {
|
|
1176
|
+
type: "browser.session.finished";
|
|
1177
|
+
sessionId: string;
|
|
1178
|
+
durationMs: number;
|
|
1179
|
+
}
|
|
1180
|
+
interface AgentTraceProgressReportedEvent extends AgentTraceEventBase {
|
|
1181
|
+
type: "progress.reported";
|
|
1182
|
+
phase: "planning" | "working" | "finalizing";
|
|
1183
|
+
message: string;
|
|
1184
|
+
}
|
|
1185
|
+
interface AgentTraceReasoningSummaryEvent extends AgentTraceEventBase {
|
|
1186
|
+
type: "reasoning.summary";
|
|
1187
|
+
text: string;
|
|
1188
|
+
}
|
|
1189
|
+
interface AgentTraceToolCallStartedEvent extends AgentTraceEventBase {
|
|
1190
|
+
type: "tool_call.started";
|
|
1191
|
+
toolCallId: string;
|
|
1192
|
+
toolName: string;
|
|
1193
|
+
parameters: unknown;
|
|
1194
|
+
}
|
|
1195
|
+
interface AgentTraceToolCallFinishedEvent extends AgentTraceEventBase {
|
|
1196
|
+
type: "tool_call.finished";
|
|
1197
|
+
toolCallId: string;
|
|
1198
|
+
toolName: string;
|
|
1199
|
+
result: unknown;
|
|
1200
|
+
}
|
|
1201
|
+
interface AgentTraceArtifactUpdatedEvent extends AgentTraceEventBase {
|
|
1202
|
+
type: "artifact.updated";
|
|
1203
|
+
artifact: AgentTraceArtifactChange;
|
|
1204
|
+
}
|
|
1205
|
+
interface AgentTraceErrorOccurredEvent extends AgentTraceEventBase {
|
|
1206
|
+
type: "error.occurred";
|
|
1207
|
+
error: AgentTraceError;
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* One event in an agent job's trace. Mirrors the canonical event schema of
|
|
1211
|
+
* the agent service (schemaVersion 1); `usage.recorded` events are withheld
|
|
1212
|
+
* server-side and `agent.started` carries no model name.
|
|
1213
|
+
*/
|
|
1214
|
+
type AgentTraceEvent = AgentTraceRunStartedEvent | AgentTraceRunCancelRequestedEvent | AgentTraceRunFinishedEvent | AgentTraceAgentStartedEvent | AgentTraceAgentFinishedEvent | AgentTraceBrowserSessionStartedEvent | AgentTraceBrowserSessionFinishedEvent | AgentTraceProgressReportedEvent | AgentTraceReasoningSummaryEvent | AgentTraceToolCallStartedEvent | AgentTraceToolCallFinishedEvent | AgentTraceArtifactUpdatedEvent | AgentTraceErrorOccurredEvent;
|
|
1215
|
+
interface AgentTraceActiveBrowserSession {
|
|
1216
|
+
id: string;
|
|
1217
|
+
liveViewUrl: string;
|
|
1218
|
+
viewport: {
|
|
1219
|
+
width: number;
|
|
1220
|
+
height: number;
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
interface AgentTraceResponse {
|
|
1224
|
+
success: boolean;
|
|
1225
|
+
id?: string;
|
|
1226
|
+
events?: AgentTraceEvent[];
|
|
1227
|
+
creditsUsed?: number;
|
|
1228
|
+
/** Present only when the trace was requested with liveView: true. */
|
|
1229
|
+
activeBrowserSessions?: AgentTraceActiveBrowserSession[];
|
|
1230
|
+
error?: string;
|
|
1231
|
+
}
|
|
1232
|
+
interface AgentSnapshotResponse {
|
|
1233
|
+
success: boolean;
|
|
1234
|
+
id?: string;
|
|
1235
|
+
snapshotId?: string;
|
|
1236
|
+
/** Full artifact content as a JSON/string blob. */
|
|
1237
|
+
snapshot?: string;
|
|
1238
|
+
error?: string;
|
|
1239
|
+
}
|
|
1108
1240
|
interface AgentOptions$1 {
|
|
1109
1241
|
model: "FIRE-1" | "v3-beta";
|
|
1110
1242
|
}
|
|
@@ -1424,6 +1556,9 @@ declare class HttpClient {
|
|
|
1424
1556
|
constructor(options: HttpClientOptions);
|
|
1425
1557
|
getApiUrl(): string;
|
|
1426
1558
|
getApiKey(): string;
|
|
1559
|
+
/** The client-wide default request timeout, for callers that need to
|
|
1560
|
+
* extend a specific request beyond it (e.g. scrape auto-resume). */
|
|
1561
|
+
getTimeoutMs(): number;
|
|
1427
1562
|
private request;
|
|
1428
1563
|
private sleep;
|
|
1429
1564
|
post<T = any>(endpoint: string, body: Record<string, unknown>, options?: RequestOptions): Promise<AxiosResponse<T, any, {}>>;
|
|
@@ -1434,6 +1569,27 @@ declare class HttpClient {
|
|
|
1434
1569
|
prepareHeaders(idempotencyKey?: string): Record<string, string>;
|
|
1435
1570
|
}
|
|
1436
1571
|
|
|
1572
|
+
/**
|
|
1573
|
+
* Options for a direct scrape call. `autoResume` lives here — NOT on the
|
|
1574
|
+
* shared ScrapeOptions — because that type is reused verbatim inside
|
|
1575
|
+
* batch/crawl/search/extract payloads, where an SDK-only key would leak
|
|
1576
|
+
* onto the wire and fail strict endpoints.
|
|
1577
|
+
*/
|
|
1578
|
+
type ScrapeCallOptions = ScrapeOptions & {
|
|
1579
|
+
/**
|
|
1580
|
+
* SDK-only (never sent to the API). Large documents (big PDFs) that
|
|
1581
|
+
* outlive the request window keep processing server-side; the API's
|
|
1582
|
+
* timeout error then carries `details.state === "processing_continues"`
|
|
1583
|
+
* and a Retry-After. When this is not `false`, the SDK sleeps that
|
|
1584
|
+
* long and re-issues the same request — the retry attaches to the
|
|
1585
|
+
* in-flight job and returns the finished result, so a large document
|
|
1586
|
+
* behaves like one slow successful call. Bounded (at most 5 resumes /
|
|
1587
|
+
* 20 minutes total wait); set `false` to surface the timeout error
|
|
1588
|
+
* immediately instead.
|
|
1589
|
+
*/
|
|
1590
|
+
autoResume?: boolean;
|
|
1591
|
+
};
|
|
1592
|
+
|
|
1437
1593
|
declare function prepareExtractPayload(args: {
|
|
1438
1594
|
urls?: string[];
|
|
1439
1595
|
prompt?: string;
|
|
@@ -1465,6 +1621,7 @@ declare function prepareAgentPayload(args: {
|
|
|
1465
1621
|
maxCredits?: number;
|
|
1466
1622
|
strictConstrainToURLs?: boolean;
|
|
1467
1623
|
model?: "spark-1-pro" | "spark-1-mini" | "spark-2";
|
|
1624
|
+
effort?: AgentEffort;
|
|
1468
1625
|
webhook?: string | AgentWebhookConfig;
|
|
1469
1626
|
threatProtection?: ThreatProtectionOptions;
|
|
1470
1627
|
auditMetadata?: AuditMetadata$1;
|
|
@@ -1636,7 +1793,7 @@ declare class FirecrawlClient {
|
|
|
1636
1793
|
scrape<Opts extends ScrapeOptions>(url: string, options: Opts): Promise<Omit<Document, "json"> & {
|
|
1637
1794
|
json?: InferredJsonFromOptions<Opts>;
|
|
1638
1795
|
}>;
|
|
1639
|
-
scrape(url: string, options?:
|
|
1796
|
+
scrape(url: string, options?: ScrapeCallOptions): Promise<Document>;
|
|
1640
1797
|
/**
|
|
1641
1798
|
* Interact with the browser session associated with a scrape job.
|
|
1642
1799
|
* @param jobId Scrape job id.
|
|
@@ -1884,6 +2041,20 @@ declare class FirecrawlClient {
|
|
|
1884
2041
|
* @returns True if cancelled.
|
|
1885
2042
|
*/
|
|
1886
2043
|
cancelAgent(jobId: string): Promise<boolean>;
|
|
2044
|
+
/**
|
|
2045
|
+
* Get the execution trace of an agent job (spark-2 runs only).
|
|
2046
|
+
* @param jobId Agent job id.
|
|
2047
|
+
* @param options.liveView Also include currently active browser sessions with live view URLs.
|
|
2048
|
+
*/
|
|
2049
|
+
getAgentTrace(jobId: string, options?: {
|
|
2050
|
+
liveView?: boolean;
|
|
2051
|
+
}): Promise<AgentTraceResponse>;
|
|
2052
|
+
/**
|
|
2053
|
+
* Get the full content of an artifact snapshot referenced by a trace event.
|
|
2054
|
+
* @param jobId Agent job id.
|
|
2055
|
+
* @param snapshotId Snapshot id from an artifact.updated trace event.
|
|
2056
|
+
*/
|
|
2057
|
+
getAgentSnapshot(jobId: string, snapshotId: string): Promise<AgentSnapshotResponse>;
|
|
1887
2058
|
/**
|
|
1888
2059
|
* Create a new browser session.
|
|
1889
2060
|
* @param args Session options (ttl, activityTtl, streamWebView, profile).
|
|
@@ -2124,6 +2295,7 @@ interface ScrapeParams<LLMSchema extends zt.ZodSchema = any, ActionsSchema exten
|
|
|
2124
2295
|
prompt?: string;
|
|
2125
2296
|
schema?: LLMSchema;
|
|
2126
2297
|
systemPrompt?: string;
|
|
2298
|
+
checkPromptInjection?: boolean;
|
|
2127
2299
|
};
|
|
2128
2300
|
changeTrackingOptions?: {
|
|
2129
2301
|
prompt?: string;
|
|
@@ -2885,4 +3057,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
2885
3057
|
get v1(): FirecrawlApp;
|
|
2886
3058
|
}
|
|
2887
3059
|
|
|
2888
|
-
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type DeveloperSearchLicenseDisclosure, type DeveloperSearchOptions, type DeveloperSearchPassage, type DeveloperSearchRepoStatus, type DeveloperSearchResponse, type DeveloperSearchResult, type DeveloperSearchSourceStatus, type DeveloperSearchType, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type MenuAvailability, type MenuImage, type MenuItem, type MenuItemIdentifiers, type MenuMerchant, type MenuPrice, type MenuProfile, type MenuSection, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorCrawlTargetResult, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorScrapeTargetResult, type MonitorSearchTarget, type MonitorSearchTargetResult, type MonitorSummary, type MonitorTarget, type MonitorTargetResult, type MonitorWebhookConfig, type PDFAction, type PDFParser, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, type PressAction, type ProductAvailability, type ProductImage, type ProductPrice, type ProductProfile, type ProductSale, type ProductVariant, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|
|
3060
|
+
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentEffort, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentSnapshotResponse, type AgentStatusResponse, type AgentTraceActiveBrowserSession, type AgentTraceAgentFinishedEvent, type AgentTraceAgentIdentity, type AgentTraceAgentRole, type AgentTraceAgentStartedEvent, type AgentTraceArtifactChange, type AgentTraceArtifactUpdatedEvent, type AgentTraceBrowserSessionFinishedEvent, type AgentTraceBrowserSessionStartedEvent, type AgentTraceError, type AgentTraceErrorOccurredEvent, type AgentTraceEvent, type AgentTraceProgressReportedEvent, type AgentTraceReasoningSummaryEvent, type AgentTraceResponse, type AgentTraceRunCancelRequestedEvent, type AgentTraceRunFinishedEvent, type AgentTraceRunStartedEvent, type AgentTraceToolCallFinishedEvent, type AgentTraceToolCallStartedEvent, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type DeveloperSearchLicenseDisclosure, type DeveloperSearchOptions, type DeveloperSearchPassage, type DeveloperSearchRepoStatus, type DeveloperSearchResponse, type DeveloperSearchResult, type DeveloperSearchSourceStatus, type DeveloperSearchType, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type MenuAvailability, type MenuImage, type MenuItem, type MenuItemIdentifiers, type MenuMerchant, type MenuPrice, type MenuProfile, type MenuSection, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorCrawlTargetResult, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorScrapeTargetResult, type MonitorSearchTarget, type MonitorSearchTargetResult, type MonitorSummary, type MonitorTarget, type MonitorTargetResult, type MonitorWebhookConfig, type PDFAction, type PDFParser, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, type PressAction, type ProductAvailability, type ProductImage, type ProductPrice, type ProductProfile, type ProductSale, type ProductVariant, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ interface JsonFormat extends Format {
|
|
|
16
16
|
type: "json";
|
|
17
17
|
prompt?: string;
|
|
18
18
|
schema?: Record<string, unknown> | ZodTypeAny;
|
|
19
|
+
checkPromptInjection?: boolean;
|
|
19
20
|
}
|
|
20
21
|
interface ScreenshotFormat {
|
|
21
22
|
type: "screenshot";
|
|
@@ -1102,9 +1103,140 @@ interface AgentStatusResponse {
|
|
|
1102
1103
|
* names makes every future model a type error at the call site.
|
|
1103
1104
|
*/
|
|
1104
1105
|
model?: "spark-1-pro" | "spark-1-mini" | "spark-2" | (string & {});
|
|
1106
|
+
/**
|
|
1107
|
+
* Reasoning effort the job ran with. Only set for runs that specified it;
|
|
1108
|
+
* older rows and default runs have no effort.
|
|
1109
|
+
*/
|
|
1110
|
+
effort?: "low" | "medium" | "high";
|
|
1105
1111
|
expiresAt: string;
|
|
1106
1112
|
creditsUsed?: number;
|
|
1107
1113
|
}
|
|
1114
|
+
/** Reasoning effort for agent jobs. Every level runs spark-2. */
|
|
1115
|
+
type AgentEffort = "low" | "medium" | "high";
|
|
1116
|
+
type AgentTraceAgentRole = "orchestrator" | "subagent" | "browser" | "system";
|
|
1117
|
+
interface AgentTraceAgentIdentity {
|
|
1118
|
+
id: string;
|
|
1119
|
+
role: AgentTraceAgentRole;
|
|
1120
|
+
name: string;
|
|
1121
|
+
parentId?: string;
|
|
1122
|
+
}
|
|
1123
|
+
interface AgentTraceError {
|
|
1124
|
+
code: "cancelled" | "credit_limit_reached" | "parent_finished" | "refused" | "internal";
|
|
1125
|
+
source: "agent" | "tool" | "billing" | "system";
|
|
1126
|
+
retryable: boolean;
|
|
1127
|
+
message: string;
|
|
1128
|
+
}
|
|
1129
|
+
interface AgentTraceArtifactChange {
|
|
1130
|
+
kind: "json" | "markdown" | "html" | "screenshot" | "text";
|
|
1131
|
+
artifactId: string;
|
|
1132
|
+
path?: string;
|
|
1133
|
+
/** Fetch the full content via getAgentSnapshot(jobId, snapshotId). */
|
|
1134
|
+
snapshotId: string;
|
|
1135
|
+
change: "init" | "partial" | "append" | "modify" | "update";
|
|
1136
|
+
changedFields?: string[];
|
|
1137
|
+
itemCount?: number;
|
|
1138
|
+
sourceToolCallId?: string;
|
|
1139
|
+
}
|
|
1140
|
+
interface AgentTraceEventBase {
|
|
1141
|
+
schemaVersion: 1;
|
|
1142
|
+
eventId: string;
|
|
1143
|
+
runId: string;
|
|
1144
|
+
occurredAt: string;
|
|
1145
|
+
producerSequence: number;
|
|
1146
|
+
agent: AgentTraceAgentIdentity;
|
|
1147
|
+
}
|
|
1148
|
+
interface AgentTraceRunStartedEvent extends AgentTraceEventBase {
|
|
1149
|
+
type: "run.started";
|
|
1150
|
+
}
|
|
1151
|
+
interface AgentTraceRunCancelRequestedEvent extends AgentTraceEventBase {
|
|
1152
|
+
type: "run.cancel_requested";
|
|
1153
|
+
reason: "user";
|
|
1154
|
+
}
|
|
1155
|
+
interface AgentTraceRunFinishedEvent extends AgentTraceEventBase {
|
|
1156
|
+
type: "run.finished";
|
|
1157
|
+
outcome: "succeeded" | "failed" | "cancelled" | "refused" | "credit_limit_reached";
|
|
1158
|
+
/** The canonical schema always writes this key (nullable), but older rows may omit it. */
|
|
1159
|
+
error?: AgentTraceError | null;
|
|
1160
|
+
}
|
|
1161
|
+
interface AgentTraceAgentStartedEvent extends AgentTraceEventBase {
|
|
1162
|
+
type: "agent.started";
|
|
1163
|
+
}
|
|
1164
|
+
interface AgentTraceAgentFinishedEvent extends AgentTraceEventBase {
|
|
1165
|
+
type: "agent.finished";
|
|
1166
|
+
outcome: "succeeded" | "failed" | "cancelled" | "refused";
|
|
1167
|
+
durationMs: number;
|
|
1168
|
+
/** The canonical schema always writes this key (nullable), but older rows may omit it. */
|
|
1169
|
+
error?: AgentTraceError | null;
|
|
1170
|
+
}
|
|
1171
|
+
interface AgentTraceBrowserSessionStartedEvent extends AgentTraceEventBase {
|
|
1172
|
+
type: "browser.session.started";
|
|
1173
|
+
sessionId: string;
|
|
1174
|
+
}
|
|
1175
|
+
interface AgentTraceBrowserSessionFinishedEvent extends AgentTraceEventBase {
|
|
1176
|
+
type: "browser.session.finished";
|
|
1177
|
+
sessionId: string;
|
|
1178
|
+
durationMs: number;
|
|
1179
|
+
}
|
|
1180
|
+
interface AgentTraceProgressReportedEvent extends AgentTraceEventBase {
|
|
1181
|
+
type: "progress.reported";
|
|
1182
|
+
phase: "planning" | "working" | "finalizing";
|
|
1183
|
+
message: string;
|
|
1184
|
+
}
|
|
1185
|
+
interface AgentTraceReasoningSummaryEvent extends AgentTraceEventBase {
|
|
1186
|
+
type: "reasoning.summary";
|
|
1187
|
+
text: string;
|
|
1188
|
+
}
|
|
1189
|
+
interface AgentTraceToolCallStartedEvent extends AgentTraceEventBase {
|
|
1190
|
+
type: "tool_call.started";
|
|
1191
|
+
toolCallId: string;
|
|
1192
|
+
toolName: string;
|
|
1193
|
+
parameters: unknown;
|
|
1194
|
+
}
|
|
1195
|
+
interface AgentTraceToolCallFinishedEvent extends AgentTraceEventBase {
|
|
1196
|
+
type: "tool_call.finished";
|
|
1197
|
+
toolCallId: string;
|
|
1198
|
+
toolName: string;
|
|
1199
|
+
result: unknown;
|
|
1200
|
+
}
|
|
1201
|
+
interface AgentTraceArtifactUpdatedEvent extends AgentTraceEventBase {
|
|
1202
|
+
type: "artifact.updated";
|
|
1203
|
+
artifact: AgentTraceArtifactChange;
|
|
1204
|
+
}
|
|
1205
|
+
interface AgentTraceErrorOccurredEvent extends AgentTraceEventBase {
|
|
1206
|
+
type: "error.occurred";
|
|
1207
|
+
error: AgentTraceError;
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* One event in an agent job's trace. Mirrors the canonical event schema of
|
|
1211
|
+
* the agent service (schemaVersion 1); `usage.recorded` events are withheld
|
|
1212
|
+
* server-side and `agent.started` carries no model name.
|
|
1213
|
+
*/
|
|
1214
|
+
type AgentTraceEvent = AgentTraceRunStartedEvent | AgentTraceRunCancelRequestedEvent | AgentTraceRunFinishedEvent | AgentTraceAgentStartedEvent | AgentTraceAgentFinishedEvent | AgentTraceBrowserSessionStartedEvent | AgentTraceBrowserSessionFinishedEvent | AgentTraceProgressReportedEvent | AgentTraceReasoningSummaryEvent | AgentTraceToolCallStartedEvent | AgentTraceToolCallFinishedEvent | AgentTraceArtifactUpdatedEvent | AgentTraceErrorOccurredEvent;
|
|
1215
|
+
interface AgentTraceActiveBrowserSession {
|
|
1216
|
+
id: string;
|
|
1217
|
+
liveViewUrl: string;
|
|
1218
|
+
viewport: {
|
|
1219
|
+
width: number;
|
|
1220
|
+
height: number;
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
interface AgentTraceResponse {
|
|
1224
|
+
success: boolean;
|
|
1225
|
+
id?: string;
|
|
1226
|
+
events?: AgentTraceEvent[];
|
|
1227
|
+
creditsUsed?: number;
|
|
1228
|
+
/** Present only when the trace was requested with liveView: true. */
|
|
1229
|
+
activeBrowserSessions?: AgentTraceActiveBrowserSession[];
|
|
1230
|
+
error?: string;
|
|
1231
|
+
}
|
|
1232
|
+
interface AgentSnapshotResponse {
|
|
1233
|
+
success: boolean;
|
|
1234
|
+
id?: string;
|
|
1235
|
+
snapshotId?: string;
|
|
1236
|
+
/** Full artifact content as a JSON/string blob. */
|
|
1237
|
+
snapshot?: string;
|
|
1238
|
+
error?: string;
|
|
1239
|
+
}
|
|
1108
1240
|
interface AgentOptions$1 {
|
|
1109
1241
|
model: "FIRE-1" | "v3-beta";
|
|
1110
1242
|
}
|
|
@@ -1424,6 +1556,9 @@ declare class HttpClient {
|
|
|
1424
1556
|
constructor(options: HttpClientOptions);
|
|
1425
1557
|
getApiUrl(): string;
|
|
1426
1558
|
getApiKey(): string;
|
|
1559
|
+
/** The client-wide default request timeout, for callers that need to
|
|
1560
|
+
* extend a specific request beyond it (e.g. scrape auto-resume). */
|
|
1561
|
+
getTimeoutMs(): number;
|
|
1427
1562
|
private request;
|
|
1428
1563
|
private sleep;
|
|
1429
1564
|
post<T = any>(endpoint: string, body: Record<string, unknown>, options?: RequestOptions): Promise<AxiosResponse<T, any, {}>>;
|
|
@@ -1434,6 +1569,27 @@ declare class HttpClient {
|
|
|
1434
1569
|
prepareHeaders(idempotencyKey?: string): Record<string, string>;
|
|
1435
1570
|
}
|
|
1436
1571
|
|
|
1572
|
+
/**
|
|
1573
|
+
* Options for a direct scrape call. `autoResume` lives here — NOT on the
|
|
1574
|
+
* shared ScrapeOptions — because that type is reused verbatim inside
|
|
1575
|
+
* batch/crawl/search/extract payloads, where an SDK-only key would leak
|
|
1576
|
+
* onto the wire and fail strict endpoints.
|
|
1577
|
+
*/
|
|
1578
|
+
type ScrapeCallOptions = ScrapeOptions & {
|
|
1579
|
+
/**
|
|
1580
|
+
* SDK-only (never sent to the API). Large documents (big PDFs) that
|
|
1581
|
+
* outlive the request window keep processing server-side; the API's
|
|
1582
|
+
* timeout error then carries `details.state === "processing_continues"`
|
|
1583
|
+
* and a Retry-After. When this is not `false`, the SDK sleeps that
|
|
1584
|
+
* long and re-issues the same request — the retry attaches to the
|
|
1585
|
+
* in-flight job and returns the finished result, so a large document
|
|
1586
|
+
* behaves like one slow successful call. Bounded (at most 5 resumes /
|
|
1587
|
+
* 20 minutes total wait); set `false` to surface the timeout error
|
|
1588
|
+
* immediately instead.
|
|
1589
|
+
*/
|
|
1590
|
+
autoResume?: boolean;
|
|
1591
|
+
};
|
|
1592
|
+
|
|
1437
1593
|
declare function prepareExtractPayload(args: {
|
|
1438
1594
|
urls?: string[];
|
|
1439
1595
|
prompt?: string;
|
|
@@ -1465,6 +1621,7 @@ declare function prepareAgentPayload(args: {
|
|
|
1465
1621
|
maxCredits?: number;
|
|
1466
1622
|
strictConstrainToURLs?: boolean;
|
|
1467
1623
|
model?: "spark-1-pro" | "spark-1-mini" | "spark-2";
|
|
1624
|
+
effort?: AgentEffort;
|
|
1468
1625
|
webhook?: string | AgentWebhookConfig;
|
|
1469
1626
|
threatProtection?: ThreatProtectionOptions;
|
|
1470
1627
|
auditMetadata?: AuditMetadata$1;
|
|
@@ -1636,7 +1793,7 @@ declare class FirecrawlClient {
|
|
|
1636
1793
|
scrape<Opts extends ScrapeOptions>(url: string, options: Opts): Promise<Omit<Document, "json"> & {
|
|
1637
1794
|
json?: InferredJsonFromOptions<Opts>;
|
|
1638
1795
|
}>;
|
|
1639
|
-
scrape(url: string, options?:
|
|
1796
|
+
scrape(url: string, options?: ScrapeCallOptions): Promise<Document>;
|
|
1640
1797
|
/**
|
|
1641
1798
|
* Interact with the browser session associated with a scrape job.
|
|
1642
1799
|
* @param jobId Scrape job id.
|
|
@@ -1884,6 +2041,20 @@ declare class FirecrawlClient {
|
|
|
1884
2041
|
* @returns True if cancelled.
|
|
1885
2042
|
*/
|
|
1886
2043
|
cancelAgent(jobId: string): Promise<boolean>;
|
|
2044
|
+
/**
|
|
2045
|
+
* Get the execution trace of an agent job (spark-2 runs only).
|
|
2046
|
+
* @param jobId Agent job id.
|
|
2047
|
+
* @param options.liveView Also include currently active browser sessions with live view URLs.
|
|
2048
|
+
*/
|
|
2049
|
+
getAgentTrace(jobId: string, options?: {
|
|
2050
|
+
liveView?: boolean;
|
|
2051
|
+
}): Promise<AgentTraceResponse>;
|
|
2052
|
+
/**
|
|
2053
|
+
* Get the full content of an artifact snapshot referenced by a trace event.
|
|
2054
|
+
* @param jobId Agent job id.
|
|
2055
|
+
* @param snapshotId Snapshot id from an artifact.updated trace event.
|
|
2056
|
+
*/
|
|
2057
|
+
getAgentSnapshot(jobId: string, snapshotId: string): Promise<AgentSnapshotResponse>;
|
|
1887
2058
|
/**
|
|
1888
2059
|
* Create a new browser session.
|
|
1889
2060
|
* @param args Session options (ttl, activityTtl, streamWebView, profile).
|
|
@@ -2124,6 +2295,7 @@ interface ScrapeParams<LLMSchema extends zt.ZodSchema = any, ActionsSchema exten
|
|
|
2124
2295
|
prompt?: string;
|
|
2125
2296
|
schema?: LLMSchema;
|
|
2126
2297
|
systemPrompt?: string;
|
|
2298
|
+
checkPromptInjection?: boolean;
|
|
2127
2299
|
};
|
|
2128
2300
|
changeTrackingOptions?: {
|
|
2129
2301
|
prompt?: string;
|
|
@@ -2885,4 +3057,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
2885
3057
|
get v1(): FirecrawlApp;
|
|
2886
3058
|
}
|
|
2887
3059
|
|
|
2888
|
-
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type DeveloperSearchLicenseDisclosure, type DeveloperSearchOptions, type DeveloperSearchPassage, type DeveloperSearchRepoStatus, type DeveloperSearchResponse, type DeveloperSearchResult, type DeveloperSearchSourceStatus, type DeveloperSearchType, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type MenuAvailability, type MenuImage, type MenuItem, type MenuItemIdentifiers, type MenuMerchant, type MenuPrice, type MenuProfile, type MenuSection, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorCrawlTargetResult, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorScrapeTargetResult, type MonitorSearchTarget, type MonitorSearchTargetResult, type MonitorSummary, type MonitorTarget, type MonitorTargetResult, type MonitorWebhookConfig, type PDFAction, type PDFParser, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, type PressAction, type ProductAvailability, type ProductImage, type ProductPrice, type ProductProfile, type ProductSale, type ProductVariant, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|
|
3060
|
+
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentEffort, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentSnapshotResponse, type AgentStatusResponse, type AgentTraceActiveBrowserSession, type AgentTraceAgentFinishedEvent, type AgentTraceAgentIdentity, type AgentTraceAgentRole, type AgentTraceAgentStartedEvent, type AgentTraceArtifactChange, type AgentTraceArtifactUpdatedEvent, type AgentTraceBrowserSessionFinishedEvent, type AgentTraceBrowserSessionStartedEvent, type AgentTraceError, type AgentTraceErrorOccurredEvent, type AgentTraceEvent, type AgentTraceProgressReportedEvent, type AgentTraceReasoningSummaryEvent, type AgentTraceResponse, type AgentTraceRunCancelRequestedEvent, type AgentTraceRunFinishedEvent, type AgentTraceRunStartedEvent, type AgentTraceToolCallFinishedEvent, type AgentTraceToolCallStartedEvent, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type DeveloperSearchLicenseDisclosure, type DeveloperSearchOptions, type DeveloperSearchPassage, type DeveloperSearchRepoStatus, type DeveloperSearchResponse, type DeveloperSearchResult, type DeveloperSearchSourceStatus, type DeveloperSearchType, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type MenuAvailability, type MenuImage, type MenuItem, type MenuItemIdentifiers, type MenuMerchant, type MenuPrice, type MenuProfile, type MenuSection, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorCrawlTargetResult, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorScrapeTargetResult, type MonitorSearchTarget, type MonitorSearchTargetResult, type MonitorSummary, type MonitorTarget, type MonitorTargetResult, type MonitorWebhookConfig, type PDFAction, type PDFParser, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, type PressAction, type ProductAvailability, type ProductImage, type ProductPrice, type ProductProfile, type ProductSale, type ProductVariant, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|