@mastra/e2b-desktop 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +71 -0
- package/package.json +71 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @mastra/e2b-desktop
|
|
2
|
+
|
|
3
|
+
## 0.1.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added `@mastra/e2b-desktop`, a computer-use sandbox provider backed by E2B Desktop. It combines E2B command, process, file, and reconnection support with screenshot, mouse, keyboard, screen information, and authenticated noVNC tools. ([#21707](https://github.com/mastra-ai/mastra/pull/21707))
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
const sandbox = new E2BDesktopSandbox({ resolution: [1280, 720] });
|
|
11
|
+
const workspace = new Workspace({ sandbox });
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The provider also exports the underlying desktop SDK through `sandbox.desktop` for desktop-specific operations.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`5c2b379`](https://github.com/mastra-ai/mastra/commit/5c2b37916a045b578cc5f4321d99a16fda9117c6)]:
|
|
19
|
+
- @mastra/e2b@0.10.0-alpha.5
|
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# @mastra/e2b-desktop
|
|
2
|
+
|
|
3
|
+
E2B Desktop (computer-use) sandbox provider for Mastra workspaces.
|
|
4
|
+
|
|
5
|
+
Runs a full Linux desktop environment in an [E2B](https://e2b.dev) cloud sandbox with screenshot, mouse, and keyboard control. Extends [`@mastra/e2b`](../e2b)'s `E2BSandbox` the same way [`@e2b/desktop`](https://github.com/e2b-dev/desktop)'s SDK extends `e2b`'s — everything the base provider supports (command execution, processes, file upload, pause/resume reconnection) works against the same desktop VM.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @mastra/e2b-desktop
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requires an E2B API key (`E2B_API_KEY` env var or the `apiKey` option).
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { Agent } from '@mastra/core/agent';
|
|
19
|
+
import { Workspace } from '@mastra/core/workspace';
|
|
20
|
+
import { E2BDesktopSandbox } from '@mastra/e2b-desktop';
|
|
21
|
+
|
|
22
|
+
const sandbox = new E2BDesktopSandbox({ resolution: [1280, 720] });
|
|
23
|
+
|
|
24
|
+
const agent = new Agent({
|
|
25
|
+
name: 'desktop-agent',
|
|
26
|
+
instructions: 'You can control a Linux desktop and run shell commands.',
|
|
27
|
+
model: 'anthropic/claude-sonnet-4-6',
|
|
28
|
+
// file + shell + computer tools are all emitted automatically
|
|
29
|
+
workspace: new Workspace({ sandbox }),
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
With a `Workspace`, agents automatically get the `mastra_workspace_computer_*` tools (screenshot, click, type, press key, scroll, drag, …) alongside the shell and process tools.
|
|
34
|
+
|
|
35
|
+
### Direct desktop control
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
const sandbox = new E2BDesktopSandbox();
|
|
39
|
+
await sandbox.start();
|
|
40
|
+
|
|
41
|
+
await sandbox.computer.leftClick(100, 200);
|
|
42
|
+
await sandbox.computer.type('hello');
|
|
43
|
+
const { data } = await sandbox.computer.screenshot(); // PNG bytes
|
|
44
|
+
|
|
45
|
+
// Live desktop view (authenticated noVNC URL)
|
|
46
|
+
const viewerUrl = await sandbox.computer.streamUrl();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Raw SDK escape hatch
|
|
50
|
+
|
|
51
|
+
Desktop-only APIs (`launch`, `open`, window helpers, custom stream control) are available on the underlying `@e2b/desktop` sandbox:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
await sandbox.desktop.launch('xfce4-terminal');
|
|
55
|
+
await sandbox.desktop.open('https://mastra.ai');
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Options
|
|
59
|
+
|
|
60
|
+
All [`E2BSandboxOptions`](../e2b) plus:
|
|
61
|
+
|
|
62
|
+
| Option | Type | Description |
|
|
63
|
+
| ------------ | ------------------ | ------------------------------------------------- |
|
|
64
|
+
| `resolution` | `[number, number]` | Desktop resolution in pixels (new sandboxes only) |
|
|
65
|
+
| `dpi` | `number` | Desktop display DPI (new sandboxes only) |
|
|
66
|
+
|
|
67
|
+
When no `template` is provided, the E2B-hosted `desktop` template is used. Note: the desktop template has no FUSE tooling, so cloud filesystem mounting requires a custom desktop template with `s3fs`/`gcsfuse` installed.
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
Apache-2.0
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mastra/e2b-desktop",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "E2B Desktop (computer-use) sandbox provider for Mastra workspaces",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsdown --silent --config tsdown.config.ts",
|
|
23
|
+
"build:lib": "pnpm build",
|
|
24
|
+
"build:watch": "pnpm build --watch",
|
|
25
|
+
"test:unit": "vitest run --exclude '**/*.integration.test.ts'",
|
|
26
|
+
"test:watch": "vitest watch",
|
|
27
|
+
"test": "vitest run ./src/**/*.integration.test.ts",
|
|
28
|
+
"test:cloud": "pnpm test",
|
|
29
|
+
"lint": "oxlint . && eslint .",
|
|
30
|
+
"lint:fix": "oxlint --fix . && eslint --fix ."
|
|
31
|
+
},
|
|
32
|
+
"license": "Apache-2.0",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@e2b/desktop": "^2.3.1",
|
|
35
|
+
"@mastra/e2b": "workspace:^",
|
|
36
|
+
"e2b": "^2.36.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@internal/lint": "workspace:*",
|
|
40
|
+
"@internal/types-builder": "workspace:*",
|
|
41
|
+
"@internal/workspace-test-utils": "workspace:*",
|
|
42
|
+
"@mastra/core": "workspace:*",
|
|
43
|
+
"@types/node": "22.20.1",
|
|
44
|
+
"@vitest/coverage-v8": "catalog:",
|
|
45
|
+
"@vitest/ui": "catalog:",
|
|
46
|
+
"dotenv": "^17.4.2",
|
|
47
|
+
"eslint": "^10.7.0",
|
|
48
|
+
"tsdown": "0.22.9",
|
|
49
|
+
"typescript": "catalog:",
|
|
50
|
+
"vitest": "catalog:"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@mastra/core": ">=1.60.0-0 <2.0.0-0"
|
|
54
|
+
},
|
|
55
|
+
"files": [
|
|
56
|
+
"dist",
|
|
57
|
+
"CHANGELOG.md"
|
|
58
|
+
],
|
|
59
|
+
"homepage": "https://mastra.ai",
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "git+https://github.com/mastra-ai/mastra.git",
|
|
63
|
+
"directory": "workspaces/e2b-desktop"
|
|
64
|
+
},
|
|
65
|
+
"bugs": {
|
|
66
|
+
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=22.13.0"
|
|
70
|
+
}
|
|
71
|
+
}
|