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,246 @@
|
|
|
1
|
+
import { requireCdp } from "../engine/index.js";
|
|
2
|
+
import { withDeadline } from "../util/deadline.js";
|
|
3
|
+
import { estimateTokens } from "../util/tokens.js";
|
|
4
|
+
import { assetExport } from "../page/asset-export.js";
|
|
5
|
+
import { pdfSave, assertPdfSupported } from "../page/pdf.js";
|
|
6
|
+
import { pageArchive } from "../page/archive.js";
|
|
7
|
+
import { SESSION_ARG } from "./schemas.js";
|
|
8
|
+
/**
|
|
9
|
+
* Capture + report — page-level artefact export. `asset_export` (persist the
|
|
10
|
+
* session's network ring to disk), `pdf_save`, and `page_archive` (a
|
|
11
|
+
* self-contained whole-document capture). Workspace-rooted output by
|
|
12
|
+
* construction; registered through the shared `ToolHost` seam.
|
|
13
|
+
*/
|
|
14
|
+
export function registerCaptureReportExportTools(host) {
|
|
15
|
+
const { z, register, gateCheck, engineGate, entryFor, cfgActionTimeout, workspace } = host;
|
|
16
|
+
// `asset_export` — filter the session's network ring and persist matching
|
|
17
|
+
// responses to a workspace-rooted dir. Mirrors `download_get`'s file-io
|
|
18
|
+
// posture (read session-buffered state, write bytes under $BROWX_WORKSPACE).
|
|
19
|
+
// CORS caveat: when a response body has aged out of the renderer cache the
|
|
20
|
+
// tool falls back to an in-page `fetch()` against the original URL —
|
|
21
|
+
// cross-origin URLs without permissive CORS headers will land in
|
|
22
|
+
// `droppedCount`, not a crash.
|
|
23
|
+
register("asset_export", {
|
|
24
|
+
capability: "file-io",
|
|
25
|
+
description: 'Filter every resource the session has loaded (the always-on `NetworkBuffer` ring) and persist matching responses to a workspace-rooted directory — the first-class alternative to scraping `<img src>` / `<link href>` then re-fetching each one through `eval_js`. Filter shape: `{mime?: string[], urlPattern?: string, minBytes?: number, maxBytes?: number, status?: number[]}`. `mime` is substring match against the captured response `Content-Type` (case-insensitive, any one match wins; e.g. `["image/", "video/"]`). `urlPattern` is a RegExp source matched case-insensitively against the URL (e.g. `"\\\\.(woff2?|ttf|otf)$"`). `minBytes`/`maxBytes` bound the encoded response size when known. `status` defaults to 2xx (200..299). Filenames are derived from the URL path basename, **sanitised** (no path separators / NULs / leading dots / control bytes; length-capped), and collision-resolved with `-N` suffix. `intoDir` defaults to `$BROWX_WORKSPACE/assets/<sessionId>-<ISO>/`; an explicit value is resolved INSIDE `$BROWX_WORKSPACE` (escape rejected). Per-call caps: `maxCount` (default 10000) + `maxBytes` (default 500 MiB) bound runaway exports — callers can raise both up to hard ceilings. **CORS caveat**: when the response body has been discarded by the renderer (bodies are short-lived) the tool falls back to an in-page `fetch()` against the original URL — cross-origin URLs without permissive CORS headers land in `droppedCount`, never a crash. → `{ ok, intoDir, totalCount, matchedCount, persistedCount, droppedCount, manifest: [{url, mime?, status?, sizeBytes, savedAs}], warnings, tokensEstimate }`. The manifest is also written to `<intoDir>/_manifest.json`. `tokensEstimate` sizes the result envelope (the manifest blob), NOT the exported files. Gated by the off-by-default **`file-io`** capability — same posture as `download_get`.',
|
|
26
|
+
inputSchema: {
|
|
27
|
+
filter: z
|
|
28
|
+
.object({
|
|
29
|
+
mime: z
|
|
30
|
+
.array(z.string())
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("Substring match against response Content-Type (case-insensitive). Any one match wins."),
|
|
33
|
+
urlPattern: z
|
|
34
|
+
.string()
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("RegExp source matched case-insensitively against the URL."),
|
|
37
|
+
minBytes: z
|
|
38
|
+
.number()
|
|
39
|
+
.int()
|
|
40
|
+
.nonnegative()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("Inclusive lower bound on encoded response byte size (when known)."),
|
|
43
|
+
maxBytes: z
|
|
44
|
+
.number()
|
|
45
|
+
.int()
|
|
46
|
+
.nonnegative()
|
|
47
|
+
.optional()
|
|
48
|
+
.describe("Inclusive upper bound on encoded response byte size (when known)."),
|
|
49
|
+
status: z
|
|
50
|
+
.array(z.number().int())
|
|
51
|
+
.optional()
|
|
52
|
+
.describe("Allow-list of HTTP status codes. Default: 200..299."),
|
|
53
|
+
})
|
|
54
|
+
.describe("Filter applied to every entry in the session's network ring."),
|
|
55
|
+
intoDir: z
|
|
56
|
+
.string()
|
|
57
|
+
.optional()
|
|
58
|
+
.describe("Workspace-rooted output directory. Default `assets/<sessionId>-<ISO>/`. Rejected if it escapes $BROWX_WORKSPACE."),
|
|
59
|
+
maxCount: z
|
|
60
|
+
.number()
|
|
61
|
+
.int()
|
|
62
|
+
.positive()
|
|
63
|
+
.optional()
|
|
64
|
+
.describe("Override the per-call file count cap (default 10000; clamped to hard ceiling 50000)."),
|
|
65
|
+
maxBytes: z
|
|
66
|
+
.number()
|
|
67
|
+
.int()
|
|
68
|
+
.positive()
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Override the per-call total byte cap (default 500 MiB; clamped to hard ceiling 2 GiB)."),
|
|
71
|
+
...SESSION_ARG,
|
|
72
|
+
},
|
|
73
|
+
}, async (args) => {
|
|
74
|
+
const g = gateCheck("asset_export");
|
|
75
|
+
if (g)
|
|
76
|
+
return g;
|
|
77
|
+
const e = await entryFor(args.session);
|
|
78
|
+
try {
|
|
79
|
+
const result = await withDeadline(assetExport({
|
|
80
|
+
cdp: requireCdp(e.session),
|
|
81
|
+
page: e.session.page(),
|
|
82
|
+
buffer: e.network,
|
|
83
|
+
workspaceRoot: workspace.root,
|
|
84
|
+
sessionId: e.id,
|
|
85
|
+
}, {
|
|
86
|
+
filter: args.filter ?? {},
|
|
87
|
+
intoDir: args.intoDir,
|
|
88
|
+
maxCount: args.maxCount,
|
|
89
|
+
maxBytes: args.maxBytes,
|
|
90
|
+
}), cfgActionTimeout(), "asset_export");
|
|
91
|
+
const json = JSON.stringify(result);
|
|
92
|
+
return {
|
|
93
|
+
content: [
|
|
94
|
+
{
|
|
95
|
+
type: "text",
|
|
96
|
+
text: JSON.stringify({ ...result, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
const body = { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
103
|
+
return {
|
|
104
|
+
content: [
|
|
105
|
+
{
|
|
106
|
+
type: "text",
|
|
107
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(JSON.stringify(body)) }, null, 2),
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
// `pdf_save` — print the current page to a workspace-rooted PDF via
|
|
114
|
+
// Playwright `page.pdf()` (CDP `Page.printToPDF`). The mirror of
|
|
115
|
+
// `upload_file`: file-io OUT instead of IN. Chromium-only (every browxai
|
|
116
|
+
// session is Chromium so that's fine); refuses cleanly on `attached`/BYOB
|
|
117
|
+
// sessions where driving PrintToPDF would surface a print dialog / mutate
|
|
118
|
+
// the human's window state. Workspace-rooted by construction.
|
|
119
|
+
register("pdf_save", {
|
|
120
|
+
capability: "action",
|
|
121
|
+
deep: true,
|
|
122
|
+
description: "Print the current page to a workspace-rooted PDF via Playwright `page.pdf()` (CDP `Page.printToPDF`). The first-class alternative to screenshot-and-OCR or driving the browser's print-to-file dialog with `shortcut`. → `{ ok, path, bytes, format, scale, printBackground }`. Defaults: `format:\"A4\"`, `scale:1`, `printBackground:false` (matches browser-print's default — opt in when background colour/imagery matters). Output `path` is resolved INSIDE `$BROWX_WORKSPACE` (a path escaping the workspace is rejected); omit it for a default `pdfs/<sessionId>-<ts>.pdf`. **Refuses on `attached`/BYOB sessions** — `page.pdf()` drives Chromium's PrintToPDF and would mutate the human's window state; open a managed (`persistent`/`incognito`) session and re-run there. Capability `action`.",
|
|
123
|
+
inputSchema: {
|
|
124
|
+
path: z
|
|
125
|
+
.string()
|
|
126
|
+
.optional()
|
|
127
|
+
.describe("Workspace-rooted file path for the PDF. Default `pdfs/<sessionId>-<ts>.pdf`. Rejected if it escapes $BROWX_WORKSPACE."),
|
|
128
|
+
format: z
|
|
129
|
+
.enum(["Letter", "Legal", "Tabloid", "Ledger", "A0", "A1", "A2", "A3", "A4", "A5", "A6"])
|
|
130
|
+
.optional()
|
|
131
|
+
.describe('Paper format. Default "A4".'),
|
|
132
|
+
scale: z
|
|
133
|
+
.number()
|
|
134
|
+
.min(0.1)
|
|
135
|
+
.max(2.0)
|
|
136
|
+
.optional()
|
|
137
|
+
.describe("Render scale. Default 1. Bounded to [0.1, 2.0] (Playwright's CDP-layer clamp)."),
|
|
138
|
+
printBackground: z
|
|
139
|
+
.boolean()
|
|
140
|
+
.optional()
|
|
141
|
+
.describe("Include CSS background-color / background-image. Default false (matches browser-print default)."),
|
|
142
|
+
...SESSION_ARG,
|
|
143
|
+
},
|
|
144
|
+
}, async (args) => {
|
|
145
|
+
const g = gateCheck("pdf_save");
|
|
146
|
+
if (g)
|
|
147
|
+
return g;
|
|
148
|
+
const e = await entryFor(args.session);
|
|
149
|
+
const eg = engineGate("pdf_save", e);
|
|
150
|
+
if (eg)
|
|
151
|
+
return eg;
|
|
152
|
+
try {
|
|
153
|
+
const refused = assertPdfSupported({ mode: e.mode });
|
|
154
|
+
if (refused) {
|
|
155
|
+
const body = { ok: false, error: refused.error, hint: refused.hint };
|
|
156
|
+
return {
|
|
157
|
+
content: [
|
|
158
|
+
{
|
|
159
|
+
type: "text",
|
|
160
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(JSON.stringify(body)) }, null, 2),
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const r = await withDeadline(pdfSave(e.session.page(), workspace.root, e.id, {
|
|
166
|
+
path: args.path,
|
|
167
|
+
format: args.format,
|
|
168
|
+
scale: args.scale,
|
|
169
|
+
printBackground: args.printBackground,
|
|
170
|
+
}), cfgActionTimeout(), "pdf_save");
|
|
171
|
+
return { content: [{ type: "text", text: JSON.stringify(r, null, 2) }] };
|
|
172
|
+
}
|
|
173
|
+
catch (err) {
|
|
174
|
+
return {
|
|
175
|
+
content: [
|
|
176
|
+
{
|
|
177
|
+
type: "text",
|
|
178
|
+
text: JSON.stringify({ ok: false, error: err instanceof Error ? err.message : String(err) }, null, 2),
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
// `page_archive` — save the current page (HTML + linked resources) as a
|
|
185
|
+
// self-contained artefact, either as a directory (`index.html` + `assets/`
|
|
186
|
+
// sidecar) or as a single-file inlined HTML. Workspace-rooted by
|
|
187
|
+
// construction (same `resolveWorkspacePath` posture as `pdf_save` /
|
|
188
|
+
// `start_har`). Under the off-by-default `file-io` capability — a deliberate
|
|
189
|
+
// filesystem egress, not a routine action. The agent is expected to
|
|
190
|
+
// navigate + settle the page BEFORE calling: the tool does not inject its
|
|
191
|
+
// own wait. The output is faithfully UNMASKED — see archive.ts header for
|
|
192
|
+
// the secrets-masking deliberate-gap rationale.
|
|
193
|
+
register("page_archive", {
|
|
194
|
+
capability: "file-io",
|
|
195
|
+
description: "Save the current page as a self-contained archive. Two formats: `directory` (default) writes `<path>/index.html` + `<path>/assets/` sidecar with every linked resource (images, fonts, scripts, stylesheets, CSS background-images surfaced via getComputedStyle); HTML refs rewritten to relative `assets/...` paths. `single-file` writes one HTML at `<path>` with every resource inlined as a `data:` URI (browsers struggle past ~150 MB — large pages should prefer `directory`). `path` is resolved INSIDE `$BROWX_WORKSPACE` (escape rejected); omit for `archives/<sessionId>-<ISO>` (directory) or `archives/<sessionId>-<ISO>.html` (single-file). `maxSizeMb` caps the total archive (default 200) — resources past the budget land in `droppedCount`. Resource fetching runs `await fetch(url)` IN-page (subject to the page's CSP `connect-src` — cross-origin blocks are caught, dropped, and counted). → `{ ok, format, path, sizeBytes, resourceCount, droppedCount, warnings[] }`. **Secrets-masking caveat**: the archive is intentionally UNMASKED — running the egress masking layer would corrupt inline JSON/CSS/binary bytes; treat the archive as sensitive (same posture as `dump_storage_state`). Caller must navigate + settle the page BEFORE calling; `page_archive` does not inject its own wait. Capability `file-io`.",
|
|
196
|
+
inputSchema: {
|
|
197
|
+
path: z
|
|
198
|
+
.string()
|
|
199
|
+
.optional()
|
|
200
|
+
.describe("Workspace-rooted output path (directory for `directory` format; .html file for `single-file`). Default `archives/<sessionId>-<ISO>[.html]`. Rejected if it escapes $BROWX_WORKSPACE."),
|
|
201
|
+
format: z
|
|
202
|
+
.enum(["directory", "single-file"])
|
|
203
|
+
.optional()
|
|
204
|
+
.describe("`directory` (default) → index.html + assets/ sidecar; `single-file` → one HTML with data:-URI-inlined resources."),
|
|
205
|
+
maxSizeMb: z
|
|
206
|
+
.number()
|
|
207
|
+
.positive()
|
|
208
|
+
.max(10_000)
|
|
209
|
+
.optional()
|
|
210
|
+
.describe("Total archive size cap (MB). Default 200. Resources past the budget are dropped + counted."),
|
|
211
|
+
...SESSION_ARG,
|
|
212
|
+
},
|
|
213
|
+
}, async (args) => {
|
|
214
|
+
const g = gateCheck("page_archive");
|
|
215
|
+
if (g)
|
|
216
|
+
return g;
|
|
217
|
+
const e = await entryFor(args.session);
|
|
218
|
+
try {
|
|
219
|
+
const r = await withDeadline(pageArchive(e.session.page(), workspace.root, e.id, {
|
|
220
|
+
path: args.path,
|
|
221
|
+
format: args.format,
|
|
222
|
+
maxSizeMb: args.maxSizeMb,
|
|
223
|
+
}), cfgActionTimeout(), "page_archive");
|
|
224
|
+
const json = JSON.stringify(r);
|
|
225
|
+
return {
|
|
226
|
+
content: [
|
|
227
|
+
{
|
|
228
|
+
type: "text",
|
|
229
|
+
text: JSON.stringify({ ...r, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
catch (err) {
|
|
235
|
+
const body = { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
236
|
+
return {
|
|
237
|
+
content: [
|
|
238
|
+
{
|
|
239
|
+
type: "text",
|
|
240
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(JSON.stringify(body)) }, null, 2),
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolHost } from "./host.js";
|
|
2
|
+
/**
|
|
3
|
+
* Capture + report — region capture & marks composition. `screenshot_region`
|
|
4
|
+
* (viewport-rect PNG), `screenshot_marks` (set-of-marks overlay), the
|
|
5
|
+
* `name_region` / `region` named-rect binding, and `cross_session_sample`
|
|
6
|
+
* (one DOM metric across every open session). Registered through the shared
|
|
7
|
+
* `ToolHost` seam.
|
|
8
|
+
*/
|
|
9
|
+
export declare function registerCaptureReportMarksTools(host: ToolHost): void;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { withDeadline } from "../util/deadline.js";
|
|
2
|
+
import { screenshotMarks } from "../page/set-of-marks.js";
|
|
3
|
+
import { sampleMetric, ELEMENT_METRICS } from "../page/sample.js";
|
|
4
|
+
import { SESSION_ARG } from "./schemas.js";
|
|
5
|
+
/**
|
|
6
|
+
* Capture + report — region capture & marks composition. `screenshot_region`
|
|
7
|
+
* (viewport-rect PNG), `screenshot_marks` (set-of-marks overlay), the
|
|
8
|
+
* `name_region` / `region` named-rect binding, and `cross_session_sample`
|
|
9
|
+
* (one DOM metric across every open session). Registered through the shared
|
|
10
|
+
* `ToolHost` seam.
|
|
11
|
+
*/
|
|
12
|
+
export function registerCaptureReportMarksTools(host) {
|
|
13
|
+
const { z, register, gateCheck, entryFor, cfgActionTimeout, config, toolHandlers, batchAllowedTools: BATCH_ALLOWED_TOOLS, } = host;
|
|
14
|
+
const BOX_SCHEMA = z.object({
|
|
15
|
+
x: z.number(),
|
|
16
|
+
y: z.number(),
|
|
17
|
+
width: z.number().positive(),
|
|
18
|
+
height: z.number().positive(),
|
|
19
|
+
});
|
|
20
|
+
register("screenshot_region", {
|
|
21
|
+
capability: "read",
|
|
22
|
+
description: "PNG screenshot of an arbitrary viewport rectangle (not an element) — for virtualised timelines / canvas / unlabelled positioned regions where an element-cropped shot doesn't apply.",
|
|
23
|
+
inputSchema: {
|
|
24
|
+
box: BOX_SCHEMA.describe("Viewport rect {x,y,width,height} in CSS px."),
|
|
25
|
+
...SESSION_ARG,
|
|
26
|
+
},
|
|
27
|
+
}, async ({ box, session }) => {
|
|
28
|
+
const g = gateCheck("screenshot_region");
|
|
29
|
+
if (g)
|
|
30
|
+
return g;
|
|
31
|
+
const e = await entryFor(session);
|
|
32
|
+
try {
|
|
33
|
+
const buf = await withDeadline(e.session.page().screenshot({ clip: box, type: "png" }), cfgActionTimeout(), "screenshot_region");
|
|
34
|
+
return {
|
|
35
|
+
content: [
|
|
36
|
+
{
|
|
37
|
+
type: "image",
|
|
38
|
+
data: Buffer.from(buf).toString("base64"),
|
|
39
|
+
mimeType: "image/png",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
return {
|
|
46
|
+
content: [
|
|
47
|
+
{
|
|
48
|
+
type: "text",
|
|
49
|
+
text: JSON.stringify({ ok: false, error: err instanceof Error ? err.message : String(err) }, null, 2),
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
register("screenshot_marks", {
|
|
56
|
+
capability: "read",
|
|
57
|
+
batchable: true,
|
|
58
|
+
description: 'Composed PNG with numbered bounding boxes painted over caller-supplied candidates — the set-of-marks primitive multimodal agents reach for when they want to ground a vision read against a small palette of stable refs ("click 2" instead of estimating a coordinate). Each candidate is either a bare `{ref}` (looked up against the current snapshot for its bbox) OR a full `find()` candidate row passed through (`{ref, role, name, testId, bbox}` — fast path, no extra tree walk). `label:"index"` (default) paints 1..N positions paired with an `{index→ref}` mapping; `label:"ref"` paints the existing `eN` directly; `label:"role"` paints the role for visual grounding. The numbering scheme SHARES the existing `name_ref` / `eN` namespace — no parallel ID space — so `mapping["2"] === "e7"` and the agent can address either way. Pure compose on top of `find()` / `snapshot()` (no new browser interaction beyond a transient in-page overlay removed before return). Candidates with `bbox:null` (clipped / off-screen) are kept in `marks` with `painted:false` so the mapping stays complete. Read-only (`read`).',
|
|
59
|
+
inputSchema: {
|
|
60
|
+
candidates: z
|
|
61
|
+
.array(z.union([z.object({ ref: z.string() }).passthrough(), z.object({}).passthrough()]))
|
|
62
|
+
.min(1)
|
|
63
|
+
.max(50)
|
|
64
|
+
.describe("Either `{ref}` rows (looked up against the current snapshot for bbox) OR full find() candidate rows (passed through). Mix-and-match allowed. Cap 50."),
|
|
65
|
+
label: z
|
|
66
|
+
.enum(["index", "ref", "role"])
|
|
67
|
+
.optional()
|
|
68
|
+
.describe("How to label each painted box. `index` (default) = 1..N array position, paired with the `{index→ref}` mapping in the result. `ref` = paint the existing `eN` ref directly. `role` = paint the candidate's role."),
|
|
69
|
+
...SESSION_ARG,
|
|
70
|
+
},
|
|
71
|
+
}, async (args) => {
|
|
72
|
+
const g = gateCheck("screenshot_marks");
|
|
73
|
+
if (g)
|
|
74
|
+
return g;
|
|
75
|
+
const e = await entryFor(args.session);
|
|
76
|
+
const candidates = args.candidates;
|
|
77
|
+
try {
|
|
78
|
+
const result = await withDeadline(screenshotMarks(e.session.page(), e.snapshotSubstrate, e.refs, {
|
|
79
|
+
candidates,
|
|
80
|
+
label: args.label,
|
|
81
|
+
testAttributes: config.testAttributes,
|
|
82
|
+
}, e.session.cdp ? e.session.cdp() : undefined), cfgActionTimeout(), "screenshot_marks");
|
|
83
|
+
const content = [
|
|
84
|
+
{
|
|
85
|
+
type: "text",
|
|
86
|
+
text: JSON.stringify({ marks: result.marks, mapping: result.mapping, warnings: result.warnings }, null, 2),
|
|
87
|
+
},
|
|
88
|
+
{ type: "image", data: result.imageBase64, mimeType: result.mimeType },
|
|
89
|
+
];
|
|
90
|
+
return { content };
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
return {
|
|
94
|
+
content: [
|
|
95
|
+
{
|
|
96
|
+
type: "text",
|
|
97
|
+
text: JSON.stringify({ ok: false, error: err instanceof Error ? err.message : String(err) }, null, 2),
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
register("name_region", {
|
|
104
|
+
capability: "human",
|
|
105
|
+
description: "Bind a viewport rectangle to a mnemonic so a sub-agent can re-select the same media segment / timeline row without re-deriving coordinates (drift). Resolve it later with `region`. Per-session.",
|
|
106
|
+
inputSchema: {
|
|
107
|
+
name: z.string().describe('Mnemonic, e.g. "matching_audio_clip".'),
|
|
108
|
+
box: BOX_SCHEMA,
|
|
109
|
+
...SESSION_ARG,
|
|
110
|
+
},
|
|
111
|
+
}, async ({ name, box, session }) => {
|
|
112
|
+
const g = gateCheck("name_region");
|
|
113
|
+
if (g)
|
|
114
|
+
return g;
|
|
115
|
+
const e = await entryFor(session);
|
|
116
|
+
return {
|
|
117
|
+
content: [
|
|
118
|
+
{
|
|
119
|
+
type: "text",
|
|
120
|
+
text: JSON.stringify({ ok: true, ...e.regions.set(name, box) }, null, 2),
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
register("region", {
|
|
126
|
+
capability: "human",
|
|
127
|
+
description: "Resolve a `name_region` mnemonic to its `{ box, center }`. Pass `center` to a coords-based action (`click({coords})`) to act on the bound region.",
|
|
128
|
+
inputSchema: { name: z.string(), ...SESSION_ARG },
|
|
129
|
+
}, async ({ name, session }) => {
|
|
130
|
+
const g = gateCheck("region");
|
|
131
|
+
if (g)
|
|
132
|
+
return g;
|
|
133
|
+
const e = await entryFor(session);
|
|
134
|
+
const r = e.regions.get(name);
|
|
135
|
+
return {
|
|
136
|
+
content: [
|
|
137
|
+
{
|
|
138
|
+
type: "text",
|
|
139
|
+
text: JSON.stringify(r
|
|
140
|
+
? { ok: true, ...r }
|
|
141
|
+
: {
|
|
142
|
+
ok: false,
|
|
143
|
+
error: `no region named "${name}" — call name_region first`,
|
|
144
|
+
known: e.regions.list().map((x) => x.name),
|
|
145
|
+
}, null, 2),
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
register("cross_session_sample", {
|
|
151
|
+
capability: "read",
|
|
152
|
+
description: "Drive an action in one session and sample a metric in ANOTHER over the same window, in one call — for realtime-propagation assertions (an action in session A should reflect in session B within a freshness budget). `action` is `{tool,args}` from the batch whitelist, dispatched in `actionSession`; the document-scroller `metric` is traced in `sampleSession`. Returns `{ action: <inner result>, sample }`.",
|
|
153
|
+
inputSchema: {
|
|
154
|
+
action: z.object({ tool: z.string(), args: z.record(z.unknown()).optional() }),
|
|
155
|
+
actionSession: z.string().describe("Session the action runs in."),
|
|
156
|
+
sampleSession: z.string().describe("Session whose page is sampled."),
|
|
157
|
+
metric: z
|
|
158
|
+
.enum(ELEMENT_METRICS)
|
|
159
|
+
.describe("Fixed metric (document scroller of sampleSession)."),
|
|
160
|
+
durationMs: z.number().int().positive().max(30_000),
|
|
161
|
+
everyFrame: z.boolean().optional(),
|
|
162
|
+
intervalMs: z.number().int().positive().max(5000).optional(),
|
|
163
|
+
},
|
|
164
|
+
}, async (args) => {
|
|
165
|
+
const g = gateCheck("cross_session_sample");
|
|
166
|
+
if (g)
|
|
167
|
+
return g;
|
|
168
|
+
const innerTool = args.action.tool;
|
|
169
|
+
if (!BATCH_ALLOWED_TOOLS.has(innerTool) || innerTool === "cross_session_sample") {
|
|
170
|
+
return {
|
|
171
|
+
content: [
|
|
172
|
+
{
|
|
173
|
+
type: "text",
|
|
174
|
+
text: JSON.stringify({
|
|
175
|
+
ok: false,
|
|
176
|
+
error: `cross_session_sample: inner tool "${innerTool}" not allowed (batch whitelist; no batch / await_human / recording / self)`,
|
|
177
|
+
}, null, 2),
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
const ig = gateCheck(innerTool);
|
|
183
|
+
if (ig)
|
|
184
|
+
return ig;
|
|
185
|
+
const sampleEntry = await entryFor(args.sampleSession);
|
|
186
|
+
const samplePromise = sampleMetric(sampleEntry.session.page(), sampleEntry.refs, {
|
|
187
|
+
metric: args.metric,
|
|
188
|
+
durationMs: args.durationMs,
|
|
189
|
+
everyFrame: args.everyFrame,
|
|
190
|
+
intervalMs: args.intervalMs,
|
|
191
|
+
});
|
|
192
|
+
const innerArgs = { ...(args.action.args ?? {}), session: args.actionSession };
|
|
193
|
+
const parseInner = (resp) => {
|
|
194
|
+
const first = resp.content[0];
|
|
195
|
+
if (!first || first.type !== "text" || first.text === undefined)
|
|
196
|
+
return first ?? null;
|
|
197
|
+
try {
|
|
198
|
+
return JSON.parse(first.text);
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
return first.text;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
const [sRes, aRes] = await Promise.allSettled([
|
|
205
|
+
samplePromise,
|
|
206
|
+
toolHandlers[innerTool](innerArgs),
|
|
207
|
+
]);
|
|
208
|
+
const sample = sRes.status === "fulfilled"
|
|
209
|
+
? sRes.value
|
|
210
|
+
: { error: sRes.reason instanceof Error ? sRes.reason.message : String(sRes.reason) };
|
|
211
|
+
const action = aRes.status === "fulfilled"
|
|
212
|
+
? parseInner(aRes.value)
|
|
213
|
+
: {
|
|
214
|
+
ok: false,
|
|
215
|
+
error: aRes.reason instanceof Error ? aRes.reason.message : String(aRes.reason),
|
|
216
|
+
};
|
|
217
|
+
return {
|
|
218
|
+
content: [{ type: "text", text: JSON.stringify({ action, sample }, null, 2) }],
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToolHost } from "./host.js";
|
|
2
|
+
/**
|
|
3
|
+
* Capture + report — file ingress & download egress. `upload_file` / `drop_files`
|
|
4
|
+
* (file ingress into the page), `downloads_capture` / `download_get` (capture and
|
|
5
|
+
* read browser-initiated downloads under the workspace root). Registered through
|
|
6
|
+
* the shared `ToolHost` seam.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerCaptureReportUploadTools(host: ToolHost): void;
|