mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-30 00:21:34 +00:00
The streaming Responses-to-Anthropic converter emitted assistant text only from output_text.delta, so a stream carrying its answer on response.output_text.done or in the terminal response.output produced a protocol-valid message with no text. Record emitted text per output_text part in a ledger that survives content block closure, and recover only the suffix a finished payload adds, as #6629 does for function-call arguments. Where the part a payload finishes cannot be established, decline to recover rather than repeat delivered text: terminal recovery runs only when nothing was emitted, and a done payload indexed differently from every delta is ignored. Give output_text.done its own handler so the shared block-closing helper and its tool-path caller stay unchanged, and so a payload arriving after message_stop cannot open a content block past the end of the message.