@daytonaio/sdk 0.22.0-alpha.2 → 0.22.0-alpha.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daytonaio/sdk",
3
- "version": "0.22.0-alpha.2",
3
+ "version": "0.22.0-alpha.3",
4
4
  "description": "TypeScript SDK for Daytona",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -42,7 +42,7 @@
42
42
  "typedoc-plugin-merge-modules": "6.1.0",
43
43
  "untildify": "^5.0.0",
44
44
  "uuid": "^11.0.3",
45
- "@daytonaio/api-client": "0.22.0-alpha.2"
45
+ "@daytonaio/api-client": "0.22.0-alpha.3"
46
46
  },
47
47
  "packageManager": "yarn@4.6.0",
48
48
  "type": "commonjs"
package/src/Sandbox.d.ts CHANGED
@@ -3,7 +3,6 @@ import { FileSystem } from './FileSystem';
3
3
  import { Git } from './Git';
4
4
  import { CodeRunParams, Process } from './Process';
5
5
  import { LspLanguageId, LspServer } from './LspServer';
6
- import { ComputerUse } from './ComputerUse';
7
6
  /**
8
7
  * Interface defining methods that a code toolbox must implement
9
8
  * @interface
@@ -18,7 +17,6 @@ export interface SandboxCodeToolbox {
18
17
  * @property {FileSystem} fs - File system operations interface
19
18
  * @property {Git} git - Git operations interface
20
19
  * @property {Process} process - Process execution interface
21
- * @property {ComputerUse} computerUse - Computer use operations interface for desktop automation
22
20
  * @property {string} id - Unique identifier for the Sandbox
23
21
  * @property {string} organizationId - Organization ID of the Sandbox
24
22
  * @property {string} [snapshot] - Daytona snapshot used to create the Sandbox
@@ -52,7 +50,6 @@ export declare class Sandbox implements SandboxDto {
52
50
  readonly fs: FileSystem;
53
51
  readonly git: Git;
54
52
  readonly process: Process;
55
- readonly computerUse: ComputerUse;
56
53
  id: string;
57
54
  organizationId: string;
58
55
  snapshot?: string;
package/src/Sandbox.js CHANGED
@@ -11,14 +11,12 @@ const Process_1 = require("./Process");
11
11
  const LspServer_1 = require("./LspServer");
12
12
  const DaytonaError_1 = require("./errors/DaytonaError");
13
13
  const Path_1 = require("./utils/Path");
14
- const ComputerUse_1 = require("./ComputerUse");
15
14
  /**
16
15
  * Represents a Daytona Sandbox.
17
16
  *
18
17
  * @property {FileSystem} fs - File system operations interface
19
18
  * @property {Git} git - Git operations interface
20
19
  * @property {Process} process - Process execution interface
21
- * @property {ComputerUse} computerUse - Computer use operations interface for desktop automation
22
20
  * @property {string} id - Unique identifier for the Sandbox
23
21
  * @property {string} organizationId - Organization ID of the Sandbox
24
22
  * @property {string} [snapshot] - Daytona snapshot used to create the Sandbox
@@ -52,7 +50,6 @@ class Sandbox {
52
50
  fs;
53
51
  git;
54
52
  process;
55
- computerUse;
56
53
  id;
57
54
  organizationId;
58
55
  snapshot;
@@ -94,7 +91,6 @@ class Sandbox {
94
91
  this.fs = new FileSystem_1.FileSystem(this.id, this.toolboxApi, async () => await this.getRootDir());
95
92
  this.git = new Git_1.Git(this.id, this.toolboxApi, async () => await this.getRootDir());
96
93
  this.process = new Process_1.Process(this.id, this.codeToolbox, this.toolboxApi, async () => await this.getRootDir());
97
- this.computerUse = new ComputerUse_1.ComputerUse(this.id, this.toolboxApi);
98
94
  }
99
95
  /**
100
96
  * Gets the root directory path for the logged in user inside the Sandbox.
@@ -222,6 +218,10 @@ class Sandbox {
222
218
  const startTime = Date.now();
223
219
  while (this.state !== 'started') {
224
220
  await this.refreshData();
221
+ // @ts-expect-error this.refreshData() can modify this.state so this check is fine
222
+ if (this.state === 'started') {
223
+ return;
224
+ }
225
225
  if (this.state === 'error') {
226
226
  const errMsg = `Sandbox ${this.id} failed to start with status: ${this.state}, error reason: ${this.errorReason}`;
227
227
  throw new DaytonaError_1.DaytonaError(errMsg);
@@ -251,6 +251,10 @@ class Sandbox {
251
251
  const startTime = Date.now();
252
252
  while (this.state !== 'stopped') {
253
253
  await this.refreshData();
254
+ // @ts-expect-error this.refreshData() can modify this.state so this check is fine
255
+ if (this.state === 'stopped') {
256
+ return;
257
+ }
254
258
  if (this.state === 'error') {
255
259
  const errMsg = `Sandbox failed to stop with status: ${this.state}, error reason: ${this.errorReason}`;
256
260
  throw new DaytonaError_1.DaytonaError(errMsg);
@@ -1 +1 @@
1
- {"version":3,"file":"Sandbox.js","sourceRoot":"","sources":["../../../../libs/sdk-typescript/src/Sandbox.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAYH,6CAAyC;AACzC,+BAA2B;AAC3B,uCAAkD;AAClD,2CAAsD;AACtD,wDAAoD;AACpD,uCAAiD;AACjD,+CAA2C;AAW3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAa,OAAO;IA0CC;IACA;IACA;IA3CH,EAAE,CAAY;IACd,GAAG,CAAK;IACR,OAAO,CAAS;IAChB,WAAW,CAAa;IAEjC,EAAE,CAAS;IACX,cAAc,CAAS;IACvB,QAAQ,CAAS;IACjB,IAAI,CAAS;IACb,GAAG,CAAyB;IAC5B,MAAM,CAAyB;IAC/B,MAAM,CAAU;IAChB,MAAM,CAAS;IACf,GAAG,CAAS;IACZ,GAAG,CAAS;IACZ,MAAM,CAAS;IACf,IAAI,CAAS;IACb,KAAK,CAAe;IACpB,WAAW,CAAS;IACpB,WAAW,CAAyB;IACpC,eAAe,CAAS;IACxB,gBAAgB,CAAS;IACzB,mBAAmB,CAAS;IAC5B,YAAY,CAAS;IACrB,OAAO,CAAuB;IAC9B,SAAS,CAAY;IACrB,SAAS,CAAS;IAClB,SAAS,CAAS;IAEjB,OAAO,CAAQ;IAEvB;;;;;;;OAOG;IACH,YACE,UAAsB,EACL,UAAsB,EACtB,UAAsB,EACtB,WAA+B;QAF/B,eAAU,GAAV,UAAU,CAAY;QACtB,eAAU,GAAV,UAAU,CAAY;QACtB,gBAAW,GAAX,WAAW,CAAoB;QAEhD,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAA;QAClC,IAAI,CAAC,OAA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CAAA;QACzD,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAA;QAC3C,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAA;QACjC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAA;QACrC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAA;QACrC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAA;IACvC,CAAC;CACF;AAhYD,0BAgYC"}
package/src/index.d.ts CHANGED
@@ -9,9 +9,7 @@ export { Image } from './Image';
9
9
  export { Sandbox } from './Sandbox';
10
10
  export type { SandboxCodeToolbox } from './Sandbox';
11
11
  export { CreateSnapshotParams } from './Snapshot';
12
- export { ComputerUse, Mouse, Keyboard, Screenshot, Display } from './ComputerUse';
13
12
  export { ChartType } from './types/Charts';
14
13
  export type { BarChart, BoxAndWhiskerChart, Chart, CompositeChart, LineChart, PieChart, ScatterChart, } from './types/Charts';
15
14
  export { SandboxState } from '@daytonaio/api-client';
16
15
  export type { FileInfo, GitStatus, ListBranchResponse, Match, ReplaceResult, SearchFilesResponse, } from '@daytonaio/api-client';
17
- export type { ScreenshotRegion, ScreenshotOptions } from './ComputerUse';
package/src/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.SandboxState = exports.ChartType = exports.Display = exports.Screenshot = exports.Keyboard = exports.Mouse = exports.ComputerUse = exports.Sandbox = exports.Image = exports.DaytonaError = exports.Process = exports.LspLanguageId = exports.Git = exports.FileSystem = exports.Daytona = exports.CodeLanguage = void 0;
7
+ exports.SandboxState = exports.ChartType = exports.Sandbox = exports.Image = exports.DaytonaError = exports.Process = exports.LspLanguageId = exports.Git = exports.FileSystem = exports.Daytona = exports.CodeLanguage = void 0;
8
8
  var Daytona_1 = require("./Daytona");
9
9
  Object.defineProperty(exports, "CodeLanguage", { enumerable: true, get: function () { return Daytona_1.CodeLanguage; } });
10
10
  Object.defineProperty(exports, "Daytona", { enumerable: true, get: function () { return Daytona_1.Daytona; } });
@@ -24,12 +24,6 @@ var Image_1 = require("./Image");
24
24
  Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return Image_1.Image; } });
25
25
  var Sandbox_1 = require("./Sandbox");
26
26
  Object.defineProperty(exports, "Sandbox", { enumerable: true, get: function () { return Sandbox_1.Sandbox; } });
27
- var ComputerUse_1 = require("./ComputerUse");
28
- Object.defineProperty(exports, "ComputerUse", { enumerable: true, get: function () { return ComputerUse_1.ComputerUse; } });
29
- Object.defineProperty(exports, "Mouse", { enumerable: true, get: function () { return ComputerUse_1.Mouse; } });
30
- Object.defineProperty(exports, "Keyboard", { enumerable: true, get: function () { return ComputerUse_1.Keyboard; } });
31
- Object.defineProperty(exports, "Screenshot", { enumerable: true, get: function () { return ComputerUse_1.Screenshot; } });
32
- Object.defineProperty(exports, "Display", { enumerable: true, get: function () { return ComputerUse_1.Display; } });
33
27
  // Chart and artifact types
34
28
  var Charts_1 = require("./types/Charts");
35
29
  Object.defineProperty(exports, "ChartType", { enumerable: true, get: function () { return Charts_1.ChartType; } });
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/sdk-typescript/src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAAiD;AAAxC,uGAAA,YAAY,OAAA;AAAE,kGAAA,OAAO,OAAA;AAS9B,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,yCAA2C;AAAlC,0GAAA,aAAa,OAAA;AACtB,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAChB,0CAA0C;AAC1C,6DAA6D;AAC7D,sDAAoD;AAA3C,4GAAA,YAAY,OAAA;AACrB,iCAA+B;AAAtB,8FAAA,KAAK,OAAA;AACd,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAGhB,6CAAiF;AAAxE,0GAAA,WAAW,OAAA;AAAE,oGAAA,KAAK,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAAE,yGAAA,UAAU,OAAA;AAAE,sGAAA,OAAO,OAAA;AAE1D,2BAA2B;AAC3B,yCAA0C;AAAjC,mGAAA,SAAS,OAAA;AAWlB,oDAAoD;AAA3C,0GAAA,YAAY,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/sdk-typescript/src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAAiD;AAAxC,uGAAA,YAAY,OAAA;AAAE,kGAAA,OAAO,OAAA;AAS9B,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,yCAA2C;AAAlC,0GAAA,aAAa,OAAA;AACtB,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAChB,0CAA0C;AAC1C,6DAA6D;AAC7D,sDAAoD;AAA3C,4GAAA,YAAY,OAAA;AACrB,iCAA+B;AAAtB,8FAAA,KAAK,OAAA;AACd,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAIhB,2BAA2B;AAC3B,yCAA0C;AAAjC,mGAAA,SAAS,OAAA;AAWlB,oDAAoD;AAA3C,0GAAA,YAAY,OAAA"}
@@ -1,447 +0,0 @@
1
- import { ToolboxApi, MousePosition, MouseMoveResponse, MouseClickResponse, MouseDragResponse, ScreenshotResponse, RegionScreenshotResponse, CompressedScreenshotResponse, DisplayInfoResponse, WindowsResponse, ComputerUseStartResponse, ComputerUseStopResponse, ComputerUseStatusResponse, ProcessStatusResponse, ProcessRestartResponse, ProcessLogsResponse, ProcessErrorsResponse } from '@daytonaio/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 sandboxId;
25
- private readonly toolboxApi;
26
- constructor(sandboxId: string, toolboxApi: ToolboxApi);
27
- /**
28
- * Gets the current mouse cursor position
29
- *
30
- * @returns {Promise<MousePosition>} Current mouse position with x and y coordinates
31
- *
32
- * @example
33
- * ```typescript
34
- * const position = await sandbox.computerUse.mouse.getPosition();
35
- * console.log(`Mouse is at: ${position.x}, ${position.y}`);
36
- * ```
37
- */
38
- getPosition(): Promise<MousePosition>;
39
- /**
40
- * Moves the mouse cursor to the specified coordinates
41
- *
42
- * @param {number} x - The x coordinate to move to
43
- * @param {number} y - The y coordinate to move to
44
- * @returns {Promise<MouseMoveResponse>} Move operation result
45
- *
46
- * @example
47
- * ```typescript
48
- * const result = await sandbox.computerUse.mouse.move(100, 200);
49
- * console.log(`Mouse moved to: ${result.x}, ${result.y}`);
50
- * ```
51
- */
52
- move(x: number, y: number): Promise<MouseMoveResponse>;
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
- click(x: number, y: number, button?: string, double?: boolean): Promise<MouseClickResponse>;
75
- /**
76
- * Drags the mouse from start coordinates to end coordinates
77
- *
78
- * @param {number} startX - The starting x coordinate
79
- * @param {number} startY - The starting y coordinate
80
- * @param {number} endX - The ending x coordinate
81
- * @param {number} endY - The ending y coordinate
82
- * @param {string} [button='left'] - The mouse button to use for dragging
83
- * @returns {Promise<MouseDragResponse>} Drag operation result
84
- *
85
- * @example
86
- * ```typescript
87
- * const result = await sandbox.computerUse.mouse.drag(50, 50, 150, 150);
88
- * console.log(`Dragged from ${result.from.x},${result.from.y} to ${result.to.x},${result.to.y}`);
89
- * ```
90
- */
91
- drag(startX: number, startY: number, endX: number, endY: number, button?: string): Promise<MouseDragResponse>;
92
- /**
93
- * Scrolls the mouse wheel at the specified coordinates
94
- *
95
- * @param {number} x - The x coordinate to scroll at
96
- * @param {number} y - The y coordinate to scroll at
97
- * @param {'up' | 'down'} direction - The direction to scroll
98
- * @param {number} [amount=1] - The amount to scroll
99
- * @returns {Promise<boolean>} Whether the scroll operation was successful
100
- *
101
- * @example
102
- * ```typescript
103
- * // Scroll up
104
- * const scrollUp = await sandbox.computerUse.mouse.scroll(100, 200, 'up', 3);
105
- *
106
- * // Scroll down
107
- * const scrollDown = await sandbox.computerUse.mouse.scroll(100, 200, 'down', 5);
108
- * ```
109
- */
110
- scroll(x: number, y: number, direction: 'up' | 'down', amount?: number): Promise<boolean>;
111
- }
112
- /**
113
- * Keyboard operations for computer use functionality
114
- */
115
- export declare class Keyboard {
116
- private readonly sandboxId;
117
- private readonly toolboxApi;
118
- constructor(sandboxId: string, toolboxApi: ToolboxApi);
119
- /**
120
- * Types the specified text
121
- *
122
- * @param {string} text - The text to type
123
- * @param {number} [delay=0] - Delay between characters in milliseconds
124
- * @throws {DaytonaError} If the type operation fails
125
- *
126
- * @example
127
- * ```typescript
128
- * try {
129
- * await sandbox.computerUse.keyboard.type('Hello, World!');
130
- * console.log('Operation success');
131
- * } catch (e) {
132
- * console.log('Operation failed:', e);
133
- * }
134
- *
135
- * // With delay between characters
136
- * try {
137
- * await sandbox.computerUse.keyboard.type('Slow typing', 100);
138
- * console.log('Operation success');
139
- * } catch (e) {
140
- * console.log('Operation failed:', e);
141
- * }
142
- * ```
143
- */
144
- type(text: string, delay?: number): Promise<void>;
145
- /**
146
- * Presses a key with optional modifiers
147
- *
148
- * @param {string} key - The key to press (e.g., 'Enter', 'Escape', 'Tab', 'a', 'A')
149
- * @param {string[]} [modifiers=[]] - Modifier keys ('ctrl', 'alt', 'meta', 'shift')
150
- * @throws {DaytonaError} If the press operation fails
151
- *
152
- * @example
153
- * ```typescript
154
- * // Press Enter
155
- * try {
156
- * await sandbox.computerUse.keyboard.press('Return');
157
- * console.log('Operation success');
158
- * } catch (e) {
159
- * console.log('Operation failed:', e);
160
- * }
161
- *
162
- * // Press Ctrl+C
163
- * try {
164
- * await sandbox.computerUse.keyboard.press('c', ['ctrl']);
165
- * console.log('Operation success');
166
- * } catch (e) {
167
- * console.log('Operation failed:', e);
168
- * }
169
- *
170
- * // Press Ctrl+Shift+T
171
- * try {
172
- * await sandbox.computerUse.keyboard.press('t', ['ctrl', 'shift']);
173
- * console.log('Operation success');
174
- * } catch (e) {
175
- * console.log('Operation failed:', e);
176
- * }
177
- * ```
178
- */
179
- press(key: string, modifiers?: string[]): Promise<void>;
180
- /**
181
- * Presses a hotkey combination
182
- *
183
- * @param {string} keys - The hotkey combination (e.g., 'ctrl+c', 'alt+tab', 'cmd+shift+t')
184
- * @throws {DaytonaError} If the hotkey operation fails
185
- *
186
- * @example
187
- * ```typescript
188
- * // Copy
189
- * try {
190
- * await sandbox.computerUse.keyboard.hotkey('ctrl+c');
191
- * console.log('Operation success');
192
- * } catch (e) {
193
- * console.log('Operation failed:', e);
194
- * }
195
- *
196
- * // Paste
197
- * try {
198
- * await sandbox.computerUse.keyboard.hotkey('ctrl+v');
199
- * console.log('Operation success');
200
- * } catch (e) {
201
- * console.log('Operation failed:', e);
202
- * }
203
- *
204
- * // Alt+Tab
205
- * try {
206
- * await sandbox.computerUse.keyboard.hotkey('alt+tab');
207
- * console.log('Operation success');
208
- * } catch (e) {
209
- * console.log('Operation failed:', e);
210
- * }
211
- * ```
212
- */
213
- hotkey(keys: string): Promise<void>;
214
- }
215
- /**
216
- * Screenshot operations for computer use functionality
217
- */
218
- export declare class Screenshot {
219
- private readonly sandboxId;
220
- private readonly toolboxApi;
221
- constructor(sandboxId: string, toolboxApi: ToolboxApi);
222
- /**
223
- * Takes a screenshot of the entire screen
224
- *
225
- * @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
226
- * @returns {Promise<ScreenshotResponse>} Screenshot data with base64 encoded image
227
- *
228
- * @example
229
- * ```typescript
230
- * const screenshot = await sandbox.computerUse.screenshot.takeFullScreen();
231
- * console.log(`Screenshot size: ${screenshot.width}x${screenshot.height}`);
232
- *
233
- * // With cursor visible
234
- * const withCursor = await sandbox.computerUse.screenshot.takeFullScreen(true);
235
- * ```
236
- */
237
- takeFullScreen(showCursor?: boolean): Promise<ScreenshotResponse>;
238
- /**
239
- * Takes a screenshot of a specific region
240
- *
241
- * @param {ScreenshotRegion} region - The region to capture
242
- * @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
243
- * @returns {Promise<RegionScreenshotResponse>} Screenshot data with base64 encoded image
244
- *
245
- * @example
246
- * ```typescript
247
- * const region = { x: 100, y: 100, width: 300, height: 200 };
248
- * const screenshot = await sandbox.computerUse.screenshot.takeRegion(region);
249
- * console.log(`Captured region: ${screenshot.region.width}x${screenshot.region.height}`);
250
- * ```
251
- */
252
- takeRegion(region: ScreenshotRegion, showCursor?: boolean): Promise<RegionScreenshotResponse>;
253
- /**
254
- * Takes a compressed screenshot of the entire screen
255
- *
256
- * @param {ScreenshotOptions} [options={}] - Compression and display options
257
- * @returns {Promise<CompressedScreenshotResponse>} Compressed screenshot data
258
- *
259
- * @example
260
- * ```typescript
261
- * // Default compression
262
- * const screenshot = await sandbox.computerUse.screenshot.takeCompressed();
263
- *
264
- * // High quality JPEG
265
- * const jpeg = await sandbox.computerUse.screenshot.takeCompressed({
266
- * format: 'jpeg',
267
- * quality: 95,
268
- * showCursor: true
269
- * });
270
- *
271
- * // Scaled down PNG
272
- * const scaled = await sandbox.computerUse.screenshot.takeCompressed({
273
- * format: 'png',
274
- * scale: 0.5
275
- * });
276
- * ```
277
- */
278
- takeCompressed(options?: ScreenshotOptions): Promise<CompressedScreenshotResponse>;
279
- /**
280
- * Takes a compressed screenshot of a specific region
281
- *
282
- * @param {ScreenshotRegion} region - The region to capture
283
- * @param {ScreenshotOptions} [options={}] - Compression and display options
284
- * @returns {Promise<CompressedScreenshotResponse>} Compressed screenshot data
285
- *
286
- * @example
287
- * ```typescript
288
- * const region = { x: 0, y: 0, width: 800, height: 600 };
289
- * const screenshot = await sandbox.computerUse.screenshot.takeCompressedRegion(region, {
290
- * format: 'webp',
291
- * quality: 80,
292
- * showCursor: true
293
- * });
294
- * console.log(`Compressed size: ${screenshot.size_bytes} bytes`);
295
- * ```
296
- */
297
- takeCompressedRegion(region: ScreenshotRegion, options?: ScreenshotOptions): Promise<CompressedScreenshotResponse>;
298
- }
299
- /**
300
- * Display operations for computer use functionality
301
- */
302
- export declare class Display {
303
- private readonly sandboxId;
304
- private readonly toolboxApi;
305
- constructor(sandboxId: string, toolboxApi: ToolboxApi);
306
- /**
307
- * Gets information about the displays
308
- *
309
- * @returns {Promise<DisplayInfoResponse>} Display information including primary display and all available displays
310
- *
311
- * @example
312
- * ```typescript
313
- * const info = await sandbox.computerUse.display.getInfo();
314
- * console.log(`Primary display: ${info.primary_display.width}x${info.primary_display.height}`);
315
- * console.log(`Total displays: ${info.total_displays}`);
316
- * info.displays.forEach((display, index) => {
317
- * console.log(`Display ${index}: ${display.width}x${display.height} at ${display.x},${display.y}`);
318
- * });
319
- * ```
320
- */
321
- getInfo(): Promise<DisplayInfoResponse>;
322
- /**
323
- * Gets the list of open windows
324
- *
325
- * @returns {Promise<WindowsResponse>} List of open windows with their IDs and titles
326
- *
327
- * @example
328
- * ```typescript
329
- * const windows = await sandbox.computerUse.display.getWindows();
330
- * console.log(`Found ${windows.count} open windows:`);
331
- * windows.windows.forEach(window => {
332
- * console.log(`- ${window.title} (ID: ${window.id})`);
333
- * });
334
- * ```
335
- */
336
- getWindows(): Promise<WindowsResponse>;
337
- }
338
- /**
339
- * Computer Use functionality for interacting with the desktop environment.
340
- *
341
- * Provides access to mouse, keyboard, screenshot, and display operations
342
- * for automating desktop interactions within a sandbox.
343
- *
344
- * @property {Mouse} mouse - Mouse operations interface
345
- * @property {Keyboard} keyboard - Keyboard operations interface
346
- * @property {Screenshot} screenshot - Screenshot operations interface
347
- * @property {Display} display - Display operations interface
348
- *
349
- * @class
350
- */
351
- export declare class ComputerUse {
352
- private readonly sandboxId;
353
- private readonly toolboxApi;
354
- readonly mouse: Mouse;
355
- readonly keyboard: Keyboard;
356
- readonly screenshot: Screenshot;
357
- readonly display: Display;
358
- constructor(sandboxId: string, toolboxApi: ToolboxApi);
359
- /**
360
- * Starts all computer use processes (Xvfb, xfce4, x11vnc, novnc)
361
- *
362
- * @returns {Promise<ComputerUseStartResponse>} Computer use start response
363
- *
364
- * @example
365
- * ```typescript
366
- * const result = await sandbox.computerUse.start();
367
- * console.log('Computer use processes started:', result.message);
368
- * ```
369
- */
370
- start(): Promise<ComputerUseStartResponse>;
371
- /**
372
- * Stops all computer use processes
373
- *
374
- * @returns {Promise<ComputerUseStopResponse>} Computer use stop response
375
- *
376
- * @example
377
- * ```typescript
378
- * const result = await sandbox.computerUse.stop();
379
- * console.log('Computer use processes stopped:', result.message);
380
- * ```
381
- */
382
- stop(): Promise<ComputerUseStopResponse>;
383
- /**
384
- * Gets the status of all computer use processes
385
- *
386
- * @returns {Promise<ComputerUseStatusResponse>} Status information about all VNC desktop processes
387
- *
388
- * @example
389
- * ```typescript
390
- * const status = await sandbox.computerUse.getStatus();
391
- * console.log('Computer use status:', status.status);
392
- * ```
393
- */
394
- getStatus(): Promise<ComputerUseStatusResponse>;
395
- /**
396
- * Gets the status of a specific VNC process
397
- *
398
- * @param {string} processName - Name of the process to check
399
- * @returns {Promise<ProcessStatusResponse>} Status information about the specific process
400
- *
401
- * @example
402
- * ```typescript
403
- * const xvfbStatus = await sandbox.computerUse.getProcessStatus('xvfb');
404
- * const noVncStatus = await sandbox.computerUse.getProcessStatus('novnc');
405
- * ```
406
- */
407
- getProcessStatus(processName: string): Promise<ProcessStatusResponse>;
408
- /**
409
- * Restarts a specific VNC process
410
- *
411
- * @param {string} processName - Name of the process to restart
412
- * @returns {Promise<ProcessRestartResponse>} Process restart response
413
- *
414
- * @example
415
- * ```typescript
416
- * const result = await sandbox.computerUse.restartProcess('xfce4');
417
- * console.log('XFCE4 process restarted:', result.message);
418
- * ```
419
- */
420
- restartProcess(processName: string): Promise<ProcessRestartResponse>;
421
- /**
422
- * Gets logs for a specific VNC process
423
- *
424
- * @param {string} processName - Name of the process to get logs for
425
- * @returns {Promise<ProcessLogsResponse>} Process logs
426
- *
427
- * @example
428
- * ```typescript
429
- * const logsResp = await sandbox.computerUse.getProcessLogs('novnc');
430
- * console.log('NoVNC logs:', logsResp.logs);
431
- * ```
432
- */
433
- getProcessLogs(processName: string): Promise<ProcessLogsResponse>;
434
- /**
435
- * Gets error logs for a specific VNC process
436
- *
437
- * @param {string} processName - Name of the process to get error logs for
438
- * @returns {Promise<ProcessErrorsResponse>} Process error logs
439
- *
440
- * @example
441
- * ```typescript
442
- * const errorsResp = await sandbox.computerUse.getProcessErrors('x11vnc');
443
- * console.log('X11VNC errors:', errorsResp.errors);
444
- * ```
445
- */
446
- getProcessErrors(processName: string): Promise<ProcessErrorsResponse>;
447
- }
@@ -1,527 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2025 Daytona Platforms Inc.
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ComputerUse = exports.Display = exports.Screenshot = exports.Keyboard = exports.Mouse = void 0;
8
- /**
9
- * Mouse operations for computer use functionality
10
- */
11
- class Mouse {
12
- sandboxId;
13
- toolboxApi;
14
- constructor(sandboxId, toolboxApi) {
15
- this.sandboxId = sandboxId;
16
- this.toolboxApi = toolboxApi;
17
- }
18
- /**
19
- * Gets the current mouse cursor position
20
- *
21
- * @returns {Promise<MousePosition>} Current mouse position with x and y coordinates
22
- *
23
- * @example
24
- * ```typescript
25
- * const position = await sandbox.computerUse.mouse.getPosition();
26
- * console.log(`Mouse is at: ${position.x}, ${position.y}`);
27
- * ```
28
- */
29
- async getPosition() {
30
- const response = await this.toolboxApi.getMousePosition(this.sandboxId);
31
- return response.data;
32
- }
33
- /**
34
- * Moves the mouse cursor to the specified coordinates
35
- *
36
- * @param {number} x - The x coordinate to move to
37
- * @param {number} y - The y coordinate to move to
38
- * @returns {Promise<MouseMoveResponse>} Move operation result
39
- *
40
- * @example
41
- * ```typescript
42
- * const result = await sandbox.computerUse.mouse.move(100, 200);
43
- * console.log(`Mouse moved to: ${result.x}, ${result.y}`);
44
- * ```
45
- */
46
- async move(x, y) {
47
- const request = { x, y };
48
- const response = await this.toolboxApi.moveMouse(this.sandboxId, request);
49
- return response.data;
50
- }
51
- /**
52
- * Clicks the mouse at the specified coordinates
53
- *
54
- * @param {number} x - The x coordinate to click at
55
- * @param {number} y - The y coordinate to click at
56
- * @param {string} [button='left'] - The mouse button to click ('left', 'right', 'middle')
57
- * @param {boolean} [double=false] - Whether to perform a double-click
58
- * @returns {Promise<MouseClickResponse>} Click operation result
59
- *
60
- * @example
61
- * ```typescript
62
- * // Single left click
63
- * const result = await sandbox.computerUse.mouse.click(100, 200);
64
- *
65
- * // Double click
66
- * const doubleClick = await sandbox.computerUse.mouse.click(100, 200, 'left', true);
67
- *
68
- * // Right click
69
- * const rightClick = await sandbox.computerUse.mouse.click(100, 200, 'right');
70
- * ```
71
- */
72
- async click(x, y, button = 'left', double = false) {
73
- const request = { x, y, button, double };
74
- const response = await this.toolboxApi.clickMouse(this.sandboxId, request);
75
- return response.data;
76
- }
77
- /**
78
- * Drags the mouse from start coordinates to end coordinates
79
- *
80
- * @param {number} startX - The starting x coordinate
81
- * @param {number} startY - The starting y coordinate
82
- * @param {number} endX - The ending x coordinate
83
- * @param {number} endY - The ending y coordinate
84
- * @param {string} [button='left'] - The mouse button to use for dragging
85
- * @returns {Promise<MouseDragResponse>} Drag operation result
86
- *
87
- * @example
88
- * ```typescript
89
- * const result = await sandbox.computerUse.mouse.drag(50, 50, 150, 150);
90
- * console.log(`Dragged from ${result.from.x},${result.from.y} to ${result.to.x},${result.to.y}`);
91
- * ```
92
- */
93
- async drag(startX, startY, endX, endY, button = 'left') {
94
- const request = { startX, startY, endX, endY, button };
95
- const response = await this.toolboxApi.dragMouse(this.sandboxId, request);
96
- return response.data;
97
- }
98
- /**
99
- * Scrolls the mouse wheel at the specified coordinates
100
- *
101
- * @param {number} x - The x coordinate to scroll at
102
- * @param {number} y - The y coordinate to scroll at
103
- * @param {'up' | 'down'} direction - The direction to scroll
104
- * @param {number} [amount=1] - The amount to scroll
105
- * @returns {Promise<boolean>} Whether the scroll operation was successful
106
- *
107
- * @example
108
- * ```typescript
109
- * // Scroll up
110
- * const scrollUp = await sandbox.computerUse.mouse.scroll(100, 200, 'up', 3);
111
- *
112
- * // Scroll down
113
- * const scrollDown = await sandbox.computerUse.mouse.scroll(100, 200, 'down', 5);
114
- * ```
115
- */
116
- async scroll(x, y, direction, amount = 1) {
117
- const request = { x, y, direction, amount };
118
- const response = await this.toolboxApi.scrollMouse(this.sandboxId, request);
119
- return response.data.success;
120
- }
121
- }
122
- exports.Mouse = Mouse;
123
- /**
124
- * Keyboard operations for computer use functionality
125
- */
126
- class Keyboard {
127
- sandboxId;
128
- toolboxApi;
129
- constructor(sandboxId, toolboxApi) {
130
- this.sandboxId = sandboxId;
131
- this.toolboxApi = toolboxApi;
132
- }
133
- /**
134
- * Types the specified text
135
- *
136
- * @param {string} text - The text to type
137
- * @param {number} [delay=0] - Delay between characters in milliseconds
138
- * @throws {DaytonaError} If the type operation fails
139
- *
140
- * @example
141
- * ```typescript
142
- * try {
143
- * await sandbox.computerUse.keyboard.type('Hello, World!');
144
- * console.log('Operation success');
145
- * } catch (e) {
146
- * console.log('Operation failed:', e);
147
- * }
148
- *
149
- * // With delay between characters
150
- * try {
151
- * await sandbox.computerUse.keyboard.type('Slow typing', 100);
152
- * console.log('Operation success');
153
- * } catch (e) {
154
- * console.log('Operation failed:', e);
155
- * }
156
- * ```
157
- */
158
- async type(text, delay) {
159
- const request = { text, delay };
160
- await this.toolboxApi.typeText(this.sandboxId, request);
161
- }
162
- /**
163
- * Presses a key with optional modifiers
164
- *
165
- * @param {string} key - The key to press (e.g., 'Enter', 'Escape', 'Tab', 'a', 'A')
166
- * @param {string[]} [modifiers=[]] - Modifier keys ('ctrl', 'alt', 'meta', 'shift')
167
- * @throws {DaytonaError} If the press operation fails
168
- *
169
- * @example
170
- * ```typescript
171
- * // Press Enter
172
- * try {
173
- * await sandbox.computerUse.keyboard.press('Return');
174
- * console.log('Operation success');
175
- * } catch (e) {
176
- * console.log('Operation failed:', e);
177
- * }
178
- *
179
- * // Press Ctrl+C
180
- * try {
181
- * await sandbox.computerUse.keyboard.press('c', ['ctrl']);
182
- * console.log('Operation success');
183
- * } catch (e) {
184
- * console.log('Operation failed:', e);
185
- * }
186
- *
187
- * // Press Ctrl+Shift+T
188
- * try {
189
- * await sandbox.computerUse.keyboard.press('t', ['ctrl', 'shift']);
190
- * console.log('Operation success');
191
- * } catch (e) {
192
- * console.log('Operation failed:', e);
193
- * }
194
- * ```
195
- */
196
- async press(key, modifiers = []) {
197
- const request = { key, modifiers };
198
- await this.toolboxApi.pressKey(this.sandboxId, request);
199
- }
200
- /**
201
- * Presses a hotkey combination
202
- *
203
- * @param {string} keys - The hotkey combination (e.g., 'ctrl+c', 'alt+tab', 'cmd+shift+t')
204
- * @throws {DaytonaError} If the hotkey operation fails
205
- *
206
- * @example
207
- * ```typescript
208
- * // Copy
209
- * try {
210
- * await sandbox.computerUse.keyboard.hotkey('ctrl+c');
211
- * console.log('Operation success');
212
- * } catch (e) {
213
- * console.log('Operation failed:', e);
214
- * }
215
- *
216
- * // Paste
217
- * try {
218
- * await sandbox.computerUse.keyboard.hotkey('ctrl+v');
219
- * console.log('Operation success');
220
- * } catch (e) {
221
- * console.log('Operation failed:', e);
222
- * }
223
- *
224
- * // Alt+Tab
225
- * try {
226
- * await sandbox.computerUse.keyboard.hotkey('alt+tab');
227
- * console.log('Operation success');
228
- * } catch (e) {
229
- * console.log('Operation failed:', e);
230
- * }
231
- * ```
232
- */
233
- async hotkey(keys) {
234
- const request = { keys };
235
- await this.toolboxApi.pressHotkey(this.sandboxId, request);
236
- }
237
- }
238
- exports.Keyboard = Keyboard;
239
- /**
240
- * Screenshot operations for computer use functionality
241
- */
242
- class Screenshot {
243
- sandboxId;
244
- toolboxApi;
245
- constructor(sandboxId, toolboxApi) {
246
- this.sandboxId = sandboxId;
247
- this.toolboxApi = toolboxApi;
248
- }
249
- /**
250
- * Takes a screenshot of the entire screen
251
- *
252
- * @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
253
- * @returns {Promise<ScreenshotResponse>} Screenshot data with base64 encoded image
254
- *
255
- * @example
256
- * ```typescript
257
- * const screenshot = await sandbox.computerUse.screenshot.takeFullScreen();
258
- * console.log(`Screenshot size: ${screenshot.width}x${screenshot.height}`);
259
- *
260
- * // With cursor visible
261
- * const withCursor = await sandbox.computerUse.screenshot.takeFullScreen(true);
262
- * ```
263
- */
264
- async takeFullScreen(showCursor = false) {
265
- const response = await this.toolboxApi.takeScreenshot(this.sandboxId, undefined, showCursor);
266
- return response.data;
267
- }
268
- /**
269
- * Takes a screenshot of a specific region
270
- *
271
- * @param {ScreenshotRegion} region - The region to capture
272
- * @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
273
- * @returns {Promise<RegionScreenshotResponse>} Screenshot data with base64 encoded image
274
- *
275
- * @example
276
- * ```typescript
277
- * const region = { x: 100, y: 100, width: 300, height: 200 };
278
- * const screenshot = await sandbox.computerUse.screenshot.takeRegion(region);
279
- * console.log(`Captured region: ${screenshot.region.width}x${screenshot.region.height}`);
280
- * ```
281
- */
282
- async takeRegion(region, showCursor = false) {
283
- const response = await this.toolboxApi.takeRegionScreenshot(this.sandboxId, region.height, region.width, region.y, region.x, undefined, showCursor);
284
- return response.data;
285
- }
286
- /**
287
- * Takes a compressed screenshot of the entire screen
288
- *
289
- * @param {ScreenshotOptions} [options={}] - Compression and display options
290
- * @returns {Promise<CompressedScreenshotResponse>} Compressed screenshot data
291
- *
292
- * @example
293
- * ```typescript
294
- * // Default compression
295
- * const screenshot = await sandbox.computerUse.screenshot.takeCompressed();
296
- *
297
- * // High quality JPEG
298
- * const jpeg = await sandbox.computerUse.screenshot.takeCompressed({
299
- * format: 'jpeg',
300
- * quality: 95,
301
- * showCursor: true
302
- * });
303
- *
304
- * // Scaled down PNG
305
- * const scaled = await sandbox.computerUse.screenshot.takeCompressed({
306
- * format: 'png',
307
- * scale: 0.5
308
- * });
309
- * ```
310
- */
311
- async takeCompressed(options = {}) {
312
- const response = await this.toolboxApi.takeCompressedScreenshot(this.sandboxId, undefined, options.scale, options.quality, options.format, options.showCursor);
313
- return response.data;
314
- }
315
- /**
316
- * Takes a compressed screenshot of a specific region
317
- *
318
- * @param {ScreenshotRegion} region - The region to capture
319
- * @param {ScreenshotOptions} [options={}] - Compression and display options
320
- * @returns {Promise<CompressedScreenshotResponse>} Compressed screenshot data
321
- *
322
- * @example
323
- * ```typescript
324
- * const region = { x: 0, y: 0, width: 800, height: 600 };
325
- * const screenshot = await sandbox.computerUse.screenshot.takeCompressedRegion(region, {
326
- * format: 'webp',
327
- * quality: 80,
328
- * showCursor: true
329
- * });
330
- * console.log(`Compressed size: ${screenshot.size_bytes} bytes`);
331
- * ```
332
- */
333
- async takeCompressedRegion(region, options = {}) {
334
- const response = await this.toolboxApi.takeCompressedRegionScreenshot(this.sandboxId, region.height, region.width, region.y, region.x, undefined, options.scale, options.quality, options.format, options.showCursor);
335
- return response.data;
336
- }
337
- }
338
- exports.Screenshot = Screenshot;
339
- /**
340
- * Display operations for computer use functionality
341
- */
342
- class Display {
343
- sandboxId;
344
- toolboxApi;
345
- constructor(sandboxId, toolboxApi) {
346
- this.sandboxId = sandboxId;
347
- this.toolboxApi = toolboxApi;
348
- }
349
- /**
350
- * Gets information about the displays
351
- *
352
- * @returns {Promise<DisplayInfoResponse>} Display information including primary display and all available displays
353
- *
354
- * @example
355
- * ```typescript
356
- * const info = await sandbox.computerUse.display.getInfo();
357
- * console.log(`Primary display: ${info.primary_display.width}x${info.primary_display.height}`);
358
- * console.log(`Total displays: ${info.total_displays}`);
359
- * info.displays.forEach((display, index) => {
360
- * console.log(`Display ${index}: ${display.width}x${display.height} at ${display.x},${display.y}`);
361
- * });
362
- * ```
363
- */
364
- async getInfo() {
365
- const response = await this.toolboxApi.getDisplayInfo(this.sandboxId);
366
- return response.data;
367
- }
368
- /**
369
- * Gets the list of open windows
370
- *
371
- * @returns {Promise<WindowsResponse>} List of open windows with their IDs and titles
372
- *
373
- * @example
374
- * ```typescript
375
- * const windows = await sandbox.computerUse.display.getWindows();
376
- * console.log(`Found ${windows.count} open windows:`);
377
- * windows.windows.forEach(window => {
378
- * console.log(`- ${window.title} (ID: ${window.id})`);
379
- * });
380
- * ```
381
- */
382
- async getWindows() {
383
- const response = await this.toolboxApi.getWindows(this.sandboxId);
384
- return response.data;
385
- }
386
- }
387
- exports.Display = Display;
388
- /**
389
- * Computer Use functionality for interacting with the desktop environment.
390
- *
391
- * Provides access to mouse, keyboard, screenshot, and display operations
392
- * for automating desktop interactions within a sandbox.
393
- *
394
- * @property {Mouse} mouse - Mouse operations interface
395
- * @property {Keyboard} keyboard - Keyboard operations interface
396
- * @property {Screenshot} screenshot - Screenshot operations interface
397
- * @property {Display} display - Display operations interface
398
- *
399
- * @class
400
- */
401
- class ComputerUse {
402
- sandboxId;
403
- toolboxApi;
404
- mouse;
405
- keyboard;
406
- screenshot;
407
- display;
408
- constructor(sandboxId, toolboxApi) {
409
- this.sandboxId = sandboxId;
410
- this.toolboxApi = toolboxApi;
411
- this.mouse = new Mouse(sandboxId, toolboxApi);
412
- this.keyboard = new Keyboard(sandboxId, toolboxApi);
413
- this.screenshot = new Screenshot(sandboxId, toolboxApi);
414
- this.display = new Display(sandboxId, toolboxApi);
415
- }
416
- /**
417
- * Starts all computer use processes (Xvfb, xfce4, x11vnc, novnc)
418
- *
419
- * @returns {Promise<ComputerUseStartResponse>} Computer use start response
420
- *
421
- * @example
422
- * ```typescript
423
- * const result = await sandbox.computerUse.start();
424
- * console.log('Computer use processes started:', result.message);
425
- * ```
426
- */
427
- async start() {
428
- const response = await this.toolboxApi.startComputerUse(this.sandboxId);
429
- return response.data;
430
- }
431
- /**
432
- * Stops all computer use processes
433
- *
434
- * @returns {Promise<ComputerUseStopResponse>} Computer use stop response
435
- *
436
- * @example
437
- * ```typescript
438
- * const result = await sandbox.computerUse.stop();
439
- * console.log('Computer use processes stopped:', result.message);
440
- * ```
441
- */
442
- async stop() {
443
- const response = await this.toolboxApi.stopComputerUse(this.sandboxId);
444
- return response.data;
445
- }
446
- /**
447
- * Gets the status of all computer use processes
448
- *
449
- * @returns {Promise<ComputerUseStatusResponse>} Status information about all VNC desktop processes
450
- *
451
- * @example
452
- * ```typescript
453
- * const status = await sandbox.computerUse.getStatus();
454
- * console.log('Computer use status:', status.status);
455
- * ```
456
- */
457
- async getStatus() {
458
- const response = await this.toolboxApi.getComputerUseStatus(this.sandboxId);
459
- return response.data;
460
- }
461
- /**
462
- * Gets the status of a specific VNC process
463
- *
464
- * @param {string} processName - Name of the process to check
465
- * @returns {Promise<ProcessStatusResponse>} Status information about the specific process
466
- *
467
- * @example
468
- * ```typescript
469
- * const xvfbStatus = await sandbox.computerUse.getProcessStatus('xvfb');
470
- * const noVncStatus = await sandbox.computerUse.getProcessStatus('novnc');
471
- * ```
472
- */
473
- async getProcessStatus(processName) {
474
- const response = await this.toolboxApi.getProcessStatus(processName, this.sandboxId);
475
- return response.data;
476
- }
477
- /**
478
- * Restarts a specific VNC process
479
- *
480
- * @param {string} processName - Name of the process to restart
481
- * @returns {Promise<ProcessRestartResponse>} Process restart response
482
- *
483
- * @example
484
- * ```typescript
485
- * const result = await sandbox.computerUse.restartProcess('xfce4');
486
- * console.log('XFCE4 process restarted:', result.message);
487
- * ```
488
- */
489
- async restartProcess(processName) {
490
- const response = await this.toolboxApi.restartProcess(processName, this.sandboxId);
491
- return response.data;
492
- }
493
- /**
494
- * Gets logs for a specific VNC process
495
- *
496
- * @param {string} processName - Name of the process to get logs for
497
- * @returns {Promise<ProcessLogsResponse>} Process logs
498
- *
499
- * @example
500
- * ```typescript
501
- * const logsResp = await sandbox.computerUse.getProcessLogs('novnc');
502
- * console.log('NoVNC logs:', logsResp.logs);
503
- * ```
504
- */
505
- async getProcessLogs(processName) {
506
- const response = await this.toolboxApi.getProcessLogs(processName, this.sandboxId);
507
- return response.data;
508
- }
509
- /**
510
- * Gets error logs for a specific VNC process
511
- *
512
- * @param {string} processName - Name of the process to get error logs for
513
- * @returns {Promise<ProcessErrorsResponse>} Process error logs
514
- *
515
- * @example
516
- * ```typescript
517
- * const errorsResp = await sandbox.computerUse.getProcessErrors('x11vnc');
518
- * console.log('X11VNC errors:', errorsResp.errors);
519
- * ```
520
- */
521
- async getProcessErrors(processName) {
522
- const response = await this.toolboxApi.getProcessErrors(processName, this.sandboxId);
523
- return response.data;
524
- }
525
- }
526
- exports.ComputerUse = ComputerUse;
527
- //# sourceMappingURL=ComputerUse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComputerUse.js","sourceRoot":"","sources":["../../../../libs/sdk-typescript/src/ComputerUse.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAiDH;;GAEG;AACH,MAAa,KAAK;IAEG;IACA;IAFnB,YACmB,SAAiB,EACjB,UAAsB;QADtB,cAAS,GAAT,SAAS,CAAQ;QACjB,eAAU,GAAV,UAAU,CAAY;IACtC,CAAC;IAEJ;;;;;;;;;;OAUG;IACI,KAAK,CAAC,WAAW;QACtB,MAAM,QAAQ,GAAG,MAAM,IAAI,C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