@browserbasehq/stagehand 3.0.3 → 3.0.4-alpha-fa18cfdc45f28e35e6566587b54612396e6ece45

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
@@ -1887,7 +1887,11 @@ declare class V3 {
1887
1887
  private readonly domSettleTimeoutMs?;
1888
1888
  private _isClosing;
1889
1889
  browserbaseSessionId?: string;
1890
+ private browserbaseSessionUrl?;
1891
+ private browserbaseDebugUrl?;
1890
1892
  get browserbaseSessionID(): string | undefined;
1893
+ get browserbaseSessionURL(): string | undefined;
1894
+ get browserbaseDebugURL(): string | undefined;
1891
1895
  private _onCdpClosed;
1892
1896
  readonly experimental: boolean;
1893
1897
  readonly logInferenceToFile: boolean;
@@ -1935,6 +1939,7 @@ declare class V3 {
1935
1939
  /** Apply post-connect local browser options that require CDP. */
1936
1940
  private _applyPostConnectLocalOptions;
1937
1941
  private _ensureBrowserbaseDownloadsEnabled;
1942
+ private resetBrowserbaseSessionMetadata;
1938
1943
  /**
1939
1944
  * Run an "act" instruction through the ActHandler.
1940
1945
  *
package/dist/index.js CHANGED
@@ -85,7 +85,7 @@ var __async = (__this, __arguments, generator) => {
85
85
  var STAGEHAND_VERSION;
86
86
  var init_version = __esm({
87
87
  "lib/version.ts"() {
88
- STAGEHAND_VERSION = "3.0.3";
88
+ STAGEHAND_VERSION = "3.0.4-alpha-fa18cfdc45f28e35e6566587b54612396e6ece45";
89
89
  }
90
90
  });
91
91
 
@@ -40389,6 +40389,12 @@ var _V3 = class _V3 {
40389
40389
  get browserbaseSessionID() {
40390
40390
  return this.browserbaseSessionId;
40391
40391
  }
40392
+ get browserbaseSessionURL() {
40393
+ return this.browserbaseSessionUrl;
40394
+ }
40395
+ get browserbaseDebugURL() {
40396
+ return this.browserbaseDebugUrl;
40397
+ }
40392
40398
  /**
40393
40399
  * Async property for metrics so callers can `await v3.metrics`.
40394
40400
  * When using API mode, fetches metrics from the API. Otherwise returns local metrics.
@@ -40688,6 +40694,7 @@ var _V3 = class _V3 {
40688
40694
  },
40689
40695
  ws: lbo.cdpUrl
40690
40696
  };
40697
+ this.resetBrowserbaseSessionMetadata();
40691
40698
  yield this._applyPostConnectLocalOptions(lbo);
40692
40699
  return;
40693
40700
  }
@@ -40766,7 +40773,7 @@ var _V3 = class _V3 {
40766
40773
  createdTempProfile: createdTemp,
40767
40774
  preserveUserDataDir: !!lbo.preserveUserDataDir
40768
40775
  };
40769
- this.browserbaseSessionId = void 0;
40776
+ this.resetBrowserbaseSessionMetadata();
40770
40777
  yield this._applyPostConnectLocalOptions(lbo);
40771
40778
  return;
40772
40779
  }
@@ -40828,15 +40835,17 @@ var _V3 = class _V3 {
40828
40835
  this.state = { kind: "BROWSERBASE", sessionId, ws, bb };
40829
40836
  this.browserbaseSessionId = sessionId;
40830
40837
  yield this._ensureBrowserbaseDownloadsEnabled();
40838
+ const resumed = !!this.opts.browserbaseSessionID;
40839
+ let debugUrl;
40840
+ try {
40841
+ const dbg = yield bb.sessions.debug(sessionId);
40842
+ debugUrl = dbg == null ? void 0 : dbg.debuggerUrl;
40843
+ } catch (e) {
40844
+ }
40845
+ const sessionUrl = `https://www.browserbase.com/sessions/${sessionId}`;
40846
+ this.browserbaseSessionUrl = sessionUrl;
40847
+ this.browserbaseDebugUrl = debugUrl;
40831
40848
  try {
40832
- const resumed = !!this.opts.browserbaseSessionID;
40833
- let debugUrl;
40834
- try {
40835
- const dbg = yield bb.sessions.debug(sessionId);
40836
- debugUrl = dbg == null ? void 0 : dbg.debuggerUrl;
40837
- } catch (e) {
40838
- }
40839
- const sessionUrl = `https://www.browserbase.com/sessions/${sessionId}`;
40840
40849
  this.logger({
40841
40850
  category: "init",
40842
40851
  message: resumed ? this.apiClient ? "Browserbase session started" : "Browserbase session resumed" : "Browserbase session started",
@@ -40900,6 +40909,11 @@ var _V3 = class _V3 {
40900
40909
  }
40901
40910
  });
40902
40911
  }
40912
+ resetBrowserbaseSessionMetadata() {
40913
+ this.browserbaseSessionId = void 0;
40914
+ this.browserbaseSessionUrl = void 0;
40915
+ this.browserbaseDebugUrl = void 0;
40916
+ }
40903
40917
  act(input, options) {
40904
40918
  return __async(this, null, function* () {
40905
40919
  return yield withInstanceLogContext(this.instanceId, () => __async(this, null, function* () {
@@ -41141,7 +41155,7 @@ var _V3 = class _V3 {
41141
41155
  this.state = { kind: "UNINITIALIZED" };
41142
41156
  this.ctx = null;
41143
41157
  this._isClosing = false;
41144
- this.browserbaseSessionId = void 0;
41158
+ this.resetBrowserbaseSessionMetadata();
41145
41159
  try {
41146
41160
  unbindInstanceLogger(this.instanceId);
41147
41161
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserbasehq/stagehand",
3
- "version": "3.0.3",
3
+ "version": "3.0.4-alpha-fa18cfdc45f28e35e6566587b54612396e6ece45",
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",
@@ -68,7 +68,8 @@
68
68
  "prettier": "^3.2.5",
69
69
  "tsup": "^8.2.1",
70
70
  "tsx": "^4.10.5",
71
- "typescript": "^5.2.2"
71
+ "typescript": "^5.2.2",
72
+ "vitest": "^4.0.8"
72
73
  },
73
74
  "repository": {
74
75
  "type": "git",
@@ -91,6 +92,7 @@
91
92
  "e2e:local": "playwright test --config=lib/v3/tests/v3.local.playwright.config.ts",
92
93
  "e2e:bb": "playwright test --config=lib/v3/tests/v3.bb.playwright.config.ts",
93
94
  "lint": "cd ../.. && prettier --check packages/core && cd packages/core && eslint .",
94
- "format": "prettier --write ."
95
+ "format": "prettier --write .",
96
+ "test:vitest": "pnpm run build-js && vitest run --config vitest.config.ts"
95
97
  }
96
98
  }