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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kalebtec
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://browxai.com"><img src="brand/browxai-glass-aurora-1024.png" width="116" alt="browxai" /></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">browxai</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center"><strong>A browser, built for agents.</strong><br/>
|
|
8
|
+
<a href="https://browxai.com">browxai.com</a> · <a href="brand/">brand kit</a></p>
|
|
9
|
+
|
|
10
|
+
**An MCP-native, model-agnostic, agentic-first browser-control server for AI agents.**
|
|
11
|
+
|
|
12
|
+
browxai gives an AI agent a curated, token-efficient browser surface over the
|
|
13
|
+
Model Context Protocol — a tool surface designed for agents rather than for human
|
|
14
|
+
developers, and headless/CI-capable. It is **engine-agnostic**: the same tool
|
|
15
|
+
surface drives Chromium, Firefox, and WebKit, real Chrome-on-Android, and real
|
|
16
|
+
Safari, each over the automation protocol that fits it (CDP, WebDriver BiDi,
|
|
17
|
+
safaridriver) behind one capability-port seam, so a tool never knows which engine
|
|
18
|
+
it is running on.
|
|
19
|
+
|
|
20
|
+
It is deliberately **not** a wrapper over `@playwright/mcp`: browxai owns its own
|
|
21
|
+
multi-engine transport so it can own the full session lifecycle — managed
|
|
22
|
+
profiles, attach-to-an-existing browser (BYOB), authenticated sessions, headed and
|
|
23
|
+
headless — and shape an agent-first surface around it.
|
|
24
|
+
|
|
25
|
+
- **Model-agnostic** — any MCP client (Claude, Codex, …), not locked to one model.
|
|
26
|
+
- **Engine-agnostic** — Chromium / Firefox / WebKit / Android Chrome / Safari behind one capability-port architecture; pick with `--engine` / `BROWX_ENGINE`. The default is Chromium, so nothing changes for existing setups.
|
|
27
|
+
- **Token-efficient** — `snapshot()` is a compact accessibility tree + DOM-walk, not a DOM dump; results are scoped/paginated/budgeted.
|
|
28
|
+
- **Safe by default** — capability-gated tools, an origin allow/blocklist, confirmation hooks, a hard anti-wedge deadline on every call. Dangerous surface (arbitrary JS, full response bodies, OS clipboard, network mocking) is off by default.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g browxai
|
|
34
|
+
npx playwright-core install chromium # one-time, ~150 MB
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Wire it into an MCP client (stdio transport) — e.g. in an `.mcp.json`:
|
|
38
|
+
|
|
39
|
+
```jsonc
|
|
40
|
+
{
|
|
41
|
+
"mcpServers": {
|
|
42
|
+
"browxai": { "command": "browxai" },
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## SDK (programmatic surface)
|
|
48
|
+
|
|
49
|
+
For consumers that author a single TypeScript script and run it
|
|
50
|
+
autonomously, browxai also ships a typed SDK. Same tool registry, same
|
|
51
|
+
capability gates, same egress hygiene — different transport.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { createBrowxai } from "browxai";
|
|
55
|
+
|
|
56
|
+
const browxai = await createBrowxai(); // in-process, single-script
|
|
57
|
+
await browxai.navigate({ url: "https://example.com" });
|
|
58
|
+
const { data } = await browxai.extract({
|
|
59
|
+
schema: {
|
|
60
|
+
/* … */
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
await browxai.close();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Three transports:
|
|
67
|
+
|
|
68
|
+
- **In-process** (default) — single Node process; the SDK drives the server
|
|
69
|
+
in-process. `close()` shuts the embedded server.
|
|
70
|
+
- **Stdio child** (`transport: "stdio-child"`) — spawns the `browxai` bin as
|
|
71
|
+
a subprocess and speaks MCP-over-stdio. `close()` ends the child.
|
|
72
|
+
- **Socket-attached** (`endpoint: "unix:///tmp/foo.sock"`) — connects to a
|
|
73
|
+
long-running `browxai serve --socket /tmp/foo.sock` process. Multiple
|
|
74
|
+
clients can attach to ONE server (e.g. a parent agent plus a child script
|
|
75
|
+
sharing one Chromium). `close()` ends only the local connection.
|
|
76
|
+
|
|
77
|
+
Capability gates apply identically to the MCP path: posture-broadening
|
|
78
|
+
tools (`eval_js`, `network_body`, `register_secret`, `upload_file`, …) are
|
|
79
|
+
**off by default** and only appear on the client when their capability is
|
|
80
|
+
named in `createBrowxai({ capabilities })`. Calling a non-exposed tool —
|
|
81
|
+
even via `client.callTool("eval_js", …)` — fails with a
|
|
82
|
+
`BROWXAI_SDK_NOT_EXPOSED` error before any wire dispatch.
|
|
83
|
+
|
|
84
|
+
## Harness setup
|
|
85
|
+
|
|
86
|
+
Ready-to-use setup for the common agent harnesses — MCP-server registration
|
|
87
|
+
plus a portable "driving browxai well" Agent Skill — lives in
|
|
88
|
+
**[`harness/`](harness/)**: [Claude Code](harness/adapters/claude-code/),
|
|
89
|
+
[Codex](harness/adapters/codex/), [Pi](harness/adapters/pi/).
|
|
90
|
+
|
|
91
|
+
## The surface
|
|
92
|
+
|
|
93
|
+
- **`snapshot`** — compact accessibility tree + DOM-walk pass; every node gets a stable `[ref=eN]`.
|
|
94
|
+
- **`find`** — natural-language query → ranked candidate locators with `selectorHint`, `stability`, visible-rect `bbox`, and an `actionable` verdict.
|
|
95
|
+
- **action tools** (`click` / `fill` / `navigate` / `select` / `wait_for` / …) — each returns a structured `ActionResult`: what navigated, what structure changed, console/network slice, a post-action element probe.
|
|
96
|
+
- **read tools** — `text_search`, `inspect`, `console_read`, `network_read`, `ws_read`, `screenshot`.
|
|
97
|
+
- **sessions** — isolated per-session contexts (own cookie jar / refs); `persistent`, `incognito`, or `attached` (BYOB) modes; MCP-driven config.
|
|
98
|
+
- **capabilities** — `read,navigation,action,human` on by default; `eval`, `network-body`, `clipboard`, `file-io`, and `byob-attach` are explicit opt-ins.
|
|
99
|
+
|
|
100
|
+
Full per-tool reference, the security model, and the stability policy are in the
|
|
101
|
+
**[documentation site](https://browxai.com/)**.
|
|
102
|
+
|
|
103
|
+
## Stability
|
|
104
|
+
|
|
105
|
+
browxai is **v0.7.0** and follows semver. The public tool surface (tool names,
|
|
106
|
+
documented input/output shapes, the `ActionResult` shape, the default
|
|
107
|
+
capability set) is frozen; anything behind an off-by-default capability is
|
|
108
|
+
explicitly experimental and not covered by the stability guarantee. See the
|
|
109
|
+
[Stability and semver](https://browxai.com/reference/tool-reference/#stability-and-semver) policy.
|
|
110
|
+
|
|
111
|
+
## Develop
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
corepack enable && pnpm install
|
|
115
|
+
pnpm install-browser # Chromium for playwright-core
|
|
116
|
+
pnpm typecheck && pnpm test
|
|
117
|
+
pnpm build # builds dist/ — the `browxai` bin is dist/cli.js
|
|
118
|
+
pnpm test:keystone # headless end-to-end keystone (real Chromium)
|
|
119
|
+
pnpm docs:dev # the documentation site, locally
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Project docs
|
|
123
|
+
|
|
124
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md) — contributor workflow + DCO.
|
|
125
|
+
- [AGENTS.md](AGENTS.md) — operating rules for AI-harness contributors.
|
|
126
|
+
- [SECURITY.md](SECURITY.md) — vulnerability reporting + disclosure policy.
|
|
127
|
+
- [MAINTAINERS.md](MAINTAINERS.md) — maintainer roster + responsibilities.
|
|
128
|
+
- [RELEASING.md](RELEASING.md) — release ritual + OIDC publish flow.
|
|
129
|
+
- [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) — Contributor Covenant adoption.
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
Code is MIT — see [LICENSE](LICENSE).
|
|
134
|
+
|
|
135
|
+
The **browxai name and logo are trademarks of Kalebtec** and are not
|
|
136
|
+
covered by the MIT License. The brand assets under [`brand/`](brand/)
|
|
137
|
+
are all-rights-reserved (see [`brand/LICENSE`](brand/LICENSE)). See
|
|
138
|
+
[TRADEMARKS.md](TRADEMARKS.md) for the full brand policy and what
|
|
139
|
+
nominative use is allowed.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
browxai is distributed under the MIT license (see [`LICENSE`](LICENSE)).
|
|
4
|
+
The published packages depend on the following third-party software.
|
|
5
|
+
|
|
6
|
+
## `browxai` (host package)
|
|
7
|
+
|
|
8
|
+
Direct production dependencies:
|
|
9
|
+
|
|
10
|
+
- **`@modelcontextprotocol/sdk`** — MIT.
|
|
11
|
+
Copyright Anthropic, PBC.
|
|
12
|
+
<https://github.com/modelcontextprotocol/typescript-sdk>
|
|
13
|
+
- **`playwright-core`** — Apache-2.0.
|
|
14
|
+
Copyright Microsoft Corporation.
|
|
15
|
+
<https://github.com/microsoft/playwright>
|
|
16
|
+
(ships its own `NOTICE` file, installed alongside the package)
|
|
17
|
+
- **`zod`** — MIT.
|
|
18
|
+
Copyright Colin McDonnell.
|
|
19
|
+
<https://github.com/colinhacks/zod>
|
|
20
|
+
|
|
21
|
+
These packages pull in their own (transitive) production dependencies;
|
|
22
|
+
every package in the installed tree carries its license text at
|
|
23
|
+
`node_modules/<name>/LICENSE` (or `LICENSE.md`/`LICENSE.txt`), and the
|
|
24
|
+
`pnpm licenses:check` CI gate restricts the production tree to the
|
|
25
|
+
allowlist `MIT / Apache-2.0 / BSD-2-Clause / BSD-3-Clause / ISC / 0BSD /
|
|
26
|
+
Unlicense / CC0-1.0`. A machine-readable inventory (CycloneDX SBOM,
|
|
27
|
+
`sbom.cdx.json`) is attached to every GitHub Release.
|
|
28
|
+
|
|
29
|
+
The optional `pnpm install-browser` step downloads Chromium via
|
|
30
|
+
`playwright-core`; Chromium is licensed under the BSD-3-Clause license
|
|
31
|
+
and bundles its own third-party notices (`chrome://credits`).
|
|
32
|
+
|
|
33
|
+
## `@browxai/plugin-example`, `@browxai/plugin-figma`, `@browxai/plugin-tldraw`, `@browxai/plugin-excalidraw`
|
|
34
|
+
|
|
35
|
+
No production dependencies — the host provides the plugin runtime API.
|
|
36
|
+
The canvas adapter plugins (`figma`, `tldraw`, `excalidraw`) drive the
|
|
37
|
+
respective web applications through the browser; they do not bundle or
|
|
38
|
+
link any code from those applications.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
This file is reviewed on every production-dependency change.
|
|
43
|
+
`pnpm licenses:check` gates the production tree against the license
|
|
44
|
+
allowlist in CI; `pnpm licenses:notices` prints the raw per-package
|
|
45
|
+
inventory (name, license, repository, publisher) for review.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runChrome(args: string[]): Promise<number>;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// `browxai chrome start|stop` — own the `--cdp` Chrome lifecycle ().
|
|
2
|
+
//
|
|
3
|
+
// Launches a Chromium with `--remote-debugging-port=9222 --user-data-dir=$BROWX_WORKSPACE/chrome-profile`
|
|
4
|
+
// (the right flags every time; profile in the workspace so logins survive across sessions)
|
|
5
|
+
// and writes the PID to `$BROWX_WORKSPACE/chrome.pid`. `stop` reads the PID file and
|
|
6
|
+
// SIGTERMs the process; cleans up. Stdout is fine — this is a CLI subcommand.
|
|
7
|
+
//
|
|
8
|
+
// The launched Chromium is the *BYOB target* an adopter would `BROWX_ATTACH_CDP=…`
|
|
9
|
+
// against. browxai itself does NOT attach to it from `chrome start` — start the
|
|
10
|
+
// MCP server separately (the `browxai-attached` MCP entry) once Chrome is up.
|
|
11
|
+
import { spawn } from "node:child_process";
|
|
12
|
+
import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
import { chromium } from "playwright-core";
|
|
15
|
+
import { resolveWorkspace } from "../util/workspace.js";
|
|
16
|
+
const DEFAULT_PORT = 9222;
|
|
17
|
+
export async function runChrome(args) {
|
|
18
|
+
const sub = args[0];
|
|
19
|
+
if (sub === "start")
|
|
20
|
+
return startChrome(args.slice(1));
|
|
21
|
+
if (sub === "stop")
|
|
22
|
+
return stopChrome();
|
|
23
|
+
if (sub === "status")
|
|
24
|
+
return statusChrome();
|
|
25
|
+
process.stderr.write("usage: browxai chrome <start [--port N] [--insecure] | stop | status>\n");
|
|
26
|
+
return 2;
|
|
27
|
+
}
|
|
28
|
+
function startChrome(opts) {
|
|
29
|
+
const port = parseFlagNum(opts, "--port") ?? DEFAULT_PORT;
|
|
30
|
+
const insecure = opts.includes("--insecure"); // opt-in security-lowered (BYOB recipe's `--disable-web-security`)
|
|
31
|
+
const ws = resolveWorkspace();
|
|
32
|
+
const profileDir = ws.sub("chrome-profile");
|
|
33
|
+
const pidFile = join(ws.root, "chrome.pid");
|
|
34
|
+
if (existsSync(pidFile)) {
|
|
35
|
+
const oldPid = readFileSync(pidFile, "utf8").trim();
|
|
36
|
+
if (oldPid && isProcessAlive(Number(oldPid))) {
|
|
37
|
+
process.stdout.write(`a previous browxai chrome is already running (pid ${oldPid}, port ${port}). Use \`browxai chrome stop\` first.\n`);
|
|
38
|
+
return Promise.resolve(1);
|
|
39
|
+
}
|
|
40
|
+
unlinkSync(pidFile);
|
|
41
|
+
}
|
|
42
|
+
const chromePath = chromium.executablePath();
|
|
43
|
+
if (!chromePath) {
|
|
44
|
+
process.stderr.write("no Chromium binary — run `pnpm install-browser` first\n");
|
|
45
|
+
return Promise.resolve(1);
|
|
46
|
+
}
|
|
47
|
+
const args = [
|
|
48
|
+
`--remote-debugging-port=${port}`,
|
|
49
|
+
`--user-data-dir=${profileDir}`,
|
|
50
|
+
"--no-first-run",
|
|
51
|
+
"--no-default-browser-check",
|
|
52
|
+
];
|
|
53
|
+
if (insecure) {
|
|
54
|
+
args.push("--disable-web-security", "--disable-site-isolation-trials");
|
|
55
|
+
process.stdout.write("⚠ --insecure: launching Chrome with --disable-web-security. SOP is OFF for the whole browser session. Use only against test/dev targets.\n");
|
|
56
|
+
}
|
|
57
|
+
const child = spawn(chromePath, args, { detached: true, stdio: "ignore" });
|
|
58
|
+
child.unref();
|
|
59
|
+
if (!child.pid) {
|
|
60
|
+
process.stderr.write("failed to spawn Chrome\n");
|
|
61
|
+
return Promise.resolve(1);
|
|
62
|
+
}
|
|
63
|
+
writeFileSync(pidFile, String(child.pid), "utf8");
|
|
64
|
+
process.stdout.write(`browxai chrome started\n pid: ${child.pid}\n port: ${port}\n profile: ${profileDir}\n attach: BROWX_ATTACH_CDP=http://127.0.0.1:${port}\n\nstop with: browxai chrome stop\n`);
|
|
65
|
+
return Promise.resolve(0);
|
|
66
|
+
}
|
|
67
|
+
async function stopChrome() {
|
|
68
|
+
const ws = resolveWorkspace();
|
|
69
|
+
const pidFile = join(ws.root, "chrome.pid");
|
|
70
|
+
if (!existsSync(pidFile)) {
|
|
71
|
+
process.stdout.write("no browxai chrome running (no chrome.pid in workspace)\n");
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
const pid = Number(readFileSync(pidFile, "utf8").trim());
|
|
75
|
+
if (!pid || !isProcessAlive(pid)) {
|
|
76
|
+
unlinkSync(pidFile);
|
|
77
|
+
process.stdout.write(`browxai chrome (pid ${pid}) no longer running; cleaned up pid file\n`);
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
process.kill(pid, "SIGTERM");
|
|
82
|
+
// Give it a beat; if it's still alive, SIGKILL.
|
|
83
|
+
await sleep(800);
|
|
84
|
+
if (isProcessAlive(pid))
|
|
85
|
+
process.kill(pid, "SIGKILL");
|
|
86
|
+
unlinkSync(pidFile);
|
|
87
|
+
process.stdout.write(`browxai chrome (pid ${pid}) stopped\n`);
|
|
88
|
+
return 0;
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
process.stderr.write(`failed to stop pid ${pid}: ${e instanceof Error ? e.message : String(e)}\n`);
|
|
92
|
+
return 1;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function statusChrome() {
|
|
96
|
+
const ws = resolveWorkspace();
|
|
97
|
+
const pidFile = join(ws.root, "chrome.pid");
|
|
98
|
+
if (!existsSync(pidFile)) {
|
|
99
|
+
process.stdout.write("no browxai chrome running (no chrome.pid in workspace)\n");
|
|
100
|
+
return Promise.resolve(0);
|
|
101
|
+
}
|
|
102
|
+
const pid = Number(readFileSync(pidFile, "utf8").trim());
|
|
103
|
+
if (pid && isProcessAlive(pid)) {
|
|
104
|
+
process.stdout.write(`browxai chrome running (pid ${pid})\n`);
|
|
105
|
+
return Promise.resolve(0);
|
|
106
|
+
}
|
|
107
|
+
process.stdout.write(`pid ${pid} no longer alive; run \`browxai chrome stop\` to clean up\n`);
|
|
108
|
+
return Promise.resolve(1);
|
|
109
|
+
}
|
|
110
|
+
function isProcessAlive(pid) {
|
|
111
|
+
if (!pid)
|
|
112
|
+
return false;
|
|
113
|
+
try {
|
|
114
|
+
process.kill(pid, 0);
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function parseFlagNum(args, flag) {
|
|
122
|
+
const i = args.indexOf(flag);
|
|
123
|
+
if (i < 0)
|
|
124
|
+
return undefined;
|
|
125
|
+
const v = Number(args[i + 1]);
|
|
126
|
+
return Number.isFinite(v) ? v : undefined;
|
|
127
|
+
}
|
|
128
|
+
function sleep(ms) {
|
|
129
|
+
return new Promise((r) => setTimeout(r, ms));
|
|
130
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** A subcommand handler: receives the argv after the subcommand token, returns
|
|
2
|
+
* the process exit code. */
|
|
3
|
+
export type CommandHandler = (rest: string[]) => Promise<number>;
|
|
4
|
+
/** Register a subcommand handler. Add-only: a new command is one
|
|
5
|
+
* `registerCommand(...)` call, never a new `case` in `cli.ts`. */
|
|
6
|
+
export declare function registerCommand(name: string, handler: CommandHandler): void;
|
|
7
|
+
/** Resolve a subcommand handler, or `undefined` when the token is not a
|
|
8
|
+
* registered subcommand (the caller then applies the literal `--version` /
|
|
9
|
+
* `--help` / `--engine` / server-fallthrough rules — the same precedence the
|
|
10
|
+
* old `switch` encoded by case order). */
|
|
11
|
+
export declare function commandFor(name: string): CommandHandler | undefined;
|
|
12
|
+
/** The registered subcommand names, in registration order — used by `cli.ts`'s
|
|
13
|
+
* unknown-subcommand diagnostic so the "Valid: …" list stays in lockstep with
|
|
14
|
+
* the registry (no second hand-maintained list to drift). */
|
|
15
|
+
export declare function registeredCommands(): string[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// CLI subcommand registry (RFC 0004 P4 / D6) — the add-only
|
|
2
|
+
// `Map<string, CommandHandler>` that replaces the extensibility arms of the
|
|
3
|
+
// `switch (subcommand)` in `src/cli.ts`.
|
|
4
|
+
//
|
|
5
|
+
// Scope: this registry owns the EXTENSIBILITY subcommands — the ones a future
|
|
6
|
+
// command would be added alongside (`doctor` / `chrome` / `init` / `serve` /
|
|
7
|
+
// `plugin`). The `--version` / `--help` literal fast paths and the
|
|
8
|
+
// `undefined` / `--engine` server-fallthrough stay inline in `cli.ts`: they are
|
|
9
|
+
// not "another subcommand", they are the bin's own argv shape (a help flag and
|
|
10
|
+
// the default server path), so registry-ifying them would be miscategorising a
|
|
11
|
+
// fixed CLI contract as an open extension point.
|
|
12
|
+
//
|
|
13
|
+
// Each handler takes the post-subcommand argv (`rest`) and returns the process
|
|
14
|
+
// exit code, exactly as the old `runDoctor()` / `runChrome(rest)` / ... calls
|
|
15
|
+
// did. The dispatcher resolves the SAME handler the `case` did — `cli.ts`
|
|
16
|
+
// behavior (`browxai doctor`, `browxai plugin …`, etc.) is unchanged.
|
|
17
|
+
const COMMANDS = new Map();
|
|
18
|
+
/** Register a subcommand handler. Add-only: a new command is one
|
|
19
|
+
* `registerCommand(...)` call, never a new `case` in `cli.ts`. */
|
|
20
|
+
export function registerCommand(name, handler) {
|
|
21
|
+
COMMANDS.set(name, handler);
|
|
22
|
+
}
|
|
23
|
+
/** Resolve a subcommand handler, or `undefined` when the token is not a
|
|
24
|
+
* registered subcommand (the caller then applies the literal `--version` /
|
|
25
|
+
* `--help` / `--engine` / server-fallthrough rules — the same precedence the
|
|
26
|
+
* old `switch` encoded by case order). */
|
|
27
|
+
export function commandFor(name) {
|
|
28
|
+
return COMMANDS.get(name);
|
|
29
|
+
}
|
|
30
|
+
/** The registered subcommand names, in registration order — used by `cli.ts`'s
|
|
31
|
+
* unknown-subcommand diagnostic so the "Valid: …" list stays in lockstep with
|
|
32
|
+
* the registry (no second hand-maintained list to drift). */
|
|
33
|
+
export function registeredCommands() {
|
|
34
|
+
return [...COMMANDS.keys()];
|
|
35
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Check } from "./doctor.js";
|
|
2
|
+
import type { Capability } from "../util/capabilities.js";
|
|
3
|
+
export interface PluginChecksOptions {
|
|
4
|
+
/** Workspace root (`resolveWorkspace().root`). */
|
|
5
|
+
readonly workspaceRoot: string;
|
|
6
|
+
/** The capability set doctor resolved (mirrors the server's gate input). */
|
|
7
|
+
readonly enabledCapabilities: ReadonlySet<Capability>;
|
|
8
|
+
/** Extra plugin names declared via the config store
|
|
9
|
+
* (`set_config({plugins})`) — unioned with `plugins.json` exactly the
|
|
10
|
+
* way `startPluginRuntime` unions them. File entries win on collision. */
|
|
11
|
+
readonly extraDeclared?: ReadonlyArray<string>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Build the doctor checks for the plugin surface. Pure inspection — reads
|
|
15
|
+
* the declaration, the lock, and installed `package.json` manifests; never
|
|
16
|
+
* executes plugin code.
|
|
17
|
+
*/
|
|
18
|
+
export declare function pluginChecks(opts: PluginChecksOptions): Check[];
|