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,186 @@
|
|
|
1
|
+
// Dependency-graph machinery for the plugin runtime.
|
|
2
|
+
//
|
|
3
|
+
// At server start, the resolver materialises each plugin's manifest and
|
|
4
|
+
// hands the runtime a `{plugin -> dependsOn[].plugin}` adjacency. This
|
|
5
|
+
// module:
|
|
6
|
+
// - Composes those edges into a directed graph.
|
|
7
|
+
// - Detects cycles via Tarjan's SCC pass (loudly: every plugin in any
|
|
8
|
+
// non-trivial SCC is named in the error so an adopter can fix it
|
|
9
|
+
// without re-running with verbose logs).
|
|
10
|
+
// - Topo-sorts the rest so the runtime loads deps before dependents.
|
|
11
|
+
// - Exposes per-plugin transitive `dependsOn` closures used by the
|
|
12
|
+
// runtime's call-graph enforcement (a plugin may call any tool
|
|
13
|
+
// belonging to a plugin in its TRANSITIVELY-resolved dep set,
|
|
14
|
+
// plus any core browxai tool).
|
|
15
|
+
//
|
|
16
|
+
// Kept dep-free — node:built-ins only.
|
|
17
|
+
export class DepGraphCycleError extends Error {
|
|
18
|
+
cycles;
|
|
19
|
+
constructor(cycles) {
|
|
20
|
+
const summary = cycles.map((c) => c.join(" → ")).join("; ");
|
|
21
|
+
super(`plugin runtime: dep-graph contains ${cycles.length} cycle(s) — refusing to load any plugin. ` +
|
|
22
|
+
`Cycles: ${summary}. Resolve by removing one direction of each cycle from the offending plugin manifest(s).`);
|
|
23
|
+
this.cycles = cycles;
|
|
24
|
+
this.name = "DepGraphCycleError";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Build the dep graph result. Throws {@link DepGraphCycleError} if any
|
|
29
|
+
* non-trivial strongly-connected component is found. The error names
|
|
30
|
+
* every plugin in every cycle.
|
|
31
|
+
*
|
|
32
|
+
* Self-edges (`pluginA -> pluginA`) are tolerated and ignored — a
|
|
33
|
+
* self-edge encodes "this plugin can call its own tools" which is
|
|
34
|
+
* always-true and harmless.
|
|
35
|
+
*
|
|
36
|
+
* Edges pointing at plugins that aren't in `directDeps.keys()` are
|
|
37
|
+
* tolerated at this layer; the runtime separately validates that
|
|
38
|
+
* dependsOn targets exist + satisfy their semver range. We only model
|
|
39
|
+
* what's in the graph here.
|
|
40
|
+
*/
|
|
41
|
+
export function buildDepGraph(input) {
|
|
42
|
+
const nodes = [...input.directDeps.keys()];
|
|
43
|
+
// Filter edges to self-edges-out + missing-target-out, since either
|
|
44
|
+
// poses no cycle risk + is reported elsewhere.
|
|
45
|
+
const edges = new Map();
|
|
46
|
+
for (const node of nodes) {
|
|
47
|
+
const deps = input.directDeps.get(node) ?? [];
|
|
48
|
+
const filtered = deps.filter((d) => d !== node && input.directDeps.has(d));
|
|
49
|
+
edges.set(node, filtered);
|
|
50
|
+
}
|
|
51
|
+
const cycles = findCycles(nodes, edges);
|
|
52
|
+
if (cycles.length > 0)
|
|
53
|
+
throw new DepGraphCycleError(cycles);
|
|
54
|
+
const loadOrder = topoSort(nodes, edges);
|
|
55
|
+
const transitiveDeps = computeTransitiveDeps(loadOrder, edges);
|
|
56
|
+
return { loadOrder, transitiveDeps };
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Tarjan's strongly-connected-components algorithm. A non-trivial SCC
|
|
60
|
+
* (size > 1) is a cycle; a self-edge in a single-node SCC would also
|
|
61
|
+
* count but we strip those above so a single-node SCC is always trivial.
|
|
62
|
+
*
|
|
63
|
+
* Output is the list of cycles, each cycle being its members in the
|
|
64
|
+
* order they appear in the SCC.
|
|
65
|
+
*/
|
|
66
|
+
function findCycles(nodes, edges) {
|
|
67
|
+
let index = 0;
|
|
68
|
+
const indexOf = new Map();
|
|
69
|
+
const lowlink = new Map();
|
|
70
|
+
const onStack = new Set();
|
|
71
|
+
const stack = [];
|
|
72
|
+
const cycles = [];
|
|
73
|
+
const strongconnect = (v) => {
|
|
74
|
+
indexOf.set(v, index);
|
|
75
|
+
lowlink.set(v, index);
|
|
76
|
+
index += 1;
|
|
77
|
+
stack.push(v);
|
|
78
|
+
onStack.add(v);
|
|
79
|
+
for (const w of edges.get(v) ?? []) {
|
|
80
|
+
if (!indexOf.has(w)) {
|
|
81
|
+
strongconnect(w);
|
|
82
|
+
lowlink.set(v, Math.min(lowlink.get(v), lowlink.get(w)));
|
|
83
|
+
}
|
|
84
|
+
else if (onStack.has(w)) {
|
|
85
|
+
lowlink.set(v, Math.min(lowlink.get(v), indexOf.get(w)));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (lowlink.get(v) === indexOf.get(v)) {
|
|
89
|
+
const component = [];
|
|
90
|
+
// pop until we pop v
|
|
91
|
+
while (true) {
|
|
92
|
+
const w = stack.pop();
|
|
93
|
+
onStack.delete(w);
|
|
94
|
+
component.push(w);
|
|
95
|
+
if (w === v)
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
if (component.length > 1)
|
|
99
|
+
cycles.push(component.reverse());
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
for (const v of nodes) {
|
|
103
|
+
if (!indexOf.has(v))
|
|
104
|
+
strongconnect(v);
|
|
105
|
+
}
|
|
106
|
+
return cycles;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Stable topological sort (Kahn-style). The input is assumed acyclic
|
|
110
|
+
* (the caller ran `findCycles` first). Within each "indegree==0" cohort
|
|
111
|
+
* we sort lexicographically so the load order is deterministic across
|
|
112
|
+
* runs / hosts.
|
|
113
|
+
*/
|
|
114
|
+
function topoSort(nodes, edges) {
|
|
115
|
+
const indegree = new Map();
|
|
116
|
+
for (const n of nodes)
|
|
117
|
+
indegree.set(n, 0);
|
|
118
|
+
for (const [, deps] of edges) {
|
|
119
|
+
for (const d of deps) {
|
|
120
|
+
// Edge n -> d means "n depends on d" — d must load first, so d
|
|
121
|
+
// gets an outgoing edge to n in the LOAD graph. Equivalently:
|
|
122
|
+
// each n we visit increments its OWN indegree by the count of
|
|
123
|
+
// not-yet-loaded deps it has. Cleaner: walk in reverse — process
|
|
124
|
+
// a node once all its deps have been processed.
|
|
125
|
+
void d;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// Compute indegree from the dependency direction. A node's "indegree"
|
|
129
|
+
// for load purposes is the number of deps that haven't loaded yet.
|
|
130
|
+
for (const [n, deps] of edges)
|
|
131
|
+
indegree.set(n, deps.length);
|
|
132
|
+
const ready = [];
|
|
133
|
+
for (const [n, deg] of indegree) {
|
|
134
|
+
if (deg === 0)
|
|
135
|
+
ready.push(n);
|
|
136
|
+
}
|
|
137
|
+
ready.sort();
|
|
138
|
+
const result = [];
|
|
139
|
+
// Reverse-edge map so we can decrement dependents when a node loads.
|
|
140
|
+
const dependents = new Map();
|
|
141
|
+
for (const n of nodes)
|
|
142
|
+
dependents.set(n, []);
|
|
143
|
+
for (const [n, deps] of edges) {
|
|
144
|
+
for (const d of deps) {
|
|
145
|
+
dependents.get(d)?.push(n);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
while (ready.length > 0) {
|
|
149
|
+
const next = ready.shift();
|
|
150
|
+
result.push(next);
|
|
151
|
+
for (const dep of dependents.get(next) ?? []) {
|
|
152
|
+
const left = (indegree.get(dep) ?? 0) - 1;
|
|
153
|
+
indegree.set(dep, left);
|
|
154
|
+
if (left === 0) {
|
|
155
|
+
// Insert sorted.
|
|
156
|
+
let i = 0;
|
|
157
|
+
while (i < ready.length && ready[i] < dep)
|
|
158
|
+
i += 1;
|
|
159
|
+
ready.splice(i, 0, dep);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (result.length !== nodes.length) {
|
|
164
|
+
// Shouldn't happen — cycles would have been caught above. Defensive.
|
|
165
|
+
throw new Error(`plugin runtime: topo-sort failed (loaded ${result.length} of ${nodes.length}). Re-run with diagnostics on.`);
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* For each plugin, compute the FULL transitive set of plugins it
|
|
171
|
+
* depends on. Walks the load order (deps-first) so each plugin can
|
|
172
|
+
* look up its already-computed dep closures.
|
|
173
|
+
*/
|
|
174
|
+
function computeTransitiveDeps(loadOrder, edges) {
|
|
175
|
+
const result = new Map();
|
|
176
|
+
for (const n of loadOrder) {
|
|
177
|
+
const closure = new Set();
|
|
178
|
+
for (const d of edges.get(n) ?? []) {
|
|
179
|
+
closure.add(d);
|
|
180
|
+
for (const t of result.get(d) ?? new Set())
|
|
181
|
+
closure.add(t);
|
|
182
|
+
}
|
|
183
|
+
result.set(n, closure);
|
|
184
|
+
}
|
|
185
|
+
return result;
|
|
186
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Trust tiers. The host operator is the only party who can configure which
|
|
4
|
+
* plugins to enable (via plugins.json), so trust is an advisory signal —
|
|
5
|
+
* the runtime treats `kalebtec` / `community` / `local` identically at
|
|
6
|
+
* capability-gate / call-graph-enforcement time. Surfaced on `plugins_list`
|
|
7
|
+
* so the operator can audit.
|
|
8
|
+
*
|
|
9
|
+
* - `kalebtec` — published by Kalebtec under `@browxai/plugin-*`.
|
|
10
|
+
* Reference plugins; same release/CI hygiene as the host.
|
|
11
|
+
* - `community` — third-party npm packages (`browxai-plugin-*` or
|
|
12
|
+
* `@<org>/browxai-plugin-*`). Adopter installs by name.
|
|
13
|
+
* - `local` — file-path-installed plugins. Used during plugin
|
|
14
|
+
* development (`browxai plugin install file:./my-plugin/`).
|
|
15
|
+
*/
|
|
16
|
+
export declare const TRUST_TIERS: readonly ["kalebtec", "community", "local"];
|
|
17
|
+
export type TrustTier = (typeof TRUST_TIERS)[number];
|
|
18
|
+
/**
|
|
19
|
+
* Inter-plugin dependency. `plugin` is the npm package name of another
|
|
20
|
+
* browxai plugin this one composes with. `version` is a semver range the
|
|
21
|
+
* dep must satisfy (e.g. `^1.0.0`). Matched against the dep plugin's
|
|
22
|
+
* `package.json#version` at load-time.
|
|
23
|
+
*/
|
|
24
|
+
export declare const dependsOnEntrySchema: z.ZodObject<{
|
|
25
|
+
plugin: z.ZodString;
|
|
26
|
+
version: z.ZodString;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
version: string;
|
|
29
|
+
plugin: string;
|
|
30
|
+
}, {
|
|
31
|
+
version: string;
|
|
32
|
+
plugin: string;
|
|
33
|
+
}>;
|
|
34
|
+
export type DependsOnEntry = z.infer<typeof dependsOnEntrySchema>;
|
|
35
|
+
/**
|
|
36
|
+
* The full plugin manifest, as embedded under `package.json#browxai`.
|
|
37
|
+
*
|
|
38
|
+
* apiVersion semver of the plugin-runtime contract the plugin codes
|
|
39
|
+
* against. The runtime advertises its own supported range
|
|
40
|
+
* (see RUNTIME_API_VERSION below); a plugin whose
|
|
41
|
+
* apiVersion does not satisfy is rejected at load-time.
|
|
42
|
+
*
|
|
43
|
+
* browxaiVersion semver range of the host browxai package the plugin
|
|
44
|
+
* was tested against. Advisory — surfaced in
|
|
45
|
+
* plugins_list, but a mismatch only warns (so a
|
|
46
|
+
* conservative range doesn't lock out a known-good
|
|
47
|
+
* host that already shipped). Authors can tighten this
|
|
48
|
+
* if needed.
|
|
49
|
+
*
|
|
50
|
+
* namespace MANDATORY tool prefix. Every tool a plugin registers
|
|
51
|
+
* is `<namespace>.<tool>`. The runtime rejects any
|
|
52
|
+
* other shape. Namespaces must be globally unique
|
|
53
|
+
* across the loaded plugin set — two plugins claiming
|
|
54
|
+
* `figma` both fail with a clear error.
|
|
55
|
+
*
|
|
56
|
+
* register Relative path to the JS module the runtime imports.
|
|
57
|
+
* The module must export a `register(api)` function
|
|
58
|
+
* (default export OR named `register`).
|
|
59
|
+
*
|
|
60
|
+
* capabilities Capabilities the plugin's tools need. Subset of the
|
|
61
|
+
* server's enabled set at load time. Mismatch →
|
|
62
|
+
* plugin disabled (status: disabled-by-capability-mismatch),
|
|
63
|
+
* server still starts. Empty array means "no
|
|
64
|
+
* capability-gated tools" — perfectly fine.
|
|
65
|
+
*
|
|
66
|
+
* trust Trust tier. The CLI tags this based on the install
|
|
67
|
+
* source; authors may set it on `kalebtec` packages but
|
|
68
|
+
* the CLI overrides on community / local installs.
|
|
69
|
+
*
|
|
70
|
+
* dependsOn Other browxai plugins this one calls into. The
|
|
71
|
+
* runtime composes these into a directed graph;
|
|
72
|
+
* cycles abort startup; call-graph enforcement at
|
|
73
|
+
* runtime refuses calls outside the declared
|
|
74
|
+
* transitive set.
|
|
75
|
+
*/
|
|
76
|
+
export declare const browxaiManifestSchema: z.ZodObject<{
|
|
77
|
+
apiVersion: z.ZodString;
|
|
78
|
+
browxaiVersion: z.ZodOptional<z.ZodString>;
|
|
79
|
+
namespace: z.ZodString;
|
|
80
|
+
register: z.ZodString;
|
|
81
|
+
capabilities: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
82
|
+
trust: z.ZodOptional<z.ZodEnum<["kalebtec", "community", "local"]>>;
|
|
83
|
+
dependsOn: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
84
|
+
plugin: z.ZodString;
|
|
85
|
+
version: z.ZodString;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
version: string;
|
|
88
|
+
plugin: string;
|
|
89
|
+
}, {
|
|
90
|
+
version: string;
|
|
91
|
+
plugin: string;
|
|
92
|
+
}>, "many">>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
capabilities: string[];
|
|
95
|
+
register: string;
|
|
96
|
+
apiVersion: string;
|
|
97
|
+
namespace: string;
|
|
98
|
+
dependsOn: {
|
|
99
|
+
version: string;
|
|
100
|
+
plugin: string;
|
|
101
|
+
}[];
|
|
102
|
+
browxaiVersion?: string | undefined;
|
|
103
|
+
trust?: "kalebtec" | "community" | "local" | undefined;
|
|
104
|
+
}, {
|
|
105
|
+
register: string;
|
|
106
|
+
apiVersion: string;
|
|
107
|
+
namespace: string;
|
|
108
|
+
capabilities?: string[] | undefined;
|
|
109
|
+
browxaiVersion?: string | undefined;
|
|
110
|
+
trust?: "kalebtec" | "community" | "local" | undefined;
|
|
111
|
+
dependsOn?: {
|
|
112
|
+
version: string;
|
|
113
|
+
plugin: string;
|
|
114
|
+
}[] | undefined;
|
|
115
|
+
}>;
|
|
116
|
+
export type BrowxaiManifestData = z.infer<typeof browxaiManifestSchema>;
|
|
117
|
+
/**
|
|
118
|
+
* Fully-resolved plugin manifest the runtime works with. Composes the
|
|
119
|
+
* Zod-validated `browxai` field with metadata read off the rest of
|
|
120
|
+
* `package.json` (name, version, description), the absolute path the
|
|
121
|
+
* plugin was loaded from, and the resolved trust tier (CLI-overridden
|
|
122
|
+
* for community / local installs).
|
|
123
|
+
*/
|
|
124
|
+
export interface ResolvedManifest {
|
|
125
|
+
/** npm package name (`package.json#name`). */
|
|
126
|
+
readonly name: string;
|
|
127
|
+
/** npm semver of the installed version (`package.json#version`). */
|
|
128
|
+
readonly version: string;
|
|
129
|
+
/** Optional human-readable description. */
|
|
130
|
+
readonly description?: string;
|
|
131
|
+
/** Absolute path the plugin was loaded from. */
|
|
132
|
+
readonly path: string;
|
|
133
|
+
/** Absolute path to the JS entry file (resolved from `register`). */
|
|
134
|
+
readonly entryPath: string;
|
|
135
|
+
/** Resolved trust tier (CLI tags community / local installs). */
|
|
136
|
+
readonly trust: TrustTier;
|
|
137
|
+
/** Parsed + validated `package.json#browxai` field. */
|
|
138
|
+
readonly browxai: BrowxaiManifestData;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The plugin-runtime API contract version. Plugin manifests declare
|
|
142
|
+
* `apiVersion`; the runtime checks plugin.apiVersion startsWith the
|
|
143
|
+
* runtime's major.
|
|
144
|
+
*
|
|
145
|
+
* ships 1.0 — the first stable runtime contract. Breaking
|
|
146
|
+
* changes here are deferred to a major-version bump.
|
|
147
|
+
*/
|
|
148
|
+
export declare const RUNTIME_API_VERSION = "1.0.0";
|
|
149
|
+
/**
|
|
150
|
+
* Reserved namespaces a plugin may NOT claim. Core browxai tools live in
|
|
151
|
+
* the implicit-root namespace; reserving the obvious aliases here
|
|
152
|
+
* prevents an early plugin from squatting them.
|
|
153
|
+
*/
|
|
154
|
+
export declare const RESERVED_NAMESPACES: ReadonlySet<string>;
|
|
155
|
+
/**
|
|
156
|
+
* Validate a parsed `package.json#browxai` field. Returns the typed
|
|
157
|
+
* manifest data on success; throws on validation failure. Caller maps
|
|
158
|
+
* the throw to a `load-error` status (so server start continues).
|
|
159
|
+
*/
|
|
160
|
+
export declare function parseManifestField(raw: unknown): BrowxaiManifestData;
|
|
161
|
+
/**
|
|
162
|
+
* Lightweight semver-major compatibility check used at apiVersion time.
|
|
163
|
+
*
|
|
164
|
+
* The runtime advertises {@link RUNTIME_API_VERSION}; a plugin manifest
|
|
165
|
+
* carries an apiVersion. We don't pull in a full semver lib — the check
|
|
166
|
+
* is "the plugin's apiVersion has the same MAJOR as the runtime, and the
|
|
167
|
+
* plugin's MINOR is ≤ runtime's MINOR". This is the standard semver
|
|
168
|
+
* "library guarantees backwards compat within a major" assumption and
|
|
169
|
+
* is enough for the contract.
|
|
170
|
+
*
|
|
171
|
+
* A plugin built for `1.0.0` works under runtime `1.5.0`; a plugin built
|
|
172
|
+
* for `1.5.0` does NOT work under runtime `1.0.0` (newer API surface).
|
|
173
|
+
* A plugin built for `2.0.0` does NOT work under runtime `1.x` (major
|
|
174
|
+
* gap).
|
|
175
|
+
*/
|
|
176
|
+
export declare function isApiVersionCompatible(pluginApiVersion: string, runtimeApiVersion?: string): boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Match a plugin's installed version against a semver range from a
|
|
179
|
+
* `dependsOn[].version` entry. Kept dep-free; supports the common
|
|
180
|
+
* shapes (`^x.y.z`, `~x.y.z`, exact, `>=x.y.z`, `*`).
|
|
181
|
+
*/
|
|
182
|
+
export declare function satisfiesRange(version: string, range: string): boolean;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
// Plugin manifest shape + validator.
|
|
2
|
+
//
|
|
3
|
+
// Every browxai plugin ships a `"browxai"` field on its `package.json`
|
|
4
|
+
// (the standard npm package-metadata file). That field carries the
|
|
5
|
+
// machine-readable contract the runtime resolves against — entry point,
|
|
6
|
+
// tool namespace, declared capabilities, declared dependencies on other
|
|
7
|
+
// plugins, trust tier, the API version range the plugin was built for.
|
|
8
|
+
//
|
|
9
|
+
// Why a sub-field on package.json rather than a sidecar JSON file?
|
|
10
|
+
// - npm/pnpm already keep `package.json` honest at install time.
|
|
11
|
+
// - Adopters can `pnpm add` a plugin from npm without an out-of-band
|
|
12
|
+
// "browxai-config" download step.
|
|
13
|
+
// - The conventional `package.json` `version` + `name` fields are the
|
|
14
|
+
// canonical version + identity the runtime trusts.
|
|
15
|
+
//
|
|
16
|
+
// The runtime validates the field with the Zod schema in this module. A
|
|
17
|
+
// failing validation marks the plugin `load-error` with a structured
|
|
18
|
+
// message — server start does NOT abort because of one bad plugin.
|
|
19
|
+
import { z } from "zod";
|
|
20
|
+
/**
|
|
21
|
+
* Trust tiers. The host operator is the only party who can configure which
|
|
22
|
+
* plugins to enable (via plugins.json), so trust is an advisory signal —
|
|
23
|
+
* the runtime treats `kalebtec` / `community` / `local` identically at
|
|
24
|
+
* capability-gate / call-graph-enforcement time. Surfaced on `plugins_list`
|
|
25
|
+
* so the operator can audit.
|
|
26
|
+
*
|
|
27
|
+
* - `kalebtec` — published by Kalebtec under `@browxai/plugin-*`.
|
|
28
|
+
* Reference plugins; same release/CI hygiene as the host.
|
|
29
|
+
* - `community` — third-party npm packages (`browxai-plugin-*` or
|
|
30
|
+
* `@<org>/browxai-plugin-*`). Adopter installs by name.
|
|
31
|
+
* - `local` — file-path-installed plugins. Used during plugin
|
|
32
|
+
* development (`browxai plugin install file:./my-plugin/`).
|
|
33
|
+
*/
|
|
34
|
+
export const TRUST_TIERS = ["kalebtec", "community", "local"];
|
|
35
|
+
/**
|
|
36
|
+
* Inter-plugin dependency. `plugin` is the npm package name of another
|
|
37
|
+
* browxai plugin this one composes with. `version` is a semver range the
|
|
38
|
+
* dep must satisfy (e.g. `^1.0.0`). Matched against the dep plugin's
|
|
39
|
+
* `package.json#version` at load-time.
|
|
40
|
+
*/
|
|
41
|
+
export const dependsOnEntrySchema = z.object({
|
|
42
|
+
plugin: z.string().min(1, "dependsOn[].plugin: must be a non-empty npm package name"),
|
|
43
|
+
version: z
|
|
44
|
+
.string()
|
|
45
|
+
.min(1, "dependsOn[].version: must be a non-empty semver range, e.g. '^1.0.0'"),
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* The full plugin manifest, as embedded under `package.json#browxai`.
|
|
49
|
+
*
|
|
50
|
+
* apiVersion semver of the plugin-runtime contract the plugin codes
|
|
51
|
+
* against. The runtime advertises its own supported range
|
|
52
|
+
* (see RUNTIME_API_VERSION below); a plugin whose
|
|
53
|
+
* apiVersion does not satisfy is rejected at load-time.
|
|
54
|
+
*
|
|
55
|
+
* browxaiVersion semver range of the host browxai package the plugin
|
|
56
|
+
* was tested against. Advisory — surfaced in
|
|
57
|
+
* plugins_list, but a mismatch only warns (so a
|
|
58
|
+
* conservative range doesn't lock out a known-good
|
|
59
|
+
* host that already shipped). Authors can tighten this
|
|
60
|
+
* if needed.
|
|
61
|
+
*
|
|
62
|
+
* namespace MANDATORY tool prefix. Every tool a plugin registers
|
|
63
|
+
* is `<namespace>.<tool>`. The runtime rejects any
|
|
64
|
+
* other shape. Namespaces must be globally unique
|
|
65
|
+
* across the loaded plugin set — two plugins claiming
|
|
66
|
+
* `figma` both fail with a clear error.
|
|
67
|
+
*
|
|
68
|
+
* register Relative path to the JS module the runtime imports.
|
|
69
|
+
* The module must export a `register(api)` function
|
|
70
|
+
* (default export OR named `register`).
|
|
71
|
+
*
|
|
72
|
+
* capabilities Capabilities the plugin's tools need. Subset of the
|
|
73
|
+
* server's enabled set at load time. Mismatch →
|
|
74
|
+
* plugin disabled (status: disabled-by-capability-mismatch),
|
|
75
|
+
* server still starts. Empty array means "no
|
|
76
|
+
* capability-gated tools" — perfectly fine.
|
|
77
|
+
*
|
|
78
|
+
* trust Trust tier. The CLI tags this based on the install
|
|
79
|
+
* source; authors may set it on `kalebtec` packages but
|
|
80
|
+
* the CLI overrides on community / local installs.
|
|
81
|
+
*
|
|
82
|
+
* dependsOn Other browxai plugins this one calls into. The
|
|
83
|
+
* runtime composes these into a directed graph;
|
|
84
|
+
* cycles abort startup; call-graph enforcement at
|
|
85
|
+
* runtime refuses calls outside the declared
|
|
86
|
+
* transitive set.
|
|
87
|
+
*/
|
|
88
|
+
export const browxaiManifestSchema = z.object({
|
|
89
|
+
apiVersion: z.string().min(1, "browxai.apiVersion: missing"),
|
|
90
|
+
browxaiVersion: z.string().min(1, "browxai.browxaiVersion: missing").optional(),
|
|
91
|
+
namespace: z
|
|
92
|
+
.string()
|
|
93
|
+
.min(1, "browxai.namespace: missing")
|
|
94
|
+
// Lowercase identifier — must not collide with reserved core
|
|
95
|
+
// namespaces. `_` allowed; no `.`/`:` (those are tool-name separators).
|
|
96
|
+
.regex(/^[a-z][a-z0-9_]*$/, "browxai.namespace: must match /^[a-z][a-z0-9_]*$/ (lowercase, alphanumeric + underscore, starts with a letter)"),
|
|
97
|
+
register: z.string().min(1, "browxai.register: missing entry-point path"),
|
|
98
|
+
capabilities: z.array(z.string()).default([]),
|
|
99
|
+
trust: z.enum(TRUST_TIERS).optional(),
|
|
100
|
+
dependsOn: z.array(dependsOnEntrySchema).default([]),
|
|
101
|
+
});
|
|
102
|
+
/**
|
|
103
|
+
* The plugin-runtime API contract version. Plugin manifests declare
|
|
104
|
+
* `apiVersion`; the runtime checks plugin.apiVersion startsWith the
|
|
105
|
+
* runtime's major.
|
|
106
|
+
*
|
|
107
|
+
* ships 1.0 — the first stable runtime contract. Breaking
|
|
108
|
+
* changes here are deferred to a major-version bump.
|
|
109
|
+
*/
|
|
110
|
+
export const RUNTIME_API_VERSION = "1.0.0";
|
|
111
|
+
/**
|
|
112
|
+
* Reserved namespaces a plugin may NOT claim. Core browxai tools live in
|
|
113
|
+
* the implicit-root namespace; reserving the obvious aliases here
|
|
114
|
+
* prevents an early plugin from squatting them.
|
|
115
|
+
*/
|
|
116
|
+
export const RESERVED_NAMESPACES = new Set([
|
|
117
|
+
"browxai",
|
|
118
|
+
"browx",
|
|
119
|
+
"core",
|
|
120
|
+
"system",
|
|
121
|
+
"plugins",
|
|
122
|
+
]);
|
|
123
|
+
/**
|
|
124
|
+
* Validate a parsed `package.json#browxai` field. Returns the typed
|
|
125
|
+
* manifest data on success; throws on validation failure. Caller maps
|
|
126
|
+
* the throw to a `load-error` status (so server start continues).
|
|
127
|
+
*/
|
|
128
|
+
export function parseManifestField(raw) {
|
|
129
|
+
const parsed = browxaiManifestSchema.parse(raw);
|
|
130
|
+
if (RESERVED_NAMESPACES.has(parsed.namespace)) {
|
|
131
|
+
throw new Error(`browxai.namespace: "${parsed.namespace}" is reserved for the core surface. ` +
|
|
132
|
+
`Pick a project-unique namespace (e.g. "${parsed.namespace}_${Math.floor(Math.random() * 1000)}").`);
|
|
133
|
+
}
|
|
134
|
+
return parsed;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Lightweight semver-major compatibility check used at apiVersion time.
|
|
138
|
+
*
|
|
139
|
+
* The runtime advertises {@link RUNTIME_API_VERSION}; a plugin manifest
|
|
140
|
+
* carries an apiVersion. We don't pull in a full semver lib — the check
|
|
141
|
+
* is "the plugin's apiVersion has the same MAJOR as the runtime, and the
|
|
142
|
+
* plugin's MINOR is ≤ runtime's MINOR". This is the standard semver
|
|
143
|
+
* "library guarantees backwards compat within a major" assumption and
|
|
144
|
+
* is enough for the contract.
|
|
145
|
+
*
|
|
146
|
+
* A plugin built for `1.0.0` works under runtime `1.5.0`; a plugin built
|
|
147
|
+
* for `1.5.0` does NOT work under runtime `1.0.0` (newer API surface).
|
|
148
|
+
* A plugin built for `2.0.0` does NOT work under runtime `1.x` (major
|
|
149
|
+
* gap).
|
|
150
|
+
*/
|
|
151
|
+
export function isApiVersionCompatible(pluginApiVersion, runtimeApiVersion = RUNTIME_API_VERSION) {
|
|
152
|
+
const a = parseVersion(pluginApiVersion);
|
|
153
|
+
const b = parseVersion(runtimeApiVersion);
|
|
154
|
+
if (!a || !b)
|
|
155
|
+
return false;
|
|
156
|
+
if (a.major !== b.major)
|
|
157
|
+
return false;
|
|
158
|
+
if (a.minor > b.minor)
|
|
159
|
+
return false;
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
function parseVersion(s) {
|
|
163
|
+
// Tolerate leading `^` / `~` / `>=` / `=` so adopters can paste a
|
|
164
|
+
// semver-range string into apiVersion. The runtime ignores the operator
|
|
165
|
+
// and treats the rest as a concrete version.
|
|
166
|
+
const stripped = s.replace(/^(\^|~|>=|<=|=|>|<)/, "").trim();
|
|
167
|
+
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(stripped);
|
|
168
|
+
if (!m)
|
|
169
|
+
return null;
|
|
170
|
+
return { major: Number(m[1]), minor: Number(m[2]), patch: Number(m[3]) };
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Match a plugin's installed version against a semver range from a
|
|
174
|
+
* `dependsOn[].version` entry. Kept dep-free; supports the common
|
|
175
|
+
* shapes (`^x.y.z`, `~x.y.z`, exact, `>=x.y.z`, `*`).
|
|
176
|
+
*/
|
|
177
|
+
export function satisfiesRange(version, range) {
|
|
178
|
+
const trimmed = range.trim();
|
|
179
|
+
if (trimmed === "*" || trimmed === "")
|
|
180
|
+
return true;
|
|
181
|
+
const v = parseVersion(version);
|
|
182
|
+
if (!v)
|
|
183
|
+
return false;
|
|
184
|
+
if (trimmed.startsWith("^")) {
|
|
185
|
+
const r = parseVersion(trimmed.slice(1));
|
|
186
|
+
if (!r)
|
|
187
|
+
return false;
|
|
188
|
+
if (v.major !== r.major)
|
|
189
|
+
return false;
|
|
190
|
+
if (v.major === 0) {
|
|
191
|
+
// ^0.x.y locks minor too (npm convention).
|
|
192
|
+
if (v.minor !== r.minor)
|
|
193
|
+
return false;
|
|
194
|
+
return v.patch >= r.patch || (v.patch === r.patch && true);
|
|
195
|
+
}
|
|
196
|
+
return v.minor > r.minor || (v.minor === r.minor && v.patch >= r.patch);
|
|
197
|
+
}
|
|
198
|
+
if (trimmed.startsWith("~")) {
|
|
199
|
+
const r = parseVersion(trimmed.slice(1));
|
|
200
|
+
if (!r)
|
|
201
|
+
return false;
|
|
202
|
+
if (v.major !== r.major || v.minor !== r.minor)
|
|
203
|
+
return false;
|
|
204
|
+
return v.patch >= r.patch;
|
|
205
|
+
}
|
|
206
|
+
if (trimmed.startsWith(">=")) {
|
|
207
|
+
const r = parseVersion(trimmed.slice(2).trim());
|
|
208
|
+
if (!r)
|
|
209
|
+
return false;
|
|
210
|
+
return (v.major > r.major ||
|
|
211
|
+
(v.major === r.major && v.minor > r.minor) ||
|
|
212
|
+
(v.major === r.major && v.minor === r.minor && v.patch >= r.patch));
|
|
213
|
+
}
|
|
214
|
+
// Exact (with or without leading `=`).
|
|
215
|
+
const r = parseVersion(trimmed.replace(/^=/, ""));
|
|
216
|
+
if (!r)
|
|
217
|
+
return false;
|
|
218
|
+
return v.major === r.major && v.minor === r.minor && v.patch === r.patch;
|
|
219
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Package managers the plugin CLI can drive. */
|
|
2
|
+
export type PackageManager = "pnpm" | "npm";
|
|
3
|
+
/** The pnpm-flavoured operations the CLI performs, mapped per manager. */
|
|
4
|
+
export type PmOperation = "add" | "remove" | "update" | "install";
|
|
5
|
+
/** One package manager's integration surface. */
|
|
6
|
+
export interface PackageManagerAdapter {
|
|
7
|
+
/** The CLI binary name (also the probe target and the spawn command). */
|
|
8
|
+
readonly name: PackageManager;
|
|
9
|
+
/** Probe order — the lowest priority that is on PATH wins. pnpm (0) is the
|
|
10
|
+
* project's declared manager; npm (1) is the adopter fallback. */
|
|
11
|
+
readonly priority: number;
|
|
12
|
+
/** The manager's verb for each browxai plugin operation. */
|
|
13
|
+
readonly verbs: Record<PmOperation, string>;
|
|
14
|
+
}
|
|
15
|
+
/** Register a package-manager adapter. Add-only: a new manager is one
|
|
16
|
+
* `registerPackageManager(...)` call. */
|
|
17
|
+
export declare function registerPackageManager(adapter: PackageManagerAdapter): void;
|
|
18
|
+
/** The registered adapter for a manager, or `undefined` when none is registered. */
|
|
19
|
+
export declare function packageManagerAdapter(name: PackageManager): PackageManagerAdapter | undefined;
|
|
20
|
+
/** All registered adapters, in ascending probe priority — the order
|
|
21
|
+
* `detectPackageManager` walks when probing PATH. */
|
|
22
|
+
export declare function packageManagerAdaptersByPriority(): PackageManagerAdapter[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Package-manager adapters (RFC 0004 P4 / D6) — the add-only registry that
|
|
2
|
+
// replaces the `PM_VERBS` record (`Record<PackageManager, Record<PmOperation,
|
|
3
|
+
// string>>`). Each supported manager is ONE `PackageManagerAdapter`: its CLI
|
|
4
|
+
// name, its probe priority (lower wins when several are on PATH), and the verb
|
|
5
|
+
// it uses for each browxai plugin operation. Adding `yarn` is one adapter
|
|
6
|
+
// registered here — no edit to `pmArgs` / `detectPackageManager` / the CLI.
|
|
7
|
+
//
|
|
8
|
+
// Behavior-preservation: the pnpm/npm adapters carry the EXACT verb strings the
|
|
9
|
+
// old `PM_VERBS` did, and the probe priority preserves the old
|
|
10
|
+
// "pnpm wins, npm is the fallback" order — so `pmArgs(...)` and
|
|
11
|
+
// `detectPackageManager(...)` return identical results.
|
|
12
|
+
const ADAPTERS = new Map();
|
|
13
|
+
/** Register a package-manager adapter. Add-only: a new manager is one
|
|
14
|
+
* `registerPackageManager(...)` call. */
|
|
15
|
+
export function registerPackageManager(adapter) {
|
|
16
|
+
ADAPTERS.set(adapter.name, adapter);
|
|
17
|
+
}
|
|
18
|
+
/** The registered adapter for a manager, or `undefined` when none is registered. */
|
|
19
|
+
export function packageManagerAdapter(name) {
|
|
20
|
+
return ADAPTERS.get(name);
|
|
21
|
+
}
|
|
22
|
+
/** All registered adapters, in ascending probe priority — the order
|
|
23
|
+
* `detectPackageManager` walks when probing PATH. */
|
|
24
|
+
export function packageManagerAdaptersByPriority() {
|
|
25
|
+
return [...ADAPTERS.values()].sort((a, b) => a.priority - b.priority);
|
|
26
|
+
}
|
|
27
|
+
// pnpm — the project's native manager (wins detection). Verbs are the canonical
|
|
28
|
+
// pnpm spelling the CLI was written against.
|
|
29
|
+
registerPackageManager({
|
|
30
|
+
name: "pnpm",
|
|
31
|
+
priority: 0,
|
|
32
|
+
verbs: { add: "add", remove: "remove", update: "update", install: "install" },
|
|
33
|
+
});
|
|
34
|
+
// npm — the fallback for `npm install -g browxai` adopters with no pnpm on PATH.
|
|
35
|
+
// `add`→`install`, `remove`→`uninstall`; `update`/`install` keep their names.
|
|
36
|
+
registerPackageManager({
|
|
37
|
+
name: "npm",
|
|
38
|
+
priority: 1,
|
|
39
|
+
verbs: { add: "install", remove: "uninstall", update: "update", install: "install" },
|
|
40
|
+
});
|