@browserbasehq/stagehand 3.0.7-alpha-e0e22e06bc752a8ffde30f3dbfa58d91e24e6c09 → 3.0.7-alpha-ddd7464487a0cd0615d4f1ba458bc6f3fa51b27d
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 -3
- package/dist/index.js +28 -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,7 +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
|
|
1996
|
-
*
|
|
1998
|
+
* - 'cua': Uses Computer Use Agent (CUA) providers for screenshot-based automation
|
|
1997
1999
|
*/
|
|
1998
2000
|
mode?: AgentToolMode;
|
|
1999
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-ddd7464487a0cd0615d4f1ba458bc6f3fa51b27d";
|
|
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");
|
|
@@ -65524,10 +65526,10 @@ function validateExperimentalFeatures(options) {
|
|
|
65524
65526
|
if ((agentConfig == null ? void 0 : agentConfig.mode) === "hybrid") {
|
|
65525
65527
|
features.push("hybrid mode");
|
|
65526
65528
|
}
|
|
65527
|
-
if (!
|
|
65529
|
+
if (!isCuaMode && (isStreaming || (agentConfig == null ? void 0 : agentConfig.stream))) {
|
|
65528
65530
|
features.push("streaming");
|
|
65529
65531
|
}
|
|
65530
|
-
if (executeOptions && !
|
|
65532
|
+
if (executeOptions && !isCuaMode) {
|
|
65531
65533
|
if (executeOptions.callbacks) {
|
|
65532
65534
|
features.push("callbacks");
|
|
65533
65535
|
}
|
|
@@ -66732,16 +66734,28 @@ var _V3 = class _V3 {
|
|
|
66732
66734
|
});
|
|
66733
66735
|
}
|
|
66734
66736
|
agent(options) {
|
|
66735
|
-
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
|
+
}
|
|
66736
66749
|
this.logger({
|
|
66737
66750
|
category: "agent",
|
|
66738
66751
|
message: `Creating v3 agent instance with options: ${JSON.stringify(options)}`,
|
|
66739
66752
|
level: 1,
|
|
66740
66753
|
auxiliary: __spreadValues({
|
|
66741
|
-
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" },
|
|
66742
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" },
|
|
66743
|
-
systemPrompt: { value: (
|
|
66744
|
-
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" }
|
|
66745
66759
|
}, (options == null ? void 0 : options.integrations) && {
|
|
66746
66760
|
integrations: {
|
|
66747
66761
|
value: JSON.stringify(options.integrations),
|
|
@@ -66749,7 +66763,7 @@ var _V3 = class _V3 {
|
|
|
66749
66763
|
}
|
|
66750
66764
|
})
|
|
66751
66765
|
});
|
|
66752
|
-
if (
|
|
66766
|
+
if (isCuaMode) {
|
|
66753
66767
|
validateExperimentalFeatures({
|
|
66754
66768
|
isExperimental: this.experimental,
|
|
66755
66769
|
agentConfig: options
|
|
@@ -66851,7 +66865,7 @@ Do not ask follow up questions, the user will trust your judgement.`
|
|
|
66851
66865
|
};
|
|
66852
66866
|
}
|
|
66853
66867
|
const agentConfigSignature = this.agentCache.buildConfigSignature(options);
|
|
66854
|
-
const isStreaming = (
|
|
66868
|
+
const isStreaming = (_d2 = options == null ? void 0 : options.stream) != null ? _d2 : false;
|
|
66855
66869
|
return {
|
|
66856
66870
|
execute: (instructionOrOptions) => __async(this, null, function* () {
|
|
66857
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-ddd7464487a0cd0615d4f1ba458bc6f3fa51b27d",
|
|
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",
|