agent-browser 0.10.0 → 0.11.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/README.md +97 -12
- package/bin/agent-browser-darwin-arm64 +0 -0
- package/bin/agent-browser-darwin-x64 +0 -0
- package/bin/agent-browser-linux-arm64 +0 -0
- package/bin/agent-browser-linux-x64 +0 -0
- package/bin/agent-browser-win32-x64.exe +0 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +22 -1
- package/dist/actions.js.map +1 -1
- package/dist/browser.d.ts +26 -2
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +164 -3
- package/dist/browser.js.map +1 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +29 -2
- package/dist/protocol.js.map +1 -1
- package/dist/snapshot.d.ts.map +1 -1
- package/dist/snapshot.js +18 -5
- package/dist/snapshot.js.map +1 -1
- package/dist/types.d.ts +28 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/agent-browser/SKILL.md +65 -1
- package/skills/agent-browser/references/commands.md +4 -0
- package/skills/agent-browser/references/profiling.md +120 -0
- package/skills/agent-browser/references/proxy-support.md +10 -4
- package/skills/agent-browser/references/snapshot-refs.md +2 -2
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Profiling
|
|
2
|
+
|
|
3
|
+
Capture Chrome DevTools performance profiles during browser automation for performance analysis.
|
|
4
|
+
|
|
5
|
+
**Related**: [commands.md](commands.md) for full command reference, [SKILL.md](../SKILL.md) for quick start.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- [Basic Profiling](#basic-profiling)
|
|
10
|
+
- [Profiler Commands](#profiler-commands)
|
|
11
|
+
- [Categories](#categories)
|
|
12
|
+
- [Use Cases](#use-cases)
|
|
13
|
+
- [Output Format](#output-format)
|
|
14
|
+
- [Viewing Profiles](#viewing-profiles)
|
|
15
|
+
- [Limitations](#limitations)
|
|
16
|
+
|
|
17
|
+
## Basic Profiling
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Start profiling
|
|
21
|
+
agent-browser profiler start
|
|
22
|
+
|
|
23
|
+
# Perform actions
|
|
24
|
+
agent-browser navigate https://example.com
|
|
25
|
+
agent-browser click "#button"
|
|
26
|
+
agent-browser wait 1000
|
|
27
|
+
|
|
28
|
+
# Stop and save
|
|
29
|
+
agent-browser profiler stop ./trace.json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Profiler Commands
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Start profiling with default categories
|
|
36
|
+
agent-browser profiler start
|
|
37
|
+
|
|
38
|
+
# Start with custom trace categories
|
|
39
|
+
agent-browser profiler start --categories "devtools.timeline,v8.execute,blink.user_timing"
|
|
40
|
+
|
|
41
|
+
# Stop profiling and save to file
|
|
42
|
+
agent-browser profiler stop ./trace.json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Categories
|
|
46
|
+
|
|
47
|
+
The `--categories` flag accepts a comma-separated list of Chrome trace categories. Default categories include:
|
|
48
|
+
|
|
49
|
+
- `devtools.timeline` -- standard DevTools performance traces
|
|
50
|
+
- `v8.execute` -- time spent running JavaScript
|
|
51
|
+
- `blink` -- renderer events
|
|
52
|
+
- `blink.user_timing` -- `performance.mark()` / `performance.measure()` calls
|
|
53
|
+
- `latencyInfo` -- input-to-latency tracking
|
|
54
|
+
- `renderer.scheduler` -- task scheduling and execution
|
|
55
|
+
- `toplevel` -- broad-spectrum basic events
|
|
56
|
+
|
|
57
|
+
Several `disabled-by-default-*` categories are also included for detailed timeline, call stack, and V8 CPU profiling data.
|
|
58
|
+
|
|
59
|
+
## Use Cases
|
|
60
|
+
|
|
61
|
+
### Diagnosing Slow Page Loads
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
agent-browser profiler start
|
|
65
|
+
agent-browser navigate https://app.example.com
|
|
66
|
+
agent-browser wait --load networkidle
|
|
67
|
+
agent-browser profiler stop ./page-load-profile.json
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Profiling User Interactions
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
agent-browser navigate https://app.example.com
|
|
74
|
+
agent-browser profiler start
|
|
75
|
+
agent-browser click "#submit"
|
|
76
|
+
agent-browser wait 2000
|
|
77
|
+
agent-browser profiler stop ./interaction-profile.json
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### CI Performance Regression Checks
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
#!/bin/bash
|
|
84
|
+
agent-browser profiler start
|
|
85
|
+
agent-browser navigate https://app.example.com
|
|
86
|
+
agent-browser wait --load networkidle
|
|
87
|
+
agent-browser profiler stop "./profiles/build-${BUILD_ID}.json"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Output Format
|
|
91
|
+
|
|
92
|
+
The output is a JSON file in Chrome Trace Event format:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"traceEvents": [
|
|
97
|
+
{ "cat": "devtools.timeline", "name": "RunTask", "ph": "X", "ts": 12345, "dur": 100, ... },
|
|
98
|
+
...
|
|
99
|
+
],
|
|
100
|
+
"metadata": {
|
|
101
|
+
"clock-domain": "LINUX_CLOCK_MONOTONIC"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The `metadata.clock-domain` field is set based on the host platform (Linux or macOS). On Windows it is omitted.
|
|
107
|
+
|
|
108
|
+
## Viewing Profiles
|
|
109
|
+
|
|
110
|
+
Load the output JSON file in any of these tools:
|
|
111
|
+
|
|
112
|
+
- **Chrome DevTools**: Performance panel > Load profile (Ctrl+Shift+I > Performance)
|
|
113
|
+
- **Perfetto UI**: https://ui.perfetto.dev/ -- drag and drop the JSON file
|
|
114
|
+
- **Trace Viewer**: `chrome://tracing` in any Chromium browser
|
|
115
|
+
|
|
116
|
+
## Limitations
|
|
117
|
+
|
|
118
|
+
- Only works with Chromium-based browsers (Chrome, Edge). Not supported on Firefox or WebKit.
|
|
119
|
+
- Trace data accumulates in memory while profiling is active (capped at 5 million events). Stop profiling promptly after the area of interest.
|
|
120
|
+
- Data collection on stop has a 30-second timeout. If the browser is unresponsive, the stop command may fail.
|
|
@@ -17,10 +17,13 @@ Proxy configuration for geo-testing, rate limiting avoidance, and corporate envi
|
|
|
17
17
|
|
|
18
18
|
## Basic Proxy Configuration
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Use the `--proxy` flag or set proxy via environment variable:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
#
|
|
23
|
+
# Via CLI flag
|
|
24
|
+
agent-browser --proxy "http://proxy.example.com:8080" open https://example.com
|
|
25
|
+
|
|
26
|
+
# Via environment variable
|
|
24
27
|
export HTTP_PROXY="http://proxy.example.com:8080"
|
|
25
28
|
agent-browser open https://example.com
|
|
26
29
|
|
|
@@ -58,10 +61,13 @@ agent-browser open https://example.com
|
|
|
58
61
|
|
|
59
62
|
## Proxy Bypass
|
|
60
63
|
|
|
61
|
-
Skip proxy for specific domains
|
|
64
|
+
Skip proxy for specific domains using `--proxy-bypass` or `NO_PROXY`:
|
|
62
65
|
|
|
63
66
|
```bash
|
|
64
|
-
#
|
|
67
|
+
# Via CLI flag
|
|
68
|
+
agent-browser --proxy "http://proxy.example.com:8080" --proxy-bypass "localhost,*.internal.com" open https://example.com
|
|
69
|
+
|
|
70
|
+
# Via environment variable
|
|
65
71
|
export NO_PROXY="localhost,127.0.0.1,.internal.company.com"
|
|
66
72
|
agent-browser open https://internal.company.com # Direct connection
|
|
67
73
|
agent-browser open https://external.com # Via proxy
|
|
@@ -174,8 +174,8 @@ agent-browser snapshot -i
|
|
|
174
174
|
### Element Not Visible in Snapshot
|
|
175
175
|
|
|
176
176
|
```bash
|
|
177
|
-
# Scroll to reveal element
|
|
178
|
-
agent-browser scroll
|
|
177
|
+
# Scroll down to reveal element
|
|
178
|
+
agent-browser scroll down 1000
|
|
179
179
|
agent-browser snapshot -i
|
|
180
180
|
|
|
181
181
|
# Or wait for dynamic content
|