browser-use-sdk 2.0.7 → 2.0.8

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.
Files changed (76) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/browsers/client/requests/CreateBrowserSessionRequest.d.ts +4 -0
  3. package/dist/cjs/api/resources/index.d.ts +0 -1
  4. package/dist/cjs/api/resources/index.js +0 -1
  5. package/dist/cjs/api/resources/sessions/client/requests/CreateSessionRequest.d.ts +4 -0
  6. package/dist/cjs/api/resources/workflows/client/Client.d.ts +63 -6
  7. package/dist/cjs/api/resources/workflows/client/Client.js +222 -9
  8. package/dist/cjs/api/resources/workflows/client/requests/GetExecutionMediaWorkflowsExecutionsExecutionIdMediaGetRequest.d.ts +9 -0
  9. package/dist/cjs/api/resources/workflows/client/requests/GetExecutionMediaWorkflowsExecutionsExecutionIdMediaGetRequest.js +3 -0
  10. package/dist/cjs/api/resources/workflows/client/requests/GetExecutionStateWorkflowsExecutionsExecutionIdStateGetRequest.d.ts +9 -0
  11. package/dist/cjs/api/resources/workflows/client/requests/GetExecutionStateWorkflowsExecutionsExecutionIdStateGetRequest.js +3 -0
  12. package/dist/cjs/api/resources/workflows/client/requests/GetWorkflowGenerationStateWorkflowsWorkflowIdGenerationStateGetRequest.d.ts +9 -0
  13. package/dist/cjs/api/resources/workflows/client/requests/GetWorkflowGenerationStateWorkflowsWorkflowIdGenerationStateGetRequest.js +3 -0
  14. package/dist/cjs/api/resources/workflows/client/requests/WorkflowExecuteRequest.d.ts +0 -3
  15. package/dist/cjs/api/resources/workflows/client/requests/index.d.ts +3 -0
  16. package/dist/cjs/api/resources/workflows/index.d.ts +0 -1
  17. package/dist/cjs/api/resources/workflows/index.js +0 -1
  18. package/dist/cjs/api/types/SupportedLlMs.d.ts +2 -0
  19. package/dist/cjs/api/types/SupportedLlMs.js +2 -0
  20. package/dist/cjs/api/types/WorkflowExecutionMediaStepView.d.ts +13 -0
  21. package/dist/cjs/api/types/WorkflowExecutionMediaStepView.js +3 -0
  22. package/dist/cjs/api/types/WorkflowExecutionMediaView.d.ts +8 -0
  23. package/dist/cjs/api/types/WorkflowExecutionMediaView.js +3 -0
  24. package/dist/cjs/api/types/WorkflowExecutionStateView.d.ts +28 -0
  25. package/dist/cjs/api/types/WorkflowExecutionStateView.js +3 -0
  26. package/dist/cjs/api/types/WorkflowExecutionStepView.d.ts +29 -0
  27. package/dist/cjs/api/types/WorkflowExecutionStepView.js +3 -0
  28. package/dist/cjs/api/types/WorkflowGenerationStateView.d.ts +18 -0
  29. package/dist/cjs/api/types/WorkflowGenerationStateView.js +3 -0
  30. package/dist/cjs/api/types/WorkflowGenerationStepView.d.ts +19 -0
  31. package/dist/cjs/api/types/WorkflowGenerationStepView.js +3 -0
  32. package/dist/cjs/api/types/index.d.ts +6 -1
  33. package/dist/cjs/api/types/index.js +6 -1
  34. package/dist/cjs/version.d.ts +1 -1
  35. package/dist/cjs/version.js +1 -1
  36. package/dist/cjs/wrapper/lib/webhooks.d.ts +2 -2
  37. package/dist/cjs/wrapper/lib/webhooks.js +3 -3
  38. package/dist/esm/Client.mjs +2 -2
  39. package/dist/esm/api/resources/browsers/client/requests/CreateBrowserSessionRequest.d.mts +4 -0
  40. package/dist/esm/api/resources/index.d.mts +0 -1
  41. package/dist/esm/api/resources/index.mjs +0 -1
  42. package/dist/esm/api/resources/sessions/client/requests/CreateSessionRequest.d.mts +4 -0
  43. package/dist/esm/api/resources/workflows/client/Client.d.mts +63 -6
  44. package/dist/esm/api/resources/workflows/client/Client.mjs +222 -9
  45. package/dist/esm/api/resources/workflows/client/requests/GetExecutionMediaWorkflowsExecutionsExecutionIdMediaGetRequest.d.mts +9 -0
  46. package/dist/esm/api/resources/workflows/client/requests/GetExecutionMediaWorkflowsExecutionsExecutionIdMediaGetRequest.mjs +2 -0
  47. package/dist/esm/api/resources/workflows/client/requests/GetExecutionStateWorkflowsExecutionsExecutionIdStateGetRequest.d.mts +9 -0
  48. package/dist/esm/api/resources/workflows/client/requests/GetExecutionStateWorkflowsExecutionsExecutionIdStateGetRequest.mjs +2 -0
  49. package/dist/esm/api/resources/workflows/client/requests/GetWorkflowGenerationStateWorkflowsWorkflowIdGenerationStateGetRequest.d.mts +9 -0
  50. package/dist/esm/api/resources/workflows/client/requests/GetWorkflowGenerationStateWorkflowsWorkflowIdGenerationStateGetRequest.mjs +2 -0
  51. package/dist/esm/api/resources/workflows/client/requests/WorkflowExecuteRequest.d.mts +0 -3
  52. package/dist/esm/api/resources/workflows/client/requests/index.d.mts +3 -0
  53. package/dist/esm/api/resources/workflows/index.d.mts +0 -1
  54. package/dist/esm/api/resources/workflows/index.mjs +0 -1
  55. package/dist/esm/api/types/SupportedLlMs.d.mts +2 -0
  56. package/dist/esm/api/types/SupportedLlMs.mjs +2 -0
  57. package/dist/esm/api/types/WorkflowExecutionMediaStepView.d.mts +13 -0
  58. package/dist/esm/api/types/WorkflowExecutionMediaStepView.mjs +2 -0
  59. package/dist/esm/api/types/WorkflowExecutionMediaView.d.mts +8 -0
  60. package/dist/esm/api/types/WorkflowExecutionMediaView.mjs +2 -0
  61. package/dist/esm/api/types/WorkflowExecutionStateView.d.mts +28 -0
  62. package/dist/esm/api/types/WorkflowExecutionStateView.mjs +2 -0
  63. package/dist/esm/api/types/WorkflowExecutionStepView.d.mts +29 -0
  64. package/dist/esm/api/types/WorkflowExecutionStepView.mjs +2 -0
  65. package/dist/esm/api/types/WorkflowGenerationStateView.d.mts +18 -0
  66. package/dist/esm/api/types/WorkflowGenerationStateView.mjs +2 -0
  67. package/dist/esm/api/types/WorkflowGenerationStepView.d.mts +19 -0
  68. package/dist/esm/api/types/WorkflowGenerationStepView.mjs +2 -0
  69. package/dist/esm/api/types/index.d.mts +6 -1
  70. package/dist/esm/api/types/index.mjs +6 -1
  71. package/dist/esm/version.d.mts +1 -1
  72. package/dist/esm/version.mjs +1 -1
  73. package/dist/esm/wrapper/lib/webhooks.d.mts +2 -2
  74. package/dist/esm/wrapper/lib/webhooks.mjs +3 -3
  75. package/package.json +82 -83
  76. package/reference.md +212 -5
@@ -49,8 +49,8 @@ class BrowserUseClient {
49
49
  this._options = Object.assign(Object.assign({}, _options), { logging: core.logging.createLogger(_options === null || _options === void 0 ? void 0 : _options.logging), headers: (0, headers_js_1.mergeHeaders)({
50
50
  "X-Fern-Language": "JavaScript",
51
51
  "X-Fern-SDK-Name": "browser-use-sdk",
52
- "X-Fern-SDK-Version": "2.0.7",
53
- "User-Agent": "browser-use-sdk/2.0.7",
52
+ "X-Fern-SDK-Version": "2.0.8",
53
+ "User-Agent": "browser-use-sdk/2.0.8",
54
54
  "X-Fern-Runtime": core.RUNTIME.type,
55
55
  "X-Fern-Runtime-Version": core.RUNTIME.version,
56
56
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -10,4 +10,8 @@ export interface CreateBrowserSessionRequest {
10
10
  proxyCountryCode?: BrowserUse.ProxyCountryCode | null;
11
11
  /** The timeout for the session in minutes. Free users are limited to 15 minutes, paid users can use up to 240 minutes (4 hours). */
12
12
  timeout?: number;
13
+ /** Custom screen width in pixels for the browser. */
14
+ browserScreenWidth?: number | null;
15
+ /** Custom screen height in pixels for the browser. */
16
+ browserScreenHeight?: number | null;
13
17
  }
@@ -11,4 +11,3 @@ export * from "./tasks/client/requests/index.js";
11
11
  export * as tasks from "./tasks/index.js";
12
12
  export * from "./workflows/client/requests/index.js";
13
13
  export * as workflows from "./workflows/index.js";
14
- export * from "./workflows/types/index.js";
@@ -50,4 +50,3 @@ __exportStar(require("./tasks/client/requests/index.js"), exports);
50
50
  exports.tasks = __importStar(require("./tasks/index.js"));
51
51
  __exportStar(require("./workflows/client/requests/index.js"), exports);
52
52
  exports.workflows = __importStar(require("./workflows/index.js"));
53
- __exportStar(require("./workflows/types/index.js"), exports);
@@ -10,4 +10,8 @@ export interface CreateSessionRequest {
10
10
  proxyCountryCode?: BrowserUse.ProxyCountryCode | null;
11
11
  /** URL to navigate to when the session starts. */
12
12
  startUrl?: string | null;
13
+ /** Custom screen width in pixels for the browser. */
14
+ browserScreenWidth?: number | null;
15
+ /** Custom screen height in pixels for the browser. */
16
+ browserScreenHeight?: number | null;
13
17
  }
@@ -83,6 +83,25 @@ export declare class Workflows {
83
83
  */
84
84
  updateWorkflow(request: BrowserUse.WorkflowUpdateRequest, requestOptions?: Workflows.RequestOptions): core.HttpResponsePromise<BrowserUse.WorkflowResponse>;
85
85
  private __updateWorkflow;
86
+ /**
87
+ * Get workflow generation state with live browser URL for polling.
88
+ *
89
+ * This endpoint returns the current state of workflow generation including
90
+ * the live browser URL (if available). It's designed to be polled every 2 seconds
91
+ * during generation to show real-time browser activity in the frontend.
92
+ *
93
+ * @param {BrowserUse.GetWorkflowGenerationStateWorkflowsWorkflowIdGenerationStateGetRequest} request
94
+ * @param {Workflows.RequestOptions} requestOptions - Request-specific configuration.
95
+ *
96
+ * @throws {@link BrowserUse.UnprocessableEntityError}
97
+ *
98
+ * @example
99
+ * await client.workflows.getWorkflowGenerationState({
100
+ * workflow_id: "workflow_id"
101
+ * })
102
+ */
103
+ getWorkflowGenerationState(request: BrowserUse.GetWorkflowGenerationStateWorkflowsWorkflowIdGenerationStateGetRequest, requestOptions?: Workflows.RequestOptions): core.HttpResponsePromise<BrowserUse.WorkflowGenerationStateView>;
104
+ private __getWorkflowGenerationState;
86
105
  /**
87
106
  * Get a presigned URL to upload workflow YAML directly to S3 from the browser.
88
107
  *
@@ -103,10 +122,10 @@ export declare class Workflows {
103
122
  getWorkflowYamlPresignedUrl(request: BrowserUse.WorkflowYamlPresignedUploadRequest, requestOptions?: Workflows.RequestOptions): core.HttpResponsePromise<BrowserUse.WorkflowYamlPresignedUploadResponse>;
104
123
  private __getWorkflowYamlPresignedUrl;
105
124
  /**
106
- * Execute a workflow either synchronously or asynchronously.
125
+ * Execute a workflow asynchronously.
107
126
  *
108
- * - ASYNC mode: Returns execution ID immediately and processes in background via Lambda
109
- * - SYNC mode: Waits for execution to complete and returns results inline (max 5 min timeout)
127
+ * Returns execution ID immediately and processes in background via Inngest.
128
+ * Use the GET /workflows/executions/{execution_id} endpoint to check status and retrieve results.
110
129
  *
111
130
  * @param {BrowserUse.WorkflowExecuteRequest} request
112
131
  * @param {Workflows.RequestOptions} requestOptions - Request-specific configuration.
@@ -114,12 +133,12 @@ export declare class Workflows {
114
133
  * @throws {@link BrowserUse.UnprocessableEntityError}
115
134
  *
116
135
  * @example
117
- * await client.workflows.executeWorkflow({
136
+ * await client.workflows.runWorkflow({
118
137
  * workflow_id: "workflow_id"
119
138
  * })
120
139
  */
121
- executeWorkflow(request: BrowserUse.WorkflowExecuteRequest, requestOptions?: Workflows.RequestOptions): core.HttpResponsePromise<BrowserUse.ExecuteWorkflowWorkflowsWorkflowIdExecutePostResponse>;
122
- private __executeWorkflow;
140
+ runWorkflow(request: BrowserUse.WorkflowExecuteRequest, requestOptions?: Workflows.RequestOptions): core.HttpResponsePromise<BrowserUse.WorkflowExecutionCreatedResponse>;
141
+ private __runWorkflow;
123
142
  /**
124
143
  * Generate a workflow from a natural language task description.
125
144
  *
@@ -217,5 +236,43 @@ export declare class Workflows {
217
236
  */
218
237
  getExecutionLogs(request: BrowserUse.GetExecutionLogsWorkflowsExecutionsExecutionIdLogsGetRequest, requestOptions?: Workflows.RequestOptions): core.HttpResponsePromise<BrowserUse.WorkflowExecutionLogResponse>;
219
238
  private __getExecutionLogs;
239
+ /**
240
+ * Get workflow execution state with steps for live UI polling.
241
+ *
242
+ * This endpoint returns the current state of a workflow execution including all steps
243
+ * with their details. It's designed to be polled every 2 seconds during execution
244
+ * to show real-time progress in the frontend.
245
+ *
246
+ * @param {BrowserUse.GetExecutionStateWorkflowsExecutionsExecutionIdStateGetRequest} request
247
+ * @param {Workflows.RequestOptions} requestOptions - Request-specific configuration.
248
+ *
249
+ * @throws {@link BrowserUse.UnprocessableEntityError}
250
+ *
251
+ * @example
252
+ * await client.workflows.getExecutionState({
253
+ * execution_id: "execution_id"
254
+ * })
255
+ */
256
+ getExecutionState(request: BrowserUse.GetExecutionStateWorkflowsExecutionsExecutionIdStateGetRequest, requestOptions?: Workflows.RequestOptions): core.HttpResponsePromise<BrowserUse.WorkflowExecutionStateView>;
257
+ private __getExecutionState;
258
+ /**
259
+ * Get workflow execution media (screenshots) with presigned URLs.
260
+ *
261
+ * This endpoint returns media URLs for completed executions. Screenshots
262
+ * are returned with presigned S3 URLs for direct access from the frontend.
263
+ * Should be called when execution status is 'completed', 'failed', or 'cancelled'.
264
+ *
265
+ * @param {BrowserUse.GetExecutionMediaWorkflowsExecutionsExecutionIdMediaGetRequest} request
266
+ * @param {Workflows.RequestOptions} requestOptions - Request-specific configuration.
267
+ *
268
+ * @throws {@link BrowserUse.UnprocessableEntityError}
269
+ *
270
+ * @example
271
+ * await client.workflows.getExecutionMedia({
272
+ * execution_id: "execution_id"
273
+ * })
274
+ */
275
+ getExecutionMedia(request: BrowserUse.GetExecutionMediaWorkflowsExecutionsExecutionIdMediaGetRequest, requestOptions?: Workflows.RequestOptions): core.HttpResponsePromise<BrowserUse.WorkflowExecutionMediaView>;
276
+ private __getExecutionMedia;
220
277
  protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
221
278
  }
@@ -400,6 +400,77 @@ class Workflows {
400
400
  }
401
401
  });
402
402
  }
403
+ /**
404
+ * Get workflow generation state with live browser URL for polling.
405
+ *
406
+ * This endpoint returns the current state of workflow generation including
407
+ * the live browser URL (if available). It's designed to be polled every 2 seconds
408
+ * during generation to show real-time browser activity in the frontend.
409
+ *
410
+ * @param {BrowserUse.GetWorkflowGenerationStateWorkflowsWorkflowIdGenerationStateGetRequest} request
411
+ * @param {Workflows.RequestOptions} requestOptions - Request-specific configuration.
412
+ *
413
+ * @throws {@link BrowserUse.UnprocessableEntityError}
414
+ *
415
+ * @example
416
+ * await client.workflows.getWorkflowGenerationState({
417
+ * workflow_id: "workflow_id"
418
+ * })
419
+ */
420
+ getWorkflowGenerationState(request, requestOptions) {
421
+ return core.HttpResponsePromise.fromPromise(this.__getWorkflowGenerationState(request, requestOptions));
422
+ }
423
+ __getWorkflowGenerationState(request, requestOptions) {
424
+ return __awaiter(this, void 0, void 0, function* () {
425
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
426
+ const { workflow_id: workflowId } = request;
427
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
428
+ const _response = yield core.fetcher({
429
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrowserUseEnvironment.Production, `workflows/${core.url.encodePathParam(workflowId)}/generation-state`),
430
+ method: "GET",
431
+ headers: _headers,
432
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
433
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
434
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
435
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
436
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
437
+ logging: this._options.logging,
438
+ });
439
+ if (_response.ok) {
440
+ return {
441
+ data: _response.body,
442
+ rawResponse: _response.rawResponse,
443
+ };
444
+ }
445
+ if (_response.error.reason === "status-code") {
446
+ switch (_response.error.statusCode) {
447
+ case 422:
448
+ throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
449
+ default:
450
+ throw new errors.BrowserUseError({
451
+ statusCode: _response.error.statusCode,
452
+ body: _response.error.body,
453
+ rawResponse: _response.rawResponse,
454
+ });
455
+ }
456
+ }
457
+ switch (_response.error.reason) {
458
+ case "non-json":
459
+ throw new errors.BrowserUseError({
460
+ statusCode: _response.error.statusCode,
461
+ body: _response.error.rawBody,
462
+ rawResponse: _response.rawResponse,
463
+ });
464
+ case "timeout":
465
+ throw new errors.BrowserUseTimeoutError("Timeout exceeded when calling GET /workflows/{workflow_id}/generation-state.");
466
+ case "unknown":
467
+ throw new errors.BrowserUseError({
468
+ message: _response.error.errorMessage,
469
+ rawResponse: _response.rawResponse,
470
+ });
471
+ }
472
+ });
473
+ }
403
474
  /**
404
475
  * Get a presigned URL to upload workflow YAML directly to S3 from the browser.
405
476
  *
@@ -475,10 +546,10 @@ class Workflows {
475
546
  });
476
547
  }
477
548
  /**
478
- * Execute a workflow either synchronously or asynchronously.
549
+ * Execute a workflow asynchronously.
479
550
  *
480
- * - ASYNC mode: Returns execution ID immediately and processes in background via Lambda
481
- * - SYNC mode: Waits for execution to complete and returns results inline (max 5 min timeout)
551
+ * Returns execution ID immediately and processes in background via Inngest.
552
+ * Use the GET /workflows/executions/{execution_id} endpoint to check status and retrieve results.
482
553
  *
483
554
  * @param {BrowserUse.WorkflowExecuteRequest} request
484
555
  * @param {Workflows.RequestOptions} requestOptions - Request-specific configuration.
@@ -486,20 +557,20 @@ class Workflows {
486
557
  * @throws {@link BrowserUse.UnprocessableEntityError}
487
558
  *
488
559
  * @example
489
- * await client.workflows.executeWorkflow({
560
+ * await client.workflows.runWorkflow({
490
561
  * workflow_id: "workflow_id"
491
562
  * })
492
563
  */
493
- executeWorkflow(request, requestOptions) {
494
- return core.HttpResponsePromise.fromPromise(this.__executeWorkflow(request, requestOptions));
564
+ runWorkflow(request, requestOptions) {
565
+ return core.HttpResponsePromise.fromPromise(this.__runWorkflow(request, requestOptions));
495
566
  }
496
- __executeWorkflow(request, requestOptions) {
567
+ __runWorkflow(request, requestOptions) {
497
568
  return __awaiter(this, void 0, void 0, function* () {
498
569
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
499
570
  const { workflow_id: workflowId } = request, _body = __rest(request, ["workflow_id"]);
500
571
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
501
572
  const _response = yield core.fetcher({
502
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrowserUseEnvironment.Production, `workflows/${core.url.encodePathParam(workflowId)}/execute`),
573
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrowserUseEnvironment.Production, `workflows/${core.url.encodePathParam(workflowId)}/run`),
503
574
  method: "POST",
504
575
  headers: _headers,
505
576
  contentType: "application/json",
@@ -538,7 +609,7 @@ class Workflows {
538
609
  rawResponse: _response.rawResponse,
539
610
  });
540
611
  case "timeout":
541
- throw new errors.BrowserUseTimeoutError("Timeout exceeded when calling POST /workflows/{workflow_id}/execute.");
612
+ throw new errors.BrowserUseTimeoutError("Timeout exceeded when calling POST /workflows/{workflow_id}/run.");
542
613
  case "unknown":
543
614
  throw new errors.BrowserUseError({
544
615
  message: _response.error.errorMessage,
@@ -976,6 +1047,148 @@ class Workflows {
976
1047
  }
977
1048
  });
978
1049
  }
1050
+ /**
1051
+ * Get workflow execution state with steps for live UI polling.
1052
+ *
1053
+ * This endpoint returns the current state of a workflow execution including all steps
1054
+ * with their details. It's designed to be polled every 2 seconds during execution
1055
+ * to show real-time progress in the frontend.
1056
+ *
1057
+ * @param {BrowserUse.GetExecutionStateWorkflowsExecutionsExecutionIdStateGetRequest} request
1058
+ * @param {Workflows.RequestOptions} requestOptions - Request-specific configuration.
1059
+ *
1060
+ * @throws {@link BrowserUse.UnprocessableEntityError}
1061
+ *
1062
+ * @example
1063
+ * await client.workflows.getExecutionState({
1064
+ * execution_id: "execution_id"
1065
+ * })
1066
+ */
1067
+ getExecutionState(request, requestOptions) {
1068
+ return core.HttpResponsePromise.fromPromise(this.__getExecutionState(request, requestOptions));
1069
+ }
1070
+ __getExecutionState(request, requestOptions) {
1071
+ return __awaiter(this, void 0, void 0, function* () {
1072
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1073
+ const { execution_id: executionId } = request;
1074
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1075
+ const _response = yield core.fetcher({
1076
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrowserUseEnvironment.Production, `workflows/executions/${core.url.encodePathParam(executionId)}/state`),
1077
+ method: "GET",
1078
+ headers: _headers,
1079
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
1080
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
1081
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
1082
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1083
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
1084
+ logging: this._options.logging,
1085
+ });
1086
+ if (_response.ok) {
1087
+ return {
1088
+ data: _response.body,
1089
+ rawResponse: _response.rawResponse,
1090
+ };
1091
+ }
1092
+ if (_response.error.reason === "status-code") {
1093
+ switch (_response.error.statusCode) {
1094
+ case 422:
1095
+ throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1096
+ default:
1097
+ throw new errors.BrowserUseError({
1098
+ statusCode: _response.error.statusCode,
1099
+ body: _response.error.body,
1100
+ rawResponse: _response.rawResponse,
1101
+ });
1102
+ }
1103
+ }
1104
+ switch (_response.error.reason) {
1105
+ case "non-json":
1106
+ throw new errors.BrowserUseError({
1107
+ statusCode: _response.error.statusCode,
1108
+ body: _response.error.rawBody,
1109
+ rawResponse: _response.rawResponse,
1110
+ });
1111
+ case "timeout":
1112
+ throw new errors.BrowserUseTimeoutError("Timeout exceeded when calling GET /workflows/executions/{execution_id}/state.");
1113
+ case "unknown":
1114
+ throw new errors.BrowserUseError({
1115
+ message: _response.error.errorMessage,
1116
+ rawResponse: _response.rawResponse,
1117
+ });
1118
+ }
1119
+ });
1120
+ }
1121
+ /**
1122
+ * Get workflow execution media (screenshots) with presigned URLs.
1123
+ *
1124
+ * This endpoint returns media URLs for completed executions. Screenshots
1125
+ * are returned with presigned S3 URLs for direct access from the frontend.
1126
+ * Should be called when execution status is 'completed', 'failed', or 'cancelled'.
1127
+ *
1128
+ * @param {BrowserUse.GetExecutionMediaWorkflowsExecutionsExecutionIdMediaGetRequest} request
1129
+ * @param {Workflows.RequestOptions} requestOptions - Request-specific configuration.
1130
+ *
1131
+ * @throws {@link BrowserUse.UnprocessableEntityError}
1132
+ *
1133
+ * @example
1134
+ * await client.workflows.getExecutionMedia({
1135
+ * execution_id: "execution_id"
1136
+ * })
1137
+ */
1138
+ getExecutionMedia(request, requestOptions) {
1139
+ return core.HttpResponsePromise.fromPromise(this.__getExecutionMedia(request, requestOptions));
1140
+ }
1141
+ __getExecutionMedia(request, requestOptions) {
1142
+ return __awaiter(this, void 0, void 0, function* () {
1143
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1144
+ const { execution_id: executionId } = request;
1145
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1146
+ const _response = yield core.fetcher({
1147
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrowserUseEnvironment.Production, `workflows/executions/${core.url.encodePathParam(executionId)}/media`),
1148
+ method: "GET",
1149
+ headers: _headers,
1150
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
1151
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
1152
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
1153
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1154
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
1155
+ logging: this._options.logging,
1156
+ });
1157
+ if (_response.ok) {
1158
+ return {
1159
+ data: _response.body,
1160
+ rawResponse: _response.rawResponse,
1161
+ };
1162
+ }
1163
+ if (_response.error.reason === "status-code") {
1164
+ switch (_response.error.statusCode) {
1165
+ case 422:
1166
+ throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
1167
+ default:
1168
+ throw new errors.BrowserUseError({
1169
+ statusCode: _response.error.statusCode,
1170
+ body: _response.error.body,
1171
+ rawResponse: _response.rawResponse,
1172
+ });
1173
+ }
1174
+ }
1175
+ switch (_response.error.reason) {
1176
+ case "non-json":
1177
+ throw new errors.BrowserUseError({
1178
+ statusCode: _response.error.statusCode,
1179
+ body: _response.error.rawBody,
1180
+ rawResponse: _response.rawResponse,
1181
+ });
1182
+ case "timeout":
1183
+ throw new errors.BrowserUseTimeoutError("Timeout exceeded when calling GET /workflows/executions/{execution_id}/media.");
1184
+ case "unknown":
1185
+ throw new errors.BrowserUseError({
1186
+ message: _response.error.errorMessage,
1187
+ rawResponse: _response.rawResponse,
1188
+ });
1189
+ }
1190
+ });
1191
+ }
979
1192
  _getCustomAuthorizationHeaders() {
980
1193
  return __awaiter(this, void 0, void 0, function* () {
981
1194
  const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * execution_id: "execution_id"
5
+ * }
6
+ */
7
+ export interface GetExecutionMediaWorkflowsExecutionsExecutionIdMediaGetRequest {
8
+ execution_id: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * execution_id: "execution_id"
5
+ * }
6
+ */
7
+ export interface GetExecutionStateWorkflowsExecutionsExecutionIdStateGetRequest {
8
+ execution_id: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * workflow_id: "workflow_id"
5
+ * }
6
+ */
7
+ export interface GetWorkflowGenerationStateWorkflowsWorkflowIdGenerationStateGetRequest {
8
+ workflow_id: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,3 @@
1
- import type * as BrowserUse from "../../../../index.js";
2
1
  /**
3
2
  * @example
4
3
  * {
@@ -9,8 +8,6 @@ export interface WorkflowExecuteRequest {
9
8
  workflow_id: string;
10
9
  /** Input parameters for the workflow execution */
11
10
  input?: Record<string, unknown> | null;
12
- /** Execution mode (sync or async) */
13
- mode?: BrowserUse.ExecutionMode;
14
11
  /** Optional metadata for this execution */
15
12
  executionMetadata?: Record<string, unknown> | null;
16
13
  }
@@ -1,7 +1,10 @@
1
1
  export type { CancelExecutionWorkflowsExecutionsExecutionIdCancelPatchRequest } from "./CancelExecutionWorkflowsExecutionsExecutionIdCancelPatchRequest.js";
2
2
  export type { DeleteWorkflowWorkflowsWorkflowIdDeleteRequest } from "./DeleteWorkflowWorkflowsWorkflowIdDeleteRequest.js";
3
3
  export type { GetExecutionLogsWorkflowsExecutionsExecutionIdLogsGetRequest } from "./GetExecutionLogsWorkflowsExecutionsExecutionIdLogsGetRequest.js";
4
+ export type { GetExecutionMediaWorkflowsExecutionsExecutionIdMediaGetRequest } from "./GetExecutionMediaWorkflowsExecutionsExecutionIdMediaGetRequest.js";
5
+ export type { GetExecutionStateWorkflowsExecutionsExecutionIdStateGetRequest } from "./GetExecutionStateWorkflowsExecutionsExecutionIdStateGetRequest.js";
4
6
  export type { GetExecutionWorkflowsExecutionsExecutionIdGetRequest } from "./GetExecutionWorkflowsExecutionsExecutionIdGetRequest.js";
7
+ export type { GetWorkflowGenerationStateWorkflowsWorkflowIdGenerationStateGetRequest } from "./GetWorkflowGenerationStateWorkflowsWorkflowIdGenerationStateGetRequest.js";
5
8
  export type { GetWorkflowWorkflowsWorkflowIdGetRequest } from "./GetWorkflowWorkflowsWorkflowIdGetRequest.js";
6
9
  export type { ListAllExecutionsWorkflowsExecutionsGetRequest } from "./ListAllExecutionsWorkflowsExecutionsGetRequest.js";
7
10
  export type { ListWorkflowExecutionsWorkflowsWorkflowIdExecutionsGetRequest } from "./ListWorkflowExecutionsWorkflowsWorkflowIdExecutionsGetRequest.js";
@@ -1,2 +1 @@
1
1
  export * from "./client/index.js";
2
- export * from "./types/index.js";
@@ -15,4 +15,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./client/index.js"), exports);
18
- __exportStar(require("./types/index.js"), exports);
@@ -6,10 +6,12 @@ export declare const SupportedLlMs: {
6
6
  readonly O3: "o3";
7
7
  readonly Gemini25Flash: "gemini-2.5-flash";
8
8
  readonly Gemini25Pro: "gemini-2.5-pro";
9
+ readonly Gemini3ProPreview: "gemini-3-pro-preview";
9
10
  readonly GeminiFlashLatest: "gemini-flash-latest";
10
11
  readonly GeminiFlashLiteLatest: "gemini-flash-lite-latest";
11
12
  readonly ClaudeSonnet420250514: "claude-sonnet-4-20250514";
12
13
  readonly ClaudeSonnet4520250929: "claude-sonnet-4-5-20250929";
14
+ readonly ClaudeOpus4520251101: "claude-opus-4-5-20251101";
13
15
  readonly Gpt4O: "gpt-4o";
14
16
  readonly Gpt4OMini: "gpt-4o-mini";
15
17
  readonly Llama4Maverick17B128EInstruct: "llama-4-maverick-17b-128e-instruct";
@@ -10,10 +10,12 @@ exports.SupportedLlMs = {
10
10
  O3: "o3",
11
11
  Gemini25Flash: "gemini-2.5-flash",
12
12
  Gemini25Pro: "gemini-2.5-pro",
13
+ Gemini3ProPreview: "gemini-3-pro-preview",
13
14
  GeminiFlashLatest: "gemini-flash-latest",
14
15
  GeminiFlashLiteLatest: "gemini-flash-lite-latest",
15
16
  ClaudeSonnet420250514: "claude-sonnet-4-20250514",
16
17
  ClaudeSonnet4520250929: "claude-sonnet-4-5-20250929",
18
+ ClaudeOpus4520251101: "claude-opus-4-5-20251101",
17
19
  Gpt4O: "gpt-4o",
18
20
  Gpt4OMini: "gpt-4o-mini",
19
21
  Llama4Maverick17B128EInstruct: "llama-4-maverick-17b-128e-instruct",
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Minimal view of a step for media endpoint (screenshots only).
3
+ */
4
+ export interface WorkflowExecutionMediaStepView {
5
+ /** Unique identifier for the step */
6
+ id: string;
7
+ /** Description of what this step did */
8
+ nextGoal: string;
9
+ /** Presigned URL for the step screenshot */
10
+ screenshotUrl?: string | null;
11
+ /** Actions taken in this step */
12
+ actions?: Record<string, unknown>[];
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import type * as BrowserUse from "../index.js";
2
+ /**
3
+ * View model for workflow execution media (screenshots, recordings).
4
+ */
5
+ export interface WorkflowExecutionMediaView {
6
+ /** List of steps with media URLs */
7
+ steps?: BrowserUse.WorkflowExecutionMediaStepView[];
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,28 @@
1
+ import type * as BrowserUse from "../index.js";
2
+ /**
3
+ * View model for workflow execution state (used for polling during execution).
4
+ */
5
+ export interface WorkflowExecutionStateView {
6
+ /** Unique identifier for the execution */
7
+ id: string;
8
+ /** ID of the workflow being executed */
9
+ workflowId: string;
10
+ /** Current status of the execution */
11
+ status: BrowserUse.WorkflowExecutionStatus;
12
+ /** When execution started */
13
+ startedAt?: string | null;
14
+ /** When execution finished */
15
+ finishedAt?: string | null;
16
+ /** List of execution steps with details */
17
+ steps?: BrowserUse.WorkflowExecutionStepView[];
18
+ /** LLM costs for this execution */
19
+ llmsCost?: string;
20
+ /** Initialization costs */
21
+ initCost?: string;
22
+ /** Total cost */
23
+ totalCost?: string;
24
+ /** When execution was created */
25
+ createdAt: string;
26
+ /** Live browser view URL (available during and up to 60s after execution) */
27
+ liveUrl?: string | null;
28
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,29 @@
1
+ /**
2
+ * View model for a single workflow execution step.
3
+ */
4
+ export interface WorkflowExecutionStepView {
5
+ /** Unique identifier for the step (execution_id-step-N) */
6
+ id: string;
7
+ /** Sequential step number (1-indexed) */
8
+ stepNumber: number;
9
+ /** Name of the step from workflow definition */
10
+ stepName?: string | null;
11
+ /** Description of what this step is doing */
12
+ nextGoal: string;
13
+ /** Whether the step has completed */
14
+ isDone?: boolean;
15
+ /** Whether the step succeeded (None if in progress) */
16
+ success?: boolean | null;
17
+ /** S3 key for the step screenshot */
18
+ screenshotUrl?: string | null;
19
+ /** Browser URL at the time of this step */
20
+ url?: string;
21
+ /** Actions taken in this step */
22
+ actions?: Record<string, unknown>[];
23
+ /** Content extracted during this step */
24
+ extractedContent?: string | null;
25
+ /** Error message if step failed */
26
+ error?: string | null;
27
+ /** ISO 8601 timestamp when step was executed */
28
+ createdAt: string;
29
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });