Skip to content

Commit a4b4bcf

Browse files
Release 2.0.7
1 parent 405b75c commit a4b4bcf

File tree

12 files changed

+254
-5
lines changed

12 files changed

+254
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "browser-use-sdk",
3-
"version": "2.0.6",
3+
"version": "2.0.7",
44
"private": false,
55
"repository": "github:browser-use/browser-use-node",
66
"type": "commonjs",

reference.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,71 @@ await client.sessions.getSession({
570570
</dl>
571571

572572

573+
</dd>
574+
</dl>
575+
</details>
576+
577+
<details><summary><code>client.sessions.<a href="/src/api/resources/sessions/client/Client.ts">deleteSession</a>({ ...params }) -> void</code></summary>
578+
<dl>
579+
<dd>
580+
581+
#### 📝 Description
582+
583+
<dl>
584+
<dd>
585+
586+
<dl>
587+
<dd>
588+
589+
Delete a session with all its tasks.
590+
</dd>
591+
</dl>
592+
</dd>
593+
</dl>
594+
595+
#### 🔌 Usage
596+
597+
<dl>
598+
<dd>
599+
600+
<dl>
601+
<dd>
602+
603+
```typescript
604+
await client.sessions.deleteSession({
605+
session_id: "session_id"
606+
});
607+
608+
```
609+
</dd>
610+
</dl>
611+
</dd>
612+
</dl>
613+
614+
#### ⚙️ Parameters
615+
616+
<dl>
617+
<dd>
618+
619+
<dl>
620+
<dd>
621+
622+
**request:** `BrowserUse.DeleteSessionSessionsSessionIdDeleteRequest`
623+
624+
</dd>
625+
</dl>
626+
627+
<dl>
628+
<dd>
629+
630+
**requestOptions:** `Sessions.RequestOptions`
631+
632+
</dd>
633+
</dl>
634+
</dd>
635+
</dl>
636+
637+
573638
</dd>
574639
</dl>
575640
</details>

src/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export class BrowserUseClient {
3535
{
3636
"X-Fern-Language": "JavaScript",
3737
"X-Fern-SDK-Name": "browser-use-sdk",
38-
"X-Fern-SDK-Version": "2.0.6",
39-
"User-Agent": "browser-use-sdk/2.0.6",
38+
"X-Fern-SDK-Version": "2.0.7",
39+
"User-Agent": "browser-use-sdk/2.0.7",
4040
"X-Fern-Runtime": core.RUNTIME.type,
4141
"X-Fern-Runtime-Version": core.RUNTIME.version,
4242
},

src/api/resources/sessions/client/Client.ts

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,92 @@ export class Sessions {
292292
}
293293
}
294294

295+
/**
296+
* Delete a session with all its tasks.
297+
*
298+
* @param {BrowserUse.DeleteSessionSessionsSessionIdDeleteRequest} request
299+
* @param {Sessions.RequestOptions} requestOptions - Request-specific configuration.
300+
*
301+
* @throws {@link BrowserUse.NotFoundError}
302+
* @throws {@link BrowserUse.UnprocessableEntityError}
303+
*
304+
* @example
305+
* await client.sessions.deleteSession({
306+
* session_id: "session_id"
307+
* })
308+
*/
309+
public deleteSession(
310+
request: BrowserUse.DeleteSessionSessionsSessionIdDeleteRequest,
311+
requestOptions?: Sessions.RequestOptions,
312+
): core.HttpResponsePromise<void> {
313+
return core.HttpResponsePromise.fromPromise(this.__deleteSession(request, requestOptions));
314+
}
315+
316+
private async __deleteSession(
317+
request: BrowserUse.DeleteSessionSessionsSessionIdDeleteRequest,
318+
requestOptions?: Sessions.RequestOptions,
319+
): Promise<core.WithRawResponse<void>> {
320+
const { session_id: sessionId } = request;
321+
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
322+
this._options?.headers,
323+
mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }),
324+
requestOptions?.headers,
325+
);
326+
const _response = await core.fetcher({
327+
url: core.url.join(
328+
(await core.Supplier.get(this._options.baseUrl)) ??
329+
(await core.Supplier.get(this._options.environment)) ??
330+
environments.BrowserUseEnvironment.Production,
331+
`sessions/${core.url.encodePathParam(sessionId)}`,
332+
),
333+
method: "DELETE",
334+
headers: _headers,
335+
queryParameters: requestOptions?.queryParams,
336+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
337+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
338+
abortSignal: requestOptions?.abortSignal,
339+
fetchFn: this._options?.fetch,
340+
logging: this._options.logging,
341+
});
342+
if (_response.ok) {
343+
return { data: undefined, rawResponse: _response.rawResponse };
344+
}
345+
346+
if (_response.error.reason === "status-code") {
347+
switch (_response.error.statusCode) {
348+
case 404:
349+
throw new BrowserUse.NotFoundError(_response.error.body as unknown, _response.rawResponse);
350+
case 422:
351+
throw new BrowserUse.UnprocessableEntityError(
352+
_response.error.body as unknown,
353+
_response.rawResponse,
354+
);
355+
default:
356+
throw new errors.BrowserUseError({
357+
statusCode: _response.error.statusCode,
358+
body: _response.error.body,
359+
rawResponse: _response.rawResponse,
360+
});
361+
}
362+
}
363+
364+
switch (_response.error.reason) {
365+
case "non-json":
366+
throw new errors.BrowserUseError({
367+
statusCode: _response.error.statusCode,
368+
body: _response.error.rawBody,
369+
rawResponse: _response.rawResponse,
370+
});
371+
case "timeout":
372+
throw new errors.BrowserUseTimeoutError("Timeout exceeded when calling DELETE /sessions/{session_id}.");
373+
case "unknown":
374+
throw new errors.BrowserUseError({
375+
message: _response.error.errorMessage,
376+
rawResponse: _response.rawResponse,
377+
});
378+
}
379+
}
380+
295381
/**
296382
* Stop a session and all its running tasks.
297383
*
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This file was auto-generated by Fern from our API Definition.
2+
3+
/**
4+
* @example
5+
* {
6+
* session_id: "session_id"
7+
* }
8+
*/
9+
export interface DeleteSessionSessionsSessionIdDeleteRequest {
10+
session_id: string;
11+
}

src/api/resources/sessions/client/requests/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export type { CreateSessionPublicShareSessionsSessionIdPublicSharePostRequest } from "./CreateSessionPublicShareSessionsSessionIdPublicSharePostRequest.js";
22
export type { CreateSessionRequest } from "./CreateSessionRequest.js";
33
export type { DeleteSessionPublicShareSessionsSessionIdPublicShareDeleteRequest } from "./DeleteSessionPublicShareSessionsSessionIdPublicShareDeleteRequest.js";
4+
export type { DeleteSessionSessionsSessionIdDeleteRequest } from "./DeleteSessionSessionsSessionIdDeleteRequest.js";
45
export type { GetSessionPublicShareSessionsSessionIdPublicShareGetRequest } from "./GetSessionPublicShareSessionsSessionIdPublicShareGetRequest.js";
56
export type { GetSessionSessionsSessionIdGetRequest } from "./GetSessionSessionsSessionIdGetRequest.js";
67
export type { ListSessionsSessionsGetRequest } from "./ListSessionsSessionsGetRequest.js";

src/api/resources/tasks/client/requests/CreateTaskRequest.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ export interface CreateTaskRequest {
3939
vision?: CreateTaskRequest.Vision;
4040
/** Optional extension to the agent system prompt. */
4141
systemPromptExtension?: string;
42+
/** Enable judge mode to evaluate task completion against ground truth. */
43+
judge?: boolean;
44+
/** Expected answer for judge evaluation. */
45+
judgeGroundTruth?: string | null;
46+
/** The LLM model to use for judging. If not provided, uses the default judge LLM. */
47+
judgeLlm?: BrowserUse.SupportedLlMs | null;
4248
}
4349

4450
export namespace CreateTaskRequest {

src/api/types/TaskItemView.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,8 @@ export interface TaskItemView {
2929
browserUseVersion?: string | null;
3030
/** Whether the task was successful (self-reported by the agent) */
3131
isSuccess?: boolean | null;
32+
/** Stringified JSON object containing the full report from the judge */
33+
judgement?: string | null;
34+
/** Judge verdict - True if the judge found the task to be successful, False otherwise (None if judge is not enabled) */
35+
judgeVerdict?: boolean | null;
3236
}

src/api/types/TaskView.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export interface TaskView {
2929
outputFiles: BrowserUse.FileView[];
3030
/** Version of browser-use used for this task (older tasks may not have this set) */
3131
browserUseVersion?: string | null;
32-
/** Whether the task was successful (self-reported by the agent) */
32+
/** Whether the task was successful based on the agent's self-reported output (less reliable than the judge) */
3333
isSuccess?: boolean | null;
34+
/** Stringified JSON object containing the full report from the judge */
35+
judgement?: string | null;
36+
/** Judge verdict - True if the judge found the task to be successful, False otherwise (None if judge is not enabled) */
37+
judgeVerdict?: boolean | null;
3438
}

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const SDK_VERSION = "2.0.6";
1+
export const SDK_VERSION = "2.0.7";

0 commit comments

Comments
 (0)