@daytonaio/sdk 0.7.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 (215) hide show
  1. package/LICENCE +43 -0
  2. package/README.md +181 -0
  3. package/dist/Daytona.d.ts +106 -0
  4. package/dist/Daytona.js +141 -0
  5. package/dist/FileSystem.d.ts +97 -0
  6. package/dist/FileSystem.js +126 -0
  7. package/dist/Git.d.ts +67 -0
  8. package/dist/Git.js +109 -0
  9. package/dist/LspServer.d.ts +68 -0
  10. package/dist/LspServer.js +93 -0
  11. package/dist/Process.d.ts +54 -0
  12. package/dist/Process.js +84 -0
  13. package/dist/Workspace.d.ts +53 -0
  14. package/dist/Workspace.js +51 -0
  15. package/dist/client/apis/ApiKeyApi.d.ts +54 -0
  16. package/dist/client/apis/ApiKeyApi.js +135 -0
  17. package/dist/client/apis/BuildApi.d.ts +95 -0
  18. package/dist/client/apis/BuildApi.js +228 -0
  19. package/dist/client/apis/ContainerRegistryApi.d.ts +68 -0
  20. package/dist/client/apis/ContainerRegistryApi.js +163 -0
  21. package/dist/client/apis/DefaultApi.d.ts +31 -0
  22. package/dist/client/apis/DefaultApi.js +72 -0
  23. package/dist/client/apis/GitProviderApi.d.ts +197 -0
  24. package/dist/client/apis/GitProviderApi.js +477 -0
  25. package/dist/client/apis/PrebuildApi.d.ts +97 -0
  26. package/dist/client/apis/PrebuildApi.js +241 -0
  27. package/dist/client/apis/ProfileApi.d.ts +51 -0
  28. package/dist/client/apis/ProfileApi.js +128 -0
  29. package/dist/client/apis/ProjectConfigApi.d.ts +94 -0
  30. package/dist/client/apis/ProjectConfigApi.js +220 -0
  31. package/dist/client/apis/ProviderApi.d.ts +71 -0
  32. package/dist/client/apis/ProviderApi.js +160 -0
  33. package/dist/client/apis/SampleApi.d.ts +28 -0
  34. package/dist/client/apis/SampleApi.js +73 -0
  35. package/dist/client/apis/ServerApi.d.ts +61 -0
  36. package/dist/client/apis/ServerApi.js +156 -0
  37. package/dist/client/apis/TargetApi.d.ts +67 -0
  38. package/dist/client/apis/TargetApi.js +159 -0
  39. package/dist/client/apis/WorkspaceApi.d.ts +141 -0
  40. package/dist/client/apis/WorkspaceApi.js +330 -0
  41. package/dist/client/apis/WorkspaceToolboxApi.d.ts +464 -0
  42. package/dist/client/apis/WorkspaceToolboxApi.js +1248 -0
  43. package/dist/client/apis/index.d.ts +14 -0
  44. package/dist/client/apis/index.js +32 -0
  45. package/dist/client/index.d.ts +3 -0
  46. package/dist/client/index.js +21 -0
  47. package/dist/client/models/ApiKey.d.ts +45 -0
  48. package/dist/client/models/ApiKey.js +60 -0
  49. package/dist/client/models/ApikeyApiKeyType.d.ts +26 -0
  50. package/dist/client/models/ApikeyApiKeyType.js +52 -0
  51. package/dist/client/models/Build.d.ts +98 -0
  52. package/dist/client/models/Build.js +91 -0
  53. package/dist/client/models/BuildBuildState.d.ts +31 -0
  54. package/dist/client/models/BuildBuildState.js +57 -0
  55. package/dist/client/models/BuildConfig.d.ts +40 -0
  56. package/dist/client/models/BuildConfig.js +57 -0
  57. package/dist/client/models/CachedBuild.d.ts +38 -0
  58. package/dist/client/models/CachedBuild.js +55 -0
  59. package/dist/client/models/CloneTarget.d.ts +25 -0
  60. package/dist/client/models/CloneTarget.js +51 -0
  61. package/dist/client/models/CompletionContext.d.ts +38 -0
  62. package/dist/client/models/CompletionContext.js +53 -0
  63. package/dist/client/models/CompletionItem.d.ts +68 -0
  64. package/dist/client/models/CompletionItem.js +63 -0
  65. package/dist/client/models/CompletionList.d.ts +39 -0
  66. package/dist/client/models/CompletionList.js +56 -0
  67. package/dist/client/models/ContainerConfig.d.ts +38 -0
  68. package/dist/client/models/ContainerConfig.js +55 -0
  69. package/dist/client/models/ContainerRegistry.d.ts +44 -0
  70. package/dist/client/models/ContainerRegistry.js +59 -0
  71. package/dist/client/models/CreateBuildDTO.d.ts +52 -0
  72. package/dist/client/models/CreateBuildDTO.js +62 -0
  73. package/dist/client/models/CreatePrebuildDTO.d.ts +56 -0
  74. package/dist/client/models/CreatePrebuildDTO.js +59 -0
  75. package/dist/client/models/CreateProjectConfigDTO.d.ts +71 -0
  76. package/dist/client/models/CreateProjectConfigDTO.js +72 -0
  77. package/dist/client/models/CreateProjectDTO.d.ts +72 -0
  78. package/dist/client/models/CreateProjectDTO.js +73 -0
  79. package/dist/client/models/CreateProjectSourceDTO.d.ts +33 -0
  80. package/dist/client/models/CreateProjectSourceDTO.js +52 -0
  81. package/dist/client/models/CreateProviderTargetDTO.d.ts +45 -0
  82. package/dist/client/models/CreateProviderTargetDTO.js +60 -0
  83. package/dist/client/models/CreateWorkspaceDTO.d.ts +51 -0
  84. package/dist/client/models/CreateWorkspaceDTO.js +64 -0
  85. package/dist/client/models/DevcontainerConfig.d.ts +32 -0
  86. package/dist/client/models/DevcontainerConfig.js +51 -0
  87. package/dist/client/models/ExecuteRequest.d.ts +38 -0
  88. package/dist/client/models/ExecuteRequest.js +53 -0
  89. package/dist/client/models/ExecuteResponse.d.ts +38 -0
  90. package/dist/client/models/ExecuteResponse.js +55 -0
  91. package/dist/client/models/FRPSConfig.d.ts +44 -0
  92. package/dist/client/models/FRPSConfig.js +59 -0
  93. package/dist/client/models/FileInfo.d.ts +74 -0
  94. package/dist/client/models/FileInfo.js +79 -0
  95. package/dist/client/models/FileStatus.d.ts +51 -0
  96. package/dist/client/models/FileStatus.js +64 -0
  97. package/dist/client/models/GetRepositoryContext.d.ts +80 -0
  98. package/dist/client/models/GetRepositoryContext.js +67 -0
  99. package/dist/client/models/GitAddRequest.d.ts +38 -0
  100. package/dist/client/models/GitAddRequest.js +55 -0
  101. package/dist/client/models/GitBranch.d.ts +38 -0
  102. package/dist/client/models/GitBranch.js +55 -0
  103. package/dist/client/models/GitBranchRequest.d.ts +38 -0
  104. package/dist/client/models/GitBranchRequest.js +55 -0
  105. package/dist/client/models/GitCloneRequest.d.ts +62 -0
  106. package/dist/client/models/GitCloneRequest.js +63 -0
  107. package/dist/client/models/GitCommitInfo.d.ts +56 -0
  108. package/dist/client/models/GitCommitInfo.js +67 -0
  109. package/dist/client/models/GitCommitRequest.d.ts +50 -0
  110. package/dist/client/models/GitCommitRequest.js +63 -0
  111. package/dist/client/models/GitCommitResponse.d.ts +32 -0
  112. package/dist/client/models/GitCommitResponse.js +51 -0
  113. package/dist/client/models/GitNamespace.d.ts +38 -0
  114. package/dist/client/models/GitNamespace.js +55 -0
  115. package/dist/client/models/GitProvider.d.ts +75 -0
  116. package/dist/client/models/GitProvider.js +76 -0
  117. package/dist/client/models/GitPullRequest.d.ts +68 -0
  118. package/dist/client/models/GitPullRequest.js +75 -0
  119. package/dist/client/models/GitRepoRequest.d.ts +44 -0
  120. package/dist/client/models/GitRepoRequest.js +55 -0
  121. package/dist/client/models/GitRepository.d.ts +87 -0
  122. package/dist/client/models/GitRepository.js +84 -0
  123. package/dist/client/models/GitStatus.d.ts +57 -0
  124. package/dist/client/models/GitStatus.js +62 -0
  125. package/dist/client/models/GitUser.d.ts +50 -0
  126. package/dist/client/models/GitUser.js +63 -0
  127. package/dist/client/models/InstallProviderRequest.d.ts +40 -0
  128. package/dist/client/models/InstallProviderRequest.js +55 -0
  129. package/dist/client/models/ListBranchResponse.d.ts +32 -0
  130. package/dist/client/models/ListBranchResponse.js +51 -0
  131. package/dist/client/models/LogFileConfig.d.ts +62 -0
  132. package/dist/client/models/LogFileConfig.js +67 -0
  133. package/dist/client/models/LspCompletionParams.d.ts +58 -0
  134. package/dist/client/models/LspCompletionParams.js +69 -0
  135. package/dist/client/models/LspDocumentRequest.d.ts +44 -0
  136. package/dist/client/models/LspDocumentRequest.js +59 -0
  137. package/dist/client/models/LspLocation.d.ts +39 -0
  138. package/dist/client/models/LspLocation.js +56 -0
  139. package/dist/client/models/LspPosition.d.ts +38 -0
  140. package/dist/client/models/LspPosition.js +55 -0
  141. package/dist/client/models/LspRange.d.ts +39 -0
  142. package/dist/client/models/LspRange.js +56 -0
  143. package/dist/client/models/LspServerRequest.d.ts +38 -0
  144. package/dist/client/models/LspServerRequest.js +55 -0
  145. package/dist/client/models/LspSymbol.d.ts +45 -0
  146. package/dist/client/models/LspSymbol.js +60 -0
  147. package/dist/client/models/Match.d.ts +44 -0
  148. package/dist/client/models/Match.js +59 -0
  149. package/dist/client/models/NetworkKey.d.ts +32 -0
  150. package/dist/client/models/NetworkKey.js +51 -0
  151. package/dist/client/models/Position.d.ts +38 -0
  152. package/dist/client/models/Position.js +55 -0
  153. package/dist/client/models/PrebuildConfig.d.ts +56 -0
  154. package/dist/client/models/PrebuildConfig.js +67 -0
  155. package/dist/client/models/PrebuildDTO.d.ts +62 -0
  156. package/dist/client/models/PrebuildDTO.js +68 -0
  157. package/dist/client/models/ProfileData.d.ts +34 -0
  158. package/dist/client/models/ProfileData.js +51 -0
  159. package/dist/client/models/Project.d.ts +91 -0
  160. package/dist/client/models/Project.js +88 -0
  161. package/dist/client/models/ProjectConfig.d.ts +84 -0
  162. package/dist/client/models/ProjectConfig.js +87 -0
  163. package/dist/client/models/ProjectDirResponse.d.ts +32 -0
  164. package/dist/client/models/ProjectDirResponse.js +49 -0
  165. package/dist/client/models/ProjectInfo.d.ts +56 -0
  166. package/dist/client/models/ProjectInfo.js +65 -0
  167. package/dist/client/models/ProjectState.d.ts +45 -0
  168. package/dist/client/models/ProjectState.js +60 -0
  169. package/dist/client/models/Provider.d.ts +44 -0
  170. package/dist/client/models/Provider.js +57 -0
  171. package/dist/client/models/ProviderProviderInfo.d.ts +44 -0
  172. package/dist/client/models/ProviderProviderInfo.js +57 -0
  173. package/dist/client/models/ProviderProviderTargetProperty.d.ts +72 -0
  174. package/dist/client/models/ProviderProviderTargetProperty.js +64 -0
  175. package/dist/client/models/ProviderProviderTargetPropertyType.d.ts +29 -0
  176. package/dist/client/models/ProviderProviderTargetPropertyType.js +55 -0
  177. package/dist/client/models/ProviderTarget.d.ts +51 -0
  178. package/dist/client/models/ProviderTarget.js +64 -0
  179. package/dist/client/models/ReplaceRequest.d.ts +44 -0
  180. package/dist/client/models/ReplaceRequest.js +59 -0
  181. package/dist/client/models/ReplaceResult.d.ts +44 -0
  182. package/dist/client/models/ReplaceResult.js +53 -0
  183. package/dist/client/models/RepositoryUrl.d.ts +32 -0
  184. package/dist/client/models/RepositoryUrl.js +51 -0
  185. package/dist/client/models/Sample.d.ts +44 -0
  186. package/dist/client/models/Sample.js +59 -0
  187. package/dist/client/models/SearchFilesResponse.d.ts +32 -0
  188. package/dist/client/models/SearchFilesResponse.js +51 -0
  189. package/dist/client/models/ServerConfig.d.ts +130 -0
  190. package/dist/client/models/ServerConfig.js +119 -0
  191. package/dist/client/models/SetGitProviderConfig.d.ts +75 -0
  192. package/dist/client/models/SetGitProviderConfig.js +70 -0
  193. package/dist/client/models/SetProjectState.d.ts +39 -0
  194. package/dist/client/models/SetProjectState.js +56 -0
  195. package/dist/client/models/SigningMethod.d.ts +25 -0
  196. package/dist/client/models/SigningMethod.js +51 -0
  197. package/dist/client/models/Status.d.ts +31 -0
  198. package/dist/client/models/Status.js +57 -0
  199. package/dist/client/models/Workspace.d.ts +51 -0
  200. package/dist/client/models/Workspace.js +64 -0
  201. package/dist/client/models/WorkspaceDTO.d.ts +58 -0
  202. package/dist/client/models/WorkspaceDTO.js +67 -0
  203. package/dist/client/models/WorkspaceInfo.d.ts +45 -0
  204. package/dist/client/models/WorkspaceInfo.js +58 -0
  205. package/dist/client/models/index.d.ts +79 -0
  206. package/dist/client/models/index.js +97 -0
  207. package/dist/client/runtime.d.ts +182 -0
  208. package/dist/client/runtime.js +340 -0
  209. package/dist/code-toolbox/WorkspacePythonCodeToolbox.d.ts +5 -0
  210. package/dist/code-toolbox/WorkspacePythonCodeToolbox.js +13 -0
  211. package/dist/code-toolbox/WorkspaceTsCodeToolbox.d.ts +5 -0
  212. package/dist/code-toolbox/WorkspaceTsCodeToolbox.js +13 -0
  213. package/dist/index.d.ts +8 -0
  214. package/dist/index.js +13 -0
  215. package/package.json +42 -0
package/dist/Git.d.ts ADDED
@@ -0,0 +1,67 @@
1
+ import { Workspace as WorkspaceInstance, ToolboxApi, ListBranchResponse, GitStatus } from '@daytonaio/api-client';
2
+ import { Workspace } from './Workspace';
3
+ /**
4
+ * Provides Git operations within a workspace
5
+ * @class Git
6
+ */
7
+ export declare class Git {
8
+ private readonly workspace;
9
+ private readonly toolboxApi;
10
+ private readonly instance;
11
+ constructor(workspace: Workspace, toolboxApi: ToolboxApi, instance: WorkspaceInstance);
12
+ /**
13
+ * Stages files for commit
14
+ * @param {string} path - Repository path
15
+ * @param {string[]} files - Array of file paths to stage
16
+ * @returns {Promise<void>}
17
+ */
18
+ add(path: string, files: string[]): Promise<void>;
19
+ /**
20
+ * Lists branches in the repository
21
+ * @param {string} path - Repository path
22
+ * @returns {Promise<ListBranchResponse>} List of branches
23
+ */
24
+ branches(path: string): Promise<ListBranchResponse>;
25
+ /**
26
+ * Clones a Git repository
27
+ * @param {string} url - Repository URL
28
+ * @param {string} path - Destination path
29
+ * @param {string} [branch] - Branch to clone
30
+ * @param {string} [commitId] - Specific commit to clone
31
+ * @param {string} [username] - Git username for authentication
32
+ * @param {string} [password] - Git password/token for authentication
33
+ * @returns {Promise<void>}
34
+ */
35
+ clone(url: string, path: string, branch?: string, commitId?: string, username?: string, password?: string): Promise<void>;
36
+ /**
37
+ * Creates a new commit with staged changes
38
+ * @param {string} path - Repository path
39
+ * @param {string} message - Commit message
40
+ * @param {string} author - Author name
41
+ * @param {string} email - Author email
42
+ * @returns {Promise<void>}
43
+ */
44
+ commit(path: string, message: string, author: string, email: string): Promise<void>;
45
+ /**
46
+ * Pushes local commits to remote repository
47
+ * @param {string} path - Repository path
48
+ * @param {string} [username] - Git username for authentication
49
+ * @param {string} [password] - Git password/token for authentication
50
+ * @returns {Promise<void>}
51
+ */
52
+ push(path: string, username?: string, password?: string): Promise<void>;
53
+ /**
54
+ * Pulls changes from remote repository
55
+ * @param {string} path - Repository path
56
+ * @param {string} [username] - Git username for authentication
57
+ * @param {string} [password] - Git password/token for authentication
58
+ * @returns {Promise<void>}
59
+ */
60
+ pull(path: string, username?: string, password?: string): Promise<void>;
61
+ /**
62
+ * Gets the current Git repository status
63
+ * @param {string} path - Repository path
64
+ * @returns {Promise<GitStatus>} Repository status information
65
+ */
66
+ status(path: string): Promise<GitStatus>;
67
+ }
package/dist/Git.js ADDED
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Git = void 0;
4
+ /**
5
+ * Provides Git operations within a workspace
6
+ * @class Git
7
+ */
8
+ class Git {
9
+ constructor(workspace, toolboxApi, instance) {
10
+ this.workspace = workspace;
11
+ this.toolboxApi = toolboxApi;
12
+ this.instance = instance;
13
+ }
14
+ /**
15
+ * Stages files for commit
16
+ * @param {string} path - Repository path
17
+ * @param {string[]} files - Array of file paths to stage
18
+ * @returns {Promise<void>}
19
+ */
20
+ async add(path, files) {
21
+ await this.toolboxApi.gitAddFiles(this.instance.id, {
22
+ path,
23
+ files,
24
+ });
25
+ }
26
+ /**
27
+ * Lists branches in the repository
28
+ * @param {string} path - Repository path
29
+ * @returns {Promise<ListBranchResponse>} List of branches
30
+ */
31
+ async branches(path) {
32
+ const response = await this.toolboxApi.gitListBranches(this.instance.id, path);
33
+ return response.data;
34
+ }
35
+ /**
36
+ * Clones a Git repository
37
+ * @param {string} url - Repository URL
38
+ * @param {string} path - Destination path
39
+ * @param {string} [branch] - Branch to clone
40
+ * @param {string} [commitId] - Specific commit to clone
41
+ * @param {string} [username] - Git username for authentication
42
+ * @param {string} [password] - Git password/token for authentication
43
+ * @returns {Promise<void>}
44
+ */
45
+ async clone(url, path, branch, commitId, username, password) {
46
+ await this.toolboxApi.gitCloneRepository(this.instance.id, {
47
+ url: url,
48
+ branch: branch,
49
+ path,
50
+ username,
51
+ password,
52
+ commit_id: commitId
53
+ });
54
+ }
55
+ /**
56
+ * Creates a new commit with staged changes
57
+ * @param {string} path - Repository path
58
+ * @param {string} message - Commit message
59
+ * @param {string} author - Author name
60
+ * @param {string} email - Author email
61
+ * @returns {Promise<void>}
62
+ */
63
+ async commit(path, message, author, email) {
64
+ await this.toolboxApi.gitCommitChanges(this.instance.id, {
65
+ path,
66
+ message,
67
+ author,
68
+ email,
69
+ });
70
+ }
71
+ /**
72
+ * Pushes local commits to remote repository
73
+ * @param {string} path - Repository path
74
+ * @param {string} [username] - Git username for authentication
75
+ * @param {string} [password] - Git password/token for authentication
76
+ * @returns {Promise<void>}
77
+ */
78
+ async push(path, username, password) {
79
+ await this.toolboxApi.gitPushChanges(this.instance.id, {
80
+ path,
81
+ username,
82
+ password,
83
+ });
84
+ }
85
+ /**
86
+ * Pulls changes from remote repository
87
+ * @param {string} path - Repository path
88
+ * @param {string} [username] - Git username for authentication
89
+ * @param {string} [password] - Git password/token for authentication
90
+ * @returns {Promise<void>}
91
+ */
92
+ async pull(path, username, password) {
93
+ await this.toolboxApi.gitPullChanges(this.instance.id, {
94
+ path,
95
+ username,
96
+ password,
97
+ });
98
+ }
99
+ /**
100
+ * Gets the current Git repository status
101
+ * @param {string} path - Repository path
102
+ * @returns {Promise<GitStatus>} Repository status information
103
+ */
104
+ async status(path) {
105
+ const response = await this.toolboxApi.gitGetStatus(this.instance.id, path);
106
+ return response.data;
107
+ }
108
+ }
109
+ exports.Git = Git;
@@ -0,0 +1,68 @@
1
+ import { CompletionList, LspSymbol, Workspace as WorkspaceInstance, ToolboxApi } from '@daytonaio/api-client';
2
+ /**
3
+ * Supported language server types
4
+ * @typedef {('typescript')} LspLanguageId
5
+ */
6
+ export type LspLanguageId = 'typescript';
7
+ /**
8
+ * Position in a text document
9
+ * @interface Position
10
+ */
11
+ export type Position = {
12
+ /** Zero-based line number */
13
+ line: number;
14
+ /** Zero-based character offset */
15
+ character: number;
16
+ };
17
+ /**
18
+ * Provides Language Server Protocol (LSP) functionality
19
+ * @class LspServer
20
+ */
21
+ export declare class LspServer {
22
+ private readonly languageId;
23
+ private readonly pathToProject;
24
+ private readonly toolboxApi;
25
+ private readonly instance;
26
+ constructor(languageId: LspLanguageId, pathToProject: string, toolboxApi: ToolboxApi, instance: WorkspaceInstance);
27
+ /**
28
+ * Starts the language server
29
+ * @returns {Promise<void>}
30
+ */
31
+ start(): Promise<void>;
32
+ /**
33
+ * Stops the language server
34
+ * @returns {Promise<void>}
35
+ */
36
+ stop(): Promise<void>;
37
+ /**
38
+ * Notifies the server that a file has been opened
39
+ * @param {string} path - Path to the opened file
40
+ * @returns {Promise<void>}
41
+ */
42
+ didOpen(path: string): Promise<void>;
43
+ /**
44
+ * Notifies the server that a file has been closed
45
+ * @param {string} path - Path to the closed file
46
+ * @returns {Promise<void>}
47
+ */
48
+ didClose(path: string): Promise<void>;
49
+ /**
50
+ * Gets document symbols (functions, classes, etc.)
51
+ * @param {string} path - Path to the file
52
+ * @returns {Promise<LspSymbol[]>} Array of document symbols
53
+ */
54
+ documentSymbols(path: string): Promise<LspSymbol[]>;
55
+ /**
56
+ * Searches for symbols across the workspace
57
+ * @param {string} query - Search query
58
+ * @returns {Promise<LspSymbol[]>} Array of matching symbols
59
+ */
60
+ workspaceSymbols(query: string): Promise<LspSymbol[]>;
61
+ /**
62
+ * Gets code completion suggestions
63
+ * @param {string} path - Path to the file
64
+ * @param {Position} position - Cursor position
65
+ * @returns {Promise<CompletionList>} List of completion suggestions
66
+ */
67
+ completions(path: string, position: Position): Promise<CompletionList>;
68
+ }
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LspServer = void 0;
4
+ /**
5
+ * Provides Language Server Protocol (LSP) functionality
6
+ * @class LspServer
7
+ */
8
+ class LspServer {
9
+ constructor(languageId, pathToProject, toolboxApi, instance) {
10
+ this.languageId = languageId;
11
+ this.pathToProject = pathToProject;
12
+ this.toolboxApi = toolboxApi;
13
+ this.instance = instance;
14
+ }
15
+ /**
16
+ * Starts the language server
17
+ * @returns {Promise<void>}
18
+ */
19
+ async start() {
20
+ await this.toolboxApi.lspStart(this.instance.id, {
21
+ languageId: this.languageId,
22
+ pathToProject: this.pathToProject,
23
+ });
24
+ }
25
+ /**
26
+ * Stops the language server
27
+ * @returns {Promise<void>}
28
+ */
29
+ async stop() {
30
+ await this.toolboxApi.lspStop(this.instance.id, {
31
+ languageId: this.languageId,
32
+ pathToProject: this.pathToProject,
33
+ });
34
+ }
35
+ /**
36
+ * Notifies the server that a file has been opened
37
+ * @param {string} path - Path to the opened file
38
+ * @returns {Promise<void>}
39
+ */
40
+ async didOpen(path) {
41
+ await this.toolboxApi.lspDidOpen(this.instance.id, {
42
+ languageId: this.languageId,
43
+ pathToProject: this.pathToProject,
44
+ uri: 'file://' + path,
45
+ });
46
+ }
47
+ /**
48
+ * Notifies the server that a file has been closed
49
+ * @param {string} path - Path to the closed file
50
+ * @returns {Promise<void>}
51
+ */
52
+ async didClose(path) {
53
+ await this.toolboxApi.lspDidClose(this.instance.id, {
54
+ languageId: this.languageId,
55
+ pathToProject: this.pathToProject,
56
+ uri: 'file://' + path,
57
+ });
58
+ }
59
+ /**
60
+ * Gets document symbols (functions, classes, etc.)
61
+ * @param {string} path - Path to the file
62
+ * @returns {Promise<LspSymbol[]>} Array of document symbols
63
+ */
64
+ async documentSymbols(path) {
65
+ const response = await this.toolboxApi.lspDocumentSymbols(this.instance.id, this.languageId, this.pathToProject, 'file://' + path);
66
+ return response.data;
67
+ }
68
+ /**
69
+ * Searches for symbols across the workspace
70
+ * @param {string} query - Search query
71
+ * @returns {Promise<LspSymbol[]>} Array of matching symbols
72
+ */
73
+ async workspaceSymbols(query) {
74
+ const response = await this.toolboxApi.lspWorkspaceSymbols(this.instance.id, this.languageId, this.pathToProject, query);
75
+ return response.data;
76
+ }
77
+ /**
78
+ * Gets code completion suggestions
79
+ * @param {string} path - Path to the file
80
+ * @param {Position} position - Cursor position
81
+ * @returns {Promise<CompletionList>} List of completion suggestions
82
+ */
83
+ async completions(path, position) {
84
+ const response = await this.toolboxApi.lspCompletions(this.instance.id, {
85
+ languageId: this.languageId,
86
+ pathToProject: this.pathToProject,
87
+ uri: 'file://' + path,
88
+ position,
89
+ });
90
+ return response.data;
91
+ }
92
+ }
93
+ exports.LspServer = LspServer;
@@ -0,0 +1,54 @@
1
+ import { ExecuteResponse, Session, SessionExecuteRequest, SessionExecuteResponse, ToolboxApi, Workspace } from '@daytonaio/api-client';
2
+ import { WorkspaceCodeToolbox } from './Workspace';
3
+ /**
4
+ * Handles process and code execution within a workspace
5
+ * @class Process
6
+ */
7
+ export declare class Process {
8
+ private readonly codeToolbox;
9
+ private readonly toolboxApi;
10
+ private readonly instance;
11
+ constructor(codeToolbox: WorkspaceCodeToolbox, toolboxApi: ToolboxApi, instance: Workspace);
12
+ /**
13
+ * Executes a shell command in the workspace
14
+ * @param {string} command - Command to execute
15
+ * @returns {Promise<ExecuteResponse>} Command execution results
16
+ */
17
+ processExecuteCommand(command: string, timeout?: number): Promise<ExecuteResponse>;
18
+ /**
19
+ * Executes code in the workspace using the appropriate language runtime
20
+ * @param {string} code - Code to execute
21
+ * @returns {Promise<ExecuteResponse>} Code execution results
22
+ */
23
+ codeRun(code: string): Promise<ExecuteResponse>;
24
+ /**
25
+ * Creates a new exec session in the workspace
26
+ * @param {string} sessionId - Unique identifier for the session
27
+ * @returns {Promise<ExecuteResponse>} Code execution results
28
+ */
29
+ createSession(sessionId: string): Promise<void>;
30
+ /**
31
+ * Executes a command in the session
32
+ * @param {string} sessionId - Unique identifier for the session
33
+ * @param {SessionExecuteRequest} req - Command to execute and async flag
34
+ * @returns {Promise<SessionExecuteResponse>} Command execution results
35
+ */
36
+ executeSession(sessionId: string, req: SessionExecuteRequest): Promise<SessionExecuteResponse>;
37
+ /**
38
+ * Gets the logs for a command in the session
39
+ * @param {string} sessionId - Unique identifier for the session
40
+ * @param {string} commandId - Unique identifier for the command
41
+ * @returns {Promise<string>} Command logs
42
+ */
43
+ getExecuteSessionCommandLogs(sessionId: string, commandId: string): Promise<string>;
44
+ /**
45
+ * Lists all sessions in the workspace
46
+ * @returns {Promise<Session[]>} List of sessions
47
+ */
48
+ listSessions(): Promise<Session[]>;
49
+ /**
50
+ * Deletes a session in the workspace
51
+ * @param {string} sessionId - Unique identifier for the session
52
+ */
53
+ deleteSession(sessionId: string): Promise<void>;
54
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Process = void 0;
4
+ /**
5
+ * Handles process and code execution within a workspace
6
+ * @class Process
7
+ */
8
+ class Process {
9
+ constructor(codeToolbox, toolboxApi, instance) {
10
+ this.codeToolbox = codeToolbox;
11
+ this.toolboxApi = toolboxApi;
12
+ this.instance = instance;
13
+ }
14
+ /**
15
+ * Executes a shell command in the workspace
16
+ * @param {string} command - Command to execute
17
+ * @returns {Promise<ExecuteResponse>} Command execution results
18
+ */
19
+ async processExecuteCommand(command, timeout) {
20
+ const response = await this.toolboxApi.executeCommand(this.instance.id, {
21
+ command,
22
+ timeout,
23
+ });
24
+ return response.data;
25
+ }
26
+ /**
27
+ * Executes code in the workspace using the appropriate language runtime
28
+ * @param {string} code - Code to execute
29
+ * @returns {Promise<ExecuteResponse>} Code execution results
30
+ */
31
+ async codeRun(code) {
32
+ const runCommand = this.codeToolbox.getRunCommand(code);
33
+ const response = await this.toolboxApi.executeCommand(this.instance.id, {
34
+ command: runCommand,
35
+ });
36
+ return response.data;
37
+ }
38
+ /**
39
+ * Creates a new exec session in the workspace
40
+ * @param {string} sessionId - Unique identifier for the session
41
+ * @returns {Promise<ExecuteResponse>} Code execution results
42
+ */
43
+ async createSession(sessionId) {
44
+ await this.toolboxApi.createSession(this.instance.id, {
45
+ sessionId,
46
+ });
47
+ }
48
+ /**
49
+ * Executes a command in the session
50
+ * @param {string} sessionId - Unique identifier for the session
51
+ * @param {SessionExecuteRequest} req - Command to execute and async flag
52
+ * @returns {Promise<SessionExecuteResponse>} Command execution results
53
+ */
54
+ async executeSession(sessionId, req) {
55
+ const response = await this.toolboxApi.executeSessionCommand(this.instance.id, sessionId, req);
56
+ return response.data;
57
+ }
58
+ /**
59
+ * Gets the logs for a command in the session
60
+ * @param {string} sessionId - Unique identifier for the session
61
+ * @param {string} commandId - Unique identifier for the command
62
+ * @returns {Promise<string>} Command logs
63
+ */
64
+ async getExecuteSessionCommandLogs(sessionId, commandId) {
65
+ const response = await this.toolboxApi.getSessionCommandLogs(this.instance.id, sessionId, commandId);
66
+ return response.data;
67
+ }
68
+ /**
69
+ * Lists all sessions in the workspace
70
+ * @returns {Promise<Session[]>} List of sessions
71
+ */
72
+ async listSessions() {
73
+ const response = await this.toolboxApi.listSessions(this.instance.id);
74
+ return response.data;
75
+ }
76
+ /**
77
+ * Deletes a session in the workspace
78
+ * @param {string} sessionId - Unique identifier for the session
79
+ */
80
+ async deleteSession(sessionId) {
81
+ await this.toolboxApi.deleteSession(this.instance.id, sessionId);
82
+ }
83
+ }
84
+ exports.Process = Process;
@@ -0,0 +1,53 @@
1
+ import { ToolboxApi, WorkspaceApi } from '@daytonaio/api-client';
2
+ import { Workspace as WorkspaceInstance } from '@daytonaio/api-client';
3
+ import { FileSystem } from './FileSystem';
4
+ import { Git } from './Git';
5
+ import { Process } from './Process';
6
+ import { LspLanguageId, LspServer } from './LspServer';
7
+ /**
8
+ * Interface defining methods that a code toolbox must implement
9
+ * @interface WorkspaceCodeToolbox
10
+ */
11
+ export interface WorkspaceCodeToolbox {
12
+ /** Generates a command to run the provided code */
13
+ getRunCommand(code: string): string;
14
+ }
15
+ /**
16
+ * Represents a Daytona workspace instance with file system, git, and process management capabilities
17
+ * @class Workspace
18
+ */
19
+ export declare class Workspace {
20
+ readonly id: string;
21
+ private readonly instance;
22
+ readonly workspaceApi: WorkspaceApi;
23
+ readonly toolboxApi: ToolboxApi;
24
+ private readonly codeToolbox;
25
+ /** File system operations for the workspace */
26
+ readonly fs: FileSystem;
27
+ /** Git operations for the workspace */
28
+ readonly git: Git;
29
+ /** Process and code execution operations */
30
+ readonly process: Process;
31
+ /**
32
+ * Creates a new workspace instance
33
+ * @param {string} id - Unique identifier for the workspace
34
+ * @param {WorkspaceInstance} instance - The underlying workspace instance
35
+ * @param {WorkspaceApi} workspaceApi - API client for workspace operations
36
+ * @param {ToolboxApi} toolboxApi - API client for toolbox operations
37
+ *
38
+ * @param {WorkspaceCodeToolbox} codeToolbox - Language-specific toolbox implementation
39
+ */
40
+ constructor(id: string, instance: WorkspaceInstance, workspaceApi: WorkspaceApi, toolboxApi: ToolboxApi, codeToolbox: WorkspaceCodeToolbox);
41
+ /**
42
+ * Gets the root directory path of the workspace
43
+ * @returns {Promise<string>} The absolute path to the workspace root
44
+ */
45
+ getWorkspaceRootDir(): Promise<string | undefined>;
46
+ /**
47
+ * Creates a new Language Server Protocol (LSP) server instance
48
+ * @param {LspLanguageId} languageId - The language server type
49
+ * @param {string} pathToProject - Path to the project root
50
+ * @returns {LspServer} A new LSP server instance
51
+ */
52
+ createLspServer(languageId: LspLanguageId, pathToProject: string): LspServer;
53
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Workspace = void 0;
4
+ const FileSystem_1 = require("./FileSystem");
5
+ const Git_1 = require("./Git");
6
+ // import { LspLanguageId, LspServer } from './LspServer'
7
+ const Process_1 = require("./Process");
8
+ const LspServer_1 = require("./LspServer");
9
+ /**
10
+ * Represents a Daytona workspace instance with file system, git, and process management capabilities
11
+ * @class Workspace
12
+ */
13
+ class Workspace {
14
+ /**
15
+ * Creates a new workspace instance
16
+ * @param {string} id - Unique identifier for the workspace
17
+ * @param {WorkspaceInstance} instance - The underlying workspace instance
18
+ * @param {WorkspaceApi} workspaceApi - API client for workspace operations
19
+ * @param {ToolboxApi} toolboxApi - API client for toolbox operations
20
+ *
21
+ * @param {WorkspaceCodeToolbox} codeToolbox - Language-specific toolbox implementation
22
+ */
23
+ constructor(id, instance, workspaceApi, toolboxApi, codeToolbox) {
24
+ this.id = id;
25
+ this.instance = instance;
26
+ this.workspaceApi = workspaceApi;
27
+ this.toolboxApi = toolboxApi;
28
+ this.codeToolbox = codeToolbox;
29
+ this.fs = new FileSystem_1.FileSystem(instance, this.toolboxApi);
30
+ this.git = new Git_1.Git(this, this.toolboxApi, instance);
31
+ this.process = new Process_1.Process(this.codeToolbox, this.toolboxApi, instance);
32
+ }
33
+ /**
34
+ * Gets the root directory path of the workspace
35
+ * @returns {Promise<string>} The absolute path to the workspace root
36
+ */
37
+ async getWorkspaceRootDir() {
38
+ const response = await this.toolboxApi.getProjectDir(this.instance.id);
39
+ return response.data.dir;
40
+ }
41
+ /**
42
+ * Creates a new Language Server Protocol (LSP) server instance
43
+ * @param {LspLanguageId} languageId - The language server type
44
+ * @param {string} pathToProject - Path to the project root
45
+ * @returns {LspServer} A new LSP server instance
46
+ */
47
+ createLspServer(languageId, pathToProject) {
48
+ return new LspServer_1.LspServer(languageId, pathToProject, this.toolboxApi, this.instance);
49
+ }
50
+ }
51
+ exports.Workspace = Workspace;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Daytona Server API
3
+ * Daytona Server API
4
+ *
5
+ * The version of the OpenAPI document: v0.0.0-dev
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from '../runtime';
13
+ import type { ApiKey } from '../models/index';
14
+ export interface GenerateApiKeyRequest {
15
+ apiKeyName: string;
16
+ }
17
+ export interface RevokeApiKeyRequest {
18
+ apiKeyName: string;
19
+ }
20
+ /**
21
+ *
22
+ */
23
+ export declare class ApiKeyApi extends runtime.BaseAPI {
24
+ /**
25
+ * Generate an API key
26
+ * Generate an API key
27
+ */
28
+ generateApiKeyRaw(requestParameters: GenerateApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
29
+ /**
30
+ * Generate an API key
31
+ * Generate an API key
32
+ */
33
+ generateApiKey(requestParameters: GenerateApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string>;
34
+ /**
35
+ * List API keys
36
+ * List API keys
37
+ */
38
+ listClientApiKeysRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ApiKey>>>;
39
+ /**
40
+ * List API keys
41
+ * List API keys
42
+ */
43
+ listClientApiKeys(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ApiKey>>;
44
+ /**
45
+ * Revoke API key
46
+ * Revoke API key
47
+ */
48
+ revokeApiKeyRaw(requestParameters: RevokeApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
49
+ /**
50
+ * Revoke API key
51
+ * Revoke API key
52
+ */
53
+ revokeApiKey(requestParameters: RevokeApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
54
+ }