refactor: share config adapter allowFrom and defaultTo helpers

This commit is contained in:
Peter Steinberger
2026-03-07 23:02:59 +00:00
parent feac26c3b7
commit 556aa8a702
17 changed files with 100 additions and 57 deletions

View File

@@ -1,6 +1,7 @@
import {
buildAccountScopedDmSecurityPolicy,
collectOpenGroupPolicyRestrictSendersWarnings,
mapAllowFromEntries,
} from "openclaw/plugin-sdk";
import {
buildChannelConfigSchema,
@@ -147,10 +148,10 @@ export const linePlugin: ChannelPlugin<ResolvedLineAccount> = {
tokenSource: account.tokenSource ?? undefined,
}),
resolveAllowFrom: ({ cfg, accountId }) =>
(
mapAllowFromEntries(
getLineRuntime().channel.line.resolveLineAccount({ cfg, accountId: accountId ?? undefined })
.config.allowFrom ?? []
).map((entry) => String(entry)),
.config.allowFrom,
),
formatAllowFrom: ({ allowFrom }) =>
allowFrom
.map((entry) => String(entry).trim())