





















@@ -91,6 +91,25 @@ function isToolAllowedByFactoryAllowlist(toolName: string, allowlist?: string[])
9191return expanded.has("*") || expanded.has(normalizeToolName(toolName));
9292}
939394+function isToolDeniedByFactoryDenylist(toolName: string, denylist?: string[]): boolean {
95+if (!denylist || denylist.length === 0) {
96+return false;
97+}
98+const expanded = new Set(expandToolGroups(denylist));
99+return expanded.has("*") || expanded.has(normalizeToolName(toolName));
100+}
101+102+function isToolAllowedByFactoryPolicy(params: {
103+toolName: string;
104+allowlist?: string[];
105+denylist?: string[];
106+}): boolean {
107+if (isToolDeniedByFactoryDenylist(params.toolName, params.denylist)) {
108+return false;
109+}
110+return isToolAllowedByFactoryAllowlist(params.toolName, params.allowlist);
111+}
112+94113function resolveImageToolFactoryAvailable(params: {
95114config?: OpenClawConfig;
96115agentDir?: string;
@@ -159,21 +178,29 @@ function resolveOptionalMediaToolFactoryPlan(params: {
159178workspaceDir?: string;
160179authStore?: AuthProfileStore;
161180toolAllowlist?: string[];
181+toolDenylist?: string[];
162182}): OptionalMediaToolFactoryPlan {
163183const defaults = params.config?.agents?.defaults;
164-const allowImageGenerate = isToolAllowedByFactoryAllowlist(
165-"image_generate",
166-params.toolAllowlist,
167-);
168-const allowVideoGenerate = isToolAllowedByFactoryAllowlist(
169-"video_generate",
170-params.toolAllowlist,
171-);
172-const allowMusicGenerate = isToolAllowedByFactoryAllowlist(
173-"music_generate",
174-params.toolAllowlist,
175-);
176-const allowPdf = isToolAllowedByFactoryAllowlist("pdf", params.toolAllowlist);
184+const allowImageGenerate = isToolAllowedByFactoryPolicy({
185+toolName: "image_generate",
186+allowlist: params.toolAllowlist,
187+denylist: params.toolDenylist,
188+});
189+const allowVideoGenerate = isToolAllowedByFactoryPolicy({
190+toolName: "video_generate",
191+allowlist: params.toolAllowlist,
192+denylist: params.toolDenylist,
193+});
194+const allowMusicGenerate = isToolAllowedByFactoryPolicy({
195+toolName: "music_generate",
196+allowlist: params.toolAllowlist,
197+denylist: params.toolDenylist,
198+});
199+const allowPdf = isToolAllowedByFactoryPolicy({
200+toolName: "pdf",
201+allowlist: params.toolAllowlist,
202+denylist: params.toolDenylist,
203+});
177204const explicitImageGeneration = hasExplicitToolModelConfig(defaults?.imageGenerationModel);
178205const explicitVideoGeneration = hasExplicitToolModelConfig(defaults?.videoGenerationModel);
179206const explicitMusicGeneration = hasExplicitToolModelConfig(defaults?.musicGenerationModel);
@@ -256,6 +283,7 @@ export function createOpenClawTools(
256283sandboxed?: boolean;
257284config?: OpenClawConfig;
258285pluginToolAllowlist?: string[];
286+pluginToolDenylist?: string[];
259287/** Current channel ID for auto-threading. */
260288currentChannelId?: string;
261289/** Current thread timestamp for auto-threading. */
@@ -348,6 +376,7 @@ export function createOpenClawTools(
348376 workspaceDir,
349377authStore: options?.authProfileStore,
350378toolAllowlist: options?.pluginToolAllowlist,
379+toolDenylist: options?.pluginToolDenylist,
351380});
352381const imageToolAgentDir = options?.agentDir;
353382const imageTool = resolveImageToolFactoryAvailable({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。