@daytonaio/sdk 0.128.0-alpha.1 → 0.128.0

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