> Opened by @factory-project:7d5175c3-3a20-42ac-aba9-756f183136f4
## Description
E2B sandboxes ran every agent command as the template's default OS user,
and S3/GCS FUSE mounts were always owned by that same user. That user
has to be privileged — mounting FUSE filesystems needs `sudo`, and the
staged s3fs credentials file (`/tmp/.passwd-s3fs-*`, mode 600) is only
readable by it — so an agent running shell commands as that user could
read bucket credentials or become root.
Two opt-in options fix that:
- **`E2BSandbox({ user })`** — every command the sandbox runs on the
agent's behalf runs as that OS user: `executeCommand`, background
processes, and the tree-kill script that takes their descendants down
(another user cannot signal them). Mounting still runs as the default
user, because it needs `sudo`.
- **`S3Filesystem({ owner })` / `GCSFilesystem({ owner })`** — `{ uid,
gid }` naming the owner of the files inside the FUSE mount, replacing
the `id -u && id -g` probe. This is what gives the command user read and
write access to the mount.
Both are additive and default to today's behavior. `owner` lives on the
filesystem options rather than the sandbox because the mount config is
produced by `filesystem.getMountConfig()`, which is what E2B's `mount()`
reads; `E2BSandboxOptions.user` reaches the provider through the shared
`CommandsApiProcessManager`, and the key is left off entirely when unset
so the SDK's own default user still applies. `owner` is validated as
non-negative integers before it is interpolated into a mount command.
The `user` must already exist in the sandbox template.
## Related issue(s)
Fixes#30349
## Type of change
- [ ] Bug fix (non-breaking change that fixes an issue)
- [x] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update
- [ ] Code refactoring
- [ ] Performance improvement
- [ ] Test update
## Checklist
- [x] I have linked the related issue(s) in the description above
- [x] I have made corresponding changes to the documentation (if
applicable)
- [ ] I have addressed all Coderabbit comments on this PR
## Test plan
All checks run on this head (`dec4e6ec`):
- `packages/_internals/workspace`: 160 tests, including a new test that
the spawn and the kill script both carry the configured user, and one
that the key stays unset without a user.
- `@mastra/e2b` unit suite: 367 passed, 9 skipped (`validateOwner`
cases; S3 and GCS mounts using an explicit owner skip the `id -u && id
-g` probe and emit `uid=`/`gid=` and `--uid=`/`--gid=`; mounts without
an owner still probe).
- `@mastra/s3` 150 passed, `@mastra/gcs` 91 passed, including
`getMountConfig()` carrying `owner` when set and omitting it when not.
- Typecheck (e2b, s3, gcs, platform-workspace) clean; lint 0 warnings /
0 errors and builds clean for e2b, s3 and gcs.
- Each new test fails against the base source without the change (10 in
e2b, 1 internal, 1 s3, 1 gcs).
- Integration coverage: `index.integration.test.ts` gained a case
asserting an explicit owner yields `1234:1234` from `stat -c %u:%g`. It
needs `E2B_API_KEY`, so it does not run in CI — a manual run on a real
sandbox is the remaining gap.
## Follow-ups (not part of this change)
1. File-API writes (`sandbox.files`, `FilesApiFilesystem`) and code-mode
staging under `/home/user` still run as the default user, so with `user`
set, files written through file tools are not owned by the command user.
2. `E2BProviderConfig.configSchema` does not list `user` (it already
omits `workingDirectory`, `reattach` and `lifecycle`), so the Studio
provider form does not offer it even though the runtime forwards it.
3. `commands.list()` scope relative to the configured user is unverified
without an API key; tracked handles still surface.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
**ELI5:** Agent commands in an E2B sandbox used to run as the same user
that mounts cloud storage. This PR lets you pick a separate,
less-privileged user for agent commands, and lets you set the file owner
for S3 and GCS mounts. Both options are off by default.
## Summary
This PR adds two opt-in E2B options, as described in issue `#30349`:
- **Command user.** `E2BSandbox({ user })` runs agent commands,
background processes, and descendant cleanup as the named OS user.
Mounting still uses the default user. The user must already exist in the
sandbox template.
- **Mount owner.** `S3Filesystem({ owner })` and `GCSFilesystem({ owner
})` accept `{ uid, gid }`. When set, the mount uses these IDs. When
unset, the existing `id -u && id -g` probe runs.
### Changes by area
- **Workspace process manager**
(`packages/_internals/workspace/src/commands-api-process-manager.ts`):
`CommandsApi.run` and `CommandsApiProcessManagerOptions` accept an
optional `user`. Spawned commands and descendant cleanup in `kill()` use
it.
- **E2B provider** (`workspaces/e2b/src/sandbox/`):
- `index.ts` adds `user?: string` to `E2BSandboxOptions`.
- `process-manager.ts` forwards `user` to the base class.
- `mounts/types.ts` adds `MountOwner` and `validateOwner`. Validation
requires non-negative integers for `uid` and `gid`.
- `mounts/s3.ts` and `mounts/gcs.ts` use a supplied owner. Otherwise,
they probe the default user.
- `index.ts` re-exports `MountOwner`.
- **S3 and GCS filesystems** (`workspaces/s3/src/filesystem/index.ts`,
`workspaces/gcs/src/filesystem/index.ts`): add `MountOwner`, an optional
`owner` option, and a `readonly owner` property. `getMountConfig()`
copies `uid` and `gid` into a plain object only when an owner is set.
This copy also handles owners whose fields are prototype getters. Both
packages re-export `MountOwner`.
- **Docs and changeset:** document both options. The changeset sets
minor releases for `@mastra/e2b`, `@mastra/s3`, and `@mastra/gcs`.
### Tests
- Workspace tests check that a configured user reaches spawned commands
and their kill commands. They also check that an unset user is passed as
`undefined`.
- E2B unit tests check owner validation and mount behavior with and
without an owner.
- S3 and GCS tests check `getMountConfig()` with and without an owner.
They also check that later changes to the input owner do not change the
config.
- An E2B integration test checks that an explicit owner of `1234` mounts
with ownership `1234:1234`. This test requires `E2B_API_KEY` and was not
run in CI.
The author reports passing workspace, E2B, S3, and GCS tests. The author
also reports clean typecheck, lint, and build results. These results are
not tied to a completed CI run on the current head. A manual run against
a real E2B sandbox is outstanding.
### Out of scope (per PR description)
- File-API writes and code-mode staging still use the default user.
- The Studio configuration schema does not expose `user`.
- The scope of `commands.list()` relative to the configured user is not
verified.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com>
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
Factory members can now add environment variables for every sandbox in a
Factory, under Settings › Manage Factory › Environment variables. Each
variable is marked Build, Runtime, or Both.
Runtime variables reach every command in the Factory's sandboxes.
Adding, editing or deleting one takes effect on the next command in a
sandbox that's already running, with no restart (processes already
running keep their old env). Build variables reach template builds and
Factory's setup commands, never runtime commands, and editing one makes
the next build rebuild the template.
Values are encrypted at rest, never returned by the API or shown in the
UI after saving, and never put into template names, identity, or images.
Saving is blocked when sign-in is on but no credential encryption key is
configured.
To make builds work, `FactorySandboxContext` gets two optional fields.
Providers pass `buildEnv` only to a build-only mechanism and put
`buildEnvRevision` (a random id, never derived from values) in template
identity:
```ts
const { buildEnv, buildEnvRevision, ...rest } = ctx;
return createRepoTemplate({ ...rest, buildEnvRevision });
```
The platform and E2B workspace packages pass Build variables to template
builds. Docker keeps them out of the image and its identity, and doesn't
apply them to template builds yet. The routes are also available from
the CLI as `mastra api factory project environment variables
list|set|update|delete`.
Tested with unit tests on a real local sandbox, route tests that check
no response ever contains a value, and UI tests. I also ran it end to
end against a Platform sandbox: a Runtime variable's new value showed up
after an edit and was gone after a delete, and a Build variable was seen
by setup but not at runtime, with an edit producing a new build.
Part of FACT-554
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
Factory admins can save environment variables for a project and choose
whether each one is used to build sandboxes, run commands, or both.
Factory protects the values and applies changes to later commands or
relevant builds.
## Summary
- Added encrypted, project-scoped storage and authenticated API routes
to list, set, update, and delete sandbox environment variables.
Responses include metadata, not values. When sign-in is enabled without
a credential encryption key, writes are blocked.
- Added a Factory settings interface and CLI commands to manage
variables with Build, Runtime, or Both scopes.
- Runtime variable changes refresh the environment before later
commands. Build variables are available to build contexts and setup
commands. Build-variable changes update a revision used by supported
providers for template identity.
- Reads are served from memory per server: the revision and decrypted
values are reused until a variable changes. A write clears this server's
entry and is announced on Factory's event bus so other servers drop
theirs; a cached read is re-checked after a minute with a cross-process
bus, or after a second without one.
- Added optional `buildEnv` and `buildEnvRevision` fields to
`FactorySandboxContext`. Platform and E2B pass Build variables to
template builds. Docker excludes these fields from template input and
identity; Docker template builds do not receive the variables.
- Added documentation and tests for storage, API routes, settings, CLI,
sandbox behavior, and provider handling.
**Diff size:** 54 files changed; 3,241 lines added and 50 removed.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: CalebBarnes <CalebBarnes@users.noreply.github.com>
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.
⚠️⚠️⚠️⚠️⚠️⚠️
`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.
⚠️⚠️⚠️⚠️⚠️⚠️
# Releases
> The changelog information of each package has been omitted from this
message, as the content exceeds the size limit.
## @mastra/client-js@1.59.0-alpha.2
## @mastra/factory@0.27.0-alpha.2
## @mastra/code-sdk@1.18.0-alpha.2
## mastra@1.38.0-alpha.2
## @mastra/core@1.82.0-alpha.2
## @mastra/editor@0.17.0-alpha.2
## @mastra/server@1.82.0-alpha.2
## @mastra/clickhouse@1.29.0-alpha.1
## @mastra/duckdb@1.18.0-alpha.1
## @mastra/pg@1.35.0-alpha.2
## @mastra/platform-workspace@1.12.0-alpha.1
## @mastra/react@1.14.1-alpha.2
## @mastra/deployer-cloud@1.82.0-alpha.2
## @mastra/deployer-sandbox@0.3.26-alpha.1
## @mastra/longmemeval@1.1.41-alpha.2
## @mastra/opencode@0.1.41-alpha.2
## @mastra/parallel@0.1.5-alpha.0
## create-factory@0.4.2-alpha.2
## mastracode@0.49.0-alpha.2
## @mastra/arize@1.3.29-alpha.1
## @mastra/arthur@0.4.29-alpha.1
## @mastra/braintrust@1.3.26-alpha.1
## @mastra/datadog@1.4.21-alpha.1
## @mastra/deepeval@0.1.23-alpha.1
## @mastra/laminar@1.3.31-alpha.1
## @mastra/langfuse@1.6.5-alpha.1
## @mastra/langsmith@1.4.2-alpha.1
## @mastra/observability@1.23.1-alpha.1
## @mastra/otel-bridge@1.5.21-alpha.1
## @mastra/otel-exporter@1.5.1-alpha.1
## @mastra/posthog@1.4.6-alpha.1
## @mastra/sentry@1.2.31-alpha.2
## @mastra/agent-builder@1.1.33-alpha.2
## @mastra/deployer@1.82.0-alpha.2
## @mastra/mcp@2.8.0-alpha.1
## @mastra/mcp-docs-server@1.3.12-alpha.3
## @mastra/memory@1.41.0-alpha.2
## @mastra/playground-ui@68.0.0-alpha.2
## @mastra/rag@2.7.2-alpha.0
## @mastra/elysia@0.1.22-alpha.2
## @mastra/express@1.5.26-alpha.2
## @mastra/fastify@1.5.26-alpha.2
## @mastra/hono@1.7.24-alpha.2
## @mastra/koa@1.7.26-alpha.2
## @mastra/nestjs@0.2.41-alpha.2
## @mastra/next@0.2.40-alpha.2
## @mastra/tanstack-start@0.2.40-alpha.2
## @mastra/dsql@1.5.6-alpha.0
## @mastra/libsql@1.29.0-alpha.1
## @mastra/mongodb@1.26.0-alpha.1
## @mastra/mssql@1.11.1-alpha.0
## @mastra/mysql@0.16.0-alpha.2
## @mastra/oracledb@0.5.6-alpha.0
## @mastra/spanner@1.11.1-alpha.0
## @mastra/turso@0.1.20-alpha.1
## @mastra/voice-google@0.14.5-alpha.0
## @mastra/inngest@1.11.1-alpha.1
## @mastra/temporal@0.5.0-alpha.2
## @mastra/e2b@0.16.1-alpha.1
## create-mastra@1.38.0-alpha.2
## @internal/playground@1.38.0-alpha.2
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.
⚠️⚠️⚠️⚠️⚠️⚠️
`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.
⚠️⚠️⚠️⚠️⚠️⚠️
# Releases
## @mastra/client-js@1.59.0-alpha.1
### Minor Changes
- Added the `aggregateTimeToFirstMeasures` observability capability.
Trace and span aggregate requests for `timeToFirstToken.*` or
`timeToFirstChunk.*` measures now return `501` against stores that can't
compute them, and field discovery omits those measures for such stores.
([#29055](https://github.com/mastra-ai/mastra/pull/29055))
```typescript
const { capabilities } = await
mastraClient.getObservabilityCapabilities();
if (capabilities.traceAggregate &&
capabilities.aggregateTimeToFirstMeasures) {
const { rows } = await mastraClient.aggregateTraces({
timeRange: { from: '2026-08-01T00:00:00.000Z', to:
'2026-08-02T00:00:00.000Z' },
groupBy: ['entityName'],
measures: ['timeToFirstChunk.p95', 'timeToFirstChunk.count'],
});
}
```
### Patch Changes
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
## @mastra/factory@0.27.0-alpha.1
### Minor Changes
- The same Jira, Linear or incident.io item can now be filed in more
than one Factory project. Before, the first project to file an item held
it for the whole org, and other projects that ingested it got no card.
Each project now keeps its own card. Within a project the card is still
reused when the item is seen again, after the card finishes and when the
issue reopens. A Linear card is also found after the issue's identifier
changes, for example when the issue moves to another team.
([#29059](https://github.com/mastra-ai/mastra/pull/29059))
When intake routing sends an item to a different project, the new
project files its own card and the previous project's card stays where
it is.
**Breaking changes**
- `claimKey` is removed from the `upsertLinkedWorkItem` decision type.
Rules that still return it, and decisions saved before this release,
keep working: the field is accepted and ignored.
- `WorkItemClaimConflictError`, `getByClaimKey`, `claimWorkItem`,
`releaseProjectClaims` and `WorkItemRow.claimKey` are removed.
Drop `claimKey` from linked-item decisions your rules return:
```ts
// Before
return {
type: 'upsertLinkedWorkItem',
source: 'jira-issue',
sourceKey: issue.id,
claimKey: `jira:issue:${issue.id}` /* … */,
};
// After
return { type: 'upsertLinkedWorkItem', source: 'jira-issue', sourceKey:
issue.id /* … */ };
```
Remove calls to `getByClaimKey`, `claimWorkItem` and
`releaseProjectClaims`. To find a project's card for an item, use
`getByProjectSource`.
The `claim_key` column stays in the database. Values already stored
there are left in place and no longer affect anything.
### Patch Changes
- Fixed shell commands that exit with a failure code reading as
successful in the Factory transcript. The command now reads as failed
while the run streams, after a dropped stream reconnects, and after a
reload. Stopping a process with `kill_process` still reads as a success.
([#28963](https://github.com/mastra-ai/mastra/pull/28963))
A system reminder that loads project instructions (`AGENTS.md`,
`CLAUDE.md` or `CONTEXT.md`) now reads "Project instructions" and names
the file by its path in the working directory, such as
`packages/core/AGENTS.md`, instead of a bare "System reminder".
- A board tool rule that moves a work item back into its current stage
with `reenter: true` now runs that stage's entry rules, as documented.
Previously the entry rules were skipped, so no new agent run started.
([#29104](https://github.com/mastra-ai/mastra/pull/29104))
- Updated dependencies
[[`5735a50`](5735a50c6c),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/platform-workspace@1.11.1-alpha.0
- @mastra/core@1.82.0-alpha.1
- @mastra/code-sdk@1.18.0-alpha.1
## @mastra/core@1.82.0-alpha.1
### Minor Changes
- Added time to first token and time to first chunk measures to trace
and span aggregates, so dashboards can chart streaming latency next to
duration. ([#29055](https://github.com/mastra-ai/mastra/pull/29055))
The new measures are `timeToFirstToken.avg`, `.min`, `.max`, `.p50`,
`.p90`, `.p95`, `.p99`, and `.count`, plus the same set for
`timeToFirstChunk`. Traces and spans without a recorded value are
skipped instead of counted as 0, and `.count` reports how many had one.
Stores opt in through the `aggregate-time-to-first-measures` feature.
### Patch Changes
- Fixed durable agents (`durable: true`) ending the `model_generation`
trace span without `responseId` and `responseModel`. Durable runs now
record the provider's response id and model on the span, the same as
non-durable agents, so a trace can be linked back to the provider's own
response log. Fixes#29053.
([#29180](https://github.com/mastra-ai/mastra/pull/29180))
- Fixed metadata filters in the in-memory store returning records whose
nested metadata had different keys from the filter when one side
contained an `undefined` value.
([#29101](https://github.com/mastra-ai/mastra/pull/29101))
- Fixed directly resumed nested workflows in the evented engine so they
continue suspended parent runs.
([#25979](https://github.com/mastra-ai/mastra/pull/25979))
## @mastra/playground-ui@68.0.0-alpha.1
### Minor Changes
- Toolbar and filter bar controls now share one look: the same paddings,
icon gaps, chevron and spacing between controls.
([#28818](https://github.com/mastra-ai/mastra/pull/28818))
**Time range.** A filter bar's time range is now the
`DateTimeRangePicker` itself, so it looks and behaves the same on every
page: a calendar icon, the range and a chevron, with no separate "Time"
label. Pass `defaultPreset` to show a × that resets a custom range; it
replaces the chevron while a custom range is applied.
Added `FilterBar.TimeRange` with `FILTER_BAR_TIME_RANGE_FIELD`,
`FILTER_BAR_TIME_RANGE_ITEM` and `FILTER_BAR_TIME_RANGE_FIELD_ID`. They
replace `TraceTimeRangeChip` and the `TRACE_TIME_RANGE_*` names from
`domains/traces/components/trace-time-range-chip`, which are removed.
```tsx
import {
FilterBar,
FILTER_BAR_TIME_RANGE_FIELD,
FILTER_BAR_TIME_RANGE_FIELD_ID,
FILTER_BAR_TIME_RANGE_ITEM,
} from '@mastra/playground-ui/components/FilterBar';
<FilterBar
fields={[FILTER_BAR_TIME_RANGE_FIELD, ...fields]}
operators={operators}
value={[FILTER_BAR_TIME_RANGE_ITEM, ...items]}
// The time range item is synthetic: keep it out of the stored filters.
onValueChange={next => setItems(next.filter(item => item.fieldId !==
FILTER_BAR_TIME_RANGE_FIELD_ID))}
>
<FilterBar.Chips
renderChip={item =>
item.fieldId === FILTER_BAR_TIME_RANGE_FIELD_ID ? (
<FilterBar.TimeRange
preset={preset}
// A preset, including the × reset, drops the applied custom dates.
onPresetChange={next => {
setPreset(next);
if (next !== 'custom') setRange({});
}}
dateFrom={range.from}
dateTo={range.to}
onDateRangeChange={(from, to) => setRange({ from, to })}
defaultPreset="last-7d"
/>
) : (
<FilterBar.Chip item={item} />
)
}
/>
<FilterBar.Input />
</FilterBar>;
```
`DateTimeRangePicker` gains `size`, `defaultPreset` and `ref` (the
trigger button).
**Migrating removed APIs.**
- `TraceTimeRangeChip` → `FilterBar.TimeRange` (same props), and
`TRACE_TIME_RANGE_FIELD` / `_ITEM` / `_FIELD_ID` →
`FILTER_BAR_TIME_RANGE_FIELD` / `_ITEM` / `_FIELD_ID`, imported from
`@mastra/playground-ui/components/FilterBar`.
```tsx
// Before
import { TraceTimeRangeChip, TRACE_TIME_RANGE_FIELD_ID } from
'@mastra/playground-ui/domains/traces/components/trace-time-range-chip';
item.fieldId === TRACE_TIME_RANGE_FIELD_ID ? <TraceTimeRangeChip
preset={preset} onPresetChange={setPreset} /> : …
// After
import { FilterBar, FILTER_BAR_TIME_RANGE_FIELD_ID } from
'@mastra/playground-ui/components/FilterBar';
item.fieldId === FILTER_BAR_TIME_RANGE_FIELD_ID ? <FilterBar.TimeRange
preset={preset} onPresetChange={setPreset} /> : …
```
- `DateTimeRangePicker`'s `renderTrigger` → remove it: the trigger is
always the shared calendar button. Pass `size` for another rung and
`ref` to reach the trigger.
- `comboboxStyles.chevron` on a hand-built trigger → `<ButtonChevron
size={size} />` from `@mastra/playground-ui/components/Button`.
**Other controls.**
- Added `ClearFiltersButton`, a round reset icon button with a tooltip,
used for every toolbar's "clear filters".
- Added `TriggerChevron` and `ButtonChevron`, the one chevron every
dropdown trigger (`Select`, `Combobox`, the date picker) shows.
- `ComboboxTrigger` uses that chevron instead of the up-down one.
- Icons in every interactive control (buttons, fields, search inputs,
filter chips, menu and command rows) follow one rule: muted at rest,
brighter on hover. Two new theme tokens, `--control-icon-rest` and
`--control-icon-hover`, set those colours; menus retune them, and
icon-only controls always brighten. Search fields and combobox fields
now brighten their icons on hover like buttons do.
- Icons take their size from the control they sit in, as in a Button:
filter chips and search inputs no longer size their own icons.
- `ListSearch` defaults to the `sm` toolbar size, and `SearchInput`'s
icon sits at the same inset as a button's.
- `ActionRow` and `FilterBar` space their controls 6px apart.
### Patch Changes
- Updated dependencies
[[`489d829`](489d8295c8),
[`0900c20`](0900c20592),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`e1e64f0`](e1e64f072c),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/memory@1.41.0-alpha.1
- @mastra/client-js@1.59.0-alpha.1
- @mastra/core@1.82.0-alpha.1
- @mastra/ai-sdk@1.11.3
- @mastra/react@1.14.1-alpha.1
## @mastra/server@1.82.0-alpha.1
### Minor Changes
- Added the `aggregateTimeToFirstMeasures` observability capability.
Trace and span aggregate requests for `timeToFirstToken.*` or
`timeToFirstChunk.*` measures now return `501` against stores that can't
compute them, and field discovery omits those measures for such stores.
([#29055](https://github.com/mastra-ai/mastra/pull/29055))
```typescript
const { capabilities } = await
mastraClient.getObservabilityCapabilities();
if (capabilities.traceAggregate &&
capabilities.aggregateTimeToFirstMeasures) {
const { rows } = await mastraClient.aggregateTraces({
timeRange: { from: '2026-08-01T00:00:00.000Z', to:
'2026-08-02T00:00:00.000Z' },
groupBy: ['entityName'],
measures: ['timeToFirstChunk.p95', 'timeToFirstChunk.count'],
});
}
```
### Patch Changes
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
## @mastra/clickhouse@1.29.0-alpha.0
### Minor Changes
- Added support for `timeToFirstToken.*` and `timeToFirstChunk.*`
measures in trace and span aggregates. Rows without a recorded value are
skipped, never counted as 0.
([#29055](https://github.com/mastra-ai/mastra/pull/29055))
```typescript
import { planSpanAggregate } from '@mastra/core/storage';
const observability = await storage.getStore('observability');
if
(observability?.getFeatures().includes('aggregate-time-to-first-measures'))
{
const { rows } = await observability.aggregateSpans(
planSpanAggregate({
timeRange: { from: '2026-08-01T00:00:00.000Z', to:
'2026-08-02T00:00:00.000Z' },
where: { op: 'eq', left: { path: 'spanType' }, right: { literal:
'model_inference' } },
measures: ['timeToFirstToken.p50', 'timeToFirstToken.p95'],
}),
);
}
```
### Patch Changes
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
## @mastra/duckdb@1.18.0-alpha.0
### Minor Changes
- Added support for `timeToFirstToken.*` and `timeToFirstChunk.*`
measures in trace and span aggregates. Rows without a recorded value are
skipped, never counted as 0.
([#29055](https://github.com/mastra-ai/mastra/pull/29055))
```typescript
import { planSpanAggregate } from '@mastra/core/storage';
const observability = await storage.getStore('observability');
if
(observability?.getFeatures().includes('aggregate-time-to-first-measures'))
{
const { rows } = await observability.aggregateSpans(
planSpanAggregate({
timeRange: { from: '2026-08-01T00:00:00.000Z', to:
'2026-08-02T00:00:00.000Z' },
where: { op: 'eq', left: { path: 'spanType' }, right: { literal:
'model_inference' } },
measures: ['timeToFirstToken.p50', 'timeToFirstToken.p95'],
}),
);
}
```
### Patch Changes
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
## @mastra/pg@1.35.0-alpha.1
### Minor Changes
- Added support for `timeToFirstToken.*` and `timeToFirstChunk.*`
measures in trace and span aggregates. Rows without a recorded value are
skipped, never counted as 0.
([#29055](https://github.com/mastra-ai/mastra/pull/29055))
```typescript
import { planSpanAggregate } from '@mastra/core/storage';
const observability = await storage.getStore('observability');
if
(observability?.getFeatures().includes('aggregate-time-to-first-measures'))
{
const { rows } = await observability.aggregateSpans(
planSpanAggregate({
timeRange: { from: '2026-08-01T00:00:00.000Z', to:
'2026-08-02T00:00:00.000Z' },
where: { op: 'eq', left: { path: 'spanType' }, right: { literal:
'model_inference' } },
measures: ['timeToFirstToken.p50', 'timeToFirstToken.p95'],
}),
);
}
```
### Patch Changes
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
## @mastra/react@1.14.1-alpha.1
### Patch Changes
- Updated dependencies
[[`0900c20`](0900c20592),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/client-js@1.59.0-alpha.1
- @mastra/core@1.82.0-alpha.1
## @mastra/deployer-cloud@1.82.0-alpha.1
### Patch Changes
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
- @mastra/deployer@1.82.0-alpha.1
## @mastra/longmemeval@1.1.41-alpha.1
### Patch Changes
- Updated dependencies
[[`489d829`](489d8295c8),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`e1e64f0`](e1e64f072c),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/memory@1.41.0-alpha.1
- @mastra/core@1.82.0-alpha.1
- @mastra/libsql@1.29.0-alpha.0
## @mastra/opencode@0.1.41-alpha.1
### Patch Changes
- Updated dependencies
[[`489d829`](489d8295c8),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`e1e64f0`](e1e64f072c),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/memory@1.41.0-alpha.1
- @mastra/core@1.82.0-alpha.1
- @mastra/libsql@1.29.0-alpha.0
## create-factory@0.4.2-alpha.1
### Patch Changes
- Updated dependencies:
- mastra@1.38.0-alpha.1
## @mastra/code-sdk@1.18.0-alpha.1
### Patch Changes
- Updated dependencies
[[`489d829`](489d8295c8),
[`0900c20`](0900c20592),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`e1e64f0`](e1e64f072c),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/memory@1.41.0-alpha.1
- @mastra/client-js@1.59.0-alpha.1
- @mastra/core@1.82.0-alpha.1
- @mastra/pg@1.35.0-alpha.1
- @mastra/duckdb@1.18.0-alpha.0
- @mastra/libsql@1.29.0-alpha.0
## mastracode@0.49.0-alpha.1
### Patch Changes
- Updated dependencies
[[`489d829`](489d8295c8),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`e1e64f0`](e1e64f072c),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/memory@1.41.0-alpha.1
- @mastra/core@1.82.0-alpha.1
- @mastra/pg@1.35.0-alpha.1
- @mastra/duckdb@1.18.0-alpha.0
- @mastra/code-sdk@1.18.0-alpha.1
- @mastra/libsql@1.29.0-alpha.0
## @mastra/sentry@1.2.31-alpha.1
### Patch Changes
- dependencies updates:
([#29123](https://github.com/mastra-ai/mastra/pull/29123))
- Updated dependency [`@sentry/node@^11.10.0`
↗︎](https://www.npmjs.com/package/@sentry/node/v/11.10.0) (from
`^10.76.2`, in `dependencies`)
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
## @mastra/agent-builder@1.1.33-alpha.1
### Patch Changes
- Updated dependencies
[[`489d829`](489d8295c8),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`e1e64f0`](e1e64f072c),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/memory@1.41.0-alpha.1
- @mastra/core@1.82.0-alpha.1
## mastra@1.38.0-alpha.1
### Patch Changes
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
- @mastra/deployer@1.82.0-alpha.1
## @mastra/deployer@1.82.0-alpha.1
### Patch Changes
- Updated dependencies
[[`0900c20`](0900c20592),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/server@1.82.0-alpha.1
- @mastra/core@1.82.0-alpha.1
## @mastra/editor@0.16.7-alpha.1
### Patch Changes
- Updated dependencies
[[`489d829`](489d8295c8),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`e1e64f0`](e1e64f072c),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/memory@1.41.0-alpha.1
- @mastra/core@1.82.0-alpha.1
## @mastra/mcp-docs-server@1.3.12-alpha.2
### Patch Changes
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
## @mastra/memory@1.41.0-alpha.1
### Patch Changes
- dependencies updates:
([#29124](https://github.com/mastra-ai/mastra/pull/29124))
- Updated dependency [`diff@^9.0.0`
↗︎](https://www.npmjs.com/package/diff/v/9.0.0) (from `^8.0.4`, in
`dependencies`)
- Observational Memory now tells the Observer who sent each user signal.
In a thread shared by several people, messages sent with
`agent.sendMessage({ contents, attributes: { name: 'Alice' } }, ...)`
are labeled `User (name="Alice")` when observed, so observations can say
who said what instead of attributing everything to "User". Messages
without attributes keep the plain `User` label.
([#29176](https://github.com/mastra-ai/mastra/pull/29176))
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
## @mastra/google-cloud-pubsub@1.1.7-alpha.0
### Patch Changes
- dependencies updates:
([#29113](https://github.com/mastra-ai/mastra/pull/29113))
- Updated dependency [`@google-cloud/pubsub@^6.3.1`
↗︎](https://www.npmjs.com/package/@google-cloud/pubsub/v/6.3.1) (from
`^5.3.1`, in `dependencies`)
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
## @mastra/elysia@0.1.22-alpha.1
### Patch Changes
- Updated dependencies
[[`0900c20`](0900c20592),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/server@1.82.0-alpha.1
- @mastra/core@1.82.0-alpha.1
## @mastra/express@1.5.26-alpha.1
### Patch Changes
- Updated dependencies
[[`0900c20`](0900c20592),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/server@1.82.0-alpha.1
- @mastra/core@1.82.0-alpha.1
## @mastra/fastify@1.5.26-alpha.1
### Patch Changes
- Updated dependencies
[[`0900c20`](0900c20592),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/server@1.82.0-alpha.1
- @mastra/core@1.82.0-alpha.1
## @mastra/hono@1.7.24-alpha.1
### Patch Changes
- Updated dependencies
[[`0900c20`](0900c20592),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/server@1.82.0-alpha.1
- @mastra/core@1.82.0-alpha.1
## @mastra/koa@1.7.26-alpha.1
### Patch Changes
- Updated dependencies
[[`0900c20`](0900c20592),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/server@1.82.0-alpha.1
- @mastra/core@1.82.0-alpha.1
## @mastra/nestjs@0.2.41-alpha.1
### Patch Changes
- Updated dependencies
[[`0900c20`](0900c20592),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/server@1.82.0-alpha.1
- @mastra/core@1.82.0-alpha.1
## @mastra/next@0.2.40-alpha.1
### Patch Changes
- Updated dependencies
[[`0900c20`](0900c20592),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/server@1.82.0-alpha.1
- @mastra/core@1.82.0-alpha.1
- @mastra/hono@1.7.24-alpha.1
## @mastra/tanstack-start@0.2.40-alpha.1
### Patch Changes
- Updated dependencies
[[`0900c20`](0900c20592),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/server@1.82.0-alpha.1
- @mastra/core@1.82.0-alpha.1
- @mastra/hono@1.7.24-alpha.1
## @mastra/mysql@0.16.0-alpha.1
### Patch Changes
- Fixed experiment result writes putting plaintext back over a purged
dataset item. When a purge committed while a result was being written,
the writer could miss the purge marker and overwrite the redacted input,
output, ground truth, error and metadata.
([#29106](https://github.com/mastra-ai/mastra/pull/29106))
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
## @mastra/inngest@1.11.1-alpha.0
### Patch Changes
- Fixed `InngestRun.watch()` crashing the process with an unhandled
rejection when the Inngest realtime subscription fails to connect (for
example `fetch failed` or a WebSocket error). The failure is now logged
as a warning and the run still completes through polling. Unwatching now
also closes the realtime connection instead of leaving it open.
([#29103](https://github.com/mastra-ai/mastra/pull/29103))
- Fixed Inngest durable agents ending the `model_generation` trace span
without `responseId` and `responseModel`. The span now carries the
provider's response id and model, the same as non-durable agents. Fixes
#29053. ([#29180](https://github.com/mastra-ai/mastra/pull/29180))
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
## @mastra/temporal@0.5.0-alpha.1
### Patch Changes
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
- @mastra/deployer@1.82.0-alpha.1
## @mastra/e2b@0.16.1-alpha.0
### Patch Changes
- dependencies updates:
([#27993](https://github.com/mastra-ai/mastra/pull/27993))
- Updated dependency [`e2b@^2.62.0`
↗︎](https://www.npmjs.com/package/e2b/v/2.62.0) (from `^2.61.0`, in
`dependencies`)
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
## @mastra/e2b-desktop@0.1.12-alpha.0
### Patch Changes
- dependencies updates:
([#27993](https://github.com/mastra-ai/mastra/pull/27993))
- Updated dependency [`e2b@^2.62.0`
↗︎](https://www.npmjs.com/package/e2b/v/2.62.0) (from `^2.61.0`, in
`dependencies`)
- Updated dependencies
[[`5735a50`](5735a50c6c),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/e2b@0.16.1-alpha.0
- @mastra/core@1.82.0-alpha.1
## @mastra/platform-workspace@1.11.1-alpha.0
### Patch Changes
- dependencies updates:
([#27993](https://github.com/mastra-ai/mastra/pull/27993))
- Updated dependency [`e2b@^2.62.0`
↗︎](https://www.npmjs.com/package/e2b/v/2.62.0) (from `^2.61.0`, in
`dependencies`)
- Updated dependencies
[[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/core@1.82.0-alpha.1
## create-mastra@1.38.0-alpha.1
## @internal/playground@1.38.0-alpha.1
### Patch Changes
- Updated dependencies
[[`0900c20`](0900c20592),
[`8751dd7`](8751dd7f56),
[`682e8f3`](682e8f3e44),
[`3314289`](33142896c1),
[`0900c20`](0900c20592),
[`ebf8a9a`](ebf8a9a137)]:
- @mastra/client-js@1.59.0-alpha.1
- @mastra/core@1.82.0-alpha.1
- @mastra/playground-ui@68.0.0-alpha.1
- @mastra/react@1.14.1-alpha.1
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
> Opened by @DSchau
## Summary
Today the env a factory deployment passes to its sandboxes reaches every
factory's sessions. A deployment hosting several factories (Shipyard
runs mastra, platform and website) can't give a credential to just one
of them.
This PR adds two fields to `FactorySandboxContext`:
- `factoryId`: the session's factory project id. Environment builds get
it from the project.
- `factoryName`: the factory's display name, for logs and readable
config.
Every factory sandbox provider (`LocalFactorySandbox`,
`PlatformFactorySandbox`, `E2BFactorySandbox`, `DockerFactorySandbox`)
now accepts `env` as either a record (unchanged) or a function of the
context:
```ts
new PlatformFactorySandbox({
env: ctx => (ctx.factoryId === PLATFORM_FACTORY_ID ? { PLATFORM_TOKEN } : {}),
});
```
Names can be edited and aren't unique, so the docs say to scope secrets
by `factoryId`, never by name. Sessions created before factories existed
carry neither field.
The change is non-breaking. The record form behaves exactly as before,
and both context fields are optional, so third-party `FactorySandbox`
implementations keep compiling.
## Proof
- Every provider gets a new test where an env function gives the
credential to the matching factory and nothing to another factory (or to
a legacy session with no factory). The existing record-form `env` tests
still pass unchanged.
- `workspace.test.ts`: the session sandbox context now includes
`factoryId`/`factoryName` for a factory session and neither for a
session without a factory. `build.test.ts`: the environment build
context carries both.
- `tsc --noEmit` is clean for `@mastra/factory`, `@mastra/e2b`,
`@mastra/docker` and `@mastra/platform-workspace` against freshly built
core.
## Unverified
- I haven't run it end to end on a deployed Factory. Shipyard's own
config change (gating the token to the platform factory) is a follow-up
once this is released.
Risk: low
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
A factory can choose which environment variables each session receives.
This helps keep one factory’s credentials away from sessions that belong
to other factories.
## What changed
- Added optional `factoryId` and `factoryName` fields to
`FactorySandboxContext`. Sessions created before factories existed do
not have these fields.
- Added the factory ID and name to sandbox contexts for sessions
associated with a factory.
- Updated the Local, Platform, E2B, and Docker sandbox providers to
accept `env` as a fixed record or a function of the session context.
- Documented how to use `factoryId` to scope secrets. Factory names can
change and are not unique.
- Documented that Platform and Docker sandboxes keep their initial
environment when resumed. Recreate a running sandbox to remove a
credential.
## Testing
The PR description reports provider tests for factory-specific
credentials, context tests in `workspace.test.ts` and `build.test.ts`,
and clean `tsc --noEmit` checks for the affected packages. The author
reports that the change was not tested end to end on a deployed Factory.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
Enable `no-useless-return` in the shared configuration. Remove 28
terminal bare returns, use 31 explicit switch breaks, and retain 12
value-returning contracts with explicit `undefined`. Preserve 13
intentional guards with local explanations, including index-skipping
property reads and the platform availability probe.
Reviewed every edit and checked that removed returns and new switch
breaks have no effectful continuation before function exit, including
cleanup through `finally`. All other source and emitted JavaScript
syntax is preserved apart from formatting, and all 2,020 function return
types and 3,280 variable binding types in the 59 affected source files
are unchanged. The new rule reports zero violations across 15,106 files.
CI lint and build, the local 57-task build, Factory build, core
typecheck, formatting, and whitespace checks pass.
All 756 focused tests pass across stream conversions, idle-loop cleanup,
workflow validation, Factory, Factory UI, Playground UI, Datadog,
Sentry, Cloudflare, and E2B. Both selected published-package monorepo
E2E cases pass. The extended build case covers a missing application
`.npmrc` and verifies successful builds with dependency installation
both skipped and enabled.
The DuckDB CI job also fails two existing capability-list assertions
because their expected arrays omit `span-aggregate`. Both failures were
reproduced on unchanged base `f4cbdb4d78`; DuckDB and core storage files
are unchanged by this PR.
No changeset is included for this lint maintenance, as requested; the
changeset check is expected to fail. Keep this PR as a draft.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
This PR teaches the shared lint configuration to flag returns that do
not change what a function does. It updates the affected code so it
still exits at the right point, while keeping returns that are needed to
return a value or protect an intentional guard.
## Summary
- Enables `no-useless-return` as an error in the shared Oxlint
configuration.
- Removes redundant terminal returns, replaces switch-case returns with
`break` where execution continues after the switch, and keeps
value-returning contracts explicit.
- Adds local explanations or lint suppressions for intentional guards.
- Adds assertions that the monorepo build test leaves `.npmrc` files
absent when installation is skipped.
The author reports that source and emitted JavaScript syntax, apart from
formatting, and the return types and variable binding types across all
59 affected files remain unchanged. The author also reports reviewing
changes for effects before function exit, including cleanup through
`finally`.
## Validation and status
The author reports zero violations across 15,106 files and passing CI
lint and build, the local 57-task build, Factory build, core typecheck,
formatting, whitespace checks, 756 focused tests, and two selected
published-package monorepo E2E cases.
The author reports two DuckDB CI failures in existing capability-list
assertions because the expected arrays omit `span-aggregate`. The author
reports reproducing both failures on unchanged base `f4cbdb4d78`; DuckDB
and core storage files were not changed.
No changeset is included, as requested. The author expects the changeset
check to fail and requests that the PR remain a draft.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Node.js Oct 2026 security release (v22.23.4 / v24.22.1): fixes Brotli
OOB write RCE CVE-2026-111497, TLS hostname-verification bypasses, dns
NUL truncation, eMudhra CA distrust, undici/OpenSSL/c-ares updates.
Bumps the Node pins in this repo: 24.22.1 for CI and the default E2B
template, 24.22.1 and 22.23.4 for the starter templates and the
otel-bridge example. `node:22-*` image tags stay floating, so they
resolve to the patched release on their own, and engine ranges are
unchanged.
⚠️ 24h soak rule: nodejs.org dist published 2026-10-21 10:33 UTC. Docker
`node:22.23.4-slim`/`-bookworm-slim` published 2026-10-21 17:38 UTC (24h
at 1:38 PM EDT Oct 22); `node:22.23.4-alpine` published 2026-10-22 02:39
UTC (24h at 10:39 PM EDT Oct 22). Do not merge before then.
After merge, images must be rebuilt and redeployed for the fix to take
effect.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
This PR updates Node.js versions used by CI, templates, and E2B sandbox
defaults. It brings them to the versions identified in the PR
description as security updates.
## Changes
- Updates Node.js 24 pins in GitHub Actions workflows and the setup
action from `24.22.0` to `24.22.1`.
- Updates the default Node.js version for E2B templates to `24.22.1`.
- Updates Node.js pins in two templates and an observability example to
`22.23.4` or `24.22.1`.
- Adds a test for the E2B default template’s version-based identity and
a patch changeset for `@mastra/e2b`.
The supplied change summary does not confirm updates to floating
`node:22-*` tags. It does not provide test results or current review
findings.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Justin Levine <20596508+jal-co@users.noreply.github.com>
## What
`PlatformSandbox` now has a full process manager. Background processes:
- stream stdout and stderr while they run, instead of only when they
exit
- can be stopped with `kill()`
- show up in `list()` (running ones, plus exited ones whose output
hasn't been read)
- can be attached to with `get(pid)`, for example after your app
restarts
Processes have no time limit unless you set `timeout`. A long-running
process's output stream reconnects periodically; output written during a
reconnect is lost.
Also:
- **`@mastra/core`:** `SandboxProcessManager.get(pid, { release: false
})` reads an exited process without dismissing it, so one reader doesn't
take output from another (such as the agent's `get_process_output`). The
default is unchanged.
- **`@mastra/e2b`:** `E2BProcessManager` now uses the same shared
implementation. `list()` also returns exited processes until they're
read and shows the command you ran instead of the `/bin/bash -l -c`
wrapper, and a process attached with `get(pid)` is no longer cut off
after 60 seconds.
## How
- The process manager lives in `@internal/workspace`
(`CommandsApiProcessManager`), next to the shared files code. Each
provider supplies one hook, `runCommands(operation, fn)`, that runs a
call with its own retry rules. `E2BProcessManager` is a thin subclass.
- `PlatformSandbox` supplies its own hook and handle. It never replays a
spawn or kill, and maps a destroyed sandbox to `SandboxDestroyedError`.
## Proof
Live, on a real `PlatformSandbox`:
- A `for … echo; sleep 1` loop streamed stdout and stderr while running.
`kill()` → `true`, `wait()` → exit `-1`, it left the running list,
stayed readable with `release: false`, and a second `kill()` → `false`.
- A second `PlatformSandbox` on the same sandbox listed and attached to
the running process and received its new output.
- A 420s process kept streaming past a reconnect and `wait()` returned
its real exit code `5`.
Live, on E2B: the sandbox conformance suite gives identical results with
this branch and with `main`'s process manager (93 passed, 35 skipped).
## Tests
- `@internal/workspace`: shared manager over real host processes
(streaming, exit mapping, kill, stdin, attach, list with exited, no
deadline on attach).
- `@mastra/platform-workspace`: `sandbox-processes.test.ts`
(reconnecting, a process that ended before it could be reattached,
retrying after an unreachable sandbox, destroyed sandbox, no replay,
timeouts).
- `@mastra/e2b`: existing suite plus `list()` returning an unread exited
process.
- `@mastra/core`: `get(pid, { release: false })`.
Each fix has a test that fails without it.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
This PR lets sandbox processes run in the background, stream output,
stop, and reconnect later. It also preserves process status and unread
output when sandbox leases change.
## Summary
- Added shared command-based process management in
`@internal/workspace`.
- Added streaming `spawn()`, `list()`, `get()`, `kill()`, stdin support,
timeouts, and process reattachment.
- Kept unread exited processes in `list()` until `get()` consumes them.
- Added `get(pid, { release: false })` to inspect exited processes
without releasing them.
- Updated `E2BProcessManager` to use the shared implementation.
- Added lease-aware E2B command access with authentication retries and
sandbox-destruction handling.
- Added E2B process support to `PlatformSandbox`.
- Kept Railway sandboxes on the existing exec-backed process manager.
- Added documentation, changesets, and tests.
Known limitation: output produced during stream reconnection can be
lost.
Reported validation covers the core process manager, workspace, E2B, and
platform-workspace suites. Reported TypeScript checks for E2B and
platform-workspace and the MDX format check passed.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: CalebBarnes <CalebBarnes@users.noreply.github.com>
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
Factory's `SandboxFilesystem` reads and writes files in a remote sandbox
by running shell commands: one `readFile` is a containment `realpath`
check plus a `base64` exec, and a write is three execs. On a Platform
sandbox each exec is a full round trip, so the agent's file tools and
the session Files tab pay 75–130ms per operation.
This adds an optional `filesystem` to `WorkspaceSandbox` so a provider
can expose its own file API, and implements it for `E2BSandbox` and
`PlatformSandbox` over E2B's envd files API. `PlatformSandbox` talks
straight to the VM with the same cached lease `executeCommand` already
uses, so there's no extra hop through Platform and no extra lease.
```ts
const sandbox = new PlatformSandbox();
await sandbox.filesystem?.readFile('/workspace/app/package.json', { encoding: 'utf-8' });
```
Both providers share one implementation in the private
`@internal/workspace` package, bundled into each. Single-entry
operations (`readFile`, `writeFile`, `stat`, `exists`, `readdir`,
`mkdir`, `deleteFile`, `rmdir`) are one files-API call. Copies, moves,
appends and `overwrite: false` writes run as one command inside the VM
(`cp -R -P`, `mv -n`, upload to a temp file then `ln` or `cat >>`), so
they're atomic, keep symlinks, and file contents never travel through
the server.
When the sandbox has one, `SandboxFilesystem` hands every file operation
to it; only grep and file walks still run as shell commands. The `..`
path check stays. The in-VM symlink check is skipped by default, since
the agent can already read anything in its VM with a command; the new
`verifySymlinks: true` option keeps it (once per path per instance), and
the Files tab route turns it on because it serves sandbox files over
HTTP to anyone viewing the session.
Measured on a real Platform sandbox (median, shell → native, commands
per op in brackets):
| Operation | Shell | Native |
|---|---|---|
| readFile small | 86ms (2) | 31ms (0) |
| readFile ~2MB | 507ms (2) | 275ms (0) |
| writeFile 4KB | 128ms (3) | 32ms (0) |
| stat | 83ms (2) | 31ms (0) |
| readdir | 81ms (2) | 35ms (0) |
| exists | 38ms (1) | 33ms (0) |
| mkdir | 131ms (3) | 31ms (0) |
| copyFile ~2MB | 183ms (4) | 48ms (1) |
| copyFile folder | 166ms (4) | 44ms (1) |
| appendFile 4KB | 132ms (3) | 76ms (1) |
| writeFile `overwrite: false` | 125ms (3) | 70ms (1) |
| moveFile `overwrite: false` | 158ms (4) | 44ms (1) |
| `view` tool | 236ms (6) | 92ms (0) |
| `edit_file` tool | 280ms (7) | 92ms (0) |
| `write_file` tool | 199ms (5) | 65ms (0) |
| Files tab open (stat + read, `verifySymlinks`) | 167ms (4) | 111ms (1)
|
The whole run minted one lease. 11 edge cases checked on the VM (GNU
coreutils) all passed: no-clobber writes onto a file, directory or link
to a directory, folder copy merging and keeping symlinks, file onto a
directory, no-clobber copy and move, append, no temp files left behind.
Platform file calls retry once, and only that single call, after an auth
rejection (which proves the request wasn't processed). A dead VM drops
the cached lease so the next call surfaces `SandboxDestroyedError` like
exec does. E2B wraps each call in `retryOnDead`. Platform sandboxes that
aren't backed by E2B throw a clear error from `filesystem`, since E2B is
the only live provider. File commands on Platform get a 10-minute
timeout when the sandbox sets none, since a recursive copy can be large.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
This PR lets supported sandboxes read and change files directly inside
the sandbox. This reduces extra round trips and adds safer handling for
symlinks, retries, and stopped sandboxes.
## Summary
- Added optional `WorkspaceSandbox.filesystem` support.
- Implemented native filesystem access for `E2BSandbox` and E2B-backed
`PlatformSandbox`.
- Added reads, writes, appends, copies, moves, deletes, directory
operations, listings, existence checks, and stats.
- Kept `grep` and file walks shell-based.
- Added atomic VM commands for copies, moves, appends, and no-overwrite
writes.
- Added optional symlink verification. The Files route enables
`verifySymlinks: true`.
- Added typed filesystem errors, lease caching, dead-sandbox detection,
lease invalidation, and one authentication retry for Platform file
calls.
- Prevented retries of potentially completed Platform filesystem
mutations. Ordinary command execution retains retry behavior.
- Added a 10-minute default timeout for Platform file commands.
- Kept native filesystem support unavailable for non-E2B Platform
sandboxes so shell fallback remains available.
- Added unit, conformance, type-level, route, and edge-case coverage.
- Added documentation and package changesets.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: CalebBarnes <CalebBarnes@users.noreply.github.com>
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.
⚠️⚠️⚠️⚠️⚠️⚠️
`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.
⚠️⚠️⚠️⚠️⚠️⚠️
# Releases
> The changelog information of each package has been omitted from this
message, as the content exceeds the size limit.
## @mastra/factory@0.23.0-alpha.3
## @mastra/code-sdk@1.14.0-alpha.3
## @mastra/core@1.78.0-alpha.3
## @mastra/memory@1.38.0-alpha.0
## @mastra/playground-ui@63.1.0-alpha.3
## @mastra/client-js@1.54.1-alpha.3
## @mastra/react@1.10.1-alpha.3
## @mastra/deployer-cloud@1.78.0-alpha.3
## @mastra/deployer-cloudflare@1.2.37-alpha.1
## @mastra/longmemeval@1.1.37-alpha.3
## @mastra/opencode@0.1.37-alpha.3
## create-factory@0.2.10-alpha.3
## mastracode@0.47.1-alpha.3
## @mastra/agent-builder@1.1.29-alpha.0
## mastra@1.34.2-alpha.3
## @mastra/deployer@1.78.0-alpha.3
## @mastra/editor@0.16.3-alpha.0
## @mastra/mcp-docs-server@1.3.8-alpha.4
## @mastra/schema-compat@1.3.15-alpha.0
## @mastra/server@1.78.0-alpha.3
## @mastra/elysia@0.1.18-alpha.3
## @mastra/express@1.5.22-alpha.3
## @mastra/fastify@1.5.22-alpha.3
## @mastra/hono@1.7.20-alpha.3
## @mastra/koa@1.7.22-alpha.3
## @mastra/nestjs@0.2.37-alpha.3
## @mastra/next@0.2.36-alpha.3
## @mastra/tanstack-start@0.2.36-alpha.3
## @mastra/clickhouse@1.25.1-alpha.1
## @mastra/duckdb@1.14.1-alpha.0
## @mastra/pg@1.31.2-alpha.1
## @mastra/voice-google-gemini-live@0.14.16-alpha.0
## @mastra/voice-openai-realtime@0.14.6-alpha.0
## @mastra/voice-sarvam@1.1.2-alpha.0
## @mastra/voice-xai-realtime@0.2.15-alpha.0
## @mastra/temporal@0.4.16-alpha.3
## @mastra/e2b@0.14.1-alpha.0
## @mastra/e2b-desktop@0.1.8-alpha.0
## @mastra/platform-workspace@1.8.1-alpha.0
## create-mastra@1.34.2-alpha.3
## @internal/playground@1.34.2-alpha.3
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Summary
In Factory's sandbox settings, memory was a free number field (MB) that
accepted 512–65536. That made users type exact megabytes and allowed
sizes the sandbox provider doesn't support: E2B caps memory at 8 GiB by
default.
Memory is now a dropdown of labelled sizes: **512 MB, 1 GB, 2 GB, 4 GB,
8 GB**.
- **`@mastra/platform-workspace` and `@mastra/e2b`**: the `memoryMb`
setting is declared as a JSON Schema `oneOf` of `{ const, title }`
entries, capped at 8 GB. Other values fail validation. The row title
changes from "Memory (MB)" to "Memory", since the labels carry the
units.
- **Factory settings UI**: settings render as a select when the schema
has an `enum` or a `oneOf` of consts, with each `title` used as the
label. When the default is one of the options, that option is marked
"(default)" instead of also listing a separate "Default (…)" item, and
choosing it clears the setting. A separate "Default" item still appears
when the default isn't one of the options.
- **`@mastra/factory`**: saving a sandbox setting re-checks every stored
setting. Before, if a stored value no longer passed the provider's
schema (for example, a memory size saved under the old 512–65536 range),
every later save for that environment failed. Stored values the schema
now rejects are dropped on save, so the provider default applies. Values
the request itself sets are never dropped, so an invalid new value is
still refused.
CPU stays a number input.
## Test plan
- [x] `workspaces/platform-workspace` and `workspaces/e2b`: tests check
the advertised choices, that 8192 is accepted, and that 3000 and 16384
are rejected
- [x] `mastracode/factory` route test: an environment with an
out-of-range stored value can still save another setting, and the stale
value is dropped. It fails without the fix (400) and passes with it.
Setting the invalid value directly is still refused.
- [x] `mastracode/factory-ui` MSW: the select shows "1 GB (default)"
with no duplicate, picking "8 GB" saves `memoryMb: 8192`, and picking
the default saves `null`
- [x] Typecheck for the changed packages (factory's existing typecheck
errors are unchanged by this PR)
- [x] Checked by hand in the local dev setup
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
Factory sandbox memory now offers five supported sizes instead of
accepting any number. When an update contains an old saved size that is
no longer allowed, Factory can remove it, but it still rejects invalid
values in the update.
## Changes
- `@mastra/platform-workspace` and `@mastra/e2b` now define memory
choices of 512 MB, 1 GB, 2 GB, 4 GB, and 8 GB.
- Factory settings render supported `enum` and const-based `oneOf`
schemas as dropdowns. The UI labels a matching default choice
“(default)” and clears the setting when that choice is selected. CPU
remains a number input.
- Factory drops stale stored settings that fail the current sandbox
schema during an update. It still rejects invalid values supplied in the
current patch.
- Added changesets and tests for memory choices, validation, stale
stored settings, and dropdown behavior.
Test execution results and typecheck status were not independently
verified.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: CalebBarnes <CalebBarnes@users.noreply.github.com>
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
## Why
Factory keeps growing features that need something from the sandbox
provider: per-project settings (CPU, memory, idle timeout), a template
built ahead of a session, build history, and later builds on a schedule
or on push. Until now the only hook a host had was a bare callback that
returned a sandbox, so every new feature meant another callback on
`MastraFactory` and provider-specific knowledge leaking into factory.
`FactorySandbox` adds one object per provider with a stable contract
between factory and the provider. Factory asks the object what it can do
and renders accordingly; providers add features by implementing an
optional method, not by changing factory. The change is backwards
compatible: a host that passes the `sandbox` callback today keeps
working unchanged. Factory wraps it as a `custom` provider, so sessions
boot exactly as before; the host just does not get the new features
(per-project settings, template builds, or any later capability) until
it moves to a `FactorySandbox`.
## What
A host configures where Factory sessions run with one object:
```ts
new MastraFactory({
sandbox: new PlatformFactorySandbox({ defaults: { cpuCount: 4, memoryMb: 8192 } }),
})
```
`FactorySandbox` (in `@mastra/core/workspace`) owns:
- **The session sandbox.** `create(ctx, settings)` constructs the
sandbox for a session, with the environment's working directory handed
through so the session finds the template's checkouts where the template
cloned them.
- **The template.** `template(ctx, settings)` describes the repository
template a session boots from, so the same definition drives a session
and an ahead-of-time build.
- **Settings.** Each provider declares the settings a user can tune per
project as a schema (`PublicSchema`, any flavor). Factory validates
against it on write and exposes the input-side JSON Schema on the wire,
which is what the Environment settings page renders: one row per
property, typed by the schema (integer, enum, boolean), with provider
defaults as placeholders. A provider with no settings renders nothing.
Adding a setting is a one-line change in the provider.
- **Optional capabilities.** `builds` (start, get, list) is the first
one. Factory describes what is present through
`MastraFactory.sandboxDescription` (`provider`, `settingsSchema`,
`capabilities`) and the UI shows a Builds section only when the provider
has it. A provider that does not build simply omits the method.
Factory detects the object by a `Symbol.for('mastra.factory.sandbox')`
brand, so no instanceof across package boundaries.
Providers:
- `@mastra/platform-workspace`: `PlatformFactorySandbox` (`cpuCount`,
`memoryMb`, `idleTimeoutMinutes`, provider-side `defaults`). The `start
complete` log line gains a `templateHash` of the serialized template.
- `@mastra/e2b`: `E2BFactorySandbox` (`cpuCount`, `memoryMb`,
`idleTimeoutMinutes`) with `builds` (`start` via
`Template.buildInBackground`, `get` with logs, `list` from the
template's build history).
- `@mastra/docker`: `DockerFactorySandbox` (`baseImage`, `owner`).
- `@mastra/factory`: `sandbox` accepts a `FactorySandbox` or the
existing callback. The callback keeps working, wrapped as `provider:
'custom'` with no settings and no capabilities; `LocalFactorySandbox({
root, env })` replaces hand-rolled local fallbacks.
- The web host constructs the class with the same
local/platform/E2B/local precedence it had.
- Docs: `reference/workspace/factory-sandbox` plus the E2B per-session
example.
The single-repo `createRepoTemplate` functions are unchanged; a unit
test pins that the class produces the same template definition and build
envs as the callback form for the web and shipyard hosts.
## Test plan
- `packages/core`: `vitest run src/workspace/factory-sandbox.test.ts`
(9), `src/workspace/factory-sandbox.test-d.ts` (2), `pnpm check`
- `workspaces/platform-workspace`: `vitest run` 268 passed, `tsc
--noEmit`
- `workspaces/e2b`: `vitest run` 265 passed (mocked SDK covers
`start`/`get`/`list`), `tsc --noEmit`
- `workspaces/docker`: `vitest run` 336 passed, `tsc --noEmit`
- `mastracode/factory`: `vitest run` 3589 passed, `tsc --noEmit`, `pnpm
lint`
- `mastracode/web`: `pnpm check`
- `docs`: `pnpm format:check`
Closes FACT-384
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
This PR gives Factory one consistent way to create a sandbox for each
session. It also lets sandbox providers describe their settings and
whether they can prepare repository templates or report build status.
## Changes
- Added the branded `FactorySandbox` contract to
`@mastra/core/workspace`. `MastraFactory` exposes the provider, settings
schema, and available capabilities through `sandboxDescription`.
- Updated `MastraFactory` to accept a `FactorySandbox` instance or the
existing callback. Factory wraps callbacks as `custom` providers without
settings or capabilities.
- Added `PlatformFactorySandbox`, `E2BFactorySandbox`,
`DockerFactorySandbox`, and `LocalFactorySandbox`.
- Updated Factory workspace and integration types to use
`FactorySandbox`. Updated the web host to select a provider using its
existing local, platform, and E2B configuration precedence.
- Added tests, exports, changesets, and documentation. Platform sandbox
start logs include a template hash when a template is used.
## Validation and review
The PR objectives report package tests, type checks, lint, and
documentation formatting checks. These results were not independently
verified. The PR objectives report the label `tests: green ✅`. The
supplied comments contain no review findings. Review severity counts are
unavailable.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: CalebBarnes <CalebBarnes@users.noreply.github.com>
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.
⚠️⚠️⚠️⚠️⚠️⚠️
`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.
⚠️⚠️⚠️⚠️⚠️⚠️
# Releases
## @mastra/code-sdk@1.12.0-alpha.9
### Minor Changes
- Added a `--pack <id>` flag to headless mode (`mastracode -p ... --pack
anthropic`). It resolves builtin pack ids and saved custom packs
(`custom:<name>` or bare name), exits with the list of valid packs on
unknown ids, and applies the pack like `/models` → Activate: mode
models, subagent models, model route, and thread `activeModelPackId`. An
explicit `--model` still wins over the pack for the active mode.
([#26691](https://github.com/mastra-ai/mastra/pull/26691))
**Example**
```bash
mastracode -p "summarize this repo" --pack anthropic
mastracode -p "fix the tests" --pack Kimi --model openai/gpt-5.5
```
### Patch Changes
- Fixed per-agent-type subagent model selections
(`subagentModelId_explore/plan/execute`) being stripped from session
state by schema validation. Pack activation (`/models` → Activate or
`--pack`) assigned subagent models, but the next session state update
silently dropped them, so subagents fell back to their default models.
([#26691](https://github.com/mastra-ai/mastra/pull/26691))
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
## mastracode@0.46.0-alpha.9
### Minor Changes
- Added a `--pack <id>` startup flag to the interactive TUI. It accepts
a builtin pack id (`anthropic`, `openai`, `github-copilot`) or a saved
custom pack by `custom:<name>` or bare name. Unknown ids fail fast with
the list of valid packs. Startup uses the pack's models for the session
and saves the pack as the global default. `--pack` takes precedence over
`MASTRACODE_MODEL_ID`.
([#26691](https://github.com/mastra-ai/mastra/pull/26691))
**Example**
```bash
mastracode --pack anthropic
mastracode --pack custom:Kimi
mastracode --pack Kimi
```
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`fdd4587`](fdd4587842),
[`fdd4587`](fdd4587842),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/code-sdk@1.12.0-alpha.9
## @mastra/e2b@0.13.0-alpha.3
### Minor Changes
- Added a `reattach` option to `RailwaySandbox`, `PlatformSandbox`, and
`E2BSandbox` to control what happens when a persisted `sandboxId` can't
be reattached on `start()`.
([#26675](https://github.com/mastra-ai/mastra/pull/26675))
- `'best-effort'` (default, unchanged behavior): carry on without the
lost sandbox. Railway and Platform provision a replacement; E2B first
looks for another sandbox with the same logical `id` and only creates a
new one if none is found.
- `'required'`: throw a `SandboxError` with code
`SANDBOX_REATTACH_FAILED` instead, so the caller can tell the user their
previous sandbox (and its state) is gone rather than silently starting a
fresh one.
Transient errors such as auth, rate limit, or network failures still
propagate unchanged. Clones inherit the parent's `reattach` setting.
```ts
const sandbox = new RailwaySandbox({ sandboxId: session.sandboxId,
reattach: 'required' });
try {
await sandbox.start();
} catch (error) {
if (error instanceof SandboxError && error.code ===
'SANDBOX_REATTACH_FAILED') {
// Previous sandbox is gone: ask the user to start fresh, then clear the
persisted sandboxId.
}
}
```
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
## @mastra/platform-workspace@1.7.0-alpha.2
### Minor Changes
- Added a `reattach` option to `RailwaySandbox`, `PlatformSandbox`, and
`E2BSandbox` to control what happens when a persisted `sandboxId` can't
be reattached on `start()`.
([#26675](https://github.com/mastra-ai/mastra/pull/26675))
- `'best-effort'` (default, unchanged behavior): carry on without the
lost sandbox. Railway and Platform provision a replacement; E2B first
looks for another sandbox with the same logical `id` and only creates a
new one if none is found.
- `'required'`: throw a `SandboxError` with code
`SANDBOX_REATTACH_FAILED` instead, so the caller can tell the user their
previous sandbox (and its state) is gone rather than silently starting a
fresh one.
Transient errors such as auth, rate limit, or network failures still
propagate unchanged. Clones inherit the parent's `reattach` setting.
```ts
const sandbox = new RailwaySandbox({ sandboxId: session.sandboxId,
reattach: 'required' });
try {
await sandbox.start();
} catch (error) {
if (error instanceof SandboxError && error.code ===
'SANDBOX_REATTACH_FAILED') {
// Previous sandbox is gone: ask the user to start fresh, then clear the
persisted sandboxId.
}
}
```
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
## @mastra/railway@0.10.0-alpha.0
### Minor Changes
- Added a `reattach` option to `RailwaySandbox`, `PlatformSandbox`, and
`E2BSandbox` to control what happens when a persisted `sandboxId` can't
be reattached on `start()`.
([#26675](https://github.com/mastra-ai/mastra/pull/26675))
- `'best-effort'` (default, unchanged behavior): carry on without the
lost sandbox. Railway and Platform provision a replacement; E2B first
looks for another sandbox with the same logical `id` and only creates a
new one if none is found.
- `'required'`: throw a `SandboxError` with code
`SANDBOX_REATTACH_FAILED` instead, so the caller can tell the user their
previous sandbox (and its state) is gone rather than silently starting a
fresh one.
Transient errors such as auth, rate limit, or network failures still
propagate unchanged. Clones inherit the parent's `reattach` setting.
```ts
const sandbox = new RailwaySandbox({ sandboxId: session.sandboxId,
reattach: 'required' });
try {
await sandbox.start();
} catch (error) {
if (error instanceof SandboxError && error.code ===
'SANDBOX_REATTACH_FAILED') {
// Previous sandbox is gone: ask the user to start fresh, then clear the
persisted sandboxId.
}
}
```
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
## @mastra/sprites@0.1.0-alpha.0
### Minor Changes
- Added `@mastra/sprites`, a workspace sandbox provider for [Fly.io
Sprites](https://sprites.dev). `SpritesSandbox` gets or creates a Sprite
by name, so files persist across sessions, and runs commands with
streaming output, timeouts, cancellation, and background processes with
stdin. `stop()` keeps the Sprite, `destroy()` deletes it, and
`snapshot()` captures a checkpoint. Requires Node.js 24 or later.
([#26650](https://github.com/mastra-ai/mastra/pull/26650))
```typescript
import { Workspace } from '@mastra/core/workspace';
import { SpritesSandbox } from '@mastra/sprites';
const workspace = new Workspace({
sandbox: new SpritesSandbox({ id: 'mastra-project', token:
process.env.SPRITES_TOKEN }),
});
```
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
## @mastra/client-js@1.53.0-alpha.9
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
## @mastra/react@1.9.0-alpha.9
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/client-js@1.53.0-alpha.9
## @mastra/deployer-cloud@1.76.0-alpha.9
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`3bb1a21`](3bb1a21ec9),
[`b7d95a4`](b7d95a4cac),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/loggers@1.3.6-alpha.5
- @mastra/deployer@1.76.0-alpha.9
## @mastra/longmemeval@1.1.35-alpha.9
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
## @mastra/opencode@0.1.35-alpha.9
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
## @mastra/factory@0.21.0-alpha.9
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`fdd4587`](fdd4587842),
[`fdd4587`](fdd4587842),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/code-sdk@1.12.0-alpha.9
## create-factory@0.2.8-alpha.9
### Patch Changes
- Updated dependencies:
- mastra@1.34.0-alpha.9
## mastra@1.34.0-alpha.9
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`3bb1a21`](3bb1a21ec9),
[`b7d95a4`](b7d95a4cac),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/loggers@1.3.6-alpha.5
- @mastra/deployer@1.76.0-alpha.9
## @mastra/core@1.76.0-alpha.9
### Patch Changes
- Fixed retried API errors leaking the failed attempt's partial text.
([#26654](https://github.com/mastra-ai/mastra/pull/26654))
A provider could stream some text, fail mid-stream, and then succeed
when an error processor retried. The final answer came out as the failed
prefix followed by the recovered answer, for example `"The answer is The
answer is 42."`. The retry request also sent the failed prefix back to
the model.
The failed attempt's partial text is now discarded, for both `Agent` and
durable agents. The final `text` and the retry prompt no longer include
it, and neither do `response.messages` and stored messages. Steps that
completed before the failed attempt are kept.
Text chunks already streamed live from the failed attempt still reach
`textStream` and `fullStream` consumers. The step that carries them
finishes with reason `retry`.
- Fixed `resumeStream` ignoring the `requestContext` and `delegation`
you pass when a supervisor run is resumed in the same process that
suspended it. The resumed delegation now calls the `onDelegationStart`
hook from the resume call, and sub-agent tools see the resume call's
`requestContext`. `DurableAgent` tools approved with `approveToolCall`
in the same process now also run with the request context passed to that
call. Fixes [#25960](https://github.com/mastra-ai/mastra/issues/25960).
([#26686](https://github.com/mastra-ai/mastra/pull/26686))
- Fixed agent steps that start directly with a tool call being merged
into the previous step in the conversation history sent to the model.
Calls that ran one after another, where the second used the first's
result, no longer look like parallel calls. Parallel tool calls within a
single step still stay together.
([#26685](https://github.com/mastra-ai/mastra/pull/26685))
## @mastra/deployer@1.76.0-alpha.9
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`cb0201a`](cb0201ab41),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/server@1.76.0-alpha.9
## @mastra/loggers@1.3.6-alpha.5
### Patch Changes
- Fixed `HttpTransport` log queries and `UpstashTransport` error results
returning `page: 0` when called with `page: 0`. They now report page
`1`, consistent with the other transports.
([#26678](https://github.com/mastra-ai/mastra/pull/26678))
- Fixed HTTP and Upstash log transports replacing a supplied `time: 0`
with the current time. Epoch-zero timestamps are now preserved; logs
without a `time` still get the current time.
([#26679](https://github.com/mastra-ai/mastra/pull/26679))
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
## @mastra/mcp-docs-server@1.3.6-alpha.17
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
## @mastra/playground-ui@62.0.0-alpha.9
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/client-js@1.53.0-alpha.9
- @mastra/react@1.9.0-alpha.9
## @mastra/server@1.76.0-alpha.9
### Patch Changes
- Fixed query parameter parsing to safely handle parameter names that
collide with built-in object properties
([#26683](https://github.com/mastra-ai/mastra/pull/26683))
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
## @mastra/elysia@0.1.16-alpha.9
### Patch Changes
- Fixed multipart form parsing to safely handle field names that collide
with built-in object properties
([#26683](https://github.com/mastra-ai/mastra/pull/26683))
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`cb0201a`](cb0201ab41),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/server@1.76.0-alpha.9
## @mastra/express@1.5.20-alpha.9
### Patch Changes
- Fixed multipart form parsing to safely handle field names that collide
with built-in object properties
([#26683](https://github.com/mastra-ai/mastra/pull/26683))
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`cb0201a`](cb0201ab41),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/server@1.76.0-alpha.9
## @mastra/fastify@1.5.20-alpha.9
### Patch Changes
- Fixed multipart form parsing to safely handle field names that collide
with built-in object properties
([#26683](https://github.com/mastra-ai/mastra/pull/26683))
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`cb0201a`](cb0201ab41),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/server@1.76.0-alpha.9
## @mastra/hono@1.7.18-alpha.9
### Patch Changes
- Fixed multipart form parsing to safely handle field names that collide
with built-in object properties
([#26683](https://github.com/mastra-ai/mastra/pull/26683))
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`cb0201a`](cb0201ab41),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/server@1.76.0-alpha.9
## @mastra/koa@1.7.20-alpha.9
### Patch Changes
- Fixed multipart form parsing to safely handle field names that collide
with built-in object properties
([#26683](https://github.com/mastra-ai/mastra/pull/26683))
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`cb0201a`](cb0201ab41),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/server@1.76.0-alpha.9
## @mastra/nestjs@0.2.35-alpha.9
### Patch Changes
- Fixed multipart form parsing to safely handle field names that collide
with built-in object properties
([#26683](https://github.com/mastra-ai/mastra/pull/26683))
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`cb0201a`](cb0201ab41),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/server@1.76.0-alpha.9
## @mastra/next@0.2.34-alpha.9
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`cb0201a`](cb0201ab41),
[`cb0201a`](cb0201ab41),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/server@1.76.0-alpha.9
- @mastra/hono@1.7.18-alpha.9
## @mastra/server-adapters-test-suite@0.1.2-alpha.0
### Patch Changes
- Added coverage for reserved field and parameter names in shared
adapter request parsing tests
([#26683](https://github.com/mastra-ai/mastra/pull/26683))
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`cb0201a`](cb0201ab41),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/server@1.76.0-alpha.9
## @mastra/tanstack-start@0.2.34-alpha.9
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`cb0201a`](cb0201ab41),
[`cb0201a`](cb0201ab41),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/server@1.76.0-alpha.9
- @mastra/hono@1.7.18-alpha.9
## @mastra/voice-openai-realtime@0.14.4-alpha.1
### Patch Changes
- Fixed the `speaker` stream never ending for responses that have no
audio. A response that only calls a tool, a text-only response, or a
response cut off by a dropped socket never got `output_audio.done`, so
its stream stayed open. Anything piping it or waiting for `end` hung,
and repeated tool turns piled up pipes until Node printed a
`MaxListenersExceededWarning`. The stream now ends on `response.done`
(before tools run), and all open streams end when the socket closes or
on `close()`/`disconnect()`.
([#26697](https://github.com/mastra-ai/mastra/pull/26697))
Fixes [#26693](https://github.com/mastra-ai/mastra/issues/26693).
## @mastra/temporal@0.4.14-alpha.9
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/deployer@1.76.0-alpha.9
## create-mastra@1.34.0-alpha.9
## @internal/playground@1.34.0-alpha.9
### Patch Changes
- Updated dependencies
[[`a65d0c7`](a65d0c7888),
[`e89310a`](e89310a8db),
[`590d6ca`](590d6ca9fa)]:
- @mastra/core@1.76.0-alpha.9
- @mastra/client-js@1.53.0-alpha.9
- @mastra/react@1.9.0-alpha.9
- @mastra/playground-ui@62.0.0-alpha.9
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Summary
A repo template can now hold several repositories. `createRepoTemplate`
in `@mastra/platform-workspace` and `@mastra/e2b`, and
`createDockerRepoTemplate` in `@mastra/docker`, accept `repos` instead
of `getRepositoryAccess`:
```ts
createRepoTemplate({
repos: [
{ getRepositoryAccess: getMastraAccess, setupCommand: 'pnpm install --frozen-lockfile' },
{ getRepositoryAccess: getDocsAccess, setupCommand: 'npm install' },
],
workspaceSetupCommand: 'touch .workspace-ready',
continueOnSetupFailure: true,
workingDirectory: '/home/user/repos',
})
```
Each entry resolves its own access and head, is cloned to
`<workingDirectory>/<repo>`, pinned, and runs its `setupCommand` inside
its clone. `workspaceSetupCommand` runs once at the working directory
after every repository. `continueOnSetupFailure` records a failing
per-repository setup in `.mastra-sandbox/setup-failed` and lets the
build continue instead of failing it.
The single-repository form is unchanged: same op order, template names,
tags, identities and `.mastra-sandbox/setup` marker.
## How it works
- Public repositories (access without `authorization`) are built before
private ones, caller order within each group.
- Credentials never enter the image or the template identity. Platform:
`MASTRA_REPOSITORY_ACCESS_TOKEN_<n>` ephemeral build envs. E2B:
`GH_TOKEN_<n>` build envs. Docker: `GH_TOKEN_<n>` build secrets mounted
only in that repository's clone stage.
- Markers under the working directory: `.mastra-sandbox/repos/<repo>`
per repository once every step ran, `.mastra-sandbox/workspace-setup`
after the workspace command, `.mastra-sandbox/setup-failed` (one line
per failing repository) when `continueOnSetupFailure` is on.
- Identity: platform family key `repos:<hash>` over the working
directory and ordered clone URLs. E2B template name hashes working
directory, clone URLs and setup commands; the tag is `sha-<hash>` over
every pinned sha. Changing the repository list starts a new template;
changing setup commands or credentials does not change the family.
- Failure: platform and E2B clone a repository unpinned when its head
cannot be resolved and fall back to the default template when access
cannot be resolved. Docker rejects the whole resolution in either case
(it clones full history and pins by checkout, so there is no unpinned
mode).
- Shared helpers (`guardedSetupCommand`, `repoSetupMarkerPath`, marker
constants) live in `@internal/workspace` so all three packages write the
same layout. `guardedSetupCommand` validates the repository directory
name and runs the setup command through `sh -c` so a stray quote or
comment cannot swallow the failure guard.
- `repos` with `getRepositoryAccess`, or `workspaceSetupCommand` /
`continueOnSetupFailure` without `repos`, throw a `TypeError`. Duplicate
checkout directory names are rejected. Docker rejects a setup command
containing a bare newline.
## Test plan
- [x] `@internal/workspace`, `@mastra/platform-workspace`,
`@mastra/e2b`, `@mastra/docker` vitest suites, tsc, lint, oxfmt
- [x] Serialization tests pin the full op list / Dockerfile for one
single-form and one list-form fixture per package
- [x] Real build through the platform proxy on E2B (two public repos,
one failing setup under `continueOnSetupFailure`): both clones present,
per-repo markers, `setup-failed` lists the failing repo once,
`.workspace-ready` present, `rev-parse HEAD` equals the pin
- [x] Real local Docker build with the same shape; a second `build()`
returns the cached tag
- [x] Docs: `integrations/sandboxes/docker.mdx`,
`integrations/sandboxes/e2b.mdx`,
`reference/workspace/platform-sandbox.mdx`
- [x] Changesets: `@mastra/platform-workspace`, `@mastra/e2b`,
`@mastra/docker` (minor)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
This change lets one sandbox or Docker image contain several
repositories instead of just one. It can set up each repository and, if
configured, keep the build going when a repository’s setup command
fails.
## Summary
- Add `repos` support to `createRepoTemplate` in
`@mastra/platform-workspace` and `@mastra/e2b`, and to
`createDockerRepoTemplate` in `@mastra/docker`.
- Configure each repository with its own access resolver, optional ref,
and setup command. Clone public repositories before private
repositories, preserving order within each group.
- Add per-repository setup markers and an optional workspace setup
command. When `continueOnSetupFailure` is enabled, record repository
setup failures and continue. Other build failures still fail the build.
- Preserve the existing single-repository behavior. Validate
incompatible options, invalid entries, and duplicate checkout
directories.
- Document the new options and export the repository configuration
types.
## Validation
The PR description reports passing Vitest suites, typechecking, lint,
and formatting for the affected packages. It also reports serialization
tests, a platform-proxy build on E2B, and local Docker builds. These
results were not independently verified.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: CalebBarnes <CalebBarnes@users.noreply.github.com>
> Opened by @abhiaiyer91
Fixes#25822
## Summary
`createDefaultMountableTemplate()` extracted the Node tarball over the
E2B base image's `/usr/local`. `tar` only adds and overwrites files; it
never removes old ones. Files from the base image's old npm stayed
behind, including a nested old `minipass` that shadows npm 11's version.
As a result, `npm view`, `npm install -g` and `npx` failed with `Class
extends value undefined is not a constructor or null`.
## Changes
- The template build now removes `/usr/local/lib/node_modules/npm` and
`/usr/local/lib/node_modules/corepack` before extracting Node.
- `MOUNTABLE_TEMPLATE_VERSION` goes from `v3` to `v4`, so cached default
templates rebuild.
- Adds a test for the version and a changeset for `@mastra/e2b` (patch).
## Test plan
- `vitest run src/utils/template.test.ts`: 5 tests pass.
- Not run against a live E2B sandbox; this needs E2B credentials. The
reporter checked the same cleanup in a live sandbox (`npm view bun
version` and `npm install -g` both work after it).
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
The default E2B template could keep old npm files when it installed
Node. This change removes those old files first, so npm tools can work
with the new Node installation.
## Changes
- Remove `/usr/local/lib/node_modules/npm` and
`/usr/local/lib/node_modules/corepack` before extracting Node.
- Bump `MOUNTABLE_TEMPLATE_VERSION` from `v3` to `v4` so cached default
templates rebuild.
- Add a version test and a patch changeset for `@mastra/e2b`.
## Testing
- `vitest run src/utils/template.test.ts` passed 5 tests, as reported.
- A live E2B sandbox test was not run because E2B credentials were
unavailable.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com>
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>