feat(responses): opt in to incremental WebSocket text and tool snapshots (#3973)
WebSocket callers currently cannot inspect cumulative text and tool inputs when a stream omits the scaffolding required by HTTP/SSE accumulation. Adds an optional caller-fed `ResponsesWebSocketAccumulator` with immutable partial snapshots and a separate exact received terminal response. It handles sync and async connections, failed/incomplete results, empty versus omitted output and item corrections without owning a socket or running tools. Existing lane and SSE methods are unchanged. Known malformed text/tool fields are rejected before they can corrupt a snapshot. Raw events, missing/nullable fields on terminal responses, and unknown variants remain available to the caller. Validation: 190 WebSocket/accumulator and 23 Responses tests passed on each of Pydantic v1 and v2, full Ruff, mypy on src, Pyright. The nullable-content setup originally hit the environment's unsupported SOCKS proxy and passed using `NO_PROXY=*` for the local fixture tests. Cases cover independent interleaved lanes, malformed input, exact terminals and disposal/reuse.
M
Mark Stuart committed
d0207b48c043741ff483d7a8c945f8003d1ee714
Parent: 4ef4129
Committed by GitHub <noreply@github.com>
on 9/28/2026, 12:32:31 AM