@mastra/e2b 0.9.0-alpha.0 → 0.10.0-alpha.2
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/CHANGELOG.md +40 -0
- package/README.md +13 -0
- package/dist/index.cjs +9 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/sandbox/index.d.ts +14 -1
- package/dist/sandbox/index.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -651,6 +651,7 @@ var E2BSandbox = class E2BSandbox extends MastraSandbox {
|
|
|
651
651
|
env;
|
|
652
652
|
metadata;
|
|
653
653
|
network;
|
|
654
|
+
lifecycle;
|
|
654
655
|
connectionOpts;
|
|
655
656
|
_instructionsOverride;
|
|
656
657
|
_constructorOptions;
|
|
@@ -670,6 +671,7 @@ var E2BSandbox = class E2BSandbox extends MastraSandbox {
|
|
|
670
671
|
this.env = options.env ?? {};
|
|
671
672
|
this.metadata = options.metadata ?? {};
|
|
672
673
|
this.network = options.network;
|
|
674
|
+
this.lifecycle = options.lifecycle ?? { onTimeout: "pause" };
|
|
673
675
|
this.connectionOpts = {
|
|
674
676
|
...options.domain && { domain: options.domain },
|
|
675
677
|
...options.apiUrl && { apiUrl: options.apiUrl },
|
|
@@ -759,7 +761,7 @@ var E2BSandbox = class E2BSandbox extends MastraSandbox {
|
|
|
759
761
|
try {
|
|
760
762
|
this._sandbox = await Sandbox.create(resolvedTemplateId, {
|
|
761
763
|
...this.connectionOpts,
|
|
762
|
-
lifecycle:
|
|
764
|
+
lifecycle: this.lifecycle,
|
|
763
765
|
metadata: {
|
|
764
766
|
...this.metadata,
|
|
765
767
|
"mastra-sandbox-id": this.id
|
|
@@ -776,7 +778,7 @@ var E2BSandbox = class E2BSandbox extends MastraSandbox {
|
|
|
776
778
|
this.logger.debug(`${LOG_PREFIX} Retrying sandbox creation with rebuilt template: ${rebuiltTemplateId}`);
|
|
777
779
|
this._sandbox = await Sandbox.create(rebuiltTemplateId, {
|
|
778
780
|
...this.connectionOpts,
|
|
779
|
-
lifecycle:
|
|
781
|
+
lifecycle: this.lifecycle,
|
|
780
782
|
metadata: {
|
|
781
783
|
...this.metadata,
|
|
782
784
|
"mastra-sandbox-id": this.id
|
|
@@ -1238,7 +1240,7 @@ var E2BSandbox = class E2BSandbox extends MastraSandbox {
|
|
|
1238
1240
|
isSandboxDeadError(error) {
|
|
1239
1241
|
if (!error) return false;
|
|
1240
1242
|
const errorStr = String(error);
|
|
1241
|
-
return
|
|
1243
|
+
return /\b(?:paused\s+)?sandbox(?:\s+\S+)?\s+(?:was\s+)?not found\b/i.test(errorStr) || errorStr.includes("Sandbox is probably not running") || errorStr.includes("sandbox has been killed");
|
|
1242
1244
|
}
|
|
1243
1245
|
/**
|
|
1244
1246
|
* Handle sandbox timeout by clearing the instance and resetting state.
|
|
@@ -1249,7 +1251,10 @@ var E2BSandbox = class E2BSandbox extends MastraSandbox {
|
|
|
1249
1251
|
*/
|
|
1250
1252
|
handleSandboxTimeout() {
|
|
1251
1253
|
this._sandbox = null;
|
|
1252
|
-
for (const [path, entry] of this.mounts.entries) if (entry.state === "mounted" || entry.state === "mounting") this.mounts.set(path, {
|
|
1254
|
+
for (const [path, entry] of this.mounts.entries) if (entry.state === "mounted" || entry.state === "mounting" || entry.state === "error") this.mounts.set(path, {
|
|
1255
|
+
state: "pending",
|
|
1256
|
+
error: void 0
|
|
1257
|
+
});
|
|
1253
1258
|
this.status = "stopped";
|
|
1254
1259
|
}
|
|
1255
1260
|
/**
|