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,109 @@
|
|
|
1
|
+
import type { BrowserContext, CDPSession, Page } from "playwright-core";
|
|
2
|
+
import type { SecretRegistry } from "../util/secrets.js";
|
|
3
|
+
import { NetworkBuffer, WsBuffer, type NetworkEntry, type NetworkSummary, type MutationEntry, type SessionNetworkRing, type SessionWsRing } from "./network.js";
|
|
4
|
+
import { PlaywrightNetworkBuffer, PlaywrightWsBuffer } from "./network-playwright.js";
|
|
5
|
+
/** The per-action network tap — opened before an action dispatches, closed after
|
|
6
|
+
* the settle window. `close()` returns the same `{summary, requests, mutations}`
|
|
7
|
+
* shape on every engine so the ActionResult envelope builder is engine-blind. */
|
|
8
|
+
export interface ActionNetworkTap {
|
|
9
|
+
open(): Promise<void>;
|
|
10
|
+
close(): Promise<{
|
|
11
|
+
summary: NetworkSummary;
|
|
12
|
+
requests: NetworkEntry[];
|
|
13
|
+
mutations: MutationEntry[];
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
/** The full-response-body result shape returned by `fetchBody` — the same shape
|
|
17
|
+
* `fetchResponseBody` (the CDP path) returns, so `network_body` is engine-blind. */
|
|
18
|
+
export interface FetchBodyResult {
|
|
19
|
+
ok: boolean;
|
|
20
|
+
body?: string;
|
|
21
|
+
base64Encoded?: boolean;
|
|
22
|
+
truncated?: boolean;
|
|
23
|
+
error?: string;
|
|
24
|
+
}
|
|
25
|
+
/** The network observation source the network tools + the action window consume.
|
|
26
|
+
* One instance wraps one session's engine handle(s); the methods carry no engine
|
|
27
|
+
* type, so the surface above this seam is engine-agnostic. Mirrors the
|
|
28
|
+
* SnapshotSubstrate shape: an interface selected by capability, the handle
|
|
29
|
+
* captured at construction, the session-wide buffers owned here and attached
|
|
30
|
+
* once, no per-call allocation on the hot path beyond the per-action tap the CDP
|
|
31
|
+
* path already allocated. */
|
|
32
|
+
export interface NetworkSubstrate {
|
|
33
|
+
/** Engine tag — for diagnostics + the per-engine keystone matrix. */
|
|
34
|
+
readonly engine: string;
|
|
35
|
+
/** Session-wide ring of recent HTTP requests (network_read; asset_export's
|
|
36
|
+
* `iter()`; session_metrics). Attached once at session creation. */
|
|
37
|
+
readonly http: SessionNetworkRing;
|
|
38
|
+
/** Session-wide ring of recent WebSocket / SSE frames (ws_read; the action
|
|
39
|
+
* window's `wsFrames` slice via `since()`). Attached once at session
|
|
40
|
+
* creation. */
|
|
41
|
+
readonly ws: SessionWsRing;
|
|
42
|
+
/** Attach the session-wide rings to their engine source. Idempotent. */
|
|
43
|
+
attach(): Promise<void>;
|
|
44
|
+
/** Wire the per-session secrets registry into every egress sink the substrate
|
|
45
|
+
* owns (both rings + the per-action taps it mints). */
|
|
46
|
+
setSecrets(secrets: SecretRegistry): void;
|
|
47
|
+
/** Mint a per-action tap for one action window. On chromium this is the
|
|
48
|
+
* verbatim CDP `NetworkTap`; off Chromium it is the Playwright-event tap. */
|
|
49
|
+
openActionTap(): ActionNetworkTap;
|
|
50
|
+
/** Fetch a full response body by request id (network_body, capability
|
|
51
|
+
* `network-body`). CDP fetches on demand; the Playwright path returns a body
|
|
52
|
+
* captured at response time. */
|
|
53
|
+
fetchBody(requestId: string, secrets: SecretRegistry | null): Promise<FetchBodyResult>;
|
|
54
|
+
}
|
|
55
|
+
/** Chromium substrate — the existing CDP network path, moved behind the interface
|
|
56
|
+
* VERBATIM. The buffers are the same `NetworkBuffer` / `WsBuffer` constructed on
|
|
57
|
+
* the CDP handle, `openActionTap` mints the same `NetworkTap`, and `fetchBody`
|
|
58
|
+
* delegates to the same `fetchResponseBody`. Output is byte-identical to the
|
|
59
|
+
* pre-seam path, so the chromium keystones + unit tests are unchanged. The CDP
|
|
60
|
+
* handle is captured here once; callers never see it. */
|
|
61
|
+
export declare class CdpNetworkSubstrate implements NetworkSubstrate {
|
|
62
|
+
private readonly cdp;
|
|
63
|
+
readonly engine = "chromium";
|
|
64
|
+
readonly http: NetworkBuffer;
|
|
65
|
+
readonly ws: WsBuffer;
|
|
66
|
+
private secrets;
|
|
67
|
+
constructor(cdp: CDPSession);
|
|
68
|
+
attach(): Promise<void>;
|
|
69
|
+
setSecrets(secrets: SecretRegistry): void;
|
|
70
|
+
openActionTap(): ActionNetworkTap;
|
|
71
|
+
fetchBody(requestId: string, secrets: SecretRegistry | null): Promise<FetchBodyResult>;
|
|
72
|
+
}
|
|
73
|
+
/** Firefox / WebKit substrate — the Playwright context-event network path. No
|
|
74
|
+
* CDP. The session-wide rings are `PlaywrightNetworkBuffer` / `PlaywrightWsBuffer`
|
|
75
|
+
* (the same ring shapes, fed by `context.on('request'|'response'|'requestfailed')`
|
|
76
|
+
* and `page.on('websocket')`). The per-action tap is the Playwright-event
|
|
77
|
+
* `PlaywrightNetworkTap`, and `fetchBody` reads from the body cache the buffer
|
|
78
|
+
* captured at response time. */
|
|
79
|
+
export declare class PlaywrightNetworkSubstrate implements NetworkSubstrate {
|
|
80
|
+
private readonly context;
|
|
81
|
+
readonly engine: string;
|
|
82
|
+
readonly http: PlaywrightNetworkBuffer;
|
|
83
|
+
readonly ws: PlaywrightWsBuffer;
|
|
84
|
+
private secrets;
|
|
85
|
+
constructor(context: BrowserContext, page: Page, engine?: string);
|
|
86
|
+
attach(): Promise<void>;
|
|
87
|
+
setSecrets(secrets: SecretRegistry): void;
|
|
88
|
+
openActionTap(): ActionNetworkTap;
|
|
89
|
+
fetchBody(requestId: string, secrets: SecretRegistry | null): Promise<FetchBodyResult>;
|
|
90
|
+
}
|
|
91
|
+
/** Safari substrate — a NO-OP. Real Safari has NO protocol-level
|
|
92
|
+
* network observation or interception at all: safaridriver's WebDriver Classic
|
|
93
|
+
* has no network tap, and Safari's experimental BiDi ships only
|
|
94
|
+
* `network.setCacheBehavior` (the `network` observation domain is absent). So
|
|
95
|
+
* the network tools are
|
|
96
|
+
* capability-gated on Safari and the action-window network slice is empty. This
|
|
97
|
+
* empty substrate keeps the session-creation + envelope code engine-blind: the
|
|
98
|
+
* rings are always empty, the per-action tap reports zero traffic, and
|
|
99
|
+
* `network_body` returns a structured "not available". It is never the source of
|
|
100
|
+
* truth for any surfaced network claim — the gate refuses the tools first. */
|
|
101
|
+
export declare class SafariNoopNetworkSubstrate implements NetworkSubstrate {
|
|
102
|
+
readonly engine = "safari";
|
|
103
|
+
readonly http: SessionNetworkRing;
|
|
104
|
+
readonly ws: SessionWsRing;
|
|
105
|
+
attach(): Promise<void>;
|
|
106
|
+
setSecrets(): void;
|
|
107
|
+
openActionTap(): ActionNetworkTap;
|
|
108
|
+
fetchBody(): Promise<FetchBodyResult>;
|
|
109
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// The NetworkSubstrate interface — the engine-agnostic seam beneath the network
|
|
2
|
+
// tools (network_read / ws_read / network_body) and the per-action ActionResult
|
|
3
|
+
// network slice. It is the network side of the hybrid network substrate, with
|
|
4
|
+
// Playwright events as the portable layer: the tools + the action window ask a
|
|
5
|
+
// substrate for "the session network ring", "the WS/SSE ring", "a per-action tap",
|
|
6
|
+
// and "a response body"; an engine-specific implementation answers.
|
|
7
|
+
//
|
|
8
|
+
// Dependency direction: tools / action-window →
|
|
9
|
+
// NetworkSubstrate (this interface) → implementation → CDP / Playwright events. A
|
|
10
|
+
// tool never reaches a CDPSession or a raw context event through this seam; the
|
|
11
|
+
// engine handle is captured at substrate construction, so the per-call surface
|
|
12
|
+
// carries no engine type. That is what un-couples the network slice from CDP and
|
|
13
|
+
// lets network_read / ws_read / network_body run on Firefox.
|
|
14
|
+
//
|
|
15
|
+
// Two implementations behind it (hybrid):
|
|
16
|
+
// - CdpNetworkSubstrate (chromium): owns the EXISTING NetworkBuffer / WsBuffer /
|
|
17
|
+
// NetworkTap / fetchResponseBody CDP path VERBATIM — byte-identical buffers
|
|
18
|
+
// and per-action tap, so the chromium keystones + unit tests stay green
|
|
19
|
+
// unchanged. The CDP path is kept on chromium deliberately: the envelope is
|
|
20
|
+
// browxai's hottest path and benchmarking put the CDP
|
|
21
|
+
// tap at parity with the event tap on chromium, so there is no reason to move
|
|
22
|
+
// chromium off the substrate it already has.
|
|
23
|
+
// - PlaywrightNetworkSubstrate (firefox / webkit): the Playwright context
|
|
24
|
+
// `request` / `response` / `requestfailed` events feed the same NetworkBuffer
|
|
25
|
+
// shape; `page.on('websocket')` `framesent` / `framereceived` feed the same
|
|
26
|
+
// WsBuffer shape. network_body captures the response body at response time
|
|
27
|
+
// (Playwright `response.body()`), because — unlike CDP `Network.getResponseBody`
|
|
28
|
+
// — there is no after-the-fact body fetch off Chromium.
|
|
29
|
+
//
|
|
30
|
+
// Documented degradation off Chromium (honest, not a regression):
|
|
31
|
+
// - resourceType nuance: Playwright `request.resourceType()` is lowercase and a
|
|
32
|
+
// slightly coarser taxonomy than CDP's; mapped to the CDP-capitalised bucket
|
|
33
|
+
// names so the noise-folding + `byType` summary stay identical in shape.
|
|
34
|
+
// - timing precision: `ms` is wall-clock (request-seen → response-seen), the
|
|
35
|
+
// same approximation the CDP tap uses — no high-resolution `timing()` deltas.
|
|
36
|
+
// - body availability: bodies are captured at response time into a bounded LRU
|
|
37
|
+
// keyed by a synthetic request id; a body for a request that predates the
|
|
38
|
+
// capture window (or was evicted) is reported "not available", same best-
|
|
39
|
+
// effort contract as the CDP renderer-discard behaviour.
|
|
40
|
+
import { NetworkBuffer, WsBuffer, NetworkTap, fetchResponseBody, } from "./network.js";
|
|
41
|
+
// RFC 0004 P4 / D10 — the off-Chromium Playwright network classes are imported
|
|
42
|
+
// DIRECTLY from their defining module, not re-exported through the `network.js`
|
|
43
|
+
// barrel. The barrel re-export was a genuine RUNTIME cycle
|
|
44
|
+
// (`network.ts` → `network-playwright.ts` → `network.ts`); routing this sole
|
|
45
|
+
// runtime consumer to the source module breaks it so the no-circular rule is
|
|
46
|
+
// clean at `error`. (network-playwright.ts still imports runtime helpers from
|
|
47
|
+
// network.ts — that edge is one-directional now, so no cycle.)
|
|
48
|
+
import { PlaywrightNetworkBuffer, PlaywrightWsBuffer, PlaywrightNetworkTap, } from "./network-playwright.js";
|
|
49
|
+
/** Chromium substrate — the existing CDP network path, moved behind the interface
|
|
50
|
+
* VERBATIM. The buffers are the same `NetworkBuffer` / `WsBuffer` constructed on
|
|
51
|
+
* the CDP handle, `openActionTap` mints the same `NetworkTap`, and `fetchBody`
|
|
52
|
+
* delegates to the same `fetchResponseBody`. Output is byte-identical to the
|
|
53
|
+
* pre-seam path, so the chromium keystones + unit tests are unchanged. The CDP
|
|
54
|
+
* handle is captured here once; callers never see it. */
|
|
55
|
+
export class CdpNetworkSubstrate {
|
|
56
|
+
cdp;
|
|
57
|
+
engine = "chromium";
|
|
58
|
+
http;
|
|
59
|
+
ws;
|
|
60
|
+
secrets = null;
|
|
61
|
+
constructor(cdp) {
|
|
62
|
+
this.cdp = cdp;
|
|
63
|
+
this.http = new NetworkBuffer(cdp);
|
|
64
|
+
this.ws = new WsBuffer(cdp);
|
|
65
|
+
}
|
|
66
|
+
async attach() {
|
|
67
|
+
await this.http.attach();
|
|
68
|
+
await this.ws.attach();
|
|
69
|
+
}
|
|
70
|
+
setSecrets(secrets) {
|
|
71
|
+
this.secrets = secrets;
|
|
72
|
+
this.http.setSecrets(secrets);
|
|
73
|
+
this.ws.setSecrets(secrets);
|
|
74
|
+
}
|
|
75
|
+
openActionTap() {
|
|
76
|
+
return new NetworkTap(this.cdp, this.secrets);
|
|
77
|
+
}
|
|
78
|
+
fetchBody(requestId, secrets) {
|
|
79
|
+
return fetchResponseBody(this.cdp, requestId, undefined, secrets);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Firefox / WebKit substrate — the Playwright context-event network path. No
|
|
83
|
+
* CDP. The session-wide rings are `PlaywrightNetworkBuffer` / `PlaywrightWsBuffer`
|
|
84
|
+
* (the same ring shapes, fed by `context.on('request'|'response'|'requestfailed')`
|
|
85
|
+
* and `page.on('websocket')`). The per-action tap is the Playwright-event
|
|
86
|
+
* `PlaywrightNetworkTap`, and `fetchBody` reads from the body cache the buffer
|
|
87
|
+
* captured at response time. */
|
|
88
|
+
export class PlaywrightNetworkSubstrate {
|
|
89
|
+
context;
|
|
90
|
+
engine;
|
|
91
|
+
http;
|
|
92
|
+
ws;
|
|
93
|
+
secrets = null;
|
|
94
|
+
constructor(context, page, engine = "firefox") {
|
|
95
|
+
this.context = context;
|
|
96
|
+
this.engine = engine;
|
|
97
|
+
this.http = new PlaywrightNetworkBuffer(context);
|
|
98
|
+
this.ws = new PlaywrightWsBuffer(page);
|
|
99
|
+
}
|
|
100
|
+
async attach() {
|
|
101
|
+
await this.http.attach();
|
|
102
|
+
await this.ws.attach();
|
|
103
|
+
}
|
|
104
|
+
setSecrets(secrets) {
|
|
105
|
+
this.secrets = secrets;
|
|
106
|
+
this.http.setSecrets(secrets);
|
|
107
|
+
this.ws.setSecrets(secrets);
|
|
108
|
+
}
|
|
109
|
+
openActionTap() {
|
|
110
|
+
return new PlaywrightNetworkTap(this.context, this.secrets);
|
|
111
|
+
}
|
|
112
|
+
fetchBody(requestId, secrets) {
|
|
113
|
+
return this.http.fetchBody(requestId, secrets);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** Safari substrate — a NO-OP. Real Safari has NO protocol-level
|
|
117
|
+
* network observation or interception at all: safaridriver's WebDriver Classic
|
|
118
|
+
* has no network tap, and Safari's experimental BiDi ships only
|
|
119
|
+
* `network.setCacheBehavior` (the `network` observation domain is absent). So
|
|
120
|
+
* the network tools are
|
|
121
|
+
* capability-gated on Safari and the action-window network slice is empty. This
|
|
122
|
+
* empty substrate keeps the session-creation + envelope code engine-blind: the
|
|
123
|
+
* rings are always empty, the per-action tap reports zero traffic, and
|
|
124
|
+
* `network_body` returns a structured "not available". It is never the source of
|
|
125
|
+
* truth for any surfaced network claim — the gate refuses the tools first. */
|
|
126
|
+
export class SafariNoopNetworkSubstrate {
|
|
127
|
+
engine = "safari";
|
|
128
|
+
http = {
|
|
129
|
+
setSecrets: () => undefined,
|
|
130
|
+
iter: () => [],
|
|
131
|
+
recent: () => ({ summary: { total: 0, byType: {}, failed: 0 }, requests: [] }),
|
|
132
|
+
};
|
|
133
|
+
ws = {
|
|
134
|
+
setSecrets: () => undefined,
|
|
135
|
+
recent: () => ({ total: 0, frames: [] }),
|
|
136
|
+
since: () => [],
|
|
137
|
+
};
|
|
138
|
+
attach() {
|
|
139
|
+
return Promise.resolve();
|
|
140
|
+
}
|
|
141
|
+
setSecrets() {
|
|
142
|
+
// No egress sinks to wire — the rings + tap are permanently empty on Safari.
|
|
143
|
+
}
|
|
144
|
+
openActionTap() {
|
|
145
|
+
return {
|
|
146
|
+
open: () => Promise.resolve(),
|
|
147
|
+
close: () => Promise.resolve({
|
|
148
|
+
summary: { total: 0, byType: {}, failed: 0 },
|
|
149
|
+
requests: [],
|
|
150
|
+
mutations: [],
|
|
151
|
+
}),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
fetchBody() {
|
|
155
|
+
return Promise.resolve({
|
|
156
|
+
ok: false,
|
|
157
|
+
error: "network_body is not available on the safari engine — Safari exposes no protocol-level " +
|
|
158
|
+
"network observation. Use a chromium/firefox/webkit session for network bodies.",
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CDPSession } from "playwright-core";
|
|
2
|
+
import type { SecretRegistry } from "../util/secrets.js";
|
|
3
|
+
export interface WsFrame {
|
|
4
|
+
/** WS/SSE endpoint URL (best-effort — empty if the create event was missed). */
|
|
5
|
+
url: string;
|
|
6
|
+
dir: "sent" | "recv";
|
|
7
|
+
kind: "ws" | "sse";
|
|
8
|
+
/** WS opcode (1=text, 2=binary, 8=close, 9=ping, 10=pong). Absent for SSE. */
|
|
9
|
+
opcode?: number;
|
|
10
|
+
/** SSE event name when present (`eventName` from CDP). */
|
|
11
|
+
event?: string;
|
|
12
|
+
/** Payload, truncated to `maxPayload` chars. */
|
|
13
|
+
payload: string;
|
|
14
|
+
truncated?: boolean;
|
|
15
|
+
ts: number;
|
|
16
|
+
}
|
|
17
|
+
/** Egress sanitizer for a WS/SSE frame: redact the endpoint url, any url
|
|
18
|
+
* substrings inside the payload (a stream payload can echo a credentialled
|
|
19
|
+
* URL too), and any registered-secret real-values that landed in the
|
|
20
|
+
* payload (chat / multiplayer / live-dashboard broadcasts routinely echo
|
|
21
|
+
* the auth blob the client sent). Returns a copy — the ring keeps raw
|
|
22
|
+
* frames for url filtering. */
|
|
23
|
+
export declare function sanitizeFrame(f: WsFrame, secrets: SecretRegistry | null): WsFrame;
|
|
24
|
+
export declare class WsBuffer {
|
|
25
|
+
private cdp;
|
|
26
|
+
private cap;
|
|
27
|
+
private maxPayload;
|
|
28
|
+
private urls;
|
|
29
|
+
private ring;
|
|
30
|
+
private enabled;
|
|
31
|
+
/** Optional per-session secrets registry; egress masking is applied on
|
|
32
|
+
* every `recent` / `since` read. */
|
|
33
|
+
private secrets;
|
|
34
|
+
constructor(cdp: CDPSession | undefined, cap?: number, maxPayload?: number);
|
|
35
|
+
setSecrets(secrets: SecretRegistry): void;
|
|
36
|
+
private trunc;
|
|
37
|
+
private push;
|
|
38
|
+
attach(): Promise<void>;
|
|
39
|
+
/** Most-recent N frames, optionally filtered by a url substring. */
|
|
40
|
+
recent(limit?: number, urlPattern?: string): {
|
|
41
|
+
total: number;
|
|
42
|
+
frames: WsFrame[];
|
|
43
|
+
};
|
|
44
|
+
/** Frames since a timestamp — for the per-action `ActionResult` slice. */
|
|
45
|
+
since(ts: number, cap?: number): WsFrame[];
|
|
46
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// WebSocket / Server-Sent-Events frame capture (CDP substrate).
|
|
2
|
+
//
|
|
3
|
+
// The realtime slice of a session: anything that streams over a long-lived
|
|
4
|
+
// connection (chat, multiplayer, collaborative editing, live dashboards) is only
|
|
5
|
+
// observable at the frame level. `WsBuffer` is the session-wide analogue of
|
|
6
|
+
// `NetworkBuffer`: a bounded ring of recent WS/SSE frames, payloads truncated.
|
|
7
|
+
//
|
|
8
|
+
// The frame shape (`WsFrame`) and the egress sanitiser (`sanitizeFrame`) are
|
|
9
|
+
// shared with the off-Chromium Playwright WS ring (`network-playwright.ts`);
|
|
10
|
+
// they live here, the home of the WS concern, and are re-exported through the
|
|
11
|
+
// `./network.js` barrel so callers import them unchanged.
|
|
12
|
+
import { maskedText, maskedUrl } from "./network-mask.js";
|
|
13
|
+
/** Egress sanitizer for a WS/SSE frame: redact the endpoint url, any url
|
|
14
|
+
* substrings inside the payload (a stream payload can echo a credentialled
|
|
15
|
+
* URL too), and any registered-secret real-values that landed in the
|
|
16
|
+
* payload (chat / multiplayer / live-dashboard broadcasts routinely echo
|
|
17
|
+
* the auth blob the client sent). Returns a copy — the ring keeps raw
|
|
18
|
+
* frames for url filtering. */
|
|
19
|
+
export function sanitizeFrame(f, secrets) {
|
|
20
|
+
return {
|
|
21
|
+
...f,
|
|
22
|
+
url: maskedUrl(f.url, secrets),
|
|
23
|
+
payload: maskedText(f.payload, secrets),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export class WsBuffer {
|
|
27
|
+
cdp;
|
|
28
|
+
cap;
|
|
29
|
+
maxPayload;
|
|
30
|
+
urls = new Map(); // requestId → endpoint url
|
|
31
|
+
ring = [];
|
|
32
|
+
enabled = false;
|
|
33
|
+
/** Optional per-session secrets registry; egress masking is applied on
|
|
34
|
+
* every `recent` / `since` read. */
|
|
35
|
+
secrets = null;
|
|
36
|
+
constructor(
|
|
37
|
+
// CDP is the WS-tap substrate today; a later change will port it onto
|
|
38
|
+
// Playwright's `page.on('websocket')` so non-CDP engines are supported.
|
|
39
|
+
// On an engine without CDP (Firefox) the buffer
|
|
40
|
+
// is constructed but never attaches — reads return empty until the
|
|
41
|
+
// substrate port lands, rather than throwing at session creation.
|
|
42
|
+
cdp, cap = 500, maxPayload = 2000) {
|
|
43
|
+
this.cdp = cdp;
|
|
44
|
+
this.cap = cap;
|
|
45
|
+
this.maxPayload = maxPayload;
|
|
46
|
+
}
|
|
47
|
+
setSecrets(secrets) {
|
|
48
|
+
this.secrets = secrets;
|
|
49
|
+
}
|
|
50
|
+
trunc(s) {
|
|
51
|
+
if (s.length <= this.maxPayload)
|
|
52
|
+
return { payload: s };
|
|
53
|
+
return { payload: s.slice(0, this.maxPayload), truncated: true };
|
|
54
|
+
}
|
|
55
|
+
push(f) {
|
|
56
|
+
this.ring.push(f);
|
|
57
|
+
if (this.ring.length > this.cap)
|
|
58
|
+
this.ring.shift();
|
|
59
|
+
}
|
|
60
|
+
async attach() {
|
|
61
|
+
if (this.enabled || !this.cdp)
|
|
62
|
+
return;
|
|
63
|
+
await this.cdp.send("Network.enable").catch(() => undefined); // idempotent w/ NetworkBuffer
|
|
64
|
+
this.enabled = true;
|
|
65
|
+
this.cdp.on("Network.webSocketCreated", (e) => {
|
|
66
|
+
this.urls.set(e.requestId, e.url);
|
|
67
|
+
});
|
|
68
|
+
this.cdp.on("Network.requestWillBeSent", (e) => {
|
|
69
|
+
if (e.type === "EventSource")
|
|
70
|
+
this.urls.set(e.requestId, e.request.url);
|
|
71
|
+
});
|
|
72
|
+
const onFrame = (dir) => (e) => {
|
|
73
|
+
this.push({
|
|
74
|
+
url: this.urls.get(e.requestId) ?? "",
|
|
75
|
+
dir,
|
|
76
|
+
kind: "ws",
|
|
77
|
+
opcode: e.response.opcode,
|
|
78
|
+
...this.trunc(e.response.payloadData ?? ""),
|
|
79
|
+
ts: Date.now(),
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
this.cdp.on("Network.webSocketFrameSent", onFrame("sent"));
|
|
83
|
+
this.cdp.on("Network.webSocketFrameReceived", onFrame("recv"));
|
|
84
|
+
this.cdp.on("Network.eventSourceMessageReceived", (e) => {
|
|
85
|
+
this.push({
|
|
86
|
+
url: this.urls.get(e.requestId) ?? "",
|
|
87
|
+
dir: "recv",
|
|
88
|
+
kind: "sse",
|
|
89
|
+
event: e.eventName || undefined,
|
|
90
|
+
...this.trunc(e.data ?? ""),
|
|
91
|
+
ts: Date.now(),
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/** Most-recent N frames, optionally filtered by a url substring. */
|
|
96
|
+
recent(limit = 50, urlPattern) {
|
|
97
|
+
let frames = this.ring;
|
|
98
|
+
// filter on the raw url, then sanitize the endpoint on the way out.
|
|
99
|
+
if (urlPattern)
|
|
100
|
+
frames = frames.filter((f) => f.url.includes(urlPattern));
|
|
101
|
+
return {
|
|
102
|
+
total: frames.length,
|
|
103
|
+
frames: frames.slice(-limit).map((f) => sanitizeFrame(f, this.secrets)),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/** Frames since a timestamp — for the per-action `ActionResult` slice. */
|
|
107
|
+
since(ts, cap = 25) {
|
|
108
|
+
return this.ring
|
|
109
|
+
.filter((f) => f.ts >= ts)
|
|
110
|
+
.slice(-cap)
|
|
111
|
+
.map((f) => sanitizeFrame(f, this.secrets));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import type { CDPSession } from "playwright-core";
|
|
2
|
+
import type { SecretRegistry } from "../util/secrets.js";
|
|
3
|
+
import type { WsFrame } from "./network-ws.js";
|
|
4
|
+
export interface NetworkEntry {
|
|
5
|
+
method: string;
|
|
6
|
+
url: string;
|
|
7
|
+
status?: number;
|
|
8
|
+
type: string;
|
|
9
|
+
ms?: number;
|
|
10
|
+
failed?: boolean;
|
|
11
|
+
/** CDP request id — the handle `network_body` resolves. Short-lived:
|
|
12
|
+
* the renderer discards bodies fairly quickly, so fetch soon after. */
|
|
13
|
+
requestId?: string;
|
|
14
|
+
/** Best-effort response `Content-Type` from CDP `Network.responseReceived`
|
|
15
|
+
* (`response.mimeType`). Absent on failed requests, attached pre-response,
|
|
16
|
+
* or non-HTTP transports. Captured for downstream filtering / asset export;
|
|
17
|
+
* NOT emitted on the `network_read` egress (which only surfaces the type
|
|
18
|
+
* bucket). */
|
|
19
|
+
mimeType?: string;
|
|
20
|
+
/** Best-effort encoded byte size from CDP `Network.loadingFinished`
|
|
21
|
+
* (`encodedDataLength`). Absent on requests that haven't finished or where
|
|
22
|
+
* the loadingFinished event hasn't landed yet. Captured for downstream
|
|
23
|
+
* filtering / asset export. */
|
|
24
|
+
bytes?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface NetworkSummary {
|
|
27
|
+
total: number;
|
|
28
|
+
byType: Record<string, number>;
|
|
29
|
+
failed: number;
|
|
30
|
+
}
|
|
31
|
+
/** The session-wide HTTP ring surface the tools above the engine seam consume
|
|
32
|
+
* (network_read, asset_export, session_metrics). Both the CDP `NetworkBuffer`
|
|
33
|
+
* and the Playwright `PlaywrightNetworkBuffer` satisfy it, so the NetworkSubstrate
|
|
34
|
+
* exposes this engine-blind shape rather than a concrete class. */
|
|
35
|
+
export interface SessionNetworkRing {
|
|
36
|
+
setSecrets(secrets: SecretRegistry): void;
|
|
37
|
+
iter(): readonly NetworkEntry[];
|
|
38
|
+
recent(limit?: number): {
|
|
39
|
+
summary: NetworkSummary;
|
|
40
|
+
requests: NetworkEntry[];
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** The session-wide WS/SSE ring surface the tools above the engine seam consume
|
|
44
|
+
* (ws_read; the action window's `wsFrames` slice). Both `WsBuffer` and
|
|
45
|
+
* `PlaywrightWsBuffer` satisfy it. */
|
|
46
|
+
export interface SessionWsRing {
|
|
47
|
+
setSecrets(secrets: SecretRegistry): void;
|
|
48
|
+
recent(limit?: number, urlPattern?: string): {
|
|
49
|
+
total: number;
|
|
50
|
+
frames: WsFrame[];
|
|
51
|
+
};
|
|
52
|
+
since(ts: number, cap?: number): WsFrame[];
|
|
53
|
+
}
|
|
54
|
+
/** bounded summary of a write-shaped request whose response landed in the
|
|
55
|
+
* action window. `responseShape` is the *top-level keys* of the parsed JSON
|
|
56
|
+
* response — no values, no nested keys. `urlPattern` strips the query string
|
|
57
|
+
* and replaces id-shaped path segments (numeric / UUID / hex) with `:id`. */
|
|
58
|
+
export interface MutationEntry {
|
|
59
|
+
method: string;
|
|
60
|
+
urlPattern: string;
|
|
61
|
+
status: number;
|
|
62
|
+
ok: boolean;
|
|
63
|
+
/** Top-level object keys of the JSON response (or first-element keys for an
|
|
64
|
+
* array response). Capped at 20 entries. Absent for non-JSON bodies. */
|
|
65
|
+
responseShape?: string[];
|
|
66
|
+
durationMs?: number;
|
|
67
|
+
}
|
|
68
|
+
export declare const MUTATION_METHODS: Set<string>;
|
|
69
|
+
export declare const MAX_BODY_BYTES_TO_PARSE = 256000;
|
|
70
|
+
/** Exported for unit tests of the cross-engine resourceType reconciliation. */
|
|
71
|
+
export declare function cdpTypeFromPlaywright(resourceType: string): string;
|
|
72
|
+
/** Fold a finished-entry list into the `{summary, requests}` the network_read /
|
|
73
|
+
* action-tap egress emits: noise/beacon entries collapse into `summary.byType
|
|
74
|
+
* .other` (and stay out of `requests`), failures count toward `summary.failed`,
|
|
75
|
+
* and the surviving "interesting" entries have their URL masked at egress. This
|
|
76
|
+
* is the EXACT logic the CDP `NetworkTap.close()` / `NetworkBuffer.recent()`
|
|
77
|
+
* loops run inline; extracted so the Playwright-event buffers/tap produce a
|
|
78
|
+
* byte-identical shape without duplicating the rule. */
|
|
79
|
+
export declare function foldInteresting(entries: readonly NetworkEntry[], secrets: SecretRegistry | null): {
|
|
80
|
+
summary: NetworkSummary;
|
|
81
|
+
requests: NetworkEntry[];
|
|
82
|
+
};
|
|
83
|
+
export declare class NetworkTap {
|
|
84
|
+
private cdp;
|
|
85
|
+
private secrets;
|
|
86
|
+
private requests;
|
|
87
|
+
private finished;
|
|
88
|
+
private mutationPromises;
|
|
89
|
+
private listeners;
|
|
90
|
+
private enabled;
|
|
91
|
+
/** Optional per-session secrets registry. When non-null, every URL +
|
|
92
|
+
* response-shape key that leaves through `close()` is run through the
|
|
93
|
+
* egress masking layer in addition to the URL sanitiser. */
|
|
94
|
+
constructor(cdp: CDPSession, secrets?: SecretRegistry | null);
|
|
95
|
+
open(): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Stop listening and produce a `{ summary, requests, mutations }` snapshot of
|
|
98
|
+
* the window. `requests` only includes the "interesting" entries (non-noise,
|
|
99
|
+
* non-beacon). Noise still counts toward `summary.byType.other`. `mutations`
|
|
100
|
+
* is awaited from the response-body probes kicked off during the window.
|
|
101
|
+
*/
|
|
102
|
+
close(): Promise<{
|
|
103
|
+
summary: NetworkSummary;
|
|
104
|
+
requests: NetworkEntry[];
|
|
105
|
+
mutations: MutationEntry[];
|
|
106
|
+
}>;
|
|
107
|
+
}
|
|
108
|
+
export type { WsFrame } from "./network-ws.js";
|
|
109
|
+
export { sanitizeFrame, WsBuffer } from "./network-ws.js";
|
|
110
|
+
/**
|
|
111
|
+
* fetch a response body by CDP request id. Gated behind the off-by-
|
|
112
|
+
* default `network-body` capability — full bodies can carry PII / tokens.
|
|
113
|
+
* Bounded (`maxBytes`, default 256 KB). Best-effort: the renderer discards
|
|
114
|
+
* bodies fairly quickly, so this can legitimately fail with "not available".
|
|
115
|
+
*/
|
|
116
|
+
export declare function fetchResponseBody(cdp: CDPSession, requestId: string, maxBytes?: number, secrets?: SecretRegistry | null): Promise<{
|
|
117
|
+
ok: boolean;
|
|
118
|
+
body?: string;
|
|
119
|
+
base64Encoded?: boolean;
|
|
120
|
+
truncated?: boolean;
|
|
121
|
+
error?: string;
|
|
122
|
+
}>;
|
|
123
|
+
/**
|
|
124
|
+
* Best-effort mutation-detail probe. Fetches the response body via
|
|
125
|
+
* `Network.getResponseBody`, extracts only the *top-level keys* of the parsed
|
|
126
|
+
* JSON. Returns null on any failure (body discarded, non-JSON, parse error,
|
|
127
|
+
* over-size body) so the caller can simply filter nulls out.
|
|
128
|
+
*
|
|
129
|
+
* Exported for unit tests of the urlPattern / responseShape helpers via
|
|
130
|
+
* `patterniseUrl` / `extractTopLevelKeys`.
|
|
131
|
+
*/
|
|
132
|
+
/** The request/response detail describing one mutation, threaded as a single
|
|
133
|
+
* group so the probe signatures stay within the param budget (the CDP and
|
|
134
|
+
* Playwright probes both carry the same four fields alongside their transport
|
|
135
|
+
* handle). */
|
|
136
|
+
export interface MutationDetail {
|
|
137
|
+
method: string;
|
|
138
|
+
url: string;
|
|
139
|
+
status: number;
|
|
140
|
+
durationMs: number;
|
|
141
|
+
}
|
|
142
|
+
export declare function mutationWithoutShape(detail: MutationDetail): MutationEntry;
|
|
143
|
+
/** Build a mutation entry, attaching the response shape only when non-empty —
|
|
144
|
+
* the success path shared by the CDP and Playwright probes. */
|
|
145
|
+
export declare function mutationWithShape(detail: MutationDetail, responseShape: string[] | null): MutationEntry;
|
|
146
|
+
/**
|
|
147
|
+
* Strip the query string and replace id-shaped path segments with `:id`. Keeps
|
|
148
|
+
* the route stable across requests for the same logical endpoint without
|
|
149
|
+
* leaking the specific record id in the result.
|
|
150
|
+
*
|
|
151
|
+
* Exported for unit tests.
|
|
152
|
+
*/
|
|
153
|
+
export declare function patterniseUrl(url: string): string;
|
|
154
|
+
/**
|
|
155
|
+
* Extract the top-level keys of a parsed JSON body. For an object, returns
|
|
156
|
+
* `Object.keys()`. For an array of objects, returns the first element's keys
|
|
157
|
+
* (prefixed with `[].` to signal array shape). Returns null otherwise.
|
|
158
|
+
*
|
|
159
|
+
* Capped at MAX_RESPONSE_SHAPE_KEYS entries. Exported for unit tests.
|
|
160
|
+
*/
|
|
161
|
+
export declare function extractTopLevelKeys(parsed: unknown): string[] | null;
|
|
162
|
+
/**
|
|
163
|
+
* Session-wide ring buffer of network requests. Same shape as NetworkTap but
|
|
164
|
+
* always-on for the lifetime of the session — exposed via the `network_read`
|
|
165
|
+
* MCP tool. Per-action attribution still lives in `ActionResult.network`;
|
|
166
|
+
* this is the "what happened recently across the session" surface.
|
|
167
|
+
*/
|
|
168
|
+
export declare class NetworkBuffer {
|
|
169
|
+
private cdp;
|
|
170
|
+
private cap;
|
|
171
|
+
private requests;
|
|
172
|
+
private ring;
|
|
173
|
+
/** requestId → entry pointer for the entries currently in `ring`. Lets
|
|
174
|
+
* `Network.loadingFinished` stamp `bytes` onto the corresponding entry
|
|
175
|
+
* without a linear scan. Pruned in `push` when an entry is evicted. */
|
|
176
|
+
private byReqId;
|
|
177
|
+
private enabled;
|
|
178
|
+
private secrets;
|
|
179
|
+
constructor(cdp: CDPSession | undefined, cap?: number);
|
|
180
|
+
setSecrets(secrets: SecretRegistry): void;
|
|
181
|
+
attach(): Promise<void>;
|
|
182
|
+
private push;
|
|
183
|
+
/** Raw, read-only snapshot of the ring — every entry, no noise/beacon
|
|
184
|
+
* folding, no egress masking. The masked / bucketed shape used by the
|
|
185
|
+
* `network_read` tool stays unchanged (see `recent`). This view is for
|
|
186
|
+
* consumers that need the full set as captured (e.g. `asset_export`
|
|
187
|
+
* iterating to pick image/font/media responses out of the ring). */
|
|
188
|
+
iter(): readonly NetworkEntry[];
|
|
189
|
+
/** Most-recent N entries; noise + beacons are folded into the `other` bucket of the summary. */
|
|
190
|
+
recent(limit?: number): {
|
|
191
|
+
summary: NetworkSummary;
|
|
192
|
+
requests: NetworkEntry[];
|
|
193
|
+
};
|
|
194
|
+
}
|