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,347 @@
|
|
|
1
|
+
import { withDeadline } from "../util/deadline.js";
|
|
2
|
+
import { confirmByobAction } from "../policy/confirm.js";
|
|
3
|
+
import { SESSION_ARG } from "./schemas.js";
|
|
4
|
+
/**
|
|
5
|
+
* Cache API + IndexedDB tools: caches_* (list_storages / list / get / put / delete
|
|
6
|
+
* / clear / delete_storage) and idb_* (list_databases / list_stores / get / put /
|
|
7
|
+
* delete / clear). Split out of `storage-tools` by cohesive family (RFC 0004 P3 /
|
|
8
|
+
* D3 SRP); registered through the shared `ToolHost` seam in the same source order.
|
|
9
|
+
*/
|
|
10
|
+
export function registerStorageCacheIdbTools(host) {
|
|
11
|
+
const { z, register, gateCheck, entryFor, okText, errText, confirmCtxFor, denyContent, storageFor, cfgActionTimeout, } = host;
|
|
12
|
+
// ---- Cache API -------------------------------------------------------------
|
|
13
|
+
register("caches_list_storages", {
|
|
14
|
+
capability: "read",
|
|
15
|
+
description: "List every cache storage visible to the current page's origin (`caches.keys()`). Cache API is ORIGIN-SCOPED — the session must be navigated to the target origin first; about:blank rejects with a navigation hint. Returns `{names:[...], origin}`. Read-only.",
|
|
16
|
+
inputSchema: { ...SESSION_ARG },
|
|
17
|
+
}, async ({ session }) => {
|
|
18
|
+
const g = gateCheck("caches_list_storages");
|
|
19
|
+
if (g)
|
|
20
|
+
return g;
|
|
21
|
+
try {
|
|
22
|
+
const e = await entryFor(session);
|
|
23
|
+
const r = await withDeadline(storageFor(e).cachesListStorages("caches_list_storages"), cfgActionTimeout(), "caches_list_storages");
|
|
24
|
+
return okText({ ok: true, count: r.names.length, ...r });
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
return errText("caches_list_storages", err);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
register("caches_list", {
|
|
31
|
+
capability: "read",
|
|
32
|
+
description: "List entries in one cache. Returns `{entries:[{url, method}], origin, cacheName}`. Optional `urlPattern` is a case-sensitive substring filter on each entry's URL (no regex — adopters wanting richer filtering can post-filter the result). Origin-scoped — navigate first. Read-only.",
|
|
33
|
+
inputSchema: {
|
|
34
|
+
cacheName: z.string().describe("Cache storage name."),
|
|
35
|
+
urlPattern: z
|
|
36
|
+
.string()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("Optional substring filter on each entry's `request.url`."),
|
|
39
|
+
...SESSION_ARG,
|
|
40
|
+
},
|
|
41
|
+
}, async ({ cacheName, urlPattern, session }) => {
|
|
42
|
+
const g = gateCheck("caches_list");
|
|
43
|
+
if (g)
|
|
44
|
+
return g;
|
|
45
|
+
try {
|
|
46
|
+
const e = await entryFor(session);
|
|
47
|
+
const r = await withDeadline(storageFor(e).cachesList({ cacheName, urlPattern }, "caches_list"), cfgActionTimeout(), "caches_list");
|
|
48
|
+
return okText({ ok: true, count: r.entries.length, ...r });
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
return errText("caches_list", err);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
register("caches_get", {
|
|
55
|
+
capability: "read",
|
|
56
|
+
description: 'Read the response body of a single cache entry. Text-like content types (`text/*`, `application/json|javascript|xml|x-www-form-urlencoded`, or anything with a `charset=`) arrive as `{kind:"text", text}`. Everything else arrives as `{kind:"binary", contentBase64, byteLength}`. `{found:false}` if no entry matches the URL. Origin-scoped — navigate first. Read-only.',
|
|
57
|
+
inputSchema: {
|
|
58
|
+
cacheName: z.string().describe("Cache storage name."),
|
|
59
|
+
url: z.string().describe("Entry URL key."),
|
|
60
|
+
...SESSION_ARG,
|
|
61
|
+
},
|
|
62
|
+
}, async ({ cacheName, url, session }) => {
|
|
63
|
+
const g = gateCheck("caches_get");
|
|
64
|
+
if (g)
|
|
65
|
+
return g;
|
|
66
|
+
try {
|
|
67
|
+
const e = await entryFor(session);
|
|
68
|
+
const r = await withDeadline(storageFor(e).cachesGet({ cacheName, url }, "caches_get"), cfgActionTimeout(), "caches_get");
|
|
69
|
+
return okText({ ok: true, ...r });
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
return errText("caches_get", err);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
register("caches_put", {
|
|
76
|
+
capability: "action",
|
|
77
|
+
description: "Put one entry in a cache. `response.body` is a UTF-8 string (default); for binary content pass `response.contentBase64` instead — exactly one of the two. Optional `response.status` (default 200) and `response.headers` build the `Response`. Auto-opens (= creates) the named cache storage if it doesn't exist. Origin-scoped — navigate first.",
|
|
78
|
+
inputSchema: {
|
|
79
|
+
cacheName: z.string().describe("Cache storage name (auto-created)."),
|
|
80
|
+
url: z.string().describe("Entry URL key."),
|
|
81
|
+
response: z
|
|
82
|
+
.object({
|
|
83
|
+
status: z.number().optional().describe("HTTP status (default 200)."),
|
|
84
|
+
headers: z.record(z.string()).optional().describe("Response headers."),
|
|
85
|
+
body: z
|
|
86
|
+
.string()
|
|
87
|
+
.optional()
|
|
88
|
+
.describe("UTF-8 string body. Mutually exclusive with `contentBase64`."),
|
|
89
|
+
contentBase64: z
|
|
90
|
+
.string()
|
|
91
|
+
.optional()
|
|
92
|
+
.describe("Base64-encoded binary body. Mutually exclusive with `body`."),
|
|
93
|
+
})
|
|
94
|
+
.describe("Response shape — body+headers+status."),
|
|
95
|
+
...SESSION_ARG,
|
|
96
|
+
},
|
|
97
|
+
}, async ({ cacheName, url, response, session }) => {
|
|
98
|
+
const g = gateCheck("caches_put");
|
|
99
|
+
if (g)
|
|
100
|
+
return g;
|
|
101
|
+
try {
|
|
102
|
+
const e = await entryFor(session);
|
|
103
|
+
const c = await confirmByobAction("caches_put", confirmCtxFor(e));
|
|
104
|
+
if (!c.ok)
|
|
105
|
+
return denyContent("caches_put", c);
|
|
106
|
+
const r = await withDeadline(storageFor(e).cachesPut({ cacheName, url, response }, "caches_put"), cfgActionTimeout(), "caches_put");
|
|
107
|
+
return okText({ ...r });
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
return errText("caches_put", err);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
register("caches_delete", {
|
|
114
|
+
capability: "action",
|
|
115
|
+
description: "Delete one entry from a cache. Returns `existed:true` when a record was present (idempotent — repeat calls return `existed:false`). Origin-scoped — navigate first.",
|
|
116
|
+
inputSchema: {
|
|
117
|
+
cacheName: z.string().describe("Cache storage name."),
|
|
118
|
+
url: z.string().describe("Entry URL key."),
|
|
119
|
+
...SESSION_ARG,
|
|
120
|
+
},
|
|
121
|
+
}, async ({ cacheName, url, session }) => {
|
|
122
|
+
const g = gateCheck("caches_delete");
|
|
123
|
+
if (g)
|
|
124
|
+
return g;
|
|
125
|
+
try {
|
|
126
|
+
const e = await entryFor(session);
|
|
127
|
+
const c = await confirmByobAction("caches_delete", confirmCtxFor(e));
|
|
128
|
+
if (!c.ok)
|
|
129
|
+
return denyContent("caches_delete", c);
|
|
130
|
+
const r = await withDeadline(storageFor(e).cachesDelete({ cacheName, url }, "caches_delete"), cfgActionTimeout(), "caches_delete");
|
|
131
|
+
return okText({ ...r });
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
return errText("caches_delete", err);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
register("caches_clear", {
|
|
138
|
+
capability: "action",
|
|
139
|
+
description: "Clear every entry in a cache (the cache storage itself remains — use `caches_delete_storage` to drop the whole storage). Returns `cleared:N` (the count removed). Origin-scoped — navigate first.",
|
|
140
|
+
inputSchema: {
|
|
141
|
+
cacheName: z.string().describe("Cache storage name."),
|
|
142
|
+
...SESSION_ARG,
|
|
143
|
+
},
|
|
144
|
+
}, async ({ cacheName, session }) => {
|
|
145
|
+
const g = gateCheck("caches_clear");
|
|
146
|
+
if (g)
|
|
147
|
+
return g;
|
|
148
|
+
try {
|
|
149
|
+
const e = await entryFor(session);
|
|
150
|
+
const c = await confirmByobAction("caches_clear", confirmCtxFor(e));
|
|
151
|
+
if (!c.ok)
|
|
152
|
+
return denyContent("caches_clear", c);
|
|
153
|
+
const r = await withDeadline(storageFor(e).cachesClear({ cacheName }, "caches_clear"), cfgActionTimeout(), "caches_clear");
|
|
154
|
+
return okText({ ...r });
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
return errText("caches_clear", err);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
register("caches_delete_storage", {
|
|
161
|
+
capability: "action",
|
|
162
|
+
description: "Delete a cache storage entirely (`caches.delete(name)`). Returns `existed:true` when the storage was present (idempotent). To clear entries while keeping the storage, use `caches_clear`. Origin-scoped — navigate first.",
|
|
163
|
+
inputSchema: {
|
|
164
|
+
cacheName: z.string().describe("Cache storage name to delete."),
|
|
165
|
+
...SESSION_ARG,
|
|
166
|
+
},
|
|
167
|
+
}, async ({ cacheName, session }) => {
|
|
168
|
+
const g = gateCheck("caches_delete_storage");
|
|
169
|
+
if (g)
|
|
170
|
+
return g;
|
|
171
|
+
try {
|
|
172
|
+
const e = await entryFor(session);
|
|
173
|
+
const c = await confirmByobAction("caches_delete_storage", confirmCtxFor(e));
|
|
174
|
+
if (!c.ok)
|
|
175
|
+
return denyContent("caches_delete_storage", c);
|
|
176
|
+
const r = await withDeadline(storageFor(e).cachesDeleteStorage({ cacheName }, "caches_delete_storage"), cfgActionTimeout(), "caches_delete_storage");
|
|
177
|
+
return okText({ ...r });
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
return errText("caches_delete_storage", err);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
// ---- IndexedDB ------------------------------------------------------------
|
|
184
|
+
register("idb_list_databases", {
|
|
185
|
+
capability: "read",
|
|
186
|
+
description: "Enumerate every IndexedDB database visible to the current page's origin (`indexedDB.databases()`). Returns `{databases:[{name, version}], origin, supported}`. `supported:false` on engines that don't expose `indexedDB.databases()` (older non-Chromium browsers) — the storage is still readable per-database via `idb_list_stores({dbName})`, you just have to know the names. IndexedDB is ORIGIN-SCOPED — navigate first. Read-only.",
|
|
187
|
+
inputSchema: { ...SESSION_ARG },
|
|
188
|
+
}, async ({ session }) => {
|
|
189
|
+
const g = gateCheck("idb_list_databases");
|
|
190
|
+
if (g)
|
|
191
|
+
return g;
|
|
192
|
+
try {
|
|
193
|
+
const e = await entryFor(session);
|
|
194
|
+
const r = await withDeadline(storageFor(e).idbListDatabases("idb_list_databases"), cfgActionTimeout(), "idb_list_databases");
|
|
195
|
+
return okText({ ok: true, count: r.databases.length, ...r });
|
|
196
|
+
}
|
|
197
|
+
catch (err) {
|
|
198
|
+
return errText("idb_list_databases", err);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
register("idb_list_stores", {
|
|
202
|
+
capability: "read",
|
|
203
|
+
description: "List the object-store names inside a database. Read-only — does NOT trigger an upgrade transaction, so it will only see stores that already exist. Returns `{stores:[...], dbName, version, origin}`. Origin-scoped — navigate first.",
|
|
204
|
+
inputSchema: {
|
|
205
|
+
dbName: z.string().describe("Database name."),
|
|
206
|
+
...SESSION_ARG,
|
|
207
|
+
},
|
|
208
|
+
}, async ({ dbName, session }) => {
|
|
209
|
+
const g = gateCheck("idb_list_stores");
|
|
210
|
+
if (g)
|
|
211
|
+
return g;
|
|
212
|
+
try {
|
|
213
|
+
const e = await entryFor(session);
|
|
214
|
+
const r = await withDeadline(storageFor(e).idbListStores({ dbName }, "idb_list_stores"), cfgActionTimeout(), "idb_list_stores");
|
|
215
|
+
return okText({ ok: true, count: r.stores.length, ...r });
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
return errText("idb_list_stores", err);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
register("idb_get", {
|
|
222
|
+
capability: "read",
|
|
223
|
+
description: "Get the value at a key in an object store. Returns `{found:true, value}` or `{found:false}`. KEY SHAPES: IDB natively accepts strings, numbers, dates, and arrays as keys — all four shapes round-trip through JSON cleanly (Dates as ISO strings; pass the ISO string back in on subsequent calls). VALUE SHAPES: IDB stores structured-clonable values (Blob/ArrayBuffer/Map/Set/Date), but this tool returns over MCP's JSON-only transport — non-JSON-serialisable values surface as a structured error (the platform value is preserved IN the store; it just can't ride the wire). For binary payloads, store them base64-encoded at the app level. **JSON-string fidelity**: if the app under test stored a value via `JSON.stringify(obj)` (a localStorage-habit common in older code), `idb_get` returns the raw JSON STRING verbatim — IDB faithfully preserves shape, and browxai does NOT auto-detect-and-parse stringified values because some apps legitimately store JSON strings as strings. Call-site responsibility: `JSON.parse` if you expect an object. The companion `idb_put` warning surfaces the opposite footgun (an MCP client double-encoding the input). Origin-scoped — navigate first. Read-only.",
|
|
224
|
+
inputSchema: {
|
|
225
|
+
dbName: z.string().describe("Database name."),
|
|
226
|
+
storeName: z.string().describe("Object store name (must exist)."),
|
|
227
|
+
key: z
|
|
228
|
+
.union([z.string(), z.number(), z.array(z.union([z.string(), z.number()]))])
|
|
229
|
+
.describe("Primary key — string, number, or array of strings/numbers."),
|
|
230
|
+
...SESSION_ARG,
|
|
231
|
+
},
|
|
232
|
+
}, async ({ dbName, storeName, key, session }) => {
|
|
233
|
+
const g = gateCheck("idb_get");
|
|
234
|
+
if (g)
|
|
235
|
+
return g;
|
|
236
|
+
try {
|
|
237
|
+
const e = await entryFor(session);
|
|
238
|
+
const r = await withDeadline(storageFor(e).idbGet({ dbName, storeName, key }, "idb_get"), cfgActionTimeout(), "idb_get");
|
|
239
|
+
return okText({ ok: true, ...r });
|
|
240
|
+
}
|
|
241
|
+
catch (err) {
|
|
242
|
+
return errText("idb_get", err);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
register("idb_put", {
|
|
246
|
+
capability: "action",
|
|
247
|
+
description: "Put a value at a key in an object store. The object store MUST already exist — this tool does not create stores (store creation requires an IDB upgrade transaction, which is the app's schema concern). `value` is anything JSON-serialisable; non-JSON inputs reject at MCP-validation time. If the store uses an in-line keyPath, `key` is ignored (the keyPath read off `value` is authoritative); otherwise `key` becomes the out-of-line primary key. Origin-scoped — navigate first.",
|
|
248
|
+
inputSchema: {
|
|
249
|
+
dbName: z.string().describe("Database name (must exist)."),
|
|
250
|
+
storeName: z.string().describe("Object store name (must exist)."),
|
|
251
|
+
key: z
|
|
252
|
+
.union([z.string(), z.number(), z.array(z.union([z.string(), z.number()]))])
|
|
253
|
+
.describe("Primary key — string, number, or array. Ignored if the store uses an in-line keyPath."),
|
|
254
|
+
value: z.unknown().describe("JSON-serialisable value to store."),
|
|
255
|
+
...SESSION_ARG,
|
|
256
|
+
},
|
|
257
|
+
}, async ({ dbName, storeName, key, value, session }) => {
|
|
258
|
+
const g = gateCheck("idb_put");
|
|
259
|
+
if (g)
|
|
260
|
+
return g;
|
|
261
|
+
try {
|
|
262
|
+
const e = await entryFor(session);
|
|
263
|
+
const c = await confirmByobAction("idb_put", confirmCtxFor(e));
|
|
264
|
+
if (!c.ok)
|
|
265
|
+
return denyContent("idb_put", c);
|
|
266
|
+
// Defensive: if `value` reaches the handler as a JSON-shaped string
|
|
267
|
+
// (some MCP clients double-encode complex args), the page-side path
|
|
268
|
+
// faithfully stores a string — adopter wrote an object, IDB holds
|
|
269
|
+
// a string, app reads back a string. Surface the case as a warning
|
|
270
|
+
// without auto-parsing (some apps legitimately store JSON strings).
|
|
271
|
+
const warnings = [];
|
|
272
|
+
if (typeof value === "string" && value.length > 1) {
|
|
273
|
+
const first = value[0];
|
|
274
|
+
if (first === "{" || first === "[") {
|
|
275
|
+
try {
|
|
276
|
+
const parsed = JSON.parse(value);
|
|
277
|
+
if (parsed !== null && typeof parsed === "object") {
|
|
278
|
+
warnings.push("idb_put: `value` arrived as a JSON-encoded STRING (e.g. `'{\"k\":1}'`). " +
|
|
279
|
+
"browxai stored it verbatim as a string — IDB now holds a string, not the parsed object. " +
|
|
280
|
+
"Most MCP clients pass structured args directly; if yours double-encodes complex values, " +
|
|
281
|
+
"JSON.parse them client-side before calling idb_put. Use idb_get to confirm what was written.");
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
catch {
|
|
285
|
+
/* not JSON; plain string — no warning */
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
const r = await withDeadline(storageFor(e).idbPut({ dbName, storeName, key, value }, "idb_put"), cfgActionTimeout(), "idb_put");
|
|
290
|
+
return okText({ ...r, ...(warnings.length > 0 ? { warnings } : {}) });
|
|
291
|
+
}
|
|
292
|
+
catch (err) {
|
|
293
|
+
return errText("idb_put", err);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
register("idb_delete", {
|
|
297
|
+
capability: "action",
|
|
298
|
+
description: "Delete the value at a key in an object store. Idempotent — returns the same shape whether or not a record was there. Origin-scoped — navigate first.",
|
|
299
|
+
inputSchema: {
|
|
300
|
+
dbName: z.string().describe("Database name."),
|
|
301
|
+
storeName: z.string().describe("Object store name."),
|
|
302
|
+
key: z
|
|
303
|
+
.union([z.string(), z.number(), z.array(z.union([z.string(), z.number()]))])
|
|
304
|
+
.describe("Primary key to delete."),
|
|
305
|
+
...SESSION_ARG,
|
|
306
|
+
},
|
|
307
|
+
}, async ({ dbName, storeName, key, session }) => {
|
|
308
|
+
const g = gateCheck("idb_delete");
|
|
309
|
+
if (g)
|
|
310
|
+
return g;
|
|
311
|
+
try {
|
|
312
|
+
const e = await entryFor(session);
|
|
313
|
+
const c = await confirmByobAction("idb_delete", confirmCtxFor(e));
|
|
314
|
+
if (!c.ok)
|
|
315
|
+
return denyContent("idb_delete", c);
|
|
316
|
+
const r = await withDeadline(storageFor(e).idbDelete({ dbName, storeName, key }, "idb_delete"), cfgActionTimeout(), "idb_delete");
|
|
317
|
+
return okText({ ...r });
|
|
318
|
+
}
|
|
319
|
+
catch (err) {
|
|
320
|
+
return errText("idb_delete", err);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
register("idb_clear", {
|
|
324
|
+
capability: "action",
|
|
325
|
+
description: "Clear every record from an object store (the store itself remains). Origin-scoped — navigate first.",
|
|
326
|
+
inputSchema: {
|
|
327
|
+
dbName: z.string().describe("Database name."),
|
|
328
|
+
storeName: z.string().describe("Object store name."),
|
|
329
|
+
...SESSION_ARG,
|
|
330
|
+
},
|
|
331
|
+
}, async ({ dbName, storeName, session }) => {
|
|
332
|
+
const g = gateCheck("idb_clear");
|
|
333
|
+
if (g)
|
|
334
|
+
return g;
|
|
335
|
+
try {
|
|
336
|
+
const e = await entryFor(session);
|
|
337
|
+
const c = await confirmByobAction("idb_clear", confirmCtxFor(e));
|
|
338
|
+
if (!c.ok)
|
|
339
|
+
return denyContent("idb_clear", c);
|
|
340
|
+
const r = await withDeadline(storageFor(e).idbClear({ dbName, storeName }, "idb_clear"), cfgActionTimeout(), "idb_clear");
|
|
341
|
+
return okText({ ...r });
|
|
342
|
+
}
|
|
343
|
+
catch (err) {
|
|
344
|
+
return errText("idb_clear", err);
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RegisterHost, GateHost, SessionHost, ConfigHost, EnvelopeHost, StorageHost, ActionHost, ServerServicesHost } from "./host.js";
|
|
2
|
+
/**
|
|
3
|
+
* Storage-state + cookies tools: dump_storage_state / inject_storage_state and the
|
|
4
|
+
* cookies CRUD family (cookies_get / cookies_list / cookies_set / cookies_delete /
|
|
5
|
+
* cookies_clear). Split out of `storage-tools` by cohesive family (RFC 0004 P3 /
|
|
6
|
+
* D3 SRP); registered through the shared `ToolHost` seam in the same source order.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerStorageStateCookiesTools(host: RegisterHost & GateHost & SessionHost & ConfigHost & EnvelopeHost & StorageHost & ActionHost & ServerServicesHost): void;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { withDeadline } from "../util/deadline.js";
|
|
2
|
+
import { confirmByobAction } from "../policy/confirm.js";
|
|
3
|
+
import { dumpStorageState, injectStorageState, readStorageStateFile, cookiesGet, cookiesDelete, cookiesClear, } from "../session/storage.js";
|
|
4
|
+
import { SESSION_ARG } from "./schemas.js";
|
|
5
|
+
/**
|
|
6
|
+
* Storage-state + cookies tools: dump_storage_state / inject_storage_state and the
|
|
7
|
+
* cookies CRUD family (cookies_get / cookies_list / cookies_set / cookies_delete /
|
|
8
|
+
* cookies_clear). Split out of `storage-tools` by cohesive family (RFC 0004 P3 /
|
|
9
|
+
* D3 SRP); registered through the shared `ToolHost` seam in the same source order.
|
|
10
|
+
*/
|
|
11
|
+
export function registerStorageStateCookiesTools(host) {
|
|
12
|
+
const { z, register, gateCheck, entryFor, okText, errText, confirmCtxFor, denyContent, storageFor, workspace, cfgActionTimeout, } = host;
|
|
13
|
+
// ---- layer 1 ----------------------------------------------------------------
|
|
14
|
+
register("dump_storage_state", {
|
|
15
|
+
capability: "read",
|
|
16
|
+
description: "Storage-state bulk dump — capture the session's current storage state (cookies + per-origin localStorage), the blob format Playwright's `BrowserContext.storageState()` returns. ALWAYS returns the blob; with `path`, also writes JSON to a workspace-rooted file (path-traversal rejected — must resolve under $BROWX_WORKSPACE). Use this to checkpoint an authed state for later replay via `inject_storage_state` / `auth_save`. Read-only. SECURITY NOTE: cookie *values* may carry credentials — treat the dump as sensitive (a future egress-masking pass lands separately).",
|
|
17
|
+
inputSchema: {
|
|
18
|
+
path: z
|
|
19
|
+
.string()
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("Optional workspace-rooted JSON file to write the state to (in addition to returning it inline). Rejected if it escapes $BROWX_WORKSPACE."),
|
|
22
|
+
...SESSION_ARG,
|
|
23
|
+
},
|
|
24
|
+
}, async ({ path, session }) => {
|
|
25
|
+
const g = gateCheck("dump_storage_state");
|
|
26
|
+
if (g)
|
|
27
|
+
return g;
|
|
28
|
+
try {
|
|
29
|
+
const e = await entryFor(session);
|
|
30
|
+
const r = await withDeadline(dumpStorageState(e.session.page().context(), workspace.root, { path }), cfgActionTimeout(), "dump_storage_state");
|
|
31
|
+
return okText({
|
|
32
|
+
ok: true,
|
|
33
|
+
cookies: r.state.cookies.length,
|
|
34
|
+
origins: r.state.origins.length,
|
|
35
|
+
...(r.path ? { path: r.path, bytes: r.bytes } : {}),
|
|
36
|
+
state: r.state,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
return errText("dump_storage_state", err);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
register("inject_storage_state", {
|
|
44
|
+
capability: "action",
|
|
45
|
+
description: "Storage-state bulk inject — apply a bulk storage state to the current session's context. `state` accepts either an inline blob OR a workspace-rooted JSON path (escape rejected). `mode:\"replace\"` (default) uses Playwright's `setStorageState` which CLEARS the context's existing cookies/localStorage/IndexedDB first — clean swap semantics. `mode:\"merge\"` adds cookies via `addCookies` without clearing AND best-effort merges localStorage for the currently-loaded origin only (other origins in the blob are skipped and returned in `originsSkipped` — localStorage is page-bound, not context-bound). For per-session seeding at CREATION, prefer `open_session({ storageState | authState })` — that's the Playwright-native primitive on incognito mode.",
|
|
46
|
+
inputSchema: {
|
|
47
|
+
state: z.union([
|
|
48
|
+
z.string().describe("Workspace-rooted JSON path to a state file (escape rejected)."),
|
|
49
|
+
z
|
|
50
|
+
.object({ cookies: z.array(z.any()), origins: z.array(z.any()) })
|
|
51
|
+
.passthrough()
|
|
52
|
+
.describe("Inline state blob (the shape `dump_storage_state` returns)."),
|
|
53
|
+
]),
|
|
54
|
+
mode: z
|
|
55
|
+
.enum(["replace", "merge"])
|
|
56
|
+
.optional()
|
|
57
|
+
.describe("`replace` (default) clears existing state then applies; `merge` adds without clearing (localStorage merge limited to current origin)."),
|
|
58
|
+
...SESSION_ARG,
|
|
59
|
+
},
|
|
60
|
+
}, async ({ state, mode, session }) => {
|
|
61
|
+
const g = gateCheck("inject_storage_state");
|
|
62
|
+
if (g)
|
|
63
|
+
return g;
|
|
64
|
+
try {
|
|
65
|
+
const e = await entryFor(session);
|
|
66
|
+
const c = await confirmByobAction("inject_storage_state", confirmCtxFor(e));
|
|
67
|
+
if (!c.ok)
|
|
68
|
+
return denyContent("inject_storage_state", c);
|
|
69
|
+
const blob = typeof state === "string"
|
|
70
|
+
? readStorageStateFile(workspace.root, state, "inject_storage_state")
|
|
71
|
+
: state;
|
|
72
|
+
const r = await withDeadline(injectStorageState(e.session.page().context(), e.session.page(), blob, { mode }), cfgActionTimeout(), "inject_storage_state");
|
|
73
|
+
return okText({ ok: true, ...r });
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
return errText("inject_storage_state", err);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
// ---- layer 2: cookies CRUD -------------------------------------------------
|
|
80
|
+
register("cookies_get", {
|
|
81
|
+
capability: "read",
|
|
82
|
+
description: "Read a single cookie by name. Optional `url` narrows the cookie jar (only cookies that would be sent on a request to that URL). Returns the full Playwright cookie object or `null`. Read-only.",
|
|
83
|
+
inputSchema: {
|
|
84
|
+
name: z.string().describe("Cookie name."),
|
|
85
|
+
url: z
|
|
86
|
+
.string()
|
|
87
|
+
.optional()
|
|
88
|
+
.describe("Optional URL — restricts to cookies that match this URL's domain/path/secure-context."),
|
|
89
|
+
...SESSION_ARG,
|
|
90
|
+
},
|
|
91
|
+
}, async ({ name, url, session }) => {
|
|
92
|
+
const g = gateCheck("cookies_get");
|
|
93
|
+
if (g)
|
|
94
|
+
return g;
|
|
95
|
+
try {
|
|
96
|
+
const e = await entryFor(session);
|
|
97
|
+
const r = await withDeadline(cookiesGet(e.session.page().context(), { name, url }), cfgActionTimeout(), "cookies_get");
|
|
98
|
+
return okText({ ok: true, cookie: r });
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
return errText("cookies_get", err);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
register("cookies_list", {
|
|
105
|
+
capability: "read",
|
|
106
|
+
description: "List cookies in the session's jar. `urls` filters to cookies that would be sent on requests to those URLs (Playwright's native filter). Returns the full Playwright cookie array. Read-only.",
|
|
107
|
+
inputSchema: {
|
|
108
|
+
urls: z
|
|
109
|
+
.array(z.string())
|
|
110
|
+
.optional()
|
|
111
|
+
.describe("Optional URL list — restricts the result to cookies matching these URLs."),
|
|
112
|
+
...SESSION_ARG,
|
|
113
|
+
},
|
|
114
|
+
}, async ({ urls, session }) => {
|
|
115
|
+
const g = gateCheck("cookies_list");
|
|
116
|
+
if (g)
|
|
117
|
+
return g;
|
|
118
|
+
try {
|
|
119
|
+
const e = await entryFor(session);
|
|
120
|
+
const r = await withDeadline(storageFor(e).cookiesList({ urls }), cfgActionTimeout(), "cookies_list");
|
|
121
|
+
return okText({ ok: true, count: r.length, cookies: r });
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
return errText("cookies_list", err);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
register("cookies_set", {
|
|
128
|
+
capability: "action",
|
|
129
|
+
description: 'Set a single cookie. Playwright\'s `addCookies` requires either `url` (recommended — derives domain/path/secure for you) OR both `domain` AND `path` explicitly; one of those two forms must be supplied or the call is rejected. Optional `expires` (Unix seconds), `httpOnly`, `secure`, `sameSite` (`"Strict"|"Lax"|"None"`). Idempotent w.r.t. (name, domain, path).',
|
|
130
|
+
inputSchema: {
|
|
131
|
+
name: z.string().describe("Cookie name."),
|
|
132
|
+
value: z.string().describe("Cookie value."),
|
|
133
|
+
url: z
|
|
134
|
+
.string()
|
|
135
|
+
.optional()
|
|
136
|
+
.describe("Recommended: source URL. Derives domain/path/secure. Mutually exclusive with explicit `domain`+`path`."),
|
|
137
|
+
domain: z.string().optional().describe("Explicit cookie domain. Requires `path` too."),
|
|
138
|
+
path: z
|
|
139
|
+
.string()
|
|
140
|
+
.optional()
|
|
141
|
+
.describe('Explicit cookie path (e.g. "/"). Requires `domain` too.'),
|
|
142
|
+
expires: z.number().optional().describe("Unix time in seconds. Omit for a session cookie."),
|
|
143
|
+
httpOnly: z.boolean().optional(),
|
|
144
|
+
secure: z.boolean().optional(),
|
|
145
|
+
sameSite: z.enum(["Strict", "Lax", "None"]).optional(),
|
|
146
|
+
...SESSION_ARG,
|
|
147
|
+
},
|
|
148
|
+
}, async ({ name, value, url, domain, path, expires, httpOnly, secure, sameSite, session }) => {
|
|
149
|
+
const g = gateCheck("cookies_set");
|
|
150
|
+
if (g)
|
|
151
|
+
return g;
|
|
152
|
+
try {
|
|
153
|
+
const e = await entryFor(session);
|
|
154
|
+
const c = await confirmByobAction("cookies_set", confirmCtxFor(e));
|
|
155
|
+
if (!c.ok)
|
|
156
|
+
return denyContent("cookies_set", c);
|
|
157
|
+
const r = await withDeadline(storageFor(e).cookiesSet({
|
|
158
|
+
name,
|
|
159
|
+
value,
|
|
160
|
+
url,
|
|
161
|
+
domain,
|
|
162
|
+
path,
|
|
163
|
+
expires,
|
|
164
|
+
httpOnly,
|
|
165
|
+
secure,
|
|
166
|
+
sameSite,
|
|
167
|
+
}), cfgActionTimeout(), "cookies_set");
|
|
168
|
+
return okText({ ok: r.ok, name: r.name });
|
|
169
|
+
}
|
|
170
|
+
catch (err) {
|
|
171
|
+
return errText("cookies_set", err);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
register("cookies_delete", {
|
|
175
|
+
capability: "action",
|
|
176
|
+
description: "Delete cookies by name, optionally narrowed by `url` (derives domain/path) or explicit `domain`/`path`. Returns `{ok:true}` even if no cookie matched (idempotent — distinguish presence via `cookies_get` first if needed).",
|
|
177
|
+
inputSchema: {
|
|
178
|
+
name: z.string().describe("Cookie name."),
|
|
179
|
+
url: z.string().optional().describe("Optional URL — narrows by derived domain/path."),
|
|
180
|
+
domain: z
|
|
181
|
+
.string()
|
|
182
|
+
.optional()
|
|
183
|
+
.describe("Explicit domain narrowing (overrides url-derived)."),
|
|
184
|
+
path: z.string().optional().describe("Explicit path narrowing (overrides url-derived)."),
|
|
185
|
+
...SESSION_ARG,
|
|
186
|
+
},
|
|
187
|
+
}, async ({ name, url, domain, path, session }) => {
|
|
188
|
+
const g = gateCheck("cookies_delete");
|
|
189
|
+
if (g)
|
|
190
|
+
return g;
|
|
191
|
+
try {
|
|
192
|
+
const e = await entryFor(session);
|
|
193
|
+
const c = await confirmByobAction("cookies_delete", confirmCtxFor(e));
|
|
194
|
+
if (!c.ok)
|
|
195
|
+
return denyContent("cookies_delete", c);
|
|
196
|
+
const r = await withDeadline(cookiesDelete(e.session.page().context(), { name, url, domain, path }), cfgActionTimeout(), "cookies_delete");
|
|
197
|
+
return okText({ ok: r.ok, name });
|
|
198
|
+
}
|
|
199
|
+
catch (err) {
|
|
200
|
+
return errText("cookies_delete", err);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
register("cookies_clear", {
|
|
204
|
+
capability: "action",
|
|
205
|
+
description: 'Wipe ALL cookies in the session\'s jar. Destructive across every domain in this context. localStorage and sessionStorage are untouched (use `*_clear` for those, or `inject_storage_state({state, mode:"replace"})` to reset everything via a bulk swap).',
|
|
206
|
+
inputSchema: { ...SESSION_ARG },
|
|
207
|
+
}, async ({ session }) => {
|
|
208
|
+
const g = gateCheck("cookies_clear");
|
|
209
|
+
if (g)
|
|
210
|
+
return g;
|
|
211
|
+
try {
|
|
212
|
+
const e = await entryFor(session);
|
|
213
|
+
const c = await confirmByobAction("cookies_clear", confirmCtxFor(e));
|
|
214
|
+
if (!c.ok)
|
|
215
|
+
return denyContent("cookies_clear", c);
|
|
216
|
+
const r = await withDeadline(cookiesClear(e.session.page().context()), cfgActionTimeout(), "cookies_clear");
|
|
217
|
+
return okText({ ok: r.ok });
|
|
218
|
+
}
|
|
219
|
+
catch (err) {
|
|
220
|
+
return errText("cookies_clear", err);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ToolHost } from "./host.js";
|
|
2
|
+
/**
|
|
3
|
+
* Storage-state tools — the three-layer storage surface plus the file-backed
|
|
4
|
+
* artifact / HAR / video families. Layer 1 bulk dump/inject, layer 2 granular
|
|
5
|
+
* cookies + web-storage + Cache API + IndexedDB CRUD, layer 3 named auth-state
|
|
6
|
+
* slots, and the session artifact KV / HAR record / video record tools.
|
|
7
|
+
*
|
|
8
|
+
* RFC 0004 P3 / D3 (SRP): the registrations were split by cohesive family into
|
|
9
|
+
* four sibling modules (state+cookies / web-storage+auth / cache+idb /
|
|
10
|
+
* artifact+har+video). This module stays the single entry point `server.ts` +
|
|
11
|
+
* `tool-metadata.ts` call, and invokes each family in the EXACT prior source order
|
|
12
|
+
* so the registered-name set + the derived maps stay byte-identical (the
|
|
13
|
+
* web-storage `for` loop over localStorage/sessionStorage is kept verbatim inside
|
|
14
|
+
* its family module). The host owns the closures (gate, confirm, storage port,
|
|
15
|
+
* workspace); the family modules own the registrations.
|
|
16
|
+
*/
|
|
17
|
+
export declare function registerStorageTools(host: ToolHost): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { registerStorageStateCookiesTools } from "./storage-state-cookies-tools.js";
|
|
2
|
+
import { registerStorageWebAuthTools } from "./storage-web-auth-tools.js";
|
|
3
|
+
import { registerStorageCacheIdbTools } from "./storage-cache-idb-tools.js";
|
|
4
|
+
import { registerStorageArtifactHarVideoTools } from "./storage-artifact-har-video-tools.js";
|
|
5
|
+
/**
|
|
6
|
+
* Storage-state tools — the three-layer storage surface plus the file-backed
|
|
7
|
+
* artifact / HAR / video families. Layer 1 bulk dump/inject, layer 2 granular
|
|
8
|
+
* cookies + web-storage + Cache API + IndexedDB CRUD, layer 3 named auth-state
|
|
9
|
+
* slots, and the session artifact KV / HAR record / video record tools.
|
|
10
|
+
*
|
|
11
|
+
* RFC 0004 P3 / D3 (SRP): the registrations were split by cohesive family into
|
|
12
|
+
* four sibling modules (state+cookies / web-storage+auth / cache+idb /
|
|
13
|
+
* artifact+har+video). This module stays the single entry point `server.ts` +
|
|
14
|
+
* `tool-metadata.ts` call, and invokes each family in the EXACT prior source order
|
|
15
|
+
* so the registered-name set + the derived maps stay byte-identical (the
|
|
16
|
+
* web-storage `for` loop over localStorage/sessionStorage is kept verbatim inside
|
|
17
|
+
* its family module). The host owns the closures (gate, confirm, storage port,
|
|
18
|
+
* workspace); the family modules own the registrations.
|
|
19
|
+
*/
|
|
20
|
+
export function registerStorageTools(host) {
|
|
21
|
+
registerStorageStateCookiesTools(host);
|
|
22
|
+
registerStorageWebAuthTools(host);
|
|
23
|
+
registerStorageCacheIdbTools(host);
|
|
24
|
+
registerStorageArtifactHarVideoTools(host);
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RegisterHost, GateHost, SessionHost, ConfigHost, EnvelopeHost, StorageHost, ActionHost, ServerServicesHost } from "./host.js";
|
|
2
|
+
/**
|
|
3
|
+
* Web-storage + named-auth-state tools: the localStorage / sessionStorage CRUD
|
|
4
|
+
* family (registered via a `for` loop over both kinds) plus auth_save / auth_load /
|
|
5
|
+
* auth_list / auth_delete. Split out of `storage-tools` by cohesive family (RFC
|
|
6
|
+
* 0004 P3 / D3 SRP); registered through the shared `ToolHost` seam in the same
|
|
7
|
+
* source order — the web-storage loop is kept verbatim so the 10 registered names
|
|
8
|
+
* land in the same order.
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerStorageWebAuthTools(host: RegisterHost & GateHost & SessionHost & ConfigHost & EnvelopeHost & StorageHost & ActionHost & ServerServicesHost): void;
|