openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
24 lines (23 loc) • 1.29 kB
JavaScript
import { y as uniqueStrings } from "./string-normalization-D6DKCpwE.mjs";
import "./message-channel-constants-B3vfipkP.mjs";
import { t as CHANNEL_IDS } from "./ids-DY4OsKJc.mjs";
import { n as normalizeMessageChannel } from "./message-channel-core-D9WI2Y8r.mjs";
import { i as listRegisteredChannelPluginIds } from "./registry-DvTPWA3B.mjs";
//#region src/utils/message-channel-normalize.ts
const listDeliverableMessageChannels = () => uniqueStrings([...CHANNEL_IDS, ...listRegisteredChannelPluginIds()]);
function isGatewayMessageChannel(value) {
return value === "webchat" || isDeliverableMessageChannel(value);
}
function isDeliverableMessageChannel(value) {
return CHANNEL_IDS.some((channelId) => channelId === value) || listRegisteredChannelPluginIds().includes(value);
}
function resolveGatewayMessageChannel(raw) {
const normalized = normalizeMessageChannel(raw);
if (!normalized) return;
return isGatewayMessageChannel(normalized) ? normalized : void 0;
}
function resolveMessageChannel(primary, fallback) {
return normalizeMessageChannel(primary) ?? normalizeMessageChannel(fallback);
}
//#endregion
export { resolveMessageChannel as a, resolveGatewayMessageChannel as i, isGatewayMessageChannel as n, listDeliverableMessageChannels as r, isDeliverableMessageChannel as t };