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.
- package/LICENSE +21 -0
- package/README.md +139 -0
- package/THIRD_PARTY_NOTICES.md +45 -0
- package/dist/cli/chrome.d.ts +1 -0
- package/dist/cli/chrome.js +130 -0
- package/dist/cli/command-registry.d.ts +15 -0
- package/dist/cli/command-registry.js +35 -0
- package/dist/cli/doctor-plugins.d.ts +18 -0
- package/dist/cli/doctor-plugins.js +338 -0
- package/dist/cli/doctor.d.ts +9 -0
- package/dist/cli/doctor.js +407 -0
- package/dist/cli/init.d.ts +1 -0
- package/dist/cli/init.js +200 -0
- package/dist/cli/register-commands.d.ts +1 -0
- package/dist/cli/register-commands.js +22 -0
- package/dist/cli/serve.d.ts +14 -0
- package/dist/cli/serve.js +151 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +129 -0
- package/dist/engine/adapters/adb.d.ts +72 -0
- package/dist/engine/adapters/adb.js +200 -0
- package/dist/engine/adapters/android-cdp.d.ts +54 -0
- package/dist/engine/adapters/android-cdp.js +110 -0
- package/dist/engine/adapters/android.engine.d.ts +1 -0
- package/dist/engine/adapters/android.engine.js +31 -0
- package/dist/engine/adapters/chromium.engine.d.ts +1 -0
- package/dist/engine/adapters/chromium.engine.js +44 -0
- package/dist/engine/adapters/firefox.engine.d.ts +1 -0
- package/dist/engine/adapters/firefox.engine.js +43 -0
- package/dist/engine/adapters/playwright-chromium.d.ts +43 -0
- package/dist/engine/adapters/playwright-chromium.js +56 -0
- package/dist/engine/adapters/playwright-firefox.d.ts +52 -0
- package/dist/engine/adapters/playwright-firefox.js +97 -0
- package/dist/engine/adapters/playwright-webkit.d.ts +40 -0
- package/dist/engine/adapters/playwright-webkit.js +79 -0
- package/dist/engine/adapters/safari/bidi-client.d.ts +46 -0
- package/dist/engine/adapters/safari/bidi-client.js +130 -0
- package/dist/engine/adapters/safari/launch.d.ts +56 -0
- package/dist/engine/adapters/safari/launch.js +104 -0
- package/dist/engine/adapters/safari/webdriver-client.d.ts +102 -0
- package/dist/engine/adapters/safari/webdriver-client.js +175 -0
- package/dist/engine/adapters/safari.engine.d.ts +1 -0
- package/dist/engine/adapters/safari.engine.js +52 -0
- package/dist/engine/adapters/safaridriver-hybrid.d.ts +56 -0
- package/dist/engine/adapters/safaridriver-hybrid.js +127 -0
- package/dist/engine/adapters/webkit.engine.d.ts +1 -0
- package/dist/engine/adapters/webkit.engine.js +47 -0
- package/dist/engine/capabilities.d.ts +53 -0
- package/dist/engine/capabilities.js +122 -0
- package/dist/engine/capability-registry.d.ts +9 -0
- package/dist/engine/capability-registry.js +20 -0
- package/dist/engine/index.d.ts +18 -0
- package/dist/engine/index.js +14 -0
- package/dist/engine/register-engines.d.ts +5 -0
- package/dist/engine/register-engines.js +16 -0
- package/dist/engine/registry.d.ts +145 -0
- package/dist/engine/registry.js +67 -0
- package/dist/engine/select.d.ts +48 -0
- package/dist/engine/select.js +128 -0
- package/dist/engine/session-cdp.d.ts +13 -0
- package/dist/engine/session-cdp.js +22 -0
- package/dist/engine/tool-gate.d.ts +19 -0
- package/dist/engine/tool-gate.js +226 -0
- package/dist/engine/types.d.ts +71 -0
- package/dist/engine/types.js +16 -0
- package/dist/helper/bridge.d.ts +48 -0
- package/dist/helper/bridge.js +200 -0
- package/dist/helper/browx-page.d.ts +1 -0
- package/dist/helper/browx-page.js +47 -0
- package/dist/helper/overlay-hide.d.ts +9 -0
- package/dist/helper/overlay-hide.js +49 -0
- package/dist/helper/stealth.d.ts +10 -0
- package/dist/helper/stealth.js +88 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +15 -0
- package/dist/page/a11y.d.ts +81 -0
- package/dist/page/a11y.js +219 -0
- package/dist/page/action-substrate.d.ts +64 -0
- package/dist/page/action-substrate.js +118 -0
- package/dist/page/actionresult-blocks.d.ts +99 -0
- package/dist/page/actionresult-blocks.js +144 -0
- package/dist/page/actionresult-shape.d.ts +48 -0
- package/dist/page/actionresult-shape.js +155 -0
- package/dist/page/actionresult-types.d.ts +368 -0
- package/dist/page/actionresult-types.js +4 -0
- package/dist/page/actionresult.d.ts +4 -0
- package/dist/page/actionresult.js +299 -0
- package/dist/page/actions-probe.d.ts +32 -0
- package/dist/page/actions-probe.js +294 -0
- package/dist/page/actions-scroll.d.ts +40 -0
- package/dist/page/actions-scroll.js +53 -0
- package/dist/page/actions.d.ts +132 -0
- package/dist/page/actions.js +453 -0
- package/dist/page/archive-assets.d.ts +39 -0
- package/dist/page/archive-assets.js +187 -0
- package/dist/page/archive.d.ts +47 -0
- package/dist/page/archive.js +349 -0
- package/dist/page/asset-export.d.ts +122 -0
- package/dist/page/asset-export.js +376 -0
- package/dist/page/await_network.d.ts +16 -0
- package/dist/page/await_network.js +23 -0
- package/dist/page/bbox.d.ts +37 -0
- package/dist/page/bbox.js +115 -0
- package/dist/page/canvas-capture.d.ts +82 -0
- package/dist/page/canvas-capture.js +257 -0
- package/dist/page/canvas-diff.d.ts +51 -0
- package/dist/page/canvas-diff.js +131 -0
- package/dist/page/canvas-gesture.d.ts +53 -0
- package/dist/page/canvas-gesture.js +167 -0
- package/dist/page/canvas-transform.d.ts +96 -0
- package/dist/page/canvas-transform.js +150 -0
- package/dist/page/canvas.d.ts +8 -0
- package/dist/page/canvas.js +50 -0
- package/dist/page/capture-substrate.d.ts +111 -0
- package/dist/page/capture-substrate.js +139 -0
- package/dist/page/clipboard.d.ts +25 -0
- package/dist/page/clipboard.js +50 -0
- package/dist/page/clock.d.ts +36 -0
- package/dist/page/clock.js +167 -0
- package/dist/page/compose.d.ts +55 -0
- package/dist/page/compose.js +169 -0
- package/dist/page/console.d.ts +39 -0
- package/dist/page/console.js +73 -0
- package/dist/page/coverage.d.ts +97 -0
- package/dist/page/coverage.js +280 -0
- package/dist/page/dom-export.d.ts +41 -0
- package/dist/page/dom-export.js +193 -0
- package/dist/page/dom-walk.d.ts +91 -0
- package/dist/page/dom-walk.js +267 -0
- package/dist/page/dom_diff.d.ts +48 -0
- package/dist/page/dom_diff.js +121 -0
- package/dist/page/downloads.d.ts +80 -0
- package/dist/page/downloads.js +244 -0
- package/dist/page/drop-files.d.ts +78 -0
- package/dist/page/drop-files.js +310 -0
- package/dist/page/element-export-discovery.d.ts +64 -0
- package/dist/page/element-export-discovery.js +346 -0
- package/dist/page/element-export.d.ts +46 -0
- package/dist/page/element-export.js +251 -0
- package/dist/page/emulation-substrate.d.ts +53 -0
- package/dist/page/emulation-substrate.js +87 -0
- package/dist/page/emulation.d.ts +60 -0
- package/dist/page/emulation.js +162 -0
- package/dist/page/export-playwright-script.d.ts +47 -0
- package/dist/page/export-playwright-script.js +304 -0
- package/dist/page/extract-resolve.d.ts +22 -0
- package/dist/page/extract-resolve.js +341 -0
- package/dist/page/extract-schema.d.ts +20 -0
- package/dist/page/extract-schema.js +200 -0
- package/dist/page/extract-types.d.ts +127 -0
- package/dist/page/extract-types.js +8 -0
- package/dist/page/extract-warnings.d.ts +8 -0
- package/dist/page/extract-warnings.js +56 -0
- package/dist/page/extract.d.ts +9 -0
- package/dist/page/extract.js +174 -0
- package/dist/page/fill-form.d.ts +58 -0
- package/dist/page/fill-form.js +261 -0
- package/dist/page/find.d.ts +158 -0
- package/dist/page/find.js +470 -0
- package/dist/page/frames.d.ts +45 -0
- package/dist/page/frames.js +133 -0
- package/dist/page/generate-locator.d.ts +57 -0
- package/dist/page/generate-locator.js +136 -0
- package/dist/page/gestures.d.ts +128 -0
- package/dist/page/gestures.js +198 -0
- package/dist/page/har.d.ts +91 -0
- package/dist/page/har.js +174 -0
- package/dist/page/heap.d.ts +97 -0
- package/dist/page/heap.js +285 -0
- package/dist/page/inspect.d.ts +34 -0
- package/dist/page/inspect.js +75 -0
- package/dist/page/layout-thrash.d.ts +34 -0
- package/dist/page/layout-thrash.js +232 -0
- package/dist/page/learning.d.ts +21 -0
- package/dist/page/learning.js +84 -0
- package/dist/page/locator.d.ts +54 -0
- package/dist/page/locator.js +142 -0
- package/dist/page/memory-diff.d.ts +48 -0
- package/dist/page/memory-diff.js +105 -0
- package/dist/page/network-mask.d.ts +8 -0
- package/dist/page/network-mask.js +18 -0
- package/dist/page/network-playwright.d.ts +96 -0
- package/dist/page/network-playwright.js +353 -0
- package/dist/page/network-substrate-select.d.ts +18 -0
- package/dist/page/network-substrate-select.js +32 -0
- package/dist/page/network-substrate.d.ts +109 -0
- package/dist/page/network-substrate.js +161 -0
- package/dist/page/network-ws.d.ts +46 -0
- package/dist/page/network-ws.js +113 -0
- package/dist/page/network.d.ts +194 -0
- package/dist/page/network.js +415 -0
- package/dist/page/overflow-detect.d.ts +102 -0
- package/dist/page/overflow-detect.js +449 -0
- package/dist/page/pdf.d.ts +69 -0
- package/dist/page/pdf.js +109 -0
- package/dist/page/perf-audit-analysers.d.ts +40 -0
- package/dist/page/perf-audit-analysers.js +369 -0
- package/dist/page/perf-audit-runner.d.ts +20 -0
- package/dist/page/perf-audit-runner.js +195 -0
- package/dist/page/perf-audit-types.d.ts +41 -0
- package/dist/page/perf-audit-types.js +5 -0
- package/dist/page/perf-audit.d.ts +37 -0
- package/dist/page/perf-audit.js +377 -0
- package/dist/page/perf.d.ts +127 -0
- package/dist/page/perf.js +373 -0
- package/dist/page/plan.d.ts +192 -0
- package/dist/page/plan.js +308 -0
- package/dist/page/point_probe.d.ts +46 -0
- package/dist/page/point_probe.js +99 -0
- package/dist/page/recording.d.ts +67 -0
- package/dist/page/recording.js +172 -0
- package/dist/page/refs.d.ts +92 -0
- package/dist/page/refs.js +134 -0
- package/dist/page/regions.d.ts +23 -0
- package/dist/page/regions.js +32 -0
- package/dist/page/routes.d.ts +40 -0
- package/dist/page/routes.js +87 -0
- package/dist/page/safari-actions.d.ts +12 -0
- package/dist/page/safari-actions.js +144 -0
- package/dist/page/sample.d.ts +64 -0
- package/dist/page/sample.js +216 -0
- package/dist/page/screenshot-on.d.ts +51 -0
- package/dist/page/screenshot-on.js +150 -0
- package/dist/page/screenshot-save.d.ts +36 -0
- package/dist/page/screenshot-save.js +53 -0
- package/dist/page/screenshot-schedule.d.ts +50 -0
- package/dist/page/screenshot-schedule.js +155 -0
- package/dist/page/script-substrate.d.ts +32 -0
- package/dist/page/script-substrate.js +47 -0
- package/dist/page/seed-random.d.ts +45 -0
- package/dist/page/seed-random.js +144 -0
- package/dist/page/set-of-marks.d.ts +96 -0
- package/dist/page/set-of-marks.js +245 -0
- package/dist/page/shadow.d.ts +136 -0
- package/dist/page/shadow.js +400 -0
- package/dist/page/shortcut.d.ts +50 -0
- package/dist/page/shortcut.js +147 -0
- package/dist/page/snapshot-substrate-safari.d.ts +30 -0
- package/dist/page/snapshot-substrate-safari.js +84 -0
- package/dist/page/snapshot-substrate-select.d.ts +24 -0
- package/dist/page/snapshot-substrate-select.js +34 -0
- package/dist/page/snapshot-substrate.d.ts +58 -0
- package/dist/page/snapshot-substrate.js +135 -0
- package/dist/page/snapshot.d.ts +24 -0
- package/dist/page/snapshot.js +162 -0
- package/dist/page/solve-captcha.d.ts +76 -0
- package/dist/page/solve-captcha.js +286 -0
- package/dist/page/storage-substrate-types.d.ts +221 -0
- package/dist/page/storage-substrate-types.js +6 -0
- package/dist/page/storage-substrate.d.ts +215 -0
- package/dist/page/storage-substrate.js +280 -0
- package/dist/page/structural.d.ts +9 -0
- package/dist/page/structural.js +152 -0
- package/dist/page/substrate-bundle-safari.d.ts +8 -0
- package/dist/page/substrate-bundle-safari.js +42 -0
- package/dist/page/substrate-bundle.d.ts +6 -0
- package/dist/page/substrate-bundle.js +53 -0
- package/dist/page/text_search.d.ts +44 -0
- package/dist/page/text_search.js +90 -0
- package/dist/page/upload.d.ts +28 -0
- package/dist/page/upload.js +62 -0
- package/dist/page/verify.d.ts +63 -0
- package/dist/page/verify.js +451 -0
- package/dist/page/video.d.ts +115 -0
- package/dist/page/video.js +169 -0
- package/dist/page/visibility.d.ts +22 -0
- package/dist/page/visibility.js +94 -0
- package/dist/page/watch.d.ts +29 -0
- package/dist/page/watch.js +99 -0
- package/dist/page/workers.d.ts +126 -0
- package/dist/page/workers.js +490 -0
- package/dist/page/ws-interactive.d.ts +82 -0
- package/dist/page/ws-interactive.js +318 -0
- package/dist/plugin/cli.d.ts +45 -0
- package/dist/plugin/cli.js +496 -0
- package/dist/plugin/command-registry.d.ts +9 -0
- package/dist/plugin/command-registry.js +23 -0
- package/dist/plugin/depgraph.d.ts +37 -0
- package/dist/plugin/depgraph.js +186 -0
- package/dist/plugin/manifest.d.ts +182 -0
- package/dist/plugin/manifest.js +219 -0
- package/dist/plugin/package-manager.d.ts +22 -0
- package/dist/plugin/package-manager.js +40 -0
- package/dist/plugin/resolver.d.ts +85 -0
- package/dist/plugin/resolver.js +166 -0
- package/dist/plugin/runtime.d.ts +77 -0
- package/dist/plugin/runtime.js +402 -0
- package/dist/plugin/types.d.ts +113 -0
- package/dist/plugin/types.js +4 -0
- package/dist/policy/confirm.d.ts +76 -0
- package/dist/policy/confirm.js +162 -0
- package/dist/policy/origin.d.ts +17 -0
- package/dist/policy/origin.js +79 -0
- package/dist/sdk/client.d.ts +21 -0
- package/dist/sdk/client.js +174 -0
- package/dist/sdk/index.d.ts +32 -0
- package/dist/sdk/index.js +61 -0
- package/dist/sdk/plugin-types.d.ts +33 -0
- package/dist/sdk/plugin-types.js +22 -0
- package/dist/sdk/registry.d.ts +17 -0
- package/dist/sdk/registry.js +94 -0
- package/dist/sdk/socket-transport.d.ts +20 -0
- package/dist/sdk/socket-transport.js +90 -0
- package/dist/sdk/tool-types.d.ts +634 -0
- package/dist/sdk/tool-types.js +28 -0
- package/dist/sdk/transport-in-process.d.ts +21 -0
- package/dist/sdk/transport-in-process.js +44 -0
- package/dist/sdk/transport-registry.d.ts +19 -0
- package/dist/sdk/transport-registry.js +31 -0
- package/dist/sdk/transport-socket.d.ts +12 -0
- package/dist/sdk/transport-socket.js +77 -0
- package/dist/sdk/transport-stdio-child.d.ts +10 -0
- package/dist/sdk/transport-stdio-child.js +47 -0
- package/dist/sdk/transport.d.ts +10 -0
- package/dist/sdk/transport.js +35 -0
- package/dist/sdk/types.d.ts +176 -0
- package/dist/sdk/types.js +10 -0
- package/dist/server.d.ts +33 -0
- package/dist/server.js +327 -0
- package/dist/session/artifacts.d.ts +52 -0
- package/dist/session/artifacts.js +177 -0
- package/dist/session/byob-attach.d.ts +26 -0
- package/dist/session/byob-attach.js +187 -0
- package/dist/session/byob.d.ts +8 -0
- package/dist/session/byob.js +20 -0
- package/dist/session/cache-storage.d.ts +100 -0
- package/dist/session/cache-storage.js +166 -0
- package/dist/session/device-emu.d.ts +149 -0
- package/dist/session/device-emu.js +545 -0
- package/dist/session/device.d.ts +14 -0
- package/dist/session/device.js +44 -0
- package/dist/session/dialog.d.ts +62 -0
- package/dist/session/dialog.js +164 -0
- package/dist/session/emulation.d.ts +69 -0
- package/dist/session/emulation.js +168 -0
- package/dist/session/extensions.d.ts +113 -0
- package/dist/session/extensions.js +237 -0
- package/dist/session/fs-picker.d.ts +144 -0
- package/dist/session/fs-picker.js +666 -0
- package/dist/session/idb-storage.d.ts +86 -0
- package/dist/session/idb-storage.js +229 -0
- package/dist/session/incognito.d.ts +3 -0
- package/dist/session/incognito.js +20 -0
- package/dist/session/launch-options.d.ts +41 -0
- package/dist/session/launch-options.js +200 -0
- package/dist/session/managed.d.ts +3 -0
- package/dist/session/managed.js +16 -0
- package/dist/session/metrics.d.ts +45 -0
- package/dist/session/metrics.js +75 -0
- package/dist/session/notification.d.ts +122 -0
- package/dist/session/notification.js +426 -0
- package/dist/session/permission.d.ts +144 -0
- package/dist/session/permission.js +600 -0
- package/dist/session/playwright-post-wire.d.ts +8 -0
- package/dist/session/playwright-post-wire.js +148 -0
- package/dist/session/policy-buffer.d.ts +21 -0
- package/dist/session/policy-buffer.js +47 -0
- package/dist/session/profile-snapshot.d.ts +11 -0
- package/dist/session/profile-snapshot.js +53 -0
- package/dist/session/registry.d.ts +365 -0
- package/dist/session/registry.js +98 -0
- package/dist/session/safari-post-wire.d.ts +8 -0
- package/dist/session/safari-post-wire.js +28 -0
- package/dist/session/safari-session.d.ts +10 -0
- package/dist/session/safari-session.js +39 -0
- package/dist/session/storage.d.ts +148 -0
- package/dist/session/storage.js +350 -0
- package/dist/session/types.d.ts +113 -0
- package/dist/session/types.js +5 -0
- package/dist/session/wedge.d.ts +15 -0
- package/dist/session/wedge.js +41 -0
- package/dist/tools/action-core-tools.d.ts +13 -0
- package/dist/tools/action-core-tools.js +156 -0
- package/dist/tools/action-form-tools.d.ts +12 -0
- package/dist/tools/action-form-tools.js +179 -0
- package/dist/tools/action-gesture-tools.d.ts +9 -0
- package/dist/tools/action-gesture-tools.js +115 -0
- package/dist/tools/action-history-tools.d.ts +8 -0
- package/dist/tools/action-history-tools.js +67 -0
- package/dist/tools/action-tool.d.ts +42 -0
- package/dist/tools/action-tool.js +58 -0
- package/dist/tools/action-tools.d.ts +20 -0
- package/dist/tools/action-tools.js +28 -0
- package/dist/tools/batch-act-tools.d.ts +10 -0
- package/dist/tools/batch-act-tools.js +276 -0
- package/dist/tools/batch-human-tools.d.ts +8 -0
- package/dist/tools/batch-human-tools.js +148 -0
- package/dist/tools/canvas-tools.d.ts +40 -0
- package/dist/tools/canvas-tools.js +368 -0
- package/dist/tools/capture-report-diagnostics-tools.d.ts +7 -0
- package/dist/tools/capture-report-diagnostics-tools.js +318 -0
- package/dist/tools/capture-report-element-export-tools.d.ts +8 -0
- package/dist/tools/capture-report-element-export-tools.js +197 -0
- package/dist/tools/capture-report-export-tools.d.ts +8 -0
- package/dist/tools/capture-report-export-tools.js +246 -0
- package/dist/tools/capture-report-marks-tools.d.ts +9 -0
- package/dist/tools/capture-report-marks-tools.js +221 -0
- package/dist/tools/capture-report-upload-tools.d.ts +8 -0
- package/dist/tools/capture-report-upload-tools.js +277 -0
- package/dist/tools/config-approval-tools.d.ts +8 -0
- package/dist/tools/config-approval-tools.js +166 -0
- package/dist/tools/deep-coverage-tools.d.ts +8 -0
- package/dist/tools/deep-coverage-tools.js +325 -0
- package/dist/tools/deep-determinism-tools.d.ts +8 -0
- package/dist/tools/deep-determinism-tools.js +276 -0
- package/dist/tools/deep-perf-tools.d.ts +19 -0
- package/dist/tools/deep-perf-tools.js +324 -0
- package/dist/tools/device-emulation-tools.d.ts +9 -0
- package/dist/tools/device-emulation-tools.js +137 -0
- package/dist/tools/extensions-batch-tools.d.ts +18 -0
- package/dist/tools/extensions-batch-tools.js +24 -0
- package/dist/tools/extensions-rebuild.d.ts +22 -0
- package/dist/tools/extensions-rebuild.js +208 -0
- package/dist/tools/extensions-tools.d.ts +2 -0
- package/dist/tools/extensions-tools.js +331 -0
- package/dist/tools/forms-fill-tools.d.ts +8 -0
- package/dist/tools/forms-fill-tools.js +109 -0
- package/dist/tools/forms-plan-tools.d.ts +7 -0
- package/dist/tools/forms-plan-tools.js +159 -0
- package/dist/tools/forms-recording-mode-tools.d.ts +8 -0
- package/dist/tools/forms-recording-mode-tools.js +71 -0
- package/dist/tools/forms-recording-tools.d.ts +14 -0
- package/dist/tools/forms-recording-tools.js +22 -0
- package/dist/tools/forms-refs-tools.d.ts +8 -0
- package/dist/tools/forms-refs-tools.js +90 -0
- package/dist/tools/gesture-coord-tools.d.ts +8 -0
- package/dist/tools/gesture-coord-tools.js +168 -0
- package/dist/tools/gesture-emulation-tools.d.ts +8 -0
- package/dist/tools/gesture-emulation-tools.js +135 -0
- package/dist/tools/gesture-network-tools.d.ts +17 -0
- package/dist/tools/gesture-network-tools.js +27 -0
- package/dist/tools/gesture-route-tools.d.ts +8 -0
- package/dist/tools/gesture-route-tools.js +142 -0
- package/dist/tools/gesture-websocket-tools.d.ts +8 -0
- package/dist/tools/gesture-websocket-tools.js +122 -0
- package/dist/tools/gesture-worker-tools.d.ts +9 -0
- package/dist/tools/gesture-worker-tools.js +200 -0
- package/dist/tools/host-build.d.ts +76 -0
- package/dist/tools/host-build.js +516 -0
- package/dist/tools/host.d.ts +287 -0
- package/dist/tools/host.js +1 -0
- package/dist/tools/input-tools.d.ts +10 -0
- package/dist/tools/input-tools.js +176 -0
- package/dist/tools/live-emulation-tools.d.ts +9 -0
- package/dist/tools/live-emulation-tools.js +353 -0
- package/dist/tools/plugin-runtime.d.ts +36 -0
- package/dist/tools/plugin-runtime.js +274 -0
- package/dist/tools/read-observe-buffer-tools.d.ts +9 -0
- package/dist/tools/read-observe-buffer-tools.js +385 -0
- package/dist/tools/read-observe-capture-tools.d.ts +12 -0
- package/dist/tools/read-observe-capture-tools.js +376 -0
- package/dist/tools/read-observe-dom-tools.d.ts +8 -0
- package/dist/tools/read-observe-dom-tools.js +308 -0
- package/dist/tools/read-observe-extract-tools.d.ts +8 -0
- package/dist/tools/read-observe-extract-tools.js +232 -0
- package/dist/tools/read-observe-verify-tools.d.ts +8 -0
- package/dist/tools/read-observe-verify-tools.js +316 -0
- package/dist/tools/schemas.d.ts +29 -0
- package/dist/tools/schemas.js +58 -0
- package/dist/tools/secrets-captcha-tools.d.ts +9 -0
- package/dist/tools/secrets-captcha-tools.js +231 -0
- package/dist/tools/session-dialog-permission-tools.d.ts +9 -0
- package/dist/tools/session-dialog-permission-tools.js +287 -0
- package/dist/tools/session-lifecycle-tools.d.ts +8 -0
- package/dist/tools/session-lifecycle-tools.js +314 -0
- package/dist/tools/session-notification-device-tools.d.ts +9 -0
- package/dist/tools/session-notification-device-tools.js +156 -0
- package/dist/tools/session-policy-tools.d.ts +16 -0
- package/dist/tools/session-policy-tools.js +22 -0
- package/dist/tools/session-registry.d.ts +28 -0
- package/dist/tools/session-registry.js +427 -0
- package/dist/tools/storage-artifact-har-video-tools.d.ts +8 -0
- package/dist/tools/storage-artifact-har-video-tools.js +311 -0
- package/dist/tools/storage-cache-idb-tools.d.ts +8 -0
- package/dist/tools/storage-cache-idb-tools.js +347 -0
- package/dist/tools/storage-state-cookies-tools.d.ts +8 -0
- package/dist/tools/storage-state-cookies-tools.js +223 -0
- package/dist/tools/storage-tools.d.ts +17 -0
- package/dist/tools/storage-tools.js +25 -0
- package/dist/tools/storage-web-auth-tools.d.ts +10 -0
- package/dist/tools/storage-web-auth-tools.js +230 -0
- package/dist/tools/tool-metadata.d.ts +8 -0
- package/dist/tools/tool-metadata.js +185 -0
- package/dist/util/batch.d.ts +83 -0
- package/dist/util/batch.js +191 -0
- package/dist/util/capabilities.d.ts +504 -0
- package/dist/util/capabilities.js +254 -0
- package/dist/util/config-store.d.ts +103 -0
- package/dist/util/config-store.js +206 -0
- package/dist/util/config.d.ts +11 -0
- package/dist/util/config.js +28 -0
- package/dist/util/credentials.d.ts +136 -0
- package/dist/util/credentials.js +622 -0
- package/dist/util/deadline.d.ts +22 -0
- package/dist/util/deadline.js +62 -0
- package/dist/util/diagnostics.d.ts +161 -0
- package/dist/util/diagnostics.js +579 -0
- package/dist/util/egress-sanitiser.d.ts +29 -0
- package/dist/util/egress-sanitiser.js +52 -0
- package/dist/util/failure.d.ts +8 -0
- package/dist/util/failure.js +50 -0
- package/dist/util/flake-check.d.ts +109 -0
- package/dist/util/flake-check.js +342 -0
- package/dist/util/invariant.d.ts +25 -0
- package/dist/util/invariant.js +66 -0
- package/dist/util/logging.d.ts +6 -0
- package/dist/util/logging.js +12 -0
- package/dist/util/predicates.d.ts +62 -0
- package/dist/util/predicates.js +340 -0
- package/dist/util/secrets.d.ts +104 -0
- package/dist/util/secrets.js +219 -0
- package/dist/util/tokens.d.ts +6 -0
- package/dist/util/tokens.js +24 -0
- package/dist/util/url-sanitizer.d.ts +19 -0
- package/dist/util/url-sanitizer.js +70 -0
- package/dist/util/version.d.ts +2 -0
- package/dist/util/version.js +21 -0
- package/dist/util/workspace.d.ts +7 -0
- package/dist/util/workspace.js +22 -0
- package/package.json +120 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
// Multi-field form-fill primitive. Fills N field/value pairs atomically in
|
|
2
|
+
// one action window, with an optional final `submit` click — replaces the
|
|
3
|
+
// fill/fill/fill/click round-trip pattern with a single dispatch.
|
|
4
|
+
//
|
|
5
|
+
// Semantics that callers can rely on:
|
|
6
|
+
//
|
|
7
|
+
// 1. **Atomic pre-resolution.** Every field's target (ref / selector /
|
|
8
|
+
// coords) is resolved BEFORE any DOM write. If any target fails to
|
|
9
|
+
// resolve, the call returns `ok:false` with a structured
|
|
10
|
+
// `fieldResolution` block listing every field's outcome — and *no*
|
|
11
|
+
// partial fills land. The agent gets a single "this form isn't ready"
|
|
12
|
+
// signal instead of a half-filled form that's hard to recover from.
|
|
13
|
+
//
|
|
14
|
+
// 2. **Sequential dispatch.** Once resolution succeeds, fields are filled
|
|
15
|
+
// in array order. Each fill goes through the same Playwright `.fill()`
|
|
16
|
+
// path the single-field primitive uses; per-field secrets materialisation
|
|
17
|
+
// and post-probe masking compose unchanged. The first per-field error
|
|
18
|
+
// stops the loop; later fields are reported as `skipped` so the agent
|
|
19
|
+
// can see how far the dispatch got.
|
|
20
|
+
//
|
|
21
|
+
// 3. **Per-field probes.** The result carries `elements: ElementProbe[]`
|
|
22
|
+
// in dispatch order — the multi-target variant of the single-field
|
|
23
|
+
// `element` probe. When a submit is supplied, `element` (singular) is
|
|
24
|
+
// the submit's post-click probe so single-target consumers don't have
|
|
25
|
+
// to feature-detect.
|
|
26
|
+
//
|
|
27
|
+
// 4. **One action window.** Navigation / network / structure / console /
|
|
28
|
+
// pageErrors / snapshotDelta are captured ACROSS the whole sequence,
|
|
29
|
+
// not per field. The agent sees "did the form submit succeed?" at the
|
|
30
|
+
// same envelope level as a one-field fill — one round-trip, one diff.
|
|
31
|
+
import { runInActionWindow, } from "./actionresult.js";
|
|
32
|
+
import { locatorFor } from "./locator.js";
|
|
33
|
+
import { materialiseValue, maskProbe, preProbe, probe } from "./actions.js";
|
|
34
|
+
const DEFAULT_TIMEOUT_MS = 5_000;
|
|
35
|
+
/** Pure helper: render a one-line summary of an ActionTarget so the
|
|
36
|
+
* resolution-failure envelope is human-readable. Exported for unit tests. */
|
|
37
|
+
export function summariseTarget(t) {
|
|
38
|
+
if (t.ref)
|
|
39
|
+
return `ref=${t.ref}`;
|
|
40
|
+
if (t.selector) {
|
|
41
|
+
return t.contextRef ? `selector=${t.selector} (in ${t.contextRef})` : `selector=${t.selector}`;
|
|
42
|
+
}
|
|
43
|
+
if (t.coords)
|
|
44
|
+
return `coords=${t.coords.x},${t.coords.y}`;
|
|
45
|
+
return "<empty target>";
|
|
46
|
+
}
|
|
47
|
+
/** Pure helper: validate the args shape before touching the page. Throws
|
|
48
|
+
* on structural problems (empty fields, coord targets for fill — which
|
|
49
|
+
* Playwright can't drive). Exported for unit tests. */
|
|
50
|
+
export function validateFillFormArgs(args) {
|
|
51
|
+
if (!Array.isArray(args.fields) || args.fields.length === 0) {
|
|
52
|
+
throw new Error("fill_form: `fields` must be a non-empty array of {target, value}");
|
|
53
|
+
}
|
|
54
|
+
for (let i = 0; i < args.fields.length; i++) {
|
|
55
|
+
const f = args.fields[i];
|
|
56
|
+
if (!f || typeof f !== "object") {
|
|
57
|
+
throw new Error(`fill_form: fields[${i}] is not an object`);
|
|
58
|
+
}
|
|
59
|
+
if (typeof f.value !== "string") {
|
|
60
|
+
throw new Error(`fill_form: fields[${i}].value must be a string`);
|
|
61
|
+
}
|
|
62
|
+
if (!f.target) {
|
|
63
|
+
throw new Error(`fill_form: fields[${i}].target is required`);
|
|
64
|
+
}
|
|
65
|
+
if (f.target.coords) {
|
|
66
|
+
throw new Error(`fill_form: fields[${i}] uses a coords target — fill requires a real input/textarea element, ` +
|
|
67
|
+
`so pass ref/selector/named. coords stays for click/hover.`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Resolve every field's locator and confirm it actually matches a node in
|
|
73
|
+
* the DOM. Returns either `{ ok: true, locators, … }` (every field resolved
|
|
74
|
+
* to ≥1 matching node) or `{ ok: false, resolutions }` (one or more misses;
|
|
75
|
+
* caller emits a structured failure and runs NO writes).
|
|
76
|
+
*
|
|
77
|
+
* Exported for unit tests — the atomic-resolution invariant is the most
|
|
78
|
+
* important part of the primitive, and we test it directly.
|
|
79
|
+
*/
|
|
80
|
+
/** Resolve one field/submit target into a locator + resolution record. `index`
|
|
81
|
+
* is the field index, or -1 for the submit target (which drives the zero-node
|
|
82
|
+
* error wording, preserving the prior byte-identical messages). */
|
|
83
|
+
async function resolveOneTarget(page, refs, target, index, targetSummary) {
|
|
84
|
+
const zeroNodeError = index === -1
|
|
85
|
+
? "submit target resolved to zero DOM nodes"
|
|
86
|
+
: "target resolved to zero DOM nodes — element no longer present";
|
|
87
|
+
try {
|
|
88
|
+
const loc = locatorFor(page, refs, target);
|
|
89
|
+
// count() is the cheap "does this resolve" gate — surfaces "ref exists in
|
|
90
|
+
// registry but no longer in the DOM" before we start typing.
|
|
91
|
+
const count = await loc.count().catch(() => 0);
|
|
92
|
+
if (count === 0) {
|
|
93
|
+
return { resolution: { index, targetSummary, ok: false, error: zeroNodeError } };
|
|
94
|
+
}
|
|
95
|
+
return { locator: loc, resolution: { index, targetSummary, ok: true } };
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
return {
|
|
99
|
+
resolution: {
|
|
100
|
+
index,
|
|
101
|
+
targetSummary,
|
|
102
|
+
ok: false,
|
|
103
|
+
error: err instanceof Error ? err.message : String(err),
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
export async function resolveFieldsAtomically(page, refs, fields, submit) {
|
|
109
|
+
const resolutions = [];
|
|
110
|
+
const locators = [];
|
|
111
|
+
for (let i = 0; i < fields.length; i++) {
|
|
112
|
+
const r = await resolveOneTarget(page, refs, fields[i].target, i, summariseTarget(fields[i].target));
|
|
113
|
+
resolutions.push(r.resolution);
|
|
114
|
+
if (r.locator)
|
|
115
|
+
locators.push(r.locator);
|
|
116
|
+
}
|
|
117
|
+
let submitLocator;
|
|
118
|
+
let submitResolution;
|
|
119
|
+
if (submit) {
|
|
120
|
+
const r = await resolveOneTarget(page, refs, submit, -1, `submit ${summariseTarget(submit)}`);
|
|
121
|
+
submitLocator = r.locator;
|
|
122
|
+
submitResolution = r.resolution;
|
|
123
|
+
}
|
|
124
|
+
const allFieldsOk = resolutions.every((r) => r.ok);
|
|
125
|
+
const submitOk = !submitResolution || submitResolution.ok;
|
|
126
|
+
if (!allFieldsOk || !submitOk) {
|
|
127
|
+
return { ok: false, resolutions, submitResolution };
|
|
128
|
+
}
|
|
129
|
+
return { ok: true, locators, submitLocator, resolutions };
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Build the dispatched-action descriptor for the result envelope. The
|
|
133
|
+
* value field carries a compact "n field(s) [+submit]" tag so transcripts
|
|
134
|
+
* stay greppable without dumping every field's value in plaintext.
|
|
135
|
+
*/
|
|
136
|
+
function descriptorFor(args) {
|
|
137
|
+
const n = args.fields.length;
|
|
138
|
+
const suffix = args.submit ? " +submit" : "";
|
|
139
|
+
return { type: "fillForm", value: `${n} field${n === 1 ? "" : "s"}${suffix}` };
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Compose-with-existing-fill multi-field form primitive. See file header
|
|
143
|
+
* for the contract. Failure envelopes mirror the action-window shape so
|
|
144
|
+
* agents see the same `ok / action / navigation / structure / console …`
|
|
145
|
+
* surface they get from every other action tool.
|
|
146
|
+
*/
|
|
147
|
+
/** Build the empty-window `ok:false` envelope for an atomic pre-flight rejection
|
|
148
|
+
* (no fields typed). Mirrors the action-window shape so callers see the same
|
|
149
|
+
* surface every action tool returns. */
|
|
150
|
+
function fillFormFailure(ctx, descriptor, error, fieldResolution) {
|
|
151
|
+
const url = ctx.page.url();
|
|
152
|
+
return {
|
|
153
|
+
ok: false,
|
|
154
|
+
action: descriptor,
|
|
155
|
+
navigation: { changed: false, from: url, to: url, kind: null },
|
|
156
|
+
structure: { appeared: [], removed: [], newTabs: [] },
|
|
157
|
+
console: { errors: [], warnings: 0 },
|
|
158
|
+
pageErrors: [],
|
|
159
|
+
network: { summary: { total: 0, byType: {}, failed: 0 } },
|
|
160
|
+
tokensEstimate: 0,
|
|
161
|
+
warnings: [],
|
|
162
|
+
error,
|
|
163
|
+
fieldResolution,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/** Materialise every field's value (resolving registered-secret aliases) before
|
|
167
|
+
* any write. Returns the materialised values or a pre-flight failure (a
|
|
168
|
+
* rejection on field 3 mustn't leave 0..2 filled). */
|
|
169
|
+
function materialiseFields(ctx, args, descriptor, fieldResolution) {
|
|
170
|
+
const materialised = [];
|
|
171
|
+
for (let i = 0; i < args.fields.length; i++) {
|
|
172
|
+
const f = args.fields[i];
|
|
173
|
+
const mat = materialiseValue(ctx, f.value);
|
|
174
|
+
if (!mat.ok) {
|
|
175
|
+
return {
|
|
176
|
+
ok: false,
|
|
177
|
+
failure: fillFormFailure(ctx, descriptor, `fill_form: secrets materialisation rejected fields[${i}]: ${mat.error}`, fieldResolution),
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
materialised.push({
|
|
181
|
+
value: mat.value,
|
|
182
|
+
alias: mat.alias,
|
|
183
|
+
descriptorValue: mat.alias ? `<${mat.alias}>` : f.value,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
return { ok: true, materialised };
|
|
187
|
+
}
|
|
188
|
+
export async function fillForm(ctx, args) {
|
|
189
|
+
validateFillFormArgs(args);
|
|
190
|
+
const descriptor = descriptorFor(args);
|
|
191
|
+
// Atomic pre-resolution happens BEFORE we open the action window — a
|
|
192
|
+
// resolution failure shouldn't pay for a network tap + a11y pre-tree.
|
|
193
|
+
const resolution = await resolveFieldsAtomically(ctx.page, ctx.refs, args.fields, args.submit);
|
|
194
|
+
if (!resolution.ok) {
|
|
195
|
+
const allResolutions = [
|
|
196
|
+
...resolution.resolutions,
|
|
197
|
+
...(resolution.submitResolution ? [resolution.submitResolution] : []),
|
|
198
|
+
];
|
|
199
|
+
const missedSummaries = allResolutions
|
|
200
|
+
.filter((r) => !r.ok)
|
|
201
|
+
.map((r) => `[${r.index}] ${r.targetSummary}: ${r.error}`)
|
|
202
|
+
.join("; ");
|
|
203
|
+
return fillFormFailure(ctx, descriptor, `fill_form: atomic pre-resolution rejected the call — no fields were typed. Misses: ${missedSummaries}`, allResolutions);
|
|
204
|
+
}
|
|
205
|
+
// Pre-validate secrets materialisation for every field too (same "fail
|
|
206
|
+
// atomically before writing" posture).
|
|
207
|
+
const mat = materialiseFields(ctx, args, descriptor, resolution.resolutions);
|
|
208
|
+
if (!mat.ok)
|
|
209
|
+
return mat.failure;
|
|
210
|
+
const materialised = mat.materialised;
|
|
211
|
+
// ---- single action window across the whole sequence ----
|
|
212
|
+
// The body returns the *final* probe (submit's post-click probe if a
|
|
213
|
+
// submit was supplied; else the last field's post-fill probe). Per-field
|
|
214
|
+
// probes accumulate on the shared `perField` array and are attached to
|
|
215
|
+
// the result on the way out so callers see them under `elements`.
|
|
216
|
+
const perField = [];
|
|
217
|
+
let fillFailure;
|
|
218
|
+
const result = await runInActionWindow(ctx, descriptor, args, async () => {
|
|
219
|
+
let finalProbe;
|
|
220
|
+
for (let i = 0; i < resolution.locators.length; i++) {
|
|
221
|
+
const loc = resolution.locators[i];
|
|
222
|
+
const m = materialised[i];
|
|
223
|
+
const target = args.fields[i].target;
|
|
224
|
+
try {
|
|
225
|
+
const pre = await preProbe(loc);
|
|
226
|
+
await loc.fill(m.value, { timeout: args.deadlineMs ?? DEFAULT_TIMEOUT_MS });
|
|
227
|
+
const probed = await probe(loc, target, m.descriptorValue, pre);
|
|
228
|
+
const masked = maskProbe(probed, ctx);
|
|
229
|
+
perField.push(masked);
|
|
230
|
+
finalProbe = masked;
|
|
231
|
+
}
|
|
232
|
+
catch (err) {
|
|
233
|
+
// Mid-loop fill failure. Record the skipped tail so the agent can
|
|
234
|
+
// see how far the dispatch got, then rethrow — the action-window
|
|
235
|
+
// catches it and surfaces the structured `ok:false` envelope.
|
|
236
|
+
const skipped = [];
|
|
237
|
+
for (let j = i + 1; j < resolution.locators.length; j++)
|
|
238
|
+
skipped.push(j);
|
|
239
|
+
fillFailure = { atIndex: i, skipped };
|
|
240
|
+
// Push a stub probe so per-field positions align with the input
|
|
241
|
+
// array — the failing index carries `stillAttached:false` so the
|
|
242
|
+
// agent doesn't have to count.
|
|
243
|
+
perField.push({ ref: target.ref, stillAttached: false });
|
|
244
|
+
throw err;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (resolution.submitLocator) {
|
|
248
|
+
const pre = await preProbe(resolution.submitLocator);
|
|
249
|
+
await resolution.submitLocator.click({ timeout: args.deadlineMs ?? DEFAULT_TIMEOUT_MS });
|
|
250
|
+
finalProbe = await probe(resolution.submitLocator, args.submit, undefined, pre);
|
|
251
|
+
}
|
|
252
|
+
return finalProbe;
|
|
253
|
+
});
|
|
254
|
+
// Attach per-field probes + fillFailure to the result.
|
|
255
|
+
const out = result;
|
|
256
|
+
if (perField.length > 0)
|
|
257
|
+
out.elements = perField;
|
|
258
|
+
if (fillFailure)
|
|
259
|
+
out.fillFailure = fillFailure;
|
|
260
|
+
return out;
|
|
261
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { CDPSession, Frame, Page } from "playwright-core";
|
|
2
|
+
import { type A11yNode, type StructuralContext } from "./a11y.js";
|
|
3
|
+
import type { RefRegistry } from "./refs.js";
|
|
4
|
+
import type { SnapshotSubstrate } from "./snapshot-substrate.js";
|
|
5
|
+
import { type VisibleRect } from "./bbox.js";
|
|
6
|
+
import type { FeedbackMemory } from "./learning.js";
|
|
7
|
+
export interface FindCandidate {
|
|
8
|
+
ref: string;
|
|
9
|
+
role: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
testId?: string;
|
|
12
|
+
/** "high" = tier-1 testid, "medium" = role+name, "low" = tier 4-5 fallback. */
|
|
13
|
+
stability: "high" | "medium" | "low";
|
|
14
|
+
/** Concrete selector string a consumer can transcribe into a flow-file. Disambiguated
|
|
15
|
+
* with `:visible` / `:nth-match(..., 1)` when the bare hint matched multiple DOM
|
|
16
|
+
* nodes (). */
|
|
17
|
+
selectorHint: string;
|
|
18
|
+
/** Which preference-order tier produced the hint (1–5). */
|
|
19
|
+
selectorTier: 1 | 2 | 3 | 4 | 5;
|
|
20
|
+
/** Visible-rect bbox; null when fully clipped. */
|
|
21
|
+
bbox: VisibleRect | null;
|
|
22
|
+
/** True when the element is fully clipped (bbox is null). */
|
|
23
|
+
clipped: boolean;
|
|
24
|
+
/** whether the element can be acted on right now. `true` = visible
|
|
25
|
+
* + enabled + on-screen. `"disabled"` / `"off-screen"` / `"covered"` describe *why*
|
|
26
|
+
* if not. Lets a calibration agent reject `<input disabled>`-shaped halts at
|
|
27
|
+
* write-time instead of at run-time. */
|
|
28
|
+
actionable: true | "disabled" | "off-screen" | "covered";
|
|
29
|
+
/** Internal score — higher = better match for the query. */
|
|
30
|
+
score: number;
|
|
31
|
+
/** structural neighbourhood when this candidate sits inside a repeated
|
|
32
|
+
* container (table row, listitem, repeated card). Lets the caller filter
|
|
33
|
+
* by row / column without re-walking the snapshot. Absent when the
|
|
34
|
+
* candidate isn't in a recognised repeated structure. */
|
|
35
|
+
context?: StructuralContext;
|
|
36
|
+
}
|
|
37
|
+
export interface FindOptions {
|
|
38
|
+
query: string;
|
|
39
|
+
maxCandidates?: number;
|
|
40
|
+
/** Configured test-attribute list (sourced from BROWX_TEST_ATTRIBUTES). */
|
|
41
|
+
testAttributes: string[];
|
|
42
|
+
/** emit a `warnings: ["no candidate scored confidently…"]` block
|
|
43
|
+
* on the result when no top candidate exceeds this score. Default 0 (off). */
|
|
44
|
+
confidenceFloor?: number;
|
|
45
|
+
/** limit ranking to descendants of this ref (from a prior
|
|
46
|
+
* snapshot/find). "The seconds input *under* the AI Voiceover panel" without
|
|
47
|
+
* encoding the relationship in natural language. Ignored if the ref isn't in
|
|
48
|
+
* the current snapshot. */
|
|
49
|
+
contextRef?: string;
|
|
50
|
+
/** learned ranking: prior session feedback applied as a per-candidate
|
|
51
|
+
* score bonus. Skip / null = no learning bonus. */
|
|
52
|
+
feedback?: FeedbackMemory;
|
|
53
|
+
/** which fallback tools to *name* in the "no visible candidate"
|
|
54
|
+
* warning. Capability-aware so we never point an agent at a disabled tool
|
|
55
|
+
* (`coords` needs `action`; `eval_js` needs `eval`). */
|
|
56
|
+
fallbackHints?: {
|
|
57
|
+
coords: boolean;
|
|
58
|
+
evalJs: boolean;
|
|
59
|
+
};
|
|
60
|
+
/** drop non-actionable candidates (off-screen / clipped / covered /
|
|
61
|
+
* disabled) entirely instead of ranking them last. A confident hidden
|
|
62
|
+
* hit still lures agents into coordinate fallbacks despite the warning;
|
|
63
|
+
* `visibleOnly` returns an empty list + the same warning rather than a
|
|
64
|
+
* misleading hit. Default false (hidden candidates kept, ranked last). */
|
|
65
|
+
visibleOnly?: boolean;
|
|
66
|
+
/** when set, scope ranking + ref-binding to this child Frame.
|
|
67
|
+
* Refs minted are bound to the frame on the registry so subsequent
|
|
68
|
+
* actions land inside the iframe. The bbox/actionable probes resolve
|
|
69
|
+
* via the frame's own locator surface. Omitted = main frame (existing
|
|
70
|
+
* behaviour, byte-identical). */
|
|
71
|
+
frame?: Frame;
|
|
72
|
+
/** stable frame ID of `frame`, used for ref namespacing in the
|
|
73
|
+
* registry and for the snapshot warning. Required when `frame` is set. */
|
|
74
|
+
frameId?: string;
|
|
75
|
+
/** shadow DOM piercing.
|
|
76
|
+
* - `undefined` (default) — preserves pre-v0.5.0 behaviour. Playwright's
|
|
77
|
+
* a11y tree auto-pierces open shadow roots; the DOM-walk fallback does
|
|
78
|
+
* not recurse into shadow content.
|
|
79
|
+
* - `"open"` — additionally have the DOM-walk fallback recurse through
|
|
80
|
+
* every reachable open shadow root.
|
|
81
|
+
* - `"closed"` — open-walk + a CDP `pierce:true` pass that surfaces
|
|
82
|
+
* elements inside CLOSED shadow roots. Best-effort: when CDP refuses
|
|
83
|
+
* the pierce call (older Chromium, attached-mode quirks), falls back
|
|
84
|
+
* to open-only and the result carries a warning. Closed-shadow
|
|
85
|
+
* candidates carry a warning of their own — they're inspectable
|
|
86
|
+
* evidence, not actionable targets (Playwright's locator engine
|
|
87
|
+
* cannot reach them). Closed-shadow CDP harvesting only runs on the
|
|
88
|
+
* main frame; in a frame-scoped find, `"closed"` degrades to `"open"`.
|
|
89
|
+
* - `false` — neither path recurses into shadow content. */
|
|
90
|
+
pierce?: "open" | "closed" | false;
|
|
91
|
+
}
|
|
92
|
+
export interface FindResult {
|
|
93
|
+
candidates: FindCandidate[];
|
|
94
|
+
warnings: string[];
|
|
95
|
+
}
|
|
96
|
+
export declare function find(page: Page | null, substrate: SnapshotSubstrate, refs: RefRegistry, opts: FindOptions,
|
|
97
|
+
/** Raw CDP handle for the visible-rect bbox fast path — present only on
|
|
98
|
+
* chromium (where a11y nodes carry `backendDOMNodeId`). Off Chromium the
|
|
99
|
+
* walker mints no `backendDOMNodeId`, so this is unused and the portable
|
|
100
|
+
* `locatorBoundingBox` fallback computes the box. Optional so the engine
|
|
101
|
+
* type never enters the find tool path. */
|
|
102
|
+
cdp?: CDPSession): Promise<FindResult>;
|
|
103
|
+
/**
|
|
104
|
+
* Stable-partition candidates: actionable ones first (preserving score order),
|
|
105
|
+
* non-actionable (off-screen / clipped / covered / disabled) last — so a
|
|
106
|
+
* slightly-lower-scored *visible* match outranks a high-scored hidden modal.
|
|
107
|
+
* `visibleOnly` drops the hidden tier entirely: an empty result + the
|
|
108
|
+
* "no visible candidate" warning is safer than a confident hidden hit the
|
|
109
|
+
* agent will chase into a coordinate fallback.
|
|
110
|
+
*
|
|
111
|
+
* Within the actionable tier, a second stable partition demotes
|
|
112
|
+
* non-interactive structural/layout containers below interactive controls,
|
|
113
|
+
* but *only* when at least one actionable interactive candidate exists — an
|
|
114
|
+
* aliased query ("the X panel in the right rail") otherwise lets the
|
|
115
|
+
* enclosing wrapper outrank the button/tab the agent actually wants. If no
|
|
116
|
+
* actionable interactive candidate matched, containers are left in place
|
|
117
|
+
* (they may be the best available target). Pure; exported for tests.
|
|
118
|
+
*/
|
|
119
|
+
export declare function rankByVisibility(candidates: FindCandidate[], visibleOnly: boolean): {
|
|
120
|
+
ranked: FindCandidate[];
|
|
121
|
+
visibleCount: number;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* the "all candidates off-screen → probably the wrong match" warning.
|
|
125
|
+
* Capability-aware — only names a fallback tool the caller actually has
|
|
126
|
+
* enabled (`coords` ⇐ `action`, `eval_js` ⇐ `eval`). Pure; exported for tests.
|
|
127
|
+
*/
|
|
128
|
+
export declare function noVisibleCandidateWarning(count: number, fallbackHints?: {
|
|
129
|
+
coords: boolean;
|
|
130
|
+
evalJs: boolean;
|
|
131
|
+
}): string;
|
|
132
|
+
export declare function scoreNode(node: A11yNode, q: string, qTokens: string[]): number;
|
|
133
|
+
/**
|
|
134
|
+
* The five-tier preference order from :
|
|
135
|
+
* 1. `[<test-attr>="…"]` → stability "high" (any configured test-attribute)
|
|
136
|
+
* 2. role + accessible name → stability "medium"
|
|
137
|
+
* 3. stable text on stable role → covered by tier 2 (the DOM-walk's nameFor()
|
|
138
|
+
* computes name from aria-label / labelledby /
|
|
139
|
+
* textContent in that order, so a `<button>Submit</button>`
|
|
140
|
+
* already gets `role=button[name="Submit"]` via tier 2)
|
|
141
|
+
* 4. structural (#id, semantic) → stability "low" (id present + id-shaped stable)
|
|
142
|
+
* 5. positional (last resort) → stability "low"
|
|
143
|
+
*
|
|
144
|
+
* update: tier 4 now fires when the node has an HTML `id` attribute that
|
|
145
|
+
* looks stable (not a numeric/UUID content-keyed id). The id-stability heuristic:
|
|
146
|
+
* reject pure-numeric (`123`), short numeric+letter combos that look generated
|
|
147
|
+
* (e.g. `mui-1234`), or strings matching common content-keyed shapes. Anything
|
|
148
|
+
* with two or more `-`/`_`-separated word segments is treated as stable.
|
|
149
|
+
*/
|
|
150
|
+
export declare function buildSelectorHint(node: Pick<A11yNode, "role" | "name" | "testId" | "testIdAttr" | "id">): {
|
|
151
|
+
hint: string;
|
|
152
|
+
tier: 1 | 2 | 3 | 4 | 5;
|
|
153
|
+
stability: FindCandidate["stability"];
|
|
154
|
+
};
|
|
155
|
+
/** Heuristic: is this HTML `id` value likely to survive across page reloads?
|
|
156
|
+
* Rejects content-keyed shapes (pure-numeric, MUI-generated `mui-N`, UUID-shaped).
|
|
157
|
+
* Accepts ids with two or more word segments separated by `-`/`_`/`:`. */
|
|
158
|
+
export declare function isLikelyStableId(id: string): boolean;
|