openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
35 lines (34 loc) • 1.81 kB
JavaScript
import { c as normalizeOptionalLowercaseString } from "./string-coerce-CCIiB4H7.mjs";
import { t as normalizeAnyChannelId } from "./registry-normalize-guW5_4yo.mjs";
import { n as getLoadedChannelPlugin } from "./registry-ByqVE5S3.mjs";
import "./plugins-BoMiRtiY.mjs";
import { r as resolveReadOnlyChannelCommandDefaults } from "./read-only-command-defaults-D1X0yxjh.mjs";
//#region src/config/commands.ts
/** Resolves native skill exposure for a provider, with provider config overriding global config. */
function resolveNativeSkillsEnabled(e) {
return resolveNativeCommandSetting(e, "nativeSkills");
}
/** Resolves native command exposure for a provider, with provider config overriding global config. */
function resolveNativeCommandsEnabled(e) {
return resolveNativeCommandSetting(e, "native");
}
function resolveNativeCommandSetting(e, t) {
const { providerId: n, providerSetting: r, globalSetting: i, ...a } = e;
const o = r === void 0 ? i : r;
if (typeof o === "boolean") return o;
const s = normalizeAnyChannelId(n) ?? normalizeOptionalLowercaseString(n);
if (!s) return false;
if (typeof a.autoDefault === "boolean") return a.autoDefault;
const c = getLoadedChannelPlugin(s)?.commands ?? (a.config ? resolveReadOnlyChannelCommandDefaults(s, {
...a,
config: a.config
}) : void 0);
return t === "native" ? c?.nativeCommandsAutoEnabled === true : c?.nativeSkillsAutoEnabled === true;
}
/** Returns true only when native commands are explicitly disabled by provider or inherited global config. */
function isNativeCommandsExplicitlyDisabled(e) {
const { providerSetting: t, globalSetting: n } = e;
return t === false || t === void 0 && n === false;
}
//#endregion
export { resolveNativeCommandsEnabled as n, resolveNativeSkillsEnabled as r, isNativeCommandsExplicitlyDisabled as t };