@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 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
- * Indicates CUA is disabled for this configuration
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-05f5580937c3c157550e3c25ae6671f44f562211";
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, _c;
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: (_b = agentOptions == null ? void 0 : agentOptions.cua) != null ? _b : false,
28443
+ cua: isCuaMode,
28443
28444
  model: serializedModel != null ? serializedModel : null,
28444
- executionModel: (agentOptions == null ? void 0 : agentOptions.cua) ? null : serializedExecutionModel,
28445
- systemPrompt: (_c = agentOptions == null ? void 0 : agentOptions.systemPrompt) != null ? _c : null,
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
- if (agentConfig == null ? void 0 : agentConfig.cua) {
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 (!(agentConfig == null ? void 0 : agentConfig.cua) && (isStreaming || (agentConfig == null ? void 0 : agentConfig.stream))) {
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 && !(agentConfig == null ? void 0 : agentConfig.cua)) {
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: (options == null ? void 0 : options.cua) ? "true" : "false", type: "boolean" },
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: (_a4 = options == null ? void 0 : options.systemPrompt) != null ? _a4 : "", type: "string" },
66741
- tools: { value: JSON.stringify((_b = options == null ? void 0 : options.tools) != null ? _b : {}), type: "object" }
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 (options == null ? void 0 : options.cua) {
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 = (_c = options == null ? void 0 : options.stream) != null ? _c : false;
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-05f5580937c3c157550e3c25ae6671f44f562211",
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",