openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
33 lines (32 loc) • 1.27 kB
JavaScript
import { l as normalizeOptionalString } from "./string-coerce-CIXf7egm.js";
import { n as resolveAgentIdentity } from "./identity-L3YWE18q.js";
import { t as resolveAgentAvatar } from "./identity-avatar-BaF1nma_.js";
//#region src/infra/outbound/identity.ts
/** Trims outbound identity fields and drops empty identity payloads. */
function normalizeOutboundIdentity(identity) {
if (!identity) return;
const name = normalizeOptionalString(identity.name);
const avatarUrl = normalizeOptionalString(identity.avatarUrl);
const emoji = normalizeOptionalString(identity.emoji);
const theme = normalizeOptionalString(identity.theme);
if (!name && !avatarUrl && !emoji && !theme) return;
return {
name,
avatarUrl,
emoji,
theme
};
}
/** Resolves an agent's configured identity into channel-safe outbound metadata. */
function resolveAgentOutboundIdentity(cfg, agentId) {
const agentIdentity = resolveAgentIdentity(cfg, agentId);
const avatar = resolveAgentAvatar(cfg, agentId);
return normalizeOutboundIdentity({
name: agentIdentity?.name,
emoji: agentIdentity?.emoji,
avatarUrl: avatar.kind === "remote" ? avatar.url : void 0,
theme: agentIdentity?.theme
});
}
//#endregion
export { resolveAgentOutboundIdentity as n, normalizeOutboundIdentity as t };