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,368 @@
|
|
|
1
|
+
import { withDeadline } from "../util/deadline.js";
|
|
2
|
+
import { estimateTokens } from "../util/tokens.js";
|
|
3
|
+
import { canvasCapture, canvasDiff, canvasScreenToWorld, canvasWorldToScreen, noAdapterError, runGestureChain, } from "../page/canvas.js";
|
|
4
|
+
import { SESSION_ARG } from "./schemas.js";
|
|
5
|
+
/**
|
|
6
|
+
* Canvas-app automation primitives.
|
|
7
|
+
*
|
|
8
|
+
* Five MCP tools + a pure-RGBA diff:
|
|
9
|
+
*
|
|
10
|
+
* - `canvas_capture` — framebuffer / 2D ImageData / PNG bytes.
|
|
11
|
+
* - `canvas_diff` — pixel/region delta over RGBA captures
|
|
12
|
+
* (PNG inputs deferred — base64 byte
|
|
13
|
+
* equality only, see warnings).
|
|
14
|
+
* - `gesture_chain` — multi-step pointer program (custom
|
|
15
|
+
* paint strokes, lasso paths, gestures
|
|
16
|
+
* the canned `drag` / `gesture_swipe`
|
|
17
|
+
* family doesn't cover).
|
|
18
|
+
* - `canvas_world_to_screen` + `canvas_screen_to_world` —
|
|
19
|
+
* affine helpers, two modes: explicit
|
|
20
|
+
* (caller passes transform) or
|
|
21
|
+
* discovery (page-side probe of common
|
|
22
|
+
* app globals — Figma / Tldraw /
|
|
23
|
+
* Excalidraw / generic).
|
|
24
|
+
* - `canvas_query` — dispatcher to a canvas-app adapter
|
|
25
|
+
* plugin (landed separately).
|
|
26
|
+
*
|
|
27
|
+
* Capability `canvas` — off-by-default, loud-warned at boot. Same posture
|
|
28
|
+
* class as `eval` / `network-body` / `secrets` / `extensions` /
|
|
29
|
+
* `device-emulation` / `diagnostics`. `canvas_diff` is pure-byte math
|
|
30
|
+
* and rides `read` (no canvas-pixel touch of its own).
|
|
31
|
+
*
|
|
32
|
+
* The primitives are app-agnostic — discovery probes common globals but
|
|
33
|
+
* those are heuristic; the structured failure path tells the caller to
|
|
34
|
+
* pass `transform` explicitly OR install a canvas-app adapter plugin.
|
|
35
|
+
* Honours the `feedback_design_for_problem_class` rule: build for the
|
|
36
|
+
* problem class (canvas-app substrate), don't hard-bind to any one app.
|
|
37
|
+
*
|
|
38
|
+
* BYO-vision: browxai does NOT bundle OCR or a hosted vision API.
|
|
39
|
+
* `canvas_capture` is the pixel source; composition with the host
|
|
40
|
+
* agent's own multimodal vision is the loop (see `docs/tool-reference.md`
|
|
41
|
+
* "Canvas-app automation — BYO vision pattern").
|
|
42
|
+
*/
|
|
43
|
+
export function registerCanvasTools(host) {
|
|
44
|
+
const { z, register, gateCheck, entryFor, cfgActionTimeout, toolHandlers } = host;
|
|
45
|
+
register("canvas_capture", {
|
|
46
|
+
capability: "canvas",
|
|
47
|
+
description: "Extract framebuffer or 2D ImageData from a `<canvas>` element on the page. Three output formats: `png` (`canvas.toDataURL` — encoded image suitable for handoff to a host-agent multimodal vision call), `2d-imagedata` (raw RGBA bytes via `getImageData` — feed to `canvas_diff` for pixel math), `webgl-framebuffer` (raw RGBA via `gl.readPixels` on a WebGL/WebGL2 context, flipped into top-left order to match `2d-imagedata` convention). `ref` optional (canvas element ref from a prior `snapshot()`/`find()`); `selector` is a fallback selector path; omitting both targets the first `<canvas>` in the document. Bounded: canvases larger than 16384×16384 pixels refuse with a structured `too-large` error (defensive cap — most editors stay well below this; a multi-megapixel buffer round-tripped through base64 is genuinely a problem). PNG-format inputs to `canvas_diff` are byte-equality only this cycle (decoded-pixel diff is a follow-up); for per-pixel math + bbox, prefer `2d-imagedata` or `webgl-framebuffer`. Tainted canvases (cross-origin images without CORS) refuse with a `taint-or-encode` / `taint-or-read` error. WebGL contexts created without `preserveDrawingBuffer:true` may read back as zero bytes; `canvas_capture` requests `preserveDrawingBuffer:true` when it acquires the context but can't undo a prior context's choice. App-agnostic — for app-specific extraction (scene-graph node bounds, layer ids, frame names) install a canvas-app adapter plugin and call through `canvas_query`. Capability `canvas` (+ `read`).",
|
|
48
|
+
inputSchema: {
|
|
49
|
+
ref: z
|
|
50
|
+
.string()
|
|
51
|
+
.optional()
|
|
52
|
+
.describe("Stable [eN] ref of the canvas element. Omit to use the first `<canvas>` (with a `selector` fallback when supplied)."),
|
|
53
|
+
selector: z
|
|
54
|
+
.string()
|
|
55
|
+
.optional()
|
|
56
|
+
.describe("Fallback CSS selector path used when `ref` does not resolve."),
|
|
57
|
+
format: z
|
|
58
|
+
.enum(["png", "webgl-framebuffer", "2d-imagedata"])
|
|
59
|
+
.describe("`png` → base64 PNG bytes (handoff to vision); `2d-imagedata` → base64 RGBA bytes (pixel math); `webgl-framebuffer` → base64 RGBA from `gl.readPixels`, flipped to top-left to match imagedata convention."),
|
|
60
|
+
...SESSION_ARG,
|
|
61
|
+
},
|
|
62
|
+
}, async (args) => {
|
|
63
|
+
const g = gateCheck("canvas_capture");
|
|
64
|
+
if (g)
|
|
65
|
+
return g;
|
|
66
|
+
const e = await entryFor(args.session);
|
|
67
|
+
try {
|
|
68
|
+
const r = await withDeadline(canvasCapture(e.session.page(), {
|
|
69
|
+
ref: args.ref,
|
|
70
|
+
selector: args.selector,
|
|
71
|
+
format: args.format,
|
|
72
|
+
}), cfgActionTimeout(), "canvas_capture");
|
|
73
|
+
const json = JSON.stringify(r);
|
|
74
|
+
return {
|
|
75
|
+
content: [
|
|
76
|
+
{
|
|
77
|
+
type: "text",
|
|
78
|
+
text: JSON.stringify({ ...r, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
const body = { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
85
|
+
return {
|
|
86
|
+
content: [
|
|
87
|
+
{
|
|
88
|
+
type: "text",
|
|
89
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(JSON.stringify(body)) }, null, 2),
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
register("canvas_diff", {
|
|
96
|
+
capability: "read",
|
|
97
|
+
description: "Compute pixel/region delta between two captured RGBA payloads. Pure function — no page contact. Inputs are base64 RGBA byte arrays from a prior `canvas_capture({format:'2d-imagedata'})` or `canvas_capture({format:'webgl-framebuffer'})`. `width` + `height` are required (the byte buffer alone does not carry dimensions). `region` is an optional sub-rectangle (in image px, top-left origin); over-flow regions clamp to image bounds. → `{ ok, changedPixelCount, changedBytes, percentageChanged, bboxOfChanges:{x,y,w,h}|null, warnings[] }`. `changedBytes` is the sum of absolute per-channel deltas (useful for 'how much changed', not just 'did anything'). For PNG-format inputs: pass `inputFormat:'png'` — this cycle compares base64 byte equality only and surfaces a warning; per-pixel diff over PNG is a follow-up. Capability `read` (no canvas-pixel touch of its own; pure math over caller-supplied bytes).",
|
|
98
|
+
inputSchema: {
|
|
99
|
+
beforeBase64: z
|
|
100
|
+
.string()
|
|
101
|
+
.describe("Base64 RGBA bytes (or PNG when `inputFormat:'png'`) from a prior capture."),
|
|
102
|
+
afterBase64: z.string().describe("Base64 RGBA bytes (or PNG) from a later capture."),
|
|
103
|
+
width: z
|
|
104
|
+
.number()
|
|
105
|
+
.int()
|
|
106
|
+
.positive()
|
|
107
|
+
.optional()
|
|
108
|
+
.describe("Pixel width of the captures. Required for RGBA inputs."),
|
|
109
|
+
height: z
|
|
110
|
+
.number()
|
|
111
|
+
.int()
|
|
112
|
+
.positive()
|
|
113
|
+
.optional()
|
|
114
|
+
.describe("Pixel height of the captures. Required for RGBA inputs."),
|
|
115
|
+
region: z
|
|
116
|
+
.object({
|
|
117
|
+
x: z.number(),
|
|
118
|
+
y: z.number(),
|
|
119
|
+
w: z.number(),
|
|
120
|
+
h: z.number(),
|
|
121
|
+
})
|
|
122
|
+
.optional()
|
|
123
|
+
.describe("Optional sub-rectangle (image px, top-left origin)."),
|
|
124
|
+
inputFormat: z
|
|
125
|
+
.enum(["rgba", "png"])
|
|
126
|
+
.optional()
|
|
127
|
+
.describe("Defaults `rgba`. Pass `png` for PNG-format inputs (this cycle: base64 byte equality only + warning)."),
|
|
128
|
+
...SESSION_ARG,
|
|
129
|
+
},
|
|
130
|
+
}, async (args) => {
|
|
131
|
+
const g = gateCheck("canvas_diff");
|
|
132
|
+
if (g)
|
|
133
|
+
return g;
|
|
134
|
+
try {
|
|
135
|
+
const r = canvasDiff({
|
|
136
|
+
beforeBase64: args.beforeBase64,
|
|
137
|
+
afterBase64: args.afterBase64,
|
|
138
|
+
...(args.width !== undefined ? { width: args.width } : {}),
|
|
139
|
+
...(args.height !== undefined ? { height: args.height } : {}),
|
|
140
|
+
...(args.region ? { region: args.region } : {}),
|
|
141
|
+
...(args.inputFormat ? { inputFormat: args.inputFormat } : {}),
|
|
142
|
+
});
|
|
143
|
+
const json = JSON.stringify(r);
|
|
144
|
+
return {
|
|
145
|
+
content: [
|
|
146
|
+
{
|
|
147
|
+
type: "text",
|
|
148
|
+
text: JSON.stringify({ ...r, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
const body = { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
155
|
+
return {
|
|
156
|
+
content: [
|
|
157
|
+
{
|
|
158
|
+
type: "text",
|
|
159
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(JSON.stringify(body)) }, null, 2),
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
register("gesture_chain", {
|
|
166
|
+
capability: "canvas",
|
|
167
|
+
description: "Multi-step pointer program — drive a sequence of `down` / `move` / `up` / `wait` / `wheel` events through the standard Playwright mouse pipeline. For custom paint strokes, lasso paths, hand-drawn gestures, signature widgets — anything the canned `drag` / `double_click` / `gesture_swipe` family doesn't cover. Each step: `{kind, x?, y?, deltaX?, deltaY?, ms?, pointerId?}`. `down` / `up` / `move` require numeric `x` + `y`; `move` accepts an optional `ms` pacing delay (floored at 5 ms — tighter pacing rarely changes app behaviour and starves the renderer); `wait` accepts `ms` (clamped at 5000 ms — split longer waits across calls); `wheel` requires non-zero `deltaX` or `deltaY` and accepts optional `x` + `y` to move the pointer first. Bounded at 200 steps total — split larger programs across multiple calls. → `{ ok, stepsExecuted, totalDurationMs, warnings[] }`. `pointerId` is accepted on input but the v1 implementation routes through Playwright's single-mouse pipeline (multi-pointer fan-out is a future extension — for multi-touch today use `touch_*` / `gesture_pinch`). Capability `canvas` (+ `action`).",
|
|
168
|
+
inputSchema: {
|
|
169
|
+
steps: z
|
|
170
|
+
.array(z.object({
|
|
171
|
+
kind: z.enum(["down", "move", "up", "wait", "wheel"]),
|
|
172
|
+
x: z.number().optional(),
|
|
173
|
+
y: z.number().optional(),
|
|
174
|
+
deltaX: z.number().optional(),
|
|
175
|
+
deltaY: z.number().optional(),
|
|
176
|
+
ms: z.number().nonnegative().optional(),
|
|
177
|
+
pointerId: z.number().int().nonnegative().optional(),
|
|
178
|
+
}))
|
|
179
|
+
.describe("Step list. Max 200 steps; `move` floored at 5 ms; `wait` clamped at 5000 ms."),
|
|
180
|
+
...SESSION_ARG,
|
|
181
|
+
},
|
|
182
|
+
}, async (args) => {
|
|
183
|
+
const g = gateCheck("gesture_chain");
|
|
184
|
+
if (g)
|
|
185
|
+
return g;
|
|
186
|
+
const e = await entryFor(args.session);
|
|
187
|
+
try {
|
|
188
|
+
const r = await withDeadline(runGestureChain(e.session.page(), { steps: args.steps }), cfgActionTimeout(), "gesture_chain");
|
|
189
|
+
const json = JSON.stringify(r);
|
|
190
|
+
return {
|
|
191
|
+
content: [
|
|
192
|
+
{
|
|
193
|
+
type: "text",
|
|
194
|
+
text: JSON.stringify({ ...r, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
catch (err) {
|
|
200
|
+
const body = { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
201
|
+
return {
|
|
202
|
+
content: [
|
|
203
|
+
{
|
|
204
|
+
type: "text",
|
|
205
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(JSON.stringify(body)) }, null, 2),
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
register("canvas_world_to_screen", {
|
|
212
|
+
capability: "canvas",
|
|
213
|
+
description: "Translate a world-space coordinate to a screen-space coordinate via an affine transform. Two modes: **explicit** (caller passes `transform: {scale, panX, panY, originX?, originY?}` — math: `screenX = (worldX + panX) * scale + originX`); **discovery** (omit `transform` — the page-side probe walks common app-side globals: `app.viewport.zoom` + `app.viewport.center` (Figma / Excalidraw shape), `app.scale` + `app.offset` (Tldraw shape), `app.transform.matrix` (generic 6-element affine). On discovery success, returns `{ok, screenX, screenY, transformDiscovered, adapterHint: 'figma'|'tldraw'|'excalidraw'|'generic', warnings:[\"discovery probes are HEURISTIC — …\"]}`. On discovery failure: `{ok:false, error:'no transform discoverable — pass `transform` explicitly OR use a canvas-app adapter plugin', code:'no-transform'}`. Discovery is HEURISTIC by design — for production, pass `transform` explicitly or install a canvas-app adapter plugin. Capability `canvas` (+ `read`).",
|
|
214
|
+
inputSchema: {
|
|
215
|
+
worldX: z.number().describe("World-space X coordinate."),
|
|
216
|
+
worldY: z.number().describe("World-space Y coordinate."),
|
|
217
|
+
ref: z
|
|
218
|
+
.string()
|
|
219
|
+
.optional()
|
|
220
|
+
.describe("Stable canvas ref. Not used for math today; reserved for adapter dispatch."),
|
|
221
|
+
selector: z
|
|
222
|
+
.string()
|
|
223
|
+
.optional()
|
|
224
|
+
.describe("Canvas selector path. Not used for math today; reserved for adapter dispatch."),
|
|
225
|
+
transform: z
|
|
226
|
+
.object({
|
|
227
|
+
scale: z.number(),
|
|
228
|
+
panX: z.number(),
|
|
229
|
+
panY: z.number(),
|
|
230
|
+
originX: z.number().optional(),
|
|
231
|
+
originY: z.number().optional(),
|
|
232
|
+
})
|
|
233
|
+
.optional()
|
|
234
|
+
.describe("Explicit transform. Omit to trigger heuristic discovery."),
|
|
235
|
+
...SESSION_ARG,
|
|
236
|
+
},
|
|
237
|
+
}, async (args) => {
|
|
238
|
+
const g = gateCheck("canvas_world_to_screen");
|
|
239
|
+
if (g)
|
|
240
|
+
return g;
|
|
241
|
+
const e = await entryFor(args.session);
|
|
242
|
+
try {
|
|
243
|
+
const r = await withDeadline(canvasWorldToScreen(e.session.page(), {
|
|
244
|
+
worldX: args.worldX,
|
|
245
|
+
worldY: args.worldY,
|
|
246
|
+
...(args.ref ? { ref: args.ref } : {}),
|
|
247
|
+
...(args.selector ? { selector: args.selector } : {}),
|
|
248
|
+
...(args.transform ? { transform: args.transform } : {}),
|
|
249
|
+
}), cfgActionTimeout(), "canvas_world_to_screen");
|
|
250
|
+
const json = JSON.stringify(r);
|
|
251
|
+
return {
|
|
252
|
+
content: [
|
|
253
|
+
{
|
|
254
|
+
type: "text",
|
|
255
|
+
text: JSON.stringify({ ...r, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
catch (err) {
|
|
261
|
+
const body = { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
262
|
+
return {
|
|
263
|
+
content: [
|
|
264
|
+
{
|
|
265
|
+
type: "text",
|
|
266
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(JSON.stringify(body)) }, null, 2),
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
register("canvas_screen_to_world", {
|
|
273
|
+
capability: "canvas",
|
|
274
|
+
description: "Inverse of `canvas_world_to_screen`. Translate a screen-space coordinate to a world-space coordinate. Two modes: **explicit** (`transform: {scale, panX, panY, originX?, originY?}` — math: `worldX = (screenX - originX) / scale - panX`); **discovery** (omit `transform` — same page-side probe as the forward call). Discovery success: `{ok, worldX, worldY, transformDiscovered, adapterHint, warnings:[…HEURISTIC…]}`. Discovery failure: `{ok:false, error:'no transform discoverable — pass `transform` explicitly OR use a canvas-app adapter plugin', code:'no-transform'}`. Round-trips with `canvas_world_to_screen` to within floating-point precision under the same explicit transform. Capability `canvas` (+ `read`).",
|
|
275
|
+
inputSchema: {
|
|
276
|
+
screenX: z.number().describe("Screen-space X coordinate (viewport CSS px)."),
|
|
277
|
+
screenY: z.number().describe("Screen-space Y coordinate (viewport CSS px)."),
|
|
278
|
+
ref: z.string().optional().describe("Stable canvas ref. Reserved for adapter dispatch."),
|
|
279
|
+
selector: z
|
|
280
|
+
.string()
|
|
281
|
+
.optional()
|
|
282
|
+
.describe("Canvas selector path. Reserved for adapter dispatch."),
|
|
283
|
+
transform: z
|
|
284
|
+
.object({
|
|
285
|
+
scale: z.number(),
|
|
286
|
+
panX: z.number(),
|
|
287
|
+
panY: z.number(),
|
|
288
|
+
originX: z.number().optional(),
|
|
289
|
+
originY: z.number().optional(),
|
|
290
|
+
})
|
|
291
|
+
.optional()
|
|
292
|
+
.describe("Explicit transform. Omit to trigger heuristic discovery."),
|
|
293
|
+
...SESSION_ARG,
|
|
294
|
+
},
|
|
295
|
+
}, async (args) => {
|
|
296
|
+
const g = gateCheck("canvas_screen_to_world");
|
|
297
|
+
if (g)
|
|
298
|
+
return g;
|
|
299
|
+
const e = await entryFor(args.session);
|
|
300
|
+
try {
|
|
301
|
+
const r = await withDeadline(canvasScreenToWorld(e.session.page(), {
|
|
302
|
+
screenX: args.screenX,
|
|
303
|
+
screenY: args.screenY,
|
|
304
|
+
...(args.ref ? { ref: args.ref } : {}),
|
|
305
|
+
...(args.selector ? { selector: args.selector } : {}),
|
|
306
|
+
...(args.transform ? { transform: args.transform } : {}),
|
|
307
|
+
}), cfgActionTimeout(), "canvas_screen_to_world");
|
|
308
|
+
const json = JSON.stringify(r);
|
|
309
|
+
return {
|
|
310
|
+
content: [
|
|
311
|
+
{
|
|
312
|
+
type: "text",
|
|
313
|
+
text: JSON.stringify({ ...r, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
catch (err) {
|
|
319
|
+
const body = { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
320
|
+
return {
|
|
321
|
+
content: [
|
|
322
|
+
{
|
|
323
|
+
type: "text",
|
|
324
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(JSON.stringify(body)) }, null, 2),
|
|
325
|
+
},
|
|
326
|
+
],
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
register("canvas_query", {
|
|
331
|
+
capability: "canvas",
|
|
332
|
+
description: "Dispatcher routing to a canvas-app adapter plugin's handler. `adapter` is the namespace of a loaded plugin (e.g. `\"figma\"`); the tool looks up `<adapter>.<op>` in the live plugin tool registry and forwards `args`. If no plugin matches: `{ok:false, error:'no canvas adapter registered for <adapter>; install @browxai/plugin-<adapter> or pass a registered adapter namespace', code:'no-adapter', requestedAdapter, requestedOp}`. The inner plugin tool's capability is enforced via the plugin call-graph gate when reached. The host ships the dispatcher; the first-party canvas-app adapter plugins (`@browxai/plugin-figma`, `@browxai/plugin-tldraw`, `@browxai/plugin-excalidraw`) install separately — see docs/plugins-first-party.md for each adapter's op surface. Capability `canvas` (+ the inner tool's own capability via the plugin runtime gate).",
|
|
333
|
+
inputSchema: {
|
|
334
|
+
adapter: z.string().describe('Plugin namespace to route to (e.g. `"figma"`).'),
|
|
335
|
+
op: z
|
|
336
|
+
.string()
|
|
337
|
+
.describe("Operation name under the plugin's namespace — combined as `<adapter>.<op>` for the registry lookup."),
|
|
338
|
+
args: z.record(z.unknown()).optional().describe("Forwarded as the inner tool's args."),
|
|
339
|
+
...SESSION_ARG,
|
|
340
|
+
},
|
|
341
|
+
}, async (args) => {
|
|
342
|
+
const g = gateCheck("canvas_query");
|
|
343
|
+
if (g)
|
|
344
|
+
return g;
|
|
345
|
+
const targetName = `${args.adapter}.${args.op}`;
|
|
346
|
+
const fn = toolHandlers[targetName];
|
|
347
|
+
if (!fn) {
|
|
348
|
+
const body = noAdapterError(args.adapter, args.op);
|
|
349
|
+
const json = JSON.stringify(body);
|
|
350
|
+
return {
|
|
351
|
+
content: [
|
|
352
|
+
{
|
|
353
|
+
type: "text",
|
|
354
|
+
text: JSON.stringify({ ...body, tokensEstimate: estimateTokens(json) }, null, 2),
|
|
355
|
+
},
|
|
356
|
+
],
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
// Forward through the live (wrapped) handler — this routes through
|
|
360
|
+
// the plugin runtime's capability gate + metrics + diagnostics
|
|
361
|
+
// wrap, identical to a direct MCP call on the inner tool.
|
|
362
|
+
const inner = await fn({
|
|
363
|
+
...(args.args ?? {}),
|
|
364
|
+
...(args.session !== undefined ? { session: args.session } : {}),
|
|
365
|
+
});
|
|
366
|
+
return inner;
|
|
367
|
+
});
|
|
368
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ToolHost } from "./host.js";
|
|
2
|
+
/**
|
|
3
|
+
* Capture + report — session report & the diagnostics store. The session report
|
|
4
|
+
* + metrics rollups, the diagnostics note/search/report agent-feedback store,
|
|
5
|
+
* and Playwright-script export. Registered through the shared `ToolHost` seam.
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerCaptureReportDiagnosticsTools(host: ToolHost): void;
|