mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-03 03:16:23 +00:00
16 lines
560 B
TypeScript
16 lines
560 B
TypeScript
import type { DmPolicy } from "openclaw/plugin-sdk/config-contracts";
|
|
import { addWildcardAllowFrom, normalizeAllowFromEntries } from "openclaw/plugin-sdk/setup";
|
|
import type { MatrixConfig } from "./types.js";
|
|
|
|
type MatrixDmAllowFrom = NonNullable<MatrixConfig["dm"]>["allowFrom"];
|
|
|
|
export function resolveMatrixSetupDmAllowFrom(
|
|
policy: DmPolicy,
|
|
allowFrom: MatrixDmAllowFrom,
|
|
): string[] {
|
|
if (policy === "open") {
|
|
return addWildcardAllowFrom(allowFrom);
|
|
}
|
|
return normalizeAllowFromEntries(allowFrom ?? []).filter((entry) => entry !== "*");
|
|
}
|