Files
openclaw/extensions/synology-chat/src/session-key.ts
Peter Steinberger a2a68d154b fix(agent): preserve explicit recipient sessions (#101507)
* 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>
2026-07-07 10:07:13 +01:00

39 lines
1.2 KiB
TypeScript

// Synology Chat plugin module implements session key behavior.
import { buildAgentSessionKey } from "openclaw/plugin-sdk/routing";
const CHANNEL_ID = "synology-chat";
export function buildSynologyChatInboundSessionKey(params: {
agentId: string;
accountId: string;
userId: string;
identityLinks?: Record<string, string[]>;
}): string {
return buildAgentSessionKey({
agentId: params.agentId,
channel: CHANNEL_ID,
accountId: params.accountId,
peer: { kind: "direct", id: params.userId },
// Synology Chat supports multiple independent accounts on one gateway.
// Keep direct-message sessions isolated per account and user.
dmScope: "per-account-channel-peer",
identityLinks: params.identityLinks,
});
}
export function buildSynologyChatOutboundSessionKey(params: {
agentId: string;
accountId: string;
chatUserId: string;
}): string {
return buildAgentSessionKey({
agentId: params.agentId,
channel: CHANNEL_ID,
accountId: params.accountId,
// Chat API IDs and outgoing-webhook IDs are separate namespaces. Keep the
// outbound identity stable without ever claiming it is the inbound sender.
peer: { kind: "direct", id: `chat-api-${params.chatUserId}` },
dmScope: "per-account-channel-peer",
});
}