@mastra/e2b 0.9.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 +29 -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 +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @mastra/e2b
|
|
2
2
|
|
|
3
|
+
## 0.10.0-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed automatic sandbox recovery when E2B reports an ID-specific missing sandbox. ([#22215](https://github.com/mastra-ai/mastra/pull/22215))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`ae8790c`](https://github.com/mastra-ai/mastra/commit/ae8790c4bfaa088d2ab279d1dcc06f326b9fd109), [`04a815f`](https://github.com/mastra-ai/mastra/commit/04a815fc8971d29e97fcdcc5008a1eb472fc00ff), [`cced745`](https://github.com/mastra-ai/mastra/commit/cced745a056ec2225c5bc702e32d848847aa8b65)]:
|
|
10
|
+
- @mastra/core@1.62.0-alpha.7
|
|
11
|
+
|
|
12
|
+
## 0.10.0-alpha.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Fixed E2B sandbox recovery so configured mounts that previously errored are retried after the physical sandbox is replaced. ([#22169](https://github.com/mastra-ai/mastra/pull/22169))
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`c8e4cea`](https://github.com/mastra-ai/mastra/commit/c8e4ceac9a390d78c8327dff3cdb2861dd71957f), [`ed01e9a`](https://github.com/mastra-ai/mastra/commit/ed01e9a807514a904374bf687a7b8f18750f6f78), [`4e9a228`](https://github.com/mastra-ai/mastra/commit/4e9a2283d5fd6ed1b70a2751eb3dc2cbf82ada20), [`63041eb`](https://github.com/mastra-ai/mastra/commit/63041eb4c50b520a0a80e03d4cd6ea99f67715a0)]:
|
|
19
|
+
- @mastra/core@1.62.0-alpha.6
|
|
20
|
+
|
|
21
|
+
## 0.10.0-alpha.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- Added a `lifecycle` option to `E2BSandbox` so you can choose what happens when a sandbox times out. Sandboxes still pause by default and resume on next use; pass `{ onTimeout: 'kill' }` to destroy idle sandboxes instead, which suits workspaces whose data is stored outside the sandbox. ([#22120](https://github.com/mastra-ai/mastra/pull/22120))
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [[`2c85f42`](https://github.com/mastra-ai/mastra/commit/2c85f428e04ccd63ea31a7ec80b5b327afdad555), [`11bbeb9`](https://github.com/mastra-ai/mastra/commit/11bbeb9b108ef2264e05acefc6dafb9cbb342921), [`1a485f3`](https://github.com/mastra-ai/mastra/commit/1a485f3538f5ec64d58bd8b5e1e99de0c695c87b), [`0d37487`](https://github.com/mastra-ai/mastra/commit/0d37487d9f349388a3f1cef6a536cf9dcc4b6273), [`8661d7d`](https://github.com/mastra-ai/mastra/commit/8661d7d7179f0a024456aabdd8679bcecd09ac28), [`575e343`](https://github.com/mastra-ai/mastra/commit/575e343900451021d96110916497d334af7bc252), [`cacb839`](https://github.com/mastra-ai/mastra/commit/cacb8392d9e74189b56d857290b0615f98a2683d), [`b47b26e`](https://github.com/mastra-ai/mastra/commit/b47b26e6fe95cb8a3482be2c5e52de157fe59d0b), [`0d37487`](https://github.com/mastra-ai/mastra/commit/0d37487d9f349388a3f1cef6a536cf9dcc4b6273), [`c46eb09`](https://github.com/mastra-ai/mastra/commit/c46eb09ce4987509af57a0ac582c61241a6dd2f1), [`30ed33e`](https://github.com/mastra-ai/mastra/commit/30ed33ee14084a26019aba15fceadda6d6ddefaf), [`91ad69d`](https://github.com/mastra-ai/mastra/commit/91ad69d64994c89199b0c55399e64ed91c61df2f), [`8dc408d`](https://github.com/mastra-ai/mastra/commit/8dc408d34438f9e13297f792c11a5cfd6cf952e1), [`c92def1`](https://github.com/mastra-ai/mastra/commit/c92def10a13c822972c96f0a4ca6ffc1f4258aed), [`c5eaec5`](https://github.com/mastra-ai/mastra/commit/c5eaec5a860d80d0e3805e67db0414b87ac8cbed), [`e66b2ba`](https://github.com/mastra-ai/mastra/commit/e66b2ba100db63eaeab6e21e1ea34b113f2ec781)]:
|
|
30
|
+
- @mastra/core@1.62.0-alpha.3
|
|
31
|
+
|
|
3
32
|
## 0.9.0
|
|
4
33
|
|
|
5
34
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -29,6 +29,19 @@ const agent = new Agent({
|
|
|
29
29
|
});
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
### Timeout Lifecycle
|
|
33
|
+
|
|
34
|
+
When a sandbox reaches its `timeout`, it is paused by default: the whole VM is snapshotted and the next `start()` reconnects and resumes it. For stateless workspaces whose data lives outside the sandbox (for example mounted from S3), you can have idle sandboxes destroyed instead and recreated on next use:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const sandbox = new E2BSandbox({
|
|
38
|
+
timeout: 60_000,
|
|
39
|
+
lifecycle: { onTimeout: 'kill' }, // default: { onTimeout: 'pause' }
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Calling `stop()` explicitly always pauses the sandbox, regardless of this setting.
|
|
44
|
+
|
|
32
45
|
### Mounting Cloud Storage
|
|
33
46
|
|
|
34
47
|
E2B sandboxes can mount S3, GCS, or Azure Blob filesystems, making cloud storage accessible as a local directory inside the sandbox:
|
package/dist/index.cjs
CHANGED
|
@@ -652,6 +652,7 @@ var E2BSandbox = class E2BSandbox extends _mastra_core_workspace.MastraSandbox {
|
|
|
652
652
|
env;
|
|
653
653
|
metadata;
|
|
654
654
|
network;
|
|
655
|
+
lifecycle;
|
|
655
656
|
connectionOpts;
|
|
656
657
|
_instructionsOverride;
|
|
657
658
|
_constructorOptions;
|
|
@@ -671,6 +672,7 @@ var E2BSandbox = class E2BSandbox extends _mastra_core_workspace.MastraSandbox {
|
|
|
671
672
|
this.env = options.env ?? {};
|
|
672
673
|
this.metadata = options.metadata ?? {};
|
|
673
674
|
this.network = options.network;
|
|
675
|
+
this.lifecycle = options.lifecycle ?? { onTimeout: "pause" };
|
|
674
676
|
this.connectionOpts = {
|
|
675
677
|
...options.domain && { domain: options.domain },
|
|
676
678
|
...options.apiUrl && { apiUrl: options.apiUrl },
|
|
@@ -760,7 +762,7 @@ var E2BSandbox = class E2BSandbox extends _mastra_core_workspace.MastraSandbox {
|
|
|
760
762
|
try {
|
|
761
763
|
this._sandbox = await e2b.Sandbox.create(resolvedTemplateId, {
|
|
762
764
|
...this.connectionOpts,
|
|
763
|
-
lifecycle:
|
|
765
|
+
lifecycle: this.lifecycle,
|
|
764
766
|
metadata: {
|
|
765
767
|
...this.metadata,
|
|
766
768
|
"mastra-sandbox-id": this.id
|
|
@@ -777,7 +779,7 @@ var E2BSandbox = class E2BSandbox extends _mastra_core_workspace.MastraSandbox {
|
|
|
777
779
|
this.logger.debug(`${LOG_PREFIX} Retrying sandbox creation with rebuilt template: ${rebuiltTemplateId}`);
|
|
778
780
|
this._sandbox = await e2b.Sandbox.create(rebuiltTemplateId, {
|
|
779
781
|
...this.connectionOpts,
|
|
780
|
-
lifecycle:
|
|
782
|
+
lifecycle: this.lifecycle,
|
|
781
783
|
metadata: {
|
|
782
784
|
...this.metadata,
|
|
783
785
|
"mastra-sandbox-id": this.id
|
|
@@ -1239,7 +1241,7 @@ var E2BSandbox = class E2BSandbox extends _mastra_core_workspace.MastraSandbox {
|
|
|
1239
1241
|
isSandboxDeadError(error) {
|
|
1240
1242
|
if (!error) return false;
|
|
1241
1243
|
const errorStr = String(error);
|
|
1242
|
-
return
|
|
1244
|
+
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");
|
|
1243
1245
|
}
|
|
1244
1246
|
/**
|
|
1245
1247
|
* Handle sandbox timeout by clearing the instance and resetting state.
|
|
@@ -1250,7 +1252,10 @@ var E2BSandbox = class E2BSandbox extends _mastra_core_workspace.MastraSandbox {
|
|
|
1250
1252
|
*/
|
|
1251
1253
|
handleSandboxTimeout() {
|
|
1252
1254
|
this._sandbox = null;
|
|
1253
|
-
for (const [path, entry] of this.mounts.entries) if (entry.state === "mounted" || entry.state === "mounting") this.mounts.set(path, {
|
|
1255
|
+
for (const [path, entry] of this.mounts.entries) if (entry.state === "mounted" || entry.state === "mounting" || entry.state === "error") this.mounts.set(path, {
|
|
1256
|
+
state: "pending",
|
|
1257
|
+
error: void 0
|
|
1258
|
+
});
|
|
1254
1259
|
this.status = "stopped";
|
|
1255
1260
|
}
|
|
1256
1261
|
/**
|