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,42 @@
|
|
|
1
|
+
// The Safari `SubstrateBundle` factory (RFC 0004 D1, pattern 1). Safari is the
|
|
2
|
+
// no-Playwright-Page engine, so its seven substrate selectors all read the
|
|
3
|
+
// Safari-native handle (`e.session.safari!()`) instead of a Page/CDP. Each body
|
|
4
|
+
// is byte-identical to its pre-fold form: the five host-build.ts Safari branches
|
|
5
|
+
// (the `if (safariHandle) return new SafariXSubstrate(...)` legs), the Safari
|
|
6
|
+
// snapshot selector (the `SafariSnapshotIO` {exec, currentUrl} wrapping at
|
|
7
|
+
// snapshot-substrate-select.ts:46-50), and the Safari no-op network substrate.
|
|
8
|
+
import { SafariActionSubstrate } from "./action-substrate.js";
|
|
9
|
+
import { SafariCaptureSubstrate } from "./capture-substrate.js";
|
|
10
|
+
import { SafariStorageSubstrate } from "./storage-substrate.js";
|
|
11
|
+
import { SafariScriptSubstrate } from "./script-substrate.js";
|
|
12
|
+
import { SafariEmulationSubstrate } from "./emulation-substrate.js";
|
|
13
|
+
import { SafariClassicSnapshotSubstrate } from "./snapshot-substrate-safari.js";
|
|
14
|
+
import { SafariNoopNetworkSubstrate } from "./network-substrate.js";
|
|
15
|
+
/** The Safari `SubstrateBundle` — the safari engine registers this. `safari!()` is
|
|
16
|
+
* the Safari-native WebDriver-Classic + BiDi handle, present on every safari
|
|
17
|
+
* session by construction (the safari `BrowserSession` always supplies it). Takes
|
|
18
|
+
* the per-server `SubstrateDeps` to honour the standardized `makeSubstrates(deps)`
|
|
19
|
+
* contract, but ignores them: every Safari selector reads the Safari-native handle,
|
|
20
|
+
* not the Playwright `ctxFor`/`describeTarget`/`save` deps. */
|
|
21
|
+
export function safariSubstrateBundle(_deps) {
|
|
22
|
+
return {
|
|
23
|
+
actions: (e) => new SafariActionSubstrate(e.session.safari(), e.refs),
|
|
24
|
+
capture: (e) => new SafariCaptureSubstrate(e.session.safari()),
|
|
25
|
+
storage: (e) => new SafariStorageSubstrate(e.session.safari()),
|
|
26
|
+
script: (e) => new SafariScriptSubstrate(e.session.safari()),
|
|
27
|
+
emulation: (e) => new SafariEmulationSubstrate(e.session.safari()),
|
|
28
|
+
snapshot: (e) => {
|
|
29
|
+
// SafariClassicSnapshotSubstrate takes a SafariSnapshotIO seam
|
|
30
|
+
// ({ exec, currentUrl }), not the raw handle — exactly the wrapping the live
|
|
31
|
+
// snapshot-substrate-select.ts:46-50 did.
|
|
32
|
+
const handle = e.session.safari();
|
|
33
|
+
return new SafariClassicSnapshotSubstrate({
|
|
34
|
+
exec: (scriptBody, args) => handle.webDriver.executeScript(handle.sessionId, scriptBody, args),
|
|
35
|
+
currentUrl: () => handle.webDriver.currentUrl(handle.sessionId),
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
// Safari has no protocol-level network at all (no CDP tap, no BiDi network
|
|
39
|
+
// domain) — the empty no-op substrate; the network tools are capability-gated.
|
|
40
|
+
network: () => new SafariNoopNetworkSubstrate(),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SubstrateBundle, SubstrateDeps } from "../engine/registry.js";
|
|
2
|
+
/** The Playwright `SubstrateBundle` — the four Playwright engines register this.
|
|
3
|
+
* `actions`/`capture` use the per-server host `deps` the composition root threads
|
|
4
|
+
* in (closed over here, not a module-global); `storage`/`script`/`emulation` wrap
|
|
5
|
+
* the session's Page/context; `snapshot`/`network` select by CDP presence. */
|
|
6
|
+
export declare function playwrightSubstrateBundle(deps: SubstrateDeps): SubstrateBundle;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// The Playwright `SubstrateBundle` factory (RFC 0004 D1, pattern 1). Folds the
|
|
2
|
+
// five host-build.ts selectors (actionsFor / captureFor / storageFor / scriptFor /
|
|
3
|
+
// emulationFor) AND the two standalone selectors (snapshotSubstrateFor /
|
|
4
|
+
// networkSubstrateFor) into one engine-owned bundle, so the four Playwright
|
|
5
|
+
// engines (chromium / firefox / webkit / android) supply ONE substrate-bundle
|
|
6
|
+
// factory instead of seven scattered closures. Each selector body is byte-identical
|
|
7
|
+
// to its pre-fold form — only the home moves.
|
|
8
|
+
//
|
|
9
|
+
// The snapshot/network selectors stay capability-keyed (the engine's CDP presence,
|
|
10
|
+
// not its name): chromium/android (CDP) → the verbatim CDP substrate; firefox/
|
|
11
|
+
// webkit (Playwright Page, no CDP) → the page-side walker / event substrate. So a
|
|
12
|
+
// future CDP-bearing Playwright engine routes correctly with no edit here.
|
|
13
|
+
//
|
|
14
|
+
// `actions`/`capture` need host config (`ctxFor`'s testAttributes/originPolicy/caps,
|
|
15
|
+
// `describeTarget`, the screenshot `save` sink). The composition root (host-build)
|
|
16
|
+
// owns those per-server locals and passes its OWN set as the `deps` argument to
|
|
17
|
+
// `playwrightSubstrateBundle(deps)` — closed over here per server, NEVER a
|
|
18
|
+
// module-global. A module-global would let a second `createServer()` in the same
|
|
19
|
+
// process (the in-process SDK transport composes one server per transport)
|
|
20
|
+
// overwrite the first server's originPolicy / workspace.root / caps, cross-
|
|
21
|
+
// contaminating its sessions. Threading the deps explicitly keeps each server's
|
|
22
|
+
// bundle bound to its own boundary.
|
|
23
|
+
import { PlaywrightActionSubstrate } from "./action-substrate.js";
|
|
24
|
+
import { PlaywrightCaptureSubstrate } from "./capture-substrate.js";
|
|
25
|
+
import { PlaywrightStorageSubstrate } from "./storage-substrate.js";
|
|
26
|
+
import { PlaywrightScriptSubstrate } from "./script-substrate.js";
|
|
27
|
+
import { PlaywrightEmulationSubstrate } from "./emulation-substrate.js";
|
|
28
|
+
import { snapshotSubstrateFor } from "./snapshot-substrate-select.js";
|
|
29
|
+
import { networkSubstrateFor } from "./network-substrate-select.js";
|
|
30
|
+
/** The Playwright `SubstrateBundle` — the four Playwright engines register this.
|
|
31
|
+
* `actions`/`capture` use the per-server host `deps` the composition root threads
|
|
32
|
+
* in (closed over here, not a module-global); `storage`/`script`/`emulation` wrap
|
|
33
|
+
* the session's Page/context; `snapshot`/`network` select by CDP presence. */
|
|
34
|
+
export function playwrightSubstrateBundle(deps) {
|
|
35
|
+
return {
|
|
36
|
+
actions: (e) => new PlaywrightActionSubstrate(() => deps.ctxFor(e), e.session.engine),
|
|
37
|
+
capture: (e) => new PlaywrightCaptureSubstrate(() => e.session.page(), e.refs, {
|
|
38
|
+
describeTarget: deps.describeTarget,
|
|
39
|
+
save: deps.save,
|
|
40
|
+
}),
|
|
41
|
+
storage: (e) => new PlaywrightStorageSubstrate(() => e.session.page().context(), () => e.session.page(), e.session.engine),
|
|
42
|
+
script: (e) => new PlaywrightScriptSubstrate(() => e.session.page(), e.session.engine),
|
|
43
|
+
emulation: (e) => new PlaywrightEmulationSubstrate(() => e.session.page().context(), () => e.session.page(), e.session.engine),
|
|
44
|
+
// Snapshot / network select by CDP presence — delegated to the existing
|
|
45
|
+
// capability-keyed selectors (chromium/android → the verbatim CDP substrate;
|
|
46
|
+
// firefox/webkit → the page-side walker / Playwright event substrate). The
|
|
47
|
+
// selectors take the session, so the bundle threads `e.session` through —
|
|
48
|
+
// byte-identical to the standalone `snapshotSubstrateFor` / `networkSubstrateFor`
|
|
49
|
+
// the session-registry used inline, now owned by the engine's bundle.
|
|
50
|
+
snapshot: (e) => snapshotSubstrateFor(e.session),
|
|
51
|
+
network: (e) => networkSubstrateFor(e.session),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { CDPSession } 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
|
+
export interface TextSearchOptions {
|
|
7
|
+
text: string;
|
|
8
|
+
/** Default false — substring (case-insensitive). When true, the match is
|
|
9
|
+
* case-sensitive equality on the trimmed node name. */
|
|
10
|
+
exact?: boolean;
|
|
11
|
+
/** Limit the search to descendants of this ref (a prior snapshot/find result). */
|
|
12
|
+
scope?: string;
|
|
13
|
+
/** Default false — only visible (bbox-having) matches are returned. */
|
|
14
|
+
includeHidden?: boolean;
|
|
15
|
+
/** Default 20; hard cap 200. */
|
|
16
|
+
maxMatches?: number;
|
|
17
|
+
testAttributes: string[];
|
|
18
|
+
}
|
|
19
|
+
export interface TextSearchMatch {
|
|
20
|
+
ref: string;
|
|
21
|
+
role: string;
|
|
22
|
+
text: string;
|
|
23
|
+
context?: StructuralContext;
|
|
24
|
+
bbox: VisibleRect | null;
|
|
25
|
+
clipped: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface TextSearchResult {
|
|
28
|
+
count: number;
|
|
29
|
+
matches: TextSearchMatch[];
|
|
30
|
+
warnings: string[];
|
|
31
|
+
}
|
|
32
|
+
export declare function textSearch(substrate: SnapshotSubstrate, refs: RefRegistry, opts: TextSearchOptions,
|
|
33
|
+
/** Raw CDP handle for the visible-rect bbox fast path — chromium only.
|
|
34
|
+
* Off Chromium the walker mints no `backendDOMNodeId`, so this is unused and
|
|
35
|
+
* hidden/visible classification rides the bbox being null (clipped). */
|
|
36
|
+
cdp?: CDPSession): Promise<TextSearchResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Pure-tree search: walk `root` and return nodes whose `name` matches `text`.
|
|
39
|
+
* Exported for unit testing.
|
|
40
|
+
*
|
|
41
|
+
* @param max hard cap on the *walked* candidate count (post-filter list is
|
|
42
|
+
* capped separately at the caller's `maxMatches`).
|
|
43
|
+
*/
|
|
44
|
+
export declare function searchTreeForText(root: A11yNode, text: string, exact: boolean, max?: number): A11yNode[];
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// `text_search` read primitive.
|
|
2
|
+
//
|
|
3
|
+
// Verification and absence checks: "is the bad value gone?" / "did 'Saved' appear?".
|
|
4
|
+
// Distinct from `find()` (which ranks actionable targets) — `text_search` simply
|
|
5
|
+
// counts matches of a text query against rendered node names, optionally scoped
|
|
6
|
+
// to a subtree, with structural context attached to each match.
|
|
7
|
+
import { walk } from "./a11y.js";
|
|
8
|
+
import { visibleRect } from "./bbox.js";
|
|
9
|
+
import { findByRef } from "./snapshot.js";
|
|
10
|
+
export async function textSearch(substrate, refs, opts,
|
|
11
|
+
/** Raw CDP handle for the visible-rect bbox fast path — chromium only.
|
|
12
|
+
* Off Chromium the walker mints no `backendDOMNodeId`, so this is unused and
|
|
13
|
+
* hidden/visible classification rides the bbox being null (clipped). */
|
|
14
|
+
cdp) {
|
|
15
|
+
const { tree } = await substrate.compose(refs, opts.testAttributes);
|
|
16
|
+
if (!tree)
|
|
17
|
+
return { count: 0, matches: [], warnings: [] };
|
|
18
|
+
const warnings = [];
|
|
19
|
+
let walkRoot = tree;
|
|
20
|
+
if (opts.scope) {
|
|
21
|
+
const sub = findByRef(tree, opts.scope);
|
|
22
|
+
if (sub)
|
|
23
|
+
walkRoot = sub;
|
|
24
|
+
else
|
|
25
|
+
warnings.push(`scope=${opts.scope} not found; searching the full tree instead.`);
|
|
26
|
+
}
|
|
27
|
+
const max = Math.min(opts.maxMatches ?? 20, 200);
|
|
28
|
+
const includeHidden = opts.includeHidden ?? false;
|
|
29
|
+
const candidates = searchTreeForText(walkRoot, opts.text, opts.exact ?? false, max * 4);
|
|
30
|
+
const matches = [];
|
|
31
|
+
for (const node of candidates) {
|
|
32
|
+
if (matches.length >= max)
|
|
33
|
+
break;
|
|
34
|
+
const match = await classifyMatch(node, includeHidden, cdp);
|
|
35
|
+
if (match)
|
|
36
|
+
matches.push(match);
|
|
37
|
+
}
|
|
38
|
+
return { count: matches.length, matches, warnings };
|
|
39
|
+
}
|
|
40
|
+
/** Resolve one candidate node to a match, applying the visible-only filter.
|
|
41
|
+
* A node only reaches here if it's in the NON-IGNORED a11y tree (display:none /
|
|
42
|
+
* aria-hidden subtrees are pruned upstream). WITH a backendDOMNodeId a null bbox
|
|
43
|
+
* means off-screen → hidden. WITHOUT one — the AX tree omits it for many inline /
|
|
44
|
+
* StaticText nodes, which is exactly what a text query matches — we cannot prove
|
|
45
|
+
* off-screen, so we treat the rendered node as visible rather than silently
|
|
46
|
+
* dropping every plain-text match in the default mode. The `clipped` flag still
|
|
47
|
+
* records that the rect was indeterminate. */
|
|
48
|
+
async function classifyMatch(node, includeHidden, cdp) {
|
|
49
|
+
const bbox = cdp !== undefined && node.backendDOMNodeId !== undefined
|
|
50
|
+
? await visibleRect(cdp, node.backendDOMNodeId)
|
|
51
|
+
: null;
|
|
52
|
+
const hasBackendId = cdp !== undefined && node.backendDOMNodeId !== undefined;
|
|
53
|
+
const visible = hasBackendId ? bbox !== null : true;
|
|
54
|
+
if (!visible && !includeHidden)
|
|
55
|
+
return null;
|
|
56
|
+
const match = {
|
|
57
|
+
ref: node.ref,
|
|
58
|
+
role: node.role,
|
|
59
|
+
text: node.name ?? "",
|
|
60
|
+
bbox,
|
|
61
|
+
clipped: !visible,
|
|
62
|
+
};
|
|
63
|
+
if (node.context)
|
|
64
|
+
match.context = node.context;
|
|
65
|
+
return match;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Pure-tree search: walk `root` and return nodes whose `name` matches `text`.
|
|
69
|
+
* Exported for unit testing.
|
|
70
|
+
*
|
|
71
|
+
* @param max hard cap on the *walked* candidate count (post-filter list is
|
|
72
|
+
* capped separately at the caller's `maxMatches`).
|
|
73
|
+
*/
|
|
74
|
+
export function searchTreeForText(root, text, exact, max = 200) {
|
|
75
|
+
const out = [];
|
|
76
|
+
const target = text;
|
|
77
|
+
const targetLower = text.toLowerCase();
|
|
78
|
+
for (const { node } of walk(root)) {
|
|
79
|
+
const name = (node.name ?? "").trim();
|
|
80
|
+
if (!name)
|
|
81
|
+
continue;
|
|
82
|
+
const hit = exact ? name === target : name.toLowerCase().includes(targetLower);
|
|
83
|
+
if (hit) {
|
|
84
|
+
out.push(node);
|
|
85
|
+
if (out.length >= max)
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Page } from "playwright-core";
|
|
2
|
+
import type { RefRegistry } from "./refs.js";
|
|
3
|
+
import { type ActionTarget } from "./locator.js";
|
|
4
|
+
export interface UploadArgs {
|
|
5
|
+
target: ActionTarget;
|
|
6
|
+
/** filename presented to the page (content-mode; default "upload"). */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** MIME type (content-mode; default "application/octet-stream"). */
|
|
9
|
+
mimeType?: string;
|
|
10
|
+
/** base64 file content. Mutually exclusive with `path`. */
|
|
11
|
+
content?: string;
|
|
12
|
+
/** workspace-rooted file path. Mutually exclusive with `content`. */
|
|
13
|
+
path?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface UploadResult {
|
|
16
|
+
ok: boolean;
|
|
17
|
+
mode: "content" | "path";
|
|
18
|
+
name: string;
|
|
19
|
+
/** byte size of the file that was set. */
|
|
20
|
+
bytes: number;
|
|
21
|
+
/** MIME type — set in content-mode (path-mode lets the browser infer). */
|
|
22
|
+
mimeType?: string;
|
|
23
|
+
/** short summary of the resolved input target (ref/selector). */
|
|
24
|
+
target: string;
|
|
25
|
+
/** number of files set on the input (always 1 today). */
|
|
26
|
+
fileCount: number;
|
|
27
|
+
}
|
|
28
|
+
export declare function uploadFile(page: Page, refs: RefRegistry, workspaceRoot: string, args: UploadArgs): Promise<UploadResult>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// `upload_file` — set files on a file `<input>`.
|
|
2
|
+
//
|
|
3
|
+
// Setting files on a file input is a common browser-test primitive that
|
|
4
|
+
// otherwise forces agents into injecting `File`/`DataTransfer` via `eval_js`
|
|
5
|
+
// (arbitrary JS). This drives Playwright's `locator.setInputFiles()` directly.
|
|
6
|
+
// Gated by the off-by-default `file-io` capability — the slot reserved for
|
|
7
|
+
// exactly this. Works on hidden inputs (Playwright handles `display:none`).
|
|
8
|
+
//
|
|
9
|
+
// Two file sources:
|
|
10
|
+
// - `content` — base64 inline; no filesystem read at all (preferred for
|
|
11
|
+
// agent-generated content).
|
|
12
|
+
// - `path` — resolved **inside `$BROWX_WORKSPACE` only**; a path escaping
|
|
13
|
+
// the workspace is rejected, keeping the no-trace / no-arbitrary-fs-read
|
|
14
|
+
// posture even with `file-io` enabled. Stage the file in the workspace.
|
|
15
|
+
import { resolve, sep } from "node:path";
|
|
16
|
+
import { statSync } from "node:fs";
|
|
17
|
+
import { locatorFor } from "./locator.js";
|
|
18
|
+
function targetSummary(t) {
|
|
19
|
+
if (t.ref)
|
|
20
|
+
return `ref ${t.ref}`;
|
|
21
|
+
if (t.selector)
|
|
22
|
+
return `selector ${t.selector}`;
|
|
23
|
+
return "(unknown)";
|
|
24
|
+
}
|
|
25
|
+
export async function uploadFile(page, refs, workspaceRoot, args) {
|
|
26
|
+
if (args.content !== undefined && args.path !== undefined) {
|
|
27
|
+
throw new Error("upload_file: pass exactly one of `content` (base64) or `path`");
|
|
28
|
+
}
|
|
29
|
+
if (args.content === undefined && args.path === undefined) {
|
|
30
|
+
throw new Error("upload_file: requires `content` (base64) or `path`");
|
|
31
|
+
}
|
|
32
|
+
const loc = locatorFor(page, refs, args.target);
|
|
33
|
+
const target = targetSummary(args.target);
|
|
34
|
+
if (args.content !== undefined) {
|
|
35
|
+
const name = args.name ?? "upload";
|
|
36
|
+
const mimeType = args.mimeType ?? "application/octet-stream";
|
|
37
|
+
const buffer = Buffer.from(args.content, "base64");
|
|
38
|
+
await loc.setInputFiles({ name, mimeType, buffer });
|
|
39
|
+
return {
|
|
40
|
+
ok: true,
|
|
41
|
+
mode: "content",
|
|
42
|
+
name,
|
|
43
|
+
bytes: buffer.length,
|
|
44
|
+
mimeType,
|
|
45
|
+
target,
|
|
46
|
+
fileCount: 1,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const resolved = resolve(workspaceRoot, args.path);
|
|
50
|
+
if (resolved !== workspaceRoot && !resolved.startsWith(workspaceRoot + sep)) {
|
|
51
|
+
throw new Error("upload_file: `path` must resolve inside $BROWX_WORKSPACE — stage the file there, or use `content` (base64)");
|
|
52
|
+
}
|
|
53
|
+
await loc.setInputFiles(resolved);
|
|
54
|
+
let bytes = 0;
|
|
55
|
+
try {
|
|
56
|
+
bytes = statSync(resolved).size;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
/* best-effort size */
|
|
60
|
+
}
|
|
61
|
+
return { ok: true, mode: "path", name: args.path, bytes, target, fileCount: 1 };
|
|
62
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Page, CDPSession } from "playwright-core";
|
|
2
|
+
import type { RefRegistry } from "./refs.js";
|
|
3
|
+
import { findByRef } from "./snapshot.js";
|
|
4
|
+
import { walk } from "./a11y.js";
|
|
5
|
+
import { visibleRect } from "./bbox.js";
|
|
6
|
+
import { type ActionTarget } from "./locator.js";
|
|
7
|
+
import { type Predicate } from "../util/predicates.js";
|
|
8
|
+
import type { FailureSource as FailureSourceBase } from "../util/failure.js";
|
|
9
|
+
export type FailureSource = Extract<FailureSourceBase, "app" | "browxai">;
|
|
10
|
+
export interface VerifyFailure {
|
|
11
|
+
/** `app` when the predicate didn't hold against the page's actual state;
|
|
12
|
+
* `browxai` when the verify itself couldn't run (ref no longer in the
|
|
13
|
+
* snapshot, selector matched nothing the helper could resolve, etc). */
|
|
14
|
+
source: FailureSource;
|
|
15
|
+
/** Stable kind label — `"visible"`, `"text-equals"`, `"value-equals"`,
|
|
16
|
+
* `"count-equals"`, `"attribute-equals"`, predicate kind for `verify_predicate`. */
|
|
17
|
+
kind: string;
|
|
18
|
+
/** Human-readable description of what should have held. */
|
|
19
|
+
expected: string;
|
|
20
|
+
/** What we actually saw — the value/state that didn't match. */
|
|
21
|
+
actual: unknown;
|
|
22
|
+
/** Optional supporting context (matched-text fragment, the ref's role,
|
|
23
|
+
* a count breakdown). Kept small so the result fits the token budget. */
|
|
24
|
+
evidence?: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
export interface VerifyResult {
|
|
27
|
+
ok: boolean;
|
|
28
|
+
failure?: VerifyFailure;
|
|
29
|
+
}
|
|
30
|
+
/** Verify that the targeted element is visible (non-zero box, not
|
|
31
|
+
* display:none/visibility:hidden, opacity > 0). `source:"app"` on miss. */
|
|
32
|
+
export declare function verifyVisible(page: Page, refs: RefRegistry, target: ActionTarget): Promise<VerifyResult>;
|
|
33
|
+
/** Verify that the targeted element's visible text matches. `exact:true` →
|
|
34
|
+
* case-sensitive equality on the trimmed innerText. Default → case-insensitive
|
|
35
|
+
* substring. `source:"app"` on miss. */
|
|
36
|
+
export declare function verifyText(page: Page, refs: RefRegistry, target: ActionTarget, text: string, exact: boolean): Promise<VerifyResult>;
|
|
37
|
+
/** Verify that the targeted input/textarea/contenteditable carries the given
|
|
38
|
+
* value (strict equality after a defensive `String()`). `source:"app"` on
|
|
39
|
+
* miss. */
|
|
40
|
+
export declare function verifyValue(page: Page, refs: RefRegistry, target: ActionTarget, value: string): Promise<VerifyResult>;
|
|
41
|
+
/** Verify that exactly `n` elements match the given selector (or visible-text
|
|
42
|
+
* search). One of `selector` or `text` is required. `source:"app"` on miss. */
|
|
43
|
+
export declare function verifyCount(page: Page, cdp: CDPSession, refs: RefRegistry, opts: {
|
|
44
|
+
selector?: string;
|
|
45
|
+
text?: string;
|
|
46
|
+
n: number;
|
|
47
|
+
testAttributes: string[];
|
|
48
|
+
}): Promise<VerifyResult>;
|
|
49
|
+
/** Verify that the targeted element's `attr` attribute equals `value`. When
|
|
50
|
+
* `value` is undefined, this asserts the attribute is present (any value).
|
|
51
|
+
* `source:"app"` on miss. */
|
|
52
|
+
export declare function verifyAttribute(page: Page, refs: RefRegistry, target: ActionTarget, attr: string, value: string | undefined): Promise<VerifyResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Evaluate a fixed-vocabulary `Predicate` against caller-supplied data
|
|
55
|
+
* (typically an `ActionResult` + optional companion `snapshot` / `evidence`).
|
|
56
|
+
*
|
|
57
|
+
* NOT arbitrary JS: the engine accepts only `kind` values from the
|
|
58
|
+
* `Predicate` enum and `key` accessor strings starting with an allow-listed
|
|
59
|
+
* root segment. Adopters supply *data* (which key, which expected value);
|
|
60
|
+
* the *vocabulary* is owned server-side. See `src/util/predicates.ts`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function verifyPredicate(predicate: Predicate, data: unknown): VerifyResult;
|
|
63
|
+
export { findByRef, walk, visibleRect };
|