Files
openclaw/extensions/nextcloud-talk/src/session-route.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

45 lines
1.3 KiB
TypeScript

// Nextcloud Talk plugin module implements session route behavior.
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
import { buildOutboundBaseSessionKey } from "openclaw/plugin-sdk/routing";
import { stripNextcloudTalkTargetPrefix } from "./normalize.js";
type NextcloudTalkOutboundSessionRouteParams = {
cfg: OpenClawConfig;
agentId: string;
accountId?: string | null;
target: string;
};
export function resolveNextcloudTalkOutboundSessionRoute(
params: NextcloudTalkOutboundSessionRouteParams,
) {
const roomId = stripNextcloudTalkTargetPrefix(params.target);
if (!roomId) {
return null;
}
const baseSessionKey = buildOutboundBaseSessionKey({
cfg: params.cfg,
agentId: params.agentId,
channel: "nextcloud-talk",
accountId: params.accountId,
peer: {
kind: "group",
id: roomId,
},
});
return {
sessionKey: baseSessionKey,
baseSessionKey,
// Room tokens do not reveal whether inbound keys by room or sender id.
// Keep delivery behavior, but reject this route for explicit session selection.
recipientSessionExact: false,
peer: {
kind: "group" as const,
id: roomId,
},
chatType: "group" as const,
from: `nextcloud-talk:room:${roomId}`,
to: `nextcloud-talk:${roomId}`,
};
}