@mastra/daytona 0.11.3 → 0.11.4-alpha.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.
- package/dist/index.cjs +9 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -18
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { Daytona, DaytonaGoneError, DaytonaNotFoundError, SandboxState } from "@daytonaio/sdk";
|
|
2
2
|
import { MastraSandbox, ProcessHandle, SandboxNotReadyError, SandboxProcessManager, UnsupportedStdinCloseError, assertModesUnsupported } from "@mastra/core/workspace";
|
|
3
3
|
import { createHash } from "crypto";
|
|
4
|
-
|
|
4
|
+
// src/utils/compact.ts
|
|
5
5
|
/**
|
|
6
6
|
* Returns a shallow copy of the object with all undefined values removed.
|
|
7
7
|
*/
|
|
8
8
|
function compact(obj) {
|
|
9
9
|
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== void 0));
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
//#region src/utils/shell-quote.ts
|
|
11
|
+
// src/utils/shell-quote.ts
|
|
13
12
|
/**
|
|
14
13
|
* Shell-quote a single argument for safe use in a command string.
|
|
15
14
|
*
|
|
@@ -20,8 +19,7 @@ function shellQuote(arg) {
|
|
|
20
19
|
if (/^[a-zA-Z0-9._\-/@:=]+$/.test(arg)) return arg;
|
|
21
20
|
return "'" + arg.replace(/'/g, "'\\''") + "'";
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
//#region src/sandbox/mounts/types.ts
|
|
22
|
+
// src/sandbox/mounts/types.ts
|
|
25
23
|
const LOG_PREFIX = "[@mastra/daytona]";
|
|
26
24
|
const SAFE_S3_BUCKET_NAME = /^[a-z0-9][a-z0-9.\-]{1,61}[a-z0-9]$/;
|
|
27
25
|
const SAFE_GCS_BUCKET_NAME = /^[a-z0-9][a-z0-9._-]{1,61}[a-z0-9]$/;
|
|
@@ -75,8 +73,7 @@ async function runCommand(sandbox, command, options) {
|
|
|
75
73
|
output: result.result ?? ""
|
|
76
74
|
};
|
|
77
75
|
}
|
|
78
|
-
|
|
79
|
-
//#region src/sandbox/mounts/s3-credentials.ts
|
|
76
|
+
// src/sandbox/mounts/s3-credentials.ts
|
|
80
77
|
function s3CredentialsPrefix(mountPath) {
|
|
81
78
|
return `/tmp/.mastra-s3-${createHash("sha256").update(mountPath.replace(/\/$/, "")).digest("hex")}-`;
|
|
82
79
|
}
|
|
@@ -120,8 +117,7 @@ exit "$result"`;
|
|
|
120
117
|
ctx.logger.warn(`${LOG_PREFIX} Could not clean up S3 credentials`);
|
|
121
118
|
}
|
|
122
119
|
}
|
|
123
|
-
|
|
124
|
-
//#region src/sandbox/mounts/s3.ts
|
|
120
|
+
// src/sandbox/mounts/s3.ts
|
|
125
121
|
/**
|
|
126
122
|
* Mount an S3 bucket using s3fs-fuse.
|
|
127
123
|
*/
|
|
@@ -213,8 +209,7 @@ async function mountS3(mountPath, config, ctx) {
|
|
|
213
209
|
}
|
|
214
210
|
}
|
|
215
211
|
}
|
|
216
|
-
|
|
217
|
-
//#region src/sandbox/mounts/gcs.ts
|
|
212
|
+
// src/sandbox/mounts/gcs.ts
|
|
218
213
|
/**
|
|
219
214
|
* Mount a GCS bucket using gcsfuse.
|
|
220
215
|
*/
|
|
@@ -279,8 +274,7 @@ async function mountGCS(mountPath, config, ctx) {
|
|
|
279
274
|
});
|
|
280
275
|
if (result.exitCode !== 0) throw new Error(`Failed to mount GCS bucket: ${result.stderr || result.stdout}`);
|
|
281
276
|
}
|
|
282
|
-
|
|
283
|
-
//#region src/sandbox/mounts/azure.ts
|
|
277
|
+
// src/sandbox/mounts/azure.ts
|
|
284
278
|
const SAFE_CONTAINER_NAME = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/;
|
|
285
279
|
const BLOBFUSE2_GITHUB_DEB = "https://github.com/Azure/azure-storage-fuse/releases/download/blobfuse2-2.5.1/blobfuse2-2.5.1-Ubuntu-22.04.x86_64.deb";
|
|
286
280
|
function validateContainerName(name) {
|
|
@@ -474,8 +468,7 @@ async function mountAzure(mountPath, config, ctx) {
|
|
|
474
468
|
});
|
|
475
469
|
if (result.exitCode !== 0) throw new Error(`Failed to mount Azure Blob container: ${result.stderr || result.stdout}`);
|
|
476
470
|
}
|
|
477
|
-
|
|
478
|
-
//#region src/sandbox/process-manager.ts
|
|
471
|
+
// src/sandbox/process-manager.ts
|
|
479
472
|
/**
|
|
480
473
|
* Wraps a Daytona session + command pair to conform to Mastra's ProcessHandle.
|
|
481
474
|
* Not exported — internal to this module.
|
|
@@ -648,8 +641,7 @@ function buildSpawnCommand(command, cwd, envs) {
|
|
|
648
641
|
parts.push(`(${command})`);
|
|
649
642
|
return parts.join(" && ");
|
|
650
643
|
}
|
|
651
|
-
|
|
652
|
-
//#region src/sandbox/index.ts
|
|
644
|
+
// src/sandbox/index.ts
|
|
653
645
|
/**
|
|
654
646
|
* Daytona Sandbox Provider
|
|
655
647
|
*
|
|
@@ -1616,7 +1608,6 @@ var DaytonaSandbox = class DaytonaSandbox extends MastraSandbox {
|
|
|
1616
1608
|
}
|
|
1617
1609
|
}
|
|
1618
1610
|
};
|
|
1619
|
-
//#endregion
|
|
1620
1611
|
export { DaytonaProcessManager, DaytonaSandbox };
|
|
1621
1612
|
|
|
1622
1613
|
//# sourceMappingURL=index.js.map
|