refactor: plugin catalog + nextcloud policy

This commit is contained in:
Peter Steinberger
2026-01-20 11:11:42 +00:00
parent 9ec1fb4a80
commit 660f87278c
33 changed files with 2865 additions and 213 deletions

View File

@@ -150,6 +150,7 @@ describe("getDmHistoryLimitFromSessionKey", () => {
"signal",
"imessage",
"msteams",
"nextcloud-talk",
] as const;
for (const provider of providers) {
@@ -168,6 +169,7 @@ describe("getDmHistoryLimitFromSessionKey", () => {
"signal",
"imessage",
"msteams",
"nextcloud-talk",
] as const;
for (const provider of providers) {

View File

@@ -62,22 +62,16 @@ export function getDmHistoryLimitFromSessionKey(
return providerConfig.dmHistoryLimit;
};
switch (provider) {
case "telegram":
return getLimit(config.channels?.telegram);
case "whatsapp":
return getLimit(config.channels?.whatsapp);
case "discord":
return getLimit(config.channels?.discord);
case "slack":
return getLimit(config.channels?.slack);
case "signal":
return getLimit(config.channels?.signal);
case "imessage":
return getLimit(config.channels?.imessage);
case "msteams":
return getLimit(config.channels?.msteams);
default:
return undefined;
}
const resolveProviderConfig = (
cfg: ClawdbotConfig | undefined,
providerId: string,
): { dmHistoryLimit?: number; dms?: Record<string, { historyLimit?: number }> } | undefined => {
const channels = cfg?.channels;
if (!channels || typeof channels !== "object") return undefined;
const entry = (channels as Record<string, unknown>)[providerId];
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return undefined;
return entry as { dmHistoryLimit?: number; dms?: Record<string, { historyLimit?: number }> };
};
return getLimit(resolveProviderConfig(config, provider));
}