refactor: consolidate remaining coercion helpers (#122020)

This commit is contained in:
Peter Steinberger
2026-08-11 10:22:01 -07:00
committed by GitHub
parent 24bbb416b5
commit cad77fb39c
234 changed files with 1210 additions and 1572 deletions
+1 -4
View File
@@ -1,4 +1,5 @@
import { isRecord } from "@openclaw/normalization-core/record-coerce";
import { readNonBlankString as readNonEmptyString } from "@openclaw/normalization-core/string-coerce";
import { redactTranscriptMessage } from "../agents/transcript-redact.js";
import {
appendTranscriptMessage,
@@ -525,10 +526,6 @@ function isDeliveryMirrorAssistantMessage(message: SessionTranscriptAssistantMes
return message.provider === "openclaw" && message.model === "delivery-mirror";
}
function readNonEmptyString(value: unknown): string | undefined {
return typeof value === "string" && value.trim().length > 0 ? value : undefined;
}
function isAgentMessageRecord(value: unknown): value is AgentMessage & Record<string, unknown> {
return isRecord(value) && readNonEmptyString(value.role) !== undefined;
}