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