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,318 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { sep as pathSep } from "node:path";
|
|
3
|
+
import { estimateTokens } from "../util/tokens.js";
|
|
4
|
+
import { resolveWorkspacePath } from "../session/storage.js";
|
|
5
|
+
import { DEFAULT_SESSION_ID } from "../session/registry.js";
|
|
6
|
+
import { buildReportSummary, } from "../util/diagnostics.js";
|
|
7
|
+
import { lowerTraceToSpec, parseCheck as parsePlaywrightSpec, } from "../page/export-playwright-script.js";
|
|
8
|
+
import { SESSION_ARG } from "./schemas.js";
|
|
9
|
+
/** Stamp the body with its token estimate and wrap it as a tool text response —
|
|
10
|
+
* the shared shape every `export_playwright_script` failure/early return uses. */
|
|
11
|
+
function exportScriptResult(body) {
|
|
12
|
+
const withTokens = { ...body, tokensEstimate: estimateTokens(JSON.stringify(body)) };
|
|
13
|
+
return { content: [{ type: "text", text: JSON.stringify(withTokens, null, 2) }] };
|
|
14
|
+
}
|
|
15
|
+
/** Filter a diagnostics record against the `diagnostics_search` query. The
|
|
16
|
+
* `tool` filter implies a `call` record; the `category` filter implies a `note`
|
|
17
|
+
* record (records of the other kind are excluded when either is set). */
|
|
18
|
+
function matchesDiagnosticFilter(r, q) {
|
|
19
|
+
if (q.sinceMs !== undefined && Date.parse(r.ts) < q.sinceMs)
|
|
20
|
+
return false;
|
|
21
|
+
if (q.sessionId && r.sessionId !== q.sessionId)
|
|
22
|
+
return false;
|
|
23
|
+
if (q.tool) {
|
|
24
|
+
if (r.kind !== "call" || r.tool !== q.tool)
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (q.category) {
|
|
28
|
+
if (r.kind !== "note" || r.category !== q.category)
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Capture + report — session report & the diagnostics store. The session report
|
|
35
|
+
* + metrics rollups, the diagnostics note/search/report agent-feedback store,
|
|
36
|
+
* and Playwright-script export. Registered through the shared `ToolHost` seam.
|
|
37
|
+
*/
|
|
38
|
+
export function registerCaptureReportDiagnosticsTools(host) {
|
|
39
|
+
const { z, register, gateCheck, entryFor, workspace, registry, diagnostics } = host;
|
|
40
|
+
register("export_session_report", {
|
|
41
|
+
capability: "read",
|
|
42
|
+
description: "Bundle a session's current QA evidence into one JSON object — url, console errors, recent network summary, named regions, live sessions — so multi-agent QA results are auditable without normalising each agent's notes by hand. `note` records a free-text label/summary. Returns the bundle (not written to disk).",
|
|
43
|
+
inputSchema: {
|
|
44
|
+
note: z.string().optional().describe("Free-text label / summary for this session's run."),
|
|
45
|
+
...SESSION_ARG,
|
|
46
|
+
},
|
|
47
|
+
}, async ({ note, session }) => {
|
|
48
|
+
const g = gateCheck("export_session_report");
|
|
49
|
+
if (g)
|
|
50
|
+
return g;
|
|
51
|
+
const e = await entryFor(session);
|
|
52
|
+
const net = e.network.recent(50);
|
|
53
|
+
const report = {
|
|
54
|
+
ok: true,
|
|
55
|
+
session: e.id,
|
|
56
|
+
mode: e.mode,
|
|
57
|
+
url: e.session.page().url(),
|
|
58
|
+
openedAt: new Date(e.openedAt).toISOString(),
|
|
59
|
+
generatedAt: new Date().toISOString(),
|
|
60
|
+
...(note ? { note } : {}),
|
|
61
|
+
consoleErrors: e.console
|
|
62
|
+
.recent(200)
|
|
63
|
+
.filter((m) => m.type === "error")
|
|
64
|
+
.map((m) => m.text)
|
|
65
|
+
.slice(-25),
|
|
66
|
+
network: net.summary,
|
|
67
|
+
regions: e.regions.list().map((r) => r.name),
|
|
68
|
+
liveSessions: registry.list().map((s) => ({ id: s.id, mode: s.mode })),
|
|
69
|
+
};
|
|
70
|
+
return { content: [{ type: "text", text: JSON.stringify(report, null, 2) }] };
|
|
71
|
+
});
|
|
72
|
+
register("session_metrics", {
|
|
73
|
+
capability: "read",
|
|
74
|
+
batchable: true,
|
|
75
|
+
description: "Per-session cumulative tool-call metrics — counts, latency, `tokensEstimate` sum, capability denials, and per-tool error counts. Piggybacks on the existing per-call envelope data (no new instrumentation, no disk writes). Pairs with `export_session_report` (which bundles the session's QA EVIDENCE — url, console errors, recent network summary, named regions, live sessions); this one rolls up DISPATCH EVIDENCE so a consumer can audit which tools the agent leaned on, how token-expensive each got, and whether the agent kept hitting a capability gate that's off. Read-only (capability `read`). → `{ ok, session, callsByTool, durationMsByTool, errorsByTool, tokensEstimateSum, capabilityDenials, sessionStartedAt, sessionDurationMs, tokensEstimate }`.",
|
|
76
|
+
inputSchema: { ...SESSION_ARG },
|
|
77
|
+
}, async ({ session }) => {
|
|
78
|
+
const g = gateCheck("session_metrics");
|
|
79
|
+
if (g)
|
|
80
|
+
return g;
|
|
81
|
+
const e = await entryFor(session);
|
|
82
|
+
const snap = e.metrics.snapshot();
|
|
83
|
+
const body = {
|
|
84
|
+
ok: true,
|
|
85
|
+
session: e.id,
|
|
86
|
+
...snap,
|
|
87
|
+
tokensEstimate: 0,
|
|
88
|
+
};
|
|
89
|
+
body.tokensEstimate = estimateTokens(JSON.stringify(body));
|
|
90
|
+
return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };
|
|
91
|
+
});
|
|
92
|
+
// ---------- diagnostics ----------
|
|
93
|
+
register("diagnostics_note", {
|
|
94
|
+
capability: "diagnostics",
|
|
95
|
+
description: "Agent self-feedback. File a structured insight against the diagnostics JSONL store: a missing primitive, a workaround that worked, a perf concern, or an ergonomic friction the curated tool surface didn't cover. `ref` optionally points at a prior tool call (a record id or `tool:ts` shorthand). The recorder is engaged by the same `diagnostics` capability — registering a note while the capability is OFF returns a structured refusal (so a polling agent on a server with diagnostics off doesn't silently lose feedback). Default category `other`, default severity `info`. Capability: `diagnostics`.",
|
|
96
|
+
inputSchema: {
|
|
97
|
+
insight: z
|
|
98
|
+
.string()
|
|
99
|
+
.min(1)
|
|
100
|
+
.describe("Free-text observation — what was tried, what was missing, what ergonomic friction surfaced."),
|
|
101
|
+
category: z
|
|
102
|
+
.enum(["missing-primitive", "workaround", "perf-concern", "ergonomic-friction", "other"])
|
|
103
|
+
.optional()
|
|
104
|
+
.describe("Default `other`. `missing-primitive` is the most actionable bucket for the curator — surface when an `eval_js` pattern keeps recurring."),
|
|
105
|
+
severity: z
|
|
106
|
+
.enum(["info", "warn", "blocker"])
|
|
107
|
+
.optional()
|
|
108
|
+
.describe('Default `info`. `blocker` means "this stopped me completing the task".'),
|
|
109
|
+
ref: z
|
|
110
|
+
.string()
|
|
111
|
+
.optional()
|
|
112
|
+
.describe("Optional reference to a prior record — e.g. `eval_js:2026-06-08T12:34:56.000Z` or a record id surfaced by `diagnostics_search`."),
|
|
113
|
+
...SESSION_ARG,
|
|
114
|
+
},
|
|
115
|
+
}, async ({ insight, category, severity, ref, session, }) => {
|
|
116
|
+
const g = gateCheck("diagnostics_note");
|
|
117
|
+
if (g)
|
|
118
|
+
return g;
|
|
119
|
+
const sessionId = session ?? DEFAULT_SESSION_ID;
|
|
120
|
+
const record = {
|
|
121
|
+
kind: "note",
|
|
122
|
+
ts: new Date().toISOString(),
|
|
123
|
+
sessionId,
|
|
124
|
+
insight,
|
|
125
|
+
category: category ?? "other",
|
|
126
|
+
severity: severity ?? "info",
|
|
127
|
+
...(ref ? { ref } : {}),
|
|
128
|
+
};
|
|
129
|
+
diagnostics.write(record);
|
|
130
|
+
const body = {
|
|
131
|
+
ok: true,
|
|
132
|
+
session: sessionId,
|
|
133
|
+
recorded: {
|
|
134
|
+
kind: record.kind,
|
|
135
|
+
ts: record.ts,
|
|
136
|
+
category: record.category,
|
|
137
|
+
severity: record.severity,
|
|
138
|
+
},
|
|
139
|
+
tokensEstimate: estimateTokens(JSON.stringify({ insight, category, severity, ref })),
|
|
140
|
+
};
|
|
141
|
+
return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };
|
|
142
|
+
});
|
|
143
|
+
register("diagnostics_search", {
|
|
144
|
+
capability: "read",
|
|
145
|
+
description: "Read-side query over the diagnostics JSONL store. Returns matching records — calls + notes — up to `limit` (default 100, max 1000). `since` filters by ts (ISO); `tool` filters by tool name (exact match); `category` filters notes only; `sessionId` filters by session. The recorder is gated on the `diagnostics` capability; this query reads whatever lives on disk, so a server with diagnostics OFF but a non-empty workspace history can still surface prior runs. Read-only (capability `read`). → `{ ok, records, count, truncated }`.",
|
|
146
|
+
inputSchema: {
|
|
147
|
+
since: z
|
|
148
|
+
.string()
|
|
149
|
+
.optional()
|
|
150
|
+
.describe("ISO timestamp filter — only records with `ts >= since` are returned."),
|
|
151
|
+
tool: z
|
|
152
|
+
.string()
|
|
153
|
+
.optional()
|
|
154
|
+
.describe('Tool-name filter (exact match) — applies to `kind:"call"` records only.'),
|
|
155
|
+
category: z
|
|
156
|
+
.string()
|
|
157
|
+
.optional()
|
|
158
|
+
.describe('Note-category filter — applies to `kind:"note"` records only.'),
|
|
159
|
+
sessionId: z.string().optional().describe("Session-id filter."),
|
|
160
|
+
limit: z
|
|
161
|
+
.number()
|
|
162
|
+
.int()
|
|
163
|
+
.positive()
|
|
164
|
+
.max(1000)
|
|
165
|
+
.optional()
|
|
166
|
+
.describe("Max records to return. Default 100, hard cap 1000."),
|
|
167
|
+
...SESSION_ARG,
|
|
168
|
+
},
|
|
169
|
+
}, async ({ since, tool, category, sessionId, limit, session: _session, }) => {
|
|
170
|
+
const g = gateCheck("diagnostics_search");
|
|
171
|
+
if (g)
|
|
172
|
+
return g;
|
|
173
|
+
const lim = limit ?? 100;
|
|
174
|
+
const sinceMs = since ? Date.parse(since) : undefined;
|
|
175
|
+
const matched = [];
|
|
176
|
+
let truncated = false;
|
|
177
|
+
for (const r of diagnostics.readAll()) {
|
|
178
|
+
if (!matchesDiagnosticFilter(r, { sinceMs, sessionId, tool, category }))
|
|
179
|
+
continue;
|
|
180
|
+
if (matched.length >= lim) {
|
|
181
|
+
truncated = true;
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
matched.push(r);
|
|
185
|
+
}
|
|
186
|
+
const body = {
|
|
187
|
+
ok: true,
|
|
188
|
+
records: matched,
|
|
189
|
+
count: matched.length,
|
|
190
|
+
truncated,
|
|
191
|
+
tokensEstimate: 0,
|
|
192
|
+
};
|
|
193
|
+
body.tokensEstimate = estimateTokens(JSON.stringify(body));
|
|
194
|
+
return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };
|
|
195
|
+
});
|
|
196
|
+
register("diagnostics_report", {
|
|
197
|
+
capability: "read",
|
|
198
|
+
description: "Analysis primitive over the diagnostics JSONL store. `summary` (default) returns per-tool counts + p50/p95 durations, the top 10 eval_js patterns by count + their taxonomy classification, capability-denial counts, note counts by category, and a `missingPrimitiveHypotheses` list — eval_js taxonomy buckets with high count flagged as candidates for a curated primitive (heuristic: non-`custom` taxonomy with count ≥ 3 OR `custom` pattern with count ≥ 5). `full` returns the same + a per-record stream capped at 500 records (`truncated:true` when exceeded). Optional `since` (ISO) windowing + `sessionId` filter. Read-only (capability `read`).",
|
|
199
|
+
inputSchema: {
|
|
200
|
+
format: z
|
|
201
|
+
.enum(["summary", "full"])
|
|
202
|
+
.optional()
|
|
203
|
+
.describe("Default `summary`. `full` additionally streams the per-record list (capped at 500)."),
|
|
204
|
+
since: z
|
|
205
|
+
.string()
|
|
206
|
+
.optional()
|
|
207
|
+
.describe("ISO timestamp filter — only records with `ts >= since` are aggregated."),
|
|
208
|
+
sessionId: z.string().optional().describe("Restrict the rollup to one session id."),
|
|
209
|
+
...SESSION_ARG,
|
|
210
|
+
},
|
|
211
|
+
}, async ({ format, since, sessionId, session: _session, }) => {
|
|
212
|
+
const g = gateCheck("diagnostics_report");
|
|
213
|
+
if (g)
|
|
214
|
+
return g;
|
|
215
|
+
const fmt = format ?? "summary";
|
|
216
|
+
const all = diagnostics.readAll();
|
|
217
|
+
const summary = buildReportSummary(all, { since, session: sessionId });
|
|
218
|
+
let records;
|
|
219
|
+
let truncated = false;
|
|
220
|
+
if (fmt === "full") {
|
|
221
|
+
const CAP = 500;
|
|
222
|
+
const sinceMs = since ? Date.parse(since) : undefined;
|
|
223
|
+
records = [];
|
|
224
|
+
for (const r of all) {
|
|
225
|
+
if (sinceMs !== undefined && Date.parse(r.ts) < sinceMs)
|
|
226
|
+
continue;
|
|
227
|
+
if (sessionId && r.sessionId !== sessionId)
|
|
228
|
+
continue;
|
|
229
|
+
if (records.length >= CAP) {
|
|
230
|
+
truncated = true;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
records.push(r);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const body = {
|
|
237
|
+
ok: true,
|
|
238
|
+
format: fmt,
|
|
239
|
+
summary,
|
|
240
|
+
...(records ? { records, truncated } : {}),
|
|
241
|
+
tokensEstimate: 0,
|
|
242
|
+
};
|
|
243
|
+
body.tokensEstimate = estimateTokens(JSON.stringify(body));
|
|
244
|
+
return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };
|
|
245
|
+
});
|
|
246
|
+
register("export_playwright_script", {
|
|
247
|
+
capability: "read",
|
|
248
|
+
description: "Lower a session's recorded action trace into a runnable `@playwright/test` spec file. Adjacent to `export_session_report` (which bundles QA evidence) and to `end_recording` (which emits the site-docs flow-file YAML); this one emits a `.spec.ts` source a code-as-action consumer can run as the seed for a skill-compilation loop. Each recorded step lowers to ONE Playwright call using the BEST stable `selectorHint` captured at the time of the call (tier-1 attribute → `page.locator(...)`, tier-2 role+name → `getByRole({name})`, role-only / tier-5 → `getByRole()` with a `// TODO: fragile selector` comment). Coords-mode actions are not recorded so the export never has to lower a non-replayable target. Requires an ACTIVE recording (call `start_recording` first); inspect-style — does NOT end the recording. With `path`, ALSO writes to a workspace-rooted `.spec.ts` file (path-traversal rejected — must resolve under $BROWX_WORKSPACE). Read-only (capability `read`). Returns `{ ok, name, source, path?, stats:{steps,handled,unhandled,fragile}, tokensEstimate }`.",
|
|
249
|
+
inputSchema: {
|
|
250
|
+
path: z
|
|
251
|
+
.string()
|
|
252
|
+
.optional()
|
|
253
|
+
.describe("Optional workspace-rooted file path to write the `.spec.ts` to (in addition to returning it inline). Rejected if it escapes $BROWX_WORKSPACE."),
|
|
254
|
+
...SESSION_ARG,
|
|
255
|
+
},
|
|
256
|
+
}, async ({ path, session }) => {
|
|
257
|
+
const g = gateCheck("export_playwright_script");
|
|
258
|
+
if (g)
|
|
259
|
+
return g;
|
|
260
|
+
const e = await entryFor(session);
|
|
261
|
+
const snap = e.recorder.inspect();
|
|
262
|
+
if (!snap) {
|
|
263
|
+
return exportScriptResult({
|
|
264
|
+
ok: false,
|
|
265
|
+
tool: "export_playwright_script",
|
|
266
|
+
error: "no active recording — call `start_recording({flowName})` first, " +
|
|
267
|
+
"drive the flow with the usual action tools (navigate/click/fill/..." +
|
|
268
|
+
"), then call this. The recording is NOT ended by export — `end_recording` " +
|
|
269
|
+
"still emits the YAML flow-file separately.",
|
|
270
|
+
failure: { source: "browxai", hint: "start_recording before exporting" },
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
const lowered = lowerTraceToSpec(snap.name, snap.steps);
|
|
274
|
+
const check = parsePlaywrightSpec(lowered.source);
|
|
275
|
+
if (!check.ok) {
|
|
276
|
+
return exportScriptResult({
|
|
277
|
+
ok: false,
|
|
278
|
+
tool: "export_playwright_script",
|
|
279
|
+
error: `generated spec failed the structural parse-check: ${check.reason}`,
|
|
280
|
+
source: lowered.source,
|
|
281
|
+
stats: lowered.stats,
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
let writtenPath;
|
|
285
|
+
let writtenBytes;
|
|
286
|
+
if (path !== undefined) {
|
|
287
|
+
try {
|
|
288
|
+
const resolved = resolveWorkspacePath(workspace.root, path, "export_playwright_script");
|
|
289
|
+
// Ensure parent dir exists — same pattern dumpStorageState uses.
|
|
290
|
+
const parent = resolved.substring(0, Math.max(resolved.lastIndexOf(pathSep), 0));
|
|
291
|
+
if (parent && !existsSync(parent))
|
|
292
|
+
mkdirSync(parent, { recursive: true });
|
|
293
|
+
writeFileSync(resolved, lowered.source, "utf8");
|
|
294
|
+
writtenPath = resolved;
|
|
295
|
+
writtenBytes = Buffer.byteLength(lowered.source, "utf8");
|
|
296
|
+
}
|
|
297
|
+
catch (err) {
|
|
298
|
+
return exportScriptResult({
|
|
299
|
+
ok: false,
|
|
300
|
+
tool: "export_playwright_script",
|
|
301
|
+
error: err instanceof Error ? err.message : String(err),
|
|
302
|
+
source: lowered.source,
|
|
303
|
+
stats: lowered.stats,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
const body = {
|
|
308
|
+
ok: true,
|
|
309
|
+
name: snap.name,
|
|
310
|
+
source: lowered.source,
|
|
311
|
+
stats: lowered.stats,
|
|
312
|
+
...(writtenPath ? { path: writtenPath, bytes: writtenBytes } : {}),
|
|
313
|
+
tokensEstimate: 0,
|
|
314
|
+
};
|
|
315
|
+
body.tokensEstimate = estimateTokens(JSON.stringify(body));
|
|
316
|
+
return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };
|
|
317
|
+
});
|
|
318
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToolHost } from "./host.js";
|
|
2
|
+
/**
|
|
3
|
+
* Capture + report — element-level export & layout diagnosis. `element_export`
|
|
4
|
+
* (a self-contained snippet for one ref's subtree), `dom_export` (the serialised
|
|
5
|
+
* DOM tree), and `overflow_detect` (clipped / ellipsis / viewport-overflow
|
|
6
|
+
* diagnosis). Registered through the shared `ToolHost` seam.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerCaptureReportElementExportTools(host: ToolHost): void;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { withDeadline } from "../util/deadline.js";
|
|
2
|
+
import { estimateTokens } from "../util/tokens.js";
|
|
3
|
+
import { elementExportFromRef } from "../page/element-export.js";
|
|
4
|
+
import { domExport } from "../page/dom-export.js";
|
|
5
|
+
import { detectOverflow } from "../page/overflow-detect.js";
|
|
6
|
+
import { SESSION_ARG } from "./schemas.js";
|
|
7
|
+
/**
|
|
8
|
+
* Capture + report — element-level export & layout diagnosis. `element_export`
|
|
9
|
+
* (a self-contained snippet for one ref's subtree), `dom_export` (the serialised
|
|
10
|
+
* DOM tree), and `overflow_detect` (clipped / ellipsis / viewport-overflow
|
|
11
|
+
* diagnosis). Registered through the shared `ToolHost` seam.
|
|
12
|
+
*/
|
|
13
|
+
export function registerCaptureReportElementExportTools(host) {
|
|
14
|
+
const { z, register, gateCheck, entryFor, cfgActionTimeout, workspace } = host;
|
|
15
|
+
// `element_export` — save the subtree under one ref as a self-contained
|
|
16
|
+
// HTML snippet plus its rendered CSS + linked resources. Sibling to
|
|
17
|
+
// `page_archive`, scoped to a single element instead of the whole
|
|
18
|
+
// document. Workspace-rooted output by construction; same UNMASKED
|
|
19
|
+
// posture as `page_archive` (rationale: secrets-masking is literal-
|
|
20
|
+
// substring substitution that would corrupt inline JSON / CSS /
|
|
21
|
+
// binary bytes).
|
|
22
|
+
register("element_export", {
|
|
23
|
+
capability: "file-io",
|
|
24
|
+
description: "Save a specific element subtree as a self-contained snippet — outerHTML + page-wide stylesheets + every linked resource the subtree references. Two formats: `directory` (default) writes `<intoDir>/element.html` + `<intoDir>/assets/` sidecar with images / fonts / scripts / stylesheets / CSS background-images (rewriting internal refs to relative `assets/...` paths); `single-file` writes one self-contained HTML at `<intoDir>` with resources inlined as `data:` URIs (browsers struggle past ~150 MB — large subtrees should prefer `directory`). `ref` must come from a prior `snapshot()` / `find()`; ref-not-found is a structured error, not a silent miss. `intoDir` is resolved INSIDE `$BROWX_WORKSPACE` (escape rejected); omit for `elements/<sessionId>-<ISO>-<ref>` (directory) or `elements/<sessionId>-<ISO>-<ref>.html` (single-file). `maxSizeMb` caps the total export (default 50, smaller than `page_archive`'s 200 — a snippet is meant to be a slice). Cross-origin stylesheets the page can't read are reported in `warnings[]` (the snippet may render differently than the source page). → `{ ok, format, ref, path, sizeBytes, resourceCount, droppedCount, warnings[] }`. **Secrets-masking caveat**: the export is intentionally UNMASKED — running the egress masking layer would corrupt the file; treat the export as sensitive (same posture as `page_archive` / `dump_storage_state`). Capability `file-io`.",
|
|
25
|
+
inputSchema: {
|
|
26
|
+
ref: z
|
|
27
|
+
.string()
|
|
28
|
+
.describe("Ref of the element subtree to export. Minted by a prior `snapshot()` / `find()`."),
|
|
29
|
+
format: z
|
|
30
|
+
.enum(["directory", "single-file"])
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("`directory` (default) → element.html + assets/ sidecar; `single-file` → one HTML with data:-URI-inlined resources + inline CSS."),
|
|
33
|
+
intoDir: z
|
|
34
|
+
.string()
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("Workspace-rooted output target (directory for `directory` format; .html file for `single-file`). Default `elements/<sessionId>-<ISO>-<ref>[.html]`. Rejected if it escapes $BROWX_WORKSPACE."),
|
|
37
|
+
maxSizeMb: z
|
|
38
|
+
.number()
|
|
39
|
+
.positive()
|
|
40
|
+
.max(10_000)
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("Total export size cap (MB). Default 50. Resources past the budget are dropped + counted."),
|
|
43
|
+
...SESSION_ARG,
|
|
44
|
+
},
|
|
45
|
+
}, async (args) => {
|
|
46
|
+
const g = gateCheck("element_export");
|
|
47
|
+
if (g)
|
|
48
|
+
return g;
|
|
49
|
+
const e = await entryFor(args.session);
|
|
50
|
+
try {
|
|
51
|
+
const r = await withDeadline(elementExportFromRef(e.session.page(), e.refs, workspace.root, e.id, {
|
|
52
|
+
ref: args.ref,
|
|
53
|
+
format: args.format,
|
|
54
|
+
intoDir: args.intoDir,
|
|
55
|
+
maxSizeMb: args.maxSizeMb,
|
|
56
|
+
}), cfgActionTimeout(), "element_export");
|
|
57
|
+
const json = JSON.stringify(r);
|
|
58
|
+
return {
|
|
59
|
+
content: [
|
|
60
|
+
{
|
|
61
|
+
type: "text",
|
|
62
|
+
text: JSON.stringify({ ...r, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
const body = { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
69
|
+
return {
|
|
70
|
+
content: [
|
|
71
|
+
{
|
|
72
|
+
type: "text",
|
|
73
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(JSON.stringify(body)) }, null, 2),
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
// `dom_export` — full DOM dump, either as `document.documentElement.
|
|
80
|
+
// outerHTML` (the platform serialization, but blind to shadow content)
|
|
81
|
+
// or as a JSONL node-per-line tree that DOES descend open shadow roots.
|
|
82
|
+
// Closed shadow roots are a web-platform constraint — unreachable from
|
|
83
|
+
// any tool. Workspace-rooted output; same UNMASKED posture as
|
|
84
|
+
// `page_archive` / `element_export`.
|
|
85
|
+
register("dom_export", {
|
|
86
|
+
capability: "file-io",
|
|
87
|
+
description: "Full DOM dump to a workspace-rooted file. Two formats: `html` (default) writes `document.documentElement.outerHTML` after the agent's prior stabilization — note the platform serializer does NOT include shadow-DOM content (open OR closed), even for elements that have one. `jsonl` writes one JSON object per line (`{tag, role?, attrs, text?, ref?, depth}`) via a depth-first walk that DOES descend open shadow roots when `includeShadow:true` (default). Closed shadow roots are inaccessible by web-platform design — the tree behind them is genuinely unreachable from this dump, surfaced in `warnings[]` when custom elements are present. `path` is resolved INSIDE `$BROWX_WORKSPACE` (escape rejected); omit for `dom-dumps/<sessionId>-<ISO>.{html|jsonl}`. → `{ ok, format, path, sizeBytes, nodeCount, shadowRootCount, warnings[] }`. **Secrets-masking caveat**: the dump is intentionally UNMASKED — running the egress masking layer would corrupt inline JSON / CSS / binary bytes; treat the dump as sensitive (same posture as `page_archive` / `dump_storage_state`). Caller must navigate + settle the page BEFORE calling. Capability `file-io`.",
|
|
88
|
+
inputSchema: {
|
|
89
|
+
format: z
|
|
90
|
+
.enum(["html", "jsonl"])
|
|
91
|
+
.optional()
|
|
92
|
+
.describe("`html` (default) → documentElement.outerHTML (shadow content not serialised); `jsonl` → one JSON node per line, depth-first, descends open shadow roots when `includeShadow`."),
|
|
93
|
+
includeShadow: z
|
|
94
|
+
.boolean()
|
|
95
|
+
.optional()
|
|
96
|
+
.describe("Walk open shadow roots (`jsonl` mode). Default `true`. Closed shadow roots are inaccessible regardless."),
|
|
97
|
+
path: z
|
|
98
|
+
.string()
|
|
99
|
+
.optional()
|
|
100
|
+
.describe("Workspace-rooted output file. Default `dom-dumps/<sessionId>-<ISO>.{html|jsonl}`. Rejected if it escapes $BROWX_WORKSPACE."),
|
|
101
|
+
...SESSION_ARG,
|
|
102
|
+
},
|
|
103
|
+
}, async (args) => {
|
|
104
|
+
const g = gateCheck("dom_export");
|
|
105
|
+
if (g)
|
|
106
|
+
return g;
|
|
107
|
+
const e = await entryFor(args.session);
|
|
108
|
+
try {
|
|
109
|
+
const r = await withDeadline(domExport(e.session.page(), workspace.root, e.id, {
|
|
110
|
+
format: args.format,
|
|
111
|
+
includeShadow: args.includeShadow,
|
|
112
|
+
path: args.path,
|
|
113
|
+
}), cfgActionTimeout(), "dom_export");
|
|
114
|
+
const json = JSON.stringify(r);
|
|
115
|
+
return {
|
|
116
|
+
content: [
|
|
117
|
+
{
|
|
118
|
+
type: "text",
|
|
119
|
+
text: JSON.stringify({ ...r, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
const body = { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
126
|
+
return {
|
|
127
|
+
content: [
|
|
128
|
+
{
|
|
129
|
+
type: "text",
|
|
130
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(JSON.stringify(body)) }, null, 2),
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
// `overflow_detect` — diagnose page-layout overflow on the target page.
|
|
137
|
+
// The silent UI-breakage primitive: clipped buttons, ellipsis-truncated
|
|
138
|
+
// labels, horizontal-scrollbar-on-mobile bugs. Generalises `inspect`'s
|
|
139
|
+
// per-element overflow check into a page-wide scan with four typed
|
|
140
|
+
// detectors (`layout`, `clipped`, `text-ellipsis`, `viewport-horizontal`).
|
|
141
|
+
// Read-only, no mutation, no new capability — rides `read`.
|
|
142
|
+
register("overflow_detect", {
|
|
143
|
+
capability: "read",
|
|
144
|
+
batchable: true,
|
|
145
|
+
description: 'Diagnose page-layout overflow — the silent UI-breakage primitive (clipped buttons, ellipsis-truncated labels, horizontal-scrollbar-on-mobile bugs). Walks the DOM and reports one finding per offending element across four detector types: `layout` (`scrollWidth/Height > clientWidth/Height` on an element with `overflow:auto|scroll` — scrollbar present but content overruns), `clipped` (same dimensions but `overflow:hidden|clip` — content invisible with no scrollbar to recover, the highest-value finding), `text-ellipsis` (`text-overflow:ellipsis` with `scrollWidth > clientWidth` — surfaces `visibleText` heuristic + `fullText` truth), `viewport-horizontal` (singleton: `documentElement.scrollWidth > clientWidth` — the body horizontal-scrollbar mobile bug; evidence carries the overrun amount + the widest overrunning descendant when cheaply identifiable). EPSILON = 1 CSS px tolerates sub-pixel rounding noise. `scope:"document"` (default) walks every element; `scope:"viewport"` skips elements fully off-screen. `types:[...]` filters which detectors fire (default = all four; empty array also treated as default). `limit` caps findings (default 50, max 500; over-cap sets `truncated:true`). Walk bounded at 10000 elements — a hit surfaces a `warnings[]` entry suggesting `scope:viewport` for a narrower pass. Each finding: `{selector, bbox: {x,y,w,h} | null, type, evidence}`. Selector synthesis tiers: `[data-testid]` > `[role][aria-label]` > nth-of-type CSS path (≤5 levels) > `tag.classes` (≤3); capped at 200 chars (longer falls through to bare tag with `evidence.selectorTruncated`). Read-only (capability `read`).',
|
|
146
|
+
inputSchema: {
|
|
147
|
+
scope: z
|
|
148
|
+
.enum(["viewport", "document"])
|
|
149
|
+
.optional()
|
|
150
|
+
.describe("`document` (default) walks every element; `viewport` skips elements fully off-screen — cheaper on very large pages."),
|
|
151
|
+
types: z
|
|
152
|
+
.array(z.enum(["layout", "clipped", "text-ellipsis", "viewport-horizontal"]))
|
|
153
|
+
.optional()
|
|
154
|
+
.describe("Detector types to surface. Default = all four. Empty array treated as default (an empty filter would silently match nothing — usage error)."),
|
|
155
|
+
limit: z
|
|
156
|
+
.number()
|
|
157
|
+
.int()
|
|
158
|
+
.positive()
|
|
159
|
+
.max(500)
|
|
160
|
+
.optional()
|
|
161
|
+
.describe("Cap on findings returned. Default 50, max 500. Findings past the cap are dropped + `truncated:true` is set."),
|
|
162
|
+
...SESSION_ARG,
|
|
163
|
+
},
|
|
164
|
+
}, async (args) => {
|
|
165
|
+
const g = gateCheck("overflow_detect");
|
|
166
|
+
if (g)
|
|
167
|
+
return g;
|
|
168
|
+
const e = await entryFor(args.session);
|
|
169
|
+
try {
|
|
170
|
+
const r = await withDeadline(detectOverflow(e.session.page(), {
|
|
171
|
+
scope: args.scope,
|
|
172
|
+
types: args.types,
|
|
173
|
+
limit: args.limit,
|
|
174
|
+
}), cfgActionTimeout(), "overflow_detect");
|
|
175
|
+
const json = JSON.stringify(r);
|
|
176
|
+
return {
|
|
177
|
+
content: [
|
|
178
|
+
{
|
|
179
|
+
type: "text",
|
|
180
|
+
text: JSON.stringify({ ...r, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
catch (err) {
|
|
186
|
+
const body = { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
187
|
+
return {
|
|
188
|
+
content: [
|
|
189
|
+
{
|
|
190
|
+
type: "text",
|
|
191
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(JSON.stringify(body)) }, null, 2),
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToolHost } from "./host.js";
|
|
2
|
+
/**
|
|
3
|
+
* Capture + report — page-level artefact export. `asset_export` (persist the
|
|
4
|
+
* session's network ring to disk), `pdf_save`, and `page_archive` (a
|
|
5
|
+
* self-contained whole-document capture). Workspace-rooted output by
|
|
6
|
+
* construction; registered through the shared `ToolHost` seam.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerCaptureReportExportTools(host: ToolHost): void;
|