mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 04:15:48 -06:00
a2a68d154b
* fix(agent): honor recipient session routing Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com> Co-authored-by: pingfanfan <pingfan.work@gmail.com> * fix(agent): preserve canonical recipient routes * fix(agent): require exact recipient routes Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com> Co-authored-by: pingfanfan <pingfan.work@gmail.com> * fix(agent): harden recipient route resolution * fix(imessage): require canonical recipient handles * fix(agent): refine provider recipient exactness * fix(agent): bound direct alias session routing * fix(signal): preserve direct alias route type * fix(agent): honor binding-scoped recipient sessions * fix(routing): honor configured main session aliases * fix(clickclack): align account-owned session routes * fix(twitch): preserve canonical recipient sessions * fix(routing): isolate stable outbound identities * chore: defer recipient session changelog * fix(sms): use dedicated channel SDK facade --------- Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com> Co-authored-by: pingfanfan <pingfan.work@gmail.com>
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
// Whatsapp plugin module implements session route behavior.
|
|
import {
|
|
buildChannelOutboundSessionRoute,
|
|
type ChannelOutboundSessionRouteParams,
|
|
} from "openclaw/plugin-sdk/core";
|
|
import { resolveWhatsAppGroupSessionKey } from "./group-session-key.js";
|
|
import {
|
|
isWhatsAppGroupJid,
|
|
isWhatsAppNewsletterJid,
|
|
normalizeWhatsAppTarget,
|
|
} from "./normalize.js";
|
|
|
|
export function resolveWhatsAppOutboundSessionRoute(params: ChannelOutboundSessionRouteParams) {
|
|
const normalized = normalizeWhatsAppTarget(params.target);
|
|
if (!normalized) {
|
|
return null;
|
|
}
|
|
const isGroup = isWhatsAppGroupJid(normalized);
|
|
const isNewsletter = isWhatsAppNewsletterJid(normalized);
|
|
const chatType = isGroup ? "group" : isNewsletter ? "channel" : "direct";
|
|
const route = buildChannelOutboundSessionRoute({
|
|
cfg: params.cfg,
|
|
agentId: params.agentId,
|
|
channel: "whatsapp",
|
|
accountId: params.accountId,
|
|
recipientSessionExact: true,
|
|
peer: {
|
|
kind: chatType,
|
|
id: normalized,
|
|
},
|
|
chatType,
|
|
from: normalized,
|
|
to: normalized,
|
|
});
|
|
return isGroup
|
|
? {
|
|
...route,
|
|
sessionKey: resolveWhatsAppGroupSessionKey({
|
|
sessionKey: route.sessionKey,
|
|
accountId: params.accountId,
|
|
}),
|
|
}
|
|
: route;
|
|
}
|