@daytonaio/sdk 0.170.0 → 0.171.0-alpha.3

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 (237) hide show
  1. package/LICENSE +190 -0
  2. package/cjs/CodeInterpreter.d.ts +95 -0
  3. package/cjs/CodeInterpreter.d.ts.map +1 -0
  4. package/cjs/CodeInterpreter.js +297 -0
  5. package/cjs/CodeInterpreter.js.map +1 -0
  6. package/cjs/ComputerUse.d.ts +539 -0
  7. package/cjs/ComputerUse.d.ts.map +1 -0
  8. package/cjs/ComputerUse.js +808 -0
  9. package/cjs/ComputerUse.js.map +1 -0
  10. package/cjs/Daytona.d.ts +355 -0
  11. package/cjs/Daytona.d.ts.map +1 -0
  12. package/cjs/Daytona.js +527 -0
  13. package/cjs/Daytona.js.map +1 -0
  14. package/cjs/FileSystem.d.ts +371 -0
  15. package/cjs/FileSystem.d.ts.map +1 -0
  16. package/cjs/FileSystem.js +489 -0
  17. package/cjs/FileSystem.js.map +1 -0
  18. package/cjs/Git.d.ts +203 -0
  19. package/cjs/Git.d.ts.map +1 -0
  20. package/cjs/Git.js +326 -0
  21. package/cjs/Git.js.map +1 -0
  22. package/cjs/Image.d.ts +265 -0
  23. package/cjs/Image.d.ts.map +1 -0
  24. package/cjs/Image.js +586 -0
  25. package/cjs/Image.js.map +1 -0
  26. package/cjs/LspServer.d.ts +172 -0
  27. package/cjs/LspServer.d.ts.map +1 -0
  28. package/cjs/LspServer.js +259 -0
  29. package/cjs/LspServer.js.map +1 -0
  30. package/cjs/ObjectStorage.d.ts +79 -0
  31. package/cjs/ObjectStorage.d.ts.map +1 -0
  32. package/cjs/ObjectStorage.js +199 -0
  33. package/cjs/ObjectStorage.js.map +1 -0
  34. package/cjs/Process.d.ts +490 -0
  35. package/cjs/Process.d.ts.map +1 -0
  36. package/cjs/Process.js +647 -0
  37. package/cjs/Process.js.map +1 -0
  38. package/cjs/PtyHandle.d.ts +155 -0
  39. package/cjs/PtyHandle.d.ts.map +1 -0
  40. package/cjs/PtyHandle.js +416 -0
  41. package/cjs/PtyHandle.js.map +1 -0
  42. package/cjs/README.md +180 -0
  43. package/cjs/Sandbox.d.ts +476 -0
  44. package/cjs/Sandbox.d.ts.map +1 -0
  45. package/cjs/Sandbox.js +905 -0
  46. package/cjs/Sandbox.js.map +1 -0
  47. package/cjs/Snapshot.d.ts +140 -0
  48. package/cjs/Snapshot.d.ts.map +1 -0
  49. package/cjs/Snapshot.js +248 -0
  50. package/cjs/Snapshot.js.map +1 -0
  51. package/cjs/Volume.d.ts +84 -0
  52. package/cjs/Volume.d.ts.map +1 -0
  53. package/cjs/Volume.js +119 -0
  54. package/cjs/Volume.js.map +1 -0
  55. package/cjs/__tests__/helpers.d.ts +6 -0
  56. package/cjs/__tests__/helpers.d.ts.map +1 -0
  57. package/cjs/__tests__/helpers.js +26 -0
  58. package/cjs/__tests__/helpers.js.map +1 -0
  59. package/cjs/errors/DaytonaError.d.ts +171 -0
  60. package/cjs/errors/DaytonaError.d.ts.map +1 -0
  61. package/cjs/errors/DaytonaError.js +258 -0
  62. package/cjs/errors/DaytonaError.js.map +1 -0
  63. package/cjs/index.d.ts +22 -0
  64. package/cjs/index.d.ts.map +1 -0
  65. package/cjs/index.js +49 -0
  66. package/cjs/index.js.map +1 -0
  67. package/cjs/package.json +3 -0
  68. package/cjs/types/Charts.d.ts +38 -0
  69. package/cjs/types/Charts.d.ts.map +1 -0
  70. package/cjs/types/Charts.js +37 -0
  71. package/cjs/types/Charts.js.map +1 -0
  72. package/cjs/types/CodeInterpreter.d.ts +77 -0
  73. package/cjs/types/CodeInterpreter.d.ts.map +1 -0
  74. package/cjs/types/CodeInterpreter.js +7 -0
  75. package/cjs/types/CodeInterpreter.js.map +1 -0
  76. package/cjs/types/ExecuteResponse.d.ts +26 -0
  77. package/cjs/types/ExecuteResponse.d.ts.map +1 -0
  78. package/cjs/types/ExecuteResponse.js +7 -0
  79. package/cjs/types/ExecuteResponse.js.map +1 -0
  80. package/cjs/types/Pty.d.ts +48 -0
  81. package/cjs/types/Pty.d.ts.map +1 -0
  82. package/cjs/types/Pty.js +7 -0
  83. package/cjs/types/Pty.js.map +1 -0
  84. package/cjs/utils/Binary.d.ts +39 -0
  85. package/cjs/utils/Binary.d.ts.map +1 -0
  86. package/cjs/utils/Binary.js +168 -0
  87. package/cjs/utils/Binary.js.map +1 -0
  88. package/cjs/utils/FileTransfer.d.ts +15 -0
  89. package/cjs/utils/FileTransfer.d.ts.map +1 -0
  90. package/cjs/utils/FileTransfer.js +261 -0
  91. package/cjs/utils/FileTransfer.js.map +1 -0
  92. package/cjs/utils/Import.d.ts +125 -0
  93. package/cjs/utils/Import.d.ts.map +1 -0
  94. package/cjs/utils/Import.js +112 -0
  95. package/cjs/utils/Import.js.map +1 -0
  96. package/cjs/utils/Multipart.d.ts +29 -0
  97. package/cjs/utils/Multipart.d.ts.map +1 -0
  98. package/cjs/utils/Multipart.js +115 -0
  99. package/cjs/utils/Multipart.js.map +1 -0
  100. package/cjs/utils/Runtime.d.ts +44 -0
  101. package/cjs/utils/Runtime.d.ts.map +1 -0
  102. package/cjs/utils/Runtime.js +95 -0
  103. package/cjs/utils/Runtime.js.map +1 -0
  104. package/cjs/utils/Stream.d.ts +20 -0
  105. package/cjs/utils/Stream.d.ts.map +1 -0
  106. package/cjs/utils/Stream.js +364 -0
  107. package/cjs/utils/Stream.js.map +1 -0
  108. package/cjs/utils/WebSocket.d.ts +10 -0
  109. package/cjs/utils/WebSocket.d.ts.map +1 -0
  110. package/cjs/utils/WebSocket.js +26 -0
  111. package/cjs/utils/WebSocket.js.map +1 -0
  112. package/cjs/utils/otel.decorator.d.ts +83 -0
  113. package/cjs/utils/otel.decorator.d.ts.map +1 -0
  114. package/cjs/utils/otel.decorator.js +141 -0
  115. package/cjs/utils/otel.decorator.js.map +1 -0
  116. package/esm/CodeInterpreter.d.ts +95 -0
  117. package/esm/CodeInterpreter.d.ts.map +1 -0
  118. package/esm/CodeInterpreter.js +292 -0
  119. package/esm/CodeInterpreter.js.map +1 -0
  120. package/esm/ComputerUse.d.ts +539 -0
  121. package/esm/ComputerUse.d.ts.map +1 -0
  122. package/esm/ComputerUse.js +799 -0
  123. package/esm/ComputerUse.js.map +1 -0
  124. package/esm/Daytona.d.ts +355 -0
  125. package/esm/Daytona.d.ts.map +1 -0
  126. package/esm/Daytona.js +523 -0
  127. package/esm/Daytona.js.map +1 -0
  128. package/esm/FileSystem.d.ts +371 -0
  129. package/esm/FileSystem.d.ts.map +1 -0
  130. package/esm/FileSystem.js +485 -0
  131. package/esm/FileSystem.js.map +1 -0
  132. package/esm/Git.d.ts +203 -0
  133. package/esm/Git.d.ts.map +1 -0
  134. package/esm/Git.js +322 -0
  135. package/esm/Git.js.map +1 -0
  136. package/esm/Image.d.ts +265 -0
  137. package/esm/Image.d.ts.map +1 -0
  138. package/esm/Image.js +581 -0
  139. package/esm/Image.js.map +1 -0
  140. package/esm/LspServer.d.ts +172 -0
  141. package/esm/LspServer.d.ts.map +1 -0
  142. package/esm/LspServer.js +255 -0
  143. package/esm/LspServer.js.map +1 -0
  144. package/esm/ObjectStorage.d.ts +79 -0
  145. package/esm/ObjectStorage.d.ts.map +1 -0
  146. package/esm/ObjectStorage.js +195 -0
  147. package/esm/ObjectStorage.js.map +1 -0
  148. package/esm/Process.d.ts +490 -0
  149. package/esm/Process.d.ts.map +1 -0
  150. package/esm/Process.js +642 -0
  151. package/esm/Process.js.map +1 -0
  152. package/esm/PtyHandle.d.ts +155 -0
  153. package/esm/PtyHandle.d.ts.map +1 -0
  154. package/esm/PtyHandle.js +412 -0
  155. package/esm/PtyHandle.js.map +1 -0
  156. package/esm/README.md +180 -0
  157. package/esm/Sandbox.d.ts +476 -0
  158. package/esm/Sandbox.d.ts.map +1 -0
  159. package/esm/Sandbox.js +901 -0
  160. package/esm/Sandbox.js.map +1 -0
  161. package/esm/Snapshot.d.ts +140 -0
  162. package/esm/Snapshot.d.ts.map +1 -0
  163. package/esm/Snapshot.js +244 -0
  164. package/esm/Snapshot.js.map +1 -0
  165. package/esm/Volume.d.ts +84 -0
  166. package/esm/Volume.d.ts.map +1 -0
  167. package/esm/Volume.js +115 -0
  168. package/esm/Volume.js.map +1 -0
  169. package/esm/__tests__/helpers.d.ts +6 -0
  170. package/esm/__tests__/helpers.d.ts.map +1 -0
  171. package/esm/__tests__/helpers.js +20 -0
  172. package/esm/__tests__/helpers.js.map +1 -0
  173. package/esm/errors/DaytonaError.d.ts +171 -0
  174. package/esm/errors/DaytonaError.d.ts.map +1 -0
  175. package/esm/errors/DaytonaError.js +243 -0
  176. package/esm/errors/DaytonaError.js.map +1 -0
  177. package/esm/index.d.ts +22 -0
  178. package/esm/index.d.ts.map +1 -0
  179. package/esm/index.js +21 -0
  180. package/esm/index.js.map +1 -0
  181. package/esm/package.json +3 -0
  182. package/esm/types/Charts.d.ts +38 -0
  183. package/esm/types/Charts.d.ts.map +1 -0
  184. package/esm/types/Charts.js +33 -0
  185. package/esm/types/Charts.js.map +1 -0
  186. package/esm/types/CodeInterpreter.d.ts +77 -0
  187. package/esm/types/CodeInterpreter.d.ts.map +1 -0
  188. package/esm/types/CodeInterpreter.js +6 -0
  189. package/esm/types/CodeInterpreter.js.map +1 -0
  190. package/esm/types/ExecuteResponse.d.ts +26 -0
  191. package/esm/types/ExecuteResponse.d.ts.map +1 -0
  192. package/esm/types/ExecuteResponse.js +6 -0
  193. package/esm/types/ExecuteResponse.js.map +1 -0
  194. package/esm/types/Pty.d.ts +48 -0
  195. package/esm/types/Pty.d.ts.map +1 -0
  196. package/esm/types/Pty.js +6 -0
  197. package/esm/types/Pty.js.map +1 -0
  198. package/esm/utils/Binary.d.ts +39 -0
  199. package/esm/utils/Binary.d.ts.map +1 -0
  200. package/esm/utils/Binary.js +157 -0
  201. package/esm/utils/Binary.js.map +1 -0
  202. package/esm/utils/FileTransfer.d.ts +15 -0
  203. package/esm/utils/FileTransfer.d.ts.map +1 -0
  204. package/esm/utils/FileTransfer.js +254 -0
  205. package/esm/utils/FileTransfer.js.map +1 -0
  206. package/esm/utils/Import.d.ts +95 -0
  207. package/esm/utils/Import.d.ts.map +1 -0
  208. package/esm/utils/Import.js +77 -0
  209. package/esm/utils/Import.js.map +1 -0
  210. package/esm/utils/Multipart.d.ts +29 -0
  211. package/esm/utils/Multipart.d.ts.map +1 -0
  212. package/esm/utils/Multipart.js +109 -0
  213. package/esm/utils/Multipart.js.map +1 -0
  214. package/esm/utils/Runtime.d.ts +44 -0
  215. package/esm/utils/Runtime.d.ts.map +1 -0
  216. package/esm/utils/Runtime.js +89 -0
  217. package/esm/utils/Runtime.js.map +1 -0
  218. package/esm/utils/Stream.d.ts +20 -0
  219. package/esm/utils/Stream.d.ts.map +1 -0
  220. package/esm/utils/Stream.js +360 -0
  221. package/esm/utils/Stream.js.map +1 -0
  222. package/esm/utils/WebSocket.d.ts +10 -0
  223. package/esm/utils/WebSocket.d.ts.map +1 -0
  224. package/esm/utils/WebSocket.js +22 -0
  225. package/esm/utils/WebSocket.js.map +1 -0
  226. package/esm/utils/otel.decorator.d.ts +83 -0
  227. package/esm/utils/otel.decorator.d.ts.map +1 -0
  228. package/esm/utils/otel.decorator.js +136 -0
  229. package/esm/utils/otel.decorator.js.map +1 -0
  230. package/package.json +20 -8
  231. package/src/ComputerUse.d.ts +4 -4
  232. package/src/ComputerUse.js +4 -4
  233. package/src/Sandbox.d.ts +1 -18
  234. package/src/Sandbox.js +0 -29
  235. package/src/Sandbox.js.map +1 -1
  236. package/src/__tests__/helpers.js +0 -2
  237. package/src/__tests__/helpers.js.map +1 -1
@@ -0,0 +1,371 @@
1
+ import { Configuration, FileInfo, Match, ReplaceResult, SearchFilesResponse } from '@daytona/toolbox-api-client';
2
+ import { FileSystemApi } from '@daytona/toolbox-api-client';
3
+ import type { Readable } from 'stream';
4
+ /**
5
+ * Parameters for setting file permissions in the Sandbox.
6
+ *
7
+ * @interface
8
+ * @property {string} [mode] - File mode/permissions in octal format (e.g. "644")
9
+ * @property {string} [owner] - User owner of the file
10
+ * @property {string} [group] - Group owner of the file
11
+ *
12
+ * @example
13
+ * const permissions: FilePermissionsParams = {
14
+ * mode: '644',
15
+ * owner: 'daytona',
16
+ * group: 'users'
17
+ * };
18
+ */
19
+ export type FilePermissionsParams = {
20
+ /** Group owner of the file */
21
+ group?: string;
22
+ /** File mode/permissions in octal format (e.g. "644") */
23
+ mode?: string;
24
+ /** User owner of the file */
25
+ owner?: string;
26
+ };
27
+ /**
28
+ * Represents a file to be uploaded to the Sandbox.
29
+ *
30
+ * @interface
31
+ * @property {string | Buffer} source - File to upload. If a Buffer, it is interpreted as the file content which is loaded into memory.
32
+ * Make sure it fits into memory, otherwise use the local file path which content will be streamed to the Sandbox.
33
+ * @property {string} destination - Absolute destination path in the Sandbox. Relative paths are resolved based on the sandbox working directory.
34
+ */
35
+ export interface FileUpload {
36
+ source: string | Buffer;
37
+ destination: string;
38
+ }
39
+ /**
40
+ * Represents a request to download a single file from the Sandbox.
41
+ *
42
+ * @interface
43
+ * @property {string} source - Source path in the Sandbox. Relative paths are resolved based on the user's
44
+ * root directory.
45
+ * @property {string} [destination] - Destination path in the local filesystem where the file content will be
46
+ * streamed to. If not provided, the file will be downloaded in the bytes buffer (might cause memory issues if the file is large).
47
+ */
48
+ export interface FileDownloadRequest {
49
+ source: string;
50
+ destination?: string;
51
+ }
52
+ /**
53
+ * Structured error metadata for a failed bulk file download item.
54
+ *
55
+ * @interface
56
+ * @property {string} message - Human-readable error message.
57
+ * @property {number | undefined} [statusCode] - HTTP-style status code for the per-file failure.
58
+ * @property {string | undefined} [errorCode] - Machine-readable error code for the per-file failure.
59
+ */
60
+ export interface FileDownloadErrorDetails {
61
+ message: string;
62
+ statusCode?: number;
63
+ errorCode?: string;
64
+ }
65
+ /**
66
+ * Represents the response to a single file download request.
67
+ *
68
+ * @interface
69
+ * @property {string} source - The original source path requested for download.
70
+ * @property {Buffer | string | undefined} [result] - The download result - file path (if destination provided in the request)
71
+ * or bytes content (if no destination in the request), undefined if failed or no data received.
72
+ * @property {string | undefined} [error] - Error message if the download failed, undefined if successful.
73
+ * @property {FileDownloadErrorDetails | undefined} [errorDetails] - Structured error metadata when the server provides it.
74
+ */
75
+ export interface FileDownloadResponse {
76
+ source: string;
77
+ result?: Buffer | string;
78
+ error?: string;
79
+ errorDetails?: FileDownloadErrorDetails;
80
+ }
81
+ /**
82
+ * Represents metadata for a file download operation.
83
+ *
84
+ * @interface
85
+ * @property {string | undefined} [destination] - Destination path in the local filesystem where the file content will be streamed to.
86
+ * @property {string | undefined} [error] - Error message if the download failed, undefined if successful.
87
+ * @property {FileDownloadErrorDetails | undefined} [errorDetails] - Structured error metadata for a failed download item.
88
+ * @property {Buffer | string | Uint8Array | undefined} [result] - The download result - file path (if destination provided in the request)
89
+ * or bytes content (if no destination in the request), undefined if failed or no data received.
90
+ */
91
+ export interface DownloadMetadata {
92
+ destination?: string;
93
+ error?: string;
94
+ errorDetails?: FileDownloadErrorDetails;
95
+ result?: Buffer | string | Uint8Array;
96
+ }
97
+ /**
98
+ * Provides file system operations within a Sandbox.
99
+ *
100
+ * @class
101
+ */
102
+ export declare class FileSystem {
103
+ private readonly clientConfig;
104
+ private readonly apiClient;
105
+ constructor(clientConfig: Configuration, apiClient: FileSystemApi);
106
+ /**
107
+ * Create a new directory in the Sandbox with specified permissions.
108
+ *
109
+ * @param {string} path - Path where the directory should be created. Relative paths are resolved based on the sandbox working directory.
110
+ * @param {string} mode - Directory permissions in octal format (e.g. "755")
111
+ * @returns {Promise<void>}
112
+ *
113
+ * @example
114
+ * // Create a directory with standard permissions
115
+ * await fs.createFolder('app/data', '755');
116
+ */
117
+ createFolder(path: string, mode: string): Promise<void>;
118
+ /**
119
+ * Deletes a file or directory from the Sandbox.
120
+ *
121
+ * @param {string} path - Path to the file or directory to delete. Relative paths are resolved based on the sandbox working directory.
122
+ * @param {boolean} [recursive] - If the file is a directory, this must be true to delete it.
123
+ * @returns {Promise<void>}
124
+ *
125
+ * @example
126
+ * // Delete a file
127
+ * await fs.deleteFile('app/temp.log');
128
+ */
129
+ deleteFile(path: string, recursive?: boolean): Promise<void>;
130
+ /**
131
+ * Downloads a file from the Sandbox. This method loads the entire file into memory, so it is not recommended
132
+ * for downloading large files.
133
+ *
134
+ * @param {string} remotePath - Path to the file to download. Relative paths are resolved based on the sandbox working directory.
135
+ * @param {number} [timeout] - Timeout for the download operation in seconds. 0 means no timeout.
136
+ * Default is 30 minutes.
137
+ * @returns {Promise<Buffer>} The file contents as a Buffer.
138
+ *
139
+ * @example
140
+ * // Download and process a file
141
+ * const fileBuffer = await fs.downloadFile('tmp/data.json');
142
+ * console.log('File content:', fileBuffer.toString());
143
+ */
144
+ downloadFile(remotePath: string, timeout?: number): Promise<Buffer>;
145
+ /**
146
+ * Downloads a file from the Sandbox and saves it to a local file. This method uses streaming to download the file,
147
+ * so it is recommended for downloading larger files.
148
+ *
149
+ * @param {string} remotePath - Path to the file to download in the Sandbox. Relative paths are resolved based on the sandbox working directory.
150
+ * @param {string} localPath - Path to save the downloaded file.
151
+ * @param {number} [timeout] - Timeout for the download operation in seconds. 0 means no timeout.
152
+ * Default is 30 minutes.
153
+ * @returns {Promise<void>}
154
+ *
155
+ * @example
156
+ * // Download and save a file
157
+ * await fs.downloadFile('tmp/data.json', 'local_file.json');
158
+ */
159
+ downloadFile(remotePath: string, localPath: string, timeout?: number): Promise<void>;
160
+ /**
161
+ * Downloads a single file from the Sandbox as a readable stream without buffering
162
+ * the entire file into memory. The returned stream can be piped directly to an HTTP
163
+ * response, a file write stream, or any other writable destination.
164
+ *
165
+ * This method is only supported in Node.js-compatible runtimes (Node.js, Bun).
166
+ * Browser and serverless environments should use {@link downloadFile} instead.
167
+ *
168
+ * @param {string} remotePath - Path to the file in the Sandbox. Relative paths are
169
+ * resolved based on the sandbox working directory.
170
+ * @param {number} [timeout] - Timeout in seconds. 0 means no timeout. Default is 30 minutes.
171
+ * @returns {Promise<Readable>} A Node.js Readable stream of the file content.
172
+ *
173
+ * @example
174
+ * // Pipe directly to an HTTP response
175
+ * const stream = await sandbox.fs.downloadFileStream('outputs/report.pdf');
176
+ * stream.pipe(res);
177
+ *
178
+ * @example
179
+ * // Pipe to a local file
180
+ * import { createWriteStream } from 'fs';
181
+ * const stream = await sandbox.fs.downloadFileStream('outputs/data.csv');
182
+ * stream.pipe(createWriteStream('local-data.csv'));
183
+ */
184
+ downloadFileStream(remotePath: string, timeout?: number): Promise<Readable>;
185
+ /**
186
+ * Downloads multiple files from the Sandbox. If the files already exist locally, they will be overwritten.
187
+ *
188
+ * @param {FileDownloadRequest[]} files - Array of file download requests.
189
+ * @param {number} [timeoutSec] - Timeout for the download operation in seconds. 0 means no timeout.
190
+ * Default is 30 minutes.
191
+ * @returns {Promise<FileDownloadResponse[]>} Array of download results.
192
+ *
193
+ * @throws {DaytonaError} If the request itself fails (network issues, invalid request/response, etc.). Individual
194
+ * file download errors are returned in `FileDownloadResponse.error`. When the daemon provides structured
195
+ * per-file metadata, it is also available in `FileDownloadResponse.errorDetails`.
196
+ *
197
+ * @example
198
+ * // Download multiple files
199
+ * const results = await fs.downloadFiles([
200
+ * { source: 'tmp/data.json' },
201
+ * { source: 'tmp/config.json', destination: 'local_config.json' }
202
+ * ]);
203
+ * results.forEach(result => {
204
+ * if (result.error) {
205
+ * console.error(`Error downloading ${result.source}: ${result.error}`);
206
+ * } else if (result.result) {
207
+ * console.log(`Downloaded ${result.source} to ${result.result}`);
208
+ * }
209
+ * });
210
+ */
211
+ downloadFiles(files: FileDownloadRequest[], timeoutSec?: number): Promise<FileDownloadResponse[]>;
212
+ /**
213
+ * Searches for text patterns within files in the Sandbox.
214
+ *
215
+ * @param {string} path - Directory to search in. Relative paths are resolved based on the sandbox working directory.
216
+ * @param {string} pattern - Search pattern
217
+ * @returns {Promise<Array<Match>>} Array of matches with file and line information
218
+ *
219
+ * @example
220
+ * // Find all TODO comments in TypeScript files
221
+ * const matches = await fs.findFiles('app/src', 'TODO:');
222
+ * matches.forEach(match => {
223
+ * console.log(`${match.file}:${match.line}: ${match.content}`);
224
+ * });
225
+ */
226
+ findFiles(path: string, pattern: string): Promise<Array<Match>>;
227
+ /**
228
+ * Retrieves detailed information about a file or directory.
229
+ *
230
+ * @param {string} path - Path to the file or directory. Relative paths are resolved based on the sandbox working directory.
231
+ * @returns {Promise<FileInfo>} Detailed file information including size, permissions, modification time
232
+ *
233
+ * @example
234
+ * // Get file details
235
+ * const info = await fs.getFileDetails('app/config.json');
236
+ * console.log(`Size: ${info.size}, Modified: ${info.modTime}`);
237
+ */
238
+ getFileDetails(path: string): Promise<FileInfo>;
239
+ /**
240
+ * Lists contents of a directory in the Sandbox.
241
+ *
242
+ * @param {string} path - Directory path to list. Relative paths are resolved based on the sandbox working directory.
243
+ * @returns {Promise<FileInfo[]>} Array of file and directory information
244
+ *
245
+ * @example
246
+ * // List directory contents
247
+ * const files = await fs.listFiles('app/src');
248
+ * files.forEach(file => {
249
+ * console.log(`${file.name} (${file.size} bytes)`);
250
+ * });
251
+ */
252
+ listFiles(path: string): Promise<FileInfo[]>;
253
+ /**
254
+ * Moves or renames a file or directory.
255
+ *
256
+ * @param {string} source - Source path. Relative paths are resolved based on the sandbox working directory.
257
+ * @param {string} destination - Destination path. Relative paths are resolved based on the sandbox working directory.
258
+ * @returns {Promise<void>}
259
+ *
260
+ * @example
261
+ * // Move a file to a new location
262
+ * await fs.moveFiles('app/temp/data.json', 'app/data/data.json');
263
+ */
264
+ moveFiles(source: string, destination: string): Promise<void>;
265
+ /**
266
+ * Replaces text content in multiple files.
267
+ *
268
+ * @param {string[]} files - Array of file paths to process. Relative paths are resolved based on the sandbox working directory.
269
+ * @param {string} pattern - Pattern to replace
270
+ * @param {string} newValue - Replacement text
271
+ * @returns {Promise<Array<ReplaceResult>>} Results of the replace operation for each file
272
+ *
273
+ * @example
274
+ * // Update version number across multiple files
275
+ * const results = await fs.replaceInFiles(
276
+ * ['app/package.json', 'app/version.ts'],
277
+ * '"version": "1.0.0"',
278
+ * '"version": "1.1.0"'
279
+ * );
280
+ */
281
+ replaceInFiles(files: string[], pattern: string, newValue: string): Promise<Array<ReplaceResult>>;
282
+ /**
283
+ * Searches for files and directories by name pattern in the Sandbox.
284
+ *
285
+ * @param {string} path - Directory to search in. Relative paths are resolved based on the sandbox working directory.
286
+ * @param {string} pattern - File name pattern (supports globs)
287
+ * @returns {Promise<SearchFilesResponse>} Search results with matching files
288
+ *
289
+ * @example
290
+ * // Find all TypeScript files
291
+ * const result = await fs.searchFiles('app', '*.ts');
292
+ * result.files.forEach(file => console.log(file));
293
+ */
294
+ searchFiles(path: string, pattern: string): Promise<SearchFilesResponse>;
295
+ /**
296
+ * Sets permissions and ownership for a file or directory.
297
+ *
298
+ * @param {string} path - Path to the file or directory. Relative paths are resolved based on the sandbox working directory.
299
+ * @param {FilePermissionsParams} permissions - Permission settings
300
+ * @returns {Promise<void>}
301
+ *
302
+ * @example
303
+ * // Set file permissions and ownership
304
+ * await fs.setFilePermissions('app/script.sh', {
305
+ * owner: 'daytona',
306
+ * group: 'users',
307
+ * mode: '755' // Execute permission for shell script
308
+ * });
309
+ */
310
+ setFilePermissions(path: string, permissions: FilePermissionsParams): Promise<void>;
311
+ /**
312
+ * Uploads a file to the Sandbox. This method loads the entire file into memory, so it is not recommended
313
+ * for uploading large files.
314
+ *
315
+ * @param {Buffer} file - Buffer of the file to upload.
316
+ * @param {string} remotePath - Destination path in the Sandbox. Relative paths are resolved based on the sandbox working directory.
317
+ * @param {number} [timeout] - Timeout for the upload operation in seconds. 0 means no timeout.
318
+ * Default is 30 minutes.
319
+ * @returns {Promise<void>}
320
+ *
321
+ * @example
322
+ * // Upload a configuration file
323
+ * await fs.uploadFile(Buffer.from('{"setting": "value"}'), 'tmp/config.json');
324
+ */
325
+ uploadFile(file: Buffer, remotePath: string, timeout?: number): Promise<void>;
326
+ /**
327
+ * Uploads a file from the local file system to the Sandbox. This method uses streaming to upload the file,
328
+ * so it is recommended for uploading larger files.
329
+ *
330
+ * @param {string} localPath - Path to the local file to upload.
331
+ * @param {string} remotePath - Destination path in the Sandbox. Relative paths are resolved based on the sandbox working directory.
332
+ * @param {number} [timeout] - Timeout for the upload operation in seconds. 0 means no timeout.
333
+ * Default is 30 minutes.
334
+ * @returns {Promise<void>}
335
+ *
336
+ * @example
337
+ * // Upload a local file
338
+ * await fs.uploadFile('local_file.txt', 'tmp/file.txt');
339
+ */
340
+ uploadFile(localPath: string, remotePath: string, timeout?: number): Promise<void>;
341
+ /**
342
+ * Uploads multiple files to the Sandbox. If files already exist at the destination paths,
343
+ * they will be overwritten.
344
+ *
345
+ * @param {FileUpload[]} files - Array of files to upload.
346
+ * @param {number} [timeout] - Timeout for the upload operation in seconds. 0 means no timeout.
347
+ * Default is 30 minutes.
348
+ * @returns {Promise<void>}
349
+ *
350
+ * @example
351
+ * // Upload multiple text files
352
+ * const files = [
353
+ * {
354
+ * source: Buffer.from('Content of file 1'),
355
+ * destination: '/tmp/file1.txt'
356
+ * },
357
+ * {
358
+ * source: 'app/data/file2.txt',
359
+ * destination: '/tmp/file2.txt'
360
+ * },
361
+ * {
362
+ * source: Buffer.from('{"key": "value"}'),
363
+ * destination: '/tmp/config.json'
364
+ * }
365
+ * ];
366
+ * await fs.uploadFiles(files);
367
+ */
368
+ uploadFiles(files: FileUpload[], timeout?: number): Promise<void>;
369
+ private makeFilePayload;
370
+ }
371
+ //# sourceMappingURL=FileSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/FileSystem.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,aAAa,EACb,QAAQ,EACR,KAAK,EAEL,aAAa,EACb,mBAAmB,EACpB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAI3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAQtC;;;;;;;;;;;;;;GAcG;AACH,MAAM,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