@crawlee/stagehand 4.0.0-beta.198 → 4.0.0-beta.200

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.d.ts CHANGED
@@ -53,7 +53,6 @@ export * from '@crawlee/browser';
53
53
  export { StagehandCrawler, createStagehandRouter } from './internals/stagehand-crawler';
54
54
  export { stagehandBrowserPool, remoteStagehandBrowserPool } from './internals/stagehand-browser-pool';
55
55
  export type { StagehandBrowserPool, StagehandBrowserPoolOptions, RemoteStagehandBrowserPoolOptions, } from './internals/stagehand-browser-pool';
56
- export type { StagehandOptions, StagehandPage, StagehandCrawlingContext, StagehandHook, StagehandRequestHandler, StagehandGotoOptions, StagehandCrawlerOptions, } from './internals/stagehand-crawler';
56
+ export type { StagehandOptions, StagehandPage, StagehandCrawlingContext, StagehandHook, StagehandGotoOptions, StagehandCrawlerOptions, } from './internals/stagehand-crawler';
57
57
  export type { StagehandLaunchContext } from './internals/stagehand-launcher';
58
- export * as stagehandUtils from './internals/utils/stagehand-utils';
59
- export type { ActOptions, ActResult, Action, AgentConfig, AgentResult, ExtractOptions, ModelConfiguration, ObserveOptions, Stagehand, } from '@browserbasehq/stagehand';
58
+ export type { ActOptions, ActResult, Action, AgentConfig, ExtractOptions, ModelConfiguration, ObserveOptions, Stagehand, } from '@browserbasehq/stagehand';
package/index.js CHANGED
@@ -51,7 +51,7 @@
51
51
  * @module @crawlee/stagehand
52
52
  */
53
53
  Object.defineProperty(exports, "__esModule", { value: true });
54
- exports.stagehandUtils = exports.remoteStagehandBrowserPool = exports.stagehandBrowserPool = exports.createStagehandRouter = exports.StagehandCrawler = void 0;
54
+ exports.remoteStagehandBrowserPool = exports.stagehandBrowserPool = exports.createStagehandRouter = exports.StagehandCrawler = void 0;
55
55
  const tslib_1 = require("tslib");
56
56
  // Re-export everything from @crawlee/browser for convenience
57
57
  tslib_1.__exportStar(require("@crawlee/browser"), exports);
@@ -63,5 +63,3 @@ Object.defineProperty(exports, "createStagehandRouter", { enumerable: true, get:
63
63
  var stagehand_browser_pool_1 = require("./internals/stagehand-browser-pool");
64
64
  Object.defineProperty(exports, "stagehandBrowserPool", { enumerable: true, get: function () { return stagehand_browser_pool_1.stagehandBrowserPool; } });
65
65
  Object.defineProperty(exports, "remoteStagehandBrowserPool", { enumerable: true, get: function () { return stagehand_browser_pool_1.remoteStagehandBrowserPool; } });
66
- // Export utilities as namespace
67
- exports.stagehandUtils = tslib_1.__importStar(require("./internals/utils/stagehand-utils"));
package/index.mjs CHANGED
@@ -25,7 +25,6 @@ export const DEFAULT_CURRENT_HISTORY_SECS = mod.DEFAULT_CURRENT_HISTORY_SECS;
25
25
  export const DEFAULT_SNAPSHOT_HISTORY_SECS = mod.DEFAULT_SNAPSHOT_HISTORY_SECS;
26
26
  export const Dataset = mod.Dataset;
27
27
  export const EnqueueStrategy = mod.EnqueueStrategy;
28
- export const ErrorSnapshotter = mod.ErrorSnapshotter;
29
28
  export const ErrorTracker = mod.ErrorTracker;
30
29
  export const EventLoopLoadSignal = mod.EventLoopLoadSignal;
31
30
  export const EventManager = mod.EventManager;
@@ -37,7 +36,6 @@ export const LogLevel = mod.LogLevel;
37
36
  export const Logger = mod.Logger;
38
37
  export const LoggerJson = mod.LoggerJson;
39
38
  export const LoggerText = mod.LoggerText;
40
- export const MAX_POOL_SIZE = mod.MAX_POOL_SIZE;
41
39
  export const MAX_QUERIES_FOR_CONSISTENCY = mod.MAX_QUERIES_FOR_CONSISTENCY;
42
40
  export const MemoryLoadSignal = mod.MemoryLoadSignal;
43
41
  export const MemoryStorageBackend = mod.MemoryStorageBackend;
@@ -46,7 +44,6 @@ export const MissingSessionError = mod.MissingSessionError;
46
44
  export const NavigationSkippedError = mod.NavigationSkippedError;
47
45
  export const NonRetryableError = mod.NonRetryableError;
48
46
  export const OwnedOrInjected = mod.OwnedOrInjected;
49
- export const PERSIST_STATE_KEY = mod.PERSIST_STATE_KEY;
50
47
  export const PersistentRateLimitError = mod.PersistentRateLimitError;
51
48
  export const ProxyConfiguration = mod.ProxyConfiguration;
52
49
  export const QUERY_HEAD_BUFFER = mod.QUERY_HEAD_BUFFER;
@@ -78,13 +75,11 @@ export const StateValidationError = mod.StateValidationError;
78
75
  export const Statistics = mod.Statistics;
79
76
  export const StorageBackendLoadSignal = mod.StorageBackendLoadSignal;
80
77
  export const StorageInstanceManager = mod.StorageInstanceManager;
81
- export const StorageStatsTracker = mod.StorageStatsTracker;
82
78
  export const StorageTransaction = mod.StorageTransaction;
83
79
  export const SystemStatus = mod.SystemStatus;
84
80
  export const ThrottlingRequestManager = mod.ThrottlingRequestManager;
85
81
  export const activeStorageTransaction = mod.activeStorageTransaction;
86
82
  export const applyRequestTransform = mod.applyRequestTransform;
87
- export const assertBrowserPoolNotConfigured = mod.assertBrowserPoolNotConfigured;
88
83
  export const assertJsonSerializable = mod.assertJsonSerializable;
89
84
  export const bindMethodsToServiceLocator = mod.bindMethodsToServiceLocator;
90
85
  export const browserPoolCookieToToughCookie = mod.browserPoolCookieToToughCookie;
@@ -128,13 +123,11 @@ export const rejectOperationInTransaction = mod.rejectOperationInTransaction;
128
123
  export const remainingNavigationWindowMillis = mod.remainingNavigationWindowMillis;
129
124
  export const remoteStagehandBrowserPool = mod.remoteStagehandBrowserPool;
130
125
  export const resolveBaseUrlForEnqueueLinksFiltering = mod.resolveBaseUrlForEnqueueLinksFiltering;
131
- export const resolveStorageIdentifier = mod.resolveStorageIdentifier;
132
126
  export const serializeArray = mod.serializeArray;
133
127
  export const serializeValue = mod.serializeValue;
134
128
  export const serviceLocator = mod.serviceLocator;
135
129
  export const snapshotValue = mod.snapshotValue;
136
130
  export const stagehandBrowserPool = mod.stagehandBrowserPool;
137
- export const stagehandUtils = mod.stagehandUtils;
138
131
  export const toughCookieToBrowserPoolCookie = mod.toughCookieToBrowserPoolCookie;
139
132
  export const updateEnqueueLinksPatternCache = mod.updateEnqueueLinksPatternCache;
140
133
  export const urlPatternSchema = mod.urlPatternSchema;
@@ -1,9 +1,9 @@
1
1
  import type { Action, ActOptions, ActResult, AgentConfig, ExtractOptions, LLMClient, ModelConfiguration, NonStreamingAgentInstance, ObserveOptions, Stagehand, StreamingAgentInstance } from '@browserbasehq/stagehand';
2
- import type { BrowserCrawlerOptions, BrowserCrawlingContext, BrowserHook, ContextPipeline, CrawlingContext, GetUserDataFromRequest, LoadedContext, RequestHandler, RouterHandler, RouterRoutes, RouteSchemas, RoutesFromSchemas } from '@crawlee/browser';
2
+ import type { BrowserCrawlerOptions, BrowserCrawlingContext, BrowserHook, GetUserDataFromRequest, RequestHandler, RouterHandler, RouterRoutes, RouteSchemas, RoutesFromSchemas } from '@crawlee/browser';
3
3
  import { BrowserCrawler } from '@crawlee/browser';
4
4
  import type { Dictionary } from '@crawlee/types';
5
5
  // @ts-ignore optional peer dependency or compatibility with es2022
6
- import type { LaunchOptions, Page, Response } from 'playwright';
6
+ import type { Page, Response } from 'playwright';
7
7
  import { z } from 'zod';
8
8
  import type { StagehandLaunchContext } from './stagehand-launcher';
9
9
  /**
@@ -187,11 +187,6 @@ export interface StagehandCrawlingContext<UserData extends Dictionary = any> ext
187
187
  * Hook function for StagehandCrawler.
188
188
  */
189
189
  export type StagehandHook<UserData extends Dictionary = any> = BrowserHook<StagehandCrawlingContext<UserData>>;
190
- /**
191
- * Request handler for StagehandCrawler.
192
- */
193
- export interface StagehandRequestHandler extends RequestHandler<LoadedContext<StagehandCrawlingContext>> {
194
- }
195
190
  /**
196
191
  * Options for StagehandCrawler.
197
192
  */
@@ -313,7 +308,8 @@ export interface StagehandCrawlerOptions<ContextExtension = Dictionary<never>, E
313
308
  * await crawler.run(['https://example.com']);
314
309
  * ```
315
310
  */
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> {
311
+ 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, StagehandCrawlingContext, ContextExtension, ExtendedContext, Routes, StatisticStateExtension> {
312
+ #private;
317
313
  /**
318
314
  * @internal
319
315
  */
@@ -366,7 +362,6 @@ export declare class StagehandCrawler<ContextExtension = Dictionary<never>, Exte
366
362
  navigationTimeoutSecs: z.ZodDefault<z.ZodCustom<number, number>>;
367
363
  preNavigationHooks: z.ZodDefault<z.ZodCustom<unknown[], unknown[]>>;
368
364
  postNavigationHooks: z.ZodDefault<z.ZodCustom<unknown[], unknown[]>>;
369
- launchContext: z.ZodDefault<z.ZodCustom<Dictionary, Dictionary>>;
370
365
  browserPool: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
371
366
  browserPoolBuilder: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
372
367
  remoteBrowser: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
@@ -374,6 +369,7 @@ export declare class StagehandCrawler<ContextExtension = Dictionary<never>, Exte
374
369
  proxyConfiguration: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
375
370
  ignoreIframes: z.ZodDefault<z.ZodBoolean>;
376
371
  ignoreShadowRoots: z.ZodDefault<z.ZodBoolean>;
372
+ launchContext: z.ZodDefault<z.ZodCustom<Dictionary, Dictionary>>;
377
373
  stagehandOptions: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
378
374
  headless: z.ZodOptional<z.ZodBoolean>;
379
375
  };
@@ -427,7 +423,6 @@ export declare class StagehandCrawler<ContextExtension = Dictionary<never>, Exte
427
423
  navigationTimeoutSecs: z.ZodDefault<z.ZodCustom<number, number>>;
428
424
  preNavigationHooks: z.ZodDefault<z.ZodCustom<unknown[], unknown[]>>;
429
425
  postNavigationHooks: z.ZodDefault<z.ZodCustom<unknown[], unknown[]>>;
430
- launchContext: z.ZodDefault<z.ZodCustom<Dictionary, Dictionary>>;
431
426
  browserPool: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
432
427
  browserPoolBuilder: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
433
428
  remoteBrowser: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
@@ -435,6 +430,7 @@ export declare class StagehandCrawler<ContextExtension = Dictionary<never>, Exte
435
430
  proxyConfiguration: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
436
431
  ignoreIframes: z.ZodDefault<z.ZodBoolean>;
437
432
  ignoreShadowRoots: z.ZodDefault<z.ZodBoolean>;
433
+ launchContext: z.ZodDefault<z.ZodCustom<Dictionary, Dictionary>>;
438
434
  stagehandOptions: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
439
435
  headless: z.ZodOptional<z.ZodBoolean>;
440
436
  }, z.core.$strict>;
@@ -444,7 +440,6 @@ export declare class StagehandCrawler<ContextExtension = Dictionary<never>, Exte
444
440
  * @param options - Crawler configuration options
445
441
  */
446
442
  constructor(options?: StagehandCrawlerOptions<ContextExtension, ExtendedContext, Routes, StatisticStateExtension>);
447
- protected buildContextPipeline(): ContextPipeline<CrawlingContext, StagehandCrawlingContext>;
448
443
  /**
449
444
  * Resolves the {@link StagehandController} that owns the given page, or
450
445
  * `undefined` when the pool does not expose controllers (e.g. a custom
@@ -62,6 +62,7 @@ class StagehandCrawler extends browser_1.BrowserCrawler {
62
62
  */
63
63
  static optionsShape = {
64
64
  ...browser_1.BrowserCrawler.optionsShape,
65
+ launchContext: internal_1.schemas.anyObject.default(() => ({})),
65
66
  stagehandOptions: internal_1.schemas.anyObject.optional(),
66
67
  headless: zod_1.z.boolean().optional(),
67
68
  };
@@ -74,10 +75,10 @@ class StagehandCrawler extends browser_1.BrowserCrawler {
74
75
  */
75
76
  constructor(options = {}) {
76
77
  const parsedOptions = (0, internal_1.parseArgument)(options, StagehandCrawler.optionsSchema, 'StagehandCrawlerOptions');
77
- const { stagehandOptions, launchContext, headless, configuration, contextPipelineBuilder, ...browserCrawlerOptions } = parsedOptions;
78
+ const { stagehandOptions, launchContext, headless, configuration, ...browserCrawlerOptions } = parsedOptions;
78
79
  if (options.browserPool) {
79
80
  // The raw options, not the parsed ones: `launchContext` has a default, so by now it is always set.
80
- (0, browser_1.assertBrowserPoolNotConfigured)(new.target.name, {
81
+ (0, internal_1.assertBrowserPoolNotConfigured)(new.target.name, {
81
82
  launchContext: options.launchContext,
82
83
  stagehandOptions: options.stagehandOptions,
83
84
  headless: options.headless,
@@ -85,7 +86,6 @@ class StagehandCrawler extends browser_1.BrowserCrawler {
85
86
  }
86
87
  super({
87
88
  ...browserCrawlerOptions,
88
- launchContext,
89
89
  configuration,
90
90
  // The pool serves plain Playwright pages - a page only becomes a `StagehandPage` further down the
91
91
  // pipeline, once `setUpStagehand` enhances it - so its page type is narrower than the crawler's.
@@ -103,11 +103,11 @@ class StagehandCrawler extends browser_1.BrowserCrawler {
103
103
  headless,
104
104
  configuration,
105
105
  })),
106
- contextPipelineBuilder: contextPipelineBuilder ?? (() => this.buildContextPipeline()),
106
+ contextPipelineBuilder: () => this.#buildContextPipeline(),
107
107
  });
108
108
  }
109
- buildContextPipeline() {
110
- return super.buildContextPipeline().compose(this.setUpStagehand.bind(this));
109
+ #buildContextPipeline() {
110
+ return this.buildContextPipeline().compose(this.setUpStagehand.bind(this));
111
111
  }
112
112
  /**
113
113
  * Resolves the {@link StagehandController} that owns the given page, or
@@ -14,10 +14,6 @@ export interface StagehandLaunchContext extends BrowserLaunchContext<LaunchOptio
14
14
  * These will be passed to Stagehand's localBrowserLaunchOptions after fingerprinting is applied.
15
15
  */
16
16
  launchOptions?: LaunchOptions & Parameters<BrowserType['launchPersistentContext']>[1];
17
- /**
18
- * Stagehand-specific configuration for AI operations.
19
- */
20
- stagehandOptions?: StagehandOptions;
21
17
  /**
22
18
  * URL to a HTTP proxy server. It must define the port number,
23
19
  * and it may also contain proxy username and password.
@@ -32,21 +28,6 @@ export interface StagehandLaunchContext extends BrowserLaunchContext<LaunchOptio
32
28
  * @default false
33
29
  */
34
30
  useChrome?: boolean;
35
- /**
36
- * With this option selected, all pages will be opened in a new incognito browser context.
37
- * @default false
38
- */
39
- useIncognitoPages?: boolean;
40
- /**
41
- * Sets the User Data Directory path.
42
- * The user data directory contains profile data such as history, bookmarks, and cookies.
43
- */
44
- userDataDir?: string;
45
- /**
46
- * By default this function uses `require("playwright").chromium`.
47
- * If you want to use a different browser you can pass it by this property.
48
- */
49
- launcher?: BrowserType;
50
31
  }
51
32
  /**
52
33
  * StagehandLauncher is based on BrowserLauncher and creates StagehandPlugin instances.
@@ -98,7 +79,9 @@ export declare class StagehandLauncher extends BrowserLauncher<StagehandPlugin>
98
79
  /**
99
80
  * All StagehandLauncher parameters are passed via the launchContext object.
100
81
  */
101
- constructor(launchContext?: StagehandLaunchContext, configuration?: Configuration);
82
+ constructor(launchContext?: StagehandLaunchContext & {
83
+ stagehandOptions?: StagehandOptions;
84
+ }, configuration?: Configuration);
102
85
  /**
103
86
  * Creates a new StagehandPlugin instance with resolved options.
104
87
  */
@@ -29,7 +29,10 @@ class StagehandLauncher extends browser_1.BrowserLauncher {
29
29
  /**
30
30
  * All StagehandLauncher parameters are passed via the launchContext object.
31
31
  */
32
- constructor(launchContext = {}, configuration = browser_1.Configuration.getGlobalConfiguration()) {
32
+ constructor(
33
+ // `stagehandOptions` is not part of the public `StagehandLaunchContext`: it is how
34
+ // `stagehandBrowserPool()` threads the crawler's resolved Stagehand options through the launcher.
35
+ launchContext = {}, configuration = browser_1.Configuration.getGlobalConfiguration()) {
33
36
  const parsedContext = (0, internal_1.parseArgument)(launchContext, StagehandLauncher.optionsSchema, 'StagehandLaunchContext');
34
37
  const { launcher = browser_1.BrowserLauncher.requireLauncherOrThrow('playwright', 'apify/actor-node-playwright-*').chromium, stagehandOptions = {}, } = parsedContext;
35
38
  const { launchOptions = {}, ...rest } = parsedContext;
@@ -1,4 +1,3 @@
1
- import type { Stagehand } from '@browserbasehq/stagehand';
2
1
  import type { BrowserController, BrowserPluginOptions, LaunchContext } from '@crawlee/browser-pool';
3
2
  import { BrowserPlugin } from '@crawlee/browser-pool';
4
3
  // @ts-ignore optional peer dependency or compatibility with es2022
@@ -28,7 +27,6 @@ export interface StagehandPluginOptions extends BrowserPluginOptions<LaunchOptio
28
27
  */
29
28
  export declare class StagehandPlugin extends BrowserPlugin<BrowserType, LaunchOptions, PlaywrightBrowser> {
30
29
  #private;
31
- readonly stagehandOptions: StagehandOptions;
32
30
  constructor(library: BrowserType, options?: StagehandPluginOptions);
33
31
  /**
34
32
  * Launches a browser using Stagehand and connects Playwright to it via CDP.
@@ -54,8 +52,4 @@ export declare class StagehandPlugin extends BrowserPlugin<BrowserType, LaunchOp
54
52
  * Augments launch errors with helpful context.
55
53
  */
56
54
  private augmentLaunchError;
57
- /**
58
- * Gets the Stagehand instance for a given browser.
59
- */
60
- getStagehandForBrowser(browser: PlaywrightBrowser): Stagehand | undefined;
61
55
  }
@@ -21,11 +21,11 @@ const stagehand_controller_1 = require("./stagehand-controller");
21
21
  * - Some fingerprinting options may not be fully applied (Stagehand controls browser launch)
22
22
  */
23
23
  class StagehandPlugin extends browser_pool_1.BrowserPlugin {
24
- stagehandOptions;
24
+ #stagehandOptions;
25
25
  #stagehandInstances = new WeakMap();
26
26
  constructor(library, options = {}) {
27
27
  super(library, options);
28
- this.stagehandOptions = options.stagehandOptions ?? {};
28
+ this.#stagehandOptions = options.stagehandOptions ?? {};
29
29
  }
30
30
  /**
31
31
  * Launches a browser using Stagehand and connects Playwright to it via CDP.
@@ -34,26 +34,26 @@ class StagehandPlugin extends browser_pool_1.BrowserPlugin {
34
34
  const { launchOptions = {}, proxyUrl } = launchContext;
35
35
  // Import Stagehand dynamically to avoid peer dependency issues
36
36
  const { Stagehand } = await import('@browserbasehq/stagehand');
37
- const isLocal = this.stagehandOptions.env === 'LOCAL' || !this.stagehandOptions.env;
37
+ const isLocal = this.#stagehandOptions.env === 'LOCAL' || !this.#stagehandOptions.env;
38
38
  // Use anonymizeProxy to handle proxy authentication transparently
39
39
  const [anonymizedProxyUrl, closeAnonymizedProxy] = await (0, browser_pool_1.anonymizeProxySugar)(proxyUrl, undefined, undefined, {
40
40
  ignoreProxyCertificate: launchContext.ignoreProxyCertificate,
41
41
  });
42
42
  // Build model configuration
43
43
  // For LOCAL env, we merge apiKey into the model config since Stagehand expects it there
44
- let modelConfig = this.stagehandOptions.model;
45
- if (isLocal && this.stagehandOptions.apiKey) {
44
+ let modelConfig = this.#stagehandOptions.model;
45
+ if (isLocal && this.#stagehandOptions.apiKey) {
46
46
  const modelName = typeof modelConfig === 'string' ? modelConfig : modelConfig?.modelName;
47
47
  modelConfig = {
48
48
  ...(typeof modelConfig === 'object' ? modelConfig : {}),
49
49
  ...(modelName ? { modelName } : {}),
50
- apiKey: this.stagehandOptions.apiKey,
50
+ apiKey: this.#stagehandOptions.apiKey,
51
51
  };
52
52
  }
53
53
  // Build Stagehand configuration by spreading our options and adding launch options
54
54
  const stagehandConfig = {
55
- ...this.stagehandOptions,
56
- env: this.stagehandOptions.env ?? 'LOCAL',
55
+ ...this.#stagehandOptions,
56
+ env: this.#stagehandOptions.env ?? 'LOCAL',
57
57
  model: modelConfig,
58
58
  localBrowserLaunchOptions: isLocal
59
59
  ? {
@@ -141,7 +141,7 @@ class StagehandPlugin extends browser_pool_1.BrowserPlugin {
141
141
  */
142
142
  augmentLaunchError(error, launchContext) {
143
143
  const message = error instanceof Error ? error.message : String(error);
144
- const model = this.stagehandOptions.model;
144
+ const model = this.#stagehandOptions.model;
145
145
  let helpText = '';
146
146
  if (typeof model === 'string') {
147
147
  const modelStr = model.toLowerCase();
@@ -159,11 +159,5 @@ class StagehandPlugin extends browser_pool_1.BrowserPlugin {
159
159
  `Executable path: ${launchContext.launchOptions?.executablePath ?? 'default'}\n` +
160
160
  `Model: ${model}${helpText}`, { cause: error });
161
161
  }
162
- /**
163
- * Gets the Stagehand instance for a given browser.
164
- */
165
- getStagehandForBrowser(browser) {
166
- return this.#stagehandInstances.get(browser);
167
- }
168
162
  }
169
163
  exports.StagehandPlugin = StagehandPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/stagehand",
3
- "version": "4.0.0-beta.198",
3
+ "version": "4.0.0-beta.200",
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": "^1.0.1",
60
- "@crawlee/browser": "4.0.0-beta.198",
61
- "@crawlee/browser-pool": "4.0.0-beta.198",
62
- "@crawlee/core": "4.0.0-beta.198",
63
- "@crawlee/types": "4.0.0-beta.198",
64
- "@crawlee/utils": "4.0.0-beta.198",
60
+ "@crawlee/browser": "4.0.0-beta.200",
61
+ "@crawlee/browser-pool": "4.0.0-beta.200",
62
+ "@crawlee/core": "4.0.0-beta.200",
63
+ "@crawlee/types": "4.0.0-beta.200",
64
+ "@crawlee/utils": "4.0.0-beta.200",
65
65
  "tslib": "^2.8.1",
66
66
  "zod": "^4.5.4"
67
67
  },
@@ -88,5 +88,5 @@
88
88
  }
89
89
  }
90
90
  },
91
- "gitHead": "889cfffcc20b2803f0d95d7cb006ad1e7f672452"
91
+ "gitHead": "471663956b78edb995e824dd906776a28cc04535"
92
92
  }