@daytonaio/sdk 0.172.0 → 0.175.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 (202) hide show
  1. package/LICENSE +190 -0
  2. package/{src → cjs}/CodeInterpreter.d.ts +1 -0
  3. package/cjs/CodeInterpreter.js.map +1 -0
  4. package/{src → cjs}/ComputerUse.d.ts +1 -0
  5. package/cjs/ComputerUse.js.map +1 -0
  6. package/{src → cjs}/Daytona.d.ts +1 -0
  7. package/{src → cjs}/Daytona.js +19 -17
  8. package/cjs/Daytona.js.map +1 -0
  9. package/{src → cjs}/FileSystem.d.ts +88 -5
  10. package/{src → cjs}/FileSystem.js +121 -35
  11. package/cjs/FileSystem.js.map +1 -0
  12. package/{src → cjs}/Git.d.ts +1 -0
  13. package/cjs/Git.js.map +1 -0
  14. package/{src → cjs}/Image.d.ts +1 -0
  15. package/cjs/Image.js.map +1 -0
  16. package/{src → cjs}/LspServer.d.ts +1 -0
  17. package/cjs/LspServer.js.map +1 -0
  18. package/{src → cjs}/ObjectStorage.d.ts +1 -0
  19. package/cjs/ObjectStorage.js.map +1 -0
  20. package/{src → cjs}/Process.d.ts +1 -0
  21. package/cjs/Process.js.map +1 -0
  22. package/{src → cjs}/PtyHandle.d.ts +1 -0
  23. package/cjs/PtyHandle.js.map +1 -0
  24. package/cjs/README.md +180 -0
  25. package/{src → cjs}/Sandbox.d.ts +1 -0
  26. package/cjs/Sandbox.js.map +1 -0
  27. package/{src → cjs}/Snapshot.d.ts +1 -0
  28. package/cjs/Snapshot.js.map +1 -0
  29. package/{src → cjs}/Volume.d.ts +1 -0
  30. package/cjs/Volume.js.map +1 -0
  31. package/{src → cjs}/errors/DaytonaError.d.ts +1 -0
  32. package/cjs/errors/DaytonaError.js.map +1 -0
  33. package/{src → cjs}/index.d.ts +2 -1
  34. package/cjs/index.js.map +1 -0
  35. package/cjs/package.json +3 -0
  36. package/{src → cjs}/types/Charts.d.ts +1 -0
  37. package/cjs/types/Charts.js.map +1 -0
  38. package/{src → cjs}/types/CodeInterpreter.d.ts +1 -0
  39. package/cjs/types/CodeInterpreter.js.map +1 -0
  40. package/{src → cjs}/types/ExecuteResponse.d.ts +1 -0
  41. package/cjs/types/ExecuteResponse.js.map +1 -0
  42. package/{src → cjs}/types/Pty.d.ts +1 -0
  43. package/cjs/types/Pty.js.map +1 -0
  44. package/{src → cjs}/utils/Binary.d.ts +1 -1
  45. package/{src → cjs}/utils/Binary.js +8 -2
  46. package/cjs/utils/Binary.js.map +1 -0
  47. package/cjs/utils/FileTransfer.d.ts +39 -0
  48. package/cjs/utils/FileTransfer.js +521 -0
  49. package/cjs/utils/FileTransfer.js.map +1 -0
  50. package/cjs/utils/Import.d.ts +40 -0
  51. package/cjs/utils/Import.js +155 -0
  52. package/cjs/utils/Import.js.map +1 -0
  53. package/{src → cjs}/utils/Multipart.d.ts +1 -0
  54. package/cjs/utils/Multipart.js.map +1 -0
  55. package/{src → cjs}/utils/Runtime.d.ts +1 -0
  56. package/cjs/utils/Runtime.js.map +1 -0
  57. package/{src → cjs}/utils/Stream.d.ts +1 -0
  58. package/cjs/utils/Stream.js.map +1 -0
  59. package/{src → cjs}/utils/WebSocket.d.ts +1 -0
  60. package/cjs/utils/WebSocket.js.map +1 -0
  61. package/{src → cjs}/utils/otel.decorator.d.ts +1 -0
  62. package/cjs/utils/otel.decorator.js.map +1 -0
  63. package/esm/CodeInterpreter.d.ts +95 -0
  64. package/esm/CodeInterpreter.js +292 -0
  65. package/esm/CodeInterpreter.js.map +1 -0
  66. package/esm/ComputerUse.d.ts +539 -0
  67. package/esm/ComputerUse.js +799 -0
  68. package/esm/ComputerUse.js.map +1 -0
  69. package/esm/Daytona.d.ts +357 -0
  70. package/esm/Daytona.js +530 -0
  71. package/esm/Daytona.js.map +1 -0
  72. package/esm/FileSystem.d.ts +453 -0
  73. package/esm/FileSystem.js +571 -0
  74. package/esm/FileSystem.js.map +1 -0
  75. package/esm/Git.d.ts +203 -0
  76. package/esm/Git.js +322 -0
  77. package/esm/Git.js.map +1 -0
  78. package/esm/Image.d.ts +265 -0
  79. package/esm/Image.js +581 -0
  80. package/esm/Image.js.map +1 -0
  81. package/esm/LspServer.d.ts +172 -0
  82. package/esm/LspServer.js +255 -0
  83. package/esm/LspServer.js.map +1 -0
  84. package/esm/ObjectStorage.d.ts +79 -0
  85. package/esm/ObjectStorage.js +195 -0
  86. package/esm/ObjectStorage.js.map +1 -0
  87. package/esm/Process.d.ts +490 -0
  88. package/esm/Process.js +642 -0
  89. package/esm/Process.js.map +1 -0
  90. package/esm/PtyHandle.d.ts +155 -0
  91. package/esm/PtyHandle.js +412 -0
  92. package/esm/PtyHandle.js.map +1 -0
  93. package/esm/README.md +180 -0
  94. package/esm/Sandbox.d.ts +476 -0
  95. package/esm/Sandbox.js +901 -0
  96. package/esm/Sandbox.js.map +1 -0
  97. package/esm/Snapshot.d.ts +140 -0
  98. package/esm/Snapshot.js +244 -0
  99. package/esm/Snapshot.js.map +1 -0
  100. package/esm/Volume.d.ts +84 -0
  101. package/esm/Volume.js +115 -0
  102. package/esm/Volume.js.map +1 -0
  103. package/esm/errors/DaytonaError.d.ts +171 -0
  104. package/esm/errors/DaytonaError.js +243 -0
  105. package/esm/errors/DaytonaError.js.map +1 -0
  106. package/esm/index.d.ts +22 -0
  107. package/esm/index.js +21 -0
  108. package/esm/index.js.map +1 -0
  109. package/esm/package.json +3 -0
  110. package/esm/types/Charts.d.ts +38 -0
  111. package/esm/types/Charts.js +33 -0
  112. package/esm/types/Charts.js.map +1 -0
  113. package/esm/types/CodeInterpreter.d.ts +77 -0
  114. package/esm/types/CodeInterpreter.js +6 -0
  115. package/esm/types/CodeInterpreter.js.map +1 -0
  116. package/esm/types/ExecuteResponse.d.ts +26 -0
  117. package/esm/types/ExecuteResponse.js +6 -0
  118. package/esm/types/ExecuteResponse.js.map +1 -0
  119. package/esm/types/Pty.d.ts +48 -0
  120. package/esm/types/Pty.js +6 -0
  121. package/esm/types/Pty.js.map +1 -0
  122. package/esm/utils/Binary.d.ts +38 -0
  123. package/esm/utils/Binary.js +163 -0
  124. package/esm/utils/Binary.js.map +1 -0
  125. package/esm/utils/FileTransfer.d.ts +39 -0
  126. package/esm/utils/FileTransfer.js +512 -0
  127. package/esm/utils/FileTransfer.js.map +1 -0
  128. package/esm/utils/Import.d.ts +40 -0
  129. package/esm/utils/Import.js +119 -0
  130. package/esm/utils/Import.js.map +1 -0
  131. package/esm/utils/Multipart.d.ts +29 -0
  132. package/esm/utils/Multipart.js +109 -0
  133. package/esm/utils/Multipart.js.map +1 -0
  134. package/esm/utils/Runtime.d.ts +44 -0
  135. package/esm/utils/Runtime.js +89 -0
  136. package/esm/utils/Runtime.js.map +1 -0
  137. package/esm/utils/Stream.d.ts +20 -0
  138. package/esm/utils/Stream.js +360 -0
  139. package/esm/utils/Stream.js.map +1 -0
  140. package/esm/utils/WebSocket.d.ts +10 -0
  141. package/esm/utils/WebSocket.js +22 -0
  142. package/esm/utils/WebSocket.js.map +1 -0
  143. package/esm/utils/otel.decorator.d.ts +83 -0
  144. package/esm/utils/otel.decorator.js +136 -0
  145. package/esm/utils/otel.decorator.js.map +1 -0
  146. package/package.json +55 -15
  147. package/src/CodeInterpreter.js.map +0 -1
  148. package/src/ComputerUse.js.map +0 -1
  149. package/src/Daytona.js.map +0 -1
  150. package/src/FileSystem.js.map +0 -1
  151. package/src/Git.js.map +0 -1
  152. package/src/Image.js.map +0 -1
  153. package/src/LspServer.js.map +0 -1
  154. package/src/ObjectStorage.js.map +0 -1
  155. package/src/Process.js.map +0 -1
  156. package/src/PtyHandle.js.map +0 -1
  157. package/src/Sandbox.js.map +0 -1
  158. package/src/Snapshot.js.map +0 -1
  159. package/src/Volume.js.map +0 -1
  160. package/src/__tests__/helpers.d.ts +0 -5
  161. package/src/__tests__/helpers.js +0 -26
  162. package/src/__tests__/helpers.js.map +0 -1
  163. package/src/errors/DaytonaError.js.map +0 -1
  164. package/src/index.js.map +0 -1
  165. package/src/types/Charts.js.map +0 -1
  166. package/src/types/CodeInterpreter.js.map +0 -1
  167. package/src/types/ExecuteResponse.js.map +0 -1
  168. package/src/types/Pty.js.map +0 -1
  169. package/src/utils/Binary.js.map +0 -1
  170. package/src/utils/FileTransfer.d.ts +0 -14
  171. package/src/utils/FileTransfer.js +0 -261
  172. package/src/utils/FileTransfer.js.map +0 -1
  173. package/src/utils/Import.d.ts +0 -97
  174. package/src/utils/Import.js +0 -79
  175. package/src/utils/Import.js.map +0 -1
  176. package/src/utils/Multipart.js.map +0 -1
  177. package/src/utils/Runtime.js.map +0 -1
  178. package/src/utils/Stream.js.map +0 -1
  179. package/src/utils/WebSocket.js.map +0 -1
  180. package/src/utils/otel.decorator.js.map +0 -1
  181. /package/{src → cjs}/CodeInterpreter.js +0 -0
  182. /package/{src → cjs}/ComputerUse.js +0 -0
  183. /package/{src → cjs}/Git.js +0 -0
  184. /package/{src → cjs}/Image.js +0 -0
  185. /package/{src → cjs}/LspServer.js +0 -0
  186. /package/{src → cjs}/ObjectStorage.js +0 -0
  187. /package/{src → cjs}/Process.js +0 -0
  188. /package/{src → cjs}/PtyHandle.js +0 -0
  189. /package/{src → cjs}/Sandbox.js +0 -0
  190. /package/{src → cjs}/Snapshot.js +0 -0
  191. /package/{src → cjs}/Volume.js +0 -0
  192. /package/{src → cjs}/errors/DaytonaError.js +0 -0
  193. /package/{src → cjs}/index.js +0 -0
  194. /package/{src → cjs}/types/Charts.js +0 -0
  195. /package/{src → cjs}/types/CodeInterpreter.js +0 -0
  196. /package/{src → cjs}/types/ExecuteResponse.js +0 -0
  197. /package/{src → cjs}/types/Pty.js +0 -0
  198. /package/{src → cjs}/utils/Multipart.js +0 -0
  199. /package/{src → cjs}/utils/Runtime.js +0 -0
  200. /package/{src → cjs}/utils/Stream.js +0 -0
  201. /package/{src → cjs}/utils/WebSocket.js +0 -0
  202. /package/{src → cjs}/utils/otel.decorator.js +0 -0
@@ -0,0 +1,571 @@
1
+ /*
2
+ * Copyright 2025 Daytona Platforms Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { __decorate, __metadata } from "tslib";
6
+ import * as pathe from 'pathe';
7
+ import axios from 'axios';
8
+ import { dynamicImport } from './utils/Import.js';
9
+ import { RUNTIME, Runtime } from './utils/Runtime.js';
10
+ import { createDaytonaError, DaytonaError } from './errors/DaytonaError.js';
11
+ import { coerceUploadSource, createAbortError, normalizeResponseStream, processDownloadFilesResponseWithBusboy, processDownloadFilesResponseWithBuffered, wrapWithUploadProgress, } from './utils/FileTransfer.js';
12
+ import { WithInstrumentation } from './utils/otel.decorator.js';
13
+ function createFileDownloadError(error, errorDetails) {
14
+ if (!errorDetails) {
15
+ return new DaytonaError(error);
16
+ }
17
+ return createDaytonaError(errorDetails.message, errorDetails.statusCode, undefined, errorDetails.errorCode);
18
+ }
19
+ /**
20
+ * Provides file system operations within a Sandbox.
21
+ *
22
+ * @class
23
+ */
24
+ export class FileSystem {
25
+ clientConfig;
26
+ apiClient;
27
+ constructor(clientConfig, apiClient) {
28
+ this.clientConfig = clientConfig;
29
+ this.apiClient = apiClient;
30
+ }
31
+ /**
32
+ * Create a new directory in the Sandbox with specified permissions.
33
+ *
34
+ * @param {string} path - Path where the directory should be created. Relative paths are resolved based on the sandbox working directory.
35
+ * @param {string} mode - Directory permissions in octal format (e.g. "755")
36
+ * @returns {Promise<void>}
37
+ *
38
+ * @example
39
+ * // Create a directory with standard permissions
40
+ * await fs.createFolder('app/data', '755');
41
+ */
42
+ async createFolder(path, mode) {
43
+ const response = await this.apiClient.createFolder(path, mode);
44
+ return response.data;
45
+ }
46
+ /**
47
+ * Deletes a file or directory from the Sandbox.
48
+ *
49
+ * @param {string} path - Path to the file or directory to delete. Relative paths are resolved based on the sandbox working directory.
50
+ * @param {boolean} [recursive] - If the file is a directory, this must be true to delete it.
51
+ * @returns {Promise<void>}
52
+ *
53
+ * @example
54
+ * // Delete a file
55
+ * await fs.deleteFile('app/temp.log');
56
+ */
57
+ async deleteFile(path, recursive) {
58
+ const response = await this.apiClient.deleteFile(path, recursive);
59
+ return response.data;
60
+ }
61
+ async downloadFile(src, dst, timeout = 30 * 60) {
62
+ const remotePath = src;
63
+ if (typeof dst !== 'string') {
64
+ if (dst) {
65
+ timeout = dst;
66
+ }
67
+ const response = await this.downloadFiles([{ source: remotePath }], timeout);
68
+ if (response[0].error) {
69
+ throw createFileDownloadError(response[0].error, response[0].errorDetails);
70
+ }
71
+ return response[0].result;
72
+ }
73
+ const response = await this.downloadFiles([{ source: remotePath, destination: dst }], timeout);
74
+ if (response[0].error) {
75
+ throw createFileDownloadError(response[0].error, response[0].errorDetails);
76
+ }
77
+ }
78
+ async downloadFileStream(remotePath, timeoutOrOptions) {
79
+ const options = typeof timeoutOrOptions === 'number' ? { timeout: timeoutOrOptions } : (timeoutOrOptions ?? {});
80
+ const timeout = options.timeout ?? 30 * 60;
81
+ const isNonStreamingRuntime = RUNTIME === Runtime.BROWSER || RUNTIME === Runtime.SERVERLESS;
82
+ if (isNonStreamingRuntime) {
83
+ throw new DaytonaError('downloadFileStream is not supported in browser or serverless environments. Use downloadFile instead.');
84
+ }
85
+ if (options.signal?.aborted) {
86
+ throw new DaytonaError('Download cancelled');
87
+ }
88
+ const toDownloadCancelledError = () => new DaytonaError('Download cancelled');
89
+ const isCanceledError = (err) => {
90
+ const error = err;
91
+ return Boolean(axios.isCancel?.(err) || error?.name === 'CanceledError' || error?.code === 'ERR_CANCELED');
92
+ };
93
+ let response;
94
+ try {
95
+ response = await this.apiClient.downloadFiles({ paths: [remotePath] }, {
96
+ responseType: 'stream',
97
+ timeout: timeout * 1000,
98
+ signal: options.signal,
99
+ });
100
+ }
101
+ catch (err) {
102
+ if (options.signal?.aborted || isCanceledError(err)) {
103
+ throw toDownloadCancelledError();
104
+ }
105
+ throw err;
106
+ }
107
+ const responseStream = normalizeResponseStream(response.data);
108
+ const metadataMap = new Map();
109
+ metadataMap.set(remotePath, {});
110
+ return new Promise((resolve, reject) => {
111
+ let resolvedStream = null;
112
+ processDownloadFilesResponseWithBusboy(responseStream, response.headers, metadataMap, (_source, fileStream, totalBytes) => {
113
+ if (options.onProgress) {
114
+ const { Transform } = require('stream');
115
+ let bytesReceived = 0;
116
+ const progress = new Transform({
117
+ transform(chunk, _encoding, callback) {
118
+ bytesReceived += chunk.length;
119
+ options.onProgress({ bytesReceived, totalBytes });
120
+ callback(null, chunk);
121
+ },
122
+ });
123
+ fileStream.pipe(progress);
124
+ fileStream.on('error', (err) => {
125
+ if (!progress.destroyed)
126
+ progress.destroy(err);
127
+ });
128
+ resolvedStream = progress;
129
+ }
130
+ else {
131
+ resolvedStream = fileStream;
132
+ }
133
+ resolve(resolvedStream);
134
+ })
135
+ .then(() => {
136
+ if (!resolvedStream) {
137
+ const metadata = metadataMap.get(remotePath);
138
+ if (metadata?.error) {
139
+ reject(createFileDownloadError(metadata.error, metadata.errorDetails));
140
+ }
141
+ else {
142
+ reject(new DaytonaError(`No file data received for: ${remotePath}`));
143
+ }
144
+ }
145
+ })
146
+ .catch((err) => {
147
+ const normalizedError = options.signal?.aborted || isCanceledError(err) ? toDownloadCancelledError() : err;
148
+ if (!resolvedStream) {
149
+ reject(normalizedError);
150
+ return;
151
+ }
152
+ const stream = resolvedStream;
153
+ if (stream.destroyed || stream.readableEnded) {
154
+ return;
155
+ }
156
+ stream.destroy(normalizedError instanceof Error ? normalizedError : new Error(String(normalizedError)));
157
+ });
158
+ });
159
+ }
160
+ /**
161
+ * Downloads multiple files from the Sandbox. If the files already exist locally, they will be overwritten.
162
+ *
163
+ * @param {FileDownloadRequest[]} files - Array of file download requests.
164
+ * @param {number} [timeoutSec] - Timeout for the download operation in seconds. 0 means no timeout.
165
+ * Default is 30 minutes.
166
+ * @returns {Promise<FileDownloadResponse[]>} Array of download results.
167
+ *
168
+ * @throws {DaytonaError} If the request itself fails (network issues, invalid request/response, etc.). Individual
169
+ * file download errors are returned in `FileDownloadResponse.error`. When the daemon provides structured
170
+ * per-file metadata, it is also available in `FileDownloadResponse.errorDetails`.
171
+ *
172
+ * @example
173
+ * // Download multiple files
174
+ * const results = await fs.downloadFiles([
175
+ * { source: 'tmp/data.json' },
176
+ * { source: 'tmp/config.json', destination: 'local_config.json' }
177
+ * ]);
178
+ * results.forEach(result => {
179
+ * if (result.error) {
180
+ * console.error(`Error downloading ${result.source}: ${result.error}`);
181
+ * } else if (result.result) {
182
+ * console.log(`Downloaded ${result.source} to ${result.result}`);
183
+ * }
184
+ * });
185
+ */
186
+ async downloadFiles(files, timeoutSec = 30 * 60) {
187
+ if (files.length === 0)
188
+ return [];
189
+ const isNonStreamingRuntime = RUNTIME === Runtime.BROWSER || RUNTIME === Runtime.SERVERLESS;
190
+ // Prepare destinations and metadata
191
+ const metadataMap = new Map();
192
+ for (const f of files) {
193
+ metadataMap.set(f.source, { destination: f.destination });
194
+ if (f.destination) {
195
+ const fs = await dynamicImport('fs', 'Downloading files to local files is not supported: ');
196
+ await fs.promises.mkdir(pathe.dirname(f.destination), { recursive: true });
197
+ }
198
+ }
199
+ const response = await this.apiClient.downloadFiles({ paths: files.map((f) => f.source) }, {
200
+ responseType: isNonStreamingRuntime ? 'arraybuffer' : 'stream',
201
+ timeout: timeoutSec * 1000,
202
+ });
203
+ const stream = normalizeResponseStream(response.data);
204
+ // Node.js path: use busboy for efficient streaming
205
+ if (isNonStreamingRuntime) {
206
+ await processDownloadFilesResponseWithBuffered(stream, response.headers, metadataMap);
207
+ }
208
+ else {
209
+ await processDownloadFilesResponseWithBusboy(stream, response.headers, metadataMap);
210
+ }
211
+ return files.map((f) => {
212
+ const metadata = metadataMap.get(f.source);
213
+ const error = metadata?.error || (!metadata?.result ? 'No data received for this file' : undefined);
214
+ return {
215
+ source: f.source,
216
+ result: error ? undefined : metadata.result,
217
+ error,
218
+ errorDetails: error ? metadata?.errorDetails : undefined,
219
+ };
220
+ });
221
+ }
222
+ /**
223
+ * Searches for text patterns within files in the Sandbox.
224
+ *
225
+ * @param {string} path - Directory to search in. Relative paths are resolved based on the sandbox working directory.
226
+ * @param {string} pattern - Search pattern
227
+ * @returns {Promise<Array<Match>>} Array of matches with file and line information
228
+ *
229
+ * @example
230
+ * // Find all TODO comments in TypeScript files
231
+ * const matches = await fs.findFiles('app/src', 'TODO:');
232
+ * matches.forEach(match => {
233
+ * console.log(`${match.file}:${match.line}: ${match.content}`);
234
+ * });
235
+ */
236
+ async findFiles(path, pattern) {
237
+ const response = await this.apiClient.findInFiles(path, pattern);
238
+ return response.data;
239
+ }
240
+ /**
241
+ * Retrieves detailed information about a file or directory.
242
+ *
243
+ * @param {string} path - Path to the file or directory. Relative paths are resolved based on the sandbox working directory.
244
+ * @returns {Promise<FileInfo>} Detailed file information including size, permissions, modification time
245
+ *
246
+ * @example
247
+ * // Get file details
248
+ * const info = await fs.getFileDetails('app/config.json');
249
+ * console.log(`Size: ${info.size}, Modified: ${info.modTime}`);
250
+ */
251
+ async getFileDetails(path) {
252
+ const response = await this.apiClient.getFileInfo(path);
253
+ return response.data;
254
+ }
255
+ /**
256
+ * Lists contents of a directory in the Sandbox.
257
+ *
258
+ * @param {string} path - Directory path to list. Relative paths are resolved based on the sandbox working directory.
259
+ * @returns {Promise<FileInfo[]>} Array of file and directory information
260
+ *
261
+ * @example
262
+ * // List directory contents
263
+ * const files = await fs.listFiles('app/src');
264
+ * files.forEach(file => {
265
+ * console.log(`${file.name} (${file.size} bytes)`);
266
+ * });
267
+ */
268
+ async listFiles(path) {
269
+ const response = await this.apiClient.listFiles(path);
270
+ return response.data;
271
+ }
272
+ /**
273
+ * Moves or renames a file or directory.
274
+ *
275
+ * @param {string} source - Source path. Relative paths are resolved based on the sandbox working directory.
276
+ * @param {string} destination - Destination path. Relative paths are resolved based on the sandbox working directory.
277
+ * @returns {Promise<void>}
278
+ *
279
+ * @example
280
+ * // Move a file to a new location
281
+ * await fs.moveFiles('app/temp/data.json', 'app/data/data.json');
282
+ */
283
+ async moveFiles(source, destination) {
284
+ const response = await this.apiClient.moveFile(source, destination);
285
+ return response.data;
286
+ }
287
+ /**
288
+ * Replaces text content in multiple files.
289
+ *
290
+ * @param {string[]} files - Array of file paths to process. Relative paths are resolved based on the sandbox working directory.
291
+ * @param {string} pattern - Pattern to replace
292
+ * @param {string} newValue - Replacement text
293
+ * @returns {Promise<Array<ReplaceResult>>} Results of the replace operation for each file
294
+ *
295
+ * @example
296
+ * // Update version number across multiple files
297
+ * const results = await fs.replaceInFiles(
298
+ * ['app/package.json', 'app/version.ts'],
299
+ * '"version": "1.0.0"',
300
+ * '"version": "1.1.0"'
301
+ * );
302
+ */
303
+ async replaceInFiles(files, pattern, newValue) {
304
+ const replaceRequest = {
305
+ files,
306
+ newValue,
307
+ pattern,
308
+ };
309
+ const response = await this.apiClient.replaceInFiles(replaceRequest);
310
+ return response.data;
311
+ }
312
+ /**
313
+ * Searches for files and directories by name pattern in the Sandbox.
314
+ *
315
+ * @param {string} path - Directory to search in. Relative paths are resolved based on the sandbox working directory.
316
+ * @param {string} pattern - File name pattern (supports globs)
317
+ * @returns {Promise<SearchFilesResponse>} Search results with matching files
318
+ *
319
+ * @example
320
+ * // Find all TypeScript files
321
+ * const result = await fs.searchFiles('app', '*.ts');
322
+ * result.files.forEach(file => console.log(file));
323
+ */
324
+ async searchFiles(path, pattern) {
325
+ const response = await this.apiClient.searchFiles(path, pattern);
326
+ return response.data;
327
+ }
328
+ /**
329
+ * Sets permissions and ownership for a file or directory.
330
+ *
331
+ * @param {string} path - Path to the file or directory. Relative paths are resolved based on the sandbox working directory.
332
+ * @param {FilePermissionsParams} permissions - Permission settings
333
+ * @returns {Promise<void>}
334
+ *
335
+ * @example
336
+ * // Set file permissions and ownership
337
+ * await fs.setFilePermissions('app/script.sh', {
338
+ * owner: 'daytona',
339
+ * group: 'users',
340
+ * mode: '755' // Execute permission for shell script
341
+ * });
342
+ */
343
+ async setFilePermissions(path, permissions) {
344
+ const response = await this.apiClient.setFilePermissions(path, permissions.owner, permissions.group, permissions.mode);
345
+ return response.data;
346
+ }
347
+ async uploadFile(src, dst, timeout = 30 * 60) {
348
+ await this.uploadFiles([{ source: src, destination: dst }], timeout);
349
+ }
350
+ /**
351
+ * Uploads a single file to the Sandbox using true streaming, with optional progress
352
+ * tracking and cancellation. Memory usage stays flat regardless of source size: the
353
+ * SDK pipes the source through a transform that counts bytes and forwards to the
354
+ * underlying multipart upload without buffering the whole payload. The HTTP layer
355
+ * uses chunked transfer encoding, so the source's natural EOF terminates the upload —
356
+ * no advance size is needed.
357
+ *
358
+ * @param {UploadSource} source - The data to upload. Accepts the same `Buffer | string`
359
+ * inputs as {@link FileSystem.uploadFile}, plus Node `Readable` streams and Web
360
+ * `ReadableStream` instances. When a string is passed, it is treated as a local
361
+ * file path and read in streaming chunks.
362
+ * @param {string} remotePath - Destination path in the Sandbox. Relative paths are
363
+ * resolved against the sandbox working directory.
364
+ * @param {UploadStreamOptions} [options] - Streaming options: AbortSignal, onProgress
365
+ * callback, timeout.
366
+ * @returns {Promise<void>}
367
+ *
368
+ * @example
369
+ * // Upload a 2 GB file with progress tracking and the ability to cancel
370
+ * import { createReadStream } from 'fs';
371
+ * const controller = new AbortController();
372
+ * await sandbox.fs.uploadFileStream(createReadStream('big.bin'), 'tmp/big.bin', {
373
+ * signal: controller.signal,
374
+ * onProgress: ({ bytesSent }) => console.log(`${bytesSent} bytes sent`),
375
+ * });
376
+ */
377
+ async uploadFileStream(source, remotePath, options = {}) {
378
+ const isNonStreamingRuntime = RUNTIME === Runtime.DENO || RUNTIME === Runtime.BROWSER || RUNTIME === Runtime.SERVERLESS;
379
+ if (isNonStreamingRuntime) {
380
+ throw new DaytonaError('uploadFileStream is not supported in browser, Deno, or serverless runtimes. Use uploadFile instead.');
381
+ }
382
+ if (options.signal?.aborted) {
383
+ throw createAbortError(remotePath);
384
+ }
385
+ const timeout = options.timeout ?? 30 * 60;
386
+ const sourceStream = await coerceUploadSource(source);
387
+ const tracked = wrapWithUploadProgress(sourceStream, options.onProgress, options.signal);
388
+ const FormDataClass = (await dynamicImport('form-data', 'Uploading files is not supported: '));
389
+ const form = new FormDataClass();
390
+ form.append('files[0].path', remotePath);
391
+ // No knownLength: form-data falls back to chunked transfer encoding, which the
392
+ // daemon's MultipartReader handles transparently. The source's EOF terminates
393
+ // the upload — no advance byte count needed.
394
+ form.append('files[0].file', tracked, { filename: remotePath });
395
+ try {
396
+ await this.apiClient.uploadFiles({
397
+ data: form,
398
+ maxRedirects: 0,
399
+ timeout: timeout * 1000,
400
+ signal: options.signal,
401
+ });
402
+ }
403
+ catch (err) {
404
+ if (options.signal?.aborted) {
405
+ throw createAbortError(remotePath);
406
+ }
407
+ throw err;
408
+ }
409
+ }
410
+ /**
411
+ * Uploads multiple files to the Sandbox. If files already exist at the destination paths,
412
+ * they will be overwritten.
413
+ *
414
+ * @param {FileUpload[]} files - Array of files to upload.
415
+ * @param {number} [timeout] - Timeout for the upload operation in seconds. 0 means no timeout.
416
+ * Default is 30 minutes.
417
+ * @returns {Promise<void>}
418
+ *
419
+ * @example
420
+ * // Upload multiple text files
421
+ * const files = [
422
+ * {
423
+ * source: Buffer.from('Content of file 1'),
424
+ * destination: '/tmp/file1.txt'
425
+ * },
426
+ * {
427
+ * source: 'app/data/file2.txt',
428
+ * destination: '/tmp/file2.txt'
429
+ * },
430
+ * {
431
+ * source: Buffer.from('{"key": "value"}'),
432
+ * destination: '/tmp/config.json'
433
+ * }
434
+ * ];
435
+ * await fs.uploadFiles(files);
436
+ */
437
+ async uploadFiles(files, timeout = 30 * 60) {
438
+ const isNonStreamingRuntime = RUNTIME === Runtime.DENO || RUNTIME === Runtime.BROWSER || RUNTIME === Runtime.SERVERLESS;
439
+ const FormDataClass = isNonStreamingRuntime
440
+ ? FormData
441
+ : (await dynamicImport('form-data', 'Uploading files is not supported: '));
442
+ const form = new FormDataClass();
443
+ for (const [i, { source, destination }] of files.entries()) {
444
+ form.append(`files[${i}].path`, destination);
445
+ const payload = await this.makeFilePayload(source);
446
+ form.append(`files[${i}].file`, payload, destination);
447
+ }
448
+ if (isNonStreamingRuntime) {
449
+ const url = `${this.clientConfig.basePath}/files/bulk-upload`;
450
+ await fetch(url, {
451
+ method: 'POST',
452
+ headers: this.clientConfig.baseOptions.headers,
453
+ body: form,
454
+ signal: timeout ? AbortSignal.timeout(timeout * 1000) : undefined,
455
+ });
456
+ }
457
+ else {
458
+ await this.apiClient.uploadFiles({
459
+ data: form,
460
+ maxRedirects: 0,
461
+ timeout: timeout * 1000,
462
+ });
463
+ }
464
+ }
465
+ async makeFilePayload(source) {
466
+ // String = file path
467
+ if (typeof source === 'string') {
468
+ const fs = await dynamicImport('fs', 'Uploading file from local file system is not supported: ');
469
+ return fs.createReadStream(source);
470
+ }
471
+ // Blob
472
+ if (RUNTIME === Runtime.BROWSER || RUNTIME === Runtime.SERVERLESS || RUNTIME === Runtime.DENO) {
473
+ // Use .slice() to ensure we have a concrete ArrayBuffer, not ArrayBufferLike
474
+ return new Blob([source.slice()], { type: 'application/octet-stream' });
475
+ }
476
+ // Readable stream
477
+ const stream = await dynamicImport('stream', 'Uploading file is not supported: ');
478
+ return stream.Readable.from(source);
479
+ }
480
+ }
481
+ __decorate([
482
+ WithInstrumentation(),
483
+ __metadata("design:type", Function),
484
+ __metadata("design:paramtypes", [String, String]),
485
+ __metadata("design:returntype", Promise)
486
+ ], FileSystem.prototype, "createFolder", null);
487
+ __decorate([
488
+ WithInstrumentation(),
489
+ __metadata("design:type", Function),
490
+ __metadata("design:paramtypes", [String, Boolean]),
491
+ __metadata("design:returntype", Promise)
492
+ ], FileSystem.prototype, "deleteFile", null);
493
+ __decorate([
494
+ WithInstrumentation(),
495
+ __metadata("design:type", Function),
496
+ __metadata("design:paramtypes", [String, Object, Number]),
497
+ __metadata("design:returntype", Promise)
498
+ ], FileSystem.prototype, "downloadFile", null);
499
+ __decorate([
500
+ WithInstrumentation(),
501
+ __metadata("design:type", Function),
502
+ __metadata("design:paramtypes", [String, Object]),
503
+ __metadata("design:returntype", Promise)
504
+ ], FileSystem.prototype, "downloadFileStream", null);
505
+ __decorate([
506
+ WithInstrumentation(),
507
+ __metadata("design:type", Function),
508
+ __metadata("design:paramtypes", [Array, Number]),
509
+ __metadata("design:returntype", Promise)
510
+ ], FileSystem.prototype, "downloadFiles", null);
511
+ __decorate([
512
+ WithInstrumentation(),
513
+ __metadata("design:type", Function),
514
+ __metadata("design:paramtypes", [String, String]),
515
+ __metadata("design:returntype", Promise)
516
+ ], FileSystem.prototype, "findFiles", null);
517
+ __decorate([
518
+ WithInstrumentation(),
519
+ __metadata("design:type", Function),
520
+ __metadata("design:paramtypes", [String]),
521
+ __metadata("design:returntype", Promise)
522
+ ], FileSystem.prototype, "getFileDetails", null);
523
+ __decorate([
524
+ WithInstrumentation(),
525
+ __metadata("design:type", Function),
526
+ __metadata("design:paramtypes", [String]),
527
+ __metadata("design:returntype", Promise)
528
+ ], FileSystem.prototype, "listFiles", null);
529
+ __decorate([
530
+ WithInstrumentation(),
531
+ __metadata("design:type", Function),
532
+ __metadata("design:paramtypes", [String, String]),
533
+ __metadata("design:returntype", Promise)
534
+ ], FileSystem.prototype, "moveFiles", null);
535
+ __decorate([
536
+ WithInstrumentation(),
537
+ __metadata("design:type", Function),
538
+ __metadata("design:paramtypes", [Array, String, String]),
539
+ __metadata("design:returntype", Promise)
540
+ ], FileSystem.prototype, "replaceInFiles", null);
541
+ __decorate([
542
+ WithInstrumentation(),
543
+ __metadata("design:type", Function),
544
+ __metadata("design:paramtypes", [String, String]),
545
+ __metadata("design:returntype", Promise)
546
+ ], FileSystem.prototype, "searchFiles", null);
547
+ __decorate([
548
+ WithInstrumentation(),
549
+ __metadata("design:type", Function),
550
+ __metadata("design:paramtypes", [String, Object]),
551
+ __metadata("design:returntype", Promise)
552
+ ], FileSystem.prototype, "setFilePermissions", null);
553
+ __decorate([
554
+ WithInstrumentation(),
555
+ __metadata("design:type", Function),
556
+ __metadata("design:paramtypes", [Object, String, Number]),
557
+ __metadata("design:returntype", Promise)
558
+ ], FileSystem.prototype, "uploadFile", null);
559
+ __decorate([
560
+ WithInstrumentation(),
561
+ __metadata("design:type", Function),
562
+ __metadata("design:paramtypes", [Object, String, Object]),
563
+ __metadata("design:returntype", Promise)
564
+ ], FileSystem.prototype, "uploadFileStream", null);
565
+ __decorate([
566
+ WithInstrumentation(),
567
+ __metadata("design:type", Function),
568
+ __metadata("design:paramtypes", [Array, Number]),
569
+ __metadata("design:returntype", Promise)
570
+ ], FileSystem.prototype, "uploadFiles", null);
571
+ //# sourceMappingURL=FileSystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSystem.js","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/FileSystem.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAExE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,sCAAsC,EACtC,wCAAwC,EACxC,sBAAsB,GACvB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AA0J5D,SAAS,uBAAuB,CAAC,KAAa,EAAE,YAAuC;IACrF,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,IAAI,YAAY,CAAC,KAAK,CAAC,CAAA;IAChC,CAAC;IAED,OAAO,kBAAkB,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,UAAU,EAAE,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,CAAA;AAC7G,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,UAAU;IAEF;IACA;IAFnB,YACmB,YAA2B,EAC3B,SAAwB;QADxB,iB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