browser-use-sdk 3.4.0 → 3.4.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-use-sdk",
3
- "version": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "description": "Official TypeScript SDK for the Browser Use API",
5
5
  "author": "Browser Use",
6
6
  "license": "MIT",
@@ -1,99 +0,0 @@
1
- // src/core/errors.ts
2
- var BrowserUseError = class extends Error {
3
- statusCode;
4
- detail;
5
- constructor(statusCode, message, detail) {
6
- super(message);
7
- this.name = "BrowserUseError";
8
- this.statusCode = statusCode;
9
- this.detail = detail;
10
- }
11
- };
12
-
13
- // src/core/http.ts
14
- var HttpClient = class {
15
- apiKey;
16
- baseUrl;
17
- maxRetries;
18
- timeout;
19
- constructor(options) {
20
- this.apiKey = options.apiKey;
21
- this.baseUrl = options.baseUrl.replace(/\/+$/, "");
22
- this.maxRetries = options.maxRetries ?? 3;
23
- this.timeout = options.timeout ?? 3e4;
24
- }
25
- async request(method, path, options) {
26
- const url = new URL(`${this.baseUrl}${path}`);
27
- if (options?.query) {
28
- for (const [key, value] of Object.entries(options.query)) {
29
- if (value !== void 0 && value !== null) {
30
- url.searchParams.set(key, String(value));
31
- }
32
- }
33
- }
34
- const headers = {
35
- "X-Browser-Use-API-Key": this.apiKey
36
- };
37
- if (options?.body !== void 0) {
38
- headers["Content-Type"] = "application/json";
39
- }
40
- for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
41
- if (attempt > 0) {
42
- const delay = Math.min(1e3 * 2 ** (attempt - 1), 1e4);
43
- await new Promise((resolve) => setTimeout(resolve, delay));
44
- }
45
- const controller = new AbortController();
46
- const timeoutId = options?.signal ? void 0 : setTimeout(() => controller.abort(), this.timeout);
47
- const signal = options?.signal ?? controller.signal;
48
- try {
49
- const response = await fetch(url.toString(), {
50
- method,
51
- headers,
52
- body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
53
- signal
54
- });
55
- clearTimeout(timeoutId);
56
- if (response.ok) {
57
- if (response.status === 204) {
58
- return void 0;
59
- }
60
- return await response.json();
61
- }
62
- const shouldRetry = response.status === 429 && attempt < this.maxRetries;
63
- if (shouldRetry) {
64
- continue;
65
- }
66
- let errorBody;
67
- try {
68
- errorBody = await response.json();
69
- } catch {
70
- }
71
- const raw = typeof errorBody === "object" && errorBody !== null ? "message" in errorBody ? errorBody.message : "detail" in errorBody ? errorBody.detail : void 0 : void 0;
72
- const message = raw === void 0 ? `HTTP ${response.status}` : typeof raw === "string" ? raw : JSON.stringify(raw);
73
- throw new BrowserUseError(response.status, message, errorBody);
74
- } catch (error) {
75
- clearTimeout(timeoutId);
76
- throw error;
77
- }
78
- }
79
- throw new Error("Unreachable: retry loop exhausted");
80
- }
81
- get(path, query) {
82
- return this.request("GET", path, { query });
83
- }
84
- post(path, body, query) {
85
- return this.request("POST", path, { body, query });
86
- }
87
- patch(path, body, query) {
88
- return this.request("PATCH", path, { body, query });
89
- }
90
- delete(path, query) {
91
- return this.request("DELETE", path, { query });
92
- }
93
- };
94
-
95
- export {
96
- BrowserUseError,
97
- HttpClient
98
- };
99
- //# sourceMappingURL=chunk-6TSB5AIP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/errors.ts","../src/core/http.ts"],"sourcesContent":["export class BrowserUseError extends Error {\n readonly statusCode: number;\n readonly detail: unknown;\n\n constructor(statusCode: number, message: string, detail?: unknown) {\n super(message);\n this.name = \"BrowserUseError\";\n this.statusCode = statusCode;\n this.detail = detail;\n }\n}\n","import { BrowserUseError } from \"./errors.js\";\n\nexport interface HttpClientOptions {\n apiKey: string;\n baseUrl: string;\n maxRetries?: number;\n timeout?: number;\n}\n\nexport class HttpClient {\n private readonly apiKey: string;\n private readonly baseUrl: string;\n private readonly maxRetries: number;\n private readonly timeout: number;\n\n constructor(options: HttpClientOptions) {\n this.apiKey = options.apiKey;\n this.baseUrl = options.baseUrl.replace(/\\/+$/, \"\");\n this.maxRetries = options.maxRetries ?? 3;\n this.timeout = options.timeout ?? 30_000;\n }\n\n async request<T>(\n method: string,\n path: string,\n options?: {\n body?: unknown;\n query?: Record<string, unknown>;\n signal?: AbortSignal;\n },\n ): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n if (options?.query) {\n for (const [key, value] of Object.entries(options.query)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n const headers: Record<string, string> = {\n \"X-Browser-Use-API-Key\": this.apiKey,\n };\n if (options?.body !== undefined) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n for (let attempt = 0; attempt <= this.maxRetries; attempt++) {\n if (attempt > 0) {\n const delay = Math.min(1000 * 2 ** (attempt - 1), 10_000);\n await new Promise((resolve) => setTimeout(resolve, delay));\n }\n\n const controller = new AbortController();\n const timeoutId = options?.signal\n ? undefined\n : setTimeout(() => controller.abort(), this.timeout);\n\n // Combine user signal with internal timeout when both are present\n const signal = options?.signal ?? controller.signal;\n\n try {\n const response = await fetch(url.toString(), {\n method,\n headers,\n body: options?.body !== undefined ? JSON.stringify(options.body) : undefined,\n signal,\n });\n\n clearTimeout(timeoutId);\n\n if (response.ok) {\n if (response.status === 204) {\n return undefined as T;\n }\n return (await response.json()) as T;\n }\n\n const shouldRetry =\n response.status === 429 &&\n attempt < this.maxRetries;\n\n if (shouldRetry) {\n continue;\n }\n\n let errorBody: unknown;\n try {\n errorBody = await response.json();\n } catch {\n /* ignore parse errors */\n }\n const raw =\n typeof errorBody === \"object\" && errorBody !== null\n ? \"message\" in errorBody\n ? (errorBody as Record<string, unknown>).message\n : \"detail\" in errorBody\n ? (errorBody as Record<string, unknown>).detail\n : undefined\n : undefined;\n const message =\n raw === undefined\n ? `HTTP ${response.status}`\n : typeof raw === \"string\"\n ? raw\n : JSON.stringify(raw);\n throw new BrowserUseError(response.status, message, errorBody);\n } catch (error) {\n clearTimeout(timeoutId);\n throw error;\n }\n }\n\n throw new Error(\"Unreachable: retry loop exhausted\");\n }\n\n get<T>(path: string, query?: Record<string, unknown>): Promise<T> {\n return this.request<T>(\"GET\", path, { query });\n }\n\n post<T>(path: string, body?: unknown, query?: Record<string, unknown>): Promise<T> {\n return this.request<T>(\"POST\", path, { body, query });\n }\n\n patch<T>(path: string, body?: unknown, query?: Record<string, unknown>): Promise<T> {\n return this.request<T>(\"PATCH\", path, { body, query });\n }\n\n delete<T>(path: string, query?: Record<string, unknown>): Promise<T> {\n return this.request<T>(\"DELETE\", path, { query });\n }\n}\n"],"mappings":"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","names":[]}
@@ -1,99 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/core/errors.ts
2
- var BrowserUseError = class extends Error {
3
-
4
-
5
- constructor(statusCode, message, detail) {
6
- super(message);
7
- this.name = "BrowserUseError";
8
- this.statusCode = statusCode;
9
- this.detail = detail;
10
- }
11
- };
12
-
13
- // src/core/http.ts
14
- var HttpClient = class {
15
-
16
-
17
-
18
-
19
- constructor(options) {
20
- this.apiKey = options.apiKey;
21
- this.baseUrl = options.baseUrl.replace(/\/+$/, "");
22
- this.maxRetries = _nullishCoalesce(options.maxRetries, () => ( 3));
23
- this.timeout = _nullishCoalesce(options.timeout, () => ( 3e4));
24
- }
25
- async request(method, path, options) {
26
- const url = new URL(`${this.baseUrl}${path}`);
27
- if (_optionalChain([options, 'optionalAccess', _ => _.query])) {
28
- for (const [key, value] of Object.entries(options.query)) {
29
- if (value !== void 0 && value !== null) {
30
- url.searchParams.set(key, String(value));
31
- }
32
- }
33
- }
34
- const headers = {
35
- "X-Browser-Use-API-Key": this.apiKey
36
- };
37
- if (_optionalChain([options, 'optionalAccess', _2 => _2.body]) !== void 0) {
38
- headers["Content-Type"] = "application/json";
39
- }
40
- for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
41
- if (attempt > 0) {
42
- const delay = Math.min(1e3 * 2 ** (attempt - 1), 1e4);
43
- await new Promise((resolve) => setTimeout(resolve, delay));
44
- }
45
- const controller = new AbortController();
46
- const timeoutId = _optionalChain([options, 'optionalAccess', _3 => _3.signal]) ? void 0 : setTimeout(() => controller.abort(), this.timeout);
47
- const signal = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _4 => _4.signal]), () => ( controller.signal));
48
- try {
49
- const response = await fetch(url.toString(), {
50
- method,
51
- headers,
52
- body: _optionalChain([options, 'optionalAccess', _5 => _5.body]) !== void 0 ? JSON.stringify(options.body) : void 0,
53
- signal
54
- });
55
- clearTimeout(timeoutId);
56
- if (response.ok) {
57
- if (response.status === 204) {
58
- return void 0;
59
- }
60
- return await response.json();
61
- }
62
- const shouldRetry = response.status === 429 && attempt < this.maxRetries;
63
- if (shouldRetry) {
64
- continue;
65
- }
66
- let errorBody;
67
- try {
68
- errorBody = await response.json();
69
- } catch (e) {
70
- }
71
- const raw = typeof errorBody === "object" && errorBody !== null ? "message" in errorBody ? errorBody.message : "detail" in errorBody ? errorBody.detail : void 0 : void 0;
72
- const message = raw === void 0 ? `HTTP ${response.status}` : typeof raw === "string" ? raw : JSON.stringify(raw);
73
- throw new BrowserUseError(response.status, message, errorBody);
74
- } catch (error) {
75
- clearTimeout(timeoutId);
76
- throw error;
77
- }
78
- }
79
- throw new Error("Unreachable: retry loop exhausted");
80
- }
81
- get(path, query) {
82
- return this.request("GET", path, { query });
83
- }
84
- post(path, body, query) {
85
- return this.request("POST", path, { body, query });
86
- }
87
- patch(path, body, query) {
88
- return this.request("PATCH", path, { body, query });
89
- }
90
- delete(path, query) {
91
- return this.request("DELETE", path, { query });
92
- }
93
- };
94
-
95
-
96
-
97
-
98
- exports.BrowserUseError = BrowserUseError; exports.HttpClient = HttpClient;
99
- //# sourceMappingURL=chunk-JT4IL3IZ.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/sauravpanda/Github/LLMs/Browser-Use/sdk/browser-use-node/dist/chunk-JT4IL3IZ.cjs","../src/core/errors.ts","../src/core/http.ts"],"names":[],"mappings":"AAAA;ACAO,IAAM,gBAAA,EAAN,MAAA,QAA8B,MAAM;AAAA,EAChC;AAAA,EACA;AAAA,EAET,WAAA,CAAY,UAAA,EAAoB,OAAA,EAAiB,MAAA,EAAkB;AACjE,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,KAAA,EAAO,iBAAA;AACZ,IAAA,IAAA,CAAK,WAAA,EAAa,UAAA;AAClB,IAAA,IAAA,CAAK,OAAA,EAAS,MAAA;AAAA,EAChB;AACF,CAAA;ADCA;AACA;AEHO,IAAM,WAAA,EAAN,MAAiB;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,WAAA,CAAY,OAAA,EAA4B;AACtC,IAAA,IAAA,CAAK,OAAA,EAAS,OAAA,CAAQ,MAAA;AACtB,IAAA,IAAA,CAAK,QAAA,EAAU,OAAA,CAAQ,OAAA,CAAQ,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA;AACjD,IAAA,IAAA,CAAK,WAAA,mBAAa,OAAA,CAAQ,UAAA,UAAc,GAAA;AACxC,IAAA,IAAA,CAAK,QAAA,mBAAU,OAAA,CAAQ,OAAA,UAAW,KAAA;AAAA,EACpC;AAAA,EAEA,MAAM,OAAA,CACJ,MAAA,EACA,IAAA,EACA,OAAA,EAKY;AACZ,IAAA,MAAM,IAAA,EAAM,IAAI,GAAA,CAAI,CAAA,EAAA;AACA,IAAA;AACD,MAAA;AACD,QAAA;AACR,UAAA;AACN,QAAA;AACF,MAAA;AACF,IAAA;AAEwC,IAAA;AACtC,MAAA;AACF,IAAA;AACa,IAAA;AACH,MAAA;AACV,IAAA;AAEmB,IAAA;AACA,MAAA;AACD,QAAA;AACJ,QAAA;AACZ,MAAA;AAEmB,MAAA;AACD,MAAA;AAKH,MAAA;AAEX,MAAA;AACe,QAAA;AACf,UAAA;AACA,UAAA;AACe,UAAA;AACf,UAAA;AACD,QAAA;AAEY,QAAA;AAEI,QAAA;AACF,UAAA;AACJ,YAAA;AACT,UAAA;AACc,UAAA;AAChB,QAAA;AAEM,QAAA;AAIW,QAAA;AACf,UAAA;AACF,QAAA;AAEI,QAAA;AACA,QAAA;AACU,UAAA;AACN,QAAA;AAER,QAAA;AAEE,QAAA;AAQA,QAAA;AAKQ,QAAA;AACI,MAAA;AACD,QAAA;AACP,QAAA;AACR,MAAA;AACF,IAAA;AAEgB,IAAA;AAClB,EAAA;AAEkE,EAAA;AACzC,IAAA;AACzB,EAAA;AAEsC,EAAA;AACb,IAAA;AACzB,EAAA;AAEuC,EAAA;AACd,IAAA;AACzB,EAAA;AAEqE,EAAA;AAC5C,IAAA;AACzB,EAAA;AACF;AFtCyB;AACA;AACA;AACA;AACA","file":"/Users/sauravpanda/Github/LLMs/Browser-Use/sdk/browser-use-node/dist/chunk-JT4IL3IZ.cjs","sourcesContent":[null,"export class BrowserUseError extends Error {\n readonly statusCode: number;\n readonly detail: unknown;\n\n constructor(statusCode: number, message: string, detail?: unknown) {\n super(message);\n this.name = \"BrowserUseError\";\n this.statusCode = statusCode;\n this.detail = detail;\n }\n}\n","import { BrowserUseError } from \"./errors.js\";\n\nexport interface HttpClientOptions {\n apiKey: string;\n baseUrl: string;\n maxRetries?: number;\n timeout?: number;\n}\n\nexport class HttpClient {\n private readonly apiKey: string;\n private readonly baseUrl: string;\n private readonly maxRetries: number;\n private readonly timeout: number;\n\n constructor(options: HttpClientOptions) {\n this.apiKey = options.apiKey;\n this.baseUrl = options.baseUrl.replace(/\\/+$/, \"\");\n this.maxRetries = options.maxRetries ?? 3;\n this.timeout = options.timeout ?? 30_000;\n }\n\n async request<T>(\n method: string,\n path: string,\n options?: {\n body?: unknown;\n query?: Record<string, unknown>;\n signal?: AbortSignal;\n },\n ): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n if (options?.query) {\n for (const [key, value] of Object.entries(options.query)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n const headers: Record<string, string> = {\n \"X-Browser-Use-API-Key\": this.apiKey,\n };\n if (options?.body !== undefined) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n for (let attempt = 0; attempt <= this.maxRetries; attempt++) {\n if (attempt > 0) {\n const delay = Math.min(1000 * 2 ** (attempt - 1), 10_000);\n await new Promise((resolve) => setTimeout(resolve, delay));\n }\n\n const controller = new AbortController();\n const timeoutId = options?.signal\n ? undefined\n : setTimeout(() => controller.abort(), this.timeout);\n\n // Combine user signal with internal timeout when both are present\n const signal = options?.signal ?? controller.signal;\n\n try {\n const response = await fetch(url.toString(), {\n method,\n headers,\n body: options?.body !== undefined ? JSON.stringify(options.body) : undefined,\n signal,\n });\n\n clearTimeout(timeoutId);\n\n if (response.ok) {\n if (response.status === 204) {\n return undefined as T;\n }\n return (await response.json()) as T;\n }\n\n const shouldRetry =\n response.status === 429 &&\n attempt < this.maxRetries;\n\n if (shouldRetry) {\n continue;\n }\n\n let errorBody: unknown;\n try {\n errorBody = await response.json();\n } catch {\n /* ignore parse errors */\n }\n const raw =\n typeof errorBody === \"object\" && errorBody !== null\n ? \"message\" in errorBody\n ? (errorBody as Record<string, unknown>).message\n : \"detail\" in errorBody\n ? (errorBody as Record<string, unknown>).detail\n : undefined\n : undefined;\n const message =\n raw === undefined\n ? `HTTP ${response.status}`\n : typeof raw === \"string\"\n ? raw\n : JSON.stringify(raw);\n throw new BrowserUseError(response.status, message, errorBody);\n } catch (error) {\n clearTimeout(timeoutId);\n throw error;\n }\n }\n\n throw new Error(\"Unreachable: retry loop exhausted\");\n }\n\n get<T>(path: string, query?: Record<string, unknown>): Promise<T> {\n return this.request<T>(\"GET\", path, { query });\n }\n\n post<T>(path: string, body?: unknown, query?: Record<string, unknown>): Promise<T> {\n return this.request<T>(\"POST\", path, { body, query });\n }\n\n patch<T>(path: string, body?: unknown, query?: Record<string, unknown>): Promise<T> {\n return this.request<T>(\"PATCH\", path, { body, query });\n }\n\n delete<T>(path: string, query?: Record<string, unknown>): Promise<T> {\n return this.request<T>(\"DELETE\", path, { query });\n }\n}\n"]}
@@ -1,30 +0,0 @@
1
- interface HttpClientOptions {
2
- apiKey: string;
3
- baseUrl: string;
4
- maxRetries?: number;
5
- timeout?: number;
6
- }
7
- declare class HttpClient {
8
- private readonly apiKey;
9
- private readonly baseUrl;
10
- private readonly maxRetries;
11
- private readonly timeout;
12
- constructor(options: HttpClientOptions);
13
- request<T>(method: string, path: string, options?: {
14
- body?: unknown;
15
- query?: Record<string, unknown>;
16
- signal?: AbortSignal;
17
- }): Promise<T>;
18
- get<T>(path: string, query?: Record<string, unknown>): Promise<T>;
19
- post<T>(path: string, body?: unknown, query?: Record<string, unknown>): Promise<T>;
20
- patch<T>(path: string, body?: unknown, query?: Record<string, unknown>): Promise<T>;
21
- delete<T>(path: string, query?: Record<string, unknown>): Promise<T>;
22
- }
23
-
24
- declare class BrowserUseError extends Error {
25
- readonly statusCode: number;
26
- readonly detail: unknown;
27
- constructor(statusCode: number, message: string, detail?: unknown);
28
- }
29
-
30
- export { BrowserUseError as B, HttpClient as H };
@@ -1,30 +0,0 @@
1
- interface HttpClientOptions {
2
- apiKey: string;
3
- baseUrl: string;
4
- maxRetries?: number;
5
- timeout?: number;
6
- }
7
- declare class HttpClient {
8
- private readonly apiKey;
9
- private readonly baseUrl;
10
- private readonly maxRetries;
11
- private readonly timeout;
12
- constructor(options: HttpClientOptions);
13
- request<T>(method: string, path: string, options?: {
14
- body?: unknown;
15
- query?: Record<string, unknown>;
16
- signal?: AbortSignal;
17
- }): Promise<T>;
18
- get<T>(path: string, query?: Record<string, unknown>): Promise<T>;
19
- post<T>(path: string, body?: unknown, query?: Record<string, unknown>): Promise<T>;
20
- patch<T>(path: string, body?: unknown, query?: Record<string, unknown>): Promise<T>;
21
- delete<T>(path: string, query?: Record<string, unknown>): Promise<T>;
22
- }
23
-
24
- declare class BrowserUseError extends Error {
25
- readonly statusCode: number;
26
- readonly detail: unknown;
27
- constructor(statusCode: number, message: string, detail?: unknown);
28
- }
29
-
30
- export { BrowserUseError as B, HttpClient as H };