@daytonaio/sdk 0.9.0 → 0.10.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 (222) hide show
  1. package/README.md +4 -4
  2. package/dist/Daytona.d.ts +243 -47
  3. package/dist/Daytona.js +278 -60
  4. package/dist/FileSystem.d.ts +183 -32
  5. package/dist/FileSystem.js +168 -28
  6. package/dist/Git.d.ts +178 -30
  7. package/dist/Git.js +178 -30
  8. package/dist/LspServer.d.ts +170 -22
  9. package/dist/LspServer.js +162 -18
  10. package/dist/Process.d.ts +187 -37
  11. package/dist/Process.js +185 -44
  12. package/dist/Workspace.d.ts +257 -35
  13. package/dist/Workspace.js +255 -48
  14. package/dist/code-toolbox/WorkspacePythonCodeToolbox.d.ts +2 -1
  15. package/dist/code-toolbox/WorkspacePythonCodeToolbox.js +4 -2
  16. package/dist/code-toolbox/WorkspaceTsCodeToolbox.d.ts +2 -1
  17. package/dist/code-toolbox/WorkspaceTsCodeToolbox.js +4 -2
  18. package/dist/errors/DaytonaError.d.ts +8 -0
  19. package/dist/errors/DaytonaError.js +12 -0
  20. package/dist/index.d.ts +4 -0
  21. package/dist/index.js +12 -1
  22. package/dist/utils/Axios.d.ts +6 -0
  23. package/dist/utils/Axios.js +28 -0
  24. package/dist/utils/errors.d.ts +10 -0
  25. package/dist/utils/errors.js +36 -0
  26. package/dist/utils/timeout.d.ts +35 -0
  27. package/dist/utils/timeout.js +73 -0
  28. package/package.json +11 -10
  29. package/dist/client/apis/ApiKeyApi.d.ts +0 -54
  30. package/dist/client/apis/ApiKeyApi.js +0 -135
  31. package/dist/client/apis/BuildApi.d.ts +0 -95
  32. package/dist/client/apis/BuildApi.js +0 -228
  33. package/dist/client/apis/ContainerRegistryApi.d.ts +0 -68
  34. package/dist/client/apis/ContainerRegistryApi.js +0 -163
  35. package/dist/client/apis/DefaultApi.d.ts +0 -31
  36. package/dist/client/apis/DefaultApi.js +0 -72
  37. package/dist/client/apis/GitProviderApi.d.ts +0 -197
  38. package/dist/client/apis/GitProviderApi.js +0 -477
  39. package/dist/client/apis/PrebuildApi.d.ts +0 -97
  40. package/dist/client/apis/PrebuildApi.js +0 -241
  41. package/dist/client/apis/ProfileApi.d.ts +0 -51
  42. package/dist/client/apis/ProfileApi.js +0 -128
  43. package/dist/client/apis/ProjectConfigApi.d.ts +0 -94
  44. package/dist/client/apis/ProjectConfigApi.js +0 -220
  45. package/dist/client/apis/ProviderApi.d.ts +0 -71
  46. package/dist/client/apis/ProviderApi.js +0 -160
  47. package/dist/client/apis/SampleApi.d.ts +0 -28
  48. package/dist/client/apis/SampleApi.js +0 -73
  49. package/dist/client/apis/ServerApi.d.ts +0 -61
  50. package/dist/client/apis/ServerApi.js +0 -156
  51. package/dist/client/apis/TargetApi.d.ts +0 -67
  52. package/dist/client/apis/TargetApi.js +0 -159
  53. package/dist/client/apis/WorkspaceApi.d.ts +0 -141
  54. package/dist/client/apis/WorkspaceApi.js +0 -330
  55. package/dist/client/apis/WorkspaceToolboxApi.d.ts +0 -464
  56. package/dist/client/apis/WorkspaceToolboxApi.js +0 -1248
  57. package/dist/client/apis/index.d.ts +0 -14
  58. package/dist/client/apis/index.js +0 -32
  59. package/dist/client/index.d.ts +0 -3
  60. package/dist/client/index.js +0 -21
  61. package/dist/client/models/ApiKey.d.ts +0 -45
  62. package/dist/client/models/ApiKey.js +0 -60
  63. package/dist/client/models/ApikeyApiKeyType.d.ts +0 -26
  64. package/dist/client/models/ApikeyApiKeyType.js +0 -52
  65. package/dist/client/models/Build.d.ts +0 -98
  66. package/dist/client/models/Build.js +0 -91
  67. package/dist/client/models/BuildBuildState.d.ts +0 -31
  68. package/dist/client/models/BuildBuildState.js +0 -57
  69. package/dist/client/models/BuildConfig.d.ts +0 -40
  70. package/dist/client/models/BuildConfig.js +0 -57
  71. package/dist/client/models/CachedBuild.d.ts +0 -38
  72. package/dist/client/models/CachedBuild.js +0 -55
  73. package/dist/client/models/CloneTarget.d.ts +0 -25
  74. package/dist/client/models/CloneTarget.js +0 -51
  75. package/dist/client/models/CompletionContext.d.ts +0 -38
  76. package/dist/client/models/CompletionContext.js +0 -53
  77. package/dist/client/models/CompletionItem.d.ts +0 -68
  78. package/dist/client/models/CompletionItem.js +0 -63
  79. package/dist/client/models/CompletionList.d.ts +0 -39
  80. package/dist/client/models/CompletionList.js +0 -56
  81. package/dist/client/models/ContainerConfig.d.ts +0 -38
  82. package/dist/client/models/ContainerConfig.js +0 -55
  83. package/dist/client/models/ContainerRegistry.d.ts +0 -44
  84. package/dist/client/models/ContainerRegistry.js +0 -59
  85. package/dist/client/models/CreateBuildDTO.d.ts +0 -52
  86. package/dist/client/models/CreateBuildDTO.js +0 -62
  87. package/dist/client/models/CreatePrebuildDTO.d.ts +0 -56
  88. package/dist/client/models/CreatePrebuildDTO.js +0 -59
  89. package/dist/client/models/CreateProjectConfigDTO.d.ts +0 -71
  90. package/dist/client/models/CreateProjectConfigDTO.js +0 -72
  91. package/dist/client/models/CreateProjectDTO.d.ts +0 -72
  92. package/dist/client/models/CreateProjectDTO.js +0 -73
  93. package/dist/client/models/CreateProjectSourceDTO.d.ts +0 -33
  94. package/dist/client/models/CreateProjectSourceDTO.js +0 -52
  95. package/dist/client/models/CreateProviderTargetDTO.d.ts +0 -45
  96. package/dist/client/models/CreateProviderTargetDTO.js +0 -60
  97. package/dist/client/models/CreateWorkspaceDTO.d.ts +0 -51
  98. package/dist/client/models/CreateWorkspaceDTO.js +0 -64
  99. package/dist/client/models/DevcontainerConfig.d.ts +0 -32
  100. package/dist/client/models/DevcontainerConfig.js +0 -51
  101. package/dist/client/models/ExecuteRequest.d.ts +0 -38
  102. package/dist/client/models/ExecuteRequest.js +0 -53
  103. package/dist/client/models/ExecuteResponse.d.ts +0 -38
  104. package/dist/client/models/ExecuteResponse.js +0 -55
  105. package/dist/client/models/FRPSConfig.d.ts +0 -44
  106. package/dist/client/models/FRPSConfig.js +0 -59
  107. package/dist/client/models/FileInfo.d.ts +0 -74
  108. package/dist/client/models/FileInfo.js +0 -79
  109. package/dist/client/models/FileStatus.d.ts +0 -51
  110. package/dist/client/models/FileStatus.js +0 -64
  111. package/dist/client/models/GetRepositoryContext.d.ts +0 -80
  112. package/dist/client/models/GetRepositoryContext.js +0 -67
  113. package/dist/client/models/GitAddRequest.d.ts +0 -38
  114. package/dist/client/models/GitAddRequest.js +0 -55
  115. package/dist/client/models/GitBranch.d.ts +0 -38
  116. package/dist/client/models/GitBranch.js +0 -55
  117. package/dist/client/models/GitBranchRequest.d.ts +0 -38
  118. package/dist/client/models/GitBranchRequest.js +0 -55
  119. package/dist/client/models/GitCloneRequest.d.ts +0 -62
  120. package/dist/client/models/GitCloneRequest.js +0 -63
  121. package/dist/client/models/GitCommitInfo.d.ts +0 -56
  122. package/dist/client/models/GitCommitInfo.js +0 -67
  123. package/dist/client/models/GitCommitRequest.d.ts +0 -50
  124. package/dist/client/models/GitCommitRequest.js +0 -63
  125. package/dist/client/models/GitCommitResponse.d.ts +0 -32
  126. package/dist/client/models/GitCommitResponse.js +0 -51
  127. package/dist/client/models/GitNamespace.d.ts +0 -38
  128. package/dist/client/models/GitNamespace.js +0 -55
  129. package/dist/client/models/GitProvider.d.ts +0 -75
  130. package/dist/client/models/GitProvider.js +0 -76
  131. package/dist/client/models/GitPullRequest.d.ts +0 -68
  132. package/dist/client/models/GitPullRequest.js +0 -75
  133. package/dist/client/models/GitRepoRequest.d.ts +0 -44
  134. package/dist/client/models/GitRepoRequest.js +0 -55
  135. package/dist/client/models/GitRepository.d.ts +0 -87
  136. package/dist/client/models/GitRepository.js +0 -84
  137. package/dist/client/models/GitStatus.d.ts +0 -57
  138. package/dist/client/models/GitStatus.js +0 -62
  139. package/dist/client/models/GitUser.d.ts +0 -50
  140. package/dist/client/models/GitUser.js +0 -63
  141. package/dist/client/models/InstallProviderRequest.d.ts +0 -40
  142. package/dist/client/models/InstallProviderRequest.js +0 -55
  143. package/dist/client/models/ListBranchResponse.d.ts +0 -32
  144. package/dist/client/models/ListBranchResponse.js +0 -51
  145. package/dist/client/models/LogFileConfig.d.ts +0 -62
  146. package/dist/client/models/LogFileConfig.js +0 -67
  147. package/dist/client/models/LspCompletionParams.d.ts +0 -58
  148. package/dist/client/models/LspCompletionParams.js +0 -69
  149. package/dist/client/models/LspDocumentRequest.d.ts +0 -44
  150. package/dist/client/models/LspDocumentRequest.js +0 -59
  151. package/dist/client/models/LspLocation.d.ts +0 -39
  152. package/dist/client/models/LspLocation.js +0 -56
  153. package/dist/client/models/LspPosition.d.ts +0 -38
  154. package/dist/client/models/LspPosition.js +0 -55
  155. package/dist/client/models/LspRange.d.ts +0 -39
  156. package/dist/client/models/LspRange.js +0 -56
  157. package/dist/client/models/LspServerRequest.d.ts +0 -38
  158. package/dist/client/models/LspServerRequest.js +0 -55
  159. package/dist/client/models/LspSymbol.d.ts +0 -45
  160. package/dist/client/models/LspSymbol.js +0 -60
  161. package/dist/client/models/Match.d.ts +0 -44
  162. package/dist/client/models/Match.js +0 -59
  163. package/dist/client/models/NetworkKey.d.ts +0 -32
  164. package/dist/client/models/NetworkKey.js +0 -51
  165. package/dist/client/models/Position.d.ts +0 -38
  166. package/dist/client/models/Position.js +0 -55
  167. package/dist/client/models/PrebuildConfig.d.ts +0 -56
  168. package/dist/client/models/PrebuildConfig.js +0 -67
  169. package/dist/client/models/PrebuildDTO.d.ts +0 -62
  170. package/dist/client/models/PrebuildDTO.js +0 -68
  171. package/dist/client/models/ProfileData.d.ts +0 -34
  172. package/dist/client/models/ProfileData.js +0 -51
  173. package/dist/client/models/Project.d.ts +0 -91
  174. package/dist/client/models/Project.js +0 -88
  175. package/dist/client/models/ProjectConfig.d.ts +0 -84
  176. package/dist/client/models/ProjectConfig.js +0 -87
  177. package/dist/client/models/ProjectDirResponse.d.ts +0 -32
  178. package/dist/client/models/ProjectDirResponse.js +0 -49
  179. package/dist/client/models/ProjectInfo.d.ts +0 -56
  180. package/dist/client/models/ProjectInfo.js +0 -65
  181. package/dist/client/models/ProjectState.d.ts +0 -45
  182. package/dist/client/models/ProjectState.js +0 -60
  183. package/dist/client/models/Provider.d.ts +0 -44
  184. package/dist/client/models/Provider.js +0 -57
  185. package/dist/client/models/ProviderProviderInfo.d.ts +0 -44
  186. package/dist/client/models/ProviderProviderInfo.js +0 -57
  187. package/dist/client/models/ProviderProviderTargetProperty.d.ts +0 -72
  188. package/dist/client/models/ProviderProviderTargetProperty.js +0 -64
  189. package/dist/client/models/ProviderProviderTargetPropertyType.d.ts +0 -29
  190. package/dist/client/models/ProviderProviderTargetPropertyType.js +0 -55
  191. package/dist/client/models/ProviderTarget.d.ts +0 -51
  192. package/dist/client/models/ProviderTarget.js +0 -64
  193. package/dist/client/models/ReplaceRequest.d.ts +0 -44
  194. package/dist/client/models/ReplaceRequest.js +0 -59
  195. package/dist/client/models/ReplaceResult.d.ts +0 -44
  196. package/dist/client/models/ReplaceResult.js +0 -53
  197. package/dist/client/models/RepositoryUrl.d.ts +0 -32
  198. package/dist/client/models/RepositoryUrl.js +0 -51
  199. package/dist/client/models/Sample.d.ts +0 -44
  200. package/dist/client/models/Sample.js +0 -59
  201. package/dist/client/models/SearchFilesResponse.d.ts +0 -32
  202. package/dist/client/models/SearchFilesResponse.js +0 -51
  203. package/dist/client/models/ServerConfig.d.ts +0 -130
  204. package/dist/client/models/ServerConfig.js +0 -119
  205. package/dist/client/models/SetGitProviderConfig.d.ts +0 -75
  206. package/dist/client/models/SetGitProviderConfig.js +0 -70
  207. package/dist/client/models/SetProjectState.d.ts +0 -39
  208. package/dist/client/models/SetProjectState.js +0 -56
  209. package/dist/client/models/SigningMethod.d.ts +0 -25
  210. package/dist/client/models/SigningMethod.js +0 -51
  211. package/dist/client/models/Status.d.ts +0 -31
  212. package/dist/client/models/Status.js +0 -57
  213. package/dist/client/models/Workspace.d.ts +0 -51
  214. package/dist/client/models/Workspace.js +0 -64
  215. package/dist/client/models/WorkspaceDTO.d.ts +0 -58
  216. package/dist/client/models/WorkspaceDTO.js +0 -67
  217. package/dist/client/models/WorkspaceInfo.d.ts +0 -45
  218. package/dist/client/models/WorkspaceInfo.js +0 -58
  219. package/dist/client/models/index.d.ts +0 -79
  220. package/dist/client/models/index.js +0 -97
  221. package/dist/client/runtime.d.ts +0 -182
  222. package/dist/client/runtime.js +0 -340
package/README.md CHANGED
@@ -34,13 +34,13 @@ To use the SDK, you'll need two essential pieces of information:
34
34
  You can install the package using npm:
35
35
 
36
36
  ```bash
37
- npm install @daytona/sdk
37
+ npm install @daytonaio/sdk
38
38
  ```
39
39
 
40
40
  Or using yarn:
41
41
 
42
42
  ```bash
43
- yarn add @daytona/sdk
43
+ yarn add @daytonaio/sdk
44
44
  ```
45
45
 
46
46
  ## Quick Start
@@ -48,7 +48,7 @@ yarn add @daytona/sdk
48
48
  Here's a simple example of using the SDK:
49
49
 
50
50
  ```typescript
51
- import { Daytona } from '@daytona/sdk'
51
+ import { Daytona } from '@daytonaio/sdk'
52
52
 
53
53
  // Initialize the Daytona client
54
54
  const daytona = new Daytona()
@@ -76,7 +76,7 @@ console.log(response.result)
76
76
  The SDK can be configured using environment variables or by passing a configuration object:
77
77
 
78
78
  ```typescript
79
- import { Daytona, DaytonaConfig } from '@daytona/sdk'
79
+ import { Daytona, DaytonaConfig } from '@daytonaio/sdk'
80
80
 
81
81
  const config: DaytonaConfig = {
82
82
  apiKey: 'your-api-key',
package/dist/Daytona.d.ts CHANGED
@@ -1,8 +1,67 @@
1
+ /**
2
+ * Sandboxes are isolated development environments managed by Daytona.
3
+ * This guide covers how to create, manage, and remove Sandboxes using the SDK.
4
+ *
5
+ * @module Daytona
6
+ *
7
+ * @example
8
+ * // Initialize using environment variables (DAYTONA_API_KEY, DAYTONA_SERVER_URL, DAYTONA_TARGET)
9
+ * const daytona = new Daytona();
10
+ *
11
+ * // Create and use a workspace
12
+ * const workspace = await daytona.create({
13
+ * language: 'typescript',
14
+ * envVars: { NODE_ENV: 'development' }
15
+ * });
16
+ *
17
+ * // Execute commands in the workspace
18
+ * const response = await workspace.process.executeCommand('echo "Hello, World!"');
19
+ * console.log(response.result);
20
+ *
21
+ * // Execute code in the workspace
22
+ * const response = await workspace.process.codeRun('console.log("Hello, World!")');
23
+ * console.log(response.result);
24
+ *
25
+ * @example
26
+ * // Initialize with explicit configuration
27
+ * const daytona = new Daytona({
28
+ * apiKey: process.env.CUSTOM_API_KEY,
29
+ * serverUrl: 'https://daytona.example.com',
30
+ * target: 'us'
31
+ * });
32
+ *
33
+ * // Create a custom workspace
34
+ * const workspace = await daytona.create({
35
+ * language: 'typescript',
36
+ * image: 'node:18',
37
+ * resources: {
38
+ * cpu: 2,
39
+ * memory: 4 // 4GB RAM
40
+ * },
41
+ * autoStopInterval: 60 // Auto-stop after 1 hour of inactivity
42
+ * });
43
+ *
44
+ * // Use workspace features
45
+ * await workspace.git.clone('https://github.com/user/repo.git');
46
+ * await workspace.process.executeCommand('npm test');
47
+ */
1
48
  import { Workspace } from './Workspace';
2
- import { CreateWorkspaceTargetEnum } from '@daytonaio/api-client';
49
+ import { CreateWorkspaceTargetEnum as WorkspaceTargetRegion } from '@daytonaio/api-client';
3
50
  /**
4
- * Configuration options for initializing the Daytona client
5
- * @interface DaytonaConfig
51
+ * Configuration options for initializing the Daytona client.
52
+ *
53
+ * @interface
54
+ * @property {string} apiKey - API key for authentication with Daytona server
55
+ * @property {string} serverUrl - URL of the Daytona server
56
+ * @property {CreateWorkspaceTargetEnum} target - Target location for Sandboxes
57
+ *
58
+ * @example
59
+ * const config: DaytonaConfig = {
60
+ * apiKey: "your-api-key",
61
+ * serverUrl: "https://your-server.com",
62
+ * target: "us"
63
+ * };
64
+ * const daytona = new Daytona(config);
6
65
  */
7
66
  export interface DaytonaConfig {
8
67
  /** API key for authentication with Daytona server */
@@ -10,55 +69,123 @@ export interface DaytonaConfig {
10
69
  /** URL of the Daytona server */
11
70
  serverUrl: string;
12
71
  /** Target environment for workspaces */
13
- target: CreateWorkspaceTargetEnum;
72
+ target: WorkspaceTargetRegion;
14
73
  }
15
74
  /**
16
75
  * Supported programming languages for code execution
17
76
  */
18
- export type CodeLanguage = 'python' | 'javascript' | 'typescript';
77
+ export declare enum CodeLanguage {
78
+ PYTHON = "python",
79
+ TYPESCRIPT = "typescript",
80
+ JAVASCRIPT = "javascript"
81
+ }
19
82
  /**
20
- * Resource allocation for a workspace
21
- * @interface WorkspaceResources
83
+ * Resource allocation for a Sandbox.
84
+ *
85
+ * @interface
86
+ * @property {number} [cpu] - CPU allocation for the Sandbox in cores
87
+ * @property {number} [gpu] - GPU allocation for the Sandbox in units
88
+ * @property {number} [memory] - Memory allocation for the Sandbox in GB
89
+ * @property {number} [disk] - Disk space allocation for the Sandbox in GB
90
+ *
91
+ * @example
92
+ * const resources: WorkspaceResources = {
93
+ * cpu: 2,
94
+ * memory: 4, // 4GB RAM
95
+ * disk: 20 // 20GB disk
96
+ * };
22
97
  */
23
98
  export interface WorkspaceResources {
24
- /** CPU allocation for the workspace */
99
+ /** CPU allocation for the Sandbox */
25
100
  cpu?: number;
26
- /** GPU allocation for the workspace */
101
+ /** GPU allocation for the Sandbox */
27
102
  gpu?: number;
28
- /** Memory allocation for the workspace in MB */
103
+ /** Memory allocation for the Sandbox in MB */
29
104
  memory?: number;
30
- /** Disk space allocation for the workspace in MB */
105
+ /** Disk space allocation for the Sandbox in MB */
31
106
  disk?: number;
32
107
  }
33
108
  /**
34
- * Parameters for creating a new workspace
35
- * @interface CreateWorkspaceParams
109
+ * Parameters for creating a new Sandbox.
110
+ *
111
+ * @interface
112
+ * @property {string} [id] - Optional Sandbox ID. If not provided, a random ID will be generated
113
+ * @property {string} [image] - Optional Docker image to use for the Sandbox
114
+ * @property {string} [user] - Optional os user to use for the Sandbox
115
+ * @property {CodeLanguage} [language] - Programming language for direct code execution
116
+ * @property {Record<string, string>} [envVars] - Optional environment variables to set in the Sandbox
117
+ * @property {Record<string, string>} [labels] - Sandbox labels
118
+ * @property {boolean} [public] - Is the Sandbox port preview public
119
+ * @property {string} [target] - Target location for the Sandbox
120
+ * @property {WorkspaceResources} [resources] - Resource allocation for the Sandbox
121
+ * @property {boolean} [async] - If true, will not wait for the Sandbox to be ready before returning
122
+ * @property {number} [timeout] - Timeout in seconds for the Sandbox to be ready (0 means no timeout)
123
+ * @property {number} [autoStopInterval] - Auto-stop interval in minutes (0 means disabled)
124
+ *
125
+ * @example
126
+ * const params: CreateWorkspaceParams = {
127
+ * language: 'typescript',
128
+ * envVars: { NODE_ENV: 'development' },
129
+ * resources: {
130
+ * cpu: 2,
131
+ * memory: 4 // 4GB RAM
132
+ * },
133
+ * autoStopInterval: 60 // Auto-stop after 1 hour of inactivity
134
+ * };
135
+ * const workspace = await daytona.create(params, 50);
36
136
  */
37
137
  export type CreateWorkspaceParams = {
38
- /** Optional workspace ID. If not provided, a random ID will be generated */
138
+ /** Optional Sandbox ID. If not provided, a random ID will be generated */
39
139
  id?: string;
40
- /** Optional Docker image to use for the workspace */
140
+ /** Optional Docker image to use for the Sandbox */
41
141
  image?: string;
42
- /** Optional os user to use for the workspace */
142
+ /** Optional os user to use for the Sandbox */
43
143
  user?: string;
44
144
  /** Programming language for direct code execution */
45
- language?: CodeLanguage;
145
+ language?: CodeLanguage | string;
46
146
  /** Optional environment variables to set in the workspace */
47
147
  envVars?: Record<string, string>;
48
- /** Workspace labels */
148
+ /** Sandbox labels */
49
149
  labels?: Record<string, string>;
50
- /** Is the workspace port preview public */
150
+ /** Is the Sandbox port preview public */
51
151
  public?: boolean;
52
- /** Target location for the workspace */
53
- target?: string;
54
- /** Resource allocation for the workspace */
152
+ /** Target location for the Sandbox */
153
+ target?: WorkspaceTargetRegion | string;
154
+ /** Resource allocation for the Sandbox */
55
155
  resources?: WorkspaceResources;
56
- /** If true, will not wait for the workspace to be ready before returning */
156
+ /** If true, will not wait for the Sandbox to be ready before returning */
57
157
  async?: boolean;
158
+ /**
159
+ * Timeout in seconds, for the Sandbox to be ready (0 means no timeout)
160
+ * @deprecated Use methods with `timeout` parameter instead
161
+ */
162
+ timeout?: number;
163
+ /** Auto-stop interval in minutes (0 means disabled) (must be a non-negative integer) */
164
+ autoStopInterval?: number;
58
165
  };
59
166
  /**
60
- * Main class for interacting with Daytona Server API
61
- * @class Daytona
167
+ * Main class for interacting with Daytona Server API.
168
+ *
169
+ * Provides methods for creating, managing, and interacting with Daytona Sandboxes.
170
+ * Can be initialized either with explicit configuration or using environment variables.
171
+ *
172
+ *
173
+ * @example
174
+ * // Using environment variables
175
+ * // Uses DAYTONA_API_KEY, DAYTONA_SERVER_URL, DAYTONA_TARGET
176
+ * const daytona = new Daytona();
177
+ * const workspace = await daytona.create();
178
+ *
179
+ * @example
180
+ * // Using explicit configuration
181
+ * const config: DaytonaConfig = {
182
+ * apiKey: "your-api-key",
183
+ * serverUrl: "https://your-server.com",
184
+ * target: "us"
185
+ * };
186
+ * const daytona = new Daytona(config);
187
+ *
188
+ * @class
62
189
  */
63
190
  export declare class Daytona {
64
191
  private readonly workspaceApi;
@@ -67,50 +194,119 @@ export declare class Daytona {
67
194
  private readonly apiKey;
68
195
  private readonly serverUrl;
69
196
  /**
70
- * Creates a new Daytona client instance
197
+ * Creates a new Daytona client instance.
198
+ *
71
199
  * @param {DaytonaConfig} [config] - Configuration options
72
- * @throws {Error} When API key or server URL is missing
200
+ * @throws {DaytonaError} - `DaytonaError` - When API key or server URL is missing
73
201
  */
74
202
  constructor(config?: DaytonaConfig);
75
203
  /**
76
- * Creates a new workspace
77
- * @param {CreateWorkspaceParams} [params] - Parameters for workspace creation
78
- * @returns {Promise<Workspace>} The created workspace instance
204
+ * Creates Sandboxes with default or custom configurations. You can specify various parameters,
205
+ * including language, image, resources, environment variables, and volumes for the Sandbox.
206
+ *
207
+ * @param {CreateWorkspaceParams} [params] - Parameters for Sandbox creation
208
+ * @param {number} [timeout] - Timeout in seconds (0 means no timeout, default is 60)
209
+ * @returns {Promise<Workspace>} The created Sandbox instance
210
+ *
211
+ * @example
212
+ * // Create a default workspace
213
+ * const workspace = await daytona.create();
214
+ *
215
+ * @example
216
+ * // Create a custom workspace
217
+ * const params: CreateWorkspaceParams = {
218
+ * language: 'typescript',
219
+ * image: 'node:18',
220
+ * envVars: {
221
+ * NODE_ENV: 'development',
222
+ * DEBUG: 'true'
223
+ * },
224
+ * resources: {
225
+ * cpu: 2,
226
+ * memory: 4 // 4GB RAM
227
+ * },
228
+ * autoStopInterval: 60
229
+ * };
230
+ * const workspace = await daytona.create(params, 40);
79
231
  */
80
- create(params?: CreateWorkspaceParams): Promise<Workspace>;
232
+ create(params: CreateWorkspaceParams, timeout?: number): Promise<Workspace>;
81
233
  /**
82
- * Gets a workspace by its ID
83
- * @param {string} workspaceId - The ID of the workspace to retrieve
84
- * @returns {Promise<Workspace>} The workspace instance
234
+ * Gets a Sandbox by its ID.
235
+ *
236
+ * @param {string} workspaceId - The ID of the Sandbox to retrieve
237
+ * @returns {Promise<Workspace>} The Sandbox
238
+ *
239
+ * @example
240
+ * const workspace = await daytona.get('my-workspace-id');
241
+ * console.log(`Workspace state: ${workspace.instance.state}`);
85
242
  */
86
243
  get(workspaceId: string): Promise<Workspace>;
87
244
  /**
88
- * Lists all workspaces
89
- * @returns {Promise<Workspace[]>} The list of workspaces
245
+ * Lists all Sandboxes.
246
+ *
247
+ * @returns {Promise<Workspace[]>} Array of Sandboxes
248
+ *
249
+ * @example
250
+ * const workspaces = await daytona.list();
251
+ * for (const workspace of workspaces) {
252
+ * console.log(`${workspace.id}: ${workspace.instance.state}`);
253
+ * }
90
254
  */
91
255
  list(): Promise<Workspace[]>;
92
256
  /**
93
- * Starts a workspace
94
- * @param {Workspace} workspace - The workspace to start
257
+ * Starts a Sandbox and waits for it to be ready.
258
+ *
259
+ * @param {Workspace} workspace - The Sandbox to start
260
+ * @param {number} [timeout] - Optional timeout in seconds (0 means no timeout)
261
+ * @returns {Promise<void>}
262
+ *
263
+ * @example
264
+ * const workspace = await daytona.get('my-workspace-id');
265
+ * // Wait up to 60 seconds for the workspace to start
266
+ * await daytona.start(workspace, 60);
95
267
  */
96
- start(workspace: Workspace): Promise<void>;
268
+ start(workspace: Workspace, timeout?: number): Promise<void>;
97
269
  /**
98
- * Stops a workspace
99
- * @param {Workspace} workspace - The workspace to stop
270
+ * Stops a Sandbox.
271
+ *
272
+ * @param {Workspace} workspace - The Sandbox to stop
100
273
  * @returns {Promise<void>}
274
+ *
275
+ * @example
276
+ * const workspace = await daytona.get('my-workspace-id');
277
+ * await daytona.stop(workspace);
101
278
  */
102
279
  stop(workspace: Workspace): Promise<void>;
103
280
  /**
104
- * Removes a workspace
105
- * @param {Workspace} workspace - The workspace to remove
281
+ * Removes a Sandbox.
282
+ *
283
+ * @param {Workspace} workspace - The Sandbox to remove
284
+ * @param {number} timeout - Timeout in seconds (0 means no timeout, default is 60)
106
285
  * @returns {Promise<void>}
286
+ *
287
+ * @example
288
+ * const workspace = await daytona.get('my-workspace-id');
289
+ * await daytona.remove(workspace);
107
290
  */
108
- remove(workspace: Workspace): Promise<void>;
291
+ remove(workspace: Workspace, timeout?: number): Promise<void>;
109
292
  /**
110
- * Gets the current workspace by ID
111
- * @param {string} workspaceId - The ID of the workspace to retrieve
112
- * @returns {Promise<Workspace>} The workspace instance
293
+ * Gets the Sandbox by ID.
294
+ *
295
+ * @param {string} workspaceId - The ID of the Sandbox to retrieve
296
+ * @returns {Promise<Workspace>} The Sandbox
297
+ *
298
+ * @example
299
+ * const workspace = await daytona.getCurrentWorkspace('my-workspace-id');
300
+ * console.log(`Current workspace state: ${workspace.instance.state}`);
113
301
  */
114
302
  getCurrentWorkspace(workspaceId: string): Promise<Workspace>;
303
+ /**
304
+ * Gets the appropriate code toolbox based on language.
305
+ *
306
+ * @private
307
+ * @param {CodeLanguage} [language] - Programming language for the toolbox
308
+ * @returns {WorkspaceCodeToolbox} The appropriate code toolbox instance
309
+ * @throws {DaytonaError} - `DaytonaError` - When an unsupported language is specified
310
+ */
115
311
  private getCodeToolbox;
116
312
  }