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,277 @@
|
|
|
1
|
+
import { confirmByobAction } from "../policy/confirm.js";
|
|
2
|
+
import { withDeadline } from "../util/deadline.js";
|
|
3
|
+
import { estimateTokens } from "../util/tokens.js";
|
|
4
|
+
import { uploadFile } from "../page/upload.js";
|
|
5
|
+
import { dropFiles } from "../page/drop-files.js";
|
|
6
|
+
import { readCapturedBytes } from "../page/downloads.js";
|
|
7
|
+
import { REF_OR_SELECTOR, SESSION_ARG } from "./schemas.js";
|
|
8
|
+
/**
|
|
9
|
+
* Capture + report — file ingress & download egress. `upload_file` / `drop_files`
|
|
10
|
+
* (file ingress into the page), `downloads_capture` / `download_get` (capture and
|
|
11
|
+
* read browser-initiated downloads under the workspace root). Registered through
|
|
12
|
+
* the shared `ToolHost` seam.
|
|
13
|
+
*/
|
|
14
|
+
export function registerCaptureReportUploadTools(host) {
|
|
15
|
+
const { z, register, gateCheck, entryFor, confirmCtxFor, denyContent, asTarget, cfgActionTimeout, workspace, } = host;
|
|
16
|
+
register("upload_file", {
|
|
17
|
+
capability: "file-io",
|
|
18
|
+
description: "Set a file on a file `<input>` (works on hidden inputs) via Playwright `setInputFiles` — the first-class alternative to injecting `File`/`DataTransfer` through `eval_js`. Target the input by `ref`/`selector`. File source is exactly one of: `content` (base64 inline — no filesystem read; pass `name`/`mimeType`) OR `path` (resolved **inside `$BROWX_WORKSPACE` only** — a path escaping the workspace is rejected; stage the file there). Gated by the off-by-default **`file-io`** capability.",
|
|
19
|
+
inputSchema: {
|
|
20
|
+
...REF_OR_SELECTOR,
|
|
21
|
+
name: z
|
|
22
|
+
.string()
|
|
23
|
+
.optional()
|
|
24
|
+
.describe('Filename presented to the page (content-mode; default "upload").'),
|
|
25
|
+
mimeType: z
|
|
26
|
+
.string()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe("MIME type (content-mode; default application/octet-stream)."),
|
|
29
|
+
content: z
|
|
30
|
+
.string()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("base64 file content. Mutually exclusive with `path`."),
|
|
33
|
+
path: z
|
|
34
|
+
.string()
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("Workspace-rooted file path. Mutually exclusive with `content`."),
|
|
37
|
+
...SESSION_ARG,
|
|
38
|
+
},
|
|
39
|
+
}, async (args) => {
|
|
40
|
+
const g = gateCheck("upload_file");
|
|
41
|
+
if (g)
|
|
42
|
+
return g;
|
|
43
|
+
const e = await entryFor(args.session);
|
|
44
|
+
const c = await confirmByobAction("upload_file", confirmCtxFor(e));
|
|
45
|
+
if (!c.ok)
|
|
46
|
+
return denyContent("upload_file", c);
|
|
47
|
+
try {
|
|
48
|
+
const target = asTarget(args, "upload_file", e.refs);
|
|
49
|
+
if ("coords" in target) {
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{
|
|
53
|
+
type: "text",
|
|
54
|
+
text: JSON.stringify({
|
|
55
|
+
ok: false,
|
|
56
|
+
error: "upload_file: target must be a ref/selector for the file input, not coords",
|
|
57
|
+
}, null, 2),
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const r = await withDeadline(uploadFile(e.session.page(), e.refs, workspace.root, {
|
|
63
|
+
target,
|
|
64
|
+
name: args.name,
|
|
65
|
+
mimeType: args.mimeType,
|
|
66
|
+
content: args.content,
|
|
67
|
+
path: args.path,
|
|
68
|
+
}), cfgActionTimeout(), "upload_file");
|
|
69
|
+
return { content: [{ type: "text", text: JSON.stringify(r, null, 2) }] };
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
return {
|
|
73
|
+
content: [
|
|
74
|
+
{
|
|
75
|
+
type: "text",
|
|
76
|
+
text: JSON.stringify({ ok: false, error: err instanceof Error ? err.message : String(err) }, null, 2),
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
// `drop_files` — sibling to `upload_file` for drop-zone uploaders. Modern
|
|
83
|
+
// SaaS file pickers listen for `dragenter`/`dragover`/`drop` with a
|
|
84
|
+
// populated `DataTransfer.files` and never expose an `<input type=file>` —
|
|
85
|
+
// `setInputFiles` can't drive them. drop_files synthesizes the standard
|
|
86
|
+
// HTML5 drop sequence with `File` objects built in-page from the bytes the
|
|
87
|
+
// caller supplies (`path` mode reads from $BROWX_WORKSPACE; `contents`
|
|
88
|
+
// mode is inline base64). Same `file-io` capability as upload_file.
|
|
89
|
+
register("drop_files", {
|
|
90
|
+
capability: "file-io",
|
|
91
|
+
description: "Synthesize an HTML5 file drag-drop on a page element — the first-class alternative to driving DataTransfer through `eval_js` for drop-zone uploaders that don't expose an `<input type=file>` (modern SaaS file pickers). Target via the standard target shapes (`ref`/`selector`/`named`/`coords`). `files[]` carries one or more file entries; each entry is exactly one of: `{path, name?, mimeType?}` (workspace-rooted file — escape-rejected, same posture as `upload_file`'s `path`) OR `{contents, name, mimeType?}` (base64 inline — no filesystem read). Builds an in-page `DataTransfer` populated with `File` objects and dispatches `dragenter` → `dragover` → `drop` on the target with realistic `clientX`/`clientY` (element box centre for ref/selector; literal coords). Drops every file in a single sequence — passing multiple entries simulates the multi-file drop most uploaders support natively. → `{ ok, target, files: [{name, mode, bytes, mimeType}], totalBytes, fileCount, eventsFired, dropDispatched, tokensEstimate }`. Gated by the off-by-default **`file-io`** capability.",
|
|
92
|
+
inputSchema: {
|
|
93
|
+
...REF_OR_SELECTOR,
|
|
94
|
+
files: z
|
|
95
|
+
.array(z.object({
|
|
96
|
+
path: z
|
|
97
|
+
.string()
|
|
98
|
+
.optional()
|
|
99
|
+
.describe("Workspace-rooted file path. Mutually exclusive with `contents`."),
|
|
100
|
+
contents: z
|
|
101
|
+
.string()
|
|
102
|
+
.optional()
|
|
103
|
+
.describe("base64 file content. Mutually exclusive with `path`."),
|
|
104
|
+
name: z
|
|
105
|
+
.string()
|
|
106
|
+
.optional()
|
|
107
|
+
.describe("Filename presented to the page. Required in `contents`-mode; defaults to the basename of `path` in `path`-mode."),
|
|
108
|
+
mimeType: z
|
|
109
|
+
.string()
|
|
110
|
+
.optional()
|
|
111
|
+
.describe('MIME type. Default "application/octet-stream".'),
|
|
112
|
+
}))
|
|
113
|
+
.min(1)
|
|
114
|
+
.describe("Files to drop. Each entry is exactly one of `{path}` or `{contents}` (plus optional `name`/`mimeType`)."),
|
|
115
|
+
...SESSION_ARG,
|
|
116
|
+
},
|
|
117
|
+
}, async (args) => {
|
|
118
|
+
const g = gateCheck("drop_files");
|
|
119
|
+
if (g)
|
|
120
|
+
return g;
|
|
121
|
+
const e = await entryFor(args.session);
|
|
122
|
+
const c = await confirmByobAction("drop_files", confirmCtxFor(e));
|
|
123
|
+
if (!c.ok)
|
|
124
|
+
return denyContent("drop_files", c);
|
|
125
|
+
try {
|
|
126
|
+
const target = asTarget(args, "drop_files", e.refs);
|
|
127
|
+
const r = await withDeadline(dropFiles(e.session.page(), e.refs, workspace.root, {
|
|
128
|
+
target,
|
|
129
|
+
files: args.files,
|
|
130
|
+
}), cfgActionTimeout(), "drop_files");
|
|
131
|
+
const json = JSON.stringify(r);
|
|
132
|
+
return {
|
|
133
|
+
content: [
|
|
134
|
+
{
|
|
135
|
+
type: "text",
|
|
136
|
+
text: JSON.stringify({ ...r, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
const body = { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
143
|
+
return {
|
|
144
|
+
content: [
|
|
145
|
+
{
|
|
146
|
+
type: "text",
|
|
147
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(JSON.stringify(body)) }, null, 2),
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
// Download capture — the reverse of `upload_file`. Off by default per
|
|
154
|
+
// session; toggled by `downloads_capture`. When on, any download fired
|
|
155
|
+
// during a subsequent action lands on `ActionResult.downloads[]` and can
|
|
156
|
+
// be read back via `download_get`. Workspace-rooted paths only.
|
|
157
|
+
register("downloads_capture", {
|
|
158
|
+
capability: "file-io",
|
|
159
|
+
description: "Per-session download capture — toggle interception of Playwright `download` events. When `on:true`, every download fired during a subsequent action is persisted to `$BROWX_WORKSPACE/.downloads/<sessionId>/<prefix>-<sanitised-name>` and surfaced on `ActionResult.downloads[{id, suggestedFilename, mimeType, sizeBytes, path}]`. When `on:false` (the default) the artifact is silently discarded so a session that never opted in leaves no on-disk trace. The page-supplied filename is sanitised (no path separators / NULs / leading dots / control bytes; length-capped) before composing the on-disk name — workspace-escape rejected. Read captured bytes with `download_get({id})`. Gated by the off-by-default **`file-io`** capability — same posture as `upload_file`. → `{ ok, captureOn, storageDir, captured: [{id, suggestedFilename, sizeBytes, path, mimeType?}], tokensEstimate }`. Pass `clear:true` alongside `on:false` to ALSO delete every captured file on disk.",
|
|
160
|
+
inputSchema: {
|
|
161
|
+
on: z.boolean().describe("Turn capture on (true) or off (false). Off by default."),
|
|
162
|
+
clear: z
|
|
163
|
+
.boolean()
|
|
164
|
+
.optional()
|
|
165
|
+
.describe("When toggling off, also delete every previously-captured file from disk. No-op when `on:true`."),
|
|
166
|
+
...SESSION_ARG,
|
|
167
|
+
},
|
|
168
|
+
}, async (args) => {
|
|
169
|
+
const g = gateCheck("downloads_capture");
|
|
170
|
+
if (g)
|
|
171
|
+
return g;
|
|
172
|
+
const e = await entryFor(args.session);
|
|
173
|
+
try {
|
|
174
|
+
e.downloads.captureOn = !!args.on;
|
|
175
|
+
if (!args.on && args.clear) {
|
|
176
|
+
// best-effort cleanup of previously-captured files. Every entry's
|
|
177
|
+
// `path` is rooted under BROWX_WORKSPACE/.downloads/<sessionId>/
|
|
178
|
+
// by construction (see SessionEntry factory + page/downloads.ts).
|
|
179
|
+
const { unlinkSync } = await import("node:fs");
|
|
180
|
+
for (const d of e.downloads.list()) {
|
|
181
|
+
try {
|
|
182
|
+
unlinkSync(d.path);
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
/* best-effort */
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
const captured = e.downloads.list().map((d) => {
|
|
190
|
+
const out = {
|
|
191
|
+
id: d.id,
|
|
192
|
+
suggestedFilename: d.suggestedFilename,
|
|
193
|
+
sizeBytes: d.sizeBytes,
|
|
194
|
+
path: d.path,
|
|
195
|
+
};
|
|
196
|
+
if (d.mimeType !== undefined)
|
|
197
|
+
out.mimeType = d.mimeType;
|
|
198
|
+
return out;
|
|
199
|
+
});
|
|
200
|
+
const body = {
|
|
201
|
+
ok: true,
|
|
202
|
+
captureOn: e.downloads.captureOn,
|
|
203
|
+
storageDir: e.downloads.storageDir,
|
|
204
|
+
captured,
|
|
205
|
+
};
|
|
206
|
+
const json = JSON.stringify(body);
|
|
207
|
+
return {
|
|
208
|
+
content: [
|
|
209
|
+
{
|
|
210
|
+
type: "text",
|
|
211
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
catch (err) {
|
|
217
|
+
return {
|
|
218
|
+
content: [
|
|
219
|
+
{
|
|
220
|
+
type: "text",
|
|
221
|
+
text: JSON.stringify({ ok: false, error: err instanceof Error ? err.message : String(err) }, null, 2),
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
register("download_get", {
|
|
228
|
+
capability: "file-io",
|
|
229
|
+
description: "Return the bytes (base64) of a previously-captured download. Pass the `id` from `ActionResult.downloads[]` (or `downloads_capture({on:true}).captured[]`). Set `pathOnly:true` to skip the base64 payload and return just the workspace-rooted path metadata (useful for very large artifacts an agent only needs to forward to another tool by path). → `{ ok, id, suggestedFilename, mimeType?, sizeBytes, path, content?: base64, tokensEstimate }`. Gated by the off-by-default **`file-io`** capability.",
|
|
230
|
+
inputSchema: {
|
|
231
|
+
id: z.string().describe("Download id from ActionResult.downloads[].id."),
|
|
232
|
+
pathOnly: z
|
|
233
|
+
.boolean()
|
|
234
|
+
.optional()
|
|
235
|
+
.describe("When true, omit the base64 `content` field and return only path/metadata."),
|
|
236
|
+
...SESSION_ARG,
|
|
237
|
+
},
|
|
238
|
+
}, async (args) => {
|
|
239
|
+
const g = gateCheck("download_get");
|
|
240
|
+
if (g)
|
|
241
|
+
return g;
|
|
242
|
+
const e = await entryFor(args.session);
|
|
243
|
+
try {
|
|
244
|
+
const r = readCapturedBytes(e.downloads, args.id);
|
|
245
|
+
const body = {
|
|
246
|
+
ok: true,
|
|
247
|
+
id: args.id,
|
|
248
|
+
suggestedFilename: r.suggestedFilename,
|
|
249
|
+
sizeBytes: r.bytes,
|
|
250
|
+
path: r.path,
|
|
251
|
+
};
|
|
252
|
+
if (r.mimeType !== undefined)
|
|
253
|
+
body.mimeType = r.mimeType;
|
|
254
|
+
if (!args.pathOnly)
|
|
255
|
+
body.content = r.base64;
|
|
256
|
+
const json = JSON.stringify(body);
|
|
257
|
+
return {
|
|
258
|
+
content: [
|
|
259
|
+
{
|
|
260
|
+
type: "text",
|
|
261
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
262
|
+
},
|
|
263
|
+
],
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
catch (err) {
|
|
267
|
+
return {
|
|
268
|
+
content: [
|
|
269
|
+
{
|
|
270
|
+
type: "text",
|
|
271
|
+
text: JSON.stringify({ ok: false, error: err instanceof Error ? err.message : String(err) }, null, 2),
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToolHost } from "./host.js";
|
|
2
|
+
/**
|
|
3
|
+
* Config-store + pre-approval tools — the browxai-managed layered config store
|
|
4
|
+
* (`get_config` / `set_config` / `reset_config`) and the session-independent
|
|
5
|
+
* pre-approval grants (`approve_actions` / `list_approvals`). Registered through
|
|
6
|
+
* the shared `ToolHost` seam.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerConfigApprovalTools(host: ToolHost): void;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config-store + pre-approval tools — the browxai-managed layered config store
|
|
3
|
+
* (`get_config` / `set_config` / `reset_config`) and the session-independent
|
|
4
|
+
* pre-approval grants (`approve_actions` / `list_approvals`). Registered through
|
|
5
|
+
* the shared `ToolHost` seam.
|
|
6
|
+
*/
|
|
7
|
+
export function registerConfigApprovalTools(host) {
|
|
8
|
+
// NOTE: `pluginRecords` is NOT destructured here — `host.pluginRecords` is a
|
|
9
|
+
// LIVE getter (host-build.ts) populated AFTER this tool is registered (the
|
|
10
|
+
// plugin runtime starts later). Destructuring would snapshot the empty
|
|
11
|
+
// pre-load array, so get_config would always report `plugins: []`. Read it
|
|
12
|
+
// live inside the handler instead.
|
|
13
|
+
const { z, register, caps, configStore, approvals } = host;
|
|
14
|
+
// ---------- config store ----------
|
|
15
|
+
const CONFIG_PATCH_SCHEMA = {
|
|
16
|
+
testAttributes: z.array(z.string()).optional(),
|
|
17
|
+
capabilities: z.array(z.string()).optional(),
|
|
18
|
+
confirmRequired: z.array(z.string()).optional(),
|
|
19
|
+
allowedOrigins: z.array(z.string()).optional(),
|
|
20
|
+
blockedOrigins: z.array(z.string()).optional(),
|
|
21
|
+
headless: z.boolean().optional(),
|
|
22
|
+
actionTimeoutMs: z.number().int().positive().max(3_600_000).optional(),
|
|
23
|
+
disableWebSecurity: z.boolean().optional(),
|
|
24
|
+
defaultDevice: z.string().optional(),
|
|
25
|
+
defaultViewport: z
|
|
26
|
+
.object({ width: z.number().int().positive(), height: z.number().int().positive() })
|
|
27
|
+
.optional(),
|
|
28
|
+
hideOverlaySelectors: z.array(z.string()).optional(),
|
|
29
|
+
plugins: z.array(z.string()).optional(),
|
|
30
|
+
unstable: z.record(z.unknown()).optional(),
|
|
31
|
+
};
|
|
32
|
+
register("get_config", {
|
|
33
|
+
batchable: true,
|
|
34
|
+
description: "Inspect browxai configuration. Default returns the fully *resolved* view (precedence: built-in defaults < env [legacy BROWX_*] < user < project < session). Pass `scope` to see one raw pre-merge layer. Config is browxai-managed — change it with `set_config`, never by hand-editing files or env.",
|
|
35
|
+
inputSchema: {
|
|
36
|
+
scope: z
|
|
37
|
+
.enum(["defaults", "env", "user", "project", "session", "resolved"])
|
|
38
|
+
.optional()
|
|
39
|
+
.describe("Which layer to show. Omit or 'resolved' for the merged view."),
|
|
40
|
+
},
|
|
41
|
+
}, async ({ scope }) => {
|
|
42
|
+
let body;
|
|
43
|
+
if (!scope || scope === "resolved") {
|
|
44
|
+
const resolved = configStore.resolve();
|
|
45
|
+
// `capabilities` in the resolved view is the LIVE enforced set — what
|
|
46
|
+
// tool gating actually uses — not the freshly re-resolved config.
|
|
47
|
+
// Those diverge after a `set_config({capabilities})` until a restart;
|
|
48
|
+
// reporting the re-resolved value here would lie to the agent.
|
|
49
|
+
const live = [...caps.enabled].sort();
|
|
50
|
+
const persisted = [...resolved.capabilities].sort();
|
|
51
|
+
// the LIVE enabled plugin set is whatever the runtime
|
|
52
|
+
// loaded at server start (status === "loaded"). Persisted plugins
|
|
53
|
+
// come from the resolved config layer. They diverge after a
|
|
54
|
+
// `set_config({plugins})` until a restart — same posture as
|
|
55
|
+
// capabilities.
|
|
56
|
+
const livePlugins = host.pluginRecords
|
|
57
|
+
.filter((p) => p.status === "loaded")
|
|
58
|
+
.map((p) => p.manifest.name)
|
|
59
|
+
.sort();
|
|
60
|
+
const persistedPlugins = [...resolved.plugins].sort();
|
|
61
|
+
body = {
|
|
62
|
+
scope: "resolved",
|
|
63
|
+
config: { ...resolved, capabilities: live, plugins: livePlugins },
|
|
64
|
+
};
|
|
65
|
+
if (live.join(",") !== persisted.join(",")) {
|
|
66
|
+
body.capabilitiesPendingRestart = {
|
|
67
|
+
active: live,
|
|
68
|
+
persisted,
|
|
69
|
+
note: "`capabilities` was changed via set_config (or env) but is resolved ONCE at server start — the difference takes effect only after a browxai server RESTART. Tool gating enforces `active`.",
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (livePlugins.join(",") !== persistedPlugins.join(",")) {
|
|
73
|
+
body.pluginsPendingRestart = {
|
|
74
|
+
active: livePlugins,
|
|
75
|
+
persisted: persistedPlugins,
|
|
76
|
+
note: "`plugins` was changed via set_config but is resolved ONCE at server start — the difference takes effect only after a browxai server RESTART. Plugin tool registration enforces `active`.",
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
body = { scope, config: configStore.getLayer(scope) };
|
|
82
|
+
}
|
|
83
|
+
return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };
|
|
84
|
+
});
|
|
85
|
+
register("set_config", {
|
|
86
|
+
description: "Persist a config patch into the `user` or `project` layer of the browxai-managed config store (`<workspace>/config.json`). This is the ONLY supported way to set persistent config — no env vars, no hand-edited files. Arrays replace; `unstable.*` shallow-merges. Takes effect for sessions opened after this call (the default session re-resolves lazily). Refuses defaults/env/session scopes.",
|
|
87
|
+
inputSchema: {
|
|
88
|
+
scope: z.enum(["user", "project"]).describe("Which persistent layer to write."),
|
|
89
|
+
patch: z
|
|
90
|
+
.object(CONFIG_PATCH_SCHEMA)
|
|
91
|
+
.describe("Partial config — only the keys you want to override."),
|
|
92
|
+
},
|
|
93
|
+
}, async ({ scope, patch }) => {
|
|
94
|
+
configStore.setLayer(scope, patch);
|
|
95
|
+
return {
|
|
96
|
+
content: [
|
|
97
|
+
{
|
|
98
|
+
type: "text",
|
|
99
|
+
text: JSON.stringify({ ok: true, scope, written: Object.keys(patch), resolved: configStore.resolve() }, null, 2),
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
register("reset_config", {
|
|
105
|
+
description: "Clear a persistent config layer (`user` or `project`) entirely. The built-in defaults + env layer remain.",
|
|
106
|
+
inputSchema: { scope: z.enum(["user", "project"]).describe("Persistent layer to clear.") },
|
|
107
|
+
}, async ({ scope }) => {
|
|
108
|
+
configStore.resetLayer(scope);
|
|
109
|
+
return {
|
|
110
|
+
content: [
|
|
111
|
+
{
|
|
112
|
+
type: "text",
|
|
113
|
+
text: JSON.stringify({ ok: true, cleared: scope, resolved: configStore.resolve() }, null, 2),
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
// ---------- session pre-approvals ----------
|
|
119
|
+
register("approve_actions", {
|
|
120
|
+
batchable: true,
|
|
121
|
+
description: 'session-scoped pre-approval for one or more confirm-required scopes. Lets a non-Claude MCP client run without a human at DevTools to issue page-side `__browx.confirm(true)`. The client calls this once at session start with the scopes to pre-approve (e.g. `["byob_action"]`) and an optional TTL; confirm hooks for those scopes auto-approve within the window. Each grant + consume is logged for audit. Falls back to page-side confirm when no grant covers the scope. Pre-approval is **not** a security boundary — it\'s an unblock for headless flows; tighten by capping `ttlSeconds` per-session.',
|
|
122
|
+
inputSchema: {
|
|
123
|
+
scopes: z
|
|
124
|
+
.array(z.enum(["navigate_off_allowlist", "byob_action", "file_download", "file_upload"]))
|
|
125
|
+
.min(1)
|
|
126
|
+
.describe("Confirm scope names to grant. Same vocabulary as BROWX_CONFIRM_REQUIRED."),
|
|
127
|
+
ttlSeconds: z
|
|
128
|
+
.number()
|
|
129
|
+
.int()
|
|
130
|
+
.positive()
|
|
131
|
+
.max(24 * 60 * 60)
|
|
132
|
+
.optional()
|
|
133
|
+
.describe("Lifetime of the grant in seconds. Default 3600 (1 hour). Hard cap 86400 (24h)."),
|
|
134
|
+
},
|
|
135
|
+
}, async ({ scopes, ttlSeconds }) => {
|
|
136
|
+
const ttl = ttlSeconds ?? 3600;
|
|
137
|
+
for (const scope of scopes)
|
|
138
|
+
approvals.grant(scope, ttl);
|
|
139
|
+
return {
|
|
140
|
+
content: [
|
|
141
|
+
{
|
|
142
|
+
type: "text",
|
|
143
|
+
text: JSON.stringify({
|
|
144
|
+
ok: true,
|
|
145
|
+
granted: scopes,
|
|
146
|
+
ttlSeconds: ttl,
|
|
147
|
+
expiresAt: new Date(Date.now() + ttl * 1000).toISOString(),
|
|
148
|
+
note: "Each call into a granted scope is logged. Subsequent approve_actions calls for the same scope reset the TTL.",
|
|
149
|
+
}, null, 2),
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
register("list_approvals", {
|
|
155
|
+
batchable: true,
|
|
156
|
+
description: "List live pre-approvals from `approve_actions` — scope, grantedAt, expiresAt, uses, remainingMs. Audit helper.",
|
|
157
|
+
inputSchema: {},
|
|
158
|
+
}, async () => ({
|
|
159
|
+
content: [
|
|
160
|
+
{
|
|
161
|
+
type: "text",
|
|
162
|
+
text: JSON.stringify({ approvals: approvals.list() }, null, 2),
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToolHost } from "./host.js";
|
|
2
|
+
/**
|
|
3
|
+
* Deep tools — coverage, layout-thrash, and V8 heap. `coverage_start` /
|
|
4
|
+
* `coverage_stop`, `layout_thrash_trace`, `memory_diff`, `heap_snapshot`, and
|
|
5
|
+
* `heap_retainers`. All CDP-deep (refused off Chromium). Registered through the
|
|
6
|
+
* shared `ToolHost` seam.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerDeepCoverageTools(host: ToolHost): void;
|