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,86 @@
1
+ import type { Page } from "playwright-core";
2
+ /** Enumerate every database visible to the current origin. Uses
3
+ * `indexedDB.databases()` — supported by Chromium-family browsers
4
+ * (the target platform). On engines without it, returns an empty list
5
+ * with a `supported:false` flag rather than throwing. */
6
+ export declare function idbListDatabases(page: Page, tool: string): Promise<{
7
+ databases: Array<{
8
+ name: string;
9
+ version: number;
10
+ }>;
11
+ origin: string;
12
+ supported: boolean;
13
+ }>;
14
+ /** List the object-store names inside a database (read-only — does NOT
15
+ * trigger an upgrade). */
16
+ export declare function idbListStores(page: Page, args: {
17
+ dbName: string;
18
+ }, tool: string): Promise<{
19
+ stores: string[];
20
+ dbName: string;
21
+ version: number;
22
+ origin: string;
23
+ }>;
24
+ /** Get the value at a key. Returns `{found:false}` if absent. Non-JSON
25
+ * values surface as a structured error rather than a silent `undefined`. */
26
+ type IdbGetResult = {
27
+ found: false;
28
+ dbName: string;
29
+ storeName: string;
30
+ key: unknown;
31
+ origin: string;
32
+ } | {
33
+ found: true;
34
+ dbName: string;
35
+ storeName: string;
36
+ key: unknown;
37
+ value: unknown;
38
+ origin: string;
39
+ };
40
+ export declare function idbGet(page: Page, args: {
41
+ dbName: string;
42
+ storeName: string;
43
+ key: unknown;
44
+ }, tool: string): Promise<IdbGetResult>;
45
+ /** Put a value at a key. The object store must already exist — this
46
+ * function does NOT create stores (store creation requires an upgrade
47
+ * transaction, which adopters who own the schema should do themselves).
48
+ *
49
+ * Values are JSON-cloned at the page boundary; non-serialisable inputs
50
+ * reject at MCP-validation time (Zod tree). */
51
+ export declare function idbPut(page: Page, args: {
52
+ dbName: string;
53
+ storeName: string;
54
+ key: unknown;
55
+ value: unknown;
56
+ }, tool: string): Promise<{
57
+ ok: true;
58
+ dbName: string;
59
+ storeName: string;
60
+ key: unknown;
61
+ origin: string;
62
+ }>;
63
+ /** Delete the value at a key. Idempotent — returns the same shape
64
+ * whether or not a record existed. */
65
+ export declare function idbDelete(page: Page, args: {
66
+ dbName: string;
67
+ storeName: string;
68
+ key: unknown;
69
+ }, tool: string): Promise<{
70
+ ok: true;
71
+ dbName: string;
72
+ storeName: string;
73
+ key: unknown;
74
+ origin: string;
75
+ }>;
76
+ /** Clear every record from an object store (the store itself remains). */
77
+ export declare function idbClear(page: Page, args: {
78
+ dbName: string;
79
+ storeName: string;
80
+ }, tool: string): Promise<{
81
+ ok: true;
82
+ dbName: string;
83
+ storeName: string;
84
+ origin: string;
85
+ }>;
86
+ export {};
@@ -0,0 +1,229 @@
1
+ // IndexedDB CRUD — storage-state surface extension.
2
+ //
3
+ // Sibling of cookies / localStorage / sessionStorage / Cache API CRUD.
4
+ // Drives the W3C IndexedDB API via `page.evaluate` — the same posture as
5
+ // the web-storage helpers (origin-scoped; the session MUST be navigated
6
+ // to the target origin first; about:blank rejected).
7
+ //
8
+ // What's actually stored: each IDB database has named object stores, each
9
+ // holding records keyed by a primary key. The CRUD surface here treats
10
+ // values as JSON-serialisable — IDB itself can store structured-clonable
11
+ // values (Blob/ArrayBuffer/Date/Map/Set), but we go through `JSON.stringify`
12
+ // at the page boundary because the MCP transport is JSON-only. Non-JSON
13
+ // values (cyclic refs / functions / DOM nodes) are reported as a structured
14
+ // error rather than silently dropped — see `idbGet` / `idbPut` below.
15
+ //
16
+ // Keys go through JSON too — IDB accepts strings, numbers, dates, and
17
+ // arrays as keys. Strings + numbers + array-of-strings/numbers all
18
+ // round-trip cleanly through JSON; Date keys are stringified to ISO and
19
+ // re-parsed on the way back in. Documented in the tool descriptions.
20
+ //
21
+ // Capability split (server.ts):
22
+ // - reads (`idb_list_databases`, `idb_list_stores`, `idb_get`) → `read`
23
+ // - writes (`idb_put`, `idb_delete`, `idb_clear`) → `action`
24
+ //
25
+ // Tracker-ID hygiene: zero. Each entry is identified by its
26
+ // `(dbName, storeName, key)` triple — the platform's native key.
27
+ const IDB_API = "indexedDB";
28
+ function idbOriginGuard(page, tool) {
29
+ let url;
30
+ try {
31
+ url = page.url();
32
+ }
33
+ catch {
34
+ url = "";
35
+ }
36
+ if (!url || url === "about:blank") {
37
+ throw new Error(`${tool}: IndexedDB is origin-scoped and the page is at "${url || "(unknown)"}". ` +
38
+ `Navigate the session to the target origin first.`);
39
+ }
40
+ }
41
+ // --- reads -----------------------------------------------------------------
42
+ /** Enumerate every database visible to the current origin. Uses
43
+ * `indexedDB.databases()` — supported by Chromium-family browsers
44
+ * (the target platform). On engines without it, returns an empty list
45
+ * with a `supported:false` flag rather than throwing. */
46
+ export async function idbListDatabases(page, tool) {
47
+ idbOriginGuard(page, tool);
48
+ const expr = `(async () => { ` +
49
+ `if (typeof ${IDB_API} === "undefined" || typeof ${IDB_API}.databases !== "function") ` +
50
+ ` return { databases: [], origin: location.origin, supported: false }; ` +
51
+ `var dbs = await ${IDB_API}.databases(); ` +
52
+ `return { databases: dbs.map(function (d) { return { name: d.name || "", version: d.version || 0 }; }), ` +
53
+ ` origin: location.origin, supported: true }; })()`;
54
+ return await page.evaluate(expr);
55
+ }
56
+ /** List the object-store names inside a database (read-only — does NOT
57
+ * trigger an upgrade). */
58
+ export async function idbListStores(page, args, tool) {
59
+ if (!args.dbName)
60
+ throw new Error(`${tool}: \`dbName\` is required`);
61
+ idbOriginGuard(page, tool);
62
+ const expr = `(async () => { ` +
63
+ `var db = await new Promise(function (resolve, reject) { ` +
64
+ ` var req = ${IDB_API}.open(${JSON.stringify(args.dbName)}); ` +
65
+ ` req.onsuccess = function () { resolve(req.result); }; ` +
66
+ ` req.onerror = function () { reject(req.error); }; ` +
67
+ ` req.onblocked = function () { reject(new Error("idb_list_stores: open blocked — close other connections to \\"" + ${JSON.stringify(args.dbName)} + "\\" first")); }; ` +
68
+ `}); ` +
69
+ `var names = Array.prototype.slice.call(db.objectStoreNames); ` +
70
+ `var version = db.version; ` +
71
+ `db.close(); ` +
72
+ `return { stores: names, dbName: ${JSON.stringify(args.dbName)}, version: version, origin: location.origin }; })()`;
73
+ return await page.evaluate(expr);
74
+ }
75
+ export async function idbGet(page, args, tool) {
76
+ if (!args.dbName)
77
+ throw new Error(`${tool}: \`dbName\` is required`);
78
+ if (!args.storeName)
79
+ throw new Error(`${tool}: \`storeName\` is required`);
80
+ if (args.key === undefined || args.key === null)
81
+ throw new Error(`${tool}: \`key\` is required`);
82
+ idbOriginGuard(page, tool);
83
+ const expr = `(async () => { ` +
84
+ `var key = ${JSON.stringify(args.key)}; ` +
85
+ `var db = await new Promise(function (resolve, reject) { ` +
86
+ ` var req = ${IDB_API}.open(${JSON.stringify(args.dbName)}); ` +
87
+ ` req.onsuccess = function () { resolve(req.result); }; ` +
88
+ ` req.onerror = function () { reject(req.error); }; ` +
89
+ ` req.onblocked = function () { reject(new Error("${tool}: open blocked")); }; ` +
90
+ `}); ` +
91
+ `if (!db.objectStoreNames.contains(${JSON.stringify(args.storeName)})) { ` +
92
+ ` db.close(); ` +
93
+ ` throw new Error("${tool}: object store \\"" + ${JSON.stringify(args.storeName)} + "\\" does not exist in db \\"" + ${JSON.stringify(args.dbName)} + "\\""); ` +
94
+ `} ` +
95
+ `var tx = db.transaction(${JSON.stringify(args.storeName)}, "readonly"); ` +
96
+ `var store = tx.objectStore(${JSON.stringify(args.storeName)}); ` +
97
+ `var value = await new Promise(function (resolve, reject) { ` +
98
+ ` var req = store.get(key); ` +
99
+ ` req.onsuccess = function () { resolve(req.result); }; ` +
100
+ ` req.onerror = function () { reject(req.error); }; ` +
101
+ `}); ` +
102
+ `db.close(); ` +
103
+ `if (value === undefined) return { found: false, dbName: ${JSON.stringify(args.dbName)}, storeName: ${JSON.stringify(args.storeName)}, key: key, origin: location.origin }; ` +
104
+ `var jsonable; ` +
105
+ `try { jsonable = JSON.parse(JSON.stringify(value)); } catch (e) { ` +
106
+ ` throw new Error("${tool}: value at (\\"" + ${JSON.stringify(args.dbName)} + "\\", \\"" + ${JSON.stringify(args.storeName)} + "\\") is not JSON-serialisable (" + (e && e.message || e) + ") — agentic browser surface returns JSON over MCP; the platform value is preserved IN the IDB store but cannot be returned over this transport"); ` +
107
+ `} ` +
108
+ `return { found: true, dbName: ${JSON.stringify(args.dbName)}, storeName: ${JSON.stringify(args.storeName)}, key: key, value: jsonable, origin: location.origin }; })()`;
109
+ return await page.evaluate(expr);
110
+ }
111
+ /** Put a value at a key. The object store must already exist — this
112
+ * function does NOT create stores (store creation requires an upgrade
113
+ * transaction, which adopters who own the schema should do themselves).
114
+ *
115
+ * Values are JSON-cloned at the page boundary; non-serialisable inputs
116
+ * reject at MCP-validation time (Zod tree). */
117
+ export async function idbPut(page, args, tool) {
118
+ if (!args.dbName)
119
+ throw new Error(`${tool}: \`dbName\` is required`);
120
+ if (!args.storeName)
121
+ throw new Error(`${tool}: \`storeName\` is required`);
122
+ if (args.key === undefined || args.key === null)
123
+ throw new Error(`${tool}: \`key\` is required`);
124
+ if (args.value === undefined)
125
+ throw new Error(`${tool}: \`value\` is required`);
126
+ idbOriginGuard(page, tool);
127
+ const expr = `(async () => { ` +
128
+ `var key = ${JSON.stringify(args.key)}; ` +
129
+ `var value = ${JSON.stringify(args.value)}; ` +
130
+ `var db = await new Promise(function (resolve, reject) { ` +
131
+ ` var req = ${IDB_API}.open(${JSON.stringify(args.dbName)}); ` +
132
+ ` req.onsuccess = function () { resolve(req.result); }; ` +
133
+ ` req.onerror = function () { reject(req.error); }; ` +
134
+ ` req.onblocked = function () { reject(new Error("${tool}: open blocked")); }; ` +
135
+ `}); ` +
136
+ `if (!db.objectStoreNames.contains(${JSON.stringify(args.storeName)})) { ` +
137
+ ` db.close(); ` +
138
+ ` throw new Error("${tool}: object store \\"" + ${JSON.stringify(args.storeName)} + "\\" does not exist in db \\"" + ${JSON.stringify(args.dbName)} + "\\" — store creation requires an upgrade transaction; create the store from app code first"); ` +
139
+ `} ` +
140
+ `var tx = db.transaction(${JSON.stringify(args.storeName)}, "readwrite"); ` +
141
+ `var store = tx.objectStore(${JSON.stringify(args.storeName)}); ` +
142
+ `await new Promise(function (resolve, reject) { ` +
143
+ ` var req; ` +
144
+ ` if (store.keyPath !== null) { req = store.put(value); } ` +
145
+ ` else { req = store.put(value, key); } ` +
146
+ ` req.onsuccess = function () { resolve(undefined); }; ` +
147
+ ` req.onerror = function () { reject(req.error); }; ` +
148
+ `}); ` +
149
+ `await new Promise(function (resolve, reject) { ` +
150
+ ` tx.oncomplete = function () { resolve(undefined); }; ` +
151
+ ` tx.onerror = function () { reject(tx.error); }; ` +
152
+ ` tx.onabort = function () { reject(tx.error || new Error("${tool}: transaction aborted")); }; ` +
153
+ `}); ` +
154
+ `db.close(); ` +
155
+ `return { ok: true, dbName: ${JSON.stringify(args.dbName)}, storeName: ${JSON.stringify(args.storeName)}, key: key, origin: location.origin }; })()`;
156
+ return await page.evaluate(expr);
157
+ }
158
+ /** Delete the value at a key. Idempotent — returns the same shape
159
+ * whether or not a record existed. */
160
+ export async function idbDelete(page, args, tool) {
161
+ if (!args.dbName)
162
+ throw new Error(`${tool}: \`dbName\` is required`);
163
+ if (!args.storeName)
164
+ throw new Error(`${tool}: \`storeName\` is required`);
165
+ if (args.key === undefined || args.key === null)
166
+ throw new Error(`${tool}: \`key\` is required`);
167
+ idbOriginGuard(page, tool);
168
+ const expr = `(async () => { ` +
169
+ `var key = ${JSON.stringify(args.key)}; ` +
170
+ `var db = await new Promise(function (resolve, reject) { ` +
171
+ ` var req = ${IDB_API}.open(${JSON.stringify(args.dbName)}); ` +
172
+ ` req.onsuccess = function () { resolve(req.result); }; ` +
173
+ ` req.onerror = function () { reject(req.error); }; ` +
174
+ ` req.onblocked = function () { reject(new Error("${tool}: open blocked")); }; ` +
175
+ `}); ` +
176
+ `if (!db.objectStoreNames.contains(${JSON.stringify(args.storeName)})) { ` +
177
+ ` db.close(); ` +
178
+ ` throw new Error("${tool}: object store \\"" + ${JSON.stringify(args.storeName)} + "\\" does not exist in db \\"" + ${JSON.stringify(args.dbName)} + "\\""); ` +
179
+ `} ` +
180
+ `var tx = db.transaction(${JSON.stringify(args.storeName)}, "readwrite"); ` +
181
+ `var store = tx.objectStore(${JSON.stringify(args.storeName)}); ` +
182
+ `await new Promise(function (resolve, reject) { ` +
183
+ ` var req = store.delete(key); ` +
184
+ ` req.onsuccess = function () { resolve(undefined); }; ` +
185
+ ` req.onerror = function () { reject(req.error); }; ` +
186
+ `}); ` +
187
+ `await new Promise(function (resolve, reject) { ` +
188
+ ` tx.oncomplete = function () { resolve(undefined); }; ` +
189
+ ` tx.onerror = function () { reject(tx.error); }; ` +
190
+ ` tx.onabort = function () { reject(tx.error || new Error("${tool}: transaction aborted")); }; ` +
191
+ `}); ` +
192
+ `db.close(); ` +
193
+ `return { ok: true, dbName: ${JSON.stringify(args.dbName)}, storeName: ${JSON.stringify(args.storeName)}, key: key, origin: location.origin }; })()`;
194
+ return await page.evaluate(expr);
195
+ }
196
+ /** Clear every record from an object store (the store itself remains). */
197
+ export async function idbClear(page, args, tool) {
198
+ if (!args.dbName)
199
+ throw new Error(`${tool}: \`dbName\` is required`);
200
+ if (!args.storeName)
201
+ throw new Error(`${tool}: \`storeName\` is required`);
202
+ idbOriginGuard(page, tool);
203
+ const expr = `(async () => { ` +
204
+ `var db = await new Promise(function (resolve, reject) { ` +
205
+ ` var req = ${IDB_API}.open(${JSON.stringify(args.dbName)}); ` +
206
+ ` req.onsuccess = function () { resolve(req.result); }; ` +
207
+ ` req.onerror = function () { reject(req.error); }; ` +
208
+ ` req.onblocked = function () { reject(new Error("${tool}: open blocked")); }; ` +
209
+ `}); ` +
210
+ `if (!db.objectStoreNames.contains(${JSON.stringify(args.storeName)})) { ` +
211
+ ` db.close(); ` +
212
+ ` throw new Error("${tool}: object store \\"" + ${JSON.stringify(args.storeName)} + "\\" does not exist in db \\"" + ${JSON.stringify(args.dbName)} + "\\""); ` +
213
+ `} ` +
214
+ `var tx = db.transaction(${JSON.stringify(args.storeName)}, "readwrite"); ` +
215
+ `var store = tx.objectStore(${JSON.stringify(args.storeName)}); ` +
216
+ `await new Promise(function (resolve, reject) { ` +
217
+ ` var req = store.clear(); ` +
218
+ ` req.onsuccess = function () { resolve(undefined); }; ` +
219
+ ` req.onerror = function () { reject(req.error); }; ` +
220
+ `}); ` +
221
+ `await new Promise(function (resolve, reject) { ` +
222
+ ` tx.oncomplete = function () { resolve(undefined); }; ` +
223
+ ` tx.onerror = function () { reject(tx.error); }; ` +
224
+ ` tx.onabort = function () { reject(tx.error || new Error("${tool}: transaction aborted")); }; ` +
225
+ `}); ` +
226
+ `db.close(); ` +
227
+ `return { ok: true, dbName: ${JSON.stringify(args.dbName)}, storeName: ${JSON.stringify(args.storeName)}, origin: location.origin }; })()`;
228
+ return await page.evaluate(expr);
229
+ }
@@ -0,0 +1,3 @@
1
+ import "../engine/register-engines.js";
2
+ import type { BrowserSession, SessionOptions } from "./types.js";
3
+ export declare function openIncognitoSession(opts?: SessionOptions): Promise<BrowserSession>;
@@ -0,0 +1,20 @@
1
+ // Incognito launch. A fresh browser process + an *ephemeral* BrowserContext: no
2
+ // profile dir, nothing persisted to disk, everything (cookies, storage, cache)
3
+ // discarded on close. Same safe-by-default flags as managed (no
4
+ // `--disable-web-security`, sandbox on). Use for one-off agentic driving where you
5
+ // explicitly do NOT want a profile trace.
6
+ //
7
+ // The no-trace consumer-repo contract is unaffected — there was never any
8
+ // consumer-cwd write; incognito additionally leaves no Chrome profile behind.
9
+ //
10
+ // Post-RFC-0004-P1 this factory keeps only its MODE concern: it resolves the
11
+ // engine and hands off to the EngineRegistry, whose `makeAdapter` owns the
12
+ // per-engine ephemeral-launch body (the `engine === "…"` chain that used to live
13
+ // here is now data-driven, one registration per engine). The per-engine launch +
14
+ // session construction is byte-identical — only relocated into the engine modules.
15
+ import { engineEntry } from "../engine/registry.js";
16
+ import "../engine/register-engines.js";
17
+ export async function openIncognitoSession(opts = {}) {
18
+ const engine = opts.browserType ?? "chromium";
19
+ return engineEntry(engine).makeAdapter({ ...opts, launchMode: "incognito" });
20
+ }
@@ -0,0 +1,41 @@
1
+ import type { Browser, BrowserContext, BrowserContextOptions, CDPSession, Page } from "playwright-core";
2
+ import type { EngineKind } from "../engine/index.js";
3
+ import type { BrowserSession, SessionOptions } from "./types.js";
4
+ /** Resolve the managed-launch profile dir + the shared context options, building
5
+ * the `--disable-web-security` + extension launch args exactly as the managed
6
+ * factory did. The chromium-only `args` splice (insecure + extension flags) is
7
+ * returned separately so the chromium engine can fold it into its
8
+ * launchPersistent options without firefox/webkit ever seeing Chromium `--` flags. */
9
+ export declare function buildManagedLaunch(engine: EngineKind, opts: SessionOptions): {
10
+ profileDir: string;
11
+ options: BrowserContextOptions & {
12
+ headless: boolean;
13
+ acceptDownloads: boolean;
14
+ };
15
+ chromiumArgs: string[];
16
+ };
17
+ /** Apply a managed session's post-launch storageState seeding (the persistent-mode
18
+ * clear-then-seed path) and build the `BrowserSession` object — verbatim from the
19
+ * managed factory's tail. */
20
+ export declare function finalizeManagedSession(engine: EngineKind, opts: SessionOptions, profileDir: string, handles: {
21
+ context: BrowserContext;
22
+ page: Page;
23
+ cdp?: CDPSession;
24
+ }): Promise<BrowserSession>;
25
+ /** Build the incognito ephemeral launch options — the `--disable-web-security`
26
+ * splice, exactly as the incognito factory did (chromium-only). */
27
+ export declare function buildIncognitoLaunchOptions(engine: EngineKind, opts: SessionOptions): {
28
+ headless: boolean;
29
+ args?: string[];
30
+ };
31
+ /** Build the incognito ephemeral context options — verbatim from the incognito
32
+ * factory (device, downloads, storageState, recordHar, recordVideo). */
33
+ export declare function buildIncognitoContextOptions(opts: SessionOptions): BrowserContextOptions;
34
+ /** Build the incognito `BrowserSession` object — verbatim from the incognito
35
+ * factory's tail (note the `mode: "managed"` coarse axis + the browser close). */
36
+ export declare function finalizeIncognitoSession(engine: EngineKind, handles: {
37
+ browser?: Browser;
38
+ context: BrowserContext;
39
+ page: Page;
40
+ cdp?: CDPSession;
41
+ }): BrowserSession;
@@ -0,0 +1,200 @@
1
+ // Shared launch-option building + session finalization for the Playwright-backed
2
+ // engines (chromium / firefox / webkit). Extracted VERBATIM from the per-engine
3
+ // branches of managed.ts / incognito.ts so the per-engine `EngineEntry.makeAdapter`
4
+ // (in adapters/<engine>.engine.ts) builds the exact same options + session object
5
+ // the old `if (engine === "…")` chains did — byte-identical, only relocated.
6
+ //
7
+ // The engine-specific divergences that DON'T collapse (firefox channel resolution,
8
+ // the chromium-only `args` splice, the disable-web-security warning text) stay in
9
+ // the engine modules; what lives here is the shared shape every Playwright engine
10
+ // builds identically.
11
+ import { log } from "../util/logging.js";
12
+ import { resolveWorkspace } from "../util/workspace.js";
13
+ /** Resolve the managed-launch profile dir + the shared context options, building
14
+ * the `--disable-web-security` + extension launch args exactly as the managed
15
+ * factory did. The chromium-only `args` splice (insecure + extension flags) is
16
+ * returned separately so the chromium engine can fold it into its
17
+ * launchPersistent options without firefox/webkit ever seeing Chromium `--` flags. */
18
+ export function buildManagedLaunch(engine, opts) {
19
+ const workspace = resolveWorkspace();
20
+ const profileDir = opts.profileDir ?? workspace.sub("profile");
21
+ // opt-in web-security-off. Off by default (safe-by-default is the
22
+ // non-negotiable); when the gated `disableWebSecurity` config flag
23
+ // is set, lower it here with a loud per-launch warning. The `--disable-*`
24
+ // flag form is Chromium-only — on Firefox SOP-off would ride
25
+ // `firefoxUserPrefs` instead, which the Juggler lane doesn't wire today, so
26
+ // we surface that rather than silently ignore the flag.
27
+ const insecureArgs = [];
28
+ if (opts.disableWebSecurity) {
29
+ if (engine !== "chromium") {
30
+ log.warn(`⚠ session.managed: disableWebSecurity is not wired on the ${engine} engine — ` +
31
+ "the --disable-web-security flag form is Chromium-only. Launching with SOP/CORS ON. " +
32
+ "Use a chromium session if you need web-security-off.");
33
+ }
34
+ else {
35
+ insecureArgs.push("--disable-web-security", "--disable-site-isolation-trials");
36
+ log.warn("⚠ session.managed: disableWebSecurity is ON — launching with --disable-web-security. " +
37
+ "SOP/CORS is OFF for the whole browser session. Use only against test/dev targets.");
38
+ }
39
+ }
40
+ // Optional Chromium extension launch flags. Empty/unset → no flags.
41
+ // Extensions are a LAUNCH-time concern in Chromium; the `extensions`-capability
42
+ // tools mutate this list and rebuild the context. Headed-only (the tool layer
43
+ // refuses on `headless:true` sessions, so by the time we reach this point the
44
+ // launch is already headed) and persistent-only (`incognito` / `attached` are
45
+ // refused upstream). The extension tools are engine-gated (Firefox has no
46
+ // Playwright extension API), so this list is empty on the firefox path.
47
+ const extensionArgs = [];
48
+ if (opts.extensionPaths && opts.extensionPaths.length > 0) {
49
+ const joined = opts.extensionPaths.join(",");
50
+ extensionArgs.push(`--disable-extensions-except=${joined}`, `--load-extension=${joined}`);
51
+ log.info("session.managed: loading extensions", {
52
+ count: opts.extensionPaths.length,
53
+ paths: opts.extensionPaths,
54
+ });
55
+ }
56
+ const chromiumArgs = [...insecureArgs, ...extensionArgs];
57
+ log.info("session.managed: launching", { profileDir, headless: !!opts.headless, engine });
58
+ // Launch options common to both engines. Chromium-only `args` are spliced in
59
+ // for the chromium path only (Firefox rejects Chromium `--` flags).
60
+ const options = {
61
+ headless: !!opts.headless,
62
+ // device/viewport emulation applied at context creation.
63
+ ...(opts.device ?? {}),
64
+ // Accept downloads at the context level — the per-session
65
+ // `DownloadsRegistry` (off-by-default) intercepts them via the
66
+ // `context.on("download")` event. Without `acceptDownloads:true`
67
+ // Playwright never emits that event, so the off-by-default registry
68
+ // can never opt in either.
69
+ acceptDownloads: true,
70
+ // HAR recording at context creation (native Playwright primitive).
71
+ // Finalized on context.close(). No-op when unset.
72
+ ...(opts.recordHar ? { recordHar: opts.recordHar } : {}),
73
+ // Video recording at context creation (native Playwright primitive).
74
+ // Finalized on context.close(). The dir is workspace-rooted by
75
+ // construction; the registry's teardown calls
76
+ // `page.video().saveAs(targetPath)` for a deterministic filename.
77
+ ...(opts.recordVideo ? { recordVideo: opts.recordVideo } : {}),
78
+ };
79
+ return { profileDir, options, chromiumArgs };
80
+ }
81
+ /** Apply a managed session's post-launch storageState seeding (the persistent-mode
82
+ * clear-then-seed path) and build the `BrowserSession` object — verbatim from the
83
+ * managed factory's tail. */
84
+ export async function finalizeManagedSession(engine, opts, profileDir, handles) {
85
+ const { context, page } = handles;
86
+ const cdpHandle = handles.cdp;
87
+ // Persistent contexts don't take `storageState` at creation (their state
88
+ // lives on disk). When a caller asks for it on a managed session we apply
89
+ // it post-create via `setStorageState` — which CLEARS the profile's
90
+ // existing cookies/localStorage/IndexedDB first. Loud-warn so the override
91
+ // is visible.
92
+ if (opts.storageState) {
93
+ log.warn("session.managed: applying storageState to a persistent profile — " +
94
+ "this CLEARS existing cookies/localStorage/IndexedDB on the profile " +
95
+ `at "${profileDir}" before seeding. Use incognito mode for a fresh ` +
96
+ "context without touching a persistent profile.");
97
+ await context.setStorageState(opts.storageState);
98
+ }
99
+ let closed = false;
100
+ return {
101
+ mode: "managed",
102
+ ownsBrowser: true,
103
+ engine,
104
+ page: () => page,
105
+ // chromium mints a CDP session; firefox has none (`cdp` stays optional and
106
+ // absent — consumers route through `requireCdp`, which refuses cleanly).
107
+ ...(cdpHandle ? { cdp: () => cdpHandle } : {}),
108
+ close: async () => {
109
+ if (closed)
110
+ return;
111
+ closed = true;
112
+ log.info("session.managed: closing");
113
+ if (cdpHandle)
114
+ await cdpHandle.detach().catch(() => undefined);
115
+ await context.close().catch(() => undefined);
116
+ },
117
+ };
118
+ }
119
+ /** Build the incognito ephemeral launch options — the `--disable-web-security`
120
+ * splice, exactly as the incognito factory did (chromium-only). */
121
+ export function buildIncognitoLaunchOptions(engine, opts) {
122
+ log.info("session.incognito: launching ephemeral browser", {
123
+ headless: !!opts.headless,
124
+ engine,
125
+ });
126
+ // opt-in web-security-off (off by default; loud per-launch warning). The
127
+ // --disable-* flag form is Chromium-only; on the firefox engine we warn
128
+ // rather than silently apply a flag Firefox doesn't accept.
129
+ const insecureArgs = [];
130
+ if (opts.disableWebSecurity) {
131
+ if (engine !== "chromium") {
132
+ log.warn(`⚠ session.incognito: disableWebSecurity is not wired on the ${engine} engine — ` +
133
+ "the --disable-web-security flag form is Chromium-only. Launching with SOP/CORS ON.");
134
+ }
135
+ else {
136
+ insecureArgs.push("--disable-web-security", "--disable-site-isolation-trials");
137
+ log.warn("⚠ session.incognito: disableWebSecurity is ON — launching with --disable-web-security. " +
138
+ "SOP/CORS is OFF for the whole browser session. Use only against test/dev targets.");
139
+ }
140
+ }
141
+ return {
142
+ headless: !!opts.headless,
143
+ // No lowered-security flags unless the gated flag is explicitly on. The
144
+ // firefox/webkit ephemeral launches never carry Chromium `--` args (their
145
+ // adapters take only `{ headless }`), so the splice is chromium-only by
146
+ // construction — the engine module passes only what its adapter accepts.
147
+ ...(insecureArgs.length ? { args: insecureArgs } : {}),
148
+ };
149
+ }
150
+ /** Build the incognito ephemeral context options — verbatim from the incognito
151
+ * factory (device, downloads, storageState, recordHar, recordVideo). */
152
+ export function buildIncognitoContextOptions(opts) {
153
+ return {
154
+ ...(opts.device ?? {}),
155
+ // Accept downloads at the context level so the per-session
156
+ // `DownloadsRegistry` (off-by-default) can intercept them on demand.
157
+ // The registry discards artefacts when capture is off — `acceptDownloads`
158
+ // being true is purely the prerequisite for Playwright to emit the
159
+ // `download` event that the registry's listener hangs off.
160
+ acceptDownloads: true,
161
+ // Seed the ephemeral context with a storage state if one was supplied
162
+ // (the Playwright-native primitive for "open a fresh browser already
163
+ // logged in as X"). No-op when unset.
164
+ ...(opts.storageState ? { storageState: opts.storageState } : {}),
165
+ // HAR recording at context creation (native Playwright primitive).
166
+ // Finalized on context.close(). No-op when unset.
167
+ ...(opts.recordHar ? { recordHar: opts.recordHar } : {}),
168
+ // Video recording at context creation (native Playwright primitive).
169
+ // Finalized on context.close(). The dir is workspace-rooted by
170
+ // construction; the registry's teardown calls
171
+ // `page.video().saveAs(targetPath)` for a deterministic filename.
172
+ ...(opts.recordVideo ? { recordVideo: opts.recordVideo } : {}),
173
+ };
174
+ }
175
+ /** Build the incognito `BrowserSession` object — verbatim from the incognito
176
+ * factory's tail (note the `mode: "managed"` coarse axis + the browser close). */
177
+ export function finalizeIncognitoSession(engine, handles) {
178
+ const { browser, context, page } = handles;
179
+ const cdpHandle = handles.cdp;
180
+ let closed = false;
181
+ return {
182
+ mode: "managed", // BrowserSession.mode is the coarse owned/not-owned axis;
183
+ // the fine-grained "incognito" label lives on SessionEntry.mode. We own it.
184
+ ownsBrowser: true,
185
+ engine,
186
+ page: () => page,
187
+ // chromium mints a CDP session; firefox has none (`cdp` stays absent).
188
+ ...(cdpHandle ? { cdp: () => cdpHandle } : {}),
189
+ close: async () => {
190
+ if (closed)
191
+ return;
192
+ closed = true;
193
+ log.info("session.incognito: closing (ephemeral context + browser discarded)");
194
+ if (cdpHandle)
195
+ await cdpHandle.detach().catch(() => undefined);
196
+ await context.close().catch(() => undefined);
197
+ await browser?.close().catch(() => undefined);
198
+ },
199
+ };
200
+ }
@@ -0,0 +1,3 @@
1
+ import "../engine/register-engines.js";
2
+ import type { BrowserSession, SessionOptions } from "./types.js";
3
+ export declare function openManagedSession(opts?: SessionOptions): Promise<BrowserSession>;
@@ -0,0 +1,16 @@
1
+ // Managed-profile launch. Normal Chrome flags, sandbox on, profile dir rooted at
2
+ // $BROWX_WORKSPACE/profile/. Never `cwd`, never the human's daily-driver profile,
3
+ // never lowered-security flags.
4
+ //
5
+ // Post-RFC-0004-P1 this factory keeps only its MODE concern: it resolves the
6
+ // engine and hands off to the EngineRegistry, whose `makeAdapter` owns the
7
+ // per-engine managed-launch body (the `engine === "…"` chain that used to live
8
+ // here is now data-driven, one registration per engine). The per-engine launch
9
+ // + session construction is byte-identical — only relocated into the engine
10
+ // modules (see src/engine/adapters/*.engine.ts + src/session/launch-options.ts).
11
+ import { engineEntry } from "../engine/registry.js";
12
+ import "../engine/register-engines.js";
13
+ export async function openManagedSession(opts = {}) {
14
+ const engine = opts.browserType ?? "chromium";
15
+ return engineEntry(engine).makeAdapter({ ...opts, launchMode: "managed" });
16
+ }
@@ -0,0 +1,45 @@
1
+ /** Per-tool counter row. */
2
+ export interface ToolCounter {
3
+ /** Total dispatches against this tool name in this session. */
4
+ count: number;
5
+ /** Sum of wall-clock dispatch latency in milliseconds. */
6
+ durationMs: number;
7
+ /** Dispatches whose first JSON result was shaped `{ok: false, ...}` and was
8
+ * NOT a capability denial. Capability denials are tracked separately on the
9
+ * session-wide `capabilityDenials` scalar (one source of truth). */
10
+ errors: number;
11
+ }
12
+ /** Outcome classifier passed from the dispatch wrapper. */
13
+ export type DispatchOutcome = "ok" | "error" | "denied";
14
+ export declare class SessionMetrics {
15
+ /** Wall-clock instant the session was created. Mirrored on the rolled-up
16
+ * result so the consumer can derive duration without a second tool call. */
17
+ readonly startedAt: number;
18
+ /** Per-tool counters. Lazily created on first dispatch of each tool. */
19
+ private byTool;
20
+ /** Sum of `tokensEstimate` across every dispatched call. The field is on the
21
+ * result envelope (set by every tool that wraps a body via the standard
22
+ * helper); we read it back here so a session-wide token budget is one
23
+ * lookup rather than re-walking each tool's transcript. */
24
+ private tokensSum;
25
+ /** Count of capability-denied dispatches across the whole session — the
26
+ * config-shape signal, see module header. */
27
+ private denials;
28
+ constructor(startedAt?: number);
29
+ /** Record one dispatch. `durationMs` is the wall-clock latency the wrapper
30
+ * measured; `tokensEstimate` is the `tokensEstimate` field from the result
31
+ * envelope (or `undefined` if the result didn't carry one — e.g. an image-
32
+ * only response). Outcome `denied` means the gate refused before dispatch. */
33
+ record(tool: string, outcome: DispatchOutcome, durationMs: number, tokensEstimate?: number): void;
34
+ /** Snapshot the current rollup. The returned object is plain JSON — safe to
35
+ * serialise straight onto the `session_metrics` tool envelope. */
36
+ snapshot(now?: number): {
37
+ callsByTool: Record<string, number>;
38
+ durationMsByTool: Record<string, number>;
39
+ errorsByTool: Record<string, number>;
40
+ tokensEstimateSum: number;
41
+ capabilityDenials: number;
42
+ sessionStartedAt: string;
43
+ sessionDurationMs: number;
44
+ };
45
+ }