@agimon-ai/browse-tool 0.2.5 → 0.2.7
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 +38 -101
- package/dist/cli.cjs +25 -24
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.mjs +16 -15
- package/dist/cli.mjs.map +1 -0
- package/dist/extension/background.js +825 -49
- package/dist/extension/background.js.map +1 -1
- package/dist/extension/content.js +100 -5
- package/dist/extension/content.js.map +1 -1
- package/dist/extension/manifest.json +12 -1
- package/dist/extension/offscreen.js +300 -32
- package/dist/extension/offscreen.js.map +1 -1
- package/dist/extension/popup.html +4 -0
- package/dist/extension/popup.js +26 -0
- package/dist/extension/popup.js.map +1 -1
- package/dist/extension/recorder.html +26 -0
- package/dist/extension/recorder.js +294 -0
- package/dist/extension/recorder.js.map +1 -0
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -0
- package/dist/playwright-test-BwI7HgW7.mjs +2 -1
- package/dist/playwright-test-BwI7HgW7.mjs.map +1 -0
- package/dist/{playwright-test-DmzWxyKo.cjs → playwright-test-CGgt4gB5.cjs} +3 -2
- package/dist/playwright-test-CGgt4gB5.cjs.map +1 -0
- package/dist/streamable-http-BFbkLZAL.mjs +14 -0
- package/dist/streamable-http-BFbkLZAL.mjs.map +1 -0
- package/dist/streamable-http-CkhxOp5e.cjs +15 -0
- package/dist/streamable-http-CkhxOp5e.cjs.map +1 -0
- package/dist/stubs/playwright-test.cjs +1 -1
- package/package.json +2 -2
- package/dist/streamable-http-CUxM6gTY.cjs +0 -10
- package/dist/streamable-http-HVS5y6kh.mjs +0 -9
package/README.md
CHANGED
|
@@ -64,6 +64,7 @@ Options:
|
|
|
64
64
|
--port <port> Port for streamable HTTP transport (default: "3201")
|
|
65
65
|
-p, --profile <name> Default profile name for browser sessions
|
|
66
66
|
--custom-tools <path> Expose tools from a folder containing tools.yaml
|
|
67
|
+
--snippets-dir <path> Directory used by browser_run_code to save and load reusable snippets
|
|
67
68
|
```
|
|
68
69
|
|
|
69
70
|
### Streamable HTTP Transport
|
|
@@ -200,6 +201,13 @@ browse-tool exec-custom-tool \
|
|
|
200
201
|
| `browser_resize_page` | Resize the browser viewport |
|
|
201
202
|
| `browser_emulate` | Emulate device, geolocation, or network conditions |
|
|
202
203
|
|
|
204
|
+
### Code Tools (2)
|
|
205
|
+
|
|
206
|
+
| Tool | Description |
|
|
207
|
+
|------|-------------|
|
|
208
|
+
| `browser_run_code` | Execute inline code against `{ page, context, browser }`, optionally save it as a reusable snippet |
|
|
209
|
+
| `browser_list_snippets` | List saved snippets by name, description, and snippetPath |
|
|
210
|
+
|
|
203
211
|
### Testing/Tracing Tools (3)
|
|
204
212
|
|
|
205
213
|
| Tool | Description |
|
|
@@ -217,63 +225,47 @@ browse-tool exec-custom-tool \
|
|
|
217
225
|
| `browser_delete_profile` | Delete a profile |
|
|
218
226
|
| `browser_save_profile_state` | Save current browser state to profile |
|
|
219
227
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
| Tool | Description |
|
|
223
|
-
|------|-------------|
|
|
224
|
-
| `run_automation` | Run an automation script with optional pause |
|
|
225
|
-
| `resume_automation` | Resume a paused automation |
|
|
226
|
-
| `get_automation_status` | Get automation session status |
|
|
227
|
-
|
|
228
|
-
## Automation Script Format
|
|
229
|
-
|
|
230
|
-
Automation scripts are TypeScript/JavaScript modules that export a `run` function:
|
|
231
|
-
|
|
232
|
-
```typescript
|
|
233
|
-
import type { AutomationFixtures } from 'browse-tool';
|
|
234
|
-
|
|
235
|
-
export async function run({ page, context, browser, pauseCheck }: AutomationFixtures) {
|
|
236
|
-
// Navigate to a page
|
|
237
|
-
await page.goto('https://example.com');
|
|
238
|
-
|
|
239
|
-
// Create a pause checkpoint for LLM intervention
|
|
240
|
-
await pauseCheck('after-navigation', 'Page loaded, ready for inspection');
|
|
228
|
+
## Saved Snippets
|
|
241
229
|
|
|
242
|
-
|
|
243
|
-
await page.click('#login-button');
|
|
230
|
+
If you start `mcp-serve` or `http-serve` with `--snippets-dir <path>`, `browser_run_code` can persist inline snippets and later execute them again by `snippetPath`.
|
|
244
231
|
|
|
245
|
-
|
|
246
|
-
await pauseCheck('after-login-click', 'Login button clicked');
|
|
232
|
+
Save an inline snippet:
|
|
247
233
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"tool": "browser_run_code",
|
|
237
|
+
"arguments": {
|
|
238
|
+
"pageId": "page-1",
|
|
239
|
+
"code": "return await page.title();",
|
|
240
|
+
"saveAs": {
|
|
241
|
+
"name": "Get Page Title",
|
|
242
|
+
"description": "Return the current page title"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
251
245
|
}
|
|
252
246
|
```
|
|
253
247
|
|
|
254
|
-
|
|
248
|
+
List saved snippets:
|
|
255
249
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
### Using pauseCheck
|
|
250
|
+
```json
|
|
251
|
+
{
|
|
252
|
+
"tool": "browser_list_snippets",
|
|
253
|
+
"arguments": {}
|
|
254
|
+
}
|
|
255
|
+
```
|
|
264
256
|
|
|
265
|
-
|
|
257
|
+
Run a saved snippet:
|
|
266
258
|
|
|
267
|
-
```
|
|
268
|
-
|
|
259
|
+
```json
|
|
260
|
+
{
|
|
261
|
+
"tool": "browser_run_code",
|
|
262
|
+
"arguments": {
|
|
263
|
+
"pageId": "page-1",
|
|
264
|
+
"snippetPath": "get-page-title.ts"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
269
267
|
```
|
|
270
268
|
|
|
271
|
-
When paused:
|
|
272
|
-
1. The automation waits for `resume_automation` to be called
|
|
273
|
-
2. All browser tools remain available for LLM interaction
|
|
274
|
-
3. The LLM can inspect page state, take screenshots, etc.
|
|
275
|
-
4. Once resumed, automation continues from where it paused
|
|
276
|
-
|
|
277
269
|
## Profile Management
|
|
278
270
|
|
|
279
271
|
Profiles allow you to persist browser state (cookies, localStorage, etc.) across sessions.
|
|
@@ -291,20 +283,6 @@ Profiles allow you to persist browser state (cookies, localStorage, etc.) across
|
|
|
291
283
|
}
|
|
292
284
|
```
|
|
293
285
|
|
|
294
|
-
### Use a Profile with Automation
|
|
295
|
-
|
|
296
|
-
```json
|
|
297
|
-
{
|
|
298
|
-
"tool": "run_automation",
|
|
299
|
-
"arguments": {
|
|
300
|
-
"scriptPath": "/path/to/script.ts",
|
|
301
|
-
"browserOptions": {
|
|
302
|
-
"profile": "my-profile"
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
```
|
|
307
|
-
|
|
308
286
|
### Save Profile State
|
|
309
287
|
|
|
310
288
|
```json
|
|
@@ -317,47 +295,6 @@ Profiles allow you to persist browser state (cookies, localStorage, etc.) across
|
|
|
317
295
|
}
|
|
318
296
|
```
|
|
319
297
|
|
|
320
|
-
## LLM-Controlled Automation Flow
|
|
321
|
-
|
|
322
|
-
The unique feature of browse-tool is the ability to run automation scripts with LLM intervention points:
|
|
323
|
-
|
|
324
|
-
1. **Start Automation with Pause**
|
|
325
|
-
```json
|
|
326
|
-
{
|
|
327
|
-
"tool": "run_automation",
|
|
328
|
-
"arguments": {
|
|
329
|
-
"scriptPath": "/path/to/script.ts",
|
|
330
|
-
"pauseAtStart": true
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
2. **Automation Pauses** - Returns `automationId` and `pageIds`
|
|
336
|
-
|
|
337
|
-
3. **LLM Interacts** - Use browser tools (`browser_click`, `browser_fill`, etc.) on the paused pages
|
|
338
|
-
|
|
339
|
-
4. **Resume Automation**
|
|
340
|
-
```json
|
|
341
|
-
{
|
|
342
|
-
"tool": "resume_automation",
|
|
343
|
-
"arguments": {
|
|
344
|
-
"automationId": "automation-1"
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
5. **Script Continues** - Until next `pauseCheck` or completion
|
|
350
|
-
|
|
351
|
-
6. **Check Status**
|
|
352
|
-
```json
|
|
353
|
-
{
|
|
354
|
-
"tool": "get_automation_status",
|
|
355
|
-
"arguments": {
|
|
356
|
-
"automationId": "automation-1"
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
```
|
|
360
|
-
|
|
361
298
|
## Configuration
|
|
362
299
|
|
|
363
300
|
### Environment Variables
|