SDK: break channel plugin import cycle

This commit is contained in:
Jacob Tomlinson
2026-03-27 19:00:57 +00:00
parent 80d1e8a11a
commit fef1b1918c
2 changed files with 18 additions and 7 deletions

View File

@@ -4,11 +4,7 @@ import {
createScopedChannelConfigAdapter,
} from "openclaw/plugin-sdk/channel-config-helpers";
import { createRestrictSendersChannelSecurity } from "openclaw/plugin-sdk/channel-policy";
import {
createChannelPluginBase,
getChatChannelMeta,
type ChannelPlugin,
} from "openclaw/plugin-sdk/core";
import { createChannelPluginBase } from "openclaw/plugin-sdk/core";
import { normalizeE164 } from "openclaw/plugin-sdk/text-runtime";
import {
listSignalAccountIds,
@@ -17,6 +13,7 @@ import {
type ResolvedSignalAccount,
} from "./accounts.js";
import { SignalChannelConfigSchema } from "./config-schema.js";
import { getChatChannelMeta, type ChannelPlugin } from "./runtime-api.js";
import { createSignalSetupWizardProxy } from "./setup-core.js";
export const SIGNAL_CHANNEL = "signal" as const;

View File

@@ -1,4 +1,5 @@
import { getChatChannelMeta } from "../channels/chat-meta.js";
import { buildAccountScopedDmSecurityPolicy } from "../channels/plugins/helpers.js";
import {
createScopedAccountReplyToModeResolver,
createTopLevelChannelReplyToModeResolver,
@@ -22,7 +23,6 @@ import type { OutboundDeliveryResult } from "../infra/outbound/deliver.js";
import { emptyPluginConfigSchema } from "../plugins/config-schema.js";
import type { PluginRuntime } from "../plugins/runtime/types.js";
import type { OpenClawPluginApi, OpenClawPluginConfigSchema } from "../plugins/types.js";
import { createScopedDmSecurityResolver } from "./channel-config-helpers.js";
export type {
AnyAgentTool,
@@ -428,7 +428,21 @@ function resolveChatChannelSecurity<TResolvedAccount extends { accountId?: strin
return security;
}
return {
resolveDmPolicy: createScopedDmSecurityResolver<TResolvedAccount>(security.dm),
resolveDmPolicy: ({ cfg, accountId, account }) =>
buildAccountScopedDmSecurityPolicy({
cfg,
channelKey: security.dm.channelKey,
accountId,
fallbackAccountId: security.dm.resolveFallbackAccountId?.(account) ?? account.accountId,
policy: security.dm.resolvePolicy(account),
allowFrom: security.dm.resolveAllowFrom(account) ?? [],
defaultPolicy: security.dm.defaultPolicy,
allowFromPathSuffix: security.dm.allowFromPathSuffix,
policyPathSuffix: security.dm.policyPathSuffix,
approveChannelId: security.dm.approveChannelId,
approveHint: security.dm.approveHint,
normalizeEntry: security.dm.normalizeEntry,
}),
...(security.collectWarnings ? { collectWarnings: security.collectWarnings } : {}),
};
}