@mendable/firecrawl-js 4.37.0 → 4.38.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-LFX7WDGT.js → chunk-KSTNOGOD.js} +1 -1
- package/dist/index.cjs +23 -1
- package/dist/index.d.cts +51 -1
- package/dist/index.d.ts +51 -1
- package/dist/index.js +24 -2
- package/dist/{package-SHMK2LJE.js → package-OS7RONXY.js} +1 -1
- package/package.json +1 -1
- package/src/__tests__/unit/v2/agent-list.unit.test.ts +68 -0
- package/src/v2/client.ts +14 -1
- package/src/v2/methods/agent.ts +13 -1
- package/src/v2/types.ts +44 -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.38.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.38.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",
|
|
@@ -1394,6 +1394,17 @@ async function getAgentStatus(http, jobId) {
|
|
|
1394
1394
|
throw err;
|
|
1395
1395
|
}
|
|
1396
1396
|
}
|
|
1397
|
+
async function listAgents(http, options) {
|
|
1398
|
+
try {
|
|
1399
|
+
const query = options?.before !== void 0 ? `?before=${options.before}` : "";
|
|
1400
|
+
const res = await http.get(`/v2/agent${query}`);
|
|
1401
|
+
if (res.status !== 200) throwForBadResponse(res, "list agents");
|
|
1402
|
+
return res.data;
|
|
1403
|
+
} catch (err) {
|
|
1404
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "list agents");
|
|
1405
|
+
throw err;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1397
1408
|
async function waitAgent(http, jobId, pollInterval = 2, timeout) {
|
|
1398
1409
|
const start = Date.now();
|
|
1399
1410
|
while (true) {
|
|
@@ -2415,6 +2426,17 @@ var FirecrawlClient = class {
|
|
|
2415
2426
|
async getAgentStatus(jobId) {
|
|
2416
2427
|
return getAgentStatus(this.http, jobId);
|
|
2417
2428
|
}
|
|
2429
|
+
/**
|
|
2430
|
+
* List agent runs, most recent first.
|
|
2431
|
+
*
|
|
2432
|
+
* Pages are fixed at 20 runs. To fetch the next page, pass the `before`
|
|
2433
|
+
* value from the previous page's `next` URL. This method does not
|
|
2434
|
+
* auto-paginate.
|
|
2435
|
+
* @param options.before Only return runs created before this unix ms timestamp.
|
|
2436
|
+
*/
|
|
2437
|
+
async listAgents(options) {
|
|
2438
|
+
return listAgents(this.http, options);
|
|
2439
|
+
}
|
|
2418
2440
|
/**
|
|
2419
2441
|
* Convenience waiter: start an agent and poll until it finishes.
|
|
2420
2442
|
* @param args Agent request plus waiter controls (pollInterval, timeout seconds).
|
package/dist/index.d.cts
CHANGED
|
@@ -1113,6 +1113,47 @@ interface AgentStatusResponse {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
/** Reasoning effort for agent jobs. Every level runs spark-2. */
|
|
1115
1115
|
type AgentEffort = "low" | "medium" | "high";
|
|
1116
|
+
/** A single agent run as returned by the agent list endpoint. */
|
|
1117
|
+
interface AgentListItem {
|
|
1118
|
+
id: string;
|
|
1119
|
+
createdAt: string;
|
|
1120
|
+
targetHint: string;
|
|
1121
|
+
origin: string;
|
|
1122
|
+
integration?: string;
|
|
1123
|
+
settings: {
|
|
1124
|
+
hidden: boolean;
|
|
1125
|
+
starred: boolean;
|
|
1126
|
+
label?: string;
|
|
1127
|
+
};
|
|
1128
|
+
status: "processing" | "completed" | "failed";
|
|
1129
|
+
options?: {
|
|
1130
|
+
urls?: string[];
|
|
1131
|
+
prompt: string;
|
|
1132
|
+
schema?: unknown;
|
|
1133
|
+
/**
|
|
1134
|
+
* Server-provided model name. Widened past the request-side union on
|
|
1135
|
+
* purpose: new models ship without an SDK release, so pinning this to
|
|
1136
|
+
* known names makes every future model a type error at the call site.
|
|
1137
|
+
*/
|
|
1138
|
+
model: "spark-1-pro" | "spark-1-mini" | "spark-2" | (string & {});
|
|
1139
|
+
effort?: AgentEffort;
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
interface AgentListResponse {
|
|
1143
|
+
success: boolean;
|
|
1144
|
+
agents?: AgentListItem[];
|
|
1145
|
+
/**
|
|
1146
|
+
* Absolute URL of the next page (pass its `before` value to listAgents to
|
|
1147
|
+
* continue). Only present when more pages exist.
|
|
1148
|
+
*/
|
|
1149
|
+
next?: string;
|
|
1150
|
+
error?: string;
|
|
1151
|
+
}
|
|
1152
|
+
/** Options for listing agent runs. */
|
|
1153
|
+
interface AgentListOptions {
|
|
1154
|
+
/** Only return agent runs created before this unix millisecond timestamp. */
|
|
1155
|
+
before?: number;
|
|
1156
|
+
}
|
|
1116
1157
|
type AgentTraceAgentRole = "orchestrator" | "subagent" | "browser" | "system";
|
|
1117
1158
|
interface AgentTraceAgentIdentity {
|
|
1118
1159
|
id: string;
|
|
@@ -2026,6 +2067,15 @@ declare class FirecrawlClient {
|
|
|
2026
2067
|
* @param jobId Agent job id.
|
|
2027
2068
|
*/
|
|
2028
2069
|
getAgentStatus(jobId: string): Promise<AgentStatusResponse>;
|
|
2070
|
+
/**
|
|
2071
|
+
* List agent runs, most recent first.
|
|
2072
|
+
*
|
|
2073
|
+
* Pages are fixed at 20 runs. To fetch the next page, pass the `before`
|
|
2074
|
+
* value from the previous page's `next` URL. This method does not
|
|
2075
|
+
* auto-paginate.
|
|
2076
|
+
* @param options.before Only return runs created before this unix ms timestamp.
|
|
2077
|
+
*/
|
|
2078
|
+
listAgents(options?: AgentListOptions): Promise<AgentListResponse>;
|
|
2029
2079
|
/**
|
|
2030
2080
|
* Convenience waiter: start an agent and poll until it finishes.
|
|
2031
2081
|
* @param args Agent request plus waiter controls (pollInterval, timeout seconds).
|
|
@@ -3057,4 +3107,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
3057
3107
|
get v1(): FirecrawlApp;
|
|
3058
3108
|
}
|
|
3059
3109
|
|
|
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 };
|
|
3110
|
+
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentEffort, type AgentListItem, type AgentListOptions, type AgentListResponse, 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
|
@@ -1113,6 +1113,47 @@ interface AgentStatusResponse {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
/** Reasoning effort for agent jobs. Every level runs spark-2. */
|
|
1115
1115
|
type AgentEffort = "low" | "medium" | "high";
|
|
1116
|
+
/** A single agent run as returned by the agent list endpoint. */
|
|
1117
|
+
interface AgentListItem {
|
|
1118
|
+
id: string;
|
|
1119
|
+
createdAt: string;
|
|
1120
|
+
targetHint: string;
|
|
1121
|
+
origin: string;
|
|
1122
|
+
integration?: string;
|
|
1123
|
+
settings: {
|
|
1124
|
+
hidden: boolean;
|
|
1125
|
+
starred: boolean;
|
|
1126
|
+
label?: string;
|
|
1127
|
+
};
|
|
1128
|
+
status: "processing" | "completed" | "failed";
|
|
1129
|
+
options?: {
|
|
1130
|
+
urls?: string[];
|
|
1131
|
+
prompt: string;
|
|
1132
|
+
schema?: unknown;
|
|
1133
|
+
/**
|
|
1134
|
+
* Server-provided model name. Widened past the request-side union on
|
|
1135
|
+
* purpose: new models ship without an SDK release, so pinning this to
|
|
1136
|
+
* known names makes every future model a type error at the call site.
|
|
1137
|
+
*/
|
|
1138
|
+
model: "spark-1-pro" | "spark-1-mini" | "spark-2" | (string & {});
|
|
1139
|
+
effort?: AgentEffort;
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
interface AgentListResponse {
|
|
1143
|
+
success: boolean;
|
|
1144
|
+
agents?: AgentListItem[];
|
|
1145
|
+
/**
|
|
1146
|
+
* Absolute URL of the next page (pass its `before` value to listAgents to
|
|
1147
|
+
* continue). Only present when more pages exist.
|
|
1148
|
+
*/
|
|
1149
|
+
next?: string;
|
|
1150
|
+
error?: string;
|
|
1151
|
+
}
|
|
1152
|
+
/** Options for listing agent runs. */
|
|
1153
|
+
interface AgentListOptions {
|
|
1154
|
+
/** Only return agent runs created before this unix millisecond timestamp. */
|
|
1155
|
+
before?: number;
|
|
1156
|
+
}
|
|
1116
1157
|
type AgentTraceAgentRole = "orchestrator" | "subagent" | "browser" | "system";
|
|
1117
1158
|
interface AgentTraceAgentIdentity {
|
|
1118
1159
|
id: string;
|
|
@@ -2026,6 +2067,15 @@ declare class FirecrawlClient {
|
|
|
2026
2067
|
* @param jobId Agent job id.
|
|
2027
2068
|
*/
|
|
2028
2069
|
getAgentStatus(jobId: string): Promise<AgentStatusResponse>;
|
|
2070
|
+
/**
|
|
2071
|
+
* List agent runs, most recent first.
|
|
2072
|
+
*
|
|
2073
|
+
* Pages are fixed at 20 runs. To fetch the next page, pass the `before`
|
|
2074
|
+
* value from the previous page's `next` URL. This method does not
|
|
2075
|
+
* auto-paginate.
|
|
2076
|
+
* @param options.before Only return runs created before this unix ms timestamp.
|
|
2077
|
+
*/
|
|
2078
|
+
listAgents(options?: AgentListOptions): Promise<AgentListResponse>;
|
|
2029
2079
|
/**
|
|
2030
2080
|
* Convenience waiter: start an agent and poll until it finishes.
|
|
2031
2081
|
* @param args Agent request plus waiter controls (pollInterval, timeout seconds).
|
|
@@ -3057,4 +3107,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
3057
3107
|
get v1(): FirecrawlApp;
|
|
3058
3108
|
}
|
|
3059
3109
|
|
|
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 };
|
|
3110
|
+
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentEffort, type AgentListItem, type AgentListOptions, type AgentListResponse, 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.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
require_package
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KSTNOGOD.js";
|
|
4
4
|
|
|
5
5
|
// src/v2/utils/httpClient.ts
|
|
6
6
|
import axios from "axios";
|
|
@@ -1263,6 +1263,17 @@ async function getAgentStatus(http, jobId) {
|
|
|
1263
1263
|
throw err;
|
|
1264
1264
|
}
|
|
1265
1265
|
}
|
|
1266
|
+
async function listAgents(http, options) {
|
|
1267
|
+
try {
|
|
1268
|
+
const query = options?.before !== void 0 ? `?before=${options.before}` : "";
|
|
1269
|
+
const res = await http.get(`/v2/agent${query}`);
|
|
1270
|
+
if (res.status !== 200) throwForBadResponse(res, "list agents");
|
|
1271
|
+
return res.data;
|
|
1272
|
+
} catch (err) {
|
|
1273
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "list agents");
|
|
1274
|
+
throw err;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1266
1277
|
async function waitAgent(http, jobId, pollInterval = 2, timeout) {
|
|
1267
1278
|
const start = Date.now();
|
|
1268
1279
|
while (true) {
|
|
@@ -2284,6 +2295,17 @@ var FirecrawlClient = class {
|
|
|
2284
2295
|
async getAgentStatus(jobId) {
|
|
2285
2296
|
return getAgentStatus(this.http, jobId);
|
|
2286
2297
|
}
|
|
2298
|
+
/**
|
|
2299
|
+
* List agent runs, most recent first.
|
|
2300
|
+
*
|
|
2301
|
+
* Pages are fixed at 20 runs. To fetch the next page, pass the `before`
|
|
2302
|
+
* value from the previous page's `next` URL. This method does not
|
|
2303
|
+
* auto-paginate.
|
|
2304
|
+
* @param options.before Only return runs created before this unix ms timestamp.
|
|
2305
|
+
*/
|
|
2306
|
+
async listAgents(options) {
|
|
2307
|
+
return listAgents(this.http, options);
|
|
2308
|
+
}
|
|
2287
2309
|
/**
|
|
2288
2310
|
* Convenience waiter: start an agent and poll until it finishes.
|
|
2289
2311
|
* @param args Agent request plus waiter controls (pollInterval, timeout seconds).
|
|
@@ -2458,7 +2480,7 @@ var FirecrawlApp = class {
|
|
|
2458
2480
|
if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
|
|
2459
2481
|
return process.env.npm_package_version;
|
|
2460
2482
|
}
|
|
2461
|
-
const packageJson = await import("./package-
|
|
2483
|
+
const packageJson = await import("./package-OS7RONXY.js");
|
|
2462
2484
|
return packageJson.default.version;
|
|
2463
2485
|
} catch (error) {
|
|
2464
2486
|
const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mendable/firecrawl-js",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.38.0",
|
|
4
4
|
"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",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { describe, expect, jest, test } from "@jest/globals";
|
|
2
|
+
import { listAgents } from "../../../v2/methods/agent";
|
|
3
|
+
|
|
4
|
+
describe("v2.agent listAgents unit", () => {
|
|
5
|
+
const sampleAgent = {
|
|
6
|
+
id: "018f3c5e-0000-7000-8000-000000000000",
|
|
7
|
+
createdAt: "2026-08-31T12:00:00.000Z",
|
|
8
|
+
targetHint: "https://example.com",
|
|
9
|
+
origin: "api",
|
|
10
|
+
settings: { hidden: false, starred: false },
|
|
11
|
+
status: "completed",
|
|
12
|
+
options: {
|
|
13
|
+
urls: ["https://example.com"],
|
|
14
|
+
prompt: "Find the pricing",
|
|
15
|
+
model: "spark-1-pro",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
test("hits GET /v2/agent without query by default", async () => {
|
|
20
|
+
const get = jest.fn().mockResolvedValue({
|
|
21
|
+
status: 200,
|
|
22
|
+
data: { success: true, agents: [sampleAgent] },
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const res = await listAgents({ get } as any);
|
|
26
|
+
|
|
27
|
+
expect(get).toHaveBeenCalledWith("/v2/agent");
|
|
28
|
+
expect(res.success).toBe(true);
|
|
29
|
+
expect(res.agents).toHaveLength(1);
|
|
30
|
+
expect(res.agents![0].id).toBe(sampleAgent.id);
|
|
31
|
+
expect(res.agents![0].settings.starred).toBe(false);
|
|
32
|
+
expect(res.next).toBeUndefined();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test("passes before as a query param", async () => {
|
|
36
|
+
const get = jest.fn().mockResolvedValue({
|
|
37
|
+
status: 200,
|
|
38
|
+
data: {
|
|
39
|
+
success: true,
|
|
40
|
+
agents: [sampleAgent],
|
|
41
|
+
next: "https://api.firecrawl.dev/v2/agent?before=1756600000000",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const res = await listAgents({ get } as any, { before: 1756600000000 });
|
|
46
|
+
|
|
47
|
+
expect(get).toHaveBeenCalledWith("/v2/agent?before=1756600000000");
|
|
48
|
+
expect(res.next).toBe(
|
|
49
|
+
"https://api.firecrawl.dev/v2/agent?before=1756600000000",
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("does not auto-paginate when next is present", async () => {
|
|
54
|
+
const get = jest.fn().mockResolvedValue({
|
|
55
|
+
status: 200,
|
|
56
|
+
data: {
|
|
57
|
+
success: true,
|
|
58
|
+
agents: [sampleAgent],
|
|
59
|
+
next: "https://api.firecrawl.dev/v2/agent?before=1756600000000",
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const res = await listAgents({ get } as any);
|
|
64
|
+
|
|
65
|
+
expect(get).toHaveBeenCalledTimes(1);
|
|
66
|
+
expect(res.agents).toHaveLength(1);
|
|
67
|
+
});
|
|
68
|
+
});
|
package/src/v2/client.ts
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
batchScrape as batchWaiter,
|
|
27
27
|
} from "./methods/batch";
|
|
28
28
|
import { startExtract, getExtractStatus, extract as extractWaiter } from "./methods/extract";
|
|
29
|
-
import { startAgent, getAgentStatus, getAgentTrace, getAgentSnapshot, cancelAgent, agent as agentWaiter } from "./methods/agent";
|
|
29
|
+
import { startAgent, getAgentStatus, getAgentTrace, getAgentSnapshot, cancelAgent, listAgents, agent as agentWaiter } from "./methods/agent";
|
|
30
30
|
import {
|
|
31
31
|
browser as browserMethod,
|
|
32
32
|
browserExecute,
|
|
@@ -70,6 +70,8 @@ import type {
|
|
|
70
70
|
AgentStatusResponse,
|
|
71
71
|
AgentTraceResponse,
|
|
72
72
|
AgentSnapshotResponse,
|
|
73
|
+
AgentListOptions,
|
|
74
|
+
AgentListResponse,
|
|
73
75
|
CrawlOptions,
|
|
74
76
|
BatchScrapeOptions,
|
|
75
77
|
PaginationConfig,
|
|
@@ -521,6 +523,17 @@ export class FirecrawlClient {
|
|
|
521
523
|
async getAgentStatus(jobId: string): Promise<AgentStatusResponse> {
|
|
522
524
|
return getAgentStatus(this.http, jobId);
|
|
523
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* List agent runs, most recent first.
|
|
528
|
+
*
|
|
529
|
+
* Pages are fixed at 20 runs. To fetch the next page, pass the `before`
|
|
530
|
+
* value from the previous page's `next` URL. This method does not
|
|
531
|
+
* auto-paginate.
|
|
532
|
+
* @param options.before Only return runs created before this unix ms timestamp.
|
|
533
|
+
*/
|
|
534
|
+
async listAgents(options?: AgentListOptions): Promise<AgentListResponse> {
|
|
535
|
+
return listAgents(this.http, options);
|
|
536
|
+
}
|
|
524
537
|
/**
|
|
525
538
|
* Convenience waiter: start an agent and poll until it finishes.
|
|
526
539
|
* @param args Agent request plus waiter controls (pollInterval, timeout seconds).
|
package/src/v2/methods/agent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentEffort, type AgentResponse, type AgentSnapshotResponse, type AgentStatusResponse, type AgentTraceResponse, type AgentWebhookConfig, type AuditMetadata, type ThreatProtectionOptions } from "../types";
|
|
1
|
+
import { type AgentEffort, type AgentListOptions, type AgentListResponse, type AgentResponse, type AgentSnapshotResponse, type AgentStatusResponse, type AgentTraceResponse, type AgentWebhookConfig, type AuditMetadata, type ThreatProtectionOptions } from "../types";
|
|
2
2
|
import { HttpClient } from "../utils/httpClient";
|
|
3
3
|
import { normalizeAxiosError, throwForBadResponse } from "../utils/errorHandler";
|
|
4
4
|
import { isZodSchema, zodSchemaToJsonSchema } from "../../utils/zodSchemaToJson";
|
|
@@ -61,6 +61,18 @@ export async function getAgentStatus(http: HttpClient, jobId: string): Promise<A
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
export async function listAgents(http: HttpClient, options?: AgentListOptions): Promise<AgentListResponse> {
|
|
65
|
+
try {
|
|
66
|
+
const query = options?.before !== undefined ? `?before=${options.before}` : "";
|
|
67
|
+
const res = await http.get<AgentListResponse>(`/v2/agent${query}`);
|
|
68
|
+
if (res.status !== 200) throwForBadResponse(res, "list agents");
|
|
69
|
+
return res.data;
|
|
70
|
+
} catch (err: any) {
|
|
71
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "list agents");
|
|
72
|
+
throw err;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
64
76
|
export async function waitAgent(
|
|
65
77
|
http: HttpClient,
|
|
66
78
|
jobId: string,
|
package/src/v2/types.ts
CHANGED
|
@@ -1340,6 +1340,50 @@ export interface AgentStatusResponse {
|
|
|
1340
1340
|
/** Reasoning effort for agent jobs. Every level runs spark-2. */
|
|
1341
1341
|
export type AgentEffort = "low" | "medium" | "high";
|
|
1342
1342
|
|
|
1343
|
+
/** A single agent run as returned by the agent list endpoint. */
|
|
1344
|
+
export interface AgentListItem {
|
|
1345
|
+
id: string;
|
|
1346
|
+
createdAt: string;
|
|
1347
|
+
targetHint: string;
|
|
1348
|
+
origin: string;
|
|
1349
|
+
integration?: string;
|
|
1350
|
+
settings: {
|
|
1351
|
+
hidden: boolean;
|
|
1352
|
+
starred: boolean;
|
|
1353
|
+
label?: string;
|
|
1354
|
+
};
|
|
1355
|
+
status: "processing" | "completed" | "failed";
|
|
1356
|
+
options?: {
|
|
1357
|
+
urls?: string[];
|
|
1358
|
+
prompt: string;
|
|
1359
|
+
schema?: unknown;
|
|
1360
|
+
/**
|
|
1361
|
+
* Server-provided model name. Widened past the request-side union on
|
|
1362
|
+
* purpose: new models ship without an SDK release, so pinning this to
|
|
1363
|
+
* known names makes every future model a type error at the call site.
|
|
1364
|
+
*/
|
|
1365
|
+
model: "spark-1-pro" | "spark-1-mini" | "spark-2" | (string & {});
|
|
1366
|
+
effort?: AgentEffort;
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
export interface AgentListResponse {
|
|
1371
|
+
success: boolean;
|
|
1372
|
+
agents?: AgentListItem[];
|
|
1373
|
+
/**
|
|
1374
|
+
* Absolute URL of the next page (pass its `before` value to listAgents to
|
|
1375
|
+
* continue). Only present when more pages exist.
|
|
1376
|
+
*/
|
|
1377
|
+
next?: string;
|
|
1378
|
+
error?: string;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
/** Options for listing agent runs. */
|
|
1382
|
+
export interface AgentListOptions {
|
|
1383
|
+
/** Only return agent runs created before this unix millisecond timestamp. */
|
|
1384
|
+
before?: number;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1343
1387
|
export type AgentTraceAgentRole = "orchestrator" | "subagent" | "browser" | "system";
|
|
1344
1388
|
|
|
1345
1389
|
export interface AgentTraceAgentIdentity {
|