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.cts 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 };