Files
openclaw/extensions/memory-core
xydt-tanshanshan 1d4d8474da [AI] fix(memory): use truncateUtf16Safe for dreaming snippet truncation (#101946)
* [AI] fix(memory): use truncateUtf16Safe for dreaming snippet truncation

Replace .slice(0, N) with truncateUtf16Safe() at 5 call sites in
dreaming-phases.ts so complex emoji and surrogate pairs near the
truncation boundary are not split into lone surrogates.

truncateUtf16Safe is the standard SDK helper, already used in
session-cost-usage, cron, exec-approval, and node-host modules
for the same purpose.

* [AI] fix(memory): use SDK facade import for truncateUtf16Safe, add surrogate-proof test

Replace direct @openclaw/normalization-core/utf16-slice import with
openclaw/plugin-sdk/memory-core-host-engine-foundation SDK facade,
matching manager-search.ts in the same extension.

Add surrogate-proof.test.ts that runs a full dreaming ingestion sweep
with emoji at the 280-char boundary and verifies zero lone surrogates.

* [AI] fix(memory-proof): use relative imports in surrogate-proof test

* [AI] fix(memory-proof): place emoji at post-prefix 280-char boundary, assert session corpus file

* [AI] fix(memory-proof): avoid unnecessary String callback in oxlint

* [AI] fix(memory-proof): add curly braces per eslint curly rule

* [AI] feat(proof): add standalone dreaming surrogate truncation proof script

* [AI] chore(proof): remove unused SQLite-dependent proof script

* [AI] fix(proof): correct emoji boundary placement for all 5 call sites

* [AI] fix(proof): add curly braces per eslint curly rule in proof script

* [AI] fix(proof): session emoji at actual corpus 280-char boundary

* test: streamline memory dreaming UTF-16 coverage

---------

Co-authored-by: hailory <hailory@xydigit.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-09 05:40:22 +01:00
..
2026-06-04 21:40:44 -04:00