@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.
- package/CHANGELOG.md +32 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts.map +1 -1
- package/client.js +8 -1
- package/client.js.map +1 -1
- package/client.mjs +8 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/browsers/browsers.d.mts +64 -2
- package/resources/browsers/browsers.d.mts.map +1 -1
- package/resources/browsers/browsers.d.ts +64 -2
- package/resources/browsers/browsers.d.ts.map +1 -1
- package/resources/browsers/browsers.js +8 -0
- package/resources/browsers/browsers.js.map +1 -1
- package/resources/browsers/browsers.mjs +8 -0
- package/resources/browsers/browsers.mjs.map +1 -1
- package/resources/browsers/fs/fs.d.mts +70 -1
- package/resources/browsers/fs/fs.d.mts.map +1 -1
- package/resources/browsers/fs/fs.d.ts +70 -1
- package/resources/browsers/fs/fs.d.ts.map +1 -1
- package/resources/browsers/fs/fs.js +55 -0
- package/resources/browsers/fs/fs.js.map +1 -1
- package/resources/browsers/fs/fs.mjs +55 -0
- package/resources/browsers/fs/fs.mjs.map +1 -1
- package/resources/browsers/fs/index.d.mts +1 -1
- package/resources/browsers/fs/index.d.mts.map +1 -1
- package/resources/browsers/fs/index.d.ts +1 -1
- package/resources/browsers/fs/index.d.ts.map +1 -1
- package/resources/browsers/fs/index.js.map +1 -1
- package/resources/browsers/fs/index.mjs.map +1 -1
- package/resources/browsers/index.d.mts +3 -1
- package/resources/browsers/index.d.mts.map +1 -1
- package/resources/browsers/index.d.ts +3 -1
- package/resources/browsers/index.d.ts.map +1 -1
- package/resources/browsers/index.js +5 -1
- package/resources/browsers/index.js.map +1 -1
- package/resources/browsers/index.mjs +2 -0
- package/resources/browsers/index.mjs.map +1 -1
- package/resources/browsers/logs.d.mts +34 -0
- package/resources/browsers/logs.d.mts.map +1 -0
- package/resources/browsers/logs.d.ts +34 -0
- package/resources/browsers/logs.d.ts.map +1 -0
- package/resources/browsers/logs.js +29 -0
- package/resources/browsers/logs.js.map +1 -0
- package/resources/browsers/logs.mjs +25 -0
- package/resources/browsers/logs.mjs.map +1 -0
- package/resources/browsers/process.d.mts +274 -0
- package/resources/browsers/process.d.mts.map +1 -0
- package/resources/browsers/process.d.ts +274 -0
- package/resources/browsers/process.d.ts.map +1 -0
- package/resources/browsers/process.js +101 -0
- package/resources/browsers/process.js.map +1 -0
- package/resources/browsers/process.mjs +97 -0
- package/resources/browsers/process.mjs.map +1 -0
- package/src/client.ts +15 -1
- package/src/resources/browsers/browsers.ts +113 -0
- package/src/resources/browsers/fs/fs.ts +105 -0
- package/src/resources/browsers/fs/index.ts +3 -0
- package/src/resources/browsers/index.ts +19 -0
- package/src/resources/browsers/logs.ts +50 -0
- package/src/resources/browsers/process.ts +366 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../core/api-promise';
|
|
5
|
+
import { Stream } from '../../core/streaming';
|
|
6
|
+
import { buildHeaders } from '../../internal/headers';
|
|
7
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
8
|
+
import { path } from '../../internal/utils/path';
|
|
9
|
+
|
|
10
|
+
export class Process extends APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* Execute a command synchronously
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const response = await client.browsers.process.exec('id', {
|
|
17
|
+
* command: 'command',
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
exec(id: string, body: ProcessExecParams, options?: RequestOptions): APIPromise<ProcessExecResponse> {
|
|
22
|
+
return this._client.post(path`/browsers/${id}/process/exec`, { body, ...options });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Send signal to process
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const response = await client.browsers.process.kill(
|
|
31
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
32
|
+
* { id: 'id', signal: 'TERM' },
|
|
33
|
+
* );
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
kill(
|
|
37
|
+
processID: string,
|
|
38
|
+
params: ProcessKillParams,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<ProcessKillResponse> {
|
|
41
|
+
const { id, ...body } = params;
|
|
42
|
+
return this._client.post(path`/browsers/${id}/process/${processID}/kill`, { body, ...options });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Execute a command asynchronously
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const response = await client.browsers.process.spawn('id', {
|
|
51
|
+
* command: 'command',
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
spawn(id: string, body: ProcessSpawnParams, options?: RequestOptions): APIPromise<ProcessSpawnResponse> {
|
|
56
|
+
return this._client.post(path`/browsers/${id}/process/spawn`, { body, ...options });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Get process status
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const response = await client.browsers.process.status(
|
|
65
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
66
|
+
* { id: 'id' },
|
|
67
|
+
* );
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
status(
|
|
71
|
+
processID: string,
|
|
72
|
+
params: ProcessStatusParams,
|
|
73
|
+
options?: RequestOptions,
|
|
74
|
+
): APIPromise<ProcessStatusResponse> {
|
|
75
|
+
const { id } = params;
|
|
76
|
+
return this._client.get(path`/browsers/${id}/process/${processID}/status`, options);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Write to process stdin
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const response = await client.browsers.process.stdin(
|
|
85
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
86
|
+
* { id: 'id', data_b64: 'data_b64' },
|
|
87
|
+
* );
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
stdin(
|
|
91
|
+
processID: string,
|
|
92
|
+
params: ProcessStdinParams,
|
|
93
|
+
options?: RequestOptions,
|
|
94
|
+
): APIPromise<ProcessStdinResponse> {
|
|
95
|
+
const { id, ...body } = params;
|
|
96
|
+
return this._client.post(path`/browsers/${id}/process/${processID}/stdin`, { body, ...options });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Stream process stdout via SSE
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* const response = await client.browsers.process.stdoutStream(
|
|
105
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
106
|
+
* { id: 'id' },
|
|
107
|
+
* );
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
stdoutStream(
|
|
111
|
+
processID: string,
|
|
112
|
+
params: ProcessStdoutStreamParams,
|
|
113
|
+
options?: RequestOptions,
|
|
114
|
+
): APIPromise<Stream<ProcessStdoutStreamResponse>> {
|
|
115
|
+
const { id } = params;
|
|
116
|
+
return this._client.get(path`/browsers/${id}/process/${processID}/stdout/stream`, {
|
|
117
|
+
...options,
|
|
118
|
+
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
119
|
+
stream: true,
|
|
120
|
+
}) as APIPromise<Stream<ProcessStdoutStreamResponse>>;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Result of a synchronous command execution.
|
|
126
|
+
*/
|
|
127
|
+
export interface ProcessExecResponse {
|
|
128
|
+
/**
|
|
129
|
+
* Execution duration in milliseconds.
|
|
130
|
+
*/
|
|
131
|
+
duration_ms?: number;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Process exit code.
|
|
135
|
+
*/
|
|
136
|
+
exit_code?: number;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Base64-encoded stderr buffer.
|
|
140
|
+
*/
|
|
141
|
+
stderr_b64?: string;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Base64-encoded stdout buffer.
|
|
145
|
+
*/
|
|
146
|
+
stdout_b64?: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Generic OK response.
|
|
151
|
+
*/
|
|
152
|
+
export interface ProcessKillResponse {
|
|
153
|
+
/**
|
|
154
|
+
* Indicates success.
|
|
155
|
+
*/
|
|
156
|
+
ok: boolean;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Information about a spawned process.
|
|
161
|
+
*/
|
|
162
|
+
export interface ProcessSpawnResponse {
|
|
163
|
+
/**
|
|
164
|
+
* OS process ID.
|
|
165
|
+
*/
|
|
166
|
+
pid?: number;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Server-assigned identifier for the process.
|
|
170
|
+
*/
|
|
171
|
+
process_id?: string;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Timestamp when the process started.
|
|
175
|
+
*/
|
|
176
|
+
started_at?: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Current status of a process.
|
|
181
|
+
*/
|
|
182
|
+
export interface ProcessStatusResponse {
|
|
183
|
+
/**
|
|
184
|
+
* Estimated CPU usage percentage.
|
|
185
|
+
*/
|
|
186
|
+
cpu_pct?: number;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Exit code if the process has exited.
|
|
190
|
+
*/
|
|
191
|
+
exit_code?: number | null;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Estimated resident memory usage in bytes.
|
|
195
|
+
*/
|
|
196
|
+
mem_bytes?: number;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Process state.
|
|
200
|
+
*/
|
|
201
|
+
state?: 'running' | 'exited';
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Result of writing to stdin.
|
|
206
|
+
*/
|
|
207
|
+
export interface ProcessStdinResponse {
|
|
208
|
+
/**
|
|
209
|
+
* Number of bytes written.
|
|
210
|
+
*/
|
|
211
|
+
written_bytes?: number;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* SSE payload representing process output or lifecycle events.
|
|
216
|
+
*/
|
|
217
|
+
export interface ProcessStdoutStreamResponse {
|
|
218
|
+
/**
|
|
219
|
+
* Base64-encoded data from the process stream.
|
|
220
|
+
*/
|
|
221
|
+
data_b64?: string;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Lifecycle event type.
|
|
225
|
+
*/
|
|
226
|
+
event?: 'exit';
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Exit code when the event is "exit".
|
|
230
|
+
*/
|
|
231
|
+
exit_code?: number;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Source stream of the data chunk.
|
|
235
|
+
*/
|
|
236
|
+
stream?: 'stdout' | 'stderr';
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export interface ProcessExecParams {
|
|
240
|
+
/**
|
|
241
|
+
* Executable or shell command to run.
|
|
242
|
+
*/
|
|
243
|
+
command: string;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Command arguments.
|
|
247
|
+
*/
|
|
248
|
+
args?: Array<string>;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Run the process with root privileges.
|
|
252
|
+
*/
|
|
253
|
+
as_root?: boolean;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Run the process as this user.
|
|
257
|
+
*/
|
|
258
|
+
as_user?: string | null;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Working directory (absolute path) to run the command in.
|
|
262
|
+
*/
|
|
263
|
+
cwd?: string | null;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Environment variables to set for the process.
|
|
267
|
+
*/
|
|
268
|
+
env?: { [key: string]: string };
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Maximum execution time in seconds.
|
|
272
|
+
*/
|
|
273
|
+
timeout_sec?: number | null;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export interface ProcessKillParams {
|
|
277
|
+
/**
|
|
278
|
+
* Path param: Browser session ID
|
|
279
|
+
*/
|
|
280
|
+
id: string;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Body param: Signal to send.
|
|
284
|
+
*/
|
|
285
|
+
signal: 'TERM' | 'KILL' | 'INT' | 'HUP';
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface ProcessSpawnParams {
|
|
289
|
+
/**
|
|
290
|
+
* Executable or shell command to run.
|
|
291
|
+
*/
|
|
292
|
+
command: string;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Command arguments.
|
|
296
|
+
*/
|
|
297
|
+
args?: Array<string>;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Run the process with root privileges.
|
|
301
|
+
*/
|
|
302
|
+
as_root?: boolean;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Run the process as this user.
|
|
306
|
+
*/
|
|
307
|
+
as_user?: string | null;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Working directory (absolute path) to run the command in.
|
|
311
|
+
*/
|
|
312
|
+
cwd?: string | null;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Environment variables to set for the process.
|
|
316
|
+
*/
|
|
317
|
+
env?: { [key: string]: string };
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Maximum execution time in seconds.
|
|
321
|
+
*/
|
|
322
|
+
timeout_sec?: number | null;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export interface ProcessStatusParams {
|
|
326
|
+
/**
|
|
327
|
+
* Browser session ID
|
|
328
|
+
*/
|
|
329
|
+
id: string;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export interface ProcessStdinParams {
|
|
333
|
+
/**
|
|
334
|
+
* Path param: Browser session ID
|
|
335
|
+
*/
|
|
336
|
+
id: string;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Body param: Base64-encoded data to write.
|
|
340
|
+
*/
|
|
341
|
+
data_b64: string;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export interface ProcessStdoutStreamParams {
|
|
345
|
+
/**
|
|
346
|
+
* Browser session ID
|
|
347
|
+
*/
|
|
348
|
+
id: string;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export declare namespace Process {
|
|
352
|
+
export {
|
|
353
|
+
type ProcessExecResponse as ProcessExecResponse,
|
|
354
|
+
type ProcessKillResponse as ProcessKillResponse,
|
|
355
|
+
type ProcessSpawnResponse as ProcessSpawnResponse,
|
|
356
|
+
type ProcessStatusResponse as ProcessStatusResponse,
|
|
357
|
+
type ProcessStdinResponse as ProcessStdinResponse,
|
|
358
|
+
type ProcessStdoutStreamResponse as ProcessStdoutStreamResponse,
|
|
359
|
+
type ProcessExecParams as ProcessExecParams,
|
|
360
|
+
type ProcessKillParams as ProcessKillParams,
|
|
361
|
+
type ProcessSpawnParams as ProcessSpawnParams,
|
|
362
|
+
type ProcessStatusParams as ProcessStatusParams,
|
|
363
|
+
type ProcessStdinParams as ProcessStdinParams,
|
|
364
|
+
type ProcessStdoutStreamParams as ProcessStdoutStreamParams,
|
|
365
|
+
};
|
|
366
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.10.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.10.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.mts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.mts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.10.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
package/version.js
CHANGED
package/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC,CAAC,2BAA2B"}
|
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.10.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
package/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,2BAA2B"}
|