@mendable/firecrawl-js 4.50.0 → 4.50.1
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-NXSNF7F3.js → chunk-UGAMW2BL.js} +2 -2
- package/dist/index.cjs +4 -2
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +4 -2
- package/dist/{package-KFOQKI5Z.js → package-TFTOUFDX.js} +1 -1
- package/package.json +3 -3
- package/pnpm-workspace.yaml +3 -1
- package/src/__tests__/unit/v2/agent-location.unit.test.ts +34 -0
- package/src/v2/methods/agent.ts +8 -0
- package/src/v2/types.ts +52 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var name = "@mendable/firecrawl-js";
|
|
3
|
-
var version = "4.50.
|
|
3
|
+
var version = "4.50.1";
|
|
4
4
|
var description = "JavaScript SDK for Firecrawl, the context API for AI agents: search, scrape, parse, crawl, map, and interact with the web, run Agent and Monitor jobs, and search scientific papers (PubMed, bioRxiv, medRxiv, arXiv)";
|
|
5
5
|
var main = "dist/index.js";
|
|
6
6
|
var types = "dist/index.d.ts";
|
|
@@ -44,7 +44,7 @@ var devDependencies = {
|
|
|
44
44
|
tsup: "^8.5.0",
|
|
45
45
|
typescript: "^5.4.5",
|
|
46
46
|
uuid: "^14.0.0",
|
|
47
|
-
vitest: "^4.1.
|
|
47
|
+
vitest: "^4.1.12"
|
|
48
48
|
};
|
|
49
49
|
var keywords = [
|
|
50
50
|
"firecrawl",
|
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.50.
|
|
42
|
+
version: "4.50.1",
|
|
43
43
|
description: "JavaScript SDK for Firecrawl, the context API for AI agents: search, scrape, parse, crawl, map, and interact with the web, run Agent and Monitor jobs, and search scientific papers (PubMed, bioRxiv, medRxiv, arXiv)",
|
|
44
44
|
main: "dist/index.js",
|
|
45
45
|
types: "dist/index.d.ts",
|
|
@@ -83,7 +83,7 @@ var require_package = __commonJS({
|
|
|
83
83
|
tsup: "^8.5.0",
|
|
84
84
|
typescript: "^5.4.5",
|
|
85
85
|
uuid: "^14.0.0",
|
|
86
|
-
vitest: "^4.1.
|
|
86
|
+
vitest: "^4.1.12"
|
|
87
87
|
},
|
|
88
88
|
keywords: [
|
|
89
89
|
"firecrawl",
|
|
@@ -1674,6 +1674,8 @@ function prepareAgentPayload(args) {
|
|
|
1674
1674
|
if (args.threadId != null) body.threadId = args.threadId;
|
|
1675
1675
|
if (args.mode != null) body.mode = args.mode;
|
|
1676
1676
|
if (args.exchange != null) body.exchange = args.exchange;
|
|
1677
|
+
if (args.location != null) body.location = args.location;
|
|
1678
|
+
if (args.zeroDataRetention != null) body.zeroDataRetention = args.zeroDataRetention;
|
|
1677
1679
|
return body;
|
|
1678
1680
|
}
|
|
1679
1681
|
async function startAgent(http, args) {
|
package/dist/index.d.cts
CHANGED
|
@@ -1552,7 +1552,7 @@ interface AgentTraceAgentIdentity {
|
|
|
1552
1552
|
parentId?: string;
|
|
1553
1553
|
}
|
|
1554
1554
|
interface AgentTraceError {
|
|
1555
|
-
code: "cancelled" | "credit_limit_reached" | "parent_finished" | "refused" | "internal";
|
|
1555
|
+
code: "cancelled" | "credit_limit_reached" | "insufficient_credits" | "parent_finished" | "refused" | "internal";
|
|
1556
1556
|
source: "agent" | "tool" | "billing" | "system";
|
|
1557
1557
|
retryable: boolean;
|
|
1558
1558
|
message: string;
|
|
@@ -1658,6 +1658,8 @@ interface AgentTraceResponse {
|
|
|
1658
1658
|
creditsUsed?: number;
|
|
1659
1659
|
/** Present only when the trace was requested with liveView: true. */
|
|
1660
1660
|
activeBrowserSessions?: AgentTraceActiveBrowserSession[];
|
|
1661
|
+
/** True for a zero data retention run: events are limited to content-free lifecycle events. */
|
|
1662
|
+
zeroDataRetention?: boolean;
|
|
1661
1663
|
error?: string;
|
|
1662
1664
|
}
|
|
1663
1665
|
interface AgentSnapshotResponse {
|
|
@@ -2109,6 +2111,14 @@ declare function prepareAgentPayload(args: {
|
|
|
2109
2111
|
threadId?: string;
|
|
2110
2112
|
mode?: AgentMode;
|
|
2111
2113
|
exchange?: AgentExchangeOptions;
|
|
2114
|
+
/**
|
|
2115
|
+
* Country for the whole run (ISO 3166-1 alpha-2). Scrapes and browser sessions are proxied from it,
|
|
2116
|
+
* and search results are localized to it without changing where requests come from. The agent cannot change it.
|
|
2117
|
+
*/
|
|
2118
|
+
location?: {
|
|
2119
|
+
country: string;
|
|
2120
|
+
};
|
|
2121
|
+
zeroDataRetention?: boolean;
|
|
2112
2122
|
}): Record<string, unknown>;
|
|
2113
2123
|
declare function startAgent(http: HttpClient, args: Parameters<typeof prepareAgentPayload>[0]): Promise<AgentResponse>;
|
|
2114
2124
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1552,7 +1552,7 @@ interface AgentTraceAgentIdentity {
|
|
|
1552
1552
|
parentId?: string;
|
|
1553
1553
|
}
|
|
1554
1554
|
interface AgentTraceError {
|
|
1555
|
-
code: "cancelled" | "credit_limit_reached" | "parent_finished" | "refused" | "internal";
|
|
1555
|
+
code: "cancelled" | "credit_limit_reached" | "insufficient_credits" | "parent_finished" | "refused" | "internal";
|
|
1556
1556
|
source: "agent" | "tool" | "billing" | "system";
|
|
1557
1557
|
retryable: boolean;
|
|
1558
1558
|
message: string;
|
|
@@ -1658,6 +1658,8 @@ interface AgentTraceResponse {
|
|
|
1658
1658
|
creditsUsed?: number;
|
|
1659
1659
|
/** Present only when the trace was requested with liveView: true. */
|
|
1660
1660
|
activeBrowserSessions?: AgentTraceActiveBrowserSession[];
|
|
1661
|
+
/** True for a zero data retention run: events are limited to content-free lifecycle events. */
|
|
1662
|
+
zeroDataRetention?: boolean;
|
|
1661
1663
|
error?: string;
|
|
1662
1664
|
}
|
|
1663
1665
|
interface AgentSnapshotResponse {
|
|
@@ -2109,6 +2111,14 @@ declare function prepareAgentPayload(args: {
|
|
|
2109
2111
|
threadId?: string;
|
|
2110
2112
|
mode?: AgentMode;
|
|
2111
2113
|
exchange?: AgentExchangeOptions;
|
|
2114
|
+
/**
|
|
2115
|
+
* Country for the whole run (ISO 3166-1 alpha-2). Scrapes and browser sessions are proxied from it,
|
|
2116
|
+
* and search results are localized to it without changing where requests come from. The agent cannot change it.
|
|
2117
|
+
*/
|
|
2118
|
+
location?: {
|
|
2119
|
+
country: string;
|
|
2120
|
+
};
|
|
2121
|
+
zeroDataRetention?: boolean;
|
|
2112
2122
|
}): Record<string, unknown>;
|
|
2113
2123
|
declare function startAgent(http: HttpClient, args: Parameters<typeof prepareAgentPayload>[0]): Promise<AgentResponse>;
|
|
2114
2124
|
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
version
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UGAMW2BL.js";
|
|
4
4
|
|
|
5
5
|
// src/v2/utils/httpClient.ts
|
|
6
6
|
import axios from "axios";
|
|
@@ -1545,6 +1545,8 @@ function prepareAgentPayload(args) {
|
|
|
1545
1545
|
if (args.threadId != null) body.threadId = args.threadId;
|
|
1546
1546
|
if (args.mode != null) body.mode = args.mode;
|
|
1547
1547
|
if (args.exchange != null) body.exchange = args.exchange;
|
|
1548
|
+
if (args.location != null) body.location = args.location;
|
|
1549
|
+
if (args.zeroDataRetention != null) body.zeroDataRetention = args.zeroDataRetention;
|
|
1548
1550
|
return body;
|
|
1549
1551
|
}
|
|
1550
1552
|
async function startAgent(http, args) {
|
|
@@ -2999,7 +3001,7 @@ var FirecrawlApp = class {
|
|
|
2999
3001
|
if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
|
|
3000
3002
|
return process.env.npm_package_version;
|
|
3001
3003
|
}
|
|
3002
|
-
const packageJson = await import("./package-
|
|
3004
|
+
const packageJson = await import("./package-TFTOUFDX.js");
|
|
3003
3005
|
return packageJson.default.version;
|
|
3004
3006
|
} catch (error) {
|
|
3005
3007
|
const isTest = typeof process !== "undefined" && !!process.env && false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mendable/firecrawl-js",
|
|
3
|
-
"version": "4.50.
|
|
3
|
+
"version": "4.50.1",
|
|
4
4
|
"description": "JavaScript SDK for Firecrawl, the context API for AI agents: search, scrape, parse, crawl, map, and interact with the web, run Agent and Monitor jobs, and search scientific papers (PubMed, bioRxiv, medRxiv, arXiv)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"axios": "1.20.0",
|
|
23
|
-
"firecrawl": "4.50.
|
|
23
|
+
"firecrawl": "4.50.1",
|
|
24
24
|
"typescript-event-target": "^1.1.1",
|
|
25
25
|
"zod": "^3.23.8",
|
|
26
26
|
"zod-to-json-schema": "^3.23.0"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"tsup": "^8.5.0",
|
|
38
38
|
"typescript": "^5.4.5",
|
|
39
39
|
"uuid": "^14.0.0",
|
|
40
|
-
"vitest": "^4.1.
|
|
40
|
+
"vitest": "^4.1.12"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [
|
|
43
43
|
"firecrawl",
|
package/pnpm-workspace.yaml
CHANGED
|
@@ -14,6 +14,8 @@ overrides:
|
|
|
14
14
|
# GHSA-m8m8-qj5v-23w3 / GHSA-44g4-m2mj-wpvx / GHSA-r4gj-5m52-g5wh:
|
|
15
15
|
# pin the 1.x line only. Exact 1.20.0 cannot resolve to 2.x.
|
|
16
16
|
"axios@>=1.0.0 <1.20.0": "1.20.0"
|
|
17
|
-
|
|
17
|
+
# GHSA-Q3JH-WRC6-JGQ8 / GHSA-8R9P-F939-6H3C: fixed in 1.16.1.
|
|
18
|
+
# Replacement is bounded <2.0.0; cannot resolve to follow-redirects 2.x.
|
|
19
|
+
"follow-redirects@<1.16.1": ">=1.16.1 <2.0.0"
|
|
18
20
|
"form-data@>=4.0.0 <4.0.6": "4.0.6"
|
|
19
21
|
"esbuild@>=0.17.0 <0.28.1": "0.28.1"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { describe, test, expect, vi } from "vitest";
|
|
2
|
+
import { startAgent } from "../../../v2/methods/agent";
|
|
3
|
+
|
|
4
|
+
describe("JS SDK v2 agent location", () => {
|
|
5
|
+
const post = () =>
|
|
6
|
+
vi.fn(async () => ({
|
|
7
|
+
status: 200,
|
|
8
|
+
data: { success: true, id: "agent-1" },
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
test("sends location when starting an agent", async () => {
|
|
12
|
+
const http = { post: post() };
|
|
13
|
+
|
|
14
|
+
await startAgent(http as any, {
|
|
15
|
+
prompt: "Find the pricing page",
|
|
16
|
+
location: { country: "DE" },
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
expect(http.post).toHaveBeenCalledWith("/v2/agent", {
|
|
20
|
+
prompt: "Find the pricing page",
|
|
21
|
+
location: { country: "DE" },
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("omits location by default", async () => {
|
|
26
|
+
const http = { post: post() };
|
|
27
|
+
|
|
28
|
+
await startAgent(http as any, { prompt: "Find the pricing page" });
|
|
29
|
+
|
|
30
|
+
expect(http.post).toHaveBeenCalledWith("/v2/agent", {
|
|
31
|
+
prompt: "Find the pricing page",
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
package/src/v2/methods/agent.ts
CHANGED
|
@@ -21,6 +21,12 @@ function prepareAgentPayload(args: {
|
|
|
21
21
|
threadId?: string;
|
|
22
22
|
mode?: AgentMode;
|
|
23
23
|
exchange?: AgentExchangeOptions;
|
|
24
|
+
/**
|
|
25
|
+
* Country for the whole run (ISO 3166-1 alpha-2). Scrapes and browser sessions are proxied from it,
|
|
26
|
+
* and search results are localized to it without changing where requests come from. The agent cannot change it.
|
|
27
|
+
*/
|
|
28
|
+
location?: { country: string };
|
|
29
|
+
zeroDataRetention?: boolean;
|
|
24
30
|
}): Record<string, unknown> {
|
|
25
31
|
const body: Record<string, unknown> = {};
|
|
26
32
|
if (args.urls) body.urls = args.urls;
|
|
@@ -42,6 +48,8 @@ function prepareAgentPayload(args: {
|
|
|
42
48
|
if (args.threadId != null) body.threadId = args.threadId;
|
|
43
49
|
if (args.mode != null) body.mode = args.mode;
|
|
44
50
|
if (args.exchange != null) body.exchange = args.exchange;
|
|
51
|
+
if (args.location != null) body.location = args.location;
|
|
52
|
+
if (args.zeroDataRetention != null) body.zeroDataRetention = args.zeroDataRetention;
|
|
45
53
|
return body;
|
|
46
54
|
}
|
|
47
55
|
|
package/src/v2/types.ts
CHANGED
|
@@ -300,7 +300,12 @@ export interface ScrapeOptions {
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
export type RedactPIIEntity =
|
|
303
|
-
|
|
303
|
+
| "PERSON"
|
|
304
|
+
| "EMAIL"
|
|
305
|
+
| "PHONE"
|
|
306
|
+
| "LOCATION"
|
|
307
|
+
| "FINANCIAL"
|
|
308
|
+
| "SECRET";
|
|
304
309
|
|
|
305
310
|
export interface RedactPIIOptions {
|
|
306
311
|
/**
|
|
@@ -347,7 +352,12 @@ export interface ThreatProtectionOptions {
|
|
|
347
352
|
}
|
|
348
353
|
|
|
349
354
|
export type ParseFileData =
|
|
350
|
-
|
|
355
|
+
| Blob
|
|
356
|
+
| File
|
|
357
|
+
| Buffer
|
|
358
|
+
| Uint8Array
|
|
359
|
+
| ArrayBuffer
|
|
360
|
+
| string;
|
|
351
361
|
|
|
352
362
|
export interface ParseFile {
|
|
353
363
|
data: ParseFileData;
|
|
@@ -395,7 +405,11 @@ export interface WebhookConfig {
|
|
|
395
405
|
|
|
396
406
|
// Agent webhook events differ from crawl: has 'action' and 'cancelled', no 'page'
|
|
397
407
|
export type AgentWebhookEvent =
|
|
398
|
-
|
|
408
|
+
| "started"
|
|
409
|
+
| "action"
|
|
410
|
+
| "completed"
|
|
411
|
+
| "failed"
|
|
412
|
+
| "cancelled";
|
|
399
413
|
|
|
400
414
|
export interface AgentWebhookConfig {
|
|
401
415
|
url: string;
|
|
@@ -516,7 +530,10 @@ export interface BrandingProfile {
|
|
|
516
530
|
headerHeight?: string;
|
|
517
531
|
footerHeight?: string;
|
|
518
532
|
[key: string]:
|
|
519
|
-
|
|
533
|
+
| number
|
|
534
|
+
| string
|
|
535
|
+
| Record<string, number | string | undefined>
|
|
536
|
+
| undefined;
|
|
520
537
|
};
|
|
521
538
|
tone?: {
|
|
522
539
|
voice?: string;
|
|
@@ -1014,7 +1031,10 @@ export interface SearchRequest {
|
|
|
1014
1031
|
/** Compact by default; summary adds metadata, full includes contracts. */
|
|
1015
1032
|
toolDetail?: "compact" | "summary" | "full";
|
|
1016
1033
|
sources?: Array<
|
|
1017
|
-
|
|
1034
|
+
| "web"
|
|
1035
|
+
| "news"
|
|
1036
|
+
| "images"
|
|
1037
|
+
| "alexandria"
|
|
1018
1038
|
| { type: "web" | "news" | "images" | "alexandria" }
|
|
1019
1039
|
>;
|
|
1020
1040
|
/**
|
|
@@ -1265,7 +1285,9 @@ export interface MonitorSearchTarget {
|
|
|
1265
1285
|
}
|
|
1266
1286
|
|
|
1267
1287
|
export type MonitorTarget =
|
|
1268
|
-
|
|
1288
|
+
| MonitorScrapeTarget
|
|
1289
|
+
| MonitorCrawlTarget
|
|
1290
|
+
| MonitorSearchTarget;
|
|
1269
1291
|
|
|
1270
1292
|
export interface CreateMonitorRequest {
|
|
1271
1293
|
name: string;
|
|
@@ -1388,7 +1410,11 @@ export interface MonitorCheck {
|
|
|
1388
1410
|
reservedCredits?: number | null;
|
|
1389
1411
|
actualCredits?: number | null;
|
|
1390
1412
|
billingStatus:
|
|
1391
|
-
|
|
1413
|
+
| "not_applicable"
|
|
1414
|
+
| "reserved"
|
|
1415
|
+
| "confirmed"
|
|
1416
|
+
| "released"
|
|
1417
|
+
| "failed";
|
|
1392
1418
|
summary: MonitorSummary;
|
|
1393
1419
|
targetResults?: MonitorTargetResult[];
|
|
1394
1420
|
notificationStatus?: unknown;
|
|
@@ -1779,7 +1805,10 @@ export interface AgentListOptions {
|
|
|
1779
1805
|
}
|
|
1780
1806
|
|
|
1781
1807
|
export type AgentTraceAgentRole =
|
|
1782
|
-
|
|
1808
|
+
| "orchestrator"
|
|
1809
|
+
| "subagent"
|
|
1810
|
+
| "browser"
|
|
1811
|
+
| "system";
|
|
1783
1812
|
|
|
1784
1813
|
export interface AgentTraceAgentIdentity {
|
|
1785
1814
|
id: string;
|
|
@@ -1792,6 +1821,7 @@ export interface AgentTraceError {
|
|
|
1792
1821
|
code:
|
|
1793
1822
|
| "cancelled"
|
|
1794
1823
|
| "credit_limit_reached"
|
|
1824
|
+
| "insufficient_credits"
|
|
1795
1825
|
| "parent_finished"
|
|
1796
1826
|
| "refused"
|
|
1797
1827
|
| "internal";
|
|
@@ -1833,7 +1863,11 @@ export interface AgentTraceRunCancelRequestedEvent extends AgentTraceEventBase {
|
|
|
1833
1863
|
export interface AgentTraceRunFinishedEvent extends AgentTraceEventBase {
|
|
1834
1864
|
type: "run.finished";
|
|
1835
1865
|
outcome:
|
|
1836
|
-
|
|
1866
|
+
| "succeeded"
|
|
1867
|
+
| "failed"
|
|
1868
|
+
| "cancelled"
|
|
1869
|
+
| "refused"
|
|
1870
|
+
| "credit_limit_reached";
|
|
1837
1871
|
/** The canonical schema always writes this key (nullable), but older rows may omit it. */
|
|
1838
1872
|
error?: AgentTraceError | null;
|
|
1839
1873
|
}
|
|
@@ -1850,12 +1884,14 @@ export interface AgentTraceAgentFinishedEvent extends AgentTraceEventBase {
|
|
|
1850
1884
|
error?: AgentTraceError | null;
|
|
1851
1885
|
}
|
|
1852
1886
|
|
|
1853
|
-
export interface AgentTraceBrowserSessionStartedEvent
|
|
1887
|
+
export interface AgentTraceBrowserSessionStartedEvent
|
|
1888
|
+
extends AgentTraceEventBase {
|
|
1854
1889
|
type: "browser.session.started";
|
|
1855
1890
|
sessionId: string;
|
|
1856
1891
|
}
|
|
1857
1892
|
|
|
1858
|
-
export interface AgentTraceBrowserSessionFinishedEvent
|
|
1893
|
+
export interface AgentTraceBrowserSessionFinishedEvent
|
|
1894
|
+
extends AgentTraceEventBase {
|
|
1859
1895
|
type: "browser.session.finished";
|
|
1860
1896
|
sessionId: string;
|
|
1861
1897
|
durationMs: number;
|
|
@@ -1929,6 +1965,8 @@ export interface AgentTraceResponse {
|
|
|
1929
1965
|
creditsUsed?: number;
|
|
1930
1966
|
/** Present only when the trace was requested with liveView: true. */
|
|
1931
1967
|
activeBrowserSessions?: AgentTraceActiveBrowserSession[];
|
|
1968
|
+
/** True for a zero data retention run: events are limited to content-free lifecycle events. */
|
|
1969
|
+
zeroDataRetention?: boolean;
|
|
1932
1970
|
error?: string;
|
|
1933
1971
|
}
|
|
1934
1972
|
|
|
@@ -2028,7 +2066,9 @@ export interface RequiresAction {
|
|
|
2028
2066
|
url?: string;
|
|
2029
2067
|
}
|
|
2030
2068
|
|
|
2031
|
-
export function parseRequiresAction(
|
|
2069
|
+
export function parseRequiresAction(
|
|
2070
|
+
value: unknown,
|
|
2071
|
+
): RequiresAction | undefined {
|
|
2032
2072
|
if (!value || typeof value !== "object") return undefined;
|
|
2033
2073
|
const record = value as Record<string, unknown>;
|
|
2034
2074
|
if (typeof record.type !== "string") return undefined;
|