Skip to content

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

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

chore: sync core lib and CLAUDE.md from agent-core#20
avifenesh merged 1 commit into
mainfrom
chore/sync-core-debate-20260426-145624

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: truncate now handles non-positive lengths and avoids breaking surrogate pairs when truncating emoji/Unicode, but could slightly change truncation behavior/perf for callers.

Overview
Updates truncate in lib/cross-platform/index.js to truncate by Unicode code points (avoiding orphan surrogate pairs for emoji) and to treat maxLength <= 0 as a no-op.

Also clarifies the function’s JSDoc to document code-point semantics and the new edge-case behavior.

Reviewed by Cursor Bugbot for commit 01d7166. 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!

@avifenesh avifenesh merged commit 5d9e691 into main Apr 26, 2026
5 checks passed
@avifenesh avifenesh deleted the chore/sync-core-debate-20260426-145624 branch April 26, 2026 14:59
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 01d7166. 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

The truncate function doesn't correctly truncate when maxLength is 1 or 2. When maxLength - 3 is negative, Array.prototype.slice treats it as an offset from the end of the array, unlike String.prototype.substring. This returns nearly the entire original string plus an ellipsis, violating the truncation contract.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 01d7166. Configure here.

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