browxai 0.7.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.
Files changed (520) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +139 -0
  3. package/THIRD_PARTY_NOTICES.md +45 -0
  4. package/dist/cli/chrome.d.ts +1 -0
  5. package/dist/cli/chrome.js +130 -0
  6. package/dist/cli/command-registry.d.ts +15 -0
  7. package/dist/cli/command-registry.js +35 -0
  8. package/dist/cli/doctor-plugins.d.ts +18 -0
  9. package/dist/cli/doctor-plugins.js +338 -0
  10. package/dist/cli/doctor.d.ts +9 -0
  11. package/dist/cli/doctor.js +407 -0
  12. package/dist/cli/init.d.ts +1 -0
  13. package/dist/cli/init.js +200 -0
  14. package/dist/cli/register-commands.d.ts +1 -0
  15. package/dist/cli/register-commands.js +22 -0
  16. package/dist/cli/serve.d.ts +14 -0
  17. package/dist/cli/serve.js +151 -0
  18. package/dist/cli.d.ts +3 -0
  19. package/dist/cli.js +129 -0
  20. package/dist/engine/adapters/adb.d.ts +72 -0
  21. package/dist/engine/adapters/adb.js +200 -0
  22. package/dist/engine/adapters/android-cdp.d.ts +54 -0
  23. package/dist/engine/adapters/android-cdp.js +110 -0
  24. package/dist/engine/adapters/android.engine.d.ts +1 -0
  25. package/dist/engine/adapters/android.engine.js +31 -0
  26. package/dist/engine/adapters/chromium.engine.d.ts +1 -0
  27. package/dist/engine/adapters/chromium.engine.js +44 -0
  28. package/dist/engine/adapters/firefox.engine.d.ts +1 -0
  29. package/dist/engine/adapters/firefox.engine.js +43 -0
  30. package/dist/engine/adapters/playwright-chromium.d.ts +43 -0
  31. package/dist/engine/adapters/playwright-chromium.js +56 -0
  32. package/dist/engine/adapters/playwright-firefox.d.ts +52 -0
  33. package/dist/engine/adapters/playwright-firefox.js +97 -0
  34. package/dist/engine/adapters/playwright-webkit.d.ts +40 -0
  35. package/dist/engine/adapters/playwright-webkit.js +79 -0
  36. package/dist/engine/adapters/safari/bidi-client.d.ts +46 -0
  37. package/dist/engine/adapters/safari/bidi-client.js +130 -0
  38. package/dist/engine/adapters/safari/launch.d.ts +56 -0
  39. package/dist/engine/adapters/safari/launch.js +104 -0
  40. package/dist/engine/adapters/safari/webdriver-client.d.ts +102 -0
  41. package/dist/engine/adapters/safari/webdriver-client.js +175 -0
  42. package/dist/engine/adapters/safari.engine.d.ts +1 -0
  43. package/dist/engine/adapters/safari.engine.js +52 -0
  44. package/dist/engine/adapters/safaridriver-hybrid.d.ts +56 -0
  45. package/dist/engine/adapters/safaridriver-hybrid.js +127 -0
  46. package/dist/engine/adapters/webkit.engine.d.ts +1 -0
  47. package/dist/engine/adapters/webkit.engine.js +47 -0
  48. package/dist/engine/capabilities.d.ts +53 -0
  49. package/dist/engine/capabilities.js +122 -0
  50. package/dist/engine/capability-registry.d.ts +9 -0
  51. package/dist/engine/capability-registry.js +20 -0
  52. package/dist/engine/index.d.ts +18 -0
  53. package/dist/engine/index.js +14 -0
  54. package/dist/engine/register-engines.d.ts +5 -0
  55. package/dist/engine/register-engines.js +16 -0
  56. package/dist/engine/registry.d.ts +145 -0
  57. package/dist/engine/registry.js +67 -0
  58. package/dist/engine/select.d.ts +48 -0
  59. package/dist/engine/select.js +128 -0
  60. package/dist/engine/session-cdp.d.ts +13 -0
  61. package/dist/engine/session-cdp.js +22 -0
  62. package/dist/engine/tool-gate.d.ts +19 -0
  63. package/dist/engine/tool-gate.js +226 -0
  64. package/dist/engine/types.d.ts +71 -0
  65. package/dist/engine/types.js +16 -0
  66. package/dist/helper/bridge.d.ts +48 -0
  67. package/dist/helper/bridge.js +200 -0
  68. package/dist/helper/browx-page.d.ts +1 -0
  69. package/dist/helper/browx-page.js +47 -0
  70. package/dist/helper/overlay-hide.d.ts +9 -0
  71. package/dist/helper/overlay-hide.js +49 -0
  72. package/dist/helper/stealth.d.ts +10 -0
  73. package/dist/helper/stealth.js +88 -0
  74. package/dist/index.d.ts +7 -0
  75. package/dist/index.js +15 -0
  76. package/dist/page/a11y.d.ts +81 -0
  77. package/dist/page/a11y.js +219 -0
  78. package/dist/page/action-substrate.d.ts +64 -0
  79. package/dist/page/action-substrate.js +118 -0
  80. package/dist/page/actionresult-blocks.d.ts +99 -0
  81. package/dist/page/actionresult-blocks.js +144 -0
  82. package/dist/page/actionresult-shape.d.ts +48 -0
  83. package/dist/page/actionresult-shape.js +155 -0
  84. package/dist/page/actionresult-types.d.ts +368 -0
  85. package/dist/page/actionresult-types.js +4 -0
  86. package/dist/page/actionresult.d.ts +4 -0
  87. package/dist/page/actionresult.js +299 -0
  88. package/dist/page/actions-probe.d.ts +32 -0
  89. package/dist/page/actions-probe.js +294 -0
  90. package/dist/page/actions-scroll.d.ts +40 -0
  91. package/dist/page/actions-scroll.js +53 -0
  92. package/dist/page/actions.d.ts +132 -0
  93. package/dist/page/actions.js +453 -0
  94. package/dist/page/archive-assets.d.ts +39 -0
  95. package/dist/page/archive-assets.js +187 -0
  96. package/dist/page/archive.d.ts +47 -0
  97. package/dist/page/archive.js +349 -0
  98. package/dist/page/asset-export.d.ts +122 -0
  99. package/dist/page/asset-export.js +376 -0
  100. package/dist/page/await_network.d.ts +16 -0
  101. package/dist/page/await_network.js +23 -0
  102. package/dist/page/bbox.d.ts +37 -0
  103. package/dist/page/bbox.js +115 -0
  104. package/dist/page/canvas-capture.d.ts +82 -0
  105. package/dist/page/canvas-capture.js +257 -0
  106. package/dist/page/canvas-diff.d.ts +51 -0
  107. package/dist/page/canvas-diff.js +131 -0
  108. package/dist/page/canvas-gesture.d.ts +53 -0
  109. package/dist/page/canvas-gesture.js +167 -0
  110. package/dist/page/canvas-transform.d.ts +96 -0
  111. package/dist/page/canvas-transform.js +150 -0
  112. package/dist/page/canvas.d.ts +8 -0
  113. package/dist/page/canvas.js +50 -0
  114. package/dist/page/capture-substrate.d.ts +111 -0
  115. package/dist/page/capture-substrate.js +139 -0
  116. package/dist/page/clipboard.d.ts +25 -0
  117. package/dist/page/clipboard.js +50 -0
  118. package/dist/page/clock.d.ts +36 -0
  119. package/dist/page/clock.js +167 -0
  120. package/dist/page/compose.d.ts +55 -0
  121. package/dist/page/compose.js +169 -0
  122. package/dist/page/console.d.ts +39 -0
  123. package/dist/page/console.js +73 -0
  124. package/dist/page/coverage.d.ts +97 -0
  125. package/dist/page/coverage.js +280 -0
  126. package/dist/page/dom-export.d.ts +41 -0
  127. package/dist/page/dom-export.js +193 -0
  128. package/dist/page/dom-walk.d.ts +91 -0
  129. package/dist/page/dom-walk.js +267 -0
  130. package/dist/page/dom_diff.d.ts +48 -0
  131. package/dist/page/dom_diff.js +121 -0
  132. package/dist/page/downloads.d.ts +80 -0
  133. package/dist/page/downloads.js +244 -0
  134. package/dist/page/drop-files.d.ts +78 -0
  135. package/dist/page/drop-files.js +310 -0
  136. package/dist/page/element-export-discovery.d.ts +64 -0
  137. package/dist/page/element-export-discovery.js +346 -0
  138. package/dist/page/element-export.d.ts +46 -0
  139. package/dist/page/element-export.js +251 -0
  140. package/dist/page/emulation-substrate.d.ts +53 -0
  141. package/dist/page/emulation-substrate.js +87 -0
  142. package/dist/page/emulation.d.ts +60 -0
  143. package/dist/page/emulation.js +162 -0
  144. package/dist/page/export-playwright-script.d.ts +47 -0
  145. package/dist/page/export-playwright-script.js +304 -0
  146. package/dist/page/extract-resolve.d.ts +22 -0
  147. package/dist/page/extract-resolve.js +341 -0
  148. package/dist/page/extract-schema.d.ts +20 -0
  149. package/dist/page/extract-schema.js +200 -0
  150. package/dist/page/extract-types.d.ts +127 -0
  151. package/dist/page/extract-types.js +8 -0
  152. package/dist/page/extract-warnings.d.ts +8 -0
  153. package/dist/page/extract-warnings.js +56 -0
  154. package/dist/page/extract.d.ts +9 -0
  155. package/dist/page/extract.js +174 -0
  156. package/dist/page/fill-form.d.ts +58 -0
  157. package/dist/page/fill-form.js +261 -0
  158. package/dist/page/find.d.ts +158 -0
  159. package/dist/page/find.js +470 -0
  160. package/dist/page/frames.d.ts +45 -0
  161. package/dist/page/frames.js +133 -0
  162. package/dist/page/generate-locator.d.ts +57 -0
  163. package/dist/page/generate-locator.js +136 -0
  164. package/dist/page/gestures.d.ts +128 -0
  165. package/dist/page/gestures.js +198 -0
  166. package/dist/page/har.d.ts +91 -0
  167. package/dist/page/har.js +174 -0
  168. package/dist/page/heap.d.ts +97 -0
  169. package/dist/page/heap.js +285 -0
  170. package/dist/page/inspect.d.ts +34 -0
  171. package/dist/page/inspect.js +75 -0
  172. package/dist/page/layout-thrash.d.ts +34 -0
  173. package/dist/page/layout-thrash.js +232 -0
  174. package/dist/page/learning.d.ts +21 -0
  175. package/dist/page/learning.js +84 -0
  176. package/dist/page/locator.d.ts +54 -0
  177. package/dist/page/locator.js +142 -0
  178. package/dist/page/memory-diff.d.ts +48 -0
  179. package/dist/page/memory-diff.js +105 -0
  180. package/dist/page/network-mask.d.ts +8 -0
  181. package/dist/page/network-mask.js +18 -0
  182. package/dist/page/network-playwright.d.ts +96 -0
  183. package/dist/page/network-playwright.js +353 -0
  184. package/dist/page/network-substrate-select.d.ts +18 -0
  185. package/dist/page/network-substrate-select.js +32 -0
  186. package/dist/page/network-substrate.d.ts +109 -0
  187. package/dist/page/network-substrate.js +161 -0
  188. package/dist/page/network-ws.d.ts +46 -0
  189. package/dist/page/network-ws.js +113 -0
  190. package/dist/page/network.d.ts +194 -0
  191. package/dist/page/network.js +415 -0
  192. package/dist/page/overflow-detect.d.ts +102 -0
  193. package/dist/page/overflow-detect.js +449 -0
  194. package/dist/page/pdf.d.ts +69 -0
  195. package/dist/page/pdf.js +109 -0
  196. package/dist/page/perf-audit-analysers.d.ts +40 -0
  197. package/dist/page/perf-audit-analysers.js +369 -0
  198. package/dist/page/perf-audit-runner.d.ts +20 -0
  199. package/dist/page/perf-audit-runner.js +195 -0
  200. package/dist/page/perf-audit-types.d.ts +41 -0
  201. package/dist/page/perf-audit-types.js +5 -0
  202. package/dist/page/perf-audit.d.ts +37 -0
  203. package/dist/page/perf-audit.js +377 -0
  204. package/dist/page/perf.d.ts +127 -0
  205. package/dist/page/perf.js +373 -0
  206. package/dist/page/plan.d.ts +192 -0
  207. package/dist/page/plan.js +308 -0
  208. package/dist/page/point_probe.d.ts +46 -0
  209. package/dist/page/point_probe.js +99 -0
  210. package/dist/page/recording.d.ts +67 -0
  211. package/dist/page/recording.js +172 -0
  212. package/dist/page/refs.d.ts +92 -0
  213. package/dist/page/refs.js +134 -0
  214. package/dist/page/regions.d.ts +23 -0
  215. package/dist/page/regions.js +32 -0
  216. package/dist/page/routes.d.ts +40 -0
  217. package/dist/page/routes.js +87 -0
  218. package/dist/page/safari-actions.d.ts +12 -0
  219. package/dist/page/safari-actions.js +144 -0
  220. package/dist/page/sample.d.ts +64 -0
  221. package/dist/page/sample.js +216 -0
  222. package/dist/page/screenshot-on.d.ts +51 -0
  223. package/dist/page/screenshot-on.js +150 -0
  224. package/dist/page/screenshot-save.d.ts +36 -0
  225. package/dist/page/screenshot-save.js +53 -0
  226. package/dist/page/screenshot-schedule.d.ts +50 -0
  227. package/dist/page/screenshot-schedule.js +155 -0
  228. package/dist/page/script-substrate.d.ts +32 -0
  229. package/dist/page/script-substrate.js +47 -0
  230. package/dist/page/seed-random.d.ts +45 -0
  231. package/dist/page/seed-random.js +144 -0
  232. package/dist/page/set-of-marks.d.ts +96 -0
  233. package/dist/page/set-of-marks.js +245 -0
  234. package/dist/page/shadow.d.ts +136 -0
  235. package/dist/page/shadow.js +400 -0
  236. package/dist/page/shortcut.d.ts +50 -0
  237. package/dist/page/shortcut.js +147 -0
  238. package/dist/page/snapshot-substrate-safari.d.ts +30 -0
  239. package/dist/page/snapshot-substrate-safari.js +84 -0
  240. package/dist/page/snapshot-substrate-select.d.ts +24 -0
  241. package/dist/page/snapshot-substrate-select.js +34 -0
  242. package/dist/page/snapshot-substrate.d.ts +58 -0
  243. package/dist/page/snapshot-substrate.js +135 -0
  244. package/dist/page/snapshot.d.ts +24 -0
  245. package/dist/page/snapshot.js +162 -0
  246. package/dist/page/solve-captcha.d.ts +76 -0
  247. package/dist/page/solve-captcha.js +286 -0
  248. package/dist/page/storage-substrate-types.d.ts +221 -0
  249. package/dist/page/storage-substrate-types.js +6 -0
  250. package/dist/page/storage-substrate.d.ts +215 -0
  251. package/dist/page/storage-substrate.js +280 -0
  252. package/dist/page/structural.d.ts +9 -0
  253. package/dist/page/structural.js +152 -0
  254. package/dist/page/substrate-bundle-safari.d.ts +8 -0
  255. package/dist/page/substrate-bundle-safari.js +42 -0
  256. package/dist/page/substrate-bundle.d.ts +6 -0
  257. package/dist/page/substrate-bundle.js +53 -0
  258. package/dist/page/text_search.d.ts +44 -0
  259. package/dist/page/text_search.js +90 -0
  260. package/dist/page/upload.d.ts +28 -0
  261. package/dist/page/upload.js +62 -0
  262. package/dist/page/verify.d.ts +63 -0
  263. package/dist/page/verify.js +451 -0
  264. package/dist/page/video.d.ts +115 -0
  265. package/dist/page/video.js +169 -0
  266. package/dist/page/visibility.d.ts +22 -0
  267. package/dist/page/visibility.js +94 -0
  268. package/dist/page/watch.d.ts +29 -0
  269. package/dist/page/watch.js +99 -0
  270. package/dist/page/workers.d.ts +126 -0
  271. package/dist/page/workers.js +490 -0
  272. package/dist/page/ws-interactive.d.ts +82 -0
  273. package/dist/page/ws-interactive.js +318 -0
  274. package/dist/plugin/cli.d.ts +45 -0
  275. package/dist/plugin/cli.js +496 -0
  276. package/dist/plugin/command-registry.d.ts +9 -0
  277. package/dist/plugin/command-registry.js +23 -0
  278. package/dist/plugin/depgraph.d.ts +37 -0
  279. package/dist/plugin/depgraph.js +186 -0
  280. package/dist/plugin/manifest.d.ts +182 -0
  281. package/dist/plugin/manifest.js +219 -0
  282. package/dist/plugin/package-manager.d.ts +22 -0
  283. package/dist/plugin/package-manager.js +40 -0
  284. package/dist/plugin/resolver.d.ts +85 -0
  285. package/dist/plugin/resolver.js +166 -0
  286. package/dist/plugin/runtime.d.ts +77 -0
  287. package/dist/plugin/runtime.js +402 -0
  288. package/dist/plugin/types.d.ts +113 -0
  289. package/dist/plugin/types.js +4 -0
  290. package/dist/policy/confirm.d.ts +76 -0
  291. package/dist/policy/confirm.js +162 -0
  292. package/dist/policy/origin.d.ts +17 -0
  293. package/dist/policy/origin.js +79 -0
  294. package/dist/sdk/client.d.ts +21 -0
  295. package/dist/sdk/client.js +174 -0
  296. package/dist/sdk/index.d.ts +32 -0
  297. package/dist/sdk/index.js +61 -0
  298. package/dist/sdk/plugin-types.d.ts +33 -0
  299. package/dist/sdk/plugin-types.js +22 -0
  300. package/dist/sdk/registry.d.ts +17 -0
  301. package/dist/sdk/registry.js +94 -0
  302. package/dist/sdk/socket-transport.d.ts +20 -0
  303. package/dist/sdk/socket-transport.js +90 -0
  304. package/dist/sdk/tool-types.d.ts +634 -0
  305. package/dist/sdk/tool-types.js +28 -0
  306. package/dist/sdk/transport-in-process.d.ts +21 -0
  307. package/dist/sdk/transport-in-process.js +44 -0
  308. package/dist/sdk/transport-registry.d.ts +19 -0
  309. package/dist/sdk/transport-registry.js +31 -0
  310. package/dist/sdk/transport-socket.d.ts +12 -0
  311. package/dist/sdk/transport-socket.js +77 -0
  312. package/dist/sdk/transport-stdio-child.d.ts +10 -0
  313. package/dist/sdk/transport-stdio-child.js +47 -0
  314. package/dist/sdk/transport.d.ts +10 -0
  315. package/dist/sdk/transport.js +35 -0
  316. package/dist/sdk/types.d.ts +176 -0
  317. package/dist/sdk/types.js +10 -0
  318. package/dist/server.d.ts +33 -0
  319. package/dist/server.js +327 -0
  320. package/dist/session/artifacts.d.ts +52 -0
  321. package/dist/session/artifacts.js +177 -0
  322. package/dist/session/byob-attach.d.ts +26 -0
  323. package/dist/session/byob-attach.js +187 -0
  324. package/dist/session/byob.d.ts +8 -0
  325. package/dist/session/byob.js +20 -0
  326. package/dist/session/cache-storage.d.ts +100 -0
  327. package/dist/session/cache-storage.js +166 -0
  328. package/dist/session/device-emu.d.ts +149 -0
  329. package/dist/session/device-emu.js +545 -0
  330. package/dist/session/device.d.ts +14 -0
  331. package/dist/session/device.js +44 -0
  332. package/dist/session/dialog.d.ts +62 -0
  333. package/dist/session/dialog.js +164 -0
  334. package/dist/session/emulation.d.ts +69 -0
  335. package/dist/session/emulation.js +168 -0
  336. package/dist/session/extensions.d.ts +113 -0
  337. package/dist/session/extensions.js +237 -0
  338. package/dist/session/fs-picker.d.ts +144 -0
  339. package/dist/session/fs-picker.js +666 -0
  340. package/dist/session/idb-storage.d.ts +86 -0
  341. package/dist/session/idb-storage.js +229 -0
  342. package/dist/session/incognito.d.ts +3 -0
  343. package/dist/session/incognito.js +20 -0
  344. package/dist/session/launch-options.d.ts +41 -0
  345. package/dist/session/launch-options.js +200 -0
  346. package/dist/session/managed.d.ts +3 -0
  347. package/dist/session/managed.js +16 -0
  348. package/dist/session/metrics.d.ts +45 -0
  349. package/dist/session/metrics.js +75 -0
  350. package/dist/session/notification.d.ts +122 -0
  351. package/dist/session/notification.js +426 -0
  352. package/dist/session/permission.d.ts +144 -0
  353. package/dist/session/permission.js +600 -0
  354. package/dist/session/playwright-post-wire.d.ts +8 -0
  355. package/dist/session/playwright-post-wire.js +148 -0
  356. package/dist/session/policy-buffer.d.ts +21 -0
  357. package/dist/session/policy-buffer.js +47 -0
  358. package/dist/session/profile-snapshot.d.ts +11 -0
  359. package/dist/session/profile-snapshot.js +53 -0
  360. package/dist/session/registry.d.ts +365 -0
  361. package/dist/session/registry.js +98 -0
  362. package/dist/session/safari-post-wire.d.ts +8 -0
  363. package/dist/session/safari-post-wire.js +28 -0
  364. package/dist/session/safari-session.d.ts +10 -0
  365. package/dist/session/safari-session.js +39 -0
  366. package/dist/session/storage.d.ts +148 -0
  367. package/dist/session/storage.js +350 -0
  368. package/dist/session/types.d.ts +113 -0
  369. package/dist/session/types.js +5 -0
  370. package/dist/session/wedge.d.ts +15 -0
  371. package/dist/session/wedge.js +41 -0
  372. package/dist/tools/action-core-tools.d.ts +13 -0
  373. package/dist/tools/action-core-tools.js +156 -0
  374. package/dist/tools/action-form-tools.d.ts +12 -0
  375. package/dist/tools/action-form-tools.js +179 -0
  376. package/dist/tools/action-gesture-tools.d.ts +9 -0
  377. package/dist/tools/action-gesture-tools.js +115 -0
  378. package/dist/tools/action-history-tools.d.ts +8 -0
  379. package/dist/tools/action-history-tools.js +67 -0
  380. package/dist/tools/action-tool.d.ts +42 -0
  381. package/dist/tools/action-tool.js +58 -0
  382. package/dist/tools/action-tools.d.ts +20 -0
  383. package/dist/tools/action-tools.js +28 -0
  384. package/dist/tools/batch-act-tools.d.ts +10 -0
  385. package/dist/tools/batch-act-tools.js +276 -0
  386. package/dist/tools/batch-human-tools.d.ts +8 -0
  387. package/dist/tools/batch-human-tools.js +148 -0
  388. package/dist/tools/canvas-tools.d.ts +40 -0
  389. package/dist/tools/canvas-tools.js +368 -0
  390. package/dist/tools/capture-report-diagnostics-tools.d.ts +7 -0
  391. package/dist/tools/capture-report-diagnostics-tools.js +318 -0
  392. package/dist/tools/capture-report-element-export-tools.d.ts +8 -0
  393. package/dist/tools/capture-report-element-export-tools.js +197 -0
  394. package/dist/tools/capture-report-export-tools.d.ts +8 -0
  395. package/dist/tools/capture-report-export-tools.js +246 -0
  396. package/dist/tools/capture-report-marks-tools.d.ts +9 -0
  397. package/dist/tools/capture-report-marks-tools.js +221 -0
  398. package/dist/tools/capture-report-upload-tools.d.ts +8 -0
  399. package/dist/tools/capture-report-upload-tools.js +277 -0
  400. package/dist/tools/config-approval-tools.d.ts +8 -0
  401. package/dist/tools/config-approval-tools.js +166 -0
  402. package/dist/tools/deep-coverage-tools.d.ts +8 -0
  403. package/dist/tools/deep-coverage-tools.js +325 -0
  404. package/dist/tools/deep-determinism-tools.d.ts +8 -0
  405. package/dist/tools/deep-determinism-tools.js +276 -0
  406. package/dist/tools/deep-perf-tools.d.ts +19 -0
  407. package/dist/tools/deep-perf-tools.js +324 -0
  408. package/dist/tools/device-emulation-tools.d.ts +9 -0
  409. package/dist/tools/device-emulation-tools.js +137 -0
  410. package/dist/tools/extensions-batch-tools.d.ts +18 -0
  411. package/dist/tools/extensions-batch-tools.js +24 -0
  412. package/dist/tools/extensions-rebuild.d.ts +22 -0
  413. package/dist/tools/extensions-rebuild.js +208 -0
  414. package/dist/tools/extensions-tools.d.ts +2 -0
  415. package/dist/tools/extensions-tools.js +331 -0
  416. package/dist/tools/forms-fill-tools.d.ts +8 -0
  417. package/dist/tools/forms-fill-tools.js +109 -0
  418. package/dist/tools/forms-plan-tools.d.ts +7 -0
  419. package/dist/tools/forms-plan-tools.js +159 -0
  420. package/dist/tools/forms-recording-mode-tools.d.ts +8 -0
  421. package/dist/tools/forms-recording-mode-tools.js +71 -0
  422. package/dist/tools/forms-recording-tools.d.ts +14 -0
  423. package/dist/tools/forms-recording-tools.js +22 -0
  424. package/dist/tools/forms-refs-tools.d.ts +8 -0
  425. package/dist/tools/forms-refs-tools.js +90 -0
  426. package/dist/tools/gesture-coord-tools.d.ts +8 -0
  427. package/dist/tools/gesture-coord-tools.js +168 -0
  428. package/dist/tools/gesture-emulation-tools.d.ts +8 -0
  429. package/dist/tools/gesture-emulation-tools.js +135 -0
  430. package/dist/tools/gesture-network-tools.d.ts +17 -0
  431. package/dist/tools/gesture-network-tools.js +27 -0
  432. package/dist/tools/gesture-route-tools.d.ts +8 -0
  433. package/dist/tools/gesture-route-tools.js +142 -0
  434. package/dist/tools/gesture-websocket-tools.d.ts +8 -0
  435. package/dist/tools/gesture-websocket-tools.js +122 -0
  436. package/dist/tools/gesture-worker-tools.d.ts +9 -0
  437. package/dist/tools/gesture-worker-tools.js +200 -0
  438. package/dist/tools/host-build.d.ts +76 -0
  439. package/dist/tools/host-build.js +516 -0
  440. package/dist/tools/host.d.ts +287 -0
  441. package/dist/tools/host.js +1 -0
  442. package/dist/tools/input-tools.d.ts +10 -0
  443. package/dist/tools/input-tools.js +176 -0
  444. package/dist/tools/live-emulation-tools.d.ts +9 -0
  445. package/dist/tools/live-emulation-tools.js +353 -0
  446. package/dist/tools/plugin-runtime.d.ts +36 -0
  447. package/dist/tools/plugin-runtime.js +274 -0
  448. package/dist/tools/read-observe-buffer-tools.d.ts +9 -0
  449. package/dist/tools/read-observe-buffer-tools.js +385 -0
  450. package/dist/tools/read-observe-capture-tools.d.ts +12 -0
  451. package/dist/tools/read-observe-capture-tools.js +376 -0
  452. package/dist/tools/read-observe-dom-tools.d.ts +8 -0
  453. package/dist/tools/read-observe-dom-tools.js +308 -0
  454. package/dist/tools/read-observe-extract-tools.d.ts +8 -0
  455. package/dist/tools/read-observe-extract-tools.js +232 -0
  456. package/dist/tools/read-observe-verify-tools.d.ts +8 -0
  457. package/dist/tools/read-observe-verify-tools.js +316 -0
  458. package/dist/tools/schemas.d.ts +29 -0
  459. package/dist/tools/schemas.js +58 -0
  460. package/dist/tools/secrets-captcha-tools.d.ts +9 -0
  461. package/dist/tools/secrets-captcha-tools.js +231 -0
  462. package/dist/tools/session-dialog-permission-tools.d.ts +9 -0
  463. package/dist/tools/session-dialog-permission-tools.js +287 -0
  464. package/dist/tools/session-lifecycle-tools.d.ts +8 -0
  465. package/dist/tools/session-lifecycle-tools.js +314 -0
  466. package/dist/tools/session-notification-device-tools.d.ts +9 -0
  467. package/dist/tools/session-notification-device-tools.js +156 -0
  468. package/dist/tools/session-policy-tools.d.ts +16 -0
  469. package/dist/tools/session-policy-tools.js +22 -0
  470. package/dist/tools/session-registry.d.ts +28 -0
  471. package/dist/tools/session-registry.js +427 -0
  472. package/dist/tools/storage-artifact-har-video-tools.d.ts +8 -0
  473. package/dist/tools/storage-artifact-har-video-tools.js +311 -0
  474. package/dist/tools/storage-cache-idb-tools.d.ts +8 -0
  475. package/dist/tools/storage-cache-idb-tools.js +347 -0
  476. package/dist/tools/storage-state-cookies-tools.d.ts +8 -0
  477. package/dist/tools/storage-state-cookies-tools.js +223 -0
  478. package/dist/tools/storage-tools.d.ts +17 -0
  479. package/dist/tools/storage-tools.js +25 -0
  480. package/dist/tools/storage-web-auth-tools.d.ts +10 -0
  481. package/dist/tools/storage-web-auth-tools.js +230 -0
  482. package/dist/tools/tool-metadata.d.ts +8 -0
  483. package/dist/tools/tool-metadata.js +185 -0
  484. package/dist/util/batch.d.ts +83 -0
  485. package/dist/util/batch.js +191 -0
  486. package/dist/util/capabilities.d.ts +504 -0
  487. package/dist/util/capabilities.js +254 -0
  488. package/dist/util/config-store.d.ts +103 -0
  489. package/dist/util/config-store.js +206 -0
  490. package/dist/util/config.d.ts +11 -0
  491. package/dist/util/config.js +28 -0
  492. package/dist/util/credentials.d.ts +136 -0
  493. package/dist/util/credentials.js +622 -0
  494. package/dist/util/deadline.d.ts +22 -0
  495. package/dist/util/deadline.js +62 -0
  496. package/dist/util/diagnostics.d.ts +161 -0
  497. package/dist/util/diagnostics.js +579 -0
  498. package/dist/util/egress-sanitiser.d.ts +29 -0
  499. package/dist/util/egress-sanitiser.js +52 -0
  500. package/dist/util/failure.d.ts +8 -0
  501. package/dist/util/failure.js +50 -0
  502. package/dist/util/flake-check.d.ts +109 -0
  503. package/dist/util/flake-check.js +342 -0
  504. package/dist/util/invariant.d.ts +25 -0
  505. package/dist/util/invariant.js +66 -0
  506. package/dist/util/logging.d.ts +6 -0
  507. package/dist/util/logging.js +12 -0
  508. package/dist/util/predicates.d.ts +62 -0
  509. package/dist/util/predicates.js +340 -0
  510. package/dist/util/secrets.d.ts +104 -0
  511. package/dist/util/secrets.js +219 -0
  512. package/dist/util/tokens.d.ts +6 -0
  513. package/dist/util/tokens.js +24 -0
  514. package/dist/util/url-sanitizer.d.ts +19 -0
  515. package/dist/util/url-sanitizer.js +70 -0
  516. package/dist/util/version.d.ts +2 -0
  517. package/dist/util/version.js +21 -0
  518. package/dist/util/workspace.d.ts +7 -0
  519. package/dist/util/workspace.js +22 -0
  520. package/package.json +120 -0
@@ -0,0 +1,110 @@
1
+ // AndroidCdpAdapter — the FOURTH BrowserEngine adapter. The
2
+ // surviving full-fidelity real-profile BYOB lane: real Chrome-on-Android attached
3
+ // over adb + CDP. The KEY property is that Android Chrome speaks FULL CDP, so this
4
+ // adapter:
5
+ // - declares `deep: true` (ANDROID_CAPABILITIES) — every tool works, including
6
+ // the CDP-deep ones (perf / coverage / heap / cpu / clock / CDP input);
7
+ // - mints an eager CDP session on attach, just like the Chromium adapter;
8
+ // - reuses the EXISTING CdpSnapshotSubstrate / CdpNetworkSubstrate verbatim
9
+ // (the substrate selectors key on CDP presence, so Android falls into the
10
+ // chromium-substrate path automatically — NO new substrate code).
11
+ //
12
+ // This is the smallest, lowest-risk adapter precisely because it adds no new
13
+ // substrate. The only genuinely new code is the adb plumbing (./adb.ts) — device
14
+ // discovery, socket forward, /json/version → wsUrl, port management, cleanup.
15
+ //
16
+ // ATTACH is the real path: discover the Chrome DevTools socket on a connected
17
+ // device (`adb forward tcp:<port> localabstract:chrome_devtools_remote`), GET
18
+ // http://127.0.0.1:<port>/json/version → webSocketDebuggerUrl, then
19
+ // `chromium.connectOverCDP(wsUrl)`. This attaches to the user's REAL Chrome-on-
20
+ // Android — the BYOB win. The forwarded socket is loopback (adb forwards to
21
+ // 127.0.0.1), so byob.ts's loopback / not-owned policy applies verbatim.
22
+ //
23
+ // connectOverCDP vs `playwright._android`: we PREFER connectOverCDP. Both reach
24
+ // the same CDP. `_android` is a separate experimental device API
25
+ // (`playwright._android.devices()` → `AndroidDevice`) that owns its own adb
26
+ // orchestration and returns a device-shaped object, NOT a `Browser`/`CDPSession`
27
+ // pair the rest of browxai is built on. connectOverCDP returns the exact
28
+ // `Browser` + `newCDPSession` handles the Chromium adapter already wires
29
+ // (attachOverCdp in playwright-chromium.ts), so the substrate selectors, the
30
+ // network tap, the a11y substrate, and teardown all work UNCHANGED. We keep the
31
+ // adb orchestration explicit (./adb.ts) rather than hand it to `_android`, which
32
+ // reuses the most existing code and keeps the seam at the same boundary as the
33
+ // desktop BYOB path. (Measured against the installed Playwright 1.60:
34
+ // `chromium.connectOverCDP` is a function; `_android` is an experimental device
35
+ // API, not a `connectOverCDP` substitute.)
36
+ //
37
+ // LAUNCH is not a thing on Android the same way: managed/ephemeral launch means
38
+ // "spawn a browser process we own", which on a phone the user controls makes no
39
+ // sense — the user opens Chrome on their device. So launch returns a structured
40
+ // `android-launch-not-supported`; Android is attach-only.
41
+ import { resolveBrowserType } from "../select.js";
42
+ import { capabilitiesFor } from "../capabilities.js";
43
+ import { defaultAdbRunner, defaultFetcher, pickFreePort, devicesArgs, forwardArgs, forwardRemoveArgs, parseDevices, selectDevice, versionUrl, extractWsUrl, } from "./adb.js";
44
+ export class AndroidCdpAdapter {
45
+ engine = "android";
46
+ capabilities;
47
+ runAdb;
48
+ fetchJson;
49
+ pickPort;
50
+ constructor(deps = {}) {
51
+ // android always has a declaration (see capabilities.ts).
52
+ this.capabilities = capabilitiesFor("android");
53
+ this.runAdb = deps.runAdb ?? defaultAdbRunner;
54
+ this.fetchJson = deps.fetchJson ?? defaultFetcher;
55
+ this.pickPort = deps.pickPort ?? pickFreePort;
56
+ }
57
+ /** Discover a ready device. Lists devices via adb, parses, and selects (the
58
+ * requested serial if given, else the single ready one — structured errors
59
+ * otherwise). Surfaces `adb-missing` / `no-device` without a device crash. */
60
+ async discoverDevice(serial) {
61
+ const stdout = await this.runAdb(devicesArgs());
62
+ const device = selectDevice(parseDevices(stdout), serial);
63
+ return device.serial;
64
+ }
65
+ /** The real BYOB path: discover device → forward the Chrome DevTools socket to
66
+ * a free loopback port → GET /json/version → webSocketDebuggerUrl →
67
+ * `chromium.connectOverCDP(wsUrl)`. Returns the `Browser` + eager `CDPSession`
68
+ * the session layer wires its bookkeeping onto, exactly like the Chromium
69
+ * attach, plus the forward-teardown handle. On any failure after the forward
70
+ * is established, the forward is removed before the error propagates (no leaked
71
+ * adb forwards). */
72
+ async attach(opts = {}) {
73
+ const serial = await this.discoverDevice(opts.serial);
74
+ const localPort = await this.pickPort();
75
+ await this.runAdb(forwardArgs(localPort, serial));
76
+ const removeForward = async () => {
77
+ await this.runAdb(forwardRemoveArgs(localPort, serial)).catch(() => undefined);
78
+ };
79
+ try {
80
+ const versionBody = await this.fetchJson(versionUrl(localPort));
81
+ const wsUrl = extractWsUrl(versionBody);
82
+ // `android` resolves to the chromium BrowserType — connectOverCDP returns
83
+ // the exact Browser the desktop BYOB path uses (attachOverCdp), so the
84
+ // eager CDP session, the substrates, and teardown all work unchanged.
85
+ const browserType = resolveBrowserType(this.engine);
86
+ const browser = await browserType.connectOverCDP(wsUrl);
87
+ const context = browser.contexts()[0] ?? (await browser.newContext());
88
+ const page = context.pages()[0] ?? (await context.newPage());
89
+ const cdp = await context.newCDPSession(page);
90
+ return { browser, page, cdp, localPort, serial, removeForward };
91
+ }
92
+ catch (err) {
93
+ await removeForward();
94
+ throw err;
95
+ }
96
+ }
97
+ /** Managed / ephemeral LAUNCH is not supported on Android. A phone's Chrome is
98
+ * the user's to open; browxai cannot spawn a browser process it owns on the
99
+ * device. Per the doctrine's no-silent-no-op rule this rejects with a
100
+ * structured, RFC-naming error rather than pretending. Promise-returning (not
101
+ * `async`) so the eslint require-await rule is honest — there is no awaited
102
+ * work, it is a structured refusal. */
103
+ launch() {
104
+ return Promise.reject(new Error("android-launch-not-supported: the android engine is ATTACH-ONLY. managed / ephemeral " +
105
+ "launch means spawning a browser process browxai owns, which is not a thing on a phone " +
106
+ "the user controls — the user opens Chrome on their device, and browxai attaches over " +
107
+ 'adb + CDP. Open the session with mode:"attached" (BROWX_ATTACH_CDP ' +
108
+ "is loopback-enforced; the adb forward is loopback by construction)."));
109
+ }
110
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ // Android engine registration (RFC 0004 D1). Android is real Chrome-on-Android
2
+ // attached over adb + CDP — it IS Chromium, so it reuses the shared Playwright
3
+ // substrate bundle (CDP present → the verbatim CDP snapshot/network substrates)
4
+ // and the full Playwright post-wire. It is ATTACH-ONLY: managed / incognito launch
5
+ // (spawning a browser we own) is not a thing on the user's phone, so those modes
6
+ // surface the adapter's structured `android-launch-not-supported`. BYOB attaches
7
+ // over adb via `openAndroidByobSession` (endpoint discovered, not URL-configured).
8
+ import { registerEngine } from "../registry.js";
9
+ import { capabilitiesFor } from "../capabilities.js";
10
+ import { AndroidCdpAdapter } from "./android-cdp.js";
11
+ import { playwrightSubstrateBundle } from "../../page/substrate-bundle.js";
12
+ import { playwrightPostWire } from "../../session/playwright-post-wire.js";
13
+ import { openAndroidByobSession } from "../../session/byob-attach.js";
14
+ async function makeAndroidAdapter(opts) {
15
+ const mode = opts.launchMode ?? "managed";
16
+ if (mode === "byob") {
17
+ return openAndroidByobSession();
18
+ }
19
+ // managed / incognito — spawning a browser we own is not a thing on a phone;
20
+ // the adapter's launch path returns the structured `android-launch-not-supported`
21
+ // refusal (it throws, never returns).
22
+ await new AndroidCdpAdapter().launch();
23
+ throw new Error("unreachable: android launch always refuses");
24
+ }
25
+ registerEngine({
26
+ kind: "android",
27
+ capabilities: capabilitiesFor("android"),
28
+ makeAdapter: makeAndroidAdapter,
29
+ makeSubstrates: (deps) => playwrightSubstrateBundle(deps),
30
+ postWire: (entry, deps) => playwrightPostWire(entry, deps),
31
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,44 @@
1
+ // Chromium engine registration (RFC 0004 D1). Registers the one `EngineEntry`
2
+ // for the chromium engine — the byte-identity-critical path. No adapter LOGIC
3
+ // moves here: the Playwright launch calls stay in `PlaywrightChromiumAdapter`,
4
+ // the substrate selection delegates to the existing CDP/Playwright selectors, and
5
+ // the post-wire is the full Playwright bookkeeping set (the always-true branch the
6
+ // three factories ran for every non-Safari engine). This is pure wiring
7
+ // relocation behind the registry — the chromium CDP path is verbatim.
8
+ import { registerEngine } from "../registry.js";
9
+ import { capabilitiesFor } from "../capabilities.js";
10
+ import { playwrightSubstrateBundle } from "../../page/substrate-bundle.js";
11
+ import { playwrightPostWire } from "../../session/playwright-post-wire.js";
12
+ import { buildManagedLaunch, buildIncognitoContextOptions, buildIncognitoLaunchOptions, finalizeManagedSession, finalizeIncognitoSession, } from "../../session/launch-options.js";
13
+ import { PlaywrightChromiumAdapter } from "./playwright-chromium.js";
14
+ import { attachByobChromium } from "../../session/byob-attach.js";
15
+ /** Build a chromium `BrowserSession` for the requested launch mode. The
16
+ * per-engine launch dispatch the three factories carried (`engine === "…"`)
17
+ * collapses to this one method; the mode is threaded via `opts.launchMode`
18
+ * (defaulting to managed). Every option-built value + adapter call is the verbatim
19
+ * pre-seam chromium path, so the chromium keystone stays byte-identical. */
20
+ async function makeChromiumAdapter(opts) {
21
+ const mode = opts.launchMode ?? "managed";
22
+ if (mode === "byob") {
23
+ return attachByobChromium(opts);
24
+ }
25
+ if (mode === "incognito") {
26
+ const adapter = new PlaywrightChromiumAdapter();
27
+ const { browser, context, page, cdp } = await adapter.launchEphemeral({
28
+ launchOptions: buildIncognitoLaunchOptions("chromium", opts),
29
+ contextOptions: buildIncognitoContextOptions(opts),
30
+ });
31
+ return finalizeIncognitoSession("chromium", { browser, context, page, cdp });
32
+ }
33
+ const { profileDir, options } = buildManagedLaunch("chromium", opts);
34
+ const adapter = new PlaywrightChromiumAdapter();
35
+ const { context, page, cdp } = await adapter.launchPersistent({ profileDir, options });
36
+ return finalizeManagedSession("chromium", opts, profileDir, { context, page, cdp });
37
+ }
38
+ registerEngine({
39
+ kind: "chromium",
40
+ capabilities: capabilitiesFor("chromium"),
41
+ makeAdapter: makeChromiumAdapter,
42
+ makeSubstrates: (deps) => playwrightSubstrateBundle(deps),
43
+ postWire: (entry, deps) => playwrightPostWire(entry, deps),
44
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ // Firefox engine registration (RFC 0004 D1). Registers the one `EngineEntry` for
2
+ // the firefox engine. No adapter logic moves: the Juggler launch stays in
3
+ // `PlaywrightFirefoxAdapter`; the substrate bundle is the shared Playwright one
4
+ // (firefox has a Page, no CDP → the page-side snapshot walker + Playwright network
5
+ // substrate are selected by CDP-absence); the post-wire is the full Playwright set.
6
+ // BYOB attach surfaces the adapter's structured `firefox-attach-not-supported`.
7
+ import { registerEngine } from "../registry.js";
8
+ import { capabilitiesFor } from "../capabilities.js";
9
+ import { PlaywrightFirefoxAdapter, firefoxChannelFromEnv } from "./playwright-firefox.js";
10
+ import { playwrightSubstrateBundle } from "../../page/substrate-bundle.js";
11
+ import { playwrightPostWire } from "../../session/playwright-post-wire.js";
12
+ import { buildManagedLaunch, buildIncognitoContextOptions, finalizeManagedSession, finalizeIncognitoSession, } from "../../session/launch-options.js";
13
+ import { assertByobAttach } from "../../session/byob-attach.js";
14
+ async function makeFirefoxAdapter(opts) {
15
+ const mode = opts.launchMode ?? "managed";
16
+ if (mode === "byob") {
17
+ // Firefox attach is a glass-box LAUNCH over BiDi, not CDP-attach — Playwright
18
+ // has no `connectOverBiDi` for a user's running Firefox. Surface the
19
+ // structured `firefox-attach-not-supported` error (no silent fail).
20
+ const url = assertByobAttach(opts);
21
+ await new PlaywrightFirefoxAdapter().attach(url);
22
+ throw new Error("unreachable: firefox attach always refuses");
23
+ }
24
+ if (mode === "incognito") {
25
+ const adapter = new PlaywrightFirefoxAdapter({ channel: firefoxChannelFromEnv() });
26
+ const { browser, context, page } = await adapter.launchEphemeral({
27
+ launchOptions: { headless: !!opts.headless },
28
+ contextOptions: buildIncognitoContextOptions(opts),
29
+ });
30
+ return finalizeIncognitoSession("firefox", { browser, context, page });
31
+ }
32
+ const { profileDir, options } = buildManagedLaunch("firefox", opts);
33
+ const adapter = new PlaywrightFirefoxAdapter({ channel: firefoxChannelFromEnv() });
34
+ const { context, page } = await adapter.launchPersistent({ profileDir, options });
35
+ return finalizeManagedSession("firefox", opts, profileDir, { context, page });
36
+ }
37
+ registerEngine({
38
+ kind: "firefox",
39
+ capabilities: capabilitiesFor("firefox"),
40
+ makeAdapter: makeFirefoxAdapter,
41
+ makeSubstrates: (deps) => playwrightSubstrateBundle(deps),
42
+ postWire: (entry, deps) => playwrightPostWire(entry, deps),
43
+ });
@@ -0,0 +1,43 @@
1
+ import type { Browser, BrowserContext, BrowserContextOptions, CDPSession, LaunchOptions, Page } from "playwright-core";
2
+ import { resolveBrowserType } from "../select.js";
3
+ import type { EngineCapabilities, EngineKind } from "../types.js";
4
+ /** Chromium always mints an eager CDP session, so its launch handles carry a
5
+ * required `cdp` — tighter than the port's optional-`cdp` `EngineLaunchHandles`
6
+ * so callers don't need a non-null assertion on the Chromium path. */
7
+ export interface ChromiumLaunchHandles {
8
+ browser?: Browser;
9
+ context: BrowserContext;
10
+ page: Page;
11
+ cdp: CDPSession;
12
+ }
13
+ /** Options for a persistent (managed) launch — the subset the managed factory
14
+ * passes to `launchPersistentContext` today. */
15
+ export interface PersistentLaunchSpec {
16
+ profileDir: string;
17
+ options: Parameters<ReturnType<typeof resolveBrowserType>["launchPersistentContext"]>[1];
18
+ }
19
+ /** Options for an ephemeral (incognito) launch — a `launch` + `newContext`
20
+ * pair, exactly as the incognito factory builds it today. */
21
+ export interface EphemeralLaunchSpec {
22
+ launchOptions: LaunchOptions;
23
+ contextOptions: BrowserContextOptions;
24
+ }
25
+ /** The Chromium engine adapter. One instance per launch; it owns the engine
26
+ * selection + the eager CDP session, and surfaces the handles the session
27
+ * layer wires its bookkeeping onto. */
28
+ export declare class PlaywrightChromiumAdapter {
29
+ readonly engine: EngineKind;
30
+ readonly capabilities: EngineCapabilities;
31
+ constructor();
32
+ /** Persistent-profile launch — wraps `launchPersistentContext` + the eager
33
+ * `newCDPSession`. Mirrors openManagedSession's pre-seam body verbatim. */
34
+ launchPersistent(spec: PersistentLaunchSpec): Promise<ChromiumLaunchHandles>;
35
+ /** Ephemeral launch — wraps `launch` + `newContext` + the eager
36
+ * `newCDPSession`. Mirrors openIncognitoSession's pre-seam body verbatim. */
37
+ launchEphemeral(spec: EphemeralLaunchSpec): Promise<ChromiumLaunchHandles>;
38
+ /** BYOB attach over CDP — wraps `connectOverCDP` + the eager `newCDPSession`.
39
+ * The loopback / not-owned policy stays in byob.ts because it is
40
+ * protocol-neutral; only this transport hop is engine-specific. Mirrors
41
+ * openByobSession's pre-seam connect body verbatim. */
42
+ attachOverCdp(endpoint: string): Promise<ChromiumLaunchHandles>;
43
+ }
@@ -0,0 +1,56 @@
1
+ // PlaywrightChromiumAdapter — the first BrowserEngine adapter. This is where
2
+ // today's Chromium/CDP behavior lives now: it WRAPS the exact Playwright calls
3
+ // the three session factories used inline before the seam existed
4
+ // (`chromium.launchPersistentContext`, `chromium.launch` + `newContext`,
5
+ // `chromium.connectOverCDP`), and mints the eager `CDPSession` Chromium needs.
6
+ // It does not reimplement anything — the launch options, flags, and ordering
7
+ // are byte-identical to the pre-seam factories.
8
+ //
9
+ // The browser-type is resolved through `resolveBrowserType("chromium")` so the
10
+ // selection seam is exercised by the only engine currently wired up;
11
+ // firefox/webkit route through the same resolver and hit
12
+ // `EngineNotYetSupportedError`.
13
+ import { resolveBrowserType } from "../select.js";
14
+ import { capabilitiesFor } from "../capabilities.js";
15
+ /** The Chromium engine adapter. One instance per launch; it owns the engine
16
+ * selection + the eager CDP session, and surfaces the handles the session
17
+ * layer wires its bookkeeping onto. */
18
+ export class PlaywrightChromiumAdapter {
19
+ engine = "chromium";
20
+ capabilities;
21
+ constructor() {
22
+ // chromium always has a declaration (see capabilities.ts).
23
+ this.capabilities = capabilitiesFor("chromium");
24
+ }
25
+ /** Persistent-profile launch — wraps `launchPersistentContext` + the eager
26
+ * `newCDPSession`. Mirrors openManagedSession's pre-seam body verbatim. */
27
+ async launchPersistent(spec) {
28
+ const browserType = resolveBrowserType(this.engine);
29
+ const context = await browserType.launchPersistentContext(spec.profileDir, spec.options);
30
+ const page = context.pages()[0] ?? (await context.newPage());
31
+ const cdp = await context.newCDPSession(page);
32
+ return { context, page, cdp };
33
+ }
34
+ /** Ephemeral launch — wraps `launch` + `newContext` + the eager
35
+ * `newCDPSession`. Mirrors openIncognitoSession's pre-seam body verbatim. */
36
+ async launchEphemeral(spec) {
37
+ const browserType = resolveBrowserType(this.engine);
38
+ const browser = await browserType.launch(spec.launchOptions);
39
+ const context = await browser.newContext(spec.contextOptions);
40
+ const page = await context.newPage();
41
+ const cdp = await context.newCDPSession(page);
42
+ return { browser, context, page, cdp };
43
+ }
44
+ /** BYOB attach over CDP — wraps `connectOverCDP` + the eager `newCDPSession`.
45
+ * The loopback / not-owned policy stays in byob.ts because it is
46
+ * protocol-neutral; only this transport hop is engine-specific. Mirrors
47
+ * openByobSession's pre-seam connect body verbatim. */
48
+ async attachOverCdp(endpoint) {
49
+ const browserType = resolveBrowserType(this.engine);
50
+ const browser = await browserType.connectOverCDP(endpoint);
51
+ const context = browser.contexts()[0] ?? (await browser.newContext());
52
+ const page = context.pages()[0] ?? (await context.newPage());
53
+ const cdp = await context.newCDPSession(page);
54
+ return { browser, context, page, cdp };
55
+ }
56
+ }
@@ -0,0 +1,52 @@
1
+ import type { BrowserContextOptions, LaunchOptions } from "playwright-core";
2
+ import { resolveBrowserType } from "../select.js";
3
+ import type { EngineCapabilities, EngineKind, EngineLaunchHandles } from "../types.js";
4
+ /** Persistent (managed) launch spec — the subset the managed factory passes to
5
+ * `launchPersistentContext`. Same shape as the chromium adapter's so the
6
+ * session factories thread one spec regardless of engine. */
7
+ export interface FirefoxPersistentLaunchSpec {
8
+ profileDir: string;
9
+ options: Parameters<ReturnType<typeof resolveBrowserType>["launchPersistentContext"]>[1];
10
+ }
11
+ /** Ephemeral (incognito) launch spec — a `launch` + `newContext` pair. */
12
+ export interface FirefoxEphemeralLaunchSpec {
13
+ launchOptions: LaunchOptions;
14
+ contextOptions: BrowserContextOptions;
15
+ }
16
+ /** The experimental stock-Firefox BiDi channel name (Playwright `channel`).
17
+ * Selected via `BROWX_FIREFOX_CHANNEL=moz-firefox`. */
18
+ export declare const MOZ_FIREFOX_CHANNEL = "moz-firefox";
19
+ /** Resolve the optional `BROWX_FIREFOX_CHANNEL` flag. Returns the channel string
20
+ * to pass to Playwright's `launch`/`launchPersistentContext`, or undefined for
21
+ * the default Juggler lane. Only `moz-firefox` is recognised; any other value
22
+ * is rejected loudly (no silent fallback). */
23
+ export declare function firefoxChannelFromEnv(env?: NodeJS.ProcessEnv): string | undefined;
24
+ /** The Firefox engine adapter. One instance per launch; it owns engine
25
+ * selection and surfaces the handles the session layer wires its bookkeeping
26
+ * onto. Unlike the chromium adapter it carries no `cdp` on its handles —
27
+ * Firefox has no CDP escape hatch. */
28
+ export declare class PlaywrightFirefoxAdapter {
29
+ readonly engine: EngineKind;
30
+ readonly capabilities: EngineCapabilities;
31
+ private readonly channel;
32
+ constructor(opts?: {
33
+ channel?: string;
34
+ });
35
+ /** Persistent-profile launch — wraps `launchPersistentContext`. No eager CDP
36
+ * session (Firefox has none). Mirrors the chromium adapter's shape. */
37
+ launchPersistent(spec: FirefoxPersistentLaunchSpec): Promise<EngineLaunchHandles>;
38
+ /** Ephemeral launch — wraps `launch` + `newContext`. No eager CDP session. */
39
+ launchEphemeral(spec: FirefoxEphemeralLaunchSpec): Promise<EngineLaunchHandles>;
40
+ /** BYOB attach. The Firefox attach model is a glass-box LAUNCH of
41
+ * the user's real profile with `--remote-debugging-port`, NOT a CDP-attach —
42
+ * and Playwright has no public `connectOverBiDi` for a user's running
43
+ * Firefox. Until a BiDi attach client exists this rejects with a structured,
44
+ * explanatory error rather than silently failing (the doctrine's
45
+ * no-silent-no-op rule). The `BROWX_ATTACH_BIDI` name is reserved for it.
46
+ * Promise-returning (not `async`) so the eslint require-await rule is honest:
47
+ * there is no awaited work — it is a structured refusal. */
48
+ attach(_endpoint: string): Promise<EngineLaunchHandles>;
49
+ /** Splice the optional `moz-firefox` BiDi channel into a launch options bag.
50
+ * No-op for the default Juggler lane. */
51
+ private withChannel;
52
+ }
@@ -0,0 +1,97 @@
1
+ // PlaywrightFirefoxAdapter — the second BrowserEngine adapter, the proof the
2
+ // port generalizes to a second engine. It mirrors PlaywrightChromiumAdapter's
3
+ // three launch shapes over `resolveBrowserType("firefox")` (Playwright's bundled
4
+ // Juggler Firefox, the default supported lane) — but it mints NO eager CDP
5
+ // session: `newCDPSession` throws on Firefox (measured), and Firefox declares
6
+ // `deep: false`, so the raw-CDP escape hatch is absent. Sessions on this engine
7
+ // run the cross-browser surface; the ~19 CDP-hard tools structured-refuse via
8
+ // the engine gate (src/engine/tool-gate.ts).
9
+ //
10
+ // Dependency direction (architecture doctrine): port → adapter → Playwright.
11
+ // The adapter delegates directly to Playwright on the per-action path exactly
12
+ // like the chromium one — no added allocation on the hot path.
13
+ //
14
+ // Two-track design: the default lane is Juggler (full Playwright API — routes,
15
+ // video, HAR — so the ~139 class-A tools are real). The experimental stock-
16
+ // Firefox `moz-firefox` BiDi channel rides behind `BROWX_FIREFOX_CHANNEL`
17
+ // (see firefoxChannelFromEnv); it is NOT gated by the keystone. Measured against
18
+ // the installed Playwright: the channel IS recognised (it launches a real BiDi
19
+ // session against stock Firefox) but the session immediately hits a Mozilla-side
20
+ // BiDi gap (`network.addDataCollector: unknown command`) — the M20 streaming /
21
+ // network gaps the research predicted. So the flag is wired and the channel
22
+ // resolves; stock-Firefox-BiDi is just not usable for browxai's surface yet.
23
+ // Flip the default to this lane when Mozilla M20 closes.
24
+ import { resolveBrowserType } from "../select.js";
25
+ import { capabilitiesFor } from "../capabilities.js";
26
+ /** The experimental stock-Firefox BiDi channel name (Playwright `channel`).
27
+ * Selected via `BROWX_FIREFOX_CHANNEL=moz-firefox`. */
28
+ export const MOZ_FIREFOX_CHANNEL = "moz-firefox";
29
+ /** Resolve the optional `BROWX_FIREFOX_CHANNEL` flag. Returns the channel string
30
+ * to pass to Playwright's `launch`/`launchPersistentContext`, or undefined for
31
+ * the default Juggler lane. Only `moz-firefox` is recognised; any other value
32
+ * is rejected loudly (no silent fallback). */
33
+ export function firefoxChannelFromEnv(env = process.env) {
34
+ const raw = env.BROWX_FIREFOX_CHANNEL?.trim();
35
+ if (!raw)
36
+ return undefined;
37
+ if (raw !== MOZ_FIREFOX_CHANNEL) {
38
+ throw new Error(`BROWX_FIREFOX_CHANNEL: unknown value "${raw}". The only supported value is ` +
39
+ `"${MOZ_FIREFOX_CHANNEL}" (the experimental stock-Firefox WebDriver-BiDi channel). ` +
40
+ "Unset it for the default bundled-Juggler lane.");
41
+ }
42
+ return MOZ_FIREFOX_CHANNEL;
43
+ }
44
+ /** The Firefox engine adapter. One instance per launch; it owns engine
45
+ * selection and surfaces the handles the session layer wires its bookkeeping
46
+ * onto. Unlike the chromium adapter it carries no `cdp` on its handles —
47
+ * Firefox has no CDP escape hatch. */
48
+ export class PlaywrightFirefoxAdapter {
49
+ engine = "firefox";
50
+ capabilities;
51
+ channel;
52
+ constructor(opts = {}) {
53
+ // firefox always has a declaration (see capabilities.ts).
54
+ this.capabilities = capabilitiesFor("firefox");
55
+ this.channel = opts.channel;
56
+ }
57
+ /** Persistent-profile launch — wraps `launchPersistentContext`. No eager CDP
58
+ * session (Firefox has none). Mirrors the chromium adapter's shape. */
59
+ async launchPersistent(spec) {
60
+ const browserType = resolveBrowserType(this.engine);
61
+ const options = this.withChannel(spec.options);
62
+ const context = await browserType.launchPersistentContext(spec.profileDir, options);
63
+ const page = context.pages()[0] ?? (await context.newPage());
64
+ return { context, page };
65
+ }
66
+ /** Ephemeral launch — wraps `launch` + `newContext`. No eager CDP session. */
67
+ async launchEphemeral(spec) {
68
+ const browserType = resolveBrowserType(this.engine);
69
+ const browser = await browserType.launch(this.withChannel(spec.launchOptions));
70
+ const context = await browser.newContext(spec.contextOptions);
71
+ const page = await context.newPage();
72
+ return { browser, context, page };
73
+ }
74
+ /** BYOB attach. The Firefox attach model is a glass-box LAUNCH of
75
+ * the user's real profile with `--remote-debugging-port`, NOT a CDP-attach —
76
+ * and Playwright has no public `connectOverBiDi` for a user's running
77
+ * Firefox. Until a BiDi attach client exists this rejects with a structured,
78
+ * explanatory error rather than silently failing (the doctrine's
79
+ * no-silent-no-op rule). The `BROWX_ATTACH_BIDI` name is reserved for it.
80
+ * Promise-returning (not `async`) so the eslint require-await rule is honest:
81
+ * there is no awaited work — it is a structured refusal. */
82
+ attach(_endpoint) {
83
+ return Promise.reject(new Error("firefox-attach-not-supported: browxai cannot attach to a running Firefox over CDP. " +
84
+ "Firefox removed CDP in v141; the forward path is WebDriver BiDi, and Playwright has no " +
85
+ "public `connectOverBiDi` for a user's running Firefox yet (the `BROWX_ATTACH_BIDI` name " +
86
+ "is reserved for it). The Firefox BYOB model is a glass-box LAUNCH of the " +
87
+ "real profile with `--remote-debugging-port`, subject to the profile lock. Use a managed " +
88
+ "Firefox session (the default), or a chromium session for CDP-attach BYOB."));
89
+ }
90
+ /** Splice the optional `moz-firefox` BiDi channel into a launch options bag.
91
+ * No-op for the default Juggler lane. */
92
+ withChannel(options) {
93
+ if (!this.channel)
94
+ return options;
95
+ return { ...(options ?? {}), channel: this.channel };
96
+ }
97
+ }
@@ -0,0 +1,40 @@
1
+ import type { BrowserContextOptions, LaunchOptions } from "playwright-core";
2
+ import { resolveBrowserType } from "../select.js";
3
+ import type { EngineCapabilities, EngineKind, EngineLaunchHandles } from "../types.js";
4
+ /** Persistent (managed) launch spec — the subset the managed factory passes to
5
+ * `launchPersistentContext`. Same shape as the chromium/firefox adapters' so the
6
+ * session factories thread one spec regardless of engine. */
7
+ export interface WebKitPersistentLaunchSpec {
8
+ profileDir: string;
9
+ options: Parameters<ReturnType<typeof resolveBrowserType>["launchPersistentContext"]>[1];
10
+ }
11
+ /** Ephemeral (incognito) launch spec — a `launch` + `newContext` pair. */
12
+ export interface WebKitEphemeralLaunchSpec {
13
+ launchOptions: LaunchOptions;
14
+ contextOptions: BrowserContextOptions;
15
+ }
16
+ /** The WebKit engine adapter. One instance per launch; it owns engine selection
17
+ * and surfaces the handles the session layer wires its bookkeeping onto. Like
18
+ * the firefox adapter it carries no `cdp` on its handles — WebKit has no CDP
19
+ * escape hatch (measured: `newCDPSession` throws off Chromium). */
20
+ export declare class PlaywrightWebKitAdapter {
21
+ readonly engine: EngineKind;
22
+ readonly capabilities: EngineCapabilities;
23
+ constructor();
24
+ /** Persistent-profile launch — wraps `launchPersistentContext`. No eager CDP
25
+ * session (WebKit has none). Mirrors the firefox adapter's shape. If a future
26
+ * WebKit build lacks persistent-context support, `launchPersistentContext`
27
+ * throws and the failure surfaces through the session factory (the
28
+ * `webkit-persistent-not-supported` reason is reserved for a structured refusal). */
29
+ launchPersistent(spec: WebKitPersistentLaunchSpec): Promise<EngineLaunchHandles>;
30
+ /** Ephemeral launch — wraps `launch` + `newContext`. No eager CDP session. */
31
+ launchEphemeral(spec: WebKitEphemeralLaunchSpec): Promise<EngineLaunchHandles>;
32
+ /** BYOB attach. WebKit has no CDP attach client and no BiDi attach client
33
+ * either (Safari has not shipped BiDi as of June 2026), and the
34
+ * WebKit engine build exposes no remote-debugging attach surface browxai can
35
+ * drive. Per the doctrine's no-silent-no-op rule this rejects with a
36
+ * structured, RFC-naming error rather than failing quietly. Promise-returning
37
+ * (not `async`) so the eslint require-await rule is honest: there is no awaited
38
+ * work — it is a structured refusal. */
39
+ attach(_endpoint: string): Promise<EngineLaunchHandles>;
40
+ }
@@ -0,0 +1,79 @@
1
+ // PlaywrightWebKitAdapter — the THIRD BrowserEngine adapter.
2
+ // It mirrors PlaywrightFirefoxAdapter's three launch shapes over
3
+ // `resolveBrowserType("webkit")` (Playwright's bundled WebKit build — the
4
+ // WebKit-ENGINE correctness lane, NOT Safari; a real-Safari surface is a
5
+ // separate, tiered companion product, never a browxai engine
6
+ // adapter). Like the Firefox adapter it mints NO eager CDP session — WebKit has
7
+ // no CDP at all (measured: `newCDPSession` throws "CDP session is only available
8
+ // in Chromium"), and `WEBKIT_CAPABILITIES` declares `deep: false`, so the raw-CDP
9
+ // escape hatch is absent and the ~26 CDP-deep tools structured-refuse via the
10
+ // CAPABILITY-based engine gate (src/engine/tool-gate.ts) with NO per-engine edit
11
+ // — the gate keys on `deep:false`, not an engine name, so a new engine that drops
12
+ // `deep` auto-gates. That is the open/closed-correct design the doctrine asks for.
13
+ //
14
+ // Dependency direction (architecture doctrine): port → adapter → Playwright. The
15
+ // adapter delegates directly to Playwright on the per-action path exactly like
16
+ // the chromium + firefox ones — no added allocation on the hot path.
17
+ //
18
+ // Substrates: both already engine-agnostic. WebKit (CDP-absent) selects the
19
+ // page-side `PlaywrightSnapshotSubstrate` walker (`snapshotSubstrateFor` keys on
20
+ // CDP capability, not engine name), so `snapshot`/`find`/`navigate`/`click`/
21
+ // `fill`/`text_search`/`extract`/`set_of_marks`/`plan` work on WebKit with no
22
+ // substrate code change. The network slice rides P2b's Playwright-event tap when
23
+ // it lands (same as Firefox); until then WebKit's network slice is empty.
24
+ //
25
+ // Persistent mode: measured against the installed Playwright, WebKit DOES support
26
+ // `launchPersistentContext` (unlike the "persistent-mode-on-WebKit is a
27
+ // known loss" caveat, which is about real-Safari, not the WebKit engine build) —
28
+ // so the managed path is real. Should a future Playwright/WebKit build drop it,
29
+ // the launch throws and the session factory surfaces it; the reserved structured
30
+ // reason name is `webkit-persistent-not-supported`.
31
+ import { resolveBrowserType } from "../select.js";
32
+ import { capabilitiesFor } from "../capabilities.js";
33
+ /** The WebKit engine adapter. One instance per launch; it owns engine selection
34
+ * and surfaces the handles the session layer wires its bookkeeping onto. Like
35
+ * the firefox adapter it carries no `cdp` on its handles — WebKit has no CDP
36
+ * escape hatch (measured: `newCDPSession` throws off Chromium). */
37
+ export class PlaywrightWebKitAdapter {
38
+ engine = "webkit";
39
+ capabilities;
40
+ constructor() {
41
+ // webkit always has a declaration (see capabilities.ts).
42
+ this.capabilities = capabilitiesFor("webkit");
43
+ }
44
+ /** Persistent-profile launch — wraps `launchPersistentContext`. No eager CDP
45
+ * session (WebKit has none). Mirrors the firefox adapter's shape. If a future
46
+ * WebKit build lacks persistent-context support, `launchPersistentContext`
47
+ * throws and the failure surfaces through the session factory (the
48
+ * `webkit-persistent-not-supported` reason is reserved for a structured refusal). */
49
+ async launchPersistent(spec) {
50
+ const browserType = resolveBrowserType(this.engine);
51
+ const context = await browserType.launchPersistentContext(spec.profileDir, spec.options);
52
+ const page = context.pages()[0] ?? (await context.newPage());
53
+ return { context, page };
54
+ }
55
+ /** Ephemeral launch — wraps `launch` + `newContext`. No eager CDP session. */
56
+ async launchEphemeral(spec) {
57
+ const browserType = resolveBrowserType(this.engine);
58
+ const browser = await browserType.launch(spec.launchOptions);
59
+ const context = await browser.newContext(spec.contextOptions);
60
+ const page = await context.newPage();
61
+ return { browser, context, page };
62
+ }
63
+ /** BYOB attach. WebKit has no CDP attach client and no BiDi attach client
64
+ * either (Safari has not shipped BiDi as of June 2026), and the
65
+ * WebKit engine build exposes no remote-debugging attach surface browxai can
66
+ * drive. Per the doctrine's no-silent-no-op rule this rejects with a
67
+ * structured, RFC-naming error rather than failing quietly. Promise-returning
68
+ * (not `async`) so the eslint require-await rule is honest: there is no awaited
69
+ * work — it is a structured refusal. */
70
+ attach(_endpoint) {
71
+ return Promise.reject(new Error("webkit-attach-not-supported: browxai cannot attach to a running WebKit/Safari over CDP " +
72
+ "or BiDi. WebKit has no CDP escape hatch, and Safari has not shipped WebDriver BiDi as " +
73
+ "of June 2026 (safaridriver is WebDriver-Classic-only and hard-isolates automation into " +
74
+ "a clean ephemeral window — attach-to-the-live-session is impossible by design). The " +
75
+ "WebKit engine lane is correctness-only (managed sessions); real-Safari BYOB " +
76
+ "is a separate, tiered companion surface (AppleScript / Web-Extension), not a browxai " +
77
+ "engine adapter. Use a managed WebKit session, or a chromium session for CDP-attach BYOB."));
78
+ }
79
+ }