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,62 @@
1
+ export type LeafKind = "equals" | "notEquals" | "contains" | "notContains" | "gt" | "lt" | "gte" | "lte" | "between" | "matches" | "exists";
2
+ export type CompositeKind = "and" | "or" | "not";
3
+ export type PredicateKind = LeafKind | CompositeKind;
4
+ export interface LeafPredicate {
5
+ kind: LeafKind;
6
+ /** Dotted accessor into `data`. Must be in the allow-list (see `isAllowedKey`). */
7
+ key: string;
8
+ /** Comparison value for kinds that take one (equals/notEquals/contains/
9
+ * notContains/gt/lt/gte/lte/matches). Required by those kinds. */
10
+ value?: string | number | boolean | null;
11
+ /** `between` bounds. Required by `between`. Inclusive. */
12
+ lo?: number;
13
+ hi?: number;
14
+ }
15
+ export interface CompositePredicate {
16
+ kind: CompositeKind;
17
+ /** Operand predicates. `and`/`or` need ≥1; `not` takes exactly the first. */
18
+ predicates: Predicate[];
19
+ }
20
+ export type Predicate = LeafPredicate | CompositePredicate;
21
+ export interface PredicatePass {
22
+ ok: true;
23
+ }
24
+ export interface PredicateFail {
25
+ ok: false;
26
+ /** Stable kind label of the failing leaf (or the failing combinator). */
27
+ kind: PredicateKind;
28
+ /** Accessor key that failed (when produced by a leaf). Composite combinators
29
+ * surface the first failing child's key for diagnosis. */
30
+ key?: string;
31
+ /** Human-readable label for the expected condition — e.g. "equals \"x\"",
32
+ * "between 0 and 10", "and([…])". Stable shape; used by callers as
33
+ * `failure.expected`. */
34
+ expected: string;
35
+ /** The actual value the accessor resolved to, or a structural description
36
+ * for composite failures ("3 of 4 children passed", etc). */
37
+ actual: unknown;
38
+ }
39
+ export type PredicateResult = PredicatePass | PredicateFail;
40
+ /** Does `key` start with one of the allow-listed roots? Pure; exported for
41
+ * tests + the registration-time validator. */
42
+ export declare function isAllowedKey(key: string): boolean;
43
+ /** The full set of allow-listed roots — exported so docs / tool descriptions
44
+ * can render the list without a second source of truth. */
45
+ export declare function allowedKeyRoots(): readonly string[];
46
+ /**
47
+ * Resolve a dotted accessor key against `data`. Supports the special trailing
48
+ * `.length` segment over arrays + strings (returns the numeric length).
49
+ * Returns `undefined` for missing intermediate keys, or when any segment
50
+ * (post-root) is on the prototype-pollution denylist. Pure; exported for tests.
51
+ */
52
+ export declare function resolveKey(data: unknown, key: string): unknown;
53
+ /** Top-level evaluator. Pure; the engine never touches DOM / page / network —
54
+ * callers stage the data bag and pass it in. */
55
+ export declare function evaluatePredicate(predicate: Predicate, data: unknown): PredicateResult;
56
+ /**
57
+ * Validate a predicate's structural shape (kind, key allow-list, required
58
+ * fields per kind). Returns null when fine, else a string explaining the
59
+ * problem. Use at registration / arg-parse time to fail fast with a clear
60
+ * message; the evaluator itself also tolerates bad shapes (returns ok:false).
61
+ */
62
+ export declare function validatePredicate(p: unknown, path?: string): string | null;
@@ -0,0 +1,340 @@
1
+ // Shared predicate vocabulary.
2
+ //
3
+ // One source of truth for "did this thing hold?" assertions across `verify_*`
4
+ // (assertive read primitives that fail-emit) and `batch.expect` (per-call
5
+ // post-conditions inside a batch). NOT an arbitrary-JS path: the predicate
6
+ // `kind` is a fixed enum, and the `key` accessor is restricted to a fixed
7
+ // allow-list of namespaced dotted paths into model-supplied data. The model
8
+ // chooses *which* key and *which* expected value; the *vocabulary* is server-
9
+ // owned. `eval_js` (gated behind the `eval` capability) is the only arbitrary-
10
+ // JS escape hatch; the predicate engine deliberately does NOT add a second.
11
+ //
12
+ // Composition kinds (`and`/`or`/`not`) are leaf-recursive — you can build
13
+ // "value contains "foo" AND warnings.length lt 3" without an `eval` round
14
+ // trip.
15
+ //
16
+ // `evaluatePredicate(predicate, data)` returns one of:
17
+ // { ok: true } — predicate held
18
+ // { ok: false, expected, actual, …} — predicate did not hold; carries
19
+ // enough to populate a failure
20
+ //
21
+ // The `data` argument is a small bag the caller assembles — e.g. for a
22
+ // verify-family call: `{ actionResult: {...}, snapshot: {...} }`. The
23
+ // accessor-key allow-list (`isAllowedKey`) caps which paths the model may
24
+ // probe.
25
+ /** Allow-listed accessor key prefixes for `data` paths. The predicate engine
26
+ * refuses any `key` whose root segment isn't on this list — keeps adopters
27
+ * from probing into objects we haven't deliberately surfaced. New surfaces
28
+ * must be added here (and documented). */
29
+ const ALLOWED_KEY_ROOTS = new Set([
30
+ // `verify_predicate` data bag
31
+ "actionResult",
32
+ "snapshot",
33
+ "element",
34
+ "value",
35
+ // `batch.expect` shorthand routing
36
+ "expect",
37
+ ]);
38
+ /** Does `key` start with one of the allow-listed roots? Pure; exported for
39
+ * tests + the registration-time validator. */
40
+ export function isAllowedKey(key) {
41
+ if (typeof key !== "string" || key.length === 0)
42
+ return false;
43
+ const root = key.split(".")[0] ?? "";
44
+ return ALLOWED_KEY_ROOTS.has(root);
45
+ }
46
+ /** The full set of allow-listed roots — exported so docs / tool descriptions
47
+ * can render the list without a second source of truth. */
48
+ export function allowedKeyRoots() {
49
+ return [...ALLOWED_KEY_ROOTS].sort();
50
+ }
51
+ /** Segments we refuse to traverse through, regardless of the allow-listed
52
+ * root, to defang prototype-pollution-style probes (`actionResult.__proto__.…`).
53
+ * Not exploitable today — no leaf kind acts on a returned function/prototype
54
+ * in a way that exfiltrates it — but a one-line denylist costs nothing and
55
+ * keeps the engine inert under future changes. */
56
+ const DENIED_KEY_SEGMENTS = new Set(["__proto__", "constructor", "prototype"]);
57
+ /**
58
+ * Resolve a dotted accessor key against `data`. Supports the special trailing
59
+ * `.length` segment over arrays + strings (returns the numeric length).
60
+ * Returns `undefined` for missing intermediate keys, or when any segment
61
+ * (post-root) is on the prototype-pollution denylist. Pure; exported for tests.
62
+ */
63
+ export function resolveKey(data, key) {
64
+ if (!isAllowedKey(key))
65
+ return undefined;
66
+ const parts = key.split(".");
67
+ let cur = data;
68
+ for (const part of parts) {
69
+ if (cur === null || cur === undefined)
70
+ return undefined;
71
+ if (DENIED_KEY_SEGMENTS.has(part))
72
+ return undefined;
73
+ if (part === "length" && (Array.isArray(cur) || typeof cur === "string")) {
74
+ cur = cur.length;
75
+ continue;
76
+ }
77
+ if (typeof cur !== "object")
78
+ return undefined;
79
+ cur = cur[part];
80
+ }
81
+ return cur;
82
+ }
83
+ /** Top-level evaluator. Pure; the engine never touches DOM / page / network —
84
+ * callers stage the data bag and pass it in. */
85
+ export function evaluatePredicate(predicate, data) {
86
+ // Composite first so we don't fall through.
87
+ if (predicate.kind === "and") {
88
+ return evalAnd(predicate, data);
89
+ }
90
+ if (predicate.kind === "or") {
91
+ return evalOr(predicate, data);
92
+ }
93
+ if (predicate.kind === "not") {
94
+ return evalNot(predicate, data);
95
+ }
96
+ return evalLeaf(predicate, data);
97
+ }
98
+ function evalAnd(p, data) {
99
+ if (!Array.isArray(p.predicates) || p.predicates.length === 0) {
100
+ return { ok: false, kind: "and", expected: "and([…]) with ≥1 child", actual: "no children" };
101
+ }
102
+ for (let i = 0; i < p.predicates.length; i++) {
103
+ const r = evaluatePredicate(p.predicates[i], data);
104
+ if (!r.ok) {
105
+ return {
106
+ ok: false,
107
+ kind: "and",
108
+ ...(r.key !== undefined ? { key: r.key } : {}),
109
+ expected: `and(child[${i}]: ${r.expected})`,
110
+ actual: r.actual,
111
+ };
112
+ }
113
+ }
114
+ return { ok: true };
115
+ }
116
+ function evalOr(p, data) {
117
+ if (!Array.isArray(p.predicates) || p.predicates.length === 0) {
118
+ return { ok: false, kind: "or", expected: "or([…]) with ≥1 child", actual: "no children" };
119
+ }
120
+ const childActuals = [];
121
+ for (const child of p.predicates) {
122
+ const r = evaluatePredicate(child, data);
123
+ if (r.ok)
124
+ return { ok: true };
125
+ childActuals.push(r.actual);
126
+ }
127
+ return {
128
+ ok: false,
129
+ kind: "or",
130
+ expected: `or(any of ${p.predicates.length} children)`,
131
+ actual: childActuals,
132
+ };
133
+ }
134
+ function evalNot(p, data) {
135
+ if (!Array.isArray(p.predicates) || p.predicates.length !== 1) {
136
+ return {
137
+ ok: false,
138
+ kind: "not",
139
+ expected: "not(child) with exactly one child",
140
+ actual: `${p.predicates?.length ?? 0} children`,
141
+ };
142
+ }
143
+ const r = evaluatePredicate(p.predicates[0], data);
144
+ if (r.ok) {
145
+ return {
146
+ ok: false,
147
+ kind: "not",
148
+ expected: "not(child) — child should NOT hold but did",
149
+ actual: "child predicate held",
150
+ };
151
+ }
152
+ return { ok: true };
153
+ }
154
+ function evalLeaf(p, data) {
155
+ if (!isAllowedKey(p.key)) {
156
+ return {
157
+ ok: false,
158
+ kind: p.kind,
159
+ key: p.key,
160
+ expected: `accessor key on the allow-list (roots: ${allowedKeyRoots().join(", ")})`,
161
+ actual: `unknown root in key "${p.key}"`,
162
+ };
163
+ }
164
+ const actual = resolveKey(data, p.key);
165
+ switch (p.kind) {
166
+ case "equals":
167
+ if (sameValue(actual, p.value ?? null))
168
+ return { ok: true };
169
+ return fail(p, actual, `equals ${jsonish(p.value)}`);
170
+ case "notEquals":
171
+ if (!sameValue(actual, p.value ?? null))
172
+ return { ok: true };
173
+ return fail(p, actual, `notEquals ${jsonish(p.value)}`);
174
+ case "contains":
175
+ if (containsValue(actual, p.value))
176
+ return { ok: true };
177
+ return fail(p, actual, `contains ${jsonish(p.value)}`);
178
+ case "notContains":
179
+ if (!containsValue(actual, p.value))
180
+ return { ok: true };
181
+ return fail(p, actual, `notContains ${jsonish(p.value)}`);
182
+ case "gt":
183
+ if (numCompare(actual, p.value, (a, b) => a > b))
184
+ return { ok: true };
185
+ return fail(p, actual, `gt ${jsonish(p.value)}`);
186
+ case "lt":
187
+ if (numCompare(actual, p.value, (a, b) => a < b))
188
+ return { ok: true };
189
+ return fail(p, actual, `lt ${jsonish(p.value)}`);
190
+ case "gte":
191
+ if (numCompare(actual, p.value, (a, b) => a >= b))
192
+ return { ok: true };
193
+ return fail(p, actual, `gte ${jsonish(p.value)}`);
194
+ case "lte":
195
+ if (numCompare(actual, p.value, (a, b) => a <= b))
196
+ return { ok: true };
197
+ return fail(p, actual, `lte ${jsonish(p.value)}`);
198
+ case "between":
199
+ if (typeof p.lo !== "number" || typeof p.hi !== "number") {
200
+ return {
201
+ ok: false,
202
+ kind: p.kind,
203
+ key: p.key,
204
+ expected: "between with numeric lo + hi",
205
+ actual: `lo=${jsonish(p.lo)}, hi=${jsonish(p.hi)}`,
206
+ };
207
+ }
208
+ if (typeof actual === "number" && actual >= p.lo && actual <= p.hi)
209
+ return { ok: true };
210
+ return fail(p, actual, `between ${p.lo} and ${p.hi} (inclusive)`);
211
+ case "matches": {
212
+ if (typeof p.value !== "string") {
213
+ return {
214
+ ok: false,
215
+ kind: p.kind,
216
+ key: p.key,
217
+ expected: "matches with a regex string",
218
+ actual: `value=${jsonish(p.value)}`,
219
+ };
220
+ }
221
+ let re;
222
+ try {
223
+ re = new RegExp(p.value);
224
+ }
225
+ catch (e) {
226
+ return {
227
+ ok: false,
228
+ kind: p.kind,
229
+ key: p.key,
230
+ expected: `matches /${p.value}/`,
231
+ actual: `invalid regex: ${e instanceof Error ? e.message : String(e)}`,
232
+ };
233
+ }
234
+ if (typeof actual === "string" && re.test(actual))
235
+ return { ok: true };
236
+ return fail(p, actual, `matches /${p.value}/`);
237
+ }
238
+ case "exists":
239
+ if (actual !== undefined && actual !== null)
240
+ return { ok: true };
241
+ return fail(p, actual, "exists (non-null/undefined)");
242
+ }
243
+ }
244
+ function fail(p, actual, expected) {
245
+ return { ok: false, kind: p.kind, key: p.key, expected, actual };
246
+ }
247
+ function sameValue(a, b) {
248
+ if (a === b)
249
+ return true;
250
+ // numbers, strings, booleans, null: strict equality covers the model-
251
+ // supplied case. Don't deep-equal arrays/objects — keep semantics tight.
252
+ return false;
253
+ }
254
+ function containsValue(haystack, needle) {
255
+ if (typeof needle !== "string" && typeof needle !== "number")
256
+ return false;
257
+ const n = String(needle);
258
+ if (typeof haystack === "string")
259
+ return haystack.includes(n);
260
+ if (Array.isArray(haystack)) {
261
+ return haystack.some((item) => item === needle || String(item) === n);
262
+ }
263
+ return false;
264
+ }
265
+ function numCompare(a, b, cmp) {
266
+ if (typeof a !== "number" || typeof b !== "number")
267
+ return false;
268
+ return cmp(a, b);
269
+ }
270
+ function jsonish(v) {
271
+ try {
272
+ return JSON.stringify(v);
273
+ }
274
+ catch {
275
+ return String(v);
276
+ }
277
+ }
278
+ /**
279
+ * Validate a predicate's structural shape (kind, key allow-list, required
280
+ * fields per kind). Returns null when fine, else a string explaining the
281
+ * problem. Use at registration / arg-parse time to fail fast with a clear
282
+ * message; the evaluator itself also tolerates bad shapes (returns ok:false).
283
+ */
284
+ export function validatePredicate(p, path = "predicate") {
285
+ if (!p || typeof p !== "object")
286
+ return `${path}: must be an object`;
287
+ const obj = p;
288
+ const kind = obj["kind"];
289
+ if (typeof kind !== "string")
290
+ return `${path}: missing "kind" string`;
291
+ if (kind === "and" || kind === "or" || kind === "not") {
292
+ const kids = obj["predicates"];
293
+ if (!Array.isArray(kids) || kids.length === 0) {
294
+ return `${path}: "${kind}" requires "predicates" array with ≥1 entries`;
295
+ }
296
+ if (kind === "not" && kids.length !== 1) {
297
+ return `${path}: "not" takes exactly one child predicate`;
298
+ }
299
+ for (let i = 0; i < kids.length; i++) {
300
+ const child = validatePredicate(kids[i], `${path}.predicates[${i}]`);
301
+ if (child)
302
+ return child;
303
+ }
304
+ return null;
305
+ }
306
+ const leafKinds = new Set([
307
+ "equals",
308
+ "notEquals",
309
+ "contains",
310
+ "notContains",
311
+ "gt",
312
+ "lt",
313
+ "gte",
314
+ "lte",
315
+ "between",
316
+ "matches",
317
+ "exists",
318
+ ]);
319
+ if (!leafKinds.has(kind)) {
320
+ return `${path}: unknown kind "${kind}" (valid: ${[...leafKinds, "and", "or", "not"].join(", ")})`;
321
+ }
322
+ const key = obj["key"];
323
+ if (typeof key !== "string" || key.length === 0)
324
+ return `${path}: missing "key" string`;
325
+ if (!isAllowedKey(key)) {
326
+ return `${path}: key "${key}" not allowed (roots: ${allowedKeyRoots().join(", ")})`;
327
+ }
328
+ if (kind === "between") {
329
+ if (typeof obj["lo"] !== "number" || typeof obj["hi"] !== "number") {
330
+ return `${path}: "between" requires numeric "lo" and "hi"`;
331
+ }
332
+ return null;
333
+ }
334
+ if (kind === "exists")
335
+ return null;
336
+ // remaining kinds need `value`
337
+ if (!("value" in obj))
338
+ return `${path}: "${kind}" requires "value"`;
339
+ return null;
340
+ }
@@ -0,0 +1,104 @@
1
+ /** A registered secret. `name` is the agent-facing alias (`PASSWORD`),
2
+ * `value` the real string that gets substituted in/out, and optional
3
+ * `scope` narrows substitution at dispatch (a real value scoped to
4
+ * `https://app.example.com` won't be materialised into a `fill` on a
5
+ * different origin's page, even if the agent passes `<PASSWORD>`). */
6
+ export interface SecretEntry {
7
+ name: string;
8
+ value: string;
9
+ /** Optional URL substring (case-insensitive) — only applied at dispatch
10
+ * when the current page URL contains it. Masking-on-egress is global
11
+ * (any sink, any origin) — narrowing only the *write* side keeps the
12
+ * read-side guarantee absolute. */
13
+ scope?: string;
14
+ }
15
+ /**
16
+ * Per-session secrets registry. Bounded (32 secrets) to keep the per-sink
17
+ * scan O(secrets × text-len) sane; the realistic upper bound for an auth
18
+ * flow is small (password, OTP, maybe a couple of token-like values).
19
+ */
20
+ export declare class SecretRegistry {
21
+ private cap;
22
+ private byName;
23
+ private cachedValuesDesc;
24
+ private warnedOnce;
25
+ constructor(cap?: number);
26
+ /** Register or replace a secret by name. Names must match `^[A-Z][A-Z0-9_]*$`
27
+ * — uppercase identifier, no whitespace, no angle brackets — so the
28
+ * `<NAME>` mask is unambiguous. An empty `value` is rejected (would mask
29
+ * the empty string everywhere and produce nothing useful). */
30
+ register(entry: SecretEntry): void;
31
+ /** List registered secret names (NEVER values). Useful for the
32
+ * registration tool's confirmation reply + the per-action warning that
33
+ * fires when a screenshot's page-text reveals one. */
34
+ names(): string[];
35
+ size(): number;
36
+ /** Look up an entry by name. Internal — callers go through `materialize`
37
+ * or `applyMask` so the real value never escapes this module by accident. */
38
+ private lookup;
39
+ /**
40
+ * Dispatch-side: turn `<NAME>` (with optional surrounding whitespace OK,
41
+ * but the contract is exact `<NAME>`) into the real value, for `fill` /
42
+ * `press`. Strings that are NOT `<NAME>`-shaped pass through unchanged —
43
+ * the substitution is conservative on purpose so a plain string containing
44
+ * angle brackets stays a plain string.
45
+ *
46
+ * Returns the materialised string + a flag for the caller to label
47
+ * the dispatched-action descriptor (so the ActionResult records that a
48
+ * masked value was sent, not the value itself).
49
+ *
50
+ * `pageUrl` is consulted only when an entry has a `scope`; if scope is set
51
+ * and the current page URL doesn't contain it, the materialisation is
52
+ * REFUSED (returns ok:false) — substituting a secret on a wrong-origin page
53
+ * would leak it cross-site.
54
+ */
55
+ materialize(value: string, pageUrl: string): MaterialiseResult;
56
+ /** Egress-side: scan `text` for any registered real-value and rewrite each
57
+ * occurrence to `<NAME>`. No-op when the registry is empty (the common
58
+ * case — secrets is opt-in). Pure string replacement; safe to apply
59
+ * multiple times (idempotent — `<NAME>` doesn't contain any registered
60
+ * value, so won't re-match). Order: longest value first, so a value
61
+ * that's a substring of another doesn't leave a partial leak. */
62
+ applyMaskInText(text: string): string;
63
+ /** Convenience: mask the string fields of an object/array recursively.
64
+ * Non-string leaves pass through. Bounded depth (8) so a malformed input
65
+ * can't blow the stack. Returns a new object — the input is not mutated. */
66
+ applyMaskDeep<T>(obj: T, depth?: number): T;
67
+ private maskValue;
68
+ /** Best-effort detection: does `text` contain any registered real-value?
69
+ * Used by the screenshot tool's text-content sweep to decide whether to
70
+ * emit the "screenshot may reveal registered secret values" warning. */
71
+ containsAnySecret(text: string): {
72
+ hit: boolean;
73
+ names: string[];
74
+ };
75
+ /** Internal: entries sorted by descending value-length, so longer values
76
+ * mask before their shorter prefixes / substrings. Cached until the next
77
+ * `register()`. */
78
+ private entriesByValueLenDesc;
79
+ }
80
+ export interface MaterialiseResult {
81
+ ok: boolean;
82
+ /** True if `value` is the *real* secret (substituted from the alias);
83
+ * false if it was a plain string the registry didn't touch. Either way
84
+ * `value` is what the caller should pass to Playwright. */
85
+ materialised: boolean;
86
+ /** The string to dispatch — either the original (pass-through) or the
87
+ * registry's stored real value (when materialised). */
88
+ value: string;
89
+ /** Present when `materialised: true` — the alias name, so the dispatched-
90
+ * action descriptor can record `value:"<NAME>"` instead of the real value. */
91
+ alias?: string;
92
+ /** Present when `ok: false` — a clean error message the action handler
93
+ * surfaces back to the agent without dispatching. */
94
+ error?: string;
95
+ }
96
+ /**
97
+ * Compose with the URL sanitiser: apply secrets-masking AFTER URL sanitisation.
98
+ * The two layers are independent — the URL sanitiser handles
99
+ * query/fragment/userinfo/token-paths (regex on URL structure); secrets-
100
+ * masking handles literal real-value substitution anywhere in the text.
101
+ *
102
+ * Helper exists so callers don't have to remember the ordering at every sink.
103
+ */
104
+ export declare function composeUrlAndSecretsInText(text: string, urlSanitiser: (t: string) => string, registry: SecretRegistry | null): string;