@sandagent/sandbox-daytona 0.1.0-beta.0

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.
@@ -0,0 +1,118 @@
1
+ import type { SandboxAdapter, SandboxHandle } from "@sandagent/manager";
2
+ /**
3
+ * Options for creating a DaytonaSandbox instance
4
+ */
5
+ export interface DaytonaSandboxOptions {
6
+ /** Daytona API key (defaults to DAYTONA_API_KEY env var) */
7
+ apiKey?: string;
8
+ /** Daytona API URL (defaults to DAYTONA_API_URL env var) */
9
+ apiUrl?: string;
10
+ /** Timeout in seconds (0 means no timeout, default is 60) */
11
+ timeout?: number;
12
+ /** Path to runner bundle.js (required for running sandagent) */
13
+ runnerBundlePath?: string;
14
+ /** Path to template directory to upload */
15
+ templatesPath?: string;
16
+ /** Volume name for persistence (will be created if not exists) */
17
+ volumeName?: string;
18
+ /** Mount path for the volume (default: /sandagent) */
19
+ volumeMountPath?: string;
20
+ /**
21
+ * Auto-stop interval in minutes (0 means disabled).
22
+ * Default is 15 minutes.
23
+ * The sandbox will automatically stop after being idle for this duration.
24
+ */
25
+ autoStopInterval?: number;
26
+ /**
27
+ * Auto-delete interval in minutes.
28
+ * - Negative value: disabled (default)
29
+ * - 0: delete immediately upon stopping
30
+ * - Positive value: delete after being stopped for this many minutes
31
+ */
32
+ autoDeleteInterval?: number;
33
+ /**
34
+ * Sandbox name for reuse.
35
+ * If provided, will try to get existing sandbox by name first.
36
+ * If not found, creates a new sandbox with this name.
37
+ * If not provided, a new sandbox is always created (without a name).
38
+ */
39
+ name?: string;
40
+ /**
41
+ * Daytona snapshot name to use.
42
+ * If provided, uses a custom snapshot with pre-installed dependencies.
43
+ * This skips npm install for claude-agent-sdk and runner-cli.
44
+ * Create snapshot: daytona snapshot push sandagent-base:0.1.0 --name sandagent-base
45
+ */
46
+ snapshot?: string;
47
+ /**
48
+ * Environment variables to set in the sandbox.
49
+ * These will be available to all commands executed in the sandbox.
50
+ */
51
+ env?: Record<string, string>;
52
+ /**
53
+ * Agent template to use (e.g., "default", "coder", "analyst", "researcher").
54
+ *
55
+ * @default 'default'
56
+ */
57
+ agentTemplate?: string;
58
+ /**
59
+ * Working directory for the agent inside the sandbox.
60
+ * Will be created if it doesn't exist.
61
+ *
62
+ * @default '/workspace'
63
+ */
64
+ workdir?: string;
65
+ }
66
+ /**
67
+ * Daytona-based sandbox implementation.
68
+ *
69
+ * This adapter supports sandbox reuse based on sandbox name.
70
+ * When a name is provided, it will attempt to get an existing sandbox
71
+ * by that name first. If not found, creates a new sandbox with that name.
72
+ * If no name is provided, a new sandbox is always created.
73
+ */
74
+ export declare class DaytonaSandbox implements SandboxAdapter {
75
+ private readonly apiKey?;
76
+ private readonly apiUrl?;
77
+ private readonly timeout;
78
+ private readonly runnerBundlePath?;
79
+ private readonly templatesPath?;
80
+ private readonly volumeName?;
81
+ private readonly volumeMountPath;
82
+ private readonly autoStopInterval;
83
+ private readonly autoDeleteInterval;
84
+ private readonly name?;
85
+ private readonly snapshot?;
86
+ private readonly env;
87
+ private readonly agentTemplate;
88
+ private readonly workdir;
89
+ /** Current handle for the sandbox instance */
90
+ private currentHandle;
91
+ constructor(options?: DaytonaSandboxOptions);
92
+ /**
93
+ * Get the environment variables configured for this sandbox.
94
+ */
95
+ getEnv(): Record<string, string>;
96
+ /**
97
+ * Get the agent template configured for this sandbox.
98
+ */
99
+ getAgentTemplate(): string;
100
+ /**
101
+ * Get the working directory configured for this sandbox.
102
+ */
103
+ getWorkdir(): string;
104
+ /**
105
+ * Get the runner command to execute in the sandbox.
106
+ * Returns different commands based on whether a local bundle or npm package is used.
107
+ */
108
+ getRunnerCommand(): string[];
109
+ getHandle(): SandboxHandle | null;
110
+ attach(): Promise<SandboxHandle>;
111
+ /**
112
+ * Create a new sandbox with the configured settings
113
+ */
114
+ private createNewSandbox;
115
+ private initializeSandbox;
116
+ private collectFiles;
117
+ }
118
+ //# sourceMappingURL=daytona-sandbox.d.ts.map
@@ -0,0 +1 @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AAa,CAAC,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAC5C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAyB;IAC7C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC,8CAA8C;IAC9C,OAAO,CAAC,aAAa,CAA8B;gBAEvC,OAAO,GAAE,qBAA0B;IAmB/C;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIhC;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;;OAGG;IACH,gBAAgB,IAAI,MAAM,EAAE;IAa5B,SAAS,IAAI,aAAa,GAAG,IAAI;IAI3B,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC;IAiLtC;;OAEG;YACW,gBAAgB;YA0ChB,iBAAiB;IAmG/B,OAAO,CAAC,YAAY;CA0BrB"}
@@ -0,0 +1,563 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import { Daytona } from "@daytonaio/sdk";
4
+ /**
5
+ * Daytona-based sandbox implementation.
6
+ *
7
+ * This adapter supports sandbox reuse based on sandbox name.
8
+ * When a name is provided, it will attempt to get an existing sandbox
9
+ * by that name first. If not found, creates a new sandbox with that name.
10
+ * If no name is provided, a new sandbox is always created.
11
+ */
12
+ export class DaytonaSandbox {
13
+ apiKey;
14
+ apiUrl;
15
+ timeout;
16
+ runnerBundlePath;
17
+ templatesPath;
18
+ volumeName;
19
+ volumeMountPath;
20
+ autoStopInterval;
21
+ autoDeleteInterval;
22
+ name;
23
+ snapshot;
24
+ env;
25
+ agentTemplate;
26
+ workdir;
27
+ /** Current handle for the sandbox instance */
28
+ currentHandle = null;
29
+ constructor(options = {}) {
30
+ this.apiKey = options.apiKey ?? process.env.DAYTONA_API_KEY;
31
+ this.apiUrl = options.apiUrl ?? process.env.DAYTONA_API_URL;
32
+ this.timeout = options.timeout ?? 0;
33
+ this.runnerBundlePath = options.runnerBundlePath;
34
+ this.templatesPath = options.templatesPath;
35
+ this.volumeName = options.volumeName;
36
+ this.volumeMountPath = options.volumeMountPath ?? "/sandagent";
37
+ // Default auto-stop to 15 minutes
38
+ this.autoStopInterval = options.autoStopInterval ?? 15;
39
+ // Default auto-delete to disabled (-1),
40
+ this.autoDeleteInterval = options.autoDeleteInterval ?? 0;
41
+ this.name = options.name;
42
+ this.snapshot = options.snapshot;
43
+ this.env = options.env ?? {};
44
+ this.agentTemplate = options.agentTemplate ?? "default";
45
+ this.workdir = options.workdir ?? "/workspace";
46
+ }
47
+ /**
48
+ * Get the environment variables configured for this sandbox.
49
+ */
50
+ getEnv() {
51
+ return this.env;
52
+ }
53
+ /**
54
+ * Get the agent template configured for this sandbox.
55
+ */
56
+ getAgentTemplate() {
57
+ return this.agentTemplate;
58
+ }
59
+ /**
60
+ * Get the working directory configured for this sandbox.
61
+ */
62
+ getWorkdir() {
63
+ return this.workdir;
64
+ }
65
+ /**
66
+ * Get the runner command to execute in the sandbox.
67
+ * Returns different commands based on whether a local bundle or npm package is used.
68
+ */
69
+ getRunnerCommand() {
70
+ if (this.runnerBundlePath && fs.existsSync(this.runnerBundlePath)) {
71
+ // Local bundle is uploaded to ${workdir}/runner/bundle.mjs
72
+ return ["node", `${this.workdir}/runner/bundle.mjs`, "run"];
73
+ }
74
+ if (this.snapshot) {
75
+ // Snapshot has sandagent as system command in /usr/local/bin
76
+ return ["sandagent", "run"];
77
+ }
78
+ // npm installed runner-cli in workspace
79
+ return [`${this.workdir}/node_modules/.bin/sandagent`, "run"];
80
+ }
81
+ getHandle() {
82
+ return this.currentHandle;
83
+ }
84
+ async attach() {
85
+ if (!this.apiKey) {
86
+ throw new Error("Daytona API key not found. Please set DAYTONA_API_KEY environment variable or pass apiKey option.");
87
+ }
88
+ // Return existing handle if already attached
89
+ if (this.currentHandle) {
90
+ return this.currentHandle;
91
+ }
92
+ const daytona = new Daytona({
93
+ apiKey: this.apiKey,
94
+ apiUrl: this.apiUrl,
95
+ });
96
+ // Use this.name if provided
97
+ const sandboxName = this.name;
98
+ console.log(`[Daytona] Attaching sandbox with name: ${sandboxName}`);
99
+ // Get or create volume if volumeName is provided
100
+ let volumes;
101
+ if (this.volumeName) {
102
+ console.log(`[Daytona] Getting/creating volume: ${this.volumeName}`);
103
+ let volume = await daytona.volume.get(this.volumeName, true);
104
+ // Wait for volume to be ready
105
+ const maxWaitMs = 30000;
106
+ const startTime = Date.now();
107
+ while (volume.state !== "ready" && Date.now() - startTime < maxWaitMs) {
108
+ console.log(`[Daytona] Volume state: ${volume.state}, waiting...`);
109
+ await new Promise((resolve) => setTimeout(resolve, 1000));
110
+ volume = await daytona.volume.get(this.volumeName, false);
111
+ }
112
+ if (volume.state !== "ready") {
113
+ throw new Error(`Volume '${this.volumeName}' failed to become ready. State: ${volume.state}`);
114
+ }
115
+ volumes = [{ volumeId: volume.id, mountPath: this.volumeMountPath }];
116
+ console.log(`[Daytona] Using volume ${volume.id} at ${this.volumeMountPath}`);
117
+ }
118
+ let sandbox;
119
+ let needsInit = false;
120
+ // Try to get existing sandbox by name
121
+ if (sandboxName) {
122
+ console.log(`[Daytona] Looking for existing sandbox with name: ${sandboxName}`);
123
+ try {
124
+ const existingSandbox = await daytona.get(sandboxName);
125
+ console.log(`[Daytona] Found existing sandbox: ${existingSandbox.id}, state: ${existingSandbox.state}`);
126
+ // Handle different sandbox states
127
+ if (existingSandbox.state === "started") {
128
+ // Sandbox is ready to use
129
+ console.log(`[Daytona] Reusing running sandbox: ${existingSandbox.id}`);
130
+ sandbox = existingSandbox;
131
+ // Refresh activity to prevent auto-stop
132
+ await sandbox.refreshActivity();
133
+ }
134
+ else if (existingSandbox.state === "stopped" ||
135
+ existingSandbox.state === "stopping") {
136
+ // Sandbox needs to be started
137
+ console.log(`[Daytona] Starting stopped sandbox: ${existingSandbox.id}`);
138
+ await existingSandbox.start(this.timeout);
139
+ sandbox = existingSandbox;
140
+ }
141
+ else if (existingSandbox.state === "archived") {
142
+ // Archived sandbox - start it (Daytona will unarchive automatically)
143
+ console.log(`[Daytona] Starting archived sandbox: ${existingSandbox.id}`);
144
+ await existingSandbox.start(this.timeout);
145
+ sandbox = existingSandbox;
146
+ }
147
+ else if (existingSandbox.state === "error") {
148
+ // Error state - check if recoverable
149
+ if (existingSandbox.recoverable) {
150
+ console.log(`[Daytona] Recovering sandbox from error: ${existingSandbox.id}`);
151
+ await existingSandbox.recover(this.timeout);
152
+ sandbox = existingSandbox;
153
+ }
154
+ else {
155
+ // Non-recoverable error - delete and create new
156
+ console.log(`[Daytona] Deleting non-recoverable sandbox: ${existingSandbox.id}`);
157
+ await existingSandbox.delete();
158
+ sandbox = await this.createNewSandbox(daytona, volumes, sandboxName);
159
+ needsInit = true;
160
+ }
161
+ }
162
+ else if (existingSandbox.state === "starting") {
163
+ // Wait for it to finish starting
164
+ console.log(`[Daytona] Waiting for sandbox to start: ${existingSandbox.id}`);
165
+ await existingSandbox.waitUntilStarted(this.timeout);
166
+ sandbox = existingSandbox;
167
+ }
168
+ else {
169
+ // Unknown state - create new sandbox
170
+ console.log(`[Daytona] Unknown sandbox state: ${existingSandbox.state}, creating new sandbox`);
171
+ sandbox = await this.createNewSandbox(daytona, volumes, sandboxName);
172
+ needsInit = true;
173
+ }
174
+ // If sandbox exists, it's already initialized (files are in volume)
175
+ // Only initialize if we're creating a new sandbox
176
+ }
177
+ catch (error) {
178
+ // get() throws if not found, create new sandbox with the name
179
+ console.log(`[Daytona] Sandbox "${sandboxName}" not found, creating new one`);
180
+ sandbox = await this.createNewSandbox(daytona, volumes, sandboxName);
181
+ needsInit = true;
182
+ }
183
+ }
184
+ else {
185
+ // No name provided - always create new sandbox
186
+ console.log(`[Daytona] No name provided, creating new sandbox`);
187
+ sandbox = await this.createNewSandbox(daytona, volumes, sandboxName);
188
+ needsInit = true;
189
+ }
190
+ console.log(`[Daytona] Sandbox ${sandbox.id} ready`);
191
+ const handle = new DaytonaHandle(sandbox, this.env, this.workdir);
192
+ // Initialize sandbox if needed (upload files, install dependencies)
193
+ // Files are stored in volume, so existing sandboxes don't need re-initialization
194
+ if (needsInit) {
195
+ await this.initializeSandbox(handle);
196
+ }
197
+ else if (this.snapshot) {
198
+ // For existing sandbox with snapshot, copy template files from /opt/sandagent/templates
199
+ console.log(`[Daytona] Copying template files from snapshot for existing sandbox`);
200
+ await handle.runCommand(`if [ -d "/opt/sandagent/templates" ]; then ` +
201
+ `cp -r /opt/sandagent/templates/. ${this.workdir}/ 2>/dev/null && ` +
202
+ `echo "Template files copied"; ` +
203
+ `fi`);
204
+ }
205
+ // Upload template files if templatesPath is provided (overrides snapshot templates)
206
+ if (this.templatesPath && fs.existsSync(this.templatesPath)) {
207
+ const templateFiles = this.collectFiles(this.templatesPath, "");
208
+ console.log(`[Daytona] Uploading ${templateFiles.length} template files to ${this.workdir}`);
209
+ await handle.upload(templateFiles, this.workdir);
210
+ }
211
+ // Store the handle
212
+ this.currentHandle = handle;
213
+ return handle;
214
+ }
215
+ /**
216
+ * Create a new sandbox with the configured settings
217
+ */
218
+ async createNewSandbox(daytona, volumes, name) {
219
+ // Use provided name parameter, fallback to this.name
220
+ const sandboxName = name || this.name;
221
+ console.log(`[Daytona] Creating new sandbox${sandboxName ? ` with name "${sandboxName}"` : ""}${this.snapshot ? `, snapshot="${this.snapshot}"` : ""}, autoStopInterval=${this.autoStopInterval}min, autoDeleteInterval=${this.autoDeleteInterval}min`);
222
+ const createParams = {
223
+ name: sandboxName,
224
+ language: "typescript",
225
+ volumes,
226
+ envVars: this.env,
227
+ autoStopInterval: this.autoStopInterval,
228
+ autoDeleteInterval: this.autoDeleteInterval,
229
+ };
230
+ // Use custom snapshot if provided (pre-installed dependencies)
231
+ if (this.snapshot) {
232
+ createParams.snapshot = this.snapshot;
233
+ }
234
+ const sandbox = await daytona.create(createParams, {
235
+ timeout: this.timeout,
236
+ });
237
+ await sandbox.start();
238
+ console.log(`[Daytona] Sandbox ${sandbox.id} created and started`);
239
+ return sandbox;
240
+ }
241
+ async initializeSandbox(handle) {
242
+ // Step 0: Create workspace directory
243
+ console.log(`[Daytona] Creating workspace directory: ${this.workdir}`);
244
+ const mkdirResult = await handle.runCommand(`mkdir -p ${this.workdir}`);
245
+ if (mkdirResult.exitCode !== 0) {
246
+ console.log(`[Daytona] mkdir warning: ${mkdirResult.stderr}`);
247
+ }
248
+ // If using custom snapshot with pre-installed dependencies - no npm install needed
249
+ if (this.snapshot) {
250
+ console.log(`[Daytona] Using custom snapshot "${this.snapshot}", dependencies are in /opt/sandagent`);
251
+ // Copy template files from /opt/sandagent/templates to workspace (if exists in snapshot)
252
+ // Use "." to include hidden files like .claude
253
+ const copyTemplateResult = await handle.runCommand(`if [ -d "/opt/sandagent/templates" ]; then ` +
254
+ `cp -r /opt/sandagent/templates/. ${this.workdir}/ 2>/dev/null && ` +
255
+ `echo "Template files copied from snapshot"; ` +
256
+ `fi`);
257
+ if (copyTemplateResult.stdout) {
258
+ console.log(`[Daytona] ${copyTemplateResult.stdout.trim()}`);
259
+ }
260
+ }
261
+ else {
262
+ // Step 1: Install claude-agent-sdk to workspace
263
+ console.log(`[Daytona] Installing @anthropic-ai/claude-agent-sdk to ${this.workdir}`);
264
+ const sdkInstallResult = await handle.runCommand(`cd ${this.workdir} && npm install --no-audit --no-fund --prefer-offline @anthropic-ai/claude-agent-sdk 2>&1`, 10 * 60);
265
+ if (sdkInstallResult.exitCode !== 0) {
266
+ console.error(`[Daytona] Failed to install claude-agent-sdk (exit ${sdkInstallResult.exitCode}): ${sdkInstallResult.stdout}`);
267
+ throw new Error(`Failed to install @anthropic-ai/claude-agent-sdk: ${sdkInstallResult.stdout}`);
268
+ }
269
+ }
270
+ // Step 2: Setup runner - either upload local bundle, use snapshot, or install from npm
271
+ if (this.runnerBundlePath && fs.existsSync(this.runnerBundlePath)) {
272
+ // Option A: Upload local runner bundle to workspace
273
+ const bundleContent = fs.readFileSync(this.runnerBundlePath);
274
+ const bundleFileName = path.basename(this.runnerBundlePath);
275
+ const runnerFiles = [
276
+ {
277
+ path: `runner/${bundleFileName}`,
278
+ content: bundleContent,
279
+ },
280
+ ];
281
+ console.log(`[Daytona] Uploading runner bundle (${bundleFileName}) to ${this.workdir}`);
282
+ await handle.upload(runnerFiles, this.workdir);
283
+ console.log(`[Daytona] Runner bundle uploaded`);
284
+ }
285
+ else if (this.snapshot) {
286
+ // Option B: Using custom snapshot - runner-cli is pre-installed
287
+ console.log(`[Daytona] Using pre-installed runner-cli from snapshot`);
288
+ }
289
+ else {
290
+ // Option C: Install runner-cli to workspace from npm
291
+ console.log(`[Daytona] No runnerBundlePath provided, installing @sandagent/runner-cli to ${this.workdir}`);
292
+ const installResult = await handle.runCommand(`cd ${this.workdir} && npm install --no-audit --no-fund --prefer-offline @sandagent/runner-cli@beta 2>&1`, 10 * 60);
293
+ if (installResult.exitCode !== 0) {
294
+ console.error(`[Daytona] Failed to install runner-cli (exit ${installResult.exitCode}): ${installResult.stdout}`);
295
+ throw new Error(`Failed to install @sandagent/runner-cli: ${installResult.stdout}`);
296
+ }
297
+ console.log(`[Daytona] Successfully installed @sandagent/runner-cli to ${this.workdir}`);
298
+ }
299
+ // Upload template to workdir (where runner will execute)
300
+ if (this.templatesPath && fs.existsSync(this.templatesPath)) {
301
+ const templateFiles = this.collectFiles(this.templatesPath, "");
302
+ console.log(`[Daytona] Uploading ${templateFiles.length} template files to ${this.workdir}`);
303
+ await handle.upload(templateFiles, this.workdir);
304
+ }
305
+ else if (this.templatesPath) {
306
+ console.warn(`[Daytona] Template path specified but not found: ${this.templatesPath}`);
307
+ }
308
+ }
309
+ collectFiles(dir, prefix) {
310
+ const files = [];
311
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
312
+ for (const entry of entries) {
313
+ const fullPath = path.join(dir, entry.name);
314
+ const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
315
+ if (entry.isDirectory()) {
316
+ if (entry.name === "node_modules" || entry.name === ".git") {
317
+ continue;
318
+ }
319
+ files.push(...this.collectFiles(fullPath, relativePath));
320
+ }
321
+ else if (entry.isFile()) {
322
+ files.push({
323
+ path: relativePath,
324
+ content: fs.readFileSync(fullPath),
325
+ });
326
+ }
327
+ }
328
+ return files;
329
+ }
330
+ }
331
+ /**
332
+ * Handle for an active Daytona sandbox
333
+ */
334
+ class DaytonaHandle {
335
+ sandbox;
336
+ sandboxEnv;
337
+ workdir;
338
+ constructor(sandbox, sandboxEnv = {}, workdir = "/workspace") {
339
+ this.sandbox = sandbox;
340
+ this.sandboxEnv = sandboxEnv;
341
+ this.workdir = workdir;
342
+ }
343
+ /**
344
+ * Get the sandbox ID (useful for external tracking)
345
+ */
346
+ getSandboxId() {
347
+ return this.sandbox.id;
348
+ }
349
+ /**
350
+ * Escape a string for safe use in shell commands
351
+ * Uses single quotes and escapes any single quotes within the string
352
+ */
353
+ shellEscape(arg) {
354
+ // If the argument contains no special characters, return as-is
355
+ if (/^[a-zA-Z0-9._\-\/=]+$/.test(arg)) {
356
+ return arg;
357
+ }
358
+ // Wrap in single quotes and escape any single quotes within
359
+ // Replace ' with '\'' (end quote, escaped quote, start quote)
360
+ return `'${arg.replace(/'/g, "'\\''")}'`;
361
+ }
362
+ /**
363
+ * Build a shell-safe command string from an array of arguments
364
+ */
365
+ buildShellCommand(command) {
366
+ return command.map((arg) => this.shellEscape(arg)).join(" ");
367
+ }
368
+ /**
369
+ * Run a command and wait for completion (used internally)
370
+ * Uses session-based execution to avoid executeCommand hanging issues
371
+ * @param cmd - Command to execute
372
+ * @param timeoutSec - Timeout in seconds (default: 300 = 5 minutes for npm installs)
373
+ */
374
+ async runCommand(cmd, timeoutSec = 300) {
375
+ console.log(`[Daytona] runCommand: ${cmd}`);
376
+ const sessionId = `init-${Date.now()}-${Math.random().toString(36).substring(7)}`;
377
+ try {
378
+ // Create a session for this command
379
+ await this.sandbox.process.createSession(sessionId);
380
+ // Execute command in session
381
+ const response = await this.sandbox.process.executeSessionCommand(sessionId, { command: cmd }, timeoutSec);
382
+ console.log(`[Daytona] runCommand completed: exit=${response.exitCode}`);
383
+ return {
384
+ exitCode: response.exitCode ?? 0,
385
+ stdout: response.stdout || response.output || "",
386
+ stderr: response.stderr || "",
387
+ };
388
+ }
389
+ finally {
390
+ // Clean up session
391
+ try {
392
+ await this.sandbox.process.deleteSession(sessionId);
393
+ }
394
+ catch {
395
+ // Ignore cleanup errors
396
+ }
397
+ }
398
+ }
399
+ exec(command, opts) {
400
+ const sandbox = this.sandbox;
401
+ const signal = opts?.signal;
402
+ // Merge sandbox-level env with call-level env (call-level takes precedence)
403
+ // Add NODE_PATH so Node can find packages installed in workspace
404
+ // Add PATH so shell can find sandagent command
405
+ const envWithNodePath = {
406
+ ...this.sandboxEnv,
407
+ ...opts?.env,
408
+ NODE_PATH: `${this.workdir}/node_modules`,
409
+ PATH: `${this.workdir}/node_modules/.bin:/usr/local/bin:/usr/bin:/bin`,
410
+ };
411
+ // Build environment exports for shell
412
+ const envExports = Object.entries(envWithNodePath)
413
+ .filter(([key]) => key === "NODE_PATH" || key === "PATH")
414
+ .map(([k, v]) => `export ${k}='${v.replace(/'/g, "'\\''")}'`)
415
+ .join("; ");
416
+ // Build shell-safe command string with proper escaping
417
+ const baseCommand = this.buildShellCommand(command);
418
+ const shellCommand = `${envExports}; ${baseCommand}`;
419
+ // Debug: log environment variables being passed to sandbox
420
+ console.log("[Daytona] Executing command:", shellCommand);
421
+ console.log("[Daytona] Environment variables:", Object.keys(envWithNodePath));
422
+ console.log("[Daytona] ANTHROPIC_API_KEY present:", !!envWithNodePath.ANTHROPIC_API_KEY);
423
+ if (envWithNodePath.ANTHROPIC_API_KEY) {
424
+ console.log("[Daytona] ANTHROPIC_API_KEY prefix:", envWithNodePath.ANTHROPIC_API_KEY.substring(0, 10) + "...");
425
+ }
426
+ const sessionId = `session-${Date.now()}-${Math.random().toString(36).substring(7)}`;
427
+ console.log("[Daytona] Session ID:", sessionId);
428
+ return {
429
+ [Symbol.asyncIterator]() {
430
+ const chunks = [];
431
+ let finished = false;
432
+ let error = null;
433
+ let resolveNext = null;
434
+ // Monitor abort signal and kill the session
435
+ const abortHandler = async () => {
436
+ console.log("[Daytona] Abort signal received, terminating session...");
437
+ console.log("[Daytona] Session ID:", sessionId);
438
+ finished = true;
439
+ error = new Error("Operation aborted");
440
+ error.name = "AbortError";
441
+ // Kill the session directly
442
+ try {
443
+ await sandbox.process.deleteSession(sessionId);
444
+ console.log("[Daytona] Session deleted successfully");
445
+ }
446
+ catch (err) {
447
+ console.error("[Daytona] Failed to delete session:", err);
448
+ }
449
+ if (resolveNext) {
450
+ resolveNext();
451
+ resolveNext = null;
452
+ }
453
+ };
454
+ if (signal) {
455
+ console.log("[Daytona] Adding abort signal listener");
456
+ signal.addEventListener("abort", abortHandler);
457
+ }
458
+ else {
459
+ console.log("[Daytona] No signal provided");
460
+ }
461
+ // Start async execution
462
+ (async () => {
463
+ try {
464
+ // Create session first
465
+ await sandbox.process.createSession(sessionId);
466
+ const result = await sandbox.process.executeSessionCommand(sessionId, { command: shellCommand, runAsync: true });
467
+ if (!result.cmdId) {
468
+ throw new Error("No command ID returned from async execution");
469
+ }
470
+ console.log("[Daytona] Command started, cmdId:", result.cmdId);
471
+ await sandbox.process.getSessionCommandLogs(sessionId, result.cmdId, (chunk) => {
472
+ console.log("[Daytona] stdout:", chunk);
473
+ chunks.push(new TextEncoder().encode(chunk));
474
+ if (resolveNext) {
475
+ resolveNext();
476
+ resolveNext = null;
477
+ }
478
+ }, (chunk) => {
479
+ console.log("[Daytona] stderr:", chunk);
480
+ });
481
+ console.log("[Daytona] Command completed");
482
+ finished = true;
483
+ if (resolveNext) {
484
+ resolveNext();
485
+ resolveNext = null;
486
+ }
487
+ }
488
+ catch (err) {
489
+ error = err instanceof Error ? err : new Error(String(err));
490
+ if (error.name === "AbortError") {
491
+ console.log("[Daytona] Command execution aborted by user");
492
+ }
493
+ else {
494
+ console.error("[Daytona] Command execution error:", error.message);
495
+ }
496
+ if (resolveNext) {
497
+ resolveNext();
498
+ resolveNext = null;
499
+ }
500
+ }
501
+ finally {
502
+ // Cleanup session
503
+ sandbox.process.deleteSession(sessionId).catch(() => {
504
+ // Ignore cleanup errors
505
+ });
506
+ // Remove event listener when iterator completes
507
+ if (signal) {
508
+ signal.removeEventListener("abort", abortHandler);
509
+ }
510
+ }
511
+ })();
512
+ return {
513
+ async next() {
514
+ while (true) {
515
+ // Check if signal is aborted and no more chunks
516
+ if (signal?.aborted && chunks.length === 0) {
517
+ console.log("[Daytona] Signal aborted, stopping iteration");
518
+ return { value: undefined, done: true };
519
+ }
520
+ if (chunks.length > 0) {
521
+ return { value: chunks.shift(), done: false };
522
+ }
523
+ if (finished) {
524
+ return { value: undefined, done: true };
525
+ }
526
+ if (error) {
527
+ throw error;
528
+ }
529
+ // Wait for next chunk
530
+ await new Promise((resolve) => {
531
+ resolveNext = resolve;
532
+ });
533
+ }
534
+ },
535
+ };
536
+ },
537
+ };
538
+ }
539
+ async upload(files, targetDir) {
540
+ // Batch upload all files
541
+ const filesToUpload = files.map((file) => ({
542
+ source: file.content instanceof Uint8Array
543
+ ? Buffer.from(file.content)
544
+ : Buffer.from(file.content, "utf-8"),
545
+ destination: `${targetDir}/${file.path}`,
546
+ }));
547
+ // Use longer timeout (300s) for large file uploads
548
+ await this.sandbox.fs.uploadFiles(filesToUpload, 300);
549
+ }
550
+ async readFile(filePath) {
551
+ // Use runCommand helper which returns { stdout, stderr, exitCode }
552
+ const result = await this.runCommand(`cat ${filePath}`);
553
+ if (result.exitCode !== 0) {
554
+ throw new Error(`Failed to read file ${filePath}: ${result.stderr || result.stdout}`);
555
+ }
556
+ return result.stdout;
557
+ }
558
+ async destroy() {
559
+ // Daytona sandbox lifecycle is managed by the platform, no manual cleanup needed
560
+ // The sandbox will auto-stop and auto-delete based on configured intervals
561
+ }
562
+ }
563
+ //# sourceMappingURL=daytona-sandbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daytona-sandbox.js","sourceRoot":"","sources":["../src/daytona-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,OAAO,EAAkC,MAAM,gBAAgB,CAAC;AAiFzE;;;;;;;GAOG;AACH,MAAM,OAAO,cAAc;IACR,MAAM,CAAU;IAChB,MAAM,CAAU;IAChB,OAAO,CAAS;IAChB,gBAAgB,CAAU;IAC1B,aAAa,CAAU;IACvB,UAAU,CAAU;IACpB,eAAe,CAAS;IACxB,gBAAgB,CAAS;IACzB,kBAAkB,CAAS;IAC3B,IAAI,CAAU;IACd,QAAQ,CAAU;IAClB,GAAG,CAAyB;IAC5B,aAAa,CAAS;IACtB,OAAO,CAAS;IAEjC,8CAA8C;IACtC,aAAa,GAAyB,IAAI,CAAC;IAEnD,YAAY,UAAiC,EAAE;QAC7C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC5D,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC5D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,C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CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC;YACxC,WAAW,EAAE,GAAG,SAAS,IAAI,IAAI,CAAC,IAAI,EAAE;SACzC,CAAC,CAAC,CAAC;QAEJ,mDAAmD;QACnD,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,WAAW,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,QAAgB;QAC7B,mEAAmE;QACnE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,QAAQ,EAAE,CAAC,CAAC;QACxD,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CACb,uBAAuB,QAAQ,KAAK,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CACrE,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,iFAAiF;QACjF,2EAA2E;IAC7E,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export { DaytonaSandbox, type DaytonaSandboxOptions, } from "./daytona-sandbox.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { DaytonaSandbox, } from "./daytona-sandbox.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAEf,MAAM,sBAAsB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@sandagent/sandbox-daytona",
3
+ "version": "0.1.0-beta.0",
4
+ "description": "Daytona sandbox adapter for SandAgent",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": ["dist"],
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "dev": "tsc --watch",
19
+ "clean": "rm -rf dist",
20
+ "typecheck": "tsc --noEmit",
21
+ "lint": "echo 'no lint configured'",
22
+ "test": "vitest run --passWithNoTests"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/vikadata/sandagent.git",
27
+ "directory": "packages/sandbox-daytona"
28
+ },
29
+ "license": "Apache-2.0",
30
+ "dependencies": {
31
+ "@sandagent/manager": "workspace:*",
32
+ "@daytonaio/sdk": "^0.130.0"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^20.10.0",
36
+ "typescript": "^5.3.0",
37
+ "vitest": "^1.6.1"
38
+ }
39
+ }