feat(responses): preserve detailed WebSocket accumulator snapshots (#3981)
The opt-in Responses WebSocket accumulator currently retains selected text/tool fields but loses response metadata, streamed logprobs, citations and non-text parts. This adds `detailed_snapshot()`, an independent mutable view of observed fields and sparse indexed output/content/annotation rows. Existing immutable, hashable `snapshot()`, raw events, and the exact server terminal response keep their contracts. Done events replace supplied logprobs and whole part/item/response events replace the relevant projections. Missing and null are preserved, and unknown parts or tool fields remain provisional data instead of fabricated validated final models. Annotations only enrich a matching item on the bound lane; they cannot bind a turn or retire an unrelated item. The helper still never reads, sends, runs tools or changes sockets. Handwritten helper, docs and tests only. Validation: - Before change: 12 new real-wire tests failed. Review regressions reproduced: 8 failures (foreign or omitted annotation, null/missing content). - Current accumulator/session suite: 438 passed on each of Pydantic 1 and 2, sync and async local WebSockets. - SDK mypy: 1,865 files passed; Ruff and formatting pass. - Base's verified custom-code check: unchanged 7,826 / 10,000; no schema or generator change.
M
Mark Stuart committed
a380cf256abc2aa51cbf5d49437ae039b9aa9b12
Parent: 80e9686
Committed by GitHub <noreply@github.com>
on 9/28/2026, 3:05:59 PM