@browserbasehq/stagehand 2.5.5 → 2.5.6

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
@@ -314,6 +314,9 @@ interface ObserveOptions {
314
314
  * @deprecated The `onlyVisible` parameter has no effect in this version of Stagehand and will be removed in later versions.
315
315
  */
316
316
  onlyVisible?: boolean;
317
+ /**
318
+ * @deprecated The `drawOverlay` parameter has no effect in this version of Stagehand and will be removed in later versions.
319
+ */
317
320
  drawOverlay?: boolean;
318
321
  iframes?: boolean;
319
322
  frameId?: string;
package/dist/index.js CHANGED
@@ -494,7 +494,7 @@ var StagehandFunctionName = /* @__PURE__ */ ((StagehandFunctionName2) => {
494
494
  })(StagehandFunctionName || {});
495
495
 
496
496
  // lib/version.ts
497
- var STAGEHAND_VERSION = "2.5.5";
497
+ var STAGEHAND_VERSION = "2.5.6";
498
498
 
499
499
  // types/stagehandErrors.ts
500
500
  var StagehandError = class extends Error {
@@ -2161,57 +2161,6 @@ function validateZodSchema(schema, data) {
2161
2161
  }
2162
2162
  throw new ZodSchemaValidationError(data, result.error.format());
2163
2163
  }
2164
- function drawObserveOverlay(page, results) {
2165
- return __async(this, null, function* () {
2166
- const xpathList = results.map((result) => result.selector);
2167
- const validXpaths = xpathList.filter((xpath) => xpath !== "xpath=");
2168
- yield page.evaluate((selectors2) => {
2169
- selectors2.forEach((selector) => {
2170
- let element;
2171
- if (selector.startsWith("xpath=")) {
2172
- const xpath = selector.substring(6);
2173
- element = document.evaluate(
2174
- xpath,
2175
- document,
2176
- null,
2177
- XPathResult.FIRST_ORDERED_NODE_TYPE,
2178
- null
2179
- ).singleNodeValue;
2180
- } else {
2181
- element = document.querySelector(selector);
2182
- }
2183
- if (element instanceof HTMLElement) {
2184
- const overlay = document.createElement("div");
2185
- overlay.setAttribute("stagehandObserve", "true");
2186
- const rect = element.getBoundingClientRect();
2187
- overlay.style.position = "absolute";
2188
- overlay.style.left = rect.left + "px";
2189
- overlay.style.top = rect.top + "px";
2190
- overlay.style.width = rect.width + "px";
2191
- overlay.style.height = rect.height + "px";
2192
- overlay.style.backgroundColor = "rgba(255, 255, 0, 0.3)";
2193
- overlay.style.pointerEvents = "none";
2194
- overlay.style.zIndex = "10000";
2195
- document.body.appendChild(overlay);
2196
- }
2197
- });
2198
- }, validXpaths);
2199
- });
2200
- }
2201
- function clearOverlays(page) {
2202
- return __async(this, null, function* () {
2203
- yield page.evaluate(() => {
2204
- const elements = document.querySelectorAll('[stagehandObserve="true"]');
2205
- elements.forEach((el) => {
2206
- const parent = el.parentNode;
2207
- while (el.firstChild) {
2208
- parent == null ? void 0 : parent.insertBefore(el.firstChild, el);
2209
- }
2210
- parent == null ? void 0 : parent.removeChild(el);
2211
- });
2212
- });
2213
- });
2214
- }
2215
2164
  function isRunningInBun() {
2216
2165
  return typeof process !== "undefined" && typeof process.versions !== "undefined" && "bun" in process.versions;
2217
2166
  }
@@ -3709,6 +3658,13 @@ var StagehandObserveHandler = class {
3709
3658
  level: 1
3710
3659
  });
3711
3660
  }
3661
+ if (drawOverlay !== void 0) {
3662
+ this.logger({
3663
+ category: "observation",
3664
+ message: "Warning: the drawOverlay parameter has been deprecated and this parameter is now a no-op.",
3665
+ level: 1
3666
+ });
3667
+ }
3712
3668
  yield this.stagehandPage._waitForSettledDom();
3713
3669
  this.logger({
3714
3670
  category: "observation",
@@ -3836,9 +3792,6 @@ var StagehandObserveHandler = class {
3836
3792
  }
3837
3793
  }
3838
3794
  });
3839
- if (drawOverlay) {
3840
- yield drawObserveOverlay(this.stagehandPage.page, elementsWithSelectors);
3841
- }
3842
3795
  return elementsWithSelectors;
3843
3796
  });
3844
3797
  }
@@ -4389,7 +4342,6 @@ var StagehandPage = class _StagehandPage {
4389
4342
  if (!this.actHandler) {
4390
4343
  throw new HandlerNotInitializedError("Act");
4391
4344
  }
4392
- yield clearOverlays(this.page);
4393
4345
  if (typeof actionOrOptions === "object" && actionOrOptions !== null) {
4394
4346
  if ("selector" in actionOrOptions && "method" in actionOrOptions) {
4395
4347
  const observeResult = actionOrOptions;
@@ -4468,7 +4420,6 @@ var StagehandPage = class _StagehandPage {
4468
4420
  if (!this.extractHandler) {
4469
4421
  throw new HandlerNotInitializedError("Extract");
4470
4422
  }
4471
- yield clearOverlays(this.page);
4472
4423
  if (!instructionOrOptions) {
4473
4424
  let result2;
4474
4425
  if (this.api) {
@@ -4571,7 +4522,6 @@ var StagehandPage = class _StagehandPage {
4571
4522
  if (!this.observeHandler) {
4572
4523
  throw new HandlerNotInitializedError("Observe");
4573
4524
  }
4574
- yield clearOverlays(this.page);
4575
4525
  const options = typeof instructionOrOptions === "string" ? { instruction: instructionOrOptions } : instructionOrOptions || {};
4576
4526
  const {
4577
4527
  instruction,
@@ -25,6 +25,9 @@ export declare class StagehandObserveHandler {
25
25
  * @deprecated The `onlyVisible` parameter has no effect in this version of Stagehand and will be removed in later versions.
26
26
  */
27
27
  onlyVisible?: boolean;
28
+ /**
29
+ * @deprecated The `drawOverlay` parameter has no effect in this version of Stagehand and will be removed in later versions.
30
+ */
28
31
  drawOverlay?: boolean;
29
32
  fromAct?: boolean;
30
33
  iframes?: boolean;
@@ -1,12 +1,9 @@
1
1
  import { Schema } from "@google/genai";
2
2
  import { z, ZodTypeAny } from "zod/v3";
3
- import { ObserveResult, Page } from ".";
4
3
  import { LogLine } from "../types/log";
5
4
  import { ModelProvider } from "../types/model";
6
5
  import { ZodPathSegments } from "../types/stagehand";
7
6
  export declare function validateZodSchema(schema: z.ZodTypeAny, data: unknown): boolean;
8
- export declare function drawObserveOverlay(page: Page, results: ObserveResult[]): Promise<void>;
9
- export declare function clearOverlays(page: Page): Promise<void>;
10
7
  /**
11
8
  * Detects if the code is running in the Bun runtime environment.
12
9
  * @returns {boolean} True if running in Bun, false otherwise.
@@ -2,4 +2,4 @@
2
2
  * AUTO-GENERATED — DO NOT EDIT BY HAND
3
3
  * Run `pnpm run gen-version` to refresh.
4
4
  */
5
- export declare const STAGEHAND_VERSION: "2.5.5";
5
+ export declare const STAGEHAND_VERSION: "2.5.6";
@@ -150,6 +150,9 @@ export interface ObserveOptions {
150
150
  * @deprecated The `onlyVisible` parameter has no effect in this version of Stagehand and will be removed in later versions.
151
151
  */
152
152
  onlyVisible?: boolean;
153
+ /**
154
+ * @deprecated The `drawOverlay` parameter has no effect in this version of Stagehand and will be removed in later versions.
155
+ */
153
156
  drawOverlay?: boolean;
154
157
  iframes?: boolean;
155
158
  frameId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserbasehq/stagehand",
3
- "version": "2.5.5",
3
+ "version": "2.5.6",
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",