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,219 @@
|
|
|
1
|
+
// Per-session sensitive-data masking. Pairs with the URL sanitiser at the
|
|
2
|
+
// same egress boundary — both layers apply.
|
|
3
|
+
//
|
|
4
|
+
// Why it exists: browxai transcripts are shareable (adoption reports, GitHub
|
|
5
|
+
// issue repros, eval datasets). An auth flow whose `fill({value:"hunter2"})`
|
|
6
|
+
// arg, ActionResult, snapshot, console line, or WS frame echoes the real
|
|
7
|
+
// password makes the transcript radioactive. The browser-use precedent:
|
|
8
|
+
// the agent sees `<PASSWORD>`, the runtime substitutes the real value at
|
|
9
|
+
// dispatch — so the password reaches the page, never the agent.
|
|
10
|
+
//
|
|
11
|
+
// Shape: the agent registers a secret with an alias name (`PASSWORD`, `OTP`)
|
|
12
|
+
// and a real value. From then on:
|
|
13
|
+
// - `fill({value:"<PASSWORD>"})` / `press({key:"<OTP>"})` materialise the
|
|
14
|
+
// real value AT DISPATCH time (between the registry and Playwright).
|
|
15
|
+
// - Every egress sink that could carry the real value (network urls + frame
|
|
16
|
+
// payloads, console text, snapshot trees, find evidence) is scanned for
|
|
17
|
+
// the real value and rewrites occurrences back to `<PASSWORD>` before
|
|
18
|
+
// leaving the server.
|
|
19
|
+
//
|
|
20
|
+
// Sanitiser composition: the URL sanitiser is regex-based on URLs;
|
|
21
|
+
// secrets-masking is literal-substring across arbitrary strings. They don't
|
|
22
|
+
// fight — apply secrets-masking AFTER the URL sanitiser at each sink (the
|
|
23
|
+
// URL sanitiser may have already redacted `?token=…`; the literal-value scan
|
|
24
|
+
// still catches a secret that landed in a path / payload / header value).
|
|
25
|
+
import { log } from "./logging.js";
|
|
26
|
+
/**
|
|
27
|
+
* Per-session secrets registry. Bounded (32 secrets) to keep the per-sink
|
|
28
|
+
* scan O(secrets × text-len) sane; the realistic upper bound for an auth
|
|
29
|
+
* flow is small (password, OTP, maybe a couple of token-like values).
|
|
30
|
+
*/
|
|
31
|
+
export class SecretRegistry {
|
|
32
|
+
cap;
|
|
33
|
+
byName = new Map();
|
|
34
|
+
// Cached real-value strings sorted by descending length, so a value that
|
|
35
|
+
// is a prefix of another doesn't get masked into a partial alias.
|
|
36
|
+
cachedValuesDesc = null;
|
|
37
|
+
warnedOnce = false;
|
|
38
|
+
constructor(cap = 32) {
|
|
39
|
+
this.cap = cap;
|
|
40
|
+
}
|
|
41
|
+
/** Register or replace a secret by name. Names must match `^[A-Z][A-Z0-9_]*$`
|
|
42
|
+
* — uppercase identifier, no whitespace, no angle brackets — so the
|
|
43
|
+
* `<NAME>` mask is unambiguous. An empty `value` is rejected (would mask
|
|
44
|
+
* the empty string everywhere and produce nothing useful). */
|
|
45
|
+
register(entry) {
|
|
46
|
+
if (!/^[A-Z][A-Z0-9_]*$/.test(entry.name)) {
|
|
47
|
+
throw new Error(`register_secret: name "${entry.name}" must match /^[A-Z][A-Z0-9_]*$/ ` +
|
|
48
|
+
`(uppercase identifier, e.g. PASSWORD / OTP / SESSION_TOKEN) — the ` +
|
|
49
|
+
`\`<NAME>\` mask format is the stable contract for agents to recognise.`);
|
|
50
|
+
}
|
|
51
|
+
if (typeof entry.value !== "string" || entry.value.length === 0) {
|
|
52
|
+
throw new Error("register_secret: value must be a non-empty string");
|
|
53
|
+
}
|
|
54
|
+
if (!this.byName.has(entry.name) && this.byName.size >= this.cap) {
|
|
55
|
+
throw new Error(`register_secret: capacity ${this.cap} reached — remove an existing ` +
|
|
56
|
+
`secret (close_session or restart) before registering more`);
|
|
57
|
+
}
|
|
58
|
+
this.byName.set(entry.name, { ...entry });
|
|
59
|
+
this.cachedValuesDesc = null;
|
|
60
|
+
if (!this.warnedOnce) {
|
|
61
|
+
// Mirrors the eval / network-body / disableWebSecurity loud-warn posture
|
|
62
|
+
// (docs/threat-model.md "Loud one-time warnings"). The `secrets`
|
|
63
|
+
// capability is off by default; once registered, the egress-masking
|
|
64
|
+
// layer is engaged for the lifetime of the session.
|
|
65
|
+
log.warn("browxai: secrets capability is ENABLED — a sensitive value was registered. " +
|
|
66
|
+
"All egress sinks (ActionResult.network, network_read, network_body, " +
|
|
67
|
+
"ws_read, console_read, snapshot, find) now strip occurrences of the " +
|
|
68
|
+
"registered value and substitute `<NAME>` aliases. `fill`/`press` " +
|
|
69
|
+
"materialise `<NAME>` to the real value at dispatch time. The " +
|
|
70
|
+
"`screenshot` tool is a partial sink — see docs/tool-reference.md.");
|
|
71
|
+
this.warnedOnce = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** List registered secret names (NEVER values). Useful for the
|
|
75
|
+
* registration tool's confirmation reply + the per-action warning that
|
|
76
|
+
* fires when a screenshot's page-text reveals one. */
|
|
77
|
+
names() {
|
|
78
|
+
return [...this.byName.keys()];
|
|
79
|
+
}
|
|
80
|
+
size() {
|
|
81
|
+
return this.byName.size;
|
|
82
|
+
}
|
|
83
|
+
/** Look up an entry by name. Internal — callers go through `materialize`
|
|
84
|
+
* or `applyMask` so the real value never escapes this module by accident. */
|
|
85
|
+
lookup(name) {
|
|
86
|
+
return this.byName.get(name);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Dispatch-side: turn `<NAME>` (with optional surrounding whitespace OK,
|
|
90
|
+
* but the contract is exact `<NAME>`) into the real value, for `fill` /
|
|
91
|
+
* `press`. Strings that are NOT `<NAME>`-shaped pass through unchanged —
|
|
92
|
+
* the substitution is conservative on purpose so a plain string containing
|
|
93
|
+
* angle brackets stays a plain string.
|
|
94
|
+
*
|
|
95
|
+
* Returns the materialised string + a flag for the caller to label
|
|
96
|
+
* the dispatched-action descriptor (so the ActionResult records that a
|
|
97
|
+
* masked value was sent, not the value itself).
|
|
98
|
+
*
|
|
99
|
+
* `pageUrl` is consulted only when an entry has a `scope`; if scope is set
|
|
100
|
+
* and the current page URL doesn't contain it, the materialisation is
|
|
101
|
+
* REFUSED (returns ok:false) — substituting a secret on a wrong-origin page
|
|
102
|
+
* would leak it cross-site.
|
|
103
|
+
*/
|
|
104
|
+
materialize(value, pageUrl) {
|
|
105
|
+
const m = /^<([A-Z][A-Z0-9_]*)>$/.exec(value);
|
|
106
|
+
if (!m)
|
|
107
|
+
return { ok: true, materialised: false, value };
|
|
108
|
+
const name = m[1];
|
|
109
|
+
const entry = this.lookup(name);
|
|
110
|
+
if (!entry) {
|
|
111
|
+
return {
|
|
112
|
+
ok: false,
|
|
113
|
+
materialised: false,
|
|
114
|
+
value,
|
|
115
|
+
error: `value "<${name}>" looks like a secret alias but no secret named ` +
|
|
116
|
+
`"${name}" is registered on this session — call register_secret({name,value}) first`,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
if (entry.scope && !pageUrl.toLowerCase().includes(entry.scope.toLowerCase())) {
|
|
120
|
+
return {
|
|
121
|
+
ok: false,
|
|
122
|
+
materialised: false,
|
|
123
|
+
value,
|
|
124
|
+
error: `secret "<${name}>" is scoped to "${entry.scope}" but the current ` +
|
|
125
|
+
`page URL doesn't contain it — refusing to substitute (would leak ` +
|
|
126
|
+
`the value cross-origin). Navigate to the scoped origin first, or ` +
|
|
127
|
+
`re-register without a scope.`,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
return { ok: true, materialised: true, value: entry.value, alias: name };
|
|
131
|
+
}
|
|
132
|
+
/** Egress-side: scan `text` for any registered real-value and rewrite each
|
|
133
|
+
* occurrence to `<NAME>`. No-op when the registry is empty (the common
|
|
134
|
+
* case — secrets is opt-in). Pure string replacement; safe to apply
|
|
135
|
+
* multiple times (idempotent — `<NAME>` doesn't contain any registered
|
|
136
|
+
* value, so won't re-match). Order: longest value first, so a value
|
|
137
|
+
* that's a substring of another doesn't leave a partial leak. */
|
|
138
|
+
applyMaskInText(text) {
|
|
139
|
+
if (this.byName.size === 0 || !text)
|
|
140
|
+
return text;
|
|
141
|
+
let out = text;
|
|
142
|
+
for (const { name, value } of this.entriesByValueLenDesc()) {
|
|
143
|
+
if (!value)
|
|
144
|
+
continue;
|
|
145
|
+
// String split/join — no regex, so secret values containing regex
|
|
146
|
+
// metacharacters (e.g. `+`, `(`, `.`) work without escaping.
|
|
147
|
+
if (out.includes(value)) {
|
|
148
|
+
out = out.split(value).join(`<${name}>`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return out;
|
|
152
|
+
}
|
|
153
|
+
/** Convenience: mask the string fields of an object/array recursively.
|
|
154
|
+
* Non-string leaves pass through. Bounded depth (8) so a malformed input
|
|
155
|
+
* can't blow the stack. Returns a new object — the input is not mutated. */
|
|
156
|
+
applyMaskDeep(obj, depth = 0) {
|
|
157
|
+
// Masking only rewrites string leaves, so the result has the same structure
|
|
158
|
+
// as the input. The recursion runs on `unknown` (every branch narrows with a
|
|
159
|
+
// real runtime check); the single `as T` is that structure-preserving contract.
|
|
160
|
+
return this.maskValue(obj, depth);
|
|
161
|
+
}
|
|
162
|
+
maskValue(obj, depth) {
|
|
163
|
+
if (this.byName.size === 0)
|
|
164
|
+
return obj;
|
|
165
|
+
if (depth > 8)
|
|
166
|
+
return obj;
|
|
167
|
+
if (typeof obj === "string")
|
|
168
|
+
return this.applyMaskInText(obj);
|
|
169
|
+
if (Array.isArray(obj))
|
|
170
|
+
return obj.map((v) => this.maskValue(v, depth + 1));
|
|
171
|
+
if (obj && typeof obj === "object") {
|
|
172
|
+
const out = {};
|
|
173
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
174
|
+
out[k] = this.maskValue(v, depth + 1);
|
|
175
|
+
}
|
|
176
|
+
return out;
|
|
177
|
+
}
|
|
178
|
+
return obj;
|
|
179
|
+
}
|
|
180
|
+
/** Best-effort detection: does `text` contain any registered real-value?
|
|
181
|
+
* Used by the screenshot tool's text-content sweep to decide whether to
|
|
182
|
+
* emit the "screenshot may reveal registered secret values" warning. */
|
|
183
|
+
containsAnySecret(text) {
|
|
184
|
+
if (this.byName.size === 0 || !text)
|
|
185
|
+
return { hit: false, names: [] };
|
|
186
|
+
const names = [];
|
|
187
|
+
for (const { name, value } of this.entriesByValueLenDesc()) {
|
|
188
|
+
if (value && text.includes(value))
|
|
189
|
+
names.push(name);
|
|
190
|
+
}
|
|
191
|
+
return { hit: names.length > 0, names };
|
|
192
|
+
}
|
|
193
|
+
/** Internal: entries sorted by descending value-length, so longer values
|
|
194
|
+
* mask before their shorter prefixes / substrings. Cached until the next
|
|
195
|
+
* `register()`. */
|
|
196
|
+
entriesByValueLenDesc() {
|
|
197
|
+
if (this.cachedValuesDesc !== null) {
|
|
198
|
+
// cache invalidation by value-string change — we cache the *sorted name
|
|
199
|
+
// order* indirectly via re-walking each call when cache is invalidated.
|
|
200
|
+
}
|
|
201
|
+
const arr = [...this.byName.values()];
|
|
202
|
+
arr.sort((a, b) => b.value.length - a.value.length);
|
|
203
|
+
return arr;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Compose with the URL sanitiser: apply secrets-masking AFTER URL sanitisation.
|
|
208
|
+
* The two layers are independent — the URL sanitiser handles
|
|
209
|
+
* query/fragment/userinfo/token-paths (regex on URL structure); secrets-
|
|
210
|
+
* masking handles literal real-value substitution anywhere in the text.
|
|
211
|
+
*
|
|
212
|
+
* Helper exists so callers don't have to remember the ordering at every sink.
|
|
213
|
+
*/
|
|
214
|
+
export function composeUrlAndSecretsInText(text, urlSanitiser, registry) {
|
|
215
|
+
const afterUrl = urlSanitiser(text);
|
|
216
|
+
if (!registry)
|
|
217
|
+
return afterUrl;
|
|
218
|
+
return registry.applyMaskInText(afterUrl);
|
|
219
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Cheap token estimation + truncation helpers. ActionResult.snapshotDelta is the
|
|
2
|
+
// elastic part of the structured result — when the budget is tight, we shrink it
|
|
3
|
+
// first before dropping anything else.
|
|
4
|
+
export function estimateTokens(text) {
|
|
5
|
+
// Order-of-magnitude estimate — 1 token ≈ 4 chars of English / structured text.
|
|
6
|
+
// We're not pricing API calls; we're sizing payloads. Good enough.
|
|
7
|
+
return Math.ceil(text.length / 4);
|
|
8
|
+
}
|
|
9
|
+
/** Truncate `text` (line-wise) so its estimated token count is ≤ `maxTokens`. */
|
|
10
|
+
export function truncateToBudget(text, maxTokens) {
|
|
11
|
+
if (estimateTokens(text) <= maxTokens)
|
|
12
|
+
return { text, truncated: false };
|
|
13
|
+
const lines = text.split("\n");
|
|
14
|
+
// Keep dropping last lines until we fit; add a final "... [N more lines]" marker.
|
|
15
|
+
let kept = lines.length;
|
|
16
|
+
while (kept > 1) {
|
|
17
|
+
const candidate = lines.slice(0, kept).join("\n") + `\n... [+${lines.length - kept} more]`;
|
|
18
|
+
if (estimateTokens(candidate) <= maxTokens) {
|
|
19
|
+
return { text: candidate, truncated: true };
|
|
20
|
+
}
|
|
21
|
+
kept = Math.max(1, Math.floor(kept * 0.75));
|
|
22
|
+
}
|
|
23
|
+
return { text: `... [${lines.length} lines elided]`, truncated: true };
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** A single path segment → itself, or `:id` when it looks like an identifier
|
|
2
|
+
* or an opaque credential/token (numeric, UUID, long hex, or a long
|
|
3
|
+
* high-entropy token). Conservative on length so human-readable route words
|
|
4
|
+
* ("profile", "avatar", "v2") are preserved. */
|
|
5
|
+
export declare function patterniseSegment(seg: string): string;
|
|
6
|
+
/** Patternise every segment of a pathname. */
|
|
7
|
+
export declare function patternisePath(pathname: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Redact a single URL: keep scheme + host + patternised path; drop the query
|
|
10
|
+
* string, fragment, and any `user:pass@` userinfo. A present-but-stripped
|
|
11
|
+
* query/fragment is signalled with `?…` / `#…` so the agent still knows it
|
|
12
|
+
* existed without seeing its contents. Opaque schemes (`blob:`, `data:`)
|
|
13
|
+
* collapse to just the scheme — their body can itself embed a full URL.
|
|
14
|
+
* Non-URL input is returned unchanged.
|
|
15
|
+
*/
|
|
16
|
+
export declare function sanitizeUrl(raw: string): string;
|
|
17
|
+
/** Replace every URL substring in arbitrary text with its sanitized form.
|
|
18
|
+
* Leaves all non-URL text untouched. */
|
|
19
|
+
export declare function sanitizeUrlsInText(text: string): string;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Centralized URL/identity redaction for everything that leaves the server
|
|
2
|
+
// carrying *captured* page traffic — HTTP request lists, WebSocket/SSE frame
|
|
3
|
+
// endpoints, and URL substrings inside console / page-error text.
|
|
4
|
+
//
|
|
5
|
+
// browxai output is meant to be shareable (issue repros, adoption reports)
|
|
6
|
+
// and the server is heading public, so this is a default-on posture, not a
|
|
7
|
+
// per-call opt-in: credential / identity-bearing material (query strings,
|
|
8
|
+
// fragments, userinfo, token-shaped path segments) is stripped at the egress
|
|
9
|
+
// boundary while the analytically useful shape — scheme, host, path pattern —
|
|
10
|
+
// is preserved. One implementation; HTTP / WS / SSE / console all route here.
|
|
11
|
+
/** A single path segment → itself, or `:id` when it looks like an identifier
|
|
12
|
+
* or an opaque credential/token (numeric, UUID, long hex, or a long
|
|
13
|
+
* high-entropy token). Conservative on length so human-readable route words
|
|
14
|
+
* ("profile", "avatar", "v2") are preserved. */
|
|
15
|
+
export function patterniseSegment(seg) {
|
|
16
|
+
if (!seg)
|
|
17
|
+
return seg;
|
|
18
|
+
if (/^\d+$/.test(seg))
|
|
19
|
+
return ":id";
|
|
20
|
+
if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(seg))
|
|
21
|
+
return ":id";
|
|
22
|
+
if (/^[0-9a-f]{12,}$/i.test(seg))
|
|
23
|
+
return ":id";
|
|
24
|
+
// Opaque token / JWT-ish: long, only token-safe chars, and mixes a letter
|
|
25
|
+
// with a digit (route words like "documentation" never match — no digit).
|
|
26
|
+
if (seg.length >= 20 &&
|
|
27
|
+
/^[A-Za-z0-9._~-]+$/.test(seg) &&
|
|
28
|
+
/[A-Za-z]/.test(seg) &&
|
|
29
|
+
/\d/.test(seg)) {
|
|
30
|
+
return ":id";
|
|
31
|
+
}
|
|
32
|
+
return seg;
|
|
33
|
+
}
|
|
34
|
+
/** Patternise every segment of a pathname. */
|
|
35
|
+
export function patternisePath(pathname) {
|
|
36
|
+
return pathname.split("/").map(patterniseSegment).join("/");
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Redact a single URL: keep scheme + host + patternised path; drop the query
|
|
40
|
+
* string, fragment, and any `user:pass@` userinfo. A present-but-stripped
|
|
41
|
+
* query/fragment is signalled with `?…` / `#…` so the agent still knows it
|
|
42
|
+
* existed without seeing its contents. Opaque schemes (`blob:`, `data:`)
|
|
43
|
+
* collapse to just the scheme — their body can itself embed a full URL.
|
|
44
|
+
* Non-URL input is returned unchanged.
|
|
45
|
+
*/
|
|
46
|
+
export function sanitizeUrl(raw) {
|
|
47
|
+
let u;
|
|
48
|
+
try {
|
|
49
|
+
u = new URL(raw);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return raw;
|
|
53
|
+
}
|
|
54
|
+
if (u.protocol === "blob:" || u.protocol === "data:")
|
|
55
|
+
return `${u.protocol}…`;
|
|
56
|
+
const path = patternisePath(u.pathname);
|
|
57
|
+
const q = u.search ? "?…" : "";
|
|
58
|
+
const frag = u.hash ? "#…" : "";
|
|
59
|
+
// u.origin excludes userinfo; for ws/wss/http/https it is `scheme://host`.
|
|
60
|
+
const base = u.origin && u.origin !== "null" ? u.origin : `${u.protocol}//${u.host}`;
|
|
61
|
+
return `${base}${path}${q}${frag}`;
|
|
62
|
+
}
|
|
63
|
+
// http(s)/ws(s) URL occurrences inside free text (console messages, page-error
|
|
64
|
+
// strings). Bounded charset stops at the first whitespace / quote / angle.
|
|
65
|
+
const URL_IN_TEXT = /\b(?:https?|wss?):\/\/[^\s"'<>`)\]}]+/gi;
|
|
66
|
+
/** Replace every URL substring in arbitrary text with its sanitized form.
|
|
67
|
+
* Leaves all non-URL text untouched. */
|
|
68
|
+
export function sanitizeUrlsInText(text) {
|
|
69
|
+
return text.replace(URL_IN_TEXT, (m) => sanitizeUrl(m));
|
|
70
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Host package version — read once, synchronously, from package.json.
|
|
2
|
+
//
|
|
3
|
+
// The MCP handshake, the SDK client identities, and the plugin runtime's
|
|
4
|
+
// host-version advisory all report this value. Deriving it from
|
|
5
|
+
// package.json at module load means the version CANNOT drift from the
|
|
6
|
+
// published one (the old hand-maintained constant shipped a 0.1.0
|
|
7
|
+
// handshake on a 0.7.0 package).
|
|
8
|
+
//
|
|
9
|
+
// `createRequire` keeps the read synchronous and bundler-free. dist/ is
|
|
10
|
+
// built by plain tsc (no bundler — see tsconfig.build.json), so the
|
|
11
|
+
// compiled file lives at `dist/util/version.js` and `../../package.json`
|
|
12
|
+
// resolves to the package root both there and from `src/util/` under tsx.
|
|
13
|
+
// npm always includes package.json in the published tarball.
|
|
14
|
+
import { createRequire } from "node:module";
|
|
15
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
16
|
+
const pkg = requireFromHere("../../package.json");
|
|
17
|
+
if (typeof pkg.version !== "string" || pkg.version.length === 0) {
|
|
18
|
+
throw new Error("browxai: package.json#version missing or empty — corrupt install");
|
|
19
|
+
}
|
|
20
|
+
/** The browxai package version (package.json#version) — single source of truth. */
|
|
21
|
+
export const PACKAGE_VERSION = pkg.version;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface Workspace {
|
|
2
|
+
/** Absolute path to the workspace root. */
|
|
3
|
+
readonly root: string;
|
|
4
|
+
/** Subdir helper — `workspace.sub("profile")` → `<root>/profile`, created if missing. */
|
|
5
|
+
sub(name: string): string;
|
|
6
|
+
}
|
|
7
|
+
export declare function resolveWorkspace(env?: NodeJS.ProcessEnv): Workspace;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// BROWX_WORKSPACE resolution + subpath helpers. The no-trace contract lives
|
|
2
|
+
// or dies here: every write path browxai produces is rooted at this dir,
|
|
3
|
+
// never at cwd. Resolved once at startup.
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
6
|
+
import { join, resolve } from "node:path";
|
|
7
|
+
const DEFAULT_WORKSPACE = join(homedir(), ".browxai");
|
|
8
|
+
export function resolveWorkspace(env = process.env) {
|
|
9
|
+
const raw = env.BROWX_WORKSPACE?.trim();
|
|
10
|
+
const root = raw ? resolve(raw.replace(/^~(?=$|\/)/, homedir())) : DEFAULT_WORKSPACE;
|
|
11
|
+
if (!existsSync(root))
|
|
12
|
+
mkdirSync(root, { recursive: true });
|
|
13
|
+
return {
|
|
14
|
+
root,
|
|
15
|
+
sub(name) {
|
|
16
|
+
const p = join(root, name);
|
|
17
|
+
if (!existsSync(p))
|
|
18
|
+
mkdirSync(p, { recursive: true });
|
|
19
|
+
return p;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "browxai",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "MCP-native, model-agnostic, agentic-first, multi-engine browser-control server.",
|
|
5
|
+
"author": "Kalebtec <security@kalebtec.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"mcp",
|
|
10
|
+
"model-context-protocol",
|
|
11
|
+
"browser-automation",
|
|
12
|
+
"playwright",
|
|
13
|
+
"cdp",
|
|
14
|
+
"ai-agent",
|
|
15
|
+
"agentic",
|
|
16
|
+
"browser-control"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://browxai.com",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/kalebteccom/browxai.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/kalebteccom/browxai/issues"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=20"
|
|
28
|
+
},
|
|
29
|
+
"packageManager": "pnpm@9.0.0",
|
|
30
|
+
"bin": {
|
|
31
|
+
"browxai": "dist/cli.js"
|
|
32
|
+
},
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"//sideEffects": "RFC 0004 P2 / D1 (SECURITY-CRITICAL): the tool-metadata bootstrap import populates the derived TOOL_CAPABILITY / DEEP_TOOLS capability+engine gates. It MUST survive bundler tree-shaking — a dropped side-effect import would silently un-gate eval_js / register_secret / network_body. List the entry points that perform the bootstrap side-effect (and the bootstrap module itself) so they are never elided. NOT `false`.",
|
|
40
|
+
"sideEffects": [
|
|
41
|
+
"./dist/index.js",
|
|
42
|
+
"./dist/cli.js",
|
|
43
|
+
"./dist/server.js",
|
|
44
|
+
"./dist/sdk/index.js",
|
|
45
|
+
"./dist/tools/tool-metadata.js"
|
|
46
|
+
],
|
|
47
|
+
"files": [
|
|
48
|
+
"dist",
|
|
49
|
+
"THIRD_PARTY_NOTICES.md"
|
|
50
|
+
],
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public",
|
|
53
|
+
"provenance": true
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"prepare": "git config core.hooksPath .githooks || true",
|
|
57
|
+
"prepublishOnly": "node scripts/audit-package-contents.mjs && pnpm typecheck && pnpm test && pnpm build",
|
|
58
|
+
"build": "tsc -p tsconfig.build.json && chmod +x dist/cli.js && pnpm --filter './packages/plugins/*' build",
|
|
59
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
60
|
+
"test": "vitest run",
|
|
61
|
+
"test:keystone": "vitest run --config vitest.keystone.config.ts",
|
|
62
|
+
"bench:network": "tsx scripts/bench-network-envelope.ts",
|
|
63
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
64
|
+
"browxai": "tsx src/cli.ts",
|
|
65
|
+
"gen:sdk-types": "tsx scripts/gen-sdk-tool-types.ts",
|
|
66
|
+
"install-browser": "playwright-core install chromium",
|
|
67
|
+
"docs:dev": "pnpm --filter @browxai/website dev",
|
|
68
|
+
"docs:build": "pnpm --filter @browxai/website build",
|
|
69
|
+
"docs:preview": "pnpm --filter @browxai/website preview",
|
|
70
|
+
"format": "prettier --write .",
|
|
71
|
+
"format:check": "prettier --check .",
|
|
72
|
+
"lint": "eslint .",
|
|
73
|
+
"lint:fix": "eslint . --fix",
|
|
74
|
+
"depcruise": "depcruise --config .dependency-cruiser.cjs src",
|
|
75
|
+
"jscpd:check": "jscpd --config .jscpd.json",
|
|
76
|
+
"licenses:check": "license-checker-rseidelsohn --production --onlyAllow 'MIT;Apache-2.0;BSD-2-Clause;BSD-3-Clause;ISC;0BSD;Unlicense;CC0-1.0'",
|
|
77
|
+
"licenses:notices": "license-checker-rseidelsohn --production --markdown",
|
|
78
|
+
"audit:prod": "pnpm audit --prod --audit-level=high",
|
|
79
|
+
"sbom": "cyclonedx-npm --output-format JSON --output-file sbom.cdx.json",
|
|
80
|
+
"depcheck": "depcheck"
|
|
81
|
+
},
|
|
82
|
+
"pnpm": {
|
|
83
|
+
"overrides": {
|
|
84
|
+
"hono": ">=4.12.21",
|
|
85
|
+
"qs": ">=6.15.2"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"lint-staged": {
|
|
89
|
+
"*.{ts,tsx,js,mjs,cjs}": [
|
|
90
|
+
"prettier --write",
|
|
91
|
+
"eslint --fix"
|
|
92
|
+
],
|
|
93
|
+
"*.{json,md,yml,yaml}": [
|
|
94
|
+
"prettier --write"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"dependencies": {
|
|
98
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
99
|
+
"playwright-core": "^1.48.0",
|
|
100
|
+
"zod": "^3.23.0"
|
|
101
|
+
},
|
|
102
|
+
"devDependencies": {
|
|
103
|
+
"@cyclonedx/cyclonedx-npm": "^2.0.0",
|
|
104
|
+
"@eslint/js": "^9.12.0",
|
|
105
|
+
"@types/node": "^20.14.0",
|
|
106
|
+
"depcheck": "^1.4.7",
|
|
107
|
+
"dependency-cruiser": "^17.4.3",
|
|
108
|
+
"eslint": "^9.12.0",
|
|
109
|
+
"eslint-plugin-import-x": "^4.3.0",
|
|
110
|
+
"globals": "^15.11.0",
|
|
111
|
+
"jscpd": "^5.0.9",
|
|
112
|
+
"license-checker-rseidelsohn": "^4.4.2",
|
|
113
|
+
"lint-staged": "^15.2.10",
|
|
114
|
+
"prettier": "^3.3.3",
|
|
115
|
+
"tsx": "^4.19.0",
|
|
116
|
+
"typescript": "^5.5.0",
|
|
117
|
+
"typescript-eslint": "^8.8.0",
|
|
118
|
+
"vitest": "^2.0.0"
|
|
119
|
+
}
|
|
120
|
+
}
|