@daytonaio/sdk 0.127.0 → 0.128.0-alpha.1

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/LICENSE +190 -0
  2. package/{src → cjs}/CodeInterpreter.d.ts +1 -0
  3. package/cjs/CodeInterpreter.d.ts.map +1 -0
  4. package/cjs/CodeInterpreter.js.map +1 -0
  5. package/{src → cjs}/ComputerUse.d.ts +1 -0
  6. package/cjs/ComputerUse.d.ts.map +1 -0
  7. package/cjs/ComputerUse.js.map +1 -0
  8. package/{src → cjs}/Daytona.d.ts +1 -0
  9. package/cjs/Daytona.d.ts.map +1 -0
  10. package/{src → cjs}/Daytona.js +1 -0
  11. package/cjs/Daytona.js.map +1 -0
  12. package/{src → cjs}/FileSystem.d.ts +1 -0
  13. package/cjs/FileSystem.d.ts.map +1 -0
  14. package/cjs/FileSystem.js.map +1 -0
  15. package/{src → cjs}/Git.d.ts +1 -0
  16. package/cjs/Git.d.ts.map +1 -0
  17. package/cjs/Git.js.map +1 -0
  18. package/{src → cjs}/Image.d.ts +21 -0
  19. package/cjs/Image.d.ts.map +1 -0
  20. package/{src → cjs}/Image.js +123 -91
  21. package/cjs/Image.js.map +1 -0
  22. package/{src → cjs}/LspServer.d.ts +1 -0
  23. package/cjs/LspServer.d.ts.map +1 -0
  24. package/cjs/LspServer.js.map +1 -0
  25. package/{src → cjs}/ObjectStorage.d.ts +1 -0
  26. package/cjs/ObjectStorage.d.ts.map +1 -0
  27. package/cjs/ObjectStorage.js.map +1 -0
  28. package/{src → cjs}/Process.d.ts +1 -0
  29. package/cjs/Process.d.ts.map +1 -0
  30. package/cjs/Process.js.map +1 -0
  31. package/{src → cjs}/PtyHandle.d.ts +1 -0
  32. package/cjs/PtyHandle.d.ts.map +1 -0
  33. package/cjs/PtyHandle.js.map +1 -0
  34. package/cjs/README.md +147 -0
  35. package/{src → cjs}/Sandbox.d.ts +2 -17
  36. package/cjs/Sandbox.d.ts.map +1 -0
  37. package/{src → cjs}/Sandbox.js +1 -27
  38. package/cjs/Sandbox.js.map +1 -0
  39. package/{src → cjs}/Snapshot.d.ts +2 -0
  40. package/cjs/Snapshot.d.ts.map +1 -0
  41. package/{src → cjs}/Snapshot.js +9 -1
  42. package/cjs/Snapshot.js.map +1 -0
  43. package/{src → cjs}/Volume.d.ts +1 -0
  44. package/cjs/Volume.d.ts.map +1 -0
  45. package/cjs/Volume.js.map +1 -0
  46. package/{src → cjs}/code-toolbox/SandboxJsCodeToolbox.d.ts +1 -0
  47. package/cjs/code-toolbox/SandboxJsCodeToolbox.d.ts.map +1 -0
  48. package/cjs/code-toolbox/SandboxJsCodeToolbox.js.map +1 -0
  49. package/{src → cjs}/code-toolbox/SandboxPythonCodeToolbox.d.ts +1 -0
  50. package/cjs/code-toolbox/SandboxPythonCodeToolbox.d.ts.map +1 -0
  51. package/cjs/code-toolbox/SandboxPythonCodeToolbox.js.map +1 -0
  52. package/{src → cjs}/code-toolbox/SandboxTsCodeToolbox.d.ts +1 -0
  53. package/cjs/code-toolbox/SandboxTsCodeToolbox.d.ts.map +1 -0
  54. package/cjs/code-toolbox/SandboxTsCodeToolbox.js.map +1 -0
  55. package/{src → cjs}/errors/DaytonaError.d.ts +1 -0
  56. package/cjs/errors/DaytonaError.d.ts.map +1 -0
  57. package/cjs/errors/DaytonaError.js.map +1 -0
  58. package/{src → cjs}/index.d.ts +1 -0
  59. package/cjs/index.d.ts.map +1 -0
  60. package/cjs/index.js.map +1 -0
  61. package/cjs/package.json +3 -0
  62. package/{src → cjs}/types/Charts.d.ts +1 -0
  63. package/cjs/types/Charts.d.ts.map +1 -0
  64. package/cjs/types/Charts.js.map +1 -0
  65. package/{src → cjs}/types/CodeInterpreter.d.ts +1 -0
  66. package/cjs/types/CodeInterpreter.d.ts.map +1 -0
  67. package/cjs/types/CodeInterpreter.js.map +1 -0
  68. package/{src → cjs}/types/ExecuteResponse.d.ts +1 -0
  69. package/cjs/types/ExecuteResponse.d.ts.map +1 -0
  70. package/cjs/types/ExecuteResponse.js.map +1 -0
  71. package/{src → cjs}/types/Pty.d.ts +1 -0
  72. package/cjs/types/Pty.d.ts.map +1 -0
  73. package/cjs/types/Pty.js.map +1 -0
  74. package/{src → cjs}/utils/ArtifactParser.d.ts +1 -0
  75. package/cjs/utils/ArtifactParser.d.ts.map +1 -0
  76. package/cjs/utils/ArtifactParser.js.map +1 -0
  77. package/{src → cjs}/utils/Binary.d.ts +1 -0
  78. package/cjs/utils/Binary.d.ts.map +1 -0
  79. package/cjs/utils/Binary.js.map +1 -0
  80. package/{src → cjs}/utils/FileTransfer.d.ts +1 -0
  81. package/cjs/utils/FileTransfer.d.ts.map +1 -0
  82. package/cjs/utils/FileTransfer.js.map +1 -0
  83. package/{src → cjs}/utils/Import.d.ts +2 -15
  84. package/cjs/utils/Import.d.ts.map +1 -0
  85. package/cjs/utils/Import.js +81 -0
  86. package/cjs/utils/Import.js.map +1 -0
  87. package/{src → cjs}/utils/Multipart.d.ts +1 -0
  88. package/cjs/utils/Multipart.d.ts.map +1 -0
  89. package/cjs/utils/Multipart.js.map +1 -0
  90. package/{src → cjs}/utils/Runtime.d.ts +1 -0
  91. package/cjs/utils/Runtime.d.ts.map +1 -0
  92. package/cjs/utils/Runtime.js.map +1 -0
  93. package/{src → cjs}/utils/Stream.d.ts +1 -0
  94. package/cjs/utils/Stream.d.ts.map +1 -0
  95. package/cjs/utils/Stream.js.map +1 -0
  96. package/{src → cjs}/utils/WebSocket.d.ts +1 -0
  97. package/cjs/utils/WebSocket.d.ts.map +1 -0
  98. package/cjs/utils/WebSocket.js.map +1 -0
  99. package/esm/CodeInterpreter.d.ts +96 -0
  100. package/esm/CodeInterpreter.d.ts.map +1 -0
  101. package/esm/CodeInterpreter.js +295 -0
  102. package/esm/CodeInterpreter.js.map +1 -0
  103. package/esm/ComputerUse.d.ts +443 -0
  104. package/esm/ComputerUse.d.ts.map +1 -0
  105. package/esm/ComputerUse.js +509 -0
  106. package/esm/ComputerUse.js.map +1 -0
  107. package/esm/Daytona.d.ts +354 -0
  108. package/esm/Daytona.d.ts.map +1 -0
  109. package/esm/Daytona.js +410 -0
  110. package/esm/Daytona.js.map +1 -0
  111. package/esm/FileSystem.d.ts +328 -0
  112. package/esm/FileSystem.d.ts.map +1 -0
  113. package/esm/FileSystem.js +331 -0
  114. package/esm/FileSystem.js.map +1 -0
  115. package/esm/Git.d.ts +203 -0
  116. package/esm/Git.d.ts.map +1 -0
  117. package/esm/Git.js +260 -0
  118. package/esm/Git.js.map +1 -0
  119. package/esm/Image.d.ts +285 -0
  120. package/esm/Image.d.ts.map +1 -0
  121. package/esm/Image.js +569 -0
  122. package/esm/Image.js.map +1 -0
  123. package/esm/LspServer.d.ts +172 -0
  124. package/esm/LspServer.d.ts.map +1 -0
  125. package/esm/LspServer.js +204 -0
  126. package/esm/LspServer.js.map +1 -0
  127. package/esm/ObjectStorage.d.ts +79 -0
  128. package/esm/ObjectStorage.d.ts.map +1 -0
  129. package/esm/ObjectStorage.js +187 -0
  130. package/esm/ObjectStorage.js.map +1 -0
  131. package/esm/Process.d.ts +442 -0
  132. package/esm/Process.d.ts.map +1 -0
  133. package/esm/Process.js +644 -0
  134. package/esm/Process.js.map +1 -0
  135. package/esm/PtyHandle.d.ts +155 -0
  136. package/esm/PtyHandle.d.ts.map +1 -0
  137. package/esm/PtyHandle.js +374 -0
  138. package/esm/PtyHandle.js.map +1 -0
  139. package/esm/README.md +147 -0
  140. package/esm/Sandbox.d.ts +359 -0
  141. package/esm/Sandbox.d.ts.map +1 -0
  142. package/esm/Sandbox.js +532 -0
  143. package/esm/Sandbox.js.map +1 -0
  144. package/esm/Snapshot.d.ts +138 -0
  145. package/esm/Snapshot.d.ts.map +1 -0
  146. package/esm/Snapshot.js +207 -0
  147. package/esm/Snapshot.js.map +1 -0
  148. package/esm/Volume.d.ts +84 -0
  149. package/esm/Volume.d.ts.map +1 -0
  150. package/esm/Volume.js +95 -0
  151. package/esm/Volume.js.map +1 -0
  152. package/esm/code-toolbox/SandboxJsCodeToolbox.d.ts +6 -0
  153. package/esm/code-toolbox/SandboxJsCodeToolbox.d.ts.map +1 -0
  154. package/esm/code-toolbox/SandboxJsCodeToolbox.js +13 -0
  155. package/esm/code-toolbox/SandboxJsCodeToolbox.js.map +1 -0
  156. package/esm/code-toolbox/SandboxPythonCodeToolbox.d.ts +12 -0
  157. package/esm/code-toolbox/SandboxPythonCodeToolbox.d.ts.map +1 -0
  158. package/esm/code-toolbox/SandboxPythonCodeToolbox.js +355 -0
  159. package/esm/code-toolbox/SandboxPythonCodeToolbox.js.map +1 -0
  160. package/esm/code-toolbox/SandboxTsCodeToolbox.d.ts +6 -0
  161. package/esm/code-toolbox/SandboxTsCodeToolbox.d.ts.map +1 -0
  162. package/esm/code-toolbox/SandboxTsCodeToolbox.js +14 -0
  163. package/esm/code-toolbox/SandboxTsCodeToolbox.js.map +1 -0
  164. package/esm/errors/DaytonaError.d.ts +32 -0
  165. package/esm/errors/DaytonaError.d.ts.map +1 -0
  166. package/esm/errors/DaytonaError.js +44 -0
  167. package/esm/errors/DaytonaError.js.map +1 -0
  168. package/esm/index.d.ts +22 -0
  169. package/esm/index.d.ts.map +1 -0
  170. package/esm/index.js +22 -0
  171. package/esm/index.js.map +1 -0
  172. package/esm/package.json +3 -0
  173. package/esm/types/Charts.d.ts +152 -0
  174. package/esm/types/Charts.d.ts.map +1 -0
  175. package/esm/types/Charts.js +42 -0
  176. package/esm/types/Charts.js.map +1 -0
  177. package/esm/types/CodeInterpreter.d.ts +77 -0
  178. package/esm/types/CodeInterpreter.d.ts.map +1 -0
  179. package/esm/types/CodeInterpreter.js +6 -0
  180. package/esm/types/CodeInterpreter.js.map +1 -0
  181. package/esm/types/ExecuteResponse.d.ts +26 -0
  182. package/esm/types/ExecuteResponse.d.ts.map +1 -0
  183. package/esm/types/ExecuteResponse.js +6 -0
  184. package/esm/types/ExecuteResponse.js.map +1 -0
  185. package/esm/types/Pty.d.ts +48 -0
  186. package/esm/types/Pty.d.ts.map +1 -0
  187. package/esm/types/Pty.js +6 -0
  188. package/esm/types/Pty.js.map +1 -0
  189. package/esm/utils/ArtifactParser.d.ts +14 -0
  190. package/esm/utils/ArtifactParser.d.ts.map +1 -0
  191. package/esm/utils/ArtifactParser.js +51 -0
  192. package/esm/utils/ArtifactParser.js.map +1 -0
  193. package/esm/utils/Binary.d.ts +39 -0
  194. package/esm/utils/Binary.d.ts.map +1 -0
  195. package/esm/utils/Binary.js +157 -0
  196. package/esm/utils/Binary.js.map +1 -0
  197. package/esm/utils/FileTransfer.d.ts +15 -0
  198. package/esm/utils/FileTransfer.d.ts.map +1 -0
  199. package/esm/utils/FileTransfer.js +209 -0
  200. package/esm/utils/FileTransfer.js.map +1 -0
  201. package/esm/utils/Import.d.ts +211 -0
  202. package/esm/utils/Import.d.ts.map +1 -0
  203. package/esm/utils/Import.js +45 -0
  204. package/esm/utils/Import.js.map +1 -0
  205. package/esm/utils/Multipart.d.ts +27 -0
  206. package/esm/utils/Multipart.d.ts.map +1 -0
  207. package/esm/utils/Multipart.js +107 -0
  208. package/esm/utils/Multipart.js.map +1 -0
  209. package/esm/utils/Runtime.d.ts +37 -0
  210. package/esm/utils/Runtime.d.ts.map +1 -0
  211. package/esm/utils/Runtime.js +57 -0
  212. package/esm/utils/Runtime.js.map +1 -0
  213. package/esm/utils/Stream.d.ts +20 -0
  214. package/esm/utils/Stream.d.ts.map +1 -0
  215. package/esm/utils/Stream.js +360 -0
  216. package/esm/utils/Stream.js.map +1 -0
  217. package/esm/utils/WebSocket.d.ts +10 -0
  218. package/esm/utils/WebSocket.d.ts.map +1 -0
  219. package/esm/utils/WebSocket.js +22 -0
  220. package/esm/utils/WebSocket.js.map +1 -0
  221. package/package.json +20 -8
  222. package/src/CodeInterpreter.js.map +0 -1
  223. package/src/ComputerUse.js.map +0 -1
  224. package/src/Daytona.js.map +0 -1
  225. package/src/FileSystem.js.map +0 -1
  226. package/src/Git.js.map +0 -1
  227. package/src/Image.js.map +0 -1
  228. package/src/LspServer.js.map +0 -1
  229. package/src/ObjectStorage.js.map +0 -1
  230. package/src/Process.js.map +0 -1
  231. package/src/PtyHandle.js.map +0 -1
  232. package/src/Sandbox.js.map +0 -1
  233. package/src/Snapshot.js.map +0 -1
  234. package/src/Volume.js.map +0 -1
  235. package/src/code-toolbox/SandboxJsCodeToolbox.js.map +0 -1
  236. package/src/code-toolbox/SandboxPythonCodeToolbox.js.map +0 -1
  237. package/src/code-toolbox/SandboxTsCodeToolbox.js.map +0 -1
  238. package/src/errors/DaytonaError.js.map +0 -1
  239. package/src/index.js.map +0 -1
  240. package/src/types/Charts.js.map +0 -1
  241. package/src/types/CodeInterpreter.js.map +0 -1
  242. package/src/types/ExecuteResponse.js.map +0 -1
  243. package/src/types/Pty.js.map +0 -1
  244. package/src/utils/ArtifactParser.js.map +0 -1
  245. package/src/utils/Binary.js.map +0 -1
  246. package/src/utils/FileTransfer.js.map +0 -1
  247. package/src/utils/Import.js +0 -77
  248. package/src/utils/Import.js.map +0 -1
  249. package/src/utils/Multipart.js.map +0 -1
  250. package/src/utils/Runtime.js.map +0 -1
  251. package/src/utils/Stream.js.map +0 -1
  252. package/src/utils/WebSocket.js.map +0 -1
  253. /package/{src → cjs}/CodeInterpreter.js +0 -0
  254. /package/{src → cjs}/ComputerUse.js +0 -0
  255. /package/{src → cjs}/FileSystem.js +0 -0
  256. /package/{src → cjs}/Git.js +0 -0
  257. /package/{src → cjs}/LspServer.js +0 -0
  258. /package/{src → cjs}/ObjectStorage.js +0 -0
  259. /package/{src → cjs}/Process.js +0 -0
  260. /package/{src → cjs}/PtyHandle.js +0 -0
  261. /package/{src → cjs}/Volume.js +0 -0
  262. /package/{src → cjs}/code-toolbox/SandboxJsCodeToolbox.js +0 -0
  263. /package/{src → cjs}/code-toolbox/SandboxPythonCodeToolbox.js +0 -0
  264. /package/{src → cjs}/code-toolbox/SandboxTsCodeToolbox.js +0 -0
  265. /package/{src → cjs}/errors/DaytonaError.js +0 -0
  266. /package/{src → cjs}/index.js +0 -0
  267. /package/{src → cjs}/types/Charts.js +0 -0
  268. /package/{src → cjs}/types/CodeInterpreter.js +0 -0
  269. /package/{src → cjs}/types/ExecuteResponse.js +0 -0
  270. /package/{src → cjs}/types/Pty.js +0 -0
  271. /package/{src → cjs}/utils/ArtifactParser.js +0 -0
  272. /package/{src → cjs}/utils/Binary.js +0 -0
  273. /package/{src → cjs}/utils/FileTransfer.js +0 -0
  274. /package/{src → cjs}/utils/Multipart.js +0 -0
  275. /package/{src → cjs}/utils/Runtime.js +0 -0
  276. /package/{src → cjs}/utils/Stream.js +0 -0
  277. /package/{src → cjs}/utils/WebSocket.js +0 -0
@@ -0,0 +1,359 @@
1
+ import { SandboxState, SandboxApi, Sandbox as SandboxDto, PaginatedSandboxes as PaginatedSandboxesDto, PortPreviewUrl, SandboxVolume, BuildInfo, SandboxBackupStateEnum, Configuration, SshAccessDto, SshAccessValidationDto } from '@daytonaio/api-client';
2
+ import { FileSystem } from './FileSystem.js';
3
+ import { Git } from './Git.js';
4
+ import { CodeRunParams, Process } from './Process.js';
5
+ import { LspLanguageId, LspServer } from './LspServer.js';
6
+ import { ComputerUse } from './ComputerUse.js';
7
+ import { AxiosInstance } from 'axios';
8
+ import { CodeInterpreter } from './CodeInterpreter.js';
9
+ /**
10
+ * Interface defining methods that a code toolbox must implement
11
+ * @interface
12
+ */
13
+ export interface SandboxCodeToolbox {
14
+ /** Generates a command to run the provided code */
15
+ getRunCommand(code: string, params?: CodeRunParams): string;
16
+ }
17
+ /**
18
+ * Represents a Daytona Sandbox.
19
+ *
20
+ * @property {FileSystem} fs - File system operations interface
21
+ * @property {Git} git - Git operations interface
22
+ * @property {Process} process - Process execution interface
23
+ * @property {CodeInterpreter} codeInterpreter - Stateful interpreter interface for executing code.
24
+ * Currently supports only Python. For other languages, use the `process.codeRun` method.
25
+ * @property {ComputerUse} computerUse - Computer use operations interface for desktop automation
26
+ * @property {string} id - Unique identifier for the Sandbox
27
+ * @property {string} organizationId - Organization ID of the Sandbox
28
+ * @property {string} [snapshot] - Daytona snapshot used to create the Sandbox
29
+ * @property {string} user - OS user running in the Sandbox
30
+ * @property {Record<string, string>} env - Environment variables set in the Sandbox
31
+ * @property {Record<string, string>} labels - Custom labels attached to the Sandbox
32
+ * @property {boolean} public - Whether the Sandbox is publicly accessible
33
+ * @property {string} target - Target location of the runner where the Sandbox runs
34
+ * @property {number} cpu - Number of CPUs allocated to the Sandbox
35
+ * @property {number} gpu - Number of GPUs allocated to the Sandbox
36
+ * @property {number} memory - Amount of memory allocated to the Sandbox in GiB
37
+ * @property {number} disk - Amount of disk space allocated to the Sandbox in GiB
38
+ * @property {SandboxState} state - Current state of the Sandbox (e.g., "started", "stopped")
39
+ * @property {string} [errorReason] - Error message if Sandbox is in error state
40
+ * @property {SandboxBackupStateEnum} [backupState] - Current state of Sandbox backup
41
+ * @property {string} [backupCreatedAt] - When the backup was created
42
+ * @property {number} [autoStopInterval] - Auto-stop interval in minutes
43
+ * @property {number} [autoArchiveInterval] - Auto-archive interval in minutes
44
+ * @property {number} [autoDeleteInterval] - Auto-delete interval in minutes
45
+ * @property {Array<SandboxVolume>} [volumes] - Volumes attached to the Sandbox
46
+ * @property {BuildInfo} [buildInfo] - Build information for the Sandbox if it was created from dynamic build
47
+ * @property {string} [createdAt] - When the Sandbox was created
48
+ * @property {string} [updatedAt] - When the Sandbox was last updated
49
+ * @property {boolean} networkBlockAll - Whether to block all network access for the Sandbox
50
+ * @property {string} [networkAllowList] - Comma-separated list of allowed CIDR network addresses for the Sandbox
51
+ *
52
+ * @class
53
+ */
54
+ export declare class Sandbox implements SandboxDto {
55
+ private readonly clientConfig;
56
+ private readonly axiosInstance;
57
+ private readonly sandboxApi;
58
+ private readonly codeToolbox;
59
+ private readonly getToolboxBaseUrl;
60
+ readonly fs: FileSystem;
61
+ readonly git: Git;
62
+ readonly process: Process;
63
+ readonly computerUse: ComputerUse;
64
+ readonly codeInterpreter: CodeInterpreter;
65
+ id: string;
66
+ name: string;
67
+ organizationId: string;
68
+ snapshot?: string;
69
+ user: string;
70
+ env: Record<string, string>;
71
+ labels: Record<string, string>;
72
+ public: boolean;
73
+ target: string;
74
+ cpu: number;
75
+ gpu: number;
76
+ memory: number;
77
+ disk: number;
78
+ state?: SandboxState;
79
+ errorReason?: string;
80
+ backupState?: SandboxBackupStateEnum;
81
+ backupCreatedAt?: string;
82
+ autoStopInterval?: number;
83
+ autoArchiveInterval?: number;
84
+ autoDeleteInterval?: number;
85
+ volumes?: Array<SandboxVolume>;
86
+ buildInfo?: BuildInfo;
87
+ createdAt?: string;
88
+ updatedAt?: string;
89
+ networkBlockAll: boolean;
90
+ networkAllowList?: string;
91
+ private infoApi;
92
+ /**
93
+ * Creates a new Sandbox instance
94
+ *
95
+ * @param {SandboxDto} sandboxDto - The API Sandbox instance
96
+ * @param {SandboxApi} sandboxApi - API client for Sandbox operations
97
+ * @param {InfoApi} infoApi - API client for info operations
98
+ * @param {SandboxCodeToolbox} codeToolbox - Language-specific toolbox implementation
99
+ */
100
+ constructor(sandboxDto: SandboxDto, clientConfig: Configuration, axiosInstance: AxiosInstance, sandboxApi: SandboxApi, codeToolbox: SandboxCodeToolbox, getToolboxBaseUrl: () => Promise<string>);
101
+ /**
102
+ * Gets the user's home directory path for the logged in user inside the Sandbox.
103
+ *
104
+ * @returns {Promise<string | undefined>} The absolute path to the Sandbox user's home directory for the logged in user
105
+ *
106
+ * @example
107
+ * const userHomeDir = await sandbox.getUserHomeDir();
108
+ * console.log(`Sandbox user home: ${userHomeDir}`);
109
+ */
110
+ getUserHomeDir(): Promise<string | undefined>;
111
+ /**
112
+ * @deprecated Use `getUserHomeDir` instead. This method will be removed in a future version.
113
+ */
114
+ getUserRootDir(): Promise<string | undefined>;
115
+ /**
116
+ * Gets the working directory path inside the Sandbox.
117
+ *
118
+ * @returns {Promise<string | undefined>} The absolute path to the Sandbox working directory. Uses the WORKDIR specified
119
+ * in the Dockerfile if present, or falling back to the user's home directory if not.
120
+ *
121
+ * @example
122
+ * const workDir = await sandbox.getWorkDir();
123
+ * console.log(`Sandbox working directory: ${workDir}`);
124
+ */
125
+ getWorkDir(): Promise<string | undefined>;
126
+ /**
127
+ * Creates a new Language Server Protocol (LSP) server instance.
128
+ *
129
+ * The LSP server provides language-specific features like code completion,
130
+ * diagnostics, and more.
131
+ *
132
+ * @param {LspLanguageId} languageId - The language server type (e.g., "typescript")
133
+ * @param {string} pathToProject - Path to the project root directory. Relative paths are resolved based on the sandbox working directory.
134
+ * @returns {LspServer} A new LSP server instance configured for the specified language
135
+ *
136
+ * @example
137
+ * const lsp = await sandbox.createLspServer('typescript', 'workspace/project');
138
+ */
139
+ createLspServer(languageId: LspLanguageId | string, pathToProject: string): Promise<LspServer>;
140
+ /**
141
+ * Sets labels for the Sandbox.
142
+ *
143
+ * Labels are key-value pairs that can be used to organize and identify Sandboxes.
144
+ *
145
+ * @param {Record<string, string>} labels - Dictionary of key-value pairs representing Sandbox labels
146
+ * @returns {Promise<void>}
147
+ *
148
+ * @example
149
+ * // Set sandbox labels
150
+ * await sandbox.setLabels({
151
+ * project: 'my-project',
152
+ * environment: 'development',
153
+ * team: 'backend'
154
+ * });
155
+ */
156
+ setLabels(labels: Record<string, string>): Promise<Record<string, string>>;
157
+ /**
158
+ * Start the Sandbox.
159
+ *
160
+ * This method starts the Sandbox and waits for it to be ready.
161
+ *
162
+ * @param {number} [timeout] - Maximum time to wait in seconds. 0 means no timeout.
163
+ * Defaults to 60-second timeout.
164
+ * @returns {Promise<void>}
165
+ * @throws {DaytonaError} - `DaytonaError` - If Sandbox fails to start or times out
166
+ *
167
+ * @example
168
+ * const sandbox = await daytona.getCurrentSandbox('my-sandbox');
169
+ * await sandbox.start(40); // Wait up to 40 seconds
170
+ * console.log('Sandbox started successfully');
171
+ */
172
+ start(timeout?: number): Promise<void>;
173
+ /**
174
+ * Stops the Sandbox.
175
+ *
176
+ * This method stops the Sandbox and waits for it to be fully stopped.
177
+ *
178
+ * @param {number} [timeout] - Maximum time to wait in seconds. 0 means no timeout.
179
+ * Defaults to 60-second timeout.
180
+ * @returns {Promise<void>}
181
+ *
182
+ * @example
183
+ * const sandbox = await daytona.getCurrentSandbox('my-sandbox');
184
+ * await sandbox.stop();
185
+ * console.log('Sandbox stopped successfully');
186
+ */
187
+ stop(timeout?: number): Promise<void>;
188
+ /**
189
+ * Deletes the Sandbox.
190
+ * @returns {Promise<void>}
191
+ */
192
+ delete(timeout?: number): Promise<void>;
193
+ /**
194
+ * Waits for the Sandbox to reach the 'started' state.
195
+ *
196
+ * This method polls the Sandbox status until it reaches the 'started' state
197
+ * or encounters an error.
198
+ *
199
+ * @param {number} [timeout] - Maximum time to wait in seconds. 0 means no timeout.
200
+ * Defaults to 60 seconds.
201
+ * @returns {Promise<void>}
202
+ * @throws {DaytonaError} - `DaytonaError` - If the sandbox ends up in an error state or fails to start within the timeout period.
203
+ */
204
+ waitUntilStarted(timeout?: number): Promise<void>;
205
+ /**
206
+ * Wait for Sandbox to reach 'stopped' state.
207
+ *
208
+ * This method polls the Sandbox status until it reaches the 'stopped' state
209
+ * or encounters an error.
210
+ *
211
+ * @param {number} [timeout] - Maximum time to wait in seconds. 0 means no timeout.
212
+ * Defaults to 60 seconds.
213
+ * @returns {Promise<void>}
214
+ * @throws {DaytonaError} - `DaytonaError` - If the sandbox fails to stop within the timeout period.
215
+ */
216
+ waitUntilStopped(timeout?: number): Promise<void>;
217
+ /**
218
+ * Refreshes the Sandbox data from the API.
219
+ *
220
+ * @returns {Promise<void>}
221
+ *
222
+ * @example
223
+ * await sandbox.refreshData();
224
+ * console.log(`Sandbox ${sandbox.id}:`);
225
+ * console.log(`State: ${sandbox.state}`);
226
+ * console.log(`Resources: ${sandbox.cpu} CPU, ${sandbox.memory} GiB RAM`);
227
+ */
228
+ refreshData(): Promise<void>;
229
+ /**
230
+ * Refreshes the sandbox activity to reset the timer for automated lifecycle management actions.
231
+ *
232
+ * This method updates the sandbox's last activity timestamp without changing its state.
233
+ * It is useful for keeping long-running sessions alive while there is still user activity.
234
+ *
235
+ * @returns {Promise<void>}
236
+ *
237
+ * @example
238
+ * // Keep sandbox activity alive
239
+ * await sandbox.refreshActivity();
240
+ */
241
+ refreshActivity(): Promise<void>;
242
+ /**
243
+ * Set the auto-stop interval for the Sandbox.
244
+ *
245
+ * The Sandbox will automatically stop after being idle (no new events) for the specified interval.
246
+ * Events include any state changes or interactions with the Sandbox through the sdk.
247
+ * Interactions using Sandbox Previews are not included.
248
+ *
249
+ * @param {number} interval - Number of minutes of inactivity before auto-stopping.
250
+ * Set to 0 to disable auto-stop. Default is 15 minutes.
251
+ * @returns {Promise<void>}
252
+ * @throws {DaytonaError} - `DaytonaError` - If interval is not a non-negative integer
253
+ *
254
+ * @example
255
+ * // Auto-stop after 1 hour
256
+ * await sandbox.setAutostopInterval(60);
257
+ * // Or disable auto-stop
258
+ * await sandbox.setAutostopInterval(0);
259
+ */
260
+ setAutostopInterval(interval: number): Promise<void>;
261
+ /**
262
+ * Set the auto-archive interval for the Sandbox.
263
+ *
264
+ * The Sandbox will automatically archive after being continuously stopped for the specified interval.
265
+ *
266
+ * @param {number} interval - Number of minutes after which a continuously stopped Sandbox will be auto-archived.
267
+ * Set to 0 for the maximum interval. Default is 7 days.
268
+ * @returns {Promise<void>}
269
+ * @throws {DaytonaError} - `DaytonaError` - If interval is not a non-negative integer
270
+ *
271
+ * @example
272
+ * // Auto-archive after 1 hour
273
+ * await sandbox.setAutoArchiveInterval(60);
274
+ * // Or use the maximum interval
275
+ * await sandbox.setAutoArchiveInterval(0);
276
+ */
277
+ setAutoArchiveInterval(interval: number): Promise<void>;
278
+ /**
279
+ * Set the auto-delete interval for the Sandbox.
280
+ *
281
+ * The Sandbox will automatically delete after being continuously stopped for the specified interval.
282
+ *
283
+ * @param {number} interval - Number of minutes after which a continuously stopped Sandbox will be auto-deleted.
284
+ * Set to negative value to disable auto-delete. Set to 0 to delete immediately upon stopping.
285
+ * By default, auto-delete is disabled.
286
+ * @returns {Promise<void>}
287
+ *
288
+ * @example
289
+ * // Auto-delete after 1 hour
290
+ * await sandbox.setAutoDeleteInterval(60);
291
+ * // Or delete immediately upon stopping
292
+ * await sandbox.setAutoDeleteInterval(0);
293
+ * // Or disable auto-delete
294
+ * await sandbox.setAutoDeleteInterval(-1);
295
+ */
296
+ setAutoDeleteInterval(interval: number): Promise<void>;
297
+ /**
298
+ * Retrieves the preview link for the sandbox at the specified port. If the port is closed,
299
+ * it will be opened automatically. For private sandboxes, a token is included to grant access
300
+ * to the URL.
301
+ *
302
+ * @param {number} port - The port to open the preview link on.
303
+ * @returns {PortPreviewUrl} The response object for the preview link, which includes the `url`
304
+ * and the `token` (to access private sandboxes).
305
+ *
306
+ * @example
307
+ * const previewLink = await sandbox.getPreviewLink(3000);
308
+ * console.log(`Preview URL: ${previewLink.url}`);
309
+ * console.log(`Token: ${previewLink.token}`);
310
+ */
311
+ getPreviewLink(port: number): Promise<PortPreviewUrl>;
312
+ /**
313
+ * Archives the sandbox, making it inactive and preserving its state. When sandboxes are archived, the entire filesystem
314
+ * state is moved to cost-effective object storage, making it possible to keep sandboxes available for an extended period.
315
+ * The tradeoff between archived and stopped states is that starting an archived sandbox takes more time, depending on its size.
316
+ * Sandbox must be stopped before archiving.
317
+ */
318
+ archive(): Promise<void>;
319
+ /**
320
+ * Creates an SSH access token for the sandbox.
321
+ *
322
+ * @param {number} expiresInMinutes - The number of minutes the SSH access token will be valid for.
323
+ * @returns {Promise<SshAccessDto>} The SSH access token.
324
+ */
325
+ createSshAccess(expiresInMinutes?: number): Promise<SshAccessDto>;
326
+ /**
327
+ * Revokes an SSH access token for the sandbox.
328
+ *
329
+ * @param {string} token - The token to revoke.
330
+ * @returns {Promise<void>}
331
+ */
332
+ revokeSshAccess(token: string): Promise<void>;
333
+ /**
334
+ * Validates an SSH access token for the sandbox.
335
+ *
336
+ * @param {string} token - The token to validate.
337
+ * @returns {Promise<SshAccessValidationDto>} The SSH access validation result.
338
+ */
339
+ validateSshAccess(token: string): Promise<SshAccessValidationDto>;
340
+ /**
341
+ * Assigns the API sandbox data to the Sandbox object.
342
+ *
343
+ * @param {SandboxDto} sandboxDto - The API sandbox instance to assign data from
344
+ * @returns {void}
345
+ */
346
+ private processSandboxDto;
347
+ /**
348
+ * Refreshes the Sandbox data from the API, but does not throw an error if the sandbox has been deleted.
349
+ * Instead, it sets the state to destroyed.
350
+ *
351
+ * @returns {Promise<void>}
352
+ */
353
+ private refreshDataSafe;
354
+ private ensureToolboxUrl;
355
+ }
356
+ export interface PaginatedSandboxes extends Omit<PaginatedSandboxesDto, 'items'> {
357
+ items: Sandbox[];
358
+ }
359
+ //# sourceMappingURL=Sandbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sandbox.d.ts","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/Sandbox.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,OAAO,IAAI,UAAU,EACrB,kBAAkB,IAAI,qBAAqB,EAC3C,cAAc,EACd,aAAa,EACb,SAAS,EACT,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,sBAAsB,EACvB,MAAM,uBAAuB,CAAA;AAU9B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAInD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAA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