@onkernel/sdk 0.48.0 → 0.51.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 (90) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/client.d.mts +5 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +5 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +15 -2
  7. package/client.js.map +1 -1
  8. package/client.mjs +15 -2
  9. package/client.mjs.map +1 -1
  10. package/index.d.mts +2 -0
  11. package/index.d.mts.map +1 -1
  12. package/index.d.ts +2 -0
  13. package/index.d.ts.map +1 -1
  14. package/index.js +3 -1
  15. package/index.js.map +1 -1
  16. package/index.mjs +1 -0
  17. package/index.mjs.map +1 -1
  18. package/lib/browser-fetch.d.mts +7 -0
  19. package/lib/browser-fetch.d.mts.map +1 -0
  20. package/lib/browser-fetch.d.ts +7 -0
  21. package/lib/browser-fetch.d.ts.map +1 -0
  22. package/lib/browser-fetch.js +128 -0
  23. package/lib/browser-fetch.js.map +1 -0
  24. package/lib/browser-fetch.mjs +125 -0
  25. package/lib/browser-fetch.mjs.map +1 -0
  26. package/lib/browser-routing.d.mts +20 -0
  27. package/lib/browser-routing.d.mts.map +1 -0
  28. package/lib/browser-routing.d.ts +20 -0
  29. package/lib/browser-routing.d.ts.map +1 -0
  30. package/lib/browser-routing.js +246 -0
  31. package/lib/browser-routing.js.map +1 -0
  32. package/lib/browser-routing.mjs +240 -0
  33. package/lib/browser-routing.mjs.map +1 -0
  34. package/lib/join-url.d.mts +2 -0
  35. package/lib/join-url.d.mts.map +1 -0
  36. package/lib/join-url.d.ts +2 -0
  37. package/lib/join-url.d.ts.map +1 -0
  38. package/lib/join-url.js +7 -0
  39. package/lib/join-url.js.map +1 -0
  40. package/lib/join-url.mjs +4 -0
  41. package/lib/join-url.mjs.map +1 -0
  42. package/package.json +11 -1
  43. package/resources/auth/connections.d.mts +31 -2
  44. package/resources/auth/connections.d.mts.map +1 -1
  45. package/resources/auth/connections.d.ts +31 -2
  46. package/resources/auth/connections.d.ts.map +1 -1
  47. package/resources/browsers/browsers.d.mts +73 -2
  48. package/resources/browsers/browsers.d.mts.map +1 -1
  49. package/resources/browsers/browsers.d.ts +73 -2
  50. package/resources/browsers/browsers.d.ts.map +1 -1
  51. package/resources/browsers/browsers.js +23 -0
  52. package/resources/browsers/browsers.js.map +1 -1
  53. package/resources/browsers/browsers.mjs +23 -0
  54. package/resources/browsers/browsers.mjs.map +1 -1
  55. package/resources/browsers/index.d.mts +1 -1
  56. package/resources/browsers/index.d.mts.map +1 -1
  57. package/resources/browsers/index.d.ts +1 -1
  58. package/resources/browsers/index.d.ts.map +1 -1
  59. package/resources/browsers/index.js.map +1 -1
  60. package/resources/browsers/index.mjs.map +1 -1
  61. package/resources/browsers/replays.d.mts +2 -1
  62. package/resources/browsers/replays.d.mts.map +1 -1
  63. package/resources/browsers/replays.d.ts +2 -1
  64. package/resources/browsers/replays.d.ts.map +1 -1
  65. package/resources/index.d.mts +1 -1
  66. package/resources/index.d.mts.map +1 -1
  67. package/resources/index.d.ts +1 -1
  68. package/resources/index.d.ts.map +1 -1
  69. package/resources/index.js.map +1 -1
  70. package/resources/index.mjs.map +1 -1
  71. package/resources/projects/projects.d.mts +2 -2
  72. package/resources/projects/projects.d.ts +2 -2
  73. package/resources/projects/projects.js +2 -2
  74. package/resources/projects/projects.mjs +2 -2
  75. package/src/client.ts +25 -2
  76. package/src/index.ts +2 -0
  77. package/src/lib/browser-fetch.ts +180 -0
  78. package/src/lib/browser-routing.ts +329 -0
  79. package/src/lib/join-url.ts +3 -0
  80. package/src/resources/auth/connections.ts +35 -2
  81. package/src/resources/browsers/browsers.ts +86 -1
  82. package/src/resources/browsers/index.ts +2 -0
  83. package/src/resources/browsers/replays.ts +2 -1
  84. package/src/resources/index.ts +2 -0
  85. package/src/resources/projects/projects.ts +2 -2
  86. package/src/version.ts +1 -1
  87. package/version.d.mts +1 -1
  88. package/version.d.ts +1 -1
  89. package/version.js +1 -1
  90. package/version.mjs +1 -1
@@ -244,6 +244,13 @@ export interface ManagedAuth {
244
244
  */
245
245
  allowed_domains?: Array<string>;
246
246
 
247
+ /**
248
+ * ID of the underlying browser session driving the current flow (present when flow
249
+ * in progress). Use this to inspect or terminate the browser session via the
250
+ * `/browsers` API.
251
+ */
252
+ browser_session_id?: string | null;
253
+
247
254
  /**
248
255
  * Whether automatic re-authentication is possible (has credential, selectors, and
249
256
  * login_url)
@@ -286,7 +293,10 @@ export interface ManagedAuth {
286
293
  external_action_message?: string | null;
287
294
 
288
295
  /**
289
- * When the current flow expires (null when no flow in progress)
296
+ * When the current flow expires (null when no flow in progress). A flow past this
297
+ * timestamp is no longer valid and its `flow_status` will be `EXPIRED`. Clients
298
+ * may start a new login to supersede a stale `IN_PROGRESS` flow past this
299
+ * timestamp.
290
300
  */
291
301
  flow_expires_at?: string | null;
292
302
 
@@ -326,10 +336,21 @@ export interface ManagedAuth {
326
336
  hosted_url?: string | null;
327
337
 
328
338
  /**
329
- * When the profile was last successfully authenticated
339
+ * @deprecated Deprecated alias for `last_auth_check_at`. Despite the name, this is
340
+ * the last health-check timestamp, not the last successful authentication. Use
341
+ * `last_auth_check_at` instead.
330
342
  */
331
343
  last_auth_at?: string;
332
344
 
345
+ /**
346
+ * When the most recent auth health check ran for this connection, regardless of
347
+ * outcome. Updated on every health check and does not by itself indicate that the
348
+ * profile is currently authenticated - use `status` for that. May be newer than
349
+ * `flow_expires_at` when a flow is still in progress because health checks
350
+ * continue to run in parallel.
351
+ */
352
+ last_auth_check_at?: string;
353
+
333
354
  /**
334
355
  * Browser live view URL for debugging (present when flow in progress)
335
356
  */
@@ -433,6 +454,12 @@ export namespace ManagedAuth {
433
454
  */
434
455
  type: 'text' | 'email' | 'password' | 'tel' | 'number' | 'url' | 'code' | 'totp';
435
456
 
457
+ /**
458
+ * Contextual help text near the field that tells the user what to enter (e.g.,
459
+ * "Enter the phone ending in (**_) _**-\*\*92")
460
+ */
461
+ hint?: string;
462
+
436
463
  /**
437
464
  * If this field is associated with an MFA option, the type of that option (e.g.,
438
465
  * password field linked to "Enter password" option)
@@ -890,6 +917,12 @@ export namespace ConnectionFollowResponse {
890
917
  */
891
918
  type: 'text' | 'email' | 'password' | 'tel' | 'number' | 'url' | 'code' | 'totp';
892
919
 
920
+ /**
921
+ * Contextual help text near the field that tells the user what to enter (e.g.,
922
+ * "Enter the phone ending in (**_) _**-\*\*92")
923
+ */
924
+ hint?: string;
925
+
893
926
  /**
894
927
  * If this field is associated with an MFA option, the type of that option (e.g.,
895
928
  * password field linked to "Enter password" option)
@@ -1,5 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ import type { RequestInfo } from '../../internal/builtin-types';
3
4
  import { APIResource } from '../../core/resource';
4
5
  import * as Shared from '../shared';
5
6
  import * as ComputerAPI from './computer';
@@ -75,6 +76,7 @@ import { buildHeaders } from '../../internal/headers';
75
76
  import { RequestOptions } from '../../internal/request-options';
76
77
  import { multipartFormRequestOptions } from '../../internal/uploads';
77
78
  import { path } from '../../internal/utils/path';
79
+ import { browserFetch, type BrowserFetchInit } from '../../lib/browser-fetch';
78
80
 
79
81
  /**
80
82
  * Create and manage browser sessions.
@@ -168,6 +170,30 @@ export class Browsers extends APIResource {
168
170
  });
169
171
  }
170
172
 
173
+ /**
174
+ * Sends an HTTP request through Chrome's HTTP request stack, inheriting the
175
+ * browser's TLS fingerprint, cookies, proxy configuration, and headers. Returns a
176
+ * structured JSON response with status, headers, body, and timing.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * const response = await client.browsers.curl('id', {
181
+ * url: 'url',
182
+ * });
183
+ * ```
184
+ */
185
+ curl(id: string, body: BrowserCurlParams, options?: RequestOptions): APIPromise<BrowserCurlResponse> {
186
+ return this._client.post(path`/browsers/${id}/curl`, { body, ...options });
187
+ }
188
+
189
+ /**
190
+ * Issues an HTTP request through the browser VM network stack, routing directly
191
+ * to the browser's `base_url` using the shared browser route cache.
192
+ */
193
+ fetch(id: string, input: RequestInfo | URL, init?: BrowserFetchInit): Promise<Response> {
194
+ return browserFetch(this._client, id, input, init);
195
+ }
196
+
171
197
  /**
172
198
  * Delete a browser session by ID
173
199
  *
@@ -706,6 +732,31 @@ export interface BrowserListResponse {
706
732
  viewport?: Shared.BrowserViewport;
707
733
  }
708
734
 
735
+ /**
736
+ * Structured response from the browser curl request.
737
+ */
738
+ export interface BrowserCurlResponse {
739
+ /**
740
+ * Response body (UTF-8 string or base64 depending on request).
741
+ */
742
+ body: string;
743
+
744
+ /**
745
+ * Total request duration in milliseconds.
746
+ */
747
+ duration_ms: number;
748
+
749
+ /**
750
+ * Response headers (multi-value).
751
+ */
752
+ headers: { [key: string]: Array<string> };
753
+
754
+ /**
755
+ * HTTP status code from target.
756
+ */
757
+ status: number;
758
+ }
759
+
709
760
  export interface BrowserCreateParams {
710
761
  /**
711
762
  * List of browser extensions to load into the session. Provide each by id or name.
@@ -841,7 +892,7 @@ export interface BrowserListParams extends OffsetPaginationParams {
841
892
  include_deleted?: boolean;
842
893
 
843
894
  /**
844
- * Search browsers by session ID, profile ID, or proxy ID.
895
+ * Search browsers by session ID, profile ID, proxy ID, or pool name.
845
896
  */
846
897
  query?: string;
847
898
 
@@ -859,6 +910,38 @@ export interface BrowserDeleteParams {
859
910
  persistent_id: string;
860
911
  }
861
912
 
913
+ export interface BrowserCurlParams {
914
+ /**
915
+ * Target URL (must be http or https).
916
+ */
917
+ url: string;
918
+
919
+ /**
920
+ * Request body (for POST/PUT/PATCH).
921
+ */
922
+ body?: string;
923
+
924
+ /**
925
+ * Custom headers merged with browser defaults.
926
+ */
927
+ headers?: { [key: string]: string };
928
+
929
+ /**
930
+ * HTTP method.
931
+ */
932
+ method?: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
933
+
934
+ /**
935
+ * Encoding for the response body. Use base64 for binary content.
936
+ */
937
+ response_encoding?: 'utf8' | 'base64';
938
+
939
+ /**
940
+ * Request timeout in milliseconds.
941
+ */
942
+ timeout_ms?: number;
943
+ }
944
+
862
945
  export interface BrowserLoadExtensionsParams {
863
946
  /**
864
947
  * List of extensions to upload and activate
@@ -898,12 +981,14 @@ export declare namespace Browsers {
898
981
  type BrowserRetrieveResponse as BrowserRetrieveResponse,
899
982
  type BrowserUpdateResponse as BrowserUpdateResponse,
900
983
  type BrowserListResponse as BrowserListResponse,
984
+ type BrowserCurlResponse as BrowserCurlResponse,
901
985
  type BrowserListResponsesOffsetPagination as BrowserListResponsesOffsetPagination,
902
986
  type BrowserCreateParams as BrowserCreateParams,
903
987
  type BrowserRetrieveParams as BrowserRetrieveParams,
904
988
  type BrowserUpdateParams as BrowserUpdateParams,
905
989
  type BrowserListParams as BrowserListParams,
906
990
  type BrowserDeleteParams as BrowserDeleteParams,
991
+ type BrowserCurlParams as BrowserCurlParams,
907
992
  type BrowserLoadExtensionsParams as BrowserLoadExtensionsParams,
908
993
  };
909
994
 
@@ -10,11 +10,13 @@ export {
10
10
  type BrowserRetrieveResponse,
11
11
  type BrowserUpdateResponse,
12
12
  type BrowserListResponse,
13
+ type BrowserCurlResponse,
13
14
  type BrowserCreateParams,
14
15
  type BrowserRetrieveParams,
15
16
  type BrowserUpdateParams,
16
17
  type BrowserListParams,
17
18
  type BrowserDeleteParams,
19
+ type BrowserCurlParams,
18
20
  type BrowserLoadExtensionsParams,
19
21
  type ProfilesOffsetPagination,
20
22
  type BrowserListResponsesOffsetPagination,
@@ -143,7 +143,8 @@ export interface ReplayDownloadParams {
143
143
 
144
144
  export interface ReplayStartParams {
145
145
  /**
146
- * Recording framerate in fps.
146
+ * Recording framerate in fps. Values above 20 require GPU to be enabled on the
147
+ * browser session.
147
148
  */
148
149
  framerate?: number;
149
150
 
@@ -29,11 +29,13 @@ export {
29
29
  type BrowserRetrieveResponse,
30
30
  type BrowserUpdateResponse,
31
31
  type BrowserListResponse,
32
+ type BrowserCurlResponse,
32
33
  type BrowserCreateParams,
33
34
  type BrowserRetrieveParams,
34
35
  type BrowserUpdateParams,
35
36
  type BrowserListParams,
36
37
  type BrowserDeleteParams,
38
+ type BrowserCurlParams,
37
39
  type BrowserLoadExtensionsParams,
38
40
  type ProfilesOffsetPagination,
39
41
  type BrowserListResponsesOffsetPagination,
@@ -16,8 +16,8 @@ export class Projects extends APIResource {
16
16
  limits: LimitsAPI.Limits = new LimitsAPI.Limits(this._client);
17
17
 
18
18
  /**
19
- * Create a new project within the authenticated organization. Requires a paid plan
20
- * and the projects feature flag.
19
+ * Create a new project within the authenticated organization. Requires the
20
+ * projects feature flag.
21
21
  *
22
22
  * @example
23
23
  * ```ts
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.48.0'; // x-release-please-version
1
+ export const VERSION = '0.51.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.48.0";
1
+ export declare const VERSION = "0.51.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.48.0";
1
+ export declare const VERSION = "0.51.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.48.0'; // x-release-please-version
4
+ exports.VERSION = '0.51.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.48.0'; // x-release-please-version
1
+ export const VERSION = '0.51.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map