agent: Fix a UTF-8 boundary panic in the agent streaming parser (#58432)

The parser stores emitted byte offsets between partial tool-call parses.
Because partial JSON can be repaired differently as more bytes arrive, a
byte offset that was valid in an earlier string can land inside a
multibyte character in a later string. We now normalize those offsets
with `find_char_boundary` before slicing.

Added property tests covering boundary-sensitive write/edit streaming
sequences to prevent regressions.

Fixes Sentry ZED-8Y1 / 7523469866.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed a crash that could occur while streaming agent edits containing
multibyte characters.
19b7625a67Anthony Eid committed on 6/3/2026, 3:49:01 PM· committed by GitHubparent0357c4a
3 files changedLine totals unavailable