@browserbasehq/stagehand 1.13.0 → 1.13.1-alpha-a7d345e75434aebb656e1aa5aa61caed00dc99a8

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.js CHANGED
@@ -1599,6 +1599,9 @@ function clearOverlays(page) {
1599
1599
  });
1600
1600
  });
1601
1601
  }
1602
+ function isRunningInBun() {
1603
+ return typeof process !== "undefined" && typeof process.versions !== "undefined" && "bun" in process.versions;
1604
+ }
1602
1605
 
1603
1606
  // lib/handlers/actHandler.ts
1604
1607
  var StagehandActHandler = class {
@@ -5649,6 +5652,11 @@ var Stagehand = class {
5649
5652
  }
5650
5653
  init(initOptions) {
5651
5654
  return __async(this, null, function* () {
5655
+ if (isRunningInBun()) {
5656
+ throw new Error(
5657
+ "Playwright does not currently support the Bun runtime environment. Please use Node.js instead. For more information, see: https://github.com/microsoft/playwright/issues/27139"
5658
+ );
5659
+ }
5652
5660
  if (initOptions) {
5653
5661
  console.warn(
5654
5662
  "Passing parameters to init() is deprecated and will be removed in the next major version. Use constructor options instead."
@@ -23,3 +23,8 @@ export declare function logLineToString(logLine: LogLine): string;
23
23
  export declare function validateZodSchema(schema: z.ZodTypeAny, data: unknown): boolean;
24
24
  export declare function drawObserveOverlay(page: Page, results: ObserveResult[]): Promise<void>;
25
25
  export declare function clearOverlays(page: Page): Promise<void>;
26
+ /**
27
+ * Detects if the code is running in the Bun runtime environment.
28
+ * @returns {boolean} True if running in Bun, false otherwise.
29
+ */
30
+ export declare function isRunningInBun(): boolean;
package/lib/index.ts CHANGED
@@ -31,7 +31,7 @@ import { StagehandAPI } from "./api";
31
31
  import { scriptContent } from "./dom/build/scriptContent";
32
32
  import { LLMClient } from "./llm/LLMClient";
33
33
  import { LLMProvider } from "./llm/LLMProvider";
34
- import { logLineToString } from "./utils";
34
+ import { logLineToString, isRunningInBun } from "./utils";
35
35
 
36
36
  dotenv.config({ path: ".env" });
37
37
 
@@ -487,6 +487,14 @@ export class Stagehand {
487
487
  /** @deprecated Use constructor options instead */
488
488
  initOptions?: InitOptions,
489
489
  ): Promise<InitResult> {
490
+ if (isRunningInBun()) {
491
+ throw new Error(
492
+ "Playwright does not currently support the Bun runtime environment. " +
493
+ "Please use Node.js instead. For more information, see: " +
494
+ "https://github.com/microsoft/playwright/issues/27139",
495
+ );
496
+ }
497
+
490
498
  if (initOptions) {
491
499
  console.warn(
492
500
  "Passing parameters to init() is deprecated and will be removed in the next major version. Use constructor options instead.",
package/lib/utils.ts CHANGED
@@ -430,3 +430,15 @@ export async function clearOverlays(page: Page) {
430
430
  });
431
431
  });
432
432
  }
433
+
434
+ /**
435
+ * Detects if the code is running in the Bun runtime environment.
436
+ * @returns {boolean} True if running in Bun, false otherwise.
437
+ */
438
+ export function isRunningInBun(): boolean {
439
+ return (
440
+ typeof process !== "undefined" &&
441
+ typeof process.versions !== "undefined" &&
442
+ "bun" in process.versions
443
+ );
444
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserbasehq/stagehand",
3
- "version": "1.13.0",
3
+ "version": "1.13.1-alpha-a7d345e75434aebb656e1aa5aa61caed00dc99a8",
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",