@onkernel/sdk 0.9.0 → 0.10.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 (70) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/client.d.mts.map +1 -1
  3. package/client.d.ts.map +1 -1
  4. package/client.js +8 -1
  5. package/client.js.map +1 -1
  6. package/client.mjs +8 -1
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/browsers/browsers.d.mts +64 -2
  10. package/resources/browsers/browsers.d.mts.map +1 -1
  11. package/resources/browsers/browsers.d.ts +64 -2
  12. package/resources/browsers/browsers.d.ts.map +1 -1
  13. package/resources/browsers/browsers.js +8 -0
  14. package/resources/browsers/browsers.js.map +1 -1
  15. package/resources/browsers/browsers.mjs +8 -0
  16. package/resources/browsers/browsers.mjs.map +1 -1
  17. package/resources/browsers/fs/fs.d.mts +70 -1
  18. package/resources/browsers/fs/fs.d.mts.map +1 -1
  19. package/resources/browsers/fs/fs.d.ts +70 -1
  20. package/resources/browsers/fs/fs.d.ts.map +1 -1
  21. package/resources/browsers/fs/fs.js +55 -0
  22. package/resources/browsers/fs/fs.js.map +1 -1
  23. package/resources/browsers/fs/fs.mjs +55 -0
  24. package/resources/browsers/fs/fs.mjs.map +1 -1
  25. package/resources/browsers/fs/index.d.mts +1 -1
  26. package/resources/browsers/fs/index.d.mts.map +1 -1
  27. package/resources/browsers/fs/index.d.ts +1 -1
  28. package/resources/browsers/fs/index.d.ts.map +1 -1
  29. package/resources/browsers/fs/index.js.map +1 -1
  30. package/resources/browsers/fs/index.mjs.map +1 -1
  31. package/resources/browsers/index.d.mts +3 -1
  32. package/resources/browsers/index.d.mts.map +1 -1
  33. package/resources/browsers/index.d.ts +3 -1
  34. package/resources/browsers/index.d.ts.map +1 -1
  35. package/resources/browsers/index.js +5 -1
  36. package/resources/browsers/index.js.map +1 -1
  37. package/resources/browsers/index.mjs +2 -0
  38. package/resources/browsers/index.mjs.map +1 -1
  39. package/resources/browsers/logs.d.mts +34 -0
  40. package/resources/browsers/logs.d.mts.map +1 -0
  41. package/resources/browsers/logs.d.ts +34 -0
  42. package/resources/browsers/logs.d.ts.map +1 -0
  43. package/resources/browsers/logs.js +29 -0
  44. package/resources/browsers/logs.js.map +1 -0
  45. package/resources/browsers/logs.mjs +25 -0
  46. package/resources/browsers/logs.mjs.map +1 -0
  47. package/resources/browsers/process.d.mts +274 -0
  48. package/resources/browsers/process.d.mts.map +1 -0
  49. package/resources/browsers/process.d.ts +274 -0
  50. package/resources/browsers/process.d.ts.map +1 -0
  51. package/resources/browsers/process.js +101 -0
  52. package/resources/browsers/process.js.map +1 -0
  53. package/resources/browsers/process.mjs +97 -0
  54. package/resources/browsers/process.mjs.map +1 -0
  55. package/src/client.ts +15 -1
  56. package/src/resources/browsers/browsers.ts +113 -0
  57. package/src/resources/browsers/fs/fs.ts +105 -0
  58. package/src/resources/browsers/fs/index.ts +3 -0
  59. package/src/resources/browsers/index.ts +19 -0
  60. package/src/resources/browsers/logs.ts +50 -0
  61. package/src/resources/browsers/process.ts +366 -0
  62. package/src/version.ts +1 -1
  63. package/version.d.mts +1 -1
  64. package/version.d.mts.map +1 -1
  65. package/version.d.ts +1 -1
  66. package/version.d.ts.map +1 -1
  67. package/version.js +1 -1
  68. package/version.js.map +1 -1
  69. package/version.mjs +1 -1
  70. package/version.mjs.map +1 -1
@@ -0,0 +1,274 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import { APIPromise } from "../../core/api-promise.js";
3
+ import { Stream } from "../../core/streaming.js";
4
+ import { RequestOptions } from "../../internal/request-options.js";
5
+ export declare class Process extends APIResource {
6
+ /**
7
+ * Execute a command synchronously
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const response = await client.browsers.process.exec('id', {
12
+ * command: 'command',
13
+ * });
14
+ * ```
15
+ */
16
+ exec(id: string, body: ProcessExecParams, options?: RequestOptions): APIPromise<ProcessExecResponse>;
17
+ /**
18
+ * Send signal to process
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const response = await client.browsers.process.kill(
23
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
24
+ * { id: 'id', signal: 'TERM' },
25
+ * );
26
+ * ```
27
+ */
28
+ kill(processID: string, params: ProcessKillParams, options?: RequestOptions): APIPromise<ProcessKillResponse>;
29
+ /**
30
+ * Execute a command asynchronously
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const response = await client.browsers.process.spawn('id', {
35
+ * command: 'command',
36
+ * });
37
+ * ```
38
+ */
39
+ spawn(id: string, body: ProcessSpawnParams, options?: RequestOptions): APIPromise<ProcessSpawnResponse>;
40
+ /**
41
+ * Get process status
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const response = await client.browsers.process.status(
46
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
47
+ * { id: 'id' },
48
+ * );
49
+ * ```
50
+ */
51
+ status(processID: string, params: ProcessStatusParams, options?: RequestOptions): APIPromise<ProcessStatusResponse>;
52
+ /**
53
+ * Write to process stdin
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const response = await client.browsers.process.stdin(
58
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
59
+ * { id: 'id', data_b64: 'data_b64' },
60
+ * );
61
+ * ```
62
+ */
63
+ stdin(processID: string, params: ProcessStdinParams, options?: RequestOptions): APIPromise<ProcessStdinResponse>;
64
+ /**
65
+ * Stream process stdout via SSE
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * const response = await client.browsers.process.stdoutStream(
70
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
71
+ * { id: 'id' },
72
+ * );
73
+ * ```
74
+ */
75
+ stdoutStream(processID: string, params: ProcessStdoutStreamParams, options?: RequestOptions): APIPromise<Stream<ProcessStdoutStreamResponse>>;
76
+ }
77
+ /**
78
+ * Result of a synchronous command execution.
79
+ */
80
+ export interface ProcessExecResponse {
81
+ /**
82
+ * Execution duration in milliseconds.
83
+ */
84
+ duration_ms?: number;
85
+ /**
86
+ * Process exit code.
87
+ */
88
+ exit_code?: number;
89
+ /**
90
+ * Base64-encoded stderr buffer.
91
+ */
92
+ stderr_b64?: string;
93
+ /**
94
+ * Base64-encoded stdout buffer.
95
+ */
96
+ stdout_b64?: string;
97
+ }
98
+ /**
99
+ * Generic OK response.
100
+ */
101
+ export interface ProcessKillResponse {
102
+ /**
103
+ * Indicates success.
104
+ */
105
+ ok: boolean;
106
+ }
107
+ /**
108
+ * Information about a spawned process.
109
+ */
110
+ export interface ProcessSpawnResponse {
111
+ /**
112
+ * OS process ID.
113
+ */
114
+ pid?: number;
115
+ /**
116
+ * Server-assigned identifier for the process.
117
+ */
118
+ process_id?: string;
119
+ /**
120
+ * Timestamp when the process started.
121
+ */
122
+ started_at?: string;
123
+ }
124
+ /**
125
+ * Current status of a process.
126
+ */
127
+ export interface ProcessStatusResponse {
128
+ /**
129
+ * Estimated CPU usage percentage.
130
+ */
131
+ cpu_pct?: number;
132
+ /**
133
+ * Exit code if the process has exited.
134
+ */
135
+ exit_code?: number | null;
136
+ /**
137
+ * Estimated resident memory usage in bytes.
138
+ */
139
+ mem_bytes?: number;
140
+ /**
141
+ * Process state.
142
+ */
143
+ state?: 'running' | 'exited';
144
+ }
145
+ /**
146
+ * Result of writing to stdin.
147
+ */
148
+ export interface ProcessStdinResponse {
149
+ /**
150
+ * Number of bytes written.
151
+ */
152
+ written_bytes?: number;
153
+ }
154
+ /**
155
+ * SSE payload representing process output or lifecycle events.
156
+ */
157
+ export interface ProcessStdoutStreamResponse {
158
+ /**
159
+ * Base64-encoded data from the process stream.
160
+ */
161
+ data_b64?: string;
162
+ /**
163
+ * Lifecycle event type.
164
+ */
165
+ event?: 'exit';
166
+ /**
167
+ * Exit code when the event is "exit".
168
+ */
169
+ exit_code?: number;
170
+ /**
171
+ * Source stream of the data chunk.
172
+ */
173
+ stream?: 'stdout' | 'stderr';
174
+ }
175
+ export interface ProcessExecParams {
176
+ /**
177
+ * Executable or shell command to run.
178
+ */
179
+ command: string;
180
+ /**
181
+ * Command arguments.
182
+ */
183
+ args?: Array<string>;
184
+ /**
185
+ * Run the process with root privileges.
186
+ */
187
+ as_root?: boolean;
188
+ /**
189
+ * Run the process as this user.
190
+ */
191
+ as_user?: string | null;
192
+ /**
193
+ * Working directory (absolute path) to run the command in.
194
+ */
195
+ cwd?: string | null;
196
+ /**
197
+ * Environment variables to set for the process.
198
+ */
199
+ env?: {
200
+ [key: string]: string;
201
+ };
202
+ /**
203
+ * Maximum execution time in seconds.
204
+ */
205
+ timeout_sec?: number | null;
206
+ }
207
+ export interface ProcessKillParams {
208
+ /**
209
+ * Path param: Browser session ID
210
+ */
211
+ id: string;
212
+ /**
213
+ * Body param: Signal to send.
214
+ */
215
+ signal: 'TERM' | 'KILL' | 'INT' | 'HUP';
216
+ }
217
+ export interface ProcessSpawnParams {
218
+ /**
219
+ * Executable or shell command to run.
220
+ */
221
+ command: string;
222
+ /**
223
+ * Command arguments.
224
+ */
225
+ args?: Array<string>;
226
+ /**
227
+ * Run the process with root privileges.
228
+ */
229
+ as_root?: boolean;
230
+ /**
231
+ * Run the process as this user.
232
+ */
233
+ as_user?: string | null;
234
+ /**
235
+ * Working directory (absolute path) to run the command in.
236
+ */
237
+ cwd?: string | null;
238
+ /**
239
+ * Environment variables to set for the process.
240
+ */
241
+ env?: {
242
+ [key: string]: string;
243
+ };
244
+ /**
245
+ * Maximum execution time in seconds.
246
+ */
247
+ timeout_sec?: number | null;
248
+ }
249
+ export interface ProcessStatusParams {
250
+ /**
251
+ * Browser session ID
252
+ */
253
+ id: string;
254
+ }
255
+ export interface ProcessStdinParams {
256
+ /**
257
+ * Path param: Browser session ID
258
+ */
259
+ id: string;
260
+ /**
261
+ * Body param: Base64-encoded data to write.
262
+ */
263
+ data_b64: string;
264
+ }
265
+ export interface ProcessStdoutStreamParams {
266
+ /**
267
+ * Browser session ID
268
+ */
269
+ id: string;
270
+ }
271
+ export declare namespace Process {
272
+ export { type ProcessExecResponse as ProcessExecResponse, type ProcessKillResponse as ProcessKillResponse, type ProcessSpawnResponse as ProcessSpawnResponse, type ProcessStatusResponse as ProcessStatusResponse, type ProcessStdinResponse as ProcessStdinResponse, type ProcessStdoutStreamResponse as ProcessStdoutStreamResponse, type ProcessExecParams as ProcessExecParams, type ProcessKillParams as ProcessKillParams, type ProcessSpawnParams as ProcessSpawnParams, type ProcessStatusParams as ProcessStatusParams, type ProcessStdinParams as ProcessStdinParams, type ProcessStdoutStreamParams as ProcessStdoutStreamParams, };
273
+ }
274
+ //# sourceMappingURL=process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/resources/browsers/process.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OAEV,EAAE,cAAc,EAAE;AAGzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;IAIpG;;;;;;;;;;OAUG;IACH,IAAI,CACF,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,iBAAiB,EACzB,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,mBAAmB,CAAC;IAKlC;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAIvG;;;;;;;;;;OAUG;IACH,MAAM,CACJ,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,EAC3B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,qBAAqB,CAAC;IAKpC;;;;;;;;;;OAUG;IACH,KAAK,CACH,SAA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,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,yBAAyB,IAAI,yBAAyB,GAC5D,CAAC;CACH"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Process = void 0;
5
+ const resource_1 = require("../../core/resource.js");
6
+ const headers_1 = require("../../internal/headers.js");
7
+ const path_1 = require("../../internal/utils/path.js");
8
+ class Process extends resource_1.APIResource {
9
+ /**
10
+ * Execute a command synchronously
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const response = await client.browsers.process.exec('id', {
15
+ * command: 'command',
16
+ * });
17
+ * ```
18
+ */
19
+ exec(id, body, options) {
20
+ return this._client.post((0, path_1.path) `/browsers/${id}/process/exec`, { body, ...options });
21
+ }
22
+ /**
23
+ * Send signal to process
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const response = await client.browsers.process.kill(
28
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
29
+ * { id: 'id', signal: 'TERM' },
30
+ * );
31
+ * ```
32
+ */
33
+ kill(processID, params, options) {
34
+ const { id, ...body } = params;
35
+ return this._client.post((0, path_1.path) `/browsers/${id}/process/${processID}/kill`, { body, ...options });
36
+ }
37
+ /**
38
+ * Execute a command asynchronously
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const response = await client.browsers.process.spawn('id', {
43
+ * command: 'command',
44
+ * });
45
+ * ```
46
+ */
47
+ spawn(id, body, options) {
48
+ return this._client.post((0, path_1.path) `/browsers/${id}/process/spawn`, { body, ...options });
49
+ }
50
+ /**
51
+ * Get process status
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const response = await client.browsers.process.status(
56
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
57
+ * { id: 'id' },
58
+ * );
59
+ * ```
60
+ */
61
+ status(processID, params, options) {
62
+ const { id } = params;
63
+ return this._client.get((0, path_1.path) `/browsers/${id}/process/${processID}/status`, options);
64
+ }
65
+ /**
66
+ * Write to process stdin
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const response = await client.browsers.process.stdin(
71
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
72
+ * { id: 'id', data_b64: 'data_b64' },
73
+ * );
74
+ * ```
75
+ */
76
+ stdin(processID, params, options) {
77
+ const { id, ...body } = params;
78
+ return this._client.post((0, path_1.path) `/browsers/${id}/process/${processID}/stdin`, { body, ...options });
79
+ }
80
+ /**
81
+ * Stream process stdout via SSE
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const response = await client.browsers.process.stdoutStream(
86
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
87
+ * { id: 'id' },
88
+ * );
89
+ * ```
90
+ */
91
+ stdoutStream(processID, params, options) {
92
+ const { id } = params;
93
+ return this._client.get((0, path_1.path) `/browsers/${id}/process/${processID}/stdout/stream`, {
94
+ ...options,
95
+ headers: (0, headers_1.buildHeaders)([{ Accept: 'text/event-stream' }, options?.headers]),
96
+ stream: true,
97
+ });
98
+ }
99
+ }
100
+ exports.Process = Process;
101
+ //# sourceMappingURL=process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/resources/browsers/process.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,uDAAsD;AAEtD,uDAAiD;AAEjD,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAU,EAAE,IAAuB,EAAE,OAAwB;QAChE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,aAAa,EAAE,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CACF,SAAiB,EACjB,MAAyB,EACzB,OAAwB;QAExB,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,aAAa,EAAE,YAAY,SAAS,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClG,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAU,EAAE,IAAwB,EAAE,OAAwB;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,aAAa,EAAE,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CACJ,SAAiB,EACjB,MAA2B,EAC3B,OAAwB;QAExB,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,aAAa,EAAE,YAAY,SAAS,SAAS,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CACH,SAAiB,EACjB,MAA0B,EAC1B,OAAwB;QAExB,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,aAAa,EAAE,YAAY,SAAS,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnG,CAAC;IAED;;;;;;;;;;OAUG;IACH,YAAY,CACV,SAAiB,EACjB,MAAiC,EACjC,OAAwB;QAExB,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,aAAa,EAAE,YAAY,SAAS,gBAAgB,EAAE;YAChF,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;SACb,CAAoD,CAAC;IACxD,CAAC;CACF;AAhHD,0BAgHC"}
@@ -0,0 +1,97 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import { buildHeaders } from "../../internal/headers.mjs";
4
+ import { path } from "../../internal/utils/path.mjs";
5
+ export class Process extends APIResource {
6
+ /**
7
+ * Execute a command synchronously
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const response = await client.browsers.process.exec('id', {
12
+ * command: 'command',
13
+ * });
14
+ * ```
15
+ */
16
+ exec(id, body, options) {
17
+ return this._client.post(path `/browsers/${id}/process/exec`, { body, ...options });
18
+ }
19
+ /**
20
+ * Send signal to process
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const response = await client.browsers.process.kill(
25
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
26
+ * { id: 'id', signal: 'TERM' },
27
+ * );
28
+ * ```
29
+ */
30
+ kill(processID, params, options) {
31
+ const { id, ...body } = params;
32
+ return this._client.post(path `/browsers/${id}/process/${processID}/kill`, { body, ...options });
33
+ }
34
+ /**
35
+ * Execute a command asynchronously
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const response = await client.browsers.process.spawn('id', {
40
+ * command: 'command',
41
+ * });
42
+ * ```
43
+ */
44
+ spawn(id, body, options) {
45
+ return this._client.post(path `/browsers/${id}/process/spawn`, { body, ...options });
46
+ }
47
+ /**
48
+ * Get process status
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const response = await client.browsers.process.status(
53
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
54
+ * { id: 'id' },
55
+ * );
56
+ * ```
57
+ */
58
+ status(processID, params, options) {
59
+ const { id } = params;
60
+ return this._client.get(path `/browsers/${id}/process/${processID}/status`, options);
61
+ }
62
+ /**
63
+ * Write to process stdin
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const response = await client.browsers.process.stdin(
68
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
69
+ * { id: 'id', data_b64: 'data_b64' },
70
+ * );
71
+ * ```
72
+ */
73
+ stdin(processID, params, options) {
74
+ const { id, ...body } = params;
75
+ return this._client.post(path `/browsers/${id}/process/${processID}/stdin`, { body, ...options });
76
+ }
77
+ /**
78
+ * Stream process stdout via SSE
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const response = await client.browsers.process.stdoutStream(
83
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
84
+ * { id: 'id' },
85
+ * );
86
+ * ```
87
+ */
88
+ stdoutStream(processID, params, options) {
89
+ const { id } = params;
90
+ return this._client.get(path `/browsers/${id}/process/${processID}/stdout/stream`, {
91
+ ...options,
92
+ headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
93
+ stream: true,
94
+ });
95
+ }
96
+ }
97
+ //# sourceMappingURL=process.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.mjs","sourceRoot":"","sources":["../../src/resources/browsers/process.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAU,EAAE,IAAuB,EAAE,OAAwB;QAChE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,aAAa,EAAE,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CACF,SAAiB,EACjB,MAAyB,EACzB,OAAwB;QAExB,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,aAAa,EAAE,YAAY,SAAS,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClG,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAU,EAAE,IAAwB,EAAE,OAAwB;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,aAAa,EAAE,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CACJ,SAAiB,EACjB,MAA2B,EAC3B,OAAwB;QAExB,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,EAAE,YAAY,SAAS,SAAS,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CACH,SAAiB,EACjB,MAA0B,EAC1B,OAAwB;QAExB,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,aAAa,EAAE,YAAY,SAAS,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnG,CAAC;IAED;;;;;;;;;;OAUG;IACH,YAAY,CACV,SAAiB,EACjB,MAAiC,EACjC,OAAwB;QAExB,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,EAAE,YAAY,SAAS,gBAAgB,EAAE;YAChF,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;SACb,CAAoD,CAAC;IACxD,CAAC;CACF"}
package/src/client.ts CHANGED
@@ -187,6 +187,18 @@ export class Kernel {
187
187
  apiKey = readEnv('KERNEL_API_KEY'),
188
188
  ...opts
189
189
  }: ClientOptions = {}) {
190
+ // Check for Bun runtime in a way that avoids type errors if Bun is not defined
191
+ if (
192
+ typeof globalThis !== 'undefined' &&
193
+ typeof (globalThis as any).Bun !== 'undefined' &&
194
+ (globalThis as any).Bun.version &&
195
+ !readEnv('KERNEL_SUPPRESS_BUN_WARNING')
196
+ ) {
197
+ loggerFor(this).warn(
198
+ 'The Bun runtime was detected. Playwright may have CDP connection issues, proceed with caution. Suppress this warning by setting the KERNEL_SUPPRESS_BUN_WARNING environment variable to true',
199
+ );
200
+ }
201
+
190
202
  if (apiKey === undefined) {
191
203
  throw new Errors.KernelError(
192
204
  "The KERNEL_API_KEY environment variable is missing or empty; either provide it, or instantiate the Kernel client with an apiKey option, like new Kernel({ apiKey: 'My API Key' }).",
@@ -730,7 +742,7 @@ export class Kernel {
730
742
  // Preserve legacy string encoding behavior for now
731
743
  headers.values.has('content-type')) ||
732
744
  // `Blob` is superset of `File`
733
- body instanceof Blob ||
745
+ ((globalThis as any).Blob && body instanceof (globalThis as any).Blob) ||
734
746
  // `FormData` -> `multipart/form-data`
735
747
  body instanceof FormData ||
736
748
  // `URLSearchParams` -> `application/x-www-form-urlencoded`
@@ -784,10 +796,12 @@ export class Kernel {
784
796
  invocations: API.Invocations = new API.Invocations(this);
785
797
  browsers: API.Browsers = new API.Browsers(this);
786
798
  }
799
+
787
800
  Kernel.Deployments = Deployments;
788
801
  Kernel.Apps = Apps;
789
802
  Kernel.Invocations = Invocations;
790
803
  Kernel.Browsers = Browsers;
804
+
791
805
  export declare namespace Kernel {
792
806
  export type RequestOptions = Opts.RequestOptions;
793
807