@onkernel/sdk 0.14.1 → 0.15.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 +17 -0
- package/README.md +5 -17
- package/internal/uploads.js +20 -1
- package/internal/uploads.js.map +1 -1
- package/internal/uploads.mjs +20 -1
- package/internal/uploads.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/browsers/browsers.d.mts +21 -0
- package/resources/browsers/browsers.d.mts.map +1 -1
- package/resources/browsers/browsers.d.ts +21 -0
- package/resources/browsers/browsers.d.ts.map +1 -1
- package/resources/browsers/browsers.js +4 -0
- package/resources/browsers/browsers.js.map +1 -1
- package/resources/browsers/browsers.mjs +4 -0
- package/resources/browsers/browsers.mjs.map +1 -1
- package/resources/browsers/computer.d.mts +232 -0
- package/resources/browsers/computer.d.mts.map +1 -0
- package/resources/browsers/computer.d.ts +232 -0
- package/resources/browsers/computer.d.ts.map +1 -0
- package/resources/browsers/computer.js +136 -0
- package/resources/browsers/computer.js.map +1 -0
- package/resources/browsers/computer.mjs +132 -0
- package/resources/browsers/computer.mjs.map +1 -0
- package/resources/browsers/index.d.mts +1 -0
- package/resources/browsers/index.d.mts.map +1 -1
- package/resources/browsers/index.d.ts +1 -0
- package/resources/browsers/index.d.ts.map +1 -1
- package/resources/browsers/index.js +3 -1
- package/resources/browsers/index.js.map +1 -1
- package/resources/browsers/index.mjs +1 -0
- package/resources/browsers/index.mjs.map +1 -1
- package/resources/deployments.d.mts +58 -5
- package/resources/deployments.d.mts.map +1 -1
- package/resources/deployments.d.ts +58 -5
- package/resources/deployments.d.ts.map +1 -1
- package/resources/deployments.js +3 -0
- package/resources/deployments.js.map +1 -1
- package/resources/deployments.mjs +3 -0
- package/resources/deployments.mjs.map +1 -1
- package/src/internal/uploads.ts +21 -3
- package/src/resources/browsers/browsers.ts +45 -0
- package/src/resources/browsers/computer.ts +328 -0
- package/src/resources/browsers/index.ts +10 -0
- package/src/resources/deployments.ts +68 -6
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,328 @@
|
|
|
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 { buildHeaders } from '../../internal/headers';
|
|
6
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
7
|
+
import { path } from '../../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
export class Computer extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Capture a screenshot of the browser instance
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const response =
|
|
16
|
+
* await client.browsers.computer.captureScreenshot('id');
|
|
17
|
+
*
|
|
18
|
+
* const content = await response.blob();
|
|
19
|
+
* console.log(content);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
captureScreenshot(
|
|
23
|
+
id: string,
|
|
24
|
+
body: ComputerCaptureScreenshotParams | null | undefined = {},
|
|
25
|
+
options?: RequestOptions,
|
|
26
|
+
): APIPromise<Response> {
|
|
27
|
+
return this._client.post(path`/browsers/${id}/computer/screenshot`, {
|
|
28
|
+
body,
|
|
29
|
+
...options,
|
|
30
|
+
headers: buildHeaders([{ Accept: 'image/png' }, options?.headers]),
|
|
31
|
+
__binaryResponse: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Simulate a mouse click action on the browser instance
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* await client.browsers.computer.clickMouse('id', {
|
|
41
|
+
* x: 0,
|
|
42
|
+
* y: 0,
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
clickMouse(id: string, body: ComputerClickMouseParams, options?: RequestOptions): APIPromise<void> {
|
|
47
|
+
return this._client.post(path`/browsers/${id}/computer/click_mouse`, {
|
|
48
|
+
body,
|
|
49
|
+
...options,
|
|
50
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Drag the mouse along a path
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* await client.browsers.computer.dragMouse('id', {
|
|
60
|
+
* path: [
|
|
61
|
+
* [0, 0],
|
|
62
|
+
* [0, 0],
|
|
63
|
+
* ],
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
dragMouse(id: string, body: ComputerDragMouseParams, options?: RequestOptions): APIPromise<void> {
|
|
68
|
+
return this._client.post(path`/browsers/${id}/computer/drag_mouse`, {
|
|
69
|
+
body,
|
|
70
|
+
...options,
|
|
71
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Move the mouse cursor to the specified coordinates on the browser instance
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* await client.browsers.computer.moveMouse('id', {
|
|
81
|
+
* x: 0,
|
|
82
|
+
* y: 0,
|
|
83
|
+
* });
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
moveMouse(id: string, body: ComputerMoveMouseParams, options?: RequestOptions): APIPromise<void> {
|
|
87
|
+
return this._client.post(path`/browsers/${id}/computer/move_mouse`, {
|
|
88
|
+
body,
|
|
89
|
+
...options,
|
|
90
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Press one or more keys on the host computer
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* await client.browsers.computer.pressKey('id', {
|
|
100
|
+
* keys: ['string'],
|
|
101
|
+
* });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
pressKey(id: string, body: ComputerPressKeyParams, options?: RequestOptions): APIPromise<void> {
|
|
105
|
+
return this._client.post(path`/browsers/${id}/computer/press_key`, {
|
|
106
|
+
body,
|
|
107
|
+
...options,
|
|
108
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Scroll the mouse wheel at a position on the host computer
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* await client.browsers.computer.scroll('id', { x: 0, y: 0 });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
scroll(id: string, body: ComputerScrollParams, options?: RequestOptions): APIPromise<void> {
|
|
121
|
+
return this._client.post(path`/browsers/${id}/computer/scroll`, {
|
|
122
|
+
body,
|
|
123
|
+
...options,
|
|
124
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Type text on the browser instance
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* await client.browsers.computer.typeText('id', {
|
|
134
|
+
* text: 'text',
|
|
135
|
+
* });
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
typeText(id: string, body: ComputerTypeTextParams, options?: RequestOptions): APIPromise<void> {
|
|
139
|
+
return this._client.post(path`/browsers/${id}/computer/type`, {
|
|
140
|
+
body,
|
|
141
|
+
...options,
|
|
142
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface ComputerCaptureScreenshotParams {
|
|
148
|
+
region?: ComputerCaptureScreenshotParams.Region;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export namespace ComputerCaptureScreenshotParams {
|
|
152
|
+
export interface Region {
|
|
153
|
+
/**
|
|
154
|
+
* Height of the region in pixels
|
|
155
|
+
*/
|
|
156
|
+
height: number;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Width of the region in pixels
|
|
160
|
+
*/
|
|
161
|
+
width: number;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* X coordinate of the region's top-left corner
|
|
165
|
+
*/
|
|
166
|
+
x: number;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Y coordinate of the region's top-left corner
|
|
170
|
+
*/
|
|
171
|
+
y: number;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface ComputerClickMouseParams {
|
|
176
|
+
/**
|
|
177
|
+
* X coordinate of the click position
|
|
178
|
+
*/
|
|
179
|
+
x: number;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Y coordinate of the click position
|
|
183
|
+
*/
|
|
184
|
+
y: number;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Mouse button to interact with
|
|
188
|
+
*/
|
|
189
|
+
button?: 'left' | 'right' | 'middle' | 'back' | 'forward';
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Type of click action
|
|
193
|
+
*/
|
|
194
|
+
click_type?: 'down' | 'up' | 'click';
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Modifier keys to hold during the click
|
|
198
|
+
*/
|
|
199
|
+
hold_keys?: Array<string>;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Number of times to repeat the click
|
|
203
|
+
*/
|
|
204
|
+
num_clicks?: number;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface ComputerDragMouseParams {
|
|
208
|
+
/**
|
|
209
|
+
* Ordered list of [x, y] coordinate pairs to move through while dragging. Must
|
|
210
|
+
* contain at least 2 points.
|
|
211
|
+
*/
|
|
212
|
+
path: Array<Array<number>>;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Mouse button to drag with
|
|
216
|
+
*/
|
|
217
|
+
button?: 'left' | 'middle' | 'right';
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Delay in milliseconds between button down and starting to move along the path.
|
|
221
|
+
*/
|
|
222
|
+
delay?: number;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Modifier keys to hold during the drag
|
|
226
|
+
*/
|
|
227
|
+
hold_keys?: Array<string>;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Delay in milliseconds between relative steps while dragging (not the initial
|
|
231
|
+
* delay).
|
|
232
|
+
*/
|
|
233
|
+
step_delay_ms?: number;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Number of relative move steps per segment in the path. Minimum 1.
|
|
237
|
+
*/
|
|
238
|
+
steps_per_segment?: number;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface ComputerMoveMouseParams {
|
|
242
|
+
/**
|
|
243
|
+
* X coordinate to move the cursor to
|
|
244
|
+
*/
|
|
245
|
+
x: number;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Y coordinate to move the cursor to
|
|
249
|
+
*/
|
|
250
|
+
y: number;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Modifier keys to hold during the move
|
|
254
|
+
*/
|
|
255
|
+
hold_keys?: Array<string>;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface ComputerPressKeyParams {
|
|
259
|
+
/**
|
|
260
|
+
* List of key symbols to press. Each item should be a key symbol supported by
|
|
261
|
+
* xdotool (see X11 keysym definitions). Examples include "Return", "Shift",
|
|
262
|
+
* "Ctrl", "Alt", "F5". Items in this list could also be combinations, e.g.
|
|
263
|
+
* "Ctrl+t" or "Ctrl+Shift+Tab".
|
|
264
|
+
*/
|
|
265
|
+
keys: Array<string>;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Duration to hold the keys down in milliseconds. If omitted or 0, keys are
|
|
269
|
+
* tapped.
|
|
270
|
+
*/
|
|
271
|
+
duration?: number;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Optional modifier keys to hold during the key press sequence.
|
|
275
|
+
*/
|
|
276
|
+
hold_keys?: Array<string>;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export interface ComputerScrollParams {
|
|
280
|
+
/**
|
|
281
|
+
* X coordinate at which to perform the scroll
|
|
282
|
+
*/
|
|
283
|
+
x: number;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Y coordinate at which to perform the scroll
|
|
287
|
+
*/
|
|
288
|
+
y: number;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Horizontal scroll amount. Positive scrolls right, negative scrolls left.
|
|
292
|
+
*/
|
|
293
|
+
delta_x?: number;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Vertical scroll amount. Positive scrolls down, negative scrolls up.
|
|
297
|
+
*/
|
|
298
|
+
delta_y?: number;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Modifier keys to hold during the scroll
|
|
302
|
+
*/
|
|
303
|
+
hold_keys?: Array<string>;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export interface ComputerTypeTextParams {
|
|
307
|
+
/**
|
|
308
|
+
* Text to type on the browser instance
|
|
309
|
+
*/
|
|
310
|
+
text: string;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Delay in milliseconds between keystrokes
|
|
314
|
+
*/
|
|
315
|
+
delay?: number;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export declare namespace Computer {
|
|
319
|
+
export {
|
|
320
|
+
type ComputerCaptureScreenshotParams as ComputerCaptureScreenshotParams,
|
|
321
|
+
type ComputerClickMouseParams as ComputerClickMouseParams,
|
|
322
|
+
type ComputerDragMouseParams as ComputerDragMouseParams,
|
|
323
|
+
type ComputerMoveMouseParams as ComputerMoveMouseParams,
|
|
324
|
+
type ComputerPressKeyParams as ComputerPressKeyParams,
|
|
325
|
+
type ComputerScrollParams as ComputerScrollParams,
|
|
326
|
+
type ComputerTypeTextParams as ComputerTypeTextParams,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
@@ -11,6 +11,16 @@ export {
|
|
|
11
11
|
type BrowserDeleteParams,
|
|
12
12
|
type BrowserLoadExtensionsParams,
|
|
13
13
|
} from './browsers';
|
|
14
|
+
export {
|
|
15
|
+
Computer,
|
|
16
|
+
type ComputerCaptureScreenshotParams,
|
|
17
|
+
type ComputerClickMouseParams,
|
|
18
|
+
type ComputerDragMouseParams,
|
|
19
|
+
type ComputerMoveMouseParams,
|
|
20
|
+
type ComputerPressKeyParams,
|
|
21
|
+
type ComputerScrollParams,
|
|
22
|
+
type ComputerTypeTextParams,
|
|
23
|
+
} from './computer';
|
|
14
24
|
export {
|
|
15
25
|
Fs,
|
|
16
26
|
type FFileInfoResponse,
|
|
@@ -19,7 +19,10 @@ export class Deployments extends APIResource {
|
|
|
19
19
|
* ```ts
|
|
20
20
|
* const deployment = await client.deployments.create({
|
|
21
21
|
* entrypoint_rel_path: 'src/app.py',
|
|
22
|
+
* env_vars: { FOO: 'bar' },
|
|
22
23
|
* file: fs.createReadStream('path/to/file'),
|
|
24
|
+
* region: 'aws.us-east-1a',
|
|
25
|
+
* version: '1.0.0',
|
|
23
26
|
* });
|
|
24
27
|
* ```
|
|
25
28
|
*/
|
|
@@ -349,12 +352,7 @@ export interface DeploymentCreateParams {
|
|
|
349
352
|
/**
|
|
350
353
|
* Relative path to the entrypoint of the application
|
|
351
354
|
*/
|
|
352
|
-
entrypoint_rel_path
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* ZIP file containing the application source directory
|
|
356
|
-
*/
|
|
357
|
-
file: Uploadable;
|
|
355
|
+
entrypoint_rel_path?: string;
|
|
358
356
|
|
|
359
357
|
/**
|
|
360
358
|
* Map of environment variables to set for the deployed application. Each key-value
|
|
@@ -362,6 +360,11 @@ export interface DeploymentCreateParams {
|
|
|
362
360
|
*/
|
|
363
361
|
env_vars?: { [key: string]: string };
|
|
364
362
|
|
|
363
|
+
/**
|
|
364
|
+
* ZIP file containing the application source directory
|
|
365
|
+
*/
|
|
366
|
+
file?: Uploadable;
|
|
367
|
+
|
|
365
368
|
/**
|
|
366
369
|
* Allow overwriting an existing app version
|
|
367
370
|
*/
|
|
@@ -372,12 +375,71 @@ export interface DeploymentCreateParams {
|
|
|
372
375
|
*/
|
|
373
376
|
region?: 'aws.us-east-1a';
|
|
374
377
|
|
|
378
|
+
/**
|
|
379
|
+
* Source from which to fetch application code.
|
|
380
|
+
*/
|
|
381
|
+
source?: DeploymentCreateParams.Source;
|
|
382
|
+
|
|
375
383
|
/**
|
|
376
384
|
* Version of the application. Can be any string.
|
|
377
385
|
*/
|
|
378
386
|
version?: string;
|
|
379
387
|
}
|
|
380
388
|
|
|
389
|
+
export namespace DeploymentCreateParams {
|
|
390
|
+
/**
|
|
391
|
+
* Source from which to fetch application code.
|
|
392
|
+
*/
|
|
393
|
+
export interface Source {
|
|
394
|
+
/**
|
|
395
|
+
* Relative path to the application entrypoint within the selected path.
|
|
396
|
+
*/
|
|
397
|
+
entrypoint: string;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Git ref (branch, tag, or commit SHA) to fetch.
|
|
401
|
+
*/
|
|
402
|
+
ref: string;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Source type identifier.
|
|
406
|
+
*/
|
|
407
|
+
type: 'github';
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Base repository URL (without blob/tree suffixes).
|
|
411
|
+
*/
|
|
412
|
+
url: string;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Authentication for private repositories.
|
|
416
|
+
*/
|
|
417
|
+
auth?: Source.Auth;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Path within the repo to deploy (omit to use repo root).
|
|
421
|
+
*/
|
|
422
|
+
path?: string;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export namespace Source {
|
|
426
|
+
/**
|
|
427
|
+
* Authentication for private repositories.
|
|
428
|
+
*/
|
|
429
|
+
export interface Auth {
|
|
430
|
+
/**
|
|
431
|
+
* GitHub PAT or installation access token
|
|
432
|
+
*/
|
|
433
|
+
token: string;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Auth method
|
|
437
|
+
*/
|
|
438
|
+
method: 'github_token';
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
381
443
|
export interface DeploymentListParams extends OffsetPaginationParams {
|
|
382
444
|
/**
|
|
383
445
|
* Filter results by application name.
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.15.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.15.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.15.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.15.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|