An upstream that turns Responses into Chat itself (OpenDesign,
deepseek-v4.1-flash) passed output_index on as tool_calls[].index. With a
sentence of text first the calls came as 1,1,2,3, and a client that keeps
calls in an array by index broke on the whole turn. chatTidy's renumber
gave a call its upstream index unless another call had it; it now gives
each call the next index in the order calls start, so 1,2,3 is 0,1,2 and
the 0,0,1 case still is 0,1,2. A stream numbered from 0 in order is
unchanged. The Responses to Chat encoder (chatEncoder) and the Messages
and Gemini translations already count calls, not positions; plugin
streams go through chatTidy.
Run: TestChatTidyNumbersCallsFromZero (text then three parallel calls),
red with the old renumber (frames 1-5 kept 1,2,3), green with it; the
chatTidy tests; go test ./internal/gateway on mote; vet on darwin, linux
nogui and windows.
Not run: the full suite before the tag; a real OpenDesign account.