@mastra/e2b 0.9.0 → 0.10.0-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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @mastra/e2b
2
2
 
3
+ ## 0.10.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 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))
8
+
9
+ ### Patch Changes
10
+
11
+ - 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)]:
12
+ - @mastra/core@1.62.0-alpha.3
13
+
3
14
  ## 0.9.0
4
15
 
5
16
  ### 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: { onTimeout: "pause" },
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: { onTimeout: "pause" },
782
+ lifecycle: this.lifecycle,
781
783
  metadata: {
782
784
  ...this.metadata,
783
785
  "mastra-sandbox-id": this.id