@daytona/sdk 0.171.0-alpha.3 → 0.171.0-alpha.5

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