@daytonaio/sdk 0.170.0 → 0.171.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/{src → cjs}/CodeInterpreter.d.ts +1 -0
- package/cjs/CodeInterpreter.js.map +1 -0
- package/{src → cjs}/ComputerUse.d.ts +2 -1
- package/{src → cjs}/ComputerUse.js +2 -2
- package/cjs/ComputerUse.js.map +1 -0
- package/{src → cjs}/Daytona.d.ts +3 -1
- package/{src → cjs}/Daytona.js +8 -2
- package/cjs/Daytona.js.map +1 -0
- package/{src → cjs}/FileSystem.d.ts +27 -0
- package/{src → cjs}/FileSystem.js +69 -0
- package/cjs/FileSystem.js.map +1 -0
- package/{src → cjs}/Git.d.ts +1 -0
- package/cjs/Git.js.map +1 -0
- package/{src → cjs}/Image.d.ts +1 -0
- package/cjs/Image.js.map +1 -0
- package/{src → cjs}/LspServer.d.ts +1 -0
- package/cjs/LspServer.js.map +1 -0
- package/{src → cjs}/ObjectStorage.d.ts +1 -0
- package/cjs/ObjectStorage.js.map +1 -0
- package/{src → cjs}/Process.d.ts +1 -0
- package/cjs/Process.js.map +1 -0
- package/{src → cjs}/PtyHandle.d.ts +1 -0
- package/cjs/PtyHandle.js.map +1 -0
- package/cjs/README.md +180 -0
- package/{src → cjs}/Sandbox.d.ts +1 -0
- package/{src → cjs}/Sandbox.js +1 -1
- package/cjs/Sandbox.js.map +1 -0
- package/{src → cjs}/Snapshot.d.ts +1 -0
- package/cjs/Snapshot.js.map +1 -0
- package/{src → cjs}/Volume.d.ts +1 -0
- package/cjs/Volume.js.map +1 -0
- package/{src → cjs}/errors/DaytonaError.d.ts +1 -0
- package/cjs/errors/DaytonaError.js.map +1 -0
- package/{src → cjs}/index.d.ts +1 -0
- package/cjs/index.js.map +1 -0
- package/cjs/package.json +3 -0
- package/{src → cjs}/types/Charts.d.ts +1 -0
- package/cjs/types/Charts.js.map +1 -0
- package/{src → cjs}/types/CodeInterpreter.d.ts +1 -0
- package/cjs/types/CodeInterpreter.js.map +1 -0
- package/{src → cjs}/types/ExecuteResponse.d.ts +1 -0
- package/cjs/types/ExecuteResponse.js.map +1 -0
- package/{src → cjs}/types/Pty.d.ts +1 -0
- package/cjs/types/Pty.js.map +1 -0
- package/{src → cjs}/utils/Binary.d.ts +1 -0
- package/cjs/utils/Binary.js.map +1 -0
- package/{src → cjs}/utils/FileTransfer.d.ts +2 -1
- package/{src → cjs}/utils/FileTransfer.js +5 -2
- package/cjs/utils/FileTransfer.js.map +1 -0
- package/cjs/utils/Import.d.ts +125 -0
- package/cjs/utils/Import.js +112 -0
- package/cjs/utils/Import.js.map +1 -0
- package/{src → cjs}/utils/Multipart.d.ts +1 -0
- package/cjs/utils/Multipart.js.map +1 -0
- package/{src → cjs}/utils/Runtime.d.ts +1 -0
- package/cjs/utils/Runtime.js.map +1 -0
- package/{src → cjs}/utils/Stream.d.ts +1 -0
- package/cjs/utils/Stream.js.map +1 -0
- package/{src → cjs}/utils/WebSocket.d.ts +1 -0
- package/cjs/utils/WebSocket.js.map +1 -0
- package/{src → cjs}/utils/otel.decorator.d.ts +1 -0
- package/cjs/utils/otel.decorator.js.map +1 -0
- package/esm/CodeInterpreter.d.ts +95 -0
- package/esm/CodeInterpreter.js +292 -0
- package/esm/CodeInterpreter.js.map +1 -0
- package/esm/ComputerUse.d.ts +539 -0
- package/esm/ComputerUse.js +799 -0
- package/esm/ComputerUse.js.map +1 -0
- package/esm/Daytona.d.ts +355 -0
- package/esm/Daytona.js +523 -0
- package/esm/Daytona.js.map +1 -0
- package/esm/FileSystem.d.ts +371 -0
- package/esm/FileSystem.js +485 -0
- package/esm/FileSystem.js.map +1 -0
- package/esm/Git.d.ts +203 -0
- package/esm/Git.js +322 -0
- package/esm/Git.js.map +1 -0
- package/esm/Image.d.ts +265 -0
- package/esm/Image.js +581 -0
- package/esm/Image.js.map +1 -0
- package/esm/LspServer.d.ts +172 -0
- package/esm/LspServer.js +255 -0
- package/esm/LspServer.js.map +1 -0
- package/esm/ObjectStorage.d.ts +79 -0
- package/esm/ObjectStorage.js +195 -0
- package/esm/ObjectStorage.js.map +1 -0
- package/esm/Process.d.ts +490 -0
- package/esm/Process.js +642 -0
- package/esm/Process.js.map +1 -0
- package/esm/PtyHandle.d.ts +155 -0
- package/esm/PtyHandle.js +412 -0
- package/esm/PtyHandle.js.map +1 -0
- package/esm/README.md +180 -0
- package/esm/Sandbox.d.ts +476 -0
- package/esm/Sandbox.js +901 -0
- package/esm/Sandbox.js.map +1 -0
- package/esm/Snapshot.d.ts +140 -0
- package/esm/Snapshot.js +244 -0
- package/esm/Snapshot.js.map +1 -0
- package/esm/Volume.d.ts +84 -0
- package/esm/Volume.js +115 -0
- package/esm/Volume.js.map +1 -0
- package/esm/errors/DaytonaError.d.ts +171 -0
- package/esm/errors/DaytonaError.js +243 -0
- package/esm/errors/DaytonaError.js.map +1 -0
- package/esm/index.d.ts +22 -0
- package/esm/index.js +21 -0
- package/esm/index.js.map +1 -0
- package/esm/package.json +3 -0
- package/esm/types/Charts.d.ts +38 -0
- package/esm/types/Charts.js +33 -0
- package/esm/types/Charts.js.map +1 -0
- package/esm/types/CodeInterpreter.d.ts +77 -0
- package/esm/types/CodeInterpreter.js +6 -0
- package/esm/types/CodeInterpreter.js.map +1 -0
- package/esm/types/ExecuteResponse.d.ts +26 -0
- package/esm/types/ExecuteResponse.js +6 -0
- package/esm/types/ExecuteResponse.js.map +1 -0
- package/esm/types/Pty.d.ts +48 -0
- package/esm/types/Pty.js +6 -0
- package/esm/types/Pty.js.map +1 -0
- package/esm/utils/Binary.d.ts +39 -0
- package/esm/utils/Binary.js +157 -0
- package/esm/utils/Binary.js.map +1 -0
- package/esm/utils/FileTransfer.d.ts +15 -0
- package/esm/utils/FileTransfer.js +254 -0
- package/esm/utils/FileTransfer.js.map +1 -0
- package/{src → esm}/utils/Import.d.ts +3 -5
- package/{src → esm}/utils/Import.js +12 -14
- package/esm/utils/Import.js.map +1 -0
- package/esm/utils/Multipart.d.ts +29 -0
- package/esm/utils/Multipart.js +109 -0
- package/esm/utils/Multipart.js.map +1 -0
- package/esm/utils/Runtime.d.ts +44 -0
- package/esm/utils/Runtime.js +89 -0
- package/esm/utils/Runtime.js.map +1 -0
- package/esm/utils/Stream.d.ts +20 -0
- package/esm/utils/Stream.js +360 -0
- package/esm/utils/Stream.js.map +1 -0
- package/esm/utils/WebSocket.d.ts +10 -0
- package/esm/utils/WebSocket.js +22 -0
- package/esm/utils/WebSocket.js.map +1 -0
- package/esm/utils/otel.decorator.d.ts +83 -0
- package/esm/utils/otel.decorator.js +136 -0
- package/esm/utils/otel.decorator.js.map +1 -0
- package/package.json +26 -8
- package/src/CodeInterpreter.js.map +0 -1
- package/src/ComputerUse.js.map +0 -1
- package/src/Daytona.js.map +0 -1
- package/src/FileSystem.js.map +0 -1
- package/src/Git.js.map +0 -1
- package/src/Image.js.map +0 -1
- package/src/LspServer.js.map +0 -1
- package/src/ObjectStorage.js.map +0 -1
- package/src/Process.js.map +0 -1
- package/src/PtyHandle.js.map +0 -1
- package/src/Sandbox.js.map +0 -1
- package/src/Snapshot.js.map +0 -1
- package/src/Volume.js.map +0 -1
- package/src/__tests__/helpers.d.ts +0 -5
- package/src/__tests__/helpers.js +0 -26
- package/src/__tests__/helpers.js.map +0 -1
- package/src/errors/DaytonaError.js.map +0 -1
- package/src/index.js.map +0 -1
- package/src/types/Charts.js.map +0 -1
- package/src/types/CodeInterpreter.js.map +0 -1
- package/src/types/ExecuteResponse.js.map +0 -1
- package/src/types/Pty.js.map +0 -1
- package/src/utils/Binary.js.map +0 -1
- package/src/utils/FileTransfer.js.map +0 -1
- package/src/utils/Import.js.map +0 -1
- package/src/utils/Multipart.js.map +0 -1
- package/src/utils/Runtime.js.map +0 -1
- package/src/utils/Stream.js.map +0 -1
- package/src/utils/WebSocket.js.map +0 -1
- package/src/utils/otel.decorator.js.map +0 -1
- /package/{src → cjs}/CodeInterpreter.js +0 -0
- /package/{src → cjs}/Git.js +0 -0
- /package/{src → cjs}/Image.js +0 -0
- /package/{src → cjs}/LspServer.js +0 -0
- /package/{src → cjs}/ObjectStorage.js +0 -0
- /package/{src → cjs}/Process.js +0 -0
- /package/{src → cjs}/PtyHandle.js +0 -0
- /package/{src → cjs}/Snapshot.js +0 -0
- /package/{src → cjs}/Volume.js +0 -0
- /package/{src → cjs}/errors/DaytonaError.js +0 -0
- /package/{src → cjs}/index.js +0 -0
- /package/{src → cjs}/types/Charts.js +0 -0
- /package/{src → cjs}/types/CodeInterpreter.js +0 -0
- /package/{src → cjs}/types/ExecuteResponse.js +0 -0
- /package/{src → cjs}/types/Pty.js +0 -0
- /package/{src → cjs}/utils/Binary.js +0 -0
- /package/{src → cjs}/utils/Multipart.js +0 -0
- /package/{src → cjs}/utils/Runtime.js +0 -0
- /package/{src → cjs}/utils/Stream.js +0 -0
- /package/{src → cjs}/utils/WebSocket.js +0 -0
- /package/{src → cjs}/utils/otel.decorator.js +0 -0
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
import { ComputerUseApi, MousePositionResponse, MouseClickResponse, MouseDragResponse, ScreenshotResponse, DisplayInfoResponse, WindowsResponse, ComputerUseStartResponse, ComputerUseStopResponse, ComputerUseStatusResponse, ProcessStatusResponse, ProcessRestartResponse, ProcessLogsResponse, ProcessErrorsResponse, Recording, ListRecordingsResponse } from '@daytona/toolbox-api-client';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for region coordinates used in screenshot operations
|
|
4
|
+
*/
|
|
5
|
+
export interface ScreenshotRegion {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Interface for screenshot compression options
|
|
13
|
+
*/
|
|
14
|
+
export interface ScreenshotOptions {
|
|
15
|
+
showCursor?: boolean;
|
|
16
|
+
format?: string;
|
|
17
|
+
quality?: number;
|
|
18
|
+
scale?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Mouse operations for computer use functionality
|
|
22
|
+
*/
|
|
23
|
+
export declare class Mouse {
|
|
24
|
+
private readonly apiClient;
|
|
25
|
+
constructor(apiClient: ComputerUseApi);
|
|
26
|
+
/**
|
|
27
|
+
* Gets the current mouse cursor position
|
|
28
|
+
*
|
|
29
|
+
* @returns {Promise<MousePositionResponse>} Current mouse position with x and y coordinates
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const position = await sandbox.computerUse.mouse.getPosition();
|
|
34
|
+
* console.log(`Mouse is at: ${position.x}, ${position.y}`);
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
getPosition(): Promise<MousePositionResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Moves the mouse cursor to the specified coordinates
|
|
40
|
+
*
|
|
41
|
+
* @param {number} x - The x coordinate to move to
|
|
42
|
+
* @param {number} y - The y coordinate to move to
|
|
43
|
+
* @returns {Promise<MousePositionResponse>} Position after move
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const result = await sandbox.computerUse.mouse.move(100, 200);
|
|
48
|
+
* console.log(`Mouse moved to: ${result.x}, ${result.y}`);
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
move(x: number, y: number): Promise<MousePositionResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Clicks the mouse at the specified coordinates
|
|
54
|
+
*
|
|
55
|
+
* @param {number} x - The x coordinate to click at
|
|
56
|
+
* @param {number} y - The y coordinate to click at
|
|
57
|
+
* @param {string} [button='left'] - The mouse button to click ('left', 'right', 'middle')
|
|
58
|
+
* @param {boolean} [double=false] - Whether to perform a double-click
|
|
59
|
+
* @returns {Promise<MouseClickResponse>} Click operation result
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* // Single left click
|
|
64
|
+
* const result = await sandbox.computerUse.mouse.click(100, 200);
|
|
65
|
+
*
|
|
66
|
+
* // Double click
|
|
67
|
+
* const doubleClick = await sandbox.computerUse.mouse.click(100, 200, 'left', true);
|
|
68
|
+
*
|
|
69
|
+
* // Right click
|
|
70
|
+
* const rightClick = await sandbox.computerUse.mouse.click(100, 200, 'right');
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
click(x: number, y: number, button?: string, double?: boolean): Promise<MouseClickResponse>;
|
|
74
|
+
/**
|
|
75
|
+
* Drags the mouse from start coordinates to end coordinates
|
|
76
|
+
*
|
|
77
|
+
* @param {number} startX - The starting x coordinate
|
|
78
|
+
* @param {number} startY - The starting y coordinate
|
|
79
|
+
* @param {number} endX - The ending x coordinate
|
|
80
|
+
* @param {number} endY - The ending y coordinate
|
|
81
|
+
* @param {string} [button='left'] - The mouse button to use for dragging
|
|
82
|
+
* @returns {Promise<MouseDragResponse>} Drag operation result
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* const result = await sandbox.computerUse.mouse.drag(50, 50, 150, 150);
|
|
87
|
+
* console.log(`Drag ended at: ${result.x}, ${result.y}`);
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
drag(startX: number, startY: number, endX: number, endY: number, button?: string): Promise<MouseDragResponse>;
|
|
91
|
+
/**
|
|
92
|
+
* Scrolls the mouse wheel at the specified coordinates
|
|
93
|
+
*
|
|
94
|
+
* @param {number} x - The x coordinate to scroll at
|
|
95
|
+
* @param {number} y - The y coordinate to scroll at
|
|
96
|
+
* @param {'up' | 'down'} direction - The direction to scroll
|
|
97
|
+
* @param {number} [amount=1] - The amount to scroll
|
|
98
|
+
* @returns {Promise<boolean>} Whether the scroll operation was successful
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* // Scroll up
|
|
103
|
+
* const scrollUp = await sandbox.computerUse.mouse.scroll(100, 200, 'up', 3);
|
|
104
|
+
*
|
|
105
|
+
* // Scroll down
|
|
106
|
+
* const scrollDown = await sandbox.computerUse.mouse.scroll(100, 200, 'down', 5);
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
scroll(x: number, y: number, direction: 'up' | 'down', amount?: number): Promise<boolean>;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Keyboard operations for computer use functionality
|
|
113
|
+
*/
|
|
114
|
+
export declare class Keyboard {
|
|
115
|
+
private readonly apiClient;
|
|
116
|
+
constructor(apiClient: ComputerUseApi);
|
|
117
|
+
/**
|
|
118
|
+
* Types the specified text
|
|
119
|
+
*
|
|
120
|
+
* @param {string} text - The text to type
|
|
121
|
+
* @param {number} [delay=0] - Delay between characters in milliseconds
|
|
122
|
+
* @throws {DaytonaError} If the type operation fails
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* try {
|
|
127
|
+
* await sandbox.computerUse.keyboard.type('Hello, World!');
|
|
128
|
+
* console.log('Operation success');
|
|
129
|
+
* } catch (e) {
|
|
130
|
+
* console.log('Operation failed:', e);
|
|
131
|
+
* }
|
|
132
|
+
*
|
|
133
|
+
* // With delay between characters
|
|
134
|
+
* try {
|
|
135
|
+
* await sandbox.computerUse.keyboard.type('Slow typing', 100);
|
|
136
|
+
* console.log('Operation success');
|
|
137
|
+
* } catch (e) {
|
|
138
|
+
* console.log('Operation failed:', e);
|
|
139
|
+
* }
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
type(text: string, delay?: number): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Presses a key with optional modifiers
|
|
145
|
+
*
|
|
146
|
+
* @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.
|
|
147
|
+
* @param {string[]} [modifiers=[]] - Canonical modifier names are 'ctrl', 'alt', 'shift', and 'cmd'. Common aliases such as 'control', 'option', 'meta', and 'win' are normalized.
|
|
148
|
+
* @throws {DaytonaError} If the press operation fails
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* // Press Enter
|
|
153
|
+
* try {
|
|
154
|
+
* await sandbox.computerUse.keyboard.press('enter');
|
|
155
|
+
* console.log('Operation success');
|
|
156
|
+
* } catch (e) {
|
|
157
|
+
* console.log('Operation failed:', e);
|
|
158
|
+
* }
|
|
159
|
+
*
|
|
160
|
+
* // Press Ctrl+C
|
|
161
|
+
* try {
|
|
162
|
+
* await sandbox.computerUse.keyboard.press('c', ['ctrl']);
|
|
163
|
+
* console.log('Operation success');
|
|
164
|
+
* } catch (e) {
|
|
165
|
+
* console.log('Operation failed:', e);
|
|
166
|
+
* }
|
|
167
|
+
*
|
|
168
|
+
* // Press Ctrl+Shift+T
|
|
169
|
+
* try {
|
|
170
|
+
* await sandbox.computerUse.keyboard.press('t', ['ctrl', 'shift']);
|
|
171
|
+
* console.log('Operation success');
|
|
172
|
+
* } catch (e) {
|
|
173
|
+
* console.log('Operation failed:', e);
|
|
174
|
+
* }
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
press(key: string, modifiers?: string[]): Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Presses a hotkey combination
|
|
180
|
+
*
|
|
181
|
+
* @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()`.
|
|
182
|
+
* @throws {DaytonaError} If the hotkey operation fails
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```typescript
|
|
186
|
+
* // Copy
|
|
187
|
+
* try {
|
|
188
|
+
* await sandbox.computerUse.keyboard.hotkey('ctrl+c');
|
|
189
|
+
* console.log('Operation success');
|
|
190
|
+
* } catch (e) {
|
|
191
|
+
* console.log('Operation failed:', e);
|
|
192
|
+
* }
|
|
193
|
+
*
|
|
194
|
+
* // Paste
|
|
195
|
+
* try {
|
|
196
|
+
* await sandbox.computerUse.keyboard.hotkey('ctrl+v');
|
|
197
|
+
* console.log('Operation success');
|
|
198
|
+
* } catch (e) {
|
|
199
|
+
* console.log('Operation failed:', e);
|
|
200
|
+
* }
|
|
201
|
+
*
|
|
202
|
+
* // Alt+Tab
|
|
203
|
+
* try {
|
|
204
|
+
* await sandbox.computerUse.keyboard.hotkey('alt+tab');
|
|
205
|
+
* console.log('Operation success');
|
|
206
|
+
* } catch (e) {
|
|
207
|
+
* console.log('Operation failed:', e);
|
|
208
|
+
* }
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
hotkey(keys: string): Promise<void>;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Screenshot operations for computer use functionality
|
|
215
|
+
*/
|
|
216
|
+
export declare class Screenshot {
|
|
217
|
+
private readonly apiClient;
|
|
218
|
+
constructor(apiClient: ComputerUseApi);
|
|
219
|
+
/**
|
|
220
|
+
* Takes a screenshot of the entire screen
|
|
221
|
+
*
|
|
222
|
+
* @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
|
|
223
|
+
* @returns {Promise<ScreenshotResponse>} Screenshot data with base64 encoded image
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* const screenshot = await sandbox.computerUse.screenshot.takeFullScreen();
|
|
228
|
+
* console.log(`Screenshot size: ${screenshot.width}x${screenshot.height}`);
|
|
229
|
+
*
|
|
230
|
+
* // With cursor visible
|
|
231
|
+
* const withCursor = await sandbox.computerUse.screenshot.takeFullScreen(true);
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
takeFullScreen(showCursor?: boolean): Promise<ScreenshotResponse>;
|
|
235
|
+
/**
|
|
236
|
+
* Takes a screenshot of a specific region
|
|
237
|
+
*
|
|
238
|
+
* @param {ScreenshotRegion} region - The region to capture
|
|
239
|
+
* @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
|
|
240
|
+
* @returns {Promise<RegionScreenshotResponse>} Screenshot data with base64 encoded image
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```typescript
|
|
244
|
+
* const region = { x: 100, y: 100, width: 300, height: 200 };
|
|
245
|
+
* const screenshot = await sandbox.computerUse.screenshot.takeRegion(region);
|
|
246
|
+
* console.log(`Captured region: ${screenshot.region.width}x${screenshot.region.height}`);
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
takeRegion(region: ScreenshotRegion, showCursor?: boolean): Promise<ScreenshotResponse>;
|
|
250
|
+
/**
|
|
251
|
+
* Takes a compressed screenshot of the entire screen
|
|
252
|
+
*
|
|
253
|
+
* @param {ScreenshotOptions} [options={}] - Compression and display options
|
|
254
|
+
* @returns {Promise<CompressedScreenshotResponse>} Compressed screenshot data
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```typescript
|
|
258
|
+
* // Default compression
|
|
259
|
+
* const screenshot = await sandbox.computerUse.screenshot.takeCompressed();
|
|
260
|
+
*
|
|
261
|
+
* // High quality JPEG
|
|
262
|
+
* const jpeg = await sandbox.computerUse.screenshot.takeCompressed({
|
|
263
|
+
* format: 'jpeg',
|
|
264
|
+
* quality: 95,
|
|
265
|
+
* showCursor: true
|
|
266
|
+
* });
|
|
267
|
+
*
|
|
268
|
+
* // Scaled down PNG
|
|
269
|
+
* const scaled = await sandbox.computerUse.screenshot.takeCompressed({
|
|
270
|
+
* format: 'png',
|
|
271
|
+
* scale: 0.5
|
|
272
|
+
* });
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
takeCompressed(options?: ScreenshotOptions): Promise<ScreenshotResponse>;
|
|
276
|
+
/**
|
|
277
|
+
* Takes a compressed screenshot of a specific region
|
|
278
|
+
*
|
|
279
|
+
* @param {ScreenshotRegion} region - The region to capture
|
|
280
|
+
* @param {ScreenshotOptions} [options={}] - Compression and display options
|
|
281
|
+
* @returns {Promise<CompressedScreenshotResponse>} Compressed screenshot data
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* const region = { x: 0, y: 0, width: 800, height: 600 };
|
|
286
|
+
* const screenshot = await sandbox.computerUse.screenshot.takeCompressedRegion(region, {
|
|
287
|
+
* format: 'webp',
|
|
288
|
+
* quality: 80,
|
|
289
|
+
* showCursor: true
|
|
290
|
+
* });
|
|
291
|
+
* console.log(`Compressed size: ${screenshot.size_bytes} bytes`);
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
takeCompressedRegion(region: ScreenshotRegion, options?: ScreenshotOptions): Promise<ScreenshotResponse>;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Display operations for computer use functionality
|
|
298
|
+
*/
|
|
299
|
+
export declare class Display {
|
|
300
|
+
private readonly apiClient;
|
|
301
|
+
constructor(apiClient: ComputerUseApi);
|
|
302
|
+
/**
|
|
303
|
+
* Gets information about the displays
|
|
304
|
+
*
|
|
305
|
+
* @returns {Promise<DisplayInfoResponse>} Display information including primary display and all available displays
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```typescript
|
|
309
|
+
* const info = await sandbox.computerUse.display.getInfo();
|
|
310
|
+
* console.log(`Primary display: ${info.primary_display.width}x${info.primary_display.height}`);
|
|
311
|
+
* console.log(`Total displays: ${info.total_displays}`);
|
|
312
|
+
* info.displays.forEach((display, index) => {
|
|
313
|
+
* console.log(`Display ${index}: ${display.width}x${display.height} at ${display.x},${display.y}`);
|
|
314
|
+
* });
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
getInfo(): Promise<DisplayInfoResponse>;
|
|
318
|
+
/**
|
|
319
|
+
* Gets the list of open windows
|
|
320
|
+
*
|
|
321
|
+
* @returns {Promise<WindowsResponse>} List of open windows with their IDs and titles
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```typescript
|
|
325
|
+
* const windows = await sandbox.computerUse.display.getWindows();
|
|
326
|
+
* console.log(`Found ${windows.count} open windows:`);
|
|
327
|
+
* windows.windows.forEach(window => {
|
|
328
|
+
* console.log(`- ${window.title} (ID: ${window.id})`);
|
|
329
|
+
* });
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
getWindows(): Promise<WindowsResponse>;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Recording operations for computer use functionality.
|
|
336
|
+
*/
|
|
337
|
+
export declare class RecordingService {
|
|
338
|
+
private readonly apiClient;
|
|
339
|
+
constructor(apiClient: ComputerUseApi);
|
|
340
|
+
/**
|
|
341
|
+
* Starts a new screen recording session
|
|
342
|
+
*
|
|
343
|
+
* @param {string} [label] - Optional custom label for the recording
|
|
344
|
+
* @returns {Promise<Recording>} Started recording details
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```typescript
|
|
348
|
+
* // Start a recording with a label
|
|
349
|
+
* const recording = await sandbox.computerUse.recording.start('my-test-recording');
|
|
350
|
+
* console.log(`Recording started: ${recording.id}`);
|
|
351
|
+
* console.log(`File: ${recording.filePath}`);
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
start(label?: string): Promise<Recording>;
|
|
355
|
+
/**
|
|
356
|
+
* Stops an active screen recording session
|
|
357
|
+
*
|
|
358
|
+
* @param {string} id - The ID of the recording to stop
|
|
359
|
+
* @returns {Promise<Recording>} Stopped recording details
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* ```typescript
|
|
363
|
+
* const result = await sandbox.computerUse.recording.stop(recording.id);
|
|
364
|
+
* console.log(`Recording stopped: ${result.durationSeconds} seconds`);
|
|
365
|
+
* console.log(`Saved to: ${result.filePath}`);
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
368
|
+
stop(id: string): Promise<Recording>;
|
|
369
|
+
/**
|
|
370
|
+
* Lists all recordings (active and completed)
|
|
371
|
+
*
|
|
372
|
+
* @returns {Promise<ListRecordingsResponse>} List of all recordings
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* ```typescript
|
|
376
|
+
* const recordings = await sandbox.computerUse.recording.list();
|
|
377
|
+
* console.log(`Found ${recordings.recordings.length} recordings`);
|
|
378
|
+
* recordings.recordings.forEach(rec => {
|
|
379
|
+
* console.log(`- ${rec.fileName}: ${rec.status}`);
|
|
380
|
+
* });
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
list(): Promise<ListRecordingsResponse>;
|
|
384
|
+
/**
|
|
385
|
+
* Gets details of a specific recording by ID
|
|
386
|
+
*
|
|
387
|
+
* @param {string} id - The ID of the recording to retrieve
|
|
388
|
+
* @returns {Promise<Recording>} Recording details
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* ```typescript
|
|
392
|
+
* const recording = await sandbox.computerUse.recording.get(recordingId);
|
|
393
|
+
* console.log(`Recording: ${recording.fileName}`);
|
|
394
|
+
* console.log(`Status: ${recording.status}`);
|
|
395
|
+
* console.log(`Duration: ${recording.durationSeconds} seconds`);
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
get(id: string): Promise<Recording>;
|
|
399
|
+
/**
|
|
400
|
+
* Deletes a recording by ID
|
|
401
|
+
*
|
|
402
|
+
* @param {string} id - The ID of the recording to delete
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* ```typescript
|
|
406
|
+
* await sandbox.computerUse.recording.delete(recordingId);
|
|
407
|
+
* console.log('Recording deleted');
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
delete(id: string): Promise<void>;
|
|
411
|
+
/**
|
|
412
|
+
* Downloads a recording file and saves it to a local path
|
|
413
|
+
*
|
|
414
|
+
* The file is streamed directly to disk without loading the entire content into memory.
|
|
415
|
+
*
|
|
416
|
+
* @param {string} id - The ID of the recording to download
|
|
417
|
+
* @param {string} localPath - Path to save the recording file locally
|
|
418
|
+
*
|
|
419
|
+
* @example
|
|
420
|
+
* ```typescript
|
|
421
|
+
* // Download recording to file
|
|
422
|
+
* await sandbox.computerUse.recording.download(recordingId, 'local_recording.mp4');
|
|
423
|
+
* console.log('Recording downloaded');
|
|
424
|
+
* ```
|
|
425
|
+
*/
|
|
426
|
+
download(id: string, localPath: string): Promise<void>;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Computer Use functionality for interacting with the desktop environment.
|
|
430
|
+
*
|
|
431
|
+
* Provides access to mouse, keyboard, screenshot, display, and recording operations
|
|
432
|
+
* for automating desktop interactions within a sandbox.
|
|
433
|
+
*
|
|
434
|
+
* @property {Mouse} mouse - Mouse operations interface
|
|
435
|
+
* @property {Keyboard} keyboard - Keyboard operations interface
|
|
436
|
+
* @property {Screenshot} screenshot - Screenshot operations interface
|
|
437
|
+
* @property {Display} display - Display operations interface
|
|
438
|
+
* @property {RecordingService} recording - Screen recording operations interface
|
|
439
|
+
*
|
|
440
|
+
* @class
|
|
441
|
+
*/
|
|
442
|
+
export declare class ComputerUse {
|
|
443
|
+
private readonly apiClient;
|
|
444
|
+
readonly mouse: Mouse;
|
|
445
|
+
readonly keyboard: Keyboard;
|
|
446
|
+
readonly screenshot: Screenshot;
|
|
447
|
+
readonly display: Display;
|
|
448
|
+
readonly recording: RecordingService;
|
|
449
|
+
constructor(apiClient: ComputerUseApi);
|
|
450
|
+
/**
|
|
451
|
+
* Starts all computer use processes (Xvfb, xfce4, x11vnc, novnc)
|
|
452
|
+
*
|
|
453
|
+
* @returns {Promise<ComputerUseStartResponse>} Computer use start response
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```typescript
|
|
457
|
+
* const result = await sandbox.computerUse.start();
|
|
458
|
+
* console.log('Computer use processes started:', result.message);
|
|
459
|
+
* ```
|
|
460
|
+
*/
|
|
461
|
+
start(): Promise<ComputerUseStartResponse>;
|
|
462
|
+
/**
|
|
463
|
+
* Stops all computer use processes
|
|
464
|
+
*
|
|
465
|
+
* @returns {Promise<ComputerUseStopResponse>} Computer use stop response
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* ```typescript
|
|
469
|
+
* const result = await sandbox.computerUse.stop();
|
|
470
|
+
* console.log('Computer use processes stopped:', result.message);
|
|
471
|
+
* ```
|
|
472
|
+
*/
|
|
473
|
+
stop(): Promise<ComputerUseStopResponse>;
|
|
474
|
+
/**
|
|
475
|
+
* Gets the status of all computer use processes
|
|
476
|
+
*
|
|
477
|
+
* @returns {Promise<ComputerUseStatusResponse>} Status information about all VNC desktop processes
|
|
478
|
+
*
|
|
479
|
+
* @example
|
|
480
|
+
* ```typescript
|
|
481
|
+
* const status = await sandbox.computerUse.getStatus();
|
|
482
|
+
* console.log('Computer use status:', status.status);
|
|
483
|
+
* ```
|
|
484
|
+
*/
|
|
485
|
+
getStatus(): Promise<ComputerUseStatusResponse>;
|
|
486
|
+
/**
|
|
487
|
+
* Gets the status of a specific VNC process
|
|
488
|
+
*
|
|
489
|
+
* @param {string} processName - Name of the process to check
|
|
490
|
+
* @returns {Promise<ProcessStatusResponse>} Status information about the specific process
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* ```typescript
|
|
494
|
+
* const xvfbStatus = await sandbox.computerUse.getProcessStatus('xvfb');
|
|
495
|
+
* const noVncStatus = await sandbox.computerUse.getProcessStatus('novnc');
|
|
496
|
+
* ```
|
|
497
|
+
*/
|
|
498
|
+
getProcessStatus(processName: string): Promise<ProcessStatusResponse>;
|
|
499
|
+
/**
|
|
500
|
+
* Restarts a specific VNC process
|
|
501
|
+
*
|
|
502
|
+
* @param {string} processName - Name of the process to restart
|
|
503
|
+
* @returns {Promise<ProcessRestartResponse>} Process restart response
|
|
504
|
+
*
|
|
505
|
+
* @example
|
|
506
|
+
* ```typescript
|
|
507
|
+
* const result = await sandbox.computerUse.restartProcess('xfce4');
|
|
508
|
+
* console.log('XFCE4 process restarted:', result.message);
|
|
509
|
+
* ```
|
|
510
|
+
*/
|
|
511
|
+
restartProcess(processName: string): Promise<ProcessRestartResponse>;
|
|
512
|
+
/**
|
|
513
|
+
* Gets logs for a specific VNC process
|
|
514
|
+
*
|
|
515
|
+
* @param {string} processName - Name of the process to get logs for
|
|
516
|
+
* @returns {Promise<ProcessLogsResponse>} Process logs
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* ```typescript
|
|
520
|
+
* const logsResp = await sandbox.computerUse.getProcessLogs('novnc');
|
|
521
|
+
* console.log('NoVNC logs:', logsResp.logs);
|
|
522
|
+
* ```
|
|
523
|
+
*/
|
|
524
|
+
getProcessLogs(processName: string): Promise<ProcessLogsResponse>;
|
|
525
|
+
/**
|
|
526
|
+
* Gets error logs for a specific VNC process
|
|
527
|
+
*
|
|
528
|
+
* @param {string} processName - Name of the process to get error logs for
|
|
529
|
+
* @returns {Promise<ProcessErrorsResponse>} Process error logs
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* ```typescript
|
|
533
|
+
* const errorsResp = await sandbox.computerUse.getProcessErrors('x11vnc');
|
|
534
|
+
* console.log('X11VNC errors:', errorsResp.errors);
|
|
535
|
+
* ```
|
|
536
|
+
*/
|
|
537
|
+
getProcessErrors(processName: string): Promise<ProcessErrorsResponse>;
|
|
538
|
+
}
|
|
539
|
+
//# sourceMappingURL=ComputerUse.d.ts.map
|