Tamir Duberstein
46aa019e80
Count serialized JSON bytes without allocating strings ( #40604 )
...
## Why
History estimation and executed-tool-call limits only need the size of serialized JSON, not the serialized output itself.
## What changed
- Add a shared `serialized_json_bytes` helper that streams JSON into a byte counter.
- Use it for response-item size estimates and executed-tool-call argument limits.
- Preserve serialization errors so callers can apply their existing fallback behavior.
## Testing
- Cover response-item sizing with escaped characters, newlines, and multibyte text.
GitOrigin-RevId: a4417996df96df5c51cae62830adc496912f69c7
2026-08-25 13:10:24 +00:00
..
2026-08-24 22:40:35 +00:00
2026-08-25 10:17:03 +00:00
2026-08-25 10:17:03 +00:00
2026-08-18 23:05:52 +00:00
2026-08-25 10:17:03 +00:00
2026-08-25 03:08:33 +00:00
2026-08-24 21:39:48 +00:00
2026-08-20 08:10:08 +00:00
2026-08-25 07:37:42 +00:00
2026-08-24 21:39:48 +00:00
2026-08-20 19:28:32 +00:00
2026-08-11 03:39:02 +00:00
2026-08-14 05:03:39 +00:00
2026-08-17 22:37:14 +00:00
2026-08-25 05:35:25 +00:00
2026-08-18 23:47:00 +00:00
2026-08-13 19:35:22 +00:00
2026-08-21 14:14:00 +00:00
2026-08-15 21:26:28 +00:00
2026-08-14 22:40:19 +00:00
2026-08-21 16:50:34 +00:00
2026-08-21 06:41:28 +00:00
2026-08-18 23:47:00 +00:00
2026-08-13 23:13:37 +00:00
2026-08-25 05:16:45 +00:00
2026-08-25 02:34:04 +00:00
2026-08-07 00:23:38 +00:00
2026-08-23 18:53:15 +00:00
2026-08-25 13:10:24 +00:00
2026-08-22 00:42:19 +00:00
2026-08-24 21:39:48 +00:00
2026-08-07 11:30:17 +00:00
2026-08-13 00:00:16 +00:00
2026-08-25 10:17:03 +00:00
2026-08-24 18:09:47 +00:00
2026-08-24 10:15:42 +00:00
2026-08-17 04:37:50 +00:00
2026-08-25 12:12:01 +00:00
2026-08-25 01:03:20 +00:00
2026-08-25 05:35:25 +00:00
2026-08-18 21:46:18 +00:00
2026-08-20 17:16:52 +00:00
2026-08-20 08:10:08 +00:00
2026-08-25 01:03:20 +00:00
2026-08-25 10:29:26 +00:00
2026-08-17 00:09:44 +00:00
2026-08-10 22:12:14 +00:00
2026-08-24 00:52:52 +00:00
2026-08-25 02:38:22 +00:00
2026-08-25 03:08:33 +00:00
2026-08-25 10:29:26 +00:00
2026-08-24 21:39:48 +00:00
2026-08-21 19:04:32 +00:00
2026-08-24 21:39:48 +00:00
2026-08-24 22:10:44 +00:00
2026-08-24 22:44:33 +00:00
2026-08-21 21:01:59 +00:00
2026-08-23 23:38:12 +00:00
2026-08-25 10:17:03 +00:00
2026-08-15 01:34:33 +00:00
2026-08-21 16:45:05 +00:00
2026-08-24 06:43:07 +00:00
2026-08-25 01:03:20 +00:00
2026-08-24 17:07:21 +00:00
2026-08-25 05:16:45 +00:00
2026-08-10 15:43:10 +00:00
2026-08-20 17:39:06 +00:00
2026-08-08 16:58:26 +00:00
2026-08-20 06:10:03 +00:00
2026-08-25 01:10:10 +00:00
2026-08-20 18:29:35 +00:00
2026-08-25 01:03:20 +00:00
2026-08-24 11:02:14 +00:00
2026-08-25 12:20:41 +00:00
2026-08-24 19:25:32 +00:00
2026-08-20 14:55:08 +00:00
2026-08-25 05:16:45 +00:00
2026-08-15 14:31:04 +00:00
2026-08-25 07:37:42 +00:00
2026-08-24 22:40:35 +00:00
2026-08-18 22:00:25 +00:00