@computesdk/daytona 1.7.25 → 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/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,10 +40,7 @@ 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
43
  const {
47
- runtime: _runtime,
48
44
  timeout: _timeout,
49
45
  envs,
50
46
  name,
@@ -59,7 +55,6 @@ var daytona = (0, import_provider.defineProvider)({
59
55
  const createParams = {
60
56
  language: runtime === "python" ? "python" : "javascript",
61
57
  ...providerOptions
62
- // Spread provider-specific options (e.g., resources, public, autoStopInterval)
63
58
  };
64
59
  if (envs && Object.keys(envs).length > 0) {
65
60
  createParams.envVars = envs;
@@ -79,28 +74,19 @@ var daytona = (0, import_provider.defineProvider)({
79
74
  createParams.snapshot = sourceId;
80
75
  }
81
76
  const createOptions = timeout ? { timeout: Math.ceil(timeout / 1e3) } : void 0;
82
- session = await daytona2.create(createParams, createOptions);
83
- sandboxId = session.id;
84
- return {
85
- sandbox: session,
86
- sandboxId
87
- };
77
+ const session = await daytona2.create(createParams, createOptions);
78
+ const sandboxId = session.id;
79
+ return { sandbox: session, sandboxId };
88
80
  } catch (error) {
89
81
  if (error instanceof Error) {
90
82
  if (error.message.includes("unauthorized") || error.message.includes("API key")) {
91
- throw new Error(
92
- `Daytona authentication failed. Please check your DAYTONA_API_KEY environment variable. Get your API key from https://daytona.io/`
93
- );
83
+ throw new Error(`Daytona authentication failed. Please check your DAYTONA_API_KEY environment variable.`);
94
84
  }
95
85
  if (error.message.includes("quota") || error.message.includes("limit")) {
96
- throw new Error(
97
- `Daytona quota exceeded. Please check your usage at https://daytona.io/`
98
- );
86
+ throw new Error(`Daytona quota exceeded. Please check your usage at https://daytona.io/`);
99
87
  }
100
88
  }
101
- throw new Error(
102
- `Failed to create Daytona sandbox: ${error instanceof Error ? error.message : String(error)}`
103
- );
89
+ throw new Error(`Failed to create Daytona sandbox: ${error instanceof Error ? error.message : String(error)}`);
104
90
  }
105
91
  },
106
92
  getById: async (config, sandboxId) => {
@@ -108,17 +94,12 @@ var daytona = (0, import_provider.defineProvider)({
108
94
  try {
109
95
  const daytona2 = new import_sdk.Daytona({ apiKey });
110
96
  const session = await daytona2.get(sandboxId);
111
- return {
112
- sandbox: session,
113
- sandboxId
114
- };
97
+ return { sandbox: session, sandboxId };
115
98
  } catch (error) {
116
99
  if (error instanceof Error && (error.message.includes("not found") || error.message.includes("404"))) {
117
100
  return null;
118
101
  }
119
- throw new Error(
120
- `Failed to get Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`
121
- );
102
+ throw new Error(`Failed to get Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`);
122
103
  }
123
104
  },
124
105
  list: async (config) => {
@@ -126,14 +107,9 @@ var daytona = (0, import_provider.defineProvider)({
126
107
  try {
127
108
  const daytona2 = new import_sdk.Daytona({ apiKey });
128
109
  const result = await daytona2.list();
129
- return result.items.map((session) => ({
130
- sandbox: session,
131
- sandboxId: session.id
132
- }));
110
+ return result.items.map((session) => ({ sandbox: session, sandboxId: session.id }));
133
111
  } catch (error) {
134
- throw new Error(
135
- `Failed to list Daytona sandboxes: ${error instanceof Error ? error.message : String(error)}`
136
- );
112
+ throw new Error(`Failed to list Daytona sandboxes: ${error instanceof Error ? error.message : String(error)}`);
137
113
  }
138
114
  },
139
115
  destroy: async (config, sandboxId) => {
@@ -146,12 +122,9 @@ var daytona = (0, import_provider.defineProvider)({
146
122
  if (error instanceof Error && (error.message.includes("not found") || error.message.includes("404"))) {
147
123
  return;
148
124
  }
149
- throw new Error(
150
- `Failed to destroy Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`
151
- );
125
+ throw new Error(`Failed to destroy Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`);
152
126
  }
153
127
  },
154
- // Instance operations (sandbox.*)
155
128
  runCommand: async (sandbox, command, options) => {
156
129
  const startTime = Date.now();
157
130
  try {
@@ -160,12 +133,8 @@ var daytona = (0, import_provider.defineProvider)({
160
133
  const envPrefix = Object.entries(options.env).map(([k, v]) => `${k}="${(0, import_provider.escapeShellArg)(v)}"`).join(" ");
161
134
  fullCommand = `${envPrefix} ${fullCommand}`;
162
135
  }
163
- if (options?.cwd) {
164
- fullCommand = `cd "${(0, import_provider.escapeShellArg)(options.cwd)}" && ${fullCommand}`;
165
- }
166
- if (options?.background) {
167
- fullCommand = `nohup ${fullCommand} > /dev/null 2>&1 &`;
168
- }
136
+ if (options?.cwd) fullCommand = `cd "${(0, import_provider.escapeShellArg)(options.cwd)}" && ${fullCommand}`;
137
+ if (options?.background) fullCommand = `nohup ${fullCommand} > /dev/null 2>&1 &`;
169
138
  const response = await sandbox.process.executeCommand(fullCommand);
170
139
  return {
171
140
  stdout: response.result || "",
@@ -174,23 +143,17 @@ var daytona = (0, import_provider.defineProvider)({
174
143
  durationMs: Date.now() - startTime
175
144
  };
176
145
  } catch (error) {
177
- throw new Error(
178
- `Daytona command execution failed: ${error instanceof Error ? error.message : String(error)}`
179
- );
146
+ throw new Error(`Daytona command execution failed: ${error instanceof Error ? error.message : String(error)}`);
180
147
  }
181
148
  },
182
149
  getInfo: async (sandbox) => {
183
150
  return {
184
151
  id: sandbox.id,
185
152
  provider: "daytona",
186
- runtime: "python",
187
- // Daytona default
188
153
  status: "running",
189
154
  createdAt: /* @__PURE__ */ new Date(),
190
155
  timeout: 3e5,
191
- metadata: {
192
- daytonaSandboxId: sandbox.id
193
- }
156
+ metadata: { daytonaSandboxId: sandbox.id }
194
157
  };
195
158
  },
196
159
  getUrl: async (sandbox, options) => {
@@ -204,100 +167,53 @@ var daytona = (0, import_provider.defineProvider)({
204
167
  }
205
168
  return url;
206
169
  } catch (error) {
207
- throw new Error(
208
- `Failed to get Daytona preview URL for port ${options.port}: ${error instanceof Error ? error.message : String(error)}`
209
- );
170
+ throw new Error(`Failed to get Daytona preview URL for port ${options.port}: ${error instanceof Error ? error.message : String(error)}`);
210
171
  }
211
172
  },
212
- // Filesystem operations via terminal commands
213
173
  filesystem: {
214
174
  readFile: async (sandbox, path) => {
215
- try {
216
- const response = await sandbox.process.executeCommand(`cat "${path}"`);
217
- if (response.exitCode !== 0) {
218
- throw new Error(`File not found or cannot be read: ${path}`);
219
- }
220
- return response.result || "";
221
- } catch (error) {
222
- throw new Error(`Failed to read file ${path}: ${error instanceof Error ? error.message : String(error)}`);
223
- }
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 || "";
224
178
  },
225
179
  writeFile: async (sandbox, path, content) => {
226
- try {
227
- const encoded = Buffer.from(content).toString("base64");
228
- const response = await sandbox.process.executeCommand(`echo "${encoded}" | base64 -d > "${path}"`);
229
- if (response.exitCode !== 0) {
230
- throw new Error(`Failed to write to file: ${path}`);
231
- }
232
- } catch (error) {
233
- throw new Error(`Failed to write file ${path}: ${error instanceof Error ? error.message : String(error)}`);
234
- }
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}`);
235
183
  },
236
184
  mkdir: async (sandbox, path) => {
237
- try {
238
- const response = await sandbox.process.executeCommand(`mkdir -p "${path}"`);
239
- if (response.exitCode !== 0) {
240
- throw new Error(`Failed to create directory: ${path}`);
241
- }
242
- } catch (error) {
243
- throw new Error(`Failed to create directory ${path}: ${error instanceof Error ? error.message : String(error)}`);
244
- }
185
+ const response = await sandbox.process.executeCommand(`mkdir -p "${path}"`);
186
+ if (response.exitCode !== 0) throw new Error(`Failed to create directory: ${path}`);
245
187
  },
246
188
  readdir: async (sandbox, path) => {
247
- try {
248
- const response = await sandbox.process.executeCommand(`ls -la "${path}"`);
249
- if (response.exitCode !== 0) {
250
- throw new Error(`Directory not found or cannot be read: ${path}`);
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
+ });
251
203
  }
252
- const lines = response.result.split("\n").filter((line) => line.trim());
253
- const entries = [];
254
- for (const line of lines) {
255
- if (line.startsWith("total ") || line.endsWith(" .") || line.endsWith(" ..")) {
256
- continue;
257
- }
258
- const parts = line.trim().split(/\s+/);
259
- if (parts.length >= 9) {
260
- const permissions = parts[0];
261
- const name = parts.slice(8).join(" ");
262
- const isDirectory = permissions.startsWith("d");
263
- const size = parseInt(parts[4]) || 0;
264
- entries.push({
265
- name,
266
- type: isDirectory ? "directory" : "file",
267
- size,
268
- modified: /* @__PURE__ */ new Date()
269
- // ls -la date parsing is complex, use current time
270
- });
271
- }
272
- }
273
- return entries;
274
- } catch (error) {
275
- throw new Error(`Failed to read directory ${path}: ${error instanceof Error ? error.message : String(error)}`);
276
204
  }
205
+ return entries;
277
206
  },
278
207
  exists: async (sandbox, path) => {
279
- try {
280
- const response = await sandbox.process.executeCommand(`test -e "${path}"`);
281
- return response.exitCode === 0;
282
- } catch (error) {
283
- return false;
284
- }
208
+ const response = await sandbox.process.executeCommand(`test -e "${path}"`);
209
+ return response.exitCode === 0;
285
210
  },
286
211
  remove: async (sandbox, path) => {
287
- try {
288
- const response = await sandbox.process.executeCommand(`rm -rf "${path}"`);
289
- if (response.exitCode !== 0) {
290
- throw new Error(`Failed to remove: ${path}`);
291
- }
292
- } catch (error) {
293
- throw new Error(`Failed to remove ${path}: ${error instanceof Error ? error.message : String(error)}`);
294
- }
212
+ const response = await sandbox.process.executeCommand(`rm -rf "${path}"`);
213
+ if (response.exitCode !== 0) throw new Error(`Failed to remove: ${path}`);
295
214
  }
296
215
  },
297
- // Provider-specific typed getInstance method
298
- getInstance: (sandbox) => {
299
- return sandbox;
300
- }
216
+ getInstance: (sandbox) => sandbox
301
217
  },
302
218
  snapshot: {
303
219
  create: async (config, sandboxId, options) => {
@@ -317,9 +233,8 @@ var daytona = (0, import_provider.defineProvider)({
317
233
  const apiKey = config.apiKey || process.env.DAYTONA_API_KEY;
318
234
  const daytona2 = new import_sdk.Daytona({ apiKey });
319
235
  try {
320
- const result = await daytona2.snapshots.list();
321
- return result;
322
- } catch (error) {
236
+ return await daytona2.snapshots.list();
237
+ } catch {
323
238
  return [];
324
239
  }
325
240
  },
@@ -328,22 +243,20 @@ var daytona = (0, import_provider.defineProvider)({
328
243
  const daytona2 = new import_sdk.Daytona({ apiKey });
329
244
  try {
330
245
  await daytona2.snapshots.delete(snapshotId);
331
- } catch (error) {
246
+ } catch {
332
247
  }
333
248
  }
334
249
  },
335
- // Templates in Daytona are effectively Snapshots
336
250
  template: {
337
- create: async (config, options) => {
251
+ create: async (_config, _options) => {
338
252
  throw new Error("To create a template in Daytona, create a snapshot from a running sandbox using snapshot.create()");
339
253
  },
340
254
  list: async (config) => {
341
255
  const apiKey = config.apiKey || process.env.DAYTONA_API_KEY;
342
256
  const daytona2 = new import_sdk.Daytona({ apiKey });
343
257
  try {
344
- const result = await daytona2.snapshots.list();
345
- return result;
346
- } catch (error) {
258
+ return await daytona2.snapshots.list();
259
+ } catch {
347
260
  return [];
348
261
  }
349
262
  },
@@ -352,7 +265,7 @@ var daytona = (0, import_provider.defineProvider)({
352
265
  const daytona2 = new import_sdk.Daytona({ apiKey });
353
266
  try {
354
267
  await daytona2.snapshots.delete(templateId);
355
- } catch (error) {
268
+ } catch {
356
269
  }
357
270
  }
358
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 // 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 ...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 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\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;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AAS,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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,iBAAmD;AACnD,sBAA+C;AAmBxC,IAAM,cAAU,gCAA8C;AAAA,EACnE,MAAM;AAAA,EACN,SAAS;AAAA,IACP,SAAS;AAAA,MACP,QAAQ,OAAO,QAAuB,YAAmC;AACvE,cAAM,SAAS,OAAO,UAAW,OAAO,YAAY,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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,10 +16,7 @@ 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
19
  const {
23
- runtime: _runtime,
24
20
  timeout: _timeout,
25
21
  envs,
26
22
  name,
@@ -35,7 +31,6 @@ var daytona = defineProvider({
35
31
  const createParams = {
36
32
  language: runtime === "python" ? "python" : "javascript",
37
33
  ...providerOptions
38
- // Spread provider-specific options (e.g., resources, public, autoStopInterval)
39
34
  };
40
35
  if (envs && Object.keys(envs).length > 0) {
41
36
  createParams.envVars = envs;
@@ -55,28 +50,19 @@ var daytona = defineProvider({
55
50
  createParams.snapshot = sourceId;
56
51
  }
57
52
  const createOptions = timeout ? { timeout: Math.ceil(timeout / 1e3) } : void 0;
58
- session = await daytona2.create(createParams, createOptions);
59
- sandboxId = session.id;
60
- return {
61
- sandbox: session,
62
- sandboxId
63
- };
53
+ const session = await daytona2.create(createParams, createOptions);
54
+ const sandboxId = session.id;
55
+ return { sandbox: session, sandboxId };
64
56
  } catch (error) {
65
57
  if (error instanceof Error) {
66
58
  if (error.message.includes("unauthorized") || error.message.includes("API key")) {
67
- throw new Error(
68
- `Daytona authentication failed. Please check your DAYTONA_API_KEY environment variable. Get your API key from https://daytona.io/`
69
- );
59
+ throw new Error(`Daytona authentication failed. Please check your DAYTONA_API_KEY environment variable.`);
70
60
  }
71
61
  if (error.message.includes("quota") || error.message.includes("limit")) {
72
- throw new Error(
73
- `Daytona quota exceeded. Please check your usage at https://daytona.io/`
74
- );
62
+ throw new Error(`Daytona quota exceeded. Please check your usage at https://daytona.io/`);
75
63
  }
76
64
  }
77
- throw new Error(
78
- `Failed to create Daytona sandbox: ${error instanceof Error ? error.message : String(error)}`
79
- );
65
+ throw new Error(`Failed to create Daytona sandbox: ${error instanceof Error ? error.message : String(error)}`);
80
66
  }
81
67
  },
82
68
  getById: async (config, sandboxId) => {
@@ -84,17 +70,12 @@ var daytona = defineProvider({
84
70
  try {
85
71
  const daytona2 = new Daytona({ apiKey });
86
72
  const session = await daytona2.get(sandboxId);
87
- return {
88
- sandbox: session,
89
- sandboxId
90
- };
73
+ return { sandbox: session, sandboxId };
91
74
  } catch (error) {
92
75
  if (error instanceof Error && (error.message.includes("not found") || error.message.includes("404"))) {
93
76
  return null;
94
77
  }
95
- throw new Error(
96
- `Failed to get Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`
97
- );
78
+ throw new Error(`Failed to get Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`);
98
79
  }
99
80
  },
100
81
  list: async (config) => {
@@ -102,14 +83,9 @@ var daytona = defineProvider({
102
83
  try {
103
84
  const daytona2 = new Daytona({ apiKey });
104
85
  const result = await daytona2.list();
105
- return result.items.map((session) => ({
106
- sandbox: session,
107
- sandboxId: session.id
108
- }));
86
+ return result.items.map((session) => ({ sandbox: session, sandboxId: session.id }));
109
87
  } catch (error) {
110
- throw new Error(
111
- `Failed to list Daytona sandboxes: ${error instanceof Error ? error.message : String(error)}`
112
- );
88
+ throw new Error(`Failed to list Daytona sandboxes: ${error instanceof Error ? error.message : String(error)}`);
113
89
  }
114
90
  },
115
91
  destroy: async (config, sandboxId) => {
@@ -122,12 +98,9 @@ var daytona = defineProvider({
122
98
  if (error instanceof Error && (error.message.includes("not found") || error.message.includes("404"))) {
123
99
  return;
124
100
  }
125
- throw new Error(
126
- `Failed to destroy Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`
127
- );
101
+ throw new Error(`Failed to destroy Daytona sandbox ${sandboxId}: ${error instanceof Error ? error.message : String(error)}`);
128
102
  }
129
103
  },
130
- // Instance operations (sandbox.*)
131
104
  runCommand: async (sandbox, command, options) => {
132
105
  const startTime = Date.now();
133
106
  try {
@@ -136,12 +109,8 @@ var daytona = defineProvider({
136
109
  const envPrefix = Object.entries(options.env).map(([k, v]) => `${k}="${escapeShellArg(v)}"`).join(" ");
137
110
  fullCommand = `${envPrefix} ${fullCommand}`;
138
111
  }
139
- if (options?.cwd) {
140
- fullCommand = `cd "${escapeShellArg(options.cwd)}" && ${fullCommand}`;
141
- }
142
- if (options?.background) {
143
- fullCommand = `nohup ${fullCommand} > /dev/null 2>&1 &`;
144
- }
112
+ if (options?.cwd) fullCommand = `cd "${escapeShellArg(options.cwd)}" && ${fullCommand}`;
113
+ if (options?.background) fullCommand = `nohup ${fullCommand} > /dev/null 2>&1 &`;
145
114
  const response = await sandbox.process.executeCommand(fullCommand);
146
115
  return {
147
116
  stdout: response.result || "",
@@ -150,23 +119,17 @@ var daytona = defineProvider({
150
119
  durationMs: Date.now() - startTime
151
120
  };
152
121
  } catch (error) {
153
- throw new Error(
154
- `Daytona command execution failed: ${error instanceof Error ? error.message : String(error)}`
155
- );
122
+ throw new Error(`Daytona command execution failed: ${error instanceof Error ? error.message : String(error)}`);
156
123
  }
157
124
  },
158
125
  getInfo: async (sandbox) => {
159
126
  return {
160
127
  id: sandbox.id,
161
128
  provider: "daytona",
162
- runtime: "python",
163
- // Daytona default
164
129
  status: "running",
165
130
  createdAt: /* @__PURE__ */ new Date(),
166
131
  timeout: 3e5,
167
- metadata: {
168
- daytonaSandboxId: sandbox.id
169
- }
132
+ metadata: { daytonaSandboxId: sandbox.id }
170
133
  };
171
134
  },
172
135
  getUrl: async (sandbox, options) => {
@@ -180,100 +143,53 @@ var daytona = defineProvider({
180
143
  }
181
144
  return url;
182
145
  } catch (error) {
183
- throw new Error(
184
- `Failed to get Daytona preview URL for port ${options.port}: ${error instanceof Error ? error.message : String(error)}`
185
- );
146
+ throw new Error(`Failed to get Daytona preview URL for port ${options.port}: ${error instanceof Error ? error.message : String(error)}`);
186
147
  }
187
148
  },
188
- // Filesystem operations via terminal commands
189
149
  filesystem: {
190
150
  readFile: async (sandbox, path) => {
191
- try {
192
- const response = await sandbox.process.executeCommand(`cat "${path}"`);
193
- if (response.exitCode !== 0) {
194
- throw new Error(`File not found or cannot be read: ${path}`);
195
- }
196
- return response.result || "";
197
- } catch (error) {
198
- throw new Error(`Failed to read file ${path}: ${error instanceof Error ? error.message : String(error)}`);
199
- }
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 || "";
200
154
  },
201
155
  writeFile: async (sandbox, path, content) => {
202
- try {
203
- const encoded = Buffer.from(content).toString("base64");
204
- const response = await sandbox.process.executeCommand(`echo "${encoded}" | base64 -d > "${path}"`);
205
- if (response.exitCode !== 0) {
206
- throw new Error(`Failed to write to file: ${path}`);
207
- }
208
- } catch (error) {
209
- throw new Error(`Failed to write file ${path}: ${error instanceof Error ? error.message : String(error)}`);
210
- }
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}`);
211
159
  },
212
160
  mkdir: async (sandbox, path) => {
213
- try {
214
- const response = await sandbox.process.executeCommand(`mkdir -p "${path}"`);
215
- if (response.exitCode !== 0) {
216
- throw new Error(`Failed to create directory: ${path}`);
217
- }
218
- } catch (error) {
219
- throw new Error(`Failed to create directory ${path}: ${error instanceof Error ? error.message : String(error)}`);
220
- }
161
+ const response = await sandbox.process.executeCommand(`mkdir -p "${path}"`);
162
+ if (response.exitCode !== 0) throw new Error(`Failed to create directory: ${path}`);
221
163
  },
222
164
  readdir: async (sandbox, path) => {
223
- try {
224
- const response = await sandbox.process.executeCommand(`ls -la "${path}"`);
225
- if (response.exitCode !== 0) {
226
- throw new Error(`Directory not found or cannot be read: ${path}`);
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
+ });
227
179
  }
228
- const lines = response.result.split("\n").filter((line) => line.trim());
229
- const entries = [];
230
- for (const line of lines) {
231
- if (line.startsWith("total ") || line.endsWith(" .") || line.endsWith(" ..")) {
232
- continue;
233
- }
234
- const parts = line.trim().split(/\s+/);
235
- if (parts.length >= 9) {
236
- const permissions = parts[0];
237
- const name = parts.slice(8).join(" ");
238
- const isDirectory = permissions.startsWith("d");
239
- const size = parseInt(parts[4]) || 0;
240
- entries.push({
241
- name,
242
- type: isDirectory ? "directory" : "file",
243
- size,
244
- modified: /* @__PURE__ */ new Date()
245
- // ls -la date parsing is complex, use current time
246
- });
247
- }
248
- }
249
- return entries;
250
- } catch (error) {
251
- throw new Error(`Failed to read directory ${path}: ${error instanceof Error ? error.message : String(error)}`);
252
180
  }
181
+ return entries;
253
182
  },
254
183
  exists: async (sandbox, path) => {
255
- try {
256
- const response = await sandbox.process.executeCommand(`test -e "${path}"`);
257
- return response.exitCode === 0;
258
- } catch (error) {
259
- return false;
260
- }
184
+ const response = await sandbox.process.executeCommand(`test -e "${path}"`);
185
+ return response.exitCode === 0;
261
186
  },
262
187
  remove: async (sandbox, path) => {
263
- try {
264
- const response = await sandbox.process.executeCommand(`rm -rf "${path}"`);
265
- if (response.exitCode !== 0) {
266
- throw new Error(`Failed to remove: ${path}`);
267
- }
268
- } catch (error) {
269
- throw new Error(`Failed to remove ${path}: ${error instanceof Error ? error.message : String(error)}`);
270
- }
188
+ const response = await sandbox.process.executeCommand(`rm -rf "${path}"`);
189
+ if (response.exitCode !== 0) throw new Error(`Failed to remove: ${path}`);
271
190
  }
272
191
  },
273
- // Provider-specific typed getInstance method
274
- getInstance: (sandbox) => {
275
- return sandbox;
276
- }
192
+ getInstance: (sandbox) => sandbox
277
193
  },
278
194
  snapshot: {
279
195
  create: async (config, sandboxId, options) => {
@@ -293,9 +209,8 @@ var daytona = defineProvider({
293
209
  const apiKey = config.apiKey || process.env.DAYTONA_API_KEY;
294
210
  const daytona2 = new Daytona({ apiKey });
295
211
  try {
296
- const result = await daytona2.snapshots.list();
297
- return result;
298
- } catch (error) {
212
+ return await daytona2.snapshots.list();
213
+ } catch {
299
214
  return [];
300
215
  }
301
216
  },
@@ -304,22 +219,20 @@ var daytona = defineProvider({
304
219
  const daytona2 = new Daytona({ apiKey });
305
220
  try {
306
221
  await daytona2.snapshots.delete(snapshotId);
307
- } catch (error) {
222
+ } catch {
308
223
  }
309
224
  }
310
225
  },
311
- // Templates in Daytona are effectively Snapshots
312
226
  template: {
313
- create: async (config, options) => {
227
+ create: async (_config, _options) => {
314
228
  throw new Error("To create a template in Daytona, create a snapshot from a running sandbox using snapshot.create()");
315
229
  },
316
230
  list: async (config) => {
317
231
  const apiKey = config.apiKey || process.env.DAYTONA_API_KEY;
318
232
  const daytona2 = new Daytona({ apiKey });
319
233
  try {
320
- const result = await daytona2.snapshots.list();
321
- return result;
322
- } catch (error) {
234
+ return await daytona2.snapshots.list();
235
+ } catch {
323
236
  return [];
324
237
  }
325
238
  },
@@ -328,7 +241,7 @@ var daytona = defineProvider({
328
241
  const daytona2 = new Daytona({ apiKey });
329
242
  try {
330
243
  await daytona2.snapshots.delete(templateId);
331
- } catch (error) {
244
+ } catch {
332
245
  }
333
246
  }
334
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 // 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 ...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 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\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,UAAU,SAAS,WAAW,OAAO;AAE3C,YAAI;AAEF,gBAAMA,WAAU,IAAI,QAAQ,EAAE,OAAe,CAAC;AAE9C,cAAI;AACJ,cAAI;AAGJ,gBAAM;AAAA,YACJ,SAAS;AAAA,YACT,SAAS;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,WAAW;AAAA,YACX,WAAW;AAAA,YACX,WAAW;AAAA,YACX,GAAG;AAAA,UACL,IAAI,WAAW,CAAC;AAId,gBAAM,eAAoC;AAAA,YACxC,UAAU,YAAY,WAAW,WAAW;AAAA,YAC5C,GAAG;AAAA;AAAA,UACL;AAGA,cAAI,QAAQ,OAAO,KAAK,IAAI,EAAE,SAAS,GAAG;AACxC,yBAAa,UAAU;AAAA,UACzB;AAEA,cAAI,MAAM;AACR,yBAAa,OAAO;AAAA,UACtB;AAGA,cAAI,YAAY,OAAO,aAAa,UAAU;AAC5C,kBAAM,SAAiC,CAAC;AACxC,uBAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,QAAQ,GAAG;AAC7C,qBAAO,CAAC,IAAI,OAAO,MAAM,WAAW,IAAI,KAAK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,EAAE,OAAe,CAAC;AAE9C,YAAI;AAGF,gBAAOA,SAAgB,UAAU,OAAO,UAAU;AAAA,QACpD,SAAS,OAAO;AAAA,QAEhB;AAAA,MACF;AAAA,IACF;AAAA;AAAA,IAGA,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,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,EACnE,MAAM;AAAA,EACN,SAAS;AAAA,IACP,SAAS;AAAA,MACP,QAAQ,OAAO,QAAuB,YAAmC;AACvE,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,UAAW,SAAiB,WAAW,OAAO,WAAW;AAC/D,cAAM,UAAU,SAAS,WAAW,OAAO;AAE3C,YAAI;AACF,gBAAMA,WAAU,IAAI,QAAQ,EAAE,OAAe,CAAC;AAE9C,gBAAM;AAAA,YACJ,SAAS;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,WAAW;AAAA,YACX,WAAW;AAAA,YACX,WAAW;AAAA,YACX,GAAG;AAAA,UACL,IAAI,WAAW,CAAC;AAEhB,gBAAM,eAAoC;AAAA,YACxC,UAAU,YAAY,WAAW,WAAW;AAAA,YAC5C,GAAG;AAAA,UACL;AAEA,cAAI,QAAQ,OAAO,KAAK,IAAI,EAAE,SAAS,GAAG;AACxC,yBAAa,UAAU;AAAA,UACzB;AAEA,cAAI,MAAM;AACR,yBAAa,OAAO;AAAA,UACtB;AAEA,cAAI,YAAY,OAAO,aAAa,UAAU;AAC5C,kBAAM,SAAiC,CAAC;AACxC,uBAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,QAAQ,GAAG;AAC7C,qBAAO,CAAC,IAAI,OAAO,MAAM,WAAW,IAAI,KAAK,UAAU,CAAC;AAAA,YAC1D;AACA,yBAAa,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AC;AAC9C,YAAI;AAAE,gBAAOA,SAAgB,UAAU,OAAO,UAAU;AAAA,QAAG,QAAQ;AAAA,QAAe;AAAA,MACpF;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,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.25",
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.4.0",
23
- "computesdk": "3.0.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",