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,156 @@
|
|
|
1
|
+
import { confirmNavigation, confirmByobAction } from "../policy/confirm.js";
|
|
2
|
+
import { withDeadline } from "../util/deadline.js";
|
|
3
|
+
import { runShortcut } from "../page/shortcut.js";
|
|
4
|
+
import { ACTION_OPTS, REF_OR_SELECTOR, SESSION_ARG, TIMEOUT_ARG } from "./schemas.js";
|
|
5
|
+
import { actionTool } from "./action-tool.js";
|
|
6
|
+
/**
|
|
7
|
+
* Core action verbs: navigate / click / fill / press / shortcut. Split out of
|
|
8
|
+
* `action-tools` by cohesive family (RFC 0004 P3 / D3 SRP); registered through
|
|
9
|
+
* the shared `ToolHost` seam in the same source order. `click` and `fill` are the
|
|
10
|
+
* canonical confirm-gated target-resolving handlers, so they ride the `actionTool`
|
|
11
|
+
* wrapper (RFC 0004 P3 / D4) — byte-identical to the prior hand-written body.
|
|
12
|
+
* navigate (confirmNavigation), press (optional target), and shortcut (try/catch
|
|
13
|
+
* over runShortcut) keep their own bodies — their shapes differ from the canonical
|
|
14
|
+
* pipeline.
|
|
15
|
+
*/
|
|
16
|
+
export function registerActionCoreTools(host) {
|
|
17
|
+
const { z } = host;
|
|
18
|
+
host.register("navigate", {
|
|
19
|
+
capability: "navigation",
|
|
20
|
+
batchable: true,
|
|
21
|
+
description: "Navigate the page to a URL. Returns an ActionResult: navigation + structure changes + console/network slice + post-snapshot.",
|
|
22
|
+
inputSchema: { url: z.string().describe("Absolute URL"), ...ACTION_OPTS },
|
|
23
|
+
}, async ({ url, mode, maxResultTokens, timeoutMs, session }) => {
|
|
24
|
+
const g = host.gateCheck("navigate");
|
|
25
|
+
if (g)
|
|
26
|
+
return g;
|
|
27
|
+
const e = await host.entryFor(session);
|
|
28
|
+
const decision = await confirmNavigation(url, host.confirmCtxFor(e));
|
|
29
|
+
if (!decision.ok)
|
|
30
|
+
return host.denyContent("navigate", decision);
|
|
31
|
+
const td = host.actionTimeout({ timeoutMs });
|
|
32
|
+
return host.asActionResultText(host.actionsFor(e).navigate({
|
|
33
|
+
url,
|
|
34
|
+
mode,
|
|
35
|
+
maxResultTokens,
|
|
36
|
+
deadlineMs: td.ms,
|
|
37
|
+
deadlineWarning: td.warning,
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
actionTool(host, "click", {
|
|
41
|
+
capability: "action",
|
|
42
|
+
batchable: true,
|
|
43
|
+
description: "Click an element by `ref` (preferred — from snapshot/find), `selector`, `named`, or page `coords` ({x,y} viewport pixels — escape hatch for canvas / custom-painted UIs). `force:true` skips Playwright's actionability checks (visibility / stability / receives-events / hit-test) — escape hatch for perpetually-busy SPAs where rAF loops + frequent re-renders make the stability check thrash forever; use only on targets you've verified clickable via snapshot/find first. Returns an ActionResult.",
|
|
44
|
+
inputSchema: {
|
|
45
|
+
...REF_OR_SELECTOR,
|
|
46
|
+
button: z
|
|
47
|
+
.enum(["left", "right", "middle"])
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("Mouse button (default: left)"),
|
|
50
|
+
force: z
|
|
51
|
+
.boolean()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe("Skip actionability checks (visibility/stability/receives-events). Use sparingly — only for known-clickable targets on perpetually-busy SPAs where Playwright's stability check thrashes forever."),
|
|
54
|
+
...ACTION_OPTS,
|
|
55
|
+
},
|
|
56
|
+
}, ({ args, e, target, recordingHint, td }) => host.actionsFor(e).click({
|
|
57
|
+
target,
|
|
58
|
+
button: args.button,
|
|
59
|
+
force: args.force,
|
|
60
|
+
mode: args.mode,
|
|
61
|
+
maxResultTokens: args.maxResultTokens,
|
|
62
|
+
recordingHint,
|
|
63
|
+
deadlineMs: td.ms,
|
|
64
|
+
deadlineWarning: td.warning,
|
|
65
|
+
}));
|
|
66
|
+
actionTool(host, "fill", {
|
|
67
|
+
capability: "action",
|
|
68
|
+
batchable: true,
|
|
69
|
+
description: "Type into an input by `ref` or `selector`. Returns an ActionResult.",
|
|
70
|
+
inputSchema: { ...REF_OR_SELECTOR, value: z.string(), ...ACTION_OPTS },
|
|
71
|
+
}, ({ args, e, target, recordingHint, td }) => host.actionsFor(e).fill({
|
|
72
|
+
target,
|
|
73
|
+
value: args.value,
|
|
74
|
+
mode: args.mode,
|
|
75
|
+
maxResultTokens: args.maxResultTokens,
|
|
76
|
+
recordingHint,
|
|
77
|
+
deadlineMs: td.ms,
|
|
78
|
+
deadlineWarning: td.warning,
|
|
79
|
+
}));
|
|
80
|
+
host.register("press", {
|
|
81
|
+
capability: "action",
|
|
82
|
+
batchable: true,
|
|
83
|
+
description: "Press a key. If a `ref`/`selector` is given, presses on that element; else on the page.",
|
|
84
|
+
inputSchema: {
|
|
85
|
+
...REF_OR_SELECTOR,
|
|
86
|
+
key: z.string().describe('Playwright key syntax, e.g. "Enter", "Control+A"'),
|
|
87
|
+
...ACTION_OPTS,
|
|
88
|
+
},
|
|
89
|
+
}, async (args) => {
|
|
90
|
+
const g = host.gateCheck("press");
|
|
91
|
+
if (g)
|
|
92
|
+
return g;
|
|
93
|
+
const e = await host.entryFor(args.session);
|
|
94
|
+
const conf = await confirmByobAction("press", host.confirmCtxFor(e));
|
|
95
|
+
if (!conf.ok)
|
|
96
|
+
return host.denyContent("press", conf);
|
|
97
|
+
const hasTarget = !!(args.ref || args.selector || args.named);
|
|
98
|
+
const target = hasTarget ? host.asTarget(args, "press", e.refs) : undefined;
|
|
99
|
+
const td = host.actionTimeout(args);
|
|
100
|
+
return host.asActionResultText(host.actionsFor(e).press({
|
|
101
|
+
target,
|
|
102
|
+
key: args.key,
|
|
103
|
+
mode: args.mode,
|
|
104
|
+
maxResultTokens: args.maxResultTokens,
|
|
105
|
+
deadlineMs: td.ms,
|
|
106
|
+
deadlineWarning: td.warning,
|
|
107
|
+
}));
|
|
108
|
+
});
|
|
109
|
+
host.register("shortcut", {
|
|
110
|
+
capability: "action",
|
|
111
|
+
description: 'Dispatch a keyboard chord ("Control+C") or an ordered sequence (["Control+A","Control+C"]) and return handled-observability: the active element, which keydown/copy/cut/paste listeners fired, and whether the app called preventDefault — so you can prove the app actually handled the shortcut, not just that keys were sent. Optional `ref`/`selector` is focused first; else page-level. Copy/cut/paste integrate the per-session clipboard ONLY when the off-by-default `clipboard` capability is enabled: each session has its own clipboard buffer, and the shared OS clipboard is written only transactionally at the copy/cut (capture selection) or paste (inject this session\'s buffer) moment — never ambiently, never read into a session (no cross-session/human clipboard bleed). Observability works without the capability.',
|
|
112
|
+
inputSchema: {
|
|
113
|
+
keys: z
|
|
114
|
+
.union([z.string(), z.array(z.string()).min(1)])
|
|
115
|
+
.describe('A chord ("Control+C") or ordered sequence of chords. Playwright key syntax.'),
|
|
116
|
+
...REF_OR_SELECTOR,
|
|
117
|
+
...TIMEOUT_ARG,
|
|
118
|
+
...SESSION_ARG,
|
|
119
|
+
},
|
|
120
|
+
}, async (args) => {
|
|
121
|
+
const g = host.gateCheck("shortcut");
|
|
122
|
+
if (g)
|
|
123
|
+
return g;
|
|
124
|
+
const e = await host.entryFor(args.session);
|
|
125
|
+
const conf = await confirmByobAction("shortcut", host.confirmCtxFor(e));
|
|
126
|
+
if (!conf.ok)
|
|
127
|
+
return host.denyContent("shortcut", conf);
|
|
128
|
+
const hasTarget = !!(args.ref || args.selector || args.named);
|
|
129
|
+
const target = hasTarget ? host.asTarget(args, "shortcut", e.refs) : undefined;
|
|
130
|
+
const td = host.actionTimeout(args);
|
|
131
|
+
try {
|
|
132
|
+
const result = await withDeadline(runShortcut(e.session.page(), e.refs, { keys: args.keys, target }, {
|
|
133
|
+
clipboardEnabled: host.caps.enabled.has("clipboard"),
|
|
134
|
+
clipboard: e.clipboard,
|
|
135
|
+
}), td.ms, "shortcut");
|
|
136
|
+
return {
|
|
137
|
+
content: [
|
|
138
|
+
{
|
|
139
|
+
type: "text",
|
|
140
|
+
text: JSON.stringify(td.warning ? { ...result, warning: td.warning } : result, null, 2),
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
return {
|
|
147
|
+
content: [
|
|
148
|
+
{
|
|
149
|
+
type: "text",
|
|
150
|
+
text: JSON.stringify({ ok: false, error: err instanceof Error ? err.message : String(err) }, null, 2),
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ActionToolHost } from "./action-tool.js";
|
|
2
|
+
import type { ServerServicesHost } from "./host.js";
|
|
3
|
+
/**
|
|
4
|
+
* Form/element action verbs: hover / select / wait_for / scroll / choose_option.
|
|
5
|
+
* Split out of `action-tools` by cohesive family (RFC 0004 P3 / D3 SRP);
|
|
6
|
+
* registered in the same source order. `hover` and `select` are canonical
|
|
7
|
+
* confirm-gated target-resolving handlers, so they ride the `actionTool` wrapper
|
|
8
|
+
* (RFC 0004 P3 / D4) — byte-identical to the prior hand-written body. wait_for
|
|
9
|
+
* (text-vs-target branch), scroll (optional target + to/by), and choose_option
|
|
10
|
+
* (coords-rejection branch) keep their own bodies.
|
|
11
|
+
*/
|
|
12
|
+
export declare function registerActionFormTools(host: ActionToolHost & ServerServicesHost): void;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { confirmByobAction } from "../policy/confirm.js";
|
|
2
|
+
import { REF_OR_SELECTOR, ACTION_OPTS } from "./schemas.js";
|
|
3
|
+
import { actionTool } from "./action-tool.js";
|
|
4
|
+
/**
|
|
5
|
+
* Form/element action verbs: hover / select / wait_for / scroll / choose_option.
|
|
6
|
+
* Split out of `action-tools` by cohesive family (RFC 0004 P3 / D3 SRP);
|
|
7
|
+
* registered in the same source order. `hover` and `select` are canonical
|
|
8
|
+
* confirm-gated target-resolving handlers, so they ride the `actionTool` wrapper
|
|
9
|
+
* (RFC 0004 P3 / D4) — byte-identical to the prior hand-written body. wait_for
|
|
10
|
+
* (text-vs-target branch), scroll (optional target + to/by), and choose_option
|
|
11
|
+
* (coords-rejection branch) keep their own bodies.
|
|
12
|
+
*/
|
|
13
|
+
export function registerActionFormTools(host) {
|
|
14
|
+
const { z } = host;
|
|
15
|
+
actionTool(host, "hover", {
|
|
16
|
+
capability: "action",
|
|
17
|
+
batchable: true,
|
|
18
|
+
description: "Hover over an element by `ref` or `selector`. Returns an ActionResult.",
|
|
19
|
+
inputSchema: { ...REF_OR_SELECTOR, ...ACTION_OPTS },
|
|
20
|
+
}, ({ args, e, target, recordingHint, td }) => host.actionsFor(e).hover({
|
|
21
|
+
target,
|
|
22
|
+
mode: args.mode,
|
|
23
|
+
maxResultTokens: args.maxResultTokens,
|
|
24
|
+
recordingHint,
|
|
25
|
+
deadlineMs: td.ms,
|
|
26
|
+
deadlineWarning: td.warning,
|
|
27
|
+
}));
|
|
28
|
+
actionTool(host, "select", {
|
|
29
|
+
capability: "action",
|
|
30
|
+
batchable: true,
|
|
31
|
+
description: "Select option(s) on a <select> by `ref` or `selector`. Returns an ActionResult.",
|
|
32
|
+
inputSchema: { ...REF_OR_SELECTOR, values: z.array(z.string()), ...ACTION_OPTS },
|
|
33
|
+
}, ({ args, e, target, recordingHint, td }) => host.actionsFor(e).select({
|
|
34
|
+
target,
|
|
35
|
+
values: args.values,
|
|
36
|
+
mode: args.mode,
|
|
37
|
+
maxResultTokens: args.maxResultTokens,
|
|
38
|
+
recordingHint,
|
|
39
|
+
deadlineMs: td.ms,
|
|
40
|
+
deadlineWarning: td.warning,
|
|
41
|
+
}));
|
|
42
|
+
host.register("wait_for", {
|
|
43
|
+
capability: "action",
|
|
44
|
+
batchable: true,
|
|
45
|
+
description: "Wait until an element is visible (`ref`/`selector`/`named`/`coords`), or until visible `text` appears anywhere on the page (SPA-readiness gating after a reload/nav). Pass exactly one of a target or `text`. Bounded by design — it CANNOT hang: `timeoutMs` is both the max wait and the anti-wedge deadline (default 5000, 1h hard cap). `ok:false` means the wait expired — on a healthy page that's a real negative (the element/text never appeared); if snapshot/navigate are also timing out it's a wedge symptom, so discard the session rather than re-issuing the wait. No arbitrary-JS predicate mode by design (that's `eval_js`, gated behind the `eval` capability). Returns an ActionResult.",
|
|
46
|
+
inputSchema: {
|
|
47
|
+
...REF_OR_SELECTOR,
|
|
48
|
+
text: z
|
|
49
|
+
.string()
|
|
50
|
+
.optional()
|
|
51
|
+
.describe("wait until this visible text appears (substring match). Mutually exclusive with a target."),
|
|
52
|
+
// wait_for's `timeoutMs` (from ACTION_OPTS) is *both* the max wait and
|
|
53
|
+
// the anti-wedge deadline — a wait is meant to wait, so its ceiling is
|
|
54
|
+
// the explicit knob (default 5000, hard max 1h, deterred).
|
|
55
|
+
...ACTION_OPTS,
|
|
56
|
+
},
|
|
57
|
+
}, async (args) => {
|
|
58
|
+
const g = host.gateCheck("wait_for");
|
|
59
|
+
if (g)
|
|
60
|
+
return g;
|
|
61
|
+
const e = await host.entryFor(args.session);
|
|
62
|
+
const td = host.actionTimeout(args);
|
|
63
|
+
if (args.text !== undefined) {
|
|
64
|
+
return host.asActionResultText(host.actionsFor(e).waitFor({
|
|
65
|
+
text: args.text,
|
|
66
|
+
timeoutMs: td.ms,
|
|
67
|
+
deadlineMs: td.ms,
|
|
68
|
+
deadlineWarning: td.warning,
|
|
69
|
+
mode: args.mode,
|
|
70
|
+
maxResultTokens: args.maxResultTokens,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
const target = host.asTarget(args, "wait_for", e.refs);
|
|
74
|
+
return host.asActionResultText(host.actionsFor(e).waitFor({
|
|
75
|
+
target,
|
|
76
|
+
timeoutMs: td.ms,
|
|
77
|
+
deadlineMs: td.ms,
|
|
78
|
+
deadlineWarning: td.warning,
|
|
79
|
+
mode: args.mode,
|
|
80
|
+
maxResultTokens: args.maxResultTokens,
|
|
81
|
+
recordingHint: host.hintFromTarget(e, target),
|
|
82
|
+
}));
|
|
83
|
+
});
|
|
84
|
+
host.register("scroll", {
|
|
85
|
+
capability: "navigation",
|
|
86
|
+
batchable: true,
|
|
87
|
+
description: "Scroll the page or a scroll container. One general primitive:\n" +
|
|
88
|
+
" - No target → scroll the window. Pass `to: top|bottom|left|right` or `by: {x,y}` (CSS px; +y = down).\n" +
|
|
89
|
+
" - `ref`/`selector`/`named` target, no `to`/`by` → scroll that element *into view* (lazy-load / virtualised lists).\n" +
|
|
90
|
+
" - element target + `to`/`by` → scroll *within* that container (set `intoView:false` is implied).\n" +
|
|
91
|
+
" - `coords` target → wheel-scroll at that point (canvas / map / WebGL panning).\n" +
|
|
92
|
+
"Returns an ActionResult — scroll commonly triggers infinite-scroll XHRs and structure changes; read `network` / `structure` / `snapshotDelta` to see what loaded.",
|
|
93
|
+
inputSchema: {
|
|
94
|
+
...REF_OR_SELECTOR,
|
|
95
|
+
to: z
|
|
96
|
+
.enum(["top", "bottom", "left", "right"])
|
|
97
|
+
.optional()
|
|
98
|
+
.describe("Scroll to an edge of the page (or targeted container)."),
|
|
99
|
+
by: z
|
|
100
|
+
.object({ x: z.number().optional(), y: z.number().optional() })
|
|
101
|
+
.optional()
|
|
102
|
+
.describe("Wheel-style delta in CSS px. +y scrolls down, +x scrolls right."),
|
|
103
|
+
intoView: z
|
|
104
|
+
.boolean()
|
|
105
|
+
.optional()
|
|
106
|
+
.describe("When a target element is given: scroll it into view. Default true unless `to`/`by` is set."),
|
|
107
|
+
...ACTION_OPTS,
|
|
108
|
+
},
|
|
109
|
+
}, async (args) => {
|
|
110
|
+
const g = host.gateCheck("scroll");
|
|
111
|
+
if (g)
|
|
112
|
+
return g;
|
|
113
|
+
const e = await host.entryFor(args.session);
|
|
114
|
+
const c = await confirmByobAction("scroll", host.confirmCtxFor(e));
|
|
115
|
+
if (!c.ok)
|
|
116
|
+
return host.denyContent("scroll", c);
|
|
117
|
+
const hasTarget = !!(args.ref || args.selector || args.named || args.coords);
|
|
118
|
+
const target = hasTarget ? host.asTarget(args, "scroll", e.refs) : undefined;
|
|
119
|
+
const td = host.actionTimeout(args);
|
|
120
|
+
return host.asActionResultText(host.actionsFor(e).scroll({
|
|
121
|
+
target,
|
|
122
|
+
to: args.to,
|
|
123
|
+
by: args.by,
|
|
124
|
+
intoView: args.intoView,
|
|
125
|
+
mode: args.mode,
|
|
126
|
+
maxResultTokens: args.maxResultTokens,
|
|
127
|
+
recordingHint: target ? host.hintFromTarget(e, target) : undefined,
|
|
128
|
+
deadlineMs: td.ms,
|
|
129
|
+
deadlineWarning: td.warning,
|
|
130
|
+
}));
|
|
131
|
+
});
|
|
132
|
+
host.register("choose_option", {
|
|
133
|
+
capability: "action",
|
|
134
|
+
batchable: true,
|
|
135
|
+
description: "Pick an option in a combobox / listbox / menu by visible text. Generic primitive for custom controls that aren't native `<select>` (so the `select` tool can't drive them). The `target` is the trigger control (the combobox itself); `option` is the visible text of the option to commit. Opens the control if not already expanded, waits for a visible listbox/menu/portal, clicks the resolved option element (no type-and-press-Enter), returns the probe on the trigger — `ownerControl.displayTextAfter` shows the committed selection.",
|
|
136
|
+
inputSchema: {
|
|
137
|
+
...REF_OR_SELECTOR,
|
|
138
|
+
option: z.string().describe("Visible text of the option to commit."),
|
|
139
|
+
exact: z
|
|
140
|
+
.boolean()
|
|
141
|
+
.optional()
|
|
142
|
+
.describe("Exact-text match (default true). When false, the option is matched as a substring."),
|
|
143
|
+
...ACTION_OPTS,
|
|
144
|
+
},
|
|
145
|
+
}, async (args) => {
|
|
146
|
+
const g = host.gateCheck("choose_option");
|
|
147
|
+
if (g)
|
|
148
|
+
return g;
|
|
149
|
+
const e = await host.entryFor(args.session);
|
|
150
|
+
const c = await confirmByobAction("choose_option", host.confirmCtxFor(e));
|
|
151
|
+
if (!c.ok)
|
|
152
|
+
return host.denyContent("choose_option", c);
|
|
153
|
+
const target = host.asTarget(args, "choose_option", e.refs);
|
|
154
|
+
if ("coords" in target) {
|
|
155
|
+
return {
|
|
156
|
+
content: [
|
|
157
|
+
{
|
|
158
|
+
type: "text",
|
|
159
|
+
text: JSON.stringify({
|
|
160
|
+
ok: false,
|
|
161
|
+
error: "choose_option requires a ref/selector/named target (the combobox/menu trigger), not coords",
|
|
162
|
+
}, null, 2),
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
const td = host.actionTimeout(args);
|
|
168
|
+
return host.asActionResultText(host.actionsFor(e).chooseOption({
|
|
169
|
+
target,
|
|
170
|
+
option: args.option,
|
|
171
|
+
exact: args.exact,
|
|
172
|
+
mode: args.mode,
|
|
173
|
+
maxResultTokens: args.maxResultTokens,
|
|
174
|
+
recordingHint: host.hintFromTarget(e, target),
|
|
175
|
+
deadlineMs: td.ms,
|
|
176
|
+
deadlineWarning: td.warning,
|
|
177
|
+
}));
|
|
178
|
+
});
|
|
179
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RegisterHost, GateHost, SessionHost, ActionHost, ServerServicesHost } from "./host.js";
|
|
2
|
+
/**
|
|
3
|
+
* Gesture action tools: drag / double_click. Both take the coords-capable
|
|
4
|
+
* `gestureTarget` shape and dispatch through the lower-half gesture helpers under
|
|
5
|
+
* `withDeadline` + a structured try/catch — a shape distinct from the canonical
|
|
6
|
+
* action pipeline, so they keep their own bodies. Split out of `action-tools` by
|
|
7
|
+
* cohesive family (RFC 0004 P3 / D3 SRP); registered in the same source order.
|
|
8
|
+
*/
|
|
9
|
+
export declare function registerActionGestureTools(host: RegisterHost & GateHost & SessionHost & ActionHost & ServerServicesHost): void;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { withDeadline } from "../util/deadline.js";
|
|
2
|
+
import { drag, doubleClick } from "../page/gestures.js";
|
|
3
|
+
import { SESSION_ARG } from "./schemas.js";
|
|
4
|
+
/**
|
|
5
|
+
* Gesture action tools: drag / double_click. Both take the coords-capable
|
|
6
|
+
* `gestureTarget` shape and dispatch through the lower-half gesture helpers under
|
|
7
|
+
* `withDeadline` + a structured try/catch — a shape distinct from the canonical
|
|
8
|
+
* action pipeline, so they keep their own bodies. Split out of `action-tools` by
|
|
9
|
+
* cohesive family (RFC 0004 P3 / D3 SRP); registered in the same source order.
|
|
10
|
+
*/
|
|
11
|
+
export function registerActionGestureTools(host) {
|
|
12
|
+
const { z } = host;
|
|
13
|
+
// A *factory* — each call returns a fresh schema instance. Reusing one
|
|
14
|
+
// shared instance across `from`/`to`/`target` made zod-to-json-schema emit a
|
|
15
|
+
// `$ref` for the repeats, which some MCP schema viewers render wrong (the
|
|
16
|
+
// reported `drag.to.coords` showing as `string`). Distinct instances → no
|
|
17
|
+
// `$ref` dedup → every field renders identically.
|
|
18
|
+
const gestureTarget = () => z.object({
|
|
19
|
+
ref: z.string().optional().describe("Stable [eN] ref."),
|
|
20
|
+
selector: z.string().optional().describe("CSS / selectorHint."),
|
|
21
|
+
coords: z.object({ x: z.number(), y: z.number() }).optional().describe("Viewport CSS px."),
|
|
22
|
+
});
|
|
23
|
+
const toActionTarget = (o) => {
|
|
24
|
+
if (o.coords)
|
|
25
|
+
return { coords: o.coords };
|
|
26
|
+
if (o.ref)
|
|
27
|
+
return { ref: o.ref };
|
|
28
|
+
if (o.selector)
|
|
29
|
+
return { selector: o.selector };
|
|
30
|
+
throw new Error("target requires one of ref / selector / coords");
|
|
31
|
+
};
|
|
32
|
+
host.register("drag", {
|
|
33
|
+
capability: "action",
|
|
34
|
+
description: "Drag from one target to another: press at `from`, move to `to` over `steps` points, release. Each of `from`/`to` is `{ref}|{selector}|{coords}` (element targets press the box centre). `preflight:true` instead probes the `from` point and returns what's under it (top hit element + `resizeRisk` when a resize-handle cursor is present) WITHOUT dragging — check it first so a narrow item's edge doesn't get resized instead of moved. For timeline scrub/trim, drag-reorder, slider, lasso.",
|
|
35
|
+
inputSchema: {
|
|
36
|
+
from: gestureTarget().describe("Drag start: {ref}|{selector}|{coords}."),
|
|
37
|
+
to: gestureTarget()
|
|
38
|
+
.optional()
|
|
39
|
+
.describe("Drag end: {ref}|{selector}|{coords}. Required unless `preflight:true`."),
|
|
40
|
+
steps: z
|
|
41
|
+
.number()
|
|
42
|
+
.int()
|
|
43
|
+
.positive()
|
|
44
|
+
.max(100)
|
|
45
|
+
.optional()
|
|
46
|
+
.describe("Intermediate mouse-move points (default 12); more = smoother/slower."),
|
|
47
|
+
preflight: z
|
|
48
|
+
.boolean()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe("When true, probe the `from` point and report what it hits (resize-handle risk) without dragging."),
|
|
51
|
+
...SESSION_ARG,
|
|
52
|
+
},
|
|
53
|
+
}, async ({ from, to, steps, preflight, session }) => {
|
|
54
|
+
const g = host.gateCheck("drag");
|
|
55
|
+
if (g)
|
|
56
|
+
return g;
|
|
57
|
+
if (!preflight && !to) {
|
|
58
|
+
return {
|
|
59
|
+
content: [
|
|
60
|
+
{
|
|
61
|
+
type: "text",
|
|
62
|
+
text: JSON.stringify({ ok: false, error: "drag: `to` is required unless `preflight:true`" }, null, 2),
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const e = await host.entryFor(session);
|
|
68
|
+
try {
|
|
69
|
+
const r = await withDeadline(drag(e.session.page(), e.refs, {
|
|
70
|
+
from: toActionTarget(from),
|
|
71
|
+
to: to ? toActionTarget(to) : { coords: { x: 0, y: 0 } },
|
|
72
|
+
steps,
|
|
73
|
+
preflight,
|
|
74
|
+
}), host.cfgActionTimeout(), "drag");
|
|
75
|
+
return { content: [{ type: "text", text: JSON.stringify(r, null, 2) }] };
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
return {
|
|
79
|
+
content: [
|
|
80
|
+
{
|
|
81
|
+
type: "text",
|
|
82
|
+
text: JSON.stringify({ ok: false, error: err instanceof Error ? err.message : String(err) }, null, 2),
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
host.register("double_click", {
|
|
89
|
+
capability: "action",
|
|
90
|
+
description: "Double-click a target (`{ref}|{selector}|{coords}`).",
|
|
91
|
+
inputSchema: {
|
|
92
|
+
target: gestureTarget().describe("{ref}|{selector}|{coords}."),
|
|
93
|
+
...SESSION_ARG,
|
|
94
|
+
},
|
|
95
|
+
}, async ({ target, session }) => {
|
|
96
|
+
const g = host.gateCheck("double_click");
|
|
97
|
+
if (g)
|
|
98
|
+
return g;
|
|
99
|
+
const e = await host.entryFor(session);
|
|
100
|
+
try {
|
|
101
|
+
const r = await withDeadline(doubleClick(e.session.page(), e.refs, toActionTarget(target)), host.cfgActionTimeout(), "double_click");
|
|
102
|
+
return { content: [{ type: "text", text: JSON.stringify(r, null, 2) }] };
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
return {
|
|
106
|
+
content: [
|
|
107
|
+
{
|
|
108
|
+
type: "text",
|
|
109
|
+
text: JSON.stringify({ ok: false, error: err instanceof Error ? err.message : String(err) }, null, 2),
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RegisterHost, GateHost, SessionHost, ActionHost, ServerServicesHost } from "./host.js";
|
|
2
|
+
/**
|
|
3
|
+
* History + viewport action verbs: go_back / go_forward / set_viewport. No
|
|
4
|
+
* confirm hook, no target resolution — a shape distinct from the canonical action
|
|
5
|
+
* pipeline, so they keep their own bodies. Split out of `action-tools` by cohesive
|
|
6
|
+
* family (RFC 0004 P3 / D3 SRP); registered in the same source order.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerActionHistoryTools(host: RegisterHost & GateHost & SessionHost & ActionHost & ServerServicesHost): void;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ACTION_OPTS, SESSION_ARG, TIMEOUT_ARG } from "./schemas.js";
|
|
2
|
+
/**
|
|
3
|
+
* History + viewport action verbs: go_back / go_forward / set_viewport. No
|
|
4
|
+
* confirm hook, no target resolution — a shape distinct from the canonical action
|
|
5
|
+
* pipeline, so they keep their own bodies. Split out of `action-tools` by cohesive
|
|
6
|
+
* family (RFC 0004 P3 / D3 SRP); registered in the same source order.
|
|
7
|
+
*/
|
|
8
|
+
export function registerActionHistoryTools(host) {
|
|
9
|
+
const { z } = host;
|
|
10
|
+
host.register("go_back", {
|
|
11
|
+
capability: "navigation",
|
|
12
|
+
batchable: true,
|
|
13
|
+
description: "Navigate back in history. Returns an ActionResult.",
|
|
14
|
+
inputSchema: { ...ACTION_OPTS },
|
|
15
|
+
}, async (args) => {
|
|
16
|
+
const g = host.gateCheck("go_back");
|
|
17
|
+
if (g)
|
|
18
|
+
return g;
|
|
19
|
+
const td = host.actionTimeout(args);
|
|
20
|
+
return host.asActionResultText(host.actionsFor(await host.entryFor(args.session)).goBack({
|
|
21
|
+
mode: args.mode,
|
|
22
|
+
maxResultTokens: args.maxResultTokens,
|
|
23
|
+
deadlineMs: td.ms,
|
|
24
|
+
deadlineWarning: td.warning,
|
|
25
|
+
}));
|
|
26
|
+
});
|
|
27
|
+
host.register("go_forward", {
|
|
28
|
+
capability: "navigation",
|
|
29
|
+
batchable: true,
|
|
30
|
+
description: "Navigate forward in history. Returns an ActionResult.",
|
|
31
|
+
inputSchema: { ...ACTION_OPTS },
|
|
32
|
+
}, async (args) => {
|
|
33
|
+
const g = host.gateCheck("go_forward");
|
|
34
|
+
if (g)
|
|
35
|
+
return g;
|
|
36
|
+
const td = host.actionTimeout(args);
|
|
37
|
+
return host.asActionResultText(host.actionsFor(await host.entryFor(args.session)).goForward({
|
|
38
|
+
mode: args.mode,
|
|
39
|
+
maxResultTokens: args.maxResultTokens,
|
|
40
|
+
deadlineMs: td.ms,
|
|
41
|
+
deadlineWarning: td.warning,
|
|
42
|
+
}));
|
|
43
|
+
});
|
|
44
|
+
host.register("set_viewport", {
|
|
45
|
+
capability: "navigation",
|
|
46
|
+
batchable: true,
|
|
47
|
+
description: "resize a session's viewport mid-flight (responsive-breakpoint testing). `page.setViewportSize` re-lays-out and commonly triggers responsive re-render / lazy-load — returns an ActionResult so `structure` / `snapshotDelta` / `network` show what changed. Only the *size* changes live; full device emulation (isMobile/touch/UA/DPR) is creation-time — set it via `open_session({ device })`.",
|
|
48
|
+
inputSchema: {
|
|
49
|
+
width: z.number().int().positive().describe("CSS px."),
|
|
50
|
+
height: z.number().int().positive().describe("CSS px."),
|
|
51
|
+
...TIMEOUT_ARG,
|
|
52
|
+
...SESSION_ARG,
|
|
53
|
+
},
|
|
54
|
+
}, async ({ width, height, timeoutMs, session }) => {
|
|
55
|
+
const g = host.gateCheck("set_viewport");
|
|
56
|
+
if (g)
|
|
57
|
+
return g;
|
|
58
|
+
const e = await host.entryFor(session);
|
|
59
|
+
const td = host.actionTimeout({ timeoutMs });
|
|
60
|
+
return host.asActionResultText(host.actionsFor(e).setViewport({
|
|
61
|
+
width,
|
|
62
|
+
height,
|
|
63
|
+
deadlineMs: td.ms,
|
|
64
|
+
deadlineWarning: td.warning,
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
67
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { SessionEntry } from "../session/registry.js";
|
|
2
|
+
import type { ResolvedTarget, RegisterHost, GateHost, SessionHost, ActionHost, ToolMeta } from "./host.js";
|
|
3
|
+
import type { z } from "zod";
|
|
4
|
+
/** The narrow host slice an action handler depends on (RFC 0004 P3 / D3 ISP) —
|
|
5
|
+
* registration, gating, session resolution, action dispatch. */
|
|
6
|
+
export type ActionToolHost = RegisterHost & GateHost & SessionHost & ActionHost;
|
|
7
|
+
/** The per-call context the dispatch body receives — exactly the values the
|
|
8
|
+
* canonical handler bodies computed inline before calling the substrate verb. */
|
|
9
|
+
export interface ActionDispatchCtx<A> {
|
|
10
|
+
/** The schema-validated args. */
|
|
11
|
+
args: A;
|
|
12
|
+
/** The resolved session entry. */
|
|
13
|
+
e: SessionEntry;
|
|
14
|
+
/** The resolved action target (step 4). */
|
|
15
|
+
target: ResolvedTarget;
|
|
16
|
+
/** The recorder selectorHint for the target (`hintFromTarget(e, target)`). */
|
|
17
|
+
recordingHint: ReturnType<ActionHost["hintFromTarget"]>;
|
|
18
|
+
/** The resolved anti-wedge deadline (step 5). */
|
|
19
|
+
td: ReturnType<ActionHost["actionTimeout"]>;
|
|
20
|
+
}
|
|
21
|
+
/** Options that toggle the opt-in pipeline steps. */
|
|
22
|
+
export interface ActionToolOpts {
|
|
23
|
+
/** Run `engineGate(name, e)` after the session resolves — OFF by default
|
|
24
|
+
* (the canonical handlers do not engine-gate). Opt-in so a handler that DID
|
|
25
|
+
* engine-gate keeps that step; the wrapper never ADDS it where it was absent
|
|
26
|
+
* nor DROPS it where present. */
|
|
27
|
+
engineGate?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Register a confirm-gated, target-resolving action tool. The wrapper runs the
|
|
31
|
+
* fixed pipeline (gate → entry → [engineGate] → confirm → target → timeout →
|
|
32
|
+
* envelope) and the `dispatch` body returns the substrate verb promise (step 6).
|
|
33
|
+
*
|
|
34
|
+
* Byte-identical to the hand-written canonical handler: the only thing the body
|
|
35
|
+
* supplies is the substrate method + its per-verb args, exactly as before.
|
|
36
|
+
*/
|
|
37
|
+
export declare function actionTool<S extends z.ZodRawShape>(host: ActionToolHost, name: string, def: {
|
|
38
|
+
description: string;
|
|
39
|
+
capability: ToolMeta["capability"];
|
|
40
|
+
batchable?: boolean;
|
|
41
|
+
inputSchema: S;
|
|
42
|
+
}, dispatch: (ctx: ActionDispatchCtx<z.infer<z.ZodObject<S>>>) => Promise<unknown>, opts?: ActionToolOpts): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// RFC 0004 P3 / D4 (DRY) — the `actionTool()` wrapper.
|
|
2
|
+
//
|
|
3
|
+
// Every confirm-gated, target-resolving action handler runs the SAME pipeline:
|
|
4
|
+
//
|
|
5
|
+
// 1. gateCheck(name) — capability gate
|
|
6
|
+
// 2. entryFor(args.session) — resolve the session entry
|
|
7
|
+
// 3. confirmByobAction(name, …) — byob confirm hook
|
|
8
|
+
// 4. asTarget(args, name, e.refs) — resolve the wire target
|
|
9
|
+
// 5. actionTimeout(args) — anti-wedge deadline
|
|
10
|
+
// 6. actionsFor(e).<verb>({ … }) — the engine-agnostic dispatch
|
|
11
|
+
// 7. asActionResultText(…) — the standard ActionResult envelope
|
|
12
|
+
//
|
|
13
|
+
// `actionTool()` owns steps 1–5 and 7 verbatim; the caller's `dispatch` supplies
|
|
14
|
+
// ONLY step 6 (the substrate verb + its per-verb args). This is a pure
|
|
15
|
+
// extraction-substitution: the four canonical handlers (`click` / `fill` /
|
|
16
|
+
// `hover` / `select`) collapse onto it with byte-identical behaviour — same gate,
|
|
17
|
+
// same confirm, same target resolution, same deadline, same envelope.
|
|
18
|
+
//
|
|
19
|
+
// CRITICAL (audit tools-and-seam#10): `engineGate` is present on SOME action
|
|
20
|
+
// handlers and ABSENT on others. The four canonical handlers this wrapper serves
|
|
21
|
+
// do NOT call `engineGate`, so the wrapper does NOT call it by default — it is an
|
|
22
|
+
// OPT-IN param (`engineGate: true`). A handler whose shape differs (navigate /
|
|
23
|
+
// press / shortcut / drag / scroll / wait_for / choose_option / …) keeps its own
|
|
24
|
+
// hand-written body; the wrapper is applied ONLY where it is byte-identical.
|
|
25
|
+
import { confirmByobAction } from "../policy/confirm.js";
|
|
26
|
+
/**
|
|
27
|
+
* Register a confirm-gated, target-resolving action tool. The wrapper runs the
|
|
28
|
+
* fixed pipeline (gate → entry → [engineGate] → confirm → target → timeout →
|
|
29
|
+
* envelope) and the `dispatch` body returns the substrate verb promise (step 6).
|
|
30
|
+
*
|
|
31
|
+
* Byte-identical to the hand-written canonical handler: the only thing the body
|
|
32
|
+
* supplies is the substrate method + its per-verb args, exactly as before.
|
|
33
|
+
*/
|
|
34
|
+
export function actionTool(host, name, def, dispatch, opts = {}) {
|
|
35
|
+
host.register(name, {
|
|
36
|
+
capability: def.capability,
|
|
37
|
+
...(def.batchable !== undefined ? { batchable: def.batchable } : {}),
|
|
38
|
+
description: def.description,
|
|
39
|
+
inputSchema: def.inputSchema,
|
|
40
|
+
}, async (args) => {
|
|
41
|
+
const g = host.gateCheck(name);
|
|
42
|
+
if (g)
|
|
43
|
+
return g;
|
|
44
|
+
const e = await host.entryFor(args.session);
|
|
45
|
+
if (opts.engineGate) {
|
|
46
|
+
const eg = host.engineGate(name, e);
|
|
47
|
+
if (eg)
|
|
48
|
+
return eg;
|
|
49
|
+
}
|
|
50
|
+
const c = await confirmByobAction(name, host.confirmCtxFor(e));
|
|
51
|
+
if (!c.ok)
|
|
52
|
+
return host.denyContent(name, c);
|
|
53
|
+
const target = host.asTarget(args, name, e.refs);
|
|
54
|
+
const td = host.actionTimeout(args);
|
|
55
|
+
const recordingHint = host.hintFromTarget(e, target);
|
|
56
|
+
return host.asActionResultText(dispatch({ args, e, target, recordingHint, td }));
|
|
57
|
+
});
|
|
58
|
+
}
|