@mastra/browser-viewer 0.2.3-alpha.1 → 0.2.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -64
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
# @mastra/browser-viewer
|
|
2
2
|
|
|
3
|
-
Playwright-
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
`@mastra/browser-viewer` provides `BrowserViewer`, which launches Chrome via Playwright and exposes the CDP URL for CLI tools (agent-browser, browser-use, or browse) to connect. This gives you:
|
|
8
|
-
|
|
9
|
-
- **Full screencast support**: Direct page-level CDP sessions
|
|
10
|
-
- **Input injection**: Mouse and keyboard events work correctly
|
|
11
|
-
- **Browser lifecycle control**: Browser starts/stops with the server
|
|
12
|
-
- **CLI flexibility**: Agent uses skills + workspace commands to drive any CLI
|
|
3
|
+
Run CLI browser tools through BrowserViewer with a Playwright-managed Chrome session, CDP access, live viewing, and Mastra workspace integration.
|
|
13
4
|
|
|
14
5
|
## Installation
|
|
15
6
|
|
|
@@ -37,62 +28,14 @@ const cdpUrl = await viewer.getCdpUrl();
|
|
|
37
28
|
console.log(cdpUrl); // ws://127.0.0.1:9222/devtools/browser/...
|
|
38
29
|
```
|
|
39
30
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
```typescript
|
|
43
|
-
import { BrowserViewer } from '@mastra/browser-viewer';
|
|
44
|
-
|
|
45
|
-
const viewer = new BrowserViewer({
|
|
46
|
-
cli: 'agent-browser',
|
|
47
|
-
cdpUrl: 'ws://127.0.0.1:9222/devtools/browser/abc123',
|
|
48
|
-
});
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### With Workspace
|
|
52
|
-
|
|
53
|
-
The CDP URL is automatically injected into CLI commands when used with workspace tools.
|
|
54
|
-
|
|
55
|
-
```typescript
|
|
56
|
-
import { Workspace, LocalSandbox } from '@mastra/core';
|
|
57
|
-
import { BrowserViewer } from '@mastra/browser-viewer';
|
|
58
|
-
|
|
59
|
-
const workspace = new Workspace({
|
|
60
|
-
sandbox: new LocalSandbox({ cwd: './workspace' }),
|
|
61
|
-
browser: new BrowserViewer({
|
|
62
|
-
cli: 'agent-browser',
|
|
63
|
-
headless: false,
|
|
64
|
-
}),
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// When agent runs: agent-browser open https://google.com
|
|
68
|
-
// Mastra auto-injects the CDP connection so CLI uses Mastra's browser
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Configuration
|
|
72
|
-
|
|
73
|
-
| Option | Type | Default | Description |
|
|
74
|
-
| ---------------- | -------------------------------------------------------------- | ---------- | ------------------------------------------------ |
|
|
75
|
-
| `cli` | `'agent-browser' \| 'browser-use' \| 'browse' \| 'browse-cli'` | Required | Which CLI the agent uses |
|
|
76
|
-
| `cdpUrl` | `string` | - | Connect to existing browser instead of launching |
|
|
77
|
-
| `headless` | `boolean` | `true` | Run browser in headless mode |
|
|
78
|
-
| `cdpPort` | `number` | `0` (auto) | Port for Chrome remote debugging |
|
|
79
|
-
| `viewport` | `{ width, height }` | `1280x720` | Browser viewport size |
|
|
80
|
-
| `executablePath` | `string` | - | Path to Chrome executable |
|
|
81
|
-
|
|
82
|
-
## How It Works
|
|
31
|
+
## Documentation
|
|
83
32
|
|
|
84
|
-
|
|
85
|
-
2. **Agent calls CLI commands** via `workspace_execute_command`
|
|
86
|
-
3. **CDP URL is auto-injected** so CLI connects to Mastra-managed Chrome
|
|
87
|
-
4. **Screencast streams** directly from page-level CDP sessions
|
|
88
|
-
5. **Browser closes** when server exits
|
|
33
|
+
- [BrowserViewer](https://mastra.ai/integrations/browsers/browser-viewer)
|
|
89
34
|
|
|
90
|
-
##
|
|
35
|
+
## Changelog
|
|
91
36
|
|
|
92
|
-
|
|
93
|
-
- **browser-use**: Python-based browser automation (`--cdp-url <url>`)
|
|
94
|
-
- **browse**: Browserbase's CLI (`--ws <url>`)
|
|
37
|
+
See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/browser/browser-viewer/CHANGELOG.md) for version history and release notes.
|
|
95
38
|
|
|
96
|
-
##
|
|
39
|
+
## Support
|
|
97
40
|
|
|
98
|
-
|
|
41
|
+
We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/browser-viewer",
|
|
3
|
-
"version": "0.2.3-alpha.
|
|
3
|
+
"version": "0.2.3-alpha.2",
|
|
4
4
|
"description": "Playwright-based browser viewer for Mastra CLI providers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"zod": "^4.4.3",
|
|
38
38
|
"@internal/lint": "0.0.129",
|
|
39
39
|
"@internal/types-builder": "0.0.104",
|
|
40
|
-
"@mastra/core": "1.64.0-alpha.
|
|
40
|
+
"@mastra/core": "1.64.0-alpha.7"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@mastra/core": ">=1.26.0-0 <2.0.0-0",
|