Skip to content

Commit b8beaec

Browse files
authored
support browserbasesessionid for resuming a session on api (#605)
* send bb session id * changeset
1 parent 1d22604 commit b8beaec

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

Diff for: .changeset/rare-tires-turn.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@browserbasehq/stagehand": patch
3+
---
4+
5+
Added support for resuming a Stagehand session created on the API.

Diff for: lib/api.ts

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export class StagehandAPI {
5151
waitForCaptchaSolves,
5252
actionTimeoutMs,
5353
browserbaseSessionCreateParams,
54+
browserbaseSessionId,
5455
}: StartSessionParams): Promise<StartSessionResult> {
5556
const sessionResponse = await this.request("/sessions/start", {
5657
method: "POST",
@@ -64,6 +65,7 @@ export class StagehandAPI {
6465
waitForCaptchaSolves,
6566
actionTimeoutMs,
6667
browserbaseSessionCreateParams,
68+
browserbaseSessionId,
6769
}),
6870
headers: {
6971
"x-model-api-key": modelApiKey,

Diff for: lib/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@ export class Stagehand {
630630
waitForCaptchaSolves: this.waitForCaptchaSolves,
631631
actionTimeoutMs: this.actTimeoutMs,
632632
browserbaseSessionCreateParams: this.browserbaseSessionCreateParams,
633+
browserbaseSessionId: this.browserbaseSessionID,
633634
});
634635
this.browserbaseSessionID = sessionId;
635636
}

Diff for: types/api.ts

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface StartSessionParams {
2424
selfHeal?: boolean;
2525
waitForCaptchaSolves?: boolean;
2626
actionTimeoutMs?: number;
27+
browserbaseSessionId?: string;
2728
}
2829

2930
export interface StartSessionResult {

0 commit comments

Comments
 (0)