@mastra/stagehand 0.3.6 → 0.3.7-alpha.1
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/dist/index.cjs +14 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -27
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +13 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -28
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.d.cts
CHANGED
|
@@ -2,11 +2,10 @@ import { ModelConfiguration as ModelConfiguration$1, Stagehand } from "@browserb
|
|
|
2
2
|
import { BrowserConfig, BrowserRecordingOptions, BrowserState, BrowserTabState, BrowserToolError, KeyboardEventParams, MastraBrowser, MouseEventParams, ScreencastOptions, ScreencastStream, ThreadManager, ThreadManagerConfig, ThreadSession } from "@mastra/core/browser";
|
|
3
3
|
import { Tool } from "@mastra/core/tools";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
//#region src/schemas.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* stagehand_act - Perform an action using natural language
|
|
8
7
|
*/
|
|
9
|
-
declare const actInputSchema: z.ZodObject<{
|
|
8
|
+
export declare const actInputSchema: z.ZodObject<{
|
|
10
9
|
instruction: z.ZodString;
|
|
11
10
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
12
11
|
useVision: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -16,7 +15,7 @@ type ActInput = z.output<typeof actInputSchema>;
|
|
|
16
15
|
/**
|
|
17
16
|
* stagehand_extract - Extract structured data from a page
|
|
18
17
|
*/
|
|
19
|
-
declare const extractInputSchema: z.ZodObject<{
|
|
18
|
+
export declare const extractInputSchema: z.ZodObject<{
|
|
20
19
|
instruction: z.ZodString;
|
|
21
20
|
schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
22
21
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
@@ -25,7 +24,7 @@ type ExtractInput = z.output<typeof extractInputSchema>;
|
|
|
25
24
|
/**
|
|
26
25
|
* stagehand_observe - Discover actionable elements on a page
|
|
27
26
|
*/
|
|
28
|
-
declare const observeInputSchema: z.ZodObject<{
|
|
27
|
+
export declare const observeInputSchema: z.ZodObject<{
|
|
29
28
|
instruction: z.ZodOptional<z.ZodString>;
|
|
30
29
|
onlyVisible: z.ZodOptional<z.ZodBoolean>;
|
|
31
30
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
@@ -34,7 +33,7 @@ type ObserveInput = z.output<typeof observeInputSchema>;
|
|
|
34
33
|
/**
|
|
35
34
|
* stagehand_navigate - Navigate to a URL
|
|
36
35
|
*/
|
|
37
|
-
declare const navigateInputSchema: z.ZodObject<{
|
|
36
|
+
export declare const navigateInputSchema: z.ZodObject<{
|
|
38
37
|
url: z.ZodString;
|
|
39
38
|
waitUntil: z.ZodOptional<z.ZodEnum<{
|
|
40
39
|
domcontentloaded: "domcontentloaded";
|
|
@@ -46,12 +45,12 @@ type NavigateInput = z.output<typeof navigateInputSchema>;
|
|
|
46
45
|
/**
|
|
47
46
|
* stagehand_close - Close the browser
|
|
48
47
|
*/
|
|
49
|
-
declare const closeInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
48
|
+
export declare const closeInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
50
49
|
type CloseInput = z.output<typeof closeInputSchema>;
|
|
51
50
|
/**
|
|
52
51
|
* stagehand_tabs - Manage browser tabs
|
|
53
52
|
*/
|
|
54
|
-
declare const tabsInputSchema: z.ZodObject<{
|
|
53
|
+
export declare const tabsInputSchema: z.ZodObject<{
|
|
55
54
|
action: z.ZodEnum<{
|
|
56
55
|
close: "close";
|
|
57
56
|
list: "list";
|
|
@@ -69,7 +68,7 @@ declare const screenshotInputSchema: z.ZodObject<{
|
|
|
69
68
|
fullPage: z.ZodOptional<z.ZodBoolean>;
|
|
70
69
|
}, z.core.$strip>;
|
|
71
70
|
type ScreenshotInput = z.output<typeof screenshotInputSchema>;
|
|
72
|
-
declare const stagehandSchemas: {
|
|
71
|
+
export declare const stagehandSchemas: {
|
|
73
72
|
readonly act: z.ZodObject<{
|
|
74
73
|
instruction: z.ZodString;
|
|
75
74
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -109,8 +108,6 @@ declare const stagehandSchemas: {
|
|
|
109
108
|
fullPage: z.ZodOptional<z.ZodBoolean>;
|
|
110
109
|
}, z.core.$strip>;
|
|
111
110
|
};
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region src/thread-manager.d.ts
|
|
114
111
|
type V3 = Stagehand;
|
|
115
112
|
type V3Page$1 = NonNullable<ReturnType<NonNullable<Stagehand['context']>['activePage']>>;
|
|
116
113
|
/**
|
|
@@ -172,12 +169,10 @@ declare class StagehandThreadManager extends ThreadManager<V3> {
|
|
|
172
169
|
*/
|
|
173
170
|
destroyAllSessions(): Promise<void>;
|
|
174
171
|
}
|
|
175
|
-
//#endregion
|
|
176
|
-
//#region src/tools/constants.d.ts
|
|
177
172
|
/**
|
|
178
173
|
* Stagehand Tool Constants
|
|
179
174
|
*/
|
|
180
|
-
declare const STAGEHAND_TOOLS: {
|
|
175
|
+
export declare const STAGEHAND_TOOLS: {
|
|
181
176
|
readonly ACT: 'stagehand_act';
|
|
182
177
|
readonly EXTRACT: 'stagehand_extract';
|
|
183
178
|
readonly OBSERVE: 'stagehand_observe';
|
|
@@ -187,8 +182,6 @@ declare const STAGEHAND_TOOLS: {
|
|
|
187
182
|
readonly SCREENSHOT: 'stagehand_screenshot';
|
|
188
183
|
};
|
|
189
184
|
type StagehandToolName = (typeof STAGEHAND_TOOLS)[keyof typeof STAGEHAND_TOOLS];
|
|
190
|
-
//#endregion
|
|
191
|
-
//#region src/types.d.ts
|
|
192
185
|
/**
|
|
193
186
|
* Model configuration for Stagehand AI operations.
|
|
194
187
|
*/
|
|
@@ -202,7 +195,7 @@ type ModelConfiguration = ModelConfiguration$1;
|
|
|
202
195
|
* can reject a bad provider up front. Keep in sync with `AISDKProviders` in
|
|
203
196
|
* `@browserbasehq/stagehand`.
|
|
204
197
|
*/
|
|
205
|
-
declare const STAGEHAND_MODEL_PROVIDERS: readonly ['anthropic', 'azure', 'bedrock', 'cerebras', 'deepseek', 'gateway', 'google', 'groq', 'mistral', 'ollama', 'openai', 'perplexity', 'togetherai', 'vertex', 'xai'];
|
|
198
|
+
export declare const STAGEHAND_MODEL_PROVIDERS: readonly ['anthropic', 'azure', 'bedrock', 'cerebras', 'deepseek', 'gateway', 'google', 'groq', 'mistral', 'ollama', 'openai', 'perplexity', 'togetherai', 'vertex', 'xai'];
|
|
206
199
|
/**
|
|
207
200
|
* Stagehand-specific configuration fields.
|
|
208
201
|
*/
|
|
@@ -356,8 +349,6 @@ interface ObserveResult {
|
|
|
356
349
|
url?: string;
|
|
357
350
|
hint?: string;
|
|
358
351
|
}
|
|
359
|
-
//#endregion
|
|
360
|
-
//#region src/stagehand-browser.d.ts
|
|
361
352
|
type V3Page = NonNullable<ReturnType<NonNullable<Stagehand['context']>['activePage']>>;
|
|
362
353
|
/**
|
|
363
354
|
* StagehandBrowser - AI-powered browser using Stagehand v3
|
|
@@ -369,7 +360,7 @@ type V3Page = NonNullable<ReturnType<NonNullable<Stagehand['context']>['activePa
|
|
|
369
360
|
* - 'shared': All threads share the same Stagehand instance
|
|
370
361
|
* - 'thread': Each thread gets its own Stagehand instance (separate browser)
|
|
371
362
|
*/
|
|
372
|
-
declare class StagehandBrowser extends MastraBrowser {
|
|
363
|
+
export declare class StagehandBrowser extends MastraBrowser {
|
|
373
364
|
readonly id: string;
|
|
374
365
|
readonly name = "StagehandBrowser";
|
|
375
366
|
readonly provider = "browserbase/stagehand";
|
|
@@ -577,8 +568,6 @@ declare class StagehandBrowser extends MastraBrowser {
|
|
|
577
568
|
injectMouseEvent(event: MouseEventParams, threadId?: string): Promise<void>;
|
|
578
569
|
injectKeyboardEvent(event: KeyboardEventParams, threadId?: string): Promise<void>;
|
|
579
570
|
}
|
|
580
|
-
//#endregion
|
|
581
|
-
//#region src/utils.d.ts
|
|
582
571
|
/**
|
|
583
572
|
* Extract the Chrome process PID from a Stagehand instance.
|
|
584
573
|
*
|
|
@@ -588,14 +577,11 @@ declare class StagehandBrowser extends MastraBrowser {
|
|
|
588
577
|
*
|
|
589
578
|
* Returns undefined if the PID can't be found (e.g. BROWSERBASE env, not yet init'd).
|
|
590
579
|
*/
|
|
591
|
-
declare function getStagehandChromePid(stagehand: Stagehand): number | undefined;
|
|
592
|
-
//#endregion
|
|
593
|
-
//#region src/tools/index.d.ts
|
|
580
|
+
export declare function getStagehandChromePid(stagehand: Stagehand): number | undefined;
|
|
594
581
|
/**
|
|
595
582
|
* Creates all Stagehand tools bound to a StagehandBrowser instance.
|
|
596
583
|
* The browser is lazily initialized on first tool use.
|
|
597
584
|
*/
|
|
598
|
-
declare function createStagehandTools(browser: StagehandBrowser): Record<string, Tool<any, any>>;
|
|
599
|
-
|
|
600
|
-
export { type ActInput, type ActResult, type CloseInput, type ExtractInput, type ExtractResult, type ModelConfiguration, type NavigateInput, type ObserveInput, type ObserveResult, STAGEHAND_MODEL_PROVIDERS, STAGEHAND_TOOLS, type StagehandAction, StagehandBrowser, type StagehandBrowserConfig, type StagehandToolName, type TabsInput, actInputSchema, closeInputSchema, createStagehandTools, extractInputSchema, getStagehandChromePid, navigateInputSchema, observeInputSchema, stagehandSchemas, tabsInputSchema };
|
|
585
|
+
export declare function createStagehandTools(browser: StagehandBrowser): Record<string, Tool<any, any>>;
|
|
586
|
+
export type { ActInput, ActResult, CloseInput, ExtractInput, ExtractResult, ModelConfiguration, NavigateInput, ObserveInput, ObserveResult, StagehandAction, StagehandBrowserConfig, StagehandToolName, TabsInput };
|
|
601
587
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":["V3Page","StagehandModelConfiguration","BaseBrowserConfig"],"sources":["../src/schemas.ts","../src/thread-manager.ts","../src/tools/constants.ts","../src/types.ts","../src/stagehand-browser.ts","../src/utils.ts","../src/tools/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["V3Page","StagehandModelConfiguration","BaseBrowserConfig"],"sources":["../src/schemas.ts","../src/thread-manager.ts","../src/tools/constants.ts","../src/types.ts","../src/stagehand-browser.ts","../src/utils.ts","../src/tools/index.ts"],"mappings":";;;;;;;qBAgBa,gBAAc,EAAA;;;;;GAQzB,EAAA,KAAA;KACU,WAAW,EAAE,cAAc;;;;qBAK1B,oBAAkB,EAAA;;;;GAO7B,EAAA,KAAA;KACU,eAAe,EAAE,cAAc;;;;qBAK9B,oBAAkB,EAAA;;;;GAS7B,EAAA,KAAA;KACU,eAAe,EAAE,cAAc;;;;qBAS9B,qBAAmB,EAAA;;;;;;;GAM9B,EAAA,KAAA;KACU,gBAAgB,EAAE,cAAc;;;;qBAK/B,kBAAgB,EAAA,cAAA,EAAA,KAAA;KACjB,aAAa,EAAE,cAAc;;;;qBAK5B,iBAAe,EAAA;;;;;;;;;GAuBxB,EAAA,KAAA;KACQ,YAAY,EAAE,cAAc;;;;cAS3B,uBAAqB,EAAA;;GAKhC,EAAA,KAAA;KACU,kBAAkB,EAAE,cAAc;qBAMjC;WAEX,KAAG,EAAA;;;;;;WACH,SAAO,EAAA;;;;;WACP,SAAO,EAAA;;;;;WAEP,UAAQ,EAAA;;;;;;;;WACR,MAAI,EAAA;;;;;;;;;;WACJ,OAAK,EAAA,cAAA,EAAA,KAAA;WAEL,YAAU,EAAA;;;;KCvHP,KAAK;KACLA,WAAS,YAAY,WAAW,YAAY;;;;UAKhC,+BAA+B;;EAE9C,YAAY;;;;;UAMG,qCAAqC;;EAEpD,wBAAwB,QAAQ;;EAEhC,oBAAoB,WAAW,IAAI;;;;;;;;;cAUxB,+BAA+B,cAAc;YACrC,UAAU,YAAY;UACjC;UACA;EAER,YAAY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,QAAQ;;;;;;;UA6B9C;;;;;;UAeA;;;;YAuCQ,cAAc,oBAAoB,QAAQ;;;;UAOlD;EAoBC,YAAY,eAAe;;;;;;EAwB9B,IACJ,OAAO,UACP,oBACC;IAAU;IAAe;IAAkB;IAAiB;IAAa;MAAiB;;;;;;EA+BvF,QACJ,OAAO,cACP,oBACC;IAAU;IAAe;IAAe;IAAa;MAAiB;;;;;;EA6BnE,QACJ,OAAO,cACP,oBACC;IAAU;IAAe,SAAS;IAAmB;IAAa;MAAiB;;;;;;EAyChF,SACJ,OAAO,eACP,oBACC;IAAU;IAAe;IAAa;IAAe;MAAiB;;;;;;EAmCnE,WACJ,OAAO,iBACP,oBACC;IAAU;IAAgB;IAAa;MAAkB;;;;;;EA+BtD,KACJ,OAAO,WACP,oBACC;IACG;IAAe,OAAO;MAAQ;MAAe;MAAa;MAAe;;IAAoB;;IAC7F;IAAe;IAAgB;IAAc;IAAgB;IAAoB;MACnF;EA0HW,cAAc,oBAAoB;;;;EAoDlC,WAAW,cAAc;;;;EAiBzB,gBAAgB,oBAAoB,QAAQ;;;;;YAwBjD,yBAAyB,oBAAoB;;;;UAS/C;;;;EA6BO,YAAY,oBAAoB,QAAQ;;;;EAQxC,kBAAkB,oBAAoB;EAUtC,gBAAgB,UAAU,oBAAoB,QAAQ;;;;;UAsDvD;EA+PC,iBAAiB,OAAO,kBAAkB,oBAAoB;EAkC9D,oBAAoB,OAAO,qBAAqB,oBAAoB;;;;;;;;;;;wBCzzCrE,sBAAsB,WAAW;;;;;wBCjBjC,qBAAqB,SAAS,mBAAmB,eAAe"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,10 @@ import { ModelConfiguration as ModelConfiguration$1, Stagehand } from "@browserb
|
|
|
2
2
|
import { BrowserConfig, BrowserRecordingOptions, BrowserState, BrowserTabState, BrowserToolError, KeyboardEventParams, MastraBrowser, MouseEventParams, ScreencastOptions, ScreencastStream, ThreadManager, ThreadManagerConfig, ThreadSession } from "@mastra/core/browser";
|
|
3
3
|
import { Tool } from "@mastra/core/tools";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
//#region src/schemas.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* stagehand_act - Perform an action using natural language
|
|
8
7
|
*/
|
|
9
|
-
declare const actInputSchema: z.ZodObject<{
|
|
8
|
+
export declare const actInputSchema: z.ZodObject<{
|
|
10
9
|
instruction: z.ZodString;
|
|
11
10
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
12
11
|
useVision: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -16,7 +15,7 @@ type ActInput = z.output<typeof actInputSchema>;
|
|
|
16
15
|
/**
|
|
17
16
|
* stagehand_extract - Extract structured data from a page
|
|
18
17
|
*/
|
|
19
|
-
declare const extractInputSchema: z.ZodObject<{
|
|
18
|
+
export declare const extractInputSchema: z.ZodObject<{
|
|
20
19
|
instruction: z.ZodString;
|
|
21
20
|
schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
22
21
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
@@ -25,7 +24,7 @@ type ExtractInput = z.output<typeof extractInputSchema>;
|
|
|
25
24
|
/**
|
|
26
25
|
* stagehand_observe - Discover actionable elements on a page
|
|
27
26
|
*/
|
|
28
|
-
declare const observeInputSchema: z.ZodObject<{
|
|
27
|
+
export declare const observeInputSchema: z.ZodObject<{
|
|
29
28
|
instruction: z.ZodOptional<z.ZodString>;
|
|
30
29
|
onlyVisible: z.ZodOptional<z.ZodBoolean>;
|
|
31
30
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
@@ -34,7 +33,7 @@ type ObserveInput = z.output<typeof observeInputSchema>;
|
|
|
34
33
|
/**
|
|
35
34
|
* stagehand_navigate - Navigate to a URL
|
|
36
35
|
*/
|
|
37
|
-
declare const navigateInputSchema: z.ZodObject<{
|
|
36
|
+
export declare const navigateInputSchema: z.ZodObject<{
|
|
38
37
|
url: z.ZodString;
|
|
39
38
|
waitUntil: z.ZodOptional<z.ZodEnum<{
|
|
40
39
|
domcontentloaded: "domcontentloaded";
|
|
@@ -46,12 +45,12 @@ type NavigateInput = z.output<typeof navigateInputSchema>;
|
|
|
46
45
|
/**
|
|
47
46
|
* stagehand_close - Close the browser
|
|
48
47
|
*/
|
|
49
|
-
declare const closeInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
48
|
+
export declare const closeInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
50
49
|
type CloseInput = z.output<typeof closeInputSchema>;
|
|
51
50
|
/**
|
|
52
51
|
* stagehand_tabs - Manage browser tabs
|
|
53
52
|
*/
|
|
54
|
-
declare const tabsInputSchema: z.ZodObject<{
|
|
53
|
+
export declare const tabsInputSchema: z.ZodObject<{
|
|
55
54
|
action: z.ZodEnum<{
|
|
56
55
|
close: "close";
|
|
57
56
|
list: "list";
|
|
@@ -69,7 +68,7 @@ declare const screenshotInputSchema: z.ZodObject<{
|
|
|
69
68
|
fullPage: z.ZodOptional<z.ZodBoolean>;
|
|
70
69
|
}, z.core.$strip>;
|
|
71
70
|
type ScreenshotInput = z.output<typeof screenshotInputSchema>;
|
|
72
|
-
declare const stagehandSchemas: {
|
|
71
|
+
export declare const stagehandSchemas: {
|
|
73
72
|
readonly act: z.ZodObject<{
|
|
74
73
|
instruction: z.ZodString;
|
|
75
74
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -109,8 +108,6 @@ declare const stagehandSchemas: {
|
|
|
109
108
|
fullPage: z.ZodOptional<z.ZodBoolean>;
|
|
110
109
|
}, z.core.$strip>;
|
|
111
110
|
};
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region src/thread-manager.d.ts
|
|
114
111
|
type V3 = Stagehand;
|
|
115
112
|
type V3Page$1 = NonNullable<ReturnType<NonNullable<Stagehand['context']>['activePage']>>;
|
|
116
113
|
/**
|
|
@@ -172,12 +169,10 @@ declare class StagehandThreadManager extends ThreadManager<V3> {
|
|
|
172
169
|
*/
|
|
173
170
|
destroyAllSessions(): Promise<void>;
|
|
174
171
|
}
|
|
175
|
-
//#endregion
|
|
176
|
-
//#region src/tools/constants.d.ts
|
|
177
172
|
/**
|
|
178
173
|
* Stagehand Tool Constants
|
|
179
174
|
*/
|
|
180
|
-
declare const STAGEHAND_TOOLS: {
|
|
175
|
+
export declare const STAGEHAND_TOOLS: {
|
|
181
176
|
readonly ACT: 'stagehand_act';
|
|
182
177
|
readonly EXTRACT: 'stagehand_extract';
|
|
183
178
|
readonly OBSERVE: 'stagehand_observe';
|
|
@@ -187,8 +182,6 @@ declare const STAGEHAND_TOOLS: {
|
|
|
187
182
|
readonly SCREENSHOT: 'stagehand_screenshot';
|
|
188
183
|
};
|
|
189
184
|
type StagehandToolName = (typeof STAGEHAND_TOOLS)[keyof typeof STAGEHAND_TOOLS];
|
|
190
|
-
//#endregion
|
|
191
|
-
//#region src/types.d.ts
|
|
192
185
|
/**
|
|
193
186
|
* Model configuration for Stagehand AI operations.
|
|
194
187
|
*/
|
|
@@ -202,7 +195,7 @@ type ModelConfiguration = ModelConfiguration$1;
|
|
|
202
195
|
* can reject a bad provider up front. Keep in sync with `AISDKProviders` in
|
|
203
196
|
* `@browserbasehq/stagehand`.
|
|
204
197
|
*/
|
|
205
|
-
declare const STAGEHAND_MODEL_PROVIDERS: readonly ['anthropic', 'azure', 'bedrock', 'cerebras', 'deepseek', 'gateway', 'google', 'groq', 'mistral', 'ollama', 'openai', 'perplexity', 'togetherai', 'vertex', 'xai'];
|
|
198
|
+
export declare const STAGEHAND_MODEL_PROVIDERS: readonly ['anthropic', 'azure', 'bedrock', 'cerebras', 'deepseek', 'gateway', 'google', 'groq', 'mistral', 'ollama', 'openai', 'perplexity', 'togetherai', 'vertex', 'xai'];
|
|
206
199
|
/**
|
|
207
200
|
* Stagehand-specific configuration fields.
|
|
208
201
|
*/
|
|
@@ -356,8 +349,6 @@ interface ObserveResult {
|
|
|
356
349
|
url?: string;
|
|
357
350
|
hint?: string;
|
|
358
351
|
}
|
|
359
|
-
//#endregion
|
|
360
|
-
//#region src/stagehand-browser.d.ts
|
|
361
352
|
type V3Page = NonNullable<ReturnType<NonNullable<Stagehand['context']>['activePage']>>;
|
|
362
353
|
/**
|
|
363
354
|
* StagehandBrowser - AI-powered browser using Stagehand v3
|
|
@@ -369,7 +360,7 @@ type V3Page = NonNullable<ReturnType<NonNullable<Stagehand['context']>['activePa
|
|
|
369
360
|
* - 'shared': All threads share the same Stagehand instance
|
|
370
361
|
* - 'thread': Each thread gets its own Stagehand instance (separate browser)
|
|
371
362
|
*/
|
|
372
|
-
declare class StagehandBrowser extends MastraBrowser {
|
|
363
|
+
export declare class StagehandBrowser extends MastraBrowser {
|
|
373
364
|
readonly id: string;
|
|
374
365
|
readonly name = "StagehandBrowser";
|
|
375
366
|
readonly provider = "browserbase/stagehand";
|
|
@@ -577,8 +568,6 @@ declare class StagehandBrowser extends MastraBrowser {
|
|
|
577
568
|
injectMouseEvent(event: MouseEventParams, threadId?: string): Promise<void>;
|
|
578
569
|
injectKeyboardEvent(event: KeyboardEventParams, threadId?: string): Promise<void>;
|
|
579
570
|
}
|
|
580
|
-
//#endregion
|
|
581
|
-
//#region src/utils.d.ts
|
|
582
571
|
/**
|
|
583
572
|
* Extract the Chrome process PID from a Stagehand instance.
|
|
584
573
|
*
|
|
@@ -588,14 +577,11 @@ declare class StagehandBrowser extends MastraBrowser {
|
|
|
588
577
|
*
|
|
589
578
|
* Returns undefined if the PID can't be found (e.g. BROWSERBASE env, not yet init'd).
|
|
590
579
|
*/
|
|
591
|
-
declare function getStagehandChromePid(stagehand: Stagehand): number | undefined;
|
|
592
|
-
//#endregion
|
|
593
|
-
//#region src/tools/index.d.ts
|
|
580
|
+
export declare function getStagehandChromePid(stagehand: Stagehand): number | undefined;
|
|
594
581
|
/**
|
|
595
582
|
* Creates all Stagehand tools bound to a StagehandBrowser instance.
|
|
596
583
|
* The browser is lazily initialized on first tool use.
|
|
597
584
|
*/
|
|
598
|
-
declare function createStagehandTools(browser: StagehandBrowser): Record<string, Tool<any, any>>;
|
|
599
|
-
|
|
600
|
-
export { type ActInput, type ActResult, type CloseInput, type ExtractInput, type ExtractResult, type ModelConfiguration, type NavigateInput, type ObserveInput, type ObserveResult, STAGEHAND_MODEL_PROVIDERS, STAGEHAND_TOOLS, type StagehandAction, StagehandBrowser, type StagehandBrowserConfig, type StagehandToolName, type TabsInput, actInputSchema, closeInputSchema, createStagehandTools, extractInputSchema, getStagehandChromePid, navigateInputSchema, observeInputSchema, stagehandSchemas, tabsInputSchema };
|
|
585
|
+
export declare function createStagehandTools(browser: StagehandBrowser): Record<string, Tool<any, any>>;
|
|
586
|
+
export type { ActInput, ActResult, CloseInput, ExtractInput, ExtractResult, ModelConfiguration, NavigateInput, ObserveInput, ObserveResult, StagehandAction, StagehandBrowserConfig, StagehandToolName, TabsInput };
|
|
601
587
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["V3Page","StagehandModelConfiguration","BaseBrowserConfig"],"sources":["../src/schemas.ts","../src/thread-manager.ts","../src/tools/constants.ts","../src/types.ts","../src/stagehand-browser.ts","../src/utils.ts","../src/tools/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["V3Page","StagehandModelConfiguration","BaseBrowserConfig"],"sources":["../src/schemas.ts","../src/thread-manager.ts","../src/tools/constants.ts","../src/types.ts","../src/stagehand-browser.ts","../src/utils.ts","../src/tools/index.ts"],"mappings":";;;;;;;qBAgBa,gBAAc,EAAA;;;;;GAQzB,EAAA,KAAA;KACU,WAAW,EAAE,cAAc;;;;qBAK1B,oBAAkB,EAAA;;;;GAO7B,EAAA,KAAA;KACU,eAAe,EAAE,cAAc;;;;qBAK9B,oBAAkB,EAAA;;;;GAS7B,EAAA,KAAA;KACU,eAAe,EAAE,cAAc;;;;qBAS9B,qBAAmB,EAAA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Ae;IAAgB;IAAc;IAAgB;IAAoB;MACnF;EA0HW,cAAc,oBAAoB;;;;EAoDlC,WAAW,cAAc;;;;EAiBzB,gBAAgB,oBAAoB,QAAQ;;;;;YAwBjD,yBAAyB,oBAAoB;;;;UAS/C;;;;EA6BO,YAAY,oBAAoB,QAAQ;;;;EAQxC,kBAAkB,oBAAoB;EAUtC,gBAAgB,UAAU,oBAAoB,QAAQ;;;;;UAsDvD;EA+PC,iBAAiB,OAAO,kBAAkB,oBAAoB;EAkC9D,oBAAoB,OAAO,qBAAqB,oBAAoB;;;;;;;;;;;wBCzzCrE,sBAAsB,WAAW;;;;;wBCjBjC,qBAAqB,SAAS,mBAAmB,eAAe"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { DEFAULT_BROWSER_VIEWPORT, DEFAULT_THREAD_ID, MastraBrowser, ScreencastS
|
|
|
4
4
|
import { createTool } from "@mastra/core/tools";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { join } from "path";
|
|
7
|
-
|
|
7
|
+
// src/thread-manager.ts
|
|
8
8
|
/**
|
|
9
9
|
* Thread manager for StagehandBrowser.
|
|
10
10
|
*
|
|
@@ -106,8 +106,7 @@ var StagehandThreadManager = class extends ThreadManager {
|
|
|
106
106
|
await super.destroyAllSessions();
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
-
|
|
110
|
-
//#region src/schemas.ts
|
|
109
|
+
// src/schemas.ts
|
|
111
110
|
/**
|
|
112
111
|
* Stagehand Tool Schemas
|
|
113
112
|
*
|
|
@@ -186,8 +185,7 @@ const stagehandSchemas = {
|
|
|
186
185
|
close: closeInputSchema,
|
|
187
186
|
screenshot: screenshotInputSchema
|
|
188
187
|
};
|
|
189
|
-
|
|
190
|
-
//#region src/tools/constants.ts
|
|
188
|
+
// src/tools/constants.ts
|
|
191
189
|
/**
|
|
192
190
|
* Stagehand Tool Constants
|
|
193
191
|
*/
|
|
@@ -200,8 +198,7 @@ const STAGEHAND_TOOLS = {
|
|
|
200
198
|
CLOSE: "stagehand_close",
|
|
201
199
|
SCREENSHOT: "stagehand_screenshot"
|
|
202
200
|
};
|
|
203
|
-
|
|
204
|
-
//#region src/tools/act.ts
|
|
201
|
+
// src/tools/act.ts
|
|
205
202
|
/**
|
|
206
203
|
* stagehand_act - Perform an action using natural language
|
|
207
204
|
*/
|
|
@@ -218,8 +215,7 @@ function createActTool(browser) {
|
|
|
218
215
|
}
|
|
219
216
|
});
|
|
220
217
|
}
|
|
221
|
-
|
|
222
|
-
//#region src/tools/close.ts
|
|
218
|
+
// src/tools/close.ts
|
|
223
219
|
/**
|
|
224
220
|
* stagehand_close - Close the browser
|
|
225
221
|
*/
|
|
@@ -249,8 +245,7 @@ function createCloseTool(browser) {
|
|
|
249
245
|
}
|
|
250
246
|
});
|
|
251
247
|
}
|
|
252
|
-
|
|
253
|
-
//#region src/tools/extract.ts
|
|
248
|
+
// src/tools/extract.ts
|
|
254
249
|
/**
|
|
255
250
|
* stagehand_extract - Extract structured data from a page
|
|
256
251
|
*/
|
|
@@ -267,8 +262,7 @@ function createExtractTool(browser) {
|
|
|
267
262
|
}
|
|
268
263
|
});
|
|
269
264
|
}
|
|
270
|
-
|
|
271
|
-
//#region src/tools/navigate.ts
|
|
265
|
+
// src/tools/navigate.ts
|
|
272
266
|
/**
|
|
273
267
|
* stagehand_navigate - Navigate to a URL
|
|
274
268
|
*/
|
|
@@ -285,8 +279,7 @@ function createNavigateTool(browser) {
|
|
|
285
279
|
}
|
|
286
280
|
});
|
|
287
281
|
}
|
|
288
|
-
|
|
289
|
-
//#region src/tools/observe.ts
|
|
282
|
+
// src/tools/observe.ts
|
|
290
283
|
/**
|
|
291
284
|
* stagehand_observe - Discover actionable elements on a page
|
|
292
285
|
*/
|
|
@@ -303,8 +296,7 @@ function createObserveTool(browser) {
|
|
|
303
296
|
}
|
|
304
297
|
});
|
|
305
298
|
}
|
|
306
|
-
|
|
307
|
-
//#region src/tools/screenshot.ts
|
|
299
|
+
// src/tools/screenshot.ts
|
|
308
300
|
/**
|
|
309
301
|
* stagehand_screenshot - Capture a screenshot of the current page
|
|
310
302
|
*/
|
|
@@ -339,8 +331,7 @@ function createScreenshotTool(browser) {
|
|
|
339
331
|
}
|
|
340
332
|
});
|
|
341
333
|
}
|
|
342
|
-
|
|
343
|
-
//#region src/tools/tabs.ts
|
|
334
|
+
// src/tools/tabs.ts
|
|
344
335
|
/**
|
|
345
336
|
* stagehand_tabs - Manage browser tabs
|
|
346
337
|
*/
|
|
@@ -357,8 +348,7 @@ function createTabsTool(browser) {
|
|
|
357
348
|
}
|
|
358
349
|
});
|
|
359
350
|
}
|
|
360
|
-
|
|
361
|
-
//#region src/tools/index.ts
|
|
351
|
+
// src/tools/index.ts
|
|
362
352
|
/**
|
|
363
353
|
* Creates all Stagehand tools bound to a StagehandBrowser instance.
|
|
364
354
|
* The browser is lazily initialized on first tool use.
|
|
@@ -374,8 +364,7 @@ function createStagehandTools(browser) {
|
|
|
374
364
|
[STAGEHAND_TOOLS.SCREENSHOT]: createScreenshotTool(browser)
|
|
375
365
|
};
|
|
376
366
|
}
|
|
377
|
-
|
|
378
|
-
//#region src/utils.ts
|
|
367
|
+
// src/utils.ts
|
|
379
368
|
/**
|
|
380
369
|
* Patch Chrome's Preferences file to set exit_type to "Normal".
|
|
381
370
|
*
|
|
@@ -417,8 +406,7 @@ function getStagehandChromePid(stagehand) {
|
|
|
417
406
|
return;
|
|
418
407
|
}
|
|
419
408
|
}
|
|
420
|
-
|
|
421
|
-
//#region src/stagehand-browser.ts
|
|
409
|
+
// src/stagehand-browser.ts
|
|
422
410
|
/**
|
|
423
411
|
* StagehandBrowser - AI-powered browser automation using Stagehand v3
|
|
424
412
|
*
|
|
@@ -1233,8 +1221,7 @@ var StagehandBrowser = class extends MastraBrowser {
|
|
|
1233
1221
|
});
|
|
1234
1222
|
}
|
|
1235
1223
|
};
|
|
1236
|
-
|
|
1237
|
-
//#region src/types.ts
|
|
1224
|
+
// src/types.ts
|
|
1238
1225
|
/**
|
|
1239
1226
|
* Providers Stagehand can resolve from a `provider/model` string.
|
|
1240
1227
|
*
|
|
@@ -1261,7 +1248,6 @@ const STAGEHAND_MODEL_PROVIDERS = [
|
|
|
1261
1248
|
"vertex",
|
|
1262
1249
|
"xai"
|
|
1263
1250
|
];
|
|
1264
|
-
//#endregion
|
|
1265
1251
|
export { STAGEHAND_MODEL_PROVIDERS, STAGEHAND_TOOLS, StagehandBrowser, actInputSchema, closeInputSchema, createStagehandTools, extractInputSchema, getStagehandChromePid, navigateInputSchema, observeInputSchema, stagehandSchemas, tabsInputSchema };
|
|
1266
1252
|
|
|
1267
1253
|
//# sourceMappingURL=index.js.map
|