@onkernel/sdk 0.6.5 → 0.7.1

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 (44) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/client.d.mts +2 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/core/streaming.d.mts +5 -3
  9. package/core/streaming.d.mts.map +1 -1
  10. package/core/streaming.d.ts +5 -3
  11. package/core/streaming.d.ts.map +1 -1
  12. package/core/streaming.js +16 -10
  13. package/core/streaming.js.map +1 -1
  14. package/core/streaming.mjs +16 -10
  15. package/core/streaming.mjs.map +1 -1
  16. package/internal/parse.js +2 -2
  17. package/internal/parse.js.map +1 -1
  18. package/internal/parse.mjs +2 -2
  19. package/internal/parse.mjs.map +1 -1
  20. package/internal/request-options.d.mts +42 -0
  21. package/internal/request-options.d.mts.map +1 -1
  22. package/internal/request-options.d.ts +42 -0
  23. package/internal/request-options.d.ts.map +1 -1
  24. package/internal/request-options.js.map +1 -1
  25. package/internal/request-options.mjs.map +1 -1
  26. package/package.json +1 -1
  27. package/resources/browsers.d.mts +50 -12
  28. package/resources/browsers.d.mts.map +1 -1
  29. package/resources/browsers.d.ts +50 -12
  30. package/resources/browsers.d.ts.map +1 -1
  31. package/resources/browsers.js +20 -0
  32. package/resources/browsers.js.map +1 -1
  33. package/resources/browsers.mjs +20 -0
  34. package/resources/browsers.mjs.map +1 -1
  35. package/src/client.ts +2 -0
  36. package/src/core/streaming.ts +22 -8
  37. package/src/internal/parse.ts +2 -2
  38. package/src/internal/request-options.ts +53 -0
  39. package/src/resources/browsers.ts +64 -14
  40. package/src/version.ts +1 -1
  41. package/version.d.mts +1 -1
  42. package/version.d.ts +1 -1
  43. package/version.js +1 -1
  44. package/version.mjs +1 -1
@@ -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;
@@ -84,6 +84,27 @@ export class Browsers extends APIResource {
84
84
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
85
85
  });
86
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
+ }
87
108
  }
88
109
 
89
110
  /**
@@ -97,11 +118,6 @@ export interface BrowserPersistence {
97
118
  }
98
119
 
99
120
  export interface BrowserCreateResponse {
100
- /**
101
- * Remote URL for live viewing the browser session
102
- */
103
- browser_live_view_url: string;
104
-
105
121
  /**
106
122
  * Websocket URL for Chrome DevTools Protocol connections to the browser session
107
123
  */
@@ -112,18 +128,24 @@ export interface BrowserCreateResponse {
112
128
  */
113
129
  session_id: string;
114
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
+
115
137
  /**
116
138
  * Optional persistence configuration for the browser session.
117
139
  */
118
140
  persistence?: BrowserPersistence;
119
- }
120
141
 
121
- export interface BrowserRetrieveResponse {
122
142
  /**
123
- * Remote URL for live viewing the browser session
143
+ * Remote URL for viewing the browser session replay if enabled
124
144
  */
125
- browser_live_view_url: string;
145
+ replay_view_url?: string;
146
+ }
126
147
 
148
+ export interface BrowserRetrieveResponse {
127
149
  /**
128
150
  * Websocket URL for Chrome DevTools Protocol connections to the browser session
129
151
  */
@@ -134,21 +156,27 @@ export interface BrowserRetrieveResponse {
134
156
  */
135
157
  session_id: string;
136
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
+
137
165
  /**
138
166
  * Optional persistence configuration for the browser session.
139
167
  */
140
168
  persistence?: BrowserPersistence;
169
+
170
+ /**
171
+ * Remote URL for viewing the browser session replay if enabled
172
+ */
173
+ replay_view_url?: string;
141
174
  }
142
175
 
143
176
  export type BrowserListResponse = Array<BrowserListResponse.BrowserListResponseItem>;
144
177
 
145
178
  export namespace BrowserListResponse {
146
179
  export interface BrowserListResponseItem {
147
- /**
148
- * Remote URL for live viewing the browser session
149
- */
150
- browser_live_view_url: string;
151
-
152
180
  /**
153
181
  * Websocket URL for Chrome DevTools Protocol connections to the browser session
154
182
  */
@@ -159,14 +187,31 @@ export namespace BrowserListResponse {
159
187
  */
160
188
  session_id: string;
161
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
+
162
196
  /**
163
197
  * Optional persistence configuration for the browser session.
164
198
  */
165
199
  persistence?: BrowsersAPI.BrowserPersistence;
200
+
201
+ /**
202
+ * Remote URL for viewing the browser session replay if enabled
203
+ */
204
+ replay_view_url?: string;
166
205
  }
167
206
  }
168
207
 
169
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
+
170
215
  /**
171
216
  * action invocation ID
172
217
  */
@@ -177,6 +222,11 @@ export interface BrowserCreateParams {
177
222
  */
178
223
  persistence?: BrowserPersistence;
179
224
 
225
+ /**
226
+ * If true, enables replay recording of the browser session. Defaults to false.
227
+ */
228
+ replay?: boolean;
229
+
180
230
  /**
181
231
  * If true, launches the browser in stealth mode to reduce detection by anti-bot
182
232
  * mechanisms.
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.6.5'; // x-release-please-version
1
+ export const VERSION = '0.7.1'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.6.5";
1
+ export declare const VERSION = "0.7.1";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.6.5";
1
+ export declare const VERSION = "0.7.1";
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.6.5'; // x-release-please-version
4
+ exports.VERSION = '0.7.1'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.6.5'; // x-release-please-version
1
+ export const VERSION = '0.7.1'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map