0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/workspaces/_test-utils/tsconfig.json
Caleb Barnes 5b930aba18
feat: E2B sandbox and S3 filesystem with mount support (COR-380, COR-385, COR-484) (#12605)
## Summary

Adds E2B sandbox and S3 filesystem packages with automatic mount
support, enabling agents to access cloud storage from within sandboxed
code execution environments.

### New Packages

- **@mastra/e2b** - E2B sandbox implementation with FUSE mounting
support
- **@mastra/s3** - S3-compatible filesystem (AWS S3, Cloudflare R2,
MinIO, etc.)

### Core Changes

- Add mount types and `FilesystemMountConfig` interface
- Add `CompositeFilesystem` for multi-mount workspaces
- Add mount state tracking to `BaseSandbox` (pending → mounting →
mounted)
- Workspace passes mount config to sandbox via `setMounts()`
- Lazy mounting: filesystems are mounted when sandbox starts

### Features

- **Automatic mounting**: S3 buckets auto-mount into E2B sandbox via
s3fs
- **Config change detection**: Remounts on credential/bucket changes
- **Mount reconciliation**: Cleans up stale mounts when config changes
- **Provider icons**: UI shows cloud provider icons for mount points
- **Sandbox reconnection**: Reconnects to existing sandbox with mount
preservation

### Usage

```typescript
import { Workspace } from '@mastra/core/workspace';
import { E2BSandbox } from '@mastra/e2b';
import { S3Filesystem } from '@mastra/s3';

const workspace = new Workspace({
  mounts: {
    '/bucket': new S3Filesystem({
      bucket: 'my-bucket',
      region: 'auto',
      endpoint: process.env.S3_ENDPOINT,
      accessKeyId: process.env.S3_ACCESS_KEY_ID,
      secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
    }),
  },
  sandbox: new E2BSandbox({
    id: 'my-sandbox',
  }),
});

// No need to call init() - mounts happen lazily on first sandbox use
const result = await workspace.sandbox.executeCommand('ls', ['/bucket']);
```

## Test plan

- [x] Mount S3 bucket into E2B sandbox
- [x] Change mount path and verify old mount is cleaned up
- [x] Change bucket/credentials and verify remount
- [x] Reconnect to existing sandbox with mount preservation
- [x] UI shows mount icons and provider badges
- [ ] Add unit tests for S3Filesystem
- [ ] Add unit tests for E2BSandbox mount logic

## Related

Based on work from #12179

---

🤖 Generated with [Claude Code](https://claude.ai/code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Multi-filesystem mounting with provider-aware icons/labels, virtual
mount browsing, cross-mount copy/move, and E2B cloud sandbox (lifecycle,
templating, command execution, mount reconciliation).
* New S3 and GCS filesystem providers and a shared workspace test-utils
library for standardized filesystem/sandbox/integration tests.
  * UI: mount-aware file browser icons and metadata in listings.

* **Bug Fixes / Reliability**
* Safer lifecycle/readiness handling and clearer error signaling for
filesystems and sandboxes.

* **Chores**
* Conditional CI workspace/cloud test workflows and new workspace build
script.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: CalebBarnes <CalebBarnes@users.noreply.github.com>
Co-authored-by: NikAiyer <nick.aiyer@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 14:07:57 -08:00

5 lines
102 B