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-De_QxZI9.mjs"; import "./runtime-config-snapshot--IkldAgP.mjs"; import { i as resolveBrowserConfig, s as resolveProfile } from "./config-NGx7eSU6.mjs"; import { t as getBrowserProfileCapabilities } from "./profile-capabilities-DXuiwiC6.mjs"; import { o as isChromeReachable } from "./chrome-IDR7c0-o.mjs"; import { t as resolveBrowserExecutableForPlatform } from "./chrome.executables-BVeaoQFk.mjs"; import { r as getBrowserControlState } from "./browser-control-state-C71zi1IJ.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 };