mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-26 18:31:34 +01:00
wrapDuplexChannelAsNodeDuplex checked the Node readable buffer and its own pending queue against the byte cap as two separate totals. A channel could hold up to twice the cap across the two buffers together. Replace both checks with one: retainedReadBytes() adds duplex.readableLength and the pending queue, and channel.onData tests that shared total against the cap before either the direct-push or the queue path runs. The two existing failure messages stay, chosen by whether the new chunk alone exceeds the cap. Co-authored-by: Paperclip <noreply@paperclip.ing>