UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

47 lines (46 loc) 2.2 kB
import { c as normalizeOptionalLowercaseString } from "./string-coerce-CIXf7egm.js"; import { a as normalizeChannelId, n as getLoadedChannelPlugin } from "./registry-Cz6cv4VC.js"; import "./plugins-Cozj1Enf.js"; import { i as resolveReadOnlyChannelCommandDefaults } from "./read-only-command-defaults-CUJu-1dU.js"; //#region src/config/commands.ts function resolveAutoDefault(providerId, kind, options) { const id = normalizeChannelId(providerId) ?? normalizeOptionalLowercaseString(providerId); if (!id) return false; if (typeof options?.autoDefault === "boolean") return options.autoDefault; const commandDefaults = getLoadedChannelPlugin(id)?.commands ?? (options?.config ? resolveReadOnlyChannelCommandDefaults(id, { ...options, config: options.config }) : void 0); if (kind === "native") return commandDefaults?.nativeCommandsAutoEnabled === true; return commandDefaults?.nativeSkillsAutoEnabled === true; } /** Resolves native skill exposure for a provider, with provider config overriding global config. */ function resolveNativeSkillsEnabled(params) { return resolveNativeCommandSetting({ ...params, kind: "nativeSkills" }); } /** Resolves native command exposure for a provider, with provider config overriding global config. */ function resolveNativeCommandsEnabled(params) { return resolveNativeCommandSetting({ ...params, kind: "native" }); } function resolveNativeCommandSetting(params) { const { providerId, providerSetting, globalSetting, kind = "native", ...options } = params; const setting = providerSetting === void 0 ? globalSetting : providerSetting; if (setting === true) return true; if (setting === false) return false; return resolveAutoDefault(providerId, kind, options); } /** Returns true only when native commands are explicitly disabled by provider or inherited global config. */ function isNativeCommandsExplicitlyDisabled(params) { const { providerSetting, globalSetting } = params; if (providerSetting === false) return true; if (providerSetting === void 0) return globalSetting === false; return false; } //#endregion export { resolveNativeCommandsEnabled as n, resolveNativeSkillsEnabled as r, isNativeCommandsExplicitlyDisabled as t };