mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-30 21:23:35 +00:00
fix(imessage): coalesce merged text on UTF-16 code-point boundary
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// Imessage plugin module implements the same-sender inbound debounce merge.
|
||||
import { sliceUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
||||
import type { IMessagePayload } from "./types.js";
|
||||
|
||||
// Keep the merge contract narrow (caps, ID tracking, reply-context preference)
|
||||
@@ -136,7 +137,7 @@ export function combineIMessagePayloads(payloads: IMessagePayload[]): CoalescedI
|
||||
}
|
||||
let combinedText = textParts.join(" ");
|
||||
if (combinedText.length > MAX_COALESCED_TEXT_CHARS) {
|
||||
combinedText = `${combinedText.slice(0, MAX_COALESCED_TEXT_CHARS)}…[truncated]`;
|
||||
combinedText = `${sliceUtf16Safe(combinedText, 0, MAX_COALESCED_TEXT_CHARS)}…[truncated]`;
|
||||
}
|
||||
|
||||
// Merge attachments across bounded entries, capped to keep downstream media
|
||||
|
||||
Reference in New Issue
Block a user