Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Nick:

Nicolas7db2d25efa5d
diff --git a/apps/api/src/lib/deep-research/deep-research-service.ts b/apps/api/src/lib/deep-research/deep-research-service.ts
index 1fe6f0739..7e19fc98f 100644
--- a/apps/api/src/lib/deep-research/deep-research-service.ts
+++ b/apps/api/src/lib/deep-research/deep-research-service.ts
@@ -94,7 +94,7 @@ export async function performDeepResearch(options: DeepResearchServiceOptions) {
teamId: options.teamId,
plan: options.plan as PlanType,
origin: "deep-research",
- timeout: 15000,
+ timeout: 10000,
scrapeOptions: {
formats: ["markdown"],
onlyMainContent: true,
diff --git a/apps/js-sdk/firecrawl/package.json b/apps/js-sdk/firecrawl/package.json
index 75164c4d0..e3d8b825e 100644
--- a/apps/js-sdk/firecrawl/package.json
+++ b/apps/js-sdk/firecrawl/package.json
@@ -1,6 +1,6 @@
{
"name": "@mendable/firecrawl-js",
- "version": "1.18.2",
+ "version": "1.18.3-beta.1",
"description": "JavaScript SDK for Firecrawl API",
"main": "dist/index.js",
"types": "dist/index.d.ts",
diff --git a/apps/js-sdk/firecrawl/src/index.ts b/apps/js-sdk/firecrawl/src/index.ts
index 7601414c2..b4bc5fb29 100644
--- a/apps/js-sdk/firecrawl/src/index.ts
+++ b/apps/js-sdk/firecrawl/src/index.ts
@@ -1391,10 +1391,22 @@ export default class FirecrawlApp {
/**
* Initiates a deep research operation on a given topic and polls until completion.
+ * @param topic - The topic to research.
* @param params - Parameters for the deep research operation.
+ * @param onActivity - Optional callback to receive activity updates in real-time.
* @returns The final research results.
*/
- async __deepResearch(topic: string, params: DeepResearchParams): Promise<DeepResearchStatusResponse | ErrorResponse> {
+ async __deepResearch(
+ topic: string,
+ params: DeepResearchParams,
+ onActivity?: (activity: {
+ type: string;
+ status: string;
+ message: string;
+ timestamp: string;
+ depth: number;
+ }) => void
+ ): Promise<DeepResearchStatusResponse | ErrorResponse> {
try {
const response = await this.__asyncDeepResearch(topic, params);
@@ -1408,16 +1420,24 @@ export default class FirecrawlApp {
const jobId = response.id;
let researchStatus;
+ let lastActivityCount = 0;
while (true) {
- // console.log("Checking research status...");
researchStatus = await this.__checkDeepResearchStatus(jobId);
- // console.log("Research status:", researchStatus);
if ('error' in researchStatus && !researchStatus.success) {
return researchStatus;
}
+ // Stream new activities through the callback if provided
+ if (onActivity && researchStatus.activities) {
+ const newActivities = researchStatus.activities.slice(lastActivityCount);
+ for (const activity of newActivities) {
+ onActivity(activity);
+ }
+ lastActivityCount = researchStatus.activities.length;
+ }
+
if (researchStatus.status === "completed") {
return researchStatus;
}
@@ -1435,7 +1455,6 @@ export default class FirecrawlApp {
await new Promise(resolve => setTimeout(resolve, 2000));
}
- // console.log("Research status finished:", researchStatus);
return { success: false, error: "Research job terminated unexpectedly" };
} catch (error: any) {