fix: unify inbound sender labels

This commit is contained in:
Peter Steinberger
2026-01-17 05:21:02 +00:00
parent 572e04d5fb
commit f7089cde54
20 changed files with 587 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
import { resolveMessagePrefix } from "../../../agents/identity.js";
import { formatAgentEnvelope } from "../../../auto-reply/envelope.js";
import { formatInboundEnvelope } from "../../../auto-reply/envelope.js";
import type { loadConfig } from "../../../config/config.js";
import type { WebInboundMsg } from "../types.js";
@@ -26,10 +26,16 @@ export function buildInboundLine(params: {
const baseLine = `${prefixStr}${msg.body}${replyContext ? `\n\n${replyContext}` : ""}`;
// Wrap with standardized envelope for the agent.
return formatAgentEnvelope({
return formatInboundEnvelope({
channel: "WhatsApp",
from: msg.chatType === "group" ? msg.from : msg.from?.replace(/^whatsapp:/, ""),
timestamp: msg.timestamp,
body: baseLine,
chatType: msg.chatType,
sender: {
name: msg.senderName,
e164: msg.senderE164,
id: msg.senderJid,
},
});
}