@daytonaio/sdk 0.175.0 → 0.178.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 (91) hide show
  1. package/cjs/CodeInterpreter.d.ts +3 -2
  2. package/cjs/CodeInterpreter.js.map +1 -1
  3. package/cjs/ComputerUse.d.ts +104 -2
  4. package/cjs/ComputerUse.js +851 -763
  5. package/cjs/ComputerUse.js.map +1 -1
  6. package/cjs/Daytona.d.ts +4 -3
  7. package/cjs/Daytona.js +429 -443
  8. package/cjs/Daytona.js.map +1 -1
  9. package/cjs/FileSystem.d.ts +2 -2
  10. package/cjs/FileSystem.js +491 -521
  11. package/cjs/FileSystem.js.map +1 -1
  12. package/cjs/Git.d.ts +2 -1
  13. package/cjs/Git.js +287 -310
  14. package/cjs/Git.js.map +1 -1
  15. package/cjs/LspServer.d.ts +2 -1
  16. package/cjs/LspServer.js +209 -226
  17. package/cjs/LspServer.js.map +1 -1
  18. package/cjs/ObjectStorage.js +170 -166
  19. package/cjs/ObjectStorage.js.map +1 -1
  20. package/cjs/Process.d.ts +4 -3
  21. package/cjs/Process.js +562 -600
  22. package/cjs/Process.js.map +1 -1
  23. package/cjs/PtyHandle.d.ts +2 -2
  24. package/cjs/PtyHandle.js +327 -338
  25. package/cjs/PtyHandle.js.map +1 -1
  26. package/cjs/Sandbox.d.ts +4 -3
  27. package/cjs/Sandbox.js +756 -821
  28. package/cjs/Sandbox.js.map +1 -1
  29. package/cjs/Snapshot.d.ts +3 -2
  30. package/cjs/Snapshot.js +203 -213
  31. package/cjs/Snapshot.js.map +1 -1
  32. package/cjs/Volume.d.ts +2 -1
  33. package/cjs/Volume.js +90 -92
  34. package/cjs/Volume.js.map +1 -1
  35. package/cjs/errors/DaytonaError.d.ts +2 -1
  36. package/cjs/errors/DaytonaError.js.map +1 -1
  37. package/cjs/index.d.ts +2 -2
  38. package/cjs/index.js +2 -1
  39. package/cjs/index.js.map +1 -1
  40. package/cjs/types/CodeInterpreter.d.ts +1 -1
  41. package/cjs/utils/Binary.js +14 -2
  42. package/cjs/utils/Binary.js.map +1 -1
  43. package/cjs/utils/otel.decorator.d.ts +7 -8
  44. package/cjs/utils/otel.decorator.js +24 -30
  45. package/cjs/utils/otel.decorator.js.map +1 -1
  46. package/esm/CodeInterpreter.d.ts +3 -2
  47. package/esm/CodeInterpreter.js.map +1 -1
  48. package/esm/ComputerUse.d.ts +104 -2
  49. package/esm/ComputerUse.js +857 -763
  50. package/esm/ComputerUse.js.map +1 -1
  51. package/esm/Daytona.d.ts +4 -3
  52. package/esm/Daytona.js +431 -444
  53. package/esm/Daytona.js.map +1 -1
  54. package/esm/FileSystem.d.ts +2 -2
  55. package/esm/FileSystem.js +493 -522
  56. package/esm/FileSystem.js.map +1 -1
  57. package/esm/Git.d.ts +2 -1
  58. package/esm/Git.js +289 -311
  59. package/esm/Git.js.map +1 -1
  60. package/esm/LspServer.d.ts +2 -1
  61. package/esm/LspServer.js +211 -227
  62. package/esm/LspServer.js.map +1 -1
  63. package/esm/ObjectStorage.js +172 -167
  64. package/esm/ObjectStorage.js.map +1 -1
  65. package/esm/Process.d.ts +4 -3
  66. package/esm/Process.js +564 -601
  67. package/esm/Process.js.map +1 -1
  68. package/esm/PtyHandle.d.ts +2 -2
  69. package/esm/PtyHandle.js +329 -339
  70. package/esm/PtyHandle.js.map +1 -1
  71. package/esm/Sandbox.d.ts +4 -3
  72. package/esm/Sandbox.js +759 -823
  73. package/esm/Sandbox.js.map +1 -1
  74. package/esm/Snapshot.d.ts +3 -2
  75. package/esm/Snapshot.js +206 -215
  76. package/esm/Snapshot.js.map +1 -1
  77. package/esm/Volume.d.ts +2 -1
  78. package/esm/Volume.js +92 -93
  79. package/esm/Volume.js.map +1 -1
  80. package/esm/errors/DaytonaError.d.ts +2 -1
  81. package/esm/errors/DaytonaError.js.map +1 -1
  82. package/esm/index.d.ts +2 -2
  83. package/esm/index.js +1 -1
  84. package/esm/index.js.map +1 -1
  85. package/esm/types/CodeInterpreter.d.ts +1 -1
  86. package/esm/utils/Binary.js +14 -2
  87. package/esm/utils/Binary.js.map +1 -1
  88. package/esm/utils/otel.decorator.d.ts +7 -8
  89. package/esm/utils/otel.decorator.js +26 -32
  90. package/esm/utils/otel.decorator.js.map +1 -1
  91. package/package.json +3 -3
@@ -2,623 +2,727 @@
2
2
  * Copyright Daytona Platforms Inc.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- import { __decorate, __metadata } from "tslib";
5
+ import { __esDecorate, __runInitializers } from "tslib";
6
6
  import * as pathe from 'pathe';
7
7
  import { dynamicImport } from './utils/Import.js';
8
8
  import { WithInstrumentation } from './utils/otel.decorator.js';
9
9
  /**
10
10
  * Mouse operations for computer use functionality
11
11
  */
12
- export class Mouse {
13
- apiClient;
14
- constructor(apiClient) {
15
- this.apiClient = apiClient;
16
- }
17
- /**
18
- * Gets the current mouse cursor position
19
- *
20
- * @returns {Promise<MousePositionResponse>} Current mouse position with x and y coordinates
21
- *
22
- * @example
23
- * ```typescript
24
- * const position = await sandbox.computerUse.mouse.getPosition();
25
- * console.log(`Mouse is at: ${position.x}, ${position.y}`);
26
- * ```
27
- */
28
- async getPosition() {
29
- const response = await this.apiClient.getMousePosition();
30
- return response.data;
31
- }
32
- /**
33
- * Moves the mouse cursor to the specified coordinates
34
- *
35
- * @param {number} x - The x coordinate to move to
36
- * @param {number} y - The y coordinate to move to
37
- * @returns {Promise<MousePositionResponse>} Position after move
38
- *
39
- * @example
40
- * ```typescript
41
- * const result = await sandbox.computerUse.mouse.move(100, 200);
42
- * console.log(`Mouse moved to: ${result.x}, ${result.y}`);
43
- * ```
44
- */
45
- async move(x, y) {
46
- const request = { x, y };
47
- const response = await this.apiClient.moveMouse(request);
48
- return response.data;
49
- }
50
- /**
51
- * Clicks the mouse at the specified coordinates
52
- *
53
- * @param {number} x - The x coordinate to click at
54
- * @param {number} y - The y coordinate to click at
55
- * @param {string} [button='left'] - The mouse button to click ('left', 'right', 'middle')
56
- * @param {boolean} [double=false] - Whether to perform a double-click
57
- * @returns {Promise<MouseClickResponse>} Click operation result
58
- *
59
- * @example
60
- * ```typescript
61
- * // Single left click
62
- * const result = await sandbox.computerUse.mouse.click(100, 200);
63
- *
64
- * // Double click
65
- * const doubleClick = await sandbox.computerUse.mouse.click(100, 200, 'left', true);
66
- *
67
- * // Right click
68
- * const rightClick = await sandbox.computerUse.mouse.click(100, 200, 'right');
69
- * ```
70
- */
71
- async click(x, y, button = 'left', double = false) {
72
- const request = { x, y, button, double };
73
- const response = await this.apiClient.click(request);
74
- return response.data;
75
- }
76
- /**
77
- * Drags the mouse from start coordinates to end coordinates
78
- *
79
- * @param {number} startX - The starting x coordinate
80
- * @param {number} startY - The starting y coordinate
81
- * @param {number} endX - The ending x coordinate
82
- * @param {number} endY - The ending y coordinate
83
- * @param {string} [button='left'] - The mouse button to use for dragging
84
- * @returns {Promise<MouseDragResponse>} Drag operation result
85
- *
86
- * @example
87
- * ```typescript
88
- * const result = await sandbox.computerUse.mouse.drag(50, 50, 150, 150);
89
- * console.log(`Drag ended at: ${result.x}, ${result.y}`);
90
- * ```
91
- */
92
- async drag(startX, startY, endX, endY, button = 'left') {
93
- const request = { startX, startY, endX, endY, button };
94
- const response = await this.apiClient.drag(request);
95
- return response.data;
96
- }
97
- /**
98
- * Scrolls the mouse wheel at the specified coordinates
99
- *
100
- * @param {number} x - The x coordinate to scroll at
101
- * @param {number} y - The y coordinate to scroll at
102
- * @param {'up' | 'down'} direction - The direction to scroll
103
- * @param {number} [amount=1] - The amount to scroll
104
- * @returns {Promise<boolean>} Whether the scroll operation was successful
105
- *
106
- * @example
107
- * ```typescript
108
- * // Scroll up
109
- * const scrollUp = await sandbox.computerUse.mouse.scroll(100, 200, 'up', 3);
110
- *
111
- * // Scroll down
112
- * const scrollDown = await sandbox.computerUse.mouse.scroll(100, 200, 'down', 5);
113
- * ```
114
- */
115
- async scroll(x, y, direction, amount = 1) {
116
- const request = { x, y, direction, amount };
117
- const response = await this.apiClient.scroll(request);
118
- return response.data.success;
119
- }
120
- }
121
- __decorate([
122
- WithInstrumentation(),
123
- __metadata("design:type", Function),
124
- __metadata("design:paramtypes", []),
125
- __metadata("design:returntype", Promise)
126
- ], Mouse.prototype, "getPosition", null);
127
- __decorate([
128
- WithInstrumentation(),
129
- __metadata("design:type", Function),
130
- __metadata("design:paramtypes", [Number, Number]),
131
- __metadata("design:returntype", Promise)
132
- ], Mouse.prototype, "move", null);
133
- __decorate([
134
- WithInstrumentation(),
135
- __metadata("design:type", Function),
136
- __metadata("design:paramtypes", [Number, Number, Object, Object]),
137
- __metadata("design:returntype", Promise)
138
- ], Mouse.prototype, "click", null);
139
- __decorate([
140
- WithInstrumentation(),
141
- __metadata("design:type", Function),
142
- __metadata("design:paramtypes", [Number, Number, Number, Number, Object]),
143
- __metadata("design:returntype", Promise)
144
- ], Mouse.prototype, "drag", null);
145
- __decorate([
146
- WithInstrumentation(),
147
- __metadata("design:type", Function),
148
- __metadata("design:paramtypes", [Number, Number, String, Object]),
149
- __metadata("design:returntype", Promise)
150
- ], Mouse.prototype, "scroll", null);
12
+ let Mouse = (() => {
13
+ let _instanceExtraInitializers = [];
14
+ let _getPosition_decorators;
15
+ let _move_decorators;
16
+ let _click_decorators;
17
+ let _drag_decorators;
18
+ let _scroll_decorators;
19
+ return class Mouse {
20
+ static {
21
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
22
+ _getPosition_decorators = [WithInstrumentation()];
23
+ _move_decorators = [WithInstrumentation()];
24
+ _click_decorators = [WithInstrumentation()];
25
+ _drag_decorators = [WithInstrumentation()];
26
+ _scroll_decorators = [WithInstrumentation()];
27
+ __esDecorate(this, null, _getPosition_decorators, { kind: "method", name: "getPosition", static: false, private: false, access: { has: obj => "getPosition" in obj, get: obj => obj.getPosition }, metadata: _metadata }, null, _instanceExtraInitializers);
28
+ __esDecorate(this, null, _move_decorators, { kind: "method", name: "move", static: false, private: false, access: { has: obj => "move" in obj, get: obj => obj.move }, metadata: _metadata }, null, _instanceExtraInitializers);
29
+ __esDecorate(this, null, _click_decorators, { kind: "method", name: "click", static: false, private: false, access: { has: obj => "click" in obj, get: obj => obj.click }, metadata: _metadata }, null, _instanceExtraInitializers);
30
+ __esDecorate(this, null, _drag_decorators, { kind: "method", name: "drag", static: false, private: false, access: { has: obj => "drag" in obj, get: obj => obj.drag }, metadata: _metadata }, null, _instanceExtraInitializers);
31
+ __esDecorate(this, null, _scroll_decorators, { kind: "method", name: "scroll", static: false, private: false, access: { has: obj => "scroll" in obj, get: obj => obj.scroll }, metadata: _metadata }, null, _instanceExtraInitializers);
32
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
33
+ }
34
+ apiClient = __runInitializers(this, _instanceExtraInitializers);
35
+ constructor(apiClient) {
36
+ this.apiClient = apiClient;
37
+ }
38
+ /**
39
+ * Gets the current mouse cursor position
40
+ *
41
+ * @returns {Promise<MousePositionResponse>} Current mouse position with x and y coordinates
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const position = await sandbox.computerUse.mouse.getPosition();
46
+ * console.log(`Mouse is at: ${position.x}, ${position.y}`);
47
+ * ```
48
+ */
49
+ async getPosition() {
50
+ const response = await this.apiClient.getMousePosition();
51
+ return response.data;
52
+ }
53
+ /**
54
+ * Moves the mouse cursor to the specified coordinates
55
+ *
56
+ * @param {number} x - The x coordinate to move to
57
+ * @param {number} y - The y coordinate to move to
58
+ * @returns {Promise<MousePositionResponse>} Position after move
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const result = await sandbox.computerUse.mouse.move(100, 200);
63
+ * console.log(`Mouse moved to: ${result.x}, ${result.y}`);
64
+ * ```
65
+ */
66
+ async move(x, y) {
67
+ const request = { x, y };
68
+ const response = await this.apiClient.moveMouse(request);
69
+ return response.data;
70
+ }
71
+ /**
72
+ * Clicks the mouse at the specified coordinates
73
+ *
74
+ * @param {number} x - The x coordinate to click at
75
+ * @param {number} y - The y coordinate to click at
76
+ * @param {string} [button='left'] - The mouse button to click ('left', 'right', 'middle')
77
+ * @param {boolean} [double=false] - Whether to perform a double-click
78
+ * @returns {Promise<MouseClickResponse>} Click operation result
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * // Single left click
83
+ * const result = await sandbox.computerUse.mouse.click(100, 200);
84
+ *
85
+ * // Double click
86
+ * const doubleClick = await sandbox.computerUse.mouse.click(100, 200, 'left', true);
87
+ *
88
+ * // Right click
89
+ * const rightClick = await sandbox.computerUse.mouse.click(100, 200, 'right');
90
+ * ```
91
+ */
92
+ async click(x, y, button = 'left', double = false) {
93
+ const request = { x, y, button, double };
94
+ const response = await this.apiClient.click(request);
95
+ return response.data;
96
+ }
97
+ /**
98
+ * Drags the mouse from start coordinates to end coordinates
99
+ *
100
+ * @param {number} startX - The starting x coordinate
101
+ * @param {number} startY - The starting y coordinate
102
+ * @param {number} endX - The ending x coordinate
103
+ * @param {number} endY - The ending y coordinate
104
+ * @param {string} [button='left'] - The mouse button to use for dragging
105
+ * @returns {Promise<MouseDragResponse>} Drag operation result
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * const result = await sandbox.computerUse.mouse.drag(50, 50, 150, 150);
110
+ * console.log(`Drag ended at: ${result.x}, ${result.y}`);
111
+ * ```
112
+ */
113
+ async drag(startX, startY, endX, endY, button = 'left') {
114
+ const request = { startX, startY, endX, endY, button };
115
+ const response = await this.apiClient.drag(request);
116
+ return response.data;
117
+ }
118
+ /**
119
+ * Scrolls the mouse wheel at the specified coordinates
120
+ *
121
+ * @param {number} x - The x coordinate to scroll at
122
+ * @param {number} y - The y coordinate to scroll at
123
+ * @param {'up' | 'down'} direction - The direction to scroll
124
+ * @param {number} [amount=1] - The amount to scroll
125
+ * @returns {Promise<boolean>} Whether the scroll operation was successful
126
+ *
127
+ * @example
128
+ * ```typescript
129
+ * // Scroll up
130
+ * const scrollUp = await sandbox.computerUse.mouse.scroll(100, 200, 'up', 3);
131
+ *
132
+ * // Scroll down
133
+ * const scrollDown = await sandbox.computerUse.mouse.scroll(100, 200, 'down', 5);
134
+ * ```
135
+ */
136
+ async scroll(x, y, direction, amount = 1) {
137
+ const request = { x, y, direction, amount };
138
+ const response = await this.apiClient.scroll(request);
139
+ return response.data.success;
140
+ }
141
+ };
142
+ })();
143
+ export { Mouse };
151
144
  /**
152
145
  * Keyboard operations for computer use functionality
153
146
  */
154
- export class Keyboard {
155
- apiClient;
156
- constructor(apiClient) {
157
- this.apiClient = apiClient;
158
- }
159
- /**
160
- * Types the specified text
161
- *
162
- * @param {string} text - The text to type
163
- * @param {number} [delay=0] - Delay between characters in milliseconds
164
- * @throws {DaytonaError} If the type operation fails
165
- *
166
- * @example
167
- * ```typescript
168
- * try {
169
- * await sandbox.computerUse.keyboard.type('Hello, World!');
170
- * console.log('Operation success');
171
- * } catch (e) {
172
- * console.log('Operation failed:', e);
173
- * }
174
- *
175
- * // With delay between characters
176
- * try {
177
- * await sandbox.computerUse.keyboard.type('Slow typing', 100);
178
- * console.log('Operation success');
179
- * } catch (e) {
180
- * console.log('Operation failed:', e);
181
- * }
182
- * ```
183
- */
184
- async type(text, delay) {
185
- const request = { text, delay };
186
- await this.apiClient.typeText(request);
187
- }
188
- /**
189
- * Presses a key with optional modifiers
190
- *
191
- * @param {string} key - The key to press. Canonical names include 'enter', 'escape', 'tab', letters, digits, unshifted punctuation, function keys, and grammar-safe numpad names such as 'num_plus'. Named keys are case-insensitive, and common aliases such as 'Return' and 'Escape' are normalized.
192
- * @param {string[]} [modifiers=[]] - Canonical modifier names are 'ctrl', 'alt', 'shift', and 'cmd'. Common aliases such as 'control', 'option', 'meta', and 'win' are normalized.
193
- * @throws {DaytonaError} If the press operation fails
194
- *
195
- * @example
196
- * ```typescript
197
- * // Press Enter
198
- * try {
199
- * await sandbox.computerUse.keyboard.press('enter');
200
- * console.log('Operation success');
201
- * } catch (e) {
202
- * console.log('Operation failed:', e);
203
- * }
204
- *
205
- * // Press Ctrl+C
206
- * try {
207
- * await sandbox.computerUse.keyboard.press('c', ['ctrl']);
208
- * console.log('Operation success');
209
- * } catch (e) {
210
- * console.log('Operation failed:', e);
211
- * }
212
- *
213
- * // Press Ctrl+Shift+T
214
- * try {
215
- * await sandbox.computerUse.keyboard.press('t', ['ctrl', 'shift']);
216
- * console.log('Operation success');
217
- * } catch (e) {
218
- * console.log('Operation failed:', e);
219
- * }
220
- * ```
221
- */
222
- async press(key, modifiers = []) {
223
- const request = { key, modifiers };
224
- await this.apiClient.pressKey(request);
225
- }
226
- /**
227
- * Presses a hotkey combination
228
- *
229
- * @param {string} keys - A single atomic hotkey chord (e.g., 'ctrl+c', 'alt+tab', 'cmd+shift+t', 'ctrl + c', 'shift'). Uses the same normalized key contract as `press()`.
230
- * @throws {DaytonaError} If the hotkey operation fails
231
- *
232
- * @example
233
- * ```typescript
234
- * // Copy
235
- * try {
236
- * await sandbox.computerUse.keyboard.hotkey('ctrl+c');
237
- * console.log('Operation success');
238
- * } catch (e) {
239
- * console.log('Operation failed:', e);
240
- * }
241
- *
242
- * // Paste
243
- * try {
244
- * await sandbox.computerUse.keyboard.hotkey('ctrl+v');
245
- * console.log('Operation success');
246
- * } catch (e) {
247
- * console.log('Operation failed:', e);
248
- * }
249
- *
250
- * // Alt+Tab
251
- * try {
252
- * await sandbox.computerUse.keyboard.hotkey('alt+tab');
253
- * console.log('Operation success');
254
- * } catch (e) {
255
- * console.log('Operation failed:', e);
256
- * }
257
- * ```
258
- */
259
- async hotkey(keys) {
260
- const request = { keys };
261
- await this.apiClient.pressHotkey(request);
262
- }
263
- }
264
- __decorate([
265
- WithInstrumentation(),
266
- __metadata("design:type", Function),
267
- __metadata("design:paramtypes", [String, Number]),
268
- __metadata("design:returntype", Promise)
269
- ], Keyboard.prototype, "type", null);
270
- __decorate([
271
- WithInstrumentation(),
272
- __metadata("design:type", Function),
273
- __metadata("design:paramtypes", [String, Array]),
274
- __metadata("design:returntype", Promise)
275
- ], Keyboard.prototype, "press", null);
276
- __decorate([
277
- WithInstrumentation(),
278
- __metadata("design:type", Function),
279
- __metadata("design:paramtypes", [String]),
280
- __metadata("design:returntype", Promise)
281
- ], Keyboard.prototype, "hotkey", null);
147
+ let Keyboard = (() => {
148
+ let _instanceExtraInitializers = [];
149
+ let _type_decorators;
150
+ let _press_decorators;
151
+ let _hotkey_decorators;
152
+ return class Keyboard {
153
+ static {
154
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
155
+ _type_decorators = [WithInstrumentation()];
156
+ _press_decorators = [WithInstrumentation()];
157
+ _hotkey_decorators = [WithInstrumentation()];
158
+ __esDecorate(this, null, _type_decorators, { kind: "method", name: "type", static: false, private: false, access: { has: obj => "type" in obj, get: obj => obj.type }, metadata: _metadata }, null, _instanceExtraInitializers);
159
+ __esDecorate(this, null, _press_decorators, { kind: "method", name: "press", static: false, private: false, access: { has: obj => "press" in obj, get: obj => obj.press }, metadata: _metadata }, null, _instanceExtraInitializers);
160
+ __esDecorate(this, null, _hotkey_decorators, { kind: "method", name: "hotkey", static: false, private: false, access: { has: obj => "hotkey" in obj, get: obj => obj.hotkey }, metadata: _metadata }, null, _instanceExtraInitializers);
161
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
162
+ }
163
+ apiClient = __runInitializers(this, _instanceExtraInitializers);
164
+ constructor(apiClient) {
165
+ this.apiClient = apiClient;
166
+ }
167
+ /**
168
+ * Types the specified text
169
+ *
170
+ * @param {string} text - The text to type
171
+ * @param {number} [delay=0] - Delay between characters in milliseconds
172
+ * @throws {DaytonaError} If the type operation fails
173
+ *
174
+ * @example
175
+ * ```typescript
176
+ * try {
177
+ * await sandbox.computerUse.keyboard.type('Hello, World!');
178
+ * console.log('Operation success');
179
+ * } catch (e) {
180
+ * console.log('Operation failed:', e);
181
+ * }
182
+ *
183
+ * // With delay between characters
184
+ * try {
185
+ * await sandbox.computerUse.keyboard.type('Slow typing', 100);
186
+ * console.log('Operation success');
187
+ * } catch (e) {
188
+ * console.log('Operation failed:', e);
189
+ * }
190
+ * ```
191
+ */
192
+ async type(text, delay) {
193
+ const request = { text, delay };
194
+ await this.apiClient.typeText(request);
195
+ }
196
+ /**
197
+ * Presses a key with optional modifiers
198
+ *
199
+ * @param {string} key - The key to press. Canonical names include 'enter', 'escape', 'tab', letters, digits, unshifted punctuation, function keys, and grammar-safe numpad names such as 'num_plus'. Named keys are case-insensitive, and common aliases such as 'Return' and 'Escape' are normalized.
200
+ * @param {string[]} [modifiers=[]] - Canonical modifier names are 'ctrl', 'alt', 'shift', and 'cmd'. Common aliases such as 'control', 'option', 'meta', and 'win' are normalized.
201
+ * @throws {DaytonaError} If the press operation fails
202
+ *
203
+ * @example
204
+ * ```typescript
205
+ * // Press Enter
206
+ * try {
207
+ * await sandbox.computerUse.keyboard.press('enter');
208
+ * console.log('Operation success');
209
+ * } catch (e) {
210
+ * console.log('Operation failed:', e);
211
+ * }
212
+ *
213
+ * // Press Ctrl+C
214
+ * try {
215
+ * await sandbox.computerUse.keyboard.press('c', ['ctrl']);
216
+ * console.log('Operation success');
217
+ * } catch (e) {
218
+ * console.log('Operation failed:', e);
219
+ * }
220
+ *
221
+ * // Press Ctrl+Shift+T
222
+ * try {
223
+ * await sandbox.computerUse.keyboard.press('t', ['ctrl', 'shift']);
224
+ * console.log('Operation success');
225
+ * } catch (e) {
226
+ * console.log('Operation failed:', e);
227
+ * }
228
+ * ```
229
+ */
230
+ async press(key, modifiers = []) {
231
+ const request = { key, modifiers };
232
+ await this.apiClient.pressKey(request);
233
+ }
234
+ /**
235
+ * Presses a hotkey combination
236
+ *
237
+ * @param {string} keys - A single atomic hotkey chord (e.g., 'ctrl+c', 'alt+tab', 'cmd+shift+t', 'ctrl + c', 'shift'). Uses the same normalized key contract as `press()`.
238
+ * @throws {DaytonaError} If the hotkey operation fails
239
+ *
240
+ * @example
241
+ * ```typescript
242
+ * // Copy
243
+ * try {
244
+ * await sandbox.computerUse.keyboard.hotkey('ctrl+c');
245
+ * console.log('Operation success');
246
+ * } catch (e) {
247
+ * console.log('Operation failed:', e);
248
+ * }
249
+ *
250
+ * // Paste
251
+ * try {
252
+ * await sandbox.computerUse.keyboard.hotkey('ctrl+v');
253
+ * console.log('Operation success');
254
+ * } catch (e) {
255
+ * console.log('Operation failed:', e);
256
+ * }
257
+ *
258
+ * // Alt+Tab
259
+ * try {
260
+ * await sandbox.computerUse.keyboard.hotkey('alt+tab');
261
+ * console.log('Operation success');
262
+ * } catch (e) {
263
+ * console.log('Operation failed:', e);
264
+ * }
265
+ * ```
266
+ */
267
+ async hotkey(keys) {
268
+ const request = { keys };
269
+ await this.apiClient.pressHotkey(request);
270
+ }
271
+ };
272
+ })();
273
+ export { Keyboard };
282
274
  /**
283
275
  * Screenshot operations for computer use functionality
284
276
  */
285
- export class Screenshot {
286
- apiClient;
287
- constructor(apiClient) {
288
- this.apiClient = apiClient;
289
- }
290
- /**
291
- * Takes a screenshot of the entire screen
292
- *
293
- * @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
294
- * @returns {Promise<ScreenshotResponse>} Screenshot data with base64 encoded image
295
- *
296
- * @example
297
- * ```typescript
298
- * const screenshot = await sandbox.computerUse.screenshot.takeFullScreen();
299
- * console.log(`Screenshot size: ${screenshot.width}x${screenshot.height}`);
300
- *
301
- * // With cursor visible
302
- * const withCursor = await sandbox.computerUse.screenshot.takeFullScreen(true);
303
- * ```
304
- */
305
- async takeFullScreen(showCursor = false) {
306
- const response = await this.apiClient.takeScreenshot(showCursor);
307
- return response.data;
308
- }
309
- /**
310
- * Takes a screenshot of a specific region
311
- *
312
- * @param {ScreenshotRegion} region - The region to capture
313
- * @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
314
- * @returns {Promise<RegionScreenshotResponse>} Screenshot data with base64 encoded image
315
- *
316
- * @example
317
- * ```typescript
318
- * const region = { x: 100, y: 100, width: 300, height: 200 };
319
- * const screenshot = await sandbox.computerUse.screenshot.takeRegion(region);
320
- * console.log(`Captured region: ${screenshot.region.width}x${screenshot.region.height}`);
321
- * ```
322
- */
323
- async takeRegion(region, showCursor = false) {
324
- const response = await this.apiClient.takeRegionScreenshot(region.height, region.width, region.y, region.x, showCursor);
325
- return response.data;
326
- }
327
- /**
328
- * Takes a compressed screenshot of the entire screen
329
- *
330
- * @param {ScreenshotOptions} [options={}] - Compression and display options
331
- * @returns {Promise<CompressedScreenshotResponse>} Compressed screenshot data
332
- *
333
- * @example
334
- * ```typescript
335
- * // Default compression
336
- * const screenshot = await sandbox.computerUse.screenshot.takeCompressed();
337
- *
338
- * // High quality JPEG
339
- * const jpeg = await sandbox.computerUse.screenshot.takeCompressed({
340
- * format: 'jpeg',
341
- * quality: 95,
342
- * showCursor: true
343
- * });
344
- *
345
- * // Scaled down PNG
346
- * const scaled = await sandbox.computerUse.screenshot.takeCompressed({
347
- * format: 'png',
348
- * scale: 0.5
349
- * });
350
- * ```
351
- */
352
- async takeCompressed(options = {}) {
353
- const response = await this.apiClient.takeCompressedScreenshot(options.showCursor, options.format, options.quality, options.scale);
354
- return response.data;
355
- }
356
- /**
357
- * Takes a compressed screenshot of a specific region
358
- *
359
- * @param {ScreenshotRegion} region - The region to capture
360
- * @param {ScreenshotOptions} [options={}] - Compression and display options
361
- * @returns {Promise<CompressedScreenshotResponse>} Compressed screenshot data
362
- *
363
- * @example
364
- * ```typescript
365
- * const region = { x: 0, y: 0, width: 800, height: 600 };
366
- * const screenshot = await sandbox.computerUse.screenshot.takeCompressedRegion(region, {
367
- * format: 'webp',
368
- * quality: 80,
369
- * showCursor: true
370
- * });
371
- * console.log(`Compressed size: ${screenshot.size_bytes} bytes`);
372
- * ```
373
- */
374
- async takeCompressedRegion(region, options = {}) {
375
- const response = await this.apiClient.takeCompressedRegionScreenshot(region.x, region.y, region.width, region.height, options.showCursor, options.format, options.quality, options.scale);
376
- return response.data;
377
- }
378
- }
379
- __decorate([
380
- WithInstrumentation(),
381
- __metadata("design:type", Function),
382
- __metadata("design:paramtypes", [Object]),
383
- __metadata("design:returntype", Promise)
384
- ], Screenshot.prototype, "takeFullScreen", null);
385
- __decorate([
386
- WithInstrumentation(),
387
- __metadata("design:type", Function),
388
- __metadata("design:paramtypes", [Object, Object]),
389
- __metadata("design:returntype", Promise)
390
- ], Screenshot.prototype, "takeRegion", null);
391
- __decorate([
392
- WithInstrumentation(),
393
- __metadata("design:type", Function),
394
- __metadata("design:paramtypes", [Object]),
395
- __metadata("design:returntype", Promise)
396
- ], Screenshot.prototype, "takeCompressed", null);
397
- __decorate([
398
- WithInstrumentation(),
399
- __metadata("design:type", Function),
400
- __metadata("design:paramtypes", [Object, Object]),
401
- __metadata("design:returntype", Promise)
402
- ], Screenshot.prototype, "takeCompressedRegion", null);
277
+ let Screenshot = (() => {
278
+ let _instanceExtraInitializers = [];
279
+ let _takeFullScreen_decorators;
280
+ let _takeRegion_decorators;
281
+ let _takeCompressed_decorators;
282
+ let _takeCompressedRegion_decorators;
283
+ return class Screenshot {
284
+ static {
285
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
286
+ _takeFullScreen_decorators = [WithInstrumentation()];
287
+ _takeRegion_decorators = [WithInstrumentation()];
288
+ _takeCompressed_decorators = [WithInstrumentation()];
289
+ _takeCompressedRegion_decorators = [WithInstrumentation()];
290
+ __esDecorate(this, null, _takeFullScreen_decorators, { kind: "method", name: "takeFullScreen", static: false, private: false, access: { has: obj => "takeFullScreen" in obj, get: obj => obj.takeFullScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
291
+ __esDecorate(this, null, _takeRegion_decorators, { kind: "method", name: "takeRegion", static: false, private: false, access: { has: obj => "takeRegion" in obj, get: obj => obj.takeRegion }, metadata: _metadata }, null, _instanceExtraInitializers);
292
+ __esDecorate(this, null, _takeCompressed_decorators, { kind: "method", name: "takeCompressed", static: false, private: false, access: { has: obj => "takeCompressed" in obj, get: obj => obj.takeCompressed }, metadata: _metadata }, null, _instanceExtraInitializers);
293
+ __esDecorate(this, null, _takeCompressedRegion_decorators, { kind: "method", name: "takeCompressedRegion", static: false, private: false, access: { has: obj => "takeCompressedRegion" in obj, get: obj => obj.takeCompressedRegion }, metadata: _metadata }, null, _instanceExtraInitializers);
294
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
295
+ }
296
+ apiClient = __runInitializers(this, _instanceExtraInitializers);
297
+ constructor(apiClient) {
298
+ this.apiClient = apiClient;
299
+ }
300
+ /**
301
+ * Takes a screenshot of the entire screen
302
+ *
303
+ * @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
304
+ * @returns {Promise<ScreenshotResponse>} Screenshot data with base64 encoded image
305
+ *
306
+ * @example
307
+ * ```typescript
308
+ * const screenshot = await sandbox.computerUse.screenshot.takeFullScreen();
309
+ * console.log(`Screenshot size: ${screenshot.width}x${screenshot.height}`);
310
+ *
311
+ * // With cursor visible
312
+ * const withCursor = await sandbox.computerUse.screenshot.takeFullScreen(true);
313
+ * ```
314
+ */
315
+ async takeFullScreen(showCursor = false) {
316
+ const response = await this.apiClient.takeScreenshot(showCursor);
317
+ return response.data;
318
+ }
319
+ /**
320
+ * Takes a screenshot of a specific region
321
+ *
322
+ * @param {ScreenshotRegion} region - The region to capture
323
+ * @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
324
+ * @returns {Promise<RegionScreenshotResponse>} Screenshot data with base64 encoded image
325
+ *
326
+ * @example
327
+ * ```typescript
328
+ * const region = { x: 100, y: 100, width: 300, height: 200 };
329
+ * const screenshot = await sandbox.computerUse.screenshot.takeRegion(region);
330
+ * console.log(`Captured region: ${screenshot.region.width}x${screenshot.region.height}`);
331
+ * ```
332
+ */
333
+ async takeRegion(region, showCursor = false) {
334
+ const response = await this.apiClient.takeRegionScreenshot(region.height, region.width, region.y, region.x, showCursor);
335
+ return response.data;
336
+ }
337
+ /**
338
+ * Takes a compressed screenshot of the entire screen
339
+ *
340
+ * @param {ScreenshotOptions} [options={}] - Compression and display options
341
+ * @returns {Promise<CompressedScreenshotResponse>} Compressed screenshot data
342
+ *
343
+ * @example
344
+ * ```typescript
345
+ * // Default compression
346
+ * const screenshot = await sandbox.computerUse.screenshot.takeCompressed();
347
+ *
348
+ * // High quality JPEG
349
+ * const jpeg = await sandbox.computerUse.screenshot.takeCompressed({
350
+ * format: 'jpeg',
351
+ * quality: 95,
352
+ * showCursor: true
353
+ * });
354
+ *
355
+ * // Scaled down PNG
356
+ * const scaled = await sandbox.computerUse.screenshot.takeCompressed({
357
+ * format: 'png',
358
+ * scale: 0.5
359
+ * });
360
+ * ```
361
+ */
362
+ async takeCompressed(options = {}) {
363
+ const response = await this.apiClient.takeCompressedScreenshot(options.showCursor, options.format, options.quality, options.scale);
364
+ return response.data;
365
+ }
366
+ /**
367
+ * Takes a compressed screenshot of a specific region
368
+ *
369
+ * @param {ScreenshotRegion} region - The region to capture
370
+ * @param {ScreenshotOptions} [options={}] - Compression and display options
371
+ * @returns {Promise<CompressedScreenshotResponse>} Compressed screenshot data
372
+ *
373
+ * @example
374
+ * ```typescript
375
+ * const region = { x: 0, y: 0, width: 800, height: 600 };
376
+ * const screenshot = await sandbox.computerUse.screenshot.takeCompressedRegion(region, {
377
+ * format: 'webp',
378
+ * quality: 80,
379
+ * showCursor: true
380
+ * });
381
+ * console.log(`Compressed size: ${screenshot.size_bytes} bytes`);
382
+ * ```
383
+ */
384
+ async takeCompressedRegion(region, options = {}) {
385
+ const response = await this.apiClient.takeCompressedRegionScreenshot(region.x, region.y, region.width, region.height, options.showCursor, options.format, options.quality, options.scale);
386
+ return response.data;
387
+ }
388
+ };
389
+ })();
390
+ export { Screenshot };
403
391
  /**
404
392
  * Display operations for computer use functionality
405
393
  */
406
- export class Display {
407
- apiClient;
408
- constructor(apiClient) {
409
- this.apiClient = apiClient;
410
- }
411
- /**
412
- * Gets information about the displays
413
- *
414
- * @returns {Promise<DisplayInfoResponse>} Display information including primary display and all available displays
415
- *
416
- * @example
417
- * ```typescript
418
- * const info = await sandbox.computerUse.display.getInfo();
419
- * console.log(`Primary display: ${info.primary_display.width}x${info.primary_display.height}`);
420
- * console.log(`Total displays: ${info.total_displays}`);
421
- * info.displays.forEach((display, index) => {
422
- * console.log(`Display ${index}: ${display.width}x${display.height} at ${display.x},${display.y}`);
423
- * });
424
- * ```
425
- */
426
- async getInfo() {
427
- const response = await this.apiClient.getDisplayInfo();
428
- return response.data;
429
- }
430
- /**
431
- * Gets the list of open windows
432
- *
433
- * @returns {Promise<WindowsResponse>} List of open windows with their IDs and titles
434
- *
435
- * @example
436
- * ```typescript
437
- * const windows = await sandbox.computerUse.display.getWindows();
438
- * console.log(`Found ${windows.count} open windows:`);
439
- * windows.windows.forEach(window => {
440
- * console.log(`- ${window.title} (ID: ${window.id})`);
441
- * });
442
- * ```
443
- */
444
- async getWindows() {
445
- const response = await this.apiClient.getWindows();
446
- return response.data;
447
- }
448
- }
449
- __decorate([
450
- WithInstrumentation(),
451
- __metadata("design:type", Function),
452
- __metadata("design:paramtypes", []),
453
- __metadata("design:returntype", Promise)
454
- ], Display.prototype, "getInfo", null);
455
- __decorate([
456
- WithInstrumentation(),
457
- __metadata("design:type", Function),
458
- __metadata("design:paramtypes", []),
459
- __metadata("design:returntype", Promise)
460
- ], Display.prototype, "getWindows", null);
394
+ let Display = (() => {
395
+ let _instanceExtraInitializers = [];
396
+ let _getInfo_decorators;
397
+ let _getWindows_decorators;
398
+ return class Display {
399
+ static {
400
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
401
+ _getInfo_decorators = [WithInstrumentation()];
402
+ _getWindows_decorators = [WithInstrumentation()];
403
+ __esDecorate(this, null, _getInfo_decorators, { kind: "method", name: "getInfo", static: false, private: false, access: { has: obj => "getInfo" in obj, get: obj => obj.getInfo }, metadata: _metadata }, null, _instanceExtraInitializers);
404
+ __esDecorate(this, null, _getWindows_decorators, { kind: "method", name: "getWindows", static: false, private: false, access: { has: obj => "getWindows" in obj, get: obj => obj.getWindows }, metadata: _metadata }, null, _instanceExtraInitializers);
405
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
406
+ }
407
+ apiClient = __runInitializers(this, _instanceExtraInitializers);
408
+ constructor(apiClient) {
409
+ this.apiClient = apiClient;
410
+ }
411
+ /**
412
+ * Gets information about the displays
413
+ *
414
+ * @returns {Promise<DisplayInfoResponse>} Display information including primary display and all available displays
415
+ *
416
+ * @example
417
+ * ```typescript
418
+ * const info = await sandbox.computerUse.display.getInfo();
419
+ * console.log(`Primary display: ${info.primary_display.width}x${info.primary_display.height}`);
420
+ * console.log(`Total displays: ${info.total_displays}`);
421
+ * info.displays.forEach((display, index) => {
422
+ * console.log(`Display ${index}: ${display.width}x${display.height} at ${display.x},${display.y}`);
423
+ * });
424
+ * ```
425
+ */
426
+ async getInfo() {
427
+ const response = await this.apiClient.getDisplayInfo();
428
+ return response.data;
429
+ }
430
+ /**
431
+ * Gets the list of open windows
432
+ *
433
+ * @returns {Promise<WindowsResponse>} List of open windows with their IDs and titles
434
+ *
435
+ * @example
436
+ * ```typescript
437
+ * const windows = await sandbox.computerUse.display.getWindows();
438
+ * console.log(`Found ${windows.count} open windows:`);
439
+ * windows.windows.forEach(window => {
440
+ * console.log(`- ${window.title} (ID: ${window.id})`);
441
+ * });
442
+ * ```
443
+ */
444
+ async getWindows() {
445
+ const response = await this.apiClient.getWindows();
446
+ return response.data;
447
+ }
448
+ };
449
+ })();
450
+ export { Display };
461
451
  /**
462
452
  * Recording operations for computer use functionality.
463
453
  */
464
- export class RecordingService {
465
- apiClient;
466
- constructor(apiClient) {
467
- this.apiClient = apiClient;
468
- }
469
- /**
470
- * Starts a new screen recording session
471
- *
472
- * @param {string} [label] - Optional custom label for the recording
473
- * @returns {Promise<Recording>} Started recording details
474
- *
475
- * @example
476
- * ```typescript
477
- * // Start a recording with a label
478
- * const recording = await sandbox.computerUse.recording.start('my-test-recording');
479
- * console.log(`Recording started: ${recording.id}`);
480
- * console.log(`File: ${recording.filePath}`);
481
- * ```
482
- */
483
- async start(label) {
484
- return (await this.apiClient.startRecording({ label })).data;
485
- }
486
- /**
487
- * Stops an active screen recording session
488
- *
489
- * @param {string} id - The ID of the recording to stop
490
- * @returns {Promise<Recording>} Stopped recording details
491
- *
492
- * @example
493
- * ```typescript
494
- * const result = await sandbox.computerUse.recording.stop(recording.id);
495
- * console.log(`Recording stopped: ${result.durationSeconds} seconds`);
496
- * console.log(`Saved to: ${result.filePath}`);
497
- * ```
498
- */
499
- async stop(id) {
500
- return (await this.apiClient.stopRecording({ id })).data;
501
- }
502
- /**
503
- * Lists all recordings (active and completed)
504
- *
505
- * @returns {Promise<ListRecordingsResponse>} List of all recordings
506
- *
507
- * @example
508
- * ```typescript
509
- * const recordings = await sandbox.computerUse.recording.list();
510
- * console.log(`Found ${recordings.recordings.length} recordings`);
511
- * recordings.recordings.forEach(rec => {
512
- * console.log(`- ${rec.fileName}: ${rec.status}`);
513
- * });
514
- * ```
515
- */
516
- async list() {
517
- return (await this.apiClient.listRecordings()).data;
518
- }
519
- /**
520
- * Gets details of a specific recording by ID
521
- *
522
- * @param {string} id - The ID of the recording to retrieve
523
- * @returns {Promise<Recording>} Recording details
524
- *
525
- * @example
526
- * ```typescript
527
- * const recording = await sandbox.computerUse.recording.get(recordingId);
528
- * console.log(`Recording: ${recording.fileName}`);
529
- * console.log(`Status: ${recording.status}`);
530
- * console.log(`Duration: ${recording.durationSeconds} seconds`);
531
- * ```
532
- */
533
- async get(id) {
534
- return (await this.apiClient.getRecording(id)).data;
535
- }
536
- /**
537
- * Deletes a recording by ID
538
- *
539
- * @param {string} id - The ID of the recording to delete
540
- *
541
- * @example
542
- * ```typescript
543
- * await sandbox.computerUse.recording.delete(recordingId);
544
- * console.log('Recording deleted');
545
- * ```
546
- */
547
- async delete(id) {
548
- await this.apiClient.deleteRecording(id);
549
- }
550
- /**
551
- * Downloads a recording file and saves it to a local path
552
- *
553
- * The file is streamed directly to disk without loading the entire content into memory.
554
- *
555
- * @param {string} id - The ID of the recording to download
556
- * @param {string} localPath - Path to save the recording file locally
557
- *
558
- * @example
559
- * ```typescript
560
- * // Download recording to file
561
- * await sandbox.computerUse.recording.download(recordingId, 'local_recording.mp4');
562
- * console.log('Recording downloaded');
563
- * ```
564
- */
565
- async download(id, localPath) {
566
- const response = await this.apiClient.downloadRecording(id, { responseType: 'stream' });
567
- const importErrPrefix = 'Recording download failed: ';
568
- const fs = await dynamicImport('fs', importErrPrefix);
569
- const stream = await dynamicImport('stream', importErrPrefix);
570
- const util = await dynamicImport('util', importErrPrefix);
571
- const pipeline = util.promisify(stream.pipeline);
572
- // Create parent directory if it doesn't exist
573
- const parentDir = pathe.dirname(localPath);
574
- if (parentDir) {
575
- await fs.promises.mkdir(parentDir, { recursive: true });
576
- }
577
- // Stream the download directly to file
578
- const writer = fs.createWriteStream(localPath);
579
- await pipeline(response.data, writer);
580
- }
581
- }
582
- __decorate([
583
- WithInstrumentation(),
584
- __metadata("design:type", Function),
585
- __metadata("design:paramtypes", [String]),
586
- __metadata("design:returntype", Promise)
587
- ], RecordingService.prototype, "start", null);
588
- __decorate([
589
- WithInstrumentation(),
590
- __metadata("design:type", Function),
591
- __metadata("design:paramtypes", [String]),
592
- __metadata("design:returntype", Promise)
593
- ], RecordingService.prototype, "stop", null);
594
- __decorate([
595
- WithInstrumentation(),
596
- __metadata("design:type", Function),
597
- __metadata("design:paramtypes", []),
598
- __metadata("design:returntype", Promise)
599
- ], RecordingService.prototype, "list", null);
600
- __decorate([
601
- WithInstrumentation(),
602
- __metadata("design:type", Function),
603
- __metadata("design:paramtypes", [String]),
604
- __metadata("design:returntype", Promise)
605
- ], RecordingService.prototype, "get", null);
606
- __decorate([
607
- WithInstrumentation(),
608
- __metadata("design:type", Function),
609
- __metadata("design:paramtypes", [String]),
610
- __metadata("design:returntype", Promise)
611
- ], RecordingService.prototype, "delete", null);
612
- __decorate([
613
- WithInstrumentation(),
614
- __metadata("design:type", Function),
615
- __metadata("design:paramtypes", [String, String]),
616
- __metadata("design:returntype", Promise)
617
- ], RecordingService.prototype, "download", null);
454
+ let RecordingService = (() => {
455
+ let _instanceExtraInitializers = [];
456
+ let _start_decorators;
457
+ let _stop_decorators;
458
+ let _list_decorators;
459
+ let _get_decorators;
460
+ let _delete_decorators;
461
+ let _download_decorators;
462
+ return class RecordingService {
463
+ static {
464
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
465
+ _start_decorators = [WithInstrumentation()];
466
+ _stop_decorators = [WithInstrumentation()];
467
+ _list_decorators = [WithInstrumentation()];
468
+ _get_decorators = [WithInstrumentation()];
469
+ _delete_decorators = [WithInstrumentation()];
470
+ _download_decorators = [WithInstrumentation()];
471
+ __esDecorate(this, null, _start_decorators, { kind: "method", name: "start", static: false, private: false, access: { has: obj => "start" in obj, get: obj => obj.start }, metadata: _metadata }, null, _instanceExtraInitializers);
472
+ __esDecorate(this, null, _stop_decorators, { kind: "method", name: "stop", static: false, private: false, access: { has: obj => "stop" in obj, get: obj => obj.stop }, metadata: _metadata }, null, _instanceExtraInitializers);
473
+ __esDecorate(this, null, _list_decorators, { kind: "method", name: "list", static: false, private: false, access: { has: obj => "list" in obj, get: obj => obj.list }, metadata: _metadata }, null, _instanceExtraInitializers);
474
+ __esDecorate(this, null, _get_decorators, { kind: "method", name: "get", static: false, private: false, access: { has: obj => "get" in obj, get: obj => obj.get }, metadata: _metadata }, null, _instanceExtraInitializers);
475
+ __esDecorate(this, null, _delete_decorators, { kind: "method", name: "delete", static: false, private: false, access: { has: obj => "delete" in obj, get: obj => obj.delete }, metadata: _metadata }, null, _instanceExtraInitializers);
476
+ __esDecorate(this, null, _download_decorators, { kind: "method", name: "download", static: false, private: false, access: { has: obj => "download" in obj, get: obj => obj.download }, metadata: _metadata }, null, _instanceExtraInitializers);
477
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
478
+ }
479
+ apiClient = __runInitializers(this, _instanceExtraInitializers);
480
+ constructor(apiClient) {
481
+ this.apiClient = apiClient;
482
+ }
483
+ /**
484
+ * Starts a new screen recording session
485
+ *
486
+ * @param {string} [label] - Optional custom label for the recording
487
+ * @returns {Promise<Recording>} Started recording details
488
+ *
489
+ * @example
490
+ * ```typescript
491
+ * // Start a recording with a label
492
+ * const recording = await sandbox.computerUse.recording.start('my-test-recording');
493
+ * console.log(`Recording started: ${recording.id}`);
494
+ * console.log(`File: ${recording.filePath}`);
495
+ * ```
496
+ */
497
+ async start(label) {
498
+ return (await this.apiClient.startRecording({ label })).data;
499
+ }
500
+ /**
501
+ * Stops an active screen recording session
502
+ *
503
+ * @param {string} id - The ID of the recording to stop
504
+ * @returns {Promise<Recording>} Stopped recording details
505
+ *
506
+ * @example
507
+ * ```typescript
508
+ * const result = await sandbox.computerUse.recording.stop(recording.id);
509
+ * console.log(`Recording stopped: ${result.durationSeconds} seconds`);
510
+ * console.log(`Saved to: ${result.filePath}`);
511
+ * ```
512
+ */
513
+ async stop(id) {
514
+ return (await this.apiClient.stopRecording({ id })).data;
515
+ }
516
+ /**
517
+ * Lists all recordings (active and completed)
518
+ *
519
+ * @returns {Promise<ListRecordingsResponse>} List of all recordings
520
+ *
521
+ * @example
522
+ * ```typescript
523
+ * const recordings = await sandbox.computerUse.recording.list();
524
+ * console.log(`Found ${recordings.recordings.length} recordings`);
525
+ * recordings.recordings.forEach(rec => {
526
+ * console.log(`- ${rec.fileName}: ${rec.status}`);
527
+ * });
528
+ * ```
529
+ */
530
+ async list() {
531
+ return (await this.apiClient.listRecordings()).data;
532
+ }
533
+ /**
534
+ * Gets details of a specific recording by ID
535
+ *
536
+ * @param {string} id - The ID of the recording to retrieve
537
+ * @returns {Promise<Recording>} Recording details
538
+ *
539
+ * @example
540
+ * ```typescript
541
+ * const recording = await sandbox.computerUse.recording.get(recordingId);
542
+ * console.log(`Recording: ${recording.fileName}`);
543
+ * console.log(`Status: ${recording.status}`);
544
+ * console.log(`Duration: ${recording.durationSeconds} seconds`);
545
+ * ```
546
+ */
547
+ async get(id) {
548
+ return (await this.apiClient.getRecording(id)).data;
549
+ }
550
+ /**
551
+ * Deletes a recording by ID
552
+ *
553
+ * @param {string} id - The ID of the recording to delete
554
+ *
555
+ * @example
556
+ * ```typescript
557
+ * await sandbox.computerUse.recording.delete(recordingId);
558
+ * console.log('Recording deleted');
559
+ * ```
560
+ */
561
+ async delete(id) {
562
+ await this.apiClient.deleteRecording(id);
563
+ }
564
+ /**
565
+ * Downloads a recording file and saves it to a local path
566
+ *
567
+ * The file is streamed directly to disk without loading the entire content into memory.
568
+ *
569
+ * @param {string} id - The ID of the recording to download
570
+ * @param {string} localPath - Path to save the recording file locally
571
+ *
572
+ * @example
573
+ * ```typescript
574
+ * // Download recording to file
575
+ * await sandbox.computerUse.recording.download(recordingId, 'local_recording.mp4');
576
+ * console.log('Recording downloaded');
577
+ * ```
578
+ */
579
+ async download(id, localPath) {
580
+ const response = await this.apiClient.downloadRecording(id, { responseType: 'stream' });
581
+ const importErrPrefix = 'Recording download failed: ';
582
+ const fs = await dynamicImport('fs', importErrPrefix);
583
+ const stream = await dynamicImport('stream', importErrPrefix);
584
+ const util = await dynamicImport('util', importErrPrefix);
585
+ const pipeline = util.promisify(stream.pipeline);
586
+ // Create parent directory if it doesn't exist
587
+ const parentDir = pathe.dirname(localPath);
588
+ if (parentDir) {
589
+ await fs.promises.mkdir(parentDir, { recursive: true });
590
+ }
591
+ // Stream the download directly to file
592
+ const writer = fs.createWriteStream(localPath);
593
+ await pipeline(response.data, writer);
594
+ }
595
+ };
596
+ })();
597
+ export { RecordingService };
598
+ /**
599
+ * Accessibility operations for computer use functionality.
600
+ */
601
+ let Accessibility = (() => {
602
+ let _instanceExtraInitializers = [];
603
+ let _getTree_decorators;
604
+ let _findNodes_decorators;
605
+ let _focusNode_decorators;
606
+ let _invokeNode_decorators;
607
+ let _setNodeValue_decorators;
608
+ return class Accessibility {
609
+ static {
610
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
611
+ _getTree_decorators = [WithInstrumentation()];
612
+ _findNodes_decorators = [WithInstrumentation()];
613
+ _focusNode_decorators = [WithInstrumentation()];
614
+ _invokeNode_decorators = [WithInstrumentation()];
615
+ _setNodeValue_decorators = [WithInstrumentation()];
616
+ __esDecorate(this, null, _getTree_decorators, { kind: "method", name: "getTree", static: false, private: false, access: { has: obj => "getTree" in obj, get: obj => obj.getTree }, metadata: _metadata }, null, _instanceExtraInitializers);
617
+ __esDecorate(this, null, _findNodes_decorators, { kind: "method", name: "findNodes", static: false, private: false, access: { has: obj => "findNodes" in obj, get: obj => obj.findNodes }, metadata: _metadata }, null, _instanceExtraInitializers);
618
+ __esDecorate(this, null, _focusNode_decorators, { kind: "method", name: "focusNode", static: false, private: false, access: { has: obj => "focusNode" in obj, get: obj => obj.focusNode }, metadata: _metadata }, null, _instanceExtraInitializers);
619
+ __esDecorate(this, null, _invokeNode_decorators, { kind: "method", name: "invokeNode", static: false, private: false, access: { has: obj => "invokeNode" in obj, get: obj => obj.invokeNode }, metadata: _metadata }, null, _instanceExtraInitializers);
620
+ __esDecorate(this, null, _setNodeValue_decorators, { kind: "method", name: "setNodeValue", static: false, private: false, access: { has: obj => "setNodeValue" in obj, get: obj => obj.setNodeValue }, metadata: _metadata }, null, _instanceExtraInitializers);
621
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
622
+ }
623
+ apiClient = __runInitializers(this, _instanceExtraInitializers);
624
+ constructor(apiClient) {
625
+ this.apiClient = apiClient;
626
+ }
627
+ /**
628
+ * Fetches the AT-SPI accessibility tree.
629
+ *
630
+ * @param {AccessibilityTreeOptions} [options] - Scope and depth options
631
+ * @returns {Promise<AccessibilityTreeResponse>} Accessibility tree response
632
+ *
633
+ * @example
634
+ * ```typescript
635
+ * const tree = await sandbox.computerUse.accessibility.getTree({ scope: 'all', maxDepth: 3 });
636
+ * console.log(tree.root?.name);
637
+ * ```
638
+ */
639
+ async getTree(options = {}) {
640
+ const response = await this.apiClient.getAccessibilityTree(options.scope, options.pid, options.maxDepth);
641
+ return response.data;
642
+ }
643
+ /**
644
+ * Finds AT-SPI accessibility nodes matching the provided filters.
645
+ *
646
+ * @param {AccessibilityFindOptions} [options] - Search scope, node filters, and result limit
647
+ * @returns {Promise<AccessibilityNodesResponse>} Matching accessibility nodes
648
+ *
649
+ * @example
650
+ * ```typescript
651
+ * const buttons = await sandbox.computerUse.accessibility.findNodes({
652
+ * scope: 'all',
653
+ * role: 'button',
654
+ * name: 'Submit',
655
+ * nameMatch: 'substring',
656
+ * });
657
+ * console.log(buttons.matches?.length);
658
+ * ```
659
+ */
660
+ async findNodes(options = {}) {
661
+ const response = await this.apiClient.findAccessibilityNodes(options);
662
+ return response.data;
663
+ }
664
+ /**
665
+ * Focuses an AT-SPI accessibility node.
666
+ *
667
+ * @param {string} id - Accessibility node ID returned by getTree or findNodes
668
+ *
669
+ * @example
670
+ * ```typescript
671
+ * const node = (await sandbox.computerUse.accessibility.findNodes({ scope: 'all', limit: 1 })).matches?.[0];
672
+ * if (node?.id) {
673
+ * await sandbox.computerUse.accessibility.focusNode(node.id);
674
+ * }
675
+ * ```
676
+ */
677
+ async focusNode(id) {
678
+ const request = { id };
679
+ await this.apiClient.focusAccessibilityNode(request);
680
+ }
681
+ /**
682
+ * Invokes an AT-SPI accessibility node action.
683
+ *
684
+ * @param {string} id - Accessibility node ID returned by getTree or findNodes
685
+ * @param {string} [action] - Action name to invoke. If omitted, the API invokes the primary action
686
+ *
687
+ * @example
688
+ * ```typescript
689
+ * const button = (await sandbox.computerUse.accessibility.findNodes({ scope: 'all', role: 'button', limit: 1 }))
690
+ * .matches?.[0];
691
+ * if (button?.id) {
692
+ * await sandbox.computerUse.accessibility.invokeNode(button.id, 'click');
693
+ * }
694
+ * ```
695
+ */
696
+ async invokeNode(id, action) {
697
+ const request = { id, action };
698
+ await this.apiClient.invokeAccessibilityNode(request);
699
+ }
700
+ /**
701
+ * Sets an AT-SPI accessibility node value.
702
+ *
703
+ * @param {string} id - Accessibility node ID returned by getTree or findNodes
704
+ * @param {string} value - Value to write to the node
705
+ *
706
+ * @example
707
+ * ```typescript
708
+ * const field = (await sandbox.computerUse.accessibility.findNodes({ scope: 'all', role: 'entry', limit: 1 }))
709
+ * .matches?.[0];
710
+ * if (field?.id) {
711
+ * await sandbox.computerUse.accessibility.setNodeValue(field.id, 'hello');
712
+ * }
713
+ * ```
714
+ */
715
+ async setNodeValue(id, value) {
716
+ const request = { id, value };
717
+ await this.apiClient.setAccessibilityNodeValue(request);
718
+ }
719
+ };
720
+ })();
721
+ export { Accessibility };
618
722
  /**
619
723
  * Computer Use functionality for interacting with the desktop environment.
620
724
  *
621
- * Provides access to mouse, keyboard, screenshot, display, and recording operations
725
+ * Provides access to mouse, keyboard, screenshot, display, recording, and accessibility operations
622
726
  * for automating desktop interactions within a sandbox.
623
727
  *
624
728
  * @property {Mouse} mouse - Mouse operations interface
@@ -626,174 +730,164 @@ __decorate([
626
730
  * @property {Screenshot} screenshot - Screenshot operations interface
627
731
  * @property {Display} display - Display operations interface
628
732
  * @property {RecordingService} recording - Screen recording operations interface
733
+ * @property {Accessibility} accessibility - Accessibility operations interface
629
734
  *
630
735
  * @class
631
736
  */
632
- export class ComputerUse {
633
- apiClient;
634
- mouse;
635
- keyboard;
636
- screenshot;
637
- display;
638
- recording;
639
- constructor(apiClient) {
640
- this.apiClient = apiClient;
641
- this.mouse = new Mouse(apiClient);
642
- this.keyboard = new Keyboard(apiClient);
643
- this.screenshot = new Screenshot(apiClient);
644
- this.display = new Display(apiClient);
645
- this.recording = new RecordingService(apiClient);
646
- }
647
- /**
648
- * Starts all computer use processes (Xvfb, xfce4, x11vnc, novnc)
649
- *
650
- * @returns {Promise<ComputerUseStartResponse>} Computer use start response
651
- *
652
- * @example
653
- * ```typescript
654
- * const result = await sandbox.computerUse.start();
655
- * console.log('Computer use processes started:', result.message);
656
- * ```
657
- */
658
- async start() {
659
- const response = await this.apiClient.startComputerUse();
660
- return response.data;
661
- }
662
- /**
663
- * Stops all computer use processes
664
- *
665
- * @returns {Promise<ComputerUseStopResponse>} Computer use stop response
666
- *
667
- * @example
668
- * ```typescript
669
- * const result = await sandbox.computerUse.stop();
670
- * console.log('Computer use processes stopped:', result.message);
671
- * ```
672
- */
673
- async stop() {
674
- const response = await this.apiClient.stopComputerUse();
675
- return response.data;
676
- }
677
- /**
678
- * Gets the status of all computer use processes
679
- *
680
- * @returns {Promise<ComputerUseStatusResponse>} Status information about all VNC desktop processes
681
- *
682
- * @example
683
- * ```typescript
684
- * const status = await sandbox.computerUse.getStatus();
685
- * console.log('Computer use status:', status.status);
686
- * ```
687
- */
688
- async getStatus() {
689
- const response = await this.apiClient.getComputerUseStatus();
690
- return response.data;
691
- }
692
- /**
693
- * Gets the status of a specific VNC process
694
- *
695
- * @param {string} processName - Name of the process to check
696
- * @returns {Promise<ProcessStatusResponse>} Status information about the specific process
697
- *
698
- * @example
699
- * ```typescript
700
- * const xvfbStatus = await sandbox.computerUse.getProcessStatus('xvfb');
701
- * const noVncStatus = await sandbox.computerUse.getProcessStatus('novnc');
702
- * ```
703
- */
704
- async getProcessStatus(processName) {
705
- const response = await this.apiClient.getProcessStatus(processName);
706
- return response.data;
707
- }
708
- /**
709
- * Restarts a specific VNC process
710
- *
711
- * @param {string} processName - Name of the process to restart
712
- * @returns {Promise<ProcessRestartResponse>} Process restart response
713
- *
714
- * @example
715
- * ```typescript
716
- * const result = await sandbox.computerUse.restartProcess('xfce4');
717
- * console.log('XFCE4 process restarted:', result.message);
718
- * ```
719
- */
720
- async restartProcess(processName) {
721
- const response = await this.apiClient.restartProcess(processName);
722
- return response.data;
723
- }
724
- /**
725
- * Gets logs for a specific VNC process
726
- *
727
- * @param {string} processName - Name of the process to get logs for
728
- * @returns {Promise<ProcessLogsResponse>} Process logs
729
- *
730
- * @example
731
- * ```typescript
732
- * const logsResp = await sandbox.computerUse.getProcessLogs('novnc');
733
- * console.log('NoVNC logs:', logsResp.logs);
734
- * ```
735
- */
736
- async getProcessLogs(processName) {
737
- const response = await this.apiClient.getProcessLogs(processName);
738
- return response.data;
739
- }
740
- /**
741
- * Gets error logs for a specific VNC process
742
- *
743
- * @param {string} processName - Name of the process to get error logs for
744
- * @returns {Promise<ProcessErrorsResponse>} Process error logs
745
- *
746
- * @example
747
- * ```typescript
748
- * const errorsResp = await sandbox.computerUse.getProcessErrors('x11vnc');
749
- * console.log('X11VNC errors:', errorsResp.errors);
750
- * ```
751
- */
752
- async getProcessErrors(processName) {
753
- const response = await this.apiClient.getProcessErrors(processName);
754
- return response.data;
755
- }
756
- }
757
- __decorate([
758
- WithInstrumentation(),
759
- __metadata("design:type", Function),
760
- __metadata("design:paramtypes", []),
761
- __metadata("design:returntype", Promise)
762
- ], ComputerUse.prototype, "start", null);
763
- __decorate([
764
- WithInstrumentation(),
765
- __metadata("design:type", Function),
766
- __metadata("design:paramtypes", []),
767
- __metadata("design:returntype", Promise)
768
- ], ComputerUse.prototype, "stop", null);
769
- __decorate([
770
- WithInstrumentation(),
771
- __metadata("design:type", Function),
772
- __metadata("design:paramtypes", []),
773
- __metadata("design:returntype", Promise)
774
- ], ComputerUse.prototype, "getStatus", null);
775
- __decorate([
776
- WithInstrumentation(),
777
- __metadata("design:type", Function),
778
- __metadata("design:paramtypes", [String]),
779
- __metadata("design:returntype", Promise)
780
- ], ComputerUse.prototype, "getProcessStatus", null);
781
- __decorate([
782
- WithInstrumentation(),
783
- __metadata("design:type", Function),
784
- __metadata("design:paramtypes", [String]),
785
- __metadata("design:returntype", Promise)
786
- ], ComputerUse.prototype, "restartProcess", null);
787
- __decorate([
788
- WithInstrumentation(),
789
- __metadata("design:type", Function),
790
- __metadata("design:paramtypes", [String]),
791
- __metadata("design:returntype", Promise)
792
- ], ComputerUse.prototype, "getProcessLogs", null);
793
- __decorate([
794
- WithInstrumentation(),
795
- __metadata("design:type", Function),
796
- __metadata("design:paramtypes", [String]),
797
- __metadata("design:returntype", Promise)
798
- ], ComputerUse.prototype, "getProcessErrors", null);
737
+ let ComputerUse = (() => {
738
+ let _instanceExtraInitializers = [];
739
+ let _start_decorators;
740
+ let _stop_decorators;
741
+ let _getStatus_decorators;
742
+ let _getProcessStatus_decorators;
743
+ let _restartProcess_decorators;
744
+ let _getProcessLogs_decorators;
745
+ let _getProcessErrors_decorators;
746
+ return class ComputerUse {
747
+ static {
748
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
749
+ _start_decorators = [WithInstrumentation()];
750
+ _stop_decorators = [WithInstrumentation()];
751
+ _getStatus_decorators = [WithInstrumentation()];
752
+ _getProcessStatus_decorators = [WithInstrumentation()];
753
+ _restartProcess_decorators = [WithInstrumentation()];
754
+ _getProcessLogs_decorators = [WithInstrumentation()];
755
+ _getProcessErrors_decorators = [WithInstrumentation()];
756
+ __esDecorate(this, null, _start_decorators, { kind: "method", name: "start", static: false, private: false, access: { has: obj => "start" in obj, get: obj => obj.start }, metadata: _metadata }, null, _instanceExtraInitializers);
757
+ __esDecorate(this, null, _stop_decorators, { kind: "method", name: "stop", static: false, private: false, access: { has: obj => "stop" in obj, get: obj => obj.stop }, metadata: _metadata }, null, _instanceExtraInitializers);
758
+ __esDecorate(this, null, _getStatus_decorators, { kind: "method", name: "getStatus", static: false, private: false, access: { has: obj => "getStatus" in obj, get: obj => obj.getStatus }, metadata: _metadata }, null, _instanceExtraInitializers);
759
+ __esDecorate(this, null, _getProcessStatus_decorators, { kind: "method", name: "getProcessStatus", static: false, private: false, access: { has: obj => "getProcessStatus" in obj, get: obj => obj.getProcessStatus }, metadata: _metadata }, null, _instanceExtraInitializers);
760
+ __esDecorate(this, null, _restartProcess_decorators, { kind: "method", name: "restartProcess", static: false, private: false, access: { has: obj => "restartProcess" in obj, get: obj => obj.restartProcess }, metadata: _metadata }, null, _instanceExtraInitializers);
761
+ __esDecorate(this, null, _getProcessLogs_decorators, { kind: "method", name: "getProcessLogs", static: false, private: false, access: { has: obj => "getProcessLogs" in obj, get: obj => obj.getProcessLogs }, metadata: _metadata }, null, _instanceExtraInitializers);
762
+ __esDecorate(this, null, _getProcessErrors_decorators, { kind: "method", name: "getProcessErrors", static: false, private: false, access: { has: obj => "getProcessErrors" in obj, get: obj => obj.getProcessErrors }, metadata: _metadata }, null, _instanceExtraInitializers);
763
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
764
+ }
765
+ apiClient = __runInitializers(this, _instanceExtraInitializers);
766
+ mouse;
767
+ keyboard;
768
+ screenshot;
769
+ display;
770
+ recording;
771
+ accessibility;
772
+ constructor(apiClient) {
773
+ this.apiClient = apiClient;
774
+ this.mouse = new Mouse(apiClient);
775
+ this.keyboard = new Keyboard(apiClient);
776
+ this.screenshot = new Screenshot(apiClient);
777
+ this.display = new Display(apiClient);
778
+ this.recording = new RecordingService(apiClient);
779
+ this.accessibility = new Accessibility(apiClient);
780
+ }
781
+ /**
782
+ * Starts all computer use processes (Xvfb, xfce4, x11vnc, novnc)
783
+ *
784
+ * @returns {Promise<ComputerUseStartResponse>} Computer use start response
785
+ *
786
+ * @example
787
+ * ```typescript
788
+ * const result = await sandbox.computerUse.start();
789
+ * console.log('Computer use processes started:', result.message);
790
+ * ```
791
+ */
792
+ async start() {
793
+ const response = await this.apiClient.startComputerUse();
794
+ return response.data;
795
+ }
796
+ /**
797
+ * Stops all computer use processes
798
+ *
799
+ * @returns {Promise<ComputerUseStopResponse>} Computer use stop response
800
+ *
801
+ * @example
802
+ * ```typescript
803
+ * const result = await sandbox.computerUse.stop();
804
+ * console.log('Computer use processes stopped:', result.message);
805
+ * ```
806
+ */
807
+ async stop() {
808
+ const response = await this.apiClient.stopComputerUse();
809
+ return response.data;
810
+ }
811
+ /**
812
+ * Gets the status of all computer use processes
813
+ *
814
+ * @returns {Promise<ComputerUseStatusResponse>} Status information about all VNC desktop processes
815
+ *
816
+ * @example
817
+ * ```typescript
818
+ * const status = await sandbox.computerUse.getStatus();
819
+ * console.log('Computer use status:', status.status);
820
+ * ```
821
+ */
822
+ async getStatus() {
823
+ const response = await this.apiClient.getComputerUseStatus();
824
+ return response.data;
825
+ }
826
+ /**
827
+ * Gets the status of a specific VNC process
828
+ *
829
+ * @param {string} processName - Name of the process to check
830
+ * @returns {Promise<ProcessStatusResponse>} Status information about the specific process
831
+ *
832
+ * @example
833
+ * ```typescript
834
+ * const xvfbStatus = await sandbox.computerUse.getProcessStatus('xvfb');
835
+ * const noVncStatus = await sandbox.computerUse.getProcessStatus('novnc');
836
+ * ```
837
+ */
838
+ async getProcessStatus(processName) {
839
+ const response = await this.apiClient.getProcessStatus(processName);
840
+ return response.data;
841
+ }
842
+ /**
843
+ * Restarts a specific VNC process
844
+ *
845
+ * @param {string} processName - Name of the process to restart
846
+ * @returns {Promise<ProcessRestartResponse>} Process restart response
847
+ *
848
+ * @example
849
+ * ```typescript
850
+ * const result = await sandbox.computerUse.restartProcess('xfce4');
851
+ * console.log('XFCE4 process restarted:', result.message);
852
+ * ```
853
+ */
854
+ async restartProcess(processName) {
855
+ const response = await this.apiClient.restartProcess(processName);
856
+ return response.data;
857
+ }
858
+ /**
859
+ * Gets logs for a specific VNC process
860
+ *
861
+ * @param {string} processName - Name of the process to get logs for
862
+ * @returns {Promise<ProcessLogsResponse>} Process logs
863
+ *
864
+ * @example
865
+ * ```typescript
866
+ * const logsResp = await sandbox.computerUse.getProcessLogs('novnc');
867
+ * console.log('NoVNC logs:', logsResp.logs);
868
+ * ```
869
+ */
870
+ async getProcessLogs(processName) {
871
+ const response = await this.apiClient.getProcessLogs(processName);
872
+ return response.data;
873
+ }
874
+ /**
875
+ * Gets error logs for a specific VNC process
876
+ *
877
+ * @param {string} processName - Name of the process to get error logs for
878
+ * @returns {Promise<ProcessErrorsResponse>} Process error logs
879
+ *
880
+ * @example
881
+ * ```typescript
882
+ * const errorsResp = await sandbox.computerUse.getProcessErrors('x11vnc');
883
+ * console.log('X11VNC errors:', errorsResp.errors);
884
+ * ```
885
+ */
886
+ async getProcessErrors(processName) {
887
+ const response = await this.apiClient.getProcessErrors(processName);
888
+ return response.data;
889
+ }
890
+ };
891
+ })();
892
+ export { ComputerUse };
799
893
  //# sourceMappingURL=ComputerUse.js.map