@crawlee/stagehand 4.0.0-beta.223 → 4.0.0-beta.224

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
@@ -51,8 +51,8 @@
51
51
  */
52
52
  export * from '@crawlee/browser';
53
53
  export { StagehandCrawler, createStagehandRouter } from './internals/stagehand-crawler';
54
- export { stagehandBrowserPool, remoteStagehandBrowserPool } from './internals/stagehand-browser-pool';
55
- export type { StagehandBrowserPool, StagehandBrowserPoolOptions, RemoteStagehandBrowserPoolOptions, } from './internals/stagehand-browser-pool';
54
+ export { stagehandBrowserPool } from './internals/stagehand-browser-pool';
55
+ export type { StagehandBrowserPool, StagehandBrowserPoolOptions } from './internals/stagehand-browser-pool';
56
56
  export type { StagehandOptions, StagehandPage, StagehandCrawlingContext, StagehandHook, StagehandGotoOptions, StagehandCrawlerOptions, } from './internals/stagehand-crawler';
57
57
  export type { StagehandLaunchContext } from './internals/stagehand-launcher';
58
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.remoteStagehandBrowserPool = exports.stagehandBrowserPool = exports.createStagehandRouter = exports.StagehandCrawler = void 0;
54
+ 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);
@@ -62,4 +62,3 @@ Object.defineProperty(exports, "createStagehandRouter", { enumerable: true, get:
62
62
  // Export the browser pool factories, which are how a pool with non-default options reaches the crawler
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
- Object.defineProperty(exports, "remoteStagehandBrowserPool", { enumerable: true, get: function () { return stagehand_browser_pool_1.remoteStagehandBrowserPool; } });
package/index.mjs CHANGED
@@ -123,7 +123,6 @@ export const parseValue = mod.parseValue;
123
123
  export const purgeDefaultStorages = mod.purgeDefaultStorages;
124
124
  export const rejectOperationInTransaction = mod.rejectOperationInTransaction;
125
125
  export const remainingNavigationWindowMillis = mod.remainingNavigationWindowMillis;
126
- export const remoteStagehandBrowserPool = mod.remoteStagehandBrowserPool;
127
126
  export const resolveBaseUrlForEnqueueLinksFiltering = mod.resolveBaseUrlForEnqueueLinksFiltering;
128
127
  export const serializeArray = mod.serializeArray;
129
128
  export const serializeValue = mod.serializeValue;
@@ -1,5 +1,5 @@
1
1
  import type { Configuration } from '@crawlee/browser';
2
- import type { BrowserPool, BrowserPoolHooks, BrowserPoolOptions, RemoteBrowserPool, RemoteBrowserPoolOptions } from '@crawlee/browser-pool';
2
+ import type { BrowserPool, BrowserPoolHooks, BrowserPoolOptions } from '@crawlee/browser-pool';
3
3
  // @ts-ignore optional peer dependency or compatibility with es2022
4
4
  import type { Page } from 'playwright';
5
5
  import type { StagehandOptions } from './stagehand-crawler';
@@ -22,8 +22,6 @@ export interface StagehandBrowserPoolOptions extends Omit<BrowserPoolOptions, 'b
22
22
  /** Configuration to read the browser defaults from. Defaults to the global configuration. */
23
23
  configuration?: Configuration;
24
24
  }
25
- export interface RemoteStagehandBrowserPoolOptions extends Pick<StagehandBrowserPoolOptions, 'launchContext' | 'stagehandOptions' | 'headless' | 'configuration'>, Omit<RemoteBrowserPoolOptions, 'browserPlugins'> {
26
- }
27
25
  /**
28
26
  * Builds a {@link BrowserPool} of Stagehand browsers to pass to a {@link StagehandCrawler} as its
29
27
  * {@link BrowserCrawlerOptions.browserPool|`browserPool`}.
@@ -50,14 +48,3 @@ export interface RemoteStagehandBrowserPoolOptions extends Pick<StagehandBrowser
50
48
  * @category Browser management
51
49
  */
52
50
  export declare function stagehandBrowserPool(options?: StagehandBrowserPoolOptions): StagehandBrowserPool;
53
- /**
54
- * The {@link RemoteBrowserPool} counterpart of {@link stagehandBrowserPool}: connects to a remote browser
55
- * service with a Stagehand plugin derived from `launchContext` and `stagehandOptions`.
56
- *
57
- * A {@link StagehandCrawler} accepts the same connection details directly via
58
- * {@link BrowserCrawlerOptions.remoteBrowser|`remoteBrowser`}; reach for this factory when you also need to
59
- * tune the wrapping pool, or to share one remote pool between crawlers.
60
- *
61
- * @category Browser management
62
- */
63
- export declare function remoteStagehandBrowserPool(options: RemoteStagehandBrowserPoolOptions): RemoteBrowserPool<Page>;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stagehandBrowserPool = stagehandBrowserPool;
4
- exports.remoteStagehandBrowserPool = remoteStagehandBrowserPool;
5
4
  const stagehand_launcher_1 = require("./stagehand-launcher");
6
5
  /**
7
6
  * Builds a {@link BrowserPool} of Stagehand browsers to pass to a {@link StagehandCrawler} as its
@@ -32,20 +31,6 @@ function stagehandBrowserPool(options = {}) {
32
31
  const { launchContext, stagehandOptions, headless, configuration, ...poolOptions } = options;
33
32
  return stagehandLauncher(launchContext, stagehandOptions, headless, configuration).createBrowserPool(poolOptions);
34
33
  }
35
- /**
36
- * The {@link RemoteBrowserPool} counterpart of {@link stagehandBrowserPool}: connects to a remote browser
37
- * service with a Stagehand plugin derived from `launchContext` and `stagehandOptions`.
38
- *
39
- * A {@link StagehandCrawler} accepts the same connection details directly via
40
- * {@link BrowserCrawlerOptions.remoteBrowser|`remoteBrowser`}; reach for this factory when you also need to
41
- * tune the wrapping pool, or to share one remote pool between crawlers.
42
- *
43
- * @category Browser management
44
- */
45
- function remoteStagehandBrowserPool(options) {
46
- const { launchContext, stagehandOptions, headless, configuration, ...remoteOptions } = options;
47
- return stagehandLauncher(launchContext, stagehandOptions, headless, configuration).createRemoteBrowserPool(remoteOptions);
48
- }
49
34
  function stagehandLauncher(launchContext = {}, stagehandOptions = {}, headless, configuration) {
50
35
  return new stagehand_launcher_1.StagehandLauncher({
51
36
  ...launchContext,
@@ -89,20 +89,19 @@ class StagehandCrawler extends browser_1.BrowserCrawler {
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.
92
- browserPoolBuilder: (remoteBrowser) => (remoteBrowser
93
- ? (0, stagehand_browser_pool_1.remoteStagehandBrowserPool)({
94
- ...remoteBrowser,
92
+ browserPoolBuilder: (remoteBrowser) => {
93
+ // Stagehand manages its own browser (local or Browserbase), so a Crawlee-level remote connection
94
+ // would be silently ignored.
95
+ if (remoteBrowser) {
96
+ throw new Error('StagehandCrawler does not support `remoteBrowser`. Use `stagehandOptions.env: "BROWSERBASE"` instead.');
97
+ }
98
+ return (0, stagehand_browser_pool_1.stagehandBrowserPool)({
95
99
  launchContext,
96
100
  stagehandOptions,
97
101
  headless,
98
102
  configuration,
99
- })
100
- : (0, stagehand_browser_pool_1.stagehandBrowserPool)({
101
- launchContext,
102
- stagehandOptions,
103
- headless,
104
- configuration,
105
- })),
103
+ });
104
+ },
106
105
  contextPipelineBuilder: () => this.#buildContextPipeline(),
107
106
  });
108
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/stagehand",
3
- "version": "4.0.0-beta.223",
3
+ "version": "4.0.0-beta.224",
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-beta.223",
60
- "@crawlee/browser-pool": "4.0.0-beta.223",
61
- "@crawlee/core": "4.0.0-beta.223",
62
- "@crawlee/types": "4.0.0-beta.223",
63
- "@crawlee/utils": "4.0.0-beta.223",
59
+ "@crawlee/browser": "4.0.0-beta.224",
60
+ "@crawlee/browser-pool": "4.0.0-beta.224",
61
+ "@crawlee/core": "4.0.0-beta.224",
62
+ "@crawlee/types": "4.0.0-beta.224",
63
+ "@crawlee/utils": "4.0.0-beta.224",
64
64
  "tslib": "^2.8.1",
65
65
  "zod": "^4.5.4"
66
66
  },
@@ -87,5 +87,5 @@
87
87
  }
88
88
  }
89
89
  },
90
- "gitHead": "cfcbcbebeabd9ca2dfd7a17afe559db16307250d"
90
+ "gitHead": "669f726126327dee3b1d6b950663fd4fceace651"
91
91
  }