veil-browser 0.3.0 → 0.4.1
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 +198 -76
- package/dist/browser.d.ts +21 -3
- package/dist/browser.js +333 -26
- package/dist/index.js +163 -52
- package/dist/mcp.d.ts +13 -1
- package/dist/mcp.js +537 -0
- package/dist/platforms.d.ts +25 -0
- package/dist/platforms.js +281 -0
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -1,143 +1,265 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img src="https://raw.githubusercontent.com/cuttlelab/veil/main/docs/logo.png" alt="veil" width="80" />
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# veil
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Stealth browser remote for AI agents.**
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
[](https://www.npmjs.com/package/veil-browser)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
[](https://nodejs.org)
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
- 🔐 **Persistent sessions** — log in once, use forever (saved to `~/.veil/sessions/`)
|
|
13
|
-
- 👁️ **Interactive login mode** — opens a real visible browser for you to authenticate manually
|
|
14
|
-
- 🤖 **Agent-friendly commands** — natural language actions, JSON output
|
|
15
|
-
- 🌐 **Works everywhere** — X/Twitter, Reddit, LinkedIn, GitHub, Instagram, any site
|
|
13
|
+
</div>
|
|
16
14
|
|
|
17
15
|
---
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
veil is a **headless browser CLI** built for AI agents. It runs a real, stealth Chromium browser and exposes every interaction as a simple command that returns clean JSON.
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
cd veil
|
|
23
|
-
npm install
|
|
24
|
-
npm run build
|
|
25
|
-
npm link # makes 'veil' available globally
|
|
26
|
-
```
|
|
19
|
+
You (or your agent) are the brain. veil is the hands.
|
|
27
20
|
|
|
28
|
-
Or install Playwright browsers:
|
|
29
21
|
```bash
|
|
22
|
+
npm install -g veil-browser
|
|
30
23
|
npx playwright install chromium
|
|
24
|
+
veil login x # save your session once
|
|
25
|
+
veil post "Hello, world from an AI agent."
|
|
31
26
|
```
|
|
32
27
|
|
|
33
28
|
---
|
|
34
29
|
|
|
35
|
-
##
|
|
30
|
+
## Why veil
|
|
36
31
|
|
|
37
|
-
|
|
32
|
+
Most browser automation tools are built for developers writing scripts. veil is built for **AI agents making decisions in real-time** — where every step is a tool call, every result is parseable JSON, and the agent decides what to do next.
|
|
38
33
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
- **No LLM inside** — veil is pure remote control. Your agent is the intelligence.
|
|
35
|
+
- **Stealth by default** — hides automation signals, realistic user agent, human-like delays
|
|
36
|
+
- **Persistent sessions** — log in once, reuse forever via saved cookies
|
|
37
|
+
- **Every output is JSON** — `{ ok: true, ... }` or `{ ok: false, error: "..." }`
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
---
|
|
44
40
|
|
|
45
|
-
|
|
41
|
+
## Installation
|
|
46
42
|
|
|
47
43
|
```bash
|
|
48
|
-
|
|
44
|
+
npm install -g veil-browser
|
|
45
|
+
npx playwright install chromium
|
|
49
46
|
```
|
|
50
47
|
|
|
51
|
-
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
52
51
|
|
|
53
52
|
```bash
|
|
54
|
-
|
|
53
|
+
# Log in once (opens visible browser)
|
|
54
|
+
veil login x
|
|
55
|
+
|
|
56
|
+
# Post a tweet
|
|
57
|
+
veil post "Building something new."
|
|
58
|
+
|
|
59
|
+
# Like, reply, repost, quote
|
|
60
|
+
veil like --nth 0
|
|
61
|
+
veil reply "Great point." --nth 0
|
|
62
|
+
veil repost --nth 1
|
|
63
|
+
veil quote "Worth reading." --nth 2
|
|
64
|
+
|
|
65
|
+
# Navigate and read any page
|
|
66
|
+
veil go https://example.com
|
|
67
|
+
veil snapshot # DOM tree → understand the page
|
|
68
|
+
veil read "h1" # Extract specific elements
|
|
69
|
+
veil find "Sign in" # Check if text exists
|
|
70
|
+
|
|
71
|
+
# Click, type, interact
|
|
72
|
+
veil click "[data-testid='button']"
|
|
73
|
+
veil type "input[name='q']" "search query"
|
|
74
|
+
veil press Enter
|
|
75
|
+
veil scroll down
|
|
76
|
+
|
|
77
|
+
# Screenshot
|
|
78
|
+
veil shot page.png
|
|
55
79
|
```
|
|
56
80
|
|
|
57
|
-
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Browser Selection
|
|
84
|
+
|
|
85
|
+
veil can use Playwright's bundled Chromium, an installed Chrome-compatible browser, or an already-running browser exposed over CDP.
|
|
58
86
|
|
|
59
87
|
```bash
|
|
60
|
-
|
|
88
|
+
# Installed Google Chrome
|
|
89
|
+
veil login reddit --browser chrome
|
|
90
|
+
|
|
91
|
+
# Installed Dia
|
|
92
|
+
veil login reddit --browser dia
|
|
93
|
+
|
|
94
|
+
# Attach to a manually started browser over CDP
|
|
95
|
+
veil login reddit --cdp-url http://127.0.0.1:9222
|
|
96
|
+
|
|
97
|
+
# Launch a dedicated persistent automation profile
|
|
98
|
+
veil login reddit --browser chrome --user-data-dir "$HOME/.veil/chrome-profile"
|
|
61
99
|
```
|
|
62
100
|
|
|
63
|
-
|
|
101
|
+
Supported shared browser flags:
|
|
102
|
+
|
|
103
|
+
- `--browser playwright|chrome|dia`
|
|
104
|
+
- `--browser-path /absolute/path/to/browser`
|
|
105
|
+
- `--cdp-url http://127.0.0.1:9222`
|
|
106
|
+
- `--user-data-dir /path/to/profile`
|
|
107
|
+
- `--timeout-ms 45000`
|
|
108
|
+
|
|
109
|
+
Use a dedicated automation profile for `--user-data-dir`. Do not point veil at your live default Chrome profile while that browser is open.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## All Commands
|
|
114
|
+
|
|
115
|
+
### Session
|
|
116
|
+
| Command | Description |
|
|
117
|
+
|---------|-------------|
|
|
118
|
+
| `veil login <platform>` | Open visible browser → log in → save session |
|
|
119
|
+
| `veil open <platform>` | Restore session and navigate to platform home |
|
|
120
|
+
| `veil sessions` | List saved sessions |
|
|
121
|
+
| `veil close` | Close browser |
|
|
122
|
+
| `veil serve` | Start the Streamable HTTP MCP server |
|
|
123
|
+
|
|
124
|
+
**Supported platforms:** `x`, `linkedin`, `reddit`, `bluesky` (or any URL)
|
|
125
|
+
|
|
126
|
+
### X / Social
|
|
127
|
+
| Command | Description |
|
|
128
|
+
|---------|-------------|
|
|
129
|
+
| `veil post "text"` | Post a tweet |
|
|
130
|
+
| `veil like --nth 0` | Like Nth post in feed |
|
|
131
|
+
| `veil reply "text" --nth 0` | Reply to Nth post |
|
|
132
|
+
| `veil repost --nth 0` | Repost Nth post |
|
|
133
|
+
| `veil quote "text" --nth 0` | Quote Nth post with comment |
|
|
134
|
+
|
|
135
|
+
### Navigation
|
|
136
|
+
| Command | Description |
|
|
137
|
+
|---------|-------------|
|
|
138
|
+
| `veil go <url>` | Navigate to URL |
|
|
139
|
+
| `veil url` | Get current URL and title |
|
|
140
|
+
| `veil back` | Go back |
|
|
141
|
+
|
|
142
|
+
### Reading
|
|
143
|
+
| Command | Description |
|
|
144
|
+
|---------|-------------|
|
|
145
|
+
| `veil snapshot` | Full DOM tree (best for understanding page structure) |
|
|
146
|
+
| `veil read [selector]` | Page text or element text |
|
|
147
|
+
| `veil read <sel> --all` | All matches as array |
|
|
148
|
+
| `veil read <sel> --attr href` | Read attribute value |
|
|
149
|
+
| `veil find "text"` | Check if text exists on page |
|
|
150
|
+
| `veil exists <selector>` | Check if selector exists |
|
|
151
|
+
|
|
152
|
+
### Interaction
|
|
153
|
+
| Command | Description |
|
|
154
|
+
|---------|-------------|
|
|
155
|
+
| `veil click <selector>` | Click element |
|
|
156
|
+
| `veil click <sel> --force` | Force click (bypass overlays) |
|
|
157
|
+
| `veil click <sel> --nth 2` | Click Nth match |
|
|
158
|
+
| `veil type <selector> "text"` | Type into element |
|
|
159
|
+
| `veil type <sel> "text" --clear` | Clear first, then type |
|
|
160
|
+
| `veil press <key>` | Press key (Enter, Tab, Escape…) |
|
|
161
|
+
| `veil scroll down\|up\|top\|bottom` | Scroll page |
|
|
162
|
+
| `veil wait <ms>` | Wait N milliseconds |
|
|
163
|
+
| `veil wait-for <selector>` | Wait until element appears |
|
|
164
|
+
| `veil eval "script"` | Run JavaScript, returns result |
|
|
165
|
+
|
|
166
|
+
### Screenshot
|
|
167
|
+
| Command | Description |
|
|
168
|
+
|---------|-------------|
|
|
169
|
+
| `veil shot [file.png]` | Screenshot (full page with `--full`) |
|
|
170
|
+
| `veil shot file.png --selector <sel>` | Screenshot specific element |
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Remote MCP Server for Claude
|
|
175
|
+
|
|
176
|
+
veil now includes a real Streamable HTTP MCP server built on the official MCP SDK.
|
|
177
|
+
|
|
178
|
+
Local HTTP example:
|
|
64
179
|
|
|
65
180
|
```bash
|
|
66
|
-
veil
|
|
181
|
+
veil serve --host 127.0.0.1 --port 3456
|
|
67
182
|
```
|
|
68
183
|
|
|
69
|
-
|
|
184
|
+
Direct HTTPS example:
|
|
70
185
|
|
|
71
186
|
```bash
|
|
72
|
-
veil
|
|
187
|
+
veil serve \
|
|
188
|
+
--host 0.0.0.0 \
|
|
189
|
+
--port 3443 \
|
|
190
|
+
--allowed-hosts your-domain.example \
|
|
191
|
+
--https-cert /etc/ssl/your-domain/fullchain.pem \
|
|
192
|
+
--https-key /etc/ssl/your-domain/privkey.pem
|
|
73
193
|
```
|
|
74
194
|
|
|
75
|
-
|
|
195
|
+
Important deployment notes:
|
|
196
|
+
|
|
197
|
+
- Claude needs a reachable `https://` endpoint with a valid certificate. A localhost server or self-signed certificate is useful for testing, but not for production Claude integrations.
|
|
198
|
+
- The MCP endpoint is `POST /mcp`.
|
|
199
|
+
- Health checks are available at `GET /healthz`.
|
|
200
|
+
- When binding to `0.0.0.0` or another non-localhost interface, set `--allowed-hosts` to the real public hostname to keep host-header validation in place.
|
|
201
|
+
- You can also terminate TLS in a reverse proxy or tunnel and forward plain HTTP to `veil serve`.
|
|
202
|
+
- Sessions are still created separately with `veil login <platform>`. The MCP server reuses those saved sessions when tools specify a `platform`.
|
|
203
|
+
|
|
204
|
+
Smoke-test the built server locally:
|
|
76
205
|
|
|
77
206
|
```bash
|
|
78
|
-
|
|
207
|
+
npm run build
|
|
208
|
+
npm run test:mcp
|
|
79
209
|
```
|
|
80
210
|
|
|
81
|
-
|
|
211
|
+
---
|
|
82
212
|
|
|
83
|
-
|
|
84
|
-
|
|
213
|
+
## For AI Agents (OpenClaw / MCP)
|
|
214
|
+
|
|
215
|
+
veil ships with a `SKILL.md` that teaches OpenClaw exactly how to use it — all commands, all platform selectors, and complete task sequences.
|
|
216
|
+
|
|
217
|
+
The agent pattern:
|
|
218
|
+
```
|
|
219
|
+
1. veil open x → restore session
|
|
220
|
+
2. veil snapshot → understand current page
|
|
221
|
+
3. veil click / type → act
|
|
222
|
+
4. veil wait 800 → let UI settle
|
|
223
|
+
5. veil find / read → verify
|
|
85
224
|
```
|
|
86
225
|
|
|
226
|
+
Every command is deterministic. Every output is parseable. The agent decides the logic.
|
|
227
|
+
|
|
87
228
|
---
|
|
88
229
|
|
|
89
|
-
##
|
|
230
|
+
## Platform Support
|
|
90
231
|
|
|
91
|
-
|
|
|
92
|
-
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
| `veil extract "<query>"` | Extract data as JSON |
|
|
98
|
-
| `veil screenshot` | Take screenshot |
|
|
99
|
-
| `veil session list` | List all saved sessions |
|
|
100
|
-
| `veil status` | Show veil status |
|
|
101
|
-
|
|
102
|
-
### Common flags
|
|
103
|
-
|
|
104
|
-
| Flag | Description |
|
|
105
|
-
|------|-------------|
|
|
106
|
-
| `-p, --platform <name>` | Use saved session for this platform |
|
|
107
|
-
| `-u, --url <url>` | Navigate to URL before action |
|
|
108
|
-
| `-H, --headed` | Run in visible browser mode |
|
|
109
|
-
| `-o, --output <path>` | Output file path (screenshot) |
|
|
110
|
-
| `--json` | Output machine-readable JSON |
|
|
232
|
+
| Platform | Login | Post | Like | Reply | Repost | Quote |
|
|
233
|
+
|----------|-------|------|------|-------|--------|-------|
|
|
234
|
+
| X (Twitter) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
235
|
+
| LinkedIn | ✅ | ✅ | ✅ | ✅ | — | — |
|
|
236
|
+
| Reddit | ✅ | — | ✅ | ✅ | — | — |
|
|
237
|
+
| Any website | — | — | ✅ via selectors | — | — | — |
|
|
111
238
|
|
|
112
239
|
---
|
|
113
240
|
|
|
114
|
-
##
|
|
241
|
+
## Configuration
|
|
242
|
+
|
|
243
|
+
Config stored at `~/.veil/config.json`. Sessions at `~/.veil/sessions/<platform>.json`.
|
|
115
244
|
|
|
116
245
|
```bash
|
|
117
|
-
veil
|
|
118
|
-
veil act "type 'hello world' into search"
|
|
119
|
-
veil act "post tweet: your content here"
|
|
120
|
-
veil act "like tweet"
|
|
121
|
-
veil act "scroll down"
|
|
122
|
-
veil act "press enter"
|
|
123
|
-
veil act "go to https://example.com"
|
|
246
|
+
veil status # show current config and saved sessions
|
|
124
247
|
```
|
|
125
248
|
|
|
126
249
|
---
|
|
127
250
|
|
|
128
|
-
##
|
|
251
|
+
## How It Works
|
|
129
252
|
|
|
130
|
-
|
|
253
|
+
1. **Stealth Chromium** — launches with flags that hide automation signals
|
|
254
|
+
2. **Session cookies** — saved after manual login, restored on every run
|
|
255
|
+
3. **Human timing** — random delays between actions (400–1200ms)
|
|
256
|
+
4. **Clean JSON output** — every command returns `{ ok, ... }` for easy parsing
|
|
131
257
|
|
|
132
258
|
---
|
|
133
259
|
|
|
134
|
-
##
|
|
260
|
+
## Built by CUTTLELAB
|
|
135
261
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
veil act "post tweet: launched something today" --platform twitter --json
|
|
140
|
-
```
|
|
262
|
+
veil is part of the tooling stack we're building for AI agents at [CUTTLELAB](https://cuttle.io).
|
|
141
263
|
|
|
142
264
|
---
|
|
143
265
|
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
import { Browser, BrowserContext, Page } from 'playwright';
|
|
2
|
-
export
|
|
2
|
+
export interface BrowserLaunchOptions {
|
|
3
3
|
headed?: boolean;
|
|
4
4
|
platform?: string;
|
|
5
|
-
|
|
5
|
+
browser?: string;
|
|
6
|
+
browserPath?: string;
|
|
7
|
+
cdpUrl?: string;
|
|
8
|
+
userDataDir?: string;
|
|
9
|
+
timeoutMs?: number | string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Ensure a browser session is available, creating or attaching as needed.
|
|
13
|
+
*/
|
|
14
|
+
export declare function ensureBrowser(opts?: BrowserLaunchOptions): Promise<{
|
|
6
15
|
browser: Browser;
|
|
7
16
|
context: BrowserContext;
|
|
8
17
|
page: Page;
|
|
9
18
|
}>;
|
|
19
|
+
/**
|
|
20
|
+
* Return the current live page if the browser is still open.
|
|
21
|
+
*/
|
|
10
22
|
export declare function getPage(): Promise<Page | null>;
|
|
11
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Persist the current storage state when requested and close veil-owned resources.
|
|
25
|
+
*/
|
|
26
|
+
export declare function closeBrowser(platform?: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Sleep for a short human-like randomized delay.
|
|
29
|
+
*/
|
|
12
30
|
export declare function humanDelay(min?: number, max?: number): Promise<void>;
|