openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
31 lines (30 loc) • 1.49 kB
JavaScript
import { c as getRuntimeConfigSourceSnapshot } from "./runtime-snapshot-WbwbY5b7.mjs";
import "./runtime-config-snapshot-Dy0VFqWf.mjs";
import { i as resolveBrowserConfig, o as resolveManagedBrowserHeadlessMode, s as resolveProfile } from "./config-ccOD-Wrr.mjs";
import { t as getBrowserProfileCapabilities } from "./profile-capabilities-C9i07NhJ.mjs";
import { o as isChromeReachable } from "./chrome-DDJiLaJI.mjs";
import { i as resolveBrowserExecutableForPlatform } from "./chrome.executables-BXILxwVX.mjs";
import { r as getBrowserControlState } from "./browser-control-state-DGe-q2t-.mjs";
//#region extensions/browser/src/browser-host-availability.ts
/** Inspect local capability before routing, without launching or replaying a browser action. */
async function isBrowserHostAvailable(e, t) {
const n = getRuntimeConfigSourceSnapshot() ?? e;
const r = resolveBrowserConfig(n.browser, n);
if (!r.enabled) return false;
const i = resolveProfile(r, t ?? r.defaultProfile);
if (!i) return false;
if (getBrowserProfileCapabilities(i).mode !== "local-managed" || i.attachOnly) return true;
if (getBrowserControlState()?.profiles.get(i.name)?.running) return true;
try {
if (resolveBrowserExecutableForPlatform({
...r,
executablePath: i.executablePath,
headless: resolveManagedBrowserHeadlessMode(r, i).headless
}, process.platform)) return true;
} catch {
return true;
}
return await isChromeReachable(i.cdpUrl);
}
//#endregion
export { isBrowserHostAvailable };