refactor: share warning collector projections

This commit is contained in:
Peter Steinberger
2026-03-22 23:31:16 +00:00
parent 2cfc7bca10
commit 39faf4725d
8 changed files with 123 additions and 27 deletions

View File

@@ -9,7 +9,7 @@ import { createAccountStatusSink } from "openclaw/plugin-sdk/channel-lifecycle";
import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing";
import {
createOpenGroupPolicyRestrictSendersWarningCollector,
projectWarningCollector,
projectAccountWarningCollector,
} from "openclaw/plugin-sdk/channel-policy";
import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
import { createChatChannelPlugin } from "openclaw/plugin-sdk/core";
@@ -282,10 +282,10 @@ export const bluebubblesPlugin: ChannelPlugin<ResolvedBlueBubblesAccount, BlueBu
},
security: {
resolveDmPolicy: resolveBlueBubblesDmPolicy,
collectWarnings: projectWarningCollector(
({ account }: { account: ResolvedBlueBubblesAccount }) => account,
collectBlueBubblesSecurityWarnings,
),
collectWarnings: projectAccountWarningCollector<
ResolvedBlueBubblesAccount,
{ account: ResolvedBlueBubblesAccount }
>(collectBlueBubblesSecurityWarnings),
},
threading: {
buildToolContext: ({ context, hasRepliedRef }) => ({

View File

@@ -12,7 +12,7 @@ import type {
import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing";
import {
createAllowlistProviderGroupPolicyWarningCollector,
projectWarningCollector,
projectConfigAccountIdWarningCollector,
} from "openclaw/plugin-sdk/channel-policy";
import { createChatChannelPlugin } from "openclaw/plugin-sdk/core";
import {
@@ -963,13 +963,10 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount, FeishuProbeResul
},
},
security: {
collectWarnings: projectWarningCollector(
({ cfg, accountId }: { cfg: ClawdbotConfig; accountId?: string | null }) => ({
cfg,
accountId,
}),
collectFeishuSecurityWarnings,
),
collectWarnings: projectConfigAccountIdWarningCollector<{
cfg: ClawdbotConfig;
accountId?: string | null;
}>(collectFeishuSecurityWarnings),
},
pairing: {
text: {

View File

@@ -10,7 +10,7 @@ import {
} from "openclaw/plugin-sdk/channel-pairing";
import {
createAllowlistProviderOpenWarningCollector,
projectWarningCollector,
projectAccountConfigWarningCollector,
} from "openclaw/plugin-sdk/channel-policy";
import { createScopedAccountReplyToModeResolver } from "openclaw/plugin-sdk/conversation-runtime";
import { createChatChannelPlugin } from "openclaw/plugin-sdk/core";
@@ -411,11 +411,8 @@ export const matrixPlugin: ChannelPlugin<ResolvedMatrixAccount, MatrixProbe> =
},
security: {
resolveDmPolicy: resolveMatrixDmPolicy,
collectWarnings: projectWarningCollector(
({ account, cfg }: { account: ResolvedMatrixAccount; cfg: unknown }) => ({
account,
cfg: cfg as CoreConfig,
}),
collectWarnings: projectAccountConfigWarningCollector(
(cfg) => cfg as CoreConfig,
collectMatrixSecurityWarningsForAccount,
),
},

View File

@@ -9,7 +9,7 @@ import type {
import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing";
import {
createAllowlistProviderGroupPolicyWarningCollector,
projectWarningCollector,
projectConfigWarningCollector,
} from "openclaw/plugin-sdk/channel-policy";
import { createChatChannelPlugin } from "openclaw/plugin-sdk/core";
import {
@@ -475,8 +475,7 @@ export const msteamsPlugin: ChannelPlugin<ResolvedMSTeamsAccount, ProbeMSTeamsRe
},
},
security: {
collectWarnings: projectWarningCollector(
({ cfg }: { cfg: OpenClawConfig }) => ({ cfg }),
collectWarnings: projectConfigWarningCollector<{ cfg: OpenClawConfig }>(
collectMSTeamsSecurityWarnings,
),
},

View File

@@ -11,7 +11,7 @@ import {
import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
import {
createConditionalWarningCollector,
projectWarningCollector,
projectAccountWarningCollector,
} from "openclaw/plugin-sdk/channel-policy";
import { attachChannelToResult } from "openclaw/plugin-sdk/channel-send-result";
import { createChatChannelPlugin, type ChannelPlugin } from "openclaw/plugin-sdk/core";
@@ -262,10 +262,10 @@ export function createSynologyChatPlugin(): SynologyChatPlugin {
},
security: {
resolveDmPolicy: resolveSynologyChatDmPolicy,
collectWarnings: projectWarningCollector(
({ account }: { account: ResolvedSynologyChatAccount }) => account,
collectSynologyChatSecurityWarnings,
),
collectWarnings: projectAccountWarningCollector<
ResolvedSynologyChatAccount,
{ account: ResolvedSynologyChatAccount }
>(collectSynologyChatSecurityWarnings),
},
outbound: {
deliveryMode: "gateway" as const,