@onkernel/sdk 0.7.1 → 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 (58) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/client.d.mts +4 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +4 -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/package.json +1 -1
  11. package/resources/browsers/browsers.d.mts +160 -0
  12. package/resources/browsers/browsers.d.mts.map +1 -0
  13. package/resources/browsers/browsers.d.ts +160 -0
  14. package/resources/browsers/browsers.d.ts.map +1 -0
  15. package/resources/browsers/browsers.js +88 -0
  16. package/resources/browsers/browsers.js.map +1 -0
  17. package/resources/browsers/browsers.mjs +83 -0
  18. package/resources/browsers/browsers.mjs.map +1 -0
  19. package/resources/browsers/index.d.mts +3 -0
  20. package/resources/browsers/index.d.mts.map +1 -0
  21. package/resources/browsers/index.d.ts +3 -0
  22. package/resources/browsers/index.d.ts.map +1 -0
  23. package/resources/browsers/index.js +9 -0
  24. package/resources/browsers/index.js.map +1 -0
  25. package/resources/browsers/index.mjs +4 -0
  26. package/resources/browsers/index.mjs.map +1 -0
  27. package/resources/browsers/replays.d.mts +120 -0
  28. package/resources/browsers/replays.d.mts.map +1 -0
  29. package/resources/browsers/replays.d.ts +120 -0
  30. package/resources/browsers/replays.d.ts.map +1 -0
  31. package/resources/browsers/replays.js +72 -0
  32. package/resources/browsers/replays.js.map +1 -0
  33. package/resources/browsers/replays.mjs +68 -0
  34. package/resources/browsers/replays.mjs.map +1 -0
  35. package/resources/browsers.d.mts +1 -185
  36. package/resources/browsers.d.mts.map +1 -1
  37. package/resources/browsers.d.ts +1 -185
  38. package/resources/browsers.d.ts.map +1 -1
  39. package/resources/browsers.js +2 -96
  40. package/resources/browsers.js.map +1 -1
  41. package/resources/browsers.mjs +1 -94
  42. package/resources/browsers.mjs.map +1 -1
  43. package/resources/index.d.mts +1 -1
  44. package/resources/index.d.ts +1 -1
  45. package/resources/index.js +1 -1
  46. package/resources/index.js.map +1 -1
  47. package/resources/index.mjs +1 -1
  48. package/src/client.ts +23 -20
  49. package/src/resources/browsers/browsers.ts +234 -0
  50. package/src/resources/browsers/index.ts +19 -0
  51. package/src/resources/browsers/replays.ts +168 -0
  52. package/src/resources/browsers.ts +1 -251
  53. package/src/resources/index.ts +1 -1
  54. package/src/version.ts +1 -1
  55. package/version.d.mts +1 -1
  56. package/version.d.ts +1 -1
  57. package/version.js +1 -1
  58. package/version.mjs +1 -1
@@ -0,0 +1,168 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { buildHeaders } from '../../internal/headers';
6
+ import { RequestOptions } from '../../internal/request-options';
7
+ import { path } from '../../internal/utils/path';
8
+
9
+ export class Replays extends APIResource {
10
+ /**
11
+ * List all replays for the specified browser session.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const replays = await client.browsers.replays.list('id');
16
+ * ```
17
+ */
18
+ list(id: string, options?: RequestOptions): APIPromise<ReplayListResponse> {
19
+ return this._client.get(path`/browsers/${id}/replays`, options);
20
+ }
21
+
22
+ /**
23
+ * Download or stream the specified replay recording.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const response = await client.browsers.replays.download(
28
+ * 'replay_id',
29
+ * { id: 'id' },
30
+ * );
31
+ *
32
+ * const content = await response.blob();
33
+ * console.log(content);
34
+ * ```
35
+ */
36
+ download(replayID: string, params: ReplayDownloadParams, options?: RequestOptions): APIPromise<Response> {
37
+ const { id } = params;
38
+ return this._client.get(path`/browsers/${id}/replays/${replayID}`, {
39
+ ...options,
40
+ headers: buildHeaders([{ Accept: 'video/mp4' }, options?.headers]),
41
+ __binaryResponse: true,
42
+ });
43
+ }
44
+
45
+ /**
46
+ * Start recording the browser session and return a replay ID.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const response = await client.browsers.replays.start('id');
51
+ * ```
52
+ */
53
+ start(
54
+ id: string,
55
+ body: ReplayStartParams | null | undefined = {},
56
+ options?: RequestOptions,
57
+ ): APIPromise<ReplayStartResponse> {
58
+ return this._client.post(path`/browsers/${id}/replays`, { body, ...options });
59
+ }
60
+
61
+ /**
62
+ * Stop the specified replay recording and persist the video.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * await client.browsers.replays.stop('replay_id', {
67
+ * id: 'id',
68
+ * });
69
+ * ```
70
+ */
71
+ stop(replayID: string, params: ReplayStopParams, options?: RequestOptions): APIPromise<void> {
72
+ const { id } = params;
73
+ return this._client.post(path`/browsers/${id}/replays/${replayID}/stop`, {
74
+ ...options,
75
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
76
+ });
77
+ }
78
+ }
79
+
80
+ export type ReplayListResponse = Array<ReplayListResponse.ReplayListResponseItem>;
81
+
82
+ export namespace ReplayListResponse {
83
+ /**
84
+ * Information about a browser replay recording.
85
+ */
86
+ export interface ReplayListResponseItem {
87
+ /**
88
+ * Unique identifier for the replay recording.
89
+ */
90
+ replay_id: string;
91
+
92
+ /**
93
+ * Timestamp when replay finished
94
+ */
95
+ finished_at?: string | null;
96
+
97
+ /**
98
+ * URL for viewing the replay recording.
99
+ */
100
+ replay_view_url?: string;
101
+
102
+ /**
103
+ * Timestamp when replay started
104
+ */
105
+ started_at?: string | null;
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Information about a browser replay recording.
111
+ */
112
+ export interface ReplayStartResponse {
113
+ /**
114
+ * Unique identifier for the replay recording.
115
+ */
116
+ replay_id: string;
117
+
118
+ /**
119
+ * Timestamp when replay finished
120
+ */
121
+ finished_at?: string | null;
122
+
123
+ /**
124
+ * URL for viewing the replay recording.
125
+ */
126
+ replay_view_url?: string;
127
+
128
+ /**
129
+ * Timestamp when replay started
130
+ */
131
+ started_at?: string | null;
132
+ }
133
+
134
+ export interface ReplayDownloadParams {
135
+ /**
136
+ * Browser session ID
137
+ */
138
+ id: string;
139
+ }
140
+
141
+ export interface ReplayStartParams {
142
+ /**
143
+ * Recording framerate in fps.
144
+ */
145
+ framerate?: number;
146
+
147
+ /**
148
+ * Maximum recording duration in seconds.
149
+ */
150
+ max_duration_in_seconds?: number;
151
+ }
152
+
153
+ export interface ReplayStopParams {
154
+ /**
155
+ * Browser session ID
156
+ */
157
+ id: string;
158
+ }
159
+
160
+ export declare namespace Replays {
161
+ export {
162
+ type ReplayListResponse as ReplayListResponse,
163
+ type ReplayStartResponse as ReplayStartResponse,
164
+ type ReplayDownloadParams as ReplayDownloadParams,
165
+ type ReplayStartParams as ReplayStartParams,
166
+ type ReplayStopParams as ReplayStopParams,
167
+ };
168
+ }
@@ -1,253 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../core/resource';
4
- import * as BrowsersAPI from './browsers';
5
- import { APIPromise } from '../core/api-promise';
6
- import { buildHeaders } from '../internal/headers';
7
- import { RequestOptions } from '../internal/request-options';
8
- import { path } from '../internal/utils/path';
9
-
10
- export class Browsers extends APIResource {
11
- /**
12
- * Create a new browser session from within an action.
13
- *
14
- * @example
15
- * ```ts
16
- * const browser = await client.browsers.create();
17
- * ```
18
- */
19
- create(
20
- body: BrowserCreateParams | null | undefined = {},
21
- options?: RequestOptions,
22
- ): APIPromise<BrowserCreateResponse> {
23
- return this._client.post('/browsers', { body, ...options });
24
- }
25
-
26
- /**
27
- * Get information about a browser session.
28
- *
29
- * @example
30
- * ```ts
31
- * const browser = await client.browsers.retrieve(
32
- * 'htzv5orfit78e1m2biiifpbv',
33
- * );
34
- * ```
35
- */
36
- retrieve(id: string, options?: RequestOptions): APIPromise<BrowserRetrieveResponse> {
37
- return this._client.get(path`/browsers/${id}`, options);
38
- }
39
-
40
- /**
41
- * List active browser sessions
42
- *
43
- * @example
44
- * ```ts
45
- * const browsers = await client.browsers.list();
46
- * ```
47
- */
48
- list(options?: RequestOptions): APIPromise<BrowserListResponse> {
49
- return this._client.get('/browsers', options);
50
- }
51
-
52
- /**
53
- * Delete a persistent browser session by its persistent_id.
54
- *
55
- * @example
56
- * ```ts
57
- * await client.browsers.delete({
58
- * persistent_id: 'persistent_id',
59
- * });
60
- * ```
61
- */
62
- delete(params: BrowserDeleteParams, options?: RequestOptions): APIPromise<void> {
63
- const { persistent_id } = params;
64
- return this._client.delete('/browsers', {
65
- query: { persistent_id },
66
- ...options,
67
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
68
- });
69
- }
70
-
71
- /**
72
- * Delete a browser session by ID
73
- *
74
- * @example
75
- * ```ts
76
- * await client.browsers.deleteByID(
77
- * 'htzv5orfit78e1m2biiifpbv',
78
- * );
79
- * ```
80
- */
81
- deleteByID(id: string, options?: RequestOptions): APIPromise<void> {
82
- return this._client.delete(path`/browsers/${id}`, {
83
- ...options,
84
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
85
- });
86
- }
87
-
88
- /**
89
- * Get browser session replay.
90
- *
91
- * @example
92
- * ```ts
93
- * const response = await client.browsers.retrieveReplay(
94
- * 'htzv5orfit78e1m2biiifpbv',
95
- * );
96
- *
97
- * const content = await response.blob();
98
- * console.log(content);
99
- * ```
100
- */
101
- retrieveReplay(id: string, options?: RequestOptions): APIPromise<Response> {
102
- return this._client.get(path`/browsers/${id}/replay`, {
103
- ...options,
104
- headers: buildHeaders([{ Accept: 'video/mp4' }, options?.headers]),
105
- __binaryResponse: true,
106
- });
107
- }
108
- }
109
-
110
- /**
111
- * Optional persistence configuration for the browser session.
112
- */
113
- export interface BrowserPersistence {
114
- /**
115
- * Unique identifier for the persistent browser session.
116
- */
117
- id: string;
118
- }
119
-
120
- export interface BrowserCreateResponse {
121
- /**
122
- * Websocket URL for Chrome DevTools Protocol connections to the browser session
123
- */
124
- cdp_ws_url: string;
125
-
126
- /**
127
- * Unique identifier for the browser session
128
- */
129
- session_id: string;
130
-
131
- /**
132
- * Remote URL for live viewing the browser session. Only available for non-headless
133
- * browsers.
134
- */
135
- browser_live_view_url?: string;
136
-
137
- /**
138
- * Optional persistence configuration for the browser session.
139
- */
140
- persistence?: BrowserPersistence;
141
-
142
- /**
143
- * Remote URL for viewing the browser session replay if enabled
144
- */
145
- replay_view_url?: string;
146
- }
147
-
148
- export interface BrowserRetrieveResponse {
149
- /**
150
- * Websocket URL for Chrome DevTools Protocol connections to the browser session
151
- */
152
- cdp_ws_url: string;
153
-
154
- /**
155
- * Unique identifier for the browser session
156
- */
157
- session_id: string;
158
-
159
- /**
160
- * Remote URL for live viewing the browser session. Only available for non-headless
161
- * browsers.
162
- */
163
- browser_live_view_url?: string;
164
-
165
- /**
166
- * Optional persistence configuration for the browser session.
167
- */
168
- persistence?: BrowserPersistence;
169
-
170
- /**
171
- * Remote URL for viewing the browser session replay if enabled
172
- */
173
- replay_view_url?: string;
174
- }
175
-
176
- export type BrowserListResponse = Array<BrowserListResponse.BrowserListResponseItem>;
177
-
178
- export namespace BrowserListResponse {
179
- export interface BrowserListResponseItem {
180
- /**
181
- * Websocket URL for Chrome DevTools Protocol connections to the browser session
182
- */
183
- cdp_ws_url: string;
184
-
185
- /**
186
- * Unique identifier for the browser session
187
- */
188
- session_id: string;
189
-
190
- /**
191
- * Remote URL for live viewing the browser session. Only available for non-headless
192
- * browsers.
193
- */
194
- browser_live_view_url?: string;
195
-
196
- /**
197
- * Optional persistence configuration for the browser session.
198
- */
199
- persistence?: BrowsersAPI.BrowserPersistence;
200
-
201
- /**
202
- * Remote URL for viewing the browser session replay if enabled
203
- */
204
- replay_view_url?: string;
205
- }
206
- }
207
-
208
- export interface BrowserCreateParams {
209
- /**
210
- * If true, launches the browser using a headless image (no VNC/GUI). Defaults to
211
- * false.
212
- */
213
- headless?: boolean;
214
-
215
- /**
216
- * action invocation ID
217
- */
218
- invocation_id?: string;
219
-
220
- /**
221
- * Optional persistence configuration for the browser session.
222
- */
223
- persistence?: BrowserPersistence;
224
-
225
- /**
226
- * If true, enables replay recording of the browser session. Defaults to false.
227
- */
228
- replay?: boolean;
229
-
230
- /**
231
- * If true, launches the browser in stealth mode to reduce detection by anti-bot
232
- * mechanisms.
233
- */
234
- stealth?: boolean;
235
- }
236
-
237
- export interface BrowserDeleteParams {
238
- /**
239
- * Persistent browser identifier
240
- */
241
- persistent_id: string;
242
- }
243
-
244
- export declare namespace Browsers {
245
- export {
246
- type BrowserPersistence as BrowserPersistence,
247
- type BrowserCreateResponse as BrowserCreateResponse,
248
- type BrowserRetrieveResponse as BrowserRetrieveResponse,
249
- type BrowserListResponse as BrowserListResponse,
250
- type BrowserCreateParams as BrowserCreateParams,
251
- type BrowserDeleteParams as BrowserDeleteParams,
252
- };
253
- }
3
+ export * from './browsers/index';
@@ -10,7 +10,7 @@ export {
10
10
  type BrowserListResponse,
11
11
  type BrowserCreateParams,
12
12
  type BrowserDeleteParams,
13
- } from './browsers';
13
+ } from './browsers/browsers';
14
14
  export {
15
15
  Deployments,
16
16
  type DeploymentStateEvent,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.7.1'; // x-release-please-version
1
+ export const VERSION = '0.8.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.7.1";
1
+ export declare const VERSION = "0.8.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.7.1";
1
+ export declare const VERSION = "0.8.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.7.1'; // x-release-please-version
4
+ exports.VERSION = '0.8.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.7.1'; // x-release-please-version
1
+ export const VERSION = '0.8.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map