mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
refactor: consolidate remaining coercion helpers (#122020)
This commit is contained in:
committed by
GitHub
parent
24bbb416b5
commit
cad77fb39c
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user