From e2c41df0b9eb5f70a998dcfdfa8f00152adb4f4b Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 6 Apr 2026 23:29:21 +0100 Subject: [PATCH] refactor: dedupe web fetch config reader --- src/agents/tools/web-fetch.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/agents/tools/web-fetch.ts b/src/agents/tools/web-fetch.ts index f23da643236..cbdbabfc766 100644 --- a/src/agents/tools/web-fetch.ts +++ b/src/agents/tools/web-fetch.ts @@ -6,6 +6,7 @@ import type { RuntimeWebFetchMetadata } from "../../secrets/runtime-web-tools.ty import { wrapExternalContent, wrapWebContent } from "../../security/external-content.js"; import { isRecord } from "../../utils.js"; import { resolveWebFetchDefinition } from "../../web-fetch/runtime.js"; +import { resolveWebProviderConfig } from "../../web/provider-runtime-shared.js"; import { stringEnum } from "../schema/typebox.js"; import type { AnyAgentTool } from "./common.js"; import { jsonResult, readNumberParam, readStringParam } from "./common.js"; @@ -69,11 +70,7 @@ type WebFetchConfig = NonNullable["web"] extends infer : undefined; function resolveFetchConfig(cfg?: OpenClawConfig): WebFetchConfig { - const fetch = cfg?.tools?.web?.fetch; - if (!fetch || typeof fetch !== "object") { - return undefined; - } - return fetch as WebFetchConfig; + return resolveWebProviderConfig<"fetch", NonNullable>(cfg, "fetch"); } function resolveFetchEnabled(params: { fetch?: WebFetchConfig; sandboxed?: boolean }): boolean {