@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.
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/code-mode/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAuB,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAQrG;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,oBAAqB,YAAW,iBAAiB;IACtD,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAiMpF;CACF"}
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/code-mode/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAuB,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAQrG;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,oBAAqB,YAAW,iBAAiB;IACtD,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAwMpF;CACF"}
package/dist/index.cjs CHANGED
@@ -1547,7 +1547,8 @@ var E2BSandbox = class E2BSandbox extends _mastra_core_workspace.MastraSandbox {
1547
1547
  * When the E2B sandbox times out or crashes mid-operation, this method
1548
1548
  * resets sandbox state, restarts it, and retries the operation once.
1549
1549
  *
1550
- * @internal Used by E2BProcessManager to handle dead sandboxes during spawn.
1550
+ * @internal Used by E2BProcessManager (spawn) and E2BCodeModeTransport (file setup)
1551
+ * to handle dead sandboxes.
1551
1552
  */
1552
1553
  async retryOnDead(fn) {
1553
1554
  try {
@@ -2047,7 +2048,7 @@ var E2BCodeModeTransport = class {
2047
2048
  if (!(sandbox instanceof E2BSandbox)) throw new Error("E2BCodeModeTransport requires an E2BSandbox");
2048
2049
  if (!sandbox.processes) throw new Error("Sandbox has no process manager");
2049
2050
  if (sandbox.status !== "running") await sandbox.start();
2050
- const e2b = sandbox.e2b;
2051
+ let e2b = sandbox.e2b;
2051
2052
  const externals = toolIds.map((toolId) => ({
2052
2053
  toolId,
2053
2054
  externalName: (0, _mastra_core_tools.sanitizeToolId)(toolId)
@@ -2084,9 +2085,12 @@ var E2BCodeModeTransport = class {
2084
2085
  } catch {}
2085
2086
  };
2086
2087
  try {
2087
- await e2b.files.makeDir(dir);
2088
- await e2b.files.write(programPath, programSource);
2089
- await e2b.files.write(runnerPath, runnerSource);
2088
+ await sandbox.retryOnDead(async () => {
2089
+ e2b = sandbox.e2b;
2090
+ await e2b.files.makeDir(dir);
2091
+ await e2b.files.write(programPath, programSource);
2092
+ await e2b.files.write(runnerPath, runnerSource);
2093
+ });
2090
2094
  let handle;
2091
2095
  const respond = async (id, ok, result, error) => {
2092
2096
  await handle.sendStdin(JSON.stringify({