openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
24 lines (23 loc) • 1.12 kB
JavaScript
import { c as normalizeOptionalLowercaseString } from "./string-coerce-1VuiLaaR.mjs";
import { t as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-constants-B3vfipkP.mjs";
import { i as normalizeChatChannelId } from "./ids-DY4OsKJc.mjs";
import { t as normalizeAnyChannelId } from "./registry-normalize-DKVgg-js.mjs";
//#region src/utils/message-channel-core.ts
/**
* Built-in aliases normalize through channel ids, while plugin-owned channel ids
* stay accepted even when core has no bundled alias for them.
*/
function normalizeMessageChannel(raw) {
const normalized = normalizeOptionalLowercaseString(raw);
if (!normalized) return;
if (normalized === "webchat") return INTERNAL_MESSAGE_CHANNEL;
const builtIn = normalizeChatChannelId(normalized);
if (builtIn) return builtIn;
return normalizeAnyChannelId(normalized) ?? normalized;
}
function isNormalizedMessageChannel(value) {
const normalized = normalizeMessageChannel(value);
return normalized !== void 0 && normalized !== "webchat" && normalized === value;
}
//#endregion
export { normalizeMessageChannel as n, isNormalizedMessageChannel as t };