refactor(plugins): consolidate record guards (#99361)

This commit is contained in:
Dallin Romney
2026-07-02 22:12:53 -07:00
committed by GitHub
parent 0e68c50139
commit de34dfdbe8
22 changed files with 23 additions and 90 deletions
@@ -2,6 +2,7 @@
* Runtime validators for Codex app-server protocol payloads, including schema
* normalization for generated JSON Schema before TypeBox compilation.
*/
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
import { Compile, type Validator as TypeBoxValidator } from "typebox/compile";
import dynamicToolCallParamsSchema from "./protocol-generated/json/DynamicToolCallParams.json" with { type: "json" };
import errorNotificationSchema from "./protocol-generated/json/v2/ErrorNotification.json" with { type: "json" };
@@ -40,10 +41,6 @@ function compileCodexSchema<T>(schema: unknown): CodexValidator<T> {
};
}
function isRecord(value: unknown): value is Record<string, unknown> {
return Boolean(value && typeof value === "object" && !Array.isArray(value));
}
const schemaMapKeywords = new Set([
"$defs",
"definitions",