Skip to content

Commit eec70a1

Browse files
committed
fix(active-memory): use truncateUtf16Safe for log value and search query truncation
1 parent 3f2466c commit eec70a1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

extensions/active-memory/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ function toSingleLineLogValue(value: unknown): string {
14341434
.replace(/\s+/g, " ")
14351435
.trim();
14361436
return singleLine.length > MAX_LOG_VALUE_CHARS
1437-
? `${singleLine.slice(0, MAX_LOG_VALUE_CHARS)}...`
1437+
? `${truncateUtf16Safe(singleLine, MAX_LOG_VALUE_CHARS)}...`
14381438
: singleLine;
14391439
}
14401440

@@ -2711,7 +2711,7 @@ function normalizeSearchQueryText(text: string): string {
27112711
function clampSearchQuery(text: string): string {
27122712
const normalized = text.replace(/\s+/g, " ").trim();
27132713
return normalized.length > MAX_ACTIVE_MEMORY_SEARCH_QUERY_CHARS
2714-
? normalized.slice(0, MAX_ACTIVE_MEMORY_SEARCH_QUERY_CHARS).trim()
2714+
? truncateUtf16Safe(normalized, MAX_ACTIVE_MEMORY_SEARCH_QUERY_CHARS).trim()
27152715
: normalized;
27162716
}
27172717

0 commit comments

Comments
 (0)