@mastra/e2b 0.11.0-alpha.3 → 0.11.0-alpha.5

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/README.md CHANGED
@@ -29,59 +29,15 @@ 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
-
45
- ### Mounting Cloud Storage
46
-
47
- E2B sandboxes can mount S3, GCS, or Azure Blob filesystems, making cloud storage accessible as a local directory inside the sandbox:
48
-
49
- ```typescript
50
- import { Workspace } from '@mastra/core/workspace';
51
- import { S3Filesystem } from '@mastra/s3';
52
- import { AzureBlobFilesystem } from '@mastra/azure/blob';
53
- import { E2BSandbox } from '@mastra/e2b';
54
-
55
- const workspace = new Workspace({
56
- mounts: {
57
- '/data': new S3Filesystem({
58
- bucket: 'my-bucket',
59
- region: 'us-east-1',
60
- accessKeyId: process.env.AWS_ACCESS_KEY_ID,
61
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
62
- }),
63
- '/azure-data': new AzureBlobFilesystem({
64
- container: 'my-container',
65
- connectionString: process.env.AZURE_STORAGE_CONNECTION_STRING,
66
- prefix: 'workspace/data',
67
- }),
68
- },
69
- sandbox: new E2BSandbox(),
70
- });
71
- ```
32
+ ## Documentation
72
33
 
73
- ### Custom Templates
34
+ - [E2B integration guide](https://mastra.ai/integrations/sandboxes/e2b)
35
+ - [Workspace documentation](https://mastra.ai/docs/mastra-platform/workspaces)
74
36
 
75
- For advanced use cases, you can use custom E2B templates:
37
+ ## Changelog
76
38
 
77
- ```typescript
78
- const workspace = new Workspace({
79
- sandbox: new E2BSandbox({
80
- template: 'my-custom-template',
81
- }),
82
- });
83
- ```
39
+ See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/workspaces/e2b/CHANGELOG.md) for version history and release notes.
84
40
 
85
- ## Documentation
41
+ ## Support
86
42
 
87
- For more information, see the [Mastra Workspaces documentation](https://mastra.ai/docs/workspace/overview).
43
+ We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
package/dist/index.cjs CHANGED
@@ -1554,6 +1554,31 @@ var E2BSandbox = class E2BSandbox extends _mastra_core_workspace.MastraSandbox {
1554
1554
  }
1555
1555
  };
1556
1556
  //#endregion
1557
+ //#region ../../packages/_internals/workspace/dist/index.js
1558
+ /**
1559
+ * Setup completion marker shared by repo templates and their consumers.
1560
+ *
1561
+ * A repo template writes this file beside the checkout as its last build
1562
+ * step, so it exists only in images where every setup command succeeded. Its
1563
+ * content is a digest of the setup commands the image ran, letting a sandbox
1564
+ * booted from the image tell whether the setup it is about to run already
1565
+ * happened. Relative to the template's build cwd, which is also the runtime
1566
+ * working directory the repo was cloned into.
1567
+ */
1568
+ const SETUP_MARKER_PATH = ".mastra-sandbox/setup";
1569
+ /** Blank entries never become build steps, so they never count toward the digest either. */
1570
+ function normalizeSetupCommands$1(setupCommand) {
1571
+ return (setupCommand === void 0 ? [] : Array.isArray(setupCommand) ? setupCommand : [setupCommand]).filter((command) => command.trim() !== "");
1572
+ }
1573
+ /** The marker content for a setup command list: `sha256:<hex>` over the commands joined by newlines. */
1574
+ function setupMarkerContent(setupCommand) {
1575
+ return `sha256:${(0, crypto.createHash)("sha256").update(normalizeSetupCommands$1(setupCommand).join("\n")).digest("hex")}`;
1576
+ }
1577
+ /** Shell step that writes the marker relative to the cwd. `content` is a digest, so it is shell-safe. */
1578
+ function setupMarkerCommand(content) {
1579
+ return `mkdir -p "$(dirname "${SETUP_MARKER_PATH}")" && printf '%s' '${content}' > "${SETUP_MARKER_PATH}"`;
1580
+ }
1581
+ //#endregion
1557
1582
  //#region src/utils/repo-template.ts
1558
1583
  /**
1559
1584
  * Sha-tagged repo templates.
@@ -1773,7 +1798,9 @@ function buildRepoTemplateSpec(identity, token) {
1773
1798
  }
1774
1799
  template = template.runCmd(`git ${auth}clone ${cloneUrl} "${repoDir}"`);
1775
1800
  if (sha) template = template.runCmd(`git -C "${repoDir}" ${auth}fetch origin ${sha}`).runCmd(`git -C "${repoDir}" checkout ${sha}`);
1776
- for (const command of normalizeSetupCommands(setupCommand)) template = template.runCmd(`cd "${repoDir}" && ${command}`);
1801
+ const setupCommands = normalizeSetupCommands(setupCommand);
1802
+ for (const command of setupCommands) template = template.runCmd(`cd "${repoDir}" && ${command}`);
1803
+ template = template.runCmd(setupMarkerCommand(setupMarkerContent(setupCommands)));
1777
1804
  return {
1778
1805
  ref: repoTemplateRef(identity),
1779
1806
  template,