fix: align bluebubbles outbound group sessions
This commit is contained in:
@@ -68,6 +68,18 @@ describe("resolveOutboundSessionRoute", () => {
|
||||
expect(route?.sessionKey).toBe("agent:main:dm:alice");
|
||||
});
|
||||
|
||||
it("strips chat_* prefixes for BlueBubbles group session keys", async () => {
|
||||
const route = await resolveOutboundSessionRoute({
|
||||
cfg: baseConfig,
|
||||
channel: "bluebubbles",
|
||||
agentId: "main",
|
||||
target: "chat_guid:ABC123",
|
||||
});
|
||||
|
||||
expect(route?.sessionKey).toBe("agent:main:bluebubbles:group:abc123");
|
||||
expect(route?.from).toBe("group:ABC123");
|
||||
});
|
||||
|
||||
it("treats Zalo Personal DM targets as direct sessions", async () => {
|
||||
const cfg = { session: { dmScope: "per-channel-peer" } } as ClawdbotConfig;
|
||||
const route = await resolveOutboundSessionRoute({
|
||||
|
||||
@@ -545,9 +545,13 @@ function resolveBlueBubblesSession(
|
||||
lower.startsWith("chat_guid:") ||
|
||||
lower.startsWith("chat_identifier:") ||
|
||||
lower.startsWith("group:");
|
||||
const peerId = isGroup
|
||||
const rawPeerId = isGroup
|
||||
? stripKindPrefix(stripped)
|
||||
: stripped.replace(/^(imessage|sms|auto):/i, "");
|
||||
// BlueBubbles inbound group ids omit chat_* prefixes; strip them to align sessions.
|
||||
const peerId = isGroup
|
||||
? rawPeerId.replace(/^(chat_id|chat_guid|chat_identifier):/i, "")
|
||||
: rawPeerId;
|
||||
if (!peerId) return null;
|
||||
const peer: RoutePeer = {
|
||||
kind: isGroup ? "group" : "dm",
|
||||
|
||||
Reference in New Issue
Block a user