feat: move group mention gating to provider groups

This commit is contained in:
Peter Steinberger
2026-01-02 22:23:00 +01:00
parent e93102b276
commit 5cf1a9535e
27 changed files with 613 additions and 50 deletions

View File

@@ -59,10 +59,10 @@ async function waitForSubscribe() {
beforeEach(() => {
config = {
imessage: {},
imessage: { groups: { "*": { requireMention: true } } },
session: { mainKey: "main" },
routing: {
groupChat: { mentionPatterns: ["@clawd"], requireMention: true },
groupChat: { mentionPatterns: ["@clawd"] },
allowFrom: [],
},
};
@@ -106,6 +106,35 @@ describe("monitorIMessageProvider", () => {
expect(sendMock).not.toHaveBeenCalled();
});
it("allows group messages when imessage groups default disables mention gating", async () => {
config = {
...config,
imessage: { groups: { "*": { requireMention: false } } },
};
const run = monitorIMessageProvider();
await waitForSubscribe();
notificationHandler?.({
method: "message",
params: {
message: {
id: 11,
chat_id: 123,
sender: "+15550001111",
is_from_me: false,
text: "hello group",
is_group: true,
},
},
});
await flush();
closeResolve?.();
await run;
expect(replyMock).toHaveBeenCalled();
});
it("delivers group replies when mentioned", async () => {
replyMock.mockResolvedValueOnce({ text: "yo" });
const run = monitorIMessageProvider();