@computesdk/daytona 1.7.24 → 1.7.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,7 +21,7 @@ import { compute } from 'computesdk';
21
21
  const sandbox = await compute.sandbox.create();
22
22
 
23
23
  // Execute code
24
- const result = await sandbox.runCode('print("Hello from Daytona!")');
24
+ const result = await sandbox.runCommand('python -c "print(\"Hello from Daytona!\")"');
25
25
  console.log(result.stdout); // "Hello from Daytona!"
26
26
 
27
27
  await sandbox.destroy();
@@ -40,7 +40,7 @@ const compute = daytona({
40
40
 
41
41
  const sandbox = await compute.sandbox.create();
42
42
 
43
- const result = await sandbox.runCode('print("Hello from Daytona!")');
43
+ const result = await sandbox.runCommand('python -c "print(\"Hello from Daytona!\")"');
44
44
  console.log(result.stdout);
45
45
 
46
46
  await sandbox.destroy();
@@ -81,20 +81,20 @@ interface DaytonaConfig {
81
81
 
82
82
  ```typescript
83
83
  // Execute Python code
84
- const result = await sandbox.runCode(`
84
+ const result = await sandbox.runCommand(`python - <<'PY'
85
85
  import json
86
86
  data = {"message": "Hello from Python"}
87
87
  print(json.dumps(data))
88
- `, 'python');
88
+ PY`);
89
89
 
90
90
  // Execute Node.js code
91
- const result = await sandbox.runCode(`
91
+ const result = await sandbox.runCommand(`node - <<'JS'
92
92
  const data = { message: "Hello from Node.js" };
93
93
  console.log(JSON.stringify(data));
94
- `, 'node');
94
+ JS`);
95
95
 
96
96
  // Auto-detection (based on code patterns)
97
- const result = await sandbox.runCode('print("Auto-detected as Python")');
97
+ const result = await sandbox.runCommand('python -c "print(\"Auto-detected as Python\")"');
98
98
  ```
99
99
 
100
100
  ### Command Execution
@@ -170,7 +170,7 @@ try {
170
170
  const compute = daytona({ apiKey: process.env.DAYTONA_API_KEY });
171
171
  const sandbox = await compute.sandbox.create();
172
172
 
173
- const result = await sandbox.runCode('invalid code');
173
+ const result = await sandbox.runCommand('invalid code');
174
174
  } catch (error) {
175
175
  if (error.message.includes('Syntax error')) {
176
176
  console.error('Code has syntax errors');
@@ -192,7 +192,7 @@ import { daytona } from '@computesdk/daytona';
192
192
  const compute = daytona({ apiKey: process.env.DAYTONA_API_KEY });
193
193
  const sandbox = await compute.sandbox.create();
194
194
 
195
- const result = await sandbox.runCode(`
195
+ const result = await sandbox.runCommand(`python - <<'PY'
196
196
  import json
197
197
 
198
198
  # Process data
@@ -204,7 +204,7 @@ result = {
204
204
  }
205
205
 
206
206
  print(json.dumps(result))
207
- `);
207
+ PY`);
208
208
 
209
209
  const output = JSON.parse(result.stdout);
210
210
  console.log(output); // { sum: 15, average: 3, max: 5 }
@@ -226,7 +226,7 @@ await sandbox.filesystem.writeFile('/workspace/data.json',
226
226
  );
227
227
 
228
228
  // Process file
229
- const result = await sandbox.runCode(`
229
+ const result = await sandbox.runCommand(`python - <<'PY'
230
230
  import json
231
231
 
232
232
  with open('/workspace/data.json', 'r') as f:
@@ -240,7 +240,7 @@ print(f"Found {user_count} users")
240
240
  result = {"user_count": user_count, "processed": True}
241
241
  with open('/workspace/result.json', 'w') as f:
242
242
  json.dump(result, f)
243
- `);
243
+ PY`);
244
244
 
245
245
  // Read result
246
246
  const resultData = await sandbox.filesystem.readFile('/workspace/result.json');
@@ -251,4 +251,4 @@ await sandbox.destroy();
251
251
 
252
252
  ## License
253
253
 
254
- MIT
254
+ MIT
package/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import * as _computesdk_provider from '@computesdk/provider';
2
- import { Runtime } from '@computesdk/provider';
3
2
  import { Sandbox } from '@daytonaio/sdk';
4
3
 
5
4
  /**
@@ -8,8 +7,8 @@ import { Sandbox } from '@daytonaio/sdk';
8
7
  interface DaytonaConfig {
9
8
  /** Daytona API key - if not provided, will fallback to DAYTONA_API_KEY environment variable */
10
9
  apiKey?: string;
11
- /** Default runtime environment */
12
- runtime?: Runtime;
10
+ /** Default runtime environment (e.g. 'python', 'node') */
11
+ runtime?: string;
13
12
  /** Execution timeout in milliseconds */
14
13
  timeout?: number;
15
14
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import * as _computesdk_provider from '@computesdk/provider';
2
- import { Runtime } from '@computesdk/provider';
3
2
  import { Sandbox } from '@daytonaio/sdk';
4
3
 
5
4
  /**
@@ -8,8 +7,8 @@ import { Sandbox } from '@daytonaio/sdk';
8
7
  interface DaytonaConfig {
9
8
  /** Daytona API key - if not provided, will fallback to DAYTONA_API_KEY environment variable */
10
9
  apiKey?: string;
11
- /** Default runtime environment */
12
- runtime?: Runtime;
10
+ /** Default runtime environment (e.g. 'python', 'node') */
11
+ runtime?: string;
13
12
  /** Execution timeout in milliseconds */
14
13
  timeout?: number;
15
14
  }
package/dist/index.js CHANGED
@@ -29,7 +29,6 @@ var daytona = (0, import_provider.defineProvider)({
29
29
  name: "daytona",
30
30
  methods: {
31
31
  sandbox: {
32
- // Collection operations (compute.sandbox.*)
33
32
  create: async (config, options) => {
34
33
  const apiKey = config.apiKey || typeof process !== "undefined" && process.env?.DAYTONA_API_KEY || "";
35
34
  if (!apiKey) {
@@ -41,73 +40,53 @@ var daytona = (0, import_provider.defineProvider)({
41
40
  const timeout = options?.timeout ?? config.timeout;
42
41
  try {
43
42
  const daytona2 = new import_sdk.Daytona({ apiKey });
44
- let session;
45
- let sandboxId;
46
- if (options?.sandboxId) {
47
- session = await daytona2.get(options.sandboxId);
48
- sandboxId = options.sandboxId;
49
- } else {
50
- const {
51
- runtime: _runtime,
52
- timeout: _timeout,
53
- envs,
54
- name,
55
- metadata,
56
- templateId,
57
- snapshotId,
58
- sandboxId: _sandboxId,
59
- namespace: _namespace,
60
- directory: _directory,
61
- overlays: _overlays,
62
- servers: _servers,
63
- ...providerOptions
64
- } = options || {};
65
- const createParams = {
66
- language: runtime === "python" ? "python" : "javascript",
67
- ...providerOptions
68
- // Spread provider-specific options (e.g., resources, public, autoStopInterval)
69
- };
70
- if (envs && Object.keys(envs).length > 0) {
71
- createParams.envVars = envs;
72
- }
73
- if (name) {
74
- createParams.name = name;
75
- }
76
- if (metadata && typeof metadata === "object") {
77
- const labels = {};
78
- for (const [k, v] of Object.entries(metadata)) {
79
- labels[k] = typeof v === "string" ? v : JSON.stringify(v);
80
- }
81
- createParams.labels = labels;
82
- }
83
- const sourceId = templateId || snapshotId;
84
- if (sourceId) {
85
- createParams.snapshot = sourceId;
43
+ const {
44
+ timeout: _timeout,
45
+ envs,
46
+ name,
47
+ metadata,
48
+ templateId,
49
+ snapshotId,
50
+ sandboxId: _sandboxId,
51
+ namespace: _namespace,
52
+ directory: _directory,
53
+ ...providerOptions
54
+ } = options || {};
55
+ const createParams = {
56
+ language: runtime === "python" ? "python" : "javascript",
57
+ ...providerOptions
58
+ };
59
+ if (envs && Object.keys(envs).length > 0) {
60
+ createParams.envVars = envs;
61
+ }
62
+ if (name) {
63
+ createParams.name = name;
64
+ }
65
+ if (metadata && typeof metadata === "object") {
66
+ const labels = {};
67
+ for (const [k, v] of Object.entries(metadata)) {
68
+ labels[k] = typeof v === "string" ? v : JSON.stringify(v);
86
69
  }
87
- const createOptions = timeout ? { timeout: Math.ceil(timeout / 1e3) } : void 0;
88
- session = await daytona2.create(createParams, createOptions);
89
- sandboxId = session.id;
70
+ createParams.labels = labels;
90
71
  }
91
- return {
92
- sandbox: session,
93
- sandboxId
94
- };
72
+ const sourceId = templateId || snapshotId;
73
+ if (sourceId) {
74
+ createParams.snapshot = sourceId;
75
+ }
76
+ const createOptions = timeout ? { timeout: Math.ceil(timeout / 1e3) } : void 0;
77
+ const session = await daytona2.create(createParams, createOptions);
78
+ const sandboxId = session.id;
79
+ return { sandbox: session, sandboxId };
95
80
  } catch (error) {
96
81
  if (error instanceof Error) {
97
82
  if (error.message.includes("unauthorized") || error.message.includes("API key")) {
98
- throw new Error(
99
- `Daytona authentication failed. Please check your DAYTONA_API_KEY environment variable. Get your API key from https://daytona.io/`
100
- );
83
+ throw new Error(`Daytona authentication failed. Please check your DAYTONA_API_KEY environment variable.`);
101
84
  }
102
85
  if (error.message.includes("quota") || error.message.includes("limit")) {
103
- throw new Error(
104
- `Daytona quota exceeded. Please check your usage at https://daytona.io/`
105
- );
86
+ throw new Error(`Daytona quota exceeded. Please check your usage at https://daytona.io/`);
106
87
  }
107
88
  }
108
- throw new Error(
109
- `Failed to create Daytona sandbox: ${error instanceof Error ? error.message : String(error)}`
110
- );
89
+ throw new Error(`Failed to create Daytona sandbox: ${error instanceof Error ? error.message : String(error)}`);
111
90
  }
112
91
  },
113
92
  getById: async (config, sandboxId) => {
@@ -115,17 +94,12 @@ var daytona = (0, import_provider.defineProvider)({
115
94
  try {
116
95
  const daytona2 = new import_sdk.Daytona({ apiKey });
117
96
  const session = await daytona2.get(sandboxId);
118
- return {
119
- sandbox: session,
120
- sandboxId
121
- };
97
+ return { sandbox: session, sandboxId };
122
98
  } catch (error) {
123
99
  if (error instanceof Error && (error.message.includes("not found") || error.message.includes("404"))) {
124
100
  return null;
125
101
  }
126
- throw new Error(
127
- `Failed to get Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`
128
- );
102
+ throw new Error(`Failed to get Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`);
129
103
  }
130
104
  },
131
105
  list: async (config) => {
@@ -133,14 +107,9 @@ var daytona = (0, import_provider.defineProvider)({
133
107
  try {
134
108
  const daytona2 = new import_sdk.Daytona({ apiKey });
135
109
  const result = await daytona2.list();
136
- return result.items.map((session) => ({
137
- sandbox: session,
138
- sandboxId: session.id
139
- }));
110
+ return result.items.map((session) => ({ sandbox: session, sandboxId: session.id }));
140
111
  } catch (error) {
141
- throw new Error(
142
- `Failed to list Daytona sandboxes: ${error instanceof Error ? error.message : String(error)}`
143
- );
112
+ throw new Error(`Failed to list Daytona sandboxes: ${error instanceof Error ? error.message : String(error)}`);
144
113
  }
145
114
  },
146
115
  destroy: async (config, sandboxId) => {
@@ -153,42 +122,7 @@ var daytona = (0, import_provider.defineProvider)({
153
122
  if (error instanceof Error && (error.message.includes("not found") || error.message.includes("404"))) {
154
123
  return;
155
124
  }
156
- throw new Error(
157
- `Failed to destroy Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`
158
- );
159
- }
160
- },
161
- // Instance operations (sandbox.*)
162
- runCode: async (sandbox, code, runtime) => {
163
- const startTime = Date.now();
164
- try {
165
- const effectiveRuntime = runtime || // Strong Python indicators
166
- (code.includes("print(") || code.includes("import ") || code.includes("def ") || code.includes("sys.") || code.includes("json.") || code.includes("__") || code.includes('f"') || code.includes("f'") || code.includes("raise ") ? "python" : "node");
167
- let response;
168
- const encoded = Buffer.from(code).toString("base64");
169
- if (effectiveRuntime === "python") {
170
- response = await sandbox.process.executeCommand(`echo "${encoded}" | base64 -d | python3`);
171
- } else {
172
- response = await sandbox.process.executeCommand(`echo "${encoded}" | base64 -d | node`);
173
- }
174
- const output = response.result || "";
175
- const hasError = output.includes("Error:") || output.includes("error TS") || output.includes("SyntaxError:") || output.includes("TypeError:") || output.includes("ReferenceError:") || output.includes("Traceback (most recent call last)");
176
- if (hasError && (output.includes("SyntaxError:") || output.includes("invalid syntax") || output.includes("Unexpected token") || output.includes("Unexpected identifier") || output.includes("error TS1434"))) {
177
- throw new Error(`Syntax error: ${output.trim()}`);
178
- }
179
- const actualExitCode = hasError ? 1 : response.exitCode || 0;
180
- return {
181
- output,
182
- exitCode: actualExitCode,
183
- language: effectiveRuntime
184
- };
185
- } catch (error) {
186
- if (error instanceof Error && error.message.includes("Syntax error")) {
187
- throw error;
188
- }
189
- throw new Error(
190
- `Daytona execution failed: ${error instanceof Error ? error.message : String(error)}`
191
- );
125
+ throw new Error(`Failed to destroy Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`);
192
126
  }
193
127
  },
194
128
  runCommand: async (sandbox, command, options) => {
@@ -199,12 +133,8 @@ var daytona = (0, import_provider.defineProvider)({
199
133
  const envPrefix = Object.entries(options.env).map(([k, v]) => `${k}="${(0, import_provider.escapeShellArg)(v)}"`).join(" ");
200
134
  fullCommand = `${envPrefix} ${fullCommand}`;
201
135
  }
202
- if (options?.cwd) {
203
- fullCommand = `cd "${(0, import_provider.escapeShellArg)(options.cwd)}" && ${fullCommand}`;
204
- }
205
- if (options?.background) {
206
- fullCommand = `nohup ${fullCommand} > /dev/null 2>&1 &`;
207
- }
136
+ if (options?.cwd) fullCommand = `cd "${(0, import_provider.escapeShellArg)(options.cwd)}" && ${fullCommand}`;
137
+ if (options?.background) fullCommand = `nohup ${fullCommand} > /dev/null 2>&1 &`;
208
138
  const response = await sandbox.process.executeCommand(fullCommand);
209
139
  return {
210
140
  stdout: response.result || "",
@@ -213,23 +143,17 @@ var daytona = (0, import_provider.defineProvider)({
213
143
  durationMs: Date.now() - startTime
214
144
  };
215
145
  } catch (error) {
216
- throw new Error(
217
- `Daytona command execution failed: ${error instanceof Error ? error.message : String(error)}`
218
- );
146
+ throw new Error(`Daytona command execution failed: ${error instanceof Error ? error.message : String(error)}`);
219
147
  }
220
148
  },
221
149
  getInfo: async (sandbox) => {
222
150
  return {
223
151
  id: sandbox.id,
224
152
  provider: "daytona",
225
- runtime: "python",
226
- // Daytona default
227
153
  status: "running",
228
154
  createdAt: /* @__PURE__ */ new Date(),
229
155
  timeout: 3e5,
230
- metadata: {
231
- daytonaSandboxId: sandbox.id
232
- }
156
+ metadata: { daytonaSandboxId: sandbox.id }
233
157
  };
234
158
  },
235
159
  getUrl: async (sandbox, options) => {
@@ -243,100 +167,53 @@ var daytona = (0, import_provider.defineProvider)({
243
167
  }
244
168
  return url;
245
169
  } catch (error) {
246
- throw new Error(
247
- `Failed to get Daytona preview URL for port ${options.port}: ${error instanceof Error ? error.message : String(error)}`
248
- );
170
+ throw new Error(`Failed to get Daytona preview URL for port ${options.port}: ${error instanceof Error ? error.message : String(error)}`);
249
171
  }
250
172
  },
251
- // Filesystem operations via terminal commands
252
173
  filesystem: {
253
174
  readFile: async (sandbox, path) => {
254
- try {
255
- const response = await sandbox.process.executeCommand(`cat "${path}"`);
256
- if (response.exitCode !== 0) {
257
- throw new Error(`File not found or cannot be read: ${path}`);
258
- }
259
- return response.result || "";
260
- } catch (error) {
261
- throw new Error(`Failed to read file ${path}: ${error instanceof Error ? error.message : String(error)}`);
262
- }
175
+ const response = await sandbox.process.executeCommand(`cat "${path}"`);
176
+ if (response.exitCode !== 0) throw new Error(`File not found or cannot be read: ${path}`);
177
+ return response.result || "";
263
178
  },
264
179
  writeFile: async (sandbox, path, content) => {
265
- try {
266
- const encoded = Buffer.from(content).toString("base64");
267
- const response = await sandbox.process.executeCommand(`echo "${encoded}" | base64 -d > "${path}"`);
268
- if (response.exitCode !== 0) {
269
- throw new Error(`Failed to write to file: ${path}`);
270
- }
271
- } catch (error) {
272
- throw new Error(`Failed to write file ${path}: ${error instanceof Error ? error.message : String(error)}`);
273
- }
180
+ const encoded = Buffer.from(content).toString("base64");
181
+ const response = await sandbox.process.executeCommand(`echo "${encoded}" | base64 -d > "${path}"`);
182
+ if (response.exitCode !== 0) throw new Error(`Failed to write to file: ${path}`);
274
183
  },
275
184
  mkdir: async (sandbox, path) => {
276
- try {
277
- const response = await sandbox.process.executeCommand(`mkdir -p "${path}"`);
278
- if (response.exitCode !== 0) {
279
- throw new Error(`Failed to create directory: ${path}`);
280
- }
281
- } catch (error) {
282
- throw new Error(`Failed to create directory ${path}: ${error instanceof Error ? error.message : String(error)}`);
283
- }
185
+ const response = await sandbox.process.executeCommand(`mkdir -p "${path}"`);
186
+ if (response.exitCode !== 0) throw new Error(`Failed to create directory: ${path}`);
284
187
  },
285
188
  readdir: async (sandbox, path) => {
286
- try {
287
- const response = await sandbox.process.executeCommand(`ls -la "${path}"`);
288
- if (response.exitCode !== 0) {
289
- throw new Error(`Directory not found or cannot be read: ${path}`);
290
- }
291
- const lines = response.result.split("\n").filter((line) => line.trim());
292
- const entries = [];
293
- for (const line of lines) {
294
- if (line.startsWith("total ") || line.endsWith(" .") || line.endsWith(" ..")) {
295
- continue;
296
- }
297
- const parts = line.trim().split(/\s+/);
298
- if (parts.length >= 9) {
299
- const permissions = parts[0];
300
- const name = parts.slice(8).join(" ");
301
- const isDirectory = permissions.startsWith("d");
302
- const size = parseInt(parts[4]) || 0;
303
- entries.push({
304
- name,
305
- type: isDirectory ? "directory" : "file",
306
- size,
307
- modified: /* @__PURE__ */ new Date()
308
- // ls -la date parsing is complex, use current time
309
- });
310
- }
189
+ const response = await sandbox.process.executeCommand(`ls -la "${path}"`);
190
+ if (response.exitCode !== 0) throw new Error(`Directory not found or cannot be read: ${path}`);
191
+ const lines = response.result.split("\n").filter((l) => l.trim());
192
+ const entries = [];
193
+ for (const line of lines) {
194
+ if (line.startsWith("total ") || line.endsWith(" .") || line.endsWith(" ..")) continue;
195
+ const parts = line.trim().split(/\s+/);
196
+ if (parts.length >= 9) {
197
+ entries.push({
198
+ name: parts.slice(8).join(" "),
199
+ type: parts[0].startsWith("d") ? "directory" : "file",
200
+ size: parseInt(parts[4]) || 0,
201
+ modified: /* @__PURE__ */ new Date()
202
+ });
311
203
  }
312
- return entries;
313
- } catch (error) {
314
- throw new Error(`Failed to read directory ${path}: ${error instanceof Error ? error.message : String(error)}`);
315
204
  }
205
+ return entries;
316
206
  },
317
207
  exists: async (sandbox, path) => {
318
- try {
319
- const response = await sandbox.process.executeCommand(`test -e "${path}"`);
320
- return response.exitCode === 0;
321
- } catch (error) {
322
- return false;
323
- }
208
+ const response = await sandbox.process.executeCommand(`test -e "${path}"`);
209
+ return response.exitCode === 0;
324
210
  },
325
211
  remove: async (sandbox, path) => {
326
- try {
327
- const response = await sandbox.process.executeCommand(`rm -rf "${path}"`);
328
- if (response.exitCode !== 0) {
329
- throw new Error(`Failed to remove: ${path}`);
330
- }
331
- } catch (error) {
332
- throw new Error(`Failed to remove ${path}: ${error instanceof Error ? error.message : String(error)}`);
333
- }
212
+ const response = await sandbox.process.executeCommand(`rm -rf "${path}"`);
213
+ if (response.exitCode !== 0) throw new Error(`Failed to remove: ${path}`);
334
214
  }
335
215
  },
336
- // Provider-specific typed getInstance method
337
- getInstance: (sandbox) => {
338
- return sandbox;
339
- }
216
+ getInstance: (sandbox) => sandbox
340
217
  },
341
218
  snapshot: {
342
219
  create: async (config, sandboxId, options) => {
@@ -356,9 +233,8 @@ var daytona = (0, import_provider.defineProvider)({
356
233
  const apiKey = config.apiKey || process.env.DAYTONA_API_KEY;
357
234
  const daytona2 = new import_sdk.Daytona({ apiKey });
358
235
  try {
359
- const result = await daytona2.snapshots.list();
360
- return result;
361
- } catch (error) {
236
+ return await daytona2.snapshots.list();
237
+ } catch {
362
238
  return [];
363
239
  }
364
240
  },
@@ -367,22 +243,20 @@ var daytona = (0, import_provider.defineProvider)({
367
243
  const daytona2 = new import_sdk.Daytona({ apiKey });
368
244
  try {
369
245
  await daytona2.snapshots.delete(snapshotId);
370
- } catch (error) {
246
+ } catch {
371
247
  }
372
248
  }
373
249
  },
374
- // Templates in Daytona are effectively Snapshots
375
250
  template: {
376
- create: async (config, options) => {
251
+ create: async (_config, _options) => {
377
252
  throw new Error("To create a template in Daytona, create a snapshot from a running sandbox using snapshot.create()");
378
253
  },
379
254
  list: async (config) => {
380
255
  const apiKey = config.apiKey || process.env.DAYTONA_API_KEY;
381
256
  const daytona2 = new import_sdk.Daytona({ apiKey });
382
257
  try {
383
- const result = await daytona2.snapshots.list();
384
- return result;
385
- } catch (error) {
258
+ return await daytona2.snapshots.list();
259
+ } catch {
386
260
  return [];
387
261
  }
388
262
  },
@@ -391,7 +265,7 @@ var daytona = (0, import_provider.defineProvider)({
391
265
  const daytona2 = new import_sdk.Daytona({ apiKey });
392
266
  try {
393
267
  await daytona2.snapshots.delete(templateId);
394
- } catch (error) {
268
+ } catch {
395
269
  }
396
270
  }
397
271
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Daytona Provider - Factory-based Implementation\n * \n * Code execution only provider using the factory pattern.\n * Reduces ~300 lines of boilerplate to ~80 lines of core logic.\n */\n\nimport { Daytona, Sandbox as DaytonaSandbox } from '@daytonaio/sdk';\nimport { defineProvider, escapeShellArg } from '@computesdk/provider';\n\nimport type { Runtime, CodeResult, CommandResult, SandboxInfo, CreateSandboxOptions, FileEntry, RunCommandOptions } from '@computesdk/provider';\n\n/**\n * Daytona-specific configuration options\n */\nexport interface DaytonaConfig {\n /** Daytona API key - if not provided, will fallback to DAYTONA_API_KEY environment variable */\n apiKey?: string;\n /** Default runtime environment */\n runtime?: Runtime;\n /** Execution timeout in milliseconds */\n timeout?: number;\n}\n\n/**\n * Create a Daytona provider instance using the factory pattern\n */\nexport const daytona = defineProvider<DaytonaSandbox, DaytonaConfig>({\n name: 'daytona',\n methods: {\n sandbox: {\n // Collection operations (compute.sandbox.*)\n create: async (config: DaytonaConfig, options?: CreateSandboxOptions) => {\n // Validate API key\n const apiKey = config.apiKey || (typeof process !== 'undefined' && process.env?.DAYTONA_API_KEY) || '';\n\n if (!apiKey) {\n throw new Error(\n `Missing Daytona API key. Provide 'apiKey' in config or set DAYTONA_API_KEY environment variable. Get your API key from https://daytona.io/`\n );\n }\n\n const runtime = options?.runtime || config.runtime || 'node';\n const timeout = options?.timeout ?? config.timeout;\n\n try {\n // Initialize Daytona client\n const daytona = new Daytona({ apiKey: apiKey });\n\n let session: DaytonaSandbox;\n let sandboxId: string;\n\n if (options?.sandboxId) {\n // Reconnect to existing Daytona sandbox\n session = await daytona.get(options.sandboxId);\n sandboxId = options.sandboxId;\n } else {\n // Destructure known ComputeSDK fields, collect the rest for passthrough\n const {\n runtime: _runtime,\n timeout: _timeout,\n envs,\n name,\n metadata,\n templateId,\n snapshotId,\n sandboxId: _sandboxId,\n namespace: _namespace,\n directory: _directory,\n overlays: _overlays,\n servers: _servers,\n ...providerOptions\n } = options || {};\n\n // Build create params from options\n // Daytona SDK uses envVars (not envs), labels (not metadata)\n const createParams: Record<string, any> = {\n language: runtime === 'python' ? 'python' : 'javascript',\n ...providerOptions, // Spread provider-specific options (e.g., resources, public, autoStopInterval)\n };\n\n // Remap ComputeSDK fields to Daytona SDK fields\n if (envs && Object.keys(envs).length > 0) {\n createParams.envVars = envs;\n }\n\n if (name) {\n createParams.name = name;\n }\n\n // Pass metadata as labels (Daytona uses labels: Record<string, string>)\n if (metadata && typeof metadata === 'object') {\n const labels: Record<string, string> = {};\n for (const [k, v] of Object.entries(metadata)) {\n labels[k] = typeof v === 'string' ? v : JSON.stringify(v);\n }\n createParams.labels = labels;\n }\n\n // If templateId or snapshotId is provided, use it as the source\n const sourceId = templateId || snapshotId;\n if (sourceId) {\n createParams.snapshot = sourceId;\n }\n\n // Daytona SDK accepts timeout in seconds as a second argument\n const createOptions = timeout\n ? { timeout: Math.ceil(timeout / 1000) }\n : undefined;\n\n session = await daytona.create(createParams as any, createOptions);\n sandboxId = session.id;\n }\n\n return {\n sandbox: session,\n sandboxId\n };\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes('unauthorized') || error.message.includes('API key')) {\n throw new Error(\n `Daytona authentication failed. Please check your DAYTONA_API_KEY environment variable. Get your API key from https://daytona.io/`\n );\n }\n if (error.message.includes('quota') || error.message.includes('limit')) {\n throw new Error(\n `Daytona quota exceeded. Please check your usage at https://daytona.io/`\n );\n }\n }\n throw new Error(\n `Failed to create Daytona sandbox: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n getById: async (config: DaytonaConfig, sandboxId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n const session = await daytona.get(sandboxId);\n\n return {\n sandbox: session,\n sandboxId\n };\n } catch (error) {\n // Sandbox not found is expected -- return null per the interface contract\n if (error instanceof Error && (error.message.includes('not found') || error.message.includes('404'))) {\n return null;\n }\n // Propagate unexpected errors (auth failures, network issues, etc.)\n throw new Error(\n `Failed to get Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n list: async (config: DaytonaConfig) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n const result = await daytona.list();\n\n return result.items.map((session: any) => ({\n sandbox: session,\n sandboxId: session.id\n }));\n } catch (error) {\n throw new Error(\n `Failed to list Daytona sandboxes: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n destroy: async (config: DaytonaConfig, sandboxId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n const sandbox = await daytona.get(sandboxId);\n await sandbox.delete();\n } catch (error) {\n // If the sandbox is already gone (404), that's fine for destroy semantics\n if (error instanceof Error && (error.message.includes('not found') || error.message.includes('404'))) {\n return;\n }\n // Propagate all other errors (auth failures, network issues, etc.)\n throw new Error(\n `Failed to destroy Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n // Instance operations (sandbox.*)\n runCode: async (sandbox: DaytonaSandbox, code: string, runtime?: Runtime): Promise<CodeResult> => {\n const startTime = Date.now();\n\n try {\n // Auto-detect runtime if not specified\n const effectiveRuntime = runtime || (\n // Strong Python indicators\n code.includes('print(') || \n code.includes('import ') ||\n code.includes('def ') ||\n code.includes('sys.') ||\n code.includes('json.') ||\n code.includes('__') ||\n code.includes('f\"') ||\n code.includes(\"f'\") ||\n code.includes('raise ')\n ? 'python'\n // Default to Node.js for all other cases (including ambiguous)\n : 'node'\n );\n \n // Use direct command execution like Vercel for consistency\n let response;\n \n // Use base64 encoding for both runtimes for reliability and consistency\n const encoded = Buffer.from(code).toString('base64');\n \n if (effectiveRuntime === 'python') {\n response = await sandbox.process.executeCommand(`echo \"${encoded}\" | base64 -d | python3`);\n } else {\n response = await sandbox.process.executeCommand(`echo \"${encoded}\" | base64 -d | node`);\n }\n\n // Daytona always returns exitCode: 0, so we need to detect errors from output\n const output = response.result || '';\n const hasError = output.includes('Error:') || \n output.includes('error TS') || \n output.includes('SyntaxError:') ||\n output.includes('TypeError:') ||\n output.includes('ReferenceError:') ||\n output.includes('Traceback (most recent call last)');\n\n // Check for syntax errors and throw them (similar to Vercel behavior)\n if (hasError && (output.includes('SyntaxError:') || \n output.includes('invalid syntax') ||\n output.includes('Unexpected token') ||\n output.includes('Unexpected identifier') ||\n output.includes('error TS1434'))) {\n throw new Error(`Syntax error: ${output.trim()}`);\n }\n\n const actualExitCode = hasError ? 1 : (response.exitCode || 0);\n\n return {\n output: output,\n exitCode: actualExitCode,\n language: effectiveRuntime\n };\n } catch (error) {\n // Re-throw syntax errors\n if (error instanceof Error && error.message.includes('Syntax error')) {\n throw error;\n }\n throw new Error(\n `Daytona execution failed: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n runCommand: async (sandbox: DaytonaSandbox, command: string, options?: RunCommandOptions): Promise<CommandResult> => {\n const startTime = Date.now();\n\n try {\n // Build command with options\n let fullCommand = command;\n \n // Handle environment variables\n if (options?.env && Object.keys(options.env).length > 0) {\n const envPrefix = Object.entries(options.env)\n .map(([k, v]) => `${k}=\"${escapeShellArg(v)}\"`)\n .join(' ');\n fullCommand = `${envPrefix} ${fullCommand}`;\n }\n \n // Handle working directory\n if (options?.cwd) {\n fullCommand = `cd \"${escapeShellArg(options.cwd)}\" && ${fullCommand}`;\n }\n \n // Handle background execution\n if (options?.background) {\n fullCommand = `nohup ${fullCommand} > /dev/null 2>&1 &`;\n }\n\n // Execute command using Daytona's process.executeCommand method\n const response = await sandbox.process.executeCommand(fullCommand);\n\n return {\n stdout: response.result || '',\n stderr: '',\n exitCode: response.exitCode || 0,\n durationMs: Date.now() - startTime\n };\n } catch (error) {\n throw new Error(\n `Daytona command execution failed: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n getInfo: async (sandbox: DaytonaSandbox): Promise<SandboxInfo> => {\n return {\n id: sandbox.id,\n provider: 'daytona',\n runtime: 'python', // Daytona default\n status: 'running',\n createdAt: new Date(),\n timeout: 300000,\n metadata: {\n daytonaSandboxId: sandbox.id\n }\n };\n },\n\n getUrl: async (sandbox: DaytonaSandbox, options: { port: number; protocol?: string }): Promise<string> => {\n try {\n // Use Daytona's built-in getPreviewLink method\n const previewInfo = await sandbox.getPreviewLink(options.port);\n let url = previewInfo.url;\n \n // If a specific protocol is requested, replace the URL's protocol\n if (options.protocol) {\n const urlObj = new URL(url);\n urlObj.protocol = options.protocol + ':';\n url = urlObj.toString();\n }\n \n return url;\n } catch (error) {\n throw new Error(\n `Failed to get Daytona preview URL for port ${options.port}: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n // Filesystem operations via terminal commands\n filesystem: {\n readFile: async (sandbox: DaytonaSandbox, path: string): Promise<string> => {\n try {\n const response = await sandbox.process.executeCommand(`cat \"${path}\"`);\n if (response.exitCode !== 0) {\n throw new Error(`File not found or cannot be read: ${path}`);\n }\n return response.result || '';\n } catch (error) {\n throw new Error(`Failed to read file ${path}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n writeFile: async (sandbox: DaytonaSandbox, path: string, content: string): Promise<void> => {\n try {\n // Use base64 encoding to safely handle special characters, newlines, and binary content\n const encoded = Buffer.from(content).toString('base64');\n const response = await sandbox.process.executeCommand(`echo \"${encoded}\" | base64 -d > \"${path}\"`);\n if (response.exitCode !== 0) {\n throw new Error(`Failed to write to file: ${path}`);\n }\n } catch (error) {\n throw new Error(`Failed to write file ${path}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n mkdir: async (sandbox: DaytonaSandbox, path: string): Promise<void> => {\n try {\n const response = await sandbox.process.executeCommand(`mkdir -p \"${path}\"`);\n if (response.exitCode !== 0) {\n throw new Error(`Failed to create directory: ${path}`);\n }\n } catch (error) {\n throw new Error(`Failed to create directory ${path}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n readdir: async (sandbox: DaytonaSandbox, path: string): Promise<FileEntry[]> => {\n try {\n const response = await sandbox.process.executeCommand(`ls -la \"${path}\"`);\n if (response.exitCode !== 0) {\n throw new Error(`Directory not found or cannot be read: ${path}`);\n }\n\n // Parse ls -la output into FileEntry objects\n const lines = response.result.split('\\n').filter(line => line.trim());\n const entries: FileEntry[] = [];\n\n for (const line of lines) {\n // Skip total line and current/parent directory entries\n if (line.startsWith('total ') || line.endsWith(' .') || line.endsWith(' ..')) {\n continue;\n }\n\n // Parse ls -la format: permissions links owner group size date time name\n const parts = line.trim().split(/\\s+/);\n if (parts.length >= 9) {\n const permissions = parts[0];\n const name = parts.slice(8).join(' '); // Handle filenames with spaces\n const isDirectory = permissions.startsWith('d');\n const size = parseInt(parts[4]) || 0;\n\n entries.push({\n name,\n type: isDirectory ? 'directory' as const : 'file' as const,\n size,\n modified: new Date() // ls -la date parsing is complex, use current time\n });\n }\n }\n\n return entries;\n } catch (error) {\n throw new Error(`Failed to read directory ${path}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n exists: async (sandbox: DaytonaSandbox, path: string): Promise<boolean> => {\n try {\n const response = await sandbox.process.executeCommand(`test -e \"${path}\"`);\n return response.exitCode === 0;\n } catch (error) {\n // If command execution fails, assume file doesn't exist\n return false;\n }\n },\n\n remove: async (sandbox: DaytonaSandbox, path: string): Promise<void> => {\n try {\n const response = await sandbox.process.executeCommand(`rm -rf \"${path}\"`);\n if (response.exitCode !== 0) {\n throw new Error(`Failed to remove: ${path}`);\n }\n } catch (error) {\n throw new Error(`Failed to remove ${path}: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n },\n\n // Provider-specific typed getInstance method\n getInstance: (sandbox: DaytonaSandbox): DaytonaSandbox => {\n return sandbox;\n },\n\n },\n\n snapshot: {\n create: async (config: DaytonaConfig, sandboxId: string, options?: { name?: string }) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n\n try {\n // Note: Using 'any' cast as we are using internal service property\n const snapshot = await (daytona as any).snapshots.create({\n workspaceId: sandboxId,\n name: options?.name || `snapshot-${Date.now()}`\n });\n return snapshot;\n } catch (error) {\n throw new Error(`Failed to create Daytona snapshot: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n list: async (config: DaytonaConfig) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n\n try {\n const result = await (daytona as any).snapshots.list();\n return result;\n } catch (error) {\n return [];\n }\n },\n\n delete: async (config: DaytonaConfig, snapshotId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n\n try {\n // Note: Daytona SDK might not expose delete directly or it might be 'remove'\n // We'll try the common pattern\n await (daytona as any).snapshots.delete(snapshotId);\n } catch (error) {\n // Ignore if not found\n }\n }\n },\n\n // Templates in Daytona are effectively Snapshots\n template: {\n create: async (config: DaytonaConfig, options: { name: string }) => {\n throw new Error('To create a template in Daytona, create a snapshot from a running sandbox using snapshot.create()');\n },\n\n list: async (config: DaytonaConfig) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n\n try {\n const result = await (daytona as any).snapshots.list();\n return result;\n } catch (error) {\n return [];\n }\n },\n\n delete: async (config: DaytonaConfig, templateId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n\n try {\n await (daytona as any).snapshots.delete(templateId);\n } catch (error) {\n // Ignore if not found\n }\n }\n }\n }\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,iBAAmD;AACnD,sBAA+C;AAmBxC,IAAM,cAAU,gCAA8C;AAAA,EACnE,MAAM;AAAA,EACN,SAAS;AAAA,IACP,SAAS;AAAA;AAAA,MAEP,QAAQ,OAAO,QAAuB,YAAmC;AAEvE,cAAM,SAAS,OAAO,UAAW,OAAO,YAAY,eAAe,QAAQ,KAAK,mBAAoB;AAEpG,YAAI,CAAC,QAAQ;AACX,gBAAM,IAAI;AAAA,YACR;AAAA,U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GA,UAAU;AAAA,MACR,QAAQ,OAAO,QAAuB,YAA8B;AACjE,cAAM,IAAI,MAAM,mGAAmG;AAAA,MACtH;AAAA,MAEA,MAAM,OAAO,WAA0B;AACrC,cAAM,SAAS,OAAO,UAAU,QAAQ,IAAI;AAC5C,cAAMA,WAAU,IAAI,mBAAQ,EAAE,OAAe,CAAC;AAE9C,YAAI;AACF,gBAAM,SAAS,MAAOA,SAAgB,UAAU,KAAK;AACrD,iBAAO;AAAA,QACT,SAAS,OAAO;AACd,iBAAO,CAAC;AAAA,QACV;AAAA,MACF;AAAA,MAEA,QAAQ,OAAO,QAAuB,eAAuB;AAC3D,cAAM,SAAS,OAAO,UAAU,QAAQ,IAAI;AAC5C,cAAMA,WAAU,IAAI,mBAAQ,EAAE,OAAe,CAAC;AAE9C,YAAI;AACF,gBAAOA,SAAgB,UAAU,OAAO,UAAU;AAAA,QACpD,SAAS,OAAO;AAAA,QAEhB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF,CAAC;","names":["daytona"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Daytona Provider - Factory-based Implementation\n */\n\nimport { Daytona, Sandbox as DaytonaSandbox } from '@daytonaio/sdk';\nimport { defineProvider, escapeShellArg } from '@computesdk/provider';\n\nimport type { CommandResult, SandboxInfo, CreateSandboxOptions, FileEntry, RunCommandOptions } from '@computesdk/provider';\n\n/**\n * Daytona-specific configuration options\n */\nexport interface DaytonaConfig {\n /** Daytona API key - if not provided, will fallback to DAYTONA_API_KEY environment variable */\n apiKey?: string;\n /** Default runtime environment (e.g. 'python', 'node') */\n runtime?: string;\n /** Execution timeout in milliseconds */\n timeout?: number;\n}\n\n/**\n * Create a Daytona provider instance using the factory pattern\n */\nexport const daytona = defineProvider<DaytonaSandbox, DaytonaConfig>({\n name: 'daytona',\n methods: {\n sandbox: {\n create: async (config: DaytonaConfig, options?: CreateSandboxOptions) => {\n const apiKey = config.apiKey || (typeof process !== 'undefined' && process.env?.DAYTONA_API_KEY) || '';\n\n if (!apiKey) {\n throw new Error(\n `Missing Daytona API key. Provide 'apiKey' in config or set DAYTONA_API_KEY environment variable. Get your API key from https://daytona.io/`\n );\n }\n\n const runtime = (options as any)?.runtime || config.runtime || 'node';\n const timeout = options?.timeout ?? config.timeout;\n\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n\n const {\n timeout: _timeout,\n envs,\n name,\n metadata,\n templateId,\n snapshotId,\n sandboxId: _sandboxId,\n namespace: _namespace,\n directory: _directory,\n ...providerOptions\n } = options || {};\n\n const createParams: Record<string, any> = {\n language: runtime === 'python' ? 'python' : 'javascript',\n ...providerOptions,\n };\n\n if (envs && Object.keys(envs).length > 0) {\n createParams.envVars = envs;\n }\n\n if (name) {\n createParams.name = name;\n }\n\n if (metadata && typeof metadata === 'object') {\n const labels: Record<string, string> = {};\n for (const [k, v] of Object.entries(metadata)) {\n labels[k] = typeof v === 'string' ? v : JSON.stringify(v);\n }\n createParams.labels = labels;\n }\n\n const sourceId = templateId || snapshotId;\n if (sourceId) {\n createParams.snapshot = sourceId;\n }\n\n const createOptions = timeout\n ? { timeout: Math.ceil(timeout / 1000) }\n : undefined;\n\n const session = await daytona.create(createParams as any, createOptions);\n const sandboxId = session.id;\n\n return { sandbox: session, sandboxId };\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes('unauthorized') || error.message.includes('API key')) {\n throw new Error(`Daytona authentication failed. Please check your DAYTONA_API_KEY environment variable.`);\n }\n if (error.message.includes('quota') || error.message.includes('limit')) {\n throw new Error(`Daytona quota exceeded. Please check your usage at https://daytona.io/`);\n }\n }\n throw new Error(`Failed to create Daytona sandbox: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n getById: async (config: DaytonaConfig, sandboxId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n const session = await daytona.get(sandboxId);\n return { sandbox: session, sandboxId };\n } catch (error) {\n if (error instanceof Error && (error.message.includes('not found') || error.message.includes('404'))) {\n return null;\n }\n throw new Error(`Failed to get Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n list: async (config: DaytonaConfig) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n const result = await daytona.list();\n return result.items.map((session: any) => ({ sandbox: session, sandboxId: session.id }));\n } catch (error) {\n throw new Error(`Failed to list Daytona sandboxes: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n destroy: async (config: DaytonaConfig, sandboxId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n const sandbox = await daytona.get(sandboxId);\n await sandbox.delete();\n } catch (error) {\n if (error instanceof Error && (error.message.includes('not found') || error.message.includes('404'))) {\n return;\n }\n throw new Error(`Failed to destroy Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n runCommand: async (sandbox: DaytonaSandbox, command: string, options?: RunCommandOptions): Promise<CommandResult> => {\n const startTime = Date.now();\n try {\n let fullCommand = command;\n if (options?.env && Object.keys(options.env).length > 0) {\n const envPrefix = Object.entries(options.env)\n .map(([k, v]) => `${k}=\"${escapeShellArg(v)}\"`)\n .join(' ');\n fullCommand = `${envPrefix} ${fullCommand}`;\n }\n if (options?.cwd) fullCommand = `cd \"${escapeShellArg(options.cwd)}\" && ${fullCommand}`;\n if (options?.background) fullCommand = `nohup ${fullCommand} > /dev/null 2>&1 &`;\n\n const response = await sandbox.process.executeCommand(fullCommand);\n return {\n stdout: response.result || '',\n stderr: '',\n exitCode: response.exitCode || 0,\n durationMs: Date.now() - startTime\n };\n } catch (error) {\n throw new Error(`Daytona command execution failed: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n getInfo: async (sandbox: DaytonaSandbox): Promise<SandboxInfo> => {\n return {\n id: sandbox.id,\n provider: 'daytona',\n status: 'running',\n createdAt: new Date(),\n timeout: 300000,\n metadata: { daytonaSandboxId: sandbox.id }\n };\n },\n\n getUrl: async (sandbox: DaytonaSandbox, options: { port: number; protocol?: string }): Promise<string> => {\n try {\n const previewInfo = await sandbox.getPreviewLink(options.port);\n let url = previewInfo.url;\n if (options.protocol) {\n const urlObj = new URL(url);\n urlObj.protocol = options.protocol + ':';\n url = urlObj.toString();\n }\n return url;\n } catch (error) {\n throw new Error(`Failed to get Daytona preview URL for port ${options.port}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n filesystem: {\n readFile: async (sandbox: DaytonaSandbox, path: string): Promise<string> => {\n const response = await sandbox.process.executeCommand(`cat \"${path}\"`);\n if (response.exitCode !== 0) throw new Error(`File not found or cannot be read: ${path}`);\n return response.result || '';\n },\n writeFile: async (sandbox: DaytonaSandbox, path: string, content: string): Promise<void> => {\n const encoded = Buffer.from(content).toString('base64');\n const response = await sandbox.process.executeCommand(`echo \"${encoded}\" | base64 -d > \"${path}\"`);\n if (response.exitCode !== 0) throw new Error(`Failed to write to file: ${path}`);\n },\n mkdir: async (sandbox: DaytonaSandbox, path: string): Promise<void> => {\n const response = await sandbox.process.executeCommand(`mkdir -p \"${path}\"`);\n if (response.exitCode !== 0) throw new Error(`Failed to create directory: ${path}`);\n },\n readdir: async (sandbox: DaytonaSandbox, path: string): Promise<FileEntry[]> => {\n const response = await sandbox.process.executeCommand(`ls -la \"${path}\"`);\n if (response.exitCode !== 0) throw new Error(`Directory not found or cannot be read: ${path}`);\n const lines = response.result.split('\\n').filter((l: string) => l.trim());\n const entries: FileEntry[] = [];\n for (const line of lines) {\n if (line.startsWith('total ') || line.endsWith(' .') || line.endsWith(' ..')) continue;\n const parts = line.trim().split(/\\s+/);\n if (parts.length >= 9) {\n entries.push({\n name: parts.slice(8).join(' '),\n type: parts[0].startsWith('d') ? 'directory' as const : 'file' as const,\n size: parseInt(parts[4]) || 0,\n modified: new Date()\n });\n }\n }\n return entries;\n },\n exists: async (sandbox: DaytonaSandbox, path: string): Promise<boolean> => {\n const response = await sandbox.process.executeCommand(`test -e \"${path}\"`);\n return response.exitCode === 0;\n },\n remove: async (sandbox: DaytonaSandbox, path: string): Promise<void> => {\n const response = await sandbox.process.executeCommand(`rm -rf \"${path}\"`);\n if (response.exitCode !== 0) throw new Error(`Failed to remove: ${path}`);\n }\n },\n\n getInstance: (sandbox: DaytonaSandbox): DaytonaSandbox => sandbox,\n },\n\n snapshot: {\n create: async (config: DaytonaConfig, sandboxId: string, options?: { name?: string }) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n try {\n const snapshot = await (daytona as any).snapshots.create({\n workspaceId: sandboxId,\n name: options?.name || `snapshot-${Date.now()}`\n });\n return snapshot;\n } catch (error) {\n throw new Error(`Failed to create Daytona snapshot: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n list: async (config: DaytonaConfig) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n try { return await (daytona as any).snapshots.list(); } catch { return []; }\n },\n delete: async (config: DaytonaConfig, snapshotId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n try { await (daytona as any).snapshots.delete(snapshotId); } catch { /* ignore */ }\n }\n },\n\n template: {\n create: async (_config: DaytonaConfig, _options: { name: string }) => {\n throw new Error('To create a template in Daytona, create a snapshot from a running sandbox using snapshot.create()');\n },\n list: async (config: DaytonaConfig) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n try { return await (daytona as any).snapshots.list(); } catch { return []; }\n },\n delete: async (config: DaytonaConfig, templateId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n try { await (daytona as any).snapshots.delete(templateId); } catch { /* ignore */ }\n }\n }\n }\n});\n"],"mapp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;AAAA,IACF;AAAA,IAEA,UAAU;AAAA,MACR,QAAQ,OAAO,SAAwB,aAA+B;AACpE,cAAM,IAAI,MAAM,mGAAmG;AAAA,MACrH;AAAA,MACA,MAAM,OAAO,WAA0B;AACrC,cAAM,SAAS,OAAO,UAAU,QAAQ,IAAI;AAC5C,cAAMA,WAAU,IAAI,mBAAQ,EAAE,OAAe,CAAC;AAC9C,YAAI;AAAE,iBAAO,MAAOA,SAAgB,UAAU,KAAK;AAAA,QAAG,QAAQ;AAAE,iBAAO,CAAC;AAAA,QAAG;AAAA,MAC7E;AAAA,MACA,QAAQ,OAAO,QAAuB,eAAuB;AAC3D,cAAM,SAAS,OAAO,UAAU,QAAQ,IAAI;AAC5C,cAAMA,WAAU,IAAI,mBAAQ,EAAE,OAAe,CAAC;AAC9C,YAAI;AAAE,gBAAOA,SAAgB,UAAU,OAAO,UAAU;AAAA,QAAG,QAAQ;AAAA,QAAe;AAAA,MACpF;AAAA,IACF;AAAA,EACF;AACF,CAAC;","names":["daytona"]}
package/dist/index.mjs CHANGED
@@ -5,7 +5,6 @@ var daytona = defineProvider({
5
5
  name: "daytona",
6
6
  methods: {
7
7
  sandbox: {
8
- // Collection operations (compute.sandbox.*)
9
8
  create: async (config, options) => {
10
9
  const apiKey = config.apiKey || typeof process !== "undefined" && process.env?.DAYTONA_API_KEY || "";
11
10
  if (!apiKey) {
@@ -17,73 +16,53 @@ var daytona = defineProvider({
17
16
  const timeout = options?.timeout ?? config.timeout;
18
17
  try {
19
18
  const daytona2 = new Daytona({ apiKey });
20
- let session;
21
- let sandboxId;
22
- if (options?.sandboxId) {
23
- session = await daytona2.get(options.sandboxId);
24
- sandboxId = options.sandboxId;
25
- } else {
26
- const {
27
- runtime: _runtime,
28
- timeout: _timeout,
29
- envs,
30
- name,
31
- metadata,
32
- templateId,
33
- snapshotId,
34
- sandboxId: _sandboxId,
35
- namespace: _namespace,
36
- directory: _directory,
37
- overlays: _overlays,
38
- servers: _servers,
39
- ...providerOptions
40
- } = options || {};
41
- const createParams = {
42
- language: runtime === "python" ? "python" : "javascript",
43
- ...providerOptions
44
- // Spread provider-specific options (e.g., resources, public, autoStopInterval)
45
- };
46
- if (envs && Object.keys(envs).length > 0) {
47
- createParams.envVars = envs;
48
- }
49
- if (name) {
50
- createParams.name = name;
51
- }
52
- if (metadata && typeof metadata === "object") {
53
- const labels = {};
54
- for (const [k, v] of Object.entries(metadata)) {
55
- labels[k] = typeof v === "string" ? v : JSON.stringify(v);
56
- }
57
- createParams.labels = labels;
58
- }
59
- const sourceId = templateId || snapshotId;
60
- if (sourceId) {
61
- createParams.snapshot = sourceId;
19
+ const {
20
+ timeout: _timeout,
21
+ envs,
22
+ name,
23
+ metadata,
24
+ templateId,
25
+ snapshotId,
26
+ sandboxId: _sandboxId,
27
+ namespace: _namespace,
28
+ directory: _directory,
29
+ ...providerOptions
30
+ } = options || {};
31
+ const createParams = {
32
+ language: runtime === "python" ? "python" : "javascript",
33
+ ...providerOptions
34
+ };
35
+ if (envs && Object.keys(envs).length > 0) {
36
+ createParams.envVars = envs;
37
+ }
38
+ if (name) {
39
+ createParams.name = name;
40
+ }
41
+ if (metadata && typeof metadata === "object") {
42
+ const labels = {};
43
+ for (const [k, v] of Object.entries(metadata)) {
44
+ labels[k] = typeof v === "string" ? v : JSON.stringify(v);
62
45
  }
63
- const createOptions = timeout ? { timeout: Math.ceil(timeout / 1e3) } : void 0;
64
- session = await daytona2.create(createParams, createOptions);
65
- sandboxId = session.id;
46
+ createParams.labels = labels;
66
47
  }
67
- return {
68
- sandbox: session,
69
- sandboxId
70
- };
48
+ const sourceId = templateId || snapshotId;
49
+ if (sourceId) {
50
+ createParams.snapshot = sourceId;
51
+ }
52
+ const createOptions = timeout ? { timeout: Math.ceil(timeout / 1e3) } : void 0;
53
+ const session = await daytona2.create(createParams, createOptions);
54
+ const sandboxId = session.id;
55
+ return { sandbox: session, sandboxId };
71
56
  } catch (error) {
72
57
  if (error instanceof Error) {
73
58
  if (error.message.includes("unauthorized") || error.message.includes("API key")) {
74
- throw new Error(
75
- `Daytona authentication failed. Please check your DAYTONA_API_KEY environment variable. Get your API key from https://daytona.io/`
76
- );
59
+ throw new Error(`Daytona authentication failed. Please check your DAYTONA_API_KEY environment variable.`);
77
60
  }
78
61
  if (error.message.includes("quota") || error.message.includes("limit")) {
79
- throw new Error(
80
- `Daytona quota exceeded. Please check your usage at https://daytona.io/`
81
- );
62
+ throw new Error(`Daytona quota exceeded. Please check your usage at https://daytona.io/`);
82
63
  }
83
64
  }
84
- throw new Error(
85
- `Failed to create Daytona sandbox: ${error instanceof Error ? error.message : String(error)}`
86
- );
65
+ throw new Error(`Failed to create Daytona sandbox: ${error instanceof Error ? error.message : String(error)}`);
87
66
  }
88
67
  },
89
68
  getById: async (config, sandboxId) => {
@@ -91,17 +70,12 @@ var daytona = defineProvider({
91
70
  try {
92
71
  const daytona2 = new Daytona({ apiKey });
93
72
  const session = await daytona2.get(sandboxId);
94
- return {
95
- sandbox: session,
96
- sandboxId
97
- };
73
+ return { sandbox: session, sandboxId };
98
74
  } catch (error) {
99
75
  if (error instanceof Error && (error.message.includes("not found") || error.message.includes("404"))) {
100
76
  return null;
101
77
  }
102
- throw new Error(
103
- `Failed to get Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`
104
- );
78
+ throw new Error(`Failed to get Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`);
105
79
  }
106
80
  },
107
81
  list: async (config) => {
@@ -109,14 +83,9 @@ var daytona = defineProvider({
109
83
  try {
110
84
  const daytona2 = new Daytona({ apiKey });
111
85
  const result = await daytona2.list();
112
- return result.items.map((session) => ({
113
- sandbox: session,
114
- sandboxId: session.id
115
- }));
86
+ return result.items.map((session) => ({ sandbox: session, sandboxId: session.id }));
116
87
  } catch (error) {
117
- throw new Error(
118
- `Failed to list Daytona sandboxes: ${error instanceof Error ? error.message : String(error)}`
119
- );
88
+ throw new Error(`Failed to list Daytona sandboxes: ${error instanceof Error ? error.message : String(error)}`);
120
89
  }
121
90
  },
122
91
  destroy: async (config, sandboxId) => {
@@ -129,42 +98,7 @@ var daytona = defineProvider({
129
98
  if (error instanceof Error && (error.message.includes("not found") || error.message.includes("404"))) {
130
99
  return;
131
100
  }
132
- throw new Error(
133
- `Failed to destroy Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`
134
- );
135
- }
136
- },
137
- // Instance operations (sandbox.*)
138
- runCode: async (sandbox, code, runtime) => {
139
- const startTime = Date.now();
140
- try {
141
- const effectiveRuntime = runtime || // Strong Python indicators
142
- (code.includes("print(") || code.includes("import ") || code.includes("def ") || code.includes("sys.") || code.includes("json.") || code.includes("__") || code.includes('f"') || code.includes("f'") || code.includes("raise ") ? "python" : "node");
143
- let response;
144
- const encoded = Buffer.from(code).toString("base64");
145
- if (effectiveRuntime === "python") {
146
- response = await sandbox.process.executeCommand(`echo "${encoded}" | base64 -d | python3`);
147
- } else {
148
- response = await sandbox.process.executeCommand(`echo "${encoded}" | base64 -d | node`);
149
- }
150
- const output = response.result || "";
151
- const hasError = output.includes("Error:") || output.includes("error TS") || output.includes("SyntaxError:") || output.includes("TypeError:") || output.includes("ReferenceError:") || output.includes("Traceback (most recent call last)");
152
- if (hasError && (output.includes("SyntaxError:") || output.includes("invalid syntax") || output.includes("Unexpected token") || output.includes("Unexpected identifier") || output.includes("error TS1434"))) {
153
- throw new Error(`Syntax error: ${output.trim()}`);
154
- }
155
- const actualExitCode = hasError ? 1 : response.exitCode || 0;
156
- return {
157
- output,
158
- exitCode: actualExitCode,
159
- language: effectiveRuntime
160
- };
161
- } catch (error) {
162
- if (error instanceof Error && error.message.includes("Syntax error")) {
163
- throw error;
164
- }
165
- throw new Error(
166
- `Daytona execution failed: ${error instanceof Error ? error.message : String(error)}`
167
- );
101
+ throw new Error(`Failed to destroy Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`);
168
102
  }
169
103
  },
170
104
  runCommand: async (sandbox, command, options) => {
@@ -175,12 +109,8 @@ var daytona = defineProvider({
175
109
  const envPrefix = Object.entries(options.env).map(([k, v]) => `${k}="${escapeShellArg(v)}"`).join(" ");
176
110
  fullCommand = `${envPrefix} ${fullCommand}`;
177
111
  }
178
- if (options?.cwd) {
179
- fullCommand = `cd "${escapeShellArg(options.cwd)}" && ${fullCommand}`;
180
- }
181
- if (options?.background) {
182
- fullCommand = `nohup ${fullCommand} > /dev/null 2>&1 &`;
183
- }
112
+ if (options?.cwd) fullCommand = `cd "${escapeShellArg(options.cwd)}" && ${fullCommand}`;
113
+ if (options?.background) fullCommand = `nohup ${fullCommand} > /dev/null 2>&1 &`;
184
114
  const response = await sandbox.process.executeCommand(fullCommand);
185
115
  return {
186
116
  stdout: response.result || "",
@@ -189,23 +119,17 @@ var daytona = defineProvider({
189
119
  durationMs: Date.now() - startTime
190
120
  };
191
121
  } catch (error) {
192
- throw new Error(
193
- `Daytona command execution failed: ${error instanceof Error ? error.message : String(error)}`
194
- );
122
+ throw new Error(`Daytona command execution failed: ${error instanceof Error ? error.message : String(error)}`);
195
123
  }
196
124
  },
197
125
  getInfo: async (sandbox) => {
198
126
  return {
199
127
  id: sandbox.id,
200
128
  provider: "daytona",
201
- runtime: "python",
202
- // Daytona default
203
129
  status: "running",
204
130
  createdAt: /* @__PURE__ */ new Date(),
205
131
  timeout: 3e5,
206
- metadata: {
207
- daytonaSandboxId: sandbox.id
208
- }
132
+ metadata: { daytonaSandboxId: sandbox.id }
209
133
  };
210
134
  },
211
135
  getUrl: async (sandbox, options) => {
@@ -219,100 +143,53 @@ var daytona = defineProvider({
219
143
  }
220
144
  return url;
221
145
  } catch (error) {
222
- throw new Error(
223
- `Failed to get Daytona preview URL for port ${options.port}: ${error instanceof Error ? error.message : String(error)}`
224
- );
146
+ throw new Error(`Failed to get Daytona preview URL for port ${options.port}: ${error instanceof Error ? error.message : String(error)}`);
225
147
  }
226
148
  },
227
- // Filesystem operations via terminal commands
228
149
  filesystem: {
229
150
  readFile: async (sandbox, path) => {
230
- try {
231
- const response = await sandbox.process.executeCommand(`cat "${path}"`);
232
- if (response.exitCode !== 0) {
233
- throw new Error(`File not found or cannot be read: ${path}`);
234
- }
235
- return response.result || "";
236
- } catch (error) {
237
- throw new Error(`Failed to read file ${path}: ${error instanceof Error ? error.message : String(error)}`);
238
- }
151
+ const response = await sandbox.process.executeCommand(`cat "${path}"`);
152
+ if (response.exitCode !== 0) throw new Error(`File not found or cannot be read: ${path}`);
153
+ return response.result || "";
239
154
  },
240
155
  writeFile: async (sandbox, path, content) => {
241
- try {
242
- const encoded = Buffer.from(content).toString("base64");
243
- const response = await sandbox.process.executeCommand(`echo "${encoded}" | base64 -d > "${path}"`);
244
- if (response.exitCode !== 0) {
245
- throw new Error(`Failed to write to file: ${path}`);
246
- }
247
- } catch (error) {
248
- throw new Error(`Failed to write file ${path}: ${error instanceof Error ? error.message : String(error)}`);
249
- }
156
+ const encoded = Buffer.from(content).toString("base64");
157
+ const response = await sandbox.process.executeCommand(`echo "${encoded}" | base64 -d > "${path}"`);
158
+ if (response.exitCode !== 0) throw new Error(`Failed to write to file: ${path}`);
250
159
  },
251
160
  mkdir: async (sandbox, path) => {
252
- try {
253
- const response = await sandbox.process.executeCommand(`mkdir -p "${path}"`);
254
- if (response.exitCode !== 0) {
255
- throw new Error(`Failed to create directory: ${path}`);
256
- }
257
- } catch (error) {
258
- throw new Error(`Failed to create directory ${path}: ${error instanceof Error ? error.message : String(error)}`);
259
- }
161
+ const response = await sandbox.process.executeCommand(`mkdir -p "${path}"`);
162
+ if (response.exitCode !== 0) throw new Error(`Failed to create directory: ${path}`);
260
163
  },
261
164
  readdir: async (sandbox, path) => {
262
- try {
263
- const response = await sandbox.process.executeCommand(`ls -la "${path}"`);
264
- if (response.exitCode !== 0) {
265
- throw new Error(`Directory not found or cannot be read: ${path}`);
266
- }
267
- const lines = response.result.split("\n").filter((line) => line.trim());
268
- const entries = [];
269
- for (const line of lines) {
270
- if (line.startsWith("total ") || line.endsWith(" .") || line.endsWith(" ..")) {
271
- continue;
272
- }
273
- const parts = line.trim().split(/\s+/);
274
- if (parts.length >= 9) {
275
- const permissions = parts[0];
276
- const name = parts.slice(8).join(" ");
277
- const isDirectory = permissions.startsWith("d");
278
- const size = parseInt(parts[4]) || 0;
279
- entries.push({
280
- name,
281
- type: isDirectory ? "directory" : "file",
282
- size,
283
- modified: /* @__PURE__ */ new Date()
284
- // ls -la date parsing is complex, use current time
285
- });
286
- }
165
+ const response = await sandbox.process.executeCommand(`ls -la "${path}"`);
166
+ if (response.exitCode !== 0) throw new Error(`Directory not found or cannot be read: ${path}`);
167
+ const lines = response.result.split("\n").filter((l) => l.trim());
168
+ const entries = [];
169
+ for (const line of lines) {
170
+ if (line.startsWith("total ") || line.endsWith(" .") || line.endsWith(" ..")) continue;
171
+ const parts = line.trim().split(/\s+/);
172
+ if (parts.length >= 9) {
173
+ entries.push({
174
+ name: parts.slice(8).join(" "),
175
+ type: parts[0].startsWith("d") ? "directory" : "file",
176
+ size: parseInt(parts[4]) || 0,
177
+ modified: /* @__PURE__ */ new Date()
178
+ });
287
179
  }
288
- return entries;
289
- } catch (error) {
290
- throw new Error(`Failed to read directory ${path}: ${error instanceof Error ? error.message : String(error)}`);
291
180
  }
181
+ return entries;
292
182
  },
293
183
  exists: async (sandbox, path) => {
294
- try {
295
- const response = await sandbox.process.executeCommand(`test -e "${path}"`);
296
- return response.exitCode === 0;
297
- } catch (error) {
298
- return false;
299
- }
184
+ const response = await sandbox.process.executeCommand(`test -e "${path}"`);
185
+ return response.exitCode === 0;
300
186
  },
301
187
  remove: async (sandbox, path) => {
302
- try {
303
- const response = await sandbox.process.executeCommand(`rm -rf "${path}"`);
304
- if (response.exitCode !== 0) {
305
- throw new Error(`Failed to remove: ${path}`);
306
- }
307
- } catch (error) {
308
- throw new Error(`Failed to remove ${path}: ${error instanceof Error ? error.message : String(error)}`);
309
- }
188
+ const response = await sandbox.process.executeCommand(`rm -rf "${path}"`);
189
+ if (response.exitCode !== 0) throw new Error(`Failed to remove: ${path}`);
310
190
  }
311
191
  },
312
- // Provider-specific typed getInstance method
313
- getInstance: (sandbox) => {
314
- return sandbox;
315
- }
192
+ getInstance: (sandbox) => sandbox
316
193
  },
317
194
  snapshot: {
318
195
  create: async (config, sandboxId, options) => {
@@ -332,9 +209,8 @@ var daytona = defineProvider({
332
209
  const apiKey = config.apiKey || process.env.DAYTONA_API_KEY;
333
210
  const daytona2 = new Daytona({ apiKey });
334
211
  try {
335
- const result = await daytona2.snapshots.list();
336
- return result;
337
- } catch (error) {
212
+ return await daytona2.snapshots.list();
213
+ } catch {
338
214
  return [];
339
215
  }
340
216
  },
@@ -343,22 +219,20 @@ var daytona = defineProvider({
343
219
  const daytona2 = new Daytona({ apiKey });
344
220
  try {
345
221
  await daytona2.snapshots.delete(snapshotId);
346
- } catch (error) {
222
+ } catch {
347
223
  }
348
224
  }
349
225
  },
350
- // Templates in Daytona are effectively Snapshots
351
226
  template: {
352
- create: async (config, options) => {
227
+ create: async (_config, _options) => {
353
228
  throw new Error("To create a template in Daytona, create a snapshot from a running sandbox using snapshot.create()");
354
229
  },
355
230
  list: async (config) => {
356
231
  const apiKey = config.apiKey || process.env.DAYTONA_API_KEY;
357
232
  const daytona2 = new Daytona({ apiKey });
358
233
  try {
359
- const result = await daytona2.snapshots.list();
360
- return result;
361
- } catch (error) {
234
+ return await daytona2.snapshots.list();
235
+ } catch {
362
236
  return [];
363
237
  }
364
238
  },
@@ -367,7 +241,7 @@ var daytona = defineProvider({
367
241
  const daytona2 = new Daytona({ apiKey });
368
242
  try {
369
243
  await daytona2.snapshots.delete(templateId);
370
- } catch (error) {
244
+ } catch {
371
245
  }
372
246
  }
373
247
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Daytona Provider - Factory-based Implementation\n * \n * Code execution only provider using the factory pattern.\n * Reduces ~300 lines of boilerplate to ~80 lines of core logic.\n */\n\nimport { Daytona, Sandbox as DaytonaSandbox } from '@daytonaio/sdk';\nimport { defineProvider, escapeShellArg } from '@computesdk/provider';\n\nimport type { Runtime, CodeResult, CommandResult, SandboxInfo, CreateSandboxOptions, FileEntry, RunCommandOptions } from '@computesdk/provider';\n\n/**\n * Daytona-specific configuration options\n */\nexport interface DaytonaConfig {\n /** Daytona API key - if not provided, will fallback to DAYTONA_API_KEY environment variable */\n apiKey?: string;\n /** Default runtime environment */\n runtime?: Runtime;\n /** Execution timeout in milliseconds */\n timeout?: number;\n}\n\n/**\n * Create a Daytona provider instance using the factory pattern\n */\nexport const daytona = defineProvider<DaytonaSandbox, DaytonaConfig>({\n name: 'daytona',\n methods: {\n sandbox: {\n // Collection operations (compute.sandbox.*)\n create: async (config: DaytonaConfig, options?: CreateSandboxOptions) => {\n // Validate API key\n const apiKey = config.apiKey || (typeof process !== 'undefined' && process.env?.DAYTONA_API_KEY) || '';\n\n if (!apiKey) {\n throw new Error(\n `Missing Daytona API key. Provide 'apiKey' in config or set DAYTONA_API_KEY environment variable. Get your API key from https://daytona.io/`\n );\n }\n\n const runtime = options?.runtime || config.runtime || 'node';\n const timeout = options?.timeout ?? config.timeout;\n\n try {\n // Initialize Daytona client\n const daytona = new Daytona({ apiKey: apiKey });\n\n let session: DaytonaSandbox;\n let sandboxId: string;\n\n if (options?.sandboxId) {\n // Reconnect to existing Daytona sandbox\n session = await daytona.get(options.sandboxId);\n sandboxId = options.sandboxId;\n } else {\n // Destructure known ComputeSDK fields, collect the rest for passthrough\n const {\n runtime: _runtime,\n timeout: _timeout,\n envs,\n name,\n metadata,\n templateId,\n snapshotId,\n sandboxId: _sandboxId,\n namespace: _namespace,\n directory: _directory,\n overlays: _overlays,\n servers: _servers,\n ...providerOptions\n } = options || {};\n\n // Build create params from options\n // Daytona SDK uses envVars (not envs), labels (not metadata)\n const createParams: Record<string, any> = {\n language: runtime === 'python' ? 'python' : 'javascript',\n ...providerOptions, // Spread provider-specific options (e.g., resources, public, autoStopInterval)\n };\n\n // Remap ComputeSDK fields to Daytona SDK fields\n if (envs && Object.keys(envs).length > 0) {\n createParams.envVars = envs;\n }\n\n if (name) {\n createParams.name = name;\n }\n\n // Pass metadata as labels (Daytona uses labels: Record<string, string>)\n if (metadata && typeof metadata === 'object') {\n const labels: Record<string, string> = {};\n for (const [k, v] of Object.entries(metadata)) {\n labels[k] = typeof v === 'string' ? v : JSON.stringify(v);\n }\n createParams.labels = labels;\n }\n\n // If templateId or snapshotId is provided, use it as the source\n const sourceId = templateId || snapshotId;\n if (sourceId) {\n createParams.snapshot = sourceId;\n }\n\n // Daytona SDK accepts timeout in seconds as a second argument\n const createOptions = timeout\n ? { timeout: Math.ceil(timeout / 1000) }\n : undefined;\n\n session = await daytona.create(createParams as any, createOptions);\n sandboxId = session.id;\n }\n\n return {\n sandbox: session,\n sandboxId\n };\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes('unauthorized') || error.message.includes('API key')) {\n throw new Error(\n `Daytona authentication failed. Please check your DAYTONA_API_KEY environment variable. Get your API key from https://daytona.io/`\n );\n }\n if (error.message.includes('quota') || error.message.includes('limit')) {\n throw new Error(\n `Daytona quota exceeded. Please check your usage at https://daytona.io/`\n );\n }\n }\n throw new Error(\n `Failed to create Daytona sandbox: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n getById: async (config: DaytonaConfig, sandboxId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n const session = await daytona.get(sandboxId);\n\n return {\n sandbox: session,\n sandboxId\n };\n } catch (error) {\n // Sandbox not found is expected -- return null per the interface contract\n if (error instanceof Error && (error.message.includes('not found') || error.message.includes('404'))) {\n return null;\n }\n // Propagate unexpected errors (auth failures, network issues, etc.)\n throw new Error(\n `Failed to get Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n list: async (config: DaytonaConfig) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n const result = await daytona.list();\n\n return result.items.map((session: any) => ({\n sandbox: session,\n sandboxId: session.id\n }));\n } catch (error) {\n throw new Error(\n `Failed to list Daytona sandboxes: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n destroy: async (config: DaytonaConfig, sandboxId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n const sandbox = await daytona.get(sandboxId);\n await sandbox.delete();\n } catch (error) {\n // If the sandbox is already gone (404), that's fine for destroy semantics\n if (error instanceof Error && (error.message.includes('not found') || error.message.includes('404'))) {\n return;\n }\n // Propagate all other errors (auth failures, network issues, etc.)\n throw new Error(\n `Failed to destroy Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n // Instance operations (sandbox.*)\n runCode: async (sandbox: DaytonaSandbox, code: string, runtime?: Runtime): Promise<CodeResult> => {\n const startTime = Date.now();\n\n try {\n // Auto-detect runtime if not specified\n const effectiveRuntime = runtime || (\n // Strong Python indicators\n code.includes('print(') || \n code.includes('import ') ||\n code.includes('def ') ||\n code.includes('sys.') ||\n code.includes('json.') ||\n code.includes('__') ||\n code.includes('f\"') ||\n code.includes(\"f'\") ||\n code.includes('raise ')\n ? 'python'\n // Default to Node.js for all other cases (including ambiguous)\n : 'node'\n );\n \n // Use direct command execution like Vercel for consistency\n let response;\n \n // Use base64 encoding for both runtimes for reliability and consistency\n const encoded = Buffer.from(code).toString('base64');\n \n if (effectiveRuntime === 'python') {\n response = await sandbox.process.executeCommand(`echo \"${encoded}\" | base64 -d | python3`);\n } else {\n response = await sandbox.process.executeCommand(`echo \"${encoded}\" | base64 -d | node`);\n }\n\n // Daytona always returns exitCode: 0, so we need to detect errors from output\n const output = response.result || '';\n const hasError = output.includes('Error:') || \n output.includes('error TS') || \n output.includes('SyntaxError:') ||\n output.includes('TypeError:') ||\n output.includes('ReferenceError:') ||\n output.includes('Traceback (most recent call last)');\n\n // Check for syntax errors and throw them (similar to Vercel behavior)\n if (hasError && (output.includes('SyntaxError:') || \n output.includes('invalid syntax') ||\n output.includes('Unexpected token') ||\n output.includes('Unexpected identifier') ||\n output.includes('error TS1434'))) {\n throw new Error(`Syntax error: ${output.trim()}`);\n }\n\n const actualExitCode = hasError ? 1 : (response.exitCode || 0);\n\n return {\n output: output,\n exitCode: actualExitCode,\n language: effectiveRuntime\n };\n } catch (error) {\n // Re-throw syntax errors\n if (error instanceof Error && error.message.includes('Syntax error')) {\n throw error;\n }\n throw new Error(\n `Daytona execution failed: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n runCommand: async (sandbox: DaytonaSandbox, command: string, options?: RunCommandOptions): Promise<CommandResult> => {\n const startTime = Date.now();\n\n try {\n // Build command with options\n let fullCommand = command;\n \n // Handle environment variables\n if (options?.env && Object.keys(options.env).length > 0) {\n const envPrefix = Object.entries(options.env)\n .map(([k, v]) => `${k}=\"${escapeShellArg(v)}\"`)\n .join(' ');\n fullCommand = `${envPrefix} ${fullCommand}`;\n }\n \n // Handle working directory\n if (options?.cwd) {\n fullCommand = `cd \"${escapeShellArg(options.cwd)}\" && ${fullCommand}`;\n }\n \n // Handle background execution\n if (options?.background) {\n fullCommand = `nohup ${fullCommand} > /dev/null 2>&1 &`;\n }\n\n // Execute command using Daytona's process.executeCommand method\n const response = await sandbox.process.executeCommand(fullCommand);\n\n return {\n stdout: response.result || '',\n stderr: '',\n exitCode: response.exitCode || 0,\n durationMs: Date.now() - startTime\n };\n } catch (error) {\n throw new Error(\n `Daytona command execution failed: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n getInfo: async (sandbox: DaytonaSandbox): Promise<SandboxInfo> => {\n return {\n id: sandbox.id,\n provider: 'daytona',\n runtime: 'python', // Daytona default\n status: 'running',\n createdAt: new Date(),\n timeout: 300000,\n metadata: {\n daytonaSandboxId: sandbox.id\n }\n };\n },\n\n getUrl: async (sandbox: DaytonaSandbox, options: { port: number; protocol?: string }): Promise<string> => {\n try {\n // Use Daytona's built-in getPreviewLink method\n const previewInfo = await sandbox.getPreviewLink(options.port);\n let url = previewInfo.url;\n \n // If a specific protocol is requested, replace the URL's protocol\n if (options.protocol) {\n const urlObj = new URL(url);\n urlObj.protocol = options.protocol + ':';\n url = urlObj.toString();\n }\n \n return url;\n } catch (error) {\n throw new Error(\n `Failed to get Daytona preview URL for port ${options.port}: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n // Filesystem operations via terminal commands\n filesystem: {\n readFile: async (sandbox: DaytonaSandbox, path: string): Promise<string> => {\n try {\n const response = await sandbox.process.executeCommand(`cat \"${path}\"`);\n if (response.exitCode !== 0) {\n throw new Error(`File not found or cannot be read: ${path}`);\n }\n return response.result || '';\n } catch (error) {\n throw new Error(`Failed to read file ${path}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n writeFile: async (sandbox: DaytonaSandbox, path: string, content: string): Promise<void> => {\n try {\n // Use base64 encoding to safely handle special characters, newlines, and binary content\n const encoded = Buffer.from(content).toString('base64');\n const response = await sandbox.process.executeCommand(`echo \"${encoded}\" | base64 -d > \"${path}\"`);\n if (response.exitCode !== 0) {\n throw new Error(`Failed to write to file: ${path}`);\n }\n } catch (error) {\n throw new Error(`Failed to write file ${path}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n mkdir: async (sandbox: DaytonaSandbox, path: string): Promise<void> => {\n try {\n const response = await sandbox.process.executeCommand(`mkdir -p \"${path}\"`);\n if (response.exitCode !== 0) {\n throw new Error(`Failed to create directory: ${path}`);\n }\n } catch (error) {\n throw new Error(`Failed to create directory ${path}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n readdir: async (sandbox: DaytonaSandbox, path: string): Promise<FileEntry[]> => {\n try {\n const response = await sandbox.process.executeCommand(`ls -la \"${path}\"`);\n if (response.exitCode !== 0) {\n throw new Error(`Directory not found or cannot be read: ${path}`);\n }\n\n // Parse ls -la output into FileEntry objects\n const lines = response.result.split('\\n').filter(line => line.trim());\n const entries: FileEntry[] = [];\n\n for (const line of lines) {\n // Skip total line and current/parent directory entries\n if (line.startsWith('total ') || line.endsWith(' .') || line.endsWith(' ..')) {\n continue;\n }\n\n // Parse ls -la format: permissions links owner group size date time name\n const parts = line.trim().split(/\\s+/);\n if (parts.length >= 9) {\n const permissions = parts[0];\n const name = parts.slice(8).join(' '); // Handle filenames with spaces\n const isDirectory = permissions.startsWith('d');\n const size = parseInt(parts[4]) || 0;\n\n entries.push({\n name,\n type: isDirectory ? 'directory' as const : 'file' as const,\n size,\n modified: new Date() // ls -la date parsing is complex, use current time\n });\n }\n }\n\n return entries;\n } catch (error) {\n throw new Error(`Failed to read directory ${path}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n exists: async (sandbox: DaytonaSandbox, path: string): Promise<boolean> => {\n try {\n const response = await sandbox.process.executeCommand(`test -e \"${path}\"`);\n return response.exitCode === 0;\n } catch (error) {\n // If command execution fails, assume file doesn't exist\n return false;\n }\n },\n\n remove: async (sandbox: DaytonaSandbox, path: string): Promise<void> => {\n try {\n const response = await sandbox.process.executeCommand(`rm -rf \"${path}\"`);\n if (response.exitCode !== 0) {\n throw new Error(`Failed to remove: ${path}`);\n }\n } catch (error) {\n throw new Error(`Failed to remove ${path}: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n },\n\n // Provider-specific typed getInstance method\n getInstance: (sandbox: DaytonaSandbox): DaytonaSandbox => {\n return sandbox;\n },\n\n },\n\n snapshot: {\n create: async (config: DaytonaConfig, sandboxId: string, options?: { name?: string }) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n\n try {\n // Note: Using 'any' cast as we are using internal service property\n const snapshot = await (daytona as any).snapshots.create({\n workspaceId: sandboxId,\n name: options?.name || `snapshot-${Date.now()}`\n });\n return snapshot;\n } catch (error) {\n throw new Error(`Failed to create Daytona snapshot: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n list: async (config: DaytonaConfig) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n\n try {\n const result = await (daytona as any).snapshots.list();\n return result;\n } catch (error) {\n return [];\n }\n },\n\n delete: async (config: DaytonaConfig, snapshotId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n\n try {\n // Note: Daytona SDK might not expose delete directly or it might be 'remove'\n // We'll try the common pattern\n await (daytona as any).snapshots.delete(snapshotId);\n } catch (error) {\n // Ignore if not found\n }\n }\n },\n\n // Templates in Daytona are effectively Snapshots\n template: {\n create: async (config: DaytonaConfig, options: { name: string }) => {\n throw new Error('To create a template in Daytona, create a snapshot from a running sandbox using snapshot.create()');\n },\n\n list: async (config: DaytonaConfig) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n\n try {\n const result = await (daytona as any).snapshots.list();\n return result;\n } catch (error) {\n return [];\n }\n },\n\n delete: async (config: DaytonaConfig, templateId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n\n try {\n await (daytona as any).snapshots.delete(templateId);\n } catch (error) {\n // Ignore if not found\n }\n }\n }\n }\n});\n"],"mappings":";AAOA,SAAS,eAA0C;AACnD,SAAS,gBAAgB,sBAAsB;AAmBxC,IAAM,UAAU,eAA8C;AAAA,EACnE,MAAM;AAAA,EACN,SAAS;AAAA,IACP,SAAS;AAAA;AAAA,MAEP,QAAQ,OAAO,QAAuB,YAAmC;AAEvE,cAAM,SAAS,OAAO,UAAW,OAAO,YAAY,eAAe,QAAQ,KAAK,mBAAoB;AAEpG,YAAI,CAAC,QAAQ;AACX,gBAAM,IAAI;AAAA,YACR;AAAA,UACF;AAAA,QACF;AAEA,cAAM,UAAU,SAAS,WAAW,OAAO,WAAW;AACtD,cAAM,UAA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AA,MACtH;AAAA,MAEA,MAAM,OAAO,WAA0B;AACrC,cAAM,SAAS,OAAO,UAAU,QAAQ,IAAI;AAC5C,cAAMA,WAAU,IAAI,QAAQ,EAAE,OAAe,CAAC;AAE9C,YAAI;AACF,gBAAM,SAAS,MAAOA,SAAgB,UAAU,KAAK;AACrD,iBAAO;AAAA,QACT,SAAS,OAAO;AACd,iBAAO,CAAC;AAAA,QACV;AAAA,MACF;AAAA,MAEA,QAAQ,OAAO,QAAuB,eAAuB;AAC3D,cAAM,SAAS,OAAO,UAAU,QAAQ,IAAI;AAC5C,cAAMA,WAAU,IAAI,QAAQ,EAAE,OAAe,CAAC;AAE9C,YAAI;AACF,gBAAOA,SAAgB,UAAU,OAAO,UAAU;AAAA,QACpD,SAAS,OAAO;AAAA,QAEhB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF,CAAC;","names":["daytona"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Daytona Provider - Factory-based Implementation\n */\n\nimport { Daytona, Sandbox as DaytonaSandbox } from '@daytonaio/sdk';\nimport { defineProvider, escapeShellArg } from '@computesdk/provider';\n\nimport type { CommandResult, SandboxInfo, CreateSandboxOptions, FileEntry, RunCommandOptions } from '@computesdk/provider';\n\n/**\n * Daytona-specific configuration options\n */\nexport interface DaytonaConfig {\n /** Daytona API key - if not provided, will fallback to DAYTONA_API_KEY environment variable */\n apiKey?: string;\n /** Default runtime environment (e.g. 'python', 'node') */\n runtime?: string;\n /** Execution timeout in milliseconds */\n timeout?: number;\n}\n\n/**\n * Create a Daytona provider instance using the factory pattern\n */\nexport const daytona = defineProvider<DaytonaSandbox, DaytonaConfig>({\n name: 'daytona',\n methods: {\n sandbox: {\n create: async (config: DaytonaConfig, options?: CreateSandboxOptions) => {\n const apiKey = config.apiKey || (typeof process !== 'undefined' && process.env?.DAYTONA_API_KEY) || '';\n\n if (!apiKey) {\n throw new Error(\n `Missing Daytona API key. Provide 'apiKey' in config or set DAYTONA_API_KEY environment variable. Get your API key from https://daytona.io/`\n );\n }\n\n const runtime = (options as any)?.runtime || config.runtime || 'node';\n const timeout = options?.timeout ?? config.timeout;\n\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n\n const {\n timeout: _timeout,\n envs,\n name,\n metadata,\n templateId,\n snapshotId,\n sandboxId: _sandboxId,\n namespace: _namespace,\n directory: _directory,\n ...providerOptions\n } = options || {};\n\n const createParams: Record<string, any> = {\n language: runtime === 'python' ? 'python' : 'javascript',\n ...providerOptions,\n };\n\n if (envs && Object.keys(envs).length > 0) {\n createParams.envVars = envs;\n }\n\n if (name) {\n createParams.name = name;\n }\n\n if (metadata && typeof metadata === 'object') {\n const labels: Record<string, string> = {};\n for (const [k, v] of Object.entries(metadata)) {\n labels[k] = typeof v === 'string' ? v : JSON.stringify(v);\n }\n createParams.labels = labels;\n }\n\n const sourceId = templateId || snapshotId;\n if (sourceId) {\n createParams.snapshot = sourceId;\n }\n\n const createOptions = timeout\n ? { timeout: Math.ceil(timeout / 1000) }\n : undefined;\n\n const session = await daytona.create(createParams as any, createOptions);\n const sandboxId = session.id;\n\n return { sandbox: session, sandboxId };\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes('unauthorized') || error.message.includes('API key')) {\n throw new Error(`Daytona authentication failed. Please check your DAYTONA_API_KEY environment variable.`);\n }\n if (error.message.includes('quota') || error.message.includes('limit')) {\n throw new Error(`Daytona quota exceeded. Please check your usage at https://daytona.io/`);\n }\n }\n throw new Error(`Failed to create Daytona sandbox: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n getById: async (config: DaytonaConfig, sandboxId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n const session = await daytona.get(sandboxId);\n return { sandbox: session, sandboxId };\n } catch (error) {\n if (error instanceof Error && (error.message.includes('not found') || error.message.includes('404'))) {\n return null;\n }\n throw new Error(`Failed to get Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n list: async (config: DaytonaConfig) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n const result = await daytona.list();\n return result.items.map((session: any) => ({ sandbox: session, sandboxId: session.id }));\n } catch (error) {\n throw new Error(`Failed to list Daytona sandboxes: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n destroy: async (config: DaytonaConfig, sandboxId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n try {\n const daytona = new Daytona({ apiKey: apiKey });\n const sandbox = await daytona.get(sandboxId);\n await sandbox.delete();\n } catch (error) {\n if (error instanceof Error && (error.message.includes('not found') || error.message.includes('404'))) {\n return;\n }\n throw new Error(`Failed to destroy Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n runCommand: async (sandbox: DaytonaSandbox, command: string, options?: RunCommandOptions): Promise<CommandResult> => {\n const startTime = Date.now();\n try {\n let fullCommand = command;\n if (options?.env && Object.keys(options.env).length > 0) {\n const envPrefix = Object.entries(options.env)\n .map(([k, v]) => `${k}=\"${escapeShellArg(v)}\"`)\n .join(' ');\n fullCommand = `${envPrefix} ${fullCommand}`;\n }\n if (options?.cwd) fullCommand = `cd \"${escapeShellArg(options.cwd)}\" && ${fullCommand}`;\n if (options?.background) fullCommand = `nohup ${fullCommand} > /dev/null 2>&1 &`;\n\n const response = await sandbox.process.executeCommand(fullCommand);\n return {\n stdout: response.result || '',\n stderr: '',\n exitCode: response.exitCode || 0,\n durationMs: Date.now() - startTime\n };\n } catch (error) {\n throw new Error(`Daytona command execution failed: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n getInfo: async (sandbox: DaytonaSandbox): Promise<SandboxInfo> => {\n return {\n id: sandbox.id,\n provider: 'daytona',\n status: 'running',\n createdAt: new Date(),\n timeout: 300000,\n metadata: { daytonaSandboxId: sandbox.id }\n };\n },\n\n getUrl: async (sandbox: DaytonaSandbox, options: { port: number; protocol?: string }): Promise<string> => {\n try {\n const previewInfo = await sandbox.getPreviewLink(options.port);\n let url = previewInfo.url;\n if (options.protocol) {\n const urlObj = new URL(url);\n urlObj.protocol = options.protocol + ':';\n url = urlObj.toString();\n }\n return url;\n } catch (error) {\n throw new Error(`Failed to get Daytona preview URL for port ${options.port}: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n filesystem: {\n readFile: async (sandbox: DaytonaSandbox, path: string): Promise<string> => {\n const response = await sandbox.process.executeCommand(`cat \"${path}\"`);\n if (response.exitCode !== 0) throw new Error(`File not found or cannot be read: ${path}`);\n return response.result || '';\n },\n writeFile: async (sandbox: DaytonaSandbox, path: string, content: string): Promise<void> => {\n const encoded = Buffer.from(content).toString('base64');\n const response = await sandbox.process.executeCommand(`echo \"${encoded}\" | base64 -d > \"${path}\"`);\n if (response.exitCode !== 0) throw new Error(`Failed to write to file: ${path}`);\n },\n mkdir: async (sandbox: DaytonaSandbox, path: string): Promise<void> => {\n const response = await sandbox.process.executeCommand(`mkdir -p \"${path}\"`);\n if (response.exitCode !== 0) throw new Error(`Failed to create directory: ${path}`);\n },\n readdir: async (sandbox: DaytonaSandbox, path: string): Promise<FileEntry[]> => {\n const response = await sandbox.process.executeCommand(`ls -la \"${path}\"`);\n if (response.exitCode !== 0) throw new Error(`Directory not found or cannot be read: ${path}`);\n const lines = response.result.split('\\n').filter((l: string) => l.trim());\n const entries: FileEntry[] = [];\n for (const line of lines) {\n if (line.startsWith('total ') || line.endsWith(' .') || line.endsWith(' ..')) continue;\n const parts = line.trim().split(/\\s+/);\n if (parts.length >= 9) {\n entries.push({\n name: parts.slice(8).join(' '),\n type: parts[0].startsWith('d') ? 'directory' as const : 'file' as const,\n size: parseInt(parts[4]) || 0,\n modified: new Date()\n });\n }\n }\n return entries;\n },\n exists: async (sandbox: DaytonaSandbox, path: string): Promise<boolean> => {\n const response = await sandbox.process.executeCommand(`test -e \"${path}\"`);\n return response.exitCode === 0;\n },\n remove: async (sandbox: DaytonaSandbox, path: string): Promise<void> => {\n const response = await sandbox.process.executeCommand(`rm -rf \"${path}\"`);\n if (response.exitCode !== 0) throw new Error(`Failed to remove: ${path}`);\n }\n },\n\n getInstance: (sandbox: DaytonaSandbox): DaytonaSandbox => sandbox,\n },\n\n snapshot: {\n create: async (config: DaytonaConfig, sandboxId: string, options?: { name?: string }) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n try {\n const snapshot = await (daytona as any).snapshots.create({\n workspaceId: sandboxId,\n name: options?.name || `snapshot-${Date.now()}`\n });\n return snapshot;\n } catch (error) {\n throw new Error(`Failed to create Daytona snapshot: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n list: async (config: DaytonaConfig) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n try { return await (daytona as any).snapshots.list(); } catch { return []; }\n },\n delete: async (config: DaytonaConfig, snapshotId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n try { await (daytona as any).snapshots.delete(snapshotId); } catch { /* ignore */ }\n }\n },\n\n template: {\n create: async (_config: DaytonaConfig, _options: { name: string }) => {\n throw new Error('To create a template in Daytona, create a snapshot from a running sandbox using snapshot.create()');\n },\n list: async (config: DaytonaConfig) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n try { return await (daytona as any).snapshots.list(); } catch { return []; }\n },\n delete: async (config: DaytonaConfig, templateId: string) => {\n const apiKey = config.apiKey || process.env.DAYTONA_API_KEY!;\n const daytona = new Daytona({ apiKey: apiKey });\n try { await (daytona as any).snapshots.delete(templateId); } catch { /* ignore */ }\n }\n }\n }\n});\n"],"mappings":";AAIA,SAAS,eAA0C;AACnD,SAAS,gBAAgB,sBAAsB;AAmBxC,IAAM,UAAU,eAA8C;AAAA,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AAO,WAA0B;AACrC,cAAM,SAAS,OAAO,UAAU,QAAQ,IAAI;AAC5C,cAAMA,WAAU,IAAI,QAAQ,EAAE,OAAe,CAAC;AAC9C,YAAI;AAAE,iBAAO,MAAOA,SAAgB,UAAU,KAAK;AAAA,QAAG,QAAQ;AAAE,iBAAO,CAAC;AAAA,QAAG;AAAA,MAC7E;AAAA,MACA,QAAQ,OAAO,QAAuB,eAAuB;AAC3D,cAAM,SAAS,OAAO,UAAU,QAAQ,IAAI;AAC5C,cAAMA,WAAU,IAAI,QAAQ,EAAE,OAAe,CAAC;AAC9C,YAAI;AAAE,gBAAOA,SAAgB,UAAU,OAAO,UAAU;AAAA,QAAG,QAAQ;AAAA,QAAe;AAAA,MACpF;AAAA,IACF;AAAA,EACF;AACF,CAAC;","names":["daytona"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@computesdk/daytona",
3
- "version": "1.7.24",
3
+ "version": "1.7.26",
4
4
  "description": "Daytona provider for ComputeSDK - standardized development environments with devcontainer support",
5
5
  "author": "Garrison",
6
6
  "license": "MIT",
@@ -19,8 +19,8 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "@daytonaio/sdk": "^0.143.0",
22
- "@computesdk/provider": "1.3.0",
23
- "computesdk": "2.6.0"
22
+ "@computesdk/provider": "2.0.0",
23
+ "computesdk": "4.0.0"
24
24
  },
25
25
  "keywords": [
26
26
  "computesdk",
@@ -51,7 +51,7 @@
51
51
  "tsup": "^8.0.0",
52
52
  "typescript": "^5.0.0",
53
53
  "vitest": "^1.0.0",
54
- "@computesdk/test-utils": "1.6.1"
54
+ "@computesdk/test-utils": "2.0.0"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "tsup",