@browserbasehq/stagehand 3.0.7-alpha-05f5580937c3c157550e3c25ae6671f44f562211 → 3.0.7-alpha-f56a9c296d4ddce25a405358c66837f8ce4d679f
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.d.ts +5 -2
- package/dist/index.js +31 -14
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1953,8 +1953,9 @@ type AgentModelConfig<TModelName extends string = string> = {
|
|
|
1953
1953
|
* Agent tool mode determines which set of tools are available to the agent.
|
|
1954
1954
|
* - 'dom': Uses DOM-based tools (act, fillForm) - better for structured page interactions
|
|
1955
1955
|
* - 'hybrid': Uses coordinate-based tools (click, type, dragAndDrop, etc.) - better for visual/screenshot-based interactions
|
|
1956
|
+
* - 'cua': Uses Computer Use Agent (CUA) providers like Anthropic Claude or Google Gemini for screenshot-based automation
|
|
1956
1957
|
*/
|
|
1957
|
-
type AgentToolMode = "dom" | "hybrid";
|
|
1958
|
+
type AgentToolMode = "dom" | "hybrid" | "cua";
|
|
1958
1959
|
type AgentConfig = {
|
|
1959
1960
|
/**
|
|
1960
1961
|
* Custom system prompt to provide to the agent. Overrides the default system prompt.
|
|
@@ -1969,7 +1970,8 @@ type AgentConfig = {
|
|
|
1969
1970
|
*/
|
|
1970
1971
|
tools?: ToolSet;
|
|
1971
1972
|
/**
|
|
1972
|
-
*
|
|
1973
|
+
* @deprecated Use `mode: "cua"` instead. This option will be removed in a future version.
|
|
1974
|
+
* Enables Computer Use Agent (CUA) mode.
|
|
1973
1975
|
*/
|
|
1974
1976
|
cua?: boolean;
|
|
1975
1977
|
/**
|
|
@@ -1993,6 +1995,7 @@ type AgentConfig = {
|
|
|
1993
1995
|
* - 'dom' (default): Uses DOM-based tools (act, fillForm) for structured interactions
|
|
1994
1996
|
* - 'hybrid': Uses coordinate-based tools (click, type, dragAndDrop, clickAndHold, fillFormVision)
|
|
1995
1997
|
* for visual/screenshot-based interactions
|
|
1998
|
+
* - 'cua': Uses Computer Use Agent (CUA) providers for screenshot-based automation
|
|
1996
1999
|
*/
|
|
1997
2000
|
mode?: AgentToolMode;
|
|
1998
2001
|
};
|
package/dist/index.js
CHANGED
|
@@ -179,7 +179,7 @@ var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")])
|
|
|
179
179
|
var STAGEHAND_VERSION;
|
|
180
180
|
var init_version = __esm({
|
|
181
181
|
"lib/version.ts"() {
|
|
182
|
-
STAGEHAND_VERSION = "3.0.7-alpha-
|
|
182
|
+
STAGEHAND_VERSION = "3.0.7-alpha-f56a9c296d4ddce25a405358c66837f8ce4d679f";
|
|
183
183
|
}
|
|
184
184
|
});
|
|
185
185
|
|
|
@@ -28424,7 +28424,7 @@ var AgentCache = class {
|
|
|
28424
28424
|
return sanitized;
|
|
28425
28425
|
}
|
|
28426
28426
|
buildConfigSignature(agentOptions) {
|
|
28427
|
-
var _a4, _b
|
|
28427
|
+
var _a4, _b;
|
|
28428
28428
|
const toolKeys = (agentOptions == null ? void 0 : agentOptions.tools) ? Object.keys(agentOptions.tools).sort() : void 0;
|
|
28429
28429
|
const integrationSignatures = (agentOptions == null ? void 0 : agentOptions.integrations) ? agentOptions.integrations.map(
|
|
28430
28430
|
(integration) => typeof integration === "string" ? integration : "client"
|
|
@@ -28435,14 +28435,15 @@ var AgentCache = class {
|
|
|
28435
28435
|
const serializedExecutionModel = this.serializeAgentModelForCache(
|
|
28436
28436
|
agentOptions == null ? void 0 : agentOptions.executionModel
|
|
28437
28437
|
);
|
|
28438
|
+
const isCuaMode = (agentOptions == null ? void 0 : agentOptions.mode) === "cua" || (agentOptions == null ? void 0 : agentOptions.cua) === true;
|
|
28438
28439
|
return JSON.stringify({
|
|
28439
28440
|
v3Model: this.getBaseModelName(),
|
|
28440
28441
|
systemPrompt: (_a4 = this.getSystemPrompt()) != null ? _a4 : "",
|
|
28441
28442
|
agent: {
|
|
28442
|
-
cua:
|
|
28443
|
+
cua: isCuaMode,
|
|
28443
28444
|
model: serializedModel != null ? serializedModel : null,
|
|
28444
|
-
executionModel:
|
|
28445
|
-
systemPrompt: (
|
|
28445
|
+
executionModel: isCuaMode ? null : serializedExecutionModel,
|
|
28446
|
+
systemPrompt: (_b = agentOptions == null ? void 0 : agentOptions.systemPrompt) != null ? _b : null,
|
|
28446
28447
|
toolKeys,
|
|
28447
28448
|
integrations: integrationSignatures
|
|
28448
28449
|
}
|
|
@@ -65497,7 +65498,8 @@ var StagehandAPIClient = class {
|
|
|
65497
65498
|
init_sdkErrors();
|
|
65498
65499
|
function validateExperimentalFeatures(options) {
|
|
65499
65500
|
const { isExperimental, agentConfig, executeOptions, isStreaming } = options;
|
|
65500
|
-
|
|
65501
|
+
const isCuaMode = (agentConfig == null ? void 0 : agentConfig.mode) === "cua" || (agentConfig == null ? void 0 : agentConfig.cua) === true;
|
|
65502
|
+
if (isCuaMode) {
|
|
65501
65503
|
const unsupportedFeatures = [];
|
|
65502
65504
|
if (agentConfig == null ? void 0 : agentConfig.stream) {
|
|
65503
65505
|
unsupportedFeatures.push("streaming");
|
|
@@ -65521,10 +65523,13 @@ function validateExperimentalFeatures(options) {
|
|
|
65521
65523
|
if (hasIntegrations || hasTools) {
|
|
65522
65524
|
features.push("MCP integrations and custom tools");
|
|
65523
65525
|
}
|
|
65524
|
-
if (
|
|
65526
|
+
if ((agentConfig == null ? void 0 : agentConfig.mode) === "hybrid") {
|
|
65527
|
+
features.push("hybrid mode");
|
|
65528
|
+
}
|
|
65529
|
+
if (!isCuaMode && (isStreaming || (agentConfig == null ? void 0 : agentConfig.stream))) {
|
|
65525
65530
|
features.push("streaming");
|
|
65526
65531
|
}
|
|
65527
|
-
if (executeOptions && !
|
|
65532
|
+
if (executeOptions && !isCuaMode) {
|
|
65528
65533
|
if (executeOptions.callbacks) {
|
|
65529
65534
|
features.push("callbacks");
|
|
65530
65535
|
}
|
|
@@ -66729,16 +66734,28 @@ var _V3 = class _V3 {
|
|
|
66729
66734
|
});
|
|
66730
66735
|
}
|
|
66731
66736
|
agent(options) {
|
|
66732
|
-
var _a4, _b, _c;
|
|
66737
|
+
var _a4, _b, _c, _d2;
|
|
66738
|
+
const isCuaMode = (options == null ? void 0 : options.mode) === "cua" || (options == null ? void 0 : options.cua) === true;
|
|
66739
|
+
if ((options == null ? void 0 : options.cua) === true) {
|
|
66740
|
+
this.logger({
|
|
66741
|
+
category: "agent",
|
|
66742
|
+
message: `[DEPRECATED] The "cua: true" option is deprecated. Use "mode: 'cua'" instead. This option will be removed in a future version.`,
|
|
66743
|
+
level: 0
|
|
66744
|
+
});
|
|
66745
|
+
console.warn(
|
|
66746
|
+
`[Stagehand] DEPRECATED: The "cua: true" option is deprecated. Use "mode: 'cua'" instead.`
|
|
66747
|
+
);
|
|
66748
|
+
}
|
|
66733
66749
|
this.logger({
|
|
66734
66750
|
category: "agent",
|
|
66735
66751
|
message: `Creating v3 agent instance with options: ${JSON.stringify(options)}`,
|
|
66736
66752
|
level: 1,
|
|
66737
66753
|
auxiliary: __spreadValues({
|
|
66738
|
-
cua: { value:
|
|
66754
|
+
cua: { value: isCuaMode ? "true" : "false", type: "boolean" },
|
|
66755
|
+
mode: { value: (_a4 = options == null ? void 0 : options.mode) != null ? _a4 : "dom", type: "string" },
|
|
66739
66756
|
model: (options == null ? void 0 : options.model) ? typeof (options == null ? void 0 : options.model) === "string" ? { value: options.model, type: "string" } : { value: options.model.modelName, type: "string" } : { value: this.llmClient.modelName, type: "string" },
|
|
66740
|
-
systemPrompt: { value: (
|
|
66741
|
-
tools: { value: JSON.stringify((
|
|
66757
|
+
systemPrompt: { value: (_b = options == null ? void 0 : options.systemPrompt) != null ? _b : "", type: "string" },
|
|
66758
|
+
tools: { value: JSON.stringify((_c = options == null ? void 0 : options.tools) != null ? _c : {}), type: "object" }
|
|
66742
66759
|
}, (options == null ? void 0 : options.integrations) && {
|
|
66743
66760
|
integrations: {
|
|
66744
66761
|
value: JSON.stringify(options.integrations),
|
|
@@ -66746,7 +66763,7 @@ var _V3 = class _V3 {
|
|
|
66746
66763
|
}
|
|
66747
66764
|
})
|
|
66748
66765
|
});
|
|
66749
|
-
if (
|
|
66766
|
+
if (isCuaMode) {
|
|
66750
66767
|
validateExperimentalFeatures({
|
|
66751
66768
|
isExperimental: this.experimental,
|
|
66752
66769
|
agentConfig: options
|
|
@@ -66848,7 +66865,7 @@ Do not ask follow up questions, the user will trust your judgement.`
|
|
|
66848
66865
|
};
|
|
66849
66866
|
}
|
|
66850
66867
|
const agentConfigSignature = this.agentCache.buildConfigSignature(options);
|
|
66851
|
-
const isStreaming = (
|
|
66868
|
+
const isStreaming = (_d2 = options == null ? void 0 : options.stream) != null ? _d2 : false;
|
|
66852
66869
|
return {
|
|
66853
66870
|
execute: (instructionOrOptions) => __async(this, null, function* () {
|
|
66854
66871
|
return withInstanceLogContext(this.instanceId, () => __async(this, null, function* () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@browserbasehq/stagehand",
|
|
3
|
-
"version": "3.0.7-alpha-
|
|
3
|
+
"version": "3.0.7-alpha-f56a9c296d4ddce25a405358c66837f8ce4d679f",
|
|
4
4
|
"description": "An AI web browsing framework focused on simplicity and extensibility.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|