@onkernel/sdk 0.49.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 (85) hide show
  1. package/CHANGELOG.md +64 -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 +72 -1
  48. package/resources/browsers/browsers.d.mts.map +1 -1
  49. package/resources/browsers/browsers.d.ts +72 -1
  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/index.d.mts +1 -1
  62. package/resources/index.d.mts.map +1 -1
  63. package/resources/index.d.ts +1 -1
  64. package/resources/index.d.ts.map +1 -1
  65. package/resources/index.js.map +1 -1
  66. package/resources/index.mjs.map +1 -1
  67. package/resources/projects/projects.d.mts +2 -2
  68. package/resources/projects/projects.d.ts +2 -2
  69. package/resources/projects/projects.js +2 -2
  70. package/resources/projects/projects.mjs +2 -2
  71. package/src/client.ts +25 -2
  72. package/src/index.ts +2 -0
  73. package/src/lib/browser-fetch.ts +180 -0
  74. package/src/lib/browser-routing.ts +329 -0
  75. package/src/lib/join-url.ts +3 -0
  76. package/src/resources/auth/connections.ts +35 -2
  77. package/src/resources/browsers/browsers.ts +85 -0
  78. package/src/resources/browsers/index.ts +2 -0
  79. package/src/resources/index.ts +2 -0
  80. package/src/resources/projects/projects.ts +2 -2
  81. package/src/version.ts +1 -1
  82. package/version.d.mts +1 -1
  83. package/version.d.ts +1 -1
  84. package/version.js +1 -1
  85. package/version.mjs +1 -1
@@ -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.
@@ -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,
@@ -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.49.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.49.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.49.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.49.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.49.0'; // x-release-please-version
1
+ export const VERSION = '0.51.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map