@agimon-ai/po-browse-tool 0.0.0-alpha.21 → 0.0.0-alpha.23
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 +122 -269
- package/dist/index.cjs +58 -2
- package/dist/index.d.cts +0 -23
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -23
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +58 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -15
- package/dist/ChromeForTestingService-DSLTv5n2.mjs +0 -2
- package/dist/ChromeForTestingService-DSLTv5n2.mjs.map +0 -1
- package/dist/ChromeForTestingService-Dkuz1mX4.cjs +0 -1
- package/dist/HttpServerHealthCheck-BAcE_UYc.cjs +0 -1
- package/dist/HttpServerHealthCheck-DSxra5fi.mjs +0 -2
- package/dist/HttpServerHealthCheck-DSxra5fi.mjs.map +0 -1
- package/dist/HttpServerManager-X21a8LMu.mjs +0 -2
- package/dist/HttpServerManager-X21a8LMu.mjs.map +0 -1
- package/dist/HttpServerManager-yZE8sHXS.cjs +0 -1
- package/dist/IdleCleanupService-CzR5zJal.cjs +0 -1
- package/dist/IdleCleanupService-retWgTZo.mjs +0 -2
- package/dist/IdleCleanupService-retWgTZo.mjs.map +0 -1
- package/dist/ProxyConfigService-CDKiKNFV.mjs +0 -2
- package/dist/ProxyConfigService-CDKiKNFV.mjs.map +0 -1
- package/dist/ProxyConfigService-o7Q9Gcts.cjs +0 -1
- package/dist/chrome-serve-BvWgTa1X.cjs +0 -1
- package/dist/chrome-serve-Dpez3s5p.mjs +0 -2
- package/dist/chrome-serve-Dpez3s5p.mjs.map +0 -1
- package/dist/cli.cjs +0 -2
- package/dist/cli.d.cts +0 -7
- package/dist/cli.d.cts.map +0 -1
- package/dist/cli.d.mts +0 -7
- package/dist/cli.d.mts.map +0 -1
- package/dist/cli.mjs +0 -3
- package/dist/cli.mjs.map +0 -1
- package/dist/config-BeTS8bPe.mjs +0 -2
- package/dist/config-BeTS8bPe.mjs.map +0 -1
- package/dist/config-CRhoDPtR.cjs +0 -1
- package/dist/custom-tools-CIJn6u12.mjs +0 -2
- package/dist/custom-tools-CIJn6u12.mjs.map +0 -1
- package/dist/custom-tools-DyYX7SVw.cjs +0 -1
- package/dist/docker-build-cft-Dy1UT5Rx.mjs +0 -2
- package/dist/docker-build-cft-Dy1UT5Rx.mjs.map +0 -1
- package/dist/docker-build-cft-ahAcHXRI.cjs +0 -1
- package/dist/dockerChromeForTesting-CV0Bi-3r.cjs +0 -1
- package/dist/dockerChromeForTesting-DUA2a5DL.mjs +0 -2
- package/dist/dockerChromeForTesting-DUA2a5DL.mjs.map +0 -1
- package/dist/exec-CSaiq6v-.cjs +0 -1
- package/dist/exec-DFchiGA_.mjs +0 -2
- package/dist/exec-DFchiGA_.mjs.map +0 -1
- package/dist/extension-routes-B3cgAJqm.mjs +0 -2
- package/dist/extension-routes-B3cgAJqm.mjs.map +0 -1
- package/dist/extension-routes-B423JHot.cjs +0 -1
- package/dist/http-serve-DpN6Sdbp.mjs +0 -482
- package/dist/http-serve-DpN6Sdbp.mjs.map +0 -1
- package/dist/http-serve-r_tkjLok.cjs +0 -481
- package/dist/mcp-serve-D3hR9ZwJ.mjs +0 -2
- package/dist/mcp-serve-D3hR9ZwJ.mjs.map +0 -1
- package/dist/mcp-serve-DPirc9hD.cjs +0 -1
- package/dist/mcpToolDefinition-8uiZQtZz.cjs +0 -1
- package/dist/mcpToolDefinition-D8qTEh17.mjs +0 -2
- package/dist/mcpToolDefinition-D8qTEh17.mjs.map +0 -1
- package/dist/networkConfig-D-4Gk1uJ.cjs +0 -1
- package/dist/networkConfig-D1ko7_Dg.mjs +0 -2
- package/dist/networkConfig-D1ko7_Dg.mjs.map +0 -1
- package/dist/outputFormatter-7ODE-7_3.mjs +0 -5
- package/dist/outputFormatter-7ODE-7_3.mjs.map +0 -1
- package/dist/outputFormatter-qZ2azsct.cjs +0 -4
- package/dist/ownerContext-CkxrrUG9.cjs +0 -1
- package/dist/ownerContext-O_ZLBU85.mjs +0 -2
- package/dist/ownerContext-O_ZLBU85.mjs.map +0 -1
- package/dist/processTree-DQhvDwo6.mjs +0 -3
- package/dist/processTree-DQhvDwo6.mjs.map +0 -1
- package/dist/processTree-DZDAk_hv.cjs +0 -2
- package/dist/status-BF6ReQ0o.cjs +0 -2
- package/dist/status-BsPUzWaY.mjs +0 -3
- package/dist/status-BsPUzWaY.mjs.map +0 -1
- package/dist/stop-Bui7ba6F.mjs +0 -2
- package/dist/stop-Bui7ba6F.mjs.map +0 -1
- package/dist/stop-CYvEmJlL.cjs +0 -1
- package/dist/streamable-http-CdadnaWv.cjs +0 -1
- package/dist/streamable-http-ka8aH0jj.mjs +0 -2
- package/dist/streamable-http-ka8aH0jj.mjs.map +0 -1
- package/dist/telemetryContext-Bs3fgsz2.mjs +0 -2
- package/dist/telemetryContext-Bs3fgsz2.mjs.map +0 -1
- package/dist/telemetryContext-vhf1yQI3.cjs +0 -1
- package/dist/timeouts-Bkutfj-l.cjs +0 -1
- package/dist/timeouts-C8bCg0kL.mjs +0 -2
- package/dist/timeouts-C8bCg0kL.mjs.map +0 -1
- package/dist/toolCommands-BPDQdla7.mjs +0 -3
- package/dist/toolCommands-BPDQdla7.mjs.map +0 -1
- package/dist/toolCommands-DAHcn5ss.cjs +0 -2
- package/dist/websocket-routes-BdR_hwJa.mjs +0 -57
- package/dist/websocket-routes-BdR_hwJa.mjs.map +0 -1
- package/dist/websocket-routes-DQgBM3d9.cjs +0 -56
package/README.md
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
# @agimon-ai/po-browse-tool
|
|
2
2
|
|
|
3
|
-
Browser automation
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Browser automation runtime and MCP server components for `@agimon-ai/po-browse`.
|
|
4
|
+
Po uses the runtime in-process and exposes it through the `browser` namespace in
|
|
5
|
+
code mode `exec`.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- Browser tools for complete browser control
|
|
10
|
-
- Extension mode
|
|
11
|
-
-
|
|
9
|
+
- Browser tools for complete browser control
|
|
10
|
+
- Extension mode for controlling Chrome through the Po extension
|
|
11
|
+
- Playwright mode for headless Chromium, Firefox, and WebKit
|
|
12
12
|
- Profile management for persistent browser sessions
|
|
13
|
-
- Page registry with per-owner pages
|
|
13
|
+
- Page registry with per-owner pages
|
|
14
|
+
- MCP server and modern stdio and streamable HTTP transports
|
|
14
15
|
|
|
15
16
|
## Library use
|
|
16
17
|
|
|
@@ -25,48 +26,55 @@ console.log(output.text); // JSON with browserId and pageId
|
|
|
25
26
|
await shutdownBrowseRuntime(runtime);
|
|
26
27
|
```
|
|
27
28
|
|
|
28
|
-
`callBrowseTool` validates
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
`callBrowseTool` validates input against the tool schema and returns
|
|
30
|
+
`{ text, images }`, throwing on a tool error. `livePage(runtime, entry)` returns
|
|
31
|
+
the live page behind a page registry entry: Playwright's `Page`, or an extension
|
|
32
|
+
proxy. `createBoundBrowserRuntime` remains exported for system tests.
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
pnpm install
|
|
34
|
-
```
|
|
34
|
+
## MCP server and transports
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Hosts that own the browser runtime create an MCP server from their tools and
|
|
37
|
+
select a transport. `ownedTools` below represents the tools owned and managed by
|
|
38
|
+
the host:
|
|
37
39
|
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
```
|
|
40
|
+
```ts
|
|
41
|
+
import { createServer, StdioTransportHandler } from '@agimon-ai/po-browse-tool';
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
const server = createServer({ tools: ownedTools });
|
|
44
|
+
const transport = new StdioTransportHandler(server);
|
|
45
|
+
await transport.start();
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
// On host shutdown:
|
|
48
|
+
await transport.stop();
|
|
46
49
|
```
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
`StreamableHttpTransportHandler` accepts a session factory and transport config.
|
|
52
|
+
The request passed to that factory exposes request headers, so a host may apply
|
|
53
|
+
its own routing and ownership policy before returning a host-owned server context.
|
|
54
|
+
The host remains responsible for binding browser ownership and runtime lifecycle.
|
|
55
|
+
The transport handles MCP protocol requests and invokes any returned cleanup
|
|
56
|
+
callback. Its default endpoint path is `/mcp`, and the path can be changed in
|
|
57
|
+
`StreamableHttpTransportConfig`.
|
|
58
|
+
|
|
59
|
+
## Installation and checks
|
|
49
60
|
|
|
50
61
|
```bash
|
|
62
|
+
pnpm install
|
|
63
|
+
pnpm build
|
|
51
64
|
pnpm test
|
|
52
65
|
```
|
|
53
66
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
This private port retains the upstream SDK, CLI, and extension assets.
|
|
57
|
-
The profile-bound SDK is verified with synthetic local fixtures and real Chromium;
|
|
58
|
-
no live credentials or email sends are used.
|
|
59
|
-
|
|
60
|
-
From the repository root:
|
|
67
|
+
This public package retains the upstream SDK, MCP transports, snippets, specs, and
|
|
68
|
+
extension assets. From the repository root:
|
|
61
69
|
|
|
62
70
|
```bash
|
|
63
71
|
pnpm exec nx run-many -t lint,typecheck,build,test -p @agimon-ai/po-browse-tool
|
|
64
72
|
```
|
|
65
73
|
|
|
66
74
|
These targets cover whole-port type-aware lint, source and test typechecking,
|
|
67
|
-
SDK
|
|
68
|
-
Browser evaluation and native receiver capture retain narrowly documented
|
|
69
|
-
exceptions because those operations are intentional features.
|
|
75
|
+
SDK and declaration builds, production extension assets, and synthetic Chromium
|
|
76
|
+
tests. Browser evaluation and native receiver capture retain narrowly documented
|
|
77
|
+
lint exceptions because those operations are intentional features.
|
|
70
78
|
|
|
71
79
|
Check the extension's browser-only declarations separately:
|
|
72
80
|
|
|
@@ -76,116 +84,9 @@ pnpm --filter @agimon-ai/po-browse-tool exec tsc --noEmit -p tsconfig.extension.
|
|
|
76
84
|
|
|
77
85
|
The production Vite build is not a substitute for this extension typecheck.
|
|
78
86
|
|
|
79
|
-
##
|
|
80
|
-
|
|
81
|
-
Add to your Claude Code configuration (`.mcp.json`):
|
|
82
|
-
|
|
83
|
-
```json
|
|
84
|
-
{
|
|
85
|
-
"mcpServers": {
|
|
86
|
-
"browse-tool": {
|
|
87
|
-
"command": "npx",
|
|
88
|
-
"args": ["browse-tool", "mcp-serve"]
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### CLI Options
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
browse-tool mcp-serve [options]
|
|
98
|
-
|
|
99
|
-
Options:
|
|
100
|
-
-t, --type <type> Transport type: stdio, streamable-http (default: "stdio")
|
|
101
|
-
-b, --browser <type> Default browser: chromium, firefox, webkit (default: "chromium")
|
|
102
|
-
--headless Run browsers in headless mode
|
|
103
|
-
--no-headless Run browsers in headed mode (visible window)
|
|
104
|
-
--host <host> Default host for HTTP services (default: "localhost")
|
|
105
|
-
--port <port> Port for streamable HTTP transport (default: "3201")
|
|
106
|
-
-p, --profile <name> Default profile name for browser sessions
|
|
107
|
-
--custom-tools <path> Expose tools from a folder containing tools.yaml
|
|
108
|
-
--snippets-dir <path> Directory used by browser_run_code to save and load reusable snippets
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Streamable HTTP Transport
|
|
112
|
-
|
|
113
|
-
For clients that can connect over MCP streamable HTTP, start `mcp-serve` with:
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
browse-tool mcp-serve --type streamable-http --host 127.0.0.1 --port 3201
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
This exposes the MCP endpoint at `http://127.0.0.1:3201/mcp` and keeps the existing browse-tool HTTP service for browser execution on its own port.
|
|
120
|
-
|
|
121
|
-
This endpoint serves modern MCP `2026-07-28` only. Send `x-browse-owner: <stable-owner-id>` on **every** stateful MCP request, and send `x-profile: <profile-name>` on every request when pinning a profile. The owner is application routing identity, not authentication. Tool discovery works without an owner; tool calls without one return an error. Browser state survives individual HTTP requests and client disconnects, scoped to the owner and profile, and is cleaned up after inactivity or shutdown. Modern HTTP does not use `Mcp-Session-Id` or a legacy initialize request.
|
|
122
|
-
|
|
123
|
-
## Custom Tools (deprecated, being removed)
|
|
124
|
-
|
|
125
|
-
Custom tools are loaded from a folder containing:
|
|
126
|
-
|
|
127
|
-
- `tools.yaml`
|
|
128
|
-
- one or more `.ts` scripts referenced by the manifest
|
|
129
|
-
|
|
130
|
-
`tools.yaml` entries support:
|
|
131
|
-
|
|
132
|
-
- `name`
|
|
133
|
-
- `description`
|
|
134
|
-
- `script`
|
|
135
|
-
- `capabilities`
|
|
136
|
-
- `inputSchema`
|
|
137
|
-
- optional `suggestionActions`
|
|
138
|
-
- a short text string describing what should be done next after the tool succeeds
|
|
139
|
-
- this value is exposed in custom-tool discovery and injected into the tool execution result
|
|
140
|
-
|
|
141
|
-
If you start the MCP server with `--custom-tools <path>`, those tools are added to the MCP tool list automatically.
|
|
142
|
-
|
|
143
|
-
### Expose Custom Tools Through MCP
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
browse-tool mcp-serve --custom-tools scripts/automation/linkedin-prospecting
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
Claude Code example:
|
|
150
|
-
|
|
151
|
-
```json
|
|
152
|
-
{
|
|
153
|
-
"mcpServers": {
|
|
154
|
-
"browse-tool": {
|
|
155
|
-
"command": "npx",
|
|
156
|
-
"args": ["browse-tool", "mcp-serve", "--custom-tools", "scripts/automation/linkedin-prospecting"]
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### Flat CLI Commands
|
|
163
|
-
|
|
164
|
-
List tools from a custom-tool directory:
|
|
87
|
+
## Tool reference
|
|
165
88
|
|
|
166
|
-
|
|
167
|
-
browse-tool list-custom-tools scripts/automation/linkedin-prospecting
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
Execute a custom tool:
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
browse-tool exec-custom-tool \
|
|
174
|
-
scripts/automation/linkedin-prospecting \
|
|
175
|
-
list_posts_from_linkedin_feed \
|
|
176
|
-
'{"pageId":"page-2","maxPosts":3}'
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
### Notes
|
|
180
|
-
|
|
181
|
-
- The flat commands talk to the browse-tool HTTP server.
|
|
182
|
-
- Custom tools are not exposed to MCP unless `mcp-serve` is started with `--custom-tools`.
|
|
183
|
-
- For slow UI-driven tools, prefer bounded inputs such as `maxPosts` so test runs stay manageable.
|
|
184
|
-
- If a manifest defines `suggestionActions`, browse-tool injects that text into the custom tool execution result.
|
|
185
|
-
|
|
186
|
-
## Tool Reference
|
|
187
|
-
|
|
188
|
-
### Input Tools (8)
|
|
89
|
+
### Input tools (8)
|
|
189
90
|
|
|
190
91
|
| Tool | Description |
|
|
191
92
|
| --------------------- | ------------------------------------------ |
|
|
@@ -198,7 +99,7 @@ browse-tool exec-custom-tool \
|
|
|
198
99
|
| `browser_press_key` | Press a keyboard key |
|
|
199
100
|
| `browser_upload_file` | Upload a file to a file input |
|
|
200
101
|
|
|
201
|
-
### Navigation
|
|
102
|
+
### Navigation tools (5)
|
|
202
103
|
|
|
203
104
|
| Tool | Description |
|
|
204
105
|
| -------------------- | -------------------------------- |
|
|
@@ -208,7 +109,7 @@ browse-tool exec-custom-tool \
|
|
|
208
109
|
| `browser_reload` | Reload the current page |
|
|
209
110
|
| `browser_wait_for` | Wait for an element or condition |
|
|
210
111
|
|
|
211
|
-
### Snapshot
|
|
112
|
+
### Snapshot tools (3)
|
|
212
113
|
|
|
213
114
|
| Tool | Description |
|
|
214
115
|
| -------------------- | ------------------------------- |
|
|
@@ -216,7 +117,7 @@ browse-tool exec-custom-tool \
|
|
|
216
117
|
| `browser_pdf` | Generate PDF of the page |
|
|
217
118
|
| `browser_snapshot` | Get accessibility tree snapshot |
|
|
218
119
|
|
|
219
|
-
### Tab
|
|
120
|
+
### Tab and page management tools (4)
|
|
220
121
|
|
|
221
122
|
| Tool | Description |
|
|
222
123
|
| --------------------- | ------------------------- |
|
|
@@ -225,11 +126,11 @@ browse-tool exec-custom-tool \
|
|
|
225
126
|
| `browser_new_page` | Open a new page |
|
|
226
127
|
| `browser_close_page` | Close a page |
|
|
227
128
|
|
|
228
|
-
### Dialog
|
|
129
|
+
### Dialog, network, and console tools (7)
|
|
229
130
|
|
|
230
131
|
| Tool | Description |
|
|
231
132
|
| ------------------------------- | -------------------------------------------------- |
|
|
232
|
-
| `browser_handle_dialog` | Handle JavaScript dialogs
|
|
133
|
+
| `browser_handle_dialog` | Handle JavaScript dialogs |
|
|
233
134
|
| `browser_list_network_requests` | List captured network requests |
|
|
234
135
|
| `browser_get_network_request` | Get details of a specific network request |
|
|
235
136
|
| `browser_list_console_messages` | List console messages |
|
|
@@ -237,35 +138,37 @@ browse-tool exec-custom-tool \
|
|
|
237
138
|
| `browser_resize_page` | Resize the browser viewport |
|
|
238
139
|
| `browser_emulate` | Emulate device, geolocation, or network conditions |
|
|
239
140
|
|
|
240
|
-
### Code
|
|
141
|
+
### Code tools (2)
|
|
241
142
|
|
|
242
|
-
Po code mode
|
|
143
|
+
Po code mode uses an `exec` script with `browser.page` for these operations:
|
|
243
144
|
|
|
244
|
-
| Tool | Description
|
|
245
|
-
| ----------------------- |
|
|
246
|
-
| `browser_run_code` | Execute
|
|
247
|
-
| `browser_list_snippets` | List saved snippets
|
|
145
|
+
| Tool | Description |
|
|
146
|
+
| ----------------------- | ------------------------------------------------ |
|
|
147
|
+
| `browser_run_code` | Execute code against a page, context, or browser |
|
|
148
|
+
| `browser_list_snippets` | List saved snippets |
|
|
248
149
|
|
|
249
|
-
### Testing
|
|
150
|
+
### Testing and tracing tools (3)
|
|
250
151
|
|
|
251
|
-
| Tool | Description
|
|
252
|
-
| --------------------- |
|
|
253
|
-
| `browser_expect` | Assert conditions on elements
|
|
254
|
-
| `browser_start_trace` | Start Playwright tracing
|
|
255
|
-
| `browser_stop_trace` | Stop tracing and save trace
|
|
152
|
+
| Tool | Description |
|
|
153
|
+
| --------------------- | ----------------------------- |
|
|
154
|
+
| `browser_expect` | Assert conditions on elements |
|
|
155
|
+
| `browser_start_trace` | Start Playwright tracing |
|
|
156
|
+
| `browser_stop_trace` | Stop tracing and save a trace |
|
|
256
157
|
|
|
257
|
-
### Profile
|
|
158
|
+
### Profile management tools (4)
|
|
258
159
|
|
|
259
|
-
| Tool | Description
|
|
260
|
-
| ---------------------------- |
|
|
261
|
-
| `browser_list_profiles` | List all saved profiles
|
|
262
|
-
| `browser_create_profile` | Create a
|
|
263
|
-
| `browser_delete_profile` | Delete a profile
|
|
264
|
-
| `browser_save_profile_state` | Save
|
|
160
|
+
| Tool | Description |
|
|
161
|
+
| ---------------------------- | ------------------------------- |
|
|
162
|
+
| `browser_list_profiles` | List all saved profiles |
|
|
163
|
+
| `browser_create_profile` | Create a browser profile |
|
|
164
|
+
| `browser_delete_profile` | Delete a profile |
|
|
165
|
+
| `browser_save_profile_state` | Save browser state to a profile |
|
|
265
166
|
|
|
266
|
-
## Saved
|
|
167
|
+
## Saved snippets for library hosts
|
|
267
168
|
|
|
268
|
-
|
|
169
|
+
Library hosts that expose the underlying snippet tools can save and run inline
|
|
170
|
+
snippets. Po's `browser` namespace does not expose saved snippet tools.
|
|
171
|
+
A saved snippet has a name, description, and `snippetPath`.
|
|
269
172
|
|
|
270
173
|
Save an inline snippet:
|
|
271
174
|
|
|
@@ -304,11 +207,11 @@ Run a saved snippet:
|
|
|
304
207
|
}
|
|
305
208
|
```
|
|
306
209
|
|
|
307
|
-
## Profile
|
|
210
|
+
## Profile management
|
|
308
211
|
|
|
309
|
-
Profiles
|
|
212
|
+
Profiles persist browser state such as cookies and local storage across sessions.
|
|
310
213
|
|
|
311
|
-
### Create a
|
|
214
|
+
### Create a profile
|
|
312
215
|
|
|
313
216
|
```json
|
|
314
217
|
{
|
|
@@ -321,7 +224,7 @@ Profiles allow you to persist browser state (cookies, localStorage, etc.) across
|
|
|
321
224
|
}
|
|
322
225
|
```
|
|
323
226
|
|
|
324
|
-
### Save
|
|
227
|
+
### Save profile state
|
|
325
228
|
|
|
326
229
|
```json
|
|
327
230
|
{
|
|
@@ -333,30 +236,20 @@ Profiles allow you to persist browser state (cookies, localStorage, etc.) across
|
|
|
333
236
|
}
|
|
334
237
|
```
|
|
335
238
|
|
|
336
|
-
## Proxy
|
|
239
|
+
## Proxy configs
|
|
337
240
|
|
|
338
|
-
`browser_launch` accepts an explicit proxy object, or `proxy: true` to load
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
{
|
|
342
|
-
"tool": "browser_launch",
|
|
343
|
-
"arguments": {
|
|
344
|
-
"profileName": "work",
|
|
345
|
-
"proxy": true
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
By default, proxy configs live beside the profiles directory. With the default profiles directory, this is `~/.browse-tool/proxy-config`.
|
|
241
|
+
`browser_launch` accepts an explicit proxy object, or `proxy: true` to load
|
|
242
|
+
`session.yaml` from the proxy config directory. With the default profiles
|
|
243
|
+
directory, proxy configs live in `~/.browse-tool/proxy-config`.
|
|
351
244
|
|
|
352
245
|
Files are resolved in this order:
|
|
353
246
|
|
|
354
|
-
1.
|
|
247
|
+
1. An explicit `proxy` object in `browser_launch` arguments
|
|
355
248
|
2. `{proxy-config}/{profileName}.yaml`
|
|
356
249
|
3. `{proxy-config}/session.yaml` when `proxy: true` is used
|
|
357
250
|
4. `{proxy-config}/default.yaml`
|
|
358
251
|
|
|
359
|
-
|
|
252
|
+
Set a custom directory with `BROWSE_TOOL_PROXY_CONFIG_DIR`.
|
|
360
253
|
|
|
361
254
|
```yaml
|
|
362
255
|
server: http://proxy.example.com:8080
|
|
@@ -365,69 +258,39 @@ password: ${PROXY_PASSWORD}
|
|
|
365
258
|
bypass: localhost,127.0.0.1
|
|
366
259
|
```
|
|
367
260
|
|
|
368
|
-
Set a custom directory with `--proxy-config-dir <path>` or `BROWSE_TOOL_PROXY_CONFIG_DIR`.
|
|
369
|
-
|
|
370
261
|
## Configuration
|
|
371
262
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
|
375
|
-
|
|
|
376
|
-
| `
|
|
377
|
-
| `
|
|
378
|
-
| `PLAYWRIGHT_REGISTRY_DIR` | `.agiflow/registry` | Directory for HTTP server registry |
|
|
379
|
-
| `PLAYWRIGHT_PIDS_DIR` | `.pids` | Directory for tracking server PIDs |
|
|
380
|
-
| `PLAYWRIGHT_BROWSER_IDLE_TIMEOUT_MINUTES` | `30` | Minutes a browser may sit idle before it is closed |
|
|
381
|
-
| `BROWSE_TOOL_SERVER_IDLE_TIMEOUT_MINUTES` | `60` | Minutes the daemon may sit idle before it shuts itself down (`0` disables) |
|
|
382
|
-
| `NODE_ENV` | `development` | Runtime environment (`development`, `production`) |
|
|
383
|
-
|
|
384
|
-
### CLI Flags vs Environment Variables
|
|
385
|
-
|
|
386
|
-
CLI flags take precedence over environment variables. For example, `--profiles-dir /custom/path` overrides `PLAYWRIGHT_PROFILES_DIR`.
|
|
263
|
+
| Variable | Default | Description |
|
|
264
|
+
| ----------------------------------------- | --------------------------------- | ------------------------------ |
|
|
265
|
+
| `PLAYWRIGHT_PROFILES_DIR` | `~/.browse-tool/profiles` | Browser profile storage |
|
|
266
|
+
| `BROWSE_TOOL_PROXY_CONFIG_DIR` | beside profiles as `proxy-config` | Browser proxy YAML configs |
|
|
267
|
+
| `PLAYWRIGHT_BROWSER_IDLE_TIMEOUT_MINUTES` | `30` | Minutes a browser may sit idle |
|
|
268
|
+
| `NODE_ENV` | `development` | Runtime environment |
|
|
387
269
|
|
|
388
|
-
|
|
270
|
+
Idle cleanup closes pages after 15 minutes, browsers after the browser idle
|
|
271
|
+
timeout, and browser processes with no pages after the shorter page timeout.
|
|
272
|
+
An in-progress recording keeps its browser and pages alive while chunks upload.
|
|
389
273
|
|
|
390
|
-
|
|
274
|
+
## Error handling
|
|
391
275
|
|
|
392
|
-
|
|
393
|
-
- **Browsers** idle for more than the browser idle timeout (default 30 minutes) are closed, including their whole process tree.
|
|
394
|
-
- **Browsers with no pages left** use the shorter 15-minute timeout.
|
|
395
|
-
- **Stealth-mode** Chrome processes are swept on the same browser timeout.
|
|
396
|
-
- **The daemon itself** exits once it has served no request and owns no browsers for the server idle timeout (default 60 minutes), releasing its port and process registry rows on the way out. Set `BROWSE_TOOL_SERVER_IDLE_TIMEOUT_MINUTES=0` to keep it running forever. Health checks do not count as requests: discovery polls them on daemons it never goes on to use.
|
|
276
|
+
Structured errors include a `code` and `recovery` field.
|
|
397
277
|
|
|
398
|
-
|
|
278
|
+
| Failure mode | Cause | Recovery |
|
|
279
|
+
| -------------------------- | ---------------------------------------------- | ----------------------------------------------- |
|
|
280
|
+
| Browser launch failure | Missing browser binary or incompatible version | Install the required Playwright browser |
|
|
281
|
+
| Navigation timeout | Page took too long to load | Increase the wait timeout or check connectivity |
|
|
282
|
+
| Element not found | Selector did not match the DOM | Use `browser_snapshot` to inspect the page |
|
|
283
|
+
| Spec bundler build error | Syntax or resolution errors in a spec file | Check the spec and its imports |
|
|
284
|
+
| Spec bundler runtime error | The Bun runtime is unavailable | Install Bun or use a supported runtime |
|
|
399
285
|
|
|
400
|
-
|
|
286
|
+
## Spec bundler
|
|
401
287
|
|
|
402
|
-
|
|
288
|
+
`SpecBundlerService` bundles Playwright spec files before execution, replacing
|
|
289
|
+
`@playwright/test` imports with a lightweight stub module so specs can run in
|
|
290
|
+
the host runtime.
|
|
403
291
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
## Error Handling
|
|
407
|
-
|
|
408
|
-
### Common Failure Modes
|
|
409
|
-
|
|
410
|
-
| Failure | Cause | Recovery |
|
|
411
|
-
| ------------------------ | -------------------------------------------------- | --------------------------------------------------------------------- |
|
|
412
|
-
| Browser launch failure | Missing browser binary or incompatible version | Run `npx playwright install chromium` to install browsers |
|
|
413
|
-
| Navigation timeout | Page took too long to load | Increase timeout via `browser_wait_for` or check network connectivity |
|
|
414
|
-
| Element not found | Selector did not match any element | Use `browser_snapshot` to inspect the current DOM tree |
|
|
415
|
-
| Profile not found | Referenced profile does not exist | Use `browser_list_profiles` to list available profiles |
|
|
416
|
-
| Session expired | Browser context was closed or crashed | Launch a new browser session with `browser_navigate` |
|
|
417
|
-
| Spec bundler build error | Syntax errors or unresolvable imports in spec file | Check the spec file for errors; see `SpecBundlerBuildError.recovery` |
|
|
418
|
-
| Spec bundler CLI error | `bun` not installed or not in PATH | Install bun: `curl -fsSL https://bun.sh/install \| bash` |
|
|
419
|
-
|
|
420
|
-
### Error Codes
|
|
421
|
-
|
|
422
|
-
All structured errors include a `code` field for programmatic handling and a `recovery` field with suggested resolution steps.
|
|
423
|
-
|
|
424
|
-
## Spec Bundler (deprecated, being removed)
|
|
425
|
-
|
|
426
|
-
The `SpecBundlerService` bundles Playwright spec files before execution, replacing `@playwright/test` imports with a lightweight stub module so specs can run inside the MCP server.
|
|
427
|
-
|
|
428
|
-
### `testInfo.attach` compatibility
|
|
429
|
-
|
|
430
|
-
`run_spec` provides a stable subset of Playwright `TestInfo` to test callbacks and per-test hooks:
|
|
292
|
+
`run_spec` provides a stable subset of Playwright `TestInfo` to test callbacks
|
|
293
|
+
and per-test hooks:
|
|
431
294
|
|
|
432
295
|
```typescript
|
|
433
296
|
test('captures evidence', async ({ page }, testInfo) => {
|
|
@@ -438,19 +301,17 @@ test('captures evidence', async ({ page }, testInfo) => {
|
|
|
438
301
|
});
|
|
439
302
|
```
|
|
440
303
|
|
|
441
|
-
Attachments may use either `body` or `path`. The runner copies
|
|
304
|
+
Attachments may use either `body` or `path`. The runner copies evidence to its
|
|
305
|
+
temporary attachment directory and returns `{ name, contentType, path }` metadata
|
|
306
|
+
on the matching test result. Unsupported `TestInfo` properties fail with
|
|
307
|
+
`RUN_SPEC_UNSUPPORTED_TEST_INFO_CAPABILITY`.
|
|
442
308
|
|
|
443
|
-
### Runtime
|
|
309
|
+
### Runtime requirements
|
|
444
310
|
|
|
445
|
-
-
|
|
446
|
-
-
|
|
447
|
-
```bash
|
|
448
|
-
curl -fsSL https://bun.sh/install | bash
|
|
449
|
-
# or
|
|
450
|
-
npm i -g bun
|
|
451
|
-
```
|
|
311
|
+
- Bun is preferred and uses `Bun.build()` directly.
|
|
312
|
+
- Node.js can use an installed `bun` executable as a subprocess.
|
|
452
313
|
|
|
453
|
-
### Programmatic
|
|
314
|
+
### Programmatic usage
|
|
454
315
|
|
|
455
316
|
```typescript
|
|
456
317
|
import { SpecBundlerService } from 'browse-tool';
|
|
@@ -464,31 +325,23 @@ try {
|
|
|
464
325
|
}
|
|
465
326
|
```
|
|
466
327
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
|
470
|
-
|
|
|
471
|
-
| `
|
|
472
|
-
| `SpecBundlerNoOutputError` | `SPEC_BUNDLER_NO_OUTPUT` | Bundling produces no output file |
|
|
473
|
-
| `SpecBundlerCliError` | `SPEC_BUNDLER_CLI_FAILED` | `bun` CLI subprocess fails to execute |
|
|
328
|
+
| Error class | Code | When |
|
|
329
|
+
| -------------------------- | --------------------------- | -------------------------------------------- |
|
|
330
|
+
| `SpecBundlerBuildError` | `SPEC_BUNDLER_BUILD_FAILED` | Bundling reports syntax or resolution errors |
|
|
331
|
+
| `SpecBundlerNoOutputError` | `SPEC_BUNDLER_NO_OUTPUT` | Bundling produces no output file |
|
|
332
|
+
| `SpecBundlerCliError` | `SPEC_BUNDLER_CLI_FAILED` | Bun cannot be started |
|
|
474
333
|
|
|
475
334
|
## Architecture
|
|
476
335
|
|
|
477
336
|
```
|
|
478
337
|
browse-tool/
|
|
479
338
|
├── src/
|
|
480
|
-
│ ├──
|
|
481
|
-
│ ├──
|
|
482
|
-
│ ├── server/ # MCP server factory
|
|
483
|
-
│ ├── services/ #
|
|
484
|
-
│
|
|
485
|
-
│
|
|
486
|
-
│ │ ├── PageRegistry.ts # Page tracking
|
|
487
|
-
│ │ ├── PauseController.ts # Pause/resume flow
|
|
488
|
-
│ │ ├── ProfileService.ts # Profile management
|
|
489
|
-
│ │ └── SessionService.ts # Session tracking
|
|
490
|
-
│ ├── tools/ # MCP tool implementations
|
|
491
|
-
│ ├── transports/ # Transport handlers (stdio, streamable HTTP)
|
|
339
|
+
│ ├── container/ # In-process runtime composition
|
|
340
|
+
│ ├── extension/ # Browser extension assets
|
|
341
|
+
│ ├── server/ # MCP server factory and extension routes
|
|
342
|
+
│ ├── services/ # Browser, page, profile, and spec services
|
|
343
|
+
│ ├── tools/ # Browser tool implementations
|
|
344
|
+
│ ├── transports/ # Stdio and streamable HTTP handlers
|
|
492
345
|
│ └── types/ # TypeScript type definitions
|
|
493
346
|
├── tests/
|
|
494
347
|
│ ├── services/ # Service unit tests
|