@crawlee/stagehand 3.17.1-beta.21 → 3.17.1-beta.23

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.
@@ -1,5 +1,5 @@
1
1
  import type { Action, ActOptions, ActResult, AgentConfig, ExtractOptions, LLMClient, ModelConfiguration, NonStreamingAgentInstance, ObserveOptions, Stagehand, StreamingAgentInstance } from '@browserbasehq/stagehand';
2
- import type { BrowserCrawlerOptions, BrowserCrawlingContext, BrowserHook, BrowserRequestHandler, GetUserDataFromRequest, LoadedContext, RouterRoutes } from '@crawlee/browser';
2
+ import type { BrowserCrawlerOptions, BrowserCrawlingContext, BrowserHook, BrowserRequestHandler, GetUserDataFromRequest, LoadedContext, RouterHandler, RouterRoutes } from '@crawlee/browser';
3
3
  import { BrowserCrawler, Configuration } from '@crawlee/browser';
4
4
  import type { Dictionary } from '@crawlee/types';
5
5
  // @ts-ignore optional peer dependency or compatibility with es2022
@@ -458,5 +458,5 @@ export declare class StagehandCrawler extends BrowserCrawler<{
458
458
  * });
459
459
  * ```
460
460
  */
461
- // @ts-ignore optional peer dependency or compatibility with es2022
462
- export declare function createStagehandRouter<Context extends StagehandCrawlingContext = StagehandCrawlingContext, UserData extends Dictionary = GetUserDataFromRequest<Context['request']>>(routes?: RouterRoutes<Context, UserData>): import("@crawlee/browser").RouterHandler<Context>;
461
+ export declare function createStagehandRouter<Context extends StagehandCrawlingContext = StagehandCrawlingContext, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<Context['request']>>>(routes?: RouterRoutes<Context, Routes>): RouterHandler<Context, Routes>;
462
+ export declare function createStagehandRouter<Context extends StagehandCrawlingContext = StagehandCrawlingContext, UserData extends Dictionary = GetUserDataFromRequest<Context['request']>>(routes?: RouterRoutes<Context, Record<string, UserData>>): RouterHandler<Context, Record<string, UserData>>;
@@ -144,30 +144,6 @@ Object.defineProperty(StagehandCrawler, "optionsShape", {
144
144
  browserPoolOptions: ow_1.default.optional.object,
145
145
  }
146
146
  });
147
- /**
148
- * Creates a new router for StagehandCrawler with type-safe route handlers.
149
- *
150
- * @param options - Router options
151
- * @returns Configured router instance
152
- *
153
- * @example
154
- * ```typescript
155
- * const router = createStagehandRouter();
156
- *
157
- * router.addHandler('product', async ({ page, request, log }) => {
158
- * log.info(`Processing product: ${request.url}`);
159
- * const data = await page.extract('Get product info', schema);
160
- * });
161
- *
162
- * router.addDefaultHandler(async ({ page, enqueueLinks }) => {
163
- * await enqueueLinks({ globs: ['https://example.com/products/*'] });
164
- * });
165
- *
166
- * const crawler = new StagehandCrawler({
167
- * requestHandler: router,
168
- * });
169
- * ```
170
- */
171
147
  function createStagehandRouter(routes) {
172
148
  return browser_1.Router.create(routes);
173
149
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/stagehand",
3
- "version": "3.17.1-beta.21",
3
+ "version": "3.17.1-beta.23",
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": ">=16.0.0"
@@ -58,11 +58,11 @@
58
58
  "dependencies": {
59
59
  "@apify/log": "^2.4.0",
60
60
  "@apify/timeout": "^0.3.1",
61
- "@crawlee/browser": "3.17.1-beta.21",
62
- "@crawlee/browser-pool": "3.17.1-beta.21",
63
- "@crawlee/core": "3.17.1-beta.21",
64
- "@crawlee/types": "3.17.1-beta.21",
65
- "@crawlee/utils": "3.17.1-beta.21",
61
+ "@crawlee/browser": "3.17.1-beta.23",
62
+ "@crawlee/browser-pool": "3.17.1-beta.23",
63
+ "@crawlee/core": "3.17.1-beta.23",
64
+ "@crawlee/types": "3.17.1-beta.23",
65
+ "@crawlee/utils": "3.17.1-beta.23",
66
66
  "ow": "^0.28.1",
67
67
  "tslib": "^2.4.0"
68
68
  },
@@ -94,5 +94,5 @@
94
94
  }
95
95
  }
96
96
  },
97
- "gitHead": "b315b66d9e3dffe8963cad291a85058ee0ef07c9"
97
+ "gitHead": "704d91af7d46c2efaf8bff883025e4a7d8ffd6d7"
98
98
  }