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,215 @@
|
|
|
1
|
+
import type { BrowserContext, Page } from "playwright-core";
|
|
2
|
+
import type { SafariSessionHandle } from "../engine/index.js";
|
|
3
|
+
import type { CookieInput, WebStorageKind } from "../session/storage.js";
|
|
4
|
+
import type { ListedCookie, CookiesListRequest, WebStorageEntry, IdbDatabasesResult, IdbStoresResult, IdbGetResult, IdbWriteResult, IdbClearResult, CachesListStoragesResult, CachesListResult, CachesGetResult, CachesPutResult, CachesDeleteResult, CachesClearResult, CachesDeleteStorageResult, StorageSubstrate } from "./storage-substrate-types.js";
|
|
5
|
+
export type { ListedCookie, SafariListedCookie, CookiesListRequest, WebStorageEntry, IdbDatabasesResult, IdbStoresResult, IdbGetResult, IdbWriteResult, IdbClearResult, CachesListStoragesResult, CachesListResult, CachesGetResult, CachesPutResult, CachesDeleteResult, CachesClearResult, CachesDeleteStorageResult, StorageSubstrate, } from "./storage-substrate-types.js";
|
|
6
|
+
/** Playwright engines — delegates cookie ops to the existing `cookiesList` /
|
|
7
|
+
* `cookiesSet` over the session's BrowserContext (the `context` thunk captures the
|
|
8
|
+
* session entry, the same per-call access the handlers did before this seam), and
|
|
9
|
+
* the web-storage ops to the existing `webStorage*` helpers over the session's Page
|
|
10
|
+
* (the `page` thunk, likewise). No behaviour change. */
|
|
11
|
+
export declare class PlaywrightStorageSubstrate implements StorageSubstrate {
|
|
12
|
+
private readonly context;
|
|
13
|
+
private readonly page;
|
|
14
|
+
readonly engine: string;
|
|
15
|
+
constructor(context: () => BrowserContext, page: () => Page, engine?: string);
|
|
16
|
+
cookiesList(req: CookiesListRequest): Promise<ListedCookie[]>;
|
|
17
|
+
cookiesSet(req: CookieInput): Promise<{
|
|
18
|
+
ok: boolean;
|
|
19
|
+
name: string;
|
|
20
|
+
}>;
|
|
21
|
+
webStorageGet(kind: WebStorageKind, args: {
|
|
22
|
+
key: string;
|
|
23
|
+
}, tool: string): Promise<{
|
|
24
|
+
value: string | null;
|
|
25
|
+
origin: string;
|
|
26
|
+
}>;
|
|
27
|
+
webStorageList(kind: WebStorageKind, tool: string): Promise<{
|
|
28
|
+
entries: WebStorageEntry[];
|
|
29
|
+
origin: string;
|
|
30
|
+
}>;
|
|
31
|
+
webStorageSet(kind: WebStorageKind, args: {
|
|
32
|
+
key: string;
|
|
33
|
+
value: string;
|
|
34
|
+
}, tool: string): Promise<{
|
|
35
|
+
ok: true;
|
|
36
|
+
origin: string;
|
|
37
|
+
}>;
|
|
38
|
+
webStorageDelete(kind: WebStorageKind, args: {
|
|
39
|
+
key: string;
|
|
40
|
+
}, tool: string): Promise<{
|
|
41
|
+
ok: true;
|
|
42
|
+
origin: string;
|
|
43
|
+
}>;
|
|
44
|
+
webStorageClear(kind: WebStorageKind, tool: string): Promise<{
|
|
45
|
+
ok: true;
|
|
46
|
+
origin: string;
|
|
47
|
+
}>;
|
|
48
|
+
idbListDatabases(tool: string): Promise<IdbDatabasesResult>;
|
|
49
|
+
idbListStores(args: {
|
|
50
|
+
dbName: string;
|
|
51
|
+
}, tool: string): Promise<IdbStoresResult>;
|
|
52
|
+
idbGet(args: {
|
|
53
|
+
dbName: string;
|
|
54
|
+
storeName: string;
|
|
55
|
+
key: unknown;
|
|
56
|
+
}, tool: string): Promise<IdbGetResult>;
|
|
57
|
+
idbPut(args: {
|
|
58
|
+
dbName: string;
|
|
59
|
+
storeName: string;
|
|
60
|
+
key: unknown;
|
|
61
|
+
value: unknown;
|
|
62
|
+
}, tool: string): Promise<IdbWriteResult>;
|
|
63
|
+
idbDelete(args: {
|
|
64
|
+
dbName: string;
|
|
65
|
+
storeName: string;
|
|
66
|
+
key: unknown;
|
|
67
|
+
}, tool: string): Promise<IdbWriteResult>;
|
|
68
|
+
idbClear(args: {
|
|
69
|
+
dbName: string;
|
|
70
|
+
storeName: string;
|
|
71
|
+
}, tool: string): Promise<IdbClearResult>;
|
|
72
|
+
cachesListStorages(tool: string): Promise<CachesListStoragesResult>;
|
|
73
|
+
cachesList(args: {
|
|
74
|
+
cacheName: string;
|
|
75
|
+
urlPattern?: string;
|
|
76
|
+
}, tool: string): Promise<CachesListResult>;
|
|
77
|
+
cachesGet(args: {
|
|
78
|
+
cacheName: string;
|
|
79
|
+
url: string;
|
|
80
|
+
}, tool: string): Promise<CachesGetResult>;
|
|
81
|
+
cachesPut(args: {
|
|
82
|
+
cacheName: string;
|
|
83
|
+
url: string;
|
|
84
|
+
response: {
|
|
85
|
+
status?: number;
|
|
86
|
+
headers?: Record<string, string>;
|
|
87
|
+
body?: string;
|
|
88
|
+
contentBase64?: string;
|
|
89
|
+
};
|
|
90
|
+
}, tool: string): Promise<CachesPutResult>;
|
|
91
|
+
cachesDelete(args: {
|
|
92
|
+
cacheName: string;
|
|
93
|
+
url: string;
|
|
94
|
+
}, tool: string): Promise<CachesDeleteResult>;
|
|
95
|
+
cachesClear(args: {
|
|
96
|
+
cacheName: string;
|
|
97
|
+
}, tool: string): Promise<CachesClearResult>;
|
|
98
|
+
cachesDeleteStorage(args: {
|
|
99
|
+
cacheName: string;
|
|
100
|
+
}, tool: string): Promise<CachesDeleteStorageResult>;
|
|
101
|
+
}
|
|
102
|
+
/** Safari — the WebDriver-Classic storage path. Cookies ride the Classic cookie
|
|
103
|
+
* endpoints; web-storage rides `execute/sync`, which runs page-context JS just like
|
|
104
|
+
* Playwright's `page.evaluate` (the ScriptSubstrate proves the seam). safaridriver
|
|
105
|
+
* returns the cookie jar for the current document; the Playwright `urls`
|
|
106
|
+
* cross-domain filter is not available over WebDriver, so it is inert here.
|
|
107
|
+
* `cookiesSet` scopes to the current document's domain — derived from `url` when
|
|
108
|
+
* given (else the explicit `domain`); the session must already be navigated to that
|
|
109
|
+
* domain. The web-storage methods run the SAME page-side IIFE the Playwright helper
|
|
110
|
+
* evaluates, wrapped in `return (…)` (an expression, not a statement body) the way
|
|
111
|
+
* `execute/sync` expects — the validation + origin guard mirror the helper so the
|
|
112
|
+
* error envelopes match. Web-storage is page-side JS, so safaridriver runs it the
|
|
113
|
+
* same way: on the no-Playwright-Page Safari engine this is a NEW working
|
|
114
|
+
* capability (the handler previously had no Safari path and threw), surfaced
|
|
115
|
+
* through the same port so the handler stays engine-blind. IndexedDB and the
|
|
116
|
+
* Cache API are the exception: both APIs are promise-based, so the page-side script
|
|
117
|
+
* is an ASYNC IIFE that must be awaited — but safaridriver's `execute/sync` returns
|
|
118
|
+
* the moment the body returns and never observes the settled promise, and there is
|
|
119
|
+
* no async-script client on this handle. So every idb and caches method REFUSES
|
|
120
|
+
* cleanly in the adapter — rejecting with a structured Error the handler's
|
|
121
|
+
* `errText` renders (the pre-seam handlers threw at `page()`, so a reject keeps
|
|
122
|
+
* that contract) — rather than running a script whose result would always be a
|
|
123
|
+
* pending promise. */
|
|
124
|
+
export declare class SafariStorageSubstrate implements StorageSubstrate {
|
|
125
|
+
private readonly handle;
|
|
126
|
+
readonly engine = "safari";
|
|
127
|
+
constructor(handle: SafariSessionHandle);
|
|
128
|
+
cookiesList(_req: CookiesListRequest): Promise<ListedCookie[]>;
|
|
129
|
+
cookiesSet(req: CookieInput): Promise<{
|
|
130
|
+
ok: boolean;
|
|
131
|
+
name: string;
|
|
132
|
+
}>;
|
|
133
|
+
webStorageGet(kind: WebStorageKind, args: {
|
|
134
|
+
key: string;
|
|
135
|
+
}, tool: string): Promise<{
|
|
136
|
+
value: string | null;
|
|
137
|
+
origin: string;
|
|
138
|
+
}>;
|
|
139
|
+
webStorageList(kind: WebStorageKind, tool: string): Promise<{
|
|
140
|
+
entries: WebStorageEntry[];
|
|
141
|
+
origin: string;
|
|
142
|
+
}>;
|
|
143
|
+
webStorageSet(kind: WebStorageKind, args: {
|
|
144
|
+
key: string;
|
|
145
|
+
value: string;
|
|
146
|
+
}, tool: string): Promise<{
|
|
147
|
+
ok: true;
|
|
148
|
+
origin: string;
|
|
149
|
+
}>;
|
|
150
|
+
webStorageDelete(kind: WebStorageKind, args: {
|
|
151
|
+
key: string;
|
|
152
|
+
}, tool: string): Promise<{
|
|
153
|
+
ok: true;
|
|
154
|
+
origin: string;
|
|
155
|
+
}>;
|
|
156
|
+
webStorageClear(kind: WebStorageKind, tool: string): Promise<{
|
|
157
|
+
ok: true;
|
|
158
|
+
origin: string;
|
|
159
|
+
}>;
|
|
160
|
+
idbListDatabases(tool: string): Promise<IdbDatabasesResult>;
|
|
161
|
+
idbListStores(_args: {
|
|
162
|
+
dbName: string;
|
|
163
|
+
}, tool: string): Promise<IdbStoresResult>;
|
|
164
|
+
idbGet(_args: {
|
|
165
|
+
dbName: string;
|
|
166
|
+
storeName: string;
|
|
167
|
+
key: unknown;
|
|
168
|
+
}, tool: string): Promise<IdbGetResult>;
|
|
169
|
+
idbPut(_args: {
|
|
170
|
+
dbName: string;
|
|
171
|
+
storeName: string;
|
|
172
|
+
key: unknown;
|
|
173
|
+
value: unknown;
|
|
174
|
+
}, tool: string): Promise<IdbWriteResult>;
|
|
175
|
+
idbDelete(_args: {
|
|
176
|
+
dbName: string;
|
|
177
|
+
storeName: string;
|
|
178
|
+
key: unknown;
|
|
179
|
+
}, tool: string): Promise<IdbWriteResult>;
|
|
180
|
+
idbClear(_args: {
|
|
181
|
+
dbName: string;
|
|
182
|
+
storeName: string;
|
|
183
|
+
}, tool: string): Promise<IdbClearResult>;
|
|
184
|
+
cachesListStorages(tool: string): Promise<CachesListStoragesResult>;
|
|
185
|
+
cachesList(_args: {
|
|
186
|
+
cacheName: string;
|
|
187
|
+
urlPattern?: string;
|
|
188
|
+
}, tool: string): Promise<CachesListResult>;
|
|
189
|
+
cachesGet(_args: {
|
|
190
|
+
cacheName: string;
|
|
191
|
+
url: string;
|
|
192
|
+
}, tool: string): Promise<CachesGetResult>;
|
|
193
|
+
cachesPut(_args: {
|
|
194
|
+
cacheName: string;
|
|
195
|
+
url: string;
|
|
196
|
+
response: {
|
|
197
|
+
status?: number;
|
|
198
|
+
headers?: Record<string, string>;
|
|
199
|
+
body?: string;
|
|
200
|
+
contentBase64?: string;
|
|
201
|
+
};
|
|
202
|
+
}, tool: string): Promise<CachesPutResult>;
|
|
203
|
+
cachesDelete(_args: {
|
|
204
|
+
cacheName: string;
|
|
205
|
+
url: string;
|
|
206
|
+
}, tool: string): Promise<CachesDeleteResult>;
|
|
207
|
+
cachesClear(_args: {
|
|
208
|
+
cacheName: string;
|
|
209
|
+
}, tool: string): Promise<CachesClearResult>;
|
|
210
|
+
cachesDeleteStorage(_args: {
|
|
211
|
+
cacheName: string;
|
|
212
|
+
}, tool: string): Promise<CachesDeleteStorageResult>;
|
|
213
|
+
private idbRefuse;
|
|
214
|
+
private cachesRefuse;
|
|
215
|
+
}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
// The StorageSubstrate interface — the engine-agnostic seam beneath the storage
|
|
2
|
+
// tools (cookies + localStorage/sessionStorage + IndexedDB + Cache API CRUD). It is
|
|
3
|
+
// the storage side of the engine-agnostic port layer: a tool handler asks a substrate
|
|
4
|
+
// to read or write the cookie jar, web-storage, an IndexedDB store, or the Cache API and gets back a
|
|
5
|
+
// universal result; an engine-specific implementation does the work. The handler
|
|
6
|
+
// never names Playwright, safaridriver, or an engine — it calls
|
|
7
|
+
// `storageFor(e).cookiesList(req)` / `storageFor(e).webStorageGet(kind, req)` /
|
|
8
|
+
// `storageFor(e).idbGet(args, tool)` / `storageFor(e).cachesList(args, tool)`, the
|
|
9
|
+
// same shape as `actionsFor(e).click(args)` / `captureFor(e).screenshot(req)`.
|
|
10
|
+
//
|
|
11
|
+
// Dependency direction (architecture doctrine §1): tool handler → StorageSubstrate
|
|
12
|
+
// (this interface) → implementation → Playwright BrowserContext/Page | safaridriver.
|
|
13
|
+
// Two impls today:
|
|
14
|
+
// - PlaywrightStorageSubstrate (chromium / firefox / webkit / android): wraps the
|
|
15
|
+
// existing `cookiesList` / `cookiesSet` over a Playwright BrowserContext and the
|
|
16
|
+
// existing `webStorage*` / `idb*` helpers over a Playwright Page — byte-identical
|
|
17
|
+
// to the pre-seam path, so the four engines' keystones stay green unchanged. The
|
|
18
|
+
// native `urls` cross-domain filter is honoured.
|
|
19
|
+
// - SafariStorageSubstrate (safari): wraps the WebDriver Classic cookie endpoints
|
|
20
|
+
// (`getCookies` / `addCookie`; no Playwright BrowserContext) and the WebDriver
|
|
21
|
+
// `execute/sync` endpoint for web-storage (page-side JS, which safaridriver CAN
|
|
22
|
+
// run — the same `return (…)` expression wrapping the ScriptSubstrate uses). For
|
|
23
|
+
// cookies, safaridriver scopes the jar to the current document, so the `urls`
|
|
24
|
+
// filter is inert (the WebDriver protocol has no cross-domain cookie filter) and
|
|
25
|
+
// `cookies_set` derives the domain from `url` exactly as the pre-seam Safari
|
|
26
|
+
// branch did. For web-storage the origin guard reads `currentUrl()` — the Classic
|
|
27
|
+
// substitute for the Playwright `page.url()` the helper guards on. The gating
|
|
28
|
+
// lives here, not as an `if (e.session.safari?.())` branch in the handler.
|
|
29
|
+
import { cookiesList, cookiesSet, webStorageGet, webStorageSet, webStorageList, webStorageDelete, webStorageClear, } from "../session/storage.js";
|
|
30
|
+
import { idbListDatabases, idbListStores, idbGet, idbPut, idbDelete, idbClear, } from "../session/idb-storage.js";
|
|
31
|
+
import { cachesListStorages, cachesList, cachesGet, cachesPut, cachesDelete, cachesClear, cachesDeleteStorage, } from "../session/cache-storage.js";
|
|
32
|
+
/** Playwright engines — delegates cookie ops to the existing `cookiesList` /
|
|
33
|
+
* `cookiesSet` over the session's BrowserContext (the `context` thunk captures the
|
|
34
|
+
* session entry, the same per-call access the handlers did before this seam), and
|
|
35
|
+
* the web-storage ops to the existing `webStorage*` helpers over the session's Page
|
|
36
|
+
* (the `page` thunk, likewise). No behaviour change. */
|
|
37
|
+
export class PlaywrightStorageSubstrate {
|
|
38
|
+
context;
|
|
39
|
+
page;
|
|
40
|
+
engine;
|
|
41
|
+
constructor(context, page, engine = "chromium") {
|
|
42
|
+
this.context = context;
|
|
43
|
+
this.page = page;
|
|
44
|
+
this.engine = engine;
|
|
45
|
+
}
|
|
46
|
+
async cookiesList(req) {
|
|
47
|
+
return cookiesList(this.context(), { urls: req.urls });
|
|
48
|
+
}
|
|
49
|
+
async cookiesSet(req) {
|
|
50
|
+
const r = await cookiesSet(this.context(), req);
|
|
51
|
+
return { ok: r.ok, name: req.name };
|
|
52
|
+
}
|
|
53
|
+
webStorageGet(kind, args, tool) {
|
|
54
|
+
return webStorageGet(this.page(), kind, args, tool);
|
|
55
|
+
}
|
|
56
|
+
webStorageList(kind, tool) {
|
|
57
|
+
return webStorageList(this.page(), kind, tool);
|
|
58
|
+
}
|
|
59
|
+
webStorageSet(kind, args, tool) {
|
|
60
|
+
return webStorageSet(this.page(), kind, args, tool);
|
|
61
|
+
}
|
|
62
|
+
webStorageDelete(kind, args, tool) {
|
|
63
|
+
return webStorageDelete(this.page(), kind, args, tool);
|
|
64
|
+
}
|
|
65
|
+
webStorageClear(kind, tool) {
|
|
66
|
+
return webStorageClear(this.page(), kind, tool);
|
|
67
|
+
}
|
|
68
|
+
idbListDatabases(tool) {
|
|
69
|
+
return idbListDatabases(this.page(), tool);
|
|
70
|
+
}
|
|
71
|
+
idbListStores(args, tool) {
|
|
72
|
+
return idbListStores(this.page(), args, tool);
|
|
73
|
+
}
|
|
74
|
+
idbGet(args, tool) {
|
|
75
|
+
return idbGet(this.page(), args, tool);
|
|
76
|
+
}
|
|
77
|
+
idbPut(args, tool) {
|
|
78
|
+
return idbPut(this.page(), args, tool);
|
|
79
|
+
}
|
|
80
|
+
idbDelete(args, tool) {
|
|
81
|
+
return idbDelete(this.page(), args, tool);
|
|
82
|
+
}
|
|
83
|
+
idbClear(args, tool) {
|
|
84
|
+
return idbClear(this.page(), args, tool);
|
|
85
|
+
}
|
|
86
|
+
cachesListStorages(tool) {
|
|
87
|
+
return cachesListStorages(this.page(), tool);
|
|
88
|
+
}
|
|
89
|
+
cachesList(args, tool) {
|
|
90
|
+
return cachesList(this.page(), args, tool);
|
|
91
|
+
}
|
|
92
|
+
cachesGet(args, tool) {
|
|
93
|
+
return cachesGet(this.page(), args, tool);
|
|
94
|
+
}
|
|
95
|
+
cachesPut(args, tool) {
|
|
96
|
+
return cachesPut(this.page(), args, tool);
|
|
97
|
+
}
|
|
98
|
+
cachesDelete(args, tool) {
|
|
99
|
+
return cachesDelete(this.page(), args, tool);
|
|
100
|
+
}
|
|
101
|
+
cachesClear(args, tool) {
|
|
102
|
+
return cachesClear(this.page(), args, tool);
|
|
103
|
+
}
|
|
104
|
+
cachesDeleteStorage(args, tool) {
|
|
105
|
+
return cachesDeleteStorage(this.page(), args, tool);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** Web-storage is origin-scoped and page-bound — the page MUST be at the target
|
|
109
|
+
* origin first. On Safari the Classic substitute for `page.url()` is
|
|
110
|
+
* `currentUrl()`; this guard reframes about:blank / unreachable into the same
|
|
111
|
+
* navigation hint the Playwright helper throws, so the refusal reads identically
|
|
112
|
+
* on every engine. */
|
|
113
|
+
async function safariWebStorageGuard(handle, kind, tool) {
|
|
114
|
+
let url;
|
|
115
|
+
try {
|
|
116
|
+
url = await handle.webDriver.currentUrl(handle.sessionId);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
url = "";
|
|
120
|
+
}
|
|
121
|
+
if (!url || url === "about:blank") {
|
|
122
|
+
throw new Error(`${tool}: ${kind} is origin-scoped and the page is at "${url || "(unknown)"}". ` +
|
|
123
|
+
`Navigate the session to the target origin first.`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** Safari — the WebDriver-Classic storage path. Cookies ride the Classic cookie
|
|
127
|
+
* endpoints; web-storage rides `execute/sync`, which runs page-context JS just like
|
|
128
|
+
* Playwright's `page.evaluate` (the ScriptSubstrate proves the seam). safaridriver
|
|
129
|
+
* returns the cookie jar for the current document; the Playwright `urls`
|
|
130
|
+
* cross-domain filter is not available over WebDriver, so it is inert here.
|
|
131
|
+
* `cookiesSet` scopes to the current document's domain — derived from `url` when
|
|
132
|
+
* given (else the explicit `domain`); the session must already be navigated to that
|
|
133
|
+
* domain. The web-storage methods run the SAME page-side IIFE the Playwright helper
|
|
134
|
+
* evaluates, wrapped in `return (…)` (an expression, not a statement body) the way
|
|
135
|
+
* `execute/sync` expects — the validation + origin guard mirror the helper so the
|
|
136
|
+
* error envelopes match. Web-storage is page-side JS, so safaridriver runs it the
|
|
137
|
+
* same way: on the no-Playwright-Page Safari engine this is a NEW working
|
|
138
|
+
* capability (the handler previously had no Safari path and threw), surfaced
|
|
139
|
+
* through the same port so the handler stays engine-blind. IndexedDB and the
|
|
140
|
+
* Cache API are the exception: both APIs are promise-based, so the page-side script
|
|
141
|
+
* is an ASYNC IIFE that must be awaited — but safaridriver's `execute/sync` returns
|
|
142
|
+
* the moment the body returns and never observes the settled promise, and there is
|
|
143
|
+
* no async-script client on this handle. So every idb and caches method REFUSES
|
|
144
|
+
* cleanly in the adapter — rejecting with a structured Error the handler's
|
|
145
|
+
* `errText` renders (the pre-seam handlers threw at `page()`, so a reject keeps
|
|
146
|
+
* that contract) — rather than running a script whose result would always be a
|
|
147
|
+
* pending promise. */
|
|
148
|
+
export class SafariStorageSubstrate {
|
|
149
|
+
handle;
|
|
150
|
+
engine = "safari";
|
|
151
|
+
constructor(handle) {
|
|
152
|
+
this.handle = handle;
|
|
153
|
+
}
|
|
154
|
+
async cookiesList(_req) {
|
|
155
|
+
return this.handle.webDriver.getCookies(this.handle.sessionId);
|
|
156
|
+
}
|
|
157
|
+
async cookiesSet(req) {
|
|
158
|
+
let derivedDomain = req.domain;
|
|
159
|
+
if (!derivedDomain && req.url) {
|
|
160
|
+
try {
|
|
161
|
+
derivedDomain = new URL(req.url).hostname;
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
derivedDomain = undefined;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
await this.handle.webDriver.addCookie(this.handle.sessionId, {
|
|
168
|
+
name: req.name,
|
|
169
|
+
value: req.value,
|
|
170
|
+
path: req.path ?? "/",
|
|
171
|
+
...(derivedDomain ? { domain: derivedDomain } : {}),
|
|
172
|
+
...(typeof req.expires === "number" ? { expiry: Math.floor(req.expires) } : {}),
|
|
173
|
+
...(req.httpOnly !== undefined ? { httpOnly: req.httpOnly } : {}),
|
|
174
|
+
...(req.secure !== undefined ? { secure: req.secure } : {}),
|
|
175
|
+
...(req.sameSite ? { sameSite: req.sameSite } : {}),
|
|
176
|
+
});
|
|
177
|
+
return { ok: true, name: req.name };
|
|
178
|
+
}
|
|
179
|
+
async webStorageGet(kind, args, tool) {
|
|
180
|
+
if (!args.key)
|
|
181
|
+
throw new Error(`${tool}: \`key\` is required`);
|
|
182
|
+
await safariWebStorageGuard(this.handle, kind, tool);
|
|
183
|
+
const expr = `(() => { var s = window.${kind}; ` +
|
|
184
|
+
`return { value: s.getItem(${JSON.stringify(args.key)}), origin: window.location.origin }; })()`;
|
|
185
|
+
return (await this.handle.webDriver.executeScript(this.handle.sessionId, `return (${expr});`));
|
|
186
|
+
}
|
|
187
|
+
async webStorageList(kind, tool) {
|
|
188
|
+
await safariWebStorageGuard(this.handle, kind, tool);
|
|
189
|
+
const expr = `(() => { var s = window.${kind}; var out = []; ` +
|
|
190
|
+
`for (var i = 0; i < s.length; i++) { var k = s.key(i); if (k === null) continue; ` +
|
|
191
|
+
`out.push({ key: k, value: s.getItem(k) || "" }); } ` +
|
|
192
|
+
`return { entries: out, origin: window.location.origin }; })()`;
|
|
193
|
+
return (await this.handle.webDriver.executeScript(this.handle.sessionId, `return (${expr});`));
|
|
194
|
+
}
|
|
195
|
+
async webStorageSet(kind, args, tool) {
|
|
196
|
+
if (!args.key)
|
|
197
|
+
throw new Error(`${tool}: \`key\` is required`);
|
|
198
|
+
if (typeof args.value !== "string")
|
|
199
|
+
throw new Error(`${tool}: \`value\` (string) is required`);
|
|
200
|
+
await safariWebStorageGuard(this.handle, kind, tool);
|
|
201
|
+
const expr = `(() => { var s = window.${kind}; ` +
|
|
202
|
+
`s.setItem(${JSON.stringify(args.key)}, ${JSON.stringify(args.value)}); ` +
|
|
203
|
+
`return { ok: true, origin: window.location.origin }; })()`;
|
|
204
|
+
return (await this.handle.webDriver.executeScript(this.handle.sessionId, `return (${expr});`));
|
|
205
|
+
}
|
|
206
|
+
async webStorageDelete(kind, args, tool) {
|
|
207
|
+
if (!args.key)
|
|
208
|
+
throw new Error(`${tool}: \`key\` is required`);
|
|
209
|
+
await safariWebStorageGuard(this.handle, kind, tool);
|
|
210
|
+
const expr = `(() => { var s = window.${kind}; s.removeItem(${JSON.stringify(args.key)}); ` +
|
|
211
|
+
`return { ok: true, origin: window.location.origin }; })()`;
|
|
212
|
+
return (await this.handle.webDriver.executeScript(this.handle.sessionId, `return (${expr});`));
|
|
213
|
+
}
|
|
214
|
+
async webStorageClear(kind, tool) {
|
|
215
|
+
await safariWebStorageGuard(this.handle, kind, tool);
|
|
216
|
+
const expr = `(() => { var s = window.${kind}; s.clear(); ` +
|
|
217
|
+
`return { ok: true, origin: window.location.origin }; })()`;
|
|
218
|
+
return (await this.handle.webDriver.executeScript(this.handle.sessionId, `return (${expr});`));
|
|
219
|
+
}
|
|
220
|
+
idbListDatabases(tool) {
|
|
221
|
+
return Promise.reject(this.idbRefuse(tool));
|
|
222
|
+
}
|
|
223
|
+
idbListStores(_args, tool) {
|
|
224
|
+
return Promise.reject(this.idbRefuse(tool));
|
|
225
|
+
}
|
|
226
|
+
idbGet(_args, tool) {
|
|
227
|
+
return Promise.reject(this.idbRefuse(tool));
|
|
228
|
+
}
|
|
229
|
+
idbPut(_args, tool) {
|
|
230
|
+
return Promise.reject(this.idbRefuse(tool));
|
|
231
|
+
}
|
|
232
|
+
idbDelete(_args, tool) {
|
|
233
|
+
return Promise.reject(this.idbRefuse(tool));
|
|
234
|
+
}
|
|
235
|
+
idbClear(_args, tool) {
|
|
236
|
+
return Promise.reject(this.idbRefuse(tool));
|
|
237
|
+
}
|
|
238
|
+
cachesListStorages(tool) {
|
|
239
|
+
return Promise.reject(this.cachesRefuse(tool));
|
|
240
|
+
}
|
|
241
|
+
cachesList(_args, tool) {
|
|
242
|
+
return Promise.reject(this.cachesRefuse(tool));
|
|
243
|
+
}
|
|
244
|
+
cachesGet(_args, tool) {
|
|
245
|
+
return Promise.reject(this.cachesRefuse(tool));
|
|
246
|
+
}
|
|
247
|
+
cachesPut(_args, tool) {
|
|
248
|
+
return Promise.reject(this.cachesRefuse(tool));
|
|
249
|
+
}
|
|
250
|
+
cachesDelete(_args, tool) {
|
|
251
|
+
return Promise.reject(this.cachesRefuse(tool));
|
|
252
|
+
}
|
|
253
|
+
cachesClear(_args, tool) {
|
|
254
|
+
return Promise.reject(this.cachesRefuse(tool));
|
|
255
|
+
}
|
|
256
|
+
cachesDeleteStorage(_args, tool) {
|
|
257
|
+
return Promise.reject(this.cachesRefuse(tool));
|
|
258
|
+
}
|
|
259
|
+
// IndexedDB's API is promise-based, so its page-side script is an async IIFE that
|
|
260
|
+
// must be awaited — but safaridriver's `execute/sync` returns the moment the body
|
|
261
|
+
// returns, never observing the settled promise, and this handle has no
|
|
262
|
+
// async-script client. Rather than run a script whose result is always a pending
|
|
263
|
+
// promise, every idb method refuses cleanly here by rejecting with this Error
|
|
264
|
+
// (the handler's `errText` renders it — the pre-seam handlers threw at `page()`,
|
|
265
|
+
// so a reject preserves that contract), keeping the engine check out of the handler.
|
|
266
|
+
idbRefuse(tool) {
|
|
267
|
+
return new Error(`\`${tool}\`: IndexedDB is not available on the Safari engine — its promise-based API ` +
|
|
268
|
+
`needs an async page-script path that safaridriver's synchronous execute/sync cannot provide. ` +
|
|
269
|
+
`Use a chromium, firefox, or webkit session for IndexedDB.`);
|
|
270
|
+
}
|
|
271
|
+
// The Cache API is promise-based exactly like IndexedDB — its page-side script is
|
|
272
|
+
// an async IIFE that safaridriver's synchronous execute/sync cannot await, and this
|
|
273
|
+
// handle has no async-script client. Same clean in-adapter refusal, keeping the
|
|
274
|
+
// engine check out of the handler.
|
|
275
|
+
cachesRefuse(tool) {
|
|
276
|
+
return new Error(`\`${tool}\`: the Cache API is not available on the Safari engine — its promise-based API ` +
|
|
277
|
+
`needs an async page-script path that safaridriver's synchronous execute/sync cannot provide. ` +
|
|
278
|
+
`Use a chromium, firefox, or webkit session for the Cache API.`);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type A11yNode } from "./a11y.js";
|
|
2
|
+
/**
|
|
3
|
+
* Walk the tree once and tag each descendant of a recognised repeated
|
|
4
|
+
* container with its structural context. Mutates nodes in place.
|
|
5
|
+
*
|
|
6
|
+
* Idempotent — re-running on the same tree produces the same annotations
|
|
7
|
+
* (each node's `context` is overwritten with the freshly computed value).
|
|
8
|
+
*/
|
|
9
|
+
export declare function annotateStructuralContext(tree: A11yNode): void;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Structural-context detector.
|
|
2
|
+
//
|
|
3
|
+
// Annotates A11yNode entries with `context: { collection, rowKey, column,
|
|
4
|
+
// rowText }` when they live inside a recognised repeated layout (semantic
|
|
5
|
+
// table/grid, list, feed). Detection is driven by ARIA roles — generic across
|
|
6
|
+
// any web app, no per-target heuristics.
|
|
7
|
+
//
|
|
8
|
+
// Detection precedence (per node):
|
|
9
|
+
// 1. ancestor chain contains `role=row` → row context, column from header alignment
|
|
10
|
+
// 2. ancestor chain contains `role=listitem` → list context
|
|
11
|
+
// 3. ancestor chain contains `role=article` whose siblings are also `role=article`
|
|
12
|
+
// → feed/card context
|
|
13
|
+
// Otherwise: no annotation (the field stays undefined).
|
|
14
|
+
import { walk } from "./a11y.js";
|
|
15
|
+
const COLLECTION_ROLES = new Set(["table", "grid", "treegrid", "rowgroup", "list", "feed"]);
|
|
16
|
+
const ROW_ROLE = "row";
|
|
17
|
+
const CELL_ROLES = new Set(["cell", "gridcell", "rowheader"]);
|
|
18
|
+
/**
|
|
19
|
+
* Walk the tree once and tag each descendant of a recognised repeated
|
|
20
|
+
* container with its structural context. Mutates nodes in place.
|
|
21
|
+
*
|
|
22
|
+
* Idempotent — re-running on the same tree produces the same annotations
|
|
23
|
+
* (each node's `context` is overwritten with the freshly computed value).
|
|
24
|
+
*/
|
|
25
|
+
export function annotateStructuralContext(tree) {
|
|
26
|
+
const parents = new Map();
|
|
27
|
+
const ancestors = new Map();
|
|
28
|
+
ancestors.set(tree, []);
|
|
29
|
+
for (const { node } of walk(tree)) {
|
|
30
|
+
const chain = ancestors.get(node) ?? [];
|
|
31
|
+
for (const c of node.children) {
|
|
32
|
+
parents.set(c, node);
|
|
33
|
+
ancestors.set(c, [node, ...chain]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Pre-compute column headers per collection root. Look for the first child
|
|
37
|
+
// row whose cells are all `role=columnheader` — that's the header row.
|
|
38
|
+
const columnHeadersByRoot = new Map();
|
|
39
|
+
for (const { node: root } of walk(tree)) {
|
|
40
|
+
if (!COLLECTION_ROLES.has(root.role))
|
|
41
|
+
continue;
|
|
42
|
+
const headerRow = findHeaderRow(root);
|
|
43
|
+
if (!headerRow)
|
|
44
|
+
continue;
|
|
45
|
+
columnHeadersByRoot.set(root, headerRow.children.filter((c) => c.role === "columnheader").map((c) => (c.name ?? "").trim()));
|
|
46
|
+
}
|
|
47
|
+
for (const { node } of walk(tree)) {
|
|
48
|
+
const chain = ancestors.get(node);
|
|
49
|
+
if (!chain)
|
|
50
|
+
continue;
|
|
51
|
+
const row = findRowContainer(node, chain);
|
|
52
|
+
if (!row)
|
|
53
|
+
continue;
|
|
54
|
+
node.context = buildStructuralContext(node, chain, row, parents, columnHeadersByRoot);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** Resolve the column header for `node` within `row` — index the node's cell
|
|
58
|
+
* ancestor (or the node itself) against the collection root's header list. */
|
|
59
|
+
function resolveColumn(node, chain, row, collectionRoot, columnHeadersByRoot) {
|
|
60
|
+
if (!collectionRoot || !columnHeadersByRoot.has(collectionRoot))
|
|
61
|
+
return undefined;
|
|
62
|
+
const headers = columnHeadersByRoot.get(collectionRoot);
|
|
63
|
+
const cellAncestor = chain.find((a) => CELL_ROLES.has(a.role)) ?? (CELL_ROLES.has(node.role) ? node : undefined);
|
|
64
|
+
if (!cellAncestor)
|
|
65
|
+
return undefined;
|
|
66
|
+
const idx = row.children.indexOf(cellAncestor);
|
|
67
|
+
return idx >= 0 && idx < headers.length ? headers[idx] || undefined : undefined;
|
|
68
|
+
}
|
|
69
|
+
/** Build the `StructuralContext` for a node inside a resolved row container. */
|
|
70
|
+
function buildStructuralContext(node, chain, row, parents, columnHeadersByRoot) {
|
|
71
|
+
const collectionRoot = nearestCollectionRoot(row, parents);
|
|
72
|
+
const ctx = {
|
|
73
|
+
collection: collectionRoot ? collectionRoot.role : `${row.role}-list`,
|
|
74
|
+
};
|
|
75
|
+
const rowKey = firstNonEmptyName(row);
|
|
76
|
+
const column = resolveColumn(node, chain, row, collectionRoot, columnHeadersByRoot);
|
|
77
|
+
const rowText = collectVisibleText(row, 200);
|
|
78
|
+
if (rowKey)
|
|
79
|
+
ctx.rowKey = rowKey;
|
|
80
|
+
if (column)
|
|
81
|
+
ctx.column = column;
|
|
82
|
+
if (rowText)
|
|
83
|
+
ctx.rowText = rowText;
|
|
84
|
+
return ctx;
|
|
85
|
+
}
|
|
86
|
+
function findRowContainer(node, ancestorChain) {
|
|
87
|
+
// `node` itself qualifies if it's a row/listitem — agents often act on the row.
|
|
88
|
+
if (node.role === ROW_ROLE || node.role === "listitem" || isArticleInFeed(node, ancestorChain)) {
|
|
89
|
+
return node;
|
|
90
|
+
}
|
|
91
|
+
for (const a of ancestorChain) {
|
|
92
|
+
if (a.role === ROW_ROLE)
|
|
93
|
+
return a;
|
|
94
|
+
if (a.role === "listitem")
|
|
95
|
+
return a;
|
|
96
|
+
if (isArticleInFeed(a, ancestorChain))
|
|
97
|
+
return a;
|
|
98
|
+
}
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
function isArticleInFeed(node, chain) {
|
|
102
|
+
if (node.role !== "article")
|
|
103
|
+
return false;
|
|
104
|
+
// Only treat `article` as a row when the chain shows a `feed` ancestor —
|
|
105
|
+
// otherwise a standalone article isn't a repeated container.
|
|
106
|
+
return chain.some((a) => a.role === "feed");
|
|
107
|
+
}
|
|
108
|
+
function nearestCollectionRoot(row, parents) {
|
|
109
|
+
let cur = parents.get(row);
|
|
110
|
+
while (cur) {
|
|
111
|
+
if (COLLECTION_ROLES.has(cur.role))
|
|
112
|
+
return cur;
|
|
113
|
+
cur = parents.get(cur);
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
function findHeaderRow(root) {
|
|
118
|
+
// Search at most two levels deep for a row whose children are all
|
|
119
|
+
// `columnheader`s (skip nested rowgroups gracefully).
|
|
120
|
+
const queue = [{ node: root, depth: 0 }];
|
|
121
|
+
while (queue.length) {
|
|
122
|
+
const { node, depth } = queue.shift();
|
|
123
|
+
if (node.role === ROW_ROLE && node.children.some((c) => c.role === "columnheader")) {
|
|
124
|
+
return node;
|
|
125
|
+
}
|
|
126
|
+
if (depth < 2) {
|
|
127
|
+
for (const c of node.children)
|
|
128
|
+
queue.push({ node: c, depth: depth + 1 });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
function firstNonEmptyName(row) {
|
|
134
|
+
for (const { node } of walk(row)) {
|
|
135
|
+
const n = (node.name ?? "").trim();
|
|
136
|
+
if (n)
|
|
137
|
+
return n.length > 80 ? n.slice(0, 79) + "…" : n;
|
|
138
|
+
}
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
function collectVisibleText(node, max) {
|
|
142
|
+
const parts = [];
|
|
143
|
+
for (const { node: n } of walk(node)) {
|
|
144
|
+
const name = (n.name ?? "").trim();
|
|
145
|
+
if (name)
|
|
146
|
+
parts.push(name);
|
|
147
|
+
}
|
|
148
|
+
const joined = parts.join(" ").replace(/\s+/g, " ").trim();
|
|
149
|
+
if (!joined)
|
|
150
|
+
return "";
|
|
151
|
+
return joined.length > max ? joined.slice(0, max - 1) + "…" : joined;
|
|
152
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SubstrateBundle, SubstrateDeps } from "../engine/registry.js";
|
|
2
|
+
/** The Safari `SubstrateBundle` — the safari engine registers this. `safari!()` is
|
|
3
|
+
* the Safari-native WebDriver-Classic + BiDi handle, present on every safari
|
|
4
|
+
* session by construction (the safari `BrowserSession` always supplies it). Takes
|
|
5
|
+
* the per-server `SubstrateDeps` to honour the standardized `makeSubstrates(deps)`
|
|
6
|
+
* contract, but ignores them: every Safari selector reads the Safari-native handle,
|
|
7
|
+
* not the Playwright `ctxFor`/`describeTarget`/`save` deps. */
|
|
8
|
+
export declare function safariSubstrateBundle(_deps: SubstrateDeps): SubstrateBundle;
|