@mastra/e2b 0.10.0 → 0.11.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,66 @@
1
1
  # @mastra/e2b
2
2
 
3
+ ## 0.11.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - **Added repository templates, so sandboxes start with a warm checkout** ([#22065](https://github.com/mastra-ai/mastra/pull/22065))
8
+
9
+ `createRepoTemplate()` builds an E2B template with the repository already cloned and its setup command already run. Sessions then start from a prepared image instead of paying a cold clone and install.
10
+
11
+ ```ts
12
+ new E2BSandbox({
13
+ id: sessionId,
14
+ template: createRepoTemplate({
15
+ getRepositoryAccess: async () => ({
16
+ cloneUrl: 'https://github.com/acme/widgets.git',
17
+ authorization: { scheme: 'bearer', token: await mintInstallationToken() },
18
+ }),
19
+ setupCommand: 'pnpm install',
20
+ }),
21
+ });
22
+ ```
23
+
24
+ `getRepositoryAccess` supplies the clone URL and, for private repositories, a short-lived credential. It returns `undefined` from `createRepoTemplate()` when the accessor is absent, so a session with no repository needs no conditional at the call site. The credential authenticates the head lookup and the build's clone through an in-shell auth header, reaching the template definition's environment but never the image filesystem. It's set as `GH_TOKEN`, the same variable a session installs before running setup, so a setup command behaves identically in both places.
25
+
26
+ **Only the first build ever blocks a start**
27
+
28
+ There's one template per repository, setup command, and workdir, with the commit sha as a tag (`mastra-repo-<owner>-<repo>-<hash>:sha-<sha>`). Without an explicit `sha` the template pins itself to the repository's current default-branch head at resolution time. When the head moves, the next sandbox boots immediately from the previous build while the new sha builds in the background, and runtime setup fast-forwards the checkout. A failed build falls back to the default template plus a runtime clone, so a broken build never wedges a session.
29
+
30
+ **Added `buildEnv` for setup commands that need credentials**
31
+
32
+ Registry tokens, private index URLs, and anything else the setup command needs at build time. Accepts a record or an async resolver. Values are part of the template's identity, so changing one produces a new template.
33
+
34
+ **Added `refreshRepoTemplate()` for warming templates ahead of time**
35
+
36
+ The same resolution the lazy start path performs, exposed standalone and awaited, so a cron or a merge-to-main handler can build the template before anyone opens a session.
37
+
38
+ **Default template ships a current Node.js LTS with corepack enabled**
39
+
40
+ The e2b base image carries Node 20.9.0, old enough that corepack-fetched package managers crash on it, so a setup command like `pnpm i && pnpm build` failed out of the box. The default mountable template now installs a pinned Node 24.20.0 over the stale runtime and enables corepack with the download prompt disabled, so `pnpm` and `yarn` resolve to whatever a repository's `packageManager` field pins. Repo templates build on the default mountable template, so they inherit the working toolchain. Pick a different release with the new `nodeVersion` option:
41
+
42
+ ```ts
43
+ createDefaultMountableTemplate({ nodeVersion: '22.23.2' });
44
+ ```
45
+
46
+ The version is exact and identity-bearing: changing it builds a new template, so a version change can never silently reuse a build at the old runtime. Existing default and repo templates rebuild once on first use after upgrading.
47
+
48
+ **Machine resources: `cpuCount` and `memoryMB`**
49
+
50
+ The built template's sandboxes get exactly that machine size. Resources are part of the template's identity — hashed into the template name alongside the repository, setup command, and build env — so a resize builds a new template instead of silently reusing one built at the old size. Absent options normalize to the SDK defaults (2 vCPU, 1024 MB). When a repo template's build fails and the sandbox degrades to the default mountable template, the default is built at the requested size too, so a 2 GB session's setup never lands in a 1 GB fallback and runs out of memory.
51
+
52
+ ```ts
53
+ new E2BSandbox({
54
+ id: sessionId,
55
+ template: createRepoTemplate({ ...ctx, memoryMB: 2048, cpuCount: 4 }),
56
+ });
57
+ ```
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies [[`3910c77`](https://github.com/mastra-ai/mastra/commit/3910c77413a3058ab270c6dbc74a59bc3cdf67ea)]:
62
+ - @mastra/core@1.63.3-alpha.0
63
+
3
64
  ## 0.10.0
4
65
 
5
66
  ### Minor Changes
package/LICENSE.md CHANGED
@@ -1,10 +1,12 @@
1
1
  Portions of this software are licensed as follows:
2
2
 
3
- - All content that resides under any directory named "ee/" within this
3
+ - All content that resides under any directory named `ee/` within this
4
4
  repository, including but not limited to:
5
- - `packages/core/src/auth/ee/`
6
- - `packages/server/src/server/auth/ee/`
7
- is licensed under the license defined in `ee/LICENSE`.
5
+ - `@mastra/core/auth/ee`
6
+ - `@mastra/core/agent-builder/ee`
7
+ - `@mastra/editor/ee`
8
+
9
+ is licensed under the license defined in [`ee/LICENSE`](https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE).
8
10
 
9
11
  - All third-party components incorporated into the Mastra Software are
10
12
  licensed under the original license provided by the owner of the
@@ -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;CAkMtF"}
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"}