refactor: dedupe provider channel readers

This commit is contained in:
Peter Steinberger
2026-04-07 07:59:44 +01:00
parent fca8ff5748
commit 90a45a4907
25 changed files with 99 additions and 59 deletions

View File

@@ -1,6 +1,7 @@
import fs from "node:fs/promises";
import { Static, Type } from "@sinclair/typebox";
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
import { normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
import type { AnyAgentTool, OpenClawPluginApi, OpenClawPluginToolContext } from "../api.js";
import { PlaywrightDiffScreenshotter, type DiffScreenshotter } from "./browser.js";
import { resolveDiffImageRenderOptions } from "./config.js";
@@ -469,9 +470,9 @@ function normalizeDiffInput(params: DiffsToolParams): DiffInput {
}
assertMaxBytes(before, "before", MAX_BEFORE_AFTER_BYTES);
assertMaxBytes(after, "after", MAX_BEFORE_AFTER_BYTES);
const path = params.path?.trim() || undefined;
const lang = params.lang?.trim() || undefined;
const title = params.title?.trim() || undefined;
const path = normalizeOptionalString(params.path);
const lang = normalizeOptionalString(params.lang);
const title = normalizeOptionalString(params.title);
if (path) {
assertMaxBytes(path, "path", MAX_PATH_BYTES);
}