@daytonaio/sdk 0.22.0-alpha.1 → 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.1",
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.1"
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,408 +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.actual_x}, ${result.actual_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
- * @returns {Promise<boolean>} Whether the type operation was successful
125
- *
126
- * @example
127
- * ```typescript
128
- * const result = await sandbox.computerUse.keyboard.type('Hello, World!');
129
- * console.log(`Typed: ${result.typed}`);
130
- *
131
- * // With delay between characters
132
- * const slowType = await sandbox.computerUse.keyboard.type('Slow typing', 100);
133
- * ```
134
- */
135
- type(text: string, delay?: number): Promise<boolean>;
136
- /**
137
- * Presses a key with optional modifiers
138
- *
139
- * @param {string} key - The key to press (e.g., 'Enter', 'Escape', 'Tab', 'a', 'A')
140
- * @param {string[]} [modifiers=[]] - Modifier keys ('ctrl', 'alt', 'meta', 'shift')
141
- * @returns {Promise<boolean>} Whether the press operation was successful
142
- *
143
- * @example
144
- * ```typescript
145
- * // Press Enter
146
- * const enter = await sandbox.computerUse.keyboard.press('Return');
147
- *
148
- * // Press Ctrl+C
149
- * const copy = await sandbox.computerUse.keyboard.press('c', ['ctrl']);
150
- *
151
- * // Press Ctrl+Shift+T
152
- * const newTab = await sandbox.computerUse.keyboard.press('t', ['ctrl', 'shift']);
153
- * ```
154
- */
155
- press(key: string, modifiers?: string[]): Promise<boolean>;
156
- /**
157
- * Presses a hotkey combination
158
- *
159
- * @param {string} keys - The hotkey combination (e.g., 'ctrl+c', 'alt+tab', 'cmd+shift+t')
160
- * @returns {Promise<boolean>} Whether the hotkey operation was successful
161
- *
162
- * @example
163
- * ```typescript
164
- * // Copy
165
- * const copy = await sandbox.computerUse.keyboard.hotkey('ctrl+c');
166
- *
167
- * // Paste
168
- * const paste = await sandbox.computerUse.keyboard.hotkey('ctrl+v');
169
- *
170
- * // Alt+Tab
171
- * const altTab = await sandbox.computerUse.keyboard.hotkey('alt+tab');
172
- * ```
173
- */
174
- hotkey(keys: string): Promise<boolean>;
175
- }
176
- /**
177
- * Screenshot operations for computer use functionality
178
- */
179
- export declare class Screenshot {
180
- private readonly sandboxId;
181
- private readonly toolboxApi;
182
- constructor(sandboxId: string, toolboxApi: ToolboxApi);
183
- /**
184
- * Takes a screenshot of the entire screen
185
- *
186
- * @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
187
- * @returns {Promise<ScreenshotResponse>} Screenshot data with base64 encoded image
188
- *
189
- * @example
190
- * ```typescript
191
- * const screenshot = await sandbox.computerUse.screenshot.takeFullScreen();
192
- * console.log(`Screenshot size: ${screenshot.width}x${screenshot.height}`);
193
- *
194
- * // With cursor visible
195
- * const withCursor = await sandbox.computerUse.screenshot.takeFullScreen(true);
196
- * ```
197
- */
198
- takeFullScreen(showCursor?: boolean): Promise<ScreenshotResponse>;
199
- /**
200
- * Takes a screenshot of a specific region
201
- *
202
- * @param {ScreenshotRegion} region - The region to capture
203
- * @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
204
- * @returns {Promise<RegionScreenshotResponse>} Screenshot data with base64 encoded image
205
- *
206
- * @example
207
- * ```typescript
208
- * const region = { x: 100, y: 100, width: 300, height: 200 };
209
- * const screenshot = await sandbox.computerUse.screenshot.takeRegion(region);
210
- * console.log(`Captured region: ${screenshot.region.width}x${screenshot.region.height}`);
211
- * ```
212
- */
213
- takeRegion(region: ScreenshotRegion, showCursor?: boolean): Promise<RegionScreenshotResponse>;
214
- /**
215
- * Takes a compressed screenshot of the entire screen
216
- *
217
- * @param {ScreenshotOptions} [options={}] - Compression and display options
218
- * @returns {Promise<CompressedScreenshotResponse>} Compressed screenshot data
219
- *
220
- * @example
221
- * ```typescript
222
- * // Default compression
223
- * const screenshot = await sandbox.computerUse.screenshot.takeCompressed();
224
- *
225
- * // High quality JPEG
226
- * const jpeg = await sandbox.computerUse.screenshot.takeCompressed({
227
- * format: 'jpeg',
228
- * quality: 95,
229
- * showCursor: true
230
- * });
231
- *
232
- * // Scaled down PNG
233
- * const scaled = await sandbox.computerUse.screenshot.takeCompressed({
234
- * format: 'png',
235
- * scale: 0.5
236
- * });
237
- * ```
238
- */
239
- takeCompressed(options?: ScreenshotOptions): Promise<CompressedScreenshotResponse>;
240
- /**
241
- * Takes a compressed screenshot of a specific region
242
- *
243
- * @param {ScreenshotRegion} region - The region to capture
244
- * @param {ScreenshotOptions} [options={}] - Compression and display options
245
- * @returns {Promise<CompressedScreenshotResponse>} Compressed screenshot data
246
- *
247
- * @example
248
- * ```typescript
249
- * const region = { x: 0, y: 0, width: 800, height: 600 };
250
- * const screenshot = await sandbox.computerUse.screenshot.takeCompressedRegion(region, {
251
- * format: 'webp',
252
- * quality: 80,
253
- * showCursor: true
254
- * });
255
- * console.log(`Compressed size: ${screenshot.size_bytes} bytes`);
256
- * ```
257
- */
258
- takeCompressedRegion(region: ScreenshotRegion, options?: ScreenshotOptions): Promise<CompressedScreenshotResponse>;
259
- }
260
- /**
261
- * Display operations for computer use functionality
262
- */
263
- export declare class Display {
264
- private readonly sandboxId;
265
- private readonly toolboxApi;
266
- constructor(sandboxId: string, toolboxApi: ToolboxApi);
267
- /**
268
- * Gets information about the displays
269
- *
270
- * @returns {Promise<DisplayInfoResponse>} Display information including primary display and all available displays
271
- *
272
- * @example
273
- * ```typescript
274
- * const info = await sandbox.computerUse.display.getInfo();
275
- * console.log(`Primary display: ${info.primary_display.width}x${info.primary_display.height}`);
276
- * console.log(`Total displays: ${info.total_displays}`);
277
- * info.displays.forEach((display, index) => {
278
- * console.log(`Display ${index}: ${display.width}x${display.height} at ${display.x},${display.y}`);
279
- * });
280
- * ```
281
- */
282
- getInfo(): Promise<DisplayInfoResponse>;
283
- /**
284
- * Gets the list of open windows
285
- *
286
- * @returns {Promise<WindowsResponse>} List of open windows with their IDs and titles
287
- *
288
- * @example
289
- * ```typescript
290
- * const windows = await sandbox.computerUse.display.getWindows();
291
- * console.log(`Found ${windows.count} open windows:`);
292
- * windows.windows.forEach(window => {
293
- * console.log(`- ${window.title} (ID: ${window.id})`);
294
- * });
295
- * ```
296
- */
297
- getWindows(): Promise<WindowsResponse>;
298
- }
299
- /**
300
- * Computer Use functionality for interacting with the desktop environment.
301
- *
302
- * Provides access to mouse, keyboard, screenshot, and display operations
303
- * for automating desktop interactions within a sandbox.
304
- *
305
- * @property {Mouse} mouse - Mouse operations interface
306
- * @property {Keyboard} keyboard - Keyboard operations interface
307
- * @property {Screenshot} screenshot - Screenshot operations interface
308
- * @property {Display} display - Display operations interface
309
- *
310
- * @class
311
- */
312
- export declare class ComputerUse {
313
- private readonly sandboxId;
314
- private readonly toolboxApi;
315
- readonly mouse: Mouse;
316
- readonly keyboard: Keyboard;
317
- readonly screenshot: Screenshot;
318
- readonly display: Display;
319
- constructor(sandboxId: string, toolboxApi: ToolboxApi);
320
- /**
321
- * Starts all computer use processes (Xvfb, xfce4, x11vnc, novnc)
322
- *
323
- * @returns {Promise<ComputerUseStartResponse>} Computer use start response
324
- *
325
- * @example
326
- * ```typescript
327
- * const result = await sandbox.computerUse.start();
328
- * console.log('Computer use processes started:', result.message);
329
- * ```
330
- */
331
- start(): Promise<ComputerUseStartResponse>;
332
- /**
333
- * Stops all computer use processes
334
- *
335
- * @returns {Promise<ComputerUseStopResponse>} Computer use stop response
336
- *
337
- * @example
338
- * ```typescript
339
- * const result = await sandbox.computerUse.stop();
340
- * console.log('Computer use processes stopped:', result.message);
341
- * ```
342
- */
343
- stop(): Promise<ComputerUseStopResponse>;
344
- /**
345
- * Gets the status of all computer use processes
346
- *
347
- * @returns {Promise<ComputerUseStatusResponse>} Status information about all VNC desktop processes
348
- *
349
- * @example
350
- * ```typescript
351
- * const status = await sandbox.computerUse.getStatus();
352
- * console.log('Computer use status:', status.status);
353
- * ```
354
- */
355
- getStatus(): Promise<ComputerUseStatusResponse>;
356
- /**
357
- * Gets the status of a specific VNC process
358
- *
359
- * @param {string} processName - Name of the process to check
360
- * @returns {Promise<ProcessStatusResponse>} Status information about the specific process
361
- *
362
- * @example
363
- * ```typescript
364
- * const xvfbStatus = await sandbox.computerUse.getProcessStatus('xvfb');
365
- * const noVncStatus = await sandbox.computerUse.getProcessStatus('novnc');
366
- * ```
367
- */
368
- getProcessStatus(processName: string): Promise<ProcessStatusResponse>;
369
- /**
370
- * Restarts a specific VNC process
371
- *
372
- * @param {string} processName - Name of the process to restart
373
- * @returns {Promise<ProcessRestartResponse>} Process restart response
374
- *
375
- * @example
376
- * ```typescript
377
- * const result = await sandbox.computerUse.restartProcess('xfce4');
378
- * console.log('XFCE4 process restarted:', result.message);
379
- * ```
380
- */
381
- restartProcess(processName: string): Promise<ProcessRestartResponse>;
382
- /**
383
- * Gets logs for a specific VNC process
384
- *
385
- * @param {string} processName - Name of the process to get logs for
386
- * @returns {Promise<ProcessLogsResponse>} Process logs
387
- *
388
- * @example
389
- * ```typescript
390
- * const logsResp = await sandbox.computerUse.getProcessLogs('novnc');
391
- * console.log('NoVNC logs:', logsResp.logs);
392
- * ```
393
- */
394
- getProcessLogs(processName: string): Promise<ProcessLogsResponse>;
395
- /**
396
- * Gets error logs for a specific VNC process
397
- *
398
- * @param {string} processName - Name of the process to get error logs for
399
- * @returns {Promise<ProcessErrorsResponse>} Process error logs
400
- *
401
- * @example
402
- * ```typescript
403
- * const errorsResp = await sandbox.computerUse.getProcessErrors('x11vnc');
404
- * console.log('X11VNC errors:', errorsResp.errors);
405
- * ```
406
- */
407
- getProcessErrors(processName: string): Promise<ProcessErrorsResponse>;
408
- }
@@ -1,491 +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.actual_x}, ${result.actual_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
- * @returns {Promise<boolean>} Whether the type operation was successful
139
- *
140
- * @example
141
- * ```typescript
142
- * const result = await sandbox.computerUse.keyboard.type('Hello, World!');
143
- * console.log(`Typed: ${result.typed}`);
144
- *
145
- * // With delay between characters
146
- * const slowType = await sandbox.computerUse.keyboard.type('Slow typing', 100);
147
- * ```
148
- */
149
- async type(text, delay) {
150
- const request = { text, delay };
151
- const response = await this.toolboxApi.typeText(this.sandboxId, request);
152
- return response.data.success;
153
- }
154
- /**
155
- * Presses a key with optional modifiers
156
- *
157
- * @param {string} key - The key to press (e.g., 'Enter', 'Escape', 'Tab', 'a', 'A')
158
- * @param {string[]} [modifiers=[]] - Modifier keys ('ctrl', 'alt', 'meta', 'shift')
159
- * @returns {Promise<boolean>} Whether the press operation was successful
160
- *
161
- * @example
162
- * ```typescript
163
- * // Press Enter
164
- * const enter = await sandbox.computerUse.keyboard.press('Return');
165
- *
166
- * // Press Ctrl+C
167
- * const copy = await sandbox.computerUse.keyboard.press('c', ['ctrl']);
168
- *
169
- * // Press Ctrl+Shift+T
170
- * const newTab = await sandbox.computerUse.keyboard.press('t', ['ctrl', 'shift']);
171
- * ```
172
- */
173
- async press(key, modifiers = []) {
174
- const request = { key, modifiers };
175
- const response = await this.toolboxApi.pressKey(this.sandboxId, request);
176
- return response.data.success;
177
- }
178
- /**
179
- * Presses a hotkey combination
180
- *
181
- * @param {string} keys - The hotkey combination (e.g., 'ctrl+c', 'alt+tab', 'cmd+shift+t')
182
- * @returns {Promise<boolean>} Whether the hotkey operation was successful
183
- *
184
- * @example
185
- * ```typescript
186
- * // Copy
187
- * const copy = await sandbox.computerUse.keyboard.hotkey('ctrl+c');
188
- *
189
- * // Paste
190
- * const paste = await sandbox.computerUse.keyboard.hotkey('ctrl+v');
191
- *
192
- * // Alt+Tab
193
- * const altTab = await sandbox.computerUse.keyboard.hotkey('alt+tab');
194
- * ```
195
- */
196
- async hotkey(keys) {
197
- const request = { keys };
198
- const response = await this.toolboxApi.pressHotkey(this.sandboxId, request);
199
- return response.data.success;
200
- }
201
- }
202
- exports.Keyboard = Keyboard;
203
- /**
204
- * Screenshot operations for computer use functionality
205
- */
206
- class Screenshot {
207
- sandboxId;
208
- toolboxApi;
209
- constructor(sandboxId, toolboxApi) {
210
- this.sandboxId = sandboxId;
211
- this.toolboxApi = toolboxApi;
212
- }
213
- /**
214
- * Takes a screenshot of the entire screen
215
- *
216
- * @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
217
- * @returns {Promise<ScreenshotResponse>} Screenshot data with base64 encoded image
218
- *
219
- * @example
220
- * ```typescript
221
- * const screenshot = await sandbox.computerUse.screenshot.takeFullScreen();
222
- * console.log(`Screenshot size: ${screenshot.width}x${screenshot.height}`);
223
- *
224
- * // With cursor visible
225
- * const withCursor = await sandbox.computerUse.screenshot.takeFullScreen(true);
226
- * ```
227
- */
228
- async takeFullScreen(showCursor = false) {
229
- const response = await this.toolboxApi.takeScreenshot(this.sandboxId, undefined, showCursor);
230
- return response.data;
231
- }
232
- /**
233
- * Takes a screenshot of a specific region
234
- *
235
- * @param {ScreenshotRegion} region - The region to capture
236
- * @param {boolean} [showCursor=false] - Whether to show the cursor in the screenshot
237
- * @returns {Promise<RegionScreenshotResponse>} Screenshot data with base64 encoded image
238
- *
239
- * @example
240
- * ```typescript
241
- * const region = { x: 100, y: 100, width: 300, height: 200 };
242
- * const screenshot = await sandbox.computerUse.screenshot.takeRegion(region);
243
- * console.log(`Captured region: ${screenshot.region.width}x${screenshot.region.height}`);
244
- * ```
245
- */
246
- async takeRegion(region, showCursor = false) {
247
- const response = await this.toolboxApi.takeRegionScreenshot(this.sandboxId, region.height, region.width, region.y, region.x, undefined, showCursor);
248
- return response.data;
249
- }
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
- async takeCompressed(options = {}) {
276
- const response = await this.toolboxApi.takeCompressedScreenshot(this.sandboxId, undefined, options.scale, options.quality, options.format, options.showCursor);
277
- return response.data;
278
- }
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
- async takeCompressedRegion(region, options = {}) {
298
- 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);
299
- return response.data;
300
- }
301
- }
302
- exports.Screenshot = Screenshot;
303
- /**
304
- * Display operations for computer use functionality
305
- */
306
- class Display {
307
- sandboxId;
308
- toolboxApi;
309
- constructor(sandboxId, toolboxApi) {
310
- this.sandboxId = sandboxId;
311
- this.toolboxApi = toolboxApi;
312
- }
313
- /**
314
- * Gets information about the displays
315
- *
316
- * @returns {Promise<DisplayInfoResponse>} Display information including primary display and all available displays
317
- *
318
- * @example
319
- * ```typescript
320
- * const info = await sandbox.computerUse.display.getInfo();
321
- * console.log(`Primary display: ${info.primary_display.width}x${info.primary_display.height}`);
322
- * console.log(`Total displays: ${info.total_displays}`);
323
- * info.displays.forEach((display, index) => {
324
- * console.log(`Display ${index}: ${display.width}x${display.height} at ${display.x},${display.y}`);
325
- * });
326
- * ```
327
- */
328
- async getInfo() {
329
- const response = await this.toolboxApi.getDisplayInfo(this.sandboxId);
330
- return response.data;
331
- }
332
- /**
333
- * Gets the list of open windows
334
- *
335
- * @returns {Promise<WindowsResponse>} List of open windows with their IDs and titles
336
- *
337
- * @example
338
- * ```typescript
339
- * const windows = await sandbox.computerUse.display.getWindows();
340
- * console.log(`Found ${windows.count} open windows:`);
341
- * windows.windows.forEach(window => {
342
- * console.log(`- ${window.title} (ID: ${window.id})`);
343
- * });
344
- * ```
345
- */
346
- async getWindows() {
347
- const response = await this.toolboxApi.getWindows(this.sandboxId);
348
- return response.data;
349
- }
350
- }
351
- exports.Display = Display;
352
- /**
353
- * Computer Use functionality for interacting with the desktop environment.
354
- *
355
- * Provides access to mouse, keyboard, screenshot, and display operations
356
- * for automating desktop interactions within a sandbox.
357
- *
358
- * @property {Mouse} mouse - Mouse operations interface
359
- * @property {Keyboard} keyboard - Keyboard operations interface
360
- * @property {Screenshot} screenshot - Screenshot operations interface
361
- * @property {Display} display - Display operations interface
362
- *
363
- * @class
364
- */
365
- class ComputerUse {
366
- sandboxId;
367
- toolboxApi;
368
- mouse;
369
- keyboard;
370
- screenshot;
371
- display;
372
- constructor(sandboxId, toolboxApi) {
373
- this.sandboxId = sandboxId;
374
- this.toolboxApi = toolboxApi;
375
- this.mouse = new Mouse(sandboxId, toolboxApi);
376
- this.keyboard = new Keyboard(sandboxId, toolboxApi);
377
- this.screenshot = new Screenshot(sandboxId, toolboxApi);
378
- this.display = new Display(sandboxId, toolboxApi);
379
- }
380
- /**
381
- * Starts all computer use processes (Xvfb, xfce4, x11vnc, novnc)
382
- *
383
- * @returns {Promise<ComputerUseStartResponse>} Computer use start response
384
- *
385
- * @example
386
- * ```typescript
387
- * const result = await sandbox.computerUse.start();
388
- * console.log('Computer use processes started:', result.message);
389
- * ```
390
- */
391
- async start() {
392
- const response = await this.toolboxApi.startComputerUse(this.sandboxId);
393
- return response.data;
394
- }
395
- /**
396
- * Stops all computer use processes
397
- *
398
- * @returns {Promise<ComputerUseStopResponse>} Computer use stop response
399
- *
400
- * @example
401
- * ```typescript
402
- * const result = await sandbox.computerUse.stop();
403
- * console.log('Computer use processes stopped:', result.message);
404
- * ```
405
- */
406
- async stop() {
407
- const response = await this.toolboxApi.stopComputerUse(this.sandboxId);
408
- return response.data;
409
- }
410
- /**
411
- * Gets the status of all computer use processes
412
- *
413
- * @returns {Promise<ComputerUseStatusResponse>} Status information about all VNC desktop processes
414
- *
415
- * @example
416
- * ```typescript
417
- * const status = await sandbox.computerUse.getStatus();
418
- * console.log('Computer use status:', status.status);
419
- * ```
420
- */
421
- async getStatus() {
422
- const response = await this.toolboxApi.getComputerUseStatus(this.sandboxId);
423
- return response.data;
424
- }
425
- /**
426
- * Gets the status of a specific VNC process
427
- *
428
- * @param {string} processName - Name of the process to check
429
- * @returns {Promise<ProcessStatusResponse>} Status information about the specific process
430
- *
431
- * @example
432
- * ```typescript
433
- * const xvfbStatus = await sandbox.computerUse.getProcessStatus('xvfb');
434
- * const noVncStatus = await sandbox.computerUse.getProcessStatus('novnc');
435
- * ```
436
- */
437
- async getProcessStatus(processName) {
438
- const response = await this.toolboxApi.getProcessStatus(processName, this.sandboxId);
439
- return response.data;
440
- }
441
- /**
442
- * Restarts a specific VNC process
443
- *
444
- * @param {string} processName - Name of the process to restart
445
- * @returns {Promise<ProcessRestartResponse>} Process restart response
446
- *
447
- * @example
448
- * ```typescript
449
- * const result = await sandbox.computerUse.restartProcess('xfce4');
450
- * console.log('XFCE4 process restarted:', result.message);
451
- * ```
452
- */
453
- async restartProcess(processName) {
454
- const response = await this.toolboxApi.restartProcess(processName, this.sandboxId);
455
- return response.data;
456
- }
457
- /**
458
- * Gets logs for a specific VNC process
459
- *
460
- * @param {string} processName - Name of the process to get logs for
461
- * @returns {Promise<ProcessLogsResponse>} Process logs
462
- *
463
- * @example
464
- * ```typescript
465
- * const logsResp = await sandbox.computerUse.getProcessLogs('novnc');
466
- * console.log('NoVNC logs:', logsResp.logs);
467
- * ```
468
- */
469
- async getProcessLogs(processName) {
470
- const response = await this.toolboxApi.getProcessLogs(processName, this.sandboxId);
471
- return response.data;
472
- }
473
- /**
474
- * Gets error logs for a specific VNC process
475
- *
476
- * @param {string} processName - Name of the process to get error logs for
477
- * @returns {Promise<ProcessErrorsResponse>} Process error logs
478
- *
479
- * @example
480
- * ```typescript
481
- * const errorsResp = await sandbox.computerUse.getProcessErrors('x11vnc');
482
- * console.log('X11VNC errors:', errorsResp.errors);
483
- * ```
484
- */
485
- async getProcessErrors(processName) {
486
- const response = await this.toolboxApi.getProcessErrors(processName, this.sandboxId);
487
- return response.data;
488
- }
489
- }
490
- exports.ComputerUse = ComputerUse;
491
- //# 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,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACvE,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,KAAK,CAAC,IAAI,CAAC,CAAS,EAAE,CAAS;QACpC,MAAM,OAAO,GAAqB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;QAC1C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;QACzE,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACI,KAAK,CAAC,KAAK,CAAC,CAAS,EAAE,CAAS,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,GAAG,KAAK;QACtE,MAAM,OAAO,GAAsB,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;QAC3D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;QAC1E,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACI,KAAK,CAAC,IAAI,CACf,MAAc,EACd,MAAc,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