@crawlee/stagehand 4.0.0-rc.2 → 4.0.0-rc.3

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/index.mjs CHANGED
@@ -25,6 +25,7 @@ export const DATASET_ITERATORS_DEFAULT_LIMIT = mod.DATASET_ITERATORS_DEFAULT_LIM
25
25
  export const DEFAULT_CURRENT_HISTORY_SECS = mod.DEFAULT_CURRENT_HISTORY_SECS;
26
26
  export const DEFAULT_SNAPSHOT_HISTORY_SECS = mod.DEFAULT_SNAPSHOT_HISTORY_SECS;
27
27
  export const Dataset = mod.Dataset;
28
+ export const DownloadStartedError = mod.DownloadStartedError;
28
29
  export const EnqueueStrategy = mod.EnqueueStrategy;
29
30
  export const ErrorTracker = mod.ErrorTracker;
30
31
  export const EventLoopLoadSignal = mod.EventLoopLoadSignal;
@@ -190,7 +190,7 @@ export type StagehandHook<UserData extends Dictionary = any> = BrowserHook<Stage
190
190
  /**
191
191
  * Options for StagehandCrawler.
192
192
  */
193
- export interface StagehandCrawlerOptions<ContextExtension = Dictionary<never>, ExtendedContext extends StagehandCrawlingContext = StagehandCrawlingContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<StagehandCrawlingContext['request']>>, StatisticStateExtension extends object = {}> extends BrowserCrawlerOptions<StagehandPage, Response, StagehandCrawlingContext, ContextExtension, ExtendedContext, Routes, StatisticStateExtension> {
193
+ export interface StagehandCrawlerOptions<ContextExtension = Dictionary<never>, ExtendedContext extends StagehandCrawlingContext = StagehandCrawlingContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<StagehandCrawlingContext['request']>>, StatisticStateExtension extends object = {}> extends Omit<BrowserCrawlerOptions<StagehandPage, Response, StagehandCrawlingContext, ContextExtension, ExtendedContext, Routes, StatisticStateExtension>, 'ignoreShadowRoots' | 'ignoreIframes'> {
194
194
  /**
195
195
  * Stagehand-specific configuration options.
196
196
  * These options configure the AI behavior and Browserbase integration.
@@ -349,8 +349,6 @@ export declare class StagehandCrawler<ContextExtension = Dictionary<never>, Exte
349
349
  // @ts-ignore optional peer dependency or compatibility with es2022
350
350
  configuration: z.ZodOptional<z.ZodInstanceOf<import("@crawlee/browser").Configuration>>;
351
351
  storageBackend: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
352
- // @ts-ignore optional peer dependency or compatibility with es2022
353
- eventManager: z.ZodOptional<z.ZodInstanceOf<import("@crawlee/browser").EventManager>>;
354
352
  logger: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
355
353
  minConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
356
354
  maxConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
@@ -410,8 +408,6 @@ export declare class StagehandCrawler<ContextExtension = Dictionary<never>, Exte
410
408
  // @ts-ignore optional peer dependency or compatibility with es2022
411
409
  configuration: z.ZodOptional<z.ZodInstanceOf<import("@crawlee/browser").Configuration>>;
412
410
  storageBackend: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
413
- // @ts-ignore optional peer dependency or compatibility with es2022
414
- eventManager: z.ZodOptional<z.ZodInstanceOf<import("@crawlee/browser").EventManager>>;
415
411
  logger: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
416
412
  minConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
417
413
  maxConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
@@ -68,13 +68,18 @@ class StagehandCrawler extends browser_1.BrowserCrawler {
68
68
  };
69
69
  /** @internal */
70
70
  static optionsSchema = zod_1.z.strictObject(StagehandCrawler.optionsShape);
71
+ /** Only `parseWithCheerio` reads the omitted options, and the Stagehand context has no such helper. */
72
+ static #constructorOptionsSchema = StagehandCrawler.optionsSchema.omit({
73
+ ignoreShadowRoots: true,
74
+ ignoreIframes: true,
75
+ });
71
76
  /**
72
77
  * Creates a new instance of StagehandCrawler.
73
78
  *
74
79
  * @param options - Crawler configuration options
75
80
  */
76
81
  constructor(options = {}) {
77
- const parsedOptions = (0, internal_1.parseArgument)(options, StagehandCrawler.optionsSchema, 'StagehandCrawlerOptions');
82
+ const parsedOptions = (0, internal_1.parseArgument)(options, StagehandCrawler.#constructorOptionsSchema, 'StagehandCrawlerOptions');
78
83
  const { stagehandOptions, launchContext, headless, configuration, ...browserCrawlerOptions } = parsedOptions;
79
84
  if (options.browserPool) {
80
85
  // The raw options, not the parsed ones: `launchContext` has a default, so by now it is always set.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/stagehand",
3
- "version": "4.0.0-rc.2",
3
+ "version": "4.0.0-rc.3",
4
4
  "description": "AI-powered web crawling with Stagehand integration for Crawlee - enables natural language browser automation with act(), extract(), and observe() methods.",
5
5
  "engines": {
6
6
  "node": ">=22.13.0"
@@ -56,11 +56,11 @@
56
56
  "access": "public"
57
57
  },
58
58
  "dependencies": {
59
- "@crawlee/browser": "4.0.0-rc.2",
60
- "@crawlee/browser-pool": "4.0.0-rc.2",
61
- "@crawlee/core": "4.0.0-rc.2",
62
- "@crawlee/types": "4.0.0-rc.2",
63
- "@crawlee/utils": "4.0.0-rc.2",
59
+ "@crawlee/browser": "4.0.0-rc.3",
60
+ "@crawlee/browser-pool": "4.0.0-rc.3",
61
+ "@crawlee/core": "4.0.0-rc.3",
62
+ "@crawlee/types": "4.0.0-rc.3",
63
+ "@crawlee/utils": "4.0.0-rc.3",
64
64
  "tslib": "^2.9.1",
65
65
  "zod": "^4.6.7"
66
66
  },
@@ -87,5 +87,5 @@
87
87
  }
88
88
  }
89
89
  },
90
- "gitHead": "a9b623229cd7d1bff5063fc82940efebaea47165"
90
+ "gitHead": "c8d256de99bcece26c9f675601dadaf0f2b892f2"
91
91
  }