@mastra/e2b 0.12.1-alpha.2 → 0.12.2-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.js
CHANGED
|
@@ -1546,7 +1546,8 @@ var E2BSandbox = class E2BSandbox extends MastraSandbox {
|
|
|
1546
1546
|
* When the E2B sandbox times out or crashes mid-operation, this method
|
|
1547
1547
|
* resets sandbox state, restarts it, and retries the operation once.
|
|
1548
1548
|
*
|
|
1549
|
-
* @internal Used by E2BProcessManager
|
|
1549
|
+
* @internal Used by E2BProcessManager (spawn) and E2BCodeModeTransport (file setup)
|
|
1550
|
+
* to handle dead sandboxes.
|
|
1550
1551
|
*/
|
|
1551
1552
|
async retryOnDead(fn) {
|
|
1552
1553
|
try {
|
|
@@ -2046,7 +2047,7 @@ var E2BCodeModeTransport = class {
|
|
|
2046
2047
|
if (!(sandbox instanceof E2BSandbox)) throw new Error("E2BCodeModeTransport requires an E2BSandbox");
|
|
2047
2048
|
if (!sandbox.processes) throw new Error("Sandbox has no process manager");
|
|
2048
2049
|
if (sandbox.status !== "running") await sandbox.start();
|
|
2049
|
-
|
|
2050
|
+
let e2b = sandbox.e2b;
|
|
2050
2051
|
const externals = toolIds.map((toolId) => ({
|
|
2051
2052
|
toolId,
|
|
2052
2053
|
externalName: sanitizeToolId(toolId)
|
|
@@ -2083,9 +2084,12 @@ var E2BCodeModeTransport = class {
|
|
|
2083
2084
|
} catch {}
|
|
2084
2085
|
};
|
|
2085
2086
|
try {
|
|
2086
|
-
await
|
|
2087
|
-
|
|
2088
|
-
|
|
2087
|
+
await sandbox.retryOnDead(async () => {
|
|
2088
|
+
e2b = sandbox.e2b;
|
|
2089
|
+
await e2b.files.makeDir(dir);
|
|
2090
|
+
await e2b.files.write(programPath, programSource);
|
|
2091
|
+
await e2b.files.write(runnerPath, runnerSource);
|
|
2092
|
+
});
|
|
2089
2093
|
let handle;
|
|
2090
2094
|
const respond = async (id, ok, result, error) => {
|
|
2091
2095
|
await handle.sendStdin(JSON.stringify({
|