@daytona/sdk 0.161.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +180 -0
  2. package/package.json +56 -0
  3. package/src/CodeInterpreter.d.ts +94 -0
  4. package/src/CodeInterpreter.js +297 -0
  5. package/src/CodeInterpreter.js.map +1 -0
  6. package/src/ComputerUse.d.ts +538 -0
  7. package/src/ComputerUse.js +808 -0
  8. package/src/ComputerUse.js.map +1 -0
  9. package/src/Daytona.d.ts +340 -0
  10. package/src/Daytona.js +538 -0
  11. package/src/Daytona.js.map +1 -0
  12. package/src/FileSystem.d.ts +326 -0
  13. package/src/FileSystem.js +412 -0
  14. package/src/FileSystem.js.map +1 -0
  15. package/src/Git.d.ts +202 -0
  16. package/src/Git.js +326 -0
  17. package/src/Git.js.map +1 -0
  18. package/src/Image.d.ts +264 -0
  19. package/src/Image.js +546 -0
  20. package/src/Image.js.map +1 -0
  21. package/src/LspServer.d.ts +171 -0
  22. package/src/LspServer.js +258 -0
  23. package/src/LspServer.js.map +1 -0
  24. package/src/ObjectStorage.d.ts +78 -0
  25. package/src/ObjectStorage.js +199 -0
  26. package/src/ObjectStorage.js.map +1 -0
  27. package/src/Process.d.ts +490 -0
  28. package/src/Process.js +790 -0
  29. package/src/Process.js.map +1 -0
  30. package/src/PtyHandle.d.ts +154 -0
  31. package/src/PtyHandle.js +416 -0
  32. package/src/PtyHandle.js.map +1 -0
  33. package/src/Sandbox.d.ts +425 -0
  34. package/src/Sandbox.js +776 -0
  35. package/src/Sandbox.js.map +1 -0
  36. package/src/Snapshot.d.ts +139 -0
  37. package/src/Snapshot.js +248 -0
  38. package/src/Snapshot.js.map +1 -0
  39. package/src/Volume.d.ts +83 -0
  40. package/src/Volume.js +119 -0
  41. package/src/Volume.js.map +1 -0
  42. package/src/code-toolbox/SandboxJsCodeToolbox.d.ts +5 -0
  43. package/src/code-toolbox/SandboxJsCodeToolbox.js +20 -0
  44. package/src/code-toolbox/SandboxJsCodeToolbox.js.map +1 -0
  45. package/src/code-toolbox/SandboxPythonCodeToolbox.d.ts +11 -0
  46. package/src/code-toolbox/SandboxPythonCodeToolbox.js +359 -0
  47. package/src/code-toolbox/SandboxPythonCodeToolbox.js.map +1 -0
  48. package/src/code-toolbox/SandboxTsCodeToolbox.d.ts +5 -0
  49. package/src/code-toolbox/SandboxTsCodeToolbox.js +29 -0
  50. package/src/code-toolbox/SandboxTsCodeToolbox.js.map +1 -0
  51. package/src/errors/DaytonaError.d.ts +31 -0
  52. package/src/errors/DaytonaError.js +51 -0
  53. package/src/errors/DaytonaError.js.map +1 -0
  54. package/src/index.d.ts +21 -0
  55. package/src/index.js +45 -0
  56. package/src/index.js.map +1 -0
  57. package/src/types/Charts.d.ts +151 -0
  58. package/src/types/Charts.js +46 -0
  59. package/src/types/Charts.js.map +1 -0
  60. package/src/types/CodeInterpreter.d.ts +76 -0
  61. package/src/types/CodeInterpreter.js +7 -0
  62. package/src/types/CodeInterpreter.js.map +1 -0
  63. package/src/types/ExecuteResponse.d.ts +25 -0
  64. package/src/types/ExecuteResponse.js +7 -0
  65. package/src/types/ExecuteResponse.js.map +1 -0
  66. package/src/types/Pty.d.ts +47 -0
  67. package/src/types/Pty.js +7 -0
  68. package/src/types/Pty.js.map +1 -0
  69. package/src/utils/ArtifactParser.d.ts +13 -0
  70. package/src/utils/ArtifactParser.js +55 -0
  71. package/src/utils/ArtifactParser.js.map +1 -0
  72. package/src/utils/Binary.d.ts +38 -0
  73. package/src/utils/Binary.js +168 -0
  74. package/src/utils/Binary.js.map +1 -0
  75. package/src/utils/FileTransfer.d.ts +14 -0
  76. package/src/utils/FileTransfer.js +216 -0
  77. package/src/utils/FileTransfer.js.map +1 -0
  78. package/src/utils/Import.d.ts +97 -0
  79. package/src/utils/Import.js +79 -0
  80. package/src/utils/Import.js.map +1 -0
  81. package/src/utils/Multipart.d.ts +26 -0
  82. package/src/utils/Multipart.js +113 -0
  83. package/src/utils/Multipart.js.map +1 -0
  84. package/src/utils/Runtime.d.ts +43 -0
  85. package/src/utils/Runtime.js +95 -0
  86. package/src/utils/Runtime.js.map +1 -0
  87. package/src/utils/Stream.d.ts +19 -0
  88. package/src/utils/Stream.js +364 -0
  89. package/src/utils/Stream.js.map +1 -0
  90. package/src/utils/WebSocket.d.ts +9 -0
  91. package/src/utils/WebSocket.js +26 -0
  92. package/src/utils/WebSocket.js.map +1 -0
  93. package/src/utils/otel.decorator.d.ts +82 -0
  94. package/src/utils/otel.decorator.js +141 -0
  95. package/src/utils/otel.decorator.js.map +1 -0
package/src/Daytona.js ADDED
@@ -0,0 +1,538 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2025 Daytona Platforms Inc.
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Daytona = exports.CodeLanguage = void 0;
8
+ const tslib_1 = require("tslib");
9
+ const api_client_1 = require("@daytonaio/api-client");
10
+ const axios_1 = tslib_1.__importStar(require("axios"));
11
+ const SandboxPythonCodeToolbox_1 = require("./code-toolbox/SandboxPythonCodeToolbox");
12
+ const SandboxTsCodeToolbox_1 = require("./code-toolbox/SandboxTsCodeToolbox");
13
+ const SandboxJsCodeToolbox_1 = require("./code-toolbox/SandboxJsCodeToolbox");
14
+ const DaytonaError_1 = require("./errors/DaytonaError");
15
+ const Image_1 = require("./Image");
16
+ const Sandbox_1 = require("./Sandbox");
17
+ const Snapshot_1 = require("./Snapshot");
18
+ const Volume_1 = require("./Volume");
19
+ const packageJson = tslib_1.__importStar(require("../package.json"));
20
+ const Stream_1 = require("./utils/Stream");
21
+ const Runtime_1 = require("./utils/Runtime");
22
+ const otel_decorator_1 = require("./utils/otel.decorator");
23
+ const api_1 = require("@opentelemetry/api");
24
+ const sdk_node_1 = require("@opentelemetry/sdk-node");
25
+ const instrumentation_http_1 = require("@opentelemetry/instrumentation-http");
26
+ const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
27
+ const exporter_trace_otlp_http_1 = require("@opentelemetry/exporter-trace-otlp-http");
28
+ const otlp_exporter_base_1 = require("@opentelemetry/otlp-exporter-base");
29
+ const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
30
+ const resources_1 = require("@opentelemetry/resources");
31
+ const api_2 = require("@opentelemetry/api");
32
+ /**
33
+ * Supported programming languages for code execution
34
+ *
35
+ * Python is used as the default sandbox language when no language is explicitly specified.
36
+ */
37
+ var CodeLanguage;
38
+ (function (CodeLanguage) {
39
+ CodeLanguage["PYTHON"] = "python";
40
+ CodeLanguage["TYPESCRIPT"] = "typescript";
41
+ CodeLanguage["JAVASCRIPT"] = "javascript";
42
+ })(CodeLanguage || (exports.CodeLanguage = CodeLanguage = {}));
43
+ /**
44
+ * Main class for interacting with the Daytona API.
45
+ * Provides methods for creating, managing, and interacting with Daytona Sandboxes.
46
+ * Can be initialized either with explicit configuration or using environment variables.
47
+ *
48
+ * @property {VolumeService} volume - Service for managing Daytona Volumes
49
+ * @property {SnapshotService} snapshot - Service for managing Daytona Snapshots
50
+ *
51
+ * @example
52
+ * // Using environment variables
53
+ * // Uses DAYTONA_API_KEY, DAYTONA_API_URL, DAYTONA_TARGET
54
+ * const daytona = new Daytona();
55
+ * const sandbox = await daytona.create();
56
+ *
57
+ * @example
58
+ * // Using explicit configuration
59
+ * const config: DaytonaConfig = {
60
+ * apiKey: "your-api-key",
61
+ * apiUrl: "https://your-api.com",
62
+ * target: "us"
63
+ * };
64
+ * const daytona = new Daytona(config);
65
+ *
66
+ * @example
67
+ * // Disposes daytona and flushes traces when done
68
+ * await using daytona = new Daytona({
69
+ * otelEnabled: true,
70
+ * });
71
+ * @class
72
+ */
73
+ class Daytona {
74
+ clientConfig;
75
+ sandboxApi;
76
+ objectStorageApi;
77
+ configApi;
78
+ target;
79
+ apiKey;
80
+ jwtToken;
81
+ organizationId;
82
+ apiUrl;
83
+ otelSdk;
84
+ volume;
85
+ snapshot;
86
+ /**
87
+ * Creates a new Daytona client instance.
88
+ *
89
+ * @param {DaytonaConfig} [config] - Configuration options
90
+ * @throws {DaytonaError} - `DaytonaError` - When API key is missing
91
+ */
92
+ constructor(config) {
93
+ let apiUrl;
94
+ if (config) {
95
+ this.apiKey = !config?.apiKey && config?.jwtToken ? undefined : config?.apiKey;
96
+ this.jwtToken = config?.jwtToken;
97
+ this.organizationId = config?.organizationId;
98
+ apiUrl = config?.apiUrl || config?.serverUrl;
99
+ this.target = config?.target;
100
+ }
101
+ let _envReader;
102
+ const envReader = () => {
103
+ if (_envReader === undefined) {
104
+ _envReader = Runtime_1.RUNTIME !== Runtime_1.Runtime.BROWSER ? new Runtime_1.DaytonaEnvReader() : null;
105
+ }
106
+ return _envReader;
107
+ };
108
+ if (!config ||
109
+ (!(this.apiKey && apiUrl && this.target) && !(this.jwtToken && this.organizationId && apiUrl && this.target))) {
110
+ const reader = envReader();
111
+ if (reader) {
112
+ this.apiKey = this.apiKey || (this.jwtToken ? undefined : reader.get('DAYTONA_API_KEY'));
113
+ this.jwtToken = this.jwtToken || reader.get('DAYTONA_JWT_TOKEN');
114
+ this.organizationId = this.organizationId || reader.get('DAYTONA_ORGANIZATION_ID');
115
+ apiUrl = apiUrl || reader.get('DAYTONA_API_URL') || reader.get('DAYTONA_SERVER_URL');
116
+ this.target = this.target || reader.get('DAYTONA_TARGET');
117
+ if (reader.get('DAYTONA_SERVER_URL') && !reader.get('DAYTONA_API_URL')) {
118
+ console.warn('[Deprecation Warning] Environment variable `DAYTONA_SERVER_URL` is deprecated and will be removed in future versions. Use `DAYTONA_API_URL` instead.');
119
+ }
120
+ }
121
+ }
122
+ this.apiUrl = apiUrl || 'https://app.daytona.io/api';
123
+ const orgHeader = {};
124
+ if (!this.apiKey) {
125
+ if (!this.organizationId) {
126
+ throw new DaytonaError_1.DaytonaError('Organization ID is required when using JWT token');
127
+ }
128
+ orgHeader['X-Daytona-Organization-ID'] = this.organizationId;
129
+ }
130
+ const isLegacyPackage = packageJson.name === '@daytonaio/sdk';
131
+ const sdkLabel = isLegacyPackage ? 'sdk-typescript-legacy' : 'sdk-typescript';
132
+ const configuration = new api_client_1.Configuration({
133
+ basePath: this.apiUrl,
134
+ baseOptions: {
135
+ headers: {
136
+ Authorization: `Bearer ${this.apiKey || this.jwtToken}`,
137
+ 'X-Daytona-Source': sdkLabel,
138
+ 'X-Daytona-SDK-Version': packageJson.version,
139
+ 'User-Agent': `${sdkLabel}/${packageJson.version}`,
140
+ ...orgHeader,
141
+ },
142
+ },
143
+ });
144
+ const axiosInstance = this.createAxiosInstance();
145
+ this.sandboxApi = new api_client_1.SandboxApi(configuration, '', axiosInstance);
146
+ this.objectStorageApi = new api_client_1.ObjectStorageApi(configuration, '', axiosInstance);
147
+ this.configApi = new api_client_1.ConfigApi(configuration, '', axiosInstance);
148
+ this.volume = new Volume_1.VolumeService(new api_client_1.VolumesApi(configuration, '', axiosInstance));
149
+ this.snapshot = new Snapshot_1.SnapshotService(configuration, new api_client_1.SnapshotsApi(configuration, '', axiosInstance), this.objectStorageApi, this.target);
150
+ this.clientConfig = configuration;
151
+ if (!config?._experimental?.otelEnabled && envReader()?.get('DAYTONA_EXPERIMENTAL_OTEL_ENABLED') !== 'true') {
152
+ return;
153
+ }
154
+ api_2.diag.setLogger(new api_2.DiagConsoleLogger(), api_2.DiagLogLevel.INFO);
155
+ this.otelSdk = new sdk_node_1.NodeSDK({
156
+ resource: (0, resources_1.resourceFromAttributes)({
157
+ [semantic_conventions_1.ATTR_SERVICE_VERSION]: packageJson.version,
158
+ [semantic_conventions_1.ATTR_SERVICE_NAME]: 'daytona-typescript-sdk',
159
+ }),
160
+ instrumentations: [
161
+ new instrumentation_http_1.HttpInstrumentation({
162
+ requireParentforOutgoingSpans: false,
163
+ }),
164
+ ],
165
+ spanProcessors: [
166
+ new sdk_trace_base_1.BatchSpanProcessor(new exporter_trace_otlp_http_1.OTLPTraceExporter({
167
+ compression: otlp_exporter_base_1.CompressionAlgorithm.GZIP,
168
+ })),
169
+ ],
170
+ });
171
+ this.otelSdk.start();
172
+ // Flush and shutdown OTEL on process exit
173
+ process.on('SIGTERM', async () => {
174
+ await this.otelSdk?.shutdown();
175
+ });
176
+ }
177
+ async [Symbol.asyncDispose]() {
178
+ if (!this.otelSdk) {
179
+ return;
180
+ }
181
+ await this.otelSdk.shutdown();
182
+ }
183
+ async create(params, options = { timeout: 60 }) {
184
+ const startTime = Date.now();
185
+ options = typeof options === 'number' ? { timeout: options } : { ...options };
186
+ if (options.timeout == undefined || options.timeout == null) {
187
+ options.timeout = 60;
188
+ }
189
+ if (params == null) {
190
+ params = { language: 'python' };
191
+ }
192
+ const labels = params.labels || {};
193
+ if (params.language) {
194
+ labels['code-toolbox-language'] = params.language;
195
+ }
196
+ if (options.timeout < 0) {
197
+ throw new DaytonaError_1.DaytonaError('Timeout must be a non-negative number');
198
+ }
199
+ if (params.autoStopInterval !== undefined &&
200
+ (!Number.isInteger(params.autoStopInterval) || params.autoStopInterval < 0)) {
201
+ throw new DaytonaError_1.DaytonaError('autoStopInterval must be a non-negative integer');
202
+ }
203
+ if (params.ephemeral) {
204
+ if (params.autoDeleteInterval !== undefined && params.autoDeleteInterval !== 0) {
205
+ console.warn("'ephemeral' and 'autoDeleteInterval' cannot be used together. If ephemeral is true, autoDeleteInterval will be ignored and set to 0.");
206
+ }
207
+ params.autoDeleteInterval = 0;
208
+ }
209
+ if (params.autoArchiveInterval !== undefined &&
210
+ (!Number.isInteger(params.autoArchiveInterval) || params.autoArchiveInterval < 0)) {
211
+ throw new DaytonaError_1.DaytonaError('autoArchiveInterval must be a non-negative integer');
212
+ }
213
+ const codeToolbox = this.getCodeToolbox(params.language);
214
+ try {
215
+ let buildInfo;
216
+ let snapshot;
217
+ let resources;
218
+ if ('snapshot' in params) {
219
+ snapshot = params.snapshot;
220
+ }
221
+ if ('image' in params) {
222
+ if (typeof params.image === 'string') {
223
+ buildInfo = {
224
+ dockerfileContent: Image_1.Image.base(params.image).dockerfile,
225
+ };
226
+ }
227
+ else if (params.image instanceof Image_1.Image) {
228
+ const contextHashes = await Snapshot_1.SnapshotService.processImageContext(this.objectStorageApi, params.image);
229
+ buildInfo = {
230
+ contextHashes,
231
+ dockerfileContent: params.image.dockerfile,
232
+ };
233
+ }
234
+ }
235
+ if ('resources' in params) {
236
+ resources = params.resources;
237
+ }
238
+ const response = await this.sandboxApi.createSandbox({
239
+ name: params.name,
240
+ snapshot: snapshot,
241
+ buildInfo,
242
+ user: params.user,
243
+ env: params.envVars || {},
244
+ labels: labels,
245
+ public: params.public,
246
+ target: this.target,
247
+ cpu: resources?.cpu,
248
+ gpu: resources?.gpu,
249
+ memory: resources?.memory,
250
+ disk: resources?.disk,
251
+ autoStopInterval: params.autoStopInterval,
252
+ autoArchiveInterval: params.autoArchiveInterval,
253
+ autoDeleteInterval: params.autoDeleteInterval,
254
+ volumes: params.volumes,
255
+ networkBlockAll: params.networkBlockAll,
256
+ networkAllowList: params.networkAllowList,
257
+ }, undefined, {
258
+ timeout: options.timeout * 1000,
259
+ });
260
+ let sandboxInstance = response.data;
261
+ if (sandboxInstance.state === api_client_1.SandboxState.PENDING_BUILD && options.onSnapshotCreateLogs) {
262
+ const terminalStates = [
263
+ api_client_1.SandboxState.STARTED,
264
+ api_client_1.SandboxState.STARTING,
265
+ api_client_1.SandboxState.ERROR,
266
+ api_client_1.SandboxState.BUILD_FAILED,
267
+ ];
268
+ while (sandboxInstance.state === api_client_1.SandboxState.PENDING_BUILD) {
269
+ if (options.timeout) {
270
+ const elapsed = (Date.now() - startTime) / 1000;
271
+ if (elapsed > options.timeout) {
272
+ throw new DaytonaError_1.DaytonaError(`Sandbox build has been pending for more than ${options.timeout} seconds. Please check the sandbox state again later.`);
273
+ }
274
+ }
275
+ await new Promise((resolve) => setTimeout(resolve, 1000));
276
+ sandboxInstance = (await this.sandboxApi.getSandbox(sandboxInstance.id)).data;
277
+ }
278
+ const response = await this.sandboxApi.getBuildLogsUrl(sandboxInstance.id);
279
+ await (0, Stream_1.processStreamingResponse)(() => fetch(response.data.url + '?follow=true', {
280
+ method: 'GET',
281
+ headers: this.clientConfig.baseOptions.headers,
282
+ }), (chunk) => options.onSnapshotCreateLogs?.(chunk.trimEnd()), async () => {
283
+ sandboxInstance = (await this.sandboxApi.getSandbox(sandboxInstance.id)).data;
284
+ return sandboxInstance.state !== undefined && terminalStates.includes(sandboxInstance.state);
285
+ });
286
+ }
287
+ const sandbox = new Sandbox_1.Sandbox(sandboxInstance, new api_client_1.Configuration(structuredClone(this.clientConfig)), this.createAxiosInstance(), this.sandboxApi, codeToolbox);
288
+ if (sandbox.state !== 'started') {
289
+ const timeElapsed = Date.now() - startTime;
290
+ await sandbox.waitUntilStarted(options.timeout ? Math.max(0.001, options.timeout - timeElapsed / 1000) : options.timeout);
291
+ }
292
+ return sandbox;
293
+ }
294
+ catch (error) {
295
+ if (error instanceof DaytonaError_1.DaytonaError && error.message.includes('Operation timed out')) {
296
+ const errMsg = `Failed to create and start sandbox within ${options.timeout} seconds. Operation timed out.`;
297
+ throw new DaytonaError_1.DaytonaError(errMsg);
298
+ }
299
+ throw error;
300
+ }
301
+ }
302
+ /**
303
+ * Gets a Sandbox by its ID or name.
304
+ *
305
+ * @param {string} sandboxIdOrName - The ID or name of the Sandbox to retrieve
306
+ * @returns {Promise<Sandbox>} The Sandbox
307
+ *
308
+ * @example
309
+ * const sandbox = await daytona.get('my-sandbox-id-or-name');
310
+ * console.log(`Sandbox state: ${sandbox.state}`);
311
+ */
312
+ async get(sandboxIdOrName) {
313
+ const response = await this.sandboxApi.getSandbox(sandboxIdOrName);
314
+ const sandboxInstance = response.data;
315
+ const language = sandboxInstance.labels && sandboxInstance.labels['code-toolbox-language'];
316
+ const codeToolbox = this.getCodeToolbox(language);
317
+ return new Sandbox_1.Sandbox(sandboxInstance, structuredClone(this.clientConfig), this.createAxiosInstance(), this.sandboxApi, codeToolbox);
318
+ }
319
+ /**
320
+ * Returns paginated list of Sandboxes filtered by labels.
321
+ *
322
+ * @param {Record<string, string>} [labels] - Labels to filter Sandboxes
323
+ * @param {number} [page] - Page number for pagination (starting from 1)
324
+ * @param {number} [limit] - Maximum number of items per page
325
+ * @returns {Promise<PaginatedSandboxes>} Paginated list of Sandboxes that match the labels.
326
+ *
327
+ * @example
328
+ * const result = await daytona.list({ 'my-label': 'my-value' }, 2, 10);
329
+ * for (const sandbox of result.items) {
330
+ * console.log(`${sandbox.id}: ${sandbox.state}`);
331
+ * }
332
+ */
333
+ async list(labels, page, limit) {
334
+ const response = await this.sandboxApi.listSandboxesPaginated(undefined, page, limit, undefined, undefined, labels ? JSON.stringify(labels) : undefined);
335
+ return {
336
+ items: response.data.items.map((sandbox) => {
337
+ const language = sandbox.labels?.['code-toolbox-language'];
338
+ return new Sandbox_1.Sandbox(sandbox, structuredClone(this.clientConfig), this.createAxiosInstance(), this.sandboxApi, this.getCodeToolbox(language));
339
+ }),
340
+ total: response.data.total,
341
+ page: response.data.page,
342
+ totalPages: response.data.totalPages,
343
+ };
344
+ }
345
+ /**
346
+ * Starts a Sandbox and waits for it to be ready.
347
+ *
348
+ * @param {Sandbox} sandbox - The Sandbox to start
349
+ * @param {number} [timeout] - Optional timeout in seconds (0 means no timeout)
350
+ * @returns {Promise<void>}
351
+ *
352
+ * @example
353
+ * const sandbox = await daytona.get('my-sandbox-id');
354
+ * // Wait up to 60 seconds for the sandbox to start
355
+ * await daytona.start(sandbox, 60);
356
+ */
357
+ async start(sandbox, timeout) {
358
+ await sandbox.start(timeout);
359
+ }
360
+ /**
361
+ * Stops a Sandbox.
362
+ *
363
+ * @param {Sandbox} sandbox - The Sandbox to stop
364
+ * @returns {Promise<void>}
365
+ *
366
+ * @example
367
+ * const sandbox = await daytona.get('my-sandbox-id');
368
+ * await daytona.stop(sandbox);
369
+ */
370
+ async stop(sandbox) {
371
+ await sandbox.stop();
372
+ }
373
+ /**
374
+ * Deletes a Sandbox.
375
+ *
376
+ * @param {Sandbox} sandbox - The Sandbox to delete
377
+ * @param {number} timeout - Timeout in seconds (0 means no timeout, default is 60)
378
+ * @returns {Promise<void>}
379
+ *
380
+ * @example
381
+ * const sandbox = await daytona.get('my-sandbox-id');
382
+ * await daytona.delete(sandbox);
383
+ */
384
+ async delete(sandbox, timeout = 60) {
385
+ await sandbox.delete(timeout);
386
+ }
387
+ /**
388
+ * Gets the appropriate code toolbox based on language.
389
+ *
390
+ * @private
391
+ * @param {CodeLanguage} [language] - Programming language for the toolbox
392
+ * @returns {SandboxCodeToolbox} The appropriate code toolbox instance
393
+ * @throws {DaytonaError} - `DaytonaError` - When an unsupported language is specified
394
+ */
395
+ getCodeToolbox(language) {
396
+ switch (language) {
397
+ case CodeLanguage.JAVASCRIPT:
398
+ return new SandboxJsCodeToolbox_1.SandboxJsCodeToolbox();
399
+ case CodeLanguage.TYPESCRIPT:
400
+ return new SandboxTsCodeToolbox_1.SandboxTsCodeToolbox();
401
+ case CodeLanguage.PYTHON:
402
+ case undefined:
403
+ return new SandboxPythonCodeToolbox_1.SandboxPythonCodeToolbox();
404
+ default: {
405
+ const errMsg = `Unsupported language: ${language}, supported languages: ${Object.values(CodeLanguage).join(', ')}`;
406
+ throw new DaytonaError_1.DaytonaError(errMsg);
407
+ }
408
+ }
409
+ }
410
+ createAxiosInstance() {
411
+ const axiosInstance = axios_1.default.create({
412
+ timeout: 24 * 60 * 60 * 1000, // 24 hours
413
+ });
414
+ // Request interceptor: Inject trace context into headers
415
+ axiosInstance.interceptors.request.use((requestConfig) => {
416
+ // Get the current active context (which may contain an active span)
417
+ const currentContext = api_1.context.active();
418
+ // Inject trace context into HTTP headers using W3C Trace Context propagation
419
+ // This adds headers like 'traceparent' and 'tracestate'
420
+ api_1.propagation.inject(currentContext, requestConfig.headers);
421
+ requestConfig.metadata = { startTime: Date.now() };
422
+ return requestConfig;
423
+ }, (error) => {
424
+ return Promise.reject(error);
425
+ });
426
+ axiosInstance.interceptors.response.use((response) => {
427
+ return response;
428
+ }, (error) => {
429
+ let errorMessage;
430
+ if (error instanceof axios_1.AxiosError && error.message.includes('timeout of')) {
431
+ errorMessage = 'Operation timed out';
432
+ }
433
+ else {
434
+ errorMessage = error.response?.data?.message || error.response?.data || error.message || String(error);
435
+ }
436
+ if (typeof errorMessage === 'object') {
437
+ try {
438
+ errorMessage = JSON.stringify(errorMessage);
439
+ }
440
+ catch {
441
+ errorMessage = String(errorMessage);
442
+ }
443
+ }
444
+ const statusCode = error.response?.status;
445
+ const headers = error.response?.headers;
446
+ switch (statusCode) {
447
+ case 404:
448
+ throw new DaytonaError_1.DaytonaNotFoundError(errorMessage, statusCode, headers);
449
+ case 429:
450
+ throw new DaytonaError_1.DaytonaRateLimitError(errorMessage, statusCode, headers);
451
+ default:
452
+ throw new DaytonaError_1.DaytonaError(errorMessage, statusCode, headers);
453
+ }
454
+ });
455
+ axiosInstance.interceptors.response.use((response) => {
456
+ const startTime = response.config.metadata?.startTime;
457
+ if (startTime) {
458
+ const duration = Date.now() - startTime;
459
+ // Get the active span to add attributes
460
+ const activeSpan = api_1.trace.getActiveSpan();
461
+ // Only modify the span if it's still recording (not ended)
462
+ if (activeSpan && activeSpan.isRecording()) {
463
+ // Add response metadata to the span
464
+ activeSpan.setAttributes({
465
+ 'http.response.status_code': response.status,
466
+ 'http.response.duration_ms': duration,
467
+ // 'http.response.size_bytes': JSON.stringify(response.data).length,
468
+ });
469
+ }
470
+ }
471
+ return response;
472
+ }, (error) => {
473
+ const startTime = error.config?.metadata?.startTime;
474
+ if (startTime) {
475
+ const duration = Date.now() - startTime;
476
+ // Get the active span to record the error
477
+ const activeSpan = api_1.trace.getActiveSpan();
478
+ // Only modify the span if it's still recording (not ended)
479
+ if (activeSpan && activeSpan.isRecording()) {
480
+ activeSpan.setStatus({
481
+ code: api_1.SpanStatusCode.ERROR,
482
+ message: error.message,
483
+ });
484
+ activeSpan.setAttributes({
485
+ 'http.response.duration_ms': duration,
486
+ 'error.type': error.name,
487
+ 'error.message': error.message,
488
+ });
489
+ if (error.response) {
490
+ activeSpan.setAttribute('http.response.status_code', error.response.status);
491
+ }
492
+ // Record the exception on the span
493
+ activeSpan.recordException(error);
494
+ }
495
+ }
496
+ return Promise.reject(error);
497
+ });
498
+ return axiosInstance;
499
+ }
500
+ }
501
+ exports.Daytona = Daytona;
502
+ tslib_1.__decorate([
503
+ (0, otel_decorator_1.WithInstrumentation)(),
504
+ tslib_1.__metadata("design:type", Function),
505
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
506
+ tslib_1.__metadata("design:returntype", Promise)
507
+ ], Daytona.prototype, "create", null);
508
+ tslib_1.__decorate([
509
+ (0, otel_decorator_1.WithInstrumentation)(),
510
+ tslib_1.__metadata("design:type", Function),
511
+ tslib_1.__metadata("design:paramtypes", [String]),
512
+ tslib_1.__metadata("design:returntype", Promise)
513
+ ], Daytona.prototype, "get", null);
514
+ tslib_1.__decorate([
515
+ (0, otel_decorator_1.WithInstrumentation)(),
516
+ tslib_1.__metadata("design:type", Function),
517
+ tslib_1.__metadata("design:paramtypes", [Object, Number, Number]),
518
+ tslib_1.__metadata("design:returntype", Promise)
519
+ ], Daytona.prototype, "list", null);
520
+ tslib_1.__decorate([
521
+ (0, otel_decorator_1.WithInstrumentation)(),
522
+ tslib_1.__metadata("design:type", Function),
523
+ tslib_1.__metadata("design:paramtypes", [Sandbox_1.Sandbox, Number]),
524
+ tslib_1.__metadata("design:returntype", Promise)
525
+ ], Daytona.prototype, "start", null);
526
+ tslib_1.__decorate([
527
+ (0, otel_decorator_1.WithInstrumentation)(),
528
+ tslib_1.__metadata("design:type", Function),
529
+ tslib_1.__metadata("design:paramtypes", [Sandbox_1.Sandbox]),
530
+ tslib_1.__metadata("design:returntype", Promise)
531
+ ], Daytona.prototype, "stop", null);
532
+ tslib_1.__decorate([
533
+ (0, otel_decorator_1.WithInstrumentation)(),
534
+ tslib_1.__metadata("design:type", Function),
535
+ tslib_1.__metadata("design:paramtypes", [Sandbox_1.Sandbox, Object]),
536
+ tslib_1.__metadata("design:returntype", Promise)
537
+ ], Daytona.prototype, "delete", null);
538
+ //# sourceMappingURL=Daytona.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Daytona.js","sourceRoot":"","sources":["../../../../libs/sdk-typescript/src/Daytona.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,sDAS8B;AAC9B,uDAAoF;AACpF,sFAAkF;AAClF,8EAA0E;AAC1E,8EAA0E;AAC1E,wDAAiG;AACjG,mCAA+B;AAC/B,uCAAuD;AACvD,yCAA4C;AAC5C,qCAAwC;AACxC,qEAA8C;AAC9C,2CAAyD;AACzD,6CAAoE;AACpE,2DAA4D;AAC5D,4CAAgF;AAChF,sDAAiD;AACjD,8EAAyE;AACzE,kEAAkE;AAClE,sFAA2E;AAC3E,0EAAwE;AACxE,8EAA6F;AAC7F,wDAAiE;AACjE,4CAA0E;AA0D1E;;;;GAIG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,yCAAyB,CAAA;IACzB,yCAAyB,CAAA;AAC3B,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAsFD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAa,OAAO;IACD,YAAY,CAAe;IAC3B,UAAU,CAAY;IACtB,gBAAgB,CAAkB;IAClC,SAAS,CAAW;IACpB,MAAM,CAAS;IACf,MAAM,CAAS;IACf,QAAQ,CAAS;IACjB,cAAc,CAAS;IACvB,MAAM,CAAQ;IACvB,OAAO,CAAU;IACT,MAAM,CAAe;IACrB,QAAQ,CAAiB;IAEzC;;;;;OAKG;IACH,YAAY,MAAsB;QAChC,IAAI,MAA0B,CAAA;QAC9B,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,IAAI,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAA;YAC9E,IAAI,CAAC,QAAQ,GAAG,MAAM,EAAE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