

















@@ -94,6 +94,11 @@ function isToolAllowedByFactoryPolicy(params: {
9494});
9595}
969697+function mergeFactoryPolicyList(...lists: Array<string[] | undefined>): string[] | undefined {
98+const merged = lists.flatMap((list) => (Array.isArray(list) ? list : []));
99+return merged.length > 0 ? Array.from(new Set(merged)) : undefined;
100+}
101+97102function resolveImageToolFactoryAvailable(params: {
98103config?: OpenClawConfig;
99104agentDir?: string;
@@ -165,25 +170,27 @@ function resolveOptionalMediaToolFactoryPlan(params: {
165170toolDenylist?: string[];
166171}): OptionalMediaToolFactoryPlan {
167172const defaults = params.config?.agents?.defaults;
173+const toolAllowlist = mergeFactoryPolicyList(params.config?.tools?.allow, params.toolAllowlist);
174+const toolDenylist = mergeFactoryPolicyList(params.config?.tools?.deny, params.toolDenylist);
168175const allowImageGenerate = isToolAllowedByFactoryPolicy({
169176toolName: "image_generate",
170-allowlist: params.toolAllowlist,
171-denylist: params.toolDenylist,
177+allowlist: toolAllowlist,
178+denylist: toolDenylist,
172179});
173180const allowVideoGenerate = isToolAllowedByFactoryPolicy({
174181toolName: "video_generate",
175-allowlist: params.toolAllowlist,
176-denylist: params.toolDenylist,
182+allowlist: toolAllowlist,
183+denylist: toolDenylist,
177184});
178185const allowMusicGenerate = isToolAllowedByFactoryPolicy({
179186toolName: "music_generate",
180-allowlist: params.toolAllowlist,
181-denylist: params.toolDenylist,
187+allowlist: toolAllowlist,
188+denylist: toolDenylist,
182189});
183190const allowPdf = isToolAllowedByFactoryPolicy({
184191toolName: "pdf",
185-allowlist: params.toolAllowlist,
186-denylist: params.toolDenylist,
192+allowlist: toolAllowlist,
193+denylist: toolDenylist,
187194});
188195const explicitImageGeneration = hasExplicitToolModelConfig(defaults?.imageGenerationModel);
189196const explicitVideoGeneration = hasExplicitToolModelConfig(defaults?.videoGenerationModel);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。