@dyyz1993/agent-browser 0.9.2

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 (187) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +907 -0
  3. package/bin/agent-browser-darwin-arm64 +0 -0
  4. package/bin/agent-browser.js +120 -0
  5. package/dist/__tests__/e2e/utils/test-helpers.d.ts +5 -0
  6. package/dist/__tests__/e2e/utils/test-helpers.d.ts.map +1 -0
  7. package/dist/__tests__/e2e/utils/test-helpers.js +22 -0
  8. package/dist/__tests__/e2e/utils/test-helpers.js.map +1 -0
  9. package/dist/__tests__/test-iframe.d.ts +2 -0
  10. package/dist/__tests__/test-iframe.d.ts.map +1 -0
  11. package/dist/__tests__/test-iframe.js +52 -0
  12. package/dist/__tests__/test-iframe.js.map +1 -0
  13. package/dist/__tests__/utils/parseCli.d.ts +20 -0
  14. package/dist/__tests__/utils/parseCli.d.ts.map +1 -0
  15. package/dist/__tests__/utils/parseCli.js +1086 -0
  16. package/dist/__tests__/utils/parseCli.js.map +1 -0
  17. package/dist/actions.d.ts +50 -0
  18. package/dist/actions.d.ts.map +1 -0
  19. package/dist/actions.js +2164 -0
  20. package/dist/actions.js.map +1 -0
  21. package/dist/browser.d.ts +556 -0
  22. package/dist/browser.d.ts.map +1 -0
  23. package/dist/browser.js +2599 -0
  24. package/dist/browser.js.map +1 -0
  25. package/dist/cli/commands.d.ts +8 -0
  26. package/dist/cli/commands.d.ts.map +1 -0
  27. package/dist/cli/commands.js +1038 -0
  28. package/dist/cli/commands.js.map +1 -0
  29. package/dist/cli/connection.d.ts +50 -0
  30. package/dist/cli/connection.d.ts.map +1 -0
  31. package/dist/cli/connection.js +595 -0
  32. package/dist/cli/connection.js.map +1 -0
  33. package/dist/cli/flags.d.ts +36 -0
  34. package/dist/cli/flags.d.ts.map +1 -0
  35. package/dist/cli/flags.js +206 -0
  36. package/dist/cli/flags.js.map +1 -0
  37. package/dist/cli/help.d.ts +4 -0
  38. package/dist/cli/help.d.ts.map +1 -0
  39. package/dist/cli/help.js +1024 -0
  40. package/dist/cli/help.js.map +1 -0
  41. package/dist/cli/output.d.ts +14 -0
  42. package/dist/cli/output.d.ts.map +1 -0
  43. package/dist/cli/output.js +456 -0
  44. package/dist/cli/output.js.map +1 -0
  45. package/dist/cli-new.d.ts +3 -0
  46. package/dist/cli-new.d.ts.map +1 -0
  47. package/dist/cli-new.js +308 -0
  48. package/dist/cli-new.js.map +1 -0
  49. package/dist/cli-old.d.ts +3 -0
  50. package/dist/cli-old.d.ts.map +1 -0
  51. package/dist/cli-old.js +1101 -0
  52. package/dist/cli-old.js.map +1 -0
  53. package/dist/cli.d.ts +3 -0
  54. package/dist/cli.d.ts.map +1 -0
  55. package/dist/cli.js +403 -0
  56. package/dist/cli.js.map +1 -0
  57. package/dist/content-detection.d.ts +18 -0
  58. package/dist/content-detection.d.ts.map +1 -0
  59. package/dist/content-detection.js +68 -0
  60. package/dist/content-detection.js.map +1 -0
  61. package/dist/daemon.d.ts +55 -0
  62. package/dist/daemon.d.ts.map +1 -0
  63. package/dist/daemon.js +426 -0
  64. package/dist/daemon.js.map +1 -0
  65. package/dist/diff.d.ts +42 -0
  66. package/dist/diff.d.ts.map +1 -0
  67. package/dist/diff.js +166 -0
  68. package/dist/diff.js.map +1 -0
  69. package/dist/human-mouse.d.ts +31 -0
  70. package/dist/human-mouse.d.ts.map +1 -0
  71. package/dist/human-mouse.js +184 -0
  72. package/dist/human-mouse.js.map +1 -0
  73. package/dist/ios-actions.d.ts +11 -0
  74. package/dist/ios-actions.d.ts.map +1 -0
  75. package/dist/ios-actions.js +228 -0
  76. package/dist/ios-actions.js.map +1 -0
  77. package/dist/ios-manager.d.ts +266 -0
  78. package/dist/ios-manager.d.ts.map +1 -0
  79. package/dist/ios-manager.js +1076 -0
  80. package/dist/ios-manager.js.map +1 -0
  81. package/dist/message-bridge.d.ts +10 -0
  82. package/dist/message-bridge.d.ts.map +1 -0
  83. package/dist/message-bridge.js +60 -0
  84. package/dist/message-bridge.js.map +1 -0
  85. package/dist/protocol.d.ts +26 -0
  86. package/dist/protocol.d.ts.map +1 -0
  87. package/dist/protocol.js +912 -0
  88. package/dist/protocol.js.map +1 -0
  89. package/dist/recorder/binding.d.ts +24 -0
  90. package/dist/recorder/binding.d.ts.map +1 -0
  91. package/dist/recorder/binding.js +215 -0
  92. package/dist/recorder/binding.js.map +1 -0
  93. package/dist/recorder/index.d.ts +4 -0
  94. package/dist/recorder/index.d.ts.map +1 -0
  95. package/dist/recorder/index.js +4 -0
  96. package/dist/recorder/index.js.map +1 -0
  97. package/dist/recorder/inject.js +1913 -0
  98. package/dist/recorder/recorder.d.ts +19 -0
  99. package/dist/recorder/recorder.d.ts.map +1 -0
  100. package/dist/recorder/recorder.js +101 -0
  101. package/dist/recorder/recorder.js.map +1 -0
  102. package/dist/recorder/store.d.ts +22 -0
  103. package/dist/recorder/store.d.ts.map +1 -0
  104. package/dist/recorder/store.js +150 -0
  105. package/dist/recorder/store.js.map +1 -0
  106. package/dist/recorder/types.d.ts +73 -0
  107. package/dist/recorder/types.d.ts.map +1 -0
  108. package/dist/recorder/types.js +5 -0
  109. package/dist/recorder/types.js.map +1 -0
  110. package/dist/snapshot.d.ts +81 -0
  111. package/dist/snapshot.d.ts.map +1 -0
  112. package/dist/snapshot.js +1348 -0
  113. package/dist/snapshot.js.map +1 -0
  114. package/dist/stream-server-standalone.d.ts +38 -0
  115. package/dist/stream-server-standalone.d.ts.map +1 -0
  116. package/dist/stream-server-standalone.js +494 -0
  117. package/dist/stream-server-standalone.js.map +1 -0
  118. package/dist/stream-server.d.ts +214 -0
  119. package/dist/stream-server.d.ts.map +1 -0
  120. package/dist/stream-server.js +811 -0
  121. package/dist/stream-server.js.map +1 -0
  122. package/dist/types.d.ts +914 -0
  123. package/dist/types.d.ts.map +1 -0
  124. package/dist/types.js +4 -0
  125. package/dist/types.js.map +1 -0
  126. package/dist/viewer-html.d.ts +2 -0
  127. package/dist/viewer-html.d.ts.map +1 -0
  128. package/dist/viewer-html.js +185 -0
  129. package/dist/viewer-html.js.map +1 -0
  130. package/dist/viewer-script.d.ts +47 -0
  131. package/dist/viewer-script.d.ts.map +1 -0
  132. package/dist/viewer-script.js +586 -0
  133. package/dist/viewer-script.js.map +1 -0
  134. package/package.json +86 -0
  135. package/scripts/build-all-platforms.sh +68 -0
  136. package/scripts/check-version-sync.js +39 -0
  137. package/scripts/check_goods_container.js +35 -0
  138. package/scripts/check_page_content.js +36 -0
  139. package/scripts/click_applause_rate.js +30 -0
  140. package/scripts/copy-native.js +36 -0
  141. package/scripts/copy-recorder.js +21 -0
  142. package/scripts/e2e-test-recorder.ts +584 -0
  143. package/scripts/explore_jd_page.js +31 -0
  144. package/scripts/extract_all_jd_data.js +80 -0
  145. package/scripts/extract_jd_product_detail.js +62 -0
  146. package/scripts/extract_jd_products_correct_links.js +78 -0
  147. package/scripts/extract_jd_products_final.js +80 -0
  148. package/scripts/extract_jd_reviews.js +48 -0
  149. package/scripts/extract_jd_seafood_final.js +78 -0
  150. package/scripts/extract_multiple_products.js +77 -0
  151. package/scripts/extract_products_no_scroll.js +68 -0
  152. package/scripts/extract_products_simple.js +68 -0
  153. package/scripts/find_applause_rate.js +26 -0
  154. package/scripts/find_jd_links.js +28 -0
  155. package/scripts/find_main_content.js +20 -0
  156. package/scripts/find_product_cards.js +38 -0
  157. package/scripts/find_root_content.js +26 -0
  158. package/scripts/find_unique_products.js +55 -0
  159. package/scripts/get_jd_product_detail.js +16 -0
  160. package/scripts/get_jd_products.js +23 -0
  161. package/scripts/get_jd_seafood_products.js +44 -0
  162. package/scripts/get_product_details_from_images.js +54 -0
  163. package/scripts/postinstall.js +235 -0
  164. package/scripts/scroll_and_get_products.js +47 -0
  165. package/scripts/scroll_deep_and_find.js +45 -0
  166. package/scripts/sync-version.js +69 -0
  167. package/scripts/verify-baidu-enter.ts +116 -0
  168. package/skills/agent-browser/SKILL.md +310 -0
  169. package/skills/agent-browser/references/authentication.md +198 -0
  170. package/skills/agent-browser/references/commands.md +471 -0
  171. package/skills/agent-browser/references/data-extraction.md +377 -0
  172. package/skills/agent-browser/references/proxy-support.md +188 -0
  173. package/skills/agent-browser/references/session-management.md +197 -0
  174. package/skills/agent-browser/references/snapshot-refs.md +379 -0
  175. package/skills/agent-browser/references/video-recording.md +173 -0
  176. package/skills/agent-browser/templates/api-interception.sh +53 -0
  177. package/skills/agent-browser/templates/authenticated-session.sh +97 -0
  178. package/skills/agent-browser/templates/capture-workflow.sh +69 -0
  179. package/skills/agent-browser/templates/data-extraction.sh +210 -0
  180. package/skills/agent-browser/templates/form-automation.sh +62 -0
  181. package/skills/skill-creator/LICENSE.txt +202 -0
  182. package/skills/skill-creator/SKILL.md +356 -0
  183. package/skills/skill-creator/references/output-patterns.md +82 -0
  184. package/skills/skill-creator/references/workflows.md +28 -0
  185. package/skills/skill-creator/scripts/init_skill.py +303 -0
  186. package/skills/skill-creator/scripts/package_skill.py +113 -0
  187. package/skills/skill-creator/scripts/quick_validate.py +95 -0
@@ -0,0 +1,1024 @@
1
+ const HELP_TEXT = {
2
+ open: `
3
+ agent-browser open - Navigate to a URL
4
+
5
+ Usage: agent-browser open <url>
6
+
7
+ Navigates the browser to the specified URL. If no protocol is provided,
8
+ https:// is automatically prepended.
9
+
10
+ Aliases: goto, navigate
11
+
12
+ Global Options:
13
+ --json Output as JSON
14
+ --session <name> Use specific session
15
+ --headers <json> Set HTTP headers (scoped to this origin)
16
+ --headed Show browser window
17
+
18
+ Examples:
19
+ agent-browser open example.com
20
+ agent-browser open https://github.com
21
+ agent-browser open localhost:3000
22
+ agent-browser open api.example.com --headers '{"Authorization": "Bearer token"}'
23
+ `,
24
+ back: `
25
+ agent-browser back - Navigate back in history
26
+
27
+ Usage: agent-browser back
28
+
29
+ Goes back one page in the browser history.
30
+
31
+ Examples:
32
+ agent-browser back
33
+ `,
34
+ forward: `
35
+ agent-browser forward - Navigate forward in history
36
+
37
+ Usage: agent-browser forward
38
+
39
+ Goes forward one page in the browser history.
40
+
41
+ Examples:
42
+ agent-browser forward
43
+ `,
44
+ reload: `
45
+ agent-browser reload - Reload the current page
46
+
47
+ Usage: agent-browser reload
48
+
49
+ Reloads the current page.
50
+
51
+ Examples:
52
+ agent-browser reload
53
+ `,
54
+ click: `
55
+ agent-browser click - Click an element
56
+
57
+ Usage: agent-browser click <selector> [options]
58
+
59
+ Clicks on the specified element. The selector can be a CSS selector,
60
+ XPath, or an element reference from snapshot (e.g., @e1).
61
+
62
+ Options:
63
+ --in-frame <path> Target element in iframe
64
+ --diff [scope] Show page changes after click
65
+ scope options:
66
+ - (no arg) 3 levels up from target (default)
67
+ - N N levels up from target
68
+ - full entire page
69
+ - selector CSS selector for diff scope
70
+
71
+ Examples:
72
+ agent-browser click "#submit-button"
73
+ agent-browser click @e1
74
+ agent-browser click @e1 --diff
75
+ agent-browser click @e1 --diff 5
76
+ agent-browser click @e1 --diff full
77
+ agent-browser click @e2 --in-frame "frame1"
78
+ `,
79
+ fill: `
80
+ agent-browser fill - Clear and fill an input field
81
+
82
+ Usage: agent-browser fill <selector> <text> [options]
83
+
84
+ Clears the input field and fills it with the specified text.
85
+
86
+ Options:
87
+ --in-frame <path> Target element in iframe
88
+ --diff [scope] Show page changes after fill
89
+
90
+ Examples:
91
+ agent-browser fill "#email" "user@example.com"
92
+ agent-browser fill @e3 "Hello World"
93
+ agent-browser fill @e3 "Hello" --diff
94
+ agent-browser fill "#input" "test" --in-frame "#frame1"
95
+ `,
96
+ type: `
97
+ agent-browser type - Type text into an element
98
+
99
+ Usage: agent-browser type <selector> <text> [options]
100
+
101
+ Types text into the specified element character by character.
102
+
103
+ Options:
104
+ --in-frame <path> Target element in iframe
105
+ --diff [scope] Show page changes after type
106
+
107
+ Examples:
108
+ agent-browser type "#search" "hello"
109
+ agent-browser type @e2 "additional text"
110
+ agent-browser type @e2 "hello" --diff
111
+ agent-browser type "#input" "test" --in-frame "#frame1"
112
+ `,
113
+ press: `
114
+ agent-browser press - Press a key or key combination
115
+
116
+ Usage: agent-browser press <key> [--diff [scope]] [--in-frame <path>]
117
+
118
+ Presses a key or key combination. Supports special keys and modifiers.
119
+
120
+ Options:
121
+ --in-frame <path> Target element in iframe
122
+ --diff [scope] Show page changes after press
123
+
124
+ Special Keys:
125
+ Enter, Tab, Escape, Backspace, Delete, Space
126
+ ArrowUp, ArrowDown, ArrowLeft, ArrowRight
127
+ Home, End, PageUp, PageDown, F1-F12
128
+
129
+ Modifiers (combine with +):
130
+ Control, Alt, Shift, Meta
131
+
132
+ Examples:
133
+ agent-browser press Enter
134
+ agent-browser press Control+a
135
+ agent-browser press Control+Shift+s
136
+ agent-browser press Enter --diff
137
+ `,
138
+ wait: `
139
+ agent-browser wait - Wait for condition
140
+
141
+ Usage: agent-browser wait <selector|ms|option> [--in-frame <path>]
142
+
143
+ Waits for an element to appear, a timeout, or other conditions.
144
+
145
+ Options:
146
+ --in-frame <path> Target element in iframe
147
+
148
+ Modes:
149
+ <selector> Wait for element to appear
150
+ <ms> Wait for specified milliseconds
151
+ --url <pattern> Wait for URL to match pattern
152
+ --load <state> Wait for load state (load, domcontentloaded, networkidle)
153
+ --fn <expression> Wait for JavaScript expression to be truthy
154
+ --text <text> Wait for text to appear on page
155
+ --download [path] Wait for a download to complete
156
+ --request <pattern> Wait for request and get response body
157
+
158
+ Examples:
159
+ agent-browser wait "#loading-spinner"
160
+ agent-browser wait 2000
161
+ agent-browser wait --url "**/dashboard"
162
+ agent-browser wait --load networkidle
163
+ agent-browser wait --text "Welcome back"
164
+ agent-browser wait --download ./file.pdf
165
+ agent-browser wait --request "**/api/data"
166
+ agent-browser wait "#btn" --in-frame "#frame1"
167
+ `,
168
+ screenshot: `
169
+ agent-browser screenshot - Take a screenshot
170
+
171
+ Usage: agent-browser screenshot [selector] [path] [options]
172
+
173
+ Captures a screenshot of the current page or a specific element.
174
+
175
+ Arguments:
176
+ [selector] CSS selector, XPath, or element reference (e.g., @e1)
177
+ [path] Save path for the screenshot
178
+
179
+ Options:
180
+ --full, -f Capture full page (not just viewport)
181
+ --in-frame <path> Target iframe
182
+
183
+ Examples:
184
+ agent-browser screenshot
185
+ agent-browser screenshot ./screenshot.png
186
+ agent-browser screenshot --full ./full-page.png
187
+ agent-browser screenshot .header # Screenshot element
188
+ agent-browser screenshot #submit-btn ./button.png # Screenshot element to file
189
+ agent-browser screenshot @e1 # Screenshot referenced element
190
+ agent-browser screenshot --in-frame "#frame1"
191
+ `,
192
+ snapshot: `
193
+ agent-browser snapshot - Get accessibility tree snapshot
194
+
195
+ Usage: agent-browser snapshot [options]
196
+
197
+ Returns an accessibility tree representation of the page with element
198
+ references (like @e1, @e2) that can be used in subsequent commands.
199
+
200
+ Options:
201
+ -i, --interactive Only include interactive elements
202
+ -C, --cursor Include cursor-interactive elements
203
+ -c, --compact Remove empty structural elements
204
+ -d, --depth <n> Limit tree depth
205
+ -s, --selector <sel> Scope snapshot to CSS selector
206
+ --in-frame <path> Target iframe (path: "#frame1" or "#frame1/#frame2")
207
+ --path Include xpath and cssPath in refs (requires --selector)
208
+ --attrs Include element attributes in refs (requires --selector)
209
+
210
+ Examples:
211
+ agent-browser snapshot
212
+ agent-browser snapshot -i
213
+ agent-browser snapshot -i -C
214
+ agent-browser snapshot --compact --depth 5
215
+ agent-browser snapshot --selector "main" --path
216
+ agent-browser snapshot --selector "form" --attrs
217
+ agent-browser snapshot -s "main" --path --attrs
218
+ `,
219
+ eval: `
220
+ agent-browser eval - Execute JavaScript
221
+
222
+ Usage: agent-browser eval [options] <script> [--in-frame <path>]
223
+
224
+ Executes JavaScript code in the browser context.
225
+
226
+ Options:
227
+ --in-frame <path> Execute in iframe
228
+ -b, --base64 Decode script from base64
229
+ --stdin Read script from stdin
230
+ --file <path> Read script from file
231
+
232
+ Examples:
233
+ agent-browser eval "document.title"
234
+ agent-browser eval -b "ZG9jdW1lbnQudGl0bGU="
235
+ agent-browser eval --file script.js
236
+ agent-browser eval "document.body.innerHTML" --in-frame "#frame1"
237
+ `,
238
+ get: `
239
+ agent-browser get - Retrieve information from elements or page
240
+
241
+ Usage: agent-browser get <subcommand> [args] [--in-frame <path>]
242
+
243
+ Subcommands:
244
+ text <selector> Get text content
245
+ html <selector> Get inner HTML
246
+ value <selector> Get input value
247
+ attr <selector> <name> Get attribute value
248
+ title Get page title
249
+ url Get current URL
250
+ count <selector> Count matching elements
251
+ box <selector> Get bounding box
252
+ styles <selector> Get computed styles
253
+
254
+ Options:
255
+ --in-frame <path> Target element in iframe
256
+
257
+ Examples:
258
+ agent-browser get text @e1
259
+ agent-browser get attr "#link" href
260
+ agent-browser get title
261
+ agent-browser get url
262
+ agent-browser get text "#content" --in-frame "#frame1"
263
+ `,
264
+ is: `
265
+ agent-browser is - Check element state
266
+
267
+ Usage: agent-browser is <subcommand> <selector> [--in-frame <path>]
268
+
269
+ Subcommands:
270
+ visible <selector> Check if element is visible
271
+ enabled <selector> Check if element is enabled
272
+ checked <selector> Check if checkbox is checked
273
+
274
+ Options:
275
+ --in-frame <path> Target element in iframe
276
+
277
+ Examples:
278
+ agent-browser is visible "#modal"
279
+ agent-browser is enabled "#submit-btn"
280
+ agent-browser is visible "#element" --in-frame "#frame1"
281
+ `,
282
+ find: `
283
+ agent-browser find - Find and interact with elements by locator
284
+
285
+ Usage: agent-browser find <locator> <value> [action] [text] [--in-frame <path>]
286
+
287
+ Locators:
288
+ role <role> Find by ARIA role (--name <n>, --exact)
289
+ text <text> Find by text content (--exact)
290
+ label <label> Find by associated label
291
+ placeholder <text> Find by placeholder text
292
+ alt <text> Find by alt text
293
+ title <text> Find by title attribute
294
+ testid <id> Find by data-testid
295
+ first <selector> First matching element
296
+ last <selector> Last matching element
297
+ nth <index> <selector> Nth matching element
298
+
299
+ Actions (default: click):
300
+ click, fill, type, hover, focus, check, uncheck
301
+
302
+ Options:
303
+ --in-frame <path> Target element in iframe
304
+
305
+ Examples:
306
+ agent-browser find role button click --name Submit
307
+ agent-browser find text "Sign In" click
308
+ agent-browser find label "Email" fill "user@example.com"
309
+ agent-browser find role button --in-frame "#frame1"
310
+ `,
311
+ set: `
312
+ agent-browser set - Configure browser settings
313
+
314
+ Usage: agent-browser set <setting> [args]
315
+
316
+ Settings:
317
+ viewport <w> <h> Set viewport size
318
+ device <name> Emulate device
319
+ geo <lat> <lng> Set geolocation
320
+ offline [on|off] Toggle offline mode
321
+ headers <json> Set extra HTTP headers
322
+ credentials <user> <pass> Set HTTP authentication
323
+ media [dark|light] [reduced-motion]
324
+
325
+ Examples:
326
+ agent-browser set viewport 1920 1080
327
+ agent-browser set device "iPhone 12"
328
+ agent-browser set geo 37.7749 -122.4194
329
+ agent-browser set headers '{"X-Custom": "value"}'
330
+ `,
331
+ network: `
332
+ agent-browser network - Network interception and monitoring
333
+
334
+ Usage: agent-browser network <subcommand> [args]
335
+
336
+ Subcommands:
337
+ route <url> [options] Intercept requests
338
+ --abort Abort matching requests
339
+ --body <json> Respond with custom body
340
+ unroute [url] Remove route
341
+ requests [options] List captured requests
342
+ --clear Clear request log
343
+ --filter <pattern> Filter by URL
344
+
345
+ Examples:
346
+ agent-browser network route "**/api/*" --abort
347
+ agent-browser network requests
348
+ `,
349
+ cookies: `
350
+ agent-browser cookies - Manage browser cookies
351
+
352
+ Usage: agent-browser cookies [operation] [args]
353
+
354
+ Operations:
355
+ get Get all cookies (default)
356
+ set <name> <value> [options] Set a cookie
357
+ clear Clear all cookies
358
+
359
+ Cookie Set Options:
360
+ --url <url> URL for the cookie
361
+ --domain <domain> Cookie domain
362
+ --path <path> Cookie path
363
+ --httpOnly Set HttpOnly flag
364
+ --secure Set Secure flag
365
+ --sameSite <Strict|Lax|None> SameSite policy
366
+ --expires <timestamp> Expiration time
367
+
368
+ Examples:
369
+ agent-browser cookies set session_id "abc123"
370
+ agent-browser cookies set auth "token" --url https://app.example.com
371
+ agent-browser cookies
372
+ agent-browser cookies clear
373
+ `,
374
+ storage: `
375
+ agent-browser storage - Manage web storage
376
+
377
+ Usage: agent-browser storage <type> [operation] [key] [value]
378
+
379
+ Types:
380
+ local localStorage
381
+ session sessionStorage
382
+
383
+ Operations:
384
+ get [key] Get all storage or specific key
385
+ set <key> <value> Set a key-value pair
386
+ clear Clear all storage
387
+
388
+ Examples:
389
+ agent-browser storage local
390
+ agent-browser storage local set theme "dark"
391
+ agent-browser storage session clear
392
+ `,
393
+ tab: `
394
+ agent-browser tab - Manage browser tabs
395
+
396
+ Usage: agent-browser tab [operation] [args]
397
+
398
+ Operations:
399
+ list List all tabs (default)
400
+ new [url] Open new tab
401
+ close [index] Close tab
402
+ <index> Switch to tab by index
403
+
404
+ Examples:
405
+ agent-browser tab
406
+ agent-browser tab new https://example.com
407
+ agent-browser tab 2
408
+ agent-browser tab close
409
+ `,
410
+ session: `
411
+ agent-browser session - Manage sessions
412
+
413
+ Usage: agent-browser session [operation]
414
+
415
+ Manage isolated browser sessions. Each session has its own browser
416
+ instance with separate cookies, storage, and state.
417
+
418
+ Operations:
419
+ (none) Show current session name
420
+ list List all active sessions
421
+
422
+ Examples:
423
+ agent-browser session
424
+ agent-browser session list
425
+ agent-browser --session test open example.com
426
+ `,
427
+ install: `
428
+ agent-browser install - Install browser binaries
429
+
430
+ Usage: agent-browser install [--with-deps]
431
+
432
+ Downloads and installs browser binaries required for automation.
433
+
434
+ Options:
435
+ -d, --with-deps Also install system dependencies (Linux only)
436
+
437
+ Examples:
438
+ agent-browser install
439
+ agent-browser install --with-deps
440
+ `,
441
+ connect: `
442
+ agent-browser connect - Connect to browser via CDP
443
+
444
+ Usage: agent-browser connect <port|url>
445
+
446
+ Connects to a running browser instance via Chrome DevTools Protocol.
447
+
448
+ Arguments:
449
+ <port> Local port number (e.g., 9222)
450
+ <url> Full WebSocket URL
451
+
452
+ Examples:
453
+ agent-browser connect 9222
454
+ agent-browser connect "ws://localhost:9222/devtools/browser/abc123"
455
+ `,
456
+ close: `
457
+ agent-browser close - Close the browser
458
+
459
+ Usage: agent-browser close
460
+
461
+ Closes the browser instance for the current session.
462
+
463
+ Aliases: quit, exit
464
+
465
+ Examples:
466
+ agent-browser close
467
+ `,
468
+ record: `
469
+ agent-browser record - Record browser session to video
470
+
471
+ Usage: agent-browser record <operation> [path] [url]
472
+
473
+ Operations:
474
+ start <path> [url] Start recording
475
+ stop Stop and save video
476
+ restart <path> [url] Stop current and start new
477
+
478
+ Examples:
479
+ agent-browser record start ./demo.webm
480
+ agent-browser record stop
481
+ `,
482
+ recorder: `
483
+ agent-browser recorder - Record user interactions as steps
484
+
485
+ Usage: agent-browser recorder <operation> [options]
486
+
487
+ Records user interactions (clicks, inputs, scrolls, etc.) as structured
488
+ steps that can be exported as YAML for LLM processing.
489
+
490
+ Operations:
491
+ start [url] Start recording (optionally navigate to URL)
492
+ stop [--output file] Stop recording and output YAML
493
+ status Show recording status
494
+ replay [file] Replay recorded CLI commands from YAML
495
+
496
+ Options:
497
+ --output <file> Save YAML to file (default: temp directory)
498
+ [file] YAML file to replay (default: most recent)
499
+
500
+ Output Format:
501
+ YAML with session info, pages visited, and recorded steps.
502
+ Each step includes: action, selector, xpath, value, trajectory.
503
+ CLI Commands section contains executable commands for replay.
504
+
505
+ Examples:
506
+ agent-browser recorder start
507
+ agent-browser recorder start https://example.com
508
+ agent-browser recorder stop
509
+ agent-browser recorder stop --output session.yaml
510
+ agent-browser recorder status
511
+ agent-browser recorder replay # Replay most recent
512
+ agent-browser recorder replay session.yaml # Replay specific file
513
+ `,
514
+ trace: `
515
+ agent-browser trace - Record execution trace
516
+
517
+ Usage: agent-browser trace <operation> [path]
518
+
519
+ Operations:
520
+ start Start recording trace
521
+ stop <path> Stop and save trace
522
+
523
+ Examples:
524
+ agent-browser trace start
525
+ agent-browser trace stop ./debug-trace.zip
526
+ `,
527
+ state: `
528
+ agent-browser state - Save/load browser state
529
+
530
+ Usage: agent-browser state <operation> <path>
531
+
532
+ Operations:
533
+ save <path> Save current state to file
534
+ load <path> Set state path (load at launch)
535
+
536
+ Examples:
537
+ agent-browser state save ./auth-state.json
538
+ agent-browser --state ./auth-state.json open example.com
539
+ `,
540
+ device: `
541
+ agent-browser device - Manage iOS simulators
542
+
543
+ Usage: agent-browser device [list]
544
+
545
+ Operations:
546
+ list List available iOS simulators
547
+
548
+ Examples:
549
+ agent-browser device list
550
+ `,
551
+ hover: `
552
+ agent-browser hover - Hover over an element
553
+
554
+ Usage: agent-browser hover <selector> [options]
555
+
556
+ Hovers over the specified element.
557
+
558
+ Options:
559
+ --in-frame <path> Target element in iframe
560
+ --diff [scope] Show page changes after hover
561
+
562
+ Examples:
563
+ agent-browser hover "#menu-item"
564
+ agent-browser hover @e2
565
+ agent-browser hover "#btn" --in-frame "#frame1"
566
+ `,
567
+ focus: `
568
+ agent-browser focus - Focus an element
569
+
570
+ Usage: agent-browser focus <selector> [--diff [scope]] [--in-frame <path>]
571
+
572
+ Sets focus on the specified element.
573
+
574
+ Options:
575
+ --in-frame <path> Target element in iframe
576
+ --diff [scope] Show page changes after focus
577
+
578
+ Examples:
579
+ agent-browser focus "#input"
580
+ agent-browser focus @e3
581
+ agent-browser focus "#field" --in-frame "#frame1"
582
+ `,
583
+ check: `
584
+ agent-browser check - Check a checkbox or radio button
585
+
586
+ Usage: agent-browser check <selector> [--diff [scope]] [--in-frame <path>]
587
+
588
+ Checks the specified checkbox or radio button.
589
+
590
+ Options:
591
+ --in-frame <path> Target element in iframe
592
+ --diff [scope] Show page changes after check
593
+
594
+ Examples:
595
+ agent-browser check "#agree"
596
+ agent-browser check @e4
597
+ agent-browser check "#terms" --in-frame "#frame1"
598
+ `,
599
+ uncheck: `
600
+ agent-browser uncheck - Uncheck a checkbox
601
+
602
+ Usage: agent-browser uncheck <selector> [--diff [scope]] [--in-frame <path>]
603
+
604
+ Unchecks the specified checkbox.
605
+
606
+ Options:
607
+ --in-frame <path> Target element in iframe
608
+ --diff [scope] Show page changes after uncheck
609
+
610
+ Examples:
611
+ agent-browser uncheck "#newsletter"
612
+ agent-browser uncheck @e5
613
+ agent-browser uncheck "#opt-in" --in-frame "#frame1"
614
+ `,
615
+ select: `
616
+ agent-browser select - Select dropdown option(s)
617
+
618
+ Usage: agent-browser select <selector> <value...> [--diff [scope]] [--in-frame <path>]
619
+
620
+ Selects option(s) in a dropdown element.
621
+
622
+ Options:
623
+ --in-frame <path> Target element in iframe
624
+ --diff [scope] Show page changes after select
625
+
626
+ Examples:
627
+ agent-browser select "#country" "US"
628
+ agent-browser select "#colors" "red" "blue"
629
+ agent-browser select "#menu" "option1" --in-frame "#frame1"
630
+ `,
631
+ drag: `
632
+ agent-browser drag - Drag and drop
633
+
634
+ Usage: agent-browser drag <source> <target> [--in-frame <path>]
635
+
636
+ Drags an element from source to target.
637
+
638
+ Options:
639
+ --in-frame <path> Target elements in iframe
640
+
641
+ Examples:
642
+ agent-browser drag "#item" "#dropzone"
643
+ agent-browser drag @e1 @e2
644
+ agent-browser drag "#item" "#target" --in-frame "#frame1"
645
+ `,
646
+ upload: `
647
+ agent-browser upload - Upload files
648
+
649
+ Usage: agent-browser upload <selector> <files...> [--in-frame <path>]
650
+
651
+ Uploads files to a file input element.
652
+
653
+ Options:
654
+ --in-frame <path> Target element in iframe
655
+
656
+ Examples:
657
+ agent-browser upload "#file-input" ./document.pdf
658
+ agent-browser upload "#photos" ./img1.jpg ./img2.jpg
659
+ agent-browser upload "#file" ./doc.pdf --in-frame "#frame1"
660
+ `,
661
+ download: `
662
+ agent-browser download - Download file by clicking element
663
+
664
+ Usage: agent-browser download <selector> <path> [--in-frame <path>]
665
+
666
+ Clicks an element and saves the downloaded file.
667
+
668
+ Options:
669
+ --in-frame <path> Target element in iframe
670
+
671
+ Examples:
672
+ agent-browser download "#download-btn" ./file.pdf
673
+ agent-browser download @e6 ./report.xlsx
674
+ agent-browser download "#link" ./data.csv --in-frame "#frame1"
675
+ `,
676
+ scroll: `
677
+ agent-browser scroll - Scroll the page
678
+
679
+ Usage: agent-browser scroll <direction> [amount] [--in-frame <path>]
680
+
681
+ Scrolls the page in the specified direction.
682
+
683
+ Options:
684
+ --in-frame <path> Target iframe
685
+
686
+ Directions:
687
+ up, down, left, right
688
+
689
+ Examples:
690
+ agent-browser scroll down
691
+ agent-browser scroll up 500
692
+ agent-browser scroll down --in-frame "#frame1"
693
+ `,
694
+ scrollintoview: `
695
+ agent-browser scrollintoview - Scroll element into view
696
+
697
+ Usage: agent-browser scrollintoview <selector> [--in-frame <path>]
698
+
699
+ Scrolls the page until the element is visible.
700
+
701
+ Options:
702
+ --in-frame <path> Target element in iframe
703
+
704
+ Examples:
705
+ agent-browser scrollintoview "#footer"
706
+ agent-browser scrollintoview @e7
707
+ agent-browser scrollintoview "#section" --in-frame "#frame1"
708
+ `,
709
+ dblclick: `
710
+ agent-browser dblclick - Double-click an element
711
+
712
+ Usage: agent-browser dblclick <selector> [options]
713
+
714
+ Double-clicks on the specified element.
715
+
716
+ Options:
717
+ --in-frame <path> Target element in iframe
718
+ --diff [scope] Show page changes after double-click
719
+
720
+ Examples:
721
+ agent-browser dblclick "#item"
722
+ agent-browser dblclick @e8
723
+ agent-browser dblclick "#file" --in-frame "#frame1"
724
+ `,
725
+ viewer: `
726
+ agent-browser viewer - Get viewer URL for browser session
727
+
728
+ Usage: agent-browser viewer
729
+
730
+ Returns URLs for viewing the browser session remotely.
731
+ Requires Stream Server to be running.
732
+
733
+ Output (JSON mode):
734
+ url HTTP viewer URL (e.g., http://localhost:5005/view?instanceId=xxx)
735
+ wsUrl WebSocket URL (e.g., ws://localhost:5005?instanceId=xxx)
736
+ streamPort Stream server port (default: 5005)
737
+
738
+ Note: In normal mode, only the HTTP viewer URL is printed.
739
+ Use --json to see all fields.
740
+
741
+ Examples:
742
+ agent-browser viewer
743
+ agent-browser viewer --json
744
+ `,
745
+ ask: `
746
+ agent-browser ask - Ask user a question
747
+
748
+ Usage: agent-browser ask <question>
749
+
750
+ Sends a question to the user and waits for a response.
751
+ Requires Stream Server with message bridge.
752
+
753
+ Question Formats:
754
+
755
+ 1. Simple String:
756
+ agent-browser ask "What should I do next?"
757
+
758
+ 2. Structured JSON (for multiple choice):
759
+ The question can be a JSON string with options for the user to select.
760
+
761
+ Structure:
762
+ {
763
+ "questions": [
764
+ {
765
+ "header": "Section Title (optional)",
766
+ "question": "Your question here",
767
+ "multiSelect": false,
768
+ "options": [
769
+ { "label": "Option 1", "description": "Optional description" },
770
+ { "label": "Option 2" }
771
+ ]
772
+ }
773
+ ]
774
+ }
775
+
776
+ Examples:
777
+ # Simple question
778
+ agent-browser ask "What should I do next?"
779
+
780
+ # Multiple choice question
781
+ agent-browser ask '{"questions":[{"question":"Choose an action","options":[{"label":"Login"},{"label":"Skip"}]}]}'
782
+
783
+ # Multi-select question
784
+ agent-browser ask '{"questions":[{"question":"Select items","multiSelect":true,"options":[{"label":"Item 1"},{"label":"Item 2"}]}]}'
785
+
786
+ # With header and descriptions
787
+ agent-browser ask '{"questions":[{"header":"Authentication","question":"How would you like to login?","options":[{"label":"Email","description":"Login with email and password"},{"label":"Google","description":"Login with Google account"}]}]}'
788
+
789
+ Output:
790
+ answer User's response (string or selected option(s))
791
+ `,
792
+ config: `
793
+ agent-browser config - Show current configuration
794
+
795
+ Usage: agent-browser config [--json]
796
+
797
+ Displays all AGENT_BROWSER_* environment variables and their current values.
798
+
799
+ Options:
800
+ --json Output in JSON format
801
+
802
+ Examples:
803
+ agent-browser config # Show all settings
804
+ agent-browser config --json # JSON output
805
+
806
+ Output Fields:
807
+ session Session name (AGENT_BROWSER_SESSION)
808
+ executablePath Custom browser path
809
+ provider Cloud browser provider
810
+ headed Show browser window
811
+ profile Persistent profile directory
812
+ extensions Browser extensions
813
+ proxy Proxy server URL
814
+ human Human mode settings (runtime)
815
+
816
+ Note: Most settings only take effect at browser startup.
817
+ Use "export AGENT_BROWSER_XXX=value" before starting.
818
+ Only AGENT_BROWSER_HUMAN takes effect at runtime.
819
+ `,
820
+ };
821
+ export function printCommandHelp(command) {
822
+ const help = HELP_TEXT[command];
823
+ if (help) {
824
+ console.log(help.trim());
825
+ return true;
826
+ }
827
+ return false;
828
+ }
829
+ export function printHelp() {
830
+ console.log(`
831
+ agent-browser - fast browser automation CLI for AI agents
832
+
833
+ Usage: agent-browser <command> [args] [options]
834
+
835
+ Core Commands:
836
+ open <url> Navigate to URL
837
+ click <sel> Click element (or @ref)
838
+ dblclick <sel> Double-click element
839
+ type <sel> <text> Type into element
840
+ fill <sel> <text> Clear and fill
841
+ press <key> Press key (Enter, Tab, Control+a)
842
+ hover <sel> Hover element
843
+ focus <sel> Focus element
844
+ check <sel> Check checkbox
845
+ uncheck <sel> Uncheck checkbox
846
+ select <sel> <val...> Select dropdown option
847
+ drag <src> <dst> Drag and drop
848
+ upload <sel> <files...> Upload files
849
+ download <sel> <path> Download file by clicking element
850
+ scroll <dir> [px] Scroll (up/down/left/right)
851
+ scrollintoview <sel> Scroll element into view
852
+ wait <sel|ms> Wait for element or time
853
+ screenshot [path] Take screenshot
854
+ pdf <path> Save as PDF
855
+ snapshot Accessibility tree with refs (for AI)
856
+ eval <js> Run JavaScript
857
+ connect <port|url> Connect to browser via CDP
858
+ close Close browser
859
+
860
+ Navigation:
861
+ back Go back
862
+ forward Go forward
863
+ reload Reload page
864
+
865
+ Get Info: agent-browser get <what> [selector]
866
+ text, html, value, attr <name>, title, url, count, box, styles
867
+
868
+ Check State: agent-browser is <what> <selector>
869
+ visible, enabled, checked
870
+
871
+ Find Elements: agent-browser find <locator> <value> <action> [text]
872
+ role, text, label, placeholder, alt, title, testid, first, last, nth
873
+
874
+ Mouse: agent-browser mouse <action> [args]
875
+ move <x> <y>, down [btn], up [btn], wheel <dy> [dx]
876
+ wander <ms> Random mouse movement
877
+ trajectory "x:y:d;..." Move along trajectory points
878
+
879
+ Browser Settings: agent-browser set <setting> [value]
880
+ viewport <w> <h>, device <name>, geo <lat> <lng>
881
+ offline [on|off], headers <json>, credentials <user> <pass>
882
+ media [dark|light] [reduced-motion]
883
+
884
+ Network: agent-browser network <action>
885
+ route <url> [--abort|--body <json>]
886
+ unroute [url]
887
+ requests [--clear] [--filter <pattern>]
888
+
889
+ Storage:
890
+ cookies [get|set|clear] Manage cookies
891
+ storage <local|session> Manage web storage
892
+
893
+ Tabs:
894
+ tab [new|list|close|<n>] Manage tabs
895
+
896
+ Debug:
897
+ trace start|stop [path] Record trace
898
+ record start <path> [url] Start video recording (WebM)
899
+ record stop Stop and save video
900
+ recorder start [url] Start step recording
901
+ recorder stop [--output] Stop and output YAML
902
+ recorder status Show recording status
903
+ recorder replay [file] Replay recorded commands
904
+ console [--clear] View console logs
905
+ errors [--clear] View page errors
906
+ highlight <sel> Highlight element
907
+
908
+ Sessions:
909
+ session Show current session name
910
+ session list List active sessions
911
+ kill Kill all daemons and Stream Server
912
+
913
+ Remote:
914
+ viewer Get viewer URL for browser session
915
+ ask <question> Ask user a question (requires Stream Server)
916
+
917
+ Config:
918
+ config [--json] Show current environment configuration
919
+
920
+ Setup:
921
+ install Install browser binaries
922
+ install --with-deps Also install system dependencies (Linux)
923
+
924
+ Snapshot Options:
925
+ -i, --interactive Only interactive elements
926
+ -c, --compact Remove empty structural elements
927
+ -d, --depth <n> Limit tree depth
928
+ -s, --selector <sel> Scope snapshot to CSS selector
929
+ --in-frame <path> Target iframe
930
+
931
+ Iframe Path Format:
932
+ --in-frame <path> Target element in iframe
933
+ path format:
934
+ - "#frame1" single iframe by ID/name
935
+ - "#frame1/#frame2" nested iframes (2 levels)
936
+ - "0" by index (0-based)
937
+ - "iframe-url" by URL path segment
938
+
939
+ Diff Options (for click, fill, type, press, etc.):
940
+ --diff [scope] Show page changes after action
941
+ scope options:
942
+ - (no arg) 3 levels up from target (default)
943
+ - N N levels up from target
944
+ - full entire page
945
+ - selector CSS selector for diff scope
946
+
947
+ Options:
948
+ --session <name> Isolated session (or AGENT_BROWSER_SESSION env)
949
+ --profile <path> Persistent browser profile
950
+ --state <path> Load storage state from JSON file
951
+ --headers <json> HTTP headers scoped to URL's origin
952
+ --executable-path <path> Custom browser executable
953
+ --extension <path> Load browser extensions (repeatable)
954
+ --args <args> Browser launch args
955
+ --user-agent <ua> Custom User-Agent
956
+ --proxy <server> Proxy server URL
957
+ --proxy-bypass <hosts> Bypass proxy for these hosts
958
+ --ignore-https-errors Ignore HTTPS certificate errors
959
+ --allow-file-access Allow file:// URLs to access local files
960
+ -p, --provider <name> Browser provider: ios, browserbase, kernel
961
+ --device <name> iOS device name
962
+ --json JSON output
963
+ --full, -f Full page screenshot
964
+ --headed Show browser window
965
+ --cdp <port> Connect via CDP
966
+ --debug Debug output
967
+ --version, -V Show version
968
+ --help, -h Show this help
969
+
970
+ Environment:
971
+ AGENT_BROWSER_SESSION Session name (default: "default")
972
+ AGENT_BROWSER_EXECUTABLE_PATH Custom browser executable path
973
+ AGENT_BROWSER_PROVIDER Browser provider (ios, browserbase, kernel, browseruse)
974
+ AGENT_BROWSER_IOS_DEVICE Default iOS device name
975
+ AGENT_BROWSER_IOS_UDID iOS device UDID
976
+ AGENT_BROWSER_STREAM_PORT Stream Server port (default: 5005)
977
+ AGENT_BROWSER_SOCKET_DIR Custom socket directory
978
+ AGENT_BROWSER_HOME Installation directory
979
+ AGENT_BROWSER_PROFILE Persistent browser profile path
980
+ AGENT_BROWSER_STATE Storage state JSON file path
981
+ AGENT_BROWSER_EXTENSIONS Browser extensions (comma-separated)
982
+ AGENT_BROWSER_ARGS Browser launch args
983
+ AGENT_BROWSER_USER_AGENT Custom User-Agent
984
+ AGENT_BROWSER_PROXY Proxy server URL
985
+ AGENT_BROWSER_PROXY_BYPASS Proxy bypass hosts
986
+ AGENT_BROWSER_IGNORE_HTTPS_ERRORS Set to "1" to ignore HTTPS errors
987
+ AGENT_BROWSER_ALLOW_FILE_ACCESS Set to "1" to allow file:// access
988
+ AGENT_BROWSER_HEADED Set to "1" for headed mode
989
+ AGENT_BROWSER_HUMAN Enable human-like mouse movement (1, bezier, arc, random, linear)
990
+
991
+ MESSAGE_BRIDGE_URL Message Bridge URL for 'ask' command
992
+ HTTP_PROXY / HTTPS_PROXY Proxy for Message Bridge requests
993
+
994
+ Provider API Keys:
995
+ BROWSERBASE_API_KEY Browserbase API key
996
+ BROWSERBASE_PROJECT_ID Browserbase project ID
997
+ KERNEL_API_KEY Kernel API key
998
+ KERNEL_PROFILE_NAME Kernel profile name
999
+ KERNEL_HEADLESS Kernel headless mode (true/false)
1000
+ KERNEL_STEALTH Kernel stealth mode (default: true)
1001
+ KERNEL_TIMEOUT_SECONDS Kernel timeout (default: 300)
1002
+ BROWSER_USE_API_KEY BrowserUse API key
1003
+
1004
+ Examples:
1005
+ agent-browser open example.com
1006
+ agent-browser snapshot -i
1007
+ agent-browser click @e2
1008
+ agent-browser fill @e3 "test@example.com"
1009
+ agent-browser find role button click --name Submit
1010
+ agent-browser screenshot --full
1011
+ agent-browser --cdp 9222 snapshot
1012
+ agent-browser --profile ~/.myapp open example.com
1013
+
1014
+ iOS Simulator (requires Xcode and Appium):
1015
+ agent-browser -p ios open example.com
1016
+ agent-browser -p ios --device "iPhone 15 Pro" open url
1017
+ agent-browser -p ios device list
1018
+ agent-browser -p ios swipe up
1019
+ `);
1020
+ }
1021
+ export function printVersion() {
1022
+ console.log('agent-browser 0.9.2');
1023
+ }
1024
+ //# sourceMappingURL=help.js.map