Skip to content

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

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

chore: sync core lib and CLAUDE.md from agent-core#30
avifenesh merged 1 commit into
mainfrom
chore/sync-core-sync-docs-20260426-145627

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, but it may slightly alter truncated output for strings containing emoji/surrogate pairs and for maxLength <= 0 inputs.

Overview
Improves truncate in lib/cross-platform/index.js to truncate by Unicode code points instead of UTF-16 code units, preventing broken surrogate pairs (e.g., emoji) in ellipsized text.

Adds a guard to leave strings unchanged when maxLength <= 0, and updates the function’s documentation to reflect the new behavior and length semantics.

Reviewed by Cursor Bugbot for commit 1b912a5. Configure here.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

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 4e84240 into main Apr 26, 2026
5 checks passed
@avifenesh avifenesh deleted the chore/sync-core-sync-docs-20260426-145627 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 1b912a5. 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 index causes output longer than input

High Severity

The truncate function can return strings longer than the original when maxLength is 1 or 2. This happens because maxLength - 3 becomes negative, causing Array.prototype.slice to interpret the end index as an offset from the array's end. The previous String.prototype.substring clamped negative values, avoiding this issue, and the maxLength <= 0 guard doesn't cover these small positive values.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1b912a5. 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