UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

30 lines (29 loc) • 1.51 kB
import { l as getRuntimeConfigSourceSnapshot } from "./runtime-snapshot-CifcQ780.mjs"; import "./runtime-config-snapshot-DPEZoubb.mjs"; import { i as resolveBrowserConfig, s as resolveProfile } from "./config-HztiUSlV.mjs"; import { t as getBrowserProfileCapabilities } from "./profile-capabilities-B5_4l3yO.mjs"; import { o as isChromeReachable } from "./chrome-DbIHmS_R.mjs"; import { t as resolveBrowserExecutableForPlatform } from "./chrome.executables-BuNK6O5J.mjs"; import { r as getBrowserControlState } from "./browser-control-state-B-F0BJmc.mjs"; //#region extensions/browser/src/browser-host-availability.ts /** Inspect local capability before routing, without launching or replaying a browser action. */ async function isBrowserHostAvailable(config, profileName) { const source = getRuntimeConfigSourceSnapshot() ?? config; const resolved = resolveBrowserConfig(source.browser, source); if (!resolved.enabled) return false; const profile = resolveProfile(resolved, profileName ?? resolved.defaultProfile); if (!profile) return false; if (getBrowserProfileCapabilities(profile).mode !== "local-managed" || profile.attachOnly) return true; if (getBrowserControlState()?.profiles.get(profile.name)?.running) return true; try { if (resolveBrowserExecutableForPlatform({ ...resolved, executablePath: profile.executablePath }, process.platform)) return true; } catch { return true; } return await isChromeReachable(profile.cdpUrl); } //#endregion export { isBrowserHostAvailable };