UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

35 lines (34 loc) 1.66 kB
import { s as normalizeOptionalLowercaseString } from "../../string-coerce-mnp54Vah.js"; import { c as isRecord } from "../../utils-CCC-BEJH.js"; import "../../string-coerce-runtime-CEGJWkQ_.js"; import { t as definePluginEntry } from "../../plugin-entry-C7DUzV0e.js"; import "../../record-shared-BdOR6CcJ.js"; //#region extensions/browser/setup-api.ts function listContainsBrowser(value) { return Array.isArray(value) && value.some((entry) => normalizeOptionalLowercaseString(entry) === "browser"); } function toolPolicyReferencesBrowser(value) { return isRecord(value) && (listContainsBrowser(value.allow) || listContainsBrowser(value.alsoAllow)); } function hasBrowserToolReference(config) { if (toolPolicyReferencesBrowser(config.tools)) return true; const agentList = config.agents?.list; return Array.isArray(agentList) ? agentList.some((entry) => isRecord(entry) && toolPolicyReferencesBrowser(entry.tools)) : false; } /** Setup entry that detects existing Browser configuration references. */ var setup_api_default = definePluginEntry({ id: "browser", name: "Browser Setup", description: "Lightweight Browser setup hooks", register(api) { api.registerAutoEnableProbe(({ config }) => { if (config.browser?.enabled === false || config.plugins?.entries?.browser?.enabled === false) return null; if (Object.hasOwn(config, "browser")) return "browser configured"; if (config.plugins?.entries && Object.hasOwn(config.plugins.entries, "browser")) return "browser plugin configured"; if (hasBrowserToolReference(config)) return "browser tool referenced"; return null; }); } }); //#endregion export { setup_api_default as default };