UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

19 lines (18 loc) • 979 B
import { c as normalizeOptionalLowercaseString, l as normalizeOptionalString } from "./string-coerce-CCIiB4H7.mjs"; import { n as getLoadedChannelPluginById } from "./registry-loaded-NYWUyLLC.mjs"; //#region src/auto-reply/reply/channel-context.ts /** Resolves the command surface channel from inbound context and command state. */ function resolveCommandSurfaceChannel(e) { const t = e.ctx.OriginatingChannel ?? e.command.channel ?? e.ctx.Surface ?? e.ctx.Provider; return normalizeOptionalLowercaseString(t) ?? ""; } /** Resolves command account id, falling back to plugin default account config. */ function resolveChannelAccountId(e) { const t = normalizeOptionalString(e.ctx.AccountId) ?? ""; if (t) return t; const n = resolveCommandSurfaceChannel(e); const r = getLoadedChannelPluginById(n); return normalizeOptionalString(r?.config.defaultAccountId?.(e.cfg)) || "default"; } //#endregion export { resolveCommandSurfaceChannel as n, resolveChannelAccountId as t };