mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 07:07:39 +00:00
feat: add session.identityLinks for cross-platform DM session linking (#1033)
Co-authored-by: Shadow <shadow@clawd.bot>
This commit is contained in:
@@ -44,6 +44,42 @@ describe("resolveAgentRoute", () => {
|
||||
expect(route.sessionKey).toBe("agent:main:whatsapp:dm:+15551234567");
|
||||
});
|
||||
|
||||
test("identityLinks collapses per-peer DM sessions across providers", () => {
|
||||
const cfg: ClawdbotConfig = {
|
||||
session: {
|
||||
dmScope: "per-peer",
|
||||
identityLinks: {
|
||||
alice: ["telegram:111111111", "discord:222222222222222222"],
|
||||
},
|
||||
},
|
||||
};
|
||||
const route = resolveAgentRoute({
|
||||
cfg,
|
||||
channel: "telegram",
|
||||
accountId: null,
|
||||
peer: { kind: "dm", id: "111111111" },
|
||||
});
|
||||
expect(route.sessionKey).toBe("agent:main:dm:alice");
|
||||
});
|
||||
|
||||
test("identityLinks applies to per-channel-peer DM sessions", () => {
|
||||
const cfg: ClawdbotConfig = {
|
||||
session: {
|
||||
dmScope: "per-channel-peer",
|
||||
identityLinks: {
|
||||
alice: ["telegram:111111111", "discord:222222222222222222"],
|
||||
},
|
||||
},
|
||||
};
|
||||
const route = resolveAgentRoute({
|
||||
cfg,
|
||||
channel: "discord",
|
||||
accountId: null,
|
||||
peer: { kind: "dm", id: "222222222222222222" },
|
||||
});
|
||||
expect(route.sessionKey).toBe("agent:main:discord:dm:alice");
|
||||
});
|
||||
|
||||
test("peer binding wins over account binding", () => {
|
||||
const cfg: ClawdbotConfig = {
|
||||
bindings: [
|
||||
|
||||
Reference in New Issue
Block a user