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,451 @@
|
|
|
1
|
+
// `verify_*` assertive read primitives.
|
|
2
|
+
//
|
|
3
|
+
// `wait_for` is *permissive* — it returns when satisfied OR when its deadline
|
|
4
|
+
// expires with `ok:false`. That leaves agents writing loops that can't
|
|
5
|
+
// terminate deterministically. The verify family is the assertive sibling:
|
|
6
|
+
// "this element MUST be visible / this text MUST appear / this value MUST
|
|
7
|
+
// equal X right now — else fail loudly." A failed verify always emits a
|
|
8
|
+
// structured `{source:"app", expected, actual}` failure, never a warning the
|
|
9
|
+
// LLM has to eyeball.
|
|
10
|
+
//
|
|
11
|
+
// Each helper is pure plumbing — it resolves the target, reads the relevant
|
|
12
|
+
// piece of state, and returns one of:
|
|
13
|
+
// { ok: true }
|
|
14
|
+
// { ok: false, failure: { source, kind, expected, actual, evidence? } }
|
|
15
|
+
//
|
|
16
|
+
// All five element-level helpers share the same ref-no-longer-found shape:
|
|
17
|
+
// when the ref doesn't resolve in the current snapshot, they fail with
|
|
18
|
+
// `source:"browxai"` so the agent can tell "the app's wrong" apart from
|
|
19
|
+
// "the snapshot rolled and the ref evaporated."
|
|
20
|
+
//
|
|
21
|
+
// `verify_predicate` (the composed-data helper) delegates to the shared
|
|
22
|
+
// predicate vocabulary in `src/util/predicates.ts` — same vocabulary that
|
|
23
|
+
// underwrites `batch.expect`. It deliberately accepts NO arbitrary-JS
|
|
24
|
+
// expression: the predicate `kind` is a fixed enum and the accessor `key` is
|
|
25
|
+
// constrained to an allow-list of namespaced paths into a small data bag the
|
|
26
|
+
// caller supplies. `eval_js` (gated behind the `eval` capability) is the only
|
|
27
|
+
// arbitrary-JS escape hatch in browxai — the verify family does not add a
|
|
28
|
+
// second one.
|
|
29
|
+
import { composeSnapshot } from "./compose.js";
|
|
30
|
+
import { findByRef } from "./snapshot.js";
|
|
31
|
+
import { searchTreeForText } from "./text_search.js";
|
|
32
|
+
import { walk } from "./a11y.js";
|
|
33
|
+
import { visibleRect } from "./bbox.js";
|
|
34
|
+
import { locatorFor } from "./locator.js";
|
|
35
|
+
import { evaluatePredicate, validatePredicate, } from "../util/predicates.js";
|
|
36
|
+
/** Resolve an `ActionTarget` to a Playwright Locator + the rich ref evidence,
|
|
37
|
+
* failing-emitting (`source:"browxai"`) when a ref isn't in the registry. */
|
|
38
|
+
function resolveOrFail(page, refs, target, kind, expected) {
|
|
39
|
+
if (target.coords) {
|
|
40
|
+
return {
|
|
41
|
+
ok: false,
|
|
42
|
+
failure: {
|
|
43
|
+
source: "browxai",
|
|
44
|
+
kind,
|
|
45
|
+
expected,
|
|
46
|
+
actual: "coords target",
|
|
47
|
+
evidence: { hint: "verify_* helpers don't accept coords targets — use ref/selector/named" },
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (target.ref) {
|
|
52
|
+
if (!refs.has(target.ref)) {
|
|
53
|
+
return {
|
|
54
|
+
ok: false,
|
|
55
|
+
failure: {
|
|
56
|
+
source: "browxai",
|
|
57
|
+
kind,
|
|
58
|
+
expected,
|
|
59
|
+
actual: "ref no longer in the snapshot",
|
|
60
|
+
evidence: {
|
|
61
|
+
ref: target.ref,
|
|
62
|
+
hint: "call snapshot() or find() again — the page may have re-rendered",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
let loc;
|
|
69
|
+
try {
|
|
70
|
+
loc = locatorFor(page, refs, target);
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
return {
|
|
74
|
+
ok: false,
|
|
75
|
+
failure: {
|
|
76
|
+
source: "browxai",
|
|
77
|
+
kind,
|
|
78
|
+
expected,
|
|
79
|
+
actual: e instanceof Error ? e.message : String(e),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return { ok: true, loc, ...(target.ref ? { ref: target.ref } : {}) };
|
|
84
|
+
}
|
|
85
|
+
/** Verify that the targeted element is visible (non-zero box, not
|
|
86
|
+
* display:none/visibility:hidden, opacity > 0). `source:"app"` on miss. */
|
|
87
|
+
export async function verifyVisible(page, refs, target) {
|
|
88
|
+
const expected = "visible (non-zero box, displayed, opacity > 0)";
|
|
89
|
+
const resolved = resolveOrFail(page, refs, target, "visible", expected);
|
|
90
|
+
if (!resolved.ok)
|
|
91
|
+
return resolved;
|
|
92
|
+
const { loc } = resolved;
|
|
93
|
+
try {
|
|
94
|
+
const count = await loc.count();
|
|
95
|
+
if (count === 0) {
|
|
96
|
+
return {
|
|
97
|
+
ok: false,
|
|
98
|
+
failure: {
|
|
99
|
+
source: "app",
|
|
100
|
+
kind: "visible",
|
|
101
|
+
expected,
|
|
102
|
+
actual: "missing (locator matched 0 nodes)",
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const isVisible = await loc.first().isVisible();
|
|
107
|
+
if (isVisible)
|
|
108
|
+
return { ok: true };
|
|
109
|
+
// Distinguish off-screen vs hidden where we can.
|
|
110
|
+
const reason = await probeNotVisibleReason(loc.first());
|
|
111
|
+
return {
|
|
112
|
+
ok: false,
|
|
113
|
+
failure: {
|
|
114
|
+
source: "app",
|
|
115
|
+
kind: "visible",
|
|
116
|
+
expected,
|
|
117
|
+
actual: reason,
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
return {
|
|
123
|
+
ok: false,
|
|
124
|
+
failure: {
|
|
125
|
+
source: "browxai",
|
|
126
|
+
kind: "visible",
|
|
127
|
+
expected,
|
|
128
|
+
actual: e instanceof Error ? e.message : String(e),
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async function probeNotVisibleReason(loc) {
|
|
134
|
+
try {
|
|
135
|
+
return await loc
|
|
136
|
+
.evaluate((el) => {
|
|
137
|
+
const cs = window.getComputedStyle(el);
|
|
138
|
+
if (cs.display === "none")
|
|
139
|
+
return "hidden (display:none)";
|
|
140
|
+
if (cs.visibility === "hidden")
|
|
141
|
+
return "hidden (visibility:hidden)";
|
|
142
|
+
if (Number(cs.opacity || "1") === 0)
|
|
143
|
+
return "hidden (opacity:0)";
|
|
144
|
+
const r = el.getBoundingClientRect();
|
|
145
|
+
if (r.width === 0 || r.height === 0)
|
|
146
|
+
return "hidden (zero-sized box)";
|
|
147
|
+
return "off-screen or covered";
|
|
148
|
+
})
|
|
149
|
+
.catch(() => "hidden");
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
return "hidden";
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/** Verify that the targeted element's visible text matches. `exact:true` →
|
|
156
|
+
* case-sensitive equality on the trimmed innerText. Default → case-insensitive
|
|
157
|
+
* substring. `source:"app"` on miss. */
|
|
158
|
+
export async function verifyText(page, refs, target, text, exact) {
|
|
159
|
+
const expected = exact
|
|
160
|
+
? `text === ${JSON.stringify(text)}`
|
|
161
|
+
: `text includes ${JSON.stringify(text)}`;
|
|
162
|
+
const resolved = resolveOrFail(page, refs, target, "text", expected);
|
|
163
|
+
if (!resolved.ok)
|
|
164
|
+
return resolved;
|
|
165
|
+
const { loc } = resolved;
|
|
166
|
+
try {
|
|
167
|
+
if ((await loc.count()) === 0) {
|
|
168
|
+
return {
|
|
169
|
+
ok: false,
|
|
170
|
+
failure: {
|
|
171
|
+
source: "app",
|
|
172
|
+
kind: "text",
|
|
173
|
+
expected,
|
|
174
|
+
actual: "missing (locator matched 0 nodes)",
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
const actualText = (await loc
|
|
179
|
+
.first()
|
|
180
|
+
.innerText()
|
|
181
|
+
.catch(() => null)) ?? "";
|
|
182
|
+
const trimmed = actualText.trim();
|
|
183
|
+
const hit = exact ? trimmed === text : trimmed.toLowerCase().includes(text.toLowerCase());
|
|
184
|
+
if (hit)
|
|
185
|
+
return { ok: true };
|
|
186
|
+
return {
|
|
187
|
+
ok: false,
|
|
188
|
+
failure: {
|
|
189
|
+
source: "app",
|
|
190
|
+
kind: "text",
|
|
191
|
+
expected,
|
|
192
|
+
actual: trimmed.slice(0, 200),
|
|
193
|
+
evidence: { exact, length: trimmed.length },
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
return {
|
|
199
|
+
ok: false,
|
|
200
|
+
failure: {
|
|
201
|
+
source: "browxai",
|
|
202
|
+
kind: "text",
|
|
203
|
+
expected,
|
|
204
|
+
actual: e instanceof Error ? e.message : String(e),
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/** Verify that the targeted input/textarea/contenteditable carries the given
|
|
210
|
+
* value (strict equality after a defensive `String()`). `source:"app"` on
|
|
211
|
+
* miss. */
|
|
212
|
+
export async function verifyValue(page, refs, target, value) {
|
|
213
|
+
const expected = `value === ${JSON.stringify(value)}`;
|
|
214
|
+
const resolved = resolveOrFail(page, refs, target, "value", expected);
|
|
215
|
+
if (!resolved.ok)
|
|
216
|
+
return resolved;
|
|
217
|
+
const { loc } = resolved;
|
|
218
|
+
try {
|
|
219
|
+
if ((await loc.count()) === 0) {
|
|
220
|
+
return {
|
|
221
|
+
ok: false,
|
|
222
|
+
failure: {
|
|
223
|
+
source: "app",
|
|
224
|
+
kind: "value",
|
|
225
|
+
expected,
|
|
226
|
+
actual: "missing (locator matched 0 nodes)",
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
const actual = await loc
|
|
231
|
+
.first()
|
|
232
|
+
.evaluate((el) => {
|
|
233
|
+
// Any element carrying a string `value` (input/textarea/select, but
|
|
234
|
+
// also output/button/etc.) reports it directly; a contenteditable host
|
|
235
|
+
// falls back to its rendered text. Structural checks mirror the DOM
|
|
236
|
+
// surface without assuming a single concrete element type.
|
|
237
|
+
const valued = el;
|
|
238
|
+
if (typeof valued.value === "string")
|
|
239
|
+
return valued.value;
|
|
240
|
+
if (el instanceof HTMLElement && el.isContentEditable)
|
|
241
|
+
return el.innerText ?? "";
|
|
242
|
+
return null;
|
|
243
|
+
})
|
|
244
|
+
.catch(() => null);
|
|
245
|
+
if (actual === null) {
|
|
246
|
+
return {
|
|
247
|
+
ok: false,
|
|
248
|
+
failure: {
|
|
249
|
+
source: "app",
|
|
250
|
+
kind: "value",
|
|
251
|
+
expected,
|
|
252
|
+
actual: "element has no `value` (not an input/textarea/select/contenteditable)",
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
if (String(actual) === value)
|
|
257
|
+
return { ok: true };
|
|
258
|
+
return {
|
|
259
|
+
ok: false,
|
|
260
|
+
failure: {
|
|
261
|
+
source: "app",
|
|
262
|
+
kind: "value",
|
|
263
|
+
expected,
|
|
264
|
+
actual: String(actual).slice(0, 200),
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
catch (e) {
|
|
269
|
+
return {
|
|
270
|
+
ok: false,
|
|
271
|
+
failure: {
|
|
272
|
+
source: "browxai",
|
|
273
|
+
kind: "value",
|
|
274
|
+
expected,
|
|
275
|
+
actual: e instanceof Error ? e.message : String(e),
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
/** Verify that exactly `n` elements match the given selector (or visible-text
|
|
281
|
+
* search). One of `selector` or `text` is required. `source:"app"` on miss. */
|
|
282
|
+
export async function verifyCount(page, cdp, refs, opts) {
|
|
283
|
+
if (opts.selector && opts.text) {
|
|
284
|
+
return {
|
|
285
|
+
ok: false,
|
|
286
|
+
failure: {
|
|
287
|
+
source: "browxai",
|
|
288
|
+
kind: "count",
|
|
289
|
+
expected: `exactly one of selector / text`,
|
|
290
|
+
actual: "both selector and text supplied",
|
|
291
|
+
},
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
if (!opts.selector && !opts.text) {
|
|
295
|
+
return {
|
|
296
|
+
ok: false,
|
|
297
|
+
failure: {
|
|
298
|
+
source: "browxai",
|
|
299
|
+
kind: "count",
|
|
300
|
+
expected: `one of selector / text`,
|
|
301
|
+
actual: "neither selector nor text supplied",
|
|
302
|
+
},
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
const target = opts.selector ?? `text:${opts.text}`;
|
|
306
|
+
const expected = `count === ${opts.n} matching ${target}`;
|
|
307
|
+
try {
|
|
308
|
+
let actualCount;
|
|
309
|
+
if (opts.selector) {
|
|
310
|
+
actualCount = await page.locator(opts.selector).count();
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
// Visible-text path: walk the composed a11y tree, count nodes whose
|
|
314
|
+
// trimmed name matches `text` case-insensitively (text_search-style).
|
|
315
|
+
const { tree } = await composeSnapshot(cdp, refs, opts.testAttributes);
|
|
316
|
+
if (!tree)
|
|
317
|
+
actualCount = 0;
|
|
318
|
+
else
|
|
319
|
+
actualCount = searchTreeForText(tree, opts.text, false, 1000).length;
|
|
320
|
+
}
|
|
321
|
+
if (actualCount === opts.n)
|
|
322
|
+
return { ok: true };
|
|
323
|
+
return {
|
|
324
|
+
ok: false,
|
|
325
|
+
failure: {
|
|
326
|
+
source: "app",
|
|
327
|
+
kind: "count",
|
|
328
|
+
expected,
|
|
329
|
+
actual: actualCount,
|
|
330
|
+
evidence: { matching: target },
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
catch (e) {
|
|
335
|
+
return {
|
|
336
|
+
ok: false,
|
|
337
|
+
failure: {
|
|
338
|
+
source: "browxai",
|
|
339
|
+
kind: "count",
|
|
340
|
+
expected,
|
|
341
|
+
actual: e instanceof Error ? e.message : String(e),
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/** Verify that the targeted element's `attr` attribute equals `value`. When
|
|
347
|
+
* `value` is undefined, this asserts the attribute is present (any value).
|
|
348
|
+
* `source:"app"` on miss. */
|
|
349
|
+
export async function verifyAttribute(page, refs, target, attr, value) {
|
|
350
|
+
const expected = value === undefined
|
|
351
|
+
? `attribute "${attr}" is present`
|
|
352
|
+
: `attribute "${attr}" === ${JSON.stringify(value)}`;
|
|
353
|
+
const resolved = resolveOrFail(page, refs, target, "attribute", expected);
|
|
354
|
+
if (!resolved.ok)
|
|
355
|
+
return resolved;
|
|
356
|
+
const { loc } = resolved;
|
|
357
|
+
try {
|
|
358
|
+
if ((await loc.count()) === 0) {
|
|
359
|
+
return {
|
|
360
|
+
ok: false,
|
|
361
|
+
failure: {
|
|
362
|
+
source: "app",
|
|
363
|
+
kind: "attribute",
|
|
364
|
+
expected,
|
|
365
|
+
actual: "missing (locator matched 0 nodes)",
|
|
366
|
+
},
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
const actual = await loc
|
|
370
|
+
.first()
|
|
371
|
+
.getAttribute(attr)
|
|
372
|
+
.catch(() => null);
|
|
373
|
+
if (value === undefined) {
|
|
374
|
+
if (actual !== null)
|
|
375
|
+
return { ok: true };
|
|
376
|
+
return {
|
|
377
|
+
ok: false,
|
|
378
|
+
failure: {
|
|
379
|
+
source: "app",
|
|
380
|
+
kind: "attribute",
|
|
381
|
+
expected,
|
|
382
|
+
actual: null,
|
|
383
|
+
evidence: { attr },
|
|
384
|
+
},
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
if (actual === value)
|
|
388
|
+
return { ok: true };
|
|
389
|
+
return {
|
|
390
|
+
ok: false,
|
|
391
|
+
failure: {
|
|
392
|
+
source: "app",
|
|
393
|
+
kind: "attribute",
|
|
394
|
+
expected,
|
|
395
|
+
actual,
|
|
396
|
+
evidence: { attr },
|
|
397
|
+
},
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
catch (e) {
|
|
401
|
+
return {
|
|
402
|
+
ok: false,
|
|
403
|
+
failure: {
|
|
404
|
+
source: "browxai",
|
|
405
|
+
kind: "attribute",
|
|
406
|
+
expected,
|
|
407
|
+
actual: e instanceof Error ? e.message : String(e),
|
|
408
|
+
},
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Evaluate a fixed-vocabulary `Predicate` against caller-supplied data
|
|
414
|
+
* (typically an `ActionResult` + optional companion `snapshot` / `evidence`).
|
|
415
|
+
*
|
|
416
|
+
* NOT arbitrary JS: the engine accepts only `kind` values from the
|
|
417
|
+
* `Predicate` enum and `key` accessor strings starting with an allow-listed
|
|
418
|
+
* root segment. Adopters supply *data* (which key, which expected value);
|
|
419
|
+
* the *vocabulary* is owned server-side. See `src/util/predicates.ts`.
|
|
420
|
+
*/
|
|
421
|
+
export function verifyPredicate(predicate, data) {
|
|
422
|
+
const shapeError = validatePredicate(predicate);
|
|
423
|
+
if (shapeError) {
|
|
424
|
+
return {
|
|
425
|
+
ok: false,
|
|
426
|
+
failure: {
|
|
427
|
+
source: "browxai",
|
|
428
|
+
kind: "predicate-shape",
|
|
429
|
+
expected: "well-formed Predicate",
|
|
430
|
+
actual: shapeError,
|
|
431
|
+
},
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
const res = evaluatePredicate(predicate, data);
|
|
435
|
+
if (res.ok)
|
|
436
|
+
return { ok: true };
|
|
437
|
+
return {
|
|
438
|
+
ok: false,
|
|
439
|
+
failure: {
|
|
440
|
+
source: "app",
|
|
441
|
+
kind: res.kind,
|
|
442
|
+
expected: res.expected,
|
|
443
|
+
actual: res.actual,
|
|
444
|
+
...(res.key !== undefined ? { evidence: { key: res.key } } : {}),
|
|
445
|
+
},
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
// Re-export the page/snapshot-walking helpers other call sites may want when
|
|
449
|
+
// composing custom `verify_predicate` data bags. Keeps `verify.ts` the single
|
|
450
|
+
// import surface for verify-family work.
|
|
451
|
+
export { findByRef, walk, visibleRect };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { Page } from "playwright-core";
|
|
2
|
+
/** Maximum size (in bytes) at which a finalized video is returned inline as
|
|
3
|
+
* base64 (`format:"bytes"`) rather than only by path. Conservative cap —
|
|
4
|
+
* video bytes balloon fast; agents that hit it should rely on the path. */
|
|
5
|
+
export declare const VIDEO_INLINE_CAP_BYTES: number;
|
|
6
|
+
/** Per-session video recorder state. One per `SessionEntry`. */
|
|
7
|
+
export interface VideoRecorderState {
|
|
8
|
+
/** True between session creation (with `recordVideo`) and `close_session`. */
|
|
9
|
+
active: boolean;
|
|
10
|
+
/** Workspace-absolute path the .webm will be written to on close. Reserved
|
|
11
|
+
* at session creation; the user-facing deterministic name. */
|
|
12
|
+
targetPath?: string;
|
|
13
|
+
/** Staging directory passed to Playwright's `recordVideo.dir`. Playwright
|
|
14
|
+
* auto-names a file inside this dir; we move/copy it to `targetPath` on
|
|
15
|
+
* session close via `page.video().saveAs(targetPath)`. */
|
|
16
|
+
stagingDir?: string;
|
|
17
|
+
/** Recorded video size. */
|
|
18
|
+
size?: {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
/** epoch ms the recorder was wired (context creation time). */
|
|
23
|
+
startedAt?: number;
|
|
24
|
+
/** True once the .webm has been saved to `targetPath` on disk (i.e.
|
|
25
|
+
* `finalizeOnClose` has run). `get_video` checks this before reading. */
|
|
26
|
+
finalized: boolean;
|
|
27
|
+
/** True once `stop_video` has been called. The actual flush still happens
|
|
28
|
+
* on `close_session` (Playwright constraint); this just records the
|
|
29
|
+
* agent's intent so the result envelope can carry it. */
|
|
30
|
+
pendingFinalize: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function newVideoRecorderState(): VideoRecorderState;
|
|
33
|
+
/** Configuration accepted by `open_session({recordVideo})`. */
|
|
34
|
+
export interface VideoStartConfig {
|
|
35
|
+
/** Workspace-rooted path. Optional — defaults to
|
|
36
|
+
* `<workspace>/videos/<session-id>-<ISO>.webm` when omitted. Path traversal
|
|
37
|
+
* outside the workspace is rejected. */
|
|
38
|
+
path?: string;
|
|
39
|
+
/** Recorded video size. Maps to Playwright's `recordVideo.size`. */
|
|
40
|
+
size?: {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** Structured refusal — matches the shape `assertPdfSupported` returns so the
|
|
46
|
+
* tool layer can wrap it uniformly. */
|
|
47
|
+
export interface VideoRefusal {
|
|
48
|
+
error: string;
|
|
49
|
+
hint: string;
|
|
50
|
+
}
|
|
51
|
+
/** Refuse video on session modes Playwright's `recordVideo` doesn't support
|
|
52
|
+
* cleanly. BYOB (`attached`) is the only refusal: we don't wire
|
|
53
|
+
* context-creation primitives on the consumer's Chrome, mirroring the
|
|
54
|
+
* `pdf_save` / `recordHar` posture. Managed `persistent` and `incognito`
|
|
55
|
+
* sessions are both supported (headed and headless). */
|
|
56
|
+
export declare function assertVideoSupported(ctx: {
|
|
57
|
+
mode: "persistent" | "incognito" | "attached";
|
|
58
|
+
}): VideoRefusal | null;
|
|
59
|
+
/** Default video filename for an auto-named recording. ISO timestamp with
|
|
60
|
+
* `:` / `.` mapped to `-` so the name is filesystem-safe on every platform. */
|
|
61
|
+
export declare function defaultVideoFilename(sessionId: string, now?: Date): string;
|
|
62
|
+
/** Resolve an explicit user-supplied path (workspace-escape rejected) OR
|
|
63
|
+
* build the default `<workspace>/videos/<auto>.webm` path. Creates the
|
|
64
|
+
* parent dir on demand — still under the workspace root by construction. */
|
|
65
|
+
export declare function resolveVideoTargetPath(workspaceRoot: string, sessionId: string, userPath: string | undefined, tool: string): string;
|
|
66
|
+
/** Resolve + create the staging directory Playwright writes its auto-named
|
|
67
|
+
* .webm into. One staging dir per session, under
|
|
68
|
+
* `<workspace>/videos/.staging/<sessionId>-<ISO>/`. Workspace-rooted by
|
|
69
|
+
* construction (resolveWorkspacePath rejects escape). */
|
|
70
|
+
export declare function resolveVideoStagingDir(workspaceRoot: string, sessionId: string, now?: Date): string;
|
|
71
|
+
/** Build the Playwright `recordVideo` option for `open_session({recordVideo})`.
|
|
72
|
+
* The caller passes this into `browser.newContext({recordVideo})` /
|
|
73
|
+
* `chromium.launchPersistentContext({recordVideo})`. Returns both the
|
|
74
|
+
* Playwright-shaped option AND the resolved target path + staging dir so the
|
|
75
|
+
* registry can persist them on `VideoRecorderState`. */
|
|
76
|
+
export declare function buildRecordVideoOption(workspaceRoot: string, sessionId: string, cfg: VideoStartConfig): {
|
|
77
|
+
targetPath: string;
|
|
78
|
+
stagingDir: string;
|
|
79
|
+
size?: {
|
|
80
|
+
width: number;
|
|
81
|
+
height: number;
|
|
82
|
+
};
|
|
83
|
+
recordVideo: {
|
|
84
|
+
dir: string;
|
|
85
|
+
size?: {
|
|
86
|
+
width: number;
|
|
87
|
+
height: number;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
/** Mark the recorder as `pendingFinalize` — the agent has signalled they
|
|
92
|
+
* want the recording stopped. The actual flush happens on `close_session`
|
|
93
|
+
* (Playwright finalizes the .webm only when the context closes). Mirrors
|
|
94
|
+
* the `stop_har` shape for the `nativeRecord:true` posture. */
|
|
95
|
+
export declare function stopVideo(state: VideoRecorderState): {
|
|
96
|
+
wasActive: boolean;
|
|
97
|
+
targetPath?: string;
|
|
98
|
+
pendingFinalize: boolean;
|
|
99
|
+
finalized: boolean;
|
|
100
|
+
};
|
|
101
|
+
/** Finalize the recording on session teardown. Calls `page.video().saveAs()`
|
|
102
|
+
* with the deterministic target path — Playwright waits for the page to
|
|
103
|
+
* close and the video to be fully written before resolving. Best-effort:
|
|
104
|
+
* errors here MUST NOT block session teardown (mirrors the `perf` /
|
|
105
|
+
* `artifacts` cleanup posture in the registry teardown). */
|
|
106
|
+
export declare function finalizeVideoOnClose(page: Page, state: VideoRecorderState): Promise<void>;
|
|
107
|
+
/** Read a finalized video file. `format: "bytes"` inlines as base64 when
|
|
108
|
+
* under the cap; `format: "path"` (or over-cap) returns only the path. */
|
|
109
|
+
export declare function readVideoIfReady(path: string, format?: "path" | "bytes", capBytes?: number): {
|
|
110
|
+
exists: boolean;
|
|
111
|
+
path: string;
|
|
112
|
+
bytes?: number;
|
|
113
|
+
inlineBase64?: string;
|
|
114
|
+
tooLargeToInline?: boolean;
|
|
115
|
+
};
|