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,110 @@
|
|
|
1
|
+
// AndroidCdpAdapter — the FOURTH BrowserEngine adapter. The
|
|
2
|
+
// surviving full-fidelity real-profile BYOB lane: real Chrome-on-Android attached
|
|
3
|
+
// over adb + CDP. The KEY property is that Android Chrome speaks FULL CDP, so this
|
|
4
|
+
// adapter:
|
|
5
|
+
// - declares `deep: true` (ANDROID_CAPABILITIES) — every tool works, including
|
|
6
|
+
// the CDP-deep ones (perf / coverage / heap / cpu / clock / CDP input);
|
|
7
|
+
// - mints an eager CDP session on attach, just like the Chromium adapter;
|
|
8
|
+
// - reuses the EXISTING CdpSnapshotSubstrate / CdpNetworkSubstrate verbatim
|
|
9
|
+
// (the substrate selectors key on CDP presence, so Android falls into the
|
|
10
|
+
// chromium-substrate path automatically — NO new substrate code).
|
|
11
|
+
//
|
|
12
|
+
// This is the smallest, lowest-risk adapter precisely because it adds no new
|
|
13
|
+
// substrate. The only genuinely new code is the adb plumbing (./adb.ts) — device
|
|
14
|
+
// discovery, socket forward, /json/version → wsUrl, port management, cleanup.
|
|
15
|
+
//
|
|
16
|
+
// ATTACH is the real path: discover the Chrome DevTools socket on a connected
|
|
17
|
+
// device (`adb forward tcp:<port> localabstract:chrome_devtools_remote`), GET
|
|
18
|
+
// http://127.0.0.1:<port>/json/version → webSocketDebuggerUrl, then
|
|
19
|
+
// `chromium.connectOverCDP(wsUrl)`. This attaches to the user's REAL Chrome-on-
|
|
20
|
+
// Android — the BYOB win. The forwarded socket is loopback (adb forwards to
|
|
21
|
+
// 127.0.0.1), so byob.ts's loopback / not-owned policy applies verbatim.
|
|
22
|
+
//
|
|
23
|
+
// connectOverCDP vs `playwright._android`: we PREFER connectOverCDP. Both reach
|
|
24
|
+
// the same CDP. `_android` is a separate experimental device API
|
|
25
|
+
// (`playwright._android.devices()` → `AndroidDevice`) that owns its own adb
|
|
26
|
+
// orchestration and returns a device-shaped object, NOT a `Browser`/`CDPSession`
|
|
27
|
+
// pair the rest of browxai is built on. connectOverCDP returns the exact
|
|
28
|
+
// `Browser` + `newCDPSession` handles the Chromium adapter already wires
|
|
29
|
+
// (attachOverCdp in playwright-chromium.ts), so the substrate selectors, the
|
|
30
|
+
// network tap, the a11y substrate, and teardown all work UNCHANGED. We keep the
|
|
31
|
+
// adb orchestration explicit (./adb.ts) rather than hand it to `_android`, which
|
|
32
|
+
// reuses the most existing code and keeps the seam at the same boundary as the
|
|
33
|
+
// desktop BYOB path. (Measured against the installed Playwright 1.60:
|
|
34
|
+
// `chromium.connectOverCDP` is a function; `_android` is an experimental device
|
|
35
|
+
// API, not a `connectOverCDP` substitute.)
|
|
36
|
+
//
|
|
37
|
+
// LAUNCH is not a thing on Android the same way: managed/ephemeral launch means
|
|
38
|
+
// "spawn a browser process we own", which on a phone the user controls makes no
|
|
39
|
+
// sense — the user opens Chrome on their device. So launch returns a structured
|
|
40
|
+
// `android-launch-not-supported`; Android is attach-only.
|
|
41
|
+
import { resolveBrowserType } from "../select.js";
|
|
42
|
+
import { capabilitiesFor } from "../capabilities.js";
|
|
43
|
+
import { defaultAdbRunner, defaultFetcher, pickFreePort, devicesArgs, forwardArgs, forwardRemoveArgs, parseDevices, selectDevice, versionUrl, extractWsUrl, } from "./adb.js";
|
|
44
|
+
export class AndroidCdpAdapter {
|
|
45
|
+
engine = "android";
|
|
46
|
+
capabilities;
|
|
47
|
+
runAdb;
|
|
48
|
+
fetchJson;
|
|
49
|
+
pickPort;
|
|
50
|
+
constructor(deps = {}) {
|
|
51
|
+
// android always has a declaration (see capabilities.ts).
|
|
52
|
+
this.capabilities = capabilitiesFor("android");
|
|
53
|
+
this.runAdb = deps.runAdb ?? defaultAdbRunner;
|
|
54
|
+
this.fetchJson = deps.fetchJson ?? defaultFetcher;
|
|
55
|
+
this.pickPort = deps.pickPort ?? pickFreePort;
|
|
56
|
+
}
|
|
57
|
+
/** Discover a ready device. Lists devices via adb, parses, and selects (the
|
|
58
|
+
* requested serial if given, else the single ready one — structured errors
|
|
59
|
+
* otherwise). Surfaces `adb-missing` / `no-device` without a device crash. */
|
|
60
|
+
async discoverDevice(serial) {
|
|
61
|
+
const stdout = await this.runAdb(devicesArgs());
|
|
62
|
+
const device = selectDevice(parseDevices(stdout), serial);
|
|
63
|
+
return device.serial;
|
|
64
|
+
}
|
|
65
|
+
/** The real BYOB path: discover device → forward the Chrome DevTools socket to
|
|
66
|
+
* a free loopback port → GET /json/version → webSocketDebuggerUrl →
|
|
67
|
+
* `chromium.connectOverCDP(wsUrl)`. Returns the `Browser` + eager `CDPSession`
|
|
68
|
+
* the session layer wires its bookkeeping onto, exactly like the Chromium
|
|
69
|
+
* attach, plus the forward-teardown handle. On any failure after the forward
|
|
70
|
+
* is established, the forward is removed before the error propagates (no leaked
|
|
71
|
+
* adb forwards). */
|
|
72
|
+
async attach(opts = {}) {
|
|
73
|
+
const serial = await this.discoverDevice(opts.serial);
|
|
74
|
+
const localPort = await this.pickPort();
|
|
75
|
+
await this.runAdb(forwardArgs(localPort, serial));
|
|
76
|
+
const removeForward = async () => {
|
|
77
|
+
await this.runAdb(forwardRemoveArgs(localPort, serial)).catch(() => undefined);
|
|
78
|
+
};
|
|
79
|
+
try {
|
|
80
|
+
const versionBody = await this.fetchJson(versionUrl(localPort));
|
|
81
|
+
const wsUrl = extractWsUrl(versionBody);
|
|
82
|
+
// `android` resolves to the chromium BrowserType — connectOverCDP returns
|
|
83
|
+
// the exact Browser the desktop BYOB path uses (attachOverCdp), so the
|
|
84
|
+
// eager CDP session, the substrates, and teardown all work unchanged.
|
|
85
|
+
const browserType = resolveBrowserType(this.engine);
|
|
86
|
+
const browser = await browserType.connectOverCDP(wsUrl);
|
|
87
|
+
const context = browser.contexts()[0] ?? (await browser.newContext());
|
|
88
|
+
const page = context.pages()[0] ?? (await context.newPage());
|
|
89
|
+
const cdp = await context.newCDPSession(page);
|
|
90
|
+
return { browser, page, cdp, localPort, serial, removeForward };
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
await removeForward();
|
|
94
|
+
throw err;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/** Managed / ephemeral LAUNCH is not supported on Android. A phone's Chrome is
|
|
98
|
+
* the user's to open; browxai cannot spawn a browser process it owns on the
|
|
99
|
+
* device. Per the doctrine's no-silent-no-op rule this rejects with a
|
|
100
|
+
* structured, RFC-naming error rather than pretending. Promise-returning (not
|
|
101
|
+
* `async`) so the eslint require-await rule is honest — there is no awaited
|
|
102
|
+
* work, it is a structured refusal. */
|
|
103
|
+
launch() {
|
|
104
|
+
return Promise.reject(new Error("android-launch-not-supported: the android engine is ATTACH-ONLY. managed / ephemeral " +
|
|
105
|
+
"launch means spawning a browser process browxai owns, which is not a thing on a phone " +
|
|
106
|
+
"the user controls — the user opens Chrome on their device, and browxai attaches over " +
|
|
107
|
+
'adb + CDP. Open the session with mode:"attached" (BROWX_ATTACH_CDP ' +
|
|
108
|
+
"is loopback-enforced; the adb forward is loopback by construction)."));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Android engine registration (RFC 0004 D1). Android is real Chrome-on-Android
|
|
2
|
+
// attached over adb + CDP — it IS Chromium, so it reuses the shared Playwright
|
|
3
|
+
// substrate bundle (CDP present → the verbatim CDP snapshot/network substrates)
|
|
4
|
+
// and the full Playwright post-wire. It is ATTACH-ONLY: managed / incognito launch
|
|
5
|
+
// (spawning a browser we own) is not a thing on the user's phone, so those modes
|
|
6
|
+
// surface the adapter's structured `android-launch-not-supported`. BYOB attaches
|
|
7
|
+
// over adb via `openAndroidByobSession` (endpoint discovered, not URL-configured).
|
|
8
|
+
import { registerEngine } from "../registry.js";
|
|
9
|
+
import { capabilitiesFor } from "../capabilities.js";
|
|
10
|
+
import { AndroidCdpAdapter } from "./android-cdp.js";
|
|
11
|
+
import { playwrightSubstrateBundle } from "../../page/substrate-bundle.js";
|
|
12
|
+
import { playwrightPostWire } from "../../session/playwright-post-wire.js";
|
|
13
|
+
import { openAndroidByobSession } from "../../session/byob-attach.js";
|
|
14
|
+
async function makeAndroidAdapter(opts) {
|
|
15
|
+
const mode = opts.launchMode ?? "managed";
|
|
16
|
+
if (mode === "byob") {
|
|
17
|
+
return openAndroidByobSession();
|
|
18
|
+
}
|
|
19
|
+
// managed / incognito — spawning a browser we own is not a thing on a phone;
|
|
20
|
+
// the adapter's launch path returns the structured `android-launch-not-supported`
|
|
21
|
+
// refusal (it throws, never returns).
|
|
22
|
+
await new AndroidCdpAdapter().launch();
|
|
23
|
+
throw new Error("unreachable: android launch always refuses");
|
|
24
|
+
}
|
|
25
|
+
registerEngine({
|
|
26
|
+
kind: "android",
|
|
27
|
+
capabilities: capabilitiesFor("android"),
|
|
28
|
+
makeAdapter: makeAndroidAdapter,
|
|
29
|
+
makeSubstrates: (deps) => playwrightSubstrateBundle(deps),
|
|
30
|
+
postWire: (entry, deps) => playwrightPostWire(entry, deps),
|
|
31
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Chromium engine registration (RFC 0004 D1). Registers the one `EngineEntry`
|
|
2
|
+
// for the chromium engine — the byte-identity-critical path. No adapter LOGIC
|
|
3
|
+
// moves here: the Playwright launch calls stay in `PlaywrightChromiumAdapter`,
|
|
4
|
+
// the substrate selection delegates to the existing CDP/Playwright selectors, and
|
|
5
|
+
// the post-wire is the full Playwright bookkeeping set (the always-true branch the
|
|
6
|
+
// three factories ran for every non-Safari engine). This is pure wiring
|
|
7
|
+
// relocation behind the registry — the chromium CDP path is verbatim.
|
|
8
|
+
import { registerEngine } from "../registry.js";
|
|
9
|
+
import { capabilitiesFor } from "../capabilities.js";
|
|
10
|
+
import { playwrightSubstrateBundle } from "../../page/substrate-bundle.js";
|
|
11
|
+
import { playwrightPostWire } from "../../session/playwright-post-wire.js";
|
|
12
|
+
import { buildManagedLaunch, buildIncognitoContextOptions, buildIncognitoLaunchOptions, finalizeManagedSession, finalizeIncognitoSession, } from "../../session/launch-options.js";
|
|
13
|
+
import { PlaywrightChromiumAdapter } from "./playwright-chromium.js";
|
|
14
|
+
import { attachByobChromium } from "../../session/byob-attach.js";
|
|
15
|
+
/** Build a chromium `BrowserSession` for the requested launch mode. The
|
|
16
|
+
* per-engine launch dispatch the three factories carried (`engine === "…"`)
|
|
17
|
+
* collapses to this one method; the mode is threaded via `opts.launchMode`
|
|
18
|
+
* (defaulting to managed). Every option-built value + adapter call is the verbatim
|
|
19
|
+
* pre-seam chromium path, so the chromium keystone stays byte-identical. */
|
|
20
|
+
async function makeChromiumAdapter(opts) {
|
|
21
|
+
const mode = opts.launchMode ?? "managed";
|
|
22
|
+
if (mode === "byob") {
|
|
23
|
+
return attachByobChromium(opts);
|
|
24
|
+
}
|
|
25
|
+
if (mode === "incognito") {
|
|
26
|
+
const adapter = new PlaywrightChromiumAdapter();
|
|
27
|
+
const { browser, context, page, cdp } = await adapter.launchEphemeral({
|
|
28
|
+
launchOptions: buildIncognitoLaunchOptions("chromium", opts),
|
|
29
|
+
contextOptions: buildIncognitoContextOptions(opts),
|
|
30
|
+
});
|
|
31
|
+
return finalizeIncognitoSession("chromium", { browser, context, page, cdp });
|
|
32
|
+
}
|
|
33
|
+
const { profileDir, options } = buildManagedLaunch("chromium", opts);
|
|
34
|
+
const adapter = new PlaywrightChromiumAdapter();
|
|
35
|
+
const { context, page, cdp } = await adapter.launchPersistent({ profileDir, options });
|
|
36
|
+
return finalizeManagedSession("chromium", opts, profileDir, { context, page, cdp });
|
|
37
|
+
}
|
|
38
|
+
registerEngine({
|
|
39
|
+
kind: "chromium",
|
|
40
|
+
capabilities: capabilitiesFor("chromium"),
|
|
41
|
+
makeAdapter: makeChromiumAdapter,
|
|
42
|
+
makeSubstrates: (deps) => playwrightSubstrateBundle(deps),
|
|
43
|
+
postWire: (entry, deps) => playwrightPostWire(entry, deps),
|
|
44
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Firefox engine registration (RFC 0004 D1). Registers the one `EngineEntry` for
|
|
2
|
+
// the firefox engine. No adapter logic moves: the Juggler launch stays in
|
|
3
|
+
// `PlaywrightFirefoxAdapter`; the substrate bundle is the shared Playwright one
|
|
4
|
+
// (firefox has a Page, no CDP → the page-side snapshot walker + Playwright network
|
|
5
|
+
// substrate are selected by CDP-absence); the post-wire is the full Playwright set.
|
|
6
|
+
// BYOB attach surfaces the adapter's structured `firefox-attach-not-supported`.
|
|
7
|
+
import { registerEngine } from "../registry.js";
|
|
8
|
+
import { capabilitiesFor } from "../capabilities.js";
|
|
9
|
+
import { PlaywrightFirefoxAdapter, firefoxChannelFromEnv } from "./playwright-firefox.js";
|
|
10
|
+
import { playwrightSubstrateBundle } from "../../page/substrate-bundle.js";
|
|
11
|
+
import { playwrightPostWire } from "../../session/playwright-post-wire.js";
|
|
12
|
+
import { buildManagedLaunch, buildIncognitoContextOptions, finalizeManagedSession, finalizeIncognitoSession, } from "../../session/launch-options.js";
|
|
13
|
+
import { assertByobAttach } from "../../session/byob-attach.js";
|
|
14
|
+
async function makeFirefoxAdapter(opts) {
|
|
15
|
+
const mode = opts.launchMode ?? "managed";
|
|
16
|
+
if (mode === "byob") {
|
|
17
|
+
// Firefox attach is a glass-box LAUNCH over BiDi, not CDP-attach — Playwright
|
|
18
|
+
// has no `connectOverBiDi` for a user's running Firefox. Surface the
|
|
19
|
+
// structured `firefox-attach-not-supported` error (no silent fail).
|
|
20
|
+
const url = assertByobAttach(opts);
|
|
21
|
+
await new PlaywrightFirefoxAdapter().attach(url);
|
|
22
|
+
throw new Error("unreachable: firefox attach always refuses");
|
|
23
|
+
}
|
|
24
|
+
if (mode === "incognito") {
|
|
25
|
+
const adapter = new PlaywrightFirefoxAdapter({ channel: firefoxChannelFromEnv() });
|
|
26
|
+
const { browser, context, page } = await adapter.launchEphemeral({
|
|
27
|
+
launchOptions: { headless: !!opts.headless },
|
|
28
|
+
contextOptions: buildIncognitoContextOptions(opts),
|
|
29
|
+
});
|
|
30
|
+
return finalizeIncognitoSession("firefox", { browser, context, page });
|
|
31
|
+
}
|
|
32
|
+
const { profileDir, options } = buildManagedLaunch("firefox", opts);
|
|
33
|
+
const adapter = new PlaywrightFirefoxAdapter({ channel: firefoxChannelFromEnv() });
|
|
34
|
+
const { context, page } = await adapter.launchPersistent({ profileDir, options });
|
|
35
|
+
return finalizeManagedSession("firefox", opts, profileDir, { context, page });
|
|
36
|
+
}
|
|
37
|
+
registerEngine({
|
|
38
|
+
kind: "firefox",
|
|
39
|
+
capabilities: capabilitiesFor("firefox"),
|
|
40
|
+
makeAdapter: makeFirefoxAdapter,
|
|
41
|
+
makeSubstrates: (deps) => playwrightSubstrateBundle(deps),
|
|
42
|
+
postWire: (entry, deps) => playwrightPostWire(entry, deps),
|
|
43
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Browser, BrowserContext, BrowserContextOptions, CDPSession, LaunchOptions, Page } from "playwright-core";
|
|
2
|
+
import { resolveBrowserType } from "../select.js";
|
|
3
|
+
import type { EngineCapabilities, EngineKind } from "../types.js";
|
|
4
|
+
/** Chromium always mints an eager CDP session, so its launch handles carry a
|
|
5
|
+
* required `cdp` — tighter than the port's optional-`cdp` `EngineLaunchHandles`
|
|
6
|
+
* so callers don't need a non-null assertion on the Chromium path. */
|
|
7
|
+
export interface ChromiumLaunchHandles {
|
|
8
|
+
browser?: Browser;
|
|
9
|
+
context: BrowserContext;
|
|
10
|
+
page: Page;
|
|
11
|
+
cdp: CDPSession;
|
|
12
|
+
}
|
|
13
|
+
/** Options for a persistent (managed) launch — the subset the managed factory
|
|
14
|
+
* passes to `launchPersistentContext` today. */
|
|
15
|
+
export interface PersistentLaunchSpec {
|
|
16
|
+
profileDir: string;
|
|
17
|
+
options: Parameters<ReturnType<typeof resolveBrowserType>["launchPersistentContext"]>[1];
|
|
18
|
+
}
|
|
19
|
+
/** Options for an ephemeral (incognito) launch — a `launch` + `newContext`
|
|
20
|
+
* pair, exactly as the incognito factory builds it today. */
|
|
21
|
+
export interface EphemeralLaunchSpec {
|
|
22
|
+
launchOptions: LaunchOptions;
|
|
23
|
+
contextOptions: BrowserContextOptions;
|
|
24
|
+
}
|
|
25
|
+
/** The Chromium engine adapter. One instance per launch; it owns the engine
|
|
26
|
+
* selection + the eager CDP session, and surfaces the handles the session
|
|
27
|
+
* layer wires its bookkeeping onto. */
|
|
28
|
+
export declare class PlaywrightChromiumAdapter {
|
|
29
|
+
readonly engine: EngineKind;
|
|
30
|
+
readonly capabilities: EngineCapabilities;
|
|
31
|
+
constructor();
|
|
32
|
+
/** Persistent-profile launch — wraps `launchPersistentContext` + the eager
|
|
33
|
+
* `newCDPSession`. Mirrors openManagedSession's pre-seam body verbatim. */
|
|
34
|
+
launchPersistent(spec: PersistentLaunchSpec): Promise<ChromiumLaunchHandles>;
|
|
35
|
+
/** Ephemeral launch — wraps `launch` + `newContext` + the eager
|
|
36
|
+
* `newCDPSession`. Mirrors openIncognitoSession's pre-seam body verbatim. */
|
|
37
|
+
launchEphemeral(spec: EphemeralLaunchSpec): Promise<ChromiumLaunchHandles>;
|
|
38
|
+
/** BYOB attach over CDP — wraps `connectOverCDP` + the eager `newCDPSession`.
|
|
39
|
+
* The loopback / not-owned policy stays in byob.ts because it is
|
|
40
|
+
* protocol-neutral; only this transport hop is engine-specific. Mirrors
|
|
41
|
+
* openByobSession's pre-seam connect body verbatim. */
|
|
42
|
+
attachOverCdp(endpoint: string): Promise<ChromiumLaunchHandles>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// PlaywrightChromiumAdapter — the first BrowserEngine adapter. This is where
|
|
2
|
+
// today's Chromium/CDP behavior lives now: it WRAPS the exact Playwright calls
|
|
3
|
+
// the three session factories used inline before the seam existed
|
|
4
|
+
// (`chromium.launchPersistentContext`, `chromium.launch` + `newContext`,
|
|
5
|
+
// `chromium.connectOverCDP`), and mints the eager `CDPSession` Chromium needs.
|
|
6
|
+
// It does not reimplement anything — the launch options, flags, and ordering
|
|
7
|
+
// are byte-identical to the pre-seam factories.
|
|
8
|
+
//
|
|
9
|
+
// The browser-type is resolved through `resolveBrowserType("chromium")` so the
|
|
10
|
+
// selection seam is exercised by the only engine currently wired up;
|
|
11
|
+
// firefox/webkit route through the same resolver and hit
|
|
12
|
+
// `EngineNotYetSupportedError`.
|
|
13
|
+
import { resolveBrowserType } from "../select.js";
|
|
14
|
+
import { capabilitiesFor } from "../capabilities.js";
|
|
15
|
+
/** The Chromium engine adapter. One instance per launch; it owns the engine
|
|
16
|
+
* selection + the eager CDP session, and surfaces the handles the session
|
|
17
|
+
* layer wires its bookkeeping onto. */
|
|
18
|
+
export class PlaywrightChromiumAdapter {
|
|
19
|
+
engine = "chromium";
|
|
20
|
+
capabilities;
|
|
21
|
+
constructor() {
|
|
22
|
+
// chromium always has a declaration (see capabilities.ts).
|
|
23
|
+
this.capabilities = capabilitiesFor("chromium");
|
|
24
|
+
}
|
|
25
|
+
/** Persistent-profile launch — wraps `launchPersistentContext` + the eager
|
|
26
|
+
* `newCDPSession`. Mirrors openManagedSession's pre-seam body verbatim. */
|
|
27
|
+
async launchPersistent(spec) {
|
|
28
|
+
const browserType = resolveBrowserType(this.engine);
|
|
29
|
+
const context = await browserType.launchPersistentContext(spec.profileDir, spec.options);
|
|
30
|
+
const page = context.pages()[0] ?? (await context.newPage());
|
|
31
|
+
const cdp = await context.newCDPSession(page);
|
|
32
|
+
return { context, page, cdp };
|
|
33
|
+
}
|
|
34
|
+
/** Ephemeral launch — wraps `launch` + `newContext` + the eager
|
|
35
|
+
* `newCDPSession`. Mirrors openIncognitoSession's pre-seam body verbatim. */
|
|
36
|
+
async launchEphemeral(spec) {
|
|
37
|
+
const browserType = resolveBrowserType(this.engine);
|
|
38
|
+
const browser = await browserType.launch(spec.launchOptions);
|
|
39
|
+
const context = await browser.newContext(spec.contextOptions);
|
|
40
|
+
const page = await context.newPage();
|
|
41
|
+
const cdp = await context.newCDPSession(page);
|
|
42
|
+
return { browser, context, page, cdp };
|
|
43
|
+
}
|
|
44
|
+
/** BYOB attach over CDP — wraps `connectOverCDP` + the eager `newCDPSession`.
|
|
45
|
+
* The loopback / not-owned policy stays in byob.ts because it is
|
|
46
|
+
* protocol-neutral; only this transport hop is engine-specific. Mirrors
|
|
47
|
+
* openByobSession's pre-seam connect body verbatim. */
|
|
48
|
+
async attachOverCdp(endpoint) {
|
|
49
|
+
const browserType = resolveBrowserType(this.engine);
|
|
50
|
+
const browser = await browserType.connectOverCDP(endpoint);
|
|
51
|
+
const context = browser.contexts()[0] ?? (await browser.newContext());
|
|
52
|
+
const page = context.pages()[0] ?? (await context.newPage());
|
|
53
|
+
const cdp = await context.newCDPSession(page);
|
|
54
|
+
return { browser, context, page, cdp };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { BrowserContextOptions, LaunchOptions } from "playwright-core";
|
|
2
|
+
import { resolveBrowserType } from "../select.js";
|
|
3
|
+
import type { EngineCapabilities, EngineKind, EngineLaunchHandles } from "../types.js";
|
|
4
|
+
/** Persistent (managed) launch spec — the subset the managed factory passes to
|
|
5
|
+
* `launchPersistentContext`. Same shape as the chromium adapter's so the
|
|
6
|
+
* session factories thread one spec regardless of engine. */
|
|
7
|
+
export interface FirefoxPersistentLaunchSpec {
|
|
8
|
+
profileDir: string;
|
|
9
|
+
options: Parameters<ReturnType<typeof resolveBrowserType>["launchPersistentContext"]>[1];
|
|
10
|
+
}
|
|
11
|
+
/** Ephemeral (incognito) launch spec — a `launch` + `newContext` pair. */
|
|
12
|
+
export interface FirefoxEphemeralLaunchSpec {
|
|
13
|
+
launchOptions: LaunchOptions;
|
|
14
|
+
contextOptions: BrowserContextOptions;
|
|
15
|
+
}
|
|
16
|
+
/** The experimental stock-Firefox BiDi channel name (Playwright `channel`).
|
|
17
|
+
* Selected via `BROWX_FIREFOX_CHANNEL=moz-firefox`. */
|
|
18
|
+
export declare const MOZ_FIREFOX_CHANNEL = "moz-firefox";
|
|
19
|
+
/** Resolve the optional `BROWX_FIREFOX_CHANNEL` flag. Returns the channel string
|
|
20
|
+
* to pass to Playwright's `launch`/`launchPersistentContext`, or undefined for
|
|
21
|
+
* the default Juggler lane. Only `moz-firefox` is recognised; any other value
|
|
22
|
+
* is rejected loudly (no silent fallback). */
|
|
23
|
+
export declare function firefoxChannelFromEnv(env?: NodeJS.ProcessEnv): string | undefined;
|
|
24
|
+
/** The Firefox engine adapter. One instance per launch; it owns engine
|
|
25
|
+
* selection and surfaces the handles the session layer wires its bookkeeping
|
|
26
|
+
* onto. Unlike the chromium adapter it carries no `cdp` on its handles —
|
|
27
|
+
* Firefox has no CDP escape hatch. */
|
|
28
|
+
export declare class PlaywrightFirefoxAdapter {
|
|
29
|
+
readonly engine: EngineKind;
|
|
30
|
+
readonly capabilities: EngineCapabilities;
|
|
31
|
+
private readonly channel;
|
|
32
|
+
constructor(opts?: {
|
|
33
|
+
channel?: string;
|
|
34
|
+
});
|
|
35
|
+
/** Persistent-profile launch — wraps `launchPersistentContext`. No eager CDP
|
|
36
|
+
* session (Firefox has none). Mirrors the chromium adapter's shape. */
|
|
37
|
+
launchPersistent(spec: FirefoxPersistentLaunchSpec): Promise<EngineLaunchHandles>;
|
|
38
|
+
/** Ephemeral launch — wraps `launch` + `newContext`. No eager CDP session. */
|
|
39
|
+
launchEphemeral(spec: FirefoxEphemeralLaunchSpec): Promise<EngineLaunchHandles>;
|
|
40
|
+
/** BYOB attach. The Firefox attach model is a glass-box LAUNCH of
|
|
41
|
+
* the user's real profile with `--remote-debugging-port`, NOT a CDP-attach —
|
|
42
|
+
* and Playwright has no public `connectOverBiDi` for a user's running
|
|
43
|
+
* Firefox. Until a BiDi attach client exists this rejects with a structured,
|
|
44
|
+
* explanatory error rather than silently failing (the doctrine's
|
|
45
|
+
* no-silent-no-op rule). The `BROWX_ATTACH_BIDI` name is reserved for it.
|
|
46
|
+
* Promise-returning (not `async`) so the eslint require-await rule is honest:
|
|
47
|
+
* there is no awaited work — it is a structured refusal. */
|
|
48
|
+
attach(_endpoint: string): Promise<EngineLaunchHandles>;
|
|
49
|
+
/** Splice the optional `moz-firefox` BiDi channel into a launch options bag.
|
|
50
|
+
* No-op for the default Juggler lane. */
|
|
51
|
+
private withChannel;
|
|
52
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// PlaywrightFirefoxAdapter — the second BrowserEngine adapter, the proof the
|
|
2
|
+
// port generalizes to a second engine. It mirrors PlaywrightChromiumAdapter's
|
|
3
|
+
// three launch shapes over `resolveBrowserType("firefox")` (Playwright's bundled
|
|
4
|
+
// Juggler Firefox, the default supported lane) — but it mints NO eager CDP
|
|
5
|
+
// session: `newCDPSession` throws on Firefox (measured), and Firefox declares
|
|
6
|
+
// `deep: false`, so the raw-CDP escape hatch is absent. Sessions on this engine
|
|
7
|
+
// run the cross-browser surface; the ~19 CDP-hard tools structured-refuse via
|
|
8
|
+
// the engine gate (src/engine/tool-gate.ts).
|
|
9
|
+
//
|
|
10
|
+
// Dependency direction (architecture doctrine): port → adapter → Playwright.
|
|
11
|
+
// The adapter delegates directly to Playwright on the per-action path exactly
|
|
12
|
+
// like the chromium one — no added allocation on the hot path.
|
|
13
|
+
//
|
|
14
|
+
// Two-track design: the default lane is Juggler (full Playwright API — routes,
|
|
15
|
+
// video, HAR — so the ~139 class-A tools are real). The experimental stock-
|
|
16
|
+
// Firefox `moz-firefox` BiDi channel rides behind `BROWX_FIREFOX_CHANNEL`
|
|
17
|
+
// (see firefoxChannelFromEnv); it is NOT gated by the keystone. Measured against
|
|
18
|
+
// the installed Playwright: the channel IS recognised (it launches a real BiDi
|
|
19
|
+
// session against stock Firefox) but the session immediately hits a Mozilla-side
|
|
20
|
+
// BiDi gap (`network.addDataCollector: unknown command`) — the M20 streaming /
|
|
21
|
+
// network gaps the research predicted. So the flag is wired and the channel
|
|
22
|
+
// resolves; stock-Firefox-BiDi is just not usable for browxai's surface yet.
|
|
23
|
+
// Flip the default to this lane when Mozilla M20 closes.
|
|
24
|
+
import { resolveBrowserType } from "../select.js";
|
|
25
|
+
import { capabilitiesFor } from "../capabilities.js";
|
|
26
|
+
/** The experimental stock-Firefox BiDi channel name (Playwright `channel`).
|
|
27
|
+
* Selected via `BROWX_FIREFOX_CHANNEL=moz-firefox`. */
|
|
28
|
+
export const MOZ_FIREFOX_CHANNEL = "moz-firefox";
|
|
29
|
+
/** Resolve the optional `BROWX_FIREFOX_CHANNEL` flag. Returns the channel string
|
|
30
|
+
* to pass to Playwright's `launch`/`launchPersistentContext`, or undefined for
|
|
31
|
+
* the default Juggler lane. Only `moz-firefox` is recognised; any other value
|
|
32
|
+
* is rejected loudly (no silent fallback). */
|
|
33
|
+
export function firefoxChannelFromEnv(env = process.env) {
|
|
34
|
+
const raw = env.BROWX_FIREFOX_CHANNEL?.trim();
|
|
35
|
+
if (!raw)
|
|
36
|
+
return undefined;
|
|
37
|
+
if (raw !== MOZ_FIREFOX_CHANNEL) {
|
|
38
|
+
throw new Error(`BROWX_FIREFOX_CHANNEL: unknown value "${raw}". The only supported value is ` +
|
|
39
|
+
`"${MOZ_FIREFOX_CHANNEL}" (the experimental stock-Firefox WebDriver-BiDi channel). ` +
|
|
40
|
+
"Unset it for the default bundled-Juggler lane.");
|
|
41
|
+
}
|
|
42
|
+
return MOZ_FIREFOX_CHANNEL;
|
|
43
|
+
}
|
|
44
|
+
/** The Firefox engine adapter. One instance per launch; it owns engine
|
|
45
|
+
* selection and surfaces the handles the session layer wires its bookkeeping
|
|
46
|
+
* onto. Unlike the chromium adapter it carries no `cdp` on its handles —
|
|
47
|
+
* Firefox has no CDP escape hatch. */
|
|
48
|
+
export class PlaywrightFirefoxAdapter {
|
|
49
|
+
engine = "firefox";
|
|
50
|
+
capabilities;
|
|
51
|
+
channel;
|
|
52
|
+
constructor(opts = {}) {
|
|
53
|
+
// firefox always has a declaration (see capabilities.ts).
|
|
54
|
+
this.capabilities = capabilitiesFor("firefox");
|
|
55
|
+
this.channel = opts.channel;
|
|
56
|
+
}
|
|
57
|
+
/** Persistent-profile launch — wraps `launchPersistentContext`. No eager CDP
|
|
58
|
+
* session (Firefox has none). Mirrors the chromium adapter's shape. */
|
|
59
|
+
async launchPersistent(spec) {
|
|
60
|
+
const browserType = resolveBrowserType(this.engine);
|
|
61
|
+
const options = this.withChannel(spec.options);
|
|
62
|
+
const context = await browserType.launchPersistentContext(spec.profileDir, options);
|
|
63
|
+
const page = context.pages()[0] ?? (await context.newPage());
|
|
64
|
+
return { context, page };
|
|
65
|
+
}
|
|
66
|
+
/** Ephemeral launch — wraps `launch` + `newContext`. No eager CDP session. */
|
|
67
|
+
async launchEphemeral(spec) {
|
|
68
|
+
const browserType = resolveBrowserType(this.engine);
|
|
69
|
+
const browser = await browserType.launch(this.withChannel(spec.launchOptions));
|
|
70
|
+
const context = await browser.newContext(spec.contextOptions);
|
|
71
|
+
const page = await context.newPage();
|
|
72
|
+
return { browser, context, page };
|
|
73
|
+
}
|
|
74
|
+
/** BYOB attach. The Firefox attach model is a glass-box LAUNCH of
|
|
75
|
+
* the user's real profile with `--remote-debugging-port`, NOT a CDP-attach —
|
|
76
|
+
* and Playwright has no public `connectOverBiDi` for a user's running
|
|
77
|
+
* Firefox. Until a BiDi attach client exists this rejects with a structured,
|
|
78
|
+
* explanatory error rather than silently failing (the doctrine's
|
|
79
|
+
* no-silent-no-op rule). The `BROWX_ATTACH_BIDI` name is reserved for it.
|
|
80
|
+
* Promise-returning (not `async`) so the eslint require-await rule is honest:
|
|
81
|
+
* there is no awaited work — it is a structured refusal. */
|
|
82
|
+
attach(_endpoint) {
|
|
83
|
+
return Promise.reject(new Error("firefox-attach-not-supported: browxai cannot attach to a running Firefox over CDP. " +
|
|
84
|
+
"Firefox removed CDP in v141; the forward path is WebDriver BiDi, and Playwright has no " +
|
|
85
|
+
"public `connectOverBiDi` for a user's running Firefox yet (the `BROWX_ATTACH_BIDI` name " +
|
|
86
|
+
"is reserved for it). The Firefox BYOB model is a glass-box LAUNCH of the " +
|
|
87
|
+
"real profile with `--remote-debugging-port`, subject to the profile lock. Use a managed " +
|
|
88
|
+
"Firefox session (the default), or a chromium session for CDP-attach BYOB."));
|
|
89
|
+
}
|
|
90
|
+
/** Splice the optional `moz-firefox` BiDi channel into a launch options bag.
|
|
91
|
+
* No-op for the default Juggler lane. */
|
|
92
|
+
withChannel(options) {
|
|
93
|
+
if (!this.channel)
|
|
94
|
+
return options;
|
|
95
|
+
return { ...(options ?? {}), channel: this.channel };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { BrowserContextOptions, LaunchOptions } from "playwright-core";
|
|
2
|
+
import { resolveBrowserType } from "../select.js";
|
|
3
|
+
import type { EngineCapabilities, EngineKind, EngineLaunchHandles } from "../types.js";
|
|
4
|
+
/** Persistent (managed) launch spec — the subset the managed factory passes to
|
|
5
|
+
* `launchPersistentContext`. Same shape as the chromium/firefox adapters' so the
|
|
6
|
+
* session factories thread one spec regardless of engine. */
|
|
7
|
+
export interface WebKitPersistentLaunchSpec {
|
|
8
|
+
profileDir: string;
|
|
9
|
+
options: Parameters<ReturnType<typeof resolveBrowserType>["launchPersistentContext"]>[1];
|
|
10
|
+
}
|
|
11
|
+
/** Ephemeral (incognito) launch spec — a `launch` + `newContext` pair. */
|
|
12
|
+
export interface WebKitEphemeralLaunchSpec {
|
|
13
|
+
launchOptions: LaunchOptions;
|
|
14
|
+
contextOptions: BrowserContextOptions;
|
|
15
|
+
}
|
|
16
|
+
/** The WebKit engine adapter. One instance per launch; it owns engine selection
|
|
17
|
+
* and surfaces the handles the session layer wires its bookkeeping onto. Like
|
|
18
|
+
* the firefox adapter it carries no `cdp` on its handles — WebKit has no CDP
|
|
19
|
+
* escape hatch (measured: `newCDPSession` throws off Chromium). */
|
|
20
|
+
export declare class PlaywrightWebKitAdapter {
|
|
21
|
+
readonly engine: EngineKind;
|
|
22
|
+
readonly capabilities: EngineCapabilities;
|
|
23
|
+
constructor();
|
|
24
|
+
/** Persistent-profile launch — wraps `launchPersistentContext`. No eager CDP
|
|
25
|
+
* session (WebKit has none). Mirrors the firefox adapter's shape. If a future
|
|
26
|
+
* WebKit build lacks persistent-context support, `launchPersistentContext`
|
|
27
|
+
* throws and the failure surfaces through the session factory (the
|
|
28
|
+
* `webkit-persistent-not-supported` reason is reserved for a structured refusal). */
|
|
29
|
+
launchPersistent(spec: WebKitPersistentLaunchSpec): Promise<EngineLaunchHandles>;
|
|
30
|
+
/** Ephemeral launch — wraps `launch` + `newContext`. No eager CDP session. */
|
|
31
|
+
launchEphemeral(spec: WebKitEphemeralLaunchSpec): Promise<EngineLaunchHandles>;
|
|
32
|
+
/** BYOB attach. WebKit has no CDP attach client and no BiDi attach client
|
|
33
|
+
* either (Safari has not shipped BiDi as of June 2026), and the
|
|
34
|
+
* WebKit engine build exposes no remote-debugging attach surface browxai can
|
|
35
|
+
* drive. Per the doctrine's no-silent-no-op rule this rejects with a
|
|
36
|
+
* structured, RFC-naming error rather than failing quietly. Promise-returning
|
|
37
|
+
* (not `async`) so the eslint require-await rule is honest: there is no awaited
|
|
38
|
+
* work — it is a structured refusal. */
|
|
39
|
+
attach(_endpoint: string): Promise<EngineLaunchHandles>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// PlaywrightWebKitAdapter — the THIRD BrowserEngine adapter.
|
|
2
|
+
// It mirrors PlaywrightFirefoxAdapter's three launch shapes over
|
|
3
|
+
// `resolveBrowserType("webkit")` (Playwright's bundled WebKit build — the
|
|
4
|
+
// WebKit-ENGINE correctness lane, NOT Safari; a real-Safari surface is a
|
|
5
|
+
// separate, tiered companion product, never a browxai engine
|
|
6
|
+
// adapter). Like the Firefox adapter it mints NO eager CDP session — WebKit has
|
|
7
|
+
// no CDP at all (measured: `newCDPSession` throws "CDP session is only available
|
|
8
|
+
// in Chromium"), and `WEBKIT_CAPABILITIES` declares `deep: false`, so the raw-CDP
|
|
9
|
+
// escape hatch is absent and the ~26 CDP-deep tools structured-refuse via the
|
|
10
|
+
// CAPABILITY-based engine gate (src/engine/tool-gate.ts) with NO per-engine edit
|
|
11
|
+
// — the gate keys on `deep:false`, not an engine name, so a new engine that drops
|
|
12
|
+
// `deep` auto-gates. That is the open/closed-correct design the doctrine asks for.
|
|
13
|
+
//
|
|
14
|
+
// Dependency direction (architecture doctrine): port → adapter → Playwright. The
|
|
15
|
+
// adapter delegates directly to Playwright on the per-action path exactly like
|
|
16
|
+
// the chromium + firefox ones — no added allocation on the hot path.
|
|
17
|
+
//
|
|
18
|
+
// Substrates: both already engine-agnostic. WebKit (CDP-absent) selects the
|
|
19
|
+
// page-side `PlaywrightSnapshotSubstrate` walker (`snapshotSubstrateFor` keys on
|
|
20
|
+
// CDP capability, not engine name), so `snapshot`/`find`/`navigate`/`click`/
|
|
21
|
+
// `fill`/`text_search`/`extract`/`set_of_marks`/`plan` work on WebKit with no
|
|
22
|
+
// substrate code change. The network slice rides P2b's Playwright-event tap when
|
|
23
|
+
// it lands (same as Firefox); until then WebKit's network slice is empty.
|
|
24
|
+
//
|
|
25
|
+
// Persistent mode: measured against the installed Playwright, WebKit DOES support
|
|
26
|
+
// `launchPersistentContext` (unlike the "persistent-mode-on-WebKit is a
|
|
27
|
+
// known loss" caveat, which is about real-Safari, not the WebKit engine build) —
|
|
28
|
+
// so the managed path is real. Should a future Playwright/WebKit build drop it,
|
|
29
|
+
// the launch throws and the session factory surfaces it; the reserved structured
|
|
30
|
+
// reason name is `webkit-persistent-not-supported`.
|
|
31
|
+
import { resolveBrowserType } from "../select.js";
|
|
32
|
+
import { capabilitiesFor } from "../capabilities.js";
|
|
33
|
+
/** The WebKit engine adapter. One instance per launch; it owns engine selection
|
|
34
|
+
* and surfaces the handles the session layer wires its bookkeeping onto. Like
|
|
35
|
+
* the firefox adapter it carries no `cdp` on its handles — WebKit has no CDP
|
|
36
|
+
* escape hatch (measured: `newCDPSession` throws off Chromium). */
|
|
37
|
+
export class PlaywrightWebKitAdapter {
|
|
38
|
+
engine = "webkit";
|
|
39
|
+
capabilities;
|
|
40
|
+
constructor() {
|
|
41
|
+
// webkit always has a declaration (see capabilities.ts).
|
|
42
|
+
this.capabilities = capabilitiesFor("webkit");
|
|
43
|
+
}
|
|
44
|
+
/** Persistent-profile launch — wraps `launchPersistentContext`. No eager CDP
|
|
45
|
+
* session (WebKit has none). Mirrors the firefox adapter's shape. If a future
|
|
46
|
+
* WebKit build lacks persistent-context support, `launchPersistentContext`
|
|
47
|
+
* throws and the failure surfaces through the session factory (the
|
|
48
|
+
* `webkit-persistent-not-supported` reason is reserved for a structured refusal). */
|
|
49
|
+
async launchPersistent(spec) {
|
|
50
|
+
const browserType = resolveBrowserType(this.engine);
|
|
51
|
+
const context = await browserType.launchPersistentContext(spec.profileDir, spec.options);
|
|
52
|
+
const page = context.pages()[0] ?? (await context.newPage());
|
|
53
|
+
return { context, page };
|
|
54
|
+
}
|
|
55
|
+
/** Ephemeral launch — wraps `launch` + `newContext`. No eager CDP session. */
|
|
56
|
+
async launchEphemeral(spec) {
|
|
57
|
+
const browserType = resolveBrowserType(this.engine);
|
|
58
|
+
const browser = await browserType.launch(spec.launchOptions);
|
|
59
|
+
const context = await browser.newContext(spec.contextOptions);
|
|
60
|
+
const page = await context.newPage();
|
|
61
|
+
return { browser, context, page };
|
|
62
|
+
}
|
|
63
|
+
/** BYOB attach. WebKit has no CDP attach client and no BiDi attach client
|
|
64
|
+
* either (Safari has not shipped BiDi as of June 2026), and the
|
|
65
|
+
* WebKit engine build exposes no remote-debugging attach surface browxai can
|
|
66
|
+
* drive. Per the doctrine's no-silent-no-op rule this rejects with a
|
|
67
|
+
* structured, RFC-naming error rather than failing quietly. Promise-returning
|
|
68
|
+
* (not `async`) so the eslint require-await rule is honest: there is no awaited
|
|
69
|
+
* work — it is a structured refusal. */
|
|
70
|
+
attach(_endpoint) {
|
|
71
|
+
return Promise.reject(new Error("webkit-attach-not-supported: browxai cannot attach to a running WebKit/Safari over CDP " +
|
|
72
|
+
"or BiDi. WebKit has no CDP escape hatch, and Safari has not shipped WebDriver BiDi as " +
|
|
73
|
+
"of June 2026 (safaridriver is WebDriver-Classic-only and hard-isolates automation into " +
|
|
74
|
+
"a clean ephemeral window — attach-to-the-live-session is impossible by design). The " +
|
|
75
|
+
"WebKit engine lane is correctness-only (managed sessions); real-Safari BYOB " +
|
|
76
|
+
"is a separate, tiered companion surface (AppleScript / Web-Extension), not a browxai " +
|
|
77
|
+
"engine adapter. Use a managed WebKit session, or a chromium session for CDP-attach BYOB."));
|
|
78
|
+
}
|
|
79
|
+
}
|