mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(scripts): keep prompt capture previews UTF-16 safe (#112044)
Use the shared UTF-16 truncation helper so captured Anthropic system and user prompt previews never emit dangling surrogate halves.
This commit is contained in:
committed by
GitHub
parent
e679566a1c
commit
bb45edac3e
@@ -14,6 +14,7 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
import process from "node:process";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice";
|
||||
import type { AuthProfileCredential } from "../src/agents/auth-profiles.js";
|
||||
import {
|
||||
parseBooleanEnv,
|
||||
@@ -140,7 +141,7 @@ function summarizeText(text: string, max = 120): string {
|
||||
if (normalized.length <= max) {
|
||||
return normalized;
|
||||
}
|
||||
return `${normalized.slice(0, max - 1)}…`;
|
||||
return `${truncateUtf16Safe(normalized, max - 1)}…`;
|
||||
}
|
||||
|
||||
function summarizeCapture(
|
||||
|
||||
Reference in New Issue
Block a user