prose-qa 0.2.0 → 0.2.3

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.
Files changed (137) hide show
  1. package/README.md +16 -28
  2. package/dist/agent/bash.d.ts +1 -1
  3. package/dist/agent/bash.d.ts.map +1 -1
  4. package/dist/agent/bash.js +23 -4
  5. package/dist/agent/bash.js.map +1 -1
  6. package/dist/agent/bash.test.js +27 -3
  7. package/dist/agent/bash.test.js.map +1 -1
  8. package/dist/agent/prompt.d.ts.map +1 -1
  9. package/dist/agent/prompt.js +9 -1
  10. package/dist/agent/prompt.js.map +1 -1
  11. package/dist/agent/provider-options.d.ts.map +1 -1
  12. package/dist/agent/provider-options.js +13 -19
  13. package/dist/agent/provider-options.js.map +1 -1
  14. package/dist/agent/provider-options.test.js +12 -2
  15. package/dist/agent/provider-options.test.js.map +1 -1
  16. package/dist/agent/runner.d.ts.map +1 -1
  17. package/dist/agent/runner.js +93 -16
  18. package/dist/agent/runner.js.map +1 -1
  19. package/dist/agent/runner.test.d.ts +2 -0
  20. package/dist/agent/runner.test.d.ts.map +1 -0
  21. package/dist/agent/runner.test.js +83 -0
  22. package/dist/agent/runner.test.js.map +1 -0
  23. package/dist/agent/transcript-persist.d.ts +9 -0
  24. package/dist/agent/transcript-persist.d.ts.map +1 -0
  25. package/dist/agent/transcript-persist.js +6 -0
  26. package/dist/agent/transcript-persist.js.map +1 -0
  27. package/dist/agent/transcript-persist.test.d.ts +2 -0
  28. package/dist/agent/transcript-persist.test.d.ts.map +1 -0
  29. package/dist/agent/transcript-persist.test.js +56 -0
  30. package/dist/agent/transcript-persist.test.js.map +1 -0
  31. package/dist/agent/verdict.d.ts +12 -3
  32. package/dist/agent/verdict.d.ts.map +1 -1
  33. package/dist/agent/verdict.js +81 -0
  34. package/dist/agent/verdict.js.map +1 -1
  35. package/dist/agent/verdict.test.js +157 -1
  36. package/dist/agent/verdict.test.js.map +1 -1
  37. package/dist/cli/help.d.ts.map +1 -1
  38. package/dist/cli/help.js +53 -17
  39. package/dist/cli/help.js.map +1 -1
  40. package/dist/cli/help.test.js +1 -0
  41. package/dist/cli/help.test.js.map +1 -1
  42. package/dist/cli/index.js +18 -1
  43. package/dist/cli/index.js.map +1 -1
  44. package/dist/cli/install-browser.d.ts +3 -0
  45. package/dist/cli/install-browser.d.ts.map +1 -0
  46. package/dist/cli/install-browser.js +42 -0
  47. package/dist/cli/install-browser.js.map +1 -0
  48. package/dist/cli/install-browser.test.d.ts +2 -0
  49. package/dist/cli/install-browser.test.d.ts.map +1 -0
  50. package/dist/cli/install-browser.test.js +19 -0
  51. package/dist/cli/install-browser.test.js.map +1 -0
  52. package/dist/cli/run.d.ts.map +1 -1
  53. package/dist/cli/run.js +20 -15
  54. package/dist/cli/run.js.map +1 -1
  55. package/dist/config/lightpanda.d.ts +8 -0
  56. package/dist/config/lightpanda.d.ts.map +1 -1
  57. package/dist/config/lightpanda.js +41 -4
  58. package/dist/config/lightpanda.js.map +1 -1
  59. package/dist/config/lightpanda.test.js +30 -1
  60. package/dist/config/lightpanda.test.js.map +1 -1
  61. package/dist/config/load.d.ts.map +1 -1
  62. package/dist/config/load.js +14 -6
  63. package/dist/config/load.js.map +1 -1
  64. package/dist/config/load.test.js +29 -0
  65. package/dist/config/load.test.js.map +1 -1
  66. package/dist/mcp/server.d.ts.map +1 -1
  67. package/dist/mcp/server.js +2 -1
  68. package/dist/mcp/server.js.map +1 -1
  69. package/dist/redact/env-secrets.d.ts.map +1 -1
  70. package/dist/redact/env-secrets.js +1 -0
  71. package/dist/redact/env-secrets.js.map +1 -1
  72. package/dist/reporter/index.d.ts.map +1 -1
  73. package/dist/reporter/index.js +10 -4
  74. package/dist/reporter/index.js.map +1 -1
  75. package/dist/reporter/index.test.js +90 -1
  76. package/dist/reporter/index.test.js.map +1 -1
  77. package/dist/reporter/stats.d.ts +10 -0
  78. package/dist/reporter/stats.d.ts.map +1 -0
  79. package/dist/reporter/stats.js +85 -0
  80. package/dist/reporter/stats.js.map +1 -0
  81. package/dist/reporter/stats.test.d.ts +2 -0
  82. package/dist/reporter/stats.test.d.ts.map +1 -0
  83. package/dist/reporter/stats.test.js +157 -0
  84. package/dist/reporter/stats.test.js.map +1 -0
  85. package/dist/skills/loader.d.ts +8 -1
  86. package/dist/skills/loader.d.ts.map +1 -1
  87. package/dist/skills/loader.js +31 -5
  88. package/dist/skills/loader.js.map +1 -1
  89. package/dist/skills/loader.test.d.ts +2 -0
  90. package/dist/skills/loader.test.d.ts.map +1 -0
  91. package/dist/skills/loader.test.js +40 -0
  92. package/dist/skills/loader.test.js.map +1 -0
  93. package/dist/skills/on-demand.d.ts +57 -0
  94. package/dist/skills/on-demand.d.ts.map +1 -0
  95. package/dist/skills/on-demand.js +225 -0
  96. package/dist/skills/on-demand.js.map +1 -0
  97. package/dist/skills/on-demand.test.d.ts +2 -0
  98. package/dist/skills/on-demand.test.d.ts.map +1 -0
  99. package/dist/skills/on-demand.test.js +111 -0
  100. package/dist/skills/on-demand.test.js.map +1 -0
  101. package/dist/types/config.d.ts +15 -4
  102. package/dist/types/config.d.ts.map +1 -1
  103. package/dist/types/verdict.d.ts +32 -1
  104. package/dist/types/verdict.d.ts.map +1 -1
  105. package/dist/types/verdict.js +22 -0
  106. package/dist/types/verdict.js.map +1 -1
  107. package/dist/version.d.ts +3 -0
  108. package/dist/version.d.ts.map +1 -0
  109. package/dist/version.js +6 -0
  110. package/dist/version.js.map +1 -0
  111. package/package.json +6 -4
  112. package/pqa.config.ts +8 -3
  113. package/prompt/SYSTEM.md +2 -1
  114. package/scripts/install-lightpanda.mjs +161 -0
  115. package/scripts/sync-skills.mjs +110 -0
  116. package/skills/agent-browser/SKILL.md +0 -1960
  117. package/skills/agent-browser/bundled/agentcore/SKILL.md +115 -0
  118. package/skills/agent-browser/bundled/dogfood/SKILL.md +220 -0
  119. package/skills/agent-browser/bundled/dogfood/references/issue-taxonomy.md +109 -0
  120. package/skills/agent-browser/bundled/dogfood/templates/dogfood-report-template.md +53 -0
  121. package/skills/agent-browser/bundled/electron/SKILL.md +236 -0
  122. package/skills/agent-browser/bundled/slack/SKILL.md +285 -0
  123. package/skills/agent-browser/bundled/slack/references/slack-tasks.md +348 -0
  124. package/skills/agent-browser/bundled/slack/templates/slack-report-template.md +163 -0
  125. package/skills/agent-browser/bundled/vercel-sandbox/SKILL.md +280 -0
  126. package/skills/agent-browser/manifest.json +42 -0
  127. package/skills/agent-browser/references/authentication.md +303 -0
  128. package/skills/agent-browser/references/commands.md +398 -0
  129. package/skills/agent-browser/references/profiling.md +120 -0
  130. package/skills/agent-browser/references/proxy-support.md +194 -0
  131. package/skills/agent-browser/references/session-management.md +193 -0
  132. package/skills/agent-browser/references/snapshot-refs.md +219 -0
  133. package/skills/agent-browser/references/trust-boundaries.md +89 -0
  134. package/skills/agent-browser/references/video-recording.md +175 -0
  135. package/skills/agent-browser/templates/authenticated-session.sh +105 -0
  136. package/skills/agent-browser/templates/capture-workflow.sh +69 -0
  137. package/skills/agent-browser/templates/form-automation.sh +62 -0
@@ -0,0 +1,398 @@
1
+ # Command Reference
2
+
3
+ Complete reference for all agent-browser commands. For quick start and common patterns, see SKILL.md.
4
+
5
+ ## Navigation
6
+
7
+ ```bash
8
+ agent-browser open # Launch browser (no navigation); stays on about:blank.
9
+ # Pair with `network route`, `cookies set --curl`, or
10
+ # `addinitscript` to stage state before the first navigation.
11
+ agent-browser open <url> # Launch + navigate (aliases: goto, navigate)
12
+ # Supports: https://, http://, file://, about:, data://
13
+ # Auto-prepends https:// if no protocol given
14
+ agent-browser back # Go back
15
+ agent-browser forward # Go forward
16
+ agent-browser reload # Reload page
17
+ agent-browser pushstate <url> # SPA client-side navigation. Auto-detects
18
+ # window.next.router.push (triggers RSC fetch on Next.js);
19
+ # falls back to history.pushState + popstate/navigate events.
20
+ agent-browser close # Close browser (aliases: quit, exit)
21
+ agent-browser connect 9222 # Connect to browser via CDP port
22
+ ```
23
+
24
+ ### Pre-navigation setup (one-turn batch)
25
+
26
+ ```bash
27
+ agent-browser batch \
28
+ '["open"]' \
29
+ '["network","route","*","--abort","--resource-type","script"]' \
30
+ '["cookies","set","--curl","cookies.curl","--domain","localhost"]' \
31
+ '["navigate","http://localhost:3000/target"]'
32
+ ```
33
+
34
+ `open` with no URL gives you a clean launch so any interception, cookies,
35
+ or init scripts you register take effect on the *first* real navigation.
36
+ Use for SSR-only debug (`--resource-type script`), protected-origin auth,
37
+ or capturing fresh `react suspense`/`vitals` state without noise from a
38
+ prior page.
39
+
40
+ ## Snapshot (page analysis)
41
+
42
+ ```bash
43
+ agent-browser snapshot # Full accessibility tree
44
+ agent-browser snapshot -i # Interactive elements only (recommended)
45
+ agent-browser snapshot -c # Compact output
46
+ agent-browser snapshot -d 3 # Limit depth to 3
47
+ agent-browser snapshot -s "#main" # Scope to CSS selector
48
+ ```
49
+
50
+ ## Interactions (use @refs from snapshot)
51
+
52
+ ```bash
53
+ agent-browser click @e1 # Click
54
+ agent-browser click @e1 --new-tab # Click and open in new tab
55
+ agent-browser dblclick @e1 # Double-click
56
+ agent-browser focus @e1 # Focus element
57
+ agent-browser fill @e2 "text" # Clear and type
58
+ agent-browser type @e2 "text" # Type without clearing
59
+ agent-browser press Enter # Press key (alias: key)
60
+ agent-browser press Control+a # Key combination
61
+ agent-browser keydown Shift # Hold key down
62
+ agent-browser keyup Shift # Release key
63
+ agent-browser hover @e1 # Hover
64
+ agent-browser check @e1 # Check checkbox
65
+ agent-browser uncheck @e1 # Uncheck checkbox
66
+ agent-browser select @e1 "value" # Select dropdown option
67
+ agent-browser select @e1 "a" "b" # Select multiple options
68
+ agent-browser scroll down 500 # Scroll page (default: down 300px)
69
+ agent-browser scrollintoview @e1 # Scroll element into view (alias: scrollinto)
70
+ agent-browser drag @e1 @e2 # Drag and drop
71
+ agent-browser upload @e1 file.pdf # Upload files
72
+ ```
73
+
74
+ ## Get Information
75
+
76
+ ```bash
77
+ agent-browser get text @e1 # Get element text
78
+ agent-browser get html @e1 # Get innerHTML
79
+ agent-browser get value @e1 # Get input value
80
+ agent-browser get attr @e1 href # Get attribute
81
+ agent-browser get title # Get page title
82
+ agent-browser get url # Get current URL
83
+ agent-browser get cdp-url # Get CDP WebSocket URL
84
+ agent-browser get count ".item" # Count matching elements
85
+ agent-browser get box @e1 # Get bounding box
86
+ agent-browser get styles @e1 # Get computed styles (font, color, bg, etc.)
87
+ ```
88
+
89
+ ## Check State
90
+
91
+ ```bash
92
+ agent-browser is visible @e1 # Check if visible
93
+ agent-browser is enabled @e1 # Check if enabled
94
+ agent-browser is checked @e1 # Check if checked
95
+ ```
96
+
97
+ ## Screenshots and PDF
98
+
99
+ ```bash
100
+ agent-browser screenshot # Save to temporary directory
101
+ agent-browser screenshot path.png # Save to specific path
102
+ agent-browser screenshot --full # Full page
103
+ agent-browser pdf output.pdf # Save as PDF
104
+ ```
105
+
106
+ Headless Chromium screenshots hide native scrollbars for consistent image output.
107
+ Pass `--hide-scrollbars false` when launching to keep native scrollbars visible.
108
+
109
+ ## Video Recording
110
+
111
+ ```bash
112
+ agent-browser open https://example.com # Launch a browser session first
113
+ agent-browser record start ./demo.webm # Start recording
114
+ agent-browser click @e1 # Perform actions
115
+ agent-browser record stop # Stop and save video
116
+ agent-browser record restart ./take2.webm # Stop current + start new
117
+ ```
118
+
119
+ ## Wait
120
+
121
+ ```bash
122
+ agent-browser wait @e1 # Wait for element
123
+ agent-browser wait 2000 # Wait milliseconds
124
+ agent-browser wait --text "Success" # Wait for text (or -t)
125
+ agent-browser wait --url "**/dashboard" # Wait for URL pattern (or -u)
126
+ agent-browser wait --load networkidle # Wait for network idle (or -l)
127
+ agent-browser wait --fn "window.ready" # Wait for JS condition (or -f)
128
+ ```
129
+
130
+ ## Mouse Control
131
+
132
+ ```bash
133
+ agent-browser mouse move 100 200 # Move mouse
134
+ agent-browser mouse down left # Press button
135
+ agent-browser mouse up left # Release button
136
+ agent-browser mouse wheel 100 # Scroll wheel
137
+ ```
138
+
139
+ ## Semantic Locators (alternative to refs)
140
+
141
+ ```bash
142
+ agent-browser find role button click --name "Submit"
143
+ agent-browser find text "Sign In" click
144
+ agent-browser find text "Sign In" click --exact # Exact match only
145
+ agent-browser find label "Email" fill "user@test.com"
146
+ agent-browser find placeholder "Search" type "query"
147
+ agent-browser find alt "Logo" click
148
+ agent-browser find title "Close" click
149
+ agent-browser find testid "submit-btn" click
150
+ agent-browser find first ".item" click
151
+ agent-browser find last ".item" click
152
+ agent-browser find nth 2 "a" hover
153
+ ```
154
+
155
+ ## Browser Settings
156
+
157
+ ```bash
158
+ agent-browser set viewport 1920 1080 # Set viewport size
159
+ agent-browser set viewport 1920 1080 2 # 2x retina (same CSS size, higher res screenshots)
160
+ agent-browser set device "iPhone 14" # Emulate device
161
+ agent-browser set geo 37.7749 -122.4194 # Set geolocation (alias: geolocation)
162
+ agent-browser set offline on # Toggle offline mode
163
+ agent-browser set headers '{"X-Key":"v"}' # Extra HTTP headers
164
+ agent-browser set credentials user pass # HTTP basic auth (alias: auth)
165
+ agent-browser set media dark # Emulate color scheme
166
+ agent-browser set media light reduced-motion # Light mode + reduced motion
167
+ ```
168
+
169
+ ## Cookies and Storage
170
+
171
+ ```bash
172
+ agent-browser cookies # Get all cookies
173
+ agent-browser cookies set name value # Set cookie
174
+ agent-browser cookies clear # Clear cookies
175
+ agent-browser storage local # Get all localStorage
176
+ agent-browser storage local key # Get specific key
177
+ agent-browser storage local set k v # Set value
178
+ agent-browser storage local clear # Clear all
179
+ ```
180
+
181
+ ## Network
182
+
183
+ ```bash
184
+ agent-browser network route <url> # Intercept requests
185
+ agent-browser network route <url> --abort # Block requests
186
+ agent-browser network route <url> --body '{}' # Mock response
187
+ agent-browser network unroute [url] # Remove routes
188
+ agent-browser network requests # View tracked requests
189
+ agent-browser network requests --filter api # Filter requests
190
+ ```
191
+
192
+ ## Tabs and Windows
193
+
194
+ ```bash
195
+ agent-browser tab # List tabs with tabId and label
196
+ agent-browser tab new [url] # New tab
197
+ agent-browser tab new --label docs [url] # New tab with a memorable label
198
+ agent-browser tab t2 # Switch to tab by id
199
+ agent-browser tab docs # Switch to tab by label
200
+ agent-browser tab close # Close current tab
201
+ agent-browser tab close t2 # Close tab by id
202
+ agent-browser tab close docs # Close tab by label
203
+ agent-browser window new # New window
204
+ ```
205
+
206
+ Tab ids are stable strings of the form `t1`, `t2`, `t3`. They're never reused
207
+ within a session, so the same id keeps referring to the same tab across
208
+ commands. Positional integers are **not** accepted — `tab 2` errors with a
209
+ teaching message; use `t2`.
210
+
211
+ User-assigned labels (`docs`, `app`, `admin`) are interchangeable with ids
212
+ everywhere a tab ref is accepted. Labels are the agent-friendly way to write
213
+ multi-tab workflows:
214
+
215
+ ```bash
216
+ agent-browser tab new --label docs https://docs.example.com
217
+ agent-browser tab new --label app https://app.example.com
218
+ agent-browser tab docs # switch to docs
219
+ agent-browser snapshot # populate refs for docs
220
+ agent-browser click @e1 # ref click on docs
221
+ agent-browser tab app # switch to app
222
+ agent-browser tab close docs # close by label
223
+ ```
224
+
225
+ Labels are never auto-generated, never rewritten on navigation, and must be
226
+ unique within a session. To interact with another tab, switch to it first:
227
+ the daemon maintains a single active tab, so refs (`@eN`) belong to the tab
228
+ that was active when the snapshot ran.
229
+
230
+ ## Frames
231
+
232
+ ```bash
233
+ agent-browser frame "#iframe" # Switch to iframe by CSS selector
234
+ agent-browser frame @e3 # Switch to iframe by element ref
235
+ agent-browser frame main # Back to main frame
236
+ ```
237
+
238
+ ### Iframe support
239
+
240
+ Iframes are detected automatically during snapshots. When the main-frame snapshot runs, `Iframe` nodes are resolved and their content is inlined beneath the iframe element in the output (one level of nesting; iframes within iframes are not expanded).
241
+
242
+ ```bash
243
+ agent-browser snapshot -i
244
+ # @e3 [Iframe] "payment-frame"
245
+ # @e4 [input] "Card number"
246
+ # @e5 [button] "Pay"
247
+
248
+ # Interact directly — refs inside iframes already work
249
+ agent-browser fill @e4 "4111111111111111"
250
+ agent-browser click @e5
251
+
252
+ # Or switch frame context for scoped snapshots
253
+ agent-browser frame @e3 # Switch using element ref
254
+ agent-browser snapshot -i # Snapshot scoped to that iframe
255
+ agent-browser frame main # Return to main frame
256
+ ```
257
+
258
+ The `frame` command accepts:
259
+ - **Element refs** — `frame @e3` resolves the ref to an iframe element
260
+ - **CSS selectors** — `frame "#payment-iframe"` finds the iframe by selector
261
+ - **Frame name/URL** — matches against the browser's frame tree
262
+
263
+ ## Dialogs
264
+
265
+ By default, `alert` and `beforeunload` dialogs are automatically accepted so they never block the agent. `confirm` and `prompt` dialogs still require explicit handling. Use `--no-auto-dialog` to disable this behavior.
266
+
267
+ ```bash
268
+ agent-browser dialog accept [text] # Accept dialog
269
+ agent-browser dialog dismiss # Dismiss dialog
270
+ agent-browser dialog status # Check if a dialog is currently open
271
+ ```
272
+
273
+ ## JavaScript
274
+
275
+ ```bash
276
+ agent-browser eval "document.title" # Simple expressions only
277
+ agent-browser eval -b "<base64>" # Any JavaScript (base64 encoded)
278
+ agent-browser eval --stdin # Read script from stdin
279
+ ```
280
+
281
+ Use `-b`/`--base64` or `--stdin` for reliable execution. Shell escaping with nested quotes and special characters is error-prone.
282
+
283
+ ```bash
284
+ # Base64 encode your script, then:
285
+ agent-browser eval -b "ZG9jdW1lbnQucXVlcnlTZWxlY3RvcignW3NyYyo9Il9uZXh0Il0nKQ=="
286
+
287
+ # Or use stdin with heredoc for multiline scripts:
288
+ cat <<'EOF' | agent-browser eval --stdin
289
+ const links = document.querySelectorAll('a');
290
+ Array.from(links).map(a => a.href);
291
+ EOF
292
+ ```
293
+
294
+ ## State Management
295
+
296
+ ```bash
297
+ agent-browser state save auth.json # Save cookies, storage, auth state
298
+ agent-browser state load auth.json # Restore saved state
299
+ ```
300
+
301
+ ## Global Options
302
+
303
+ ```bash
304
+ agent-browser --session <name> ... # Isolated browser session
305
+ agent-browser --json ... # JSON output for parsing
306
+ agent-browser --headed ... # Show browser window (not headless)
307
+ agent-browser --cdp <port> ... # Connect via Chrome DevTools Protocol
308
+ agent-browser -p <provider> ... # Cloud browser provider (--provider)
309
+ agent-browser --proxy <url> ... # Use proxy server
310
+ agent-browser --proxy-bypass <hosts> # Hosts to bypass proxy
311
+ agent-browser --headers <json> ... # HTTP headers scoped to URL's origin
312
+ agent-browser --executable-path <p> # Custom browser executable
313
+ agent-browser --extension <path> ... # Load browser extension (repeatable)
314
+ agent-browser --ignore-https-errors # Ignore SSL certificate errors
315
+ agent-browser --hide-scrollbars false # Keep native scrollbars visible in headless Chromium screenshots
316
+ agent-browser --help # Show help (-h)
317
+ agent-browser --version # Show version (-V)
318
+ agent-browser <command> --help # Show detailed help for a command
319
+ ```
320
+
321
+ ## Debugging
322
+
323
+ ```bash
324
+ agent-browser --headed open example.com # Show browser window
325
+ agent-browser --cdp 9222 snapshot # Connect via CDP port
326
+ agent-browser connect 9222 # Alternative: connect command
327
+ agent-browser console # View console messages
328
+ agent-browser console --clear # Clear console
329
+ agent-browser errors # View page errors
330
+ agent-browser errors --clear # Clear errors
331
+ agent-browser highlight @e1 # Highlight element
332
+ agent-browser inspect # Open Chrome DevTools for this session
333
+ agent-browser trace start # Start recording trace
334
+ agent-browser trace stop trace.json # Stop and save trace
335
+ agent-browser profiler start # Start Chrome DevTools profiling
336
+ agent-browser profiler stop trace.json # Stop and save profile
337
+ ```
338
+
339
+ ## React / Web Vitals
340
+
341
+ Requires `--enable react-devtools` at launch for the `react ...` commands.
342
+ `vitals` and `pushstate` are framework-agnostic.
343
+
344
+ ```bash
345
+ agent-browser open --enable react-devtools <url> # Launch with React hook installed
346
+ agent-browser react tree # Full component tree
347
+ agent-browser react inspect <fiberId> # Props, hooks, state, source
348
+ agent-browser react renders start # Begin re-render recording
349
+ agent-browser react renders stop [--json] # Stop and print render profile
350
+ agent-browser react suspense [--only-dynamic] [--json] # Suspense boundaries + classifier
351
+ # --only-dynamic hides the "static" list
352
+ agent-browser vitals [url] [--json] # LCP/CLS/TTFB/FCP/INP + hydration
353
+ agent-browser pushstate <url> # SPA client-side nav (auto-detects Next router)
354
+ ```
355
+
356
+ `vitals` prints a summary by default and uses the same fields as the structured
357
+ `--json` response.
358
+
359
+ ## Init scripts
360
+
361
+ ```bash
362
+ agent-browser open --init-script <path> # Register before first navigation (repeatable)
363
+ agent-browser addinitscript <js> # Register at runtime (returns identifier)
364
+ agent-browser removeinitscript <identifier> # Remove a previously registered init script
365
+ ```
366
+
367
+ ## cURL cookie import
368
+
369
+ ```bash
370
+ agent-browser cookies set --curl <file> # Auto-detects JSON/cURL/Cookie-header
371
+ agent-browser cookies set --curl <file> --domain example.com # Scope to a domain
372
+ ```
373
+
374
+ Supported formats: JSON array of `{name, value}`, a cURL dump from
375
+ DevTools -> Network -> Copy as cURL, or a bare Cookie header. Errors never
376
+ echo cookie values.
377
+
378
+ ## Network route by resource type
379
+
380
+ ```bash
381
+ agent-browser network route '*' --abort --resource-type script # Block scripts only (SSR-lock pattern)
382
+ agent-browser network route '*' --resource-type image,font --body '' # Stub images and fonts
383
+ ```
384
+
385
+ ## Environment Variables
386
+
387
+ ```bash
388
+ AGENT_BROWSER_SESSION="mysession" # Default session name
389
+ AGENT_BROWSER_EXECUTABLE_PATH="/path/chrome" # Custom browser path
390
+ AGENT_BROWSER_EXTENSIONS="/ext1,/ext2" # Comma-separated extension paths
391
+ AGENT_BROWSER_INIT_SCRIPTS="/a.js,/b.js" # Comma-separated init script paths
392
+ AGENT_BROWSER_ENABLE="react-devtools" # Comma-separated built-in init script features
393
+ AGENT_BROWSER_HIDE_SCROLLBARS="false" # Keep native scrollbars visible in headless Chromium screenshots
394
+ AGENT_BROWSER_PROVIDER="browserbase" # Cloud browser provider
395
+ AGENT_BROWSER_STREAM_PORT="9223" # Override WebSocket streaming port (default: OS-assigned)
396
+ AGENT_BROWSER_CONFIG="./agent-browser.json" # Custom config file
397
+ AGENT_BROWSER_CDP="9222" # Connect daemon to CDP port or WebSocket URL
398
+ ```
@@ -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.