@crawlee/stagehand 4.0.0-beta.134 → 4.0.0-beta.136

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
@@ -119,7 +119,6 @@ export const log = mod.log;
119
119
  export const mergeCookies = mod.mergeCookies;
120
120
  export const navigationDeadlineKey = mod.navigationDeadlineKey;
121
121
  export const operationRejectedInTransaction = mod.operationRejectedInTransaction;
122
- export const parseArgument = mod.parseArgument;
123
122
  export const parseRetryAfterHeader = mod.parseRetryAfterHeader;
124
123
  export const parseValue = mod.parseValue;
125
124
  export const purgeDefaultStorages = mod.purgeDefaultStorages;
@@ -128,7 +127,6 @@ export const remainingNavigationWindowMillis = mod.remainingNavigationWindowMill
128
127
  export const remoteStagehandBrowserPool = mod.remoteStagehandBrowserPool;
129
128
  export const resolveBaseUrlForEnqueueLinksFiltering = mod.resolveBaseUrlForEnqueueLinksFiltering;
130
129
  export const resolveStorageIdentifier = mod.resolveStorageIdentifier;
131
- export const schemas = mod.schemas;
132
130
  export const serializeArray = mod.serializeArray;
133
131
  export const serializeValue = mod.serializeValue;
134
132
  export const serviceLocator = mod.serviceLocator;
@@ -137,7 +135,6 @@ export const stagehandBrowserPool = mod.stagehandBrowserPool;
137
135
  export const stagehandUtils = mod.stagehandUtils;
138
136
  export const supportsDomainThrottling = mod.supportsDomainThrottling;
139
137
  export const toughCookieToBrowserPoolCookie = mod.toughCookieToBrowserPoolCookie;
140
- export const tryAbsoluteURL = mod.tryAbsoluteURL;
141
138
  export const updateEnqueueLinksPatternCache = mod.updateEnqueueLinksPatternCache;
142
139
  export const urlPatternSchema = mod.urlPatternSchema;
143
140
  export const useState = mod.useState;
@@ -314,6 +314,9 @@ export interface StagehandCrawlerOptions<ContextExtension = Dictionary<never>, E
314
314
  * ```
315
315
  */
316
316
  export declare class StagehandCrawler<ContextExtension = Dictionary<never>, ExtendedContext extends StagehandCrawlingContext = StagehandCrawlingContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<StagehandCrawlingContext['request']>>, StatisticStateExtension extends object = {}> extends BrowserCrawler<StagehandPage, Response, LaunchOptions, StagehandCrawlingContext, ContextExtension, ExtendedContext, Routes, StatisticStateExtension> {
317
+ /**
318
+ * @internal
319
+ */
317
320
  protected static optionsShape: {
318
321
  stagehandOptions: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
319
322
  headless: z.ZodOptional<z.ZodBoolean>;
@@ -373,6 +376,7 @@ export declare class StagehandCrawler<ContextExtension = Dictionary<never>, Exte
373
376
  statistics: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
374
377
  id: z.ZodOptional<z.ZodString>;
375
378
  };
379
+ /** @internal */
376
380
  protected static optionsSchema: z.ZodObject<{
377
381
  stagehandOptions: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
378
382
  headless: z.ZodOptional<z.ZodBoolean>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StagehandCrawler = void 0;
4
4
  exports.createStagehandRouter = createStagehandRouter;
5
5
  const browser_1 = require("@crawlee/browser");
6
+ const internal_1 = require("@crawlee/utils/internal");
6
7
  const zod_1 = require("zod");
7
8
  const stagehand_browser_pool_1 = require("./stagehand-browser-pool");
8
9
  const stagehand_utils_1 = require("./utils/stagehand-utils");
@@ -56,11 +57,15 @@ const stagehand_utils_1 = require("./utils/stagehand-utils");
56
57
  * ```
57
58
  */
58
59
  class StagehandCrawler extends browser_1.BrowserCrawler {
60
+ /**
61
+ * @internal
62
+ */
59
63
  static optionsShape = {
60
64
  ...browser_1.BrowserCrawler.optionsShape,
61
- stagehandOptions: browser_1.schemas.anyObject.optional(),
65
+ stagehandOptions: internal_1.schemas.anyObject.optional(),
62
66
  headless: zod_1.z.boolean().optional(),
63
67
  };
68
+ /** @internal */
64
69
  static optionsSchema = zod_1.z.strictObject(StagehandCrawler.optionsShape);
65
70
  /**
66
71
  * Creates a new instance of StagehandCrawler.
@@ -68,7 +73,7 @@ class StagehandCrawler extends browser_1.BrowserCrawler {
68
73
  * @param options - Crawler configuration options
69
74
  */
70
75
  constructor(options = {}) {
71
- const parsedOptions = (0, browser_1.parseArgument)(options, StagehandCrawler.optionsSchema, 'StagehandCrawlerOptions');
76
+ const parsedOptions = (0, internal_1.parseArgument)(options, StagehandCrawler.optionsSchema, 'StagehandCrawlerOptions');
72
77
  const { stagehandOptions, launchContext, headless, configuration, contextPipelineBuilder, ...browserCrawlerOptions } = parsedOptions;
73
78
  if (options.browserPool) {
74
79
  // The raw options, not the parsed ones: `launchContext` has a default, so by now it is always set.
@@ -57,6 +57,9 @@ export interface StagehandLaunchContext extends BrowserLaunchContext<LaunchOptio
57
57
  export declare class StagehandLauncher extends BrowserLauncher<StagehandPlugin> {
58
58
  #private;
59
59
  readonly configuration: Configuration;
60
+ /**
61
+ * @internal
62
+ */
60
63
  protected static optionsShape: {
61
64
  // @ts-ignore optional peer dependency or compatibility with es2022
62
65
  launcher: z.ZodOptional<z.ZodCustom<import("@crawlee/types", { with: { "resolution-mode": "import" } }).Dictionary, import("@crawlee/types", { with: { "resolution-mode": "import" } }).Dictionary>>;
@@ -74,6 +77,7 @@ export declare class StagehandLauncher extends BrowserLauncher<StagehandPlugin>
74
77
  launchOptions: z.ZodOptional<z.ZodCustom<import("@crawlee/types", { with: { "resolution-mode": "import" } }).Dictionary, import("@crawlee/types", { with: { "resolution-mode": "import" } }).Dictionary>>;
75
78
  userAgent: z.ZodOptional<z.ZodString>;
76
79
  };
80
+ /** @internal */
77
81
  protected static optionsSchema: z.ZodObject<{
78
82
  // @ts-ignore optional peer dependency or compatibility with es2022
79
83
  launcher: z.ZodOptional<z.ZodCustom<import("@crawlee/types", { with: { "resolution-mode": "import" } }).Dictionary, import("@crawlee/types", { with: { "resolution-mode": "import" } }).Dictionary>>;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StagehandLauncher = void 0;
4
4
  const browser_1 = require("@crawlee/browser");
5
+ const internal_1 = require("@crawlee/utils/internal");
5
6
  const zod_1 = require("zod");
6
7
  const stagehand_plugin_1 = require("./stagehand-plugin");
7
8
  /**
@@ -12,20 +13,24 @@ const stagehand_plugin_1 = require("./stagehand-plugin");
12
13
  */
13
14
  class StagehandLauncher extends browser_1.BrowserLauncher {
14
15
  configuration;
16
+ /**
17
+ * @internal
18
+ */
15
19
  static optionsShape = {
16
20
  ...browser_1.BrowserLauncher.optionsShape,
17
21
  // Passthrough schemas — the launcher module object must keep its prototype through parsing.
18
- launcher: browser_1.schemas.anyObject.optional(),
19
- launchContextOptions: browser_1.schemas.anyObject.optional(),
20
- stagehandOptions: browser_1.schemas.anyObject.optional(),
22
+ launcher: internal_1.schemas.anyObject.optional(),
23
+ launchContextOptions: internal_1.schemas.anyObject.optional(),
24
+ stagehandOptions: internal_1.schemas.anyObject.optional(),
21
25
  };
26
+ /** @internal */
22
27
  static optionsSchema = zod_1.z.strictObject(StagehandLauncher.optionsShape);
23
28
  #stagehandOptions;
24
29
  /**
25
30
  * All StagehandLauncher parameters are passed via the launchContext object.
26
31
  */
27
32
  constructor(launchContext = {}, configuration = browser_1.Configuration.getGlobalConfiguration()) {
28
- const parsedContext = (0, browser_1.parseArgument)(launchContext, StagehandLauncher.optionsSchema, 'StagehandLaunchContext');
33
+ const parsedContext = (0, internal_1.parseArgument)(launchContext, StagehandLauncher.optionsSchema, 'StagehandLaunchContext');
29
34
  const { launcher = browser_1.BrowserLauncher.requireLauncherOrThrow('playwright', 'apify/actor-node-playwright-*').chromium, stagehandOptions = {}, } = parsedContext;
30
35
  const { launchOptions = {}, ...rest } = parsedContext;
31
36
  // Call super first before initializing properties
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/stagehand",
3
- "version": "4.0.0-beta.134",
3
+ "version": "4.0.0-beta.136",
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.0.0"
@@ -57,11 +57,11 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@apify/timeout": "^0.4.4",
60
- "@crawlee/browser": "4.0.0-beta.134",
61
- "@crawlee/browser-pool": "4.0.0-beta.134",
62
- "@crawlee/core": "4.0.0-beta.134",
63
- "@crawlee/types": "4.0.0-beta.134",
64
- "@crawlee/utils": "4.0.0-beta.134",
60
+ "@crawlee/browser": "4.0.0-beta.136",
61
+ "@crawlee/browser-pool": "4.0.0-beta.136",
62
+ "@crawlee/core": "4.0.0-beta.136",
63
+ "@crawlee/types": "4.0.0-beta.136",
64
+ "@crawlee/utils": "4.0.0-beta.136",
65
65
  "tslib": "^2.8.1",
66
66
  "zod": "^4.4.3"
67
67
  },
@@ -88,5 +88,5 @@
88
88
  }
89
89
  }
90
90
  },
91
- "gitHead": "0f269d5b24ec2829f3d44c19a35973fa20d95999"
91
+ "gitHead": "d425bb9841885b4b71b84ae6fb0bafbdc4a7e978"
92
92
  }