@mastra/e2b 0.11.0-alpha.5 → 0.11.0-alpha.6
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 +22 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -8
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -127,7 +127,7 @@ function validatePrefix(prefix) {
|
|
|
127
127
|
* Arguments containing only safe characters are returned as-is.
|
|
128
128
|
* All others are wrapped in single quotes with embedded single quotes escaped.
|
|
129
129
|
*/
|
|
130
|
-
function shellQuote(arg) {
|
|
130
|
+
function shellQuote$1(arg) {
|
|
131
131
|
if (/^[a-zA-Z0-9._\-/@:=]+$/.test(arg)) return arg;
|
|
132
132
|
return "'" + arg.replace(/'/g, "'\\''") + "'";
|
|
133
133
|
}
|
|
@@ -192,7 +192,7 @@ Error details: ${installResult.stderr || installResult.stdout}`);
|
|
|
192
192
|
const normalizedPrefix = validatePrefix(config.prefix);
|
|
193
193
|
bucketArg = `${config.bucket}:/${normalizedPrefix}`;
|
|
194
194
|
}
|
|
195
|
-
const mountCmd = `sudo s3fs ${shellQuote(bucketArg)} ${shellQuote(mountPath)} -o ${mountOptions.join(" -o ")}`;
|
|
195
|
+
const mountCmd = `sudo s3fs ${shellQuote$1(bucketArg)} ${shellQuote$1(mountPath)} -o ${mountOptions.join(" -o ")}`;
|
|
196
196
|
logger.debug(`${LOG_PREFIX} Mounting S3:`, hasCredentials ? mountCmd.replace(credentialsPath, "***") : mountCmd);
|
|
197
197
|
try {
|
|
198
198
|
const result = await sandbox.commands.run(mountCmd, { timeoutMs: 6e4 });
|
|
@@ -213,7 +213,7 @@ Error details: ${installResult.stderr || installResult.stdout}`);
|
|
|
213
213
|
});
|
|
214
214
|
throw new Error(`Failed to mount S3 bucket: ${stderr || stdout || error}`);
|
|
215
215
|
}
|
|
216
|
-
if ((await sandbox.commands.run(`mountpoint -q ${shellQuote(mountPath)}`)).exitCode !== 0) throw new Error(`s3fs returned exit 0 but ${mountPath} is not a mountpoint. The s3fs daemon likely failed during FUSE init (common causes: region mismatch, invalid credentials, or an S3-compatible endpoint that rejects the signature). Re-run inside the sandbox with '-f -o dbglevel=info' to see the underlying error.`);
|
|
216
|
+
if ((await sandbox.commands.run(`mountpoint -q ${shellQuote$1(mountPath)}`)).exitCode !== 0) throw new Error(`s3fs returned exit 0 but ${mountPath} is not a mountpoint. The s3fs daemon likely failed during FUSE init (common causes: region mismatch, invalid credentials, or an S3-compatible endpoint that rejects the signature). Re-run inside the sandbox with '-f -o dbglevel=info' to see the underlying error.`);
|
|
217
217
|
}
|
|
218
218
|
//#endregion
|
|
219
219
|
//#region src/sandbox/mounts/gcs.ts
|
|
@@ -233,7 +233,7 @@ async function mountGCS(mountPath, config, ctx) {
|
|
|
233
233
|
}
|
|
234
234
|
const [uid, gid] = (await sandbox.commands.run("id -u && id -g")).stdout.trim().split("\n");
|
|
235
235
|
const uidGidFlags = uid && gid ? `--uid=${uid} --gid=${gid}` : "";
|
|
236
|
-
const onlyDirFlag = config.prefix ? ` --only-dir=${shellQuote(validatePrefix(config.prefix))}` : "";
|
|
236
|
+
const onlyDirFlag = config.prefix ? ` --only-dir=${shellQuote$1(validatePrefix(config.prefix))}` : "";
|
|
237
237
|
const hasCredentials = !!config.serviceAccountKey;
|
|
238
238
|
let mountCmd;
|
|
239
239
|
if (hasCredentials) {
|
|
@@ -441,9 +441,9 @@ Error details: ${verifyResult.stderr || verifyResult.stdout || installResult?.st
|
|
|
441
441
|
await sandbox.commands.run(`sudo rm -f ${configPath}`);
|
|
442
442
|
await sandbox.files.write(configPath, yaml);
|
|
443
443
|
await sandbox.commands.run(`sudo chown root:root ${configPath} && sudo chmod 600 ${configPath}`);
|
|
444
|
-
await sandbox.commands.run(`sudo rm -rf ${shellQuote(cachePath)} && sudo mkdir -p ${shellQuote(cachePath)}`);
|
|
445
|
-
const prefixFlags = prefix ? ` --virtual-directory=true --subdirectory=${shellQuote(prefix)}` : "";
|
|
446
|
-
const mountCmd = `sudo blobfuse2 mount ${shellQuote(mountPath)} --config-file=${shellQuote(configPath)}${prefixFlags}`;
|
|
444
|
+
await sandbox.commands.run(`sudo rm -rf ${shellQuote$1(cachePath)} && sudo mkdir -p ${shellQuote$1(cachePath)}`);
|
|
445
|
+
const prefixFlags = prefix ? ` --virtual-directory=true --subdirectory=${shellQuote$1(prefix)}` : "";
|
|
446
|
+
const mountCmd = `sudo blobfuse2 mount ${shellQuote$1(mountPath)} --config-file=${shellQuote$1(configPath)}${prefixFlags}`;
|
|
447
447
|
logger.debug(`${LOG_PREFIX} Mounting Azure Blob:`, mountCmd);
|
|
448
448
|
try {
|
|
449
449
|
const result = await sandbox.commands.run(mountCmd, { timeoutMs: 6e4 });
|
|
@@ -1578,6 +1578,16 @@ function setupMarkerContent(setupCommand) {
|
|
|
1578
1578
|
function setupMarkerCommand(content) {
|
|
1579
1579
|
return `mkdir -p "$(dirname "${SETUP_MARKER_PATH}")" && printf '%s' '${content}' > "${SETUP_MARKER_PATH}"`;
|
|
1580
1580
|
}
|
|
1581
|
+
function repoCloneCommand({ cloneUrl, destination, branch, tokenEnv }) {
|
|
1582
|
+
return `git ${tokenEnv ? `${gitAuthFlag$1(tokenEnv)} ` : ""}clone --depth=1 --single-branch ${branch ? `--branch ${shellQuote(branch)} ` : ""}${shellQuote(cloneUrl)} ${shellQuote(destination)}`;
|
|
1583
|
+
}
|
|
1584
|
+
/** Per-invocation auth header; `-c` config never reaches `.git/config`. */
|
|
1585
|
+
function gitAuthFlag$1(tokenEnv) {
|
|
1586
|
+
return `-c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$${tokenEnv}" | base64 -w0)"`;
|
|
1587
|
+
}
|
|
1588
|
+
function shellQuote(value) {
|
|
1589
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
1590
|
+
}
|
|
1581
1591
|
//#endregion
|
|
1582
1592
|
//#region src/utils/repo-template.ts
|
|
1583
1593
|
/**
|
|
@@ -1796,7 +1806,11 @@ function buildRepoTemplateSpec(identity, token) {
|
|
|
1796
1806
|
const dir = trimTrailingSlashes(workingDirectory);
|
|
1797
1807
|
template = template.runCmd(`mkdir -p "${dir}"`).setWorkdir(dir);
|
|
1798
1808
|
}
|
|
1799
|
-
template = template.runCmd(
|
|
1809
|
+
template = template.runCmd(repoCloneCommand({
|
|
1810
|
+
cloneUrl,
|
|
1811
|
+
destination: repoDir,
|
|
1812
|
+
...token ? { tokenEnv: BUILD_TOKEN_ENV } : {}
|
|
1813
|
+
}));
|
|
1800
1814
|
if (sha) template = template.runCmd(`git -C "${repoDir}" ${auth}fetch origin ${sha}`).runCmd(`git -C "${repoDir}" checkout ${sha}`);
|
|
1801
1815
|
const setupCommands = normalizeSetupCommands(setupCommand);
|
|
1802
1816
|
for (const command of setupCommands) template = template.runCmd(`cd "${repoDir}" && ${command}`);
|