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,286 @@
|
|
|
1
|
+
// `solve_captcha` — gated behind the off-by-default `captcha` capability.
|
|
2
|
+
//
|
|
3
|
+
// What this is (and is NOT):
|
|
4
|
+
//
|
|
5
|
+
// - This is a DELEGATION SEAM, not a solver. browxai does NOT bundle a
|
|
6
|
+
// captcha solver; doing so would mean shipping ML weights / cloud creds /
|
|
7
|
+
// legal exposure to every adopter. Instead the tool reads provider config
|
|
8
|
+
// from environment variables at session-/call-time and POSTs the captcha
|
|
9
|
+
// challenge to that provider's HTTP API. If no provider is configured,
|
|
10
|
+
// the tool returns a structured failure with a clear "no provider
|
|
11
|
+
// configured" hint — never tries to "guess" the answer.
|
|
12
|
+
//
|
|
13
|
+
// - The provider API shape we target for v0.2.0 is the **2Captcha** REST
|
|
14
|
+
// contract (`POST /in.php` to submit + poll `GET /res.php` for the
|
|
15
|
+
// answer). CapMonster Cloud mirrors this API exactly (it documents
|
|
16
|
+
// itself as drop-in compatible with 2Captcha), so configuring
|
|
17
|
+
// `BROWX_CAPTCHA_PROVIDER=capmonster` + `BROWX_CAPTCHA_API_BASE=https://api.capmonster.cloud`
|
|
18
|
+
// works without code changes. Other providers (AntiCaptcha's
|
|
19
|
+
// `/createTask` + `/getTaskResult` flow, hCaptcha-specific endpoints)
|
|
20
|
+
// are extensible — drop a new branch in `submitToProvider` and add the
|
|
21
|
+
// provider name to `KNOWN_PROVIDERS`. We chose 2Captcha because (a) it
|
|
22
|
+
// and CapMonster between them cover the majority of real-world adopter
|
|
23
|
+
// captcha-solving setups, and (b) the polled-task model is the most
|
|
24
|
+
// widely-mirrored shape, so 2Captcha-compatible providers proliferate.
|
|
25
|
+
//
|
|
26
|
+
// - Posture: same class as `eval` / `network-body` / `secrets` / `extensions`
|
|
27
|
+
// / `stealth`. Loud one-time warning at server boot when the capability
|
|
28
|
+
// is on; the warning names the legal/ToS exposure explicitly. Many
|
|
29
|
+
// sites' terms of service prohibit "circumventing access controls"
|
|
30
|
+
// including captchas; using this tool against such sites is the
|
|
31
|
+
// operator's choice and their legal exposure.
|
|
32
|
+
import { log } from "../util/logging.js";
|
|
33
|
+
/** Provider names this version of the module knows how to talk to. Other
|
|
34
|
+
* providers can be added without breaking the env-config surface — new
|
|
35
|
+
* names just append. */
|
|
36
|
+
export const KNOWN_PROVIDERS = ["2captcha", "capmonster"];
|
|
37
|
+
const DEFAULT_BASE_FOR = {
|
|
38
|
+
"2captcha": "https://2captcha.com",
|
|
39
|
+
capmonster: "https://api.capmonster.cloud",
|
|
40
|
+
};
|
|
41
|
+
/** Read provider config from env. Returns `null` when nothing is configured —
|
|
42
|
+
* the caller surfaces a structured `ok:false` with a "no provider
|
|
43
|
+
* configured" hint rather than throwing (the capability is on but the
|
|
44
|
+
* deployment hasn't wired a solver — recoverable, not a server-startup
|
|
45
|
+
* error). Returns an `error` object on partial config (provider set without
|
|
46
|
+
* api-key, unknown provider name) so the agent sees a clear pointer. */
|
|
47
|
+
export function resolveCaptchaProvider(env = process.env) {
|
|
48
|
+
const rawProvider = env.BROWX_CAPTCHA_PROVIDER?.trim();
|
|
49
|
+
const rawKey = env.BROWX_CAPTCHA_API_KEY?.trim();
|
|
50
|
+
if (!rawProvider && !rawKey) {
|
|
51
|
+
return { ok: false, reason: "unconfigured" };
|
|
52
|
+
}
|
|
53
|
+
if (!rawProvider) {
|
|
54
|
+
return {
|
|
55
|
+
ok: false,
|
|
56
|
+
reason: "partial",
|
|
57
|
+
error: "BROWX_CAPTCHA_API_KEY is set but BROWX_CAPTCHA_PROVIDER is not — set both, or unset both.",
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (!rawKey) {
|
|
61
|
+
return {
|
|
62
|
+
ok: false,
|
|
63
|
+
reason: "partial",
|
|
64
|
+
error: `BROWX_CAPTCHA_PROVIDER="${rawProvider}" is set but BROWX_CAPTCHA_API_KEY is not — set both, or unset both.`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const provider = rawProvider.toLowerCase();
|
|
68
|
+
if (!KNOWN_PROVIDERS.includes(provider)) {
|
|
69
|
+
return {
|
|
70
|
+
ok: false,
|
|
71
|
+
reason: "partial",
|
|
72
|
+
error: `BROWX_CAPTCHA_PROVIDER="${rawProvider}" is not a known provider. ` +
|
|
73
|
+
`Known: ${KNOWN_PROVIDERS.join(", ")}. ` +
|
|
74
|
+
`Other providers can be supported by extending src/page/solve-captcha.ts.`,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const apiBase = (env.BROWX_CAPTCHA_API_BASE?.trim() || DEFAULT_BASE_FOR[provider]).replace(/\/+$/, "");
|
|
78
|
+
const timeout = parsePositiveIntEnv(env.BROWX_CAPTCHA_TIMEOUT_MS, 120_000, "BROWX_CAPTCHA_TIMEOUT_MS");
|
|
79
|
+
if (!timeout.ok)
|
|
80
|
+
return { ok: false, reason: "partial", error: timeout.error };
|
|
81
|
+
const poll = parsePositiveIntEnv(env.BROWX_CAPTCHA_POLL_MS, 5000, "BROWX_CAPTCHA_POLL_MS");
|
|
82
|
+
if (!poll.ok)
|
|
83
|
+
return { ok: false, reason: "partial", error: poll.error };
|
|
84
|
+
return {
|
|
85
|
+
ok: true,
|
|
86
|
+
config: { provider, apiKey: rawKey, apiBase, timeoutMs: timeout.value, pollMs: poll.value },
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** Parse a positive-integer env var (ms), falling back to `fallback` when unset.
|
|
90
|
+
* Returns a structured error message naming `varName` when it isn't a positive
|
|
91
|
+
* integer. */
|
|
92
|
+
function parsePositiveIntEnv(raw, fallback, varName) {
|
|
93
|
+
const trimmed = raw?.trim();
|
|
94
|
+
const value = trimmed ? Number.parseInt(trimmed, 10) : fallback;
|
|
95
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
96
|
+
return { ok: false, error: `${varName}="${trimmed}" must be a positive integer (ms).` };
|
|
97
|
+
}
|
|
98
|
+
return { ok: true, value };
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Submit a challenge to the configured provider and poll for the solution.
|
|
102
|
+
* Uses native `fetch` (Node 18+ ships it; Node 20 is the project's floor).
|
|
103
|
+
* The provider may return a transient busy state (`CAPCHA_NOT_READY`) — we
|
|
104
|
+
* poll until the deadline.
|
|
105
|
+
*
|
|
106
|
+
* `fetchImpl` parameter is injected so tests can stub it without a real
|
|
107
|
+
* network round-trip.
|
|
108
|
+
*/
|
|
109
|
+
/** Per-captcha-type submit-method config: the 2Captcha `method`, the form key
|
|
110
|
+
* the siteKey rides under, and an optional extra (e.g. recaptcha3 `version`). */
|
|
111
|
+
const SITEKEY_SUBMIT = {
|
|
112
|
+
recaptcha2: {
|
|
113
|
+
method: "userrecaptcha",
|
|
114
|
+
keyParam: "googlekey",
|
|
115
|
+
hint: "recaptcha2 requires a siteKey (the page's `data-sitekey` attribute)",
|
|
116
|
+
},
|
|
117
|
+
recaptcha3: {
|
|
118
|
+
method: "userrecaptcha",
|
|
119
|
+
keyParam: "googlekey",
|
|
120
|
+
extra: ["version", "v3"],
|
|
121
|
+
hint: "recaptcha3 requires a siteKey (the page's `data-sitekey` attribute)",
|
|
122
|
+
},
|
|
123
|
+
hcaptcha: {
|
|
124
|
+
method: "hcaptcha",
|
|
125
|
+
keyParam: "sitekey",
|
|
126
|
+
hint: "hcaptcha requires a siteKey (the hCaptcha widget's `data-sitekey`)",
|
|
127
|
+
},
|
|
128
|
+
turnstile: {
|
|
129
|
+
method: "turnstile",
|
|
130
|
+
keyParam: "sitekey",
|
|
131
|
+
hint: "turnstile requires a siteKey (Cloudflare Turnstile's `data-sitekey`)",
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
/** Build the 2Captcha `/in.php` form body for a challenge, or a structured
|
|
135
|
+
* failure when a required field (siteKey / imageBase64) is missing. */
|
|
136
|
+
function buildSubmitBody(challenge, config) {
|
|
137
|
+
const body = new URLSearchParams({ key: config.apiKey, json: "1" });
|
|
138
|
+
if (challenge.type === "image") {
|
|
139
|
+
if (!challenge.imageBase64) {
|
|
140
|
+
return {
|
|
141
|
+
error: failureWithHint(config.provider, "image captcha requires `imageBase64` (raw base64, no data URL prefix)"),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
body.set("method", "base64");
|
|
145
|
+
body.set("body", challenge.imageBase64);
|
|
146
|
+
return { body };
|
|
147
|
+
}
|
|
148
|
+
const spec = SITEKEY_SUBMIT[challenge.type];
|
|
149
|
+
if (!spec) {
|
|
150
|
+
return {
|
|
151
|
+
error: failureWithHint(config.provider, `unsupported captcha type "${String(challenge.type)}"`),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
if (!challenge.siteKey)
|
|
155
|
+
return { error: failureWithHint(config.provider, spec.hint) };
|
|
156
|
+
body.set("method", spec.method);
|
|
157
|
+
if (spec.extra)
|
|
158
|
+
body.set(spec.extra[0], spec.extra[1]);
|
|
159
|
+
body.set(spec.keyParam, challenge.siteKey);
|
|
160
|
+
body.set("pageurl", challenge.pageUrl);
|
|
161
|
+
return { body };
|
|
162
|
+
}
|
|
163
|
+
export async function submitToProvider(challenge, config, fetchImpl = fetch, nowFn = Date.now, sleepFn = (ms) => new Promise((res) => setTimeout(res, ms))) {
|
|
164
|
+
const started = nowFn();
|
|
165
|
+
const built = buildSubmitBody(challenge, config);
|
|
166
|
+
if ("error" in built)
|
|
167
|
+
return built.error;
|
|
168
|
+
const submitBody = built.body;
|
|
169
|
+
let submitResp;
|
|
170
|
+
try {
|
|
171
|
+
submitResp = await fetchImpl(`${config.apiBase}/in.php`, {
|
|
172
|
+
method: "POST",
|
|
173
|
+
headers: { "content-type": "application/x-www-form-urlencoded" },
|
|
174
|
+
body: submitBody.toString(),
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
return failureWithHint(config.provider, `network error submitting to provider: ${err instanceof Error ? err.message : String(err)}`);
|
|
179
|
+
}
|
|
180
|
+
if (!submitResp.ok) {
|
|
181
|
+
return failureWithHint(config.provider, `provider returned HTTP ${submitResp.status} on submit`);
|
|
182
|
+
}
|
|
183
|
+
let submitJson;
|
|
184
|
+
try {
|
|
185
|
+
submitJson = (await submitResp.json());
|
|
186
|
+
}
|
|
187
|
+
catch (err) {
|
|
188
|
+
return failureWithHint(config.provider, `provider returned non-JSON on submit: ${err instanceof Error ? err.message : String(err)}`);
|
|
189
|
+
}
|
|
190
|
+
if (submitJson.status !== 1 || !submitJson.request) {
|
|
191
|
+
return {
|
|
192
|
+
ok: false,
|
|
193
|
+
provider: config.provider,
|
|
194
|
+
error: `provider rejected submission: ${submitJson.request ?? "(no detail)"}`,
|
|
195
|
+
hint: submitJson.error_text ??
|
|
196
|
+
"Check the provider dashboard for account balance / blocked-method status.",
|
|
197
|
+
...(submitJson.request ? { providerCode: submitJson.request } : {}),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
return pollForSolution(submitJson.request, config, started, { fetchImpl, nowFn, sleepFn });
|
|
201
|
+
}
|
|
202
|
+
/** One poll tick: fetch /res.php once. Returns a terminal solution/failure, or
|
|
203
|
+
* null to keep polling (transient blip or still-working). */
|
|
204
|
+
async function pollOnce(taskId, config, started, seams) {
|
|
205
|
+
let pollResp;
|
|
206
|
+
try {
|
|
207
|
+
pollResp = await seams.fetchImpl(`${config.apiBase}/res.php?key=${encodeURIComponent(config.apiKey)}&action=get&id=${encodeURIComponent(taskId)}&json=1`);
|
|
208
|
+
}
|
|
209
|
+
catch (err) {
|
|
210
|
+
log.warn(`solve_captcha: poll network blip (${err instanceof Error ? err.message : String(err)}) — continuing`);
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
if (!pollResp.ok) {
|
|
214
|
+
log.warn(`solve_captcha: poll returned HTTP ${pollResp.status} — continuing`);
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
let pollJson;
|
|
218
|
+
try {
|
|
219
|
+
pollJson = (await pollResp.json());
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
if (pollJson.status === 1 && pollJson.request) {
|
|
225
|
+
return {
|
|
226
|
+
ok: true,
|
|
227
|
+
provider: config.provider,
|
|
228
|
+
solution: pollJson.request,
|
|
229
|
+
taskId,
|
|
230
|
+
elapsedMs: seams.nowFn() - started,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
// `status:0, request:"CAPCHA_NOT_READY"` is the canonical "still working"
|
|
234
|
+
// signal; any other request-string is a terminal error.
|
|
235
|
+
if (pollJson.request && pollJson.request !== "CAPCHA_NOT_READY") {
|
|
236
|
+
return {
|
|
237
|
+
ok: false,
|
|
238
|
+
provider: config.provider,
|
|
239
|
+
error: `provider returned terminal error: ${pollJson.request}`,
|
|
240
|
+
hint: pollJson.error_text ?? "Consult the provider documentation for this error code.",
|
|
241
|
+
providerCode: pollJson.request,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
return null; // still working — keep polling
|
|
245
|
+
}
|
|
246
|
+
/** Poll /res.php until ready or the deadline expires. */
|
|
247
|
+
async function pollForSolution(taskId, config, started, seams) {
|
|
248
|
+
while (true) {
|
|
249
|
+
if (seams.nowFn() - started > config.timeoutMs) {
|
|
250
|
+
return {
|
|
251
|
+
ok: false,
|
|
252
|
+
provider: config.provider,
|
|
253
|
+
error: `provider did not return a solution within ${config.timeoutMs}ms`,
|
|
254
|
+
hint: "Increase BROWX_CAPTCHA_TIMEOUT_MS, or check the provider dashboard — repeated timeouts usually mean the worker pool is overloaded.",
|
|
255
|
+
providerCode: taskId,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
await seams.sleepFn(config.pollMs);
|
|
259
|
+
const outcome = await pollOnce(taskId, config, started, seams);
|
|
260
|
+
if (outcome)
|
|
261
|
+
return outcome;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function failureWithHint(provider, error) {
|
|
265
|
+
return {
|
|
266
|
+
ok: false,
|
|
267
|
+
provider,
|
|
268
|
+
error,
|
|
269
|
+
hint: "Validate the captcha challenge inputs against the provider's API docs " +
|
|
270
|
+
"(https://2captcha.com/2captcha-api for 2Captcha / CapMonster-compatible providers).",
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
/** Build the structured "no provider configured" failure — used when the
|
|
274
|
+
* capability is on but env vars are unset. Hints at exactly what to set and
|
|
275
|
+
* names the per-deployment / no-bundled-solver / no-auto-purchase posture. */
|
|
276
|
+
export function unconfiguredFailure() {
|
|
277
|
+
return {
|
|
278
|
+
ok: false,
|
|
279
|
+
provider: null,
|
|
280
|
+
error: "no captcha provider configured — `solve_captcha` cannot delegate.",
|
|
281
|
+
hint: 'Set BROWX_CAPTCHA_PROVIDER (e.g. "2captcha" or "capmonster") and BROWX_CAPTCHA_API_KEY in the server\'s ' +
|
|
282
|
+
"environment to enable delegation. browxai does NOT bundle a solver and does NOT auto-purchase credits — the " +
|
|
283
|
+
"operator chooses a provider, funds the account, and configures the server. Known providers in this version: " +
|
|
284
|
+
`${KNOWN_PROVIDERS.join(", ")} (both speak the 2Captcha-compatible HTTP API).`,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import type { CookieInput, StorageStateBlob, WebStorageKind } from "../session/storage.js";
|
|
2
|
+
import type { CacheEntryBody } from "../session/cache-storage.js";
|
|
3
|
+
/** A cookie as returned by a `cookiesList`. The Playwright path returns the full
|
|
4
|
+
* Playwright cookie object; the Safari path returns the WebDriver cookie shape.
|
|
5
|
+
* Both carry at least `name` + `value`, which is all the handler renders. */
|
|
6
|
+
export type ListedCookie = StorageStateBlob["cookies"][number] | SafariListedCookie;
|
|
7
|
+
/** The WebDriver Classic cookie shape safaridriver returns from `GET /cookie`. */
|
|
8
|
+
export interface SafariListedCookie {
|
|
9
|
+
name: string;
|
|
10
|
+
value: string;
|
|
11
|
+
domain?: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
secure?: boolean;
|
|
14
|
+
httpOnly?: boolean;
|
|
15
|
+
expiry?: number;
|
|
16
|
+
sameSite?: "Lax" | "Strict" | "None";
|
|
17
|
+
}
|
|
18
|
+
/** Normalised cookie-list request — the handler's already-validated args, engine-
|
|
19
|
+
* blind. `urls` is the Playwright native cross-domain filter; it is honoured by the
|
|
20
|
+
* Playwright path and inert on Safari (WebDriver scopes the jar to the current
|
|
21
|
+
* document, the same as the pre-seam Safari branch). */
|
|
22
|
+
export interface CookiesListRequest {
|
|
23
|
+
urls?: string[];
|
|
24
|
+
}
|
|
25
|
+
/** A single web-storage entry — the shape `*_list` renders per key. */
|
|
26
|
+
export interface WebStorageEntry {
|
|
27
|
+
key: string;
|
|
28
|
+
value: string;
|
|
29
|
+
}
|
|
30
|
+
/** The IDB result shapes — the universal envelopes the idb handlers render. They
|
|
31
|
+
* mirror the `idb*` helper return types verbatim so the Playwright path is a
|
|
32
|
+
* pass-through and the four engines' keystones stay byte-identical. */
|
|
33
|
+
export interface IdbDatabasesResult {
|
|
34
|
+
databases: Array<{
|
|
35
|
+
name: string;
|
|
36
|
+
version: number;
|
|
37
|
+
}>;
|
|
38
|
+
origin: string;
|
|
39
|
+
supported: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface IdbStoresResult {
|
|
42
|
+
stores: string[];
|
|
43
|
+
dbName: string;
|
|
44
|
+
version: number;
|
|
45
|
+
origin: string;
|
|
46
|
+
}
|
|
47
|
+
export type IdbGetResult = {
|
|
48
|
+
found: false;
|
|
49
|
+
dbName: string;
|
|
50
|
+
storeName: string;
|
|
51
|
+
key: unknown;
|
|
52
|
+
origin: string;
|
|
53
|
+
} | {
|
|
54
|
+
found: true;
|
|
55
|
+
dbName: string;
|
|
56
|
+
storeName: string;
|
|
57
|
+
key: unknown;
|
|
58
|
+
value: unknown;
|
|
59
|
+
origin: string;
|
|
60
|
+
};
|
|
61
|
+
export interface IdbWriteResult {
|
|
62
|
+
ok: true;
|
|
63
|
+
dbName: string;
|
|
64
|
+
storeName: string;
|
|
65
|
+
key: unknown;
|
|
66
|
+
origin: string;
|
|
67
|
+
}
|
|
68
|
+
export interface IdbClearResult {
|
|
69
|
+
ok: true;
|
|
70
|
+
dbName: string;
|
|
71
|
+
storeName: string;
|
|
72
|
+
origin: string;
|
|
73
|
+
}
|
|
74
|
+
/** The Cache API result shapes — the universal envelopes the caches handlers
|
|
75
|
+
* render. They mirror the `caches*` helper return types verbatim so the
|
|
76
|
+
* Playwright path is a pass-through and the four engines' keystones stay
|
|
77
|
+
* byte-identical. `CachesGetResult` reuses the helper's `CacheEntryBody` so the
|
|
78
|
+
* text/binary split is shared, not re-declared. */
|
|
79
|
+
export interface CachesListStoragesResult {
|
|
80
|
+
names: string[];
|
|
81
|
+
origin: string;
|
|
82
|
+
}
|
|
83
|
+
export interface CachesListResult {
|
|
84
|
+
entries: Array<{
|
|
85
|
+
url: string;
|
|
86
|
+
method: string;
|
|
87
|
+
}>;
|
|
88
|
+
origin: string;
|
|
89
|
+
cacheName: string;
|
|
90
|
+
}
|
|
91
|
+
export type CachesGetResult = {
|
|
92
|
+
found: false;
|
|
93
|
+
cacheName: string;
|
|
94
|
+
url: string;
|
|
95
|
+
origin: string;
|
|
96
|
+
} | (CacheEntryBody & {
|
|
97
|
+
found: true;
|
|
98
|
+
cacheName: string;
|
|
99
|
+
url: string;
|
|
100
|
+
origin: string;
|
|
101
|
+
});
|
|
102
|
+
export interface CachesPutResult {
|
|
103
|
+
ok: true;
|
|
104
|
+
cacheName: string;
|
|
105
|
+
url: string;
|
|
106
|
+
origin: string;
|
|
107
|
+
}
|
|
108
|
+
export interface CachesDeleteResult {
|
|
109
|
+
ok: true;
|
|
110
|
+
existed: boolean;
|
|
111
|
+
cacheName: string;
|
|
112
|
+
url: string;
|
|
113
|
+
origin: string;
|
|
114
|
+
}
|
|
115
|
+
export interface CachesClearResult {
|
|
116
|
+
ok: true;
|
|
117
|
+
cleared: number;
|
|
118
|
+
cacheName: string;
|
|
119
|
+
origin: string;
|
|
120
|
+
}
|
|
121
|
+
export interface CachesDeleteStorageResult {
|
|
122
|
+
ok: true;
|
|
123
|
+
existed: boolean;
|
|
124
|
+
cacheName: string;
|
|
125
|
+
origin: string;
|
|
126
|
+
}
|
|
127
|
+
/** The storage capability port. One instance wraps one session's engine handle;
|
|
128
|
+
* the methods carry no engine type, so the handlers above this seam are
|
|
129
|
+
* engine-blind. Mirrors the ActionSubstrate / CaptureSubstrate shape. The
|
|
130
|
+
* web-storage methods take `kind` (localStorage | sessionStorage) — the JS
|
|
131
|
+
* surface is identical, only the storage object differs — plus the handler's
|
|
132
|
+
* `tool` name, so the validation/guard error messages read the same as the
|
|
133
|
+
* pre-seam helper path on every engine. */
|
|
134
|
+
export interface StorageSubstrate {
|
|
135
|
+
readonly engine: string;
|
|
136
|
+
cookiesList(req: CookiesListRequest): Promise<ListedCookie[]>;
|
|
137
|
+
cookiesSet(req: CookieInput): Promise<{
|
|
138
|
+
ok: boolean;
|
|
139
|
+
name: string;
|
|
140
|
+
}>;
|
|
141
|
+
webStorageGet(kind: WebStorageKind, args: {
|
|
142
|
+
key: string;
|
|
143
|
+
}, tool: string): Promise<{
|
|
144
|
+
value: string | null;
|
|
145
|
+
origin: string;
|
|
146
|
+
}>;
|
|
147
|
+
webStorageList(kind: WebStorageKind, tool: string): Promise<{
|
|
148
|
+
entries: WebStorageEntry[];
|
|
149
|
+
origin: string;
|
|
150
|
+
}>;
|
|
151
|
+
webStorageSet(kind: WebStorageKind, args: {
|
|
152
|
+
key: string;
|
|
153
|
+
value: string;
|
|
154
|
+
}, tool: string): Promise<{
|
|
155
|
+
ok: true;
|
|
156
|
+
origin: string;
|
|
157
|
+
}>;
|
|
158
|
+
webStorageDelete(kind: WebStorageKind, args: {
|
|
159
|
+
key: string;
|
|
160
|
+
}, tool: string): Promise<{
|
|
161
|
+
ok: true;
|
|
162
|
+
origin: string;
|
|
163
|
+
}>;
|
|
164
|
+
webStorageClear(kind: WebStorageKind, tool: string): Promise<{
|
|
165
|
+
ok: true;
|
|
166
|
+
origin: string;
|
|
167
|
+
}>;
|
|
168
|
+
idbListDatabases(tool: string): Promise<IdbDatabasesResult>;
|
|
169
|
+
idbListStores(args: {
|
|
170
|
+
dbName: string;
|
|
171
|
+
}, tool: string): Promise<IdbStoresResult>;
|
|
172
|
+
idbGet(args: {
|
|
173
|
+
dbName: string;
|
|
174
|
+
storeName: string;
|
|
175
|
+
key: unknown;
|
|
176
|
+
}, tool: string): Promise<IdbGetResult>;
|
|
177
|
+
idbPut(args: {
|
|
178
|
+
dbName: string;
|
|
179
|
+
storeName: string;
|
|
180
|
+
key: unknown;
|
|
181
|
+
value: unknown;
|
|
182
|
+
}, tool: string): Promise<IdbWriteResult>;
|
|
183
|
+
idbDelete(args: {
|
|
184
|
+
dbName: string;
|
|
185
|
+
storeName: string;
|
|
186
|
+
key: unknown;
|
|
187
|
+
}, tool: string): Promise<IdbWriteResult>;
|
|
188
|
+
idbClear(args: {
|
|
189
|
+
dbName: string;
|
|
190
|
+
storeName: string;
|
|
191
|
+
}, tool: string): Promise<IdbClearResult>;
|
|
192
|
+
cachesListStorages(tool: string): Promise<CachesListStoragesResult>;
|
|
193
|
+
cachesList(args: {
|
|
194
|
+
cacheName: string;
|
|
195
|
+
urlPattern?: string;
|
|
196
|
+
}, tool: string): Promise<CachesListResult>;
|
|
197
|
+
cachesGet(args: {
|
|
198
|
+
cacheName: string;
|
|
199
|
+
url: string;
|
|
200
|
+
}, tool: string): Promise<CachesGetResult>;
|
|
201
|
+
cachesPut(args: {
|
|
202
|
+
cacheName: string;
|
|
203
|
+
url: string;
|
|
204
|
+
response: {
|
|
205
|
+
status?: number;
|
|
206
|
+
headers?: Record<string, string>;
|
|
207
|
+
body?: string;
|
|
208
|
+
contentBase64?: string;
|
|
209
|
+
};
|
|
210
|
+
}, tool: string): Promise<CachesPutResult>;
|
|
211
|
+
cachesDelete(args: {
|
|
212
|
+
cacheName: string;
|
|
213
|
+
url: string;
|
|
214
|
+
}, tool: string): Promise<CachesDeleteResult>;
|
|
215
|
+
cachesClear(args: {
|
|
216
|
+
cacheName: string;
|
|
217
|
+
}, tool: string): Promise<CachesClearResult>;
|
|
218
|
+
cachesDeleteStorage(args: {
|
|
219
|
+
cacheName: string;
|
|
220
|
+
}, tool: string): Promise<CachesDeleteStorageResult>;
|
|
221
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// StorageSubstrate port + result types — the engine-agnostic vocabulary the
|
|
2
|
+
// storage tools speak (cookies + web-storage + IndexedDB + Cache API). Split out
|
|
3
|
+
// of storage-substrate.ts so neither the interface nor its two implementations
|
|
4
|
+
// push that file over the size budget. Re-exported through
|
|
5
|
+
// `./storage-substrate.js` so callers import unchanged.
|
|
6
|
+
export {};
|