@onkernel/sdk 0.19.2 → 0.21.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 (55) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/client.d.mts +9 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +9 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/browser-pools.d.mts +438 -0
  12. package/resources/browser-pools.d.mts.map +1 -0
  13. package/resources/browser-pools.d.ts +438 -0
  14. package/resources/browser-pools.d.ts.map +1 -0
  15. package/resources/browser-pools.js +125 -0
  16. package/resources/browser-pools.js.map +1 -0
  17. package/resources/browser-pools.mjs +121 -0
  18. package/resources/browser-pools.mjs.map +1 -0
  19. package/resources/browsers/browsers.d.mts +79 -201
  20. package/resources/browsers/browsers.d.mts.map +1 -1
  21. package/resources/browsers/browsers.d.ts +79 -201
  22. package/resources/browsers/browsers.d.ts.map +1 -1
  23. package/resources/browsers/browsers.js +9 -4
  24. package/resources/browsers/browsers.js.map +1 -1
  25. package/resources/browsers/browsers.mjs +9 -4
  26. package/resources/browsers/browsers.mjs.map +1 -1
  27. package/resources/browsers/index.d.mts +1 -1
  28. package/resources/browsers/index.d.mts.map +1 -1
  29. package/resources/browsers/index.d.ts +1 -1
  30. package/resources/browsers/index.d.ts.map +1 -1
  31. package/resources/browsers/index.js.map +1 -1
  32. package/resources/browsers/index.mjs.map +1 -1
  33. package/resources/index.d.mts +2 -1
  34. package/resources/index.d.mts.map +1 -1
  35. package/resources/index.d.ts +2 -1
  36. package/resources/index.d.ts.map +1 -1
  37. package/resources/index.js +3 -1
  38. package/resources/index.js.map +1 -1
  39. package/resources/index.mjs +1 -0
  40. package/resources/index.mjs.map +1 -1
  41. package/resources/shared.d.mts +61 -0
  42. package/resources/shared.d.mts.map +1 -1
  43. package/resources/shared.d.ts +61 -0
  44. package/resources/shared.d.ts.map +1 -1
  45. package/src/client.ts +41 -1
  46. package/src/resources/browser-pools.ts +560 -0
  47. package/src/resources/browsers/browsers.ts +95 -225
  48. package/src/resources/browsers/index.ts +2 -0
  49. package/src/resources/index.ts +17 -0
  50. package/src/resources/shared.ts +69 -0
  51. package/src/version.ts +1 -1
  52. package/version.d.mts +1 -1
  53. package/version.d.ts +1 -1
  54. package/version.js +1 -1
  55. package/version.mjs +1 -1
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
- import * as BrowsersAPI from './browsers';
4
+ import * as Shared from '../shared';
5
5
  import * as ComputerAPI from './computer';
6
6
  import {
7
7
  Computer,
@@ -63,6 +63,7 @@ import {
63
63
  Fs,
64
64
  } from './fs/fs';
65
65
  import { APIPromise } from '../../core/api-promise';
66
+ import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../../core/pagination';
66
67
  import { type Uploadable } from '../../core/uploads';
67
68
  import { buildHeaders } from '../../internal/headers';
68
69
  import { RequestOptions } from '../../internal/request-options';
@@ -107,15 +108,22 @@ export class Browsers extends APIResource {
107
108
  }
108
109
 
109
110
  /**
110
- * List active browser sessions
111
+ * List all browser sessions with pagination support. Use include_deleted=true to
112
+ * include soft-deleted sessions in the results.
111
113
  *
112
114
  * @example
113
115
  * ```ts
114
- * const browsers = await client.browsers.list();
116
+ * // Automatically fetches more pages as needed.
117
+ * for await (const browserListResponse of client.browsers.list()) {
118
+ * // ...
119
+ * }
115
120
  * ```
116
121
  */
117
- list(options?: RequestOptions): APIPromise<BrowserListResponse> {
118
- return this._client.get('/browsers', options);
122
+ list(
123
+ query: BrowserListParams | null | undefined = {},
124
+ options?: RequestOptions,
125
+ ): PagePromise<BrowserListResponsesOffsetPagination, BrowserListResponse> {
126
+ return this._client.getAPIList('/browsers', OffsetPagination<BrowserListResponse>, { query, ...options });
119
127
  }
120
128
 
121
129
  /**
@@ -181,6 +189,8 @@ export class Browsers extends APIResource {
181
189
  }
182
190
  }
183
191
 
192
+ export type BrowserListResponsesOffsetPagination = OffsetPagination<BrowserListResponse>;
193
+
184
194
  /**
185
195
  * Optional persistence configuration for the browser session.
186
196
  */
@@ -258,6 +268,11 @@ export interface BrowserCreateResponse {
258
268
  */
259
269
  browser_live_view_url?: string;
260
270
 
271
+ /**
272
+ * When the browser session was soft-deleted. Only present for deleted sessions.
273
+ */
274
+ deleted_at?: string;
275
+
261
276
  /**
262
277
  * Whether the browser session is running in kiosk mode.
263
278
  */
@@ -288,37 +303,7 @@ export interface BrowserCreateResponse {
288
303
  * configuration exactly. Note: Higher resolutions may affect the responsiveness of
289
304
  * live view browser
290
305
  */
291
- viewport?: BrowserCreateResponse.Viewport;
292
- }
293
-
294
- export namespace BrowserCreateResponse {
295
- /**
296
- * Initial browser window size in pixels with optional refresh rate. If omitted,
297
- * image defaults apply (commonly 1024x768@60). Only specific viewport
298
- * configurations are supported. The server will reject unsupported combinations.
299
- * Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
300
- * 1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
301
- * be automatically determined from the width and height if they match a supported
302
- * configuration exactly. Note: Higher resolutions may affect the responsiveness of
303
- * live view browser
304
- */
305
- export interface Viewport {
306
- /**
307
- * Browser window height in pixels.
308
- */
309
- height: number;
310
-
311
- /**
312
- * Browser window width in pixels.
313
- */
314
- width: number;
315
-
316
- /**
317
- * Display refresh rate in Hz. If omitted, automatically determined from width and
318
- * height.
319
- */
320
- refresh_rate?: number;
321
- }
306
+ viewport?: Shared.BrowserViewport;
322
307
  }
323
308
 
324
309
  export interface BrowserRetrieveResponse {
@@ -358,6 +343,11 @@ export interface BrowserRetrieveResponse {
358
343
  */
359
344
  browser_live_view_url?: string;
360
345
 
346
+ /**
347
+ * When the browser session was soft-deleted. Only present for deleted sessions.
348
+ */
349
+ deleted_at?: string;
350
+
361
351
  /**
362
352
  * Whether the browser session is running in kiosk mode.
363
353
  */
@@ -388,148 +378,89 @@ export interface BrowserRetrieveResponse {
388
378
  * configuration exactly. Note: Higher resolutions may affect the responsiveness of
389
379
  * live view browser
390
380
  */
391
- viewport?: BrowserRetrieveResponse.Viewport;
381
+ viewport?: Shared.BrowserViewport;
392
382
  }
393
383
 
394
- export namespace BrowserRetrieveResponse {
384
+ export interface BrowserListResponse {
395
385
  /**
396
- * Initial browser window size in pixels with optional refresh rate. If omitted,
397
- * image defaults apply (commonly 1024x768@60). Only specific viewport
398
- * configurations are supported. The server will reject unsupported combinations.
399
- * Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
400
- * 1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
401
- * be automatically determined from the width and height if they match a supported
402
- * configuration exactly. Note: Higher resolutions may affect the responsiveness of
403
- * live view browser
386
+ * Websocket URL for Chrome DevTools Protocol connections to the browser session
404
387
  */
405
- export interface Viewport {
406
- /**
407
- * Browser window height in pixels.
408
- */
409
- height: number;
410
-
411
- /**
412
- * Browser window width in pixels.
413
- */
414
- width: number;
415
-
416
- /**
417
- * Display refresh rate in Hz. If omitted, automatically determined from width and
418
- * height.
419
- */
420
- refresh_rate?: number;
421
- }
422
- }
423
-
424
- export type BrowserListResponse = Array<BrowserListResponse.BrowserListResponseItem>;
425
-
426
- export namespace BrowserListResponse {
427
- export interface BrowserListResponseItem {
428
- /**
429
- * Websocket URL for Chrome DevTools Protocol connections to the browser session
430
- */
431
- cdp_ws_url: string;
388
+ cdp_ws_url: string;
432
389
 
433
- /**
434
- * When the browser session was created.
435
- */
436
- created_at: string;
390
+ /**
391
+ * When the browser session was created.
392
+ */
393
+ created_at: string;
437
394
 
438
- /**
439
- * Whether the browser session is running in headless mode.
440
- */
441
- headless: boolean;
395
+ /**
396
+ * Whether the browser session is running in headless mode.
397
+ */
398
+ headless: boolean;
442
399
 
443
- /**
444
- * Unique identifier for the browser session
445
- */
446
- session_id: string;
400
+ /**
401
+ * Unique identifier for the browser session
402
+ */
403
+ session_id: string;
447
404
 
448
- /**
449
- * Whether the browser session is running in stealth mode.
450
- */
451
- stealth: boolean;
405
+ /**
406
+ * Whether the browser session is running in stealth mode.
407
+ */
408
+ stealth: boolean;
452
409
 
453
- /**
454
- * The number of seconds of inactivity before the browser session is terminated.
455
- */
456
- timeout_seconds: number;
410
+ /**
411
+ * The number of seconds of inactivity before the browser session is terminated.
412
+ */
413
+ timeout_seconds: number;
457
414
 
458
- /**
459
- * Remote URL for live viewing the browser session. Only available for non-headless
460
- * browsers.
461
- */
462
- browser_live_view_url?: string;
415
+ /**
416
+ * Remote URL for live viewing the browser session. Only available for non-headless
417
+ * browsers.
418
+ */
419
+ browser_live_view_url?: string;
463
420
 
464
- /**
465
- * Whether the browser session is running in kiosk mode.
466
- */
467
- kiosk_mode?: boolean;
421
+ /**
422
+ * When the browser session was soft-deleted. Only present for deleted sessions.
423
+ */
424
+ deleted_at?: string;
468
425
 
469
- /**
470
- * Optional persistence configuration for the browser session.
471
- */
472
- persistence?: BrowsersAPI.BrowserPersistence;
426
+ /**
427
+ * Whether the browser session is running in kiosk mode.
428
+ */
429
+ kiosk_mode?: boolean;
473
430
 
474
- /**
475
- * Browser profile metadata.
476
- */
477
- profile?: BrowsersAPI.Profile;
431
+ /**
432
+ * Optional persistence configuration for the browser session.
433
+ */
434
+ persistence?: BrowserPersistence;
478
435
 
479
- /**
480
- * ID of the proxy associated with this browser session, if any.
481
- */
482
- proxy_id?: string;
436
+ /**
437
+ * Browser profile metadata.
438
+ */
439
+ profile?: Profile;
483
440
 
484
- /**
485
- * Initial browser window size in pixels with optional refresh rate. If omitted,
486
- * image defaults apply (commonly 1024x768@60). Only specific viewport
487
- * configurations are supported. The server will reject unsupported combinations.
488
- * Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
489
- * 1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
490
- * be automatically determined from the width and height if they match a supported
491
- * configuration exactly. Note: Higher resolutions may affect the responsiveness of
492
- * live view browser
493
- */
494
- viewport?: BrowserListResponseItem.Viewport;
495
- }
441
+ /**
442
+ * ID of the proxy associated with this browser session, if any.
443
+ */
444
+ proxy_id?: string;
496
445
 
497
- export namespace BrowserListResponseItem {
498
- /**
499
- * Initial browser window size in pixels with optional refresh rate. If omitted,
500
- * image defaults apply (commonly 1024x768@60). Only specific viewport
501
- * configurations are supported. The server will reject unsupported combinations.
502
- * Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
503
- * 1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
504
- * be automatically determined from the width and height if they match a supported
505
- * configuration exactly. Note: Higher resolutions may affect the responsiveness of
506
- * live view browser
507
- */
508
- export interface Viewport {
509
- /**
510
- * Browser window height in pixels.
511
- */
512
- height: number;
513
-
514
- /**
515
- * Browser window width in pixels.
516
- */
517
- width: number;
518
-
519
- /**
520
- * Display refresh rate in Hz. If omitted, automatically determined from width and
521
- * height.
522
- */
523
- refresh_rate?: number;
524
- }
525
- }
446
+ /**
447
+ * Initial browser window size in pixels with optional refresh rate. If omitted,
448
+ * image defaults apply (commonly 1024x768@60). Only specific viewport
449
+ * configurations are supported. The server will reject unsupported combinations.
450
+ * Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
451
+ * 1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
452
+ * be automatically determined from the width and height if they match a supported
453
+ * configuration exactly. Note: Higher resolutions may affect the responsiveness of
454
+ * live view browser
455
+ */
456
+ viewport?: Shared.BrowserViewport;
526
457
  }
527
458
 
528
459
  export interface BrowserCreateParams {
529
460
  /**
530
461
  * List of browser extensions to load into the session. Provide each by id or name.
531
462
  */
532
- extensions?: Array<BrowserCreateParams.Extension>;
463
+ extensions?: Array<Shared.BrowserExtension>;
533
464
 
534
465
  /**
535
466
  * If true, launches the browser using a headless image (no VNC/GUI). Defaults to
@@ -558,7 +489,7 @@ export interface BrowserCreateParams {
558
489
  * specified, the matching profile will be loaded into the browser session.
559
490
  * Profiles must be created beforehand.
560
491
  */
561
- profile?: BrowserCreateParams.Profile;
492
+ profile?: Shared.BrowserProfile;
562
493
 
563
494
  /**
564
495
  * Optional proxy to associate to the browser session. Must reference a proxy
@@ -592,78 +523,15 @@ export interface BrowserCreateParams {
592
523
  * configuration exactly. Note: Higher resolutions may affect the responsiveness of
593
524
  * live view browser
594
525
  */
595
- viewport?: BrowserCreateParams.Viewport;
526
+ viewport?: Shared.BrowserViewport;
596
527
  }
597
528
 
598
- export namespace BrowserCreateParams {
599
- /**
600
- * Extension selection for the browser session. Provide either id or name of an
601
- * extension uploaded to Kernel.
602
- */
603
- export interface Extension {
604
- /**
605
- * Extension ID to load for this browser session
606
- */
607
- id?: string;
608
-
609
- /**
610
- * Extension name to load for this browser session (instead of id). Must be 1-255
611
- * characters, using letters, numbers, dots, underscores, or hyphens.
612
- */
613
- name?: string;
614
- }
615
-
529
+ export interface BrowserListParams extends OffsetPaginationParams {
616
530
  /**
617
- * Profile selection for the browser session. Provide either id or name. If
618
- * specified, the matching profile will be loaded into the browser session.
619
- * Profiles must be created beforehand.
531
+ * When true, includes soft-deleted browser sessions in the results alongside
532
+ * active sessions.
620
533
  */
621
- export interface Profile {
622
- /**
623
- * Profile ID to load for this browser session
624
- */
625
- id?: string;
626
-
627
- /**
628
- * Profile name to load for this browser session (instead of id). Must be 1-255
629
- * characters, using letters, numbers, dots, underscores, or hyphens.
630
- */
631
- name?: string;
632
-
633
- /**
634
- * If true, save changes made during the session back to the profile when the
635
- * session ends.
636
- */
637
- save_changes?: boolean;
638
- }
639
-
640
- /**
641
- * Initial browser window size in pixels with optional refresh rate. If omitted,
642
- * image defaults apply (commonly 1024x768@60). Only specific viewport
643
- * configurations are supported. The server will reject unsupported combinations.
644
- * Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
645
- * 1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
646
- * be automatically determined from the width and height if they match a supported
647
- * configuration exactly. Note: Higher resolutions may affect the responsiveness of
648
- * live view browser
649
- */
650
- export interface Viewport {
651
- /**
652
- * Browser window height in pixels.
653
- */
654
- height: number;
655
-
656
- /**
657
- * Browser window width in pixels.
658
- */
659
- width: number;
660
-
661
- /**
662
- * Display refresh rate in Hz. If omitted, automatically determined from width and
663
- * height.
664
- */
665
- refresh_rate?: number;
666
- }
534
+ include_deleted?: boolean;
667
535
  }
668
536
 
669
537
  export interface BrowserDeleteParams {
@@ -709,7 +577,9 @@ export declare namespace Browsers {
709
577
  type BrowserCreateResponse as BrowserCreateResponse,
710
578
  type BrowserRetrieveResponse as BrowserRetrieveResponse,
711
579
  type BrowserListResponse as BrowserListResponse,
580
+ type BrowserListResponsesOffsetPagination as BrowserListResponsesOffsetPagination,
712
581
  type BrowserCreateParams as BrowserCreateParams,
582
+ type BrowserListParams as BrowserListParams,
713
583
  type BrowserDeleteParams as BrowserDeleteParams,
714
584
  type BrowserLoadExtensionsParams as BrowserLoadExtensionsParams,
715
585
  };
@@ -8,8 +8,10 @@ export {
8
8
  type BrowserRetrieveResponse,
9
9
  type BrowserListResponse,
10
10
  type BrowserCreateParams,
11
+ type BrowserListParams,
11
12
  type BrowserDeleteParams,
12
13
  type BrowserLoadExtensionsParams,
14
+ type BrowserListResponsesOffsetPagination,
13
15
  } from './browsers';
14
16
  export {
15
17
  Computer,
@@ -7,6 +7,21 @@ export {
7
7
  type AppListParams,
8
8
  type AppListResponsesOffsetPagination,
9
9
  } from './apps';
10
+ export {
11
+ BrowserPools,
12
+ type BrowserPool,
13
+ type BrowserPoolAcquireRequest,
14
+ type BrowserPoolReleaseRequest,
15
+ type BrowserPoolRequest,
16
+ type BrowserPoolUpdateRequest,
17
+ type BrowserPoolListResponse,
18
+ type BrowserPoolAcquireResponse,
19
+ type BrowserPoolCreateParams,
20
+ type BrowserPoolUpdateParams,
21
+ type BrowserPoolDeleteParams,
22
+ type BrowserPoolAcquireParams,
23
+ type BrowserPoolReleaseParams,
24
+ } from './browser-pools';
10
25
  export {
11
26
  Browsers,
12
27
  type BrowserPersistence,
@@ -15,8 +30,10 @@ export {
15
30
  type BrowserRetrieveResponse,
16
31
  type BrowserListResponse,
17
32
  type BrowserCreateParams,
33
+ type BrowserListParams,
18
34
  type BrowserDeleteParams,
19
35
  type BrowserLoadExtensionsParams,
36
+ type BrowserListResponsesOffsetPagination,
20
37
  } from './browsers/browsers';
21
38
  export {
22
39
  Deployments,
@@ -10,6 +10,75 @@ export interface AppAction {
10
10
  name: string;
11
11
  }
12
12
 
13
+ /**
14
+ * Extension selection for the browser session. Provide either id or name of an
15
+ * extension uploaded to Kernel.
16
+ */
17
+ export interface BrowserExtension {
18
+ /**
19
+ * Extension ID to load for this browser session
20
+ */
21
+ id?: string;
22
+
23
+ /**
24
+ * Extension name to load for this browser session (instead of id). Must be 1-255
25
+ * characters, using letters, numbers, dots, underscores, or hyphens.
26
+ */
27
+ name?: string;
28
+ }
29
+
30
+ /**
31
+ * Profile selection for the browser session. Provide either id or name. If
32
+ * specified, the matching profile will be loaded into the browser session.
33
+ * Profiles must be created beforehand.
34
+ */
35
+ export interface BrowserProfile {
36
+ /**
37
+ * Profile ID to load for this browser session
38
+ */
39
+ id?: string;
40
+
41
+ /**
42
+ * Profile name to load for this browser session (instead of id). Must be 1-255
43
+ * characters, using letters, numbers, dots, underscores, or hyphens.
44
+ */
45
+ name?: string;
46
+
47
+ /**
48
+ * If true, save changes made during the session back to the profile when the
49
+ * session ends.
50
+ */
51
+ save_changes?: boolean;
52
+ }
53
+
54
+ /**
55
+ * Initial browser window size in pixels with optional refresh rate. If omitted,
56
+ * image defaults apply (commonly 1024x768@60). Only specific viewport
57
+ * configurations are supported. The server will reject unsupported combinations.
58
+ * Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
59
+ * 1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
60
+ * be automatically determined from the width and height if they match a supported
61
+ * configuration exactly. Note: Higher resolutions may affect the responsiveness of
62
+ * live view browser
63
+ */
64
+ export interface BrowserViewport {
65
+ /**
66
+ * Browser window height in pixels.
67
+ */
68
+ height: number;
69
+
70
+ /**
71
+ * Browser window width in pixels.
72
+ */
73
+ width: number;
74
+
75
+ /**
76
+ * Display refresh rate in Hz. If omitted, automatically determined from width and
77
+ * height.
78
+ */
79
+ refresh_rate?: number;
80
+ }
81
+
13
82
  export interface ErrorDetail {
14
83
  /**
15
84
  * Lower-level error code providing more specific detail
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.19.2'; // x-release-please-version
1
+ export const VERSION = '0.21.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.19.2";
1
+ export declare const VERSION = "0.21.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.19.2";
1
+ export declare const VERSION = "0.21.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.19.2'; // x-release-please-version
4
+ exports.VERSION = '0.21.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.19.2'; // x-release-please-version
1
+ export const VERSION = '0.21.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map