refactor: dedupe web fetch record helper

This commit is contained in:
Peter Steinberger
2026-04-06 23:28:41 +01:00
parent 0fdb176465
commit 49aef60447

View File

@@ -4,6 +4,7 @@ import { SsrFBlockedError, type LookupFn } from "../../infra/net/ssrf.js";
import { logDebug } from "../../logger.js";
import type { RuntimeWebFetchMetadata } from "../../secrets/runtime-web-tools.types.js";
import { wrapExternalContent, wrapWebContent } from "../../security/external-content.js";
import { isRecord } from "../../utils.js";
import { resolveWebFetchDefinition } from "../../web-fetch/runtime.js";
import { stringEnum } from "../schema/typebox.js";
import type { AnyAgentTool } from "./common.js";
@@ -248,10 +249,6 @@ type WebFetchRuntimeParams = {
resolveProviderFallback: () => ReturnType<typeof resolveWebFetchDefinition>;
};
function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null && !Array.isArray(value);
}
function normalizeProviderFinalUrl(value: unknown): string | undefined {
if (typeof value !== "string") {
return undefined;