Opus finding
types.ts comment 'Must perfectly match concatenated streamed chunks' is not enforced and currently violated on abort
lowdocs-gaphigh
- src/providers/types.ts:27-33
- src/providers/anthropic.ts:116-134
Comment claims final UnifiedResponse.text/thinking must match the concatenation of streamed chunks. In the abort path of Anthropic, the function returns whatever was accumulated, which DOES match concatenated chunks — but only if onTextDelta callbacks didn't throw. In the success path, the code returns the locally-accumulated string rather than reading from finalMessage.content, which is correct but undocumented. The comment is a strong invariant that needs either enforcement or a softer rewording, especially when finalMessage from Anthropic may include cached or transformed final text different from raw deltas.
Recommendation
Document that responseText is the deterministic source of truth; clarify mismatch behavior.