mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 05:37:41 +00:00
feat(session): add dmScope for multi-user DM isolation
Co-authored-by: Alphonse-arianee <Alphonse-arianee@users.noreply.github.com>
This commit is contained in:
committed by
Peter Steinberger
parent
e6364d031d
commit
ca9688b5cc
@@ -18,6 +18,32 @@ describe("resolveAgentRoute", () => {
|
||||
expect(route.matchedBy).toBe("default");
|
||||
});
|
||||
|
||||
test("dmScope=per-peer isolates DM sessions by sender id", () => {
|
||||
const cfg: ClawdbotConfig = {
|
||||
session: { dmScope: "per-peer" },
|
||||
};
|
||||
const route = resolveAgentRoute({
|
||||
cfg,
|
||||
channel: "whatsapp",
|
||||
accountId: null,
|
||||
peer: { kind: "dm", id: "+15551234567" },
|
||||
});
|
||||
expect(route.sessionKey).toBe("agent:main:dm:+15551234567");
|
||||
});
|
||||
|
||||
test("dmScope=per-channel-peer isolates DM sessions per channel and sender", () => {
|
||||
const cfg: ClawdbotConfig = {
|
||||
session: { dmScope: "per-channel-peer" },
|
||||
};
|
||||
const route = resolveAgentRoute({
|
||||
cfg,
|
||||
channel: "whatsapp",
|
||||
accountId: null,
|
||||
peer: { kind: "dm", id: "+15551234567" },
|
||||
});
|
||||
expect(route.sessionKey).toBe("agent:main:whatsapp:dm:+15551234567");
|
||||
});
|
||||
|
||||
test("peer binding wins over account binding", () => {
|
||||
const cfg: ClawdbotConfig = {
|
||||
bindings: [
|
||||
|
||||
Reference in New Issue
Block a user