Skip to content

chore: sync core lib and CLAUDE.md from agent-core#16

Merged
avifenesh merged 1 commit into
mainfrom
chore/sync-core-learn-20260426-145626
Apr 26, 2026
Merged

chore: sync core lib and CLAUDE.md from agent-core#16
avifenesh merged 1 commit into
mainfrom
chore/sync-core-learn-20260426-145626

Conversation

@avifenesh
Copy link
Copy Markdown
Contributor

@avifenesh avifenesh commented Apr 26, 2026

Automated sync of lib/ and CLAUDE.md from agent-core.


Note

Low Risk
Low risk utility change limited to truncate, adjusting string length semantics to Unicode code points and adding a guard for maxLength <= 0; potential minor behavior differences for callers relying on UTF-16 length.

Overview
Updates truncate in lib/cross-platform/index.js to truncate by Unicode code points (avoiding broken surrogate pairs like emoji) instead of UTF-16 code units, and to return the input unchanged when maxLength <= 0. Documentation is updated to reflect the new semantics.

Reviewed by Cursor Bugbot for commit 7e41029. Configure here.

@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7e41029. Configure here.

if (maxLength <= 0) return text;
const codePoints = [...text];
if (codePoints.length <= maxLength) return text;
return codePoints.slice(0, maxLength - 3).join('') + '...';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Negative slice end produces oversized output

Medium Severity

When maxLength is 1 or 2, maxLength - 3 is negative, and Array.prototype.slice treats negative end indices as offsets from the array end (unlike String.prototype.substring, which clamped them to 0). The result keeps almost all of the original code points and appends '...', producing output far longer than maxLength and even longer than the input string.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7e41029. Configure here.

@avifenesh avifenesh merged commit 6f86a45 into main Apr 26, 2026
7 checks passed
@avifenesh avifenesh deleted the chore/sync-core-learn-20260426-145626 branch April 26, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant