@onkernel/sdk 0.106.0 → 0.107.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 (53) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/client.d.mts +2 -5
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -5
  5. package/client.d.ts.map +1 -1
  6. package/client.js +0 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +0 -3
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/browsers/browsers.d.mts +124 -4
  12. package/resources/browsers/browsers.d.mts.map +1 -1
  13. package/resources/browsers/browsers.d.ts +124 -4
  14. package/resources/browsers/browsers.d.ts.map +1 -1
  15. package/resources/browsers/browsers.js +26 -3
  16. package/resources/browsers/browsers.js.map +1 -1
  17. package/resources/browsers/browsers.mjs +26 -3
  18. package/resources/browsers/browsers.mjs.map +1 -1
  19. package/resources/browsers/index.d.mts +1 -1
  20. package/resources/browsers/index.d.mts.map +1 -1
  21. package/resources/browsers/index.d.ts +1 -1
  22. package/resources/browsers/index.d.ts.map +1 -1
  23. package/resources/browsers/index.js.map +1 -1
  24. package/resources/browsers/index.mjs.map +1 -1
  25. package/resources/config-registry/config-registry.d.mts +1 -1
  26. package/resources/config-registry/config-registry.d.mts.map +1 -1
  27. package/resources/config-registry/config-registry.d.ts +1 -1
  28. package/resources/config-registry/config-registry.d.ts.map +1 -1
  29. package/resources/index.d.mts +1 -1
  30. package/resources/index.d.mts.map +1 -1
  31. package/resources/index.d.ts +1 -1
  32. package/resources/index.d.ts.map +1 -1
  33. package/resources/index.js.map +1 -1
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/vaults/items.d.mts +6 -3
  36. package/resources/vaults/items.d.mts.map +1 -1
  37. package/resources/vaults/items.d.ts +6 -3
  38. package/resources/vaults/items.d.ts.map +1 -1
  39. package/resources/vaults/items.js +4 -2
  40. package/resources/vaults/items.js.map +1 -1
  41. package/resources/vaults/items.mjs +4 -2
  42. package/resources/vaults/items.mjs.map +1 -1
  43. package/src/client.ts +12 -3
  44. package/src/resources/browsers/browsers.ts +153 -3
  45. package/src/resources/browsers/index.ts +6 -0
  46. package/src/resources/config-registry/config-registry.ts +1 -1
  47. package/src/resources/index.ts +6 -0
  48. package/src/resources/vaults/items.ts +6 -3
  49. package/src/version.ts +1 -1
  50. package/version.d.mts +1 -1
  51. package/version.d.ts +1 -1
  52. package/version.js +1 -1
  53. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -168,6 +168,12 @@ import {
168
168
  BrowserProxy,
169
169
  BrowserProxyConfig,
170
170
  BrowserProxyMode,
171
+ BrowserReplContent,
172
+ BrowserReplImageContent,
173
+ BrowserReplParams,
174
+ BrowserReplRequest,
175
+ BrowserReplResult,
176
+ BrowserReplTextContent,
171
177
  BrowserRetrieveParams,
172
178
  BrowserRetrieveResponse,
173
179
  BrowserUpdateParams,
@@ -1053,9 +1059,6 @@ export class Kernel {
1053
1059
  * Resolve browser and proxy recommendations for bot-protected sites.
1054
1060
  */
1055
1061
  configRegistry: API.ConfigRegistry = new API.ConfigRegistry(this);
1056
- /**
1057
- * Create and manage browser sessions.
1058
- */
1059
1062
  browsers: API.Browsers = new API.Browsers(this);
1060
1063
  /**
1061
1064
  * Create, list, retrieve, and delete browser profiles.
@@ -1205,6 +1208,11 @@ export declare namespace Kernel {
1205
1208
  type BrowserProxy as BrowserProxy,
1206
1209
  type BrowserProxyConfig as BrowserProxyConfig,
1207
1210
  type BrowserProxyMode as BrowserProxyMode,
1211
+ type BrowserReplContent as BrowserReplContent,
1212
+ type BrowserReplImageContent as BrowserReplImageContent,
1213
+ type BrowserReplRequest as BrowserReplRequest,
1214
+ type BrowserReplResult as BrowserReplResult,
1215
+ type BrowserReplTextContent as BrowserReplTextContent,
1208
1216
  type BrowserUsage as BrowserUsage,
1209
1217
  type Profile as Profile,
1210
1218
  type Tags as Tags,
@@ -1221,6 +1229,7 @@ export declare namespace Kernel {
1221
1229
  type BrowserListParams as BrowserListParams,
1222
1230
  type BrowserCurlParams as BrowserCurlParams,
1223
1231
  type BrowserLoadExtensionsParams as BrowserLoadExtensionsParams,
1232
+ type BrowserReplParams as BrowserReplParams,
1224
1233
  };
1225
1234
 
1226
1235
  export {
@@ -149,9 +149,6 @@ import { multipartFormRequestOptions } from '../../internal/uploads';
149
149
  import { path } from '../../internal/utils/path';
150
150
  import { browserFetch, type BrowserFetchInit } from '../../lib/browser-fetch';
151
151
 
152
- /**
153
- * Create and manage browser sessions.
154
- */
155
152
  export class Browsers extends APIResource {
156
153
  telemetry: TelemetryAPI.Telemetry = new TelemetryAPI.Telemetry(this._client);
157
154
  replays: ReplaysAPI.Replays = new ReplaysAPI.Replays(this._client);
@@ -306,6 +303,33 @@ export class Browsers extends APIResource {
306
303
  ),
307
304
  );
308
305
  }
306
+
307
+ /**
308
+ * Execute JavaScript in a persistent Node.js runtime inside the browser VM.
309
+ * Top-level bindings, closures, mutations, and dynamically imported modules
310
+ * persist across calls until the REPL is reset or replaced. Start with
311
+ * `repl.help()` to list available methods, or call `repl.help("click")` for
312
+ * detailed help.
313
+ *
314
+ * Expression values are ignored. Emit ordered text or image output with
315
+ * `repl.write(...)`, console methods, or `repl.emitImage(...)`. The runtime also
316
+ * exposes browser-control helpers, WebMCP, Patchright, Playwright, and raw CDP.
317
+ *
318
+ * Executions are serialized. A timeout, crash, OOM, or protocol failure terminates
319
+ * the REPL and changes its `repl_id`. This is unrestricted code execution inside
320
+ * the browser VM and is not sandboxed.
321
+ *
322
+ * @example
323
+ * ```ts
324
+ * const browserReplResult = await client.browsers.repl(
325
+ * 'htzv5orfit78e1m2biiifpbv',
326
+ * { code: 'code' },
327
+ * );
328
+ * ```
329
+ */
330
+ repl(idOrName: string, body: BrowserReplParams, options?: RequestOptions): APIPromise<BrowserReplResult> {
331
+ return this._client.post(path`/browsers/${idOrName}/repl`, { body, ...options });
332
+ }
309
333
  }
310
334
 
311
335
  export type BrowserListResponsesOffsetPagination = OffsetPagination<BrowserListResponse>;
@@ -434,6 +458,104 @@ export interface BrowserProxyConfig {
434
458
  */
435
459
  export type BrowserProxyMode = 'direct' | 'default';
436
460
 
461
+ /**
462
+ * Ordered discriminated union of Browser REPL output items.
463
+ */
464
+ export type BrowserReplContent = BrowserReplTextContent | BrowserReplImageContent;
465
+
466
+ export interface BrowserReplImageContent {
467
+ data_b64: string;
468
+
469
+ mime_type: string;
470
+
471
+ type: 'image';
472
+ }
473
+
474
+ /**
475
+ * Request to execute code in the persistent Browser REPL.
476
+ */
477
+ export interface BrowserReplRequest {
478
+ /**
479
+ * JavaScript evaluated in a persistent Node.js runtime. Top-level bindings persist
480
+ * until the browser VM's API process exits, the REPL is reset, or the REPL is
481
+ * terminated after a crash or timeout. Static top-level imports are unsupported;
482
+ * use dynamic `import()`. Expression values are ignored; emit output with
483
+ * `repl.write(...)`, console methods, or `repl.emitImage(...)`. May be empty only
484
+ * when `reset` is true.
485
+ */
486
+ code: string;
487
+
488
+ /**
489
+ * Terminate the current REPL, start a fresh one, and then evaluate code.
490
+ */
491
+ reset?: boolean;
492
+
493
+ /**
494
+ * Maximum execution time in seconds. Default is 60.
495
+ */
496
+ timeout_sec?: number;
497
+ }
498
+
499
+ /**
500
+ * Result of Browser REPL code execution.
501
+ */
502
+ export interface BrowserReplResult {
503
+ /**
504
+ * CUID2 identifying the exact state-holding REPL process used for this execution.
505
+ * Stable across calls and Chromium reconnects; changes after an API restart,
506
+ * explicit reset, execution timeout, or REPL crash.
507
+ */
508
+ repl_id: string;
509
+
510
+ /**
511
+ * Whether the code executed successfully.
512
+ */
513
+ success: boolean;
514
+
515
+ /**
516
+ * Optional ordered text/image output produced by the execution.
517
+ */
518
+ content?: Array<BrowserReplContent>;
519
+
520
+ /**
521
+ * True if text or image output was dropped or truncated due to response limits.
522
+ */
523
+ content_truncated?: boolean;
524
+
525
+ /**
526
+ * Wall-clock execution time in milliseconds.
527
+ */
528
+ duration_ms?: number;
529
+
530
+ /**
531
+ * Error message if execution failed.
532
+ */
533
+ error?: string;
534
+
535
+ /**
536
+ * True if the REPL identified by `repl_id` was terminated by this request. The
537
+ * next request lazily starts a fresh REPL with a new `repl_id`.
538
+ */
539
+ repl_terminated?: boolean;
540
+
541
+ /**
542
+ * Stack trace if execution failed.
543
+ */
544
+ stack?: string;
545
+ }
546
+
547
+ export interface BrowserReplTextContent {
548
+ /**
549
+ * `write` is emitted by `repl.write`; `stdout` and `stderr` are emitted by console
550
+ * methods.
551
+ */
552
+ channel: 'write' | 'stdout' | 'stderr';
553
+
554
+ text: string;
555
+
556
+ type: 'text';
557
+ }
558
+
437
559
  /**
438
560
  * Session usage metrics.
439
561
  */
@@ -1703,6 +1825,28 @@ export namespace BrowserLoadExtensionsParams {
1703
1825
  }
1704
1826
  }
1705
1827
 
1828
+ export interface BrowserReplParams {
1829
+ /**
1830
+ * JavaScript evaluated in a persistent Node.js runtime. Top-level bindings persist
1831
+ * until the browser VM's API process exits, the REPL is reset, or the REPL is
1832
+ * terminated after a crash or timeout. Static top-level imports are unsupported;
1833
+ * use dynamic `import()`. Expression values are ignored; emit output with
1834
+ * `repl.write(...)`, console methods, or `repl.emitImage(...)`. May be empty only
1835
+ * when `reset` is true.
1836
+ */
1837
+ code: string;
1838
+
1839
+ /**
1840
+ * Terminate the current REPL, start a fresh one, and then evaluate code.
1841
+ */
1842
+ reset?: boolean;
1843
+
1844
+ /**
1845
+ * Maximum execution time in seconds. Default is 60.
1846
+ */
1847
+ timeout_sec?: number;
1848
+ }
1849
+
1706
1850
  Browsers.Telemetry = TelemetryAPITelemetry;
1707
1851
  Browsers.Replays = Replays;
1708
1852
  Browsers.Fs = Fs;
@@ -1721,6 +1865,11 @@ export declare namespace Browsers {
1721
1865
  type BrowserProxy as BrowserProxy,
1722
1866
  type BrowserProxyConfig as BrowserProxyConfig,
1723
1867
  type BrowserProxyMode as BrowserProxyMode,
1868
+ type BrowserReplContent as BrowserReplContent,
1869
+ type BrowserReplImageContent as BrowserReplImageContent,
1870
+ type BrowserReplRequest as BrowserReplRequest,
1871
+ type BrowserReplResult as BrowserReplResult,
1872
+ type BrowserReplTextContent as BrowserReplTextContent,
1724
1873
  type BrowserUsage as BrowserUsage,
1725
1874
  type Profile as Profile,
1726
1875
  type Tags as Tags,
@@ -1737,6 +1886,7 @@ export declare namespace Browsers {
1737
1886
  type BrowserListParams as BrowserListParams,
1738
1887
  type BrowserCurlParams as BrowserCurlParams,
1739
1888
  type BrowserLoadExtensionsParams as BrowserLoadExtensionsParams,
1889
+ type BrowserReplParams as BrowserReplParams,
1740
1890
  };
1741
1891
 
1742
1892
  export {
@@ -9,6 +9,11 @@ export {
9
9
  type BrowserProxy,
10
10
  type BrowserProxyConfig,
11
11
  type BrowserProxyMode,
12
+ type BrowserReplContent,
13
+ type BrowserReplImageContent,
14
+ type BrowserReplRequest,
15
+ type BrowserReplResult,
16
+ type BrowserReplTextContent,
12
17
  type BrowserUsage,
13
18
  type Profile,
14
19
  type Tags,
@@ -24,6 +29,7 @@ export {
24
29
  type BrowserListParams,
25
30
  type BrowserCurlParams,
26
31
  type BrowserLoadExtensionsParams,
32
+ type BrowserReplParams,
27
33
  type ProfilesOffsetPagination,
28
34
  type BrowserListResponsesOffsetPagination,
29
35
  } from './browsers';
@@ -261,7 +261,7 @@ export interface NoRecommendation {
261
261
  /**
262
262
  * Machine-readable reason Kernel cannot currently provide a config recommendation.
263
263
  */
264
- code: 'proxy_restricted' | 'no_working_configuration' | 'inconclusive';
264
+ code: 'proxy_restricted' | 'target_not_evaluable' | 'no_working_configuration' | 'inconclusive';
265
265
 
266
266
  /**
267
267
  * Human-readable explanation suitable for display.
@@ -47,6 +47,11 @@ export {
47
47
  type BrowserProxy,
48
48
  type BrowserProxyConfig,
49
49
  type BrowserProxyMode,
50
+ type BrowserReplContent,
51
+ type BrowserReplImageContent,
52
+ type BrowserReplRequest,
53
+ type BrowserReplResult,
54
+ type BrowserReplTextContent,
50
55
  type BrowserUsage,
51
56
  type Profile,
52
57
  type Tags,
@@ -62,6 +67,7 @@ export {
62
67
  type BrowserListParams,
63
68
  type BrowserCurlParams,
64
69
  type BrowserLoadExtensionsParams,
70
+ type BrowserReplParams,
65
71
  type ProfilesOffsetPagination,
66
72
  type BrowserListResponsesOffsetPagination,
67
73
  } from './browsers/browsers';
@@ -133,8 +133,10 @@ export class Items extends APIResource {
133
133
  * device approval before native Square Pay. Keep the returned approval page open,
134
134
  * poll until ready_to_submit, then submit before preparation.expires_at. Unused
135
135
  * preparations expire automatically and cannot be reused. If spend-request
136
- * creation is rate limited, returns HTTP 429 with code
137
- * `spend_request_rate_limited`; stop and back off before retrying.
136
+ * creation is rejected with a non-retryable provider error, the card item is
137
+ * deleted and the provider's error code and message are returned. Rate limits
138
+ * return HTTP 429 and retain the card item; stop, back off, and retry the same
139
+ * authorize operation.
138
140
  *
139
141
  * Fill returns a value-free execution result. Validation failures before writing
140
142
  * return 400 (invalid request or targets), 403 (access or destination denied), 404
@@ -316,7 +318,8 @@ export namespace CardVaultItemSpec {
316
318
  */
317
319
  export interface LinkCardVaultItemSpec {
318
320
  /**
319
- * Integer amount in minor currency units.
321
+ * Integer amount in minor currency units. Link permits at most 50000 per spend
322
+ * request.
320
323
  */
321
324
  amount: number;
322
325
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.106.0'; // x-release-please-version
1
+ export const VERSION = '0.107.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.106.0";
1
+ export declare const VERSION = "0.107.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.106.0";
1
+ export declare const VERSION = "0.107.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.106.0'; // x-release-please-version
4
+ exports.VERSION = '0.107.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.106.0'; // x-release-please-version
1
+ export const VERSION = '0.107.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map