@daytonaio/sdk 0.102.0-rc.1 → 0.102.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.
- package/package.json +2 -3
- package/src/ComputerUse.d.ts +18 -18
- package/src/ComputerUse.js +42 -42
- package/src/ComputerUse.js.map +1 -1
- package/src/Daytona.d.ts +1 -1
- package/src/Daytona.js +31 -33
- package/src/Daytona.js.map +1 -1
- package/src/FileSystem.d.ts +5 -5
- package/src/FileSystem.js +17 -16
- package/src/FileSystem.js.map +1 -1
- package/src/Git.d.ts +3 -3
- package/src/Git.js +13 -13
- package/src/Git.js.map +1 -1
- package/src/LspServer.d.ts +3 -3
- package/src/LspServer.js +10 -10
- package/src/LspServer.js.map +1 -1
- package/src/Process.d.ts +3 -4
- package/src/Process.js +11 -11
- package/src/Process.js.map +1 -1
- package/src/Sandbox.d.ts +4 -6
- package/src/Sandbox.js +10 -29
- package/src/Sandbox.js.map +1 -1
- package/src/types/ExecuteResponse.d.ts +1 -1
package/src/FileSystem.js
CHANGED
|
@@ -17,12 +17,12 @@ const Runtime_1 = require("./utils/Runtime");
|
|
|
17
17
|
class FileSystem {
|
|
18
18
|
sandboxId;
|
|
19
19
|
clientConfig;
|
|
20
|
-
|
|
20
|
+
toolboxApi;
|
|
21
21
|
getRootDir;
|
|
22
|
-
constructor(sandboxId, clientConfig,
|
|
22
|
+
constructor(sandboxId, clientConfig, toolboxApi, getRootDir) {
|
|
23
23
|
this.sandboxId = sandboxId;
|
|
24
24
|
this.clientConfig = clientConfig;
|
|
25
|
-
this.
|
|
25
|
+
this.toolboxApi = toolboxApi;
|
|
26
26
|
this.getRootDir = getRootDir;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
@@ -38,7 +38,7 @@ class FileSystem {
|
|
|
38
38
|
* await fs.createFolder('app/data', '755');
|
|
39
39
|
*/
|
|
40
40
|
async createFolder(path, mode) {
|
|
41
|
-
const response = await this.
|
|
41
|
+
const response = await this.toolboxApi.createFolder(this.sandboxId, (0, Path_1.prefixRelativePath)(await this.getRootDir(), path), mode);
|
|
42
42
|
return response.data;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
@@ -46,21 +46,22 @@ class FileSystem {
|
|
|
46
46
|
*
|
|
47
47
|
* @param {string} path - Path to the file or directory to delete. Relative paths are resolved based on the user's
|
|
48
48
|
* root directory.
|
|
49
|
+
* @param {boolean} [recursive] - If the file is a directory, this must be true to delete it.
|
|
49
50
|
* @returns {Promise<void>}
|
|
50
51
|
*
|
|
51
52
|
* @example
|
|
52
53
|
* // Delete a file
|
|
53
54
|
* await fs.deleteFile('app/temp.log');
|
|
54
55
|
*/
|
|
55
|
-
async deleteFile(path) {
|
|
56
|
-
const response = await this.
|
|
56
|
+
async deleteFile(path, recursive) {
|
|
57
|
+
const response = await this.toolboxApi.deleteFile(this.sandboxId, (0, Path_1.prefixRelativePath)(await this.getRootDir(), path), undefined, recursive);
|
|
57
58
|
return response.data;
|
|
58
59
|
}
|
|
59
60
|
async downloadFile(src, dst, timeout = 30 * 60) {
|
|
60
61
|
const remotePath = (0, Path_1.prefixRelativePath)(await this.getRootDir(), src);
|
|
61
62
|
if (typeof dst !== 'string') {
|
|
62
63
|
timeout = dst;
|
|
63
|
-
const { data } = await this.
|
|
64
|
+
const { data } = await this.toolboxApi.downloadFile(this.sandboxId, remotePath, undefined, {
|
|
64
65
|
responseType: 'arraybuffer',
|
|
65
66
|
timeout: timeout * 1000,
|
|
66
67
|
});
|
|
@@ -73,7 +74,7 @@ class FileSystem {
|
|
|
73
74
|
return buffer_1.Buffer.from(await data.arrayBuffer());
|
|
74
75
|
}
|
|
75
76
|
const fs = await (0, Import_1.dynamicImport)('fs', 'Downloading file to local file is not supported: ');
|
|
76
|
-
const response = await this.
|
|
77
|
+
const response = await this.toolboxApi.downloadFile(this.sandboxId, remotePath, undefined, {
|
|
77
78
|
responseType: 'stream',
|
|
78
79
|
timeout: timeout * 1000,
|
|
79
80
|
});
|
|
@@ -100,7 +101,7 @@ class FileSystem {
|
|
|
100
101
|
* });
|
|
101
102
|
*/
|
|
102
103
|
async findFiles(path, pattern) {
|
|
103
|
-
const response = await this.
|
|
104
|
+
const response = await this.toolboxApi.findInFiles(this.sandboxId, (0, Path_1.prefixRelativePath)(await this.getRootDir(), path), pattern);
|
|
104
105
|
return response.data;
|
|
105
106
|
}
|
|
106
107
|
/**
|
|
@@ -116,7 +117,7 @@ class FileSystem {
|
|
|
116
117
|
* console.log(`Size: ${info.size}, Modified: ${info.modTime}`);
|
|
117
118
|
*/
|
|
118
119
|
async getFileDetails(path) {
|
|
119
|
-
const response = await this.
|
|
120
|
+
const response = await this.toolboxApi.getFileInfo(this.sandboxId, (0, Path_1.prefixRelativePath)(await this.getRootDir(), path));
|
|
120
121
|
return response.data;
|
|
121
122
|
}
|
|
122
123
|
/**
|
|
@@ -134,7 +135,7 @@ class FileSystem {
|
|
|
134
135
|
* });
|
|
135
136
|
*/
|
|
136
137
|
async listFiles(path) {
|
|
137
|
-
const response = await this.
|
|
138
|
+
const response = await this.toolboxApi.listFiles(this.sandboxId, undefined, (0, Path_1.prefixRelativePath)(await this.getRootDir(), path));
|
|
138
139
|
return response.data;
|
|
139
140
|
}
|
|
140
141
|
/**
|
|
@@ -151,7 +152,7 @@ class FileSystem {
|
|
|
151
152
|
* await fs.moveFiles('app/temp/data.json', 'app/data/data.json');
|
|
152
153
|
*/
|
|
153
154
|
async moveFiles(source, destination) {
|
|
154
|
-
const response = await this.
|
|
155
|
+
const response = await this.toolboxApi.moveFile(this.sandboxId, (0, Path_1.prefixRelativePath)(await this.getRootDir(), source), (0, Path_1.prefixRelativePath)(await this.getRootDir(), destination));
|
|
155
156
|
return response.data;
|
|
156
157
|
}
|
|
157
158
|
/**
|
|
@@ -179,7 +180,7 @@ class FileSystem {
|
|
|
179
180
|
newValue,
|
|
180
181
|
pattern,
|
|
181
182
|
};
|
|
182
|
-
const response = await this.
|
|
183
|
+
const response = await this.toolboxApi.replaceInFiles(this.sandboxId, replaceRequest);
|
|
183
184
|
return response.data;
|
|
184
185
|
}
|
|
185
186
|
/**
|
|
@@ -195,7 +196,7 @@ class FileSystem {
|
|
|
195
196
|
* result.files.forEach(file => console.log(file));
|
|
196
197
|
*/
|
|
197
198
|
async searchFiles(path, pattern) {
|
|
198
|
-
const response = await this.
|
|
199
|
+
const response = await this.toolboxApi.searchFiles(this.sandboxId, (0, Path_1.prefixRelativePath)(await this.getRootDir(), path), pattern);
|
|
199
200
|
return response.data;
|
|
200
201
|
}
|
|
201
202
|
/**
|
|
@@ -215,7 +216,7 @@ class FileSystem {
|
|
|
215
216
|
* });
|
|
216
217
|
*/
|
|
217
218
|
async setFilePermissions(path, permissions) {
|
|
218
|
-
const response = await this.
|
|
219
|
+
const response = await this.toolboxApi.setFilePermissions(this.sandboxId, (0, Path_1.prefixRelativePath)(await this.getRootDir(), path), undefined, permissions.owner, permissions.group, permissions.mode);
|
|
219
220
|
return response.data;
|
|
220
221
|
}
|
|
221
222
|
async uploadFile(src, dst, timeout = 30 * 60) {
|
|
@@ -272,7 +273,7 @@ class FileSystem {
|
|
|
272
273
|
});
|
|
273
274
|
}
|
|
274
275
|
else {
|
|
275
|
-
await this.
|
|
276
|
+
await this.toolboxApi.uploadFiles(this.sandboxId, undefined, {
|
|
276
277
|
data: form,
|
|
277
278
|
maxRedirects: 0,
|
|
278
279
|
timeout: timeout * 1000,
|
package/src/FileSystem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSystem.js","sourceRoot":"","sources":["../../../../libs/sdk-typescript/src/FileSystem.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH,uCAAiD;AACjD,2CAA8C;AAC9C,mCAA+B;AAC/B,6CAAkD;AAwClD;;;;GAIG;AACH,MAAa,UAAU;IAEF;IACA;IACA;IACA;IAJnB,YACmB,SAAiB,EACjB,YAA2B,EAC3B,
|
|
1
|
+
{"version":3,"file":"FileSystem.js","sourceRoot":"","sources":["../../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
package/src/Git.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ToolboxApi, ListBranchResponse, GitStatus } from '@daytonaio/api-client';
|
|
2
2
|
/**
|
|
3
3
|
* Response from the git commit.
|
|
4
4
|
*
|
|
@@ -15,9 +15,9 @@ export interface GitCommitResponse {
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class Git {
|
|
17
17
|
private readonly sandboxId;
|
|
18
|
-
private readonly
|
|
18
|
+
private readonly toolboxApi;
|
|
19
19
|
private readonly getRootDir;
|
|
20
|
-
constructor(sandboxId: string,
|
|
20
|
+
constructor(sandboxId: string, toolboxApi: ToolboxApi, getRootDir: () => Promise<string>);
|
|
21
21
|
/**
|
|
22
22
|
* Stages the specified files for the next commit, similar to
|
|
23
23
|
* running 'git add' on the command line.
|
package/src/Git.js
CHANGED
|
@@ -13,11 +13,11 @@ const Path_1 = require("./utils/Path");
|
|
|
13
13
|
*/
|
|
14
14
|
class Git {
|
|
15
15
|
sandboxId;
|
|
16
|
-
|
|
16
|
+
toolboxApi;
|
|
17
17
|
getRootDir;
|
|
18
|
-
constructor(sandboxId,
|
|
18
|
+
constructor(sandboxId, toolboxApi, getRootDir) {
|
|
19
19
|
this.sandboxId = sandboxId;
|
|
20
|
-
this.
|
|
20
|
+
this.toolboxApi = toolboxApi;
|
|
21
21
|
this.getRootDir = getRootDir;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
@@ -38,7 +38,7 @@ class Git {
|
|
|
38
38
|
* await git.add('workspace/repo', ['.']);
|
|
39
39
|
*/
|
|
40
40
|
async add(path, files) {
|
|
41
|
-
await this.
|
|
41
|
+
await this.toolboxApi.gitAddFiles(this.sandboxId, {
|
|
42
42
|
path: (0, Path_1.prefixRelativePath)(await this.getRootDir(), path),
|
|
43
43
|
files,
|
|
44
44
|
});
|
|
@@ -55,7 +55,7 @@ class Git {
|
|
|
55
55
|
* console.log(`Branches: ${response.branches}`);
|
|
56
56
|
*/
|
|
57
57
|
async branches(path) {
|
|
58
|
-
const response = await this.
|
|
58
|
+
const response = await this.toolboxApi.gitListBranches(this.sandboxId, (0, Path_1.prefixRelativePath)(await this.getRootDir(), path));
|
|
59
59
|
return response.data;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
@@ -70,7 +70,7 @@ class Git {
|
|
|
70
70
|
* await git.createBranch('workspace/repo', 'new-feature');
|
|
71
71
|
*/
|
|
72
72
|
async createBranch(path, name) {
|
|
73
|
-
await this.
|
|
73
|
+
await this.toolboxApi.gitCreateBranch(this.sandboxId, {
|
|
74
74
|
path: (0, Path_1.prefixRelativePath)(await this.getRootDir(), path),
|
|
75
75
|
name,
|
|
76
76
|
});
|
|
@@ -88,7 +88,7 @@ class Git {
|
|
|
88
88
|
* await git.deleteBranch('workspace/repo', 'new-feature');
|
|
89
89
|
*/
|
|
90
90
|
async deleteBranch(path, name) {
|
|
91
|
-
await this.
|
|
91
|
+
await this.toolboxApi.gitDeleteBranch(this.sandboxId, {
|
|
92
92
|
path: (0, Path_1.prefixRelativePath)(await this.getRootDir(), path),
|
|
93
93
|
name,
|
|
94
94
|
});
|
|
@@ -106,7 +106,7 @@ class Git {
|
|
|
106
106
|
* await git.checkoutBranch('workspace/repo', 'new-feature');
|
|
107
107
|
*/
|
|
108
108
|
async checkoutBranch(path, branch) {
|
|
109
|
-
await this.
|
|
109
|
+
await this.toolboxApi.gitCheckoutBranch(this.sandboxId, {
|
|
110
110
|
path: (0, Path_1.prefixRelativePath)(await this.getRootDir(), path),
|
|
111
111
|
branch,
|
|
112
112
|
});
|
|
@@ -152,7 +152,7 @@ class Git {
|
|
|
152
152
|
* );
|
|
153
153
|
*/
|
|
154
154
|
async clone(url, path, branch, commitId, username, password) {
|
|
155
|
-
await this.
|
|
155
|
+
await this.toolboxApi.gitCloneRepository(this.sandboxId, {
|
|
156
156
|
url: url,
|
|
157
157
|
branch: branch,
|
|
158
158
|
path: (0, Path_1.prefixRelativePath)(await this.getRootDir(), path),
|
|
@@ -185,7 +185,7 @@ class Git {
|
|
|
185
185
|
*
|
|
186
186
|
*/
|
|
187
187
|
async commit(path, message, author, email, allowEmpty) {
|
|
188
|
-
const response = await this.
|
|
188
|
+
const response = await this.toolboxApi.gitCommitChanges(this.sandboxId, {
|
|
189
189
|
path: (0, Path_1.prefixRelativePath)(await this.getRootDir(), path),
|
|
190
190
|
message,
|
|
191
191
|
author,
|
|
@@ -218,7 +218,7 @@ class Git {
|
|
|
218
218
|
* );
|
|
219
219
|
*/
|
|
220
220
|
async push(path, username, password) {
|
|
221
|
-
await this.
|
|
221
|
+
await this.toolboxApi.gitPushChanges(this.sandboxId, {
|
|
222
222
|
path: (0, Path_1.prefixRelativePath)(await this.getRootDir(), path),
|
|
223
223
|
username,
|
|
224
224
|
password,
|
|
@@ -246,7 +246,7 @@ class Git {
|
|
|
246
246
|
* );
|
|
247
247
|
*/
|
|
248
248
|
async pull(path, username, password) {
|
|
249
|
-
await this.
|
|
249
|
+
await this.toolboxApi.gitPullChanges(this.sandboxId, {
|
|
250
250
|
path: (0, Path_1.prefixRelativePath)(await this.getRootDir(), path),
|
|
251
251
|
username,
|
|
252
252
|
password,
|
|
@@ -271,7 +271,7 @@ class Git {
|
|
|
271
271
|
* console.log(`Commits behind: ${status.behind}`);
|
|
272
272
|
*/
|
|
273
273
|
async status(path) {
|
|
274
|
-
const response = await this.
|
|
274
|
+
const response = await this.toolboxApi.gitGetStatus(this.sandboxId, (0, Path_1.prefixRelativePath)(await this.getRootDir(), path));
|
|
275
275
|
return response.data;
|
|
276
276
|
}
|
|
277
277
|
}
|
package/src/Git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Git.js","sourceRoot":"","sources":["../../../../libs/sdk-typescript/src/Git.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uCAAiD;AAYjD;;;;GAIG;AACH,MAAa,GAAG;IAEK;IACA;IACA;IAHnB,YACmB,SAAiB,EACjB,
|
|
1
|
+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supported language server types.
|
|
4
4
|
*/
|
|
@@ -41,9 +41,9 @@ export type Position = {
|
|
|
41
41
|
export declare class LspServer {
|
|
42
42
|
private readonly languageId;
|
|
43
43
|
private readonly pathToProject;
|
|
44
|
-
private readonly
|
|
44
|
+
private readonly toolboxApi;
|
|
45
45
|
private readonly sandboxId;
|
|
46
|
-
constructor(languageId: LspLanguageId, pathToProject: string,
|
|
46
|
+
constructor(languageId: LspLanguageId, pathToProject: string, toolboxApi: ToolboxApi, sandboxId: string);
|
|
47
47
|
/**
|
|
48
48
|
* Starts the language server, must be called before using any other LSP functionality.
|
|
49
49
|
* It initializes the language server for the specified language and project.
|
package/src/LspServer.js
CHANGED
|
@@ -29,12 +29,12 @@ var LspLanguageId;
|
|
|
29
29
|
class LspServer {
|
|
30
30
|
languageId;
|
|
31
31
|
pathToProject;
|
|
32
|
-
|
|
32
|
+
toolboxApi;
|
|
33
33
|
sandboxId;
|
|
34
|
-
constructor(languageId, pathToProject,
|
|
34
|
+
constructor(languageId, pathToProject, toolboxApi, sandboxId) {
|
|
35
35
|
this.languageId = languageId;
|
|
36
36
|
this.pathToProject = pathToProject;
|
|
37
|
-
this.
|
|
37
|
+
this.toolboxApi = toolboxApi;
|
|
38
38
|
this.sandboxId = sandboxId;
|
|
39
39
|
if (!Object.values(LspLanguageId).includes(this.languageId)) {
|
|
40
40
|
throw new Error(`Invalid languageId: ${this.languageId}. Supported values are: ${Object.values(LspLanguageId).join(', ')}`);
|
|
@@ -52,7 +52,7 @@ class LspServer {
|
|
|
52
52
|
* // Now ready for LSP operations
|
|
53
53
|
*/
|
|
54
54
|
async start() {
|
|
55
|
-
await this.
|
|
55
|
+
await this.toolboxApi.lspStart(this.sandboxId, {
|
|
56
56
|
languageId: this.languageId,
|
|
57
57
|
pathToProject: this.pathToProject,
|
|
58
58
|
});
|
|
@@ -68,7 +68,7 @@ class LspServer {
|
|
|
68
68
|
* await lsp.stop(); // Clean up resources
|
|
69
69
|
*/
|
|
70
70
|
async stop() {
|
|
71
|
-
await this.
|
|
71
|
+
await this.toolboxApi.lspStop(this.sandboxId, {
|
|
72
72
|
languageId: this.languageId,
|
|
73
73
|
pathToProject: this.pathToProject,
|
|
74
74
|
});
|
|
@@ -88,7 +88,7 @@ class LspServer {
|
|
|
88
88
|
* // Now can get completions, symbols, etc. for this file
|
|
89
89
|
*/
|
|
90
90
|
async didOpen(path) {
|
|
91
|
-
await this.
|
|
91
|
+
await this.toolboxApi.lspDidOpen(this.sandboxId, {
|
|
92
92
|
languageId: this.languageId,
|
|
93
93
|
pathToProject: this.pathToProject,
|
|
94
94
|
uri: 'file://' + (0, Path_1.prefixRelativePath)(this.pathToProject, path),
|
|
@@ -107,7 +107,7 @@ class LspServer {
|
|
|
107
107
|
* await lsp.didClose('workspace/project/src/index.ts');
|
|
108
108
|
*/
|
|
109
109
|
async didClose(path) {
|
|
110
|
-
await this.
|
|
110
|
+
await this.toolboxApi.lspDidClose(this.sandboxId, {
|
|
111
111
|
languageId: this.languageId,
|
|
112
112
|
pathToProject: this.pathToProject,
|
|
113
113
|
uri: 'file://' + (0, Path_1.prefixRelativePath)(this.pathToProject, path),
|
|
@@ -131,7 +131,7 @@ class LspServer {
|
|
|
131
131
|
* });
|
|
132
132
|
*/
|
|
133
133
|
async documentSymbols(path) {
|
|
134
|
-
const response = await this.
|
|
134
|
+
const response = await this.toolboxApi.lspDocumentSymbols(this.sandboxId, this.languageId, this.pathToProject, 'file://' + (0, Path_1.prefixRelativePath)(this.pathToProject, path));
|
|
135
135
|
return response.data;
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
@@ -165,7 +165,7 @@ class LspServer {
|
|
|
165
165
|
* });
|
|
166
166
|
*/
|
|
167
167
|
async sandboxSymbols(query) {
|
|
168
|
-
const response = await this.
|
|
168
|
+
const response = await this.toolboxApi.lspWorkspaceSymbols(this.sandboxId, this.languageId, this.pathToProject, query);
|
|
169
169
|
return response.data;
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
@@ -196,7 +196,7 @@ class LspServer {
|
|
|
196
196
|
* });
|
|
197
197
|
*/
|
|
198
198
|
async completions(path, position) {
|
|
199
|
-
const response = await this.
|
|
199
|
+
const response = await this.toolboxApi.lspCompletions(this.sandboxId, {
|
|
200
200
|
languageId: this.languageId,
|
|
201
201
|
pathToProject: this.pathToProject,
|
|
202
202
|
uri: 'file://' + (0, Path_1.prefixRelativePath)(this.pathToProject, path),
|
package/src/LspServer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LspServer.js","sourceRoot":"","sources":["../../../../libs/sdk-typescript/src/LspServer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uCAAiD;AAEjD;;GAEG;AACH,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,0CAAyB,CAAA;IACzB,0CAAyB,CAAA;AAC3B,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAuBD;;;;;;;;;;GAUG;AACH,MAAa,SAAS;IAED;IACA;IACA;IACA;IAJnB,YACmB,UAAyB,EACzB,aAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"LspServer.js","sourceRoot":"","sources":["../../../../libs/sdk-typescript/src/LspServer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uCAAiD;AAEjD;;GAEG;AACH,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,0CAAyB,CAAA;IACzB,0CAAyB,CAAA;AAC3B,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAuBD;;;;;;;;;;GAUG;AACH,MAAa,SAAS;IAED;IACA;IACA;IACA;IAJnB,YACmB,UAAyB,EACzB,aAAqB,EACrB,UAAsB,EACtB,SAAiB;QAHjB,eAAU,GAAV,UAAU,CAAe;QACzB,kBAAa,GAAb,aAAa,CAAQ;QACrB,eAAU,GAAV,UAAU,CAAY;QACtB,cAAS,GAAT,SAAS,CAAQ;QAElC,IAAI,CAAC,MAAM,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AQ,CAAC,IAAI,CAAA;IACtB,CAAC;CACF;AAnMD,8BAmMC"}
|
package/src/Process.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Configuration, PortPreviewUrl } from '@daytonaio/api-client';
|
|
2
|
-
import { ProcessApi, Command, Session, SessionExecuteRequest, SessionExecuteResponse as ApiSessionExecuteResponse } from '@daytonaio/daemon-api-client';
|
|
1
|
+
import { Command, Configuration, Session, SessionExecuteRequest, SessionExecuteResponse as ApiSessionExecuteResponse, PortPreviewUrl, ToolboxApi } from '@daytonaio/api-client';
|
|
3
2
|
import { SandboxCodeToolbox } from './Sandbox';
|
|
4
3
|
import { ExecuteResponse } from './types/ExecuteResponse';
|
|
5
4
|
export declare const STDOUT_PREFIX_BYTES: Uint8Array<ArrayBuffer>;
|
|
@@ -36,10 +35,10 @@ export declare class Process {
|
|
|
36
35
|
private readonly sandboxId;
|
|
37
36
|
private readonly clientConfig;
|
|
38
37
|
private readonly codeToolbox;
|
|
39
|
-
private readonly
|
|
38
|
+
private readonly toolboxApi;
|
|
40
39
|
private readonly getRootDir;
|
|
41
40
|
private readonly getPreviewLink;
|
|
42
|
-
constructor(sandboxId: string, clientConfig: Configuration, codeToolbox: SandboxCodeToolbox,
|
|
41
|
+
constructor(sandboxId: string, clientConfig: Configuration, codeToolbox: SandboxCodeToolbox, toolboxApi: ToolboxApi, getRootDir: () => Promise<string>, getPreviewLink: (port: number) => Promise<PortPreviewUrl>);
|
|
43
42
|
/**
|
|
44
43
|
* Executes a shell command in the Sandbox.
|
|
45
44
|
*
|
package/src/Process.js
CHANGED
|
@@ -38,14 +38,14 @@ class Process {
|
|
|
38
38
|
sandboxId;
|
|
39
39
|
clientConfig;
|
|
40
40
|
codeToolbox;
|
|
41
|
-
|
|
41
|
+
toolboxApi;
|
|
42
42
|
getRootDir;
|
|
43
43
|
getPreviewLink;
|
|
44
|
-
constructor(sandboxId, clientConfig, codeToolbox,
|
|
44
|
+
constructor(sandboxId, clientConfig, codeToolbox, toolboxApi, getRootDir, getPreviewLink) {
|
|
45
45
|
this.sandboxId = sandboxId;
|
|
46
46
|
this.clientConfig = clientConfig;
|
|
47
47
|
this.codeToolbox = codeToolbox;
|
|
48
|
-
this.
|
|
48
|
+
this.toolboxApi = toolboxApi;
|
|
49
49
|
this.getRootDir = getRootDir;
|
|
50
50
|
this.getPreviewLink = getPreviewLink;
|
|
51
51
|
}
|
|
@@ -88,7 +88,7 @@ class Process {
|
|
|
88
88
|
command = `${safeEnvExports} ${command}`;
|
|
89
89
|
}
|
|
90
90
|
command = `sh -c "${command}"`;
|
|
91
|
-
const response = await this.
|
|
91
|
+
const response = await this.toolboxApi.executeCommand(this.sandboxId, {
|
|
92
92
|
command,
|
|
93
93
|
timeout,
|
|
94
94
|
cwd: cwd ?? (await this.getRootDir()),
|
|
@@ -183,7 +183,7 @@ class Process {
|
|
|
183
183
|
* await process.deleteSession(sessionId);
|
|
184
184
|
*/
|
|
185
185
|
async createSession(sessionId) {
|
|
186
|
-
await this.
|
|
186
|
+
await this.toolboxApi.createSession(this.sandboxId, {
|
|
187
187
|
sessionId,
|
|
188
188
|
});
|
|
189
189
|
}
|
|
@@ -202,7 +202,7 @@ class Process {
|
|
|
202
202
|
* });
|
|
203
203
|
*/
|
|
204
204
|
async getSession(sessionId) {
|
|
205
|
-
const response = await this.
|
|
205
|
+
const response = await this.toolboxApi.getSession(this.sandboxId, sessionId);
|
|
206
206
|
return response.data;
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
@@ -222,7 +222,7 @@ class Process {
|
|
|
222
222
|
* }
|
|
223
223
|
*/
|
|
224
224
|
async getSessionCommand(sessionId, commandId) {
|
|
225
|
-
const response = await this.
|
|
225
|
+
const response = await this.toolboxApi.getSessionCommand(this.sandboxId, sessionId, commandId);
|
|
226
226
|
return response.data;
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
@@ -257,7 +257,7 @@ class Process {
|
|
|
257
257
|
* console.log('[STDERR]:', result.stderr);
|
|
258
258
|
*/
|
|
259
259
|
async executeSessionCommand(sessionId, req, timeout) {
|
|
260
|
-
const response = await this.
|
|
260
|
+
const response = await this.toolboxApi.executeSessionCommand(this.sandboxId, sessionId, req, undefined, timeout ? { timeout: timeout * 1000 } : {});
|
|
261
261
|
// Demux the output if it exists
|
|
262
262
|
if (response.data.output) {
|
|
263
263
|
// Convert string to bytes for demuxing
|
|
@@ -273,7 +273,7 @@ class Process {
|
|
|
273
273
|
}
|
|
274
274
|
async getSessionCommandLogs(sessionId, commandId, onStdout, onStderr) {
|
|
275
275
|
if (!onStdout && !onStderr) {
|
|
276
|
-
const response = await this.
|
|
276
|
+
const response = await this.toolboxApi.getSessionCommandLogs(this.sandboxId, sessionId, commandId);
|
|
277
277
|
// Parse the response data if it's available
|
|
278
278
|
if (response.data) {
|
|
279
279
|
// Convert string to bytes for demuxing
|
|
@@ -320,7 +320,7 @@ class Process {
|
|
|
320
320
|
* });
|
|
321
321
|
*/
|
|
322
322
|
async listSessions() {
|
|
323
|
-
const response = await this.
|
|
323
|
+
const response = await this.toolboxApi.listSessions(this.sandboxId);
|
|
324
324
|
return response.data;
|
|
325
325
|
}
|
|
326
326
|
/**
|
|
@@ -334,7 +334,7 @@ class Process {
|
|
|
334
334
|
* await process.deleteSession('my-session');
|
|
335
335
|
*/
|
|
336
336
|
async deleteSession(sessionId) {
|
|
337
|
-
await this.
|
|
337
|
+
await this.toolboxApi.deleteSession(this.sandboxId, sessionId);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
exports.Process = Process;
|
package/src/Process.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Process.js","sourceRoot":"","sources":["../../../../libs/sdk-typescript/src/Process.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;
|
|
1
|
+
{"version":3,"file":"Process.js","sourceRoot":"","sources":["../../../../libs/sdk-typescript/src/Process.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAaH,2DAAuD;AACvD,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B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,IAAI,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClC,KAAK,GAAG,KAAK,CAAA;gBACb,MAAK;YACP,CAAC;QACH,CAAC;QACD,IAAI,KAAK;YAAE,OAAO,CAAC,CAAA;IACrB,CAAC;IACD,OAAO,CAAC,CAAC,CAAA;AACX,CAAC"}
|
package/src/Sandbox.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { SandboxState, SandboxApi, Sandbox as SandboxDto, PortPreviewUrl, SandboxVolume, BuildInfo, SandboxBackupStateEnum, Configuration, SshAccessDto, SshAccessValidationDto } from '@daytonaio/api-client';
|
|
1
|
+
import { ToolboxApi, SandboxState, SandboxApi, Sandbox as SandboxDto, PortPreviewUrl, SandboxVolume, BuildInfo, SandboxBackupStateEnum, Configuration, SshAccessDto, SshAccessValidationDto } from '@daytonaio/api-client';
|
|
2
2
|
import { FileSystem } from './FileSystem';
|
|
3
3
|
import { Git } from './Git';
|
|
4
4
|
import { CodeRunParams, Process } from './Process';
|
|
5
5
|
import { LspLanguageId, LspServer } from './LspServer';
|
|
6
6
|
import { ComputerUse } from './ComputerUse';
|
|
7
|
-
import { AxiosInstance } from 'axios';
|
|
8
7
|
/**
|
|
9
8
|
* Interface defining methods that a code toolbox must implement
|
|
10
9
|
* @interface
|
|
@@ -51,8 +50,8 @@ export interface SandboxCodeToolbox {
|
|
|
51
50
|
*/
|
|
52
51
|
export declare class Sandbox implements SandboxDto {
|
|
53
52
|
private readonly clientConfig;
|
|
54
|
-
private readonly axiosInstance;
|
|
55
53
|
private readonly sandboxApi;
|
|
54
|
+
private readonly toolboxApi;
|
|
56
55
|
private readonly codeToolbox;
|
|
57
56
|
readonly fs: FileSystem;
|
|
58
57
|
readonly git: Git;
|
|
@@ -85,16 +84,15 @@ export declare class Sandbox implements SandboxDto {
|
|
|
85
84
|
networkBlockAll: boolean;
|
|
86
85
|
networkAllowList?: string;
|
|
87
86
|
private rootDir;
|
|
88
|
-
private infoApi;
|
|
89
87
|
/**
|
|
90
88
|
* Creates a new Sandbox instance
|
|
91
89
|
*
|
|
92
90
|
* @param {SandboxDto} sandboxDto - The API Sandbox instance
|
|
93
91
|
* @param {SandboxApi} sandboxApi - API client for Sandbox operations
|
|
94
|
-
* @param {
|
|
92
|
+
* @param {ToolboxApi} toolboxApi - API client for toolbox operations
|
|
95
93
|
* @param {SandboxCodeToolbox} codeToolbox - Language-specific toolbox implementation
|
|
96
94
|
*/
|
|
97
|
-
constructor(sandboxDto: SandboxDto, clientConfig: Configuration,
|
|
95
|
+
constructor(sandboxDto: SandboxDto, clientConfig: Configuration, sandboxApi: SandboxApi, toolboxApi: ToolboxApi, codeToolbox: SandboxCodeToolbox);
|
|
98
96
|
/**
|
|
99
97
|
* Gets the root directory path for the logged in user inside the Sandbox.
|
|
100
98
|
*
|