feat: unify provider history context

This commit is contained in:
Peter Steinberger
2026-01-10 18:53:33 +01:00
parent 8c1d39064d
commit d41372b9d9
19 changed files with 718 additions and 80 deletions

View File

@@ -1225,6 +1225,34 @@ describe("legacy config detection", () => {
}
});
it("accepts historyLimit overrides per provider and account", async () => {
vi.resetModules();
const { validateConfigObject } = await import("./config.js");
const res = validateConfigObject({
messages: { groupChat: { historyLimit: 12 } },
whatsapp: { historyLimit: 9, accounts: { work: { historyLimit: 4 } } },
telegram: { historyLimit: 8, accounts: { ops: { historyLimit: 3 } } },
slack: { historyLimit: 7, accounts: { ops: { historyLimit: 2 } } },
signal: { historyLimit: 6 },
imessage: { historyLimit: 5 },
msteams: { historyLimit: 4 },
discord: { historyLimit: 3 },
});
expect(res.ok).toBe(true);
if (res.ok) {
expect(res.config.whatsapp?.historyLimit).toBe(9);
expect(res.config.whatsapp?.accounts?.work?.historyLimit).toBe(4);
expect(res.config.telegram?.historyLimit).toBe(8);
expect(res.config.telegram?.accounts?.ops?.historyLimit).toBe(3);
expect(res.config.slack?.historyLimit).toBe(7);
expect(res.config.slack?.accounts?.ops?.historyLimit).toBe(2);
expect(res.config.signal?.historyLimit).toBe(6);
expect(res.config.imessage?.historyLimit).toBe(5);
expect(res.config.msteams?.historyLimit).toBe(4);
expect(res.config.discord?.historyLimit).toBe(3);
}
});
it('rejects imessage.dmPolicy="open" without allowFrom "*"', async () => {
vi.resetModules();
const { validateConfigObject } = await import("./config.js");