@onkernel/sdk 0.7.0 → 0.8.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/client.d.mts +6 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +6 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +13 -10
  7. package/client.js.map +1 -1
  8. package/client.mjs +13 -10
  9. package/client.mjs.map +1 -1
  10. package/core/streaming.d.mts +5 -3
  11. package/core/streaming.d.mts.map +1 -1
  12. package/core/streaming.d.ts +5 -3
  13. package/core/streaming.d.ts.map +1 -1
  14. package/core/streaming.js +16 -10
  15. package/core/streaming.js.map +1 -1
  16. package/core/streaming.mjs +16 -10
  17. package/core/streaming.mjs.map +1 -1
  18. package/internal/parse.js +2 -2
  19. package/internal/parse.js.map +1 -1
  20. package/internal/parse.mjs +2 -2
  21. package/internal/parse.mjs.map +1 -1
  22. package/internal/request-options.d.mts +42 -0
  23. package/internal/request-options.d.mts.map +1 -1
  24. package/internal/request-options.d.ts +42 -0
  25. package/internal/request-options.d.ts.map +1 -1
  26. package/internal/request-options.js.map +1 -1
  27. package/internal/request-options.mjs.map +1 -1
  28. package/package.json +1 -1
  29. package/resources/browsers/browsers.d.mts +160 -0
  30. package/resources/browsers/browsers.d.mts.map +1 -0
  31. package/resources/browsers/browsers.d.ts +160 -0
  32. package/resources/browsers/browsers.d.ts.map +1 -0
  33. package/resources/browsers/browsers.js +88 -0
  34. package/resources/browsers/browsers.js.map +1 -0
  35. package/resources/browsers/browsers.mjs +83 -0
  36. package/resources/browsers/browsers.mjs.map +1 -0
  37. package/resources/browsers/index.d.mts +3 -0
  38. package/resources/browsers/index.d.mts.map +1 -0
  39. package/resources/browsers/index.d.ts +3 -0
  40. package/resources/browsers/index.d.ts.map +1 -0
  41. package/resources/browsers/index.js +9 -0
  42. package/resources/browsers/index.js.map +1 -0
  43. package/resources/browsers/index.mjs +4 -0
  44. package/resources/browsers/index.mjs.map +1 -0
  45. package/resources/browsers/replays.d.mts +120 -0
  46. package/resources/browsers/replays.d.mts.map +1 -0
  47. package/resources/browsers/replays.d.ts +120 -0
  48. package/resources/browsers/replays.d.ts.map +1 -0
  49. package/resources/browsers/replays.js +72 -0
  50. package/resources/browsers/replays.js.map +1 -0
  51. package/resources/browsers/replays.mjs +68 -0
  52. package/resources/browsers/replays.mjs.map +1 -0
  53. package/resources/browsers.d.mts +1 -155
  54. package/resources/browsers.d.mts.map +1 -1
  55. package/resources/browsers.d.ts +1 -155
  56. package/resources/browsers.d.ts.map +1 -1
  57. package/resources/browsers.js +2 -76
  58. package/resources/browsers.js.map +1 -1
  59. package/resources/browsers.mjs +1 -74
  60. package/resources/browsers.mjs.map +1 -1
  61. package/resources/index.d.mts +1 -1
  62. package/resources/index.d.ts +1 -1
  63. package/resources/index.js +1 -1
  64. package/resources/index.js.map +1 -1
  65. package/resources/index.mjs +1 -1
  66. package/src/client.ts +25 -20
  67. package/src/core/streaming.ts +22 -8
  68. package/src/internal/parse.ts +2 -2
  69. package/src/internal/request-options.ts +53 -0
  70. package/src/resources/browsers/browsers.ts +234 -0
  71. package/src/resources/browsers/index.ts +19 -0
  72. package/src/resources/browsers/replays.ts +168 -0
  73. package/src/resources/browsers.ts +1 -210
  74. package/src/resources/index.ts +1 -1
  75. package/src/version.ts +1 -1
  76. package/version.d.mts +1 -1
  77. package/version.d.ts +1 -1
  78. package/version.js +1 -1
  79. package/version.mjs +1 -1
@@ -6,7 +6,7 @@ const tslib_1 = require("../internal/tslib.js");
6
6
  tslib_1.__exportStar(require("./shared.js"), exports);
7
7
  var apps_1 = require("./apps/apps.js");
8
8
  Object.defineProperty(exports, "Apps", { enumerable: true, get: function () { return apps_1.Apps; } });
9
- var browsers_1 = require("./browsers.js");
9
+ var browsers_1 = require("./browsers/browsers.js");
10
10
  Object.defineProperty(exports, "Browsers", { enumerable: true, get: function () { return browsers_1.Browsers; } });
11
11
  var deployments_1 = require("./deployments.js");
12
12
  Object.defineProperty(exports, "Deployments", { enumerable: true, get: function () { return deployments_1.Deployments; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,sDAAyB;AACzB,uCAA6E;AAApE,4FAAA,IAAI,OAAA;AACb,0CAQoB;AAPlB,oGAAA,QAAQ,OAAA;AAQV,gDAUuB;AATrB,0GAAA,WAAW,OAAA;AAUb,gDASuB;AARrB,0GAAA,WAAW,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,sDAAyB;AACzB,uCAA6E;AAApE,4FAAA,IAAI,OAAA;AACb,mDAQ6B;AAP3B,oGAAA,QAAQ,OAAA;AAQV,gDAUuB;AATrB,0GAAA,WAAW,OAAA;AAUb,gDASuB;AARrB,0GAAA,WAAW,OAAA"}
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  export * from "./shared.mjs";
3
3
  export { Apps } from "./apps/apps.mjs";
4
- export { Browsers, } from "./browsers.mjs";
4
+ export { Browsers, } from "./browsers/browsers.mjs";
5
5
  export { Deployments, } from "./deployments.mjs";
6
6
  export { Invocations, } from "./invocations.mjs";
7
7
  //# sourceMappingURL=index.mjs.map
package/src/client.ts CHANGED
@@ -16,15 +16,6 @@ import * as Errors from './core/error';
16
16
  import * as Uploads from './core/uploads';
17
17
  import * as API from './resources/index';
18
18
  import { APIPromise } from './core/api-promise';
19
- import {
20
- BrowserCreateParams,
21
- BrowserCreateResponse,
22
- BrowserDeleteParams,
23
- BrowserListResponse,
24
- BrowserPersistence,
25
- BrowserRetrieveResponse,
26
- Browsers,
27
- } from './resources/browsers';
28
19
  import {
29
20
  DeploymentCreateParams,
30
21
  DeploymentCreateResponse,
@@ -48,6 +39,15 @@ import {
48
39
  Invocations,
49
40
  } from './resources/invocations';
50
41
  import { AppListParams, AppListResponse, Apps } from './resources/apps/apps';
42
+ import {
43
+ BrowserCreateParams,
44
+ BrowserCreateResponse,
45
+ BrowserDeleteParams,
46
+ BrowserListResponse,
47
+ BrowserPersistence,
48
+ BrowserRetrieveResponse,
49
+ Browsers,
50
+ } from './resources/browsers/browsers';
51
51
  import { type Fetch } from './internal/builtin-types';
52
52
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
53
53
  import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -95,6 +95,8 @@ export interface ClientOptions {
95
95
  *
96
96
  * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
97
97
  * much longer than this timeout before the promise succeeds or fails.
98
+ *
99
+ * @unit milliseconds
98
100
  */
99
101
  timeout?: number | undefined;
100
102
  /**
@@ -228,7 +230,7 @@ export class Kernel {
228
230
  * Create a new client instance re-using the same options given to the current client with optional overriding.
229
231
  */
230
232
  withOptions(options: Partial<ClientOptions>): this {
231
- return new (this.constructor as any as new (props: ClientOptions) => typeof this)({
233
+ const client = new (this.constructor as any as new (props: ClientOptions) => typeof this)({
232
234
  ...this._options,
233
235
  environment: options.environment ? options.environment : undefined,
234
236
  baseURL: options.environment ? undefined : this.baseURL,
@@ -241,6 +243,7 @@ export class Kernel {
241
243
  apiKey: this.apiKey,
242
244
  ...options,
243
245
  });
246
+ return client;
244
247
  }
245
248
 
246
249
  /**
@@ -258,7 +261,7 @@ export class Kernel {
258
261
  return;
259
262
  }
260
263
 
261
- protected authHeaders(opts: FinalRequestOptions): NullableHeaders | undefined {
264
+ protected async authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
262
265
  return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
263
266
  }
264
267
 
@@ -390,7 +393,9 @@ export class Kernel {
390
393
 
391
394
  await this.prepareOptions(options);
392
395
 
393
- const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining });
396
+ const { req, url, timeout } = await this.buildRequest(options, {
397
+ retryCount: maxRetries - retriesRemaining,
398
+ });
394
399
 
395
400
  await this.prepareRequest(req, { url, options });
396
401
 
@@ -468,7 +473,7 @@ export class Kernel {
468
473
  } with status ${response.status} in ${headersTime - startTime}ms`;
469
474
 
470
475
  if (!response.ok) {
471
- const shouldRetry = this.shouldRetry(response);
476
+ const shouldRetry = await this.shouldRetry(response);
472
477
  if (retriesRemaining && shouldRetry) {
473
478
  const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
474
479
 
@@ -567,7 +572,7 @@ export class Kernel {
567
572
  }
568
573
  }
569
574
 
570
- private shouldRetry(response: Response): boolean {
575
+ private async shouldRetry(response: Response): Promise<boolean> {
571
576
  // Note this is not a standard header.
572
577
  const shouldRetryHeader = response.headers.get('x-should-retry');
573
578
 
@@ -644,10 +649,10 @@ export class Kernel {
644
649
  return sleepSeconds * jitter * 1000;
645
650
  }
646
651
 
647
- buildRequest(
652
+ async buildRequest(
648
653
  inputOptions: FinalRequestOptions,
649
654
  { retryCount = 0 }: { retryCount?: number } = {},
650
- ): { req: FinalizedRequestInit; url: string; timeout: number } {
655
+ ): Promise<{ req: FinalizedRequestInit; url: string; timeout: number }> {
651
656
  const options = { ...inputOptions };
652
657
  const { method, path, query, defaultBaseURL } = options;
653
658
 
@@ -655,7 +660,7 @@ export class Kernel {
655
660
  if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
656
661
  options.timeout = options.timeout ?? this.timeout;
657
662
  const { bodyHeaders, body } = this.buildBody({ options });
658
- const reqHeaders = this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
663
+ const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
659
664
 
660
665
  const req: FinalizedRequestInit = {
661
666
  method,
@@ -671,7 +676,7 @@ export class Kernel {
671
676
  return { req, url, timeout: options.timeout };
672
677
  }
673
678
 
674
- private buildHeaders({
679
+ private async buildHeaders({
675
680
  options,
676
681
  method,
677
682
  bodyHeaders,
@@ -681,7 +686,7 @@ export class Kernel {
681
686
  method: HTTPMethod;
682
687
  bodyHeaders: HeadersLike;
683
688
  retryCount: number;
684
- }): Headers {
689
+ }): Promise<Headers> {
685
690
  let idempotencyHeaders: HeadersLike = {};
686
691
  if (this.idempotencyHeader && method !== 'get') {
687
692
  if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey();
@@ -697,7 +702,7 @@ export class Kernel {
697
702
  ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
698
703
  ...getPlatformHeaders(),
699
704
  },
700
- this.authHeaders(options),
705
+ await this.authHeaders(options),
701
706
  this._options.defaultHeaders,
702
707
  bodyHeaders,
703
708
  options.headers,
@@ -5,6 +5,8 @@ import { findDoubleNewlineIndex, LineDecoder } from '../internal/decoders/line';
5
5
  import { ReadableStreamToAsyncIterable } from '../internal/shims';
6
6
  import { isAbortError } from '../internal/errors';
7
7
  import { encodeUTF8 } from '../internal/utils/bytes';
8
+ import { loggerFor } from '../internal/utils/log';
9
+ import type { Kernel } from '../client';
8
10
 
9
11
  type Bytes = string | ArrayBuffer | Uint8Array | null | undefined;
10
12
 
@@ -16,16 +18,24 @@ export type ServerSentEvent = {
16
18
 
17
19
  export class Stream<Item> implements AsyncIterable<Item> {
18
20
  controller: AbortController;
21
+ #client: Kernel | undefined;
19
22
 
20
23
  constructor(
21
24
  private iterator: () => AsyncIterator<Item>,
22
25
  controller: AbortController,
26
+ client?: Kernel,
23
27
  ) {
24
28
  this.controller = controller;
29
+ this.#client = client;
25
30
  }
26
31
 
27
- static fromSSEResponse<Item>(response: Response, controller: AbortController): Stream<Item> {
32
+ static fromSSEResponse<Item>(
33
+ response: Response,
34
+ controller: AbortController,
35
+ client?: Kernel,
36
+ ): Stream<Item> {
28
37
  let consumed = false;
38
+ const logger = client ? loggerFor(client) : console;
29
39
 
30
40
  async function* iterator(): AsyncIterator<Item, any, undefined> {
31
41
  if (consumed) {
@@ -38,8 +48,8 @@ export class Stream<Item> implements AsyncIterable<Item> {
38
48
  try {
39
49
  yield JSON.parse(sse.data);
40
50
  } catch (e) {
41
- console.error(`Could not parse message into JSON:`, sse.data);
42
- console.error(`From chunk:`, sse.raw);
51
+ logger.error(`Could not parse message into JSON:`, sse.data);
52
+ logger.error(`From chunk:`, sse.raw);
43
53
  throw e;
44
54
  }
45
55
  }
@@ -54,14 +64,18 @@ export class Stream<Item> implements AsyncIterable<Item> {
54
64
  }
55
65
  }
56
66
 
57
- return new Stream(iterator, controller);
67
+ return new Stream(iterator, controller, client);
58
68
  }
59
69
 
60
70
  /**
61
71
  * Generates a Stream from a newline-separated ReadableStream
62
72
  * where each item is a JSON value.
63
73
  */
64
- static fromReadableStream<Item>(readableStream: ReadableStream, controller: AbortController): Stream<Item> {
74
+ static fromReadableStream<Item>(
75
+ readableStream: ReadableStream,
76
+ controller: AbortController,
77
+ client?: Kernel,
78
+ ): Stream<Item> {
65
79
  let consumed = false;
66
80
 
67
81
  async function* iterLines(): AsyncGenerator<string, void, unknown> {
@@ -101,7 +115,7 @@ export class Stream<Item> implements AsyncIterable<Item> {
101
115
  }
102
116
  }
103
117
 
104
- return new Stream(iterator, controller);
118
+ return new Stream(iterator, controller, client);
105
119
  }
106
120
 
107
121
  [Symbol.asyncIterator](): AsyncIterator<Item> {
@@ -131,8 +145,8 @@ export class Stream<Item> implements AsyncIterable<Item> {
131
145
  };
132
146
 
133
147
  return [
134
- new Stream(() => teeIterator(left), this.controller),
135
- new Stream(() => teeIterator(right), this.controller),
148
+ new Stream(() => teeIterator(left), this.controller, this.#client),
149
+ new Stream(() => teeIterator(right), this.controller, this.#client),
136
150
  ];
137
151
  }
138
152
 
@@ -24,10 +24,10 @@ export async function defaultParseResponse<T>(client: Kernel, props: APIResponse
24
24
  // that if you set `stream: true` the response type must also be `Stream<T>`
25
25
 
26
26
  if (props.options.__streamClass) {
27
- return props.options.__streamClass.fromSSEResponse(response, props.controller) as any;
27
+ return props.options.__streamClass.fromSSEResponse(response, props.controller, client) as any;
28
28
  }
29
29
 
30
- return Stream.fromSSEResponse(response, props.controller) as any;
30
+ return Stream.fromSSEResponse(response, props.controller, client) as any;
31
31
  }
32
32
 
33
33
  // fetch refuses to read the body when the status code is 204.
@@ -10,17 +10,70 @@ import { type HeadersLike } from './headers';
10
10
  export type FinalRequestOptions = RequestOptions & { method: HTTPMethod; path: string };
11
11
 
12
12
  export type RequestOptions = {
13
+ /**
14
+ * The HTTP method for the request (e.g., 'get', 'post', 'put', 'delete').
15
+ */
13
16
  method?: HTTPMethod;
17
+
18
+ /**
19
+ * The URL path for the request.
20
+ *
21
+ * @example "/v1/foo"
22
+ */
14
23
  path?: string;
24
+
25
+ /**
26
+ * Query parameters to include in the request URL.
27
+ */
15
28
  query?: object | undefined | null;
29
+
30
+ /**
31
+ * The request body. Can be a string, JSON object, FormData, or other supported types.
32
+ */
16
33
  body?: unknown;
34
+
35
+ /**
36
+ * HTTP headers to include with the request. Can be a Headers object, plain object, or array of tuples.
37
+ */
17
38
  headers?: HeadersLike;
39
+
40
+ /**
41
+ * The maximum number of times that the client will retry a request in case of a
42
+ * temporary failure, like a network error or a 5XX error from the server.
43
+ *
44
+ * @default 2
45
+ */
18
46
  maxRetries?: number;
47
+
19
48
  stream?: boolean | undefined;
49
+
50
+ /**
51
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
52
+ * from the server before timing out a single request.
53
+ *
54
+ * @unit milliseconds
55
+ */
20
56
  timeout?: number;
57
+
58
+ /**
59
+ * Additional `RequestInit` options to be passed to the underlying `fetch` call.
60
+ * These options will be merged with the client's default fetch options.
61
+ */
21
62
  fetchOptions?: MergedRequestInit;
63
+
64
+ /**
65
+ * An AbortSignal that can be used to cancel the request.
66
+ */
22
67
  signal?: AbortSignal | undefined | null;
68
+
69
+ /**
70
+ * A unique key for this request to enable idempotency.
71
+ */
23
72
  idempotencyKey?: string;
73
+
74
+ /**
75
+ * Override the default base URL for this specific request.
76
+ */
24
77
  defaultBaseURL?: string | undefined;
25
78
 
26
79
  __binaryResponse?: boolean | undefined;
@@ -0,0 +1,234 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as BrowsersAPI from './browsers';
5
+ import * as ReplaysAPI from './replays';
6
+ import {
7
+ ReplayDownloadParams,
8
+ ReplayListResponse,
9
+ ReplayStartParams,
10
+ ReplayStartResponse,
11
+ ReplayStopParams,
12
+ Replays,
13
+ } from './replays';
14
+ import { APIPromise } from '../../core/api-promise';
15
+ import { buildHeaders } from '../../internal/headers';
16
+ import { RequestOptions } from '../../internal/request-options';
17
+ import { path } from '../../internal/utils/path';
18
+
19
+ export class Browsers extends APIResource {
20
+ replays: ReplaysAPI.Replays = new ReplaysAPI.Replays(this._client);
21
+
22
+ /**
23
+ * Create a new browser session from within an action.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const browser = await client.browsers.create();
28
+ * ```
29
+ */
30
+ create(
31
+ body: BrowserCreateParams | null | undefined = {},
32
+ options?: RequestOptions,
33
+ ): APIPromise<BrowserCreateResponse> {
34
+ return this._client.post('/browsers', { body, ...options });
35
+ }
36
+
37
+ /**
38
+ * Get information about a browser session.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const browser = await client.browsers.retrieve(
43
+ * 'htzv5orfit78e1m2biiifpbv',
44
+ * );
45
+ * ```
46
+ */
47
+ retrieve(id: string, options?: RequestOptions): APIPromise<BrowserRetrieveResponse> {
48
+ return this._client.get(path`/browsers/${id}`, options);
49
+ }
50
+
51
+ /**
52
+ * List active browser sessions
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * const browsers = await client.browsers.list();
57
+ * ```
58
+ */
59
+ list(options?: RequestOptions): APIPromise<BrowserListResponse> {
60
+ return this._client.get('/browsers', options);
61
+ }
62
+
63
+ /**
64
+ * Delete a persistent browser session by its persistent_id.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * await client.browsers.delete({
69
+ * persistent_id: 'persistent_id',
70
+ * });
71
+ * ```
72
+ */
73
+ delete(params: BrowserDeleteParams, options?: RequestOptions): APIPromise<void> {
74
+ const { persistent_id } = params;
75
+ return this._client.delete('/browsers', {
76
+ query: { persistent_id },
77
+ ...options,
78
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
79
+ });
80
+ }
81
+
82
+ /**
83
+ * Delete a browser session by ID
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * await client.browsers.deleteByID(
88
+ * 'htzv5orfit78e1m2biiifpbv',
89
+ * );
90
+ * ```
91
+ */
92
+ deleteByID(id: string, options?: RequestOptions): APIPromise<void> {
93
+ return this._client.delete(path`/browsers/${id}`, {
94
+ ...options,
95
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
96
+ });
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Optional persistence configuration for the browser session.
102
+ */
103
+ export interface BrowserPersistence {
104
+ /**
105
+ * Unique identifier for the persistent browser session.
106
+ */
107
+ id: string;
108
+ }
109
+
110
+ export interface BrowserCreateResponse {
111
+ /**
112
+ * Websocket URL for Chrome DevTools Protocol connections to the browser session
113
+ */
114
+ cdp_ws_url: string;
115
+
116
+ /**
117
+ * Unique identifier for the browser session
118
+ */
119
+ session_id: string;
120
+
121
+ /**
122
+ * Remote URL for live viewing the browser session. Only available for non-headless
123
+ * browsers.
124
+ */
125
+ browser_live_view_url?: string;
126
+
127
+ /**
128
+ * Optional persistence configuration for the browser session.
129
+ */
130
+ persistence?: BrowserPersistence;
131
+ }
132
+
133
+ export interface BrowserRetrieveResponse {
134
+ /**
135
+ * Websocket URL for Chrome DevTools Protocol connections to the browser session
136
+ */
137
+ cdp_ws_url: string;
138
+
139
+ /**
140
+ * Unique identifier for the browser session
141
+ */
142
+ session_id: string;
143
+
144
+ /**
145
+ * Remote URL for live viewing the browser session. Only available for non-headless
146
+ * browsers.
147
+ */
148
+ browser_live_view_url?: string;
149
+
150
+ /**
151
+ * Optional persistence configuration for the browser session.
152
+ */
153
+ persistence?: BrowserPersistence;
154
+ }
155
+
156
+ export type BrowserListResponse = Array<BrowserListResponse.BrowserListResponseItem>;
157
+
158
+ export namespace BrowserListResponse {
159
+ export interface BrowserListResponseItem {
160
+ /**
161
+ * Websocket URL for Chrome DevTools Protocol connections to the browser session
162
+ */
163
+ cdp_ws_url: string;
164
+
165
+ /**
166
+ * Unique identifier for the browser session
167
+ */
168
+ session_id: string;
169
+
170
+ /**
171
+ * Remote URL for live viewing the browser session. Only available for non-headless
172
+ * browsers.
173
+ */
174
+ browser_live_view_url?: string;
175
+
176
+ /**
177
+ * Optional persistence configuration for the browser session.
178
+ */
179
+ persistence?: BrowsersAPI.BrowserPersistence;
180
+ }
181
+ }
182
+
183
+ export interface BrowserCreateParams {
184
+ /**
185
+ * If true, launches the browser using a headless image (no VNC/GUI). Defaults to
186
+ * false.
187
+ */
188
+ headless?: boolean;
189
+
190
+ /**
191
+ * action invocation ID
192
+ */
193
+ invocation_id?: string;
194
+
195
+ /**
196
+ * Optional persistence configuration for the browser session.
197
+ */
198
+ persistence?: BrowserPersistence;
199
+
200
+ /**
201
+ * If true, launches the browser in stealth mode to reduce detection by anti-bot
202
+ * mechanisms.
203
+ */
204
+ stealth?: boolean;
205
+ }
206
+
207
+ export interface BrowserDeleteParams {
208
+ /**
209
+ * Persistent browser identifier
210
+ */
211
+ persistent_id: string;
212
+ }
213
+
214
+ Browsers.Replays = Replays;
215
+
216
+ export declare namespace Browsers {
217
+ export {
218
+ type BrowserPersistence as BrowserPersistence,
219
+ type BrowserCreateResponse as BrowserCreateResponse,
220
+ type BrowserRetrieveResponse as BrowserRetrieveResponse,
221
+ type BrowserListResponse as BrowserListResponse,
222
+ type BrowserCreateParams as BrowserCreateParams,
223
+ type BrowserDeleteParams as BrowserDeleteParams,
224
+ };
225
+
226
+ export {
227
+ Replays as Replays,
228
+ type ReplayListResponse as ReplayListResponse,
229
+ type ReplayStartResponse as ReplayStartResponse,
230
+ type ReplayDownloadParams as ReplayDownloadParams,
231
+ type ReplayStartParams as ReplayStartParams,
232
+ type ReplayStopParams as ReplayStopParams,
233
+ };
234
+ }
@@ -0,0 +1,19 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ Browsers,
5
+ type BrowserPersistence,
6
+ type BrowserCreateResponse,
7
+ type BrowserRetrieveResponse,
8
+ type BrowserListResponse,
9
+ type BrowserCreateParams,
10
+ type BrowserDeleteParams,
11
+ } from './browsers';
12
+ export {
13
+ Replays,
14
+ type ReplayListResponse,
15
+ type ReplayStartResponse,
16
+ type ReplayDownloadParams,
17
+ type ReplayStartParams,
18
+ type ReplayStopParams,
19
+ } from './replays';