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,230 @@
|
|
|
1
|
+
import { withDeadline } from "../util/deadline.js";
|
|
2
|
+
import { confirmByobAction } from "../policy/confirm.js";
|
|
3
|
+
import { injectStorageState, authSave, authLoad, authList, authDelete, } from "../session/storage.js";
|
|
4
|
+
import { SESSION_ARG } from "./schemas.js";
|
|
5
|
+
/**
|
|
6
|
+
* Web-storage + named-auth-state tools: the localStorage / sessionStorage CRUD
|
|
7
|
+
* family (registered via a `for` loop over both kinds) plus auth_save / auth_load /
|
|
8
|
+
* auth_list / auth_delete. Split out of `storage-tools` by cohesive family (RFC
|
|
9
|
+
* 0004 P3 / D3 SRP); registered through the shared `ToolHost` seam in the same
|
|
10
|
+
* source order — the web-storage loop is kept verbatim so the 10 registered names
|
|
11
|
+
* land in the same order.
|
|
12
|
+
*/
|
|
13
|
+
export function registerStorageWebAuthTools(host) {
|
|
14
|
+
const { z, register, gateCheck, entryFor, okText, errText, confirmCtxFor, denyContent, storageFor, workspace, cfgActionTimeout, } = host;
|
|
15
|
+
// ---- layer 2: localStorage / sessionStorage --------------------------------
|
|
16
|
+
// Origin-scoped, page-bound: the session must be navigated to the target
|
|
17
|
+
// origin before any of these tools work. Driven via `page.evaluate(...)`
|
|
18
|
+
// on `window.localStorage` / `window.sessionStorage` — the JS surface is
|
|
19
|
+
// identical, so the implementation factors over a single helper family.
|
|
20
|
+
for (const kind of ["localStorage", "sessionStorage"]) {
|
|
21
|
+
const prefix = kind === "localStorage" ? "localstorage" : "sessionstorage";
|
|
22
|
+
const human = kind === "localStorage" ? "localStorage" : "sessionStorage";
|
|
23
|
+
const lifetimeNote = kind === "localStorage"
|
|
24
|
+
? 'Persists across reloads + browser restarts (within the origin\'s persistent storage; cleared by `inject_storage_state({mode:"replace"})` or a profile wipe).'
|
|
25
|
+
: "Session-scoped: cleared automatically when the top-level browsing context ends (tab close). NOT included in `dump_storage_state`/`storageState()` — capture is intentionally a cookies+localStorage blob.";
|
|
26
|
+
const originScope = `${human} is ORIGIN-SCOPED and tied to the current page — the session MUST be navigated to the target origin before this tool works. On about:blank / a different origin the call rejects with a navigation hint.`;
|
|
27
|
+
register(`${prefix}_get`, {
|
|
28
|
+
capability: "read",
|
|
29
|
+
description: `Read one key from ${human} of the current page's origin. Returns \`{value: string|null, origin}\`. ${originScope} Read-only.`,
|
|
30
|
+
inputSchema: { key: z.string().describe(`${human} key.`), ...SESSION_ARG },
|
|
31
|
+
}, async ({ key, session }) => {
|
|
32
|
+
const g = gateCheck(`${prefix}_get`);
|
|
33
|
+
if (g)
|
|
34
|
+
return g;
|
|
35
|
+
try {
|
|
36
|
+
const e = await entryFor(session);
|
|
37
|
+
const r = await withDeadline(storageFor(e).webStorageGet(kind, { key }, `${prefix}_get`), cfgActionTimeout(), `${prefix}_get`);
|
|
38
|
+
return okText({ ok: true, key, ...r });
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
return errText(`${prefix}_get`, err);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
register(`${prefix}_list`, {
|
|
45
|
+
capability: "read",
|
|
46
|
+
description: `List every key/value pair in ${human} of the current page's origin. Returns \`{entries:[{key,value}...], origin}\`. ${originScope} Read-only.`,
|
|
47
|
+
inputSchema: { ...SESSION_ARG },
|
|
48
|
+
}, async ({ session }) => {
|
|
49
|
+
const g = gateCheck(`${prefix}_list`);
|
|
50
|
+
if (g)
|
|
51
|
+
return g;
|
|
52
|
+
try {
|
|
53
|
+
const e = await entryFor(session);
|
|
54
|
+
const r = await withDeadline(storageFor(e).webStorageList(kind, `${prefix}_list`), cfgActionTimeout(), `${prefix}_list`);
|
|
55
|
+
return okText({ ok: true, count: r.entries.length, ...r });
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
return errText(`${prefix}_list`, err);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
register(`${prefix}_set`, {
|
|
62
|
+
capability: "action",
|
|
63
|
+
description: `Set a key/value in ${human} of the current page's origin. ${lifetimeNote} ${originScope}`,
|
|
64
|
+
inputSchema: {
|
|
65
|
+
key: z.string().describe(`${human} key.`),
|
|
66
|
+
value: z
|
|
67
|
+
.string()
|
|
68
|
+
.describe(`${human} value (string — same as the DOM API, non-strings must be JSON-stringified by the caller).`),
|
|
69
|
+
...SESSION_ARG,
|
|
70
|
+
},
|
|
71
|
+
}, async ({ key, value, session }) => {
|
|
72
|
+
const g = gateCheck(`${prefix}_set`);
|
|
73
|
+
if (g)
|
|
74
|
+
return g;
|
|
75
|
+
try {
|
|
76
|
+
const e = await entryFor(session);
|
|
77
|
+
const c = await confirmByobAction(`${prefix}_set`, confirmCtxFor(e));
|
|
78
|
+
if (!c.ok)
|
|
79
|
+
return denyContent(`${prefix}_set`, c);
|
|
80
|
+
const r = await withDeadline(storageFor(e).webStorageSet(kind, { key, value }, `${prefix}_set`), cfgActionTimeout(), `${prefix}_set`);
|
|
81
|
+
return okText({ ok: r.ok, key, origin: r.origin });
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
return errText(`${prefix}_set`, err);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
register(`${prefix}_delete`, {
|
|
88
|
+
capability: "action",
|
|
89
|
+
description: `Remove a key from ${human} of the current page's origin. Idempotent. ${originScope}`,
|
|
90
|
+
inputSchema: { key: z.string().describe(`${human} key.`), ...SESSION_ARG },
|
|
91
|
+
}, async ({ key, session }) => {
|
|
92
|
+
const g = gateCheck(`${prefix}_delete`);
|
|
93
|
+
if (g)
|
|
94
|
+
return g;
|
|
95
|
+
try {
|
|
96
|
+
const e = await entryFor(session);
|
|
97
|
+
const c = await confirmByobAction(`${prefix}_delete`, confirmCtxFor(e));
|
|
98
|
+
if (!c.ok)
|
|
99
|
+
return denyContent(`${prefix}_delete`, c);
|
|
100
|
+
const r = await withDeadline(storageFor(e).webStorageDelete(kind, { key }, `${prefix}_delete`), cfgActionTimeout(), `${prefix}_delete`);
|
|
101
|
+
return okText({ ok: r.ok, key, origin: r.origin });
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
return errText(`${prefix}_delete`, err);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
register(`${prefix}_clear`, {
|
|
108
|
+
capability: "action",
|
|
109
|
+
description: `Wipe ALL keys in ${human} of the current page's origin. ${originScope}`,
|
|
110
|
+
inputSchema: { ...SESSION_ARG },
|
|
111
|
+
}, async ({ session }) => {
|
|
112
|
+
const g = gateCheck(`${prefix}_clear`);
|
|
113
|
+
if (g)
|
|
114
|
+
return g;
|
|
115
|
+
try {
|
|
116
|
+
const e = await entryFor(session);
|
|
117
|
+
const c = await confirmByobAction(`${prefix}_clear`, confirmCtxFor(e));
|
|
118
|
+
if (!c.ok)
|
|
119
|
+
return denyContent(`${prefix}_clear`, c);
|
|
120
|
+
const r = await withDeadline(storageFor(e).webStorageClear(kind, `${prefix}_clear`), cfgActionTimeout(), `${prefix}_clear`);
|
|
121
|
+
return okText({ ok: r.ok, origin: r.origin });
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
return errText(`${prefix}_clear`, err);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
// ---- layer 3: named auth-states --------------------------------------------
|
|
129
|
+
// Wraps layer 1: auth_save writes a workspace-rooted JSON of the bulk
|
|
130
|
+
// storageState; auth_load reads it back. open_session({authState}) is the
|
|
131
|
+
// canonical seeding path; inject_storage_state({state: <path or blob>})
|
|
132
|
+
// is the in-flight reseat. NO parallel implementation.
|
|
133
|
+
register("auth_save", {
|
|
134
|
+
capability: "action",
|
|
135
|
+
description: "Capture the session's current storage state into a named slot at `$BROWX_WORKSPACE/.auth-states/<name>.json`. Names are letters/digits/`._-` only (no separators, no `..`). Overwrites an existing slot of the same name. Pair with `open_session({authState})` to spin up a session pre-logged-in, or with `auth_load` + `inject_storage_state` for in-flight reseating. SECURITY NOTE: cookie *values* may carry credentials — these files are sensitive (a future secrets-masking pass lands separately).",
|
|
136
|
+
inputSchema: {
|
|
137
|
+
name: z.string().describe("Slot name (letters/digits/`._-` only)."),
|
|
138
|
+
...SESSION_ARG,
|
|
139
|
+
},
|
|
140
|
+
}, async ({ name, session }) => {
|
|
141
|
+
const g = gateCheck("auth_save");
|
|
142
|
+
if (g)
|
|
143
|
+
return g;
|
|
144
|
+
try {
|
|
145
|
+
const e = await entryFor(session);
|
|
146
|
+
const c = await confirmByobAction("auth_save", confirmCtxFor(e));
|
|
147
|
+
if (!c.ok)
|
|
148
|
+
return denyContent("auth_save", c);
|
|
149
|
+
const r = await withDeadline(authSave(e.session.page().context(), workspace.root, name), cfgActionTimeout(), "auth_save");
|
|
150
|
+
return okText({ ...r });
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
return errText("auth_save", err);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
register("auth_load", {
|
|
157
|
+
capability: "action",
|
|
158
|
+
description: 'Load a named storage-state slot AND apply it to an existing session (replaces the context\'s cookies/localStorage/IndexedDB — same semantics as `inject_storage_state({mode:"replace"})`). For SEEDING a new session at creation time, prefer `open_session({authState:"<name>"})` — that\'s cheaper (no clear-then-replace cycle on a fresh context) and lets incognito mode use the Playwright-native primitive.',
|
|
159
|
+
inputSchema: {
|
|
160
|
+
name: z.string().describe("Slot name (must exist; auth_save it first)."),
|
|
161
|
+
...SESSION_ARG,
|
|
162
|
+
},
|
|
163
|
+
}, async ({ name, session }) => {
|
|
164
|
+
const g = gateCheck("auth_load");
|
|
165
|
+
if (g)
|
|
166
|
+
return g;
|
|
167
|
+
try {
|
|
168
|
+
const e = await entryFor(session);
|
|
169
|
+
const c = await confirmByobAction("auth_load", confirmCtxFor(e));
|
|
170
|
+
if (!c.ok)
|
|
171
|
+
return denyContent("auth_load", c);
|
|
172
|
+
const blob = authLoad(workspace.root, name);
|
|
173
|
+
const r = await withDeadline(injectStorageState(e.session.page().context(), e.session.page(), blob, {
|
|
174
|
+
mode: "replace",
|
|
175
|
+
}), cfgActionTimeout(), "auth_load");
|
|
176
|
+
return okText({ ok: true, name, applied: r });
|
|
177
|
+
}
|
|
178
|
+
catch (err) {
|
|
179
|
+
return errText("auth_load", err);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
register("auth_list", {
|
|
183
|
+
capability: "read",
|
|
184
|
+
description: "Enumerate every named auth-state slot in the workspace. Returns `{name, path, bytes, modifiedAt}` per slot, sorted by name. Read-only.",
|
|
185
|
+
inputSchema: {},
|
|
186
|
+
}, async () => {
|
|
187
|
+
const g = gateCheck("auth_list");
|
|
188
|
+
if (g)
|
|
189
|
+
return g;
|
|
190
|
+
try {
|
|
191
|
+
const slots = authList(workspace.root);
|
|
192
|
+
return okText({ ok: true, count: slots.length, slots });
|
|
193
|
+
}
|
|
194
|
+
catch (err) {
|
|
195
|
+
return errText("auth_list", err);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
register("auth_delete", {
|
|
199
|
+
capability: "action",
|
|
200
|
+
description: "Remove a named auth-state slot from the workspace. Idempotent (`existed:false` if it wasn't there).",
|
|
201
|
+
inputSchema: { name: z.string().describe("Slot name.") },
|
|
202
|
+
}, async ({ name }) => {
|
|
203
|
+
const g = gateCheck("auth_delete");
|
|
204
|
+
if (g)
|
|
205
|
+
return g;
|
|
206
|
+
try {
|
|
207
|
+
const r = authDelete(workspace.root, name);
|
|
208
|
+
return okText({ ...r, name });
|
|
209
|
+
}
|
|
210
|
+
catch (err) {
|
|
211
|
+
return errText("auth_delete", err);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
// ===========================================================================
|
|
215
|
+
// Cache API + IndexedDB CRUD.
|
|
216
|
+
//
|
|
217
|
+
// Sibling families of the cookie / web-storage CRUD above. Both APIs are
|
|
218
|
+
// ORIGIN-SCOPED — the page MUST be navigated to the target origin first
|
|
219
|
+
// (same posture as localStorage / sessionStorage). On about:blank or a
|
|
220
|
+
// different origin the call rejects with a navigation hint.
|
|
221
|
+
//
|
|
222
|
+
// Capability split:
|
|
223
|
+
// reads (`caches_list_storages`, `caches_list`, `caches_get`,
|
|
224
|
+
// `idb_list_databases`, `idb_list_stores`, `idb_get`) → `read`
|
|
225
|
+
// writes (`caches_put`, `caches_delete`, `caches_clear`,
|
|
226
|
+
// `caches_delete_storage`, `idb_put`, `idb_delete`,
|
|
227
|
+
// `idb_clear`) → `action`
|
|
228
|
+
// No new capability gate — same posture as web-storage CRUD.
|
|
229
|
+
// ===========================================================================
|
|
230
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToolRegistration } from "./host.js";
|
|
2
|
+
/** Run every core tool registration once against a browser-free host and return
|
|
3
|
+
* the accumulated metadata table (name → `ToolMeta` + zod schema). The two
|
|
4
|
+
* plugin-info tools (`plugins_list` / `plugins_info`) are registered inside the
|
|
5
|
+
* async `wirePluginRuntime` (which loads plugins from disk); their capability is
|
|
6
|
+
* declared from the shared `PLUGIN_INFO_TOOL_CAPABILITY` source so collection
|
|
7
|
+
* stays synchronous and IO-free. Cached after the first run. */
|
|
8
|
+
export declare function collectToolMetadata(): ReadonlyMap<string, ToolRegistration>;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// Tool-metadata bootstrap (RFC 0004 P2 / D2 + D7).
|
|
2
|
+
//
|
|
3
|
+
// The per-tool gating facts (`capability` / `batchable` / `deep`) and the zod
|
|
4
|
+
// input schema are declared inline at each `host.register` call — the single
|
|
5
|
+
// source of truth. The three central maps (`TOOL_CAPABILITY`,
|
|
6
|
+
// `BATCH_ALLOWED_TOOLS`, `DEEP_TOOLS`) and the SDK tool-types codegen are DERIVED
|
|
7
|
+
// from those registrations.
|
|
8
|
+
//
|
|
9
|
+
// Most consumers read a derived map only AFTER `createServer` has run every
|
|
10
|
+
// `registerXxxTools(host)` module, so the maps are already populated. But a few
|
|
11
|
+
// read them standalone — `resolveCapabilities` (a unit test, `browxai doctor`),
|
|
12
|
+
// the SDK registry's `capabilityFor`, and the SDK tool-types generator. For those
|
|
13
|
+
// callers this module exposes `collectToolMetadata()`: it builds a browser-free
|
|
14
|
+
// host, runs every registration once, and returns the accumulated table. It also
|
|
15
|
+
// installs that collection as the lazy populator behind `TOOL_CAPABILITY` /
|
|
16
|
+
// `DEEP_TOOLS` (the inverted dependency the leaf modules `capabilities.ts` /
|
|
17
|
+
// `tool-gate.ts` cannot express directly — they can't import the tools layer).
|
|
18
|
+
//
|
|
19
|
+
// The collection is browser-free and idempotent: the host's session factory is
|
|
20
|
+
// lazy (no browser opens), the handlers are never invoked (only their `def`
|
|
21
|
+
// metadata is read), and `declareToolCapability` / `declareDeepTool` are no-ops
|
|
22
|
+
// on a repeat of the same value.
|
|
23
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
24
|
+
import { installToolMetadataCollector, resolveCapabilities, resolveConfirmHooks, } from "../util/capabilities.js";
|
|
25
|
+
import { installDeepToolsCollector } from "../engine/tool-gate.js";
|
|
26
|
+
import { resolveConfig } from "../util/config.js";
|
|
27
|
+
import { resolveWorkspace } from "../util/workspace.js";
|
|
28
|
+
import { ConfigStore, resolvedToEnv } from "../util/config-store.js";
|
|
29
|
+
import { resolveOriginPolicy } from "../policy/origin.js";
|
|
30
|
+
import { ApprovalStore } from "../policy/confirm.js";
|
|
31
|
+
import { resolveCredentialsProvider } from "../util/credentials.js";
|
|
32
|
+
import { DiagnosticsRecorder } from "../util/diagnostics.js";
|
|
33
|
+
import { PACKAGE_VERSION } from "../util/version.js";
|
|
34
|
+
import { buildHost } from "./host-build.js";
|
|
35
|
+
import { buildSessionRegistry } from "./session-registry.js";
|
|
36
|
+
import { registerActionTools } from "./action-tools.js";
|
|
37
|
+
import { registerReadObserveDomTools } from "./read-observe-dom-tools.js";
|
|
38
|
+
import { registerReadObserveExtractTools } from "./read-observe-extract-tools.js";
|
|
39
|
+
import { registerReadObserveVerifyTools } from "./read-observe-verify-tools.js";
|
|
40
|
+
import { registerReadObserveCaptureTools } from "./read-observe-capture-tools.js";
|
|
41
|
+
import { registerReadObserveBufferTools } from "./read-observe-buffer-tools.js";
|
|
42
|
+
import { registerGestureNetworkTools } from "./gesture-network-tools.js";
|
|
43
|
+
import { registerDeepPerfTools } from "./deep-perf-tools.js";
|
|
44
|
+
import { registerDeepCoverageTools } from "./deep-coverage-tools.js";
|
|
45
|
+
import { registerDeepDeterminismTools } from "./deep-determinism-tools.js";
|
|
46
|
+
import { registerCaptureReportMarksTools } from "./capture-report-marks-tools.js";
|
|
47
|
+
import { registerCaptureReportDiagnosticsTools } from "./capture-report-diagnostics-tools.js";
|
|
48
|
+
import { registerCaptureReportUploadTools } from "./capture-report-upload-tools.js";
|
|
49
|
+
import { registerCaptureReportExportTools } from "./capture-report-export-tools.js";
|
|
50
|
+
import { registerCaptureReportElementExportTools } from "./capture-report-element-export-tools.js";
|
|
51
|
+
import { registerCanvasTools } from "./canvas-tools.js";
|
|
52
|
+
import { registerStorageTools } from "./storage-tools.js";
|
|
53
|
+
import { registerFormsRecordingTools } from "./forms-recording-tools.js";
|
|
54
|
+
import { registerSessionPolicyTools } from "./session-policy-tools.js";
|
|
55
|
+
import { registerDeviceEmulationTools } from "./device-emulation-tools.js";
|
|
56
|
+
import { registerLiveEmulationTools } from "./live-emulation-tools.js";
|
|
57
|
+
import { registerConfigApprovalTools } from "./config-approval-tools.js";
|
|
58
|
+
import { registerSecretsCaptchaTools } from "./secrets-captcha-tools.js";
|
|
59
|
+
import { registerInputTools } from "./input-tools.js";
|
|
60
|
+
import { registerExtensionsBatchTools } from "./extensions-batch-tools.js";
|
|
61
|
+
import { PLUGIN_INFO_TOOL_CAPABILITY } from "./plugin-runtime.js";
|
|
62
|
+
/** Build a browser-free `HostDeps` so `buildHost` runs without opening a browser.
|
|
63
|
+
* Mirrors the deps `createServer` assembles (server.ts) via the same public
|
|
64
|
+
* resolvers; the session-registry factory is lazy (no session opens), and the
|
|
65
|
+
* two per-handler closures (`describeTarget` / `asTarget`) are stubs `buildHost`
|
|
66
|
+
* only stores and never invokes at construction. */
|
|
67
|
+
function makeMetadataHostDeps() {
|
|
68
|
+
const workspace = resolveWorkspace();
|
|
69
|
+
const configStore = new ConfigStore(workspace.root);
|
|
70
|
+
const resolvedConfig = configStore.resolve();
|
|
71
|
+
const cfgEnv = resolvedToEnv(resolvedConfig);
|
|
72
|
+
const config = resolveConfig(cfgEnv);
|
|
73
|
+
const caps = resolveCapabilities(cfgEnv);
|
|
74
|
+
const confirmHooks = resolveConfirmHooks(cfgEnv);
|
|
75
|
+
const originPolicy = resolveOriginPolicy(cfgEnv);
|
|
76
|
+
const approvals = new ApprovalStore();
|
|
77
|
+
const credentialsResolved = resolveCredentialsProvider(cfgEnv);
|
|
78
|
+
const diagnostics = new DiagnosticsRecorder({ enabled: false, workspaceRoot: workspace.root });
|
|
79
|
+
const registry = buildSessionRegistry({
|
|
80
|
+
opts: { headless: true },
|
|
81
|
+
resolvedConfig,
|
|
82
|
+
configStore,
|
|
83
|
+
caps,
|
|
84
|
+
workspace,
|
|
85
|
+
serverEngine: "chromium",
|
|
86
|
+
serverDefaultMode: "persistent",
|
|
87
|
+
});
|
|
88
|
+
// The collection server is throwaway (never served) — name/version are cosmetic.
|
|
89
|
+
const server = new McpServer({ name: "browxai", version: PACKAGE_VERSION }, { capabilities: { tools: {} } });
|
|
90
|
+
const toolHandlers = {};
|
|
91
|
+
return {
|
|
92
|
+
server,
|
|
93
|
+
toolHandlers,
|
|
94
|
+
registry,
|
|
95
|
+
config,
|
|
96
|
+
configStore,
|
|
97
|
+
resolvedConfig,
|
|
98
|
+
caps,
|
|
99
|
+
confirmHooks,
|
|
100
|
+
originPolicy,
|
|
101
|
+
approvals,
|
|
102
|
+
isByob: false,
|
|
103
|
+
workspace,
|
|
104
|
+
diagnostics,
|
|
105
|
+
credentialsResolved,
|
|
106
|
+
pluginRecords: () => [],
|
|
107
|
+
startOptions: { headless: true },
|
|
108
|
+
describeTarget: async () => "",
|
|
109
|
+
asTarget: () => {
|
|
110
|
+
throw new Error("asTarget is a metadata-collection stub — no handler runs here");
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
let cached;
|
|
115
|
+
/** Run every core tool registration once against a browser-free host and return
|
|
116
|
+
* the accumulated metadata table (name → `ToolMeta` + zod schema). The two
|
|
117
|
+
* plugin-info tools (`plugins_list` / `plugins_info`) are registered inside the
|
|
118
|
+
* async `wirePluginRuntime` (which loads plugins from disk); their capability is
|
|
119
|
+
* declared from the shared `PLUGIN_INFO_TOOL_CAPABILITY` source so collection
|
|
120
|
+
* stays synchronous and IO-free. Cached after the first run. */
|
|
121
|
+
export function collectToolMetadata() {
|
|
122
|
+
if (cached)
|
|
123
|
+
return cached;
|
|
124
|
+
const host = buildHost(makeMetadataHostDeps());
|
|
125
|
+
registerReadObserveDomTools(host);
|
|
126
|
+
registerReadObserveExtractTools(host);
|
|
127
|
+
registerReadObserveVerifyTools(host);
|
|
128
|
+
registerReadObserveCaptureTools(host);
|
|
129
|
+
registerReadObserveBufferTools(host);
|
|
130
|
+
registerActionTools(host);
|
|
131
|
+
registerGestureNetworkTools(host);
|
|
132
|
+
registerDeepPerfTools(host);
|
|
133
|
+
registerDeepCoverageTools(host);
|
|
134
|
+
registerDeepDeterminismTools(host);
|
|
135
|
+
registerCaptureReportMarksTools(host);
|
|
136
|
+
registerCaptureReportDiagnosticsTools(host);
|
|
137
|
+
registerCaptureReportUploadTools(host);
|
|
138
|
+
registerCaptureReportExportTools(host);
|
|
139
|
+
registerCaptureReportElementExportTools(host);
|
|
140
|
+
registerCanvasTools(host);
|
|
141
|
+
registerStorageTools(host);
|
|
142
|
+
registerFormsRecordingTools(host);
|
|
143
|
+
registerSessionPolicyTools(host);
|
|
144
|
+
registerDeviceEmulationTools(host);
|
|
145
|
+
registerLiveEmulationTools(host);
|
|
146
|
+
registerConfigApprovalTools(host);
|
|
147
|
+
registerSecretsCaptchaTools(host);
|
|
148
|
+
registerInputTools(host);
|
|
149
|
+
registerExtensionsBatchTools(host);
|
|
150
|
+
// The two plugin-info MCP tools register inside the async plugin runtime; their
|
|
151
|
+
// capability (the only metadata that matters for the derived maps) is declared
|
|
152
|
+
// from the shared single source so we don't run the plugin loader to collect it.
|
|
153
|
+
const table = new Map(host.registrations);
|
|
154
|
+
for (const [name, capability] of Object.entries(PLUGIN_INFO_TOOL_CAPABILITY)) {
|
|
155
|
+
host.register(name, { description: `${name} (plugin runtime)`, capability }, async () => ({
|
|
156
|
+
content: [],
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
for (const [name, reg] of host.registrations)
|
|
160
|
+
table.set(name, reg);
|
|
161
|
+
cached = table;
|
|
162
|
+
return cached;
|
|
163
|
+
}
|
|
164
|
+
// Install the collection as the lazy populator behind the derived maps. A read of
|
|
165
|
+
// `TOOL_CAPABILITY` / `DEEP_TOOLS` (or a `resolveCapabilities` call) that happens
|
|
166
|
+
// before `createServer` ran will now trigger `collectToolMetadata()` once and see
|
|
167
|
+
// the full derived rows — without the standalone caller having to build a server.
|
|
168
|
+
installToolMetadataCollector(() => {
|
|
169
|
+
collectToolMetadata();
|
|
170
|
+
});
|
|
171
|
+
installDeepToolsCollector(() => {
|
|
172
|
+
collectToolMetadata();
|
|
173
|
+
});
|
|
174
|
+
// D1 (RFC 0004 P2, SECURITY-CRITICAL): EAGERLY populate the derived maps at import
|
|
175
|
+
// time — do not wait for the first lazy read. Importing this bootstrap is the
|
|
176
|
+
// composition-root install point reached by every real entry point (the package
|
|
177
|
+
// entry `src/index.ts`, `createServer` in `src/server.ts`, the SDK client in
|
|
178
|
+
// `src/sdk/index.ts`, and the CLI `src/cli.ts`). With the maps populated on import,
|
|
179
|
+
// the gate's fail-safe (`assertGateBootstrapped` / `assertEngineGateBootstrapped`)
|
|
180
|
+
// never fires on a production read — it stays a backstop against a NEW consumer
|
|
181
|
+
// that forgets to reach this bootstrap. The collection is cached, so the eager run
|
|
182
|
+
// is paid once. createServer calls `resolveCapabilities` BEFORE its own tool
|
|
183
|
+
// registrations; because this eager run already populated the maps, that early
|
|
184
|
+
// read sees the full rows rather than an empty (fail-open) map.
|
|
185
|
+
collectToolMetadata();
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type Predicate } from "./predicates.js";
|
|
2
|
+
export interface BatchCall {
|
|
3
|
+
tool: string;
|
|
4
|
+
args?: Record<string, unknown>;
|
|
5
|
+
/** opaque label echoed verbatim in the result for cross-referencing in
|
|
6
|
+
* long batches ("set type", "set initiative", "save row"). Free-form. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** optional post-call assertions. Failing any assertion marks the call
|
|
9
|
+
* as `ok: false` with `error` set to the failed predicate, and respects
|
|
10
|
+
* `stopOnError`. Minimal predicate set — not a full assertion DSL. */
|
|
11
|
+
expect?: BatchExpect;
|
|
12
|
+
}
|
|
13
|
+
export interface BatchExpect {
|
|
14
|
+
/** Inner result's `element.value === <string>`. */
|
|
15
|
+
valueEquals?: string;
|
|
16
|
+
/** Inner result's `element.displayText` includes the substring. */
|
|
17
|
+
displayTextIncludes?: string;
|
|
18
|
+
/** Inner result's `element.ownerControl.displayTextAfter` includes the substring. */
|
|
19
|
+
controlDisplayTextIncludes?: string;
|
|
20
|
+
/** Inner result's `element.container.rowText` includes the substring. */
|
|
21
|
+
containerTextIncludes?: string;
|
|
22
|
+
/** Inner result's `element.ownerControl.changed === true`. */
|
|
23
|
+
controlChanged?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface BatchEntry {
|
|
26
|
+
tool: string;
|
|
27
|
+
/** Echo of the call's `label` when supplied. */
|
|
28
|
+
label?: string;
|
|
29
|
+
ok: boolean;
|
|
30
|
+
result?: unknown;
|
|
31
|
+
error?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface BatchReport {
|
|
34
|
+
completed: number;
|
|
35
|
+
failedAt: number | null;
|
|
36
|
+
results: BatchEntry[];
|
|
37
|
+
}
|
|
38
|
+
export type ToolContent = {
|
|
39
|
+
type: "text";
|
|
40
|
+
text: string;
|
|
41
|
+
} | {
|
|
42
|
+
type: string;
|
|
43
|
+
[k: string]: unknown;
|
|
44
|
+
};
|
|
45
|
+
export interface ToolResponse {
|
|
46
|
+
content: ToolContent[];
|
|
47
|
+
}
|
|
48
|
+
export type ToolHandler = (args: unknown) => Promise<ToolResponse>;
|
|
49
|
+
export interface BatchOptions {
|
|
50
|
+
allowed: ReadonlySet<string>;
|
|
51
|
+
handlers: Record<string, ToolHandler>;
|
|
52
|
+
stopOnError?: boolean;
|
|
53
|
+
}
|
|
54
|
+
export declare function runBatch(calls: BatchCall[], opts: BatchOptions): Promise<BatchReport>;
|
|
55
|
+
/**
|
|
56
|
+
* Evaluate a `BatchExpect` against the parsed inner-call result. Returns null
|
|
57
|
+
* when all predicates pass, or a string describing the first failed predicate.
|
|
58
|
+
*
|
|
59
|
+
* Implementation: each shorthand field lowers into a `Predicate` and runs
|
|
60
|
+
* through the shared `evaluatePredicate` engine — same vocabulary that backs
|
|
61
|
+
* `verify_predicate`. The shorthand INPUT shape stays frozen; the engine
|
|
62
|
+
* underneath is shared so semantic primitives (`contains`, `equals`) can
|
|
63
|
+
* never drift between the two surfaces. The data bag is the inner-call body
|
|
64
|
+
* itself (an ActionResult-shaped `{element: {...}}`); paths use the
|
|
65
|
+
* `element.*` root, which is on the predicate engine's accessor allow-list.
|
|
66
|
+
*
|
|
67
|
+
* Exported for unit tests.
|
|
68
|
+
*/
|
|
69
|
+
export declare function evaluateExpect(expect: BatchExpect, body: unknown): string | null;
|
|
70
|
+
interface LoweredShorthand {
|
|
71
|
+
/** Source shorthand field name — used in the failure string so the
|
|
72
|
+
* user-facing message still names the shorthand they supplied. */
|
|
73
|
+
field: keyof BatchExpect;
|
|
74
|
+
/** Path label for the failure message (e.g. "element.value"). */
|
|
75
|
+
path: string;
|
|
76
|
+
/** The value the shorthand expected (echoed in the failure message). */
|
|
77
|
+
expected: unknown;
|
|
78
|
+
predicate: Predicate;
|
|
79
|
+
}
|
|
80
|
+
/** Pure; exported for tests + the equivalence-pinning regression. Each
|
|
81
|
+
* supplied shorthand field becomes one predicate over the inner body. */
|
|
82
|
+
export declare function lowerExpect(expect: BatchExpect): LoweredShorthand[];
|
|
83
|
+
export {};
|