browser-use-sdk 3.0.3 → 3.2.0

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/v3.d.ts CHANGED
@@ -38,6 +38,11 @@ interface components {
38
38
  FileListResponse: {
39
39
  /** Files */
40
40
  files: components["schemas"]["FileInfo"][];
41
+ /**
42
+ * Folders
43
+ * @description Immediate sub-folder names at this prefix level
44
+ */
45
+ folders?: string[];
41
46
  /** Nextcursor */
42
47
  nextCursor?: string | null;
43
48
  /**
@@ -46,11 +51,95 @@ interface components {
46
51
  */
47
52
  hasMore: boolean;
48
53
  };
54
+ /**
55
+ * FileUploadItem
56
+ * @description A single file to upload.
57
+ */
58
+ FileUploadItem: {
59
+ /**
60
+ * Name
61
+ * @description Filename, e.g. "data.csv"
62
+ */
63
+ name: string;
64
+ /**
65
+ * Contenttype
66
+ * @description MIME type, e.g. "text/csv"
67
+ * @default application/octet-stream
68
+ */
69
+ contentType: string;
70
+ /**
71
+ * Size
72
+ * @description File size in bytes (required for workspace uploads)
73
+ */
74
+ size?: number | null;
75
+ };
76
+ /**
77
+ * FileUploadRequest
78
+ * @description Request body for generating presigned upload URLs.
79
+ */
80
+ FileUploadRequest: {
81
+ /** Files */
82
+ files: components["schemas"]["FileUploadItem"][];
83
+ };
84
+ /**
85
+ * FileUploadResponse
86
+ * @description Presigned upload URLs for the requested files.
87
+ */
88
+ FileUploadResponse: {
89
+ /** Files */
90
+ files: components["schemas"]["FileUploadResponseItem"][];
91
+ };
92
+ /**
93
+ * FileUploadResponseItem
94
+ * @description Presigned upload URL for a single file.
95
+ */
96
+ FileUploadResponseItem: {
97
+ /** Name */
98
+ name: string;
99
+ /** Uploadurl */
100
+ uploadUrl: string;
101
+ /**
102
+ * Path
103
+ * @description S3-relative path, e.g. "uploads/data.csv"
104
+ */
105
+ path: string;
106
+ };
49
107
  /** HTTPValidationError */
50
108
  HTTPValidationError: {
51
109
  /** Detail */
52
110
  detail?: components["schemas"]["ValidationError"][];
53
111
  };
112
+ /** MessageListResponse */
113
+ MessageListResponse: {
114
+ /** Messages */
115
+ messages: components["schemas"]["MessageResponse"][];
116
+ /** Hasmore */
117
+ hasMore: boolean;
118
+ };
119
+ /** MessageResponse */
120
+ MessageResponse: {
121
+ /**
122
+ * Id
123
+ * Format: uuid
124
+ */
125
+ id: string;
126
+ /**
127
+ * Sessionid
128
+ * Format: uuid
129
+ */
130
+ sessionId: string;
131
+ /** Role */
132
+ role: string;
133
+ /** Data */
134
+ data: string;
135
+ /** Hidden */
136
+ hidden: boolean;
137
+ /**
138
+ * Createdat
139
+ * Format: date-time
140
+ */
141
+ createdAt: string;
142
+ };
54
143
  /**
55
144
  * ProxyCountryCode
56
145
  * @enum {string}
@@ -60,12 +149,14 @@ interface components {
60
149
  * RunTaskRequest
61
150
  * @description Unified request for creating a session or dispatching a task.
62
151
  *
63
- * - Without session_id: creates a new session + dispatches the task
64
- * - With session_id: dispatches the task to an existing session
152
+ * - Without session_id + without task: creates a new idle session (for file uploads, etc.)
153
+ * - Without session_id + with task: creates a new session and dispatches the task
154
+ * - With session_id + with task: dispatches the task to an existing idle session
155
+ * - With session_id + without task: 422 (task required when dispatching to existing session)
65
156
  */
66
157
  RunTaskRequest: {
67
158
  /** Task */
68
- task: string;
159
+ task?: string | null;
69
160
  /** @default bu-mini */
70
161
  model: components["schemas"]["BuModel"];
71
162
  /** Sessionid */
@@ -79,6 +170,8 @@ interface components {
79
170
  maxCostUsd?: number | string | null;
80
171
  /** Profileid */
81
172
  profileId?: string | null;
173
+ /** Workspaceid */
174
+ workspaceId?: string | null;
82
175
  proxyCountryCode?: components["schemas"]["ProxyCountryCode"] | null;
83
176
  /** Outputschema */
84
177
  outputSchema?: {
@@ -109,10 +202,16 @@ interface components {
109
202
  title?: string | null;
110
203
  /** Output */
111
204
  output?: unknown | null;
205
+ /** Outputschema */
206
+ outputSchema?: {
207
+ [key: string]: unknown;
208
+ } | null;
112
209
  /** Liveurl */
113
210
  liveUrl?: string | null;
114
211
  /** Profileid */
115
212
  profileId?: string | null;
213
+ /** Workspaceid */
214
+ workspaceId?: string | null;
116
215
  proxyCountryCode?: components["schemas"]["ProxyCountryCode"] | null;
117
216
  /** Maxcostusd */
118
217
  maxCostUsd?: string | null;
@@ -157,6 +256,16 @@ interface components {
157
256
  */
158
257
  updatedAt: string;
159
258
  };
259
+ /** StopSessionRequest */
260
+ StopSessionRequest: {
261
+ /** @default session */
262
+ strategy: components["schemas"]["StopStrategy"];
263
+ };
264
+ /**
265
+ * StopStrategy
266
+ * @enum {string}
267
+ */
268
+ StopStrategy: "task" | "session";
160
269
  /** ValidationError */
161
270
  ValidationError: {
162
271
  /** Location */
@@ -166,6 +275,83 @@ interface components {
166
275
  /** Error Type */
167
276
  type: string;
168
277
  };
278
+ /**
279
+ * WorkspaceCreateRequest
280
+ * @description Request model for creating a new workspace.
281
+ */
282
+ WorkspaceCreateRequest: {
283
+ /**
284
+ * Name
285
+ * @description Optional name for the workspace
286
+ */
287
+ name?: string | null;
288
+ };
289
+ /**
290
+ * WorkspaceListResponse
291
+ * @description Response model for paginated workspace list requests.
292
+ */
293
+ WorkspaceListResponse: {
294
+ /**
295
+ * Items
296
+ * @description List of workspace views for the current page
297
+ */
298
+ items: components["schemas"]["WorkspaceView"][];
299
+ /**
300
+ * Total Items
301
+ * @description Total number of items in the list
302
+ */
303
+ totalItems: number;
304
+ /**
305
+ * Page Number
306
+ * @description Page number
307
+ */
308
+ pageNumber: number;
309
+ /**
310
+ * Page Size
311
+ * @description Number of items per page
312
+ */
313
+ pageSize: number;
314
+ };
315
+ /**
316
+ * WorkspaceUpdateRequest
317
+ * @description Request model for updating a workspace.
318
+ */
319
+ WorkspaceUpdateRequest: {
320
+ /**
321
+ * Name
322
+ * @description Optional name for the workspace
323
+ */
324
+ name?: string | null;
325
+ };
326
+ /**
327
+ * WorkspaceView
328
+ * @description View model for a workspace — persistent shared storage across sessions.
329
+ */
330
+ WorkspaceView: {
331
+ /**
332
+ * ID
333
+ * Format: uuid
334
+ * @description Unique identifier for the workspace
335
+ */
336
+ id: string;
337
+ /**
338
+ * Name
339
+ * @description Optional name for the workspace
340
+ */
341
+ name?: string | null;
342
+ /**
343
+ * Created At
344
+ * Format: date-time
345
+ * @description Timestamp when the workspace was created
346
+ */
347
+ createdAt: string;
348
+ /**
349
+ * Updated At
350
+ * Format: date-time
351
+ * @description Timestamp when the workspace was last updated
352
+ */
353
+ updatedAt: string;
354
+ };
169
355
  };
170
356
  responses: never;
171
357
  parameters: never;
@@ -175,11 +361,15 @@ interface components {
175
361
  }
176
362
 
177
363
  type RunTaskRequest$2 = components["schemas"]["RunTaskRequest"];
178
- /** Like RunTaskRequest but only `task` is required; fields with server defaults are optional. */
179
- type CreateSessionBody = Pick<RunTaskRequest$2, "task"> & Partial<Omit<RunTaskRequest$2, "task">>;
364
+ /** All fields optional omit `task` to create an idle session. */
365
+ type CreateSessionBody = Partial<RunTaskRequest$2>;
180
366
  type SessionResponse$2 = components["schemas"]["SessionResponse"];
181
367
  type SessionListResponse$1 = components["schemas"]["SessionListResponse"];
182
- type FileListResponse$1 = components["schemas"]["FileListResponse"];
368
+ type FileListResponse$2 = components["schemas"]["FileListResponse"];
369
+ type StopSessionRequest$1 = components["schemas"]["StopSessionRequest"];
370
+ type FileUploadRequest$2 = components["schemas"]["FileUploadRequest"];
371
+ type FileUploadResponse$2 = components["schemas"]["FileUploadResponse"];
372
+ type MessageListResponse$1 = components["schemas"]["MessageListResponse"];
183
373
  interface SessionListParams {
184
374
  page?: number;
185
375
  page_size?: number;
@@ -189,20 +379,75 @@ interface SessionFilesParams {
189
379
  limit?: number;
190
380
  cursor?: string | null;
191
381
  includeUrls?: boolean;
382
+ shallow?: boolean;
383
+ }
384
+ interface SessionMessagesParams {
385
+ after?: string | null;
386
+ before?: string | null;
387
+ limit?: number;
192
388
  }
193
389
  declare class Sessions {
194
390
  private readonly http;
195
391
  constructor(http: HttpClient);
196
- /** Create a session and run a task. */
197
- create(body: CreateSessionBody): Promise<SessionResponse$2>;
392
+ /** Create a session and optionally dispatch a task. */
393
+ create(body?: CreateSessionBody): Promise<SessionResponse$2>;
198
394
  /** List sessions for the authenticated project. */
199
395
  list(params?: SessionListParams): Promise<SessionListResponse$1>;
200
396
  /** Get session details. */
201
397
  get(sessionId: string): Promise<SessionResponse$2>;
202
- /** Stop a session. */
203
- stop(sessionId: string): Promise<SessionResponse$2>;
398
+ /** Stop a session or the running task. */
399
+ stop(sessionId: string, body?: StopSessionRequest$1): Promise<SessionResponse$2>;
400
+ /** Soft-delete a session. */
401
+ delete(sessionId: string): Promise<void>;
402
+ /** Get presigned upload URLs for session files. */
403
+ uploadFiles(sessionId: string, body: FileUploadRequest$2): Promise<FileUploadResponse$2>;
204
404
  /** List files in a session's workspace. */
205
- files(sessionId: string, params?: SessionFilesParams): Promise<FileListResponse$1>;
405
+ files(sessionId: string, params?: SessionFilesParams): Promise<FileListResponse$2>;
406
+ /** List messages for a session with cursor-based pagination. */
407
+ messages(sessionId: string, params?: SessionMessagesParams): Promise<MessageListResponse$1>;
408
+ }
409
+
410
+ type WorkspaceView$1 = components["schemas"]["WorkspaceView"];
411
+ type WorkspaceListResponse$1 = components["schemas"]["WorkspaceListResponse"];
412
+ type WorkspaceCreateRequest$1 = components["schemas"]["WorkspaceCreateRequest"];
413
+ type WorkspaceUpdateRequest$1 = components["schemas"]["WorkspaceUpdateRequest"];
414
+ type FileListResponse$1 = components["schemas"]["FileListResponse"];
415
+ type FileUploadRequest$1 = components["schemas"]["FileUploadRequest"];
416
+ type FileUploadResponse$1 = components["schemas"]["FileUploadResponse"];
417
+ interface WorkspaceListParams {
418
+ pageSize?: number;
419
+ pageNumber?: number;
420
+ }
421
+ interface WorkspaceFilesParams {
422
+ prefix?: string;
423
+ limit?: number;
424
+ cursor?: string | null;
425
+ includeUrls?: boolean;
426
+ shallow?: boolean;
427
+ }
428
+ declare class Workspaces {
429
+ private readonly http;
430
+ constructor(http: HttpClient);
431
+ /** List workspaces for the authenticated project. */
432
+ list(params?: WorkspaceListParams): Promise<WorkspaceListResponse$1>;
433
+ /** Create a new workspace. */
434
+ create(body?: WorkspaceCreateRequest$1): Promise<WorkspaceView$1>;
435
+ /** Get workspace details. */
436
+ get(workspaceId: string): Promise<WorkspaceView$1>;
437
+ /** Update a workspace. */
438
+ update(workspaceId: string, body: WorkspaceUpdateRequest$1): Promise<WorkspaceView$1>;
439
+ /** Delete a workspace and its data. */
440
+ delete(workspaceId: string): Promise<void>;
441
+ /** List files in a workspace. */
442
+ files(workspaceId: string, params?: WorkspaceFilesParams): Promise<FileListResponse$1>;
443
+ /** Get presigned upload URLs for workspace files. */
444
+ uploadFiles(workspaceId: string, body: FileUploadRequest$1, query?: {
445
+ prefix?: string;
446
+ }): Promise<FileUploadResponse$1>;
447
+ /** Delete a file from a workspace. */
448
+ deleteFile(workspaceId: string, path: string): Promise<void>;
449
+ /** Get storage usage for a workspace. */
450
+ size(workspaceId: string): Promise<unknown>;
206
451
  }
207
452
 
208
453
  type SessionResponse$1 = components["schemas"]["SessionResponse"];
@@ -253,6 +498,7 @@ type RunSessionOptions = Partial<Omit<RunTaskRequest$1, "task">> & RunOptions &
253
498
  };
254
499
  declare class BrowserUse {
255
500
  readonly sessions: Sessions;
501
+ readonly workspaces: Workspaces;
256
502
  private readonly http;
257
503
  constructor(options?: BrowserUseOptions);
258
504
  /**
@@ -279,9 +525,21 @@ type SessionResponse = S["SessionResponse"];
279
525
  type SessionListResponse = S["SessionListResponse"];
280
526
  type FileListResponse = S["FileListResponse"];
281
527
  type FileInfo = S["FileInfo"];
528
+ type FileUploadResponse = S["FileUploadResponse"];
529
+ type FileUploadResponseItem = S["FileUploadResponseItem"];
530
+ type MessageListResponse = S["MessageListResponse"];
531
+ type MessageResponse = S["MessageResponse"];
532
+ type WorkspaceView = S["WorkspaceView"];
533
+ type WorkspaceListResponse = S["WorkspaceListResponse"];
282
534
  type RunTaskRequest = S["RunTaskRequest"];
535
+ type StopSessionRequest = S["StopSessionRequest"];
536
+ type FileUploadRequest = S["FileUploadRequest"];
537
+ type FileUploadItem = S["FileUploadItem"];
538
+ type WorkspaceCreateRequest = S["WorkspaceCreateRequest"];
539
+ type WorkspaceUpdateRequest = S["WorkspaceUpdateRequest"];
283
540
  type BuAgentSessionStatus = S["BuAgentSessionStatus"];
284
541
  type BuModel = S["BuModel"];
285
542
  type ProxyCountryCode = S["ProxyCountryCode"];
543
+ type StopStrategy = S["StopStrategy"];
286
544
 
287
- export { BrowserUse, type BrowserUseOptions, type BuAgentSessionStatus, type BuModel, type CreateSessionBody, type FileInfo, type FileListResponse, type ProxyCountryCode, type RunOptions, type RunSessionOptions, type RunTaskRequest, type SessionFilesParams, type SessionListParams, type SessionListResponse, type SessionResponse, type SessionResult, SessionRun, Sessions, type components as V3Types };
545
+ export { BrowserUse, type BrowserUseOptions, type BuAgentSessionStatus, type BuModel, type CreateSessionBody, type FileInfo, type FileListResponse, type FileUploadItem, type FileUploadRequest, type FileUploadResponse, type FileUploadResponseItem, type MessageListResponse, type MessageResponse, type ProxyCountryCode, type RunOptions, type RunSessionOptions, type RunTaskRequest, type SessionFilesParams, type SessionListParams, type SessionListResponse, type SessionMessagesParams, type SessionResponse, type SessionResult, SessionRun, Sessions, type StopSessionRequest, type StopStrategy, type components as V3Types, type WorkspaceCreateRequest, type WorkspaceFilesParams, type WorkspaceListParams, type WorkspaceListResponse, type WorkspaceUpdateRequest, type WorkspaceView, Workspaces };
package/dist/v3.js CHANGED
@@ -11,7 +11,7 @@ var Sessions = class {
11
11
  constructor(http) {
12
12
  this.http = http;
13
13
  }
14
- /** Create a session and run a task. */
14
+ /** Create a session and optionally dispatch a task. */
15
15
  create(body) {
16
16
  return this.http.post("/sessions", body);
17
17
  }
@@ -23,9 +23,17 @@ var Sessions = class {
23
23
  get(sessionId) {
24
24
  return this.http.get(`/sessions/${sessionId}`);
25
25
  }
26
- /** Stop a session. */
27
- stop(sessionId) {
28
- return this.http.post(`/sessions/${sessionId}/stop`);
26
+ /** Stop a session or the running task. */
27
+ stop(sessionId, body) {
28
+ return this.http.post(`/sessions/${sessionId}/stop`, body);
29
+ }
30
+ /** Soft-delete a session. */
31
+ delete(sessionId) {
32
+ return this.http.delete(`/sessions/${sessionId}`);
33
+ }
34
+ /** Get presigned upload URLs for session files. */
35
+ uploadFiles(sessionId, body) {
36
+ return this.http.post(`/sessions/${sessionId}/files/upload`, body);
29
37
  }
30
38
  /** List files in a session's workspace. */
31
39
  files(sessionId, params) {
@@ -34,6 +42,63 @@ var Sessions = class {
34
42
  params
35
43
  );
36
44
  }
45
+ /** List messages for a session with cursor-based pagination. */
46
+ messages(sessionId, params) {
47
+ return this.http.get(
48
+ `/sessions/${sessionId}/messages`,
49
+ params
50
+ );
51
+ }
52
+ };
53
+
54
+ // src/v3/resources/workspaces.ts
55
+ var Workspaces = class {
56
+ constructor(http) {
57
+ this.http = http;
58
+ }
59
+ /** List workspaces for the authenticated project. */
60
+ list(params) {
61
+ return this.http.get("/workspaces", params);
62
+ }
63
+ /** Create a new workspace. */
64
+ create(body) {
65
+ return this.http.post("/workspaces", body);
66
+ }
67
+ /** Get workspace details. */
68
+ get(workspaceId) {
69
+ return this.http.get(`/workspaces/${workspaceId}`);
70
+ }
71
+ /** Update a workspace. */
72
+ update(workspaceId, body) {
73
+ return this.http.patch(`/workspaces/${workspaceId}`, body);
74
+ }
75
+ /** Delete a workspace and its data. */
76
+ delete(workspaceId) {
77
+ return this.http.delete(`/workspaces/${workspaceId}`);
78
+ }
79
+ /** List files in a workspace. */
80
+ files(workspaceId, params) {
81
+ return this.http.get(
82
+ `/workspaces/${workspaceId}/files`,
83
+ params
84
+ );
85
+ }
86
+ /** Get presigned upload URLs for workspace files. */
87
+ uploadFiles(workspaceId, body, query) {
88
+ return this.http.post(
89
+ `/workspaces/${workspaceId}/files/upload`,
90
+ body,
91
+ query
92
+ );
93
+ }
94
+ /** Delete a file from a workspace. */
95
+ deleteFile(workspaceId, path) {
96
+ return this.http.delete(`/workspaces/${workspaceId}/files`, { path });
97
+ }
98
+ /** Get storage usage for a workspace. */
99
+ size(workspaceId) {
100
+ return this.http.get(`/workspaces/${workspaceId}/size`);
101
+ }
37
102
  };
38
103
 
39
104
  // src/v3/helpers.ts
@@ -105,6 +170,7 @@ var SessionRun = class {
105
170
  var DEFAULT_BASE_URL = "https://api.browser-use.com/api/v3";
106
171
  var BrowserUse = class {
107
172
  sessions;
173
+ workspaces;
108
174
  http;
109
175
  constructor(options = {}) {
110
176
  const apiKey = options.apiKey ?? process.env.BROWSER_USE_API_KEY ?? "";
@@ -120,6 +186,7 @@ var BrowserUse = class {
120
186
  timeout: options.timeout
121
187
  });
122
188
  this.sessions = new Sessions(this.http);
189
+ this.workspaces = new Workspaces(this.http);
123
190
  }
124
191
  run(task, options) {
125
192
  const { schema, timeout, interval, ...rest } = options ?? {};
@@ -135,6 +202,7 @@ export {
135
202
  BrowserUse,
136
203
  BrowserUseError,
137
204
  SessionRun,
138
- Sessions
205
+ Sessions,
206
+ Workspaces
139
207
  };
140
208
  //# sourceMappingURL=v3.js.map
package/dist/v3.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/v3/client.ts","../src/v3/resources/sessions.ts","../src/v3/helpers.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { HttpClient } from \"../core/http.js\";\nimport { Sessions } from \"./resources/sessions.js\";\nimport { SessionRun } from \"./helpers.js\";\nimport type { components } from \"../generated/v3/types.js\";\nimport type { RunOptions } from \"./helpers.js\";\n\ntype RunTaskRequest = components[\"schemas\"][\"RunTaskRequest\"];\n\nconst DEFAULT_BASE_URL = \"https://api.browser-use.com/api/v3\";\n\nexport interface BrowserUseOptions {\n apiKey?: string;\n baseUrl?: string;\n maxRetries?: number;\n timeout?: number;\n}\n\nexport type RunSessionOptions = Partial<Omit<RunTaskRequest, \"task\">> &\n RunOptions & { schema?: z.ZodType };\n\nexport class BrowserUse {\n readonly sessions: Sessions;\n\n private readonly http: HttpClient;\n\n constructor(options: BrowserUseOptions = {}) {\n const apiKey =\n options.apiKey ?? process.env.BROWSER_USE_API_KEY ?? \"\";\n if (!apiKey) {\n throw new Error(\n \"No API key provided. Pass apiKey or set BROWSER_USE_API_KEY.\",\n );\n }\n this.http = new HttpClient({\n apiKey,\n baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,\n maxRetries: options.maxRetries,\n timeout: options.timeout,\n });\n\n this.sessions = new Sessions(this.http);\n }\n\n /**\n * Create a session and run a task. `await` the result for a typed SessionResult.\n *\n * ```ts\n * // Simple — just get the output\n * const result = await client.run(\"Find the top HN post\");\n * console.log(result.output);\n *\n * // Structured output (Zod)\n * const result = await client.run(\"Find product info\", { schema: ProductSchema });\n * console.log(result.output.name); // fully typed\n * ```\n */\n run(task: string, options?: Omit<RunSessionOptions, \"schema\">): SessionRun<string>;\n run<T extends z.ZodType>(task: string, options: RunSessionOptions & { schema: T }): SessionRun<z.output<T>>;\n run(task: string, options?: RunSessionOptions): SessionRun<any> {\n const { schema, timeout, interval, ...rest } = options ?? {};\n const body = { task, ...rest } as RunTaskRequest;\n if (schema) {\n body.outputSchema = z.toJSONSchema(schema) as Record<string, unknown>;\n }\n const promise = this.sessions.create(body);\n return new SessionRun(promise, this.sessions, schema, { timeout, interval });\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v3/types.js\";\n\ntype RunTaskRequest = components[\"schemas\"][\"RunTaskRequest\"];\n/** Like RunTaskRequest but only `task` is required; fields with server defaults are optional. */\nexport type CreateSessionBody = Pick<RunTaskRequest, \"task\"> & Partial<Omit<RunTaskRequest, \"task\">>;\ntype SessionResponse = components[\"schemas\"][\"SessionResponse\"];\ntype SessionListResponse = components[\"schemas\"][\"SessionListResponse\"];\ntype FileListResponse = components[\"schemas\"][\"FileListResponse\"];\n\nexport interface SessionListParams {\n page?: number;\n page_size?: number;\n}\n\nexport interface SessionFilesParams {\n prefix?: string;\n limit?: number;\n cursor?: string | null;\n includeUrls?: boolean;\n}\n\nexport class Sessions {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a session and run a task. */\n create(body: CreateSessionBody): Promise<SessionResponse> {\n return this.http.post<SessionResponse>(\"/sessions\", body);\n }\n\n /** List sessions for the authenticated project. */\n list(params?: SessionListParams): Promise<SessionListResponse> {\n return this.http.get<SessionListResponse>(\"/sessions\", params as Record<string, unknown>);\n }\n\n /** Get session details. */\n get(sessionId: string): Promise<SessionResponse> {\n return this.http.get<SessionResponse>(`/sessions/${sessionId}`);\n }\n\n /** Stop a session. */\n stop(sessionId: string): Promise<SessionResponse> {\n return this.http.post<SessionResponse>(`/sessions/${sessionId}/stop`);\n }\n\n /** List files in a session's workspace. */\n files(sessionId: string, params?: SessionFilesParams): Promise<FileListResponse> {\n return this.http.get<FileListResponse>(\n `/sessions/${sessionId}/files`,\n params as Record<string, unknown>,\n );\n }\n}\n","import type { z } from \"zod\";\nimport type { components } from \"../generated/v3/types.js\";\nimport type { Sessions } from \"./resources/sessions.js\";\n\ntype SessionResponse = components[\"schemas\"][\"SessionResponse\"];\n\nconst TERMINAL_STATUSES = new Set([\"idle\", \"stopped\", \"timed_out\", \"error\"]);\n\nexport interface RunOptions {\n /** Maximum time to wait in milliseconds. Default: 300_000 (5 min). */\n timeout?: number;\n /** Polling interval in milliseconds. Default: 2_000. */\n interval?: number;\n}\n\n/** Session result with typed output. All SessionResponse fields are directly accessible. */\nexport type SessionResult<T = string | null> = Omit<SessionResponse, \"output\"> & { output: T };\n\n/**\n * Dual-purpose session handle: `await` it for a typed SessionResult,\n * or access `.result` for the full SessionResult after resolution.\n */\nexport class SessionRun<T = string> implements PromiseLike<SessionResult<T>> {\n private readonly _createPromise: Promise<SessionResponse>;\n private readonly _sessions: Sessions;\n private readonly _schema?: z.ZodType<T>;\n private readonly _timeout: number;\n private readonly _interval: number;\n private _sessionId: string | null = null;\n private _result: SessionResult<T> | null = null;\n\n constructor(\n createPromise: Promise<SessionResponse>,\n sessions: Sessions,\n schema?: z.ZodType<T>,\n options?: RunOptions,\n ) {\n this._createPromise = createPromise;\n this._sessions = sessions;\n this._schema = schema;\n this._timeout = options?.timeout ?? 300_000;\n this._interval = options?.interval ?? 2_000;\n }\n\n /** The session ID, available after task creation resolves. */\n get sessionId(): string | null {\n return this._sessionId;\n }\n\n /** The full SessionResult, available after polling completes. */\n get result(): SessionResult<T> | null {\n return this._result;\n }\n\n /** Enable `await client.run(...)` — polls until terminal, returns SessionResult. */\n then<R1 = SessionResult<T>, R2 = never>(\n onFulfilled?:\n | ((value: SessionResult<T>) => R1 | PromiseLike<R1>)\n | null,\n onRejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null,\n ): Promise<R1 | R2> {\n return this._waitForOutput().then(onFulfilled, onRejected);\n }\n\n private async _ensureSessionId(): Promise<string> {\n if (this._sessionId) return this._sessionId;\n const created = await this._createPromise;\n this._sessionId = created.id;\n return this._sessionId;\n }\n\n /** Poll session until terminal, return SessionResult. */\n private async _waitForOutput(): Promise<SessionResult<T>> {\n const sessionId = await this._ensureSessionId();\n const deadline = Date.now() + this._timeout;\n\n while (Date.now() < deadline) {\n const session = await this._sessions.get(sessionId);\n if (TERMINAL_STATUSES.has(session.status)) {\n const { output, ...rest } = session;\n const parsed = this._parseOutput(output);\n this._result = { ...rest, output: parsed } as SessionResult<T>;\n return this._result;\n }\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) =>\n setTimeout(r, Math.min(this._interval, remaining)),\n );\n }\n\n throw new Error(\n `Session ${sessionId} did not complete within ${this._timeout}ms`,\n );\n }\n\n private _parseOutput(output: unknown): T {\n if (output == null) return null as T;\n if (!this._schema) return output as unknown as T;\n const raw = typeof output === \"string\" ? JSON.parse(output) : output;\n return this._schema.parse(raw);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,SAAS;;;ACsBX,IAAM,WAAN,MAAe;AAAA,EACpB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA,EAGhD,OAAO,MAAmD;AACxD,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AAS,KAAK,IAAI;AAAA,EACxC;AAAA,EAiBA,IAAI,MAAc,SAA8C;AAC9D,UAAM,EAAE,QAAQ,SAAS,UAAU,GAAG,KAAK,IAAI,WAAW,CAAC;AAC3D,UAAM,OAAO,EAAE,MAAM,GAAG,KAAK;AAC7B,QAAI,QAAQ;AACV,WAAK,eAAe,EAAE,aAAa,MAAM;AAAA,IAC3C;AACA,UAAM,UAAU,KAAK,SAAS,OAAO,IAAI;AACzC,WAAO,IAAI,WAAW,SAAS,KAAK,UAAU,QAAQ,EAAE,SAAS,SAAS,CAAC;AAAA,EAC7E;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/v3/client.ts","../src/v3/resources/sessions.ts","../src/v3/resources/workspaces.ts","../src/v3/helpers.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { HttpClient } from \"../core/http.js\";\nimport { Sessions } from \"./resources/sessions.js\";\nimport { Workspaces } from \"./resources/workspaces.js\";\nimport { SessionRun } from \"./helpers.js\";\nimport type { components } from \"../generated/v3/types.js\";\nimport type { RunOptions } from \"./helpers.js\";\n\ntype RunTaskRequest = components[\"schemas\"][\"RunTaskRequest\"];\n\nconst DEFAULT_BASE_URL = \"https://api.browser-use.com/api/v3\";\n\nexport interface BrowserUseOptions {\n apiKey?: string;\n baseUrl?: string;\n maxRetries?: number;\n timeout?: number;\n}\n\nexport type RunSessionOptions = Partial<Omit<RunTaskRequest, \"task\">> &\n RunOptions & { schema?: z.ZodType };\n\nexport class BrowserUse {\n readonly sessions: Sessions;\n readonly workspaces: Workspaces;\n\n private readonly http: HttpClient;\n\n constructor(options: BrowserUseOptions = {}) {\n const apiKey =\n options.apiKey ?? process.env.BROWSER_USE_API_KEY ?? \"\";\n if (!apiKey) {\n throw new Error(\n \"No API key provided. Pass apiKey or set BROWSER_USE_API_KEY.\",\n );\n }\n this.http = new HttpClient({\n apiKey,\n baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,\n maxRetries: options.maxRetries,\n timeout: options.timeout,\n });\n\n this.sessions = new Sessions(this.http);\n this.workspaces = new Workspaces(this.http);\n }\n\n /**\n * Create a session and run a task. `await` the result for a typed SessionResult.\n *\n * ```ts\n * // Simple — just get the output\n * const result = await client.run(\"Find the top HN post\");\n * console.log(result.output);\n *\n * // Structured output (Zod)\n * const result = await client.run(\"Find product info\", { schema: ProductSchema });\n * console.log(result.output.name); // fully typed\n * ```\n */\n run(task: string, options?: Omit<RunSessionOptions, \"schema\">): SessionRun<string>;\n run<T extends z.ZodType>(task: string, options: RunSessionOptions & { schema: T }): SessionRun<z.output<T>>;\n run(task: string, options?: RunSessionOptions): SessionRun<any> {\n const { schema, timeout, interval, ...rest } = options ?? {};\n const body = { task, ...rest } as RunTaskRequest;\n if (schema) {\n body.outputSchema = z.toJSONSchema(schema) as Record<string, unknown>;\n }\n const promise = this.sessions.create(body);\n return new SessionRun(promise, this.sessions, schema, { timeout, interval });\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v3/types.js\";\n\ntype RunTaskRequest = components[\"schemas\"][\"RunTaskRequest\"];\n/** All fields optional — omit `task` to create an idle session. */\nexport type CreateSessionBody = Partial<RunTaskRequest>;\ntype SessionResponse = components[\"schemas\"][\"SessionResponse\"];\ntype SessionListResponse = components[\"schemas\"][\"SessionListResponse\"];\ntype FileListResponse = components[\"schemas\"][\"FileListResponse\"];\ntype StopSessionRequest = components[\"schemas\"][\"StopSessionRequest\"];\ntype FileUploadRequest = components[\"schemas\"][\"FileUploadRequest\"];\ntype FileUploadResponse = components[\"schemas\"][\"FileUploadResponse\"];\ntype MessageListResponse = components[\"schemas\"][\"MessageListResponse\"];\n\nexport interface SessionListParams {\n page?: number;\n page_size?: number;\n}\n\nexport interface SessionFilesParams {\n prefix?: string;\n limit?: number;\n cursor?: string | null;\n includeUrls?: boolean;\n shallow?: boolean;\n}\n\nexport interface SessionMessagesParams {\n after?: string | null;\n before?: string | null;\n limit?: number;\n}\n\nexport class Sessions {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a session and optionally dispatch a task. */\n create(body?: CreateSessionBody): Promise<SessionResponse> {\n return this.http.post<SessionResponse>(\"/sessions\", body);\n }\n\n /** List sessions for the authenticated project. */\n list(params?: SessionListParams): Promise<SessionListResponse> {\n return this.http.get<SessionListResponse>(\"/sessions\", params as Record<string, unknown>);\n }\n\n /** Get session details. */\n get(sessionId: string): Promise<SessionResponse> {\n return this.http.get<SessionResponse>(`/sessions/${sessionId}`);\n }\n\n /** Stop a session or the running task. */\n stop(sessionId: string, body?: StopSessionRequest): Promise<SessionResponse> {\n return this.http.post<SessionResponse>(`/sessions/${sessionId}/stop`, body);\n }\n\n /** Soft-delete a session. */\n delete(sessionId: string): Promise<void> {\n return this.http.delete<void>(`/sessions/${sessionId}`);\n }\n\n /** Get presigned upload URLs for session files. */\n uploadFiles(sessionId: string, body: FileUploadRequest): Promise<FileUploadResponse> {\n return this.http.post<FileUploadResponse>(`/sessions/${sessionId}/files/upload`, body);\n }\n\n /** List files in a session's workspace. */\n files(sessionId: string, params?: SessionFilesParams): Promise<FileListResponse> {\n return this.http.get<FileListResponse>(\n `/sessions/${sessionId}/files`,\n params as Record<string, unknown>,\n );\n }\n\n /** List messages for a session with cursor-based pagination. */\n messages(sessionId: string, params?: SessionMessagesParams): Promise<MessageListResponse> {\n return this.http.get<MessageListResponse>(\n `/sessions/${sessionId}/messages`,\n params as Record<string, unknown>,\n );\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v3/types.js\";\n\ntype WorkspaceView = components[\"schemas\"][\"WorkspaceView\"];\ntype WorkspaceListResponse = components[\"schemas\"][\"WorkspaceListResponse\"];\ntype WorkspaceCreateRequest = components[\"schemas\"][\"WorkspaceCreateRequest\"];\ntype WorkspaceUpdateRequest = components[\"schemas\"][\"WorkspaceUpdateRequest\"];\ntype FileListResponse = components[\"schemas\"][\"FileListResponse\"];\ntype FileUploadRequest = components[\"schemas\"][\"FileUploadRequest\"];\ntype FileUploadResponse = components[\"schemas\"][\"FileUploadResponse\"];\n\nexport interface WorkspaceListParams {\n pageSize?: number;\n pageNumber?: number;\n}\n\nexport interface WorkspaceFilesParams {\n prefix?: string;\n limit?: number;\n cursor?: string | null;\n includeUrls?: boolean;\n shallow?: boolean;\n}\n\nexport class Workspaces {\n constructor(private readonly http: HttpClient) {}\n\n /** List workspaces for the authenticated project. */\n list(params?: WorkspaceListParams): Promise<WorkspaceListResponse> {\n return this.http.get<WorkspaceListResponse>(\"/workspaces\", params as Record<string, unknown>);\n }\n\n /** Create a new workspace. */\n create(body?: WorkspaceCreateRequest): Promise<WorkspaceView> {\n return this.http.post<WorkspaceView>(\"/workspaces\", body);\n }\n\n /** Get workspace details. */\n get(workspaceId: string): Promise<WorkspaceView> {\n return this.http.get<WorkspaceView>(`/workspaces/${workspaceId}`);\n }\n\n /** Update a workspace. */\n update(workspaceId: string, body: WorkspaceUpdateRequest): Promise<WorkspaceView> {\n return this.http.patch<WorkspaceView>(`/workspaces/${workspaceId}`, body);\n }\n\n /** Delete a workspace and its data. */\n delete(workspaceId: string): Promise<void> {\n return this.http.delete<void>(`/workspaces/${workspaceId}`);\n }\n\n /** List files in a workspace. */\n files(workspaceId: string, params?: WorkspaceFilesParams): Promise<FileListResponse> {\n return this.http.get<FileListResponse>(\n `/workspaces/${workspaceId}/files`,\n params as Record<string, unknown>,\n );\n }\n\n /** Get presigned upload URLs for workspace files. */\n uploadFiles(workspaceId: string, body: FileUploadRequest, query?: { prefix?: string }): Promise<FileUploadResponse> {\n return this.http.post<FileUploadResponse>(\n `/workspaces/${workspaceId}/files/upload`,\n body,\n query as Record<string, unknown>,\n );\n }\n\n /** Delete a file from a workspace. */\n deleteFile(workspaceId: string, path: string): Promise<void> {\n return this.http.delete<void>(`/workspaces/${workspaceId}/files`, { path });\n }\n\n /** Get storage usage for a workspace. */\n size(workspaceId: string): Promise<unknown> {\n return this.http.get<unknown>(`/workspaces/${workspaceId}/size`);\n }\n}\n","import type { z } from \"zod\";\nimport type { components } from \"../generated/v3/types.js\";\nimport type { Sessions } from \"./resources/sessions.js\";\n\ntype SessionResponse = components[\"schemas\"][\"SessionResponse\"];\n\nconst TERMINAL_STATUSES = new Set([\"idle\", \"stopped\", \"timed_out\", \"error\"]);\n\nexport interface RunOptions {\n /** Maximum time to wait in milliseconds. Default: 300_000 (5 min). */\n timeout?: number;\n /** Polling interval in milliseconds. Default: 2_000. */\n interval?: number;\n}\n\n/** Session result with typed output. All SessionResponse fields are directly accessible. */\nexport type SessionResult<T = string | null> = Omit<SessionResponse, \"output\"> & { output: T };\n\n/**\n * Dual-purpose session handle: `await` it for a typed SessionResult,\n * or access `.result` for the full SessionResult after resolution.\n */\nexport class SessionRun<T = string> implements PromiseLike<SessionResult<T>> {\n private readonly _createPromise: Promise<SessionResponse>;\n private readonly _sessions: Sessions;\n private readonly _schema?: z.ZodType<T>;\n private readonly _timeout: number;\n private readonly _interval: number;\n private _sessionId: string | null = null;\n private _result: SessionResult<T> | null = null;\n\n constructor(\n createPromise: Promise<SessionResponse>,\n sessions: Sessions,\n schema?: z.ZodType<T>,\n options?: RunOptions,\n ) {\n this._createPromise = createPromise;\n this._sessions = sessions;\n this._schema = schema;\n this._timeout = options?.timeout ?? 300_000;\n this._interval = options?.interval ?? 2_000;\n }\n\n /** The session ID, available after task creation resolves. */\n get sessionId(): string | null {\n return this._sessionId;\n }\n\n /** The full SessionResult, available after polling completes. */\n get result(): SessionResult<T> | null {\n return this._result;\n }\n\n /** Enable `await client.run(...)` — polls until terminal, returns SessionResult. */\n then<R1 = SessionResult<T>, R2 = never>(\n onFulfilled?:\n | ((value: SessionResult<T>) => R1 | PromiseLike<R1>)\n | null,\n onRejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null,\n ): Promise<R1 | R2> {\n return this._waitForOutput().then(onFulfilled, onRejected);\n }\n\n private async _ensureSessionId(): Promise<string> {\n if (this._sessionId) return this._sessionId;\n const created = await this._createPromise;\n this._sessionId = created.id;\n return this._sessionId;\n }\n\n /** Poll session until terminal, return SessionResult. */\n private async _waitForOutput(): Promise<SessionResult<T>> {\n const sessionId = await this._ensureSessionId();\n const deadline = Date.now() + this._timeout;\n\n while (Date.now() < deadline) {\n const session = await this._sessions.get(sessionId);\n if (TERMINAL_STATUSES.has(session.status)) {\n const { output, ...rest } = session;\n const parsed = this._parseOutput(output);\n this._result = { ...rest, output: parsed } as SessionResult<T>;\n return this._result;\n }\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) =>\n setTimeout(r, Math.min(this._interval, remaining)),\n );\n }\n\n throw new Error(\n `Session ${sessionId} did not complete within ${this._timeout}ms`,\n );\n }\n\n private _parseOutput(output: unknown): T {\n if (output == null) return null as T;\n if (!this._schema) return output as unknown as T;\n const raw = typeof output === \"string\" ? JSON.parse(output) : output;\n return this._schema.parse(raw);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,SAAS;;;ACiCX,IAAM,WAAN,MAAe;AAAA,EACpB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA,EAGhD,OAAO,MAAoD;AACzD,WAAO,KAAK,KAAK,KAAsB,aAAa,IAAI;AAAA,EAC1D;AAAA;AAAA,EAGA,KAAK,QAA0D;AAC7D,WAAO,KAAK,KAAK,IAAyB,aAAa,MAAiC;AAAA,EAC1F;AAAA;AAAA,EAGA,IAAI,WAA6C;AAC/C,WAAO,KAAK,KAAK,IAAqB,aAAa,SAAS,EAAE;AAAA,EAChE;AAAA;AAAA,EAGA,KAAK,WAAmB,MAAqD;AAC3E,WAAO,KAAK,KAAK,KAAsB,aAAa,SAAS,SAAS,IAAI;AAAA,EAC5E;AAAA;AAAA,EAGA,OAAO,WAAkC;AACvC,WAAO,KAAK,KAAK,OAAa,aAAa,SAAS,EAAE;AAAA,EACxD;AAAA;AAAA,EAGA,YAAY,WAAmB,MAAsD;AACnF,WAAO,KAAK,KAAK,KAAyB,aAAa,SAAS,iBAAiB,IAAI;AAAA,EACvF;AAAA;AAAA,E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names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-use-sdk",
3
- "version": "3.0.3",
3
+ "version": "3.2.0",
4
4
  "description": "Official TypeScript SDK for the Browser Use API",
5
5
  "author": "Browser Use",
6
6
  "license": "MIT",
@@ -62,5 +62,6 @@
62
62
  "dependencies": {
63
63
  "dotenv": "^17.2.4",
64
64
  "zod": "^4.3.6"
65
- }
65
+ },
66
+ "packageManager": "pnpm@10.23.0+sha512.21c4e5698002ade97e4efe8b8b4a89a8de3c85a37919f957e7a0f30f38fbc5bbdd05980ffe29179b2fb6e6e691242e098d945d1601772cad0fef5fb6411e2a4b"
66
67
  }