mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 12:24:59 +00:00
Channels: add per-group tool policies
This commit is contained in:
committed by
Peter Steinberger
parent
e51bf46abe
commit
c07949a99c
@@ -1,11 +1,13 @@
|
||||
import type { ChannelId } from "../channels/plugins/types.js";
|
||||
import { normalizeAccountId } from "../routing/session-key.js";
|
||||
import type { ClawdbotConfig } from "./config.js";
|
||||
import type { GroupToolPolicyConfig } from "./types.tools.js";
|
||||
|
||||
export type GroupPolicyChannel = ChannelId;
|
||||
|
||||
export type ChannelGroupConfig = {
|
||||
requireMention?: boolean;
|
||||
tools?: GroupToolPolicyConfig;
|
||||
};
|
||||
|
||||
export type ChannelGroupPolicy = {
|
||||
@@ -91,3 +93,15 @@ export function resolveChannelGroupRequireMention(params: {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function resolveChannelGroupToolsPolicy(params: {
|
||||
cfg: ClawdbotConfig;
|
||||
channel: GroupPolicyChannel;
|
||||
groupId?: string | null;
|
||||
accountId?: string | null;
|
||||
}): GroupToolPolicyConfig | undefined {
|
||||
const { groupConfig, defaultConfig } = resolveChannelGroupPolicy(params);
|
||||
if (groupConfig?.tools) return groupConfig.tools;
|
||||
if (defaultConfig?.tools) return defaultConfig.tools;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user